Improve docs

This commit is contained in:
Crawl
2017-04-24 16:29:29 +02:00
parent 401822a094
commit 53eda09f72
16 changed files with 34 additions and 25 deletions

View File

@@ -32,7 +32,7 @@ class VoiceBroadcast extends VolumeInterface {
this.prism = new Prism();
/**
* The current audio transcoder that is being used
* @type {object}
* @type {Object}
*/
this.currentTranscoder = null;
this.tickInterval = null;
@@ -120,14 +120,14 @@ class VoiceBroadcast extends VolumeInterface {
* @param {StreamOptions} [options] Options for playing the stream
* @returns {VoiceBroadcast}
* @example
* // play streams using ytdl-core
* // Play streams using ytdl-core
* const ytdl = require('ytdl-core');
* const streamOptions = { seek: 0, volume: 1 };
* const broadcast = client.createVoiceBroadcast();
*
* voiceChannel.join()
* .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' });
* broadcast.playStream(stream);
* const dispatcher = connection.playBroadcast(broadcast);
* })
@@ -144,7 +144,7 @@ class VoiceBroadcast extends VolumeInterface {
* @param {StreamOptions} [options] Options for playing the stream
* @returns {StreamDispatcher}
* @example
* // play files natively
* // Play files natively
* const broadcast = client.createVoiceBroadcast();
*
* voiceChannel.join()

View File

@@ -10,7 +10,7 @@ const Prism = require('prism-media');
/**
* Represents a connection to a voice channel in Discord.
* ```js
* // obtained using:
* // Obtained using:
* voiceChannel.join().then(connection => {
*
* });
@@ -437,7 +437,7 @@ class VoiceConnection extends EventEmitter {
* @param {StreamOptions} [options] Options for playing the stream
* @returns {StreamDispatcher}
* @example
* // play files natively
* // Play files natively
* voiceChannel.join()
* .then(connection => {
* const dispatcher = connection.playFile('C:/Users/Discord/Desktop/music.mp3');
@@ -464,12 +464,12 @@ class VoiceConnection extends EventEmitter {
* @param {StreamOptions} [options] Options for playing the stream
* @returns {StreamDispatcher}
* @example
* // play streams using ytdl-core
* // Play streams using ytdl-core
* 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 stream = ytdl('https://www.youtube.com/watch?v=XAWgeLF9EVQ', { filter : 'audioonly' });
* const dispatcher = connection.playStream(stream, streamOptions);
* })
* .catch(console.error);
@@ -504,7 +504,7 @@ class VoiceConnection extends EventEmitter {
* @param {VoiceBroadcast} broadcast the broadcast to play
* @returns {StreamDispatcher}
* @example
* // play a broadcast
* // Play a broadcast
* const broadcast = client
* .createVoiceBroadcast()
* .playFile('./test.mp3');

View File

@@ -84,7 +84,7 @@ class VoiceConnectionUDPClient extends EventEmitter {
/**
* Send a packet to the UDP client
* @param {Object} packet the packet to send
* @param {Object} packet The packet to send
* @returns {Promise<Object>}
*/
send(packet) {

View File

@@ -153,7 +153,7 @@ class VoiceWebSocket extends EventEmitter {
/**
* Called whenever an error occurs with the WebSocket.
* @param {Error} error the error that occurred
* @param {Error} error The error that occurred
*/
onError(error) {
this.emit('error', error);
@@ -161,7 +161,7 @@ class VoiceWebSocket extends EventEmitter {
/**
* Called whenever a valid packet is received from the WebSocket
* @param {Object} packet the received packet
* @param {Object} packet The received packet
*/
onPacket(packet) {
switch (packet.op) {
@@ -169,7 +169,7 @@ class VoiceWebSocket extends EventEmitter {
this.setHeartbeat(packet.d.heartbeat_interval);
/**
* Emitted once the voice websocket receives the ready packet
* @param {Object} packet the received packet
* @param {Object} packet The received packet
* @event VoiceWebSocket#ready
*/
this.emit('ready', packet.d);
@@ -177,8 +177,8 @@ class VoiceWebSocket extends EventEmitter {
case Constants.VoiceOPCodes.SESSION_DESCRIPTION:
/**
* Emitted once the Voice Websocket receives a description of this voice session
* @param {string} encryptionMode the type of encryption being used
* @param {SecretKey} secretKey the secret key used for encryption
* @param {string} encryptionMode The type of encryption being used
* @param {SecretKey} secretKey The secret key used for encryption
* @event VoiceWebSocket#sessionDescription
*/
this.emit('sessionDescription', packet.d.mode, new SecretKey(packet.d.secret_key));
@@ -204,7 +204,7 @@ class VoiceWebSocket extends EventEmitter {
/**
* Sets an interval at which to send a heartbeat packet to the WebSocket
* @param {number} interval the interval at which to send a heartbeat packet
* @param {number} interval The interval at which to send a heartbeat packet
*/
setHeartbeat(interval) {
if (!interval || isNaN(interval)) {
@@ -214,7 +214,7 @@ class VoiceWebSocket extends EventEmitter {
if (this.heartbeatInterval) {
/**
* Emitted whenver the voice websocket encounters a non-fatal error
* @param {string} warn the warning
* @param {string} warn The warning
* @event VoiceWebSocket#warn
*/
this.emit('warn', 'A voice heartbeat interval is being overwritten');

View File

@@ -9,9 +9,9 @@ nonce.fill(0);
/**
* The class that sends voice packet data to the voice connection.
* ```js
* // obtained using:
* // Obtained using:
* voiceChannel.join().then(connection => {
* // you can play a file or a stream here:
* // You can play a file or a stream here:
* const dispatcher = connection.playFile('./file.mp3');
* });
* ```

View File

@@ -9,7 +9,7 @@ nonce.fill(0);
/**
* Receives voice data from a voice connection.
* ```js
* // obtained using:
* // Obtained using:
* voiceChannel.join().then(connection => {
* const receiver = connection.createReceiver();
* });