Docs cleanup

This commit is contained in:
Crawl
2017-08-20 22:08:37 +02:00
parent c33b78da23
commit c7d1507e19
32 changed files with 287 additions and 267 deletions

View File

@@ -28,7 +28,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
@@ -65,7 +65,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
*/
@@ -106,7 +106,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);
* }
@@ -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);

View File

@@ -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() {

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

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

View File

@@ -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}
*/

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;
@@ -232,7 +232,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}
@@ -356,7 +356,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) {