Browse Source

Update intro.md

Updated intro.md to include the part where you need to setup the interactions handler.
pull/2401/head
Marten GitHub 2 years ago
parent
commit
ab99b1b210
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 0 deletions
  1. +12
    -0
      docs/guides/int_framework/intro.md

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

@@ -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.


Loading…
Cancel
Save