From ef439f21697f9273305545c08b1f1482aab5be4d Mon Sep 17 00:00:00 2001 From: Gideon Tong Date: Sun, 29 Nov 2020 14:26:25 -0800 Subject: [PATCH] Fix bugs --- commands/quote.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/commands/quote.js b/commands/quote.js index 80972561..e02cfee6 100644 --- a/commands/quote.js +++ b/commands/quote.js @@ -11,6 +11,8 @@ const { MessageEmbed } = require('discord.js'); module.exports = async (client, msg, args) => { let index = Math.floor(Math.random() * quotes.length); const color = Math.floor(Math.random() * colors); + const quote = new MessageEmbed() + .setColor(color); if (args[1] && !isNaN(args[1])) { let idx = parseInt(args[1]) - 1; if (idx < quotes.length) { @@ -19,9 +21,7 @@ module.exports = async (client, msg, args) => { quote.addField('Error', `There are only ${quotes.length} quotes in the database, so a random one was used.`); } } - const quote = new MessageEmbed() - .setColor(color) - .setDescription(`*${quotes[index].text}*`) + quote.setDescription(`*${quotes[index].text}*`) .setFooter(`- ${quotes[index].author}`) .setTitle(`Random Quote #${index + 1}`); msg.channel.send(quote);