aboutsummaryrefslogtreecommitdiff
path: root/commands/quote.js
diff options
context:
space:
mode:
authorAndrew Lee <alee14498@protonmail.com>2022-09-20 09:24:37 -0400
committerAndrew Lee <alee14498@protonmail.com>2022-09-20 09:24:37 -0400
commit85a8f11507c0fb74b67914090bdfe10c361b775e (patch)
treeda8b96c91854df8953da241ccfe9872e8effe496 /commands/quote.js
parent96762ce209415c72e098a78771f80fcc41413280 (diff)
downloadAleeBot-85a8f11507c0fb74b67914090bdfe10c361b775e.tar.gz
AleeBot-85a8f11507c0fb74b67914090bdfe10c361b775e.tar.bz2
AleeBot-85a8f11507c0fb74b67914090bdfe10c361b775e.zip
Removed jail command; Added more activities; Few tweaks
Diffstat (limited to 'commands/quote.js')
-rw-r--r--commands/quote.js39
1 files changed, 19 insertions, 20 deletions
diff --git a/commands/quote.js b/commands/quote.js
index e431566..481cc9b 100644
--- a/commands/quote.js
+++ b/commands/quote.js
@@ -19,7 +19,7 @@
* *************************************/
const mongo = require('../plugins/mongo');
const quoteSchema = require('../schema/quote-schema');
-module.exports.run = async (client, message) => {
+module.exports.run = async (client, message, args) => {
if (!['242775871059001344'].includes(message.author.id)) return message.reply('**This command is disabled due to a new system being implemented.**');
const { MessageEmbed } = require('discord.js');
@@ -32,27 +32,26 @@ module.exports.run = async (client, message) => {
let quoQuote;
let quoYear;
- // Written using GitHub CoPilot
+ if (args) {
+ await mongo().then(async (mongoose) => {
+ try {
+ const quote = await quoteSchema.findOne({quoteID: args[1], author: quoAuthor, authorImage: quoAuthorImage, quote: quoQuote, year: quoYear})
+ /*
+ const embed = new MessageEmbed()
+ .setAuthor(quoAuthor, quoAuthorImage)
+ .setDescription(quoQuote)
+ .setColor('#1fd619')
+ .setFooter('- ' + quoYear);
- // Fetch a random quote from quoteSchema database then return the quote using embeds
- const fetchQuote = async () => {
- const quote = await mongo.db.collection('quotes').aggregate([{ $sample: { size: 1 } }]).toArray();
- quoId = quote[0]._id;
- quoAuthor = quote[0].author;
- quoAuthorImage = quote[0].authorImage;
- quoQuote = quote[0].quote;
- quoYear = quote[0].year;
- const embed = new MessageEmbed()
-
- .setColor('#0099ff')
- .setAuthor(quoAuthor, quoAuthorImage)
- .setDescription(`${quoQuote}`)
- .setFooter(`${quoYear}`)
- return message.channel.send(embed);
+ await message.channel.send({embeds:[embed]});*/
+ console.log(quote);
+ } finally {
+ await mongoose.connection.close();
+ }
+ })
+ } else {
- };
-
- fetchQuote();
+ }
/*