i'm using newest discord.js in node.js and i'm trying to add user to role, but it seems bot.addUserToRole() was removed.
How can I do it when I know only rank name, not it's ID?
Here's what worked for me, hope this helps!
var role= member.guild.roles.cache.find(role => role.name === "role name");
member.roles.add(role);
Here is the official documentation on it.
You can do this with:
var role = message.guild.roles.find(role => role.name === "MyRole");
message.member.addRole(role);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With