guilded.ts
Version:
A powerful NPM module that allows you to easily interact with the Guilded API.
31 lines • 1.09 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.GroupManager = void 0;
const BaseManager_1 = require("../BaseManager");
const Group_1 = require("../../structures/Group");
/**
* The manager of groups that belong to the client.
* @example new GroupManager(client);
*/
class GroupManager extends BaseManager_1.BaseManager {
/** @param client The client that owns the groups. */
constructor(client) {
super(client, client.options.maxGroupCache);
}
/**
* Fetch a group from Guilded, or cache.
* @param group The group to fetch.
* @param options The options to fetch the group with.
* @returns The fetched group.
* @example groups.fetch(group);
*/
fetch(group, options) {
group = group instanceof Group_1.Group ? group.id : group;
const cached = this.cache.get(group);
if (cached)
return cached;
return new Group_1.Group(this.client, { id: group }, options?.cache);
}
}
exports.GroupManager = GroupManager;
//# sourceMappingURL=GroupManager.js.map