From 0c0155a4d207611fb3d975f9e7e56d04fff63d44 Mon Sep 17 00:00:00 2001 From: Andrew Lee Date: Sat, 14 Oct 2023 00:16:49 -0400 Subject: Docker; Removed packages; Removed binaryworks refs --- commands/quote.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'commands/quote.js') diff --git a/commands/quote.js b/commands/quote.js index 81f9142..37f5714 100644 --- a/commands/quote.js +++ b/commands/quote.js @@ -24,23 +24,23 @@ module.exports.run = async (client, message, args) => { if (quoteID === undefined) { const quoteList = await quoteDB.findAll({ attributes: ['id'] }) - quoteID = Math.floor(Math.random() * (quoteList.length - 1)) + 1 + const random = crypto.getRandomValues(new Uint32Array(1)); + quoteID = quoteList[random[0] % quoteList.length].id; } const quote = await quoteDB.findOne({ where: { id: quoteID } }) if (quote) { - const embed = new MessageEmbed() - .setAuthor({ name: quote.author, iconURL: quote.authorImage}) + const quoteEmbed = new MessageEmbed() + .setAuthor({ name: quote.author, iconURL: quote.authorImage }) .setDescription(quote.quote) .setColor('#1fd619') .setFooter('- ' + quote.year); - await message.reply('Alright, here\'s your quote.') - await message.channel.send({embeds:[embed]}); + await message.reply({ content: 'Alright, here\'s your quote.', embeds: [quoteEmbed] }) } else { - message.reply('Cannot find quote'); + message.reply('Cannot find quote, specify the correct quote id.'); } -- cgit v1.2.3