Dosen't duplicate entry in starboard anymore
This commit is contained in:
parent
bb954a78bd
commit
e6660a371d
2 changed files with 13 additions and 1 deletions
1
json/starboard.json
Normal file
1
json/starboard.json
Normal file
|
@ -0,0 +1 @@
|
||||||
|
[]
|
|
@ -1,6 +1,7 @@
|
||||||
const { Listener } = require('discord-akairo');
|
const { Listener } = require('discord-akairo');
|
||||||
const { MessageEmbed } = require('discord.js');
|
const { MessageEmbed } = require('discord.js');
|
||||||
const reload = require('auto-reload');
|
const reload = require('auto-reload');
|
||||||
|
let messageID = require('../json/starboard.json');
|
||||||
|
|
||||||
class MessageReactionAddListener extends Listener {
|
class MessageReactionAddListener extends Listener {
|
||||||
constructor() {
|
constructor() {
|
||||||
|
@ -15,6 +16,11 @@ class MessageReactionAddListener extends Listener {
|
||||||
let messageAttachments = reaction.message.attachments.map(u=> `${u.url}`);
|
let messageAttachments = reaction.message.attachments.map(u=> `${u.url}`);
|
||||||
|
|
||||||
if (reaction.emoji.name === '🌟' && reaction.count === 4) {
|
if (reaction.emoji.name === '🌟' && reaction.count === 4) {
|
||||||
|
if (messageID.includes(reaction.message.id))
|
||||||
|
return console.log('Message already in starboard!');
|
||||||
|
|
||||||
|
messageID.push(reaction.message.id);
|
||||||
|
|
||||||
let starboardChannel = reload(`../starboard/${reaction.message.guild.id}.json`);
|
let starboardChannel = reload(`../starboard/${reaction.message.guild.id}.json`);
|
||||||
const channel = this.client.channels.get(starboardChannel['starboard']);
|
const channel = this.client.channels.get(starboardChannel['starboard']);
|
||||||
|
|
||||||
|
@ -25,9 +31,14 @@ class MessageReactionAddListener extends Listener {
|
||||||
.setTimestamp();
|
.setTimestamp();
|
||||||
|
|
||||||
channel.send({ embed: starEmbed});
|
channel.send({ embed: starEmbed});
|
||||||
return channel.send(`From: ${reaction.message.channel}\n${messageAttachments}`);
|
return channel.send(`From: ${reaction.message.channel} ID: ${reaction.message.id} \n${messageAttachments}`);
|
||||||
}
|
}
|
||||||
if (reaction.emoji.name === '✡' && reaction.count === 4) {
|
if (reaction.emoji.name === '✡' && reaction.count === 4) {
|
||||||
|
if (messageID.includes(reaction.message.id))
|
||||||
|
return console.log('Message already in starboard!');
|
||||||
|
|
||||||
|
messageID.push(reaction.message.id);
|
||||||
|
|
||||||
let shameboardChannel = reload(`../starboard/${message.guild.id}.json`);
|
let shameboardChannel = reload(`../starboard/${message.guild.id}.json`);
|
||||||
const channel = client.channels.get(shameboardChannel['shameboard']);
|
const channel = client.channels.get(shameboardChannel['shameboard']);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue