aboutsummaryrefslogtreecommitdiff
path: root/commands/addquote.js
diff options
context:
space:
mode:
Diffstat (limited to 'commands/addquote.js')
-rw-r--r--commands/addquote.js93
1 files changed, 27 insertions, 66 deletions
diff --git a/commands/addquote.js b/commands/addquote.js
index 6334470..477d891 100644
--- a/commands/addquote.js
+++ b/commands/addquote.js
@@ -17,74 +17,35 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* *************************************/
-const mongo = require('../plugins/mongo');
-const quoteSchema = require('../schema/quote-schema');
+const quoteDB = require('../models/quote');
+const Discord = require("discord.js");
module.exports.run = async (client, message, args) => {
-/*
- let authorMessage;
- let authorImageMessage;
- let quoteMessage;
- let yearMessage;*/
-
if (!['242775871059001344'].includes(message.author.id)) return message.reply('**This command is disabled due to a new system being implemented.**');
- //await message.author.send('Welcome to AleeBot\'s quoting system!\nThis process will be easy.');
-
- if (!args.length) return message.reply("Error: Did not provide more context (message will be replaced eventually)");
-
- await mongo().then(async (mongoose) => {
- try {
- await new quoteSchema({
- author: args[0],
- authorImage: args[1],
- quote: args[2],
- year: args[3]
-
- }).save()
- } finally {
- await mongoose.connection.close();
- message.reply('Added this quote to the database...');
- }
- })
-
-/*
- let quoteState = {};
- let state = quoteState[message.author.id];
-
- if (message.content.toLowerCase() === "q"){
- await message.author.send("Process has been cancelled");
- state = null;
- } else {
- switch (state) {
- case 1:
- await message.author.send('Enter the author\'s name');
- authorMessage = message.content;
- console.log(authorMessage);
- state = 2;
- break;
- case 2:
- await message.author.send('author url here');
- authorImageMessage = message.content;
- console.log(authorImageMessage);
- state = 3;
- break;
- case 3:
- await message.author.send('quote here');
- quoteMessage = message.content;
- console.log(quoteMessage);
- state = 4;
- break;
- case 4:
- await message.author.send('year here');
- yearMessage = message.content;
- console.log(yearMessage);
- state = 5;
- break;
- case 5:
- await message.author.send('process complete');
- state = null;
- break;
- }
-*/
+ try {
+ let newAuthor;
+ let newAuthorImage;
+ let newQuote;
+ let newYear;
+
+ const quote = await quoteDB.create({
+ author: newAuthor,
+ authorImage: newAuthorImage,
+ quote: newQuote,
+ year: newYear
+ })
+
+ const setupEmbed = new Discord.MessageEmbed()
+ .setTitle('AleeBot Quote Setup', client.user.avatarURL())
+ .setDescription('Input the data to the following embed')
+ .addField('Author', newAuthor, true)
+ .addField('Author Image (URL)', newAuthorImage, true)
+ .addField('Quote', newQuote, true)
+ .addField('Year', newYear, true);
+
+ message.reply({embeds: [setupEmbed]});
+ } catch (error) {
+ console.log(error)
+ }
};
exports.conf = {