mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-13 10:03:31 +01:00
Docs cleanup
This commit is contained in:
@@ -18,7 +18,7 @@ const ffmpegArguments = [
|
||||
* ```js
|
||||
* const broadcast = client.createVoiceBroadcast();
|
||||
* broadcast.playFile('./music.mp3');
|
||||
* // play "music.mp3" in all voice connections that the client is in
|
||||
* // Play "music.mp3" in all voice connections that the client is in
|
||||
* for (const connection of client.voiceConnections.values()) {
|
||||
* connection.playBroadcast(broadcast);
|
||||
* }
|
||||
@@ -136,12 +136,12 @@ class VoiceBroadcast extends VolumeInterface {
|
||||
* const broadcast = client.createVoiceBroadcast();
|
||||
*
|
||||
* voiceChannel.join()
|
||||
* .then(connection => {
|
||||
* const stream = ytdl('https://www.youtube.com/watch?v=XAWgeLF9EVQ', { filter : 'audioonly' });
|
||||
* broadcast.playStream(stream);
|
||||
* const dispatcher = connection.playBroadcast(broadcast);
|
||||
* })
|
||||
* .catch(console.error);
|
||||
* .then(connection => {
|
||||
* const stream = ytdl('https://www.youtube.com/watch?v=XAWgeLF9EVQ', { filter : 'audioonly' });
|
||||
* broadcast.playStream(stream);
|
||||
* const dispatcher = connection.playBroadcast(broadcast);
|
||||
* })
|
||||
* .catch(console.error);
|
||||
*/
|
||||
playStream(stream, options = {}) {
|
||||
this.setVolume(options.volume || 1);
|
||||
@@ -158,11 +158,11 @@ class VoiceBroadcast extends VolumeInterface {
|
||||
* const broadcast = client.createVoiceBroadcast();
|
||||
*
|
||||
* voiceChannel.join()
|
||||
* .then(connection => {
|
||||
* broadcast.playFile('C:/Users/Discord/Desktop/music.mp3');
|
||||
* const dispatcher = connection.playBroadcast(broadcast);
|
||||
* })
|
||||
* .catch(console.error);
|
||||
* .then(connection => {
|
||||
* broadcast.playFile('C:/Users/Discord/Desktop/music.mp3');
|
||||
* const dispatcher = connection.playBroadcast(broadcast);
|
||||
* })
|
||||
* .catch(console.error);
|
||||
*/
|
||||
playFile(file, options = {}) {
|
||||
this.setVolume(options.volume || 1);
|
||||
|
||||
@@ -11,9 +11,10 @@ const Prism = require('prism-media');
|
||||
* Represents a connection to a guild's voice server.
|
||||
* ```js
|
||||
* // Obtained using:
|
||||
* voiceChannel.join().then(connection => {
|
||||
* voiceChannel.join()
|
||||
* .then(connection => {
|
||||
*
|
||||
* });
|
||||
* });
|
||||
* ```
|
||||
* @extends {EventEmitter}
|
||||
*/
|
||||
@@ -443,10 +444,10 @@ class VoiceConnection extends EventEmitter {
|
||||
* @example
|
||||
* // Play files natively
|
||||
* voiceChannel.join()
|
||||
* .then(connection => {
|
||||
* const dispatcher = connection.playFile('C:/Users/Discord/Desktop/music.mp3');
|
||||
* })
|
||||
* .catch(console.error);
|
||||
* .then(connection => {
|
||||
* const dispatcher = connection.playFile('C:/Users/Discord/Desktop/music.mp3');
|
||||
* })
|
||||
* .catch(console.error);
|
||||
*/
|
||||
playFile(file, options) {
|
||||
return this.player.playUnknownStream(`file:${file}`, options);
|
||||
@@ -472,11 +473,11 @@ class VoiceConnection extends EventEmitter {
|
||||
* const ytdl = require('ytdl-core');
|
||||
* const streamOptions = { seek: 0, volume: 1 };
|
||||
* voiceChannel.join()
|
||||
* .then(connection => {
|
||||
* const stream = ytdl('https://www.youtube.com/watch?v=XAWgeLF9EVQ', { filter : 'audioonly' });
|
||||
* const dispatcher = connection.playStream(stream, streamOptions);
|
||||
* })
|
||||
* .catch(console.error);
|
||||
* .then(connection => {
|
||||
* const stream = ytdl('https://www.youtube.com/watch?v=XAWgeLF9EVQ', { filter : 'audioonly' });
|
||||
* const dispatcher = connection.playStream(stream, streamOptions);
|
||||
* })
|
||||
* .catch(console.error);
|
||||
*/
|
||||
playStream(stream, options) {
|
||||
return this.player.playUnknownStream(stream, options);
|
||||
@@ -520,7 +521,8 @@ class VoiceConnection extends EventEmitter {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a VoiceReceiver so you can start listening to voice data. It's recommended to only create one of these.
|
||||
* Creates a VoiceReceiver so you can start listening to voice data.
|
||||
* It's recommended to only create one of these.
|
||||
* @returns {VoiceReceiver}
|
||||
*/
|
||||
createReceiver() {
|
||||
|
||||
@@ -89,12 +89,12 @@ class StreamDispatcher extends VolumeInterface {
|
||||
}
|
||||
|
||||
/**
|
||||
* Stops sending voice packets to the voice connection (stream may still progress however)
|
||||
* Stops sending voice packets to the voice connection (stream may still progress however).
|
||||
*/
|
||||
pause() { this.setPaused(true); }
|
||||
|
||||
/**
|
||||
* Resumes sending voice packets to the voice connection (may be further on in the stream than when paused)
|
||||
* Resumes sending voice packets to the voice connection (may be further on in the stream than when paused).
|
||||
*/
|
||||
resume() { this.setPaused(false); }
|
||||
|
||||
@@ -122,7 +122,7 @@ class StreamDispatcher extends VolumeInterface {
|
||||
|
||||
/**
|
||||
* Set the bitrate of the current Opus encoder.
|
||||
* @param {number} bitrate New bitrate, in kbps.
|
||||
* @param {number} bitrate New bitrate, in kbps
|
||||
* If set to 'auto', the voice channel's bitrate will be used
|
||||
*/
|
||||
setBitrate(bitrate) {
|
||||
@@ -140,7 +140,7 @@ class StreamDispatcher extends VolumeInterface {
|
||||
/**
|
||||
* Emitted whenever the dispatcher has debug information.
|
||||
* @event StreamDispatcher#debug
|
||||
* @param {string} info the debug info
|
||||
* @param {string} info The debug info
|
||||
*/
|
||||
this.setSpeaking(true);
|
||||
while (repeats--) {
|
||||
@@ -294,7 +294,7 @@ class StreamDispatcher extends VolumeInterface {
|
||||
this.emit(type, reason);
|
||||
/**
|
||||
* Emitted once the dispatcher ends.
|
||||
* @param {string} [reason] the reason the dispatcher ended
|
||||
* @param {string} [reason] The reason the dispatcher ended
|
||||
* @event StreamDispatcher#end
|
||||
*/
|
||||
if (type !== 'end') this.emit('end', `destroyed due to ${type} - ${reason}`);
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
*/
|
||||
class BaseOpus {
|
||||
/**
|
||||
* @param {Object} [options] The options to apply to the Opus engine.
|
||||
* @param {number} [options.bitrate=48] The desired bitrate (kbps).
|
||||
* @param {boolean} [options.fec=false] Whether to enable forward error correction.
|
||||
* @param {number} [options.plp=0] The expected packet loss percentage.
|
||||
* @param {Object} [options] The options to apply to the Opus engine
|
||||
* @param {number} [options.bitrate=48] The desired bitrate (kbps)
|
||||
* @param {boolean} [options.fec=false] Whether to enable forward error correction
|
||||
* @param {number} [options.plp=0] The expected packet loss percentage
|
||||
*/
|
||||
constructor({ bitrate = 48, fec = false, plp = 0 } = {}) {
|
||||
this.ctl = {
|
||||
|
||||
@@ -81,7 +81,7 @@ class AudioPlayer extends EventEmitter {
|
||||
|
||||
/**
|
||||
* Set the bitrate of the current Opus encoder.
|
||||
* @param {number} value New bitrate, in kbps.
|
||||
* @param {number} value New bitrate, in kbps
|
||||
* If set to 'auto', the voice channel's bitrate will be used
|
||||
*/
|
||||
setBitrate(value) {
|
||||
|
||||
@@ -10,9 +10,10 @@ nonce.fill(0);
|
||||
* Receives voice data from a voice connection.
|
||||
* ```js
|
||||
* // Obtained using:
|
||||
* voiceChannel.join().then(connection => {
|
||||
* const receiver = connection.createReceiver();
|
||||
* });
|
||||
* voiceChannel.join()
|
||||
* .then(connection => {
|
||||
* const receiver = connection.createReceiver();
|
||||
* });
|
||||
* ```
|
||||
* @extends {EventEmitter}
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user