Role class

const role = new Role(data, addon, guild);

constructor

The Permissions class provides three required arguments. The first argument is the Discord.js Role class where it can collect the data from. The second argument is a Zyno Bot Addons Addon class of the addon where the role belongs to. The third argument is the Zyno Bot Addons Guild class of the guild where the role belongs to.

Properties

id

The id of the role and is a Twitter snowflake.

name

The name of the role.

string

The role as a string mention for in a Discord channel.

color

An object which provides the hex and the base10 color of the role.

{
    hex: string;
    base: number;
}

hoist

A boolean which defines whether the role should be displayed separately from the members or not.

position

The position of the role compared to the other roles where the lowest possible position is 0.

created

An instance of the NodeJS built-in Date class which defines the time when the role was created.

createdTimestamp

A number which represents the timestamp of the time when the role was created.

editable

A boolean which defines whether the bot is able to change this role or not.

guild

The Zyno Bot Addons Guild class which defines in which guild the role belongs.

guildId

The id of the guild where the role belongs to.

permissions

An instance of the Discord.js PermissionsBitField class which defines which permissions members with the role have.

mentionable

A boolean which defines whether the role can be mentioned by others or not.

Functions

setName

role.setName(name: string, reason?: string) : Promise<Role>;

Updates the name of the current role. The function returns a Promise which returns the Role class once the Promise has been fulfilled.

setHoist

role.setHoist(hoist?: boolean, reason?: string) : Promise<Role>;

Displays the role separately from the members or makes it display equally with the members depending on the value of the hoist argument. The function returns a Promise which returns the Role class once the Promise has been fulfilled.

setColor

role.setColor(color: string | number, reason?: string) : Promise<Role>;

Changes the color of the role. The function returns a Promise which returns the Role class once the Promise has been fulfilled.

setPosition

role.setPosition(position: number, reason?: string) : Promise<Role>;

Changes the position of the role compared to the other roles. The function returns a Promise which returns the Role class once the Promise has been fulfilled.

setMentionable

role.setMentionable(mentionable?: boolean, reason?: string) : Promise<Role>;

Changes the mentionable status of the role. The function returns a Promise which returns the Role class once the Promise has been fulfilled.

setPermissions

role.setPermissions(permissions: [bigint], reason?: string) : Promise<Role>;

Sets new permissions for the role and overwrites previously set permissions. The function returns a Promise which returns the Role class once the Promise has been fulfilled.

delete

role.delete() : Promise<void>;

Deletes the role. The function returns a Promise which will be fulfilled once the role has been deleted.

Last updated