Skip to content

Commit

Permalink
fix(Action): Do not set undefined values (#9755)
Browse files Browse the repository at this point in the history
fix(Action): do not set `undefined` values

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
  • Loading branch information
Jiralite and kodiakhq[bot] authored Aug 11, 2023
1 parent a30d46c commit d8e3755
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions packages/discord.js/src/client/actions/Action.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,15 @@ class GenericAction {
}

getChannel(data) {
const payloadData = { recipients: data.recipients ?? [data.author ?? data.user ?? { id: data.user_id }] };
const id = data.channel_id ?? data.id;
if (id !== undefined) payloadData.id = id;
if ('guild_id' in data) payloadData.guild_id = data.guild_id;
if ('last_message_id' in data) payloadData.last_message_id = data.last_message_id;

return (
data[this.client.actions.injectedChannel] ??
this.getPayload(
{
id,
guild_id: data.guild_id,
recipients: data.recipients ?? [data.author ?? data.user ?? { id: data.user_id }],
last_message_id: data.last_message_id,
},
this.client.channels,
id,
Partials.Channel,
)
this.getPayload(payloadData, this.client.channels, id, Partials.Channel)
);
}

Expand Down

0 comments on commit d8e3755

Please sign in to comment.