From 42bdb8484bbfbb309f25ed78c70ab4a8d04dad90 Mon Sep 17 00:00:00 2001 From: Davide Fantino <80767709+fantinodavide@users.noreply.github.com> Date: Sat, 25 Feb 2023 11:55:08 +0100 Subject: [PATCH] fix: multiple end announcements after reroll --- mapvote.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mapvote.js b/mapvote.js index 31b9eec..484b5b2 100644 --- a/mapvote.js +++ b/mapvote.js @@ -202,6 +202,7 @@ export default class MapVote extends DiscordBasePlugin { this.or_options = { ...this.options }; this.autovotestart = null; this.lastMapUpdate = new Date(); + this.endVotingTimeout = null; this.timeout_ps = [] this.onNewGame = this.onNewGame.bind(this); @@ -252,7 +253,8 @@ export default class MapVote extends DiscordBasePlugin { async onNewGame() { for (let x of this.timeout_ps) clearTimeout(this.timeout_ps.pop()) - setTimeout(async () => { + + this.endVotingTimeout = setTimeout(async () => { this.endVoting(); this.trackedVotes = {}; this.tallies = []; @@ -743,6 +745,7 @@ export default class MapVote extends DiscordBasePlugin { this.votingEnabled = false; clearInterval(this.broadcastIntervalTask); clearTimeout(this.newVoteTimeout); + clearTimeout(this.endVotingTimeout); this.newVoteTimeout = null; this.broadcastIntervalTask = null; }