mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-12 01:23:31 +01:00
fix: set messages deleted when their channel is deleted (#3519)
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user