mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-23 10:02:05 +02:00
Fix Some Bugs
This commit is contained in:
@@ -60,6 +60,7 @@ module.exports = class ConnectFourCommand extends Command {
|
|||||||
const filter = res => {
|
const filter = res => {
|
||||||
const choice = res.content;
|
const choice = res.content;
|
||||||
if (choice.toLowerCase() === 'end') return true;
|
if (choice.toLowerCase() === 'end') return true;
|
||||||
|
if (!board[Number.parseInt(choice, 10) - 1]) return false;
|
||||||
if (!board[Number.parseInt(choice, 10) - 1].includes(null)) return false;
|
if (!board[Number.parseInt(choice, 10) - 1].includes(null)) return false;
|
||||||
return res.author.id === user.id;
|
return res.author.id === user.id;
|
||||||
};
|
};
|
||||||
@@ -78,7 +79,7 @@ module.exports = class ConnectFourCommand extends Command {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
const i = Number.parseInt(choice, 10) - 1;
|
const i = Number.parseInt(choice, 10) - 1;
|
||||||
board[i][board[i][6]] = sign;
|
board[i][5 - board[i][6]] = sign;
|
||||||
board[i][6] += 1;
|
board[i][6] += 1;
|
||||||
if (this.verifyWin(board)) winner = userTurn ? msg.author : opponent;
|
if (this.verifyWin(board)) winner = userTurn ? msg.author : opponent;
|
||||||
userTurn = !userTurn;
|
userTurn = !userTurn;
|
||||||
@@ -132,6 +133,6 @@ module.exports = class ConnectFourCommand extends Command {
|
|||||||
if (piece === 'user') return playerOneEmoji;
|
if (piece === 'user') return playerOneEmoji;
|
||||||
if (piece === 'oppo') return playerTwoEmoji;
|
if (piece === 'oppo') return playerTwoEmoji;
|
||||||
return blankEmoji;
|
return blankEmoji;
|
||||||
}).join(' ')).join('\n');
|
}).join('')).join('\n');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user