Skip to content

Commit

Permalink
Fix bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
gideontong committed Nov 29, 2020
1 parent f044fad commit ef439f2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions commands/quote.js
Expand Up @@ -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) {
Expand All @@ -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);
Expand Down

0 comments on commit ef439f2

Please sign in to comment.