From c84134a193706e9f2e62c769ffc2e389692a3649 Mon Sep 17 00:00:00 2001 From: Xodrium <118943715+malloc62@users.noreply.github.com> Date: Sat, 18 Feb 2023 06:08:26 -0500 Subject: [PATCH] Patch instant-vote bug Prevents a bug that allows the suggester of an element to down-vote then quickly remove their down-vote, leading to the element getting voted in at one below the required number --- eod/polls/handle.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/eod/polls/handle.go b/eod/polls/handle.go index 81cc347e..670812c0 100644 --- a/eod/polls/handle.go +++ b/eod/polls/handle.go @@ -35,18 +35,18 @@ func (b *Polls) reactionHandler(s *discordgo.Session, r *discordgo.MessageReacti return } - // User trying to delete? - if r.UserID == p.Creator && r.Emoji.Name == DownArrow { - b.deletePoll(&p, s) - return - } - // Handle if r.Emoji.Name == UpArrow { p.Upvotes++ } else { p.Downvotes++ } + + // User trying to delete? + if r.UserID == p.Creator && r.Emoji.Name == DownArrow { + b.deletePoll(&p, s) + return + } // Update _, err = b.db.NamedExec("UPDATE polls SET upvotes=:upvotes, downvotes=:downvotes WHERE guild=:guild AND message=:message", p)