Skip to content

Commit 92c1a51

Browse files
authored
fix(Action): Ensure all properties on getChannel() are passed (#10278)
* fix(Action): ensure all properties on `getChannel()` are passed * refactor: flip `recipient` check
1 parent 35207b0 commit 92c1a51

File tree

1 file changed

+2
-6
lines changed
  • packages/discord.js/src/client/actions

1 file changed

+2
-6
lines changed

packages/discord.js/src/client/actions/Action.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,21 +31,17 @@ class GenericAction {
3131
const payloadData = {};
3232
const id = data.channel_id ?? data.id;
3333

34-
if ('recipients' in data) {
35-
payloadData.recipients = data.recipients;
36-
} else {
34+
if (!('recipients' in data)) {
3735
// Try to resolve the recipient, but do not add the client user.
3836
const recipient = data.author ?? data.user ?? { id: data.user_id };
3937
if (recipient.id !== this.client.user.id) payloadData.recipients = [recipient];
4038
}
4139

4240
if (id !== undefined) payloadData.id = id;
43-
if ('guild_id' in data) payloadData.guild_id = data.guild_id;
44-
if ('last_message_id' in data) payloadData.last_message_id = data.last_message_id;
4541

4642
return (
4743
data[this.client.actions.injectedChannel] ??
48-
this.getPayload(payloadData, this.client.channels, id, Partials.Channel)
44+
this.getPayload({ ...data, ...payloadData }, this.client.channels, id, Partials.Channel)
4945
);
5046
}
5147

0 commit comments

Comments
 (0)