Tests d'interception des réactions

This commit is contained in:
Christophe Chailloleau-Leclerc 2019-05-22 23:46:09 +02:00
parent 0ffe5b4e24
commit e75cb67fe7

View File

@ -1,4 +1,5 @@
using Discord.Commands;
using Discord;
using Discord.Commands;
using Discord.WebSocket;
using System;
using System.Reflection;
@ -28,6 +29,8 @@ namespace Sean
{
// Hook the MessageReceived event into our command handler
_client.MessageReceived += HandleCommandAsync;
_client.ReactionAdded += HandleReactionAddedAsync;
_client.ReactionRemoved += HandleReactionRemovedAsync;
// Here we discover all of the command modules in the entry
// assembly and load them. Starting from Discord.NET 2.0, a
@ -76,6 +79,14 @@ namespace Sean
// if (!result.IsSuccess)
// await context.Channel.SendMessageAsync(result.ErrorReason);
}
private async Task HandleReactionAddedAsync(Cacheable<IUserMessage, ulong> message, ISocketMessageChannel channel, SocketReaction reaction)
{
await channel.SendMessageAsync($"Ajout de {reaction.Emote.Name}");
}
private async Task HandleReactionRemovedAsync(Cacheable<IUserMessage, ulong> message, ISocketMessageChannel channel, SocketReaction reaction)
{
await channel.SendMessageAsync($"Retrait de {reaction.Emote.Name}");
}
#endregion Methods
}
}