refactor: make Structure#deleted a getter to a WeakSet (#7074)

This commit is contained in:
Antonio Román
2021-12-08 10:47:54 +01:00
committed by GitHub
parent f410536c51
commit b0937502d3
51 changed files with 297 additions and 120 deletions

View File

@@ -1,7 +1,9 @@
'use strict';
const Action = require('./Action');
const { deletedChannels } = require('../../structures/Channel');
const DMChannel = require('../../structures/DMChannel');
const { deletedMessages } = require('../../structures/Message');
const { Events } = require('../../util/Constants');
class ChannelDeleteAction extends Action {
@@ -16,10 +18,10 @@ class ChannelDeleteAction extends Action {
if (channel) {
client.channels._remove(channel.id);
channel.deleted = true;
deletedChannels.add(channel);
if (channel.messages && !(channel instanceof DMChannel)) {
for (const message of channel.messages.cache.values()) {
message.deleted = true;
deletedMessages.add(message);
}
}
/**