From a8087692a293e750fbb6355d66c62cf5e2793a5b Mon Sep 17 00:00:00 2001 From: Travis CI Date: Sun, 29 Oct 2017 14:00:35 +0000 Subject: [PATCH] Webpack build for branch master: 29a81eab733f91c2574979e5b2b3e62163abe9de --- discord.master.js | 2807 ++++++++++++++++++++--------------------- discord.master.min.js | 2 +- 2 files changed, 1363 insertions(+), 1446 deletions(-) diff --git a/discord.master.js b/discord.master.js index fe802b32..638732d9 100644 --- a/discord.master.js +++ b/discord.master.js @@ -61,14 +61,14 @@ window["Discord"] = /******/ __webpack_require__.p = ""; /******/ /******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = 74); +/******/ return __webpack_require__(__webpack_require__.s = 75); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ /***/ (function(module, exports, __webpack_require__) { -const Package = exports.Package = __webpack_require__(40); +const Package = exports.Package = __webpack_require__(41); const { Error, RangeError } = __webpack_require__(4); const browser = exports.browser = typeof window !== 'undefined'; @@ -1268,16 +1268,16 @@ module.exports = Collection; /* 4 */ /***/ (function(module, exports, __webpack_require__) { -module.exports = __webpack_require__(41); -module.exports.Messages = __webpack_require__(81); +module.exports = __webpack_require__(42); +module.exports.Messages = __webpack_require__(82); /***/ }), /* 5 */ /***/ (function(module, exports, __webpack_require__) { -const Long = __webpack_require__(26); -const snekfetch = __webpack_require__(27); +const Long = __webpack_require__(27); +const snekfetch = __webpack_require__(28); const { Colors, DefaultOptions, Endpoints } = __webpack_require__(0); const { Error: DiscordError, RangeError, TypeError } = __webpack_require__(4); const has = (o, k) => Object.prototype.hasOwnProperty.call(o, k); @@ -1692,7 +1692,7 @@ module.exports = DataStore; /* 8 */ /***/ (function(module, exports, __webpack_require__) { -const Long = __webpack_require__(26); +const Long = __webpack_require__(27); // Discord epoch (2015-01-01T00:00:00.000Z) const EPOCH = 1420070400000; @@ -1775,7 +1775,7 @@ module.exports = SnowflakeUtil; const path = __webpack_require__(49); const fs = __webpack_require__(49); -const snekfetch = __webpack_require__(27); +const snekfetch = __webpack_require__(28); const Util = __webpack_require__(5); const { Error, TypeError } = __webpack_require__(4); const { browser } = __webpack_require__(0); @@ -2326,7 +2326,7 @@ module.exports = Channel; /***/ (function(module, exports, __webpack_require__) { const TextBasedChannel = __webpack_require__(18); -const Role = __webpack_require__(23); +const Role = __webpack_require__(22); const Permissions = __webpack_require__(10); const Collection = __webpack_require__(3); const Base = __webpack_require__(6); @@ -3089,343 +3089,199 @@ exports.RichPresenceAssets = RichPresenceAssets; /* 15 */ /***/ (function(module, exports, __webpack_require__) { -const MessageAttachment = __webpack_require__(20); -const Util = __webpack_require__(5); -const { RangeError } = __webpack_require__(4); +const DataResolver = __webpack_require__(9); +const { createMessage } = __webpack_require__(21); /** - * Represents an embed in a message (image/video preview, rich embed, etc.) + * Represents a webhook. */ -class MessageEmbed { - constructor(data = {}) { - this.setup(data); - } - - setup(data) { // eslint-disable-line complexity +class Webhook { + constructor(client, data) { /** - * The type of this embed - * @type {string} - */ - this.type = data.type; - - /** - * The title of this embed - * @type {?string} - */ - this.title = data.title; - - /** - * The description of this embed - * @type {?string} - */ - this.description = data.description; - - /** - * The URL of this embed - * @type {?string} - */ - this.url = data.url; - - /** - * The color of the embed - * @type {?number} - */ - this.color = data.color; - - /** - * The timestamp of this embed - * @type {?number} - */ - this.timestamp = data.timestamp ? new Date(data.timestamp).getTime() : null; - - /** - * The fields of this embed - * @type {Object[]} - * @property {string} name The name of this field - * @property {string} value The value of this field - * @property {boolean} inline If this field will be displayed inline - */ - this.fields = data.fields ? data.fields.map(Util.cloneObject) : []; - - /** - * The thumbnail of this embed (if there is one) - * @type {?Object} - * @property {string} url URL for this thumbnail - * @property {string} proxyURL ProxyURL for this thumbnail - * @property {number} height Height of this thumbnail - * @property {number} width Width of this thumbnail - */ - this.thumbnail = data.thumbnail ? { - url: data.thumbnail.url, - proxyURL: data.thumbnail.proxy_url, - height: data.height, - width: data.width, - } : null; - - /** - * The image of this embed, if there is one - * @type {?Object} - * @property {string} url URL for this image - * @property {string} proxyURL ProxyURL for this image - * @property {number} height Height of this image - * @property {number} width Width of this image - */ - this.image = data.image ? { - url: data.image.url, - proxyURL: data.image.proxy_url, - height: data.height, - width: data.width, - } : null; - - /** - * The video of this embed (if there is one) - * @type {?Object} - * @property {string} url URL of this video - * @property {number} height Height of this video - * @property {number} width Width of this video + * The client that instantiated the webhook + * @name Webhook#client + * @type {Client} * @readonly */ - this.video = data.video; + 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 author of this embed (if there is one) - * @type {?Object} - * @property {string} name The name of this author - * @property {string} url URL of this author - * @property {string} iconURL URL of the icon for this author - * @property {string} proxyIconURL Proxied URL of the icon for this author + * The token for the webhook + * @type {string} */ - this.author = data.author ? { - name: data.author.name, - url: data.author.url, - iconURL: data.author.iconURL || data.author.icon_url, - proxyIconURL: data.author.proxyIconUrl || data.author.proxy_icon_url, - } : null; + this.token = data.token; /** - * The provider of this embed (if there is one) - * @type {?Object} - * @property {string} name The name of this provider - * @property {string} url URL of this provider + * The avatar for the webhook + * @type {?string} */ - this.provider = data.provider; + this.avatar = data.avatar; /** - * The footer of this embed - * @type {?Object} - * @property {string} text The text of this footer - * @property {string} iconURL URL of the icon for this footer - * @property {string} proxyIconURL Proxied URL of the icon for this footer + * The ID of the webhook + * @type {Snowflake} */ - this.footer = data.footer ? { - text: data.footer.text, - iconURL: data.footer.iconURL || data.footer.icon_url, - proxyIconURL: data.footer.proxyIconURL || data.footer.proxy_icon_url, - } : null; + this.id = data.id; - if (data.files) { + /** + * 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 files of this embed - * @type {?Object} - * @property {Array} files Files to attach + * The owner of the webhook + * @type {?User|Object} */ - this.files = data.files.map(file => { - if (file instanceof MessageAttachment) { - return typeof file.file === 'string' ? file.file : Util.cloneObject(file.file); - } - return file; - }); + this.owner = this.client.users ? this.client.users.get(data.user.id) : data.user; + } else { + this.owner = null; } } /** - * The date this embed was created at - * @type {?Date} - * @readonly + * 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[]|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. */ - get createdAt() { - return this.timestamp ? new Date(this.timestamp) : null; - } + /* eslint-disable max-len */ /** - * The hexadecimal version of the embed color, with a leading hash - * @type {?string} - * @readonly + * Sends 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); */ - get hexColor() { - return this.color ? `#${this.color.toString(16).padStart(6, '0')}` : null; - } - - /** - * Adds a field to the embed (max 25). - * @param {StringResolvable} name The name of the field - * @param {StringResolvable} value The value of the field - * @param {boolean} [inline=false] Set the field to display inline - * @returns {MessageEmbed} - */ - addField(name, value, inline = false) { - if (this.fields.length >= 25) throw new RangeError('EMBED_FIELD_COUNT'); - name = Util.resolveString(name); - if (!String(name) || name.length > 256) throw new RangeError('EMBED_FIELD_NAME'); - value = Util.resolveString(value); - if (!String(value) || value.length > 1024) throw new RangeError('EMBED_FIELD_VALUE'); - this.fields.push({ name, value, inline }); - return this; - } - - /** - * Convenience function for `.addField('\u200B', '\u200B', inline)`. - * @param {boolean} [inline=false] Set the field to display inline - * @returns {MessageEmbed} - */ - addBlankField(inline = false) { - return this.addField('\u200B', '\u200B', inline); - } - - /** - * Sets the file to upload alongside the embed. This file can be accessed via `attachment://fileName.extension` when - * setting an embed image or author/footer icons. Only one file may be attached. - * @param {Array} files Files to attach - * @returns {MessageEmbed} - */ - attachFiles(files) { - if (this.files) this.files = this.files.concat(files); - else this.files = files; - for (let file of files) { - if (file instanceof MessageAttachment) file = file.file; + /* eslint-enable max-len */ + async send(content, options) { // eslint-disable-line complexity + if (!options && typeof content === 'object' && !(content instanceof Array)) { + options = content; + content = null; + } else if (!options) { + options = {}; } - return this; + if (!options.content) options.content = content; + + const { data, files } = await createMessage(this, options); + + return this.client.api.webhooks(this.id, this.token).post({ + data, files, + query: { wait: true }, + auth: false, + }).then(d => { + if (!this.client.channels) return d; + return this.client.channels.get(d.channel_id).messages.create(d, false); + }); } /** - * Sets the author of this embed. - * @param {StringResolvable} name The name of the author - * @param {string} [iconURL] The icon URL of the author - * @param {string} [url] The URL of the author - * @returns {MessageEmbed} + * Sends 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); */ - setAuthor(name, iconURL, url) { - this.author = { name: Util.resolveString(name), iconURL, url }; - return this; + 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); + }); } /** - * Sets the color of this embed. - * @param {ColorResolvable} color The color of the embed - * @returns {MessageEmbed} + * Edits 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 {ChannelResolvable} [options.channel] New channel for this webhook + * @param {string} [reason] Reason for editing this webhook + * @returns {Promise} */ - setColor(color) { - this.color = Util.resolveColor(color); - return this; + edit({ name = this.name, avatar, channel }, reason) { + if (avatar && (typeof avatar === 'string' && !avatar.startsWith('data:'))) { + return DataResolver.resolveImage(avatar).then(image => this.edit({ name, avatar: image }, reason)); + } + if (channel) channel = this.client.channels.resolveID(channel); + return this.client.api.webhooks(this.id, channel ? undefined : this.token).patch({ + data: { name, avatar, channel_id: channel }, + reason, + }).then(data => { + this.name = data.name; + this.avatar = data.avatar; + this.channelID = data.channel_id; + return this; + }); } /** - * Sets the description of this embed. - * @param {StringResolvable} description The description - * @returns {MessageEmbed} + * Deletes the webhook. + * @param {string} [reason] Reason for deleting this webhook + * @returns {Promise} */ - setDescription(description) { - description = Util.resolveString(description); - if (description.length > 2048) throw new RangeError('EMBED_DESCRIPTION'); - this.description = description; - return this; + delete(reason) { + return this.client.api.webhooks(this.id, this.token).delete({ reason }); } - /** - * Sets the footer of this embed. - * @param {StringResolvable} text The text of the footer - * @param {string} [iconURL] The icon URL of the footer - * @returns {MessageEmbed} - */ - setFooter(text, iconURL) { - text = Util.resolveString(text); - if (text.length > 2048) throw new RangeError('EMBED_FOOTER_TEXT'); - this.footer = { text, iconURL }; - return this; - } - - /** - * Sets the image of this embed. - * @param {string} url The URL of the image - * @returns {MessageEmbed} - */ - setImage(url) { - this.image = { url }; - return this; - } - - /** - * Sets the thumbnail of this embed. - * @param {string} url The URL of the thumbnail - * @returns {MessageEmbed} - */ - setThumbnail(url) { - this.thumbnail = { url }; - return this; - } - - /** - * Sets the timestamp of this embed. - * @param {Date} [timestamp=current date] The timestamp - * @returns {MessageEmbed} - */ - setTimestamp(timestamp = new Date()) { - this.timestamp = timestamp.getTime(); - return this; - } - - /** - * Sets the title of this embed. - * @param {StringResolvable} title The title - * @returns {MessageEmbed} - */ - setTitle(title) { - title = Util.resolveString(title); - if (title.length > 256) throw new RangeError('EMBED_TITLE'); - this.title = title; - return this; - } - - /** - * Sets the URL of this embed. - * @param {string} url The URL - * @returns {MessageEmbed} - */ - setURL(url) { - this.url = url; - return this; - } - - /** - * Transforms the embed object to be processed. - * @returns {Object} The raw data of this embed - * @private - */ - _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, - 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, - }; + static applyToClass(structure) { + for (const prop of [ + 'send', + 'sendSlackMessage', + 'edit', + 'delete', + ]) { + Object.defineProperty(structure.prototype, prop, + Object.getOwnPropertyDescriptor(Webhook.prototype, prop)); + } } } -module.exports = MessageEmbed; +module.exports = Webhook; /***/ }), @@ -3433,8 +3289,8 @@ module.exports = MessageEmbed; /***/ (function(module, exports, __webpack_require__) { const Channel = __webpack_require__(12); -const Role = __webpack_require__(23); -const Invite = __webpack_require__(24); +const Role = __webpack_require__(22); +const Invite = __webpack_require__(25); const PermissionOverwrites = __webpack_require__(53); const Util = __webpack_require__(5); const Permissions = __webpack_require__(10); @@ -3942,309 +3798,284 @@ module.exports = GuildChannel; /* 17 */ /***/ (function(module, exports, __webpack_require__) { -const Util = __webpack_require__(5); -const DataResolver = __webpack_require__(9); -const Embed = __webpack_require__(15); -const MessageAttachment = __webpack_require__(20); -const MessageEmbed = __webpack_require__(15); -const { browser } = __webpack_require__(0); +const TextBasedChannel = __webpack_require__(18); +const { Presence } = __webpack_require__(14); +const UserProfile = __webpack_require__(101); +const Snowflake = __webpack_require__(8); +const Base = __webpack_require__(6); +const { Error } = __webpack_require__(4); /** - * Represents a webhook. + * Represents a user on Discord. + * @implements {TextBasedChannel} + * @extends {Base} */ -class Webhook { +class User extends Base { 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; + super(client); /** - * 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 + * The ID of the user * @type {Snowflake} */ this.id = data.id; /** - * The guild the webhook belongs to - * @type {Snowflake} + * Whether or not the user is a bot + * @type {boolean} + * @name User#bot */ - this.guildID = data.guild_id; + this.bot = Boolean(data.bot); + + this._patch(data); + } + + _patch(data) { + /** + * The username of the user + * @type {string} + * @name User#username + */ + if (data.username) this.username = data.username; /** - * The channel the webhook belongs to - * @type {Snowflake} + * A discriminator based on username for the user + * @type {string} + * @name User#discriminator */ - this.channelID = data.channel_id; + if (data.discriminator) this.discriminator = data.discriminator; - 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; - } + /** + * The ID of the user's avatar + * @type {?string} + * @name User#avatar + */ + if (typeof data.avatar !== 'undefined') this.avatar = data.avatar; + + /** + * 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; } /** - * 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[]|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. + * The timestamp the user was created at + * @type {number} + * @readonly */ + get createdTimestamp() { + return Snowflake.deconstruct(this.id).timestamp; + } - /* eslint-disable max-len */ /** - * Sends a message with this webhook. - * @param {StringResolvable} [content] The content to send - * @param {WebhookMessageOptions|MessageEmbed|MessageAttachment|MessageAttachment[]} [options={}] The options to provide - * @returns {Promise} + * The time the user was created at + * @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(this.client); + } + + /** + * 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" (e.g. `hydrabolt#0086`) 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; + } + + /** + * Checks 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); + } + + /** + * Gets 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; + } + + /** + * Gets 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); + } + + /** + * Gets 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 returns the user's mention instead of the User object. + * @returns {string} * @example - * // Send a message - * webhook.send('hello!') - * .then(message => console.log(`Sent message: ${message.content}`)) - * .catch(console.error); + * // Logs: Hello from <@123456789012345678>! + * console.log(`Hello from ${user}!`); */ - /* 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' || (!browser && Buffer.isBuffer(file))) file = { attachment: file }; - if (!file.name) { - if (typeof file.attachment === 'string') { - file.name = Util.basename(file.attachment); - } else if (file.attachment && file.attachment.path) { - file.name = Util.basename(file.attachment.path); - } else if (file instanceof MessageAttachment) { - file = { attachment: file.file, name: Util.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).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); - }); + toString() { + return `<@${this.id}>`; } - /** - * Sends 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); - }); - } - - /** - * Edits 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 {ChannelResolvable} [options.channel] New channel for this webhook - * @param {string} [reason] Reason for editing this webhook - * @returns {Promise} - */ - edit({ name = this.name, avatar, channel }, reason) { - if (avatar && (typeof avatar === 'string' && !avatar.startsWith('data:'))) { - return DataResolver.resolveImage(avatar).then(image => this.edit({ name, avatar: image }, reason)); - } - if (channel) channel = this.client.channels.resolveID(channel); - return this.client.api.webhooks(this.id, channel ? undefined : this.token).patch({ - data: { name, avatar, channel_id: channel }, - reason, - }).then(data => { - this.name = data.name; - this.avatar = data.avatar; - this.channelID = data.channel_id; - return this; - }); - } - - /** - * Deletes 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)); - } - } + // These are here only for documentation purposes - they are implemented by TextBasedChannel + /* eslint-disable no-empty-function */ + send() {} } -module.exports = Webhook; +TextBasedChannel.applyToClass(User); + +module.exports = User; /***/ }), /* 18 */ /***/ (function(module, exports, __webpack_require__) { -const MessageCollector = __webpack_require__(44); -const Shared = __webpack_require__(45); -const Util = __webpack_require__(5); -const { browser } = __webpack_require__(0); +const MessageCollector = __webpack_require__(45); +const Shared = __webpack_require__(21); const Snowflake = __webpack_require__(8); const Collection = __webpack_require__(3); -const DataResolver = __webpack_require__(9); -const MessageAttachment = __webpack_require__(20); -const MessageEmbed = __webpack_require__(15); const { RangeError, TypeError } = __webpack_require__(4); /** @@ -4318,61 +4149,12 @@ class TextBasedChannel { send(content, options) { // eslint-disable-line complexity if (!options && typeof content === 'object' && !(content instanceof Array)) { options = content; - content = ''; + content = null; } 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' || (!browser && Buffer.isBuffer(file))) file = { attachment: file }; - if (!file.name) { - if (typeof file.attachment === 'string') { - file.name = Util.basename(file.attachment); - } else if (file.attachment && file.attachment.path) { - file.name = Util.basename(file.attachment.path); - } else if (file instanceof MessageAttachment) { - file = { attachment: file.file, name: Util.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).then(resource => { - file.file = resource; - return file; - }) - )).then(files => { - options.files = files; - return Shared.sendMessage(this, options); - }); - } - return Shared.sendMessage(this, options); } @@ -4396,26 +4178,45 @@ class TextBasedChannel { /** * Starts a typing indicator in the channel. - * @param {number} [count] The number of times startTyping should be considered to have been called + * @param {number} [count=1] The number of times startTyping should be considered to have been called + * @returns {Promise} Resolves once the bot stops typing gracefully, or rejects when an error occurs * @example - * // Start typing in a channel + * // Start typing in a channel, or increase the typing count by one * channel.startTyping(); + * @example + * // Start typing in a channel with a typing count of five, or set it to five + * channel.startTyping(5); */ 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 { + if (this.client.user._typing.has(this.id)) { const entry = this.client.user._typing.get(this.id); entry.count = count || entry.count + 1; + return entry.promise; } + + const entry = {}; + entry.promise = new Promise((resolve, reject) => { + const endpoint = this.client.api.channels[this.id].typing; + Object.assign(entry, { + count: count || 1, + interval: this.client.setInterval(() => { + endpoint.post().catch(error => { + this.client.clearInterval(entry.interval); + this.client.user._typing.delete(this.id); + reject(error); + }); + }, 9000), + resolve, + }); + endpoint.post().catch(error => { + this.client.clearInterval(entry.interval); + this.client.user._typing.delete(this.id); + reject(error); + }); + this.client.user._typing.set(this.id, entry); + }); + return entry.promise; } /** @@ -4424,10 +4225,10 @@ class TextBasedChannel { * 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 + * // Reduce the typing count by one and stop typing if it reached 0 * channel.stopTyping(); * @example - * // Force typing to fully stop in a channel + * // Force typing to fully stop regardless of typing count * channel.stopTyping(true); */ stopTyping(force = false) { @@ -4437,6 +4238,7 @@ class TextBasedChannel { if (entry.count <= 0 || force) { this.client.clearInterval(entry.interval); this.client.user._typing.delete(this.id); + entry.resolve(); } } } @@ -4601,7 +4403,7 @@ const MessageStore = __webpack_require__(19); const DataStore = __webpack_require__(7); const Collection = __webpack_require__(3); -const Message = __webpack_require__(31); +const Message = __webpack_require__(32); const { Error } = __webpack_require__(4); /** @@ -4724,125 +4526,6 @@ module.exports = MessageStore; /* 20 */ /***/ (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; - } - - /** - * Sets 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; - } - - /** - * Sets the file of this attachment. - * @param {BufferResolvable|Stream} attachment The file - * @returns {MessageAttachment} This attachment - */ - setFile(attachment) { - this.file = { attachment }; - return this; - } - - /** - * Sets 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; - } - - /** - * Sets 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; - - -/***/ }), -/* 21 */ -/***/ (function(module, exports) { - // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -5148,281 +4831,18 @@ function isUndefined(arg) { /***/ }), -/* 22 */ +/* 21 */ /***/ (function(module, exports, __webpack_require__) { -const TextBasedChannel = __webpack_require__(18); -const { Presence } = __webpack_require__(14); -const UserProfile = __webpack_require__(100); -const Snowflake = __webpack_require__(8); -const Base = __webpack_require__(6); -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; - - /** - * Whether or not the user is a bot - * @type {boolean} - * @name User#bot - */ - this.bot = Boolean(data.bot); - - 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; - - /** - * 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; - } - - /** - * The timestamp the user was created at - * @type {number} - * @readonly - */ - get createdTimestamp() { - return Snowflake.deconstruct(this.id).timestamp; - } - - /** - * The time the user was created at - * @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(this.client); - } - - /** - * 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" (e.g. `hydrabolt#0086`) 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; - } - - /** - * Checks 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); - } - - /** - * Gets 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; - } - - /** - * Gets 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); - } - - /** - * Gets 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 returns the user's mention instead of the User object. - * @returns {string} - * @example - * // Logs: Hello from <@123456789012345678>! - * 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; +module.exports = { + search: __webpack_require__(98), + sendMessage: __webpack_require__(100), + createMessage: __webpack_require__(60), +}; /***/ }), -/* 23 */ +/* 22 */ /***/ (function(module, exports, __webpack_require__) { const Snowflake = __webpack_require__(8); @@ -5786,10 +5206,472 @@ class Role extends Base { module.exports = Role; +/***/ }), +/* 23 */ +/***/ (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; + } + + /** + * Sets 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; + } + + /** + * Sets the file of this attachment. + * @param {BufferResolvable|Stream} attachment The file + * @returns {MessageAttachment} This attachment + */ + setFile(attachment) { + this.file = { attachment }; + return this; + } + + /** + * Sets 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; + } + + /** + * Sets 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; + + /***/ }), /* 24 */ /***/ (function(module, exports, __webpack_require__) { +const MessageAttachment = __webpack_require__(23); +const Util = __webpack_require__(5); +const { RangeError } = __webpack_require__(4); + +/** + * Represents an embed in a message (image/video preview, rich embed, etc.) + */ +class MessageEmbed { + constructor(data = {}) { + this.setup(data); + } + + setup(data) { // eslint-disable-line complexity + /** + * The type of this embed + * @type {string} + */ + this.type = data.type; + + /** + * The title of this embed + * @type {?string} + */ + this.title = data.title; + + /** + * The description of this embed + * @type {?string} + */ + this.description = data.description; + + /** + * The URL of this embed + * @type {?string} + */ + this.url = data.url; + + /** + * The color of the embed + * @type {?number} + */ + this.color = data.color; + + /** + * The timestamp of this embed + * @type {?number} + */ + this.timestamp = data.timestamp ? new Date(data.timestamp).getTime() : null; + + /** + * The fields of this embed + * @type {Object[]} + * @property {string} name The name of this field + * @property {string} value The value of this field + * @property {boolean} inline If this field will be displayed inline + */ + this.fields = data.fields ? data.fields.map(Util.cloneObject) : []; + + /** + * The thumbnail of this embed (if there is one) + * @type {?Object} + * @property {string} url URL for this thumbnail + * @property {string} proxyURL ProxyURL for this thumbnail + * @property {number} height Height of this thumbnail + * @property {number} width Width of this thumbnail + */ + this.thumbnail = data.thumbnail ? { + url: data.thumbnail.url, + proxyURL: data.thumbnail.proxy_url, + height: data.height, + width: data.width, + } : null; + + /** + * The image of this embed, if there is one + * @type {?Object} + * @property {string} url URL for this image + * @property {string} proxyURL ProxyURL for this image + * @property {number} height Height of this image + * @property {number} width Width of this image + */ + this.image = data.image ? { + url: data.image.url, + proxyURL: data.image.proxy_url, + height: data.height, + width: data.width, + } : null; + + /** + * The video of this embed (if there is one) + * @type {?Object} + * @property {string} url URL of this video + * @property {number} height Height of this video + * @property {number} width Width of this video + * @readonly + */ + this.video = data.video; + + /** + * The author of this embed (if there is one) + * @type {?Object} + * @property {string} name The name of this author + * @property {string} url URL of this author + * @property {string} iconURL URL of the icon for this author + * @property {string} proxyIconURL Proxied URL of the icon for this author + */ + this.author = data.author ? { + name: data.author.name, + url: data.author.url, + iconURL: data.author.iconURL || data.author.icon_url, + proxyIconURL: data.author.proxyIconUrl || data.author.proxy_icon_url, + } : null; + + /** + * The provider of this embed (if there is one) + * @type {?Object} + * @property {string} name The name of this provider + * @property {string} url URL of this provider + */ + this.provider = data.provider; + + /** + * The footer of this embed + * @type {?Object} + * @property {string} text The text of this footer + * @property {string} iconURL URL of the icon for this footer + * @property {string} proxyIconURL Proxied URL of the icon for this footer + */ + this.footer = data.footer ? { + text: data.footer.text, + iconURL: data.footer.iconURL || data.footer.icon_url, + proxyIconURL: data.footer.proxyIconURL || data.footer.proxy_icon_url, + } : null; + + if (data.files) { + /** + * The files of this embed + * @type {?Object} + * @property {Array} files Files to attach + */ + this.files = data.files.map(file => { + if (file instanceof MessageAttachment) { + return typeof file.file === 'string' ? file.file : Util.cloneObject(file.file); + } + return file; + }); + } + } + + /** + * The date this embed was created at + * @type {?Date} + * @readonly + */ + get createdAt() { + return this.timestamp ? new Date(this.timestamp) : null; + } + + /** + * The hexadecimal version of the embed color, with a leading hash + * @type {?string} + * @readonly + */ + get hexColor() { + return this.color ? `#${this.color.toString(16).padStart(6, '0')}` : null; + } + + /** + * Adds a field to the embed (max 25). + * @param {StringResolvable} name The name of the field + * @param {StringResolvable} value The value of the field + * @param {boolean} [inline=false] Set the field to display inline + * @returns {MessageEmbed} + */ + addField(name, value, inline = false) { + if (this.fields.length >= 25) throw new RangeError('EMBED_FIELD_COUNT'); + name = Util.resolveString(name); + if (!String(name) || name.length > 256) throw new RangeError('EMBED_FIELD_NAME'); + value = Util.resolveString(value); + if (!String(value) || value.length > 1024) throw new RangeError('EMBED_FIELD_VALUE'); + this.fields.push({ name, value, inline }); + return this; + } + + /** + * Convenience function for `.addField('\u200B', '\u200B', inline)`. + * @param {boolean} [inline=false] Set the field to display inline + * @returns {MessageEmbed} + */ + addBlankField(inline = false) { + return this.addField('\u200B', '\u200B', inline); + } + + /** + * Sets the file to upload alongside the embed. This file can be accessed via `attachment://fileName.extension` when + * setting an embed image or author/footer icons. Only one file may be attached. + * @param {Array} files Files to attach + * @returns {MessageEmbed} + */ + attachFiles(files) { + if (this.files) this.files = this.files.concat(files); + else this.files = files; + for (let file of files) { + if (file instanceof MessageAttachment) file = file.file; + } + return this; + } + + /** + * Sets the author of this embed. + * @param {StringResolvable} name The name of the author + * @param {string} [iconURL] The icon URL of the author + * @param {string} [url] The URL of the author + * @returns {MessageEmbed} + */ + setAuthor(name, iconURL, url) { + this.author = { name: Util.resolveString(name), iconURL, url }; + return this; + } + + /** + * Sets the color of this embed. + * @param {ColorResolvable} color The color of the embed + * @returns {MessageEmbed} + */ + setColor(color) { + this.color = Util.resolveColor(color); + return this; + } + + /** + * Sets the description of this embed. + * @param {StringResolvable} description The description + * @returns {MessageEmbed} + */ + setDescription(description) { + description = Util.resolveString(description); + if (description.length > 2048) throw new RangeError('EMBED_DESCRIPTION'); + this.description = description; + return this; + } + + /** + * Sets the footer of this embed. + * @param {StringResolvable} text The text of the footer + * @param {string} [iconURL] The icon URL of the footer + * @returns {MessageEmbed} + */ + setFooter(text, iconURL) { + text = Util.resolveString(text); + if (text.length > 2048) throw new RangeError('EMBED_FOOTER_TEXT'); + this.footer = { text, iconURL }; + return this; + } + + /** + * Sets the image of this embed. + * @param {string} url The URL of the image + * @returns {MessageEmbed} + */ + setImage(url) { + this.image = { url }; + return this; + } + + /** + * Sets the thumbnail of this embed. + * @param {string} url The URL of the thumbnail + * @returns {MessageEmbed} + */ + setThumbnail(url) { + this.thumbnail = { url }; + return this; + } + + /** + * Sets the timestamp of this embed. + * @param {Date} [timestamp=current date] The timestamp + * @returns {MessageEmbed} + */ + setTimestamp(timestamp = new Date()) { + this.timestamp = timestamp.getTime(); + return this; + } + + /** + * Sets the title of this embed. + * @param {StringResolvable} title The title + * @returns {MessageEmbed} + */ + setTitle(title) { + title = Util.resolveString(title); + if (title.length > 256) throw new RangeError('EMBED_TITLE'); + this.title = title; + return this; + } + + /** + * Sets the URL of this embed. + * @param {string} url The URL + * @returns {MessageEmbed} + */ + setURL(url) { + this.url = url; + return this; + } + + /** + * Transforms the embed object to be processed. + * @returns {Object} The raw data of this embed + * @private + */ + _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, + 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, + }; + } +} + +module.exports = MessageEmbed; + + +/***/ }), +/* 25 */ +/***/ (function(module, exports, __webpack_require__) { + const { Endpoints } = __webpack_require__(0); const Base = __webpack_require__(6); @@ -5947,26 +5829,26 @@ module.exports = Invite; /***/ }), -/* 25 */ +/* 26 */ /***/ (function(module, exports, __webpack_require__) { -const Invite = __webpack_require__(24); +const Invite = __webpack_require__(25); const GuildAuditLogs = __webpack_require__(56); -const Webhook = __webpack_require__(17); +const Webhook = __webpack_require__(15); const GuildMember = __webpack_require__(13); -const VoiceRegion = __webpack_require__(35); +const VoiceRegion = __webpack_require__(36); const { ChannelTypes, Events, browser } = __webpack_require__(0); const Collection = __webpack_require__(3); const Util = __webpack_require__(5); const DataResolver = __webpack_require__(9); const Snowflake = __webpack_require__(8); const Permissions = __webpack_require__(10); -const Shared = __webpack_require__(45); +const Shared = __webpack_require__(21); const GuildMemberStore = __webpack_require__(57); const RoleStore = __webpack_require__(58); -const EmojiStore = __webpack_require__(36); +const EmojiStore = __webpack_require__(37); const GuildChannelStore = __webpack_require__(59); -const PresenceStore = __webpack_require__(37); +const PresenceStore = __webpack_require__(38); const Base = __webpack_require__(6); const { Error, TypeError } = __webpack_require__(4); @@ -7133,7 +7015,7 @@ module.exports = Guild; /***/ }), -/* 26 */ +/* 27 */ /***/ (function(module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* @@ -8350,30 +8232,30 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ }); -/***/ }), -/* 27 */ -/***/ (function(module, exports, __webpack_require__) { - -module.exports = __webpack_require__(75); - - /***/ }), /* 28 */ /***/ (function(module, exports, __webpack_require__) { -"use strict"; - - -exports.decode = exports.parse = __webpack_require__(76); -exports.encode = exports.stringify = __webpack_require__(77); +module.exports = __webpack_require__(76); /***/ }), /* 29 */ /***/ (function(module, exports, __webpack_require__) { -const EventEmitter = __webpack_require__(21); -const RESTManager = __webpack_require__(82); +"use strict"; + + +exports.decode = exports.parse = __webpack_require__(77); +exports.encode = exports.stringify = __webpack_require__(78); + + +/***/ }), +/* 30 */ +/***/ (function(module, exports, __webpack_require__) { + +const EventEmitter = __webpack_require__(20); +const RESTManager = __webpack_require__(83); const Util = __webpack_require__(5); const { DefaultOptions } = __webpack_require__(0); @@ -8484,11 +8366,11 @@ module.exports = BaseClient; /***/ }), -/* 30 */ +/* 31 */ /***/ (function(module, exports, __webpack_require__) { const Collection = __webpack_require__(3); -const EventEmitter = __webpack_require__(21); +const EventEmitter = __webpack_require__(20); /** * Filter to be applied to the collector. @@ -8698,22 +8580,22 @@ module.exports = Collector; /***/ }), -/* 31 */ +/* 32 */ /***/ (function(module, exports, __webpack_require__) { const Mentions = __webpack_require__(47); -const MessageAttachment = __webpack_require__(20); -const Embed = __webpack_require__(15); +const MessageAttachment = __webpack_require__(23); +const Embed = __webpack_require__(24); const ReactionCollector = __webpack_require__(48); -const ClientApplication = __webpack_require__(32); +const ClientApplication = __webpack_require__(33); const Util = __webpack_require__(5); const Collection = __webpack_require__(3); -const ReactionStore = __webpack_require__(98); +const ReactionStore = __webpack_require__(99); const { MessageTypes } = __webpack_require__(0); const Permissions = __webpack_require__(10); -const GuildMember = __webpack_require__(13); const Base = __webpack_require__(6); const { Error, TypeError } = __webpack_require__(4); +const { createMessage } = __webpack_require__(21); /** * Represents a message on Discord. @@ -9071,41 +8953,22 @@ class Message extends Base { * .then(msg => console.log(`Updated the content of a message from ${msg.author}`)) * .catch(console.error); */ - edit(content, options) { + async edit(content, options) { if (!options && typeof content === 'object' && !(content instanceof Array)) { options = content; - content = ''; + content = null; } else if (!options) { options = {}; } - if (options instanceof Embed) options = { embed: options }; + if (!options.content) options.content = content; - if (typeof options.content !== 'undefined') content = options.content; - - if (typeof content !== 'undefined') content = Util.resolveString(content); - - let { embed, code, reply } = options; - - if (embed) embed = new Embed(embed)._apiTransform(); - - // Wrap everything in a code block - if (typeof code !== 'undefined' && (typeof code !== 'boolean' || code === true)) { - content = Util.escapeMarkdown(Util.resolveString(content), true); - content = `\`\`\`${typeof code !== 'boolean' ? code || '' : ''}\n${content}\n\`\`\``; - } - - // Add the reply prefix - if (reply && this.channel.type !== 'dm') { - const id = this.client.users.resolveID(reply); - const mention = `<@${reply instanceof GuildMember && reply.nickname ? '!' : ''}${id}>`; - content = `${mention}${content ? `, ${content}` : ''}`; - } + const { data, files } = await createMessage(this, options); return this.client.api.channels[this.channel.id].messages[this.id] - .patch({ data: { content, embed } }) - .then(data => { + .patch({ data, files }) + .then(d => { const clone = this._clone(); - clone._patch(data); + clone._patch(d); return clone; }); } @@ -9276,7 +9139,7 @@ module.exports = Message; /***/ }), -/* 32 */ +/* 33 */ /***/ (function(module, exports, __webpack_require__) { const Snowflake = __webpack_require__(8); @@ -9492,7 +9355,7 @@ module.exports = ClientApplication; /***/ }), -/* 33 */ +/* 34 */ /***/ (function(module, exports, __webpack_require__) { const Collection = __webpack_require__(3); @@ -9736,7 +9599,7 @@ module.exports = Emoji; /***/ }), -/* 34 */ +/* 35 */ /***/ (function(module, exports) { /** @@ -9792,7 +9655,7 @@ module.exports = ReactionEmoji; /***/ }), -/* 35 */ +/* 36 */ /***/ (function(module, exports) { /** @@ -9848,12 +9711,12 @@ module.exports = VoiceRegion; /***/ }), -/* 36 */ +/* 37 */ /***/ (function(module, exports, __webpack_require__) { const DataStore = __webpack_require__(7); -const Emoji = __webpack_require__(33); -const ReactionEmoji = __webpack_require__(34); +const Emoji = __webpack_require__(34); +const ReactionEmoji = __webpack_require__(35); /** * Stores emojis. @@ -9925,7 +9788,7 @@ module.exports = EmojiStore; /***/ }), -/* 37 */ +/* 38 */ /***/ (function(module, exports, __webpack_require__) { const DataStore = __webpack_require__(7); @@ -9983,12 +9846,12 @@ module.exports = PresenceStore; /***/ }), -/* 38 */ +/* 39 */ /***/ (function(module, exports, __webpack_require__) { const { UserGuildSettingsMap } = __webpack_require__(0); const Collection = __webpack_require__(3); -const ClientUserChannelOverride = __webpack_require__(62); +const ClientUserChannelOverride = __webpack_require__(63); /** * A wrapper around the ClientUser's guild settings. @@ -10049,7 +9912,7 @@ module.exports = ClientUserGuildSettings; /***/ }), -/* 39 */ +/* 40 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -10088,13 +9951,13 @@ module.exports = { /***/ }), -/* 40 */ +/* 41 */ /***/ (function(module, exports) { module.exports = ({"version":"12.0.0-dev","homepage":"https://github.com/hydrabolt/discord.js#readme"}) /***/ }), -/* 41 */ +/* 42 */ /***/ (function(module, exports) { // Heavily inspired by node's `internal/errors` module @@ -10159,7 +10022,7 @@ module.exports = { /***/ }), -/* 42 */ +/* 43 */ /***/ (function(module, exports) { /** @@ -10219,17 +10082,17 @@ module.exports = DiscordAPIError; /***/ }), -/* 43 */ +/* 44 */ /***/ (function(module, exports, __webpack_require__) { -const User = __webpack_require__(22); +const User = __webpack_require__(17); const Collection = __webpack_require__(3); -const ClientUserSettings = __webpack_require__(61); -const ClientUserGuildSettings = __webpack_require__(38); +const ClientUserSettings = __webpack_require__(62); +const ClientUserGuildSettings = __webpack_require__(39); const { Events } = __webpack_require__(0); const Util = __webpack_require__(5); const DataResolver = __webpack_require__(9); -const Guild = __webpack_require__(25); +const Guild = __webpack_require__(26); /** * Represents the logged in client's Discord user. @@ -10558,10 +10421,10 @@ module.exports = ClientUser; /***/ }), -/* 44 */ +/* 45 */ /***/ (function(module, exports, __webpack_require__) { -const Collector = __webpack_require__(30); +const Collector = __webpack_require__(31); const { Events } = __webpack_require__(0); /** @@ -10650,16 +10513,6 @@ class MessageCollector extends Collector { module.exports = MessageCollector; -/***/ }), -/* 45 */ -/***/ (function(module, exports, __webpack_require__) { - -module.exports = { - search: __webpack_require__(97), - sendMessage: __webpack_require__(99), -}; - - /***/ }), /* 46 */ /***/ (function(module, exports, __webpack_require__) { @@ -10894,7 +10747,7 @@ module.exports = MessageMentions; /* 48 */ /***/ (function(module, exports, __webpack_require__) { -const Collector = __webpack_require__(30); +const Collector = __webpack_require__(31); const Collection = __webpack_require__(3); const { Events } = __webpack_require__(0); @@ -11023,8 +10876,8 @@ module.exports = ReactionCollector; /***/ (function(module, exports, __webpack_require__) { const Collection = __webpack_require__(3); -const Emoji = __webpack_require__(33); -const ReactionEmoji = __webpack_require__(34); +const Emoji = __webpack_require__(34); +const ReactionEmoji = __webpack_require__(35); const { Error } = __webpack_require__(4); /** @@ -11389,7 +11242,7 @@ module.exports = GroupDMChannel; /***/ (function(module, exports, __webpack_require__) { const GuildChannel = __webpack_require__(16); -const Webhook = __webpack_require__(17); +const Webhook = __webpack_require__(15); const TextBasedChannel = __webpack_require__(18); const Collection = __webpack_require__(3); const DataResolver = __webpack_require__(9); @@ -11733,7 +11586,7 @@ module.exports = CategoryChannel; const Collection = __webpack_require__(3); const Snowflake = __webpack_require__(8); -const Webhook = __webpack_require__(17); +const Webhook = __webpack_require__(15); /** * The target type of an entry, e.g. `GUILD`. Here are the available types: @@ -12269,7 +12122,7 @@ module.exports = GuildMemberStore; /***/ (function(module, exports, __webpack_require__) { const DataStore = __webpack_require__(7); -const Role = __webpack_require__(23); +const Role = __webpack_require__(22); /** * Stores roles. @@ -12372,6 +12225,123 @@ module.exports = GuildChannelStore; /***/ }), /* 60 */ +/***/ (function(module, exports, __webpack_require__) { + +const Embed = __webpack_require__(24); +const DataResolver = __webpack_require__(9); +const MessageEmbed = __webpack_require__(24); +const MessageAttachment = __webpack_require__(23); +const { browser } = __webpack_require__(0); +const Util = __webpack_require__(5); + +// eslint-disable-next-line complexity +module.exports = async function createMessage(channel, options) { + const User = __webpack_require__(17); + const GuildMember = __webpack_require__(13); + const Webhook = __webpack_require__(15); + + const webhook = channel instanceof Webhook; + + if (typeof options.nonce !== 'undefined') { + options.nonce = parseInt(options.nonce); + if (isNaN(options.nonce) || options.nonce < 0) throw new RangeError('MESSAGE_NONCE_TYPE'); + } + + if (options instanceof MessageEmbed) options = webhook ? { embeds: [options] } : { embed: options }; + if (options instanceof MessageAttachment) options = { files: [options.file] }; + + if (options.reply && !(channel instanceof User || channel instanceof GuildMember) && channel.type !== 'dm') { + const id = channel.client.users.resolveID(options.reply); + const mention = `<@${options.reply instanceof GuildMember && options.reply.nickname ? '!' : ''}${id}>`; + if (options.split) options.split.prepend = `${mention}, ${options.split.prepend || ''}`; + options.content = `${mention}${typeof options.content !== 'undefined' ? `, ${options.content}` : ''}`; + } + + if (options.content) { + options.content = Util.resolveString(options.content); + if (options.split && typeof options.split !== 'object') options.split = {}; + // Wrap everything in a code block + if (typeof options.code !== 'undefined' && (typeof options.code !== 'boolean' || options.code === true)) { + options.content = Util.escapeMarkdown(options.content, true); + options.content = + `\`\`\`${typeof options.code !== 'boolean' ? options.code || '' : ''}\n${options.content}\n\`\`\``; + if (options.split) { + options.split.prepend = `\`\`\`${typeof options.code !== 'boolean' ? options.code || '' : ''}\n`; + options.split.append = '\n```'; + } + } + + // Add zero-width spaces to @everyone/@here + if (options.disableEveryone || + (typeof options.disableEveryone === 'undefined' && channel.client.options.disableEveryone)) { + options.content = options.content.replace(/@(everyone|here)/g, '@\u200b$1'); + } + + if (options.split) options.content = Util.splitMessage(options.content, options.split); + } + + 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.embed && webhook) options.embeds = [new Embed(options.embed)._apiTransform()]; + else if (options.embed) options.embed = new Embed(options.embed)._apiTransform(); + else if (options.embeds) options.embeds = options.embeds.map(e => new Embed(e)._apiTransform()); + + let files; + + if (options.files) { + for (let i = 0; i < options.files.length; i++) { + let file = options.files[i]; + if (typeof file === 'string' || (!browser && Buffer.isBuffer(file))) file = { attachment: file }; + if (!file.name) { + if (typeof file.attachment === 'string') { + file.name = Util.basename(file.attachment); + } else if (file.attachment && file.attachment.path) { + file.name = Util.basename(file.attachment.path); + } else if (file instanceof MessageAttachment) { + file = { attachment: file.file, name: Util.basename(file.file) || 'file.jpg' }; + } else { + file.name = 'file.jpg'; + } + } else if (file instanceof MessageAttachment) { + file = file.file; + } + options.files[i] = file; + } + + files = await Promise.all(options.files.map(file => + DataResolver.resolveFile(file.attachment).then(resource => { + file.file = resource; + return file; + }) + )); + delete options.files; + } + + if (webhook) { + if (!options.username) options.username = this.name; + if (options.avatarURL) { + options.avatar_url = options.avatarURL; + options.avatarURL = null; + } + } + + return { data: { + content: options.content, + tts: options.tts, + nonce: options.nonce, + embed: options.embed, + embeds: options.embeds, + username: options.username, + avatar_url: options.avatarURL, + }, files }; +}; + + +/***/ }), +/* 61 */ /***/ (function(module, exports) { /** @@ -12425,7 +12395,7 @@ module.exports = UserConnection; /***/ }), -/* 61 */ +/* 62 */ /***/ (function(module, exports, __webpack_require__) { const { UserSettingsMap } = __webpack_require__(0); @@ -12511,7 +12481,7 @@ module.exports = ClientUserSettings; /***/ }), -/* 62 */ +/* 63 */ /***/ (function(module, exports, __webpack_require__) { const { UserChannelOverrideMap } = __webpack_require__(0); @@ -12545,13 +12515,13 @@ module.exports = ClientUserChannelOverride; /***/ }), -/* 63 */ +/* 64 */ /***/ (function(module, exports, __webpack_require__) { const { browser } = __webpack_require__(0); -const querystring = __webpack_require__(28); +const querystring = __webpack_require__(29); try { - var erlpack = __webpack_require__(137); + var erlpack = __webpack_require__(138); if (!erlpack.pack) erlpack = null; } catch (err) {} // eslint-disable-line no-empty @@ -12559,9 +12529,9 @@ if (browser) { exports.WebSocket = window.WebSocket; // eslint-disable-line no-undef } else { try { - exports.WebSocket = __webpack_require__(138); - } catch (err) { exports.WebSocket = __webpack_require__(139); + } catch (err) { + exports.WebSocket = __webpack_require__(140); } } @@ -12588,7 +12558,7 @@ for (const state of ['CONNECTING', 'OPEN', 'CLOSING', 'CLOSED']) exports[state] /***/ }), -/* 64 */ +/* 65 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -12597,9 +12567,9 @@ for (const state of ['CONNECTING', 'OPEN', 'CLOSING', 'CLOSED']) exports[state] var assign = __webpack_require__(11).assign; -var deflate = __webpack_require__(141); -var inflate = __webpack_require__(144); -var constants = __webpack_require__(69); +var deflate = __webpack_require__(142); +var inflate = __webpack_require__(145); +var constants = __webpack_require__(70); var pako = {}; @@ -12609,7 +12579,7 @@ module.exports = pako; /***/ }), -/* 65 */ +/* 66 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -12667,7 +12637,7 @@ module.exports = adler32; /***/ }), -/* 66 */ +/* 67 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -12733,7 +12703,7 @@ module.exports = crc32; /***/ }), -/* 67 */ +/* 68 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -12925,7 +12895,7 @@ exports.utf8border = function (buf, max) { /***/ }), -/* 68 */ +/* 69 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -12979,7 +12949,7 @@ module.exports = ZStream; /***/ }), -/* 69 */ +/* 70 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -13054,13 +13024,13 @@ module.exports = { /***/ }), -/* 70 */ +/* 71 */ /***/ (function(module, exports, __webpack_require__) { const DataStore = __webpack_require__(7); -const User = __webpack_require__(22); +const User = __webpack_require__(17); const GuildMember = __webpack_require__(13); -const Message = __webpack_require__(31); +const Message = __webpack_require__(32); /** * A data store to store User models. @@ -13121,7 +13091,7 @@ module.exports = UserStore; /***/ }), -/* 71 */ +/* 72 */ /***/ (function(module, exports, __webpack_require__) { const DataStore = __webpack_require__(7); @@ -13229,11 +13199,11 @@ module.exports = ChannelStore; /***/ }), -/* 72 */ +/* 73 */ /***/ (function(module, exports, __webpack_require__) { const DataStore = __webpack_require__(7); -const Guild = __webpack_require__(25); +const Guild = __webpack_require__(26); /** * Stores guilds. @@ -13275,10 +13245,10 @@ module.exports = GuildStore; /***/ }), -/* 73 */ +/* 74 */ /***/ (function(module, exports, __webpack_require__) { -const PresenceStore = __webpack_require__(37); +const PresenceStore = __webpack_require__(38); const Collection = __webpack_require__(3); const { ActivityTypes, OPCodes } = __webpack_require__(0); const { Presence } = __webpack_require__(14); @@ -13348,44 +13318,44 @@ module.exports = ClientPresenceStore; /***/ }), -/* 74 */ +/* 75 */ /***/ (function(module, exports, __webpack_require__) { const Util = __webpack_require__(5); module.exports = { // "Root" classes (starting points) - BaseClient: __webpack_require__(29), - Client: __webpack_require__(90), - Shard: __webpack_require__(178), - ShardClientUtil: __webpack_require__(179), - ShardingManager: __webpack_require__(180), - WebhookClient: __webpack_require__(181), + BaseClient: __webpack_require__(30), + Client: __webpack_require__(91), + Shard: __webpack_require__(179), + ShardClientUtil: __webpack_require__(180), + ShardingManager: __webpack_require__(181), + WebhookClient: __webpack_require__(182), // Utilities Collection: __webpack_require__(3), Constants: __webpack_require__(0), DataResolver: __webpack_require__(9), DataStore: __webpack_require__(7), - DiscordAPIError: __webpack_require__(42), + DiscordAPIError: __webpack_require__(43), Permissions: __webpack_require__(10), Snowflake: __webpack_require__(8), SnowflakeUtil: __webpack_require__(8), Util: Util, util: Util, - version: __webpack_require__(40).version, + version: __webpack_require__(41).version, // Stores - ChannelStore: __webpack_require__(71), - ClientPresenceStore: __webpack_require__(73), - EmojiStore: __webpack_require__(36), + ChannelStore: __webpack_require__(72), + ClientPresenceStore: __webpack_require__(74), + EmojiStore: __webpack_require__(37), GuildChannelStore: __webpack_require__(59), GuildMemberStore: __webpack_require__(57), - GuildStore: __webpack_require__(72), + GuildStore: __webpack_require__(73), MessageStore: __webpack_require__(19), - PresenceStore: __webpack_require__(37), + PresenceStore: __webpack_require__(38), RoleStore: __webpack_require__(58), - UserStore: __webpack_require__(70), + UserStore: __webpack_require__(71), // Shortcuts to Util methods escapeMarkdown: Util.escapeMarkdown, @@ -13397,51 +13367,51 @@ module.exports = { Activity: __webpack_require__(14).Activity, CategoryChannel: __webpack_require__(55), Channel: __webpack_require__(12), - ClientApplication: __webpack_require__(32), - ClientUser: __webpack_require__(43), - ClientUserChannelOverride: __webpack_require__(62), - ClientUserGuildSettings: __webpack_require__(38), - ClientUserSettings: __webpack_require__(61), - Collector: __webpack_require__(30), + ClientApplication: __webpack_require__(33), + ClientUser: __webpack_require__(44), + ClientUserChannelOverride: __webpack_require__(63), + ClientUserGuildSettings: __webpack_require__(39), + ClientUserSettings: __webpack_require__(62), + Collector: __webpack_require__(31), DMChannel: __webpack_require__(46), - Emoji: __webpack_require__(33), + Emoji: __webpack_require__(34), GroupDMChannel: __webpack_require__(51), - Guild: __webpack_require__(25), + Guild: __webpack_require__(26), GuildAuditLogs: __webpack_require__(56), GuildChannel: __webpack_require__(16), GuildMember: __webpack_require__(13), - Invite: __webpack_require__(24), - Message: __webpack_require__(31), - MessageAttachment: __webpack_require__(20), - MessageCollector: __webpack_require__(44), - MessageEmbed: __webpack_require__(15), + Invite: __webpack_require__(25), + Message: __webpack_require__(32), + MessageAttachment: __webpack_require__(23), + MessageCollector: __webpack_require__(45), + MessageEmbed: __webpack_require__(24), MessageMentions: __webpack_require__(47), MessageReaction: __webpack_require__(50), PermissionOverwrites: __webpack_require__(53), Presence: __webpack_require__(14).Presence, ReactionCollector: __webpack_require__(48), - ReactionEmoji: __webpack_require__(34), + ReactionEmoji: __webpack_require__(35), RichPresenceAssets: __webpack_require__(14).RichPresenceAssets, - Role: __webpack_require__(23), + Role: __webpack_require__(22), TextChannel: __webpack_require__(52), - User: __webpack_require__(22), - UserConnection: __webpack_require__(60), + User: __webpack_require__(17), + UserConnection: __webpack_require__(61), VoiceChannel: __webpack_require__(54), - VoiceRegion: __webpack_require__(35), - Webhook: __webpack_require__(17), + VoiceRegion: __webpack_require__(36), + Webhook: __webpack_require__(15), - WebSocket: __webpack_require__(63), + WebSocket: __webpack_require__(64), }; /***/ }), -/* 75 */ +/* 76 */ /***/ (function(module, exports, __webpack_require__) { const browser = typeof window !== 'undefined'; -const querystring = __webpack_require__(28); -const Package = __webpack_require__(78); -const transport = browser ? __webpack_require__(79) : __webpack_require__(80); +const querystring = __webpack_require__(29); +const Package = __webpack_require__(79); +const transport = browser ? __webpack_require__(80) : __webpack_require__(81); /** * Snekfetch @@ -13700,7 +13670,7 @@ module.exports = Snekfetch; /***/ }), -/* 76 */ +/* 77 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -13791,7 +13761,7 @@ var isArray = Array.isArray || function (xs) { /***/ }), -/* 77 */ +/* 78 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -13883,13 +13853,13 @@ var objectKeys = Object.keys || function (obj) { /***/ }), -/* 78 */ +/* 79 */ /***/ (function(module, exports) { module.exports = ({"name":"snekfetch","homepage":"https://github.com/devsnek/snekfetch"}) /***/ }), -/* 79 */ +/* 80 */ /***/ (function(module, exports) { function buildRequest(method, url) { @@ -13932,16 +13902,16 @@ module.exports = { /***/ }), -/* 80 */ +/* 81 */ /***/ (function(module, exports) { /* (ignored) */ /***/ }), -/* 81 */ +/* 82 */ /***/ (function(module, exports, __webpack_require__) { -const { register } = __webpack_require__(41); +const { register } = __webpack_require__(42); const Messages = { CLIENT_INVALID_OPTION: (prop, must) => `The ${prop} option must be ${must}`, @@ -14041,12 +14011,12 @@ for (const [name, message] of Object.entries(Messages)) register(name, message); /***/ }), -/* 82 */ +/* 83 */ /***/ (function(module, exports, __webpack_require__) { -const handlers = __webpack_require__(83); -const APIRequest = __webpack_require__(87); -const routeBuilder = __webpack_require__(89); +const handlers = __webpack_require__(84); +const APIRequest = __webpack_require__(88); +const routeBuilder = __webpack_require__(90); const { Error } = __webpack_require__(4); const { Endpoints } = __webpack_require__(0); @@ -14122,18 +14092,18 @@ module.exports = RESTManager; /***/ }), -/* 83 */ +/* 84 */ /***/ (function(module, exports, __webpack_require__) { module.exports = { - sequential: __webpack_require__(84), - burst: __webpack_require__(85), - RequestHandler: __webpack_require__(86), + sequential: __webpack_require__(85), + burst: __webpack_require__(86), + RequestHandler: __webpack_require__(87), }; /***/ }), -/* 84 */ +/* 85 */ /***/ (function(module, exports) { module.exports = function sequential() { @@ -14155,7 +14125,7 @@ module.exports = function sequential() { /***/ }), -/* 85 */ +/* 86 */ /***/ (function(module, exports) { module.exports = function burst() { @@ -14174,10 +14144,10 @@ module.exports = function burst() { /***/ }), -/* 86 */ +/* 87 */ /***/ (function(module, exports, __webpack_require__) { -const DiscordAPIError = __webpack_require__(42); +const DiscordAPIError = __webpack_require__(43); const { Events: { RATE_LIMIT } } = __webpack_require__(0); class RequestHandler { @@ -14276,12 +14246,12 @@ module.exports = RequestHandler; /***/ }), -/* 87 */ +/* 88 */ /***/ (function(module, exports, __webpack_require__) { -const querystring = __webpack_require__(28); -const snekfetch = __webpack_require__(27); -const https = __webpack_require__(88); +const querystring = __webpack_require__(29); +const snekfetch = __webpack_require__(28); +const https = __webpack_require__(89); const { browser, UserAgent } = __webpack_require__(0); if (https.Agent) var agent = new https.Agent({ keepAlive: true }); @@ -14326,13 +14296,13 @@ module.exports = APIRequest; /***/ }), -/* 88 */ +/* 89 */ /***/ (function(module, exports) { /* (ignored) */ /***/ }), -/* 89 */ +/* 90 */ /***/ (function(module, exports) { const noop = () => {}; // eslint-disable-line no-empty-function @@ -14371,27 +14341,27 @@ module.exports = buildRoute; /***/ }), -/* 90 */ +/* 91 */ /***/ (function(module, exports, __webpack_require__) { -const BaseClient = __webpack_require__(29); +const BaseClient = __webpack_require__(30); const Permissions = __webpack_require__(10); -const ClientManager = __webpack_require__(91); -const ClientVoiceManager = __webpack_require__(92); -const WebSocketManager = __webpack_require__(93); -const ActionsManager = __webpack_require__(149); +const ClientManager = __webpack_require__(92); +const ClientVoiceManager = __webpack_require__(93); +const WebSocketManager = __webpack_require__(94); +const ActionsManager = __webpack_require__(150); const Collection = __webpack_require__(3); -const VoiceRegion = __webpack_require__(35); -const Webhook = __webpack_require__(17); -const Invite = __webpack_require__(24); -const ClientApplication = __webpack_require__(32); -const ShardClientUtil = __webpack_require__(176); -const VoiceBroadcast = __webpack_require__(177); -const UserStore = __webpack_require__(70); -const ChannelStore = __webpack_require__(71); -const GuildStore = __webpack_require__(72); -const ClientPresenceStore = __webpack_require__(73); -const EmojiStore = __webpack_require__(36); +const VoiceRegion = __webpack_require__(36); +const Webhook = __webpack_require__(15); +const Invite = __webpack_require__(25); +const ClientApplication = __webpack_require__(33); +const ShardClientUtil = __webpack_require__(177); +const VoiceBroadcast = __webpack_require__(178); +const UserStore = __webpack_require__(71); +const ChannelStore = __webpack_require__(72); +const GuildStore = __webpack_require__(73); +const ClientPresenceStore = __webpack_require__(74); +const EmojiStore = __webpack_require__(37); const { Events, browser } = __webpack_require__(0); const DataResolver = __webpack_require__(9); const { Error, TypeError, RangeError } = __webpack_require__(4); @@ -14845,7 +14815,7 @@ module.exports = Client; /***/ }), -/* 91 */ +/* 92 */ /***/ (function(module, exports, __webpack_require__) { const { Events, Status } = __webpack_require__(0); @@ -14924,18 +14894,18 @@ module.exports = ClientManager; /***/ }), -/* 92 */ +/* 93 */ /***/ (function(module, exports) { /* (ignored) */ /***/ }), -/* 93 */ +/* 94 */ /***/ (function(module, exports, __webpack_require__) { -const EventEmitter = __webpack_require__(21); +const EventEmitter = __webpack_require__(20); const { Events, Status } = __webpack_require__(0); -const WebSocketConnection = __webpack_require__(94); +const WebSocketConnection = __webpack_require__(95); /** * WebSocket Manager of the client. @@ -15026,18 +14996,18 @@ module.exports = WebSocketManager; /***/ }), -/* 94 */ +/* 95 */ /***/ (function(module, exports, __webpack_require__) { -const EventEmitter = __webpack_require__(21); +const EventEmitter = __webpack_require__(20); const { Events, OPCodes, Status, WSCodes } = __webpack_require__(0); -const PacketManager = __webpack_require__(95); -const WebSocket = __webpack_require__(63); +const PacketManager = __webpack_require__(96); +const WebSocket = __webpack_require__(64); try { - var zlib = __webpack_require__(140); - if (!zlib.Inflate) zlib = __webpack_require__(64); + var zlib = __webpack_require__(141); + if (!zlib.Inflate) zlib = __webpack_require__(65); } catch (err) { - zlib = __webpack_require__(64); + zlib = __webpack_require__(65); } /** @@ -15512,7 +15482,7 @@ module.exports = WebSocketConnection; /***/ }), -/* 95 */ +/* 96 */ /***/ (function(module, exports, __webpack_require__) { const { OPCodes, Status, WSEvents } = __webpack_require__(0); @@ -15533,43 +15503,43 @@ class WebSocketPacketManager { this.handlers = {}; this.queue = []; - this.register(WSEvents.READY, __webpack_require__(96)); - this.register(WSEvents.RESUMED, __webpack_require__(101)); - this.register(WSEvents.GUILD_CREATE, __webpack_require__(102)); - this.register(WSEvents.GUILD_DELETE, __webpack_require__(103)); - this.register(WSEvents.GUILD_UPDATE, __webpack_require__(104)); - this.register(WSEvents.GUILD_BAN_ADD, __webpack_require__(105)); - this.register(WSEvents.GUILD_BAN_REMOVE, __webpack_require__(106)); - this.register(WSEvents.GUILD_MEMBER_ADD, __webpack_require__(107)); - this.register(WSEvents.GUILD_MEMBER_REMOVE, __webpack_require__(108)); - this.register(WSEvents.GUILD_MEMBER_UPDATE, __webpack_require__(109)); - this.register(WSEvents.GUILD_ROLE_CREATE, __webpack_require__(110)); - this.register(WSEvents.GUILD_ROLE_DELETE, __webpack_require__(111)); - this.register(WSEvents.GUILD_ROLE_UPDATE, __webpack_require__(112)); - this.register(WSEvents.GUILD_EMOJIS_UPDATE, __webpack_require__(113)); - this.register(WSEvents.GUILD_MEMBERS_CHUNK, __webpack_require__(114)); - this.register(WSEvents.CHANNEL_CREATE, __webpack_require__(115)); - this.register(WSEvents.CHANNEL_DELETE, __webpack_require__(116)); - this.register(WSEvents.CHANNEL_UPDATE, __webpack_require__(117)); - this.register(WSEvents.CHANNEL_PINS_UPDATE, __webpack_require__(118)); - this.register(WSEvents.PRESENCE_UPDATE, __webpack_require__(119)); - this.register(WSEvents.USER_UPDATE, __webpack_require__(120)); - this.register(WSEvents.USER_NOTE_UPDATE, __webpack_require__(121)); - this.register(WSEvents.USER_SETTINGS_UPDATE, __webpack_require__(122)); - this.register(WSEvents.USER_GUILD_SETTINGS_UPDATE, __webpack_require__(123)); - this.register(WSEvents.VOICE_STATE_UPDATE, __webpack_require__(124)); - this.register(WSEvents.TYPING_START, __webpack_require__(125)); - this.register(WSEvents.MESSAGE_CREATE, __webpack_require__(126)); - this.register(WSEvents.MESSAGE_DELETE, __webpack_require__(127)); - this.register(WSEvents.MESSAGE_UPDATE, __webpack_require__(128)); - this.register(WSEvents.MESSAGE_DELETE_BULK, __webpack_require__(129)); - this.register(WSEvents.VOICE_SERVER_UPDATE, __webpack_require__(130)); - this.register(WSEvents.GUILD_SYNC, __webpack_require__(131)); - this.register(WSEvents.RELATIONSHIP_ADD, __webpack_require__(132)); - this.register(WSEvents.RELATIONSHIP_REMOVE, __webpack_require__(133)); - this.register(WSEvents.MESSAGE_REACTION_ADD, __webpack_require__(134)); - this.register(WSEvents.MESSAGE_REACTION_REMOVE, __webpack_require__(135)); - this.register(WSEvents.MESSAGE_REACTION_REMOVE_ALL, __webpack_require__(136)); + this.register(WSEvents.READY, __webpack_require__(97)); + this.register(WSEvents.RESUMED, __webpack_require__(102)); + this.register(WSEvents.GUILD_CREATE, __webpack_require__(103)); + this.register(WSEvents.GUILD_DELETE, __webpack_require__(104)); + this.register(WSEvents.GUILD_UPDATE, __webpack_require__(105)); + this.register(WSEvents.GUILD_BAN_ADD, __webpack_require__(106)); + this.register(WSEvents.GUILD_BAN_REMOVE, __webpack_require__(107)); + this.register(WSEvents.GUILD_MEMBER_ADD, __webpack_require__(108)); + this.register(WSEvents.GUILD_MEMBER_REMOVE, __webpack_require__(109)); + this.register(WSEvents.GUILD_MEMBER_UPDATE, __webpack_require__(110)); + this.register(WSEvents.GUILD_ROLE_CREATE, __webpack_require__(111)); + this.register(WSEvents.GUILD_ROLE_DELETE, __webpack_require__(112)); + this.register(WSEvents.GUILD_ROLE_UPDATE, __webpack_require__(113)); + this.register(WSEvents.GUILD_EMOJIS_UPDATE, __webpack_require__(114)); + this.register(WSEvents.GUILD_MEMBERS_CHUNK, __webpack_require__(115)); + this.register(WSEvents.CHANNEL_CREATE, __webpack_require__(116)); + this.register(WSEvents.CHANNEL_DELETE, __webpack_require__(117)); + this.register(WSEvents.CHANNEL_UPDATE, __webpack_require__(118)); + this.register(WSEvents.CHANNEL_PINS_UPDATE, __webpack_require__(119)); + this.register(WSEvents.PRESENCE_UPDATE, __webpack_require__(120)); + this.register(WSEvents.USER_UPDATE, __webpack_require__(121)); + this.register(WSEvents.USER_NOTE_UPDATE, __webpack_require__(122)); + this.register(WSEvents.USER_SETTINGS_UPDATE, __webpack_require__(123)); + this.register(WSEvents.USER_GUILD_SETTINGS_UPDATE, __webpack_require__(124)); + this.register(WSEvents.VOICE_STATE_UPDATE, __webpack_require__(125)); + this.register(WSEvents.TYPING_START, __webpack_require__(126)); + this.register(WSEvents.MESSAGE_CREATE, __webpack_require__(127)); + this.register(WSEvents.MESSAGE_DELETE, __webpack_require__(128)); + this.register(WSEvents.MESSAGE_UPDATE, __webpack_require__(129)); + this.register(WSEvents.MESSAGE_DELETE_BULK, __webpack_require__(130)); + this.register(WSEvents.VOICE_SERVER_UPDATE, __webpack_require__(131)); + this.register(WSEvents.GUILD_SYNC, __webpack_require__(132)); + this.register(WSEvents.RELATIONSHIP_ADD, __webpack_require__(133)); + this.register(WSEvents.RELATIONSHIP_REMOVE, __webpack_require__(134)); + this.register(WSEvents.MESSAGE_REACTION_ADD, __webpack_require__(135)); + this.register(WSEvents.MESSAGE_REACTION_REMOVE, __webpack_require__(136)); + this.register(WSEvents.MESSAGE_REACTION_REMOVE_ALL, __webpack_require__(137)); } get client() { @@ -15626,12 +15596,12 @@ module.exports = WebSocketPacketManager; /***/ }), -/* 96 */ +/* 97 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); const { Events } = __webpack_require__(0); -const ClientUser = __webpack_require__(43); +const ClientUser = __webpack_require__(44); class ReadyHandler extends AbstractHandler { handle(packet) { @@ -15709,10 +15679,10 @@ module.exports = ReadyHandler; /***/ }), -/* 97 */ +/* 98 */ /***/ (function(module, exports, __webpack_require__) { -const long = __webpack_require__(26); +const long = __webpack_require__(27); const { TypeError } = __webpack_require__(4); /** @@ -15797,7 +15767,7 @@ module.exports = function search(target, options) { // Lazy load these because some of them use util const Channel = __webpack_require__(12); - const Guild = __webpack_require__(25); + const Guild = __webpack_require__(26); if (!(target instanceof Channel || target instanceof Guild)) throw new TypeError('SEARCH_CHANNEL_TYPE'); @@ -15815,7 +15785,7 @@ module.exports = function search(target, options) { /***/ }), -/* 98 */ +/* 99 */ /***/ (function(module, exports, __webpack_require__) { const DataStore = __webpack_require__(7); @@ -15866,83 +15836,30 @@ module.exports = ReactionStore; /***/ }), -/* 99 */ +/* 100 */ /***/ (function(module, exports, __webpack_require__) { -const Util = __webpack_require__(5); -const Embed = __webpack_require__(15); -const { RangeError } = __webpack_require__(4); +const createMessage = __webpack_require__(60); -module.exports = function sendMessage(channel, options) { // eslint-disable-line complexity - const User = __webpack_require__(22); +module.exports = async function sendMessage(channel, options) { // eslint-disable-line complexity + const User = __webpack_require__(17); const GuildMember = __webpack_require__(13); 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(); + const { data, files } = await createMessage(channel, options); - 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); + return channel.client.api.channels[channel.id].messages.post({ data, files }) + .then(d => channel.client.actions.MessageCreate.handle(d).message); }; /***/ }), -/* 100 */ +/* 101 */ /***/ (function(module, exports, __webpack_require__) { const Collection = __webpack_require__(3); const { UserFlags } = __webpack_require__(0); -const UserConnection = __webpack_require__(60); +const UserConnection = __webpack_require__(61); const Base = __webpack_require__(6); /** @@ -16022,7 +15939,7 @@ module.exports = UserProfile; /***/ }), -/* 101 */ +/* 102 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -16056,7 +15973,7 @@ module.exports = ResumedHandler; /***/ }), -/* 102 */ +/* 103 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -16095,7 +16012,7 @@ module.exports = GuildCreateHandler; /***/ }), -/* 103 */ +/* 104 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -16117,7 +16034,7 @@ module.exports = GuildDeleteHandler; /***/ }), -/* 104 */ +/* 105 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -16134,7 +16051,7 @@ module.exports = GuildUpdateHandler; /***/ }), -/* 105 */ +/* 106 */ /***/ (function(module, exports, __webpack_require__) { // ##untested handler## @@ -16163,7 +16080,7 @@ module.exports = GuildBanAddHandler; /***/ }), -/* 106 */ +/* 107 */ /***/ (function(module, exports, __webpack_require__) { // ##untested handler## @@ -16189,7 +16106,7 @@ module.exports = GuildBanRemoveHandler; /***/ }), -/* 107 */ +/* 108 */ /***/ (function(module, exports, __webpack_require__) { // ##untested handler## @@ -16222,7 +16139,7 @@ module.exports = GuildMemberAddHandler; /***/ }), -/* 108 */ +/* 109 */ /***/ (function(module, exports, __webpack_require__) { // ##untested handler## @@ -16241,7 +16158,7 @@ module.exports = GuildMemberRemoveHandler; /***/ }), -/* 109 */ +/* 110 */ /***/ (function(module, exports, __webpack_require__) { // ##untested handler## @@ -16276,7 +16193,7 @@ module.exports = GuildMemberUpdateHandler; /***/ }), -/* 110 */ +/* 111 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -16293,7 +16210,7 @@ module.exports = GuildRoleCreateHandler; /***/ }), -/* 111 */ +/* 112 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -16310,7 +16227,7 @@ module.exports = GuildRoleDeleteHandler; /***/ }), -/* 112 */ +/* 113 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -16327,7 +16244,7 @@ module.exports = GuildRoleUpdateHandler; /***/ }), -/* 113 */ +/* 114 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -16344,7 +16261,7 @@ module.exports = GuildEmojisUpdate; /***/ }), -/* 114 */ +/* 115 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -16378,7 +16295,7 @@ module.exports = GuildMembersChunkHandler; /***/ }), -/* 115 */ +/* 116 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -16399,7 +16316,7 @@ module.exports = ChannelCreateHandler; /***/ }), -/* 116 */ +/* 117 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -16414,7 +16331,7 @@ module.exports = ChannelDeleteHandler; /***/ }), -/* 117 */ +/* 118 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -16440,7 +16357,7 @@ module.exports = ChannelUpdateHandler; /***/ }), -/* 118 */ +/* 119 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -16477,7 +16394,7 @@ module.exports = ChannelPinsUpdate; /***/ }), -/* 119 */ +/* 120 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -16557,7 +16474,7 @@ module.exports = PresenceUpdateHandler; /***/ }), -/* 120 */ +/* 121 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -16574,7 +16491,7 @@ module.exports = UserUpdateHandler; /***/ }), -/* 121 */ +/* 122 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -16592,7 +16509,7 @@ module.exports = UserNoteUpdateHandler; /***/ }), -/* 122 */ +/* 123 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -16616,12 +16533,12 @@ module.exports = UserSettingsUpdateHandler; /***/ }), -/* 123 */ +/* 124 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); const { Events } = __webpack_require__(0); -const ClientUserGuildSettings = __webpack_require__(38); +const ClientUserGuildSettings = __webpack_require__(39); class UserGuildSettingsUpdateHandler extends AbstractHandler { handle(packet) { @@ -16643,7 +16560,7 @@ module.exports = UserGuildSettingsUpdateHandler; /***/ }), -/* 124 */ +/* 125 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -16685,7 +16602,7 @@ module.exports = VoiceStateUpdateHandler; /***/ }), -/* 125 */ +/* 126 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -16759,7 +16676,7 @@ module.exports = TypingStartHandler; /***/ }), -/* 126 */ +/* 127 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -16774,7 +16691,7 @@ module.exports = MessageCreateHandler; /***/ }), -/* 127 */ +/* 128 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -16789,7 +16706,7 @@ module.exports = MessageDeleteHandler; /***/ }), -/* 128 */ +/* 129 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -16815,7 +16732,7 @@ module.exports = MessageUpdateHandler; /***/ }), -/* 129 */ +/* 130 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -16830,7 +16747,7 @@ module.exports = MessageDeleteBulkHandler; /***/ }), -/* 130 */ +/* 131 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -16855,7 +16772,7 @@ module.exports = VoiceServerUpdate; /***/ }), -/* 131 */ +/* 132 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -16872,7 +16789,7 @@ module.exports = GuildSyncHandler; /***/ }), -/* 132 */ +/* 133 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -16897,7 +16814,7 @@ module.exports = RelationshipAddHandler; /***/ }), -/* 133 */ +/* 134 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -16922,7 +16839,7 @@ module.exports = RelationshipRemoveHandler; /***/ }), -/* 134 */ +/* 135 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -16941,7 +16858,7 @@ module.exports = MessageReactionAddHandler; /***/ }), -/* 135 */ +/* 136 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -16958,7 +16875,7 @@ module.exports = MessageReactionRemove; /***/ }), -/* 136 */ +/* 137 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -16974,12 +16891,6 @@ class MessageReactionRemoveAll extends AbstractHandler { module.exports = MessageReactionRemoveAll; -/***/ }), -/* 137 */ -/***/ (function(module, exports) { - -/* (ignored) */ - /***/ }), /* 138 */ /***/ (function(module, exports) { @@ -17000,17 +16911,23 @@ module.exports = MessageReactionRemoveAll; /***/ }), /* 141 */ +/***/ (function(module, exports) { + +/* (ignored) */ + +/***/ }), +/* 142 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var zlib_deflate = __webpack_require__(142); +var zlib_deflate = __webpack_require__(143); var utils = __webpack_require__(11); -var strings = __webpack_require__(67); -var msg = __webpack_require__(39); -var ZStream = __webpack_require__(68); +var strings = __webpack_require__(68); +var msg = __webpack_require__(40); +var ZStream = __webpack_require__(69); var toString = Object.prototype.toString; @@ -17406,7 +17323,7 @@ exports.gzip = gzip; /***/ }), -/* 142 */ +/* 143 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -17432,10 +17349,10 @@ exports.gzip = gzip; // 3. This notice may not be removed or altered from any source distribution. var utils = __webpack_require__(11); -var trees = __webpack_require__(143); -var adler32 = __webpack_require__(65); -var crc32 = __webpack_require__(66); -var msg = __webpack_require__(39); +var trees = __webpack_require__(144); +var adler32 = __webpack_require__(66); +var crc32 = __webpack_require__(67); +var msg = __webpack_require__(40); /* Public constants ==========================================================*/ /* ===========================================================================*/ @@ -19287,7 +19204,7 @@ exports.deflateTune = deflateTune; /***/ }), -/* 143 */ +/* 144 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -20514,20 +20431,20 @@ exports._tr_align = _tr_align; /***/ }), -/* 144 */ +/* 145 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var zlib_inflate = __webpack_require__(145); +var zlib_inflate = __webpack_require__(146); var utils = __webpack_require__(11); -var strings = __webpack_require__(67); -var c = __webpack_require__(69); -var msg = __webpack_require__(39); -var ZStream = __webpack_require__(68); -var GZheader = __webpack_require__(148); +var strings = __webpack_require__(68); +var c = __webpack_require__(70); +var msg = __webpack_require__(40); +var ZStream = __webpack_require__(69); +var GZheader = __webpack_require__(149); var toString = Object.prototype.toString; @@ -20939,7 +20856,7 @@ exports.ungzip = inflate; /***/ }), -/* 145 */ +/* 146 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -20965,10 +20882,10 @@ exports.ungzip = inflate; // 3. This notice may not be removed or altered from any source distribution. var utils = __webpack_require__(11); -var adler32 = __webpack_require__(65); -var crc32 = __webpack_require__(66); -var inflate_fast = __webpack_require__(146); -var inflate_table = __webpack_require__(147); +var adler32 = __webpack_require__(66); +var crc32 = __webpack_require__(67); +var inflate_fast = __webpack_require__(147); +var inflate_table = __webpack_require__(148); var CODES = 0; var LENS = 1; @@ -22502,7 +22419,7 @@ exports.inflateUndermine = inflateUndermine; /***/ }), -/* 146 */ +/* 147 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -22854,7 +22771,7 @@ module.exports = function inflate_fast(strm, start) { /***/ }), -/* 147 */ +/* 148 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -23204,7 +23121,7 @@ module.exports = function inflate_table(type, lens, lens_index, codes, table, ta /***/ }), -/* 148 */ +/* 149 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -23269,14 +23186,13 @@ module.exports = GZheader; /***/ }), -/* 149 */ +/* 150 */ /***/ (function(module, exports, __webpack_require__) { class ActionsManager { constructor(client) { this.client = client; - this.register(__webpack_require__(150)); this.register(__webpack_require__(151)); this.register(__webpack_require__(152)); this.register(__webpack_require__(153)); @@ -23302,6 +23218,7 @@ class ActionsManager { this.register(__webpack_require__(173)); this.register(__webpack_require__(174)); this.register(__webpack_require__(175)); + this.register(__webpack_require__(176)); } register(Action) { @@ -23313,7 +23230,7 @@ module.exports = ActionsManager; /***/ }), -/* 150 */ +/* 151 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -23358,7 +23275,7 @@ module.exports = MessageCreateAction; /***/ }), -/* 151 */ +/* 152 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -23392,7 +23309,7 @@ module.exports = MessageDeleteAction; /***/ }), -/* 152 */ +/* 153 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -23432,7 +23349,7 @@ module.exports = MessageDeleteBulkAction; /***/ }), -/* 153 */ +/* 154 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -23461,7 +23378,7 @@ module.exports = MessageUpdateAction; /***/ }), -/* 154 */ +/* 155 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -23506,7 +23423,7 @@ module.exports = MessageReactionAdd; /***/ }), -/* 155 */ +/* 156 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -23552,7 +23469,7 @@ module.exports = MessageReactionRemove; /***/ }), -/* 156 */ +/* 157 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -23583,7 +23500,7 @@ module.exports = MessageReactionRemoveAll; /***/ }), -/* 157 */ +/* 158 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -23605,7 +23522,7 @@ module.exports = ChannelCreateAction; /***/ }), -/* 158 */ +/* 159 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -23640,7 +23557,7 @@ module.exports = ChannelDeleteAction; /***/ }), -/* 159 */ +/* 160 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -23666,7 +23583,7 @@ module.exports = ChannelUpdateAction; /***/ }), -/* 160 */ +/* 161 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -23729,7 +23646,7 @@ module.exports = GuildDeleteAction; /***/ }), -/* 161 */ +/* 162 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -23767,7 +23684,7 @@ module.exports = GuildUpdateAction; /***/ }), -/* 162 */ +/* 163 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -23800,7 +23717,7 @@ module.exports = GuildMemberRemoveAction; /***/ }), -/* 163 */ +/* 164 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -23819,7 +23736,7 @@ module.exports = GuildBanRemove; /***/ }), -/* 164 */ +/* 165 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -23849,7 +23766,7 @@ module.exports = GuildRoleCreate; /***/ }), -/* 165 */ +/* 166 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -23883,7 +23800,7 @@ module.exports = GuildRoleDeleteAction; /***/ }), -/* 166 */ +/* 167 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -23927,7 +23844,7 @@ module.exports = GuildRoleUpdateAction; /***/ }), -/* 167 */ +/* 168 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -23964,7 +23881,7 @@ module.exports = UserUpdateAction; /***/ }), -/* 168 */ +/* 169 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -24000,7 +23917,7 @@ module.exports = UserNoteUpdateAction; /***/ }), -/* 169 */ +/* 170 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -24035,7 +23952,7 @@ module.exports = GuildSync; /***/ }), -/* 170 */ +/* 171 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -24059,7 +23976,7 @@ module.exports = GuildEmojiCreateAction; /***/ }), -/* 171 */ +/* 172 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -24083,7 +24000,7 @@ module.exports = GuildEmojiDeleteAction; /***/ }), -/* 172 */ +/* 173 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -24108,7 +24025,7 @@ module.exports = GuildEmojiUpdateAction; /***/ }), -/* 173 */ +/* 174 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -24152,7 +24069,7 @@ module.exports = GuildEmojisUpdateAction; /***/ }), -/* 174 */ +/* 175 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -24177,7 +24094,7 @@ module.exports = GuildRolesPositionUpdate; /***/ }), -/* 175 */ +/* 176 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -24201,12 +24118,6 @@ class GuildChannelsPositionUpdate extends Action { module.exports = GuildChannelsPositionUpdate; -/***/ }), -/* 176 */ -/***/ (function(module, exports) { - -/* (ignored) */ - /***/ }), /* 177 */ /***/ (function(module, exports) { @@ -24233,10 +24144,16 @@ module.exports = GuildChannelsPositionUpdate; /***/ }), /* 181 */ +/***/ (function(module, exports) { + +/* (ignored) */ + +/***/ }), +/* 182 */ /***/ (function(module, exports, __webpack_require__) { -const Webhook = __webpack_require__(17); -const BaseClient = __webpack_require__(29); +const Webhook = __webpack_require__(15); +const BaseClient = __webpack_require__(30); /** * The webhook client. diff --git a/discord.master.min.js b/discord.master.min.js index 66e68c31..117351db 100644 --- a/discord.master.min.js +++ b/discord.master.min.js @@ -1 +1 @@ -window.Discord=function(e){function t(i){if(s[i])return s[i].exports;var n=s[i]={i:i,l:!1,exports:{}};return e[i].call(n.exports,n,n.exports,t),n.l=!0,n.exports}var s={};return t.m=e,t.c=s,t.d=function(e,s,i){t.o(e,s)||Object.defineProperty(e,s,{configurable:!1,enumerable:!0,get:i})},t.n=function(e){var s=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(s,"a",s),s},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=74)}([function(e,t,s){function i(e,{format:t="webp",size:s}={}){if(t&&!l.includes(t))throw new r("IMAGE_FORMAT",t);if(s&&!h.includes(s))throw new a("IMAGE_SIZE",s);return`${e}.${t}${s?`?size=${s}`:""}`}const n=t.Package=s(40),{Error:r,RangeError:a}=s(4),o=t.browser="undefined"!=typeof window;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:!1,properties:{$os:o?"browser":process.platform,$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.UserAgent=o?null:`DiscordBot (${n.homepage.split("#")[0]}, ${n.version}) Node.js/${process.version}`,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 l=["webp","png","jpg","gif"],h=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,s,n="default",r)=>"1"===t?s:("default"===n&&(n=s.startsWith("a_")?"gif":"webp"),i(`${e}/avatars/${t}/${s}`,{format:n,size:r})),Icon:(t,s,n="webp",r)=>i(`${e}/icons/${t}/${s}`,{format:n,size:r}),AppIcon:(t,s,{format:n="webp",size:r}={})=>i(`${e}/app-icons/${t}/${s}`,{size:r,format:n}),AppAsset:(t,s,{format:n="webp",size:r}={})=>i(`${e}/app-assets/${t}/${s}`,{size:r,format:n}),GDMIcon:(t,s,n="webp",r)=>i(`${e}/channel-icons/${t}/${s}`,{size:r,format:n}),Splash:(t,s,n="webp",r)=>i(`${e}/splashes/${t}/${s}`,{size:r,format:n})}),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.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={RATE_LIMIT:"rateLimit",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 s of e)t[s]=s;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.ChannelTypes={TEXT:0,DM:1,VOICE:2,GROUP:3,CATEGORY: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}},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),s=this.values();for(let i=0;i{const i=e.get(s);return i!==t||void 0===i&&!e.has(s)}))}sort(e=((e,t)=>+(e>t)||+(e===t)-1)){return new Collection(Array.from(this.entries()).sort((t,s)=>e(t[1],s[1],t[0],s[0])))}}e.exports=Collection},function(e,t,s){e.exports=s(41),e.exports.Messages=s(81)},function(e,t,s){const i=s(26),n=s(27),{Colors:r,DefaultOptions:a,Endpoints:o}=s(0),{Error:l,RangeError:h,TypeError:c}=s(4),d=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),u=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^/]+?|)(\.[^./]*|))(?:[/]*)$/;class Util{constructor(){throw new Error(`The ${this.constructor.name} class may not be instantiated.`)}static splitMessage(e,{maxLength:t=1950,char:s="\n",prepend:i="",append:n=""}={}){if(e.length<=t)return e;const r=e.split(s);if(1===r.length)throw new h("SPLIT_MAX_LEN");const a=[""];let o=0;for(let e=0;et&&(a[o]+=n,a.push(i),o++),a[o]+=(a[o].length>0&&a[o]!==i?s:"")+r[e];return a.filter(e=>e)}static escapeMarkdown(e,t=!1,s=!1){return t?e.replace(/```/g,"`​``"):s?e.replace(/\\(`|\\)/g,"$1").replace(/(`|\\)/g,"\\$1"):e.replace(/\\(\*|_|`|~|\\)/g,"$1").replace(/(\*|_|`|~|\\)/g,"\\$1")}static fetchRecommendedShards(e,t=1e3){return new Promise((s,i)=>{if(!e)throw new l("TOKEN_MISSING");n.get(`${a.http.api}/v${a.http.version}${o.botGateway}`).set("Authorization",`Bot ${e.replace(/^Bot\s*/i,"")}`).end((e,n)=>{e&&i(e),s(n.body.shards*(1e3/t))})})}static parseEmoji(e){if(e.includes("%")&&(e=decodeURIComponent(e)),e.includes(":")){const[t,s]=e.split(":");return{name:t,id:s}}return{name:e,id:null}}static arraysEqual(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(const s of e){const e=t.indexOf(s);-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 s in e)d(t,s)&&void 0!==t[s]?t[s]===Object(t[s])&&(t[s]=this.mergeDefault(e[s],t[s])):t[s]=e[s];return t}static convertToBuffer(e){return"string"==typeof e&&(e=this.str2ab(e)),Buffer.from(e)}static str2ab(e){const t=new ArrayBuffer(2*e.length),s=new Uint16Array(t);for(var i=0,n=e.length;i-1&&s16777215)throw new h("COLOR_RANGE");if(e&&isNaN(e))throw new c("COLOR_CONVERT");return e}static discordSort(e){return e.sort((e,t)=>e.rawPosition-t.rawPosition||i.fromString(e.id).sub(i.fromString(t.id)).toNumber())}static setPosition(e,t,s,i,n,r){let a=i.array();return Util.moveElementInArray(a,e,t,s),a=a.map((e,t)=>({id:e.id,position:t})),n.patch({data:a,reason:r}).then(()=>a)}static basename(e,t){let s=u.exec(e).slice(1)[2];return t&&s.substr(-1*t.length)===t&&(s=s.substr(0,s.length-t.length)),s}}e.exports=Util},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,s){const i=s(3);class DataStore extends i{constructor(e,t,s){if(super(),Object.defineProperty(this,"client",{value:e}),Object.defineProperty(this,"holds",{value:s}),t)for(const e of t)this.create(e)}create(e,t=!0,{id:s,extras:i=[]}={}){const n=this.get(s||e.id);if(n)return n;const r=this.holds?new this.holds(this.client,e,...i):e;return t&&this.set(s||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 e?e:null}}e.exports=DataStore},function(e,t,s){function i(e,t,s="0"){return String(e).length>=t?String(e):(String(s).repeat(t)+e).slice(-t)}const n=s(26);let r=0;class SnowflakeUtil{constructor(){throw new Error(`The ${this.constructor.name} class may not be instantiated.`)}static generate(){r>=4095&&(r=0);const e=`${i((Date.now()-14200704e5).toString(2),42)}0000100000${i((r++).toString(2),12)}`;return n.fromString(e,2).toString()}static deconstruct(e){const t=i(n.fromString(e).toString(2),64),s={timestamp:parseInt(t.substring(0,42),2)+14200704e5,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(s,"date",{get:function(){return new Date(this.timestamp)},enumerable:!0}),s}}e.exports=SnowflakeUtil},function(e,t,s){const i=s(49),n=s(49),r=s(27),a=s(5),{Error:o,TypeError:l}=s(4),{browser:h}=s(0);class DataResolver{constructor(){throw new o(`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){if(!e)return null;if("string"==typeof e&&e.startsWith("data:"))return e;const t=await this.resolveFile(e);return DataResolver.resolveBase64(t)}static resolveBase64(e){return e instanceof Buffer?`data:image/jpg;base64,${e.toString("base64")}`:e}static resolveFile(e){return e instanceof Buffer?Promise.resolve(e):h&&e instanceof ArrayBuffer?Promise.resolve(a.convertToBuffer(e)):"string"==typeof e?new Promise((t,s)=>{if(/^https?:\/\//.test(e))r.get(e).end((e,i)=>e?s(e):i.body instanceof Buffer?t(i.body):s(new l("REQ_BODY_TYPE")));else{const r=h?e:i.resolve(e);n.stat(r,(e,i)=>e?s(e):i&&i.isFile()?(n.readFile(r,(e,i)=>{e?s(e):t(i)}),null):s(new o("FILE_NOT_FOUND",r)))}}):e.pipe&&"function"==typeof e.pipe?new Promise((t,s)=>{const i=[];e.once("error",s),e.on("data",e=>i.push(e)),e.once("end",()=>t(Buffer.concat(i)))}):Promise.reject(new l("REQ_RESOURCE_TYPE"))}}e.exports=DataResolver},function(e,t,s){const{RangeError:i}=s(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))}freeze(){return Object.freeze(this)}add(...e){let t=0;for(let s=e.length-1;s>=0;s--)t|=this.constructor.resolve(e[s]);return Object.isFrozen(this)?new this.constructor(this.bitfield|t):(this.bitfield|=t,this)}remove(...e){let t=0;for(let s=e.length-1;s>=0;s--)t|=this.constructor.resolve(e[s]);return Object.isFrozen(this)?new this.constructor(this.bitfield&~t):(this.bitfield&=~t,this)}serialize(e=!0){const t={};for(const s in this.constructor.FLAGS)t[s]=this.has(s,e);return t}static resolve(e){if("number"==typeof e&&e>=0)return e;if(e instanceof Permissions)return e.bitfield;if(e instanceof Array)return e.map(e=>this.resolve(e)).reduce((e,t)=>e|t,0);if("string"==typeof e)return this.FLAGS[e];throw new i("PERMISSIONS_INVALID")}}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,s){"use strict";function i(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var n="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;t.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var s=t.shift();if(s){if("object"!=typeof s)throw new TypeError(s+"must be non-object");for(var n in s)i(s,n)&&(e[n]=s[n])}}return e},t.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var r={arraySet:function(e,t,s,i,n){if(t.subarray&&e.subarray)e.set(t.subarray(s,s+i),n);else for(var r=0;rthis)}static create(e,t,i){const n=s(46),a=s(51),o=s(52),l=s(54),h=s(55),c=s(16);let d;if(t.type===r.DM)d=new n(e,t);else if(t.type===r.GROUP)d=new a(e,t);else if(i=i||e.guilds.get(t.guild_id)){switch(t.type){case r.TEXT:d=new o(i,t);break;case r.VOICE:d=new l(i,t);break;case r.CATEGORY:d=new h(i,t);break;default:d=new c(i,t)}i.channels.set(d.id,d)}return d}}e.exports=Channel},function(e,t,s){const i=s(18),n=s(23),r=s(10),a=s(3),o=s(6),{Presence:l}=s(14),{Error:h,TypeError:c}=s(4);class GuildMember extends o{constructor(e,t,s){super(e),this.guild=s,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),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 l(this.client)}get roles(){const e=new a,t=this.guild.roles.get(this.guild.id);t&&e.set(t.id,t);for(const t of this._roles){const s=this.guild.roles.get(t);s&&e.set(s.id,s)}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(){return this.user.id===this.guild.ownerID?new r(r.ALL).freeze():new r(this.roles.map(e=>e.permissions)).freeze()}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 h("GUILD_CHANNEL_RESOLVE");return e.permissionsFor(this)}hasPermission(e,t=!0,s=!0){return!(!s||this.user.id!==this.guild.ownerID)||this.roles.some(s=>s.permissions.has(e,t))}missingPermissions(e,t=!1){return this.permissions.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 n?e.id:e));let s=this.client.api.guilds(this.guild.id);if(this.user.id===this.client.user.id){const t=Object.keys(e);s=1===t.length&&"nick"===t[0]?s.members("@me").nick:s.members(this.id)}else s=s.members(this.id);return s.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 c("INVALID_TYPE","role","Role nor a Snowflake"))}addRoles(e,t){let s=this._roles.slice();for(let t of e instanceof a?e.values():e){if(!(t=this.guild.roles.resolve(t)))return Promise.reject(new c("INVALID_TYPE","roles","Array or Collection of Roles or Snowflakes",!0));s.push(t.id)}return this.edit({roles:s},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(),s=t._roles.indexOf(e.id);return~s&&t._roles.splice(s,1),t}):Promise.resolve(this):Promise.reject(new c("INVALID_TYPE","role","Role nor a Snowflake"))}removeRoles(e,t){const s=this._roles.slice();for(let t of e instanceof a?e.values():e){if(!(t=this.guild.roles.resolve(t)))return Promise.reject(new c("INVALID_TYPE","roles","Array or Collection of Roles or Snowflakes",!0));const e=s.indexOf(t.id);e>=0&&s.splice(e,1)}return this.edit({roles:s},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(){}}i.applyToClass(GuildMember),e.exports=GuildMember},function(e,t,s){const{ActivityTypes:i}=s(0);class Presence{constructor(e,t={}){Object.defineProperty(this,"client",{value:e}),this.patch(t)}patch(e){this.status=e.status||this.status||"offline";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=i[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,s){const i=s(20),n=s(5),{RangeError:r}=s(4);class MessageEmbed{constructor(e={}){this.setup(e)}setup(e){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?e.fields.map(n.cloneObject):[],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&&(this.files=e.files.map(e=>e instanceof i?"string"==typeof e.file?e.file:n.cloneObject(e.file):e))}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,s=!1){if(this.fields.length>=25)throw new r("EMBED_FIELD_COUNT");if(e=n.resolveString(e),!String(e)||e.length>256)throw new r("EMBED_FIELD_NAME");if(t=n.resolveString(t),!String(t)||t.length>1024)throw new r("EMBED_FIELD_VALUE");return this.fields.push({name:e,value:t,inline:s}),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 i&&(t=t.file);return this}setAuthor(e,t,s){return this.author={name:n.resolveString(e),iconURL:t,url:s},this}setColor(e){return this.color=n.resolveColor(e),this}setDescription(e){if((e=n.resolveString(e)).length>2048)throw new r("EMBED_DESCRIPTION");return this.description=e,this}setFooter(e,t){if((e=n.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=n.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,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,s){const i=s(12),n=s(23),r=s(24),a=s(53),o=s(5),l=s(10),h=s(3),{MessageNotificationTypes:c}=s(0),{Error:d,TypeError:u}=s(4);class GuildChannel extends i{constructor(e,t){super(e.client,t),this.guild=e}_patch(e){if(super._patch(e),this.name=e.name,this.rawPosition=e.position,this.parentID=e.parent_id,this.permissionOverwrites=new h,e.permission_overwrites)for(const t of e.permission_overwrites)this.permissionOverwrites.set(t.id,new a(this,t))}get parent(){return this.guild.channels.get(this.parentID)}get permissionsLocked(){return this.parent?this.permissionOverwrites.size===this.parent.permissionOverwrites.size&&!this.permissionOverwrites.find((e,t)=>{const s=this.parent.permissionOverwrites.get(t);return void 0===s||s.denied.bitfield!==e.denied.bitfield||s.allowed.bitfield!==e.allowed.bitfield}):null}get position(){const e=this.guild._sortedChannels(this);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 l(l.ALL).freeze();const t=e.roles,s=new l(t.map(e=>e.permissions));if(s.has(l.FLAGS.ADMINISTRATOR))return new l(l.ALL).freeze();const i=this.overwritesFor(e,!0,t);return s.remove(i.everyone?i.everyone.denied:0).add(i.everyone?i.everyone.allowed:0).remove(i.roles.length>0?i.roles.map(e=>e.denied):0).add(i.roles.length>0?i.roles.map(e=>e.allowed):0).remove(i.member?i.member.denied:0).add(i.member?i.member.allowed:0).freeze()}overwritesFor(e,t=!1,s=null){if(t||(e=this.guild.members.resolve(e)),!e)return[];s=s||e.roles;const i=[];let n,r;for(const t of this.permissionOverwrites.values())t.id===this.guild.id?r=t:s.has(t.id)?i.push(t):t.id===e.id&&(n=t);return{everyone:r,roles:i,member:n}}overwritePermissions(e,t,s){const i=new l(0),r=new l(0);let a;const o=this.guild.roles.get(e);if(o||e instanceof n)e=o||e,a="role";else if(e=this.client.users.resolve(e),a="member",!e)return Promise.reject(new u("INVALID_TYPE","parameter","User nor a Role",!0));const h=this.permissionOverwrites.get(e.id);h&&(i.add(h.allowed),r.add(h.denied));for(const e in t)!0===t[e]?(i.add(l.FLAGS[e]||0),r.remove(l.FLAGS[e]||0)):!1===t[e]?(i.remove(l.FLAGS[e]||0),r.add(l.FLAGS[e]||0)):null===t[e]&&(i.remove(l.FLAGS[e]||0),r.remove(l.FLAGS[e]||0));return this.client.api.channels(this.id).permissions[e.id].put({data:{id:e.id,type:a,allow:i.bitfield,deny:r.bitfield},reason:s}).then(()=>this)}lockPermissions(){if(!this.parent)return Promise.reject(new d("GUILD_CHANNEL_ORPHAN"));const e=this.parent.permissionOverwrites.map(e=>({deny:e.denied.bitfield,allow:e.allowed.bitfield,id:e.id,type:e.type}));return this.edit({permissionOverwrites:e})}get members(){const e=new h;for(const t of this.guild.members.values())this.permissionsFor(t).has("VIEW_CHANNEL")&&e.set(t.id,t);return e}async edit(e,t){return void 0!==e.position&&await o.setPosition(this,e.position,!1,this.guild._sortedChannels(this),this.client.api.guilds(this.guild.id).channels,t).then(e=>{this.client.actions.GuildChannelsPositionUpdate.handle({guild_id:this.guild.id,channels:e})}),this.client.api.channels(this.id).patch({data:{name:(e.name||this.name).trim(),topic:e.topic,nsfw:e.nsfw,bitrate:e.bitrate||(this.bitrate?1e3*this.bitrate:void 0),user_limit:null!=e.userLimit?e.userLimit:this.userLimit,parent_id:e.parentID,lock_permissions:e.lockPermissions,permission_overwrites:e.permissionOverwrites},reason:t}).then(e=>{const t=this._clone();return t._patch(e),t})}setName(e,t){return this.edit({name:e},t)}setParent(e,{lockPermissions:t=!0,reason:s}={}){return this.edit({parentID:e.id?e.id:e,lockPermissions:t},s)}setTopic(e,t){return this.edit({topic:e},t)}setPosition(e,{relative:t,reason:s}={}){return o.setPosition(this,e,t,this.guild._sortedChannels(this),this.client.api.guilds(this.guild.id).channels,s).then(e=>(this.client.actions.GuildChannelsPositionUpdate.handle({guild_id:this.guild.id,channels:e}),this))}createInvite({temporary:e=!1,maxAge:t=86400,maxUses:s=0,unique:i,reason:n}={}){return this.client.api.channels(this.id).invites.post({data:{temporary:e,max_age:t,max_uses:s,unique:i},reason:n}).then(e=>new r(this.client,e))}clone({name:e=this.name,withPermissions:t=!0,withTopic:s=!0,reason:i}={}){const n={overwrites:t?this.permissionOverwrites:[],reason:i};return this.guild.createChannel(e,this.type,n).then(e=>s?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.permissionsFor(this.client.user).has(l.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 c[3]}}toString(){return`<#${this.id}>`}}e.exports=GuildChannel},function(e,t,s){const i=s(5),n=s(9),r=s(15),a=s(20),o=s(15),{browser:l}=s(0);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,t){if(t||"object"!=typeof e||e instanceof Array?t||(t={}):(t=e,e=""),t instanceof a&&(t={files:[t.file]}),t instanceof o&&(t={embeds:[t]}),t.embed&&(t={embeds:[t.embed]}),e instanceof Array||t instanceof Array){const s=e instanceof Array?e:t,i=s.filter(e=>e instanceof a),n=s.filter(e=>e instanceof o);i.length&&(t={files:i}),n.length&&(t={embeds:n}),(n.length||i.length)&&e instanceof Array&&(e="")}if(t.username||(t.username=this.name),t.avatarURL&&(t.avatar_url=t.avatarURL,t.avatarURL=null),e){e=i.resolveString(e);let{split:s,code:n,disableEveryone:r}=t;s&&"object"!=typeof s&&(s={}),void 0===n||"boolean"==typeof n&&!0!==n||(e=i.escapeMarkdown(e,!0),e=`\`\`\`${"boolean"!=typeof n?n||"":""}\n${e}\n\`\`\``,s&&(s.prepend=`\`\`\`${"boolean"!=typeof n?n||"":""}\n`,s.append="\n```")),(r||void 0===r&&this.client.options.disableEveryone)&&(e=e.replace(/@(everyone|here)/g,"@​$1")),s&&(e=i.splitMessage(e,s))}if(t.content=e,t.embeds&&(t.embeds=t.embeds.map(e=>new r(e)._apiTransform())),t.files){for(let e=0;en.resolveFile(e.attachment).then(t=>(e.file=t,e)))).then(e=>this.client.api.webhooks(this.id,this.token).post({data:t,query:{wait:!0},files:e,auth:!1}))}return e instanceof Array?new Promise((s,i)=>{const n=[];(function r(){const a=e.length?null:{embeds:t.embeds,files:t.files};this.client.api.webhooks(this.id,this.token).post({data:{content:e.shift(),opt:a},query:{wait:!0},auth:!1}).then(t=>(n.push(t),0===e.length?s(n):r.call(this))).catch(i)}).call(this)}):this.client.api.webhooks(this.id,this.token).post({data:t,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,channel:s},i){return t&&"string"==typeof t&&!t.startsWith("data:")?n.resolveImage(t).then(t=>this.edit({name:e,avatar:t},i)):(s&&(s=this.client.channels.resolveID(s)),this.client.api.webhooks(this.id,s?void 0:this.token).patch({data:{name:e,avatar:t,channel_id:s},reason:i}).then(e=>(this.name=e.name,this.avatar=e.avatar,this.channelID=e.channel_id,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},function(e,t,s){const i=s(44),n=s(45),r=s(5),{browser:a}=s(0),o=s(8),l=s(3),h=s(9),c=s(20),d=s(15),{RangeError:u,TypeError:f}=s(4);class TextBasedChannel{constructor(){this.messages=new p(this),this.lastMessageID=null,this.lastMessage=null}send(e,t){if(t||"object"!=typeof e||e instanceof Array?t||(t={}):(t=e,e=""),t instanceof d&&(t={embed:t}),t instanceof c&&(t={files:[t.file]}),e instanceof Array||t instanceof Array){const s=(e instanceof Array?e:t).filter(e=>e instanceof c);s.length&&(t={files:s},e instanceof Array&&(e=""))}if(t.content||(t.content=e),t.embed&&t.embed.files&&(t.files?t.files=t.files.concat(t.embed.files):t.files=t.embed.files),t.files){for(let e=0;eh.resolveFile(e.attachment).then(t=>(e.file=t,e)))).then(e=>(t.files=e,n.sendMessage(this,t)))}return n.sendMessage(this,t)}search(e={}){return n.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 i(this,e,t)}awaitMessages(e,t={}){return new Promise((s,i)=>{this.createMessageCollector(e,t).once("end",(e,n)=>{t.errors&&t.errors.includes(n)?i(e):s(e)})})}async bulkDelete(e,t=!1){if(e instanceof Array||e instanceof l){let s=e instanceof l?e.keyArray():e.map(e=>e.id||e);if(t&&(s=s.filter(e=>Date.now()-o.deconstruct(e).date.getTime()<12096e5)),0===s.length)return new l;if(1===s.length){await this.client.api.channels(this.id).messages(s[0]).delete();const e=this.client.actions.MessageDelete.handle({channel_id:this.id,id:s[0]}).message;return e?new l([[e.id,e]]):new l}return await this.client.api.channels[this.id].messages["bulk-delete"].post({data:{messages:s}}),this.client.actions.MessageDeleteBulk.handle({channel_id:this.id,ids:s}).messages}if(!isNaN(e)){const s=await this.messages.fetch({limit:e});return this.bulkDelete(s,t)}throw new f("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,s=[]){const i=["send"];t&&i.push("acknowledge","search","bulkDelete","startTyping","stopTyping","typing","typingCount","createMessageCollector","awaitMessages");for(const t of i)s.includes(t)||Object.defineProperty(e.prototype,t,Object.getOwnPropertyDescriptor(TextBasedChannel.prototype,t))}}e.exports=TextBasedChannel;const p=s(19)},function(e,t,s){const i=s(7),n=s(3),r=s(31),{Error:a}=s(4);class MessageStore extends i{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 s=this.client.options.messageCacheMaxSize;0!==s&&(this.size>=s&&s>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 n;for(const s of e)t.set(s.id,this.create(s));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 s=t.get(e);if(!s)throw new a("MESSAGE_MISSING");return s})}_fetchMany(e={}){return this.client.api.channels[this.channel.id].messages.get({query:e}).then(e=>{const t=new n;for(const s of e)t.set(s.id,this.create(s));return t})}}e.exports=MessageStore},function(e,t){class MessageAttachment{constructor(e,t,s){this.file=null,s&&this._patch(s),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){function s(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function i(e){return"function"==typeof e}function n(e){return"number"==typeof e}function r(e){return"object"==typeof e&&null!==e}function a(e){return void 0===e}e.exports=s,s.EventEmitter=s,s.prototype._events=void 0,s.prototype._maxListeners=void 0,s.defaultMaxListeners=10,s.prototype.setMaxListeners=function(e){if(!n(e)||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},s.prototype.emit=function(e){var t,s,n,o,l,h;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 c=new Error('Uncaught, unspecified "error" event. ('+t+")");throw c.context=t,c}if(s=this._events[e],a(s))return!1;if(i(s))switch(arguments.length){case 1:s.call(this);break;case 2:s.call(this,arguments[1]);break;case 3:s.call(this,arguments[1],arguments[2]);break;default:o=Array.prototype.slice.call(arguments,1),s.apply(this,o)}else if(r(s))for(o=Array.prototype.slice.call(arguments,1),n=(h=s.slice()).length,l=0;l0&&this._events[e].length>n&&(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},s.prototype.on=s.prototype.addListener,s.prototype.once=function(e,t){function s(){this.removeListener(e,s),n||(n=!0,t.apply(this,arguments))}if(!i(t))throw TypeError("listener must be a function");var n=!1;return s.listener=t,this.on(e,s),this},s.prototype.removeListener=function(e,t){var s,n,a,o;if(!i(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(s=this._events[e],a=s.length,n=-1,s===t||i(s.listener)&&s.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(r(s)){for(o=a;o-- >0;)if(s[o]===t||s[o].listener&&s[o].listener===t){n=o;break}if(n<0)return this;1===s.length?(s.length=0,delete this._events[e]):s.splice(n,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},s.prototype.removeAllListeners=function(e){var t,s;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(s=this._events[e],i(s))this.removeListener(e,s);else if(s)for(;s.length;)this.removeListener(e,s[s.length-1]);return delete this._events[e],this},s.prototype.listeners=function(e){return this._events&&this._events[e]?i(this._events[e])?[this._events[e]]:this._events[e].slice():[]},s.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(i(t))return 1;if(t)return t.length}return 0},s.listenerCount=function(e,t){return e.listenerCount(t)}},function(e,t,s){const i=s(18),{Presence:n}=s(14),r=s(100),a=s(8),o=s(6),{Error:l}=s(4);class User extends o{constructor(e,t){super(e),this.id=t.id,this.bot=Boolean(t.bot),this._patch(t)}_patch(e){e.username&&(this.username=e.username),e.discriminator&&(this.discriminator=e.discriminator),void 0!==e.avatar&&(this.avatar=e.avatar),this.lastMessageID=null,this.lastMessage=null}get createdTimestamp(){return a.deconstruct(this.id).timestamp}get createdAt(){return new Date(this.createdTimestamp)}get presence(){if(this.client.presences.has(this.id))return this.client.presences.get(this.id);for(const e of this.client.guilds.values())if(e.presences.has(this.id))return e.presences.get(this.id);return new n(this.client)}avatarURL({format:e,size:t}={}){return this.avatar?this.client.rest.cdn.Avatar(this.id,this.avatar,e,t):null}get defaultAvatarURL(){return this.client.rest.cdn.DefaultAvatar(this.discriminator%5)}displayAvatarURL(e){return this.avatarURL(e)||this.defaultAvatarURL}get tag(){return`${this.username}#${this.discriminator}`}get note(){return this.client.user.notes.get(this.id)||null}typingIn(e){return(e=this.client.channels.resolve(e))._typing.has(this.id)}typingSinceIn(e){return(e=this.client.channels.resolve(e))._typing.has(this.id)?new Date(e._typing.get(this.id).since):null}typingDurationIn(e){return(e=this.client.channels.resolve(e))._typing.has(this.id)?e._typing.get(this.id).elapsedTime:-1}get dmChannel(){return this.client.channels.filter(e=>"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 l("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(){}}i.applyToClass(User),e.exports=User},function(e,t,s){const i=s(8),n=s(10),r=s(5),a=s(6),{TypeError:o}=s(4);class Role extends a{constructor(e,t,s){super(e),this.guild=s,t&&this._patch(t)}_patch(e){this.id=e.id,this.name=e.name,this.color=e.color,this.hoist=e.hoist,this.rawPosition=e.position,this.permissions=new n(e.permissions).freeze(),this.managed=e.managed,this.mentionable=e.mentionable}get createdTimestamp(){return i.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(n.FLAGS.MANAGE_ROLES)&&e.highestRole.comparePositionTo(this)>0}get position(){const e=this.guild._sortedRoles();return e.array().indexOf(e.get(this.id))}comparePositionTo(e){return(e=this.guild.roles.resolve(e))?this.constructor.comparePositions(this,e):Promise.reject(new o("INVALID_TYPE","role","Role nor a Snowflake"))}async edit(e,t){return e.permissions?e.permissions=n.resolve(e.permissions):e.permissions=this.permissions.bitfield,void 0!==e.position&&await r.setPosition(this,e.position,!1,this.guild._sortedRoles(),this.client.api.guilds(this.guild.id).roles,t).then(e=>{this.client.actions.GuildRolesPositionUpdate.handle({guild_id:this.guild.id,roles:e})}),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,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)}setPermissions(e,t){return this.edit({permissions:e},t)}setMentionable(e,t){return this.edit({mentionable:e},t)}setPosition(e,{relative:t,reason:s}={}){return r.setPosition(this,e,t,this.guild._sortedRoles(),this.client.api.guilds(this.guild.id).roles,s).then(e=>(this.client.actions.GuildRolesPositionUpdate.handle({guild_id:this.guild.id,roles:e}),this))}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.bitfield===e.permissions.bitfield&&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,s){const{Endpoints:i}=s(0),n=s(6);class Invite extends n{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 i.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,s){const i=s(24),n=s(56),r=s(17),a=s(13),o=s(35),{ChannelTypes:l,Events:h,browser:c}=s(0),d=s(3),u=s(5),f=s(9),p=s(8),m=s(10),g=s(45),_=s(57),E=s(58),v=s(36),b=s(59),w=s(37),y=s(6),{Error:A,TypeError:T}=s(4);class Guild extends y{constructor(e,t){super(e),this.members=new _(this),this.channels=new b(this),this.roles=new E(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 v(this),e.emojis)for(const t of e.emojis)this.emojis.create(t)}get createdTimestamp(){return p.deconstruct(this.id).timestamp}get createdAt(){return new Date(this.createdTimestamp)}get joinedAt(){return new Date(this.joinedTimestamp)}get verified(){return this.features.includes("VERIFIED")}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 c?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)}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 d))}fetchInvites(){return this.client.api.guilds(this.id).invites.get().then(e=>{const t=new d;for(const s of e){const e=new i(this.client,s);t.set(e.code,e)}return t})}fetchWebhooks(){return this.client.api.guilds(this.id).webhooks.get().then(e=>{const t=new d;for(const s of e)t.set(s.id,new r(this.client,s));return t})}fetchVoiceRegions(){return this.client.api.guilds(this.id).regions.get().then(e=>{const t=new d;for(const s of e)t.set(s.id,new o(s));return t})}fetchAuditLogs(e={}){return e.before&&e.before instanceof n.Entry&&(e.before=e.before.id),e.after&&e.after instanceof n.Entry&&(e.after=e.after.id),"string"==typeof e.type&&(e.type=n.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=>n.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 s of t.roles instanceof d?t.roles.values():t.roles){if(!(s=this.roles.resolve(s)))return Promise.reject(new T("INVALID_TYPE","options.roles","Array or Collection of Roles or Snowflakes",!0));e.push(s.id)}}return this.client.api.guilds(this.id).members(e.id).put({data:t}).then(e=>this.members.create(e))}search(e={}){return g.search(this,e)}edit(e,t){const s={};return e.name&&(s.name=e.name),e.region&&(s.region=e.region),void 0!==e.verificationLevel&&(s.verification_level=Number(e.verificationLevel)),void 0!==e.afkChannel&&(s.afk_channel_id=this.client.channels.resolveID(e.afkChannel)),void 0!==e.systemChannel&&(s.system_channel_id=this.client.channels.resolveID(e.systemChannel)),e.afkTimeout&&(s.afk_timeout=Number(e.afkTimeout)),void 0!==e.icon&&(s.icon=e.icon),e.owner&&(s.owner_id=this.client.users.resolve(e.owner).id),e.splash&&(s.splash=e.splash),void 0!==e.explicitContentFilter&&(s.explicit_content_filter=Number(e.explicitContentFilter)),this.client.api.guilds(this.id).patch({data:s,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),reason:t})}setOwner(e,t){return this.edit({owner:e},t)}async setSplash(e,t){return this.edit({splash:await f.resolveImage(e),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 s=this.client.users.resolveID(e);return s?this.client.api.guilds(this.id).bans[s].put({query:t}).then(()=>{if(e instanceof a)return e;const t=this.client.users.resolve(s);return t?this.members.resolve(t)||t:s}):Promise.reject(new A("BAN_RESOLVE_ID",!0))}unban(e,t){const s=this.client.users.resolveID(e);if(!s)throw new A("BAN_RESOLVE_ID");return this.client.api.guilds(this.id).bans[s].delete({reason:t}).then(()=>e)}pruneMembers({days:e=7,dry:t=!1,reason:s}={}){if("number"!=typeof e)throw new T("PRUNE_DAYS_TYPE");return this.client.api.guilds(this.id).prune[t?"get":"post"]({query:{days:e},reason:s}).then(e=>e.pruned)}sync(){this.client.user.bot||this.client.syncGuilds([this])}createChannel(e,t,{nsfw:s,bitrate:i,userLimit:n,parent:r,overwrites:a,reason:o}={}){return(a instanceof d||a instanceof Array)&&(a=a.map(e=>{let t=e.allow||(e.allowed?e.allowed.bitfield:0),s=e.deny||(e.denied?e.denied.bitfield:0);t instanceof Array&&(t=m.resolve(t)),s instanceof Array&&(s=m.resolve(s));const i=this.roles.resolve(e.id);return i?(e.id=i.id,e.type="role"):(e.id=this.client.users.resolveID(e.id),e.type="member"),{allow:t,deny:s,type:e.type,id:e.id}})),r&&(r=this.client.channels.resolveID(r)),this.client.api.guilds(this.id).channels.post({data:{name:e,type:l[t.toUpperCase()],nsfw:s,bitrate:i,user_limit:n,parent_id:r,permission_overwrites:a},reason:o}).then(e=>this.client.actions.ChannelCreate.handle(e).channel)}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=u.resolveColor(e.color)),e.permissions&&(e.permissions=m.resolve(e.permissions)),this.client.api.guilds(this.id).roles.post({data:e,reason:t}).then(s=>{const{role:i}=this.client.actions.GuildRoleCreate.handle({guild_id:this.id,role:s});return e.position?i.setPosition(e.position,t):i})}createEmoji(e,t,{roles:s,reason:i}={}){if("string"==typeof e&&e.startsWith("data:")){const n={image:e,name:t};if(s){n.roles=[];for(let e of s instanceof d?s.values():s){if(!(e=this.roles.resolve(e)))return Promise.reject(new T("INVALID_TYPE","options.roles","Array or Collection of Roles or Snowflakes",!0));n.roles.push(e.id)}}return this.client.api.guilds(this.id).emojis.post({data:n,reason:i}).then(e=>this.client.actions.GuildEmojiCreate.handle(this,e).emoji)}return f.resolveImage(e).then(e=>this.createEmoji(e,t,{roles:s,reason:i}))}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&&u.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 s=this.members.get(e);s&&s.speaking!==t&&(s.speaking=t,this.client.emit(h.GUILD_MEMBER_SPEAKING,s,t))}_sortedRoles(){return u.discordSort(this.roles)}_sortedChannels(e){const t=e.type===l.CATEGORY;return u.discordSort(this.channels.filter(s=>s.type===e.type&&(t||s.parent===e.parent)))}}class VoiceStateCollection extends d{constructor(e){super(),this.guild=e}set(e,t){const s=this.guild.members.get(e);if(s){s.voiceChannel&&s.voiceChannel.id!==t.channel_id&&s.voiceChannel.members.delete(s.id),t.channel_id||(s.speaking=null);const e=this.guild.channels.get(t.channel_id);e&&e.members.set(s.user.id,s)}super.set(e,t)}}e.exports=Guild},function(e,t,s){var i,n,r;!function(s,a){n=[],void 0!==(r="function"==typeof(i=a)?i.apply(t,n):i)&&(e.exports=r)}(0,function(){"use strict";function e(e,t,s){this.low=0|e,this.high=0|t,this.unsigned=!!s}function t(e){return!0===(e&&e.__isLong__)}function s(e,t){var s,i,r;return t?(e>>>=0,(r=0<=e&&e<256)&&(i=l[e])?i:(s=n(e,(0|e)<0?-1:0,!0),r&&(l[e]=s),s)):(e|=0,(r=-128<=e&&e<128)&&(i=o[e])?i:(s=n(e,e<0?-1:0,!1),r&&(o[e]=s),s))}function i(e,t){if(isNaN(e)||!isFinite(e))return t?m:p;if(t){if(e<0)return m;if(e>=d)return b}else{if(e<=-u)return w;if(e+1>=u)return v}return e<0?i(-e,t).neg():n(e%c|0,e/c|0,t)}function n(t,s,i){return new e(t,s,i)}function r(e,t,s){if(0===e.length)throw Error("empty string");if("NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return p;if("number"==typeof t?(s=t,t=!1):t=!!t,(s=s||10)<2||360)throw Error("interior hyphen");if(0===n)return r(e.substring(1),t,s).neg();for(var a=i(h(s,8)),o=p,l=0;l>>0:this.low},y.toNumber=function(){return this.unsigned?(this.high>>>0)*c+(this.low>>>0):this.high*c+(this.low>>>0)},y.toString=function(e){if((e=e||10)<2||36>>0).toString(e);if((a=l).isZero())return c+o;for(;c.length<6;)c="0"+c;o=""+c+o}},y.getHighBits=function(){return this.high},y.getHighBitsUnsigned=function(){return this.high>>>0},y.getLowBits=function(){return this.low},y.getLowBitsUnsigned=function(){return this.low>>>0},y.getNumBitsAbs=function(){if(this.isNegative())return this.eq(w)?64:this.neg().getNumBitsAbs();for(var e=0!=this.high?this.high:this.low,t=31;t>0&&0==(e&1<=0},y.isOdd=function(){return 1==(1&this.low)},y.isEven=function(){return 0==(1&this.low)},y.equals=function(e){return t(e)||(e=a(e)),(this.unsigned===e.unsigned||this.high>>>31!=1||e.high>>>31!=1)&&(this.high===e.high&&this.low===e.low)},y.eq=y.equals,y.notEquals=function(e){return!this.eq(e)},y.neq=y.notEquals,y.lessThan=function(e){return this.comp(e)<0},y.lt=y.lessThan,y.lessThanOrEqual=function(e){return this.comp(e)<=0},y.lte=y.lessThanOrEqual,y.greaterThan=function(e){return this.comp(e)>0},y.gt=y.greaterThan,y.greaterThanOrEqual=function(e){return this.comp(e)>=0},y.gte=y.greaterThanOrEqual,y.compare=function(e){if(t(e)||(e=a(e)),this.eq(e))return 0;var s=this.isNegative(),i=e.isNegative();return s&&!i?-1:!s&&i?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},y.comp=y.compare,y.negate=function(){return!this.unsigned&&this.eq(w)?w:this.not().add(g)},y.neg=y.negate,y.add=function(e){t(e)||(e=a(e));var s=this.high>>>16,i=65535&this.high,r=this.low>>>16,o=65535&this.low,l=e.high>>>16,h=65535&e.high,c=e.low>>>16,d=0,u=0,f=0,p=0;return p+=o+(65535&e.low),f+=p>>>16,p&=65535,f+=r+c,u+=f>>>16,f&=65535,u+=i+h,d+=u>>>16,u&=65535,d+=s+l,d&=65535,n(f<<16|p,d<<16|u,this.unsigned)},y.subtract=function(e){return t(e)||(e=a(e)),this.add(e.neg())},y.sub=y.subtract,y.multiply=function(e){if(this.isZero())return p;if(t(e)||(e=a(e)),e.isZero())return p;if(this.eq(w))return e.isOdd()?w:p;if(e.eq(w))return this.isOdd()?w:p;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(f)&&e.lt(f))return i(this.toNumber()*e.toNumber(),this.unsigned);var s=this.high>>>16,r=65535&this.high,o=this.low>>>16,l=65535&this.low,h=e.high>>>16,c=65535&e.high,d=e.low>>>16,u=65535&e.low,m=0,g=0,_=0,E=0;return E+=l*u,_+=E>>>16,E&=65535,_+=o*u,g+=_>>>16,_&=65535,_+=l*d,g+=_>>>16,_&=65535,g+=r*u,m+=g>>>16,g&=65535,g+=o*d,m+=g>>>16,g&=65535,g+=l*c,m+=g>>>16,g&=65535,m+=s*u+r*d+o*c+l*h,m&=65535,n(_<<16|E,m<<16|g,this.unsigned)},y.mul=y.multiply,y.divide=function(e){if(t(e)||(e=a(e)),e.isZero())throw Error("division by zero");if(this.isZero())return this.unsigned?m:p;var s,n,r;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return m;if(e.gt(this.shru(1)))return _;r=m}else{if(this.eq(w))return e.eq(g)||e.eq(E)?w:e.eq(w)?g:(s=this.shr(1).div(e).shl(1)).eq(p)?e.isNegative()?g:E:(n=this.sub(e.mul(s)),r=s.add(n.div(e)));if(e.eq(w))return this.unsigned?m:p;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=p}for(n=this;n.gte(e);){s=Math.max(1,Math.floor(n.toNumber()/e.toNumber()));for(var o=Math.ceil(Math.log(s)/Math.LN2),l=o<=48?1:h(2,o-48),c=i(s),d=c.mul(e);d.isNegative()||d.gt(n);)d=(c=i(s-=l,this.unsigned)).mul(e);c.isZero()&&(c=g),r=r.add(c),n=n.sub(d)}return r},y.div=y.divide,y.modulo=function(e){return t(e)||(e=a(e)),this.sub(this.div(e).mul(e))},y.mod=y.modulo,y.not=function(){return n(~this.low,~this.high,this.unsigned)},y.and=function(e){return t(e)||(e=a(e)),n(this.low&e.low,this.high&e.high,this.unsigned)},y.or=function(e){return t(e)||(e=a(e)),n(this.low|e.low,this.high|e.high,this.unsigned)},y.xor=function(e){return t(e)||(e=a(e)),n(this.low^e.low,this.high^e.high,this.unsigned)},y.shiftLeft=function(e){return t(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?n(this.low<>>32-e,this.unsigned):n(0,this.low<>>e|this.high<<32-e,this.high>>e,this.unsigned):n(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},y.shr=y.shiftRight,y.shiftRightUnsigned=function(e){if(t(e)&&(e=e.toInt()),0===(e&=63))return this;var s=this.high;return e<32?n(this.low>>>e|s<<32-e,s>>>e,this.unsigned):32===e?n(s,0,this.unsigned):n(s>>>e-32,0,this.unsigned)},y.shru=y.shiftRightUnsigned,y.toSigned=function(){return this.unsigned?n(this.low,this.high,!1):this},y.toUnsigned=function(){return this.unsigned?this:n(this.low,this.high,!0)},y.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},y.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]},y.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,s){e.exports=s(75)},function(e,t,s){"use strict";t.decode=t.parse=s(76),t.encode=t.stringify=s(77)},function(e,t,s){const i=s(21),n=s(82),r=s(5),{DefaultOptions:a}=s(0);class BaseClient extends i{constructor(e={}){super(),this.options=r.mergeDefault(a,e),this.rest=new n(this,e._tokenType),this._timeouts=new Set,this._intervals=new Set}get api(){return this.rest.api}destroy(){for(const e of this._timeouts)clearTimeout(e);for(const e of this._intervals)clearInterval(e);this._timeouts.clear(),this._intervals.clear()}setTimeout(e,t,...s){const i=setTimeout(()=>{e(...s),this._timeouts.delete(i)},t);return this._timeouts.add(i),i}clearTimeout(e){clearTimeout(e),this._timeouts.delete(e)}setInterval(e,t,...s){const i=setInterval(e,t,...s);return this._intervals.add(i),i}clearInterval(e){clearInterval(e),this._intervals.delete(e)}}e.exports=BaseClient},function(e,t,s){const i=s(3),n=s(21);class Collector extends n{constructor(e,t,s={}){super(),Object.defineProperty(this,"client",{value:e}),this.filter=t,this.options=s,this.collected=new i,this.ended=!1,this._timeout=null,this.handleCollect=this.handleCollect.bind(this),this.handleDispose=this.handleDispose.bind(this),s.time&&(this._timeout=this.client.setTimeout(()=>this.stop("time"),s.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 s=this.collected.get(t);this.collected.delete(t),this.emit("dispose",s,...e),this.checkEnd()}get next(){return new Promise((e,t)=>{if(this.ended)return void t(this.collected);const s=()=>{this.removeListener("collect",i),this.removeListener("end",n)},i=t=>{s(),e(t)},n=()=>{s(),t(this.collected)};this.on("collect",i),this.on("end",n)})}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,s){const i=s(47),n=s(20),r=s(15),a=s(48),o=s(32),l=s(5),h=s(3),c=s(98),{MessageTypes:d}=s(0),u=s(10),f=s(13),p=s(6),{Error:m,TypeError:g}=s(4);class Message extends p{constructor(e,t,s){super(e),this.channel=s,t&&this._patch(t)}_patch(e){this.id=e.id,this.type=d[e.type],this.content=e.content,this.author=this.client.users.create(e.author,!e.webhook_id),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 h;for(const t of e.attachments)this.attachments.set(t.id,new n(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 c(this),e.reactions&&e.reactions.length>0)for(const t of e.reactions)this.reactions.create(t);this.mentions=new i(this,e.mentions,e.mention_roles,e.mention_everyone),this.webhookID=e.webhook_id||null,this.application=e.application?new o(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 h;for(const t of e.attachments)this.attachments.set(t.id,new n(t.url,t.filename,t))}else this.attachments=new h(this.attachments);this.mentions=new i(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 s=this.channel.guild.members.get(t);if(s)return s.nickname?`@${s.nickname}`:`@${s.user.username}`;{const s=this.client.users.get(t);return s?`@${s.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 a(this,e,t)}awaitReactions(e,t={}){return new Promise((s,i)=>{this.createReactionCollector(e,t).once("end",(e,n)=>{t.errors&&t.errors.includes(n)?i(e):s(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(u.FLAGS.MANAGE_MESSAGES)}get pinnable(){return!this.guild||this.channel.permissionsFor(this.client.user).has(u.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=l.resolveString(e));let{embed:s,code:i,reply:n}=t;if(s&&(s=new r(s)._apiTransform()),void 0===i||"boolean"==typeof i&&!0!==i||(e=l.escapeMarkdown(l.resolveString(e),!0),e=`\`\`\`${"boolean"!=typeof i?i||"":""}\n${e}\n\`\`\``),n&&"dm"!==this.channel.type){const t=this.client.users.resolveID(n);e=`${`<@${n instanceof f&&n.nickname?"!":""}${t}>`}${e?`, ${e}`:""}`}return this.client.api.channels[this.channel.id].messages[this.id].patch({data:{content:e,embed:s}}).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 g("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:l.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(s=>{this.client.setTimeout(()=>{s(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 m("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 s=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 s&&t&&(s=this.mentions.everyone===e.mentions.everyone&&this.createdTimestamp===new Date(t.timestamp).getTime()&&this.editedTimestamp===new Date(t.edited_timestamp).getTime()),s}toString(){return this.content}}e.exports=Message},function(e,t,s){const i=s(8),{ClientApplicationAssetTypes:n,Endpoints:r}=s(0),a=s(9),o=s(6);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 i.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?r.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(n)[e.type-1]})))}createAsset(e,t,s){return a.resolveBase64(t).then(t=>this.client.api.applications(this.id).assets.post({data:{name:e,data:t,type:n[s.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,s){const i=s(3),n=s(8),r=s(6),{TypeError:a}=s(4);class Emoji extends r{constructor(e,t,s){super(e),this.guild=s,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 n.deconstruct(this.id).timestamp}get createdAt(){return new Date(this.createdTimestamp)}get roles(){const e=new i;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 i(this.roles);for(let s of e instanceof i?e.values():e){if(!(s=this.guild.roles.resolve(s)))return Promise.reject(new a("INVALID_TYPE","roles","Array or Collection of Roles or Snowflakes",!0));t.set(s.id,s)}return this.edit({roles:t})}removeRestrictedRole(e){return this.removeRestrictedRoles([e])}removeRestrictedRoles(e){const t=new i(this.roles);for(let s of e instanceof i?e.values():e){if(!(s=this.guild.roles.resolve(s)))return Promise.reject(new a("INVALID_TYPE","roles","Array or Collection of Roles or Snowflakes",!0));t.has(s.id)&&t.delete(s.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,s){this.reaction=e,this.name=t,this.id=s}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){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,s){const i=s(7),n=s(33),r=s(34);class EmojiStore extends i{constructor(e,t){super(e.client,t,n),this.guild=e}create(e,t){return 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,s){const i=s(7),{Presence:n}=s(14);class PresenceStore extends i{constructor(e,t){super(e,t,n)}create(e,t){const s=this.get(e.user.id);return s?s.patch(e):super.create(e,t,{id:e.user.id})}resolve(e){const t=super.resolve(e);if(t)return t;const s=this.client.users.resolveID(e);return super.resolve(s)||null}resolveID(e){const t=super.resolveID(e);if(t)return t;const s=this.client.users.resolveID(e);return this.has(s)?s:null}}e.exports=PresenceStore},function(e,t,s){const{UserGuildSettingsMap:i}=s(0),n=s(3),r=s(62);class ClientUserGuildSettings{constructor(e,t){Object.defineProperty(this,"client",{value:e}),this.guildID=t.guild_id,this.channelOverrides=new n,this.patch(t)}patch(e){for(const[t,s]of Object.entries(i))if(e.hasOwnProperty(t))if("channel_overrides"===t)for(const s of e[t]){const e=this.channelOverrides.get(s.channel_id);e?e.patch(s):this.channelOverrides.set(s.channel_id,new r(s))}else"function"==typeof s?this[s.name]=s(e[t]):this[s]=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,s){"use strict";e.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},function(e,t){e.exports={version:"12.0.0-dev",homepage:"https://github.com/hydrabolt/discord.js#readme"}},function(e,t){function s(e){return class DiscordjsError extends e{constructor(e,...t){super(i(e,t)),this[n]=e,Error.captureStackTrace&&Error.captureStackTrace(this,DiscordjsError)}get name(){return`${super.name} [${this[n]}]`}get code(){return this[n]}}}function i(e,t){if("string"!=typeof e)throw new Error("Error message key must be a string");const s=r.get(e);if(!s)throw new Error(`An invalid error message key was used: ${e}.`);return"function"==typeof s?s(...t):void 0===t||0===t.length?s:(t.unshift(s),String(...t))}const n=Symbol("code"),r=new Map;e.exports={register:function(e,t){r.set(e,"function"==typeof t?t:String(t))},Error:s(Error),TypeError:s(TypeError),RangeError:s(RangeError)}},function(e,t){class DiscordAPIError extends Error{constructor(e,t){super();const s=this.constructor.flattenErrors(t.errors||t).join("\n");this.name="DiscordAPIError",this.message=t.message&&s?`${t.message}\n${s}`:t.message||s,this.path=e,this.code=t.code}static flattenErrors(e,t=""){let s=[];for(const[i,n]of Object.entries(e)){if("message"===i)continue;const e=t?isNaN(i)?`${t}.${i}`:`${t}[${i}]`:i;n._errors?s.push(`${e}: ${n._errors.map(e=>e.message).join(" ")}`):n.code||n.message?s.push(`${n.code?`${n.code}: `:""}${n.message}`.trim()):"string"==typeof n?s.push(n):s=s.concat(this.flattenErrors(n,e))}return s}}e.exports=DiscordAPIError},function(e,t,s){const i=s(22),n=s(3),r=s(61),a=s(38),{Events:o}=s(0),l=s(5),h=s(9),c=s(25);class ClientUser extends i{_patch(e){if(super._patch(e),this.verified=e.verified,this.email=e.email,this._typing=new Map,this.friends=new n,this.blocked=new n,this.notes=new n,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 n,e.user_guild_settings)for(const t of e.user_guild_settings)this.guildSettings.set(t.guild_id,new a(this.client,t));e.token&&(this.client.token=e.token)}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 h.resolveImage(e)})}setPresence(e){return this.client.presences.setClientPresence(e)}setStatus(e){return this.setPresence({status:e})}setActivity(e,{url:t,type:s}={}){return e?this.setPresence({activity:{name:e,type:s,url:t}}):this.setPresence({activity:null})}setAFK(e){return this.setPresence({afk:e})}fetchMentions(e={}){return e.guild instanceof c&&(e.guild=e.guild.id),l.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:s=null}={}){return!s||"string"==typeof s&&s.startsWith("data:")?new Promise((i,n)=>this.client.api.guilds.post({data:{name:e,region:t,icon:s}}).then(e=>{if(this.client.guilds.has(e.id))return i(this.client.guilds.get(e.id));const t=n=>{n.id===e.id&&(this.client.removeListener(o.GUILD_CREATE,t),this.client.clearTimeout(s),i(n))};this.client.on(o.GUILD_CREATE,t);const s=this.client.setTimeout(()=>{this.client.removeListener(o.GUILD_CREATE,t),i(this.client.guilds.create(e))},1e4)},n)):h.resolveImage(s).then(s=>this.createGuild(e,{region:t,icon:s||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,s){const i=s(30),{Events:n}=s(0);class MessageCollector extends i{constructor(e,t,s={}){super(e.client,t,s),this.channel=e,this.received=0;const i=(e=>{for(const t of e.values())this.handleDispose(t)}).bind(this);this.client.on(n.MESSAGE_CREATE,this.handleCollect),this.client.on(n.MESSAGE_DELETE,this.handleDispose),this.client.on(n.MESSAGE_BULK_DELETE,i),this.once("end",()=>{this.client.removeListener(n.MESSAGE_CREATE,this.handleCollect),this.client.removeListener(n.MESSAGE_DELETE,this.handleDispose),this.client.removeListener(n.MESSAGE_BULK_DELETE,i)})}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,s){e.exports={search:s(97),sendMessage:s(99)}},function(e,t,s){const i=s(12),n=s(18),r=s(19);class DMChannel extends i{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(){}}n.applyToClass(DMChannel,!0,["bulkDelete"]),e.exports=DMChannel},function(e,t,s){const i=s(3),n=s(13);class MessageMentions{constructor(e,t,s,n){if(this.everyone=Boolean(n),t)if(t instanceof i)this.users=new i(t);else{this.users=new i;for(const s of t){let t=e.client.users.create(s);this.users.set(t.id,t)}}else this.users=new i;if(s)if(s instanceof i)this.roles=new i(s);else{this.roles=new i;for(const t of s){const s=e.channel.guild.roles.get(t);s&&this.roles.set(s.id,s)}}else this.roles=new i;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 i,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 i;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 n)for(const t of this.roles.values())if(e.roles.has(t.id))return!0;const s=e.id||e;return this.users.has(s)||this.channels.has(s)||this.roles.has(s)}}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,s){const i=s(30),n=s(3),{Events:r}=s(0);class ReactionCollector extends i{constructor(e,t,s={}){super(e.client,t,s),this.message=e,this.users=new n,this.total=0,this.empty=this.empty.bind(this),this.client.on(r.MESSAGE_REACTION_ADD,this.handleCollect),this.client.on(r.MESSAGE_REACTION_REMOVE,this.handleDispose),this.client.on(r.MESSAGE_REACTION_REMOVE_ALL,this.empty),this.once("end",()=>{this.client.removeListener(r.MESSAGE_REACTION_ADD,this.handleCollect),this.client.removeListener(r.MESSAGE_REACTION_REMOVE,this.handleDispose),this.client.removeListener(r.MESSAGE_REACTION_REMOVE_ALL,this.empty)}),this.on("collect",(e,t,s)=>{this.total++,this.users.set(s.id,s)}),this.on("dispose",(e,t,s)=>{this.total--,this.collected.some(e=>e.users.has(s.id))||this.users.delete(s.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){},function(e,t,s){const i=s(3),n=s(33),r=s(34),{Error:a}=s(4);class MessageReaction{constructor(e,t,s){this.message=s,this.me=t.me,this.count=t.count||0,this.users=new i,this._emoji=new r(this,t.emoji.name,t.emoji.id)}get emoji(){if(this._emoji instanceof n)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 a("REACTION_RESOLVE_USER"))}async fetchUsers({limit:e=100,after:t}={}){const s=this.message,i=await s.client.api.channels[s.channel.id].messages[s.id].reactions[this.emoji.identifier].get({query:{limit:e,after:t}});for(const e of i){const t=s.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,s){const i=s(12),n=s(18),r=s(3),a=s(9),o=s(19);class GroupDMChannel extends i{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 a.resolveImage(e)})}setName(e){return this.edit({name:e})}addUser({user:e,accessToken:t,nick:s}){const i=this.client.users.resolveID(e),n=this.client.user.bot?{nick:s,access_token:t}:{recipient:i};return this.client.api.channels[this.id].recipients[i].put({data:n}).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(){}}n.applyToClass(GroupDMChannel,!0,["bulkDelete"]),e.exports=GroupDMChannel},function(e,t,s){const i=s(16),n=s(17),r=s(18),a=s(3),o=s(9),l=s(19);class TextChannel extends i{constructor(e,t){super(e,t),this.messages=new l(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)}setNSFW(e,t){return this.edit({nsfw:e},t)}fetchWebhooks(){return this.client.api.channels[this.id].webhooks.get().then(e=>{const t=new a;for(const s of e)t.set(s.id,new n(this.client,s));return t})}async createWebhook(e,{avatar:t,reason:s}={}){return"string"!=typeof t||t.startsWith("data:")||(t=await o.resolveImage(t)),this.client.api.channels[this.id].webhooks.post({data:{name:e,avatar:t},reason:s}).then(e=>new n(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,s){const i=s(10);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=new i(e.deny).freeze(),this.allowed=new i(e.allow).freeze()}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,s){const i=s(16),n=s(3),{browser:r}=s(0),{Error:a}=s(4);class VoiceChannel extends i{constructor(e,t){super(e,t),Object.defineProperty(this,"members",{value:new n})}_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!r&&(!!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 r?Promise.reject(new a("VOICE_NO_BROWSER")):this.client.voice.joinChannel(this)}leave(){if(r)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,s){const i=s(16);class CategoryChannel extends i{get children(){return this.guild.channels.filter(e=>e.parentID===this.id)}}e.exports=CategoryChannel},function(e,t,s){const i=s(3),n=s(8),r=s(17),a={ALL:"ALL",GUILD:"GUILD",CHANNEL:"CHANNEL",USER:"USER",ROLE:"ROLE",INVITE:"INVITE",WEBHOOK:"WEBHOOK",EMOJI:"EMOJI",MESSAGE:"MESSAGE",UNKNOWN:"UNKNOWN"},o={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 s of t.users)e.client.users.create(s);if(this.webhooks=new i,t.webhooks)for(const s of t.webhooks)this.webhooks.set(s.id,new r(e.client,s));this.entries=new i;for(const s of t.audit_log_entries){const t=new GuildAuditLogsEntry(this,e,s);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?a.GUILD:e<20?a.CHANNEL:e<30?a.USER:e<40?a.ROLE:e<50?a.INVITE:e<60?a.WEBHOOK:e<70?a.EMOJI:e<80?a.MESSAGE:a.UNKNOWN}static actionType(e){return[o.CHANNEL_CREATE,o.CHANNEL_OVERWRITE_CREATE,o.MEMBER_BAN_REMOVE,o.ROLE_CREATE,o.INVITE_CREATE,o.WEBHOOK_CREATE,o.EMOJI_CREATE].includes(e)?"CREATE":[o.CHANNEL_DELETE,o.CHANNEL_OVERWRITE_DELETE,o.MEMBER_KICK,o.MEMBER_PRUNE,o.MEMBER_BAN_ADD,o.ROLE_DELETE,o.INVITE_DELETE,o.WEBHOOK_DELETE,o.EMOJI_DELETE,o.MESSAGE_DELETE].includes(e)?"DELETE":[o.GUILD_UPDATE,o.CHANNEL_UPDATE,o.CHANNEL_OVERWRITE_UPDATE,o.MEMBER_UPDATE,o.MEMBER_ROLE_UPDATE,o.ROLE_UPDATE,o.INVITE_UPDATE,o.WEBHOOK_UPDATE,o.EMOJI_UPDATE].includes(e)?"UPDATE":"ALL"}}class GuildAuditLogsEntry{constructor(e,t,s){const i=GuildAuditLogs.targetType(s.action_type);if(this.targetType=i,this.actionType=GuildAuditLogs.actionType(s.action_type),this.action=Object.keys(o).find(e=>o[e]===s.action_type),this.reason=s.reason||null,this.executor=t.client.users.get(s.user_id),this.changes=s.changes?s.changes.map(e=>({key:e.key,old:e.old_value,new:e.new_value})):null,this.id=s.id,this.extra=null,s.options)if(s.action_type===o.MEMBER_PRUNE)this.extra={removed:s.options.members_removed,days:s.options.delete_member_days};else if(s.action_type===o.MESSAGE_DELETE)this.extra={count:s.options.count,channel:t.channels.get(s.options.channel_id)};else switch(s.options.type){case"member":this.extra=t.members.get(s.options.id),this.extra||(this.extra={id:s.options.id});break;case"role":this.extra=t.roles.get(s.options.id),this.extra||(this.extra={id:s.options.id,name:s.options.role_name})}if(i===a.UNKNOWN)this.target=this.changes.reduce((e,t)=>(e[t.key]=t.new||t.old,e),{}),this.target.id=s.target_id;else if([a.USER,a.GUILD].includes(i))this.target=t.client[`${i.toLowerCase()}s`].get(s.target_id);else if(i===a.WEBHOOK)this.target=e.webhooks.get(s.target_id)||new r(t.client,this.changes.reduce((e,t)=>(e[t.key]=t.new||t.old,e),{id:s.target_id,guild_id:t.id}));else if(i===a.INVITE)if(t.me.permissions.has("MANAGE_GUILD")){const e=this.changes.find(e=>"code"===e.key);this.target=t.fetchInvites().then(t=>(this.target=t.find(t=>t.code===(e.new||e.old)),this.target))}else this.target=this.changes.reduce((e,t)=>(e[t.key]=t.new||t.old,e),{});else this.target=i===a.MESSAGE?t.client.users.get(s.target_id):t[`${i.toLowerCase()}s`].get(s.target_id)}get createdTimestamp(){return n.deconstruct(this.id).timestamp}get createdAt(){return new Date(this.createdTimestamp)}}GuildAuditLogs.Actions=o,GuildAuditLogs.Targets=a,GuildAuditLogs.Entry=GuildAuditLogsEntry,e.exports=GuildAuditLogs},function(e,t,s){const i=s(7),n=s(13),{Events:r,OPCodes:a}=s(0),o=s(3),{Error:l}=s(4);class GuildMemberStore extends i{constructor(e,t){super(e.client,t,n),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 s=this.client.users.resolveID(e);return s?super.resolve(s):null}resolveID(e){const t=super.resolveID(e);if(t)return t;const s=this.client.users.resolveID(e);return this.has(s)?s:null}fetch(e){if(!e)return this._fetchMany();const t=this.client.users.resolveID(e);return t?this._fetchSingle({user:t,cache:!0}):e.user&&(e.user=this.client.users.resolveID(e.user),e.user)?this._fetchSingle(e):this._fetchMany(e)}_fetchSingle({user:e,cache:t}){const s=this.get(e);return s?Promise.resolve(s):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((s,i)=>{if(this.guild.memberCount===this.size)return void s(e||t?new o:this);this.guild.client.ws.send({op:a.REQUEST_GUILD_MEMBERS,d:{guild_id:this.guild.id,query:e,limit:t}});const n=new o,h=(i,a)=>{if(a.id===this.guild.id){for(const s of i.values())(e||t)&&n.set(s.id,s);(this.guild.memberCount<=this.size||(e||t)&&i.size<1e3||t&&n.size>=t)&&(this.guild.client.removeListener(r.GUILD_MEMBERS_CHUNK,h),s(e||t?n:this))}};this.guild.client.on(r.GUILD_MEMBERS_CHUNK,h),this.guild.client.setTimeout(()=>{this.guild.client.removeListener(r.GUILD_MEMBERS_CHUNK,h),i(new l("GUILD_MEMBERS_TIMEOUT"))},12e4)})}}e.exports=GuildMemberStore},function(e,t,s){const i=s(7),n=s(23);class RoleStore extends i{constructor(e,t){super(e.client,t,n),this.guild=e}create(e,t){return super.create(e,t,{extras:[this.guild]})}}e.exports=RoleStore},function(e,t,s){const i=s(7),n=s(12),r=s(16);class GuildChannelStore extends i{constructor(e,t){super(e.client,t,r),this.guild=e}create(e){const t=this.get(e.id);return t||n.create(this.client,e,this.guild)}}e.exports=GuildChannelStore},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,s){const{UserSettingsMap:i}=s(0),n=s(5),{Error:r}=s(4);class ClientUserSettings{constructor(e,t){this.user=e,this.patch(t)}patch(e){for(const[t,s]of Object.entries(i))e.hasOwnProperty(t)&&("function"==typeof s?this[s.name]=s(e[t]):this[s]=e[t])}update(e,t){return this.user.client.api.users["@me"].settings.patch({data:{[e]:t}})}setGuildPosition(e,t,s){const i=Object.assign([],this.guildPositions);return n.moveElementInArray(i,e.id,t,s),this.update("guild_positions",i).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),s=t.indexOf(e.id);return s<0?Promise.reject(new r("GUILD_RESTRICTED")):(t.splice(s,1),this.update("restricted_guilds",t).then(()=>e))}}e.exports=ClientUserSettings},function(e,t,s){const{UserChannelOverrideMap:i}=s(0);class ClientUserChannelOverride{constructor(e){this.patch(e)}patch(e){for(const[t,s]of Object.entries(i))e.hasOwnProperty(t)&&("function"==typeof s?this[s.name]=s(e[t]):this[s]=e[t])}}e.exports=ClientUserChannelOverride},function(e,t,s){const{browser:i}=s(0),n=s(28);try{var r=s(137);r.pack||(r=null)}catch(e){}if(i)t.WebSocket=window.WebSocket;else try{t.WebSocket=s(138)}catch(e){t.WebSocket=s(139)}t.encoding=r?"etf":"json",t.pack=r?r.pack:JSON.stringify,t.unpack=(e=>r&&"{"!==e[0]?(e instanceof Buffer||(e=Buffer.from(new Uint8Array(e))),r.unpack(e)):JSON.parse(e)),t.create=((e,s={},...r)=>{const[a,o]=e.split("?");s.encoding=t.encoding,o&&(s=Object.assign(n.parse(o),s));const l=new t.WebSocket(`${a}?${n.stringify(s)}`,...r);return i&&(l.binaryType="arraybuffer"),l});for(const e of["CONNECTING","OPEN","CLOSING","CLOSED"])t[e]=t.WebSocket[e]},function(e,t,s){"use strict";var i={};(0,s(11).assign)(i,s(141),s(144),s(69)),e.exports=i},function(e,t,s){"use strict";e.exports=function(e,t,s,i){for(var n=65535&e|0,r=e>>>16&65535|0,a=0;0!==s;){s-=a=s>2e3?2e3:s;do{r=r+(n=n+t[i++]|0)|0}while(--a);n%=65521,r%=65521}return n|r<<16|0}},function(e,t,s){"use strict";var i=function(){for(var e,t=[],s=0;s<256;s++){e=s;for(var i=0;i<8;i++)e=1&e?3988292384^e>>>1:e>>>1;t[s]=e}return t}();e.exports=function(e,t,s,n){var r=i,a=n+s;e^=-1;for(var o=n;o>>8^r[255&(e^t[o])];return-1^e}},function(e,t,s){"use strict";function i(e,t){if(t<65537&&(e.subarray&&a||!e.subarray&&r))return String.fromCharCode.apply(null,n.shrinkBuf(e,t));for(var s="",i=0;i=252?6:l>=248?5:l>=240?4:l>=224?3:l>=192?2:1;o[254]=o[254]=1,t.string2buf=function(e){var t,s,i,r,a,o=e.length,l=0;for(r=0;r>>6,t[a++]=128|63&s):s<65536?(t[a++]=224|s>>>12,t[a++]=128|s>>>6&63,t[a++]=128|63&s):(t[a++]=240|s>>>18,t[a++]=128|s>>>12&63,t[a++]=128|s>>>6&63,t[a++]=128|63&s);return t},t.buf2binstring=function(e){return i(e,e.length)},t.binstring2buf=function(e){for(var t=new n.Buf8(e.length),s=0,i=t.length;s4)h[n++]=65533,s+=a-1;else{for(r&=2===a?31:3===a?15:7;a>1&&s1?h[n++]=65533:r<65536?h[n++]=r:(r-=65536,h[n++]=55296|r>>10&1023,h[n++]=56320|1023&r)}return i(h,n)},t.utf8border=function(e,t){var s;for((t=t||e.length)>e.length&&(t=e.length),s=t-1;s>=0&&128==(192&e[s]);)s--;return s<0?t:0===s?t:s+o[e[s]]>t?s:t}},function(e,t,s){"use strict";e.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},function(e,t,s){"use strict";e.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},function(e,t,s){const i=s(7),n=s(22),r=s(13),a=s(31);class UserStore extends i{constructor(e,t){super(e,t,n)}resolve(e){return e instanceof r?e.user:e instanceof a?e.author:super.resolve(e)}resolveID(e){return e instanceof r?e.user.id:e instanceof a?e.author.id:super.resolveID(e)}fetch(e,t=!0){const s=this.get(e);return s?Promise.resolve(s):this.client.api.users(e).get().then(e=>this.create(e,t))}}e.exports=UserStore},function(e,t,s){const i=s(7),n=s(12),{Events:r}=s(0),a=Symbol("LRU"),o=["group","dm"];class ChannelStore extends i{constructor(e,t={},s){if(s||"function"==typeof t[Symbol.iterator]||(s=t,t=void 0),super(e,t,n),s.lru){const e=this[a]=[];e.add=(t=>{for(e.remove(t),e.unshift(t);e.length>s.lru;)this.remove(e[e.length-1])}),e.remove=(t=>{const s=e.indexOf(t);s>-1&&e.splice(s,1)})}}get(e,t=!1){const s=super.get(e);return s&&o.includes(s.type)?(!t&&this[a]&&this[a].add(e),s):s}set(e,t){return this[a]&&o.includes(t.type)&&this[a].add(e),super.set(e,t)}delete(e){const t=this.get(e,!0);return!!t&&(this[a]&&o.includes(t.type)&&this[a].remove(e),super.delete(e))}create(e,t,s=!0){const i=this.get(e.id);if(i)return i;const a=n.create(this.client,e,t);return a?(s&&this.set(a.id,a),a):(this.client.emit(r.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,s){const i=s(7),n=s(25);class GuildStore extends i{constructor(e,t){super(e,t,n)}}e.exports=GuildStore},function(e,t,s){const i=s(37),n=s(3),{ActivityTypes:r,OPCodes:a}=s(0),{Presence:o}=s(14),{TypeError:l}=s(4);class ClientPresenceStore extends i{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:s,activity:i}){const o=i&&(i.application?i.application.id||i.application:null);let h=new n;if(i){if("string"!=typeof i.name)throw new l("INVALID_TYPE","name","string");if(i.type||(i.type=0),i.assets&&o)try{const e=await this.client.api.oauth2.applications(o).assets.get();for(const t of e)h.set(t.name,t.id)}catch(e){}}const c={afk:null!=s&&s,since:null!=t?t:null,status:e||this.clientPresence.status,game:i?{type:"number"==typeof i.type?i.type:r.indexOf(i.type),name:i.name,url:i.url,details:i.details||void 0,state:i.state||void 0,assets:i.assets?{large_text:i.assets.largeText||void 0,small_text:i.assets.smallText||void 0,large_image:h.get(i.assets.largeImage)||i.assets.largeImage,small_image:h.get(i.assets.smallImage)||i.assets.smallImage}:void 0,timestamps:i.timestamps||void 0,party:i.party||void 0,application_id:o||void 0,secrets:i.secrets||void 0,instance:i.instance||void 0}:null};return this.clientPresence.patch(c),this.client.ws.send({op:a.STATUS_UPDATE,d:c}),this.clientPresence}}e.exports=ClientPresenceStore},function(e,t,s){const i=s(5);e.exports={BaseClient:s(29),Client:s(90),Shard:s(178),ShardClientUtil:s(179),ShardingManager:s(180),WebhookClient:s(181),Collection:s(3),Constants:s(0),DataResolver:s(9),DataStore:s(7),DiscordAPIError:s(42),Permissions:s(10),Snowflake:s(8),SnowflakeUtil:s(8),Util:i,util:i,version:s(40).version,ChannelStore:s(71),ClientPresenceStore:s(73),EmojiStore:s(36),GuildChannelStore:s(59),GuildMemberStore:s(57),GuildStore:s(72),MessageStore:s(19),PresenceStore:s(37),RoleStore:s(58),UserStore:s(70),escapeMarkdown:i.escapeMarkdown,fetchRecommendedShards:i.fetchRecommendedShards,splitMessage:i.splitMessage,Base:s(6),Activity:s(14).Activity,CategoryChannel:s(55),Channel:s(12),ClientApplication:s(32),ClientUser:s(43),ClientUserChannelOverride:s(62),ClientUserGuildSettings:s(38),ClientUserSettings:s(61),Collector:s(30),DMChannel:s(46),Emoji:s(33),GroupDMChannel:s(51),Guild:s(25),GuildAuditLogs:s(56),GuildChannel:s(16),GuildMember:s(13),Invite:s(24),Message:s(31),MessageAttachment:s(20),MessageCollector:s(44),MessageEmbed:s(15),MessageMentions:s(47),MessageReaction:s(50),PermissionOverwrites:s(53),Presence:s(14).Presence,ReactionCollector:s(48),ReactionEmoji:s(34),RichPresenceAssets:s(14).RichPresenceAssets,Role:s(23),TextChannel:s(52),User:s(22),UserConnection:s(60),VoiceChannel:s(54),VoiceRegion:s(35),Webhook:s(17),WebSocket:s(63)}},function(e,t,s){const i="undefined"!=typeof window,n=s(28),r=s(78),a=s(i?79:80);class Snekfetch extends a.Extension{constructor(e,t,s={version:1,qs:n,followRedirects:!0}){super(),this.options=s,this.request=a.buildRequest.call(this,e,t,s),s.query&&this.query(s.query),s.data&&this.send(s.data)}query(e,t){if(this._checkModify(),this.request.query||(this.request.query={}),null!==e&&"object"==typeof e)for(const[t,s]of Object.entries(e))this.query(t,s);else this.request.query[e]=t;return this}set(e,t){if(this._checkModify(),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){this._checkModify();const t=this._getFormData();if("object"==typeof e[0])for(const[t,s]of Object.entries(e[0]))this.attach(t,s);else t.append(...e);return this}send(e){if(this._checkModify(),e instanceof a.FormData||a.shouldSendRaw(e))this.data=e;else if(null!==e&&"object"==typeof e){const t=this.request.getHeader("content-type");let s;t?t.includes("json")?s=JSON.stringify:t.includes("urlencoded")&&(s=this.options.qs.stringify):(this.set("Content-Type","application/json"),s=JSON.stringify),this.data=s(e)}else this.data=e;return this}then(e,t){return this._response?this._response.then(e,t):this._response=a.finalizeRequest.call(this).then(({response:e,raw:t,redirect:s,headers:i})=>{if(s){let t=this.request.method;[301,302].includes(e.statusCode)?("HEAD"!==t&&(t="GET"),this.data=null):303===e.statusCode&&(t="GET");const i=this.request.getHeaders();return delete i.host,new Snekfetch(t,s,{data:this.data,headers:i})}const n=e.statusCode||e.status,r=this,o={request:this.request,get body(){delete o.body;const e=this.headers["content-type"];if(e&&e.includes("application/json"))try{o.body=JSON.parse(o.text)}catch(e){o.body=o.text}else e&&e.includes("application/x-www-form-urlencoded")?o.body=r.options.qs.parse(o.text):o.body=t;return o.body},text:t.toString(),ok:n>=200&&n<400,headers:i||e.headers,status:n,statusText:e.statusText||a.STATUS_CODES[e.statusCode]};if(o.ok)return o;{const e=new Error(`${o.status} ${o.statusText}`.trim());return Object.assign(e,o),Promise.reject(e)}}).then(e,t)}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):Promise.reject(t))}_getFormData(){return this.data instanceof a.FormData||(this.data=new a.FormData),this.data}_finalizeRequest(){if(this.request&&(this.request.getHeader("user-agent")||this.set("User-Agent",`snekfetch/${Snekfetch.version} (${r.homepage})`),"HEAD"!==this.request.method&&this.set("Accept-Encoding","gzip, deflate"),this.data&&this.data.getBoundary&&this.set("Content-Type",`multipart/form-data; boundary=${this.data.getBoundary()}`),this.request.query)){const[e,t]=this.request.path.split("?");this.request.path=`${e}?${this.options.qs.stringify(this.request.query)}${t?`&${t}`:""}`}}_checkModify(){if(this.response)throw new Error("Cannot modify request after it has been sent!")}}Snekfetch.version=r.version,Snekfetch.METHODS=a.METHODS.concat("BREW").filter(e=>"M-SEARCH"!==e);for(const e of Snekfetch.METHODS)Snekfetch[e.toLowerCase()]=((t,s)=>new Snekfetch(e,t,s));e.exports=Snekfetch},function(e,t,s){"use strict";function i(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.exports=function(e,t,s,r){t=t||"&",s=s||"=";var a={};if("string"!=typeof e||0===e.length)return a;var o=/\+/g;e=e.split(t);var l=1e3;r&&"number"==typeof r.maxKeys&&(l=r.maxKeys);var h=e.length;l>0&&h>l&&(h=l);for(var c=0;c=0?(d=m.substr(0,g),u=m.substr(g+1)):(d=m,u=""),f=decodeURIComponent(d),p=decodeURIComponent(u),i(a,f)?n(a[f])?a[f].push(p):a[f]=[a[f],p]:a[f]=p}return a};var n=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},function(e,t,s){"use strict";function i(e,t){if(e.map)return e.map(t);for(var s=[],i=0;ie.text().then(t=>{const s={};for(const[t,i]of e.headers.entries())s[t.toLowerCase()]=i;return{response:e,raw:t,headers:s}}))},shouldSendRaw:()=>!1,METHODS:["GET","HEAD","POST","PUT","DELETE","CONNECT","OPTIONS","PATCH"],STATUS_CODES:{},Extension:Object,FormData:window.FormData}},function(e,t){},function(e,t,s){const{register:i}=s(41),n={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_TIMEOUT:"The connection to the gateway timed out.",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_CHANNEL_ORPHAN:"Could not find a parent to this 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,s=!1)=>`Supplied ${e} is not a${s?"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(n))i(e,t)},function(e,t,s){const i=s(83),n=s(87),r=s(89),{Error:a}=s(4),{Endpoints:o}=s(0);class RESTManager{constructor(e,t="Bot"){this.client=e,this.handlers={},this.rateLimitedEndpoints={},this.globallyRateLimited=!1,this.tokenPrefix=t,this.versioned=!0,this.timeDifferences=[]}get api(){return r(this)}get timeDifference(){return Math.round(this.timeDifferences.reduce((e,t)=>e+t,0)/this.timeDifferences.length)}set timeDifference(e){this.timeDifferences.unshift(e),this.timeDifferences.length>5&&(this.timeDifferences.length=5)}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 o.CDN(this.client.options.http.cdn)}push(e,t){return new Promise((s,i)=>{e.push({request:t,resolve:s,reject:i})})}getRequestHandler(){const e=this.client.options.apiRequestMethod;if("function"==typeof e)return e;const t=i[e];if(!t)throw new a("RATELIMIT_INVALID_METHOD");return t}request(e,t,s={}){const r=new n(this,e,t,s);return this.handlers[r.route]||(this.handlers[r.route]=new i.RequestHandler(this,this.getRequestHandler())),this.push(this.handlers[r.route],r)}set endpoint(e){this.client.options.http.api=e}}e.exports=RESTManager},function(e,t,s){e.exports={sequential:s(84),burst:s(85),RequestHandler:s(86)}},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)}))}},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.remaining--,this.handle())}},function(e,t,s){const i=s(42),{Events:{RATE_LIMIT:n}}=s(0);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.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,s)=>{const r=i=>{i||this.limited?(i||(i=this.resetTime-Date.now()+this.manager.timeDifference+this.client.options.restTimeOffset),s({timeout:i}),this.client.listenerCount(n)&&this.client.emit(n,{timeout:i,limit:this.limit,timeDifference:this.manager.timeDifference,method:e.request.method,path:e.request.path,route:e.request.route})):t()};e.request.gen().end((t,s)=>{if(s&&s.headers&&(s.headers["x-ratelimit-global"]&&(this.globallyLimited=!0),this.limit=Number(s.headers["x-ratelimit-limit"]),this.resetTime=1e3*Number(s.headers["x-ratelimit-reset"]),this.remaining=Number(s.headers["x-ratelimit-remaining"]),this.manager.timeDifference=Date.now()-new Date(s.headers.date).getTime()),t)429===t.status?(this.queue.unshift(e),r(Number(s.headers["retry-after"])+this.client.options.restTimeOffset)):t.status>=500&&t.status<600?(this.queue.unshift(e),r(1e3+this.client.options.restTimeOffset)):(e.reject(t.status>=400&&t.status<500?new i(s.request.path,s.body):t),r());else{const t=s&&s.body?s.body:{};e.resolve(t),r()}})})}reset(){this.globallyLimited=!1,this.remaining=1}}e.exports=RequestHandler},function(e,t,s){const i=s(28),n=s(27),r=s(88),{browser:a,UserAgent:o}=s(0);if(r.Agent)var l=new r.Agent({keepAlive:!0});class APIRequest{constructor(e,t,s,i){this.rest=e,this.client=e.client,this.method=t,this.path=s.toString(),this.route=i.route,this.options=i}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=(i.stringify(this.options.query).match(/[^=&?]+=[^=&?]+/g)||[]).join("&");this.path+=`?${e}`}const t=n[this.method](`${e}${this.path}`,{agent:l});if(!1!==this.options.auth&&t.set("Authorization",this.rest.getAuth()),this.options.reason&&t.set("X-Audit-Log-Reason",encodeURIComponent(this.options.reason)),a||t.set("User-Agent",o),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){},function(e,t){const s=()=>{},i=["get","post","delete","patch","put"],n=["toString","valueOf","inspect","constructor",Symbol.toPrimitive,Symbol.for("util.inspect.custom")];e.exports=function(e){const t=[""],r={get:(a,o)=>n.includes(o)?()=>t.join("/"):i.includes(o)?s=>e.request(o,t.join("/"),Object.assign({versioned:e.versioned,route:t.map((e,s)=>/\d{16,19}/g.test(e)?/channels|guilds/.test(t[s-1])?e:":id":e).join("/")},s)):(t.push(o),new Proxy(s,r)),apply:(e,i,n)=>(t.push(...n.filter(e=>null!=e)),new Proxy(s,r))};return new Proxy(s,r)}},function(module,exports,__webpack_require__){const BaseClient=__webpack_require__(29),Permissions=__webpack_require__(10),ClientManager=__webpack_require__(91),ClientVoiceManager=__webpack_require__(92),WebSocketManager=__webpack_require__(93),ActionsManager=__webpack_require__(149),Collection=__webpack_require__(3),VoiceRegion=__webpack_require__(35),Webhook=__webpack_require__(17),Invite=__webpack_require__(24),ClientApplication=__webpack_require__(32),ShardClientUtil=__webpack_require__(176),VoiceBroadcast=__webpack_require__(177),UserStore=__webpack_require__(70),ChannelStore=__webpack_require__(71),GuildStore=__webpack_require__(72),ClientPresenceStore=__webpack_require__(73),EmojiStore=__webpack_require__(36),{Events:Events,browser:browser}=__webpack_require__(0),DataResolver=__webpack_require__(9),{Error:Error,TypeError:TypeError,RangeError:RangeError}=__webpack_require__(4);class Client extends BaseClient{constructor(e={}){super(Object.assign({_tokenType:"Bot"},e)),!browser&&!this.options.shardId&&"SHARD_ID"in process.env&&(this.options.shardId=Number(process.env.SHARD_ID)),!browser&&!this.options.shardCount&&"SHARD_COUNT"in process.env&&(this.options.shardCount=Number(process.env.SHARD_COUNT)),this._validateOptions(),this.manager=new ClientManager(this),this.ws=new WebSocketManager(this),this.actions=new ActionsManager(this),this.voice=browser?null:new ClientVoiceManager(this),this.shard=!browser&&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}),!browser&&!this.token&&"CLIENT_TOKEN"in process.env?this.token=process.env.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 browser?new Collection:this.voice.connections}get emojis(){const e=new EmojiStore({client:this});for(const t of this.guilds.values())if(t.available)for(const s of t.emojis.values())e.set(s.id,s);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=this.token){return new Promise((t,s)=>{if(!e||"string"!=typeof e)throw new Error("TOKEN_INVALID");e=e.replace(/^Bot\s*/i,""),this.manager.connectToWebSocket(e,t,s)}).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 s of e)t.set(s.id,new VoiceRegion(s));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(Events.DEBUG,"Didn't sweep messages - lifetime is unlimited"),-1;const t=1e3*e,s=Date.now();let i=0,n=0;for(const e of this.channels.values())if(e.messages){i++;for(const i of e.messages.values())s-(i.editedTimestamp||i.createdTimestamp)>t&&(e.messages.delete(i.id),n++)}return this.emit(Events.DEBUG,`Swept ${n} messages older than ${e} seconds in ${i} text-based channels`),n}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},function(e,t,s){const{Events:i,Status:n}=s(0),{Error:r}=s(4);class ClientManager{constructor(e){this.client=e,this.heartbeatInterval=null}get status(){return this.connection?this.connection.status:n.IDLE}connectToWebSocket(e,t,s){this.client.emit(i.DEBUG,`Authenticated using token ${e}`),this.client.token=e;const n=this.client.setTimeout(()=>s(new r("WS_CONNECTION_TIMEOUT")),3e5);this.client.api.gateway.get().then(a=>{const o=`${a.url}/`;this.client.emit(i.DEBUG,`Using gateway ${o}`),this.client.ws.connect(o),this.client.ws.connection.once("error",s),this.client.ws.connection.once("close",e=>{4004===e.code&&s(new r("TOKEN_INVALID")),4010===e.code&&s(new r("SHARDING_INVALID")),4011===e.code&&s(new r("SHARDING_REQUIRED"))}),this.client.once(i.READY,()=>{t(e),this.client.clearTimeout(n)})},s)}destroy(){return this.client.ws.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,s){const i=s(21),{Events:n,Status:r}=s(0),a=s(94);class WebSocketManager extends i{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(n.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 a(this,e),!0;switch(this.connection.status){case r.IDLE:case r.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,s){const i=s(21),{Events:n,OPCodes:r,Status:a,WSCodes:o}=s(0),l=s(95),h=s(63);try{var c=s(140);c.Inflate||(c=s(64))}catch(e){c=s(64)}class WebSocketConnection extends i{constructor(e,t){super(),this.manager=e,this.client=e.client,this.ws=null,this.sequence=-1,this.status=a.IDLE,this.packetManager=new l(this),this.lastPingTimestamp=0,this.ratelimit={queue:[],remaining:120,total:120,time:6e4,resetTimer:null},this.disabledEvents={};for(const e of this.client.options.disabledEvents)this.disabledEvents[e]=!0;this.closeSequence=0,this.expectingClose=!1,this.inflate=null,this.connect(t)}triggerReady(){this.status!==a.READY?(this.status=a.READY,this.client.emit(n.READY),this.packetManager.handleQueue()):this.debug("Tried to mark self as ready, but already ready")}checkIfReady(){if(this.status===a.READY||this.status===a.NEARLY)return!1;let e=0;for(const t of this.client.guilds.values())t.available||e++;if(0===e){if(this.status=a.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()},this.ratelimit.time));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===h.OPEN?this.ws.send(h.pack(e)):this.debug(`Tried to send packet ${e} but no WebSocket is available!`)}send(e){this.ws&&this.ws.readyState===h.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,s=!1){if(t)return this.client.setTimeout(()=>this.connect(e,0,s),t);if(this.ws&&!s)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.inflate=new c.Inflate({chunkSize:65535,flush:c.Z_SYNC_FLUSH,to:"json"===h.encoding?"string":""}),this.expectingClose=!1,this.gateway=e,this.debug(`Connecting to ${e}`);const i=this.ws=h.create(e,{v:this.client.options.ws.version,compress:"zlib-stream"});return i.onmessage=this.onMessage.bind(this),i.onopen=this.onOpen.bind(this),i.onerror=this.onError.bind(this),i.onclose=this.onClose.bind(this),this.status=a.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=a.DISCONNECTED,this.ratelimit.remaining=this.ratelimit.total,!0):(this.debug("Attempted to destroy WebSocket but no connection exists!"),!1)}onMessage({data:e}){e instanceof ArrayBuffer&&(e=new Uint8Array(e));const t=e.length,s=t>=4&&0===e[t-4]&&0===e[t-3]&&255===e[t-2]&&255===e[t-1];if(this.inflate.push(e,s&&c.Z_SYNC_FLUSH),s)try{const e=h.unpack(this.inflate.result);this.onPacket(e),this.client.listenerCount("raw")&&this.client.emit("raw",e)}catch(e){this.client.emit("debug",e)}}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 r.HELLO:return this.heartbeat(e.d.heartbeat_interval);case r.RECONNECT:return this.reconnect();case r.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 r.HEARTBEAT_ACK:return this.ackHeartbeat();case r.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(n.RECONNECTING),this.connect(this.gateway,5500,!0)}onError(e){e&&"uWs client connection error"===e.message?this.reconnect():this.client.emit(n.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:o[e.code])return this.expectingClose=!1,this.client.emit(n.DISCONNECT,e),this.debug(o[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:r.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:s}=this.client.options;s>0&&(e.shard=[Number(t),Number(s)]),this.debug("Identifying as a new session"),this.send({op:r.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:r.RESUME,d:e})}}e.exports=WebSocketConnection},function(e,t,s){const{OPCodes:i,Status:n,WSEvents:r}=s(0),a=[r.READY,r.RESUMED,r.GUILD_CREATE,r.GUILD_DELETE,r.GUILD_MEMBERS_CHUNK,r.GUILD_MEMBER_ADD,r.GUILD_MEMBER_REMOVE];class WebSocketPacketManager{constructor(e){this.ws=e,this.handlers={},this.queue=[],this.register(r.READY,s(96)),this.register(r.RESUMED,s(101)),this.register(r.GUILD_CREATE,s(102)),this.register(r.GUILD_DELETE,s(103)),this.register(r.GUILD_UPDATE,s(104)),this.register(r.GUILD_BAN_ADD,s(105)),this.register(r.GUILD_BAN_REMOVE,s(106)),this.register(r.GUILD_MEMBER_ADD,s(107)),this.register(r.GUILD_MEMBER_REMOVE,s(108)),this.register(r.GUILD_MEMBER_UPDATE,s(109)),this.register(r.GUILD_ROLE_CREATE,s(110)),this.register(r.GUILD_ROLE_DELETE,s(111)),this.register(r.GUILD_ROLE_UPDATE,s(112)),this.register(r.GUILD_EMOJIS_UPDATE,s(113)),this.register(r.GUILD_MEMBERS_CHUNK,s(114)),this.register(r.CHANNEL_CREATE,s(115)),this.register(r.CHANNEL_DELETE,s(116)),this.register(r.CHANNEL_UPDATE,s(117)),this.register(r.CHANNEL_PINS_UPDATE,s(118)),this.register(r.PRESENCE_UPDATE,s(119)),this.register(r.USER_UPDATE,s(120)),this.register(r.USER_NOTE_UPDATE,s(121)),this.register(r.USER_SETTINGS_UPDATE,s(122)),this.register(r.USER_GUILD_SETTINGS_UPDATE,s(123)),this.register(r.VOICE_STATE_UPDATE,s(124)),this.register(r.TYPING_START,s(125)),this.register(r.MESSAGE_CREATE,s(126)),this.register(r.MESSAGE_DELETE,s(127)),this.register(r.MESSAGE_UPDATE,s(128)),this.register(r.MESSAGE_DELETE_BULK,s(129)),this.register(r.VOICE_SERVER_UPDATE,s(130)),this.register(r.GUILD_SYNC,s(131)),this.register(r.RELATIONSHIP_ADD,s(132)),this.register(r.RELATIONSHIP_REMOVE,s(133)),this.register(r.MESSAGE_REACTION_ADD,s(134)),this.register(r.MESSAGE_REACTION_REMOVE,s(135)),this.register(r.MESSAGE_REACTION_REMOVE_ALL,s(136))}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===i.HEARTBEAT_ACK?(this.ws.client._pong(this.ws.client._pingTimestamp),this.ws.lastHeartbeatAck=!0,this.ws.client.emit("debug","Heartbeat acknowledged")):e.op===i.HEARTBEAT&&(this.client.ws.send({op:i.HEARTBEAT,d:this.client.ws.sequence}),this.ws.client.emit("debug","Received gateway heartbeat")),this.ws.status===n.RECONNECTING&&(this.ws.reconnecting=!1,this.ws.checkIfReady()),this.ws.setSequence(e.s),void 0===this.ws.disabledEvents[e.t]&&(this.ws.status!==n.READY&&-1===a.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,s){const i=s(1),{Events:n}=s(0),r=s(43);class ReadyHandler extends i{handle(e){const t=this.packetManager.client,s=e.d;t.ws.heartbeat(),s.user.user_settings=s.user_settings,s.user.user_guild_settings=s.user_guild_settings;const i=new r(t,s.user);t.user=i,t.readyAt=new Date,t.users.set(i.id,i);for(const e of s.guilds)t.guilds.create(e);for(const e of s.private_channels)t.channels.create(e);for(const e of s.relationships){const s=t.users.create(e.user);1===e.type?t.user.friends.set(s.id,s):2===e.type&&t.user.blocked.set(s.id,s)}for(const e of s.presences||[])t.presences.create(e);if(s.notes)for(const e in s.notes){let i=s.notes[e];i.length||(i=null),t.user.notes.set(e,i)}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 a=t.setTimeout(()=>{t.ws.connection.triggerReady()},1200*s.guilds.length);t.setMaxListeners(s.guilds.length+10),t.once("ready",()=>{t.syncGuilds(),t.setMaxListeners(10),t.clearTimeout(a)});const o=this.packetManager.ws;o.sessionID=s.session_id,o._trace=s._trace,t.emit(n.DEBUG,`READY ${o._trace.join(" -> ")} ${o.sessionID}`),o.checkIfReady()}}e.exports=ReadyHandler},function(e,t,s){const i=s(26),{TypeError:n}=s(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=i.fromNumber(t.before.getTime()-14200704e5).shiftLeft(22).toString()),t.after&&(t.after instanceof Date||(t.after=new Date(t.after)),t.minID=i.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=i.fromNumber(e).shiftLeft(22).toString(),t.maxID=i.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=s(12),a=s(25);if(!(e instanceof r||e instanceof a))throw new n("SEARCH_CHANNEL_TYPE");return e.client.api[e instanceof r?"channels":"guilds"](e.id).messages().search.get({query:t}).then(t=>{const s=t.messages.map(t=>t.map(t=>e.client.channels.get(t.channel_id).messages.create(t,!1)));return{total:t.total_results,results:s}})}},function(e,t,s){const i=s(7),n=s(50);class ReactionStore extends i{constructor(e,t){super(e.client,t,n),this.message=e}create(e,t){return super.create(e,t,{id:e.emoji.id||e.emoji.name,extras:[this.message]})}}e.exports=ReactionStore},function(e,t,s){const i=s(5),n=s(15),{RangeError:r}=s(4);e.exports=function(e,t){const a=s(22),o=s(13);if(e instanceof a||e instanceof o)return e.createDM().then(e=>e.send(t));let{content:l,nonce:h,reply:c,code:d,disableEveryone:u,tts:f,embed:p,files:m,split:g}=t;if(p&&(p=new n(p)._apiTransform()),void 0!==h&&(h=parseInt(h),isNaN(h)||h<0))throw new r("MESSAGE_NONCE_TYPE");if(c&&!(e instanceof a||e instanceof o)&&"dm"!==e.type){const t=e.client.users.resolveID(c),s=`<@${c instanceof o&&c.nickname?"!":""}${t}>`;g&&(g.prepend=`${s}, ${g.prepend||""}`),l=`${s}${void 0!==l?`, ${l}`:""}`}return l&&(l=i.resolveString(l),g&&"object"!=typeof g&&(g={}),void 0===d||"boolean"==typeof d&&!0!==d||(l=i.escapeMarkdown(l,!0),l=`\`\`\`${"boolean"!=typeof d?d||"":""}\n${l}\n\`\`\``,g&&(g.prepend=`\`\`\`${"boolean"!=typeof d?d||"":""}\n`,g.append="\n```")),(u||void 0===u&&e.client.options.disableEveryone)&&(l=l.replace(/@(everyone|here)/g,"@​$1")),g&&(l=i.splitMessage(l,g))),l instanceof Array?new Promise((t,s)=>{const i=[];!function n(){const r=l.length?{tts:f}:{tts:f,embed:p,files:m};e.send(l.shift(),r).then(e=>(i.push(e),0===l.length?t(i):n())).catch(s)}()}):e.client.api.channels[e.id].messages.post({data:{content:l,tts:f,nonce:h,embed:p},files:m}).then(t=>e.client.actions.MessageCreate.handle(t).message)}},function(e,t,s){const i=s(3),{UserFlags:n}=s(0),r=s(60),a=s(6);class UserProfile extends a{constructor(e,t){super(e.client),this.user=e,this.mutualGuilds=new i,this.connections=new i,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,s]of Object.entries(n))(this._flags&s)===s&&e.push(t);return e}}e.exports=UserProfile},function(e,t,s){const i=s(1),{Events:n,Status:r}=s(0);class ResumedHandler extends i{handle(e){const t=this.packetManager.client,s=t.ws.connection;s._trace=e.d._trace,s.status=r.READY,this.packetManager.handleQueue();const i=s.sequence-s.closeSequence;s.debug(`RESUMED ${s._trace.join(" -> ")} | replayed ${i} events.`),t.emit(n.RESUMED,i),s.heartbeat()}}e.exports=ResumedHandler},function(e,t,s){const i=s(1),{Events:n,Status:r}=s(0);class GuildCreateHandler extends i{async handle(e){const t=this.packetManager.client,s=e.d;let i=t.guilds.get(s.id);i?i.available||s.unavailable||(i._patch(s),this.packetManager.ws.checkIfReady()):(i=t.guilds.create(s),t.ws.connection.status===r.READY&&(t.options.fetchAllMembers&&await i.members.fetch(),t.emit(n.GUILD_CREATE,i)))}}e.exports=GuildCreateHandler},function(e,t,s){const i=s(1);class GuildDeleteHandler extends i{handle(e){this.packetManager.client.actions.GuildDelete.handle(e.d)}}e.exports=GuildDeleteHandler},function(e,t,s){const i=s(1);class GuildUpdateHandler extends i{handle(e){const t=this.packetManager.client,s=e.d;t.actions.GuildUpdate.handle(s)}}e.exports=GuildUpdateHandler},function(e,t,s){const i=s(1),{Events:n}=s(0);class GuildBanAddHandler extends i{handle(e){const t=this.packetManager.client,s=e.d,i=t.guilds.get(s.guild_id),r=t.users.get(s.user.id);i&&r&&t.emit(n.GUILD_BAN_ADD,i,r)}}e.exports=GuildBanAddHandler},function(e,t,s){const i=s(1);class GuildBanRemoveHandler extends i{handle(e){const t=this.packetManager.client,s=e.d;t.actions.GuildBanRemove.handle(s)}}e.exports=GuildBanRemoveHandler},function(e,t,s){const i=s(1),{Events:n,Status:r}=s(0);class GuildMemberAddHandler extends i{handle(e){const t=this.packetManager.client,s=e.d,i=t.guilds.get(s.guild_id);if(i){i.memberCount++;const e=i.members.create(s);t.ws.connection.status===r.READY&&t.emit(n.GUILD_MEMBER_ADD,e)}}}e.exports=GuildMemberAddHandler},function(e,t,s){const i=s(1);class GuildMemberRemoveHandler extends i{handle(e){const t=this.packetManager.client,s=e.d;t.actions.GuildMemberRemove.handle(s)}}e.exports=GuildMemberRemoveHandler},function(e,t,s){const i=s(1),{Events:n,Status:r}=s(0);class GuildMemberUpdateHandler extends i{handle(e){const t=this.packetManager.client,s=e.d,i=t.guilds.get(s.guild_id);if(i){const e=i.members.get(s.user.id);if(e){const i=e._update(s);t.ws.connection.status===r.READY&&t.emit(n.GUILD_MEMBER_UPDATE,i,e)}}}}e.exports=GuildMemberUpdateHandler},function(e,t,s){const i=s(1);class GuildRoleCreateHandler extends i{handle(e){const t=this.packetManager.client,s=e.d;t.actions.GuildRoleCreate.handle(s)}}e.exports=GuildRoleCreateHandler},function(e,t,s){const i=s(1);class GuildRoleDeleteHandler extends i{handle(e){const t=this.packetManager.client,s=e.d;t.actions.GuildRoleDelete.handle(s)}}e.exports=GuildRoleDeleteHandler},function(e,t,s){const i=s(1);class GuildRoleUpdateHandler extends i{handle(e){const t=this.packetManager.client,s=e.d;t.actions.GuildRoleUpdate.handle(s)}}e.exports=GuildRoleUpdateHandler},function(e,t,s){const i=s(1);class GuildEmojisUpdate extends i{handle(e){const t=this.packetManager.client,s=e.d;t.actions.GuildEmojisUpdate.handle(s)}}e.exports=GuildEmojisUpdate},function(e,t,s){const i=s(1),{Events:n}=s(0),r=s(3);class GuildMembersChunkHandler extends i{handle(e){const t=this.packetManager.client,s=e.d,i=t.guilds.get(s.guild_id);if(!i)return;const a=new r;for(const e of s.members)a.set(e.user.id,i.members.create(e));t.emit(n.GUILD_MEMBERS_CHUNK,a,i),t.ws.lastHeartbeatAck=!0}}e.exports=GuildMembersChunkHandler},function(e,t,s){const i=s(1);class ChannelCreateHandler extends i{handle(e){this.packetManager.client.actions.ChannelCreate.handle(e.d)}}e.exports=ChannelCreateHandler},function(e,t,s){const i=s(1);class ChannelDeleteHandler extends i{handle(e){this.packetManager.client.actions.ChannelDelete.handle(e.d)}}e.exports=ChannelDeleteHandler},function(e,t,s){const i=s(1),{Events:n}=s(0);class ChannelUpdateHandler extends i{handle(e){const{old:t,updated:s}=this.packetManager.client.actions.ChannelUpdate.handle(e.d);t&&s&&this.packetManager.client.emit(n.CHANNEL_UPDATE,t,s)}}e.exports=ChannelUpdateHandler},function(e,t,s){const i=s(1),{Events:n}=s(0);class ChannelPinsUpdate extends i{handle(e){const t=this.packetManager.client,s=e.d,i=t.channels.get(s.channel_id),r=new Date(s.last_pin_timestamp);i&&r&&t.emit(n.CHANNEL_PINS_UPDATE,i,r)}}e.exports=ChannelPinsUpdate},function(e,t,s){const i=s(1),{Events:n}=s(0);class PresenceUpdateHandler extends i{handle(e){const t=this.packetManager.client,s=e.d;let i=t.users.get(s.user.id);const r=t.guilds.get(s.guild_id);if(!i){if(!s.user.username)return;i=t.users.create(s.user)}const a=i._update(s.user);if(i.equals(a)||t.emit(n.USER_UPDATE,a,i),r){let e=r.members.get(i.id);if(e||"offline"===s.status||(e=r.members.create({user:i,roles:s.roles,deaf:!1,mute:!1}),t.emit(n.GUILD_MEMBER_AVAILABLE,e)),e){if(0===t.listenerCount(n.PRESENCE_UPDATE))return void r.presences.create(s);const i=e._clone();e.presence&&(i.frozenPresence=e.presence._clone()),r.presences.create(s),t.emit(n.PRESENCE_UPDATE,i,e)}else r.presences.create(s)}}}e.exports=PresenceUpdateHandler},function(e,t,s){const i=s(1);class UserUpdateHandler extends i{handle(e){const t=this.packetManager.client,s=e.d;t.actions.UserUpdate.handle(s)}}e.exports=UserUpdateHandler},function(e,t,s){const i=s(1);class UserNoteUpdateHandler extends i{handle(e){const t=this.packetManager.client,s=e.d;t.actions.UserNoteUpdate.handle(s)}}e.exports=UserNoteUpdateHandler},function(e,t,s){const i=s(1),{Events:n}=s(0);class UserSettingsUpdateHandler extends i{handle(e){const t=this.packetManager.client;t.user.settings.patch(e.d),t.emit(n.USER_SETTINGS_UPDATE,t.user.settings)}}e.exports=UserSettingsUpdateHandler},function(e,t,s){const i=s(1),{Events:n}=s(0),r=s(38);class UserGuildSettingsUpdateHandler extends i{handle(e){const t=this.packetManager.client,s=t.user.guildSettings.get(e.d.guild_id);s?s.patch(e.d):t.user.guildSettings.set(e.d.guild_id,new r(this.client,e.d)),t.emit(n.USER_GUILD_SETTINGS_UPDATE,t.user.guildSettings.get(e.d.guild_id))}}e.exports=UserGuildSettingsUpdateHandler},function(e,t,s){const i=s(1),{Events:n}=s(0);class VoiceStateUpdateHandler extends i{handle(e){const t=this.packetManager.client,s=e.d,i=t.guilds.get(s.guild_id);if(i){const e=i.members.get(s.user_id);if(e){const r=e._clone();r._frozenVoiceState=r.voiceState,e.user.id===t.user.id&&s.channel_id&&t.emit("self.voiceStateUpdate",s),i.voiceStates.set(e.user.id,s),t.emit(n.VOICE_STATE_UPDATE,r,e)}}}}e.exports=VoiceStateUpdateHandler},function(e,t,s){function i(e,t){return e.client.setTimeout(()=>{e.client.emit(r.TYPING_STOP,e,t,e._typing.get(t.id)),e._typing.delete(t.id)},6e3)}const n=s(1),{Events:r}=s(0);class TypingStartHandler extends n{handle(e){const t=this.packetManager.client,s=e.d,n=t.channels.get(s.channel_id),a=t.users.get(s.user_id),o=new Date(1e3*s.timestamp);if(n&&a){if("voice"===n.type)return void t.emit(r.WARN,`Discord sent a typing packet to voice channel ${n.id}`);if(n._typing.has(a.id)){const e=n._typing.get(a.id);e.lastTimestamp=o,e.resetTimeout(i(n,a))}else n._typing.set(a.id,new TypingData(t,o,o,i(n,a))),t.emit(r.TYPING_START,n,a)}}}class TypingData{constructor(e,t,s,i){this.client=e,this.since=t,this.lastTimestamp=s,this._timeout=i}resetTimeout(e){this.client.clearTimeout(this._timeout),this._timeout=e}get elapsedTime(){return Date.now()-this.since}}e.exports=TypingStartHandler},function(e,t,s){const i=s(1);class MessageCreateHandler extends i{handle(e){this.packetManager.client.actions.MessageCreate.handle(e.d)}}e.exports=MessageCreateHandler},function(e,t,s){const i=s(1);class MessageDeleteHandler extends i{handle(e){this.packetManager.client.actions.MessageDelete.handle(e.d)}}e.exports=MessageDeleteHandler},function(e,t,s){const i=s(1),{Events:n}=s(0);class MessageUpdateHandler extends i{handle(e){const{old:t,updated:s}=this.packetManager.client.actions.MessageUpdate.handle(e.d);t&&s&&this.packetManager.client.emit(n.MESSAGE_UPDATE,t,s)}}e.exports=MessageUpdateHandler},function(e,t,s){const i=s(1);class MessageDeleteBulkHandler extends i{handle(e){this.packetManager.client.actions.MessageDeleteBulk.handle(e.d)}}e.exports=MessageDeleteBulkHandler},function(e,t,s){const i=s(1);class VoiceServerUpdate extends i{handle(e){const t=this.packetManager.client,s=e.d;t.emit("self.voiceServer",s)}}e.exports=VoiceServerUpdate},function(e,t,s){const i=s(1);class GuildSyncHandler extends i{handle(e){const t=this.packetManager.client,s=e.d;t.actions.GuildSync.handle(s)}}e.exports=GuildSyncHandler},function(e,t,s){const i=s(1);class RelationshipAddHandler extends i{handle(e){const t=this.packetManager.client,s=e.d;1===s.type?t.users.fetch(s.id).then(e=>{t.user.friends.set(e.id,e)}):2===s.type&&t.users.fetch(s.id).then(e=>{t.user.blocked.set(e.id,e)})}}e.exports=RelationshipAddHandler},function(e,t,s){const i=s(1);class RelationshipRemoveHandler extends i{handle(e){const t=this.packetManager.client,s=e.d;2===s.type?t.user.blocked.has(s.id)&&t.user.blocked.delete(s.id):1===s.type&&t.user.friends.has(s.id)&&t.user.friends.delete(s.id)}}e.exports=RelationshipRemoveHandler},function(e,t,s){const i=s(1),{Events:n}=s(0);class MessageReactionAddHandler extends i{handle(e){const t=this.packetManager.client,s=e.d,{user:i,reaction:r}=t.actions.MessageReactionAdd.handle(s);r&&t.emit(n.MESSAGE_REACTION_ADD,r,i)}}e.exports=MessageReactionAddHandler},function(e,t,s){const i=s(1);class MessageReactionRemove extends i{handle(e){const t=this.packetManager.client,s=e.d;t.actions.MessageReactionRemove.handle(s)}}e.exports=MessageReactionRemove},function(e,t,s){const i=s(1);class MessageReactionRemoveAll extends i{handle(e){const t=this.packetManager.client,s=e.d;t.actions.MessageReactionRemoveAll.handle(s)}}e.exports=MessageReactionRemoveAll},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t,s){"use strict";function i(e){if(!(this instanceof i))return new i(e);this.options=a.assign({level:u,method:p,chunkSize:16384,windowBits:15,memLevel:8,strategy:f,to:""},e||{});var t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new h,this.strm.avail_out=0;var s=r.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(s!==d)throw new Error(l[s]);if(t.header&&r.deflateSetHeader(this.strm,t.header),t.dictionary){var n;if(n="string"==typeof t.dictionary?o.string2buf(t.dictionary):"[object ArrayBuffer]"===c.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,(s=r.deflateSetDictionary(this.strm,n))!==d)throw new Error(l[s]);this._dict_set=!0}}function n(e,t){var s=new i(t);if(s.push(e,!0),s.err)throw s.msg||l[s.err];return s.result}var r=s(142),a=s(11),o=s(67),l=s(39),h=s(68),c=Object.prototype.toString,d=0,u=-1,f=0,p=8;i.prototype.push=function(e,t){var s,i,n=this.strm,l=this.options.chunkSize;if(this.ended)return!1;i=t===~~t?t:!0===t?4:0,"string"==typeof e?n.input=o.string2buf(e):"[object ArrayBuffer]"===c.call(e)?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;do{if(0===n.avail_out&&(n.output=new a.Buf8(l),n.next_out=0,n.avail_out=l),1!==(s=r.deflate(n,i))&&s!==d)return this.onEnd(s),this.ended=!0,!1;0!==n.avail_out&&(0!==n.avail_in||4!==i&&2!==i)||("string"===this.options.to?this.onData(o.buf2binstring(a.shrinkBuf(n.output,n.next_out))):this.onData(a.shrinkBuf(n.output,n.next_out)))}while((n.avail_in>0||0===n.avail_out)&&1!==s);return 4===i?(s=r.deflateEnd(this.strm),this.onEnd(s),this.ended=!0,s===d):2!==i||(this.onEnd(d),n.avail_out=0,!0)},i.prototype.onData=function(e){this.chunks.push(e)},i.prototype.onEnd=function(e){e===d&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=a.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},t.Deflate=i,t.deflate=n,t.deflateRaw=function(e,t){return t=t||{},t.raw=!0,n(e,t)},t.gzip=function(e,t){return t=t||{},t.gzip=!0,n(e,t)}},function(e,t,s){"use strict";function i(e,t){return e.msg=N[t],t}function n(e){return(e<<1)-(e>4?9:0)}function r(e){for(var t=e.length;--t>=0;)e[t]=0}function a(e){var t=e.state,s=t.pending;s>e.avail_out&&(s=e.avail_out),0!==s&&(T.arraySet(e.output,t.pending_buf,t.pending_out,s,e.next_out),e.next_out+=s,t.pending_out+=s,e.total_out+=s,e.avail_out-=s,t.pending-=s,0===t.pending&&(t.pending_out=0))}function o(e,t){I._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,a(e.strm)}function l(e,t){e.pending_buf[e.pending++]=t}function h(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function c(e,t,s,i){var n=e.avail_in;return n>i&&(n=i),0===n?0:(e.avail_in-=n,T.arraySet(t,e.input,e.next_in,n,s),1===e.state.wrap?e.adler=S(e.adler,t,n,s):2===e.state.wrap&&(e.adler=D(e.adler,t,n,s)),e.next_in+=n,e.total_in+=n,n)}function d(e,t){var s,i,n=e.max_chain_length,r=e.strstart,a=e.prev_length,o=e.nice_match,l=e.strstart>e.w_size-ie?e.strstart-(e.w_size-ie):0,h=e.window,c=e.w_mask,d=e.prev,u=e.strstart+se,f=h[r+a-1],p=h[r+a];e.prev_length>=e.good_match&&(n>>=2),o>e.lookahead&&(o=e.lookahead);do{if(s=t,h[s+a]===p&&h[s+a-1]===f&&h[s]===h[r]&&h[++s]===h[r+1]){r+=2,s++;do{}while(h[++r]===h[++s]&&h[++r]===h[++s]&&h[++r]===h[++s]&&h[++r]===h[++s]&&h[++r]===h[++s]&&h[++r]===h[++s]&&h[++r]===h[++s]&&h[++r]===h[++s]&&ra){if(e.match_start=t,a=i,i>=o)break;f=h[r+a-1],p=h[r+a]}}}while((t=d[t&c])>l&&0!=--n);return a<=e.lookahead?a:e.lookahead}function u(e){var t,s,i,n,r,a=e.w_size;do{if(n=e.window_size-e.lookahead-e.strstart,e.strstart>=a+(a-ie)){T.arraySet(e.window,e.window,a,a,0),e.match_start-=a,e.strstart-=a,e.block_start-=a,t=s=e.hash_size;do{i=e.head[--t],e.head[t]=i>=a?i-a:0}while(--s);t=s=a;do{i=e.prev[--t],e.prev[t]=i>=a?i-a:0}while(--s);n+=a}if(0===e.strm.avail_in)break;if(s=c(e.strm,e.window,e.strstart+e.lookahead,n),e.lookahead+=s,e.lookahead+e.insert>=te)for(r=e.strstart-e.insert,e.ins_h=e.window[r],e.ins_h=(e.ins_h<=te&&(e.ins_h=(e.ins_h<=te)if(i=I._tr_tally(e,e.strstart-e.match_start,e.match_length-te),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=te){e.match_length--;do{e.strstart++,e.ins_h=(e.ins_h<=te&&(e.ins_h=(e.ins_h<4096)&&(e.match_length=te-1)),e.prev_length>=te&&e.match_length<=e.prev_length){n=e.strstart+e.lookahead-te,i=I._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-te),e.lookahead-=e.prev_length-1,e.prev_length-=2;do{++e.strstart<=n&&(e.ins_h=(e.ins_h<=te&&e.strstart>0&&(n=e.strstart-1,(i=a[n])===a[++n]&&i===a[++n]&&i===a[++n])){r=e.strstart+se;do{}while(i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&ne.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=te?(s=I._tr_tally(e,1,e.match_length-te),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(s=I._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),s&&(o(e,!1),0===e.strm.avail_out))return ue}return e.insert=0,t===M?(o(e,!0),0===e.strm.avail_out?pe:me):e.last_lit&&(o(e,!1),0===e.strm.avail_out)?ue:fe}function g(e,t){for(var s;;){if(0===e.lookahead&&(u(e),0===e.lookahead)){if(t===R)return ue;break}if(e.match_length=0,s=I._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,s&&(o(e,!1),0===e.strm.avail_out))return ue}return e.insert=0,t===M?(o(e,!0),0===e.strm.avail_out?pe:me):e.last_lit&&(o(e,!1),0===e.strm.avail_out)?ue:fe}function _(e,t,s,i,n){this.good_length=e,this.max_lazy=t,this.nice_length=s,this.max_chain=i,this.func=n}function E(e){e.window_size=2*e.w_size,r(e.head),e.max_lazy_match=A[e.level].max_lazy,e.good_match=A[e.level].good_length,e.nice_match=A[e.level].nice_length,e.max_chain_length=A[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=te-1,e.match_available=0,e.ins_h=0}function v(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=F,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new T.Buf16(2*Q),this.dyn_dtree=new T.Buf16(2*(2*J+1)),this.bl_tree=new T.Buf16(2*(2*X+1)),r(this.dyn_ltree),r(this.dyn_dtree),r(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new T.Buf16(ee+1),this.heap=new T.Buf16(2*Z+1),r(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new T.Buf16(2*Z+1),r(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function b(e){var t;return e&&e.state?(e.total_in=e.total_out=0,e.data_type=$,t=e.state,t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap?re:ce,e.adler=2===t.wrap?0:1,t.last_flush=R,I._tr_init(t),L):i(e,U)}function w(e){var t=b(e);return t===L&&E(e.state),t}function y(e,t,s,n,r,a){if(!e)return U;var o=1;if(t===B&&(t=6),n<0?(o=0,n=-n):n>15&&(o=2,n-=16),r<1||r>K||s!==F||n<8||n>15||t<0||t>9||a<0||a>q)return i(e,U);8===n&&(n=9);var l=new v;return e.state=l,l.strm=e,l.wrap=o,l.gzhead=null,l.w_bits=n,l.w_size=1<e.pending_buf_size-5&&(s=e.pending_buf_size-5);;){if(e.lookahead<=1){if(u(e),0===e.lookahead&&t===R)return ue;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var i=e.block_start+s;if((0===e.strstart||e.strstart>=i)&&(e.lookahead=e.strstart-i,e.strstart=i,o(e,!1),0===e.strm.avail_out))return ue;if(e.strstart-e.block_start>=e.w_size-ie&&(o(e,!1),0===e.strm.avail_out))return ue}return e.insert=0,t===M?(o(e,!0),0===e.strm.avail_out?pe:me):(e.strstart>e.block_start&&(o(e,!1),e.strm.avail_out),ue)}),new _(4,4,8,4,f),new _(4,5,16,8,f),new _(4,6,32,32,f),new _(4,4,16,16,p),new _(8,16,32,32,p),new _(8,16,128,128,p),new _(8,32,128,256,p),new _(32,128,258,1024,p),new _(32,258,258,4096,p)],t.deflateInit=function(e,t){return y(e,t,F,W,Y,V)},t.deflateInit2=y,t.deflateReset=w,t.deflateResetKeep=b,t.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?U:(e.state.gzhead=t,L):U},t.deflate=function(e,t){var s,o,c,d;if(!e||!e.state||t>O||t<0)return e?i(e,U):U;if(o=e.state,!e.output||!e.input&&0!==e.avail_in||o.status===de&&t!==M)return i(e,0===e.avail_out?P:U);if(o.strm=e,s=o.last_flush,o.last_flush=t,o.status===re)if(2===o.wrap)e.adler=0,l(o,31),l(o,139),l(o,8),o.gzhead?(l(o,(o.gzhead.text?1:0)+(o.gzhead.hcrc?2:0)+(o.gzhead.extra?4:0)+(o.gzhead.name?8:0)+(o.gzhead.comment?16:0)),l(o,255&o.gzhead.time),l(o,o.gzhead.time>>8&255),l(o,o.gzhead.time>>16&255),l(o,o.gzhead.time>>24&255),l(o,9===o.level?2:o.strategy>=H||o.level<2?4:0),l(o,255&o.gzhead.os),o.gzhead.extra&&o.gzhead.extra.length&&(l(o,255&o.gzhead.extra.length),l(o,o.gzhead.extra.length>>8&255)),o.gzhead.hcrc&&(e.adler=D(e.adler,o.pending_buf,o.pending,0)),o.gzindex=0,o.status=ae):(l(o,0),l(o,0),l(o,0),l(o,0),l(o,0),l(o,9===o.level?2:o.strategy>=H||o.level<2?4:0),l(o,ge),o.status=ce);else{var u=F+(o.w_bits-8<<4)<<8;u|=(o.strategy>=H||o.level<2?0:o.level<6?1:6===o.level?2:3)<<6,0!==o.strstart&&(u|=ne),u+=31-u%31,o.status=ce,h(o,u),0!==o.strstart&&(h(o,e.adler>>>16),h(o,65535&e.adler)),e.adler=1}if(o.status===ae)if(o.gzhead.extra){for(c=o.pending;o.gzindex<(65535&o.gzhead.extra.length)&&(o.pending!==o.pending_buf_size||(o.gzhead.hcrc&&o.pending>c&&(e.adler=D(e.adler,o.pending_buf,o.pending-c,c)),a(e),c=o.pending,o.pending!==o.pending_buf_size));)l(o,255&o.gzhead.extra[o.gzindex]),o.gzindex++;o.gzhead.hcrc&&o.pending>c&&(e.adler=D(e.adler,o.pending_buf,o.pending-c,c)),o.gzindex===o.gzhead.extra.length&&(o.gzindex=0,o.status=oe)}else o.status=oe;if(o.status===oe)if(o.gzhead.name){c=o.pending;do{if(o.pending===o.pending_buf_size&&(o.gzhead.hcrc&&o.pending>c&&(e.adler=D(e.adler,o.pending_buf,o.pending-c,c)),a(e),c=o.pending,o.pending===o.pending_buf_size)){d=1;break}d=o.gzindexc&&(e.adler=D(e.adler,o.pending_buf,o.pending-c,c)),0===d&&(o.gzindex=0,o.status=le)}else o.status=le;if(o.status===le)if(o.gzhead.comment){c=o.pending;do{if(o.pending===o.pending_buf_size&&(o.gzhead.hcrc&&o.pending>c&&(e.adler=D(e.adler,o.pending_buf,o.pending-c,c)),a(e),c=o.pending,o.pending===o.pending_buf_size)){d=1;break}d=o.gzindexc&&(e.adler=D(e.adler,o.pending_buf,o.pending-c,c)),0===d&&(o.status=he)}else o.status=he;if(o.status===he&&(o.gzhead.hcrc?(o.pending+2>o.pending_buf_size&&a(e),o.pending+2<=o.pending_buf_size&&(l(o,255&e.adler),l(o,e.adler>>8&255),e.adler=0,o.status=ce)):o.status=ce),0!==o.pending){if(a(e),0===e.avail_out)return o.last_flush=-1,L}else if(0===e.avail_in&&n(t)<=n(s)&&t!==M)return i(e,P);if(o.status===de&&0!==e.avail_in)return i(e,P);if(0!==e.avail_in||0!==o.lookahead||t!==R&&o.status!==de){var f=o.strategy===H?g(o,t):o.strategy===z?m(o,t):A[o.level].func(o,t);if(f!==pe&&f!==me||(o.status=de),f===ue||f===pe)return 0===e.avail_out&&(o.last_flush=-1),L;if(f===fe&&(t===C?I._tr_align(o):t!==O&&(I._tr_stored_block(o,0,0,!1),t===k&&(r(o.head),0===o.lookahead&&(o.strstart=0,o.block_start=0,o.insert=0))),a(e),0===e.avail_out))return o.last_flush=-1,L}return t!==M?L:o.wrap<=0?x:(2===o.wrap?(l(o,255&e.adler),l(o,e.adler>>8&255),l(o,e.adler>>16&255),l(o,e.adler>>24&255),l(o,255&e.total_in),l(o,e.total_in>>8&255),l(o,e.total_in>>16&255),l(o,e.total_in>>24&255)):(h(o,e.adler>>>16),h(o,65535&e.adler)),a(e),o.wrap>0&&(o.wrap=-o.wrap),0!==o.pending?L:x)},t.deflateEnd=function(e){var t;return e&&e.state?(t=e.state.status)!==re&&t!==ae&&t!==oe&&t!==le&&t!==he&&t!==ce&&t!==de?i(e,U):(e.state=null,t===ce?i(e,G):L):U},t.deflateSetDictionary=function(e,t){var s,i,n,a,o,l,h,c,d=t.length;if(!e||!e.state)return U;if(s=e.state,2===(a=s.wrap)||1===a&&s.status!==re||s.lookahead)return U;for(1===a&&(e.adler=S(e.adler,t,d,0)),s.wrap=0,d>=s.w_size&&(0===a&&(r(s.head),s.strstart=0,s.block_start=0,s.insert=0),c=new T.Buf8(s.w_size),T.arraySet(c,t,d-s.w_size,s.w_size,0),t=c,d=s.w_size),o=e.avail_in,l=e.next_in,h=e.input,e.avail_in=d,e.next_in=0,e.input=t,u(s);s.lookahead>=te;){i=s.strstart,n=s.lookahead-(te-1);do{s.ins_h=(s.ins_h<=0;)e[t]=0}function n(e,t,s,i,n){this.static_tree=e,this.extra_bits=t,this.extra_base=s,this.elems=i,this.max_length=n,this.has_stree=e&&e.length}function r(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function a(e){return e<256?te[e]:te[256+(e>>>7)]}function o(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function l(e,t,s){e.bi_valid>q-s?(e.bi_buf|=t<>q-e.bi_valid,e.bi_valid+=s-q):(e.bi_buf|=t<>>=1,s<<=1}while(--t>0);return s>>>1}function d(e){16===e.bi_valid?(o(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}function u(e,t){var s,i,n,r,a,o,l=t.dyn_tree,h=t.max_code,c=t.stat_desc.static_tree,d=t.stat_desc.has_stree,u=t.stat_desc.extra_bits,f=t.stat_desc.extra_base,p=t.stat_desc.max_length,m=0;for(r=0;r<=z;r++)e.bl_count[r]=0;for(l[2*e.heap[e.heap_max]+1]=0,s=e.heap_max+1;sp&&(r=p,m++),l[2*i+1]=r,i>h||(e.bl_count[r]++,a=0,i>=f&&(a=u[i-f]),o=l[2*i],e.opt_len+=o*(r+a),d&&(e.static_len+=o*(c[2*i+1]+a)));if(0!==m){do{for(r=p-1;0===e.bl_count[r];)r--;e.bl_count[r]--,e.bl_count[r+1]+=2,e.bl_count[p]--,m-=2}while(m>0);for(r=p;0!==r;r--)for(i=e.bl_count[r];0!==i;)(n=e.heap[--s])>h||(l[2*n+1]!==r&&(e.opt_len+=(r-l[2*n+1])*l[2*n],l[2*n+1]=r),i--)}}function f(e,t,s){var i,n,r=new Array(z+1),a=0;for(i=1;i<=z;i++)r[i]=a=a+s[i-1]<<1;for(n=0;n<=t;n++){var o=e[2*n+1];0!==o&&(e[2*n]=c(r[o]++,o))}}function p(){var e,t,s,i,r,a=new Array(z+1);for(s=0,i=0;i>=7;i8?o(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function _(e,t,s,i){g(e),i&&(o(e,s),o(e,~s)),N.arraySet(e.pending_buf,e.window,t,s,e.pending),e.pending+=s}function E(e,t,s,i){var n=2*t,r=2*s;return e[n]>1;s>=1;s--)v(e,r,s);n=l;do{s=e.heap[1],e.heap[1]=e.heap[e.heap_len--],v(e,r,1),i=e.heap[1],e.heap[--e.heap_max]=s,e.heap[--e.heap_max]=i,r[2*n]=r[2*s]+r[2*i],e.depth[n]=(e.depth[s]>=e.depth[i]?e.depth[s]:e.depth[i])+1,r[2*s+1]=r[2*i+1]=n,e.heap[1]=n++,v(e,r,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],u(e,t),f(r,h,e.bl_count)}function y(e,t,s){var i,n,r=-1,a=t[1],o=0,l=7,h=4;for(0===a&&(l=138,h=3),t[2*(s+1)+1]=65535,i=0;i<=s;i++)n=a,a=t[2*(i+1)+1],++o=3&&0===e.bl_tree[2*X[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t}function I(e,t,s,i){var n;for(l(e,t-257,5),l(e,s-1,5),l(e,i-4,4),n=0;n>>=1)if(1&s&&0!==e.dyn_ltree[2*t])return C;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return k;for(t=32;t0?(e.strm.data_type===M&&(e.strm.data_type=S(e)),w(e,e.l_desc),w(e,e.d_desc),a=T(e),n=e.opt_len+3+7>>>3,(r=e.static_len+3+7>>>3)<=n&&(n=r)):n=r=s+5,s+4<=n&&-1!==t?D(e,t,s,i):e.strategy===R||r===n?(l(e,(L<<1)+(i?1:0),3),b(e,Q,ee)):(l(e,(x<<1)+(i?1:0),3),I(e,e.l_desc.max_code+1,e.d_desc.max_code+1,a+1),b(e,e.dyn_ltree,e.dyn_dtree)),m(e),i&&g(e)},t._tr_tally=function(e,t,s){return e.pending_buf[e.d_buf+2*e.last_lit]=t>>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&s,e.last_lit++,0===t?e.dyn_ltree[2*s]++:(e.matches++,t--,e.dyn_ltree[2*(se[s]+G+1)]++,e.dyn_dtree[2*a(t)]++),e.last_lit===e.lit_bufsize-1},t._tr_align=function(e){l(e,L<<1,3),h(e,$,Q),d(e)}},function(e,t,s){"use strict";function i(e){if(!(this instanceof i))return new i(e);this.options=a.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&0==(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new c,this.strm.avail_out=0;var s=r.inflateInit2(this.strm,t.windowBits);if(s!==l.Z_OK)throw new Error(h[s]);this.header=new d,r.inflateGetHeader(this.strm,this.header)}function n(e,t){var s=new i(t);if(s.push(e,!0),s.err)throw s.msg||h[s.err];return s.result}var r=s(145),a=s(11),o=s(67),l=s(69),h=s(39),c=s(68),d=s(148),u=Object.prototype.toString;i.prototype.push=function(e,t){var s,i,n,h,c,d,f=this.strm,p=this.options.chunkSize,m=this.options.dictionary,g=!1;if(this.ended)return!1;i=t===~~t?t:!0===t?l.Z_FINISH:l.Z_NO_FLUSH,"string"==typeof e?f.input=o.binstring2buf(e):"[object ArrayBuffer]"===u.call(e)?f.input=new Uint8Array(e):f.input=e,f.next_in=0,f.avail_in=f.input.length;do{if(0===f.avail_out&&(f.output=new a.Buf8(p),f.next_out=0,f.avail_out=p),(s=r.inflate(f,l.Z_NO_FLUSH))===l.Z_NEED_DICT&&m&&(d="string"==typeof m?o.string2buf(m):"[object ArrayBuffer]"===u.call(m)?new Uint8Array(m):m,s=r.inflateSetDictionary(this.strm,d)),s===l.Z_BUF_ERROR&&!0===g&&(s=l.Z_OK,g=!1),s!==l.Z_STREAM_END&&s!==l.Z_OK)return this.onEnd(s),this.ended=!0,!1;f.next_out&&(0!==f.avail_out&&s!==l.Z_STREAM_END&&(0!==f.avail_in||i!==l.Z_FINISH&&i!==l.Z_SYNC_FLUSH)||("string"===this.options.to?(n=o.utf8border(f.output,f.next_out),h=f.next_out-n,c=o.buf2string(f.output,n),f.next_out=h,f.avail_out=p-h,h&&a.arraySet(f.output,f.output,n,h,0),this.onData(c)):this.onData(a.shrinkBuf(f.output,f.next_out)))),0===f.avail_in&&0===f.avail_out&&(g=!0)}while((f.avail_in>0||0===f.avail_out)&&s!==l.Z_STREAM_END);return s===l.Z_STREAM_END&&(i=l.Z_FINISH),i===l.Z_FINISH?(s=r.inflateEnd(this.strm),this.onEnd(s),this.ended=!0,s===l.Z_OK):i!==l.Z_SYNC_FLUSH||(this.onEnd(l.Z_OK),f.avail_out=0,!0)},i.prototype.onData=function(e){this.chunks.push(e)},i.prototype.onEnd=function(e){e===l.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=a.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},t.Inflate=i,t.inflate=n,t.inflateRaw=function(e,t){return t=t||{},t.raw=!0,n(e,t)},t.ungzip=n},function(e,t,s){"use strict";function i(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function n(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new f.Buf16(320),this.work=new f.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function r(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=M,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new f.Buf32(ce),t.distcode=t.distdyn=new f.Buf32(de),t.sane=1,t.back=-1,T):D}function a(e){var t;return e&&e.state?(t=e.state,t.wsize=0,t.whave=0,t.wnext=0,r(e)):D}function o(e,t){var s,i;return e&&e.state?(i=e.state,t<0?(s=0,t=-t):(s=1+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?D:(null!==i.window&&i.wbits!==t&&(i.window=null),i.wrap=s,i.wbits=t,a(e))):D}function l(e,t){var s,i;return e?(i=new n,e.state=i,i.window=null,(s=o(e,t))!==T&&(e.state=null),s):D}function h(e){if(fe){var t;for(d=new f.Buf32(512),u=new f.Buf32(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(_(v,e.lens,0,288,d,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;_(b,e.lens,0,32,u,0,e.work,{bits:5}),fe=!1}e.lencode=d,e.lenbits=9,e.distcode=u,e.distbits=5}function c(e,t,s,i){var n,r=e.state;return null===r.window&&(r.wsize=1<=r.wsize?(f.arraySet(r.window,t,s-r.wsize,r.wsize,0),r.wnext=0,r.whave=r.wsize):((n=r.wsize-r.wnext)>i&&(n=i),f.arraySet(r.window,t,s-i,n,r.wnext),(i-=n)?(f.arraySet(r.window,t,s-i,i,0),r.wnext=i,r.whave=r.wsize):(r.wnext+=n,r.wnext===r.wsize&&(r.wnext=0),r.whave>>8&255,s.check=m(s.check,De,2,0),u=0,ce=0,s.mode=O;break}if(s.flags=0,s.head&&(s.head.done=!1),!(1&s.wrap)||(((255&u)<<8)+(u>>8))%31){e.msg="incorrect header check",s.mode=oe;break}if((15&u)!==k){e.msg="unknown compression method",s.mode=oe;break}if(u>>>=4,ce-=4,ye=8+(15&u),0===s.wbits)s.wbits=ye;else if(ye>s.wbits){e.msg="invalid window size",s.mode=oe;break}s.dmax=1<>8&1),512&s.flags&&(De[0]=255&u,De[1]=u>>>8&255,s.check=m(s.check,De,2,0)),u=0,ce=0,s.mode=L;case L:for(;ce<32;){if(0===l)break e;l--,u+=n[a++]<>>8&255,De[2]=u>>>16&255,De[3]=u>>>24&255,s.check=m(s.check,De,4,0)),u=0,ce=0,s.mode=x;case x:for(;ce<16;){if(0===l)break e;l--,u+=n[a++]<>8),512&s.flags&&(De[0]=255&u,De[1]=u>>>8&255,s.check=m(s.check,De,2,0)),u=0,ce=0,s.mode=U;case U:if(1024&s.flags){for(;ce<16;){if(0===l)break e;l--,u+=n[a++]<>>8&255,s.check=m(s.check,De,2,0)),u=0,ce=0}else s.head&&(s.head.extra=null);s.mode=G;case G:if(1024&s.flags&&((fe=s.length)>l&&(fe=l),fe&&(s.head&&(ye=s.head.extra_len-s.length,s.head.extra||(s.head.extra=new Array(s.head.extra_len)),f.arraySet(s.head.extra,n,a,fe,ye)),512&s.flags&&(s.check=m(s.check,n,fe,a)),l-=fe,a+=fe,s.length-=fe),s.length))break e;s.length=0,s.mode=P;case P:if(2048&s.flags){if(0===l)break e;fe=0;do{ye=n[a+fe++],s.head&&ye&&s.length<65536&&(s.head.name+=String.fromCharCode(ye))}while(ye&&fe>9&1,s.head.done=!0),e.adler=s.check=0,s.mode=q;break;case H:for(;ce<32;){if(0===l)break e;l--,u+=n[a++]<>>=7&ce,ce-=7&ce,s.mode=ne;break}for(;ce<3;){if(0===l)break e;l--,u+=n[a++]<>>=1,ce-=1,3&u){case 0:s.mode=$;break;case 1:if(h(s),s.mode=J,t===A){u>>>=2,ce-=2;break e}break;case 2:s.mode=W;break;case 3:e.msg="invalid block type",s.mode=oe}u>>>=2,ce-=2;break;case $:for(u>>>=7&ce,ce-=7&ce;ce<32;){if(0===l)break e;l--,u+=n[a++]<>>16^65535)){e.msg="invalid stored block lengths",s.mode=oe;break}if(s.length=65535&u,u=0,ce=0,s.mode=F,t===A)break e;case F:s.mode=K;case K:if(fe=s.length){if(fe>l&&(fe=l),fe>d&&(fe=d),0===fe)break e;f.arraySet(r,n,a,fe,o),l-=fe,a+=fe,d-=fe,o+=fe,s.length-=fe;break}s.mode=q;break;case W:for(;ce<14;){if(0===l)break e;l--,u+=n[a++]<>>=5,ce-=5,s.ndist=1+(31&u),u>>>=5,ce-=5,s.ncode=4+(15&u),u>>>=4,ce-=4,s.nlen>286||s.ndist>30){e.msg="too many length or distance symbols",s.mode=oe;break}s.have=0,s.mode=Y;case Y:for(;s.have>>=3,ce-=3}for(;s.have<19;)s.lens[Ne[s.have++]]=0;if(s.lencode=s.lendyn,s.lenbits=7,Te={bits:s.lenbits},Ae=_(E,s.lens,0,19,s.lencode,0,s.work,Te),s.lenbits=Te.bits,Ae){e.msg="invalid code lengths set",s.mode=oe;break}s.have=0,s.mode=Z;case Z:for(;s.have>>24,_e=Se>>>16&255,Ee=65535&Se,!(ge<=ce);){if(0===l)break e;l--,u+=n[a++]<>>=ge,ce-=ge,s.lens[s.have++]=Ee;else{if(16===Ee){for(Ie=ge+2;ce>>=ge,ce-=ge,0===s.have){e.msg="invalid bit length repeat",s.mode=oe;break}ye=s.lens[s.have-1],fe=3+(3&u),u>>>=2,ce-=2}else if(17===Ee){for(Ie=ge+3;ce>>=ge)),u>>>=3,ce-=3}else{for(Ie=ge+7;ce>>=ge)),u>>>=7,ce-=7}if(s.have+fe>s.nlen+s.ndist){e.msg="invalid bit length repeat",s.mode=oe;break}for(;fe--;)s.lens[s.have++]=ye}}if(s.mode===oe)break;if(0===s.lens[256]){e.msg="invalid code -- missing end-of-block",s.mode=oe;break}if(s.lenbits=9,Te={bits:s.lenbits},Ae=_(v,s.lens,0,s.nlen,s.lencode,0,s.work,Te),s.lenbits=Te.bits,Ae){e.msg="invalid literal/lengths set",s.mode=oe;break}if(s.distbits=6,s.distcode=s.distdyn,Te={bits:s.distbits},Ae=_(b,s.lens,s.nlen,s.ndist,s.distcode,0,s.work,Te),s.distbits=Te.bits,Ae){e.msg="invalid distances set",s.mode=oe;break}if(s.mode=J,t===A)break e;case J:s.mode=X;case X:if(l>=6&&d>=258){e.next_out=o,e.avail_out=d,e.next_in=a,e.avail_in=l,s.hold=u,s.bits=ce,g(e,ue),o=e.next_out,r=e.output,d=e.avail_out,a=e.next_in,n=e.input,l=e.avail_in,u=s.hold,ce=s.bits,s.mode===q&&(s.back=-1);break}for(s.back=0;Se=s.lencode[u&(1<>>24,_e=Se>>>16&255,Ee=65535&Se,!(ge<=ce);){if(0===l)break e;l--,u+=n[a++]<>ve)],ge=Se>>>24,_e=Se>>>16&255,Ee=65535&Se,!(ve+ge<=ce);){if(0===l)break e;l--,u+=n[a++]<>>=ve,ce-=ve,s.back+=ve}if(u>>>=ge,ce-=ge,s.back+=ge,s.length=Ee,0===_e){s.mode=ie;break}if(32&_e){s.back=-1,s.mode=q;break}if(64&_e){e.msg="invalid literal/length code",s.mode=oe;break}s.extra=15&_e,s.mode=Q;case Q:if(s.extra){for(Ie=s.extra;ce>>=s.extra,ce-=s.extra,s.back+=s.extra}s.was=s.length,s.mode=ee;case ee:for(;Se=s.distcode[u&(1<>>24,_e=Se>>>16&255,Ee=65535&Se,!(ge<=ce);){if(0===l)break e;l--,u+=n[a++]<>ve)],ge=Se>>>24,_e=Se>>>16&255,Ee=65535&Se,!(ve+ge<=ce);){if(0===l)break e;l--,u+=n[a++]<>>=ve,ce-=ve,s.back+=ve}if(u>>>=ge,ce-=ge,s.back+=ge,64&_e){e.msg="invalid distance code",s.mode=oe;break}s.offset=Ee,s.extra=15&_e,s.mode=te;case te:if(s.extra){for(Ie=s.extra;ce>>=s.extra,ce-=s.extra,s.back+=s.extra}if(s.offset>s.dmax){e.msg="invalid distance too far back",s.mode=oe;break}s.mode=se;case se:if(0===d)break e;if(fe=ue-d,s.offset>fe){if((fe=s.offset-fe)>s.whave&&s.sane){e.msg="invalid distance too far back",s.mode=oe;break}fe>s.wnext?(fe-=s.wnext,pe=s.wsize-fe):pe=s.wnext-fe,fe>s.length&&(fe=s.length),me=s.window}else me=r,pe=o-s.offset,fe=s.length;fe>d&&(fe=d),d-=fe,s.length-=fe;do{r[o++]=me[pe++]}while(--fe);0===s.length&&(s.mode=X);break;case ie:if(0===d)break e;r[o++]=s.length,d--,s.mode=X;break;case ne:if(s.wrap){for(;ce<32;){if(0===l)break e;l--,u|=n[a++]<>>24,f>>>=b,p-=b,0===(b=v>>>16&255))S[r++]=65535&v;else{if(!(16&b)){if(0==(64&b)){v=m[(65535&v)+(f&(1<>>=b,p-=b),p<15&&(f+=I[i++]<>>24,f>>>=b,p-=b,!(16&(b=v>>>16&255))){if(0==(64&b)){v=g[(65535&v)+(f&(1<l){e.msg="invalid distance too far back",s.mode=30;break e}if(f>>>=b,p-=b,b=r-a,y>b){if((b=y-b)>c&&s.sane){e.msg="invalid distance too far back",s.mode=30;break e}if(A=0,T=u,0===d){if(A+=h-b,b2;)S[r++]=T[A++],S[r++]=T[A++],S[r++]=T[A++],w-=3;w&&(S[r++]=T[A++],w>1&&(S[r++]=T[A++]))}else{A=r-y;do{S[r++]=S[A++],S[r++]=S[A++],S[r++]=S[A++],w-=3}while(w>2);w&&(S[r++]=S[A++],w>1&&(S[r++]=S[A++]))}break}}break}}while(i>3,f&=(1<<(p-=w<<3))-1,e.next_in=i,e.next_out=r,e.avail_in=i=1&&0===x[S];S--);if(D>S&&(D=S),0===S)return h[c++]=20971520,h[c++]=20971520,u.bits=1,0;for(I=1;I0&&(0===e||1!==S))return-1;for(U[1]=0,A=1;A<15;A++)U[A+1]=U[A]+x[A];for(T=0;T852||2===e&&k>592)return 1;for(;;){v=A-R,d[T]E?(b=G[P+d[T]],w=O[L+d[T]]):(b=96,w=0),f=1<>R)+(p-=f)]=v<<24|b<<16|w|0}while(0!==p);for(f=1<>=1;if(0!==f?(M&=f-1,M+=f):M=0,T++,0==--x[A]){if(A===S)break;A=t[s+d[T]]}if(A>D&&(M&g)!==m){for(0===R&&(R=D),_+=I,C=1<<(N=A-R);N+R852||2===e&&k>592)return 1;h[m=M&g]=D<<24|N<<16|_-c|0}}return 0!==M&&(h[_+M]=A-R<<24|64<<16|0),u.bits=D,0}},function(e,t,s){"use strict";e.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},function(e,t,s){class ActionsManager{constructor(e){this.client=e,this.register(s(150)),this.register(s(151)),this.register(s(152)),this.register(s(153)),this.register(s(154)),this.register(s(155)),this.register(s(156)),this.register(s(157)),this.register(s(158)),this.register(s(159)),this.register(s(160)),this.register(s(161)),this.register(s(162)),this.register(s(163)),this.register(s(164)),this.register(s(165)),this.register(s(166)),this.register(s(167)),this.register(s(168)),this.register(s(169)),this.register(s(170)),this.register(s(171)),this.register(s(172)),this.register(s(173)),this.register(s(174)),this.register(s(175))}register(e){this[e.name.replace(/Action$/,"")]=new e(this.client)}}e.exports=ActionsManager},function(e,t,s){const i=s(2),{Events:n}=s(0);class MessageCreateAction extends i{handle(e){const t=this.client,s=t.channels.get(e.channel_id);if(s){const i=s.messages.get(e.id);if(i)return{message:i};const r=s.messages.create(e),a=r.author,o=s.guild?s.guild.member(a):null;return s.lastMessageID=e.id,s.lastMessage=r,a&&(a.lastMessageID=e.id,a.lastMessage=r),o&&(o.lastMessageID=e.id,o.lastMessage=r),t.emit(n.MESSAGE_CREATE,r),{message:r}}return{}}}e.exports=MessageCreateAction},function(e,t,s){const i=s(2),{Events:n}=s(0);class MessageDeleteAction extends i{handle(e){const t=this.client,s=t.channels.get(e.channel_id);let i;return s&&(i=s.messages.get(e.id))&&(s.messages.delete(i.id),t.emit(n.MESSAGE_DELETE,i)),{message:i}}}e.exports=MessageDeleteAction},function(e,t,s){const i=s(2),n=s(3),{Events:r}=s(0);class MessageDeleteBulkAction extends i{handle(e){const t=this.client,s=t.channels.get(e.channel_id);if(s){const i=e.ids,a=new n;for(const e of i){const t=s.messages.get(e);t&&(a.set(t.id,t),s.messages.delete(e))}return a.size>0&&t.emit(r.MESSAGE_BULK_DELETE,a),{messages:a}}return{}}}e.exports=MessageDeleteBulkAction},function(e,t,s){const i=s(2);class MessageUpdateAction extends i{handle(e){const t=this.client.channels.get(e.channel_id);if(t){const s=t.messages.get(e.id);if(s)return s.patch(e),{old:s._edits[0],updated:s}}return{}}}e.exports=MessageUpdateAction},function(e,t,s){const i=s(2);class MessageReactionAdd extends i{handle(e){const t=e.user||this.client.users.get(e.user_id);if(!t)return!1;const s=e.channel||this.client.channels.get(e.channel_id);if(!s||"voice"===s.type)return!1;const i=e.message||s.messages.get(e.message_id);if(!i)return!1;if(!e.emoji)return!1;const n=i.reactions.create({emoji:e.emoji,count:0,me:t.id===this.client.user.id});return n._add(t),{message:i,reaction:n,user:t}}}e.exports=MessageReactionAdd},function(e,t,s){const i=s(2),{Events:n}=s(0);class MessageReactionRemove extends i{handle(e){const t=this.client.users.get(e.user_id);if(!t)return!1;const s=this.client.channels.get(e.channel_id);if(!s||"voice"===s.type)return!1;const i=s.messages.get(e.message_id);if(!i)return!1;if(!e.emoji)return!1;const r=e.emoji.id||decodeURIComponent(e.emoji.name),a=i.reactions.get(r);return!!a&&(a._remove(t),this.client.emit(n.MESSAGE_REACTION_REMOVE,a,t),{message:i,reaction:a,user:t})}}e.exports=MessageReactionRemove},function(e,t,s){const i=s(2),{Events:n}=s(0);class MessageReactionRemoveAll extends i{handle(e){const t=this.client.channels.get(e.channel_id);if(!t||"voice"===t.type)return!1;const s=t.messages.get(e.message_id);return!!s&&(s.reactions.clear(),this.client.emit(n.MESSAGE_REACTION_REMOVE_ALL,s),{message:s})}}e.exports=MessageReactionRemoveAll},function(e,t,s){const i=s(2),{Events:n}=s(0);class ChannelCreateAction extends i{handle(e){const t=this.client,s=t.channels.has(e.id),i=t.channels.create(e);return!s&&i&&t.emit(n.CHANNEL_CREATE,i),{channel:i}}}e.exports=ChannelCreateAction},function(e,t,s){const i=s(2),{Events:n}=s(0);class ChannelDeleteAction extends i{constructor(e){super(e),this.deleted=new Map}handle(e){const t=this.client;let s=t.channels.get(e.id);return s&&(t.channels.remove(s.id),t.emit(n.CHANNEL_DELETE,s)),{channel:s}}}e.exports=ChannelDeleteAction},function(e,t,s){const i=s(2);class ChannelUpdateAction extends i{handle(e){const t=this.client.channels.get(e.id);return t?{old:t._update(e),updated:t}:{}}}e.exports=ChannelUpdateAction},function(e,t,s){const i=s(2),{Events:n}=s(0);class GuildDeleteAction extends i{constructor(e){super(e),this.deleted=new Map}handle(e){const t=this.client;let s=t.guilds.get(e.id);if(s){for(const e of s.channels.values())"text"===e.type&&e.stopTyping(!0);if(s.available&&e.unavailable)return s.available=!1,t.emit(n.GUILD_UNAVAILABLE,s),{guild:null};for(const e of s.channels.values())this.client.channels.remove(e.id);s.voiceConnection&&s.voiceConnection.disconnect(),t.guilds.remove(s.id),t.emit(n.GUILD_DELETE,s),this.deleted.set(s.id,s),this.scheduleForDeletion(s.id)}else s=this.deleted.get(e.id)||null;return{guild:s}}scheduleForDeletion(e){this.client.setTimeout(()=>this.deleted.delete(e),this.client.options.restWsBridgeTimeout)}}e.exports=GuildDeleteAction},function(e,t,s){const i=s(2),{Events:n}=s(0);class GuildUpdateAction extends i{handle(e){const t=this.client,s=t.guilds.get(e.id);if(s){const i=s._update(e);return t.emit(n.GUILD_UPDATE,i,s),{old:i,updated:s}}return{old:null,updated:null}}}e.exports=GuildUpdateAction},function(e,t,s){const i=s(2),{Events:n,Status:r}=s(0);class GuildMemberRemoveAction extends i{handle(e){const t=this.client,s=t.guilds.get(e.guild_id);let i=null;return s&&(i=s.members.get(e.user.id))&&(s.memberCount--,s.members.remove(i.id),t.status===r.READY&&t.emit(n.GUILD_MEMBER_REMOVE,i)),{guild:s,member:i}}}e.exports=GuildMemberRemoveAction},function(e,t,s){const i=s(2),{Events:n}=s(0);class GuildBanRemove extends i{handle(e){const t=this.client,s=t.guilds.get(e.guild_id),i=t.users.create(e.user);s&&i&&t.emit(n.GUILD_BAN_REMOVE,s,i)}}e.exports=GuildBanRemove},function(e,t,s){const i=s(2),{Events:n}=s(0);class GuildRoleCreate extends i{handle(e){const t=this.client,s=t.guilds.get(e.guild_id);let i;if(s){const r=s.roles.has(e.role.id);i=s.roles.create(e.role),r||t.emit(n.GUILD_ROLE_CREATE,i)}return{role:i}}}e.exports=GuildRoleCreate},function(e,t,s){const i=s(2),{Events:n}=s(0);class GuildRoleDeleteAction extends i{handle(e){const t=this.client,s=t.guilds.get(e.guild_id);let i;return s&&(i=s.roles.get(e.role_id))&&(s.roles.remove(e.role_id),t.emit(n.GUILD_ROLE_DELETE,i)),{role:i}}}e.exports=GuildRoleDeleteAction},function(e,t,s){const i=s(2),{Events:n}=s(0);class GuildRoleUpdateAction extends i{handle(e){const t=this.client,s=t.guilds.get(e.guild_id);if(s){let i=null;const r=s.roles.get(e.role.id);return r&&(i=r._update(e.role),t.emit(n.GUILD_ROLE_UPDATE,i,r)),{old:i,updated:r}}return{old:null,updated:null}}}e.exports=GuildRoleUpdateAction},function(e,t,s){const i=s(2),{Events:n}=s(0);class UserUpdateAction extends i{handle(e){const t=this.client;if(t.user){if(t.user.equals(e))return{old:t.user,updated:t.user};const s=t.user._update(e);return t.emit(n.USER_UPDATE,s,t.user),{old:s,updated:t.user}}return{old:null,updated:null}}}e.exports=UserUpdateAction},function(e,t,s){const i=s(2),{Events:n}=s(0);class UserNoteUpdateAction extends i{handle(e){const t=this.client,s=t.user.notes.get(e.id),i=e.note.length?e.note:null;return t.user.notes.set(e.id,i),t.emit(n.USER_NOTE_UPDATE,e.id,s,i),{old:s,updated:i}}}e.exports=UserNoteUpdateAction},function(e,t,s){const i=s(2);class GuildSync extends i{handle(e){const t=this.client.guilds.get(e.id);if(t){if(e.presences)for(const s of e.presences)t.presences.create(s);if(e.members)for(const s of e.members){const e=t.members.get(s.user.id);e?e._patch(s):t.members.create(s,!1)}"large"in e&&(t.large=e.large)}}}e.exports=GuildSync},function(e,t,s){const i=s(2),{Events:n}=s(0);class GuildEmojiCreateAction extends i{handle(e,t){const s=e.emojis.create(t);return this.client.emit(n.GUILD_EMOJI_CREATE,s),{emoji:s}}}e.exports=GuildEmojiCreateAction},function(e,t,s){const i=s(2),{Events:n}=s(0);class GuildEmojiDeleteAction extends i{handle(e){return e.guild.emojis.remove(e.id),this.client.emit(n.GUILD_EMOJI_DELETE,e),{emoji:e}}}e.exports=GuildEmojiDeleteAction},function(e,t,s){const i=s(2),{Events:n}=s(0);class GuildEmojiUpdateAction extends i{handle(e,t){const s=e._update(t);return this.client.emit(n.GUILD_EMOJI_UPDATE,s,e),{emoji:e}}}e.exports=GuildEmojiUpdateAction},function(e,t,s){function i(e){const t=new Map;for(const s of e)t.set(...s);return t}const n=s(2);class GuildEmojisUpdateAction extends n{handle(e){const t=this.client.guilds.get(e.guild_id);if(!t||!t.emojis)return;const s=i(t.emojis.entries());for(const i of e.emojis){const e=t.emojis.get(i.id);e?(s.delete(i.id),e.equals(i,!0)||this.client.actions.GuildEmojiUpdate.handle(e,i)):this.client.actions.GuildEmojiCreate.handle(t,i)}for(const e of s.values())this.client.actions.GuildEmojiDelete.handle(e)}}e.exports=GuildEmojisUpdateAction},function(e,t,s){const i=s(2);class GuildRolesPositionUpdate extends i{handle(e){const t=this.client.guilds.get(e.guild_id);if(t)for(const s of e.roles){const e=t.roles.get(s.id);e&&(e.rawPosition=s.position)}return{guild:t}}}e.exports=GuildRolesPositionUpdate},function(e,t,s){const i=s(2);class GuildChannelsPositionUpdate extends i{handle(e){const t=this.client.guilds.get(e.guild_id);if(t)for(const s of e.channels){const e=t.channels.get(s.id);e&&(e.rawPosition=s.position)}return{guild:t}}}e.exports=GuildChannelsPositionUpdate},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t,s){const i=s(17),n=s(29);class WebhookClient extends n{constructor(e,t,s){super(s),Object.defineProperty(this,"client",{value:this}),this.id=e,this.token=t}}i.applyToClass(WebhookClient),e.exports=WebhookClient}]); \ No newline at end of file +window.Discord=function(e){function t(i){if(s[i])return s[i].exports;var n=s[i]={i:i,l:!1,exports:{}};return e[i].call(n.exports,n,n.exports,t),n.l=!0,n.exports}var s={};return t.m=e,t.c=s,t.d=function(e,s,i){t.o(e,s)||Object.defineProperty(e,s,{configurable:!1,enumerable:!0,get:i})},t.n=function(e){var s=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(s,"a",s),s},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=75)}([function(e,t,s){function i(e,{format:t="webp",size:s}={}){if(t&&!l.includes(t))throw new r("IMAGE_FORMAT",t);if(s&&!h.includes(s))throw new o("IMAGE_SIZE",s);return`${e}.${t}${s?`?size=${s}`:""}`}const n=t.Package=s(41),{Error:r,RangeError:o}=s(4),a=t.browser="undefined"!=typeof window;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:!1,properties:{$os:a?"browser":process.platform,$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.UserAgent=a?null:`DiscordBot (${n.homepage.split("#")[0]}, ${n.version}) Node.js/${process.version}`,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 l=["webp","png","jpg","gif"],h=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,s,n="default",r)=>"1"===t?s:("default"===n&&(n=s.startsWith("a_")?"gif":"webp"),i(`${e}/avatars/${t}/${s}`,{format:n,size:r})),Icon:(t,s,n="webp",r)=>i(`${e}/icons/${t}/${s}`,{format:n,size:r}),AppIcon:(t,s,{format:n="webp",size:r}={})=>i(`${e}/app-icons/${t}/${s}`,{size:r,format:n}),AppAsset:(t,s,{format:n="webp",size:r}={})=>i(`${e}/app-assets/${t}/${s}`,{size:r,format:n}),GDMIcon:(t,s,n="webp",r)=>i(`${e}/channel-icons/${t}/${s}`,{size:r,format:n}),Splash:(t,s,n="webp",r)=>i(`${e}/splashes/${t}/${s}`,{size:r,format:n})}),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.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={RATE_LIMIT:"rateLimit",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 s of e)t[s]=s;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.ChannelTypes={TEXT:0,DM:1,VOICE:2,GROUP:3,CATEGORY: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}},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),s=this.values();for(let i=0;i{const i=e.get(s);return i!==t||void 0===i&&!e.has(s)}))}sort(e=((e,t)=>+(e>t)||+(e===t)-1)){return new Collection(Array.from(this.entries()).sort((t,s)=>e(t[1],s[1],t[0],s[0])))}}e.exports=Collection},function(e,t,s){e.exports=s(42),e.exports.Messages=s(82)},function(e,t,s){const i=s(27),n=s(28),{Colors:r,DefaultOptions:o,Endpoints:a}=s(0),{Error:l,RangeError:h,TypeError:c}=s(4),d=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),u=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^/]+?|)(\.[^./]*|))(?:[/]*)$/;class Util{constructor(){throw new Error(`The ${this.constructor.name} class may not be instantiated.`)}static splitMessage(e,{maxLength:t=1950,char:s="\n",prepend:i="",append:n=""}={}){if(e.length<=t)return e;const r=e.split(s);if(1===r.length)throw new h("SPLIT_MAX_LEN");const o=[""];let a=0;for(let e=0;et&&(o[a]+=n,o.push(i),a++),o[a]+=(o[a].length>0&&o[a]!==i?s:"")+r[e];return o.filter(e=>e)}static escapeMarkdown(e,t=!1,s=!1){return t?e.replace(/```/g,"`​``"):s?e.replace(/\\(`|\\)/g,"$1").replace(/(`|\\)/g,"\\$1"):e.replace(/\\(\*|_|`|~|\\)/g,"$1").replace(/(\*|_|`|~|\\)/g,"\\$1")}static fetchRecommendedShards(e,t=1e3){return new Promise((s,i)=>{if(!e)throw new l("TOKEN_MISSING");n.get(`${o.http.api}/v${o.http.version}${a.botGateway}`).set("Authorization",`Bot ${e.replace(/^Bot\s*/i,"")}`).end((e,n)=>{e&&i(e),s(n.body.shards*(1e3/t))})})}static parseEmoji(e){if(e.includes("%")&&(e=decodeURIComponent(e)),e.includes(":")){const[t,s]=e.split(":");return{name:t,id:s}}return{name:e,id:null}}static arraysEqual(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(const s of e){const e=t.indexOf(s);-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 s in e)d(t,s)&&void 0!==t[s]?t[s]===Object(t[s])&&(t[s]=this.mergeDefault(e[s],t[s])):t[s]=e[s];return t}static convertToBuffer(e){return"string"==typeof e&&(e=this.str2ab(e)),Buffer.from(e)}static str2ab(e){const t=new ArrayBuffer(2*e.length),s=new Uint16Array(t);for(var i=0,n=e.length;i-1&&s16777215)throw new h("COLOR_RANGE");if(e&&isNaN(e))throw new c("COLOR_CONVERT");return e}static discordSort(e){return e.sort((e,t)=>e.rawPosition-t.rawPosition||i.fromString(e.id).sub(i.fromString(t.id)).toNumber())}static setPosition(e,t,s,i,n,r){let o=i.array();return Util.moveElementInArray(o,e,t,s),o=o.map((e,t)=>({id:e.id,position:t})),n.patch({data:o,reason:r}).then(()=>o)}static basename(e,t){let s=u.exec(e).slice(1)[2];return t&&s.substr(-1*t.length)===t&&(s=s.substr(0,s.length-t.length)),s}}e.exports=Util},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,s){const i=s(3);class DataStore extends i{constructor(e,t,s){if(super(),Object.defineProperty(this,"client",{value:e}),Object.defineProperty(this,"holds",{value:s}),t)for(const e of t)this.create(e)}create(e,t=!0,{id:s,extras:i=[]}={}){const n=this.get(s||e.id);if(n)return n;const r=this.holds?new this.holds(this.client,e,...i):e;return t&&this.set(s||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 e?e:null}}e.exports=DataStore},function(e,t,s){function i(e,t,s="0"){return String(e).length>=t?String(e):(String(s).repeat(t)+e).slice(-t)}const n=s(27);let r=0;class SnowflakeUtil{constructor(){throw new Error(`The ${this.constructor.name} class may not be instantiated.`)}static generate(){r>=4095&&(r=0);const e=`${i((Date.now()-14200704e5).toString(2),42)}0000100000${i((r++).toString(2),12)}`;return n.fromString(e,2).toString()}static deconstruct(e){const t=i(n.fromString(e).toString(2),64),s={timestamp:parseInt(t.substring(0,42),2)+14200704e5,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(s,"date",{get:function(){return new Date(this.timestamp)},enumerable:!0}),s}}e.exports=SnowflakeUtil},function(e,t,s){const i=s(49),n=s(49),r=s(28),o=s(5),{Error:a,TypeError:l}=s(4),{browser:h}=s(0);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){if(!e)return null;if("string"==typeof e&&e.startsWith("data:"))return e;const t=await this.resolveFile(e);return DataResolver.resolveBase64(t)}static resolveBase64(e){return e instanceof Buffer?`data:image/jpg;base64,${e.toString("base64")}`:e}static resolveFile(e){return e instanceof Buffer?Promise.resolve(e):h&&e instanceof ArrayBuffer?Promise.resolve(o.convertToBuffer(e)):"string"==typeof e?new Promise((t,s)=>{if(/^https?:\/\//.test(e))r.get(e).end((e,i)=>e?s(e):i.body instanceof Buffer?t(i.body):s(new l("REQ_BODY_TYPE")));else{const r=h?e:i.resolve(e);n.stat(r,(e,i)=>e?s(e):i&&i.isFile()?(n.readFile(r,(e,i)=>{e?s(e):t(i)}),null):s(new a("FILE_NOT_FOUND",r)))}}):e.pipe&&"function"==typeof e.pipe?new Promise((t,s)=>{const i=[];e.once("error",s),e.on("data",e=>i.push(e)),e.once("end",()=>t(Buffer.concat(i)))}):Promise.reject(new l("REQ_RESOURCE_TYPE"))}}e.exports=DataResolver},function(e,t,s){const{RangeError:i}=s(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))}freeze(){return Object.freeze(this)}add(...e){let t=0;for(let s=e.length-1;s>=0;s--)t|=this.constructor.resolve(e[s]);return Object.isFrozen(this)?new this.constructor(this.bitfield|t):(this.bitfield|=t,this)}remove(...e){let t=0;for(let s=e.length-1;s>=0;s--)t|=this.constructor.resolve(e[s]);return Object.isFrozen(this)?new this.constructor(this.bitfield&~t):(this.bitfield&=~t,this)}serialize(e=!0){const t={};for(const s in this.constructor.FLAGS)t[s]=this.has(s,e);return t}static resolve(e){if("number"==typeof e&&e>=0)return e;if(e instanceof Permissions)return e.bitfield;if(e instanceof Array)return e.map(e=>this.resolve(e)).reduce((e,t)=>e|t,0);if("string"==typeof e)return this.FLAGS[e];throw new i("PERMISSIONS_INVALID")}}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,s){"use strict";function i(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var n="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;t.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var s=t.shift();if(s){if("object"!=typeof s)throw new TypeError(s+"must be non-object");for(var n in s)i(s,n)&&(e[n]=s[n])}}return e},t.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var r={arraySet:function(e,t,s,i,n){if(t.subarray&&e.subarray)e.set(t.subarray(s,s+i),n);else for(var r=0;rthis)}static create(e,t,i){const n=s(46),o=s(51),a=s(52),l=s(54),h=s(55),c=s(16);let d;if(t.type===r.DM)d=new n(e,t);else if(t.type===r.GROUP)d=new o(e,t);else if(i=i||e.guilds.get(t.guild_id)){switch(t.type){case r.TEXT:d=new a(i,t);break;case r.VOICE:d=new l(i,t);break;case r.CATEGORY:d=new h(i,t);break;default:d=new c(i,t)}i.channels.set(d.id,d)}return d}}e.exports=Channel},function(e,t,s){const i=s(18),n=s(22),r=s(10),o=s(3),a=s(6),{Presence:l}=s(14),{Error:h,TypeError:c}=s(4);class GuildMember extends a{constructor(e,t,s){super(e),this.guild=s,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),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 l(this.client)}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 s=this.guild.roles.get(t);s&&e.set(s.id,s)}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(){return this.user.id===this.guild.ownerID?new r(r.ALL).freeze():new r(this.roles.map(e=>e.permissions)).freeze()}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 h("GUILD_CHANNEL_RESOLVE");return e.permissionsFor(this)}hasPermission(e,t=!0,s=!0){return!(!s||this.user.id!==this.guild.ownerID)||this.roles.some(s=>s.permissions.has(e,t))}missingPermissions(e,t=!1){return this.permissions.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 n?e.id:e));let s=this.client.api.guilds(this.guild.id);if(this.user.id===this.client.user.id){const t=Object.keys(e);s=1===t.length&&"nick"===t[0]?s.members("@me").nick:s.members(this.id)}else s=s.members(this.id);return s.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 c("INVALID_TYPE","role","Role nor a Snowflake"))}addRoles(e,t){let s=this._roles.slice();for(let t of e instanceof o?e.values():e){if(!(t=this.guild.roles.resolve(t)))return Promise.reject(new c("INVALID_TYPE","roles","Array or Collection of Roles or Snowflakes",!0));s.push(t.id)}return this.edit({roles:s},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(),s=t._roles.indexOf(e.id);return~s&&t._roles.splice(s,1),t}):Promise.resolve(this):Promise.reject(new c("INVALID_TYPE","role","Role nor a Snowflake"))}removeRoles(e,t){const s=this._roles.slice();for(let t of e instanceof o?e.values():e){if(!(t=this.guild.roles.resolve(t)))return Promise.reject(new c("INVALID_TYPE","roles","Array or Collection of Roles or Snowflakes",!0));const e=s.indexOf(t.id);e>=0&&s.splice(e,1)}return this.edit({roles:s},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(){}}i.applyToClass(GuildMember),e.exports=GuildMember},function(e,t,s){const{ActivityTypes:i}=s(0);class Presence{constructor(e,t={}){Object.defineProperty(this,"client",{value:e}),this.patch(t)}patch(e){this.status=e.status||this.status||"offline";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=i[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,s){const i=s(9),{createMessage:n}=s(21);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}async send(e,t){t||"object"!=typeof e||e instanceof Array?t||(t={}):(t=e,e=null),t.content||(t.content=e);const{data:s,files:i}=await n(this,t);return this.client.api.webhooks(this.id,this.token).post({data:s,files: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,channel:s},n){return t&&"string"==typeof t&&!t.startsWith("data:")?i.resolveImage(t).then(t=>this.edit({name:e,avatar:t},n)):(s&&(s=this.client.channels.resolveID(s)),this.client.api.webhooks(this.id,s?void 0:this.token).patch({data:{name:e,avatar:t,channel_id:s},reason:n}).then(e=>(this.name=e.name,this.avatar=e.avatar,this.channelID=e.channel_id,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},function(e,t,s){const i=s(12),n=s(22),r=s(25),o=s(53),a=s(5),l=s(10),h=s(3),{MessageNotificationTypes:c}=s(0),{Error:d,TypeError:u}=s(4);class GuildChannel extends i{constructor(e,t){super(e.client,t),this.guild=e}_patch(e){if(super._patch(e),this.name=e.name,this.rawPosition=e.position,this.parentID=e.parent_id,this.permissionOverwrites=new h,e.permission_overwrites)for(const t of e.permission_overwrites)this.permissionOverwrites.set(t.id,new o(this,t))}get parent(){return this.guild.channels.get(this.parentID)}get permissionsLocked(){return this.parent?this.permissionOverwrites.size===this.parent.permissionOverwrites.size&&!this.permissionOverwrites.find((e,t)=>{const s=this.parent.permissionOverwrites.get(t);return void 0===s||s.denied.bitfield!==e.denied.bitfield||s.allowed.bitfield!==e.allowed.bitfield}):null}get position(){const e=this.guild._sortedChannels(this);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 l(l.ALL).freeze();const t=e.roles,s=new l(t.map(e=>e.permissions));if(s.has(l.FLAGS.ADMINISTRATOR))return new l(l.ALL).freeze();const i=this.overwritesFor(e,!0,t);return s.remove(i.everyone?i.everyone.denied:0).add(i.everyone?i.everyone.allowed:0).remove(i.roles.length>0?i.roles.map(e=>e.denied):0).add(i.roles.length>0?i.roles.map(e=>e.allowed):0).remove(i.member?i.member.denied:0).add(i.member?i.member.allowed:0).freeze()}overwritesFor(e,t=!1,s=null){if(t||(e=this.guild.members.resolve(e)),!e)return[];s=s||e.roles;const i=[];let n,r;for(const t of this.permissionOverwrites.values())t.id===this.guild.id?r=t:s.has(t.id)?i.push(t):t.id===e.id&&(n=t);return{everyone:r,roles:i,member:n}}overwritePermissions(e,t,s){const i=new l(0),r=new l(0);let o;const a=this.guild.roles.get(e);if(a||e instanceof n)e=a||e,o="role";else if(e=this.client.users.resolve(e),o="member",!e)return Promise.reject(new u("INVALID_TYPE","parameter","User nor a Role",!0));const h=this.permissionOverwrites.get(e.id);h&&(i.add(h.allowed),r.add(h.denied));for(const e in t)!0===t[e]?(i.add(l.FLAGS[e]||0),r.remove(l.FLAGS[e]||0)):!1===t[e]?(i.remove(l.FLAGS[e]||0),r.add(l.FLAGS[e]||0)):null===t[e]&&(i.remove(l.FLAGS[e]||0),r.remove(l.FLAGS[e]||0));return this.client.api.channels(this.id).permissions[e.id].put({data:{id:e.id,type:o,allow:i.bitfield,deny:r.bitfield},reason:s}).then(()=>this)}lockPermissions(){if(!this.parent)return Promise.reject(new d("GUILD_CHANNEL_ORPHAN"));const e=this.parent.permissionOverwrites.map(e=>({deny:e.denied.bitfield,allow:e.allowed.bitfield,id:e.id,type:e.type}));return this.edit({permissionOverwrites:e})}get members(){const e=new h;for(const t of this.guild.members.values())this.permissionsFor(t).has("VIEW_CHANNEL")&&e.set(t.id,t);return e}async edit(e,t){return void 0!==e.position&&await a.setPosition(this,e.position,!1,this.guild._sortedChannels(this),this.client.api.guilds(this.guild.id).channels,t).then(e=>{this.client.actions.GuildChannelsPositionUpdate.handle({guild_id:this.guild.id,channels:e})}),this.client.api.channels(this.id).patch({data:{name:(e.name||this.name).trim(),topic:e.topic,nsfw:e.nsfw,bitrate:e.bitrate||(this.bitrate?1e3*this.bitrate:void 0),user_limit:null!=e.userLimit?e.userLimit:this.userLimit,parent_id:e.parentID,lock_permissions:e.lockPermissions,permission_overwrites:e.permissionOverwrites},reason:t}).then(e=>{const t=this._clone();return t._patch(e),t})}setName(e,t){return this.edit({name:e},t)}setParent(e,{lockPermissions:t=!0,reason:s}={}){return this.edit({parentID:e.id?e.id:e,lockPermissions:t},s)}setTopic(e,t){return this.edit({topic:e},t)}setPosition(e,{relative:t,reason:s}={}){return a.setPosition(this,e,t,this.guild._sortedChannels(this),this.client.api.guilds(this.guild.id).channels,s).then(e=>(this.client.actions.GuildChannelsPositionUpdate.handle({guild_id:this.guild.id,channels:e}),this))}createInvite({temporary:e=!1,maxAge:t=86400,maxUses:s=0,unique:i,reason:n}={}){return this.client.api.channels(this.id).invites.post({data:{temporary:e,max_age:t,max_uses:s,unique:i},reason:n}).then(e=>new r(this.client,e))}clone({name:e=this.name,withPermissions:t=!0,withTopic:s=!0,reason:i}={}){const n={overwrites:t?this.permissionOverwrites:[],reason:i};return this.guild.createChannel(e,this.type,n).then(e=>s?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.permissionsFor(this.client.user).has(l.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 c[3]}}toString(){return`<#${this.id}>`}}e.exports=GuildChannel},function(e,t,s){const i=s(18),{Presence:n}=s(14),r=s(101),o=s(8),a=s(6),{Error:l}=s(4);class User extends a{constructor(e,t){super(e),this.id=t.id,this.bot=Boolean(t.bot),this._patch(t)}_patch(e){e.username&&(this.username=e.username),e.discriminator&&(this.discriminator=e.discriminator),void 0!==e.avatar&&(this.avatar=e.avatar),this.lastMessageID=null,this.lastMessage=null}get createdTimestamp(){return o.deconstruct(this.id).timestamp}get createdAt(){return new Date(this.createdTimestamp)}get presence(){if(this.client.presences.has(this.id))return this.client.presences.get(this.id);for(const e of this.client.guilds.values())if(e.presences.has(this.id))return e.presences.get(this.id);return new n(this.client)}avatarURL({format:e,size:t}={}){return this.avatar?this.client.rest.cdn.Avatar(this.id,this.avatar,e,t):null}get defaultAvatarURL(){return this.client.rest.cdn.DefaultAvatar(this.discriminator%5)}displayAvatarURL(e){return this.avatarURL(e)||this.defaultAvatarURL}get tag(){return`${this.username}#${this.discriminator}`}get note(){return this.client.user.notes.get(this.id)||null}typingIn(e){return(e=this.client.channels.resolve(e))._typing.has(this.id)}typingSinceIn(e){return(e=this.client.channels.resolve(e))._typing.has(this.id)?new Date(e._typing.get(this.id).since):null}typingDurationIn(e){return(e=this.client.channels.resolve(e))._typing.has(this.id)?e._typing.get(this.id).elapsedTime:-1}get dmChannel(){return this.client.channels.filter(e=>"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 l("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(){}}i.applyToClass(User),e.exports=User},function(e,t,s){const i=s(45),n=s(21),r=s(8),o=s(3),{RangeError:a,TypeError:l}=s(4);class TextBasedChannel{constructor(){this.messages=new h(this),this.lastMessageID=null,this.lastMessage=null}send(e,t){return t||"object"!=typeof e||e instanceof Array?t||(t={}):(t=e,e=null),t.content||(t.content=e),n.sendMessage(this,t)}search(e={}){return n.search(this,e)}startTyping(e){if(void 0!==e&&e<1)throw new a("TYPING_COUNT");if(this.client.user._typing.has(this.id)){const t=this.client.user._typing.get(this.id);return t.count=e||t.count+1,t.promise}const t={};return t.promise=new Promise((s,i)=>{const n=this.client.api.channels[this.id].typing;Object.assign(t,{count:e||1,interval:this.client.setInterval(()=>{n.post().catch(e=>{this.client.clearInterval(t.interval),this.client.user._typing.delete(this.id),i(e)})},9e3),resolve:s}),n.post().catch(e=>{this.client.clearInterval(t.interval),this.client.user._typing.delete(this.id),i(e)}),this.client.user._typing.set(this.id,t)}),t.promise}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),t.resolve())}}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 i(this,e,t)}awaitMessages(e,t={}){return new Promise((s,i)=>{this.createMessageCollector(e,t).once("end",(e,n)=>{t.errors&&t.errors.includes(n)?i(e):s(e)})})}async bulkDelete(e,t=!1){if(e instanceof Array||e instanceof o){let s=e instanceof o?e.keyArray():e.map(e=>e.id||e);if(t&&(s=s.filter(e=>Date.now()-r.deconstruct(e).date.getTime()<12096e5)),0===s.length)return new o;if(1===s.length){await this.client.api.channels(this.id).messages(s[0]).delete();const e=this.client.actions.MessageDelete.handle({channel_id:this.id,id:s[0]}).message;return e?new o([[e.id,e]]):new o}return await this.client.api.channels[this.id].messages["bulk-delete"].post({data:{messages:s}}),this.client.actions.MessageDeleteBulk.handle({channel_id:this.id,ids:s}).messages}if(!isNaN(e)){const s=await this.messages.fetch({limit:e});return this.bulkDelete(s,t)}throw new l("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,s=[]){const i=["send"];t&&i.push("acknowledge","search","bulkDelete","startTyping","stopTyping","typing","typingCount","createMessageCollector","awaitMessages");for(const t of i)s.includes(t)||Object.defineProperty(e.prototype,t,Object.getOwnPropertyDescriptor(TextBasedChannel.prototype,t))}}e.exports=TextBasedChannel;const h=s(19)},function(e,t,s){const i=s(7),n=s(3),r=s(32),{Error:o}=s(4);class MessageStore extends i{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 s=this.client.options.messageCacheMaxSize;0!==s&&(this.size>=s&&s>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 n;for(const s of e)t.set(s.id,this.create(s));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 s=t.get(e);if(!s)throw new o("MESSAGE_MISSING");return s})}_fetchMany(e={}){return this.client.api.channels[this.channel.id].messages.get({query:e}).then(e=>{const t=new n;for(const s of e)t.set(s.id,this.create(s));return t})}}e.exports=MessageStore},function(e,t){function s(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function i(e){return"function"==typeof e}function n(e){return"number"==typeof e}function r(e){return"object"==typeof e&&null!==e}function o(e){return void 0===e}e.exports=s,s.EventEmitter=s,s.prototype._events=void 0,s.prototype._maxListeners=void 0,s.defaultMaxListeners=10,s.prototype.setMaxListeners=function(e){if(!n(e)||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},s.prototype.emit=function(e){var t,s,n,a,l,h;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 c=new Error('Uncaught, unspecified "error" event. ('+t+")");throw c.context=t,c}if(s=this._events[e],o(s))return!1;if(i(s))switch(arguments.length){case 1:s.call(this);break;case 2:s.call(this,arguments[1]);break;case 3:s.call(this,arguments[1],arguments[2]);break;default:a=Array.prototype.slice.call(arguments,1),s.apply(this,a)}else if(r(s))for(a=Array.prototype.slice.call(arguments,1),n=(h=s.slice()).length,l=0;l0&&this._events[e].length>n&&(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},s.prototype.on=s.prototype.addListener,s.prototype.once=function(e,t){function s(){this.removeListener(e,s),n||(n=!0,t.apply(this,arguments))}if(!i(t))throw TypeError("listener must be a function");var n=!1;return s.listener=t,this.on(e,s),this},s.prototype.removeListener=function(e,t){var s,n,o,a;if(!i(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(s=this._events[e],o=s.length,n=-1,s===t||i(s.listener)&&s.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(r(s)){for(a=o;a-- >0;)if(s[a]===t||s[a].listener&&s[a].listener===t){n=a;break}if(n<0)return this;1===s.length?(s.length=0,delete this._events[e]):s.splice(n,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},s.prototype.removeAllListeners=function(e){var t,s;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(s=this._events[e],i(s))this.removeListener(e,s);else if(s)for(;s.length;)this.removeListener(e,s[s.length-1]);return delete this._events[e],this},s.prototype.listeners=function(e){return this._events&&this._events[e]?i(this._events[e])?[this._events[e]]:this._events[e].slice():[]},s.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(i(t))return 1;if(t)return t.length}return 0},s.listenerCount=function(e,t){return e.listenerCount(t)}},function(e,t,s){e.exports={search:s(98),sendMessage:s(100),createMessage:s(60)}},function(e,t,s){const i=s(8),n=s(10),r=s(5),o=s(6),{TypeError:a}=s(4);class Role extends o{constructor(e,t,s){super(e),this.guild=s,t&&this._patch(t)}_patch(e){this.id=e.id,this.name=e.name,this.color=e.color,this.hoist=e.hoist,this.rawPosition=e.position,this.permissions=new n(e.permissions).freeze(),this.managed=e.managed,this.mentionable=e.mentionable}get createdTimestamp(){return i.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(n.FLAGS.MANAGE_ROLES)&&e.highestRole.comparePositionTo(this)>0}get position(){const e=this.guild._sortedRoles();return e.array().indexOf(e.get(this.id))}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"))}async edit(e,t){return e.permissions?e.permissions=n.resolve(e.permissions):e.permissions=this.permissions.bitfield,void 0!==e.position&&await r.setPosition(this,e.position,!1,this.guild._sortedRoles(),this.client.api.guilds(this.guild.id).roles,t).then(e=>{this.client.actions.GuildRolesPositionUpdate.handle({guild_id:this.guild.id,roles:e})}),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,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)}setPermissions(e,t){return this.edit({permissions:e},t)}setMentionable(e,t){return this.edit({mentionable:e},t)}setPosition(e,{relative:t,reason:s}={}){return r.setPosition(this,e,t,this.guild._sortedRoles(),this.client.api.guilds(this.guild.id).roles,s).then(e=>(this.client.actions.GuildRolesPositionUpdate.handle({guild_id:this.guild.id,roles:e}),this))}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.bitfield===e.permissions.bitfield&&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,s){this.file=null,s&&this._patch(s),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,s){const i=s(23),n=s(5),{RangeError:r}=s(4);class MessageEmbed{constructor(e={}){this.setup(e)}setup(e){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?e.fields.map(n.cloneObject):[],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&&(this.files=e.files.map(e=>e instanceof i?"string"==typeof e.file?e.file:n.cloneObject(e.file):e))}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,s=!1){if(this.fields.length>=25)throw new r("EMBED_FIELD_COUNT");if(e=n.resolveString(e),!String(e)||e.length>256)throw new r("EMBED_FIELD_NAME");if(t=n.resolveString(t),!String(t)||t.length>1024)throw new r("EMBED_FIELD_VALUE");return this.fields.push({name:e,value:t,inline:s}),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 i&&(t=t.file);return this}setAuthor(e,t,s){return this.author={name:n.resolveString(e),iconURL:t,url:s},this}setColor(e){return this.color=n.resolveColor(e),this}setDescription(e){if((e=n.resolveString(e)).length>2048)throw new r("EMBED_DESCRIPTION");return this.description=e,this}setFooter(e,t){if((e=n.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=n.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,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,s){const{Endpoints:i}=s(0),n=s(6);class Invite extends n{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 i.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,s){const i=s(25),n=s(56),r=s(15),o=s(13),a=s(36),{ChannelTypes:l,Events:h,browser:c}=s(0),d=s(3),u=s(5),p=s(9),f=s(8),m=s(10),g=s(21),_=s(57),E=s(58),v=s(37),b=s(59),w=s(38),y=s(6),{Error:A,TypeError:T}=s(4);class Guild extends y{constructor(e,t){super(e),this.members=new _(this),this.channels=new b(this),this.roles=new E(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 v(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)}get verified(){return this.features.includes("VERIFIED")}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 c?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)}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 d))}fetchInvites(){return this.client.api.guilds(this.id).invites.get().then(e=>{const t=new d;for(const s of e){const e=new i(this.client,s);t.set(e.code,e)}return t})}fetchWebhooks(){return this.client.api.guilds(this.id).webhooks.get().then(e=>{const t=new d;for(const s of e)t.set(s.id,new r(this.client,s));return t})}fetchVoiceRegions(){return this.client.api.guilds(this.id).regions.get().then(e=>{const t=new d;for(const s of e)t.set(s.id,new a(s));return t})}fetchAuditLogs(e={}){return e.before&&e.before instanceof n.Entry&&(e.before=e.before.id),e.after&&e.after instanceof n.Entry&&(e.after=e.after.id),"string"==typeof e.type&&(e.type=n.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=>n.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 s of t.roles instanceof d?t.roles.values():t.roles){if(!(s=this.roles.resolve(s)))return Promise.reject(new T("INVALID_TYPE","options.roles","Array or Collection of Roles or Snowflakes",!0));e.push(s.id)}}return this.client.api.guilds(this.id).members(e.id).put({data:t}).then(e=>this.members.create(e))}search(e={}){return g.search(this,e)}edit(e,t){const s={};return e.name&&(s.name=e.name),e.region&&(s.region=e.region),void 0!==e.verificationLevel&&(s.verification_level=Number(e.verificationLevel)),void 0!==e.afkChannel&&(s.afk_channel_id=this.client.channels.resolveID(e.afkChannel)),void 0!==e.systemChannel&&(s.system_channel_id=this.client.channels.resolveID(e.systemChannel)),e.afkTimeout&&(s.afk_timeout=Number(e.afkTimeout)),void 0!==e.icon&&(s.icon=e.icon),e.owner&&(s.owner_id=this.client.users.resolve(e.owner).id),e.splash&&(s.splash=e.splash),void 0!==e.explicitContentFilter&&(s.explicit_content_filter=Number(e.explicitContentFilter)),this.client.api.guilds(this.id).patch({data:s,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 p.resolveImage(e),reason:t})}setOwner(e,t){return this.edit({owner:e},t)}async setSplash(e,t){return this.edit({splash:await p.resolveImage(e),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 s=this.client.users.resolveID(e);return s?this.client.api.guilds(this.id).bans[s].put({query:t}).then(()=>{if(e instanceof o)return e;const t=this.client.users.resolve(s);return t?this.members.resolve(t)||t:s}):Promise.reject(new A("BAN_RESOLVE_ID",!0))}unban(e,t){const s=this.client.users.resolveID(e);if(!s)throw new A("BAN_RESOLVE_ID");return this.client.api.guilds(this.id).bans[s].delete({reason:t}).then(()=>e)}pruneMembers({days:e=7,dry:t=!1,reason:s}={}){if("number"!=typeof e)throw new T("PRUNE_DAYS_TYPE");return this.client.api.guilds(this.id).prune[t?"get":"post"]({query:{days:e},reason:s}).then(e=>e.pruned)}sync(){this.client.user.bot||this.client.syncGuilds([this])}createChannel(e,t,{nsfw:s,bitrate:i,userLimit:n,parent:r,overwrites:o,reason:a}={}){return(o instanceof d||o instanceof Array)&&(o=o.map(e=>{let t=e.allow||(e.allowed?e.allowed.bitfield:0),s=e.deny||(e.denied?e.denied.bitfield:0);t instanceof Array&&(t=m.resolve(t)),s instanceof Array&&(s=m.resolve(s));const i=this.roles.resolve(e.id);return i?(e.id=i.id,e.type="role"):(e.id=this.client.users.resolveID(e.id),e.type="member"),{allow:t,deny:s,type:e.type,id:e.id}})),r&&(r=this.client.channels.resolveID(r)),this.client.api.guilds(this.id).channels.post({data:{name:e,type:l[t.toUpperCase()],nsfw:s,bitrate:i,user_limit:n,parent_id:r,permission_overwrites:o},reason:a}).then(e=>this.client.actions.ChannelCreate.handle(e).channel)}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=u.resolveColor(e.color)),e.permissions&&(e.permissions=m.resolve(e.permissions)),this.client.api.guilds(this.id).roles.post({data:e,reason:t}).then(s=>{const{role:i}=this.client.actions.GuildRoleCreate.handle({guild_id:this.id,role:s});return e.position?i.setPosition(e.position,t):i})}createEmoji(e,t,{roles:s,reason:i}={}){if("string"==typeof e&&e.startsWith("data:")){const n={image:e,name:t};if(s){n.roles=[];for(let e of s instanceof d?s.values():s){if(!(e=this.roles.resolve(e)))return Promise.reject(new T("INVALID_TYPE","options.roles","Array or Collection of Roles or Snowflakes",!0));n.roles.push(e.id)}}return this.client.api.guilds(this.id).emojis.post({data:n,reason:i}).then(e=>this.client.actions.GuildEmojiCreate.handle(this,e).emoji)}return p.resolveImage(e).then(e=>this.createEmoji(e,t,{roles:s,reason:i}))}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&&u.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 s=this.members.get(e);s&&s.speaking!==t&&(s.speaking=t,this.client.emit(h.GUILD_MEMBER_SPEAKING,s,t))}_sortedRoles(){return u.discordSort(this.roles)}_sortedChannels(e){const t=e.type===l.CATEGORY;return u.discordSort(this.channels.filter(s=>s.type===e.type&&(t||s.parent===e.parent)))}}class VoiceStateCollection extends d{constructor(e){super(),this.guild=e}set(e,t){const s=this.guild.members.get(e);if(s){s.voiceChannel&&s.voiceChannel.id!==t.channel_id&&s.voiceChannel.members.delete(s.id),t.channel_id||(s.speaking=null);const e=this.guild.channels.get(t.channel_id);e&&e.members.set(s.user.id,s)}super.set(e,t)}}e.exports=Guild},function(e,t,s){var i,n,r;!function(s,o){n=[],void 0!==(r="function"==typeof(i=o)?i.apply(t,n):i)&&(e.exports=r)}(0,function(){"use strict";function e(e,t,s){this.low=0|e,this.high=0|t,this.unsigned=!!s}function t(e){return!0===(e&&e.__isLong__)}function s(e,t){var s,i,r;return t?(e>>>=0,(r=0<=e&&e<256)&&(i=l[e])?i:(s=n(e,(0|e)<0?-1:0,!0),r&&(l[e]=s),s)):(e|=0,(r=-128<=e&&e<128)&&(i=a[e])?i:(s=n(e,e<0?-1:0,!1),r&&(a[e]=s),s))}function i(e,t){if(isNaN(e)||!isFinite(e))return t?m:f;if(t){if(e<0)return m;if(e>=d)return b}else{if(e<=-u)return w;if(e+1>=u)return v}return e<0?i(-e,t).neg():n(e%c|0,e/c|0,t)}function n(t,s,i){return new e(t,s,i)}function r(e,t,s){if(0===e.length)throw Error("empty string");if("NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return f;if("number"==typeof t?(s=t,t=!1):t=!!t,(s=s||10)<2||360)throw Error("interior hyphen");if(0===n)return r(e.substring(1),t,s).neg();for(var o=i(h(s,8)),a=f,l=0;l>>0:this.low},y.toNumber=function(){return this.unsigned?(this.high>>>0)*c+(this.low>>>0):this.high*c+(this.low>>>0)},y.toString=function(e){if((e=e||10)<2||36>>0).toString(e);if((o=l).isZero())return c+a;for(;c.length<6;)c="0"+c;a=""+c+a}},y.getHighBits=function(){return this.high},y.getHighBitsUnsigned=function(){return this.high>>>0},y.getLowBits=function(){return this.low},y.getLowBitsUnsigned=function(){return this.low>>>0},y.getNumBitsAbs=function(){if(this.isNegative())return this.eq(w)?64:this.neg().getNumBitsAbs();for(var e=0!=this.high?this.high:this.low,t=31;t>0&&0==(e&1<=0},y.isOdd=function(){return 1==(1&this.low)},y.isEven=function(){return 0==(1&this.low)},y.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)},y.eq=y.equals,y.notEquals=function(e){return!this.eq(e)},y.neq=y.notEquals,y.lessThan=function(e){return this.comp(e)<0},y.lt=y.lessThan,y.lessThanOrEqual=function(e){return this.comp(e)<=0},y.lte=y.lessThanOrEqual,y.greaterThan=function(e){return this.comp(e)>0},y.gt=y.greaterThan,y.greaterThanOrEqual=function(e){return this.comp(e)>=0},y.gte=y.greaterThanOrEqual,y.compare=function(e){if(t(e)||(e=o(e)),this.eq(e))return 0;var s=this.isNegative(),i=e.isNegative();return s&&!i?-1:!s&&i?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},y.comp=y.compare,y.negate=function(){return!this.unsigned&&this.eq(w)?w:this.not().add(g)},y.neg=y.negate,y.add=function(e){t(e)||(e=o(e));var s=this.high>>>16,i=65535&this.high,r=this.low>>>16,a=65535&this.low,l=e.high>>>16,h=65535&e.high,c=e.low>>>16,d=0,u=0,p=0,f=0;return f+=a+(65535&e.low),p+=f>>>16,f&=65535,p+=r+c,u+=p>>>16,p&=65535,u+=i+h,d+=u>>>16,u&=65535,d+=s+l,d&=65535,n(p<<16|f,d<<16|u,this.unsigned)},y.subtract=function(e){return t(e)||(e=o(e)),this.add(e.neg())},y.sub=y.subtract,y.multiply=function(e){if(this.isZero())return f;if(t(e)||(e=o(e)),e.isZero())return f;if(this.eq(w))return e.isOdd()?w:f;if(e.eq(w))return this.isOdd()?w: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(p)&&e.lt(p))return i(this.toNumber()*e.toNumber(),this.unsigned);var s=this.high>>>16,r=65535&this.high,a=this.low>>>16,l=65535&this.low,h=e.high>>>16,c=65535&e.high,d=e.low>>>16,u=65535&e.low,m=0,g=0,_=0,E=0;return E+=l*u,_+=E>>>16,E&=65535,_+=a*u,g+=_>>>16,_&=65535,_+=l*d,g+=_>>>16,_&=65535,g+=r*u,m+=g>>>16,g&=65535,g+=a*d,m+=g>>>16,g&=65535,g+=l*c,m+=g>>>16,g&=65535,m+=s*u+r*d+a*c+l*h,m&=65535,n(_<<16|E,m<<16|g,this.unsigned)},y.mul=y.multiply,y.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 s,n,r;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return m;if(e.gt(this.shru(1)))return _;r=m}else{if(this.eq(w))return e.eq(g)||e.eq(E)?w:e.eq(w)?g:(s=this.shr(1).div(e).shl(1)).eq(f)?e.isNegative()?g:E:(n=this.sub(e.mul(s)),r=s.add(n.div(e)));if(e.eq(w))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(n=this;n.gte(e);){s=Math.max(1,Math.floor(n.toNumber()/e.toNumber()));for(var a=Math.ceil(Math.log(s)/Math.LN2),l=a<=48?1:h(2,a-48),c=i(s),d=c.mul(e);d.isNegative()||d.gt(n);)d=(c=i(s-=l,this.unsigned)).mul(e);c.isZero()&&(c=g),r=r.add(c),n=n.sub(d)}return r},y.div=y.divide,y.modulo=function(e){return t(e)||(e=o(e)),this.sub(this.div(e).mul(e))},y.mod=y.modulo,y.not=function(){return n(~this.low,~this.high,this.unsigned)},y.and=function(e){return t(e)||(e=o(e)),n(this.low&e.low,this.high&e.high,this.unsigned)},y.or=function(e){return t(e)||(e=o(e)),n(this.low|e.low,this.high|e.high,this.unsigned)},y.xor=function(e){return t(e)||(e=o(e)),n(this.low^e.low,this.high^e.high,this.unsigned)},y.shiftLeft=function(e){return t(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?n(this.low<>>32-e,this.unsigned):n(0,this.low<>>e|this.high<<32-e,this.high>>e,this.unsigned):n(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},y.shr=y.shiftRight,y.shiftRightUnsigned=function(e){if(t(e)&&(e=e.toInt()),0===(e&=63))return this;var s=this.high;return e<32?n(this.low>>>e|s<<32-e,s>>>e,this.unsigned):32===e?n(s,0,this.unsigned):n(s>>>e-32,0,this.unsigned)},y.shru=y.shiftRightUnsigned,y.toSigned=function(){return this.unsigned?n(this.low,this.high,!1):this},y.toUnsigned=function(){return this.unsigned?this:n(this.low,this.high,!0)},y.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},y.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]},y.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,s){e.exports=s(76)},function(e,t,s){"use strict";t.decode=t.parse=s(77),t.encode=t.stringify=s(78)},function(e,t,s){const i=s(20),n=s(83),r=s(5),{DefaultOptions:o}=s(0);class BaseClient extends i{constructor(e={}){super(),this.options=r.mergeDefault(o,e),this.rest=new n(this,e._tokenType),this._timeouts=new Set,this._intervals=new Set}get api(){return this.rest.api}destroy(){for(const e of this._timeouts)clearTimeout(e);for(const e of this._intervals)clearInterval(e);this._timeouts.clear(),this._intervals.clear()}setTimeout(e,t,...s){const i=setTimeout(()=>{e(...s),this._timeouts.delete(i)},t);return this._timeouts.add(i),i}clearTimeout(e){clearTimeout(e),this._timeouts.delete(e)}setInterval(e,t,...s){const i=setInterval(e,t,...s);return this._intervals.add(i),i}clearInterval(e){clearInterval(e),this._intervals.delete(e)}}e.exports=BaseClient},function(e,t,s){const i=s(3),n=s(20);class Collector extends n{constructor(e,t,s={}){super(),Object.defineProperty(this,"client",{value:e}),this.filter=t,this.options=s,this.collected=new i,this.ended=!1,this._timeout=null,this.handleCollect=this.handleCollect.bind(this),this.handleDispose=this.handleDispose.bind(this),s.time&&(this._timeout=this.client.setTimeout(()=>this.stop("time"),s.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 s=this.collected.get(t);this.collected.delete(t),this.emit("dispose",s,...e),this.checkEnd()}get next(){return new Promise((e,t)=>{if(this.ended)return void t(this.collected);const s=()=>{this.removeListener("collect",i),this.removeListener("end",n)},i=t=>{s(),e(t)},n=()=>{s(),t(this.collected)};this.on("collect",i),this.on("end",n)})}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,s){const i=s(47),n=s(23),r=s(24),o=s(48),a=s(33),l=s(5),h=s(3),c=s(99),{MessageTypes:d}=s(0),u=s(10),p=s(6),{Error:f,TypeError:m}=s(4),{createMessage:g}=s(21);class Message extends p{constructor(e,t,s){super(e),this.channel=s,t&&this._patch(t)}_patch(e){this.id=e.id,this.type=d[e.type],this.content=e.content,this.author=this.client.users.create(e.author,!e.webhook_id),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 h;for(const t of e.attachments)this.attachments.set(t.id,new n(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 c(this),e.reactions&&e.reactions.length>0)for(const t of e.reactions)this.reactions.create(t);this.mentions=new i(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 h;for(const t of e.attachments)this.attachments.set(t.id,new n(t.url,t.filename,t))}else this.attachments=new h(this.attachments);this.mentions=new i(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 s=this.channel.guild.members.get(t);if(s)return s.nickname?`@${s.nickname}`:`@${s.user.username}`;{const s=this.client.users.get(t);return s?`@${s.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((s,i)=>{this.createReactionCollector(e,t).once("end",(e,n)=>{t.errors&&t.errors.includes(n)?i(e):s(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(u.FLAGS.MANAGE_MESSAGES)}get pinnable(){return!this.guild||this.channel.permissionsFor(this.client.user).has(u.FLAGS.MANAGE_MESSAGES)}async edit(e,t){t||"object"!=typeof e||e instanceof Array?t||(t={}):(t=e,e=null),t.content||(t.content=e);const{data:s,files:i}=await g(this,t);return this.client.api.channels[this.channel.id].messages[this.id].patch({data:s,files: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:l.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(s=>{this.client.setTimeout(()=>{s(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 s=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 s&&t&&(s=this.mentions.everyone===e.mentions.everyone&&this.createdTimestamp===new Date(t.timestamp).getTime()&&this.editedTimestamp===new Date(t.edited_timestamp).getTime()),s}toString(){return this.content}}e.exports=Message},function(e,t,s){const i=s(8),{ClientApplicationAssetTypes:n,Endpoints:r}=s(0),o=s(9),a=s(6);class ClientApplication extends a{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 i.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?r.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(n)[e.type-1]})))}createAsset(e,t,s){return o.resolveBase64(t).then(t=>this.client.api.applications(this.id).assets.post({data:{name:e,data:t,type:n[s.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,s){const i=s(3),n=s(8),r=s(6),{TypeError:o}=s(4);class Emoji extends r{constructor(e,t,s){super(e),this.guild=s,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 n.deconstruct(this.id).timestamp}get createdAt(){return new Date(this.createdTimestamp)}get roles(){const e=new i;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 i(this.roles);for(let s of e instanceof i?e.values():e){if(!(s=this.guild.roles.resolve(s)))return Promise.reject(new o("INVALID_TYPE","roles","Array or Collection of Roles or Snowflakes",!0));t.set(s.id,s)}return this.edit({roles:t})}removeRestrictedRole(e){return this.removeRestrictedRoles([e])}removeRestrictedRoles(e){const t=new i(this.roles);for(let s of e instanceof i?e.values():e){if(!(s=this.guild.roles.resolve(s)))return Promise.reject(new o("INVALID_TYPE","roles","Array or Collection of Roles or Snowflakes",!0));t.has(s.id)&&t.delete(s.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,s){this.reaction=e,this.name=t,this.id=s}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){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,s){const i=s(7),n=s(34),r=s(35);class EmojiStore extends i{constructor(e,t){super(e.client,t,n),this.guild=e}create(e,t){return 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,s){const i=s(7),{Presence:n}=s(14);class PresenceStore extends i{constructor(e,t){super(e,t,n)}create(e,t){const s=this.get(e.user.id);return s?s.patch(e):super.create(e,t,{id:e.user.id})}resolve(e){const t=super.resolve(e);if(t)return t;const s=this.client.users.resolveID(e);return super.resolve(s)||null}resolveID(e){const t=super.resolveID(e);if(t)return t;const s=this.client.users.resolveID(e);return this.has(s)?s:null}}e.exports=PresenceStore},function(e,t,s){const{UserGuildSettingsMap:i}=s(0),n=s(3),r=s(63);class ClientUserGuildSettings{constructor(e,t){Object.defineProperty(this,"client",{value:e}),this.guildID=t.guild_id,this.channelOverrides=new n,this.patch(t)}patch(e){for(const[t,s]of Object.entries(i))if(e.hasOwnProperty(t))if("channel_overrides"===t)for(const s of e[t]){const e=this.channelOverrides.get(s.channel_id);e?e.patch(s):this.channelOverrides.set(s.channel_id,new r(s))}else"function"==typeof s?this[s.name]=s(e[t]):this[s]=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,s){"use strict";e.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},function(e,t){e.exports={version:"12.0.0-dev",homepage:"https://github.com/hydrabolt/discord.js#readme"}},function(e,t){function s(e){return class DiscordjsError extends e{constructor(e,...t){super(i(e,t)),this[n]=e,Error.captureStackTrace&&Error.captureStackTrace(this,DiscordjsError)}get name(){return`${super.name} [${this[n]}]`}get code(){return this[n]}}}function i(e,t){if("string"!=typeof e)throw new Error("Error message key must be a string");const s=r.get(e);if(!s)throw new Error(`An invalid error message key was used: ${e}.`);return"function"==typeof s?s(...t):void 0===t||0===t.length?s:(t.unshift(s),String(...t))}const n=Symbol("code"),r=new Map;e.exports={register:function(e,t){r.set(e,"function"==typeof t?t:String(t))},Error:s(Error),TypeError:s(TypeError),RangeError:s(RangeError)}},function(e,t){class DiscordAPIError extends Error{constructor(e,t){super();const s=this.constructor.flattenErrors(t.errors||t).join("\n");this.name="DiscordAPIError",this.message=t.message&&s?`${t.message}\n${s}`:t.message||s,this.path=e,this.code=t.code}static flattenErrors(e,t=""){let s=[];for(const[i,n]of Object.entries(e)){if("message"===i)continue;const e=t?isNaN(i)?`${t}.${i}`:`${t}[${i}]`:i;n._errors?s.push(`${e}: ${n._errors.map(e=>e.message).join(" ")}`):n.code||n.message?s.push(`${n.code?`${n.code}: `:""}${n.message}`.trim()):"string"==typeof n?s.push(n):s=s.concat(this.flattenErrors(n,e))}return s}}e.exports=DiscordAPIError},function(e,t,s){const i=s(17),n=s(3),r=s(62),o=s(39),{Events:a}=s(0),l=s(5),h=s(9),c=s(26);class ClientUser extends i{_patch(e){if(super._patch(e),this.verified=e.verified,this.email=e.email,this._typing=new Map,this.friends=new n,this.blocked=new n,this.notes=new n,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 n,e.user_guild_settings)for(const t of e.user_guild_settings)this.guildSettings.set(t.guild_id,new o(this.client,t));e.token&&(this.client.token=e.token)}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 h.resolveImage(e)})}setPresence(e){return this.client.presences.setClientPresence(e)}setStatus(e){return this.setPresence({status:e})}setActivity(e,{url:t,type:s}={}){return e?this.setPresence({activity:{name:e,type:s,url:t}}):this.setPresence({activity:null})}setAFK(e){return this.setPresence({afk:e})}fetchMentions(e={}){return e.guild instanceof c&&(e.guild=e.guild.id),l.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:s=null}={}){return!s||"string"==typeof s&&s.startsWith("data:")?new Promise((i,n)=>this.client.api.guilds.post({data:{name:e,region:t,icon:s}}).then(e=>{if(this.client.guilds.has(e.id))return i(this.client.guilds.get(e.id));const t=n=>{n.id===e.id&&(this.client.removeListener(a.GUILD_CREATE,t),this.client.clearTimeout(s),i(n))};this.client.on(a.GUILD_CREATE,t);const s=this.client.setTimeout(()=>{this.client.removeListener(a.GUILD_CREATE,t),i(this.client.guilds.create(e))},1e4)},n)):h.resolveImage(s).then(s=>this.createGuild(e,{region:t,icon:s||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,s){const i=s(31),{Events:n}=s(0);class MessageCollector extends i{constructor(e,t,s={}){super(e.client,t,s),this.channel=e,this.received=0;const i=(e=>{for(const t of e.values())this.handleDispose(t)}).bind(this);this.client.on(n.MESSAGE_CREATE,this.handleCollect),this.client.on(n.MESSAGE_DELETE,this.handleDispose),this.client.on(n.MESSAGE_BULK_DELETE,i),this.once("end",()=>{this.client.removeListener(n.MESSAGE_CREATE,this.handleCollect),this.client.removeListener(n.MESSAGE_DELETE,this.handleDispose),this.client.removeListener(n.MESSAGE_BULK_DELETE,i)})}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,s){const i=s(12),n=s(18),r=s(19);class DMChannel extends i{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(){}}n.applyToClass(DMChannel,!0,["bulkDelete"]),e.exports=DMChannel},function(e,t,s){const i=s(3),n=s(13);class MessageMentions{constructor(e,t,s,n){if(this.everyone=Boolean(n),t)if(t instanceof i)this.users=new i(t);else{this.users=new i;for(const s of t){let t=e.client.users.create(s);this.users.set(t.id,t)}}else this.users=new i;if(s)if(s instanceof i)this.roles=new i(s);else{this.roles=new i;for(const t of s){const s=e.channel.guild.roles.get(t);s&&this.roles.set(s.id,s)}}else this.roles=new i;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 i,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 i;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 n)for(const t of this.roles.values())if(e.roles.has(t.id))return!0;const s=e.id||e;return this.users.has(s)||this.channels.has(s)||this.roles.has(s)}}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,s){const i=s(31),n=s(3),{Events:r}=s(0);class ReactionCollector extends i{constructor(e,t,s={}){super(e.client,t,s),this.message=e,this.users=new n,this.total=0,this.empty=this.empty.bind(this),this.client.on(r.MESSAGE_REACTION_ADD,this.handleCollect),this.client.on(r.MESSAGE_REACTION_REMOVE,this.handleDispose),this.client.on(r.MESSAGE_REACTION_REMOVE_ALL,this.empty),this.once("end",()=>{this.client.removeListener(r.MESSAGE_REACTION_ADD,this.handleCollect),this.client.removeListener(r.MESSAGE_REACTION_REMOVE,this.handleDispose),this.client.removeListener(r.MESSAGE_REACTION_REMOVE_ALL,this.empty)}),this.on("collect",(e,t,s)=>{this.total++,this.users.set(s.id,s)}),this.on("dispose",(e,t,s)=>{this.total--,this.collected.some(e=>e.users.has(s.id))||this.users.delete(s.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){},function(e,t,s){const i=s(3),n=s(34),r=s(35),{Error:o}=s(4);class MessageReaction{constructor(e,t,s){this.message=s,this.me=t.me,this.count=t.count||0,this.users=new i,this._emoji=new r(this,t.emoji.name,t.emoji.id)}get emoji(){if(this._emoji instanceof n)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 s=this.message,i=await s.client.api.channels[s.channel.id].messages[s.id].reactions[this.emoji.identifier].get({query:{limit:e,after:t}});for(const e of i){const t=s.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,s){const i=s(12),n=s(18),r=s(3),o=s(9),a=s(19);class GroupDMChannel extends i{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)})}setName(e){return this.edit({name:e})}addUser({user:e,accessToken:t,nick:s}){const i=this.client.users.resolveID(e),n=this.client.user.bot?{nick:s,access_token:t}:{recipient:i};return this.client.api.channels[this.id].recipients[i].put({data:n}).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(){}}n.applyToClass(GroupDMChannel,!0,["bulkDelete"]),e.exports=GroupDMChannel},function(e,t,s){const i=s(16),n=s(15),r=s(18),o=s(3),a=s(9),l=s(19);class TextChannel extends i{constructor(e,t){super(e,t),this.messages=new l(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)}setNSFW(e,t){return this.edit({nsfw:e},t)}fetchWebhooks(){return this.client.api.channels[this.id].webhooks.get().then(e=>{const t=new o;for(const s of e)t.set(s.id,new n(this.client,s));return t})}async createWebhook(e,{avatar:t,reason:s}={}){return"string"!=typeof t||t.startsWith("data:")||(t=await a.resolveImage(t)),this.client.api.channels[this.id].webhooks.post({data:{name:e,avatar:t},reason:s}).then(e=>new n(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,s){const i=s(10);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=new i(e.deny).freeze(),this.allowed=new i(e.allow).freeze()}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,s){const i=s(16),n=s(3),{browser:r}=s(0),{Error:o}=s(4);class VoiceChannel extends i{constructor(e,t){super(e,t),Object.defineProperty(this,"members",{value:new n})}_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!r&&(!!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 r?Promise.reject(new o("VOICE_NO_BROWSER")):this.client.voice.joinChannel(this)}leave(){if(r)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,s){const i=s(16);class CategoryChannel extends i{get children(){return this.guild.channels.filter(e=>e.parentID===this.id)}}e.exports=CategoryChannel},function(e,t,s){const i=s(3),n=s(8),r=s(15),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 s of t.users)e.client.users.create(s);if(this.webhooks=new i,t.webhooks)for(const s of t.webhooks)this.webhooks.set(s.id,new r(e.client,s));this.entries=new i;for(const s of t.audit_log_entries){const t=new GuildAuditLogsEntry(this,e,s);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,s){const i=GuildAuditLogs.targetType(s.action_type);if(this.targetType=i,this.actionType=GuildAuditLogs.actionType(s.action_type),this.action=Object.keys(a).find(e=>a[e]===s.action_type),this.reason=s.reason||null,this.executor=t.client.users.get(s.user_id),this.changes=s.changes?s.changes.map(e=>({key:e.key,old:e.old_value,new:e.new_value})):null,this.id=s.id,this.extra=null,s.options)if(s.action_type===a.MEMBER_PRUNE)this.extra={removed:s.options.members_removed,days:s.options.delete_member_days};else if(s.action_type===a.MESSAGE_DELETE)this.extra={count:s.options.count,channel:t.channels.get(s.options.channel_id)};else switch(s.options.type){case"member":this.extra=t.members.get(s.options.id),this.extra||(this.extra={id:s.options.id});break;case"role":this.extra=t.roles.get(s.options.id),this.extra||(this.extra={id:s.options.id,name:s.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=s.target_id;else if([o.USER,o.GUILD].includes(i))this.target=t.client[`${i.toLowerCase()}s`].get(s.target_id);else if(i===o.WEBHOOK)this.target=e.webhooks.get(s.target_id)||new r(t.client,this.changes.reduce((e,t)=>(e[t.key]=t.new||t.old,e),{id:s.target_id,guild_id:t.id}));else if(i===o.INVITE)if(t.me.permissions.has("MANAGE_GUILD")){const e=this.changes.find(e=>"code"===e.key);this.target=t.fetchInvites().then(t=>(this.target=t.find(t=>t.code===(e.new||e.old)),this.target))}else this.target=this.changes.reduce((e,t)=>(e[t.key]=t.new||t.old,e),{});else this.target=i===o.MESSAGE?t.client.users.get(s.target_id):t[`${i.toLowerCase()}s`].get(s.target_id)}get createdTimestamp(){return n.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,s){const i=s(7),n=s(13),{Events:r,OPCodes:o}=s(0),a=s(3),{Error:l}=s(4);class GuildMemberStore extends i{constructor(e,t){super(e.client,t,n),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 s=this.client.users.resolveID(e);return s?super.resolve(s):null}resolveID(e){const t=super.resolveID(e);if(t)return t;const s=this.client.users.resolveID(e);return this.has(s)?s:null}fetch(e){if(!e)return this._fetchMany();const t=this.client.users.resolveID(e);return t?this._fetchSingle({user:t,cache:!0}):e.user&&(e.user=this.client.users.resolveID(e.user),e.user)?this._fetchSingle(e):this._fetchMany(e)}_fetchSingle({user:e,cache:t}){const s=this.get(e);return s?Promise.resolve(s):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((s,i)=>{if(this.guild.memberCount===this.size)return void s(e||t?new a:this);this.guild.client.ws.send({op:o.REQUEST_GUILD_MEMBERS,d:{guild_id:this.guild.id,query:e,limit:t}});const n=new a,h=(i,o)=>{if(o.id===this.guild.id){for(const s of i.values())(e||t)&&n.set(s.id,s);(this.guild.memberCount<=this.size||(e||t)&&i.size<1e3||t&&n.size>=t)&&(this.guild.client.removeListener(r.GUILD_MEMBERS_CHUNK,h),s(e||t?n:this))}};this.guild.client.on(r.GUILD_MEMBERS_CHUNK,h),this.guild.client.setTimeout(()=>{this.guild.client.removeListener(r.GUILD_MEMBERS_CHUNK,h),i(new l("GUILD_MEMBERS_TIMEOUT"))},12e4)})}}e.exports=GuildMemberStore},function(e,t,s){const i=s(7),n=s(22);class RoleStore extends i{constructor(e,t){super(e.client,t,n),this.guild=e}create(e,t){return super.create(e,t,{extras:[this.guild]})}}e.exports=RoleStore},function(e,t,s){const i=s(7),n=s(12),r=s(16);class GuildChannelStore extends i{constructor(e,t){super(e.client,t,r),this.guild=e}create(e){const t=this.get(e.id);return t||n.create(this.client,e,this.guild)}}e.exports=GuildChannelStore},function(e,t,s){const i=s(24),n=s(9),r=s(24),o=s(23),{browser:a}=s(0),l=s(5);e.exports=async function(e,t){const h=s(17),c=s(13),d=e instanceof s(15);if(void 0!==t.nonce&&(t.nonce=parseInt(t.nonce),isNaN(t.nonce)||t.nonce<0))throw new RangeError("MESSAGE_NONCE_TYPE");if(t instanceof r&&(t=d?{embeds:[t]}:{embed:t}),t instanceof o&&(t={files:[t.file]}),t.reply&&!(e instanceof h||e instanceof c)&&"dm"!==e.type){const s=e.client.users.resolveID(t.reply),i=`<@${t.reply instanceof c&&t.reply.nickname?"!":""}${s}>`;t.split&&(t.split.prepend=`${i}, ${t.split.prepend||""}`),t.content=`${i}${void 0!==t.content?`, ${t.content}`:""}`}t.content&&(t.content=l.resolveString(t.content),t.split&&"object"!=typeof t.split&&(t.split={}),void 0===t.code||"boolean"==typeof t.code&&!0!==t.code||(t.content=l.escapeMarkdown(t.content,!0),t.content=`\`\`\`${"boolean"!=typeof t.code?t.code||"":""}\n${t.content}\n\`\`\``,t.split&&(t.split.prepend=`\`\`\`${"boolean"!=typeof t.code?t.code||"":""}\n`,t.split.append="\n```")),(t.disableEveryone||void 0===t.disableEveryone&&e.client.options.disableEveryone)&&(t.content=t.content.replace(/@(everyone|here)/g,"@​$1")),t.split&&(t.content=l.splitMessage(t.content,t.split))),t.embed&&t.embed.files&&(t.files?t.files=t.files.concat(t.embed.files):t.files=t.embed.files),t.embed&&d?t.embeds=[new i(t.embed)._apiTransform()]:t.embed?t.embed=new i(t.embed)._apiTransform():t.embeds&&(t.embeds=t.embeds.map(e=>new i(e)._apiTransform()));let u;if(t.files){for(let e=0;en.resolveFile(e.attachment).then(t=>(e.file=t,e)))),delete t.files}return d&&(t.username||(t.username=this.name),t.avatarURL&&(t.avatar_url=t.avatarURL,t.avatarURL=null)),{data:{content:t.content,tts:t.tts,nonce:t.nonce,embed:t.embed,embeds:t.embeds,username:t.username,avatar_url:t.avatarURL},files:u}}},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,s){const{UserSettingsMap:i}=s(0),n=s(5),{Error:r}=s(4);class ClientUserSettings{constructor(e,t){this.user=e,this.patch(t)}patch(e){for(const[t,s]of Object.entries(i))e.hasOwnProperty(t)&&("function"==typeof s?this[s.name]=s(e[t]):this[s]=e[t])}update(e,t){return this.user.client.api.users["@me"].settings.patch({data:{[e]:t}})}setGuildPosition(e,t,s){const i=Object.assign([],this.guildPositions);return n.moveElementInArray(i,e.id,t,s),this.update("guild_positions",i).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),s=t.indexOf(e.id);return s<0?Promise.reject(new r("GUILD_RESTRICTED")):(t.splice(s,1),this.update("restricted_guilds",t).then(()=>e))}}e.exports=ClientUserSettings},function(e,t,s){const{UserChannelOverrideMap:i}=s(0);class ClientUserChannelOverride{constructor(e){this.patch(e)}patch(e){for(const[t,s]of Object.entries(i))e.hasOwnProperty(t)&&("function"==typeof s?this[s.name]=s(e[t]):this[s]=e[t])}}e.exports=ClientUserChannelOverride},function(e,t,s){const{browser:i}=s(0),n=s(29);try{var r=s(138);r.pack||(r=null)}catch(e){}if(i)t.WebSocket=window.WebSocket;else try{t.WebSocket=s(139)}catch(e){t.WebSocket=s(140)}t.encoding=r?"etf":"json",t.pack=r?r.pack:JSON.stringify,t.unpack=(e=>r&&"{"!==e[0]?(e instanceof Buffer||(e=Buffer.from(new Uint8Array(e))),r.unpack(e)):JSON.parse(e)),t.create=((e,s={},...r)=>{const[o,a]=e.split("?");s.encoding=t.encoding,a&&(s=Object.assign(n.parse(a),s));const l=new t.WebSocket(`${o}?${n.stringify(s)}`,...r);return i&&(l.binaryType="arraybuffer"),l});for(const e of["CONNECTING","OPEN","CLOSING","CLOSED"])t[e]=t.WebSocket[e]},function(e,t,s){"use strict";var i={};(0,s(11).assign)(i,s(142),s(145),s(70)),e.exports=i},function(e,t,s){"use strict";e.exports=function(e,t,s,i){for(var n=65535&e|0,r=e>>>16&65535|0,o=0;0!==s;){s-=o=s>2e3?2e3:s;do{r=r+(n=n+t[i++]|0)|0}while(--o);n%=65521,r%=65521}return n|r<<16|0}},function(e,t,s){"use strict";var i=function(){for(var e,t=[],s=0;s<256;s++){e=s;for(var i=0;i<8;i++)e=1&e?3988292384^e>>>1:e>>>1;t[s]=e}return t}();e.exports=function(e,t,s,n){var r=i,o=n+s;e^=-1;for(var a=n;a>>8^r[255&(e^t[a])];return-1^e}},function(e,t,s){"use strict";function i(e,t){if(t<65537&&(e.subarray&&o||!e.subarray&&r))return String.fromCharCode.apply(null,n.shrinkBuf(e,t));for(var s="",i=0;i=252?6:l>=248?5:l>=240?4:l>=224?3:l>=192?2:1;a[254]=a[254]=1,t.string2buf=function(e){var t,s,i,r,o,a=e.length,l=0;for(r=0;r>>6,t[o++]=128|63&s):s<65536?(t[o++]=224|s>>>12,t[o++]=128|s>>>6&63,t[o++]=128|63&s):(t[o++]=240|s>>>18,t[o++]=128|s>>>12&63,t[o++]=128|s>>>6&63,t[o++]=128|63&s);return t},t.buf2binstring=function(e){return i(e,e.length)},t.binstring2buf=function(e){for(var t=new n.Buf8(e.length),s=0,i=t.length;s4)h[n++]=65533,s+=o-1;else{for(r&=2===o?31:3===o?15:7;o>1&&s1?h[n++]=65533:r<65536?h[n++]=r:(r-=65536,h[n++]=55296|r>>10&1023,h[n++]=56320|1023&r)}return i(h,n)},t.utf8border=function(e,t){var s;for((t=t||e.length)>e.length&&(t=e.length),s=t-1;s>=0&&128==(192&e[s]);)s--;return s<0?t:0===s?t:s+a[e[s]]>t?s:t}},function(e,t,s){"use strict";e.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},function(e,t,s){"use strict";e.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},function(e,t,s){const i=s(7),n=s(17),r=s(13),o=s(32);class UserStore extends i{constructor(e,t){super(e,t,n)}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 s=this.get(e);return s?Promise.resolve(s):this.client.api.users(e).get().then(e=>this.create(e,t))}}e.exports=UserStore},function(e,t,s){const i=s(7),n=s(12),{Events:r}=s(0),o=Symbol("LRU"),a=["group","dm"];class ChannelStore extends i{constructor(e,t={},s){if(s||"function"==typeof t[Symbol.iterator]||(s=t,t=void 0),super(e,t,n),s.lru){const e=this[o]=[];e.add=(t=>{for(e.remove(t),e.unshift(t);e.length>s.lru;)this.remove(e[e.length-1])}),e.remove=(t=>{const s=e.indexOf(t);s>-1&&e.splice(s,1)})}}get(e,t=!1){const s=super.get(e);return s&&a.includes(s.type)?(!t&&this[o]&&this[o].add(e),s):s}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,s=!0){const i=this.get(e.id);if(i)return i;const o=n.create(this.client,e,t);return o?(s&&this.set(o.id,o),o):(this.client.emit(r.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,s){const i=s(7),n=s(26);class GuildStore extends i{constructor(e,t){super(e,t,n)}}e.exports=GuildStore},function(e,t,s){const i=s(38),n=s(3),{ActivityTypes:r,OPCodes:o}=s(0),{Presence:a}=s(14),{TypeError:l}=s(4);class ClientPresenceStore extends i{constructor(...e){super(...e),this.clientPresence=new a(this.client,{status:"online",afk:!1,since:null,activity:null})}async setClientPresence({status:e,since:t,afk:s,activity:i}){const a=i&&(i.application?i.application.id||i.application:null);let h=new n;if(i){if("string"!=typeof i.name)throw new l("INVALID_TYPE","name","string");if(i.type||(i.type=0),i.assets&&a)try{const e=await this.client.api.oauth2.applications(a).assets.get();for(const t of e)h.set(t.name,t.id)}catch(e){}}const c={afk:null!=s&&s,since:null!=t?t:null,status:e||this.clientPresence.status,game:i?{type:"number"==typeof i.type?i.type:r.indexOf(i.type),name:i.name,url:i.url,details:i.details||void 0,state:i.state||void 0,assets:i.assets?{large_text:i.assets.largeText||void 0,small_text:i.assets.smallText||void 0,large_image:h.get(i.assets.largeImage)||i.assets.largeImage,small_image:h.get(i.assets.smallImage)||i.assets.smallImage}:void 0,timestamps:i.timestamps||void 0,party:i.party||void 0,application_id:a||void 0,secrets:i.secrets||void 0,instance:i.instance||void 0}:null};return this.clientPresence.patch(c),this.client.ws.send({op:o.STATUS_UPDATE,d:c}),this.clientPresence}}e.exports=ClientPresenceStore},function(e,t,s){const i=s(5);e.exports={BaseClient:s(30),Client:s(91),Shard:s(179),ShardClientUtil:s(180),ShardingManager:s(181),WebhookClient:s(182),Collection:s(3),Constants:s(0),DataResolver:s(9),DataStore:s(7),DiscordAPIError:s(43),Permissions:s(10),Snowflake:s(8),SnowflakeUtil:s(8),Util:i,util:i,version:s(41).version,ChannelStore:s(72),ClientPresenceStore:s(74),EmojiStore:s(37),GuildChannelStore:s(59),GuildMemberStore:s(57),GuildStore:s(73),MessageStore:s(19),PresenceStore:s(38),RoleStore:s(58),UserStore:s(71),escapeMarkdown:i.escapeMarkdown,fetchRecommendedShards:i.fetchRecommendedShards,splitMessage:i.splitMessage,Base:s(6),Activity:s(14).Activity,CategoryChannel:s(55),Channel:s(12),ClientApplication:s(33),ClientUser:s(44),ClientUserChannelOverride:s(63),ClientUserGuildSettings:s(39),ClientUserSettings:s(62),Collector:s(31),DMChannel:s(46),Emoji:s(34),GroupDMChannel:s(51),Guild:s(26),GuildAuditLogs:s(56),GuildChannel:s(16),GuildMember:s(13),Invite:s(25),Message:s(32),MessageAttachment:s(23),MessageCollector:s(45),MessageEmbed:s(24),MessageMentions:s(47),MessageReaction:s(50),PermissionOverwrites:s(53),Presence:s(14).Presence,ReactionCollector:s(48),ReactionEmoji:s(35),RichPresenceAssets:s(14).RichPresenceAssets,Role:s(22),TextChannel:s(52),User:s(17),UserConnection:s(61),VoiceChannel:s(54),VoiceRegion:s(36),Webhook:s(15),WebSocket:s(64)}},function(e,t,s){const i="undefined"!=typeof window,n=s(29),r=s(79),o=s(i?80:81);class Snekfetch extends o.Extension{constructor(e,t,s={version:1,qs:n,followRedirects:!0}){super(),this.options=s,this.request=o.buildRequest.call(this,e,t,s),s.query&&this.query(s.query),s.data&&this.send(s.data)}query(e,t){if(this._checkModify(),this.request.query||(this.request.query={}),null!==e&&"object"==typeof e)for(const[t,s]of Object.entries(e))this.query(t,s);else this.request.query[e]=t;return this}set(e,t){if(this._checkModify(),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){this._checkModify();const t=this._getFormData();if("object"==typeof e[0])for(const[t,s]of Object.entries(e[0]))this.attach(t,s);else t.append(...e);return this}send(e){if(this._checkModify(),e instanceof o.FormData||o.shouldSendRaw(e))this.data=e;else if(null!==e&&"object"==typeof e){const t=this.request.getHeader("content-type");let s;t?t.includes("json")?s=JSON.stringify:t.includes("urlencoded")&&(s=this.options.qs.stringify):(this.set("Content-Type","application/json"),s=JSON.stringify),this.data=s(e)}else this.data=e;return this}then(e,t){return this._response?this._response.then(e,t):this._response=o.finalizeRequest.call(this).then(({response:e,raw:t,redirect:s,headers:i})=>{if(s){let t=this.request.method;[301,302].includes(e.statusCode)?("HEAD"!==t&&(t="GET"),this.data=null):303===e.statusCode&&(t="GET");const i=this.request.getHeaders();return delete i.host,new Snekfetch(t,s,{data:this.data,headers:i})}const n=e.statusCode||e.status,r=this,a={request:this.request,get body(){delete a.body;const e=this.headers["content-type"];if(e&&e.includes("application/json"))try{a.body=JSON.parse(a.text)}catch(e){a.body=a.text}else e&&e.includes("application/x-www-form-urlencoded")?a.body=r.options.qs.parse(a.text):a.body=t;return a.body},text:t.toString(),ok:n>=200&&n<400,headers:i||e.headers,status:n,statusText:e.statusText||o.STATUS_CODES[e.statusCode]};if(a.ok)return a;{const e=new Error(`${a.status} ${a.statusText}`.trim());return Object.assign(e,a),Promise.reject(e)}}).then(e,t)}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):Promise.reject(t))}_getFormData(){return this.data instanceof o.FormData||(this.data=new o.FormData),this.data}_finalizeRequest(){if(this.request&&(this.request.getHeader("user-agent")||this.set("User-Agent",`snekfetch/${Snekfetch.version} (${r.homepage})`),"HEAD"!==this.request.method&&this.set("Accept-Encoding","gzip, deflate"),this.data&&this.data.getBoundary&&this.set("Content-Type",`multipart/form-data; boundary=${this.data.getBoundary()}`),this.request.query)){const[e,t]=this.request.path.split("?");this.request.path=`${e}?${this.options.qs.stringify(this.request.query)}${t?`&${t}`:""}`}}_checkModify(){if(this.response)throw new Error("Cannot modify request after it has been sent!")}}Snekfetch.version=r.version,Snekfetch.METHODS=o.METHODS.concat("BREW").filter(e=>"M-SEARCH"!==e);for(const e of Snekfetch.METHODS)Snekfetch[e.toLowerCase()]=((t,s)=>new Snekfetch(e,t,s));e.exports=Snekfetch},function(e,t,s){"use strict";function i(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.exports=function(e,t,s,r){t=t||"&",s=s||"=";var o={};if("string"!=typeof e||0===e.length)return o;var a=/\+/g;e=e.split(t);var l=1e3;r&&"number"==typeof r.maxKeys&&(l=r.maxKeys);var h=e.length;l>0&&h>l&&(h=l);for(var c=0;c=0?(d=m.substr(0,g),u=m.substr(g+1)):(d=m,u=""),p=decodeURIComponent(d),f=decodeURIComponent(u),i(o,p)?n(o[p])?o[p].push(f):o[p]=[o[p],f]:o[p]=f}return o};var n=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},function(e,t,s){"use strict";function i(e,t){if(e.map)return e.map(t);for(var s=[],i=0;ie.text().then(t=>{const s={};for(const[t,i]of e.headers.entries())s[t.toLowerCase()]=i;return{response:e,raw:t,headers:s}}))},shouldSendRaw:()=>!1,METHODS:["GET","HEAD","POST","PUT","DELETE","CONNECT","OPTIONS","PATCH"],STATUS_CODES:{},Extension:Object,FormData:window.FormData}},function(e,t){},function(e,t,s){const{register:i}=s(42),n={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_TIMEOUT:"The connection to the gateway timed out.",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_CHANNEL_ORPHAN:"Could not find a parent to this 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,s=!1)=>`Supplied ${e} is not a${s?"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(n))i(e,t)},function(e,t,s){const i=s(84),n=s(88),r=s(90),{Error:o}=s(4),{Endpoints:a}=s(0);class RESTManager{constructor(e,t="Bot"){this.client=e,this.handlers={},this.rateLimitedEndpoints={},this.globallyRateLimited=!1,this.tokenPrefix=t,this.versioned=!0,this.timeDifferences=[]}get api(){return r(this)}get timeDifference(){return Math.round(this.timeDifferences.reduce((e,t)=>e+t,0)/this.timeDifferences.length)}set timeDifference(e){this.timeDifferences.unshift(e),this.timeDifferences.length>5&&(this.timeDifferences.length=5)}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 o("TOKEN_MISSING")}get cdn(){return a.CDN(this.client.options.http.cdn)}push(e,t){return new Promise((s,i)=>{e.push({request:t,resolve:s,reject:i})})}getRequestHandler(){const e=this.client.options.apiRequestMethod;if("function"==typeof e)return e;const t=i[e];if(!t)throw new o("RATELIMIT_INVALID_METHOD");return t}request(e,t,s={}){const r=new n(this,e,t,s);return this.handlers[r.route]||(this.handlers[r.route]=new i.RequestHandler(this,this.getRequestHandler())),this.push(this.handlers[r.route],r)}set endpoint(e){this.client.options.http.api=e}}e.exports=RESTManager},function(e,t,s){e.exports={sequential:s(85),burst:s(86),RequestHandler:s(87)}},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)}))}},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.remaining--,this.handle())}},function(e,t,s){const i=s(43),{Events:{RATE_LIMIT:n}}=s(0);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.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,s)=>{const r=i=>{i||this.limited?(i||(i=this.resetTime-Date.now()+this.manager.timeDifference+this.client.options.restTimeOffset),s({timeout:i}),this.client.listenerCount(n)&&this.client.emit(n,{timeout:i,limit:this.limit,timeDifference:this.manager.timeDifference,method:e.request.method,path:e.request.path,route:e.request.route})):t()};e.request.gen().end((t,s)=>{if(s&&s.headers&&(s.headers["x-ratelimit-global"]&&(this.globallyLimited=!0),this.limit=Number(s.headers["x-ratelimit-limit"]),this.resetTime=1e3*Number(s.headers["x-ratelimit-reset"]),this.remaining=Number(s.headers["x-ratelimit-remaining"]),this.manager.timeDifference=Date.now()-new Date(s.headers.date).getTime()),t)429===t.status?(this.queue.unshift(e),r(Number(s.headers["retry-after"])+this.client.options.restTimeOffset)):t.status>=500&&t.status<600?(this.queue.unshift(e),r(1e3+this.client.options.restTimeOffset)):(e.reject(t.status>=400&&t.status<500?new i(s.request.path,s.body):t),r());else{const t=s&&s.body?s.body:{};e.resolve(t),r()}})})}reset(){this.globallyLimited=!1,this.remaining=1}}e.exports=RequestHandler},function(e,t,s){const i=s(29),n=s(28),r=s(89),{browser:o,UserAgent:a}=s(0);if(r.Agent)var l=new r.Agent({keepAlive:!0});class APIRequest{constructor(e,t,s,i){this.rest=e,this.client=e.client,this.method=t,this.path=s.toString(),this.route=i.route,this.options=i}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=(i.stringify(this.options.query).match(/[^=&?]+=[^=&?]+/g)||[]).join("&");this.path+=`?${e}`}const t=n[this.method](`${e}${this.path}`,{agent:l});if(!1!==this.options.auth&&t.set("Authorization",this.rest.getAuth()),this.options.reason&&t.set("X-Audit-Log-Reason",encodeURIComponent(this.options.reason)),o||t.set("User-Agent",a),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){},function(e,t){const s=()=>{},i=["get","post","delete","patch","put"],n=["toString","valueOf","inspect","constructor",Symbol.toPrimitive,Symbol.for("util.inspect.custom")];e.exports=function(e){const t=[""],r={get:(o,a)=>n.includes(a)?()=>t.join("/"):i.includes(a)?s=>e.request(a,t.join("/"),Object.assign({versioned:e.versioned,route:t.map((e,s)=>/\d{16,19}/g.test(e)?/channels|guilds/.test(t[s-1])?e:":id":e).join("/")},s)):(t.push(a),new Proxy(s,r)),apply:(e,i,n)=>(t.push(...n.filter(e=>null!=e)),new Proxy(s,r))};return new Proxy(s,r)}},function(module,exports,__webpack_require__){const BaseClient=__webpack_require__(30),Permissions=__webpack_require__(10),ClientManager=__webpack_require__(92),ClientVoiceManager=__webpack_require__(93),WebSocketManager=__webpack_require__(94),ActionsManager=__webpack_require__(150),Collection=__webpack_require__(3),VoiceRegion=__webpack_require__(36),Webhook=__webpack_require__(15),Invite=__webpack_require__(25),ClientApplication=__webpack_require__(33),ShardClientUtil=__webpack_require__(177),VoiceBroadcast=__webpack_require__(178),UserStore=__webpack_require__(71),ChannelStore=__webpack_require__(72),GuildStore=__webpack_require__(73),ClientPresenceStore=__webpack_require__(74),EmojiStore=__webpack_require__(37),{Events:Events,browser:browser}=__webpack_require__(0),DataResolver=__webpack_require__(9),{Error:Error,TypeError:TypeError,RangeError:RangeError}=__webpack_require__(4);class Client extends BaseClient{constructor(e={}){super(Object.assign({_tokenType:"Bot"},e)),!browser&&!this.options.shardId&&"SHARD_ID"in process.env&&(this.options.shardId=Number(process.env.SHARD_ID)),!browser&&!this.options.shardCount&&"SHARD_COUNT"in process.env&&(this.options.shardCount=Number(process.env.SHARD_COUNT)),this._validateOptions(),this.manager=new ClientManager(this),this.ws=new WebSocketManager(this),this.actions=new ActionsManager(this),this.voice=browser?null:new ClientVoiceManager(this),this.shard=!browser&&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}),!browser&&!this.token&&"CLIENT_TOKEN"in process.env?this.token=process.env.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 browser?new Collection:this.voice.connections}get emojis(){const e=new EmojiStore({client:this});for(const t of this.guilds.values())if(t.available)for(const s of t.emojis.values())e.set(s.id,s);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=this.token){return new Promise((t,s)=>{if(!e||"string"!=typeof e)throw new Error("TOKEN_INVALID");e=e.replace(/^Bot\s*/i,""),this.manager.connectToWebSocket(e,t,s)}).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 s of e)t.set(s.id,new VoiceRegion(s));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(Events.DEBUG,"Didn't sweep messages - lifetime is unlimited"),-1;const t=1e3*e,s=Date.now();let i=0,n=0;for(const e of this.channels.values())if(e.messages){i++;for(const i of e.messages.values())s-(i.editedTimestamp||i.createdTimestamp)>t&&(e.messages.delete(i.id),n++)}return this.emit(Events.DEBUG,`Swept ${n} messages older than ${e} seconds in ${i} text-based channels`),n}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},function(e,t,s){const{Events:i,Status:n}=s(0),{Error:r}=s(4);class ClientManager{constructor(e){this.client=e,this.heartbeatInterval=null}get status(){return this.connection?this.connection.status:n.IDLE}connectToWebSocket(e,t,s){this.client.emit(i.DEBUG,`Authenticated using token ${e}`),this.client.token=e;const n=this.client.setTimeout(()=>s(new r("WS_CONNECTION_TIMEOUT")),3e5);this.client.api.gateway.get().then(o=>{const a=`${o.url}/`;this.client.emit(i.DEBUG,`Using gateway ${a}`),this.client.ws.connect(a),this.client.ws.connection.once("error",s),this.client.ws.connection.once("close",e=>{4004===e.code&&s(new r("TOKEN_INVALID")),4010===e.code&&s(new r("SHARDING_INVALID")),4011===e.code&&s(new r("SHARDING_REQUIRED"))}),this.client.once(i.READY,()=>{t(e),this.client.clearTimeout(n)})},s)}destroy(){return this.client.ws.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,s){const i=s(20),{Events:n,Status:r}=s(0),o=s(95);class WebSocketManager extends i{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(n.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 o(this,e),!0;switch(this.connection.status){case r.IDLE:case r.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,s){const i=s(20),{Events:n,OPCodes:r,Status:o,WSCodes:a}=s(0),l=s(96),h=s(64);try{var c=s(141);c.Inflate||(c=s(65))}catch(e){c=s(65)}class WebSocketConnection extends i{constructor(e,t){super(),this.manager=e,this.client=e.client,this.ws=null,this.sequence=-1,this.status=o.IDLE,this.packetManager=new l(this),this.lastPingTimestamp=0,this.ratelimit={queue:[],remaining:120,total:120,time:6e4,resetTimer:null},this.disabledEvents={};for(const e of this.client.options.disabledEvents)this.disabledEvents[e]=!0;this.closeSequence=0,this.expectingClose=!1,this.inflate=null,this.connect(t)}triggerReady(){this.status!==o.READY?(this.status=o.READY,this.client.emit(n.READY),this.packetManager.handleQueue()):this.debug("Tried to mark self as ready, but already ready")}checkIfReady(){if(this.status===o.READY||this.status===o.NEARLY)return!1;let e=0;for(const t of this.client.guilds.values())t.available||e++;if(0===e){if(this.status=o.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()},this.ratelimit.time));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===h.OPEN?this.ws.send(h.pack(e)):this.debug(`Tried to send packet ${e} but no WebSocket is available!`)}send(e){this.ws&&this.ws.readyState===h.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,s=!1){if(t)return this.client.setTimeout(()=>this.connect(e,0,s),t);if(this.ws&&!s)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.inflate=new c.Inflate({chunkSize:65535,flush:c.Z_SYNC_FLUSH,to:"json"===h.encoding?"string":""}),this.expectingClose=!1,this.gateway=e,this.debug(`Connecting to ${e}`);const i=this.ws=h.create(e,{v:this.client.options.ws.version,compress:"zlib-stream"});return i.onmessage=this.onMessage.bind(this),i.onopen=this.onOpen.bind(this),i.onerror=this.onError.bind(this),i.onclose=this.onClose.bind(this),this.status=o.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=o.DISCONNECTED,this.ratelimit.remaining=this.ratelimit.total,!0):(this.debug("Attempted to destroy WebSocket but no connection exists!"),!1)}onMessage({data:e}){e instanceof ArrayBuffer&&(e=new Uint8Array(e));const t=e.length,s=t>=4&&0===e[t-4]&&0===e[t-3]&&255===e[t-2]&&255===e[t-1];if(this.inflate.push(e,s&&c.Z_SYNC_FLUSH),s)try{const e=h.unpack(this.inflate.result);this.onPacket(e),this.client.listenerCount("raw")&&this.client.emit("raw",e)}catch(e){this.client.emit("debug",e)}}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 r.HELLO:return this.heartbeat(e.d.heartbeat_interval);case r.RECONNECT:return this.reconnect();case r.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 r.HEARTBEAT_ACK:return this.ackHeartbeat();case r.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(n.RECONNECTING),this.connect(this.gateway,5500,!0)}onError(e){e&&"uWs client connection error"===e.message?this.reconnect():this.client.emit(n.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:a[e.code])return this.expectingClose=!1,this.client.emit(n.DISCONNECT,e),this.debug(a[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:r.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:s}=this.client.options;s>0&&(e.shard=[Number(t),Number(s)]),this.debug("Identifying as a new session"),this.send({op:r.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:r.RESUME,d:e})}}e.exports=WebSocketConnection},function(e,t,s){const{OPCodes:i,Status:n,WSEvents:r}=s(0),o=[r.READY,r.RESUMED,r.GUILD_CREATE,r.GUILD_DELETE,r.GUILD_MEMBERS_CHUNK,r.GUILD_MEMBER_ADD,r.GUILD_MEMBER_REMOVE];class WebSocketPacketManager{constructor(e){this.ws=e,this.handlers={},this.queue=[],this.register(r.READY,s(97)),this.register(r.RESUMED,s(102)),this.register(r.GUILD_CREATE,s(103)),this.register(r.GUILD_DELETE,s(104)),this.register(r.GUILD_UPDATE,s(105)),this.register(r.GUILD_BAN_ADD,s(106)),this.register(r.GUILD_BAN_REMOVE,s(107)),this.register(r.GUILD_MEMBER_ADD,s(108)),this.register(r.GUILD_MEMBER_REMOVE,s(109)),this.register(r.GUILD_MEMBER_UPDATE,s(110)),this.register(r.GUILD_ROLE_CREATE,s(111)),this.register(r.GUILD_ROLE_DELETE,s(112)),this.register(r.GUILD_ROLE_UPDATE,s(113)),this.register(r.GUILD_EMOJIS_UPDATE,s(114)),this.register(r.GUILD_MEMBERS_CHUNK,s(115)),this.register(r.CHANNEL_CREATE,s(116)),this.register(r.CHANNEL_DELETE,s(117)),this.register(r.CHANNEL_UPDATE,s(118)),this.register(r.CHANNEL_PINS_UPDATE,s(119)),this.register(r.PRESENCE_UPDATE,s(120)),this.register(r.USER_UPDATE,s(121)),this.register(r.USER_NOTE_UPDATE,s(122)),this.register(r.USER_SETTINGS_UPDATE,s(123)),this.register(r.USER_GUILD_SETTINGS_UPDATE,s(124)),this.register(r.VOICE_STATE_UPDATE,s(125)),this.register(r.TYPING_START,s(126)),this.register(r.MESSAGE_CREATE,s(127)),this.register(r.MESSAGE_DELETE,s(128)),this.register(r.MESSAGE_UPDATE,s(129)),this.register(r.MESSAGE_DELETE_BULK,s(130)),this.register(r.VOICE_SERVER_UPDATE,s(131)),this.register(r.GUILD_SYNC,s(132)),this.register(r.RELATIONSHIP_ADD,s(133)),this.register(r.RELATIONSHIP_REMOVE,s(134)),this.register(r.MESSAGE_REACTION_ADD,s(135)),this.register(r.MESSAGE_REACTION_REMOVE,s(136)),this.register(r.MESSAGE_REACTION_REMOVE_ALL,s(137))}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===i.HEARTBEAT_ACK?(this.ws.client._pong(this.ws.client._pingTimestamp),this.ws.lastHeartbeatAck=!0,this.ws.client.emit("debug","Heartbeat acknowledged")):e.op===i.HEARTBEAT&&(this.client.ws.send({op:i.HEARTBEAT,d:this.client.ws.sequence}),this.ws.client.emit("debug","Received gateway heartbeat")),this.ws.status===n.RECONNECTING&&(this.ws.reconnecting=!1,this.ws.checkIfReady()),this.ws.setSequence(e.s),void 0===this.ws.disabledEvents[e.t]&&(this.ws.status!==n.READY&&-1===o.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,s){const i=s(1),{Events:n}=s(0),r=s(44);class ReadyHandler extends i{handle(e){const t=this.packetManager.client,s=e.d;t.ws.heartbeat(),s.user.user_settings=s.user_settings,s.user.user_guild_settings=s.user_guild_settings;const i=new r(t,s.user);t.user=i,t.readyAt=new Date,t.users.set(i.id,i);for(const e of s.guilds)t.guilds.create(e);for(const e of s.private_channels)t.channels.create(e);for(const e of s.relationships){const s=t.users.create(e.user);1===e.type?t.user.friends.set(s.id,s):2===e.type&&t.user.blocked.set(s.id,s)}for(const e of s.presences||[])t.presences.create(e);if(s.notes)for(const e in s.notes){let i=s.notes[e];i.length||(i=null),t.user.notes.set(e,i)}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*s.guilds.length);t.setMaxListeners(s.guilds.length+10),t.once("ready",()=>{t.syncGuilds(),t.setMaxListeners(10),t.clearTimeout(o)});const a=this.packetManager.ws;a.sessionID=s.session_id,a._trace=s._trace,t.emit(n.DEBUG,`READY ${a._trace.join(" -> ")} ${a.sessionID}`),a.checkIfReady()}}e.exports=ReadyHandler},function(e,t,s){const i=s(27),{TypeError:n}=s(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=i.fromNumber(t.before.getTime()-14200704e5).shiftLeft(22).toString()),t.after&&(t.after instanceof Date||(t.after=new Date(t.after)),t.minID=i.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=i.fromNumber(e).shiftLeft(22).toString(),t.maxID=i.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=s(12),o=s(26);if(!(e instanceof r||e instanceof o))throw new n("SEARCH_CHANNEL_TYPE");return e.client.api[e instanceof r?"channels":"guilds"](e.id).messages().search.get({query:t}).then(t=>{const s=t.messages.map(t=>t.map(t=>e.client.channels.get(t.channel_id).messages.create(t,!1)));return{total:t.total_results,results:s}})}},function(e,t,s){const i=s(7),n=s(50);class ReactionStore extends i{constructor(e,t){super(e.client,t,n),this.message=e}create(e,t){return super.create(e,t,{id:e.emoji.id||e.emoji.name,extras:[this.message]})}}e.exports=ReactionStore},function(e,t,s){const i=s(60);e.exports=async function(e,t){const n=s(17),r=s(13);if(e instanceof n||e instanceof r)return e.createDM().then(e=>e.send(t));const{data:o,files:a}=await i(e,t);return e.client.api.channels[e.id].messages.post({data:o,files:a}).then(t=>e.client.actions.MessageCreate.handle(t).message)}},function(e,t,s){const i=s(3),{UserFlags:n}=s(0),r=s(61),o=s(6);class UserProfile extends o{constructor(e,t){super(e.client),this.user=e,this.mutualGuilds=new i,this.connections=new i,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,s]of Object.entries(n))(this._flags&s)===s&&e.push(t);return e}}e.exports=UserProfile},function(e,t,s){const i=s(1),{Events:n,Status:r}=s(0);class ResumedHandler extends i{handle(e){const t=this.packetManager.client,s=t.ws.connection;s._trace=e.d._trace,s.status=r.READY,this.packetManager.handleQueue();const i=s.sequence-s.closeSequence;s.debug(`RESUMED ${s._trace.join(" -> ")} | replayed ${i} events.`),t.emit(n.RESUMED,i),s.heartbeat()}}e.exports=ResumedHandler},function(e,t,s){const i=s(1),{Events:n,Status:r}=s(0);class GuildCreateHandler extends i{async handle(e){const t=this.packetManager.client,s=e.d;let i=t.guilds.get(s.id);i?i.available||s.unavailable||(i._patch(s),this.packetManager.ws.checkIfReady()):(i=t.guilds.create(s),t.ws.connection.status===r.READY&&(t.options.fetchAllMembers&&await i.members.fetch(),t.emit(n.GUILD_CREATE,i)))}}e.exports=GuildCreateHandler},function(e,t,s){const i=s(1);class GuildDeleteHandler extends i{handle(e){this.packetManager.client.actions.GuildDelete.handle(e.d)}}e.exports=GuildDeleteHandler},function(e,t,s){const i=s(1);class GuildUpdateHandler extends i{handle(e){const t=this.packetManager.client,s=e.d;t.actions.GuildUpdate.handle(s)}}e.exports=GuildUpdateHandler},function(e,t,s){const i=s(1),{Events:n}=s(0);class GuildBanAddHandler extends i{handle(e){const t=this.packetManager.client,s=e.d,i=t.guilds.get(s.guild_id),r=t.users.get(s.user.id);i&&r&&t.emit(n.GUILD_BAN_ADD,i,r)}}e.exports=GuildBanAddHandler},function(e,t,s){const i=s(1);class GuildBanRemoveHandler extends i{handle(e){const t=this.packetManager.client,s=e.d;t.actions.GuildBanRemove.handle(s)}}e.exports=GuildBanRemoveHandler},function(e,t,s){const i=s(1),{Events:n,Status:r}=s(0);class GuildMemberAddHandler extends i{handle(e){const t=this.packetManager.client,s=e.d,i=t.guilds.get(s.guild_id);if(i){i.memberCount++;const e=i.members.create(s);t.ws.connection.status===r.READY&&t.emit(n.GUILD_MEMBER_ADD,e)}}}e.exports=GuildMemberAddHandler},function(e,t,s){const i=s(1);class GuildMemberRemoveHandler extends i{handle(e){const t=this.packetManager.client,s=e.d;t.actions.GuildMemberRemove.handle(s)}}e.exports=GuildMemberRemoveHandler},function(e,t,s){const i=s(1),{Events:n,Status:r}=s(0);class GuildMemberUpdateHandler extends i{handle(e){const t=this.packetManager.client,s=e.d,i=t.guilds.get(s.guild_id);if(i){const e=i.members.get(s.user.id);if(e){const i=e._update(s);t.ws.connection.status===r.READY&&t.emit(n.GUILD_MEMBER_UPDATE,i,e)}}}}e.exports=GuildMemberUpdateHandler},function(e,t,s){const i=s(1);class GuildRoleCreateHandler extends i{handle(e){const t=this.packetManager.client,s=e.d;t.actions.GuildRoleCreate.handle(s)}}e.exports=GuildRoleCreateHandler},function(e,t,s){const i=s(1);class GuildRoleDeleteHandler extends i{handle(e){const t=this.packetManager.client,s=e.d;t.actions.GuildRoleDelete.handle(s)}}e.exports=GuildRoleDeleteHandler},function(e,t,s){const i=s(1);class GuildRoleUpdateHandler extends i{handle(e){const t=this.packetManager.client,s=e.d;t.actions.GuildRoleUpdate.handle(s)}}e.exports=GuildRoleUpdateHandler},function(e,t,s){const i=s(1);class GuildEmojisUpdate extends i{handle(e){const t=this.packetManager.client,s=e.d;t.actions.GuildEmojisUpdate.handle(s)}}e.exports=GuildEmojisUpdate},function(e,t,s){const i=s(1),{Events:n}=s(0),r=s(3);class GuildMembersChunkHandler extends i{handle(e){const t=this.packetManager.client,s=e.d,i=t.guilds.get(s.guild_id);if(!i)return;const o=new r;for(const e of s.members)o.set(e.user.id,i.members.create(e));t.emit(n.GUILD_MEMBERS_CHUNK,o,i),t.ws.lastHeartbeatAck=!0}}e.exports=GuildMembersChunkHandler},function(e,t,s){const i=s(1);class ChannelCreateHandler extends i{handle(e){this.packetManager.client.actions.ChannelCreate.handle(e.d)}}e.exports=ChannelCreateHandler},function(e,t,s){const i=s(1);class ChannelDeleteHandler extends i{handle(e){this.packetManager.client.actions.ChannelDelete.handle(e.d)}}e.exports=ChannelDeleteHandler},function(e,t,s){const i=s(1),{Events:n}=s(0);class ChannelUpdateHandler extends i{handle(e){const{old:t,updated:s}=this.packetManager.client.actions.ChannelUpdate.handle(e.d);t&&s&&this.packetManager.client.emit(n.CHANNEL_UPDATE,t,s)}}e.exports=ChannelUpdateHandler},function(e,t,s){const i=s(1),{Events:n}=s(0);class ChannelPinsUpdate extends i{handle(e){const t=this.packetManager.client,s=e.d,i=t.channels.get(s.channel_id),r=new Date(s.last_pin_timestamp);i&&r&&t.emit(n.CHANNEL_PINS_UPDATE,i,r)}}e.exports=ChannelPinsUpdate},function(e,t,s){const i=s(1),{Events:n}=s(0);class PresenceUpdateHandler extends i{handle(e){const t=this.packetManager.client,s=e.d;let i=t.users.get(s.user.id);const r=t.guilds.get(s.guild_id);if(!i){if(!s.user.username)return;i=t.users.create(s.user)}const o=i._update(s.user);if(i.equals(o)||t.emit(n.USER_UPDATE,o,i),r){let e=r.members.get(i.id);if(e||"offline"===s.status||(e=r.members.create({user:i,roles:s.roles,deaf:!1,mute:!1}),t.emit(n.GUILD_MEMBER_AVAILABLE,e)),e){if(0===t.listenerCount(n.PRESENCE_UPDATE))return void r.presences.create(s);const i=e._clone();e.presence&&(i.frozenPresence=e.presence._clone()),r.presences.create(s),t.emit(n.PRESENCE_UPDATE,i,e)}else r.presences.create(s)}}}e.exports=PresenceUpdateHandler},function(e,t,s){const i=s(1);class UserUpdateHandler extends i{handle(e){const t=this.packetManager.client,s=e.d;t.actions.UserUpdate.handle(s)}}e.exports=UserUpdateHandler},function(e,t,s){const i=s(1);class UserNoteUpdateHandler extends i{handle(e){const t=this.packetManager.client,s=e.d;t.actions.UserNoteUpdate.handle(s)}}e.exports=UserNoteUpdateHandler},function(e,t,s){const i=s(1),{Events:n}=s(0);class UserSettingsUpdateHandler extends i{handle(e){const t=this.packetManager.client;t.user.settings.patch(e.d),t.emit(n.USER_SETTINGS_UPDATE,t.user.settings)}}e.exports=UserSettingsUpdateHandler},function(e,t,s){const i=s(1),{Events:n}=s(0),r=s(39);class UserGuildSettingsUpdateHandler extends i{handle(e){const t=this.packetManager.client,s=t.user.guildSettings.get(e.d.guild_id);s?s.patch(e.d):t.user.guildSettings.set(e.d.guild_id,new r(this.client,e.d)),t.emit(n.USER_GUILD_SETTINGS_UPDATE,t.user.guildSettings.get(e.d.guild_id))}}e.exports=UserGuildSettingsUpdateHandler},function(e,t,s){const i=s(1),{Events:n}=s(0);class VoiceStateUpdateHandler extends i{handle(e){const t=this.packetManager.client,s=e.d,i=t.guilds.get(s.guild_id);if(i){const e=i.members.get(s.user_id);if(e){const r=e._clone();r._frozenVoiceState=r.voiceState,e.user.id===t.user.id&&s.channel_id&&t.emit("self.voiceStateUpdate",s),i.voiceStates.set(e.user.id,s),t.emit(n.VOICE_STATE_UPDATE,r,e)}}}}e.exports=VoiceStateUpdateHandler},function(e,t,s){function i(e,t){return e.client.setTimeout(()=>{e.client.emit(r.TYPING_STOP,e,t,e._typing.get(t.id)),e._typing.delete(t.id)},6e3)}const n=s(1),{Events:r}=s(0);class TypingStartHandler extends n{handle(e){const t=this.packetManager.client,s=e.d,n=t.channels.get(s.channel_id),o=t.users.get(s.user_id),a=new Date(1e3*s.timestamp);if(n&&o){if("voice"===n.type)return void t.emit(r.WARN,`Discord sent a typing packet to voice channel ${n.id}`);if(n._typing.has(o.id)){const e=n._typing.get(o.id);e.lastTimestamp=a,e.resetTimeout(i(n,o))}else n._typing.set(o.id,new TypingData(t,a,a,i(n,o))),t.emit(r.TYPING_START,n,o)}}}class TypingData{constructor(e,t,s,i){this.client=e,this.since=t,this.lastTimestamp=s,this._timeout=i}resetTimeout(e){this.client.clearTimeout(this._timeout),this._timeout=e}get elapsedTime(){return Date.now()-this.since}}e.exports=TypingStartHandler},function(e,t,s){const i=s(1);class MessageCreateHandler extends i{handle(e){this.packetManager.client.actions.MessageCreate.handle(e.d)}}e.exports=MessageCreateHandler},function(e,t,s){const i=s(1);class MessageDeleteHandler extends i{handle(e){this.packetManager.client.actions.MessageDelete.handle(e.d)}}e.exports=MessageDeleteHandler},function(e,t,s){const i=s(1),{Events:n}=s(0);class MessageUpdateHandler extends i{handle(e){const{old:t,updated:s}=this.packetManager.client.actions.MessageUpdate.handle(e.d);t&&s&&this.packetManager.client.emit(n.MESSAGE_UPDATE,t,s)}}e.exports=MessageUpdateHandler},function(e,t,s){const i=s(1);class MessageDeleteBulkHandler extends i{handle(e){this.packetManager.client.actions.MessageDeleteBulk.handle(e.d)}}e.exports=MessageDeleteBulkHandler},function(e,t,s){const i=s(1);class VoiceServerUpdate extends i{handle(e){const t=this.packetManager.client,s=e.d;t.emit("self.voiceServer",s)}}e.exports=VoiceServerUpdate},function(e,t,s){const i=s(1);class GuildSyncHandler extends i{handle(e){const t=this.packetManager.client,s=e.d;t.actions.GuildSync.handle(s)}}e.exports=GuildSyncHandler},function(e,t,s){const i=s(1);class RelationshipAddHandler extends i{handle(e){const t=this.packetManager.client,s=e.d;1===s.type?t.users.fetch(s.id).then(e=>{t.user.friends.set(e.id,e)}):2===s.type&&t.users.fetch(s.id).then(e=>{t.user.blocked.set(e.id,e)})}}e.exports=RelationshipAddHandler},function(e,t,s){const i=s(1);class RelationshipRemoveHandler extends i{handle(e){const t=this.packetManager.client,s=e.d;2===s.type?t.user.blocked.has(s.id)&&t.user.blocked.delete(s.id):1===s.type&&t.user.friends.has(s.id)&&t.user.friends.delete(s.id)}}e.exports=RelationshipRemoveHandler},function(e,t,s){const i=s(1),{Events:n}=s(0);class MessageReactionAddHandler extends i{handle(e){const t=this.packetManager.client,s=e.d,{user:i,reaction:r}=t.actions.MessageReactionAdd.handle(s);r&&t.emit(n.MESSAGE_REACTION_ADD,r,i)}}e.exports=MessageReactionAddHandler},function(e,t,s){const i=s(1);class MessageReactionRemove extends i{handle(e){const t=this.packetManager.client,s=e.d;t.actions.MessageReactionRemove.handle(s)}}e.exports=MessageReactionRemove},function(e,t,s){const i=s(1);class MessageReactionRemoveAll extends i{handle(e){const t=this.packetManager.client,s=e.d;t.actions.MessageReactionRemoveAll.handle(s)}}e.exports=MessageReactionRemoveAll},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t,s){"use strict";function i(e){if(!(this instanceof i))return new i(e);this.options=o.assign({level:u,method:f,chunkSize:16384,windowBits:15,memLevel:8,strategy:p,to:""},e||{});var t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new h,this.strm.avail_out=0;var s=r.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(s!==d)throw new Error(l[s]);if(t.header&&r.deflateSetHeader(this.strm,t.header),t.dictionary){var n;if(n="string"==typeof t.dictionary?a.string2buf(t.dictionary):"[object ArrayBuffer]"===c.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,(s=r.deflateSetDictionary(this.strm,n))!==d)throw new Error(l[s]);this._dict_set=!0}}function n(e,t){var s=new i(t);if(s.push(e,!0),s.err)throw s.msg||l[s.err];return s.result}var r=s(143),o=s(11),a=s(68),l=s(40),h=s(69),c=Object.prototype.toString,d=0,u=-1,p=0,f=8;i.prototype.push=function(e,t){var s,i,n=this.strm,l=this.options.chunkSize;if(this.ended)return!1;i=t===~~t?t:!0===t?4:0,"string"==typeof e?n.input=a.string2buf(e):"[object ArrayBuffer]"===c.call(e)?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;do{if(0===n.avail_out&&(n.output=new o.Buf8(l),n.next_out=0,n.avail_out=l),1!==(s=r.deflate(n,i))&&s!==d)return this.onEnd(s),this.ended=!0,!1;0!==n.avail_out&&(0!==n.avail_in||4!==i&&2!==i)||("string"===this.options.to?this.onData(a.buf2binstring(o.shrinkBuf(n.output,n.next_out))):this.onData(o.shrinkBuf(n.output,n.next_out)))}while((n.avail_in>0||0===n.avail_out)&&1!==s);return 4===i?(s=r.deflateEnd(this.strm),this.onEnd(s),this.ended=!0,s===d):2!==i||(this.onEnd(d),n.avail_out=0,!0)},i.prototype.onData=function(e){this.chunks.push(e)},i.prototype.onEnd=function(e){e===d&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=o.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},t.Deflate=i,t.deflate=n,t.deflateRaw=function(e,t){return t=t||{},t.raw=!0,n(e,t)},t.gzip=function(e,t){return t=t||{},t.gzip=!0,n(e,t)}},function(e,t,s){"use strict";function i(e,t){return e.msg=N[t],t}function n(e){return(e<<1)-(e>4?9:0)}function r(e){for(var t=e.length;--t>=0;)e[t]=0}function o(e){var t=e.state,s=t.pending;s>e.avail_out&&(s=e.avail_out),0!==s&&(T.arraySet(e.output,t.pending_buf,t.pending_out,s,e.next_out),e.next_out+=s,t.pending_out+=s,e.total_out+=s,e.avail_out-=s,t.pending-=s,0===t.pending&&(t.pending_out=0))}function a(e,t){I._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,o(e.strm)}function l(e,t){e.pending_buf[e.pending++]=t}function h(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function c(e,t,s,i){var n=e.avail_in;return n>i&&(n=i),0===n?0:(e.avail_in-=n,T.arraySet(t,e.input,e.next_in,n,s),1===e.state.wrap?e.adler=S(e.adler,t,n,s):2===e.state.wrap&&(e.adler=D(e.adler,t,n,s)),e.next_in+=n,e.total_in+=n,n)}function d(e,t){var s,i,n=e.max_chain_length,r=e.strstart,o=e.prev_length,a=e.nice_match,l=e.strstart>e.w_size-ie?e.strstart-(e.w_size-ie):0,h=e.window,c=e.w_mask,d=e.prev,u=e.strstart+se,p=h[r+o-1],f=h[r+o];e.prev_length>=e.good_match&&(n>>=2),a>e.lookahead&&(a=e.lookahead);do{if(s=t,h[s+o]===f&&h[s+o-1]===p&&h[s]===h[r]&&h[++s]===h[r+1]){r+=2,s++;do{}while(h[++r]===h[++s]&&h[++r]===h[++s]&&h[++r]===h[++s]&&h[++r]===h[++s]&&h[++r]===h[++s]&&h[++r]===h[++s]&&h[++r]===h[++s]&&h[++r]===h[++s]&&ro){if(e.match_start=t,o=i,i>=a)break;p=h[r+o-1],f=h[r+o]}}}while((t=d[t&c])>l&&0!=--n);return o<=e.lookahead?o:e.lookahead}function u(e){var t,s,i,n,r,o=e.w_size;do{if(n=e.window_size-e.lookahead-e.strstart,e.strstart>=o+(o-ie)){T.arraySet(e.window,e.window,o,o,0),e.match_start-=o,e.strstart-=o,e.block_start-=o,t=s=e.hash_size;do{i=e.head[--t],e.head[t]=i>=o?i-o:0}while(--s);t=s=o;do{i=e.prev[--t],e.prev[t]=i>=o?i-o:0}while(--s);n+=o}if(0===e.strm.avail_in)break;if(s=c(e.strm,e.window,e.strstart+e.lookahead,n),e.lookahead+=s,e.lookahead+e.insert>=te)for(r=e.strstart-e.insert,e.ins_h=e.window[r],e.ins_h=(e.ins_h<=te&&(e.ins_h=(e.ins_h<=te)if(i=I._tr_tally(e,e.strstart-e.match_start,e.match_length-te),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=te){e.match_length--;do{e.strstart++,e.ins_h=(e.ins_h<=te&&(e.ins_h=(e.ins_h<4096)&&(e.match_length=te-1)),e.prev_length>=te&&e.match_length<=e.prev_length){n=e.strstart+e.lookahead-te,i=I._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-te),e.lookahead-=e.prev_length-1,e.prev_length-=2;do{++e.strstart<=n&&(e.ins_h=(e.ins_h<=te&&e.strstart>0&&(n=e.strstart-1,(i=o[n])===o[++n]&&i===o[++n]&&i===o[++n])){r=e.strstart+se;do{}while(i===o[++n]&&i===o[++n]&&i===o[++n]&&i===o[++n]&&i===o[++n]&&i===o[++n]&&i===o[++n]&&i===o[++n]&&ne.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=te?(s=I._tr_tally(e,1,e.match_length-te),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(s=I._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),s&&(a(e,!1),0===e.strm.avail_out))return ue}return e.insert=0,t===M?(a(e,!0),0===e.strm.avail_out?fe:me):e.last_lit&&(a(e,!1),0===e.strm.avail_out)?ue:pe}function g(e,t){for(var s;;){if(0===e.lookahead&&(u(e),0===e.lookahead)){if(t===R)return ue;break}if(e.match_length=0,s=I._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,s&&(a(e,!1),0===e.strm.avail_out))return ue}return e.insert=0,t===M?(a(e,!0),0===e.strm.avail_out?fe:me):e.last_lit&&(a(e,!1),0===e.strm.avail_out)?ue:pe}function _(e,t,s,i,n){this.good_length=e,this.max_lazy=t,this.nice_length=s,this.max_chain=i,this.func=n}function E(e){e.window_size=2*e.w_size,r(e.head),e.max_lazy_match=A[e.level].max_lazy,e.good_match=A[e.level].good_length,e.nice_match=A[e.level].nice_length,e.max_chain_length=A[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=te-1,e.match_available=0,e.ins_h=0}function v(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=F,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new T.Buf16(2*Q),this.dyn_dtree=new T.Buf16(2*(2*J+1)),this.bl_tree=new T.Buf16(2*(2*X+1)),r(this.dyn_ltree),r(this.dyn_dtree),r(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new T.Buf16(ee+1),this.heap=new T.Buf16(2*Z+1),r(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new T.Buf16(2*Z+1),r(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function b(e){var t;return e&&e.state?(e.total_in=e.total_out=0,e.data_type=$,t=e.state,t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap?re:ce,e.adler=2===t.wrap?0:1,t.last_flush=R,I._tr_init(t),L):i(e,U)}function w(e){var t=b(e);return t===L&&E(e.state),t}function y(e,t,s,n,r,o){if(!e)return U;var a=1;if(t===B&&(t=6),n<0?(a=0,n=-n):n>15&&(a=2,n-=16),r<1||r>K||s!==F||n<8||n>15||t<0||t>9||o<0||o>V)return i(e,U);8===n&&(n=9);var l=new v;return e.state=l,l.strm=e,l.wrap=a,l.gzhead=null,l.w_bits=n,l.w_size=1<e.pending_buf_size-5&&(s=e.pending_buf_size-5);;){if(e.lookahead<=1){if(u(e),0===e.lookahead&&t===R)return ue;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var i=e.block_start+s;if((0===e.strstart||e.strstart>=i)&&(e.lookahead=e.strstart-i,e.strstart=i,a(e,!1),0===e.strm.avail_out))return ue;if(e.strstart-e.block_start>=e.w_size-ie&&(a(e,!1),0===e.strm.avail_out))return ue}return e.insert=0,t===M?(a(e,!0),0===e.strm.avail_out?fe:me):(e.strstart>e.block_start&&(a(e,!1),e.strm.avail_out),ue)}),new _(4,4,8,4,p),new _(4,5,16,8,p),new _(4,6,32,32,p),new _(4,4,16,16,f),new _(8,16,32,32,f),new _(8,16,128,128,f),new _(8,32,128,256,f),new _(32,128,258,1024,f),new _(32,258,258,4096,f)],t.deflateInit=function(e,t){return y(e,t,F,W,Y,q)},t.deflateInit2=y,t.deflateReset=w,t.deflateResetKeep=b,t.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?U:(e.state.gzhead=t,L):U},t.deflate=function(e,t){var s,a,c,d;if(!e||!e.state||t>O||t<0)return e?i(e,U):U;if(a=e.state,!e.output||!e.input&&0!==e.avail_in||a.status===de&&t!==M)return i(e,0===e.avail_out?P:U);if(a.strm=e,s=a.last_flush,a.last_flush=t,a.status===re)if(2===a.wrap)e.adler=0,l(a,31),l(a,139),l(a,8),a.gzhead?(l(a,(a.gzhead.text?1:0)+(a.gzhead.hcrc?2:0)+(a.gzhead.extra?4:0)+(a.gzhead.name?8:0)+(a.gzhead.comment?16:0)),l(a,255&a.gzhead.time),l(a,a.gzhead.time>>8&255),l(a,a.gzhead.time>>16&255),l(a,a.gzhead.time>>24&255),l(a,9===a.level?2:a.strategy>=H||a.level<2?4:0),l(a,255&a.gzhead.os),a.gzhead.extra&&a.gzhead.extra.length&&(l(a,255&a.gzhead.extra.length),l(a,a.gzhead.extra.length>>8&255)),a.gzhead.hcrc&&(e.adler=D(e.adler,a.pending_buf,a.pending,0)),a.gzindex=0,a.status=oe):(l(a,0),l(a,0),l(a,0),l(a,0),l(a,0),l(a,9===a.level?2:a.strategy>=H||a.level<2?4:0),l(a,ge),a.status=ce);else{var u=F+(a.w_bits-8<<4)<<8;u|=(a.strategy>=H||a.level<2?0:a.level<6?1:6===a.level?2:3)<<6,0!==a.strstart&&(u|=ne),u+=31-u%31,a.status=ce,h(a,u),0!==a.strstart&&(h(a,e.adler>>>16),h(a,65535&e.adler)),e.adler=1}if(a.status===oe)if(a.gzhead.extra){for(c=a.pending;a.gzindex<(65535&a.gzhead.extra.length)&&(a.pending!==a.pending_buf_size||(a.gzhead.hcrc&&a.pending>c&&(e.adler=D(e.adler,a.pending_buf,a.pending-c,c)),o(e),c=a.pending,a.pending!==a.pending_buf_size));)l(a,255&a.gzhead.extra[a.gzindex]),a.gzindex++;a.gzhead.hcrc&&a.pending>c&&(e.adler=D(e.adler,a.pending_buf,a.pending-c,c)),a.gzindex===a.gzhead.extra.length&&(a.gzindex=0,a.status=ae)}else a.status=ae;if(a.status===ae)if(a.gzhead.name){c=a.pending;do{if(a.pending===a.pending_buf_size&&(a.gzhead.hcrc&&a.pending>c&&(e.adler=D(e.adler,a.pending_buf,a.pending-c,c)),o(e),c=a.pending,a.pending===a.pending_buf_size)){d=1;break}d=a.gzindexc&&(e.adler=D(e.adler,a.pending_buf,a.pending-c,c)),0===d&&(a.gzindex=0,a.status=le)}else a.status=le;if(a.status===le)if(a.gzhead.comment){c=a.pending;do{if(a.pending===a.pending_buf_size&&(a.gzhead.hcrc&&a.pending>c&&(e.adler=D(e.adler,a.pending_buf,a.pending-c,c)),o(e),c=a.pending,a.pending===a.pending_buf_size)){d=1;break}d=a.gzindexc&&(e.adler=D(e.adler,a.pending_buf,a.pending-c,c)),0===d&&(a.status=he)}else a.status=he;if(a.status===he&&(a.gzhead.hcrc?(a.pending+2>a.pending_buf_size&&o(e),a.pending+2<=a.pending_buf_size&&(l(a,255&e.adler),l(a,e.adler>>8&255),e.adler=0,a.status=ce)):a.status=ce),0!==a.pending){if(o(e),0===e.avail_out)return a.last_flush=-1,L}else if(0===e.avail_in&&n(t)<=n(s)&&t!==M)return i(e,P);if(a.status===de&&0!==e.avail_in)return i(e,P);if(0!==e.avail_in||0!==a.lookahead||t!==R&&a.status!==de){var p=a.strategy===H?g(a,t):a.strategy===z?m(a,t):A[a.level].func(a,t);if(p!==fe&&p!==me||(a.status=de),p===ue||p===fe)return 0===e.avail_out&&(a.last_flush=-1),L;if(p===pe&&(t===C?I._tr_align(a):t!==O&&(I._tr_stored_block(a,0,0,!1),t===k&&(r(a.head),0===a.lookahead&&(a.strstart=0,a.block_start=0,a.insert=0))),o(e),0===e.avail_out))return a.last_flush=-1,L}return t!==M?L:a.wrap<=0?x:(2===a.wrap?(l(a,255&e.adler),l(a,e.adler>>8&255),l(a,e.adler>>16&255),l(a,e.adler>>24&255),l(a,255&e.total_in),l(a,e.total_in>>8&255),l(a,e.total_in>>16&255),l(a,e.total_in>>24&255)):(h(a,e.adler>>>16),h(a,65535&e.adler)),o(e),a.wrap>0&&(a.wrap=-a.wrap),0!==a.pending?L:x)},t.deflateEnd=function(e){var t;return e&&e.state?(t=e.state.status)!==re&&t!==oe&&t!==ae&&t!==le&&t!==he&&t!==ce&&t!==de?i(e,U):(e.state=null,t===ce?i(e,G):L):U},t.deflateSetDictionary=function(e,t){var s,i,n,o,a,l,h,c,d=t.length;if(!e||!e.state)return U;if(s=e.state,2===(o=s.wrap)||1===o&&s.status!==re||s.lookahead)return U;for(1===o&&(e.adler=S(e.adler,t,d,0)),s.wrap=0,d>=s.w_size&&(0===o&&(r(s.head),s.strstart=0,s.block_start=0,s.insert=0),c=new T.Buf8(s.w_size),T.arraySet(c,t,d-s.w_size,s.w_size,0),t=c,d=s.w_size),a=e.avail_in,l=e.next_in,h=e.input,e.avail_in=d,e.next_in=0,e.input=t,u(s);s.lookahead>=te;){i=s.strstart,n=s.lookahead-(te-1);do{s.ins_h=(s.ins_h<=0;)e[t]=0}function n(e,t,s,i,n){this.static_tree=e,this.extra_bits=t,this.extra_base=s,this.elems=i,this.max_length=n,this.has_stree=e&&e.length}function r(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function o(e){return e<256?te[e]:te[256+(e>>>7)]}function a(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function l(e,t,s){e.bi_valid>V-s?(e.bi_buf|=t<>V-e.bi_valid,e.bi_valid+=s-V):(e.bi_buf|=t<>>=1,s<<=1}while(--t>0);return s>>>1}function d(e){16===e.bi_valid?(a(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}function u(e,t){var s,i,n,r,o,a,l=t.dyn_tree,h=t.max_code,c=t.stat_desc.static_tree,d=t.stat_desc.has_stree,u=t.stat_desc.extra_bits,p=t.stat_desc.extra_base,f=t.stat_desc.max_length,m=0;for(r=0;r<=z;r++)e.bl_count[r]=0;for(l[2*e.heap[e.heap_max]+1]=0,s=e.heap_max+1;sf&&(r=f,m++),l[2*i+1]=r,i>h||(e.bl_count[r]++,o=0,i>=p&&(o=u[i-p]),a=l[2*i],e.opt_len+=a*(r+o),d&&(e.static_len+=a*(c[2*i+1]+o)));if(0!==m){do{for(r=f-1;0===e.bl_count[r];)r--;e.bl_count[r]--,e.bl_count[r+1]+=2,e.bl_count[f]--,m-=2}while(m>0);for(r=f;0!==r;r--)for(i=e.bl_count[r];0!==i;)(n=e.heap[--s])>h||(l[2*n+1]!==r&&(e.opt_len+=(r-l[2*n+1])*l[2*n],l[2*n+1]=r),i--)}}function p(e,t,s){var i,n,r=new Array(z+1),o=0;for(i=1;i<=z;i++)r[i]=o=o+s[i-1]<<1;for(n=0;n<=t;n++){var a=e[2*n+1];0!==a&&(e[2*n]=c(r[a]++,a))}}function f(){var e,t,s,i,r,o=new Array(z+1);for(s=0,i=0;i>=7;i8?a(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function _(e,t,s,i){g(e),i&&(a(e,s),a(e,~s)),N.arraySet(e.pending_buf,e.window,t,s,e.pending),e.pending+=s}function E(e,t,s,i){var n=2*t,r=2*s;return e[n]>1;s>=1;s--)v(e,r,s);n=l;do{s=e.heap[1],e.heap[1]=e.heap[e.heap_len--],v(e,r,1),i=e.heap[1],e.heap[--e.heap_max]=s,e.heap[--e.heap_max]=i,r[2*n]=r[2*s]+r[2*i],e.depth[n]=(e.depth[s]>=e.depth[i]?e.depth[s]:e.depth[i])+1,r[2*s+1]=r[2*i+1]=n,e.heap[1]=n++,v(e,r,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],u(e,t),p(r,h,e.bl_count)}function y(e,t,s){var i,n,r=-1,o=t[1],a=0,l=7,h=4;for(0===o&&(l=138,h=3),t[2*(s+1)+1]=65535,i=0;i<=s;i++)n=o,o=t[2*(i+1)+1],++a=3&&0===e.bl_tree[2*X[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t}function I(e,t,s,i){var n;for(l(e,t-257,5),l(e,s-1,5),l(e,i-4,4),n=0;n>>=1)if(1&s&&0!==e.dyn_ltree[2*t])return C;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return k;for(t=32;t0?(e.strm.data_type===M&&(e.strm.data_type=S(e)),w(e,e.l_desc),w(e,e.d_desc),o=T(e),n=e.opt_len+3+7>>>3,(r=e.static_len+3+7>>>3)<=n&&(n=r)):n=r=s+5,s+4<=n&&-1!==t?D(e,t,s,i):e.strategy===R||r===n?(l(e,(L<<1)+(i?1:0),3),b(e,Q,ee)):(l(e,(x<<1)+(i?1:0),3),I(e,e.l_desc.max_code+1,e.d_desc.max_code+1,o+1),b(e,e.dyn_ltree,e.dyn_dtree)),m(e),i&&g(e)},t._tr_tally=function(e,t,s){return e.pending_buf[e.d_buf+2*e.last_lit]=t>>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&s,e.last_lit++,0===t?e.dyn_ltree[2*s]++:(e.matches++,t--,e.dyn_ltree[2*(se[s]+G+1)]++,e.dyn_dtree[2*o(t)]++),e.last_lit===e.lit_bufsize-1},t._tr_align=function(e){l(e,L<<1,3),h(e,$,Q),d(e)}},function(e,t,s){"use strict";function i(e){if(!(this instanceof i))return new i(e);this.options=o.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&0==(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new c,this.strm.avail_out=0;var s=r.inflateInit2(this.strm,t.windowBits);if(s!==l.Z_OK)throw new Error(h[s]);this.header=new d,r.inflateGetHeader(this.strm,this.header)}function n(e,t){var s=new i(t);if(s.push(e,!0),s.err)throw s.msg||h[s.err];return s.result}var r=s(146),o=s(11),a=s(68),l=s(70),h=s(40),c=s(69),d=s(149),u=Object.prototype.toString;i.prototype.push=function(e,t){var s,i,n,h,c,d,p=this.strm,f=this.options.chunkSize,m=this.options.dictionary,g=!1;if(this.ended)return!1;i=t===~~t?t:!0===t?l.Z_FINISH:l.Z_NO_FLUSH,"string"==typeof e?p.input=a.binstring2buf(e):"[object ArrayBuffer]"===u.call(e)?p.input=new Uint8Array(e):p.input=e,p.next_in=0,p.avail_in=p.input.length;do{if(0===p.avail_out&&(p.output=new o.Buf8(f),p.next_out=0,p.avail_out=f),(s=r.inflate(p,l.Z_NO_FLUSH))===l.Z_NEED_DICT&&m&&(d="string"==typeof m?a.string2buf(m):"[object ArrayBuffer]"===u.call(m)?new Uint8Array(m):m,s=r.inflateSetDictionary(this.strm,d)),s===l.Z_BUF_ERROR&&!0===g&&(s=l.Z_OK,g=!1),s!==l.Z_STREAM_END&&s!==l.Z_OK)return this.onEnd(s),this.ended=!0,!1;p.next_out&&(0!==p.avail_out&&s!==l.Z_STREAM_END&&(0!==p.avail_in||i!==l.Z_FINISH&&i!==l.Z_SYNC_FLUSH)||("string"===this.options.to?(n=a.utf8border(p.output,p.next_out),h=p.next_out-n,c=a.buf2string(p.output,n),p.next_out=h,p.avail_out=f-h,h&&o.arraySet(p.output,p.output,n,h,0),this.onData(c)):this.onData(o.shrinkBuf(p.output,p.next_out)))),0===p.avail_in&&0===p.avail_out&&(g=!0)}while((p.avail_in>0||0===p.avail_out)&&s!==l.Z_STREAM_END);return s===l.Z_STREAM_END&&(i=l.Z_FINISH),i===l.Z_FINISH?(s=r.inflateEnd(this.strm),this.onEnd(s),this.ended=!0,s===l.Z_OK):i!==l.Z_SYNC_FLUSH||(this.onEnd(l.Z_OK),p.avail_out=0,!0)},i.prototype.onData=function(e){this.chunks.push(e)},i.prototype.onEnd=function(e){e===l.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=o.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},t.Inflate=i,t.inflate=n,t.inflateRaw=function(e,t){return t=t||{},t.raw=!0,n(e,t)},t.ungzip=n},function(e,t,s){"use strict";function i(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function n(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new p.Buf16(320),this.work=new p.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function r(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=M,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new p.Buf32(ce),t.distcode=t.distdyn=new p.Buf32(de),t.sane=1,t.back=-1,T):D}function o(e){var t;return e&&e.state?(t=e.state,t.wsize=0,t.whave=0,t.wnext=0,r(e)):D}function a(e,t){var s,i;return e&&e.state?(i=e.state,t<0?(s=0,t=-t):(s=1+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?D:(null!==i.window&&i.wbits!==t&&(i.window=null),i.wrap=s,i.wbits=t,o(e))):D}function l(e,t){var s,i;return e?(i=new n,e.state=i,i.window=null,(s=a(e,t))!==T&&(e.state=null),s):D}function h(e){if(pe){var t;for(d=new p.Buf32(512),u=new p.Buf32(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(_(v,e.lens,0,288,d,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;_(b,e.lens,0,32,u,0,e.work,{bits:5}),pe=!1}e.lencode=d,e.lenbits=9,e.distcode=u,e.distbits=5}function c(e,t,s,i){var n,r=e.state;return null===r.window&&(r.wsize=1<=r.wsize?(p.arraySet(r.window,t,s-r.wsize,r.wsize,0),r.wnext=0,r.whave=r.wsize):((n=r.wsize-r.wnext)>i&&(n=i),p.arraySet(r.window,t,s-i,n,r.wnext),(i-=n)?(p.arraySet(r.window,t,s-i,i,0),r.wnext=i,r.whave=r.wsize):(r.wnext+=n,r.wnext===r.wsize&&(r.wnext=0),r.whave>>8&255,s.check=m(s.check,De,2,0),u=0,ce=0,s.mode=O;break}if(s.flags=0,s.head&&(s.head.done=!1),!(1&s.wrap)||(((255&u)<<8)+(u>>8))%31){e.msg="incorrect header check",s.mode=ae;break}if((15&u)!==k){e.msg="unknown compression method",s.mode=ae;break}if(u>>>=4,ce-=4,ye=8+(15&u),0===s.wbits)s.wbits=ye;else if(ye>s.wbits){e.msg="invalid window size",s.mode=ae;break}s.dmax=1<>8&1),512&s.flags&&(De[0]=255&u,De[1]=u>>>8&255,s.check=m(s.check,De,2,0)),u=0,ce=0,s.mode=L;case L:for(;ce<32;){if(0===l)break e;l--,u+=n[o++]<>>8&255,De[2]=u>>>16&255,De[3]=u>>>24&255,s.check=m(s.check,De,4,0)),u=0,ce=0,s.mode=x;case x:for(;ce<16;){if(0===l)break e;l--,u+=n[o++]<>8),512&s.flags&&(De[0]=255&u,De[1]=u>>>8&255,s.check=m(s.check,De,2,0)),u=0,ce=0,s.mode=U;case U:if(1024&s.flags){for(;ce<16;){if(0===l)break e;l--,u+=n[o++]<>>8&255,s.check=m(s.check,De,2,0)),u=0,ce=0}else s.head&&(s.head.extra=null);s.mode=G;case G:if(1024&s.flags&&((pe=s.length)>l&&(pe=l),pe&&(s.head&&(ye=s.head.extra_len-s.length,s.head.extra||(s.head.extra=new Array(s.head.extra_len)),p.arraySet(s.head.extra,n,o,pe,ye)),512&s.flags&&(s.check=m(s.check,n,pe,o)),l-=pe,o+=pe,s.length-=pe),s.length))break e;s.length=0,s.mode=P;case P:if(2048&s.flags){if(0===l)break e;pe=0;do{ye=n[o+pe++],s.head&&ye&&s.length<65536&&(s.head.name+=String.fromCharCode(ye))}while(ye&&pe>9&1,s.head.done=!0),e.adler=s.check=0,s.mode=V;break;case H:for(;ce<32;){if(0===l)break e;l--,u+=n[o++]<>>=7&ce,ce-=7&ce,s.mode=ne;break}for(;ce<3;){if(0===l)break e;l--,u+=n[o++]<>>=1,ce-=1,3&u){case 0:s.mode=$;break;case 1:if(h(s),s.mode=J,t===A){u>>>=2,ce-=2;break e}break;case 2:s.mode=W;break;case 3:e.msg="invalid block type",s.mode=ae}u>>>=2,ce-=2;break;case $:for(u>>>=7&ce,ce-=7&ce;ce<32;){if(0===l)break e;l--,u+=n[o++]<>>16^65535)){e.msg="invalid stored block lengths",s.mode=ae;break}if(s.length=65535&u,u=0,ce=0,s.mode=F,t===A)break e;case F:s.mode=K;case K:if(pe=s.length){if(pe>l&&(pe=l),pe>d&&(pe=d),0===pe)break e;p.arraySet(r,n,o,pe,a),l-=pe,o+=pe,d-=pe,a+=pe,s.length-=pe;break}s.mode=V;break;case W:for(;ce<14;){if(0===l)break e;l--,u+=n[o++]<>>=5,ce-=5,s.ndist=1+(31&u),u>>>=5,ce-=5,s.ncode=4+(15&u),u>>>=4,ce-=4,s.nlen>286||s.ndist>30){e.msg="too many length or distance symbols",s.mode=ae;break}s.have=0,s.mode=Y;case Y:for(;s.have>>=3,ce-=3}for(;s.have<19;)s.lens[Ne[s.have++]]=0;if(s.lencode=s.lendyn,s.lenbits=7,Te={bits:s.lenbits},Ae=_(E,s.lens,0,19,s.lencode,0,s.work,Te),s.lenbits=Te.bits,Ae){e.msg="invalid code lengths set",s.mode=ae;break}s.have=0,s.mode=Z;case Z:for(;s.have>>24,_e=Se>>>16&255,Ee=65535&Se,!(ge<=ce);){if(0===l)break e;l--,u+=n[o++]<>>=ge,ce-=ge,s.lens[s.have++]=Ee;else{if(16===Ee){for(Ie=ge+2;ce>>=ge,ce-=ge,0===s.have){e.msg="invalid bit length repeat",s.mode=ae;break}ye=s.lens[s.have-1],pe=3+(3&u),u>>>=2,ce-=2}else if(17===Ee){for(Ie=ge+3;ce>>=ge)),u>>>=3,ce-=3}else{for(Ie=ge+7;ce>>=ge)),u>>>=7,ce-=7}if(s.have+pe>s.nlen+s.ndist){e.msg="invalid bit length repeat",s.mode=ae;break}for(;pe--;)s.lens[s.have++]=ye}}if(s.mode===ae)break;if(0===s.lens[256]){e.msg="invalid code -- missing end-of-block",s.mode=ae;break}if(s.lenbits=9,Te={bits:s.lenbits},Ae=_(v,s.lens,0,s.nlen,s.lencode,0,s.work,Te),s.lenbits=Te.bits,Ae){e.msg="invalid literal/lengths set",s.mode=ae;break}if(s.distbits=6,s.distcode=s.distdyn,Te={bits:s.distbits},Ae=_(b,s.lens,s.nlen,s.ndist,s.distcode,0,s.work,Te),s.distbits=Te.bits,Ae){e.msg="invalid distances set",s.mode=ae;break}if(s.mode=J,t===A)break e;case J:s.mode=X;case X:if(l>=6&&d>=258){e.next_out=a,e.avail_out=d,e.next_in=o,e.avail_in=l,s.hold=u,s.bits=ce,g(e,ue),a=e.next_out,r=e.output,d=e.avail_out,o=e.next_in,n=e.input,l=e.avail_in,u=s.hold,ce=s.bits,s.mode===V&&(s.back=-1);break}for(s.back=0;Se=s.lencode[u&(1<>>24,_e=Se>>>16&255,Ee=65535&Se,!(ge<=ce);){if(0===l)break e;l--,u+=n[o++]<>ve)],ge=Se>>>24,_e=Se>>>16&255,Ee=65535&Se,!(ve+ge<=ce);){if(0===l)break e;l--,u+=n[o++]<>>=ve,ce-=ve,s.back+=ve}if(u>>>=ge,ce-=ge,s.back+=ge,s.length=Ee,0===_e){s.mode=ie;break}if(32&_e){s.back=-1,s.mode=V;break}if(64&_e){e.msg="invalid literal/length code",s.mode=ae;break}s.extra=15&_e,s.mode=Q;case Q:if(s.extra){for(Ie=s.extra;ce>>=s.extra,ce-=s.extra,s.back+=s.extra}s.was=s.length,s.mode=ee;case ee:for(;Se=s.distcode[u&(1<>>24,_e=Se>>>16&255,Ee=65535&Se,!(ge<=ce);){if(0===l)break e;l--,u+=n[o++]<>ve)],ge=Se>>>24,_e=Se>>>16&255,Ee=65535&Se,!(ve+ge<=ce);){if(0===l)break e;l--,u+=n[o++]<>>=ve,ce-=ve,s.back+=ve}if(u>>>=ge,ce-=ge,s.back+=ge,64&_e){e.msg="invalid distance code",s.mode=ae;break}s.offset=Ee,s.extra=15&_e,s.mode=te;case te:if(s.extra){for(Ie=s.extra;ce>>=s.extra,ce-=s.extra,s.back+=s.extra}if(s.offset>s.dmax){e.msg="invalid distance too far back",s.mode=ae;break}s.mode=se;case se:if(0===d)break e;if(pe=ue-d,s.offset>pe){if((pe=s.offset-pe)>s.whave&&s.sane){e.msg="invalid distance too far back",s.mode=ae;break}pe>s.wnext?(pe-=s.wnext,fe=s.wsize-pe):fe=s.wnext-pe,pe>s.length&&(pe=s.length),me=s.window}else me=r,fe=a-s.offset,pe=s.length;pe>d&&(pe=d),d-=pe,s.length-=pe;do{r[a++]=me[fe++]}while(--pe);0===s.length&&(s.mode=X);break;case ie:if(0===d)break e;r[a++]=s.length,d--,s.mode=X;break;case ne:if(s.wrap){for(;ce<32;){if(0===l)break e;l--,u|=n[o++]<>>24,p>>>=b,f-=b,0===(b=v>>>16&255))S[r++]=65535&v;else{if(!(16&b)){if(0==(64&b)){v=m[(65535&v)+(p&(1<>>=b,f-=b),f<15&&(p+=I[i++]<>>24,p>>>=b,f-=b,!(16&(b=v>>>16&255))){if(0==(64&b)){v=g[(65535&v)+(p&(1<l){e.msg="invalid distance too far back",s.mode=30;break e}if(p>>>=b,f-=b,b=r-o,y>b){if((b=y-b)>c&&s.sane){e.msg="invalid distance too far back",s.mode=30;break e}if(A=0,T=u,0===d){if(A+=h-b,b2;)S[r++]=T[A++],S[r++]=T[A++],S[r++]=T[A++],w-=3;w&&(S[r++]=T[A++],w>1&&(S[r++]=T[A++]))}else{A=r-y;do{S[r++]=S[A++],S[r++]=S[A++],S[r++]=S[A++],w-=3}while(w>2);w&&(S[r++]=S[A++],w>1&&(S[r++]=S[A++]))}break}}break}}while(i>3,p&=(1<<(f-=w<<3))-1,e.next_in=i,e.next_out=r,e.avail_in=i=1&&0===x[S];S--);if(D>S&&(D=S),0===S)return h[c++]=20971520,h[c++]=20971520,u.bits=1,0;for(I=1;I0&&(0===e||1!==S))return-1;for(U[1]=0,A=1;A<15;A++)U[A+1]=U[A]+x[A];for(T=0;T852||2===e&&k>592)return 1;for(;;){v=A-R,d[T]E?(b=G[P+d[T]],w=O[L+d[T]]):(b=96,w=0),p=1<>R)+(f-=p)]=v<<24|b<<16|w|0}while(0!==f);for(p=1<>=1;if(0!==p?(M&=p-1,M+=p):M=0,T++,0==--x[A]){if(A===S)break;A=t[s+d[T]]}if(A>D&&(M&g)!==m){for(0===R&&(R=D),_+=I,C=1<<(N=A-R);N+R852||2===e&&k>592)return 1;h[m=M&g]=D<<24|N<<16|_-c|0}}return 0!==M&&(h[_+M]=A-R<<24|64<<16|0),u.bits=D,0}},function(e,t,s){"use strict";e.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},function(e,t,s){class ActionsManager{constructor(e){this.client=e,this.register(s(151)),this.register(s(152)),this.register(s(153)),this.register(s(154)),this.register(s(155)),this.register(s(156)),this.register(s(157)),this.register(s(158)),this.register(s(159)),this.register(s(160)),this.register(s(161)),this.register(s(162)),this.register(s(163)),this.register(s(164)),this.register(s(165)),this.register(s(166)),this.register(s(167)),this.register(s(168)),this.register(s(169)),this.register(s(170)),this.register(s(171)),this.register(s(172)),this.register(s(173)),this.register(s(174)),this.register(s(175)),this.register(s(176))}register(e){this[e.name.replace(/Action$/,"")]=new e(this.client)}}e.exports=ActionsManager},function(e,t,s){const i=s(2),{Events:n}=s(0);class MessageCreateAction extends i{handle(e){const t=this.client,s=t.channels.get(e.channel_id);if(s){const i=s.messages.get(e.id);if(i)return{message:i};const r=s.messages.create(e),o=r.author,a=s.guild?s.guild.member(o):null;return s.lastMessageID=e.id,s.lastMessage=r,o&&(o.lastMessageID=e.id,o.lastMessage=r),a&&(a.lastMessageID=e.id,a.lastMessage=r),t.emit(n.MESSAGE_CREATE,r),{message:r}}return{}}}e.exports=MessageCreateAction},function(e,t,s){const i=s(2),{Events:n}=s(0);class MessageDeleteAction extends i{handle(e){const t=this.client,s=t.channels.get(e.channel_id);let i;return s&&(i=s.messages.get(e.id))&&(s.messages.delete(i.id),t.emit(n.MESSAGE_DELETE,i)),{message:i}}}e.exports=MessageDeleteAction},function(e,t,s){const i=s(2),n=s(3),{Events:r}=s(0);class MessageDeleteBulkAction extends i{handle(e){const t=this.client,s=t.channels.get(e.channel_id);if(s){const i=e.ids,o=new n;for(const e of i){const t=s.messages.get(e);t&&(o.set(t.id,t),s.messages.delete(e))}return o.size>0&&t.emit(r.MESSAGE_BULK_DELETE,o),{messages:o}}return{}}}e.exports=MessageDeleteBulkAction},function(e,t,s){const i=s(2);class MessageUpdateAction extends i{handle(e){const t=this.client.channels.get(e.channel_id);if(t){const s=t.messages.get(e.id);if(s)return s.patch(e),{old:s._edits[0],updated:s}}return{}}}e.exports=MessageUpdateAction},function(e,t,s){const i=s(2);class MessageReactionAdd extends i{handle(e){const t=e.user||this.client.users.get(e.user_id);if(!t)return!1;const s=e.channel||this.client.channels.get(e.channel_id);if(!s||"voice"===s.type)return!1;const i=e.message||s.messages.get(e.message_id);if(!i)return!1;if(!e.emoji)return!1;const n=i.reactions.create({emoji:e.emoji,count:0,me:t.id===this.client.user.id});return n._add(t),{message:i,reaction:n,user:t}}}e.exports=MessageReactionAdd},function(e,t,s){const i=s(2),{Events:n}=s(0);class MessageReactionRemove extends i{handle(e){const t=this.client.users.get(e.user_id);if(!t)return!1;const s=this.client.channels.get(e.channel_id);if(!s||"voice"===s.type)return!1;const i=s.messages.get(e.message_id);if(!i)return!1;if(!e.emoji)return!1;const r=e.emoji.id||decodeURIComponent(e.emoji.name),o=i.reactions.get(r);return!!o&&(o._remove(t),this.client.emit(n.MESSAGE_REACTION_REMOVE,o,t),{message:i,reaction:o,user:t})}}e.exports=MessageReactionRemove},function(e,t,s){const i=s(2),{Events:n}=s(0);class MessageReactionRemoveAll extends i{handle(e){const t=this.client.channels.get(e.channel_id);if(!t||"voice"===t.type)return!1;const s=t.messages.get(e.message_id);return!!s&&(s.reactions.clear(),this.client.emit(n.MESSAGE_REACTION_REMOVE_ALL,s),{message:s})}}e.exports=MessageReactionRemoveAll},function(e,t,s){const i=s(2),{Events:n}=s(0);class ChannelCreateAction extends i{handle(e){const t=this.client,s=t.channels.has(e.id),i=t.channels.create(e);return!s&&i&&t.emit(n.CHANNEL_CREATE,i),{channel:i}}}e.exports=ChannelCreateAction},function(e,t,s){const i=s(2),{Events:n}=s(0);class ChannelDeleteAction extends i{constructor(e){super(e),this.deleted=new Map}handle(e){const t=this.client;let s=t.channels.get(e.id);return s&&(t.channels.remove(s.id),t.emit(n.CHANNEL_DELETE,s)),{channel:s}}}e.exports=ChannelDeleteAction},function(e,t,s){const i=s(2);class ChannelUpdateAction extends i{handle(e){const t=this.client.channels.get(e.id);return t?{old:t._update(e),updated:t}:{}}}e.exports=ChannelUpdateAction},function(e,t,s){const i=s(2),{Events:n}=s(0);class GuildDeleteAction extends i{constructor(e){super(e),this.deleted=new Map}handle(e){const t=this.client;let s=t.guilds.get(e.id);if(s){for(const e of s.channels.values())"text"===e.type&&e.stopTyping(!0);if(s.available&&e.unavailable)return s.available=!1,t.emit(n.GUILD_UNAVAILABLE,s),{guild:null};for(const e of s.channels.values())this.client.channels.remove(e.id);s.voiceConnection&&s.voiceConnection.disconnect(),t.guilds.remove(s.id),t.emit(n.GUILD_DELETE,s),this.deleted.set(s.id,s),this.scheduleForDeletion(s.id)}else s=this.deleted.get(e.id)||null;return{guild:s}}scheduleForDeletion(e){this.client.setTimeout(()=>this.deleted.delete(e),this.client.options.restWsBridgeTimeout)}}e.exports=GuildDeleteAction},function(e,t,s){const i=s(2),{Events:n}=s(0);class GuildUpdateAction extends i{handle(e){const t=this.client,s=t.guilds.get(e.id);if(s){const i=s._update(e);return t.emit(n.GUILD_UPDATE,i,s),{old:i,updated:s}}return{old:null,updated:null}}}e.exports=GuildUpdateAction},function(e,t,s){const i=s(2),{Events:n,Status:r}=s(0);class GuildMemberRemoveAction extends i{handle(e){const t=this.client,s=t.guilds.get(e.guild_id);let i=null;return s&&(i=s.members.get(e.user.id))&&(s.memberCount--,s.members.remove(i.id),t.status===r.READY&&t.emit(n.GUILD_MEMBER_REMOVE,i)),{guild:s,member:i}}}e.exports=GuildMemberRemoveAction},function(e,t,s){const i=s(2),{Events:n}=s(0);class GuildBanRemove extends i{handle(e){const t=this.client,s=t.guilds.get(e.guild_id),i=t.users.create(e.user);s&&i&&t.emit(n.GUILD_BAN_REMOVE,s,i)}}e.exports=GuildBanRemove},function(e,t,s){const i=s(2),{Events:n}=s(0);class GuildRoleCreate extends i{handle(e){const t=this.client,s=t.guilds.get(e.guild_id);let i;if(s){const r=s.roles.has(e.role.id);i=s.roles.create(e.role),r||t.emit(n.GUILD_ROLE_CREATE,i)}return{role:i}}}e.exports=GuildRoleCreate},function(e,t,s){const i=s(2),{Events:n}=s(0);class GuildRoleDeleteAction extends i{handle(e){const t=this.client,s=t.guilds.get(e.guild_id);let i;return s&&(i=s.roles.get(e.role_id))&&(s.roles.remove(e.role_id),t.emit(n.GUILD_ROLE_DELETE,i)),{role:i}}}e.exports=GuildRoleDeleteAction},function(e,t,s){const i=s(2),{Events:n}=s(0);class GuildRoleUpdateAction extends i{handle(e){const t=this.client,s=t.guilds.get(e.guild_id);if(s){let i=null;const r=s.roles.get(e.role.id);return r&&(i=r._update(e.role),t.emit(n.GUILD_ROLE_UPDATE,i,r)),{old:i,updated:r}}return{old:null,updated:null}}}e.exports=GuildRoleUpdateAction},function(e,t,s){const i=s(2),{Events:n}=s(0);class UserUpdateAction extends i{handle(e){const t=this.client;if(t.user){if(t.user.equals(e))return{old:t.user,updated:t.user};const s=t.user._update(e);return t.emit(n.USER_UPDATE,s,t.user),{old:s,updated:t.user}}return{old:null,updated:null}}}e.exports=UserUpdateAction},function(e,t,s){const i=s(2),{Events:n}=s(0);class UserNoteUpdateAction extends i{handle(e){const t=this.client,s=t.user.notes.get(e.id),i=e.note.length?e.note:null;return t.user.notes.set(e.id,i),t.emit(n.USER_NOTE_UPDATE,e.id,s,i),{old:s,updated:i}}}e.exports=UserNoteUpdateAction},function(e,t,s){const i=s(2);class GuildSync extends i{handle(e){const t=this.client.guilds.get(e.id);if(t){if(e.presences)for(const s of e.presences)t.presences.create(s);if(e.members)for(const s of e.members){const e=t.members.get(s.user.id);e?e._patch(s):t.members.create(s,!1)}"large"in e&&(t.large=e.large)}}}e.exports=GuildSync},function(e,t,s){const i=s(2),{Events:n}=s(0);class GuildEmojiCreateAction extends i{handle(e,t){const s=e.emojis.create(t);return this.client.emit(n.GUILD_EMOJI_CREATE,s),{emoji:s}}}e.exports=GuildEmojiCreateAction},function(e,t,s){const i=s(2),{Events:n}=s(0);class GuildEmojiDeleteAction extends i{handle(e){return e.guild.emojis.remove(e.id),this.client.emit(n.GUILD_EMOJI_DELETE,e),{emoji:e}}}e.exports=GuildEmojiDeleteAction},function(e,t,s){const i=s(2),{Events:n}=s(0);class GuildEmojiUpdateAction extends i{handle(e,t){const s=e._update(t);return this.client.emit(n.GUILD_EMOJI_UPDATE,s,e),{emoji:e}}}e.exports=GuildEmojiUpdateAction},function(e,t,s){function i(e){const t=new Map;for(const s of e)t.set(...s);return t}const n=s(2);class GuildEmojisUpdateAction extends n{handle(e){const t=this.client.guilds.get(e.guild_id);if(!t||!t.emojis)return;const s=i(t.emojis.entries());for(const i of e.emojis){const e=t.emojis.get(i.id);e?(s.delete(i.id),e.equals(i,!0)||this.client.actions.GuildEmojiUpdate.handle(e,i)):this.client.actions.GuildEmojiCreate.handle(t,i)}for(const e of s.values())this.client.actions.GuildEmojiDelete.handle(e)}}e.exports=GuildEmojisUpdateAction},function(e,t,s){const i=s(2);class GuildRolesPositionUpdate extends i{handle(e){const t=this.client.guilds.get(e.guild_id);if(t)for(const s of e.roles){const e=t.roles.get(s.id);e&&(e.rawPosition=s.position)}return{guild:t}}}e.exports=GuildRolesPositionUpdate},function(e,t,s){const i=s(2);class GuildChannelsPositionUpdate extends i{handle(e){const t=this.client.guilds.get(e.guild_id);if(t)for(const s of e.channels){const e=t.channels.get(s.id);e&&(e.rawPosition=s.position)}return{guild:t}}}e.exports=GuildChannelsPositionUpdate},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t,s){const i=s(15),n=s(30);class WebhookClient extends n{constructor(e,t,s){super(s),Object.defineProperty(this,"client",{value:this}),this.id=e,this.token=t}}i.applyToClass(WebhookClient),e.exports=WebhookClient}]); \ No newline at end of file