From cf25acdbc10941003046ef097e996b82acd00e4b Mon Sep 17 00:00:00 2001 From: Misha133 <61027276+Misha-133@users.noreply.github.com> Date: Mon, 1 Aug 2022 14:39:11 +0300 Subject: [PATCH] docs: Add IgnoreGroupNames clarification to IF docs (#2374) --- docs/guides/int_framework/intro.md | 5 +++++ docs/guides/int_framework/samples/intro/groupmodule.cs | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/docs/guides/int_framework/intro.md b/docs/guides/int_framework/intro.md index 23be5b544..5d3253a6f 100644 --- a/docs/guides/int_framework/intro.md +++ b/docs/guides/int_framework/intro.md @@ -291,6 +291,11 @@ 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. +> [!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)] ## Executing Commands diff --git a/docs/guides/int_framework/samples/intro/groupmodule.cs b/docs/guides/int_framework/samples/intro/groupmodule.cs index f0d992aff..a07b2e4d8 100644 --- a/docs/guides/int_framework/samples/intro/groupmodule.cs +++ b/docs/guides/int_framework/samples/intro/groupmodule.cs @@ -16,6 +16,11 @@ public class CommandGroupModule : InteractionModuleBase await RespondAsync(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); } } \ No newline at end of file