src/server/discord.ts (view raw)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
import { type RESTGetAPIUserResult, Routes } from "discord-api-types/rest/v10";
import rest from "../rest";
import config from "@/config";
const cache = new Map<string, RESTGetAPIUserResult>();
export async function getUser(id: string) {
const cached = cache.get(id);
if (cached) return cached;
const res = (await rest.get(
Routes.guildMember(config.discord.guild, id),
)) as RESTGetAPIUserResult;
cache.set(id, res);
return res;
}
|