mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-15 19:13:31 +01:00
Improve docs
This commit is contained in:
@@ -291,7 +291,7 @@ class ClientDataResolver {
|
|||||||
* [255, 0, 255]
|
* [255, 0, 255]
|
||||||
* ```
|
* ```
|
||||||
* for purple
|
* for purple
|
||||||
* @typedef {String|number|Array} ColorResolvable
|
* @typedef {string|number|Array} ColorResolvable
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -15,4 +15,5 @@ class GuildEmojiCreateAction extends Action {
|
|||||||
* @event Client#emojiCreate
|
* @event Client#emojiCreate
|
||||||
* @param {Emoji} emoji The emoji that was created.
|
* @param {Emoji} emoji The emoji that was created.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
module.exports = GuildEmojiCreateAction;
|
module.exports = GuildEmojiCreateAction;
|
||||||
|
|||||||
@@ -15,4 +15,5 @@ class GuildEmojiDeleteAction extends Action {
|
|||||||
* @event Client#emojiDelete
|
* @event Client#emojiDelete
|
||||||
* @param {Emoji} emoji The emoji that was deleted.
|
* @param {Emoji} emoji The emoji that was deleted.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
module.exports = GuildEmojiDeleteAction;
|
module.exports = GuildEmojiDeleteAction;
|
||||||
|
|||||||
@@ -15,4 +15,5 @@ class GuildEmojiUpdateAction extends Action {
|
|||||||
* @param {Emoji} oldEmoji The old emoji
|
* @param {Emoji} oldEmoji The old emoji
|
||||||
* @param {Emoji} newEmoji The new emoji
|
* @param {Emoji} newEmoji The new emoji
|
||||||
*/
|
*/
|
||||||
|
|
||||||
module.exports = GuildEmojiUpdateAction;
|
module.exports = GuildEmojiUpdateAction;
|
||||||
|
|||||||
@@ -34,10 +34,12 @@ class MessageReactionAdd extends Action {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Emitted whenever a reaction is added to a message.
|
* Emitted whenever a reaction is added to a message.
|
||||||
* @event Client#messageReactionAdd
|
* @event Client#messageReactionAdd
|
||||||
* @param {MessageReaction} messageReaction The reaction object.
|
* @param {MessageReaction} messageReaction The reaction object.
|
||||||
* @param {User} user The user that applied the emoji or reaction emoji.
|
* @param {User} user The user that applied the emoji or reaction emoji.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
module.exports = MessageReactionAdd;
|
module.exports = MessageReactionAdd;
|
||||||
|
|||||||
@@ -34,10 +34,12 @@ class MessageReactionRemove extends Action {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Emitted whenever a reaction is removed from a message.
|
* Emitted whenever a reaction is removed from a message.
|
||||||
* @event Client#messageReactionRemove
|
* @event Client#messageReactionRemove
|
||||||
* @param {MessageReaction} messageReaction The reaction object.
|
* @param {MessageReaction} messageReaction The reaction object.
|
||||||
* @param {User} user The user that removed the emoji or reaction emoji.
|
* @param {User} user The user that removed the emoji or reaction emoji.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
module.exports = MessageReactionRemove;
|
module.exports = MessageReactionRemove;
|
||||||
|
|||||||
@@ -17,9 +17,11 @@ class MessageReactionRemoveAll extends Action {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Emitted whenever all reactions are removed from a message.
|
* Emitted whenever all reactions are removed from a message.
|
||||||
* @event Client#messageReactionRemoveAll
|
* @event Client#messageReactionRemoveAll
|
||||||
* @param {Message} message The message the reactions were removed from.
|
* @param {Message} message The message the reactions were removed from.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
module.exports = MessageReactionRemoveAll;
|
module.exports = MessageReactionRemoveAll;
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ class VoiceBroadcast extends VolumeInterface {
|
|||||||
this.prism = new Prism();
|
this.prism = new Prism();
|
||||||
/**
|
/**
|
||||||
* The current audio transcoder that is being used
|
* The current audio transcoder that is being used
|
||||||
* @type {object}
|
* @type {Object}
|
||||||
*/
|
*/
|
||||||
this.currentTranscoder = null;
|
this.currentTranscoder = null;
|
||||||
this.tickInterval = null;
|
this.tickInterval = null;
|
||||||
@@ -120,14 +120,14 @@ class VoiceBroadcast extends VolumeInterface {
|
|||||||
* @param {StreamOptions} [options] Options for playing the stream
|
* @param {StreamOptions} [options] Options for playing the stream
|
||||||
* @returns {VoiceBroadcast}
|
* @returns {VoiceBroadcast}
|
||||||
* @example
|
* @example
|
||||||
* // play streams using ytdl-core
|
* // Play streams using ytdl-core
|
||||||
* const ytdl = require('ytdl-core');
|
* const ytdl = require('ytdl-core');
|
||||||
* const streamOptions = { seek: 0, volume: 1 };
|
* const streamOptions = { seek: 0, volume: 1 };
|
||||||
* const broadcast = client.createVoiceBroadcast();
|
* const broadcast = client.createVoiceBroadcast();
|
||||||
*
|
*
|
||||||
* voiceChannel.join()
|
* voiceChannel.join()
|
||||||
* .then(connection => {
|
* .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);
|
* broadcast.playStream(stream);
|
||||||
* const dispatcher = connection.playBroadcast(broadcast);
|
* const dispatcher = connection.playBroadcast(broadcast);
|
||||||
* })
|
* })
|
||||||
@@ -144,7 +144,7 @@ class VoiceBroadcast extends VolumeInterface {
|
|||||||
* @param {StreamOptions} [options] Options for playing the stream
|
* @param {StreamOptions} [options] Options for playing the stream
|
||||||
* @returns {StreamDispatcher}
|
* @returns {StreamDispatcher}
|
||||||
* @example
|
* @example
|
||||||
* // play files natively
|
* // Play files natively
|
||||||
* const broadcast = client.createVoiceBroadcast();
|
* const broadcast = client.createVoiceBroadcast();
|
||||||
*
|
*
|
||||||
* voiceChannel.join()
|
* voiceChannel.join()
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ const Prism = require('prism-media');
|
|||||||
/**
|
/**
|
||||||
* Represents a connection to a voice channel in Discord.
|
* Represents a connection to a voice channel in Discord.
|
||||||
* ```js
|
* ```js
|
||||||
* // obtained using:
|
* // Obtained using:
|
||||||
* voiceChannel.join().then(connection => {
|
* voiceChannel.join().then(connection => {
|
||||||
*
|
*
|
||||||
* });
|
* });
|
||||||
@@ -437,7 +437,7 @@ class VoiceConnection extends EventEmitter {
|
|||||||
* @param {StreamOptions} [options] Options for playing the stream
|
* @param {StreamOptions} [options] Options for playing the stream
|
||||||
* @returns {StreamDispatcher}
|
* @returns {StreamDispatcher}
|
||||||
* @example
|
* @example
|
||||||
* // play files natively
|
* // Play files natively
|
||||||
* voiceChannel.join()
|
* voiceChannel.join()
|
||||||
* .then(connection => {
|
* .then(connection => {
|
||||||
* const dispatcher = connection.playFile('C:/Users/Discord/Desktop/music.mp3');
|
* 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
|
* @param {StreamOptions} [options] Options for playing the stream
|
||||||
* @returns {StreamDispatcher}
|
* @returns {StreamDispatcher}
|
||||||
* @example
|
* @example
|
||||||
* // play streams using ytdl-core
|
* // Play streams using ytdl-core
|
||||||
* const ytdl = require('ytdl-core');
|
* const ytdl = require('ytdl-core');
|
||||||
* const streamOptions = { seek: 0, volume: 1 };
|
* const streamOptions = { seek: 0, volume: 1 };
|
||||||
* voiceChannel.join()
|
* voiceChannel.join()
|
||||||
* .then(connection => {
|
* .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);
|
* const dispatcher = connection.playStream(stream, streamOptions);
|
||||||
* })
|
* })
|
||||||
* .catch(console.error);
|
* .catch(console.error);
|
||||||
@@ -504,7 +504,7 @@ class VoiceConnection extends EventEmitter {
|
|||||||
* @param {VoiceBroadcast} broadcast the broadcast to play
|
* @param {VoiceBroadcast} broadcast the broadcast to play
|
||||||
* @returns {StreamDispatcher}
|
* @returns {StreamDispatcher}
|
||||||
* @example
|
* @example
|
||||||
* // play a broadcast
|
* // Play a broadcast
|
||||||
* const broadcast = client
|
* const broadcast = client
|
||||||
* .createVoiceBroadcast()
|
* .createVoiceBroadcast()
|
||||||
* .playFile('./test.mp3');
|
* .playFile('./test.mp3');
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ class VoiceConnectionUDPClient extends EventEmitter {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Send a packet to the UDP client
|
* Send a packet to the UDP client
|
||||||
* @param {Object} packet the packet to send
|
* @param {Object} packet The packet to send
|
||||||
* @returns {Promise<Object>}
|
* @returns {Promise<Object>}
|
||||||
*/
|
*/
|
||||||
send(packet) {
|
send(packet) {
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ class VoiceWebSocket extends EventEmitter {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Called whenever an error occurs with the WebSocket.
|
* Called whenever an error occurs with the WebSocket.
|
||||||
* @param {Error} error the error that occurred
|
* @param {Error} error The error that occurred
|
||||||
*/
|
*/
|
||||||
onError(error) {
|
onError(error) {
|
||||||
this.emit('error', error);
|
this.emit('error', error);
|
||||||
@@ -161,7 +161,7 @@ class VoiceWebSocket extends EventEmitter {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Called whenever a valid packet is received from the WebSocket
|
* Called whenever a valid packet is received from the WebSocket
|
||||||
* @param {Object} packet the received packet
|
* @param {Object} packet The received packet
|
||||||
*/
|
*/
|
||||||
onPacket(packet) {
|
onPacket(packet) {
|
||||||
switch (packet.op) {
|
switch (packet.op) {
|
||||||
@@ -169,7 +169,7 @@ class VoiceWebSocket extends EventEmitter {
|
|||||||
this.setHeartbeat(packet.d.heartbeat_interval);
|
this.setHeartbeat(packet.d.heartbeat_interval);
|
||||||
/**
|
/**
|
||||||
* Emitted once the voice websocket receives the ready packet
|
* Emitted once the voice websocket receives the ready packet
|
||||||
* @param {Object} packet the received packet
|
* @param {Object} packet The received packet
|
||||||
* @event VoiceWebSocket#ready
|
* @event VoiceWebSocket#ready
|
||||||
*/
|
*/
|
||||||
this.emit('ready', packet.d);
|
this.emit('ready', packet.d);
|
||||||
@@ -177,8 +177,8 @@ class VoiceWebSocket extends EventEmitter {
|
|||||||
case Constants.VoiceOPCodes.SESSION_DESCRIPTION:
|
case Constants.VoiceOPCodes.SESSION_DESCRIPTION:
|
||||||
/**
|
/**
|
||||||
* Emitted once the Voice Websocket receives a description of this voice session
|
* Emitted once the Voice Websocket receives a description of this voice session
|
||||||
* @param {string} encryptionMode the type of encryption being used
|
* @param {string} encryptionMode The type of encryption being used
|
||||||
* @param {SecretKey} secretKey the secret key used for encryption
|
* @param {SecretKey} secretKey The secret key used for encryption
|
||||||
* @event VoiceWebSocket#sessionDescription
|
* @event VoiceWebSocket#sessionDescription
|
||||||
*/
|
*/
|
||||||
this.emit('sessionDescription', packet.d.mode, new SecretKey(packet.d.secret_key));
|
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
|
* 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) {
|
setHeartbeat(interval) {
|
||||||
if (!interval || isNaN(interval)) {
|
if (!interval || isNaN(interval)) {
|
||||||
@@ -214,7 +214,7 @@ class VoiceWebSocket extends EventEmitter {
|
|||||||
if (this.heartbeatInterval) {
|
if (this.heartbeatInterval) {
|
||||||
/**
|
/**
|
||||||
* Emitted whenver the voice websocket encounters a non-fatal error
|
* Emitted whenver the voice websocket encounters a non-fatal error
|
||||||
* @param {string} warn the warning
|
* @param {string} warn The warning
|
||||||
* @event VoiceWebSocket#warn
|
* @event VoiceWebSocket#warn
|
||||||
*/
|
*/
|
||||||
this.emit('warn', 'A voice heartbeat interval is being overwritten');
|
this.emit('warn', 'A voice heartbeat interval is being overwritten');
|
||||||
|
|||||||
@@ -9,9 +9,9 @@ nonce.fill(0);
|
|||||||
/**
|
/**
|
||||||
* The class that sends voice packet data to the voice connection.
|
* The class that sends voice packet data to the voice connection.
|
||||||
* ```js
|
* ```js
|
||||||
* // obtained using:
|
* // Obtained using:
|
||||||
* voiceChannel.join().then(connection => {
|
* 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');
|
* const dispatcher = connection.playFile('./file.mp3');
|
||||||
* });
|
* });
|
||||||
* ```
|
* ```
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ nonce.fill(0);
|
|||||||
/**
|
/**
|
||||||
* Receives voice data from a voice connection.
|
* Receives voice data from a voice connection.
|
||||||
* ```js
|
* ```js
|
||||||
* // obtained using:
|
* // Obtained using:
|
||||||
* voiceChannel.join().then(connection => {
|
* voiceChannel.join().then(connection => {
|
||||||
* const receiver = connection.createReceiver();
|
* const receiver = connection.createReceiver();
|
||||||
* });
|
* });
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ class ResumedHandler extends AbstractHandler {
|
|||||||
/**
|
/**
|
||||||
* Emitted whenever a websocket resumes
|
* Emitted whenever a websocket resumes
|
||||||
* @event Client#resume
|
* @event Client#resume
|
||||||
* @param {Number} replayed Number of events that were replayed
|
* @param {number} replayed Number of events that were replayed
|
||||||
*/
|
*/
|
||||||
|
|
||||||
module.exports = ResumedHandler;
|
module.exports = ResumedHandler;
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ class GroupDMChannel extends Channel {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Nicknames for group members
|
* 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]));
|
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
|
* 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)
|
* @param {string} [nick] Permanent nickname to give the user (only available if a bot is creating the dm)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ class UserProfile {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The user's connections
|
* The user's connections
|
||||||
* @type {Collection<String, UserConnection>}
|
* @type {Collection<Snowflake, UserConnection>}
|
||||||
*/
|
*/
|
||||||
this.connections = new Collection();
|
this.connections = new Collection();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user