This commit is contained in:
Dragon Fire
2021-06-07 20:39:08 -04:00
parent 434e7bd288
commit 8a2238cd8f
+12 -3
View File
@@ -61,7 +61,7 @@ module.exports = class AkinatorCommand extends Command {
}
let buttonPress = initialVerify.first();
if (buttonPress.customID === 'false') return buttonPress.update('Too bad...', { components: [] });
await buttonPress.deferUpdate();
await this.sendLoadingMessage(buttonPress, [initialRow]);
const guessBlacklist = [];
this.client.games.set(msg.channel.id, { name: this.name });
while (timesGuessed < 3) {
@@ -100,7 +100,7 @@ module.exports = class AkinatorCommand extends Command {
break;
}
buttonPress = interactions.first();
await buttonPress.deferUpdate();
await this.sendLoadingMessage(buttonPress, [row, sRow]);
const choice = interactions.first().customID;
if (choice === 'end') {
forceGuess = true;
@@ -146,7 +146,7 @@ module.exports = class AkinatorCommand extends Command {
break;
}
buttonPress = verification.first();
await buttonPress.deferUpdate();
await this.sendLoadingMessage(buttonPress, [guessRow]);
if (buttonPress.customID === 'true') {
win = false;
break;
@@ -173,4 +173,13 @@ module.exports = class AkinatorCommand extends Command {
throw err;
}
}
sendLoadingMessage(buttonPress, rows) {
for (const row of rows) {
for (const button of row.components) {
button.setDisabled(true);
}
}
return buttonPress.update('Loading...', { components: [rows] });
}
};