Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(Action): Ensure all properties on getChannel() are passed #10278

Merged
merged 2 commits into from
May 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions packages/discord.js/src/client/actions/Action.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,17 @@ class GenericAction {
const payloadData = {};
const id = data.channel_id ?? data.id;

if ('recipients' in data) {
payloadData.recipients = data.recipients;
} else {
if (!('recipients' in data)) {
// Try to resolve the recipient, but do not add the client user.
const recipient = data.author ?? data.user ?? { id: data.user_id };
if (recipient.id !== this.client.user.id) payloadData.recipients = [recipient];
}

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(payloadData, this.client.channels, id, Partials.Channel)
this.getPayload({ ...data, ...payloadData }, this.client.channels, id, Partials.Channel)
);
}

Expand Down
Loading