Documentation
¶
Overview ¶
Package slackbot provides a wrapper around official slack library to simplify building a slack bot. bot uses the slack RTM API. Refer https://api.slack.com/bot-users#creating-bot-user
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNotMatch = errors.New("no match")
ErrNotMatch can be returned by MessageHandler to indicate that handler cannot process the message event.
Functions ¶
func AddressUser ¶
AddressUser creates the escape sequence for marking a user in a message.
Types ¶
type Bot ¶
type Bot struct {
// configurations
Handler Handler
GroupSupport bool
// contains filtered or unexported fields
}
Bot represents an RTM connection based Slack Bot instance.
func New ¶
New initializes a Slack Bot instance using RTM API. New does not connect to slack API until Listen() is invoked.
func (*Bot) Listen ¶
Listen connects to slack and starts the RTM event connection. Blocks until an unrecoverable error occurs.
func (*Bot) Self ¶
func (bot *Bot) Self() slack.UserDetails
Self returns details about the currently connected bot user.
type LuaHandler ¶
type LuaHandler struct {
InitFile string
HandlerFunc string
// contains filtered or unexported fields
}
LuaHandler implements the Bot handler using a lua scripting layer.
func (*LuaHandler) Handle ¶
func (h *LuaHandler) Handle(bot *Bot, msg slack.MessageEvent, from slack.User) error