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:
Jiralite
2023-07-09 20:30:48 +01:00
committed by GitHub
parent ede9f4e5e2
commit 719e54a921

View File

@@ -24,11 +24,7 @@ class GenericAction {
}
getPayload(data, manager, id, partialType, cache) {
const existing = manager.cache.get(id);
if (!existing && this.client.options.partials.includes(partialType)) {
return manager._add(data, cache);
}
return existing;
return this.client.options.partials.includes(partialType) ? manager._add(data, cache) : manager.cache.get(id);
}
getChannel(data) {
@@ -39,7 +35,8 @@ class GenericAction {
{
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,
id,