Removed useless thing
This commit is contained in:
parent
b2e1193b65
commit
efdfdb52ba
1 changed files with 24 additions and 60 deletions
|
@ -13,12 +13,11 @@ class MessageReactionAddListener extends Listener {
|
||||||
|
|
||||||
async exec(reaction, user) {
|
async exec(reaction, user) {
|
||||||
if (reaction.message.author == user) return;
|
if (reaction.message.author == user) return;
|
||||||
|
|
||||||
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);
|
||||||
|
|
||||||
let starboardChannel;
|
let starboardChannel, staremote, starcount, shameboardChannel, shameemote, shamecount;
|
||||||
let staremote;
|
|
||||||
let starcount;
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
starboardChannel = reload(`../../board/star${reaction.message.guild.id}.json`);
|
starboardChannel = reload(`../../board/star${reaction.message.guild.id}.json`);
|
||||||
|
@ -26,9 +25,17 @@ class MessageReactionAddListener extends Listener {
|
||||||
staremote = starboardChannel['emote'];
|
staremote = starboardChannel['emote'];
|
||||||
starcount = starboardChannel['count'];
|
starcount = starboardChannel['count'];
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
return null;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
shameboardChannel = reload(`../../board/shame${reaction.message.guild.id}.json`);
|
||||||
|
|
||||||
|
shameemote = shameboardChannel['emote'];
|
||||||
|
shamecount = shameboardChannel['count'];
|
||||||
|
} catch (err) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Starboard
|
// Starboard
|
||||||
if (reaction.emoji.name == staremote && reaction.count == starcount) {
|
if (reaction.emoji.name == staremote && reaction.count == starcount) {
|
||||||
|
@ -37,48 +44,9 @@ class MessageReactionAddListener extends Listener {
|
||||||
|
|
||||||
messageID.push(reaction.message.id);
|
messageID.push(reaction.message.id);
|
||||||
|
|
||||||
const channel = this.client.channels.get(starboardChannel['starboard']);
|
sendEmbed('starboard', staremote, this.client);
|
||||||
|
|
||||||
if (!messageContent) {
|
|
||||||
const starEmbed = new MessageEmbed()
|
|
||||||
.setColor(reaction.message.member.displayHexColor)
|
|
||||||
.setAuthor(reaction.message.author.username, reaction.message.author.displayAvatarURL())
|
|
||||||
.setDescription(`[Jump to message](https://discordapp.com/channels/${reaction.message.guild.id}/${reaction.message.channel.id}/${reaction.message.id})`)
|
|
||||||
.addField('Channel', reaction.message.channel)
|
|
||||||
.setFooter(reaction.count + ' ' + staremote)
|
|
||||||
.setTimestamp();
|
|
||||||
|
|
||||||
return channel.send({files: messageAttachments, embed: starEmbed})
|
|
||||||
.catch(() => channel.send(messageAttachments, { embed: starEmbed }));
|
|
||||||
}
|
|
||||||
|
|
||||||
const starEmbed = new MessageEmbed()
|
|
||||||
.setColor(reaction.message.member.displayHexColor)
|
|
||||||
.setAuthor(reaction.message.author.username, reaction.message.author.displayAvatarURL())
|
|
||||||
.setDescription(messageContent)
|
|
||||||
.addField('Jump to', `[message](https://discordapp.com/channels/${reaction.message.guild.id}/${reaction.message.channel.id}/${reaction.message.id})`)
|
|
||||||
.addField('Channel', reaction.message.channel)
|
|
||||||
.setFooter(reaction.count + ' ' + staremote)
|
|
||||||
.setTimestamp();
|
|
||||||
|
|
||||||
return channel.send({files: messageAttachments, embed: starEmbed})
|
|
||||||
.catch(() => channel.send(messageAttachments, { embed: starEmbed}));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let shameboardChannel;
|
|
||||||
let shameemote;
|
|
||||||
let shamecount;
|
|
||||||
try {
|
|
||||||
shameboardChannel = reload(`../../board/shame${reaction.message.guild.id}.json`);
|
|
||||||
|
|
||||||
shameemote = shameboardChannel['emote'];
|
|
||||||
shamecount = shameboardChannel['count'];
|
|
||||||
} catch (err) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//Shameboard
|
//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))
|
||||||
|
@ -86,32 +54,28 @@ class MessageReactionAddListener extends Listener {
|
||||||
|
|
||||||
messageID.push(reaction.message.id);
|
messageID.push(reaction.message.id);
|
||||||
|
|
||||||
const channel = this.client.channels.get(shameboardChannel['shameboard']);
|
sendEmbed('shameboard', shameemote, this.client);
|
||||||
|
}
|
||||||
|
|
||||||
if (!messageContent) {
|
function sendEmbed(name, emote, client) {
|
||||||
const shameEmbed = new MessageEmbed()
|
let channel;
|
||||||
.setColor(reaction.message.member.displayHexColor)
|
if (name == 'starboard') {
|
||||||
.setAuthor(reaction.message.author.username, reaction.message.author.displayAvatarURL())
|
channel = client.channels.get(starboardChannel['starboard']);
|
||||||
.setDescription(`[Jump to message](https://discordapp.com/channels/${reaction.message.guild.id}/${reaction.message.channel.id}/${reaction.message.id})`)
|
} else {
|
||||||
.addField('Channel', reaction.message.channel)
|
channel = client.channels.get(shameboardChannel['shameboard']);
|
||||||
.setFooter(reaction.count + ' ' + shameemote)
|
|
||||||
.setTimestamp();
|
|
||||||
|
|
||||||
return channel.send({files: messageAttachments, embed: shameEmbed })
|
|
||||||
.catch(() => channel.send(messageAttachments, { embed: shameEmbed}));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const shameEmbed = new MessageEmbed()
|
const Embed = new MessageEmbed()
|
||||||
.setColor(reaction.message.member.displayHexColor)
|
.setColor(reaction.message.member.displayHexColor)
|
||||||
.setAuthor(reaction.message.author.username, reaction.message.author.displayAvatarURL())
|
.setAuthor(reaction.message.author.username, reaction.message.author.displayAvatarURL())
|
||||||
.setDescription(messageContent)
|
.setDescription(messageContent)
|
||||||
.addField('Jump to', `[message](https://discordapp.com/channels/${reaction.message.guild.id}/${reaction.message.channel.id}/${reaction.message.id})`)
|
.addField('Jump to', `[message](https://discordapp.com/channels/${reaction.message.guild.id}/${reaction.message.channel.id}/${reaction.message.id})`)
|
||||||
.addField('Channel', reaction.message.channel)
|
.addField('Channel', reaction.message.channel)
|
||||||
.setFooter(reaction.count + ' ' + shameemote)
|
.setFooter(reaction.count + ' ' + emote)
|
||||||
.setTimestamp();
|
.setTimestamp();
|
||||||
|
|
||||||
return channel.send({files: messageAttachments, embed: shameEmbed})
|
return channel.send({files: messageAttachments, embed: Embed})
|
||||||
.catch(() => channel.send(messageAttachments, { embed: shameEmbed}));
|
.catch(() => channel.send(messageAttachments, { embed: Embed}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue