@@ -282,6 +282,8 @@ By nesting commands inside a module that is tagged with [GroupAttribute] you can | |||||
> Although creating nested module stuctures are allowed, | > Although creating nested module stuctures are allowed, | ||||
> you are not permitted to use more than 2 [GroupAttribute]'s in module hierarchy. | > you are not permitted to use more than 2 [GroupAttribute]'s in module hierarchy. | ||||
[!code-csharp[Command Group Example](samples/intro/groupmodule.cs)] | |||||
## Executing Commands | ## Executing Commands | ||||
Any of the following socket events can be used to execute commands: | Any of the following socket events can be used to execute commands: | ||||
@@ -0,0 +1,15 @@ | |||||
[Group("group-name", "Group description")] | |||||
public class CommandGroupModule : InteractionModuleBase<SocketInteractionContext> | |||||
{ | |||||
[SlashCommand("ping", "Get a pong")] | |||||
public async Task PongSubcommand() | |||||
=> await RespondAsync("Pong!"); | |||||
[Group("subcommand-group", "Subcommand group description")] | |||||
public class SubcommandGroupModule : InteractionModuleBase<SocketInteractionContext> | |||||
{ | |||||
[SlashCommand("echo", "Echo an input")] | |||||
public async Task PongSubcommand(string input) | |||||
=> await RespondAsync(input); | |||||
} | |||||
} |