mirror of
https://github.com/discordjs/discord.js.git
synced 2024-08-20 22:04:45 +12:00
fix(Action): Do not set undefined values (#9755)
Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
This commit is contained in:
parent
142db0ed8c
commit
65bbed8a0f
1 changed files with 6 additions and 10 deletions
|
@ -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)
|
||||
);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue