mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-18 04:23:31 +01:00
fix(Action): Use existing recipients if available (#9653)
* fix(Action): use existing recipients if available * fix: account for message delete -> interaction * fix(Action): use `last_message_id` if it exists * refactor(Action): use ternary --------- Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
@@ -24,11 +24,7 @@ class GenericAction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getPayload(data, manager, id, partialType, cache) {
|
getPayload(data, manager, id, partialType, cache) {
|
||||||
const existing = manager.cache.get(id);
|
return this.client.options.partials.includes(partialType) ? manager._add(data, cache) : manager.cache.get(id);
|
||||||
if (!existing && this.client.options.partials.includes(partialType)) {
|
|
||||||
return manager._add(data, cache);
|
|
||||||
}
|
|
||||||
return existing;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getChannel(data) {
|
getChannel(data) {
|
||||||
@@ -39,7 +35,8 @@ class GenericAction {
|
|||||||
{
|
{
|
||||||
id,
|
id,
|
||||||
guild_id: data.guild_id,
|
guild_id: data.guild_id,
|
||||||
recipients: [data.author ?? data.user ?? { id: data.user_id }],
|
recipients: data.recipients ?? [data.author ?? data.user ?? { id: data.user_id }],
|
||||||
|
last_message_id: data.last_message_id,
|
||||||
},
|
},
|
||||||
this.client.channels,
|
this.client.channels,
|
||||||
id,
|
id,
|
||||||
|
|||||||
Reference in New Issue
Block a user