mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-04 18:00:08 +00:00
misc
This commit is contained in:
@@ -1,14 +1,8 @@
|
||||
import { rest } from "../../rest/rest.ts";
|
||||
import {
|
||||
DiscordGetGatewayBot,
|
||||
GetGatewayBot,
|
||||
} from "../../types/gateway/get_gateway_bot.ts";
|
||||
import { GetGatewayBot } from "../../types/gateway/get_gateway_bot.ts";
|
||||
import { endpoints } from "../../util/constants.ts";
|
||||
import { snakeKeysToCamelCase } from "../../util/utils.ts";
|
||||
|
||||
/** Get the bots Gateway metadata that can help during the operation of large or sharded bots. */
|
||||
export async function getGatewayBot() {
|
||||
const result = await rest.runMethod("get", endpoints.GATEWAY_BOT);
|
||||
|
||||
return snakeKeysToCamelCase(result as DiscordGetGatewayBot) as GetGatewayBot;
|
||||
return await rest.runMethod<GetGatewayBot>("get", endpoints.GATEWAY_BOT);
|
||||
}
|
||||
|
||||
@@ -1,12 +1,8 @@
|
||||
import { rest } from "../../rest/rest.ts";
|
||||
import { DiscordUser } from "../../types/users/user.ts";
|
||||
import { User } from "../../types/users/user.ts";
|
||||
import { endpoints } from "../../util/constants.ts";
|
||||
import { snakeKeysToCamelCase } from "../../util/utils.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(userId: string) {
|
||||
const result: User = await rest.runMethod("get", endpoints.USER(userId));
|
||||
|
||||
return snakeKeysToCamelCase<DiscordUser>(result);
|
||||
return await rest.runMethod<User>("get", endpoints.USER(userId));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user