1
0
Fork 0
mirror of https://github.com/diamondburned/arikawa.git synced 2025-01-07 12:38:05 +00:00

Added example into bot/Context's doc

This commit is contained in:
diamondburned (Forefront) 2020-01-19 17:58:24 -08:00
parent ac685b0df4
commit a6bf7c340b

View file

@ -98,6 +98,17 @@ func Wait() {
// cmds := &Commands{}
// c, err := rfrouter.New(session, cmds)
//
// Example
//
// A command can be created by making it a method of Commands, or whatever
// struct was given to the constructor. This following example creates a command
// with a single integer argument (which can be ran with "~example 123"):
//
// func (c *Commands) Example(m *gateway.MessageCreateEvent, i int) error {
// _, err := c.Ctx.SendMessage(m.ChannelID, fmt.Sprintf("You sent: %d", i))
// return err
// }
//
// Commands' exported methods will all be used as commands. Messages are parsed
// with its first argument (the command) mapped accordingly to c.MapName, which
// capitalizes the first letter automatically to reflect the exported method