UNPKG

guilded.ts

Version:

A powerful NPM module that allows you to easily interact with the Guilded API.

38 lines 1.13 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ServerRole = void 0; const Base_1 = require("../Base"); /** * Represents a server role on Guilded. * @example new ServerRole(server, rawRole); */ class ServerRole extends Base_1.Base { server; raw; /** * @param server The server the role belongs to. * @param raw The raw data of the role. * @param cache Whether to cache the server role. */ constructor(server, raw, cache = server.client.options.cacheServerRoles ?? true) { super(server.client, raw.id); this.server = server; this.raw = raw; if (cache) server.roles.cache.set(this.id, this); } /** Whether the role is cached. */ get isCached() { return this.server.roles.cache.has(this.id); } /** * Award XP to the role. * @param amount The amount of XP to award to the role. * @example role.awardXp(100); */ awardXp(amount) { return this.server.roles.awardXp(this, amount); } } exports.ServerRole = ServerRole; //# sourceMappingURL=ServerRole.js.map