fixed shameboard

This commit is contained in:
loicbersier 2019-01-03 17:52:54 +01:00
parent 97b312625e
commit 084e5cb21e

View file

@ -11,7 +11,7 @@ class MessageReactionAddListener extends Listener {
}); });
} }
async exec(reaction, message, client) { async exec(reaction) {
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}`);
@ -36,26 +36,21 @@ class MessageReactionAddListener extends Listener {
if (reaction.emoji.name === '✡' && reaction.count === 4) { if (reaction.emoji.name === '✡' && reaction.count === 4) {
if (messageID.includes(reaction.message.id)) if (messageID.includes(reaction.message.id))
return console.log('Message already in starboard!'); return console.log('Message already in starboard!');
messageID.push(reaction.message.id); messageID.push(reaction.message.id);
let shameboardChannel = reload(`../starboard/${message.guild.id}.json`); let shameboardChannel = reload(`../starboard/${reaction.message.guild.id}.json`);
const channel = client.channels.get(shameboardChannel['shameboard']); const channel = this.client.channels.get(shameboardChannel['shameboard']);
const starEmbed = new MessageEmbed() const shameEmbed = new MessageEmbed()
.setColor() .setColor()
.setDescription(messageContent) .setDescription(messageContent)
.setAuthor(reaction.message.author.username, reaction.message.author.displayAvatarURL) .setAuthor(reaction.message.author.username, reaction.message.author.displayAvatarURL)
.setTimestamp(); .setTimestamp();
try { channel.send({ embed: shameEmbed});
channel.send({ embed: starEmbed}); return channel.send(`From: ${reaction.message.channel} ID: ${reaction.message.id} \n${messageAttachments}`);
await channel.send(messageAttachments);
} catch(err) {
console.error('There is no shameboard');
}
} }
} }
} }