diff --git a/src/RESTClient.js b/src/RESTClient.js index dd33165..eb83e78 100644 --- a/src/RESTClient.js +++ b/src/RESTClient.js @@ -9,7 +9,7 @@ module.exports = class RESTClient { return new Promise((resolve, reject) => { headers.Authorization = `Bearer ${this.client.accessToken}`; superagent[method.toLowerCase()](`https://${this.client.hostAndPort}${path}`) - .set(headers).send(body).then(resolve, reject); + .set(headers).send(body).then(res => resolve(res.body), reject); }); } diff --git a/src/RPCClient.js b/src/RPCClient.js index 1b49f3a..3486cc5 100644 --- a/src/RPCClient.js +++ b/src/RPCClient.js @@ -5,7 +5,7 @@ const EventEmitter = require('events').EventEmitter; const { RPCCommands, RPCEvents, RPCErrors } = require('./Constants'); -if (typeof WebSocket === 'undefined') { const WebSocket = require('ws'); } +if (typeof WebSocket === 'undefined') { const WebSocket = require('ws'); } // eslint-disable-line const superagent = require('superagent'); const uuid = require('uuid').v4; const RESTClient = require('./RESTClient'); @@ -31,9 +31,7 @@ class RPCClient { } connect (accessToken = this.accessToken, tries = 0) { - if (this.connected) { - return; - } + if (this.connected) return; this.accessToken = accessToken; const port = 6463 + (tries % 10); this.hostAndPort = `${uuid()}.discordapp.io:${port}`;