Documentation
¶
Index ¶
- Constants
- Variables
- type Bear
- func (b *Bear) AddHandler(handler interface{}) *Bear
- func (b *Bear) Close() *Bear
- func (b *Bear) RegisterCommand(cmd Command) *Bear
- func (b *Bear) RegisterCommands(cmds []Command) *Bear
- func (b *Bear) RegisterModule(module Module) *Bear
- func (b *Bear) RegisterModules(modules ...Module) *Bear
- func (b *Bear) Start() *Bear
- 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 LogConfig
- 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 Version = "0.2.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
Log *logrus.Logger
Config *Config
Version string
// contains filtered or unexported fields
}
Bear is the core bot.
func (*Bear) AddHandler ¶
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"`
Log *LogConfig `json:"log"`
}
Config holds the configuration options for the bot.
type Context ¶
type Context struct {
Log *logrus.Logger
Session *discordgo.Session
ChannelID string
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.