Webpack build for branch 11.1-dev: c7d1507e19

This commit is contained in:
Travis CI 2017-08-20 20:12:24 +00:00
parent 965c5b87ee
commit f65de8f971

View file

@ -289,12 +289,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 = {
@ -308,11 +308,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 = {
@ -402,41 +402,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 = {
@ -478,6 +478,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',
@ -666,49 +678,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 = {
@ -1309,9 +1321,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
@ -3997,7 +4009,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}
@ -4046,8 +4058,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
*/ */
@ -5342,7 +5354,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
@ -5413,8 +5425,8 @@ class Role {
* @example * @example
* // Edit a role * // Edit a role
* role.edit({name: 'new role'}) * role.edit({name: 'new role'})
* .then(r => console.log(`Edited role ${r}`)) * .then(r => console.log(`Edited role ${r}`))
* .catch(console.error); * .catch(console.error);
*/ */
edit(data) { edit(data) {
return this.client.rest.methods.updateGuildRole(this, data); return this.client.rest.methods.updateGuildRole(this, data);
@ -5427,8 +5439,8 @@ class Role {
* @example * @example
* // Set the name of the role * // Set the name of the role
* role.setName('new role') * role.setName('new role')
* .then(r => console.log(`Edited name of role ${r}`)) * .then(r => console.log(`Edited name of role ${r}`))
* .catch(console.error); * .catch(console.error);
*/ */
setName(name) { setName(name) {
return this.edit({ name }); return this.edit({ name });
@ -5441,8 +5453,8 @@ class Role {
* @example * @example
* // Set the color of a role * // Set the color of a role
* role.setColor('#FF0000') * role.setColor('#FF0000')
* .then(r => console.log(`Set color of role ${r}`)) * .then(r => console.log(`Set color of role ${r}`))
* .catch(console.error); * .catch(console.error);
*/ */
setColor(color) { setColor(color) {
return this.edit({ color }); return this.edit({ color });
@ -5455,8 +5467,8 @@ class Role {
* @example * @example
* // Set the hoist of the role * // Set the hoist of the role
* role.setHoist(true) * role.setHoist(true)
* .then(r => console.log(`Role hoisted: ${r.hoist}`)) * .then(r => console.log(`Role hoisted: ${r.hoist}`))
* .catch(console.error); * .catch(console.error);
*/ */
setHoist(hoist) { setHoist(hoist) {
return this.edit({ hoist }); return this.edit({ hoist });
@ -5470,8 +5482,8 @@ class Role {
* @example * @example
* // Set the position of the role * // Set the position of the role
* role.setPosition(1) * role.setPosition(1)
* .then(r => console.log(`Role position: ${r.position}`)) * .then(r => console.log(`Role position: ${r.position}`))
* .catch(console.error); * .catch(console.error);
*/ */
setPosition(position, relative) { setPosition(position, relative) {
return this.guild.setRolePosition(this, position, relative).then(() => this); return this.guild.setRolePosition(this, position, relative).then(() => this);
@ -5484,8 +5496,8 @@ class Role {
* @example * @example
* // Set the permissions of the role * // Set the permissions of the role
* role.setPermissions(['KICK_MEMBERS', 'BAN_MEMBERS']) * role.setPermissions(['KICK_MEMBERS', 'BAN_MEMBERS'])
* .then(r => console.log(`Role updated ${r}`)) * .then(r => console.log(`Role updated ${r}`))
* .catch(console.error); * .catch(console.error);
*/ */
setPermissions(permissions) { setPermissions(permissions) {
return this.edit({ permissions }); return this.edit({ permissions });
@ -5498,8 +5510,8 @@ class Role {
* @example * @example
* // Make the role mentionable * // Make the role mentionable
* role.setMentionable(true) * role.setMentionable(true)
* .then(r => console.log(`Role updated ${r}`)) * .then(r => console.log(`Role updated ${r}`))
* .catch(console.error); * .catch(console.error);
*/ */
setMentionable(mentionable) { setMentionable(mentionable) {
return this.edit({ mentionable }); return this.edit({ mentionable });
@ -5511,8 +5523,8 @@ class Role {
* @example * @example
* // Delete a role * // Delete a role
* role.delete() * role.delete()
* .then(r => console.log(`Deleted role ${r}`)) * .then(r => console.log(`Deleted role ${r}`))
* .catch(console.error); * .catch(console.error);
*/ */
delete() { delete() {
return this.client.rest.methods.deleteGuildRole(this); return this.client.rest.methods.deleteGuildRole(this);
@ -5727,8 +5739,8 @@ class Channel {
* @example * @example
* // Delete the channel * // Delete the channel
* channel.delete() * channel.delete()
* .then() // Success * .then() // Success
* .catch(console.error); // Log error * .catch(console.error); // Log error
*/ */
delete() { delete() {
return this.client.rest.methods.deleteChannel(this); return this.client.rest.methods.deleteChannel(this);
@ -6171,8 +6183,8 @@ class TextBasedChannel {
* @example * @example
* // Send a message * // Send a message
* channel.send('hello!') * channel.send('hello!')
* .then(message => console.log(`Sent message: ${message.content}`)) * .then(message => console.log(`Sent message: ${message.content}`))
* .catch(console.error); * .catch(console.error);
*/ */
send(content, options) { send(content, options) {
if (!options && typeof content === 'object' && !(content instanceof Array)) { if (!options && typeof content === 'object' && !(content instanceof Array)) {
@ -6260,8 +6272,8 @@ class TextBasedChannel {
* @example * @example
* // Get messages * // Get messages
* channel.fetchMessages({limit: 10}) * channel.fetchMessages({limit: 10})
* .then(messages => console.log(`Received ${messages.size} messages`)) * .then(messages => console.log(`Received ${messages.size} messages`))
* .catch(console.error); * .catch(console.error);
*/ */
fetchMessages(options = {}) { fetchMessages(options = {}) {
return this.client.rest.methods.getChannelMessages(this, options).then(data => { return this.client.rest.methods.getChannelMessages(this, options).then(data => {
@ -6423,8 +6435,8 @@ class TextBasedChannel {
* @example * @example
* // Create a message collector * // Create a message collector
* const collector = channel.createMessageCollector( * const collector = channel.createMessageCollector(
* m => m.content.includes('discord'), * m => m.content.includes('discord'),
* { time: 15000 } * { time: 15000 }
* ); * );
* collector.on('collect', m => console.log(`Collected ${m.content}`)); * collector.on('collect', m => console.log(`Collected ${m.content}`));
* collector.on('end', collected => console.log(`Collected ${collected.size} items`)); * collector.on('end', collected => console.log(`Collected ${collected.size} items`));
@ -6450,8 +6462,8 @@ class TextBasedChannel {
* const filter = m => m.content.startsWith('!vote'); * const filter = m => m.content.startsWith('!vote');
* // Errors: ['time'] treats ending because of the time limit as an error * // Errors: ['time'] treats ending because of the time limit as an error
* channel.awaitMessages(filter, { max: 4, time: 60000, errors: ['time'] }) * channel.awaitMessages(filter, { max: 4, time: 60000, errors: ['time'] })
* .then(collected => console.log(collected.size)) * .then(collected => console.log(collected.size))
* .catch(collected => console.log(`After a minute, only ${collected.size} out of 4 voted.`)); * .catch(collected => console.log(`After a minute, only ${collected.size} out of 4 voted.`));
*/ */
awaitMessages(filter, options = {}) { awaitMessages(filter, options = {}) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
@ -6669,8 +6681,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;
@ -6821,8 +6833,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
*/ */
@ -6866,8 +6878,8 @@ class Message {
* @example * @example
* // Create a reaction collector * // Create a reaction collector
* const collector = message.createReactionCollector( * const collector = message.createReactionCollector(
* (reaction, user) => reaction.emoji.name === '👌' && user.id === 'someID', * (reaction, user) => reaction.emoji.name === '👌' && user.id === 'someID',
* { time: 15000 } * { time: 15000 }
* ); * );
* collector.on('collect', r => console.log(`Collected ${r.emoji.name}`)); * collector.on('collect', r => console.log(`Collected ${r.emoji.name}`));
* collector.on('end', collected => console.log(`Collected ${collected.size} items`)); * collector.on('end', collected => console.log(`Collected ${collected.size} items`));
@ -6883,8 +6895,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>>}
@ -6982,8 +6994,8 @@ class Message {
* @example * @example
* // Update the content of a message * // Update the content of a message
* message.edit('This is my new content!') * message.edit('This is my new content!')
* .then(msg => console.log(`Updated the content of a message from ${msg.author}`)) * .then(msg => console.log(`Updated the content of a message from ${msg.author}`))
* .catch(console.error); * .catch(console.error);
*/ */
edit(content, options) { edit(content, options) {
if (!options && typeof content === 'object' && !(content instanceof Array)) { if (!options && typeof content === 'object' && !(content instanceof Array)) {
@ -7050,8 +7062,8 @@ class Message {
* @example * @example
* // Delete a message * // Delete a message
* message.delete() * message.delete()
* .then(msg => console.log(`Deleted message from ${msg.author}`)) * .then(msg => console.log(`Deleted message from ${msg.author}`))
* .catch(console.error); * .catch(console.error);
*/ */
delete(timeout = 0) { delete(timeout = 0) {
if (timeout <= 0) { if (timeout <= 0) {
@ -7073,8 +7085,8 @@ class Message {
* @example * @example
* // Reply to a message * // Reply to a message
* message.reply('Hey, I\'m a reply!') * message.reply('Hey, I\'m a reply!')
* .then(msg => console.log(`Sent a reply to ${msg.author}`)) * .then(msg => console.log(`Sent a reply to ${msg.author}`))
* .catch(console.error); * .catch(console.error);
*/ */
reply(content, options) { reply(content, options) {
if (!options && typeof content === 'object' && !(content instanceof Array)) { if (!options && typeof content === 'object' && !(content instanceof Array)) {
@ -7305,10 +7317,10 @@ 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);
*/ */
edit(data) { edit(data) {
return this.client.rest.methods.updateEmoji(this, data); return this.client.rest.methods.updateEmoji(this, data);
@ -7891,7 +7903,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
@ -8266,7 +8278,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();
@ -8317,7 +8330,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
*/ */
@ -8438,7 +8451,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() {
@ -8584,11 +8598,11 @@ class Guild {
* @example * @example
* // Set the guild name and region * // Set the guild name and region
* guild.edit({ * guild.edit({
* name: 'Discord Guild', * name: 'Discord Guild',
* region: 'london', * region: 'london',
* }) * })
* .then(updated => console.log(`New guild name ${updated.name} in region ${updated.region}`)) * .then(updated => console.log(`New guild name ${updated.name} in region ${updated.region}`))
* .catch(console.error); * .catch(console.error);
*/ */
edit(data) { edit(data) {
const _data = {}; const _data = {};
@ -8784,8 +8798,8 @@ class Guild {
* @example * @example
* // Ban a user by ID (or with a user/guild member object) * // Ban a user by ID (or with a user/guild member object)
* guild.ban('some user ID') * guild.ban('some user ID')
* .then(user => console.log(`Banned ${user.username || user.id || user} from ${guild.name}`)) * .then(user => console.log(`Banned ${user.username || user.id || user} from ${guild.name}`))
* .catch(console.error); * .catch(console.error);
*/ */
ban(user, options = {}) { ban(user, options = {}) {
if (typeof options === 'number') { if (typeof options === 'number') {
@ -8804,8 +8818,8 @@ class Guild {
* @example * @example
* // Unban a user by ID (or with a user/guild member object) * // Unban a user by ID (or with a user/guild member object)
* guild.unban('some user ID') * guild.unban('some user ID')
* .then(user => console.log(`Unbanned ${user.username} from ${guild.name}`)) * .then(user => console.log(`Unbanned ${user.username} from ${guild.name}`))
* .catch(console.error); * .catch(console.error);
*/ */
unban(user) { unban(user) {
return this.client.rest.methods.unbanGuildMember(this, user); return this.client.rest.methods.unbanGuildMember(this, user);
@ -8849,8 +8863,8 @@ class Guild {
* @example * @example
* // Create a new text channel * // Create a new text channel
* guild.createChannel('new-general', 'text') * guild.createChannel('new-general', 'text')
* .then(channel => console.log(`Created new channel ${channel}`)) * .then(channel => console.log(`Created new channel ${channel}`))
* .catch(console.error); * .catch(console.error);
*/ */
createChannel(name, type, overwrites) { createChannel(name, type, overwrites) {
return this.client.rest.methods.createChannel(this, name, type, overwrites); return this.client.rest.methods.createChannel(this, name, type, overwrites);
@ -8869,8 +8883,8 @@ class Guild {
* @returns {Promise<Guild>} * @returns {Promise<Guild>}
* @example * @example
* guild.updateChannels([{ channel: channelID, position: newChannelIndex }]) * guild.updateChannels([{ channel: channelID, position: newChannelIndex }])
* .then(guild => console.log(`Updated channel positions for ${guild.id}`)) * .then(guild => console.log(`Updated channel positions for ${guild.id}`))
* .catch(console.error); * .catch(console.error);
*/ */
setChannelPositions(channelPositions) { setChannelPositions(channelPositions) {
return this.client.rest.methods.updateChannelPositions(this.id, channelPositions); return this.client.rest.methods.updateChannelPositions(this.id, channelPositions);
@ -8883,16 +8897,16 @@ class Guild {
* @example * @example
* // Create a new role * // Create a new role
* guild.createRole() * guild.createRole()
* .then(role => console.log(`Created role ${role}`)) * .then(role => console.log(`Created role ${role}`))
* .catch(console.error); * .catch(console.error);
* @example * @example
* // Create a new role with data * // Create a new role with data
* guild.createRole({ * guild.createRole({
* name: 'Super Cool People', * name: 'Super Cool People',
* color: 'BLUE', * color: 'BLUE',
* }) * })
* .then(role => console.log(`Created role ${role}`)) * .then(role => console.log(`Created role ${role}`))
* .catch(console.error) * .catch(console.error)
*/ */
createRole(data = {}) { createRole(data = {}) {
return this.client.rest.methods.createGuildRole(this, data); return this.client.rest.methods.createGuildRole(this, data);
@ -8907,13 +8921,13 @@ class Guild {
* @example * @example
* // Create a new emoji from a url * // Create a new emoji from a url
* guild.createEmoji('https://i.imgur.com/w3duR07.png', 'rip') * guild.createEmoji('https://i.imgur.com/w3duR07.png', 'rip')
* .then(emoji => console.log(`Created new emoji with name ${emoji.name}!`)) * .then(emoji => console.log(`Created new emoji with name ${emoji.name}!`))
* .catch(console.error); * .catch(console.error);
* @example * @example
* // Create a new emoji from a file on your computer * // Create a new emoji from a file on your computer
* guild.createEmoji('./memes/banana.png', 'banana') * guild.createEmoji('./memes/banana.png', 'banana')
* .then(emoji => console.log(`Created new emoji with name ${emoji.name}!`)) * .then(emoji => console.log(`Created new emoji with name ${emoji.name}!`))
* .catch(console.error); * .catch(console.error);
*/ */
createEmoji(attachment, name, roles) { createEmoji(attachment, name, roles) {
return new Promise(resolve => { return new Promise(resolve => {
@ -8944,8 +8958,8 @@ class Guild {
* @example * @example
* // Leave a guild * // Leave a guild
* guild.leave() * guild.leave()
* .then(g => console.log(`Left the guild ${g}`)) * .then(g => console.log(`Left the guild ${g}`))
* .catch(console.error); * .catch(console.error);
*/ */
leave() { leave() {
return this.client.rest.methods.leaveGuild(this); return this.client.rest.methods.leaveGuild(this);
@ -8957,8 +8971,8 @@ class Guild {
* @example * @example
* // Delete a guild * // Delete a guild
* guild.delete() * guild.delete()
* .then(g => console.log(`Deleted the guild ${g}`)) * .then(g => console.log(`Deleted the guild ${g}`))
* .catch(console.error); * .catch(console.error);
*/ */
delete() { delete() {
return this.client.rest.methods.deleteGuild(this); return this.client.rest.methods.deleteGuild(this);
@ -9338,10 +9352,10 @@ class GuildChannel extends Channel {
* @example * @example
* // Overwrite permissions for a message author * // Overwrite permissions for a message author
* message.channel.overwritePermissions(message.author, { * message.channel.overwritePermissions(message.author, {
* SEND_MESSAGES: false * SEND_MESSAGES: false
* }) * })
* .then(() => console.log('Done!')) * .then(() => console.log('Done!'))
* .catch(console.error); * .catch(console.error);
*/ */
overwritePermissions(userOrRole, options) { overwritePermissions(userOrRole, options) {
const payload = { const payload = {
@ -9402,8 +9416,8 @@ class GuildChannel extends Channel {
* @example * @example
* // Edit a channel * // Edit a channel
* channel.edit({name: 'new-channel'}) * channel.edit({name: 'new-channel'})
* .then(c => console.log(`Edited channel ${c}`)) * .then(c => console.log(`Edited channel ${c}`))
* .catch(console.error); * .catch(console.error);
*/ */
edit(data) { edit(data) {
return this.client.rest.methods.updateChannel(this, data); return this.client.rest.methods.updateChannel(this, data);
@ -9416,8 +9430,8 @@ class GuildChannel extends Channel {
* @example * @example
* // Set a new channel name * // Set a new channel name
* channel.setName('not_general') * channel.setName('not_general')
* .then(newChannel => console.log(`Channel's new name is ${newChannel.name}`)) * .then(newChannel => console.log(`Channel's new name is ${newChannel.name}`))
* .catch(console.error); * .catch(console.error);
*/ */
setName(name) { setName(name) {
return this.edit({ name }); return this.edit({ name });
@ -9431,8 +9445,8 @@ class GuildChannel extends Channel {
* @example * @example
* // Set a new channel position * // Set a new channel position
* channel.setPosition(2) * channel.setPosition(2)
* .then(newChannel => console.log(`Channel's new position is ${newChannel.position}`)) * .then(newChannel => console.log(`Channel's new position is ${newChannel.position}`))
* .catch(console.error); * .catch(console.error);
*/ */
setPosition(position, relative) { setPosition(position, relative) {
return this.guild.setChannelPosition(this, position, relative).then(() => this); return this.guild.setChannelPosition(this, position, relative).then(() => this);
@ -9445,8 +9459,8 @@ class GuildChannel extends Channel {
* @example * @example
* // Set a new channel topic * // Set a new channel topic
* channel.setTopic('needs more rate limiting') * channel.setTopic('needs more rate limiting')
* .then(newChannel => console.log(`Channel's new topic is ${newChannel.topic}`)) * .then(newChannel => console.log(`Channel's new topic is ${newChannel.topic}`))
* .catch(console.error); * .catch(console.error);
*/ */
setTopic(topic) { setTopic(topic) {
return this.client.rest.methods.updateChannel(this, { topic }); return this.client.rest.methods.updateChannel(this, { topic });
@ -11987,8 +12001,8 @@ class Webhook {
* @example * @example
* // Send a message * // Send a message
* webhook.send('hello!') * webhook.send('hello!')
* .then(message => console.log(`Sent message: ${message.content}`)) * .then(message => console.log(`Sent message: ${message.content}`))
* .catch(console.error); * .catch(console.error);
*/ */
send(content, options) { send(content, options) {
if (!options && typeof content === 'object' && !(content instanceof Array)) { if (!options && typeof content === 'object' && !(content instanceof Array)) {
@ -12541,7 +12555,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
@ -12578,7 +12592,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
*/ */
@ -12619,7 +12633,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
*/ */
@ -16154,7 +16168,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) {
@ -16220,7 +16234,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;
@ -16258,7 +16273,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) {
@ -16747,7 +16762,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
@ -17049,9 +17064,9 @@ 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)
*/ */
createWebhook(name, avatar) { createWebhook(name, avatar) {
return new Promise(resolve => { return new Promise(resolve => {
@ -17231,8 +17246,8 @@ class VoiceChannel extends GuildChannel {
* @example * @example
* // Set the bitrate of a voice channel * // Set the bitrate of a voice channel
* voiceChannel.setBitrate(48) * voiceChannel.setBitrate(48)
* .then(vc => console.log(`Set bitrate to ${vc.bitrate}kbps for ${vc.name}`)) * .then(vc => console.log(`Set bitrate to ${vc.bitrate}kbps for ${vc.name}`))
* .catch(console.error); * .catch(console.error);
*/ */
setBitrate(bitrate) { setBitrate(bitrate) {
bitrate *= 1000; bitrate *= 1000;
@ -17246,8 +17261,8 @@ class VoiceChannel extends GuildChannel {
* @example * @example
* // Set the user limit of a voice channel * // Set the user limit of a voice channel
* voiceChannel.setUserLimit(42) * voiceChannel.setUserLimit(42)
* .then(vc => console.log(`Set user limit to ${vc.userLimit} for ${vc.name}`)) * .then(vc => console.log(`Set user limit to ${vc.userLimit} for ${vc.name}`))
* .catch(console.error); * .catch(console.error);
*/ */
setUserLimit(userLimit) { setUserLimit(userLimit) {
return this.edit({ userLimit }); return this.edit({ userLimit });
@ -17259,8 +17274,8 @@ class VoiceChannel extends GuildChannel {
* @example * @example
* // Join a voice channel * // Join a voice channel
* voiceChannel.join() * voiceChannel.join()
* .then(connection => console.log('Connected!')) * .then(connection => console.log('Connected!'))
* .catch(console.error); * .catch(console.error);
*/ */
join() { join() {
if (this.client.browser) return Promise.reject(new Error('Voice connections are not available in browsers.')); if (this.client.browser) return Promise.reject(new Error('Voice connections are not available in browsers.'));
@ -17318,12 +17333,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;
@ -17521,7 +17536,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}
@ -17645,7 +17660,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') {
@ -17888,8 +17903,8 @@ class ClientUser extends User {
* @example * @example
* // Set username * // Set username
* client.user.setUsername('discordjs') * client.user.setUsername('discordjs')
* .then(user => console.log(`My new username is ${user.username}`)) * .then(user => console.log(`My new username is ${user.username}`))
* .catch(console.error); * .catch(console.error);
*/ */
setUsername(username, password) { setUsername(username, password) {
return this.client.rest.methods.updateCurrentUser({ username }, password); return this.client.rest.methods.updateCurrentUser({ username }, password);
@ -17904,8 +17919,8 @@ class ClientUser extends User {
* @example * @example
* // Set email * // Set email
* client.user.setEmail('bob@gmail.com', 'some amazing password 123') * client.user.setEmail('bob@gmail.com', 'some amazing password 123')
* .then(user => console.log(`My new email is ${user.email}`)) * .then(user => console.log(`My new email is ${user.email}`))
* .catch(console.error); * .catch(console.error);
*/ */
setEmail(email, password) { setEmail(email, password) {
return this.client.rest.methods.updateCurrentUser({ email }, password); return this.client.rest.methods.updateCurrentUser({ email }, password);
@ -17920,8 +17935,8 @@ class ClientUser extends User {
* @example * @example
* // Set password * // Set password
* client.user.setPassword('some new amazing password 456', 'some amazing password 123') * client.user.setPassword('some new amazing password 456', 'some amazing password 123')
* .then(user => console.log('New password set!')) * .then(user => console.log('New password set!'))
* .catch(console.error); * .catch(console.error);
*/ */
setPassword(newPassword, oldPassword) { setPassword(newPassword, oldPassword) {
return this.client.rest.methods.updateCurrentUser({ password: newPassword }, oldPassword); return this.client.rest.methods.updateCurrentUser({ password: newPassword }, oldPassword);
@ -17934,8 +17949,8 @@ class ClientUser extends User {
* @example * @example
* // Set avatar * // Set avatar
* client.user.setAvatar('./avatar.png') * client.user.setAvatar('./avatar.png')
* .then(user => console.log(`New avatar set!`)) * .then(user => console.log(`New avatar set!`))
* .catch(console.error); * .catch(console.error);
*/ */
setAvatar(avatar) { setAvatar(avatar) {
if (typeof avatar === 'string' && avatar.startsWith('data:')) { if (typeof avatar === 'string' && avatar.startsWith('data:')) {
@ -18014,10 +18029,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
*/ */
@ -23081,7 +23096,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
@ -24858,7 +24873,7 @@ const Constants = __webpack_require__(0);
const WebSocketConnection = __webpack_require__(70); const WebSocketConnection = __webpack_require__(70);
/** /**
* WebSocket Manager of the client * WebSocket Manager of the client.
* @private * @private
*/ */
class WebSocketManager extends EventEmitter { class WebSocketManager extends EventEmitter {
@ -24878,7 +24893,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() {
@ -24922,7 +24937,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) {