RoleShorter

Signature

export declare class RoleShorter extends BaseShorter

Methods

create(guildId: string, body: RESTPostAPIGuildRoleJSONBody, reason?: string): Promise<GuildRoleStructure>;

Creates a new role in the guild.

Parameters
guildId
The ID of the guild.
body
The data for creating the role.
reason
The reason for creating the role.
Returns

A Promise that resolves when the role is created.

raw(guildId: string, roleId: string, force?: boolean): Promise<APIRole>;
list(guildId: string, force?: boolean): Promise<GuildRoleStructure[]>;

Retrieves a list of roles in the guild.

Parameters
guildId
The ID of the guild.
force
Whether to force fetching roles from the API even if they exist in the cache.
Returns

A Promise that resolves to an array of roles.

edit(guildId: string, roleId: string, body: RESTPatchAPIGuildRoleJSONBody, reason?: string): Promise<GuildRoleStructure>;

Edits a role in the guild.

Parameters
guildId
The ID of the guild.
roleId
The ID of the role to edit.
body
The data to update the role with.
reason
The reason for editing the role.
Returns

A Promise that resolves when the role is edited.

delete(guildId: string, roleId: string, reason?: string): Promise<void>;

Deletes a role from the guild.

Parameters
guildId
The ID of the guild.
roleId
The ID of the role to delete.
reason
The reason for deleting the role.
Returns

A Promise that resolves when the role is deleted.

memberCounts(guildId: string): Promise<RESTGetAPIGuildRoleMemberCountsResult>;

Returns a map of role IDs to the number of members with the role. Does not include the

Parameters
guildId
The ID of the guild.
Returns

A Promise that resolves to an object mapping role IDs to member counts.

@everyonerole.