From f10df31f5c9b99300a54a1c45d45269a96a16a92 Mon Sep 17 00:00:00 2001 From: Umimaso Date: Sat, 19 Jun 2021 14:50:11 +0100 Subject: 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 --- package.json | 2 ++ 1 file changed, 2 insertions(+) (limited to 'package.json') diff --git a/package.json b/package.json index 7566e742..3c82a382 100644 --- a/package.json +++ b/package.json @@ -38,6 +38,7 @@ "atomically": "^1.7.0", "bcrypt": "^5.0.1", "body-parser": "^1.19.0", + "canvas": "^2.8.0", "cheerio": "^1.0.0-rc.9", "dot-prop": "^6.0.1", "dotenv": "^8.2.0", @@ -48,6 +49,7 @@ "i18next": "^19.8.5", "i18next-http-middleware": "^3.1.3", "i18next-node-fs-backend": "^2.1.3", + "image-size": "^1.0.0", "jsonwebtoken": "^8.5.1", "lambert-server": "^1.2.5", "missing-native-js-functions": "^1.2.6", -- cgit 1.5.1