docs: Improve IF cmd execution docs (#2405)

Adds samples and better explains workflow.
This commit is contained in:
Armano den Boef
2022-08-01 17:01:01 +02:00
committed by GitHub
parent cf25acdbc1
commit 246282dda3
2 changed files with 28 additions and 1 deletions

View File

@@ -0,0 +1,14 @@
// Theres multiple ways to subscribe to the event, depending on your application. Please use the approach fit to your type of client.
// DiscordSocketClient:
_socketClient.InteractionCreated += async (x) =>
{
var ctx = new SocketInteractionContext(_socketClient, x);
await _interactionService.ExecuteCommandAsync(ctx, _serviceProvider);
}
// DiscordShardedClient:
_shardedClient.InteractionCreated += async (x) =>
{
var ctx = new ShardedInteractionContext(_shardedClient, x);
await _interactionService.ExecuteCommandAsync(ctx, _serviceProvider);
}