Fix redeclaration

This commit is contained in:
abalabahaha
2016-10-02 13:11:26 +09:00
parent 015eb9c546
commit 972558f030
4 changed files with 14 additions and 15 deletions

View File

@@ -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);

View File

@@ -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];

View File

@@ -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,

View File

@@ -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);