From 7b08e4d014784dabc18de78d895eedc4d46d8668 Mon Sep 17 00:00:00 2001 From: Skillz Date: Fri, 4 Sep 2020 23:13:34 -0400 Subject: [PATCH] get raw user --- src/constants/discord.ts | 1 + src/handlers/guild.ts | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/src/constants/discord.ts b/src/constants/discord.ts index 074fa2949..c4e970051 100644 --- a/src/constants/discord.ts +++ b/src/constants/discord.ts @@ -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) => diff --git a/src/handlers/guild.ts b/src/handlers/guild.ts index 25dab7467..9d212377d 100644 --- a/src/handlers/guild.ts +++ b/src/handlers/guild.ts @@ -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; +}