2019-01-01 03:49:46 +01:00
|
|
|
const { Listener } = require('discord-akairo');
|
2019-01-02 10:21:21 +01:00
|
|
|
const { MessageEmbed } = require('discord.js');
|
2019-01-02 05:51:09 +01:00
|
|
|
const reload = require('auto-reload');
|
2019-01-01 03:49:46 +01:00
|
|
|
|
|
|
|
class MessageReactionAddListener extends Listener {
|
2019-01-02 08:09:45 +01:00
|
|
|
constructor() {
|
|
|
|
super('messagereactionadd', {
|
|
|
|
emitter: 'client',
|
|
|
|
eventName: 'messageReactionAdd'
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
async exec(reaction, message, client) {
|
|
|
|
let messageContent = reaction.message.content;
|
|
|
|
let messageAttachments = reaction.message.attachments.map(u=> `${u.url}`);
|
|
|
|
|
|
|
|
if (reaction.emoji.name === '🌟' && reaction.count === 4) {
|
|
|
|
let starboardChannel = reload(`../starboard/${reaction.message.guild.id}.json`);
|
|
|
|
const channel = this.client.channels.get(starboardChannel['starboard']);
|
|
|
|
|
2019-01-02 10:21:21 +01:00
|
|
|
const starEmbed = new MessageEmbed()
|
|
|
|
.setColor()
|
|
|
|
.setDescription(messageContent)
|
|
|
|
.setAuthor(reaction.message.author.username, reaction.message.author.displayAvatarURL)
|
|
|
|
.setTimestamp();
|
2019-01-02 08:09:45 +01:00
|
|
|
|
|
|
|
channel.send({ embed: starEmbed});
|
|
|
|
return channel.send(`From: ${reaction.message.channel}\n${messageAttachments}`);
|
|
|
|
}
|
|
|
|
if (reaction.emoji.name === '✡' && reaction.count === 4) {
|
|
|
|
let shameboardChannel = reload(`../starboard/${message.guild.id}.json`);
|
|
|
|
const channel = client.channels.get(shameboardChannel['shameboard']);
|
|
|
|
|
2019-01-02 10:21:21 +01:00
|
|
|
const starEmbed = new MessageEmbed()
|
|
|
|
.setColor()
|
|
|
|
.setDescription(messageContent)
|
|
|
|
.setAuthor(reaction.message.author.username, reaction.message.author.displayAvatarURL)
|
|
|
|
.setTimestamp();
|
2019-01-02 08:09:45 +01:00
|
|
|
|
|
|
|
try {
|
|
|
|
channel.send({ embed: starEmbed});
|
|
|
|
await channel.send(messageAttachments);
|
|
|
|
} catch(err) {
|
|
|
|
console.error('There is no shameboard');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2019-01-01 03:49:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = MessageReactionAddListener;
|