Wanted to make the bot dm a person who uses the command to get a hint based on the puzzle role they had.
did watch a YT vid that showed to dm a person based on a trigger. That didn't help as it needs too many triggers.
the bot should dm a person on what role they have
so I do know we need to use if (message.member.roles.cache.some(role => role.name === 'Puzzle 1')
Not completely sure on how to make it :'(
CodePudding user response:
You can use message.author.send("YOUR MESSAGE HERE") for sending a private message to the user.
If you want to check user role by name before sending DM, you can make something like that:
if (message.member.roles.cache.some(role => role.name === 'Puzzle 1')){
message.author.send("YOUR MESSAGE HERE")
}
IMPORTANT NOTE: If a user disabled Allow direct messages from server members on privacy & safety settings, the bot can't send a message to a user. So I recommend you to use try/catch.
