mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-19 13:03:31 +01:00
Docs cleanup
This commit is contained in:
@@ -19,11 +19,7 @@ client.on('ready', () => {
|
|||||||
|
|
||||||
// Create an event listener for new guild members
|
// Create an event listener for new guild members
|
||||||
client.on('guildMemberAdd', member => {
|
client.on('guildMemberAdd', member => {
|
||||||
// Send the message to the guilds default channel (usually #general), mentioning the member
|
// Send the message to a designated channel on a server:
|
||||||
member.guild.defaultChannel.send(`Welcome to the server, ${member}!`);
|
|
||||||
|
|
||||||
// If you want to send the message to a designated channel on a server instead
|
|
||||||
// you can do the following:
|
|
||||||
const channel = member.guild.channels.find('name', 'member-log');
|
const channel = member.guild.channels.find('name', 'member-log');
|
||||||
// Do nothing if the channel wasn't found on this server
|
// Do nothing if the channel wasn't found on this server
|
||||||
if (!channel) return;
|
if (!channel) return;
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ class ClientDataResolver {
|
|||||||
/**
|
/**
|
||||||
* Data that resolves to give a User object. This can be:
|
* Data that resolves to give a User object. This can be:
|
||||||
* * A User object
|
* * A User object
|
||||||
* * A user ID
|
* * A Snowflake
|
||||||
* * A Message object (resolves to the message author)
|
* * A Message object (resolves to the message author)
|
||||||
* * A Guild object (owner of the guild)
|
* * A Guild object (owner of the guild)
|
||||||
* * A GuildMember object
|
* * A GuildMember object
|
||||||
@@ -65,7 +65,7 @@ class ClientDataResolver {
|
|||||||
/**
|
/**
|
||||||
* Data that resolves to give a Guild object. This can be:
|
* Data that resolves to give a Guild object. This can be:
|
||||||
* * A Guild object
|
* * A Guild object
|
||||||
* * A Guild ID
|
* * A Snowflake
|
||||||
* @typedef {Guild|Snowflake} GuildResolvable
|
* @typedef {Guild|Snowflake} GuildResolvable
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -106,7 +106,7 @@ class ClientDataResolver {
|
|||||||
* * A Channel object
|
* * A Channel object
|
||||||
* * A Message object (the channel the message was sent in)
|
* * A Message object (the channel the message was sent in)
|
||||||
* * A Guild object (the #general channel)
|
* * A Guild object (the #general channel)
|
||||||
* * A channel ID
|
* * A Snowflake
|
||||||
* @typedef {Channel|Guild|Message|Snowflake} ChannelResolvable
|
* @typedef {Channel|Guild|Message|Snowflake} ChannelResolvable
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ const ffmpegArguments = [
|
|||||||
* ```js
|
* ```js
|
||||||
* const broadcast = client.createVoiceBroadcast();
|
* const broadcast = client.createVoiceBroadcast();
|
||||||
* broadcast.playFile('./music.mp3');
|
* 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()) {
|
* for (const connection of client.voiceConnections.values()) {
|
||||||
* connection.playBroadcast(broadcast);
|
* connection.playBroadcast(broadcast);
|
||||||
* }
|
* }
|
||||||
|
|||||||
@@ -11,7 +11,8 @@ const Prism = require('prism-media');
|
|||||||
* Represents a connection to a guild's voice server.
|
* Represents a connection to a guild's voice server.
|
||||||
* ```js
|
* ```js
|
||||||
* // Obtained using:
|
* // Obtained using:
|
||||||
* voiceChannel.join().then(connection => {
|
* voiceChannel.join()
|
||||||
|
* .then(connection => {
|
||||||
*
|
*
|
||||||
* });
|
* });
|
||||||
* ```
|
* ```
|
||||||
@@ -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}
|
* @returns {VoiceReceiver}
|
||||||
*/
|
*/
|
||||||
createReceiver() {
|
createReceiver() {
|
||||||
|
|||||||
@@ -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); }
|
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); }
|
resume() { this.setPaused(false); }
|
||||||
|
|
||||||
@@ -122,7 +122,7 @@ class StreamDispatcher extends VolumeInterface {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the bitrate of the current Opus encoder.
|
* 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
|
* If set to 'auto', the voice channel's bitrate will be used
|
||||||
*/
|
*/
|
||||||
setBitrate(bitrate) {
|
setBitrate(bitrate) {
|
||||||
@@ -140,7 +140,7 @@ class StreamDispatcher extends VolumeInterface {
|
|||||||
/**
|
/**
|
||||||
* Emitted whenever the dispatcher has debug information.
|
* Emitted whenever the dispatcher has debug information.
|
||||||
* @event StreamDispatcher#debug
|
* @event StreamDispatcher#debug
|
||||||
* @param {string} info the debug info
|
* @param {string} info The debug info
|
||||||
*/
|
*/
|
||||||
this.setSpeaking(true);
|
this.setSpeaking(true);
|
||||||
while (repeats--) {
|
while (repeats--) {
|
||||||
@@ -294,7 +294,7 @@ class StreamDispatcher extends VolumeInterface {
|
|||||||
this.emit(type, reason);
|
this.emit(type, reason);
|
||||||
/**
|
/**
|
||||||
* Emitted once the dispatcher ends.
|
* Emitted once the dispatcher ends.
|
||||||
* @param {string} [reason] the reason the dispatcher ended
|
* @param {string} [reason] The reason the dispatcher ended
|
||||||
* @event StreamDispatcher#end
|
* @event StreamDispatcher#end
|
||||||
*/
|
*/
|
||||||
if (type !== 'end') this.emit('end', `destroyed due to ${type} - ${reason}`);
|
if (type !== 'end') this.emit('end', `destroyed due to ${type} - ${reason}`);
|
||||||
|
|||||||
@@ -4,10 +4,10 @@
|
|||||||
*/
|
*/
|
||||||
class BaseOpus {
|
class BaseOpus {
|
||||||
/**
|
/**
|
||||||
* @param {Object} [options] The options to apply to the Opus engine.
|
* @param {Object} [options] The options to apply to the Opus engine
|
||||||
* @param {number} [options.bitrate=48] The desired bitrate (kbps).
|
* @param {number} [options.bitrate=48] The desired bitrate (kbps)
|
||||||
* @param {boolean} [options.fec=false] Whether to enable forward error correction.
|
* @param {boolean} [options.fec=false] Whether to enable forward error correction
|
||||||
* @param {number} [options.plp=0] The expected packet loss percentage.
|
* @param {number} [options.plp=0] The expected packet loss percentage
|
||||||
*/
|
*/
|
||||||
constructor({ bitrate = 48, fec = false, plp = 0 } = {}) {
|
constructor({ bitrate = 48, fec = false, plp = 0 } = {}) {
|
||||||
this.ctl = {
|
this.ctl = {
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ class AudioPlayer extends EventEmitter {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the bitrate of the current Opus encoder.
|
* 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
|
* If set to 'auto', the voice channel's bitrate will be used
|
||||||
*/
|
*/
|
||||||
setBitrate(value) {
|
setBitrate(value) {
|
||||||
|
|||||||
@@ -10,7 +10,8 @@ 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();
|
||||||
* });
|
* });
|
||||||
* ```
|
* ```
|
||||||
|
|||||||
@@ -29,12 +29,12 @@ const WebSocket = (function findWebSocket() {
|
|||||||
class WebSocketConnection extends EventEmitter {
|
class WebSocketConnection extends EventEmitter {
|
||||||
/**
|
/**
|
||||||
* @param {WebSocketManager} manager The WebSocket manager
|
* @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) {
|
constructor(manager, gateway) {
|
||||||
super();
|
super();
|
||||||
/**
|
/**
|
||||||
* WebSocket Manager of this connection
|
* The WebSocket Manager of this connection
|
||||||
* @type {WebSocketManager}
|
* @type {WebSocketManager}
|
||||||
*/
|
*/
|
||||||
this.manager = manager;
|
this.manager = manager;
|
||||||
@@ -232,7 +232,7 @@ class WebSocketConnection extends EventEmitter {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a connection to a gateway.
|
* 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 {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
|
* @param {boolean} [force=false] Whether or not to force a new connection even if one already exists
|
||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
@@ -356,7 +356,7 @@ class WebSocketConnection extends EventEmitter {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Called whenever an error occurs with the WebSocket.
|
* Called whenever an error occurs with the WebSocket.
|
||||||
* @param {Error} error Error that occurred
|
* @param {Error} error The error that occurred
|
||||||
*/
|
*/
|
||||||
onError(error) {
|
onError(error) {
|
||||||
if (error && error.message === 'uWs client connection error') {
|
if (error && error.message === 'uWs client connection error') {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ const Constants = require('../../util/Constants');
|
|||||||
const WebSocketConnection = require('./WebSocketConnection');
|
const WebSocketConnection = require('./WebSocketConnection');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* WebSocket Manager of the client
|
* WebSocket Manager of the client.
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
class WebSocketManager extends EventEmitter {
|
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}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
heartbeat() {
|
heartbeat() {
|
||||||
@@ -67,7 +67,7 @@ class WebSocketManager extends EventEmitter {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Connects the client to a gateway.
|
* Connects the client to a gateway.
|
||||||
* @param {string} gateway Gateway to connect to
|
* @param {string} gateway The gateway to connect to
|
||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
connect(gateway) {
|
connect(gateway) {
|
||||||
|
|||||||
@@ -69,9 +69,11 @@ class Shard {
|
|||||||
* @param {string} prop Name of the client property to get, using periods for nesting
|
* @param {string} prop Name of the client property to get, using periods for nesting
|
||||||
* @returns {Promise<*>}
|
* @returns {Promise<*>}
|
||||||
* @example
|
* @example
|
||||||
* shard.fetchClientValue('guilds.size').then(count => {
|
* shard.fetchClientValue('guilds.size')
|
||||||
|
* .then(count => {
|
||||||
* console.log(`${count} guilds in shard ${shard.id}`);
|
* console.log(`${count} guilds in shard ${shard.id}`);
|
||||||
* }).catch(console.error);
|
* })
|
||||||
|
* .catch(console.error);
|
||||||
*/
|
*/
|
||||||
fetchClientValue(prop) {
|
fetchClientValue(prop) {
|
||||||
if (this._fetches.has(prop)) return this._fetches.get(prop);
|
if (this._fetches.has(prop)) return this._fetches.get(prop);
|
||||||
|
|||||||
@@ -49,9 +49,11 @@ class ShardClientUtil {
|
|||||||
* @param {string} prop Name of the client property to get, using periods for nesting
|
* @param {string} prop Name of the client property to get, using periods for nesting
|
||||||
* @returns {Promise<Array>}
|
* @returns {Promise<Array>}
|
||||||
* @example
|
* @example
|
||||||
* client.shard.fetchClientValues('guilds.size').then(results => {
|
* client.shard.fetchClientValues('guilds.size')
|
||||||
|
* .then(results => {
|
||||||
* console.log(`${results.reduce((prev, val) => prev + val, 0)} total guilds`);
|
* console.log(`${results.reduce((prev, val) => prev + val, 0)} total guilds`);
|
||||||
* }).catch(console.error);
|
* })
|
||||||
|
* .catch(console.error);
|
||||||
*/
|
*/
|
||||||
fetchClientValues(prop) {
|
fetchClientValues(prop) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
|
|||||||
@@ -176,9 +176,11 @@ class ShardingManager extends EventEmitter {
|
|||||||
* @param {string} prop Name of the client property to get, using periods for nesting
|
* @param {string} prop Name of the client property to get, using periods for nesting
|
||||||
* @returns {Promise<Array>}
|
* @returns {Promise<Array>}
|
||||||
* @example
|
* @example
|
||||||
* manager.fetchClientValues('guilds.size').then(results => {
|
* manager.fetchClientValues('guilds.size')
|
||||||
|
* .then(results => {
|
||||||
* console.log(`${results.reduce((prev, val) => prev + val, 0)} total guilds`);
|
* console.log(`${results.reduce((prev, val) => prev + val, 0)} total guilds`);
|
||||||
* }).catch(console.error);
|
* })
|
||||||
|
* .catch(console.error);
|
||||||
*/
|
*/
|
||||||
fetchClientValues(prop) {
|
fetchClientValues(prop) {
|
||||||
if (this.shards.size === 0) return Promise.reject(new Error('No shards have been spawned.'));
|
if (this.shards.size === 0) return Promise.reject(new Error('No shards have been spawned.'));
|
||||||
|
|||||||
@@ -215,10 +215,10 @@ class ClientUser extends User {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* A user's status. Must be one of:
|
* A user's status. Must be one of:
|
||||||
* - `online`
|
* * `online`
|
||||||
* - `idle`
|
* * `idle`
|
||||||
* - `invisible`
|
* * `invisible`
|
||||||
* - `dnd` (do not disturb)
|
* * `dnd` (do not disturb)
|
||||||
* @typedef {string} PresenceStatus
|
* @typedef {string} PresenceStatus
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ class Emoji {
|
|||||||
* @param {EmojiEditData} data The new data for the emoji
|
* @param {EmojiEditData} data The new data for the emoji
|
||||||
* @returns {Promise<Emoji>}
|
* @returns {Promise<Emoji>}
|
||||||
* @example
|
* @example
|
||||||
* // Edit a emoji
|
* // Edit an emoji
|
||||||
* emoji.edit({name: 'newemoji'})
|
* emoji.edit({name: 'newemoji'})
|
||||||
* .then(e => console.log(`Edited emoji ${e}`))
|
* .then(e => console.log(`Edited emoji ${e}`))
|
||||||
* .catch(console.error);
|
* .catch(console.error);
|
||||||
|
|||||||
@@ -219,7 +219,8 @@ class Guild {
|
|||||||
|
|
||||||
if (!this.emojis) {
|
if (!this.emojis) {
|
||||||
/**
|
/**
|
||||||
* A collection of emojis that are in this guild. The key is the emoji's ID, the value is the emoji.
|
* A collection of emojis that are in this guild
|
||||||
|
* The key is the emoji's ID, the value is the emoji
|
||||||
* @type {Collection<Snowflake, Emoji>}
|
* @type {Collection<Snowflake, Emoji>}
|
||||||
*/
|
*/
|
||||||
this.emojis = new Collection();
|
this.emojis = new Collection();
|
||||||
@@ -270,7 +271,7 @@ class Guild {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the acronym that shows up in place of a guild icon
|
* The acronym that shows up in place of a guild icon.
|
||||||
* @type {string}
|
* @type {string}
|
||||||
* @readonly
|
* @readonly
|
||||||
*/
|
*/
|
||||||
@@ -391,7 +392,8 @@ class Guild {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetch a collection of invites to this guild. Resolves with a collection mapping invites by their codes.
|
* Fetch a collection of invites to this guild.
|
||||||
|
* Resolves with a collection mapping invites by their codes.
|
||||||
* @returns {Promise<Collection<string, Invite>>}
|
* @returns {Promise<Collection<string, Invite>>}
|
||||||
*/
|
*/
|
||||||
fetchInvites() {
|
fetchInvites() {
|
||||||
|
|||||||
@@ -171,7 +171,7 @@ class GuildAuditLogsEntry {
|
|||||||
this.executor = guild.client.users.get(data.user_id);
|
this.executor = guild.client.users.get(data.user_id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An entry in the audit log representing a specific change
|
* An entry in the audit log representing a specific change.
|
||||||
* @typedef {object} AuditLogChange
|
* @typedef {object} AuditLogChange
|
||||||
* @property {string} key The property that was changed, e.g. `nick` for nickname changes
|
* @property {string} key The property that was changed, e.g. `nick` for nickname changes
|
||||||
* @property {*} [old] The old value of the change, e.g. for nicknames, the old nickname
|
* @property {*} [old] The old value of the change, e.g. for nicknames, the old nickname
|
||||||
|
|||||||
@@ -481,7 +481,7 @@ class GuildMember {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ban this guild member
|
* Ban this guild member.
|
||||||
* @param {Object|number|string} [options] Ban options. If a number, the number of days to delete messages for, if a
|
* @param {Object|number|string} [options] Ban options. If a number, the number of days to delete messages for, if a
|
||||||
* string, the ban reason. Supplying an object allows you to do both.
|
* string, the ban reason. Supplying an object allows you to do both.
|
||||||
* @param {number} [options.days=0] Number of days of messages to delete
|
* @param {number} [options.days=0] Number of days of messages to delete
|
||||||
|
|||||||
@@ -57,8 +57,8 @@ class Message {
|
|||||||
this.author = this.client.dataManager.newUser(data.author);
|
this.author = this.client.dataManager.newUser(data.author);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents the author of the message as a guild member. Only available if the message comes from a guild
|
* Represents the author of the message as a guild member
|
||||||
* where the author is still a member.
|
* Only available if the message comes from a guild where the author is still a member
|
||||||
* @type {?GuildMember}
|
* @type {?GuildMember}
|
||||||
*/
|
*/
|
||||||
this.member = this.guild ? this.guild.member(this.author) || null : null;
|
this.member = this.guild ? this.guild.member(this.author) || null : null;
|
||||||
@@ -209,8 +209,8 @@ class Message {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The message contents with all mentions replaced by the equivalent text. If mentions cannot be resolved to a name,
|
* The message contents with all mentions replaced by the equivalent text.
|
||||||
* the relevant mention in the message content will not be converted
|
* If mentions cannot be resolved to a name, the relevant mention in the message content will not be converted.
|
||||||
* @type {string}
|
* @type {string}
|
||||||
* @readonly
|
* @readonly
|
||||||
*/
|
*/
|
||||||
@@ -271,8 +271,8 @@ class Message {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Similar to createCollector but in promise form. Resolves with a collection of reactions that pass the specified
|
* Similar to createCollector but in promise form.
|
||||||
* filter.
|
* Resolves with a collection of reactions that pass the specified filter.
|
||||||
* @param {CollectorFilter} filter The filter function to use
|
* @param {CollectorFilter} filter The filter function to use
|
||||||
* @param {AwaitReactionsOptions} [options={}] Optional options to pass to the internal collector
|
* @param {AwaitReactionsOptions} [options={}] Optional options to pass to the internal collector
|
||||||
* @returns {Promise<Collection<string, MessageReaction>>}
|
* @returns {Promise<Collection<string, MessageReaction>>}
|
||||||
|
|||||||
@@ -22,7 +22,8 @@ class MessageCollector extends Collector {
|
|||||||
super(channel.client, filter, options);
|
super(channel.client, filter, options);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {TextBasedChannel} channel The channel
|
* The channel
|
||||||
|
* @type {TextBasedChannel}
|
||||||
*/
|
*/
|
||||||
this.channel = channel;
|
this.channel = channel;
|
||||||
|
|
||||||
@@ -60,7 +61,7 @@ class MessageCollector extends Collector {
|
|||||||
/**
|
/**
|
||||||
* Handle an incoming message for possible collection.
|
* Handle an incoming message for possible collection.
|
||||||
* @param {Message} message The message that could be collected
|
* @param {Message} message The message that could be collected
|
||||||
* @returns {?{key: Snowflake, value: Message}} Message data to collect
|
* @returns {?{key: Snowflake, value: Message}}
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
handle(message) {
|
handle(message) {
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ class ReactionCollector extends Collector {
|
|||||||
/**
|
/**
|
||||||
* Handle an incoming reaction for possible collection.
|
* Handle an incoming reaction for possible collection.
|
||||||
* @param {MessageReaction} reaction The reaction to possibly collect
|
* @param {MessageReaction} reaction The reaction to possibly collect
|
||||||
* @returns {?{key: Snowflake, value: MessageReaction}} Reaction data to collect
|
* @returns {?{key: Snowflake, value: MessageReaction}}
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
handle(reaction) {
|
handle(reaction) {
|
||||||
|
|||||||
@@ -135,7 +135,7 @@ class Role {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get an object mapping permission names to whether or not the role enables that permission
|
* Get an object mapping permission names to whether or not the role enables that permission.
|
||||||
* @returns {Object<string, boolean>}
|
* @returns {Object<string, boolean>}
|
||||||
* @example
|
* @example
|
||||||
* // Print the serialized role permissions
|
* // Print the serialized role permissions
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ class TextChannel extends GuildChannel {
|
|||||||
* @param {BufferResolvable|Base64Resolvable} avatar The avatar for the webhook
|
* @param {BufferResolvable|Base64Resolvable} avatar The avatar for the webhook
|
||||||
* @returns {Promise<Webhook>} webhook The created webhook
|
* @returns {Promise<Webhook>} webhook The created webhook
|
||||||
* @example
|
* @example
|
||||||
* channel.createWebhook('Snek', 'http://snek.s3.amazonaws.com/topSnek.png')
|
* channel.createWebhook('Snek', 'https://i.imgur.com/mI8XcpG.jpg')
|
||||||
* .then(webhook => console.log(`Created webhook ${webhook}`))
|
* .then(webhook => console.log(`Created webhook ${webhook}`))
|
||||||
* .catch(console.error)
|
* .catch(console.error)
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ class UserProfile {
|
|||||||
this.user = user;
|
this.user = user;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The client that created the instance of the the UserProfile.
|
* The client that created the instance of the UserProfile
|
||||||
* @name UserProfile#client
|
* @name UserProfile#client
|
||||||
* @type {Client}
|
* @type {Client}
|
||||||
* @readonly
|
* @readonly
|
||||||
|
|||||||
@@ -220,12 +220,12 @@ const Endpoints = exports.Endpoints = {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The current status of the client. Here are the available statuses:
|
* The current status of the client. Here are the available statuses:
|
||||||
* - READY
|
* * READY
|
||||||
* - CONNECTING
|
* * CONNECTING
|
||||||
* - RECONNECTING
|
* * RECONNECTING
|
||||||
* - IDLE
|
* * IDLE
|
||||||
* - NEARLY
|
* * NEARLY
|
||||||
* - DISCONNECTED
|
* * DISCONNECTED
|
||||||
* @typedef {number} Status
|
* @typedef {number} Status
|
||||||
*/
|
*/
|
||||||
exports.Status = {
|
exports.Status = {
|
||||||
@@ -239,11 +239,11 @@ exports.Status = {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The current status of a voice connection. Here are the available statuses:
|
* The current status of a voice connection. Here are the available statuses:
|
||||||
* - CONNECTED
|
* * CONNECTED
|
||||||
* - CONNECTING
|
* * CONNECTING
|
||||||
* - AUTHENTICATING
|
* * AUTHENTICATING
|
||||||
* - RECONNECTING
|
* * RECONNECTING
|
||||||
* - DISCONNECTED
|
* * DISCONNECTED
|
||||||
* @typedef {number} VoiceStatus
|
* @typedef {number} VoiceStatus
|
||||||
*/
|
*/
|
||||||
exports.VoiceStatus = {
|
exports.VoiceStatus = {
|
||||||
@@ -333,41 +333,41 @@ exports.Events = {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The type of a websocket message event, e.g. `MESSAGE_CREATE`. Here are the available events:
|
* The type of a websocket message event, e.g. `MESSAGE_CREATE`. Here are the available events:
|
||||||
* - READY
|
* * READY
|
||||||
* - RESUMED
|
* * RESUMED
|
||||||
* - GUILD_SYNC
|
* * GUILD_SYNC
|
||||||
* - GUILD_CREATE
|
* * GUILD_CREATE
|
||||||
* - GUILD_DELETE
|
* * GUILD_DELETE
|
||||||
* - GUILD_UPDATE
|
* * GUILD_UPDATE
|
||||||
* - GUILD_MEMBER_ADD
|
* * GUILD_MEMBER_ADD
|
||||||
* - GUILD_MEMBER_REMOVE
|
* * GUILD_MEMBER_REMOVE
|
||||||
* - GUILD_MEMBER_UPDATE
|
* * GUILD_MEMBER_UPDATE
|
||||||
* - GUILD_MEMBERS_CHUNK
|
* * GUILD_MEMBERS_CHUNK
|
||||||
* - GUILD_ROLE_CREATE
|
* * GUILD_ROLE_CREATE
|
||||||
* - GUILD_ROLE_DELETE
|
* * GUILD_ROLE_DELETE
|
||||||
* - GUILD_ROLE_UPDATE
|
* * GUILD_ROLE_UPDATE
|
||||||
* - GUILD_BAN_ADD
|
* * GUILD_BAN_ADD
|
||||||
* - GUILD_BAN_REMOVE
|
* * GUILD_BAN_REMOVE
|
||||||
* - CHANNEL_CREATE
|
* * CHANNEL_CREATE
|
||||||
* - CHANNEL_DELETE
|
* * CHANNEL_DELETE
|
||||||
* - CHANNEL_UPDATE
|
* * CHANNEL_UPDATE
|
||||||
* - CHANNEL_PINS_UPDATE
|
* * CHANNEL_PINS_UPDATE
|
||||||
* - MESSAGE_CREATE
|
* * MESSAGE_CREATE
|
||||||
* - MESSAGE_DELETE
|
* * MESSAGE_DELETE
|
||||||
* - MESSAGE_UPDATE
|
* * MESSAGE_UPDATE
|
||||||
* - MESSAGE_DELETE_BULK
|
* * MESSAGE_DELETE_BULK
|
||||||
* - MESSAGE_REACTION_ADD
|
* * MESSAGE_REACTION_ADD
|
||||||
* - MESSAGE_REACTION_REMOVE
|
* * MESSAGE_REACTION_REMOVE
|
||||||
* - MESSAGE_REACTION_REMOVE_ALL
|
* * MESSAGE_REACTION_REMOVE_ALL
|
||||||
* - USER_UPDATE
|
* * USER_UPDATE
|
||||||
* - USER_NOTE_UPDATE
|
* * USER_NOTE_UPDATE
|
||||||
* - USER_SETTINGS_UPDATE
|
* * USER_SETTINGS_UPDATE
|
||||||
* - PRESENCE_UPDATE
|
* * PRESENCE_UPDATE
|
||||||
* - VOICE_STATE_UPDATE
|
* * VOICE_STATE_UPDATE
|
||||||
* - TYPING_START
|
* * TYPING_START
|
||||||
* - VOICE_SERVER_UPDATE
|
* * VOICE_SERVER_UPDATE
|
||||||
* - RELATIONSHIP_ADD
|
* * RELATIONSHIP_ADD
|
||||||
* - RELATIONSHIP_REMOVE
|
* * RELATIONSHIP_REMOVE
|
||||||
* @typedef {string} WSEventType
|
* @typedef {string} WSEventType
|
||||||
*/
|
*/
|
||||||
exports.WSEvents = {
|
exports.WSEvents = {
|
||||||
@@ -409,6 +409,18 @@ exports.WSEvents = {
|
|||||||
RELATIONSHIP_REMOVE: 'RELATIONSHIP_REMOVE',
|
RELATIONSHIP_REMOVE: 'RELATIONSHIP_REMOVE',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type of a message, e.g. `DEFAULT`. Here are the available types:
|
||||||
|
* * DEFAULT
|
||||||
|
* * RECIPIENT_ADD
|
||||||
|
* * RECIPIENT_REMOVE
|
||||||
|
* * CALL
|
||||||
|
* * CHANNEL_NAME_CHANGE
|
||||||
|
* * CHANNEL_ICON_CHANGE
|
||||||
|
* * PINS_ADD
|
||||||
|
* * GUILD_MEMBER_JOIN
|
||||||
|
* @typedef {string} MessageType
|
||||||
|
*/
|
||||||
exports.MessageTypes = [
|
exports.MessageTypes = [
|
||||||
'DEFAULT',
|
'DEFAULT',
|
||||||
'RECIPIENT_ADD',
|
'RECIPIENT_ADD',
|
||||||
@@ -597,49 +609,49 @@ exports.Colors = {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* An error encountered while performing an API request. Here are the potential errors:
|
* An error encountered while performing an API request. Here are the potential errors:
|
||||||
* - UNKNOWN_ACCOUNT
|
* * UNKNOWN_ACCOUNT
|
||||||
* - UNKNOWN_APPLICATION
|
* * UNKNOWN_APPLICATION
|
||||||
* - UNKNOWN_CHANNEL
|
* * UNKNOWN_CHANNEL
|
||||||
* - UNKNOWN_GUILD
|
* * UNKNOWN_GUILD
|
||||||
* - UNKNOWN_INTEGRATION
|
* * UNKNOWN_INTEGRATION
|
||||||
* - UNKNOWN_INVITE
|
* * UNKNOWN_INVITE
|
||||||
* - UNKNOWN_MEMBER
|
* * UNKNOWN_MEMBER
|
||||||
* - UNKNOWN_MESSAGE
|
* * UNKNOWN_MESSAGE
|
||||||
* - UNKNOWN_OVERWRITE
|
* * UNKNOWN_OVERWRITE
|
||||||
* - UNKNOWN_PROVIDER
|
* * UNKNOWN_PROVIDER
|
||||||
* - UNKNOWN_ROLE
|
* * UNKNOWN_ROLE
|
||||||
* - UNKNOWN_TOKEN
|
* * UNKNOWN_TOKEN
|
||||||
* - UNKNOWN_USER
|
* * UNKNOWN_USER
|
||||||
* - UNKNOWN_EMOJI
|
* * UNKNOWN_EMOJI
|
||||||
* - BOT_PROHIBITED_ENDPOINT
|
* * BOT_PROHIBITED_ENDPOINT
|
||||||
* - BOT_ONLY_ENDPOINT
|
* * BOT_ONLY_ENDPOINT
|
||||||
* - MAXIMUM_GUILDS
|
* * MAXIMUM_GUILDS
|
||||||
* - MAXIMUM_FRIENDS
|
* * MAXIMUM_FRIENDS
|
||||||
* - MAXIMUM_PINS
|
* * MAXIMUM_PINS
|
||||||
* - MAXIMUM_ROLES
|
* * MAXIMUM_ROLES
|
||||||
* - MAXIMUM_REACTIONS
|
* * MAXIMUM_REACTIONS
|
||||||
* - UNAUTHORIZED
|
* * UNAUTHORIZED
|
||||||
* - MISSING_ACCESS
|
* * MISSING_ACCESS
|
||||||
* - INVALID_ACCOUNT_TYPE
|
* * INVALID_ACCOUNT_TYPE
|
||||||
* - CANNOT_EXECUTE_ON_DM
|
* * CANNOT_EXECUTE_ON_DM
|
||||||
* - EMBED_DISABLED
|
* * EMBED_DISABLED
|
||||||
* - CANNOT_EDIT_MESSAGE_BY_OTHER
|
* * CANNOT_EDIT_MESSAGE_BY_OTHER
|
||||||
* - CANNOT_SEND_EMPTY_MESSAGE
|
* * CANNOT_SEND_EMPTY_MESSAGE
|
||||||
* - CANNOT_MESSAGE_USER
|
* * CANNOT_MESSAGE_USER
|
||||||
* - CANNOT_SEND_MESSAGES_IN_VOICE_CHANNEL
|
* * CANNOT_SEND_MESSAGES_IN_VOICE_CHANNEL
|
||||||
* - CHANNEL_VERIFICATION_LEVEL_TOO_HIGH
|
* * CHANNEL_VERIFICATION_LEVEL_TOO_HIGH
|
||||||
* - OAUTH2_APPLICATION_BOT_ABSENT
|
* * OAUTH2_APPLICATION_BOT_ABSENT
|
||||||
* - MAXIMUM_OAUTH2_APPLICATIONS
|
* * MAXIMUM_OAUTH2_APPLICATIONS
|
||||||
* - INVALID_OAUTH_STATE
|
* * INVALID_OAUTH_STATE
|
||||||
* - MISSING_PERMISSIONS
|
* * MISSING_PERMISSIONS
|
||||||
* - INVALID_AUTHENTICATION_TOKEN
|
* * INVALID_AUTHENTICATION_TOKEN
|
||||||
* - NOTE_TOO_LONG
|
* * NOTE_TOO_LONG
|
||||||
* - INVALID_BULK_DELETE_QUANTITY
|
* * INVALID_BULK_DELETE_QUANTITY
|
||||||
* - CANNOT_PIN_MESSAGE_IN_OTHER_CHANNEL
|
* * CANNOT_PIN_MESSAGE_IN_OTHER_CHANNEL
|
||||||
* - CANNOT_EXECUTE_ON_SYSTEM_MESSAGE
|
* * CANNOT_EXECUTE_ON_SYSTEM_MESSAGE
|
||||||
* - BULK_DELETE_MESSAGE_TOO_OLD
|
* * BULK_DELETE_MESSAGE_TOO_OLD
|
||||||
* - INVITE_ACCEPTED_TO_GUILD_NOT_CONTANING_BOT
|
* * INVITE_ACCEPTED_TO_GUILD_NOT_CONTANING_BOT
|
||||||
* - REACTION_BLOCKED
|
* * REACTION_BLOCKED
|
||||||
* @typedef {string} APIError
|
* @typedef {string} APIError
|
||||||
*/
|
*/
|
||||||
exports.APIErrors = {
|
exports.APIErrors = {
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ class Permissions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets an object mapping permission name (like `READ_MESSAGES`) to a {@link boolean} indicating whether the
|
* Gets an object mapping permission name (like `VIEW_CHANNEL`) to a {@link boolean} indicating whether the
|
||||||
* permission is available.
|
* permission is available.
|
||||||
* @param {boolean} [checkAdmin=true] Whether to allow the administrator permission to override
|
* @param {boolean} [checkAdmin=true] Whether to allow the administrator permission to override
|
||||||
* @returns {Object}
|
* @returns {Object}
|
||||||
@@ -152,8 +152,8 @@ class Permissions {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Data that can be resolved to give a permission number. This can be:
|
* Data that can be resolved to give a permission number. This can be:
|
||||||
* - A string (see {@link Permissions.FLAGS})
|
* * A string (see {@link Permissions.FLAGS})
|
||||||
* - A permission number
|
* * A permission number
|
||||||
* @typedef {string|number} PermissionResolvable
|
* @typedef {string|number} PermissionResolvable
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@@ -66,9 +66,9 @@ class Util {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Parses emoji info out of a string. The string must be one of:
|
* Parses emoji info out of a string. The string must be one of:
|
||||||
* - A UTF-8 emoji (no ID)
|
* * A UTF-8 emoji (no ID)
|
||||||
* - A URL-encoded UTF-8 emoji (no ID)
|
* * A URL-encoded UTF-8 emoji (no ID)
|
||||||
* - A Discord custom emoji (`<:name:id>`)
|
* * A Discord custom emoji (`<:name:id>`)
|
||||||
* @param {string} text Emoji string to parse
|
* @param {string} text Emoji string to parse
|
||||||
* @returns {Object} Object with `name` and `id` properties
|
* @returns {Object} Object with `name` and `id` properties
|
||||||
* @private
|
* @private
|
||||||
|
|||||||
Reference in New Issue
Block a user