Skip to content

GuildEmojiRoleManager

classe · Source

Manages API methods for roles belonging to emojis and stores their cache.

Extends: DataManager

Properties

emoji

emoji: GuildEmoji

The emoji belonging to this manager Source

guild

guild: Guild

The guild belonging to this manager Source

cache

readonly

cache: Collection<Snowflake, Role>

The cache of roles belonging to this emoji Source

holds

readonly · private

holds: function

The data structure belonging to this manager. Source

client

readonly

client: Client

The client that instantiated this Manager Source

Methods

add

async

async add(roleOrRoles: RoleResolvable | Array<RoleResolvable> | Collection<Snowflake, Role>): Promise<GuildEmoji>

Adds a role (or multiple roles) to the list of roles that can use this emoji. Parameters

NameTypeDescription
roleOrRolesRoleResolvable | Array<RoleResolvable> | Collection<Snowflake, Role>The role or roles to add

Returns: Promise<GuildEmoji>Source

remove

async

async remove(roleOrRoles: RoleResolvable | Array<RoleResolvable> | Collection<Snowflake, Role>): Promise<GuildEmoji>

Removes a role (or multiple roles) from the list of roles that can use this emoji. Parameters

NameTypeDescription
roleOrRolesRoleResolvable | Array<RoleResolvable> | Collection<Snowflake, Role>The role or roles to remove

Returns: Promise<GuildEmoji>Source

set

set(roles: Collection<Snowflake, Role> | Array<RoleResolvable>): Promise<GuildEmoji>

Sets the role(s) that can use this emoji. Parameters

NameTypeDescription
rolesCollection<Snowflake, Role> | Array<RoleResolvable>The roles or role ids to apply

Returns: Promise<GuildEmoji>

js
// Set the emoji's roles to a single role
guildEmoji.roles.set(['391156570408615936'])
  .then(console.log)
  .catch(console.error);
js
// Remove all roles from an emoji
guildEmoji.roles.set([])
   .then(console.log)
   .catch(console.error);

Source

_patch

private

_patch(roles: Array<Snowflake>)

Patches the roles for this manager's cache Parameters

NameTypeDescription
rolesArray<Snowflake>The new roles
Source

resolve

resolve(idOrInstance: string | Object): Object

Resolves a data entry to a data Object. Parameters

NameTypeDescription
idOrInstancestring | ObjectThe id or instance of something in this Manager

Returns: Object — An instance from this Manager Source

resolveId

resolveId(idOrInstance: string | Object): Snowflake

Resolves a data entry to an instance id. Parameters

NameTypeDescription
idOrInstancestring | ObjectThe id or instance of something in this Manager

Returns: SnowflakeSource

Unofficial software. Not affiliated with or supported by Discord.