From ab99b1b210ae4534ea12974752d94bad1bba4b76 Mon Sep 17 00:00:00 2001 From: Marten Date: Sun, 31 Jul 2022 15:14:05 +0200 Subject: [PATCH] Update intro.md Updated intro.md to include the part where you need to setup the interactions handler. --- docs/guides/int_framework/intro.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/docs/guides/int_framework/intro.md b/docs/guides/int_framework/intro.md index 54e9086a1..a53488ec6 100644 --- a/docs/guides/int_framework/intro.md +++ b/docs/guides/int_framework/intro.md @@ -20,6 +20,18 @@ var _interactionService = new InteractionService(_client.Rest); ... ``` +Interactions are not directly executed by the `InteractionService`. You need to setup a handler that handles the InteractionCreated event and passes it to the `InteractionService`. This is also the part where the `SocketInteractionContext` will be created here. +```csharp +... +await _interactionService.AddModulesAsync(assembly: Assembly.GetEntryAssembly(), services: null); +_client.InteractionCreated += async (interaction) => +{ + var ctx = new SocketInteractionContext(Client, interaction); + await _interactionService.ExecuteCommandAsync(ctx, services: null); +}; +... +``` + ## Modules Attribute based Interaction handlers must be defined within a command module class.