Skip to content

Commit

Permalink
fix(Action): Use existing recipients if available (#9653)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
Jiralite and kodiakhq[bot] committed Jul 9, 2023
1 parent ede9f4e commit 719e54a
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions packages/discord.js/src/client/actions/Action.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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,
Expand Down

0 comments on commit 719e54a

Please sign in to comment.