[VERSION]
Finally, you can now register and use sub command groups!
Simply add a sub command option to your command in the Options
implementation of your command.
Example:
func (c *SubsCommand) Options() []*discordgo.ApplicationCommandOption {
return []*discordgo.ApplicationCommandOption{
{
Type: discordgo.ApplicationCommandOptionSubCommandGroup,
Name: "group",
Description: "Some sub command gorup",
Options: []*discordgo.ApplicationCommandOption{
// ...
},
},
}
}
Now, you can add a SubCommandGroup
handler to your HandleSubCommands
method to register sub commands in the group.
Example:
func (c *SubsCommand) Run(ctx ken.Context) (err error) {
err = ctx.HandleSubCommands(
ken.SubCommandGroup{"group", []ken.CommandHandler{
ken.SubCommandHandler{"one", c.one},
ken.SubCommandHandler{"two", c.two},
}},
)
return
}
The full example can be found in examples/subcommandgroups.
-
The
AutocompleteContext
now implementsObjectMap
so you can pass dependencies down the line just like with command contexts. -
AutocompleteContext
now has a new helper functionGetInputAny
which takes multiple option names and returns the first match found in the event data. -
FoolowUpMessage
has now been added accordingly toRespondMessage
, which was added inv0.19.0
.
go get -v -u github.com/zekrotja/ken@[VERSION]