Question relating to DMs

When users disable permissions for server members to DM them, when a bot tries to DM them, it produces an error. I can use a catch to prevent it from crashing, but is there any way to find out whether a user has server member DMs enabled, as I would like to notify the person sending the command that setting is disabled.
6 Replies
d.js toolkit
d.js toolkit2y ago
• What's your exact discord.js npm list discord.js and node node -v version? • Post the full error stack trace, not just the top part! • Show your code! • Explain what exactly your issue is. • Not a discord.js issue? Check out #useful-servers.
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
samp
sampOP2y ago
aww man but the cached error could be some other type of error
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
d.js docs
d.js docs2y 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
samp
sampOP2y ago
alright
Want results from more Discord servers?
Add your server