mirror of
https://github.com/danbulant/discord.js
synced 2026-06-02 22:30:53 +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 { 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
|
||||
|
|
|
|||
Loading…
Reference in a new issue