MCPcopy Create free account
hub / github.com/AnswerOverflow/AnswerOverflow / getUserServers

Function getUserServers

packages/core/src/auth.ts:626–638  ·  view source on GitHub ↗
(opts: DiscordApiCallOpts)

Source from the content-addressed store, hash-verified

624 }
625
626 export async function getUserServers(opts: DiscordApiCallOpts) {
627 const client = await Cache.getRedisClient();
628 const cachedServers = await client.get(
629 getDiscordServersRedisKey(opts.accessToken),
630 );
631 if (cachedServers) {
632 return zDiscordApiServerArraySchema.parse(JSON.parse(cachedServers));
633 }
634 const data = await discordApiFetch('/users/@me/guilds', opts);
635 const servers = zDiscordApiServerArraySchema.parse(await data.json());
636 await updateUserServersCache(opts.accessToken, servers);
637 return servers;
638 }
639
640 export async function removeServerFromUserCache(
641 opts: DiscordApiCallOpts & { serverId: string },

Callers 2

Calls 4

discordApiFetchFunction · 0.85
updateUserServersCacheFunction · 0.85
parseMethod · 0.45

Tested by

no test coverage detected