mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-11 00:53:31 +01:00
feat(Actions): use partials for messageDeleteBulk (#3240)
* make use of partials * don't cache the messages * pass each message within the for..of iteration
This commit is contained in:
@@ -33,14 +33,14 @@ class GenericAction {
|
||||
this.client.channels.get(id));
|
||||
}
|
||||
|
||||
getMessage(data, channel) {
|
||||
getMessage(data, channel, cache = true) {
|
||||
const id = data.message_id || data.id;
|
||||
return data.message || (this.client.options.partials.includes(PartialTypes.MESSAGE) ?
|
||||
channel.messages.add({
|
||||
id,
|
||||
channel_id: channel.id,
|
||||
guild_id: data.guild_id || (channel.guild ? channel.guild.id : null),
|
||||
}) :
|
||||
}, cache) :
|
||||
channel.messages.get(id));
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,10 @@ class MessageDeleteBulkAction extends Action {
|
||||
const ids = data.ids;
|
||||
const messages = new Collection();
|
||||
for (const id of ids) {
|
||||
const message = channel.messages.get(id);
|
||||
const message = this.getMessage({
|
||||
id,
|
||||
guild_id: data.guild_id,
|
||||
}, channel, false);
|
||||
if (message) {
|
||||
message.deleted = true;
|
||||
messages.set(message.id, message);
|
||||
|
||||
Reference in New Issue
Block a user