From 568b262f8ffcab50848cb9e7035235b03a6f28a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Serna?= Date: Mon, 18 Jul 2022 15:36:35 -0300 Subject: [PATCH] Add GUILD_WIDGET route --- packages/biscuit/Routes.ts | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/packages/biscuit/Routes.ts b/packages/biscuit/Routes.ts index 98c5aa6..eb8e219 100644 --- a/packages/biscuit/Routes.ts +++ b/packages/biscuit/Routes.ts @@ -425,3 +425,26 @@ export function GUILD_STICKERS(guildId: Snowflake, stickerId?: Snowflake): strin if (stickerId) return `/guilds/${guildId}/stickers/${stickerId}`; return `/guilds/${guildId}/stickers`; } + +/** + * Return the widget for the guild. + * @link https://discord.com/developers/docs/resources/guild#get-guild-widget-settings + */ +export interface GetWidget { + get: 'json' | 'image' | 'settings'; +} + +/** + * /guilds/{guildId}/widget + * @link https://discord.com/developers/docs/resources/guild#get-guild-widget-settings + */ +export function GUILD_WIDGET(guildId: Snowflake, options: GetWidget = {get: 'settings'}): string { + let url = `/guilds/${guildId}/widget`; + if (options.get === 'json') { + url += '.json'; + } else if (options.get === 'image') { + url += '.png'; + } + + return url +} \ No newline at end of file