Cannot send messages to this user

E:\Yara Bot\node_modules\@discordjs\rest\dist\index.js:743
throw new DiscordAPIError(data, "code" in data ? data.code : data.error, status, method, url, requestData);
^

DiscordAPIError[50007]: Cannot send messages to this user
at SequentialHandler.runRequest (E:\Yara Bot\node_modules\@discordjs\rest\dist\index.js:743:15)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async SequentialHandler.queueRequest (E:\Yara Bot\node_modules\@discordjs\rest\dist\index.js:549:14)
at async REST.request (E:\Yara Bot\node_modules\@discordjs\rest\dist\index.js:988:22)
at async DMChannel.send (E:\Yara Bot\node_modules\discord.js\src\structures\interfaces\TextBasedChannel.js:175:15) {
requestBody: {
files: [],
json: {
content: undefined,
tts: false,
nonce: undefined,
embeds: [
{
color: 16754688,
title: 'You have been kicked - Case [xgUBpOA]',
description: '**Reason: **`Test`\n' +
'**Proof: **`None`\n' +
'**Duration: **`None`\n' +
'**Expires: **`Now`\n' +
'\n' +
'**If you think this is a mistake, please open a `Case Complaint` ticket when you can. Until then, please wait.**',
footer: {
text: 'PAdventures#1713',
icon_url: 'https://cdn.discordapp.com/avatars/905929688189390858/8d0370d025b3f1133fa1c913f1bd2797.webp'
}
}
],
components: undefined,
username: undefined,
avatar_url: undefined,
allowed_mentions: undefined,
flags: undefined,
message_reference: undefined,
attachments: undefined,
sticker_ids: undefined,
thread_name: undefined
}
},
rawError: { message: 'Cannot send messages to this user', code: 50007 },
code: 50007,
status: 403,
method: 'POST',
url: 'https://discord.com/api/v10/channels/1028689515298160782/messages'
}
E:\Yara Bot\node_modules\@discordjs\rest\dist\index.js:743
throw new DiscordAPIError(data, "code" in data ? data.code : data.error, status, method, url, requestData);
^

DiscordAPIError[50007]: Cannot send messages to this user
at SequentialHandler.runRequest (E:\Yara Bot\node_modules\@discordjs\rest\dist\index.js:743:15)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async SequentialHandler.queueRequest (E:\Yara Bot\node_modules\@discordjs\rest\dist\index.js:549:14)
at async REST.request (E:\Yara Bot\node_modules\@discordjs\rest\dist\index.js:988:22)
at async DMChannel.send (E:\Yara Bot\node_modules\discord.js\src\structures\interfaces\TextBasedChannel.js:175:15) {
requestBody: {
files: [],
json: {
content: undefined,
tts: false,
nonce: undefined,
embeds: [
{
color: 16754688,
title: 'You have been kicked - Case [xgUBpOA]',
description: '**Reason: **`Test`\n' +
'**Proof: **`None`\n' +
'**Duration: **`None`\n' +
'**Expires: **`Now`\n' +
'\n' +
'**If you think this is a mistake, please open a `Case Complaint` ticket when you can. Until then, please wait.**',
footer: {
text: 'PAdventures#1713',
icon_url: 'https://cdn.discordapp.com/avatars/905929688189390858/8d0370d025b3f1133fa1c913f1bd2797.webp'
}
}
],
components: undefined,
username: undefined,
avatar_url: undefined,
allowed_mentions: undefined,
flags: undefined,
message_reference: undefined,
attachments: undefined,
sticker_ids: undefined,
thread_name: undefined
}
},
rawError: { message: 'Cannot send messages to this user', code: 50007 },
code: 50007,
status: 403,
method: 'POST',
url: 'https://discord.com/api/v10/channels/1028689515298160782/messages'
}
14 Replies
PAdventures
PAdventuresOP3y ago
Is this because they have DMs turned off?
d.js docs
d.js docs3y ago
DiscordAPIError: Cannot send messages to this user Your bot is trying to send a DM to a user, but failed to do so: • The user has DMs disabled or the bot blocked • The user no longer shares a guild with the bot (make sure to send informational DMs before banning/kicking) • The bot is trying to DM itself or another bot Note: You cannot check if you can send a DM beforehand but have to handle the rejection case
Jaworek
Jaworek3y ago
or u don't have mutual servers
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
PAdventures
PAdventuresOP3y ago
k still error after sending before kick How would i stop the error from stopping my bot
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
PAdventures
PAdventuresOP3y ago
tried that and still no
try {
member.send({ embeds: [mentionTarget] });
await member.kick(reason);
interaction.editReply({ embeds: [kickDone] });
} catch (err) {
console.log(err);
}
try {
member.send({ embeds: [mentionTarget] });
await member.kick(reason);
interaction.editReply({ embeds: [kickDone] });
} catch (err) {
console.log(err);
}
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
PAdventures
PAdventuresOP3y ago
yes
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
PAdventures
PAdventuresOP3y ago
still no
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
Jaworek
Jaworek3y ago
so u awaited the send?
PAdventures
PAdventuresOP3y ago
🤦‍♂️ No
Want results from more Discord servers?
Add your server