mirror of
https://github.com/danbulant/discord.js
synced 2026-05-30 04:41:11 +00: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:
parent
692494dc04
commit
176fc47699
2 changed files with 6 additions and 3 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in a new issue