Files
discordeno/plugins/bot/helpers/misc/getUser.ts
Skillz4Killz ffe7cdbc6f feat: base plugin lib idea (#2308)
* feat: base plugin lib idea

* fix: stuff

* fmt

* fix: imports and exports

* fix: errors & tests

* fix: remove logs
2022-06-18 18:46:37 -04:00

12 lines
443 B
TypeScript

import { Bot } from "../../bot.ts";
import { DiscordUser } from "../../deps.ts";
/** This function will return the raw user payload in the rare cases you need to fetch a user directly from the API. */
export async function getUser(bot: Bot, userId: bigint) {
const result = await bot.rest.runMethod<DiscordUser>(bot.rest, "GET", bot.constants.routes.USER(userId));
if (!result.id) return;
return bot.transformers.user(bot, result);
}