Documentation ¶
Index ¶
- Constants
- Variables
- type Bear
- func (b *Bear) AddHandler(handler interface{})
- func (b *Bear) Close() error
- func (b *Bear) RegisterCommand(cmd Command) error
- func (b *Bear) RegisterCommands(cmds []Command) error
- func (b *Bear) RegisterModule(module Module) error
- func (b *Bear) RegisterModules(modules ...Module) error
- func (b *Bear) Start() error
- func (b *Bear) UpdateConfig(config *Config) *Bear
- type Command
- type Config
- type Context
- func (ctx Context) SendEmbed(embed *discordgo.MessageEmbed) (*discordgo.Message, error)
- func (ctx Context) SendErrorMessage(format string, a ...interface{}) (*discordgo.Message, error)
- func (ctx Context) SendInfoMessage(format string, a ...interface{}) (*discordgo.Message, error)
- func (ctx Context) SendMessage(color int, title, format string, a ...interface{}) (*discordgo.Message, error)
- func (ctx Context) SendSuccessMessage(format string, a ...interface{}) (*discordgo.Message, error)
- type Module
Constants ¶
const ( SuccessColor int = 5025616 ErrorColor int = 16007990 InfoColor int = 2201331 )
This is a collection of the standard colors used for messages.
Variables ¶
var ( ErrModuleAlreadyExists = errors.New("module does not have a unique name") ErrCommandAlreadyExists = errors.New("command does not have a unique caller") )
The errors returned from Bear commands.
var Version = "0.4.0-alpha"
Version is the current version of Bear.
Functions ¶
This section is empty.
Types ¶
type Bear ¶
type Bear struct { Commands map[string]Command Modules map[string]Module Session *discordgo.Session Config *Config Version string // contains filtered or unexported fields }
Bear is the core bot.
func (*Bear) AddHandler ¶
func (b *Bear) AddHandler(handler interface{})
AddHandler will add a handler to the Discord session
func (*Bear) RegisterCommand ¶
RegisterCommand will check if a command exists, and add it to the bot.
func (*Bear) RegisterCommands ¶
RegisterCommands will register an array of commands to the bot.
func (*Bear) RegisterModule ¶
RegisterModule with register a module to the bot.
func (*Bear) RegisterModules ¶
RegisterModules will register all of the modules passed to this function.
func (*Bear) UpdateConfig ¶
UpdateConfig will update the configuration of the bot.
type Config ¶
type Config struct { DiscordToken string `json:"discord_token"` AutoDelete bool `json:"auto_delete"` AdminRoles []string `json:"admin_roles"` AdminUsers []string `json:"admin_users"` }
Config holds the configuration options for the bot.
type Context ¶
type Context struct { ChannelID string Session *discordgo.Session Message *discordgo.MessageCreate }
Context holds useful functions for a handler.
func (Context) SendErrorMessage ¶
SendErrorMessage is a quick way to send an error.
func (Context) SendInfoMessage ¶
SendInfoMessage is a shortcut for sending a message with the info colors.