mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
Fix
This commit is contained in:
@@ -60,14 +60,25 @@ module.exports = class LieSwatterCommand extends Command {
|
|||||||
new ButtonBuilder().setCustomId('true').setStyle(ButtonStyle.Success).setLabel('The Truth'),
|
new ButtonBuilder().setCustomId('true').setStyle(ButtonStyle.Success).setLabel('The Truth'),
|
||||||
new ButtonBuilder().setCustomId('false').setStyle(ButtonStyle.Danger).setLabel('A Lie')
|
new ButtonBuilder().setCustomId('false').setStyle(ButtonStyle.Danger).setLabel('A Lie')
|
||||||
);
|
);
|
||||||
await gameMsg.edit(`**(${turn}) ${question.category}**\n${question.question}`, { components: [row] });
|
await gameMsg.edit({
|
||||||
const choices = await msg.channel.awaitMessageComponent({
|
content: `**(${turn}) ${question.category}**\n${question.question}`,
|
||||||
filter: res => awaitedPlayers.includes(res.author.id),
|
components: [row]
|
||||||
max: pts.size,
|
|
||||||
time: 30000
|
|
||||||
});
|
});
|
||||||
if (!choices.size) {
|
let choices;
|
||||||
await gameMsg.edit(`No answers? Well, it was ${question.answer ? 'true' : 'a lie'}.`, { components: [] });
|
try {
|
||||||
|
choices = await msg.channel.awaitMessageComponent({
|
||||||
|
filter: res => awaitedPlayers.includes(res.author.id),
|
||||||
|
max: pts.size,
|
||||||
|
time: 30000
|
||||||
|
});
|
||||||
|
} catch {
|
||||||
|
choices = null;
|
||||||
|
}
|
||||||
|
if (!choices) {
|
||||||
|
await gameMsg.edit({
|
||||||
|
content: `No answers? Well, it was ${question.answer ? 'true' : 'a lie'}.`,
|
||||||
|
components: []
|
||||||
|
});
|
||||||
if (lastTurnTimeout) {
|
if (lastTurnTimeout) {
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
@@ -87,22 +98,28 @@ module.exports = class LieSwatterCommand extends Command {
|
|||||||
if (correct[0].id === answer.id) player.points += 75;
|
if (correct[0].id === answer.id) player.points += 75;
|
||||||
else player.points += 50;
|
else player.points += 50;
|
||||||
}
|
}
|
||||||
await gameMsg.edit(stripIndents`
|
await gameMsg.edit({
|
||||||
It was... **${question.answer ? 'true' : 'a lie'}**!
|
content: stripIndents`
|
||||||
|
It was... **${question.answer ? 'true' : 'a lie'}**!
|
||||||
|
|
||||||
_Fastest Guess: ${correct.length ? `${pts.get(correct[0].id).user.tag} (+75 pts)` : 'No One...'}_
|
_Fastest Guess: ${correct.length ? `${pts.get(correct[0].id).user.tag} (+75 pts)` : 'No One...'}_
|
||||||
${questions.length ? '_Next round starting in 5 seconds..._' : ''}
|
${questions.length ? '_Next round starting in 5 seconds..._' : ''}
|
||||||
`, { components: [] });
|
`,
|
||||||
|
components: []
|
||||||
|
});
|
||||||
if (lastTurnTimeout) lastTurnTimeout = false;
|
if (lastTurnTimeout) lastTurnTimeout = false;
|
||||||
if (questions.length) await delay(5000);
|
if (questions.length) await delay(5000);
|
||||||
}
|
}
|
||||||
const winner = pts.sort((a, b) => b.points - a.points).first().user;
|
const winner = pts.sort((a, b) => b.points - a.points).first().user;
|
||||||
return gameMsg.edit(stripIndents`
|
return gameMsg.edit({
|
||||||
Congrats, ${winner}!
|
content: stripIndents`
|
||||||
|
Congrats, ${winner}!
|
||||||
|
|
||||||
__**Top 10:**__
|
__**Top 10:**__
|
||||||
${this.makeLeaderboard(pts).slice(0, 10).join('\n')}
|
${this.makeLeaderboard(pts).slice(0, 10).join('\n')}
|
||||||
`);
|
`,
|
||||||
|
components: []
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async fetchQuestions() {
|
async fetchQuestions() {
|
||||||
|
|||||||
Reference in New Issue
Block a user