mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-15 19:13:31 +01:00
Make JSDocs follow general conventions (#582)
* Make JSDocs follow usual conventions * Fix StringResolvable name * Make function lowercase
This commit is contained in:
committed by
Amish Shah
parent
44efcf3f52
commit
27652b94af
@@ -16,12 +16,12 @@ class ClientVoiceManager {
|
||||
this.client = client;
|
||||
/**
|
||||
* A collection mapping connection IDs to the Connection objects
|
||||
* @type {Collection<String, VoiceConnection>}
|
||||
* @type {Collection<string, VoiceConnection>}
|
||||
*/
|
||||
this.connections = new Collection();
|
||||
/**
|
||||
* Pending connection attempts, maps Guild ID to VoiceChannel
|
||||
* @type {Collection<String, VoiceChannel>}
|
||||
* @type {Collection<string, VoiceChannel>}
|
||||
*/
|
||||
this.pending = new Collection();
|
||||
}
|
||||
@@ -29,7 +29,7 @@ class ClientVoiceManager {
|
||||
/**
|
||||
* Checks whether a pending request can be processed
|
||||
* @private
|
||||
* @param {String} guildID The ID of the Guild
|
||||
* @param {string} guildID The ID of the Guild
|
||||
*/
|
||||
_checkPendingReady(guildID) {
|
||||
const pendingRequest = this.pending.get(guildID);
|
||||
@@ -49,9 +49,9 @@ class ClientVoiceManager {
|
||||
|
||||
/**
|
||||
* Called when the Client receives information about this voice server update.
|
||||
* @param {String} guildID the ID of the Guild
|
||||
* @param {String} token the token to authorise with
|
||||
* @param {String} endpoint the endpoint to connect to
|
||||
* @param {string} guildID the ID of the Guild
|
||||
* @param {string} token the token to authorise with
|
||||
* @param {string} endpoint the endpoint to connect to
|
||||
*/
|
||||
_receivedVoiceServer(guildID, token, endpoint) {
|
||||
const pendingRequest = this.pending.get(guildID);
|
||||
@@ -66,8 +66,8 @@ class ClientVoiceManager {
|
||||
|
||||
/**
|
||||
* Called when the Client receives information about the voice state update.
|
||||
* @param {String} guildID the ID of the Guild
|
||||
* @param {String} sessionID the session id to authorise with
|
||||
* @param {string} guildID the ID of the Guild
|
||||
* @param {string} sessionID the session id to authorise with
|
||||
*/
|
||||
_receivedVoiceStateUpdate(guildID, sessionID) {
|
||||
const pendingRequest = this.pending.get(guildID);
|
||||
@@ -99,7 +99,7 @@ class ClientVoiceManager {
|
||||
/**
|
||||
* Sets up a request to join a voice channel
|
||||
* @param {VoiceChannel} channel the voice channel to join
|
||||
* @returns {null}
|
||||
* @returns {void}
|
||||
*/
|
||||
joinChannel(channel) {
|
||||
return new Promise((resolve, reject) => {
|
||||
|
||||
@@ -25,7 +25,7 @@ class VoiceConnection extends EventEmitter {
|
||||
this.player = new DefaultPlayer(this);
|
||||
/**
|
||||
* The endpoint of the connection
|
||||
* @type {String}
|
||||
* @type {string}
|
||||
*/
|
||||
this.endpoint = endpoint;
|
||||
/**
|
||||
@@ -41,18 +41,18 @@ class VoiceConnection extends EventEmitter {
|
||||
this.websocket = new VoiceConnectionWebSocket(this, channel.guild.id, token, sessionID, endpoint);
|
||||
/**
|
||||
* Whether or not the connection is ready
|
||||
* @type {Boolean}
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.ready = false;
|
||||
/**
|
||||
* The resolve function for the promise associated with creating this connection
|
||||
* @type {Function}
|
||||
* @type {function}
|
||||
* @private
|
||||
*/
|
||||
this._resolve = resolve;
|
||||
/**
|
||||
* The reject function for the promise associated with creating this connection
|
||||
* @type {Function}
|
||||
* @type {function}
|
||||
* @private
|
||||
*/
|
||||
this._reject = reject;
|
||||
@@ -66,7 +66,7 @@ class VoiceConnection extends EventEmitter {
|
||||
* Executed whenever an error occurs with the UDP/WebSocket sub-client
|
||||
* @private
|
||||
* @param {Error} error
|
||||
* @returns {null}
|
||||
* @returns {void}
|
||||
*/
|
||||
_onError(e) {
|
||||
this._reject(e);
|
||||
@@ -82,7 +82,7 @@ class VoiceConnection extends EventEmitter {
|
||||
/**
|
||||
* Disconnects the Client from the Voice Channel
|
||||
* @param {string} [reason='user requested'] the reason of the disconnection
|
||||
* @returns {null}
|
||||
* @returns {void}
|
||||
*/
|
||||
disconnect(reason = 'user requested') {
|
||||
this.manager.client.ws.send({
|
||||
@@ -122,7 +122,7 @@ class VoiceConnection extends EventEmitter {
|
||||
|
||||
/**
|
||||
* Binds listeners to the WebSocket and UDP sub-clients
|
||||
* @returns {null}
|
||||
* @returns {void}
|
||||
* @private
|
||||
*/
|
||||
bindListeners() {
|
||||
@@ -195,7 +195,7 @@ class VoiceConnection extends EventEmitter {
|
||||
* Emitted whenever a user starts/stops speaking
|
||||
* @event VoiceConnection#speaking
|
||||
* @param {User} user the user that has started/stopped speaking
|
||||
* @param {Boolean} speaking whether or not the user is speaking
|
||||
* @param {boolean} speaking whether or not the user is speaking
|
||||
*/
|
||||
if (this.ready) {
|
||||
this.emit('speaking', user, data.speaking);
|
||||
@@ -208,7 +208,7 @@ class VoiceConnection extends EventEmitter {
|
||||
|
||||
/**
|
||||
* Play the given file in the voice connection
|
||||
* @param {String} filepath the path to the file
|
||||
* @param {string} filepath the path to the file
|
||||
* @returns {StreamDispatcher}
|
||||
* @example
|
||||
* // play files natively
|
||||
|
||||
@@ -26,7 +26,7 @@ class StreamDispatcher extends EventEmitter {
|
||||
/**
|
||||
* Emitted when the dispatcher starts/stops speaking
|
||||
* @event StreamDispatcher#speaking
|
||||
* @param {Boolean} value whether or not the dispatcher is speaking
|
||||
* @param {boolean} value whether or not the dispatcher is speaking
|
||||
*/
|
||||
_setSpeaking(value) {
|
||||
this.speaking = value;
|
||||
@@ -129,7 +129,7 @@ class StreamDispatcher extends EventEmitter {
|
||||
/**
|
||||
* Emitted when the stream wants to give debug information.
|
||||
* @event StreamDispatcher#debug
|
||||
* @param {String} information the debug information
|
||||
* @param {string} information the debug information
|
||||
*/
|
||||
this.emit('debug', `triggered terminal state ${state} - stream is now dead`);
|
||||
this._triggered = true;
|
||||
@@ -172,7 +172,7 @@ class StreamDispatcher extends EventEmitter {
|
||||
|
||||
/**
|
||||
* Stops the current stream permanently and emits an `end` event.
|
||||
* @returns {null}
|
||||
* @returns {void}
|
||||
*/
|
||||
end() {
|
||||
this._triggerTerminalState('end', 'user requested');
|
||||
@@ -180,7 +180,7 @@ class StreamDispatcher extends EventEmitter {
|
||||
|
||||
/**
|
||||
* Stops sending voice packets to the voice connection (stream may still progress however)
|
||||
* @returns {null}
|
||||
* @returns {void}
|
||||
*/
|
||||
pause() {
|
||||
this._pause(true);
|
||||
@@ -188,7 +188,7 @@ class StreamDispatcher extends EventEmitter {
|
||||
|
||||
/**
|
||||
* Resumes sending voice packets to the voice connection (may be further on in the stream than when paused)
|
||||
* @returns {null}
|
||||
* @returns {void}
|
||||
*/
|
||||
resume() {
|
||||
this._pause(false);
|
||||
|
||||
@@ -89,7 +89,7 @@ class VoiceReceiver extends EventEmitter {
|
||||
/**
|
||||
* Emitted whenever a voice packet cannot be decrypted
|
||||
* @event VoiceReceiver#warn
|
||||
* @param {String} message the warning message
|
||||
* @param {string} message the warning message
|
||||
*/
|
||||
return this.emit('warn', 'failed to decrypt voice packet');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user