How to create a role with discord.js

Tags: , , ,

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 there is no mention of a createRole(“role”, “roleName”); type function.

If anyone could help that would be great!


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: 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 below on creating new roles with the new RoleManager object.

Source: stackoverflow