docs: Add IgnoreGroupNames clarification to IF docs (#2374)
This commit is contained in:
@@ -291,6 +291,11 @@ 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.
|
||||||
|
|
||||||
|
> [!NOTE]
|
||||||
|
> To not use the command group's name as a prefix for component or modal interaction's custom id set `ignoreGroupNames` parameter to `true` in classes with [GroupAttribute]
|
||||||
|
>
|
||||||
|
> However, you have to be careful to prevent overlapping ids of buttons and modals
|
||||||
|
|
||||||
[!code-csharp[Command Group Example](samples/intro/groupmodule.cs)]
|
[!code-csharp[Command Group Example](samples/intro/groupmodule.cs)]
|
||||||
|
|
||||||
## Executing Commands
|
## Executing Commands
|
||||||
|
|||||||
@@ -16,6 +16,11 @@ public class CommandGroupModule : InteractionModuleBase<SocketInteractionContext
|
|||||||
// group-name subcommand-group-name echo
|
// group-name subcommand-group-name echo
|
||||||
[SlashCommand("echo", "Echo an input")]
|
[SlashCommand("echo", "Echo an input")]
|
||||||
public async Task EchoSubcommand(string input)
|
public async Task EchoSubcommand(string input)
|
||||||
|
=> await RespondAsync(input, components: new ComponentBuilder().WithButton("Echo", $"echoButton_{input}").Build());
|
||||||
|
|
||||||
|
// Component interaction with ignoreGroupNames set to true
|
||||||
|
[ComponentInteraction("echoButton_*", true)]
|
||||||
|
public async Task EchoButton(string input)
|
||||||
=> await RespondAsync(input);
|
=> await RespondAsync(input);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user