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

@@ -291,7 +291,7 @@ class ClientDataResolver {
* [255, 0, 255]
* ```
* for purple
* @typedef {String|number|Array} ColorResolvable
* @typedef {string|number|Array} ColorResolvable
*/
/**

View File

@@ -15,4 +15,5 @@ class GuildEmojiCreateAction extends Action {
* @event Client#emojiCreate
* @param {Emoji} emoji The emoji that was created.
*/
module.exports = GuildEmojiCreateAction;

View File

@@ -15,4 +15,5 @@ class GuildEmojiDeleteAction extends Action {
* @event Client#emojiDelete
* @param {Emoji} emoji The emoji that was deleted.
*/
module.exports = GuildEmojiDeleteAction;

View File

@@ -15,4 +15,5 @@ class GuildEmojiUpdateAction extends Action {
* @param {Emoji} oldEmoji The old emoji
* @param {Emoji} newEmoji The new emoji
*/
module.exports = GuildEmojiUpdateAction;

View File

@@ -34,10 +34,12 @@ class MessageReactionAdd extends Action {
};
}
}
/**
* Emitted whenever a reaction is added to a message.
* @event Client#messageReactionAdd
* @param {MessageReaction} messageReaction The reaction object.
* @param {User} user The user that applied the emoji or reaction emoji.
*/
module.exports = MessageReactionAdd;

View File

@@ -34,10 +34,12 @@ class MessageReactionRemove extends Action {
};
}
}
/**
* Emitted whenever a reaction is removed from a message.
* @event Client#messageReactionRemove
* @param {MessageReaction} messageReaction The reaction object.
* @param {User} user The user that removed the emoji or reaction emoji.
*/
module.exports = MessageReactionRemove;

View File

@@ -17,9 +17,11 @@ class MessageReactionRemoveAll extends Action {
};
}
}
/**
* Emitted whenever all reactions are removed from a message.
* @event Client#messageReactionRemoveAll
* @param {Message} message The message the reactions were removed from.
*/
module.exports = MessageReactionRemoveAll;

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();
* });

View File

@@ -20,7 +20,7 @@ class ResumedHandler extends AbstractHandler {
/**
* Emitted whenever a websocket resumes
* @event Client#resume
* @param {Number} replayed Number of events that were replayed
* @param {number} replayed Number of events that were replayed
*/
module.exports = ResumedHandler;

View File

@@ -72,7 +72,7 @@ class GroupDMChannel extends Channel {
/**
* Nicknames for group members
* @type {?Collection<Snowflake, String>}
* @type {?Collection<Snowflake, string>}
*/
if (data.nicks) this.nicks = new Collection(data.nicks.map(n => [n.id, n.nick]));
@@ -126,7 +126,7 @@ class GroupDMChannel extends Channel {
/**
* Add a user to the dm
* @param {UserResolvable|String} accessTokenOrID Access token or user resolvable
* @param {UserResolvable|string} accessTokenOrID Access token or user resolvable
* @param {string} [nick] Permanent nickname to give the user (only available if a bot is creating the dm)
*/

View File

@@ -28,7 +28,7 @@ class UserProfile {
/**
* The user's connections
* @type {Collection<String, UserConnection>}
* @type {Collection<Snowflake, UserConnection>}
*/
this.connections = new Collection();