mirror of
https://github.com/diamondburned/arikawa.git
synced 2025-01-23 04:57:16 +00:00
Added example into bot/Context's doc
This commit is contained in:
parent
ac685b0df4
commit
a6bf7c340b
11
bot/ctx.go
11
bot/ctx.go
|
@ -98,6 +98,17 @@ func Wait() {
|
||||||
// cmds := &Commands{}
|
// cmds := &Commands{}
|
||||||
// c, err := rfrouter.New(session, cmds)
|
// 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
|
// Commands' exported methods will all be used as commands. Messages are parsed
|
||||||
// with its first argument (the command) mapped accordingly to c.MapName, which
|
// with its first argument (the command) mapped accordingly to c.MapName, which
|
||||||
// capitalizes the first letter automatically to reflect the exported method
|
// capitalizes the first letter automatically to reflect the exported method
|
||||||
|
|
Loading…
Reference in a new issue