End Bingo game if no one calls bingo

This commit is contained in:
Dragon Fire
2020-06-09 09:46:29 -04:00
parent 81ff24dc27
commit 031e1659d1
2 changed files with 3 additions and 1 deletions
+2
View File
@@ -48,6 +48,7 @@ module.exports = class BingoCommand extends Command {
const called = ['FR'];
while (!winner) {
const validNums = callNums.filter(num => !called.includes(num));
if (!validNums.length) break;
const picked = validNums[Math.floor(Math.random() * validNums.length)];
called.push(picked);
for (const player of players.values()) {
@@ -80,6 +81,7 @@ module.exports = class BingoCommand extends Command {
winner = bingo.first().author;
}
this.client.games.delete(msg.channel.id);
if (!winner) return msg.say('I called the entire board, but no one called bingo...');
return msg.say(`Congrats, ${winner.user}!`);
} catch (err) {
this.client.games.delete(msg.channel.id);
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "xiao",
"version": "116.9.3",
"version": "116.9.4",
"description": "Your personal server companion.",
"main": "Xiao.js",
"scripts": {