Delete the message when the board get deleted

This commit is contained in:
loicbersier 2019-12-27 22:04:37 +01:00
parent 3d0448b588
commit bbb6e21f51

View file

@ -28,6 +28,7 @@ class messageReactionRemoveListener extends Listener {
if (messageID[reaction.message.id] && reaction.emoji.name == staremote && reaction.count < starcount) { if (messageID[reaction.message.id] && reaction.emoji.name == staremote && reaction.count < starcount) {
let channel = this.client.channels.get(starboardChannel.starboard); let channel = this.client.channels.get(starboardChannel.starboard);
let message = await channel.messages.get(messageID[reaction.message.id]); let message = await channel.messages.get(messageID[reaction.message.id]);
delete messageID[reaction.message.id];
message.delete(); message.delete();
} else if (reaction.emoji.name == staremote && reaction.count >= starcount) { } else if (reaction.emoji.name == staremote && reaction.count >= starcount) {
return editEmbed('starboard', staremote, messageID[reaction.message.id], this.client); return editEmbed('starboard', staremote, messageID[reaction.message.id], this.client);
@ -48,6 +49,7 @@ class messageReactionRemoveListener extends Listener {
if (messageID[reaction.message.id] && reaction.emoji.name == shameemote && reaction.count < shamecount) { if (messageID[reaction.message.id] && reaction.emoji.name == shameemote && reaction.count < shamecount) {
let channel = this.client.channels.get(shameboardChannel.shameboard); let channel = this.client.channels.get(shameboardChannel.shameboard);
let message = await channel.messages.get(messageID[reaction.message.id]); let message = await channel.messages.get(messageID[reaction.message.id]);
delete messageID[reaction.message.id];
message.delete(); message.delete();
} else if (reaction.emoji.name == shameemote && reaction.count >= shamecount) { } else if (reaction.emoji.name == shameemote && reaction.count >= shamecount) {
return editEmbed('shameboard', shameemote, messageID[reaction.message.id], this.client); return editEmbed('shameboard', shameemote, messageID[reaction.message.id], this.client);