mirror of
https://github.com/danbulant/discord.js
synced 2026-05-27 14:02:02 +00:00
fix(ChannelDelete): mark messages of a deleted channel as deleted (#3572)
This commit is contained in:
parent
367c80070f
commit
d1d0d75d4a
1 changed files with 9 additions and 1 deletions
|
|
@ -1,4 +1,5 @@
|
||||||
const Action = require('./Action');
|
const Action = require('./Action');
|
||||||
|
const DMChannel = require('../../structures/DMChannel');
|
||||||
|
|
||||||
class ChannelDeleteAction extends Action {
|
class ChannelDeleteAction extends Action {
|
||||||
constructor(client) {
|
constructor(client) {
|
||||||
|
|
@ -17,7 +18,14 @@ class ChannelDeleteAction extends Action {
|
||||||
} else {
|
} else {
|
||||||
channel = this.deleted.get(data.id) || null;
|
channel = this.deleted.get(data.id) || null;
|
||||||
}
|
}
|
||||||
if (channel) channel.deleted = true;
|
if (channel) {
|
||||||
|
if (channel.messages && !(channel instanceof DMChannel)) {
|
||||||
|
for (const message of channel.messages.values()) {
|
||||||
|
message.deleted = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
channel.deleted = true;
|
||||||
|
}
|
||||||
|
|
||||||
return { channel };
|
return { channel };
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue