Exemple #1
0
            public async sealed override Task ActionOff(ActionData action, SocketReaction reaction)
            {
                var tally = (await action.GetTallyData(reaction.UserId)).Select(x => GetEmote(x)).ToArray();

                if (tally.Length == 0)
                {
                    Console.WriteLine("What th e f uck"); // Pretty sure this is also invalid
                    return;
                }
                if (tally.Contains(reaction.Emote))
                {
                    await Task.WhenAll(
                        ToggleOff(tally, reaction.Channel, reaction.Message.IsSpecified ? reaction.Message.Value : (IUserMessage)(await reaction.Channel.GetMessageAsync(reaction.MessageId)), reaction.UserId, reaction.Emote),
                        action.RemoveTally(reaction.UserId, reaction.Emote.ToString() ?? throw new ArgumentNullException("Reaction emote has null name and it hurts the soul."))
                        );
                } // Seraphina removed the reaction otherwise so it's all good?
            }
Exemple #2
0
            public async sealed override Task ActionOn(ActionData action, SocketReaction reaction)
            {
                var tally = (await action.GetTallyData(reaction.UserId)).Select(x => GetEmote(x)).ToArray();

                if (!await ToggleOn(tally, reaction))
                {
                    if (!((reaction.Message.IsSpecified ? reaction.Message.Value : await reaction.Channel.GetMessageAsync(reaction.MessageId)) is IUserMessage message))
                    {
                        Console.WriteLine("Can't do toggle actions on non-user messages");
                        return;
                    }
                    await message.RemoveReactionAsync(reaction.Emote, reaction.User.IsSpecified?reaction.User.Value : await reaction.Channel.GetUserAsync(reaction.UserId));

                    return;
                }
                await action.AddTally(reaction.UserId, reaction.Emote.ToString() ?? throw new ArgumentNullException("Reaction emote has null name somehow. Asshole emote."));
            }