Talbot is a basic chat bot (robot) written in Go that listens and responds to Slack messages.
To make use of Talbot, you will need to setup a user account or a 'bot' user (a special kind of user account specifically designed for programatic access to APIs) and obtain an authentication token from Slack.
Once you have a user account and an authentication token you can connect Talbot to slack. Simply paste the authentication token into the slack.token file in the same directory as the executable.
Talbot can be given any name within Slack - he will use and respond to whatever nick/username is registered for the bot account within Slack. For the purposes of the examples below, we have assumed talbot has been used as the nick in Slack.
Talbot can be extended by registering additional actions as follows.
package main
import "github.com/james-bowman/talbot/brain"
func init() {
brain.Register(brain.Action{
Regex: regexp.MustCompile("(?i)open the pod bay doors"),
Usage: "open the pod bay doors",
Description: "Opens the bay doors",
Answerer: func(dummy string) string {
return "I'm sorry Dave, I can't do that right now."
},
})
}
This registers an action that will be executed when any user directs the message open the pod bay doors
at the bot i.e.
@talbot: open the pod bay doors
in an open channel or simply
open the pod bay doors
as a Direct Message to Talbot.
Out of the box, Talbot supports the following commands:
help
- Reply with instructionsping
- Reply with ponghello
- Reply with a random greetingthe rules
- Make sure talbot knows the rulesimage me <search expression>
- Queries Google Images and returns a random matching imageanimate me <search expression>
- Likeanimate me
except looks for animated GIFsmustache me <seach expression or URL>
- Adds a mustache to the image matched by Google Image search or to the image explicitly specified by URL.