mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-21 14:04:38 +02:00
Either player can forfeit
This commit is contained in:
@@ -84,9 +84,10 @@ module.exports = class ChessCommand extends Command {
|
|||||||
prevPieces = Object.assign({}, game.exportJson().pieces);
|
prevPieces = Object.assign({}, game.exportJson().pieces);
|
||||||
const moves = game.moves();
|
const moves = game.moves();
|
||||||
const pickFilter = res => {
|
const pickFilter = res => {
|
||||||
if (res.author.id !== user.id) return false;
|
if (![msg.author.id, opponent.id].includes(res.author.id)) return false;
|
||||||
const choice = res.content.toUpperCase();
|
const choice = res.content.toUpperCase();
|
||||||
if (choice === 'END') return true;
|
if (choice === 'END') return true;
|
||||||
|
if (res.author.id !== user.id) return false;
|
||||||
const move = choice.match(turnRegex);
|
const move = choice.match(turnRegex);
|
||||||
if (!move) return false;
|
if (!move) return false;
|
||||||
if (!moves[move[1]] || !moves[move[1]].includes(move[2])) {
|
if (!moves[move[1]] || !moves[move[1]].includes(move[2])) {
|
||||||
|
|||||||
Reference in New Issue
Block a user