refactor(rest): move user agent to constants

This commit is contained in:
ayntee
2020-12-26 19:36:08 +04:00
parent 8092128a0f
commit 64884439db
2 changed files with 17 additions and 12 deletions
+13 -7
View File
@@ -1,13 +1,19 @@
// These will never be modified and remain constants
export const discordAPIURLS = {
BASE_URL: `https://discord.com/api/v8`,
CDN_URL: "https://cdn.discordapp.com",
};
/** https://discord.com/developers/docs/reference#api-reference-base-url */
export const BASE_URL = "https://discord.com/api";
/** https://discord.com/developers/docs/reference#api-versioning-api-versions */
export const API_VERSION = 8;
/** https://discord.com/developers/docs/reference#user-agent */
export const USER_AGENT = "DiscordBot (https://github.com/discordeno/discordeno, v10)";
/** https://discord.com/developers/docs/reference#image-formatting-image-base-url */
export const IMAGE_BASE_URL = "https://cdn.discordapp.com/";
// This can be modified by big brain bots and use a proxy
export const baseEndpoints = {
BASE_URL: discordAPIURLS.BASE_URL,
CDN_URL: discordAPIURLS.CDN_URL,
BASE_URL: `${BASE_URL}/v${API_VERSION}`,
CDN_URL: IMAGE_BASE_URL,
};
const GUILDS_BASE = (id: string) => `${baseEndpoints.BASE_URL}/guilds/${id}`;