From ee8957913ff0906eaa823ee725bbf94c82d24790 Mon Sep 17 00:00:00 2001 From: loicbersier Date: Sun, 30 Jun 2019 22:47:25 +0200 Subject: [PATCH] fixed the command not working --- event/listeners/messageReactionAdd.js | 46 ++++++++++++++------------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/event/listeners/messageReactionAdd.js b/event/listeners/messageReactionAdd.js index 32f9c2ed..490b9039 100644 --- a/event/listeners/messageReactionAdd.js +++ b/event/listeners/messageReactionAdd.js @@ -15,38 +15,40 @@ class MessageReactionAddListener extends Listener { async exec(reaction, user) { if (reaction.message.author == user) return; let starboardChannel, shameboardChannel, staremote, starcount, shameemote, shamecount; - if (fs.existsSync(`./board/star${reaction.message.guild.id}.json`)) { - starboardChannel = require(`../../board/star${reaction.message.guild.id}.json`); - staremote = starboardChannel['emote']; - starcount = starboardChannel['count']; - } - if (fs.existsSync(`./board/shame${reaction.message.guild.id}.json`)) { - shameboardChannel = require(`../../board/shame${reaction.message.guild.id}.json`); - shameemote = shameboardChannel['emote']; - shamecount = shameboardChannel['count']; - } let messageContent = reaction.message.content; let messageAttachments = reaction.message.attachments.map(u=> u.url); - // Starboard - if (reaction.emoji.name == staremote && reaction.count == starcount) { - if (messageID.includes(reaction.message.id)) - return console.log('Message already in starboard!'); + if (fs.existsSync(`./board/star${reaction.message.guild.id}.json`)) { + starboardChannel = require(`../../board/star${reaction.message.guild.id}.json`); + staremote = starboardChannel['emote']; + starcount = starboardChannel['count']; - messageID.push(reaction.message.id); + // Starboard + if (reaction.emoji.name == staremote && reaction.count == starcount) { + if (messageID.includes(reaction.message.id)) + return console.log('Message already in starboard!'); - sendEmbed('starboard', staremote, this.client); + messageID.push(reaction.message.id); + + sendEmbed('starboard', staremote, this.client); + } } - //Shameboard - if (reaction.emoji.name == shameemote && reaction.count == shamecount) { - if (messageID.includes(reaction.message.id)) - return console.log('Message already in starboard!'); + if (fs.existsSync(`./board/shame${reaction.message.guild.id}.json`)) { + shameboardChannel = require(`../../board/shame${reaction.message.guild.id}.json`); + shameemote = shameboardChannel['emote']; + shamecount = shameboardChannel['count']; - messageID.push(reaction.message.id); + //Shameboard + if (reaction.emoji.name == shameemote && reaction.count == shamecount) { + if (messageID.includes(reaction.message.id)) + return console.log('Message already in starboard!'); - sendEmbed('shameboard', shameemote, this.client); + messageID.push(reaction.message.id); + + sendEmbed('shameboard', shameemote, this.client); + } } function sendEmbed(name, emote, client) {