diff options
| author | Andrew Lee <alee14498@protonmail.com> | 2022-09-15 15:06:29 -0400 |
|---|---|---|
| committer | Andrew Lee <alee14498@protonmail.com> | 2022-09-15 15:06:29 -0400 |
| commit | 96762ce209415c72e098a78771f80fcc41413280 (patch) | |
| tree | 4340e737752f0468aeab7451bfb7c30db7e0de50 /commands | |
| parent | caa341ec28a1247bd06602ba3bc727a7ff8f1fd7 (diff) | |
| download | AleeBot-96762ce209415c72e098a78771f80fcc41413280.tar.gz AleeBot-96762ce209415c72e098a78771f80fcc41413280.tar.bz2 AleeBot-96762ce209415c72e098a78771f80fcc41413280.zip | |
2022 update; Modularized activities
Diffstat (limited to 'commands')
| -rw-r--r-- | commands/about.js | 4 | ||||
| -rw-r--r-- | commands/quote.js | 43 | ||||
| -rw-r--r-- | commands/serverinfo.js | 2 |
3 files changed, 25 insertions, 24 deletions
diff --git a/commands/about.js b/commands/about.js index 5fd11de..14daebb 100644 --- a/commands/about.js +++ b/commands/about.js @@ -22,10 +22,10 @@ module.exports.run = async (client, message) => { const aboutEmbed = new MessageEmbed() .setAuthor(`AleeBot ${require('../storage/settings.json').abVersion}`, client.user.avatarURL()) - .addField('About AleeBot', 'AleeBot is an all-in-one bot that\'s made from the Discord.JS api!') + .addField('About AleeBot', 'AleeBot is an all-in-one bot that\'s made from the Discord.JS API!') .addField('License', 'GNU General Public License v3.0') .addField('Contributors', 'Andrew Lee (Founder of this project)\nOfficialRain (Raina) (Uptime Command)\njtsshieh (Command Handler)') - .setFooter('© Copyright 2017-2021 Alee Productions') + .setFooter('© Copyright 2017-2022 Andrew Lee Projects') .setColor('#1fd619'); let inviteButton = new MessageActionRow() diff --git a/commands/quote.js b/commands/quote.js index 57729ae..e431566 100644 --- a/commands/quote.js +++ b/commands/quote.js @@ -19,12 +19,12 @@ * *************************************/ const mongo = require('../plugins/mongo'); const quoteSchema = require('../schema/quote-schema'); -module.exports.run = async (client, message, args) => { +module.exports.run = async (client, message) => { 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'); - let NewQuote; - let quo; +// let NewQuote; +// let quo; let quoId; let quoAuthor; @@ -32,26 +32,27 @@ module.exports.run = async (client, message, args) => { let quoQuote; let quoYear; - 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); + // Written using GitHub CoPilot - await message.channel.send({embeds:[embed]});*/ - console.log(quote); - } finally { - await mongoose.connection.close(); - } - }) - } else { + // 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); - } + }; + + fetchQuote(); /* diff --git a/commands/serverinfo.js b/commands/serverinfo.js index 049ad98..513b1b4 100644 --- a/commands/serverinfo.js +++ b/commands/serverinfo.js @@ -27,7 +27,7 @@ module.exports.run = async (client, message) => { .setThumbnail(`${message.guild.iconURL()}`) .addField('Server Name:', `${message.guild.name}`) .addField('Server ID:', `${message.guild.id}`) - .addField('Create At:', `${message.guild.createdAt.toUTCString()}`) + .addField('Created At:', `${message.guild.createdAt.toUTCString()}`) /*message.guild.channels.cacheType.forEach(channel => { listedChannels.push(channel) })*/ |
