Answer by TheFungusAmongUs for How to check if a bot can DM a user
ExplanationYou can send an invalid message, which would raise a 400 Bad Request exception, to the dm_channel. This can be accomplished by setting content to None, for example.If it raises 400 Bad...
View ArticleHow to check if a bot can DM a user
If a user has the privacy setting "Allow direct messages from server members" turned off and a discord bot callsawait user.dm_channel.send("Hello there")You'll get this error:discord.errors.Forbidden:...
View Article