diff options
Diffstat (limited to 'commands/quote.js')
| -rw-r--r-- | commands/quote.js | 44 |
1 files changed, 38 insertions, 6 deletions
diff --git a/commands/quote.js b/commands/quote.js index 149fe37..69e810a 100644 --- a/commands/quote.js +++ b/commands/quote.js @@ -1,7 +1,7 @@ /** ************************************** * * Quote: Command for AleeBot - * Copyright (C) 2017-2020 Alee Productions + * Copyright (C) 2017-2021 Alee Productions * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -17,17 +17,49 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * * *************************************/ -module.exports.run = async (client, message) => { +const mongo = require('../plugins/mongo'); +const quoteSchema = require('../schema/quote-schema'); +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 Discord = require('discord.js'); let NewQuote; + let quo; + + let quoId; + let quoAuthor; + let quoAuthorImage; + let quoQuote; + let quoYear; + + if (args) { + await mongo().then(async (mongoose) => { + try { + const quote = await quoteSchema.findOne({quoteID: "1", author: quoAuthor, authorImage: quoAuthorImage, quote: quoQuote, year: quoYear}) + /*const embed = new Discord.MessageEmbed() + .setAuthor(quoAuthor, quoAuthorImage) + .setDescription(quoQuote) + .setColor('#1fd619') + .setFooter('- ' + quoYear); + + await message.channel.send({embed});*/ + console.log(quote); + } finally { + await mongoose.connection.close(); + } + }) + } else { + + } + + /* function GetNewQuote(quoteNum = -1) { NewQuote = new Discord.MessageEmbed(); - let quo = require('../storage/quotes.json').quotes; + let quo = require('../storage/quotes.json').quotes - if (quoteNum == -1) { + if (quoteNum === -1) { quoteNum = Math.floor(Math.random() * 1000) % quo.length; quo=quo[quoteNum]; } @@ -42,14 +74,14 @@ module.exports.run = async (client, message) => { NewQuote.setColor('#1fd619'); NewQuote.setDescription(quote); NewQuote.setFooter('- ' + year); - NewQuote.setURL(url); + //NewQuote.setURL(url); return NewQuote; } const newquote = GetNewQuote(); message.reply('Alright, here\'s your quote.'); - message.channel.send(newquote); + await message.channel.send(newquote);*/ }; exports.conf = { |
