This commit is contained in:
Dragon Fire
2021-01-09 11:03:49 -05:00
parent aa0d419b84
commit b0e9635c32
+3 -3
View File
@@ -62,7 +62,7 @@ module.exports = class ConnectFourCommand extends Command {
this.client.games.delete(msg.channel.id);
return msg.say('Looks like they declined...');
}
const available = Object.keys(colors).filter(clr => color != clr);
const available = Object.keys(colors).filter(clr => color !== clr);
await msg.say(`${opponent}, what color do you want to be? Either ${list(available, 'or')}.`);
const filter = res => res.author.id === opponent.id && available.includes(res.content.toLowerCase());
const p2Color = await msg.channel.awaitMessages(filter, {
@@ -84,14 +84,14 @@ module.exports = class ConnectFourCommand extends Command {
${this.displayBoard(board, playerOneEmoji, playerTwoEmoji)}
${nums.join('')}
`);
const filter = res => {
const pickFilter = res => {
if (res.author.id !== user.id) return false;
const choice = res.content;
if (choice.toLowerCase() === 'end') return true;
const i = Number.parseInt(choice, 10) - 1;
return board[colLevels[i]] && board[colLevels[i]][i] !== undefined;
};
const turn = await msg.channel.awaitMessages(filter, {
const turn = await msg.channel.awaitMessages(pickFilter, {
max: 1,
time: 60000
});