Unable to DM User despite open DMs
code:
Output in pics
Somehow whenever i do this with my main(this acc) and select myself in the userselectmenu it works.
try {
let userData = client.users.cache.get(user.id);
console.log(userData)
// Check if user data is available and if the user allows DMs
if (userData && userData.dmChannel) {
userData.send({
content: 'You have been referred in a post by <@!' + interaction.user.id + '>. To report this Referral click the Report button in this message',
embeds: [embed],
});
} else {
// Handle the case where DMs are disabled or the user blocked the bot
console.log(`Failed to send a message to user ${user.id}.`);
errorIds.push({id:user.id, reason: 'Closed DMs'});
}
} catch (e) {
// Handle other potential errors
console.error(`Error while sending a message to user ${user.id}:`, e);
errorIds.push({id:user.id, reason: "User doesn't Exist"});
}try {
let userData = client.users.cache.get(user.id);
console.log(userData)
// Check if user data is available and if the user allows DMs
if (userData && userData.dmChannel) {
userData.send({
content: 'You have been referred in a post by <@!' + interaction.user.id + '>. To report this Referral click the Report button in this message',
embeds: [embed],
});
} else {
// Handle the case where DMs are disabled or the user blocked the bot
console.log(`Failed to send a message to user ${user.id}.`);
errorIds.push({id:user.id, reason: 'Closed DMs'});
}
} catch (e) {
// Handle other potential errors
console.error(`Error while sending a message to user ${user.id}:`, e);
errorIds.push({id:user.id, reason: "User doesn't Exist"});
}Output in pics
Somehow whenever i do this with my main(this acc) and select myself in the userselectmenu it works.

