Actually fix partial messages

akairo
loicbersier 4 years ago
parent 890d294f9d
commit 00389b326d

@ -31,9 +31,6 @@ class messageListener extends Listener {
return console.error(err); return console.error(err);
}); });
} else { } else {
return;
}
if (message.author.bot) return; if (message.author.bot) return;
/* Banned words section /* Banned words section
@ -289,6 +286,9 @@ class messageListener extends Listener {
} }
} }
} }
}
} }
module.exports = messageListener; module.exports = messageListener;

@ -12,18 +12,15 @@ class MessageReactionAddListener extends Listener {
} }
async exec(reaction) { async exec(reaction) {
let starboardChannel, shameboardChannel;
let reactionCount = reaction.count;
if (reaction.message.partial) { if (reaction.message.partial) {
await reaction.message.fetch() await reaction.message.fetch()
.catch(err => { .catch(err => {
return console.error(err); return console.error(err);
}); });
} else { } else {
return;
}
let starboardChannel, shameboardChannel;
let reactionCount = reaction.count;
// If one of the reaction is the author of the message remove 1 to the reaction count // If one of the reaction is the author of the message remove 1 to the reaction count
reaction.users.cache.forEach(user => { reaction.users.cache.forEach(user => {
if (reaction.message.author == user) reactionCount--; if (reaction.message.author == user) reactionCount--;
@ -70,6 +67,7 @@ class MessageReactionAddListener extends Listener {
} }
} }
} }
}
async function editEmbed(name, emote, boardID, client) { async function editEmbed(name, emote, boardID, client) {
let channel; let channel;

@ -11,18 +11,15 @@ class messageReactionRemoveListener extends Listener {
} }
async exec(reaction) { async exec(reaction) {
let starboardChannel, shameboardChannel;
let reactionCount = reaction.count;
if (reaction.message.partial) { if (reaction.message.partial) {
await reaction.message.fetch() await reaction.message.fetch()
.catch(err => { .catch(err => {
return console.error(err); return console.error(err);
}); });
} else { } else {
return;
}
let starboardChannel, shameboardChannel;
let reactionCount = reaction.count;
// If one of the reaction removed is the author of the message add 1 to the reaction count // If one of the reaction removed is the author of the message add 1 to the reaction count
reaction.users.cache.forEach(user => { reaction.users.cache.forEach(user => {
if (reaction.message.author == user) reactionCount++; if (reaction.message.author == user) reactionCount++;
@ -74,6 +71,7 @@ class messageReactionRemoveListener extends Listener {
return editEmbed('shameboard', shameemote, messageID[reaction.message.id], this.client); return editEmbed('shameboard', shameemote, messageID[reaction.message.id], this.client);
} }
} }
}
async function editEmbed(name, emote, boardID, client) { async function editEmbed(name, emote, boardID, client) {
let channel; let channel;

Loading…
Cancel
Save