From 00b24a8206ee73ca736c34e08af41cc11d1a111e Mon Sep 17 00:00:00 2001 From: Travis CI Date: Fri, 8 Sep 2017 21:08:28 +0000 Subject: [PATCH] Webpack build for branch master: dd085ceaee1903f5fbd7424f37b802ddfcc0b74e --- discord.master.js | 8105 +++++++++++++++++++++-------------------- discord.master.min.js | 2 +- 2 files changed, 4116 insertions(+), 3991 deletions(-) diff --git a/discord.master.js b/discord.master.js index 3eb99b5a..29cb0eac 100644 --- a/discord.master.js +++ b/discord.master.js @@ -60,14 +60,14 @@ /******/ __webpack_require__.p = ""; /******/ /******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = 78); +/******/ return __webpack_require__(__webpack_require__.s = 79); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ /***/ (function(module, exports, __webpack_require__) { -/* WEBPACK VAR INJECTION */(function(process) {exports.Package = __webpack_require__(57); +/* WEBPACK VAR INJECTION */(function(process) {exports.Package = __webpack_require__(58); const { Error, RangeError } = __webpack_require__(4); /** @@ -125,7 +125,7 @@ exports.DefaultOptions = { */ ws: { large_threshold: 250, - compress: __webpack_require__(113).platform() !== 'browser', + compress: __webpack_require__(114).platform() !== 'browser', properties: { $os: process ? process.platform : 'discord.js', $browser: 'discord.js', @@ -1261,8 +1261,8 @@ module.exports = Collection; /* 4 */ /***/ (function(module, exports, __webpack_require__) { -module.exports = __webpack_require__(58); -module.exports.Messages = __webpack_require__(112); +module.exports = __webpack_require__(59); +module.exports.Messages = __webpack_require__(113); /***/ }), @@ -1280,9 +1280,9 @@ module.exports.Messages = __webpack_require__(112); -var base64 = __webpack_require__(80) -var ieee754 = __webpack_require__(81) -var isArray = __webpack_require__(47) +var base64 = __webpack_require__(81) +var ieee754 = __webpack_require__(82) +var isArray = __webpack_require__(48) exports.Buffer = Buffer exports.SlowBuffer = SlowBuffer @@ -3707,15 +3707,45 @@ const Collection = __webpack_require__(3); * @extends {Collection} */ class DataStore extends Collection { - constructor(client, iterable) { + constructor(client, iterable, holds) { super(); Object.defineProperty(this, 'client', { value: client }); + Object.defineProperty(this, 'holds', { value: holds }); if (iterable) for (const item of iterable) this.create(item); } - // Stubs - create() { return undefined; } + create(data, cache = true, { id, extras = [] } = {}) { + const existing = this.get(id || data.id); + if (existing) return existing; + + const entry = this.holds ? new this.holds(this.client, data, ...extras) : data; + if (cache) this.set(id || entry.id, entry); + return entry; + } + remove(key) { return this.delete(key); } + + /** + * Resolves a data entry to a data Object. + * @param {string|Object} idOrInstance The id or instance of something in this datastore + * @returns {?Object} An instance from this datastore + */ + resolve(idOrInstance) { + if (idOrInstance instanceof this.holds) return idOrInstance; + if (typeof idOrInstance === 'string') return this.get(idOrInstance) || null; + return null; + } + + /** + * Resolves a data entry to a instance ID. + * @param {string|Instance} idOrInstance The id or instance of something in this datastore + * @returns {?string} + */ + resolveID(idOrInstance) { + if (idOrInstance instanceof this.holds) return idOrInstance.id; + if (typeof channel === 'string') return idOrInstance; + return null; + } } module.exports = DataStore; @@ -3911,6 +3941,137 @@ module.exports = Permissions; /***/ }), /* 13 */ +/***/ (function(module, exports, __webpack_require__) { + +/* WEBPACK VAR INJECTION */(function(Buffer) {const path = __webpack_require__(25); +const fs = __webpack_require__(30); +const snekfetch = __webpack_require__(36); +const Util = __webpack_require__(7); +const { Error, TypeError } = __webpack_require__(4); + +/** + * The DataResolver identifies different objects and tries to resolve a specific piece of information from them. + * @private + */ +class DataResolver { + constructor() { + throw new Error(`The ${this.constructor.name} class may not be instantiated.`); + } + + /** + * Data that can be resolved to give an invite code. This can be: + * * An invite code + * * An invite URL + * @typedef {string} InviteResolvable + */ + + /** + * Resolves InviteResolvable to an invite code. + * @param {InviteResolvable} data The invite resolvable to resolve + * @returns {string} + */ + static resolveInviteCode(data) { + const inviteRegex = /discord(?:app\.com\/invite|\.gg)\/([\w-]{2,255})/i; + const match = inviteRegex.exec(data); + if (match && match[1]) return match[1]; + return data; + } + + /** + * Resolves a Base64Resolvable, a string, or a BufferResolvable to a Base 64 image. + * @param {BufferResolvable|Base64Resolvable} image The image to be resolved + * @param {boolean} browser Whether this should resolve for a browser + * @returns {Promise} + */ + static async resolveImage(image, browser) { + if (!image) return null; + if (typeof image === 'string' && image.startsWith('data:')) { + return image; + } + const file = await this.resolveFile(image, browser); + return this.constructor.resolveBase64(file); + } + + /** + * Data that resolves to give a Base64 string, typically for image uploading. This can be: + * * A Buffer + * * A base64 string + * @typedef {Buffer|string} Base64Resolvable + */ + + /** + * Resolves a Base64Resolvable to a Base 64 image. + * @param {Base64Resolvable} data The base 64 resolvable you want to resolve + * @returns {?string} + */ + static resolveBase64(data) { + if (data instanceof Buffer) return `data:image/jpg;base64,${data.toString('base64')}`; + return data; + } + + /** + * Data that can be resolved to give a Buffer. This can be: + * * A Buffer + * * The path to a local file + * * A URL + * @typedef {string|Buffer} BufferResolvable + */ + + /** + * @external Stream + * @see {@link https://nodejs.org/api/stream.html} + */ + + /** + * Resolves a BufferResolvable to a Buffer. + * @param {BufferResolvable|Stream} resource The buffer or stream resolvable to resolve + * @param {boolean} browser Whether this should resolve for a browser + * @returns {Promise} + */ + static resolveFile(resource, browser) { + if (resource instanceof Buffer) return Promise.resolve(resource); + if (browser && resource instanceof ArrayBuffer) return Promise.resolve(Util.convertToBuffer(resource)); + + if (typeof resource === 'string') { + return new Promise((resolve, reject) => { + if (/^https?:\/\//.test(resource)) { + snekfetch.get(resource) + .end((err, res) => { + if (err) return reject(err); + if (!(res.body instanceof Buffer)) return reject(new TypeError('REQ_BODY_TYPE')); + return resolve(res.body); + }); + } else { + const file = path.resolve(resource); + fs.stat(file, (err, stats) => { + if (err) return reject(err); + if (!stats || !stats.isFile()) return reject(new Error('FILE_NOT_FOUND', file)); + fs.readFile(file, (err2, data) => { + if (err2) reject(err2); else resolve(data); + }); + return null; + }); + } + }); + } else if (resource.pipe && typeof resource.pipe === 'function') { + return new Promise((resolve, reject) => { + const buffers = []; + resource.once('error', reject); + resource.on('data', data => buffers.push(data)); + resource.once('end', () => resolve(Buffer.concat(buffers))); + }); + } + + return Promise.reject(new TypeError('REQ_RESOURCE_TYPE')); + } +} + +module.exports = DataResolver; + +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5).Buffer)) + +/***/ }), +/* 14 */ /***/ (function(module, exports) { // Copyright Joyent, Inc. and other Node contributors. @@ -4218,7 +4379,7 @@ function isUndefined(arg) { /***/ }), -/* 14 */ +/* 15 */ /***/ (function(module, exports) { if (typeof Object.create === 'function') { @@ -4246,111 +4407,6 @@ if (typeof Object.create === 'function') { } -/***/ }), -/* 15 */ -/***/ (function(module, exports, __webpack_require__) { - -const Snowflake = __webpack_require__(9); -const Base = __webpack_require__(10); -const Constants = __webpack_require__(0); - -/** - * Represents any channel on Discord. - * @extends {Base} - */ -class Channel extends Base { - constructor(client, data) { - super(client); - - const type = Object.keys(Constants.ChannelTypes)[data.type]; - /** - * The type of the channel, either: - * * `dm` - a DM channel - * * `group` - a Group DM channel - * * `text` - a guild text channel - * * `voice` - a guild voice channel - * * `unknown` - a generic channel of unknown type, could be Channel or GuildChannel - * @type {string} - */ - this.type = type ? type.toLowerCase() : 'unknown'; - - if (data) this._patch(data); - } - - _patch(data) { - /** - * The unique ID of the channel - * @type {Snowflake} - */ - this.id = data.id; - } - - /** - * The timestamp the channel was created at - * @type {number} - * @readonly - */ - get createdTimestamp() { - return Snowflake.deconstruct(this.id).timestamp; - } - - /** - * The time the channel was created - * @type {Date} - * @readonly - */ - get createdAt() { - return new Date(this.createdTimestamp); - } - - /** - * Deletes this channel. - * @returns {Promise} - * @example - * // Delete the channel - * channel.delete() - * .then() // Success - * .catch(console.error); // Log error - */ - delete() { - return this.client.api.channels(this.id).delete().then(() => this); - } - - static create(client, data, guild) { - const DMChannel = __webpack_require__(63); - const GroupDMChannel = __webpack_require__(67); - const TextChannel = __webpack_require__(68); - const VoiceChannel = __webpack_require__(70); - const GuildChannel = __webpack_require__(28); - const types = Constants.ChannelTypes; - let channel; - if (data.type === types.DM) { - channel = new DMChannel(client, data); - } else if (data.type === types.GROUP) { - channel = new GroupDMChannel(client, data); - } else { - guild = guild || client.guilds.get(data.guild_id); - if (guild) { - switch (data.type) { - case types.TEXT: - channel = new TextChannel(guild, data); - break; - case types.VOICE: - channel = new VoiceChannel(guild, data); - break; - default: - channel = new GuildChannel(guild, data); - } - guild.channels.set(channel.id, channel); - } - } - return channel; - } -} - -module.exports = Channel; - - /***/ }), /* 16 */ /***/ (function(module, exports, __webpack_require__) { @@ -4386,7 +4442,7 @@ module.exports = Channel; /**/ -var processNextTick = __webpack_require__(30); +var processNextTick = __webpack_require__(29); /**/ /**/ @@ -4401,11 +4457,11 @@ var objectKeys = Object.keys || function (obj) { module.exports = Duplex; /**/ -var util = __webpack_require__(23); -util.inherits = __webpack_require__(14); +var util = __webpack_require__(24); +util.inherits = __webpack_require__(15); /**/ -var Readable = __webpack_require__(48); +var Readable = __webpack_require__(49); var Writable = __webpack_require__(39); util.inherits(Duplex, Readable); @@ -4485,8 +4541,113 @@ function forEach(xs, f) { /* 17 */ /***/ (function(module, exports, __webpack_require__) { +const Snowflake = __webpack_require__(9); +const Base = __webpack_require__(10); +const Constants = __webpack_require__(0); + +/** + * Represents any channel on Discord. + * @extends {Base} + */ +class Channel extends Base { + constructor(client, data) { + super(client); + + const type = Object.keys(Constants.ChannelTypes)[data.type]; + /** + * The type of the channel, either: + * * `dm` - a DM channel + * * `group` - a Group DM channel + * * `text` - a guild text channel + * * `voice` - a guild voice channel + * * `unknown` - a generic channel of unknown type, could be Channel or GuildChannel + * @type {string} + */ + this.type = type ? type.toLowerCase() : 'unknown'; + + if (data) this._patch(data); + } + + _patch(data) { + /** + * The unique ID of the channel + * @type {Snowflake} + */ + this.id = data.id; + } + + /** + * The timestamp the channel was created at + * @type {number} + * @readonly + */ + get createdTimestamp() { + return Snowflake.deconstruct(this.id).timestamp; + } + + /** + * The time the channel was created + * @type {Date} + * @readonly + */ + get createdAt() { + return new Date(this.createdTimestamp); + } + + /** + * Deletes this channel. + * @returns {Promise} + * @example + * // Delete the channel + * channel.delete() + * .then() // Success + * .catch(console.error); // Log error + */ + delete() { + return this.client.api.channels(this.id).delete().then(() => this); + } + + static create(client, data, guild) { + const DMChannel = __webpack_require__(65); + const GroupDMChannel = __webpack_require__(69); + const TextChannel = __webpack_require__(70); + const VoiceChannel = __webpack_require__(72); + const GuildChannel = __webpack_require__(21); + const types = Constants.ChannelTypes; + let channel; + if (data.type === types.DM) { + channel = new DMChannel(client, data); + } else if (data.type === types.GROUP) { + channel = new GroupDMChannel(client, data); + } else { + guild = guild || client.guilds.get(data.guild_id); + if (guild) { + switch (data.type) { + case types.TEXT: + channel = new TextChannel(guild, data); + break; + case types.VOICE: + channel = new VoiceChannel(guild, data); + break; + default: + channel = new GuildChannel(guild, data); + } + guild.channels.set(channel.id, channel); + } + } + return channel; + } +} + +module.exports = Channel; + + +/***/ }), +/* 18 */ +/***/ (function(module, exports, __webpack_require__) { + const TextBasedChannel = __webpack_require__(26); -const Role = __webpack_require__(18); +const Role = __webpack_require__(27); const Permissions = __webpack_require__(12); const Collection = __webpack_require__(3); const Base = __webpack_require__(10); @@ -4499,8 +4660,8 @@ const { Error, TypeError } = __webpack_require__(4); * @extends {Base} */ class GuildMember extends Base { - constructor(guild, data) { - super(guild.client); + constructor(client, data, guild) { + super(client); /** * The guild that this member is part of @@ -4778,7 +4939,7 @@ class GuildMember extends Base { * @returns {?Permissions} */ permissionsIn(channel) { - channel = this.client.resolver.resolveChannel(channel); + channel = this.client.channels.resolve(channel); if (!channel || !channel.guild) throw new Error('GUILD_CHANNEL_RESOLVE'); return channel.permissionsFor(this); } @@ -4829,7 +4990,7 @@ class GuildMember extends Base { */ edit(data, reason) { if (data.channel) { - data.channel_id = this.client.resolver.resolveChannel(data.channel).id; + data.channel_id = this.client.channels.resolve(data.channel).id; data.channel = null; } if (data.roles) data.roles = data.roles.map(role => role instanceof Role ? role.id : role); @@ -4899,7 +5060,7 @@ class GuildMember extends Base { * @returns {Promise} */ addRole(role, reason) { - role = this.client.resolver.resolveRole(this.guild, role); + role = this.guild.roles.resolve(role); if (!role) return Promise.reject(new TypeError('INVALID_TYPE', 'role', 'Role nor a Snowflake')); if (this._roles.includes(role.id)) return Promise.resolve(this); return this.client.api.guilds(this.guild.id).members(this.user.id).roles(role.id) @@ -4920,7 +5081,7 @@ class GuildMember extends Base { addRoles(roles, reason) { let allRoles = this._roles.slice(); for (let role of roles instanceof Collection ? roles.values() : roles) { - role = this.client.resolver.resolveRole(this.guild, role); + role = this.guild.roles.resolve(role); if (!role) { return Promise.reject(new TypeError('INVALID_TYPE', 'roles', 'Array or Collection of Roles or Snowflakes', true)); @@ -4937,7 +5098,7 @@ class GuildMember extends Base { * @returns {Promise} */ removeRole(role, reason) { - role = this.client.resolver.resolveRole(this.guild, role); + role = this.guild.roles.resolve(role); if (!role) return Promise.reject(new TypeError('INVALID_TYPE', 'role', 'Role nor a Snowflake')); if (!this._roles.includes(role.id)) return Promise.resolve(this); return this.client.api.guilds(this.guild.id).members(this.user.id).roles(role.id) @@ -4959,7 +5120,7 @@ class GuildMember extends Base { removeRoles(roles, reason) { const allRoles = this._roles.slice(); for (let role of roles instanceof Collection ? roles.values() : roles) { - role = this.client.resolver.resolveRole(this.guild, role); + role = this.guild.roles.resolve(role); if (!role) { return Promise.reject(new TypeError('INVALID_TYPE', 'roles', 'Array or Collection of Roles or Snowflakes', true)); @@ -5047,382 +5208,6 @@ TextBasedChannel.applyToClass(GuildMember); module.exports = GuildMember; -/***/ }), -/* 18 */ -/***/ (function(module, exports, __webpack_require__) { - -const Snowflake = __webpack_require__(9); -const Permissions = __webpack_require__(12); -const Util = __webpack_require__(7); -const Base = __webpack_require__(10); -const { TypeError } = __webpack_require__(4); - -/** - * Represents a role on Discord. - * @extends {Base} - */ -class Role extends Base { - constructor(guild, data) { - super(guild.client); - - /** - * The guild that the role belongs to - * @type {Guild} - */ - this.guild = guild; - - if (data) this._patch(data); - } - - _patch(data) { - /** - * The ID of the role (unique to the guild it is part of) - * @type {Snowflake} - */ - this.id = data.id; - - /** - * The name of the role - * @type {string} - */ - this.name = data.name; - - /** - * The base 10 color of the role - * @type {number} - */ - this.color = data.color; - - /** - * If true, users that are part of this role will appear in a separate category in the users list - * @type {boolean} - */ - this.hoist = data.hoist; - - /** - * The position of the role from the API - * @type {number} - */ - this.position = data.position; - - /** - * The permissions bitfield of the role - * @type {number} - */ - this.permissions = data.permissions; - - /** - * Whether or not the role is managed by an external service - * @type {boolean} - */ - this.managed = data.managed; - - /** - * Whether or not the role can be mentioned by anyone - * @type {boolean} - */ - this.mentionable = data.mentionable; - } - - /** - * The timestamp the role was created at - * @type {number} - * @readonly - */ - get createdTimestamp() { - return Snowflake.deconstruct(this.id).timestamp; - } - - /** - * The time the role was created - * @type {Date} - * @readonly - */ - get createdAt() { - return new Date(this.createdTimestamp); - } - - /** - * The hexadecimal version of the role color, with a leading hashtag - * @type {string} - * @readonly - */ - get hexColor() { - let col = this.color.toString(16); - while (col.length < 6) col = `0${col}`; - return `#${col}`; - } - - /** - * The cached guild members that have this role - * @type {Collection} - * @readonly - */ - get members() { - return this.guild.members.filter(m => m.roles.has(this.id)); - } - - /** - * Whether the role is editable by the client user - * @type {boolean} - * @readonly - */ - get editable() { - if (this.managed) return false; - const clientMember = this.guild.member(this.client.user); - if (!clientMember.permissions.has(Permissions.FLAGS.MANAGE_ROLES)) return false; - return clientMember.highestRole.comparePositionTo(this) > 0; - } - - /** - * The position of the role in the role manager - * @type {number} - * @readonly - */ - get calculatedPosition() { - const sorted = this.guild._sortedRoles; - return sorted.array().indexOf(sorted.get(this.id)); - } - - /** - * Get an object mapping permission names to whether or not the role enables that permission. - * @returns {Object} - * @example - * // Print the serialized role permissions - * console.log(role.serialize()); - */ - serialize() { - return new Permissions(this.permissions).serialize(); - } - - /** - * Checks if the role has a permission. - * @param {PermissionResolvable|PermissionResolvable[]} permission Permission(s) to check for - * @param {boolean} [explicit=false] Whether to require the role to explicitly have the exact permission - * **(deprecated)** - * @param {boolean} [checkAdmin] Whether to allow the administrator permission to override - * (takes priority over `explicit`) - * @returns {boolean} - * @example - * // See if a role can ban a member - * if (role.hasPermission('BAN_MEMBERS')) { - * console.log('This role can ban members'); - * } else { - * console.log('This role can\'t ban members'); - * } - */ - hasPermission(permission, explicit = false, checkAdmin) { - return new Permissions(this.permissions).has( - permission, typeof checkAdmin !== 'undefined' ? checkAdmin : !explicit - ); - } - - /** - * Compares this role's position to another role's. - * @param {RoleResolvable} role Role to compare to this one - * @returns {number} Negative number if the this role's position is lower (other role's is higher), - * positive number if the this one is higher (other's is lower), 0 if equal - */ - comparePositionTo(role) { - role = this.client.resolver.resolveRole(this.guild, role); - if (!role) return Promise.reject(new TypeError('INVALID_TYPE', 'role', 'Role nor a Snowflake')); - return this.constructor.comparePositions(this, role); - } - - /** - * The data for a role. - * @typedef {Object} RoleData - * @property {string} [name] The name of the role - * @property {ColorResolvable} [color] The color of the role, either a hex string or a base 10 number - * @property {boolean} [hoist] Whether or not the role should be hoisted - * @property {number} [position] The position of the role - * @property {PermissionResolvable|PermissionResolvable[]} [permissions] The permissions of the role - * @property {boolean} [mentionable] Whether or not the role should be mentionable - */ - - /** - * Edits the role. - * @param {RoleData} data The new data for the role - * @param {string} [reason] Reason for editing this role - * @returns {Promise} - * @example - * // Edit a role - * role.edit({name: 'new role'}) - * .then(r => console.log(`Edited role ${r}`)) - * .catch(console.error); - */ - edit(data, reason) { - if (data.permissions) data.permissions = Permissions.resolve(data.permissions); - else data.permissions = this.permissions; - return this.client.api.guilds[this.guild.id].roles[this.id].patch({ - data: { - name: data.name || this.name, - color: Util.resolveColor(data.color || this.color), - hoist: typeof data.hoist !== 'undefined' ? data.hoist : this.hoist, - position: typeof data.position !== 'undefined' ? data.position : this.position, - permissions: data.permissions, - mentionable: typeof data.mentionable !== 'undefined' ? data.mentionable : this.mentionable, - }, - reason, - }) - .then(role => { - const clone = this._clone(); - clone._patch(role); - return clone; - }); - } - - /** - * Set a new name for the role. - * @param {string} name The new name of the role - * @param {string} [reason] Reason for changing the role's name - * @returns {Promise} - * @example - * // Set the name of the role - * role.setName('new role') - * .then(r => console.log(`Edited name of role ${r}`)) - * .catch(console.error); - */ - setName(name, reason) { - return this.edit({ name }, reason); - } - - /** - * Set a new color for the role. - * @param {ColorResolvable} color The color of the role - * @param {string} [reason] Reason for changing the role's color - * @returns {Promise} - * @example - * // Set the color of a role - * role.setColor('#FF0000') - * .then(r => console.log(`Set color of role ${r}`)) - * .catch(console.error); - */ - setColor(color, reason) { - return this.edit({ color }, reason); - } - - /** - * Set whether or not the role should be hoisted. - * @param {boolean} hoist Whether or not to hoist the role - * @param {string} [reason] Reason for setting whether or not the role should be hoisted - * @returns {Promise} - * @example - * // Set the hoist of the role - * role.setHoist(true) - * .then(r => console.log(`Role hoisted: ${r.hoist}`)) - * .catch(console.error); - */ - setHoist(hoist, reason) { - return this.edit({ hoist }, reason); - } - - /** - * Set the position of the role. - * @param {number} position The position of the role - * @param {boolean} [relative=false] Move the position relative to its current value - * @returns {Promise} - * @example - * // Set the position of the role - * role.setPosition(1) - * .then(r => console.log(`Role position: ${r.position}`)) - * .catch(console.error); - */ - setPosition(position, relative) { - return this.guild.setRolePosition(this, position, relative).then(() => this); - } - - /** - * Set the permissions of the role. - * @param {PermissionResolvable[]} permissions The permissions of the role - * @param {string} [reason] Reason for changing the role's permissions - * @returns {Promise} - * @example - * // Set the permissions of the role - * role.setPermissions(['KICK_MEMBERS', 'BAN_MEMBERS']) - * .then(r => console.log(`Role updated ${r}`)) - * .catch(console.error); - */ - setPermissions(permissions, reason) { - return this.edit({ permissions }, reason); - } - - /** - * Set whether this role is mentionable. - * @param {boolean} mentionable Whether this role should be mentionable - * @param {string} [reason] Reason for setting whether or not this role should be mentionable - * @returns {Promise} - * @example - * // Make the role mentionable - * role.setMentionable(true) - * .then(r => console.log(`Role updated ${r}`)) - * .catch(console.error); - */ - setMentionable(mentionable, reason) { - return this.edit({ mentionable }, reason); - } - - /** - * Deletes the role. - * @param {string} [reason] Reason for deleting this role - * @returns {Promise} - * @example - * // Delete a role - * role.delete() - * .then(r => console.log(`Deleted role ${r}`)) - * .catch(console.error); - */ - delete(reason) { - return this.client.api.guilds[this.guild.id].roles[this.id].delete({ reason }) - .then(() => { - this.client.actions.GuildRoleDelete.handle({ guild_id: this.guild.id, role_id: this.id }); - return this; - }); - } - - /** - * Whether this role equals another role. It compares all properties, so for most operations - * it is advisable to just compare `role.id === role2.id` as it is much faster and is often - * what most users need. - * @param {Role} role Role to compare with - * @returns {boolean} - */ - equals(role) { - return role && - this.id === role.id && - this.name === role.name && - this.color === role.color && - this.hoist === role.hoist && - this.position === role.position && - this.permissions === role.permissions && - this.managed === role.managed; - } - - /** - * When concatenated with a string, this automatically concatenates the role mention rather than the Role object. - * @returns {string} - */ - toString() { - if (this.id === this.guild.id) return '@everyone'; - return `<@&${this.id}>`; - } - - /** - * Compares the positions of two roles. - * @param {Role} role1 First role to compare - * @param {Role} role2 Second role to compare - * @returns {number} Negative number if the first role's position is lower (second role's is higher), - * positive number if the first's is higher (second's is lower), 0 if equal - */ - static comparePositions(role1, role2) { - if (role1.position === role2.position) return role2.id - role1.id; - return role1.position - role2.position; - } -} - -module.exports = Role; - - /***/ }), /* 19 */ /***/ (function(module, exports, __webpack_require__) { @@ -5455,6 +5240,8 @@ class Presence { * @type {?Activity} */ this.activity = activity ? new Activity(this, activity) : null; + + return this; } _clone() { @@ -5629,7 +5416,7 @@ exports.RichPresenceAssets = RichPresenceAssets; /* 20 */ /***/ (function(module, exports, __webpack_require__) { -const MessageAttachment = __webpack_require__(27); +const MessageAttachment = __webpack_require__(28); const Util = __webpack_require__(7); const { RangeError } = __webpack_require__(4); @@ -5968,1407 +5755,10 @@ module.exports = MessageEmbed; /* 21 */ /***/ (function(module, exports, __webpack_require__) { -/* WEBPACK VAR INJECTION */(function(Buffer) {const path = __webpack_require__(24); -const Util = __webpack_require__(7); -const Embed = __webpack_require__(20); -const MessageAttachment = __webpack_require__(27); -const MessageEmbed = __webpack_require__(20); - -/** - * Represents a webhook. - */ -class Webhook { - constructor(client, data) { - /** - * The client that instantiated the webhook - * @name Webhook#client - * @type {Client} - * @readonly - */ - Object.defineProperty(this, 'client', { value: client }); - if (data) this._patch(data); - } - - _patch(data) { - /** - * The name of the webhook - * @type {string} - */ - this.name = data.name; - - /** - * The token for the webhook - * @type {string} - */ - this.token = data.token; - - /** - * The avatar for the webhook - * @type {?string} - */ - this.avatar = data.avatar; - - /** - * The ID of the webhook - * @type {Snowflake} - */ - this.id = data.id; - - /** - * The guild the webhook belongs to - * @type {Snowflake} - */ - this.guildID = data.guild_id; - - /** - * The channel the webhook belongs to - * @type {Snowflake} - */ - this.channelID = data.channel_id; - - if (data.user) { - /** - * The owner of the webhook - * @type {?User|Object} - */ - this.owner = this.client.users ? this.client.users.get(data.user.id) : data.user; - } else { - this.owner = null; - } - } - - /** - * Options that can be passed into send. - * @typedef {Object} WebhookMessageOptions - * @property {string} [username=this.name] Username override for the message - * @property {string} [avatarURL] Avatar URL override for the message - * @property {boolean} [tts=false] Whether or not the message should be spoken aloud - * @property {string} [nonce=''] The nonce for the message - * @property {Object[]} [embeds] An array of embeds for the message - * (see [here](https://discordapp.com/developers/docs/resources/channel#embed-object) for more details) - * @property {boolean} [disableEveryone=this.client.options.disableEveryone] Whether or not @everyone and @here - * should be replaced with plain-text - * @property {FileOptions|BufferResolvable} [file] A file to send with the message - * @property {FileOptions[]|string[]} [files] Files to send with the message - * @property {string|boolean} [code] Language for optional codeblock formatting to apply - * @property {boolean|SplitOptions} [split=false] Whether or not the message should be split into multiple messages if - * it exceeds the character limit. If an object is provided, these are the options for splitting the message. - */ - - /* eslint-disable max-len */ - /** - * Send a message with this webhook. - * @param {StringResolvable} [content] The content to send - * @param {WebhookMessageOptions|MessageEmbed|MessageAttachment|MessageAttachment[]} [options={}] The options to provide - * @returns {Promise} - * @example - * // Send a message - * webhook.send('hello!') - * .then(message => console.log(`Sent message: ${message.content}`)) - * .catch(console.error); - */ - /* eslint-enable max-len */ - send(content, options) { // eslint-disable-line complexity - if (!options && typeof content === 'object' && !(content instanceof Array)) { - options = content; - content = ''; - } else if (!options) { - options = {}; - } - - if (options instanceof MessageAttachment) options = { files: [options.file] }; - if (options instanceof MessageEmbed) options = { embeds: [options] }; - if (options.embed) options = { embeds: [options.embed] }; - - if (content instanceof Array || options instanceof Array) { - const which = content instanceof Array ? content : options; - const attachments = which.filter(item => item instanceof MessageAttachment); - const embeds = which.filter(item => item instanceof MessageEmbed); - if (attachments.length) options = { files: attachments }; - if (embeds.length) options = { embeds }; - if ((embeds.length || attachments.length) && content instanceof Array) content = ''; - } - - if (!options.username) options.username = this.name; - if (options.avatarURL) { - options.avatar_url = options.avatarURL; - options.avatarURL = null; - } - - if (content) { - content = Util.resolveString(content); - let { split, code, disableEveryone } = options; - if (split && typeof split !== 'object') split = {}; - if (typeof code !== 'undefined' && (typeof code !== 'boolean' || code === true)) { - content = Util.escapeMarkdown(content, true); - content = `\`\`\`${typeof code !== 'boolean' ? code || '' : ''}\n${content}\n\`\`\``; - if (split) { - split.prepend = `\`\`\`${typeof code !== 'boolean' ? code || '' : ''}\n`; - split.append = '\n```'; - } - } - if (disableEveryone || (typeof disableEveryone === 'undefined' && this.client.options.disableEveryone)) { - content = content.replace(/@(everyone|here)/g, '@\u200b$1'); - } - - if (split) content = Util.splitMessage(content, split); - } - options.content = content; - - if (options.embeds) options.embeds = options.embeds.map(embed => new Embed(embed)._apiTransform()); - - if (options.files) { - for (let i = 0; i < options.files.length; i++) { - let file = options.files[i]; - if (typeof file === 'string' || Buffer.isBuffer(file)) file = { attachment: file }; - if (!file.name) { - if (typeof file.attachment === 'string') { - file.name = path.basename(file.attachment); - } else if (file.attachment && file.attachment.path) { - file.name = path.basename(file.attachment.path); - } else if (file instanceof MessageAttachment) { - file = { attachment: file.file, name: path.basename(file.file) || 'file.jpg' }; - } else { - file.name = 'file.jpg'; - } - } else if (file instanceof MessageAttachment) { - file = file.file; - } - options.files[i] = file; - } - - return Promise.all(options.files.map(file => - this.client.resolver.resolveFile(file.attachment).then(resource => { - file.file = resource; - return file; - }) - )).then(files => this.client.api.webhooks(this.id, this.token).post({ - data: options, - query: { wait: true }, - files, - auth: false, - })); - } - - if (content instanceof Array) { - return new Promise((resolve, reject) => { - const messages = []; - (function sendChunk() { - const opt = content.length ? null : { embeds: options.embeds, files: options.files }; - this.client.api.webhooks(this.id, this.token).post({ - data: { content: content.shift(), opt }, - query: { wait: true }, - auth: false, - }) - .then(message => { - messages.push(message); - if (content.length === 0) return resolve(messages); - return sendChunk.call(this); - }) - .catch(reject); - }.call(this)); - }); - } - - return this.client.api.webhooks(this.id, this.token).post({ - data: options, - query: { wait: true }, - auth: false, - }).then(data => { - if (!this.client.channels) return data; - return this.client.channels.get(data.channel_id).messages.create(data, false); - }); - } - - /** - * Send a raw slack message with this webhook. - * @param {Object} body The raw body to send - * @returns {Promise} - * @example - * // Send a slack message - * webhook.sendSlackMessage({ - * 'username': 'Wumpus', - * 'attachments': [{ - * 'pretext': 'this looks pretty cool', - * 'color': '#F0F', - * 'footer_icon': 'http://snek.s3.amazonaws.com/topSnek.png', - * 'footer': 'Powered by sneks', - * 'ts': Date.now() / 1000 - * }] - * }).catch(console.error); - */ - sendSlackMessage(body) { - return this.client.api.webhooks(this.id, this.token).slack.post({ - query: { wait: true }, - auth: false, - data: body, - }).then(data => { - if (!this.client.channels) return data; - return this.client.channels.get(data.channel_id).messages.create(data, false); - }); - } - - /** - * Edit the webhook. - * @param {Object} options Options - * @param {string} [options.name=this.name] New name for this webhook - * @param {BufferResolvable} [options.avatar] New avatar for this webhook - * @param {string} [reason] Reason for editing this webhook - * @returns {Promise} - */ - edit({ name = this.name, avatar }, reason) { - if (avatar && (typeof avatar === 'string' && !avatar.startsWith('data:'))) { - return this.client.resolver.resolveImage(avatar).then(image => - this.edit({ name, avatar: image }, reason) - ); - } - return this.client.api.webhooks(this.id, this.token).patch({ - data: { name, avatar }, - reason, - }).then(data => { - this.name = data.name; - this.avatar = data.avatar; - return this; - }); - } - - /** - * Delete the webhook. - * @param {string} [reason] Reason for deleting this webhook - * @returns {Promise} - */ - delete(reason) { - return this.client.api.webhooks(this.id, this.token).delete({ reason }); - } - - static applyToClass(structure) { - for (const prop of [ - 'send', - 'sendSlackMessage', - 'edit', - 'delete', - ]) { - Object.defineProperty(structure.prototype, prop, - Object.getOwnPropertyDescriptor(Webhook.prototype, prop)); - } - } -} - -module.exports = Webhook; - -/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5).Buffer)) - -/***/ }), -/* 22 */ -/***/ (function(module, exports, __webpack_require__) { - -exports = module.exports = __webpack_require__(48); -exports.Stream = exports; -exports.Readable = exports; -exports.Writable = __webpack_require__(39); -exports.Duplex = __webpack_require__(16); -exports.Transform = __webpack_require__(52); -exports.PassThrough = __webpack_require__(88); - - -/***/ }), -/* 23 */ -/***/ (function(module, exports, __webpack_require__) { - -/* WEBPACK VAR INJECTION */(function(Buffer) {// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -// NOTE: These type checking functions intentionally don't use `instanceof` -// because it is fragile and can be easily faked with `Object.create()`. - -function isArray(arg) { - if (Array.isArray) { - return Array.isArray(arg); - } - return objectToString(arg) === '[object Array]'; -} -exports.isArray = isArray; - -function isBoolean(arg) { - return typeof arg === 'boolean'; -} -exports.isBoolean = isBoolean; - -function isNull(arg) { - return arg === null; -} -exports.isNull = isNull; - -function isNullOrUndefined(arg) { - return arg == null; -} -exports.isNullOrUndefined = isNullOrUndefined; - -function isNumber(arg) { - return typeof arg === 'number'; -} -exports.isNumber = isNumber; - -function isString(arg) { - return typeof arg === 'string'; -} -exports.isString = isString; - -function isSymbol(arg) { - return typeof arg === 'symbol'; -} -exports.isSymbol = isSymbol; - -function isUndefined(arg) { - return arg === void 0; -} -exports.isUndefined = isUndefined; - -function isRegExp(re) { - return objectToString(re) === '[object RegExp]'; -} -exports.isRegExp = isRegExp; - -function isObject(arg) { - return typeof arg === 'object' && arg !== null; -} -exports.isObject = isObject; - -function isDate(d) { - return objectToString(d) === '[object Date]'; -} -exports.isDate = isDate; - -function isError(e) { - return (objectToString(e) === '[object Error]' || e instanceof Error); -} -exports.isError = isError; - -function isFunction(arg) { - return typeof arg === 'function'; -} -exports.isFunction = isFunction; - -function isPrimitive(arg) { - return arg === null || - typeof arg === 'boolean' || - typeof arg === 'number' || - typeof arg === 'string' || - typeof arg === 'symbol' || // ES6 symbol - typeof arg === 'undefined'; -} -exports.isPrimitive = isPrimitive; - -exports.isBuffer = Buffer.isBuffer; - -function objectToString(o) { - return Object.prototype.toString.call(o); -} - -/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5).Buffer)) - -/***/ }), -/* 24 */ -/***/ (function(module, exports, __webpack_require__) { - -/* WEBPACK VAR INJECTION */(function(process) {// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -// resolves . and .. elements in a path array with directory names there -// must be no slashes, empty elements, or device names (c:\) in the array -// (so also no leading and trailing slashes - it does not distinguish -// relative and absolute paths) -function normalizeArray(parts, allowAboveRoot) { - // if the path tries to go above the root, `up` ends up > 0 - var up = 0; - for (var i = parts.length - 1; i >= 0; i--) { - var last = parts[i]; - if (last === '.') { - parts.splice(i, 1); - } else if (last === '..') { - parts.splice(i, 1); - up++; - } else if (up) { - parts.splice(i, 1); - up--; - } - } - - // if the path is allowed to go above the root, restore leading ..s - if (allowAboveRoot) { - for (; up--; up) { - parts.unshift('..'); - } - } - - return parts; -} - -// Split a filename into [root, dir, basename, ext], unix version -// 'root' is just a slash, or nothing. -var splitPathRe = - /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/; -var splitPath = function(filename) { - return splitPathRe.exec(filename).slice(1); -}; - -// path.resolve([from ...], to) -// posix version -exports.resolve = function() { - var resolvedPath = '', - resolvedAbsolute = false; - - for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) { - var path = (i >= 0) ? arguments[i] : process.cwd(); - - // Skip empty and invalid entries - if (typeof path !== 'string') { - throw new TypeError('Arguments to path.resolve must be strings'); - } else if (!path) { - continue; - } - - resolvedPath = path + '/' + resolvedPath; - resolvedAbsolute = path.charAt(0) === '/'; - } - - // At this point the path should be resolved to a full absolute path, but - // handle relative paths to be safe (might happen when process.cwd() fails) - - // Normalize the path - resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) { - return !!p; - }), !resolvedAbsolute).join('/'); - - return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.'; -}; - -// path.normalize(path) -// posix version -exports.normalize = function(path) { - var isAbsolute = exports.isAbsolute(path), - trailingSlash = substr(path, -1) === '/'; - - // Normalize the path - path = normalizeArray(filter(path.split('/'), function(p) { - return !!p; - }), !isAbsolute).join('/'); - - if (!path && !isAbsolute) { - path = '.'; - } - if (path && trailingSlash) { - path += '/'; - } - - return (isAbsolute ? '/' : '') + path; -}; - -// posix version -exports.isAbsolute = function(path) { - return path.charAt(0) === '/'; -}; - -// posix version -exports.join = function() { - var paths = Array.prototype.slice.call(arguments, 0); - return exports.normalize(filter(paths, function(p, index) { - if (typeof p !== 'string') { - throw new TypeError('Arguments to path.join must be strings'); - } - return p; - }).join('/')); -}; - - -// path.relative(from, to) -// posix version -exports.relative = function(from, to) { - from = exports.resolve(from).substr(1); - to = exports.resolve(to).substr(1); - - function trim(arr) { - var start = 0; - for (; start < arr.length; start++) { - if (arr[start] !== '') break; - } - - var end = arr.length - 1; - for (; end >= 0; end--) { - if (arr[end] !== '') break; - } - - if (start > end) return []; - return arr.slice(start, end - start + 1); - } - - var fromParts = trim(from.split('/')); - var toParts = trim(to.split('/')); - - var length = Math.min(fromParts.length, toParts.length); - var samePartsLength = length; - for (var i = 0; i < length; i++) { - if (fromParts[i] !== toParts[i]) { - samePartsLength = i; - break; - } - } - - var outputParts = []; - for (var i = samePartsLength; i < fromParts.length; i++) { - outputParts.push('..'); - } - - outputParts = outputParts.concat(toParts.slice(samePartsLength)); - - return outputParts.join('/'); -}; - -exports.sep = '/'; -exports.delimiter = ':'; - -exports.dirname = function(path) { - var result = splitPath(path), - root = result[0], - dir = result[1]; - - if (!root && !dir) { - // No dirname whatsoever - return '.'; - } - - if (dir) { - // It has a dirname, strip trailing slash - dir = dir.substr(0, dir.length - 1); - } - - return root + dir; -}; - - -exports.basename = function(path, ext) { - var f = splitPath(path)[2]; - // TODO: make this comparison case-insensitive on windows? - if (ext && f.substr(-1 * ext.length) === ext) { - f = f.substr(0, f.length - ext.length); - } - return f; -}; - - -exports.extname = function(path) { - return splitPath(path)[3]; -}; - -function filter (xs, f) { - if (xs.filter) return xs.filter(f); - var res = []; - for (var i = 0; i < xs.length; i++) { - if (f(xs[i], i, xs)) res.push(xs[i]); - } - return res; -} - -// String.prototype.substr - negative index don't work in IE8 -var substr = 'ab'.substr(-1) === 'b' - ? function (str, start, len) { return str.substr(start, len) } - : function (str, start, len) { - if (start < 0) start = str.length + start; - return str.substr(start, len); - } -; - -/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(8))) - -/***/ }), -/* 25 */ -/***/ (function(module, exports, __webpack_require__) { - -const TextBasedChannel = __webpack_require__(26); -const { Presence } = __webpack_require__(19); -const UserProfile = __webpack_require__(129); -const Snowflake = __webpack_require__(9); -const Base = __webpack_require__(10); -const { Error } = __webpack_require__(4); - -/** - * Represents a user on Discord. - * @implements {TextBasedChannel} - * @extends {Base} - */ -class User extends Base { - constructor(client, data) { - super(client); - - /** - * The ID of the user - * @type {Snowflake} - */ - this.id = data.id; - - this._patch(data); - } - - _patch(data) { - /** - * The username of the user - * @type {string} - * @name User#username - */ - if (data.username) this.username = data.username; - - /** - * A discriminator based on username for the user - * @type {string} - * @name User#discriminator - */ - if (data.discriminator) this.discriminator = data.discriminator; - - /** - * The ID of the user's avatar - * @type {string} - * @name User#avatar - */ - if (typeof data.avatar !== 'undefined') this.avatar = data.avatar; - - /** - * Whether or not the user is a bot - * @type {boolean} - * @name User#bot - */ - if (typeof this.bot === 'undefined' && typeof data.bot !== 'undefined') this.bot = Boolean(data.bot); - - /** - * The ID of the last message sent by the user, if one was sent - * @type {?Snowflake} - */ - this.lastMessageID = null; - - /** - * The Message object of the last message sent by the user, if one was sent - * @type {?Message} - */ - this.lastMessage = null; - - if (data.token) this.client.token = data.token; - } - - /** - * The timestamp the user was created at - * @type {number} - * @readonly - */ - get createdTimestamp() { - return Snowflake.deconstruct(this.id).timestamp; - } - - /** - * The time the user was created - * @type {Date} - * @readonly - */ - get createdAt() { - return new Date(this.createdTimestamp); - } - - /** - * The presence of this user - * @type {Presence} - * @readonly - */ - get presence() { - if (this.client.presences.has(this.id)) return this.client.presences.get(this.id); - for (const guild of this.client.guilds.values()) { - if (guild.presences.has(this.id)) return guild.presences.get(this.id); - } - return new Presence(); - } - - /** - * A link to the user's avatar. - * @param {Object} [options={}] Options for the avatar url - * @param {string} [options.format='webp'] One of `webp`, `png`, `jpg`, `gif`. If no format is provided, - * it will be `gif` for animated avatars or otherwise `webp` - * @param {number} [options.size=128] One of `128`, `256`, `512`, `1024`, `2048` - * @returns {?string} - */ - avatarURL({ format, size } = {}) { - if (!this.avatar) return null; - return this.client.rest.cdn.Avatar(this.id, this.avatar, format, size); - } - - /** - * A link to the user's default avatar - * @type {string} - * @readonly - */ - get defaultAvatarURL() { - return this.client.rest.cdn.DefaultAvatar(this.discriminator % 5); - } - - /** - * A link to the user's avatar if they have one. - * Otherwise a link to their default avatar will be returned. - * @param {Object} [options={}] Options for the avatar url - * @param {string} [options.format='webp'] One of `webp`, `png`, `jpg`, `gif`. If no format is provided, - * it will be `gif` for animated avatars or otherwise `webp` - * @param {number} [options.size=128] One of `128`, `256`, `512`, `1024`, `2048` - * @returns {string} - */ - displayAvatarURL(options) { - return this.avatarURL(options) || this.defaultAvatarURL; - } - - /** - * The Discord "tag" for this user - * @type {string} - * @readonly - */ - get tag() { - return `${this.username}#${this.discriminator}`; - } - - /** - * The note that is set for the user - * This is only available when using a user account. - * @type {?string} - * @readonly - */ - get note() { - return this.client.user.notes.get(this.id) || null; - } - - /** - * Check whether the user is typing in a channel. - * @param {ChannelResolvable} channel The channel to check in - * @returns {boolean} - */ - typingIn(channel) { - channel = this.client.resolver.resolveChannel(channel); - return channel._typing.has(this.id); - } - - /** - * Get the time that the user started typing. - * @param {ChannelResolvable} channel The channel to get the time in - * @returns {?Date} - */ - typingSinceIn(channel) { - channel = this.client.resolver.resolveChannel(channel); - return channel._typing.has(this.id) ? new Date(channel._typing.get(this.id).since) : null; - } - - /** - * Get the amount of time the user has been typing in a channel for (in milliseconds), or -1 if they're not typing. - * @param {ChannelResolvable} channel The channel to get the time in - * @returns {number} - */ - typingDurationIn(channel) { - channel = this.client.resolver.resolveChannel(channel); - return channel._typing.has(this.id) ? channel._typing.get(this.id).elapsedTime : -1; - } - - /** - * The DM between the client's user and this user - * @type {?DMChannel} - * @readonly - */ - get dmChannel() { - return this.client.channels.filter(c => c.type === 'dm').find(c => c.recipient.id === this.id); - } - - /** - * Creates a DM channel between the client and the user. - * @returns {Promise} - */ - createDM() { - if (this.dmChannel) return Promise.resolve(this.dmChannel); - return this.client.api.users(this.client.user.id).channels.post({ data: { - recipient_id: this.id, - } }) - .then(data => this.client.actions.ChannelCreate.handle(data).channel); - } - - /** - * Deletes a DM channel (if one exists) between the client and the user. Resolves with the channel if successful. - * @returns {Promise} - */ - deleteDM() { - if (!this.dmChannel) return Promise.reject(new Error('USER_NO_DMCHANNEL')); - return this.client.api.channels(this.dmChannel.id).delete() - .then(data => this.client.actions.ChannelDelete.handle(data).channel); - } - - /** - * Get the profile of the user. - * This is only available when using a user account. - * @returns {Promise} - */ - fetchProfile() { - return this.client.api.users(this.id).profile.get().then(data => new UserProfile(this, data)); - } - - /** - * Sets a note for the user. - * This is only available when using a user account. - * @param {string} note The note to set for the user - * @returns {Promise} - */ - setNote(note) { - return this.client.api.users('@me').notes(this.id).put({ data: { note } }) - .then(() => this); - } - - /** - * Checks if the user is equal to another. It compares ID, username, discriminator, avatar, and bot flags. - * It is recommended to compare equality by using `user.id === user2.id` unless you want to compare all properties. - * @param {User} user User to compare with - * @returns {boolean} - */ - equals(user) { - let equal = user && - this.id === user.id && - this.username === user.username && - this.discriminator === user.discriminator && - this.avatar === user.avatar; - - return equal; - } - - /** - * When concatenated with a string, this automatically concatenates the user's mention instead of the User object. - * @returns {string} - * @example - * // logs: Hello from <@123456789>! - * console.log(`Hello from ${user}!`); - */ - toString() { - return `<@${this.id}>`; - } - - // These are here only for documentation purposes - they are implemented by TextBasedChannel - /* eslint-disable no-empty-function */ - send() {} -} - -TextBasedChannel.applyToClass(User); - -module.exports = User; - - -/***/ }), -/* 26 */ -/***/ (function(module, exports, __webpack_require__) { - -/* WEBPACK VAR INJECTION */(function(Buffer) {const path = __webpack_require__(24); -const MessageCollector = __webpack_require__(61); -const Shared = __webpack_require__(62); -const MessageStore = __webpack_require__(33); -const Snowflake = __webpack_require__(9); -const Collection = __webpack_require__(3); -const MessageAttachment = __webpack_require__(27); -const MessageEmbed = __webpack_require__(20); -const { RangeError, TypeError } = __webpack_require__(4); - -/** - * Interface for classes that have text-channel-like features. - * @interface - */ -class TextBasedChannel { - constructor() { - /** - * A collection containing the messages sent to this channel - * @type {MessageStore} - */ - this.messages = new MessageStore(this); - - /** - * The ID of the last message in the channel, if one was sent - * @type {?Snowflake} - */ - this.lastMessageID = null; - - /** - * The Message object of the last message in the channel, if one was sent - * @type {?Message} - */ - this.lastMessage = null; - } - - /** - * Options provided when sending or editing a message. - * @typedef {Object} MessageOptions - * @property {boolean} [tts=false] Whether or not the message should be spoken aloud - * @property {string} [nonce=''] The nonce for the message - * @property {string} [content=''] The content for the message - * @property {MessageEmbed|Object} [embed] An embed for the message - * (see [here](https://discordapp.com/developers/docs/resources/channel#embed-object) for more details) - * @property {boolean} [disableEveryone=this.client.options.disableEveryone] Whether or not @everyone and @here - * should be replaced with plain-text - * @property {FileOptions[]|BufferResolvable[]} [files] Files to send with the message - * @property {string|boolean} [code] Language for optional codeblock formatting to apply - * @property {boolean|SplitOptions} [split=false] Whether or not the message should be split into multiple messages if - * it exceeds the character limit. If an object is provided, these are the options for splitting the message - * @property {UserResolvable} [reply] User to reply to (prefixes the message with a mention, except in DMs) - */ - - /** - * @typedef {Object} FileOptions - * @property {BufferResolvable} attachment File to attach - * @property {string} [name='file.jpg'] Filename of the attachment - */ - - /** - * Options for splitting a message. - * @typedef {Object} SplitOptions - * @property {number} [maxLength=1950] Maximum character length per message piece - * @property {string} [char='\n'] Character to split the message with - * @property {string} [prepend=''] Text to prepend to every piece except the first - * @property {string} [append=''] Text to append to every piece except the last - */ - - /** - * Send a message to this channel. - * @param {StringResolvable} [content] Text for the message - * @param {MessageOptions|MessageEmbed|MessageAttachment|MessageAttachment[]} [options={}] Options for the message - * @returns {Promise} - * @example - * // Send a message - * channel.send('hello!') - * .then(message => console.log(`Sent message: ${message.content}`)) - * .catch(console.error); - */ - send(content, options) { // eslint-disable-line complexity - if (!options && typeof content === 'object' && !(content instanceof Array)) { - options = content; - content = ''; - } else if (!options) { - options = {}; - } - - if (options instanceof MessageEmbed) options = { embed: options }; - if (options instanceof MessageAttachment) options = { files: [options.file] }; - - if (content instanceof Array || options instanceof Array) { - const which = content instanceof Array ? content : options; - const attachments = which.filter(item => item instanceof MessageAttachment); - if (attachments.length) { - options = { files: attachments }; - if (content instanceof Array) content = ''; - } - } - - if (!options.content) options.content = content; - - if (options.embed && options.embed.files) { - if (options.files) options.files = options.files.concat(options.embed.files); - else options.files = options.embed.files; - } - - if (options.files) { - for (let i = 0; i < options.files.length; i++) { - let file = options.files[i]; - if (typeof file === 'string' || Buffer.isBuffer(file)) file = { attachment: file }; - if (!file.name) { - if (typeof file.attachment === 'string') { - file.name = path.basename(file.attachment); - } else if (file.attachment && file.attachment.path) { - file.name = path.basename(file.attachment.path); - } else if (file instanceof MessageAttachment) { - file = { attachment: file.file, name: path.basename(file.file) || 'file.jpg' }; - } else { - file.name = 'file.jpg'; - } - } else if (file instanceof MessageAttachment) { - file = file.file; - } - options.files[i] = file; - } - - return Promise.all(options.files.map(file => - this.client.resolver.resolveFile(file.attachment).then(resource => { - file.file = resource; - return file; - }) - )).then(files => { - options.files = files; - return Shared.sendMessage(this, options); - }); - } - - return Shared.sendMessage(this, options); - } - - /** - * Performs a search within the channel. - * This is only available when using a user account. - * @param {MessageSearchOptions} [options={}] Options to pass to the search - * @returns {Promise} - * @example - * channel.search({ - * content: 'discord.js', - * before: '2016-11-17' - * }).then(res => { - * const hit = res.results[0].find(m => m.hit).content; - * console.log(`I found: **${hit}**, total results: ${res.total}`); - * }).catch(console.error); - */ - search(options = {}) { - return Shared.search(this, options); - } - - /** - * Starts a typing indicator in the channel. - * @param {number} [count] The number of times startTyping should be considered to have been called - * @example - * // Start typing in a channel - * channel.startTyping(); - */ - startTyping(count) { - if (typeof count !== 'undefined' && count < 1) throw new RangeError('TYPING_COUNT'); - if (!this.client.user._typing.has(this.id)) { - const endpoint = this.client.api.channels[this.id].typing; - this.client.user._typing.set(this.id, { - count: count || 1, - interval: this.client.setInterval(() => { - endpoint.post(); - }, 9000), - }); - endpoint.post(); - } else { - const entry = this.client.user._typing.get(this.id); - entry.count = count || entry.count + 1; - } - } - - /** - * Stops the typing indicator in the channel. - * The indicator will only stop if this is called as many times as startTyping(). - * It can take a few seconds for the client user to stop typing. - * @param {boolean} [force=false] Whether or not to reset the call count and force the indicator to stop - * @example - * // Stop typing in a channel - * channel.stopTyping(); - * @example - * // Force typing to fully stop in a channel - * channel.stopTyping(true); - */ - stopTyping(force = false) { - if (this.client.user._typing.has(this.id)) { - const entry = this.client.user._typing.get(this.id); - entry.count--; - if (entry.count <= 0 || force) { - this.client.clearInterval(entry.interval); - this.client.user._typing.delete(this.id); - } - } - } - - /** - * Whether or not the typing indicator is being shown in the channel - * @type {boolean} - * @readonly - */ - get typing() { - return this.client.user._typing.has(this.id); - } - - /** - * Number of times `startTyping` has been called - * @type {number} - * @readonly - */ - get typingCount() { - if (this.client.user._typing.has(this.id)) return this.client.user._typing.get(this.id).count; - return 0; - } - - /** - * Creates a Message Collector. - * @param {CollectorFilter} filter The filter to create the collector with - * @param {MessageCollectorOptions} [options={}] The options to pass to the collector - * @returns {MessageCollector} - * @example - * // Create a message collector - * const collector = channel.createMessageCollector( - * m => m.content.includes('discord'), - * { time: 15000 } - * ); - * collector.on('collect', m => console.log(`Collected ${m.content}`)); - * collector.on('end', collected => console.log(`Collected ${collected.size} items`)); - */ - createMessageCollector(filter, options = {}) { - return new MessageCollector(this, filter, options); - } - - /** - * An object containing the same properties as CollectorOptions, but a few more: - * @typedef {MessageCollectorOptions} AwaitMessagesOptions - * @property {string[]} [errors] Stop/end reasons that cause the promise to reject - */ - - /** - * Similar to createMessageCollector but in promise form. - * Resolves with a collection of messages that pass the specified filter. - * @param {CollectorFilter} filter The filter function to use - * @param {AwaitMessagesOptions} [options={}] Optional options to pass to the internal collector - * @returns {Promise>} - * @example - * // Await !vote messages - * const filter = m => m.content.startsWith('!vote'); - * // Errors: ['time'] treats ending because of the time limit as an error - * channel.awaitMessages(filter, { max: 4, time: 60000, errors: ['time'] }) - * .then(collected => console.log(collected.size)) - * .catch(collected => console.log(`After a minute, only ${collected.size} out of 4 voted.`)); - */ - awaitMessages(filter, options = {}) { - return new Promise((resolve, reject) => { - const collector = this.createMessageCollector(filter, options); - collector.once('end', (collection, reason) => { - if (options.errors && options.errors.includes(reason)) { - reject(collection); - } else { - resolve(collection); - } - }); - }); - } - - /** - * Bulk delete given messages that are newer than two weeks. - * This is only available when using a bot account. - * @param {Collection|Message[]|number} messages Messages or number of messages to delete - * @param {boolean} [filterOld=false] Filter messages to remove those which are older than two weeks automatically - * @returns {Promise>} Deleted messages - */ - bulkDelete(messages, filterOld = false) { - if (!isNaN(messages)) { - return this.messages.fetch({ limit: messages }).then(msgs => this.bulkDelete(msgs, filterOld)); - } - if (messages instanceof Array || messages instanceof Collection) { - let messageIDs = messages instanceof Collection ? messages.keyArray() : messages.map(m => m.id); - if (filterOld) { - messageIDs = messageIDs.filter(id => - Date.now() - Snowflake.deconstruct(id).date.getTime() < 1209600000 - ); - } - return this.client.api.channels[this.id].messages['bulk-delete'] - .post({ data: { messages: messageIDs } }) - .then(() => - this.client.actions.MessageDeleteBulk.handle({ - channel_id: this.id, - ids: messageIDs, - }).messages - ); - } - throw new TypeError('MESSAGE_BULK_DELETE_TYPE'); - } - - /** - * Marks all messages in this channel as read. - * This is only available when using a user account. - * @returns {Promise} - */ - acknowledge() { - if (!this.lastMessageID) return Promise.resolve(this); - return this.client.api.channels[this.id].messages[this.lastMessageID].ack - .post({ data: { token: this.client.rest._ackToken } }) - .then(res => { - if (res.token) this.client.rest._ackToken = res.token; - return this; - }); - } - - static applyToClass(structure, full = false, ignore = []) { - const props = ['send']; - if (full) { - props.push( - 'acknowledge', - 'search', - 'bulkDelete', - 'startTyping', - 'stopTyping', - 'typing', - 'typingCount', - 'createMessageCollector', - 'awaitMessages' - ); - } - for (const prop of props) { - if (ignore.includes(prop)) continue; - Object.defineProperty(structure.prototype, prop, - Object.getOwnPropertyDescriptor(TextBasedChannel.prototype, prop)); - } - } -} - -module.exports = TextBasedChannel; - -/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5).Buffer)) - -/***/ }), -/* 27 */ -/***/ (function(module, exports) { - -/** - * Represents an attachment in a message. - * @param {BufferResolvable|Stream} file The file - * @param {string} [name] The name of the file, if any - */ -class MessageAttachment { - constructor(file, name, data) { - this.file = null; - if (data) this._patch(data); - if (name) this.setAttachment(file, name); - else this._attach(file); - } - - /** - * The name of the file - * @type {?string} - * @readonly - */ - get name() { - return this.file.name; - } - - /** - * The file - * @type {?BufferResolvable|Stream} - * @readonly - */ - get attachment() { - return this.file.attachment; - } - - /** - * Set the file of this attachment. - * @param {BufferResolvable|Stream} file The file - * @param {string} name The name of the file - * @returns {MessageAttachment} This attachment - */ - setAttachment(file, name) { - this.file = { attachment: file, name }; - return this; - } - - /** - * Set the file of this attachment. - * @param {BufferResolvable|Stream} attachment The file - * @returns {MessageAttachment} This attachment - */ - setFile(attachment) { - this.file = { attachment }; - return this; - } - - /** - * Set the name of this attachment. - * @param {string} name The name of the image - * @returns {MessageAttachment} This attachment - */ - setName(name) { - this.file.name = name; - return this; - } - - /** - * Set the file of this attachment. - * @param {BufferResolvable|Stream} file The file - * @param {string} name The name of the file - * @private - */ - _attach(file, name) { - if (typeof file === 'string') this.file = file; - else this.setAttachment(file, name); - } - - _patch(data) { - /** - * The ID of this attachment - * @type {Snowflake} - */ - this.id = data.id; - - /** - * The size of this attachment in bytes - * @type {number} - */ - this.size = data.size; - - /** - * The URL to this attachment - * @type {string} - */ - this.url = data.url; - - /** - * The Proxy URL to this attachment - * @type {string} - */ - this.proxyURL = data.proxy_url; - - /** - * The height of this attachment (if an image) - * @type {?number} - */ - this.height = data.height; - - /** - * The width of this attachment (if an image) - * @type {?number} - */ - this.width = data.width; - } -} - -module.exports = MessageAttachment; - - -/***/ }), -/* 28 */ -/***/ (function(module, exports, __webpack_require__) { - -const Channel = __webpack_require__(15); -const Role = __webpack_require__(18); -const Invite = __webpack_require__(35); -const PermissionOverwrites = __webpack_require__(69); +const Channel = __webpack_require__(17); +const Role = __webpack_require__(27); +const Invite = __webpack_require__(34); +const PermissionOverwrites = __webpack_require__(71); const Permissions = __webpack_require__(12); const Collection = __webpack_require__(3); const Constants = __webpack_require__(0); @@ -7433,7 +5823,7 @@ class GuildChannel extends Channel { * @returns {?Permissions} */ permissionsFor(member) { - member = this.client.resolver.resolveGuildMember(this.guild, member); + member = this.guild.members.resolve(member); if (!member) return null; if (member.id === this.guild.ownerID) return new Permissions(Permissions.ALL); @@ -7468,7 +5858,7 @@ class GuildChannel extends Channel { } overwritesFor(member, verified = false, roles = null) { - if (!verified) member = this.client.resolver.resolveGuildMember(this.guild, member); + if (!verified) member = this.guild.members.resolve(member); if (!member) return []; roles = roles || member.roles; @@ -7525,13 +5915,13 @@ class GuildChannel extends Channel { deny: 0, }; - if (userOrRole instanceof Role) { - payload.type = 'role'; - } else if (this.guild.roles.has(userOrRole)) { - userOrRole = this.guild.roles.get(userOrRole); + const role = this.guild.roles.get(userOrRole); + + if (role || userOrRole instanceof Role) { + userOrRole = role || userOrRole; payload.type = 'role'; } else { - userOrRole = this.client.resolver.resolveUser(userOrRole); + userOrRole = this.client.users.resolve(userOrRole); payload.type = 'member'; if (!userOrRole) return Promise.reject(new TypeError('INVALID_TYPE', 'parameter', 'User nor a Role', true)); } @@ -7794,29 +6184,2158 @@ class GuildChannel extends Channel { module.exports = GuildChannel; +/***/ }), +/* 22 */ +/***/ (function(module, exports, __webpack_require__) { + +/* WEBPACK VAR INJECTION */(function(Buffer) {const path = __webpack_require__(25); +const Util = __webpack_require__(7); +const DataResolver = __webpack_require__(13); +const Embed = __webpack_require__(20); +const MessageAttachment = __webpack_require__(28); +const MessageEmbed = __webpack_require__(20); + +/** + * Represents a webhook. + */ +class Webhook { + constructor(client, data) { + /** + * The client that instantiated the webhook + * @name Webhook#client + * @type {Client} + * @readonly + */ + Object.defineProperty(this, 'client', { value: client }); + if (data) this._patch(data); + } + + _patch(data) { + /** + * The name of the webhook + * @type {string} + */ + this.name = data.name; + + /** + * The token for the webhook + * @type {string} + */ + this.token = data.token; + + /** + * The avatar for the webhook + * @type {?string} + */ + this.avatar = data.avatar; + + /** + * The ID of the webhook + * @type {Snowflake} + */ + this.id = data.id; + + /** + * The guild the webhook belongs to + * @type {Snowflake} + */ + this.guildID = data.guild_id; + + /** + * The channel the webhook belongs to + * @type {Snowflake} + */ + this.channelID = data.channel_id; + + if (data.user) { + /** + * The owner of the webhook + * @type {?User|Object} + */ + this.owner = this.client.users ? this.client.users.get(data.user.id) : data.user; + } else { + this.owner = null; + } + } + + /** + * Options that can be passed into send. + * @typedef {Object} WebhookMessageOptions + * @property {string} [username=this.name] Username override for the message + * @property {string} [avatarURL] Avatar URL override for the message + * @property {boolean} [tts=false] Whether or not the message should be spoken aloud + * @property {string} [nonce=''] The nonce for the message + * @property {Object[]} [embeds] An array of embeds for the message + * (see [here](https://discordapp.com/developers/docs/resources/channel#embed-object) for more details) + * @property {boolean} [disableEveryone=this.client.options.disableEveryone] Whether or not @everyone and @here + * should be replaced with plain-text + * @property {FileOptions|BufferResolvable} [file] A file to send with the message + * @property {FileOptions[]|string[]} [files] Files to send with the message + * @property {string|boolean} [code] Language for optional codeblock formatting to apply + * @property {boolean|SplitOptions} [split=false] Whether or not the message should be split into multiple messages if + * it exceeds the character limit. If an object is provided, these are the options for splitting the message. + */ + + /* eslint-disable max-len */ + /** + * Send a message with this webhook. + * @param {StringResolvable} [content] The content to send + * @param {WebhookMessageOptions|MessageEmbed|MessageAttachment|MessageAttachment[]} [options={}] The options to provide + * @returns {Promise} + * @example + * // Send a message + * webhook.send('hello!') + * .then(message => console.log(`Sent message: ${message.content}`)) + * .catch(console.error); + */ + /* eslint-enable max-len */ + send(content, options) { // eslint-disable-line complexity + if (!options && typeof content === 'object' && !(content instanceof Array)) { + options = content; + content = ''; + } else if (!options) { + options = {}; + } + + if (options instanceof MessageAttachment) options = { files: [options.file] }; + if (options instanceof MessageEmbed) options = { embeds: [options] }; + if (options.embed) options = { embeds: [options.embed] }; + + if (content instanceof Array || options instanceof Array) { + const which = content instanceof Array ? content : options; + const attachments = which.filter(item => item instanceof MessageAttachment); + const embeds = which.filter(item => item instanceof MessageEmbed); + if (attachments.length) options = { files: attachments }; + if (embeds.length) options = { embeds }; + if ((embeds.length || attachments.length) && content instanceof Array) content = ''; + } + + if (!options.username) options.username = this.name; + if (options.avatarURL) { + options.avatar_url = options.avatarURL; + options.avatarURL = null; + } + + if (content) { + content = Util.resolveString(content); + let { split, code, disableEveryone } = options; + if (split && typeof split !== 'object') split = {}; + if (typeof code !== 'undefined' && (typeof code !== 'boolean' || code === true)) { + content = Util.escapeMarkdown(content, true); + content = `\`\`\`${typeof code !== 'boolean' ? code || '' : ''}\n${content}\n\`\`\``; + if (split) { + split.prepend = `\`\`\`${typeof code !== 'boolean' ? code || '' : ''}\n`; + split.append = '\n```'; + } + } + if (disableEveryone || (typeof disableEveryone === 'undefined' && this.client.options.disableEveryone)) { + content = content.replace(/@(everyone|here)/g, '@\u200b$1'); + } + + if (split) content = Util.splitMessage(content, split); + } + options.content = content; + + if (options.embeds) options.embeds = options.embeds.map(embed => new Embed(embed)._apiTransform()); + + if (options.files) { + for (let i = 0; i < options.files.length; i++) { + let file = options.files[i]; + if (typeof file === 'string' || Buffer.isBuffer(file)) file = { attachment: file }; + if (!file.name) { + if (typeof file.attachment === 'string') { + file.name = path.basename(file.attachment); + } else if (file.attachment && file.attachment.path) { + file.name = path.basename(file.attachment.path); + } else if (file instanceof MessageAttachment) { + file = { attachment: file.file, name: path.basename(file.file) || 'file.jpg' }; + } else { + file.name = 'file.jpg'; + } + } else if (file instanceof MessageAttachment) { + file = file.file; + } + options.files[i] = file; + } + + return Promise.all(options.files.map(file => + DataResolver.resolveFile(file.attachment, this.client.browser).then(resource => { + file.file = resource; + return file; + }) + )).then(files => this.client.api.webhooks(this.id, this.token).post({ + data: options, + query: { wait: true }, + files, + auth: false, + })); + } + + if (content instanceof Array) { + return new Promise((resolve, reject) => { + const messages = []; + (function sendChunk() { + const opt = content.length ? null : { embeds: options.embeds, files: options.files }; + this.client.api.webhooks(this.id, this.token).post({ + data: { content: content.shift(), opt }, + query: { wait: true }, + auth: false, + }) + .then(message => { + messages.push(message); + if (content.length === 0) return resolve(messages); + return sendChunk.call(this); + }) + .catch(reject); + }.call(this)); + }); + } + + return this.client.api.webhooks(this.id, this.token).post({ + data: options, + query: { wait: true }, + auth: false, + }).then(data => { + if (!this.client.channels) return data; + return this.client.channels.get(data.channel_id).messages.create(data, false); + }); + } + + /** + * Send a raw slack message with this webhook. + * @param {Object} body The raw body to send + * @returns {Promise} + * @example + * // Send a slack message + * webhook.sendSlackMessage({ + * 'username': 'Wumpus', + * 'attachments': [{ + * 'pretext': 'this looks pretty cool', + * 'color': '#F0F', + * 'footer_icon': 'http://snek.s3.amazonaws.com/topSnek.png', + * 'footer': 'Powered by sneks', + * 'ts': Date.now() / 1000 + * }] + * }).catch(console.error); + */ + sendSlackMessage(body) { + return this.client.api.webhooks(this.id, this.token).slack.post({ + query: { wait: true }, + auth: false, + data: body, + }).then(data => { + if (!this.client.channels) return data; + return this.client.channels.get(data.channel_id).messages.create(data, false); + }); + } + + /** + * Edit the webhook. + * @param {Object} options Options + * @param {string} [options.name=this.name] New name for this webhook + * @param {BufferResolvable} [options.avatar] New avatar for this webhook + * @param {string} [reason] Reason for editing this webhook + * @returns {Promise} + */ + edit({ name = this.name, avatar }, reason) { + if (avatar && (typeof avatar === 'string' && !avatar.startsWith('data:'))) { + return DataResolver.resolveImage(avatar, this.client.browser).then(image => + this.edit({ name, avatar: image }, reason) + ); + } + return this.client.api.webhooks(this.id, this.token).patch({ + data: { name, avatar }, + reason, + }).then(data => { + this.name = data.name; + this.avatar = data.avatar; + return this; + }); + } + + /** + * Delete the webhook. + * @param {string} [reason] Reason for deleting this webhook + * @returns {Promise} + */ + delete(reason) { + return this.client.api.webhooks(this.id, this.token).delete({ reason }); + } + + static applyToClass(structure) { + for (const prop of [ + 'send', + 'sendSlackMessage', + 'edit', + 'delete', + ]) { + Object.defineProperty(structure.prototype, prop, + Object.getOwnPropertyDescriptor(Webhook.prototype, prop)); + } + } +} + +module.exports = Webhook; + +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5).Buffer)) + +/***/ }), +/* 23 */ +/***/ (function(module, exports, __webpack_require__) { + +exports = module.exports = __webpack_require__(49); +exports.Stream = exports; +exports.Readable = exports; +exports.Writable = __webpack_require__(39); +exports.Duplex = __webpack_require__(16); +exports.Transform = __webpack_require__(53); +exports.PassThrough = __webpack_require__(89); + + +/***/ }), +/* 24 */ +/***/ (function(module, exports, __webpack_require__) { + +/* WEBPACK VAR INJECTION */(function(Buffer) {// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +// NOTE: These type checking functions intentionally don't use `instanceof` +// because it is fragile and can be easily faked with `Object.create()`. + +function isArray(arg) { + if (Array.isArray) { + return Array.isArray(arg); + } + return objectToString(arg) === '[object Array]'; +} +exports.isArray = isArray; + +function isBoolean(arg) { + return typeof arg === 'boolean'; +} +exports.isBoolean = isBoolean; + +function isNull(arg) { + return arg === null; +} +exports.isNull = isNull; + +function isNullOrUndefined(arg) { + return arg == null; +} +exports.isNullOrUndefined = isNullOrUndefined; + +function isNumber(arg) { + return typeof arg === 'number'; +} +exports.isNumber = isNumber; + +function isString(arg) { + return typeof arg === 'string'; +} +exports.isString = isString; + +function isSymbol(arg) { + return typeof arg === 'symbol'; +} +exports.isSymbol = isSymbol; + +function isUndefined(arg) { + return arg === void 0; +} +exports.isUndefined = isUndefined; + +function isRegExp(re) { + return objectToString(re) === '[object RegExp]'; +} +exports.isRegExp = isRegExp; + +function isObject(arg) { + return typeof arg === 'object' && arg !== null; +} +exports.isObject = isObject; + +function isDate(d) { + return objectToString(d) === '[object Date]'; +} +exports.isDate = isDate; + +function isError(e) { + return (objectToString(e) === '[object Error]' || e instanceof Error); +} +exports.isError = isError; + +function isFunction(arg) { + return typeof arg === 'function'; +} +exports.isFunction = isFunction; + +function isPrimitive(arg) { + return arg === null || + typeof arg === 'boolean' || + typeof arg === 'number' || + typeof arg === 'string' || + typeof arg === 'symbol' || // ES6 symbol + typeof arg === 'undefined'; +} +exports.isPrimitive = isPrimitive; + +exports.isBuffer = Buffer.isBuffer; + +function objectToString(o) { + return Object.prototype.toString.call(o); +} + +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5).Buffer)) + +/***/ }), +/* 25 */ +/***/ (function(module, exports, __webpack_require__) { + +/* WEBPACK VAR INJECTION */(function(process) {// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +// resolves . and .. elements in a path array with directory names there +// must be no slashes, empty elements, or device names (c:\) in the array +// (so also no leading and trailing slashes - it does not distinguish +// relative and absolute paths) +function normalizeArray(parts, allowAboveRoot) { + // if the path tries to go above the root, `up` ends up > 0 + var up = 0; + for (var i = parts.length - 1; i >= 0; i--) { + var last = parts[i]; + if (last === '.') { + parts.splice(i, 1); + } else if (last === '..') { + parts.splice(i, 1); + up++; + } else if (up) { + parts.splice(i, 1); + up--; + } + } + + // if the path is allowed to go above the root, restore leading ..s + if (allowAboveRoot) { + for (; up--; up) { + parts.unshift('..'); + } + } + + return parts; +} + +// Split a filename into [root, dir, basename, ext], unix version +// 'root' is just a slash, or nothing. +var splitPathRe = + /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/; +var splitPath = function(filename) { + return splitPathRe.exec(filename).slice(1); +}; + +// path.resolve([from ...], to) +// posix version +exports.resolve = function() { + var resolvedPath = '', + resolvedAbsolute = false; + + for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) { + var path = (i >= 0) ? arguments[i] : process.cwd(); + + // Skip empty and invalid entries + if (typeof path !== 'string') { + throw new TypeError('Arguments to path.resolve must be strings'); + } else if (!path) { + continue; + } + + resolvedPath = path + '/' + resolvedPath; + resolvedAbsolute = path.charAt(0) === '/'; + } + + // At this point the path should be resolved to a full absolute path, but + // handle relative paths to be safe (might happen when process.cwd() fails) + + // Normalize the path + resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) { + return !!p; + }), !resolvedAbsolute).join('/'); + + return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.'; +}; + +// path.normalize(path) +// posix version +exports.normalize = function(path) { + var isAbsolute = exports.isAbsolute(path), + trailingSlash = substr(path, -1) === '/'; + + // Normalize the path + path = normalizeArray(filter(path.split('/'), function(p) { + return !!p; + }), !isAbsolute).join('/'); + + if (!path && !isAbsolute) { + path = '.'; + } + if (path && trailingSlash) { + path += '/'; + } + + return (isAbsolute ? '/' : '') + path; +}; + +// posix version +exports.isAbsolute = function(path) { + return path.charAt(0) === '/'; +}; + +// posix version +exports.join = function() { + var paths = Array.prototype.slice.call(arguments, 0); + return exports.normalize(filter(paths, function(p, index) { + if (typeof p !== 'string') { + throw new TypeError('Arguments to path.join must be strings'); + } + return p; + }).join('/')); +}; + + +// path.relative(from, to) +// posix version +exports.relative = function(from, to) { + from = exports.resolve(from).substr(1); + to = exports.resolve(to).substr(1); + + function trim(arr) { + var start = 0; + for (; start < arr.length; start++) { + if (arr[start] !== '') break; + } + + var end = arr.length - 1; + for (; end >= 0; end--) { + if (arr[end] !== '') break; + } + + if (start > end) return []; + return arr.slice(start, end - start + 1); + } + + var fromParts = trim(from.split('/')); + var toParts = trim(to.split('/')); + + var length = Math.min(fromParts.length, toParts.length); + var samePartsLength = length; + for (var i = 0; i < length; i++) { + if (fromParts[i] !== toParts[i]) { + samePartsLength = i; + break; + } + } + + var outputParts = []; + for (var i = samePartsLength; i < fromParts.length; i++) { + outputParts.push('..'); + } + + outputParts = outputParts.concat(toParts.slice(samePartsLength)); + + return outputParts.join('/'); +}; + +exports.sep = '/'; +exports.delimiter = ':'; + +exports.dirname = function(path) { + var result = splitPath(path), + root = result[0], + dir = result[1]; + + if (!root && !dir) { + // No dirname whatsoever + return '.'; + } + + if (dir) { + // It has a dirname, strip trailing slash + dir = dir.substr(0, dir.length - 1); + } + + return root + dir; +}; + + +exports.basename = function(path, ext) { + var f = splitPath(path)[2]; + // TODO: make this comparison case-insensitive on windows? + if (ext && f.substr(-1 * ext.length) === ext) { + f = f.substr(0, f.length - ext.length); + } + return f; +}; + + +exports.extname = function(path) { + return splitPath(path)[3]; +}; + +function filter (xs, f) { + if (xs.filter) return xs.filter(f); + var res = []; + for (var i = 0; i < xs.length; i++) { + if (f(xs[i], i, xs)) res.push(xs[i]); + } + return res; +} + +// String.prototype.substr - negative index don't work in IE8 +var substr = 'ab'.substr(-1) === 'b' + ? function (str, start, len) { return str.substr(start, len) } + : function (str, start, len) { + if (start < 0) start = str.length + start; + return str.substr(start, len); + } +; + +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(8))) + +/***/ }), +/* 26 */ +/***/ (function(module, exports, __webpack_require__) { + +/* WEBPACK VAR INJECTION */(function(Buffer) {const path = __webpack_require__(25); +const MessageCollector = __webpack_require__(63); +const Shared = __webpack_require__(64); +const Snowflake = __webpack_require__(9); +const Collection = __webpack_require__(3); +const DataResolver = __webpack_require__(13); +const MessageAttachment = __webpack_require__(28); +const MessageEmbed = __webpack_require__(20); +const { RangeError, TypeError } = __webpack_require__(4); + +/** + * Interface for classes that have text-channel-like features. + * @interface + */ +class TextBasedChannel { + constructor() { + /** + * A collection containing the messages sent to this channel + * @type {MessageStore} + */ + this.messages = new MessageStore(this); + + /** + * The ID of the last message in the channel, if one was sent + * @type {?Snowflake} + */ + this.lastMessageID = null; + + /** + * The Message object of the last message in the channel, if one was sent + * @type {?Message} + */ + this.lastMessage = null; + } + + /** + * Options provided when sending or editing a message. + * @typedef {Object} MessageOptions + * @property {boolean} [tts=false] Whether or not the message should be spoken aloud + * @property {string} [nonce=''] The nonce for the message + * @property {string} [content=''] The content for the message + * @property {MessageEmbed|Object} [embed] An embed for the message + * (see [here](https://discordapp.com/developers/docs/resources/channel#embed-object) for more details) + * @property {boolean} [disableEveryone=this.client.options.disableEveryone] Whether or not @everyone and @here + * should be replaced with plain-text + * @property {FileOptions[]|BufferResolvable[]} [files] Files to send with the message + * @property {string|boolean} [code] Language for optional codeblock formatting to apply + * @property {boolean|SplitOptions} [split=false] Whether or not the message should be split into multiple messages if + * it exceeds the character limit. If an object is provided, these are the options for splitting the message + * @property {UserResolvable} [reply] User to reply to (prefixes the message with a mention, except in DMs) + */ + + /** + * @typedef {Object} FileOptions + * @property {BufferResolvable} attachment File to attach + * @property {string} [name='file.jpg'] Filename of the attachment + */ + + /** + * Options for splitting a message. + * @typedef {Object} SplitOptions + * @property {number} [maxLength=1950] Maximum character length per message piece + * @property {string} [char='\n'] Character to split the message with + * @property {string} [prepend=''] Text to prepend to every piece except the first + * @property {string} [append=''] Text to append to every piece except the last + */ + + /** + * Send a message to this channel. + * @param {StringResolvable} [content] Text for the message + * @param {MessageOptions|MessageEmbed|MessageAttachment|MessageAttachment[]} [options={}] Options for the message + * @returns {Promise} + * @example + * // Send a message + * channel.send('hello!') + * .then(message => console.log(`Sent message: ${message.content}`)) + * .catch(console.error); + */ + send(content, options) { // eslint-disable-line complexity + if (!options && typeof content === 'object' && !(content instanceof Array)) { + options = content; + content = ''; + } else if (!options) { + options = {}; + } + + if (options instanceof MessageEmbed) options = { embed: options }; + if (options instanceof MessageAttachment) options = { files: [options.file] }; + + if (content instanceof Array || options instanceof Array) { + const which = content instanceof Array ? content : options; + const attachments = which.filter(item => item instanceof MessageAttachment); + if (attachments.length) { + options = { files: attachments }; + if (content instanceof Array) content = ''; + } + } + + if (!options.content) options.content = content; + + if (options.embed && options.embed.files) { + if (options.files) options.files = options.files.concat(options.embed.files); + else options.files = options.embed.files; + } + + if (options.files) { + for (let i = 0; i < options.files.length; i++) { + let file = options.files[i]; + if (typeof file === 'string' || Buffer.isBuffer(file)) file = { attachment: file }; + if (!file.name) { + if (typeof file.attachment === 'string') { + file.name = path.basename(file.attachment); + } else if (file.attachment && file.attachment.path) { + file.name = path.basename(file.attachment.path); + } else if (file instanceof MessageAttachment) { + file = { attachment: file.file, name: path.basename(file.file) || 'file.jpg' }; + } else { + file.name = 'file.jpg'; + } + } else if (file instanceof MessageAttachment) { + file = file.file; + } + options.files[i] = file; + } + + return Promise.all(options.files.map(file => + DataResolver.resolveFile(file.attachment, this.client.browser).then(resource => { + file.file = resource; + return file; + }) + )).then(files => { + options.files = files; + return Shared.sendMessage(this, options); + }); + } + + return Shared.sendMessage(this, options); + } + + /** + * Performs a search within the channel. + * This is only available when using a user account. + * @param {MessageSearchOptions} [options={}] Options to pass to the search + * @returns {Promise} + * @example + * channel.search({ + * content: 'discord.js', + * before: '2016-11-17' + * }).then(res => { + * const hit = res.results[0].find(m => m.hit).content; + * console.log(`I found: **${hit}**, total results: ${res.total}`); + * }).catch(console.error); + */ + search(options = {}) { + return Shared.search(this, options); + } + + /** + * Starts a typing indicator in the channel. + * @param {number} [count] The number of times startTyping should be considered to have been called + * @example + * // Start typing in a channel + * channel.startTyping(); + */ + startTyping(count) { + if (typeof count !== 'undefined' && count < 1) throw new RangeError('TYPING_COUNT'); + if (!this.client.user._typing.has(this.id)) { + const endpoint = this.client.api.channels[this.id].typing; + this.client.user._typing.set(this.id, { + count: count || 1, + interval: this.client.setInterval(() => { + endpoint.post(); + }, 9000), + }); + endpoint.post(); + } else { + const entry = this.client.user._typing.get(this.id); + entry.count = count || entry.count + 1; + } + } + + /** + * Stops the typing indicator in the channel. + * The indicator will only stop if this is called as many times as startTyping(). + * It can take a few seconds for the client user to stop typing. + * @param {boolean} [force=false] Whether or not to reset the call count and force the indicator to stop + * @example + * // Stop typing in a channel + * channel.stopTyping(); + * @example + * // Force typing to fully stop in a channel + * channel.stopTyping(true); + */ + stopTyping(force = false) { + if (this.client.user._typing.has(this.id)) { + const entry = this.client.user._typing.get(this.id); + entry.count--; + if (entry.count <= 0 || force) { + this.client.clearInterval(entry.interval); + this.client.user._typing.delete(this.id); + } + } + } + + /** + * Whether or not the typing indicator is being shown in the channel + * @type {boolean} + * @readonly + */ + get typing() { + return this.client.user._typing.has(this.id); + } + + /** + * Number of times `startTyping` has been called + * @type {number} + * @readonly + */ + get typingCount() { + if (this.client.user._typing.has(this.id)) return this.client.user._typing.get(this.id).count; + return 0; + } + + /** + * Creates a Message Collector. + * @param {CollectorFilter} filter The filter to create the collector with + * @param {MessageCollectorOptions} [options={}] The options to pass to the collector + * @returns {MessageCollector} + * @example + * // Create a message collector + * const collector = channel.createMessageCollector( + * m => m.content.includes('discord'), + * { time: 15000 } + * ); + * collector.on('collect', m => console.log(`Collected ${m.content}`)); + * collector.on('end', collected => console.log(`Collected ${collected.size} items`)); + */ + createMessageCollector(filter, options = {}) { + return new MessageCollector(this, filter, options); + } + + /** + * An object containing the same properties as CollectorOptions, but a few more: + * @typedef {MessageCollectorOptions} AwaitMessagesOptions + * @property {string[]} [errors] Stop/end reasons that cause the promise to reject + */ + + /** + * Similar to createMessageCollector but in promise form. + * Resolves with a collection of messages that pass the specified filter. + * @param {CollectorFilter} filter The filter function to use + * @param {AwaitMessagesOptions} [options={}] Optional options to pass to the internal collector + * @returns {Promise>} + * @example + * // Await !vote messages + * const filter = m => m.content.startsWith('!vote'); + * // Errors: ['time'] treats ending because of the time limit as an error + * channel.awaitMessages(filter, { max: 4, time: 60000, errors: ['time'] }) + * .then(collected => console.log(collected.size)) + * .catch(collected => console.log(`After a minute, only ${collected.size} out of 4 voted.`)); + */ + awaitMessages(filter, options = {}) { + return new Promise((resolve, reject) => { + const collector = this.createMessageCollector(filter, options); + collector.once('end', (collection, reason) => { + if (options.errors && options.errors.includes(reason)) { + reject(collection); + } else { + resolve(collection); + } + }); + }); + } + + /** + * Bulk delete given messages that are newer than two weeks. + * This is only available when using a bot account. + * @param {Collection|Message[]|number} messages Messages or number of messages to delete + * @param {boolean} [filterOld=false] Filter messages to remove those which are older than two weeks automatically + * @returns {Promise>} Deleted messages + */ + bulkDelete(messages, filterOld = false) { + if (!isNaN(messages)) { + return this.messages.fetch({ limit: messages }).then(msgs => this.bulkDelete(msgs, filterOld)); + } + if (messages instanceof Array || messages instanceof Collection) { + let messageIDs = messages instanceof Collection ? messages.keyArray() : messages.map(m => m.id); + if (filterOld) { + messageIDs = messageIDs.filter(id => + Date.now() - Snowflake.deconstruct(id).date.getTime() < 1209600000 + ); + } + return this.client.api.channels[this.id].messages['bulk-delete'] + .post({ data: { messages: messageIDs } }) + .then(() => + this.client.actions.MessageDeleteBulk.handle({ + channel_id: this.id, + ids: messageIDs, + }).messages + ); + } + throw new TypeError('MESSAGE_BULK_DELETE_TYPE'); + } + + /** + * Marks all messages in this channel as read. + * This is only available when using a user account. + * @returns {Promise} + */ + acknowledge() { + if (!this.lastMessageID) return Promise.resolve(this); + return this.client.api.channels[this.id].messages[this.lastMessageID].ack + .post({ data: { token: this.client.rest._ackToken } }) + .then(res => { + if (res.token) this.client.rest._ackToken = res.token; + return this; + }); + } + + static applyToClass(structure, full = false, ignore = []) { + const props = ['send']; + if (full) { + props.push( + 'acknowledge', + 'search', + 'bulkDelete', + 'startTyping', + 'stopTyping', + 'typing', + 'typingCount', + 'createMessageCollector', + 'awaitMessages' + ); + } + for (const prop of props) { + if (ignore.includes(prop)) continue; + Object.defineProperty(structure.prototype, prop, + Object.getOwnPropertyDescriptor(TextBasedChannel.prototype, prop)); + } + } +} + +module.exports = TextBasedChannel; + +// Fixes Circular +const MessageStore = __webpack_require__(33); + +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5).Buffer)) + +/***/ }), +/* 27 */ +/***/ (function(module, exports, __webpack_require__) { + +const Snowflake = __webpack_require__(9); +const Permissions = __webpack_require__(12); +const Util = __webpack_require__(7); +const Base = __webpack_require__(10); +const { TypeError } = __webpack_require__(4); + +/** + * Represents a role on Discord. + * @extends {Base} + */ +class Role extends Base { + constructor(client, data, guild) { + super(client); + + /** + * The guild that the role belongs to + * @type {Guild} + */ + this.guild = guild; + + if (data) this._patch(data); + } + + _patch(data) { + /** + * The ID of the role (unique to the guild it is part of) + * @type {Snowflake} + */ + this.id = data.id; + + /** + * The name of the role + * @type {string} + */ + this.name = data.name; + + /** + * The base 10 color of the role + * @type {number} + */ + this.color = data.color; + + /** + * If true, users that are part of this role will appear in a separate category in the users list + * @type {boolean} + */ + this.hoist = data.hoist; + + /** + * The position of the role from the API + * @type {number} + */ + this.position = data.position; + + /** + * The permissions bitfield of the role + * @type {number} + */ + this.permissions = data.permissions; + + /** + * Whether or not the role is managed by an external service + * @type {boolean} + */ + this.managed = data.managed; + + /** + * Whether or not the role can be mentioned by anyone + * @type {boolean} + */ + this.mentionable = data.mentionable; + } + + /** + * The timestamp the role was created at + * @type {number} + * @readonly + */ + get createdTimestamp() { + return Snowflake.deconstruct(this.id).timestamp; + } + + /** + * The time the role was created + * @type {Date} + * @readonly + */ + get createdAt() { + return new Date(this.createdTimestamp); + } + + /** + * The hexadecimal version of the role color, with a leading hashtag + * @type {string} + * @readonly + */ + get hexColor() { + let col = this.color.toString(16); + while (col.length < 6) col = `0${col}`; + return `#${col}`; + } + + /** + * The cached guild members that have this role + * @type {Collection} + * @readonly + */ + get members() { + return this.guild.members.filter(m => m.roles.has(this.id)); + } + + /** + * Whether the role is editable by the client user + * @type {boolean} + * @readonly + */ + get editable() { + if (this.managed) return false; + const clientMember = this.guild.member(this.client.user); + if (!clientMember.permissions.has(Permissions.FLAGS.MANAGE_ROLES)) return false; + return clientMember.highestRole.comparePositionTo(this) > 0; + } + + /** + * The position of the role in the role manager + * @type {number} + * @readonly + */ + get calculatedPosition() { + const sorted = this.guild._sortedRoles; + return sorted.array().indexOf(sorted.get(this.id)); + } + + /** + * Get an object mapping permission names to whether or not the role enables that permission. + * @returns {Object} + * @example + * // Print the serialized role permissions + * console.log(role.serialize()); + */ + serialize() { + return new Permissions(this.permissions).serialize(); + } + + /** + * Checks if the role has a permission. + * @param {PermissionResolvable|PermissionResolvable[]} permission Permission(s) to check for + * @param {boolean} [explicit=false] Whether to require the role to explicitly have the exact permission + * **(deprecated)** + * @param {boolean} [checkAdmin] Whether to allow the administrator permission to override + * (takes priority over `explicit`) + * @returns {boolean} + * @example + * // See if a role can ban a member + * if (role.hasPermission('BAN_MEMBERS')) { + * console.log('This role can ban members'); + * } else { + * console.log('This role can\'t ban members'); + * } + */ + hasPermission(permission, explicit = false, checkAdmin) { + return new Permissions(this.permissions).has( + permission, typeof checkAdmin !== 'undefined' ? checkAdmin : !explicit + ); + } + + /** + * Compares this role's position to another role's. + * @param {RoleResolvable} role Role to compare to this one + * @returns {number} Negative number if the this role's position is lower (other role's is higher), + * positive number if the this one is higher (other's is lower), 0 if equal + */ + comparePositionTo(role) { + role = this.guild.roles.resolve(role); + if (!role) return Promise.reject(new TypeError('INVALID_TYPE', 'role', 'Role nor a Snowflake')); + return this.constructor.comparePositions(this, role); + } + + /** + * The data for a role. + * @typedef {Object} RoleData + * @property {string} [name] The name of the role + * @property {ColorResolvable} [color] The color of the role, either a hex string or a base 10 number + * @property {boolean} [hoist] Whether or not the role should be hoisted + * @property {number} [position] The position of the role + * @property {PermissionResolvable|PermissionResolvable[]} [permissions] The permissions of the role + * @property {boolean} [mentionable] Whether or not the role should be mentionable + */ + + /** + * Edits the role. + * @param {RoleData} data The new data for the role + * @param {string} [reason] Reason for editing this role + * @returns {Promise} + * @example + * // Edit a role + * role.edit({name: 'new role'}) + * .then(r => console.log(`Edited role ${r}`)) + * .catch(console.error); + */ + edit(data, reason) { + if (data.permissions) data.permissions = Permissions.resolve(data.permissions); + else data.permissions = this.permissions; + return this.client.api.guilds[this.guild.id].roles[this.id].patch({ + data: { + name: data.name || this.name, + color: Util.resolveColor(data.color || this.color), + hoist: typeof data.hoist !== 'undefined' ? data.hoist : this.hoist, + position: typeof data.position !== 'undefined' ? data.position : this.position, + permissions: data.permissions, + mentionable: typeof data.mentionable !== 'undefined' ? data.mentionable : this.mentionable, + }, + reason, + }) + .then(role => { + const clone = this._clone(); + clone._patch(role); + return clone; + }); + } + + /** + * Set a new name for the role. + * @param {string} name The new name of the role + * @param {string} [reason] Reason for changing the role's name + * @returns {Promise} + * @example + * // Set the name of the role + * role.setName('new role') + * .then(r => console.log(`Edited name of role ${r}`)) + * .catch(console.error); + */ + setName(name, reason) { + return this.edit({ name }, reason); + } + + /** + * Set a new color for the role. + * @param {ColorResolvable} color The color of the role + * @param {string} [reason] Reason for changing the role's color + * @returns {Promise} + * @example + * // Set the color of a role + * role.setColor('#FF0000') + * .then(r => console.log(`Set color of role ${r}`)) + * .catch(console.error); + */ + setColor(color, reason) { + return this.edit({ color }, reason); + } + + /** + * Set whether or not the role should be hoisted. + * @param {boolean} hoist Whether or not to hoist the role + * @param {string} [reason] Reason for setting whether or not the role should be hoisted + * @returns {Promise} + * @example + * // Set the hoist of the role + * role.setHoist(true) + * .then(r => console.log(`Role hoisted: ${r.hoist}`)) + * .catch(console.error); + */ + setHoist(hoist, reason) { + return this.edit({ hoist }, reason); + } + + /** + * Set the position of the role. + * @param {number} position The position of the role + * @param {boolean} [relative=false] Move the position relative to its current value + * @returns {Promise} + * @example + * // Set the position of the role + * role.setPosition(1) + * .then(r => console.log(`Role position: ${r.position}`)) + * .catch(console.error); + */ + setPosition(position, relative) { + return this.guild.setRolePosition(this, position, relative).then(() => this); + } + + /** + * Set the permissions of the role. + * @param {PermissionResolvable[]} permissions The permissions of the role + * @param {string} [reason] Reason for changing the role's permissions + * @returns {Promise} + * @example + * // Set the permissions of the role + * role.setPermissions(['KICK_MEMBERS', 'BAN_MEMBERS']) + * .then(r => console.log(`Role updated ${r}`)) + * .catch(console.error); + */ + setPermissions(permissions, reason) { + return this.edit({ permissions }, reason); + } + + /** + * Set whether this role is mentionable. + * @param {boolean} mentionable Whether this role should be mentionable + * @param {string} [reason] Reason for setting whether or not this role should be mentionable + * @returns {Promise} + * @example + * // Make the role mentionable + * role.setMentionable(true) + * .then(r => console.log(`Role updated ${r}`)) + * .catch(console.error); + */ + setMentionable(mentionable, reason) { + return this.edit({ mentionable }, reason); + } + + /** + * Deletes the role. + * @param {string} [reason] Reason for deleting this role + * @returns {Promise} + * @example + * // Delete a role + * role.delete() + * .then(r => console.log(`Deleted role ${r}`)) + * .catch(console.error); + */ + delete(reason) { + return this.client.api.guilds[this.guild.id].roles[this.id].delete({ reason }) + .then(() => { + this.client.actions.GuildRoleDelete.handle({ guild_id: this.guild.id, role_id: this.id }); + return this; + }); + } + + /** + * Whether this role equals another role. It compares all properties, so for most operations + * it is advisable to just compare `role.id === role2.id` as it is much faster and is often + * what most users need. + * @param {Role} role Role to compare with + * @returns {boolean} + */ + equals(role) { + return role && + this.id === role.id && + this.name === role.name && + this.color === role.color && + this.hoist === role.hoist && + this.position === role.position && + this.permissions === role.permissions && + this.managed === role.managed; + } + + /** + * When concatenated with a string, this automatically concatenates the role mention rather than the Role object. + * @returns {string} + */ + toString() { + if (this.id === this.guild.id) return '@everyone'; + return `<@&${this.id}>`; + } + + /** + * Compares the positions of two roles. + * @param {Role} role1 First role to compare + * @param {Role} role2 Second role to compare + * @returns {number} Negative number if the first role's position is lower (second role's is higher), + * positive number if the first's is higher (second's is lower), 0 if equal + */ + static comparePositions(role1, role2) { + if (role1.position === role2.position) return role2.id - role1.id; + return role1.position - role2.position; + } +} + +module.exports = Role; + + +/***/ }), +/* 28 */ +/***/ (function(module, exports) { + +/** + * Represents an attachment in a message. + * @param {BufferResolvable|Stream} file The file + * @param {string} [name] The name of the file, if any + */ +class MessageAttachment { + constructor(file, name, data) { + this.file = null; + if (data) this._patch(data); + if (name) this.setAttachment(file, name); + else this._attach(file); + } + + /** + * The name of the file + * @type {?string} + * @readonly + */ + get name() { + return this.file.name; + } + + /** + * The file + * @type {?BufferResolvable|Stream} + * @readonly + */ + get attachment() { + return this.file.attachment; + } + + /** + * Set the file of this attachment. + * @param {BufferResolvable|Stream} file The file + * @param {string} name The name of the file + * @returns {MessageAttachment} This attachment + */ + setAttachment(file, name) { + this.file = { attachment: file, name }; + return this; + } + + /** + * Set the file of this attachment. + * @param {BufferResolvable|Stream} attachment The file + * @returns {MessageAttachment} This attachment + */ + setFile(attachment) { + this.file = { attachment }; + return this; + } + + /** + * Set the name of this attachment. + * @param {string} name The name of the image + * @returns {MessageAttachment} This attachment + */ + setName(name) { + this.file.name = name; + return this; + } + + /** + * Set the file of this attachment. + * @param {BufferResolvable|Stream} file The file + * @param {string} name The name of the file + * @private + */ + _attach(file, name) { + if (typeof file === 'string') this.file = file; + else this.setAttachment(file, name); + } + + _patch(data) { + /** + * The ID of this attachment + * @type {Snowflake} + */ + this.id = data.id; + + /** + * The size of this attachment in bytes + * @type {number} + */ + this.size = data.size; + + /** + * The URL to this attachment + * @type {string} + */ + this.url = data.url; + + /** + * The Proxy URL to this attachment + * @type {string} + */ + this.proxyURL = data.proxy_url; + + /** + * The height of this attachment (if an image) + * @type {?number} + */ + this.height = data.height; + + /** + * The width of this attachment (if an image) + * @type {?number} + */ + this.width = data.width; + } +} + +module.exports = MessageAttachment; + + /***/ }), /* 29 */ /***/ (function(module, exports, __webpack_require__) { +"use strict"; +/* WEBPACK VAR INJECTION */(function(process) { + +if (!process.version || + process.version.indexOf('v0.') === 0 || + process.version.indexOf('v1.') === 0 && process.version.indexOf('v1.8.') !== 0) { + module.exports = nextTick; +} else { + module.exports = process.nextTick; +} + +function nextTick(fn, arg1, arg2, arg3) { + if (typeof fn !== 'function') { + throw new TypeError('"callback" argument must be a function'); + } + var len = arguments.length; + var args, i; + switch (len) { + case 0: + case 1: + return process.nextTick(fn); + case 2: + return process.nextTick(function afterTickOne() { + fn.call(null, arg1); + }); + case 3: + return process.nextTick(function afterTickTwo() { + fn.call(null, arg1, arg2); + }); + case 4: + return process.nextTick(function afterTickThree() { + fn.call(null, arg1, arg2, arg3); + }); + default: + args = new Array(len - 1); + i = 0; + while (i < args.length) { + args[i++] = arguments[i]; + } + return process.nextTick(function afterTick() { + fn.apply(null, args); + }); + } +} + +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(8))) + +/***/ }), +/* 30 */ +/***/ (function(module, exports) { + + + +/***/ }), +/* 31 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +exports.decode = exports.parse = __webpack_require__(94); +exports.encode = exports.stringify = __webpack_require__(95); + + +/***/ }), +/* 32 */ +/***/ (function(module, exports, __webpack_require__) { + +const TextBasedChannel = __webpack_require__(26); +const { Presence } = __webpack_require__(19); +const UserProfile = __webpack_require__(136); +const Snowflake = __webpack_require__(9); +const Base = __webpack_require__(10); +const { Error } = __webpack_require__(4); + +/** + * Represents a user on Discord. + * @implements {TextBasedChannel} + * @extends {Base} + */ +class User extends Base { + constructor(client, data) { + super(client); + + /** + * The ID of the user + * @type {Snowflake} + */ + this.id = data.id; + + this._patch(data); + } + + _patch(data) { + /** + * The username of the user + * @type {string} + * @name User#username + */ + if (data.username) this.username = data.username; + + /** + * A discriminator based on username for the user + * @type {string} + * @name User#discriminator + */ + if (data.discriminator) this.discriminator = data.discriminator; + + /** + * The ID of the user's avatar + * @type {string} + * @name User#avatar + */ + if (typeof data.avatar !== 'undefined') this.avatar = data.avatar; + + /** + * Whether or not the user is a bot + * @type {boolean} + * @name User#bot + */ + if (typeof this.bot === 'undefined' && typeof data.bot !== 'undefined') this.bot = Boolean(data.bot); + + /** + * The ID of the last message sent by the user, if one was sent + * @type {?Snowflake} + */ + this.lastMessageID = null; + + /** + * The Message object of the last message sent by the user, if one was sent + * @type {?Message} + */ + this.lastMessage = null; + + if (data.token) this.client.token = data.token; + } + + /** + * The timestamp the user was created at + * @type {number} + * @readonly + */ + get createdTimestamp() { + return Snowflake.deconstruct(this.id).timestamp; + } + + /** + * The time the user was created + * @type {Date} + * @readonly + */ + get createdAt() { + return new Date(this.createdTimestamp); + } + + /** + * The presence of this user + * @type {Presence} + * @readonly + */ + get presence() { + if (this.client.presences.has(this.id)) return this.client.presences.get(this.id); + for (const guild of this.client.guilds.values()) { + if (guild.presences.has(this.id)) return guild.presences.get(this.id); + } + return new Presence(); + } + + /** + * A link to the user's avatar. + * @param {Object} [options={}] Options for the avatar url + * @param {string} [options.format='webp'] One of `webp`, `png`, `jpg`, `gif`. If no format is provided, + * it will be `gif` for animated avatars or otherwise `webp` + * @param {number} [options.size=128] One of `128`, `256`, `512`, `1024`, `2048` + * @returns {?string} + */ + avatarURL({ format, size } = {}) { + if (!this.avatar) return null; + return this.client.rest.cdn.Avatar(this.id, this.avatar, format, size); + } + + /** + * A link to the user's default avatar + * @type {string} + * @readonly + */ + get defaultAvatarURL() { + return this.client.rest.cdn.DefaultAvatar(this.discriminator % 5); + } + + /** + * A link to the user's avatar if they have one. + * Otherwise a link to their default avatar will be returned. + * @param {Object} [options={}] Options for the avatar url + * @param {string} [options.format='webp'] One of `webp`, `png`, `jpg`, `gif`. If no format is provided, + * it will be `gif` for animated avatars or otherwise `webp` + * @param {number} [options.size=128] One of `128`, `256`, `512`, `1024`, `2048` + * @returns {string} + */ + displayAvatarURL(options) { + return this.avatarURL(options) || this.defaultAvatarURL; + } + + /** + * The Discord "tag" for this user + * @type {string} + * @readonly + */ + get tag() { + return `${this.username}#${this.discriminator}`; + } + + /** + * The note that is set for the user + * This is only available when using a user account. + * @type {?string} + * @readonly + */ + get note() { + return this.client.user.notes.get(this.id) || null; + } + + /** + * Check whether the user is typing in a channel. + * @param {ChannelResolvable} channel The channel to check in + * @returns {boolean} + */ + typingIn(channel) { + channel = this.client.channels.resolve(channel); + return channel._typing.has(this.id); + } + + /** + * Get the time that the user started typing. + * @param {ChannelResolvable} channel The channel to get the time in + * @returns {?Date} + */ + typingSinceIn(channel) { + channel = this.client.channels.resolve(channel); + return channel._typing.has(this.id) ? new Date(channel._typing.get(this.id).since) : null; + } + + /** + * Get the amount of time the user has been typing in a channel for (in milliseconds), or -1 if they're not typing. + * @param {ChannelResolvable} channel The channel to get the time in + * @returns {number} + */ + typingDurationIn(channel) { + channel = this.client.channels.resolve(channel); + return channel._typing.has(this.id) ? channel._typing.get(this.id).elapsedTime : -1; + } + + /** + * The DM between the client's user and this user + * @type {?DMChannel} + * @readonly + */ + get dmChannel() { + return this.client.channels.filter(c => c.type === 'dm').find(c => c.recipient.id === this.id); + } + + /** + * Creates a DM channel between the client and the user. + * @returns {Promise} + */ + createDM() { + if (this.dmChannel) return Promise.resolve(this.dmChannel); + return this.client.api.users(this.client.user.id).channels.post({ data: { + recipient_id: this.id, + } }) + .then(data => this.client.actions.ChannelCreate.handle(data).channel); + } + + /** + * Deletes a DM channel (if one exists) between the client and the user. Resolves with the channel if successful. + * @returns {Promise} + */ + deleteDM() { + if (!this.dmChannel) return Promise.reject(new Error('USER_NO_DMCHANNEL')); + return this.client.api.channels(this.dmChannel.id).delete() + .then(data => this.client.actions.ChannelDelete.handle(data).channel); + } + + /** + * Get the profile of the user. + * This is only available when using a user account. + * @returns {Promise} + */ + fetchProfile() { + return this.client.api.users(this.id).profile.get().then(data => new UserProfile(this, data)); + } + + /** + * Sets a note for the user. + * This is only available when using a user account. + * @param {string} note The note to set for the user + * @returns {Promise} + */ + setNote(note) { + return this.client.api.users('@me').notes(this.id).put({ data: { note } }) + .then(() => this); + } + + /** + * Checks if the user is equal to another. It compares ID, username, discriminator, avatar, and bot flags. + * It is recommended to compare equality by using `user.id === user2.id` unless you want to compare all properties. + * @param {User} user User to compare with + * @returns {boolean} + */ + equals(user) { + let equal = user && + this.id === user.id && + this.username === user.username && + this.discriminator === user.discriminator && + this.avatar === user.avatar; + + return equal; + } + + /** + * When concatenated with a string, this automatically concatenates the user's mention instead of the User object. + * @returns {string} + * @example + * // logs: Hello from <@123456789>! + * console.log(`Hello from ${user}!`); + */ + toString() { + return `<@${this.id}>`; + } + + // These are here only for documentation purposes - they are implemented by TextBasedChannel + /* eslint-disable no-empty-function */ + send() {} +} + +TextBasedChannel.applyToClass(User); + +module.exports = User; + + +/***/ }), +/* 33 */ +/***/ (function(module, exports, __webpack_require__) { + +const DataStore = __webpack_require__(11); +const Collection = __webpack_require__(3); +const Message = __webpack_require__(44); +const { Error } = __webpack_require__(4); + +/** + * Stores messages for text-based channels. + * @extends {DataStore} + */ +class MessageStore extends DataStore { + constructor(channel, iterable) { + super(channel.client, iterable, Message); + this.channel = channel; + } + + create(data, cache) { + return super.create(data, cache, { extras: [this.channel] }); + } + + set(key, value) { + const maxSize = this.client.options.messageCacheMaxSize; + if (maxSize === 0) return; + if (this.size >= maxSize && maxSize > 0) this.delete(this.firstKey()); + super.set(key, value); + } + + /** + * The parameters to pass in when requesting previous messages from a channel. `around`, `before` and + * `after` are mutually exclusive. All the parameters are optional. + * @typedef {Object} ChannelLogsQueryOptions + * @property {number} [limit=50] Number of messages to acquire + * @property {Snowflake} [before] ID of a message to get the messages that were posted before it + * @property {Snowflake} [after] ID of a message to get the messages that were posted after it + * @property {Snowflake} [around] ID of a message to get the messages that were posted around it + */ + + /** + * Gets a message, or messages, from this channel. + * @param {Snowflake|ChannelLogsQueryOptions} [message] The ID of the message to fetch, or query parameters. + * @returns {Promise|Promise>} + * @example + * // Get message + * channel.messages.fetch('99539446449315840') + * .then(message => console.log(message.content)) + * .catch(console.error); + * @example + * // Get messages + * channel.messages.fetch({limit: 10}) + * .then(messages => console.log(`Received ${messages.size} messages`)) + * .catch(console.error); + */ + fetch(message) { + return typeof message === 'string' ? this._fetchId(message) : this._fetchMany(message); + } + + /** + * Fetches the pinned messages of this channel and returns a collection of them. + * The returned Collection does not contain the reactions of the messages. + * Those need to be fetched seperately. + * @returns {Promise>} + */ + fetchPinned() { + return this.client.api.channels[this.channel.id].pins.get().then(data => { + const messages = new Collection(); + for (const message of data) messages.set(message.id, this.create(message)); + return messages; + }); + } + + _fetchId(messageID) { + if (!this.client.user.bot) { + return this._fetchMany({ limit: 1, around: messageID }) + .then(messages => { + const msg = messages.get(messageID); + if (!msg) throw new Error('MESSAGE_MISSING'); + return msg; + }); + } + return this.client.api.channels[this.channel.id].messages[messageID].get() + .then(data => this.create(data)); + } + + _fetchMany(options = {}) { + return this.client.api.channels[this.channel.id].messages.get({ query: options }) + .then(data => { + const messages = new Collection(); + for (const message of data) messages.set(message.id, this.create(message)); + return messages; + }); + } + + + /** + * Data that can be resolved to a Message object. This can be: + * * A Message + * * A Snowflake + * @typedef {Message|Snowflake} MessageResolvable + */ + + /** + * Resolves a MessageResolvable to a Message object. + * @method resolve + * @memberof MessageStore + * @param {MessageResolvable} message The message resolvable to resolve + * @returns {?Message} + */ + + /** + * Resolves a MessageResolvable to a Message ID string. + * @method MessageStore + * @memberof PresenceStore + * @param {MessageResolvable} message The message resolvable to resolve + * @returns {?string} + */ +} + +module.exports = MessageStore; + + +/***/ }), +/* 34 */ +/***/ (function(module, exports, __webpack_require__) { + +const Constants = __webpack_require__(0); +const Base = __webpack_require__(10); + +/** + * Represents an invitation to a guild channel. + * The only guaranteed properties are `code`, `guild` and `channel`. Other properties can be missing. + * @extends {Base} + */ +class Invite extends Base { + constructor(client, data) { + super(client); + this._patch(data); + } + + _patch(data) { + /** + * The guild the invite is for + * @type {Guild} + */ + this.guild = this.client.guilds.create(data.guild, false); + + /** + * The code for this invite + * @type {string} + */ + this.code = data.code; + + /** + * The approximate number of online members of the guild this invite is for + * @type {number} + */ + this.presenceCount = data.approximate_presence_count; + + /** + * The approximate total number of members of the guild this invite is for + * @type {number} + */ + this.memberCount = data.approximate_member_count; + + /** + * The number of text channels the guild this invite goes to has + * @type {number} + */ + this.textChannelCount = data.guild.text_channel_count; + + /** + * The number of voice channels the guild this invite goes to has + * @type {number} + */ + this.voiceChannelCount = data.guild.voice_channel_count; + + /** + * Whether or not this invite is temporary + * @type {boolean} + */ + this.temporary = data.temporary; + + /** + * The maximum age of the invite, in seconds + * @type {?number} + */ + this.maxAge = data.max_age; + + /** + * How many times this invite has been used + * @type {number} + */ + this.uses = data.uses; + + /** + * The maximum uses of this invite + * @type {number} + */ + this.maxUses = data.max_uses; + + if (data.inviter) { + /** + * The user who created this invite + * @type {User} + */ + this.inviter = this.client.users.create(data.inviter); + } + + /** + * The channel the invite is for + * @type {GuildChannel} + */ + this.channel = this.client.channels.create(data.channel, this.guild, false); + + /** + * The timestamp the invite was created at + * @type {number} + */ + this.createdTimestamp = new Date(data.created_at).getTime(); + } + + /** + * The time the invite was created + * @type {Date} + * @readonly + */ + get createdAt() { + return new Date(this.createdTimestamp); + } + + /** + * The timestamp the invite will expire at + * @type {number} + * @readonly + */ + get expiresTimestamp() { + return this.createdTimestamp + (this.maxAge * 1000); + } + + /** + * The time the invite will expire + * @type {Date} + * @readonly + */ + get expiresAt() { + return new Date(this.expiresTimestamp); + } + + /** + * The URL to the invite + * @type {string} + * @readonly + */ + get url() { + return Constants.Endpoints.invite(this.client.options.http.invite, this.code); + } + + /** + * Deletes this invite. + * @param {string} [reason] Reason for deleting this invite + * @returns {Promise} + */ + delete(reason) { + return this.client.api.invites[this.code].delete({ reason }).then(() => this); + } + + /** + * When concatenated with a string, this automatically concatenates the invite's URL instead of the object. + * @returns {string} + * @example + * // Logs: Invite: https://discord.gg/A1b2C3 + * console.log(`Invite: ${invite}`); + */ + toString() { + return this.url; + } +} + +module.exports = Invite; + + +/***/ }), +/* 35 */ +/***/ (function(module, exports, __webpack_require__) { + const Long = __webpack_require__(43); -const Role = __webpack_require__(18); -const Invite = __webpack_require__(35); -const GuildAuditLogs = __webpack_require__(71); -const Webhook = __webpack_require__(21); -const GuildChannel = __webpack_require__(28); -const GuildMember = __webpack_require__(17); -const VoiceRegion = __webpack_require__(72); +const Role = __webpack_require__(27); +const Invite = __webpack_require__(34); +const GuildAuditLogs = __webpack_require__(73); +const Webhook = __webpack_require__(22); +const GuildChannel = __webpack_require__(21); +const GuildMember = __webpack_require__(18); +const VoiceRegion = __webpack_require__(74); const Constants = __webpack_require__(0); const Collection = __webpack_require__(3); const Util = __webpack_require__(7); +const DataResolver = __webpack_require__(13); const Snowflake = __webpack_require__(9); const Permissions = __webpack_require__(12); -const Shared = __webpack_require__(62); -const GuildMemberStore = __webpack_require__(124); -const RoleStore = __webpack_require__(125); -const EmojiStore = __webpack_require__(126); -const GuildChannelStore = __webpack_require__(127); -const PresenceStore = __webpack_require__(73); +const Shared = __webpack_require__(64); +const GuildMemberStore = __webpack_require__(131); +const RoleStore = __webpack_require__(132); +const EmojiStore = __webpack_require__(133); +const GuildChannelStore = __webpack_require__(134); +const PresenceStore = __webpack_require__(75); const Base = __webpack_require__(10); const { Error, TypeError } = __webpack_require__(4); @@ -8231,7 +8750,7 @@ class Guild extends Base { * const member = guild.member(message.author); */ member(user) { - return this.client.resolver.resolveGuildMember(this, user); + return this.members.resolve(user); } /** @@ -8311,7 +8830,7 @@ class Guild extends Base { before: options.before, after: options.after, limit: options.limit, - user_id: this.client.resolver.resolveUserID(options.user), + user_id: this.client.users.resolveID(options.user), action_type: options.type, } }) .then(data => GuildAuditLogs.build(this, data)); @@ -8336,7 +8855,7 @@ class Guild extends Base { if (options.roles) { const roles = []; for (let role of options.roles instanceof Collection ? options.roles.values() : options.roles) { - role = this.client.resolver.resolveRole(this, role); + role = this.roles.resolve(role); if (!role) { return Promise.reject(new TypeError('INVALID_TYPE', 'options.roles', 'Array or Collection of Roles or Snowflakes', true)); @@ -8401,14 +8920,14 @@ class Guild extends Base { if (data.region) _data.region = data.region; if (typeof data.verificationLevel !== 'undefined') _data.verification_level = Number(data.verificationLevel); if (typeof data.afkChannel !== 'undefined') { - _data.afk_channel_id = this.client.resolver.resolveChannelID(data.afkChannel); + _data.afk_channel_id = this.client.channels.resolveID(data.afkChannel); } if (typeof data.systemChannel !== 'undefined') { - _data.system_channel_id = this.client.resolver.resolveChannelID(data.systemChannel); + _data.system_channel_id = this.client.channels.resolveID(data.systemChannel); } if (data.afkTimeout) _data.afk_timeout = Number(data.afkTimeout); if (typeof data.icon !== 'undefined') _data.icon = data.icon; - if (data.owner) _data.owner_id = this.client.resolver.resolveUser(data.owner).id; + if (data.owner) _data.owner_id = this.client.users.resolve(data.owner).id; if (data.splash) _data.splash = data.splash; if (typeof data.explicitContentFilter !== 'undefined') { _data.explicit_content_filter = Number(data.explicitContentFilter); @@ -8524,7 +9043,7 @@ class Guild extends Base { * .catch(console.error); */ async setIcon(icon, reason) { - return this.edit({ icon: await this.client.resolver.resolveImage(icon), reason }); + return this.edit({ icon: await DataResolver.resolveImage(icon, this.client.browser), reason }); } /** @@ -8554,7 +9073,7 @@ class Guild extends Base { * .catch(console.error); */ async setSplash(splash, reason) { - return this.edit({ splash: await this.client.resolver.resolveImage(splash), reason }); + return this.edit({ splash: await DataResolver.resolveImage(splash, this.client.browser), reason }); } /** @@ -8615,14 +9134,14 @@ class Guild extends Base { */ ban(user, options = { days: 0 }) { if (options.days) options['delete-message-days'] = options.days; - const id = this.client.resolver.resolveUserID(user); + const id = this.client.users.resolveID(user); if (!id) return Promise.reject(new Error('BAN_RESOLVE_ID', true)); return this.client.api.guilds(this.id).bans[id].put({ query: options }) .then(() => { if (user instanceof GuildMember) return user; - const _user = this.client.resolver.resolveUser(id); + const _user = this.client.users.resolve(id); if (_user) { - const member = this.client.resolver.resolveGuildMember(this, _user); + const member = this.members.resolve(_user); return member || _user; } return id; @@ -8641,7 +9160,7 @@ class Guild extends Base { * .catch(console.error); */ unban(user, reason) { - const id = this.client.resolver.resolveUserID(user); + const id = this.client.users.resolverID(user); if (!id) throw new Error('BAN_RESOLVE_ID'); return this.client.api.guilds(this.id).bans[id].delete({ reason }) .then(() => user); @@ -8710,12 +9229,12 @@ class Guild extends Base { if (allow instanceof Array) allow = Permissions.resolve(allow); if (deny instanceof Array) deny = Permissions.resolve(deny); - const role = this.client.resolver.resolveRole(this, overwrite.id); + const role = this.roles.resolve(overwrite.id); if (role) { overwrite.id = role.id; overwrite.type = 'role'; } else { - overwrite.id = this.client.resolver.resolveUserID(overwrite.id); + overwrite.id = this.client.users.resolveID(overwrite.id); overwrite.type = 'member'; } @@ -8788,7 +9307,7 @@ class Guild extends Base { */ setChannelPositions(channelPositions) { const updatedChannels = channelPositions.map(r => ({ - id: this.client.resolver.resolveChannelID(r.channel), + id: this.client.channels.resolveID(r.channel), position: r.position, })); @@ -8863,7 +9382,7 @@ class Guild extends Base { if (roles) { data.roles = []; for (let role of roles instanceof Collection ? roles.values() : roles) { - role = this.client.resolver.resolveRole(this, role); + role = this.roles.resolve(role); if (!role) { return Promise.reject(new TypeError('INVALID_TYPE', 'options.roles', 'Array or Collection of Roles or Snowflakes', true)); @@ -8876,7 +9395,7 @@ class Guild extends Base { .then(emoji => this.client.actions.GuildEmojiCreate.handle(this, emoji).emoji); } - return this.client.resolver.resolveImage(attachment) + return DataResolver.resolveImage(attachment, this.client.browser) .then(image => this.createEmoji(image, name, { roles, reason })); } @@ -9054,589 +9573,11 @@ class VoiceStateCollection extends Collection { module.exports = Guild; -/***/ }), -/* 30 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/* WEBPACK VAR INJECTION */(function(process) { - -if (!process.version || - process.version.indexOf('v0.') === 0 || - process.version.indexOf('v1.') === 0 && process.version.indexOf('v1.8.') !== 0) { - module.exports = nextTick; -} else { - module.exports = process.nextTick; -} - -function nextTick(fn, arg1, arg2, arg3) { - if (typeof fn !== 'function') { - throw new TypeError('"callback" argument must be a function'); - } - var len = arguments.length; - var args, i; - switch (len) { - case 0: - case 1: - return process.nextTick(fn); - case 2: - return process.nextTick(function afterTickOne() { - fn.call(null, arg1); - }); - case 3: - return process.nextTick(function afterTickTwo() { - fn.call(null, arg1, arg2); - }); - case 4: - return process.nextTick(function afterTickThree() { - fn.call(null, arg1, arg2, arg3); - }); - default: - args = new Array(len - 1); - i = 0; - while (i < args.length) { - args[i++] = arguments[i]; - } - return process.nextTick(function afterTick() { - fn.apply(null, args); - }); - } -} - -/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(8))) - -/***/ }), -/* 31 */ -/***/ (function(module, exports) { - - - -/***/ }), -/* 32 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -exports.decode = exports.parse = __webpack_require__(93); -exports.encode = exports.stringify = __webpack_require__(94); - - -/***/ }), -/* 33 */ -/***/ (function(module, exports, __webpack_require__) { - -const DataStore = __webpack_require__(11); -const Collection = __webpack_require__(3); -const { Error } = __webpack_require__(4); -let Message; - -/** - * Stores messages for text-based channels. - * @extends {DataStore} - */ -class MessageStore extends DataStore { - constructor(channel, iterable) { - super(channel.client, iterable); - this.channel = channel; - Message = __webpack_require__(44); - } - - create(data, cache = true) { - const existing = this.get(data.id); - if (existing) return existing; - - const message = new Message(this.client.channels.get(data.channel_id), data, this.client); - - if (cache) this.set(message.id, message); - return message; - } - - set(key, value) { - const maxSize = this.client.options.messageCacheMaxSize; - if (maxSize === 0) return; - if (this.size >= maxSize && maxSize > 0) this.delete(this.firstKey()); - super.set(key, value); - } - - /** - * The parameters to pass in when requesting previous messages from a channel. `around`, `before` and - * `after` are mutually exclusive. All the parameters are optional. - * @typedef {Object} ChannelLogsQueryOptions - * @property {number} [limit=50] Number of messages to acquire - * @property {Snowflake} [before] ID of a message to get the messages that were posted before it - * @property {Snowflake} [after] ID of a message to get the messages that were posted after it - * @property {Snowflake} [around] ID of a message to get the messages that were posted around it - */ - - /** - * Gets a message, or messages, from this channel. - * @param {Snowflake|ChannelLogsQueryOptions} [message] The ID of the message to fetch, or query parameters. - * @returns {Promise|Promise>} - * @example - * // Get message - * channel.messages.fetch('99539446449315840') - * .then(message => console.log(message.content)) - * .catch(console.error); - * @example - * // Get messages - * channel.messages.fetch({limit: 10}) - * .then(messages => console.log(`Received ${messages.size} messages`)) - * .catch(console.error); - */ - fetch(message) { - return typeof message === 'string' ? this._fetchId(message) : this._fetchMany(message); - } - - /** - * Fetches the pinned messages of this channel and returns a collection of them. - * The returned Collection does not contain the reactions of the messages. - * Those need to be fetched seperately. - * @returns {Promise>} - */ - fetchPinned() { - return this.client.api.channels[this.channel.id].pins.get().then(data => { - const messages = new Collection(); - for (const message of data) messages.set(message.id, this.create(message)); - return messages; - }); - } - - _fetchId(messageID) { - if (!this.client.user.bot) { - return this._fetchMany({ limit: 1, around: messageID }) - .then(messages => { - const msg = messages.get(messageID); - if (!msg) throw new Error('MESSAGE_MISSING'); - return msg; - }); - } - return this.client.api.channels[this.channel.id].messages[messageID].get() - .then(data => this.create(data)); - } - - _fetchMany(options = {}) { - return this.client.api.channels[this.channel.id].messages.get({ query: options }) - .then(data => { - const messages = new Collection(); - for (const message of data) messages.set(message.id, this.create(message)); - return messages; - }); - } -} - -module.exports = MessageStore; - - -/***/ }), -/* 34 */ -/***/ (function(module, exports, __webpack_require__) { - -const Collection = __webpack_require__(3); -const Snowflake = __webpack_require__(9); -const Base = __webpack_require__(10); -const { TypeError } = __webpack_require__(4); - -/** - * Represents a custom emoji. - * @extends {Base} - */ -class Emoji extends Base { - constructor(guild, data) { - super(guild.client); - - /** - * The guild this emoji is part of - * @type {Guild} - */ - this.guild = guild; - - this._patch(data); - } - - _patch(data) { - /** - * The ID of the emoji - * @type {Snowflake} - */ - this.id = data.id; - - /** - * The name of the emoji - * @type {string} - */ - this.name = data.name; - - /** - * Whether or not this emoji requires colons surrounding it - * @type {boolean} - */ - this.requiresColons = data.require_colons; - - /** - * Whether this emoji is managed by an external service - * @type {boolean} - */ - this.managed = data.managed; - - this._roles = data.roles; - } - - /** - * The timestamp the emoji was created at - * @type {number} - * @readonly - */ - get createdTimestamp() { - return Snowflake.deconstruct(this.id).timestamp; - } - - /** - * The time the emoji was created - * @type {Date} - * @readonly - */ - get createdAt() { - return new Date(this.createdTimestamp); - } - - /** - * A collection of roles this emoji is active for (empty if all), mapped by role ID - * @type {Collection} - * @readonly - */ - get roles() { - const roles = new Collection(); - for (const role of this._roles) { - if (this.guild.roles.has(role)) roles.set(role, this.guild.roles.get(role)); - } - return roles; - } - - /** - * The URL to the emoji file - * @type {string} - * @readonly - */ - get url() { - return this.client.rest.cdn.Emoji(this.id); - } - - /** - * The identifier of this emoji, used for message reactions - * @type {string} - * @readonly - */ - get identifier() { - if (this.id) return `${this.name}:${this.id}`; - return encodeURIComponent(this.name); - } - - /** - * Data for editing an emoji. - * @typedef {Object} EmojiEditData - * @property {string} [name] The name of the emoji - * @property {Collection|RoleResolvable[]} [roles] Roles to restrict emoji to - */ - - /** - * Edits the emoji. - * @param {EmojiEditData} data The new data for the emoji - * @param {string} [reason] Reason for editing this emoji - * @returns {Promise} - * @example - * // Edit an emoji - * emoji.edit({name: 'newemoji'}) - * .then(e => console.log(`Edited emoji ${e}`)) - * .catch(console.error); - */ - edit(data, reason) { - return this.client.api.guilds(this.guild.id).emojis(this.id) - .patch({ data: { - name: data.name, - roles: data.roles ? data.roles.map(r => r.id ? r.id : r) : undefined, - }, reason }) - .then(() => this); - } - - /** - * Set the name of the emoji. - * @param {string} name The new name for the emoji - * @param {string} [reason] Reason for changing the emoji's name - * @returns {Promise} - */ - setName(name, reason) { - return this.edit({ name }, reason); - } - - /** - * Add a role to the list of roles that can use this emoji. - * @param {Role} role The role to add - * @returns {Promise} - */ - addRestrictedRole(role) { - return this.addRestrictedRoles([role]); - } - - /** - * Add multiple roles to the list of roles that can use this emoji. - * @param {Collection|RoleResolvable[]} roles Roles to add - * @returns {Promise} - */ - addRestrictedRoles(roles) { - const newRoles = new Collection(this.roles); - for (let role of roles instanceof Collection ? roles.values() : roles) { - role = this.client.resolver.resolveRole(this.guild, role); - if (!role) { - return Promise.reject(new TypeError('INVALID_TYPE', 'roles', - 'Array or Collection of Roles or Snowflakes', true)); - } - newRoles.set(role.id, role); - } - return this.edit({ roles: newRoles }); - } - - /** - * Remove a role from the list of roles that can use this emoji. - * @param {Role} role The role to remove - * @returns {Promise} - */ - removeRestrictedRole(role) { - return this.removeRestrictedRoles([role]); - } - - /** - * Remove multiple roles from the list of roles that can use this emoji. - * @param {Collection|RoleResolvable[]} roles Roles to remove - * @returns {Promise} - */ - removeRestrictedRoles(roles) { - const newRoles = new Collection(this.roles); - for (let role of roles instanceof Collection ? roles.values() : roles) { - role = this.client.resolver.resolveRole(this.guild, role); - if (!role) { - return Promise.reject(new TypeError('INVALID_TYPE', 'roles', - 'Array or Collection of Roles or Snowflakes', true)); - } - if (newRoles.has(role.id)) newRoles.delete(role.id); - } - return this.edit({ roles: newRoles }); - } - - /** - * When concatenated with a string, this automatically returns the emoji mention rather than the object. - * @returns {string} - * @example - * // Send an emoji: - * const emoji = guild.emojis.first(); - * msg.reply(`Hello! ${emoji}`); - */ - toString() { - return this.requiresColons ? `<:${this.name}:${this.id}>` : this.name; - } - - /** - * Delete the emoji. - * @param {string} [reason] Reason for deleting the emoji - * @returns {Promise} - */ - delete(reason) { - return this.client.api.guilds(this.guild.id).emojis(this.id).delete({ reason }) - .then(() => this); - } - - /** - * Whether this emoji is the same as another one. - * @param {Emoji|Object} other The emoji to compare it to - * @returns {boolean} Whether the emoji is equal to the given emoji or not - */ - equals(other) { - if (other instanceof Emoji) { - return ( - other.id === this.id && - other.name === this.name && - other.managed === this.managed && - other.requiresColons === this.requiresColons && - other._roles === this._roles - ); - } else { - return ( - other.id === this.id && - other.name === this.name && - other._roles === this._roles - ); - } - } -} - -module.exports = Emoji; - - -/***/ }), -/* 35 */ -/***/ (function(module, exports, __webpack_require__) { - -const Constants = __webpack_require__(0); -const Base = __webpack_require__(10); - -/** - * Represents an invitation to a guild channel. - * The only guaranteed properties are `code`, `guild` and `channel`. Other properties can be missing. - * @extends {Base} - */ -class Invite extends Base { - constructor(client, data) { - super(client); - this._patch(data); - } - - _patch(data) { - /** - * The guild the invite is for - * @type {Guild} - */ - this.guild = this.client.guilds.create(data.guild, false); - - /** - * The code for this invite - * @type {string} - */ - this.code = data.code; - - /** - * The approximate number of online members of the guild this invite is for - * @type {number} - */ - this.presenceCount = data.approximate_presence_count; - - /** - * The approximate total number of members of the guild this invite is for - * @type {number} - */ - this.memberCount = data.approximate_member_count; - - /** - * The number of text channels the guild this invite goes to has - * @type {number} - */ - this.textChannelCount = data.guild.text_channel_count; - - /** - * The number of voice channels the guild this invite goes to has - * @type {number} - */ - this.voiceChannelCount = data.guild.voice_channel_count; - - /** - * Whether or not this invite is temporary - * @type {boolean} - */ - this.temporary = data.temporary; - - /** - * The maximum age of the invite, in seconds - * @type {?number} - */ - this.maxAge = data.max_age; - - /** - * How many times this invite has been used - * @type {number} - */ - this.uses = data.uses; - - /** - * The maximum uses of this invite - * @type {number} - */ - this.maxUses = data.max_uses; - - if (data.inviter) { - /** - * The user who created this invite - * @type {User} - */ - this.inviter = this.client.users.create(data.inviter); - } - - /** - * The channel the invite is for - * @type {GuildChannel} - */ - this.channel = this.client.channels.create(data.channel, this.guild, false); - - /** - * The timestamp the invite was created at - * @type {number} - */ - this.createdTimestamp = new Date(data.created_at).getTime(); - } - - /** - * The time the invite was created - * @type {Date} - * @readonly - */ - get createdAt() { - return new Date(this.createdTimestamp); - } - - /** - * The timestamp the invite will expire at - * @type {number} - * @readonly - */ - get expiresTimestamp() { - return this.createdTimestamp + (this.maxAge * 1000); - } - - /** - * The time the invite will expire - * @type {Date} - * @readonly - */ - get expiresAt() { - return new Date(this.expiresTimestamp); - } - - /** - * The URL to the invite - * @type {string} - * @readonly - */ - get url() { - return Constants.Endpoints.invite(this.client.options.http.invite, this.code); - } - - /** - * Deletes this invite. - * @param {string} [reason] Reason for deleting this invite - * @returns {Promise} - */ - delete(reason) { - return this.client.api.invites[this.code].delete({ reason }).then(() => this); - } - - /** - * When concatenated with a string, this automatically concatenates the invite's URL instead of the object. - * @returns {string} - * @example - * // Logs: Invite: https://discord.gg/A1b2C3 - * console.log(`Invite: ${invite}`); - */ - toString() { - return this.url; - } -} - -module.exports = Invite; - - /***/ }), /* 36 */ /***/ (function(module, exports, __webpack_require__) { -const Snekfetch = __webpack_require__(82); +const Snekfetch = __webpack_require__(83); // Sync stuff might go here @@ -9670,15 +9611,15 @@ module.exports = Snekfetch; module.exports = Stream; -var EE = __webpack_require__(13).EventEmitter; -var inherits = __webpack_require__(14); +var EE = __webpack_require__(14).EventEmitter; +var inherits = __webpack_require__(15); inherits(Stream, EE); -Stream.Readable = __webpack_require__(22); -Stream.Writable = __webpack_require__(89); -Stream.Duplex = __webpack_require__(90); -Stream.Transform = __webpack_require__(91); -Stream.PassThrough = __webpack_require__(92); +Stream.Readable = __webpack_require__(23); +Stream.Writable = __webpack_require__(90); +Stream.Duplex = __webpack_require__(91); +Stream.Transform = __webpack_require__(92); +Stream.PassThrough = __webpack_require__(93); // Backwards-compat with node 0.4.x Stream.Stream = Stream; @@ -9878,7 +9819,7 @@ SafeBuffer.allocUnsafeSlow = function (size) { /**/ -var processNextTick = __webpack_require__(30); +var processNextTick = __webpack_require__(29); /**/ module.exports = Writable; @@ -9915,18 +9856,18 @@ var Duplex; Writable.WritableState = WritableState; /**/ -var util = __webpack_require__(23); -util.inherits = __webpack_require__(14); +var util = __webpack_require__(24); +util.inherits = __webpack_require__(15); /**/ /**/ var internalUtil = { - deprecate: __webpack_require__(87) + deprecate: __webpack_require__(88) }; /**/ /**/ -var Stream = __webpack_require__(49); +var Stream = __webpack_require__(50); /**/ /**/ @@ -9940,7 +9881,7 @@ function _isUint8Array(obj) { } /**/ -var destroyImpl = __webpack_require__(50); +var destroyImpl = __webpack_require__(51); util.inherits(Writable, Stream); @@ -10513,7 +10454,7 @@ Writable.prototype._destroy = function (err, cb) { this.end(); cb(err); }; -/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(8), __webpack_require__(85).setImmediate, __webpack_require__(6))) +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(8), __webpack_require__(86).setImmediate, __webpack_require__(6))) /***/ }), /* 40 */ @@ -11044,7 +10985,7 @@ function isPrimitive(arg) { } exports.isPrimitive = isPrimitive; -exports.isBuffer = __webpack_require__(110); +exports.isBuffer = __webpack_require__(111); function objectToString(o) { return Object.prototype.toString.call(o); @@ -11088,7 +11029,7 @@ exports.log = function() { * prototype. * @param {function} superCtor Constructor function to inherit prototype from. */ -exports.inherits = __webpack_require__(111); +exports.inherits = __webpack_require__(112); exports._extend = function(origin, add) { // Don't do anything if add isn't an object @@ -11112,9 +11053,8 @@ function hasOwnProperty(obj, prop) { /* 41 */ /***/ (function(module, exports, __webpack_require__) { -const EventEmitter = __webpack_require__(13); -const RESTManager = __webpack_require__(59); -const ClientDataResolver = __webpack_require__(121); +const EventEmitter = __webpack_require__(14); +const RESTManager = __webpack_require__(60); const Util = __webpack_require__(7); const Constants = __webpack_require__(0); @@ -11139,13 +11079,6 @@ class BaseClient extends EventEmitter { */ this.rest = new RESTManager(this, options._tokenType); - /** - * The data resolver of the client - * @type {ClientDataResolver} - * @private - */ - this.resolver = new ClientDataResolver(this); - /** * Timeouts set by {@link WebhookClient#setTimeout} that are still active * @type {Set} @@ -11245,7 +11178,7 @@ module.exports = BaseClient; /***/ (function(module, exports, __webpack_require__) { const Collection = __webpack_require__(3); -const EventEmitter = __webpack_require__(13); +const EventEmitter = __webpack_require__(14); /** * Filter to be applied to the collector. @@ -12676,14 +12609,14 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ /* 44 */ /***/ (function(module, exports, __webpack_require__) { -const Mentions = __webpack_require__(64); -const MessageAttachment = __webpack_require__(27); +const Mentions = __webpack_require__(66); +const MessageAttachment = __webpack_require__(28); const Embed = __webpack_require__(20); -const ReactionCollector = __webpack_require__(65); +const ReactionCollector = __webpack_require__(67); const ClientApplication = __webpack_require__(45); const Util = __webpack_require__(7); const Collection = __webpack_require__(3); -const ReactionStore = __webpack_require__(123); +const ReactionStore = __webpack_require__(130); const Constants = __webpack_require__(0); const Permissions = __webpack_require__(12); const Base = __webpack_require__(10); @@ -12695,7 +12628,7 @@ let GuildMember; * @extends {Base} */ class Message extends Base { - constructor(channel, data, client) { + constructor(client, data, channel) { super(client); /** @@ -13071,7 +13004,7 @@ class Message extends Base { // Add the reply prefix if (reply && this.channel.type !== 'dm') { - const id = this.client.resolver.resolveUserID(reply); + const id = this.client.users.resolveID(reply); const mention = `<@${reply instanceof GuildMember && reply.nickname ? '!' : ''}${id}>`; content = `${mention}${content ? `, ${content}` : ''}`; } @@ -13105,11 +13038,11 @@ class Message extends Base { /** * Add a reaction to the message. - * @param {string|Emoji|ReactionEmoji} emoji The emoji to react with + * @param {EmojiIdentifierResolveable} emoji The emoji to react with * @returns {Promise} */ react(emoji) { - emoji = this.client.resolver.resolveEmojiIdentifier(emoji); + emoji = this.client.emojis.resolveIdentifier(emoji); if (!emoji) throw new TypeError('EMOJI_TYPE'); return this.client.api.channels(this.channel.id).messages(this.id).reactions(emoji, '@me') @@ -13256,6 +13189,7 @@ module.exports = Message; const Snowflake = __webpack_require__(9); const Constants = __webpack_require__(0); +const DataResolver = __webpack_require__(13); const Base = __webpack_require__(10); /** @@ -13421,7 +13355,7 @@ class ClientApplication extends Base { * @returns {Promise} */ createAsset(name, data, type) { - return this.client.resolveBase64(data).then(b64 => + return DataResolver.resolveBase64(data).then(b64 => this.client.api.applications(this.id).assets.post({ data: { name, data: b64, @@ -13463,6 +13397,250 @@ module.exports = ClientApplication; /***/ }), /* 46 */ +/***/ (function(module, exports, __webpack_require__) { + +const Collection = __webpack_require__(3); +const Snowflake = __webpack_require__(9); +const Base = __webpack_require__(10); +const { TypeError } = __webpack_require__(4); + +/** + * Represents a custom emoji. + * @extends {Base} + */ +class Emoji extends Base { + constructor(client, data, guild) { + super(client); + + /** + * The guild this emoji is part of + * @type {Guild} + */ + this.guild = guild; + + this._patch(data); + } + + _patch(data) { + /** + * The ID of the emoji + * @type {Snowflake} + */ + this.id = data.id; + + /** + * The name of the emoji + * @type {string} + */ + this.name = data.name; + + /** + * Whether or not this emoji requires colons surrounding it + * @type {boolean} + */ + this.requiresColons = data.require_colons; + + /** + * Whether this emoji is managed by an external service + * @type {boolean} + */ + this.managed = data.managed; + + this._roles = data.roles; + } + + /** + * The timestamp the emoji was created at + * @type {number} + * @readonly + */ + get createdTimestamp() { + return Snowflake.deconstruct(this.id).timestamp; + } + + /** + * The time the emoji was created + * @type {Date} + * @readonly + */ + get createdAt() { + return new Date(this.createdTimestamp); + } + + /** + * A collection of roles this emoji is active for (empty if all), mapped by role ID + * @type {Collection} + * @readonly + */ + get roles() { + const roles = new Collection(); + for (const role of this._roles) { + if (this.guild.roles.has(role)) roles.set(role, this.guild.roles.get(role)); + } + return roles; + } + + /** + * The URL to the emoji file + * @type {string} + * @readonly + */ + get url() { + return this.client.rest.cdn.Emoji(this.id); + } + + /** + * The identifier of this emoji, used for message reactions + * @type {string} + * @readonly + */ + get identifier() { + if (this.id) return `${this.name}:${this.id}`; + return encodeURIComponent(this.name); + } + + /** + * Data for editing an emoji. + * @typedef {Object} EmojiEditData + * @property {string} [name] The name of the emoji + * @property {Collection|RoleResolvable[]} [roles] Roles to restrict emoji to + */ + + /** + * Edits the emoji. + * @param {EmojiEditData} data The new data for the emoji + * @param {string} [reason] Reason for editing this emoji + * @returns {Promise} + * @example + * // Edit an emoji + * emoji.edit({name: 'newemoji'}) + * .then(e => console.log(`Edited emoji ${e}`)) + * .catch(console.error); + */ + edit(data, reason) { + return this.client.api.guilds(this.guild.id).emojis(this.id) + .patch({ data: { + name: data.name, + roles: data.roles ? data.roles.map(r => r.id ? r.id : r) : undefined, + }, reason }) + .then(() => this); + } + + /** + * Set the name of the emoji. + * @param {string} name The new name for the emoji + * @param {string} [reason] Reason for changing the emoji's name + * @returns {Promise} + */ + setName(name, reason) { + return this.edit({ name }, reason); + } + + /** + * Add a role to the list of roles that can use this emoji. + * @param {Role} role The role to add + * @returns {Promise} + */ + addRestrictedRole(role) { + return this.addRestrictedRoles([role]); + } + + /** + * Add multiple roles to the list of roles that can use this emoji. + * @param {Collection|RoleResolvable[]} roles Roles to add + * @returns {Promise} + */ + addRestrictedRoles(roles) { + const newRoles = new Collection(this.roles); + for (let role of roles instanceof Collection ? roles.values() : roles) { + role = this.guild.roles.resolve(role); + if (!role) { + return Promise.reject(new TypeError('INVALID_TYPE', 'roles', + 'Array or Collection of Roles or Snowflakes', true)); + } + newRoles.set(role.id, role); + } + return this.edit({ roles: newRoles }); + } + + /** + * Remove a role from the list of roles that can use this emoji. + * @param {Role} role The role to remove + * @returns {Promise} + */ + removeRestrictedRole(role) { + return this.removeRestrictedRoles([role]); + } + + /** + * Remove multiple roles from the list of roles that can use this emoji. + * @param {Collection|RoleResolvable[]} roles Roles to remove + * @returns {Promise} + */ + removeRestrictedRoles(roles) { + const newRoles = new Collection(this.roles); + for (let role of roles instanceof Collection ? roles.values() : roles) { + role = this.guild.roles.resolve(role); + if (!role) { + return Promise.reject(new TypeError('INVALID_TYPE', 'roles', + 'Array or Collection of Roles or Snowflakes', true)); + } + if (newRoles.has(role.id)) newRoles.delete(role.id); + } + return this.edit({ roles: newRoles }); + } + + /** + * When concatenated with a string, this automatically returns the emoji mention rather than the object. + * @returns {string} + * @example + * // Send an emoji: + * const emoji = guild.emojis.first(); + * msg.reply(`Hello! ${emoji}`); + */ + toString() { + return this.requiresColons ? `<:${this.name}:${this.id}>` : this.name; + } + + /** + * Delete the emoji. + * @param {string} [reason] Reason for deleting the emoji + * @returns {Promise} + */ + delete(reason) { + return this.client.api.guilds(this.guild.id).emojis(this.id).delete({ reason }) + .then(() => this); + } + + /** + * Whether this emoji is the same as another one. + * @param {Emoji|Object} other The emoji to compare it to + * @returns {boolean} Whether the emoji is equal to the given emoji or not + */ + equals(other) { + if (other instanceof Emoji) { + return ( + other.id === this.id && + other.name === this.name && + other.managed === this.managed && + other.requiresColons === this.requiresColons && + other._roles === this._roles + ); + } else { + return ( + other.id === this.id && + other.name === this.name && + other._roles === this._roles + ); + } + } +} + +module.exports = Emoji; + + +/***/ }), +/* 47 */ /***/ (function(module, exports) { /** @@ -13517,7 +13695,7 @@ module.exports = ReactionEmoji; /***/ }), -/* 47 */ +/* 48 */ /***/ (function(module, exports) { var toString = {}.toString; @@ -13528,7 +13706,7 @@ module.exports = Array.isArray || function (arr) { /***/ }), -/* 48 */ +/* 49 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -13557,13 +13735,13 @@ module.exports = Array.isArray || function (arr) { /**/ -var processNextTick = __webpack_require__(30); +var processNextTick = __webpack_require__(29); /**/ module.exports = Readable; /**/ -var isArray = __webpack_require__(47); +var isArray = __webpack_require__(48); /**/ /**/ @@ -13573,7 +13751,7 @@ var Duplex; Readable.ReadableState = ReadableState; /**/ -var EE = __webpack_require__(13).EventEmitter; +var EE = __webpack_require__(14).EventEmitter; var EElistenerCount = function (emitter, type) { return emitter.listeners(type).length; @@ -13581,7 +13759,7 @@ var EElistenerCount = function (emitter, type) { /**/ /**/ -var Stream = __webpack_require__(49); +var Stream = __webpack_require__(50); /**/ // TODO(bmeurer): Change this back to const once hole checks are @@ -13598,12 +13776,12 @@ function _isUint8Array(obj) { /**/ /**/ -var util = __webpack_require__(23); -util.inherits = __webpack_require__(14); +var util = __webpack_require__(24); +util.inherits = __webpack_require__(15); /**/ /**/ -var debugUtil = __webpack_require__(83); +var debugUtil = __webpack_require__(84); var debug = void 0; if (debugUtil && debugUtil.debuglog) { debug = debugUtil.debuglog('stream'); @@ -13612,8 +13790,8 @@ if (debugUtil && debugUtil.debuglog) { } /**/ -var BufferList = __webpack_require__(84); -var destroyImpl = __webpack_require__(50); +var BufferList = __webpack_require__(85); +var destroyImpl = __webpack_require__(51); var StringDecoder; util.inherits(Readable, Stream); @@ -13696,7 +13874,7 @@ function ReadableState(options, stream) { this.decoder = null; this.encoding = null; if (options.encoding) { - if (!StringDecoder) StringDecoder = __webpack_require__(51).StringDecoder; + if (!StringDecoder) StringDecoder = __webpack_require__(52).StringDecoder; this.decoder = new StringDecoder(options.encoding); this.encoding = options.encoding; } @@ -13852,7 +14030,7 @@ Readable.prototype.isPaused = function () { // backwards compatibility. Readable.prototype.setEncoding = function (enc) { - if (!StringDecoder) StringDecoder = __webpack_require__(51).StringDecoder; + if (!StringDecoder) StringDecoder = __webpack_require__(52).StringDecoder; this._readableState.decoder = new StringDecoder(enc); this._readableState.encoding = enc; return this; @@ -14542,14 +14720,14 @@ function indexOf(xs, x) { /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6), __webpack_require__(8))) /***/ }), -/* 49 */ +/* 50 */ /***/ (function(module, exports, __webpack_require__) { -module.exports = __webpack_require__(13).EventEmitter; +module.exports = __webpack_require__(14).EventEmitter; /***/ }), -/* 50 */ +/* 51 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -14557,7 +14735,7 @@ module.exports = __webpack_require__(13).EventEmitter; /**/ -var processNextTick = __webpack_require__(30); +var processNextTick = __webpack_require__(29); /**/ // undocumented cb() API, needed for core, not for public API @@ -14627,7 +14805,7 @@ module.exports = { }; /***/ }), -/* 51 */ +/* 52 */ /***/ (function(module, exports, __webpack_require__) { // Copyright Joyent, Inc. and other Node contributors. @@ -14854,7 +15032,7 @@ function base64DetectIncompleteChar(buffer) { /***/ }), -/* 52 */ +/* 53 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -14928,8 +15106,8 @@ module.exports = Transform; var Duplex = __webpack_require__(16); /**/ -var util = __webpack_require__(23); -util.inherits = __webpack_require__(14); +var util = __webpack_require__(24); +util.inherits = __webpack_require__(15); /**/ util.inherits(Transform, Duplex); @@ -15074,13 +15252,13 @@ function done(stream, er, data) { } /***/ }), -/* 53 */ +/* 54 */ /***/ (function(module, exports, __webpack_require__) { -/* WEBPACK VAR INJECTION */(function(global) {var ClientRequest = __webpack_require__(95) -var extend = __webpack_require__(98) -var statusCodes = __webpack_require__(99) -var url = __webpack_require__(55) +/* WEBPACK VAR INJECTION */(function(global) {var ClientRequest = __webpack_require__(96) +var extend = __webpack_require__(99) +var statusCodes = __webpack_require__(100) +var url = __webpack_require__(56) var http = exports @@ -15159,7 +15337,7 @@ http.METHODS = [ /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) /***/ }), -/* 54 */ +/* 55 */ /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(global) {exports.fetch = isFunction(global.fetch) && isFunction(global.ReadableStream) @@ -15235,7 +15413,7 @@ xhr = null // Help gc /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) /***/ }), -/* 55 */ +/* 56 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -15262,8 +15440,8 @@ xhr = null // Help gc -var punycode = __webpack_require__(100); -var util = __webpack_require__(102); +var punycode = __webpack_require__(101); +var util = __webpack_require__(103); exports.parse = urlParse; exports.resolve = urlResolve; @@ -15338,7 +15516,7 @@ var protocolPattern = /^([a-z0-9.+-]+:)/i, 'gopher:': true, 'file:': true }, - querystring = __webpack_require__(32); + querystring = __webpack_require__(31); function urlParse(url, parseQueryString, slashesDenoteHost) { if (url && util.isObject(url) && url instanceof Url) return url; @@ -15974,11 +16152,11 @@ Url.prototype.parseHost = function() { /***/ }), -/* 56 */ +/* 57 */ /***/ (function(module, exports, __webpack_require__) { -const mimes = __webpack_require__(106); -const mimeOfBuffer = __webpack_require__(107); +const mimes = __webpack_require__(107); +const mimeOfBuffer = __webpack_require__(108); function lookupMime(ext) { return mimes[ext.replace(/^\./, '')] || mimes.bin; @@ -15996,20 +16174,20 @@ module.exports = { /***/ }), -/* 57 */ +/* 58 */ /***/ (function(module, exports) { module.exports = {"name":"discord.js","version":"12.0.0-dev","description":"A powerful library for interacting with the Discord API","main":"./src/index","types":"./typings/index.d.ts","scripts":{"test":"npm run lint && npm run docs:test","docs":"docgen --source src --custom docs/index.yml --output docs/docs.json --jsdoc jsdoc.json","docs:test":"docgen --source src --custom docs/index.yml --jsdoc jsdoc.json","lint":"eslint src","lint:fix":"eslint --fix src","webpack":"parallel-webpack"},"repository":{"type":"git","url":"git+https://github.com/hydrabolt/discord.js.git"},"keywords":["discord","api","bot","client","node","discordapp"],"author":"Amish Shah ","license":"Apache-2.0","bugs":{"url":"https://github.com/hydrabolt/discord.js/issues"},"homepage":"https://github.com/hydrabolt/discord.js#readme","runkitExampleFilename":"./docs/examples/ping.js","dependencies":{"long":"^3.0.0","prism-media":"^0.0.1","snekfetch":"^3.0.0","tweetnacl":"^1.0.0","ws":"^3.0.0"},"peerDependencies":{"bufferutil":"^3.0.0","erlpack":"hammerandchisel/erlpack","node-opus":"^0.2.0","opusscript":"^0.0.3","sodium":"^2.0.0","libsodium-wrappers":"^0.5.0","uws":"^8.14.0"},"devDependencies":{"@types/node":"^8.0.0","discord.js-docgen":"hydrabolt/discord.js-docgen","eslint":"^4.0.0","jsdoc-strip-async-await":"^0.1.0","parallel-webpack":"^2.0.0","uglifyjs-webpack-plugin":"^1.0.0-beta.2","webpack":"^3.0.0"},"engines":{"node":">=8.0.0"},"browser":{"ws":false,"uws":false,"erlpack":false,"prism-media":false,"opusscript":false,"node-opus":false,"tweetnacl":false,"sodium":false,"src/sharding/Shard.js":false,"src/sharding/ShardClientUtil.js":false,"src/sharding/ShardingManager.js":false,"src/client/voice/dispatcher/StreamDispatcher.js":false,"src/client/voice/opus/BaseOpusEngine.js":false,"src/client/voice/opus/NodeOpusEngine.js":false,"src/client/voice/opus/OpusEngineList.js":false,"src/client/voice/opus/OpusScriptEngine.js":false,"src/client/voice/pcm/ConverterEngine.js":false,"src/client/voice/pcm/ConverterEngineList.js":false,"src/client/voice/pcm/FfmpegConverterEngine.js":false,"src/client/voice/player/AudioPlayer.js":false,"src/client/voice/receiver/VoiceReadable.js":false,"src/client/voice/receiver/VoiceReceiver.js":false,"src/client/voice/util/Secretbox.js":false,"src/client/voice/util/SecretKey.js":false,"src/client/voice/util/VolumeInterface.js":false,"src/client/voice/ClientVoiceManager.js":false,"src/client/voice/VoiceBroadcast.js":false,"src/client/voice/VoiceConnection.js":false,"src/client/voice/VoiceUDPClient.js":false,"src/client/voice/VoiceWebSocket.js":false}} /***/ }), -/* 58 */ +/* 59 */ /***/ (function(module, exports, __webpack_require__) { // Heavily inspired by node's `internal/errors` module const kCode = Symbol('code'); const messages = new Map(); -const assert = __webpack_require__(109); +const assert = __webpack_require__(110); const util = __webpack_require__(40); /** @@ -16073,13 +16251,13 @@ module.exports = { /***/ }), -/* 59 */ +/* 60 */ /***/ (function(module, exports, __webpack_require__) { -const UserAgentManager = __webpack_require__(114); -const handlers = __webpack_require__(115); -const APIRequest = __webpack_require__(119); -const routeBuilder = __webpack_require__(120); +const UserAgentManager = __webpack_require__(115); +const handlers = __webpack_require__(116); +const APIRequest = __webpack_require__(120); +const routeBuilder = __webpack_require__(121); const { Error } = __webpack_require__(4); const Constants = __webpack_require__(0); @@ -16152,7 +16330,7 @@ module.exports = RESTManager; /***/ }), -/* 60 */ +/* 61 */ /***/ (function(module, exports) { /** @@ -16212,7 +16390,343 @@ module.exports = DiscordAPIError; /***/ }), -/* 61 */ +/* 62 */ +/***/ (function(module, exports, __webpack_require__) { + +const User = __webpack_require__(32); +const Collection = __webpack_require__(3); +const ClientUserSettings = __webpack_require__(76); +const ClientUserGuildSettings = __webpack_require__(77); +const Constants = __webpack_require__(0); +const Util = __webpack_require__(7); +const DataResolver = __webpack_require__(13); +const Guild = __webpack_require__(35); + +/** + * Represents the logged in client's Discord user. + * @extends {User} + */ +class ClientUser extends User { + _patch(data) { + super._patch(data); + + /** + * Whether or not this account has been verified + * @type {boolean} + */ + this.verified = data.verified; + + /** + * The email of this account + * @type {string} + */ + this.email = data.email; + this._typing = new Map(); + + /** + * A Collection of friends for the logged in user + * This is only filled when using a user account. + * @type {Collection} + */ + this.friends = new Collection(); + + /** + * A Collection of blocked users for the logged in user + * This is only filled when using a user account. + * @type {Collection} + */ + this.blocked = new Collection(); + + /** + * A Collection of notes for the logged in user + * This is only filled when using a user account. + * @type {Collection} + */ + this.notes = new Collection(); + + /** + * If the user has Discord premium (nitro) + * This is only filled when using a user account. + * @type {?boolean} + */ + this.premium = typeof data.premium === 'boolean' ? data.premium : null; + + /** + * If the user has MFA enabled on their account + * This is only filled when using a user account. + * @type {?boolean} + */ + this.mfaEnabled = typeof data.mfa_enabled === 'boolean' ? data.mfa_enabled : null; + + /** + * If the user has ever used a mobile device on Discord + * This is only filled when using a user account. + * @type {?boolean} + */ + this.mobile = typeof data.mobile === 'boolean' ? data.mobile : null; + + /** + * Various settings for this user + * This is only filled when using a user account. + * @type {?ClientUserSettings} + */ + this.settings = data.user_settings ? new ClientUserSettings(this, data.user_settings) : null; + + /** + * All of the user's guild settings + * This is only filled when using a user account. + * @type {Collection} + */ + this.guildSettings = new Collection(); + if (data.user_guild_settings) { + for (const settings of data.user_guild_settings) { + this.guildSettings.set(settings.guild_id, new ClientUserGuildSettings(this.client, settings)); + } + } + } + + /** + * ClientUser's presence + * @readonly + * @type {Presence} + */ + get presence() { + return this.client.presences.clientPresence; + } + + edit(data, passcode) { + if (!this.bot) { + if (typeof passcode !== 'object') { + data.password = passcode; + } else { + data.code = passcode.mfaCode; + data.password = passcode.password; + } + } + return this.client.api.users('@me').patch({ data }) + .then(newData => { + this.client.token = newData.token; + return this.client.actions.UserUpdate.handle(newData).updated; + }); + } + + /** + * Set the username of the logged in client. + * Changing usernames in Discord is heavily rate limited, with only 2 requests + * every hour. Use this sparingly! + * @param {string} username The new username + * @param {string} [password] Current password (only for user accounts) + * @returns {Promise} + * @example + * // Set username + * client.user.setUsername('discordjs') + * .then(user => console.log(`My new username is ${user.username}`)) + * .catch(console.error); + */ + setUsername(username, password) { + return this.edit({ username }, password); + } + + /** + * Changes the email for the client user's account. + * This is only available when using a user account. + * @param {string} email New email to change to + * @param {string} password Current password + * @returns {Promise} + * @example + * // Set email + * client.user.setEmail('bob@gmail.com', 'some amazing password 123') + * .then(user => console.log(`My new email is ${user.email}`)) + * .catch(console.error); + */ + setEmail(email, password) { + return this.edit({ email }, password); + } + + /** + * Changes the password for the client user's account. + * This is only available when using a user account. + * @param {string} newPassword New password to change to + * @param {Object|string} options Object containing an MFA code, password or both. + * Can be just a string for the password. + * @param {string} [options.oldPassword] Current password + * @param {string} [options.mfaCode] Timed MFA Code + * @returns {Promise} + * @example + * // Set password + * client.user.setPassword('some new amazing password 456', 'some amazing password 123') + * .then(user => console.log('New password set!')) + * .catch(console.error); + */ + setPassword(newPassword, options) { + return this.edit({ new_password: newPassword }, { password: options.oldPassword, mfaCode: options.mfaCode }); + } + + /** + * Set the avatar of the logged in client. + * @param {BufferResolvable|Base64Resolvable} avatar The new avatar + * @returns {Promise} + * @example + * // Set avatar + * client.user.setAvatar('./avatar.png') + * .then(user => console.log(`New avatar set!`)) + * .catch(console.error); + */ + async setAvatar(avatar) { + return this.edit({ avatar: await DataResolver.resolveImage(avatar, this.client.browser) }); + } + + /** + * Data resembling a raw Discord presence. + * @typedef {Object} PresenceData + * @property {PresenceStatus} [status] Status of the user + * @property {boolean} [afk] Whether the user is AFK + * @property {Object} [activity] activity the user is playing + * @property {string} [activity.name] Name of the activity + * @property {ActivityType|number} [activity.type] Type of the activity + * @property {string} [activity.url] Stream url + */ + + /** + * Sets the full presence of the client user. + * @param {PresenceData} data Data for the presence + * @returns {Promise} + */ + setPresence(data) { + return this.client.presences.setClientPresence(data); + } + + /** + * A user's status. Must be one of: + * * `online` + * * `idle` + * * `invisible` + * * `dnd` (do not disturb) + * @typedef {string} PresenceStatus + */ + + /** + * Sets the status of the client user. + * @param {PresenceStatus} status Status to change to + * @returns {Promise} + */ + setStatus(status) { + return this.setPresence({ status }); + } + + /** + * Sets the activity the client user is playing. + * @param {?string} name Activity being played + * @param {Object} [options] Options for setting the activity + * @param {string} [options.url] Twitch stream URL + * @param {ActivityType|number} [options.type] Type of the activity + * @returns {Promise} + */ + setActivity(name, { url, type } = {}) { + if (!name) return this.setPresence({ activity: null }); + return this.setPresence({ + activity: { name, type, url }, + }); + } + + /** + * Sets/removes the AFK flag for the client user. + * @param {boolean} afk Whether or not the user is AFK + * @returns {Promise} + */ + setAFK(afk) { + return this.setPresence({ afk }); + } + + /** + * Fetches messages that mentioned the client's user. + * @param {Object} [options] Options for the fetch + * @param {number} [options.limit=25] Maximum number of mentions to retrieve + * @param {boolean} [options.roles=true] Whether to include role mentions + * @param {boolean} [options.everyone=true] Whether to include everyone/here mentions + * @param {Guild|Snowflake} [options.guild] Limit the search to a specific guild + * @returns {Promise} + */ + fetchMentions(options = {}) { + if (options.guild instanceof Guild) options.guild = options.guild.id; + Util.mergeDefault({ limit: 25, roles: true, everyone: true, guild: null }, options); + + return this.client.api.users('@me').mentions.get({ query: options }) + .then(data => data.map(m => this.client.channels.get(m.channel_id).messages.create(m, false))); + } + + /** + * Creates a guild. + * This is only available when using a user account. + * @param {string} name The name of the guild + * @param {Object} [options] Options for the creating + * @param {string} [options.region] The region for the server, defaults to the closest one available + * @param {BufferResolvable|Base64Resolvable} [options.icon=null] The icon for the guild + * @returns {Promise} The guild that was created + */ + createGuild(name, { region, icon = null } = {}) { + if (!icon || (typeof icon === 'string' && icon.startsWith('data:'))) { + return new Promise((resolve, reject) => + this.client.api.guilds.post({ data: { name, region, icon } }) + .then(data => { + if (this.client.guilds.has(data.id)) return resolve(this.client.guilds.get(data.id)); + + const handleGuild = guild => { + if (guild.id === data.id) { + this.client.removeListener(Constants.Events.GUILD_CREATE, handleGuild); + this.client.clearTimeout(timeout); + resolve(guild); + } + }; + this.client.on(Constants.Events.GUILD_CREATE, handleGuild); + + const timeout = this.client.setTimeout(() => { + this.client.removeListener(Constants.Events.GUILD_CREATE, handleGuild); + resolve(this.client.guilds.create(data)); + }, 10000); + return undefined; + }, reject) + ); + } + + return DataResolver.resolveImage(icon, this.client.browser) + .then(data => this.createGuild(name, { region, icon: data || null })); + } + + /** + * An object containing either a user or access token, and an optional nickname. + * @typedef {Object} GroupDMRecipientOptions + * @property {UserResolvable} [user] User to add to the Group DM + * @property {string} [accessToken] Access token to use to add a user to the Group DM + * (only available if a bot is creating the DM) + * @property {string} [nick] Permanent nickname (only available if a bot is creating the DM) + * @property {string} [id] If no user resolvable is provided and you want to assign nicknames + * you must provide user ids instead + */ + + /** + * Creates a Group DM. + * @param {GroupDMRecipientOptions[]} recipients The recipients + * @returns {Promise} + */ + createGroupDM(recipients) { + const data = this.bot ? { + access_tokens: recipients.map(u => u.accessToken), + nicks: recipients.reduce((o, r) => { + if (r.nick) o[r.user ? r.user.id : r.id] = r.nick; + return o; + }, {}), + } : { recipients: recipients.map(u => this.client.users.resolveID(u.user || u.id)) }; + return this.client.api.users('@me').channels.post({ data }) + .then(res => this.client.channels.create(res)); + } +} + +module.exports = ClientUser; + + +/***/ }), +/* 63 */ /***/ (function(module, exports, __webpack_require__) { const Collector = __webpack_require__(42); @@ -16304,20 +16818,20 @@ module.exports = MessageCollector; /***/ }), -/* 62 */ +/* 64 */ /***/ (function(module, exports, __webpack_require__) { module.exports = { - search: __webpack_require__(122), - sendMessage: __webpack_require__(128), + search: __webpack_require__(129), + sendMessage: __webpack_require__(135), }; /***/ }), -/* 63 */ +/* 65 */ /***/ (function(module, exports, __webpack_require__) { -const Channel = __webpack_require__(15); +const Channel = __webpack_require__(17); const TextBasedChannel = __webpack_require__(26); const MessageStore = __webpack_require__(33); @@ -16375,11 +16889,11 @@ module.exports = DMChannel; /***/ }), -/* 64 */ +/* 66 */ /***/ (function(module, exports, __webpack_require__) { const Collection = __webpack_require__(3); -const GuildMember = __webpack_require__(17); +const GuildMember = __webpack_require__(18); /** * Keeps track of mentions in a {@link Message}. @@ -16541,7 +17055,7 @@ module.exports = MessageMentions; /***/ }), -/* 65 */ +/* 67 */ /***/ (function(module, exports, __webpack_require__) { const Collector = __webpack_require__(42); @@ -16662,19 +17176,19 @@ module.exports = ReactionCollector; /***/ }), -/* 66 */ +/* 68 */ /***/ (function(module, exports, __webpack_require__) { const Collection = __webpack_require__(3); -const Emoji = __webpack_require__(34); -const ReactionEmoji = __webpack_require__(46); +const Emoji = __webpack_require__(46); +const ReactionEmoji = __webpack_require__(47); const { Error } = __webpack_require__(4); /** * Represents a reaction to a message. */ class MessageReaction { - constructor(message, emoji, count, me) { + constructor(client, data, message) { /** * The message that this reaction refers to * @type {Message} @@ -16685,13 +17199,13 @@ class MessageReaction { * Whether the client has given this reaction * @type {boolean} */ - this.me = me; + this.me = data.me; /** * The number of people that have given the same reaction * @type {number} */ - this.count = count || 0; + this.count = data.count || 0; /** * The users that have given this reaction, mapped by their ID @@ -16699,7 +17213,7 @@ class MessageReaction { */ this.users = new Collection(); - this._emoji = new ReactionEmoji(this, emoji.name, emoji.id); + this._emoji = new ReactionEmoji(this, data.emoji.name, data.emoji.id); } /** @@ -16729,7 +17243,7 @@ class MessageReaction { * @returns {Promise} */ remove(user = this.message.client.user) { - const userID = this.message.client.resolver.resolveUserID(user); + const userID = this.message.client.users.resolveID(user); if (!userID) return Promise.reject(new Error('REACTION_RESOLVE_USER')); return this.message.client.api.channels[this.message.channel.id].messages[this.message.id] .reactions[this.emoji.identifier][userID === this.message.client.user.id ? '@me' : userID] @@ -16788,12 +17302,13 @@ module.exports = MessageReaction; /***/ }), -/* 67 */ +/* 69 */ /***/ (function(module, exports, __webpack_require__) { -const Channel = __webpack_require__(15); +const Channel = __webpack_require__(17); const TextBasedChannel = __webpack_require__(26); const Collection = __webpack_require__(3); +const DataResolver = __webpack_require__(13); const MessageStore = __webpack_require__(33); /* @@ -16953,7 +17468,7 @@ class GroupDMChannel extends Channel { * @returns {Promise} */ async setIcon(icon) { - return this.edit({ icon: await this.client.resolver.resolveImage(icon) }); + return this.edit({ icon: await DataResolver.resolveImage(icon, this.client.browser) }); } /** @@ -16975,7 +17490,7 @@ class GroupDMChannel extends Channel { * @returns {Promise} */ addUser({ user, accessToken, nick }) { - const id = this.client.resolver.resolveUserID(user); + const id = this.client.users.resolveID(user); const data = this.client.user.bot ? { nick, access_token: accessToken } : { recipient: id }; @@ -16989,7 +17504,7 @@ class GroupDMChannel extends Channel { * @returns {Promise} */ removeUser(user) { - const id = this.client.resolver.resolveUserID(user); + const id = this.client.users.resolveID(user); return this.client.api.channels[this.id].recipients[id].delete() .then(() => this); } @@ -17029,13 +17544,14 @@ module.exports = GroupDMChannel; /***/ }), -/* 68 */ +/* 70 */ /***/ (function(module, exports, __webpack_require__) { -const GuildChannel = __webpack_require__(28); -const Webhook = __webpack_require__(21); +const GuildChannel = __webpack_require__(21); +const Webhook = __webpack_require__(22); const TextBasedChannel = __webpack_require__(26); const Collection = __webpack_require__(3); +const DataResolver = __webpack_require__(13); const MessageStore = __webpack_require__(33); /** @@ -17097,7 +17613,7 @@ class TextChannel extends GuildChannel { */ async createWebhook(name, { avatar, reason } = {}) { if (typeof avatar === 'string' && !avatar.startsWith('data:')) { - avatar = await this.client.resolver.resolveImage(avatar); + avatar = await DataResolver.resolveImage(avatar, this.client.browser); } return this.client.api.channels[this.id].webhooks.post({ data: { name, avatar, @@ -17125,7 +17641,7 @@ module.exports = TextChannel; /***/ }), -/* 69 */ +/* 71 */ /***/ (function(module, exports, __webpack_require__) { const Permissions = __webpack_require__(12); @@ -17191,10 +17707,10 @@ module.exports = PermissionOverwrites; /***/ }), -/* 70 */ +/* 72 */ /***/ (function(module, exports, __webpack_require__) { -const GuildChannel = __webpack_require__(28); +const GuildChannel = __webpack_require__(21); const Collection = __webpack_require__(3); const { Error } = __webpack_require__(4); @@ -17332,12 +17848,12 @@ module.exports = VoiceChannel; /***/ }), -/* 71 */ +/* 73 */ /***/ (function(module, exports, __webpack_require__) { const Collection = __webpack_require__(3); const Snowflake = __webpack_require__(9); -const Webhook = __webpack_require__(21); +const Webhook = __webpack_require__(22); const Targets = { ALL: 'ALL', @@ -17655,7 +18171,7 @@ module.exports = GuildAuditLogs; /***/ }), -/* 72 */ +/* 74 */ /***/ (function(module, exports) { /** @@ -17711,20 +18227,53 @@ module.exports = VoiceRegion; /***/ }), -/* 73 */ +/* 75 */ /***/ (function(module, exports, __webpack_require__) { const DataStore = __webpack_require__(11); const { Presence } = __webpack_require__(19); class PresenceStore extends DataStore { - create(data) { - if (this.has(data.user.id)) { - this.get(data.user.id).patch(data); - } else { - this.set(data.user.id, new Presence(this.client, data)); - } - return this.get(data.user.id); + constructor(client, iterable) { + super(client, iterable, Presence); + } + + create(data, cache) { + const existing = this.get(data.user.id); + return existing ? existing.patch(data) : super.create(data, cache, { id: data.user.id }); + } + + /** + * Data that can be resolved to a Presence object. This can be: + * * A Presence + * * A UserResolveable + * * A Snowflake + * @typedef {Presence|UserResolveable|Snowflake} PresenceResolvable + */ + + /** + * Resolves a PresenceResolvable to a Presence object. + * @param {PresenceResolvable} presence The presence resolvable to resolve + * @returns {?Presence} + */ + resolve(presence) { + const presenceResolveable = super.resolve(presence); + if (presenceResolveable) return presenceResolveable; + const UserResolveable = this.client.users.resolveID(presence); + return super.resolve(UserResolveable) || null; + } + + + /** + * Resolves a PresenceResolvable to a Presence ID string. + * @param {PresenceResolvable} presence The presence resolvable to resolve + * @returns {?string} + */ + resolveID(presence) { + const presenceResolveable = super.resolveID(presence); + if (presenceResolveable) return presenceResolveable; + const userResolveable = this.client.users.resolveID(presence); + return this.has(userResolveable) ? userResolveable : null; } } @@ -17732,342 +18281,7 @@ module.exports = PresenceStore; /***/ }), -/* 74 */ -/***/ (function(module, exports, __webpack_require__) { - -const User = __webpack_require__(25); -const Collection = __webpack_require__(3); -const ClientUserSettings = __webpack_require__(75); -const ClientUserGuildSettings = __webpack_require__(76); -const Constants = __webpack_require__(0); -const Util = __webpack_require__(7); -const Guild = __webpack_require__(29); - -/** - * Represents the logged in client's Discord user. - * @extends {User} - */ -class ClientUser extends User { - _patch(data) { - super._patch(data); - - /** - * Whether or not this account has been verified - * @type {boolean} - */ - this.verified = data.verified; - - /** - * The email of this account - * @type {string} - */ - this.email = data.email; - this._typing = new Map(); - - /** - * A Collection of friends for the logged in user - * This is only filled when using a user account. - * @type {Collection} - */ - this.friends = new Collection(); - - /** - * A Collection of blocked users for the logged in user - * This is only filled when using a user account. - * @type {Collection} - */ - this.blocked = new Collection(); - - /** - * A Collection of notes for the logged in user - * This is only filled when using a user account. - * @type {Collection} - */ - this.notes = new Collection(); - - /** - * If the user has Discord premium (nitro) - * This is only filled when using a user account. - * @type {?boolean} - */ - this.premium = typeof data.premium === 'boolean' ? data.premium : null; - - /** - * If the user has MFA enabled on their account - * This is only filled when using a user account. - * @type {?boolean} - */ - this.mfaEnabled = typeof data.mfa_enabled === 'boolean' ? data.mfa_enabled : null; - - /** - * If the user has ever used a mobile device on Discord - * This is only filled when using a user account. - * @type {?boolean} - */ - this.mobile = typeof data.mobile === 'boolean' ? data.mobile : null; - - /** - * Various settings for this user - * This is only filled when using a user account. - * @type {?ClientUserSettings} - */ - this.settings = data.user_settings ? new ClientUserSettings(this, data.user_settings) : null; - - /** - * All of the user's guild settings - * This is only filled when using a user account. - * @type {Collection} - */ - this.guildSettings = new Collection(); - if (data.user_guild_settings) { - for (const settings of data.user_guild_settings) { - this.guildSettings.set(settings.guild_id, new ClientUserGuildSettings(this.client, settings)); - } - } - } - - /** - * ClientUser's presence - * @readonly - * @type {Presence} - */ - get presence() { - return this.client.presences.clientPresence; - } - - edit(data, passcode) { - if (!this.bot) { - if (typeof passcode !== 'object') { - data.password = passcode; - } else { - data.code = passcode.mfaCode; - data.password = passcode.password; - } - } - return this.client.api.users('@me').patch({ data }) - .then(newData => { - this.client.token = newData.token; - return this.client.actions.UserUpdate.handle(newData).updated; - }); - } - - /** - * Set the username of the logged in client. - * Changing usernames in Discord is heavily rate limited, with only 2 requests - * every hour. Use this sparingly! - * @param {string} username The new username - * @param {string} [password] Current password (only for user accounts) - * @returns {Promise} - * @example - * // Set username - * client.user.setUsername('discordjs') - * .then(user => console.log(`My new username is ${user.username}`)) - * .catch(console.error); - */ - setUsername(username, password) { - return this.edit({ username }, password); - } - - /** - * Changes the email for the client user's account. - * This is only available when using a user account. - * @param {string} email New email to change to - * @param {string} password Current password - * @returns {Promise} - * @example - * // Set email - * client.user.setEmail('bob@gmail.com', 'some amazing password 123') - * .then(user => console.log(`My new email is ${user.email}`)) - * .catch(console.error); - */ - setEmail(email, password) { - return this.edit({ email }, password); - } - - /** - * Changes the password for the client user's account. - * This is only available when using a user account. - * @param {string} newPassword New password to change to - * @param {Object|string} options Object containing an MFA code, password or both. - * Can be just a string for the password. - * @param {string} [options.oldPassword] Current password - * @param {string} [options.mfaCode] Timed MFA Code - * @returns {Promise} - * @example - * // Set password - * client.user.setPassword('some new amazing password 456', 'some amazing password 123') - * .then(user => console.log('New password set!')) - * .catch(console.error); - */ - setPassword(newPassword, options) { - return this.edit({ new_password: newPassword }, { password: options.oldPassword, mfaCode: options.mfaCode }); - } - - /** - * Set the avatar of the logged in client. - * @param {BufferResolvable|Base64Resolvable} avatar The new avatar - * @returns {Promise} - * @example - * // Set avatar - * client.user.setAvatar('./avatar.png') - * .then(user => console.log(`New avatar set!`)) - * .catch(console.error); - */ - async setAvatar(avatar) { - return this.edit({ avatar: await this.client.resolver.resolveImage(avatar) }); - } - - /** - * Data resembling a raw Discord presence. - * @typedef {Object} PresenceData - * @property {PresenceStatus} [status] Status of the user - * @property {boolean} [afk] Whether the user is AFK - * @property {Object} [activity] activity the user is playing - * @property {string} [activity.name] Name of the activity - * @property {ActivityType|number} [activity.type] Type of the activity - * @property {string} [activity.url] Stream url - */ - - /** - * Sets the full presence of the client user. - * @param {PresenceData} data Data for the presence - * @returns {Promise} - */ - setPresence(data) { - return this.client.presences.setClientPresence(data); - } - - /** - * A user's status. Must be one of: - * * `online` - * * `idle` - * * `invisible` - * * `dnd` (do not disturb) - * @typedef {string} PresenceStatus - */ - - /** - * Sets the status of the client user. - * @param {PresenceStatus} status Status to change to - * @returns {Promise} - */ - setStatus(status) { - return this.setPresence({ status }); - } - - /** - * Sets the activity the client user is playing. - * @param {?string} name Activity being played - * @param {Object} [options] Options for setting the activity - * @param {string} [options.url] Twitch stream URL - * @param {ActivityType|number} [options.type] Type of the activity - * @returns {Promise} - */ - setActivity(name, { url, type } = {}) { - if (!name) return this.setPresence({ activity: null }); - return this.setPresence({ - activity: { name, type, url }, - }); - } - - /** - * Sets/removes the AFK flag for the client user. - * @param {boolean} afk Whether or not the user is AFK - * @returns {Promise} - */ - setAFK(afk) { - return this.setPresence({ afk }); - } - - /** - * Fetches messages that mentioned the client's user. - * @param {Object} [options] Options for the fetch - * @param {number} [options.limit=25] Maximum number of mentions to retrieve - * @param {boolean} [options.roles=true] Whether to include role mentions - * @param {boolean} [options.everyone=true] Whether to include everyone/here mentions - * @param {Guild|Snowflake} [options.guild] Limit the search to a specific guild - * @returns {Promise} - */ - fetchMentions(options = {}) { - if (options.guild instanceof Guild) options.guild = options.guild.id; - Util.mergeDefault({ limit: 25, roles: true, everyone: true, guild: null }, options); - - return this.client.api.users('@me').mentions.get({ query: options }) - .then(data => data.map(m => this.client.channels.get(m.channel_id).messages.create(m, false))); - } - - /** - * Creates a guild. - * This is only available when using a user account. - * @param {string} name The name of the guild - * @param {Object} [options] Options for the creating - * @param {string} [options.region] The region for the server, defaults to the closest one available - * @param {BufferResolvable|Base64Resolvable} [options.icon=null] The icon for the guild - * @returns {Promise} The guild that was created - */ - createGuild(name, { region, icon = null } = {}) { - if (!icon || (typeof icon === 'string' && icon.startsWith('data:'))) { - return new Promise((resolve, reject) => - this.client.api.guilds.post({ data: { name, region, icon } }) - .then(data => { - if (this.client.guilds.has(data.id)) return resolve(this.client.guilds.get(data.id)); - - const handleGuild = guild => { - if (guild.id === data.id) { - this.client.removeListener(Constants.Events.GUILD_CREATE, handleGuild); - this.client.clearTimeout(timeout); - resolve(guild); - } - }; - this.client.on(Constants.Events.GUILD_CREATE, handleGuild); - - const timeout = this.client.setTimeout(() => { - this.client.removeListener(Constants.Events.GUILD_CREATE, handleGuild); - resolve(this.client.guilds.create(data)); - }, 10000); - return undefined; - }, reject) - ); - } - - return this.client.resolver.resolveImage(icon) - .then(data => this.createGuild(name, { region, icon: data || null })); - } - - /** - * An object containing either a user or access token, and an optional nickname. - * @typedef {Object} GroupDMRecipientOptions - * @property {UserResolvable} [user] User to add to the Group DM - * @property {string} [accessToken] Access token to use to add a user to the Group DM - * (only available if a bot is creating the DM) - * @property {string} [nick] Permanent nickname (only available if a bot is creating the DM) - * @property {string} [id] If no user resolvable is provided and you want to assign nicknames - * you must provide user ids instead - */ - - /** - * Creates a Group DM. - * @param {GroupDMRecipientOptions[]} recipients The recipients - * @returns {Promise} - */ - createGroupDM(recipients) { - const data = this.bot ? { - access_tokens: recipients.map(u => u.accessToken), - nicks: recipients.reduce((o, r) => { - if (r.nick) o[r.user ? r.user.id : r.id] = r.nick; - return o; - }, {}), - } : { recipients: recipients.map(u => this.client.resolver.resolveUserID(u.user || u.id)) }; - return this.client.api.users('@me').channels.post({ data }) - .then(res => this.client.channels.create(res)); - } -} - -module.exports = ClientUser; - - -/***/ }), -/* 75 */ +/* 76 */ /***/ (function(module, exports, __webpack_require__) { const Constants = __webpack_require__(0); @@ -18153,7 +18367,7 @@ module.exports = ClientUserSettings; /***/ }), -/* 76 */ +/* 77 */ /***/ (function(module, exports, __webpack_require__) { const Constants = __webpack_require__(0); @@ -18219,12 +18433,12 @@ module.exports = ClientUserGuildSettings; /***/ }), -/* 77 */ +/* 78 */ /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(Buffer) {const browser = typeof window !== 'undefined'; -const zlib = __webpack_require__(31); -const querystring = __webpack_require__(32); +const zlib = __webpack_require__(30); +const querystring = __webpack_require__(31); if (browser) { exports.WebSocket = window.WebSocket; // eslint-disable-line no-undef @@ -18266,13 +18480,13 @@ for (const state of ['CONNECTING', 'OPEN', 'CLOSING', 'CLOSED']) exports[state] /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5).Buffer)) /***/ }), -/* 78 */ +/* 79 */ /***/ (function(module, exports, __webpack_require__) { const browser = typeof window !== 'undefined'; const webpack = !!"true"; -const Discord = __webpack_require__(79); +const Discord = __webpack_require__(80); module.exports = Discord; if (browser && webpack) window.Discord = Discord; // eslint-disable-line no-undef @@ -18281,7 +18495,7 @@ else if (!browser) console.warn('Warning: Attempting to use browser version of D /***/ }), -/* 79 */ +/* 80 */ /***/ (function(module, exports, __webpack_require__) { const Util = __webpack_require__(7); @@ -18289,7 +18503,7 @@ const Util = __webpack_require__(7); module.exports = { // "Root" classes (starting points) BaseClient: __webpack_require__(41), - Client: __webpack_require__(131), + Client: __webpack_require__(122), Shard: __webpack_require__(213), ShardClientUtil: __webpack_require__(214), ShardingManager: __webpack_require__(215), @@ -18298,14 +18512,15 @@ module.exports = { // Utilities Collection: __webpack_require__(3), Constants: __webpack_require__(0), - DiscordAPIError: __webpack_require__(60), + DataResolver: __webpack_require__(13), + DiscordAPIError: __webpack_require__(61), EvaluatedPermissions: __webpack_require__(12), Permissions: __webpack_require__(12), Snowflake: __webpack_require__(9), SnowflakeUtil: __webpack_require__(9), Util: Util, util: Util, - version: __webpack_require__(57).version, + version: __webpack_require__(58).version, // Shortcuts to Util methods escapeMarkdown: Util.escapeMarkdown, @@ -18314,41 +18529,41 @@ module.exports = { // Structures Activity: __webpack_require__(19).Activity, - Channel: __webpack_require__(15), - ClientUser: __webpack_require__(74), - ClientUserSettings: __webpack_require__(75), + Channel: __webpack_require__(17), + ClientUser: __webpack_require__(62), + ClientUserSettings: __webpack_require__(76), Collector: __webpack_require__(42), - DMChannel: __webpack_require__(63), - Emoji: __webpack_require__(34), - GroupDMChannel: __webpack_require__(67), - Guild: __webpack_require__(29), - GuildAuditLogs: __webpack_require__(71), - GuildChannel: __webpack_require__(28), - GuildMember: __webpack_require__(17), - Invite: __webpack_require__(35), + DMChannel: __webpack_require__(65), + Emoji: __webpack_require__(46), + GroupDMChannel: __webpack_require__(69), + Guild: __webpack_require__(35), + GuildAuditLogs: __webpack_require__(73), + GuildChannel: __webpack_require__(21), + GuildMember: __webpack_require__(18), + Invite: __webpack_require__(34), Message: __webpack_require__(44), - MessageAttachment: __webpack_require__(27), - MessageCollector: __webpack_require__(61), + MessageAttachment: __webpack_require__(28), + MessageCollector: __webpack_require__(63), MessageEmbed: __webpack_require__(20), - MessageMentions: __webpack_require__(64), - MessageReaction: __webpack_require__(66), + MessageMentions: __webpack_require__(66), + MessageReaction: __webpack_require__(68), ClientApplication: __webpack_require__(45), - PermissionOverwrites: __webpack_require__(69), + PermissionOverwrites: __webpack_require__(71), Presence: __webpack_require__(19).Presence, - ReactionEmoji: __webpack_require__(46), - ReactionCollector: __webpack_require__(65), - Role: __webpack_require__(18), - TextChannel: __webpack_require__(68), - User: __webpack_require__(25), - VoiceChannel: __webpack_require__(70), - Webhook: __webpack_require__(21), + ReactionEmoji: __webpack_require__(47), + ReactionCollector: __webpack_require__(67), + Role: __webpack_require__(27), + TextChannel: __webpack_require__(70), + User: __webpack_require__(32), + VoiceChannel: __webpack_require__(72), + Webhook: __webpack_require__(22), - WebSocket: __webpack_require__(77), + WebSocket: __webpack_require__(78), }; /***/ }), -/* 80 */ +/* 81 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -18469,7 +18684,7 @@ function fromByteArray (uint8) { /***/ }), -/* 81 */ +/* 82 */ /***/ (function(module, exports) { exports.read = function (buffer, offset, isLE, mLen, nBytes) { @@ -18559,19 +18774,19 @@ exports.write = function (buffer, value, offset, isLE, mLen, nBytes) { /***/ }), -/* 82 */ +/* 83 */ /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(Buffer) {__webpack_require__(37); -const zlib = __webpack_require__(31); -const qs = __webpack_require__(32); -const http = __webpack_require__(53); -const https = __webpack_require__(103); -const URL = __webpack_require__(55); -const Package = __webpack_require__(104); +const zlib = __webpack_require__(30); +const qs = __webpack_require__(31); +const http = __webpack_require__(54); +const https = __webpack_require__(104); +const URL = __webpack_require__(56); +const Package = __webpack_require__(105); const Stream = __webpack_require__(37); -const FormData = __webpack_require__(105); -const fileLoader = __webpack_require__(108); +const FormData = __webpack_require__(106); +const fileLoader = __webpack_require__(109); /** * Snekfetch @@ -18890,13 +19105,13 @@ function makeURLFromRequest(request) { /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5).Buffer)) /***/ }), -/* 83 */ +/* 84 */ /***/ (function(module, exports) { /* (ignored) */ /***/ }), -/* 84 */ +/* 85 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -18976,7 +19191,7 @@ module.exports = function () { }(); /***/ }), -/* 85 */ +/* 86 */ /***/ (function(module, exports, __webpack_require__) { var apply = Function.prototype.apply; @@ -19029,13 +19244,13 @@ exports._unrefActive = exports.active = function(item) { }; // setimmediate attaches itself to the global object -__webpack_require__(86); +__webpack_require__(87); exports.setImmediate = setImmediate; exports.clearImmediate = clearImmediate; /***/ }), -/* 86 */ +/* 87 */ /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(global, process) {(function (global, undefined) { @@ -19228,7 +19443,7 @@ exports.clearImmediate = clearImmediate; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6), __webpack_require__(8))) /***/ }), -/* 87 */ +/* 88 */ /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(global) { @@ -19302,7 +19517,7 @@ function config (name) { /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) /***/ }), -/* 88 */ +/* 89 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -19335,11 +19550,11 @@ function config (name) { module.exports = PassThrough; -var Transform = __webpack_require__(52); +var Transform = __webpack_require__(53); /**/ -var util = __webpack_require__(23); -util.inherits = __webpack_require__(14); +var util = __webpack_require__(24); +util.inherits = __webpack_require__(15); /**/ util.inherits(PassThrough, Transform); @@ -19355,37 +19570,37 @@ PassThrough.prototype._transform = function (chunk, encoding, cb) { }; /***/ }), -/* 89 */ +/* 90 */ /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(39); /***/ }), -/* 90 */ +/* 91 */ /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(16); -/***/ }), -/* 91 */ -/***/ (function(module, exports, __webpack_require__) { - -module.exports = __webpack_require__(22).Transform - - /***/ }), /* 92 */ /***/ (function(module, exports, __webpack_require__) { -module.exports = __webpack_require__(22).PassThrough +module.exports = __webpack_require__(23).Transform /***/ }), /* 93 */ /***/ (function(module, exports, __webpack_require__) { +module.exports = __webpack_require__(23).PassThrough + + +/***/ }), +/* 94 */ +/***/ (function(module, exports, __webpack_require__) { + "use strict"; // Copyright Joyent, Inc. and other Node contributors. // @@ -19474,7 +19689,7 @@ var isArray = Array.isArray || function (xs) { /***/ }), -/* 94 */ +/* 95 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -19566,14 +19781,14 @@ var objectKeys = Object.keys || function (obj) { /***/ }), -/* 95 */ +/* 96 */ /***/ (function(module, exports, __webpack_require__) { -/* WEBPACK VAR INJECTION */(function(Buffer, global, process) {var capability = __webpack_require__(54) -var inherits = __webpack_require__(14) -var response = __webpack_require__(96) -var stream = __webpack_require__(22) -var toArrayBuffer = __webpack_require__(97) +/* WEBPACK VAR INJECTION */(function(Buffer, global, process) {var capability = __webpack_require__(55) +var inherits = __webpack_require__(15) +var response = __webpack_require__(97) +var stream = __webpack_require__(23) +var toArrayBuffer = __webpack_require__(98) var IncomingMessage = response.IncomingMessage var rStates = response.readyStates @@ -19879,12 +20094,12 @@ var unsafeHeaders = [ /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5).Buffer, __webpack_require__(6), __webpack_require__(8))) /***/ }), -/* 96 */ +/* 97 */ /***/ (function(module, exports, __webpack_require__) { -/* WEBPACK VAR INJECTION */(function(process, Buffer, global) {var capability = __webpack_require__(54) -var inherits = __webpack_require__(14) -var stream = __webpack_require__(22) +/* WEBPACK VAR INJECTION */(function(process, Buffer, global) {var capability = __webpack_require__(55) +var inherits = __webpack_require__(15) +var stream = __webpack_require__(23) var rStates = exports.readyStates = { UNSENT: 0, @@ -20068,7 +20283,7 @@ IncomingMessage.prototype._onXHRProgress = function () { /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(8), __webpack_require__(5).Buffer, __webpack_require__(6))) /***/ }), -/* 97 */ +/* 98 */ /***/ (function(module, exports, __webpack_require__) { var Buffer = __webpack_require__(5).Buffer @@ -20101,7 +20316,7 @@ module.exports = function (buf) { /***/ }), -/* 98 */ +/* 99 */ /***/ (function(module, exports) { module.exports = extend @@ -20126,7 +20341,7 @@ function extend() { /***/ }), -/* 99 */ +/* 100 */ /***/ (function(module, exports) { module.exports = { @@ -20196,7 +20411,7 @@ module.exports = { /***/ }), -/* 100 */ +/* 101 */ /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(module, global) {var __WEBPACK_AMD_DEFINE_RESULT__;/*! https://mths.be/punycode v1.4.1 by @mathias */ @@ -20732,10 +20947,10 @@ module.exports = { }(this)); -/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(101)(module), __webpack_require__(6))) +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(102)(module), __webpack_require__(6))) /***/ }), -/* 101 */ +/* 102 */ /***/ (function(module, exports) { module.exports = function(module) { @@ -20763,7 +20978,7 @@ module.exports = function(module) { /***/ }), -/* 102 */ +/* 103 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -20786,10 +21001,10 @@ module.exports = { /***/ }), -/* 103 */ +/* 104 */ /***/ (function(module, exports, __webpack_require__) { -var http = __webpack_require__(53); +var http = __webpack_require__(54); var https = module.exports; @@ -20806,17 +21021,17 @@ https.request = function (params, cb) { /***/ }), -/* 104 */ +/* 105 */ /***/ (function(module, exports) { module.exports = {"_from":"snekfetch@^3.0.0","_id":"snekfetch@3.2.9","_inBundle":false,"_integrity":"sha512-0ZYxGRMtgBska6uQ616F0jcPYad/sLe+uBJJ2vewD62ftEFnh6rY5mza05KoUS5UWcclMuiUfAZSf10ZYnkOZA==","_location":"/snekfetch","_phantomChildren":{},"_requested":{"type":"range","registry":true,"raw":"snekfetch@^3.0.0","name":"snekfetch","escapedName":"snekfetch","rawSpec":"^3.0.0","saveSpec":null,"fetchSpec":"^3.0.0"},"_requiredBy":["/"],"_resolved":"https://registry.npmjs.org/snekfetch/-/snekfetch-3.2.9.tgz","_shasum":"cdd28c7e88c889d86b9ff289a8e985a2f484f206","_spec":"snekfetch@^3.0.0","_where":"/home/travis/build/hydrabolt/discord.js","author":{"name":"Gus Caplan","email":"me@gus.host"},"bugs":{"url":"https://github.com/devsnek/snekfetch/issues"},"bundleDependencies":false,"dependencies":{},"deprecated":false,"description":"Just do http requests without all that weird nastiness from other libs","devDependencies":{},"homepage":"https://github.com/devsnek/snekfetch#readme","license":"MIT","main":"index.js","name":"snekfetch","repository":{"type":"git","url":"git+https://github.com/devsnek/snekfetch.git"},"version":"3.2.9"} /***/ }), -/* 105 */ +/* 106 */ /***/ (function(module, exports, __webpack_require__) { -/* WEBPACK VAR INJECTION */(function(Buffer) {const path = __webpack_require__(24); -const mime = __webpack_require__(56); +/* WEBPACK VAR INJECTION */(function(Buffer) {const path = __webpack_require__(25); +const mime = __webpack_require__(57); class FormData { constructor() { @@ -20864,13 +21079,13 @@ module.exports = FormData; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5).Buffer)) /***/ }), -/* 106 */ +/* 107 */ /***/ (function(module, exports) { module.exports = {"123":"application/vnd.lotus-1-2-3","ez":"application/andrew-inset","aw":"application/applixware","atom":"application/atom+xml","atomcat":"application/atomcat+xml","atomsvc":"application/atomsvc+xml","bdoc":"application/x-bdoc","ccxml":"application/ccxml+xml","cdmia":"application/cdmi-capability","cdmic":"application/cdmi-container","cdmid":"application/cdmi-domain","cdmio":"application/cdmi-object","cdmiq":"application/cdmi-queue","cu":"application/cu-seeme","mpd":"application/dash+xml","davmount":"application/davmount+xml","dbk":"application/docbook+xml","dssc":"application/dssc+der","xdssc":"application/dssc+xml","ecma":"application/ecmascript","emma":"application/emma+xml","epub":"application/epub+zip","exi":"application/exi","pfr":"application/font-tdpfr","woff":"application/font-woff","woff2":"application/font-woff2","geojson":"application/geo+json","gml":"application/gml+xml","gpx":"application/gpx+xml","gxf":"application/gxf","stk":"application/hyperstudio","ink":"application/inkml+xml","inkml":"application/inkml+xml","ipfix":"application/ipfix","jar":"application/java-archive","war":"application/java-archive","ear":"application/java-archive","ser":"application/java-serialized-object","class":"application/java-vm","js":"application/javascript","json":"application/json","map":"application/json","json5":"application/json5","jsonml":"application/jsonml+json","jsonld":"application/ld+json","lostxml":"application/lost+xml","hqx":"application/mac-binhex40","cpt":"application/mac-compactpro","mads":"application/mads+xml","webmanifest":"application/manifest+json","mrc":"application/marc","mrcx":"application/marcxml+xml","ma":"application/mathematica","nb":"application/mathematica","mb":"application/mathematica","mathml":"application/mathml+xml","mbox":"application/mbox","mscml":"application/mediaservercontrol+xml","metalink":"application/metalink+xml","meta4":"application/metalink4+xml","mets":"application/mets+xml","mods":"application/mods+xml","m21":"application/mp21","mp21":"application/mp21","mp4s":"application/mp4","m4p":"application/mp4","doc":"application/msword","dot":"application/msword","mxf":"application/mxf","bin":"application/octet-stream","dms":"application/octet-stream","lrf":"application/octet-stream","mar":"application/octet-stream","so":"application/octet-stream","dist":"application/octet-stream","distz":"application/octet-stream","pkg":"application/octet-stream","bpk":"application/octet-stream","dump":"application/octet-stream","elc":"application/octet-stream","deploy":"application/octet-stream","exe":"application/x-msdownload","dll":"application/x-msdownload","deb":"application/x-debian-package","dmg":"application/x-apple-diskimage","iso":"application/x-iso9660-image","img":"application/octet-stream","msi":"application/x-msdownload","msp":"application/octet-stream","msm":"application/octet-stream","buffer":"application/octet-stream","oda":"application/oda","opf":"application/oebps-package+xml","ogx":"application/ogg","omdoc":"application/omdoc+xml","onetoc":"application/onenote","onetoc2":"application/onenote","onetmp":"application/onenote","onepkg":"application/onenote","oxps":"application/oxps","xer":"application/patch-ops-error+xml","pdf":"application/pdf","pgp":"application/pgp-encrypted","asc":"application/pgp-signature","sig":"application/pgp-signature","prf":"application/pics-rules","p10":"application/pkcs10","p7m":"application/pkcs7-mime","p7c":"application/pkcs7-mime","p7s":"application/pkcs7-signature","p8":"application/pkcs8","ac":"application/pkix-attr-cert","cer":"application/pkix-cert","crl":"application/pkix-crl","pkipath":"application/pkix-pkipath","pki":"application/pkixcmp","pls":"application/pls+xml","ai":"application/postscript","eps":"application/postscript","ps":"application/postscript","cww":"application/prs.cww","pskcxml":"application/pskc+xml","rdf":"application/rdf+xml","rif":"application/reginfo+xml","rnc":"application/relax-ng-compact-syntax","rl":"application/resource-lists+xml","rld":"application/resource-lists-diff+xml","rs":"application/rls-services+xml","gbr":"application/rpki-ghostbusters","mft":"application/rpki-manifest","roa":"application/rpki-roa","rsd":"application/rsd+xml","rss":"application/rss+xml","rtf":"text/rtf","sbml":"application/sbml+xml","scq":"application/scvp-cv-request","scs":"application/scvp-cv-response","spq":"application/scvp-vp-request","spp":"application/scvp-vp-response","sdp":"application/sdp","setpay":"application/set-payment-initiation","setreg":"application/set-registration-initiation","shf":"application/shf+xml","smi":"application/smil+xml","smil":"application/smil+xml","rq":"application/sparql-query","srx":"application/sparql-results+xml","gram":"application/srgs","grxml":"application/srgs+xml","sru":"application/sru+xml","ssdl":"application/ssdl+xml","ssml":"application/ssml+xml","tei":"application/tei+xml","teicorpus":"application/tei+xml","tfi":"application/thraud+xml","tsd":"application/timestamped-data","plb":"application/vnd.3gpp.pic-bw-large","psb":"application/vnd.3gpp.pic-bw-small","pvb":"application/vnd.3gpp.pic-bw-var","tcap":"application/vnd.3gpp2.tcap","pwn":"application/vnd.3m.post-it-notes","aso":"application/vnd.accpac.simply.aso","imp":"application/vnd.accpac.simply.imp","acu":"application/vnd.acucobol","atc":"application/vnd.acucorp","acutc":"application/vnd.acucorp","air":"application/vnd.adobe.air-application-installer-package+zip","fcdt":"application/vnd.adobe.formscentral.fcdt","fxp":"application/vnd.adobe.fxp","fxpl":"application/vnd.adobe.fxp","xdp":"application/vnd.adobe.xdp+xml","xfdf":"application/vnd.adobe.xfdf","ahead":"application/vnd.ahead.space","azf":"application/vnd.airzip.filesecure.azf","azs":"application/vnd.airzip.filesecure.azs","azw":"application/vnd.amazon.ebook","acc":"application/vnd.americandynamics.acc","ami":"application/vnd.amiga.ami","apk":"application/vnd.android.package-archive","cii":"application/vnd.anser-web-certificate-issue-initiation","fti":"application/vnd.anser-web-funds-transfer-initiation","atx":"application/vnd.antix.game-component","mpkg":"application/vnd.apple.installer+xml","m3u8":"application/vnd.apple.mpegurl","pkpass":"application/vnd.apple.pkpass","swi":"application/vnd.aristanetworks.swi","iota":"application/vnd.astraea-software.iota","aep":"application/vnd.audiograph","mpm":"application/vnd.blueice.multipass","bmi":"application/vnd.bmi","rep":"application/vnd.businessobjects","cdxml":"application/vnd.chemdraw+xml","mmd":"application/vnd.chipnuts.karaoke-mmd","cdy":"application/vnd.cinderella","cla":"application/vnd.claymore","rp9":"application/vnd.cloanto.rp9","c4g":"application/vnd.clonk.c4group","c4d":"application/vnd.clonk.c4group","c4f":"application/vnd.clonk.c4group","c4p":"application/vnd.clonk.c4group","c4u":"application/vnd.clonk.c4group","c11amc":"application/vnd.cluetrust.cartomobile-config","c11amz":"application/vnd.cluetrust.cartomobile-config-pkg","csp":"application/vnd.commonspace","cdbcmsg":"application/vnd.contact.cmsg","cmc":"application/vnd.cosmocaller","clkx":"application/vnd.crick.clicker","clkk":"application/vnd.crick.clicker.keyboard","clkp":"application/vnd.crick.clicker.palette","clkt":"application/vnd.crick.clicker.template","clkw":"application/vnd.crick.clicker.wordbank","wbs":"application/vnd.criticaltools.wbs+xml","pml":"application/vnd.ctc-posml","ppd":"application/vnd.cups-ppd","car":"application/vnd.curl.car","pcurl":"application/vnd.curl.pcurl","dart":"application/vnd.dart","rdz":"application/vnd.data-vision.rdz","uvf":"application/vnd.dece.data","uvvf":"application/vnd.dece.data","uvd":"application/vnd.dece.data","uvvd":"application/vnd.dece.data","uvt":"application/vnd.dece.ttml+xml","uvvt":"application/vnd.dece.ttml+xml","uvx":"application/vnd.dece.unspecified","uvvx":"application/vnd.dece.unspecified","uvz":"application/vnd.dece.zip","uvvz":"application/vnd.dece.zip","fe_launch":"application/vnd.denovo.fcselayout-link","dna":"application/vnd.dna","mlp":"application/vnd.dolby.mlp","dpg":"application/vnd.dpgraph","dfac":"application/vnd.dreamfactory","kpxx":"application/vnd.ds-keypoint","ait":"application/vnd.dvb.ait","svc":"application/vnd.dvb.service","geo":"application/vnd.dynageo","mag":"application/vnd.ecowin.chart","nml":"application/vnd.enliven","esf":"application/vnd.epson.esf","msf":"application/vnd.epson.msf","qam":"application/vnd.epson.quickanime","slt":"application/vnd.epson.salt","ssf":"application/vnd.epson.ssf","es3":"application/vnd.eszigno3+xml","et3":"application/vnd.eszigno3+xml","ez2":"application/vnd.ezpix-album","ez3":"application/vnd.ezpix-package","fdf":"application/vnd.fdf","mseed":"application/vnd.fdsn.mseed","seed":"application/vnd.fdsn.seed","dataless":"application/vnd.fdsn.seed","gph":"application/vnd.flographit","ftc":"application/vnd.fluxtime.clip","fm":"application/vnd.framemaker","frame":"application/vnd.framemaker","maker":"application/vnd.framemaker","book":"application/vnd.framemaker","fnc":"application/vnd.frogans.fnc","ltf":"application/vnd.frogans.ltf","fsc":"application/vnd.fsc.weblaunch","oas":"application/vnd.fujitsu.oasys","oa2":"application/vnd.fujitsu.oasys2","oa3":"application/vnd.fujitsu.oasys3","fg5":"application/vnd.fujitsu.oasysgp","bh2":"application/vnd.fujitsu.oasysprs","ddd":"application/vnd.fujixerox.ddd","xdw":"application/vnd.fujixerox.docuworks","xbd":"application/vnd.fujixerox.docuworks.binder","fzs":"application/vnd.fuzzysheet","txd":"application/vnd.genomatix.tuxedo","ggb":"application/vnd.geogebra.file","ggt":"application/vnd.geogebra.tool","gex":"application/vnd.geometry-explorer","gre":"application/vnd.geometry-explorer","gxt":"application/vnd.geonext","g2w":"application/vnd.geoplan","g3w":"application/vnd.geospace","gmx":"application/vnd.gmx","gdoc":"application/vnd.google-apps.document","gslides":"application/vnd.google-apps.presentation","gsheet":"application/vnd.google-apps.spreadsheet","kml":"application/vnd.google-earth.kml+xml","kmz":"application/vnd.google-earth.kmz","gqf":"application/vnd.grafeq","gqs":"application/vnd.grafeq","gac":"application/vnd.groove-account","ghf":"application/vnd.groove-help","gim":"application/vnd.groove-identity-message","grv":"application/vnd.groove-injector","gtm":"application/vnd.groove-tool-message","tpl":"application/vnd.groove-tool-template","vcg":"application/vnd.groove-vcard","hal":"application/vnd.hal+xml","zmm":"application/vnd.handheld-entertainment+xml","hbci":"application/vnd.hbci","les":"application/vnd.hhe.lesson-player","hpgl":"application/vnd.hp-hpgl","hpid":"application/vnd.hp-hpid","hps":"application/vnd.hp-hps","jlt":"application/vnd.hp-jlyt","pcl":"application/vnd.hp-pcl","pclxl":"application/vnd.hp-pclxl","sfd-hdstx":"application/vnd.hydrostatix.sof-data","mpy":"application/vnd.ibm.minipay","afp":"application/vnd.ibm.modcap","listafp":"application/vnd.ibm.modcap","list3820":"application/vnd.ibm.modcap","irm":"application/vnd.ibm.rights-management","sc":"application/vnd.ibm.secure-container","icc":"application/vnd.iccprofile","icm":"application/vnd.iccprofile","igl":"application/vnd.igloader","ivp":"application/vnd.immervision-ivp","ivu":"application/vnd.immervision-ivu","igm":"application/vnd.insors.igm","xpw":"application/vnd.intercon.formnet","xpx":"application/vnd.intercon.formnet","i2g":"application/vnd.intergeo","qbo":"application/vnd.intu.qbo","qfx":"application/vnd.intu.qfx","rcprofile":"application/vnd.ipunplugged.rcprofile","irp":"application/vnd.irepository.package+xml","xpr":"application/vnd.is-xpr","fcs":"application/vnd.isac.fcs","jam":"application/vnd.jam","rms":"application/vnd.jcp.javame.midlet-rms","jisp":"application/vnd.jisp","joda":"application/vnd.joost.joda-archive","ktz":"application/vnd.kahootz","ktr":"application/vnd.kahootz","karbon":"application/vnd.kde.karbon","chrt":"application/vnd.kde.kchart","kfo":"application/vnd.kde.kformula","flw":"application/vnd.kde.kivio","kon":"application/vnd.kde.kontour","kpr":"application/vnd.kde.kpresenter","kpt":"application/vnd.kde.kpresenter","ksp":"application/vnd.kde.kspread","kwd":"application/vnd.kde.kword","kwt":"application/vnd.kde.kword","htke":"application/vnd.kenameaapp","kia":"application/vnd.kidspiration","kne":"application/vnd.kinar","knp":"application/vnd.kinar","skp":"application/vnd.koan","skd":"application/vnd.koan","skt":"application/vnd.koan","skm":"application/vnd.koan","sse":"application/vnd.kodak-descriptor","lasxml":"application/vnd.las.las+xml","lbd":"application/vnd.llamagraphics.life-balance.desktop","lbe":"application/vnd.llamagraphics.life-balance.exchange+xml","apr":"application/vnd.lotus-approach","pre":"application/vnd.lotus-freelance","nsf":"application/vnd.lotus-notes","org":"application/vnd.lotus-organizer","scm":"application/vnd.lotus-screencam","lwp":"application/vnd.lotus-wordpro","portpkg":"application/vnd.macports.portpkg","mcd":"application/vnd.mcd","mc1":"application/vnd.medcalcdata","cdkey":"application/vnd.mediastation.cdkey","mwf":"application/vnd.mfer","mfm":"application/vnd.mfmp","flo":"application/vnd.micrografx.flo","igx":"application/vnd.micrografx.igx","mif":"application/vnd.mif","daf":"application/vnd.mobius.daf","dis":"application/vnd.mobius.dis","mbk":"application/vnd.mobius.mbk","mqy":"application/vnd.mobius.mqy","msl":"application/vnd.mobius.msl","plc":"application/vnd.mobius.plc","txf":"application/vnd.mobius.txf","mpn":"application/vnd.mophun.application","mpc":"application/vnd.mophun.certificate","xul":"application/vnd.mozilla.xul+xml","cil":"application/vnd.ms-artgalry","cab":"application/vnd.ms-cab-compressed","xls":"application/vnd.ms-excel","xlm":"application/vnd.ms-excel","xla":"application/vnd.ms-excel","xlc":"application/vnd.ms-excel","xlt":"application/vnd.ms-excel","xlw":"application/vnd.ms-excel","xlam":"application/vnd.ms-excel.addin.macroenabled.12","xlsb":"application/vnd.ms-excel.sheet.binary.macroenabled.12","xlsm":"application/vnd.ms-excel.sheet.macroenabled.12","xltm":"application/vnd.ms-excel.template.macroenabled.12","eot":"application/vnd.ms-fontobject","chm":"application/vnd.ms-htmlhelp","ims":"application/vnd.ms-ims","lrm":"application/vnd.ms-lrm","thmx":"application/vnd.ms-officetheme","cat":"application/vnd.ms-pki.seccat","stl":"application/vnd.ms-pki.stl","ppt":"application/vnd.ms-powerpoint","pps":"application/vnd.ms-powerpoint","pot":"application/vnd.ms-powerpoint","ppam":"application/vnd.ms-powerpoint.addin.macroenabled.12","pptm":"application/vnd.ms-powerpoint.presentation.macroenabled.12","sldm":"application/vnd.ms-powerpoint.slide.macroenabled.12","ppsm":"application/vnd.ms-powerpoint.slideshow.macroenabled.12","potm":"application/vnd.ms-powerpoint.template.macroenabled.12","mpp":"application/vnd.ms-project","mpt":"application/vnd.ms-project","docm":"application/vnd.ms-word.document.macroenabled.12","dotm":"application/vnd.ms-word.template.macroenabled.12","wps":"application/vnd.ms-works","wks":"application/vnd.ms-works","wcm":"application/vnd.ms-works","wdb":"application/vnd.ms-works","wpl":"application/vnd.ms-wpl","xps":"application/vnd.ms-xpsdocument","mseq":"application/vnd.mseq","mus":"application/vnd.musician","msty":"application/vnd.muvee.style","taglet":"application/vnd.mynfc","nlu":"application/vnd.neurolanguage.nlu","ntf":"application/vnd.nitf","nitf":"application/vnd.nitf","nnd":"application/vnd.noblenet-directory","nns":"application/vnd.noblenet-sealer","nnw":"application/vnd.noblenet-web","ngdat":"application/vnd.nokia.n-gage.data","n-gage":"application/vnd.nokia.n-gage.symbian.install","rpst":"application/vnd.nokia.radio-preset","rpss":"application/vnd.nokia.radio-presets","edm":"application/vnd.novadigm.edm","edx":"application/vnd.novadigm.edx","ext":"application/vnd.novadigm.ext","odc":"application/vnd.oasis.opendocument.chart","otc":"application/vnd.oasis.opendocument.chart-template","odb":"application/vnd.oasis.opendocument.database","odf":"application/vnd.oasis.opendocument.formula","odft":"application/vnd.oasis.opendocument.formula-template","odg":"application/vnd.oasis.opendocument.graphics","otg":"application/vnd.oasis.opendocument.graphics-template","odi":"application/vnd.oasis.opendocument.image","oti":"application/vnd.oasis.opendocument.image-template","odp":"application/vnd.oasis.opendocument.presentation","otp":"application/vnd.oasis.opendocument.presentation-template","ods":"application/vnd.oasis.opendocument.spreadsheet","ots":"application/vnd.oasis.opendocument.spreadsheet-template","odt":"application/vnd.oasis.opendocument.text","odm":"application/vnd.oasis.opendocument.text-master","ott":"application/vnd.oasis.opendocument.text-template","oth":"application/vnd.oasis.opendocument.text-web","xo":"application/vnd.olpc-sugar","dd2":"application/vnd.oma.dd2+xml","oxt":"application/vnd.openofficeorg.extension","pptx":"application/vnd.openxmlformats-officedocument.presentationml.presentation","sldx":"application/vnd.openxmlformats-officedocument.presentationml.slide","ppsx":"application/vnd.openxmlformats-officedocument.presentationml.slideshow","potx":"application/vnd.openxmlformats-officedocument.presentationml.template","xlsx":"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","xltx":"application/vnd.openxmlformats-officedocument.spreadsheetml.template","docx":"application/vnd.openxmlformats-officedocument.wordprocessingml.document","dotx":"application/vnd.openxmlformats-officedocument.wordprocessingml.template","mgp":"application/vnd.osgeo.mapguide.package","dp":"application/vnd.osgi.dp","esa":"application/vnd.osgi.subsystem","pdb":"application/x-pilot","pqa":"application/vnd.palm","oprc":"application/vnd.palm","paw":"application/vnd.pawaafile","str":"application/vnd.pg.format","ei6":"application/vnd.pg.osasli","efif":"application/vnd.picsel","wg":"application/vnd.pmi.widget","plf":"application/vnd.pocketlearn","pbd":"application/vnd.powerbuilder6","box":"application/vnd.previewsystems.box","mgz":"application/vnd.proteus.magazine","qps":"application/vnd.publishare-delta-tree","ptid":"application/vnd.pvi.ptid1","qxd":"application/vnd.quark.quarkxpress","qxt":"application/vnd.quark.quarkxpress","qwd":"application/vnd.quark.quarkxpress","qwt":"application/vnd.quark.quarkxpress","qxl":"application/vnd.quark.quarkxpress","qxb":"application/vnd.quark.quarkxpress","bed":"application/vnd.realvnc.bed","mxl":"application/vnd.recordare.musicxml","musicxml":"application/vnd.recordare.musicxml+xml","cryptonote":"application/vnd.rig.cryptonote","cod":"application/vnd.rim.cod","rm":"application/vnd.rn-realmedia","rmvb":"application/vnd.rn-realmedia-vbr","link66":"application/vnd.route66.link66+xml","st":"application/vnd.sailingtracker.track","see":"application/vnd.seemail","sema":"application/vnd.sema","semd":"application/vnd.semd","semf":"application/vnd.semf","ifm":"application/vnd.shana.informed.formdata","itp":"application/vnd.shana.informed.formtemplate","iif":"application/vnd.shana.informed.interchange","ipk":"application/vnd.shana.informed.package","twd":"application/vnd.simtech-mindmapper","twds":"application/vnd.simtech-mindmapper","mmf":"application/vnd.smaf","teacher":"application/vnd.smart.teacher","sdkm":"application/vnd.solent.sdkm+xml","sdkd":"application/vnd.solent.sdkm+xml","dxp":"application/vnd.spotfire.dxp","sfs":"application/vnd.spotfire.sfs","sdc":"application/vnd.stardivision.calc","sda":"application/vnd.stardivision.draw","sdd":"application/vnd.stardivision.impress","smf":"application/vnd.stardivision.math","sdw":"application/vnd.stardivision.writer","vor":"application/vnd.stardivision.writer","sgl":"application/vnd.stardivision.writer-global","smzip":"application/vnd.stepmania.package","sm":"application/vnd.stepmania.stepchart","sxc":"application/vnd.sun.xml.calc","stc":"application/vnd.sun.xml.calc.template","sxd":"application/vnd.sun.xml.draw","std":"application/vnd.sun.xml.draw.template","sxi":"application/vnd.sun.xml.impress","sti":"application/vnd.sun.xml.impress.template","sxm":"application/vnd.sun.xml.math","sxw":"application/vnd.sun.xml.writer","sxg":"application/vnd.sun.xml.writer.global","stw":"application/vnd.sun.xml.writer.template","sus":"application/vnd.sus-calendar","susp":"application/vnd.sus-calendar","svd":"application/vnd.svd","sis":"application/vnd.symbian.install","sisx":"application/vnd.symbian.install","xsm":"application/vnd.syncml+xml","bdm":"application/vnd.syncml.dm+wbxml","xdm":"application/vnd.syncml.dm+xml","tao":"application/vnd.tao.intent-module-archive","pcap":"application/vnd.tcpdump.pcap","cap":"application/vnd.tcpdump.pcap","dmp":"application/vnd.tcpdump.pcap","tmo":"application/vnd.tmobile-livetv","tpt":"application/vnd.trid.tpt","mxs":"application/vnd.triscape.mxs","tra":"application/vnd.trueapp","ufd":"application/vnd.ufdl","ufdl":"application/vnd.ufdl","utz":"application/vnd.uiq.theme","umj":"application/vnd.umajin","unityweb":"application/vnd.unity","uoml":"application/vnd.uoml+xml","vcx":"application/vnd.vcx","vsd":"application/vnd.visio","vst":"application/vnd.visio","vss":"application/vnd.visio","vsw":"application/vnd.visio","vis":"application/vnd.visionary","vsf":"application/vnd.vsf","wbxml":"application/vnd.wap.wbxml","wmlc":"application/vnd.wap.wmlc","wmlsc":"application/vnd.wap.wmlscriptc","wtb":"application/vnd.webturbo","nbp":"application/vnd.wolfram.player","wpd":"application/vnd.wordperfect","wqd":"application/vnd.wqd","stf":"application/vnd.wt.stf","xar":"application/vnd.xara","xfdl":"application/vnd.xfdl","hvd":"application/vnd.yamaha.hv-dic","hvs":"application/vnd.yamaha.hv-script","hvp":"application/vnd.yamaha.hv-voice","osf":"application/vnd.yamaha.openscoreformat","osfpvg":"application/vnd.yamaha.openscoreformat.osfpvg+xml","saf":"application/vnd.yamaha.smaf-audio","spf":"application/vnd.yamaha.smaf-phrase","cmp":"application/vnd.yellowriver-custom-menu","zir":"application/vnd.zul","zirz":"application/vnd.zul","zaz":"application/vnd.zzazz.deck+xml","vxml":"application/voicexml+xml","wgt":"application/widget","hlp":"application/winhlp","wsdl":"application/wsdl+xml","wspolicy":"application/wspolicy+xml","7z":"application/x-7z-compressed","abw":"application/x-abiword","ace":"application/x-ace-compressed","aab":"application/x-authorware-bin","x32":"application/x-authorware-bin","u32":"application/x-authorware-bin","vox":"application/x-authorware-bin","aam":"application/x-authorware-map","aas":"application/x-authorware-seg","bcpio":"application/x-bcpio","torrent":"application/x-bittorrent","blb":"application/x-blorb","blorb":"application/x-blorb","bz":"application/x-bzip","bz2":"application/x-bzip2","boz":"application/x-bzip2","cbr":"application/x-cbr","cba":"application/x-cbr","cbt":"application/x-cbr","cbz":"application/x-cbr","cb7":"application/x-cbr","vcd":"application/x-cdlink","cfs":"application/x-cfs-compressed","chat":"application/x-chat","pgn":"application/x-chess-pgn","crx":"application/x-chrome-extension","cco":"application/x-cocoa","nsc":"application/x-conference","cpio":"application/x-cpio","csh":"application/x-csh","udeb":"application/x-debian-package","dgc":"application/x-dgc-compressed","dir":"application/x-director","dcr":"application/x-director","dxr":"application/x-director","cst":"application/x-director","cct":"application/x-director","cxt":"application/x-director","w3d":"application/x-director","fgd":"application/x-director","swa":"application/x-director","wad":"application/x-doom","ncx":"application/x-dtbncx+xml","dtb":"application/x-dtbook+xml","res":"application/x-dtbresource+xml","dvi":"application/x-dvi","evy":"application/x-envoy","eva":"application/x-eva","bdf":"application/x-font-bdf","gsf":"application/x-font-ghostscript","psf":"application/x-font-linux-psf","otf":"font/opentype","pcf":"application/x-font-pcf","snf":"application/x-font-snf","ttf":"application/x-font-ttf","ttc":"application/x-font-ttf","pfa":"application/x-font-type1","pfb":"application/x-font-type1","pfm":"application/x-font-type1","afm":"application/x-font-type1","arc":"application/x-freearc","spl":"application/x-futuresplash","gca":"application/x-gca-compressed","ulx":"application/x-glulx","gnumeric":"application/x-gnumeric","gramps":"application/x-gramps-xml","gtar":"application/x-gtar","hdf":"application/x-hdf","php":"application/x-httpd-php","install":"application/x-install-instructions","jardiff":"application/x-java-archive-diff","jnlp":"application/x-java-jnlp-file","latex":"application/x-latex","luac":"application/x-lua-bytecode","lzh":"application/x-lzh-compressed","lha":"application/x-lzh-compressed","run":"application/x-makeself","mie":"application/x-mie","prc":"application/x-pilot","mobi":"application/x-mobipocket-ebook","application":"application/x-ms-application","lnk":"application/x-ms-shortcut","wmd":"application/x-ms-wmd","wmz":"application/x-msmetafile","xbap":"application/x-ms-xbap","mdb":"application/x-msaccess","obd":"application/x-msbinder","crd":"application/x-mscardfile","clp":"application/x-msclip","com":"application/x-msdownload","bat":"application/x-msdownload","mvb":"application/x-msmediaview","m13":"application/x-msmediaview","m14":"application/x-msmediaview","wmf":"application/x-msmetafile","emf":"application/x-msmetafile","emz":"application/x-msmetafile","mny":"application/x-msmoney","pub":"application/x-mspublisher","scd":"application/x-msschedule","trm":"application/x-msterminal","wri":"application/x-mswrite","nc":"application/x-netcdf","cdf":"application/x-netcdf","pac":"application/x-ns-proxy-autoconfig","nzb":"application/x-nzb","pl":"application/x-perl","pm":"application/x-perl","p12":"application/x-pkcs12","pfx":"application/x-pkcs12","p7b":"application/x-pkcs7-certificates","spc":"application/x-pkcs7-certificates","p7r":"application/x-pkcs7-certreqresp","rar":"application/x-rar-compressed","rpm":"application/x-redhat-package-manager","ris":"application/x-research-info-systems","sea":"application/x-sea","sh":"application/x-sh","shar":"application/x-shar","swf":"application/x-shockwave-flash","xap":"application/x-silverlight-app","sql":"application/x-sql","sit":"application/x-stuffit","sitx":"application/x-stuffitx","srt":"application/x-subrip","sv4cpio":"application/x-sv4cpio","sv4crc":"application/x-sv4crc","t3":"application/x-t3vm-image","gam":"application/x-tads","tar":"application/x-tar","tcl":"application/x-tcl","tk":"application/x-tcl","tex":"application/x-tex","tfm":"application/x-tex-tfm","texinfo":"application/x-texinfo","texi":"application/x-texinfo","obj":"application/x-tgif","ustar":"application/x-ustar","src":"application/x-wais-source","webapp":"application/x-web-app-manifest+json","der":"application/x-x509-ca-cert","crt":"application/x-x509-ca-cert","pem":"application/x-x509-ca-cert","fig":"application/x-xfig","xlf":"application/x-xliff+xml","xpi":"application/x-xpinstall","xz":"application/x-xz","z1":"application/x-zmachine","z2":"application/x-zmachine","z3":"application/x-zmachine","z4":"application/x-zmachine","z5":"application/x-zmachine","z6":"application/x-zmachine","z7":"application/x-zmachine","z8":"application/x-zmachine","xaml":"application/xaml+xml","xdf":"application/xcap-diff+xml","xenc":"application/xenc+xml","xhtml":"application/xhtml+xml","xht":"application/xhtml+xml","xml":"text/xml","xsl":"application/xml","xsd":"application/xml","rng":"application/xml","dtd":"application/xml-dtd","xop":"application/xop+xml","xpl":"application/xproc+xml","xslt":"application/xslt+xml","xspf":"application/xspf+xml","mxml":"application/xv+xml","xhvml":"application/xv+xml","xvml":"application/xv+xml","xvm":"application/xv+xml","yang":"application/yang","yin":"application/yin+xml","zip":"application/zip","3gpp":"video/3gpp","adp":"audio/adpcm","au":"audio/basic","snd":"audio/basic","mid":"audio/midi","midi":"audio/midi","kar":"audio/midi","rmi":"audio/midi","mp3":"audio/mpeg","m4a":"audio/x-m4a","mp4a":"audio/mp4","mpga":"audio/mpeg","mp2":"audio/mpeg","mp2a":"audio/mpeg","m2a":"audio/mpeg","m3a":"audio/mpeg","oga":"audio/ogg","ogg":"audio/ogg","spx":"audio/ogg","s3m":"audio/s3m","sil":"audio/silk","uva":"audio/vnd.dece.audio","uvva":"audio/vnd.dece.audio","eol":"audio/vnd.digital-winds","dra":"audio/vnd.dra","dts":"audio/vnd.dts","dtshd":"audio/vnd.dts.hd","lvp":"audio/vnd.lucent.voice","pya":"audio/vnd.ms-playready.media.pya","ecelp4800":"audio/vnd.nuera.ecelp4800","ecelp7470":"audio/vnd.nuera.ecelp7470","ecelp9600":"audio/vnd.nuera.ecelp9600","rip":"audio/vnd.rip","wav":"audio/x-wav","weba":"audio/webm","aac":"audio/x-aac","aif":"audio/x-aiff","aiff":"audio/x-aiff","aifc":"audio/x-aiff","caf":"audio/x-caf","flac":"audio/x-flac","mka":"audio/x-matroska","m3u":"audio/x-mpegurl","wax":"audio/x-ms-wax","wma":"audio/x-ms-wma","ram":"audio/x-pn-realaudio","ra":"audio/x-realaudio","rmp":"audio/x-pn-realaudio-plugin","xm":"audio/xm","cdx":"chemical/x-cdx","cif":"chemical/x-cif","cmdf":"chemical/x-cmdf","cml":"chemical/x-cml","csml":"chemical/x-csml","xyz":"chemical/x-xyz","bmp":"image/x-ms-bmp","cgm":"image/cgm","g3":"image/g3fax","gif":"image/gif","ief":"image/ief","jpeg":"image/jpeg","jpg":"image/jpeg","jpe":"image/jpeg","ktx":"image/ktx","png":"image/png","btif":"image/prs.btif","sgi":"image/sgi","svg":"image/svg+xml","svgz":"image/svg+xml","tiff":"image/tiff","tif":"image/tiff","psd":"image/vnd.adobe.photoshop","uvi":"image/vnd.dece.graphic","uvvi":"image/vnd.dece.graphic","uvg":"image/vnd.dece.graphic","uvvg":"image/vnd.dece.graphic","djvu":"image/vnd.djvu","djv":"image/vnd.djvu","sub":"text/vnd.dvb.subtitle","dwg":"image/vnd.dwg","dxf":"image/vnd.dxf","fbs":"image/vnd.fastbidsheet","fpx":"image/vnd.fpx","fst":"image/vnd.fst","mmr":"image/vnd.fujixerox.edmics-mmr","rlc":"image/vnd.fujixerox.edmics-rlc","mdi":"image/vnd.ms-modi","wdp":"image/vnd.ms-photo","npx":"image/vnd.net-fpx","wbmp":"image/vnd.wap.wbmp","xif":"image/vnd.xiff","webp":"image/webp","3ds":"image/x-3ds","ras":"image/x-cmu-raster","cmx":"image/x-cmx","fh":"image/x-freehand","fhc":"image/x-freehand","fh4":"image/x-freehand","fh5":"image/x-freehand","fh7":"image/x-freehand","ico":"image/x-icon","jng":"image/x-jng","sid":"image/x-mrsid-image","pcx":"image/x-pcx","pic":"image/x-pict","pct":"image/x-pict","pnm":"image/x-portable-anymap","pbm":"image/x-portable-bitmap","pgm":"image/x-portable-graymap","ppm":"image/x-portable-pixmap","rgb":"image/x-rgb","tga":"image/x-tga","xbm":"image/x-xbitmap","xpm":"image/x-xpixmap","xwd":"image/x-xwindowdump","eml":"message/rfc822","mime":"message/rfc822","igs":"model/iges","iges":"model/iges","msh":"model/mesh","mesh":"model/mesh","silo":"model/mesh","dae":"model/vnd.collada+xml","dwf":"model/vnd.dwf","gdl":"model/vnd.gdl","gtw":"model/vnd.gtw","mts":"model/vnd.mts","vtu":"model/vnd.vtu","wrl":"model/vrml","vrml":"model/vrml","x3db":"model/x3d+binary","x3dbz":"model/x3d+binary","x3dv":"model/x3d+vrml","x3dvz":"model/x3d+vrml","x3d":"model/x3d+xml","x3dz":"model/x3d+xml","appcache":"text/cache-manifest","manifest":"text/cache-manifest","ics":"text/calendar","ifb":"text/calendar","coffee":"text/coffeescript","litcoffee":"text/coffeescript","css":"text/css","csv":"text/csv","hjson":"text/hjson","html":"text/html","htm":"text/html","shtml":"text/html","jade":"text/jade","jsx":"text/jsx","less":"text/less","mml":"text/mathml","n3":"text/n3","txt":"text/plain","text":"text/plain","conf":"text/plain","def":"text/plain","list":"text/plain","log":"text/plain","in":"text/plain","ini":"text/plain","dsc":"text/prs.lines.tag","rtx":"text/richtext","sgml":"text/sgml","sgm":"text/sgml","slim":"text/slim","slm":"text/slim","stylus":"text/stylus","styl":"text/stylus","tsv":"text/tab-separated-values","t":"text/troff","tr":"text/troff","roff":"text/troff","man":"text/troff","me":"text/troff","ms":"text/troff","ttl":"text/turtle","uri":"text/uri-list","uris":"text/uri-list","urls":"text/uri-list","vcard":"text/vcard","curl":"text/vnd.curl","dcurl":"text/vnd.curl.dcurl","mcurl":"text/vnd.curl.mcurl","scurl":"text/vnd.curl.scurl","fly":"text/vnd.fly","flx":"text/vnd.fmi.flexstor","gv":"text/vnd.graphviz","3dml":"text/vnd.in3d.3dml","spot":"text/vnd.in3d.spot","jad":"text/vnd.sun.j2me.app-descriptor","wml":"text/vnd.wap.wml","wmls":"text/vnd.wap.wmlscript","vtt":"text/vtt","s":"text/x-asm","asm":"text/x-asm","c":"text/x-c","cc":"text/x-c","cxx":"text/x-c","cpp":"text/x-c","h":"text/x-c","hh":"text/x-c","dic":"text/x-c","htc":"text/x-component","f":"text/x-fortran","for":"text/x-fortran","f77":"text/x-fortran","f90":"text/x-fortran","hbs":"text/x-handlebars-template","java":"text/x-java-source","lua":"text/x-lua","markdown":"text/x-markdown","md":"text/x-markdown","mkd":"text/x-markdown","nfo":"text/x-nfo","opml":"text/x-opml","p":"text/x-pascal","pas":"text/x-pascal","pde":"text/x-processing","sass":"text/x-sass","scss":"text/x-scss","etx":"text/x-setext","sfv":"text/x-sfv","ymp":"text/x-suse-ymp","uu":"text/x-uuencode","vcs":"text/x-vcalendar","vcf":"text/x-vcard","yaml":"text/yaml","yml":"text/yaml","3gp":"video/3gpp","3g2":"video/3gpp2","h261":"video/h261","h263":"video/h263","h264":"video/h264","jpgv":"video/jpeg","jpm":"video/jpm","jpgm":"video/jpm","mj2":"video/mj2","mjp2":"video/mj2","ts":"video/mp2t","mp4":"video/mp4","mp4v":"video/mp4","mpg4":"video/mp4","mpeg":"video/mpeg","mpg":"video/mpeg","mpe":"video/mpeg","m1v":"video/mpeg","m2v":"video/mpeg","ogv":"video/ogg","qt":"video/quicktime","mov":"video/quicktime","uvh":"video/vnd.dece.hd","uvvh":"video/vnd.dece.hd","uvm":"video/vnd.dece.mobile","uvvm":"video/vnd.dece.mobile","uvp":"video/vnd.dece.pd","uvvp":"video/vnd.dece.pd","uvs":"video/vnd.dece.sd","uvvs":"video/vnd.dece.sd","uvv":"video/vnd.dece.video","uvvv":"video/vnd.dece.video","dvb":"video/vnd.dvb.file","fvt":"video/vnd.fvt","mxu":"video/vnd.mpegurl","m4u":"video/vnd.mpegurl","pyv":"video/vnd.ms-playready.media.pyv","uvu":"video/vnd.uvvu.mp4","uvvu":"video/vnd.uvvu.mp4","viv":"video/vnd.vivo","webm":"video/webm","f4v":"video/x-f4v","fli":"video/x-fli","flv":"video/x-flv","m4v":"video/x-m4v","mkv":"video/x-matroska","mk3d":"video/x-matroska","mks":"video/x-matroska","mng":"video/x-mng","asf":"video/x-ms-asf","asx":"video/x-ms-asf","vob":"video/x-ms-vob","wm":"video/x-ms-wm","wmv":"video/x-ms-wmv","wmx":"video/x-ms-wmx","wvx":"video/x-ms-wvx","avi":"video/x-msvideo","movie":"video/x-sgi-movie","smv":"video/x-smv","ice":"x-conference/x-cooltalk"} /***/ }), -/* 107 */ +/* 108 */ /***/ (function(module, exports) { /* eslint complexity: 0 */ @@ -21422,13 +21637,13 @@ module.exports = mimeOfBuffer; /***/ }), -/* 108 */ +/* 109 */ /***/ (function(module, exports, __webpack_require__) { -const fs = __webpack_require__(31); -const path = __webpack_require__(24); -const mime = __webpack_require__(56); -const EventEmitter = __webpack_require__(13); +const fs = __webpack_require__(30); +const path = __webpack_require__(25); +const mime = __webpack_require__(57); +const EventEmitter = __webpack_require__(14); const Stream = __webpack_require__(37); class ResponseStream extends Stream.Readable { @@ -21555,7 +21770,7 @@ module.exports = { /***/ }), -/* 109 */ +/* 110 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -22053,7 +22268,7 @@ var objectKeys = Object.keys || function (obj) { /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) /***/ }), -/* 110 */ +/* 111 */ /***/ (function(module, exports) { module.exports = function isBuffer(arg) { @@ -22064,7 +22279,7 @@ module.exports = function isBuffer(arg) { } /***/ }), -/* 111 */ +/* 112 */ /***/ (function(module, exports) { if (typeof Object.create === 'function') { @@ -22093,10 +22308,10 @@ if (typeof Object.create === 'function') { /***/ }), -/* 112 */ +/* 113 */ /***/ (function(module, exports, __webpack_require__) { -const { register } = __webpack_require__(58); +const { register } = __webpack_require__(59); const Messages = { CLIENT_INVALID_OPTION: (prop, must) => `The ${prop} option must be ${must}`, @@ -22194,7 +22409,7 @@ for (const [name, message] of Object.entries(Messages)) register(name, message); /***/ }), -/* 113 */ +/* 114 */ /***/ (function(module, exports) { exports.endianness = function () { return 'LE' }; @@ -22245,7 +22460,7 @@ exports.EOL = '\n'; /***/ }), -/* 114 */ +/* 115 */ /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(process) {const Constants = __webpack_require__(0); @@ -22277,18 +22492,18 @@ module.exports = UserAgentManager; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(8))) /***/ }), -/* 115 */ +/* 116 */ /***/ (function(module, exports, __webpack_require__) { module.exports = { - sequential: __webpack_require__(116), - burst: __webpack_require__(117), - RequestHandler: __webpack_require__(118), + sequential: __webpack_require__(117), + burst: __webpack_require__(118), + RequestHandler: __webpack_require__(119), }; /***/ }), -/* 116 */ +/* 117 */ /***/ (function(module, exports) { module.exports = function sequential() { @@ -22310,7 +22525,7 @@ module.exports = function sequential() { /***/ }), -/* 117 */ +/* 118 */ /***/ (function(module, exports) { module.exports = function burst() { @@ -22329,10 +22544,10 @@ module.exports = function burst() { /***/ }), -/* 118 */ +/* 119 */ /***/ (function(module, exports, __webpack_require__) { -const DiscordAPIError = __webpack_require__(60); +const DiscordAPIError = __webpack_require__(61); class RequestHandler { constructor(manager, handler) { @@ -22405,10 +22620,10 @@ module.exports = RequestHandler; /***/ }), -/* 119 */ +/* 120 */ /***/ (function(module, exports, __webpack_require__) { -const querystring = __webpack_require__(32); +const querystring = __webpack_require__(31); const snekfetch = __webpack_require__(36); class APIRequest { @@ -22451,7 +22666,7 @@ module.exports = APIRequest; /***/ }), -/* 120 */ +/* 121 */ /***/ (function(module, exports, __webpack_require__) { const util = __webpack_require__(40); @@ -22491,876 +22706,21 @@ function buildRoute(manager) { module.exports = buildRoute; -/***/ }), -/* 121 */ -/***/ (function(module, exports, __webpack_require__) { - -/* WEBPACK VAR INJECTION */(function(Buffer) {const path = __webpack_require__(24); -const fs = __webpack_require__(31); -const snekfetch = __webpack_require__(36); - -const Util = __webpack_require__(7); -const User = __webpack_require__(25); -const Message = __webpack_require__(44); -const Guild = __webpack_require__(29); -const Channel = __webpack_require__(15); -const GuildMember = __webpack_require__(17); -const Role = __webpack_require__(18); -const Emoji = __webpack_require__(34); -const ReactionEmoji = __webpack_require__(46); -const { Error, TypeError } = __webpack_require__(4); - -/** - * The DataResolver identifies different objects and tries to resolve a specific piece of information from them, e.g. - * extracting a User from a Message object. - * @private - */ -class ClientDataResolver { - /** - * @param {Client} client The client the resolver is for - */ - constructor(client) { - this.client = client; - } - - /** - * Data that resolves to give a User object. This can be: - * * A User object - * * A Snowflake - * * A Message object (resolves to the message author) - * * A GuildMember object - * @typedef {User|Snowflake|Message|GuildMember} UserResolvable - */ - - /** - * Resolves a UserResolvable to a User object. - * @param {UserResolvable} user The UserResolvable to identify - * @returns {?User} - */ - resolveUser(user) { - if (user instanceof User) return user; - if (typeof user === 'string') return this.client.users.get(user) || null; - if (user instanceof GuildMember) return user.user; - if (user instanceof Message) return user.author; - return null; - } - - /** - * Resolves a UserResolvable to a user ID string. - * @param {UserResolvable} user The UserResolvable to identify - * @returns {?Snowflake} - */ - resolveUserID(user) { - if (user instanceof User || user instanceof GuildMember) return user.id; - if (typeof user === 'string') return user || null; - if (user instanceof Message) return user.author.id; - return null; - } - - /** - * Data that resolves to give a Guild object. This can be: - * * A Guild object - * * A Snowflake - * @typedef {Guild|Snowflake} GuildResolvable - */ - - /** - * Resolves a GuildResolvable to a Guild object. - * @param {GuildResolvable} guild The GuildResolvable to identify - * @returns {?Guild} - */ - resolveGuild(guild) { - if (guild instanceof Guild) return guild; - if (typeof guild === 'string') return this.client.guilds.get(guild) || null; - return null; - } - - /** - * Data that resolves to give a GuildMember object. This can be: - * * A GuildMember object - * * A User object - * @typedef {GuildMember|User} GuildMemberResolvable - */ - - /** - * Resolves a GuildMemberResolvable to a GuildMember object. - * @param {GuildResolvable} guild The guild that the member is part of - * @param {UserResolvable} user The user that is part of the guild - * @returns {?GuildMember} - */ - resolveGuildMember(guild, user) { - if (user instanceof GuildMember) return user; - guild = this.resolveGuild(guild); - user = this.resolveUser(user); - if (!guild || !user) return null; - return guild.members.get(user.id) || null; - } - - /** - * Data that can be resolved to a Role object. This can be: - * * A Role - * * A Snowflake - * @typedef {Role|Snowflake} RoleResolvable - */ - - /** - * Resolves a RoleResolvable to a Role object. - * @param {GuildResolvable} guild The guild that this role is part of - * @param {RoleResolvable} role The role resolvable to resolve - * @returns {?Role} - */ - resolveRole(guild, role) { - if (role instanceof Role) return role; - guild = this.resolveGuild(guild); - if (!guild) return null; - if (typeof role === 'string') return guild.roles.get(role); - return null; - } - - /** - * Data that can be resolved to give a Channel object. This can be: - * * A Channel object - * * A Snowflake - * @typedef {Channel|Snowflake} ChannelResolvable - */ - - /** - * Resolves a ChannelResolvable to a Channel object. - * @param {ChannelResolvable} channel The channel resolvable to resolve - * @returns {?Channel} - */ - resolveChannel(channel) { - if (channel instanceof Channel) return channel; - if (typeof channel === 'string') return this.client.channels.get(channel) || null; - return null; - } - - /** - * Resolves a ChannelResolvable to a channel ID. - * @param {ChannelResolvable} channel The channel resolvable to resolve - * @returns {?Snowflake} - */ - resolveChannelID(channel) { - if (channel instanceof Channel) return channel.id; - if (typeof channel === 'string') return channel; - return null; - } - - /** - * Data that can be resolved to give an invite code. This can be: - * * An invite code - * * An invite URL - * @typedef {string} InviteResolvable - */ - - /** - * Resolves InviteResolvable to an invite code. - * @param {InviteResolvable} data The invite resolvable to resolve - * @returns {string} - */ - resolveInviteCode(data) { - const inviteRegex = /discord(?:app\.com\/invite|\.gg)\/([\w-]{2,255})/i; - const match = inviteRegex.exec(data); - if (match && match[1]) return match[1]; - return data; - } - - /** - * Resolves a Base64Resolvable, a string, or a BufferResolvable to a Base 64 image. - * @param {BufferResolvable|Base64Resolvable} image The image to be resolved - * @returns {Promise} - */ - async resolveImage(image) { - if (!image) return null; - if (typeof image === 'string' && image.startsWith('data:')) { - return image; - } - const file = await this.resolveFile(image); - return this.resolveBase64(file); - } - - /** - * Data that resolves to give a Base64 string, typically for image uploading. This can be: - * * A Buffer - * * A base64 string - * @typedef {Buffer|string} Base64Resolvable - */ - - /** - * Resolves a Base64Resolvable to a Base 64 image. - * @param {Base64Resolvable} data The base 64 resolvable you want to resolve - * @returns {?string} - */ - resolveBase64(data) { - if (data instanceof Buffer) return `data:image/jpg;base64,${data.toString('base64')}`; - return data; - } - - /** - * Data that can be resolved to give a Buffer. This can be: - * * A Buffer - * * The path to a local file - * * A URL - * @typedef {string|Buffer} BufferResolvable - */ - - /** - * @external Stream - * @see {@link https://nodejs.org/api/stream.html} - */ - - /** - * Resolves a BufferResolvable to a Buffer. - * @param {BufferResolvable|Stream} resource The buffer or stream resolvable to resolve - * @returns {Promise} - */ - resolveFile(resource) { - if (resource instanceof Buffer) return Promise.resolve(resource); - if (this.client.browser && resource instanceof ArrayBuffer) return Promise.resolve(Util.convertToBuffer(resource)); - - if (typeof resource === 'string') { - return new Promise((resolve, reject) => { - if (/^https?:\/\//.test(resource)) { - snekfetch.get(resource) - .end((err, res) => { - if (err) return reject(err); - if (!(res.body instanceof Buffer)) return reject(new TypeError('REQ_BODY_TYPE')); - return resolve(res.body); - }); - } else { - const file = path.resolve(resource); - fs.stat(file, (err, stats) => { - if (err) return reject(err); - if (!stats || !stats.isFile()) return reject(new Error('FILE_NOT_FOUND', file)); - fs.readFile(file, (err2, data) => { - if (err2) reject(err2); else resolve(data); - }); - return null; - }); - } - }); - } else if (resource.pipe && typeof resource.pipe === 'function') { - return new Promise((resolve, reject) => { - const buffers = []; - resource.once('error', reject); - resource.on('data', data => buffers.push(data)); - resource.once('end', () => resolve(Buffer.concat(buffers))); - }); - } - - return Promise.reject(new TypeError('REQ_RESOURCE_TYPE')); - } - - /** - * Data that can be resolved to give an emoji identifier. This can be: - * * The unicode representation of an emoji - * * A custom emoji ID - * * An Emoji object - * * A ReactionEmoji object - * @typedef {string|Snowflake|Emoji|ReactionEmoji} EmojiIdentifierResolvable - */ - - /** - * Resolves an EmojiResolvable to an emoji identifier. - * @param {EmojiIdentifierResolvable} emoji The emoji resolvable to resolve - * @returns {?string} - */ - resolveEmojiIdentifier(emoji) { - if (emoji instanceof Emoji || emoji instanceof ReactionEmoji) return emoji.identifier; - if (typeof emoji === 'string') { - if (this.client.emojis.has(emoji)) return this.client.emojis.get(emoji).identifier; - else if (!emoji.includes('%')) return encodeURIComponent(emoji); - else return emoji; - } - return null; - } -} - -module.exports = ClientDataResolver; - -/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5).Buffer)) - /***/ }), /* 122 */ /***/ (function(module, exports, __webpack_require__) { -const long = __webpack_require__(43); -const { TypeError } = __webpack_require__(4); - -/** - * @typedef {Object} MessageSearchOptions - * @property {string} [content] Message content - * @property {Snowflake} [maxID] Maximum ID for the filter - * @property {Snowflake} [minID] Minimum ID for the filter - * @property {string} [has] One of `link`, `embed`, `file`, `video`, `image`, or `sound`, - * or add `-` to negate (e.g. `-file`) - * @property {ChannelResolvable} [channel] Channel to limit search to (only for guild search endpoint) - * @property {UserResolvable} [author] Author to limit search - * @property {string} [authorType] One of `user`, `bot`, `webhook`, or add `-` to negate (e.g. `-webhook`) - * @property {string} [sortBy='recent'] `recent` or `relevant` - * @property {string} [sortOrder='descending'] `ascending` or `descending` - * @property {number} [contextSize=2] How many messages to get around the matched message (0 to 2) - * @property {number} [limit=25] Maximum number of results to get (1 to 25) - * @property {number} [offset=0] Offset the "pages" of results (since you can only see 25 at a time) - * @property {UserResolvable} [mentions] Mentioned user filter - * @property {boolean} [mentionsEveryone] If everyone is mentioned - * @property {string} [linkHostname] Filter links by hostname - * @property {string} [embedProvider] The name of an embed provider - * @property {string} [embedType] one of `image`, `video`, `url`, `rich`, or add `-` to negate (e.g. `-image`) - * @property {string} [attachmentFilename] The name of an attachment - * @property {string} [attachmentExtension] The extension of an attachment - * @property {Date} [before] Date to find messages before - * @property {Date} [after] Date to find messages before - * @property {Date} [during] Date to find messages during (range of date to date + 24 hours) - * @property {boolean} [nsfw=false] Include results from NSFW channels - */ - -/** - * @typedef {Object} MessageSearchResult - * @property {number} total Total result count - * @property {Array} results Array of message results - * The message which has triggered the result will have the `hit` property set to `true` - */ - -module.exports = function search(target, options) { - if (typeof options === 'string') options = { content: options }; - if (options.before) { - if (!(options.before instanceof Date)) options.before = new Date(options.before); - options.maxID = long.fromNumber(options.before.getTime() - 14200704e5).shiftLeft(22).toString(); - } - if (options.after) { - if (!(options.after instanceof Date)) options.after = new Date(options.after); - options.minID = long.fromNumber(options.after.getTime() - 14200704e5).shiftLeft(22).toString(); - } - if (options.during) { - if (!(options.during instanceof Date)) options.during = new Date(options.during); - const t = options.during.getTime() - 14200704e5; - options.minID = long.fromNumber(t).shiftLeft(22).toString(); - options.maxID = long.fromNumber(t + 864e5).shiftLeft(22).toString(); - } - if (options.channel) options.channel = target.client.resolver.resolveChannelID(options.channel); - if (options.author) options.author = target.client.resolver.resolveUserID(options.author); - if (options.mentions) options.mentions = target.client.resolver.resolveUserID(options.options.mentions); - if (options.sortOrder) { - options.sortOrder = { ascending: 'asc', descending: 'desc' }[options.sortOrder] || options.sortOrder; - } - options = { - content: options.content, - max_id: options.maxID, - min_id: options.minID, - has: options.has, - channel_id: options.channel, - author_id: options.author, - author_type: options.authorType, - context_size: options.contextSize, - sort_by: options.sortBy, - sort_order: options.sortOrder, - limit: options.limit, - offset: options.offset, - mentions: options.mentions, - mentions_everyone: options.mentionsEveryone, - link_hostname: options.linkHostname, - embed_provider: options.embedProvider, - embed_type: options.embedType, - attachment_filename: options.attachmentFilename, - attachment_extension: options.attachmentExtension, - include_nsfw: options.nsfw, - }; - - // Lazy load these because some of them use util - const Channel = __webpack_require__(15); - const Guild = __webpack_require__(29); - - if (!(target instanceof Channel || target instanceof Guild)) throw new TypeError('SEARCH_CHANNEL_TYPE'); - - let endpoint = target.client.api[target instanceof Channel ? 'channels' : 'guilds'](target.id).messages().search; - return endpoint.get({ query: options }).then(body => { - const results = body.messages.map(x => - x.map(m => target.client.channels.get(m.channel_id).messages.create(m, false)) - ); - return { - total: body.total_results, - results, - }; - }); -}; - - -/***/ }), -/* 123 */ -/***/ (function(module, exports, __webpack_require__) { - -const DataStore = __webpack_require__(11); -const MessageReaction = __webpack_require__(66); -/** - * Stores reactions. - * @private - * @extends {DataStore} - */ -class ReactionStore extends DataStore { - constructor(message, iterable) { - super(message.client, iterable); - this.message = message; - } - - create(data) { - const emojiID = data.emoji.id || decodeURIComponent(data.emoji.name); - - const existing = this.get(emojiID); - if (existing) return existing; - - const reaction = new MessageReaction(this.message, data.emoji, data.count, data.me); - this.set(emojiID, reaction); - - return reaction; - } -} - -module.exports = ReactionStore; - - -/***/ }), -/* 124 */ -/***/ (function(module, exports, __webpack_require__) { - -const DataStore = __webpack_require__(11); -const GuildMember = __webpack_require__(17); -const Constants = __webpack_require__(0); -const Collection = __webpack_require__(3); -const { Error } = __webpack_require__(4); - -/** - * Stores guild members. - * @extends {DataStore} - */ -class GuildMemberStore extends DataStore { - constructor(guild, iterable) { - super(guild.client, iterable); - this.guild = guild; - } - - create(data, cache = true) { - const existing = this.get(data.user.id); - if (existing) return existing; - - const member = new GuildMember(this.guild, data); - if (cache) this.set(member.id, member); - - return member; - } - - /** - * Options used to fetch a single member from a guild. - * @typedef {Object} FetchMemberOptions - * @property {UserResolvable} user The user to fetch - * @property {boolean} [cache=true] Whether or not to cache the fetched member - */ - - /** - * Options used to fetch multiple members from a guild. - * @typedef {Object} FetchMembersOptions - * @property {string} [query=''] Limit fetch to members with similar usernames - * @property {number} [limit=0] Maximum number of members to request - */ - - /** - * Fetch member(s) from Discord, even if they're offline. - * @param {UserResolvable|FetchMemberOptions|FetchMembersOptions} [options] If a UserResolvable, the user to fetch. - * If undefined, fetches all members. - * If a query, it limits the results to users with similar usernames. - * @returns {Promise|Promise>} - * @example - * // Fetch all members from a guild - * guild.members.fetch(); - * @example - * // Fetch a single member - * guild.members.fetch('66564597481480192'); - * guild.members.fetch(user); - * guild.members.fetch({ user, cache: false }); // Fetch and don't cache - * @example - * // Fetch by query - * guild.members.fetch({ - * query: 'hydra', - * }); - * guild.members.fetch({ - * query: 'hydra', - * limit: 10, - * }); - */ - fetch(options) { - if (!options) return this._fetchMany(); - const user = this.client.resolver.resolveUserID(options); - if (user) return this._fetchSingle({ user, cache: true }); - if (options.user) { - options.user = this.client.resolver.resolveUserID(options.user); - if (options.user) return this._fetchSingle(options); - } - return this._fetchMany(options); - } - - _fetchSingle({ user, cache }) { - if (this.has(user)) return Promise.resolve(this.get(user)); - return this.client.api.guilds(this.guild.id).members(user).get() - .then(data => this.create(data, cache)); - } - - _fetchMany({ query = '', limit = 0 } = {}) { - return new Promise((resolve, reject) => { - if (this.guild.memberCount === this.size) { - resolve(query || limit ? new Collection() : this); - return; - } - this.guild.client.ws.send({ - op: Constants.OPCodes.REQUEST_GUILD_MEMBERS, - d: { - guild_id: this.guild.id, - query, - limit, - }, - }); - const fetchedMembers = new Collection(); - const handler = (members, guild) => { - if (guild.id !== this.guild.id) return; - for (const member of members.values()) { - if (query || limit) fetchedMembers.set(member.id, member); - } - if (this.guild.memberCount <= this.size || - ((query || limit) && members.size < 1000) || - (limit && fetchedMembers.size >= limit)) { - this.guild.client.removeListener(Constants.Events.GUILD_MEMBERS_CHUNK, handler); - resolve(query || limit ? fetchedMembers : this); - } - }; - this.guild.client.on(Constants.Events.GUILD_MEMBERS_CHUNK, handler); - this.guild.client.setTimeout(() => { - this.guild.client.removeListener(Constants.Events.GUILD_MEMBERS_CHUNK, handler); - reject(new Error('GUILD_MEMBERS_TIMEOUT')); - }, 120e3); - }); - } -} - -module.exports = GuildMemberStore; - - -/***/ }), -/* 125 */ -/***/ (function(module, exports, __webpack_require__) { - -const DataStore = __webpack_require__(11); -const Role = __webpack_require__(18); -/** - * Stores roles. - * @private - * @extends {DataStore} - */ -class RoleStore extends DataStore { - constructor(guild, iterable) { - super(guild.client, iterable); - this.guild = guild; - } - - create(data) { - const existing = this.get(data.id); - if (existing) return existing; - - const role = new Role(this.guild, data); - this.set(role.id, role); - - return role; - } -} - -module.exports = RoleStore; - - -/***/ }), -/* 126 */ -/***/ (function(module, exports, __webpack_require__) { - -const DataStore = __webpack_require__(11); -const Emoji = __webpack_require__(34); -/** - * Stores emojis. - * @private - * @extends {DataStore} - */ -class EmojiStore extends DataStore { - constructor(guild, iterable) { - super(guild.client, iterable); - this.guild = guild; - } - - create(data) { - const guild = this.guild; - - const existing = guild.emojis.get(data.id); - if (existing) return existing; - - const emoji = new Emoji(guild, data); - guild.emojis.set(emoji.id, emoji); - - return emoji; - } -} - -module.exports = EmojiStore; - - -/***/ }), -/* 127 */ -/***/ (function(module, exports, __webpack_require__) { - -const DataStore = __webpack_require__(11); -const Channel = __webpack_require__(15); - -/** - * Stores guild channels. - * @private - * @extends {DataStore} - */ -class GuildChannelStore extends DataStore { - constructor(guild, iterable) { - super(guild.client, iterable); - this.guild = guild; - } - - create(data) { - const existing = this.get(data.id); - if (existing) return existing; - - return Channel.create(this.client, data, this.guild); - } -} - -module.exports = GuildChannelStore; - - -/***/ }), -/* 128 */ -/***/ (function(module, exports, __webpack_require__) { - -const Util = __webpack_require__(7); -const Embed = __webpack_require__(20); -const { RangeError } = __webpack_require__(4); - -module.exports = function sendMessage(channel, options) { // eslint-disable-line complexity - const User = __webpack_require__(25); - const GuildMember = __webpack_require__(17); - if (channel instanceof User || channel instanceof GuildMember) return channel.createDM().then(dm => dm.send(options)); - let { content, nonce, reply, code, disableEveryone, tts, embed, files, split } = options; - - if (embed) embed = new Embed(embed)._apiTransform(); - - if (typeof nonce !== 'undefined') { - nonce = parseInt(nonce); - if (isNaN(nonce) || nonce < 0) throw new RangeError('MESSAGE_NONCE_TYPE'); - } - - // Add the reply prefix - if (reply && !(channel instanceof User || channel instanceof GuildMember) && channel.type !== 'dm') { - const id = channel.client.resolver.resolveUserID(reply); - const mention = `<@${reply instanceof GuildMember && reply.nickname ? '!' : ''}${id}>`; - if (split) split.prepend = `${mention}, ${split.prepend || ''}`; - content = `${mention}${typeof content !== 'undefined' ? `, ${content}` : ''}`; - } - - if (content) { - content = Util.resolveString(content); - if (split && typeof split !== 'object') split = {}; - // Wrap everything in a code block - if (typeof code !== 'undefined' && (typeof code !== 'boolean' || code === true)) { - content = Util.escapeMarkdown(content, true); - content = `\`\`\`${typeof code !== 'boolean' ? code || '' : ''}\n${content}\n\`\`\``; - if (split) { - split.prepend = `\`\`\`${typeof code !== 'boolean' ? code || '' : ''}\n`; - split.append = '\n```'; - } - } - - // Add zero-width spaces to @everyone/@here - if (disableEveryone || (typeof disableEveryone === 'undefined' && channel.client.options.disableEveryone)) { - content = content.replace(/@(everyone|here)/g, '@\u200b$1'); - } - - if (split) content = Util.splitMessage(content, split); - } - - if (content instanceof Array) { - return new Promise((resolve, reject) => { - const messages = []; - (function sendChunk() { - const opt = content.length ? { tts } : { tts, embed, files }; - channel.send(content.shift(), opt).then(message => { - messages.push(message); - if (content.length === 0) return resolve(messages); - return sendChunk(); - }).catch(reject); - }()); - }); - } - - return channel.client.api.channels[channel.id].messages.post({ - data: { content, tts, nonce, embed }, - files, - }).then(data => channel.client.actions.MessageCreate.handle(data).message); -}; - - -/***/ }), -/* 129 */ -/***/ (function(module, exports, __webpack_require__) { - -const Collection = __webpack_require__(3); -const { UserFlags } = __webpack_require__(0); -const UserConnection = __webpack_require__(130); -const Base = __webpack_require__(10); - -/** - * Represents a user's profile on Discord. - * @extends {Base} - */ -class UserProfile extends Base { - constructor(user, data) { - super(user.client); - - /** - * The owner of the profile - * @type {User} - */ - this.user = user; - - /** - * The guilds that the client user and the user share - * @type {Collection} - */ - this.mutualGuilds = new Collection(); - - /** - * The user's connections - * @type {Collection} - */ - this.connections = new Collection(); - - this._patch(data); - } - - _patch(data) { - /** - * If the user has Discord Premium - * @type {boolean} - */ - this.premium = Boolean(data.premium_since); - - /** - * The Bitfield of the users' flags - * @type {number} - * @private - */ - this._flags = data.user.flags; - - /** - * The date since which the user has had Discord Premium - * @type {?Date} - */ - this.premiumSince = data.premium_since ? new Date(data.premium_since) : null; - - for (const guild of data.mutual_guilds) { - if (this.client.guilds.has(guild.id)) { - this.mutualGuilds.set(guild.id, this.client.guilds.get(guild.id)); - } - } - for (const connection of data.connected_accounts) { - this.connections.set(connection.id, new UserConnection(this.user, connection)); - } - } - - /** - * The flags the user has - * @type {UserFlags[]} - * @readonly - */ - get flags() { - const flags = []; - for (const [name, flag] of Object.entries(UserFlags)) { - if ((this._flags & flag) === flag) flags.push(name); - } - return flags; - } -} - -module.exports = UserProfile; - - -/***/ }), -/* 130 */ -/***/ (function(module, exports) { - -/** - * Represents a user connection (or "platform identity"). - */ -class UserConnection { - constructor(user, data) { - /** - * The user that owns the connection - * @type {User} - */ - this.user = user; - - this._patch(data); - } - - _patch(data) { - /** - * The type of the connection - * @type {string} - */ - this.type = data.type; - - /** - * The username of the connection account - * @type {string} - */ - this.name = data.name; - - /** - * The id of the connection account - * @type {string} - */ - this.id = data.id; - - /** - * Whether the connection is revoked - * @type {boolean} - */ - this.revoked = data.revoked; - - /** - * Partial server integrations (not yet implemented) - * @type {Object[]} - */ - this.integrations = data.integrations; - } -} - -module.exports = UserConnection; - - -/***/ }), -/* 131 */ -/***/ (function(module, exports, __webpack_require__) { - /* WEBPACK VAR INJECTION */(function(process) {const BaseClient = __webpack_require__(41); const Permissions = __webpack_require__(12); -const RESTManager = __webpack_require__(59); -const ClientManager = __webpack_require__(132); -const ClientVoiceManager = __webpack_require__(133); -const WebSocketManager = __webpack_require__(134); +const RESTManager = __webpack_require__(60); +const ClientManager = __webpack_require__(123); +const ClientVoiceManager = __webpack_require__(124); +const WebSocketManager = __webpack_require__(125); const ActionsManager = __webpack_require__(178); const Collection = __webpack_require__(3); -const VoiceRegion = __webpack_require__(72); -const Webhook = __webpack_require__(21); -const Invite = __webpack_require__(35); +const VoiceRegion = __webpack_require__(74); +const Webhook = __webpack_require__(22); +const Invite = __webpack_require__(34); const ClientApplication = __webpack_require__(45); const ShardClientUtil = __webpack_require__(207); const VoiceBroadcast = __webpack_require__(208); @@ -23369,6 +22729,7 @@ const ChannelStore = __webpack_require__(210); const GuildStore = __webpack_require__(211); const ClientPresenceStore = __webpack_require__(212); const Constants = __webpack_require__(0); +const DataResolver = __webpack_require__(13); const { Error, TypeError, RangeError } = __webpack_require__(4); /** @@ -23644,7 +23005,7 @@ class Client extends BaseClient { * @returns {Promise} */ fetchInvite(invite) { - const code = this.resolver.resolveInviteCode(invite); + const code = DataResolver.resolveInviteCode(invite); return this.api.invites(code).get({ query: { with_counts: true } }) .then(data => new Invite(this, data)); } @@ -23825,7 +23186,7 @@ module.exports = Client; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(8))) /***/ }), -/* 132 */ +/* 123 */ /***/ (function(module, exports, __webpack_require__) { const Constants = __webpack_require__(0); @@ -23903,18 +23264,18 @@ module.exports = ClientManager; /***/ }), -/* 133 */ +/* 124 */ /***/ (function(module, exports) { /* (ignored) */ /***/ }), -/* 134 */ +/* 125 */ /***/ (function(module, exports, __webpack_require__) { -const EventEmitter = __webpack_require__(13); +const EventEmitter = __webpack_require__(14); const Constants = __webpack_require__(0); -const WebSocketConnection = __webpack_require__(135); +const WebSocketConnection = __webpack_require__(126); /** * WebSocket Manager of the client. @@ -24005,13 +23366,13 @@ module.exports = WebSocketManager; /***/ }), -/* 135 */ +/* 126 */ /***/ (function(module, exports, __webpack_require__) { -const EventEmitter = __webpack_require__(13); +const EventEmitter = __webpack_require__(14); const Constants = __webpack_require__(0); -const PacketManager = __webpack_require__(136); -const WebSocket = __webpack_require__(77); +const PacketManager = __webpack_require__(127); +const WebSocket = __webpack_require__(78); /** * Abstracts a WebSocket connection with decoding/encoding for the Discord gateway. @@ -24467,7 +23828,7 @@ module.exports = WebSocketConnection; /***/ }), -/* 136 */ +/* 127 */ /***/ (function(module, exports, __webpack_require__) { const Constants = __webpack_require__(0); @@ -24488,7 +23849,7 @@ class WebSocketPacketManager { this.handlers = {}; this.queue = []; - this.register(Constants.WSEvents.READY, __webpack_require__(137)); + this.register(Constants.WSEvents.READY, __webpack_require__(128)); this.register(Constants.WSEvents.RESUMED, __webpack_require__(139)); this.register(Constants.WSEvents.GUILD_CREATE, __webpack_require__(140)); this.register(Constants.WSEvents.GUILD_DELETE, __webpack_require__(141)); @@ -24581,12 +23942,12 @@ module.exports = WebSocketPacketManager; /***/ }), -/* 137 */ +/* 128 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); const Constants = __webpack_require__(0); -const ClientUser = __webpack_require__(74); +const ClientUser = __webpack_require__(62); class ReadyHandler extends AbstractHandler { handle(packet) { @@ -24663,6 +24024,701 @@ class ReadyHandler extends AbstractHandler { module.exports = ReadyHandler; +/***/ }), +/* 129 */ +/***/ (function(module, exports, __webpack_require__) { + +const long = __webpack_require__(43); +const { TypeError } = __webpack_require__(4); + +/** + * @typedef {Object} MessageSearchOptions + * @property {string} [content] Message content + * @property {Snowflake} [maxID] Maximum ID for the filter + * @property {Snowflake} [minID] Minimum ID for the filter + * @property {string} [has] One of `link`, `embed`, `file`, `video`, `image`, or `sound`, + * or add `-` to negate (e.g. `-file`) + * @property {ChannelResolvable} [channel] Channel to limit search to (only for guild search endpoint) + * @property {UserResolvable} [author] Author to limit search + * @property {string} [authorType] One of `user`, `bot`, `webhook`, or add `-` to negate (e.g. `-webhook`) + * @property {string} [sortBy='recent'] `recent` or `relevant` + * @property {string} [sortOrder='descending'] `ascending` or `descending` + * @property {number} [contextSize=2] How many messages to get around the matched message (0 to 2) + * @property {number} [limit=25] Maximum number of results to get (1 to 25) + * @property {number} [offset=0] Offset the "pages" of results (since you can only see 25 at a time) + * @property {UserResolvable} [mentions] Mentioned user filter + * @property {boolean} [mentionsEveryone] If everyone is mentioned + * @property {string} [linkHostname] Filter links by hostname + * @property {string} [embedProvider] The name of an embed provider + * @property {string} [embedType] one of `image`, `video`, `url`, `rich`, or add `-` to negate (e.g. `-image`) + * @property {string} [attachmentFilename] The name of an attachment + * @property {string} [attachmentExtension] The extension of an attachment + * @property {Date} [before] Date to find messages before + * @property {Date} [after] Date to find messages before + * @property {Date} [during] Date to find messages during (range of date to date + 24 hours) + * @property {boolean} [nsfw=false] Include results from NSFW channels + */ + +/** + * @typedef {Object} MessageSearchResult + * @property {number} total Total result count + * @property {Array} results Array of message results + * The message which has triggered the result will have the `hit` property set to `true` + */ + +module.exports = function search(target, options) { + if (typeof options === 'string') options = { content: options }; + if (options.before) { + if (!(options.before instanceof Date)) options.before = new Date(options.before); + options.maxID = long.fromNumber(options.before.getTime() - 14200704e5).shiftLeft(22).toString(); + } + if (options.after) { + if (!(options.after instanceof Date)) options.after = new Date(options.after); + options.minID = long.fromNumber(options.after.getTime() - 14200704e5).shiftLeft(22).toString(); + } + if (options.during) { + if (!(options.during instanceof Date)) options.during = new Date(options.during); + const t = options.during.getTime() - 14200704e5; + options.minID = long.fromNumber(t).shiftLeft(22).toString(); + options.maxID = long.fromNumber(t + 864e5).shiftLeft(22).toString(); + } + if (options.channel) options.channel = target.client.channels.resolveID(options.channel); + if (options.author) options.author = target.client.users.resolveID(options.author); + if (options.mentions) options.mentions = target.client.users.resolveID(options.options.mentions); + if (options.sortOrder) { + options.sortOrder = { ascending: 'asc', descending: 'desc' }[options.sortOrder] || options.sortOrder; + } + options = { + content: options.content, + max_id: options.maxID, + min_id: options.minID, + has: options.has, + channel_id: options.channel, + author_id: options.author, + author_type: options.authorType, + context_size: options.contextSize, + sort_by: options.sortBy, + sort_order: options.sortOrder, + limit: options.limit, + offset: options.offset, + mentions: options.mentions, + mentions_everyone: options.mentionsEveryone, + link_hostname: options.linkHostname, + embed_provider: options.embedProvider, + embed_type: options.embedType, + attachment_filename: options.attachmentFilename, + attachment_extension: options.attachmentExtension, + include_nsfw: options.nsfw, + }; + + // Lazy load these because some of them use util + const Channel = __webpack_require__(17); + const Guild = __webpack_require__(35); + + if (!(target instanceof Channel || target instanceof Guild)) throw new TypeError('SEARCH_CHANNEL_TYPE'); + + let endpoint = target.client.api[target instanceof Channel ? 'channels' : 'guilds'](target.id).messages().search; + return endpoint.get({ query: options }).then(body => { + const results = body.messages.map(x => + x.map(m => target.client.channels.get(m.channel_id).messages.create(m, false)) + ); + return { + total: body.total_results, + results, + }; + }); +}; + + +/***/ }), +/* 130 */ +/***/ (function(module, exports, __webpack_require__) { + +const DataStore = __webpack_require__(11); +const MessageReaction = __webpack_require__(68); + +/** + * Stores reactions. + * @private + * @extends {DataStore} + */ +class ReactionStore extends DataStore { + constructor(message, iterable) { + super(message.client, iterable, MessageReaction); + this.message = message; + } + + create(data, cache) { + data.emoji.id = data.emoji.id || decodeURIComponent(data.emoji.name); + return super.create(data, cache, { id: data.emoji.id, extras: [this.message] }); + } + + /** + * Data that can be resolved to a MessageReaction object. This can be: + * * A MessageReaction + * * A Snowflake + * @typedef {MessageReaction|Snowflake} MessageReactionResolvable + */ + + /** + * Resolves a MessageReactionResolvable to a MessageReaction object. + * @method resolve + * @memberof ReactionStore + * @param {MessageReactionResolvable} reaction The MessageReaction to resolve + * @returns {?MessageReaction} + */ + + /** + * Resolves a MessageReactionResolvable to a MessageReaction ID string. + * @method resolveID + * @memberof ReactionStore + * @param {MessageReactionResolvable} role The role resolvable to resolve + * @returns {?string} + */ +} + +module.exports = ReactionStore; + + +/***/ }), +/* 131 */ +/***/ (function(module, exports, __webpack_require__) { + +const DataStore = __webpack_require__(11); +const GuildMember = __webpack_require__(18); +const Constants = __webpack_require__(0); +const Collection = __webpack_require__(3); +const { Error } = __webpack_require__(4); + +/** + * Stores guild members. + * @extends {DataStore} + */ +class GuildMemberStore extends DataStore { + constructor(guild, iterable) { + super(guild.client, iterable, GuildMember); + this.guild = guild; + } + + create(data, cache) { + return super.create(data, cache, { extras: [this.guild] }); + } + + /** + * Data that resolves to give a GuildMember object. This can be: + * * A GuildMember object + * * A User resolvable + * @typedef {GuildMember|UserResolveable} GuildMemberResolvable + */ + + /** + * Resolves a GuildMemberResolvable to a GuildMember object. + * @param {GuildMemberResolvable} member The user that is part of the guild + * @returns {?GuildMember} + */ + resolve(member) { + const memberResolveable = super.resolve(member); + if (memberResolveable) return memberResolveable; + const userResolveable = this.client.users.resolveID(member); + if (userResolveable) return super.resolve(userResolveable); + return null; + } + + /** + * Resolves a GuildMemberResolvable to an member ID string. + * @param {GuildMemberResolvable} member The user that is part of the guild + * @returns {?string} + */ + resolveID(member) { + const memberResolveable = super.resolveID(member); + if (memberResolveable) return memberResolveable; + const userResolveable = this.client.users.resolveID(member); + return this.has(userResolveable) ? userResolveable : null; + } + + /** + * Options used to fetch a single member from a guild. + * @typedef {Object} FetchMemberOptions + * @property {UserResolvable} user The user to fetch + * @property {boolean} [cache=true] Whether or not to cache the fetched member + */ + + /** + * Options used to fetch multiple members from a guild. + * @typedef {Object} FetchMembersOptions + * @property {string} [query=''] Limit fetch to members with similar usernames + * @property {number} [limit=0] Maximum number of members to request + */ + + /** + * Fetch member(s) from Discord, even if they're offline. + * @param {UserResolvable|FetchMemberOptions|FetchMembersOptions} [options] If a UserResolvable, the user to fetch. + * If undefined, fetches all members. + * If a query, it limits the results to users with similar usernames. + * @returns {Promise|Promise>} + * @example + * // Fetch all members from a guild + * guild.members.fetch(); + * @example + * // Fetch a single member + * guild.members.fetch('66564597481480192'); + * guild.members.fetch(user); + * guild.members.fetch({ user, cache: false }); // Fetch and don't cache + * @example + * // Fetch by query + * guild.members.fetch({ + * query: 'hydra', + * }); + * guild.members.fetch({ + * query: 'hydra', + * limit: 10, + * }); + */ + fetch(options) { + if (!options) return this._fetchMany(); + const user = this.resolveID(options); + if (user) return this._fetchSingle({ user, cache: true }); + if (options.user) { + options.user = this.resolveID(options.user); + if (options.user) return this._fetchSingle(options); + } + return this._fetchMany(options); + } + + _fetchSingle({ user, cache }) { + if (this.has(user)) return Promise.resolve(this.get(user)); + return this.client.api.guilds(this.guild.id).members(user).get() + .then(data => this.create(data, cache)); + } + + _fetchMany({ query = '', limit = 0 } = {}) { + return new Promise((resolve, reject) => { + if (this.guild.memberCount === this.size) { + resolve(query || limit ? new Collection() : this); + return; + } + this.guild.client.ws.send({ + op: Constants.OPCodes.REQUEST_GUILD_MEMBERS, + d: { + guild_id: this.guild.id, + query, + limit, + }, + }); + const fetchedMembers = new Collection(); + const handler = (members, guild) => { + if (guild.id !== this.guild.id) return; + for (const member of members.values()) { + if (query || limit) fetchedMembers.set(member.id, member); + } + if (this.guild.memberCount <= this.size || + ((query || limit) && members.size < 1000) || + (limit && fetchedMembers.size >= limit)) { + this.guild.client.removeListener(Constants.Events.GUILD_MEMBERS_CHUNK, handler); + resolve(query || limit ? fetchedMembers : this); + } + }; + this.guild.client.on(Constants.Events.GUILD_MEMBERS_CHUNK, handler); + this.guild.client.setTimeout(() => { + this.guild.client.removeListener(Constants.Events.GUILD_MEMBERS_CHUNK, handler); + reject(new Error('GUILD_MEMBERS_TIMEOUT')); + }, 120e3); + }); + } +} + +module.exports = GuildMemberStore; + + +/***/ }), +/* 132 */ +/***/ (function(module, exports, __webpack_require__) { + +const DataStore = __webpack_require__(11); +const Role = __webpack_require__(27); + +/** + * Stores roles. + * @private + * @extends {DataStore} + */ +class RoleStore extends DataStore { + constructor(guild, iterable) { + super(guild.client, iterable, Role); + this.guild = guild; + } + + create(data, cache) { + return super.create(data, cache, { extras: [this.guild] }); + } + + /** + * Data that can be resolved to a Role object. This can be: + * * A Role + * * A Snowflake + * @typedef {Role|Snowflake} RoleResolvable + */ + + /** + * Resolves a RoleResolvable to a Role object. + * @method resolve + * @memberof RoleStore + * @param {RoleResolvable} role The role resolvable to resolve + * @returns {?Role} + */ + + /** + * Resolves a RoleResolvable to a role ID string. + * @method resolveID + * @memberof RoleStore + * @param {RoleResolvable} role The role resolvable to resolve + * @returns {?string} + */ +} + +module.exports = RoleStore; + + +/***/ }), +/* 133 */ +/***/ (function(module, exports, __webpack_require__) { + +const DataStore = __webpack_require__(11); +const Emoji = __webpack_require__(46); +const ReactionEmoji = __webpack_require__(47); + +/** + * Stores emojis. + * @private + * @extends {DataStore} + */ +class EmojiStore extends DataStore { + constructor(guild, iterable) { + super(guild.client, iterable, Emoji); + this.guild = guild; + } + + create(data, cache) { + super.create(data, cache, { extras: [this.guild] }); + } + + /** + * Data that can be resolved into an Emoji object. This can be: + * * A custom emoji ID + * * An Emoji object + * * A ReactionEmoji object + * @typedef {Snowflake|Emoji|ReactionEmoji} EmojiResolvable + */ + + /** + * Resolves a EmojiResolvable to a Emoji object. + * @param {EmojiResolvable} emoji The Emoji resolvable to identify + * @returns {?Emoji} + */ + resolve(emoji) { + if (emoji instanceof ReactionEmoji) return super.resolve(emoji.id); + return super.resolve(emoji); + } + + /** + * Resolves a EmojiResolvable to a Emoji ID string. + * @param {EmojiResolvable} emoji The Emoji resolvable to identify + * @returns {?string} + */ + resolveID(emoji) { + if (emoji instanceof ReactionEmoji) return emoji.id; + return super.resolveID(emoji); + } + + /** + * Data that can be resolved to give an emoji identifier. This can be: + * * The unicode representation of an emoji + * * An EmojiResolveable + * @typedef {string|EmojiResolvable} EmojiIdentifierResolvable + */ + + /** + * Resolves an EmojiResolvable to an emoji identifier. + * @param {EmojiIdentifierResolvable} emoji The emoji resolvable to resolve + * @returns {?string} + */ + resolveIdentifier(emoji) { + const emojiResolveable = this.resolve(emoji); + if (emojiResolveable) return emojiResolveable.identifier; + if (typeof emoji === 'string') { + if (!emoji.includes('%')) return encodeURIComponent(emoji); + else return emoji; + } + return null; + } +} + +module.exports = EmojiStore; + + +/***/ }), +/* 134 */ +/***/ (function(module, exports, __webpack_require__) { + +const DataStore = __webpack_require__(11); +const Channel = __webpack_require__(17); +const GuildChannel = __webpack_require__(21); + +/** + * Stores guild channels. + * @private + * @extends {DataStore} + */ +class GuildChannelStore extends DataStore { + constructor(guild, iterable) { + super(guild.client, iterable, GuildChannel); + this.guild = guild; + } + + create(data) { + const existing = this.get(data.id); + if (existing) return existing; + + return Channel.create(this.client, data, this.guild); + } + + /** + * Data that can be resolved to give a Channel object. This can be: + * * A GuildChannel object + * * A Snowflake + * @typedef {Channel|Snowflake} GuildChannelResolvable + */ + + /** + * Resolves a GuildChannelResolvable to a Channel object. + * @method resolve + * @memberof GuildChannelStore + * @param {GuildChannelResolvable} channel The GuildChannel resolvable to resolve + * @returns {?Channel} + */ + + /** + * Resolves a GuildChannelResolvable to a channel ID string. + * @method resolveID + * @memberof GuildChannelStore + * @param {GuildChannelResolvable} channel The GuildChannel resolvable to resolve + * @returns {?string} + */ +} + +module.exports = GuildChannelStore; + + +/***/ }), +/* 135 */ +/***/ (function(module, exports, __webpack_require__) { + +const Util = __webpack_require__(7); +const Embed = __webpack_require__(20); +const { RangeError } = __webpack_require__(4); + +module.exports = function sendMessage(channel, options) { // eslint-disable-line complexity + const User = __webpack_require__(32); + const GuildMember = __webpack_require__(18); + if (channel instanceof User || channel instanceof GuildMember) return channel.createDM().then(dm => dm.send(options)); + let { content, nonce, reply, code, disableEveryone, tts, embed, files, split } = options; + + if (embed) embed = new Embed(embed)._apiTransform(); + + if (typeof nonce !== 'undefined') { + nonce = parseInt(nonce); + if (isNaN(nonce) || nonce < 0) throw new RangeError('MESSAGE_NONCE_TYPE'); + } + + // Add the reply prefix + if (reply && !(channel instanceof User || channel instanceof GuildMember) && channel.type !== 'dm') { + const id = channel.client.users.resolveID(reply); + const mention = `<@${reply instanceof GuildMember && reply.nickname ? '!' : ''}${id}>`; + if (split) split.prepend = `${mention}, ${split.prepend || ''}`; + content = `${mention}${typeof content !== 'undefined' ? `, ${content}` : ''}`; + } + + if (content) { + content = Util.resolveString(content); + if (split && typeof split !== 'object') split = {}; + // Wrap everything in a code block + if (typeof code !== 'undefined' && (typeof code !== 'boolean' || code === true)) { + content = Util.escapeMarkdown(content, true); + content = `\`\`\`${typeof code !== 'boolean' ? code || '' : ''}\n${content}\n\`\`\``; + if (split) { + split.prepend = `\`\`\`${typeof code !== 'boolean' ? code || '' : ''}\n`; + split.append = '\n```'; + } + } + + // Add zero-width spaces to @everyone/@here + if (disableEveryone || (typeof disableEveryone === 'undefined' && channel.client.options.disableEveryone)) { + content = content.replace(/@(everyone|here)/g, '@\u200b$1'); + } + + if (split) content = Util.splitMessage(content, split); + } + + if (content instanceof Array) { + return new Promise((resolve, reject) => { + const messages = []; + (function sendChunk() { + const opt = content.length ? { tts } : { tts, embed, files }; + channel.send(content.shift(), opt).then(message => { + messages.push(message); + if (content.length === 0) return resolve(messages); + return sendChunk(); + }).catch(reject); + }()); + }); + } + + return channel.client.api.channels[channel.id].messages.post({ + data: { content, tts, nonce, embed }, + files, + }).then(data => channel.client.actions.MessageCreate.handle(data).message); +}; + + +/***/ }), +/* 136 */ +/***/ (function(module, exports, __webpack_require__) { + +const Collection = __webpack_require__(3); +const { UserFlags } = __webpack_require__(0); +const UserConnection = __webpack_require__(137); +const Base = __webpack_require__(10); + +/** + * Represents a user's profile on Discord. + * @extends {Base} + */ +class UserProfile extends Base { + constructor(user, data) { + super(user.client); + + /** + * The owner of the profile + * @type {User} + */ + this.user = user; + + /** + * The guilds that the client user and the user share + * @type {Collection} + */ + this.mutualGuilds = new Collection(); + + /** + * The user's connections + * @type {Collection} + */ + this.connections = new Collection(); + + this._patch(data); + } + + _patch(data) { + /** + * If the user has Discord Premium + * @type {boolean} + */ + this.premium = Boolean(data.premium_since); + + /** + * The Bitfield of the users' flags + * @type {number} + * @private + */ + this._flags = data.user.flags; + + /** + * The date since which the user has had Discord Premium + * @type {?Date} + */ + this.premiumSince = data.premium_since ? new Date(data.premium_since) : null; + + for (const guild of data.mutual_guilds) { + if (this.client.guilds.has(guild.id)) { + this.mutualGuilds.set(guild.id, this.client.guilds.get(guild.id)); + } + } + for (const connection of data.connected_accounts) { + this.connections.set(connection.id, new UserConnection(this.user, connection)); + } + } + + /** + * The flags the user has + * @type {UserFlags[]} + * @readonly + */ + get flags() { + const flags = []; + for (const [name, flag] of Object.entries(UserFlags)) { + if ((this._flags & flag) === flag) flags.push(name); + } + return flags; + } +} + +module.exports = UserProfile; + + +/***/ }), +/* 137 */ +/***/ (function(module, exports) { + +/** + * Represents a user connection (or "platform identity"). + */ +class UserConnection { + constructor(user, data) { + /** + * The user that owns the connection + * @type {User} + */ + this.user = user; + + this._patch(data); + } + + _patch(data) { + /** + * The type of the connection + * @type {string} + */ + this.type = data.type; + + /** + * The username of the connection account + * @type {string} + */ + this.name = data.name; + + /** + * The id of the connection account + * @type {string} + */ + this.id = data.id; + + /** + * Whether the connection is revoked + * @type {boolean} + */ + this.revoked = data.revoked; + + /** + * Partial server integrations (not yet implemented) + * @type {Object[]} + */ + this.integrations = data.integrations; + } +} + +module.exports = UserConnection; + + /***/ }), /* 138 */ /***/ (function(module, exports, __webpack_require__) { @@ -25297,7 +25353,7 @@ module.exports = UserSettingsUpdateHandler; const AbstractHandler = __webpack_require__(1); const Constants = __webpack_require__(0); -const ClientUserGuildSettings = __webpack_require__(76); +const ClientUserGuildSettings = __webpack_require__(77); class UserGuildSettingsUpdateHandler extends AbstractHandler { handle(packet) { @@ -26647,20 +26703,48 @@ module.exports = GuildChannelsPositionUpdate; /***/ (function(module, exports, __webpack_require__) { const DataStore = __webpack_require__(11); -const User = __webpack_require__(25); +const User = __webpack_require__(32); +const GuildMember = __webpack_require__(18); +const Message = __webpack_require__(44); /** * A data store to store User models. * @extends {DataStore} */ class UserStore extends DataStore { - create(data, cache = true) { - const existing = this.get(data.id); - if (existing) return existing; + constructor(client, iterable) { + super(client, iterable, User); + } - const user = new User(this.client, data); - if (cache) this.set(user.id, user); - return user; + /** + * Data that resolves to give a User object. This can be: + * * A User object + * * A Snowflake + * * A Message object (resolves to the message author) + * * A GuildMember object + * @typedef {User|Snowflake|Message|GuildMember} UserResolvable + */ + + /** + * Resolves a UserResolvable to a User object. + * @param {UserResolvable} user The UserResolvable to identify + * @returns {?User} + */ + resolve(user) { + if (user instanceof GuildMember) return user.user; + if (user instanceof Message) return user.author; + return super.resolve(user); + } + + /** + * Resolves a UserResolvable to a user ID string. + * @param {UserResolvable} user The UserResolvable to identify + * @returns {?string} + */ + resolveID(user) { + if (user instanceof GuildMember) return user.user.id; + if (user instanceof Message) return user.author.id; + return super.resolveID(user); } /** @@ -26686,7 +26770,7 @@ module.exports = UserStore; /***/ (function(module, exports, __webpack_require__) { const DataStore = __webpack_require__(11); -const Channel = __webpack_require__(15); +const Channel = __webpack_require__(17); const Constants = __webpack_require__(0); const kLru = Symbol('LRU'); @@ -26703,7 +26787,7 @@ class ChannelStore extends DataStore { options = iterableOrOptions; iterableOrOptions = undefined; } - super(client, iterableOrOptions); + super(client, iterableOrOptions, Channel); if (options.lru) { const lru = this[kLru] = []; @@ -26759,6 +26843,29 @@ class ChannelStore extends DataStore { if (channel.guild) channel.guild.channels.remove(id); super.remove(id); } + + /** + * Data that can be resolved to give a Channel object. This can be: + * * A Channel object + * * A Snowflake + * @typedef {Channel|Snowflake} ChannelResolvable + */ + + /** + * Resolves a ChannelResolvable to a Channel object. + * @method resolve + * @memberof ChannelStore + * @param {ChannelResolvable} channel The channel resolvable to resolve + * @returns {?Channel} + */ + + /** + * Resolves a ChannelResolvable to a channel ID string. + * @method resolveID + * @memberof ChannelStore + * @param {ChannelResolvable} channel The channel resolvable to resolve + * @returns {?string} + */ } module.exports = ChannelStore; @@ -26769,22 +26876,40 @@ module.exports = ChannelStore; /***/ (function(module, exports, __webpack_require__) { const DataStore = __webpack_require__(11); -const Guild = __webpack_require__(29); +const Guild = __webpack_require__(35); + /** * Stores guilds. * @private * @extends {DataStore} */ class GuildStore extends DataStore { - create(data, cache = true) { - const existing = this.get(data.id); - if (existing) return existing; - - const guild = new Guild(this.client, data); - if (cache) this.set(guild.id, guild); - - return guild; + constructor(client, iterable) { + super(client, iterable, Guild); } + + /** + * Data that resolves to give a Guild object. This can be: + * * A Guild object + * * A Snowflake + * @typedef {Guild|Snowflake} GuildResolvable + */ + + /** + * Resolves a GuildResolvable to a Guild object. + * @method resolve + * @memberof GuildStore + * @param {GuildResolvable} guild The guild resolvable to identify + * @returns {?Guild} + */ + + /** + * Resolves a GuildResolvable to a Guild ID string. + * @method resolveID + * @memberof GuildStore + * @param {GuildResolvable} guild The guild resolvable to identify + * @returns {?string} + */ } module.exports = GuildStore; @@ -26794,7 +26919,7 @@ module.exports = GuildStore; /* 212 */ /***/ (function(module, exports, __webpack_require__) { -const PresenceStore = __webpack_require__(73); +const PresenceStore = __webpack_require__(75); const Collection = __webpack_require__(3); const Constants = __webpack_require__(0); const { Presence } = __webpack_require__(19); @@ -26880,7 +27005,7 @@ module.exports = ClientPresenceStore; /* 216 */ /***/ (function(module, exports, __webpack_require__) { -const Webhook = __webpack_require__(21); +const Webhook = __webpack_require__(22); const BaseClient = __webpack_require__(41); /** diff --git a/discord.master.min.js b/discord.master.min.js index 82ca80e0..50792970 100644 --- a/discord.master.min.js +++ b/discord.master.min.js @@ -1 +1 @@ -!function(e){function t(n){if(i[n])return i[n].exports;var s=i[n]={i:n,l:!1,exports:{}};return e[n].call(s.exports,s,s.exports,t),s.l=!0,s.exports}var i={};t.m=e,t.c=i,t.d=function(e,i,n){t.o(e,i)||Object.defineProperty(e,i,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var i=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(i,"a",i),i},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=78)}([function(e,t,i){(function(e){function n(e,{format:t="webp",size:i}={}){if(t&&!o.includes(t))throw new s("IMAGE_FORMAT",t);if(i&&!a.includes(i))throw new r("IMAGE_SIZE",i);return`${e}.${t}${i?`?size=${i}`:""}`}t.Package=i(57);const{Error:s,RangeError:r}=i(4);t.DefaultOptions={apiRequestMethod:"sequential",shardId:0,shardCount:0,internalSharding:!1,messageCacheMaxSize:200,messageCacheLifetime:0,messageSweepInterval:0,fetchAllMembers:!1,disableEveryone:!1,sync:!1,restWsBridgeTimeout:5e3,disabledEvents:[],restTimeOffset:500,ws:{large_threshold:250,compress:"browser"!==i(113).platform(),properties:{$os:e?e.platform:"discord.js",$browser:"discord.js",$device:"discord.js"},version:6},http:{version:7,api:"https://discordapp.com/api",cdn:"https://cdn.discordapp.com",invite:"https://discord.gg"}},t.WSCodes={1e3:"Connection gracefully closed",4004:"Tried to identify with an invalid token",4010:"Sharding data provided was invalid",4011:"Shard would be on too many guilds if connected"};const o=["webp","png","jpg","gif"],a=Array.from({length:8},(e,t)=>2**(t+4));t.Endpoints={CDN:e=>({Emoji:t=>`${e}/emojis/${t}.png`,Asset:t=>`${e}/assets/${t}`,DefaultAvatar:t=>`${e}/embed/avatars/${t}.png`,Avatar:(t,i,s="default",r)=>("default"===s&&(s=i.startsWith("a_")?"gif":"webp"),n(`${e}/avatars/${t}/${i}`,{format:s,size:r})),Icon:(t,i,s="webp",r)=>n(`${e}/icons/${t}/${i}`,{format:s,size:r}),AppIcon:(t,i,{format:s="webp",size:r}={})=>n(`${e}/app-icons/${t}/${i}`,{size:r,format:s}),AppAsset:(t,i,{format:s="webp",size:r}={})=>n(`${e}/app-assets/${t}/${i}`,{size:r,format:s}),GDMIcon:(t,i,s="webp",r)=>n(`${e}/channel-icons/${t}/${i}`,{size:r,format:s}),Splash:(t,i,s="webp",r)=>n(`${e}/splashes/${t}/${i}`,{size:r,format:s})}),invite:(e,t)=>`${e}/${t}`,botGateway:"/gateway/bot"},t.Status={READY:0,CONNECTING:1,RECONNECTING:2,IDLE:3,NEARLY:4,DISCONNECTED:5},t.VoiceStatus={CONNECTED:0,CONNECTING:1,AUTHENTICATING:2,RECONNECTING:3,DISCONNECTED:4},t.ChannelTypes={TEXT:0,DM:1,VOICE:2,GROUP:3},t.OPCodes={DISPATCH:0,HEARTBEAT:1,IDENTIFY:2,STATUS_UPDATE:3,VOICE_STATE_UPDATE:4,VOICE_GUILD_PING:5,RESUME:6,RECONNECT:7,REQUEST_GUILD_MEMBERS:8,INVALID_SESSION:9,HELLO:10,HEARTBEAT_ACK:11},t.VoiceOPCodes={IDENTIFY:0,SELECT_PROTOCOL:1,READY:2,HEARTBEAT:3,SESSION_DESCRIPTION:4,SPEAKING:5},t.Events={READY:"ready",RESUMED:"resumed",GUILD_CREATE:"guildCreate",GUILD_DELETE:"guildDelete",GUILD_UPDATE:"guildUpdate",GUILD_UNAVAILABLE:"guildUnavailable",GUILD_AVAILABLE:"guildAvailable",GUILD_MEMBER_ADD:"guildMemberAdd",GUILD_MEMBER_REMOVE:"guildMemberRemove",GUILD_MEMBER_UPDATE:"guildMemberUpdate",GUILD_MEMBER_AVAILABLE:"guildMemberAvailable",GUILD_MEMBER_SPEAKING:"guildMemberSpeaking",GUILD_MEMBERS_CHUNK:"guildMembersChunk",GUILD_ROLE_CREATE:"roleCreate",GUILD_ROLE_DELETE:"roleDelete",GUILD_ROLE_UPDATE:"roleUpdate",GUILD_EMOJI_CREATE:"emojiCreate",GUILD_EMOJI_DELETE:"emojiDelete",GUILD_EMOJI_UPDATE:"emojiUpdate",GUILD_BAN_ADD:"guildBanAdd",GUILD_BAN_REMOVE:"guildBanRemove",CHANNEL_CREATE:"channelCreate",CHANNEL_DELETE:"channelDelete",CHANNEL_UPDATE:"channelUpdate",CHANNEL_PINS_UPDATE:"channelPinsUpdate",MESSAGE_CREATE:"message",MESSAGE_DELETE:"messageDelete",MESSAGE_UPDATE:"messageUpdate",MESSAGE_BULK_DELETE:"messageDeleteBulk",MESSAGE_REACTION_ADD:"messageReactionAdd",MESSAGE_REACTION_REMOVE:"messageReactionRemove",MESSAGE_REACTION_REMOVE_ALL:"messageReactionRemoveAll",USER_UPDATE:"userUpdate",USER_NOTE_UPDATE:"userNoteUpdate",USER_SETTINGS_UPDATE:"clientUserSettingsUpdate",USER_GUILD_SETTINGS_UPDATE:"clientUserGuildSettingsUpdate",PRESENCE_UPDATE:"presenceUpdate",VOICE_STATE_UPDATE:"voiceStateUpdate",TYPING_START:"typingStart",TYPING_STOP:"typingStop",DISCONNECT:"disconnect",RECONNECTING:"reconnecting",ERROR:"error",WARN:"warn",DEBUG:"debug"},t.WSEvents=function(e){let t=Object.create(null);for(const i of e)t[i]=i;return t}(["READY","RESUMED","GUILD_SYNC","GUILD_CREATE","GUILD_DELETE","GUILD_UPDATE","GUILD_MEMBER_ADD","GUILD_MEMBER_REMOVE","GUILD_MEMBER_UPDATE","GUILD_MEMBERS_CHUNK","GUILD_ROLE_CREATE","GUILD_ROLE_DELETE","GUILD_ROLE_UPDATE","GUILD_BAN_ADD","GUILD_BAN_REMOVE","GUILD_EMOJIS_UPDATE","CHANNEL_CREATE","CHANNEL_DELETE","CHANNEL_UPDATE","CHANNEL_PINS_UPDATE","MESSAGE_CREATE","MESSAGE_DELETE","MESSAGE_UPDATE","MESSAGE_DELETE_BULK","MESSAGE_REACTION_ADD","MESSAGE_REACTION_REMOVE","MESSAGE_REACTION_REMOVE_ALL","USER_UPDATE","USER_NOTE_UPDATE","USER_SETTINGS_UPDATE","USER_GUILD_SETTINGS_UPDATE","PRESENCE_UPDATE","VOICE_STATE_UPDATE","TYPING_START","VOICE_SERVER_UPDATE","RELATIONSHIP_ADD","RELATIONSHIP_REMOVE"]),t.MessageTypes=["DEFAULT","RECIPIENT_ADD","RECIPIENT_REMOVE","CALL","CHANNEL_NAME_CHANGE","CHANNEL_ICON_CHANGE","PINS_ADD","GUILD_MEMBER_JOIN"],t.ActivityTypes=["PLAYING","STREAMING","LISTENING","WATCHING"],t.ExplicitContentFilterTypes=["DISABLED","NON_FRIENDS","FRIENDS_AND_NON_FRIENDS"],t.MessageNotificationTypes=["EVERYTHING","MENTIONS","NOTHING","INHERIT"],t.UserSettingsMap={convert_emoticons:"convertEmoticons",default_guilds_restricted:"defaultGuildsRestricted",detect_platform_accounts:"detectPlatformAccounts",developer_mode:"developerMode",enable_tts_command:"enableTTSCommand",theme:"theme",status:"status",show_current_game:"showCurrentGame",inline_attachment_media:"inlineAttachmentMedia",inline_embed_media:"inlineEmbedMedia",locale:"locale",message_display_compact:"messageDisplayCompact",render_reactions:"renderReactions",guild_positions:"guildPositions",restricted_guilds:"restrictedGuilds",explicit_content_filter:function(e){return t.ExplicitContentFilterTypes[e]},friend_source_flags:function(e){return{all:e.all||!1,mutualGuilds:!!e.all||(e.mutual_guilds||!1),mutualFriends:!!e.all||(e.mutualFriends||!1)}}},t.UserGuildSettingsMap={message_notifications:function(e){return t.MessageNotificationTypes[e]},mobile_push:"mobilePush",muted:"muted",suppress_everyone:"suppressEveryone",channel_overrides:"channelOverrides"},t.UserChannelOverrideMap={message_notifications:function(e){return t.MessageNotificationTypes[e]},muted:"muted"},t.UserFlags={STAFF:1,PARTNER:2,HYPESQUAD:4},t.ClientApplicationAssetTypes={SMALL:1,BIG:2},t.Colors={DEFAULT:0,AQUA:1752220,GREEN:3066993,BLUE:3447003,PURPLE:10181046,GOLD:15844367,ORANGE:15105570,RED:15158332,GREY:9807270,NAVY:3426654,DARK_AQUA:1146986,DARK_GREEN:2067276,DARK_BLUE:2123412,DARK_PURPLE:7419530,DARK_GOLD:12745742,DARK_ORANGE:11027200,DARK_RED:10038562,DARK_GREY:9936031,DARKER_GREY:8359053,LIGHT_GREY:12370112,DARK_NAVY:2899536,BLURPLE:7506394,GREYPLE:10070709,DARK_BUT_NOT_BLACK:2895667,NOT_QUITE_BLACK:2303786},t.APIErrors={UNKNOWN_ACCOUNT:10001,UNKNOWN_APPLICATION:10002,UNKNOWN_CHANNEL:10003,UNKNOWN_GUILD:10004,UNKNOWN_INTEGRATION:10005,UNKNOWN_INVITE:10006,UNKNOWN_MEMBER:10007,UNKNOWN_MESSAGE:10008,UNKNOWN_OVERWRITE:10009,UNKNOWN_PROVIDER:10010,UNKNOWN_ROLE:10011,UNKNOWN_TOKEN:10012,UNKNOWN_USER:10013,UNKNOWN_EMOJI:10014,BOT_PROHIBITED_ENDPOINT:20001,BOT_ONLY_ENDPOINT:20002,MAXIMUM_GUILDS:30001,MAXIMUM_FRIENDS:30002,MAXIMUM_PINS:30003,MAXIMUM_ROLES:30005,MAXIMUM_REACTIONS:30010,UNAUTHORIZED:40001,MISSING_ACCESS:50001,INVALID_ACCOUNT_TYPE:50002,CANNOT_EXECUTE_ON_DM:50003,EMBED_DISABLED:50004,CANNOT_EDIT_MESSAGE_BY_OTHER:50005,CANNOT_SEND_EMPTY_MESSAGE:50006,CANNOT_MESSAGE_USER:50007,CANNOT_SEND_MESSAGES_IN_VOICE_CHANNEL:50008,CHANNEL_VERIFICATION_LEVEL_TOO_HIGH:50009,OAUTH2_APPLICATION_BOT_ABSENT:50010,MAXIMUM_OAUTH2_APPLICATIONS:50011,INVALID_OAUTH_STATE:50012,MISSING_PERMISSIONS:50013,INVALID_AUTHENTICATION_TOKEN:50014,NOTE_TOO_LONG:50015,INVALID_BULK_DELETE_QUANTITY:50016,CANNOT_PIN_MESSAGE_IN_OTHER_CHANNEL:50019,CANNOT_EXECUTE_ON_SYSTEM_MESSAGE:50021,BULK_DELETE_MESSAGE_TOO_OLD:50034,INVITE_ACCEPTED_TO_GUILD_NOT_CONTANING_BOT:50036,REACTION_BLOCKED:90001}}).call(t,i(8))},function(e,t){class AbstractHandler{constructor(e){this.packetManager=e}handle(e){return e}}e.exports=AbstractHandler},function(e,t){class GenericAction{constructor(e){this.client=e}handle(e){return e}}e.exports=GenericAction},function(e,t){class Collection extends Map{constructor(e){super(e),Object.defineProperty(this,"_array",{value:null,writable:!0,configurable:!0}),Object.defineProperty(this,"_keyArray",{value:null,writable:!0,configurable:!0})}set(e,t){return this._array=null,this._keyArray=null,super.set(e,t)}delete(e){return this._array=null,this._keyArray=null,super.delete(e)}array(){return this._array&&this._array.length===this.size||(this._array=Array.from(this.values())),this._array}keyArray(){return this._keyArray&&this._keyArray.length===this.size||(this._keyArray=Array.from(this.keys())),this._keyArray}first(e){if(void 0===e)return this.values().next().value;if(e<0)return this.last(-1*e);e=Math.min(this.size,e);const t=new Array(e),i=this.values();for(let n=0;n{const n=e.get(i);return n!==t||void 0===n&&!e.has(i)}))}sort(e=((e,t)=>+(e>t)||+(e===t)-1)){return new Collection(Array.from(this.entries()).sort((t,i)=>e(t[1],i[1],t[0],i[0])))}}e.exports=Collection},function(e,t,i){e.exports=i(58),e.exports.Messages=i(112)},function(e,t,i){"use strict";(function(e){function n(){return r.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function s(e,t){if(n()=n())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+n().toString(16)+" bytes");return 0|e}function m(e,t){if(r.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var i=e.length;if(0===i)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return i;case"utf8":case"utf-8":case void 0:return z(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*i;case"hex":return i>>>1;case"base64":return W(e).length;default:if(n)return z(e).length;t=(""+t).toLowerCase(),n=!0}}function g(e,t,i){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===i||i>this.length)&&(i=this.length),i<=0)return"";if(i>>>=0,t>>>=0,i<=t)return"";for(e||(e="utf8");;)switch(e){case"hex":return k(this,t,i);case"utf8":case"utf-8":return R(this,t,i);case"ascii":return D(this,t,i);case"latin1":case"binary":return C(this,t,i);case"base64":return T(this,t,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return N(this,t,i);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function v(e,t,i){var n=e[t];e[t]=e[i],e[i]=n}function E(e,t,i,n,s){if(0===e.length)return-1;if("string"==typeof i?(n=i,i=0):i>2147483647?i=2147483647:i<-2147483648&&(i=-2147483648),i=+i,isNaN(i)&&(i=s?0:e.length-1),i<0&&(i=e.length+i),i>=e.length){if(s)return-1;i=e.length-1}else if(i<0){if(!s)return-1;i=0}if("string"==typeof t&&(t=r.from(t,n)),r.isBuffer(t))return 0===t.length?-1:_(e,t,i,n,s);if("number"==typeof t)return t&=255,r.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?s?Uint8Array.prototype.indexOf.call(e,t,i):Uint8Array.prototype.lastIndexOf.call(e,t,i):_(e,[t],i,n,s);throw new TypeError("val must be string, number or Buffer")}function _(e,t,i,n,s){function r(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}var o=1,a=e.length,c=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;o=2,a/=2,c/=2,i/=2}var l;if(s){var h=-1;for(l=i;la&&(i=a-c),l=i;l>=0;l--){for(var u=!0,p=0;ps&&(n=s):n=s;var r=t.length;if(r%2!=0)throw new TypeError("Invalid hex string");n>r/2&&(n=r/2);for(var o=0;o239?4:r>223?3:r>191?2:1;if(s+a<=i){var c,l,h,u;switch(a){case 1:r<128&&(o=r);break;case 2:128==(192&(c=e[s+1]))&&(u=(31&r)<<6|63&c)>127&&(o=u);break;case 3:c=e[s+1],l=e[s+2],128==(192&c)&&128==(192&l)&&(u=(15&r)<<12|(63&c)<<6|63&l)>2047&&(u<55296||u>57343)&&(o=u);break;case 4:c=e[s+1],l=e[s+2],h=e[s+3],128==(192&c)&&128==(192&l)&&128==(192&h)&&(u=(15&r)<<18|(63&c)<<12|(63&l)<<6|63&h)>65535&&u<1114112&&(o=u)}}null===o?(o=65533,a=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|1023&o),n.push(o),s+=a}return I(n)}function I(e){var t=e.length;if(t<=Z)return String.fromCharCode.apply(String,e);for(var i="",n=0;nn)&&(i=n);for(var s="",r=t;ri)throw new RangeError("Trying to access beyond buffer length")}function O(e,t,i,n,s,o){if(!r.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>s||te.length)throw new RangeError("Index out of range")}function L(e,t,i,n){t<0&&(t=65535+t+1);for(var s=0,r=Math.min(e.length-i,2);s>>8*(n?s:1-s)}function U(e,t,i,n){t<0&&(t=4294967295+t+1);for(var s=0,r=Math.min(e.length-i,4);s>>8*(n?s:3-s)&255}function P(e,t,i,n,s,r){if(i+n>e.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("Index out of range")}function j(e,t,i,n,s){return s||P(e,t,i,4,3.4028234663852886e38,-3.4028234663852886e38),J.write(e,t,i,n,23,4),i+4}function G(e,t,i,n,s){return s||P(e,t,i,8,1.7976931348623157e308,-1.7976931348623157e308),J.write(e,t,i,n,52,8),i+8}function B(e){if((e=q(e).replace(Q,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}function q(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function H(e){return e<16?"0"+e.toString(16):e.toString(16)}function z(e,t){t=t||1/0;for(var i,n=e.length,s=null,r=[],o=0;o55295&&i<57344){if(!s){if(i>56319){(t-=3)>-1&&r.push(239,191,189);continue}if(o+1===n){(t-=3)>-1&&r.push(239,191,189);continue}s=i;continue}if(i<56320){(t-=3)>-1&&r.push(239,191,189),s=i;continue}i=65536+(s-55296<<10|i-56320)}else s&&(t-=3)>-1&&r.push(239,191,189);if(s=null,i<128){if((t-=1)<0)break;r.push(i)}else if(i<2048){if((t-=2)<0)break;r.push(i>>6|192,63&i|128)}else if(i<65536){if((t-=3)<0)break;r.push(i>>12|224,i>>6&63|128,63&i|128)}else{if(!(i<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;r.push(i>>18|240,i>>12&63|128,i>>6&63|128,63&i|128)}}return r}function V(e){for(var t=[],i=0;i>8,s=i%256,r.push(s),r.push(n);return r}function W(e){return K.toByteArray(B(e))}function F(e,t,i,n){for(var s=0;s=t.length||s>=e.length);++s)t[s+i]=e[s];return s}function Y(e){return e!==e}var K=i(80),J=i(81),X=i(47);t.Buffer=r,t.SlowBuffer=function(e){return+e!=e&&(e=0),r.alloc(+e)},t.INSPECT_MAX_BYTES=50,r.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}(),t.kMaxLength=n(),r.poolSize=8192,r._augment=function(e){return e.__proto__=r.prototype,e},r.from=function(e,t,i){return o(null,e,t,i)},r.TYPED_ARRAY_SUPPORT&&(r.prototype.__proto__=Uint8Array.prototype,r.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&r[Symbol.species]===r&&Object.defineProperty(r,Symbol.species,{value:null,configurable:!0})),r.alloc=function(e,t,i){return c(null,e,t,i)},r.allocUnsafe=function(e){return l(null,e)},r.allocUnsafeSlow=function(e){return l(null,e)},r.isBuffer=function(e){return!(null==e||!e._isBuffer)},r.compare=function(e,t){if(!r.isBuffer(e)||!r.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var i=e.length,n=t.length,s=0,o=Math.min(i,n);s0&&(e=this.toString("hex",0,i).match(/.{2}/g).join(" "),this.length>i&&(e+=" ... ")),""},r.prototype.compare=function(e,t,i,n,s){if(!r.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===i&&(i=e?e.length:0),void 0===n&&(n=0),void 0===s&&(s=this.length),t<0||i>e.length||n<0||s>this.length)throw new RangeError("out of range index");if(n>=s&&t>=i)return 0;if(n>=s)return-1;if(t>=i)return 1;if(t>>>=0,i>>>=0,n>>>=0,s>>>=0,this===e)return 0;for(var o=s-n,a=i-t,c=Math.min(o,a),l=this.slice(n,s),h=e.slice(t,i),u=0;us)&&(i=s),e.length>0&&(i<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var r=!1;;)switch(n){case"hex":return y(this,e,t,i);case"utf8":case"utf-8":return b(this,e,t,i);case"ascii":return w(this,e,t,i);case"latin1":case"binary":return x(this,e,t,i);case"base64":return A(this,e,t,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,e,t,i);default:if(r)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),r=!0}},r.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Z=4096;r.prototype.slice=function(e,t){var i=this.length;e=~~e,t=void 0===t?i:~~t,e<0?(e+=i)<0&&(e=0):e>i&&(e=i),t<0?(t+=i)<0&&(t=0):t>i&&(t=i),t0&&(s*=256);)n+=this[e+--t]*s;return n},r.prototype.readUInt8=function(e,t){return t||M(e,1,this.length),this[e]},r.prototype.readUInt16LE=function(e,t){return t||M(e,2,this.length),this[e]|this[e+1]<<8},r.prototype.readUInt16BE=function(e,t){return t||M(e,2,this.length),this[e]<<8|this[e+1]},r.prototype.readUInt32LE=function(e,t){return t||M(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},r.prototype.readUInt32BE=function(e,t){return t||M(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},r.prototype.readIntLE=function(e,t,i){e|=0,t|=0,i||M(e,t,this.length);for(var n=this[e],s=1,r=0;++r=s&&(n-=Math.pow(2,8*t)),n},r.prototype.readIntBE=function(e,t,i){e|=0,t|=0,i||M(e,t,this.length);for(var n=t,s=1,r=this[e+--n];n>0&&(s*=256);)r+=this[e+--n]*s;return s*=128,r>=s&&(r-=Math.pow(2,8*t)),r},r.prototype.readInt8=function(e,t){return t||M(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},r.prototype.readInt16LE=function(e,t){t||M(e,2,this.length);var i=this[e]|this[e+1]<<8;return 32768&i?4294901760|i:i},r.prototype.readInt16BE=function(e,t){t||M(e,2,this.length);var i=this[e+1]|this[e]<<8;return 32768&i?4294901760|i:i},r.prototype.readInt32LE=function(e,t){return t||M(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},r.prototype.readInt32BE=function(e,t){return t||M(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},r.prototype.readFloatLE=function(e,t){return t||M(e,4,this.length),J.read(this,e,!0,23,4)},r.prototype.readFloatBE=function(e,t){return t||M(e,4,this.length),J.read(this,e,!1,23,4)},r.prototype.readDoubleLE=function(e,t){return t||M(e,8,this.length),J.read(this,e,!0,52,8)},r.prototype.readDoubleBE=function(e,t){return t||M(e,8,this.length),J.read(this,e,!1,52,8)},r.prototype.writeUIntLE=function(e,t,i,n){e=+e,t|=0,i|=0,n||O(this,e,t,i,Math.pow(2,8*i)-1,0);var s=1,r=0;for(this[t]=255&e;++r=0&&(r*=256);)this[t+s]=e/r&255;return t+i},r.prototype.writeUInt8=function(e,t,i){return e=+e,t|=0,i||O(this,e,t,1,255,0),r.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},r.prototype.writeUInt16LE=function(e,t,i){return e=+e,t|=0,i||O(this,e,t,2,65535,0),r.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):L(this,e,t,!0),t+2},r.prototype.writeUInt16BE=function(e,t,i){return e=+e,t|=0,i||O(this,e,t,2,65535,0),r.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):L(this,e,t,!1),t+2},r.prototype.writeUInt32LE=function(e,t,i){return e=+e,t|=0,i||O(this,e,t,4,4294967295,0),r.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):U(this,e,t,!0),t+4},r.prototype.writeUInt32BE=function(e,t,i){return e=+e,t|=0,i||O(this,e,t,4,4294967295,0),r.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):U(this,e,t,!1),t+4},r.prototype.writeIntLE=function(e,t,i,n){if(e=+e,t|=0,!n){var s=Math.pow(2,8*i-1);O(this,e,t,i,s-1,-s)}var r=0,o=1,a=0;for(this[t]=255&e;++r>0)-a&255;return t+i},r.prototype.writeIntBE=function(e,t,i,n){if(e=+e,t|=0,!n){var s=Math.pow(2,8*i-1);O(this,e,t,i,s-1,-s)}var r=i-1,o=1,a=0;for(this[t+r]=255&e;--r>=0&&(o*=256);)e<0&&0===a&&0!==this[t+r+1]&&(a=1),this[t+r]=(e/o>>0)-a&255;return t+i},r.prototype.writeInt8=function(e,t,i){return e=+e,t|=0,i||O(this,e,t,1,127,-128),r.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},r.prototype.writeInt16LE=function(e,t,i){return e=+e,t|=0,i||O(this,e,t,2,32767,-32768),r.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):L(this,e,t,!0),t+2},r.prototype.writeInt16BE=function(e,t,i){return e=+e,t|=0,i||O(this,e,t,2,32767,-32768),r.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):L(this,e,t,!1),t+2},r.prototype.writeInt32LE=function(e,t,i){return e=+e,t|=0,i||O(this,e,t,4,2147483647,-2147483648),r.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):U(this,e,t,!0),t+4},r.prototype.writeInt32BE=function(e,t,i){return e=+e,t|=0,i||O(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),r.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):U(this,e,t,!1),t+4},r.prototype.writeFloatLE=function(e,t,i){return j(this,e,t,!0,i)},r.prototype.writeFloatBE=function(e,t,i){return j(this,e,t,!1,i)},r.prototype.writeDoubleLE=function(e,t,i){return G(this,e,t,!0,i)},r.prototype.writeDoubleBE=function(e,t,i){return G(this,e,t,!1,i)},r.prototype.copy=function(e,t,i,n){if(i||(i=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t=0;--s)e[s+t]=this[s+i];else if(o<1e3||!r.TYPED_ARRAY_SUPPORT)for(s=0;s>>=0,i=void 0===i?this.length:i>>>0,e||(e=0);var o;if("number"==typeof e)for(o=t;oObject.prototype.hasOwnProperty.call(e,t);class Util{constructor(){throw new Error(`The ${this.constructor.name} class may not be instantiated.`)}static splitMessage(e,{maxLength:t=1950,char:i="\n",prepend:n="",append:s=""}={}){if(e.length<=t)return e;const r=e.split(i);if(1===r.length)throw new a("SPLIT_MAX_LEN");const o=[""];let c=0;for(let e=0;et&&(o[c]+=s,o.push(n),c++),o[c]+=(o[c].length>0&&o[c]!==n?i:"")+r[e];return o.filter(e=>e)}static escapeMarkdown(e,t=!1,i=!1){return t?e.replace(/```/g,"`​``"):i?e.replace(/\\(`|\\)/g,"$1").replace(/(`|\\)/g,"\\$1"):e.replace(/\\(\*|_|`|~|\\)/g,"$1").replace(/(\*|_|`|~|\\)/g,"\\$1")}static fetchRecommendedShards(e,t=1e3){return new Promise((i,a)=>{if(!e)throw new o("TOKEN_MISSING");n.get(`${r.api}/v${r.version}${s.Endpoints.botGateway}`).set("Authorization",`Bot ${e.replace(/^Bot\s*/i,"")}`).end((e,n)=>{e&&a(e),i(n.body.shards*(1e3/t))})})}static parseEmoji(e){if(e.includes("%")&&(e=decodeURIComponent(e)),e.includes(":")){const[t,i]=e.split(":");return{name:t,id:i}}return{name:e,id:null}}static arraysEqual(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(const i of e){const e=t.indexOf(i);-1!==e&&t.splice(e,1)}return 0===t.length}static cloneObject(e){return Object.assign(Object.create(e),e)}static mergeDefault(e,t){if(!t)return e;for(const i in e)l(t,i)&&void 0!==t[i]?t[i]===Object(t[i])&&(t[i]=this.mergeDefault(e[i],t[i])):t[i]=e[i];return t}static convertToBuffer(e){return"string"==typeof e&&(e=this.str2ab(e)),t.from(e)}static str2ab(e){const t=new ArrayBuffer(2*e.length),i=new Uint16Array(t);for(var n=0,s=e.length;n-1&&i16777215)throw new a("COLOR_RANGE");if(e&&isNaN(e))throw new c("COLOR_CONVERT");return e}}e.exports=Util}).call(t,i(5).Buffer)},function(e,t){function i(){throw new Error("setTimeout has not been defined")}function n(){throw new Error("clearTimeout has not been defined")}function s(e){if(h===setTimeout)return setTimeout(e,0);if((h===i||!h)&&setTimeout)return h=setTimeout,setTimeout(e,0);try{return h(e,0)}catch(t){try{return h.call(null,e,0)}catch(t){return h.call(this,e,0)}}}function r(e){if(u===clearTimeout)return clearTimeout(e);if((u===n||!u)&&clearTimeout)return u=clearTimeout,clearTimeout(e);try{return u(e)}catch(t){try{return u.call(null,e)}catch(t){return u.call(this,e)}}}function o(){m&&d&&(m=!1,d.length?f=d.concat(f):g=-1,f.length&&a())}function a(){if(!m){var e=s(o);m=!0;for(var t=f.length;t;){for(d=f,f=[];++g1)for(var i=1;i=t?String(e):(String(i).repeat(t)+e).slice(-t)}const s=i(43),r=14200704e5;let o=0;class SnowflakeUtil{constructor(){throw new Error(`The ${this.constructor.name} class may not be instantiated.`)}static generate(){o>=4095&&(o=0);const e=`${n((Date.now()-r).toString(2),42)}0000100000${n((o++).toString(2),12)}`;return s.fromString(e,2).toString()}static deconstruct(e){const t=n(s.fromString(e).toString(2),64),i={timestamp:parseInt(t.substring(0,42),2)+r,workerID:parseInt(t.substring(42,47),2),processID:parseInt(t.substring(47,52),2),increment:parseInt(t.substring(52,64),2),binary:t};return Object.defineProperty(i,"date",{get:function(){return new Date(this.timestamp)},enumerable:!0}),i}}e.exports=SnowflakeUtil},function(e,t){class Base{constructor(e){Object.defineProperty(this,"client",{value:e})}_clone(){return Object.assign(Object.create(this),this)}_patch(e){return e}_update(e){const t=this._clone();return this._patch(e),t}}e.exports=Base},function(e,t,i){const n=i(3);class DataStore extends n{constructor(e,t){if(super(),Object.defineProperty(this,"client",{value:e}),t)for(const e of t)this.create(e)}create(){}remove(e){return this.delete(e)}}e.exports=DataStore},function(e,t,i){const{RangeError:n}=i(4);class Permissions{constructor(e){this.bitfield="number"==typeof e?e:this.constructor.resolve(e)}has(e,t=!0){return e instanceof Array?e.every(e=>this.has(e,t)):(e=this.constructor.resolve(e),!!(t&&(this.bitfield&this.constructor.FLAGS.ADMINISTRATOR)>0)||(this.bitfield&e)===e)}missing(e,t=!0){return e.filter(e=>!this.has(e,t))}add(...e){let t=0;for(let i=0;ithis.resolve(e)).reduce((e,t)=>e|t,0);if("string"==typeof e&&(e=this.FLAGS[e]),"number"!=typeof e||e<1)throw new n("PERMISSION_INVALID");return e}}Permissions.FLAGS={CREATE_INSTANT_INVITE:1,KICK_MEMBERS:2,BAN_MEMBERS:4,ADMINISTRATOR:8,MANAGE_CHANNELS:16,MANAGE_GUILD:32,ADD_REACTIONS:64,VIEW_AUDIT_LOG:128,VIEW_CHANNEL:1024,SEND_MESSAGES:2048,SEND_TTS_MESSAGES:4096,MANAGE_MESSAGES:8192,EMBED_LINKS:16384,ATTACH_FILES:32768,READ_MESSAGE_HISTORY:65536,MENTION_EVERYONE:1<<17,USE_EXTERNAL_EMOJIS:1<<18,CONNECT:1<<20,SPEAK:1<<21,MUTE_MEMBERS:1<<22,DEAFEN_MEMBERS:1<<23,MOVE_MEMBERS:1<<24,USE_VAD:1<<25,CHANGE_NICKNAME:1<<26,MANAGE_NICKNAMES:1<<27,MANAGE_ROLES:1<<28,MANAGE_WEBHOOKS:1<<29,MANAGE_EMOJIS:1<<30},Permissions.ALL=Object.values(Permissions.FLAGS).reduce((e,t)=>e|t,0),Permissions.DEFAULT=104324097,e.exports=Permissions},function(e,t){function i(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function n(e){return"function"==typeof e}function s(e){return"number"==typeof e}function r(e){return"object"==typeof e&&null!==e}function o(e){return void 0===e}e.exports=i,i.EventEmitter=i,i.prototype._events=void 0,i.prototype._maxListeners=void 0,i.defaultMaxListeners=10,i.prototype.setMaxListeners=function(e){if(!s(e)||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},i.prototype.emit=function(e){var t,i,s,a,c,l;if(this._events||(this._events={}),"error"===e&&(!this._events.error||r(this._events.error)&&!this._events.error.length)){if((t=arguments[1])instanceof Error)throw t;var h=new Error('Uncaught, unspecified "error" event. ('+t+")");throw h.context=t,h}if(i=this._events[e],o(i))return!1;if(n(i))switch(arguments.length){case 1:i.call(this);break;case 2:i.call(this,arguments[1]);break;case 3:i.call(this,arguments[1],arguments[2]);break;default:a=Array.prototype.slice.call(arguments,1),i.apply(this,a)}else if(r(i))for(a=Array.prototype.slice.call(arguments,1),s=(l=i.slice()).length,c=0;c0&&this._events[e].length>s&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace()),this},i.prototype.on=i.prototype.addListener,i.prototype.once=function(e,t){function i(){this.removeListener(e,i),s||(s=!0,t.apply(this,arguments))}if(!n(t))throw TypeError("listener must be a function");var s=!1;return i.listener=t,this.on(e,i),this},i.prototype.removeListener=function(e,t){var i,s,o,a;if(!n(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(i=this._events[e],o=i.length,s=-1,i===t||n(i.listener)&&i.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(r(i)){for(a=o;a-- >0;)if(i[a]===t||i[a].listener&&i[a].listener===t){s=a;break}if(s<0)return this;1===i.length?(i.length=0,delete this._events[e]):i.splice(s,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},i.prototype.removeAllListeners=function(e){var t,i;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(i=this._events[e],n(i))this.removeListener(e,i);else if(i)for(;i.length;)this.removeListener(e,i[i.length-1]);return delete this._events[e],this},i.prototype.listeners=function(e){return this._events&&this._events[e]?n(this._events[e])?[this._events[e]]:this._events[e].slice():[]},i.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(n(t))return 1;if(t)return t.length}return 0},i.listenerCount=function(e,t){return e.listenerCount(t)}},function(e,t){"function"==typeof Object.create?e.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(e,t){e.super_=t;var i=function(){};i.prototype=t.prototype,e.prototype=new i,e.prototype.constructor=e}},function(e,t,i){const n=i(9),s=i(10),r=i(0);class Channel extends s{constructor(e,t){super(e);const i=Object.keys(r.ChannelTypes)[t.type];this.type=i?i.toLowerCase():"unknown",t&&this._patch(t)}_patch(e){this.id=e.id}get createdTimestamp(){return n.deconstruct(this.id).timestamp}get createdAt(){return new Date(this.createdTimestamp)}delete(){return this.client.api.channels(this.id).delete().then(()=>this)}static create(e,t,n){const s=i(63),o=i(67),a=i(68),c=i(70),l=i(28),h=r.ChannelTypes;let u;if(t.type===h.DM)u=new s(e,t);else if(t.type===h.GROUP)u=new o(e,t);else if(n=n||e.guilds.get(t.guild_id)){switch(t.type){case h.TEXT:u=new a(n,t);break;case h.VOICE:u=new c(n,t);break;default:u=new l(n,t)}n.channels.set(u.id,u)}return u}}e.exports=Channel},function(e,t,i){"use strict";function n(e){if(!(this instanceof n))return new n(e);l.call(this,e),h.call(this,e),e&&!1===e.readable&&(this.readable=!1),e&&!1===e.writable&&(this.writable=!1),this.allowHalfOpen=!0,e&&!1===e.allowHalfOpen&&(this.allowHalfOpen=!1),this.once("end",s)}function s(){this.allowHalfOpen||this._writableState.ended||o(r,this)}function r(e){e.end()}var o=i(30),a=Object.keys||function(e){var t=[];for(var i in e)t.push(i);return t};e.exports=n;var c=i(23);c.inherits=i(14);var l=i(48),h=i(39);c.inherits(n,l);for(var u=a(h.prototype),p=0;p!e||t.comparePositionTo(e)>0?t:e)}get colorRole(){const e=this.roles.filter(e=>e.color);return e.size?e.reduce((e,t)=>!e||t.comparePositionTo(e)>0?t:e):null}get displayColor(){const e=this.colorRole;return e&&e.color||0}get displayHexColor(){const e=this.colorRole;return e&&e.hexColor||"#000000"}get hoistRole(){const e=this.roles.filter(e=>e.hoist);return e.size?e.reduce((e,t)=>!e||t.comparePositionTo(e)>0?t:e):null}get mute(){return this.selfMute||this.serverMute}get deaf(){return this.selfDeaf||this.serverDeaf}get voiceChannel(){return this.guild.channels.get(this.voiceChannelID)}get id(){return this.user.id}get displayName(){return this.nickname||this.user.username}get permissions(){if(this.user.id===this.guild.ownerID)return new r(r.ALL);let e=0;const t=this.roles;for(const i of t.values())e|=i.permissions;return new r(e)}get kickable(){if(this.user.id===this.guild.ownerID)return!1;if(this.user.id===this.client.user.id)return!1;const e=this.guild.member(this.client.user);return!!e.permissions.has(r.FLAGS.KICK_MEMBERS)&&e.highestRole.comparePositionTo(this.highestRole)>0}get bannable(){if(this.user.id===this.guild.ownerID)return!1;if(this.user.id===this.client.user.id)return!1;const e=this.guild.member(this.client.user);return!!e.permissions.has(r.FLAGS.BAN_MEMBERS)&&e.highestRole.comparePositionTo(this.highestRole)>0}permissionsIn(e){if(!(e=this.client.resolver.resolveChannel(e))||!e.guild)throw new l("GUILD_CHANNEL_RESOLVE");return e.permissionsFor(this)}hasPermission(e,t=!1,i,n){return void 0===i&&(i=!t),void 0===n&&(n=!t),!(!n||this.user.id!==this.guild.ownerID)||this.roles.some(t=>t.hasPermission(e,void 0,i))}missingPermissions(e,t=!1){return e.missing(e,t)}edit(e,t){e.channel&&(e.channel_id=this.client.resolver.resolveChannel(e.channel).id,e.channel=null),e.roles&&(e.roles=e.roles.map(e=>e instanceof s?e.id:e));let i=this.client.api.guilds(this.guild.id);if(this.user.id===this.client.user.id){const t=Object.keys(e);i=1===t.length&&"nick"===t[0]?i.members("@me").nick:i.members(this.id)}else i=i.members(this.id);return i.patch({data:e,reason:t}).then(()=>{const t=this._clone();return e.user=this.user,t._patch(e),t._frozenVoiceState=this.voiceState,void 0!==e.mute&&(t._frozenVoiceState.mute=e.mute),void 0!==e.deaf&&(t._frozenVoiceState.mute=e.deaf),void 0!==e.channel_id&&(t._frozenVoiceState.channel_id=e.channel_id),t})}setMute(e,t){return this.edit({mute:e},t)}setDeaf(e,t){return this.edit({deaf:e},t)}setVoiceChannel(e){return this.edit({channel:e})}setRoles(e,t){return this.edit({roles:e},t)}addRole(e,t){return(e=this.client.resolver.resolveRole(this.guild,e))?this._roles.includes(e.id)?Promise.resolve(this):this.client.api.guilds(this.guild.id).members(this.user.id).roles(e.id).put({reason:t}).then(()=>{const t=this._clone();return t._roles.includes(e.id)||t._roles.push(e.id),t}):Promise.reject(new h("INVALID_TYPE","role","Role nor a Snowflake"))}addRoles(e,t){let i=this._roles.slice();for(let t of e instanceof o?e.values():e){if(!(t=this.client.resolver.resolveRole(this.guild,t)))return Promise.reject(new h("INVALID_TYPE","roles","Array or Collection of Roles or Snowflakes",!0));i.push(t.id)}return this.edit({roles:i},t)}removeRole(e,t){return(e=this.client.resolver.resolveRole(this.guild,e))?this._roles.includes(e.id)?this.client.api.guilds(this.guild.id).members(this.user.id).roles(e.id).delete({reason:t}).then(()=>{const t=this._clone(),i=t._roles.indexOf(e.id);return~i&&t._roles.splice(i,1),t}):Promise.resolve(this):Promise.reject(new h("INVALID_TYPE","role","Role nor a Snowflake"))}removeRoles(e,t){const i=this._roles.slice();for(let t of e instanceof o?e.values():e){if(!(t=this.client.resolver.resolveRole(this.guild,t)))return Promise.reject(new h("INVALID_TYPE","roles","Array or Collection of Roles or Snowflakes",!0));const e=i.indexOf(t.id);e>=0&&i.splice(e,1)}return this.edit({roles:i},t)}setNickname(e,t){return this.edit({nick:e},t)}createDM(){return this.user.createDM()}deleteDM(){return this.user.deleteDM()}kick(e){return this.client.api.guilds(this.guild.id).members(this.user.id).delete({reason:e}).then(()=>this.client.actions.GuildMemberRemove.handle({guild_id:this.guild.id,user:this.user}).member)}ban(e){return this.guild.ban(this,e)}toString(){return`<@${this.nickname?"!":""}${this.user.id}>`}send(){}}n.applyToClass(GuildMember),e.exports=GuildMember},function(e,t,i){const n=i(9),s=i(12),r=i(7),o=i(10),{TypeError:a}=i(4);class Role extends o{constructor(e,t){super(e.client),this.guild=e,t&&this._patch(t)}_patch(e){this.id=e.id,this.name=e.name,this.color=e.color,this.hoist=e.hoist,this.position=e.position,this.permissions=e.permissions,this.managed=e.managed,this.mentionable=e.mentionable}get createdTimestamp(){return n.deconstruct(this.id).timestamp}get createdAt(){return new Date(this.createdTimestamp)}get hexColor(){let e=this.color.toString(16);for(;e.length<6;)e=`0${e}`;return`#${e}`}get members(){return this.guild.members.filter(e=>e.roles.has(this.id))}get editable(){if(this.managed)return!1;const e=this.guild.member(this.client.user);return!!e.permissions.has(s.FLAGS.MANAGE_ROLES)&&e.highestRole.comparePositionTo(this)>0}get calculatedPosition(){const e=this.guild._sortedRoles;return e.array().indexOf(e.get(this.id))}serialize(){return new s(this.permissions).serialize()}hasPermission(e,t=!1,i){return new s(this.permissions).has(e,void 0!==i?i:!t)}comparePositionTo(e){return(e=this.client.resolver.resolveRole(this.guild,e))?this.constructor.comparePositions(this,e):Promise.reject(new a("INVALID_TYPE","role","Role nor a Snowflake"))}edit(e,t){return e.permissions?e.permissions=s.resolve(e.permissions):e.permissions=this.permissions,this.client.api.guilds[this.guild.id].roles[this.id].patch({data:{name:e.name||this.name,color:r.resolveColor(e.color||this.color),hoist:void 0!==e.hoist?e.hoist:this.hoist,position:void 0!==e.position?e.position:this.position,permissions:e.permissions,mentionable:void 0!==e.mentionable?e.mentionable:this.mentionable},reason:t}).then(e=>{const t=this._clone();return t._patch(e),t})}setName(e,t){return this.edit({name:e},t)}setColor(e,t){return this.edit({color:e},t)}setHoist(e,t){return this.edit({hoist:e},t)}setPosition(e,t){return this.guild.setRolePosition(this,e,t).then(()=>this)}setPermissions(e,t){return this.edit({permissions:e},t)}setMentionable(e,t){return this.edit({mentionable:e},t)}delete(e){return this.client.api.guilds[this.guild.id].roles[this.id].delete({reason:e}).then(()=>(this.client.actions.GuildRoleDelete.handle({guild_id:this.guild.id,role_id:this.id}),this))}equals(e){return e&&this.id===e.id&&this.name===e.name&&this.color===e.color&&this.hoist===e.hoist&&this.position===e.position&&this.permissions===e.permissions&&this.managed===e.managed}toString(){return this.id===this.guild.id?"@everyone":`<@&${this.id}>`}static comparePositions(e,t){return e.position===t.position?t.id-e.id:e.position-t.position}}e.exports=Role},function(e,t,i){const n=i(0);class Presence{constructor(e,t={}){Object.defineProperty(this,"client",{value:e}),this.patch(t)}patch(e){this.status=e.status||this.status;const t=e.game||e.activity;this.activity=t?new Activity(this,t):null}_clone(){const e=Object.assign(Object.create(this),this);return this.activity&&(e.activity=this.activity._clone()),e}equals(e){return this===e||(e&&this.status===e.status&&this.activity?this.activity.equals(e.activity):!e.activity)}}class Activity{constructor(e,t){Object.defineProperty(this,"presence",{value:e}),this.name=t.name,this.type=n.ActivityTypes[t.type],this.url=t.url||null,this.details=t.details||null,this.state=t.state||null,this.applicationID=t.application_id||null,this.timestamps=t.timestamps?{start:t.timestamps.start?new Date(t.timestamps.start):null,end:t.timestamps.end?new Date(t.timestamps.end):null}:null,this.party=t.party||null,this.assets=t.assets?new RichPresenceAssets(this,t.assets):null}equals(e){return this===e||e&&this.name===e.name&&this.type===e.type&&this.url===e.url}_clone(){return Object.assign(Object.create(this),this)}}class RichPresenceAssets{constructor(e,t){Object.defineProperty(this,"activity",{value:e}),this.largeText=t.large_text||null,this.smallText=t.small_text||null,this.largeImage=t.large_image||null,this.smallImage=t.small_image||null}smallImageURL({format:e,size:t}={}){return this.smallImage?this.activity.presence.client.rest.cdn.AppAsset(this.activity.applicationID,this.smallImage,{format:e,size:t}):null}largeImageURL({format:e,size:t}={}){return this.largeImage?this.activity.presence.client.rest.cdn.AppAsset(this.activity.applicationID,this.largeImage,{format:e,size:t}):null}}t.Presence=Presence,t.Activity=Activity,t.RichPresenceAssets=RichPresenceAssets},function(e,t,i){const n=i(27),s=i(7),{RangeError:r}=i(4);class MessageEmbed{constructor(e={}){this.setup(e)}setup(e){if(this.type=e.type,this.title=e.title,this.description=e.description,this.url=e.url,this.color=e.color,this.timestamp=e.timestamp?new Date(e.timestamp).getTime():null,this.fields=e.fields||[],this.thumbnail=e.thumbnail?{url:e.thumbnail.url,proxyURL:e.thumbnail.proxy_url,height:e.height,width:e.width}:null,this.image=e.image?{url:e.image.url,proxyURL:e.image.proxy_url,height:e.height,width:e.width}:null,this.video=e.video,this.author=e.author?{name:e.author.name,url:e.author.url,iconURL:e.author.iconURL||e.author.icon_url,proxyIconURL:e.author.proxyIconUrl||e.author.proxy_icon_url}:null,this.provider=e.provider,this.footer=e.footer?{text:e.footer.text,iconURL:e.footer.iconURL||e.footer.icon_url,proxyIconURL:e.footer.proxyIconURL||e.footer.proxy_icon_url}:null,e.files)for(let t of e.files)t instanceof n&&(t=t.file);else e.files=null}get createdAt(){return this.timestamp?new Date(this.timestamp):null}get hexColor(){return this.color?`#${this.color.toString(16).padStart(6,"0")}`:null}addField(e,t,i=!1){if(this.fields.length>=25)throw new r("EMBED_FIELD_COUNT");if(e=s.resolveString(e),!String(e)||e.length>256)throw new r("EMBED_FIELD_NAME");if(t=s.resolveString(t),!String(t)||t.length>1024)throw new r("EMBED_FIELD_VALUE");return this.fields.push({name:e,value:t,inline:i}),this}addBlankField(e=!1){return this.addField("​","​",e)}attachFiles(e){this.files?this.files=this.files.concat(e):this.files=e;for(let t of e)t instanceof n&&(t=t.file);return this}setAuthor(e,t,i){return this.author={name:s.resolveString(e),iconURL:t,url:i},this}setColor(e){return this.color=s.resolveColor(e),this}setDescription(e){if((e=s.resolveString(e)).length>2048)throw new r("EMBED_DESCRIPTION");return this.description=e,this}setFooter(e,t){if((e=s.resolveString(e)).length>2048)throw new r("EMBED_FOOTER_TEXT");return this.footer={text:e,iconURL:t},this}setImage(e){return this.image={url:e},this}setThumbnail(e){return this.thumbnail={url:e},this}setTimestamp(e=new Date){return this.timestamp=e.getTime(),this}setTitle(e){if((e=s.resolveString(e)).length>256)throw new r("EMBED_TITLE");return this.title=e,this}setURL(e){return this.url=e,this}_apiTransform(){return{title:this.title,type:"rich",description:this.description,url:this.url,timestamp:this.timestamp?new Date(this.timestamp):null,color:this.color,fields:this.fields,files:this.files,thumbnail:this.thumbnail,image:this.image,author:this.author?{name:this.author.name,url:this.author.url,icon_url:this.author.iconURL}:null,footer:this.footer?{text:this.footer.text,icon_url:this.footer.iconURL}:null}}}e.exports=MessageEmbed},function(e,t,i){(function(t){const n=i(24),s=i(7),r=i(20),o=i(27),a=i(20);class Webhook{constructor(e,t){Object.defineProperty(this,"client",{value:e}),t&&this._patch(t)}_patch(e){this.name=e.name,this.token=e.token,this.avatar=e.avatar,this.id=e.id,this.guildID=e.guild_id,this.channelID=e.channel_id,e.user?this.owner=this.client.users?this.client.users.get(e.user.id):e.user:this.owner=null}send(e,i){if(i||"object"!=typeof e||e instanceof Array?i||(i={}):(i=e,e=""),i instanceof o&&(i={files:[i.file]}),i instanceof a&&(i={embeds:[i]}),i.embed&&(i={embeds:[i.embed]}),e instanceof Array||i instanceof Array){const t=e instanceof Array?e:i,n=t.filter(e=>e instanceof o),s=t.filter(e=>e instanceof a);n.length&&(i={files:n}),s.length&&(i={embeds:s}),(s.length||n.length)&&e instanceof Array&&(e="")}if(i.username||(i.username=this.name),i.avatarURL&&(i.avatar_url=i.avatarURL,i.avatarURL=null),e){e=s.resolveString(e);let{split:t,code:n,disableEveryone:r}=i;t&&"object"!=typeof t&&(t={}),void 0===n||"boolean"==typeof n&&!0!==n||(e=s.escapeMarkdown(e,!0),e=`\`\`\`${"boolean"!=typeof n?n||"":""}\n${e}\n\`\`\``,t&&(t.prepend=`\`\`\`${"boolean"!=typeof n?n||"":""}\n`,t.append="\n```")),(r||void 0===r&&this.client.options.disableEveryone)&&(e=e.replace(/@(everyone|here)/g,"@​$1")),t&&(e=s.splitMessage(e,t))}if(i.content=e,i.embeds&&(i.embeds=i.embeds.map(e=>new r(e)._apiTransform())),i.files){for(let e=0;ethis.client.resolver.resolveFile(e.attachment).then(t=>(e.file=t,e)))).then(e=>this.client.api.webhooks(this.id,this.token).post({data:i,query:{wait:!0},files:e,auth:!1}))}return e instanceof Array?new Promise((t,n)=>{const s=[];(function r(){const o=e.length?null:{embeds:i.embeds,files:i.files};this.client.api.webhooks(this.id,this.token).post({data:{content:e.shift(),opt:o},query:{wait:!0},auth:!1}).then(i=>(s.push(i),0===e.length?t(s):r.call(this))).catch(n)}).call(this)}):this.client.api.webhooks(this.id,this.token).post({data:i,query:{wait:!0},auth:!1}).then(e=>this.client.channels?this.client.channels.get(e.channel_id).messages.create(e,!1):e)}sendSlackMessage(e){return this.client.api.webhooks(this.id,this.token).slack.post({query:{wait:!0},auth:!1,data:e}).then(e=>this.client.channels?this.client.channels.get(e.channel_id).messages.create(e,!1):e)}edit({name:e=this.name,avatar:t},i){return t&&"string"==typeof t&&!t.startsWith("data:")?this.client.resolver.resolveImage(t).then(t=>this.edit({name:e,avatar:t},i)):this.client.api.webhooks(this.id,this.token).patch({data:{name:e,avatar:t},reason:i}).then(e=>(this.name=e.name,this.avatar=e.avatar,this))}delete(e){return this.client.api.webhooks(this.id,this.token).delete({reason:e})}static applyToClass(e){for(const t of["send","sendSlackMessage","edit","delete"])Object.defineProperty(e.prototype,t,Object.getOwnPropertyDescriptor(Webhook.prototype,t))}}e.exports=Webhook}).call(t,i(5).Buffer)},function(e,t,i){(t=e.exports=i(48)).Stream=t,t.Readable=t,t.Writable=i(39),t.Duplex=i(16),t.Transform=i(52),t.PassThrough=i(88)},function(e,t,i){(function(e){function i(e){return Object.prototype.toString.call(e)}t.isArray=function(e){return Array.isArray?Array.isArray(e):"[object Array]"===i(e)},t.isBoolean=function(e){return"boolean"==typeof e},t.isNull=function(e){return null===e},t.isNullOrUndefined=function(e){return null==e},t.isNumber=function(e){return"number"==typeof e},t.isString=function(e){return"string"==typeof e},t.isSymbol=function(e){return"symbol"==typeof e},t.isUndefined=function(e){return void 0===e},t.isRegExp=function(e){return"[object RegExp]"===i(e)},t.isObject=function(e){return"object"==typeof e&&null!==e},t.isDate=function(e){return"[object Date]"===i(e)},t.isError=function(e){return"[object Error]"===i(e)||e instanceof Error},t.isFunction=function(e){return"function"==typeof e},t.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},t.isBuffer=e.isBuffer}).call(t,i(5).Buffer)},function(e,t,i){(function(e){function i(e,t){for(var i=0,n=e.length-1;n>=0;n--){var s=e[n];"."===s?e.splice(n,1):".."===s?(e.splice(n,1),i++):i&&(e.splice(n,1),i--)}if(t)for(;i--;i)e.unshift("..");return e}function n(e,t){if(e.filter)return e.filter(t);for(var i=[],n=0;n=-1&&!s;r--){var o=r>=0?arguments[r]:e.cwd();if("string"!=typeof o)throw new TypeError("Arguments to path.resolve must be strings");o&&(t=o+"/"+t,s="/"===o.charAt(0))}return t=i(n(t.split("/"),function(e){return!!e}),!s).join("/"),(s?"/":"")+t||"."},t.normalize=function(e){var s=t.isAbsolute(e),r="/"===o(e,-1);return(e=i(n(e.split("/"),function(e){return!!e}),!s).join("/"))||s||(e="."),e&&r&&(e+="/"),(s?"/":"")+e},t.isAbsolute=function(e){return"/"===e.charAt(0)},t.join=function(){var e=Array.prototype.slice.call(arguments,0);return t.normalize(n(e,function(e,t){if("string"!=typeof e)throw new TypeError("Arguments to path.join must be strings");return e}).join("/"))},t.relative=function(e,i){function n(e){for(var t=0;t=0&&""===e[i];i--);return t>i?[]:e.slice(t,i-t+1)}e=t.resolve(e).substr(1),i=t.resolve(i).substr(1);for(var s=n(e.split("/")),r=n(i.split("/")),o=Math.min(s.length,r.length),a=o,c=0;c"dm"===e.type).find(e=>e.recipient.id===this.id)}createDM(){return this.dmChannel?Promise.resolve(this.dmChannel):this.client.api.users(this.client.user.id).channels.post({data:{recipient_id:this.id}}).then(e=>this.client.actions.ChannelCreate.handle(e).channel)}deleteDM(){return this.dmChannel?this.client.api.channels(this.dmChannel.id).delete().then(e=>this.client.actions.ChannelDelete.handle(e).channel):Promise.reject(new c("USER_NO_DMCHANNEL"))}fetchProfile(){return this.client.api.users(this.id).profile.get().then(e=>new r(this,e))}setNote(e){return this.client.api.users("@me").notes(this.id).put({data:{note:e}}).then(()=>this)}equals(e){return e&&this.id===e.id&&this.username===e.username&&this.discriminator===e.discriminator&&this.avatar===e.avatar}toString(){return`<@${this.id}>`}send(){}}n.applyToClass(User),e.exports=User},function(e,t,i){(function(t){const n=i(24),s=i(61),r=i(62),o=i(33),a=i(9),c=i(3),l=i(27),h=i(20),{RangeError:u,TypeError:p}=i(4);class TextBasedChannel{constructor(){this.messages=new o(this),this.lastMessageID=null,this.lastMessage=null}send(e,i){if(i||"object"!=typeof e||e instanceof Array?i||(i={}):(i=e,e=""),i instanceof h&&(i={embed:i}),i instanceof l&&(i={files:[i.file]}),e instanceof Array||i instanceof Array){const t=(e instanceof Array?e:i).filter(e=>e instanceof l);t.length&&(i={files:t},e instanceof Array&&(e=""))}if(i.content||(i.content=e),i.embed&&i.embed.files&&(i.files?i.files=i.files.concat(i.embed.files):i.files=i.embed.files),i.files){for(let e=0;ethis.client.resolver.resolveFile(e.attachment).then(t=>(e.file=t,e)))).then(e=>(i.files=e,r.sendMessage(this,i)))}return r.sendMessage(this,i)}search(e={}){return r.search(this,e)}startTyping(e){if(void 0!==e&&e<1)throw new u("TYPING_COUNT");if(this.client.user._typing.has(this.id)){const t=this.client.user._typing.get(this.id);t.count=e||t.count+1}else{const t=this.client.api.channels[this.id].typing;this.client.user._typing.set(this.id,{count:e||1,interval:this.client.setInterval(()=>{t.post()},9e3)}),t.post()}}stopTyping(e=!1){if(this.client.user._typing.has(this.id)){const t=this.client.user._typing.get(this.id);t.count--,(t.count<=0||e)&&(this.client.clearInterval(t.interval),this.client.user._typing.delete(this.id))}}get typing(){return this.client.user._typing.has(this.id)}get typingCount(){return this.client.user._typing.has(this.id)?this.client.user._typing.get(this.id).count:0}createMessageCollector(e,t={}){return new s(this,e,t)}awaitMessages(e,t={}){return new Promise((i,n)=>{this.createMessageCollector(e,t).once("end",(e,s)=>{t.errors&&t.errors.includes(s)?n(e):i(e)})})}bulkDelete(e,t=!1){if(!isNaN(e))return this.messages.fetch({limit:e}).then(e=>this.bulkDelete(e,t));if(e instanceof Array||e instanceof c){let i=e instanceof c?e.keyArray():e.map(e=>e.id);return t&&(i=i.filter(e=>Date.now()-a.deconstruct(e).date.getTime()<12096e5)),this.client.api.channels[this.id].messages["bulk-delete"].post({data:{messages:i}}).then(()=>this.client.actions.MessageDeleteBulk.handle({channel_id:this.id,ids:i}).messages)}throw new p("MESSAGE_BULK_DELETE_TYPE")}acknowledge(){return this.lastMessageID?this.client.api.channels[this.id].messages[this.lastMessageID].ack.post({data:{token:this.client.rest._ackToken}}).then(e=>(e.token&&(this.client.rest._ackToken=e.token),this)):Promise.resolve(this)}static applyToClass(e,t=!1,i=[]){const n=["send"];t&&n.push("acknowledge","search","bulkDelete","startTyping","stopTyping","typing","typingCount","createMessageCollector","awaitMessages");for(const t of n)i.includes(t)||Object.defineProperty(e.prototype,t,Object.getOwnPropertyDescriptor(TextBasedChannel.prototype,t))}}e.exports=TextBasedChannel}).call(t,i(5).Buffer)},function(e,t){class MessageAttachment{constructor(e,t,i){this.file=null,i&&this._patch(i),t?this.setAttachment(e,t):this._attach(e)}get name(){return this.file.name}get attachment(){return this.file.attachment}setAttachment(e,t){return this.file={attachment:e,name:t},this}setFile(e){return this.file={attachment:e},this}setName(e){return this.file.name=e,this}_attach(e,t){"string"==typeof e?this.file=e:this.setAttachment(e,t)}_patch(e){this.id=e.id,this.size=e.size,this.url=e.url,this.proxyURL=e.proxy_url,this.height=e.height,this.width=e.width}}e.exports=MessageAttachment},function(e,t,i){const n=i(15),s=i(18),r=i(35),o=i(69),a=i(12),c=i(3),l=i(0),{TypeError:h}=i(4);class GuildChannel extends n{constructor(e,t){super(e.client,t),this.guild=e}_patch(e){if(super._patch(e),this.name=e.name,this.position=e.position,this.permissionOverwrites=new c,e.permission_overwrites)for(const t of e.permission_overwrites)this.permissionOverwrites.set(t.id,new o(this,t))}get calculatedPosition(){const e=this.guild._sortedChannels(this.type);return e.array().indexOf(e.get(this.id))}permissionsFor(e){if(!(e=this.client.resolver.resolveGuildMember(this.guild,e)))return null;if(e.id===this.guild.ownerID)return new a(a.ALL);let t=0;const i=e.roles;for(const e of i.values())t|=e.permissions;const n=this.overwritesFor(e,!0,i);n.everyone&&(t&=~n.everyone._denied,t|=n.everyone._allowed);let s=0;for(const e of n.roles)t&=~e._denied,s|=e._allowed;return t|=s,n.member&&(t&=~n.member._denied,t|=n.member._allowed),Boolean(t&a.FLAGS.ADMINISTRATOR)&&(t=a.ALL),new a(t)}overwritesFor(e,t=!1,i=null){if(t||(e=this.client.resolver.resolveGuildMember(this.guild,e)),!e)return[];i=i||e.roles;const n=[];let s,r;for(const t of this.permissionOverwrites.values())t.id===this.guild.id?r=t:i.has(t.id)?n.push(t):t.id===e.id&&(s=t);return{everyone:r,roles:n,member:s}}overwritePermissions(e,t,i){const n={allow:0,deny:0};if(e instanceof s)n.type="role";else if(this.guild.roles.has(e))e=this.guild.roles.get(e),n.type="role";else if(e=this.client.resolver.resolveUser(e),n.type="member",!e)return Promise.reject(new h("INVALID_TYPE","parameter","User nor a Role",!0));n.id=e.id;const r=this.permissionOverwrites.get(e.id);r&&(n.allow=r._allowed,n.deny=r._denied);for(const e in t)!0===t[e]?(n.allow|=a.FLAGS[e]||0,n.deny&=~(a.FLAGS[e]||0)):!1===t[e]?(n.allow&=~(a.FLAGS[e]||0),n.deny|=a.FLAGS[e]||0):null===t[e]&&(n.allow&=~(a.FLAGS[e]||0),n.deny&=~(a.FLAGS[e]||0));return this.client.api.channels(this.id).permissions[n.id].put({data:n,reason:i}).then(()=>this)}get members(){const e=new c;for(const t of this.guild.members.values())this.permissionsFor(t).has("VIEW_CHANNEL")&&e.set(t.id,t);return e}edit(e,t){return this.client.api.channels(this.id).patch({data:{name:(e.name||this.name).trim(),topic:e.topic||this.topic,position:e.position||this.position,bitrate:e.bitrate||(this.bitrate?1e3*this.bitrate:void 0),user_limit:e.userLimit||this.userLimit},reason:t}).then(e=>{const t=this._clone();return t._patch(e),t})}setName(e,t){return this.edit({name:e},t)}setPosition(e,t){return this.guild.setChannelPosition(this,e,t).then(()=>this)}setTopic(e,t){return this.edit({topic:e},t)}createInvite({temporary:e=!1,maxAge:t=86400,maxUses:i=0,unique:n,reason:s}={}){return this.client.api.channels(this.id).invites.post({data:{temporary:e,max_age:t,max_uses:i,unique:n},reason:s}).then(e=>new r(this.client,e))}clone({name:e=this.name,withPermissions:t=!0,withTopic:i=!0,reason:n}={}){const s={overwrites:t?this.permissionOverwrites:[],reason:n};return this.guild.createChannel(e,this.type,s).then(e=>i?e.setTopic(this.topic):e)}equals(e){let t=e&&this.id===e.id&&this.type===e.type&&this.topic===e.topic&&this.position===e.position&&this.name===e.name;return t&&(t=this.permissionOverwrites&&e.permissionOverwrites?this.permissionOverwrites.equals(e.permissionOverwrites):!this.permissionOverwrites&&!e.permissionOverwrites),t}get deletable(){return this.id!==this.guild.id&&this.permissionsFor(this.client.user).has(a.FLAGS.MANAGE_CHANNELS)}delete(e){return this.client.api.channels(this.id).delete({reason:e}).then(()=>this)}get muted(){if(this.client.user.bot)return null;try{return this.client.user.guildSettings.get(this.guild.id).channelOverrides.get(this.id).muted}catch(e){return!1}}get messageNotifications(){if(this.client.user.bot)return null;try{return this.client.user.guildSettings.get(this.guild.id).channelOverrides.get(this.id).messageNotifications}catch(e){return l.MessageNotificationTypes[3]}}toString(){return`<#${this.id}>`}}e.exports=GuildChannel},function(e,t,i){const n=i(43),s=i(18),r=i(35),o=i(71),a=i(21),c=i(28),l=i(17),h=i(72),u=i(0),p=i(3),d=i(7),f=i(9),m=i(12),g=i(62),v=i(124),E=i(125),_=i(126),y=i(127),b=i(73),w=i(10),{Error:x,TypeError:A}=i(4);class Guild extends w{constructor(e,t){super(e),this.members=new v(this),this.channels=new y(this),this.roles=new E(this),this.presences=new b(this.client),t&&(t.unavailable?(this.available=!1,this.id=t.id):(this._patch(t),t.channels||(this.available=!1)))}_patch(e){if(this.name=e.name,this.icon=e.icon,this.splash=e.splash,this.region=e.region,this.memberCount=e.member_count||this.memberCount,this.large=Boolean("large"in e?e.large:this.large),this.features=e.features,this.applicationID=e.application_id,this.afkTimeout=e.afk_timeout,this.afkChannelID=e.afk_channel_id,this.systemChannelID=e.system_channel_id,this.embedEnabled=e.embed_enabled,this.verificationLevel=e.verification_level,this.explicitContentFilter=e.explicit_content_filter,this.joinedTimestamp=e.joined_at?new Date(e.joined_at).getTime():this.joinedTimestamp,this.id=e.id,this.available=!e.unavailable,this.features=e.features||this.features||[],e.members){this.members.clear();for(const t of e.members)this.members.create(t)}if(e.owner_id&&(this.ownerID=e.owner_id),e.channels){this.channels.clear();for(const t of e.channels)this.client.channels.create(t,this)}if(e.roles){this.roles.clear();for(const t of e.roles)this.roles.create(t)}if(e.presences)for(const t of e.presences)this.presences.create(t);if(this.voiceStates=new VoiceStateCollection(this),e.voice_states)for(const t of e.voice_states)this.voiceStates.set(t.user_id,t);if(this.emojis)this.client.actions.GuildEmojisUpdate.handle({guild_id:this.id,emojis:e.emojis});else if(this.emojis=new _(this),e.emojis)for(const t of e.emojis)this.emojis.create(t)}get createdTimestamp(){return f.deconstruct(this.id).timestamp}get createdAt(){return new Date(this.createdTimestamp)}get joinedAt(){return new Date(this.joinedTimestamp)}iconURL({format:e,size:t}={}){return this.icon?this.client.rest.cdn.Icon(this.id,this.icon,e,t):null}get nameAcronym(){return this.name.replace(/\w+/g,e=>e[0]).replace(/\s/g,"")}splashURL({format:e,size:t}={}){return this.splash?this.client.rest.cdn.Splash(this.id,this.splash,e,t):null}get owner(){return this.members.get(this.ownerID)}get afkChannel(){return this.client.channels.get(this.afkChannelID)||null}get systemChannel(){return this.client.channels.get(this.systemChannelID)||null}get voiceConnection(){return this.client.browser?null:this.client.voice.connections.get(this.id)||null}get position(){return this.client.user.bot?null:this.client.user.settings.guildPositions?this.client.user.settings.guildPositions.indexOf(this.id):null}get muted(){if(this.client.user.bot)return null;try{return this.client.user.guildSettings.get(this.id).muted}catch(e){return!1}}get messageNotifications(){if(this.client.user.bot)return null;try{return this.client.user.guildSettings.get(this.id).messageNotifications}catch(e){return null}}get mobilePush(){if(this.client.user.bot)return null;try{return this.client.user.guildSettings.get(this.id).mobilePush}catch(e){return!1}}get suppressEveryone(){if(this.client.user.bot)return null;try{return this.client.user.guildSettings.get(this.id).suppressEveryone}catch(e){return null}}get defaultRole(){return this.roles.get(this.id)}get me(){return this.members.get(this.client.user.id)}get _sortedRoles(){return this._sortPositionWithID(this.roles)}member(e){return this.client.resolver.resolveGuildMember(this,e)}fetchBans(){return this.client.api.guilds(this.id).bans.get().then(e=>e.reduce((e,t)=>(e.set(t.user.id,{reason:t.reason,user:this.client.users.create(t.user)}),e),new p))}fetchInvites(){return this.client.api.guilds(this.id).invites.get().then(e=>{const t=new p;for(const i of e){const e=new r(this.client,i);t.set(e.code,e)}return t})}fetchWebhooks(){return this.client.api.guilds(this.id).webhooks.get().then(e=>{const t=new p;for(const i of e)t.set(i.id,new a(this.client,i));return t})}fetchVoiceRegions(){return this.client.api.guilds(this.id).regions.get().then(e=>{const t=new p;for(const i of e)t.set(i.id,new h(i));return t})}fetchAuditLogs(e={}){return e.before&&e.before instanceof o.Entry&&(e.before=e.before.id),e.after&&e.after instanceof o.Entry&&(e.after=e.after.id),"string"==typeof e.type&&(e.type=o.Actions[e.type]),this.client.api.guilds(this.id)["audit-logs"].get({query:{before:e.before,after:e.after,limit:e.limit,user_id:this.client.resolver.resolveUserID(e.user),action_type:e.type}}).then(e=>o.build(this,e))}addMember(e,t){if(this.members.has(e.id))return Promise.resolve(this.members.get(e.id));if(t.access_token=t.accessToken,t.roles){const e=[];for(let i of t.roles instanceof p?t.roles.values():t.roles){if(!(i=this.client.resolver.resolveRole(this,i)))return Promise.reject(new A("INVALID_TYPE","options.roles","Array or Collection of Roles or Snowflakes",!0));e.push(i.id)}}return this.client.api.guilds(this.id).members(e.id).put({data:t}).then(e=>this.client.actions.GuildMemberGet.handle(this,e).member)}search(e={}){return g.search(this,e)}edit(e,t){const i={};return e.name&&(i.name=e.name),e.region&&(i.region=e.region),void 0!==e.verificationLevel&&(i.verification_level=Number(e.verificationLevel)),void 0!==e.afkChannel&&(i.afk_channel_id=this.client.resolver.resolveChannelID(e.afkChannel)),void 0!==e.systemChannel&&(i.system_channel_id=this.client.resolver.resolveChannelID(e.systemChannel)),e.afkTimeout&&(i.afk_timeout=Number(e.afkTimeout)),void 0!==e.icon&&(i.icon=e.icon),e.owner&&(i.owner_id=this.client.resolver.resolveUser(e.owner).id),e.splash&&(i.splash=e.splash),void 0!==e.explicitContentFilter&&(i.explicit_content_filter=Number(e.explicitContentFilter)),this.client.api.guilds(this.id).patch({data:i,reason:t}).then(e=>this.client.actions.GuildUpdate.handle(e).updated)}setExplicitContentFilter(e,t){return this.edit({explicitContentFilter:e},t)}setName(e,t){return this.edit({name:e},t)}setRegion(e,t){return this.edit({region:e},t)}setVerificationLevel(e,t){return this.edit({verificationLevel:e},t)}setAFKChannel(e,t){return this.edit({afkChannel:e},t)}setSystemChannel(e,t){return this.edit({systemChannel:e},t)}setAFKTimeout(e,t){return this.edit({afkTimeout:e},t)}async setIcon(e,t){return this.edit({icon:await this.client.resolver.resolveImage(e),reason:t})}setOwner(e,t){return this.edit({owner:e},t)}async setSplash(e,t){return this.edit({splash:await this.client.resolver.resolveImage(e),reason:t})}setPosition(e,t){return this.client.user.bot?Promise.reject(new x("FEATURE_USER_ONLY")):this.client.user.settings.setGuildPosition(this,e,t)}acknowledge(){return this.client.api.guilds(this.id).ack.post({data:{token:this.client.rest._ackToken}}).then(e=>(e.token&&(this.client.rest._ackToken=e.token),this))}allowDMs(e){const t=this.client.user.settings;return e?t.removeRestrictedGuild(this):t.addRestrictedGuild(this)}ban(e,t={days:0}){t.days&&(t["delete-message-days"]=t.days);const i=this.client.resolver.resolveUserID(e);return i?this.client.api.guilds(this.id).bans[i].put({query:t}).then(()=>{if(e instanceof l)return e;const t=this.client.resolver.resolveUser(i);return t?this.client.resolver.resolveGuildMember(this,t)||t:i}):Promise.reject(new x("BAN_RESOLVE_ID",!0))}unban(e,t){const i=this.client.resolver.resolveUserID(e);if(!i)throw new x("BAN_RESOLVE_ID");return this.client.api.guilds(this.id).bans[i].delete({reason:t}).then(()=>e)}pruneMembers({days:e=7,dry:t=!1,reason:i}={}){if("number"!=typeof e)throw new A("PRUNE_DAYS_TYPE");return this.client.api.guilds(this.id).prune[t?"get":"post"]({query:{days:e},reason:i}).then(e=>e.pruned)}sync(){this.client.user.bot||this.client.syncGuilds([this])}createChannel(e,t,{overwrites:i,reason:n}={}){return(i instanceof p||i instanceof Array)&&(i=i.map(e=>{let t=e.allow||e._allowed,i=e.deny||e._denied;t instanceof Array&&(t=m.resolve(t)),i instanceof Array&&(i=m.resolve(i));const n=this.client.resolver.resolveRole(this,e.id);return n?(e.id=n.id,e.type="role"):(e.id=this.client.resolver.resolveUserID(e.id),e.type="member"),{allow:t,deny:i,type:e.type,id:e.id}})),this.client.api.guilds(this.id).channels.post({data:{name:e,type:u.ChannelTypes[t.toUpperCase()],permission_overwrites:i},reason:n}).then(e=>this.client.actions.ChannelCreate.handle(e).channel)}setChannelPosition(e,t,i=!1){if("string"==typeof e&&(e=this.channels.get(e)),!(e instanceof c))return Promise.reject(new A("INVALID_TYPE","channel","GuildChannel nor a Snowflake"));if(t=Number(t),isNaN(t))return Promise.reject(new A("INVALID_TYPE","position","number"));let n=this._sortedChannels(e.type).array();return d.moveElementInArray(n,e,t,i),n=n.map((e,t)=>({id:e.id,position:t})),this.client.api.guilds(this.id).channels.patch({data:n}).then(()=>this.client.actions.GuildChannelsPositionUpdate.handle({guild_id:this.id,channels:n}).guild)}setChannelPositions(e){const t=e.map(e=>({id:this.client.resolver.resolveChannelID(e.channel),position:e.position}));return this.client.api.guilds(this.id).channels.patch({data:t}).then(()=>this.client.actions.GuildChannelsPositionUpdate.handle({guild_id:this.id,channels:t}).guild)}createRole({data:e={},reason:t}={}){return e.color&&(e.color=d.resolveColor(e.color)),e.permissions&&(e.permissions=m.resolve(e.permissions)),this.client.api.guilds(this.id).roles.post({data:e,reason:t}).then(i=>{const{role:n}=this.client.actions.GuildRoleCreate.handle({guild_id:this.id,role:i});return e.position?n.setPosition(e.position,t):n})}createEmoji(e,t,{roles:i,reason:n}={}){if("string"==typeof e&&e.startsWith("data:")){const s={image:e,name:t};if(i){s.roles=[];for(let e of i instanceof p?i.values():i){if(!(e=this.client.resolver.resolveRole(this,e)))return Promise.reject(new A("INVALID_TYPE","options.roles","Array or Collection of Roles or Snowflakes",!0));s.roles.push(e.id)}}return this.client.api.guilds(this.id).emojis.post({data:s,reason:n}).then(e=>this.client.actions.GuildEmojiCreate.handle(this,e).emoji)}return this.client.resolver.resolveImage(e).then(e=>this.createEmoji(e,t,{roles:i,reason:n}))}leave(){return this.ownerID===this.client.user.id?Promise.reject(new x("GUILD_OWNED")):this.client.api.users("@me").guilds(this.id).delete().then(()=>this.client.actions.GuildDelete.handle({id:this.id}).guild)}delete(){return this.client.api.guilds(this.id).delete().then(()=>this.client.actions.GuildDelete.handle({id:this.id}).guild)}equals(e){let t=e&&e instanceof this.constructor&&this.id===e.id&&this.available===e.available&&this.splash===e.splash&&this.region===e.region&&this.name===e.name&&this.memberCount===e.memberCount&&this.large===e.large&&this.icon===e.icon&&d.arraysEqual(this.features,e.features)&&this.ownerID===e.ownerID&&this.verificationLevel===e.verificationLevel&&this.embedEnabled===e.embedEnabled;return t&&(this.embedChannel?e.embedChannel&&this.embedChannel.id===e.embedChannel.id||(t=!1):e.embedChannel&&(t=!1)),t}toString(){return this.name}_memberSpeakUpdate(e,t){const i=this.members.get(e);i&&i.speaking!==t&&(i.speaking=t,this.client.emit(u.Events.GUILD_MEMBER_SPEAKING,i,t))}setRolePosition(e,t,i=!1){if("string"==typeof e&&(e=this.roles.get(e)),!(e instanceof s))return Promise.reject(new A("INVALID_TYPE","role","Role nor a Snowflake"));if(t=Number(t),isNaN(t))return Promise.reject(new A("INVALID_TYPE","position","number"));let n=this._sortedRoles.array();return d.moveElementInArray(n,e,t,i),n=n.map((e,t)=>({id:e.id,position:t})),this.client.api.guilds(this.id).roles.patch({data:n}).then(()=>this.client.actions.GuildRolesPositionUpdate.handle({guild_id:this.id,roles:n}).guild)}_sortedChannels(e){return this._sortPositionWithID(this.channels.filter(t=>"voice"===e&&"voice"===t.type||("voice"!==e&&"voice"!==t.type||e===t.type)))}_sortPositionWithID(e){return e.sort((e,t)=>e.position!==t.position?e.position-t.position:n.fromString(e.id).sub(n.fromString(t.id)).toNumber())}}class VoiceStateCollection extends p{constructor(e){super(),this.guild=e}set(e,t){const i=this.guild.members.get(e);if(i){i.voiceChannel&&i.voiceChannel.id!==t.channel_id&&i.voiceChannel.members.delete(i.id),t.channel_id||(i.speaking=null);const e=this.guild.channels.get(t.channel_id);e&&e.members.set(i.user.id,i)}super.set(e,t)}}e.exports=Guild},function(e,t,i){"use strict";(function(t){!t.version||0===t.version.indexOf("v0.")||0===t.version.indexOf("v1.")&&0!==t.version.indexOf("v1.8.")?e.exports=function(e,i,n,s){if("function"!=typeof e)throw new TypeError('"callback" argument must be a function');var r,o,a=arguments.length;switch(a){case 0:case 1:return t.nextTick(e);case 2:return t.nextTick(function(){e.call(null,i)});case 3:return t.nextTick(function(){e.call(null,i,n)});case 4:return t.nextTick(function(){e.call(null,i,n,s)});default:for(r=new Array(a-1),o=0;o=i&&i>0&&this.delete(this.firstKey()),super.set(e,t))}fetch(e){return"string"==typeof e?this._fetchId(e):this._fetchMany(e)}fetchPinned(){return this.client.api.channels[this.channel.id].pins.get().then(e=>{const t=new s;for(const i of e)t.set(i.id,this.create(i));return t})}_fetchId(e){return this.client.user.bot?this.client.api.channels[this.channel.id].messages[e].get().then(e=>this.create(e)):this._fetchMany({limit:1,around:e}).then(t=>{const i=t.get(e);if(!i)throw new r("MESSAGE_MISSING");return i})}_fetchMany(e={}){return this.client.api.channels[this.channel.id].messages.get({query:e}).then(e=>{const t=new s;for(const i of e)t.set(i.id,this.create(i));return t})}}e.exports=MessageStore},function(e,t,i){const n=i(3),s=i(9),r=i(10),{TypeError:o}=i(4);class Emoji extends r{constructor(e,t){super(e.client),this.guild=e,this._patch(t)}_patch(e){this.id=e.id,this.name=e.name,this.requiresColons=e.require_colons,this.managed=e.managed,this._roles=e.roles}get createdTimestamp(){return s.deconstruct(this.id).timestamp}get createdAt(){return new Date(this.createdTimestamp)}get roles(){const e=new n;for(const t of this._roles)this.guild.roles.has(t)&&e.set(t,this.guild.roles.get(t));return e}get url(){return this.client.rest.cdn.Emoji(this.id)}get identifier(){return this.id?`${this.name}:${this.id}`:encodeURIComponent(this.name)}edit(e,t){return this.client.api.guilds(this.guild.id).emojis(this.id).patch({data:{name:e.name,roles:e.roles?e.roles.map(e=>e.id?e.id:e):void 0},reason:t}).then(()=>this)}setName(e,t){return this.edit({name:e},t)}addRestrictedRole(e){return this.addRestrictedRoles([e])}addRestrictedRoles(e){const t=new n(this.roles);for(let i of e instanceof n?e.values():e){if(!(i=this.client.resolver.resolveRole(this.guild,i)))return Promise.reject(new o("INVALID_TYPE","roles","Array or Collection of Roles or Snowflakes",!0));t.set(i.id,i)}return this.edit({roles:t})}removeRestrictedRole(e){return this.removeRestrictedRoles([e])}removeRestrictedRoles(e){const t=new n(this.roles);for(let i of e instanceof n?e.values():e){if(!(i=this.client.resolver.resolveRole(this.guild,i)))return Promise.reject(new o("INVALID_TYPE","roles","Array or Collection of Roles or Snowflakes",!0));t.has(i.id)&&t.delete(i.id)}return this.edit({roles:t})}toString(){return this.requiresColons?`<:${this.name}:${this.id}>`:this.name}delete(e){return this.client.api.guilds(this.guild.id).emojis(this.id).delete({reason:e}).then(()=>this)}equals(e){return e instanceof Emoji?e.id===this.id&&e.name===this.name&&e.managed===this.managed&&e.requiresColons===this.requiresColons&&e._roles===this._roles:e.id===this.id&&e.name===this.name&&e._roles===this._roles}}e.exports=Emoji},function(e,t,i){const n=i(0),s=i(10);class Invite extends s{constructor(e,t){super(e),this._patch(t)}_patch(e){this.guild=this.client.guilds.create(e.guild,!1),this.code=e.code,this.presenceCount=e.approximate_presence_count,this.memberCount=e.approximate_member_count,this.textChannelCount=e.guild.text_channel_count,this.voiceChannelCount=e.guild.voice_channel_count,this.temporary=e.temporary,this.maxAge=e.max_age,this.uses=e.uses,this.maxUses=e.max_uses,e.inviter&&(this.inviter=this.client.users.create(e.inviter)),this.channel=this.client.channels.create(e.channel,this.guild,!1),this.createdTimestamp=new Date(e.created_at).getTime()}get createdAt(){return new Date(this.createdTimestamp)}get expiresTimestamp(){return this.createdTimestamp+1e3*this.maxAge}get expiresAt(){return new Date(this.expiresTimestamp)}get url(){return n.Endpoints.invite(this.client.options.http.invite,this.code)}delete(e){return this.client.api.invites[this.code].delete({reason:e}).then(()=>this)}toString(){return this.url}}e.exports=Invite},function(e,t,i){const n=i(82);e.exports=n},function(e,t,i){function n(){s.call(this)}e.exports=n;var s=i(13).EventEmitter;i(14)(n,s),n.Readable=i(22),n.Writable=i(89),n.Duplex=i(90),n.Transform=i(91),n.PassThrough=i(92),n.Stream=n,n.prototype.pipe=function(e,t){function i(t){e.writable&&!1===e.write(t)&&l.pause&&l.pause()}function n(){l.readable&&l.resume&&l.resume()}function r(){h||(h=!0,e.end())}function o(){h||(h=!0,"function"==typeof e.destroy&&e.destroy())}function a(e){if(c(),0===s.listenerCount(this,"error"))throw e}function c(){l.removeListener("data",i),e.removeListener("drain",n),l.removeListener("end",r),l.removeListener("close",o),l.removeListener("error",a),e.removeListener("error",a),l.removeListener("end",c),l.removeListener("close",c),e.removeListener("close",c)}var l=this;l.on("data",i),e.on("drain",n),e._isStdio||t&&!1===t.end||(l.on("end",r),l.on("close",o));var h=!1;return l.on("error",a),e.on("error",a),l.on("end",c),l.on("close",c),e.on("close",c),e.emit("pipe",l),e}},function(e,t,i){function n(e,t){for(var i in e)t[i]=e[i]}function s(e,t,i){return o(e,t,i)}var r=i(5),o=r.Buffer;o.from&&o.alloc&&o.allocUnsafe&&o.allocUnsafeSlow?e.exports=r:(n(r,t),t.Buffer=s),n(o,s),s.from=function(e,t,i){if("number"==typeof e)throw new TypeError("Argument must not be a number");return o(e,t,i)},s.alloc=function(e,t,i){if("number"!=typeof e)throw new TypeError("Argument must be a number");var n=o(e);return void 0!==t?"string"==typeof i?n.fill(t,i):n.fill(t):n.fill(0),n},s.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return o(e)},s.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return r.SlowBuffer(e)}},function(e,t,i){"use strict";(function(t,n,s){function r(e){var t=this;this.next=null,this.entry=null,this.finish=function(){R(t,e)}}function o(e){return O.from(e)}function a(e){return O.isBuffer(e)||e instanceof L}function c(){}function l(e,t){D=D||i(16),e=e||{},this.objectMode=!!e.objectMode,t instanceof D&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var n=e.highWaterMark,s=this.objectMode?16:16384;this.highWaterMark=n||0===n?n:s,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var o=!1===e.decodeStrings;this.decodeStrings=!o,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){E(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new r(this)}function h(e){if(D=D||i(16),!(P.call(h,this)||this instanceof D))return new h(e);this._writableState=new l(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),M.call(this)}function u(e,t){var i=new Error("write after end");e.emit("error",i),I(t,i)}function p(e,t,i,n){var s=!0,r=!1;return null===i?r=new TypeError("May not write null values to stream"):"string"==typeof i||void 0===i||t.objectMode||(r=new TypeError("Invalid non-string/buffer chunk")),r&&(e.emit("error",r),I(n,r),s=!1),s}function d(e,t,i){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=O.from(t,i)),t}function f(e,t,i,n,s,r){if(!i){var o=d(t,n,s);n!==o&&(i=!0,s="buffer",n=o)}var a=t.objectMode?1:n.length;t.length+=a;var c=t.length-1?n:I;h.WritableState=l;var k=i(23);k.inherits=i(14);var N={deprecate:i(87)},M=i(49),O=i(38).Buffer,L=s.Uint8Array||function(){},U=i(50);k.inherits(h,M),l.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(l.prototype,"buffer",{get:N.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}();var P;"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(P=Function.prototype[Symbol.hasInstance],Object.defineProperty(h,Symbol.hasInstance,{value:function(e){return!!P.call(this,e)||e&&e._writableState instanceof l}})):P=function(e){return e instanceof this},h.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},h.prototype.write=function(e,t,i){var n=this._writableState,s=!1,r=a(e)&&!n.objectMode;return r&&!O.isBuffer(e)&&(e=o(e)),"function"==typeof t&&(i=t,t=null),r?t="buffer":t||(t=n.defaultEncoding),"function"!=typeof i&&(i=c),n.ended?u(this,i):(r||p(this,n,e,i))&&(n.pendingcb++,s=f(this,n,r,e,t,i)),s},h.prototype.cork=function(){this._writableState.corked++},h.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.finished||e.bufferProcessing||!e.bufferedRequest||b(this,e))},h.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},h.prototype._write=function(e,t,i){i(new Error("_write() is not implemented"))},h.prototype._writev=null,h.prototype.end=function(e,t,i){var n=this._writableState;"function"==typeof e?(i=e,e=null,t=null):"function"==typeof t&&(i=t,t=null),null!==e&&void 0!==e&&this.write(e,t),n.corked&&(n.corked=1,this.uncork()),n.ending||n.finished||T(this,n,i)},Object.defineProperty(h.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),h.prototype.destroy=U.destroy,h.prototype._undestroy=U.undestroy,h.prototype._destroy=function(e,t){this.end(),t(e)}}).call(t,i(8),i(85).setImmediate,i(6))},function(e,t,i){(function(e,n){function s(e,i){var n={seen:[],stylize:o};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),m(i)?n.showHidden=i:i&&t._extend(n,i),_(n.showHidden)&&(n.showHidden=!1),_(n.depth)&&(n.depth=2),_(n.colors)&&(n.colors=!1),_(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=r),c(n,e,n.depth)}function r(e,t){var i=s.styles[t];return i?"["+s.colors[i][0]+"m"+e+"["+s.colors[i][1]+"m":e}function o(e,t){return e}function a(e){var t={};return e.forEach(function(e,i){t[e]=!0}),t}function c(e,i,n){if(e.customInspect&&i&&A(i.inspect)&&i.inspect!==t.inspect&&(!i.constructor||i.constructor.prototype!==i)){var s=i.inspect(n,e);return E(s)||(s=c(e,s,n)),s}var r=l(e,i);if(r)return r;var o=Object.keys(i),m=a(o);if(e.showHidden&&(o=Object.getOwnPropertyNames(i)),x(i)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return h(i);if(0===o.length){if(A(i)){var g=i.name?": "+i.name:"";return e.stylize("[Function"+g+"]","special")}if(y(i))return e.stylize(RegExp.prototype.toString.call(i),"regexp");if(w(i))return e.stylize(Date.prototype.toString.call(i),"date");if(x(i))return h(i)}var v="",_=!1,b=["{","}"];if(f(i)&&(_=!0,b=["[","]"]),A(i)&&(v=" [Function"+(i.name?": "+i.name:"")+"]"),y(i)&&(v=" "+RegExp.prototype.toString.call(i)),w(i)&&(v=" "+Date.prototype.toUTCString.call(i)),x(i)&&(v=" "+h(i)),0===o.length&&(!_||0==i.length))return b[0]+v+b[1];if(n<0)return y(i)?e.stylize(RegExp.prototype.toString.call(i),"regexp"):e.stylize("[Object]","special");e.seen.push(i);var S;return S=_?u(e,i,n,m,o):o.map(function(t){return p(e,i,n,m,t,_)}),e.seen.pop(),d(S,v,b)}function l(e,t){if(_(t))return e.stylize("undefined","undefined");if(E(t)){var i="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(i,"string")}return v(t)?e.stylize(""+t,"number"):m(t)?e.stylize(""+t,"boolean"):g(t)?e.stylize("null","null"):void 0}function h(e){return"["+Error.prototype.toString.call(e)+"]"}function u(e,t,i,n,s){for(var r=[],o=0,a=t.length;o-1&&(a=r?a.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+a.split("\n").map(function(e){return" "+e}).join("\n")):a=e.stylize("[Circular]","special")),_(o)){if(r&&s.match(/^\d+$/))return a;(o=JSON.stringify(""+s)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(o=o.substr(1,o.length-2),o=e.stylize(o,"name")):(o=o.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),o=e.stylize(o,"string"))}return o+": "+a}function d(e,t,i){var n=0;return e.reduce(function(e,t){return n++,t.indexOf("\n")>=0&&n++,e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0)>60?i[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+i[1]:i[0]+t+" "+e.join(", ")+" "+i[1]}function f(e){return Array.isArray(e)}function m(e){return"boolean"==typeof e}function g(e){return null===e}function v(e){return"number"==typeof e}function E(e){return"string"==typeof e}function _(e){return void 0===e}function y(e){return b(e)&&"[object RegExp]"===S(e)}function b(e){return"object"==typeof e&&null!==e}function w(e){return b(e)&&"[object Date]"===S(e)}function x(e){return b(e)&&("[object Error]"===S(e)||e instanceof Error)}function A(e){return"function"==typeof e}function S(e){return Object.prototype.toString.call(e)}function T(e){return e<10?"0"+e.toString(10):e.toString(10)}function R(){var e=new Date,t=[T(e.getHours()),T(e.getMinutes()),T(e.getSeconds())].join(":");return[e.getDate(),N[e.getMonth()],t].join(" ")}function I(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var D=/%[sdj%]/g;t.format=function(e){if(!E(e)){for(var t=[],i=0;i=r)return e;switch(e){case"%s":return String(n[i++]);case"%d":return Number(n[i++]);case"%j":try{return JSON.stringify(n[i++])}catch(e){return"[Circular]"}default:return e}}),a=n[i];i{e(...i),this._timeouts.delete(n)},t);return this._timeouts.add(n),n}clearTimeout(e){clearTimeout(e),this._timeouts.delete(e)}setInterval(e,t,...i){const n=setInterval(e,t,...i);return this._intervals.add(n),n}clearInterval(e){clearInterval(e),this._intervals.delete(e)}}e.exports=BaseClient},function(e,t,i){const n=i(3),s=i(13);class Collector extends s{constructor(e,t,i={}){super(),Object.defineProperty(this,"client",{value:e}),this.filter=t,this.options=i,this.collected=new n,this.ended=!1,this._timeout=null,this.handleCollect=this.handleCollect.bind(this),this.handleDispose=this.handleDispose.bind(this),i.time&&(this._timeout=this.client.setTimeout(()=>this.stop("time"),i.time))}handleCollect(...e){const t=this.collect(...e);t&&this.filter(...e,this.collected)&&(this.collected.set(t.key,t.value),this.emit("collect",t.value,...e),this.checkEnd())}handleDispose(...e){if(!this.options.dispose)return;const t=this.dispose(...e);if(!t||!this.filter(...e)||!this.collected.has(t))return;const i=this.collected.get(t);this.collected.delete(t),this.emit("dispose",i,...e),this.checkEnd()}get next(){return new Promise((e,t)=>{if(this.ended)return void t(this.collected);const i=()=>{this.removeListener("collect",n),this.removeListener("end",s)},n=t=>{i(),e(t)},s=()=>{i(),t(this.collected)};this.on("collect",n),this.on("end",s)})}stop(e="user"){this.ended||(this._timeout&&this.client.clearTimeout(this._timeout),this.ended=!0,this.emit("end",this.collected,e))}checkEnd(){const e=this.endReason();e&&this.stop(e)}collect(){}dispose(){}endReason(){}}e.exports=Collector},function(e,t,i){var n,s,r;!function(i,o){s=[],void 0!==(r="function"==typeof(n=o)?n.apply(t,s):n)&&(e.exports=r)}(0,function(){"use strict";function e(e,t,i){this.low=0|e,this.high=0|t,this.unsigned=!!i}function t(e){return!0===(e&&e.__isLong__)}function i(e,t){var i,n,r;return t?(e>>>=0,(r=0<=e&&e<256)&&(n=c[e])?n:(i=s(e,(0|e)<0?-1:0,!0),r&&(c[e]=i),i)):(e|=0,(r=-128<=e&&e<128)&&(n=a[e])?n:(i=s(e,e<0?-1:0,!1),r&&(a[e]=i),i))}function n(e,t){if(isNaN(e)||!isFinite(e))return t?m:f;if(t){if(e<0)return m;if(e>=u)return y}else{if(e<=-p)return b;if(e+1>=p)return _}return e<0?n(-e,t).neg():s(e%h|0,e/h|0,t)}function s(t,i,n){return new e(t,i,n)}function r(e,t,i){if(0===e.length)throw Error("empty string");if("NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return f;if("number"==typeof t?(i=t,t=!1):t=!!t,(i=i||10)<2||360)throw Error("interior hyphen");if(0===s)return r(e.substring(1),t,i).neg();for(var o=n(l(i,8)),a=f,c=0;c>>0:this.low},w.toNumber=function(){return this.unsigned?(this.high>>>0)*h+(this.low>>>0):this.high*h+(this.low>>>0)},w.toString=function(e){if((e=e||10)<2||36>>0).toString(e);if((o=c).isZero())return h+a;for(;h.length<6;)h="0"+h;a=""+h+a}},w.getHighBits=function(){return this.high},w.getHighBitsUnsigned=function(){return this.high>>>0},w.getLowBits=function(){return this.low},w.getLowBitsUnsigned=function(){return this.low>>>0},w.getNumBitsAbs=function(){if(this.isNegative())return this.eq(b)?64:this.neg().getNumBitsAbs();for(var e=0!=this.high?this.high:this.low,t=31;t>0&&0==(e&1<=0},w.isOdd=function(){return 1==(1&this.low)},w.isEven=function(){return 0==(1&this.low)},w.equals=function(e){return t(e)||(e=o(e)),(this.unsigned===e.unsigned||this.high>>>31!=1||e.high>>>31!=1)&&(this.high===e.high&&this.low===e.low)},w.eq=w.equals,w.notEquals=function(e){return!this.eq(e)},w.neq=w.notEquals,w.lessThan=function(e){return this.comp(e)<0},w.lt=w.lessThan,w.lessThanOrEqual=function(e){return this.comp(e)<=0},w.lte=w.lessThanOrEqual,w.greaterThan=function(e){return this.comp(e)>0},w.gt=w.greaterThan,w.greaterThanOrEqual=function(e){return this.comp(e)>=0},w.gte=w.greaterThanOrEqual,w.compare=function(e){if(t(e)||(e=o(e)),this.eq(e))return 0;var i=this.isNegative(),n=e.isNegative();return i&&!n?-1:!i&&n?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1},w.comp=w.compare,w.negate=function(){return!this.unsigned&&this.eq(b)?b:this.not().add(g)},w.neg=w.negate,w.add=function(e){t(e)||(e=o(e));var i=this.high>>>16,n=65535&this.high,r=this.low>>>16,a=65535&this.low,c=e.high>>>16,l=65535&e.high,h=e.low>>>16,u=0,p=0,d=0,f=0;return f+=a+(65535&e.low),d+=f>>>16,f&=65535,d+=r+h,p+=d>>>16,d&=65535,p+=n+l,u+=p>>>16,p&=65535,u+=i+c,u&=65535,s(d<<16|f,u<<16|p,this.unsigned)},w.subtract=function(e){return t(e)||(e=o(e)),this.add(e.neg())},w.sub=w.subtract,w.multiply=function(e){if(this.isZero())return f;if(t(e)||(e=o(e)),e.isZero())return f;if(this.eq(b))return e.isOdd()?b:f;if(e.eq(b))return this.isOdd()?b:f;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(d)&&e.lt(d))return n(this.toNumber()*e.toNumber(),this.unsigned);var i=this.high>>>16,r=65535&this.high,a=this.low>>>16,c=65535&this.low,l=e.high>>>16,h=65535&e.high,u=e.low>>>16,p=65535&e.low,m=0,g=0,v=0,E=0;return E+=c*p,v+=E>>>16,E&=65535,v+=a*p,g+=v>>>16,v&=65535,v+=c*u,g+=v>>>16,v&=65535,g+=r*p,m+=g>>>16,g&=65535,g+=a*u,m+=g>>>16,g&=65535,g+=c*h,m+=g>>>16,g&=65535,m+=i*p+r*u+a*h+c*l,m&=65535,s(v<<16|E,m<<16|g,this.unsigned)},w.mul=w.multiply,w.divide=function(e){if(t(e)||(e=o(e)),e.isZero())throw Error("division by zero");if(this.isZero())return this.unsigned?m:f;var i,s,r;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return m;if(e.gt(this.shru(1)))return v;r=m}else{if(this.eq(b))return e.eq(g)||e.eq(E)?b:e.eq(b)?g:(i=this.shr(1).div(e).shl(1)).eq(f)?e.isNegative()?g:E:(s=this.sub(e.mul(i)),r=i.add(s.div(e)));if(e.eq(b))return this.unsigned?m:f;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();r=f}for(s=this;s.gte(e);){i=Math.max(1,Math.floor(s.toNumber()/e.toNumber()));for(var a=Math.ceil(Math.log(i)/Math.LN2),c=a<=48?1:l(2,a-48),h=n(i),u=h.mul(e);u.isNegative()||u.gt(s);)u=(h=n(i-=c,this.unsigned)).mul(e);h.isZero()&&(h=g),r=r.add(h),s=s.sub(u)}return r},w.div=w.divide,w.modulo=function(e){return t(e)||(e=o(e)),this.sub(this.div(e).mul(e))},w.mod=w.modulo,w.not=function(){return s(~this.low,~this.high,this.unsigned)},w.and=function(e){return t(e)||(e=o(e)),s(this.low&e.low,this.high&e.high,this.unsigned)},w.or=function(e){return t(e)||(e=o(e)),s(this.low|e.low,this.high|e.high,this.unsigned)},w.xor=function(e){return t(e)||(e=o(e)),s(this.low^e.low,this.high^e.high,this.unsigned)},w.shiftLeft=function(e){return t(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?s(this.low<>>32-e,this.unsigned):s(0,this.low<>>e|this.high<<32-e,this.high>>e,this.unsigned):s(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},w.shr=w.shiftRight,w.shiftRightUnsigned=function(e){if(t(e)&&(e=e.toInt()),0===(e&=63))return this;var i=this.high;return e<32?s(this.low>>>e|i<<32-e,i>>>e,this.unsigned):32===e?s(i,0,this.unsigned):s(i>>>e-32,0,this.unsigned)},w.shru=w.shiftRightUnsigned,w.toSigned=function(){return this.unsigned?s(this.low,this.high,!1):this},w.toUnsigned=function(){return this.unsigned?this:s(this.low,this.high,!0)},w.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},w.toBytesLE=function(){var e=this.high,t=this.low;return[255&t,t>>>8&255,t>>>16&255,t>>>24&255,255&e,e>>>8&255,e>>>16&255,e>>>24&255]},w.toBytesBE=function(){var e=this.high,t=this.low;return[e>>>24&255,e>>>16&255,e>>>8&255,255&e,t>>>24&255,t>>>16&255,t>>>8&255,255&t]},e})},function(e,t,i){const n=i(64),s=i(27),r=i(20),o=i(65),a=i(45),c=i(7),l=i(3),h=i(123),u=i(0),p=i(12),d=i(10),{Error:f,TypeError:m}=i(4);let g;class Message extends d{constructor(e,t,i){super(i),this.channel=e,t&&this._patch(t)}_patch(e){this.id=e.id,this.type=u.MessageTypes[e.type],this.content=e.content,this.author=this.client.users.create(e.author),this.member=this.guild?this.guild.member(this.author)||null:null,this.pinned=e.pinned,this.tts=e.tts,this.nonce=e.nonce,this.system=6===e.type,this.embeds=e.embeds.map(e=>new r(e)),this.attachments=new l;for(const t of e.attachments)this.attachments.set(t.id,new s(t.url,t.filename,t));if(this.createdTimestamp=new Date(e.timestamp).getTime(),this.editedTimestamp=e.edited_timestamp?new Date(e.edited_timestamp).getTime():null,this.reactions=new h(this),e.reactions&&e.reactions.length>0)for(const t of e.reactions)this.reactions.create(t);this.mentions=new n(this,e.mentions,e.mention_roles,e.mention_everyone),this.webhookID=e.webhook_id||null,this.application=e.application?new a(this.client,e.application):null,this.activity=e.activity?{partyID:e.activity.party_id,type:e.activity.type}:null,this.hit="boolean"==typeof e.hit?e.hit:null,this._edits=[]}patch(e){const t=this._clone();if(this._edits.unshift(t),this.editedTimestamp=new Date(e.edited_timestamp).getTime(),"content"in e&&(this.content=e.content),"pinned"in e&&(this.pinned=e.pinned),"tts"in e&&(this.tts=e.tts),this.embeds="embeds"in e?e.embeds.map(e=>new r(e)):this.embeds.slice(),"attachments"in e){this.attachments=new l;for(const t of e.attachments)this.attachments.set(t.id,new s(t.url,t.filename,t))}else this.attachments=new l(this.attachments);this.mentions=new n(this,"mentions"in e?e.mentions:this.mentions.users,"mentions_roles"in e?e.mentions_roles:this.mentions.roles,"mention_everyone"in e?e.mention_everyone:this.mentions.everyone)}get createdAt(){return new Date(this.createdTimestamp)}get editedAt(){return this.editedTimestamp?new Date(this.editedTimestamp):null}get guild(){return this.channel.guild||null}get cleanContent(){return this.content.replace(/@(everyone|here)/g,"@​$1").replace(/<@!?[0-9]+>/g,e=>{const t=e.replace(/<|!|>|@/g,"");if("dm"===this.channel.type||"group"===this.channel.type)return this.client.users.has(t)?`@${this.client.users.get(t).username}`:e;const i=this.channel.guild.members.get(t);if(i)return i.nickname?`@${i.nickname}`:`@${i.user.username}`;{const i=this.client.users.get(t);return i?`@${i.username}`:e}}).replace(/<#[0-9]+>/g,e=>{const t=this.client.channels.get(e.replace(/<|#|>/g,""));return t?`#${t.name}`:e}).replace(/<@&[0-9]+>/g,e=>{if("dm"===this.channel.type||"group"===this.channel.type)return e;const t=this.guild.roles.get(e.replace(/<|@|>|&/g,""));return t?`@${t.name}`:e})}createReactionCollector(e,t={}){return new o(this,e,t)}awaitReactions(e,t={}){return new Promise((i,n)=>{this.createReactionCollector(e,t).once("end",(e,s)=>{t.errors&&t.errors.includes(s)?n(e):i(e)})})}get edits(){const e=this._edits.slice();return e.unshift(this),e}get editable(){return this.author.id===this.client.user.id}get deletable(){return this.author.id===this.client.user.id||this.guild&&this.channel.permissionsFor(this.client.user).has(p.FLAGS.MANAGE_MESSAGES)}get pinnable(){return!this.guild||this.channel.permissionsFor(this.client.user).has(p.FLAGS.MANAGE_MESSAGES)}edit(e,t){t||"object"!=typeof e||e instanceof Array?t||(t={}):(t=e,e=""),t instanceof r&&(t={embed:t}),void 0!==t.content&&(e=t.content),void 0!==e&&(e=c.resolveString(e));let{embed:i,code:n,reply:s}=t;if(i&&(i=new r(i)._apiTransform()),void 0===n||"boolean"==typeof n&&!0!==n||(e=c.escapeMarkdown(c.resolveString(e),!0),e=`\`\`\`${"boolean"!=typeof n?n||"":""}\n${e}\n\`\`\``),s&&"dm"!==this.channel.type){const t=this.client.resolver.resolveUserID(s);e=`${`<@${s instanceof g&&s.nickname?"!":""}${t}>`}${e?`, ${e}`:""}`}return this.client.api.channels[this.channel.id].messages[this.id].patch({data:{content:e,embed:i}}).then(e=>{const t=this._clone();return t._patch(e),t})}pin(){return this.client.api.channels(this.channel.id).pins(this.id).put().then(()=>this)}unpin(){return this.client.api.channels(this.channel.id).pins(this.id).delete().then(()=>this)}react(e){if(!(e=this.client.resolver.resolveEmojiIdentifier(e)))throw new m("EMOJI_TYPE");return this.client.api.channels(this.channel.id).messages(this.id).reactions(e,"@me").put().then(()=>this.client.actions.MessageReactionAdd.handle({user:this.client.user,channel:this.channel,message:this,emoji:c.parseEmoji(e)}).reaction)}clearReactions(){return this.client.api.channels(this.channel.id).messages(this.id).reactions.delete().then(()=>this)}delete({timeout:e=0,reason:t}={}){return e<=0?this.client.api.channels(this.channel.id).messages(this.id).delete({reason:t}).then(()=>this.client.actions.MessageDelete.handle({id:this.id,channel_id:this.channel.id}).message):new Promise(i=>{this.client.setTimeout(()=>{i(this.delete({reason:t}))},e)})}reply(e,t){return t||"object"!=typeof e||e instanceof Array?t||(t={}):(t=e,e=""),this.channel.send(e,Object.assign(t,{reply:this.member||this.author}))}acknowledge(){return this.client.api.channels(this.channel.id).messages(this.id).ack.post({data:{token:this.client.rest._ackToken}}).then(e=>(e.token&&(this.client.rest._ackToken=e.token),this))}fetchWebhook(){return this.webhookID?this.client.fetchWebhook(this.webhookID):Promise.reject(new f("WEBHOOK_MESSAGE"))}equals(e,t){if(!e)return!1;if(!e.author&&!e.attachments)return this.id===e.id&&this.embeds.length===e.embeds.length;let i=this.id===e.id&&this.author.id===e.author.id&&this.content===e.content&&this.tts===e.tts&&this.nonce===e.nonce&&this.embeds.length===e.embeds.length&&this.attachments.length===e.attachments.length;return i&&t&&(i=this.mentions.everyone===e.mentions.everyone&&this.createdTimestamp===new Date(t.timestamp).getTime()&&this.editedTimestamp===new Date(t.edited_timestamp).getTime()),i}toString(){return this.content}}e.exports=Message},function(e,t,i){const n=i(9),s=i(0),r=i(10);class ClientApplication extends r{constructor(e,t){super(e),this._patch(t)}_patch(e){this.id=e.id,this.name=e.name,this.description=e.description,this.icon=e.icon,this.cover=e.cover_image,this.rpcOrigins=e.rpc_origins,this.redirectURIs=e.redirect_uris,this.botRequireCodeGrant=e.bot_require_code_grant,this.botPublic=e.bot_public,this.rpcApplicationState=e.rpc_application_state,this.bot=e.bot,this.flags=e.flags,this.secret=e.secret,e.owner&&(this.owner=this.client.users.create(e.owner))}get createdTimestamp(){return n.deconstruct(this.id).timestamp}get createdAt(){return new Date(this.createdTimestamp)}iconURL({format:e,size:t}={}){return this.icon?this.client.rest.cdn.AppIcon(this.id,this.icon,{format:e,size:t}):null}coverImage({format:e,size:t}={}){return this.cover?s.Endpoints.CDN(this.client.options.http.cdn).AppIcon(this.id,this.cover,{format:e,size:t}):null}fetchAssets(){return this.client.api.applications(this.id).assets.get().then(e=>e.map(e=>({id:e.id,name:e.name,type:Object.keys(s.ClientApplicationAssetTypes)[e.type-1]})))}createAsset(e,t,i){return this.client.resolveBase64(t).then(t=>this.client.api.applications(this.id).assets.post({data:{name:e,data:t,type:s.ClientApplicationAssetTypes[i.toUpperCase()]}}))}resetSecret(){return this.client.api.oauth2.applications[this.id].reset.post().then(e=>new ClientApplication(this.client,e))}resetToken(){return this.client.api.oauth2.applications[this.id].bot.reset.post().then(e=>new ClientApplication(this.client,Object.assign({},this,{bot:e})))}toString(){return this.name}}e.exports=ClientApplication},function(e,t){class ReactionEmoji{constructor(e,t,i){this.reaction=e,this.name=t,this.id=i}get identifier(){return this.id?`${this.name}:${this.id}`:encodeURIComponent(this.name)}toString(){return this.id?`<:${this.name}:${this.id}>`:this.name}}e.exports=ReactionEmoji},function(e,t){var i={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==i.call(e)}},function(e,t,i){"use strict";(function(t,n){function s(e){return P.from(e)}function r(e){return P.isBuffer(e)||e instanceof j}function o(e,t,i){if("function"==typeof e.prependListener)return e.prependListener(t,i);e._events&&e._events[t]?O(e._events[t])?e._events[t].unshift(i):e._events[t]=[i,e._events[t]]:e.on(t,i)}function a(e,t){M=M||i(16),e=e||{},this.objectMode=!!e.objectMode,t instanceof M&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var n=e.highWaterMark,s=this.objectMode?16:16384;this.highWaterMark=n||0===n?n:s,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new z,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(H||(H=i(51).StringDecoder),this.decoder=new H(e.encoding),this.encoding=e.encoding)}function c(e){if(M=M||i(16),!(this instanceof c))return new c(e);this._readableState=new a(e,this),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),U.call(this)}function l(e,t,i,n,r){var o=e._readableState;if(null===t)o.reading=!1,m(e,o);else{var a;r||(a=u(o,t)),a?e.emit("error",a):o.objectMode||t&&t.length>0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===P.prototype||(t=s(t)),n?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):h(e,o,t,!0):o.ended?e.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!i?(t=o.decoder.write(t),o.objectMode||0!==t.length?h(e,o,t,!1):E(e,o)):h(e,o,t,!1))):n||(o.reading=!1)}return p(o)}function h(e,t,i,n){t.flowing&&0===t.length&&!t.sync?(e.emit("data",i),e.read(0)):(t.length+=t.objectMode?1:i.length,n?t.buffer.unshift(i):t.buffer.push(i),t.needReadable&&g(e)),E(e,t)}function u(e,t){var i;return r(t)||"string"==typeof t||void 0===t||e.objectMode||(i=new TypeError("Invalid non-string/buffer chunk")),i}function p(e){return!e.ended&&(e.needReadable||e.length=W?e=W:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function f(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!==e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=d(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function m(e,t){if(!t.ended){if(t.decoder){var i=t.decoder.end();i&&i.length&&(t.buffer.push(i),t.length+=t.objectMode?1:i.length)}t.ended=!0,g(e)}}function g(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(q("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?N(v,e):v(e))}function v(e){q("emit readable"),e.emit("readable"),A(e)}function E(e,t){t.readingMore||(t.readingMore=!0,N(_,e,t))}function _(e,t){for(var i=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(i=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):i=T(e,t.buffer,t.decoder),i}function T(e,t,i){var n;return er.length?r.length:e;if(o===r.length?s+=r:s+=r.slice(0,e),0===(e-=o)){o===r.length?(++n,i.next?t.head=i.next:t.head=t.tail=null):(t.head=i,i.data=r.slice(o));break}++n}return t.length-=n,s}function I(e,t){var i=P.allocUnsafe(e),n=t.head,s=1;for(n.data.copy(i),e-=n.data.length;n=n.next;){var r=n.data,o=e>r.length?r.length:e;if(r.copy(i,i.length-e,0,o),0===(e-=o)){o===r.length?(++s,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=r.slice(o));break}++s}return t.length-=s,i}function D(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,N(C,t,e))}function C(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function k(e,t){for(var i=0,n=e.length;i=t.highWaterMark||t.ended))return q("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?D(this):g(this),null;if(0===(e=f(e,t))&&t.ended)return 0===t.length&&D(this),null;var n=t.needReadable;q("need readable",n),(0===t.length||t.length-e0?S(e,t):null)?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),i!==e&&t.ended&&D(this)),null!==s&&this.emit("data",s),s},c.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},c.prototype.pipe=function(e,t){function i(e,t){q("onunpipe"),e===p&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,r())}function s(){q("onend"),e.end()}function r(){q("cleanup"),e.removeListener("close",l),e.removeListener("finish",h),e.removeListener("drain",m),e.removeListener("error",c),e.removeListener("unpipe",i),p.removeListener("end",s),p.removeListener("end",u),p.removeListener("data",a),g=!0,!d.awaitDrain||e._writableState&&!e._writableState.needDrain||m()}function a(t){q("ondata"),v=!1,!1!==e.write(t)||v||((1===d.pipesCount&&d.pipes===e||d.pipesCount>1&&-1!==k(d.pipes,e))&&!g&&(q("false write response, pause",p._readableState.awaitDrain),p._readableState.awaitDrain++,v=!0),p.pause())}function c(t){q("onerror",t),u(),e.removeListener("error",c),0===L(e,"error")&&e.emit("error",t)}function l(){e.removeListener("finish",h),u()}function h(){q("onfinish"),e.removeListener("close",l),u()}function u(){q("unpipe"),p.unpipe(e)}var p=this,d=this._readableState;switch(d.pipesCount){case 0:d.pipes=e;break;case 1:d.pipes=[d.pipes,e];break;default:d.pipes.push(e)}d.pipesCount+=1,q("pipe count=%d opts=%j",d.pipesCount,t);var f=(!t||!1!==t.end)&&e!==n.stdout&&e!==n.stderr?s:u;d.endEmitted?N(f):p.once("end",f),e.on("unpipe",i);var m=y(p);e.on("drain",m);var g=!1,v=!1;return p.on("data",a),o(e,"error",c),e.once("close",l),e.once("finish",h),e.emit("pipe",p),d.flowing||(q("pipe resume"),p.resume()),e},c.prototype.unpipe=function(e){var t=this._readableState,i={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,i),this);if(!e){var n=t.pipes,s=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var r=0;r=this.charLength-this.charReceived?this.charLength-this.charReceived:e.length;if(e.copy(this.charBuffer,this.charReceived,0,i),this.charReceived+=i,this.charReceived=55296&&s<=56319)){if(this.charReceived=this.charLength=0,0===e.length)return t;break}this.charLength+=this.surrogateSize,t=""}this.detectIncompleteChar(e);n=e.length;this.charLength&&(e.copy(this.charBuffer,0,e.length-this.charReceived,n),n-=this.charReceived);var n=(t+=e.toString(this.encoding,0,n)).length-1,s=t.charCodeAt(n);if(s>=55296&&s<=56319){var r=this.surrogateSize;return this.charLength+=r,this.charReceived+=r,this.charBuffer.copy(this.charBuffer,r,0,r),e.copy(this.charBuffer,0,0,r),t.substring(0,n)}return t},l.prototype.detectIncompleteChar=function(e){for(var t=e.length>=3?3:e.length;t>0;t--){var i=e[e.length-t];if(1==t&&i>>5==6){this.charLength=2;break}if(t<=2&&i>>4==14){this.charLength=3;break}if(t<=3&&i>>3==30){this.charLength=4;break}}this.charReceived=t},l.prototype.end=function(e){var t="";if(e&&e.length&&(t=this.write(e)),this.charReceived){var i=this.charReceived,n=this.charBuffer,s=this.encoding;t+=n.slice(0,i).toString(s)}return t}},function(e,t,i){"use strict";function n(e){this.afterTransform=function(t,i){return s(e,t,i)},this.needTransform=!1,this.transforming=!1,this.writecb=null,this.writechunk=null,this.writeencoding=null}function s(e,t,i){var n=e._transformState;n.transforming=!1;var s=n.writecb;if(!s)return e.emit("error",new Error("write callback called multiple times"));n.writechunk=null,n.writecb=null,null!==i&&void 0!==i&&e.push(i),s(t);var r=e._readableState;r.reading=!1,(r.needReadable||r.length",'"',"`"," ","\r","\n","\t"],u=["{","}","|","\\","^","`"].concat(h),p=["'"].concat(u),d=["%","/","?",";","#"].concat(p),f=["/","?","#"],m=/^[+a-z0-9A-Z_-]{0,63}$/,g=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,v={javascript:!0,"javascript:":!0},E={javascript:!0,"javascript:":!0},_={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},y=i(32);n.prototype.parse=function(e,t,i){if(!o.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var n=e.indexOf("?"),s=-1!==n&&n127?O+="x":O+=M[L];if(!O.match(m)){var P=k.slice(0,T),j=k.slice(T+1),G=M.match(g);G&&(P.push(G[1]),j.unshift(G[2])),j.length&&(u="/"+j.join(".")+u),this.hostname=P.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),C||(this.hostname=r.toASCII(this.hostname));var B=this.port?":"+this.port:"",q=this.hostname||"";this.host=q+B,this.href+=this.host,C&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==u[0]&&(u="/"+u))}if(!v[x])for(var T=0,N=p.length;T0)&&i.host.split("@"))&&(i.auth=C.shift(),i.host=i.hostname=C.shift())),i.search=e.search,i.query=e.query,o.isNull(i.pathname)&&o.isNull(i.search)||(i.path=(i.pathname?i.pathname:"")+(i.search?i.search:"")),i.href=i.format(),i;if(!w.length)return i.pathname=null,i.search?i.path="/"+i.search:i.path=null,i.href=i.format(),i;for(var S=w.slice(-1)[0],T=(i.host||e.host||w.length>1)&&("."===S||".."===S)||""===S,R=0,I=w.length;I>=0;I--)"."===(S=w[I])?w.splice(I,1):".."===S?(w.splice(I,1),R++):R&&(w.splice(I,1),R--);if(!y&&!b)for(;R--;R)w.unshift("..");!y||""===w[0]||w[0]&&"/"===w[0].charAt(0)||w.unshift(""),T&&"/"!==w.join("/").substr(-1)&&w.push("");var D=""===w[0]||w[0]&&"/"===w[0].charAt(0);if(A){i.hostname=i.host=D?"":w.length?w.shift():"";var C=!!(i.host&&i.host.indexOf("@")>0)&&i.host.split("@");C&&(i.auth=C.shift(),i.host=i.hostname=C.shift())}return(y=y||i.host&&w.length)&&!D&&w.unshift(""),w.length?i.pathname=w.join("/"):(i.pathname=null,i.path=null),o.isNull(i.pathname)&&o.isNull(i.search)||(i.path=(i.pathname?i.pathname:"")+(i.search?i.search:"")),i.auth=e.auth||i.auth,i.slashes=i.slashes||e.slashes,i.href=i.format(),i},n.prototype.parseHost=function(){var e=this.host,t=c.exec(e);t&&(":"!==(t=t[0])&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)}},function(e,t,i){const n=i(106),s=i(107);e.exports={buffer:function(e){const t=s(e);return t?t.mime:n.bin},lookup:function(e){return n[e.replace(/^\./,"")]||n.bin}}},function(e,t){e.exports={name:"discord.js",version:"12.0.0-dev",description:"A powerful library for interacting with the Discord API",main:"./src/index",types:"./typings/index.d.ts",scripts:{test:"npm run lint && npm run docs:test",docs:"docgen --source src --custom docs/index.yml --output docs/docs.json --jsdoc jsdoc.json","docs:test":"docgen --source src --custom docs/index.yml --jsdoc jsdoc.json",lint:"eslint src","lint:fix":"eslint --fix src",webpack:"parallel-webpack"},repository:{type:"git",url:"git+https://github.com/hydrabolt/discord.js.git"},keywords:["discord","api","bot","client","node","discordapp"],author:"Amish Shah ",license:"Apache-2.0",bugs:{url:"https://github.com/hydrabolt/discord.js/issues"},homepage:"https://github.com/hydrabolt/discord.js#readme",runkitExampleFilename:"./docs/examples/ping.js",dependencies:{long:"^3.0.0","prism-media":"^0.0.1",snekfetch:"^3.0.0",tweetnacl:"^1.0.0",ws:"^3.0.0"},peerDependencies:{bufferutil:"^3.0.0",erlpack:"hammerandchisel/erlpack","node-opus":"^0.2.0",opusscript:"^0.0.3",sodium:"^2.0.0","libsodium-wrappers":"^0.5.0",uws:"^8.14.0"},devDependencies:{"@types/node":"^8.0.0","discord.js-docgen":"hydrabolt/discord.js-docgen",eslint:"^4.0.0","jsdoc-strip-async-await":"^0.1.0","parallel-webpack":"^2.0.0","uglifyjs-webpack-plugin":"^1.0.0-beta.2",webpack:"^3.0.0"},engines:{node:">=8.0.0"},browser:{ws:!1,uws:!1,erlpack:!1,"prism-media":!1,opusscript:!1,"node-opus":!1,tweetnacl:!1,sodium:!1,"src/sharding/Shard.js":!1,"src/sharding/ShardClientUtil.js":!1,"src/sharding/ShardingManager.js":!1,"src/client/voice/dispatcher/StreamDispatcher.js":!1,"src/client/voice/opus/BaseOpusEngine.js":!1,"src/client/voice/opus/NodeOpusEngine.js":!1,"src/client/voice/opus/OpusEngineList.js":!1,"src/client/voice/opus/OpusScriptEngine.js":!1,"src/client/voice/pcm/ConverterEngine.js":!1,"src/client/voice/pcm/ConverterEngineList.js":!1,"src/client/voice/pcm/FfmpegConverterEngine.js":!1,"src/client/voice/player/AudioPlayer.js":!1,"src/client/voice/receiver/VoiceReadable.js":!1,"src/client/voice/receiver/VoiceReceiver.js":!1,"src/client/voice/util/Secretbox.js":!1,"src/client/voice/util/SecretKey.js":!1,"src/client/voice/util/VolumeInterface.js":!1,"src/client/voice/ClientVoiceManager.js":!1,"src/client/voice/VoiceBroadcast.js":!1,"src/client/voice/VoiceConnection.js":!1,"src/client/voice/VoiceUDPClient.js":!1,"src/client/voice/VoiceWebSocket.js":!1}}},function(e,t,i){function n(e){return class DiscordjsError extends e{constructor(e,...t){super(s(e,t)),this[r]=e,Error.captureStackTrace&&Error.captureStackTrace(this,DiscordjsError)}get name(){return`${super.name} [${this[r]}]`}get code(){return this[r]}}}function s(e,t){a.strictEqual(typeof e,"string");const i=o.get(e);a(i,`An invalid error message key was used: ${e}.`);let n=c.format;if("function"==typeof i)n=i;else{if(void 0===t||0===t.length)return i;t.unshift(i)}return String(n(...t))}const r=Symbol("code"),o=new Map,a=i(109),c=i(40);e.exports={register:function(e,t){o.set(e,"function"==typeof t?t:String(t))},Error:n(Error),TypeError:n(TypeError),RangeError:n(RangeError)}},function(e,t,i){const n=i(114),s=i(115),r=i(119),o=i(120),{Error:a}=i(4),c=i(0);class RESTManager{constructor(e,t="Bot"){this.client=e,this.handlers={},this.userAgentManager=new n(this),this.rateLimitedEndpoints={},this.globallyRateLimited=!1,this.tokenPrefix=t,this.versioned=!0}get api(){return o(this)}getAuth(){const e=this.client.token||this.client.accessToken,t=!!this.client.application||this.client.user&&this.client.user.bot;if(e&&t)return`${this.tokenPrefix} ${e}`;if(e)return e;throw new a("TOKEN_MISSING")}get cdn(){return c.Endpoints.CDN(this.client.options.http.cdn)}destroy(){for(const e of Object.values(this.handlers))e.destroy&&e.destroy()}push(e,t){return new Promise((i,n)=>{e.push({request:t,resolve:i,reject:n})})}getRequestHandler(){const e=this.client.options.apiRequestMethod;if("function"==typeof e)return e;const t=s[e];if(!t)throw new a("RATELIMIT_INVALID_METHOD");return t}request(e,t,i={}){const n=new r(this,e,t,i);return this.handlers[n.route]||(this.handlers[n.route]=new s.RequestHandler(this,this.getRequestHandler())),this.push(this.handlers[n.route],n)}set endpoint(e){this.client.options.http.api=e}}e.exports=RESTManager},function(e,t){class DiscordAPIError extends Error{constructor(e,t){super();const i=this.constructor.flattenErrors(t.errors||t).join("\n");this.name="DiscordAPIError",this.message=t.message&&i?`${t.message}\n${i}`:t.message||i,this.path=e,this.code=t.code}static flattenErrors(e,t=""){let i=[];for(const[n,s]of Object.entries(e)){if("message"===n)continue;const e=t?isNaN(n)?`${t}.${n}`:`${t}[${n}]`:n;s._errors?i.push(`${e}: ${s._errors.map(e=>e.message).join(" ")}`):s.code||s.message?i.push(`${s.code?`${s.code}: `:""}${s.message}`.trim()):"string"==typeof s?i.push(s):i=i.concat(this.flattenErrors(s,e))}return i}}e.exports=DiscordAPIError},function(e,t,i){const n=i(42);class MessageCollector extends n{constructor(e,t,i={}){super(e.client,t,i),this.channel=e,this.received=0;const n=(e=>{for(const t of e.values())this.handleDispose(t)}).bind(this);this.client.on("message",this.handleCollect),this.client.on("messageDelete",this.handleDispose),this.client.on("messageDeleteBulk",n),this.once("end",()=>{this.client.removeListener("message",this.handleCollect),this.client.removeListener("messageDelete",this.handleDispose),this.client.removeListener("messageDeleteBulk",n)})}collect(e){return e.channel.id!==this.channel.id?null:(this.received++,{key:e.id,value:e})}dispose(e){return e.channel.id===this.channel.id?e.id:null}endReason(){return this.options.max&&this.collected.size>=this.options.max?"limit":this.options.maxProcessed&&this.received===this.options.maxProcessed?"processedLimit":null}}e.exports=MessageCollector},function(e,t,i){e.exports={search:i(122),sendMessage:i(128)}},function(e,t,i){const n=i(15),s=i(26),r=i(33);class DMChannel extends n{constructor(e,t){super(e,t),this.messages=new r(this),this._typing=new Map}_patch(e){super._patch(e),this.recipient=this.client.users.create(e.recipients[0]),this.lastMessageID=e.last_message_id}toString(){return this.recipient.toString()}send(){}search(){}startTyping(){}stopTyping(){}get typing(){}get typingCount(){}createMessageCollector(){}awaitMessages(){}acknowledge(){}_cacheMessage(){}}s.applyToClass(DMChannel,!0,["bulkDelete"]),e.exports=DMChannel},function(e,t,i){const n=i(3),s=i(17);class MessageMentions{constructor(e,t,i,s){if(this.everyone=Boolean(s),t)if(t instanceof n)this.users=new n(t);else{this.users=new n;for(const i of t){let t=e.client.users.create(i);this.users.set(t.id,t)}}else this.users=new n;if(i)if(i instanceof n)this.roles=new n(i);else{this.roles=new n;for(const t of i){const i=e.channel.guild.roles.get(t);i&&this.roles.set(i.id,i)}}else this.roles=new n;this._content=e.content,this._client=e.client,this._guild=e.channel.guild,this._members=null,this._channels=null}get members(){return this._members?this._members:this._guild?(this._members=new n,this.users.forEach(e=>{const t=this._guild.member(e);t&&this._members.set(t.user.id,t)}),this._members):null}get channels(){if(this._channels)return this._channels;this._channels=new n;let e;for(;null!==(e=this.constructor.CHANNELS_PATTERN.exec(this._content));){const t=this._client.channels.get(e[1]);t&&this._channels.set(t.id,t)}return this._channels}has(e,t=!0){if(t&&this.everyone)return!0;if(t&&e instanceof s)for(const t of this.roles.values())if(e.roles.has(t.id))return!0;const i=e.id||e;return this.users.has(i)||this.channels.has(i)||this.roles.has(i)}}MessageMentions.EVERYONE_PATTERN=/@(everyone|here)/g,MessageMentions.USERS_PATTERN=/<@!?(1|\d{17,19})>/g,MessageMentions.ROLES_PATTERN=/<@&(\d{17,19})>/g,MessageMentions.CHANNELS_PATTERN=/<#(\d{17,19})>/g,e.exports=MessageMentions},function(e,t,i){const n=i(42),s=i(3);class ReactionCollector extends n{constructor(e,t,i={}){super(e.client,t,i),this.message=e,this.users=new s,this.total=0,this.empty=this.empty.bind(this),this.client.on("messageReactionAdd",this.handleCollect),this.client.on("messageReactionRemove",this.handleDispose),this.client.on("messageReactionRemoveAll",this.empty),this.once("end",()=>{this.client.removeListener("messageReactionAdd",this.handleCollect),this.client.removeListener("messageReactionRemove",this.handleDispose),this.client.removeListener("messageReactionRemoveAll",this.empty)}),this.on("collect",(e,t,i)=>{this.total++,this.users.set(i.id,i)}),this.on("dispose",(e,t,i)=>{this.total--,this.collected.some(e=>e.users.has(i.id))||this.users.delete(i.id)})}collect(e){return e.message.id!==this.message.id?null:{key:ReactionCollector.key(e),value:e}}dispose(e){return e.message.id!==this.message.id||e.count?null:ReactionCollector.key(e)}empty(){this.total=0,this.collected.clear(),this.users.clear(),this.checkEnd()}endReason(){return this.options.max&&this.total>=this.options.max?"limit":this.options.maxEmojis&&this.collected.size>=this.options.maxEmojis?"emojiLimit":this.options.maxUsers&&this.users.size>=this.options.maxUsers?"userLimit":null}static key(e){return e.emoji.id||e.emoji.name}}e.exports=ReactionCollector},function(e,t,i){const n=i(3),s=i(34),r=i(46),{Error:o}=i(4);class MessageReaction{constructor(e,t,i,s){this.message=e,this.me=s,this.count=i||0,this.users=new n,this._emoji=new r(this,t.name,t.id)}get emoji(){if(this._emoji instanceof s)return this._emoji;if(this._emoji.id){const e=this.message.client.emojis;if(e.has(this._emoji.id)){const t=e.get(this._emoji.id);return this._emoji=t,t}}return this._emoji}remove(e=this.message.client.user){const t=this.message.client.resolver.resolveUserID(e);return t?this.message.client.api.channels[this.message.channel.id].messages[this.message.id].reactions[this.emoji.identifier][t===this.message.client.user.id?"@me":t].delete().then(()=>this.message.client.actions.MessageReactionRemove.handle({user_id:t,message_id:this.message.id,emoji:this.emoji,channel_id:this.message.channel.id}).reaction):Promise.reject(new o("REACTION_RESOLVE_USER"))}async fetchUsers({limit:e=100,after:t}={}){const i=this.message,n=await i.client.api.channels[i.channel.id].messages[i.id].reactions[this.emoji.identifier].get({query:{limit:e,after:t}});for(const e of n){const t=i.client.users.create(e);this.users.set(t.id,t)}return this.count=this.users.size,this.users}_add(e){this.users.has(e.id)||(this.users.set(e.id,e),this.count++),this.me||(this.me=e.id===this.message.client.user.id)}_remove(e){this.users.has(e.id)&&(this.users.delete(e.id),this.count--,e.id===this.message.client.user.id&&(this.me=!1),this.count<=0&&this.message.reactions.remove(this.emoji.id||this.emoji.name))}}e.exports=MessageReaction},function(e,t,i){const n=i(15),s=i(26),r=i(3),o=i(33);class GroupDMChannel extends n{constructor(e,t){super(e,t),this.messages=new o(this),this._typing=new Map}_patch(e){if(super._patch(e),this.name=e.name,this.icon=e.icon,this.ownerID=e.owner_id,this.managed=e.managed,this.applicationID=e.application_id,e.nicks&&(this.nicks=new r(e.nicks.map(e=>[e.id,e.nick]))),this.recipients||(this.recipients=new r),e.recipients)for(const t of e.recipients){const e=this.client.users.create(t);this.recipients.set(e.id,e)}this.lastMessageID=e.last_message_id}get owner(){return this.client.users.get(this.ownerID)}iconURL({format:e,size:t}={}){return this.icon?this.client.rest.cdn.GDMIcon(this.id,this.icon,e,t):null}equals(e){const t=e&&this.id===e.id&&this.name===e.name&&this.icon===e.icon&&this.ownerID===e.ownerID;return t?this.recipients.equals(e.recipients):t}edit(e,t){return this.client.api.channels[this.id].patch({data:{icon:e.icon,name:null===e.name?null:e.name||this.name},reason:t}).then(()=>this)}async setIcon(e){return this.edit({icon:await this.client.resolver.resolveImage(e)})}setName(e){return this.edit({name:e})}addUser({user:e,accessToken:t,nick:i}){const n=this.client.resolver.resolveUserID(e),s=this.client.user.bot?{nick:i,access_token:t}:{recipient:n};return this.client.api.channels[this.id].recipients[n].put({data:s}).then(()=>this)}removeUser(e){const t=this.client.resolver.resolveUserID(e);return this.client.api.channels[this.id].recipients[t].delete().then(()=>this)}toString(){return this.name}send(){}search(){}startTyping(){}stopTyping(){}get typing(){}get typingCount(){}createMessageCollector(){}awaitMessages(){}acknowledge(){}_cacheMessage(){}}s.applyToClass(GroupDMChannel,!0,["bulkDelete"]),e.exports=GroupDMChannel},function(e,t,i){const n=i(28),s=i(21),r=i(26),o=i(3),a=i(33);class TextChannel extends n{constructor(e,t){super(e,t),this.messages=new a(this),this._typing=new Map}_patch(e){if(super._patch(e),this.topic=e.topic,this.nsfw=Boolean(e.nsfw),this.lastMessageID=e.last_message_id,e.messages)for(const t of e.messages)this.messages.create(t)}fetchWebhooks(){return this.client.api.channels[this.id].webhooks.get().then(e=>{const t=new o;for(const i of e)t.set(i.id,new s(this.client,i));return t})}async createWebhook(e,{avatar:t,reason:i}={}){return"string"!=typeof t||t.startsWith("data:")||(t=await this.client.resolver.resolveImage(t)),this.client.api.channels[this.id].webhooks.post({data:{name:e,avatar:t},reason:i}).then(e=>new s(this.client,e))}send(){}search(){}startTyping(){}stopTyping(){}get typing(){}get typingCount(){}createMessageCollector(){}awaitMessages(){}bulkDelete(){}acknowledge(){}_cacheMessage(){}}r.applyToClass(TextChannel,!0),e.exports=TextChannel},function(e,t,i){const n=i(12);class PermissionOverwrites{constructor(e,t){Object.defineProperty(this,"channel",{value:e}),t&&this._patch(t)}_patch(e){this.id=e.id,this.type=e.type,this._denied=e.deny,this._allowed=e.allow,this.denied=new n(this._denied),this.allowed=new n(this._allowed)}delete(e){return this.channel.client.api.channels[this.channel.id].permissions[this.id].delete({reason:e}).then(()=>this)}}e.exports=PermissionOverwrites},function(e,t,i){const n=i(28),s=i(3),{Error:r}=i(4);class VoiceChannel extends n{constructor(e,t){super(e,t),Object.defineProperty(this,"members",{value:new s})}_patch(e){super._patch(e),this.bitrate=.001*e.bitrate,this.userLimit=e.user_limit}get connection(){const e=this.guild.voiceConnection;return e&&e.channel.id===this.id?e:null}get full(){return this.userLimit>0&&this.members.size>=this.userLimit}get joinable(){return!this.client.browser&&(!!this.permissionsFor(this.client.user).has("CONNECT")&&!(this.full&&!this.permissionsFor(this.client.user).has("MOVE_MEMBERS")))}get speakable(){return this.permissionsFor(this.client.user).has("SPEAK")}setBitrate(e,t){return e*=1e3,this.edit({bitrate:e},t)}setUserLimit(e,t){return this.edit({userLimit:e},t)}join(){return this.client.browser?Promise.reject(new r("VOICE_NO_BROWSER")):this.client.voice.joinChannel(this)}leave(){if(this.client.browser)return;const e=this.client.voice.connections.get(this.guild.id);e&&e.channel.id===this.id&&e.disconnect()}}e.exports=VoiceChannel},function(e,t,i){const n=i(3),s=i(9),r=i(21),o={ALL:"ALL",GUILD:"GUILD",CHANNEL:"CHANNEL",USER:"USER",ROLE:"ROLE",INVITE:"INVITE",WEBHOOK:"WEBHOOK",EMOJI:"EMOJI",MESSAGE:"MESSAGE",UNKNOWN:"UNKNOWN"},a={ALL:null,GUILD_UPDATE:1,CHANNEL_CREATE:10,CHANNEL_UPDATE:11,CHANNEL_DELETE:12,CHANNEL_OVERWRITE_CREATE:13,CHANNEL_OVERWRITE_UPDATE:14,CHANNEL_OVERWRITE_DELETE:15,MEMBER_KICK:20,MEMBER_PRUNE:21,MEMBER_BAN_ADD:22,MEMBER_BAN_REMOVE:23,MEMBER_UPDATE:24,MEMBER_ROLE_UPDATE:25,ROLE_CREATE:30,ROLE_UPDATE:31,ROLE_DELETE:32,INVITE_CREATE:40,INVITE_UPDATE:41,INVITE_DELETE:42,WEBHOOK_CREATE:50,WEBHOOK_UPDATE:51,WEBHOOK_DELETE:52,EMOJI_CREATE:60,EMOJI_UPDATE:61,EMOJI_DELETE:62,MESSAGE_DELETE:72};class GuildAuditLogs{constructor(e,t){if(t.users)for(const i of t.users)e.client.users.create(i);if(this.webhooks=new n,t.webhooks)for(const i of t.webhooks)this.webhooks.set(i.id,new r(e.client,i));this.entries=new n;for(const i of t.audit_log_entries){const t=new GuildAuditLogsEntry(e,i);this.entries.set(t.id,t)}}static build(...e){const t=new GuildAuditLogs(...e);return Promise.all(t.entries.map(e=>e.target)).then(()=>t)}static targetType(e){return e<10?o.GUILD:e<20?o.CHANNEL:e<30?o.USER:e<40?o.ROLE:e<50?o.INVITE:e<60?o.WEBHOOK:e<70?o.EMOJI:e<80?o.MESSAGE:o.UNKNOWN}static actionType(e){return[a.CHANNEL_CREATE,a.CHANNEL_OVERWRITE_CREATE,a.MEMBER_BAN_REMOVE,a.ROLE_CREATE,a.INVITE_CREATE,a.WEBHOOK_CREATE,a.EMOJI_CREATE].includes(e)?"CREATE":[a.CHANNEL_DELETE,a.CHANNEL_OVERWRITE_DELETE,a.MEMBER_KICK,a.MEMBER_PRUNE,a.MEMBER_BAN_ADD,a.ROLE_DELETE,a.INVITE_DELETE,a.WEBHOOK_DELETE,a.EMOJI_DELETE,a.MESSAGE_DELETE].includes(e)?"DELETE":[a.GUILD_UPDATE,a.CHANNEL_UPDATE,a.CHANNEL_OVERWRITE_UPDATE,a.MEMBER_UPDATE,a.MEMBER_ROLE_UPDATE,a.ROLE_UPDATE,a.INVITE_UPDATE,a.WEBHOOK_UPDATE,a.EMOJI_UPDATE].includes(e)?"UPDATE":"ALL"}}class GuildAuditLogsEntry{constructor(e,t){const i=GuildAuditLogs.targetType(t.action_type);if(this.targetType=i,this.actionType=GuildAuditLogs.actionType(t.action_type),this.action=Object.keys(a).find(e=>a[e]===t.action_type),this.reason=t.reason||null,this.executor=e.client.users.get(t.user_id),this.changes=t.changes?t.changes.map(e=>({key:e.key,old:e.old_value,new:e.new_value})):null,this.id=t.id,this.extra=null,t.options)if(t.action_type===a.MEMBER_PRUNE)this.extra={removed:t.options.members_removed,days:t.options.delete_member_days};else if(t.action_type===a.MESSAGE_DELETE)this.extra={count:t.options.count,channel:e.channels.get(t.options.channel_id)};else switch(t.options.type){case"member":this.extra=e.members.get(t.options.id),this.extra||(this.extra={id:t.options.id});break;case"role":this.extra=e.roles.get(t.options.id),this.extra||(this.extra={id:t.options.id,name:t.options.role_name})}if(i===o.UNKNOWN)this.target=this.changes.reduce((e,t)=>(e[t.key]=t.new||t.old,e),{}),this.target.id=t.target_id;else if([o.USER,o.GUILD].includes(i))this.target=e.client[`${i.toLowerCase()}s`].get(t.target_id);else if(i===o.WEBHOOK)this.target=this.webhooks.get(t.target_id);else if(i===o.INVITE)if(e.me.permissions.has("MANAGE_GUILD")){const t=this.changes.find(e=>"code"===e.key);this.target=e.fetchInvites().then(e=>(this.target=e.find(e=>e.code===(t.new||t.old)),this.target))}else this.target=this.changes.reduce((e,t)=>(e[t.key]=t.new||t.old,e),{});else i===o.MESSAGE?this.target=e.client.users.get(t.target_id):this.target=e[`${i.toLowerCase()}s`].get(t.target_id)}get createdTimestamp(){return s.deconstruct(this.id).timestamp}get createdAt(){return new Date(this.createdTimestamp)}}GuildAuditLogs.Actions=a,GuildAuditLogs.Targets=o,GuildAuditLogs.Entry=GuildAuditLogsEntry,e.exports=GuildAuditLogs},function(e,t){class VoiceRegion{constructor(e){this.id=e.id,this.name=e.name,this.vip=e.vip,this.deprecated=e.deprecated,this.optimal=e.optimal,this.custom=e.custom,this.sampleHostname=e.sample_hostname}}e.exports=VoiceRegion},function(e,t,i){const n=i(11),{Presence:s}=i(19);class PresenceStore extends n{create(e){return this.has(e.user.id)?this.get(e.user.id).patch(e):this.set(e.user.id,new s(this.client,e)),this.get(e.user.id)}}e.exports=PresenceStore},function(e,t,i){const n=i(25),s=i(3),r=i(75),o=i(76),a=i(0),c=i(7),l=i(29);class ClientUser extends n{_patch(e){if(super._patch(e),this.verified=e.verified,this.email=e.email,this._typing=new Map,this.friends=new s,this.blocked=new s,this.notes=new s,this.premium="boolean"==typeof e.premium?e.premium:null,this.mfaEnabled="boolean"==typeof e.mfa_enabled?e.mfa_enabled:null,this.mobile="boolean"==typeof e.mobile?e.mobile:null,this.settings=e.user_settings?new r(this,e.user_settings):null,this.guildSettings=new s,e.user_guild_settings)for(const t of e.user_guild_settings)this.guildSettings.set(t.guild_id,new o(this.client,t))}get presence(){return this.client.presences.clientPresence}edit(e,t){return this.bot||("object"!=typeof t?e.password=t:(e.code=t.mfaCode,e.password=t.password)),this.client.api.users("@me").patch({data:e}).then(e=>(this.client.token=e.token,this.client.actions.UserUpdate.handle(e).updated))}setUsername(e,t){return this.edit({username:e},t)}setEmail(e,t){return this.edit({email:e},t)}setPassword(e,t){return this.edit({new_password:e},{password:t.oldPassword,mfaCode:t.mfaCode})}async setAvatar(e){return this.edit({avatar:await this.client.resolver.resolveImage(e)})}setPresence(e){return this.client.presences.setClientPresence(e)}setStatus(e){return this.setPresence({status:e})}setActivity(e,{url:t,type:i}={}){return e?this.setPresence({activity:{name:e,type:i,url:t}}):this.setPresence({activity:null})}setAFK(e){return this.setPresence({afk:e})}fetchMentions(e={}){return e.guild instanceof l&&(e.guild=e.guild.id),c.mergeDefault({limit:25,roles:!0,everyone:!0,guild:null},e),this.client.api.users("@me").mentions.get({query:e}).then(e=>e.map(e=>this.client.channels.get(e.channel_id).messages.create(e,!1)))}createGuild(e,{region:t,icon:i=null}={}){return!i||"string"==typeof i&&i.startsWith("data:")?new Promise((n,s)=>this.client.api.guilds.post({data:{name:e,region:t,icon:i}}).then(e=>{if(this.client.guilds.has(e.id))return n(this.client.guilds.get(e.id));const t=s=>{s.id===e.id&&(this.client.removeListener(a.Events.GUILD_CREATE,t),this.client.clearTimeout(i),n(s))};this.client.on(a.Events.GUILD_CREATE,t);const i=this.client.setTimeout(()=>{this.client.removeListener(a.Events.GUILD_CREATE,t),n(this.client.guilds.create(e))},1e4)},s)):this.client.resolver.resolveImage(i).then(i=>this.createGuild(e,{region:t,icon:i||null}))}createGroupDM(e){const t=this.bot?{access_tokens:e.map(e=>e.accessToken),nicks:e.reduce((e,t)=>(t.nick&&(e[t.user?t.user.id:t.id]=t.nick),e),{})}:{recipients:e.map(e=>this.client.resolver.resolveUserID(e.user||e.id))};return this.client.api.users("@me").channels.post({data:t}).then(e=>this.client.channels.create(e))}}e.exports=ClientUser},function(e,t,i){const n=i(0),s=i(7),{Error:r}=i(4);class ClientUserSettings{constructor(e,t){this.user=e,this.patch(t)}patch(e){for(const[t,i]of Object.entries(n.UserSettingsMap))e.hasOwnProperty(t)&&("function"==typeof i?this[i.name]=i(e[t]):this[i]=e[t])}update(e,t){return this.user.client.api.users["@me"].settings.patch({data:{[e]:t}})}setGuildPosition(e,t,i){const n=Object.assign([],this.guildPositions);return s.moveElementInArray(n,e.id,t,i),this.update("guild_positions",n).then(()=>e)}addRestrictedGuild(e){const t=Object.assign([],this.restrictedGuilds);return t.includes(e.id)?Promise.reject(new r("GUILD_RESTRICTED",!0)):(t.push(e.id),this.update("restricted_guilds",t).then(()=>e))}removeRestrictedGuild(e){const t=Object.assign([],this.restrictedGuilds),i=t.indexOf(e.id);return i<0?Promise.reject(new r("GUILD_RESTRICTED")):(t.splice(i,1),this.update("restricted_guilds",t).then(()=>e))}}e.exports=ClientUserSettings},function(e,t,i){const n=i(0),s=i(3),r=i(138);class ClientUserGuildSettings{constructor(e,t){Object.defineProperty(this,"client",{value:e}),this.guildID=t.guild_id,this.channelOverrides=new s,this.patch(t)}patch(e){for(const[t,i]of Object.entries(n.UserGuildSettingsMap))if(e.hasOwnProperty(t))if("channel_overrides"===t)for(const i of e[t]){const e=this.channelOverrides.get(i.channel_id);e?e.patch(i):this.channelOverrides.set(i.channel_id,new r(i))}else"function"==typeof i?this[i.name]=i(e[t]):this[i]=e[t]}update(e,t){return this.client.api.users("@me").guilds(this.guildID).settings.patch({data:{[e]:t}})}}e.exports=ClientUserGuildSettings},function(e,t,i){(function(e){const n="undefined"!=typeof window,s=i(31),r=i(32);if(n)t.WebSocket=window.WebSocket;else try{t.WebSocket=i(175)}catch(e){t.WebSocket=i(176)}try{var o=i(177);o.pack||(o=null)}catch(e){}t.encoding=o?"etf":"json",t.pack=o?o.pack:JSON.stringify,t.unpack=(t=>(Array.isArray(t)&&(t=e.concat(t)),t instanceof ArrayBuffer&&(t=e.from(new Uint8Array(t))),o&&"string"!=typeof t?o.unpack(t):(t instanceof e&&(t=s.inflateSync(t).toString()),JSON.parse(t)))),t.create=((e,i={},...s)=>{i.encoding=t.encoding;const o=new t.WebSocket(`${e}?${r.stringify(i)}`,...s);return n&&(o.binaryType="arraybuffer"),o});for(const e of["CONNECTING","OPEN","CLOSING","CLOSED"])t[e]=t.WebSocket[e]}).call(t,i(5).Buffer)},function(e,t,i){const n="undefined"!=typeof window,s=i(79);e.exports=s,n?window.Discord=s:n||console.warn("Warning: Attempting to use browser version of Discord.js in a non-browser environment!")},function(e,t,i){const n=i(7);e.exports={BaseClient:i(41),Client:i(131),Shard:i(213),ShardClientUtil:i(214),ShardingManager:i(215),WebhookClient:i(216),Collection:i(3),Constants:i(0),DiscordAPIError:i(60),EvaluatedPermissions:i(12),Permissions:i(12),Snowflake:i(9),SnowflakeUtil:i(9),Util:n,util:n,version:i(57).version,escapeMarkdown:n.escapeMarkdown,fetchRecommendedShards:n.fetchRecommendedShards,splitMessage:n.splitMessage,Activity:i(19).Activity,Channel:i(15),ClientUser:i(74),ClientUserSettings:i(75),Collector:i(42),DMChannel:i(63),Emoji:i(34),GroupDMChannel:i(67),Guild:i(29),GuildAuditLogs:i(71),GuildChannel:i(28),GuildMember:i(17),Invite:i(35),Message:i(44),MessageAttachment:i(27),MessageCollector:i(61),MessageEmbed:i(20),MessageMentions:i(64),MessageReaction:i(66),ClientApplication:i(45),PermissionOverwrites:i(69),Presence:i(19).Presence,ReactionEmoji:i(46),ReactionCollector:i(65),Role:i(18),TextChannel:i(68),User:i(25),VoiceChannel:i(70),Webhook:i(21),WebSocket:i(77)}},function(e,t,i){"use strict";function n(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===e[t-2]?2:"="===e[t-1]?1:0}function s(e){return o[e>>18&63]+o[e>>12&63]+o[e>>6&63]+o[63&e]}function r(e,t,i){for(var n,r=[],o=t;o0?l-4:l;var h=0;for(t=0;t>16&255,o[h++]=s>>8&255,o[h++]=255&s;return 2===r?(s=a[e.charCodeAt(t)]<<2|a[e.charCodeAt(t+1)]>>4,o[h++]=255&s):1===r&&(s=a[e.charCodeAt(t)]<<10|a[e.charCodeAt(t+1)]<<4|a[e.charCodeAt(t+2)]>>2,o[h++]=s>>8&255,o[h++]=255&s),o},t.fromByteArray=function(e){for(var t,i=e.length,n=i%3,s="",a=[],c=0,l=i-n;cl?l:c+16383));return 1===n?(t=e[i-1],s+=o[t>>2],s+=o[t<<4&63],s+="=="):2===n&&(t=(e[i-2]<<8)+e[i-1],s+=o[t>>10],s+=o[t>>4&63],s+=o[t<<2&63],s+="="),a.push(s),a.join("")};for(var o=[],a=[],c="undefined"!=typeof Uint8Array?Uint8Array:Array,l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",h=0,u=l.length;h>1,h=-7,u=i?s-1:0,p=i?-1:1,d=e[t+u];for(u+=p,r=d&(1<<-h)-1,d>>=-h,h+=a;h>0;r=256*r+e[t+u],u+=p,h-=8);for(o=r&(1<<-h)-1,r>>=-h,h+=n;h>0;o=256*o+e[t+u],u+=p,h-=8);if(0===r)r=1-l;else{if(r===c)return o?NaN:1/0*(d?-1:1);o+=Math.pow(2,n),r-=l}return(d?-1:1)*o*Math.pow(2,r-n)},t.write=function(e,t,i,n,s,r){var o,a,c,l=8*r-s-1,h=(1<>1,p=23===s?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:r-1,f=n?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,o=h):(o=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-o))<1&&(o--,c*=2),(t+=o+u>=1?p/c:p*Math.pow(2,1-u))*c>=2&&(o++,c/=2),o+u>=h?(a=0,o=h):o+u>=1?(a=(t*c-1)*Math.pow(2,s),o+=u):(a=t*Math.pow(2,u-1)*Math.pow(2,s),o=0));s>=8;e[i+d]=255&a,d+=f,a/=256,s-=8);for(o=o<0;e[i+d]=255&o,d+=f,o/=256,l-=8);e[i+d-f]|=128*m}},function(e,t,i){(function(t){function n(e){return c.format({protocol:e.connection.encrypted?"https:":"http:",hostname:e.getHeader("host"),pathname:e.path.split("?")[0],query:e.query})}i(37);const s=i(31),r=i(32),o=i(53),a=i(103),c=i(55),l=i(104),h=i(37),u=i(105),p=i(108);class Snekfetch extends h.Readable{constructor(e,t,i={headers:null,data:null,query:null}){super();const n=c.parse(t);n.method=e.toUpperCase(),i.headers&&(n.headers=i.headers),"agent"in i&&(n.agent=i.agent),this.request={https:a,http:o,file:p}[n.protocol.replace(":","")].request(n),this.request.followRedirects=i.followRedirects,i.query&&this.query(i.query),i.data&&this.send(i.data)}query(e,t){if(this.response)throw new Error("Cannot modify query after being sent!");return this.request.query||(this.request.query={}),null!==e&&"object"==typeof e?this.request.query=Object.assign(this.request.query,e):this.request.query[e]=t,this}set(e,t){if(this.response)throw new Error("Cannot modify headers after being sent!");if(null!==e&&"object"==typeof e)for(const t of Object.keys(e))this.set(t,e[t]);else this.request.setHeader(e,t);return this}attach(e,t,i){if(this.response)throw new Error("Cannot modify data after being sent!");const n=this._getFormData();return this.set("Content-Type",`multipart/form-data; boundary=${n.boundary}`),n.append(e,t,i),this.data=n,this}send(e){if(this.response)throw new Error("Cannot modify data after being sent!");if(e instanceof t||e instanceof h)this.data=e;else if(null!==e&&"object"==typeof e){const t=this._getRequestHeader("content-type");let i;t?t.includes("json")?i=JSON.stringify:t.includes("urlencoded")&&(i=r.stringify):(this.set("Content-Type","application/json"),i=JSON.stringify),this.data=i(e)}else this.data=e;return this}then(e,i){return new Promise((e,i)=>{const a=this.request,l=e=>{e||(e=new Error("Unknown error occured")),e.request=a,i(e)};a.once("abort",l),a.once("aborted",l),a.once("error",l),a.once("response",l=>{const u=new h.PassThrough;this._shouldUnzip(l)?l.pipe(s.createUnzip({flush:s.Z_SYNC_FLUSH,finishFlush:s.Z_SYNC_FLUSH})).pipe(u):l.pipe(u);const p=[];u.on("data",e=>{this.push(e)||this.pause(),p.push(e)}),u.once("end",()=>{this.push(null);const s=t.concat(p);if(!1!==this.request.followRedirects&&this._shouldRedirect(l)){let t=this.request.method;[301,302].includes(l.statusCode)?("HEAD"!==t&&(t="GET"),this.data=null):303===l.statusCode&&(t="GET");const i={};if(this.request._headerNames)for(const e of Object.keys(this.request._headerNames))"host"!==e.toLowerCase()&&(i[this.request._headerNames[e]]=this.request._headers[e]);else for(const e of Object.keys(this.request._headers)){if("host"===e.toLowerCase())continue;const t=this.request._headers[e];i[t.name]=t.value}const s=/^https?:\/\//i.test(l.headers.location)?l.headers.location:c.resolve(n(a),l.headers.location);return void e(new Snekfetch(t,s,{data:this.data,headers:i}))}const h={request:this.request,get body(){delete h.body;const e=l.headers["content-type"];if(e&&e.includes("application/json"))try{h.body=JSON.parse(h.text)}catch(e){h.body=h.text}else e&&e.includes("application/x-www-form-urlencoded")?h.body=r.parse(h.text):h.body=s;return h.body},text:s.toString(),ok:l.statusCode>=200&&l.statusCode<300,headers:l.headers,status:l.statusCode,statusText:l.statusText||o.STATUS_CODES[l.statusCode]};if(h.ok)e(h);else{const e=new Error(`${h.status} ${h.statusText}`.trim());Object.assign(e,h),i(e)}})});const u=this.data?this.data.end?this.data.end():this.data:null;if(this._addFinalHeaders(),this.request.query&&(this.request.path=`${this.request.path}?${r.stringify(this.request.query)}`),Array.isArray(u)){for(const e of u)a.write(e);a.end()}else u instanceof h?u.pipe(a):u instanceof t?(this.set("Content-Length",t.byteLength(u)),a.end(u)):a.end(u)}).then(e,i)}catch(e){return this.then(null,e)}end(e){return this.then(t=>e?e(null,t):t,t=>e?e(t,t.status?t:null):t)}_read(){this.resume(),this.response||this.catch(e=>this.emit("error",e))}_shouldUnzip(e){return 204!==e.statusCode&&304!==e.statusCode&&("0"!==e.headers["content-length"]&&/^\s*(?:deflate|gzip)\s*$/.test(e.headers["content-encoding"]))}_shouldRedirect(e){return[301,302,303,307,308].includes(e.statusCode)}_getFormData(){return this._formData||(this._formData=new u),this._formData}_addFinalHeaders(){this.request&&(this._getRequestHeader("user-agent")||this.set("User-Agent",`snekfetch/${Snekfetch.version} (${l.repository.url.replace(/\.?git/,"")})`),"HEAD"!==this.request.method&&this.set("Accept-Encoding","gzip, deflate"),this.data&&this.data.end&&this.set("Content-Length",this.data.length))}get response(){return this.request?this.request.res||this.request._response||null:null}_getRequestHeader(e){try{return this.request.getHeader(e)}catch(e){return null}}}Snekfetch.version=l.version,Snekfetch.METHODS=o.METHODS?o.METHODS.concat("BREW"):["GET","POST","PUT","DELETE","OPTIONS","HEAD"];for(const e of Snekfetch.METHODS)Snekfetch["M-SEARCH"===e?"msearch":e.toLowerCase()]=((t,i)=>new Snekfetch(e,t,i));e.exports=Snekfetch}).call(t,i(5).Buffer)},function(e,t){},function(e,t,i){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t,i){e.copy(t,i)}var r=i(38).Buffer;e.exports=function(){function e(){n(this,e),this.head=null,this.tail=null,this.length=0}return e.prototype.push=function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length},e.prototype.unshift=function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length},e.prototype.shift=function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}},e.prototype.clear=function(){this.head=this.tail=null,this.length=0},e.prototype.join=function(e){if(0===this.length)return"";for(var t=this.head,i=""+t.data;t=t.next;)i+=e+t.data;return i},e.prototype.concat=function(e){if(0===this.length)return r.alloc(0);if(1===this.length)return this.head.data;for(var t=r.allocUnsafe(e>>>0),i=this.head,n=0;i;)s(i.data,t,n),n+=i.data.length,i=i.next;return t},e}()},function(e,t,i){function n(e,t){this._id=e,this._clearFn=t}var s=Function.prototype.apply;t.setTimeout=function(){return new n(s.call(setTimeout,window,arguments),clearTimeout)},t.setInterval=function(){return new n(s.call(setInterval,window,arguments),clearInterval)},t.clearTimeout=t.clearInterval=function(e){e&&e.close()},n.prototype.unref=n.prototype.ref=function(){},n.prototype.close=function(){this._clearFn.call(window,this._id)},t.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},t.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},t._unrefActive=t.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;t>=0&&(e._idleTimeoutId=setTimeout(function(){e._onTimeout&&e._onTimeout()},t))},i(86),t.setImmediate=setImmediate,t.clearImmediate=clearImmediate},function(e,t,i){(function(e,t){!function(e,i){"use strict";function n(e){delete c[e]}function s(e){var t=e.callback,n=e.args;switch(n.length){case 0:t();break;case 1:t(n[0]);break;case 2:t(n[0],n[1]);break;case 3:t(n[0],n[1],n[2]);break;default:t.apply(i,n)}}function r(e){if(l)setTimeout(r,0,e);else{var t=c[e];if(t){l=!0;try{s(t)}finally{n(e),l=!1}}}}if(!e.setImmediate){var o,a=1,c={},l=!1,h=e.document,u=Object.getPrototypeOf&&Object.getPrototypeOf(e);u=u&&u.setTimeout?u:e,"[object process]"==={}.toString.call(e.process)?o=function(e){t.nextTick(function(){r(e)})}:function(){if(e.postMessage&&!e.importScripts){var t=!0,i=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=i,t}}()?function(){var t="setImmediate$"+Math.random()+"$",i=function(i){i.source===e&&"string"==typeof i.data&&0===i.data.indexOf(t)&&r(+i.data.slice(t.length))};e.addEventListener?e.addEventListener("message",i,!1):e.attachEvent("onmessage",i),o=function(i){e.postMessage(t+i,"*")}}():e.MessageChannel?function(){var e=new MessageChannel;e.port1.onmessage=function(e){r(e.data)},o=function(t){e.port2.postMessage(t)}}():h&&"onreadystatechange"in h.createElement("script")?function(){var e=h.documentElement;o=function(t){var i=h.createElement("script");i.onreadystatechange=function(){r(t),i.onreadystatechange=null,e.removeChild(i),i=null},e.appendChild(i)}}():o=function(e){setTimeout(r,0,e)},u.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),i=0;i0&&l>c&&(l=c);for(var h=0;h=0?(u=m.substr(0,g),p=m.substr(g+1)):(u=m,p=""),d=decodeURIComponent(u),f=decodeURIComponent(p),n(o,d)?s(o[d])?o[d].push(f):o[d]=[o[d],f]:o[d]=f}return o};var s=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},function(e,t,i){"use strict";function n(e,t){if(e.map)return e.map(t);for(var i=[],n=0;ne._pos){var r=i.substr(e._pos);if("x-user-defined"===e._charset){for(var o=new n(r.length),a=0;ae._pos&&(e.push(new n(new Uint8Array(l.result.slice(e._pos)))),e._pos=l.result.byteLength)},l.onload=function(){e.push(null)},l.readAsArrayBuffer(i)}e._xhr.readyState===c.DONE&&"ms-stream"!==e._mode&&e.push(null)}}).call(t,i(8),i(5).Buffer,i(6))},function(e,t,i){var n=i(5).Buffer;e.exports=function(e){if(e instanceof Uint8Array){if(0===e.byteOffset&&e.byteLength===e.buffer.byteLength)return e.buffer;if("function"==typeof e.buffer.slice)return e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}if(n.isBuffer(e)){for(var t=new Uint8Array(e.length),i=e.length,s=0;s1&&(n=i[0]+"@",e=i[1]),n+a((e=e.replace(D,".")).split("."),t).join(".")}function l(e){for(var t,i,n=[],s=0,r=e.length;s=55296&&t<=56319&&s65535&&(t+=M((e-=65536)>>>10&1023|55296),e=56320|1023&e),t+=M(e)}).join("")}function u(e){return e-48<10?e-22:e-65<26?e-65:e-97<26?e-97:_}function p(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function d(e,t,i){var n=0;for(e=i?N(e/x):e>>1,e+=N(e/t);e>k*b>>1;n+=_)e=N(e/k);return N(n+(k+1)*e/(e+w))}function f(e){var t,i,n,s,r,a,c,l,p,f,m=[],g=e.length,v=0,w=S,x=A;for((i=e.lastIndexOf(T))<0&&(i=0),n=0;n=128&&o("not-basic"),m.push(e.charCodeAt(n));for(s=i>0?i+1:0;s=g&&o("invalid-input"),((l=u(e.charCodeAt(s++)))>=_||l>N((E-v)/a))&&o("overflow"),v+=l*a,p=c<=x?y:c>=x+b?b:c-x,!(lN(E/(f=_-p))&&o("overflow"),a*=f;x=d(v-r,t=m.length+1,0==r),N(v/t)>E-w&&o("overflow"),w+=N(v/t),v%=t,m.splice(v++,0,w)}return h(m)}function m(e){var t,i,n,s,r,a,c,h,u,f,m,g,v,w,x,R=[];for(g=(e=l(e)).length,t=S,i=0,r=A,a=0;a=t&&mN((E-i)/(v=n+1))&&o("overflow"),i+=(c-t)*v,t=c,a=0;aE&&o("overflow"),m==t){for(h=i,u=_;f=u<=r?y:u>=r+b?b:u-r,!(h= 0x80 (not a basic code point)","invalid-input":"Invalid input"},k=_-y,N=Math.floor,M=String.fromCharCode;v={version:"1.4.1",ucs2:{decode:l,encode:h},decode:f,encode:m,toASCII:function(e){return c(e,function(e){return I.test(e)?"xn--"+m(e):e})},toUnicode:function(e){return c(e,function(e){return R.test(e)?f(e.slice(4).toLowerCase()):e})}},void 0!==(s=function(){return v}.call(t,i,t,e))&&(e.exports=s)}()}).call(t,i(101)(e),i(6))},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,i){"use strict";e.exports={isString:function(e){return"string"==typeof e},isObject:function(e){return"object"==typeof e&&null!==e},isNull:function(e){return null===e},isNullOrUndefined:function(e){return null==e}}},function(e,t,i){var n=i(53),s=e.exports;for(var r in n)n.hasOwnProperty(r)&&(s[r]=n[r]);s.request=function(e,t){return e||(e={}),e.scheme="https",e.protocol="https:",n.request.call(this,e,t)}},function(e,t){e.exports={_from:"snekfetch@^3.0.0",_id:"snekfetch@3.2.9",_inBundle:!1,_integrity:"sha512-0ZYxGRMtgBska6uQ616F0jcPYad/sLe+uBJJ2vewD62ftEFnh6rY5mza05KoUS5UWcclMuiUfAZSf10ZYnkOZA==",_location:"/snekfetch",_phantomChildren:{},_requested:{type:"range",registry:!0,raw:"snekfetch@^3.0.0",name:"snekfetch",escapedName:"snekfetch",rawSpec:"^3.0.0",saveSpec:null,fetchSpec:"^3.0.0"},_requiredBy:["/"],_resolved:"https://registry.npmjs.org/snekfetch/-/snekfetch-3.2.9.tgz",_shasum:"cdd28c7e88c889d86b9ff289a8e985a2f484f206",_spec:"snekfetch@^3.0.0",_where:"/home/travis/build/hydrabolt/discord.js",author:{name:"Gus Caplan",email:"me@gus.host"},bugs:{url:"https://github.com/devsnek/snekfetch/issues"},bundleDependencies:!1,dependencies:{},deprecated:!1,description:"Just do http requests without all that weird nastiness from other libs",devDependencies:{},homepage:"https://github.com/devsnek/snekfetch#readme",license:"MIT",main:"index.js",name:"snekfetch",repository:{type:"git",url:"git+https://github.com/devsnek/snekfetch.git"},version:"3.2.9"}},function(e,t,i){(function(t){const n=i(24),s=i(56);class FormData{constructor(){this.boundary=`--snekfetch--${Math.random().toString().slice(2,7)}`,this.buffers=[]}append(e,i,r){if(void 0===i)return;let o=`\r\n--${this.boundary}\r\nContent-Disposition: form-data; name="${e}"`,a=null;if(r){o+=`; filename="${r}"`,a="application/octet-stream";const e=n.extname(r).slice(1);e&&(a=s.lookup(e))}i instanceof t?a=s.buffer(i):"object"==typeof i?(a="application/json",i=t.from(JSON.stringify(i))):i=t.from(String(i)),a&&(o+=`\r\nContent-Type: ${a}`),this.buffers.push(`${o}\r\n\r\n`),this.buffers.push(i)}end(){return this.buffers.push(`\r\n--${this.boundary}--`),this.buffers}get length(){return this.buffers.reduce((e,i)=>e+t.byteLength(i),0)}}e.exports=FormData}).call(t,i(5).Buffer)},function(e,t){e.exports={123:"application/vnd.lotus-1-2-3",ez:"application/andrew-inset",aw:"application/applixware",atom:"application/atom+xml",atomcat:"application/atomcat+xml",atomsvc:"application/atomsvc+xml",bdoc:"application/x-bdoc",ccxml:"application/ccxml+xml",cdmia:"application/cdmi-capability",cdmic:"application/cdmi-container",cdmid:"application/cdmi-domain",cdmio:"application/cdmi-object",cdmiq:"application/cdmi-queue",cu:"application/cu-seeme",mpd:"application/dash+xml",davmount:"application/davmount+xml",dbk:"application/docbook+xml",dssc:"application/dssc+der",xdssc:"application/dssc+xml",ecma:"application/ecmascript",emma:"application/emma+xml",epub:"application/epub+zip",exi:"application/exi",pfr:"application/font-tdpfr",woff:"application/font-woff",woff2:"application/font-woff2",geojson:"application/geo+json",gml:"application/gml+xml",gpx:"application/gpx+xml",gxf:"application/gxf",stk:"application/hyperstudio",ink:"application/inkml+xml",inkml:"application/inkml+xml",ipfix:"application/ipfix",jar:"application/java-archive",war:"application/java-archive",ear:"application/java-archive",ser:"application/java-serialized-object",class:"application/java-vm",js:"application/javascript",json:"application/json",map:"application/json",json5:"application/json5",jsonml:"application/jsonml+json",jsonld:"application/ld+json",lostxml:"application/lost+xml",hqx:"application/mac-binhex40",cpt:"application/mac-compactpro",mads:"application/mads+xml",webmanifest:"application/manifest+json",mrc:"application/marc",mrcx:"application/marcxml+xml",ma:"application/mathematica",nb:"application/mathematica",mb:"application/mathematica",mathml:"application/mathml+xml",mbox:"application/mbox",mscml:"application/mediaservercontrol+xml",metalink:"application/metalink+xml",meta4:"application/metalink4+xml",mets:"application/mets+xml",mods:"application/mods+xml",m21:"application/mp21",mp21:"application/mp21",mp4s:"application/mp4",m4p:"application/mp4",doc:"application/msword",dot:"application/msword",mxf:"application/mxf",bin:"application/octet-stream",dms:"application/octet-stream",lrf:"application/octet-stream",mar:"application/octet-stream",so:"application/octet-stream",dist:"application/octet-stream",distz:"application/octet-stream",pkg:"application/octet-stream",bpk:"application/octet-stream",dump:"application/octet-stream",elc:"application/octet-stream",deploy:"application/octet-stream",exe:"application/x-msdownload",dll:"application/x-msdownload",deb:"application/x-debian-package",dmg:"application/x-apple-diskimage",iso:"application/x-iso9660-image",img:"application/octet-stream",msi:"application/x-msdownload",msp:"application/octet-stream",msm:"application/octet-stream",buffer:"application/octet-stream",oda:"application/oda",opf:"application/oebps-package+xml",ogx:"application/ogg",omdoc:"application/omdoc+xml",onetoc:"application/onenote",onetoc2:"application/onenote",onetmp:"application/onenote",onepkg:"application/onenote",oxps:"application/oxps",xer:"application/patch-ops-error+xml",pdf:"application/pdf",pgp:"application/pgp-encrypted",asc:"application/pgp-signature",sig:"application/pgp-signature",prf:"application/pics-rules",p10:"application/pkcs10",p7m:"application/pkcs7-mime",p7c:"application/pkcs7-mime",p7s:"application/pkcs7-signature",p8:"application/pkcs8",ac:"application/pkix-attr-cert",cer:"application/pkix-cert",crl:"application/pkix-crl",pkipath:"application/pkix-pkipath",pki:"application/pkixcmp",pls:"application/pls+xml",ai:"application/postscript",eps:"application/postscript",ps:"application/postscript",cww:"application/prs.cww",pskcxml:"application/pskc+xml",rdf:"application/rdf+xml",rif:"application/reginfo+xml",rnc:"application/relax-ng-compact-syntax",rl:"application/resource-lists+xml",rld:"application/resource-lists-diff+xml",rs:"application/rls-services+xml",gbr:"application/rpki-ghostbusters",mft:"application/rpki-manifest",roa:"application/rpki-roa",rsd:"application/rsd+xml",rss:"application/rss+xml",rtf:"text/rtf",sbml:"application/sbml+xml",scq:"application/scvp-cv-request",scs:"application/scvp-cv-response",spq:"application/scvp-vp-request",spp:"application/scvp-vp-response",sdp:"application/sdp",setpay:"application/set-payment-initiation",setreg:"application/set-registration-initiation",shf:"application/shf+xml",smi:"application/smil+xml",smil:"application/smil+xml",rq:"application/sparql-query",srx:"application/sparql-results+xml",gram:"application/srgs",grxml:"application/srgs+xml",sru:"application/sru+xml",ssdl:"application/ssdl+xml",ssml:"application/ssml+xml",tei:"application/tei+xml",teicorpus:"application/tei+xml",tfi:"application/thraud+xml",tsd:"application/timestamped-data",plb:"application/vnd.3gpp.pic-bw-large",psb:"application/vnd.3gpp.pic-bw-small",pvb:"application/vnd.3gpp.pic-bw-var",tcap:"application/vnd.3gpp2.tcap",pwn:"application/vnd.3m.post-it-notes",aso:"application/vnd.accpac.simply.aso",imp:"application/vnd.accpac.simply.imp",acu:"application/vnd.acucobol",atc:"application/vnd.acucorp",acutc:"application/vnd.acucorp",air:"application/vnd.adobe.air-application-installer-package+zip",fcdt:"application/vnd.adobe.formscentral.fcdt",fxp:"application/vnd.adobe.fxp",fxpl:"application/vnd.adobe.fxp",xdp:"application/vnd.adobe.xdp+xml",xfdf:"application/vnd.adobe.xfdf",ahead:"application/vnd.ahead.space",azf:"application/vnd.airzip.filesecure.azf",azs:"application/vnd.airzip.filesecure.azs",azw:"application/vnd.amazon.ebook",acc:"application/vnd.americandynamics.acc",ami:"application/vnd.amiga.ami",apk:"application/vnd.android.package-archive",cii:"application/vnd.anser-web-certificate-issue-initiation",fti:"application/vnd.anser-web-funds-transfer-initiation",atx:"application/vnd.antix.game-component",mpkg:"application/vnd.apple.installer+xml",m3u8:"application/vnd.apple.mpegurl",pkpass:"application/vnd.apple.pkpass",swi:"application/vnd.aristanetworks.swi",iota:"application/vnd.astraea-software.iota",aep:"application/vnd.audiograph",mpm:"application/vnd.blueice.multipass",bmi:"application/vnd.bmi",rep:"application/vnd.businessobjects",cdxml:"application/vnd.chemdraw+xml",mmd:"application/vnd.chipnuts.karaoke-mmd",cdy:"application/vnd.cinderella",cla:"application/vnd.claymore",rp9:"application/vnd.cloanto.rp9",c4g:"application/vnd.clonk.c4group",c4d:"application/vnd.clonk.c4group",c4f:"application/vnd.clonk.c4group",c4p:"application/vnd.clonk.c4group",c4u:"application/vnd.clonk.c4group",c11amc:"application/vnd.cluetrust.cartomobile-config",c11amz:"application/vnd.cluetrust.cartomobile-config-pkg",csp:"application/vnd.commonspace",cdbcmsg:"application/vnd.contact.cmsg",cmc:"application/vnd.cosmocaller",clkx:"application/vnd.crick.clicker",clkk:"application/vnd.crick.clicker.keyboard",clkp:"application/vnd.crick.clicker.palette",clkt:"application/vnd.crick.clicker.template",clkw:"application/vnd.crick.clicker.wordbank",wbs:"application/vnd.criticaltools.wbs+xml",pml:"application/vnd.ctc-posml",ppd:"application/vnd.cups-ppd",car:"application/vnd.curl.car",pcurl:"application/vnd.curl.pcurl",dart:"application/vnd.dart",rdz:"application/vnd.data-vision.rdz",uvf:"application/vnd.dece.data",uvvf:"application/vnd.dece.data",uvd:"application/vnd.dece.data",uvvd:"application/vnd.dece.data",uvt:"application/vnd.dece.ttml+xml",uvvt:"application/vnd.dece.ttml+xml",uvx:"application/vnd.dece.unspecified",uvvx:"application/vnd.dece.unspecified",uvz:"application/vnd.dece.zip",uvvz:"application/vnd.dece.zip",fe_launch:"application/vnd.denovo.fcselayout-link",dna:"application/vnd.dna",mlp:"application/vnd.dolby.mlp",dpg:"application/vnd.dpgraph",dfac:"application/vnd.dreamfactory",kpxx:"application/vnd.ds-keypoint",ait:"application/vnd.dvb.ait",svc:"application/vnd.dvb.service",geo:"application/vnd.dynageo",mag:"application/vnd.ecowin.chart",nml:"application/vnd.enliven",esf:"application/vnd.epson.esf",msf:"application/vnd.epson.msf",qam:"application/vnd.epson.quickanime",slt:"application/vnd.epson.salt",ssf:"application/vnd.epson.ssf",es3:"application/vnd.eszigno3+xml",et3:"application/vnd.eszigno3+xml",ez2:"application/vnd.ezpix-album",ez3:"application/vnd.ezpix-package",fdf:"application/vnd.fdf",mseed:"application/vnd.fdsn.mseed",seed:"application/vnd.fdsn.seed",dataless:"application/vnd.fdsn.seed",gph:"application/vnd.flographit",ftc:"application/vnd.fluxtime.clip",fm:"application/vnd.framemaker",frame:"application/vnd.framemaker",maker:"application/vnd.framemaker",book:"application/vnd.framemaker",fnc:"application/vnd.frogans.fnc",ltf:"application/vnd.frogans.ltf",fsc:"application/vnd.fsc.weblaunch",oas:"application/vnd.fujitsu.oasys",oa2:"application/vnd.fujitsu.oasys2",oa3:"application/vnd.fujitsu.oasys3",fg5:"application/vnd.fujitsu.oasysgp",bh2:"application/vnd.fujitsu.oasysprs",ddd:"application/vnd.fujixerox.ddd",xdw:"application/vnd.fujixerox.docuworks",xbd:"application/vnd.fujixerox.docuworks.binder",fzs:"application/vnd.fuzzysheet",txd:"application/vnd.genomatix.tuxedo",ggb:"application/vnd.geogebra.file",ggt:"application/vnd.geogebra.tool",gex:"application/vnd.geometry-explorer",gre:"application/vnd.geometry-explorer",gxt:"application/vnd.geonext",g2w:"application/vnd.geoplan",g3w:"application/vnd.geospace",gmx:"application/vnd.gmx",gdoc:"application/vnd.google-apps.document",gslides:"application/vnd.google-apps.presentation",gsheet:"application/vnd.google-apps.spreadsheet",kml:"application/vnd.google-earth.kml+xml",kmz:"application/vnd.google-earth.kmz",gqf:"application/vnd.grafeq",gqs:"application/vnd.grafeq",gac:"application/vnd.groove-account",ghf:"application/vnd.groove-help",gim:"application/vnd.groove-identity-message",grv:"application/vnd.groove-injector",gtm:"application/vnd.groove-tool-message",tpl:"application/vnd.groove-tool-template",vcg:"application/vnd.groove-vcard",hal:"application/vnd.hal+xml",zmm:"application/vnd.handheld-entertainment+xml",hbci:"application/vnd.hbci",les:"application/vnd.hhe.lesson-player",hpgl:"application/vnd.hp-hpgl",hpid:"application/vnd.hp-hpid",hps:"application/vnd.hp-hps",jlt:"application/vnd.hp-jlyt",pcl:"application/vnd.hp-pcl",pclxl:"application/vnd.hp-pclxl","sfd-hdstx":"application/vnd.hydrostatix.sof-data",mpy:"application/vnd.ibm.minipay",afp:"application/vnd.ibm.modcap",listafp:"application/vnd.ibm.modcap",list3820:"application/vnd.ibm.modcap",irm:"application/vnd.ibm.rights-management",sc:"application/vnd.ibm.secure-container",icc:"application/vnd.iccprofile",icm:"application/vnd.iccprofile",igl:"application/vnd.igloader",ivp:"application/vnd.immervision-ivp",ivu:"application/vnd.immervision-ivu",igm:"application/vnd.insors.igm",xpw:"application/vnd.intercon.formnet",xpx:"application/vnd.intercon.formnet",i2g:"application/vnd.intergeo",qbo:"application/vnd.intu.qbo",qfx:"application/vnd.intu.qfx",rcprofile:"application/vnd.ipunplugged.rcprofile",irp:"application/vnd.irepository.package+xml",xpr:"application/vnd.is-xpr",fcs:"application/vnd.isac.fcs",jam:"application/vnd.jam",rms:"application/vnd.jcp.javame.midlet-rms",jisp:"application/vnd.jisp",joda:"application/vnd.joost.joda-archive",ktz:"application/vnd.kahootz",ktr:"application/vnd.kahootz",karbon:"application/vnd.kde.karbon",chrt:"application/vnd.kde.kchart",kfo:"application/vnd.kde.kformula",flw:"application/vnd.kde.kivio",kon:"application/vnd.kde.kontour",kpr:"application/vnd.kde.kpresenter",kpt:"application/vnd.kde.kpresenter",ksp:"application/vnd.kde.kspread",kwd:"application/vnd.kde.kword",kwt:"application/vnd.kde.kword",htke:"application/vnd.kenameaapp",kia:"application/vnd.kidspiration",kne:"application/vnd.kinar",knp:"application/vnd.kinar",skp:"application/vnd.koan",skd:"application/vnd.koan",skt:"application/vnd.koan",skm:"application/vnd.koan",sse:"application/vnd.kodak-descriptor",lasxml:"application/vnd.las.las+xml",lbd:"application/vnd.llamagraphics.life-balance.desktop",lbe:"application/vnd.llamagraphics.life-balance.exchange+xml",apr:"application/vnd.lotus-approach",pre:"application/vnd.lotus-freelance",nsf:"application/vnd.lotus-notes",org:"application/vnd.lotus-organizer",scm:"application/vnd.lotus-screencam",lwp:"application/vnd.lotus-wordpro",portpkg:"application/vnd.macports.portpkg",mcd:"application/vnd.mcd",mc1:"application/vnd.medcalcdata",cdkey:"application/vnd.mediastation.cdkey",mwf:"application/vnd.mfer",mfm:"application/vnd.mfmp",flo:"application/vnd.micrografx.flo",igx:"application/vnd.micrografx.igx",mif:"application/vnd.mif",daf:"application/vnd.mobius.daf",dis:"application/vnd.mobius.dis",mbk:"application/vnd.mobius.mbk",mqy:"application/vnd.mobius.mqy",msl:"application/vnd.mobius.msl",plc:"application/vnd.mobius.plc",txf:"application/vnd.mobius.txf",mpn:"application/vnd.mophun.application",mpc:"application/vnd.mophun.certificate",xul:"application/vnd.mozilla.xul+xml",cil:"application/vnd.ms-artgalry",cab:"application/vnd.ms-cab-compressed",xls:"application/vnd.ms-excel",xlm:"application/vnd.ms-excel",xla:"application/vnd.ms-excel",xlc:"application/vnd.ms-excel",xlt:"application/vnd.ms-excel",xlw:"application/vnd.ms-excel",xlam:"application/vnd.ms-excel.addin.macroenabled.12",xlsb:"application/vnd.ms-excel.sheet.binary.macroenabled.12",xlsm:"application/vnd.ms-excel.sheet.macroenabled.12",xltm:"application/vnd.ms-excel.template.macroenabled.12",eot:"application/vnd.ms-fontobject",chm:"application/vnd.ms-htmlhelp",ims:"application/vnd.ms-ims",lrm:"application/vnd.ms-lrm",thmx:"application/vnd.ms-officetheme",cat:"application/vnd.ms-pki.seccat",stl:"application/vnd.ms-pki.stl",ppt:"application/vnd.ms-powerpoint",pps:"application/vnd.ms-powerpoint",pot:"application/vnd.ms-powerpoint",ppam:"application/vnd.ms-powerpoint.addin.macroenabled.12",pptm:"application/vnd.ms-powerpoint.presentation.macroenabled.12",sldm:"application/vnd.ms-powerpoint.slide.macroenabled.12",ppsm:"application/vnd.ms-powerpoint.slideshow.macroenabled.12",potm:"application/vnd.ms-powerpoint.template.macroenabled.12",mpp:"application/vnd.ms-project",mpt:"application/vnd.ms-project",docm:"application/vnd.ms-word.document.macroenabled.12",dotm:"application/vnd.ms-word.template.macroenabled.12",wps:"application/vnd.ms-works",wks:"application/vnd.ms-works",wcm:"application/vnd.ms-works",wdb:"application/vnd.ms-works",wpl:"application/vnd.ms-wpl",xps:"application/vnd.ms-xpsdocument",mseq:"application/vnd.mseq",mus:"application/vnd.musician",msty:"application/vnd.muvee.style",taglet:"application/vnd.mynfc",nlu:"application/vnd.neurolanguage.nlu",ntf:"application/vnd.nitf",nitf:"application/vnd.nitf",nnd:"application/vnd.noblenet-directory",nns:"application/vnd.noblenet-sealer",nnw:"application/vnd.noblenet-web",ngdat:"application/vnd.nokia.n-gage.data","n-gage":"application/vnd.nokia.n-gage.symbian.install",rpst:"application/vnd.nokia.radio-preset",rpss:"application/vnd.nokia.radio-presets",edm:"application/vnd.novadigm.edm",edx:"application/vnd.novadigm.edx",ext:"application/vnd.novadigm.ext",odc:"application/vnd.oasis.opendocument.chart",otc:"application/vnd.oasis.opendocument.chart-template",odb:"application/vnd.oasis.opendocument.database",odf:"application/vnd.oasis.opendocument.formula",odft:"application/vnd.oasis.opendocument.formula-template",odg:"application/vnd.oasis.opendocument.graphics",otg:"application/vnd.oasis.opendocument.graphics-template",odi:"application/vnd.oasis.opendocument.image",oti:"application/vnd.oasis.opendocument.image-template",odp:"application/vnd.oasis.opendocument.presentation",otp:"application/vnd.oasis.opendocument.presentation-template",ods:"application/vnd.oasis.opendocument.spreadsheet",ots:"application/vnd.oasis.opendocument.spreadsheet-template",odt:"application/vnd.oasis.opendocument.text",odm:"application/vnd.oasis.opendocument.text-master",ott:"application/vnd.oasis.opendocument.text-template",oth:"application/vnd.oasis.opendocument.text-web",xo:"application/vnd.olpc-sugar",dd2:"application/vnd.oma.dd2+xml",oxt:"application/vnd.openofficeorg.extension",pptx:"application/vnd.openxmlformats-officedocument.presentationml.presentation",sldx:"application/vnd.openxmlformats-officedocument.presentationml.slide",ppsx:"application/vnd.openxmlformats-officedocument.presentationml.slideshow",potx:"application/vnd.openxmlformats-officedocument.presentationml.template",xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",xltx:"application/vnd.openxmlformats-officedocument.spreadsheetml.template",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",dotx:"application/vnd.openxmlformats-officedocument.wordprocessingml.template",mgp:"application/vnd.osgeo.mapguide.package",dp:"application/vnd.osgi.dp",esa:"application/vnd.osgi.subsystem",pdb:"application/x-pilot",pqa:"application/vnd.palm",oprc:"application/vnd.palm",paw:"application/vnd.pawaafile",str:"application/vnd.pg.format",ei6:"application/vnd.pg.osasli",efif:"application/vnd.picsel",wg:"application/vnd.pmi.widget",plf:"application/vnd.pocketlearn",pbd:"application/vnd.powerbuilder6",box:"application/vnd.previewsystems.box",mgz:"application/vnd.proteus.magazine",qps:"application/vnd.publishare-delta-tree",ptid:"application/vnd.pvi.ptid1",qxd:"application/vnd.quark.quarkxpress",qxt:"application/vnd.quark.quarkxpress",qwd:"application/vnd.quark.quarkxpress",qwt:"application/vnd.quark.quarkxpress",qxl:"application/vnd.quark.quarkxpress",qxb:"application/vnd.quark.quarkxpress",bed:"application/vnd.realvnc.bed",mxl:"application/vnd.recordare.musicxml",musicxml:"application/vnd.recordare.musicxml+xml",cryptonote:"application/vnd.rig.cryptonote",cod:"application/vnd.rim.cod",rm:"application/vnd.rn-realmedia",rmvb:"application/vnd.rn-realmedia-vbr",link66:"application/vnd.route66.link66+xml",st:"application/vnd.sailingtracker.track",see:"application/vnd.seemail",sema:"application/vnd.sema",semd:"application/vnd.semd",semf:"application/vnd.semf",ifm:"application/vnd.shana.informed.formdata",itp:"application/vnd.shana.informed.formtemplate",iif:"application/vnd.shana.informed.interchange",ipk:"application/vnd.shana.informed.package",twd:"application/vnd.simtech-mindmapper",twds:"application/vnd.simtech-mindmapper",mmf:"application/vnd.smaf",teacher:"application/vnd.smart.teacher",sdkm:"application/vnd.solent.sdkm+xml",sdkd:"application/vnd.solent.sdkm+xml",dxp:"application/vnd.spotfire.dxp",sfs:"application/vnd.spotfire.sfs",sdc:"application/vnd.stardivision.calc",sda:"application/vnd.stardivision.draw",sdd:"application/vnd.stardivision.impress",smf:"application/vnd.stardivision.math",sdw:"application/vnd.stardivision.writer",vor:"application/vnd.stardivision.writer",sgl:"application/vnd.stardivision.writer-global",smzip:"application/vnd.stepmania.package",sm:"application/vnd.stepmania.stepchart",sxc:"application/vnd.sun.xml.calc",stc:"application/vnd.sun.xml.calc.template",sxd:"application/vnd.sun.xml.draw",std:"application/vnd.sun.xml.draw.template",sxi:"application/vnd.sun.xml.impress",sti:"application/vnd.sun.xml.impress.template",sxm:"application/vnd.sun.xml.math",sxw:"application/vnd.sun.xml.writer",sxg:"application/vnd.sun.xml.writer.global",stw:"application/vnd.sun.xml.writer.template",sus:"application/vnd.sus-calendar",susp:"application/vnd.sus-calendar",svd:"application/vnd.svd",sis:"application/vnd.symbian.install",sisx:"application/vnd.symbian.install",xsm:"application/vnd.syncml+xml",bdm:"application/vnd.syncml.dm+wbxml",xdm:"application/vnd.syncml.dm+xml",tao:"application/vnd.tao.intent-module-archive",pcap:"application/vnd.tcpdump.pcap",cap:"application/vnd.tcpdump.pcap",dmp:"application/vnd.tcpdump.pcap",tmo:"application/vnd.tmobile-livetv",tpt:"application/vnd.trid.tpt",mxs:"application/vnd.triscape.mxs",tra:"application/vnd.trueapp",ufd:"application/vnd.ufdl",ufdl:"application/vnd.ufdl",utz:"application/vnd.uiq.theme",umj:"application/vnd.umajin",unityweb:"application/vnd.unity",uoml:"application/vnd.uoml+xml",vcx:"application/vnd.vcx",vsd:"application/vnd.visio",vst:"application/vnd.visio",vss:"application/vnd.visio",vsw:"application/vnd.visio",vis:"application/vnd.visionary",vsf:"application/vnd.vsf",wbxml:"application/vnd.wap.wbxml",wmlc:"application/vnd.wap.wmlc",wmlsc:"application/vnd.wap.wmlscriptc",wtb:"application/vnd.webturbo",nbp:"application/vnd.wolfram.player",wpd:"application/vnd.wordperfect",wqd:"application/vnd.wqd",stf:"application/vnd.wt.stf",xar:"application/vnd.xara",xfdl:"application/vnd.xfdl",hvd:"application/vnd.yamaha.hv-dic",hvs:"application/vnd.yamaha.hv-script",hvp:"application/vnd.yamaha.hv-voice",osf:"application/vnd.yamaha.openscoreformat",osfpvg:"application/vnd.yamaha.openscoreformat.osfpvg+xml",saf:"application/vnd.yamaha.smaf-audio",spf:"application/vnd.yamaha.smaf-phrase",cmp:"application/vnd.yellowriver-custom-menu",zir:"application/vnd.zul",zirz:"application/vnd.zul",zaz:"application/vnd.zzazz.deck+xml",vxml:"application/voicexml+xml",wgt:"application/widget",hlp:"application/winhlp",wsdl:"application/wsdl+xml",wspolicy:"application/wspolicy+xml","7z":"application/x-7z-compressed",abw:"application/x-abiword",ace:"application/x-ace-compressed",aab:"application/x-authorware-bin",x32:"application/x-authorware-bin",u32:"application/x-authorware-bin",vox:"application/x-authorware-bin",aam:"application/x-authorware-map",aas:"application/x-authorware-seg",bcpio:"application/x-bcpio",torrent:"application/x-bittorrent",blb:"application/x-blorb",blorb:"application/x-blorb",bz:"application/x-bzip",bz2:"application/x-bzip2",boz:"application/x-bzip2",cbr:"application/x-cbr",cba:"application/x-cbr",cbt:"application/x-cbr",cbz:"application/x-cbr",cb7:"application/x-cbr",vcd:"application/x-cdlink",cfs:"application/x-cfs-compressed",chat:"application/x-chat",pgn:"application/x-chess-pgn",crx:"application/x-chrome-extension",cco:"application/x-cocoa",nsc:"application/x-conference",cpio:"application/x-cpio",csh:"application/x-csh",udeb:"application/x-debian-package",dgc:"application/x-dgc-compressed",dir:"application/x-director",dcr:"application/x-director",dxr:"application/x-director",cst:"application/x-director",cct:"application/x-director",cxt:"application/x-director",w3d:"application/x-director",fgd:"application/x-director",swa:"application/x-director",wad:"application/x-doom",ncx:"application/x-dtbncx+xml",dtb:"application/x-dtbook+xml",res:"application/x-dtbresource+xml",dvi:"application/x-dvi",evy:"application/x-envoy",eva:"application/x-eva",bdf:"application/x-font-bdf",gsf:"application/x-font-ghostscript",psf:"application/x-font-linux-psf",otf:"font/opentype",pcf:"application/x-font-pcf",snf:"application/x-font-snf",ttf:"application/x-font-ttf",ttc:"application/x-font-ttf",pfa:"application/x-font-type1",pfb:"application/x-font-type1",pfm:"application/x-font-type1",afm:"application/x-font-type1",arc:"application/x-freearc",spl:"application/x-futuresplash",gca:"application/x-gca-compressed",ulx:"application/x-glulx",gnumeric:"application/x-gnumeric",gramps:"application/x-gramps-xml",gtar:"application/x-gtar",hdf:"application/x-hdf",php:"application/x-httpd-php",install:"application/x-install-instructions",jardiff:"application/x-java-archive-diff",jnlp:"application/x-java-jnlp-file",latex:"application/x-latex",luac:"application/x-lua-bytecode",lzh:"application/x-lzh-compressed",lha:"application/x-lzh-compressed",run:"application/x-makeself",mie:"application/x-mie",prc:"application/x-pilot",mobi:"application/x-mobipocket-ebook",application:"application/x-ms-application",lnk:"application/x-ms-shortcut",wmd:"application/x-ms-wmd",wmz:"application/x-msmetafile",xbap:"application/x-ms-xbap",mdb:"application/x-msaccess",obd:"application/x-msbinder",crd:"application/x-mscardfile",clp:"application/x-msclip",com:"application/x-msdownload",bat:"application/x-msdownload",mvb:"application/x-msmediaview",m13:"application/x-msmediaview",m14:"application/x-msmediaview",wmf:"application/x-msmetafile",emf:"application/x-msmetafile",emz:"application/x-msmetafile",mny:"application/x-msmoney",pub:"application/x-mspublisher",scd:"application/x-msschedule",trm:"application/x-msterminal",wri:"application/x-mswrite",nc:"application/x-netcdf",cdf:"application/x-netcdf",pac:"application/x-ns-proxy-autoconfig",nzb:"application/x-nzb",pl:"application/x-perl",pm:"application/x-perl",p12:"application/x-pkcs12",pfx:"application/x-pkcs12",p7b:"application/x-pkcs7-certificates",spc:"application/x-pkcs7-certificates",p7r:"application/x-pkcs7-certreqresp",rar:"application/x-rar-compressed",rpm:"application/x-redhat-package-manager",ris:"application/x-research-info-systems",sea:"application/x-sea",sh:"application/x-sh",shar:"application/x-shar",swf:"application/x-shockwave-flash",xap:"application/x-silverlight-app",sql:"application/x-sql",sit:"application/x-stuffit",sitx:"application/x-stuffitx",srt:"application/x-subrip",sv4cpio:"application/x-sv4cpio",sv4crc:"application/x-sv4crc",t3:"application/x-t3vm-image",gam:"application/x-tads",tar:"application/x-tar",tcl:"application/x-tcl",tk:"application/x-tcl",tex:"application/x-tex",tfm:"application/x-tex-tfm",texinfo:"application/x-texinfo",texi:"application/x-texinfo",obj:"application/x-tgif",ustar:"application/x-ustar",src:"application/x-wais-source",webapp:"application/x-web-app-manifest+json",der:"application/x-x509-ca-cert",crt:"application/x-x509-ca-cert",pem:"application/x-x509-ca-cert",fig:"application/x-xfig",xlf:"application/x-xliff+xml",xpi:"application/x-xpinstall",xz:"application/x-xz",z1:"application/x-zmachine",z2:"application/x-zmachine",z3:"application/x-zmachine",z4:"application/x-zmachine",z5:"application/x-zmachine",z6:"application/x-zmachine",z7:"application/x-zmachine",z8:"application/x-zmachine",xaml:"application/xaml+xml",xdf:"application/xcap-diff+xml",xenc:"application/xenc+xml",xhtml:"application/xhtml+xml",xht:"application/xhtml+xml",xml:"text/xml",xsl:"application/xml",xsd:"application/xml",rng:"application/xml",dtd:"application/xml-dtd",xop:"application/xop+xml",xpl:"application/xproc+xml",xslt:"application/xslt+xml",xspf:"application/xspf+xml",mxml:"application/xv+xml",xhvml:"application/xv+xml",xvml:"application/xv+xml",xvm:"application/xv+xml",yang:"application/yang",yin:"application/yin+xml",zip:"application/zip","3gpp":"video/3gpp",adp:"audio/adpcm",au:"audio/basic",snd:"audio/basic",mid:"audio/midi",midi:"audio/midi",kar:"audio/midi",rmi:"audio/midi",mp3:"audio/mpeg",m4a:"audio/x-m4a",mp4a:"audio/mp4",mpga:"audio/mpeg",mp2:"audio/mpeg",mp2a:"audio/mpeg",m2a:"audio/mpeg",m3a:"audio/mpeg",oga:"audio/ogg",ogg:"audio/ogg",spx:"audio/ogg",s3m:"audio/s3m",sil:"audio/silk",uva:"audio/vnd.dece.audio",uvva:"audio/vnd.dece.audio",eol:"audio/vnd.digital-winds",dra:"audio/vnd.dra",dts:"audio/vnd.dts",dtshd:"audio/vnd.dts.hd",lvp:"audio/vnd.lucent.voice",pya:"audio/vnd.ms-playready.media.pya",ecelp4800:"audio/vnd.nuera.ecelp4800",ecelp7470:"audio/vnd.nuera.ecelp7470",ecelp9600:"audio/vnd.nuera.ecelp9600",rip:"audio/vnd.rip",wav:"audio/x-wav",weba:"audio/webm",aac:"audio/x-aac",aif:"audio/x-aiff",aiff:"audio/x-aiff",aifc:"audio/x-aiff",caf:"audio/x-caf",flac:"audio/x-flac",mka:"audio/x-matroska",m3u:"audio/x-mpegurl",wax:"audio/x-ms-wax",wma:"audio/x-ms-wma",ram:"audio/x-pn-realaudio",ra:"audio/x-realaudio",rmp:"audio/x-pn-realaudio-plugin",xm:"audio/xm",cdx:"chemical/x-cdx",cif:"chemical/x-cif",cmdf:"chemical/x-cmdf",cml:"chemical/x-cml",csml:"chemical/x-csml",xyz:"chemical/x-xyz",bmp:"image/x-ms-bmp",cgm:"image/cgm",g3:"image/g3fax",gif:"image/gif",ief:"image/ief",jpeg:"image/jpeg",jpg:"image/jpeg",jpe:"image/jpeg",ktx:"image/ktx",png:"image/png",btif:"image/prs.btif",sgi:"image/sgi",svg:"image/svg+xml",svgz:"image/svg+xml",tiff:"image/tiff",tif:"image/tiff",psd:"image/vnd.adobe.photoshop",uvi:"image/vnd.dece.graphic",uvvi:"image/vnd.dece.graphic",uvg:"image/vnd.dece.graphic",uvvg:"image/vnd.dece.graphic",djvu:"image/vnd.djvu",djv:"image/vnd.djvu",sub:"text/vnd.dvb.subtitle",dwg:"image/vnd.dwg",dxf:"image/vnd.dxf",fbs:"image/vnd.fastbidsheet",fpx:"image/vnd.fpx",fst:"image/vnd.fst",mmr:"image/vnd.fujixerox.edmics-mmr",rlc:"image/vnd.fujixerox.edmics-rlc",mdi:"image/vnd.ms-modi",wdp:"image/vnd.ms-photo",npx:"image/vnd.net-fpx",wbmp:"image/vnd.wap.wbmp",xif:"image/vnd.xiff",webp:"image/webp","3ds":"image/x-3ds",ras:"image/x-cmu-raster",cmx:"image/x-cmx",fh:"image/x-freehand",fhc:"image/x-freehand",fh4:"image/x-freehand",fh5:"image/x-freehand",fh7:"image/x-freehand",ico:"image/x-icon",jng:"image/x-jng",sid:"image/x-mrsid-image",pcx:"image/x-pcx",pic:"image/x-pict",pct:"image/x-pict",pnm:"image/x-portable-anymap",pbm:"image/x-portable-bitmap",pgm:"image/x-portable-graymap",ppm:"image/x-portable-pixmap",rgb:"image/x-rgb",tga:"image/x-tga",xbm:"image/x-xbitmap",xpm:"image/x-xpixmap",xwd:"image/x-xwindowdump",eml:"message/rfc822",mime:"message/rfc822",igs:"model/iges",iges:"model/iges",msh:"model/mesh",mesh:"model/mesh",silo:"model/mesh",dae:"model/vnd.collada+xml",dwf:"model/vnd.dwf",gdl:"model/vnd.gdl",gtw:"model/vnd.gtw",mts:"model/vnd.mts",vtu:"model/vnd.vtu",wrl:"model/vrml",vrml:"model/vrml",x3db:"model/x3d+binary",x3dbz:"model/x3d+binary",x3dv:"model/x3d+vrml",x3dvz:"model/x3d+vrml",x3d:"model/x3d+xml",x3dz:"model/x3d+xml",appcache:"text/cache-manifest",manifest:"text/cache-manifest",ics:"text/calendar",ifb:"text/calendar",coffee:"text/coffeescript",litcoffee:"text/coffeescript",css:"text/css",csv:"text/csv",hjson:"text/hjson",html:"text/html",htm:"text/html",shtml:"text/html",jade:"text/jade",jsx:"text/jsx",less:"text/less",mml:"text/mathml",n3:"text/n3",txt:"text/plain",text:"text/plain",conf:"text/plain",def:"text/plain",list:"text/plain",log:"text/plain",in:"text/plain",ini:"text/plain",dsc:"text/prs.lines.tag",rtx:"text/richtext",sgml:"text/sgml",sgm:"text/sgml",slim:"text/slim",slm:"text/slim",stylus:"text/stylus",styl:"text/stylus",tsv:"text/tab-separated-values",t:"text/troff",tr:"text/troff",roff:"text/troff",man:"text/troff",me:"text/troff",ms:"text/troff",ttl:"text/turtle",uri:"text/uri-list",uris:"text/uri-list",urls:"text/uri-list",vcard:"text/vcard",curl:"text/vnd.curl",dcurl:"text/vnd.curl.dcurl",mcurl:"text/vnd.curl.mcurl",scurl:"text/vnd.curl.scurl",fly:"text/vnd.fly",flx:"text/vnd.fmi.flexstor",gv:"text/vnd.graphviz","3dml":"text/vnd.in3d.3dml",spot:"text/vnd.in3d.spot",jad:"text/vnd.sun.j2me.app-descriptor",wml:"text/vnd.wap.wml",wmls:"text/vnd.wap.wmlscript",vtt:"text/vtt",s:"text/x-asm",asm:"text/x-asm",c:"text/x-c",cc:"text/x-c",cxx:"text/x-c",cpp:"text/x-c",h:"text/x-c",hh:"text/x-c",dic:"text/x-c",htc:"text/x-component",f:"text/x-fortran",for:"text/x-fortran",f77:"text/x-fortran",f90:"text/x-fortran",hbs:"text/x-handlebars-template",java:"text/x-java-source",lua:"text/x-lua",markdown:"text/x-markdown",md:"text/x-markdown",mkd:"text/x-markdown",nfo:"text/x-nfo",opml:"text/x-opml",p:"text/x-pascal",pas:"text/x-pascal",pde:"text/x-processing",sass:"text/x-sass",scss:"text/x-scss",etx:"text/x-setext",sfv:"text/x-sfv",ymp:"text/x-suse-ymp",uu:"text/x-uuencode",vcs:"text/x-vcalendar",vcf:"text/x-vcard",yaml:"text/yaml",yml:"text/yaml","3gp":"video/3gpp","3g2":"video/3gpp2",h261:"video/h261",h263:"video/h263",h264:"video/h264",jpgv:"video/jpeg",jpm:"video/jpm",jpgm:"video/jpm",mj2:"video/mj2",mjp2:"video/mj2",ts:"video/mp2t",mp4:"video/mp4",mp4v:"video/mp4",mpg4:"video/mp4",mpeg:"video/mpeg",mpg:"video/mpeg",mpe:"video/mpeg",m1v:"video/mpeg",m2v:"video/mpeg",ogv:"video/ogg",qt:"video/quicktime",mov:"video/quicktime",uvh:"video/vnd.dece.hd",uvvh:"video/vnd.dece.hd",uvm:"video/vnd.dece.mobile",uvvm:"video/vnd.dece.mobile",uvp:"video/vnd.dece.pd",uvvp:"video/vnd.dece.pd",uvs:"video/vnd.dece.sd",uvvs:"video/vnd.dece.sd",uvv:"video/vnd.dece.video",uvvv:"video/vnd.dece.video",dvb:"video/vnd.dvb.file",fvt:"video/vnd.fvt",mxu:"video/vnd.mpegurl",m4u:"video/vnd.mpegurl",pyv:"video/vnd.ms-playready.media.pyv",uvu:"video/vnd.uvvu.mp4",uvvu:"video/vnd.uvvu.mp4",viv:"video/vnd.vivo",webm:"video/webm",f4v:"video/x-f4v",fli:"video/x-fli",flv:"video/x-flv",m4v:"video/x-m4v",mkv:"video/x-matroska",mk3d:"video/x-matroska",mks:"video/x-matroska",mng:"video/x-mng",asf:"video/x-ms-asf",asx:"video/x-ms-asf",vob:"video/x-ms-vob",wm:"video/x-ms-wm",wmv:"video/x-ms-wmv",wmx:"video/x-ms-wmx",wvx:"video/x-ms-wvx",avi:"video/x-msvideo",movie:"video/x-sgi-movie",smv:"video/x-smv",ice:"x-conference/x-cooltalk"}},function(e,t){e.exports=function(e){const t=new Uint8Array(e);if(!(t&&t.length>1))return null;if(255===t[0]&&216===t[1]&&255===t[2])return{ext:"jpg",mime:"image/jpeg"};if(137===t[0]&&80===t[1]&&78===t[2]&&71===t[3])return{ext:"png",mime:"image/png"};if(71===t[0]&&73===t[1]&&70===t[2])return{ext:"gif",mime:"image/gif"};if(87===t[8]&&69===t[9]&&66===t[10]&&80===t[11])return{ext:"webp",mime:"image/webp"};if(70===t[0]&&76===t[1]&&73===t[2]&&70===t[3])return{ext:"flif",mime:"image/flif"};if((73===t[0]&&73===t[1]&&42===t[2]&&0===t[3]||77===t[0]&&77===t[1]&&0===t[2]&&42===t[3])&&67===t[8]&&82===t[9])return{ext:"cr2",mime:"image/x-canon-cr2"};if(73===t[0]&&73===t[1]&&42===t[2]&&0===t[3]||77===t[0]&&77===t[1]&&0===t[2]&&42===t[3])return{ext:"tif",mime:"image/tiff"};if(66===t[0]&&77===t[1])return{ext:"bmp",mime:"image/bmp"};if(73===t[0]&&73===t[1]&&188===t[2])return{ext:"jxr",mime:"image/vnd.ms-photo"};if(56===t[0]&&66===t[1]&&80===t[2]&&83===t[3])return{ext:"psd",mime:"image/vnd.adobe.photoshop"};if(80===t[0]&&75===t[1]&&3===t[2]&&4===t[3]&&109===t[30]&&105===t[31]&&109===t[32]&&101===t[33]&&116===t[34]&&121===t[35]&&112===t[36]&&101===t[37]&&97===t[38]&&112===t[39]&&112===t[40]&&108===t[41]&&105===t[42]&&99===t[43]&&97===t[44]&&116===t[45]&&105===t[46]&&111===t[47]&&110===t[48]&&47===t[49]&&101===t[50]&&112===t[51]&&117===t[52]&&98===t[53]&&43===t[54]&&122===t[55]&&105===t[56]&&112===t[57])return{ext:"epub",mime:"application/epub+zip"};if(80===t[0]&&75===t[1]&&3===t[2]&&4===t[3]&&77===t[30]&&69===t[31]&&84===t[32]&&65===t[33]&&45===t[34]&&73===t[35]&&78===t[36]&&70===t[37]&&47===t[38]&&109===t[39]&&111===t[40]&&122===t[41]&&105===t[42]&&108===t[43]&&108===t[44]&&97===t[45]&&46===t[46]&&114===t[47]&&115===t[48]&&97===t[49])return{ext:"xpi",mime:"application/x-xpinstall"};if(!(80!==t[0]||75!==t[1]||3!==t[2]&&5!==t[2]&&7!==t[2]||4!==t[3]&&6!==t[3]&&8!==t[3]))return{ext:"zip",mime:"application/zip"};if(117===t[257]&&115===t[258]&&116===t[259]&&97===t[260]&&114===t[261])return{ext:"tar",mime:"application/x-tar"};if(82===t[0]&&97===t[1]&&114===t[2]&&33===t[3]&&26===t[4]&&7===t[5]&&(0===t[6]||1===t[6]))return{ext:"rar",mime:"application/x-rar-compressed"};if(31===t[0]&&139===t[1]&&8===t[2])return{ext:"gz",mime:"application/gzip"};if(66===t[0]&&90===t[1]&&104===t[2])return{ext:"bz2",mime:"application/x-bzip2"};if(55===t[0]&&122===t[1]&&188===t[2]&&175===t[3]&&39===t[4]&&28===t[5])return{ext:"7z",mime:"application/x-7z-compressed"};if(120===t[0]&&1===t[1])return{ext:"dmg",mime:"application/x-apple-diskimage"};if(0===t[0]&&0===t[1]&&0===t[2]&&(24===t[3]||32===t[3])&&102===t[4]&&116===t[5]&&121===t[6]&&112===t[7]||51===t[0]&&103===t[1]&&112===t[2]&&53===t[3]||0===t[0]&&0===t[1]&&0===t[2]&&28===t[3]&&102===t[4]&&116===t[5]&&121===t[6]&&112===t[7]&&109===t[8]&&112===t[9]&&52===t[10]&&50===t[11]&&109===t[16]&&112===t[17]&&52===t[18]&&49===t[19]&&109===t[20]&&112===t[21]&&52===t[22]&&50===t[23]&&105===t[24]&&115===t[25]&&111===t[26]&&109===t[27]||0===t[0]&&0===t[1]&&0===t[2]&&28===t[3]&&102===t[4]&&116===t[5]&&121===t[6]&&112===t[7]&&105===t[8]&&115===t[9]&&111===t[10]&&109===t[11]||0===t[0]&&0===t[1]&&0===t[2]&&28===t[3]&&102===t[4]&&116===t[5]&&121===t[6]&&112===t[7]&&109===t[8]&&112===t[9]&&52===t[10]&&50===t[11]&&0===t[12]&&0===t[13]&&0===t[14]&&0===t[15])return{ext:"mp4",mime:"video/mp4"};if(0===t[0]&&0===t[1]&&0===t[2]&&28===t[3]&&102===t[4]&&116===t[5]&&121===t[6]&&112===t[7]&&77===t[8]&&52===t[9]&&86===t[10])return{ext:"m4v",mime:"video/x-m4v"};if(77===t[0]&&84===t[1]&&104===t[2]&&100===t[3])return{ext:"mid",mime:"audio/midi"};if(26===t[0]&&69===t[1]&&223===t[2]&&163===t[3]){const e=t.subarray(4,4100),i=e.findIndex((e,t,i)=>66===i[t]&&130===i[t+1]);if(i>=0){const t=i+3,n=i=>Array.from(i).every((i,n)=>e[t+n]===i.charCodeAt(0));if(n("matroska"))return{ext:"mkv",mime:"video/x-matroska"};if(n("webm"))return{ext:"webm",mime:"video/webm"}}}return 0===t[0]&&0===t[1]&&0===t[2]&&20===t[3]&&102===t[4]&&116===t[5]&&121===t[6]&&112===t[7]?{ext:"mov",mime:"video/quicktime"}:82===t[0]&&73===t[1]&&70===t[2]&&70===t[3]&&65===t[8]&&86===t[9]&&73===t[10]?{ext:"avi",mime:"video/x-msvideo"}:48===t[0]&&38===t[1]&&178===t[2]&&117===t[3]&&142===t[4]&&102===t[5]&&207===t[6]&&17===t[7]&&166===t[8]&&217===t[9]?{ext:"wmv",mime:"video/x-ms-wmv"}:0===t[0]&&0===t[1]&&1===t[2]&&"b"===t[3].toString(16)[0]?{ext:"mpg",mime:"video/mpeg"}:73===t[0]&&68===t[1]&&51===t[2]||255===t[0]&&251===t[1]?{ext:"mp3",mime:"audio/mpeg"}:102===t[4]&&116===t[5]&&121===t[6]&&112===t[7]&&77===t[8]&&52===t[9]&&65===t[10]||77===t[0]&&52===t[1]&&65===t[2]&&32===t[3]?{ext:"m4a",mime:"audio/m4a"}:79===t[28]&&112===t[29]&&117===t[30]&&115===t[31]&&72===t[32]&&101===t[33]&&97===t[34]&&100===t[35]?{ext:"opus",mime:"audio/opus"}:79===t[0]&&103===t[1]&&103===t[2]&&83===t[3]?{ext:"ogg",mime:"audio/ogg"}:102===t[0]&&76===t[1]&&97===t[2]&&67===t[3]?{ext:"flac",mime:"audio/x-flac"}:82===t[0]&&73===t[1]&&70===t[2]&&70===t[3]&&87===t[8]&&65===t[9]&&86===t[10]&&69===t[11]?{ext:"wav",mime:"audio/x-wav"}:35===t[0]&&33===t[1]&&65===t[2]&&77===t[3]&&82===t[4]&&10===t[5]?{ext:"amr",mime:"audio/amr"}:37===t[0]&&80===t[1]&&68===t[2]&&70===t[3]?{ext:"pdf",mime:"application/pdf"}:77===t[0]&&90===t[1]?{ext:"exe",mime:"application/x-msdownload"}:67!==t[0]&&70!==t[0]||87!==t[1]||83!==t[2]?123===t[0]&&92===t[1]&&114===t[2]&&116===t[3]&&102===t[4]?{ext:"rtf",mime:"application/rtf"}:119===t[0]&&79===t[1]&&70===t[2]&&70===t[3]&&(0===t[4]&&1===t[5]&&0===t[6]&&0===t[7]||79===t[4]&&84===t[5]&&84===t[6]&&79===t[7])?{ext:"woff",mime:"application/font-woff"}:119===t[0]&&79===t[1]&&70===t[2]&&50===t[3]&&(0===t[4]&&1===t[5]&&0===t[6]&&0===t[7]||79===t[4]&&84===t[5]&&84===t[6]&&79===t[7])?{ext:"woff2",mime:"application/font-woff"}:76===t[34]&&80===t[35]&&(0===t[8]&&0===t[9]&&1===t[10]||1===t[8]&&0===t[9]&&2===t[10]||2===t[8]&&0===t[9]&&2===t[10])?{ext:"eot",mime:"application/octet-stream"}:0===t[0]&&1===t[1]&&0===t[2]&&0===t[3]&&0===t[4]?{ext:"ttf",mime:"application/font-sfnt"}:79===t[0]&&84===t[1]&&84===t[2]&&79===t[3]&&0===t[4]?{ext:"otf",mime:"application/font-sfnt"}:0===t[0]&&0===t[1]&&1===t[2]&&0===t[3]?{ext:"ico",mime:"image/x-icon"}:70===t[0]&&76===t[1]&&86===t[2]&&1===t[3]?{ext:"flv",mime:"video/x-flv"}:37===t[0]&&33===t[1]?{ext:"ps",mime:"application/postscript"}:253===t[0]&&55===t[1]&&122===t[2]&&88===t[3]&&90===t[4]&&0===t[5]?{ext:"xz",mime:"application/x-xz"}:83===t[0]&&81===t[1]&&76===t[2]&&105===t[3]?{ext:"sqlite",mime:"application/x-sqlite3"}:78===t[0]&&69===t[1]&&83===t[2]&&26===t[3]?{ext:"nes",mime:"application/x-nintendo-nes-rom"}:67===t[0]&&114===t[1]&&50===t[2]&&52===t[3]?{ext:"crx",mime:"application/x-google-chrome-extension"}:77===t[0]&&83===t[1]&&67===t[2]&&70===t[3]||73===t[0]&&83===t[1]&&99===t[2]&&40===t[3]?{ext:"cab",mime:"application/vnd.ms-cab-compressed"}:33===t[0]&&60===t[1]&&97===t[2]&&114===t[3]&&99===t[4]&&104===t[5]&&62===t[6]&&10===t[7]&&100===t[8]&&101===t[9]&&98===t[10]&&105===t[11]&&97===t[12]&&110===t[13]&&45===t[14]&&98===t[15]&&105===t[16]&&110===t[17]&&97===t[18]&&114===t[19]&&121===t[20]?{ext:"deb",mime:"application/x-deb"}:33===t[0]&&60===t[1]&&97===t[2]&&114===t[3]&&99===t[4]&&104===t[5]&&62===t[6]?{ext:"ar",mime:"application/x-unix-archive"}:237===t[0]&&171===t[1]&&238===t[2]&&219===t[3]?{ext:"rpm",mime:"application/x-rpm"}:31===t[0]&&160===t[1]||31===t[0]&&157===t[1]?{ext:"Z",mime:"application/x-compress"}:76===t[0]&&90===t[1]&&73===t[2]&&80===t[3]?{ext:"lz",mime:"application/x-lzip"}:208===t[0]&&207===t[1]&&17===t[2]&&224===t[3]&&161===t[4]&&177===t[5]&&26===t[6]&&225===t[7]?{ext:"msi",mime:"application/x-msi"}:6===t[0]&&14===t[1]&&43===t[2]&&52===t[3]&&2===t[4]&&5===t[5]&&1===t[6]&&1===t[7]&&13===t[8]&&1===t[9]&&2===t[10]&&1===t[11]&&1===t[12]&&2===t[13]?{ext:"mxf",mime:"application/mxf"}:null:{ext:"swf",mime:"application/x-shockwave-flash"}}},function(e,t,i){function n(e){try{return s.lstatSync(e).isDirectory()}catch(e){return!0}}const s=i(31),r=i(24),o=i(56),a=i(13),c=i(37);class ResponseStream extends c.Readable{constructor(){super(),this.statusCode=200,this.status="OK"}error(e,t){return this.statusCode=e,this.status=t,this}on(e,t){["end","open"].includes(e)&&t()}_read(){}}const l={GET:(e,t)=>{t.end=(()=>{const i=n(e)?(new ResponseStream).error(404,`ENOENT: no such file or directory, open '${e}'`):s.createReadStream(e);t.res=i,i.headers={"content-length":0,"content-type":o.lookup(r.extname(e))},i.on("open",()=>{t.emit("response",i)}),i instanceof ResponseStream||(i.statusCode=200,i.on("end",()=>{i.headers["content-length"]=i.bytesRead}),i.on("error",e=>{i.statusCode=400,i.status=e.message}))})},POST:(e,t)=>{const i=[];t.write=(e=>{i.push(e)}),t.end=(n=>{i.push(n);const a=s.createWriteStream(e),c=new ResponseStream;t.res=c,c.headers={"content-length":0,"content-type":o.lookup(r.extname(e))},a.on("finish",()=>{t.emit("response",c)}),a.on("open",()=>{!function e(){const t=i.shift();t&&(a.write(t)?e():a.once("drain",e))}(),a.end()})})},DELETE:(e,t)=>{t.end=(()=>{const i=new ResponseStream;t.res=i,i.headers={"content-length":0,"content-type":o.lookup(r.extname(e))},s.unlink(e,e=>{t.emit("response",e?i.error(400,e.message):i)})})}};class Req extends a{constructor(){super(),this._headers={}}setHeader(){}}e.exports={request:function(e){const t=l[e.method];if(!t)throw new Error(`Invalid request method "${t}"`);const i=e.href.replace("file://",""),n=new Req;return t(i,n,e),n}}},function(e,t,i){"use strict";(function(t){function n(e,t){if(e===t)return 0;for(var i=e.length,n=t.length,s=0,r=Math.min(i,n);s=0;a--)if(c[a]!==l[a])return!1;for(a=c.length-1;a>=0;a--)if(o=c[a],!d(e[o],t[o],i,n))return!1;return!0}function g(e,t,i){d(e,t,!0)&&u(e,t,i,"notDeepStrictEqual",g)}function v(e,t){if(!e||!t)return!1;if("[object RegExp]"==Object.prototype.toString.call(t))return t.test(e);try{if(e instanceof t)return!0}catch(e){}return!Error.isPrototypeOf(t)&&!0===t.call({},e)}function E(e){var t;try{e()}catch(e){t=e}return t}function _(e,t,i,n){var s;if("function"!=typeof t)throw new TypeError('"block" argument must be a function');"string"==typeof i&&(n=i,i=null),s=E(t),n=(i&&i.name?" ("+i.name+").":".")+(n?" "+n:"."),e&&!s&&u(s,i,"Missing expected exception"+n);var r="string"==typeof n,o=!e&&y.isError(s),a=!e&&s&&!i;if((o&&r&&v(s,i)||a)&&u(s,i,"Got unwanted exception"+n),e&&s&&i&&!v(s,i)||!e&&s)throw s}var y=i(40),b=Object.prototype.hasOwnProperty,w=Array.prototype.slice,x="foo"===function(){}.name,A=e.exports=p,S=/\s*function\s+([^\(\s]*)\s*/;A.AssertionError=function(e){this.name="AssertionError",this.actual=e.actual,this.expected=e.expected,this.operator=e.operator,e.message?(this.message=e.message,this.generatedMessage=!1):(this.message=h(this),this.generatedMessage=!0);var t=e.stackStartFunction||u;if(Error.captureStackTrace)Error.captureStackTrace(this,t);else{var i=new Error;if(i.stack){var n=i.stack,s=a(t),r=n.indexOf("\n"+s);if(r>=0){var o=n.indexOf("\n",r+1);n=n.substring(o+1)}this.stack=n}}},y.inherits(A.AssertionError,Error),A.fail=u,A.ok=p,A.equal=function(e,t,i){e!=t&&u(e,t,i,"==",A.equal)},A.notEqual=function(e,t,i){e==t&&u(e,t,i,"!=",A.notEqual)},A.deepEqual=function(e,t,i){d(e,t,!1)||u(e,t,i,"deepEqual",A.deepEqual)},A.deepStrictEqual=function(e,t,i){d(e,t,!0)||u(e,t,i,"deepStrictEqual",A.deepStrictEqual)},A.notDeepEqual=function(e,t,i){d(e,t,!1)&&u(e,t,i,"notDeepEqual",A.notDeepEqual)},A.notDeepStrictEqual=g,A.strictEqual=function(e,t,i){e!==t&&u(e,t,i,"===",A.strictEqual)},A.notStrictEqual=function(e,t,i){e===t&&u(e,t,i,"!==",A.notStrictEqual)},A.throws=function(e,t,i){_(!0,e,t,i)},A.doesNotThrow=function(e,t,i){_(!1,e,t,i)},A.ifError=function(e){if(e)throw e};var T=Object.keys||function(e){var t=[];for(var i in e)b.call(e,i)&&t.push(i);return t}}).call(t,i(6))},function(e,t){e.exports=function(e){return e&&"object"==typeof e&&"function"==typeof e.copy&&"function"==typeof e.fill&&"function"==typeof e.readUInt8}},function(e,t){"function"==typeof Object.create?e.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(e,t){e.super_=t;var i=function(){};i.prototype=t.prototype,e.prototype=new i,e.prototype.constructor=e}},function(e,t,i){const{register:n}=i(58),s={CLIENT_INVALID_OPTION:(e,t)=>`The ${e} option must be ${t}`,TOKEN_INVALID:"An invalid token was provided.",TOKEN_MISSING:"Request to use token, but token was unavailable to the client.",FEATURE_USER_ONLY:"Only user accounts are able to make use of this feature.",WS_CONNECTION_EXISTS:"There is already an existing WebSocket connection.",WS_NOT_OPEN:(e="data")=>`Websocket not open to send ${e}`,PERMISSION_INVALID:"Invalid permission string or number.",RATELIMIT_INVALID_METHOD:"Unknown rate limiting method.",SHARDING_INVALID:"Invalid shard settings were provided.",SHARDING_REQUIRED:"This session would have handled too many guilds - Sharding is required.",SHARDING_CHILD_CONNECTION:"Failed to send message to shard's process.",SHARDING_PARENT_CONNECTION:"Failed to send message to master process.",SHARDING_NO_SHARDS:"No shards have been spawned",SHARDING_IN_PROCESS:"Shards are still being spawned",SHARDING_ALREADY_SPAWNED:e=>`Already spawned ${e} shards`,COLOR_RANGE:"Color must be within the range 0 - 16777215 (0xFFFFFF).",COLOR_CONVERT:"Unable to convert color to a number.",EMBED_FIELD_COUNT:"MessageEmbeds may not exceed 25 fields.",EMBED_FIELD_NAME:"MessageEmbed field names may not exceed 256 characters or be empty.",EMBED_FIELD_VALUE:"MessageEmbed field values may not exceed 1024 characters or be empty.",EMBED_DESCRIPTION:"MessageEmbed descriptions may not exceed 2048 characters.",EMBED_FOOTER_TEXT:"MessageEmbed footer text may not exceed 2048 characters.",EMBED_TITLE:"MessageEmbed titles may not exceed 256 characters.",FILE_NOT_FOUND:e=>`File could not be found: ${e}`,USER_NO_DMCHANNEL:"No DM Channel exists!",VOICE_INVALID_HEARTBEAT:"Tried to set voice heartbeat but no valid interval was specified.",VOICE_USER_MISSING:"Couldn't resolve the user to create stream.",VOICE_STREAM_EXISTS:"There is already an existing stream for that user.",VOICE_JOIN_CHANNEL:(e=!1)=>`You do not have permission to join this voice channel${e?"; it is full.":"."}`,VOICE_CONNECTION_TIMEOUT:"Connection not established within 15 seconds.",VOICE_TOKEN_ABSENT:"Token not provided from voice server packet.",VOICE_SESSION_ABSENT:"Session ID not supplied.",VOICE_INVALID_ENDPOINT:"Invalid endpoint received.",VOICE_NO_BROWSER:"Voice connections are not available in browsers.",VOICE_CONNECTION_ATTEMPTS_EXCEEDED:e=>`Too many connection attempts (${e}).`,VOICE_JOIN_SOCKET_CLOSED:"Tried to send join packet, but the WebSocket is not open.",OPUS_ENGINE_MISSING:"Couldn't find an Opus engine.",UDP_SEND_FAIL:"Tried to send a UDP packet, but there is no socket available.",UDP_ADDRESS_MALFORMED:"Malformed UDP address or port.",UDP_CONNECTION_EXISTS:"There is already an existing UDP connection.",REQ_BODY_TYPE:"The response body isn't a Buffer.",REQ_RESOURCE_TYPE:"The resource must be a string, Buffer or a valid file stream.",IMAGE_FORMAT:e=>`Invalid image format: ${e}`,IMAGE_SIZE:e=>`Invalid image size: ${e}`,MESSAGE_MISSING:"Message not found",MESSAGE_BULK_DELETE_TYPE:"The messages must be an Array, Collection, or number.",MESSAGE_NONCE_TYPE:"Message nonce must fit in an unsigned 64-bit integer.",TYPING_COUNT:"Count must be at least 1",SPLIT_MAX_LEN:"Message exceeds the max length and contains no split characters.",BAN_RESOLVE_ID:(e=!1)=>`Couldn't resolve the user ID to ${e?"ban":"unban"}.`,PRUNE_DAYS_TYPE:"Days must be a number",SEARCH_CHANNEL_TYPE:"Target must be a TextChannel, DMChannel, GroupDMChannel, or Guild.",MESSAGE_SPLIT_MISSING:"Message exceeds the max length and contains no split characters.",GUILD_CHANNEL_RESOLVE:"Could not resolve channel to a guild channel.",GUILD_OWNED:"Guild is owned by the client.",GUILD_RESTRICTED:(e=!1)=>`Guild is ${e?"already":"not"} restricted.`,GUILD_MEMBERS_TIMEOUT:"Members didn't arrive in time.",INVALID_TYPE:(e,t,i=!1)=>`Supplied ${e} is not a${i?"n":""} ${t}.`,WEBHOOK_MESSAGE:"The message was not sent by a webhook.",EMOJI_TYPE:"Emoji must be a string or Emoji/ReactionEmoji",REACTION_RESOLVE_USER:"Couldn't resolve the user ID to remove from the reaction."};for(const[e,t]of Object.entries(s))n(e,t)},function(e,t){t.endianness=function(){return"LE"},t.hostname=function(){return"undefined"!=typeof location?location.hostname:""},t.loadavg=function(){return[]},t.uptime=function(){return 0},t.freemem=function(){return Number.MAX_VALUE},t.totalmem=function(){return Number.MAX_VALUE},t.cpus=function(){return[]},t.type=function(){return"Browser"},t.release=function(){return"undefined"!=typeof navigator?navigator.appVersion:""},t.networkInterfaces=t.getNetworkInterfaces=function(){return{}},t.arch=function(){return"javascript"},t.platform=function(){return"browser"},t.tmpdir=t.tmpDir=function(){return"/tmp"},t.EOL="\n"},function(e,t,i){(function(t){const n=i(0);class UserAgentManager{constructor(){this.build(this.constructor.DEFAULT)}set({url:e,version:t}={}){this.build({url:e||this.constructor.DFEAULT.url,version:t||this.constructor.DEFAULT.version})}build(e){this.userAgent=`DiscordBot (${e.url}, ${e.version}) Node.js/${t.version}`}}UserAgentManager.DEFAULT={url:n.Package.homepage.split("#")[0],version:n.Package.version},e.exports=UserAgentManager}).call(t,i(8))},function(e,t,i){e.exports={sequential:i(116),burst:i(117),RequestHandler:i(118)}},function(e,t){e.exports=function(){this.busy||this.limited||0===this.queue.length||(this.busy=!0,this.execute(this.queue.shift()).then(()=>{this.busy=!1,this.handle()}).catch(({timeout:e})=>{this.client.setTimeout(()=>{this.reset(),this.busy=!1,this.handle()},e||this.resetTime-Date.now()+this.timeDifference+this.client.options.restTimeOffset)}))}},function(e,t){e.exports=function(){this.limited||0===this.queue.length||(this.execute(this.queue.shift()).then(this.handle.bind(this)).catch(({timeout:e})=>{this.client.setTimeout(()=>{this.reset(),this.handle()},e||this.resetTime-Date.now()+this.timeDifference+this.client.options.restTimeOffset)}),this.remaining--,this.handle())}},function(e,t,i){const n=i(60);class RequestHandler{constructor(e,t){this.manager=e,this.client=this.manager.client,this.handle=t.bind(this),this.limit=1/0,this.resetTime=null,this.remaining=1,this.timeDifference=0,this.queue=[]}get limited(){return this.manager.globallyRateLimited||this.remaining<=0}set globallyLimited(e){this.manager.globallyRateLimited=e}push(e){this.queue.push(e),this.handle()}execute(e){return new Promise((t,i)=>{const s=e=>{e||this.limited?i({timeout:e,limited:this.limited}):t()};e.request.gen().end((t,i)=>{if(i&&i.headers&&(i.headers["x-ratelimit-global"]&&(this.globallyLimited=!0),this.limit=Number(i.headers["x-ratelimit-limit"]),this.resetTime=1e3*Number(i.headers["x-ratelimit-reset"]),this.remaining=Number(i.headers["x-ratelimit-remaining"]),this.timeDifference=Date.now()-new Date(i.headers.date).getTime()),t)429===t.status?(this.queue.unshift(e),s(Number(i.headers["retry-after"])+this.client.options.restTimeOffset)):t.status>=500&&t.status<600?(this.queue.unshift(e),s(1e3+this.client.options.restTimeOffset)):(e.reject(t.status>=400&&t.status<500?new n(i.request.path,i.body):t),s());else{const t=i&&i.body?i.body:{};e.resolve(t),s()}})})}reset(){this.globallyLimited=!1,this.remaining=1}}e.exports=RequestHandler},function(e,t,i){const n=i(32),s=i(36);class APIRequest{constructor(e,t,i,n){this.rest=e,this.client=e.client,this.method=t,this.path=i.toString(),this.route=n.route,this.options=n}gen(){const e=!1===this.options.versioned?this.client.options.http.api:`${this.client.options.http.api}/v${this.client.options.http.version}`;if(this.options.query){const e=(n.stringify(this.options.query).match(/[^=&?]+=[^=&?]+/g)||[]).join("&");this.path+=`?${e}`}const t=s[this.method](`${e}${this.path}`);if(!1!==this.options.auth&&t.set("Authorization",this.rest.getAuth()),this.options.reason&&t.set("X-Audit-Log-Reason",encodeURIComponent(this.options.reason)),this.rest.client.browser||t.set("User-Agent",this.rest.userAgentManager.userAgent),this.options.headers&&t.set(this.options.headers),this.options.files){for(const e of this.options.files)e&&e.file&&t.attach(e.name,e.file,e.name);void 0!==this.options.data&&t.attach("payload_json",JSON.stringify(this.options.data))}else void 0!==this.options.data&&t.send(this.options.data);return t}}e.exports=APIRequest},function(e,t,i){const n=i(40),s=()=>{},r=["get","post","delete","patch","put"],o=["toString","valueOf","inspect","constructor",Symbol.toPrimitive,n.inspect.custom];e.exports=function(e){const t=[""],i={get:(n,a)=>o.includes(a)?()=>t.join("/"):r.includes(a)?i=>e.request(a,t.join("/"),Object.assign({versioned:e.versioned,route:t.map((e,i)=>/\d{16,19}/g.test(e)?/channels|guilds/.test(t[i-1])?e:":id":e).join("/")},i)):(t.push(a),new Proxy(s,i)),apply:(e,n,r)=>(t.push(...r.filter(e=>null!=e)),new Proxy(s,i))};return new Proxy(s,i)}},function(e,t,i){(function(t){const n=i(24),s=i(31),r=i(36),o=i(7),a=i(25),c=i(44),l=i(29),h=i(15),u=i(17),p=i(18),d=i(34),f=i(46),{Error:m,TypeError:g}=i(4);class ClientDataResolver{constructor(e){this.client=e}resolveUser(e){return e instanceof a?e:"string"==typeof e?this.client.users.get(e)||null:e instanceof u?e.user:e instanceof c?e.author:null}resolveUserID(e){return e instanceof a||e instanceof u?e.id:"string"==typeof e?e||null:e instanceof c?e.author.id:null}resolveGuild(e){return e instanceof l?e:"string"==typeof e?this.client.guilds.get(e)||null:null}resolveGuildMember(e,t){return t instanceof u?t:(e=this.resolveGuild(e),t=this.resolveUser(t),e&&t?e.members.get(t.id)||null:null)}resolveRole(e,t){return t instanceof p?t:(e=this.resolveGuild(e))&&"string"==typeof t?e.roles.get(t):null}resolveChannel(e){return e instanceof h?e:"string"==typeof e?this.client.channels.get(e)||null:null}resolveChannelID(e){return e instanceof h?e.id:"string"==typeof e?e:null}resolveInviteCode(e){const t=/discord(?:app\.com\/invite|\.gg)\/([\w-]{2,255})/i.exec(e);return t&&t[1]?t[1]:e}async resolveImage(e){if(!e)return null;if("string"==typeof e&&e.startsWith("data:"))return e;const t=await this.resolveFile(e);return this.resolveBase64(t)}resolveBase64(e){return e instanceof t?`data:image/jpg;base64,${e.toString("base64")}`:e}resolveFile(e){return e instanceof t?Promise.resolve(e):this.client.browser&&e instanceof ArrayBuffer?Promise.resolve(o.convertToBuffer(e)):"string"==typeof e?new Promise((i,o)=>{if(/^https?:\/\//.test(e))r.get(e).end((e,n)=>e?o(e):n.body instanceof t?i(n.body):o(new g("REQ_BODY_TYPE")));else{const t=n.resolve(e);s.stat(t,(e,n)=>e?o(e):n&&n.isFile()?(s.readFile(t,(e,t)=>{e?o(e):i(t)}),null):o(new m("FILE_NOT_FOUND",t)))}}):e.pipe&&"function"==typeof e.pipe?new Promise((i,n)=>{const s=[];e.once("error",n),e.on("data",e=>s.push(e)),e.once("end",()=>i(t.concat(s)))}):Promise.reject(new g("REQ_RESOURCE_TYPE"))}resolveEmojiIdentifier(e){return e instanceof d||e instanceof f?e.identifier:"string"==typeof e?this.client.emojis.has(e)?this.client.emojis.get(e).identifier:e.includes("%")?e:encodeURIComponent(e):null}}e.exports=ClientDataResolver}).call(t,i(5).Buffer)},function(e,t,i){const n=i(43),{TypeError:s}=i(4);e.exports=function(e,t){if("string"==typeof t&&(t={content:t}),t.before&&(t.before instanceof Date||(t.before=new Date(t.before)),t.maxID=n.fromNumber(t.before.getTime()-14200704e5).shiftLeft(22).toString()),t.after&&(t.after instanceof Date||(t.after=new Date(t.after)),t.minID=n.fromNumber(t.after.getTime()-14200704e5).shiftLeft(22).toString()),t.during){t.during instanceof Date||(t.during=new Date(t.during));const e=t.during.getTime()-14200704e5;t.minID=n.fromNumber(e).shiftLeft(22).toString(),t.maxID=n.fromNumber(e+864e5).shiftLeft(22).toString()}t.channel&&(t.channel=e.client.resolver.resolveChannelID(t.channel)),t.author&&(t.author=e.client.resolver.resolveUserID(t.author)),t.mentions&&(t.mentions=e.client.resolver.resolveUserID(t.options.mentions)),t.sortOrder&&(t.sortOrder={ascending:"asc",descending:"desc"}[t.sortOrder]||t.sortOrder),t={content:t.content,max_id:t.maxID,min_id:t.minID,has:t.has,channel_id:t.channel,author_id:t.author,author_type:t.authorType,context_size:t.contextSize,sort_by:t.sortBy,sort_order:t.sortOrder,limit:t.limit,offset:t.offset,mentions:t.mentions,mentions_everyone:t.mentionsEveryone,link_hostname:t.linkHostname,embed_provider:t.embedProvider,embed_type:t.embedType,attachment_filename:t.attachmentFilename,attachment_extension:t.attachmentExtension,include_nsfw:t.nsfw};const r=i(15),o=i(29);if(!(e instanceof r||e instanceof o))throw new s("SEARCH_CHANNEL_TYPE");return e.client.api[e instanceof r?"channels":"guilds"](e.id).messages().search.get({query:t}).then(t=>{const i=t.messages.map(t=>t.map(t=>e.client.channels.get(t.channel_id).messages.create(t,!1)));return{total:t.total_results,results:i}})}},function(e,t,i){const n=i(11),s=i(66);class ReactionStore extends n{constructor(e,t){super(e.client,t),this.message=e}create(e){const t=e.emoji.id||decodeURIComponent(e.emoji.name),i=this.get(t);if(i)return i;const n=new s(this.message,e.emoji,e.count,e.me);return this.set(t,n),n}}e.exports=ReactionStore},function(e,t,i){const n=i(11),s=i(17),r=i(0),o=i(3),{Error:a}=i(4);class GuildMemberStore extends n{constructor(e,t){super(e.client,t),this.guild=e}create(e,t=!0){const i=this.get(e.user.id);if(i)return i;const n=new s(this.guild,e);return t&&this.set(n.id,n),n}fetch(e){if(!e)return this._fetchMany();const t=this.client.resolver.resolveUserID(e);return t?this._fetchSingle({user:t,cache:!0}):e.user&&(e.user=this.client.resolver.resolveUserID(e.user),e.user)?this._fetchSingle(e):this._fetchMany(e)}_fetchSingle({user:e,cache:t}){return this.has(e)?Promise.resolve(this.get(e)):this.client.api.guilds(this.guild.id).members(e).get().then(e=>this.create(e,t))}_fetchMany({query:e="",limit:t=0}={}){return new Promise((i,n)=>{if(this.guild.memberCount===this.size)return void i(e||t?new o:this);this.guild.client.ws.send({op:r.OPCodes.REQUEST_GUILD_MEMBERS,d:{guild_id:this.guild.id,query:e,limit:t}});const s=new o,c=(n,o)=>{if(o.id===this.guild.id){for(const i of n.values())(e||t)&&s.set(i.id,i);(this.guild.memberCount<=this.size||(e||t)&&n.size<1e3||t&&s.size>=t)&&(this.guild.client.removeListener(r.Events.GUILD_MEMBERS_CHUNK,c),i(e||t?s:this))}};this.guild.client.on(r.Events.GUILD_MEMBERS_CHUNK,c),this.guild.client.setTimeout(()=>{this.guild.client.removeListener(r.Events.GUILD_MEMBERS_CHUNK,c),n(new a("GUILD_MEMBERS_TIMEOUT"))},12e4)})}}e.exports=GuildMemberStore},function(e,t,i){const n=i(11),s=i(18);class RoleStore extends n{constructor(e,t){super(e.client,t),this.guild=e}create(e){const t=this.get(e.id);if(t)return t;const i=new s(this.guild,e);return this.set(i.id,i),i}}e.exports=RoleStore},function(e,t,i){const n=i(11),s=i(34);class EmojiStore extends n{constructor(e,t){super(e.client,t),this.guild=e}create(e){const t=this.guild,i=t.emojis.get(e.id);if(i)return i;const n=new s(t,e);return t.emojis.set(n.id,n),n}}e.exports=EmojiStore},function(e,t,i){const n=i(11),s=i(15);class GuildChannelStore extends n{constructor(e,t){super(e.client,t),this.guild=e}create(e){const t=this.get(e.id);return t||s.create(this.client,e,this.guild)}}e.exports=GuildChannelStore},function(e,t,i){const n=i(7),s=i(20),{RangeError:r}=i(4);e.exports=function(e,t){const o=i(25),a=i(17);if(e instanceof o||e instanceof a)return e.createDM().then(e=>e.send(t));let{content:c,nonce:l,reply:h,code:u,disableEveryone:p,tts:d,embed:f,files:m,split:g}=t;if(f&&(f=new s(f)._apiTransform()),void 0!==l&&(l=parseInt(l),isNaN(l)||l<0))throw new r("MESSAGE_NONCE_TYPE");if(h&&!(e instanceof o||e instanceof a)&&"dm"!==e.type){const t=e.client.resolver.resolveUserID(h),i=`<@${h instanceof a&&h.nickname?"!":""}${t}>`;g&&(g.prepend=`${i}, ${g.prepend||""}`),c=`${i}${void 0!==c?`, ${c}`:""}`}return c&&(c=n.resolveString(c),g&&"object"!=typeof g&&(g={}),void 0===u||"boolean"==typeof u&&!0!==u||(c=n.escapeMarkdown(c,!0),c=`\`\`\`${"boolean"!=typeof u?u||"":""}\n${c}\n\`\`\``,g&&(g.prepend=`\`\`\`${"boolean"!=typeof u?u||"":""}\n`,g.append="\n```")),(p||void 0===p&&e.client.options.disableEveryone)&&(c=c.replace(/@(everyone|here)/g,"@​$1")),g&&(c=n.splitMessage(c,g))),c instanceof Array?new Promise((t,i)=>{const n=[];!function s(){const r=c.length?{tts:d}:{tts:d,embed:f,files:m};e.send(c.shift(),r).then(e=>(n.push(e),0===c.length?t(n):s())).catch(i)}()}):e.client.api.channels[e.id].messages.post({data:{content:c,tts:d,nonce:l,embed:f},files:m}).then(t=>e.client.actions.MessageCreate.handle(t).message)}},function(e,t,i){const n=i(3),{UserFlags:s}=i(0),r=i(130),o=i(10);class UserProfile extends o{constructor(e,t){super(e.client),this.user=e,this.mutualGuilds=new n,this.connections=new n,this._patch(t)}_patch(e){this.premium=Boolean(e.premium_since),this._flags=e.user.flags,this.premiumSince=e.premium_since?new Date(e.premium_since):null;for(const t of e.mutual_guilds)this.client.guilds.has(t.id)&&this.mutualGuilds.set(t.id,this.client.guilds.get(t.id));for(const t of e.connected_accounts)this.connections.set(t.id,new r(this.user,t))}get flags(){const e=[];for(const[t,i]of Object.entries(s))(this._flags&i)===i&&e.push(t);return e}}e.exports=UserProfile},function(e,t){class UserConnection{constructor(e,t){this.user=e,this._patch(t)}_patch(e){this.type=e.type,this.name=e.name,this.id=e.id,this.revoked=e.revoked,this.integrations=e.integrations}}e.exports=UserConnection},function(module,exports,__webpack_require__){(function(process){const BaseClient=__webpack_require__(41),Permissions=__webpack_require__(12),RESTManager=__webpack_require__(59),ClientManager=__webpack_require__(132),ClientVoiceManager=__webpack_require__(133),WebSocketManager=__webpack_require__(134),ActionsManager=__webpack_require__(178),Collection=__webpack_require__(3),VoiceRegion=__webpack_require__(72),Webhook=__webpack_require__(21),Invite=__webpack_require__(35),ClientApplication=__webpack_require__(45),ShardClientUtil=__webpack_require__(207),VoiceBroadcast=__webpack_require__(208),UserStore=__webpack_require__(209),ChannelStore=__webpack_require__(210),GuildStore=__webpack_require__(211),ClientPresenceStore=__webpack_require__(212),Constants=__webpack_require__(0),{Error:Error,TypeError:TypeError,RangeError:RangeError}=__webpack_require__(4);class Client extends BaseClient{constructor(e={}){super(Object.assign({_tokenType:"Bot"},e)),!this.options.shardId&&"SHARD_ID"in Object({__DISCORD_WEBPACK__:"true"})&&(this.options.shardId=Number(Object({__DISCORD_WEBPACK__:"true"}).SHARD_ID)),!this.options.shardCount&&"SHARD_COUNT"in Object({__DISCORD_WEBPACK__:"true"})&&(this.options.shardCount=Number(Object({__DISCORD_WEBPACK__:"true"}).SHARD_COUNT)),this._validateOptions(),this.rest=new RESTManager(this),this.manager=new ClientManager(this),this.ws=new WebSocketManager(this),this.actions=new ActionsManager(this),this.voice=this.browser?null:new ClientVoiceManager(this),this.shard=process.send?ShardClientUtil.singleton(this):null,this.users=new UserStore(this),this.guilds=new GuildStore(this),this.channels=new ChannelStore(this),this.presences=new ClientPresenceStore(this),Object.defineProperty(this,"token",{writable:!0}),!this.token&&"CLIENT_TOKEN"in Object({__DISCORD_WEBPACK__:"true"})?this.token=Object({__DISCORD_WEBPACK__:"true"}).CLIENT_TOKEN:this.token=null,this.user=null,this.readyAt=null,this.broadcasts=[],this.pings=[],this._timeouts=new Set,this._intervals=new Set,this.options.messageSweepInterval>0&&this.setInterval(this.sweepMessages.bind(this),1e3*this.options.messageSweepInterval)}get _pingTimestamp(){return this.ws.connection?this.ws.connection.lastPingTimestamp:0}get status(){return this.ws.connection?this.ws.connection.status:null}get uptime(){return this.readyAt?Date.now()-this.readyAt:null}get ping(){return this.pings.reduce((e,t)=>e+t,0)/this.pings.length}get voiceConnections(){return this.browser?new Collection:this.voice.connections}get emojis(){const e=new Collection;for(const t of this.guilds.values())if(t.available)for(const i of t.emojis.values())e.set(i.id,i);return e}get readyTimestamp(){return this.readyAt?this.readyAt.getTime():null}createVoiceBroadcast(){const e=new VoiceBroadcast(this);return this.broadcasts.push(e),e}login(e){return new Promise((t,i)=>{if("string"!=typeof e)throw new Error("TOKEN_INVALID");e=e.replace(/^Bot\s*/i,""),this.manager.connectToWebSocket(e,t,i)}).catch(e=>(this.destroy(),Promise.reject(e)))}destroy(){return super.destroy(),this.manager.destroy()}syncGuilds(e=this.guilds){this.user.bot||this.ws.send({op:12,d:e instanceof Collection?e.keyArray():e.map(e=>e.id)})}fetchInvite(e){const t=this.resolver.resolveInviteCode(e);return this.api.invites(t).get({query:{with_counts:!0}}).then(e=>new Invite(this,e))}fetchWebhook(e,t){return this.api.webhooks(e,t).get().then(e=>new Webhook(this,e))}fetchVoiceRegions(){return this.api.voice.regions.get().then(e=>{const t=new Collection;for(const i of e)t.set(i.id,new VoiceRegion(i));return t})}sweepMessages(e=this.options.messageCacheLifetime){if("number"!=typeof e||isNaN(e))throw new TypeError("CLIENT_INVALID_OPTION","Lifetime","a number");if(e<=0)return this.emit(Constants.Events.DEBUG,"Didn't sweep messages - lifetime is unlimited"),-1;const t=1e3*e,i=Date.now();let n=0,s=0;for(const e of this.channels.values())if(e.messages){n++;for(const n of e.messages.values())i-(n.editedTimestamp||n.createdTimestamp)>t&&(e.messages.delete(n.id),s++)}return this.emit(Constants.Events.DEBUG,`Swept ${s} messages older than ${e} seconds in ${n} text-based channels`),s}fetchApplication(e="@me"){return this.api.oauth2.applications(e).get().then(e=>new ClientApplication(this,e))}generateInvite(e){return e?e instanceof Array&&(e=Permissions.resolve(e)):e=0,this.fetchApplication().then(t=>`https://discordapp.com/oauth2/authorize?client_id=${t.id}&permissions=${e}&scope=bot`)}_pong(e){this.pings.unshift(Date.now()-e),this.pings.length>3&&(this.pings.length=3),this.ws.lastHeartbeatAck=!0}_eval(script){return eval(script)}_validateOptions(e=this.options){if("number"!=typeof e.shardCount||isNaN(e.shardCount))throw new TypeError("CLIENT_INVALID_OPTION","shardCount","a number");if("number"!=typeof e.shardId||isNaN(e.shardId))throw new TypeError("CLIENT_INVALID_OPTION","shardId","a number");if(e.shardCount<0)throw new RangeError("CLIENT_INVALID_OPTION","shardCount","at least 0");if(e.shardId<0)throw new RangeError("CLIENT_INVALID_OPTION","shardId","at least 0");if(0!==e.shardId&&e.shardId>=e.shardCount)throw new RangeError("CLIENT_INVALID_OPTION","shardId","less than shardCount");if("number"!=typeof e.messageCacheMaxSize||isNaN(e.messageCacheMaxSize))throw new TypeError("CLIENT_INVALID_OPTION","messageCacheMaxSize","a number");if("number"!=typeof e.messageCacheLifetime||isNaN(e.messageCacheLifetime))throw new TypeError("CLIENT_INVALID_OPTION","The messageCacheLifetime","a number");if("number"!=typeof e.messageSweepInterval||isNaN(e.messageSweepInterval))throw new TypeError("CLIENT_INVALID_OPTION","messageSweepInterval","a number");if("boolean"!=typeof e.fetchAllMembers)throw new TypeError("CLIENT_INVALID_OPTION","fetchAllMembers","a boolean");if("boolean"!=typeof e.disableEveryone)throw new TypeError("CLIENT_INVALID_OPTION","disableEveryone","a boolean");if("number"!=typeof e.restWsBridgeTimeout||isNaN(e.restWsBridgeTimeout))throw new TypeError("CLIENT_INVALID_OPTION","restWsBridgeTimeout","a number");if("boolean"!=typeof e.internalSharding)throw new TypeError("CLIENT_INVALID_OPTION","internalSharding","a boolean");if(!(e.disabledEvents instanceof Array))throw new TypeError("CLIENT_INVALID_OPTION","disabledEvents","an Array")}}module.exports=Client}).call(exports,__webpack_require__(8))},function(e,t,i){const n=i(0),{Error:s}=i(4);class ClientManager{constructor(e){this.client=e,this.heartbeatInterval=null}get status(){return this.connection?this.connection.status:n.Status.IDLE}connectToWebSocket(e,t,i){this.client.emit(n.Events.DEBUG,`Authenticated using token ${e}`),this.client.token=e;const r=this.client.setTimeout(()=>i(new s("TOKEN_INVALID")),3e5);this.client.api.gateway.get().then(o=>{const a=`${o.url}/`;this.client.emit(n.Events.DEBUG,`Using gateway ${a}`),this.client.ws.connect(a),this.client.ws.connection.once("close",e=>{4004===e.code&&i(new s("TOKEN_INVALID")),4010===e.code&&i(new s("SHARDING_INVALID")),4011===e.code&&i(new s("SHARDING_REQUIRED"))}),this.client.once(n.Events.READY,()=>{t(e),this.client.clearTimeout(r)})},i)}destroy(){return this.client.ws.destroy(),this.client.rest.destroy(),this.client.user?this.client.user.bot?(this.client.token=null,Promise.resolve()):this.client.api.logout.post().then(()=>{this.client.token=null}):Promise.resolve()}}e.exports=ClientManager},function(e,t){},function(e,t,i){const n=i(13),s=i(0),r=i(135);class WebSocketManager extends n{constructor(e){super(),this.client=e,this.connection=null}heartbeat(){return this.connection?this.connection.heartbeat():this.debug("No connection to heartbeat")}debug(e){return this.client.emit(s.Events.DEBUG,`[ws] ${e}`)}destroy(){return this.connection?this.connection.destroy():(this.debug("Attempted to destroy WebSocket but no connection exists!"),!1)}send(e){this.connection?this.connection.send(e):this.debug("No connection to websocket")}connect(e){if(!this.connection)return this.connection=new r(this,e),!0;switch(this.connection.status){case s.Status.IDLE:case s.Status.DISCONNECTED:return this.connection.connect(e,5500),!0;default:return this.debug(`Couldn't connect to ${e} as the websocket is at state ${this.connection.status}`),!1}}}e.exports=WebSocketManager},function(e,t,i){const n=i(13),s=i(0),r=i(136),o=i(77);class WebSocketConnection extends n{constructor(e,t){super(),this.manager=e,this.client=e.client,this.ws=null,this.sequence=-1,this.status=s.Status.IDLE,this.packetManager=new r(this),this.lastPingTimestamp=0,this.ratelimit={queue:[],remaining:60,total:60,resetTimer:null},this.connect(t),this.disabledEvents={},this.closeSequence=0,this.expectingClose=!1;for(const e of this.client.options.disabledEvents)this.disabledEvents[e]=!0}triggerReady(){this.status!==s.Status.READY?(this.status=s.Status.READY,this.client.emit(s.Events.READY),this.packetManager.handleQueue()):this.debug("Tried to mark self as ready, but already ready")}checkIfReady(){if(this.status===s.Status.READY||this.status===s.Status.NEARLY)return!1;let e=0;for(const t of this.client.guilds.values())t.available||e++;if(0===e){if(this.status=s.Status.NEARLY,!this.client.options.fetchAllMembers)return this.triggerReady();const e=this.client.guilds.map(e=>e.members.fetch());Promise.all(e).then(()=>this.triggerReady()).catch(e=>{this.debug(`Failed to fetch all members before ready! ${e}`),this.triggerReady()})}return!0}debug(e){return e instanceof Error&&(e=e.stack),this.manager.debug(`[connection] ${e}`)}processQueue(){if(0!==this.ratelimit.remaining&&0!==this.ratelimit.queue.length)for(this.ratelimit.remaining===this.ratelimit.total&&(this.ratelimit.resetTimer=this.client.setTimeout(()=>{this.ratelimit.remaining=this.ratelimit.total,this.processQueue()},12e4));this.ratelimit.remaining>0;){const e=this.ratelimit.queue.shift();if(!e)return;this._send(e),this.ratelimit.remaining--}}_send(e){this.ws&&this.ws.readyState===o.OPEN?this.ws.send(o.pack(e)):this.debug(`Tried to send packet ${e} but no WebSocket is available!`)}send(e){this.ws&&this.ws.readyState===o.OPEN?(this.ratelimit.queue.push(e),this.processQueue()):this.debug(`Tried to send packet ${e} but no WebSocket is available!`)}connect(e=this.gateway,t=0,i=!1){if(t)return this.client.setTimeout(()=>this.connect(e,0,i),t);if(this.ws&&!i)return this.debug("WebSocket connection already exists"),!1;if("string"!=typeof e)return this.debug(`Tried to connect to an invalid gateway: ${e}`),!1;this.expectingClose=!1,this.gateway=e,this.debug(`Connecting to ${e}`);const n=this.ws=o.create(e,{v:s.DefaultOptions.ws.version});return n.onmessage=this.onMessage.bind(this),n.onopen=this.onOpen.bind(this),n.onerror=this.onError.bind(this),n.onclose=this.onClose.bind(this),this.status=s.Status.CONNECTING,!0}destroy(){const e=this.ws;return e?(this.heartbeat(-1),this.expectingClose=!0,e.close(1e3),this.packetManager.handleQueue(),this.ws=null,this.status=s.Status.DISCONNECTED,this.ratelimit.remaining=this.ratelimit.total,!0):(this.debug("Attempted to destroy WebSocket but no connection exists!"),!1)}onMessage(e){let t;try{t=o.unpack(e.data)}catch(e){this.emit("debug",e)}const i=this.onPacket(t);return this.client.emit("raw",t),i}setSequence(e){this.sequence=e>this.sequence?e:this.sequence}onPacket(e){if(!e)return this.debug("Received null packet"),!1;switch(e.op){case s.OPCodes.HELLO:return this.heartbeat(e.d.heartbeat_interval);case s.OPCodes.RECONNECT:return this.reconnect();case s.OPCodes.INVALID_SESSION:return e.d||(this.sessionID=null),this.sequence=-1,this.debug("Session invalidated -- will identify with a new session"),this.identify(e.d?2500:0);case s.OPCodes.HEARTBEAT_ACK:return this.ackHeartbeat();case s.OPCodes.HEARTBEAT:return this.heartbeat();default:return this.packetManager.handle(e)}}onOpen(e){e&&e.target&&e.target.url&&(this.gateway=e.target.url),this.debug(`Connected to gateway ${this.gateway}`),this.identify()}reconnect(){this.debug("Attemping to reconnect in 5500ms..."),this.client.emit(s.Events.RECONNECTING),this.connect(this.gateway,5500,!0)}onError(e){e&&"uWs client connection error"===e.message?this.reconnect():this.client.emit(s.Events.ERROR,e)}onClose(e){if(this.debug(`${this.expectingClose?"Client":"Server"} closed the WebSocket connection: ${e.code}`),this.closeSequence=this.sequence,this.emit("close",e),this.heartbeat(-1),1e3===e.code?this.expectingClose:s.WSCodes[e.code])return this.expectingClose=!1,this.client.emit(s.Events.DISCONNECT,e),this.debug(s.WSCodes[e.code]),void this.destroy();this.expectingClose=!1,this.reconnect()}ackHeartbeat(){this.debug(`Heartbeat acknowledged, latency of ${Date.now()-this.lastPingTimestamp}ms`),this.client._pong(this.lastPingTimestamp)}heartbeat(e){isNaN(e)?(this.debug("Sending a heartbeat"),this.lastPingTimestamp=Date.now(),this.send({op:s.OPCodes.HEARTBEAT,d:this.sequence})):-1===e?(this.debug("Clearing heartbeat interval"),this.client.clearInterval(this.heartbeatInterval),this.heartbeatInterval=null):(this.debug(`Setting a heartbeat interval for ${e}ms`),this.heartbeatInterval=this.client.setInterval(()=>this.heartbeat(),e))}identify(e){return e?this.client.setTimeout(this.identify.bind(this),e):this.sessionID?this.identifyResume():this.identifyNew()}identifyNew(){if(!this.client.token)return void this.debug("No token available to identify a new session with");const e=Object.assign({token:this.client.token},this.client.options.ws),{shardId:t,shardCount:i}=this.client.options;i>0&&(e.shard=[Number(t),Number(i)]),this.debug("Identifying as a new session"),this.send({op:s.OPCodes.IDENTIFY,d:e})}identifyResume(){if(!this.sessionID)return this.debug("Warning: wanted to resume but session ID not available; identifying as a new session instead"),this.identifyNew();this.debug(`Attempting to resume session ${this.sessionID}`);const e={token:this.client.token,session_id:this.sessionID,seq:this.sequence};return this.send({op:s.OPCodes.RESUME,d:e})}}e.exports=WebSocketConnection},function(e,t,i){const n=i(0),s=[n.WSEvents.READY,n.WSEvents.RESUMED,n.WSEvents.GUILD_CREATE,n.WSEvents.GUILD_DELETE,n.WSEvents.GUILD_MEMBERS_CHUNK,n.WSEvents.GUILD_MEMBER_ADD,n.WSEvents.GUILD_MEMBER_REMOVE];class WebSocketPacketManager{constructor(e){this.ws=e,this.handlers={},this.queue=[],this.register(n.WSEvents.READY,i(137)),this.register(n.WSEvents.RESUMED,i(139)),this.register(n.WSEvents.GUILD_CREATE,i(140)),this.register(n.WSEvents.GUILD_DELETE,i(141)),this.register(n.WSEvents.GUILD_UPDATE,i(142)),this.register(n.WSEvents.GUILD_BAN_ADD,i(143)),this.register(n.WSEvents.GUILD_BAN_REMOVE,i(144)),this.register(n.WSEvents.GUILD_MEMBER_ADD,i(145)),this.register(n.WSEvents.GUILD_MEMBER_REMOVE,i(146)),this.register(n.WSEvents.GUILD_MEMBER_UPDATE,i(147)),this.register(n.WSEvents.GUILD_ROLE_CREATE,i(148)),this.register(n.WSEvents.GUILD_ROLE_DELETE,i(149)),this.register(n.WSEvents.GUILD_ROLE_UPDATE,i(150)),this.register(n.WSEvents.GUILD_EMOJIS_UPDATE,i(151)),this.register(n.WSEvents.GUILD_MEMBERS_CHUNK,i(152)),this.register(n.WSEvents.CHANNEL_CREATE,i(153)),this.register(n.WSEvents.CHANNEL_DELETE,i(154)),this.register(n.WSEvents.CHANNEL_UPDATE,i(155)),this.register(n.WSEvents.CHANNEL_PINS_UPDATE,i(156)),this.register(n.WSEvents.PRESENCE_UPDATE,i(157)),this.register(n.WSEvents.USER_UPDATE,i(158)),this.register(n.WSEvents.USER_NOTE_UPDATE,i(159)),this.register(n.WSEvents.USER_SETTINGS_UPDATE,i(160)),this.register(n.WSEvents.USER_GUILD_SETTINGS_UPDATE,i(161)),this.register(n.WSEvents.VOICE_STATE_UPDATE,i(162)),this.register(n.WSEvents.TYPING_START,i(163)),this.register(n.WSEvents.MESSAGE_CREATE,i(164)),this.register(n.WSEvents.MESSAGE_DELETE,i(165)),this.register(n.WSEvents.MESSAGE_UPDATE,i(166)),this.register(n.WSEvents.MESSAGE_DELETE_BULK,i(167)),this.register(n.WSEvents.VOICE_SERVER_UPDATE,i(168)),this.register(n.WSEvents.GUILD_SYNC,i(169)),this.register(n.WSEvents.RELATIONSHIP_ADD,i(170)),this.register(n.WSEvents.RELATIONSHIP_REMOVE,i(171)),this.register(n.WSEvents.MESSAGE_REACTION_ADD,i(172)),this.register(n.WSEvents.MESSAGE_REACTION_REMOVE,i(173)),this.register(n.WSEvents.MESSAGE_REACTION_REMOVE_ALL,i(174))}get client(){return this.ws.client}register(e,t){this.handlers[e]=new t(this)}handleQueue(){this.queue.forEach((e,t)=>{this.handle(this.queue[t],!0),this.queue.splice(t,1)})}handle(e,t=!1){return e.op===n.OPCodes.HEARTBEAT_ACK?(this.ws.client._pong(this.ws.client._pingTimestamp),this.ws.lastHeartbeatAck=!0,this.ws.client.emit("debug","Heartbeat acknowledged")):e.op===n.OPCodes.HEARTBEAT&&(this.client.ws.send({op:n.OPCodes.HEARTBEAT,d:this.client.ws.sequence}),this.ws.client.emit("debug","Received gateway heartbeat")),this.ws.status===n.Status.RECONNECTING&&(this.ws.reconnecting=!1,this.ws.checkIfReady()),this.ws.setSequence(e.s),void 0===this.ws.disabledEvents[e.t]&&(this.ws.status!==n.Status.READY&&-1===s.indexOf(e.t)?(this.queue.push(e),!1):(!t&&this.queue.length>0&&this.handleQueue(),!!this.handlers[e.t]&&this.handlers[e.t].handle(e)))}}e.exports=WebSocketPacketManager},function(e,t,i){const n=i(1),s=i(0),r=i(74);class ReadyHandler extends n{handle(e){const t=this.packetManager.client,i=e.d;t.ws.heartbeat(),i.user.user_settings=i.user_settings,i.user.user_guild_settings=i.user_guild_settings;const n=new r(t,i.user);t.user=n,t.readyAt=new Date,t.users.set(n.id,n);for(const e of i.guilds)t.guilds.create(e);for(const e of i.private_channels)t.channels.create(e);for(const e of i.relationships){const i=t.users.create(e.user);1===e.type?t.user.friends.set(i.id,i):2===e.type&&t.user.blocked.set(i.id,i)}for(const e of i.presences||[])t.presences.create(e);if(i.notes)for(const e in i.notes){let n=i.notes[e];n.length||(n=null),t.user.notes.set(e,n)}t.users.has("1")||t.users.create({id:"1",username:"Clyde",discriminator:"0000",avatar:"https://discordapp.com/assets/f78426a064bc9dd24847519259bc42af.png",bot:!0,status:"online",activity:null,verified:!0});const o=t.setTimeout(()=>{t.ws.connection.triggerReady()},1200*i.guilds.length);t.setMaxListeners(i.guilds.length+10),t.once("ready",()=>{t.syncGuilds(),t.setMaxListeners(10),t.clearTimeout(o)});const a=this.packetManager.ws;a.sessionID=i.session_id,a._trace=i._trace,t.emit(s.Events.DEBUG,`READY ${a._trace.join(" -> ")} ${a.sessionID}`),a.checkIfReady()}}e.exports=ReadyHandler},function(e,t,i){const n=i(0);class ClientUserChannelOverride{constructor(e){this.patch(e)}patch(e){for(const[t,i]of Object.entries(n.UserChannelOverrideMap))e.hasOwnProperty(t)&&("function"==typeof i?this[i.name]=i(e[t]):this[i]=e[t])}}e.exports=ClientUserChannelOverride},function(e,t,i){const n=i(1),s=i(0);class ResumedHandler extends n{handle(e){const t=this.packetManager.client,i=t.ws.connection;i._trace=e.d._trace,i.status=s.Status.READY,this.packetManager.handleQueue();const n=i.sequence-i.closeSequence;i.debug(`RESUMED ${i._trace.join(" -> ")} | replayed ${n} events.`),t.emit(s.Events.RESUMED,n),i.heartbeat()}}e.exports=ResumedHandler},function(e,t,i){const n=i(1),s=i(0);class GuildCreateHandler extends n{async handle(e){const t=this.packetManager.client,i=e.d;let n=t.guilds.get(i.id);n?n.available||i.unavailable||(n._patch(i),this.packetManager.ws.checkIfReady()):(n=t.guilds.create(i),t.ws.connection.status===s.Status.READY&&(t.options.fetchAllMembers&&await n.members.fetch(),t.emit(s.Events.GUILD_CREATE,n)))}}e.exports=GuildCreateHandler},function(e,t,i){const n=i(1);class GuildDeleteHandler extends n{handle(e){this.packetManager.client.actions.GuildDelete.handle(e.d)}}e.exports=GuildDeleteHandler},function(e,t,i){const n=i(1);class GuildUpdateHandler extends n{handle(e){const t=this.packetManager.client,i=e.d;t.actions.GuildUpdate.handle(i)}}e.exports=GuildUpdateHandler},function(e,t,i){const n=i(1),s=i(0);class GuildBanAddHandler extends n{handle(e){const t=this.packetManager.client,i=e.d,n=t.guilds.get(i.guild_id),r=t.users.get(i.user.id);n&&r&&t.emit(s.Events.GUILD_BAN_ADD,n,r)}}e.exports=GuildBanAddHandler},function(e,t,i){const n=i(1);class GuildBanRemoveHandler extends n{handle(e){const t=this.packetManager.client,i=e.d;t.actions.GuildBanRemove.handle(i)}}e.exports=GuildBanRemoveHandler},function(e,t,i){const n=i(1),s=i(0);class GuildMemberAddHandler extends n{handle(e){const t=this.packetManager.client,i=e.d,n=t.guilds.get(i.guild_id);if(n){n.memberCount++;const e=n.members.create(i);t.ws.connection.status===s.Status.READY&&t.emit(s.Events.GUILD_MEMBER_ADD,e)}}}e.exports=GuildMemberAddHandler},function(e,t,i){const n=i(1);class GuildMemberRemoveHandler extends n{handle(e){const t=this.packetManager.client,i=e.d;t.actions.GuildMemberRemove.handle(i)}}e.exports=GuildMemberRemoveHandler},function(e,t,i){const n=i(1),s=i(0);class GuildMemberUpdateHandler extends n{handle(e){const t=this.packetManager.client,i=e.d,n=t.guilds.get(i.guild_id);if(n){const e=n.members.get(i.user.id);if(e){const n=e._update(i);t.ws.connection.status===s.Status.READY&&t.emit(s.Events.GUILD_MEMBER_UPDATE,n,e)}}}}e.exports=GuildMemberUpdateHandler},function(e,t,i){const n=i(1);class GuildRoleCreateHandler extends n{handle(e){const t=this.packetManager.client,i=e.d;t.actions.GuildRoleCreate.handle(i)}}e.exports=GuildRoleCreateHandler},function(e,t,i){const n=i(1);class GuildRoleDeleteHandler extends n{handle(e){const t=this.packetManager.client,i=e.d;t.actions.GuildRoleDelete.handle(i)}}e.exports=GuildRoleDeleteHandler},function(e,t,i){const n=i(1);class GuildRoleUpdateHandler extends n{handle(e){const t=this.packetManager.client,i=e.d;t.actions.GuildRoleUpdate.handle(i)}}e.exports=GuildRoleUpdateHandler},function(e,t,i){const n=i(1);class GuildEmojisUpdate extends n{handle(e){const t=this.packetManager.client,i=e.d;t.actions.GuildEmojisUpdate.handle(i)}}e.exports=GuildEmojisUpdate},function(e,t,i){const n=i(1),s=i(0),r=i(3);class GuildMembersChunkHandler extends n{handle(e){const t=this.packetManager.client,i=e.d,n=t.guilds.get(i.guild_id);if(!n)return;const o=new r;for(const e of i.members)o.set(e.user.id,n.members.create(e));t.emit(s.Events.GUILD_MEMBERS_CHUNK,o,n),t.ws.lastHeartbeatAck=!0}}e.exports=GuildMembersChunkHandler},function(e,t,i){const n=i(1);class ChannelCreateHandler extends n{handle(e){this.packetManager.client.actions.ChannelCreate.handle(e.d)}}e.exports=ChannelCreateHandler},function(e,t,i){const n=i(1);class ChannelDeleteHandler extends n{handle(e){this.packetManager.client.actions.ChannelDelete.handle(e.d)}}e.exports=ChannelDeleteHandler},function(e,t,i){const n=i(1),s=i(0);class ChannelUpdateHandler extends n{handle(e){const{old:t,updated:i}=this.packetManager.client.actions.ChannelUpdate.handle(e.d);t&&i&&this.packetManager.client.emit(s.Events.CHANNEL_UPDATE,t,i)}}e.exports=ChannelUpdateHandler},function(e,t,i){const n=i(1),s=i(0);class ChannelPinsUpdate extends n{handle(e){const t=this.packetManager.client,i=e.d,n=t.channels.get(i.channel_id),r=new Date(i.last_pin_timestamp);n&&r&&t.emit(s.Events.CHANNEL_PINS_UPDATE,n,r)}}e.exports=ChannelPinsUpdate},function(e,t,i){const n=i(1),s=i(0);class PresenceUpdateHandler extends n{handle(e){const t=this.packetManager.client,i=e.d;let n=t.users.get(i.user.id);const r=t.guilds.get(i.guild_id);if(!n){if(!i.user.username)return;n=t.users.create(i.user)}const o=n._update(i.user);if(n.equals(o)||t.emit(s.Events.USER_UPDATE,o,n),r){let e=r.members.get(n.id);if(e||"offline"===i.status||(e=r.members.create({user:n,roles:i.roles,deaf:!1,mute:!1}),t.emit(s.Events.GUILD_MEMBER_AVAILABLE,e)),e){if(0===t.listenerCount(s.Events.PRESENCE_UPDATE))return void r.presences.create(i);const n=e._clone();e.presence&&(n.frozenPresence=e.presence._clone()),r.presences.create(i),t.emit(s.Events.PRESENCE_UPDATE,n,e)}else r.presences.create(i)}}}e.exports=PresenceUpdateHandler},function(e,t,i){const n=i(1);class UserUpdateHandler extends n{handle(e){const t=this.packetManager.client,i=e.d;t.actions.UserUpdate.handle(i)}}e.exports=UserUpdateHandler},function(e,t,i){const n=i(1);class UserNoteUpdateHandler extends n{handle(e){const t=this.packetManager.client,i=e.d;t.actions.UserNoteUpdate.handle(i)}}e.exports=UserNoteUpdateHandler},function(e,t,i){const n=i(1),s=i(0);class UserSettingsUpdateHandler extends n{handle(e){const t=this.packetManager.client;t.user.settings.patch(e.d),t.emit(s.Events.USER_SETTINGS_UPDATE,t.user.settings)}}e.exports=UserSettingsUpdateHandler},function(e,t,i){const n=i(1),s=i(0),r=i(76);class UserGuildSettingsUpdateHandler extends n{handle(e){const t=this.packetManager.client,i=t.user.guildSettings.get(e.d.guild_id);i?i.patch(e.d):t.user.guildSettings.set(e.d.guild_id,new r(this.client,e.d)),t.emit(s.Events.USER_GUILD_SETTINGS_UPDATE,t.user.guildSettings.get(e.d.guild_id))}}e.exports=UserGuildSettingsUpdateHandler},function(e,t,i){const n=i(1),s=i(0);class VoiceStateUpdateHandler extends n{handle(e){const t=this.packetManager.client,i=e.d,n=t.guilds.get(i.guild_id);if(n){const e=n.members.get(i.user_id);if(e){const r=e._clone();r._frozenVoiceState=r.voiceState,e.user.id===t.user.id&&i.channel_id&&t.emit("self.voiceStateUpdate",i),n.voiceStates.set(e.user.id,i),t.emit(s.Events.VOICE_STATE_UPDATE,r,e)}}}}e.exports=VoiceStateUpdateHandler},function(e,t,i){function n(e,t){return e.client.setTimeout(()=>{e.client.emit(r.Events.TYPING_STOP,e,t,e._typing.get(t.id)),e._typing.delete(t.id)},6e3)}const s=i(1),r=i(0);class TypingStartHandler extends s{handle(e){const t=this.packetManager.client,i=e.d,s=t.channels.get(i.channel_id),o=t.users.get(i.user_id),a=new Date(1e3*i.timestamp);if(s&&o){if("voice"===s.type)return void t.emit(r.Events.WARN,`Discord sent a typing packet to voice channel ${s.id}`);if(s._typing.has(o.id)){const e=s._typing.get(o.id);e.lastTimestamp=a,e.resetTimeout(n(s,o))}else s._typing.set(o.id,new TypingData(t,a,a,n(s,o))),t.emit(r.Events.TYPING_START,s,o)}}}class TypingData{constructor(e,t,i,n){this.client=e,this.since=t,this.lastTimestamp=i,this._timeout=n}resetTimeout(e){this.client.clearTimeout(this._timeout),this._timeout=e}get elapsedTime(){return Date.now()-this.since}}e.exports=TypingStartHandler},function(e,t,i){const n=i(1);class MessageCreateHandler extends n{handle(e){this.packetManager.client.actions.MessageCreate.handle(e.d)}}e.exports=MessageCreateHandler},function(e,t,i){const n=i(1);class MessageDeleteHandler extends n{handle(e){this.packetManager.client.actions.MessageDelete.handle(e.d)}}e.exports=MessageDeleteHandler},function(e,t,i){const n=i(1),s=i(0);class MessageUpdateHandler extends n{handle(e){const{old:t,updated:i}=this.packetManager.client.actions.MessageUpdate.handle(e.d);t&&i&&this.packetManager.client.emit(s.Events.MESSAGE_UPDATE,t,i)}}e.exports=MessageUpdateHandler},function(e,t,i){const n=i(1);class MessageDeleteBulkHandler extends n{handle(e){this.packetManager.client.actions.MessageDeleteBulk.handle(e.d)}}e.exports=MessageDeleteBulkHandler},function(e,t,i){const n=i(1);class VoiceServerUpdate extends n{handle(e){const t=this.packetManager.client,i=e.d;t.emit("self.voiceServer",i)}}e.exports=VoiceServerUpdate},function(e,t,i){const n=i(1);class GuildSyncHandler extends n{handle(e){const t=this.packetManager.client,i=e.d;t.actions.GuildSync.handle(i)}}e.exports=GuildSyncHandler},function(e,t,i){const n=i(1);class RelationshipAddHandler extends n{handle(e){const t=this.packetManager.client,i=e.d;1===i.type?t.users.fetch(i.id).then(e=>{t.user.friends.set(e.id,e)}):2===i.type&&t.users.fetch(i.id).then(e=>{t.user.blocked.set(e.id,e)})}}e.exports=RelationshipAddHandler},function(e,t,i){const n=i(1);class RelationshipRemoveHandler extends n{handle(e){const t=this.packetManager.client,i=e.d;2===i.type?t.user.blocked.has(i.id)&&t.user.blocked.delete(i.id):1===i.type&&t.user.friends.has(i.id)&&t.user.friends.delete(i.id)}}e.exports=RelationshipRemoveHandler},function(e,t,i){const n=i(1),s=i(0);class MessageReactionAddHandler extends n{handle(e){const t=this.packetManager.client,i=e.d,{user:n,reaction:r}=t.actions.MessageReactionAdd.handle(i);r&&t.emit(s.Events.MESSAGE_REACTION_ADD,r,n)}}e.exports=MessageReactionAddHandler},function(e,t,i){const n=i(1);class MessageReactionRemove extends n{handle(e){const t=this.packetManager.client,i=e.d;t.actions.MessageReactionRemove.handle(i)}}e.exports=MessageReactionRemove},function(e,t,i){const n=i(1);class MessageReactionRemoveAll extends n{handle(e){const t=this.packetManager.client,i=e.d;t.actions.MessageReactionRemoveAll.handle(i)}}e.exports=MessageReactionRemoveAll},function(e,t){},function(e,t){},function(e,t){},function(e,t,i){class ActionsManager{constructor(e){this.client=e,this.register(i(179)),this.register(i(180)),this.register(i(181)),this.register(i(182)),this.register(i(183)),this.register(i(184)),this.register(i(185)),this.register(i(186)),this.register(i(187)),this.register(i(188)),this.register(i(189)),this.register(i(190)),this.register(i(191)),this.register(i(192)),this.register(i(193)),this.register(i(194)),this.register(i(195)),this.register(i(196)),this.register(i(197)),this.register(i(198)),this.register(i(199)),this.register(i(200)),this.register(i(201)),this.register(i(202)),this.register(i(203)),this.register(i(204)),this.register(i(205)),this.register(i(206))}register(e){this[e.name.replace(/Action$/,"")]=new e(this.client)}}e.exports=ActionsManager},function(e,t,i){const n=i(2),s=i(0);class MessageCreateAction extends n{handle(e){const t=this.client,i=t.channels.get(e.channel_id),n=t.users.get(e.author.id);if(i){const r=i.messages.get(e.id);if(r)return{message:r};const o=i.guild?i.guild.member(n):null,a=i.messages.create(e);return i.lastMessageID=e.id,i.lastMessage=a,n&&(n.lastMessageID=e.id,n.lastMessage=a),o&&(o.lastMessageID=e.id,o.lastMessage=a),t.emit(s.Events.MESSAGE_CREATE,a),{message:a}}return{}}}e.exports=MessageCreateAction},function(e,t,i){const n=i(2),s=i(0);class MessageDeleteAction extends n{handle(e){const t=this.client,i=t.channels.get(e.channel_id);let n;return i&&(n=i.messages.get(e.id))&&(i.messages.delete(n.id),t.emit(s.Events.MESSAGE_DELETE,n)),{message:n}}}e.exports=MessageDeleteAction},function(e,t,i){const n=i(2),s=i(3),r=i(0);class MessageDeleteBulkAction extends n{handle(e){const t=this.client,i=t.channels.get(e.channel_id);if(i){const n=e.ids,o=new s;for(const e of n){const t=i.messages.get(e);t&&o.set(t.id,t)}return o.size>0&&t.emit(r.Events.MESSAGE_BULK_DELETE,o),{messages:o}}return{}}}e.exports=MessageDeleteBulkAction},function(e,t,i){const n=i(2);class MessageUpdateAction extends n{handle(e){const t=this.client.channels.get(e.channel_id);if(t){const i=t.messages.get(e.id);if(i)return i.patch(e),{old:i._edits[0],updated:i}}return{}}}e.exports=MessageUpdateAction},function(e,t,i){const n=i(2);class MessageReactionAdd extends n{handle(e){const t=e.user||this.client.users.get(e.user_id);if(!t)return!1;const i=e.channel||this.client.channels.get(e.channel_id);if(!i||"voice"===i.type)return!1;const n=e.message||i.messages.get(e.message_id);if(!n)return!1;if(!e.emoji)return!1;const s=n.reactions.create({emoji:e.emoji,count:0,me:t.id===this.client.user.id});return s._add(t),{message:n,reaction:s,user:t}}}e.exports=MessageReactionAdd},function(e,t,i){const n=i(2),s=i(0);class MessageReactionRemove extends n{handle(e){const t=this.client.users.get(e.user_id);if(!t)return!1;const i=this.client.channels.get(e.channel_id);if(!i||"voice"===i.type)return!1;const n=i.messages.get(e.message_id);if(!n)return!1;if(!e.emoji)return!1;const r=e.emoji.id||decodeURIComponent(e.emoji.name),o=n.reactions.get(r);return!!o&&(o._remove(t),this.client.emit(s.Events.MESSAGE_REACTION_REMOVE,o,t),{message:n,reaction:o,user:t})}}e.exports=MessageReactionRemove},function(e,t,i){const n=i(2),s=i(0);class MessageReactionRemoveAll extends n{handle(e){const t=this.client.channels.get(e.channel_id);if(!t||"voice"===t.type)return!1;const i=t.messages.get(e.message_id);return!!i&&(i.reactions.clear(),this.client.emit(s.Events.MESSAGE_REACTION_REMOVE_ALL,i),{message:i})}}e.exports=MessageReactionRemoveAll},function(e,t,i){const n=i(2),s=i(0);class ChannelCreateAction extends n{handle(e){const t=this.client,i=t.channels.has(e.id),n=t.channels.create(e);return!i&&n&&t.emit(s.Events.CHANNEL_CREATE,n),{channel:n}}}e.exports=ChannelCreateAction},function(e,t,i){const n=i(2),s=i(0);class ChannelDeleteAction extends n{constructor(e){super(e),this.deleted=new Map}handle(e){const t=this.client;let i=t.channels.get(e.id);return i&&(t.channels.remove(i.id),t.emit(s.Events.CHANNEL_DELETE,i)),{channel:i}}}e.exports=ChannelDeleteAction},function(e,t,i){const n=i(2);class ChannelUpdateAction extends n{handle(e){const t=this.client.channels.get(e.id);return t?{old:t._update(e),updated:t}:{}}}e.exports=ChannelUpdateAction},function(e,t,i){const n=i(2),s=i(0);class GuildDeleteAction extends n{constructor(e){super(e),this.deleted=new Map}handle(e){const t=this.client;let i=t.guilds.get(e.id);if(i){for(const e of i.channels.values())"text"===e.type&&e.stopTyping(!0);if(i.available&&e.unavailable)return i.available=!1,t.emit(s.Events.GUILD_UNAVAILABLE,i),{guild:null};t.guilds.remove(i.id),t.emit(s.Events.GUILD_DELETE,i),this.deleted.set(i.id,i),this.scheduleForDeletion(i.id)}else i=this.deleted.get(e.id)||null;return{guild:i}}scheduleForDeletion(e){this.client.setTimeout(()=>this.deleted.delete(e),this.client.options.restWsBridgeTimeout)}}e.exports=GuildDeleteAction},function(e,t,i){const n=i(2),s=i(0);class GuildUpdateAction extends n{handle(e){const t=this.client,i=t.guilds.get(e.id);if(i){const n=i._update(e);return t.emit(s.Events.GUILD_UPDATE,n,i),{old:n,updated:i}}return{old:null,updated:null}}}e.exports=GuildUpdateAction},function(e,t,i){const n=i(2);class GuildMemberGetAction extends n{handle(e,t){return{member:e.members.create(t)}}}e.exports=GuildMemberGetAction},function(e,t,i){const n=i(2),s=i(0);class GuildMemberRemoveAction extends n{handle(e){const t=this.client,i=t.guilds.get(e.guild_id);let n=null;return i&&(n=i.members.get(e.user.id))&&(i.memberCount--,i.members.remove(n.id),t.status===s.Status.READY&&t.emit(s.Events.GUILD_MEMBER_REMOVE,n)),{guild:i,member:n}}}e.exports=GuildMemberRemoveAction},function(e,t,i){const n=i(2),s=i(0);class GuildBanRemove extends n{handle(e){const t=this.client,i=t.guilds.get(e.guild_id),n=t.users.create(e.user);i&&n&&t.emit(s.Events.GUILD_BAN_REMOVE,i,n)}}e.exports=GuildBanRemove},function(e,t,i){const n=i(2),s=i(0);class GuildRoleCreate extends n{handle(e){const t=this.client,i=t.guilds.get(e.guild_id);let n;if(i){const r=i.roles.has(e.role.id);n=i.roles.create(e.role),r||t.emit(s.Events.GUILD_ROLE_CREATE,n)}return{role:n}}}e.exports=GuildRoleCreate},function(e,t,i){const n=i(2),s=i(0);class GuildRoleDeleteAction extends n{handle(e){const t=this.client,i=t.guilds.get(e.guild_id);let n;return i&&(n=i.roles.get(e.role_id))&&(i.roles.remove(e.role_id),t.emit(s.Events.GUILD_ROLE_DELETE,n)),{role:n}}}e.exports=GuildRoleDeleteAction},function(e,t,i){const n=i(2),s=i(0);class GuildRoleUpdateAction extends n{handle(e){const t=this.client,i=t.guilds.get(e.guild_id);if(i){let n=null;const r=i.roles.get(e.role.id);return r&&(n=r._update(e.role),t.emit(s.Events.GUILD_ROLE_UPDATE,n,r)),{old:n,updated:r}}return{old:null,updated:null}}}e.exports=GuildRoleUpdateAction},function(e,t,i){const n=i(2);class UserGetAction extends n{handle(e){return{user:this.client.users.create(e)}}}e.exports=UserGetAction},function(e,t,i){const n=i(2),s=i(0);class UserUpdateAction extends n{handle(e){const t=this.client;if(t.user){if(t.user.equals(e))return{old:t.user,updated:t.user};const i=t.user._update(e);return t.emit(s.Events.USER_UPDATE,i,t.user),{old:i,updated:t.user}}return{old:null,updated:null}}}e.exports=UserUpdateAction},function(e,t,i){const n=i(2),s=i(0);class UserNoteUpdateAction extends n{handle(e){const t=this.client,i=t.user.notes.get(e.id),n=e.note.length?e.note:null;return t.user.notes.set(e.id,n),t.emit(s.Events.USER_NOTE_UPDATE,e.id,i,n),{old:i,updated:n}}}e.exports=UserNoteUpdateAction},function(e,t,i){const n=i(2);class GuildSync extends n{handle(e){const t=this.client.guilds.get(e.id);if(t){if(e.presences)for(const i of e.presences)t.presences.create(i);if(e.members)for(const i of e.members){const e=t.members.get(i.user.id);e?e._patch(i):t.members.create(i,!1)}"large"in e&&(t.large=e.large)}}}e.exports=GuildSync},function(e,t,i){const n=i(2),s=i(0);class GuildEmojiCreateAction extends n{handle(e,t){const i=e.emojis.create(t);return this.client.emit(s.Events.GUILD_EMOJI_CREATE,i),{emoji:i}}}e.exports=GuildEmojiCreateAction},function(e,t,i){const n=i(2),s=i(0);class GuildEmojiDeleteAction extends n{handle(e){return e.guild.emojis.remove(e.id),this.client.emit(s.Events.GUILD_EMOJI_DELETE,e),{emoji:e}}}e.exports=GuildEmojiDeleteAction},function(e,t,i){const n=i(2),s=i(0);class GuildEmojiUpdateAction extends n{handle(e,t){const i=e._update(t);return this.client.emit(s.Events.GUILD_EMOJI_UPDATE,i,e),{emoji:e}}}e.exports=GuildEmojiUpdateAction},function(e,t,i){function n(e){const t=new Map;for(const i of e)t.set(...i);return t}const s=i(2);class GuildEmojisUpdateAction extends s{handle(e){const t=this.client.guilds.get(e.guild_id);if(!t||!t.emojis)return;const i=n(t.emojis.entries());for(const n of e.emojis){const e=t.emojis.get(n.id);e?(i.delete(n.id),e.equals(n,!0)||this.client.actions.GuildEmojiUpdate.handle(e,n)):this.client.actions.GuildEmojiCreate.handle(t,n)}for(const e of i.values())this.client.actions.GuildEmojiDelete.handle(e)}}e.exports=GuildEmojisUpdateAction},function(e,t,i){const n=i(2);class GuildRolesPositionUpdate extends n{handle(e){const t=this.client.guilds.get(e.guild_id);if(t)for(const i of e.roles){const e=t.roles.get(i.id);e&&(e.position=i.position)}return{guild:t}}}e.exports=GuildRolesPositionUpdate},function(e,t,i){const n=i(2);class GuildChannelsPositionUpdate extends n{handle(e){const t=this.client.guilds.get(e.guild_id);if(t)for(const i of e.channels){const e=t.channels.get(i.id);e&&(e.position=i.position)}return{guild:t}}}e.exports=GuildChannelsPositionUpdate},function(e,t){},function(e,t){},function(e,t,i){const n=i(11),s=i(25);class UserStore extends n{create(e,t=!0){const i=this.get(e.id);if(i)return i;const n=new s(this.client,e);return t&&this.set(n.id,n),n}fetch(e,t=!0){const i=this.get(e);return i?Promise.resolve(i):this.client.api.users(e).get().then(e=>this.create(e,t))}}e.exports=UserStore},function(e,t,i){const n=i(11),s=i(15),r=i(0),o=Symbol("LRU"),a=["group","dm"];class ChannelStore extends n{constructor(e,t={},i){if(i||"function"==typeof t[Symbol.iterator]||(i=t,t=void 0),super(e,t),i.lru){const e=this[o]=[];e.add=(t=>{for(e.remove(t),e.unshift(t);e.length>i.lru;)this.remove(e[e.length-1])}),e.remove=(t=>{const i=e.indexOf(t);i>-1&&e.splice(i,1)})}}get(e,t=!1){const i=super.get(e);return i&&a.includes(i.type)?(!t&&this[o]&&this[o].add(e),i):i}set(e,t){return this[o]&&a.includes(t.type)&&this[o].add(e),super.set(e,t)}delete(e){const t=this.get(e,!0);return!!t&&(this[o]&&a.includes(t.type)&&this[o].remove(e),super.delete(e))}create(e,t,i=!0){const n=this.get(e.id);if(n)return n;const o=s.create(this.client,e,t);return o?(i&&this.set(o.id,o),o):(this.client.emit(r.Events.DEBUG,`Failed to find guild for channel ${e.id} ${e.type}`),null)}remove(e){const t=this.get(e);t.guild&&t.guild.channels.remove(e),super.remove(e)}}e.exports=ChannelStore},function(e,t,i){const n=i(11),s=i(29);class GuildStore extends n{create(e,t=!0){const i=this.get(e.id);if(i)return i;const n=new s(this.client,e);return t&&this.set(n.id,n),n}}e.exports=GuildStore},function(e,t,i){const n=i(73),s=i(3),r=i(0),{Presence:o}=i(19),{TypeError:a}=i(4);class ClientPresenceStore extends n{constructor(...e){super(...e),this.clientPresence=new o(this.client,{status:"online",afk:!1,since:null,activity:null})}async setClientPresence({status:e,since:t,afk:i,activity:n}){const o=n&&(n.application?n.application.id||n.application:null);let c=new s;if(n){if("string"!=typeof n.name)throw new a("INVALID_TYPE","name","string");if(n.type||(n.type=0),n.assets&&o)try{const e=await this.client.api.oauth2.applications(o).assets.get();for(const t of e)c.set(t.name,t.id)}catch(e){}}const l={afk:null!=i&&i,since:null!=t?t:null,status:e||this.clientPresence.status,game:n?{type:"number"==typeof n.type?n.type:r.ActivityTypes.indexOf(n.type),name:n.name,url:n.url,details:n.details||void 0,state:n.state||void 0,assets:n.assets?{large_text:n.assets.largeText||void 0,small_text:n.assets.smallText||void 0,large_image:c.get(n.assets.largeImage)||n.assets.largeImage,small_image:c.get(n.assets.smallImage)||n.assets.smallImage}:void 0,timestamps:n.timestamps||void 0,party:n.party||void 0,application_id:o||void 0,secrets:n.secrets||void 0,instance:n.instance||void 0}:null};return this.clientPresence.patch(l),this.client.ws.send({op:r.OPCodes.STATUS_UPDATE,d:l}),this.clientPresence}}e.exports=ClientPresenceStore},function(e,t){},function(e,t){},function(e,t){},function(e,t,i){const n=i(21),s=i(41);class WebhookClient extends s{constructor(e,t,i){super(i),Object.defineProperty(this,"client",{value:this}),this.id=e,this.token=t}}n.applyToClass(WebhookClient),e.exports=WebhookClient}]); \ No newline at end of file +!function(e){function t(n){if(i[n])return i[n].exports;var s=i[n]={i:n,l:!1,exports:{}};return e[n].call(s.exports,s,s.exports,t),s.l=!0,s.exports}var i={};t.m=e,t.c=i,t.d=function(e,i,n){t.o(e,i)||Object.defineProperty(e,i,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var i=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(i,"a",i),i},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=79)}([function(e,t,i){(function(e){function n(e,{format:t="webp",size:i}={}){if(t&&!o.includes(t))throw new s("IMAGE_FORMAT",t);if(i&&!a.includes(i))throw new r("IMAGE_SIZE",i);return`${e}.${t}${i?`?size=${i}`:""}`}t.Package=i(58);const{Error:s,RangeError:r}=i(4);t.DefaultOptions={apiRequestMethod:"sequential",shardId:0,shardCount:0,internalSharding:!1,messageCacheMaxSize:200,messageCacheLifetime:0,messageSweepInterval:0,fetchAllMembers:!1,disableEveryone:!1,sync:!1,restWsBridgeTimeout:5e3,disabledEvents:[],restTimeOffset:500,ws:{large_threshold:250,compress:"browser"!==i(114).platform(),properties:{$os:e?e.platform:"discord.js",$browser:"discord.js",$device:"discord.js"},version:6},http:{version:7,api:"https://discordapp.com/api",cdn:"https://cdn.discordapp.com",invite:"https://discord.gg"}},t.WSCodes={1e3:"Connection gracefully closed",4004:"Tried to identify with an invalid token",4010:"Sharding data provided was invalid",4011:"Shard would be on too many guilds if connected"};const o=["webp","png","jpg","gif"],a=Array.from({length:8},(e,t)=>2**(t+4));t.Endpoints={CDN:e=>({Emoji:t=>`${e}/emojis/${t}.png`,Asset:t=>`${e}/assets/${t}`,DefaultAvatar:t=>`${e}/embed/avatars/${t}.png`,Avatar:(t,i,s="default",r)=>("default"===s&&(s=i.startsWith("a_")?"gif":"webp"),n(`${e}/avatars/${t}/${i}`,{format:s,size:r})),Icon:(t,i,s="webp",r)=>n(`${e}/icons/${t}/${i}`,{format:s,size:r}),AppIcon:(t,i,{format:s="webp",size:r}={})=>n(`${e}/app-icons/${t}/${i}`,{size:r,format:s}),AppAsset:(t,i,{format:s="webp",size:r}={})=>n(`${e}/app-assets/${t}/${i}`,{size:r,format:s}),GDMIcon:(t,i,s="webp",r)=>n(`${e}/channel-icons/${t}/${i}`,{size:r,format:s}),Splash:(t,i,s="webp",r)=>n(`${e}/splashes/${t}/${i}`,{size:r,format:s})}),invite:(e,t)=>`${e}/${t}`,botGateway:"/gateway/bot"},t.Status={READY:0,CONNECTING:1,RECONNECTING:2,IDLE:3,NEARLY:4,DISCONNECTED:5},t.VoiceStatus={CONNECTED:0,CONNECTING:1,AUTHENTICATING:2,RECONNECTING:3,DISCONNECTED:4},t.ChannelTypes={TEXT:0,DM:1,VOICE:2,GROUP:3},t.OPCodes={DISPATCH:0,HEARTBEAT:1,IDENTIFY:2,STATUS_UPDATE:3,VOICE_STATE_UPDATE:4,VOICE_GUILD_PING:5,RESUME:6,RECONNECT:7,REQUEST_GUILD_MEMBERS:8,INVALID_SESSION:9,HELLO:10,HEARTBEAT_ACK:11},t.VoiceOPCodes={IDENTIFY:0,SELECT_PROTOCOL:1,READY:2,HEARTBEAT:3,SESSION_DESCRIPTION:4,SPEAKING:5},t.Events={READY:"ready",RESUMED:"resumed",GUILD_CREATE:"guildCreate",GUILD_DELETE:"guildDelete",GUILD_UPDATE:"guildUpdate",GUILD_UNAVAILABLE:"guildUnavailable",GUILD_AVAILABLE:"guildAvailable",GUILD_MEMBER_ADD:"guildMemberAdd",GUILD_MEMBER_REMOVE:"guildMemberRemove",GUILD_MEMBER_UPDATE:"guildMemberUpdate",GUILD_MEMBER_AVAILABLE:"guildMemberAvailable",GUILD_MEMBER_SPEAKING:"guildMemberSpeaking",GUILD_MEMBERS_CHUNK:"guildMembersChunk",GUILD_ROLE_CREATE:"roleCreate",GUILD_ROLE_DELETE:"roleDelete",GUILD_ROLE_UPDATE:"roleUpdate",GUILD_EMOJI_CREATE:"emojiCreate",GUILD_EMOJI_DELETE:"emojiDelete",GUILD_EMOJI_UPDATE:"emojiUpdate",GUILD_BAN_ADD:"guildBanAdd",GUILD_BAN_REMOVE:"guildBanRemove",CHANNEL_CREATE:"channelCreate",CHANNEL_DELETE:"channelDelete",CHANNEL_UPDATE:"channelUpdate",CHANNEL_PINS_UPDATE:"channelPinsUpdate",MESSAGE_CREATE:"message",MESSAGE_DELETE:"messageDelete",MESSAGE_UPDATE:"messageUpdate",MESSAGE_BULK_DELETE:"messageDeleteBulk",MESSAGE_REACTION_ADD:"messageReactionAdd",MESSAGE_REACTION_REMOVE:"messageReactionRemove",MESSAGE_REACTION_REMOVE_ALL:"messageReactionRemoveAll",USER_UPDATE:"userUpdate",USER_NOTE_UPDATE:"userNoteUpdate",USER_SETTINGS_UPDATE:"clientUserSettingsUpdate",USER_GUILD_SETTINGS_UPDATE:"clientUserGuildSettingsUpdate",PRESENCE_UPDATE:"presenceUpdate",VOICE_STATE_UPDATE:"voiceStateUpdate",TYPING_START:"typingStart",TYPING_STOP:"typingStop",DISCONNECT:"disconnect",RECONNECTING:"reconnecting",ERROR:"error",WARN:"warn",DEBUG:"debug"},t.WSEvents=function(e){let t=Object.create(null);for(const i of e)t[i]=i;return t}(["READY","RESUMED","GUILD_SYNC","GUILD_CREATE","GUILD_DELETE","GUILD_UPDATE","GUILD_MEMBER_ADD","GUILD_MEMBER_REMOVE","GUILD_MEMBER_UPDATE","GUILD_MEMBERS_CHUNK","GUILD_ROLE_CREATE","GUILD_ROLE_DELETE","GUILD_ROLE_UPDATE","GUILD_BAN_ADD","GUILD_BAN_REMOVE","GUILD_EMOJIS_UPDATE","CHANNEL_CREATE","CHANNEL_DELETE","CHANNEL_UPDATE","CHANNEL_PINS_UPDATE","MESSAGE_CREATE","MESSAGE_DELETE","MESSAGE_UPDATE","MESSAGE_DELETE_BULK","MESSAGE_REACTION_ADD","MESSAGE_REACTION_REMOVE","MESSAGE_REACTION_REMOVE_ALL","USER_UPDATE","USER_NOTE_UPDATE","USER_SETTINGS_UPDATE","USER_GUILD_SETTINGS_UPDATE","PRESENCE_UPDATE","VOICE_STATE_UPDATE","TYPING_START","VOICE_SERVER_UPDATE","RELATIONSHIP_ADD","RELATIONSHIP_REMOVE"]),t.MessageTypes=["DEFAULT","RECIPIENT_ADD","RECIPIENT_REMOVE","CALL","CHANNEL_NAME_CHANGE","CHANNEL_ICON_CHANGE","PINS_ADD","GUILD_MEMBER_JOIN"],t.ActivityTypes=["PLAYING","STREAMING","LISTENING","WATCHING"],t.ExplicitContentFilterTypes=["DISABLED","NON_FRIENDS","FRIENDS_AND_NON_FRIENDS"],t.MessageNotificationTypes=["EVERYTHING","MENTIONS","NOTHING","INHERIT"],t.UserSettingsMap={convert_emoticons:"convertEmoticons",default_guilds_restricted:"defaultGuildsRestricted",detect_platform_accounts:"detectPlatformAccounts",developer_mode:"developerMode",enable_tts_command:"enableTTSCommand",theme:"theme",status:"status",show_current_game:"showCurrentGame",inline_attachment_media:"inlineAttachmentMedia",inline_embed_media:"inlineEmbedMedia",locale:"locale",message_display_compact:"messageDisplayCompact",render_reactions:"renderReactions",guild_positions:"guildPositions",restricted_guilds:"restrictedGuilds",explicit_content_filter:function(e){return t.ExplicitContentFilterTypes[e]},friend_source_flags:function(e){return{all:e.all||!1,mutualGuilds:!!e.all||(e.mutual_guilds||!1),mutualFriends:!!e.all||(e.mutualFriends||!1)}}},t.UserGuildSettingsMap={message_notifications:function(e){return t.MessageNotificationTypes[e]},mobile_push:"mobilePush",muted:"muted",suppress_everyone:"suppressEveryone",channel_overrides:"channelOverrides"},t.UserChannelOverrideMap={message_notifications:function(e){return t.MessageNotificationTypes[e]},muted:"muted"},t.UserFlags={STAFF:1,PARTNER:2,HYPESQUAD:4},t.ClientApplicationAssetTypes={SMALL:1,BIG:2},t.Colors={DEFAULT:0,AQUA:1752220,GREEN:3066993,BLUE:3447003,PURPLE:10181046,GOLD:15844367,ORANGE:15105570,RED:15158332,GREY:9807270,NAVY:3426654,DARK_AQUA:1146986,DARK_GREEN:2067276,DARK_BLUE:2123412,DARK_PURPLE:7419530,DARK_GOLD:12745742,DARK_ORANGE:11027200,DARK_RED:10038562,DARK_GREY:9936031,DARKER_GREY:8359053,LIGHT_GREY:12370112,DARK_NAVY:2899536,BLURPLE:7506394,GREYPLE:10070709,DARK_BUT_NOT_BLACK:2895667,NOT_QUITE_BLACK:2303786},t.APIErrors={UNKNOWN_ACCOUNT:10001,UNKNOWN_APPLICATION:10002,UNKNOWN_CHANNEL:10003,UNKNOWN_GUILD:10004,UNKNOWN_INTEGRATION:10005,UNKNOWN_INVITE:10006,UNKNOWN_MEMBER:10007,UNKNOWN_MESSAGE:10008,UNKNOWN_OVERWRITE:10009,UNKNOWN_PROVIDER:10010,UNKNOWN_ROLE:10011,UNKNOWN_TOKEN:10012,UNKNOWN_USER:10013,UNKNOWN_EMOJI:10014,BOT_PROHIBITED_ENDPOINT:20001,BOT_ONLY_ENDPOINT:20002,MAXIMUM_GUILDS:30001,MAXIMUM_FRIENDS:30002,MAXIMUM_PINS:30003,MAXIMUM_ROLES:30005,MAXIMUM_REACTIONS:30010,UNAUTHORIZED:40001,MISSING_ACCESS:50001,INVALID_ACCOUNT_TYPE:50002,CANNOT_EXECUTE_ON_DM:50003,EMBED_DISABLED:50004,CANNOT_EDIT_MESSAGE_BY_OTHER:50005,CANNOT_SEND_EMPTY_MESSAGE:50006,CANNOT_MESSAGE_USER:50007,CANNOT_SEND_MESSAGES_IN_VOICE_CHANNEL:50008,CHANNEL_VERIFICATION_LEVEL_TOO_HIGH:50009,OAUTH2_APPLICATION_BOT_ABSENT:50010,MAXIMUM_OAUTH2_APPLICATIONS:50011,INVALID_OAUTH_STATE:50012,MISSING_PERMISSIONS:50013,INVALID_AUTHENTICATION_TOKEN:50014,NOTE_TOO_LONG:50015,INVALID_BULK_DELETE_QUANTITY:50016,CANNOT_PIN_MESSAGE_IN_OTHER_CHANNEL:50019,CANNOT_EXECUTE_ON_SYSTEM_MESSAGE:50021,BULK_DELETE_MESSAGE_TOO_OLD:50034,INVITE_ACCEPTED_TO_GUILD_NOT_CONTANING_BOT:50036,REACTION_BLOCKED:90001}}).call(t,i(8))},function(e,t){class AbstractHandler{constructor(e){this.packetManager=e}handle(e){return e}}e.exports=AbstractHandler},function(e,t){class GenericAction{constructor(e){this.client=e}handle(e){return e}}e.exports=GenericAction},function(e,t){class Collection extends Map{constructor(e){super(e),Object.defineProperty(this,"_array",{value:null,writable:!0,configurable:!0}),Object.defineProperty(this,"_keyArray",{value:null,writable:!0,configurable:!0})}set(e,t){return this._array=null,this._keyArray=null,super.set(e,t)}delete(e){return this._array=null,this._keyArray=null,super.delete(e)}array(){return this._array&&this._array.length===this.size||(this._array=Array.from(this.values())),this._array}keyArray(){return this._keyArray&&this._keyArray.length===this.size||(this._keyArray=Array.from(this.keys())),this._keyArray}first(e){if(void 0===e)return this.values().next().value;if(e<0)return this.last(-1*e);e=Math.min(this.size,e);const t=new Array(e),i=this.values();for(let n=0;n{const n=e.get(i);return n!==t||void 0===n&&!e.has(i)}))}sort(e=((e,t)=>+(e>t)||+(e===t)-1)){return new Collection(Array.from(this.entries()).sort((t,i)=>e(t[1],i[1],t[0],i[0])))}}e.exports=Collection},function(e,t,i){e.exports=i(59),e.exports.Messages=i(113)},function(e,t,i){"use strict";(function(e){function n(){return r.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function s(e,t){if(n()=n())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+n().toString(16)+" bytes");return 0|e}function m(e,t){if(r.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var i=e.length;if(0===i)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return i;case"utf8":case"utf-8":case void 0:return z(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*i;case"hex":return i>>>1;case"base64":return W(e).length;default:if(n)return z(e).length;t=(""+t).toLowerCase(),n=!0}}function g(e,t,i){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===i||i>this.length)&&(i=this.length),i<=0)return"";if(i>>>=0,t>>>=0,i<=t)return"";for(e||(e="utf8");;)switch(e){case"hex":return k(this,t,i);case"utf8":case"utf-8":return R(this,t,i);case"ascii":return D(this,t,i);case"latin1":case"binary":return C(this,t,i);case"base64":return T(this,t,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return N(this,t,i);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function v(e,t,i){var n=e[t];e[t]=e[i],e[i]=n}function E(e,t,i,n,s){if(0===e.length)return-1;if("string"==typeof i?(n=i,i=0):i>2147483647?i=2147483647:i<-2147483648&&(i=-2147483648),i=+i,isNaN(i)&&(i=s?0:e.length-1),i<0&&(i=e.length+i),i>=e.length){if(s)return-1;i=e.length-1}else if(i<0){if(!s)return-1;i=0}if("string"==typeof t&&(t=r.from(t,n)),r.isBuffer(t))return 0===t.length?-1:_(e,t,i,n,s);if("number"==typeof t)return t&=255,r.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?s?Uint8Array.prototype.indexOf.call(e,t,i):Uint8Array.prototype.lastIndexOf.call(e,t,i):_(e,[t],i,n,s);throw new TypeError("val must be string, number or Buffer")}function _(e,t,i,n,s){function r(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}var o=1,a=e.length,c=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;o=2,a/=2,c/=2,i/=2}var l;if(s){var h=-1;for(l=i;la&&(i=a-c),l=i;l>=0;l--){for(var u=!0,p=0;ps&&(n=s):n=s;var r=t.length;if(r%2!=0)throw new TypeError("Invalid hex string");n>r/2&&(n=r/2);for(var o=0;o239?4:r>223?3:r>191?2:1;if(s+a<=i){var c,l,h,u;switch(a){case 1:r<128&&(o=r);break;case 2:128==(192&(c=e[s+1]))&&(u=(31&r)<<6|63&c)>127&&(o=u);break;case 3:c=e[s+1],l=e[s+2],128==(192&c)&&128==(192&l)&&(u=(15&r)<<12|(63&c)<<6|63&l)>2047&&(u<55296||u>57343)&&(o=u);break;case 4:c=e[s+1],l=e[s+2],h=e[s+3],128==(192&c)&&128==(192&l)&&128==(192&h)&&(u=(15&r)<<18|(63&c)<<12|(63&l)<<6|63&h)>65535&&u<1114112&&(o=u)}}null===o?(o=65533,a=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|1023&o),n.push(o),s+=a}return I(n)}function I(e){var t=e.length;if(t<=Z)return String.fromCharCode.apply(String,e);for(var i="",n=0;nn)&&(i=n);for(var s="",r=t;ri)throw new RangeError("Trying to access beyond buffer length")}function O(e,t,i,n,s,o){if(!r.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>s||te.length)throw new RangeError("Index out of range")}function L(e,t,i,n){t<0&&(t=65535+t+1);for(var s=0,r=Math.min(e.length-i,2);s>>8*(n?s:1-s)}function U(e,t,i,n){t<0&&(t=4294967295+t+1);for(var s=0,r=Math.min(e.length-i,4);s>>8*(n?s:3-s)&255}function P(e,t,i,n,s,r){if(i+n>e.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("Index out of range")}function j(e,t,i,n,s){return s||P(e,t,i,4,3.4028234663852886e38,-3.4028234663852886e38),J.write(e,t,i,n,23,4),i+4}function G(e,t,i,n,s){return s||P(e,t,i,8,1.7976931348623157e308,-1.7976931348623157e308),J.write(e,t,i,n,52,8),i+8}function B(e){if((e=q(e).replace(Q,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}function q(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function H(e){return e<16?"0"+e.toString(16):e.toString(16)}function z(e,t){t=t||1/0;for(var i,n=e.length,s=null,r=[],o=0;o55295&&i<57344){if(!s){if(i>56319){(t-=3)>-1&&r.push(239,191,189);continue}if(o+1===n){(t-=3)>-1&&r.push(239,191,189);continue}s=i;continue}if(i<56320){(t-=3)>-1&&r.push(239,191,189),s=i;continue}i=65536+(s-55296<<10|i-56320)}else s&&(t-=3)>-1&&r.push(239,191,189);if(s=null,i<128){if((t-=1)<0)break;r.push(i)}else if(i<2048){if((t-=2)<0)break;r.push(i>>6|192,63&i|128)}else if(i<65536){if((t-=3)<0)break;r.push(i>>12|224,i>>6&63|128,63&i|128)}else{if(!(i<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;r.push(i>>18|240,i>>12&63|128,i>>6&63|128,63&i|128)}}return r}function V(e){for(var t=[],i=0;i>8,s=i%256,r.push(s),r.push(n);return r}function W(e){return K.toByteArray(B(e))}function F(e,t,i,n){for(var s=0;s=t.length||s>=e.length);++s)t[s+i]=e[s];return s}function Y(e){return e!==e}var K=i(81),J=i(82),X=i(48);t.Buffer=r,t.SlowBuffer=function(e){return+e!=e&&(e=0),r.alloc(+e)},t.INSPECT_MAX_BYTES=50,r.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}(),t.kMaxLength=n(),r.poolSize=8192,r._augment=function(e){return e.__proto__=r.prototype,e},r.from=function(e,t,i){return o(null,e,t,i)},r.TYPED_ARRAY_SUPPORT&&(r.prototype.__proto__=Uint8Array.prototype,r.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&r[Symbol.species]===r&&Object.defineProperty(r,Symbol.species,{value:null,configurable:!0})),r.alloc=function(e,t,i){return c(null,e,t,i)},r.allocUnsafe=function(e){return l(null,e)},r.allocUnsafeSlow=function(e){return l(null,e)},r.isBuffer=function(e){return!(null==e||!e._isBuffer)},r.compare=function(e,t){if(!r.isBuffer(e)||!r.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var i=e.length,n=t.length,s=0,o=Math.min(i,n);s0&&(e=this.toString("hex",0,i).match(/.{2}/g).join(" "),this.length>i&&(e+=" ... ")),""},r.prototype.compare=function(e,t,i,n,s){if(!r.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===i&&(i=e?e.length:0),void 0===n&&(n=0),void 0===s&&(s=this.length),t<0||i>e.length||n<0||s>this.length)throw new RangeError("out of range index");if(n>=s&&t>=i)return 0;if(n>=s)return-1;if(t>=i)return 1;if(t>>>=0,i>>>=0,n>>>=0,s>>>=0,this===e)return 0;for(var o=s-n,a=i-t,c=Math.min(o,a),l=this.slice(n,s),h=e.slice(t,i),u=0;us)&&(i=s),e.length>0&&(i<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var r=!1;;)switch(n){case"hex":return y(this,e,t,i);case"utf8":case"utf-8":return b(this,e,t,i);case"ascii":return w(this,e,t,i);case"latin1":case"binary":return x(this,e,t,i);case"base64":return A(this,e,t,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,e,t,i);default:if(r)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),r=!0}},r.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Z=4096;r.prototype.slice=function(e,t){var i=this.length;e=~~e,t=void 0===t?i:~~t,e<0?(e+=i)<0&&(e=0):e>i&&(e=i),t<0?(t+=i)<0&&(t=0):t>i&&(t=i),t0&&(s*=256);)n+=this[e+--t]*s;return n},r.prototype.readUInt8=function(e,t){return t||M(e,1,this.length),this[e]},r.prototype.readUInt16LE=function(e,t){return t||M(e,2,this.length),this[e]|this[e+1]<<8},r.prototype.readUInt16BE=function(e,t){return t||M(e,2,this.length),this[e]<<8|this[e+1]},r.prototype.readUInt32LE=function(e,t){return t||M(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},r.prototype.readUInt32BE=function(e,t){return t||M(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},r.prototype.readIntLE=function(e,t,i){e|=0,t|=0,i||M(e,t,this.length);for(var n=this[e],s=1,r=0;++r=s&&(n-=Math.pow(2,8*t)),n},r.prototype.readIntBE=function(e,t,i){e|=0,t|=0,i||M(e,t,this.length);for(var n=t,s=1,r=this[e+--n];n>0&&(s*=256);)r+=this[e+--n]*s;return s*=128,r>=s&&(r-=Math.pow(2,8*t)),r},r.prototype.readInt8=function(e,t){return t||M(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},r.prototype.readInt16LE=function(e,t){t||M(e,2,this.length);var i=this[e]|this[e+1]<<8;return 32768&i?4294901760|i:i},r.prototype.readInt16BE=function(e,t){t||M(e,2,this.length);var i=this[e+1]|this[e]<<8;return 32768&i?4294901760|i:i},r.prototype.readInt32LE=function(e,t){return t||M(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},r.prototype.readInt32BE=function(e,t){return t||M(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},r.prototype.readFloatLE=function(e,t){return t||M(e,4,this.length),J.read(this,e,!0,23,4)},r.prototype.readFloatBE=function(e,t){return t||M(e,4,this.length),J.read(this,e,!1,23,4)},r.prototype.readDoubleLE=function(e,t){return t||M(e,8,this.length),J.read(this,e,!0,52,8)},r.prototype.readDoubleBE=function(e,t){return t||M(e,8,this.length),J.read(this,e,!1,52,8)},r.prototype.writeUIntLE=function(e,t,i,n){e=+e,t|=0,i|=0,n||O(this,e,t,i,Math.pow(2,8*i)-1,0);var s=1,r=0;for(this[t]=255&e;++r=0&&(r*=256);)this[t+s]=e/r&255;return t+i},r.prototype.writeUInt8=function(e,t,i){return e=+e,t|=0,i||O(this,e,t,1,255,0),r.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},r.prototype.writeUInt16LE=function(e,t,i){return e=+e,t|=0,i||O(this,e,t,2,65535,0),r.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):L(this,e,t,!0),t+2},r.prototype.writeUInt16BE=function(e,t,i){return e=+e,t|=0,i||O(this,e,t,2,65535,0),r.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):L(this,e,t,!1),t+2},r.prototype.writeUInt32LE=function(e,t,i){return e=+e,t|=0,i||O(this,e,t,4,4294967295,0),r.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):U(this,e,t,!0),t+4},r.prototype.writeUInt32BE=function(e,t,i){return e=+e,t|=0,i||O(this,e,t,4,4294967295,0),r.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):U(this,e,t,!1),t+4},r.prototype.writeIntLE=function(e,t,i,n){if(e=+e,t|=0,!n){var s=Math.pow(2,8*i-1);O(this,e,t,i,s-1,-s)}var r=0,o=1,a=0;for(this[t]=255&e;++r>0)-a&255;return t+i},r.prototype.writeIntBE=function(e,t,i,n){if(e=+e,t|=0,!n){var s=Math.pow(2,8*i-1);O(this,e,t,i,s-1,-s)}var r=i-1,o=1,a=0;for(this[t+r]=255&e;--r>=0&&(o*=256);)e<0&&0===a&&0!==this[t+r+1]&&(a=1),this[t+r]=(e/o>>0)-a&255;return t+i},r.prototype.writeInt8=function(e,t,i){return e=+e,t|=0,i||O(this,e,t,1,127,-128),r.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},r.prototype.writeInt16LE=function(e,t,i){return e=+e,t|=0,i||O(this,e,t,2,32767,-32768),r.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):L(this,e,t,!0),t+2},r.prototype.writeInt16BE=function(e,t,i){return e=+e,t|=0,i||O(this,e,t,2,32767,-32768),r.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):L(this,e,t,!1),t+2},r.prototype.writeInt32LE=function(e,t,i){return e=+e,t|=0,i||O(this,e,t,4,2147483647,-2147483648),r.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):U(this,e,t,!0),t+4},r.prototype.writeInt32BE=function(e,t,i){return e=+e,t|=0,i||O(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),r.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):U(this,e,t,!1),t+4},r.prototype.writeFloatLE=function(e,t,i){return j(this,e,t,!0,i)},r.prototype.writeFloatBE=function(e,t,i){return j(this,e,t,!1,i)},r.prototype.writeDoubleLE=function(e,t,i){return G(this,e,t,!0,i)},r.prototype.writeDoubleBE=function(e,t,i){return G(this,e,t,!1,i)},r.prototype.copy=function(e,t,i,n){if(i||(i=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t=0;--s)e[s+t]=this[s+i];else if(o<1e3||!r.TYPED_ARRAY_SUPPORT)for(s=0;s>>=0,i=void 0===i?this.length:i>>>0,e||(e=0);var o;if("number"==typeof e)for(o=t;oObject.prototype.hasOwnProperty.call(e,t);class Util{constructor(){throw new Error(`The ${this.constructor.name} class may not be instantiated.`)}static splitMessage(e,{maxLength:t=1950,char:i="\n",prepend:n="",append:s=""}={}){if(e.length<=t)return e;const r=e.split(i);if(1===r.length)throw new a("SPLIT_MAX_LEN");const o=[""];let c=0;for(let e=0;et&&(o[c]+=s,o.push(n),c++),o[c]+=(o[c].length>0&&o[c]!==n?i:"")+r[e];return o.filter(e=>e)}static escapeMarkdown(e,t=!1,i=!1){return t?e.replace(/```/g,"`​``"):i?e.replace(/\\(`|\\)/g,"$1").replace(/(`|\\)/g,"\\$1"):e.replace(/\\(\*|_|`|~|\\)/g,"$1").replace(/(\*|_|`|~|\\)/g,"\\$1")}static fetchRecommendedShards(e,t=1e3){return new Promise((i,a)=>{if(!e)throw new o("TOKEN_MISSING");n.get(`${r.api}/v${r.version}${s.Endpoints.botGateway}`).set("Authorization",`Bot ${e.replace(/^Bot\s*/i,"")}`).end((e,n)=>{e&&a(e),i(n.body.shards*(1e3/t))})})}static parseEmoji(e){if(e.includes("%")&&(e=decodeURIComponent(e)),e.includes(":")){const[t,i]=e.split(":");return{name:t,id:i}}return{name:e,id:null}}static arraysEqual(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(const i of e){const e=t.indexOf(i);-1!==e&&t.splice(e,1)}return 0===t.length}static cloneObject(e){return Object.assign(Object.create(e),e)}static mergeDefault(e,t){if(!t)return e;for(const i in e)l(t,i)&&void 0!==t[i]?t[i]===Object(t[i])&&(t[i]=this.mergeDefault(e[i],t[i])):t[i]=e[i];return t}static convertToBuffer(e){return"string"==typeof e&&(e=this.str2ab(e)),t.from(e)}static str2ab(e){const t=new ArrayBuffer(2*e.length),i=new Uint16Array(t);for(var n=0,s=e.length;n-1&&i16777215)throw new a("COLOR_RANGE");if(e&&isNaN(e))throw new c("COLOR_CONVERT");return e}}e.exports=Util}).call(t,i(5).Buffer)},function(e,t){function i(){throw new Error("setTimeout has not been defined")}function n(){throw new Error("clearTimeout has not been defined")}function s(e){if(h===setTimeout)return setTimeout(e,0);if((h===i||!h)&&setTimeout)return h=setTimeout,setTimeout(e,0);try{return h(e,0)}catch(t){try{return h.call(null,e,0)}catch(t){return h.call(this,e,0)}}}function r(e){if(u===clearTimeout)return clearTimeout(e);if((u===n||!u)&&clearTimeout)return u=clearTimeout,clearTimeout(e);try{return u(e)}catch(t){try{return u.call(null,e)}catch(t){return u.call(this,e)}}}function o(){m&&d&&(m=!1,d.length?f=d.concat(f):g=-1,f.length&&a())}function a(){if(!m){var e=s(o);m=!0;for(var t=f.length;t;){for(d=f,f=[];++g1)for(var i=1;i=t?String(e):(String(i).repeat(t)+e).slice(-t)}const s=i(43),r=14200704e5;let o=0;class SnowflakeUtil{constructor(){throw new Error(`The ${this.constructor.name} class may not be instantiated.`)}static generate(){o>=4095&&(o=0);const e=`${n((Date.now()-r).toString(2),42)}0000100000${n((o++).toString(2),12)}`;return s.fromString(e,2).toString()}static deconstruct(e){const t=n(s.fromString(e).toString(2),64),i={timestamp:parseInt(t.substring(0,42),2)+r,workerID:parseInt(t.substring(42,47),2),processID:parseInt(t.substring(47,52),2),increment:parseInt(t.substring(52,64),2),binary:t};return Object.defineProperty(i,"date",{get:function(){return new Date(this.timestamp)},enumerable:!0}),i}}e.exports=SnowflakeUtil},function(e,t){class Base{constructor(e){Object.defineProperty(this,"client",{value:e})}_clone(){return Object.assign(Object.create(this),this)}_patch(e){return e}_update(e){const t=this._clone();return this._patch(e),t}}e.exports=Base},function(e,t,i){const n=i(3);class DataStore extends n{constructor(e,t,i){if(super(),Object.defineProperty(this,"client",{value:e}),Object.defineProperty(this,"holds",{value:i}),t)for(const e of t)this.create(e)}create(e,t=!0,{id:i,extras:n=[]}={}){const s=this.get(i||e.id);if(s)return s;const r=this.holds?new this.holds(this.client,e,...n):e;return t&&this.set(i||r.id,r),r}remove(e){return this.delete(e)}resolve(e){return e instanceof this.holds?e:"string"==typeof e?this.get(e)||null:null}resolveID(e){return e instanceof this.holds?e.id:"string"==typeof channel?e:null}}e.exports=DataStore},function(e,t,i){const{RangeError:n}=i(4);class Permissions{constructor(e){this.bitfield="number"==typeof e?e:this.constructor.resolve(e)}has(e,t=!0){return e instanceof Array?e.every(e=>this.has(e,t)):(e=this.constructor.resolve(e),!!(t&&(this.bitfield&this.constructor.FLAGS.ADMINISTRATOR)>0)||(this.bitfield&e)===e)}missing(e,t=!0){return e.filter(e=>!this.has(e,t))}add(...e){let t=0;for(let i=0;ithis.resolve(e)).reduce((e,t)=>e|t,0);if("string"==typeof e&&(e=this.FLAGS[e]),"number"!=typeof e||e<1)throw new n("PERMISSION_INVALID");return e}}Permissions.FLAGS={CREATE_INSTANT_INVITE:1,KICK_MEMBERS:2,BAN_MEMBERS:4,ADMINISTRATOR:8,MANAGE_CHANNELS:16,MANAGE_GUILD:32,ADD_REACTIONS:64,VIEW_AUDIT_LOG:128,VIEW_CHANNEL:1024,SEND_MESSAGES:2048,SEND_TTS_MESSAGES:4096,MANAGE_MESSAGES:8192,EMBED_LINKS:16384,ATTACH_FILES:32768,READ_MESSAGE_HISTORY:65536,MENTION_EVERYONE:1<<17,USE_EXTERNAL_EMOJIS:1<<18,CONNECT:1<<20,SPEAK:1<<21,MUTE_MEMBERS:1<<22,DEAFEN_MEMBERS:1<<23,MOVE_MEMBERS:1<<24,USE_VAD:1<<25,CHANGE_NICKNAME:1<<26,MANAGE_NICKNAMES:1<<27,MANAGE_ROLES:1<<28,MANAGE_WEBHOOKS:1<<29,MANAGE_EMOJIS:1<<30},Permissions.ALL=Object.values(Permissions.FLAGS).reduce((e,t)=>e|t,0),Permissions.DEFAULT=104324097,e.exports=Permissions},function(e,t,i){(function(t){const n=i(25),s=i(30),r=i(36),o=i(7),{Error:a,TypeError:c}=i(4);class DataResolver{constructor(){throw new a(`The ${this.constructor.name} class may not be instantiated.`)}static resolveInviteCode(e){const t=/discord(?:app\.com\/invite|\.gg)\/([\w-]{2,255})/i.exec(e);return t&&t[1]?t[1]:e}static async resolveImage(e,t){if(!e)return null;if("string"==typeof e&&e.startsWith("data:"))return e;const i=await this.resolveFile(e,t);return this.constructor.resolveBase64(i)}static resolveBase64(e){return e instanceof t?`data:image/jpg;base64,${e.toString("base64")}`:e}static resolveFile(e,i){return e instanceof t?Promise.resolve(e):i&&e instanceof ArrayBuffer?Promise.resolve(o.convertToBuffer(e)):"string"==typeof e?new Promise((i,o)=>{if(/^https?:\/\//.test(e))r.get(e).end((e,n)=>e?o(e):n.body instanceof t?i(n.body):o(new c("REQ_BODY_TYPE")));else{const t=n.resolve(e);s.stat(t,(e,n)=>e?o(e):n&&n.isFile()?(s.readFile(t,(e,t)=>{e?o(e):i(t)}),null):o(new a("FILE_NOT_FOUND",t)))}}):e.pipe&&"function"==typeof e.pipe?new Promise((i,n)=>{const s=[];e.once("error",n),e.on("data",e=>s.push(e)),e.once("end",()=>i(t.concat(s)))}):Promise.reject(new c("REQ_RESOURCE_TYPE"))}}e.exports=DataResolver}).call(t,i(5).Buffer)},function(e,t){function i(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function n(e){return"function"==typeof e}function s(e){return"number"==typeof e}function r(e){return"object"==typeof e&&null!==e}function o(e){return void 0===e}e.exports=i,i.EventEmitter=i,i.prototype._events=void 0,i.prototype._maxListeners=void 0,i.defaultMaxListeners=10,i.prototype.setMaxListeners=function(e){if(!s(e)||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},i.prototype.emit=function(e){var t,i,s,a,c,l;if(this._events||(this._events={}),"error"===e&&(!this._events.error||r(this._events.error)&&!this._events.error.length)){if((t=arguments[1])instanceof Error)throw t;var h=new Error('Uncaught, unspecified "error" event. ('+t+")");throw h.context=t,h}if(i=this._events[e],o(i))return!1;if(n(i))switch(arguments.length){case 1:i.call(this);break;case 2:i.call(this,arguments[1]);break;case 3:i.call(this,arguments[1],arguments[2]);break;default:a=Array.prototype.slice.call(arguments,1),i.apply(this,a)}else if(r(i))for(a=Array.prototype.slice.call(arguments,1),s=(l=i.slice()).length,c=0;c0&&this._events[e].length>s&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace()),this},i.prototype.on=i.prototype.addListener,i.prototype.once=function(e,t){function i(){this.removeListener(e,i),s||(s=!0,t.apply(this,arguments))}if(!n(t))throw TypeError("listener must be a function");var s=!1;return i.listener=t,this.on(e,i),this},i.prototype.removeListener=function(e,t){var i,s,o,a;if(!n(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(i=this._events[e],o=i.length,s=-1,i===t||n(i.listener)&&i.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(r(i)){for(a=o;a-- >0;)if(i[a]===t||i[a].listener&&i[a].listener===t){s=a;break}if(s<0)return this;1===i.length?(i.length=0,delete this._events[e]):i.splice(s,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},i.prototype.removeAllListeners=function(e){var t,i;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(i=this._events[e],n(i))this.removeListener(e,i);else if(i)for(;i.length;)this.removeListener(e,i[i.length-1]);return delete this._events[e],this},i.prototype.listeners=function(e){return this._events&&this._events[e]?n(this._events[e])?[this._events[e]]:this._events[e].slice():[]},i.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(n(t))return 1;if(t)return t.length}return 0},i.listenerCount=function(e,t){return e.listenerCount(t)}},function(e,t){"function"==typeof Object.create?e.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(e,t){e.super_=t;var i=function(){};i.prototype=t.prototype,e.prototype=new i,e.prototype.constructor=e}},function(e,t,i){"use strict";function n(e){if(!(this instanceof n))return new n(e);l.call(this,e),h.call(this,e),e&&!1===e.readable&&(this.readable=!1),e&&!1===e.writable&&(this.writable=!1),this.allowHalfOpen=!0,e&&!1===e.allowHalfOpen&&(this.allowHalfOpen=!1),this.once("end",s)}function s(){this.allowHalfOpen||this._writableState.ended||o(r,this)}function r(e){e.end()}var o=i(29),a=Object.keys||function(e){var t=[];for(var i in e)t.push(i);return t};e.exports=n;var c=i(24);c.inherits=i(15);var l=i(49),h=i(39);c.inherits(n,l);for(var u=a(h.prototype),p=0;pthis)}static create(e,t,n){const s=i(65),o=i(69),a=i(70),c=i(72),l=i(21),h=r.ChannelTypes;let u;if(t.type===h.DM)u=new s(e,t);else if(t.type===h.GROUP)u=new o(e,t);else if(n=n||e.guilds.get(t.guild_id)){switch(t.type){case h.TEXT:u=new a(n,t);break;case h.VOICE:u=new c(n,t);break;default:u=new l(n,t)}n.channels.set(u.id,u)}return u}}e.exports=Channel},function(e,t,i){const n=i(26),s=i(27),r=i(12),o=i(3),a=i(10),{Presence:c}=i(19),{Error:l,TypeError:h}=i(4);class GuildMember extends a{constructor(e,t,i){super(e),this.guild=i,this.user={},this._roles=[],t&&this._patch(t),this.lastMessageID=null,this.lastMessage=null}_patch(e){void 0===this.speaking&&(this.speaking=!1),void 0!==e.nick&&(this.nickname=e.nick),void 0!==e.joined_at&&(this.joinedTimestamp=new Date(e.joined_at).getTime()),this.user=this.guild.client.users.create(e.user),e.roles&&(this._roles=e.roles)}get voiceState(){return this._frozenVoiceState||this.guild.voiceStates.get(this.id)||{}}get serverDeaf(){return this.voiceState.deaf}get serverMute(){return this.voiceState.mute}get selfMute(){return this.voiceState.self_mute}get selfDeaf(){return this.voiceState.self_deaf}get voiceSessionID(){return this.voiceState.session_id}get voiceChannelID(){return this.voiceState.channel_id}get joinedAt(){return new Date(this.joinedTimestamp)}get presence(){return this.frozenPresence||this.guild.presences.get(this.id)||new c}get roles(){const e=new o,t=this.guild.roles.get(this.guild.id);t&&e.set(t.id,t);for(const t of this._roles){const i=this.guild.roles.get(t);i&&e.set(i.id,i)}return e}get highestRole(){return this.roles.reduce((e,t)=>!e||t.comparePositionTo(e)>0?t:e)}get colorRole(){const e=this.roles.filter(e=>e.color);return e.size?e.reduce((e,t)=>!e||t.comparePositionTo(e)>0?t:e):null}get displayColor(){const e=this.colorRole;return e&&e.color||0}get displayHexColor(){const e=this.colorRole;return e&&e.hexColor||"#000000"}get hoistRole(){const e=this.roles.filter(e=>e.hoist);return e.size?e.reduce((e,t)=>!e||t.comparePositionTo(e)>0?t:e):null}get mute(){return this.selfMute||this.serverMute}get deaf(){return this.selfDeaf||this.serverDeaf}get voiceChannel(){return this.guild.channels.get(this.voiceChannelID)}get id(){return this.user.id}get displayName(){return this.nickname||this.user.username}get permissions(){if(this.user.id===this.guild.ownerID)return new r(r.ALL);let e=0;const t=this.roles;for(const i of t.values())e|=i.permissions;return new r(e)}get kickable(){if(this.user.id===this.guild.ownerID)return!1;if(this.user.id===this.client.user.id)return!1;const e=this.guild.member(this.client.user);return!!e.permissions.has(r.FLAGS.KICK_MEMBERS)&&e.highestRole.comparePositionTo(this.highestRole)>0}get bannable(){if(this.user.id===this.guild.ownerID)return!1;if(this.user.id===this.client.user.id)return!1;const e=this.guild.member(this.client.user);return!!e.permissions.has(r.FLAGS.BAN_MEMBERS)&&e.highestRole.comparePositionTo(this.highestRole)>0}permissionsIn(e){if(!(e=this.client.channels.resolve(e))||!e.guild)throw new l("GUILD_CHANNEL_RESOLVE");return e.permissionsFor(this)}hasPermission(e,t=!1,i,n){return void 0===i&&(i=!t),void 0===n&&(n=!t),!(!n||this.user.id!==this.guild.ownerID)||this.roles.some(t=>t.hasPermission(e,void 0,i))}missingPermissions(e,t=!1){return e.missing(e,t)}edit(e,t){e.channel&&(e.channel_id=this.client.channels.resolve(e.channel).id,e.channel=null),e.roles&&(e.roles=e.roles.map(e=>e instanceof s?e.id:e));let i=this.client.api.guilds(this.guild.id);if(this.user.id===this.client.user.id){const t=Object.keys(e);i=1===t.length&&"nick"===t[0]?i.members("@me").nick:i.members(this.id)}else i=i.members(this.id);return i.patch({data:e,reason:t}).then(()=>{const t=this._clone();return e.user=this.user,t._patch(e),t._frozenVoiceState=this.voiceState,void 0!==e.mute&&(t._frozenVoiceState.mute=e.mute),void 0!==e.deaf&&(t._frozenVoiceState.mute=e.deaf),void 0!==e.channel_id&&(t._frozenVoiceState.channel_id=e.channel_id),t})}setMute(e,t){return this.edit({mute:e},t)}setDeaf(e,t){return this.edit({deaf:e},t)}setVoiceChannel(e){return this.edit({channel:e})}setRoles(e,t){return this.edit({roles:e},t)}addRole(e,t){return(e=this.guild.roles.resolve(e))?this._roles.includes(e.id)?Promise.resolve(this):this.client.api.guilds(this.guild.id).members(this.user.id).roles(e.id).put({reason:t}).then(()=>{const t=this._clone();return t._roles.includes(e.id)||t._roles.push(e.id),t}):Promise.reject(new h("INVALID_TYPE","role","Role nor a Snowflake"))}addRoles(e,t){let i=this._roles.slice();for(let t of e instanceof o?e.values():e){if(!(t=this.guild.roles.resolve(t)))return Promise.reject(new h("INVALID_TYPE","roles","Array or Collection of Roles or Snowflakes",!0));i.push(t.id)}return this.edit({roles:i},t)}removeRole(e,t){return(e=this.guild.roles.resolve(e))?this._roles.includes(e.id)?this.client.api.guilds(this.guild.id).members(this.user.id).roles(e.id).delete({reason:t}).then(()=>{const t=this._clone(),i=t._roles.indexOf(e.id);return~i&&t._roles.splice(i,1),t}):Promise.resolve(this):Promise.reject(new h("INVALID_TYPE","role","Role nor a Snowflake"))}removeRoles(e,t){const i=this._roles.slice();for(let t of e instanceof o?e.values():e){if(!(t=this.guild.roles.resolve(t)))return Promise.reject(new h("INVALID_TYPE","roles","Array or Collection of Roles or Snowflakes",!0));const e=i.indexOf(t.id);e>=0&&i.splice(e,1)}return this.edit({roles:i},t)}setNickname(e,t){return this.edit({nick:e},t)}createDM(){return this.user.createDM()}deleteDM(){return this.user.deleteDM()}kick(e){return this.client.api.guilds(this.guild.id).members(this.user.id).delete({reason:e}).then(()=>this.client.actions.GuildMemberRemove.handle({guild_id:this.guild.id,user:this.user}).member)}ban(e){return this.guild.ban(this,e)}toString(){return`<@${this.nickname?"!":""}${this.user.id}>`}send(){}}n.applyToClass(GuildMember),e.exports=GuildMember},function(e,t,i){const n=i(0);class Presence{constructor(e,t={}){Object.defineProperty(this,"client",{value:e}),this.patch(t)}patch(e){this.status=e.status||this.status;const t=e.game||e.activity;return this.activity=t?new Activity(this,t):null,this}_clone(){const e=Object.assign(Object.create(this),this);return this.activity&&(e.activity=this.activity._clone()),e}equals(e){return this===e||(e&&this.status===e.status&&this.activity?this.activity.equals(e.activity):!e.activity)}}class Activity{constructor(e,t){Object.defineProperty(this,"presence",{value:e}),this.name=t.name,this.type=n.ActivityTypes[t.type],this.url=t.url||null,this.details=t.details||null,this.state=t.state||null,this.applicationID=t.application_id||null,this.timestamps=t.timestamps?{start:t.timestamps.start?new Date(t.timestamps.start):null,end:t.timestamps.end?new Date(t.timestamps.end):null}:null,this.party=t.party||null,this.assets=t.assets?new RichPresenceAssets(this,t.assets):null}equals(e){return this===e||e&&this.name===e.name&&this.type===e.type&&this.url===e.url}_clone(){return Object.assign(Object.create(this),this)}}class RichPresenceAssets{constructor(e,t){Object.defineProperty(this,"activity",{value:e}),this.largeText=t.large_text||null,this.smallText=t.small_text||null,this.largeImage=t.large_image||null,this.smallImage=t.small_image||null}smallImageURL({format:e,size:t}={}){return this.smallImage?this.activity.presence.client.rest.cdn.AppAsset(this.activity.applicationID,this.smallImage,{format:e,size:t}):null}largeImageURL({format:e,size:t}={}){return this.largeImage?this.activity.presence.client.rest.cdn.AppAsset(this.activity.applicationID,this.largeImage,{format:e,size:t}):null}}t.Presence=Presence,t.Activity=Activity,t.RichPresenceAssets=RichPresenceAssets},function(e,t,i){const n=i(28),s=i(7),{RangeError:r}=i(4);class MessageEmbed{constructor(e={}){this.setup(e)}setup(e){if(this.type=e.type,this.title=e.title,this.description=e.description,this.url=e.url,this.color=e.color,this.timestamp=e.timestamp?new Date(e.timestamp).getTime():null,this.fields=e.fields||[],this.thumbnail=e.thumbnail?{url:e.thumbnail.url,proxyURL:e.thumbnail.proxy_url,height:e.height,width:e.width}:null,this.image=e.image?{url:e.image.url,proxyURL:e.image.proxy_url,height:e.height,width:e.width}:null,this.video=e.video,this.author=e.author?{name:e.author.name,url:e.author.url,iconURL:e.author.iconURL||e.author.icon_url,proxyIconURL:e.author.proxyIconUrl||e.author.proxy_icon_url}:null,this.provider=e.provider,this.footer=e.footer?{text:e.footer.text,iconURL:e.footer.iconURL||e.footer.icon_url,proxyIconURL:e.footer.proxyIconURL||e.footer.proxy_icon_url}:null,e.files)for(let t of e.files)t instanceof n&&(t=t.file);else e.files=null}get createdAt(){return this.timestamp?new Date(this.timestamp):null}get hexColor(){return this.color?`#${this.color.toString(16).padStart(6,"0")}`:null}addField(e,t,i=!1){if(this.fields.length>=25)throw new r("EMBED_FIELD_COUNT");if(e=s.resolveString(e),!String(e)||e.length>256)throw new r("EMBED_FIELD_NAME");if(t=s.resolveString(t),!String(t)||t.length>1024)throw new r("EMBED_FIELD_VALUE");return this.fields.push({name:e,value:t,inline:i}),this}addBlankField(e=!1){return this.addField("​","​",e)}attachFiles(e){this.files?this.files=this.files.concat(e):this.files=e;for(let t of e)t instanceof n&&(t=t.file);return this}setAuthor(e,t,i){return this.author={name:s.resolveString(e),iconURL:t,url:i},this}setColor(e){return this.color=s.resolveColor(e),this}setDescription(e){if((e=s.resolveString(e)).length>2048)throw new r("EMBED_DESCRIPTION");return this.description=e,this}setFooter(e,t){if((e=s.resolveString(e)).length>2048)throw new r("EMBED_FOOTER_TEXT");return this.footer={text:e,iconURL:t},this}setImage(e){return this.image={url:e},this}setThumbnail(e){return this.thumbnail={url:e},this}setTimestamp(e=new Date){return this.timestamp=e.getTime(),this}setTitle(e){if((e=s.resolveString(e)).length>256)throw new r("EMBED_TITLE");return this.title=e,this}setURL(e){return this.url=e,this}_apiTransform(){return{title:this.title,type:"rich",description:this.description,url:this.url,timestamp:this.timestamp?new Date(this.timestamp):null,color:this.color,fields:this.fields,files:this.files,thumbnail:this.thumbnail,image:this.image,author:this.author?{name:this.author.name,url:this.author.url,icon_url:this.author.iconURL}:null,footer:this.footer?{text:this.footer.text,icon_url:this.footer.iconURL}:null}}}e.exports=MessageEmbed},function(e,t,i){const n=i(17),s=i(27),r=i(34),o=i(71),a=i(12),c=i(3),l=i(0),{TypeError:h}=i(4);class GuildChannel extends n{constructor(e,t){super(e.client,t),this.guild=e}_patch(e){if(super._patch(e),this.name=e.name,this.position=e.position,this.permissionOverwrites=new c,e.permission_overwrites)for(const t of e.permission_overwrites)this.permissionOverwrites.set(t.id,new o(this,t))}get calculatedPosition(){const e=this.guild._sortedChannels(this.type);return e.array().indexOf(e.get(this.id))}permissionsFor(e){if(!(e=this.guild.members.resolve(e)))return null;if(e.id===this.guild.ownerID)return new a(a.ALL);let t=0;const i=e.roles;for(const e of i.values())t|=e.permissions;const n=this.overwritesFor(e,!0,i);n.everyone&&(t&=~n.everyone._denied,t|=n.everyone._allowed);let s=0;for(const e of n.roles)t&=~e._denied,s|=e._allowed;return t|=s,n.member&&(t&=~n.member._denied,t|=n.member._allowed),Boolean(t&a.FLAGS.ADMINISTRATOR)&&(t=a.ALL),new a(t)}overwritesFor(e,t=!1,i=null){if(t||(e=this.guild.members.resolve(e)),!e)return[];i=i||e.roles;const n=[];let s,r;for(const t of this.permissionOverwrites.values())t.id===this.guild.id?r=t:i.has(t.id)?n.push(t):t.id===e.id&&(s=t);return{everyone:r,roles:n,member:s}}overwritePermissions(e,t,i){const n={allow:0,deny:0},r=this.guild.roles.get(e);if(r||e instanceof s)e=r||e,n.type="role";else if(e=this.client.users.resolve(e),n.type="member",!e)return Promise.reject(new h("INVALID_TYPE","parameter","User nor a Role",!0));n.id=e.id;const o=this.permissionOverwrites.get(e.id);o&&(n.allow=o._allowed,n.deny=o._denied);for(const e in t)!0===t[e]?(n.allow|=a.FLAGS[e]||0,n.deny&=~(a.FLAGS[e]||0)):!1===t[e]?(n.allow&=~(a.FLAGS[e]||0),n.deny|=a.FLAGS[e]||0):null===t[e]&&(n.allow&=~(a.FLAGS[e]||0),n.deny&=~(a.FLAGS[e]||0));return this.client.api.channels(this.id).permissions[n.id].put({data:n,reason:i}).then(()=>this)}get members(){const e=new c;for(const t of this.guild.members.values())this.permissionsFor(t).has("VIEW_CHANNEL")&&e.set(t.id,t);return e}edit(e,t){return this.client.api.channels(this.id).patch({data:{name:(e.name||this.name).trim(),topic:e.topic||this.topic,position:e.position||this.position,bitrate:e.bitrate||(this.bitrate?1e3*this.bitrate:void 0),user_limit:e.userLimit||this.userLimit},reason:t}).then(e=>{const t=this._clone();return t._patch(e),t})}setName(e,t){return this.edit({name:e},t)}setPosition(e,t){return this.guild.setChannelPosition(this,e,t).then(()=>this)}setTopic(e,t){return this.edit({topic:e},t)}createInvite({temporary:e=!1,maxAge:t=86400,maxUses:i=0,unique:n,reason:s}={}){return this.client.api.channels(this.id).invites.post({data:{temporary:e,max_age:t,max_uses:i,unique:n},reason:s}).then(e=>new r(this.client,e))}clone({name:e=this.name,withPermissions:t=!0,withTopic:i=!0,reason:n}={}){const s={overwrites:t?this.permissionOverwrites:[],reason:n};return this.guild.createChannel(e,this.type,s).then(e=>i?e.setTopic(this.topic):e)}equals(e){let t=e&&this.id===e.id&&this.type===e.type&&this.topic===e.topic&&this.position===e.position&&this.name===e.name;return t&&(t=this.permissionOverwrites&&e.permissionOverwrites?this.permissionOverwrites.equals(e.permissionOverwrites):!this.permissionOverwrites&&!e.permissionOverwrites),t}get deletable(){return this.id!==this.guild.id&&this.permissionsFor(this.client.user).has(a.FLAGS.MANAGE_CHANNELS)}delete(e){return this.client.api.channels(this.id).delete({reason:e}).then(()=>this)}get muted(){if(this.client.user.bot)return null;try{return this.client.user.guildSettings.get(this.guild.id).channelOverrides.get(this.id).muted}catch(e){return!1}}get messageNotifications(){if(this.client.user.bot)return null;try{return this.client.user.guildSettings.get(this.guild.id).channelOverrides.get(this.id).messageNotifications}catch(e){return l.MessageNotificationTypes[3]}}toString(){return`<#${this.id}>`}}e.exports=GuildChannel},function(e,t,i){(function(t){const n=i(25),s=i(7),r=i(13),o=i(20),a=i(28),c=i(20);class Webhook{constructor(e,t){Object.defineProperty(this,"client",{value:e}),t&&this._patch(t)}_patch(e){this.name=e.name,this.token=e.token,this.avatar=e.avatar,this.id=e.id,this.guildID=e.guild_id,this.channelID=e.channel_id,e.user?this.owner=this.client.users?this.client.users.get(e.user.id):e.user:this.owner=null}send(e,i){if(i||"object"!=typeof e||e instanceof Array?i||(i={}):(i=e,e=""),i instanceof a&&(i={files:[i.file]}),i instanceof c&&(i={embeds:[i]}),i.embed&&(i={embeds:[i.embed]}),e instanceof Array||i instanceof Array){const t=e instanceof Array?e:i,n=t.filter(e=>e instanceof a),s=t.filter(e=>e instanceof c);n.length&&(i={files:n}),s.length&&(i={embeds:s}),(s.length||n.length)&&e instanceof Array&&(e="")}if(i.username||(i.username=this.name),i.avatarURL&&(i.avatar_url=i.avatarURL,i.avatarURL=null),e){e=s.resolveString(e);let{split:t,code:n,disableEveryone:r}=i;t&&"object"!=typeof t&&(t={}),void 0===n||"boolean"==typeof n&&!0!==n||(e=s.escapeMarkdown(e,!0),e=`\`\`\`${"boolean"!=typeof n?n||"":""}\n${e}\n\`\`\``,t&&(t.prepend=`\`\`\`${"boolean"!=typeof n?n||"":""}\n`,t.append="\n```")),(r||void 0===r&&this.client.options.disableEveryone)&&(e=e.replace(/@(everyone|here)/g,"@​$1")),t&&(e=s.splitMessage(e,t))}if(i.content=e,i.embeds&&(i.embeds=i.embeds.map(e=>new o(e)._apiTransform())),i.files){for(let e=0;er.resolveFile(e.attachment,this.client.browser).then(t=>(e.file=t,e)))).then(e=>this.client.api.webhooks(this.id,this.token).post({data:i,query:{wait:!0},files:e,auth:!1}))}return e instanceof Array?new Promise((t,n)=>{const s=[];(function r(){const o=e.length?null:{embeds:i.embeds,files:i.files};this.client.api.webhooks(this.id,this.token).post({data:{content:e.shift(),opt:o},query:{wait:!0},auth:!1}).then(i=>(s.push(i),0===e.length?t(s):r.call(this))).catch(n)}).call(this)}):this.client.api.webhooks(this.id,this.token).post({data:i,query:{wait:!0},auth:!1}).then(e=>this.client.channels?this.client.channels.get(e.channel_id).messages.create(e,!1):e)}sendSlackMessage(e){return this.client.api.webhooks(this.id,this.token).slack.post({query:{wait:!0},auth:!1,data:e}).then(e=>this.client.channels?this.client.channels.get(e.channel_id).messages.create(e,!1):e)}edit({name:e=this.name,avatar:t},i){return t&&"string"==typeof t&&!t.startsWith("data:")?r.resolveImage(t,this.client.browser).then(t=>this.edit({name:e,avatar:t},i)):this.client.api.webhooks(this.id,this.token).patch({data:{name:e,avatar:t},reason:i}).then(e=>(this.name=e.name,this.avatar=e.avatar,this))}delete(e){return this.client.api.webhooks(this.id,this.token).delete({reason:e})}static applyToClass(e){for(const t of["send","sendSlackMessage","edit","delete"])Object.defineProperty(e.prototype,t,Object.getOwnPropertyDescriptor(Webhook.prototype,t))}}e.exports=Webhook}).call(t,i(5).Buffer)},function(e,t,i){(t=e.exports=i(49)).Stream=t,t.Readable=t,t.Writable=i(39),t.Duplex=i(16),t.Transform=i(53),t.PassThrough=i(89)},function(e,t,i){(function(e){function i(e){return Object.prototype.toString.call(e)}t.isArray=function(e){return Array.isArray?Array.isArray(e):"[object Array]"===i(e)},t.isBoolean=function(e){return"boolean"==typeof e},t.isNull=function(e){return null===e},t.isNullOrUndefined=function(e){return null==e},t.isNumber=function(e){return"number"==typeof e},t.isString=function(e){return"string"==typeof e},t.isSymbol=function(e){return"symbol"==typeof e},t.isUndefined=function(e){return void 0===e},t.isRegExp=function(e){return"[object RegExp]"===i(e)},t.isObject=function(e){return"object"==typeof e&&null!==e},t.isDate=function(e){return"[object Date]"===i(e)},t.isError=function(e){return"[object Error]"===i(e)||e instanceof Error},t.isFunction=function(e){return"function"==typeof e},t.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},t.isBuffer=e.isBuffer}).call(t,i(5).Buffer)},function(e,t,i){(function(e){function i(e,t){for(var i=0,n=e.length-1;n>=0;n--){var s=e[n];"."===s?e.splice(n,1):".."===s?(e.splice(n,1),i++):i&&(e.splice(n,1),i--)}if(t)for(;i--;i)e.unshift("..");return e}function n(e,t){if(e.filter)return e.filter(t);for(var i=[],n=0;n=-1&&!s;r--){var o=r>=0?arguments[r]:e.cwd();if("string"!=typeof o)throw new TypeError("Arguments to path.resolve must be strings");o&&(t=o+"/"+t,s="/"===o.charAt(0))}return t=i(n(t.split("/"),function(e){return!!e}),!s).join("/"),(s?"/":"")+t||"."},t.normalize=function(e){var s=t.isAbsolute(e),r="/"===o(e,-1);return(e=i(n(e.split("/"),function(e){return!!e}),!s).join("/"))||s||(e="."),e&&r&&(e+="/"),(s?"/":"")+e},t.isAbsolute=function(e){return"/"===e.charAt(0)},t.join=function(){var e=Array.prototype.slice.call(arguments,0);return t.normalize(n(e,function(e,t){if("string"!=typeof e)throw new TypeError("Arguments to path.join must be strings");return e}).join("/"))},t.relative=function(e,i){function n(e){for(var t=0;t=0&&""===e[i];i--);return t>i?[]:e.slice(t,i-t+1)}e=t.resolve(e).substr(1),i=t.resolve(i).substr(1);for(var s=n(e.split("/")),r=n(i.split("/")),o=Math.min(s.length,r.length),a=o,c=0;ce instanceof l);t.length&&(i={files:t},e instanceof Array&&(e=""))}if(i.content||(i.content=e),i.embed&&i.embed.files&&(i.files?i.files=i.files.concat(i.embed.files):i.files=i.embed.files),i.files){for(let e=0;ec.resolveFile(e.attachment,this.client.browser).then(t=>(e.file=t,e)))).then(e=>(i.files=e,r.sendMessage(this,i)))}return r.sendMessage(this,i)}search(e={}){return r.search(this,e)}startTyping(e){if(void 0!==e&&e<1)throw new u("TYPING_COUNT");if(this.client.user._typing.has(this.id)){const t=this.client.user._typing.get(this.id);t.count=e||t.count+1}else{const t=this.client.api.channels[this.id].typing;this.client.user._typing.set(this.id,{count:e||1,interval:this.client.setInterval(()=>{t.post()},9e3)}),t.post()}}stopTyping(e=!1){if(this.client.user._typing.has(this.id)){const t=this.client.user._typing.get(this.id);t.count--,(t.count<=0||e)&&(this.client.clearInterval(t.interval),this.client.user._typing.delete(this.id))}}get typing(){return this.client.user._typing.has(this.id)}get typingCount(){return this.client.user._typing.has(this.id)?this.client.user._typing.get(this.id).count:0}createMessageCollector(e,t={}){return new s(this,e,t)}awaitMessages(e,t={}){return new Promise((i,n)=>{this.createMessageCollector(e,t).once("end",(e,s)=>{t.errors&&t.errors.includes(s)?n(e):i(e)})})}bulkDelete(e,t=!1){if(!isNaN(e))return this.messages.fetch({limit:e}).then(e=>this.bulkDelete(e,t));if(e instanceof Array||e instanceof a){let i=e instanceof a?e.keyArray():e.map(e=>e.id);return t&&(i=i.filter(e=>Date.now()-o.deconstruct(e).date.getTime()<12096e5)),this.client.api.channels[this.id].messages["bulk-delete"].post({data:{messages:i}}).then(()=>this.client.actions.MessageDeleteBulk.handle({channel_id:this.id,ids:i}).messages)}throw new p("MESSAGE_BULK_DELETE_TYPE")}acknowledge(){return this.lastMessageID?this.client.api.channels[this.id].messages[this.lastMessageID].ack.post({data:{token:this.client.rest._ackToken}}).then(e=>(e.token&&(this.client.rest._ackToken=e.token),this)):Promise.resolve(this)}static applyToClass(e,t=!1,i=[]){const n=["send"];t&&n.push("acknowledge","search","bulkDelete","startTyping","stopTyping","typing","typingCount","createMessageCollector","awaitMessages");for(const t of n)i.includes(t)||Object.defineProperty(e.prototype,t,Object.getOwnPropertyDescriptor(TextBasedChannel.prototype,t))}}e.exports=TextBasedChannel;const d=i(33)}).call(t,i(5).Buffer)},function(e,t,i){const n=i(9),s=i(12),r=i(7),o=i(10),{TypeError:a}=i(4);class Role extends o{constructor(e,t,i){super(e),this.guild=i,t&&this._patch(t)}_patch(e){this.id=e.id,this.name=e.name,this.color=e.color,this.hoist=e.hoist,this.position=e.position,this.permissions=e.permissions,this.managed=e.managed,this.mentionable=e.mentionable}get createdTimestamp(){return n.deconstruct(this.id).timestamp}get createdAt(){return new Date(this.createdTimestamp)}get hexColor(){let e=this.color.toString(16);for(;e.length<6;)e=`0${e}`;return`#${e}`}get members(){return this.guild.members.filter(e=>e.roles.has(this.id))}get editable(){if(this.managed)return!1;const e=this.guild.member(this.client.user);return!!e.permissions.has(s.FLAGS.MANAGE_ROLES)&&e.highestRole.comparePositionTo(this)>0}get calculatedPosition(){const e=this.guild._sortedRoles;return e.array().indexOf(e.get(this.id))}serialize(){return new s(this.permissions).serialize()}hasPermission(e,t=!1,i){return new s(this.permissions).has(e,void 0!==i?i:!t)}comparePositionTo(e){return(e=this.guild.roles.resolve(e))?this.constructor.comparePositions(this,e):Promise.reject(new a("INVALID_TYPE","role","Role nor a Snowflake"))}edit(e,t){return e.permissions?e.permissions=s.resolve(e.permissions):e.permissions=this.permissions,this.client.api.guilds[this.guild.id].roles[this.id].patch({data:{name:e.name||this.name,color:r.resolveColor(e.color||this.color),hoist:void 0!==e.hoist?e.hoist:this.hoist,position:void 0!==e.position?e.position:this.position,permissions:e.permissions,mentionable:void 0!==e.mentionable?e.mentionable:this.mentionable},reason:t}).then(e=>{const t=this._clone();return t._patch(e),t})}setName(e,t){return this.edit({name:e},t)}setColor(e,t){return this.edit({color:e},t)}setHoist(e,t){return this.edit({hoist:e},t)}setPosition(e,t){return this.guild.setRolePosition(this,e,t).then(()=>this)}setPermissions(e,t){return this.edit({permissions:e},t)}setMentionable(e,t){return this.edit({mentionable:e},t)}delete(e){return this.client.api.guilds[this.guild.id].roles[this.id].delete({reason:e}).then(()=>(this.client.actions.GuildRoleDelete.handle({guild_id:this.guild.id,role_id:this.id}),this))}equals(e){return e&&this.id===e.id&&this.name===e.name&&this.color===e.color&&this.hoist===e.hoist&&this.position===e.position&&this.permissions===e.permissions&&this.managed===e.managed}toString(){return this.id===this.guild.id?"@everyone":`<@&${this.id}>`}static comparePositions(e,t){return e.position===t.position?t.id-e.id:e.position-t.position}}e.exports=Role},function(e,t){class MessageAttachment{constructor(e,t,i){this.file=null,i&&this._patch(i),t?this.setAttachment(e,t):this._attach(e)}get name(){return this.file.name}get attachment(){return this.file.attachment}setAttachment(e,t){return this.file={attachment:e,name:t},this}setFile(e){return this.file={attachment:e},this}setName(e){return this.file.name=e,this}_attach(e,t){"string"==typeof e?this.file=e:this.setAttachment(e,t)}_patch(e){this.id=e.id,this.size=e.size,this.url=e.url,this.proxyURL=e.proxy_url,this.height=e.height,this.width=e.width}}e.exports=MessageAttachment},function(e,t,i){"use strict";(function(t){!t.version||0===t.version.indexOf("v0.")||0===t.version.indexOf("v1.")&&0!==t.version.indexOf("v1.8.")?e.exports=function(e,i,n,s){if("function"!=typeof e)throw new TypeError('"callback" argument must be a function');var r,o,a=arguments.length;switch(a){case 0:case 1:return t.nextTick(e);case 2:return t.nextTick(function(){e.call(null,i)});case 3:return t.nextTick(function(){e.call(null,i,n)});case 4:return t.nextTick(function(){e.call(null,i,n,s)});default:for(r=new Array(a-1),o=0;o"dm"===e.type).find(e=>e.recipient.id===this.id)}createDM(){return this.dmChannel?Promise.resolve(this.dmChannel):this.client.api.users(this.client.user.id).channels.post({data:{recipient_id:this.id}}).then(e=>this.client.actions.ChannelCreate.handle(e).channel)}deleteDM(){return this.dmChannel?this.client.api.channels(this.dmChannel.id).delete().then(e=>this.client.actions.ChannelDelete.handle(e).channel):Promise.reject(new c("USER_NO_DMCHANNEL"))}fetchProfile(){return this.client.api.users(this.id).profile.get().then(e=>new r(this,e))}setNote(e){return this.client.api.users("@me").notes(this.id).put({data:{note:e}}).then(()=>this)}equals(e){return e&&this.id===e.id&&this.username===e.username&&this.discriminator===e.discriminator&&this.avatar===e.avatar}toString(){return`<@${this.id}>`}send(){}}n.applyToClass(User),e.exports=User},function(e,t,i){const n=i(11),s=i(3),r=i(44),{Error:o}=i(4);class MessageStore extends n{constructor(e,t){super(e.client,t,r),this.channel=e}create(e,t){return super.create(e,t,{extras:[this.channel]})}set(e,t){const i=this.client.options.messageCacheMaxSize;0!==i&&(this.size>=i&&i>0&&this.delete(this.firstKey()),super.set(e,t))}fetch(e){return"string"==typeof e?this._fetchId(e):this._fetchMany(e)}fetchPinned(){return this.client.api.channels[this.channel.id].pins.get().then(e=>{const t=new s;for(const i of e)t.set(i.id,this.create(i));return t})}_fetchId(e){return this.client.user.bot?this.client.api.channels[this.channel.id].messages[e].get().then(e=>this.create(e)):this._fetchMany({limit:1,around:e}).then(t=>{const i=t.get(e);if(!i)throw new o("MESSAGE_MISSING");return i})}_fetchMany(e={}){return this.client.api.channels[this.channel.id].messages.get({query:e}).then(e=>{const t=new s;for(const i of e)t.set(i.id,this.create(i));return t})}}e.exports=MessageStore},function(e,t,i){const n=i(0),s=i(10);class Invite extends s{constructor(e,t){super(e),this._patch(t)}_patch(e){this.guild=this.client.guilds.create(e.guild,!1),this.code=e.code,this.presenceCount=e.approximate_presence_count,this.memberCount=e.approximate_member_count,this.textChannelCount=e.guild.text_channel_count,this.voiceChannelCount=e.guild.voice_channel_count,this.temporary=e.temporary,this.maxAge=e.max_age,this.uses=e.uses,this.maxUses=e.max_uses,e.inviter&&(this.inviter=this.client.users.create(e.inviter)),this.channel=this.client.channels.create(e.channel,this.guild,!1),this.createdTimestamp=new Date(e.created_at).getTime()}get createdAt(){return new Date(this.createdTimestamp)}get expiresTimestamp(){return this.createdTimestamp+1e3*this.maxAge}get expiresAt(){return new Date(this.expiresTimestamp)}get url(){return n.Endpoints.invite(this.client.options.http.invite,this.code)}delete(e){return this.client.api.invites[this.code].delete({reason:e}).then(()=>this)}toString(){return this.url}}e.exports=Invite},function(e,t,i){const n=i(43),s=i(27),r=i(34),o=i(73),a=i(22),c=i(21),l=i(18),h=i(74),u=i(0),p=i(3),d=i(7),f=i(13),m=i(9),g=i(12),v=i(64),E=i(131),_=i(132),y=i(133),b=i(134),w=i(75),x=i(10),{Error:A,TypeError:S}=i(4);class Guild extends x{constructor(e,t){super(e),this.members=new E(this),this.channels=new b(this),this.roles=new _(this),this.presences=new w(this.client),t&&(t.unavailable?(this.available=!1,this.id=t.id):(this._patch(t),t.channels||(this.available=!1)))}_patch(e){if(this.name=e.name,this.icon=e.icon,this.splash=e.splash,this.region=e.region,this.memberCount=e.member_count||this.memberCount,this.large=Boolean("large"in e?e.large:this.large),this.features=e.features,this.applicationID=e.application_id,this.afkTimeout=e.afk_timeout,this.afkChannelID=e.afk_channel_id,this.systemChannelID=e.system_channel_id,this.embedEnabled=e.embed_enabled,this.verificationLevel=e.verification_level,this.explicitContentFilter=e.explicit_content_filter,this.joinedTimestamp=e.joined_at?new Date(e.joined_at).getTime():this.joinedTimestamp,this.id=e.id,this.available=!e.unavailable,this.features=e.features||this.features||[],e.members){this.members.clear();for(const t of e.members)this.members.create(t)}if(e.owner_id&&(this.ownerID=e.owner_id),e.channels){this.channels.clear();for(const t of e.channels)this.client.channels.create(t,this)}if(e.roles){this.roles.clear();for(const t of e.roles)this.roles.create(t)}if(e.presences)for(const t of e.presences)this.presences.create(t);if(this.voiceStates=new VoiceStateCollection(this),e.voice_states)for(const t of e.voice_states)this.voiceStates.set(t.user_id,t);if(this.emojis)this.client.actions.GuildEmojisUpdate.handle({guild_id:this.id,emojis:e.emojis});else if(this.emojis=new y(this),e.emojis)for(const t of e.emojis)this.emojis.create(t)}get createdTimestamp(){return m.deconstruct(this.id).timestamp}get createdAt(){return new Date(this.createdTimestamp)}get joinedAt(){return new Date(this.joinedTimestamp)}iconURL({format:e,size:t}={}){return this.icon?this.client.rest.cdn.Icon(this.id,this.icon,e,t):null}get nameAcronym(){return this.name.replace(/\w+/g,e=>e[0]).replace(/\s/g,"")}splashURL({format:e,size:t}={}){return this.splash?this.client.rest.cdn.Splash(this.id,this.splash,e,t):null}get owner(){return this.members.get(this.ownerID)}get afkChannel(){return this.client.channels.get(this.afkChannelID)||null}get systemChannel(){return this.client.channels.get(this.systemChannelID)||null}get voiceConnection(){return this.client.browser?null:this.client.voice.connections.get(this.id)||null}get position(){return this.client.user.bot?null:this.client.user.settings.guildPositions?this.client.user.settings.guildPositions.indexOf(this.id):null}get muted(){if(this.client.user.bot)return null;try{return this.client.user.guildSettings.get(this.id).muted}catch(e){return!1}}get messageNotifications(){if(this.client.user.bot)return null;try{return this.client.user.guildSettings.get(this.id).messageNotifications}catch(e){return null}}get mobilePush(){if(this.client.user.bot)return null;try{return this.client.user.guildSettings.get(this.id).mobilePush}catch(e){return!1}}get suppressEveryone(){if(this.client.user.bot)return null;try{return this.client.user.guildSettings.get(this.id).suppressEveryone}catch(e){return null}}get defaultRole(){return this.roles.get(this.id)}get me(){return this.members.get(this.client.user.id)}get _sortedRoles(){return this._sortPositionWithID(this.roles)}member(e){return this.members.resolve(e)}fetchBans(){return this.client.api.guilds(this.id).bans.get().then(e=>e.reduce((e,t)=>(e.set(t.user.id,{reason:t.reason,user:this.client.users.create(t.user)}),e),new p))}fetchInvites(){return this.client.api.guilds(this.id).invites.get().then(e=>{const t=new p;for(const i of e){const e=new r(this.client,i);t.set(e.code,e)}return t})}fetchWebhooks(){return this.client.api.guilds(this.id).webhooks.get().then(e=>{const t=new p;for(const i of e)t.set(i.id,new a(this.client,i));return t})}fetchVoiceRegions(){return this.client.api.guilds(this.id).regions.get().then(e=>{const t=new p;for(const i of e)t.set(i.id,new h(i));return t})}fetchAuditLogs(e={}){return e.before&&e.before instanceof o.Entry&&(e.before=e.before.id),e.after&&e.after instanceof o.Entry&&(e.after=e.after.id),"string"==typeof e.type&&(e.type=o.Actions[e.type]),this.client.api.guilds(this.id)["audit-logs"].get({query:{before:e.before,after:e.after,limit:e.limit,user_id:this.client.users.resolveID(e.user),action_type:e.type}}).then(e=>o.build(this,e))}addMember(e,t){if(this.members.has(e.id))return Promise.resolve(this.members.get(e.id));if(t.access_token=t.accessToken,t.roles){const e=[];for(let i of t.roles instanceof p?t.roles.values():t.roles){if(!(i=this.roles.resolve(i)))return Promise.reject(new S("INVALID_TYPE","options.roles","Array or Collection of Roles or Snowflakes",!0));e.push(i.id)}}return this.client.api.guilds(this.id).members(e.id).put({data:t}).then(e=>this.client.actions.GuildMemberGet.handle(this,e).member)}search(e={}){return v.search(this,e)}edit(e,t){const i={};return e.name&&(i.name=e.name),e.region&&(i.region=e.region),void 0!==e.verificationLevel&&(i.verification_level=Number(e.verificationLevel)),void 0!==e.afkChannel&&(i.afk_channel_id=this.client.channels.resolveID(e.afkChannel)),void 0!==e.systemChannel&&(i.system_channel_id=this.client.channels.resolveID(e.systemChannel)),e.afkTimeout&&(i.afk_timeout=Number(e.afkTimeout)),void 0!==e.icon&&(i.icon=e.icon),e.owner&&(i.owner_id=this.client.users.resolve(e.owner).id),e.splash&&(i.splash=e.splash),void 0!==e.explicitContentFilter&&(i.explicit_content_filter=Number(e.explicitContentFilter)),this.client.api.guilds(this.id).patch({data:i,reason:t}).then(e=>this.client.actions.GuildUpdate.handle(e).updated)}setExplicitContentFilter(e,t){return this.edit({explicitContentFilter:e},t)}setName(e,t){return this.edit({name:e},t)}setRegion(e,t){return this.edit({region:e},t)}setVerificationLevel(e,t){return this.edit({verificationLevel:e},t)}setAFKChannel(e,t){return this.edit({afkChannel:e},t)}setSystemChannel(e,t){return this.edit({systemChannel:e},t)}setAFKTimeout(e,t){return this.edit({afkTimeout:e},t)}async setIcon(e,t){return this.edit({icon:await f.resolveImage(e,this.client.browser),reason:t})}setOwner(e,t){return this.edit({owner:e},t)}async setSplash(e,t){return this.edit({splash:await f.resolveImage(e,this.client.browser),reason:t})}setPosition(e,t){return this.client.user.bot?Promise.reject(new A("FEATURE_USER_ONLY")):this.client.user.settings.setGuildPosition(this,e,t)}acknowledge(){return this.client.api.guilds(this.id).ack.post({data:{token:this.client.rest._ackToken}}).then(e=>(e.token&&(this.client.rest._ackToken=e.token),this))}allowDMs(e){const t=this.client.user.settings;return e?t.removeRestrictedGuild(this):t.addRestrictedGuild(this)}ban(e,t={days:0}){t.days&&(t["delete-message-days"]=t.days);const i=this.client.users.resolveID(e);return i?this.client.api.guilds(this.id).bans[i].put({query:t}).then(()=>{if(e instanceof l)return e;const t=this.client.users.resolve(i);return t?this.members.resolve(t)||t:i}):Promise.reject(new A("BAN_RESOLVE_ID",!0))}unban(e,t){const i=this.client.users.resolverID(e);if(!i)throw new A("BAN_RESOLVE_ID");return this.client.api.guilds(this.id).bans[i].delete({reason:t}).then(()=>e)}pruneMembers({days:e=7,dry:t=!1,reason:i}={}){if("number"!=typeof e)throw new S("PRUNE_DAYS_TYPE");return this.client.api.guilds(this.id).prune[t?"get":"post"]({query:{days:e},reason:i}).then(e=>e.pruned)}sync(){this.client.user.bot||this.client.syncGuilds([this])}createChannel(e,t,{overwrites:i,reason:n}={}){return(i instanceof p||i instanceof Array)&&(i=i.map(e=>{let t=e.allow||e._allowed,i=e.deny||e._denied;t instanceof Array&&(t=g.resolve(t)),i instanceof Array&&(i=g.resolve(i));const n=this.roles.resolve(e.id);return n?(e.id=n.id,e.type="role"):(e.id=this.client.users.resolveID(e.id),e.type="member"),{allow:t,deny:i,type:e.type,id:e.id}})),this.client.api.guilds(this.id).channels.post({data:{name:e,type:u.ChannelTypes[t.toUpperCase()],permission_overwrites:i},reason:n}).then(e=>this.client.actions.ChannelCreate.handle(e).channel)}setChannelPosition(e,t,i=!1){if("string"==typeof e&&(e=this.channels.get(e)),!(e instanceof c))return Promise.reject(new S("INVALID_TYPE","channel","GuildChannel nor a Snowflake"));if(t=Number(t),isNaN(t))return Promise.reject(new S("INVALID_TYPE","position","number"));let n=this._sortedChannels(e.type).array();return d.moveElementInArray(n,e,t,i),n=n.map((e,t)=>({id:e.id,position:t})),this.client.api.guilds(this.id).channels.patch({data:n}).then(()=>this.client.actions.GuildChannelsPositionUpdate.handle({guild_id:this.id,channels:n}).guild)}setChannelPositions(e){const t=e.map(e=>({id:this.client.channels.resolveID(e.channel),position:e.position}));return this.client.api.guilds(this.id).channels.patch({data:t}).then(()=>this.client.actions.GuildChannelsPositionUpdate.handle({guild_id:this.id,channels:t}).guild)}createRole({data:e={},reason:t}={}){return e.color&&(e.color=d.resolveColor(e.color)),e.permissions&&(e.permissions=g.resolve(e.permissions)),this.client.api.guilds(this.id).roles.post({data:e,reason:t}).then(i=>{const{role:n}=this.client.actions.GuildRoleCreate.handle({guild_id:this.id,role:i});return e.position?n.setPosition(e.position,t):n})}createEmoji(e,t,{roles:i,reason:n}={}){if("string"==typeof e&&e.startsWith("data:")){const s={image:e,name:t};if(i){s.roles=[];for(let e of i instanceof p?i.values():i){if(!(e=this.roles.resolve(e)))return Promise.reject(new S("INVALID_TYPE","options.roles","Array or Collection of Roles or Snowflakes",!0));s.roles.push(e.id)}}return this.client.api.guilds(this.id).emojis.post({data:s,reason:n}).then(e=>this.client.actions.GuildEmojiCreate.handle(this,e).emoji)}return f.resolveImage(e,this.client.browser).then(e=>this.createEmoji(e,t,{roles:i,reason:n}))}leave(){return this.ownerID===this.client.user.id?Promise.reject(new A("GUILD_OWNED")):this.client.api.users("@me").guilds(this.id).delete().then(()=>this.client.actions.GuildDelete.handle({id:this.id}).guild)}delete(){return this.client.api.guilds(this.id).delete().then(()=>this.client.actions.GuildDelete.handle({id:this.id}).guild)}equals(e){let t=e&&e instanceof this.constructor&&this.id===e.id&&this.available===e.available&&this.splash===e.splash&&this.region===e.region&&this.name===e.name&&this.memberCount===e.memberCount&&this.large===e.large&&this.icon===e.icon&&d.arraysEqual(this.features,e.features)&&this.ownerID===e.ownerID&&this.verificationLevel===e.verificationLevel&&this.embedEnabled===e.embedEnabled;return t&&(this.embedChannel?e.embedChannel&&this.embedChannel.id===e.embedChannel.id||(t=!1):e.embedChannel&&(t=!1)),t}toString(){return this.name}_memberSpeakUpdate(e,t){const i=this.members.get(e);i&&i.speaking!==t&&(i.speaking=t,this.client.emit(u.Events.GUILD_MEMBER_SPEAKING,i,t))}setRolePosition(e,t,i=!1){if("string"==typeof e&&(e=this.roles.get(e)),!(e instanceof s))return Promise.reject(new S("INVALID_TYPE","role","Role nor a Snowflake"));if(t=Number(t),isNaN(t))return Promise.reject(new S("INVALID_TYPE","position","number"));let n=this._sortedRoles.array();return d.moveElementInArray(n,e,t,i),n=n.map((e,t)=>({id:e.id,position:t})),this.client.api.guilds(this.id).roles.patch({data:n}).then(()=>this.client.actions.GuildRolesPositionUpdate.handle({guild_id:this.id,roles:n}).guild)}_sortedChannels(e){return this._sortPositionWithID(this.channels.filter(t=>"voice"===e&&"voice"===t.type||("voice"!==e&&"voice"!==t.type||e===t.type)))}_sortPositionWithID(e){return e.sort((e,t)=>e.position!==t.position?e.position-t.position:n.fromString(e.id).sub(n.fromString(t.id)).toNumber())}}class VoiceStateCollection extends p{constructor(e){super(),this.guild=e}set(e,t){const i=this.guild.members.get(e);if(i){i.voiceChannel&&i.voiceChannel.id!==t.channel_id&&i.voiceChannel.members.delete(i.id),t.channel_id||(i.speaking=null);const e=this.guild.channels.get(t.channel_id);e&&e.members.set(i.user.id,i)}super.set(e,t)}}e.exports=Guild},function(e,t,i){const n=i(83);e.exports=n},function(e,t,i){function n(){s.call(this)}e.exports=n;var s=i(14).EventEmitter;i(15)(n,s),n.Readable=i(23),n.Writable=i(90),n.Duplex=i(91),n.Transform=i(92),n.PassThrough=i(93),n.Stream=n,n.prototype.pipe=function(e,t){function i(t){e.writable&&!1===e.write(t)&&l.pause&&l.pause()}function n(){l.readable&&l.resume&&l.resume()}function r(){h||(h=!0,e.end())}function o(){h||(h=!0,"function"==typeof e.destroy&&e.destroy())}function a(e){if(c(),0===s.listenerCount(this,"error"))throw e}function c(){l.removeListener("data",i),e.removeListener("drain",n),l.removeListener("end",r),l.removeListener("close",o),l.removeListener("error",a),e.removeListener("error",a),l.removeListener("end",c),l.removeListener("close",c),e.removeListener("close",c)}var l=this;l.on("data",i),e.on("drain",n),e._isStdio||t&&!1===t.end||(l.on("end",r),l.on("close",o));var h=!1;return l.on("error",a),e.on("error",a),l.on("end",c),l.on("close",c),e.on("close",c),e.emit("pipe",l),e}},function(e,t,i){function n(e,t){for(var i in e)t[i]=e[i]}function s(e,t,i){return o(e,t,i)}var r=i(5),o=r.Buffer;o.from&&o.alloc&&o.allocUnsafe&&o.allocUnsafeSlow?e.exports=r:(n(r,t),t.Buffer=s),n(o,s),s.from=function(e,t,i){if("number"==typeof e)throw new TypeError("Argument must not be a number");return o(e,t,i)},s.alloc=function(e,t,i){if("number"!=typeof e)throw new TypeError("Argument must be a number");var n=o(e);return void 0!==t?"string"==typeof i?n.fill(t,i):n.fill(t):n.fill(0),n},s.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return o(e)},s.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return r.SlowBuffer(e)}},function(e,t,i){"use strict";(function(t,n,s){function r(e){var t=this;this.next=null,this.entry=null,this.finish=function(){R(t,e)}}function o(e){return O.from(e)}function a(e){return O.isBuffer(e)||e instanceof L}function c(){}function l(e,t){D=D||i(16),e=e||{},this.objectMode=!!e.objectMode,t instanceof D&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var n=e.highWaterMark,s=this.objectMode?16:16384;this.highWaterMark=n||0===n?n:s,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var o=!1===e.decodeStrings;this.decodeStrings=!o,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){E(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new r(this)}function h(e){if(D=D||i(16),!(P.call(h,this)||this instanceof D))return new h(e);this._writableState=new l(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),M.call(this)}function u(e,t){var i=new Error("write after end");e.emit("error",i),I(t,i)}function p(e,t,i,n){var s=!0,r=!1;return null===i?r=new TypeError("May not write null values to stream"):"string"==typeof i||void 0===i||t.objectMode||(r=new TypeError("Invalid non-string/buffer chunk")),r&&(e.emit("error",r),I(n,r),s=!1),s}function d(e,t,i){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=O.from(t,i)),t}function f(e,t,i,n,s,r){if(!i){var o=d(t,n,s);n!==o&&(i=!0,s="buffer",n=o)}var a=t.objectMode?1:n.length;t.length+=a;var c=t.length-1?n:I;h.WritableState=l;var k=i(24);k.inherits=i(15);var N={deprecate:i(88)},M=i(50),O=i(38).Buffer,L=s.Uint8Array||function(){},U=i(51);k.inherits(h,M),l.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(l.prototype,"buffer",{get:N.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}();var P;"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(P=Function.prototype[Symbol.hasInstance],Object.defineProperty(h,Symbol.hasInstance,{value:function(e){return!!P.call(this,e)||e&&e._writableState instanceof l}})):P=function(e){return e instanceof this},h.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},h.prototype.write=function(e,t,i){var n=this._writableState,s=!1,r=a(e)&&!n.objectMode;return r&&!O.isBuffer(e)&&(e=o(e)),"function"==typeof t&&(i=t,t=null),r?t="buffer":t||(t=n.defaultEncoding),"function"!=typeof i&&(i=c),n.ended?u(this,i):(r||p(this,n,e,i))&&(n.pendingcb++,s=f(this,n,r,e,t,i)),s},h.prototype.cork=function(){this._writableState.corked++},h.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.finished||e.bufferProcessing||!e.bufferedRequest||b(this,e))},h.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},h.prototype._write=function(e,t,i){i(new Error("_write() is not implemented"))},h.prototype._writev=null,h.prototype.end=function(e,t,i){var n=this._writableState;"function"==typeof e?(i=e,e=null,t=null):"function"==typeof t&&(i=t,t=null),null!==e&&void 0!==e&&this.write(e,t),n.corked&&(n.corked=1,this.uncork()),n.ending||n.finished||T(this,n,i)},Object.defineProperty(h.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),h.prototype.destroy=U.destroy,h.prototype._undestroy=U.undestroy,h.prototype._destroy=function(e,t){this.end(),t(e)}}).call(t,i(8),i(86).setImmediate,i(6))},function(e,t,i){(function(e,n){function s(e,i){var n={seen:[],stylize:o};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),m(i)?n.showHidden=i:i&&t._extend(n,i),_(n.showHidden)&&(n.showHidden=!1),_(n.depth)&&(n.depth=2),_(n.colors)&&(n.colors=!1),_(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=r),c(n,e,n.depth)}function r(e,t){var i=s.styles[t];return i?"["+s.colors[i][0]+"m"+e+"["+s.colors[i][1]+"m":e}function o(e,t){return e}function a(e){var t={};return e.forEach(function(e,i){t[e]=!0}),t}function c(e,i,n){if(e.customInspect&&i&&A(i.inspect)&&i.inspect!==t.inspect&&(!i.constructor||i.constructor.prototype!==i)){var s=i.inspect(n,e);return E(s)||(s=c(e,s,n)),s}var r=l(e,i);if(r)return r;var o=Object.keys(i),m=a(o);if(e.showHidden&&(o=Object.getOwnPropertyNames(i)),x(i)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return h(i);if(0===o.length){if(A(i)){var g=i.name?": "+i.name:"";return e.stylize("[Function"+g+"]","special")}if(y(i))return e.stylize(RegExp.prototype.toString.call(i),"regexp");if(w(i))return e.stylize(Date.prototype.toString.call(i),"date");if(x(i))return h(i)}var v="",_=!1,b=["{","}"];if(f(i)&&(_=!0,b=["[","]"]),A(i)&&(v=" [Function"+(i.name?": "+i.name:"")+"]"),y(i)&&(v=" "+RegExp.prototype.toString.call(i)),w(i)&&(v=" "+Date.prototype.toUTCString.call(i)),x(i)&&(v=" "+h(i)),0===o.length&&(!_||0==i.length))return b[0]+v+b[1];if(n<0)return y(i)?e.stylize(RegExp.prototype.toString.call(i),"regexp"):e.stylize("[Object]","special");e.seen.push(i);var S;return S=_?u(e,i,n,m,o):o.map(function(t){return p(e,i,n,m,t,_)}),e.seen.pop(),d(S,v,b)}function l(e,t){if(_(t))return e.stylize("undefined","undefined");if(E(t)){var i="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(i,"string")}return v(t)?e.stylize(""+t,"number"):m(t)?e.stylize(""+t,"boolean"):g(t)?e.stylize("null","null"):void 0}function h(e){return"["+Error.prototype.toString.call(e)+"]"}function u(e,t,i,n,s){for(var r=[],o=0,a=t.length;o-1&&(a=r?a.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+a.split("\n").map(function(e){return" "+e}).join("\n")):a=e.stylize("[Circular]","special")),_(o)){if(r&&s.match(/^\d+$/))return a;(o=JSON.stringify(""+s)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(o=o.substr(1,o.length-2),o=e.stylize(o,"name")):(o=o.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),o=e.stylize(o,"string"))}return o+": "+a}function d(e,t,i){var n=0;return e.reduce(function(e,t){return n++,t.indexOf("\n")>=0&&n++,e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0)>60?i[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+i[1]:i[0]+t+" "+e.join(", ")+" "+i[1]}function f(e){return Array.isArray(e)}function m(e){return"boolean"==typeof e}function g(e){return null===e}function v(e){return"number"==typeof e}function E(e){return"string"==typeof e}function _(e){return void 0===e}function y(e){return b(e)&&"[object RegExp]"===S(e)}function b(e){return"object"==typeof e&&null!==e}function w(e){return b(e)&&"[object Date]"===S(e)}function x(e){return b(e)&&("[object Error]"===S(e)||e instanceof Error)}function A(e){return"function"==typeof e}function S(e){return Object.prototype.toString.call(e)}function T(e){return e<10?"0"+e.toString(10):e.toString(10)}function R(){var e=new Date,t=[T(e.getHours()),T(e.getMinutes()),T(e.getSeconds())].join(":");return[e.getDate(),N[e.getMonth()],t].join(" ")}function I(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var D=/%[sdj%]/g;t.format=function(e){if(!E(e)){for(var t=[],i=0;i=r)return e;switch(e){case"%s":return String(n[i++]);case"%d":return Number(n[i++]);case"%j":try{return JSON.stringify(n[i++])}catch(e){return"[Circular]"}default:return e}}),a=n[i];i{e(...i),this._timeouts.delete(n)},t);return this._timeouts.add(n),n}clearTimeout(e){clearTimeout(e),this._timeouts.delete(e)}setInterval(e,t,...i){const n=setInterval(e,t,...i);return this._intervals.add(n),n}clearInterval(e){clearInterval(e),this._intervals.delete(e)}}e.exports=BaseClient},function(e,t,i){const n=i(3),s=i(14);class Collector extends s{constructor(e,t,i={}){super(),Object.defineProperty(this,"client",{value:e}),this.filter=t,this.options=i,this.collected=new n,this.ended=!1,this._timeout=null,this.handleCollect=this.handleCollect.bind(this),this.handleDispose=this.handleDispose.bind(this),i.time&&(this._timeout=this.client.setTimeout(()=>this.stop("time"),i.time))}handleCollect(...e){const t=this.collect(...e);t&&this.filter(...e,this.collected)&&(this.collected.set(t.key,t.value),this.emit("collect",t.value,...e),this.checkEnd())}handleDispose(...e){if(!this.options.dispose)return;const t=this.dispose(...e);if(!t||!this.filter(...e)||!this.collected.has(t))return;const i=this.collected.get(t);this.collected.delete(t),this.emit("dispose",i,...e),this.checkEnd()}get next(){return new Promise((e,t)=>{if(this.ended)return void t(this.collected);const i=()=>{this.removeListener("collect",n),this.removeListener("end",s)},n=t=>{i(),e(t)},s=()=>{i(),t(this.collected)};this.on("collect",n),this.on("end",s)})}stop(e="user"){this.ended||(this._timeout&&this.client.clearTimeout(this._timeout),this.ended=!0,this.emit("end",this.collected,e))}checkEnd(){const e=this.endReason();e&&this.stop(e)}collect(){}dispose(){}endReason(){}}e.exports=Collector},function(e,t,i){var n,s,r;!function(i,o){s=[],void 0!==(r="function"==typeof(n=o)?n.apply(t,s):n)&&(e.exports=r)}(0,function(){"use strict";function e(e,t,i){this.low=0|e,this.high=0|t,this.unsigned=!!i}function t(e){return!0===(e&&e.__isLong__)}function i(e,t){var i,n,r;return t?(e>>>=0,(r=0<=e&&e<256)&&(n=c[e])?n:(i=s(e,(0|e)<0?-1:0,!0),r&&(c[e]=i),i)):(e|=0,(r=-128<=e&&e<128)&&(n=a[e])?n:(i=s(e,e<0?-1:0,!1),r&&(a[e]=i),i))}function n(e,t){if(isNaN(e)||!isFinite(e))return t?m:f;if(t){if(e<0)return m;if(e>=u)return y}else{if(e<=-p)return b;if(e+1>=p)return _}return e<0?n(-e,t).neg():s(e%h|0,e/h|0,t)}function s(t,i,n){return new e(t,i,n)}function r(e,t,i){if(0===e.length)throw Error("empty string");if("NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return f;if("number"==typeof t?(i=t,t=!1):t=!!t,(i=i||10)<2||360)throw Error("interior hyphen");if(0===s)return r(e.substring(1),t,i).neg();for(var o=n(l(i,8)),a=f,c=0;c>>0:this.low},w.toNumber=function(){return this.unsigned?(this.high>>>0)*h+(this.low>>>0):this.high*h+(this.low>>>0)},w.toString=function(e){if((e=e||10)<2||36>>0).toString(e);if((o=c).isZero())return h+a;for(;h.length<6;)h="0"+h;a=""+h+a}},w.getHighBits=function(){return this.high},w.getHighBitsUnsigned=function(){return this.high>>>0},w.getLowBits=function(){return this.low},w.getLowBitsUnsigned=function(){return this.low>>>0},w.getNumBitsAbs=function(){if(this.isNegative())return this.eq(b)?64:this.neg().getNumBitsAbs();for(var e=0!=this.high?this.high:this.low,t=31;t>0&&0==(e&1<=0},w.isOdd=function(){return 1==(1&this.low)},w.isEven=function(){return 0==(1&this.low)},w.equals=function(e){return t(e)||(e=o(e)),(this.unsigned===e.unsigned||this.high>>>31!=1||e.high>>>31!=1)&&(this.high===e.high&&this.low===e.low)},w.eq=w.equals,w.notEquals=function(e){return!this.eq(e)},w.neq=w.notEquals,w.lessThan=function(e){return this.comp(e)<0},w.lt=w.lessThan,w.lessThanOrEqual=function(e){return this.comp(e)<=0},w.lte=w.lessThanOrEqual,w.greaterThan=function(e){return this.comp(e)>0},w.gt=w.greaterThan,w.greaterThanOrEqual=function(e){return this.comp(e)>=0},w.gte=w.greaterThanOrEqual,w.compare=function(e){if(t(e)||(e=o(e)),this.eq(e))return 0;var i=this.isNegative(),n=e.isNegative();return i&&!n?-1:!i&&n?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1},w.comp=w.compare,w.negate=function(){return!this.unsigned&&this.eq(b)?b:this.not().add(g)},w.neg=w.negate,w.add=function(e){t(e)||(e=o(e));var i=this.high>>>16,n=65535&this.high,r=this.low>>>16,a=65535&this.low,c=e.high>>>16,l=65535&e.high,h=e.low>>>16,u=0,p=0,d=0,f=0;return f+=a+(65535&e.low),d+=f>>>16,f&=65535,d+=r+h,p+=d>>>16,d&=65535,p+=n+l,u+=p>>>16,p&=65535,u+=i+c,u&=65535,s(d<<16|f,u<<16|p,this.unsigned)},w.subtract=function(e){return t(e)||(e=o(e)),this.add(e.neg())},w.sub=w.subtract,w.multiply=function(e){if(this.isZero())return f;if(t(e)||(e=o(e)),e.isZero())return f;if(this.eq(b))return e.isOdd()?b:f;if(e.eq(b))return this.isOdd()?b:f;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(d)&&e.lt(d))return n(this.toNumber()*e.toNumber(),this.unsigned);var i=this.high>>>16,r=65535&this.high,a=this.low>>>16,c=65535&this.low,l=e.high>>>16,h=65535&e.high,u=e.low>>>16,p=65535&e.low,m=0,g=0,v=0,E=0;return E+=c*p,v+=E>>>16,E&=65535,v+=a*p,g+=v>>>16,v&=65535,v+=c*u,g+=v>>>16,v&=65535,g+=r*p,m+=g>>>16,g&=65535,g+=a*u,m+=g>>>16,g&=65535,g+=c*h,m+=g>>>16,g&=65535,m+=i*p+r*u+a*h+c*l,m&=65535,s(v<<16|E,m<<16|g,this.unsigned)},w.mul=w.multiply,w.divide=function(e){if(t(e)||(e=o(e)),e.isZero())throw Error("division by zero");if(this.isZero())return this.unsigned?m:f;var i,s,r;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return m;if(e.gt(this.shru(1)))return v;r=m}else{if(this.eq(b))return e.eq(g)||e.eq(E)?b:e.eq(b)?g:(i=this.shr(1).div(e).shl(1)).eq(f)?e.isNegative()?g:E:(s=this.sub(e.mul(i)),r=i.add(s.div(e)));if(e.eq(b))return this.unsigned?m:f;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();r=f}for(s=this;s.gte(e);){i=Math.max(1,Math.floor(s.toNumber()/e.toNumber()));for(var a=Math.ceil(Math.log(i)/Math.LN2),c=a<=48?1:l(2,a-48),h=n(i),u=h.mul(e);u.isNegative()||u.gt(s);)u=(h=n(i-=c,this.unsigned)).mul(e);h.isZero()&&(h=g),r=r.add(h),s=s.sub(u)}return r},w.div=w.divide,w.modulo=function(e){return t(e)||(e=o(e)),this.sub(this.div(e).mul(e))},w.mod=w.modulo,w.not=function(){return s(~this.low,~this.high,this.unsigned)},w.and=function(e){return t(e)||(e=o(e)),s(this.low&e.low,this.high&e.high,this.unsigned)},w.or=function(e){return t(e)||(e=o(e)),s(this.low|e.low,this.high|e.high,this.unsigned)},w.xor=function(e){return t(e)||(e=o(e)),s(this.low^e.low,this.high^e.high,this.unsigned)},w.shiftLeft=function(e){return t(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?s(this.low<>>32-e,this.unsigned):s(0,this.low<>>e|this.high<<32-e,this.high>>e,this.unsigned):s(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},w.shr=w.shiftRight,w.shiftRightUnsigned=function(e){if(t(e)&&(e=e.toInt()),0===(e&=63))return this;var i=this.high;return e<32?s(this.low>>>e|i<<32-e,i>>>e,this.unsigned):32===e?s(i,0,this.unsigned):s(i>>>e-32,0,this.unsigned)},w.shru=w.shiftRightUnsigned,w.toSigned=function(){return this.unsigned?s(this.low,this.high,!1):this},w.toUnsigned=function(){return this.unsigned?this:s(this.low,this.high,!0)},w.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},w.toBytesLE=function(){var e=this.high,t=this.low;return[255&t,t>>>8&255,t>>>16&255,t>>>24&255,255&e,e>>>8&255,e>>>16&255,e>>>24&255]},w.toBytesBE=function(){var e=this.high,t=this.low;return[e>>>24&255,e>>>16&255,e>>>8&255,255&e,t>>>24&255,t>>>16&255,t>>>8&255,255&t]},e})},function(e,t,i){const n=i(66),s=i(28),r=i(20),o=i(67),a=i(45),c=i(7),l=i(3),h=i(130),u=i(0),p=i(12),d=i(10),{Error:f,TypeError:m}=i(4);let g;class Message extends d{constructor(e,t,i){super(e),this.channel=i,t&&this._patch(t)}_patch(e){this.id=e.id,this.type=u.MessageTypes[e.type],this.content=e.content,this.author=this.client.users.create(e.author),this.member=this.guild?this.guild.member(this.author)||null:null,this.pinned=e.pinned,this.tts=e.tts,this.nonce=e.nonce,this.system=6===e.type,this.embeds=e.embeds.map(e=>new r(e)),this.attachments=new l;for(const t of e.attachments)this.attachments.set(t.id,new s(t.url,t.filename,t));if(this.createdTimestamp=new Date(e.timestamp).getTime(),this.editedTimestamp=e.edited_timestamp?new Date(e.edited_timestamp).getTime():null,this.reactions=new h(this),e.reactions&&e.reactions.length>0)for(const t of e.reactions)this.reactions.create(t);this.mentions=new n(this,e.mentions,e.mention_roles,e.mention_everyone),this.webhookID=e.webhook_id||null,this.application=e.application?new a(this.client,e.application):null,this.activity=e.activity?{partyID:e.activity.party_id,type:e.activity.type}:null,this.hit="boolean"==typeof e.hit?e.hit:null,this._edits=[]}patch(e){const t=this._clone();if(this._edits.unshift(t),this.editedTimestamp=new Date(e.edited_timestamp).getTime(),"content"in e&&(this.content=e.content),"pinned"in e&&(this.pinned=e.pinned),"tts"in e&&(this.tts=e.tts),this.embeds="embeds"in e?e.embeds.map(e=>new r(e)):this.embeds.slice(),"attachments"in e){this.attachments=new l;for(const t of e.attachments)this.attachments.set(t.id,new s(t.url,t.filename,t))}else this.attachments=new l(this.attachments);this.mentions=new n(this,"mentions"in e?e.mentions:this.mentions.users,"mentions_roles"in e?e.mentions_roles:this.mentions.roles,"mention_everyone"in e?e.mention_everyone:this.mentions.everyone)}get createdAt(){return new Date(this.createdTimestamp)}get editedAt(){return this.editedTimestamp?new Date(this.editedTimestamp):null}get guild(){return this.channel.guild||null}get cleanContent(){return this.content.replace(/@(everyone|here)/g,"@​$1").replace(/<@!?[0-9]+>/g,e=>{const t=e.replace(/<|!|>|@/g,"");if("dm"===this.channel.type||"group"===this.channel.type)return this.client.users.has(t)?`@${this.client.users.get(t).username}`:e;const i=this.channel.guild.members.get(t);if(i)return i.nickname?`@${i.nickname}`:`@${i.user.username}`;{const i=this.client.users.get(t);return i?`@${i.username}`:e}}).replace(/<#[0-9]+>/g,e=>{const t=this.client.channels.get(e.replace(/<|#|>/g,""));return t?`#${t.name}`:e}).replace(/<@&[0-9]+>/g,e=>{if("dm"===this.channel.type||"group"===this.channel.type)return e;const t=this.guild.roles.get(e.replace(/<|@|>|&/g,""));return t?`@${t.name}`:e})}createReactionCollector(e,t={}){return new o(this,e,t)}awaitReactions(e,t={}){return new Promise((i,n)=>{this.createReactionCollector(e,t).once("end",(e,s)=>{t.errors&&t.errors.includes(s)?n(e):i(e)})})}get edits(){const e=this._edits.slice();return e.unshift(this),e}get editable(){return this.author.id===this.client.user.id}get deletable(){return this.author.id===this.client.user.id||this.guild&&this.channel.permissionsFor(this.client.user).has(p.FLAGS.MANAGE_MESSAGES)}get pinnable(){return!this.guild||this.channel.permissionsFor(this.client.user).has(p.FLAGS.MANAGE_MESSAGES)}edit(e,t){t||"object"!=typeof e||e instanceof Array?t||(t={}):(t=e,e=""),t instanceof r&&(t={embed:t}),void 0!==t.content&&(e=t.content),void 0!==e&&(e=c.resolveString(e));let{embed:i,code:n,reply:s}=t;if(i&&(i=new r(i)._apiTransform()),void 0===n||"boolean"==typeof n&&!0!==n||(e=c.escapeMarkdown(c.resolveString(e),!0),e=`\`\`\`${"boolean"!=typeof n?n||"":""}\n${e}\n\`\`\``),s&&"dm"!==this.channel.type){const t=this.client.users.resolveID(s);e=`${`<@${s instanceof g&&s.nickname?"!":""}${t}>`}${e?`, ${e}`:""}`}return this.client.api.channels[this.channel.id].messages[this.id].patch({data:{content:e,embed:i}}).then(e=>{const t=this._clone();return t._patch(e),t})}pin(){return this.client.api.channels(this.channel.id).pins(this.id).put().then(()=>this)}unpin(){return this.client.api.channels(this.channel.id).pins(this.id).delete().then(()=>this)}react(e){if(!(e=this.client.emojis.resolveIdentifier(e)))throw new m("EMOJI_TYPE");return this.client.api.channels(this.channel.id).messages(this.id).reactions(e,"@me").put().then(()=>this.client.actions.MessageReactionAdd.handle({user:this.client.user,channel:this.channel,message:this,emoji:c.parseEmoji(e)}).reaction)}clearReactions(){return this.client.api.channels(this.channel.id).messages(this.id).reactions.delete().then(()=>this)}delete({timeout:e=0,reason:t}={}){return e<=0?this.client.api.channels(this.channel.id).messages(this.id).delete({reason:t}).then(()=>this.client.actions.MessageDelete.handle({id:this.id,channel_id:this.channel.id}).message):new Promise(i=>{this.client.setTimeout(()=>{i(this.delete({reason:t}))},e)})}reply(e,t){return t||"object"!=typeof e||e instanceof Array?t||(t={}):(t=e,e=""),this.channel.send(e,Object.assign(t,{reply:this.member||this.author}))}acknowledge(){return this.client.api.channels(this.channel.id).messages(this.id).ack.post({data:{token:this.client.rest._ackToken}}).then(e=>(e.token&&(this.client.rest._ackToken=e.token),this))}fetchWebhook(){return this.webhookID?this.client.fetchWebhook(this.webhookID):Promise.reject(new f("WEBHOOK_MESSAGE"))}equals(e,t){if(!e)return!1;if(!e.author&&!e.attachments)return this.id===e.id&&this.embeds.length===e.embeds.length;let i=this.id===e.id&&this.author.id===e.author.id&&this.content===e.content&&this.tts===e.tts&&this.nonce===e.nonce&&this.embeds.length===e.embeds.length&&this.attachments.length===e.attachments.length;return i&&t&&(i=this.mentions.everyone===e.mentions.everyone&&this.createdTimestamp===new Date(t.timestamp).getTime()&&this.editedTimestamp===new Date(t.edited_timestamp).getTime()),i}toString(){return this.content}}e.exports=Message},function(e,t,i){const n=i(9),s=i(0),r=i(13),o=i(10);class ClientApplication extends o{constructor(e,t){super(e),this._patch(t)}_patch(e){this.id=e.id,this.name=e.name,this.description=e.description,this.icon=e.icon,this.cover=e.cover_image,this.rpcOrigins=e.rpc_origins,this.redirectURIs=e.redirect_uris,this.botRequireCodeGrant=e.bot_require_code_grant,this.botPublic=e.bot_public,this.rpcApplicationState=e.rpc_application_state,this.bot=e.bot,this.flags=e.flags,this.secret=e.secret,e.owner&&(this.owner=this.client.users.create(e.owner))}get createdTimestamp(){return n.deconstruct(this.id).timestamp}get createdAt(){return new Date(this.createdTimestamp)}iconURL({format:e,size:t}={}){return this.icon?this.client.rest.cdn.AppIcon(this.id,this.icon,{format:e,size:t}):null}coverImage({format:e,size:t}={}){return this.cover?s.Endpoints.CDN(this.client.options.http.cdn).AppIcon(this.id,this.cover,{format:e,size:t}):null}fetchAssets(){return this.client.api.applications(this.id).assets.get().then(e=>e.map(e=>({id:e.id,name:e.name,type:Object.keys(s.ClientApplicationAssetTypes)[e.type-1]})))}createAsset(e,t,i){return r.resolveBase64(t).then(t=>this.client.api.applications(this.id).assets.post({data:{name:e,data:t,type:s.ClientApplicationAssetTypes[i.toUpperCase()]}}))}resetSecret(){return this.client.api.oauth2.applications[this.id].reset.post().then(e=>new ClientApplication(this.client,e))}resetToken(){return this.client.api.oauth2.applications[this.id].bot.reset.post().then(e=>new ClientApplication(this.client,Object.assign({},this,{bot:e})))}toString(){return this.name}}e.exports=ClientApplication},function(e,t,i){const n=i(3),s=i(9),r=i(10),{TypeError:o}=i(4);class Emoji extends r{constructor(e,t,i){super(e),this.guild=i,this._patch(t)}_patch(e){this.id=e.id,this.name=e.name,this.requiresColons=e.require_colons,this.managed=e.managed,this._roles=e.roles}get createdTimestamp(){return s.deconstruct(this.id).timestamp}get createdAt(){return new Date(this.createdTimestamp)}get roles(){const e=new n;for(const t of this._roles)this.guild.roles.has(t)&&e.set(t,this.guild.roles.get(t));return e}get url(){return this.client.rest.cdn.Emoji(this.id)}get identifier(){return this.id?`${this.name}:${this.id}`:encodeURIComponent(this.name)}edit(e,t){return this.client.api.guilds(this.guild.id).emojis(this.id).patch({data:{name:e.name,roles:e.roles?e.roles.map(e=>e.id?e.id:e):void 0},reason:t}).then(()=>this)}setName(e,t){return this.edit({name:e},t)}addRestrictedRole(e){return this.addRestrictedRoles([e])}addRestrictedRoles(e){const t=new n(this.roles);for(let i of e instanceof n?e.values():e){if(!(i=this.guild.roles.resolve(i)))return Promise.reject(new o("INVALID_TYPE","roles","Array or Collection of Roles or Snowflakes",!0));t.set(i.id,i)}return this.edit({roles:t})}removeRestrictedRole(e){return this.removeRestrictedRoles([e])}removeRestrictedRoles(e){const t=new n(this.roles);for(let i of e instanceof n?e.values():e){if(!(i=this.guild.roles.resolve(i)))return Promise.reject(new o("INVALID_TYPE","roles","Array or Collection of Roles or Snowflakes",!0));t.has(i.id)&&t.delete(i.id)}return this.edit({roles:t})}toString(){return this.requiresColons?`<:${this.name}:${this.id}>`:this.name}delete(e){return this.client.api.guilds(this.guild.id).emojis(this.id).delete({reason:e}).then(()=>this)}equals(e){return e instanceof Emoji?e.id===this.id&&e.name===this.name&&e.managed===this.managed&&e.requiresColons===this.requiresColons&&e._roles===this._roles:e.id===this.id&&e.name===this.name&&e._roles===this._roles}}e.exports=Emoji},function(e,t){class ReactionEmoji{constructor(e,t,i){this.reaction=e,this.name=t,this.id=i}get identifier(){return this.id?`${this.name}:${this.id}`:encodeURIComponent(this.name)}toString(){return this.id?`<:${this.name}:${this.id}>`:this.name}}e.exports=ReactionEmoji},function(e,t){var i={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==i.call(e)}},function(e,t,i){"use strict";(function(t,n){function s(e){return P.from(e)}function r(e){return P.isBuffer(e)||e instanceof j}function o(e,t,i){if("function"==typeof e.prependListener)return e.prependListener(t,i);e._events&&e._events[t]?O(e._events[t])?e._events[t].unshift(i):e._events[t]=[i,e._events[t]]:e.on(t,i)}function a(e,t){M=M||i(16),e=e||{},this.objectMode=!!e.objectMode,t instanceof M&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var n=e.highWaterMark,s=this.objectMode?16:16384;this.highWaterMark=n||0===n?n:s,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new z,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(H||(H=i(52).StringDecoder),this.decoder=new H(e.encoding),this.encoding=e.encoding)}function c(e){if(M=M||i(16),!(this instanceof c))return new c(e);this._readableState=new a(e,this),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),U.call(this)}function l(e,t,i,n,r){var o=e._readableState;if(null===t)o.reading=!1,m(e,o);else{var a;r||(a=u(o,t)),a?e.emit("error",a):o.objectMode||t&&t.length>0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===P.prototype||(t=s(t)),n?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):h(e,o,t,!0):o.ended?e.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!i?(t=o.decoder.write(t),o.objectMode||0!==t.length?h(e,o,t,!1):E(e,o)):h(e,o,t,!1))):n||(o.reading=!1)}return p(o)}function h(e,t,i,n){t.flowing&&0===t.length&&!t.sync?(e.emit("data",i),e.read(0)):(t.length+=t.objectMode?1:i.length,n?t.buffer.unshift(i):t.buffer.push(i),t.needReadable&&g(e)),E(e,t)}function u(e,t){var i;return r(t)||"string"==typeof t||void 0===t||e.objectMode||(i=new TypeError("Invalid non-string/buffer chunk")),i}function p(e){return!e.ended&&(e.needReadable||e.length=W?e=W:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function f(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!==e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=d(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function m(e,t){if(!t.ended){if(t.decoder){var i=t.decoder.end();i&&i.length&&(t.buffer.push(i),t.length+=t.objectMode?1:i.length)}t.ended=!0,g(e)}}function g(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(q("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?N(v,e):v(e))}function v(e){q("emit readable"),e.emit("readable"),A(e)}function E(e,t){t.readingMore||(t.readingMore=!0,N(_,e,t))}function _(e,t){for(var i=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(i=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):i=T(e,t.buffer,t.decoder),i}function T(e,t,i){var n;return er.length?r.length:e;if(o===r.length?s+=r:s+=r.slice(0,e),0===(e-=o)){o===r.length?(++n,i.next?t.head=i.next:t.head=t.tail=null):(t.head=i,i.data=r.slice(o));break}++n}return t.length-=n,s}function I(e,t){var i=P.allocUnsafe(e),n=t.head,s=1;for(n.data.copy(i),e-=n.data.length;n=n.next;){var r=n.data,o=e>r.length?r.length:e;if(r.copy(i,i.length-e,0,o),0===(e-=o)){o===r.length?(++s,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=r.slice(o));break}++s}return t.length-=s,i}function D(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,N(C,t,e))}function C(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function k(e,t){for(var i=0,n=e.length;i=t.highWaterMark||t.ended))return q("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?D(this):g(this),null;if(0===(e=f(e,t))&&t.ended)return 0===t.length&&D(this),null;var n=t.needReadable;q("need readable",n),(0===t.length||t.length-e0?S(e,t):null)?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),i!==e&&t.ended&&D(this)),null!==s&&this.emit("data",s),s},c.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},c.prototype.pipe=function(e,t){function i(e,t){q("onunpipe"),e===p&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,r())}function s(){q("onend"),e.end()}function r(){q("cleanup"),e.removeListener("close",l),e.removeListener("finish",h),e.removeListener("drain",m),e.removeListener("error",c),e.removeListener("unpipe",i),p.removeListener("end",s),p.removeListener("end",u),p.removeListener("data",a),g=!0,!d.awaitDrain||e._writableState&&!e._writableState.needDrain||m()}function a(t){q("ondata"),v=!1,!1!==e.write(t)||v||((1===d.pipesCount&&d.pipes===e||d.pipesCount>1&&-1!==k(d.pipes,e))&&!g&&(q("false write response, pause",p._readableState.awaitDrain),p._readableState.awaitDrain++,v=!0),p.pause())}function c(t){q("onerror",t),u(),e.removeListener("error",c),0===L(e,"error")&&e.emit("error",t)}function l(){e.removeListener("finish",h),u()}function h(){q("onfinish"),e.removeListener("close",l),u()}function u(){q("unpipe"),p.unpipe(e)}var p=this,d=this._readableState;switch(d.pipesCount){case 0:d.pipes=e;break;case 1:d.pipes=[d.pipes,e];break;default:d.pipes.push(e)}d.pipesCount+=1,q("pipe count=%d opts=%j",d.pipesCount,t);var f=(!t||!1!==t.end)&&e!==n.stdout&&e!==n.stderr?s:u;d.endEmitted?N(f):p.once("end",f),e.on("unpipe",i);var m=y(p);e.on("drain",m);var g=!1,v=!1;return p.on("data",a),o(e,"error",c),e.once("close",l),e.once("finish",h),e.emit("pipe",p),d.flowing||(q("pipe resume"),p.resume()),e},c.prototype.unpipe=function(e){var t=this._readableState,i={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,i),this);if(!e){var n=t.pipes,s=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var r=0;r=this.charLength-this.charReceived?this.charLength-this.charReceived:e.length;if(e.copy(this.charBuffer,this.charReceived,0,i),this.charReceived+=i,this.charReceived=55296&&s<=56319)){if(this.charReceived=this.charLength=0,0===e.length)return t;break}this.charLength+=this.surrogateSize,t=""}this.detectIncompleteChar(e);n=e.length;this.charLength&&(e.copy(this.charBuffer,0,e.length-this.charReceived,n),n-=this.charReceived);var n=(t+=e.toString(this.encoding,0,n)).length-1,s=t.charCodeAt(n);if(s>=55296&&s<=56319){var r=this.surrogateSize;return this.charLength+=r,this.charReceived+=r,this.charBuffer.copy(this.charBuffer,r,0,r),e.copy(this.charBuffer,0,0,r),t.substring(0,n)}return t},l.prototype.detectIncompleteChar=function(e){for(var t=e.length>=3?3:e.length;t>0;t--){var i=e[e.length-t];if(1==t&&i>>5==6){this.charLength=2;break}if(t<=2&&i>>4==14){this.charLength=3;break}if(t<=3&&i>>3==30){this.charLength=4;break}}this.charReceived=t},l.prototype.end=function(e){var t="";if(e&&e.length&&(t=this.write(e)),this.charReceived){var i=this.charReceived,n=this.charBuffer,s=this.encoding;t+=n.slice(0,i).toString(s)}return t}},function(e,t,i){"use strict";function n(e){this.afterTransform=function(t,i){return s(e,t,i)},this.needTransform=!1,this.transforming=!1,this.writecb=null,this.writechunk=null,this.writeencoding=null}function s(e,t,i){var n=e._transformState;n.transforming=!1;var s=n.writecb;if(!s)return e.emit("error",new Error("write callback called multiple times"));n.writechunk=null,n.writecb=null,null!==i&&void 0!==i&&e.push(i),s(t);var r=e._readableState;r.reading=!1,(r.needReadable||r.length",'"',"`"," ","\r","\n","\t"],u=["{","}","|","\\","^","`"].concat(h),p=["'"].concat(u),d=["%","/","?",";","#"].concat(p),f=["/","?","#"],m=/^[+a-z0-9A-Z_-]{0,63}$/,g=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,v={javascript:!0,"javascript:":!0},E={javascript:!0,"javascript:":!0},_={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},y=i(31);n.prototype.parse=function(e,t,i){if(!o.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var n=e.indexOf("?"),s=-1!==n&&n127?O+="x":O+=M[L];if(!O.match(m)){var P=k.slice(0,T),j=k.slice(T+1),G=M.match(g);G&&(P.push(G[1]),j.unshift(G[2])),j.length&&(u="/"+j.join(".")+u),this.hostname=P.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),C||(this.hostname=r.toASCII(this.hostname));var B=this.port?":"+this.port:"",q=this.hostname||"";this.host=q+B,this.href+=this.host,C&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==u[0]&&(u="/"+u))}if(!v[x])for(var T=0,N=p.length;T0)&&i.host.split("@"))&&(i.auth=C.shift(),i.host=i.hostname=C.shift())),i.search=e.search,i.query=e.query,o.isNull(i.pathname)&&o.isNull(i.search)||(i.path=(i.pathname?i.pathname:"")+(i.search?i.search:"")),i.href=i.format(),i;if(!w.length)return i.pathname=null,i.search?i.path="/"+i.search:i.path=null,i.href=i.format(),i;for(var S=w.slice(-1)[0],T=(i.host||e.host||w.length>1)&&("."===S||".."===S)||""===S,R=0,I=w.length;I>=0;I--)"."===(S=w[I])?w.splice(I,1):".."===S?(w.splice(I,1),R++):R&&(w.splice(I,1),R--);if(!y&&!b)for(;R--;R)w.unshift("..");!y||""===w[0]||w[0]&&"/"===w[0].charAt(0)||w.unshift(""),T&&"/"!==w.join("/").substr(-1)&&w.push("");var D=""===w[0]||w[0]&&"/"===w[0].charAt(0);if(A){i.hostname=i.host=D?"":w.length?w.shift():"";var C=!!(i.host&&i.host.indexOf("@")>0)&&i.host.split("@");C&&(i.auth=C.shift(),i.host=i.hostname=C.shift())}return(y=y||i.host&&w.length)&&!D&&w.unshift(""),w.length?i.pathname=w.join("/"):(i.pathname=null,i.path=null),o.isNull(i.pathname)&&o.isNull(i.search)||(i.path=(i.pathname?i.pathname:"")+(i.search?i.search:"")),i.auth=e.auth||i.auth,i.slashes=i.slashes||e.slashes,i.href=i.format(),i},n.prototype.parseHost=function(){var e=this.host,t=c.exec(e);t&&(":"!==(t=t[0])&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)}},function(e,t,i){const n=i(107),s=i(108);e.exports={buffer:function(e){const t=s(e);return t?t.mime:n.bin},lookup:function(e){return n[e.replace(/^\./,"")]||n.bin}}},function(e,t){e.exports={name:"discord.js",version:"12.0.0-dev",description:"A powerful library for interacting with the Discord API",main:"./src/index",types:"./typings/index.d.ts",scripts:{test:"npm run lint && npm run docs:test",docs:"docgen --source src --custom docs/index.yml --output docs/docs.json --jsdoc jsdoc.json","docs:test":"docgen --source src --custom docs/index.yml --jsdoc jsdoc.json",lint:"eslint src","lint:fix":"eslint --fix src",webpack:"parallel-webpack"},repository:{type:"git",url:"git+https://github.com/hydrabolt/discord.js.git"},keywords:["discord","api","bot","client","node","discordapp"],author:"Amish Shah ",license:"Apache-2.0",bugs:{url:"https://github.com/hydrabolt/discord.js/issues"},homepage:"https://github.com/hydrabolt/discord.js#readme",runkitExampleFilename:"./docs/examples/ping.js",dependencies:{long:"^3.0.0","prism-media":"^0.0.1",snekfetch:"^3.0.0",tweetnacl:"^1.0.0",ws:"^3.0.0"},peerDependencies:{bufferutil:"^3.0.0",erlpack:"hammerandchisel/erlpack","node-opus":"^0.2.0",opusscript:"^0.0.3",sodium:"^2.0.0","libsodium-wrappers":"^0.5.0",uws:"^8.14.0"},devDependencies:{"@types/node":"^8.0.0","discord.js-docgen":"hydrabolt/discord.js-docgen",eslint:"^4.0.0","jsdoc-strip-async-await":"^0.1.0","parallel-webpack":"^2.0.0","uglifyjs-webpack-plugin":"^1.0.0-beta.2",webpack:"^3.0.0"},engines:{node:">=8.0.0"},browser:{ws:!1,uws:!1,erlpack:!1,"prism-media":!1,opusscript:!1,"node-opus":!1,tweetnacl:!1,sodium:!1,"src/sharding/Shard.js":!1,"src/sharding/ShardClientUtil.js":!1,"src/sharding/ShardingManager.js":!1,"src/client/voice/dispatcher/StreamDispatcher.js":!1,"src/client/voice/opus/BaseOpusEngine.js":!1,"src/client/voice/opus/NodeOpusEngine.js":!1,"src/client/voice/opus/OpusEngineList.js":!1,"src/client/voice/opus/OpusScriptEngine.js":!1,"src/client/voice/pcm/ConverterEngine.js":!1,"src/client/voice/pcm/ConverterEngineList.js":!1,"src/client/voice/pcm/FfmpegConverterEngine.js":!1,"src/client/voice/player/AudioPlayer.js":!1,"src/client/voice/receiver/VoiceReadable.js":!1,"src/client/voice/receiver/VoiceReceiver.js":!1,"src/client/voice/util/Secretbox.js":!1,"src/client/voice/util/SecretKey.js":!1,"src/client/voice/util/VolumeInterface.js":!1,"src/client/voice/ClientVoiceManager.js":!1,"src/client/voice/VoiceBroadcast.js":!1,"src/client/voice/VoiceConnection.js":!1,"src/client/voice/VoiceUDPClient.js":!1,"src/client/voice/VoiceWebSocket.js":!1}}},function(e,t,i){function n(e){return class DiscordjsError extends e{constructor(e,...t){super(s(e,t)),this[r]=e,Error.captureStackTrace&&Error.captureStackTrace(this,DiscordjsError)}get name(){return`${super.name} [${this[r]}]`}get code(){return this[r]}}}function s(e,t){a.strictEqual(typeof e,"string");const i=o.get(e);a(i,`An invalid error message key was used: ${e}.`);let n=c.format;if("function"==typeof i)n=i;else{if(void 0===t||0===t.length)return i;t.unshift(i)}return String(n(...t))}const r=Symbol("code"),o=new Map,a=i(110),c=i(40);e.exports={register:function(e,t){o.set(e,"function"==typeof t?t:String(t))},Error:n(Error),TypeError:n(TypeError),RangeError:n(RangeError)}},function(e,t,i){const n=i(115),s=i(116),r=i(120),o=i(121),{Error:a}=i(4),c=i(0);class RESTManager{constructor(e,t="Bot"){this.client=e,this.handlers={},this.userAgentManager=new n(this),this.rateLimitedEndpoints={},this.globallyRateLimited=!1,this.tokenPrefix=t,this.versioned=!0}get api(){return o(this)}getAuth(){const e=this.client.token||this.client.accessToken,t=!!this.client.application||this.client.user&&this.client.user.bot;if(e&&t)return`${this.tokenPrefix} ${e}`;if(e)return e;throw new a("TOKEN_MISSING")}get cdn(){return c.Endpoints.CDN(this.client.options.http.cdn)}destroy(){for(const e of Object.values(this.handlers))e.destroy&&e.destroy()}push(e,t){return new Promise((i,n)=>{e.push({request:t,resolve:i,reject:n})})}getRequestHandler(){const e=this.client.options.apiRequestMethod;if("function"==typeof e)return e;const t=s[e];if(!t)throw new a("RATELIMIT_INVALID_METHOD");return t}request(e,t,i={}){const n=new r(this,e,t,i);return this.handlers[n.route]||(this.handlers[n.route]=new s.RequestHandler(this,this.getRequestHandler())),this.push(this.handlers[n.route],n)}set endpoint(e){this.client.options.http.api=e}}e.exports=RESTManager},function(e,t){class DiscordAPIError extends Error{constructor(e,t){super();const i=this.constructor.flattenErrors(t.errors||t).join("\n");this.name="DiscordAPIError",this.message=t.message&&i?`${t.message}\n${i}`:t.message||i,this.path=e,this.code=t.code}static flattenErrors(e,t=""){let i=[];for(const[n,s]of Object.entries(e)){if("message"===n)continue;const e=t?isNaN(n)?`${t}.${n}`:`${t}[${n}]`:n;s._errors?i.push(`${e}: ${s._errors.map(e=>e.message).join(" ")}`):s.code||s.message?i.push(`${s.code?`${s.code}: `:""}${s.message}`.trim()):"string"==typeof s?i.push(s):i=i.concat(this.flattenErrors(s,e))}return i}}e.exports=DiscordAPIError},function(e,t,i){const n=i(32),s=i(3),r=i(76),o=i(77),a=i(0),c=i(7),l=i(13),h=i(35);class ClientUser extends n{_patch(e){if(super._patch(e),this.verified=e.verified,this.email=e.email,this._typing=new Map,this.friends=new s,this.blocked=new s,this.notes=new s,this.premium="boolean"==typeof e.premium?e.premium:null,this.mfaEnabled="boolean"==typeof e.mfa_enabled?e.mfa_enabled:null,this.mobile="boolean"==typeof e.mobile?e.mobile:null,this.settings=e.user_settings?new r(this,e.user_settings):null,this.guildSettings=new s,e.user_guild_settings)for(const t of e.user_guild_settings)this.guildSettings.set(t.guild_id,new o(this.client,t))}get presence(){return this.client.presences.clientPresence}edit(e,t){return this.bot||("object"!=typeof t?e.password=t:(e.code=t.mfaCode,e.password=t.password)),this.client.api.users("@me").patch({data:e}).then(e=>(this.client.token=e.token,this.client.actions.UserUpdate.handle(e).updated))}setUsername(e,t){return this.edit({username:e},t)}setEmail(e,t){return this.edit({email:e},t)}setPassword(e,t){return this.edit({new_password:e},{password:t.oldPassword,mfaCode:t.mfaCode})}async setAvatar(e){return this.edit({avatar:await l.resolveImage(e,this.client.browser)})}setPresence(e){return this.client.presences.setClientPresence(e)}setStatus(e){return this.setPresence({status:e})}setActivity(e,{url:t,type:i}={}){return e?this.setPresence({activity:{name:e,type:i,url:t}}):this.setPresence({activity:null})}setAFK(e){return this.setPresence({afk:e})}fetchMentions(e={}){return e.guild instanceof h&&(e.guild=e.guild.id),c.mergeDefault({limit:25,roles:!0,everyone:!0,guild:null},e),this.client.api.users("@me").mentions.get({query:e}).then(e=>e.map(e=>this.client.channels.get(e.channel_id).messages.create(e,!1)))}createGuild(e,{region:t,icon:i=null}={}){return!i||"string"==typeof i&&i.startsWith("data:")?new Promise((n,s)=>this.client.api.guilds.post({data:{name:e,region:t,icon:i}}).then(e=>{if(this.client.guilds.has(e.id))return n(this.client.guilds.get(e.id));const t=s=>{s.id===e.id&&(this.client.removeListener(a.Events.GUILD_CREATE,t),this.client.clearTimeout(i),n(s))};this.client.on(a.Events.GUILD_CREATE,t);const i=this.client.setTimeout(()=>{this.client.removeListener(a.Events.GUILD_CREATE,t),n(this.client.guilds.create(e))},1e4)},s)):l.resolveImage(i,this.client.browser).then(i=>this.createGuild(e,{region:t,icon:i||null}))}createGroupDM(e){const t=this.bot?{access_tokens:e.map(e=>e.accessToken),nicks:e.reduce((e,t)=>(t.nick&&(e[t.user?t.user.id:t.id]=t.nick),e),{})}:{recipients:e.map(e=>this.client.users.resolveID(e.user||e.id))};return this.client.api.users("@me").channels.post({data:t}).then(e=>this.client.channels.create(e))}}e.exports=ClientUser},function(e,t,i){const n=i(42);class MessageCollector extends n{constructor(e,t,i={}){super(e.client,t,i),this.channel=e,this.received=0;const n=(e=>{for(const t of e.values())this.handleDispose(t)}).bind(this);this.client.on("message",this.handleCollect),this.client.on("messageDelete",this.handleDispose),this.client.on("messageDeleteBulk",n),this.once("end",()=>{this.client.removeListener("message",this.handleCollect),this.client.removeListener("messageDelete",this.handleDispose),this.client.removeListener("messageDeleteBulk",n)})}collect(e){return e.channel.id!==this.channel.id?null:(this.received++,{key:e.id,value:e})}dispose(e){return e.channel.id===this.channel.id?e.id:null}endReason(){return this.options.max&&this.collected.size>=this.options.max?"limit":this.options.maxProcessed&&this.received===this.options.maxProcessed?"processedLimit":null}}e.exports=MessageCollector},function(e,t,i){e.exports={search:i(129),sendMessage:i(135)}},function(e,t,i){const n=i(17),s=i(26),r=i(33);class DMChannel extends n{constructor(e,t){super(e,t),this.messages=new r(this),this._typing=new Map}_patch(e){super._patch(e),this.recipient=this.client.users.create(e.recipients[0]),this.lastMessageID=e.last_message_id}toString(){return this.recipient.toString()}send(){}search(){}startTyping(){}stopTyping(){}get typing(){}get typingCount(){}createMessageCollector(){}awaitMessages(){}acknowledge(){}_cacheMessage(){}}s.applyToClass(DMChannel,!0,["bulkDelete"]),e.exports=DMChannel},function(e,t,i){const n=i(3),s=i(18);class MessageMentions{constructor(e,t,i,s){if(this.everyone=Boolean(s),t)if(t instanceof n)this.users=new n(t);else{this.users=new n;for(const i of t){let t=e.client.users.create(i);this.users.set(t.id,t)}}else this.users=new n;if(i)if(i instanceof n)this.roles=new n(i);else{this.roles=new n;for(const t of i){const i=e.channel.guild.roles.get(t);i&&this.roles.set(i.id,i)}}else this.roles=new n;this._content=e.content,this._client=e.client,this._guild=e.channel.guild,this._members=null,this._channels=null}get members(){return this._members?this._members:this._guild?(this._members=new n,this.users.forEach(e=>{const t=this._guild.member(e);t&&this._members.set(t.user.id,t)}),this._members):null}get channels(){if(this._channels)return this._channels;this._channels=new n;let e;for(;null!==(e=this.constructor.CHANNELS_PATTERN.exec(this._content));){const t=this._client.channels.get(e[1]);t&&this._channels.set(t.id,t)}return this._channels}has(e,t=!0){if(t&&this.everyone)return!0;if(t&&e instanceof s)for(const t of this.roles.values())if(e.roles.has(t.id))return!0;const i=e.id||e;return this.users.has(i)||this.channels.has(i)||this.roles.has(i)}}MessageMentions.EVERYONE_PATTERN=/@(everyone|here)/g,MessageMentions.USERS_PATTERN=/<@!?(1|\d{17,19})>/g,MessageMentions.ROLES_PATTERN=/<@&(\d{17,19})>/g,MessageMentions.CHANNELS_PATTERN=/<#(\d{17,19})>/g,e.exports=MessageMentions},function(e,t,i){const n=i(42),s=i(3);class ReactionCollector extends n{constructor(e,t,i={}){super(e.client,t,i),this.message=e,this.users=new s,this.total=0,this.empty=this.empty.bind(this),this.client.on("messageReactionAdd",this.handleCollect),this.client.on("messageReactionRemove",this.handleDispose),this.client.on("messageReactionRemoveAll",this.empty),this.once("end",()=>{this.client.removeListener("messageReactionAdd",this.handleCollect),this.client.removeListener("messageReactionRemove",this.handleDispose),this.client.removeListener("messageReactionRemoveAll",this.empty)}),this.on("collect",(e,t,i)=>{this.total++,this.users.set(i.id,i)}),this.on("dispose",(e,t,i)=>{this.total--,this.collected.some(e=>e.users.has(i.id))||this.users.delete(i.id)})}collect(e){return e.message.id!==this.message.id?null:{key:ReactionCollector.key(e),value:e}}dispose(e){return e.message.id!==this.message.id||e.count?null:ReactionCollector.key(e)}empty(){this.total=0,this.collected.clear(),this.users.clear(),this.checkEnd()}endReason(){return this.options.max&&this.total>=this.options.max?"limit":this.options.maxEmojis&&this.collected.size>=this.options.maxEmojis?"emojiLimit":this.options.maxUsers&&this.users.size>=this.options.maxUsers?"userLimit":null}static key(e){return e.emoji.id||e.emoji.name}}e.exports=ReactionCollector},function(e,t,i){const n=i(3),s=i(46),r=i(47),{Error:o}=i(4);class MessageReaction{constructor(e,t,i){this.message=i,this.me=t.me,this.count=t.count||0,this.users=new n,this._emoji=new r(this,t.emoji.name,t.emoji.id)}get emoji(){if(this._emoji instanceof s)return this._emoji;if(this._emoji.id){const e=this.message.client.emojis;if(e.has(this._emoji.id)){const t=e.get(this._emoji.id);return this._emoji=t,t}}return this._emoji}remove(e=this.message.client.user){const t=this.message.client.users.resolveID(e);return t?this.message.client.api.channels[this.message.channel.id].messages[this.message.id].reactions[this.emoji.identifier][t===this.message.client.user.id?"@me":t].delete().then(()=>this.message.client.actions.MessageReactionRemove.handle({user_id:t,message_id:this.message.id,emoji:this.emoji,channel_id:this.message.channel.id}).reaction):Promise.reject(new o("REACTION_RESOLVE_USER"))}async fetchUsers({limit:e=100,after:t}={}){const i=this.message,n=await i.client.api.channels[i.channel.id].messages[i.id].reactions[this.emoji.identifier].get({query:{limit:e,after:t}});for(const e of n){const t=i.client.users.create(e);this.users.set(t.id,t)}return this.count=this.users.size,this.users}_add(e){this.users.has(e.id)||(this.users.set(e.id,e),this.count++),this.me||(this.me=e.id===this.message.client.user.id)}_remove(e){this.users.has(e.id)&&(this.users.delete(e.id),this.count--,e.id===this.message.client.user.id&&(this.me=!1),this.count<=0&&this.message.reactions.remove(this.emoji.id||this.emoji.name))}}e.exports=MessageReaction},function(e,t,i){const n=i(17),s=i(26),r=i(3),o=i(13),a=i(33);class GroupDMChannel extends n{constructor(e,t){super(e,t),this.messages=new a(this),this._typing=new Map}_patch(e){if(super._patch(e),this.name=e.name,this.icon=e.icon,this.ownerID=e.owner_id,this.managed=e.managed,this.applicationID=e.application_id,e.nicks&&(this.nicks=new r(e.nicks.map(e=>[e.id,e.nick]))),this.recipients||(this.recipients=new r),e.recipients)for(const t of e.recipients){const e=this.client.users.create(t);this.recipients.set(e.id,e)}this.lastMessageID=e.last_message_id}get owner(){return this.client.users.get(this.ownerID)}iconURL({format:e,size:t}={}){return this.icon?this.client.rest.cdn.GDMIcon(this.id,this.icon,e,t):null}equals(e){const t=e&&this.id===e.id&&this.name===e.name&&this.icon===e.icon&&this.ownerID===e.ownerID;return t?this.recipients.equals(e.recipients):t}edit(e,t){return this.client.api.channels[this.id].patch({data:{icon:e.icon,name:null===e.name?null:e.name||this.name},reason:t}).then(()=>this)}async setIcon(e){return this.edit({icon:await o.resolveImage(e,this.client.browser)})}setName(e){return this.edit({name:e})}addUser({user:e,accessToken:t,nick:i}){const n=this.client.users.resolveID(e),s=this.client.user.bot?{nick:i,access_token:t}:{recipient:n};return this.client.api.channels[this.id].recipients[n].put({data:s}).then(()=>this)}removeUser(e){const t=this.client.users.resolveID(e);return this.client.api.channels[this.id].recipients[t].delete().then(()=>this)}toString(){return this.name}send(){}search(){}startTyping(){}stopTyping(){}get typing(){}get typingCount(){}createMessageCollector(){}awaitMessages(){}acknowledge(){}_cacheMessage(){}}s.applyToClass(GroupDMChannel,!0,["bulkDelete"]),e.exports=GroupDMChannel},function(e,t,i){const n=i(21),s=i(22),r=i(26),o=i(3),a=i(13),c=i(33);class TextChannel extends n{constructor(e,t){super(e,t),this.messages=new c(this),this._typing=new Map}_patch(e){if(super._patch(e),this.topic=e.topic,this.nsfw=Boolean(e.nsfw),this.lastMessageID=e.last_message_id,e.messages)for(const t of e.messages)this.messages.create(t)}fetchWebhooks(){return this.client.api.channels[this.id].webhooks.get().then(e=>{const t=new o;for(const i of e)t.set(i.id,new s(this.client,i));return t})}async createWebhook(e,{avatar:t,reason:i}={}){return"string"!=typeof t||t.startsWith("data:")||(t=await a.resolveImage(t,this.client.browser)),this.client.api.channels[this.id].webhooks.post({data:{name:e,avatar:t},reason:i}).then(e=>new s(this.client,e))}send(){}search(){}startTyping(){}stopTyping(){}get typing(){}get typingCount(){}createMessageCollector(){}awaitMessages(){}bulkDelete(){}acknowledge(){}_cacheMessage(){}}r.applyToClass(TextChannel,!0),e.exports=TextChannel},function(e,t,i){const n=i(12);class PermissionOverwrites{constructor(e,t){Object.defineProperty(this,"channel",{value:e}),t&&this._patch(t)}_patch(e){this.id=e.id,this.type=e.type,this._denied=e.deny,this._allowed=e.allow,this.denied=new n(this._denied),this.allowed=new n(this._allowed)}delete(e){return this.channel.client.api.channels[this.channel.id].permissions[this.id].delete({reason:e}).then(()=>this)}}e.exports=PermissionOverwrites},function(e,t,i){const n=i(21),s=i(3),{Error:r}=i(4);class VoiceChannel extends n{constructor(e,t){super(e,t),Object.defineProperty(this,"members",{value:new s})}_patch(e){super._patch(e),this.bitrate=.001*e.bitrate,this.userLimit=e.user_limit}get connection(){const e=this.guild.voiceConnection;return e&&e.channel.id===this.id?e:null}get full(){return this.userLimit>0&&this.members.size>=this.userLimit}get joinable(){return!this.client.browser&&(!!this.permissionsFor(this.client.user).has("CONNECT")&&!(this.full&&!this.permissionsFor(this.client.user).has("MOVE_MEMBERS")))}get speakable(){return this.permissionsFor(this.client.user).has("SPEAK")}setBitrate(e,t){return e*=1e3,this.edit({bitrate:e},t)}setUserLimit(e,t){return this.edit({userLimit:e},t)}join(){return this.client.browser?Promise.reject(new r("VOICE_NO_BROWSER")):this.client.voice.joinChannel(this)}leave(){if(this.client.browser)return;const e=this.client.voice.connections.get(this.guild.id);e&&e.channel.id===this.id&&e.disconnect()}}e.exports=VoiceChannel},function(e,t,i){const n=i(3),s=i(9),r=i(22),o={ALL:"ALL",GUILD:"GUILD",CHANNEL:"CHANNEL",USER:"USER",ROLE:"ROLE",INVITE:"INVITE",WEBHOOK:"WEBHOOK",EMOJI:"EMOJI",MESSAGE:"MESSAGE",UNKNOWN:"UNKNOWN"},a={ALL:null,GUILD_UPDATE:1,CHANNEL_CREATE:10,CHANNEL_UPDATE:11,CHANNEL_DELETE:12,CHANNEL_OVERWRITE_CREATE:13,CHANNEL_OVERWRITE_UPDATE:14,CHANNEL_OVERWRITE_DELETE:15,MEMBER_KICK:20,MEMBER_PRUNE:21,MEMBER_BAN_ADD:22,MEMBER_BAN_REMOVE:23,MEMBER_UPDATE:24,MEMBER_ROLE_UPDATE:25,ROLE_CREATE:30,ROLE_UPDATE:31,ROLE_DELETE:32,INVITE_CREATE:40,INVITE_UPDATE:41,INVITE_DELETE:42,WEBHOOK_CREATE:50,WEBHOOK_UPDATE:51,WEBHOOK_DELETE:52,EMOJI_CREATE:60,EMOJI_UPDATE:61,EMOJI_DELETE:62,MESSAGE_DELETE:72};class GuildAuditLogs{constructor(e,t){if(t.users)for(const i of t.users)e.client.users.create(i);if(this.webhooks=new n,t.webhooks)for(const i of t.webhooks)this.webhooks.set(i.id,new r(e.client,i));this.entries=new n;for(const i of t.audit_log_entries){const t=new GuildAuditLogsEntry(e,i);this.entries.set(t.id,t)}}static build(...e){const t=new GuildAuditLogs(...e);return Promise.all(t.entries.map(e=>e.target)).then(()=>t)}static targetType(e){return e<10?o.GUILD:e<20?o.CHANNEL:e<30?o.USER:e<40?o.ROLE:e<50?o.INVITE:e<60?o.WEBHOOK:e<70?o.EMOJI:e<80?o.MESSAGE:o.UNKNOWN}static actionType(e){return[a.CHANNEL_CREATE,a.CHANNEL_OVERWRITE_CREATE,a.MEMBER_BAN_REMOVE,a.ROLE_CREATE,a.INVITE_CREATE,a.WEBHOOK_CREATE,a.EMOJI_CREATE].includes(e)?"CREATE":[a.CHANNEL_DELETE,a.CHANNEL_OVERWRITE_DELETE,a.MEMBER_KICK,a.MEMBER_PRUNE,a.MEMBER_BAN_ADD,a.ROLE_DELETE,a.INVITE_DELETE,a.WEBHOOK_DELETE,a.EMOJI_DELETE,a.MESSAGE_DELETE].includes(e)?"DELETE":[a.GUILD_UPDATE,a.CHANNEL_UPDATE,a.CHANNEL_OVERWRITE_UPDATE,a.MEMBER_UPDATE,a.MEMBER_ROLE_UPDATE,a.ROLE_UPDATE,a.INVITE_UPDATE,a.WEBHOOK_UPDATE,a.EMOJI_UPDATE].includes(e)?"UPDATE":"ALL"}}class GuildAuditLogsEntry{constructor(e,t){const i=GuildAuditLogs.targetType(t.action_type);if(this.targetType=i,this.actionType=GuildAuditLogs.actionType(t.action_type),this.action=Object.keys(a).find(e=>a[e]===t.action_type),this.reason=t.reason||null,this.executor=e.client.users.get(t.user_id),this.changes=t.changes?t.changes.map(e=>({key:e.key,old:e.old_value,new:e.new_value})):null,this.id=t.id,this.extra=null,t.options)if(t.action_type===a.MEMBER_PRUNE)this.extra={removed:t.options.members_removed,days:t.options.delete_member_days};else if(t.action_type===a.MESSAGE_DELETE)this.extra={count:t.options.count,channel:e.channels.get(t.options.channel_id)};else switch(t.options.type){case"member":this.extra=e.members.get(t.options.id),this.extra||(this.extra={id:t.options.id});break;case"role":this.extra=e.roles.get(t.options.id),this.extra||(this.extra={id:t.options.id,name:t.options.role_name})}if(i===o.UNKNOWN)this.target=this.changes.reduce((e,t)=>(e[t.key]=t.new||t.old,e),{}),this.target.id=t.target_id;else if([o.USER,o.GUILD].includes(i))this.target=e.client[`${i.toLowerCase()}s`].get(t.target_id);else if(i===o.WEBHOOK)this.target=this.webhooks.get(t.target_id);else if(i===o.INVITE)if(e.me.permissions.has("MANAGE_GUILD")){const t=this.changes.find(e=>"code"===e.key);this.target=e.fetchInvites().then(e=>(this.target=e.find(e=>e.code===(t.new||t.old)),this.target))}else this.target=this.changes.reduce((e,t)=>(e[t.key]=t.new||t.old,e),{});else i===o.MESSAGE?this.target=e.client.users.get(t.target_id):this.target=e[`${i.toLowerCase()}s`].get(t.target_id)}get createdTimestamp(){return s.deconstruct(this.id).timestamp}get createdAt(){return new Date(this.createdTimestamp)}}GuildAuditLogs.Actions=a,GuildAuditLogs.Targets=o,GuildAuditLogs.Entry=GuildAuditLogsEntry,e.exports=GuildAuditLogs},function(e,t){class VoiceRegion{constructor(e){this.id=e.id,this.name=e.name,this.vip=e.vip,this.deprecated=e.deprecated,this.optimal=e.optimal,this.custom=e.custom,this.sampleHostname=e.sample_hostname}}e.exports=VoiceRegion},function(e,t,i){const n=i(11),{Presence:s}=i(19);class PresenceStore extends n{constructor(e,t){super(e,t,s)}create(e,t){const i=this.get(e.user.id);return i?i.patch(e):super.create(e,t,{id:e.user.id})}resolve(e){const t=super.resolve(e);if(t)return t;const i=this.client.users.resolveID(e);return super.resolve(i)||null}resolveID(e){const t=super.resolveID(e);if(t)return t;const i=this.client.users.resolveID(e);return this.has(i)?i:null}}e.exports=PresenceStore},function(e,t,i){const n=i(0),s=i(7),{Error:r}=i(4);class ClientUserSettings{constructor(e,t){this.user=e,this.patch(t)}patch(e){for(const[t,i]of Object.entries(n.UserSettingsMap))e.hasOwnProperty(t)&&("function"==typeof i?this[i.name]=i(e[t]):this[i]=e[t])}update(e,t){return this.user.client.api.users["@me"].settings.patch({data:{[e]:t}})}setGuildPosition(e,t,i){const n=Object.assign([],this.guildPositions);return s.moveElementInArray(n,e.id,t,i),this.update("guild_positions",n).then(()=>e)}addRestrictedGuild(e){const t=Object.assign([],this.restrictedGuilds);return t.includes(e.id)?Promise.reject(new r("GUILD_RESTRICTED",!0)):(t.push(e.id),this.update("restricted_guilds",t).then(()=>e))}removeRestrictedGuild(e){const t=Object.assign([],this.restrictedGuilds),i=t.indexOf(e.id);return i<0?Promise.reject(new r("GUILD_RESTRICTED")):(t.splice(i,1),this.update("restricted_guilds",t).then(()=>e))}}e.exports=ClientUserSettings},function(e,t,i){const n=i(0),s=i(3),r=i(138);class ClientUserGuildSettings{constructor(e,t){Object.defineProperty(this,"client",{value:e}),this.guildID=t.guild_id,this.channelOverrides=new s,this.patch(t)}patch(e){for(const[t,i]of Object.entries(n.UserGuildSettingsMap))if(e.hasOwnProperty(t))if("channel_overrides"===t)for(const i of e[t]){const e=this.channelOverrides.get(i.channel_id);e?e.patch(i):this.channelOverrides.set(i.channel_id,new r(i))}else"function"==typeof i?this[i.name]=i(e[t]):this[i]=e[t]}update(e,t){return this.client.api.users("@me").guilds(this.guildID).settings.patch({data:{[e]:t}})}}e.exports=ClientUserGuildSettings},function(e,t,i){(function(e){const n="undefined"!=typeof window,s=i(30),r=i(31);if(n)t.WebSocket=window.WebSocket;else try{t.WebSocket=i(175)}catch(e){t.WebSocket=i(176)}try{var o=i(177);o.pack||(o=null)}catch(e){}t.encoding=o?"etf":"json",t.pack=o?o.pack:JSON.stringify,t.unpack=(t=>(Array.isArray(t)&&(t=e.concat(t)),t instanceof ArrayBuffer&&(t=e.from(new Uint8Array(t))),o&&"string"!=typeof t?o.unpack(t):(t instanceof e&&(t=s.inflateSync(t).toString()),JSON.parse(t)))),t.create=((e,i={},...s)=>{i.encoding=t.encoding;const o=new t.WebSocket(`${e}?${r.stringify(i)}`,...s);return n&&(o.binaryType="arraybuffer"),o});for(const e of["CONNECTING","OPEN","CLOSING","CLOSED"])t[e]=t.WebSocket[e]}).call(t,i(5).Buffer)},function(e,t,i){const n="undefined"!=typeof window,s=i(80);e.exports=s,n?window.Discord=s:n||console.warn("Warning: Attempting to use browser version of Discord.js in a non-browser environment!")},function(e,t,i){const n=i(7);e.exports={BaseClient:i(41),Client:i(122),Shard:i(213),ShardClientUtil:i(214),ShardingManager:i(215),WebhookClient:i(216),Collection:i(3),Constants:i(0),DataResolver:i(13),DiscordAPIError:i(61),EvaluatedPermissions:i(12),Permissions:i(12),Snowflake:i(9),SnowflakeUtil:i(9),Util:n,util:n,version:i(58).version,escapeMarkdown:n.escapeMarkdown,fetchRecommendedShards:n.fetchRecommendedShards,splitMessage:n.splitMessage,Activity:i(19).Activity,Channel:i(17),ClientUser:i(62),ClientUserSettings:i(76),Collector:i(42),DMChannel:i(65),Emoji:i(46),GroupDMChannel:i(69),Guild:i(35),GuildAuditLogs:i(73),GuildChannel:i(21),GuildMember:i(18),Invite:i(34),Message:i(44),MessageAttachment:i(28),MessageCollector:i(63),MessageEmbed:i(20),MessageMentions:i(66),MessageReaction:i(68),ClientApplication:i(45),PermissionOverwrites:i(71),Presence:i(19).Presence,ReactionEmoji:i(47),ReactionCollector:i(67),Role:i(27),TextChannel:i(70),User:i(32),VoiceChannel:i(72),Webhook:i(22),WebSocket:i(78)}},function(e,t,i){"use strict";function n(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===e[t-2]?2:"="===e[t-1]?1:0}function s(e){return o[e>>18&63]+o[e>>12&63]+o[e>>6&63]+o[63&e]}function r(e,t,i){for(var n,r=[],o=t;o0?l-4:l;var h=0;for(t=0;t>16&255,o[h++]=s>>8&255,o[h++]=255&s;return 2===r?(s=a[e.charCodeAt(t)]<<2|a[e.charCodeAt(t+1)]>>4,o[h++]=255&s):1===r&&(s=a[e.charCodeAt(t)]<<10|a[e.charCodeAt(t+1)]<<4|a[e.charCodeAt(t+2)]>>2,o[h++]=s>>8&255,o[h++]=255&s),o},t.fromByteArray=function(e){for(var t,i=e.length,n=i%3,s="",a=[],c=0,l=i-n;cl?l:c+16383));return 1===n?(t=e[i-1],s+=o[t>>2],s+=o[t<<4&63],s+="=="):2===n&&(t=(e[i-2]<<8)+e[i-1],s+=o[t>>10],s+=o[t>>4&63],s+=o[t<<2&63],s+="="),a.push(s),a.join("")};for(var o=[],a=[],c="undefined"!=typeof Uint8Array?Uint8Array:Array,l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",h=0,u=l.length;h>1,h=-7,u=i?s-1:0,p=i?-1:1,d=e[t+u];for(u+=p,r=d&(1<<-h)-1,d>>=-h,h+=a;h>0;r=256*r+e[t+u],u+=p,h-=8);for(o=r&(1<<-h)-1,r>>=-h,h+=n;h>0;o=256*o+e[t+u],u+=p,h-=8);if(0===r)r=1-l;else{if(r===c)return o?NaN:1/0*(d?-1:1);o+=Math.pow(2,n),r-=l}return(d?-1:1)*o*Math.pow(2,r-n)},t.write=function(e,t,i,n,s,r){var o,a,c,l=8*r-s-1,h=(1<>1,p=23===s?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:r-1,f=n?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,o=h):(o=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-o))<1&&(o--,c*=2),(t+=o+u>=1?p/c:p*Math.pow(2,1-u))*c>=2&&(o++,c/=2),o+u>=h?(a=0,o=h):o+u>=1?(a=(t*c-1)*Math.pow(2,s),o+=u):(a=t*Math.pow(2,u-1)*Math.pow(2,s),o=0));s>=8;e[i+d]=255&a,d+=f,a/=256,s-=8);for(o=o<0;e[i+d]=255&o,d+=f,o/=256,l-=8);e[i+d-f]|=128*m}},function(e,t,i){(function(t){function n(e){return c.format({protocol:e.connection.encrypted?"https:":"http:",hostname:e.getHeader("host"),pathname:e.path.split("?")[0],query:e.query})}i(37);const s=i(30),r=i(31),o=i(54),a=i(104),c=i(56),l=i(105),h=i(37),u=i(106),p=i(109);class Snekfetch extends h.Readable{constructor(e,t,i={headers:null,data:null,query:null}){super();const n=c.parse(t);n.method=e.toUpperCase(),i.headers&&(n.headers=i.headers),"agent"in i&&(n.agent=i.agent),this.request={https:a,http:o,file:p}[n.protocol.replace(":","")].request(n),this.request.followRedirects=i.followRedirects,i.query&&this.query(i.query),i.data&&this.send(i.data)}query(e,t){if(this.response)throw new Error("Cannot modify query after being sent!");return this.request.query||(this.request.query={}),null!==e&&"object"==typeof e?this.request.query=Object.assign(this.request.query,e):this.request.query[e]=t,this}set(e,t){if(this.response)throw new Error("Cannot modify headers after being sent!");if(null!==e&&"object"==typeof e)for(const t of Object.keys(e))this.set(t,e[t]);else this.request.setHeader(e,t);return this}attach(e,t,i){if(this.response)throw new Error("Cannot modify data after being sent!");const n=this._getFormData();return this.set("Content-Type",`multipart/form-data; boundary=${n.boundary}`),n.append(e,t,i),this.data=n,this}send(e){if(this.response)throw new Error("Cannot modify data after being sent!");if(e instanceof t||e instanceof h)this.data=e;else if(null!==e&&"object"==typeof e){const t=this._getRequestHeader("content-type");let i;t?t.includes("json")?i=JSON.stringify:t.includes("urlencoded")&&(i=r.stringify):(this.set("Content-Type","application/json"),i=JSON.stringify),this.data=i(e)}else this.data=e;return this}then(e,i){return new Promise((e,i)=>{const a=this.request,l=e=>{e||(e=new Error("Unknown error occured")),e.request=a,i(e)};a.once("abort",l),a.once("aborted",l),a.once("error",l),a.once("response",l=>{const u=new h.PassThrough;this._shouldUnzip(l)?l.pipe(s.createUnzip({flush:s.Z_SYNC_FLUSH,finishFlush:s.Z_SYNC_FLUSH})).pipe(u):l.pipe(u);const p=[];u.on("data",e=>{this.push(e)||this.pause(),p.push(e)}),u.once("end",()=>{this.push(null);const s=t.concat(p);if(!1!==this.request.followRedirects&&this._shouldRedirect(l)){let t=this.request.method;[301,302].includes(l.statusCode)?("HEAD"!==t&&(t="GET"),this.data=null):303===l.statusCode&&(t="GET");const i={};if(this.request._headerNames)for(const e of Object.keys(this.request._headerNames))"host"!==e.toLowerCase()&&(i[this.request._headerNames[e]]=this.request._headers[e]);else for(const e of Object.keys(this.request._headers)){if("host"===e.toLowerCase())continue;const t=this.request._headers[e];i[t.name]=t.value}const s=/^https?:\/\//i.test(l.headers.location)?l.headers.location:c.resolve(n(a),l.headers.location);return void e(new Snekfetch(t,s,{data:this.data,headers:i}))}const h={request:this.request,get body(){delete h.body;const e=l.headers["content-type"];if(e&&e.includes("application/json"))try{h.body=JSON.parse(h.text)}catch(e){h.body=h.text}else e&&e.includes("application/x-www-form-urlencoded")?h.body=r.parse(h.text):h.body=s;return h.body},text:s.toString(),ok:l.statusCode>=200&&l.statusCode<300,headers:l.headers,status:l.statusCode,statusText:l.statusText||o.STATUS_CODES[l.statusCode]};if(h.ok)e(h);else{const e=new Error(`${h.status} ${h.statusText}`.trim());Object.assign(e,h),i(e)}})});const u=this.data?this.data.end?this.data.end():this.data:null;if(this._addFinalHeaders(),this.request.query&&(this.request.path=`${this.request.path}?${r.stringify(this.request.query)}`),Array.isArray(u)){for(const e of u)a.write(e);a.end()}else u instanceof h?u.pipe(a):u instanceof t?(this.set("Content-Length",t.byteLength(u)),a.end(u)):a.end(u)}).then(e,i)}catch(e){return this.then(null,e)}end(e){return this.then(t=>e?e(null,t):t,t=>e?e(t,t.status?t:null):t)}_read(){this.resume(),this.response||this.catch(e=>this.emit("error",e))}_shouldUnzip(e){return 204!==e.statusCode&&304!==e.statusCode&&("0"!==e.headers["content-length"]&&/^\s*(?:deflate|gzip)\s*$/.test(e.headers["content-encoding"]))}_shouldRedirect(e){return[301,302,303,307,308].includes(e.statusCode)}_getFormData(){return this._formData||(this._formData=new u),this._formData}_addFinalHeaders(){this.request&&(this._getRequestHeader("user-agent")||this.set("User-Agent",`snekfetch/${Snekfetch.version} (${l.repository.url.replace(/\.?git/,"")})`),"HEAD"!==this.request.method&&this.set("Accept-Encoding","gzip, deflate"),this.data&&this.data.end&&this.set("Content-Length",this.data.length))}get response(){return this.request?this.request.res||this.request._response||null:null}_getRequestHeader(e){try{return this.request.getHeader(e)}catch(e){return null}}}Snekfetch.version=l.version,Snekfetch.METHODS=o.METHODS?o.METHODS.concat("BREW"):["GET","POST","PUT","DELETE","OPTIONS","HEAD"];for(const e of Snekfetch.METHODS)Snekfetch["M-SEARCH"===e?"msearch":e.toLowerCase()]=((t,i)=>new Snekfetch(e,t,i));e.exports=Snekfetch}).call(t,i(5).Buffer)},function(e,t){},function(e,t,i){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t,i){e.copy(t,i)}var r=i(38).Buffer;e.exports=function(){function e(){n(this,e),this.head=null,this.tail=null,this.length=0}return e.prototype.push=function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length},e.prototype.unshift=function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length},e.prototype.shift=function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}},e.prototype.clear=function(){this.head=this.tail=null,this.length=0},e.prototype.join=function(e){if(0===this.length)return"";for(var t=this.head,i=""+t.data;t=t.next;)i+=e+t.data;return i},e.prototype.concat=function(e){if(0===this.length)return r.alloc(0);if(1===this.length)return this.head.data;for(var t=r.allocUnsafe(e>>>0),i=this.head,n=0;i;)s(i.data,t,n),n+=i.data.length,i=i.next;return t},e}()},function(e,t,i){function n(e,t){this._id=e,this._clearFn=t}var s=Function.prototype.apply;t.setTimeout=function(){return new n(s.call(setTimeout,window,arguments),clearTimeout)},t.setInterval=function(){return new n(s.call(setInterval,window,arguments),clearInterval)},t.clearTimeout=t.clearInterval=function(e){e&&e.close()},n.prototype.unref=n.prototype.ref=function(){},n.prototype.close=function(){this._clearFn.call(window,this._id)},t.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},t.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},t._unrefActive=t.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;t>=0&&(e._idleTimeoutId=setTimeout(function(){e._onTimeout&&e._onTimeout()},t))},i(87),t.setImmediate=setImmediate,t.clearImmediate=clearImmediate},function(e,t,i){(function(e,t){!function(e,i){"use strict";function n(e){delete c[e]}function s(e){var t=e.callback,n=e.args;switch(n.length){case 0:t();break;case 1:t(n[0]);break;case 2:t(n[0],n[1]);break;case 3:t(n[0],n[1],n[2]);break;default:t.apply(i,n)}}function r(e){if(l)setTimeout(r,0,e);else{var t=c[e];if(t){l=!0;try{s(t)}finally{n(e),l=!1}}}}if(!e.setImmediate){var o,a=1,c={},l=!1,h=e.document,u=Object.getPrototypeOf&&Object.getPrototypeOf(e);u=u&&u.setTimeout?u:e,"[object process]"==={}.toString.call(e.process)?o=function(e){t.nextTick(function(){r(e)})}:function(){if(e.postMessage&&!e.importScripts){var t=!0,i=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=i,t}}()?function(){var t="setImmediate$"+Math.random()+"$",i=function(i){i.source===e&&"string"==typeof i.data&&0===i.data.indexOf(t)&&r(+i.data.slice(t.length))};e.addEventListener?e.addEventListener("message",i,!1):e.attachEvent("onmessage",i),o=function(i){e.postMessage(t+i,"*")}}():e.MessageChannel?function(){var e=new MessageChannel;e.port1.onmessage=function(e){r(e.data)},o=function(t){e.port2.postMessage(t)}}():h&&"onreadystatechange"in h.createElement("script")?function(){var e=h.documentElement;o=function(t){var i=h.createElement("script");i.onreadystatechange=function(){r(t),i.onreadystatechange=null,e.removeChild(i),i=null},e.appendChild(i)}}():o=function(e){setTimeout(r,0,e)},u.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),i=0;i0&&l>c&&(l=c);for(var h=0;h=0?(u=m.substr(0,g),p=m.substr(g+1)):(u=m,p=""),d=decodeURIComponent(u),f=decodeURIComponent(p),n(o,d)?s(o[d])?o[d].push(f):o[d]=[o[d],f]:o[d]=f}return o};var s=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},function(e,t,i){"use strict";function n(e,t){if(e.map)return e.map(t);for(var i=[],n=0;ne._pos){var r=i.substr(e._pos);if("x-user-defined"===e._charset){for(var o=new n(r.length),a=0;ae._pos&&(e.push(new n(new Uint8Array(l.result.slice(e._pos)))),e._pos=l.result.byteLength)},l.onload=function(){e.push(null)},l.readAsArrayBuffer(i)}e._xhr.readyState===c.DONE&&"ms-stream"!==e._mode&&e.push(null)}}).call(t,i(8),i(5).Buffer,i(6))},function(e,t,i){var n=i(5).Buffer;e.exports=function(e){if(e instanceof Uint8Array){if(0===e.byteOffset&&e.byteLength===e.buffer.byteLength)return e.buffer;if("function"==typeof e.buffer.slice)return e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}if(n.isBuffer(e)){for(var t=new Uint8Array(e.length),i=e.length,s=0;s1&&(n=i[0]+"@",e=i[1]),n+a((e=e.replace(D,".")).split("."),t).join(".")}function l(e){for(var t,i,n=[],s=0,r=e.length;s=55296&&t<=56319&&s65535&&(t+=M((e-=65536)>>>10&1023|55296),e=56320|1023&e),t+=M(e)}).join("")}function u(e){return e-48<10?e-22:e-65<26?e-65:e-97<26?e-97:_}function p(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function d(e,t,i){var n=0;for(e=i?N(e/x):e>>1,e+=N(e/t);e>k*b>>1;n+=_)e=N(e/k);return N(n+(k+1)*e/(e+w))}function f(e){var t,i,n,s,r,a,c,l,p,f,m=[],g=e.length,v=0,w=S,x=A;for((i=e.lastIndexOf(T))<0&&(i=0),n=0;n=128&&o("not-basic"),m.push(e.charCodeAt(n));for(s=i>0?i+1:0;s=g&&o("invalid-input"),((l=u(e.charCodeAt(s++)))>=_||l>N((E-v)/a))&&o("overflow"),v+=l*a,p=c<=x?y:c>=x+b?b:c-x,!(lN(E/(f=_-p))&&o("overflow"),a*=f;x=d(v-r,t=m.length+1,0==r),N(v/t)>E-w&&o("overflow"),w+=N(v/t),v%=t,m.splice(v++,0,w)}return h(m)}function m(e){var t,i,n,s,r,a,c,h,u,f,m,g,v,w,x,R=[];for(g=(e=l(e)).length,t=S,i=0,r=A,a=0;a=t&&mN((E-i)/(v=n+1))&&o("overflow"),i+=(c-t)*v,t=c,a=0;aE&&o("overflow"),m==t){for(h=i,u=_;f=u<=r?y:u>=r+b?b:u-r,!(h= 0x80 (not a basic code point)","invalid-input":"Invalid input"},k=_-y,N=Math.floor,M=String.fromCharCode;v={version:"1.4.1",ucs2:{decode:l,encode:h},decode:f,encode:m,toASCII:function(e){return c(e,function(e){return I.test(e)?"xn--"+m(e):e})},toUnicode:function(e){return c(e,function(e){return R.test(e)?f(e.slice(4).toLowerCase()):e})}},void 0!==(s=function(){return v}.call(t,i,t,e))&&(e.exports=s)}()}).call(t,i(102)(e),i(6))},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,i){"use strict";e.exports={isString:function(e){return"string"==typeof e},isObject:function(e){return"object"==typeof e&&null!==e},isNull:function(e){return null===e},isNullOrUndefined:function(e){return null==e}}},function(e,t,i){var n=i(54),s=e.exports;for(var r in n)n.hasOwnProperty(r)&&(s[r]=n[r]);s.request=function(e,t){return e||(e={}),e.scheme="https",e.protocol="https:",n.request.call(this,e,t)}},function(e,t){e.exports={_from:"snekfetch@^3.0.0",_id:"snekfetch@3.2.9",_inBundle:!1,_integrity:"sha512-0ZYxGRMtgBska6uQ616F0jcPYad/sLe+uBJJ2vewD62ftEFnh6rY5mza05KoUS5UWcclMuiUfAZSf10ZYnkOZA==",_location:"/snekfetch",_phantomChildren:{},_requested:{type:"range",registry:!0,raw:"snekfetch@^3.0.0",name:"snekfetch",escapedName:"snekfetch",rawSpec:"^3.0.0",saveSpec:null,fetchSpec:"^3.0.0"},_requiredBy:["/"],_resolved:"https://registry.npmjs.org/snekfetch/-/snekfetch-3.2.9.tgz",_shasum:"cdd28c7e88c889d86b9ff289a8e985a2f484f206",_spec:"snekfetch@^3.0.0",_where:"/home/travis/build/hydrabolt/discord.js",author:{name:"Gus Caplan",email:"me@gus.host"},bugs:{url:"https://github.com/devsnek/snekfetch/issues"},bundleDependencies:!1,dependencies:{},deprecated:!1,description:"Just do http requests without all that weird nastiness from other libs",devDependencies:{},homepage:"https://github.com/devsnek/snekfetch#readme",license:"MIT",main:"index.js",name:"snekfetch",repository:{type:"git",url:"git+https://github.com/devsnek/snekfetch.git"},version:"3.2.9"}},function(e,t,i){(function(t){const n=i(25),s=i(57);class FormData{constructor(){this.boundary=`--snekfetch--${Math.random().toString().slice(2,7)}`,this.buffers=[]}append(e,i,r){if(void 0===i)return;let o=`\r\n--${this.boundary}\r\nContent-Disposition: form-data; name="${e}"`,a=null;if(r){o+=`; filename="${r}"`,a="application/octet-stream";const e=n.extname(r).slice(1);e&&(a=s.lookup(e))}i instanceof t?a=s.buffer(i):"object"==typeof i?(a="application/json",i=t.from(JSON.stringify(i))):i=t.from(String(i)),a&&(o+=`\r\nContent-Type: ${a}`),this.buffers.push(`${o}\r\n\r\n`),this.buffers.push(i)}end(){return this.buffers.push(`\r\n--${this.boundary}--`),this.buffers}get length(){return this.buffers.reduce((e,i)=>e+t.byteLength(i),0)}}e.exports=FormData}).call(t,i(5).Buffer)},function(e,t){e.exports={123:"application/vnd.lotus-1-2-3",ez:"application/andrew-inset",aw:"application/applixware",atom:"application/atom+xml",atomcat:"application/atomcat+xml",atomsvc:"application/atomsvc+xml",bdoc:"application/x-bdoc",ccxml:"application/ccxml+xml",cdmia:"application/cdmi-capability",cdmic:"application/cdmi-container",cdmid:"application/cdmi-domain",cdmio:"application/cdmi-object",cdmiq:"application/cdmi-queue",cu:"application/cu-seeme",mpd:"application/dash+xml",davmount:"application/davmount+xml",dbk:"application/docbook+xml",dssc:"application/dssc+der",xdssc:"application/dssc+xml",ecma:"application/ecmascript",emma:"application/emma+xml",epub:"application/epub+zip",exi:"application/exi",pfr:"application/font-tdpfr",woff:"application/font-woff",woff2:"application/font-woff2",geojson:"application/geo+json",gml:"application/gml+xml",gpx:"application/gpx+xml",gxf:"application/gxf",stk:"application/hyperstudio",ink:"application/inkml+xml",inkml:"application/inkml+xml",ipfix:"application/ipfix",jar:"application/java-archive",war:"application/java-archive",ear:"application/java-archive",ser:"application/java-serialized-object",class:"application/java-vm",js:"application/javascript",json:"application/json",map:"application/json",json5:"application/json5",jsonml:"application/jsonml+json",jsonld:"application/ld+json",lostxml:"application/lost+xml",hqx:"application/mac-binhex40",cpt:"application/mac-compactpro",mads:"application/mads+xml",webmanifest:"application/manifest+json",mrc:"application/marc",mrcx:"application/marcxml+xml",ma:"application/mathematica",nb:"application/mathematica",mb:"application/mathematica",mathml:"application/mathml+xml",mbox:"application/mbox",mscml:"application/mediaservercontrol+xml",metalink:"application/metalink+xml",meta4:"application/metalink4+xml",mets:"application/mets+xml",mods:"application/mods+xml",m21:"application/mp21",mp21:"application/mp21",mp4s:"application/mp4",m4p:"application/mp4",doc:"application/msword",dot:"application/msword",mxf:"application/mxf",bin:"application/octet-stream",dms:"application/octet-stream",lrf:"application/octet-stream",mar:"application/octet-stream",so:"application/octet-stream",dist:"application/octet-stream",distz:"application/octet-stream",pkg:"application/octet-stream",bpk:"application/octet-stream",dump:"application/octet-stream",elc:"application/octet-stream",deploy:"application/octet-stream",exe:"application/x-msdownload",dll:"application/x-msdownload",deb:"application/x-debian-package",dmg:"application/x-apple-diskimage",iso:"application/x-iso9660-image",img:"application/octet-stream",msi:"application/x-msdownload",msp:"application/octet-stream",msm:"application/octet-stream",buffer:"application/octet-stream",oda:"application/oda",opf:"application/oebps-package+xml",ogx:"application/ogg",omdoc:"application/omdoc+xml",onetoc:"application/onenote",onetoc2:"application/onenote",onetmp:"application/onenote",onepkg:"application/onenote",oxps:"application/oxps",xer:"application/patch-ops-error+xml",pdf:"application/pdf",pgp:"application/pgp-encrypted",asc:"application/pgp-signature",sig:"application/pgp-signature",prf:"application/pics-rules",p10:"application/pkcs10",p7m:"application/pkcs7-mime",p7c:"application/pkcs7-mime",p7s:"application/pkcs7-signature",p8:"application/pkcs8",ac:"application/pkix-attr-cert",cer:"application/pkix-cert",crl:"application/pkix-crl",pkipath:"application/pkix-pkipath",pki:"application/pkixcmp",pls:"application/pls+xml",ai:"application/postscript",eps:"application/postscript",ps:"application/postscript",cww:"application/prs.cww",pskcxml:"application/pskc+xml",rdf:"application/rdf+xml",rif:"application/reginfo+xml",rnc:"application/relax-ng-compact-syntax",rl:"application/resource-lists+xml",rld:"application/resource-lists-diff+xml",rs:"application/rls-services+xml",gbr:"application/rpki-ghostbusters",mft:"application/rpki-manifest",roa:"application/rpki-roa",rsd:"application/rsd+xml",rss:"application/rss+xml",rtf:"text/rtf",sbml:"application/sbml+xml",scq:"application/scvp-cv-request",scs:"application/scvp-cv-response",spq:"application/scvp-vp-request",spp:"application/scvp-vp-response",sdp:"application/sdp",setpay:"application/set-payment-initiation",setreg:"application/set-registration-initiation",shf:"application/shf+xml",smi:"application/smil+xml",smil:"application/smil+xml",rq:"application/sparql-query",srx:"application/sparql-results+xml",gram:"application/srgs",grxml:"application/srgs+xml",sru:"application/sru+xml",ssdl:"application/ssdl+xml",ssml:"application/ssml+xml",tei:"application/tei+xml",teicorpus:"application/tei+xml",tfi:"application/thraud+xml",tsd:"application/timestamped-data",plb:"application/vnd.3gpp.pic-bw-large",psb:"application/vnd.3gpp.pic-bw-small",pvb:"application/vnd.3gpp.pic-bw-var",tcap:"application/vnd.3gpp2.tcap",pwn:"application/vnd.3m.post-it-notes",aso:"application/vnd.accpac.simply.aso",imp:"application/vnd.accpac.simply.imp",acu:"application/vnd.acucobol",atc:"application/vnd.acucorp",acutc:"application/vnd.acucorp",air:"application/vnd.adobe.air-application-installer-package+zip",fcdt:"application/vnd.adobe.formscentral.fcdt",fxp:"application/vnd.adobe.fxp",fxpl:"application/vnd.adobe.fxp",xdp:"application/vnd.adobe.xdp+xml",xfdf:"application/vnd.adobe.xfdf",ahead:"application/vnd.ahead.space",azf:"application/vnd.airzip.filesecure.azf",azs:"application/vnd.airzip.filesecure.azs",azw:"application/vnd.amazon.ebook",acc:"application/vnd.americandynamics.acc",ami:"application/vnd.amiga.ami",apk:"application/vnd.android.package-archive",cii:"application/vnd.anser-web-certificate-issue-initiation",fti:"application/vnd.anser-web-funds-transfer-initiation",atx:"application/vnd.antix.game-component",mpkg:"application/vnd.apple.installer+xml",m3u8:"application/vnd.apple.mpegurl",pkpass:"application/vnd.apple.pkpass",swi:"application/vnd.aristanetworks.swi",iota:"application/vnd.astraea-software.iota",aep:"application/vnd.audiograph",mpm:"application/vnd.blueice.multipass",bmi:"application/vnd.bmi",rep:"application/vnd.businessobjects",cdxml:"application/vnd.chemdraw+xml",mmd:"application/vnd.chipnuts.karaoke-mmd",cdy:"application/vnd.cinderella",cla:"application/vnd.claymore",rp9:"application/vnd.cloanto.rp9",c4g:"application/vnd.clonk.c4group",c4d:"application/vnd.clonk.c4group",c4f:"application/vnd.clonk.c4group",c4p:"application/vnd.clonk.c4group",c4u:"application/vnd.clonk.c4group",c11amc:"application/vnd.cluetrust.cartomobile-config",c11amz:"application/vnd.cluetrust.cartomobile-config-pkg",csp:"application/vnd.commonspace",cdbcmsg:"application/vnd.contact.cmsg",cmc:"application/vnd.cosmocaller",clkx:"application/vnd.crick.clicker",clkk:"application/vnd.crick.clicker.keyboard",clkp:"application/vnd.crick.clicker.palette",clkt:"application/vnd.crick.clicker.template",clkw:"application/vnd.crick.clicker.wordbank",wbs:"application/vnd.criticaltools.wbs+xml",pml:"application/vnd.ctc-posml",ppd:"application/vnd.cups-ppd",car:"application/vnd.curl.car",pcurl:"application/vnd.curl.pcurl",dart:"application/vnd.dart",rdz:"application/vnd.data-vision.rdz",uvf:"application/vnd.dece.data",uvvf:"application/vnd.dece.data",uvd:"application/vnd.dece.data",uvvd:"application/vnd.dece.data",uvt:"application/vnd.dece.ttml+xml",uvvt:"application/vnd.dece.ttml+xml",uvx:"application/vnd.dece.unspecified",uvvx:"application/vnd.dece.unspecified",uvz:"application/vnd.dece.zip",uvvz:"application/vnd.dece.zip",fe_launch:"application/vnd.denovo.fcselayout-link",dna:"application/vnd.dna",mlp:"application/vnd.dolby.mlp",dpg:"application/vnd.dpgraph",dfac:"application/vnd.dreamfactory",kpxx:"application/vnd.ds-keypoint",ait:"application/vnd.dvb.ait",svc:"application/vnd.dvb.service",geo:"application/vnd.dynageo",mag:"application/vnd.ecowin.chart",nml:"application/vnd.enliven",esf:"application/vnd.epson.esf",msf:"application/vnd.epson.msf",qam:"application/vnd.epson.quickanime",slt:"application/vnd.epson.salt",ssf:"application/vnd.epson.ssf",es3:"application/vnd.eszigno3+xml",et3:"application/vnd.eszigno3+xml",ez2:"application/vnd.ezpix-album",ez3:"application/vnd.ezpix-package",fdf:"application/vnd.fdf",mseed:"application/vnd.fdsn.mseed",seed:"application/vnd.fdsn.seed",dataless:"application/vnd.fdsn.seed",gph:"application/vnd.flographit",ftc:"application/vnd.fluxtime.clip",fm:"application/vnd.framemaker",frame:"application/vnd.framemaker",maker:"application/vnd.framemaker",book:"application/vnd.framemaker",fnc:"application/vnd.frogans.fnc",ltf:"application/vnd.frogans.ltf",fsc:"application/vnd.fsc.weblaunch",oas:"application/vnd.fujitsu.oasys",oa2:"application/vnd.fujitsu.oasys2",oa3:"application/vnd.fujitsu.oasys3",fg5:"application/vnd.fujitsu.oasysgp",bh2:"application/vnd.fujitsu.oasysprs",ddd:"application/vnd.fujixerox.ddd",xdw:"application/vnd.fujixerox.docuworks",xbd:"application/vnd.fujixerox.docuworks.binder",fzs:"application/vnd.fuzzysheet",txd:"application/vnd.genomatix.tuxedo",ggb:"application/vnd.geogebra.file",ggt:"application/vnd.geogebra.tool",gex:"application/vnd.geometry-explorer",gre:"application/vnd.geometry-explorer",gxt:"application/vnd.geonext",g2w:"application/vnd.geoplan",g3w:"application/vnd.geospace",gmx:"application/vnd.gmx",gdoc:"application/vnd.google-apps.document",gslides:"application/vnd.google-apps.presentation",gsheet:"application/vnd.google-apps.spreadsheet",kml:"application/vnd.google-earth.kml+xml",kmz:"application/vnd.google-earth.kmz",gqf:"application/vnd.grafeq",gqs:"application/vnd.grafeq",gac:"application/vnd.groove-account",ghf:"application/vnd.groove-help",gim:"application/vnd.groove-identity-message",grv:"application/vnd.groove-injector",gtm:"application/vnd.groove-tool-message",tpl:"application/vnd.groove-tool-template",vcg:"application/vnd.groove-vcard",hal:"application/vnd.hal+xml",zmm:"application/vnd.handheld-entertainment+xml",hbci:"application/vnd.hbci",les:"application/vnd.hhe.lesson-player",hpgl:"application/vnd.hp-hpgl",hpid:"application/vnd.hp-hpid",hps:"application/vnd.hp-hps",jlt:"application/vnd.hp-jlyt",pcl:"application/vnd.hp-pcl",pclxl:"application/vnd.hp-pclxl","sfd-hdstx":"application/vnd.hydrostatix.sof-data",mpy:"application/vnd.ibm.minipay",afp:"application/vnd.ibm.modcap",listafp:"application/vnd.ibm.modcap",list3820:"application/vnd.ibm.modcap",irm:"application/vnd.ibm.rights-management",sc:"application/vnd.ibm.secure-container",icc:"application/vnd.iccprofile",icm:"application/vnd.iccprofile",igl:"application/vnd.igloader",ivp:"application/vnd.immervision-ivp",ivu:"application/vnd.immervision-ivu",igm:"application/vnd.insors.igm",xpw:"application/vnd.intercon.formnet",xpx:"application/vnd.intercon.formnet",i2g:"application/vnd.intergeo",qbo:"application/vnd.intu.qbo",qfx:"application/vnd.intu.qfx",rcprofile:"application/vnd.ipunplugged.rcprofile",irp:"application/vnd.irepository.package+xml",xpr:"application/vnd.is-xpr",fcs:"application/vnd.isac.fcs",jam:"application/vnd.jam",rms:"application/vnd.jcp.javame.midlet-rms",jisp:"application/vnd.jisp",joda:"application/vnd.joost.joda-archive",ktz:"application/vnd.kahootz",ktr:"application/vnd.kahootz",karbon:"application/vnd.kde.karbon",chrt:"application/vnd.kde.kchart",kfo:"application/vnd.kde.kformula",flw:"application/vnd.kde.kivio",kon:"application/vnd.kde.kontour",kpr:"application/vnd.kde.kpresenter",kpt:"application/vnd.kde.kpresenter",ksp:"application/vnd.kde.kspread",kwd:"application/vnd.kde.kword",kwt:"application/vnd.kde.kword",htke:"application/vnd.kenameaapp",kia:"application/vnd.kidspiration",kne:"application/vnd.kinar",knp:"application/vnd.kinar",skp:"application/vnd.koan",skd:"application/vnd.koan",skt:"application/vnd.koan",skm:"application/vnd.koan",sse:"application/vnd.kodak-descriptor",lasxml:"application/vnd.las.las+xml",lbd:"application/vnd.llamagraphics.life-balance.desktop",lbe:"application/vnd.llamagraphics.life-balance.exchange+xml",apr:"application/vnd.lotus-approach",pre:"application/vnd.lotus-freelance",nsf:"application/vnd.lotus-notes",org:"application/vnd.lotus-organizer",scm:"application/vnd.lotus-screencam",lwp:"application/vnd.lotus-wordpro",portpkg:"application/vnd.macports.portpkg",mcd:"application/vnd.mcd",mc1:"application/vnd.medcalcdata",cdkey:"application/vnd.mediastation.cdkey",mwf:"application/vnd.mfer",mfm:"application/vnd.mfmp",flo:"application/vnd.micrografx.flo",igx:"application/vnd.micrografx.igx",mif:"application/vnd.mif",daf:"application/vnd.mobius.daf",dis:"application/vnd.mobius.dis",mbk:"application/vnd.mobius.mbk",mqy:"application/vnd.mobius.mqy",msl:"application/vnd.mobius.msl",plc:"application/vnd.mobius.plc",txf:"application/vnd.mobius.txf",mpn:"application/vnd.mophun.application",mpc:"application/vnd.mophun.certificate",xul:"application/vnd.mozilla.xul+xml",cil:"application/vnd.ms-artgalry",cab:"application/vnd.ms-cab-compressed",xls:"application/vnd.ms-excel",xlm:"application/vnd.ms-excel",xla:"application/vnd.ms-excel",xlc:"application/vnd.ms-excel",xlt:"application/vnd.ms-excel",xlw:"application/vnd.ms-excel",xlam:"application/vnd.ms-excel.addin.macroenabled.12",xlsb:"application/vnd.ms-excel.sheet.binary.macroenabled.12",xlsm:"application/vnd.ms-excel.sheet.macroenabled.12",xltm:"application/vnd.ms-excel.template.macroenabled.12",eot:"application/vnd.ms-fontobject",chm:"application/vnd.ms-htmlhelp",ims:"application/vnd.ms-ims",lrm:"application/vnd.ms-lrm",thmx:"application/vnd.ms-officetheme",cat:"application/vnd.ms-pki.seccat",stl:"application/vnd.ms-pki.stl",ppt:"application/vnd.ms-powerpoint",pps:"application/vnd.ms-powerpoint",pot:"application/vnd.ms-powerpoint",ppam:"application/vnd.ms-powerpoint.addin.macroenabled.12",pptm:"application/vnd.ms-powerpoint.presentation.macroenabled.12",sldm:"application/vnd.ms-powerpoint.slide.macroenabled.12",ppsm:"application/vnd.ms-powerpoint.slideshow.macroenabled.12",potm:"application/vnd.ms-powerpoint.template.macroenabled.12",mpp:"application/vnd.ms-project",mpt:"application/vnd.ms-project",docm:"application/vnd.ms-word.document.macroenabled.12",dotm:"application/vnd.ms-word.template.macroenabled.12",wps:"application/vnd.ms-works",wks:"application/vnd.ms-works",wcm:"application/vnd.ms-works",wdb:"application/vnd.ms-works",wpl:"application/vnd.ms-wpl",xps:"application/vnd.ms-xpsdocument",mseq:"application/vnd.mseq",mus:"application/vnd.musician",msty:"application/vnd.muvee.style",taglet:"application/vnd.mynfc",nlu:"application/vnd.neurolanguage.nlu",ntf:"application/vnd.nitf",nitf:"application/vnd.nitf",nnd:"application/vnd.noblenet-directory",nns:"application/vnd.noblenet-sealer",nnw:"application/vnd.noblenet-web",ngdat:"application/vnd.nokia.n-gage.data","n-gage":"application/vnd.nokia.n-gage.symbian.install",rpst:"application/vnd.nokia.radio-preset",rpss:"application/vnd.nokia.radio-presets",edm:"application/vnd.novadigm.edm",edx:"application/vnd.novadigm.edx",ext:"application/vnd.novadigm.ext",odc:"application/vnd.oasis.opendocument.chart",otc:"application/vnd.oasis.opendocument.chart-template",odb:"application/vnd.oasis.opendocument.database",odf:"application/vnd.oasis.opendocument.formula",odft:"application/vnd.oasis.opendocument.formula-template",odg:"application/vnd.oasis.opendocument.graphics",otg:"application/vnd.oasis.opendocument.graphics-template",odi:"application/vnd.oasis.opendocument.image",oti:"application/vnd.oasis.opendocument.image-template",odp:"application/vnd.oasis.opendocument.presentation",otp:"application/vnd.oasis.opendocument.presentation-template",ods:"application/vnd.oasis.opendocument.spreadsheet",ots:"application/vnd.oasis.opendocument.spreadsheet-template",odt:"application/vnd.oasis.opendocument.text",odm:"application/vnd.oasis.opendocument.text-master",ott:"application/vnd.oasis.opendocument.text-template",oth:"application/vnd.oasis.opendocument.text-web",xo:"application/vnd.olpc-sugar",dd2:"application/vnd.oma.dd2+xml",oxt:"application/vnd.openofficeorg.extension",pptx:"application/vnd.openxmlformats-officedocument.presentationml.presentation",sldx:"application/vnd.openxmlformats-officedocument.presentationml.slide",ppsx:"application/vnd.openxmlformats-officedocument.presentationml.slideshow",potx:"application/vnd.openxmlformats-officedocument.presentationml.template",xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",xltx:"application/vnd.openxmlformats-officedocument.spreadsheetml.template",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",dotx:"application/vnd.openxmlformats-officedocument.wordprocessingml.template",mgp:"application/vnd.osgeo.mapguide.package",dp:"application/vnd.osgi.dp",esa:"application/vnd.osgi.subsystem",pdb:"application/x-pilot",pqa:"application/vnd.palm",oprc:"application/vnd.palm",paw:"application/vnd.pawaafile",str:"application/vnd.pg.format",ei6:"application/vnd.pg.osasli",efif:"application/vnd.picsel",wg:"application/vnd.pmi.widget",plf:"application/vnd.pocketlearn",pbd:"application/vnd.powerbuilder6",box:"application/vnd.previewsystems.box",mgz:"application/vnd.proteus.magazine",qps:"application/vnd.publishare-delta-tree",ptid:"application/vnd.pvi.ptid1",qxd:"application/vnd.quark.quarkxpress",qxt:"application/vnd.quark.quarkxpress",qwd:"application/vnd.quark.quarkxpress",qwt:"application/vnd.quark.quarkxpress",qxl:"application/vnd.quark.quarkxpress",qxb:"application/vnd.quark.quarkxpress",bed:"application/vnd.realvnc.bed",mxl:"application/vnd.recordare.musicxml",musicxml:"application/vnd.recordare.musicxml+xml",cryptonote:"application/vnd.rig.cryptonote",cod:"application/vnd.rim.cod",rm:"application/vnd.rn-realmedia",rmvb:"application/vnd.rn-realmedia-vbr",link66:"application/vnd.route66.link66+xml",st:"application/vnd.sailingtracker.track",see:"application/vnd.seemail",sema:"application/vnd.sema",semd:"application/vnd.semd",semf:"application/vnd.semf",ifm:"application/vnd.shana.informed.formdata",itp:"application/vnd.shana.informed.formtemplate",iif:"application/vnd.shana.informed.interchange",ipk:"application/vnd.shana.informed.package",twd:"application/vnd.simtech-mindmapper",twds:"application/vnd.simtech-mindmapper",mmf:"application/vnd.smaf",teacher:"application/vnd.smart.teacher",sdkm:"application/vnd.solent.sdkm+xml",sdkd:"application/vnd.solent.sdkm+xml",dxp:"application/vnd.spotfire.dxp",sfs:"application/vnd.spotfire.sfs",sdc:"application/vnd.stardivision.calc",sda:"application/vnd.stardivision.draw",sdd:"application/vnd.stardivision.impress",smf:"application/vnd.stardivision.math",sdw:"application/vnd.stardivision.writer",vor:"application/vnd.stardivision.writer",sgl:"application/vnd.stardivision.writer-global",smzip:"application/vnd.stepmania.package",sm:"application/vnd.stepmania.stepchart",sxc:"application/vnd.sun.xml.calc",stc:"application/vnd.sun.xml.calc.template",sxd:"application/vnd.sun.xml.draw",std:"application/vnd.sun.xml.draw.template",sxi:"application/vnd.sun.xml.impress",sti:"application/vnd.sun.xml.impress.template",sxm:"application/vnd.sun.xml.math",sxw:"application/vnd.sun.xml.writer",sxg:"application/vnd.sun.xml.writer.global",stw:"application/vnd.sun.xml.writer.template",sus:"application/vnd.sus-calendar",susp:"application/vnd.sus-calendar",svd:"application/vnd.svd",sis:"application/vnd.symbian.install",sisx:"application/vnd.symbian.install",xsm:"application/vnd.syncml+xml",bdm:"application/vnd.syncml.dm+wbxml",xdm:"application/vnd.syncml.dm+xml",tao:"application/vnd.tao.intent-module-archive",pcap:"application/vnd.tcpdump.pcap",cap:"application/vnd.tcpdump.pcap",dmp:"application/vnd.tcpdump.pcap",tmo:"application/vnd.tmobile-livetv",tpt:"application/vnd.trid.tpt",mxs:"application/vnd.triscape.mxs",tra:"application/vnd.trueapp",ufd:"application/vnd.ufdl",ufdl:"application/vnd.ufdl",utz:"application/vnd.uiq.theme",umj:"application/vnd.umajin",unityweb:"application/vnd.unity",uoml:"application/vnd.uoml+xml",vcx:"application/vnd.vcx",vsd:"application/vnd.visio",vst:"application/vnd.visio",vss:"application/vnd.visio",vsw:"application/vnd.visio",vis:"application/vnd.visionary",vsf:"application/vnd.vsf",wbxml:"application/vnd.wap.wbxml",wmlc:"application/vnd.wap.wmlc",wmlsc:"application/vnd.wap.wmlscriptc",wtb:"application/vnd.webturbo",nbp:"application/vnd.wolfram.player",wpd:"application/vnd.wordperfect",wqd:"application/vnd.wqd",stf:"application/vnd.wt.stf",xar:"application/vnd.xara",xfdl:"application/vnd.xfdl",hvd:"application/vnd.yamaha.hv-dic",hvs:"application/vnd.yamaha.hv-script",hvp:"application/vnd.yamaha.hv-voice",osf:"application/vnd.yamaha.openscoreformat",osfpvg:"application/vnd.yamaha.openscoreformat.osfpvg+xml",saf:"application/vnd.yamaha.smaf-audio",spf:"application/vnd.yamaha.smaf-phrase",cmp:"application/vnd.yellowriver-custom-menu",zir:"application/vnd.zul",zirz:"application/vnd.zul",zaz:"application/vnd.zzazz.deck+xml",vxml:"application/voicexml+xml",wgt:"application/widget",hlp:"application/winhlp",wsdl:"application/wsdl+xml",wspolicy:"application/wspolicy+xml","7z":"application/x-7z-compressed",abw:"application/x-abiword",ace:"application/x-ace-compressed",aab:"application/x-authorware-bin",x32:"application/x-authorware-bin",u32:"application/x-authorware-bin",vox:"application/x-authorware-bin",aam:"application/x-authorware-map",aas:"application/x-authorware-seg",bcpio:"application/x-bcpio",torrent:"application/x-bittorrent",blb:"application/x-blorb",blorb:"application/x-blorb",bz:"application/x-bzip",bz2:"application/x-bzip2",boz:"application/x-bzip2",cbr:"application/x-cbr",cba:"application/x-cbr",cbt:"application/x-cbr",cbz:"application/x-cbr",cb7:"application/x-cbr",vcd:"application/x-cdlink",cfs:"application/x-cfs-compressed",chat:"application/x-chat",pgn:"application/x-chess-pgn",crx:"application/x-chrome-extension",cco:"application/x-cocoa",nsc:"application/x-conference",cpio:"application/x-cpio",csh:"application/x-csh",udeb:"application/x-debian-package",dgc:"application/x-dgc-compressed",dir:"application/x-director",dcr:"application/x-director",dxr:"application/x-director",cst:"application/x-director",cct:"application/x-director",cxt:"application/x-director",w3d:"application/x-director",fgd:"application/x-director",swa:"application/x-director",wad:"application/x-doom",ncx:"application/x-dtbncx+xml",dtb:"application/x-dtbook+xml",res:"application/x-dtbresource+xml",dvi:"application/x-dvi",evy:"application/x-envoy",eva:"application/x-eva",bdf:"application/x-font-bdf",gsf:"application/x-font-ghostscript",psf:"application/x-font-linux-psf",otf:"font/opentype",pcf:"application/x-font-pcf",snf:"application/x-font-snf",ttf:"application/x-font-ttf",ttc:"application/x-font-ttf",pfa:"application/x-font-type1",pfb:"application/x-font-type1",pfm:"application/x-font-type1",afm:"application/x-font-type1",arc:"application/x-freearc",spl:"application/x-futuresplash",gca:"application/x-gca-compressed",ulx:"application/x-glulx",gnumeric:"application/x-gnumeric",gramps:"application/x-gramps-xml",gtar:"application/x-gtar",hdf:"application/x-hdf",php:"application/x-httpd-php",install:"application/x-install-instructions",jardiff:"application/x-java-archive-diff",jnlp:"application/x-java-jnlp-file",latex:"application/x-latex",luac:"application/x-lua-bytecode",lzh:"application/x-lzh-compressed",lha:"application/x-lzh-compressed",run:"application/x-makeself",mie:"application/x-mie",prc:"application/x-pilot",mobi:"application/x-mobipocket-ebook",application:"application/x-ms-application",lnk:"application/x-ms-shortcut",wmd:"application/x-ms-wmd",wmz:"application/x-msmetafile",xbap:"application/x-ms-xbap",mdb:"application/x-msaccess",obd:"application/x-msbinder",crd:"application/x-mscardfile",clp:"application/x-msclip",com:"application/x-msdownload",bat:"application/x-msdownload",mvb:"application/x-msmediaview",m13:"application/x-msmediaview",m14:"application/x-msmediaview",wmf:"application/x-msmetafile",emf:"application/x-msmetafile",emz:"application/x-msmetafile",mny:"application/x-msmoney",pub:"application/x-mspublisher",scd:"application/x-msschedule",trm:"application/x-msterminal",wri:"application/x-mswrite",nc:"application/x-netcdf",cdf:"application/x-netcdf",pac:"application/x-ns-proxy-autoconfig",nzb:"application/x-nzb",pl:"application/x-perl",pm:"application/x-perl",p12:"application/x-pkcs12",pfx:"application/x-pkcs12",p7b:"application/x-pkcs7-certificates",spc:"application/x-pkcs7-certificates",p7r:"application/x-pkcs7-certreqresp",rar:"application/x-rar-compressed",rpm:"application/x-redhat-package-manager",ris:"application/x-research-info-systems",sea:"application/x-sea",sh:"application/x-sh",shar:"application/x-shar",swf:"application/x-shockwave-flash",xap:"application/x-silverlight-app",sql:"application/x-sql",sit:"application/x-stuffit",sitx:"application/x-stuffitx",srt:"application/x-subrip",sv4cpio:"application/x-sv4cpio",sv4crc:"application/x-sv4crc",t3:"application/x-t3vm-image",gam:"application/x-tads",tar:"application/x-tar",tcl:"application/x-tcl",tk:"application/x-tcl",tex:"application/x-tex",tfm:"application/x-tex-tfm",texinfo:"application/x-texinfo",texi:"application/x-texinfo",obj:"application/x-tgif",ustar:"application/x-ustar",src:"application/x-wais-source",webapp:"application/x-web-app-manifest+json",der:"application/x-x509-ca-cert",crt:"application/x-x509-ca-cert",pem:"application/x-x509-ca-cert",fig:"application/x-xfig",xlf:"application/x-xliff+xml",xpi:"application/x-xpinstall",xz:"application/x-xz",z1:"application/x-zmachine",z2:"application/x-zmachine",z3:"application/x-zmachine",z4:"application/x-zmachine",z5:"application/x-zmachine",z6:"application/x-zmachine",z7:"application/x-zmachine",z8:"application/x-zmachine",xaml:"application/xaml+xml",xdf:"application/xcap-diff+xml",xenc:"application/xenc+xml",xhtml:"application/xhtml+xml",xht:"application/xhtml+xml",xml:"text/xml",xsl:"application/xml",xsd:"application/xml",rng:"application/xml",dtd:"application/xml-dtd",xop:"application/xop+xml",xpl:"application/xproc+xml",xslt:"application/xslt+xml",xspf:"application/xspf+xml",mxml:"application/xv+xml",xhvml:"application/xv+xml",xvml:"application/xv+xml",xvm:"application/xv+xml",yang:"application/yang",yin:"application/yin+xml",zip:"application/zip","3gpp":"video/3gpp",adp:"audio/adpcm",au:"audio/basic",snd:"audio/basic",mid:"audio/midi",midi:"audio/midi",kar:"audio/midi",rmi:"audio/midi",mp3:"audio/mpeg",m4a:"audio/x-m4a",mp4a:"audio/mp4",mpga:"audio/mpeg",mp2:"audio/mpeg",mp2a:"audio/mpeg",m2a:"audio/mpeg",m3a:"audio/mpeg",oga:"audio/ogg",ogg:"audio/ogg",spx:"audio/ogg",s3m:"audio/s3m",sil:"audio/silk",uva:"audio/vnd.dece.audio",uvva:"audio/vnd.dece.audio",eol:"audio/vnd.digital-winds",dra:"audio/vnd.dra",dts:"audio/vnd.dts",dtshd:"audio/vnd.dts.hd",lvp:"audio/vnd.lucent.voice",pya:"audio/vnd.ms-playready.media.pya",ecelp4800:"audio/vnd.nuera.ecelp4800",ecelp7470:"audio/vnd.nuera.ecelp7470",ecelp9600:"audio/vnd.nuera.ecelp9600",rip:"audio/vnd.rip",wav:"audio/x-wav",weba:"audio/webm",aac:"audio/x-aac",aif:"audio/x-aiff",aiff:"audio/x-aiff",aifc:"audio/x-aiff",caf:"audio/x-caf",flac:"audio/x-flac",mka:"audio/x-matroska",m3u:"audio/x-mpegurl",wax:"audio/x-ms-wax",wma:"audio/x-ms-wma",ram:"audio/x-pn-realaudio",ra:"audio/x-realaudio",rmp:"audio/x-pn-realaudio-plugin",xm:"audio/xm",cdx:"chemical/x-cdx",cif:"chemical/x-cif",cmdf:"chemical/x-cmdf",cml:"chemical/x-cml",csml:"chemical/x-csml",xyz:"chemical/x-xyz",bmp:"image/x-ms-bmp",cgm:"image/cgm",g3:"image/g3fax",gif:"image/gif",ief:"image/ief",jpeg:"image/jpeg",jpg:"image/jpeg",jpe:"image/jpeg",ktx:"image/ktx",png:"image/png",btif:"image/prs.btif",sgi:"image/sgi",svg:"image/svg+xml",svgz:"image/svg+xml",tiff:"image/tiff",tif:"image/tiff",psd:"image/vnd.adobe.photoshop",uvi:"image/vnd.dece.graphic",uvvi:"image/vnd.dece.graphic",uvg:"image/vnd.dece.graphic",uvvg:"image/vnd.dece.graphic",djvu:"image/vnd.djvu",djv:"image/vnd.djvu",sub:"text/vnd.dvb.subtitle",dwg:"image/vnd.dwg",dxf:"image/vnd.dxf",fbs:"image/vnd.fastbidsheet",fpx:"image/vnd.fpx",fst:"image/vnd.fst",mmr:"image/vnd.fujixerox.edmics-mmr",rlc:"image/vnd.fujixerox.edmics-rlc",mdi:"image/vnd.ms-modi",wdp:"image/vnd.ms-photo",npx:"image/vnd.net-fpx",wbmp:"image/vnd.wap.wbmp",xif:"image/vnd.xiff",webp:"image/webp","3ds":"image/x-3ds",ras:"image/x-cmu-raster",cmx:"image/x-cmx",fh:"image/x-freehand",fhc:"image/x-freehand",fh4:"image/x-freehand",fh5:"image/x-freehand",fh7:"image/x-freehand",ico:"image/x-icon",jng:"image/x-jng",sid:"image/x-mrsid-image",pcx:"image/x-pcx",pic:"image/x-pict",pct:"image/x-pict",pnm:"image/x-portable-anymap",pbm:"image/x-portable-bitmap",pgm:"image/x-portable-graymap",ppm:"image/x-portable-pixmap",rgb:"image/x-rgb",tga:"image/x-tga",xbm:"image/x-xbitmap",xpm:"image/x-xpixmap",xwd:"image/x-xwindowdump",eml:"message/rfc822",mime:"message/rfc822",igs:"model/iges",iges:"model/iges",msh:"model/mesh",mesh:"model/mesh",silo:"model/mesh",dae:"model/vnd.collada+xml",dwf:"model/vnd.dwf",gdl:"model/vnd.gdl",gtw:"model/vnd.gtw",mts:"model/vnd.mts",vtu:"model/vnd.vtu",wrl:"model/vrml",vrml:"model/vrml",x3db:"model/x3d+binary",x3dbz:"model/x3d+binary",x3dv:"model/x3d+vrml",x3dvz:"model/x3d+vrml",x3d:"model/x3d+xml",x3dz:"model/x3d+xml",appcache:"text/cache-manifest",manifest:"text/cache-manifest",ics:"text/calendar",ifb:"text/calendar",coffee:"text/coffeescript",litcoffee:"text/coffeescript",css:"text/css",csv:"text/csv",hjson:"text/hjson",html:"text/html",htm:"text/html",shtml:"text/html",jade:"text/jade",jsx:"text/jsx",less:"text/less",mml:"text/mathml",n3:"text/n3",txt:"text/plain",text:"text/plain",conf:"text/plain",def:"text/plain",list:"text/plain",log:"text/plain",in:"text/plain",ini:"text/plain",dsc:"text/prs.lines.tag",rtx:"text/richtext",sgml:"text/sgml",sgm:"text/sgml",slim:"text/slim",slm:"text/slim",stylus:"text/stylus",styl:"text/stylus",tsv:"text/tab-separated-values",t:"text/troff",tr:"text/troff",roff:"text/troff",man:"text/troff",me:"text/troff",ms:"text/troff",ttl:"text/turtle",uri:"text/uri-list",uris:"text/uri-list",urls:"text/uri-list",vcard:"text/vcard",curl:"text/vnd.curl",dcurl:"text/vnd.curl.dcurl",mcurl:"text/vnd.curl.mcurl",scurl:"text/vnd.curl.scurl",fly:"text/vnd.fly",flx:"text/vnd.fmi.flexstor",gv:"text/vnd.graphviz","3dml":"text/vnd.in3d.3dml",spot:"text/vnd.in3d.spot",jad:"text/vnd.sun.j2me.app-descriptor",wml:"text/vnd.wap.wml",wmls:"text/vnd.wap.wmlscript",vtt:"text/vtt",s:"text/x-asm",asm:"text/x-asm",c:"text/x-c",cc:"text/x-c",cxx:"text/x-c",cpp:"text/x-c",h:"text/x-c",hh:"text/x-c",dic:"text/x-c",htc:"text/x-component",f:"text/x-fortran",for:"text/x-fortran",f77:"text/x-fortran",f90:"text/x-fortran",hbs:"text/x-handlebars-template",java:"text/x-java-source",lua:"text/x-lua",markdown:"text/x-markdown",md:"text/x-markdown",mkd:"text/x-markdown",nfo:"text/x-nfo",opml:"text/x-opml",p:"text/x-pascal",pas:"text/x-pascal",pde:"text/x-processing",sass:"text/x-sass",scss:"text/x-scss",etx:"text/x-setext",sfv:"text/x-sfv",ymp:"text/x-suse-ymp",uu:"text/x-uuencode",vcs:"text/x-vcalendar",vcf:"text/x-vcard",yaml:"text/yaml",yml:"text/yaml","3gp":"video/3gpp","3g2":"video/3gpp2",h261:"video/h261",h263:"video/h263",h264:"video/h264",jpgv:"video/jpeg",jpm:"video/jpm",jpgm:"video/jpm",mj2:"video/mj2",mjp2:"video/mj2",ts:"video/mp2t",mp4:"video/mp4",mp4v:"video/mp4",mpg4:"video/mp4",mpeg:"video/mpeg",mpg:"video/mpeg",mpe:"video/mpeg",m1v:"video/mpeg",m2v:"video/mpeg",ogv:"video/ogg",qt:"video/quicktime",mov:"video/quicktime",uvh:"video/vnd.dece.hd",uvvh:"video/vnd.dece.hd",uvm:"video/vnd.dece.mobile",uvvm:"video/vnd.dece.mobile",uvp:"video/vnd.dece.pd",uvvp:"video/vnd.dece.pd",uvs:"video/vnd.dece.sd",uvvs:"video/vnd.dece.sd",uvv:"video/vnd.dece.video",uvvv:"video/vnd.dece.video",dvb:"video/vnd.dvb.file",fvt:"video/vnd.fvt",mxu:"video/vnd.mpegurl",m4u:"video/vnd.mpegurl",pyv:"video/vnd.ms-playready.media.pyv",uvu:"video/vnd.uvvu.mp4",uvvu:"video/vnd.uvvu.mp4",viv:"video/vnd.vivo",webm:"video/webm",f4v:"video/x-f4v",fli:"video/x-fli",flv:"video/x-flv",m4v:"video/x-m4v",mkv:"video/x-matroska",mk3d:"video/x-matroska",mks:"video/x-matroska",mng:"video/x-mng",asf:"video/x-ms-asf",asx:"video/x-ms-asf",vob:"video/x-ms-vob",wm:"video/x-ms-wm",wmv:"video/x-ms-wmv",wmx:"video/x-ms-wmx",wvx:"video/x-ms-wvx",avi:"video/x-msvideo",movie:"video/x-sgi-movie",smv:"video/x-smv",ice:"x-conference/x-cooltalk"}},function(e,t){e.exports=function(e){const t=new Uint8Array(e);if(!(t&&t.length>1))return null;if(255===t[0]&&216===t[1]&&255===t[2])return{ext:"jpg",mime:"image/jpeg"};if(137===t[0]&&80===t[1]&&78===t[2]&&71===t[3])return{ext:"png",mime:"image/png"};if(71===t[0]&&73===t[1]&&70===t[2])return{ext:"gif",mime:"image/gif"};if(87===t[8]&&69===t[9]&&66===t[10]&&80===t[11])return{ext:"webp",mime:"image/webp"};if(70===t[0]&&76===t[1]&&73===t[2]&&70===t[3])return{ext:"flif",mime:"image/flif"};if((73===t[0]&&73===t[1]&&42===t[2]&&0===t[3]||77===t[0]&&77===t[1]&&0===t[2]&&42===t[3])&&67===t[8]&&82===t[9])return{ext:"cr2",mime:"image/x-canon-cr2"};if(73===t[0]&&73===t[1]&&42===t[2]&&0===t[3]||77===t[0]&&77===t[1]&&0===t[2]&&42===t[3])return{ext:"tif",mime:"image/tiff"};if(66===t[0]&&77===t[1])return{ext:"bmp",mime:"image/bmp"};if(73===t[0]&&73===t[1]&&188===t[2])return{ext:"jxr",mime:"image/vnd.ms-photo"};if(56===t[0]&&66===t[1]&&80===t[2]&&83===t[3])return{ext:"psd",mime:"image/vnd.adobe.photoshop"};if(80===t[0]&&75===t[1]&&3===t[2]&&4===t[3]&&109===t[30]&&105===t[31]&&109===t[32]&&101===t[33]&&116===t[34]&&121===t[35]&&112===t[36]&&101===t[37]&&97===t[38]&&112===t[39]&&112===t[40]&&108===t[41]&&105===t[42]&&99===t[43]&&97===t[44]&&116===t[45]&&105===t[46]&&111===t[47]&&110===t[48]&&47===t[49]&&101===t[50]&&112===t[51]&&117===t[52]&&98===t[53]&&43===t[54]&&122===t[55]&&105===t[56]&&112===t[57])return{ext:"epub",mime:"application/epub+zip"};if(80===t[0]&&75===t[1]&&3===t[2]&&4===t[3]&&77===t[30]&&69===t[31]&&84===t[32]&&65===t[33]&&45===t[34]&&73===t[35]&&78===t[36]&&70===t[37]&&47===t[38]&&109===t[39]&&111===t[40]&&122===t[41]&&105===t[42]&&108===t[43]&&108===t[44]&&97===t[45]&&46===t[46]&&114===t[47]&&115===t[48]&&97===t[49])return{ext:"xpi",mime:"application/x-xpinstall"};if(!(80!==t[0]||75!==t[1]||3!==t[2]&&5!==t[2]&&7!==t[2]||4!==t[3]&&6!==t[3]&&8!==t[3]))return{ext:"zip",mime:"application/zip"};if(117===t[257]&&115===t[258]&&116===t[259]&&97===t[260]&&114===t[261])return{ext:"tar",mime:"application/x-tar"};if(82===t[0]&&97===t[1]&&114===t[2]&&33===t[3]&&26===t[4]&&7===t[5]&&(0===t[6]||1===t[6]))return{ext:"rar",mime:"application/x-rar-compressed"};if(31===t[0]&&139===t[1]&&8===t[2])return{ext:"gz",mime:"application/gzip"};if(66===t[0]&&90===t[1]&&104===t[2])return{ext:"bz2",mime:"application/x-bzip2"};if(55===t[0]&&122===t[1]&&188===t[2]&&175===t[3]&&39===t[4]&&28===t[5])return{ext:"7z",mime:"application/x-7z-compressed"};if(120===t[0]&&1===t[1])return{ext:"dmg",mime:"application/x-apple-diskimage"};if(0===t[0]&&0===t[1]&&0===t[2]&&(24===t[3]||32===t[3])&&102===t[4]&&116===t[5]&&121===t[6]&&112===t[7]||51===t[0]&&103===t[1]&&112===t[2]&&53===t[3]||0===t[0]&&0===t[1]&&0===t[2]&&28===t[3]&&102===t[4]&&116===t[5]&&121===t[6]&&112===t[7]&&109===t[8]&&112===t[9]&&52===t[10]&&50===t[11]&&109===t[16]&&112===t[17]&&52===t[18]&&49===t[19]&&109===t[20]&&112===t[21]&&52===t[22]&&50===t[23]&&105===t[24]&&115===t[25]&&111===t[26]&&109===t[27]||0===t[0]&&0===t[1]&&0===t[2]&&28===t[3]&&102===t[4]&&116===t[5]&&121===t[6]&&112===t[7]&&105===t[8]&&115===t[9]&&111===t[10]&&109===t[11]||0===t[0]&&0===t[1]&&0===t[2]&&28===t[3]&&102===t[4]&&116===t[5]&&121===t[6]&&112===t[7]&&109===t[8]&&112===t[9]&&52===t[10]&&50===t[11]&&0===t[12]&&0===t[13]&&0===t[14]&&0===t[15])return{ext:"mp4",mime:"video/mp4"};if(0===t[0]&&0===t[1]&&0===t[2]&&28===t[3]&&102===t[4]&&116===t[5]&&121===t[6]&&112===t[7]&&77===t[8]&&52===t[9]&&86===t[10])return{ext:"m4v",mime:"video/x-m4v"};if(77===t[0]&&84===t[1]&&104===t[2]&&100===t[3])return{ext:"mid",mime:"audio/midi"};if(26===t[0]&&69===t[1]&&223===t[2]&&163===t[3]){const e=t.subarray(4,4100),i=e.findIndex((e,t,i)=>66===i[t]&&130===i[t+1]);if(i>=0){const t=i+3,n=i=>Array.from(i).every((i,n)=>e[t+n]===i.charCodeAt(0));if(n("matroska"))return{ext:"mkv",mime:"video/x-matroska"};if(n("webm"))return{ext:"webm",mime:"video/webm"}}}return 0===t[0]&&0===t[1]&&0===t[2]&&20===t[3]&&102===t[4]&&116===t[5]&&121===t[6]&&112===t[7]?{ext:"mov",mime:"video/quicktime"}:82===t[0]&&73===t[1]&&70===t[2]&&70===t[3]&&65===t[8]&&86===t[9]&&73===t[10]?{ext:"avi",mime:"video/x-msvideo"}:48===t[0]&&38===t[1]&&178===t[2]&&117===t[3]&&142===t[4]&&102===t[5]&&207===t[6]&&17===t[7]&&166===t[8]&&217===t[9]?{ext:"wmv",mime:"video/x-ms-wmv"}:0===t[0]&&0===t[1]&&1===t[2]&&"b"===t[3].toString(16)[0]?{ext:"mpg",mime:"video/mpeg"}:73===t[0]&&68===t[1]&&51===t[2]||255===t[0]&&251===t[1]?{ext:"mp3",mime:"audio/mpeg"}:102===t[4]&&116===t[5]&&121===t[6]&&112===t[7]&&77===t[8]&&52===t[9]&&65===t[10]||77===t[0]&&52===t[1]&&65===t[2]&&32===t[3]?{ext:"m4a",mime:"audio/m4a"}:79===t[28]&&112===t[29]&&117===t[30]&&115===t[31]&&72===t[32]&&101===t[33]&&97===t[34]&&100===t[35]?{ext:"opus",mime:"audio/opus"}:79===t[0]&&103===t[1]&&103===t[2]&&83===t[3]?{ext:"ogg",mime:"audio/ogg"}:102===t[0]&&76===t[1]&&97===t[2]&&67===t[3]?{ext:"flac",mime:"audio/x-flac"}:82===t[0]&&73===t[1]&&70===t[2]&&70===t[3]&&87===t[8]&&65===t[9]&&86===t[10]&&69===t[11]?{ext:"wav",mime:"audio/x-wav"}:35===t[0]&&33===t[1]&&65===t[2]&&77===t[3]&&82===t[4]&&10===t[5]?{ext:"amr",mime:"audio/amr"}:37===t[0]&&80===t[1]&&68===t[2]&&70===t[3]?{ext:"pdf",mime:"application/pdf"}:77===t[0]&&90===t[1]?{ext:"exe",mime:"application/x-msdownload"}:67!==t[0]&&70!==t[0]||87!==t[1]||83!==t[2]?123===t[0]&&92===t[1]&&114===t[2]&&116===t[3]&&102===t[4]?{ext:"rtf",mime:"application/rtf"}:119===t[0]&&79===t[1]&&70===t[2]&&70===t[3]&&(0===t[4]&&1===t[5]&&0===t[6]&&0===t[7]||79===t[4]&&84===t[5]&&84===t[6]&&79===t[7])?{ext:"woff",mime:"application/font-woff"}:119===t[0]&&79===t[1]&&70===t[2]&&50===t[3]&&(0===t[4]&&1===t[5]&&0===t[6]&&0===t[7]||79===t[4]&&84===t[5]&&84===t[6]&&79===t[7])?{ext:"woff2",mime:"application/font-woff"}:76===t[34]&&80===t[35]&&(0===t[8]&&0===t[9]&&1===t[10]||1===t[8]&&0===t[9]&&2===t[10]||2===t[8]&&0===t[9]&&2===t[10])?{ext:"eot",mime:"application/octet-stream"}:0===t[0]&&1===t[1]&&0===t[2]&&0===t[3]&&0===t[4]?{ext:"ttf",mime:"application/font-sfnt"}:79===t[0]&&84===t[1]&&84===t[2]&&79===t[3]&&0===t[4]?{ext:"otf",mime:"application/font-sfnt"}:0===t[0]&&0===t[1]&&1===t[2]&&0===t[3]?{ext:"ico",mime:"image/x-icon"}:70===t[0]&&76===t[1]&&86===t[2]&&1===t[3]?{ext:"flv",mime:"video/x-flv"}:37===t[0]&&33===t[1]?{ext:"ps",mime:"application/postscript"}:253===t[0]&&55===t[1]&&122===t[2]&&88===t[3]&&90===t[4]&&0===t[5]?{ext:"xz",mime:"application/x-xz"}:83===t[0]&&81===t[1]&&76===t[2]&&105===t[3]?{ext:"sqlite",mime:"application/x-sqlite3"}:78===t[0]&&69===t[1]&&83===t[2]&&26===t[3]?{ext:"nes",mime:"application/x-nintendo-nes-rom"}:67===t[0]&&114===t[1]&&50===t[2]&&52===t[3]?{ext:"crx",mime:"application/x-google-chrome-extension"}:77===t[0]&&83===t[1]&&67===t[2]&&70===t[3]||73===t[0]&&83===t[1]&&99===t[2]&&40===t[3]?{ext:"cab",mime:"application/vnd.ms-cab-compressed"}:33===t[0]&&60===t[1]&&97===t[2]&&114===t[3]&&99===t[4]&&104===t[5]&&62===t[6]&&10===t[7]&&100===t[8]&&101===t[9]&&98===t[10]&&105===t[11]&&97===t[12]&&110===t[13]&&45===t[14]&&98===t[15]&&105===t[16]&&110===t[17]&&97===t[18]&&114===t[19]&&121===t[20]?{ext:"deb",mime:"application/x-deb"}:33===t[0]&&60===t[1]&&97===t[2]&&114===t[3]&&99===t[4]&&104===t[5]&&62===t[6]?{ext:"ar",mime:"application/x-unix-archive"}:237===t[0]&&171===t[1]&&238===t[2]&&219===t[3]?{ext:"rpm",mime:"application/x-rpm"}:31===t[0]&&160===t[1]||31===t[0]&&157===t[1]?{ext:"Z",mime:"application/x-compress"}:76===t[0]&&90===t[1]&&73===t[2]&&80===t[3]?{ext:"lz",mime:"application/x-lzip"}:208===t[0]&&207===t[1]&&17===t[2]&&224===t[3]&&161===t[4]&&177===t[5]&&26===t[6]&&225===t[7]?{ext:"msi",mime:"application/x-msi"}:6===t[0]&&14===t[1]&&43===t[2]&&52===t[3]&&2===t[4]&&5===t[5]&&1===t[6]&&1===t[7]&&13===t[8]&&1===t[9]&&2===t[10]&&1===t[11]&&1===t[12]&&2===t[13]?{ext:"mxf",mime:"application/mxf"}:null:{ext:"swf",mime:"application/x-shockwave-flash"}}},function(e,t,i){function n(e){try{return s.lstatSync(e).isDirectory()}catch(e){return!0}}const s=i(30),r=i(25),o=i(57),a=i(14),c=i(37);class ResponseStream extends c.Readable{constructor(){super(),this.statusCode=200,this.status="OK"}error(e,t){return this.statusCode=e,this.status=t,this}on(e,t){["end","open"].includes(e)&&t()}_read(){}}const l={GET:(e,t)=>{t.end=(()=>{const i=n(e)?(new ResponseStream).error(404,`ENOENT: no such file or directory, open '${e}'`):s.createReadStream(e);t.res=i,i.headers={"content-length":0,"content-type":o.lookup(r.extname(e))},i.on("open",()=>{t.emit("response",i)}),i instanceof ResponseStream||(i.statusCode=200,i.on("end",()=>{i.headers["content-length"]=i.bytesRead}),i.on("error",e=>{i.statusCode=400,i.status=e.message}))})},POST:(e,t)=>{const i=[];t.write=(e=>{i.push(e)}),t.end=(n=>{i.push(n);const a=s.createWriteStream(e),c=new ResponseStream;t.res=c,c.headers={"content-length":0,"content-type":o.lookup(r.extname(e))},a.on("finish",()=>{t.emit("response",c)}),a.on("open",()=>{!function e(){const t=i.shift();t&&(a.write(t)?e():a.once("drain",e))}(),a.end()})})},DELETE:(e,t)=>{t.end=(()=>{const i=new ResponseStream;t.res=i,i.headers={"content-length":0,"content-type":o.lookup(r.extname(e))},s.unlink(e,e=>{t.emit("response",e?i.error(400,e.message):i)})})}};class Req extends a{constructor(){super(),this._headers={}}setHeader(){}}e.exports={request:function(e){const t=l[e.method];if(!t)throw new Error(`Invalid request method "${t}"`);const i=e.href.replace("file://",""),n=new Req;return t(i,n,e),n}}},function(e,t,i){"use strict";(function(t){function n(e,t){if(e===t)return 0;for(var i=e.length,n=t.length,s=0,r=Math.min(i,n);s=0;a--)if(c[a]!==l[a])return!1;for(a=c.length-1;a>=0;a--)if(o=c[a],!d(e[o],t[o],i,n))return!1;return!0}function g(e,t,i){d(e,t,!0)&&u(e,t,i,"notDeepStrictEqual",g)}function v(e,t){if(!e||!t)return!1;if("[object RegExp]"==Object.prototype.toString.call(t))return t.test(e);try{if(e instanceof t)return!0}catch(e){}return!Error.isPrototypeOf(t)&&!0===t.call({},e)}function E(e){var t;try{e()}catch(e){t=e}return t}function _(e,t,i,n){var s;if("function"!=typeof t)throw new TypeError('"block" argument must be a function');"string"==typeof i&&(n=i,i=null),s=E(t),n=(i&&i.name?" ("+i.name+").":".")+(n?" "+n:"."),e&&!s&&u(s,i,"Missing expected exception"+n);var r="string"==typeof n,o=!e&&y.isError(s),a=!e&&s&&!i;if((o&&r&&v(s,i)||a)&&u(s,i,"Got unwanted exception"+n),e&&s&&i&&!v(s,i)||!e&&s)throw s}var y=i(40),b=Object.prototype.hasOwnProperty,w=Array.prototype.slice,x="foo"===function(){}.name,A=e.exports=p,S=/\s*function\s+([^\(\s]*)\s*/;A.AssertionError=function(e){this.name="AssertionError",this.actual=e.actual,this.expected=e.expected,this.operator=e.operator,e.message?(this.message=e.message,this.generatedMessage=!1):(this.message=h(this),this.generatedMessage=!0);var t=e.stackStartFunction||u;if(Error.captureStackTrace)Error.captureStackTrace(this,t);else{var i=new Error;if(i.stack){var n=i.stack,s=a(t),r=n.indexOf("\n"+s);if(r>=0){var o=n.indexOf("\n",r+1);n=n.substring(o+1)}this.stack=n}}},y.inherits(A.AssertionError,Error),A.fail=u,A.ok=p,A.equal=function(e,t,i){e!=t&&u(e,t,i,"==",A.equal)},A.notEqual=function(e,t,i){e==t&&u(e,t,i,"!=",A.notEqual)},A.deepEqual=function(e,t,i){d(e,t,!1)||u(e,t,i,"deepEqual",A.deepEqual)},A.deepStrictEqual=function(e,t,i){d(e,t,!0)||u(e,t,i,"deepStrictEqual",A.deepStrictEqual)},A.notDeepEqual=function(e,t,i){d(e,t,!1)&&u(e,t,i,"notDeepEqual",A.notDeepEqual)},A.notDeepStrictEqual=g,A.strictEqual=function(e,t,i){e!==t&&u(e,t,i,"===",A.strictEqual)},A.notStrictEqual=function(e,t,i){e===t&&u(e,t,i,"!==",A.notStrictEqual)},A.throws=function(e,t,i){_(!0,e,t,i)},A.doesNotThrow=function(e,t,i){_(!1,e,t,i)},A.ifError=function(e){if(e)throw e};var T=Object.keys||function(e){var t=[];for(var i in e)b.call(e,i)&&t.push(i);return t}}).call(t,i(6))},function(e,t){e.exports=function(e){return e&&"object"==typeof e&&"function"==typeof e.copy&&"function"==typeof e.fill&&"function"==typeof e.readUInt8}},function(e,t){"function"==typeof Object.create?e.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(e,t){e.super_=t;var i=function(){};i.prototype=t.prototype,e.prototype=new i,e.prototype.constructor=e}},function(e,t,i){const{register:n}=i(59),s={CLIENT_INVALID_OPTION:(e,t)=>`The ${e} option must be ${t}`,TOKEN_INVALID:"An invalid token was provided.",TOKEN_MISSING:"Request to use token, but token was unavailable to the client.",FEATURE_USER_ONLY:"Only user accounts are able to make use of this feature.",WS_CONNECTION_EXISTS:"There is already an existing WebSocket connection.",WS_NOT_OPEN:(e="data")=>`Websocket not open to send ${e}`,PERMISSION_INVALID:"Invalid permission string or number.",RATELIMIT_INVALID_METHOD:"Unknown rate limiting method.",SHARDING_INVALID:"Invalid shard settings were provided.",SHARDING_REQUIRED:"This session would have handled too many guilds - Sharding is required.",SHARDING_CHILD_CONNECTION:"Failed to send message to shard's process.",SHARDING_PARENT_CONNECTION:"Failed to send message to master process.",SHARDING_NO_SHARDS:"No shards have been spawned",SHARDING_IN_PROCESS:"Shards are still being spawned",SHARDING_ALREADY_SPAWNED:e=>`Already spawned ${e} shards`,COLOR_RANGE:"Color must be within the range 0 - 16777215 (0xFFFFFF).",COLOR_CONVERT:"Unable to convert color to a number.",EMBED_FIELD_COUNT:"MessageEmbeds may not exceed 25 fields.",EMBED_FIELD_NAME:"MessageEmbed field names may not exceed 256 characters or be empty.",EMBED_FIELD_VALUE:"MessageEmbed field values may not exceed 1024 characters or be empty.",EMBED_DESCRIPTION:"MessageEmbed descriptions may not exceed 2048 characters.",EMBED_FOOTER_TEXT:"MessageEmbed footer text may not exceed 2048 characters.",EMBED_TITLE:"MessageEmbed titles may not exceed 256 characters.",FILE_NOT_FOUND:e=>`File could not be found: ${e}`,USER_NO_DMCHANNEL:"No DM Channel exists!",VOICE_INVALID_HEARTBEAT:"Tried to set voice heartbeat but no valid interval was specified.",VOICE_USER_MISSING:"Couldn't resolve the user to create stream.",VOICE_STREAM_EXISTS:"There is already an existing stream for that user.",VOICE_JOIN_CHANNEL:(e=!1)=>`You do not have permission to join this voice channel${e?"; it is full.":"."}`,VOICE_CONNECTION_TIMEOUT:"Connection not established within 15 seconds.",VOICE_TOKEN_ABSENT:"Token not provided from voice server packet.",VOICE_SESSION_ABSENT:"Session ID not supplied.",VOICE_INVALID_ENDPOINT:"Invalid endpoint received.",VOICE_NO_BROWSER:"Voice connections are not available in browsers.",VOICE_CONNECTION_ATTEMPTS_EXCEEDED:e=>`Too many connection attempts (${e}).`,VOICE_JOIN_SOCKET_CLOSED:"Tried to send join packet, but the WebSocket is not open.",OPUS_ENGINE_MISSING:"Couldn't find an Opus engine.",UDP_SEND_FAIL:"Tried to send a UDP packet, but there is no socket available.",UDP_ADDRESS_MALFORMED:"Malformed UDP address or port.",UDP_CONNECTION_EXISTS:"There is already an existing UDP connection.",REQ_BODY_TYPE:"The response body isn't a Buffer.",REQ_RESOURCE_TYPE:"The resource must be a string, Buffer or a valid file stream.",IMAGE_FORMAT:e=>`Invalid image format: ${e}`,IMAGE_SIZE:e=>`Invalid image size: ${e}`,MESSAGE_MISSING:"Message not found",MESSAGE_BULK_DELETE_TYPE:"The messages must be an Array, Collection, or number.",MESSAGE_NONCE_TYPE:"Message nonce must fit in an unsigned 64-bit integer.",TYPING_COUNT:"Count must be at least 1",SPLIT_MAX_LEN:"Message exceeds the max length and contains no split characters.",BAN_RESOLVE_ID:(e=!1)=>`Couldn't resolve the user ID to ${e?"ban":"unban"}.`,PRUNE_DAYS_TYPE:"Days must be a number",SEARCH_CHANNEL_TYPE:"Target must be a TextChannel, DMChannel, GroupDMChannel, or Guild.",MESSAGE_SPLIT_MISSING:"Message exceeds the max length and contains no split characters.",GUILD_CHANNEL_RESOLVE:"Could not resolve channel to a guild channel.",GUILD_OWNED:"Guild is owned by the client.",GUILD_RESTRICTED:(e=!1)=>`Guild is ${e?"already":"not"} restricted.`,GUILD_MEMBERS_TIMEOUT:"Members didn't arrive in time.",INVALID_TYPE:(e,t,i=!1)=>`Supplied ${e} is not a${i?"n":""} ${t}.`,WEBHOOK_MESSAGE:"The message was not sent by a webhook.",EMOJI_TYPE:"Emoji must be a string or Emoji/ReactionEmoji",REACTION_RESOLVE_USER:"Couldn't resolve the user ID to remove from the reaction."};for(const[e,t]of Object.entries(s))n(e,t)},function(e,t){t.endianness=function(){return"LE"},t.hostname=function(){return"undefined"!=typeof location?location.hostname:""},t.loadavg=function(){return[]},t.uptime=function(){return 0},t.freemem=function(){return Number.MAX_VALUE},t.totalmem=function(){return Number.MAX_VALUE},t.cpus=function(){return[]},t.type=function(){return"Browser"},t.release=function(){return"undefined"!=typeof navigator?navigator.appVersion:""},t.networkInterfaces=t.getNetworkInterfaces=function(){return{}},t.arch=function(){return"javascript"},t.platform=function(){return"browser"},t.tmpdir=t.tmpDir=function(){return"/tmp"},t.EOL="\n"},function(e,t,i){(function(t){const n=i(0);class UserAgentManager{constructor(){this.build(this.constructor.DEFAULT)}set({url:e,version:t}={}){this.build({url:e||this.constructor.DFEAULT.url,version:t||this.constructor.DEFAULT.version})}build(e){this.userAgent=`DiscordBot (${e.url}, ${e.version}) Node.js/${t.version}`}}UserAgentManager.DEFAULT={url:n.Package.homepage.split("#")[0],version:n.Package.version},e.exports=UserAgentManager}).call(t,i(8))},function(e,t,i){e.exports={sequential:i(117),burst:i(118),RequestHandler:i(119)}},function(e,t){e.exports=function(){this.busy||this.limited||0===this.queue.length||(this.busy=!0,this.execute(this.queue.shift()).then(()=>{this.busy=!1,this.handle()}).catch(({timeout:e})=>{this.client.setTimeout(()=>{this.reset(),this.busy=!1,this.handle()},e||this.resetTime-Date.now()+this.timeDifference+this.client.options.restTimeOffset)}))}},function(e,t){e.exports=function(){this.limited||0===this.queue.length||(this.execute(this.queue.shift()).then(this.handle.bind(this)).catch(({timeout:e})=>{this.client.setTimeout(()=>{this.reset(),this.handle()},e||this.resetTime-Date.now()+this.timeDifference+this.client.options.restTimeOffset)}),this.remaining--,this.handle())}},function(e,t,i){const n=i(61);class RequestHandler{constructor(e,t){this.manager=e,this.client=this.manager.client,this.handle=t.bind(this),this.limit=1/0,this.resetTime=null,this.remaining=1,this.timeDifference=0,this.queue=[]}get limited(){return this.manager.globallyRateLimited||this.remaining<=0}set globallyLimited(e){this.manager.globallyRateLimited=e}push(e){this.queue.push(e),this.handle()}execute(e){return new Promise((t,i)=>{const s=e=>{e||this.limited?i({timeout:e,limited:this.limited}):t()};e.request.gen().end((t,i)=>{if(i&&i.headers&&(i.headers["x-ratelimit-global"]&&(this.globallyLimited=!0),this.limit=Number(i.headers["x-ratelimit-limit"]),this.resetTime=1e3*Number(i.headers["x-ratelimit-reset"]),this.remaining=Number(i.headers["x-ratelimit-remaining"]),this.timeDifference=Date.now()-new Date(i.headers.date).getTime()),t)429===t.status?(this.queue.unshift(e),s(Number(i.headers["retry-after"])+this.client.options.restTimeOffset)):t.status>=500&&t.status<600?(this.queue.unshift(e),s(1e3+this.client.options.restTimeOffset)):(e.reject(t.status>=400&&t.status<500?new n(i.request.path,i.body):t),s());else{const t=i&&i.body?i.body:{};e.resolve(t),s()}})})}reset(){this.globallyLimited=!1,this.remaining=1}}e.exports=RequestHandler},function(e,t,i){const n=i(31),s=i(36);class APIRequest{constructor(e,t,i,n){this.rest=e,this.client=e.client,this.method=t,this.path=i.toString(),this.route=n.route,this.options=n}gen(){const e=!1===this.options.versioned?this.client.options.http.api:`${this.client.options.http.api}/v${this.client.options.http.version}`;if(this.options.query){const e=(n.stringify(this.options.query).match(/[^=&?]+=[^=&?]+/g)||[]).join("&");this.path+=`?${e}`}const t=s[this.method](`${e}${this.path}`);if(!1!==this.options.auth&&t.set("Authorization",this.rest.getAuth()),this.options.reason&&t.set("X-Audit-Log-Reason",encodeURIComponent(this.options.reason)),this.rest.client.browser||t.set("User-Agent",this.rest.userAgentManager.userAgent),this.options.headers&&t.set(this.options.headers),this.options.files){for(const e of this.options.files)e&&e.file&&t.attach(e.name,e.file,e.name);void 0!==this.options.data&&t.attach("payload_json",JSON.stringify(this.options.data))}else void 0!==this.options.data&&t.send(this.options.data);return t}}e.exports=APIRequest},function(e,t,i){const n=i(40),s=()=>{},r=["get","post","delete","patch","put"],o=["toString","valueOf","inspect","constructor",Symbol.toPrimitive,n.inspect.custom];e.exports=function(e){const t=[""],i={get:(n,a)=>o.includes(a)?()=>t.join("/"):r.includes(a)?i=>e.request(a,t.join("/"),Object.assign({versioned:e.versioned,route:t.map((e,i)=>/\d{16,19}/g.test(e)?/channels|guilds/.test(t[i-1])?e:":id":e).join("/")},i)):(t.push(a),new Proxy(s,i)),apply:(e,n,r)=>(t.push(...r.filter(e=>null!=e)),new Proxy(s,i))};return new Proxy(s,i)}},function(module,exports,__webpack_require__){(function(process){const BaseClient=__webpack_require__(41),Permissions=__webpack_require__(12),RESTManager=__webpack_require__(60),ClientManager=__webpack_require__(123),ClientVoiceManager=__webpack_require__(124),WebSocketManager=__webpack_require__(125),ActionsManager=__webpack_require__(178),Collection=__webpack_require__(3),VoiceRegion=__webpack_require__(74),Webhook=__webpack_require__(22),Invite=__webpack_require__(34),ClientApplication=__webpack_require__(45),ShardClientUtil=__webpack_require__(207),VoiceBroadcast=__webpack_require__(208),UserStore=__webpack_require__(209),ChannelStore=__webpack_require__(210),GuildStore=__webpack_require__(211),ClientPresenceStore=__webpack_require__(212),Constants=__webpack_require__(0),DataResolver=__webpack_require__(13),{Error:Error,TypeError:TypeError,RangeError:RangeError}=__webpack_require__(4);class Client extends BaseClient{constructor(e={}){super(Object.assign({_tokenType:"Bot"},e)),!this.options.shardId&&"SHARD_ID"in Object({__DISCORD_WEBPACK__:"true"})&&(this.options.shardId=Number(Object({__DISCORD_WEBPACK__:"true"}).SHARD_ID)),!this.options.shardCount&&"SHARD_COUNT"in Object({__DISCORD_WEBPACK__:"true"})&&(this.options.shardCount=Number(Object({__DISCORD_WEBPACK__:"true"}).SHARD_COUNT)),this._validateOptions(),this.rest=new RESTManager(this),this.manager=new ClientManager(this),this.ws=new WebSocketManager(this),this.actions=new ActionsManager(this),this.voice=this.browser?null:new ClientVoiceManager(this),this.shard=process.send?ShardClientUtil.singleton(this):null,this.users=new UserStore(this),this.guilds=new GuildStore(this),this.channels=new ChannelStore(this),this.presences=new ClientPresenceStore(this),Object.defineProperty(this,"token",{writable:!0}),!this.token&&"CLIENT_TOKEN"in Object({__DISCORD_WEBPACK__:"true"})?this.token=Object({__DISCORD_WEBPACK__:"true"}).CLIENT_TOKEN:this.token=null,this.user=null,this.readyAt=null,this.broadcasts=[],this.pings=[],this._timeouts=new Set,this._intervals=new Set,this.options.messageSweepInterval>0&&this.setInterval(this.sweepMessages.bind(this),1e3*this.options.messageSweepInterval)}get _pingTimestamp(){return this.ws.connection?this.ws.connection.lastPingTimestamp:0}get status(){return this.ws.connection?this.ws.connection.status:null}get uptime(){return this.readyAt?Date.now()-this.readyAt:null}get ping(){return this.pings.reduce((e,t)=>e+t,0)/this.pings.length}get voiceConnections(){return this.browser?new Collection:this.voice.connections}get emojis(){const e=new Collection;for(const t of this.guilds.values())if(t.available)for(const i of t.emojis.values())e.set(i.id,i);return e}get readyTimestamp(){return this.readyAt?this.readyAt.getTime():null}createVoiceBroadcast(){const e=new VoiceBroadcast(this);return this.broadcasts.push(e),e}login(e){return new Promise((t,i)=>{if("string"!=typeof e)throw new Error("TOKEN_INVALID");e=e.replace(/^Bot\s*/i,""),this.manager.connectToWebSocket(e,t,i)}).catch(e=>(this.destroy(),Promise.reject(e)))}destroy(){return super.destroy(),this.manager.destroy()}syncGuilds(e=this.guilds){this.user.bot||this.ws.send({op:12,d:e instanceof Collection?e.keyArray():e.map(e=>e.id)})}fetchInvite(e){const t=DataResolver.resolveInviteCode(e);return this.api.invites(t).get({query:{with_counts:!0}}).then(e=>new Invite(this,e))}fetchWebhook(e,t){return this.api.webhooks(e,t).get().then(e=>new Webhook(this,e))}fetchVoiceRegions(){return this.api.voice.regions.get().then(e=>{const t=new Collection;for(const i of e)t.set(i.id,new VoiceRegion(i));return t})}sweepMessages(e=this.options.messageCacheLifetime){if("number"!=typeof e||isNaN(e))throw new TypeError("CLIENT_INVALID_OPTION","Lifetime","a number");if(e<=0)return this.emit(Constants.Events.DEBUG,"Didn't sweep messages - lifetime is unlimited"),-1;const t=1e3*e,i=Date.now();let n=0,s=0;for(const e of this.channels.values())if(e.messages){n++;for(const n of e.messages.values())i-(n.editedTimestamp||n.createdTimestamp)>t&&(e.messages.delete(n.id),s++)}return this.emit(Constants.Events.DEBUG,`Swept ${s} messages older than ${e} seconds in ${n} text-based channels`),s}fetchApplication(e="@me"){return this.api.oauth2.applications(e).get().then(e=>new ClientApplication(this,e))}generateInvite(e){return e?e instanceof Array&&(e=Permissions.resolve(e)):e=0,this.fetchApplication().then(t=>`https://discordapp.com/oauth2/authorize?client_id=${t.id}&permissions=${e}&scope=bot`)}_pong(e){this.pings.unshift(Date.now()-e),this.pings.length>3&&(this.pings.length=3),this.ws.lastHeartbeatAck=!0}_eval(script){return eval(script)}_validateOptions(e=this.options){if("number"!=typeof e.shardCount||isNaN(e.shardCount))throw new TypeError("CLIENT_INVALID_OPTION","shardCount","a number");if("number"!=typeof e.shardId||isNaN(e.shardId))throw new TypeError("CLIENT_INVALID_OPTION","shardId","a number");if(e.shardCount<0)throw new RangeError("CLIENT_INVALID_OPTION","shardCount","at least 0");if(e.shardId<0)throw new RangeError("CLIENT_INVALID_OPTION","shardId","at least 0");if(0!==e.shardId&&e.shardId>=e.shardCount)throw new RangeError("CLIENT_INVALID_OPTION","shardId","less than shardCount");if("number"!=typeof e.messageCacheMaxSize||isNaN(e.messageCacheMaxSize))throw new TypeError("CLIENT_INVALID_OPTION","messageCacheMaxSize","a number");if("number"!=typeof e.messageCacheLifetime||isNaN(e.messageCacheLifetime))throw new TypeError("CLIENT_INVALID_OPTION","The messageCacheLifetime","a number");if("number"!=typeof e.messageSweepInterval||isNaN(e.messageSweepInterval))throw new TypeError("CLIENT_INVALID_OPTION","messageSweepInterval","a number");if("boolean"!=typeof e.fetchAllMembers)throw new TypeError("CLIENT_INVALID_OPTION","fetchAllMembers","a boolean");if("boolean"!=typeof e.disableEveryone)throw new TypeError("CLIENT_INVALID_OPTION","disableEveryone","a boolean");if("number"!=typeof e.restWsBridgeTimeout||isNaN(e.restWsBridgeTimeout))throw new TypeError("CLIENT_INVALID_OPTION","restWsBridgeTimeout","a number");if("boolean"!=typeof e.internalSharding)throw new TypeError("CLIENT_INVALID_OPTION","internalSharding","a boolean");if(!(e.disabledEvents instanceof Array))throw new TypeError("CLIENT_INVALID_OPTION","disabledEvents","an Array")}}module.exports=Client}).call(exports,__webpack_require__(8))},function(e,t,i){const n=i(0),{Error:s}=i(4);class ClientManager{constructor(e){this.client=e,this.heartbeatInterval=null}get status(){return this.connection?this.connection.status:n.Status.IDLE}connectToWebSocket(e,t,i){this.client.emit(n.Events.DEBUG,`Authenticated using token ${e}`),this.client.token=e;const r=this.client.setTimeout(()=>i(new s("TOKEN_INVALID")),3e5);this.client.api.gateway.get().then(o=>{const a=`${o.url}/`;this.client.emit(n.Events.DEBUG,`Using gateway ${a}`),this.client.ws.connect(a),this.client.ws.connection.once("close",e=>{4004===e.code&&i(new s("TOKEN_INVALID")),4010===e.code&&i(new s("SHARDING_INVALID")),4011===e.code&&i(new s("SHARDING_REQUIRED"))}),this.client.once(n.Events.READY,()=>{t(e),this.client.clearTimeout(r)})},i)}destroy(){return this.client.ws.destroy(),this.client.rest.destroy(),this.client.user?this.client.user.bot?(this.client.token=null,Promise.resolve()):this.client.api.logout.post().then(()=>{this.client.token=null}):Promise.resolve()}}e.exports=ClientManager},function(e,t){},function(e,t,i){const n=i(14),s=i(0),r=i(126);class WebSocketManager extends n{constructor(e){super(),this.client=e,this.connection=null}heartbeat(){return this.connection?this.connection.heartbeat():this.debug("No connection to heartbeat")}debug(e){return this.client.emit(s.Events.DEBUG,`[ws] ${e}`)}destroy(){return this.connection?this.connection.destroy():(this.debug("Attempted to destroy WebSocket but no connection exists!"),!1)}send(e){this.connection?this.connection.send(e):this.debug("No connection to websocket")}connect(e){if(!this.connection)return this.connection=new r(this,e),!0;switch(this.connection.status){case s.Status.IDLE:case s.Status.DISCONNECTED:return this.connection.connect(e,5500),!0;default:return this.debug(`Couldn't connect to ${e} as the websocket is at state ${this.connection.status}`),!1}}}e.exports=WebSocketManager},function(e,t,i){const n=i(14),s=i(0),r=i(127),o=i(78);class WebSocketConnection extends n{constructor(e,t){super(),this.manager=e,this.client=e.client,this.ws=null,this.sequence=-1,this.status=s.Status.IDLE,this.packetManager=new r(this),this.lastPingTimestamp=0,this.ratelimit={queue:[],remaining:60,total:60,resetTimer:null},this.connect(t),this.disabledEvents={},this.closeSequence=0,this.expectingClose=!1;for(const e of this.client.options.disabledEvents)this.disabledEvents[e]=!0}triggerReady(){this.status!==s.Status.READY?(this.status=s.Status.READY,this.client.emit(s.Events.READY),this.packetManager.handleQueue()):this.debug("Tried to mark self as ready, but already ready")}checkIfReady(){if(this.status===s.Status.READY||this.status===s.Status.NEARLY)return!1;let e=0;for(const t of this.client.guilds.values())t.available||e++;if(0===e){if(this.status=s.Status.NEARLY,!this.client.options.fetchAllMembers)return this.triggerReady();const e=this.client.guilds.map(e=>e.members.fetch());Promise.all(e).then(()=>this.triggerReady()).catch(e=>{this.debug(`Failed to fetch all members before ready! ${e}`),this.triggerReady()})}return!0}debug(e){return e instanceof Error&&(e=e.stack),this.manager.debug(`[connection] ${e}`)}processQueue(){if(0!==this.ratelimit.remaining&&0!==this.ratelimit.queue.length)for(this.ratelimit.remaining===this.ratelimit.total&&(this.ratelimit.resetTimer=this.client.setTimeout(()=>{this.ratelimit.remaining=this.ratelimit.total,this.processQueue()},12e4));this.ratelimit.remaining>0;){const e=this.ratelimit.queue.shift();if(!e)return;this._send(e),this.ratelimit.remaining--}}_send(e){this.ws&&this.ws.readyState===o.OPEN?this.ws.send(o.pack(e)):this.debug(`Tried to send packet ${e} but no WebSocket is available!`)}send(e){this.ws&&this.ws.readyState===o.OPEN?(this.ratelimit.queue.push(e),this.processQueue()):this.debug(`Tried to send packet ${e} but no WebSocket is available!`)}connect(e=this.gateway,t=0,i=!1){if(t)return this.client.setTimeout(()=>this.connect(e,0,i),t);if(this.ws&&!i)return this.debug("WebSocket connection already exists"),!1;if("string"!=typeof e)return this.debug(`Tried to connect to an invalid gateway: ${e}`),!1;this.expectingClose=!1,this.gateway=e,this.debug(`Connecting to ${e}`);const n=this.ws=o.create(e,{v:s.DefaultOptions.ws.version});return n.onmessage=this.onMessage.bind(this),n.onopen=this.onOpen.bind(this),n.onerror=this.onError.bind(this),n.onclose=this.onClose.bind(this),this.status=s.Status.CONNECTING,!0}destroy(){const e=this.ws;return e?(this.heartbeat(-1),this.expectingClose=!0,e.close(1e3),this.packetManager.handleQueue(),this.ws=null,this.status=s.Status.DISCONNECTED,this.ratelimit.remaining=this.ratelimit.total,!0):(this.debug("Attempted to destroy WebSocket but no connection exists!"),!1)}onMessage(e){let t;try{t=o.unpack(e.data)}catch(e){this.emit("debug",e)}const i=this.onPacket(t);return this.client.emit("raw",t),i}setSequence(e){this.sequence=e>this.sequence?e:this.sequence}onPacket(e){if(!e)return this.debug("Received null packet"),!1;switch(e.op){case s.OPCodes.HELLO:return this.heartbeat(e.d.heartbeat_interval);case s.OPCodes.RECONNECT:return this.reconnect();case s.OPCodes.INVALID_SESSION:return e.d||(this.sessionID=null),this.sequence=-1,this.debug("Session invalidated -- will identify with a new session"),this.identify(e.d?2500:0);case s.OPCodes.HEARTBEAT_ACK:return this.ackHeartbeat();case s.OPCodes.HEARTBEAT:return this.heartbeat();default:return this.packetManager.handle(e)}}onOpen(e){e&&e.target&&e.target.url&&(this.gateway=e.target.url),this.debug(`Connected to gateway ${this.gateway}`),this.identify()}reconnect(){this.debug("Attemping to reconnect in 5500ms..."),this.client.emit(s.Events.RECONNECTING),this.connect(this.gateway,5500,!0)}onError(e){e&&"uWs client connection error"===e.message?this.reconnect():this.client.emit(s.Events.ERROR,e)}onClose(e){if(this.debug(`${this.expectingClose?"Client":"Server"} closed the WebSocket connection: ${e.code}`),this.closeSequence=this.sequence,this.emit("close",e),this.heartbeat(-1),1e3===e.code?this.expectingClose:s.WSCodes[e.code])return this.expectingClose=!1,this.client.emit(s.Events.DISCONNECT,e),this.debug(s.WSCodes[e.code]),void this.destroy();this.expectingClose=!1,this.reconnect()}ackHeartbeat(){this.debug(`Heartbeat acknowledged, latency of ${Date.now()-this.lastPingTimestamp}ms`),this.client._pong(this.lastPingTimestamp)}heartbeat(e){isNaN(e)?(this.debug("Sending a heartbeat"),this.lastPingTimestamp=Date.now(),this.send({op:s.OPCodes.HEARTBEAT,d:this.sequence})):-1===e?(this.debug("Clearing heartbeat interval"),this.client.clearInterval(this.heartbeatInterval),this.heartbeatInterval=null):(this.debug(`Setting a heartbeat interval for ${e}ms`),this.heartbeatInterval=this.client.setInterval(()=>this.heartbeat(),e))}identify(e){return e?this.client.setTimeout(this.identify.bind(this),e):this.sessionID?this.identifyResume():this.identifyNew()}identifyNew(){if(!this.client.token)return void this.debug("No token available to identify a new session with");const e=Object.assign({token:this.client.token},this.client.options.ws),{shardId:t,shardCount:i}=this.client.options;i>0&&(e.shard=[Number(t),Number(i)]),this.debug("Identifying as a new session"),this.send({op:s.OPCodes.IDENTIFY,d:e})}identifyResume(){if(!this.sessionID)return this.debug("Warning: wanted to resume but session ID not available; identifying as a new session instead"),this.identifyNew();this.debug(`Attempting to resume session ${this.sessionID}`);const e={token:this.client.token,session_id:this.sessionID,seq:this.sequence};return this.send({op:s.OPCodes.RESUME,d:e})}}e.exports=WebSocketConnection},function(e,t,i){const n=i(0),s=[n.WSEvents.READY,n.WSEvents.RESUMED,n.WSEvents.GUILD_CREATE,n.WSEvents.GUILD_DELETE,n.WSEvents.GUILD_MEMBERS_CHUNK,n.WSEvents.GUILD_MEMBER_ADD,n.WSEvents.GUILD_MEMBER_REMOVE];class WebSocketPacketManager{constructor(e){this.ws=e,this.handlers={},this.queue=[],this.register(n.WSEvents.READY,i(128)),this.register(n.WSEvents.RESUMED,i(139)),this.register(n.WSEvents.GUILD_CREATE,i(140)),this.register(n.WSEvents.GUILD_DELETE,i(141)),this.register(n.WSEvents.GUILD_UPDATE,i(142)),this.register(n.WSEvents.GUILD_BAN_ADD,i(143)),this.register(n.WSEvents.GUILD_BAN_REMOVE,i(144)),this.register(n.WSEvents.GUILD_MEMBER_ADD,i(145)),this.register(n.WSEvents.GUILD_MEMBER_REMOVE,i(146)),this.register(n.WSEvents.GUILD_MEMBER_UPDATE,i(147)),this.register(n.WSEvents.GUILD_ROLE_CREATE,i(148)),this.register(n.WSEvents.GUILD_ROLE_DELETE,i(149)),this.register(n.WSEvents.GUILD_ROLE_UPDATE,i(150)),this.register(n.WSEvents.GUILD_EMOJIS_UPDATE,i(151)),this.register(n.WSEvents.GUILD_MEMBERS_CHUNK,i(152)),this.register(n.WSEvents.CHANNEL_CREATE,i(153)),this.register(n.WSEvents.CHANNEL_DELETE,i(154)),this.register(n.WSEvents.CHANNEL_UPDATE,i(155)),this.register(n.WSEvents.CHANNEL_PINS_UPDATE,i(156)),this.register(n.WSEvents.PRESENCE_UPDATE,i(157)),this.register(n.WSEvents.USER_UPDATE,i(158)),this.register(n.WSEvents.USER_NOTE_UPDATE,i(159)),this.register(n.WSEvents.USER_SETTINGS_UPDATE,i(160)),this.register(n.WSEvents.USER_GUILD_SETTINGS_UPDATE,i(161)),this.register(n.WSEvents.VOICE_STATE_UPDATE,i(162)),this.register(n.WSEvents.TYPING_START,i(163)),this.register(n.WSEvents.MESSAGE_CREATE,i(164)),this.register(n.WSEvents.MESSAGE_DELETE,i(165)),this.register(n.WSEvents.MESSAGE_UPDATE,i(166)),this.register(n.WSEvents.MESSAGE_DELETE_BULK,i(167)),this.register(n.WSEvents.VOICE_SERVER_UPDATE,i(168)),this.register(n.WSEvents.GUILD_SYNC,i(169)),this.register(n.WSEvents.RELATIONSHIP_ADD,i(170)),this.register(n.WSEvents.RELATIONSHIP_REMOVE,i(171)),this.register(n.WSEvents.MESSAGE_REACTION_ADD,i(172)),this.register(n.WSEvents.MESSAGE_REACTION_REMOVE,i(173)),this.register(n.WSEvents.MESSAGE_REACTION_REMOVE_ALL,i(174))}get client(){return this.ws.client}register(e,t){this.handlers[e]=new t(this)}handleQueue(){this.queue.forEach((e,t)=>{this.handle(this.queue[t],!0),this.queue.splice(t,1)})}handle(e,t=!1){return e.op===n.OPCodes.HEARTBEAT_ACK?(this.ws.client._pong(this.ws.client._pingTimestamp),this.ws.lastHeartbeatAck=!0,this.ws.client.emit("debug","Heartbeat acknowledged")):e.op===n.OPCodes.HEARTBEAT&&(this.client.ws.send({op:n.OPCodes.HEARTBEAT,d:this.client.ws.sequence}),this.ws.client.emit("debug","Received gateway heartbeat")),this.ws.status===n.Status.RECONNECTING&&(this.ws.reconnecting=!1,this.ws.checkIfReady()),this.ws.setSequence(e.s),void 0===this.ws.disabledEvents[e.t]&&(this.ws.status!==n.Status.READY&&-1===s.indexOf(e.t)?(this.queue.push(e),!1):(!t&&this.queue.length>0&&this.handleQueue(),!!this.handlers[e.t]&&this.handlers[e.t].handle(e)))}}e.exports=WebSocketPacketManager},function(e,t,i){const n=i(1),s=i(0),r=i(62);class ReadyHandler extends n{handle(e){const t=this.packetManager.client,i=e.d;t.ws.heartbeat(),i.user.user_settings=i.user_settings,i.user.user_guild_settings=i.user_guild_settings;const n=new r(t,i.user);t.user=n,t.readyAt=new Date,t.users.set(n.id,n);for(const e of i.guilds)t.guilds.create(e);for(const e of i.private_channels)t.channels.create(e);for(const e of i.relationships){const i=t.users.create(e.user);1===e.type?t.user.friends.set(i.id,i):2===e.type&&t.user.blocked.set(i.id,i)}for(const e of i.presences||[])t.presences.create(e);if(i.notes)for(const e in i.notes){let n=i.notes[e];n.length||(n=null),t.user.notes.set(e,n)}t.users.has("1")||t.users.create({id:"1",username:"Clyde",discriminator:"0000",avatar:"https://discordapp.com/assets/f78426a064bc9dd24847519259bc42af.png",bot:!0,status:"online",activity:null,verified:!0});const o=t.setTimeout(()=>{t.ws.connection.triggerReady()},1200*i.guilds.length);t.setMaxListeners(i.guilds.length+10),t.once("ready",()=>{t.syncGuilds(),t.setMaxListeners(10),t.clearTimeout(o)});const a=this.packetManager.ws;a.sessionID=i.session_id,a._trace=i._trace,t.emit(s.Events.DEBUG,`READY ${a._trace.join(" -> ")} ${a.sessionID}`),a.checkIfReady()}}e.exports=ReadyHandler},function(e,t,i){const n=i(43),{TypeError:s}=i(4);e.exports=function(e,t){if("string"==typeof t&&(t={content:t}),t.before&&(t.before instanceof Date||(t.before=new Date(t.before)),t.maxID=n.fromNumber(t.before.getTime()-14200704e5).shiftLeft(22).toString()),t.after&&(t.after instanceof Date||(t.after=new Date(t.after)),t.minID=n.fromNumber(t.after.getTime()-14200704e5).shiftLeft(22).toString()),t.during){t.during instanceof Date||(t.during=new Date(t.during));const e=t.during.getTime()-14200704e5;t.minID=n.fromNumber(e).shiftLeft(22).toString(),t.maxID=n.fromNumber(e+864e5).shiftLeft(22).toString()}t.channel&&(t.channel=e.client.channels.resolveID(t.channel)),t.author&&(t.author=e.client.users.resolveID(t.author)),t.mentions&&(t.mentions=e.client.users.resolveID(t.options.mentions)),t.sortOrder&&(t.sortOrder={ascending:"asc",descending:"desc"}[t.sortOrder]||t.sortOrder),t={content:t.content,max_id:t.maxID,min_id:t.minID,has:t.has,channel_id:t.channel,author_id:t.author,author_type:t.authorType,context_size:t.contextSize,sort_by:t.sortBy,sort_order:t.sortOrder,limit:t.limit,offset:t.offset,mentions:t.mentions,mentions_everyone:t.mentionsEveryone,link_hostname:t.linkHostname,embed_provider:t.embedProvider,embed_type:t.embedType,attachment_filename:t.attachmentFilename,attachment_extension:t.attachmentExtension,include_nsfw:t.nsfw};const r=i(17),o=i(35);if(!(e instanceof r||e instanceof o))throw new s("SEARCH_CHANNEL_TYPE");return e.client.api[e instanceof r?"channels":"guilds"](e.id).messages().search.get({query:t}).then(t=>{const i=t.messages.map(t=>t.map(t=>e.client.channels.get(t.channel_id).messages.create(t,!1)));return{total:t.total_results,results:i}})}},function(e,t,i){const n=i(11),s=i(68);class ReactionStore extends n{constructor(e,t){super(e.client,t,s),this.message=e}create(e,t){return e.emoji.id=e.emoji.id||decodeURIComponent(e.emoji.name),super.create(e,t,{id:e.emoji.id,extras:[this.message]})}}e.exports=ReactionStore},function(e,t,i){const n=i(11),s=i(18),r=i(0),o=i(3),{Error:a}=i(4);class GuildMemberStore extends n{constructor(e,t){super(e.client,t,s),this.guild=e}create(e,t){return super.create(e,t,{extras:[this.guild]})}resolve(e){const t=super.resolve(e);if(t)return t;const i=this.client.users.resolveID(e);return i?super.resolve(i):null}resolveID(e){const t=super.resolveID(e);if(t)return t;const i=this.client.users.resolveID(e);return this.has(i)?i:null}fetch(e){if(!e)return this._fetchMany();const t=this.resolveID(e);return t?this._fetchSingle({user:t,cache:!0}):e.user&&(e.user=this.resolveID(e.user),e.user)?this._fetchSingle(e):this._fetchMany(e)}_fetchSingle({user:e,cache:t}){return this.has(e)?Promise.resolve(this.get(e)):this.client.api.guilds(this.guild.id).members(e).get().then(e=>this.create(e,t))}_fetchMany({query:e="",limit:t=0}={}){return new Promise((i,n)=>{if(this.guild.memberCount===this.size)return void i(e||t?new o:this);this.guild.client.ws.send({op:r.OPCodes.REQUEST_GUILD_MEMBERS,d:{guild_id:this.guild.id,query:e,limit:t}});const s=new o,c=(n,o)=>{if(o.id===this.guild.id){for(const i of n.values())(e||t)&&s.set(i.id,i);(this.guild.memberCount<=this.size||(e||t)&&n.size<1e3||t&&s.size>=t)&&(this.guild.client.removeListener(r.Events.GUILD_MEMBERS_CHUNK,c),i(e||t?s:this))}};this.guild.client.on(r.Events.GUILD_MEMBERS_CHUNK,c),this.guild.client.setTimeout(()=>{this.guild.client.removeListener(r.Events.GUILD_MEMBERS_CHUNK,c),n(new a("GUILD_MEMBERS_TIMEOUT"))},12e4)})}}e.exports=GuildMemberStore},function(e,t,i){const n=i(11),s=i(27);class RoleStore extends n{constructor(e,t){super(e.client,t,s),this.guild=e}create(e,t){return super.create(e,t,{extras:[this.guild]})}}e.exports=RoleStore},function(e,t,i){const n=i(11),s=i(46),r=i(47);class EmojiStore extends n{constructor(e,t){super(e.client,t,s),this.guild=e}create(e,t){super.create(e,t,{extras:[this.guild]})}resolve(e){return e instanceof r?super.resolve(e.id):super.resolve(e)}resolveID(e){return e instanceof r?e.id:super.resolveID(e)}resolveIdentifier(e){const t=this.resolve(e);return t?t.identifier:"string"==typeof e?e.includes("%")?e:encodeURIComponent(e):null}}e.exports=EmojiStore},function(e,t,i){const n=i(11),s=i(17),r=i(21);class GuildChannelStore extends n{constructor(e,t){super(e.client,t,r),this.guild=e}create(e){const t=this.get(e.id);return t||s.create(this.client,e,this.guild)}}e.exports=GuildChannelStore},function(e,t,i){const n=i(7),s=i(20),{RangeError:r}=i(4);e.exports=function(e,t){const o=i(32),a=i(18);if(e instanceof o||e instanceof a)return e.createDM().then(e=>e.send(t));let{content:c,nonce:l,reply:h,code:u,disableEveryone:p,tts:d,embed:f,files:m,split:g}=t;if(f&&(f=new s(f)._apiTransform()),void 0!==l&&(l=parseInt(l),isNaN(l)||l<0))throw new r("MESSAGE_NONCE_TYPE");if(h&&!(e instanceof o||e instanceof a)&&"dm"!==e.type){const t=e.client.users.resolveID(h),i=`<@${h instanceof a&&h.nickname?"!":""}${t}>`;g&&(g.prepend=`${i}, ${g.prepend||""}`),c=`${i}${void 0!==c?`, ${c}`:""}`}return c&&(c=n.resolveString(c),g&&"object"!=typeof g&&(g={}),void 0===u||"boolean"==typeof u&&!0!==u||(c=n.escapeMarkdown(c,!0),c=`\`\`\`${"boolean"!=typeof u?u||"":""}\n${c}\n\`\`\``,g&&(g.prepend=`\`\`\`${"boolean"!=typeof u?u||"":""}\n`,g.append="\n```")),(p||void 0===p&&e.client.options.disableEveryone)&&(c=c.replace(/@(everyone|here)/g,"@​$1")),g&&(c=n.splitMessage(c,g))),c instanceof Array?new Promise((t,i)=>{const n=[];!function s(){const r=c.length?{tts:d}:{tts:d,embed:f,files:m};e.send(c.shift(),r).then(e=>(n.push(e),0===c.length?t(n):s())).catch(i)}()}):e.client.api.channels[e.id].messages.post({data:{content:c,tts:d,nonce:l,embed:f},files:m}).then(t=>e.client.actions.MessageCreate.handle(t).message)}},function(e,t,i){const n=i(3),{UserFlags:s}=i(0),r=i(137),o=i(10);class UserProfile extends o{constructor(e,t){super(e.client),this.user=e,this.mutualGuilds=new n,this.connections=new n,this._patch(t)}_patch(e){this.premium=Boolean(e.premium_since),this._flags=e.user.flags,this.premiumSince=e.premium_since?new Date(e.premium_since):null;for(const t of e.mutual_guilds)this.client.guilds.has(t.id)&&this.mutualGuilds.set(t.id,this.client.guilds.get(t.id));for(const t of e.connected_accounts)this.connections.set(t.id,new r(this.user,t))}get flags(){const e=[];for(const[t,i]of Object.entries(s))(this._flags&i)===i&&e.push(t);return e}}e.exports=UserProfile},function(e,t){class UserConnection{constructor(e,t){this.user=e,this._patch(t)}_patch(e){this.type=e.type,this.name=e.name,this.id=e.id,this.revoked=e.revoked,this.integrations=e.integrations}}e.exports=UserConnection},function(e,t,i){const n=i(0);class ClientUserChannelOverride{constructor(e){this.patch(e)}patch(e){for(const[t,i]of Object.entries(n.UserChannelOverrideMap))e.hasOwnProperty(t)&&("function"==typeof i?this[i.name]=i(e[t]):this[i]=e[t])}}e.exports=ClientUserChannelOverride},function(e,t,i){const n=i(1),s=i(0);class ResumedHandler extends n{handle(e){const t=this.packetManager.client,i=t.ws.connection;i._trace=e.d._trace,i.status=s.Status.READY,this.packetManager.handleQueue();const n=i.sequence-i.closeSequence;i.debug(`RESUMED ${i._trace.join(" -> ")} | replayed ${n} events.`),t.emit(s.Events.RESUMED,n),i.heartbeat()}}e.exports=ResumedHandler},function(e,t,i){const n=i(1),s=i(0);class GuildCreateHandler extends n{async handle(e){const t=this.packetManager.client,i=e.d;let n=t.guilds.get(i.id);n?n.available||i.unavailable||(n._patch(i),this.packetManager.ws.checkIfReady()):(n=t.guilds.create(i),t.ws.connection.status===s.Status.READY&&(t.options.fetchAllMembers&&await n.members.fetch(),t.emit(s.Events.GUILD_CREATE,n)))}}e.exports=GuildCreateHandler},function(e,t,i){const n=i(1);class GuildDeleteHandler extends n{handle(e){this.packetManager.client.actions.GuildDelete.handle(e.d)}}e.exports=GuildDeleteHandler},function(e,t,i){const n=i(1);class GuildUpdateHandler extends n{handle(e){const t=this.packetManager.client,i=e.d;t.actions.GuildUpdate.handle(i)}}e.exports=GuildUpdateHandler},function(e,t,i){const n=i(1),s=i(0);class GuildBanAddHandler extends n{handle(e){const t=this.packetManager.client,i=e.d,n=t.guilds.get(i.guild_id),r=t.users.get(i.user.id);n&&r&&t.emit(s.Events.GUILD_BAN_ADD,n,r)}}e.exports=GuildBanAddHandler},function(e,t,i){const n=i(1);class GuildBanRemoveHandler extends n{handle(e){const t=this.packetManager.client,i=e.d;t.actions.GuildBanRemove.handle(i)}}e.exports=GuildBanRemoveHandler},function(e,t,i){const n=i(1),s=i(0);class GuildMemberAddHandler extends n{handle(e){const t=this.packetManager.client,i=e.d,n=t.guilds.get(i.guild_id);if(n){n.memberCount++;const e=n.members.create(i);t.ws.connection.status===s.Status.READY&&t.emit(s.Events.GUILD_MEMBER_ADD,e)}}}e.exports=GuildMemberAddHandler},function(e,t,i){const n=i(1);class GuildMemberRemoveHandler extends n{handle(e){const t=this.packetManager.client,i=e.d;t.actions.GuildMemberRemove.handle(i)}}e.exports=GuildMemberRemoveHandler},function(e,t,i){const n=i(1),s=i(0);class GuildMemberUpdateHandler extends n{handle(e){const t=this.packetManager.client,i=e.d,n=t.guilds.get(i.guild_id);if(n){const e=n.members.get(i.user.id);if(e){const n=e._update(i);t.ws.connection.status===s.Status.READY&&t.emit(s.Events.GUILD_MEMBER_UPDATE,n,e)}}}}e.exports=GuildMemberUpdateHandler},function(e,t,i){const n=i(1);class GuildRoleCreateHandler extends n{handle(e){const t=this.packetManager.client,i=e.d;t.actions.GuildRoleCreate.handle(i)}}e.exports=GuildRoleCreateHandler},function(e,t,i){const n=i(1);class GuildRoleDeleteHandler extends n{handle(e){const t=this.packetManager.client,i=e.d;t.actions.GuildRoleDelete.handle(i)}}e.exports=GuildRoleDeleteHandler},function(e,t,i){const n=i(1);class GuildRoleUpdateHandler extends n{handle(e){const t=this.packetManager.client,i=e.d;t.actions.GuildRoleUpdate.handle(i)}}e.exports=GuildRoleUpdateHandler},function(e,t,i){const n=i(1);class GuildEmojisUpdate extends n{handle(e){const t=this.packetManager.client,i=e.d;t.actions.GuildEmojisUpdate.handle(i)}}e.exports=GuildEmojisUpdate},function(e,t,i){const n=i(1),s=i(0),r=i(3);class GuildMembersChunkHandler extends n{handle(e){const t=this.packetManager.client,i=e.d,n=t.guilds.get(i.guild_id);if(!n)return;const o=new r;for(const e of i.members)o.set(e.user.id,n.members.create(e));t.emit(s.Events.GUILD_MEMBERS_CHUNK,o,n),t.ws.lastHeartbeatAck=!0}}e.exports=GuildMembersChunkHandler},function(e,t,i){const n=i(1);class ChannelCreateHandler extends n{handle(e){this.packetManager.client.actions.ChannelCreate.handle(e.d)}}e.exports=ChannelCreateHandler},function(e,t,i){const n=i(1);class ChannelDeleteHandler extends n{handle(e){this.packetManager.client.actions.ChannelDelete.handle(e.d)}}e.exports=ChannelDeleteHandler},function(e,t,i){const n=i(1),s=i(0);class ChannelUpdateHandler extends n{handle(e){const{old:t,updated:i}=this.packetManager.client.actions.ChannelUpdate.handle(e.d);t&&i&&this.packetManager.client.emit(s.Events.CHANNEL_UPDATE,t,i)}}e.exports=ChannelUpdateHandler},function(e,t,i){const n=i(1),s=i(0);class ChannelPinsUpdate extends n{handle(e){const t=this.packetManager.client,i=e.d,n=t.channels.get(i.channel_id),r=new Date(i.last_pin_timestamp);n&&r&&t.emit(s.Events.CHANNEL_PINS_UPDATE,n,r)}}e.exports=ChannelPinsUpdate},function(e,t,i){const n=i(1),s=i(0);class PresenceUpdateHandler extends n{handle(e){const t=this.packetManager.client,i=e.d;let n=t.users.get(i.user.id);const r=t.guilds.get(i.guild_id);if(!n){if(!i.user.username)return;n=t.users.create(i.user)}const o=n._update(i.user);if(n.equals(o)||t.emit(s.Events.USER_UPDATE,o,n),r){let e=r.members.get(n.id);if(e||"offline"===i.status||(e=r.members.create({user:n,roles:i.roles,deaf:!1,mute:!1}),t.emit(s.Events.GUILD_MEMBER_AVAILABLE,e)),e){if(0===t.listenerCount(s.Events.PRESENCE_UPDATE))return void r.presences.create(i);const n=e._clone();e.presence&&(n.frozenPresence=e.presence._clone()),r.presences.create(i),t.emit(s.Events.PRESENCE_UPDATE,n,e)}else r.presences.create(i)}}}e.exports=PresenceUpdateHandler},function(e,t,i){const n=i(1);class UserUpdateHandler extends n{handle(e){const t=this.packetManager.client,i=e.d;t.actions.UserUpdate.handle(i)}}e.exports=UserUpdateHandler},function(e,t,i){const n=i(1);class UserNoteUpdateHandler extends n{handle(e){const t=this.packetManager.client,i=e.d;t.actions.UserNoteUpdate.handle(i)}}e.exports=UserNoteUpdateHandler},function(e,t,i){const n=i(1),s=i(0);class UserSettingsUpdateHandler extends n{handle(e){const t=this.packetManager.client;t.user.settings.patch(e.d),t.emit(s.Events.USER_SETTINGS_UPDATE,t.user.settings)}}e.exports=UserSettingsUpdateHandler},function(e,t,i){const n=i(1),s=i(0),r=i(77);class UserGuildSettingsUpdateHandler extends n{handle(e){const t=this.packetManager.client,i=t.user.guildSettings.get(e.d.guild_id);i?i.patch(e.d):t.user.guildSettings.set(e.d.guild_id,new r(this.client,e.d)),t.emit(s.Events.USER_GUILD_SETTINGS_UPDATE,t.user.guildSettings.get(e.d.guild_id))}}e.exports=UserGuildSettingsUpdateHandler},function(e,t,i){const n=i(1),s=i(0);class VoiceStateUpdateHandler extends n{handle(e){const t=this.packetManager.client,i=e.d,n=t.guilds.get(i.guild_id);if(n){const e=n.members.get(i.user_id);if(e){const r=e._clone();r._frozenVoiceState=r.voiceState,e.user.id===t.user.id&&i.channel_id&&t.emit("self.voiceStateUpdate",i),n.voiceStates.set(e.user.id,i),t.emit(s.Events.VOICE_STATE_UPDATE,r,e)}}}}e.exports=VoiceStateUpdateHandler},function(e,t,i){function n(e,t){return e.client.setTimeout(()=>{e.client.emit(r.Events.TYPING_STOP,e,t,e._typing.get(t.id)),e._typing.delete(t.id)},6e3)}const s=i(1),r=i(0);class TypingStartHandler extends s{handle(e){const t=this.packetManager.client,i=e.d,s=t.channels.get(i.channel_id),o=t.users.get(i.user_id),a=new Date(1e3*i.timestamp);if(s&&o){if("voice"===s.type)return void t.emit(r.Events.WARN,`Discord sent a typing packet to voice channel ${s.id}`);if(s._typing.has(o.id)){const e=s._typing.get(o.id);e.lastTimestamp=a,e.resetTimeout(n(s,o))}else s._typing.set(o.id,new TypingData(t,a,a,n(s,o))),t.emit(r.Events.TYPING_START,s,o)}}}class TypingData{constructor(e,t,i,n){this.client=e,this.since=t,this.lastTimestamp=i,this._timeout=n}resetTimeout(e){this.client.clearTimeout(this._timeout),this._timeout=e}get elapsedTime(){return Date.now()-this.since}}e.exports=TypingStartHandler},function(e,t,i){const n=i(1);class MessageCreateHandler extends n{handle(e){this.packetManager.client.actions.MessageCreate.handle(e.d)}}e.exports=MessageCreateHandler},function(e,t,i){const n=i(1);class MessageDeleteHandler extends n{handle(e){this.packetManager.client.actions.MessageDelete.handle(e.d)}}e.exports=MessageDeleteHandler},function(e,t,i){const n=i(1),s=i(0);class MessageUpdateHandler extends n{handle(e){const{old:t,updated:i}=this.packetManager.client.actions.MessageUpdate.handle(e.d);t&&i&&this.packetManager.client.emit(s.Events.MESSAGE_UPDATE,t,i)}}e.exports=MessageUpdateHandler},function(e,t,i){const n=i(1);class MessageDeleteBulkHandler extends n{handle(e){this.packetManager.client.actions.MessageDeleteBulk.handle(e.d)}}e.exports=MessageDeleteBulkHandler},function(e,t,i){const n=i(1);class VoiceServerUpdate extends n{handle(e){const t=this.packetManager.client,i=e.d;t.emit("self.voiceServer",i)}}e.exports=VoiceServerUpdate},function(e,t,i){const n=i(1);class GuildSyncHandler extends n{handle(e){const t=this.packetManager.client,i=e.d;t.actions.GuildSync.handle(i)}}e.exports=GuildSyncHandler},function(e,t,i){const n=i(1);class RelationshipAddHandler extends n{handle(e){const t=this.packetManager.client,i=e.d;1===i.type?t.users.fetch(i.id).then(e=>{t.user.friends.set(e.id,e)}):2===i.type&&t.users.fetch(i.id).then(e=>{t.user.blocked.set(e.id,e)})}}e.exports=RelationshipAddHandler},function(e,t,i){const n=i(1);class RelationshipRemoveHandler extends n{handle(e){const t=this.packetManager.client,i=e.d;2===i.type?t.user.blocked.has(i.id)&&t.user.blocked.delete(i.id):1===i.type&&t.user.friends.has(i.id)&&t.user.friends.delete(i.id)}}e.exports=RelationshipRemoveHandler},function(e,t,i){const n=i(1),s=i(0);class MessageReactionAddHandler extends n{handle(e){const t=this.packetManager.client,i=e.d,{user:n,reaction:r}=t.actions.MessageReactionAdd.handle(i);r&&t.emit(s.Events.MESSAGE_REACTION_ADD,r,n)}}e.exports=MessageReactionAddHandler},function(e,t,i){const n=i(1);class MessageReactionRemove extends n{handle(e){const t=this.packetManager.client,i=e.d;t.actions.MessageReactionRemove.handle(i)}}e.exports=MessageReactionRemove},function(e,t,i){const n=i(1);class MessageReactionRemoveAll extends n{handle(e){const t=this.packetManager.client,i=e.d;t.actions.MessageReactionRemoveAll.handle(i)}}e.exports=MessageReactionRemoveAll},function(e,t){},function(e,t){},function(e,t){},function(e,t,i){class ActionsManager{constructor(e){this.client=e,this.register(i(179)),this.register(i(180)),this.register(i(181)),this.register(i(182)),this.register(i(183)),this.register(i(184)),this.register(i(185)),this.register(i(186)),this.register(i(187)),this.register(i(188)),this.register(i(189)),this.register(i(190)),this.register(i(191)),this.register(i(192)),this.register(i(193)),this.register(i(194)),this.register(i(195)),this.register(i(196)),this.register(i(197)),this.register(i(198)),this.register(i(199)),this.register(i(200)),this.register(i(201)),this.register(i(202)),this.register(i(203)),this.register(i(204)),this.register(i(205)),this.register(i(206))}register(e){this[e.name.replace(/Action$/,"")]=new e(this.client)}}e.exports=ActionsManager},function(e,t,i){const n=i(2),s=i(0);class MessageCreateAction extends n{handle(e){const t=this.client,i=t.channels.get(e.channel_id),n=t.users.get(e.author.id);if(i){const r=i.messages.get(e.id);if(r)return{message:r};const o=i.guild?i.guild.member(n):null,a=i.messages.create(e);return i.lastMessageID=e.id,i.lastMessage=a,n&&(n.lastMessageID=e.id,n.lastMessage=a),o&&(o.lastMessageID=e.id,o.lastMessage=a),t.emit(s.Events.MESSAGE_CREATE,a),{message:a}}return{}}}e.exports=MessageCreateAction},function(e,t,i){const n=i(2),s=i(0);class MessageDeleteAction extends n{handle(e){const t=this.client,i=t.channels.get(e.channel_id);let n;return i&&(n=i.messages.get(e.id))&&(i.messages.delete(n.id),t.emit(s.Events.MESSAGE_DELETE,n)),{message:n}}}e.exports=MessageDeleteAction},function(e,t,i){const n=i(2),s=i(3),r=i(0);class MessageDeleteBulkAction extends n{handle(e){const t=this.client,i=t.channels.get(e.channel_id);if(i){const n=e.ids,o=new s;for(const e of n){const t=i.messages.get(e);t&&o.set(t.id,t)}return o.size>0&&t.emit(r.Events.MESSAGE_BULK_DELETE,o),{messages:o}}return{}}}e.exports=MessageDeleteBulkAction},function(e,t,i){const n=i(2);class MessageUpdateAction extends n{handle(e){const t=this.client.channels.get(e.channel_id);if(t){const i=t.messages.get(e.id);if(i)return i.patch(e),{old:i._edits[0],updated:i}}return{}}}e.exports=MessageUpdateAction},function(e,t,i){const n=i(2);class MessageReactionAdd extends n{handle(e){const t=e.user||this.client.users.get(e.user_id);if(!t)return!1;const i=e.channel||this.client.channels.get(e.channel_id);if(!i||"voice"===i.type)return!1;const n=e.message||i.messages.get(e.message_id);if(!n)return!1;if(!e.emoji)return!1;const s=n.reactions.create({emoji:e.emoji,count:0,me:t.id===this.client.user.id});return s._add(t),{message:n,reaction:s,user:t}}}e.exports=MessageReactionAdd},function(e,t,i){const n=i(2),s=i(0);class MessageReactionRemove extends n{handle(e){const t=this.client.users.get(e.user_id);if(!t)return!1;const i=this.client.channels.get(e.channel_id);if(!i||"voice"===i.type)return!1;const n=i.messages.get(e.message_id);if(!n)return!1;if(!e.emoji)return!1;const r=e.emoji.id||decodeURIComponent(e.emoji.name),o=n.reactions.get(r);return!!o&&(o._remove(t),this.client.emit(s.Events.MESSAGE_REACTION_REMOVE,o,t),{message:n,reaction:o,user:t})}}e.exports=MessageReactionRemove},function(e,t,i){const n=i(2),s=i(0);class MessageReactionRemoveAll extends n{handle(e){const t=this.client.channels.get(e.channel_id);if(!t||"voice"===t.type)return!1;const i=t.messages.get(e.message_id);return!!i&&(i.reactions.clear(),this.client.emit(s.Events.MESSAGE_REACTION_REMOVE_ALL,i),{message:i})}}e.exports=MessageReactionRemoveAll},function(e,t,i){const n=i(2),s=i(0);class ChannelCreateAction extends n{handle(e){const t=this.client,i=t.channels.has(e.id),n=t.channels.create(e);return!i&&n&&t.emit(s.Events.CHANNEL_CREATE,n),{channel:n}}}e.exports=ChannelCreateAction},function(e,t,i){const n=i(2),s=i(0);class ChannelDeleteAction extends n{constructor(e){super(e),this.deleted=new Map}handle(e){const t=this.client;let i=t.channels.get(e.id);return i&&(t.channels.remove(i.id),t.emit(s.Events.CHANNEL_DELETE,i)),{channel:i}}}e.exports=ChannelDeleteAction},function(e,t,i){const n=i(2);class ChannelUpdateAction extends n{handle(e){const t=this.client.channels.get(e.id);return t?{old:t._update(e),updated:t}:{}}}e.exports=ChannelUpdateAction},function(e,t,i){const n=i(2),s=i(0);class GuildDeleteAction extends n{constructor(e){super(e),this.deleted=new Map}handle(e){const t=this.client;let i=t.guilds.get(e.id);if(i){for(const e of i.channels.values())"text"===e.type&&e.stopTyping(!0);if(i.available&&e.unavailable)return i.available=!1,t.emit(s.Events.GUILD_UNAVAILABLE,i),{guild:null};t.guilds.remove(i.id),t.emit(s.Events.GUILD_DELETE,i),this.deleted.set(i.id,i),this.scheduleForDeletion(i.id)}else i=this.deleted.get(e.id)||null;return{guild:i}}scheduleForDeletion(e){this.client.setTimeout(()=>this.deleted.delete(e),this.client.options.restWsBridgeTimeout)}}e.exports=GuildDeleteAction},function(e,t,i){const n=i(2),s=i(0);class GuildUpdateAction extends n{handle(e){const t=this.client,i=t.guilds.get(e.id);if(i){const n=i._update(e);return t.emit(s.Events.GUILD_UPDATE,n,i),{old:n,updated:i}}return{old:null,updated:null}}}e.exports=GuildUpdateAction},function(e,t,i){const n=i(2);class GuildMemberGetAction extends n{handle(e,t){return{member:e.members.create(t)}}}e.exports=GuildMemberGetAction},function(e,t,i){const n=i(2),s=i(0);class GuildMemberRemoveAction extends n{handle(e){const t=this.client,i=t.guilds.get(e.guild_id);let n=null;return i&&(n=i.members.get(e.user.id))&&(i.memberCount--,i.members.remove(n.id),t.status===s.Status.READY&&t.emit(s.Events.GUILD_MEMBER_REMOVE,n)),{guild:i,member:n}}}e.exports=GuildMemberRemoveAction},function(e,t,i){const n=i(2),s=i(0);class GuildBanRemove extends n{handle(e){const t=this.client,i=t.guilds.get(e.guild_id),n=t.users.create(e.user);i&&n&&t.emit(s.Events.GUILD_BAN_REMOVE,i,n)}}e.exports=GuildBanRemove},function(e,t,i){const n=i(2),s=i(0);class GuildRoleCreate extends n{handle(e){const t=this.client,i=t.guilds.get(e.guild_id);let n;if(i){const r=i.roles.has(e.role.id);n=i.roles.create(e.role),r||t.emit(s.Events.GUILD_ROLE_CREATE,n)}return{role:n}}}e.exports=GuildRoleCreate},function(e,t,i){const n=i(2),s=i(0);class GuildRoleDeleteAction extends n{handle(e){const t=this.client,i=t.guilds.get(e.guild_id);let n;return i&&(n=i.roles.get(e.role_id))&&(i.roles.remove(e.role_id),t.emit(s.Events.GUILD_ROLE_DELETE,n)),{role:n}}}e.exports=GuildRoleDeleteAction},function(e,t,i){const n=i(2),s=i(0);class GuildRoleUpdateAction extends n{handle(e){const t=this.client,i=t.guilds.get(e.guild_id);if(i){let n=null;const r=i.roles.get(e.role.id);return r&&(n=r._update(e.role),t.emit(s.Events.GUILD_ROLE_UPDATE,n,r)),{old:n,updated:r}}return{old:null,updated:null}}}e.exports=GuildRoleUpdateAction},function(e,t,i){const n=i(2);class UserGetAction extends n{handle(e){return{user:this.client.users.create(e)}}}e.exports=UserGetAction},function(e,t,i){const n=i(2),s=i(0);class UserUpdateAction extends n{handle(e){const t=this.client;if(t.user){if(t.user.equals(e))return{old:t.user,updated:t.user};const i=t.user._update(e);return t.emit(s.Events.USER_UPDATE,i,t.user),{old:i,updated:t.user}}return{old:null,updated:null}}}e.exports=UserUpdateAction},function(e,t,i){const n=i(2),s=i(0);class UserNoteUpdateAction extends n{handle(e){const t=this.client,i=t.user.notes.get(e.id),n=e.note.length?e.note:null;return t.user.notes.set(e.id,n),t.emit(s.Events.USER_NOTE_UPDATE,e.id,i,n),{old:i,updated:n}}}e.exports=UserNoteUpdateAction},function(e,t,i){const n=i(2);class GuildSync extends n{handle(e){const t=this.client.guilds.get(e.id);if(t){if(e.presences)for(const i of e.presences)t.presences.create(i);if(e.members)for(const i of e.members){const e=t.members.get(i.user.id);e?e._patch(i):t.members.create(i,!1)}"large"in e&&(t.large=e.large)}}}e.exports=GuildSync},function(e,t,i){const n=i(2),s=i(0);class GuildEmojiCreateAction extends n{handle(e,t){const i=e.emojis.create(t);return this.client.emit(s.Events.GUILD_EMOJI_CREATE,i),{emoji:i}}}e.exports=GuildEmojiCreateAction},function(e,t,i){const n=i(2),s=i(0);class GuildEmojiDeleteAction extends n{handle(e){return e.guild.emojis.remove(e.id),this.client.emit(s.Events.GUILD_EMOJI_DELETE,e),{emoji:e}}}e.exports=GuildEmojiDeleteAction},function(e,t,i){const n=i(2),s=i(0);class GuildEmojiUpdateAction extends n{handle(e,t){const i=e._update(t);return this.client.emit(s.Events.GUILD_EMOJI_UPDATE,i,e),{emoji:e}}}e.exports=GuildEmojiUpdateAction},function(e,t,i){function n(e){const t=new Map;for(const i of e)t.set(...i);return t}const s=i(2);class GuildEmojisUpdateAction extends s{handle(e){const t=this.client.guilds.get(e.guild_id);if(!t||!t.emojis)return;const i=n(t.emojis.entries());for(const n of e.emojis){const e=t.emojis.get(n.id);e?(i.delete(n.id),e.equals(n,!0)||this.client.actions.GuildEmojiUpdate.handle(e,n)):this.client.actions.GuildEmojiCreate.handle(t,n)}for(const e of i.values())this.client.actions.GuildEmojiDelete.handle(e)}}e.exports=GuildEmojisUpdateAction},function(e,t,i){const n=i(2);class GuildRolesPositionUpdate extends n{handle(e){const t=this.client.guilds.get(e.guild_id);if(t)for(const i of e.roles){const e=t.roles.get(i.id);e&&(e.position=i.position)}return{guild:t}}}e.exports=GuildRolesPositionUpdate},function(e,t,i){const n=i(2);class GuildChannelsPositionUpdate extends n{handle(e){const t=this.client.guilds.get(e.guild_id);if(t)for(const i of e.channels){const e=t.channels.get(i.id);e&&(e.position=i.position)}return{guild:t}}}e.exports=GuildChannelsPositionUpdate},function(e,t){},function(e,t){},function(e,t,i){const n=i(11),s=i(32),r=i(18),o=i(44);class UserStore extends n{constructor(e,t){super(e,t,s)}resolve(e){return e instanceof r?e.user:e instanceof o?e.author:super.resolve(e)}resolveID(e){return e instanceof r?e.user.id:e instanceof o?e.author.id:super.resolveID(e)}fetch(e,t=!0){const i=this.get(e);return i?Promise.resolve(i):this.client.api.users(e).get().then(e=>this.create(e,t))}}e.exports=UserStore},function(e,t,i){const n=i(11),s=i(17),r=i(0),o=Symbol("LRU"),a=["group","dm"];class ChannelStore extends n{constructor(e,t={},i){if(i||"function"==typeof t[Symbol.iterator]||(i=t,t=void 0),super(e,t,s),i.lru){const e=this[o]=[];e.add=(t=>{for(e.remove(t),e.unshift(t);e.length>i.lru;)this.remove(e[e.length-1])}),e.remove=(t=>{const i=e.indexOf(t);i>-1&&e.splice(i,1)})}}get(e,t=!1){const i=super.get(e);return i&&a.includes(i.type)?(!t&&this[o]&&this[o].add(e),i):i}set(e,t){return this[o]&&a.includes(t.type)&&this[o].add(e),super.set(e,t)}delete(e){const t=this.get(e,!0);return!!t&&(this[o]&&a.includes(t.type)&&this[o].remove(e),super.delete(e))}create(e,t,i=!0){const n=this.get(e.id);if(n)return n;const o=s.create(this.client,e,t);return o?(i&&this.set(o.id,o),o):(this.client.emit(r.Events.DEBUG,`Failed to find guild for channel ${e.id} ${e.type}`),null)}remove(e){const t=this.get(e);t.guild&&t.guild.channels.remove(e),super.remove(e)}}e.exports=ChannelStore},function(e,t,i){const n=i(11),s=i(35);class GuildStore extends n{constructor(e,t){super(e,t,s)}}e.exports=GuildStore},function(e,t,i){const n=i(75),s=i(3),r=i(0),{Presence:o}=i(19),{TypeError:a}=i(4);class ClientPresenceStore extends n{constructor(...e){super(...e),this.clientPresence=new o(this.client,{status:"online",afk:!1,since:null,activity:null})}async setClientPresence({status:e,since:t,afk:i,activity:n}){const o=n&&(n.application?n.application.id||n.application:null);let c=new s;if(n){if("string"!=typeof n.name)throw new a("INVALID_TYPE","name","string");if(n.type||(n.type=0),n.assets&&o)try{const e=await this.client.api.oauth2.applications(o).assets.get();for(const t of e)c.set(t.name,t.id)}catch(e){}}const l={afk:null!=i&&i,since:null!=t?t:null,status:e||this.clientPresence.status,game:n?{type:"number"==typeof n.type?n.type:r.ActivityTypes.indexOf(n.type),name:n.name,url:n.url,details:n.details||void 0,state:n.state||void 0,assets:n.assets?{large_text:n.assets.largeText||void 0,small_text:n.assets.smallText||void 0,large_image:c.get(n.assets.largeImage)||n.assets.largeImage,small_image:c.get(n.assets.smallImage)||n.assets.smallImage}:void 0,timestamps:n.timestamps||void 0,party:n.party||void 0,application_id:o||void 0,secrets:n.secrets||void 0,instance:n.instance||void 0}:null};return this.clientPresence.patch(l),this.client.ws.send({op:r.OPCodes.STATUS_UPDATE,d:l}),this.clientPresence}}e.exports=ClientPresenceStore},function(e,t){},function(e,t){},function(e,t){},function(e,t,i){const n=i(22),s=i(41);class WebhookClient extends s{constructor(e,t,i){super(i),Object.defineProperty(this,"client",{value:this}),this.id=e,this.token=t}}n.applyToClass(WebhookClient),e.exports=WebhookClient}]); \ No newline at end of file