From 972558f030e5ede7d6142c4006f837acccf39225 Mon Sep 17 00:00:00 2001 From: abalabahaha Date: Sun, 2 Oct 2016 13:11:26 +0900 Subject: [PATCH] Fix redeclaration --- lib/Voice/AudioEncoder.js | 2 +- lib/Voice/VoiceConnection.js | 12 ++++++------ src/Voice/AudioEncoder.js | 2 +- src/Voice/VoiceConnection.js | 13 ++++++------- 4 files changed, 14 insertions(+), 15 deletions(-) diff --git a/lib/Voice/AudioEncoder.js b/lib/Voice/AudioEncoder.js index 9f4700134..1d9ca6fbf 100644 --- a/lib/Voice/AudioEncoder.js +++ b/lib/Voice/AudioEncoder.js @@ -136,7 +136,7 @@ var AudioEncoder = (function () { if (!command) return reject(new Error('FFMPEG not found. Make sure it is installed and in path.')); // add options discord.js needs - var ffmpegOptions = ffmpegOptions.concat(['-f', 's16le', '-ar', '48000', '-ac', 2, 'pipe:1']); + ffmpegOptions = ffmpegOptions.concat(['-f', 's16le', '-ar', '48000', '-ac', 2, 'pipe:1']); var enc = _child_process2["default"].spawn(command, ffmpegOptions); _this3.hookEncodingProcess(resolve, reject, enc); diff --git a/lib/Voice/VoiceConnection.js b/lib/Voice/VoiceConnection.js index 38c726187..ce786aef9 100644 --- a/lib/Voice/VoiceConnection.js +++ b/lib/Voice/VoiceConnection.js @@ -276,12 +276,12 @@ var VoiceConnection = (function (_EventEmitter) { } options.volume = options.volume !== undefined ? options.volume : this.getVolume(); return new Promise(function (resolve, reject) { - _this.encoder.encodeFile(stream, options)["catch"](error).then(function (data) { + _this.encoder.encodeFile(stream, options).then(function (data) { self.streamProc = data.proc; var intent = self.playStream(data.stream, 2); resolve(intent); callback(null, intent); - }); + })["catch"](error); function error() { var e = arguments.length <= 0 || arguments[0] === undefined ? true : arguments[0]; @@ -308,13 +308,13 @@ var VoiceConnection = (function (_EventEmitter) { } options.volume = options.volume !== undefined ? options.volume : this.getVolume(); return new Promise(function (resolve, reject) { - _this2.encoder.encodeStream(stream, options)["catch"](error).then(function (data) { + _this2.encoder.encodeStream(stream, options).then(function (data) { self.streamProc = data.proc; self.instream = data.instream; var intent = self.playStream(data.stream); resolve(intent); callback(null, intent); - }); + })["catch"](error); function error() { var e = arguments.length <= 0 || arguments[0] === undefined ? true : arguments[0]; @@ -343,13 +343,13 @@ var VoiceConnection = (function (_EventEmitter) { } options.volume = options.volume !== undefined ? options.volume : this.getVolume(); return new Promise(function (resolve, reject) { - _this3.encoder.encodeArbitraryFFmpeg(ffmpegOptions, options)["catch"](error).then(function (data) { + _this3.encoder.encodeArbitraryFFmpeg(ffmpegOptions, options).then(function (data) { self.streamProc = data.proc; self.instream = data.instream; var intent = self.playStream(data.stream); resolve(intent); callback(null, intent); - }); + })["catch"](error); function error() { var e = arguments.length <= 0 || arguments[0] === undefined ? true : arguments[0]; diff --git a/src/Voice/AudioEncoder.js b/src/Voice/AudioEncoder.js index fcff4b40b..7830d5b8d 100644 --- a/src/Voice/AudioEncoder.js +++ b/src/Voice/AudioEncoder.js @@ -117,7 +117,7 @@ export default class AudioEncoder { if (!command) return reject(new Error('FFMPEG not found. Make sure it is installed and in path.')); // add options discord.js needs - var ffmpegOptions = ffmpegOptions.concat([ + ffmpegOptions = ffmpegOptions.concat([ '-f', 's16le', '-ar', '48000', '-ac', 2, diff --git a/src/Voice/VoiceConnection.js b/src/Voice/VoiceConnection.js index 2750335cd..78efbf365 100755 --- a/src/Voice/VoiceConnection.js +++ b/src/Voice/VoiceConnection.js @@ -238,14 +238,14 @@ export default class VoiceConnection extends EventEmitter { return new Promise((resolve, reject) => { this.encoder .encodeFile(stream, options) - .catch(error) .then(data => { self.streamProc = data.proc; var intent = self.playStream(data.stream, 2); resolve(intent); callback(null, intent); - }); + }) + .catch(error); function error(e = true) { reject(e); callback(e); @@ -267,15 +267,14 @@ export default class VoiceConnection extends EventEmitter { return new Promise((resolve, reject) => { this.encoder .encodeStream(stream, options) - .catch(error) .then(data => { self.streamProc = data.proc; self.instream = data.instream; var intent = self.playStream(data.stream); resolve(intent); callback(null, intent); - - }); + }) + .catch(error); function error(e = true) { reject(e); callback(e); @@ -300,14 +299,14 @@ export default class VoiceConnection extends EventEmitter { return new Promise((resolve, reject) => { this.encoder .encodeArbitraryFFmpeg(ffmpegOptions, options) - .catch(error) .then(data => { self.streamProc = data.proc; self.instream = data.instream; var intent = self.playStream(data.stream); resolve(intent); callback(null, intent); - }); + }) + .catch(error); function error(e = true) { reject(e); callback(e);