From b7e7d89d24503c2e9b8a46957d9ac69badc515bd Mon Sep 17 00:00:00 2001 From: Benjamin Harris Date: Wed, 13 Dec 2017 00:30:30 -0500 Subject: [PATCH] pollwork... --- Services/PollService.cs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Services/PollService.cs b/Services/PollService.cs index 22ded1d..bf8f2e3 100644 --- a/Services/PollService.cs +++ b/Services/PollService.cs @@ -9,6 +9,7 @@ namespace dotbot.Services { public class PollService { + private readonly ulong _selfId; public Dictionary currentPolls; public PollService(DiscordSocketClient discord) @@ -16,15 +17,13 @@ namespace dotbot.Services currentPolls = new Dictionary(); discord.ReactionAdded += OnReactionAddedAsync; + _selfId = discord.CurrentUser.Id; } private Task OnReactionAddedAsync(Cacheable CachedMessage, ISocketMessageChannel Channel, SocketReaction Reaction) { - if (currentPolls.ContainsKey(Channel.Id)) - { - currentPolls[Channel.Id].Options.First(o => o.MessageId == CachedMessage.Id).Votes++; - } - // Console.WriteLine($"{Reaction.Emote} reaction added to {CachedMessage.Id} in {Channel.Name}"); + if (currentPolls.ContainsKey(Channel.Id) && Reaction.UserId != _selfId) + currentPolls[Channel.Id].Options.First(o => o.MessageId == Reaction.MessageId).Votes++; return Task.CompletedTask; }