Documentation ¶
Index ¶
- Variables
- func GetCommandID(text string) string
- func HavePermitions(command *Command, msg whatsapp.TextMessage) (logs []string)
- func ParseCommand(wac *whatsapp.Conn, msg whatsapp.TextMessage)
- type Command
- func (c *Command) Add()
- func (c *Command) OnlyRoot() *Command
- func (c *Command) SetAliases(aliases ...string) *Command
- func (c *Command) SetArgs(args ...string) *Command
- func (c *Command) SetCooldown(seconds time.Duration) *Command
- func (c *Command) SetHelp(format string, args ...interface{}) *Command
- func (c *Command) SetSubcommands(commands ...string) *Command
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ActiveCommands = make(map[string]*Command) WaitList = make(map[string]time.Time) )
ActiveCommands the current avaliable commands
Functions ¶
func GetCommandID ¶
GetCommandID slicing the message and searching for aliases
func HavePermitions ¶
func HavePermitions(command *Command, msg whatsapp.TextMessage) (logs []string)
HavePermitions Check if the participant have the permitions to use some command
func ParseCommand ¶
func ParseCommand(wac *whatsapp.Conn, msg whatsapp.TextMessage)
ParseCommand analyze the command FIXME: add error definitions
Types ¶
type Command ¶
type Command struct { ID string Name string Aliases []string Subcommands []string Args []string Help string RootOnly bool Cooldown time.Duration Exec func(*whatsapp.Conn, whatsapp.TextMessage, map[string]string) error }
Command all command data
func New ¶
func New(name string, f func(*whatsapp.Conn, whatsapp.TextMessage, map[string]string) error) *Command
New creates a new command
func (*Command) SetAliases ¶
SetAliases to the command
func (*Command) SetCooldown ¶
SetCooldown to re use the command
func (*Command) SetSubcommands ¶
SetSubcommands set a sub command
Click to show internal directories.
Click to hide internal directories.