Documentation ¶
Index ¶
- Variables
- func ExecuteSafely(callback func() error) (err error)
- func GetArgs(s string) []string
- func GetFunctionName(i interface{}) string
- func GetShardCount(token string) (int, error)
- func RecoverAndLog()
- type AutoShardedBot
- func (bot *AutoShardedBot) AddHandler(handler interface{}) func()
- func (bot *AutoShardedBot) CommandMessageCreateHandler() func(*discordgo.Session, *discordgo.MessageCreate)
- func (bot *AutoShardedBot) GetContext(event *discordgo.MessageCreate) (*Context, bool)
- func (bot *AutoShardedBot) GetShard(guildID string) (*Shard, error)
- func (bot *AutoShardedBot) Run()
- type Bot
- func (bot *Bot) AddCommand(command *Command) error
- func (bot *Bot) Command(name string, desc string, callback CommandHandler) (*Command, error)
- func (bot *Bot) CommandMessageCreateHandler() func(*discordgo.Session, *discordgo.MessageCreate)
- func (bot *Bot) ExecuteSafely(callback func() error) (recovered interface{}, returned error)
- func (bot *Bot) GetCommand(name string) (*Command, bool)
- func (bot *Bot) GetContext(event *discordgo.MessageCreate) (*Context, bool)
- func (bot *Bot) Me() (*discordgo.User, error)
- func (bot *Bot) RemoveCommand(name string)
- func (bot *Bot) Run()
- func (bot *Bot) SetHelpCommand(help HelpCommand) error
- func (bot *Bot) WaitForChannelCreate(check func(*discordgo.ChannelCreate) bool) *discordgo.ChannelCreate
- func (bot *Bot) WaitForChannelDelete(check func(*discordgo.ChannelDelete) bool) *discordgo.ChannelDelete
- func (bot *Bot) WaitForChannelPinsUpdate(check func(*discordgo.ChannelPinsUpdate) bool) *discordgo.ChannelPinsUpdate
- func (bot *Bot) WaitForChannelUpdate(check func(*discordgo.ChannelUpdate) bool) *discordgo.ChannelUpdate
- func (bot *Bot) WaitForConnect(check func(*discordgo.Connect) bool) *discordgo.Connect
- func (bot *Bot) WaitForDisconnect(check func(*discordgo.Disconnect) bool) *discordgo.Disconnect
- func (bot *Bot) WaitForEvent(check func(*discordgo.Event) bool) *discordgo.Event
- func (bot *Bot) WaitForGuildBanAdd(check func(*discordgo.GuildBanAdd) bool) *discordgo.GuildBanAdd
- func (bot *Bot) WaitForGuildBanRemove(check func(*discordgo.GuildBanRemove) bool) *discordgo.GuildBanRemove
- func (bot *Bot) WaitForGuildCreate(check func(*discordgo.GuildCreate) bool) *discordgo.GuildCreate
- func (bot *Bot) WaitForGuildDelete(check func(*discordgo.GuildDelete) bool) *discordgo.GuildDelete
- func (bot *Bot) WaitForGuildEmojisUpdate(check func(*discordgo.GuildEmojisUpdate) bool) *discordgo.GuildEmojisUpdate
- func (bot *Bot) WaitForGuildIntegrationsUpdate(check func(*discordgo.GuildIntegrationsUpdate) bool) *discordgo.GuildIntegrationsUpdate
- func (bot *Bot) WaitForGuildMemberAdd(check func(*discordgo.GuildMemberAdd) bool) *discordgo.GuildMemberAdd
- func (bot *Bot) WaitForGuildMemberRemove(check func(*discordgo.GuildMemberRemove) bool) *discordgo.GuildMemberRemove
- func (bot *Bot) WaitForGuildMemberUpdate(check func(*discordgo.GuildMemberUpdate) bool) *discordgo.GuildMemberUpdate
- func (bot *Bot) WaitForGuildMembersChunk(check func(*discordgo.GuildMembersChunk) bool) *discordgo.GuildMembersChunk
- func (bot *Bot) WaitForGuildRoleCreate(check func(*discordgo.GuildRoleCreate) bool) *discordgo.GuildRoleCreate
- func (bot *Bot) WaitForGuildRoleDelete(check func(*discordgo.GuildRoleDelete) bool) *discordgo.GuildRoleDelete
- func (bot *Bot) WaitForGuildRoleUpdate(check func(*discordgo.GuildRoleUpdate) bool) *discordgo.GuildRoleUpdate
- func (bot *Bot) WaitForGuildUpdate(check func(*discordgo.GuildUpdate) bool) *discordgo.GuildUpdate
- func (bot *Bot) WaitForMessageAck(check func(*discordgo.MessageAck) bool) *discordgo.MessageAck
- func (bot *Bot) WaitForMessageCreate(check func(*discordgo.MessageCreate) bool) *discordgo.MessageCreate
- func (bot *Bot) WaitForMessageDelete(check func(*discordgo.MessageDelete) bool) *discordgo.MessageDelete
- func (bot *Bot) WaitForMessageDeleteBulk(check func(*discordgo.MessageDeleteBulk) bool) *discordgo.MessageDeleteBulk
- func (bot *Bot) WaitForMessageReactionAdd(check func(*discordgo.MessageReactionAdd) bool) *discordgo.MessageReactionAdd
- func (bot *Bot) WaitForMessageReactionRemove(check func(*discordgo.MessageReactionRemove) bool) *discordgo.MessageReactionRemove
- func (bot *Bot) WaitForMessageReactionRemoveAll(check func(*discordgo.MessageReactionRemoveAll) bool) *discordgo.MessageReactionRemoveAll
- func (bot *Bot) WaitForMessageUpdate(check func(*discordgo.MessageUpdate) bool) *discordgo.MessageUpdate
- func (bot *Bot) WaitForPresenceUpdate(check func(*discordgo.PresenceUpdate) bool) *discordgo.PresenceUpdate
- func (bot *Bot) WaitForPresencesReplace(check func(*discordgo.PresencesReplace) bool) *discordgo.PresencesReplace
- func (bot *Bot) WaitForRateLimit(check func(*discordgo.RateLimit) bool) *discordgo.RateLimit
- func (bot *Bot) WaitForReady(check func(*discordgo.Ready) bool) *discordgo.Ready
- func (bot *Bot) WaitForRelationshipAdd(check func(*discordgo.RelationshipAdd) bool) *discordgo.RelationshipAdd
- func (bot *Bot) WaitForRelationshipRemove(check func(*discordgo.RelationshipRemove) bool) *discordgo.RelationshipRemove
- func (bot *Bot) WaitForResumed(check func(*discordgo.Resumed) bool) *discordgo.Resumed
- func (bot *Bot) WaitForTypingStart(check func(*discordgo.TypingStart) bool) *discordgo.TypingStart
- func (bot *Bot) WaitForUserGuildSettingsUpdate(check func(*discordgo.UserGuildSettingsUpdate) bool) *discordgo.UserGuildSettingsUpdate
- func (bot *Bot) WaitForUserNoteUpdate(check func(*discordgo.UserNoteUpdate) bool) *discordgo.UserNoteUpdate
- func (bot *Bot) WaitForUserSettingsUpdate(check func(*discordgo.UserSettingsUpdate) bool) *discordgo.UserSettingsUpdate
- func (bot *Bot) WaitForUserUpdate(check func(*discordgo.UserUpdate) bool) *discordgo.UserUpdate
- func (bot *Bot) WaitForVoiceServerUpdate(check func(*discordgo.VoiceServerUpdate) bool) *discordgo.VoiceServerUpdate
- func (bot *Bot) WaitForVoiceStateUpdate(check func(*discordgo.VoiceStateUpdate) bool) *discordgo.VoiceStateUpdate
- func (bot *Bot) WaitForWebhooksUpdate(check func(*discordgo.WebhooksUpdate) bool) *discordgo.WebhooksUpdate
- type Cog
- type Command
- func (cmd *Command) AddSubcommand(subcommand *Command) error
- func (cmd *Command) Check(checks ...CommandCheck)
- func (cmd *Command) GetSubcommand(name string) (*Command, bool)
- func (cmd *Command) Info() CommandInfo
- func (cmd *Command) Invoke(ctx *Context) error
- func (cmd *Command) RemoveSubcommand(name string)
- func (cmd *Command) Subcommand(name string, desc string, callback CommandHandler) (*Command, error)
- type CommandCheck
- type CommandHandler
- type CommandInfo
- type Context
- type DefaultHelpCommand
- type ErrorHandler
- type HelpCommand
- type PanicHandler
- type Shard
Constants ¶
This section is empty.
Variables ¶
View Source
var NilCommand = &Command{ Handler: func(ctx *Context) error { return nil }, }
View Source
var NilContext = &Context{ Command: NilCommand, }
Functions ¶
func ExecuteSafely ¶
func GetFunctionName ¶
func GetFunctionName(i interface{}) string
func GetShardCount ¶
func RecoverAndLog ¶
func RecoverAndLog()
Types ¶
type AutoShardedBot ¶
func NewAutoShardedBot ¶
func NewAutoShardedBot(prefix, token string, shardIDs []int, shardCount int) (*AutoShardedBot, error)
func (*AutoShardedBot) AddHandler ¶
func (bot *AutoShardedBot) AddHandler(handler interface{}) func()
func (*AutoShardedBot) CommandMessageCreateHandler ¶
func (bot *AutoShardedBot) CommandMessageCreateHandler() func(*discordgo.Session, *discordgo.MessageCreate)
func (*AutoShardedBot) GetContext ¶
func (bot *AutoShardedBot) GetContext(event *discordgo.MessageCreate) (*Context, bool)
func (*AutoShardedBot) GetShard ¶
func (bot *AutoShardedBot) GetShard(guildID string) (*Shard, error)
func (*AutoShardedBot) Run ¶
func (bot *AutoShardedBot) Run()
type Bot ¶
type Bot struct { Prefix string CaseInsensitive bool Session *discordgo.Session Commands []*Command Cogs []*Cog HelpCommand *HelpCommand ErrorHandler ErrorHandler PanicHandler PanicHandler }
func (*Bot) AddCommand ¶
func (*Bot) CommandMessageCreateHandler ¶
func (bot *Bot) CommandMessageCreateHandler() func(*discordgo.Session, *discordgo.MessageCreate)
func (*Bot) ExecuteSafely ¶
func (*Bot) GetContext ¶
func (bot *Bot) GetContext(event *discordgo.MessageCreate) (*Context, bool)
func (*Bot) RemoveCommand ¶
func (*Bot) SetHelpCommand ¶
func (bot *Bot) SetHelpCommand(help HelpCommand) error
func (*Bot) WaitForChannelCreate ¶
func (bot *Bot) WaitForChannelCreate(check func(*discordgo.ChannelCreate) bool) *discordgo.ChannelCreate
func (*Bot) WaitForChannelDelete ¶
func (bot *Bot) WaitForChannelDelete(check func(*discordgo.ChannelDelete) bool) *discordgo.ChannelDelete
func (*Bot) WaitForChannelPinsUpdate ¶
func (bot *Bot) WaitForChannelPinsUpdate(check func(*discordgo.ChannelPinsUpdate) bool) *discordgo.ChannelPinsUpdate
func (*Bot) WaitForChannelUpdate ¶
func (bot *Bot) WaitForChannelUpdate(check func(*discordgo.ChannelUpdate) bool) *discordgo.ChannelUpdate
func (*Bot) WaitForConnect ¶
func (*Bot) WaitForDisconnect ¶
func (bot *Bot) WaitForDisconnect(check func(*discordgo.Disconnect) bool) *discordgo.Disconnect
func (*Bot) WaitForEvent ¶
func (*Bot) WaitForGuildBanAdd ¶
func (bot *Bot) WaitForGuildBanAdd(check func(*discordgo.GuildBanAdd) bool) *discordgo.GuildBanAdd
func (*Bot) WaitForGuildBanRemove ¶
func (bot *Bot) WaitForGuildBanRemove(check func(*discordgo.GuildBanRemove) bool) *discordgo.GuildBanRemove
func (*Bot) WaitForGuildCreate ¶
func (bot *Bot) WaitForGuildCreate(check func(*discordgo.GuildCreate) bool) *discordgo.GuildCreate
func (*Bot) WaitForGuildDelete ¶
func (bot *Bot) WaitForGuildDelete(check func(*discordgo.GuildDelete) bool) *discordgo.GuildDelete
func (*Bot) WaitForGuildEmojisUpdate ¶
func (bot *Bot) WaitForGuildEmojisUpdate(check func(*discordgo.GuildEmojisUpdate) bool) *discordgo.GuildEmojisUpdate
func (*Bot) WaitForGuildIntegrationsUpdate ¶
func (bot *Bot) WaitForGuildIntegrationsUpdate(check func(*discordgo.GuildIntegrationsUpdate) bool) *discordgo.GuildIntegrationsUpdate
func (*Bot) WaitForGuildMemberAdd ¶
func (bot *Bot) WaitForGuildMemberAdd(check func(*discordgo.GuildMemberAdd) bool) *discordgo.GuildMemberAdd
func (*Bot) WaitForGuildMemberRemove ¶
func (bot *Bot) WaitForGuildMemberRemove(check func(*discordgo.GuildMemberRemove) bool) *discordgo.GuildMemberRemove
func (*Bot) WaitForGuildMemberUpdate ¶
func (bot *Bot) WaitForGuildMemberUpdate(check func(*discordgo.GuildMemberUpdate) bool) *discordgo.GuildMemberUpdate
func (*Bot) WaitForGuildMembersChunk ¶
func (bot *Bot) WaitForGuildMembersChunk(check func(*discordgo.GuildMembersChunk) bool) *discordgo.GuildMembersChunk
func (*Bot) WaitForGuildRoleCreate ¶
func (bot *Bot) WaitForGuildRoleCreate(check func(*discordgo.GuildRoleCreate) bool) *discordgo.GuildRoleCreate
func (*Bot) WaitForGuildRoleDelete ¶
func (bot *Bot) WaitForGuildRoleDelete(check func(*discordgo.GuildRoleDelete) bool) *discordgo.GuildRoleDelete
func (*Bot) WaitForGuildRoleUpdate ¶
func (bot *Bot) WaitForGuildRoleUpdate(check func(*discordgo.GuildRoleUpdate) bool) *discordgo.GuildRoleUpdate
func (*Bot) WaitForGuildUpdate ¶
func (bot *Bot) WaitForGuildUpdate(check func(*discordgo.GuildUpdate) bool) *discordgo.GuildUpdate
func (*Bot) WaitForMessageAck ¶
func (bot *Bot) WaitForMessageAck(check func(*discordgo.MessageAck) bool) *discordgo.MessageAck
func (*Bot) WaitForMessageCreate ¶
func (bot *Bot) WaitForMessageCreate(check func(*discordgo.MessageCreate) bool) *discordgo.MessageCreate
func (*Bot) WaitForMessageDelete ¶
func (bot *Bot) WaitForMessageDelete(check func(*discordgo.MessageDelete) bool) *discordgo.MessageDelete
func (*Bot) WaitForMessageDeleteBulk ¶
func (bot *Bot) WaitForMessageDeleteBulk(check func(*discordgo.MessageDeleteBulk) bool) *discordgo.MessageDeleteBulk
func (*Bot) WaitForMessageReactionAdd ¶
func (bot *Bot) WaitForMessageReactionAdd(check func(*discordgo.MessageReactionAdd) bool) *discordgo.MessageReactionAdd
func (*Bot) WaitForMessageReactionRemove ¶
func (bot *Bot) WaitForMessageReactionRemove(check func(*discordgo.MessageReactionRemove) bool) *discordgo.MessageReactionRemove
func (*Bot) WaitForMessageReactionRemoveAll ¶
func (bot *Bot) WaitForMessageReactionRemoveAll(check func(*discordgo.MessageReactionRemoveAll) bool) *discordgo.MessageReactionRemoveAll
func (*Bot) WaitForMessageUpdate ¶
func (bot *Bot) WaitForMessageUpdate(check func(*discordgo.MessageUpdate) bool) *discordgo.MessageUpdate
func (*Bot) WaitForPresenceUpdate ¶
func (bot *Bot) WaitForPresenceUpdate(check func(*discordgo.PresenceUpdate) bool) *discordgo.PresenceUpdate
func (*Bot) WaitForPresencesReplace ¶
func (bot *Bot) WaitForPresencesReplace(check func(*discordgo.PresencesReplace) bool) *discordgo.PresencesReplace
func (*Bot) WaitForRateLimit ¶
func (*Bot) WaitForReady ¶
func (*Bot) WaitForRelationshipAdd ¶
func (bot *Bot) WaitForRelationshipAdd(check func(*discordgo.RelationshipAdd) bool) *discordgo.RelationshipAdd
func (*Bot) WaitForRelationshipRemove ¶
func (bot *Bot) WaitForRelationshipRemove(check func(*discordgo.RelationshipRemove) bool) *discordgo.RelationshipRemove
func (*Bot) WaitForResumed ¶
func (*Bot) WaitForTypingStart ¶
func (bot *Bot) WaitForTypingStart(check func(*discordgo.TypingStart) bool) *discordgo.TypingStart
func (*Bot) WaitForUserGuildSettingsUpdate ¶
func (bot *Bot) WaitForUserGuildSettingsUpdate(check func(*discordgo.UserGuildSettingsUpdate) bool) *discordgo.UserGuildSettingsUpdate
func (*Bot) WaitForUserNoteUpdate ¶
func (bot *Bot) WaitForUserNoteUpdate(check func(*discordgo.UserNoteUpdate) bool) *discordgo.UserNoteUpdate
func (*Bot) WaitForUserSettingsUpdate ¶
func (bot *Bot) WaitForUserSettingsUpdate(check func(*discordgo.UserSettingsUpdate) bool) *discordgo.UserSettingsUpdate
func (*Bot) WaitForUserUpdate ¶
func (bot *Bot) WaitForUserUpdate(check func(*discordgo.UserUpdate) bool) *discordgo.UserUpdate
func (*Bot) WaitForVoiceServerUpdate ¶
func (bot *Bot) WaitForVoiceServerUpdate(check func(*discordgo.VoiceServerUpdate) bool) *discordgo.VoiceServerUpdate
func (*Bot) WaitForVoiceStateUpdate ¶
func (bot *Bot) WaitForVoiceStateUpdate(check func(*discordgo.VoiceStateUpdate) bool) *discordgo.VoiceStateUpdate
func (*Bot) WaitForWebhooksUpdate ¶
func (bot *Bot) WaitForWebhooksUpdate(check func(*discordgo.WebhooksUpdate) bool) *discordgo.WebhooksUpdate
type Cog ¶
type Cog struct { Name string Bot Bot CommandList []Command // contains filtered or unexported fields }
func (Cog) GetCommand ¶
type Command ¶
type Command struct { Name string Desc string QualifiedName string Handler CommandHandler Checks []CommandCheck Subcommands []*Command ErrorHandler ErrorHandler PanicHandler PanicHandler }
func HelpCommandHandler ¶
func HelpCommandHandler(help HelpCommand) *Command
func (*Command) AddSubcommand ¶
func (*Command) Check ¶
func (cmd *Command) Check(checks ...CommandCheck)
func (*Command) Info ¶
func (cmd *Command) Info() CommandInfo
func (*Command) RemoveSubcommand ¶
func (*Command) Subcommand ¶
type CommandCheck ¶
type CommandHandler ¶
type CommandInfo ¶
type Context ¶
type Context struct { Bot *Bot Command *Command Shard *Shard Session *discordgo.Session Message *discordgo.MessageCreate Author *discordgo.User Member *discordgo.Member Channel *discordgo.Channel Guild *discordgo.Guild Args []string }
func NewContext ¶
type DefaultHelpCommand ¶
func NewDefaultHelpCommand ¶
func NewDefaultHelpCommand() DefaultHelpCommand
func (DefaultHelpCommand) Info ¶
func (help DefaultHelpCommand) Info() CommandInfo
func (DefaultHelpCommand) SendBotHelp ¶
func (help DefaultHelpCommand) SendBotHelp(ctx *Context) error
func (DefaultHelpCommand) SendCommandHelp ¶
func (help DefaultHelpCommand) SendCommandHelp(ctx *Context, commandName string) error
func (DefaultHelpCommand) SendHelp ¶
func (help DefaultHelpCommand) SendHelp(ctx *Context) error
type ErrorHandler ¶
type HelpCommand ¶
type PanicHandler ¶
type PanicHandler func(*Context, interface{})
Source Files ¶
Click to show internal directories.
Click to hide internal directories.