mirror of
https://github.com/discordjs/discord.js.git
synced 2024-08-21 23:54:44 +12:00
fix(Action): Do not set undefined
values (#9755)
fix(Action): do not set `undefined` values Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
parent
a30d46c5f5
commit
d8e37551ce
1 changed files with 6 additions and 11 deletions
|
@ -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)
|
||||
);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue