From 02f9f7e643ad5ec44744eebb958a9b8451bc3ac6 Mon Sep 17 00:00:00 2001 From: alex Date: Mon, 25 May 2020 18:06:00 -0500 Subject: [PATCH] look at this --- src/index.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/index.js b/src/index.js index 7daa88c..f806e14 100755 --- a/src/index.js +++ b/src/index.js @@ -145,13 +145,14 @@ client.on("message", async message => { let quotes = require(`${homedir}/quotes.json`); var quoteadd = ""; let selector = args[0].toLowerCase() - if(selector === "add") { - quoteadd = args.shift(); - quotes.quotes.push(quoteadd); - JSON.stringify(quotes); - fs.writeFile(`${homedir}/quotes.json`, JSON.stringify(quotes), (err) => { - return message.reply("Something went wrong"); - }); + try{ + if(selector === "add") { + quoteadd = args.shift(); + quotes.quotes.push(quoteadd); + fs.writeFile(`${homedir}/quotes.json`, JSON.stringify(quotes), (err) => { + if (err) return message.reply("Something went wrong"); + }); + } catch (error) {}; client.channels.cache.get('712084662033580064').send(`${message.member} has submitted ${quoteadd} to the quote repository`); return message.reply("Quote added to repository"); };