fix: set messages deleted when their channel is deleted (#3519)

This commit is contained in:
Souji
2019-10-04 16:44:04 +02:00
committed by SpaceEEC
parent 3458693748
commit 48856c0815

View File

@@ -2,6 +2,7 @@
const Action = require('./Action');
const { Events } = require('../../util/Constants');
const DMChannel = require('../../structures/DMChannel');
class ChannelDeleteAction extends Action {
constructor(client) {
@@ -16,6 +17,11 @@ class ChannelDeleteAction extends Action {
if (channel) {
client.channels.remove(channel.id);
channel.deleted = true;
if (channel.messages && !(channel instanceof DMChannel)) {
for (const message of channel.messages.values()) {
message.deleted = true;
}
}
/**
* Emitted whenever a channel is deleted.
* @event Client#channelDelete