Documentation ¶
Overview ¶
Package bot defines a basic slack bot that can listen for app mention events for our bot and send the message to a handler to handle the interaction.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bot ¶
type Bot struct {
// contains filtered or unexported fields
}
Bot provides a slack bot for listening to slack channels.
func (*Bot) Register ¶
func (b *Bot) Register(r *regexp.Regexp, h HandleFunc)
Register registers a function for handling a message to the bot. The regex is checked in the order that it is added. A nil regexp is considered the default handler. Only 1 default handler can be added and is always the choice of last resort.
type HandleFunc ¶
HandleFunc receive the user who sent a message and the message. It can then use api or client to respond to said message.
type Message ¶
type Message struct { // User has the user information on who mentioned the bot. User *slack.User // AppMention gives information on the event. AppMention *slackevents.AppMentionEvent // Text gives the text of the message without the @User stuff. If you want the full message, see AppMention. Text string }
Message details information about a message that was sent in an AppMention event.