Documentation
¶
Overview ¶
Package slackbot is a callback-based Slack Bot framework for Go.
For more information visit https://github.com/bushelpowered/slackbot
Index ¶
- Variables
- type AppHomeOpenedEventCallback
- type AppHomeOpenedEventContainer
- type AppMentionEventCallback
- type AppMentionEventContainer
- type AppUninstalledEventCallback
- type AppUninstalledEventContainer
- type BlockActionFilter
- type Bot
- func (b *Bot) Api() *slack.Client
- func (b *Bot) Boot(listenAddr string) error
- func (b *Bot) BootWithEngine(listenAddr string, engine *gin.Engine) error
- func (b *Bot) RegisterAppHomeOpenedEvent(callback AppHomeOpenedEventCallback)
- func (b *Bot) RegisterAppMentionEvent(callback AppMentionEventCallback)
- func (b *Bot) RegisterAppUninstalledEvent(callback AppUninstalledEventCallback)
- func (b *Bot) RegisterBlockActionsInteraction(filter BlockActionFilter, callback InteractionCallback)
- func (b *Bot) RegisterCommand(name string, callback CommandCallback)
- func (b *Bot) RegisterGridMigrationFinishedEvent(callback GridMigrationFinishedEventCallback)
- func (b *Bot) RegisterGridMigrationStartedEvent(callback GridMigrationStartedEventCallback)
- func (b *Bot) RegisterKeyword(regex *regexp.Regexp, callback KeywordCallback)
- func (b *Bot) RegisterLinkSharedEvent(callback LinkSharedEventCallback)
- func (b *Bot) RegisterMemberJoinedChannelEvent(callback MemberJoinedChannelEventCallback)
- func (b *Bot) RegisterMemberLeftChannelEvent(callback MemberLeftChannelEventCallback)
- func (b *Bot) RegisterMessageActionInteraction(callbackId string, callback InteractionCallback)
- func (b *Bot) RegisterMessageEvent(callback MessageEventCallback)
- func (b *Bot) RegisterPinAddedEvent(callback PinAddedEventCallback)
- func (b *Bot) RegisterPinRemovedEvent(callback PinRemovedEventCallback)
- func (b *Bot) RegisterReactionAddedEvent(callback ReactionAddedEventCallback)
- func (b *Bot) RegisterReactionRemovedEvent(callback ReactionRemovedEventCallback)
- func (b *Bot) RegisterSelectOptionGroups(callbackId string, callback SelectMenuOptionsGroupCallback)
- func (b *Bot) RegisterSelectOptions(callbackId string, callback SelectMenuOptionsCallback)
- func (b *Bot) RegisterShortcutInteraction(callbackId string, callback InteractionCallback)
- func (b *Bot) RegisterTokensRevokedEvent(callback TokensRevokedEventCallback)
- func (b *Bot) RegisterViewClosedInteraction(callbackId string, callback InteractionCallback)
- func (b *Bot) RegisterViewSubmissionInteraction(callbackId string, callback ViewSubmissionInteractionCallback)
- func (b *Bot) SetLogger(logger *logrus.Logger)
- func (b *Bot) Shutdown(timeout time.Duration)
- type CommandCallback
- type GridMigrationFinishedEventCallback
- type GridMigrationFinishedEventContainer
- type GridMigrationStartedEventCallback
- type GridMigrationStartedEventContainer
- type InteractionCallback
- type KeywordCallback
- type LinkSharedEventCallback
- type LinkSharedEventContainer
- type MemberJoinedChannelEventCallback
- type MemberJoinedChannelEventContainer
- type MemberLeftChannelEventCallback
- type MemberLeftChannelEventContainer
- type MessageEventCallback
- type MessageEventContainer
- type PinAddedEventCallback
- type PinAddedEventContainer
- type PinRemovedEventCallback
- type PinRemovedEventContainer
- type ReactionAddedEventCallback
- type ReactionAddedEventContainer
- type ReactionRemovedEventCallback
- type ReactionRemovedEventContainer
- type SelectMenuOptionsCallback
- type SelectMenuOptionsGroupCallback
- type TokensRevokedEventCallback
- type TokensRevokedEventContainer
- type ViewSubmissionInteractionCallback
Constants ¶
This section is empty.
Variables ¶
var ErrAlreadyBooted = errors.New("bot already booted")
var ErrBadPayload = errors.New("bad payload")
var ErrEmptyPayload = errors.New("empty payload")
var ErrUnknownOptionsCallback = errors.New("unknown options callback")
Functions ¶
This section is empty.
Types ¶
type AppHomeOpenedEventCallback ¶
type AppHomeOpenedEventCallback = func(bot *Bot, c AppHomeOpenedEventContainer)
type AppHomeOpenedEventContainer ¶
type AppHomeOpenedEventContainer struct {
APIEvent slackevents.EventsAPIEvent
Event slackevents.AppHomeOpenedEvent
}
type AppMentionEventCallback ¶
type AppMentionEventCallback = func(bot *Bot, c AppMentionEventContainer)
type AppMentionEventContainer ¶
type AppMentionEventContainer struct {
APIEvent slackevents.EventsAPIEvent
Event slackevents.AppMentionEvent
}
type AppUninstalledEventCallback ¶
type AppUninstalledEventCallback = func(bot *Bot, c AppUninstalledEventContainer)
type AppUninstalledEventContainer ¶
type AppUninstalledEventContainer struct {
APIEvent slackevents.EventsAPIEvent
Event slackevents.AppUninstalledEvent
}
type BlockActionFilter ¶
Filter for RegisterBlockActionsInteraction
- specify an ActionID to filter for only certain actions
- specify a BlockID for filter for only certain blocks
type Bot ¶
func (*Bot) BootWithEngine ¶
Start the bot on the given listen address with a pre-configured instance of gin.Engine.
func (*Bot) RegisterAppHomeOpenedEvent ¶
func (b *Bot) RegisterAppHomeOpenedEvent(callback AppHomeOpenedEventCallback)
Register a callback for app_home_opened events
func (*Bot) RegisterAppMentionEvent ¶
func (b *Bot) RegisterAppMentionEvent(callback AppMentionEventCallback)
Register a callback for app_mention events
func (*Bot) RegisterAppUninstalledEvent ¶
func (b *Bot) RegisterAppUninstalledEvent(callback AppUninstalledEventCallback)
Register a callback for app_uninstalled events
func (*Bot) RegisterBlockActionsInteraction ¶
func (b *Bot) RegisterBlockActionsInteraction(filter BlockActionFilter, callback InteractionCallback)
Register a callback for block_actions interactions with a specified BlockActionFilter
func (*Bot) RegisterCommand ¶
func (b *Bot) RegisterCommand(name string, callback CommandCallback)
Register a slash command callback
func (*Bot) RegisterGridMigrationFinishedEvent ¶
func (b *Bot) RegisterGridMigrationFinishedEvent(callback GridMigrationFinishedEventCallback)
Register a callback for grid_migration_finished events
func (*Bot) RegisterGridMigrationStartedEvent ¶
func (b *Bot) RegisterGridMigrationStartedEvent(callback GridMigrationStartedEventCallback)
Register a callback for grid_migration_started events
func (*Bot) RegisterKeyword ¶
func (b *Bot) RegisterKeyword(regex *regexp.Regexp, callback KeywordCallback)
Register a message event keyword regex callback.
func (*Bot) RegisterLinkSharedEvent ¶
func (b *Bot) RegisterLinkSharedEvent(callback LinkSharedEventCallback)
Register a callback for link_shared events
func (*Bot) RegisterMemberJoinedChannelEvent ¶
func (b *Bot) RegisterMemberJoinedChannelEvent(callback MemberJoinedChannelEventCallback)
Register a callback for member_joined_channel events
func (*Bot) RegisterMemberLeftChannelEvent ¶
func (b *Bot) RegisterMemberLeftChannelEvent(callback MemberLeftChannelEventCallback)
Register a callback for member_left_channel events
func (*Bot) RegisterMessageActionInteraction ¶
func (b *Bot) RegisterMessageActionInteraction(callbackId string, callback InteractionCallback)
Register a callback for message_action interactions with a specific callbackId
func (*Bot) RegisterMessageEvent ¶
func (b *Bot) RegisterMessageEvent(callback MessageEventCallback)
Register a callback for message events
func (*Bot) RegisterPinAddedEvent ¶
func (b *Bot) RegisterPinAddedEvent(callback PinAddedEventCallback)
Register a callback for pin_added events
func (*Bot) RegisterPinRemovedEvent ¶
func (b *Bot) RegisterPinRemovedEvent(callback PinRemovedEventCallback)
Register a callback for pin_removed events
func (*Bot) RegisterReactionAddedEvent ¶
func (b *Bot) RegisterReactionAddedEvent(callback ReactionAddedEventCallback)
Register a callback for reaction_added events
func (*Bot) RegisterReactionRemovedEvent ¶
func (b *Bot) RegisterReactionRemovedEvent(callback ReactionRemovedEventCallback)
Register a callback for reaction_removed events
func (*Bot) RegisterSelectOptionGroups ¶
func (b *Bot) RegisterSelectOptionGroups(callbackId string, callback SelectMenuOptionsGroupCallback)
Register a select option groups callback
func (*Bot) RegisterSelectOptions ¶
func (b *Bot) RegisterSelectOptions(callbackId string, callback SelectMenuOptionsCallback)
Register a select options callback
func (*Bot) RegisterShortcutInteraction ¶
func (b *Bot) RegisterShortcutInteraction(callbackId string, callback InteractionCallback)
Register a callback for shortcut interactions with a specific callbackId
func (*Bot) RegisterTokensRevokedEvent ¶
func (b *Bot) RegisterTokensRevokedEvent(callback TokensRevokedEventCallback)
Register a callback for tokens_revoked events
func (*Bot) RegisterViewClosedInteraction ¶
func (b *Bot) RegisterViewClosedInteraction(callbackId string, callback InteractionCallback)
Register a callback for view_closed interactions with a specific callbackId
func (*Bot) RegisterViewSubmissionInteraction ¶
func (b *Bot) RegisterViewSubmissionInteraction(callbackId string, callback ViewSubmissionInteractionCallback)
Register a callback for view_submission interactions with a specific callbackId Callback may return a slack.ViewSubmissionResponse or nil for no response
type CommandCallback ¶
type CommandCallback = func(bot *Bot, command slack.SlashCommand) *slack.Msg
type GridMigrationFinishedEventCallback ¶
type GridMigrationFinishedEventCallback = func(bot *Bot, c GridMigrationFinishedEventContainer)
type GridMigrationFinishedEventContainer ¶
type GridMigrationFinishedEventContainer struct {
APIEvent slackevents.EventsAPIEvent
Event slackevents.GridMigrationFinishedEvent
}
type GridMigrationStartedEventCallback ¶
type GridMigrationStartedEventCallback = func(bot *Bot, c GridMigrationStartedEventContainer)
type GridMigrationStartedEventContainer ¶
type GridMigrationStartedEventContainer struct {
APIEvent slackevents.EventsAPIEvent
Event slackevents.GridMigrationStartedEvent
}
type InteractionCallback ¶
type InteractionCallback = func(bot *Bot, event slack.InteractionCallback)
type KeywordCallback ¶
type KeywordCallback = func(bot *Bot, container MessageEventContainer)
type LinkSharedEventCallback ¶
type LinkSharedEventCallback = func(bot *Bot, c LinkSharedEventContainer)
type LinkSharedEventContainer ¶
type LinkSharedEventContainer struct {
}
type MemberJoinedChannelEventCallback ¶
type MemberJoinedChannelEventCallback = func(bot *Bot, c MemberJoinedChannelEventContainer)
type MemberJoinedChannelEventContainer ¶
type MemberJoinedChannelEventContainer struct {
APIEvent slackevents.EventsAPIEvent
Event slackevents.MemberJoinedChannelEvent
}
type MemberLeftChannelEventCallback ¶
type MemberLeftChannelEventCallback = func(bot *Bot, c MemberLeftChannelEventContainer)
type MemberLeftChannelEventContainer ¶
type MemberLeftChannelEventContainer struct {
APIEvent slackevents.EventsAPIEvent
Event slackevents.MemberLeftChannelEvent
}
type MessageEventCallback ¶
type MessageEventCallback = func(bot *Bot, c MessageEventContainer)
type MessageEventContainer ¶
type MessageEventContainer struct {
APIEvent slackevents.EventsAPIEvent
Event slackevents.MessageEvent
}
type PinAddedEventCallback ¶
type PinAddedEventCallback = func(bot *Bot, c PinAddedEventContainer)
type PinAddedEventContainer ¶
type PinAddedEventContainer struct {
APIEvent slackevents.EventsAPIEvent
Event slackevents.PinAddedEvent
}
type PinRemovedEventCallback ¶
type PinRemovedEventCallback = func(bot *Bot, c PinRemovedEventContainer)
type PinRemovedEventContainer ¶
type PinRemovedEventContainer struct {
APIEvent slackevents.EventsAPIEvent
Event slackevents.PinRemovedEvent
}
type ReactionAddedEventCallback ¶
type ReactionAddedEventCallback = func(bot *Bot, c ReactionAddedEventContainer)
type ReactionAddedEventContainer ¶
type ReactionAddedEventContainer struct {
APIEvent slackevents.EventsAPIEvent
Event slackevents.ReactionAddedEvent
}
type ReactionRemovedEventCallback ¶
type ReactionRemovedEventCallback = func(bot *Bot, c ReactionRemovedEventContainer)
type ReactionRemovedEventContainer ¶
type ReactionRemovedEventContainer struct {
APIEvent slackevents.EventsAPIEvent
Event slackevents.ReactionRemovedEvent
}
type SelectMenuOptionsCallback ¶
type SelectMenuOptionsCallback = func(bot *Bot, interaction slack.InteractionCallback) slack.OptionsResponse
type SelectMenuOptionsGroupCallback ¶
type SelectMenuOptionsGroupCallback = func(bot *Bot, interaction slack.InteractionCallback) slack.OptionGroupsResponse
type TokensRevokedEventCallback ¶
type TokensRevokedEventCallback = func(bot *Bot, c TokensRevokedEventContainer)
type TokensRevokedEventContainer ¶
type TokensRevokedEventContainer struct {
APIEvent slackevents.EventsAPIEvent
Event slackevents.TokensRevokedEvent
}
type ViewSubmissionInteractionCallback ¶
type ViewSubmissionInteractionCallback = func(bot *Bot, event slack.InteractionCallback) *slack.ViewSubmissionResponse