From 1841122a8f6c160a94f905f8bebe397795891a20 Mon Sep 17 00:00:00 2001 From: Schuyler Cebulskie Date: Thu, 27 Oct 2016 19:48:34 -0400 Subject: [PATCH 1/2] Cherry pick commits from indev --- README.md | 28 +++++++------------------- docs/custom/documents/welcome.md | 28 +++++++------------------- src/client/Client.js | 4 ++-- src/client/ClientManager.js | 4 ++-- src/client/voice/ClientVoiceManager.js | 2 +- src/client/voice/VoiceWebSocket.js | 1 - src/client/voice/util/SecretKey.js | 1 + src/structures/Guild.js | 2 +- 8 files changed, 21 insertions(+), 49 deletions(-) diff --git a/README.md b/README.md index f489c0503..a0909b7d6 100644 --- a/README.md +++ b/README.md @@ -1,30 +1,16 @@

- - discord.js - + discord.js

- - Discord server - - - NPM version - - - NPM downloads - - - Build status - - - Dependencies - + Discord server + NPM version + NPM downloads + Build status + Dependencies

- - NPM info - + NPM info

diff --git a/docs/custom/documents/welcome.md b/docs/custom/documents/welcome.md index 4b1cb445b..b5215178e 100644 --- a/docs/custom/documents/welcome.md +++ b/docs/custom/documents/welcome.md @@ -1,30 +1,16 @@

- - discord.js - + discord.js

- - Discord server - - - NPM version - - - NPM downloads - - - Build status - - - Dependencies - + Discord server + NPM version + NPM downloads + Build status + Dependencies

- - NPM info - + NPM info

diff --git a/src/client/Client.js b/src/client/Client.js index 39a222154..eb95c45c3 100644 --- a/src/client/Client.js +++ b/src/client/Client.js @@ -236,8 +236,8 @@ class Client extends EventEmitter { destroy() { for (const t of this._timeouts) clearTimeout(t); for (const i of this._intervals) clearInterval(i); - this._timeouts = []; - this._intervals = []; + this._timeouts.clear(); + this._intervals.clear(); this.token = null; this.email = null; this.password = null; diff --git a/src/client/ClientManager.js b/src/client/ClientManager.js index 03d43b375..ef943b339 100644 --- a/src/client/ClientManager.js +++ b/src/client/ClientManager.js @@ -58,10 +58,10 @@ class ClientManager { } destroy() { - return new Promise((resolve) => { + return new Promise((resolve, reject) => { this.client.ws.destroy(); if (!this.client.user.bot) { - this.client.rest.methods.logout().then(resolve); + this.client.rest.methods.logout().then(resolve, reject); } else { resolve(); } diff --git a/src/client/voice/ClientVoiceManager.js b/src/client/voice/ClientVoiceManager.js index bd58989ee..e32eae4bf 100644 --- a/src/client/voice/ClientVoiceManager.js +++ b/src/client/voice/ClientVoiceManager.js @@ -80,7 +80,7 @@ class ClientVoiceManager { return new Promise((resolve, reject) => { if (this.pending.get(channel.guild.id)) throw new Error('Already connecting to this guild\'s voice server.'); - if (!channel.permissionsFor(this.client.user).hasPermission('CONNECT')) { + if (!channel.joinable) { throw new Error('You do not have permission to join this voice channel'); } diff --git a/src/client/voice/VoiceWebSocket.js b/src/client/voice/VoiceWebSocket.js index 1c421a71b..ebc2a3103 100644 --- a/src/client/voice/VoiceWebSocket.js +++ b/src/client/voice/VoiceWebSocket.js @@ -142,7 +142,6 @@ class VoiceWebSocket extends EventEmitter { * Called whenever the connection to the WebSocket Server is lost */ onClose() { - // TODO see if the connection is open before reconnecting if (!this.dead) this.client.setTimeout(this.connect.bind(this), this.attempts * 1000); } diff --git a/src/client/voice/util/SecretKey.js b/src/client/voice/util/SecretKey.js index 42a0da0cb..508a1baa0 100644 --- a/src/client/voice/util/SecretKey.js +++ b/src/client/voice/util/SecretKey.js @@ -1,5 +1,6 @@ /** * Represents a Secret Key used in encryption over voice + * @private */ class SecretKey { constructor(key) { diff --git a/src/structures/Guild.js b/src/structures/Guild.js index 58b28cb8a..e78c204e0 100644 --- a/src/structures/Guild.js +++ b/src/structures/Guild.js @@ -650,7 +650,7 @@ class Guild { const updatedRoles = this.roles.array().map(r => ({ id: r.id, - position: r.id === role ? position : (r.position < position ? r.position : r.position + 1), + position: r.id === role ? position : r.position < position ? r.position : r.position + 1, })); return this.client.rest.methods.setRolePositions(this.id, updatedRoles); From c1926b62217d201f7678eac1e8acbb2d7fef4bab Mon Sep 17 00:00:00 2001 From: Schuyler Cebulskie Date: Thu, 27 Oct 2016 19:52:54 -0400 Subject: [PATCH 2/2] Prepare 10.0.1 release --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index cd6742849..6e92756f8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "discord.js", - "version": "10.0.0", + "version": "10.0.1", "description": "A powerful library for interacting with the Discord API", "main": "./src/index", "scripts": {