This commit is contained in:
Dragon Fire
2024-04-13 01:07:06 -04:00
parent 8404a974fb
commit 425d76afe4
+25 -8
View File
@@ -60,14 +60,25 @@ module.exports = class LieSwatterCommand extends Command {
new ButtonBuilder().setCustomId('true').setStyle(ButtonStyle.Success).setLabel('The Truth'),
new ButtonBuilder().setCustomId('false').setStyle(ButtonStyle.Danger).setLabel('A Lie')
);
await gameMsg.edit(`**(${turn}) ${question.category}**\n${question.question}`, { components: [row] });
const choices = await msg.channel.awaitMessageComponent({
await gameMsg.edit({
content: `**(${turn}) ${question.category}**\n${question.question}`,
components: [row]
});
let choices;
try {
choices = await msg.channel.awaitMessageComponent({
filter: res => awaitedPlayers.includes(res.author.id),
max: pts.size,
time: 30000
});
if (!choices.size) {
await gameMsg.edit(`No answers? Well, it was ${question.answer ? 'true' : 'a lie'}.`, { components: [] });
} catch {
choices = null;
}
if (!choices) {
await gameMsg.edit({
content: `No answers? Well, it was ${question.answer ? 'true' : 'a lie'}.`,
components: []
});
if (lastTurnTimeout) {
break;
} else {
@@ -87,22 +98,28 @@ module.exports = class LieSwatterCommand extends Command {
if (correct[0].id === answer.id) player.points += 75;
else player.points += 50;
}
await gameMsg.edit(stripIndents`
await gameMsg.edit({
content: stripIndents`
It was... **${question.answer ? 'true' : 'a lie'}**!
_Fastest Guess: ${correct.length ? `${pts.get(correct[0].id).user.tag} (+75 pts)` : 'No One...'}_
${questions.length ? '_Next round starting in 5 seconds..._' : ''}
`, { components: [] });
`,
components: []
});
if (lastTurnTimeout) lastTurnTimeout = false;
if (questions.length) await delay(5000);
}
const winner = pts.sort((a, b) => b.points - a.points).first().user;
return gameMsg.edit(stripIndents`
return gameMsg.edit({
content: stripIndents`
Congrats, ${winner}!
__**Top 10:**__
${this.makeLeaderboard(pts).slice(0, 10).join('\n')}
`);
`,
components: []
});
}
async fetchQuestions() {