UNPKG

guilded.ts

Version:

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

32 lines 1.2 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ServerManager = void 0; const BaseManager_1 = require("../BaseManager"); const Server_1 = require("../../structures/server/Server"); /** * The manager of servers that belong to the client. * @example new ServerManager(client); */ class ServerManager extends BaseManager_1.BaseManager { /** @param client The client the servers belong to. */ constructor(client) { super(client, client.options.maxServerCache); } /** * Fetch a server from Guilded, or cache. * @param server The server to fetch. * @param options The options to fetch the server with. * @returns The fetched server. * @example servers.fetch(server); */ async fetch(server, options) { server = server instanceof Server_1.Server ? server.id : server; const cached = this.cache.get(server); if (cached && !options?.force) return cached; const raw = await this.client.api.servers.fetch(server); return new Server_1.Server(this.client, raw, options?.cache); } } exports.ServerManager = ServerManager; //# sourceMappingURL=ServerManager.js.map