Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Arguments ¶
type Arguments interface { // GetInt returns the integer value of an argument GetInt(name string) int // GetString returns the string value of an argument GetString(name string) string }
Arguments represents a command arguments
type Command ¶
type Command interface { // Name returns the command name Name() (name string) // Execute the command Execute(client client.Client, event Event) (err error) }
Command represents a command
type CommandBuilder ¶
type CommandBuilder interface { // AddInt adds an integer argument to the command AddInt(name string) CommandBuilder // AddString adds a string argument to the command AddString(name string) CommandBuilder // AddRest add the rest of the arguments concatenated with a whitespace to the command AddRest(name string) CommandBuilder // AddFilter adds a channel filter for the command AddFilter(filter FilterFn) CommandBuilder // Resolver sets the command resolver Resolver(CommandFn) CommandBuilder // Build the command Build() Command }
CommandBuilder allows to build commands
func NewCommandBuilder ¶
func NewCommandBuilder(name string) CommandBuilder
NewCommandBuilder creates a command builder
type Event ¶
type Event struct { // UserID is the user that performed the command UserID string // UserPermission holds the user permission UserPermissions int64 // GuildID is the guild where the command was performed GuildID string // CategoryID is the category where the command was performed CategoryID string // ChannelID is the channel where the command was performed ChannelID string // MessageID holds the message where the command was performed MessageID string // Params holds the command params a string that was executed Params string }
type Lexer ¶
type Lexer interface { // HasNext returns true while the lexer has more token to read. HasNext() bool // Next returns the next token as string Next() (string, error) }
Lexer tokenizes commands
type Parser ¶
type Parser interface { // ReadInt reads an int from the input command ReadInt() (int, error) // ReadString reads a string from the input ReadString() (string, error) // ReadRest reads the rest of the input command and returns a string that concatenates remaining tokens using space ReadRest() (string, error) }
Parser represents a command parser
Click to show internal directories.
Click to hide internal directories.