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?
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?
You can do this with:
var role = message.guild.roles.find(role => role.name === "MyRole");
message.member.addRole(role);
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.
var role = message.guild.roles.find(role => role.name === "theroleimade");
^
TypeError: message.guild.roles.find is not a function
why does it say that?