mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-19 21:13:30 +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 Action = require('./Action');
|
||||||
const { Events } = require('../../util/Constants');
|
const { Events } = require('../../util/Constants');
|
||||||
|
const DMChannel = require('../../structures/DMChannel');
|
||||||
|
|
||||||
class ChannelDeleteAction extends Action {
|
class ChannelDeleteAction extends Action {
|
||||||
constructor(client) {
|
constructor(client) {
|
||||||
@@ -16,6 +17,11 @@ class ChannelDeleteAction extends Action {
|
|||||||
if (channel) {
|
if (channel) {
|
||||||
client.channels.remove(channel.id);
|
client.channels.remove(channel.id);
|
||||||
channel.deleted = true;
|
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.
|
* Emitted whenever a channel is deleted.
|
||||||
* @event Client#channelDelete
|
* @event Client#channelDelete
|
||||||
|
|||||||
Reference in New Issue
Block a user