mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-04 18:00:08 +00:00
24 lines
816 B
TypeScript
24 lines
816 B
TypeScript
import type { Bot } from "../../../bot.ts";
|
|
import { GuildWidget } from "../../../transformers/widget.ts";
|
|
import { DiscordGuildWidget } from "../../../types/discord.ts";
|
|
import { BigString } from "../../../types/shared.ts";
|
|
|
|
/**
|
|
* Gets the guild widget by guild ID.
|
|
*
|
|
* @param bot - The bot instance to use to make the request.
|
|
* @param guildId - The ID of the guild to get the widget of.
|
|
* @returns An instance of {@link GuildWidget}.
|
|
*
|
|
* @see {@link https://discord.com/developers/docs/resources/guild#get-guild-widget}
|
|
*/
|
|
export async function getWidget(bot: Bot, guildId: BigString): Promise<GuildWidget> {
|
|
const result = await bot.rest.runMethod<DiscordGuildWidget>(
|
|
bot.rest,
|
|
"GET",
|
|
bot.constants.routes.GUILD_WIDGET_JSON(guildId),
|
|
);
|
|
|
|
return bot.transformers.widget(bot, result);
|
|
}
|