Fix button-based stuff

This commit is contained in:
Dragon Fire
2024-03-21 16:32:39 -04:00
parent 60b4d5b5b7
commit 99b71f5657
5 changed files with 63 additions and 54 deletions
+13 -10
View File
@@ -53,16 +53,19 @@ module.exports = class Player {
await this.sendHand(hand, black);
let gambled = false;
let swapped = false;
const collector = this.user.dmChannel.createMessageCollector(res => {
if (res.content.toLowerCase() === 'swap' && this.points > 0 && !swapped) return true;
if (res.content.toLowerCase() === 'gamble' && this.points > 0 && !gambled) return true;
const existing = hand[Number.parseInt(res.content, 10) - 1];
if (!existing || chosen.includes(existing)) {
reactIfAble(res, res.author, FAILURE_EMOJI_ID, '❌');
return false;
}
return true;
}, { time: 60000 });
const collector = this.user.dmChannel.createMessageCollector({
filter: res => {
if (res.content.toLowerCase() === 'swap' && this.points > 0 && !swapped) return true;
if (res.content.toLowerCase() === 'gamble' && this.points > 0 && !gambled) return true;
const existing = hand[Number.parseInt(res.content, 10) - 1];
if (!existing || chosen.includes(existing)) {
reactIfAble(res, res.author, FAILURE_EMOJI_ID, '❌');
return false;
}
return true;
},
time: 60000
});
collector.on('collect', async msg => {
const existing = hand[Number.parseInt(msg.content, 10) - 1];
if (msg.content.toLowerCase() === 'swap') {