mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-15 11:03:30 +01:00
fix(ChannelDelete): mark messages of a deleted channel as deleted (#3572)
This commit is contained in:
@@ -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 };
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user