Documentation
¶
Overview ¶
Package slack exposes the Slack (Socket Mode) constructor and the raw-event and client accessors for botbooter. Import it for a Slack bot; a Slack-only binary pulls in slack-go but never discordgo or go-telegram.
Index ¶
- Variables
- func Client(b *botbooter.Bot) *slackapi.Client
- func New(cfg Config) (*botbooter.Bot, error)
- func RawEvent(m *botbooter.Message) (*slackevents.MessageEvent, bool)
- func RawReaction(r *botbooter.Reaction) (*slackevents.ReactionAddedEvent, bool)
- func SocketClient(b *botbooter.Bot) *socketmode.Client
- type Config
Constants ¶
This section is empty.
Variables ¶
var ErrMissingConfig = slackint.ErrMissingConfig
ErrMissingConfig is returned by New when a required Config field is empty.
Functions ¶
func New ¶
New creates a Slack bot that connects via Socket Mode. It returns ErrMissingConfig if a required config field is missing.
func RawEvent ¶
func RawEvent(m *botbooter.Message) (*slackevents.MessageEvent, bool)
RawEvent returns the raw Slack message event carried on m, reporting whether m originated from Slack.
func RawReaction ¶ added in v0.4.0
func RawReaction(r *botbooter.Reaction) (*slackevents.ReactionAddedEvent, bool)
RawReaction returns the raw Slack reaction event carried on r, reporting whether r originated from Slack. Its Reaction field is the platform's original bare shortname ("thumbsup") behind r.Emoji's colon-wrapped ":thumbsup:".
func SocketClient ¶
func SocketClient(b *botbooter.Bot) *socketmode.Client
SocketClient returns the Socket Mode client backing b, or nil if b is not a Slack bot.