Skip to content

Latest commit

 

History

History
54 lines (41 loc) · 1.96 KB

CHANGELOG.md

File metadata and controls

54 lines (41 loc) · 1.96 KB

[VERSION]

Sub Command Support [#14]

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.

Minor Changes

Update

go get -v -u github.com/zekrotja/ken@[VERSION]