Docs cleanup

This commit is contained in:
iCrawl
2017-08-17 20:04:01 +02:00
parent 5ce0def9d0
commit 2aa2f73c74
40 changed files with 366 additions and 359 deletions

View File

@@ -29,7 +29,7 @@ class ClientDataResolver {
/**
* Data that resolves to give a User object. This can be:
* * A User object
* * A user ID
* * A Snowflake
* * A Message object (resolves to the message author)
* * A Guild object (owner of the guild)
* * A GuildMember object
@@ -66,7 +66,7 @@ class ClientDataResolver {
/**
* Data that resolves to give a Guild object. This can be:
* * A Guild object
* * A Guild ID
* * A Snowflake
* @typedef {Guild|Snowflake} GuildResolvable
*/
@@ -128,7 +128,7 @@ class ClientDataResolver {
* * A Channel object
* * A Message object (the channel the message was sent in)
* * A Guild object (the #general channel)
* * A channel ID
* * A Snowflake
* @typedef {Channel|Guild|Message|Snowflake} ChannelResolvable
*/

View File

@@ -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);
* }
@@ -141,12 +141,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);
@@ -163,11 +163,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);

View File

@@ -12,9 +12,10 @@ const { Error } = require('../../errors');
* Represents a connection to a guild's voice server.
* ```js
* // Obtained using:
* voiceChannel.join().then(connection => {
* voiceChannel.join()
* .then(connection => {
*
* });
* });
* ```
* @extends {EventEmitter}
*/
@@ -311,7 +312,7 @@ class VoiceConnection extends EventEmitter {
}
/**
* Internally disconnects (doesn't send disconnect packet.)
* Internally disconnects (doesn't send disconnect packet).
* @private
*/
_disconnect() {
@@ -454,10 +455,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);
@@ -483,11 +484,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);
@@ -531,7 +532,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() {

View File

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

View File

@@ -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 = {

View File

@@ -83,7 +83,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) {

View File

@@ -11,9 +11,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}
*/

View File

@@ -29,12 +29,12 @@ const WebSocket = (function findWebSocket() {
class WebSocketConnection extends EventEmitter {
/**
* @param {WebSocketManager} manager The WebSocket manager
* @param {string} gateway WebSocket gateway to connect to
* @param {string} gateway The WebSocket gateway to connect to
*/
constructor(manager, gateway) {
super();
/**
* WebSocket Manager of this connection
* The WebSocket Manager of this connection
* @type {WebSocketManager}
*/
this.manager = manager;
@@ -233,7 +233,7 @@ class WebSocketConnection extends EventEmitter {
/**
* Creates a connection to a gateway.
* @param {string} gateway Gateway to connect to
* @param {string} gateway The gateway to connect to
* @param {number} [after=0] How long to wait before connecting
* @param {boolean} [force=false] Whether or not to force a new connection even if one already exists
* @returns {boolean}
@@ -358,7 +358,7 @@ class WebSocketConnection extends EventEmitter {
/**
* Called whenever an error occurs with the WebSocket.
* @param {Error} error Error that occurred
* @param {Error} error The error that occurred
*/
onError(error) {
if (error && error.message === 'uWs client connection error') {

View File

@@ -3,7 +3,7 @@ const Constants = require('../../util/Constants');
const WebSocketConnection = require('./WebSocketConnection');
/**
* WebSocket Manager of the client
* WebSocket Manager of the client.
* @private
*/
class WebSocketManager extends EventEmitter {
@@ -23,7 +23,7 @@ class WebSocketManager extends EventEmitter {
}
/**
* Sends a heartbeat on the available connection
* Sends a heartbeat on the available connection.
* @returns {void}
*/
heartbeat() {
@@ -67,7 +67,7 @@ class WebSocketManager extends EventEmitter {
/**
* Connects the client to a gateway.
* @param {string} gateway Gateway to connect to
* @param {string} gateway The gateway to connect to
* @returns {boolean}
*/
connect(gateway) {