Class GlobalRoleManager

A class representing a global role manager. At the moment, we don't cache roles in this structure.

Hierarchy

Constructors

Properties

cache: Collection<number, Role> = ...
client: Client

Methods

  • Assigns a role to a member.

    Parameters

    • serverId: string

      The ID of the server.

    • userId: string

      The ID of the member.

    • roleId: number

      The ID of the role.

    Returns Promise<void>

    A Promise that resolves with no value upon successful completion.

  • Delete a role by ID.

    Parameters

    • serverId: string

      ID of the server to delete the role.

    • roleId: number

      ID of the role to delete.

    Returns Promise<null | Role>

    Promise that resolves with the cached deleted role, or null if the role isn't present in the cache.

  • Fetch a role by its ID

    Parameters

    • serverId: string

      The ID of the server.

    • roleId: number

      ID of the role to fetch.

    • Optional force: boolean

      Whether or not to force a fetch from the API.

    Returns Promise<Role>

    Promise that resolves with the fetched role.

  • Fetch all roles in a given server.

    Parameters

    • serverId: string

      The ID of the server.

    Returns Promise<Collection<number, Role>>

    Promise that resolves with a Collection of fetched roles.

  • Awards XP to a role.

    Parameters

    • serverId: string

      The ID of the server.

    • roleId: number

      The ID of the role.

    • amount: number

      The amount of XP to award.

    Returns Promise<void>

    A Promise that resolves with the total XP awarded to the role.

  • Removes a role from a member.

    Parameters

    • serverId: string

      The ID of the server.

    • userId: string

      The ID of the member.

    • roleId: number

      The ID of the role.

    Returns Promise<void>

    A Promise that resolves with no value upon successful completion.

  • Update a role by ID.

    Parameters

    • serverId: string

      The ID of the server.

    • roleId: number

      ID of the role to update.

    • options: {}

      Role update options.

      Returns Promise<Role>

      Promise that resolves with the updated role.

    • Updates the permissions of a role.

      Parameters

      • serverId: string

        The ID of the server.

      • roleId: number

        The ID of the role.

      • options: {}

        Role permission update options.

        Returns Promise<void>

        A Promise that resolves with no value upon successful completion.

      Generated using TypeDoc