mirror of
https://github.com/danbulant/discord.js
synced 2026-07-09 05:00:48 +00:00
fix: set messages deleted when their channel is deleted (#3519)
This commit is contained in:
parent
3458693748
commit
48856c0815
1 changed files with 6 additions and 0 deletions
|
|
@ -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
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue