mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-13 10:03:31 +01:00
Fix stuff
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -224,7 +224,7 @@ class VoiceConnection extends EventEmitter {
|
|||||||
* })
|
* })
|
||||||
* .catch(console.log);
|
* .catch(console.log);
|
||||||
*/
|
*/
|
||||||
playFile(file, { seek = 0, volume = 1 }) {
|
playFile(file, { seek = 0, volume = 1 } = {}) {
|
||||||
const options = { seek: seek, volume: volume };
|
const options = { seek: seek, volume: volume };
|
||||||
return this.player.playFile(file, options);
|
return this.player.playFile(file, options);
|
||||||
}
|
}
|
||||||
@@ -237,7 +237,7 @@ class VoiceConnection extends EventEmitter {
|
|||||||
* @example
|
* @example
|
||||||
* // play streams using ytdl-core
|
* // play streams using ytdl-core
|
||||||
* const ytdl = require('ytdl-core');
|
* const ytdl = require('ytdl-core');
|
||||||
* const streamOptions = {seek: 0, volume: 1};
|
* const streamOptions = { seek: 0, volume: 1 };
|
||||||
* voiceChannel.join()
|
* voiceChannel.join()
|
||||||
* .then(connection => {
|
* .then(connection => {
|
||||||
* const stream = ytdl('https://www.youtube.com/watch?v=XAWgeLF9EVQ', {filter : 'audioonly'});
|
* const stream = ytdl('https://www.youtube.com/watch?v=XAWgeLF9EVQ', {filter : 'audioonly'});
|
||||||
@@ -245,7 +245,7 @@ class VoiceConnection extends EventEmitter {
|
|||||||
* })
|
* })
|
||||||
* .catch(console.log);
|
* .catch(console.log);
|
||||||
*/
|
*/
|
||||||
playStream(stream, { seek = 0, volume = 1 }) {
|
playStream(stream, { seek = 0, volume = 1 } = {}) {
|
||||||
const options = { seek: seek, volume: volume };
|
const options = { seek: seek, volume: volume };
|
||||||
return this.player.playStream(stream, options);
|
return this.player.playStream(stream, options);
|
||||||
}
|
}
|
||||||
@@ -256,7 +256,7 @@ class VoiceConnection extends EventEmitter {
|
|||||||
* @param {StreamOptions} [options] Options for playing the stream
|
* @param {StreamOptions} [options] Options for playing the stream
|
||||||
* @returns {StreamDispatcher}
|
* @returns {StreamDispatcher}
|
||||||
*/
|
*/
|
||||||
playConvertedStream(stream, { seek = 0, volume = 1 }) {
|
playConvertedStream(stream, { seek = 0, volume = 1 } = {}) {
|
||||||
const options = { seek: seek, volume: volume };
|
const options = { seek: seek, volume: volume };
|
||||||
this._shutdown();
|
this._shutdown();
|
||||||
const dispatcher = this.player.playPCMStream(stream, options);
|
const dispatcher = this.player.playPCMStream(stream, options);
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ class VoiceConnectionPlayer extends EventEmitter {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
convertStream(stream, { seek = 0, volume = 1 }) {
|
convertStream(stream, { seek = 0, volume = 1 } = {}) {
|
||||||
const options = { seek: seek, volume: volume };
|
const options = { seek: seek, volume: volume };
|
||||||
const encoder = this.converterEngine.createConvertStream(options.seek);
|
const encoder = this.converterEngine.createConvertStream(options.seek);
|
||||||
const pipe = stream.pipe(encoder.stdin);
|
const pipe = stream.pipe(encoder.stdin);
|
||||||
@@ -89,7 +89,7 @@ class VoiceConnectionPlayer extends EventEmitter {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
playPCMStream(pcmStream, { seek = 0, volume = 1 }) {
|
playPCMStream(pcmStream, { seek = 0, volume = 1 } = {}) {
|
||||||
const options = { seek: seek, volume: volume };
|
const options = { seek: seek, volume: volume };
|
||||||
const dispatcher = new StreamDispatcher(this, pcmStream, this._streamingData, options);
|
const dispatcher = new StreamDispatcher(this, pcmStream, this._streamingData, options);
|
||||||
dispatcher.on('speaking', value => this.setSpeaking(value));
|
dispatcher.on('speaking', value => this.setSpeaking(value));
|
||||||
|
|||||||
@@ -2,12 +2,12 @@ const BasePlayer = require('./BasePlayer');
|
|||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
|
|
||||||
class DefaultPlayer extends BasePlayer {
|
class DefaultPlayer extends BasePlayer {
|
||||||
playFile(file, { seek = 0, volume = 1 }) {
|
playFile(file, { seek = 0, volume = 1 } = {}) {
|
||||||
const options = { seek: seek, volume: volume };
|
const options = { seek: seek, volume: volume };
|
||||||
return this.playStream(fs.createReadStream(file), options);
|
return this.playStream(fs.createReadStream(file), options);
|
||||||
}
|
}
|
||||||
|
|
||||||
playStream(stream, { seek = 0, volume = 1 }) {
|
playStream(stream, { seek = 0, volume = 1 } = {}) {
|
||||||
this._shutdown();
|
this._shutdown();
|
||||||
const options = { seek: seek, volume: volume };
|
const options = { seek: seek, volume: volume };
|
||||||
const pcmStream = this.convertStream(stream, options);
|
const pcmStream = this.convertStream(stream, options);
|
||||||
|
|||||||
Reference in New Issue
Block a user