fix for star/shameboard

This commit is contained in:
loicbersier 2019-07-11 17:30:26 +02:00
parent 3becb69642
commit f0d66466f5

View file

@ -19,37 +19,37 @@ class MessageReactionAddListener extends Listener {
let messageContent = reaction.message.content; let messageContent = reaction.message.content;
let messageAttachments = reaction.message.attachments.map(u=> u.url); let messageAttachments = reaction.message.attachments.map(u=> u.url);
// Starboard
if (fs.existsSync(`./board/star${reaction.message.guild.id}.json`)) { if (fs.existsSync(`./board/star${reaction.message.guild.id}.json`)) {
starboardChannel = require(`../../board/star${reaction.message.guild.id}.json`); starboardChannel = require(`../../board/star${reaction.message.guild.id}.json`);
staremote = starboardChannel['emote']; staremote = starboardChannel['emote'];
starcount = starboardChannel['count']; starcount = starboardChannel['count'];
// Starboard
if (reaction.emoji.name == staremote && reaction.count == starcount) { if (reaction.emoji.name == staremote && reaction.count == starcount) {
if (messageID.includes(reaction.message.id)) if (messageID.includes(reaction.message.id)) {
return console.log('Message already in starboard!'); console.log('Message already in starboard!');
} else {
messageID.push(reaction.message.id); messageID.push(reaction.message.id);
sendEmbed('starboard', staremote, this.client); sendEmbed('starboard', staremote, this.client);
} }
} }
}
//Shameboard
if (fs.existsSync(`./board/shame${reaction.message.guild.id}.json`)) { if (fs.existsSync(`./board/shame${reaction.message.guild.id}.json`)) {
shameboardChannel = require(`../../board/shame${reaction.message.guild.id}.json`); shameboardChannel = require(`../../board/shame${reaction.message.guild.id}.json`);
shameemote = shameboardChannel['emote']; shameemote = shameboardChannel['emote'];
shamecount = shameboardChannel['count']; shamecount = shameboardChannel['count'];
//Shameboard
if (reaction.emoji.name == shameemote && reaction.count == shamecount) { if (reaction.emoji.name == shameemote && reaction.count == shamecount) {
if (messageID.includes(reaction.message.id)) if (messageID.includes(reaction.message.id)) {
return console.log('Message already in starboard!'); console.log('Message already in shameboard!');
} else {
messageID.push(reaction.message.id); messageID.push(reaction.message.id);
sendEmbed('shameboard', shameemote, this.client); sendEmbed('shameboard', shameemote, this.client);
} }
} }
}
function sendEmbed(name, emote, client) { function sendEmbed(name, emote, client) {
let channel; let channel;