diff options
author | Umimaso <git@umimaso.com> | 2021-06-19 14:50:11 +0100 |
---|---|---|
committer | Umimaso <git@umimaso.com> | 2021-06-19 14:50:11 +0100 |
commit | f10df31f5c9b99300a54a1c45d45269a96a16a92 (patch) | |
tree | 339f2be44bf57142c46c7c706bfa50e1e0e0a41b /src/schema | |
parent | :sparkles: Guild invites (diff) | |
download | server-f10df31f5c9b99300a54a1c45d45269a96a16a92.tar.xz |
feat: add widget endpoints
Implemented the four widget related endpoints of the api. Partial user object being returned as part of the widget.json endpoint [1] is an intentional choice related to privacy [2]. The widget.json endpoint will require additional changes upon completion of other work. Member details will need to return extra key/values for connected users to voice channels. An additional avatar_url value will hold an unique avatar url for the user + guild, fetched via a CDN endpoint widget-avatars. New dependencies `canvas` and `image-size`. Canvas is used to create the widget.png endpoint image [3]. Image-size is used to set the canvas' size to match the widget template images. Use regex in determining if a NO_AUTHORIZATION_ROUTES is hit or not. [1] https://discord.com/developers/docs/resources/guild#get-guild-widget [2] https://github.com/discord/discord-api-docs/issues/1287 [3] https://discord.com/developers/docs/resources/guild#get-guild-widget-image Closes: #9, #110
Diffstat (limited to 'src/schema')
-rw-r--r-- | src/schema/Widget.ts | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/schema/Widget.ts b/src/schema/Widget.ts new file mode 100644 index 00000000..6a15a139 --- /dev/null +++ b/src/schema/Widget.ts @@ -0,0 +1,10 @@ +// https://discord.com/developers/docs/resources/guild#guild-widget-object +export const WidgetModifySchema = { + $enabled: Boolean, // whether the widget is enabled + $channel_id: String // the widget channel id +}; + +export interface WidgetModifySchema { + enabled: boolean; // whether the widget is enabled + channel_id: string; // the widget channel id +} |