detritus-client
Version:
A Typescript NodeJS library to interact with Discord's API, both Rest and Gateway.
29 lines (28 loc) • 779 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Roles = void 0;
const basecollection_1 = require("./basecollection");
const constants_1 = require("../constants");
;
/**
* Roles Reference Collection
* @category Collections
*/
class Roles extends basecollection_1.BaseClientGuildReferenceCache {
constructor() {
super(...arguments);
this.key = constants_1.DetritusKeys[constants_1.DiscordKeys.ROLES];
}
insert(role) {
if (this.enabled) {
const guild = role.guild;
if (guild) {
guild.roles.set(role.id, role);
}
}
}
get [Symbol.toStringTag]() {
return `Roles (${this.size.toLocaleString()} items)`;
}
}
exports.Roles = Roles;