Skip to content

Commit 24fbb11

Browse files
fix(Action): Do not add the client user as a recipient (#9774)
fix(Action): do not add the client user as a recipient Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
1 parent 727dc09 commit 24fbb11

File tree

1 file changed

+10
-1
lines changed
  • packages/discord.js/src/client/actions

1 file changed

+10
-1
lines changed

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

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,17 @@ class GenericAction {
2828
}
2929

3030
getChannel(data) {
31-
const payloadData = { recipients: data.recipients ?? [data.author ?? data.user ?? { id: data.user_id }] };
31+
const payloadData = {};
3232
const id = data.channel_id ?? data.id;
33+
34+
if ('recipients' in data) {
35+
payloadData.recipients = data.recipients;
36+
} else {
37+
// Try to resolve the recipient, but do not add the client user.
38+
const recipient = data.author ?? data.user ?? { id: data.user_id };
39+
if (recipient.id !== this.client.user.id) payloadData.recipients = [recipient];
40+
}
41+
3342
if (id !== undefined) payloadData.id = id;
3443
if ('guild_id' in data) payloadData.guild_id = data.guild_id;
3544
if ('last_message_id' in data) payloadData.last_message_id = data.last_message_id;

0 commit comments

Comments
 (0)