From 99494d27d1ebe1e2a0de9df2f562d14b5c9c5352 Mon Sep 17 00:00:00 2001 From: Skillz Date: Tue, 14 Jul 2020 18:27:09 -0400 Subject: [PATCH] allow changing api version on the fly --- constants/discord.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/constants/discord.ts b/constants/discord.ts index 4c85c64f8..11681f9a2 100644 --- a/constants/discord.ts +++ b/constants/discord.ts @@ -1,9 +1,15 @@ +let VERSION = 'v7' + export const baseEndpoints = { /** Although, the version can be defaulted, keep the v6 as it can be changed to test newer versions when necessary. */ - BASE_URL: "https://discord.com/api/v7", + BASE_URL: `https://discord.com/api/${VERSION}`, CDN_URL: "https://cdn.discordapp.com", }; +export function changeAPIVersion(number = 7) { + VERSION = `v${number}` +} + const GUILDS_BASE = (id: string) => `${baseEndpoints.BASE_URL}/guilds/${id}`; export const endpoints = {