Documentation ¶
Index ¶
- func BalanceCommand(commandMessage CommandMessage)
- func HelpCommand(commandMessage CommandMessage)
- func LordCommand(commandMessage CommandMessage)
- func PayCommand(commandMessage CommandMessage)
- func PingCommand(commandMessage CommandMessage)
- type Command
- type CommandHandler
- type CommandInfo
- type CommandMap
- type CommandMessage
- type Config
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BalanceCommand ¶
func BalanceCommand(commandMessage CommandMessage)
BalanceCommand shows you your balance.
func HelpCommand ¶
func HelpCommand(commandMessage CommandMessage)
HelpCommand displays information about all commands.
func LordCommand ¶
func LordCommand(commandMessage CommandMessage)
LordCommand replies with the username of the player with the most tacos in the guild.
func PayCommand ¶
func PayCommand(commandMessage CommandMessage)
PayCommand allows you to transfer funds to another user.
func PingCommand ¶
func PingCommand(commandMessage CommandMessage)
PingCommand sends a "Pong!" message back.
Types ¶
type Command ¶
type Command func(CommandMessage)
Command is a function that requires CommandMessage as its argument.
type CommandHandler ¶
CommandHandler stores command information/state.
func New ¶
func New(database *storage.Database, config Config) (ch *CommandHandler)
New creates a new command handler.
func (CommandHandler) Get ¶
func (ch CommandHandler) Get(name string) (*CommandInfo, bool)
Get retrieves the Command (Data type) from the CommandMap map.
func (CommandHandler) Process ¶
func (ch CommandHandler) Process(session *discordgo.Session, message *discordgo.MessageCreate)
Process processes incoming messages and calls the command's function.
func (CommandHandler) Register ¶
func (ch CommandHandler) Register(name string, commandInfo CommandInfo)
Register registers a command to be handled by the command handler.
type CommandInfo ¶
type CommandInfo struct { Function Command Description string Hidden bool Cooldown map[*discordgo.Guild]time.Time }
CommandInfo stores information about a command.
type CommandMap ¶
type CommandMap map[string]CommandInfo
CommandMap stores all command functions by their name.
type CommandMessage ¶
type CommandMessage struct { CommandHandler *CommandHandler Session *discordgo.Session Guild *discordgo.Guild Message *discordgo.MessageCreate Args []string }
CommandMessage stores information about the message sent by the player.