A manager of roles that belong to a server.

Example

new ServerRoleManager(server);

Hierarchy

Constructors

Properties

cache: CacheCollection<number, ServerRole>

This cache of the manager.

client: Client
server: Server

Methods

  • Assign a role to a member.

    Returns

    The role that was added to the member.

    Example

    roles.assign(member, role);
    

    Parameters

    • member: string | ServerMember

      The member the role belongs to.

    • role: number | ServerRole

      The role to add to the member.

    Returns Promise<ServerRole>

  • Award XP to a role.

    Example

    roles.awardXp(role, 100);
    

    Parameters

    • role: number | ServerRole

      The role to award XP to.

    • amount: number

      The amount of XP to award to the role.

    Returns Promise<void>

  • Fetch roles that belong to a member.

    Returns

    The fetched roles that belong to the member.

    Example

    roles.fetch(member);
    

    Parameters

    Returns Promise<Collection<number, ServerRole>>

  • Set the maximum cache size of the manager.

    Returns

    The manager.

    Example

    manager.setMaxCache(100);
    

    Parameters

    • maxSize: number

      The maximum size of the cache.

    Returns ServerRoleManager

  • Unassign a role from a member.

    Returns

    The role that was removed from the member.

    Example

    roles.unassign(member, role);
    

    Parameters

    • member: string | ServerMember

      The member the role belongs to.

    • role: number | ServerRole

      The role to remove from the member.

    Returns Promise<ServerRole>