I’ve been trying to make a discord bot using discord.js, but I can’t seem to find any documentation on how to create a role that works in 2018. All the ones I can find that work, no longer work as they have removed the referenced function. In https://discord.js.org/#/docs/main/stable/class/Role there is no mention of a createRole(“role”, “roleName”); type function.
If anyone could help that would be great!
Advertisement
Answer
The class Role
does not have the method to create a new role, you must look at the Guild
class for that. Here is a link to the documentation for the method: https://discord.js.org/#/docs/main/stable/class/Guild?scrollTo=createRole. Feel free to comment back if you have any questions!
Edit: As of discord.js v12, createRole
no longer exists, please refer to cecomp64’s answer above on creating new roles with the new RoleManager
object.