From 10394b733bcf50771b6b03c91241469c73acadbb Mon Sep 17 00:00:00 2001 From: Gus Caplan Date: Thu, 17 Nov 2016 07:28:26 -0600 Subject: [PATCH] clean up for first release --- src/RESTClient.js | 2 +- src/RPCClient.js | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) 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}`;