Fix dots-and-boxes

This commit is contained in:
Dragon Fire
2020-05-07 18:00:30 -04:00
parent 2a47ed50e1
commit 3582946e81
+1 -1
View File
@@ -121,11 +121,11 @@ module.exports = class DotsAndBoxesCommand extends Command {
}
if (lastTurnTimeout) lastTurnTimeout = false;
}
this.client.games.delete(msg.channel.id);
if (winner === 'time') return msg.say('Game ended due to inactivity.');
winner = userOwned.length === oppoOwned.length
? null
: userOwned.length > oppoOwned.length ? msg.author : opponent;
this.client.games.delete(msg.channel.id);
return msg.say(winner ? `Congrats, ${winner}!` : 'Looks like it\'s a draw...');
} catch (err) {
this.client.games.delete(msg.channel.id);