mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-19 21:40:51 +02:00
Fix
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
const Command = require('../../structures/Command');
|
const Command = require('../../structures/Command');
|
||||||
const { stripIndents } = require('common-tags');
|
const { stripIndents } = require('common-tags');
|
||||||
|
const Collection = require('@discordjs/collection');
|
||||||
const questions = require('../../assets/json/guesspionage');
|
const questions = require('../../assets/json/guesspionage');
|
||||||
const { SUCCESS_EMOJI_ID } = process.env;
|
const { SUCCESS_EMOJI_ID } = process.env;
|
||||||
const guesses = ['much higher', 'higher', 'lower', 'much lower'];
|
const guesses = ['much higher', 'higher', 'lower', 'much lower'];
|
||||||
@@ -49,7 +50,7 @@ module.exports = class GuesspionageCommand extends Command {
|
|||||||
return msg.say('Game could not be started...');
|
return msg.say('Game could not be started...');
|
||||||
}
|
}
|
||||||
let turn = 0;
|
let turn = 0;
|
||||||
const pts = new Map();
|
const pts = new Collection();
|
||||||
for (const player of awaitedPlayers) {
|
for (const player of awaitedPlayers) {
|
||||||
pts.set(player, {
|
pts.set(player, {
|
||||||
points: 0,
|
points: 0,
|
||||||
@@ -59,7 +60,7 @@ module.exports = class GuesspionageCommand extends Command {
|
|||||||
}
|
}
|
||||||
const used = [];
|
const used = [];
|
||||||
const userTurn = awaitedPlayers.slice(0);
|
const userTurn = awaitedPlayers.slice(0);
|
||||||
while (turn <= pts.size) {
|
while (userTurn.length) {
|
||||||
++turn;
|
++turn;
|
||||||
const mainUser = pts.get(userTurn[0]).user;
|
const mainUser = pts.get(userTurn[0]).user;
|
||||||
userTurn.shift();
|
userTurn.shift();
|
||||||
@@ -100,6 +101,7 @@ module.exports = class GuesspionageCommand extends Command {
|
|||||||
if (!awaitedPlayers.includes(res.author.id)) return false;
|
if (!awaitedPlayers.includes(res.author.id)) return false;
|
||||||
if (!guesses.includes(res.content.toLowerCase())) return false;
|
if (!guesses.includes(res.content.toLowerCase())) return false;
|
||||||
guessed.push(res.author.id);
|
guessed.push(res.author.id);
|
||||||
|
res.react(SUCCESS_EMOJI_ID || '✅').catch(() => null);
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
const everyoneElse = await msg.channel.awaitMessages(everyoneElseFilter, {
|
const everyoneElse = await msg.channel.awaitMessages(everyoneElseFilter, {
|
||||||
|
|||||||
Reference in New Issue
Block a user