src/Bot/ReactionHandler.cs
/// <summary>
/// Handle incoming reaction, check whether it belong to message used as game
/// and process it in that case.
/// </summary>
/// <param name="messageCached">Cached message which got message.</param>
/// <param name="channel">Chanel, in which was reaction added.</param>
/// <param name="reaction">Reaction received.</param>
Handle incoming reaction, check whether it belong to message used as game
and process it in that case.
Handle incoming reaction check whether it belong to message used as game and process it in that case .
private Task HandleReactionAsync(
            Cacheable<IUserMessage, ulong> messageCached, ISocketMessageChannel channel, SocketReaction reaction
        )
        {
            if (! ShouldProcess(messageCached, reaction))
            {
                return Task.CompletedTask;
            }
            ThreadPool.QueueUserWorkItem(async delegate
            {
                await GameFactory.Instance.ProcessReactionAsync(messageCached.Id, reaction);
                DatabaseGames.TryGet(messageCached.Id, out var gameContext);
                await gameContext!.Message.RemoveReactionAsync(reaction.Emote, reaction.UserId);
            });
            return Task.CompletedTask;
        }
private Task HandleReactionAsync ( Cacheable < IUserMessage , ulong > messageCached , ISocketMessageChannel channel , SocketReaction reaction ) { if ( ! ShouldProcess ( messageCached , reaction ) ) { return Task . CompletedTask ; } ThreadPool . QueueUserWorkItem ( async delegate { await GameFactory . Instance . ProcessReactionAsync ( messageCached . Id , reaction ) ; DatabaseGames . TryGet ( messageCached . Id , out var gameContext ) ; await gameContext ! . Message . RemoveReactionAsync ( reaction . Emote , reaction . UserId ) ; } ) ; return Task . CompletedTask ; }
Handle incoming reaction, check whether it belong to message used as game
and process it in that case.
Handle incoming reaction check whether it belong to message used as game and process it in that case .
messageCached
Cacheable<IUserMessage, ulong>
Cached message which got message.
Cached message which got message .
channel
ISocketMessageChannel
Chanel, in which was reaction added.
Chanel in which was reaction added .
reaction
SocketReaction
None