From e3cd000ec09677478942e0d666dec7e322772811 Mon Sep 17 00:00:00 2001 From: Gus Caplan Date: Wed, 5 Jul 2017 03:10:06 -0500 Subject: [PATCH] update http options to fit discord spec (#1656) * Update Constants.js * Update APIRequest.js * Update Invite.js * Update Constants.js --- src/client/rest/APIRequest.js | 2 +- src/structures/Invite.js | 2 +- src/util/Constants.js | 5 +++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/client/rest/APIRequest.js b/src/client/rest/APIRequest.js index a96249a7a..9382c9ae2 100644 --- a/src/client/rest/APIRequest.js +++ b/src/client/rest/APIRequest.js @@ -32,7 +32,7 @@ class APIRequest { } gen() { - const API = `${this.client.options.http.host}/api/v${this.client.options.http.version}`; + const API = `${this.client.options.http.api}/v${this.client.options.http.version}`; if (this.options.query) { const queryString = (querystring.stringify(this.options.query).match(/[^=&?]+=[^=&?]+/g) || []).join('&'); diff --git a/src/structures/Invite.js b/src/structures/Invite.js index ac883761d..53a94f081 100644 --- a/src/structures/Invite.js +++ b/src/structures/Invite.js @@ -136,7 +136,7 @@ class Invite { * @readonly */ get url() { - return Constants.Endpoints.invite(this.code); + return Constants.Endpoints.invite(this.client.options.http.invite, this.code); } /** diff --git a/src/util/Constants.js b/src/util/Constants.js index 3370b02af..7af384ba9 100644 --- a/src/util/Constants.js +++ b/src/util/Constants.js @@ -67,8 +67,9 @@ exports.DefaultOptions = { }, http: { version: 7, - host: 'https://discordapp.com', + api: 'https://discordapp.com/api', cdn: 'https://cdn.discordapp.com', + invite: 'https://discord.gg', }, }; @@ -124,7 +125,7 @@ exports.Endpoints = { }, }; }, - invite: code => `https://discord.gg/${code}`, + invite: (root, code) => `${root}/${code}`, botGateway: '/gateway/bot', };