This commit is contained in:
Dragon Fire
2024-03-21 16:36:45 -04:00
parent 99b71f5657
commit 9c7be4f533
2 changed files with 5 additions and 4 deletions
+4 -3
View File
@@ -48,8 +48,9 @@ module.exports = class AkinatorCommand extends Command {
const gameMsg = await msg.reply('Welcome to Akinator! Think of a character, and I will try to guess it.', { const gameMsg = await msg.reply('Welcome to Akinator! Think of a character, and I will try to guess it.', {
components: [initialRow] components: [initialRow]
}); });
let buttonPress;
try { try {
const initialVerify = await gameMsg.awaitMessageComponent({ buttonPress = await gameMsg.awaitMessageComponent({
filter: res => res.user.id === msg.author.id, filter: res => res.user.id === msg.author.id,
max: 1, max: 1,
time: 30000 time: 30000
@@ -57,7 +58,7 @@ module.exports = class AkinatorCommand extends Command {
if (initialVerify.customId === 'false') return initialVerify.update('Too bad...', { components: [] }); if (initialVerify.customId === 'false') return initialVerify.update('Too bad...', { components: [] });
} catch { } catch {
return gameMsg.edit('Guess you didn\'t want to play after all...', { components: [] }); return gameMsg.edit('Guess you didn\'t want to play after all...', { components: [] });
} }
await this.sendLoadingMessage(buttonPress, [initialRow]); await this.sendLoadingMessage(buttonPress, [initialRow]);
const guessBlacklist = []; const guessBlacklist = [];
while (timesGuessed < 3) { while (timesGuessed < 3) {
@@ -99,7 +100,7 @@ module.exports = class AkinatorCommand extends Command {
break; break;
} }
await this.sendLoadingMessage(buttonPress, [row, sRow]); await this.sendLoadingMessage(buttonPress, [row, sRow]);
const choice = interactions.first().customId; const choice = buttonPress.customId;
if (choice === 'end') { if (choice === 'end') {
forceGuess = true; forceGuess = true;
} else if (choice === 'back') { } else if (choice === 'back') {
+1 -1
View File
@@ -64,7 +64,7 @@ module.exports = class Player {
} }
return true; return true;
}, },
time: 60000 time: 60000
}); });
collector.on('collect', async msg => { collector.on('collect', async msg => {
const existing = hand[Number.parseInt(msg.content, 10) - 1]; const existing = hand[Number.parseInt(msg.content, 10) - 1];