GuildRoleManager

GuildRoleManager

Manages all roles belonging to a guild.

Constructor

new GuildRoleManager(client, guild)

Description:
  • Creates a role manager.

Source:
Parameters:
Name Type Description
client Client

The client instance.

guild Guild

The guild that this role manager belongs to.

Methods

(async, static) fetchRole(guildId, roleIdnullable) → {Promise.<(Role|Array.<Role>)>}

Description:
  • Fetches a role, checking the cache first.

Source:
Parameters:
Name Type Attributes Description
guildId String

The id of the guild the role belongs to.

roleId String <nullable>

The id of the role to fetch, or null to return all roles.

Throws:
TypeError
Returns:
Type
Promise.<(Role|Array.<Role>)>

(static) getCacheManager(client, guildId) → {GuildRoleManager}

Description:
  • Returns the cache manager.

Source:
Parameters:
Name Type Description
client Client

The client instance.

guildId String

The ID of the guild.

Throws:
TypeError
Returns:
Type
GuildRoleManager

(static) getRole(client, guildId, roleId) → (nullable) {Role}

Description:
  • Returns a role from the cache.

Source:
Parameters:
Name Type Description
client Client

The client instance.

guildId String

The ID of the guild.

roleId String

The ID of the role.

Throws:
TypeError
Returns:
Type
Role

(async) fetch(role_id) → {Promise.<Role>}

Description:
  • Fetches a role that belongs to this guild.

Source:
Parameters:
Name Type Description
role_id String

The id of the role to fetch.

Throws:
TypeError | Error
Returns:

The fetched role.

Type
Promise.<Role>

set(id, role) → {Role}

Description:
  • Adds a role to the cache.

Source:
Parameters:
Name Type Description
id String

The ID of the role to cache

role Role

The role to cache.

Throws:
TypeError
Returns:
Type
Role