Answer the question
In order to leave comments, you need to log in
How to write a code for a Discord bot to issue a role when commanded, for example: !role @nickname @role. I write in Node.js. Can you help?
I'm starting to write my bot for Discord, I don't know how to write code so that it gives a role to a certain person, for example: !role @nickname @role. I write on Node.js, Urgently, help!!!
Answer the question
In order to leave comments, you need to log in
What exactly do you not understand? There is documentation - https://discord.js.org/#/docs/main/stable/general/...
The user has a `.roles` property. Which returns GuildMemberRoleManager . This object already has a `.add()` method which adds a role by role object.
The role and user object can be obtained from the Message object that you will catch from the chat. The `.mentions` property contains MessageMentions , which already has `.users` and `.roles`.
Combine these two knowledge and you will get what you want.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question