From c45c2862c2a71b0d193547ae8303e207704bdc75 Mon Sep 17 00:00:00 2001 From: Michal Orlik Date: Mon, 11 Feb 2019 13:44:33 +0100 Subject: [PATCH] fix(polls): extend timeout for sending several messages Extend timeout for sending several messages should help tests to have correct order of messages. If we still have some issues with this, we shuld consider to add proper message queue --- src/bot/systems/polls.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/bot/systems/polls.ts b/src/bot/systems/polls.ts index 56a06b74bd6..2eed0805577 100644 --- a/src/bot/systems/polls.ts +++ b/src/bot/systems/polls.ts @@ -142,7 +142,7 @@ class Polls extends System { } else { global.commons.sendMessage(`#vote${Number(index) + 1} - ${option} - ${votesCount} ${global.commons.getLocalizedName(votesCount, 'systems.polls.votes')}, ${percentage}%`, opts.sender); } - }, 100 * (Number(index) + 1)); + }, 300 * (Number(index) + 1)); } } } catch (e) { @@ -180,7 +180,7 @@ class Polls extends System { for (const index of Object.keys(options)) { setTimeout(() => { if (type === 'normal') { global.commons.sendMessage(this.settings.commands['!vote'] + ` ${(Number(index) + 1)} => ${options[index]}`, opts.sender); } else { global.commons.sendMessage(`#vote${(Number(index) + 1)} => ${options[index]}`, opts.sender); } - }, 100 * (Number(index) + 1)); + }, 300 * (Number(index) + 1)); } this.lastTimeRemind = Date.now(); @@ -199,7 +199,7 @@ class Polls extends System { for (const index of Object.keys(cVote.options)) { setTimeout(() => { if (cVote.type === 'normal') { global.commons.sendMessage(this.settings.commands['!poll open'] + ` ${index} => ${cVote.options[index]}`, opts.sender); } else { global.commons.sendMessage(`#vote${(Number(index) + 1)} => ${cVote.options[index]}`, opts.sender); } - }, 100 * (Number(index) + 1)); + }, 300 * (Number(index) + 1)); } break; default: @@ -366,7 +366,7 @@ class Polls extends System { for (const index of Object.keys(vote.options)) { setTimeout(() => { if (vote.type === 'normal') { global.commons.sendMessage(this.settings.commands['!vote'] + ` ${(Number(index) + 1)} => ${vote.options[index]}`, global.commons.getOwner()); } else { global.commons.sendMessage(`#vote${(Number(index) + 1)} => ${vote.options[index]}`, global.commons.getOwner()); } - }, 100 * (Number(index) + 1)); + }, 300 * (Number(index) + 1)); } } }