get raw user

This commit is contained in:
Skillz
2020-09-04 23:13:34 -04:00
parent 656b44cfba
commit 7b08e4d014
2 changed files with 7 additions and 0 deletions

View File

@@ -94,6 +94,7 @@ export const endpoints = {
WEBHOOK_ID: (id: string) => `${baseEndpoints.BASE_URL}/webhooks/${id}`,
// User endpoints
USER: (id: string) => `${baseEndpoints.BASE_URL}/users/${id}`,
USER_AVATAR: (id: string, icon: string) =>
`${baseEndpoints.CDN_URL}/avatars/${id}/${icon}`,
USER_DEFAULT_AVATAR: (icon: number) =>

View File

@@ -29,6 +29,7 @@ import {
PrunePayload,
ChannelCreateOptions,
BannedUser,
UserPayload,
} from "../types/guild.ts";
import { RoleData } from "../types/role.ts";
import { createRole } from "../structures/role.ts";
@@ -622,3 +623,8 @@ export function getWebhooks(guildID: string) {
return RequestManager.get(endpoints.GUILD_WEBHOOKS(guildID));
}
/** This function will return the raw user payload in the rare cases you need to fetch a user directly from the API. */
export function getUser(userID: string) {
return RequestManager.get(endpoints.USER(userID)) as Promise<UserPayload>;
}