Browse Source

add Group Command Examples to int_framework intro

pull/2246/head
Misha133 3 years ago
parent
commit
bd2efca5da
2 changed files with 17 additions and 0 deletions
  1. +2
    -0
      docs/guides/int_framework/intro.md
  2. +15
    -0
      docs/guides/int_framework/samples/intro/groupmodule.cs

+ 2
- 0
docs/guides/int_framework/intro.md View File

@@ -282,6 +282,8 @@ By nesting commands inside a module that is tagged with [GroupAttribute] you can
> Although creating nested module stuctures are allowed,
> 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

Any of the following socket events can be used to execute commands:


+ 15
- 0
docs/guides/int_framework/samples/intro/groupmodule.cs View File

@@ -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);
}
}

Loading…
Cancel
Save