mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-23 10:02:05 +02:00
Gracefully handle empty clues
This commit is contained in:
@@ -43,6 +43,9 @@ module.exports = class JeopardyCommand extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async run(msg) {
|
async run(msg) {
|
||||||
|
if (!this.client.jeopardy.clues.length) {
|
||||||
|
return msg.reply('Hang tight! I\'m updating my clue database.');
|
||||||
|
}
|
||||||
const question = this.client.jeopardy.clues[Math.floor(Math.random() * this.client.jeopardy.clues.length)];
|
const question = this.client.jeopardy.clues[Math.floor(Math.random() * this.client.jeopardy.clues.length)];
|
||||||
const clueCard = await this.generateClueCard(question.question);
|
const clueCard = await this.generateClueCard(question.question);
|
||||||
const connection = msg.guild ? this.client.dispatchers.get(msg.guild.id) : null;
|
const connection = msg.guild ? this.client.dispatchers.get(msg.guild.id) : null;
|
||||||
|
|||||||
Reference in New Issue
Block a user