UNPKG

hennus-api

Version:

Esta es una libreria para el bot Hennus

91 lines (90 loc) 3.25 kB
"use strict"; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.Guild = void 0; const data_1 = require("../base/data"); const utils_1 = require("../../utils"); const GuildChannels_1 = require("../../utils/manager/GuildChannels"); class Guild extends data_1.BaseData { constructor(data, client) { super(client); this.data = data; this.id = ""; this.icon = undefined; this.banner = undefined; this.memberCount = 0; this.members = new utils_1.MembersManager(this.client, this.id); this.roles = new utils_1.RolesManager(this.client); Object.defineProperty(this, "data", { value: data }); this.id = data.id; this.name = data.name; this.description = data.description ?? undefined; this.memberCount = data.approximate_member_count ?? 0; this.icon = data.icon ?? undefined; this.banner = data.banner ?? undefined; } get channels() { const datas = this.client.channels.search(this.id); const collect = new GuildChannels_1.GuildChannelsManager(this.client, this); collect.cache.concat(datas); return collect; } ; get emojis() { return this.client.emojis.search(this.id); } ; iconURL(options) { if (!this.icon) return undefined; return this.cdn.icon(this.id, this.icon, options); } bannerURL(options) { if (!this.banner) return undefined; return this.cdn.banner(this.id, this.banner, options); } toJson() { return this.data; } _patch(data) { if (data.name != this.data.name) this.name = data.name; if (data.description != this.data.description) this.description = data.description ?? undefined; if (data.icon != this.data.icon) this.icon = data.icon ?? undefined; if (data.banner != this.data.banner) this.banner = data.banner ?? undefined; if (data.approximate_member_count != this.data.approximate_member_count) this.memberCount = data.approximate_member_count ?? 0; if (this.data != data) Object.defineProperty(this, "data", { value: data }); return this; } ; toString() { if (this.id) return `<@&${this.id}>`; else return ""; } ; } exports.Guild = Guild; __exportStar(require("./Member"), exports); __exportStar(require("./roles"), exports); __exportStar(require("./emojis"), exports);