From 27a0361afcee2ffa5506d3cec534d3137c040f92 Mon Sep 17 00:00:00 2001 From: abalabahaha Date: Tue, 15 Mar 2016 22:09:16 -0700 Subject: [PATCH] Not everyone needs to set the volume --- lib/Voice/VoiceConnection.js | 6 ++++++ src/Voice/VoiceConnection.js | 12 +++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/lib/Voice/VoiceConnection.js b/lib/Voice/VoiceConnection.js index bed9bdc33..f9f642fda 100644 --- a/lib/Voice/VoiceConnection.js +++ b/lib/Voice/VoiceConnection.js @@ -252,6 +252,8 @@ var VoiceConnection = (function (_EventEmitter) { if (typeof options === "function") { // options is the callback callback = options; + } + if (typeof options !== "object") { options = {}; } options.volume = options.volume !== undefined ? options.volume : this.getVolume(); @@ -282,6 +284,8 @@ var VoiceConnection = (function (_EventEmitter) { if (typeof options === "function") { // options is the callback callback = options; + } + if (typeof options !== "object") { options = {}; } options.volume = options.volume !== undefined ? options.volume : this.getVolume(); @@ -312,6 +316,8 @@ var VoiceConnection = (function (_EventEmitter) { if (typeof options === "function") { // options is the callback callback = options; + } + if (typeof options !== "object") { options = {}; } options.volume = options.volume !== undefined ? options.volume : this.getVolume(); diff --git a/src/Voice/VoiceConnection.js b/src/Voice/VoiceConnection.js index cdff9d465..16f39cf70 100644 --- a/src/Voice/VoiceConnection.js +++ b/src/Voice/VoiceConnection.js @@ -212,8 +212,10 @@ export default class VoiceConnection extends EventEmitter { if (typeof options === "function") { // options is the callback callback = options; - options = {}; } + if (typeof options !== "object") { + options = {}; + } options.volume = options.volume !== undefined ? options.volume : this.getVolume(); return new Promise((resolve, reject) => { this.encoder @@ -239,8 +241,10 @@ export default class VoiceConnection extends EventEmitter { if (typeof options === "function") { // options is the callback callback = options; - options = {}; } + if (typeof options !== "object") { + options = {}; + } options.volume = options.volume !== undefined ? options.volume : this.getVolume(); return new Promise((resolve, reject) => { this.encoder @@ -267,8 +271,10 @@ export default class VoiceConnection extends EventEmitter { if (typeof options === "function") { // options is the callback callback = options; - options = {}; } + if (typeof options !== "object") { + options = {}; + } options.volume = options.volume !== undefined ? options.volume : this.getVolume(); return new Promise((resolve, reject) => { this.encoder