Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix(Action): Do not set undefined values (#9755)
Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
  • Loading branch information
2 people authored and vladfrangu committed Nov 5, 2023
1 parent 142db0e commit 65bbed8
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions src/client/actions/Action.js
Expand Up @@ -32,19 +32,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.author ?? data.user ?? { id: data.user_id }],
},
this.client.channels,
id,
PartialTypes.CHANNEL,
)
this.getPayload(payloadData, this.client.channels, id, PartialTypes.CHANNEL)
);
}

Expand Down

0 comments on commit 65bbed8

Please sign in to comment.