diff --git a/src/managers/RoleManager.js b/src/managers/RoleManager.js
index 279e43b99..667085b6b 100644
--- a/src/managers/RoleManager.js
+++ b/src/managers/RoleManager.js
@@ -89,7 +89,12 @@ class RoleManager extends BaseManager {
* Creates a new role in the guild with given information.
* The position will silently reset to 1 if an invalid one is provided, or none.
* @param {Object} [options] Options
- * @param {RoleData} [options.data] The data to create the role with
+ * @param {string} [options.name] The name of the new role
+ * @param {ColorResolvable} [options.color] The data to create the role with
+ * @param {boolean} [options.hoist] Whether or not the new role should be hoisted.
+ * @param {PermissionResolvable} [options.permissions] The permissions for the new role
+ * @param {number} [options.position] The position of the new role
+ * @param {boolean} [options.mentionable] Whether or not the new role should be mentionable.
* @param {string} [options.reason] Reason for creating this role
* @returns {Promise}
* @example
@@ -100,28 +105,36 @@ class RoleManager extends BaseManager {
* @example
* // Create a new role with data and a reason
* guild.roles.create({
- * data: {
- * name: 'Super Cool People',
- * color: 'BLUE',
- * },
+ * name: 'Super Cool Blue People',
+ * color: 'BLUE',
* reason: 'we needed a role for Super Cool People',
* })
* .then(console.log)
* .catch(console.error);
*/
- create({ data = {}, reason } = {}) {
- if (data.color) data.color = resolveColor(data.color);
- if (data.permissions) data.permissions = Permissions.resolve(data.permissions);
+ create(options = {}) {
+ let { name, color, hoist, permissions, position, mentionable, reason } = options;
+ if (color) color = resolveColor(color);
+ if (permissions) permissions = Permissions.resolve(permissions);
return this.client.api
.guilds(this.guild.id)
- .roles.post({ data, reason })
+ .roles.post({
+ data: {
+ name,
+ color,
+ hoist,
+ permissions,
+ mentionable,
+ },
+ reason,
+ })
.then(r => {
const { role } = this.client.actions.GuildRoleCreate.handle({
guild_id: this.guild.id,
role: r,
});
- if (data.position) return role.setPosition(data.position, reason);
+ if (position) return role.setPosition(position, reason);
return role;
});
}
diff --git a/typings/index.d.ts b/typings/index.d.ts
index f01379476..35643d584 100644
--- a/typings/index.d.ts
+++ b/typings/index.d.ts
@@ -2021,7 +2021,7 @@ declare module 'discord.js' {
public guild: Guild;
public readonly premiumSubscriberRole: Role | null;
public botRoleFor(user: UserResolvable): Role | null;
- public create(options?: { data?: RoleData; reason?: string }): Promise;
+ public create(options?: RoleData & { reason?: string }): Promise;
public fetch(id: Snowflake, cache?: boolean, force?: boolean): Promise;
public fetch(id?: Snowflake, cache?: boolean, force?: boolean): Promise>;
}