Documentation
¶
Index ¶
- func Extract(args *Arguments, usage string, loc *map[string]interface{})
- type Argument
- type Arguments
- type Command
- type Context
- func (c *Context) DeleteMessage() error
- func (c *Context) Failure(msg string)
- func (c *Context) InvalidCommandUsage() error
- func (c *Context) ReplyEmbed(embed *discord.Embed) error
- func (c *Context) Respond(msg string) (*discordgo.Message, error)
- func (c *Context) RespondEmbed(embed *discord.Embed) error
- func (c *Context) RunTask(fn func(*discord.Session, string) error)
- func (c *Context) Success(msg string)
- func (c *Context) Typing()
- type Module
- type Task
- type Token
- type TokenType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Argument ¶
type Argument struct {
// contains filtered or unexported fields
}
A Argument is a argument for a command parsed from a discord message
type Arguments ¶
type Arguments struct {
// contains filtered or unexported fields
}
Arguments contains multiple arguments
func ParseArguments ¶
ParseArguments splits a string into multiple arguments
type Command ¶
type Command struct { Name string // DEPRECEATED, use the map key as name instead Description string Usage string Example string Permissions []string Execute func(*Context) error }
A Command is a command of a module that responds to a user calling it
type Context ¶
Context contains the context for a function call
func (*Context) DeleteMessage ¶
DeleteMessage deletes the message that triggered the command
func (*Context) InvalidCommandUsage ¶
InvalidCommandUsage returns an error that registers the command call to be invalid and an command help will be shown instead The return value from this function should be used as a command handler return value E.g.:
if (condition) { return ctx.InvalidCommandUsage() }
func (*Context) ReplyEmbed ¶
ReplyEmbed sends a embed in the same channel a message was received DEPRECEATED. use c.RespondEmbed instead
func (*Context) RespondEmbed ¶
RespondEmbed sends a embed in the same channel a message was received
type Module ¶
type Module struct { Name string Description string GuildOnly bool Commands map[string]*Command Permissions []string Tasks []*Task Store *store.Store }
A Module is a namespace for creating custom commands and bot functionalities
type Task ¶
type Task struct { Name string Interval time.Duration AtTime string // In the format: HH:MM AtWeekday time.Weekday // Optional weekday for At field Execute func(*discord.Session, string) error // Include the session and the discord guild }
Task is a background job that should be executed automatically without any user interaction