UNPKG

node-groupme

Version:

The only GroupMe API library that isn't a million years old.

25 lines 888 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getMember = exports.getUser = exports.getGroup = void 0; async function getThing(client, id, manager, partialType) { let thing = manager.cache.get(String(id)); if (!thing && client.options.fetchPartials[partialType]) thing = await manager.fetch(String(id)); return thing; } async function getGroup(client, id) { return getThing(client, id, client.groups, 'group'); } exports.getGroup = getGroup; async function getUser(client, id) { return getThing(client, id, client.users, 'user'); } exports.getUser = getUser; async function getMember(client, groupID, userID) { const group = await getGroup(client, groupID); if (!group) return; return getThing(client, userID, group.members, 'member'); } exports.getMember = getMember; //# sourceMappingURL=util.js.map