diff --git a/discord.master.js b/discord.master.js index e95de566..73263f77 100644 --- a/discord.master.js +++ b/discord.master.js @@ -63,14 +63,14 @@ /******/ __webpack_require__.p = ""; /******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = 145); +/******/ return __webpack_require__(__webpack_require__.s = 144); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ /***/ (function(module, exports, __webpack_require__) { -/* WEBPACK VAR INJECTION */(function(process) {exports.Package = __webpack_require__(29); +/* WEBPACK VAR INJECTION */(function(process) {exports.Package = __webpack_require__(28); /** * Options for a Client. @@ -125,7 +125,7 @@ exports.DefaultOptions = { */ ws: { large_threshold: 250, - compress: __webpack_require__(15).platform() !== 'browser', + compress: __webpack_require__(16).platform() !== 'browser', properties: { $os: process ? process.platform : 'discord.js', $browser: 'discord.js', @@ -514,7 +514,7 @@ exports.Colors = { NOT_QUITE_BLACK: 0x23272A, }; -/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(18))) +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(20))) /***/ }), /* 1 */ @@ -958,7 +958,7 @@ module.exports = Collection; /* 4 */ /***/ (function(module, exports, __webpack_require__) { -/* WEBPACK VAR INJECTION */(function(Buffer) {const superagent = __webpack_require__(26); +/* WEBPACK VAR INJECTION */(function(Buffer) {const snekfetch = __webpack_require__(26); const Constants = __webpack_require__(0); /** @@ -1014,7 +1014,7 @@ class Util { static fetchRecommendedShards(token, guildsPerShard = 1000) { return new Promise((resolve, reject) => { if (!token) throw new Error('A token must be provided.'); - superagent.get(Constants.Endpoints.gateway.bot) + snekfetch.get(Constants.Endpoints.gateway.bot) .set('Authorization', `Bot ${token.replace(/^Bot\s*/i, '')}`) .end((err, res) => { if (err) reject(err); @@ -1172,13 +1172,13 @@ class Util { module.exports = Util; -/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(22).Buffer)) +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(14).Buffer)) /***/ }), /* 5 */ /***/ (function(module, exports, __webpack_require__) { -const Long = __webpack_require__(24); +const Long = __webpack_require__(25); // Discord epoch (2015-01-01T00:00:00.000Z) const EPOCH = 1420070400000; @@ -1685,9 +1685,9 @@ module.exports = Channel; /* 9 */ /***/ (function(module, exports, __webpack_require__) { -const Attachment = __webpack_require__(33); -const Embed = __webpack_require__(35); -const MessageReaction = __webpack_require__(36); +const Attachment = __webpack_require__(32); +const Embed = __webpack_require__(34); +const MessageReaction = __webpack_require__(35); const Util = __webpack_require__(4); const Collection = __webpack_require__(3); const Constants = __webpack_require__(0); @@ -2589,7 +2589,7 @@ module.exports = Role; /* 11 */ /***/ (function(module, exports, __webpack_require__) { -const TextBasedChannel = __webpack_require__(14); +const TextBasedChannel = __webpack_require__(15); const Constants = __webpack_require__(0); const Presence = __webpack_require__(7).Presence; const Snowflake = __webpack_require__(5); @@ -3054,7 +3054,7 @@ module.exports = Emoji; /* 13 */ /***/ (function(module, exports, __webpack_require__) { -const TextBasedChannel = __webpack_require__(14); +const TextBasedChannel = __webpack_require__(15); const Role = __webpack_require__(10); const Permissions = __webpack_require__(6); const Collection = __webpack_require__(3); @@ -3574,2521 +3574,6 @@ module.exports = GuildMember; /* 14 */ /***/ (function(module, exports, __webpack_require__) { -const path = __webpack_require__(25); -const Message = __webpack_require__(9); -const MessageCollector = __webpack_require__(34); -const Collection = __webpack_require__(3); - -/** - * Interface for classes that have text-channel-like features - * @interface - */ -class TextBasedChannel { - constructor() { - /** - * A collection containing the messages sent to this channel. - * @type {Collection} - */ - this.messages = new Collection(); - - /** - * The ID of the last message in the channel, if one was sent. - * @type {?Snowflake} - */ - this.lastMessageID = null; - - /** - * The Message object of the last message in the channel, if one was sent. - * @type {?Message} - */ - this.lastMessage = null; - } - - /** - * Options provided when sending or editing a message - * @typedef {Object} MessageOptions - * @property {boolean} [tts=false] Whether or not the message should be spoken aloud - * @property {string} [nonce=''] The nonce for the message - * @property {RichEmbed|Object} [embed] An embed for the message - * (see [here](https://discordapp.com/developers/docs/resources/channel#embed-object) for more details) - * @property {boolean} [disableEveryone=this.client.options.disableEveryone] Whether or not @everyone and @here - * should be replaced with plain-text - * @property {FileOptions|string} [file] A file to send with the message **(deprecated)** - * @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. - * @property {UserResolvable} [reply] User to reply to (prefixes the message with a mention, except in DMs) - */ - - /** - * @typedef {Object} FileOptions - * @property {BufferResolvable} attachment File to attach - * @property {string} [name='file.jpg'] Filename of the attachment - */ - - /** - * Options for splitting a message - * @typedef {Object} SplitOptions - * @property {number} [maxLength=1950] Maximum character length per message piece - * @property {string} [char='\n'] Character to split the message with - * @property {string} [prepend=''] Text to prepend to every piece except the first - * @property {string} [append=''] Text to append to every piece except the last - */ - - /** - * Send a message to this channel - * @param {StringResolvable} [content] Text for the message - * @param {MessageOptions} [options={}] Options for the message - * @returns {Promise} - * @example - * // send a message - * channel.send('hello!') - * .then(message => console.log(`Sent message: ${message.content}`)) - * .catch(console.error); - */ - send(content, options) { - if (!options && typeof content === 'object' && !(content instanceof Array)) { - options = content; - content = ''; - } else if (!options) { - options = {}; - } - - if (options.embed && options.embed.file) options.file = options.embed.file; - - if (options.file) { - if (options.files) options.files.push(options.file); - else options.files = [options.file]; - } - - if (options.files) { - for (const i in options.files) { - let file = options.files[i]; - if (typeof file === 'string') file = { attachment: file }; - if (!file.name) { - if (typeof file.attachment === 'string') { - file.name = path.basename(file.attachment); - } else if (file.attachment && file.attachment.path) { - file.name = path.basename(file.attachment.path); - } else { - file.name = 'file.jpg'; - } - } - options.files[i] = file; - } - - return Promise.all(options.files.map(file => - this.client.resolver.resolveBuffer(file.attachment).then(buffer => { - file.file = buffer; - return file; - }) - )).then(files => this.client.rest.methods.sendMessage(this, content, options, files)); - } - - return this.client.rest.methods.sendMessage(this, content, options); - } - - /** - * Send a message to this channel - * @param {StringResolvable} [content] Text for the message - * @param {MessageOptions} [options={}] Options for the message - * @returns {Promise} - * @example - * // send a message - * channel.sendMessage('hello!') - * .then(message => console.log(`Sent message: ${message.content}`)) - * .catch(console.error); - */ - sendMessage(content, options) { - return this.send(content, options); - } - - /** - * Send an embed to this channel - * @param {RichEmbed|Object} embed Embed for the message - * @param {string} [content] Text for the message - * @param {MessageOptions} [options] Options for the message - * @returns {Promise} - */ - sendEmbed(embed, content, options) { - if (!options && typeof content === 'object' && !(content instanceof Array)) { - options = content; - content = ''; - } else if (!options) { - options = {}; - } - return this.send(content, Object.assign(options, { embed })); - } - - /** - * Send files to this channel - * @param {FileOptions[]|string[]} files Files to send with the message - * @param {StringResolvable} [content] Text for the message - * @param {MessageOptions} [options] Options for the message - * @returns {Promise} - */ - sendFiles(files, content, options = {}) { - return this.send(content, Object.assign(options, { files })); - } - - /** - * Send a file to this channel - * @param {BufferResolvable} attachment File to send - * @param {string} [name='file.jpg'] Name and extension of the file - * @param {StringResolvable} [content] Text for the message - * @param {MessageOptions} [options] Options for the message - * @returns {Promise} - */ - sendFile(attachment, name, content, options = {}) { - return this.sendFiles([{ attachment, name }], content, options); - } - - /** - * Send a code block to this channel - * @param {string} lang Language for the code block - * @param {StringResolvable} content Content of the code block - * @param {MessageOptions} [options] Options for the message - * @returns {Promise} - */ - sendCode(lang, content, options = {}) { - return this.send(content, Object.assign(options, { code: lang })); - } - - /** - * Gets a single message from this channel, regardless of it being cached or not. Since the single message fetching - * endpoint is reserved for bot accounts, this abstracts the `fetchMessages` method to obtain the single message when - * using a user account. - * @param {Snowflake} messageID ID of the message to get - * @returns {Promise} - * @example - * // get message - * channel.fetchMessage('99539446449315840') - * .then(message => console.log(message.content)) - * .catch(console.error); - */ - fetchMessage(messageID) { - if (!this.client.user.bot) { - return this.fetchMessages({ limit: 1, around: messageID }).then(messages => { - const msg = messages.first(); - if (msg.id !== messageID) throw new Error('Message not found.'); - return msg; - }); - } - return this.client.rest.methods.getChannelMessage(this, messageID).then(data => { - const msg = data instanceof Message ? data : new Message(this, data, this.client); - this._cacheMessage(msg); - return msg; - }); - } - - /** - * The parameters to pass in when requesting previous messages from a channel. `around`, `before` and - * `after` are mutually exclusive. All the parameters are optional. - * @typedef {Object} ChannelLogsQueryOptions - * @property {number} [limit=50] Number of messages to acquire - * @property {Snowflake} [before] ID of a message to get the messages that were posted before it - * @property {Snowflake} [after] ID of a message to get the messages that were posted after it - * @property {Snowflake} [around] ID of a message to get the messages that were posted around it - */ - - /** - * Gets the past messages sent in this channel. Resolves with a collection mapping message ID's to Message objects. - * @param {ChannelLogsQueryOptions} [options={}] Query parameters to pass in - * @returns {Promise>} - * @example - * // get messages - * channel.fetchMessages({limit: 10}) - * .then(messages => console.log(`Received ${messages.size} messages`)) - * .catch(console.error); - */ - fetchMessages(options = {}) { - return this.client.rest.methods.getChannelMessages(this, options).then(data => { - const messages = new Collection(); - for (const message of data) { - const msg = new Message(this, message, this.client); - messages.set(message.id, msg); - this._cacheMessage(msg); - } - return messages; - }); - } - - /** - * Fetches the pinned messages of this channel and returns a collection of them. - * @returns {Promise>} - */ - fetchPinnedMessages() { - return this.client.rest.methods.getChannelPinnedMessages(this).then(data => { - const messages = new Collection(); - for (const message of data) { - const msg = new Message(this, message, this.client); - messages.set(message.id, msg); - this._cacheMessage(msg); - } - return messages; - }); - } - - /** - * @typedef {Object} MessageSearchOptions - * @property {string} [content] Message content - * @property {Snowflake} [maxID] Maximum ID for the filter - * @property {Snowflake} [minID] Minimum ID for the filter - * @property {string} [has] One of `link`, `embed`, `file`, `video`, `image`, or `sound`, - * or add `-` to negate (e.g. `-file`) - * @property {ChannelResolvable} [channel] Channel to limit search to (only for guild search endpoint) - * @property {UserResolvable} [author] Author to limit search - * @property {string} [authorType] One of `user`, `bot`, `webhook`, or add `-` to negate (e.g. `-webhook`) - * @property {string} [sortBy='recent'] `recent` or `relevant` - * @property {string} [sortOrder='desc'] `asc` or `desc` - * @property {number} [contextSize=2] How many messages to get around the matched message (0 to 2) - * @property {number} [limit=25] Maximum number of results to get (1 to 25) - * @property {number} [offset=0] Offset the "pages" of results (since you can only see 25 at a time) - * @property {UserResolvable} [mentions] Mentioned user filter - * @property {boolean} [mentionsEveryone] If everyone is mentioned - * @property {string} [linkHostname] Filter links by hostname - * @property {string} [embedProvider] The name of an embed provider - * @property {string} [embedType] one of `image`, `video`, `url`, `rich` - * @property {string} [attachmentFilename] The name of an attachment - * @property {string} [attachmentExtension] The extension of an attachment - * @property {Date} [before] Date to find messages before - * @property {Date} [after] Date to find messages before - * @property {Date} [during] Date to find messages during (range of date to date + 24 hours) - */ - - /** - * Performs a search within the channel. - * @param {MessageSearchOptions} [options={}] Options to pass to the search - * @returns {Promise>} - * An array containing arrays of messages. Each inner array is a search context cluster. - * The message which has triggered the result will have the `hit` property set to `true`. - * @example - * channel.search({ - * content: 'discord.js', - * before: '2016-11-17' - * }).then(res => { - * const hit = res.messages[0].find(m => m.hit).content; - * console.log(`I found: **${hit}**, total results: ${res.totalResults}`); - * }).catch(console.error); - */ - search(options) { - return this.client.rest.methods.search(this, options); - } - - /** - * Starts a typing indicator in the channel. - * @param {number} [count] The number of times startTyping should be considered to have been called - * @example - * // start typing in a channel - * channel.startTyping(); - */ - startTyping(count) { - if (typeof count !== 'undefined' && count < 1) throw new RangeError('Count must be at least 1.'); - if (!this.client.user._typing.has(this.id)) { - this.client.user._typing.set(this.id, { - count: count || 1, - interval: this.client.setInterval(() => { - this.client.rest.methods.sendTyping(this.id); - }, 9000), - }); - this.client.rest.methods.sendTyping(this.id); - } else { - const entry = this.client.user._typing.get(this.id); - entry.count = count || entry.count + 1; - } - } - - /** - * Stops the typing indicator in the channel. - * The indicator will only stop if this is called as many times as startTyping(). - * It can take a few seconds for the client user to stop typing. - * @param {boolean} [force=false] Whether or not to reset the call count and force the indicator to stop - * @example - * // stop typing in a channel - * channel.stopTyping(); - * @example - * // force typing to fully stop in a channel - * channel.stopTyping(true); - */ - stopTyping(force = false) { - if (this.client.user._typing.has(this.id)) { - const entry = this.client.user._typing.get(this.id); - entry.count--; - if (entry.count <= 0 || force) { - this.client.clearInterval(entry.interval); - this.client.user._typing.delete(this.id); - } - } - } - - /** - * Whether or not the typing indicator is being shown in the channel. - * @type {boolean} - * @readonly - */ - get typing() { - return this.client.user._typing.has(this.id); - } - - /** - * Number of times `startTyping` has been called. - * @type {number} - * @readonly - */ - get typingCount() { - if (this.client.user._typing.has(this.id)) return this.client.user._typing.get(this.id).count; - return 0; - } - - /** - * Creates a Message Collector - * @param {CollectorFilterFunction} filter The filter to create the collector with - * @param {CollectorOptions} [options={}] The options to pass to the collector - * @returns {MessageCollector} - * @example - * // create a message collector - * const collector = channel.createCollector( - * m => m.content.includes('discord'), - * { time: 15000 } - * ); - * collector.on('message', m => console.log(`Collected ${m.content}`)); - * collector.on('end', collected => console.log(`Collected ${collected.size} items`)); - */ - createCollector(filter, options = {}) { - return new MessageCollector(this, filter, options); - } - - /** - * An object containing the same properties as CollectorOptions, but a few more: - * @typedef {CollectorOptions} AwaitMessagesOptions - * @property {string[]} [errors] Stop/end reasons that cause the promise to reject - */ - - /** - * Similar to createCollector but in promise form. Resolves with a collection of messages that pass the specified - * filter. - * @param {CollectorFilterFunction} filter The filter function to use - * @param {AwaitMessagesOptions} [options={}] Optional options to pass to the internal collector - * @returns {Promise>} - * @example - * // await !vote messages - * const filter = m => m.content.startsWith('!vote'); - * // errors: ['time'] treats ending because of the time limit as an error - * channel.awaitMessages(filter, { max: 4, time: 60000, errors: ['time'] }) - * .then(collected => console.log(collected.size)) - * .catch(collected => console.log(`After a minute, only ${collected.size} out of 4 voted.`)); - */ - awaitMessages(filter, options = {}) { - return new Promise((resolve, reject) => { - const collector = this.createCollector(filter, options); - collector.on('end', (collection, reason) => { - if (options.errors && options.errors.includes(reason)) { - reject(collection); - } else { - resolve(collection); - } - }); - }); - } - - /** - * Bulk delete given messages that are newer than two weeks - * This is only available when using a bot account. - * @param {Collection|Message[]|number} messages Messages or number of messages to delete - * @param {boolean} [filterOld=false] Filter messages to remove those which are older than two weeks automatically - * @returns {Promise>} Deleted messages - */ - bulkDelete(messages, filterOld = false) { - if (!isNaN(messages)) return this.fetchMessages({ limit: messages }).then(msgs => this.bulkDelete(msgs, filterOld)); - if (messages instanceof Array || messages instanceof Collection) { - const messageIDs = messages instanceof Collection ? messages.keyArray() : messages.map(m => m.id); - return this.client.rest.methods.bulkDeleteMessages(this, messageIDs, filterOld); - } - throw new TypeError('The messages must be an Array, Collection, or number.'); - } - - /** - * Marks all messages in this channel as read - * This is only available when using a user account. - * @returns {Promise} - */ - acknowledge() { - return this.client.rest.methods.ackTextMessage(this); - } - - _cacheMessage(message) { - const maxSize = this.client.options.messageCacheMaxSize; - if (maxSize === 0) return null; - if (this.messages.size >= maxSize && maxSize > 0) this.messages.delete(this.messages.firstKey()); - this.messages.set(message.id, message); - return message; - } -} - -exports.applyToClass = (structure, full = false, ignore = []) => { - const props = ['send', 'sendMessage', 'sendEmbed', 'sendFile', 'sendFiles', 'sendCode']; - if (full) { - props.push( - '_cacheMessage', - 'fetchMessages', - 'fetchMessage', - 'search', - 'bulkDelete', - 'startTyping', - 'stopTyping', - 'typing', - 'typingCount', - 'fetchPinnedMessages', - 'createCollector', - 'awaitMessages' - ); - } - for (const prop of props) { - if (ignore.includes(prop)) continue; - Object.defineProperty(structure.prototype, prop, Object.getOwnPropertyDescriptor(TextBasedChannel.prototype, prop)); - } -}; - - -/***/ }), -/* 15 */ -/***/ (function(module, exports) { - -exports.endianness = function () { return 'LE' }; - -exports.hostname = function () { - if (typeof location !== 'undefined') { - return location.hostname - } - else return ''; -}; - -exports.loadavg = function () { return [] }; - -exports.uptime = function () { return 0 }; - -exports.freemem = function () { - return Number.MAX_VALUE; -}; - -exports.totalmem = function () { - return Number.MAX_VALUE; -}; - -exports.cpus = function () { return [] }; - -exports.type = function () { return 'Browser' }; - -exports.release = function () { - if (typeof navigator !== 'undefined') { - return navigator.appVersion; - } - return ''; -}; - -exports.networkInterfaces -= exports.getNetworkInterfaces -= function () { return {} }; - -exports.arch = function () { return 'javascript' }; - -exports.platform = function () { return 'browser' }; - -exports.tmpdir = exports.tmpDir = function () { - return '/tmp'; -}; - -exports.EOL = '\n'; - - -/***/ }), -/* 16 */ -/***/ (function(module, exports, __webpack_require__) { - -const Long = __webpack_require__(24); -const User = __webpack_require__(11); -const Role = __webpack_require__(10); -const Emoji = __webpack_require__(12); -const Presence = __webpack_require__(7).Presence; -const GuildMember = __webpack_require__(13); -const Constants = __webpack_require__(0); -const Collection = __webpack_require__(3); -const Util = __webpack_require__(4); -const Snowflake = __webpack_require__(5); - -/** - * Represents a guild (or a server) on Discord. - * It's recommended to see if a guild is available before performing operations or reading data from it. You can - * check this with `guild.available`. - */ -class Guild { - constructor(client, data) { - /** - * The Client that created the instance of the the Guild. - * @name Guild#client - * @type {Client} - * @readonly - */ - Object.defineProperty(this, 'client', { value: client }); - - /** - * A collection of members that are in this guild. The key is the member's ID, the value is the member. - * @type {Collection} - */ - this.members = new Collection(); - - /** - * A collection of channels that are in this guild. The key is the channel's ID, the value is the channel. - * @type {Collection} - */ - this.channels = new Collection(); - - /** - * A collection of roles that are in this guild. The key is the role's ID, the value is the role. - * @type {Collection} - */ - this.roles = new Collection(); - - /** - * A collection of presences in this guild - * @type {Collection} - */ - this.presences = new Collection(); - - if (!data) return; - if (data.unavailable) { - /** - * Whether the guild is available to access. If it is not available, it indicates a server outage. - * @type {boolean} - */ - this.available = false; - - /** - * The Unique ID of the Guild, useful for comparisons. - * @type {Snowflake} - */ - this.id = data.id; - } else { - this.available = true; - this.setup(data); - } - } - - /** - * Sets up the Guild - * @param {*} data The raw data of the guild - * @private - */ - setup(data) { - /** - * The name of the guild - * @type {string} - */ - this.name = data.name; - - /** - * The hash of the guild icon, or null if there is no icon. - * @type {?string} - */ - this.icon = data.icon; - - /** - * The hash of the guild splash image, or null if no splash (VIP only) - * @type {?string} - */ - this.splash = data.splash; - - /** - * The region the guild is located in - * @type {string} - */ - this.region = data.region; - - /** - * The full amount of members in this guild as of `READY` - * @type {number} - */ - this.memberCount = data.member_count || this.memberCount; - - /** - * Whether the guild is "large" (has more than 250 members) - * @type {boolean} - */ - this.large = Boolean('large' in data ? data.large : this.large); - - /** - * An array of guild features. - * @type {Object[]} - */ - this.features = data.features; - - /** - * The ID of the application that created this guild (if applicable) - * @type {?Snowflake} - */ - this.applicationID = data.application_id; - - /** - * A collection of emojis that are in this guild. The key is the emoji's ID, the value is the emoji. - * @type {Collection} - */ - this.emojis = new Collection(); - for (const emoji of data.emojis) this.emojis.set(emoji.id, new Emoji(this, emoji)); - - /** - * The time in seconds before a user is counted as "away from keyboard". - * @type {?number} - */ - this.afkTimeout = data.afk_timeout; - - /** - * The ID of the voice channel where AFK members are moved. - * @type {?string} - */ - this.afkChannelID = data.afk_channel_id; - - /** - * Whether embedded images are enabled on this guild. - * @type {boolean} - */ - this.embedEnabled = data.embed_enabled; - - /** - * The verification level of the guild. - * @type {number} - */ - this.verificationLevel = data.verification_level; - - /** - * The timestamp the client user joined the guild at - * @type {number} - */ - this.joinedTimestamp = data.joined_at ? new Date(data.joined_at).getTime() : this.joinedTimestamp; - - this.id = data.id; - this.available = !data.unavailable; - this.features = data.features || this.features || []; - - if (data.members) { - this.members.clear(); - for (const guildUser of data.members) this._addMember(guildUser, false); - } - - if (data.owner_id) { - /** - * The user ID of this guild's owner. - * @type {Snowflake} - */ - this.ownerID = data.owner_id; - } - - if (data.channels) { - this.channels.clear(); - for (const channel of data.channels) this.client.dataManager.newChannel(channel, this); - } - - if (data.roles) { - this.roles.clear(); - for (const role of data.roles) { - const newRole = new Role(this, role); - this.roles.set(newRole.id, newRole); - } - } - - if (data.presences) { - for (const presence of data.presences) { - this._setPresence(presence.user.id, presence); - } - } - - this._rawVoiceStates = new Collection(); - if (data.voice_states) { - for (const voiceState of data.voice_states) { - this._rawVoiceStates.set(voiceState.user_id, voiceState); - const member = this.members.get(voiceState.user_id); - if (member) { - member.serverMute = voiceState.mute; - member.serverDeaf = voiceState.deaf; - member.selfMute = voiceState.self_mute; - member.selfDeaf = voiceState.self_deaf; - member.voiceSessionID = voiceState.session_id; - member.voiceChannelID = voiceState.channel_id; - this.channels.get(voiceState.channel_id).members.set(member.user.id, member); - } - } - } - } - - /** - * The timestamp the guild was created at - * @type {number} - * @readonly - */ - get createdTimestamp() { - return Snowflake.deconstruct(this.id).timestamp; - } - - /** - * The time the guild was created - * @type {Date} - * @readonly - */ - get createdAt() { - return new Date(this.createdTimestamp); - } - - /** - * The time the client user joined the guild - * @type {Date} - * @readonly - */ - get joinedAt() { - return new Date(this.joinedTimestamp); - } - - /** - * Gets the URL to this guild's icon (if it has one, otherwise it returns null) - * @type {?string} - * @readonly - */ - get iconURL() { - if (!this.icon) return null; - return Constants.Endpoints.Guild(this).Icon(this.client.options.http.cdn, this.icon); - } - - /** - * Gets the URL to this guild's splash (if it has one, otherwise it returns null) - * @type {?string} - * @readonly - */ - get splashURL() { - if (!this.splash) return null; - return Constants.Endpoints.Guild(this).Splash(this.client.options.http.cdn, this.splash); - } - - /** - * The owner of the guild - * @type {GuildMember} - * @readonly - */ - get owner() { - return this.members.get(this.ownerID); - } - - /** - * If the client is connected to any voice channel in this guild, this will be the relevant VoiceConnection. - * @type {?VoiceConnection} - * @readonly - */ - get voiceConnection() { - if (this.client.browser) return null; - return this.client.voice.connections.get(this.id) || null; - } - - /** - * The `#general` TextChannel of the guild. - * @type {TextChannel} - * @readonly - */ - get defaultChannel() { - return this.channels.get(this.id); - } - - /** - * The `@everyone` Role of the guild. - * @type {Role} - * @readonly - */ - get defaultRole() { - return this.roles.get(this.id); - } - - /** - * Fetches a collection of roles in the current guild sorted by position. - * @type {Collection} - * @readonly - */ - get _sortedRoles() { - return this._sortPositionWithID(this.roles); - } - - /** - * Returns the GuildMember form of a User object, if the user is present in the guild. - * @param {UserResolvable} user The user that you want to obtain the GuildMember of - * @returns {?GuildMember} - * @example - * // get the guild member of a user - * const member = guild.member(message.author); - */ - member(user) { - return this.client.resolver.resolveGuildMember(this, user); - } - - /** - * Fetch a collection of banned users in this guild. - * @returns {Promise>} - */ - fetchBans() { - return this.client.rest.methods.getGuildBans(this); - } - - /** - * Fetch a collection of invites to this guild. Resolves with a collection mapping invites by their codes. - * @returns {Promise>} - */ - fetchInvites() { - return this.client.rest.methods.getGuildInvites(this); - } - - /** - * Fetch all webhooks for the guild. - * @returns {Collection} - */ - fetchWebhooks() { - return this.client.rest.methods.getGuildWebhooks(this); - } - - /** - * Fetch available voice regions - * @returns {Collection} - */ - fetchVoiceRegions() { - return this.client.rest.methods.fetchVoiceRegions(this.id); - } - - /** - * Adds a user to the guild using OAuth2. Requires the `CREATE_INSTANT_INVITE` permission. - * @param {UserResolvable} user User to add to the guild - * @param {Object} options Options for the addition - * @param {string} options.accessToken An OAuth2 access token for the user with the `guilds.join` scope granted to the - * bot's application - * @param {string} [options.nick] Nickname to give the member (requires `MANAGE_NICKNAMES`) - * @param {Collection|Role[]|Snowflake[]} [options.roles] Roles to add to the member - * (requires `MANAGE_ROLES`) - * @param {boolean} [options.mute] Whether the member should be muted (requires `MUTE_MEMBERS`) - * @param {boolean} [options.deaf] Whether the member should be deafened (requires `DEAFEN_MEMBERS`) - * @returns {Promise} - */ - addMember(user, options) { - if (this.members.has(user.id)) return Promise.resolve(this.members.get(user.id)); - return this.client.rest.methods.putGuildMember(this, user, options); - } - - /** - * Fetch a single guild member from a user. - * @param {UserResolvable} user The user to fetch the member for - * @param {boolean} [cache=true] Insert the user into the users cache - * @returns {Promise} - */ - fetchMember(user, cache = true) { - user = this.client.resolver.resolveUser(user); - if (!user) return Promise.reject(new Error('User is not cached. Use Client.fetchUser first.')); - if (this.members.has(user.id)) return Promise.resolve(this.members.get(user.id)); - return this.client.rest.methods.getGuildMember(this, user, cache); - } - - /** - * Fetches all the members in the guild, even if they are offline. If the guild has less than 250 members, - * this should not be necessary. - * @param {string} [query=''] Limit fetch to members with similar usernames - * @param {number} [limit=0] Maximum number of members to request - * @returns {Promise} - */ - fetchMembers(query = '', limit = 0) { - return new Promise((resolve, reject) => { - if (this.memberCount === this.members.size) { - // Uncomment in v12 - // resolve(this.members) - resolve(this); - return; - } - this.client.ws.send({ - op: Constants.OPCodes.REQUEST_GUILD_MEMBERS, - d: { - guild_id: this.id, - query, - limit, - }, - }); - const handler = (members, guild) => { - if (guild.id !== this.id) return; - if (this.memberCount === this.members.size || members.length < 1000) { - this.client.removeListener(Constants.Events.GUILD_MEMBERS_CHUNK, handler); - // Uncomment in v12 - // resolve(this.members) - resolve(this); - } - }; - this.client.on(Constants.Events.GUILD_MEMBERS_CHUNK, handler); - this.client.setTimeout(() => reject(new Error('Members didn\'t arrive in time.')), 120 * 1000); - }); - } - - /** - * Performs a search within the entire guild. - * @param {MessageSearchOptions} [options={}] Options to pass to the search - * @returns {Promise>} - * An array containing arrays of messages. Each inner array is a search context cluster. - * The message which has triggered the result will have the `hit` property set to `true`. - * @example - * guild.search({ - * content: 'discord.js', - * before: '2016-11-17' - * }).then(res => { - * const hit = res.messages[0].find(m => m.hit).content; - * console.log(`I found: **${hit}**, total results: ${res.totalResults}`); - * }).catch(console.error); - */ - search(options) { - return this.client.rest.methods.search(this, options); - } - - /** - * The data for editing a guild - * @typedef {Object} GuildEditData - * @property {string} [name] The name of the guild - * @property {string} [region] The region of the guild - * @property {number} [verificationLevel] The verification level of the guild - * @property {ChannelResolvable} [afkChannel] The AFK channel of the guild - * @property {number} [afkTimeout] The AFK timeout of the guild - * @property {Base64Resolvable} [icon] The icon of the guild - * @property {GuildMemberResolvable} [owner] The owner of the guild - * @property {Base64Resolvable} [splash] The splash screen of the guild - */ - - /** - * Updates the Guild with new information - e.g. a new name. - * @param {GuildEditData} data The data to update the guild with - * @returns {Promise} - * @example - * // set the guild name and region - * guild.edit({ - * name: 'Discord Guild', - * region: 'london', - * }) - * .then(updated => console.log(`New guild name ${updated.name} in region ${updated.region}`)) - * .catch(console.error); - */ - edit(data) { - return this.client.rest.methods.updateGuild(this, data); - } - - /** - * Edit the name of the guild. - * @param {string} name The new name of the guild - * @returns {Promise} - * @example - * // edit the guild name - * guild.setName('Discord Guild') - * .then(updated => console.log(`Updated guild name to ${guild.name}`)) - * .catch(console.error); - */ - setName(name) { - return this.edit({ name }); - } - - /** - * Edit the region of the guild. - * @param {string} region The new region of the guild. - * @returns {Promise} - * @example - * // edit the guild region - * guild.setRegion('london') - * .then(updated => console.log(`Updated guild region to ${guild.region}`)) - * .catch(console.error); - */ - setRegion(region) { - return this.edit({ region }); - } - - /** - * Edit the verification level of the guild. - * @param {number} verificationLevel The new verification level of the guild - * @returns {Promise} - * @example - * // edit the guild verification level - * guild.setVerificationLevel(1) - * .then(updated => console.log(`Updated guild verification level to ${guild.verificationLevel}`)) - * .catch(console.error); - */ - setVerificationLevel(verificationLevel) { - return this.edit({ verificationLevel }); - } - - /** - * Edit the AFK channel of the guild. - * @param {ChannelResolvable} afkChannel The new AFK channel - * @returns {Promise} - * @example - * // edit the guild AFK channel - * guild.setAFKChannel(channel) - * .then(updated => console.log(`Updated guild AFK channel to ${guild.afkChannel}`)) - * .catch(console.error); - */ - setAFKChannel(afkChannel) { - return this.edit({ afkChannel }); - } - - /** - * Edit the AFK timeout of the guild. - * @param {number} afkTimeout The time in seconds that a user must be idle to be considered AFK - * @returns {Promise} - * @example - * // edit the guild AFK channel - * guild.setAFKTimeout(60) - * .then(updated => console.log(`Updated guild AFK timeout to ${guild.afkTimeout}`)) - * .catch(console.error); - */ - setAFKTimeout(afkTimeout) { - return this.edit({ afkTimeout }); - } - - /** - * Set a new guild icon. - * @param {Base64Resolvable} icon The new icon of the guild - * @returns {Promise} - * @example - * // edit the guild icon - * guild.setIcon(fs.readFileSync('./icon.png')) - * .then(updated => console.log('Updated the guild icon')) - * .catch(console.error); - */ - setIcon(icon) { - return this.edit({ icon }); - } - - /** - * Sets a new owner of the guild. - * @param {GuildMemberResolvable} owner The new owner of the guild - * @returns {Promise} - * @example - * // edit the guild owner - * guild.setOwner(guilds.members[0]) - * .then(updated => console.log(`Updated the guild owner to ${updated.owner.username}`)) - * .catch(console.error); - */ - setOwner(owner) { - return this.edit({ owner }); - } - - /** - * Set a new guild splash screen. - * @param {Base64Resolvable} splash The new splash screen of the guild - * @returns {Promise} - * @example - * // edit the guild splash - * guild.setIcon(fs.readFileSync('./splash.png')) - * .then(updated => console.log('Updated the guild splash')) - * .catch(console.error); - */ - setSplash(splash) { - return this.edit({ splash }); - } - - /** - * Bans a user from the guild. - * @param {UserResolvable} user The user to ban - * @param {number} [deleteDays=0] The amount of days worth of messages from this user that should - * also be deleted. Between `0` and `7`. - * @returns {Promise} Result object will be resolved as specifically as possible. - * If the GuildMember cannot be resolved, the User will instead be attempted to be resolved. If that also cannot - * be resolved, the user ID will be the result. - * @example - * // ban a user by ID (or with a user/guild member object) - * guild.ban('some user ID') - * .then(user => console.log(`Banned ${user.username || user.id || user} from ${guild.name}`)) - * .catch(console.error); - */ - ban(user, deleteDays = 0) { - return this.client.rest.methods.banGuildMember(this, user, deleteDays); - } - - /** - * Unbans a user from the guild. - * @param {UserResolvable} user The user to unban - * @returns {Promise} - * @example - * // unban a user by ID (or with a user/guild member object) - * guild.unban('some user ID') - * .then(user => console.log(`Unbanned ${user.username} from ${guild.name}`)) - * .catch(console.error); - */ - unban(user) { - return this.client.rest.methods.unbanGuildMember(this, user); - } - - /** - * Prunes members from the guild based on how long they have been inactive. - * @param {number} days Number of days of inactivity required to kick - * @param {boolean} [dry=false] If true, will return number of users that will be kicked, without actually doing it - * @returns {Promise} The number of members that were/will be kicked - * @example - * // see how many members will be pruned - * guild.pruneMembers(12, true) - * .then(pruned => console.log(`This will prune ${pruned} people!`)) - * .catch(console.error); - * @example - * // actually prune the members - * guild.pruneMembers(12) - * .then(pruned => console.log(`I just pruned ${pruned} people!`)) - * .catch(console.error); - */ - pruneMembers(days, dry = false) { - if (typeof days !== 'number') throw new TypeError('Days must be a number.'); - return this.client.rest.methods.pruneGuildMembers(this, days, dry); - } - - /** - * Syncs this guild (already done automatically every 30 seconds). - * This is only available when using a user account. - */ - sync() { - if (!this.client.user.bot) this.client.syncGuilds([this]); - } - - /** - * Creates a new channel in the guild. - * @param {string} name The name of the new channel - * @param {string} type The type of the new channel, either `text` or `voice` - * @param {Array} overwrites Permission overwrites to apply to the new channel - * @returns {Promise} - * @example - * // create a new text channel - * guild.createChannel('new-general', 'text') - * .then(channel => console.log(`Created new channel ${channel}`)) - * .catch(console.error); - */ - createChannel(name, type, overwrites) { - return this.client.rest.methods.createChannel(this, name, type, overwrites); - } - - /** - * The data needed for updating a channel's position. - * @typedef {Object} ChannelPosition - * @property {ChannelResolvable} channel Channel to update - * @property {number} position New position for the channel - */ - - /** - * Batch-updates the guild's channels' positions. - * @param {ChannelPosition[]} channelPositions Channel positions to update - * @returns {Promise} - * @example - * guild.updateChannels([{ channel: channelID, position: newChannelIndex }]) - * .then(guild => console.log(`Updated channel positions for ${guild.id}`)) - * .catch(console.error); - */ - setChannelPositions(channelPositions) { - return this.client.rest.methods.updateChannelPositions(this.id, channelPositions); - } - - /** - * Creates a new role in the guild with given information - * @param {RoleData} [data] The data to update the role with - * @returns {Promise} - * @example - * // create a new role - * guild.createRole() - * .then(role => console.log(`Created role ${role}`)) - * .catch(console.error); - * @example - * // create a new role with data - * guild.createRole({ - * name: 'Super Cool People', - * color: 'BLUE', - * }) - * .then(role => console.log(`Created role ${role}`)) - * .catch(console.error) - */ - createRole(data = {}) { - return this.client.rest.methods.createGuildRole(this, data); - } - - /** - * Creates a new custom emoji in the guild. - * @param {BufferResolvable|Base64Resolvable} attachment The image for the emoji. - * @param {string} name The name for the emoji. - * @param {Collection|Role[]} [roles] Roles to limit the emoji to - * @returns {Promise} The created emoji. - * @example - * // create a new emoji from a url - * guild.createEmoji('https://i.imgur.com/w3duR07.png', 'rip') - * .then(emoji => console.log(`Created new emoji with name ${emoji.name}!`)) - * .catch(console.error); - * @example - * // create a new emoji from a file on your computer - * guild.createEmoji('./memes/banana.png', 'banana') - * .then(emoji => console.log(`Created new emoji with name ${emoji.name}!`)) - * .catch(console.error); - */ - createEmoji(attachment, name, roles) { - return new Promise(resolve => { - if (typeof attachment === 'string' && attachment.startsWith('data:')) { - resolve(this.client.rest.methods.createEmoji(this, attachment, name, roles)); - } else { - this.client.resolver.resolveBuffer(attachment).then(data => { - const dataURI = this.client.resolver.resolveBase64(data); - resolve(this.client.rest.methods.createEmoji(this, dataURI, name, roles)); - }); - } - }); - } - - /** - * Delete an emoji. - * @param {Emoji|string} emoji The emoji to delete. - * @returns {Promise} - */ - deleteEmoji(emoji) { - if (!(emoji instanceof Emoji)) emoji = this.emojis.get(emoji); - return this.client.rest.methods.deleteEmoji(emoji); - } - - /** - * Causes the Client to leave the guild. - * @returns {Promise} - * @example - * // leave a guild - * guild.leave() - * .then(g => console.log(`Left the guild ${g}`)) - * .catch(console.error); - */ - leave() { - return this.client.rest.methods.leaveGuild(this); - } - - /** - * Causes the Client to delete the guild. - * @returns {Promise} - * @example - * // delete a guild - * guild.delete() - * .then(g => console.log(`Deleted the guild ${g}`)) - * .catch(console.error); - */ - delete() { - return this.client.rest.methods.deleteGuild(this); - } - - /** - * Marks all messages in this guild as read - * This is only available when using a user account. - * @returns {Promise} this guild - */ - acknowledge() { - return this.client.rest.methods.ackGuild(this); - } - - /** - * Whether this Guild equals another Guild. It compares all properties, so for most operations - * it is advisable to just compare `guild.id === guild2.id` as it is much faster and is often - * what most users need. - * @param {Guild} guild Guild to compare with - * @returns {boolean} - */ - equals(guild) { - let equal = - guild && - this.id === guild.id && - this.available === !guild.unavailable && - this.splash === guild.splash && - this.region === guild.region && - this.name === guild.name && - this.memberCount === guild.member_count && - this.large === guild.large && - this.icon === guild.icon && - Util.arraysEqual(this.features, guild.features) && - this.ownerID === guild.owner_id && - this.verificationLevel === guild.verification_level && - this.embedEnabled === guild.embed_enabled; - - if (equal) { - if (this.embedChannel) { - if (this.embedChannel.id !== guild.embed_channel_id) equal = false; - } else if (guild.embed_channel_id) { - equal = false; - } - } - - return equal; - } - - /** - * When concatenated with a string, this automatically concatenates the guild's name instead of the Guild object. - * @returns {string} - * @example - * // logs: Hello from My Guild! - * console.log(`Hello from ${guild}!`); - * @example - * // logs: Hello from My Guild! - * console.log(`Hello from ' + guild + '!'); - */ - toString() { - return this.name; - } - - _addMember(guildUser, emitEvent = true) { - const existing = this.members.has(guildUser.user.id); - if (!(guildUser.user instanceof User)) guildUser.user = this.client.dataManager.newUser(guildUser.user); - - guildUser.joined_at = guildUser.joined_at || 0; - const member = new GuildMember(this, guildUser); - this.members.set(member.id, member); - - if (this._rawVoiceStates && this._rawVoiceStates.has(member.user.id)) { - const voiceState = this._rawVoiceStates.get(member.user.id); - member.serverMute = voiceState.mute; - member.serverDeaf = voiceState.deaf; - member.selfMute = voiceState.self_mute; - member.selfDeaf = voiceState.self_deaf; - member.voiceSessionID = voiceState.session_id; - member.voiceChannelID = voiceState.channel_id; - if (this.client.channels.has(voiceState.channel_id)) { - this.client.channels.get(voiceState.channel_id).members.set(member.user.id, member); - } else { - this.client.emit('warn', `Member ${member.id} added in guild ${this.id} with an uncached voice channel`); - } - } - - /** - * Emitted whenever a user joins a guild. - * @event Client#guildMemberAdd - * @param {GuildMember} member The member that has joined a guild - */ - if (this.client.ws.status === Constants.Status.READY && emitEvent && !existing) { - this.client.emit(Constants.Events.GUILD_MEMBER_ADD, member); - } - - return member; - } - - _updateMember(member, data) { - const oldMember = Util.cloneObject(member); - - if (data.roles) member._roles = data.roles; - if (typeof data.nick !== 'undefined') member.nickname = data.nick; - - const notSame = member.nickname !== oldMember.nickname || !Util.arraysEqual(member._roles, oldMember._roles); - - if (this.client.ws.status === Constants.Status.READY && notSame) { - /** - * Emitted whenever a guild member changes - i.e. new role, removed role, nickname - * @event Client#guildMemberUpdate - * @param {GuildMember} oldMember The member before the update - * @param {GuildMember} newMember The member after the update - */ - this.client.emit(Constants.Events.GUILD_MEMBER_UPDATE, oldMember, member); - } - - return { - old: oldMember, - mem: member, - }; - } - - _removeMember(guildMember) { - this.members.delete(guildMember.id); - } - - _memberSpeakUpdate(user, speaking) { - const member = this.members.get(user); - if (member && member.speaking !== speaking) { - member.speaking = speaking; - /** - * Emitted once a guild member starts/stops speaking - * @event Client#guildMemberSpeaking - * @param {GuildMember} member The member that started/stopped speaking - * @param {boolean} speaking Whether or not the member is speaking - */ - this.client.emit(Constants.Events.GUILD_MEMBER_SPEAKING, member, speaking); - } - } - - _setPresence(id, presence) { - if (this.presences.get(id)) { - this.presences.get(id).update(presence); - return; - } - this.presences.set(id, new Presence(presence)); - } - - /** - * Set the position of a role in this guild - * @param {string|Role} role The role to edit, can be a role object or a role ID. - * @param {number} position The new position of the role - * @param {boolean} [relative=false] Position Moves the role relative to its current position - * @returns {Promise} - */ - setRolePosition(role, position, relative = false) { - if (typeof role === 'string') { - role = this.roles.get(role); - if (!role) return Promise.reject(new Error('Supplied role is not a role or snowflake.')); - } - - position = Number(position); - if (isNaN(position)) return Promise.reject(new Error('Supplied position is not a number.')); - - let updatedRoles = this._sortedRoles().array(); - - Util.moveElementInArray(updatedRoles, role, position, relative); - - updatedRoles = updatedRoles.map((r, i) => ({ id: r.id, position: i })); - return this.client.rest.methods.setRolePositions(this.id, updatedRoles); - } - - /** - * Set the position of a channel in this guild - * @param {string|GuildChannel} channel The channel to edit, can be a channel object or a channel ID. - * @param {number} position The new position of the channel - * @param {boolean} [relative=false] Position Moves the channel relative to its current position - * @returns {Promise} - */ - setChannelPosition(channel, position, relative = false) { - if (typeof channel === 'string') { - channel = this.channels.get(channel); - if (!channel) return Promise.reject(new Error('Supplied channel is not a channel or snowflake.')); - } - - position = Number(position); - if (isNaN(position)) return Promise.reject(new Error('Supplied position is not a number.')); - - let updatedChannels = this._sortedChannels(channel.type).array(); - - Util.moveElementInArray(updatedChannels, channel, position, relative); - - updatedChannels = updatedChannels.map((r, i) => ({ id: r.id, position: i })); - return this.client.rest.methods.setChannelPositions(this.id, updatedChannels); - } - - /** - * Fetches a collection of channels in the current guild sorted by position. - * @param {string} type Channel type - * @returns {Collection} - */ - _sortedChannels(type) { - return this._sortPositionWithID(this.channels.filter(c => { - if (type === 'voice' && c.type === 'voice') return true; - else if (type !== 'voice' && c.type !== 'voice') return true; - else return type === c.type; - })); - } - - /** - * Sorts a collection by object position or ID if the positions are equivalent. - * Intended to be identical to Discord's sorting method. - * @param {Collection} collection The collection to sort - * @returns {Collection} - */ - _sortPositionWithID(collection) { - return collection.sort((a, b) => - a.position !== b.position ? - a.position - b.position : - Long.fromString(a.id).sub(Long.fromString(b.id)).toNumber() - ); - } -} - -module.exports = Guild; - - -/***/ }), -/* 17 */ -/***/ (function(module, exports, __webpack_require__) { - -const Channel = __webpack_require__(8); -const Role = __webpack_require__(10); -const PermissionOverwrites = __webpack_require__(40); -const Permissions = __webpack_require__(6); -const Collection = __webpack_require__(3); - -/** - * Represents a guild channel (i.e. text channels and voice channels) - * @extends {Channel} - */ -class GuildChannel extends Channel { - constructor(guild, data) { - super(guild.client, data); - - /** - * The guild the channel is in - * @type {Guild} - */ - this.guild = guild; - } - - setup(data) { - super.setup(data); - - /** - * The name of the guild channel - * @type {string} - */ - this.name = data.name; - - /** - * The position of the channel in the list. - * @type {number} - */ - this.position = data.position; - - /** - * A map of permission overwrites in this channel for roles and users. - * @type {Collection} - */ - this.permissionOverwrites = new Collection(); - if (data.permission_overwrites) { - for (const overwrite of data.permission_overwrites) { - this.permissionOverwrites.set(overwrite.id, new PermissionOverwrites(this, overwrite)); - } - } - } - - /** - * The position of the channel - * @type {number} - */ - get calculatedPosition() { - const sorted = this.guild._sortedChannels(this.type); - return sorted.array().indexOf(sorted.get(this.id)); - } - - /** - * Gets the overall set of permissions for a user in this channel, taking into account roles and permission - * overwrites. - * @param {GuildMemberResolvable} member The user that you want to obtain the overall permissions for - * @returns {?Permissions} - */ - permissionsFor(member) { - member = this.client.resolver.resolveGuildMember(this.guild, member); - if (!member) return null; - if (member.id === this.guild.ownerID) return new Permissions(member, Permissions.ALL); - - let permissions = 0; - - const roles = member.roles; - for (const role of roles.values()) permissions |= role.permissions; - - const overwrites = this.overwritesFor(member, true, roles); - - if (overwrites.everyone) { - permissions &= ~overwrites.everyone.deny; - permissions |= overwrites.everyone.allow; - } - - let allow = 0; - for (const overwrite of overwrites.roles) { - permissions &= ~overwrite.deny; - allow |= overwrite.allow; - } - permissions |= allow; - - if (overwrites.member) { - permissions &= ~overwrites.member.deny; - permissions |= overwrites.member.allow; - } - - const admin = Boolean(permissions & Permissions.FLAGS.ADMINISTRATOR); - if (admin) permissions = Permissions.ALL; - - return new Permissions(member, permissions); - } - - overwritesFor(member, verified = false, roles = null) { - if (!verified) member = this.client.resolver.resolveGuildMember(this.guild, member); - if (!member) return []; - - roles = roles || member.roles; - const roleOverwrites = []; - let memberOverwrites; - let everyoneOverwrites; - - for (const overwrite of this.permissionOverwrites.values()) { - if (overwrite.id === this.guild.id) { - everyoneOverwrites = overwrite; - } else if (roles.has(overwrite.id)) { - roleOverwrites.push(overwrite); - } else if (overwrite.id === member.id) { - memberOverwrites = overwrite; - } - } - - return { - everyone: everyoneOverwrites, - roles: roleOverwrites, - member: memberOverwrites, - }; - } - - /** - * An object mapping permission flags to `true` (enabled) or `false` (disabled) - * ```js - * { - * 'SEND_MESSAGES': true, - * 'ATTACH_FILES': false, - * } - * ``` - * @typedef {Object} PermissionOverwriteOptions - */ - - /** - * Overwrites the permissions for a user or role in this channel. - * @param {RoleResolvable|UserResolvable} userOrRole The user or role to update - * @param {PermissionOverwriteOptions} options The configuration for the update - * @returns {Promise} - * @example - * // overwrite permissions for a message author - * message.channel.overwritePermissions(message.author, { - * SEND_MESSAGES: false - * }) - * .then(() => console.log('Done!')) - * .catch(console.error); - */ - overwritePermissions(userOrRole, options) { - const payload = { - allow: 0, - deny: 0, - }; - - if (userOrRole instanceof Role) { - payload.type = 'role'; - } else if (this.guild.roles.has(userOrRole)) { - userOrRole = this.guild.roles.get(userOrRole); - payload.type = 'role'; - } else { - userOrRole = this.client.resolver.resolveUser(userOrRole); - payload.type = 'member'; - if (!userOrRole) return Promise.reject(new TypeError('Supplied parameter was neither a User nor a Role.')); - } - - payload.id = userOrRole.id; - - const prevOverwrite = this.permissionOverwrites.get(userOrRole.id); - - if (prevOverwrite) { - payload.allow = prevOverwrite.allow; - payload.deny = prevOverwrite.deny; - } - - for (const perm in options) { - if (options[perm] === true) { - payload.allow |= Permissions.FLAGS[perm] || 0; - payload.deny &= ~(Permissions.FLAGS[perm] || 0); - } else if (options[perm] === false) { - payload.allow &= ~(Permissions.FLAGS[perm] || 0); - payload.deny |= Permissions.FLAGS[perm] || 0; - } else if (options[perm] === null) { - payload.allow &= ~(Permissions.FLAGS[perm] || 0); - payload.deny &= ~(Permissions.FLAGS[perm] || 0); - } - } - - return this.client.rest.methods.setChannelOverwrite(this, payload); - } - - /** - * The data for a guild channel - * @typedef {Object} ChannelData - * @property {string} [name] The name of the channel - * @property {number} [position] The position of the channel - * @property {string} [topic] The topic of the text channel - * @property {number} [bitrate] The bitrate of the voice channel - * @property {number} [userLimit] The user limit of the channel - */ - - /** - * Edits the channel - * @param {ChannelData} data The new data for the channel - * @returns {Promise} - * @example - * // edit a channel - * channel.edit({name: 'new-channel'}) - * .then(c => console.log(`Edited channel ${c}`)) - * .catch(console.error); - */ - edit(data) { - return this.client.rest.methods.updateChannel(this, data); - } - - /** - * Set a new name for the guild channel - * @param {string} name The new name for the guild channel - * @returns {Promise} - * @example - * // set a new channel name - * channel.setName('not_general') - * .then(newChannel => console.log(`Channel's new name is ${newChannel.name}`)) - * .catch(console.error); - */ - setName(name) { - return this.edit({ name }); - } - - /** - * Set a new position for the guild channel - * @param {number} position The new position for the guild channel - * @param {boolean} [relative=false] Move the position relative to its current value - * @returns {Promise} - * @example - * // set a new channel position - * channel.setPosition(2) - * .then(newChannel => console.log(`Channel's new position is ${newChannel.position}`)) - * .catch(console.error); - */ - setPosition(position, relative) { - return this.guild.setChannelPosition(this, position, relative).then(() => this); - } - - /** - * Set a new topic for the guild channel - * @param {string} topic The new topic for the guild channel - * @returns {Promise} - * @example - * // set a new channel topic - * channel.setTopic('needs more rate limiting') - * .then(newChannel => console.log(`Channel's new topic is ${newChannel.topic}`)) - * .catch(console.error); - */ - setTopic(topic) { - return this.client.rest.methods.updateChannel(this, { topic }); - } - - /** - * Options given when creating a guild channel invite - * @typedef {Object} InviteOptions - - */ - - /** - * Create an invite to this guild channel - * @param {InviteOptions} [options={}] Options for the invite - * @param {boolean} [options.temporary=false] Whether members that joined via the invite should be automatically - * kicked after 24 hours if they have not yet received a role - * @param {number} [options.maxAge=86400] How long the invite should last (in seconds, 0 for forever) - * @param {number} [options.maxUses=0] Maximum number of uses - * @returns {Promise} - */ - createInvite(options = {}) { - return this.client.rest.methods.createChannelInvite(this, options); - } - - /** - * Clone this channel - * @param {string} [name=this.name] Optional name for the new channel, otherwise it has the name of this channel - * @param {boolean} [withPermissions=true] Whether to clone the channel with this channel's permission overwrites - * @param {boolean} [withTopic=true] Whether to clone the channel with this channel's topic - * @returns {Promise} - */ - clone(name = this.name, withPermissions = true, withTopic = true) { - return this.guild.createChannel(name, this.type, withPermissions ? this.permissionOverwrites : []) - .then(channel => withTopic ? channel.setTopic(this.topic) : channel); - } - - /** - * Checks if this channel has the same type, topic, position, name, overwrites and ID as another channel. - * In most cases, a simple `channel.id === channel2.id` will do, and is much faster too. - * @param {GuildChannel} channel Channel to compare with - * @returns {boolean} - */ - equals(channel) { - let equal = channel && - this.id === channel.id && - this.type === channel.type && - this.topic === channel.topic && - this.position === channel.position && - this.name === channel.name; - - if (equal) { - if (this.permissionOverwrites && channel.permissionOverwrites) { - equal = this.permissionOverwrites.equals(channel.permissionOverwrites); - } else { - equal = !this.permissionOverwrites && !channel.permissionOverwrites; - } - } - - return equal; - } - - /** - * Whether the channel is deletable by the client user. - * @type {boolean} - * @readonly - */ - get deletable() { - return this.id !== this.guild.id && - this.permissionsFor(this.client.user).hasPermission(Permissions.FLAGS.MANAGE_CHANNELS); - } - - /** - * When concatenated with a string, this automatically returns the channel's mention instead of the Channel object. - * @returns {string} - * @example - * // Outputs: Hello from #general - * console.log(`Hello from ${channel}`); - * @example - * // Outputs: Hello from #general - * console.log('Hello from ' + channel); - */ - toString() { - return `<#${this.id}>`; - } -} - -module.exports = GuildChannel; - - -/***/ }), -/* 18 */ -/***/ (function(module, exports) { - -// shim for using process in browser -var process = module.exports = {}; - -// cached from whatever global is present so that test runners that stub it -// don't break things. But we need to wrap it in a try catch in case it is -// wrapped in strict mode code which doesn't define any globals. It's inside a -// function because try/catches deoptimize in certain engines. - -var cachedSetTimeout; -var cachedClearTimeout; - -function defaultSetTimout() { - throw new Error('setTimeout has not been defined'); -} -function defaultClearTimeout () { - throw new Error('clearTimeout has not been defined'); -} -(function () { - try { - if (typeof setTimeout === 'function') { - cachedSetTimeout = setTimeout; - } else { - cachedSetTimeout = defaultSetTimout; - } - } catch (e) { - cachedSetTimeout = defaultSetTimout; - } - try { - if (typeof clearTimeout === 'function') { - cachedClearTimeout = clearTimeout; - } else { - cachedClearTimeout = defaultClearTimeout; - } - } catch (e) { - cachedClearTimeout = defaultClearTimeout; - } -} ()) -function runTimeout(fun) { - if (cachedSetTimeout === setTimeout) { - //normal enviroments in sane situations - return setTimeout(fun, 0); - } - // if setTimeout wasn't available but was latter defined - if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { - cachedSetTimeout = setTimeout; - return setTimeout(fun, 0); - } - try { - // when when somebody has screwed with setTimeout but no I.E. maddness - return cachedSetTimeout(fun, 0); - } catch(e){ - try { - // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally - return cachedSetTimeout.call(null, fun, 0); - } catch(e){ - // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error - return cachedSetTimeout.call(this, fun, 0); - } - } - - -} -function runClearTimeout(marker) { - if (cachedClearTimeout === clearTimeout) { - //normal enviroments in sane situations - return clearTimeout(marker); - } - // if clearTimeout wasn't available but was latter defined - if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { - cachedClearTimeout = clearTimeout; - return clearTimeout(marker); - } - try { - // when when somebody has screwed with setTimeout but no I.E. maddness - return cachedClearTimeout(marker); - } catch (e){ - try { - // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally - return cachedClearTimeout.call(null, marker); - } catch (e){ - // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. - // Some versions of I.E. have different rules for clearTimeout vs setTimeout - return cachedClearTimeout.call(this, marker); - } - } - - - -} -var queue = []; -var draining = false; -var currentQueue; -var queueIndex = -1; - -function cleanUpNextTick() { - if (!draining || !currentQueue) { - return; - } - draining = false; - if (currentQueue.length) { - queue = currentQueue.concat(queue); - } else { - queueIndex = -1; - } - if (queue.length) { - drainQueue(); - } -} - -function drainQueue() { - if (draining) { - return; - } - var timeout = runTimeout(cleanUpNextTick); - draining = true; - - var len = queue.length; - while(len) { - currentQueue = queue; - queue = []; - while (++queueIndex < len) { - if (currentQueue) { - currentQueue[queueIndex].run(); - } - } - queueIndex = -1; - len = queue.length; - } - currentQueue = null; - draining = false; - runClearTimeout(timeout); -} - -process.nextTick = function (fun) { - var args = new Array(arguments.length - 1); - if (arguments.length > 1) { - for (var i = 1; i < arguments.length; i++) { - args[i - 1] = arguments[i]; - } - } - queue.push(new Item(fun, args)); - if (queue.length === 1 && !draining) { - runTimeout(drainQueue); - } -}; - -// v8 likes predictible objects -function Item(fun, array) { - this.fun = fun; - this.array = array; -} -Item.prototype.run = function () { - this.fun.apply(null, this.array); -}; -process.title = 'browser'; -process.browser = true; -process.env = {}; -process.argv = []; -process.version = ''; // empty string to avoid regexp issues -process.versions = {}; - -function noop() {} - -process.on = noop; -process.addListener = noop; -process.once = noop; -process.off = noop; -process.removeListener = noop; -process.removeAllListeners = noop; -process.emit = noop; - -process.binding = function (name) { - throw new Error('process.binding is not supported'); -}; - -process.cwd = function () { return '/' }; -process.chdir = function (dir) { - throw new Error('process.chdir is not supported'); -}; -process.umask = function() { return 0; }; - - -/***/ }), -/* 19 */ -/***/ (function(module, exports, __webpack_require__) { - -const Channel = __webpack_require__(8); -const TextBasedChannel = __webpack_require__(14); -const Collection = __webpack_require__(3); - -/* -{ type: 3, - recipients: - [ { username: 'Charlie', - id: '123', - discriminator: '6631', - avatar: '123' }, - { username: 'Ben', - id: '123', - discriminator: '2055', - avatar: '123' }, - { username: 'Adam', - id: '123', - discriminator: '2406', - avatar: '123' } ], - owner_id: '123', - name: null, - last_message_id: '123', - id: '123', - icon: null } -*/ - -/** - * Represents a Group DM on Discord - * @extends {Channel} - * @implements {TextBasedChannel} - */ -class GroupDMChannel extends Channel { - constructor(client, data) { - super(client, data); - this.type = 'group'; - this.messages = new Collection(); - this._typing = new Map(); - } - - setup(data) { - super.setup(data); - - /** - * The name of this Group DM, can be null if one isn't set. - * @type {string} - */ - this.name = data.name; - - /** - * A hash of the Group DM icon. - * @type {string} - */ - this.icon = data.icon; - - /** - * The user ID of this Group DM's owner. - * @type {string} - */ - this.ownerID = data.owner_id; - - /** - * If the dm is managed by an application - * @type {boolean} - */ - this.managed = data.managed; - - /** - * Application ID of the application that made this group dm, if applicable - * @type {?string} - */ - this.applicationID = data.application_id; - - /** - * Nicknames for group members - * @type {?Collection} - */ - if (data.nicks) this.nicks = new Collection(data.nicks.map(n => [n.id, n.nick])); - - if (!this.recipients) { - /** - * A collection of the recipients of this DM, mapped by their ID. - * @type {Collection} - */ - this.recipients = new Collection(); - } - - if (data.recipients) { - for (const recipient of data.recipients) { - const user = this.client.dataManager.newUser(recipient); - this.recipients.set(user.id, user); - } - } - - this.lastMessageID = data.last_message_id; - } - - /** - * The owner of this Group DM. - * @type {User} - * @readonly - */ - get owner() { - return this.client.users.get(this.ownerID); - } - - /** - * Whether this channel equals another channel. It compares all properties, so for most operations - * it is advisable to just compare `channel.id === channel2.id` as it is much faster and is often - * what most users need. - * @param {GroupDMChannel} channel Channel to compare with - * @returns {boolean} - */ - equals(channel) { - const equal = channel && - this.id === channel.id && - this.name === channel.name && - this.icon === channel.icon && - this.ownerID === channel.ownerID; - - if (equal) { - return this.recipients.equals(channel.recipients); - } - - return equal; - } - - /** - * Add a user to the dm - * @param {UserResolvable|String} accessTokenOrID Access token or user resolvable - * @param {string} [nick] Permanent nickname to give the user (only available if a bot is creating the dm) - */ - - addUser(accessTokenOrID, nick) { - return this.client.rest.methods.addUserToGroupDM(this, { - nick, - id: this.client.resolver.resolveUserID(accessTokenOrID), - accessToken: accessTokenOrID, - }); - } - - /** - * When concatenated with a string, this automatically concatenates the channel's name instead of the Channel object. - * @returns {string} - * @example - * // logs: Hello from My Group DM! - * console.log(`Hello from ${channel}!`); - * @example - * // logs: Hello from My Group DM! - * console.log(`Hello from ' + channel + '!'); - */ - toString() { - return this.name; - } - - // These are here only for documentation purposes - they are implemented by TextBasedChannel - /* eslint-disable no-empty-function */ - send() {} - sendMessage() {} - sendEmbed() {} - sendFile() {} - sendFiles() {} - sendCode() {} - fetchMessage() {} - fetchMessages() {} - fetchPinnedMessages() {} - search() {} - startTyping() {} - stopTyping() {} - get typing() {} - get typingCount() {} - createCollector() {} - awaitMessages() {} - // Doesn't work on group DMs; bulkDelete() {} - acknowledge() {} - _cacheMessage() {} -} - -TextBasedChannel.applyToClass(GroupDMChannel, true, ['bulkDelete']); - -module.exports = GroupDMChannel; - - -/***/ }), -/* 20 */ -/***/ (function(module, exports) { - -/** - * Represents a limited emoji set used for both custom and unicode emojis. Custom emojis - * will use this class opposed to the Emoji class when the client doesn't know enough - * information about them. - */ -class ReactionEmoji { - constructor(reaction, name, id) { - /** - * The message reaction this emoji refers to - * @type {MessageReaction} - */ - this.reaction = reaction; - - /** - * The name of this reaction emoji. - * @type {string} - */ - this.name = name; - - /** - * The ID of this reaction emoji. - * @type {?Snowflake} - */ - this.id = id; - } - - /** - * The identifier of this emoji, used for message reactions - * @type {string} - * @readonly - */ - get identifier() { - if (this.id) return `${this.name}:${this.id}`; - return encodeURIComponent(this.name); - } - - /** - * Creates the text required to form a graphical emoji on Discord. - * @example - * // send the emoji used in a reaction to the channel the reaction is part of - * reaction.message.channel.sendMessage(`The emoji used is ${reaction.emoji}`); - * @returns {string} - */ - toString() { - return this.id ? `<:${this.name}:${this.id}>` : this.name; - } -} - -module.exports = ReactionEmoji; - - -/***/ }), -/* 21 */ -/***/ (function(module, exports, __webpack_require__) { - -const path = __webpack_require__(25); - -/** - * Represents a webhook - */ -class Webhook { - constructor(client, dataOrID, token) { - if (client) { - /** - * The Client that instantiated the Webhook - * @name Webhook#client - * @type {Client} - * @readonly - */ - Object.defineProperty(this, 'client', { value: client }); - if (dataOrID) this.setup(dataOrID); - } else { - this.id = dataOrID; - this.token = token; - Object.defineProperty(this, 'client', { value: this }); - } - } - - setup(data) { - /** - * The name of the webhook - * @type {string} - */ - this.name = data.name; - - /** - * The token for the webhook - * @type {string} - */ - this.token = data.token; - - /** - * The avatar for the webhook - * @type {string} - */ - this.avatar = data.avatar; - - /** - * The ID of the webhook - * @type {Snowflake} - */ - this.id = data.id; - - /** - * The guild the webhook belongs to - * @type {Snowflake} - */ - this.guildID = data.guild_id; - - /** - * The channel the webhook belongs to - * @type {Snowflake} - */ - this.channelID = data.channel_id; - - if (data.user) { - /** - * The owner of the webhook - * @type {?User|Object} - */ - this.owner = this.client.users ? this.client.users.get(data.user.id) : data.user; - } else { - this.owner = null; - } - } - - /** - * Options that can be passed into send, sendMessage, sendFile, sendEmbed, and sendCode - * @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} [file] A file 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. - */ - - /** - * Send a message with this webhook - * @param {StringResolvable} content The content to send. - * @param {WebhookMessageOptions} [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); - */ - send(content, options) { - if (!options && typeof content === 'object' && !(content instanceof Array)) { - options = content; - content = ''; - } else if (!options) { - options = {}; - } - if (options.file) { - if (typeof options.file === 'string') options.file = { attachment: options.file }; - if (!options.file.name) { - if (typeof options.file.attachment === 'string') { - options.file.name = path.basename(options.file.attachment); - } else if (options.file.attachment && options.file.attachment.path) { - options.file.name = path.basename(options.file.attachment.path); - } else { - options.file.name = 'file.jpg'; - } - } - return this.client.resolver.resolveBuffer(options.file.attachment).then(file => - this.client.rest.methods.sendWebhookMessage(this, content, options, { - file, - name: options.file.name, - }) - ); - } - return this.client.rest.methods.sendWebhookMessage(this, content, options); - } - - /** - * Send a message with this webhook - * @param {StringResolvable} content The content to send. - * @param {WebhookMessageOptions} [options={}] The options to provide. - * @returns {Promise} - * @example - * // send a message - * webhook.sendMessage('hello!') - * .then(message => console.log(`Sent message: ${message.content}`)) - * .catch(console.error); - */ - sendMessage(content, options = {}) { - return this.send(content, options); - } - - /** - * Send a file with this webhook - * @param {BufferResolvable} attachment The file to send - * @param {string} [name='file.jpg'] The name and extension of the file - * @param {StringResolvable} [content] Text message to send with the attachment - * @param {WebhookMessageOptions} [options] The options to provide - * @returns {Promise} - */ - sendFile(attachment, name, content, options = {}) { - return this.send(content, Object.assign(options, { file: { attachment, name } })); - } - - /** - * Send a code block with this webhook - * @param {string} lang Language for the code block - * @param {StringResolvable} content Content of the code block - * @param {WebhookMessageOptions} options The options to provide - * @returns {Promise} - */ - sendCode(lang, content, options = {}) { - return this.send(content, Object.assign(options, { code: lang })); - } - - /** - * Send a raw slack message with this webhook - * @param {Object} body The raw body to send. - * @returns {Promise} - * @example - * // send a slack message - * webhook.sendSlackMessage({ - * 'username': 'Wumpus', - * 'attachments': [{ - * 'pretext': 'this looks pretty cool', - * 'color': '#F0F', - * 'footer_icon': 'http://snek.s3.amazonaws.com/topSnek.png', - * 'footer': 'Powered by sneks', - * 'ts': Date.now() / 1000 - * }] - * }).catch(console.error); - */ - sendSlackMessage(body) { - return this.client.rest.methods.sendSlackWebhookMessage(this, body); - } - - /** - * Edit the webhook. - * @param {string} name The new name for the Webhook - * @param {BufferResolvable} avatar The new avatar for the Webhook. - * @returns {Promise} - */ - edit(name = this.name, avatar) { - if (avatar) { - return this.client.resolver.resolveBuffer(avatar).then(file => { - const dataURI = this.client.resolver.resolveBase64(file); - return this.client.rest.methods.editWebhook(this, name, dataURI); - }); - } - return this.client.rest.methods.editWebhook(this, name).then(data => { - this.setup(data); - return this; - }); - } - - /** - * Delete the webhook - * @returns {Promise} - */ - delete() { - return this.client.rest.methods.deleteWebhook(this); - } -} - -module.exports = Webhook; - - -/***/ }), -/* 22 */ -/***/ (function(module, exports, __webpack_require__) { - "use strict"; /* WEBPACK VAR INJECTION */(function(global) {/*! * The buffer module from node.js, for the browser. @@ -6100,9 +3585,9 @@ module.exports = Webhook; -var base64 = __webpack_require__(52) -var ieee754 = __webpack_require__(54) -var isArray = __webpack_require__(55) +var base64 = __webpack_require__(51) +var ieee754 = __webpack_require__(52) +var isArray = __webpack_require__(53) exports.Buffer = Buffer exports.SlowBuffer = SlowBuffer @@ -7880,10 +5365,2756 @@ function isnan (val) { return val !== val // eslint-disable-line no-self-compare } -/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(64))) +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(62))) + +/***/ }), +/* 15 */ +/***/ (function(module, exports, __webpack_require__) { + +const path = __webpack_require__(19); +const Message = __webpack_require__(9); +const MessageCollector = __webpack_require__(33); +const Collection = __webpack_require__(3); + +/** + * Interface for classes that have text-channel-like features + * @interface + */ +class TextBasedChannel { + constructor() { + /** + * A collection containing the messages sent to this channel. + * @type {Collection} + */ + this.messages = new Collection(); + + /** + * The ID of the last message in the channel, if one was sent. + * @type {?Snowflake} + */ + this.lastMessageID = null; + + /** + * The Message object of the last message in the channel, if one was sent. + * @type {?Message} + */ + this.lastMessage = null; + } + + /** + * Options provided when sending or editing a message + * @typedef {Object} MessageOptions + * @property {boolean} [tts=false] Whether or not the message should be spoken aloud + * @property {string} [nonce=''] The nonce for the message + * @property {RichEmbed|Object} [embed] An embed for the message + * (see [here](https://discordapp.com/developers/docs/resources/channel#embed-object) for more details) + * @property {boolean} [disableEveryone=this.client.options.disableEveryone] Whether or not @everyone and @here + * should be replaced with plain-text + * @property {FileOptions|string} [file] A file to send with the message **(deprecated)** + * @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. + * @property {UserResolvable} [reply] User to reply to (prefixes the message with a mention, except in DMs) + */ + + /** + * @typedef {Object} FileOptions + * @property {BufferResolvable} attachment File to attach + * @property {string} [name='file.jpg'] Filename of the attachment + */ + + /** + * Options for splitting a message + * @typedef {Object} SplitOptions + * @property {number} [maxLength=1950] Maximum character length per message piece + * @property {string} [char='\n'] Character to split the message with + * @property {string} [prepend=''] Text to prepend to every piece except the first + * @property {string} [append=''] Text to append to every piece except the last + */ + + /** + * Send a message to this channel + * @param {StringResolvable} [content] Text for the message + * @param {MessageOptions} [options={}] Options for the message + * @returns {Promise} + * @example + * // send a message + * channel.send('hello!') + * .then(message => console.log(`Sent message: ${message.content}`)) + * .catch(console.error); + */ + send(content, options) { + if (!options && typeof content === 'object' && !(content instanceof Array)) { + options = content; + content = ''; + } else if (!options) { + options = {}; + } + + if (options.embed && options.embed.file) options.file = options.embed.file; + + if (options.file) { + if (options.files) options.files.push(options.file); + else options.files = [options.file]; + } + + if (options.files) { + for (const i in options.files) { + let file = options.files[i]; + if (typeof file === 'string') file = { attachment: file }; + if (!file.name) { + if (typeof file.attachment === 'string') { + file.name = path.basename(file.attachment); + } else if (file.attachment && file.attachment.path) { + file.name = path.basename(file.attachment.path); + } else { + file.name = 'file.jpg'; + } + } + options.files[i] = file; + } + + return Promise.all(options.files.map(file => + this.client.resolver.resolveBuffer(file.attachment).then(buffer => { + file.file = buffer; + return file; + }) + )).then(files => this.client.rest.methods.sendMessage(this, content, options, files)); + } + + return this.client.rest.methods.sendMessage(this, content, options); + } + + /** + * Send a message to this channel + * @param {StringResolvable} [content] Text for the message + * @param {MessageOptions} [options={}] Options for the message + * @returns {Promise} + * @example + * // send a message + * channel.sendMessage('hello!') + * .then(message => console.log(`Sent message: ${message.content}`)) + * .catch(console.error); + */ + sendMessage(content, options) { + return this.send(content, options); + } + + /** + * Send an embed to this channel + * @param {RichEmbed|Object} embed Embed for the message + * @param {string} [content] Text for the message + * @param {MessageOptions} [options] Options for the message + * @returns {Promise} + */ + sendEmbed(embed, content, options) { + if (!options && typeof content === 'object' && !(content instanceof Array)) { + options = content; + content = ''; + } else if (!options) { + options = {}; + } + return this.send(content, Object.assign(options, { embed })); + } + + /** + * Send files to this channel + * @param {FileOptions[]|string[]} files Files to send with the message + * @param {StringResolvable} [content] Text for the message + * @param {MessageOptions} [options] Options for the message + * @returns {Promise} + */ + sendFiles(files, content, options = {}) { + return this.send(content, Object.assign(options, { files })); + } + + /** + * Send a file to this channel + * @param {BufferResolvable} attachment File to send + * @param {string} [name='file.jpg'] Name and extension of the file + * @param {StringResolvable} [content] Text for the message + * @param {MessageOptions} [options] Options for the message + * @returns {Promise} + */ + sendFile(attachment, name, content, options = {}) { + return this.sendFiles([{ attachment, name }], content, options); + } + + /** + * Send a code block to this channel + * @param {string} lang Language for the code block + * @param {StringResolvable} content Content of the code block + * @param {MessageOptions} [options] Options for the message + * @returns {Promise} + */ + sendCode(lang, content, options = {}) { + return this.send(content, Object.assign(options, { code: lang })); + } + + /** + * Gets a single message from this channel, regardless of it being cached or not. Since the single message fetching + * endpoint is reserved for bot accounts, this abstracts the `fetchMessages` method to obtain the single message when + * using a user account. + * @param {Snowflake} messageID ID of the message to get + * @returns {Promise} + * @example + * // get message + * channel.fetchMessage('99539446449315840') + * .then(message => console.log(message.content)) + * .catch(console.error); + */ + fetchMessage(messageID) { + if (!this.client.user.bot) { + return this.fetchMessages({ limit: 1, around: messageID }).then(messages => { + const msg = messages.first(); + if (msg.id !== messageID) throw new Error('Message not found.'); + return msg; + }); + } + return this.client.rest.methods.getChannelMessage(this, messageID).then(data => { + const msg = data instanceof Message ? data : new Message(this, data, this.client); + this._cacheMessage(msg); + return msg; + }); + } + + /** + * The parameters to pass in when requesting previous messages from a channel. `around`, `before` and + * `after` are mutually exclusive. All the parameters are optional. + * @typedef {Object} ChannelLogsQueryOptions + * @property {number} [limit=50] Number of messages to acquire + * @property {Snowflake} [before] ID of a message to get the messages that were posted before it + * @property {Snowflake} [after] ID of a message to get the messages that were posted after it + * @property {Snowflake} [around] ID of a message to get the messages that were posted around it + */ + + /** + * Gets the past messages sent in this channel. Resolves with a collection mapping message ID's to Message objects. + * @param {ChannelLogsQueryOptions} [options={}] Query parameters to pass in + * @returns {Promise>} + * @example + * // get messages + * channel.fetchMessages({limit: 10}) + * .then(messages => console.log(`Received ${messages.size} messages`)) + * .catch(console.error); + */ + fetchMessages(options = {}) { + return this.client.rest.methods.getChannelMessages(this, options).then(data => { + const messages = new Collection(); + for (const message of data) { + const msg = new Message(this, message, this.client); + messages.set(message.id, msg); + this._cacheMessage(msg); + } + return messages; + }); + } + + /** + * Fetches the pinned messages of this channel and returns a collection of them. + * @returns {Promise>} + */ + fetchPinnedMessages() { + return this.client.rest.methods.getChannelPinnedMessages(this).then(data => { + const messages = new Collection(); + for (const message of data) { + const msg = new Message(this, message, this.client); + messages.set(message.id, msg); + this._cacheMessage(msg); + } + return messages; + }); + } + + /** + * @typedef {Object} MessageSearchOptions + * @property {string} [content] Message content + * @property {Snowflake} [maxID] Maximum ID for the filter + * @property {Snowflake} [minID] Minimum ID for the filter + * @property {string} [has] One of `link`, `embed`, `file`, `video`, `image`, or `sound`, + * or add `-` to negate (e.g. `-file`) + * @property {ChannelResolvable} [channel] Channel to limit search to (only for guild search endpoint) + * @property {UserResolvable} [author] Author to limit search + * @property {string} [authorType] One of `user`, `bot`, `webhook`, or add `-` to negate (e.g. `-webhook`) + * @property {string} [sortBy='recent'] `recent` or `relevant` + * @property {string} [sortOrder='desc'] `asc` or `desc` + * @property {number} [contextSize=2] How many messages to get around the matched message (0 to 2) + * @property {number} [limit=25] Maximum number of results to get (1 to 25) + * @property {number} [offset=0] Offset the "pages" of results (since you can only see 25 at a time) + * @property {UserResolvable} [mentions] Mentioned user filter + * @property {boolean} [mentionsEveryone] If everyone is mentioned + * @property {string} [linkHostname] Filter links by hostname + * @property {string} [embedProvider] The name of an embed provider + * @property {string} [embedType] one of `image`, `video`, `url`, `rich` + * @property {string} [attachmentFilename] The name of an attachment + * @property {string} [attachmentExtension] The extension of an attachment + * @property {Date} [before] Date to find messages before + * @property {Date} [after] Date to find messages before + * @property {Date} [during] Date to find messages during (range of date to date + 24 hours) + */ + + /** + * Performs a search within the channel. + * @param {MessageSearchOptions} [options={}] Options to pass to the search + * @returns {Promise>} + * An array containing arrays of messages. Each inner array is a search context cluster. + * The message which has triggered the result will have the `hit` property set to `true`. + * @example + * channel.search({ + * content: 'discord.js', + * before: '2016-11-17' + * }).then(res => { + * const hit = res.messages[0].find(m => m.hit).content; + * console.log(`I found: **${hit}**, total results: ${res.totalResults}`); + * }).catch(console.error); + */ + search(options) { + return this.client.rest.methods.search(this, options); + } + + /** + * Starts a typing indicator in the channel. + * @param {number} [count] The number of times startTyping should be considered to have been called + * @example + * // start typing in a channel + * channel.startTyping(); + */ + startTyping(count) { + if (typeof count !== 'undefined' && count < 1) throw new RangeError('Count must be at least 1.'); + if (!this.client.user._typing.has(this.id)) { + this.client.user._typing.set(this.id, { + count: count || 1, + interval: this.client.setInterval(() => { + this.client.rest.methods.sendTyping(this.id); + }, 9000), + }); + this.client.rest.methods.sendTyping(this.id); + } else { + const entry = this.client.user._typing.get(this.id); + entry.count = count || entry.count + 1; + } + } + + /** + * Stops the typing indicator in the channel. + * The indicator will only stop if this is called as many times as startTyping(). + * It can take a few seconds for the client user to stop typing. + * @param {boolean} [force=false] Whether or not to reset the call count and force the indicator to stop + * @example + * // stop typing in a channel + * channel.stopTyping(); + * @example + * // force typing to fully stop in a channel + * channel.stopTyping(true); + */ + stopTyping(force = false) { + if (this.client.user._typing.has(this.id)) { + const entry = this.client.user._typing.get(this.id); + entry.count--; + if (entry.count <= 0 || force) { + this.client.clearInterval(entry.interval); + this.client.user._typing.delete(this.id); + } + } + } + + /** + * Whether or not the typing indicator is being shown in the channel. + * @type {boolean} + * @readonly + */ + get typing() { + return this.client.user._typing.has(this.id); + } + + /** + * Number of times `startTyping` has been called. + * @type {number} + * @readonly + */ + get typingCount() { + if (this.client.user._typing.has(this.id)) return this.client.user._typing.get(this.id).count; + return 0; + } + + /** + * Creates a Message Collector + * @param {CollectorFilterFunction} filter The filter to create the collector with + * @param {CollectorOptions} [options={}] The options to pass to the collector + * @returns {MessageCollector} + * @example + * // create a message collector + * const collector = channel.createCollector( + * m => m.content.includes('discord'), + * { time: 15000 } + * ); + * collector.on('message', m => console.log(`Collected ${m.content}`)); + * collector.on('end', collected => console.log(`Collected ${collected.size} items`)); + */ + createCollector(filter, options = {}) { + return new MessageCollector(this, filter, options); + } + + /** + * An object containing the same properties as CollectorOptions, but a few more: + * @typedef {CollectorOptions} AwaitMessagesOptions + * @property {string[]} [errors] Stop/end reasons that cause the promise to reject + */ + + /** + * Similar to createCollector but in promise form. Resolves with a collection of messages that pass the specified + * filter. + * @param {CollectorFilterFunction} filter The filter function to use + * @param {AwaitMessagesOptions} [options={}] Optional options to pass to the internal collector + * @returns {Promise>} + * @example + * // await !vote messages + * const filter = m => m.content.startsWith('!vote'); + * // errors: ['time'] treats ending because of the time limit as an error + * channel.awaitMessages(filter, { max: 4, time: 60000, errors: ['time'] }) + * .then(collected => console.log(collected.size)) + * .catch(collected => console.log(`After a minute, only ${collected.size} out of 4 voted.`)); + */ + awaitMessages(filter, options = {}) { + return new Promise((resolve, reject) => { + const collector = this.createCollector(filter, options); + collector.on('end', (collection, reason) => { + if (options.errors && options.errors.includes(reason)) { + reject(collection); + } else { + resolve(collection); + } + }); + }); + } + + /** + * Bulk delete given messages that are newer than two weeks + * This is only available when using a bot account. + * @param {Collection|Message[]|number} messages Messages or number of messages to delete + * @param {boolean} [filterOld=false] Filter messages to remove those which are older than two weeks automatically + * @returns {Promise>} Deleted messages + */ + bulkDelete(messages, filterOld = false) { + if (!isNaN(messages)) return this.fetchMessages({ limit: messages }).then(msgs => this.bulkDelete(msgs, filterOld)); + if (messages instanceof Array || messages instanceof Collection) { + const messageIDs = messages instanceof Collection ? messages.keyArray() : messages.map(m => m.id); + return this.client.rest.methods.bulkDeleteMessages(this, messageIDs, filterOld); + } + throw new TypeError('The messages must be an Array, Collection, or number.'); + } + + /** + * Marks all messages in this channel as read + * This is only available when using a user account. + * @returns {Promise} + */ + acknowledge() { + return this.client.rest.methods.ackTextMessage(this); + } + + _cacheMessage(message) { + const maxSize = this.client.options.messageCacheMaxSize; + if (maxSize === 0) return null; + if (this.messages.size >= maxSize && maxSize > 0) this.messages.delete(this.messages.firstKey()); + this.messages.set(message.id, message); + return message; + } +} + +exports.applyToClass = (structure, full = false, ignore = []) => { + const props = ['send', 'sendMessage', 'sendEmbed', 'sendFile', 'sendFiles', 'sendCode']; + if (full) { + props.push( + '_cacheMessage', + 'fetchMessages', + 'fetchMessage', + 'search', + 'bulkDelete', + 'startTyping', + 'stopTyping', + 'typing', + 'typingCount', + 'fetchPinnedMessages', + 'createCollector', + 'awaitMessages' + ); + } + for (const prop of props) { + if (ignore.includes(prop)) continue; + Object.defineProperty(structure.prototype, prop, Object.getOwnPropertyDescriptor(TextBasedChannel.prototype, prop)); + } +}; + + +/***/ }), +/* 16 */ +/***/ (function(module, exports) { + +exports.endianness = function () { return 'LE' }; + +exports.hostname = function () { + if (typeof location !== 'undefined') { + return location.hostname + } + else return ''; +}; + +exports.loadavg = function () { return [] }; + +exports.uptime = function () { return 0 }; + +exports.freemem = function () { + return Number.MAX_VALUE; +}; + +exports.totalmem = function () { + return Number.MAX_VALUE; +}; + +exports.cpus = function () { return [] }; + +exports.type = function () { return 'Browser' }; + +exports.release = function () { + if (typeof navigator !== 'undefined') { + return navigator.appVersion; + } + return ''; +}; + +exports.networkInterfaces += exports.getNetworkInterfaces += function () { return {} }; + +exports.arch = function () { return 'javascript' }; + +exports.platform = function () { return 'browser' }; + +exports.tmpdir = exports.tmpDir = function () { + return '/tmp'; +}; + +exports.EOL = '\n'; + + +/***/ }), +/* 17 */ +/***/ (function(module, exports, __webpack_require__) { + +const Long = __webpack_require__(25); +const User = __webpack_require__(11); +const Role = __webpack_require__(10); +const Emoji = __webpack_require__(12); +const Presence = __webpack_require__(7).Presence; +const GuildMember = __webpack_require__(13); +const Constants = __webpack_require__(0); +const Collection = __webpack_require__(3); +const Util = __webpack_require__(4); +const Snowflake = __webpack_require__(5); + +/** + * Represents a guild (or a server) on Discord. + * It's recommended to see if a guild is available before performing operations or reading data from it. You can + * check this with `guild.available`. + */ +class Guild { + constructor(client, data) { + /** + * The Client that created the instance of the the Guild. + * @name Guild#client + * @type {Client} + * @readonly + */ + Object.defineProperty(this, 'client', { value: client }); + + /** + * A collection of members that are in this guild. The key is the member's ID, the value is the member. + * @type {Collection} + */ + this.members = new Collection(); + + /** + * A collection of channels that are in this guild. The key is the channel's ID, the value is the channel. + * @type {Collection} + */ + this.channels = new Collection(); + + /** + * A collection of roles that are in this guild. The key is the role's ID, the value is the role. + * @type {Collection} + */ + this.roles = new Collection(); + + /** + * A collection of presences in this guild + * @type {Collection} + */ + this.presences = new Collection(); + + if (!data) return; + if (data.unavailable) { + /** + * Whether the guild is available to access. If it is not available, it indicates a server outage. + * @type {boolean} + */ + this.available = false; + + /** + * The Unique ID of the Guild, useful for comparisons. + * @type {Snowflake} + */ + this.id = data.id; + } else { + this.available = true; + this.setup(data); + } + } + + /** + * Sets up the Guild + * @param {*} data The raw data of the guild + * @private + */ + setup(data) { + /** + * The name of the guild + * @type {string} + */ + this.name = data.name; + + /** + * The hash of the guild icon, or null if there is no icon. + * @type {?string} + */ + this.icon = data.icon; + + /** + * The hash of the guild splash image, or null if no splash (VIP only) + * @type {?string} + */ + this.splash = data.splash; + + /** + * The region the guild is located in + * @type {string} + */ + this.region = data.region; + + /** + * The full amount of members in this guild as of `READY` + * @type {number} + */ + this.memberCount = data.member_count || this.memberCount; + + /** + * Whether the guild is "large" (has more than 250 members) + * @type {boolean} + */ + this.large = Boolean('large' in data ? data.large : this.large); + + /** + * An array of guild features. + * @type {Object[]} + */ + this.features = data.features; + + /** + * The ID of the application that created this guild (if applicable) + * @type {?Snowflake} + */ + this.applicationID = data.application_id; + + /** + * A collection of emojis that are in this guild. The key is the emoji's ID, the value is the emoji. + * @type {Collection} + */ + this.emojis = new Collection(); + for (const emoji of data.emojis) this.emojis.set(emoji.id, new Emoji(this, emoji)); + + /** + * The time in seconds before a user is counted as "away from keyboard". + * @type {?number} + */ + this.afkTimeout = data.afk_timeout; + + /** + * The ID of the voice channel where AFK members are moved. + * @type {?string} + */ + this.afkChannelID = data.afk_channel_id; + + /** + * Whether embedded images are enabled on this guild. + * @type {boolean} + */ + this.embedEnabled = data.embed_enabled; + + /** + * The verification level of the guild. + * @type {number} + */ + this.verificationLevel = data.verification_level; + + /** + * The timestamp the client user joined the guild at + * @type {number} + */ + this.joinedTimestamp = data.joined_at ? new Date(data.joined_at).getTime() : this.joinedTimestamp; + + this.id = data.id; + this.available = !data.unavailable; + this.features = data.features || this.features || []; + + if (data.members) { + this.members.clear(); + for (const guildUser of data.members) this._addMember(guildUser, false); + } + + if (data.owner_id) { + /** + * The user ID of this guild's owner. + * @type {Snowflake} + */ + this.ownerID = data.owner_id; + } + + if (data.channels) { + this.channels.clear(); + for (const channel of data.channels) this.client.dataManager.newChannel(channel, this); + } + + if (data.roles) { + this.roles.clear(); + for (const role of data.roles) { + const newRole = new Role(this, role); + this.roles.set(newRole.id, newRole); + } + } + + if (data.presences) { + for (const presence of data.presences) { + this._setPresence(presence.user.id, presence); + } + } + + this._rawVoiceStates = new Collection(); + if (data.voice_states) { + for (const voiceState of data.voice_states) { + this._rawVoiceStates.set(voiceState.user_id, voiceState); + const member = this.members.get(voiceState.user_id); + if (member) { + member.serverMute = voiceState.mute; + member.serverDeaf = voiceState.deaf; + member.selfMute = voiceState.self_mute; + member.selfDeaf = voiceState.self_deaf; + member.voiceSessionID = voiceState.session_id; + member.voiceChannelID = voiceState.channel_id; + this.channels.get(voiceState.channel_id).members.set(member.user.id, member); + } + } + } + } + + /** + * The timestamp the guild was created at + * @type {number} + * @readonly + */ + get createdTimestamp() { + return Snowflake.deconstruct(this.id).timestamp; + } + + /** + * The time the guild was created + * @type {Date} + * @readonly + */ + get createdAt() { + return new Date(this.createdTimestamp); + } + + /** + * The time the client user joined the guild + * @type {Date} + * @readonly + */ + get joinedAt() { + return new Date(this.joinedTimestamp); + } + + /** + * Gets the URL to this guild's icon (if it has one, otherwise it returns null) + * @type {?string} + * @readonly + */ + get iconURL() { + if (!this.icon) return null; + return Constants.Endpoints.Guild(this).Icon(this.client.options.http.cdn, this.icon); + } + + /** + * Gets the URL to this guild's splash (if it has one, otherwise it returns null) + * @type {?string} + * @readonly + */ + get splashURL() { + if (!this.splash) return null; + return Constants.Endpoints.Guild(this).Splash(this.client.options.http.cdn, this.splash); + } + + /** + * The owner of the guild + * @type {GuildMember} + * @readonly + */ + get owner() { + return this.members.get(this.ownerID); + } + + /** + * If the client is connected to any voice channel in this guild, this will be the relevant VoiceConnection. + * @type {?VoiceConnection} + * @readonly + */ + get voiceConnection() { + if (this.client.browser) return null; + return this.client.voice.connections.get(this.id) || null; + } + + /** + * The `#general` TextChannel of the guild. + * @type {TextChannel} + * @readonly + */ + get defaultChannel() { + return this.channels.get(this.id); + } + + /** + * The `@everyone` Role of the guild. + * @type {Role} + * @readonly + */ + get defaultRole() { + return this.roles.get(this.id); + } + + /** + * Fetches a collection of roles in the current guild sorted by position. + * @type {Collection} + * @readonly + */ + get _sortedRoles() { + return this._sortPositionWithID(this.roles); + } + + /** + * Returns the GuildMember form of a User object, if the user is present in the guild. + * @param {UserResolvable} user The user that you want to obtain the GuildMember of + * @returns {?GuildMember} + * @example + * // get the guild member of a user + * const member = guild.member(message.author); + */ + member(user) { + return this.client.resolver.resolveGuildMember(this, user); + } + + /** + * Fetch a collection of banned users in this guild. + * @returns {Promise>} + */ + fetchBans() { + return this.client.rest.methods.getGuildBans(this); + } + + /** + * Fetch a collection of invites to this guild. Resolves with a collection mapping invites by their codes. + * @returns {Promise>} + */ + fetchInvites() { + return this.client.rest.methods.getGuildInvites(this); + } + + /** + * Fetch all webhooks for the guild. + * @returns {Collection} + */ + fetchWebhooks() { + return this.client.rest.methods.getGuildWebhooks(this); + } + + /** + * Fetch available voice regions + * @returns {Collection} + */ + fetchVoiceRegions() { + return this.client.rest.methods.fetchVoiceRegions(this.id); + } + + /** + * Adds a user to the guild using OAuth2. Requires the `CREATE_INSTANT_INVITE` permission. + * @param {UserResolvable} user User to add to the guild + * @param {Object} options Options for the addition + * @param {string} options.accessToken An OAuth2 access token for the user with the `guilds.join` scope granted to the + * bot's application + * @param {string} [options.nick] Nickname to give the member (requires `MANAGE_NICKNAMES`) + * @param {Collection|Role[]|Snowflake[]} [options.roles] Roles to add to the member + * (requires `MANAGE_ROLES`) + * @param {boolean} [options.mute] Whether the member should be muted (requires `MUTE_MEMBERS`) + * @param {boolean} [options.deaf] Whether the member should be deafened (requires `DEAFEN_MEMBERS`) + * @returns {Promise} + */ + addMember(user, options) { + if (this.members.has(user.id)) return Promise.resolve(this.members.get(user.id)); + return this.client.rest.methods.putGuildMember(this, user, options); + } + + /** + * Fetch a single guild member from a user. + * @param {UserResolvable} user The user to fetch the member for + * @param {boolean} [cache=true] Insert the user into the users cache + * @returns {Promise} + */ + fetchMember(user, cache = true) { + user = this.client.resolver.resolveUser(user); + if (!user) return Promise.reject(new Error('User is not cached. Use Client.fetchUser first.')); + if (this.members.has(user.id)) return Promise.resolve(this.members.get(user.id)); + return this.client.rest.methods.getGuildMember(this, user, cache); + } + + /** + * Fetches all the members in the guild, even if they are offline. If the guild has less than 250 members, + * this should not be necessary. + * @param {string} [query=''] Limit fetch to members with similar usernames + * @param {number} [limit=0] Maximum number of members to request + * @returns {Promise} + */ + fetchMembers(query = '', limit = 0) { + return new Promise((resolve, reject) => { + if (this.memberCount === this.members.size) { + // Uncomment in v12 + // resolve(this.members) + resolve(this); + return; + } + this.client.ws.send({ + op: Constants.OPCodes.REQUEST_GUILD_MEMBERS, + d: { + guild_id: this.id, + query, + limit, + }, + }); + const handler = (members, guild) => { + if (guild.id !== this.id) return; + if (this.memberCount === this.members.size || members.length < 1000) { + this.client.removeListener(Constants.Events.GUILD_MEMBERS_CHUNK, handler); + // Uncomment in v12 + // resolve(this.members) + resolve(this); + } + }; + this.client.on(Constants.Events.GUILD_MEMBERS_CHUNK, handler); + this.client.setTimeout(() => reject(new Error('Members didn\'t arrive in time.')), 120 * 1000); + }); + } + + /** + * Performs a search within the entire guild. + * @param {MessageSearchOptions} [options={}] Options to pass to the search + * @returns {Promise>} + * An array containing arrays of messages. Each inner array is a search context cluster. + * The message which has triggered the result will have the `hit` property set to `true`. + * @example + * guild.search({ + * content: 'discord.js', + * before: '2016-11-17' + * }).then(res => { + * const hit = res.messages[0].find(m => m.hit).content; + * console.log(`I found: **${hit}**, total results: ${res.totalResults}`); + * }).catch(console.error); + */ + search(options) { + return this.client.rest.methods.search(this, options); + } + + /** + * The data for editing a guild + * @typedef {Object} GuildEditData + * @property {string} [name] The name of the guild + * @property {string} [region] The region of the guild + * @property {number} [verificationLevel] The verification level of the guild + * @property {ChannelResolvable} [afkChannel] The AFK channel of the guild + * @property {number} [afkTimeout] The AFK timeout of the guild + * @property {Base64Resolvable} [icon] The icon of the guild + * @property {GuildMemberResolvable} [owner] The owner of the guild + * @property {Base64Resolvable} [splash] The splash screen of the guild + */ + + /** + * Updates the Guild with new information - e.g. a new name. + * @param {GuildEditData} data The data to update the guild with + * @returns {Promise} + * @example + * // set the guild name and region + * guild.edit({ + * name: 'Discord Guild', + * region: 'london', + * }) + * .then(updated => console.log(`New guild name ${updated.name} in region ${updated.region}`)) + * .catch(console.error); + */ + edit(data) { + return this.client.rest.methods.updateGuild(this, data); + } + + /** + * Edit the name of the guild. + * @param {string} name The new name of the guild + * @returns {Promise} + * @example + * // edit the guild name + * guild.setName('Discord Guild') + * .then(updated => console.log(`Updated guild name to ${guild.name}`)) + * .catch(console.error); + */ + setName(name) { + return this.edit({ name }); + } + + /** + * Edit the region of the guild. + * @param {string} region The new region of the guild. + * @returns {Promise} + * @example + * // edit the guild region + * guild.setRegion('london') + * .then(updated => console.log(`Updated guild region to ${guild.region}`)) + * .catch(console.error); + */ + setRegion(region) { + return this.edit({ region }); + } + + /** + * Edit the verification level of the guild. + * @param {number} verificationLevel The new verification level of the guild + * @returns {Promise} + * @example + * // edit the guild verification level + * guild.setVerificationLevel(1) + * .then(updated => console.log(`Updated guild verification level to ${guild.verificationLevel}`)) + * .catch(console.error); + */ + setVerificationLevel(verificationLevel) { + return this.edit({ verificationLevel }); + } + + /** + * Edit the AFK channel of the guild. + * @param {ChannelResolvable} afkChannel The new AFK channel + * @returns {Promise} + * @example + * // edit the guild AFK channel + * guild.setAFKChannel(channel) + * .then(updated => console.log(`Updated guild AFK channel to ${guild.afkChannel}`)) + * .catch(console.error); + */ + setAFKChannel(afkChannel) { + return this.edit({ afkChannel }); + } + + /** + * Edit the AFK timeout of the guild. + * @param {number} afkTimeout The time in seconds that a user must be idle to be considered AFK + * @returns {Promise} + * @example + * // edit the guild AFK channel + * guild.setAFKTimeout(60) + * .then(updated => console.log(`Updated guild AFK timeout to ${guild.afkTimeout}`)) + * .catch(console.error); + */ + setAFKTimeout(afkTimeout) { + return this.edit({ afkTimeout }); + } + + /** + * Set a new guild icon. + * @param {Base64Resolvable} icon The new icon of the guild + * @returns {Promise} + * @example + * // edit the guild icon + * guild.setIcon(fs.readFileSync('./icon.png')) + * .then(updated => console.log('Updated the guild icon')) + * .catch(console.error); + */ + setIcon(icon) { + return this.edit({ icon }); + } + + /** + * Sets a new owner of the guild. + * @param {GuildMemberResolvable} owner The new owner of the guild + * @returns {Promise} + * @example + * // edit the guild owner + * guild.setOwner(guilds.members[0]) + * .then(updated => console.log(`Updated the guild owner to ${updated.owner.username}`)) + * .catch(console.error); + */ + setOwner(owner) { + return this.edit({ owner }); + } + + /** + * Set a new guild splash screen. + * @param {Base64Resolvable} splash The new splash screen of the guild + * @returns {Promise} + * @example + * // edit the guild splash + * guild.setIcon(fs.readFileSync('./splash.png')) + * .then(updated => console.log('Updated the guild splash')) + * .catch(console.error); + */ + setSplash(splash) { + return this.edit({ splash }); + } + + /** + * Bans a user from the guild. + * @param {UserResolvable} user The user to ban + * @param {number} [deleteDays=0] The amount of days worth of messages from this user that should + * also be deleted. Between `0` and `7`. + * @returns {Promise} Result object will be resolved as specifically as possible. + * If the GuildMember cannot be resolved, the User will instead be attempted to be resolved. If that also cannot + * be resolved, the user ID will be the result. + * @example + * // ban a user by ID (or with a user/guild member object) + * guild.ban('some user ID') + * .then(user => console.log(`Banned ${user.username || user.id || user} from ${guild.name}`)) + * .catch(console.error); + */ + ban(user, deleteDays = 0) { + return this.client.rest.methods.banGuildMember(this, user, deleteDays); + } + + /** + * Unbans a user from the guild. + * @param {UserResolvable} user The user to unban + * @returns {Promise} + * @example + * // unban a user by ID (or with a user/guild member object) + * guild.unban('some user ID') + * .then(user => console.log(`Unbanned ${user.username} from ${guild.name}`)) + * .catch(console.error); + */ + unban(user) { + return this.client.rest.methods.unbanGuildMember(this, user); + } + + /** + * Prunes members from the guild based on how long they have been inactive. + * @param {number} days Number of days of inactivity required to kick + * @param {boolean} [dry=false] If true, will return number of users that will be kicked, without actually doing it + * @returns {Promise} The number of members that were/will be kicked + * @example + * // see how many members will be pruned + * guild.pruneMembers(12, true) + * .then(pruned => console.log(`This will prune ${pruned} people!`)) + * .catch(console.error); + * @example + * // actually prune the members + * guild.pruneMembers(12) + * .then(pruned => console.log(`I just pruned ${pruned} people!`)) + * .catch(console.error); + */ + pruneMembers(days, dry = false) { + if (typeof days !== 'number') throw new TypeError('Days must be a number.'); + return this.client.rest.methods.pruneGuildMembers(this, days, dry); + } + + /** + * Syncs this guild (already done automatically every 30 seconds). + * This is only available when using a user account. + */ + sync() { + if (!this.client.user.bot) this.client.syncGuilds([this]); + } + + /** + * Creates a new channel in the guild. + * @param {string} name The name of the new channel + * @param {string} type The type of the new channel, either `text` or `voice` + * @param {Array} overwrites Permission overwrites to apply to the new channel + * @returns {Promise} + * @example + * // create a new text channel + * guild.createChannel('new-general', 'text') + * .then(channel => console.log(`Created new channel ${channel}`)) + * .catch(console.error); + */ + createChannel(name, type, overwrites) { + return this.client.rest.methods.createChannel(this, name, type, overwrites); + } + + /** + * The data needed for updating a channel's position. + * @typedef {Object} ChannelPosition + * @property {ChannelResolvable} channel Channel to update + * @property {number} position New position for the channel + */ + + /** + * Batch-updates the guild's channels' positions. + * @param {ChannelPosition[]} channelPositions Channel positions to update + * @returns {Promise} + * @example + * guild.updateChannels([{ channel: channelID, position: newChannelIndex }]) + * .then(guild => console.log(`Updated channel positions for ${guild.id}`)) + * .catch(console.error); + */ + setChannelPositions(channelPositions) { + return this.client.rest.methods.updateChannelPositions(this.id, channelPositions); + } + + /** + * Creates a new role in the guild with given information + * @param {RoleData} [data] The data to update the role with + * @returns {Promise} + * @example + * // create a new role + * guild.createRole() + * .then(role => console.log(`Created role ${role}`)) + * .catch(console.error); + * @example + * // create a new role with data + * guild.createRole({ + * name: 'Super Cool People', + * color: 'BLUE', + * }) + * .then(role => console.log(`Created role ${role}`)) + * .catch(console.error) + */ + createRole(data = {}) { + return this.client.rest.methods.createGuildRole(this, data); + } + + /** + * Creates a new custom emoji in the guild. + * @param {BufferResolvable|Base64Resolvable} attachment The image for the emoji. + * @param {string} name The name for the emoji. + * @param {Collection|Role[]} [roles] Roles to limit the emoji to + * @returns {Promise} The created emoji. + * @example + * // create a new emoji from a url + * guild.createEmoji('https://i.imgur.com/w3duR07.png', 'rip') + * .then(emoji => console.log(`Created new emoji with name ${emoji.name}!`)) + * .catch(console.error); + * @example + * // create a new emoji from a file on your computer + * guild.createEmoji('./memes/banana.png', 'banana') + * .then(emoji => console.log(`Created new emoji with name ${emoji.name}!`)) + * .catch(console.error); + */ + createEmoji(attachment, name, roles) { + return new Promise(resolve => { + if (typeof attachment === 'string' && attachment.startsWith('data:')) { + resolve(this.client.rest.methods.createEmoji(this, attachment, name, roles)); + } else { + this.client.resolver.resolveBuffer(attachment).then(data => { + const dataURI = this.client.resolver.resolveBase64(data); + resolve(this.client.rest.methods.createEmoji(this, dataURI, name, roles)); + }); + } + }); + } + + /** + * Delete an emoji. + * @param {Emoji|string} emoji The emoji to delete. + * @returns {Promise} + */ + deleteEmoji(emoji) { + if (!(emoji instanceof Emoji)) emoji = this.emojis.get(emoji); + return this.client.rest.methods.deleteEmoji(emoji); + } + + /** + * Causes the Client to leave the guild. + * @returns {Promise} + * @example + * // leave a guild + * guild.leave() + * .then(g => console.log(`Left the guild ${g}`)) + * .catch(console.error); + */ + leave() { + return this.client.rest.methods.leaveGuild(this); + } + + /** + * Causes the Client to delete the guild. + * @returns {Promise} + * @example + * // delete a guild + * guild.delete() + * .then(g => console.log(`Deleted the guild ${g}`)) + * .catch(console.error); + */ + delete() { + return this.client.rest.methods.deleteGuild(this); + } + + /** + * Marks all messages in this guild as read + * This is only available when using a user account. + * @returns {Promise} this guild + */ + acknowledge() { + return this.client.rest.methods.ackGuild(this); + } + + /** + * Whether this Guild equals another Guild. It compares all properties, so for most operations + * it is advisable to just compare `guild.id === guild2.id` as it is much faster and is often + * what most users need. + * @param {Guild} guild Guild to compare with + * @returns {boolean} + */ + equals(guild) { + let equal = + guild && + this.id === guild.id && + this.available === !guild.unavailable && + this.splash === guild.splash && + this.region === guild.region && + this.name === guild.name && + this.memberCount === guild.member_count && + this.large === guild.large && + this.icon === guild.icon && + Util.arraysEqual(this.features, guild.features) && + this.ownerID === guild.owner_id && + this.verificationLevel === guild.verification_level && + this.embedEnabled === guild.embed_enabled; + + if (equal) { + if (this.embedChannel) { + if (this.embedChannel.id !== guild.embed_channel_id) equal = false; + } else if (guild.embed_channel_id) { + equal = false; + } + } + + return equal; + } + + /** + * When concatenated with a string, this automatically concatenates the guild's name instead of the Guild object. + * @returns {string} + * @example + * // logs: Hello from My Guild! + * console.log(`Hello from ${guild}!`); + * @example + * // logs: Hello from My Guild! + * console.log(`Hello from ' + guild + '!'); + */ + toString() { + return this.name; + } + + _addMember(guildUser, emitEvent = true) { + const existing = this.members.has(guildUser.user.id); + if (!(guildUser.user instanceof User)) guildUser.user = this.client.dataManager.newUser(guildUser.user); + + guildUser.joined_at = guildUser.joined_at || 0; + const member = new GuildMember(this, guildUser); + this.members.set(member.id, member); + + if (this._rawVoiceStates && this._rawVoiceStates.has(member.user.id)) { + const voiceState = this._rawVoiceStates.get(member.user.id); + member.serverMute = voiceState.mute; + member.serverDeaf = voiceState.deaf; + member.selfMute = voiceState.self_mute; + member.selfDeaf = voiceState.self_deaf; + member.voiceSessionID = voiceState.session_id; + member.voiceChannelID = voiceState.channel_id; + if (this.client.channels.has(voiceState.channel_id)) { + this.client.channels.get(voiceState.channel_id).members.set(member.user.id, member); + } else { + this.client.emit('warn', `Member ${member.id} added in guild ${this.id} with an uncached voice channel`); + } + } + + /** + * Emitted whenever a user joins a guild. + * @event Client#guildMemberAdd + * @param {GuildMember} member The member that has joined a guild + */ + if (this.client.ws.status === Constants.Status.READY && emitEvent && !existing) { + this.client.emit(Constants.Events.GUILD_MEMBER_ADD, member); + } + + return member; + } + + _updateMember(member, data) { + const oldMember = Util.cloneObject(member); + + if (data.roles) member._roles = data.roles; + if (typeof data.nick !== 'undefined') member.nickname = data.nick; + + const notSame = member.nickname !== oldMember.nickname || !Util.arraysEqual(member._roles, oldMember._roles); + + if (this.client.ws.status === Constants.Status.READY && notSame) { + /** + * Emitted whenever a guild member changes - i.e. new role, removed role, nickname + * @event Client#guildMemberUpdate + * @param {GuildMember} oldMember The member before the update + * @param {GuildMember} newMember The member after the update + */ + this.client.emit(Constants.Events.GUILD_MEMBER_UPDATE, oldMember, member); + } + + return { + old: oldMember, + mem: member, + }; + } + + _removeMember(guildMember) { + this.members.delete(guildMember.id); + } + + _memberSpeakUpdate(user, speaking) { + const member = this.members.get(user); + if (member && member.speaking !== speaking) { + member.speaking = speaking; + /** + * Emitted once a guild member starts/stops speaking + * @event Client#guildMemberSpeaking + * @param {GuildMember} member The member that started/stopped speaking + * @param {boolean} speaking Whether or not the member is speaking + */ + this.client.emit(Constants.Events.GUILD_MEMBER_SPEAKING, member, speaking); + } + } + + _setPresence(id, presence) { + if (this.presences.get(id)) { + this.presences.get(id).update(presence); + return; + } + this.presences.set(id, new Presence(presence)); + } + + /** + * Set the position of a role in this guild + * @param {string|Role} role The role to edit, can be a role object or a role ID. + * @param {number} position The new position of the role + * @param {boolean} [relative=false] Position Moves the role relative to its current position + * @returns {Promise} + */ + setRolePosition(role, position, relative = false) { + if (typeof role === 'string') { + role = this.roles.get(role); + if (!role) return Promise.reject(new Error('Supplied role is not a role or snowflake.')); + } + + position = Number(position); + if (isNaN(position)) return Promise.reject(new Error('Supplied position is not a number.')); + + let updatedRoles = this._sortedRoles().array(); + + Util.moveElementInArray(updatedRoles, role, position, relative); + + updatedRoles = updatedRoles.map((r, i) => ({ id: r.id, position: i })); + return this.client.rest.methods.setRolePositions(this.id, updatedRoles); + } + + /** + * Set the position of a channel in this guild + * @param {string|GuildChannel} channel The channel to edit, can be a channel object or a channel ID. + * @param {number} position The new position of the channel + * @param {boolean} [relative=false] Position Moves the channel relative to its current position + * @returns {Promise} + */ + setChannelPosition(channel, position, relative = false) { + if (typeof channel === 'string') { + channel = this.channels.get(channel); + if (!channel) return Promise.reject(new Error('Supplied channel is not a channel or snowflake.')); + } + + position = Number(position); + if (isNaN(position)) return Promise.reject(new Error('Supplied position is not a number.')); + + let updatedChannels = this._sortedChannels(channel.type).array(); + + Util.moveElementInArray(updatedChannels, channel, position, relative); + + updatedChannels = updatedChannels.map((r, i) => ({ id: r.id, position: i })); + return this.client.rest.methods.setChannelPositions(this.id, updatedChannels); + } + + /** + * Fetches a collection of channels in the current guild sorted by position. + * @param {string} type Channel type + * @returns {Collection} + */ + _sortedChannels(type) { + return this._sortPositionWithID(this.channels.filter(c => { + if (type === 'voice' && c.type === 'voice') return true; + else if (type !== 'voice' && c.type !== 'voice') return true; + else return type === c.type; + })); + } + + /** + * Sorts a collection by object position or ID if the positions are equivalent. + * Intended to be identical to Discord's sorting method. + * @param {Collection} collection The collection to sort + * @returns {Collection} + */ + _sortPositionWithID(collection) { + return collection.sort((a, b) => + a.position !== b.position ? + a.position - b.position : + Long.fromString(a.id).sub(Long.fromString(b.id)).toNumber() + ); + } +} + +module.exports = Guild; + + +/***/ }), +/* 18 */ +/***/ (function(module, exports, __webpack_require__) { + +const Channel = __webpack_require__(8); +const Role = __webpack_require__(10); +const PermissionOverwrites = __webpack_require__(39); +const Permissions = __webpack_require__(6); +const Collection = __webpack_require__(3); + +/** + * Represents a guild channel (i.e. text channels and voice channels) + * @extends {Channel} + */ +class GuildChannel extends Channel { + constructor(guild, data) { + super(guild.client, data); + + /** + * The guild the channel is in + * @type {Guild} + */ + this.guild = guild; + } + + setup(data) { + super.setup(data); + + /** + * The name of the guild channel + * @type {string} + */ + this.name = data.name; + + /** + * The position of the channel in the list. + * @type {number} + */ + this.position = data.position; + + /** + * A map of permission overwrites in this channel for roles and users. + * @type {Collection} + */ + this.permissionOverwrites = new Collection(); + if (data.permission_overwrites) { + for (const overwrite of data.permission_overwrites) { + this.permissionOverwrites.set(overwrite.id, new PermissionOverwrites(this, overwrite)); + } + } + } + + /** + * The position of the channel + * @type {number} + */ + get calculatedPosition() { + const sorted = this.guild._sortedChannels(this.type); + return sorted.array().indexOf(sorted.get(this.id)); + } + + /** + * Gets the overall set of permissions for a user in this channel, taking into account roles and permission + * overwrites. + * @param {GuildMemberResolvable} member The user that you want to obtain the overall permissions for + * @returns {?Permissions} + */ + permissionsFor(member) { + member = this.client.resolver.resolveGuildMember(this.guild, member); + if (!member) return null; + if (member.id === this.guild.ownerID) return new Permissions(member, Permissions.ALL); + + let permissions = 0; + + const roles = member.roles; + for (const role of roles.values()) permissions |= role.permissions; + + const overwrites = this.overwritesFor(member, true, roles); + + if (overwrites.everyone) { + permissions &= ~overwrites.everyone.deny; + permissions |= overwrites.everyone.allow; + } + + let allow = 0; + for (const overwrite of overwrites.roles) { + permissions &= ~overwrite.deny; + allow |= overwrite.allow; + } + permissions |= allow; + + if (overwrites.member) { + permissions &= ~overwrites.member.deny; + permissions |= overwrites.member.allow; + } + + const admin = Boolean(permissions & Permissions.FLAGS.ADMINISTRATOR); + if (admin) permissions = Permissions.ALL; + + return new Permissions(member, permissions); + } + + overwritesFor(member, verified = false, roles = null) { + if (!verified) member = this.client.resolver.resolveGuildMember(this.guild, member); + if (!member) return []; + + roles = roles || member.roles; + const roleOverwrites = []; + let memberOverwrites; + let everyoneOverwrites; + + for (const overwrite of this.permissionOverwrites.values()) { + if (overwrite.id === this.guild.id) { + everyoneOverwrites = overwrite; + } else if (roles.has(overwrite.id)) { + roleOverwrites.push(overwrite); + } else if (overwrite.id === member.id) { + memberOverwrites = overwrite; + } + } + + return { + everyone: everyoneOverwrites, + roles: roleOverwrites, + member: memberOverwrites, + }; + } + + /** + * An object mapping permission flags to `true` (enabled) or `false` (disabled) + * ```js + * { + * 'SEND_MESSAGES': true, + * 'ATTACH_FILES': false, + * } + * ``` + * @typedef {Object} PermissionOverwriteOptions + */ + + /** + * Overwrites the permissions for a user or role in this channel. + * @param {RoleResolvable|UserResolvable} userOrRole The user or role to update + * @param {PermissionOverwriteOptions} options The configuration for the update + * @returns {Promise} + * @example + * // overwrite permissions for a message author + * message.channel.overwritePermissions(message.author, { + * SEND_MESSAGES: false + * }) + * .then(() => console.log('Done!')) + * .catch(console.error); + */ + overwritePermissions(userOrRole, options) { + const payload = { + allow: 0, + deny: 0, + }; + + if (userOrRole instanceof Role) { + payload.type = 'role'; + } else if (this.guild.roles.has(userOrRole)) { + userOrRole = this.guild.roles.get(userOrRole); + payload.type = 'role'; + } else { + userOrRole = this.client.resolver.resolveUser(userOrRole); + payload.type = 'member'; + if (!userOrRole) return Promise.reject(new TypeError('Supplied parameter was neither a User nor a Role.')); + } + + payload.id = userOrRole.id; + + const prevOverwrite = this.permissionOverwrites.get(userOrRole.id); + + if (prevOverwrite) { + payload.allow = prevOverwrite.allow; + payload.deny = prevOverwrite.deny; + } + + for (const perm in options) { + if (options[perm] === true) { + payload.allow |= Permissions.FLAGS[perm] || 0; + payload.deny &= ~(Permissions.FLAGS[perm] || 0); + } else if (options[perm] === false) { + payload.allow &= ~(Permissions.FLAGS[perm] || 0); + payload.deny |= Permissions.FLAGS[perm] || 0; + } else if (options[perm] === null) { + payload.allow &= ~(Permissions.FLAGS[perm] || 0); + payload.deny &= ~(Permissions.FLAGS[perm] || 0); + } + } + + return this.client.rest.methods.setChannelOverwrite(this, payload); + } + + /** + * The data for a guild channel + * @typedef {Object} ChannelData + * @property {string} [name] The name of the channel + * @property {number} [position] The position of the channel + * @property {string} [topic] The topic of the text channel + * @property {number} [bitrate] The bitrate of the voice channel + * @property {number} [userLimit] The user limit of the channel + */ + + /** + * Edits the channel + * @param {ChannelData} data The new data for the channel + * @returns {Promise} + * @example + * // edit a channel + * channel.edit({name: 'new-channel'}) + * .then(c => console.log(`Edited channel ${c}`)) + * .catch(console.error); + */ + edit(data) { + return this.client.rest.methods.updateChannel(this, data); + } + + /** + * Set a new name for the guild channel + * @param {string} name The new name for the guild channel + * @returns {Promise} + * @example + * // set a new channel name + * channel.setName('not_general') + * .then(newChannel => console.log(`Channel's new name is ${newChannel.name}`)) + * .catch(console.error); + */ + setName(name) { + return this.edit({ name }); + } + + /** + * Set a new position for the guild channel + * @param {number} position The new position for the guild channel + * @param {boolean} [relative=false] Move the position relative to its current value + * @returns {Promise} + * @example + * // set a new channel position + * channel.setPosition(2) + * .then(newChannel => console.log(`Channel's new position is ${newChannel.position}`)) + * .catch(console.error); + */ + setPosition(position, relative) { + return this.guild.setChannelPosition(this, position, relative).then(() => this); + } + + /** + * Set a new topic for the guild channel + * @param {string} topic The new topic for the guild channel + * @returns {Promise} + * @example + * // set a new channel topic + * channel.setTopic('needs more rate limiting') + * .then(newChannel => console.log(`Channel's new topic is ${newChannel.topic}`)) + * .catch(console.error); + */ + setTopic(topic) { + return this.client.rest.methods.updateChannel(this, { topic }); + } + + /** + * Options given when creating a guild channel invite + * @typedef {Object} InviteOptions + + */ + + /** + * Create an invite to this guild channel + * @param {InviteOptions} [options={}] Options for the invite + * @param {boolean} [options.temporary=false] Whether members that joined via the invite should be automatically + * kicked after 24 hours if they have not yet received a role + * @param {number} [options.maxAge=86400] How long the invite should last (in seconds, 0 for forever) + * @param {number} [options.maxUses=0] Maximum number of uses + * @returns {Promise} + */ + createInvite(options = {}) { + return this.client.rest.methods.createChannelInvite(this, options); + } + + /** + * Clone this channel + * @param {string} [name=this.name] Optional name for the new channel, otherwise it has the name of this channel + * @param {boolean} [withPermissions=true] Whether to clone the channel with this channel's permission overwrites + * @param {boolean} [withTopic=true] Whether to clone the channel with this channel's topic + * @returns {Promise} + */ + clone(name = this.name, withPermissions = true, withTopic = true) { + return this.guild.createChannel(name, this.type, withPermissions ? this.permissionOverwrites : []) + .then(channel => withTopic ? channel.setTopic(this.topic) : channel); + } + + /** + * Checks if this channel has the same type, topic, position, name, overwrites and ID as another channel. + * In most cases, a simple `channel.id === channel2.id` will do, and is much faster too. + * @param {GuildChannel} channel Channel to compare with + * @returns {boolean} + */ + equals(channel) { + let equal = channel && + this.id === channel.id && + this.type === channel.type && + this.topic === channel.topic && + this.position === channel.position && + this.name === channel.name; + + if (equal) { + if (this.permissionOverwrites && channel.permissionOverwrites) { + equal = this.permissionOverwrites.equals(channel.permissionOverwrites); + } else { + equal = !this.permissionOverwrites && !channel.permissionOverwrites; + } + } + + return equal; + } + + /** + * Whether the channel is deletable by the client user. + * @type {boolean} + * @readonly + */ + get deletable() { + return this.id !== this.guild.id && + this.permissionsFor(this.client.user).hasPermission(Permissions.FLAGS.MANAGE_CHANNELS); + } + + /** + * When concatenated with a string, this automatically returns the channel's mention instead of the Channel object. + * @returns {string} + * @example + * // Outputs: Hello from #general + * console.log(`Hello from ${channel}`); + * @example + * // Outputs: Hello from #general + * console.log('Hello from ' + channel); + */ + toString() { + return `<#${this.id}>`; + } +} + +module.exports = GuildChannel; + + +/***/ }), +/* 19 */ +/***/ (function(module, exports, __webpack_require__) { + +/* WEBPACK VAR INJECTION */(function(process) {// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +// resolves . and .. elements in a path array with directory names there +// must be no slashes, empty elements, or device names (c:\) in the array +// (so also no leading and trailing slashes - it does not distinguish +// relative and absolute paths) +function normalizeArray(parts, allowAboveRoot) { + // if the path tries to go above the root, `up` ends up > 0 + var up = 0; + for (var i = parts.length - 1; i >= 0; i--) { + var last = parts[i]; + if (last === '.') { + parts.splice(i, 1); + } else if (last === '..') { + parts.splice(i, 1); + up++; + } else if (up) { + parts.splice(i, 1); + up--; + } + } + + // if the path is allowed to go above the root, restore leading ..s + if (allowAboveRoot) { + for (; up--; up) { + parts.unshift('..'); + } + } + + return parts; +} + +// Split a filename into [root, dir, basename, ext], unix version +// 'root' is just a slash, or nothing. +var splitPathRe = + /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/; +var splitPath = function(filename) { + return splitPathRe.exec(filename).slice(1); +}; + +// path.resolve([from ...], to) +// posix version +exports.resolve = function() { + var resolvedPath = '', + resolvedAbsolute = false; + + for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) { + var path = (i >= 0) ? arguments[i] : process.cwd(); + + // Skip empty and invalid entries + if (typeof path !== 'string') { + throw new TypeError('Arguments to path.resolve must be strings'); + } else if (!path) { + continue; + } + + resolvedPath = path + '/' + resolvedPath; + resolvedAbsolute = path.charAt(0) === '/'; + } + + // At this point the path should be resolved to a full absolute path, but + // handle relative paths to be safe (might happen when process.cwd() fails) + + // Normalize the path + resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) { + return !!p; + }), !resolvedAbsolute).join('/'); + + return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.'; +}; + +// path.normalize(path) +// posix version +exports.normalize = function(path) { + var isAbsolute = exports.isAbsolute(path), + trailingSlash = substr(path, -1) === '/'; + + // Normalize the path + path = normalizeArray(filter(path.split('/'), function(p) { + return !!p; + }), !isAbsolute).join('/'); + + if (!path && !isAbsolute) { + path = '.'; + } + if (path && trailingSlash) { + path += '/'; + } + + return (isAbsolute ? '/' : '') + path; +}; + +// posix version +exports.isAbsolute = function(path) { + return path.charAt(0) === '/'; +}; + +// posix version +exports.join = function() { + var paths = Array.prototype.slice.call(arguments, 0); + return exports.normalize(filter(paths, function(p, index) { + if (typeof p !== 'string') { + throw new TypeError('Arguments to path.join must be strings'); + } + return p; + }).join('/')); +}; + + +// path.relative(from, to) +// posix version +exports.relative = function(from, to) { + from = exports.resolve(from).substr(1); + to = exports.resolve(to).substr(1); + + function trim(arr) { + var start = 0; + for (; start < arr.length; start++) { + if (arr[start] !== '') break; + } + + var end = arr.length - 1; + for (; end >= 0; end--) { + if (arr[end] !== '') break; + } + + if (start > end) return []; + return arr.slice(start, end - start + 1); + } + + var fromParts = trim(from.split('/')); + var toParts = trim(to.split('/')); + + var length = Math.min(fromParts.length, toParts.length); + var samePartsLength = length; + for (var i = 0; i < length; i++) { + if (fromParts[i] !== toParts[i]) { + samePartsLength = i; + break; + } + } + + var outputParts = []; + for (var i = samePartsLength; i < fromParts.length; i++) { + outputParts.push('..'); + } + + outputParts = outputParts.concat(toParts.slice(samePartsLength)); + + return outputParts.join('/'); +}; + +exports.sep = '/'; +exports.delimiter = ':'; + +exports.dirname = function(path) { + var result = splitPath(path), + root = result[0], + dir = result[1]; + + if (!root && !dir) { + // No dirname whatsoever + return '.'; + } + + if (dir) { + // It has a dirname, strip trailing slash + dir = dir.substr(0, dir.length - 1); + } + + return root + dir; +}; + + +exports.basename = function(path, ext) { + var f = splitPath(path)[2]; + // TODO: make this comparison case-insensitive on windows? + if (ext && f.substr(-1 * ext.length) === ext) { + f = f.substr(0, f.length - ext.length); + } + return f; +}; + + +exports.extname = function(path) { + return splitPath(path)[3]; +}; + +function filter (xs, f) { + if (xs.filter) return xs.filter(f); + var res = []; + for (var i = 0; i < xs.length; i++) { + if (f(xs[i], i, xs)) res.push(xs[i]); + } + return res; +} + +// String.prototype.substr - negative index don't work in IE8 +var substr = 'ab'.substr(-1) === 'b' + ? function (str, start, len) { return str.substr(start, len) } + : function (str, start, len) { + if (start < 0) start = str.length + start; + return str.substr(start, len); + } +; + +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(20))) + +/***/ }), +/* 20 */ +/***/ (function(module, exports) { + +// shim for using process in browser +var process = module.exports = {}; + +// cached from whatever global is present so that test runners that stub it +// don't break things. But we need to wrap it in a try catch in case it is +// wrapped in strict mode code which doesn't define any globals. It's inside a +// function because try/catches deoptimize in certain engines. + +var cachedSetTimeout; +var cachedClearTimeout; + +function defaultSetTimout() { + throw new Error('setTimeout has not been defined'); +} +function defaultClearTimeout () { + throw new Error('clearTimeout has not been defined'); +} +(function () { + try { + if (typeof setTimeout === 'function') { + cachedSetTimeout = setTimeout; + } else { + cachedSetTimeout = defaultSetTimout; + } + } catch (e) { + cachedSetTimeout = defaultSetTimout; + } + try { + if (typeof clearTimeout === 'function') { + cachedClearTimeout = clearTimeout; + } else { + cachedClearTimeout = defaultClearTimeout; + } + } catch (e) { + cachedClearTimeout = defaultClearTimeout; + } +} ()) +function runTimeout(fun) { + if (cachedSetTimeout === setTimeout) { + //normal enviroments in sane situations + return setTimeout(fun, 0); + } + // if setTimeout wasn't available but was latter defined + if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { + cachedSetTimeout = setTimeout; + return setTimeout(fun, 0); + } + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedSetTimeout(fun, 0); + } catch(e){ + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedSetTimeout.call(null, fun, 0); + } catch(e){ + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error + return cachedSetTimeout.call(this, fun, 0); + } + } + + +} +function runClearTimeout(marker) { + if (cachedClearTimeout === clearTimeout) { + //normal enviroments in sane situations + return clearTimeout(marker); + } + // if clearTimeout wasn't available but was latter defined + if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { + cachedClearTimeout = clearTimeout; + return clearTimeout(marker); + } + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedClearTimeout(marker); + } catch (e){ + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedClearTimeout.call(null, marker); + } catch (e){ + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. + // Some versions of I.E. have different rules for clearTimeout vs setTimeout + return cachedClearTimeout.call(this, marker); + } + } + + + +} +var queue = []; +var draining = false; +var currentQueue; +var queueIndex = -1; + +function cleanUpNextTick() { + if (!draining || !currentQueue) { + return; + } + draining = false; + if (currentQueue.length) { + queue = currentQueue.concat(queue); + } else { + queueIndex = -1; + } + if (queue.length) { + drainQueue(); + } +} + +function drainQueue() { + if (draining) { + return; + } + var timeout = runTimeout(cleanUpNextTick); + draining = true; + + var len = queue.length; + while(len) { + currentQueue = queue; + queue = []; + while (++queueIndex < len) { + if (currentQueue) { + currentQueue[queueIndex].run(); + } + } + queueIndex = -1; + len = queue.length; + } + currentQueue = null; + draining = false; + runClearTimeout(timeout); +} + +process.nextTick = function (fun) { + var args = new Array(arguments.length - 1); + if (arguments.length > 1) { + for (var i = 1; i < arguments.length; i++) { + args[i - 1] = arguments[i]; + } + } + queue.push(new Item(fun, args)); + if (queue.length === 1 && !draining) { + runTimeout(drainQueue); + } +}; + +// v8 likes predictible objects +function Item(fun, array) { + this.fun = fun; + this.array = array; +} +Item.prototype.run = function () { + this.fun.apply(null, this.array); +}; +process.title = 'browser'; +process.browser = true; +process.env = {}; +process.argv = []; +process.version = ''; // empty string to avoid regexp issues +process.versions = {}; + +function noop() {} + +process.on = noop; +process.addListener = noop; +process.once = noop; +process.off = noop; +process.removeListener = noop; +process.removeAllListeners = noop; +process.emit = noop; + +process.binding = function (name) { + throw new Error('process.binding is not supported'); +}; + +process.cwd = function () { return '/' }; +process.chdir = function (dir) { + throw new Error('process.chdir is not supported'); +}; +process.umask = function() { return 0; }; + + +/***/ }), +/* 21 */ +/***/ (function(module, exports, __webpack_require__) { + +const Channel = __webpack_require__(8); +const TextBasedChannel = __webpack_require__(15); +const Collection = __webpack_require__(3); + +/* +{ type: 3, + recipients: + [ { username: 'Charlie', + id: '123', + discriminator: '6631', + avatar: '123' }, + { username: 'Ben', + id: '123', + discriminator: '2055', + avatar: '123' }, + { username: 'Adam', + id: '123', + discriminator: '2406', + avatar: '123' } ], + owner_id: '123', + name: null, + last_message_id: '123', + id: '123', + icon: null } +*/ + +/** + * Represents a Group DM on Discord + * @extends {Channel} + * @implements {TextBasedChannel} + */ +class GroupDMChannel extends Channel { + constructor(client, data) { + super(client, data); + this.type = 'group'; + this.messages = new Collection(); + this._typing = new Map(); + } + + setup(data) { + super.setup(data); + + /** + * The name of this Group DM, can be null if one isn't set. + * @type {string} + */ + this.name = data.name; + + /** + * A hash of the Group DM icon. + * @type {string} + */ + this.icon = data.icon; + + /** + * The user ID of this Group DM's owner. + * @type {string} + */ + this.ownerID = data.owner_id; + + /** + * If the dm is managed by an application + * @type {boolean} + */ + this.managed = data.managed; + + /** + * Application ID of the application that made this group dm, if applicable + * @type {?string} + */ + this.applicationID = data.application_id; + + /** + * Nicknames for group members + * @type {?Collection} + */ + if (data.nicks) this.nicks = new Collection(data.nicks.map(n => [n.id, n.nick])); + + if (!this.recipients) { + /** + * A collection of the recipients of this DM, mapped by their ID. + * @type {Collection} + */ + this.recipients = new Collection(); + } + + if (data.recipients) { + for (const recipient of data.recipients) { + const user = this.client.dataManager.newUser(recipient); + this.recipients.set(user.id, user); + } + } + + this.lastMessageID = data.last_message_id; + } + + /** + * The owner of this Group DM. + * @type {User} + * @readonly + */ + get owner() { + return this.client.users.get(this.ownerID); + } + + /** + * Whether this channel equals another channel. It compares all properties, so for most operations + * it is advisable to just compare `channel.id === channel2.id` as it is much faster and is often + * what most users need. + * @param {GroupDMChannel} channel Channel to compare with + * @returns {boolean} + */ + equals(channel) { + const equal = channel && + this.id === channel.id && + this.name === channel.name && + this.icon === channel.icon && + this.ownerID === channel.ownerID; + + if (equal) { + return this.recipients.equals(channel.recipients); + } + + return equal; + } + + /** + * Add a user to the dm + * @param {UserResolvable|String} accessTokenOrID Access token or user resolvable + * @param {string} [nick] Permanent nickname to give the user (only available if a bot is creating the dm) + */ + + addUser(accessTokenOrID, nick) { + return this.client.rest.methods.addUserToGroupDM(this, { + nick, + id: this.client.resolver.resolveUserID(accessTokenOrID), + accessToken: accessTokenOrID, + }); + } + + /** + * When concatenated with a string, this automatically concatenates the channel's name instead of the Channel object. + * @returns {string} + * @example + * // logs: Hello from My Group DM! + * console.log(`Hello from ${channel}!`); + * @example + * // logs: Hello from My Group DM! + * console.log(`Hello from ' + channel + '!'); + */ + toString() { + return this.name; + } + + // These are here only for documentation purposes - they are implemented by TextBasedChannel + /* eslint-disable no-empty-function */ + send() {} + sendMessage() {} + sendEmbed() {} + sendFile() {} + sendFiles() {} + sendCode() {} + fetchMessage() {} + fetchMessages() {} + fetchPinnedMessages() {} + search() {} + startTyping() {} + stopTyping() {} + get typing() {} + get typingCount() {} + createCollector() {} + awaitMessages() {} + // Doesn't work on group DMs; bulkDelete() {} + acknowledge() {} + _cacheMessage() {} +} + +TextBasedChannel.applyToClass(GroupDMChannel, true, ['bulkDelete']); + +module.exports = GroupDMChannel; + + +/***/ }), +/* 22 */ +/***/ (function(module, exports) { + +/** + * Represents a limited emoji set used for both custom and unicode emojis. Custom emojis + * will use this class opposed to the Emoji class when the client doesn't know enough + * information about them. + */ +class ReactionEmoji { + constructor(reaction, name, id) { + /** + * The message reaction this emoji refers to + * @type {MessageReaction} + */ + this.reaction = reaction; + + /** + * The name of this reaction emoji. + * @type {string} + */ + this.name = name; + + /** + * The ID of this reaction emoji. + * @type {?Snowflake} + */ + this.id = id; + } + + /** + * The identifier of this emoji, used for message reactions + * @type {string} + * @readonly + */ + get identifier() { + if (this.id) return `${this.name}:${this.id}`; + return encodeURIComponent(this.name); + } + + /** + * Creates the text required to form a graphical emoji on Discord. + * @example + * // send the emoji used in a reaction to the channel the reaction is part of + * reaction.message.channel.sendMessage(`The emoji used is ${reaction.emoji}`); + * @returns {string} + */ + toString() { + return this.id ? `<:${this.name}:${this.id}>` : this.name; + } +} + +module.exports = ReactionEmoji; + /***/ }), /* 23 */ +/***/ (function(module, exports, __webpack_require__) { + +const path = __webpack_require__(19); + +/** + * Represents a webhook + */ +class Webhook { + constructor(client, dataOrID, token) { + if (client) { + /** + * The Client that instantiated the Webhook + * @name Webhook#client + * @type {Client} + * @readonly + */ + Object.defineProperty(this, 'client', { value: client }); + if (dataOrID) this.setup(dataOrID); + } else { + this.id = dataOrID; + this.token = token; + Object.defineProperty(this, 'client', { value: this }); + } + } + + setup(data) { + /** + * The name of the webhook + * @type {string} + */ + this.name = data.name; + + /** + * The token for the webhook + * @type {string} + */ + this.token = data.token; + + /** + * The avatar for the webhook + * @type {string} + */ + this.avatar = data.avatar; + + /** + * The ID of the webhook + * @type {Snowflake} + */ + this.id = data.id; + + /** + * The guild the webhook belongs to + * @type {Snowflake} + */ + this.guildID = data.guild_id; + + /** + * The channel the webhook belongs to + * @type {Snowflake} + */ + this.channelID = data.channel_id; + + if (data.user) { + /** + * The owner of the webhook + * @type {?User|Object} + */ + this.owner = this.client.users ? this.client.users.get(data.user.id) : data.user; + } else { + this.owner = null; + } + } + + /** + * Options that can be passed into send, sendMessage, sendFile, sendEmbed, and sendCode + * @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} [file] A file 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. + */ + + /** + * Send a message with this webhook + * @param {StringResolvable} content The content to send. + * @param {WebhookMessageOptions} [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); + */ + send(content, options) { + if (!options && typeof content === 'object' && !(content instanceof Array)) { + options = content; + content = ''; + } else if (!options) { + options = {}; + } + if (options.file) { + if (typeof options.file === 'string') options.file = { attachment: options.file }; + if (!options.file.name) { + if (typeof options.file.attachment === 'string') { + options.file.name = path.basename(options.file.attachment); + } else if (options.file.attachment && options.file.attachment.path) { + options.file.name = path.basename(options.file.attachment.path); + } else { + options.file.name = 'file.jpg'; + } + } + return this.client.resolver.resolveBuffer(options.file.attachment).then(file => + this.client.rest.methods.sendWebhookMessage(this, content, options, { + file, + name: options.file.name, + }) + ); + } + return this.client.rest.methods.sendWebhookMessage(this, content, options); + } + + /** + * Send a message with this webhook + * @param {StringResolvable} content The content to send. + * @param {WebhookMessageOptions} [options={}] The options to provide. + * @returns {Promise} + * @example + * // send a message + * webhook.sendMessage('hello!') + * .then(message => console.log(`Sent message: ${message.content}`)) + * .catch(console.error); + */ + sendMessage(content, options = {}) { + return this.send(content, options); + } + + /** + * Send a file with this webhook + * @param {BufferResolvable} attachment The file to send + * @param {string} [name='file.jpg'] The name and extension of the file + * @param {StringResolvable} [content] Text message to send with the attachment + * @param {WebhookMessageOptions} [options] The options to provide + * @returns {Promise} + */ + sendFile(attachment, name, content, options = {}) { + return this.send(content, Object.assign(options, { file: { attachment, name } })); + } + + /** + * Send a code block with this webhook + * @param {string} lang Language for the code block + * @param {StringResolvable} content Content of the code block + * @param {WebhookMessageOptions} options The options to provide + * @returns {Promise} + */ + sendCode(lang, content, options = {}) { + return this.send(content, Object.assign(options, { code: lang })); + } + + /** + * Send a raw slack message with this webhook + * @param {Object} body The raw body to send. + * @returns {Promise} + * @example + * // send a slack message + * webhook.sendSlackMessage({ + * 'username': 'Wumpus', + * 'attachments': [{ + * 'pretext': 'this looks pretty cool', + * 'color': '#F0F', + * 'footer_icon': 'http://snek.s3.amazonaws.com/topSnek.png', + * 'footer': 'Powered by sneks', + * 'ts': Date.now() / 1000 + * }] + * }).catch(console.error); + */ + sendSlackMessage(body) { + return this.client.rest.methods.sendSlackWebhookMessage(this, body); + } + + /** + * Edit the webhook. + * @param {string} name The new name for the Webhook + * @param {BufferResolvable} avatar The new avatar for the Webhook. + * @returns {Promise} + */ + edit(name = this.name, avatar) { + if (avatar) { + return this.client.resolver.resolveBuffer(avatar).then(file => { + const dataURI = this.client.resolver.resolveBase64(file); + return this.client.rest.methods.editWebhook(this, name, dataURI); + }); + } + return this.client.rest.methods.editWebhook(this, name).then(data => { + this.setup(data); + return this; + }); + } + + /** + * Delete the webhook + * @returns {Promise} + */ + delete() { + return this.client.rest.methods.deleteWebhook(this); + } +} + +module.exports = Webhook; + + +/***/ }), +/* 24 */ /***/ (function(module, exports) { // Copyright Joyent, Inc. and other Node contributors. @@ -8191,7 +8422,7 @@ function isUndefined(arg) { /***/ }), -/* 24 */ +/* 25 */ /***/ (function(module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* @@ -9408,1201 +9639,171 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ }); -/***/ }), -/* 25 */ -/***/ (function(module, exports, __webpack_require__) { - -/* WEBPACK VAR INJECTION */(function(process) {// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -// resolves . and .. elements in a path array with directory names there -// must be no slashes, empty elements, or device names (c:\) in the array -// (so also no leading and trailing slashes - it does not distinguish -// relative and absolute paths) -function normalizeArray(parts, allowAboveRoot) { - // if the path tries to go above the root, `up` ends up > 0 - var up = 0; - for (var i = parts.length - 1; i >= 0; i--) { - var last = parts[i]; - if (last === '.') { - parts.splice(i, 1); - } else if (last === '..') { - parts.splice(i, 1); - up++; - } else if (up) { - parts.splice(i, 1); - up--; - } - } - - // if the path is allowed to go above the root, restore leading ..s - if (allowAboveRoot) { - for (; up--; up) { - parts.unshift('..'); - } - } - - return parts; -} - -// Split a filename into [root, dir, basename, ext], unix version -// 'root' is just a slash, or nothing. -var splitPathRe = - /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/; -var splitPath = function(filename) { - return splitPathRe.exec(filename).slice(1); -}; - -// path.resolve([from ...], to) -// posix version -exports.resolve = function() { - var resolvedPath = '', - resolvedAbsolute = false; - - for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) { - var path = (i >= 0) ? arguments[i] : process.cwd(); - - // Skip empty and invalid entries - if (typeof path !== 'string') { - throw new TypeError('Arguments to path.resolve must be strings'); - } else if (!path) { - continue; - } - - resolvedPath = path + '/' + resolvedPath; - resolvedAbsolute = path.charAt(0) === '/'; - } - - // At this point the path should be resolved to a full absolute path, but - // handle relative paths to be safe (might happen when process.cwd() fails) - - // Normalize the path - resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) { - return !!p; - }), !resolvedAbsolute).join('/'); - - return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.'; -}; - -// path.normalize(path) -// posix version -exports.normalize = function(path) { - var isAbsolute = exports.isAbsolute(path), - trailingSlash = substr(path, -1) === '/'; - - // Normalize the path - path = normalizeArray(filter(path.split('/'), function(p) { - return !!p; - }), !isAbsolute).join('/'); - - if (!path && !isAbsolute) { - path = '.'; - } - if (path && trailingSlash) { - path += '/'; - } - - return (isAbsolute ? '/' : '') + path; -}; - -// posix version -exports.isAbsolute = function(path) { - return path.charAt(0) === '/'; -}; - -// posix version -exports.join = function() { - var paths = Array.prototype.slice.call(arguments, 0); - return exports.normalize(filter(paths, function(p, index) { - if (typeof p !== 'string') { - throw new TypeError('Arguments to path.join must be strings'); - } - return p; - }).join('/')); -}; - - -// path.relative(from, to) -// posix version -exports.relative = function(from, to) { - from = exports.resolve(from).substr(1); - to = exports.resolve(to).substr(1); - - function trim(arr) { - var start = 0; - for (; start < arr.length; start++) { - if (arr[start] !== '') break; - } - - var end = arr.length - 1; - for (; end >= 0; end--) { - if (arr[end] !== '') break; - } - - if (start > end) return []; - return arr.slice(start, end - start + 1); - } - - var fromParts = trim(from.split('/')); - var toParts = trim(to.split('/')); - - var length = Math.min(fromParts.length, toParts.length); - var samePartsLength = length; - for (var i = 0; i < length; i++) { - if (fromParts[i] !== toParts[i]) { - samePartsLength = i; - break; - } - } - - var outputParts = []; - for (var i = samePartsLength; i < fromParts.length; i++) { - outputParts.push('..'); - } - - outputParts = outputParts.concat(toParts.slice(samePartsLength)); - - return outputParts.join('/'); -}; - -exports.sep = '/'; -exports.delimiter = ':'; - -exports.dirname = function(path) { - var result = splitPath(path), - root = result[0], - dir = result[1]; - - if (!root && !dir) { - // No dirname whatsoever - return '.'; - } - - if (dir) { - // It has a dirname, strip trailing slash - dir = dir.substr(0, dir.length - 1); - } - - return root + dir; -}; - - -exports.basename = function(path, ext) { - var f = splitPath(path)[2]; - // TODO: make this comparison case-insensitive on windows? - if (ext && f.substr(-1 * ext.length) === ext) { - f = f.substr(0, f.length - ext.length); - } - return f; -}; - - -exports.extname = function(path) { - return splitPath(path)[3]; -}; - -function filter (xs, f) { - if (xs.filter) return xs.filter(f); - var res = []; - for (var i = 0; i < xs.length; i++) { - if (f(xs[i], i, xs)) res.push(xs[i]); - } - return res; -} - -// String.prototype.substr - negative index don't work in IE8 -var substr = 'ab'.substr(-1) === 'b' - ? function (str, start, len) { return str.substr(start, len) } - : function (str, start, len) { - if (start < 0) start = str.length + start; - return str.substr(start, len); - } -; - -/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(18))) - /***/ }), /* 26 */ /***/ (function(module, exports, __webpack_require__) { -/** - * Root reference for iframes. - */ +/* WEBPACK VAR INJECTION */(function(Buffer) {const browser = typeof window !== 'undefined'; -var root; -if (typeof window !== 'undefined') { // Browser window - root = window; -} else if (typeof self !== 'undefined') { // Web Worker - root = self; -} else { // Other environments - console.warn("Using browser-only version of superagent in non-browser environment"); - root = this; +let fetch; +let FormData; +if (browser) { + fetch = window.fetch; // eslint-disable-line no-undef + FormData = window.FormData; // eslint-disable-line no-undef +} else { + fetch = __webpack_require__(137); + FormData = __webpack_require__(58); } -var Emitter = __webpack_require__(53); -var RequestBase = __webpack_require__(60); -var isObject = __webpack_require__(27); -var isFunction = __webpack_require__(59); -var ResponseBase = __webpack_require__(61); -var shouldRetry = __webpack_require__(62); - -/** - * Noop. - */ - -function noop(){}; - -/** - * Expose `request`. - */ - -var request = exports = module.exports = function(method, url) { - // callback - if ('function' == typeof url) { - return new exports.Request('GET', method).end(url); +class Fetcher { + constructor(method, url) { + this.url = url; + this.method = method.toUpperCase(); + this.headers = {}; + this.data = null; } - // url first - if (1 == arguments.length) { - return new exports.Request('GET', method); + set(name, value) { + this.headers[name] = value; + return this; } - return new exports.Request(method, url); -} - -exports.Request = Request; - -/** - * Determine XHR. - */ - -request.getXHR = function () { - if (root.XMLHttpRequest - && (!root.location || 'file:' != root.location.protocol - || !root.ActiveXObject)) { - return new XMLHttpRequest; - } else { - try { return new ActiveXObject('Microsoft.XMLHTTP'); } catch(e) {} - try { return new ActiveXObject('Msxml2.XMLHTTP.6.0'); } catch(e) {} - try { return new ActiveXObject('Msxml2.XMLHTTP.3.0'); } catch(e) {} - try { return new ActiveXObject('Msxml2.XMLHTTP'); } catch(e) {} + attach(name, data, filename) { + const form = this._getFormData(); + this.set('Content-Type', `multipart/form-data; boundary=${form.boundary}`); + form.append(name, data, filename); + this.data = form; + return this; } - throw Error("Browser-only verison of superagent could not find XHR"); -}; -/** - * Removes leading and trailing whitespace, added to support IE. - * - * @param {String} s - * @return {String} - * @api private - */ - -var trim = ''.trim - ? function(s) { return s.trim(); } - : function(s) { return s.replace(/(^\s*|\s*$)/g, ''); }; - -/** - * Serialize the given `obj`. - * - * @param {Object} obj - * @return {String} - * @api private - */ - -function serialize(obj) { - if (!isObject(obj)) return obj; - var pairs = []; - for (var key in obj) { - pushEncodedKeyValuePair(pairs, key, obj[key]); + send(data) { + if (typeof data === 'object') { + this.set('Content-Type', 'application/json'); + this.data = JSON.stringify(data); + } else { + this.data = data; + } + return this; } - return pairs.join('&'); -} -/** - * Helps 'serialize' with serializing arrays. - * Mutates the pairs array. - * - * @param {Array} pairs - * @param {String} key - * @param {Mixed} val - */ - -function pushEncodedKeyValuePair(pairs, key, val) { - if (val != null) { - if (Array.isArray(val)) { - val.forEach(function(v) { - pushEncodedKeyValuePair(pairs, key, v); - }); - } else if (isObject(val)) { - for(var subkey in val) { - pushEncodedKeyValuePair(pairs, key + '[' + subkey + ']', val[subkey]); + end(cb) { + // in a browser, the response is actually immutable, so we make a new one + let response = { + headers: {}, + text: '', + body: {}, + }; + const data = this.data ? this.data.end ? this.data.end() : this.data : null; + return fetch(this.url, { + method: this.method, + headers: this.headers, + body: data, + }).then((res) => { + const ctype = res.headers.get('Content-Type'); + if (ctype.includes('application/json')) { + return res.text().then((t) => { + response.text = t; + response.body = JSON.parse(t); + return res; + }); + } else if (ctype.includes('application/x-www-form-urlencoded')) { + return res.text().then((t) => { + response.text = t; + response.body = parseWWWFormUrlEncoded(t); + return res; + }); + } else { + return (browser ? res.arrayBuffer() : res.buffer()) + .then((b) => { + if (b instanceof ArrayBuffer) b = convertToBuffer(b); + response.body = b; + response.text = b.toString(); + return res; + }); } - } else { - pairs.push(encodeURIComponent(key) - + '=' + encodeURIComponent(val)); - } - } else if (val === null) { - pairs.push(encodeURIComponent(key)); + }) + .then((res) => { + const { body, text } = response; + Object.assign(response, res); + response.body = body; + response.text = text; + if (res.headers.raw) { + for (const [name, value] of Object.entries(res.headers.raw())) response.headers[name] = value[0]; + } else { + for (const [name, value] of res.headers.entries()) response.headers[name] = value; + } + if (['4', '5'].includes(response.status.toString().substr(0, 1))) return cb(response, response); + return cb(null, response); + }) + .catch((err) => { + cb(err); + }); + } + + then(s, f) { + return new Promise((resolve, reject) => { + this.end((err, res) => { + if (err) reject(f ? f(err) : err); + else resolve(s ? s(res) : res); + }); + }); + } + + catch(f) { + return this.then(null, f); + } + + _getFormData() { + if (!this._formData) this._formData = new FormData(); + return this._formData; } } -/** - * Expose serialization method. - */ +const methods = ['GET', 'HEAD', 'POST', 'PUT', 'DELETE', 'CONNECT', 'OPTIONS', 'TRACE', 'PATCH', 'BREW']; +for (const method of methods) Fetcher[method.toLowerCase()] = (url) => new Fetcher(method, url); - request.serializeObject = serialize; +Fetcher.version = __webpack_require__(57).version; - /** - * Parse the given x-www-form-urlencoded `str`. - * - * @param {String} str - * @return {Object} - * @api private - */ +module.exports = Fetcher; +if (browser) window.Fetcher = Fetcher; -function parseString(str) { - var obj = {}; - var pairs = str.split('&'); - var pair; - var pos; - - for (var i = 0, len = pairs.length; i < len; ++i) { - pair = pairs[i]; - pos = pair.indexOf('='); - if (pos == -1) { - obj[decodeURIComponent(pair)] = ''; - } else { - obj[decodeURIComponent(pair.slice(0, pos))] = - decodeURIComponent(pair.slice(pos + 1)); - } +function convertToBuffer(ab) { + function str2ab(str) { + const buffer = new ArrayBuffer(str.length * 2); + const view = new Uint16Array(buffer); + for (var i = 0, strLen = str.length; i < strLen; i++) view[i] = str.charCodeAt(i); + return buffer; } + if (typeof ab === 'string') ab = str2ab(ab); + return Buffer.from(ab); +} + +function parseWWWFormUrlEncoded(str) { + const obj = {}; + for (const [k, v] of str.split('&').map(q => q.split('='))) obj[k] = v; return obj; } -/** - * Expose parser. - */ - -request.parseString = parseString; - -/** - * Default MIME type map. - * - * superagent.types.xml = 'application/xml'; - * - */ - -request.types = { - html: 'text/html', - json: 'application/json', - xml: 'application/xml', - urlencoded: 'application/x-www-form-urlencoded', - 'form': 'application/x-www-form-urlencoded', - 'form-data': 'application/x-www-form-urlencoded' -}; - -/** - * Default serialization map. - * - * superagent.serialize['application/xml'] = function(obj){ - * return 'generated xml here'; - * }; - * - */ - - request.serialize = { - 'application/x-www-form-urlencoded': serialize, - 'application/json': JSON.stringify - }; - - /** - * Default parsers. - * - * superagent.parse['application/xml'] = function(str){ - * return { object parsed from str }; - * }; - * - */ - -request.parse = { - 'application/x-www-form-urlencoded': parseString, - 'application/json': JSON.parse -}; - -/** - * Parse the given header `str` into - * an object containing the mapped fields. - * - * @param {String} str - * @return {Object} - * @api private - */ - -function parseHeader(str) { - var lines = str.split(/\r?\n/); - var fields = {}; - var index; - var line; - var field; - var val; - - lines.pop(); // trailing CRLF - - for (var i = 0, len = lines.length; i < len; ++i) { - line = lines[i]; - index = line.indexOf(':'); - field = line.slice(0, index).toLowerCase(); - val = trim(line.slice(index + 1)); - fields[field] = val; - } - - return fields; -} - -/** - * Check if `mime` is json or has +json structured syntax suffix. - * - * @param {String} mime - * @return {Boolean} - * @api private - */ - -function isJSON(mime) { - return /[\/+]json\b/.test(mime); -} - -/** - * Initialize a new `Response` with the given `xhr`. - * - * - set flags (.ok, .error, etc) - * - parse header - * - * Examples: - * - * Aliasing `superagent` as `request` is nice: - * - * request = superagent; - * - * We can use the promise-like API, or pass callbacks: - * - * request.get('/').end(function(res){}); - * request.get('/', function(res){}); - * - * Sending data can be chained: - * - * request - * .post('/user') - * .send({ name: 'tj' }) - * .end(function(res){}); - * - * Or passed to `.send()`: - * - * request - * .post('/user') - * .send({ name: 'tj' }, function(res){}); - * - * Or passed to `.post()`: - * - * request - * .post('/user', { name: 'tj' }) - * .end(function(res){}); - * - * Or further reduced to a single call for simple cases: - * - * request - * .post('/user', { name: 'tj' }, function(res){}); - * - * @param {XMLHTTPRequest} xhr - * @param {Object} options - * @api private - */ - -function Response(req) { - this.req = req; - this.xhr = this.req.xhr; - // responseText is accessible only if responseType is '' or 'text' and on older browsers - this.text = ((this.req.method !='HEAD' && (this.xhr.responseType === '' || this.xhr.responseType === 'text')) || typeof this.xhr.responseType === 'undefined') - ? this.xhr.responseText - : null; - this.statusText = this.req.xhr.statusText; - var status = this.xhr.status; - // handle IE9 bug: http://stackoverflow.com/questions/10046972/msie-returns-status-code-of-1223-for-ajax-request - if (status === 1223) { - status = 204; - } - this._setStatusProperties(status); - this.header = this.headers = parseHeader(this.xhr.getAllResponseHeaders()); - // getAllResponseHeaders sometimes falsely returns "" for CORS requests, but - // getResponseHeader still works. so we get content-type even if getting - // other headers fails. - this.header['content-type'] = this.xhr.getResponseHeader('content-type'); - this._setHeaderProperties(this.header); - - if (null === this.text && req._responseType) { - this.body = this.xhr.response; - } else { - this.body = this.req.method != 'HEAD' - ? this._parseBody(this.text ? this.text : this.xhr.response) - : null; - } -} - -ResponseBase(Response.prototype); - -/** - * Parse the given body `str`. - * - * Used for auto-parsing of bodies. Parsers - * are defined on the `superagent.parse` object. - * - * @param {String} str - * @return {Mixed} - * @api private - */ - -Response.prototype._parseBody = function(str){ - var parse = request.parse[this.type]; - if(this.req._parser) { - return this.req._parser(this, str); - } - if (!parse && isJSON(this.type)) { - parse = request.parse['application/json']; - } - return parse && str && (str.length || str instanceof Object) - ? parse(str) - : null; -}; - -/** - * Return an `Error` representative of this response. - * - * @return {Error} - * @api public - */ - -Response.prototype.toError = function(){ - var req = this.req; - var method = req.method; - var url = req.url; - - var msg = 'cannot ' + method + ' ' + url + ' (' + this.status + ')'; - var err = new Error(msg); - err.status = this.status; - err.method = method; - err.url = url; - - return err; -}; - -/** - * Expose `Response`. - */ - -request.Response = Response; - -/** - * Initialize a new `Request` with the given `method` and `url`. - * - * @param {String} method - * @param {String} url - * @api public - */ - -function Request(method, url) { - var self = this; - this._query = this._query || []; - this.method = method; - this.url = url; - this.header = {}; // preserves header name case - this._header = {}; // coerces header names to lowercase - this.on('end', function(){ - var err = null; - var res = null; - - try { - res = new Response(self); - } catch(e) { - err = new Error('Parser is unable to parse the response'); - err.parse = true; - err.original = e; - // issue #675: return the raw response if the response parsing fails - if (self.xhr) { - // ie9 doesn't have 'response' property - err.rawResponse = typeof self.xhr.responseType == 'undefined' ? self.xhr.responseText : self.xhr.response; - // issue #876: return the http status code if the response parsing fails - err.status = self.xhr.status ? self.xhr.status : null; - err.statusCode = err.status; // backwards-compat only - } else { - err.rawResponse = null; - err.status = null; - } - - return self.callback(err); - } - - self.emit('response', res); - - var new_err; - try { - if (!self._isResponseOK(res)) { - new_err = new Error(res.statusText || 'Unsuccessful HTTP response'); - new_err.original = err; - new_err.response = res; - new_err.status = res.status; - } - } catch(e) { - new_err = e; // #985 touching res may cause INVALID_STATE_ERR on old Android - } - - // #1000 don't catch errors from the callback to avoid double calling it - if (new_err) { - self.callback(new_err, res); - } else { - self.callback(null, res); - } - }); -} - -/** - * Mixin `Emitter` and `RequestBase`. - */ - -Emitter(Request.prototype); -RequestBase(Request.prototype); - -/** - * Set Content-Type to `type`, mapping values from `request.types`. - * - * Examples: - * - * superagent.types.xml = 'application/xml'; - * - * request.post('/') - * .type('xml') - * .send(xmlstring) - * .end(callback); - * - * request.post('/') - * .type('application/xml') - * .send(xmlstring) - * .end(callback); - * - * @param {String} type - * @return {Request} for chaining - * @api public - */ - -Request.prototype.type = function(type){ - this.set('Content-Type', request.types[type] || type); - return this; -}; - -/** - * Set Accept to `type`, mapping values from `request.types`. - * - * Examples: - * - * superagent.types.json = 'application/json'; - * - * request.get('/agent') - * .accept('json') - * .end(callback); - * - * request.get('/agent') - * .accept('application/json') - * .end(callback); - * - * @param {String} accept - * @return {Request} for chaining - * @api public - */ - -Request.prototype.accept = function(type){ - this.set('Accept', request.types[type] || type); - return this; -}; - -/** - * Set Authorization field value with `user` and `pass`. - * - * @param {String} user - * @param {String} pass - * @param {Object} options with 'type' property 'auto' or 'basic' (default 'basic') - * @return {Request} for chaining - * @api public - */ - -Request.prototype.auth = function(user, pass, options){ - if (!options) { - options = { - type: 'function' === typeof btoa ? 'basic' : 'auto', - } - } - - switch (options.type) { - case 'basic': - this.set('Authorization', 'Basic ' + btoa(user + ':' + pass)); - break; - - case 'auto': - this.username = user; - this.password = pass; - break; - } - return this; -}; - -/** - * Add query-string `val`. - * - * Examples: - * - * request.get('/shoes') - * .query('size=10') - * .query({ color: 'blue' }) - * - * @param {Object|String} val - * @return {Request} for chaining - * @api public - */ - -Request.prototype.query = function(val){ - if ('string' != typeof val) val = serialize(val); - if (val) this._query.push(val); - return this; -}; - -/** - * Queue the given `file` as an attachment to the specified `field`, - * with optional `options` (or filename). - * - * ``` js - * request.post('/upload') - * .attach('content', new Blob(['hey!'], { type: "text/html"})) - * .end(callback); - * ``` - * - * @param {String} field - * @param {Blob|File} file - * @param {String|Object} options - * @return {Request} for chaining - * @api public - */ - -Request.prototype.attach = function(field, file, options){ - if (this._data) { - throw Error("superagent can't mix .send() and .attach()"); - } - - this._getFormData().append(field, file, options || file.name); - return this; -}; - -Request.prototype._getFormData = function(){ - if (!this._formData) { - this._formData = new root.FormData(); - } - return this._formData; -}; - -/** - * Invoke the callback with `err` and `res` - * and handle arity check. - * - * @param {Error} err - * @param {Response} res - * @api private - */ - -Request.prototype.callback = function(err, res){ - // console.log(this._retries, this._maxRetries) - if (this._maxRetries && this._retries++ < this._maxRetries && shouldRetry(err, res)) { - return this._retry(); - } - - var fn = this._callback; - this.clearTimeout(); - - if (err) { - if (this._maxRetries) err.retries = this._retries - 1; - this.emit('error', err); - } - - fn(err, res); -}; - -/** - * Invoke callback with x-domain error. - * - * @api private - */ - -Request.prototype.crossDomainError = function(){ - var err = new Error('Request has been terminated\nPossible causes: the network is offline, Origin is not allowed by Access-Control-Allow-Origin, the page is being unloaded, etc.'); - err.crossDomain = true; - - err.status = this.status; - err.method = this.method; - err.url = this.url; - - this.callback(err); -}; - -// This only warns, because the request is still likely to work -Request.prototype.buffer = Request.prototype.ca = Request.prototype.agent = function(){ - console.warn("This is not supported in browser version of superagent"); - return this; -}; - -// This throws, because it can't send/receive data as expected -Request.prototype.pipe = Request.prototype.write = function(){ - throw Error("Streaming is not supported in browser version of superagent"); -}; - -/** - * Compose querystring to append to req.url - * - * @api private - */ - -Request.prototype._appendQueryString = function(){ - var query = this._query.join('&'); - if (query) { - this.url += (this.url.indexOf('?') >= 0 ? '&' : '?') + query; - } - - if (this._sort) { - var index = this.url.indexOf('?'); - if (index >= 0) { - var queryArr = this.url.substring(index + 1).split('&'); - if (isFunction(this._sort)) { - queryArr.sort(this._sort); - } else { - queryArr.sort(); - } - this.url = this.url.substring(0, index) + '?' + queryArr.join('&'); - } - } -}; - -/** - * Check if `obj` is a host object, - * we don't want to serialize these :) - * - * @param {Object} obj - * @return {Boolean} - * @api private - */ -Request.prototype._isHost = function _isHost(obj) { - // Native objects stringify to [object File], [object Blob], [object FormData], etc. - return obj && 'object' === typeof obj && !Array.isArray(obj) && Object.prototype.toString.call(obj) !== '[object Object]'; -} - -/** - * Initiate request, invoking callback `fn(res)` - * with an instanceof `Response`. - * - * @param {Function} fn - * @return {Request} for chaining - * @api public - */ - -Request.prototype.end = function(fn){ - if (this._endCalled) { - console.warn("Warning: .end() was called twice. This is not supported in superagent"); - } - this._endCalled = true; - - // store callback - this._callback = fn || noop; - - // querystring - this._appendQueryString(); - - return this._end(); -}; - -Request.prototype._end = function() { - var self = this; - var xhr = this.xhr = request.getXHR(); - var data = this._formData || this._data; - - this._setTimeouts(); - - // state change - xhr.onreadystatechange = function(){ - var readyState = xhr.readyState; - if (readyState >= 2 && self._responseTimeoutTimer) { - clearTimeout(self._responseTimeoutTimer); - } - if (4 != readyState) { - return; - } - - // In IE9, reads to any property (e.g. status) off of an aborted XHR will - // result in the error "Could not complete the operation due to error c00c023f" - var status; - try { status = xhr.status } catch(e) { status = 0; } - - if (!status) { - if (self.timedout || self._aborted) return; - return self.crossDomainError(); - } - self.emit('end'); - }; - - // progress - var handleProgress = function(direction, e) { - if (e.total > 0) { - e.percent = e.loaded / e.total * 100; - } - e.direction = direction; - self.emit('progress', e); - } - if (this.hasListeners('progress')) { - try { - xhr.onprogress = handleProgress.bind(null, 'download'); - if (xhr.upload) { - xhr.upload.onprogress = handleProgress.bind(null, 'upload'); - } - } catch(e) { - // Accessing xhr.upload fails in IE from a web worker, so just pretend it doesn't exist. - // Reported here: - // https://connect.microsoft.com/IE/feedback/details/837245/xmlhttprequest-upload-throws-invalid-argument-when-used-from-web-worker-context - } - } - - // initiate request - try { - if (this.username && this.password) { - xhr.open(this.method, this.url, true, this.username, this.password); - } else { - xhr.open(this.method, this.url, true); - } - } catch (err) { - // see #1149 - return this.callback(err); - } - - // CORS - if (this._withCredentials) xhr.withCredentials = true; - - // body - if (!this._formData && 'GET' != this.method && 'HEAD' != this.method && 'string' != typeof data && !this._isHost(data)) { - // serialize stuff - var contentType = this._header['content-type']; - var serialize = this._serializer || request.serialize[contentType ? contentType.split(';')[0] : '']; - if (!serialize && isJSON(contentType)) { - serialize = request.serialize['application/json']; - } - if (serialize) data = serialize(data); - } - - // set header fields - for (var field in this.header) { - if (null == this.header[field]) continue; - xhr.setRequestHeader(field, this.header[field]); - } - - if (this._responseType) { - xhr.responseType = this._responseType; - } - - // send stuff - this.emit('request', this); - - // IE11 xhr.send(undefined) sends 'undefined' string as POST payload (instead of nothing) - // We need null here if data is undefined - xhr.send(typeof data !== 'undefined' ? data : null); - return this; -}; - -/** - * GET `url` with optional callback `fn(res)`. - * - * @param {String} url - * @param {Mixed|Function} [data] or fn - * @param {Function} [fn] - * @return {Request} - * @api public - */ - -request.get = function(url, data, fn){ - var req = request('GET', url); - if ('function' == typeof data) fn = data, data = null; - if (data) req.query(data); - if (fn) req.end(fn); - return req; -}; - -/** - * HEAD `url` with optional callback `fn(res)`. - * - * @param {String} url - * @param {Mixed|Function} [data] or fn - * @param {Function} [fn] - * @return {Request} - * @api public - */ - -request.head = function(url, data, fn){ - var req = request('HEAD', url); - if ('function' == typeof data) fn = data, data = null; - if (data) req.send(data); - if (fn) req.end(fn); - return req; -}; - -/** - * OPTIONS query to `url` with optional callback `fn(res)`. - * - * @param {String} url - * @param {Mixed|Function} [data] or fn - * @param {Function} [fn] - * @return {Request} - * @api public - */ - -request.options = function(url, data, fn){ - var req = request('OPTIONS', url); - if ('function' == typeof data) fn = data, data = null; - if (data) req.send(data); - if (fn) req.end(fn); - return req; -}; - -/** - * DELETE `url` with optional `data` and callback `fn(res)`. - * - * @param {String} url - * @param {Mixed} [data] - * @param {Function} [fn] - * @return {Request} - * @api public - */ - -function del(url, data, fn){ - var req = request('DELETE', url); - if ('function' == typeof data) fn = data, data = null; - if (data) req.send(data); - if (fn) req.end(fn); - return req; -}; - -request['del'] = del; -request['delete'] = del; - -/** - * PATCH `url` with optional `data` and callback `fn(res)`. - * - * @param {String} url - * @param {Mixed} [data] - * @param {Function} [fn] - * @return {Request} - * @api public - */ - -request.patch = function(url, data, fn){ - var req = request('PATCH', url); - if ('function' == typeof data) fn = data, data = null; - if (data) req.send(data); - if (fn) req.end(fn); - return req; -}; - -/** - * POST `url` with optional `data` and callback `fn(res)`. - * - * @param {String} url - * @param {Mixed} [data] - * @param {Function} [fn] - * @return {Request} - * @api public - */ - -request.post = function(url, data, fn){ - var req = request('POST', url); - if ('function' == typeof data) fn = data, data = null; - if (data) req.send(data); - if (fn) req.end(fn); - return req; -}; - -/** - * PUT `url` with optional `data` and callback `fn(res)`. - * - * @param {String} url - * @param {Mixed|Function} [data] or fn - * @param {Function} [fn] - * @return {Request} - * @api public - */ - -request.put = function(url, data, fn){ - var req = request('PUT', url); - if ('function' == typeof data) fn = data, data = null; - if (data) req.send(data); - if (fn) req.end(fn); - return req; -}; - +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(14).Buffer)) /***/ }), /* 27 */ -/***/ (function(module, exports) { - -/** - * Check if `obj` is an object. - * - * @param {Object} obj - * @return {Boolean} - * @api private - */ - -function isObject(obj) { - return null !== obj && 'object' === typeof obj; -} - -module.exports = isObject; - - -/***/ }), -/* 28 */ /***/ (function(module, exports, __webpack_require__) { -/* WEBPACK VAR INJECTION */(function(Buffer) {const path = __webpack_require__(25); -const fs = __webpack_require__(43); -const request = __webpack_require__(26); +/* WEBPACK VAR INJECTION */(function(Buffer) {const path = __webpack_require__(19); +const fs = __webpack_require__(42); +const snekfetch = __webpack_require__(26); const Constants = __webpack_require__(0); const convertToBuffer = __webpack_require__(4).convertToBuffer; const User = __webpack_require__(11); const Message = __webpack_require__(9); -const Guild = __webpack_require__(16); +const Guild = __webpack_require__(17); const Channel = __webpack_require__(8); const GuildMember = __webpack_require__(13); const Emoji = __webpack_require__(12); -const ReactionEmoji = __webpack_require__(20); +const ReactionEmoji = __webpack_require__(22); /** * The DataResolver identifies different objects and tries to resolve a specific piece of information from them, e.g. @@ -10803,11 +10004,9 @@ class ClientDataResolver { if (typeof resource === 'string') { return new Promise((resolve, reject) => { if (/^https?:\/\//.test(resource)) { - const req = request.get(resource).set('Content-Type', 'blob'); - if (this.client.browser) req.responseType('arraybuffer'); - req.end((err, res) => { + snekfetch.get(resource) + .end((err, res) => { if (err) return reject(err); - if (this.client.browser) return resolve(convertToBuffer(res.xhr.response)); if (!(res.body instanceof Buffer)) return reject(new TypeError('The response body isn\'t a Buffer.')); return resolve(res.body); }); @@ -10918,10 +10117,10 @@ class ClientDataResolver { module.exports = ClientDataResolver; -/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(22).Buffer)) +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(14).Buffer)) /***/ }), -/* 29 */ +/* 28 */ /***/ (function(module, exports) { module.exports = { @@ -10961,7 +10160,7 @@ module.exports = { "@types/node": "^7.0.0", "long": "^3.2.0", "prism-media": "hydrabolt/prism-media", - "superagent": "^3.4.0", + "snekfetch": "github:guscaplan/snekfetch", "tweetnacl": "^0.14.0", "ws": "^2.0.0" }, @@ -10992,6 +10191,7 @@ module.exports = { "node-opus": false, "tweetnacl": false, "sodium": false, + "node-fetch": false, "src/sharding/Shard.js": false, "src/sharding/ShardClientUtil.js": false, "src/sharding/ShardingManager.js": false, @@ -11018,7 +10218,7 @@ module.exports = { }; /***/ }), -/* 30 */ +/* 29 */ /***/ (function(module, exports, __webpack_require__) { const User = __webpack_require__(11); @@ -11362,11 +10562,11 @@ module.exports = ClientUser; /***/ }), -/* 31 */ +/* 30 */ /***/ (function(module, exports, __webpack_require__) { const Channel = __webpack_require__(8); -const TextBasedChannel = __webpack_require__(14); +const TextBasedChannel = __webpack_require__(15); const Collection = __webpack_require__(3); /** @@ -11432,11 +10632,11 @@ module.exports = DMChannel; /***/ }), -/* 32 */ +/* 31 */ /***/ (function(module, exports, __webpack_require__) { -const PartialGuild = __webpack_require__(38); -const PartialGuildChannel = __webpack_require__(39); +const PartialGuild = __webpack_require__(37); +const PartialGuildChannel = __webpack_require__(38); const Constants = __webpack_require__(0); /* @@ -11597,7 +10797,7 @@ module.exports = Invite; /***/ }), -/* 33 */ +/* 32 */ /***/ (function(module, exports) { /** @@ -11671,10 +10871,10 @@ module.exports = MessageAttachment; /***/ }), -/* 34 */ +/* 33 */ /***/ (function(module, exports, __webpack_require__) { -const EventEmitter = __webpack_require__(23).EventEmitter; +const EventEmitter = __webpack_require__(24).EventEmitter; const Collection = __webpack_require__(3); /** @@ -11828,7 +11028,7 @@ module.exports = MessageCollector; /***/ }), -/* 35 */ +/* 34 */ /***/ (function(module, exports) { /** @@ -12218,12 +11418,12 @@ module.exports = MessageEmbed; /***/ }), -/* 36 */ +/* 35 */ /***/ (function(module, exports, __webpack_require__) { const Collection = __webpack_require__(3); const Emoji = __webpack_require__(12); -const ReactionEmoji = __webpack_require__(20); +const ReactionEmoji = __webpack_require__(22); /** * Represents a reaction to a message @@ -12316,7 +11516,7 @@ module.exports = MessageReaction; /***/ }), -/* 37 */ +/* 36 */ /***/ (function(module, exports, __webpack_require__) { const Snowflake = __webpack_require__(5); @@ -12456,7 +11656,7 @@ module.exports = OAuth2Application; /***/ }), -/* 38 */ +/* 37 */ /***/ (function(module, exports) { /* @@ -12513,7 +11713,7 @@ module.exports = PartialGuild; /***/ }), -/* 39 */ +/* 38 */ /***/ (function(module, exports, __webpack_require__) { const Constants = __webpack_require__(0); @@ -12563,7 +11763,7 @@ module.exports = PartialGuildChannel; /***/ }), -/* 40 */ +/* 39 */ /***/ (function(module, exports) { /** @@ -12612,11 +11812,11 @@ module.exports = PermissionOverwrites; /***/ }), -/* 41 */ +/* 40 */ /***/ (function(module, exports, __webpack_require__) { -const GuildChannel = __webpack_require__(17); -const TextBasedChannel = __webpack_require__(14); +const GuildChannel = __webpack_require__(18); +const TextBasedChannel = __webpack_require__(15); const Collection = __webpack_require__(3); /** @@ -12718,10 +11918,10 @@ module.exports = TextChannel; /***/ }), -/* 42 */ +/* 41 */ /***/ (function(module, exports, __webpack_require__) { -const GuildChannel = __webpack_require__(17); +const GuildChannel = __webpack_require__(18); const Collection = __webpack_require__(3); /** @@ -12854,20 +12054,20 @@ module.exports = VoiceChannel; /***/ }), -/* 43 */ +/* 42 */ /***/ (function(module, exports) { /***/ }), -/* 44 */ +/* 43 */ /***/ (function(module, exports, __webpack_require__) { -const UserAgentManager = __webpack_require__(99); -const RESTMethods = __webpack_require__(96); -const SequentialRequestHandler = __webpack_require__(98); -const BurstRequestHandler = __webpack_require__(97); -const APIRequest = __webpack_require__(95); +const UserAgentManager = __webpack_require__(97); +const RESTMethods = __webpack_require__(94); +const SequentialRequestHandler = __webpack_require__(96); +const BurstRequestHandler = __webpack_require__(95); +const APIRequest = __webpack_require__(93); const Constants = __webpack_require__(0); class RESTManager { @@ -12917,7 +12117,7 @@ module.exports = RESTManager; /***/ }), -/* 45 */ +/* 44 */ /***/ (function(module, exports) { /** @@ -12972,25 +12172,25 @@ module.exports = RequestHandler; /***/ }), -/* 46 */ +/* 45 */ /***/ (function(module, exports, __webpack_require__) { -/* WEBPACK VAR INJECTION */(function(process) {const os = __webpack_require__(15); -const EventEmitter = __webpack_require__(23).EventEmitter; +/* WEBPACK VAR INJECTION */(function(process) {const os = __webpack_require__(16); +const EventEmitter = __webpack_require__(24).EventEmitter; const Constants = __webpack_require__(0); const Permissions = __webpack_require__(6); const Util = __webpack_require__(4); -const RESTManager = __webpack_require__(44); -const ClientDataManager = __webpack_require__(65); -const ClientManager = __webpack_require__(66); -const ClientDataResolver = __webpack_require__(28); -const ClientVoiceManager = __webpack_require__(140); -const WebSocketManager = __webpack_require__(100); -const ActionsManager = __webpack_require__(67); +const RESTManager = __webpack_require__(43); +const ClientDataManager = __webpack_require__(63); +const ClientManager = __webpack_require__(64); +const ClientDataResolver = __webpack_require__(27); +const ClientVoiceManager = __webpack_require__(139); +const WebSocketManager = __webpack_require__(98); +const ActionsManager = __webpack_require__(65); const Collection = __webpack_require__(3); const Presence = __webpack_require__(7).Presence; -const ShardClientUtil = __webpack_require__(139); -const VoiceBroadcast = __webpack_require__(141); +const ShardClientUtil = __webpack_require__(138); +const VoiceBroadcast = __webpack_require__(140); /** * The main hub for interacting with the Discord API, and the starting point for any bot. @@ -13521,15 +12721,15 @@ module.exports = Client; * @param {string} info The debug information */ -/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(18))) +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(20))) /***/ }), -/* 47 */ +/* 46 */ /***/ (function(module, exports, __webpack_require__) { -const Webhook = __webpack_require__(21); -const RESTManager = __webpack_require__(44); -const ClientDataResolver = __webpack_require__(28); +const Webhook = __webpack_require__(23); +const RESTManager = __webpack_require__(43); +const ClientDataResolver = __webpack_require__(27); const Constants = __webpack_require__(0); const Util = __webpack_require__(4); @@ -13648,10 +12848,10 @@ module.exports = WebhookClient; /***/ }), -/* 48 */ +/* 47 */ /***/ (function(module, exports, __webpack_require__) { -const ClientDataResolver = __webpack_require__(28); +const ClientDataResolver = __webpack_require__(27); /** * A rich embed to be sent with a message with a fluent interface for creation @@ -13875,6 +13075,12 @@ function resolveString(data) { } +/***/ }), +/* 48 */ +/***/ (function(module, exports) { + +/* (ignored) */ + /***/ }), /* 49 */ /***/ (function(module, exports) { @@ -13889,12 +13095,6 @@ function resolveString(data) { /***/ }), /* 51 */ -/***/ (function(module, exports) { - -/* (ignored) */ - -/***/ }), -/* 52 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -14015,176 +13215,7 @@ function fromByteArray (uint8) { /***/ }), -/* 53 */ -/***/ (function(module, exports, __webpack_require__) { - - -/** - * Expose `Emitter`. - */ - -if (true) { - module.exports = Emitter; -} - -/** - * Initialize a new `Emitter`. - * - * @api public - */ - -function Emitter(obj) { - if (obj) return mixin(obj); -}; - -/** - * Mixin the emitter properties. - * - * @param {Object} obj - * @return {Object} - * @api private - */ - -function mixin(obj) { - for (var key in Emitter.prototype) { - obj[key] = Emitter.prototype[key]; - } - return obj; -} - -/** - * Listen on the given `event` with `fn`. - * - * @param {String} event - * @param {Function} fn - * @return {Emitter} - * @api public - */ - -Emitter.prototype.on = -Emitter.prototype.addEventListener = function(event, fn){ - this._callbacks = this._callbacks || {}; - (this._callbacks['$' + event] = this._callbacks['$' + event] || []) - .push(fn); - return this; -}; - -/** - * Adds an `event` listener that will be invoked a single - * time then automatically removed. - * - * @param {String} event - * @param {Function} fn - * @return {Emitter} - * @api public - */ - -Emitter.prototype.once = function(event, fn){ - function on() { - this.off(event, on); - fn.apply(this, arguments); - } - - on.fn = fn; - this.on(event, on); - return this; -}; - -/** - * Remove the given callback for `event` or all - * registered callbacks. - * - * @param {String} event - * @param {Function} fn - * @return {Emitter} - * @api public - */ - -Emitter.prototype.off = -Emitter.prototype.removeListener = -Emitter.prototype.removeAllListeners = -Emitter.prototype.removeEventListener = function(event, fn){ - this._callbacks = this._callbacks || {}; - - // all - if (0 == arguments.length) { - this._callbacks = {}; - return this; - } - - // specific event - var callbacks = this._callbacks['$' + event]; - if (!callbacks) return this; - - // remove all handlers - if (1 == arguments.length) { - delete this._callbacks['$' + event]; - return this; - } - - // remove specific handler - var cb; - for (var i = 0; i < callbacks.length; i++) { - cb = callbacks[i]; - if (cb === fn || cb.fn === fn) { - callbacks.splice(i, 1); - break; - } - } - return this; -}; - -/** - * Emit `event` with the given args. - * - * @param {String} event - * @param {Mixed} ... - * @return {Emitter} - */ - -Emitter.prototype.emit = function(event){ - this._callbacks = this._callbacks || {}; - var args = [].slice.call(arguments, 1) - , callbacks = this._callbacks['$' + event]; - - if (callbacks) { - callbacks = callbacks.slice(0); - for (var i = 0, len = callbacks.length; i < len; ++i) { - callbacks[i].apply(this, args); - } - } - - return this; -}; - -/** - * Return array of callbacks for `event`. - * - * @param {String} event - * @return {Array} - * @api public - */ - -Emitter.prototype.listeners = function(event){ - this._callbacks = this._callbacks || {}; - return this._callbacks['$' + event] || []; -}; - -/** - * Check if this emitter has `event` handlers. - * - * @param {String} event - * @return {Boolean} - * @api public - */ - -Emitter.prototype.hasListeners = function(event){ - return !! this.listeners(event).length; -}; - - -/***/ }), -/* 54 */ +/* 52 */ /***/ (function(module, exports) { exports.read = function (buffer, offset, isLE, mLen, nBytes) { @@ -14274,7 +13305,7 @@ exports.write = function (buffer, value, offset, isLE, mLen, nBytes) { /***/ }), -/* 55 */ +/* 53 */ /***/ (function(module, exports) { var toString = {}.toString; @@ -14285,7 +13316,7 @@ module.exports = Array.isArray || function (arr) { /***/ }), -/* 56 */ +/* 54 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -14376,7 +13407,7 @@ var isArray = Array.isArray || function (xs) { /***/ }), -/* 57 */ +/* 55 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -14468,869 +13499,1795 @@ var objectKeys = Object.keys || function (obj) { /***/ }), -/* 58 */ +/* 56 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -exports.decode = exports.parse = __webpack_require__(56); -exports.encode = exports.stringify = __webpack_require__(57); +exports.decode = exports.parse = __webpack_require__(54); +exports.encode = exports.stringify = __webpack_require__(55); +/***/ }), +/* 57 */ +/***/ (function(module, exports) { + +module.exports = { + "_args": [ + [ + { + "raw": "snekfetch@github:guscaplan/snekfetch", + "scope": null, + "escapedName": "snekfetch", + "name": "snekfetch", + "rawSpec": "github:guscaplan/snekfetch", + "spec": "github:guscaplan/snekfetch", + "type": "hosted", + "hosted": { + "type": "github", + "ssh": "git@github.com:guscaplan/snekfetch.git", + "sshUrl": "git+ssh://git@github.com/guscaplan/snekfetch.git", + "httpsUrl": "git+https://github.com/guscaplan/snekfetch.git", + "gitUrl": "git://github.com/guscaplan/snekfetch.git", + "shortcut": "github:guscaplan/snekfetch", + "directUrl": "https://raw.githubusercontent.com/guscaplan/snekfetch/master/package.json" + } + }, + "/home/travis/build/hydrabolt/discord.js" + ] + ], + "_from": "guscaplan/snekfetch", + "_id": "snekfetch@1.0.1", + "_inCache": true, + "_location": "/snekfetch", + "_phantomChildren": {}, + "_requested": { + "raw": "snekfetch@github:guscaplan/snekfetch", + "scope": null, + "escapedName": "snekfetch", + "name": "snekfetch", + "rawSpec": "github:guscaplan/snekfetch", + "spec": "github:guscaplan/snekfetch", + "type": "hosted", + "hosted": { + "type": "github", + "ssh": "git@github.com:guscaplan/snekfetch.git", + "sshUrl": "git+ssh://git@github.com/guscaplan/snekfetch.git", + "httpsUrl": "git+https://github.com/guscaplan/snekfetch.git", + "gitUrl": "git://github.com/guscaplan/snekfetch.git", + "shortcut": "github:guscaplan/snekfetch", + "directUrl": "https://raw.githubusercontent.com/guscaplan/snekfetch/master/package.json" + } + }, + "_requiredBy": [ + "/" + ], + "_resolved": "git://github.com/guscaplan/snekfetch.git#d411b7b6c15da19d7546cc7e2c5af78ca37b5713", + "_shasum": "c17dba213ced87df637c0d7bc92a3ecd66e8e5f5", + "_shrinkwrap": null, + "_spec": "snekfetch@github:guscaplan/snekfetch", + "_where": "/home/travis/build/hydrabolt/discord.js", + "author": { + "name": "Gus Caplan", + "email": "me@gus.host" + }, + "browser": { + "node-fetch": false + }, + "bugs": { + "url": "https://github.com/GusCaplan/snekfetch/issues" + }, + "dependencies": { + "node-fetch": "^1.6.3" + }, + "description": "It's like superagent but without all the shitcode and shitdeps.", + "devDependencies": {}, + "gitHead": "d411b7b6c15da19d7546cc7e2c5af78ca37b5713", + "homepage": "https://github.com/GusCaplan/snekfetch#readme", + "license": "MIT", + "main": "src/index.js", + "name": "snekfetch", + "optionalDependencies": {}, + "readme": "# snekfetch\n\nJust do http requests without all that weird nastiness from other libs\n\nresponse.text is raw and always present \nresponse.body will be a buffer or an object and is not always present\n\nyou can `end` or `then` or `catch` a request just like superagent.\nyou can probably await it as well <.<\n\n```js\nconst snekfetch = require('snekfetch');\n\nsnekfetch.get('https://s.gus.host/o-SNAKES-80.jpg')\n .then(r => fs.writeFile('download.jpg', r.body));\n```\n\n```js\nconst snekfetch = require('snekfetch');\n\nsnekfetch.post('https://httpbin.org/post')\n .send({ meme: 'dream' })\n .then(r => console.log(r.body));\n```\n", + "readmeFilename": "README.md", + "repository": { + "type": "git", + "url": "git+https://github.com/GusCaplan/snekfetch.git" + }, + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "version": "1.0.1" +}; + +/***/ }), +/* 58 */ +/***/ (function(module, exports, __webpack_require__) { + +/* WEBPACK VAR INJECTION */(function(Buffer) {const path = __webpack_require__(19); +const mime = __webpack_require__(59); + +class FormData { + constructor() { + this.boundary = `-----------${Math.random().toString().slice(2)}`; + this.buffer = new Buffer(0); + } + + append(name, data, filename) { + if (typeof data === 'undefined') return; + let str = `\r\n--${this.boundary}\r\nContent-Disposition: form-data; name="${name}"`; + let mimetype = null; + if (filename) { + str += `; filename="${filename}"`; + mimetype = 'application/octet-stream'; + const extname = path.extname(filename); + if (extname) mimetype = mime.lookup(extname); + } + + if (data instanceof Buffer) { + mimetype = mime.buffer(data); + } else if (typeof data === 'object') { + mimetype = 'application/json'; + data = Buffer.from(JSON.stringify(data)); + } else { + data = Buffer.from(String(data)); + } + + if (mimetype) str += `\r\nContent-Type: ${mimetype}`; + this.buffer = Buffer.concat([ + this.buffer, + Buffer.from(`${str}\r\n\r\n`), + data, + ]); + } + + end() { + this.buffer = Buffer.concat([ + this.buffer, + Buffer.from(`\r\n--${this.boundary}--`), + ]); + return this.buffer; + } +} + +module.exports = FormData; + +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(14).Buffer)) + /***/ }), /* 59 */ /***/ (function(module, exports, __webpack_require__) { -/** - * Check if `fn` is a function. - * - * @param {Function} fn - * @return {Boolean} - * @api private - */ -var isObject = __webpack_require__(27); +const mimes = __webpack_require__(61); +const mimeOfBuffer = __webpack_require__(60); -function isFunction(fn) { - var tag = isObject(fn) ? Object.prototype.toString.call(fn) : ''; - return tag === '[object Function]'; +function lookupMime(ext) { + return mimes[ext] || mimes.bin; } -module.exports = isFunction; +function lookupBuffer(buffer) { + const type = mimeOfBuffer(buffer); + if (type) return type.mime; + else return mimes.bin; +} + +module.exports = { + buffer: lookupBuffer, + lookup: lookupMime, +}; /***/ }), /* 60 */ -/***/ (function(module, exports, __webpack_require__) { +/***/ (function(module, exports) { -/** - * Module of mixed-in functions shared between node and client code - */ -var isObject = __webpack_require__(27); +/* eslint complexity: 0 */ -/** - * Expose `RequestBase`. - */ +// from file-type by @sindresorhus under the MIT license +// https://github.com/sindresorhus/file-type -module.exports = RequestBase; +function mimeOfBuffer(input) { + const buf = new Uint8Array(input); -/** - * Initialize a new `RequestBase`. - * - * @api public - */ + if (!(buf && buf.length > 1)) { + return null; + } -function RequestBase(obj) { - if (obj) return mixin(obj); + if (buf[0] === 0xFF && buf[1] === 0xD8 && buf[2] === 0xFF) { + return { + ext: 'jpg', + mime: 'image/jpeg', + }; + } + + if (buf[0] === 0x89 && buf[1] === 0x50 && buf[2] === 0x4E && buf[3] === 0x47) { + return { + ext: 'png', + mime: 'image/png', + }; + } + + if (buf[0] === 0x47 && buf[1] === 0x49 && buf[2] === 0x46) { + return { + ext: 'gif', + mime: 'image/gif', + }; + } + + if (buf[8] === 0x57 && buf[9] === 0x45 && buf[10] === 0x42 && buf[11] === 0x50) { + return { + ext: 'webp', + mime: 'image/webp', + }; + } + + if (buf[0] === 0x46 && buf[1] === 0x4C && buf[2] === 0x49 && buf[3] === 0x46) { + return { + ext: 'flif', + mime: 'image/flif', + }; + } + + // needs to be before `tif` check + if ( + ((buf[0] === 0x49 && buf[1] === 0x49 && buf[2] === 0x2A && buf[3] === 0x0) || + (buf[0] === 0x4D && buf[1] === 0x4D && buf[2] === 0x0 && buf[3] === 0x2A)) && buf[8] === 0x43 && buf[9] === 0x52 + ) { + return { + ext: 'cr2', + mime: 'image/x-canon-cr2', + }; + } + + if ( + (buf[0] === 0x49 && buf[1] === 0x49 && buf[2] === 0x2A && buf[3] === 0x0) || + (buf[0] === 0x4D && buf[1] === 0x4D && buf[2] === 0x0 && buf[3] === 0x2A) + ) { + return { + ext: 'tif', + mime: 'image/tiff', + }; + } + + if (buf[0] === 0x42 && buf[1] === 0x4D) { + return { + ext: 'bmp', + mime: 'image/bmp', + }; + } + + if (buf[0] === 0x49 && buf[1] === 0x49 && buf[2] === 0xBC) { + return { + ext: 'jxr', + mime: 'image/vnd.ms-photo', + }; + } + + if (buf[0] === 0x38 && buf[1] === 0x42 && buf[2] === 0x50 && buf[3] === 0x53) { + return { + ext: 'psd', + mime: 'image/vnd.adobe.photoshop', + }; + } + + // needs to be before `zip` check + if ( + buf[0] === 0x50 && buf[1] === 0x4B && buf[2] === 0x3 && buf[3] === 0x4 && buf[30] === 0x6D && buf[31] === 0x69 && + buf[32] === 0x6D && buf[33] === 0x65 && buf[34] === 0x74 && buf[35] === 0x79 && buf[36] === 0x70 && + buf[37] === 0x65 && buf[38] === 0x61 && buf[39] === 0x70 && buf[40] === 0x70 && buf[41] === 0x6C && + buf[42] === 0x69 && buf[43] === 0x63 && buf[44] === 0x61 && buf[45] === 0x74 && buf[46] === 0x69 && + buf[47] === 0x6F && buf[48] === 0x6E && buf[49] === 0x2F && buf[50] === 0x65 && buf[51] === 0x70 && + buf[52] === 0x75 && buf[53] === 0x62 && buf[54] === 0x2B && buf[55] === 0x7A && buf[56] === 0x69 && + buf[57] === 0x70 + ) { + return { + ext: 'epub', + mime: 'application/epub+zip', + }; + } + + // needs to be before `zip` check + // assumes signed .xpi from addons.mozilla.org + if ( + buf[0] === 0x50 && buf[1] === 0x4B && buf[2] === 0x3 && buf[3] === 0x4 && buf[30] === 0x4D && buf[31] === 0x45 && + buf[32] === 0x54 && buf[33] === 0x41 && buf[34] === 0x2D && buf[35] === 0x49 && buf[36] === 0x4E && + buf[37] === 0x46 && buf[38] === 0x2F && buf[39] === 0x6D && buf[40] === 0x6F && buf[41] === 0x7A && + buf[42] === 0x69 && buf[43] === 0x6C && buf[44] === 0x6C && buf[45] === 0x61 && buf[46] === 0x2E && + buf[47] === 0x72 && buf[48] === 0x73 && buf[49] === 0x61 + ) { + return { + ext: 'xpi', + mime: 'application/x-xpinstall', + }; + } + + if ( + buf[0] === 0x50 && buf[1] === 0x4B && (buf[2] === 0x3 || buf[2] === 0x5 || buf[2] === 0x7) && + (buf[3] === 0x4 || buf[3] === 0x6 || buf[3] === 0x8) + ) { + return { + ext: 'zip', + mime: 'application/zip', + }; + } + + if (buf[257] === 0x75 && buf[258] === 0x73 && buf[259] === 0x74 && buf[260] === 0x61 && buf[261] === 0x72) { + return { + ext: 'tar', + mime: 'application/x-tar', + }; + } + + if ( + buf[0] === 0x52 && buf[1] === 0x61 && buf[2] === 0x72 && buf[3] === 0x21 && buf[4] === 0x1A && buf[5] === 0x7 && + (buf[6] === 0x0 || buf[6] === 0x1) + ) { + return { + ext: 'rar', + mime: 'application/x-rar-compressed', + }; + } + + if (buf[0] === 0x1F && buf[1] === 0x8B && buf[2] === 0x8) { + return { + ext: 'gz', + mime: 'application/gzip', + }; + } + + if (buf[0] === 0x42 && buf[1] === 0x5A && buf[2] === 0x68) { + return { + ext: 'bz2', + mime: 'application/x-bzip2', + }; + } + + if (buf[0] === 0x37 && buf[1] === 0x7A && buf[2] === 0xBC && buf[3] === 0xAF && buf[4] === 0x27 && buf[5] === 0x1C) { + return { + ext: '7z', + mime: 'application/x-7z-compressed', + }; + } + + if (buf[0] === 0x78 && buf[1] === 0x01) { + return { + ext: 'dmg', + mime: 'application/x-apple-diskimage', + }; + } + + if ( + (buf[0] === 0x0 && buf[1] === 0x0 && buf[2] === 0x0 && (buf[3] === 0x18 || buf[3] === 0x20) && buf[4] === 0x66 && + buf[5] === 0x74 && buf[6] === 0x79 && buf[7] === 0x70) || + (buf[0] === 0x33 && buf[1] === 0x67 && buf[2] === 0x70 && buf[3] === 0x35) || + (buf[0] === 0x0 && buf[1] === 0x0 && buf[2] === 0x0 && buf[3] === 0x1C && buf[4] === 0x66 && buf[5] === 0x74 && + buf[6] === 0x79 && buf[7] === 0x70 && buf[8] === 0x6D && buf[9] === 0x70 && buf[10] === 0x34 && + buf[11] === 0x32 && buf[16] === 0x6D && buf[17] === 0x70 && buf[18] === 0x34 && buf[19] === 0x31 && + buf[20] === 0x6D && buf[21] === 0x70 && buf[22] === 0x34 && buf[23] === 0x32 && buf[24] === 0x69 && + buf[25] === 0x73 && buf[26] === 0x6F && buf[27] === 0x6D) || + (buf[0] === 0x0 && buf[1] === 0x0 && buf[2] === 0x0 && buf[3] === 0x1C && buf[4] === 0x66 && buf[5] === 0x74 && + buf[6] === 0x79 && buf[7] === 0x70 && buf[8] === 0x69 && buf[9] === 0x73 && buf[10] === 0x6F && + buf[11] === 0x6D) || + (buf[0] === 0x0 && buf[1] === 0x0 && buf[2] === 0x0 && buf[3] === 0x1c && buf[4] === 0x66 && buf[5] === 0x74 && + buf[6] === 0x79 && buf[7] === 0x70 && buf[8] === 0x6D && buf[9] === 0x70 && buf[10] === 0x34 && + buf[11] === 0x32 && buf[12] === 0x0 && buf[13] === 0x0 && buf[14] === 0x0 && buf[15] === 0x0) + ) { + return { + ext: 'mp4', + mime: 'video/mp4', + }; + } + + if ( + buf[0] === 0x0 && buf[1] === 0x0 && buf[2] === 0x0 && buf[3] === 0x1C && buf[4] === 0x66 && + buf[5] === 0x74 && buf[6] === 0x79 && buf[7] === 0x70 && buf[8] === 0x4D && buf[9] === 0x34 && buf[10] === 0x56 + ) { + return { + ext: 'm4v', + mime: 'video/x-m4v', + }; + } + + if (buf[0] === 0x4D && buf[1] === 0x54 && buf[2] === 0x68 && buf[3] === 0x64) { + return { + ext: 'mid', + mime: 'audio/midi', + }; + } + + // https://github.com/threatstack/libmagic/blob/master/magic/Magdir/matroska + if (buf[0] === 0x1A && buf[1] === 0x45 && buf[2] === 0xDF && buf[3] === 0xA3) { + const sliced = buf.subarray(4, 4 + 4096); + const idPos = sliced.findIndex((el, i, arr) => arr[i] === 0x42 && arr[i + 1] === 0x82); + + if (idPos >= 0) { + const docTypePos = idPos + 3; + const findDocType = (type) => Array.from(type).every((c, i) => sliced[docTypePos + i] === c.charCodeAt(0)); + + if (findDocType('matroska')) { + return { + ext: 'mkv', + mime: 'video/x-matroska', + }; + } + if (findDocType('webm')) { + return { + ext: 'webm', + mime: 'video/webm', + }; + } + } + } + + if ( + buf[0] === 0x0 && buf[1] === 0x0 && buf[2] === 0x0 && buf[3] === 0x14 && buf[4] === 0x66 && buf[5] === 0x74 && + buf[6] === 0x79 && buf[7] === 0x70 + ) { + return { + ext: 'mov', + mime: 'video/quicktime', + }; + } + + if ( + buf[0] === 0x52 && buf[1] === 0x49 && buf[2] === 0x46 && buf[3] === 0x46 && buf[8] === 0x41 && buf[9] === 0x56 && + buf[10] === 0x49 + ) { + return { + ext: 'avi', + mime: 'video/x-msvideo', + }; + } + + if ( + buf[0] === 0x30 && buf[1] === 0x26 && buf[2] === 0xB2 && buf[3] === 0x75 && buf[4] === 0x8E && buf[5] === 0x66 && + buf[6] === 0xCF && buf[7] === 0x11 && buf[8] === 0xA6 && buf[9] === 0xD9 + ) { + return { + ext: 'wmv', + mime: 'video/x-ms-wmv', + }; + } + + if (buf[0] === 0x0 && buf[1] === 0x0 && buf[2] === 0x1 && buf[3].toString(16)[0] === 'b') { + return { + ext: 'mpg', + mime: 'video/mpeg', + }; + } + + if ((buf[0] === 0x49 && buf[1] === 0x44 && buf[2] === 0x33) || (buf[0] === 0xFF && buf[1] === 0xfb)) { + return { + ext: 'mp3', + mime: 'audio/mpeg', + }; + } + + if ((buf[4] === 0x66 && buf[5] === 0x74 && buf[6] === 0x79 && buf[7] === 0x70 && buf[8] === 0x4D && + buf[9] === 0x34 && buf[10] === 0x41) || (buf[0] === 0x4D && buf[1] === 0x34 && buf[2] === 0x41 && buf[3] === 0x20) + ) { + return { + ext: 'm4a', + mime: 'audio/m4a', + }; + } + + // needs to be before `ogg` check + if ( + buf[28] === 0x4F && buf[29] === 0x70 && buf[30] === 0x75 && buf[31] === 0x73 && buf[32] === 0x48 && + buf[33] === 0x65 && buf[34] === 0x61 && buf[35] === 0x64 + ) { + return { + ext: 'opus', + mime: 'audio/opus', + }; + } + + if (buf[0] === 0x4F && buf[1] === 0x67 && buf[2] === 0x67 && buf[3] === 0x53) { + return { + ext: 'ogg', + mime: 'audio/ogg', + }; + } + + if (buf[0] === 0x66 && buf[1] === 0x4C && buf[2] === 0x61 && buf[3] === 0x43) { + return { + ext: 'flac', + mime: 'audio/x-flac', + }; + } + + if ( + buf[0] === 0x52 && buf[1] === 0x49 && buf[2] === 0x46 && buf[3] === 0x46 && buf[8] === 0x57 && buf[9] === 0x41 && + buf[10] === 0x56 && buf[11] === 0x45 + ) { + return { + ext: 'wav', + mime: 'audio/x-wav', + }; + } + + if (buf[0] === 0x23 && buf[1] === 0x21 && buf[2] === 0x41 && buf[3] === 0x4D && buf[4] === 0x52 && buf[5] === 0x0A) { + return { + ext: 'amr', + mime: 'audio/amr', + }; + } + + if (buf[0] === 0x25 && buf[1] === 0x50 && buf[2] === 0x44 && buf[3] === 0x46) { + return { + ext: 'pdf', + mime: 'application/pdf', + }; + } + + if (buf[0] === 0x4D && buf[1] === 0x5A) { + return { + ext: 'exe', + mime: 'application/x-msdownload', + }; + } + + if ((buf[0] === 0x43 || buf[0] === 0x46) && buf[1] === 0x57 && buf[2] === 0x53) { + return { + ext: 'swf', + mime: 'application/x-shockwave-flash', + }; + } + + if (buf[0] === 0x7B && buf[1] === 0x5C && buf[2] === 0x72 && buf[3] === 0x74 && buf[4] === 0x66) { + return { + ext: 'rtf', + mime: 'application/rtf', + }; + } + + if ( + (buf[0] === 0x77 && buf[1] === 0x4F && buf[2] === 0x46 && buf[3] === 0x46) && + ( + (buf[4] === 0x00 && buf[5] === 0x01 && buf[6] === 0x00 && buf[7] === 0x00) || + (buf[4] === 0x4F && buf[5] === 0x54 && buf[6] === 0x54 && buf[7] === 0x4F) + ) + ) { + return { + ext: 'woff', + mime: 'application/font-woff', + }; + } + + if ( + (buf[0] === 0x77 && buf[1] === 0x4F && buf[2] === 0x46 && buf[3] === 0x32) && + ( + (buf[4] === 0x00 && buf[5] === 0x01 && buf[6] === 0x00 && buf[7] === 0x00) || + (buf[4] === 0x4F && buf[5] === 0x54 && buf[6] === 0x54 && buf[7] === 0x4F) + ) + ) { + return { + ext: 'woff2', + mime: 'application/font-woff', + }; + } + + if ( + (buf[34] === 0x4C && buf[35] === 0x50) && + ( + (buf[8] === 0x00 && buf[9] === 0x00 && buf[10] === 0x01) || + (buf[8] === 0x01 && buf[9] === 0x00 && buf[10] === 0x02) || + (buf[8] === 0x02 && buf[9] === 0x00 && buf[10] === 0x02) + ) + ) { + return { + ext: 'eot', + mime: 'application/octet-stream', + }; + } + + if (buf[0] === 0x00 && buf[1] === 0x01 && buf[2] === 0x00 && buf[3] === 0x00 && buf[4] === 0x00) { + return { + ext: 'ttf', + mime: 'application/font-sfnt', + }; + } + + if (buf[0] === 0x4F && buf[1] === 0x54 && buf[2] === 0x54 && buf[3] === 0x4F && buf[4] === 0x00) { + return { + ext: 'otf', + mime: 'application/font-sfnt', + }; + } + + if (buf[0] === 0x00 && buf[1] === 0x00 && buf[2] === 0x01 && buf[3] === 0x00) { + return { + ext: 'ico', + mime: 'image/x-icon', + }; + } + + if (buf[0] === 0x46 && buf[1] === 0x4C && buf[2] === 0x56 && buf[3] === 0x01) { + return { + ext: 'flv', + mime: 'video/x-flv', + }; + } + + if (buf[0] === 0x25 && buf[1] === 0x21) { + return { + ext: 'ps', + mime: 'application/postscript', + }; + } + + if (buf[0] === 0xFD && buf[1] === 0x37 && buf[2] === 0x7A && buf[3] === 0x58 && buf[4] === 0x5A && buf[5] === 0x00) { + return { + ext: 'xz', + mime: 'application/x-xz', + }; + } + + if (buf[0] === 0x53 && buf[1] === 0x51 && buf[2] === 0x4C && buf[3] === 0x69) { + return { + ext: 'sqlite', + mime: 'application/x-sqlite3', + }; + } + + if (buf[0] === 0x4E && buf[1] === 0x45 && buf[2] === 0x53 && buf[3] === 0x1A) { + return { + ext: 'nes', + mime: 'application/x-nintendo-nes-rom', + }; + } + + if (buf[0] === 0x43 && buf[1] === 0x72 && buf[2] === 0x32 && buf[3] === 0x34) { + return { + ext: 'crx', + mime: 'application/x-google-chrome-extension', + }; + } + + if ( + (buf[0] === 0x4D && buf[1] === 0x53 && buf[2] === 0x43 && buf[3] === 0x46) || + (buf[0] === 0x49 && buf[1] === 0x53 && buf[2] === 0x63 && buf[3] === 0x28) + ) { + return { + ext: 'cab', + mime: 'application/vnd.ms-cab-compressed', + }; + } + + // needs to be before `ar` check + if ( + buf[0] === 0x21 && buf[1] === 0x3C && buf[2] === 0x61 && buf[3] === 0x72 && buf[4] === 0x63 && buf[5] === 0x68 && + buf[6] === 0x3E && buf[7] === 0x0A && buf[8] === 0x64 && buf[9] === 0x65 && buf[10] === 0x62 && buf[11] === 0x69 && + buf[12] === 0x61 && buf[13] === 0x6E && buf[14] === 0x2D && buf[15] === 0x62 && buf[16] === 0x69 && + buf[17] === 0x6E && buf[18] === 0x61 && buf[19] === 0x72 && buf[20] === 0x79 + ) { + return { + ext: 'deb', + mime: 'application/x-deb', + }; + } + + if ( + buf[0] === 0x21 && buf[1] === 0x3C && buf[2] === 0x61 && buf[3] === 0x72 && buf[4] === 0x63 && buf[5] === 0x68 && + buf[6] === 0x3E + ) { + return { + ext: 'ar', + mime: 'application/x-unix-archive', + }; + } + + if (buf[0] === 0xED && buf[1] === 0xAB && buf[2] === 0xEE && buf[3] === 0xDB) { + return { + ext: 'rpm', + mime: 'application/x-rpm', + }; + } + + if ( + (buf[0] === 0x1F && buf[1] === 0xA0) || + (buf[0] === 0x1F && buf[1] === 0x9D) + ) { + return { + ext: 'Z', + mime: 'application/x-compress', + }; + } + + if (buf[0] === 0x4C && buf[1] === 0x5A && buf[2] === 0x49 && buf[3] === 0x50) { + return { + ext: 'lz', + mime: 'application/x-lzip', + }; + } + + if ( + buf[0] === 0xD0 && buf[1] === 0xCF && buf[2] === 0x11 && buf[3] === 0xE0 && buf[4] === 0xA1 && buf[5] === 0xB1 && + buf[6] === 0x1A && buf[7] === 0xE1 + ) { + return { + ext: 'msi', + mime: 'application/x-msi', + }; + } + + if ( + buf[0] === 0x06 && buf[1] === 0x0E && buf[2] === 0x2B && buf[3] === 0x34 && buf[4] === 0x02 && buf[5] === 0x05 && + buf[6] === 0x01 && buf[7] === 0x01 && buf[8] === 0x0D && buf[9] === 0x01 && buf[10] === 0x02 && buf[11] === 0x01 && + buf[12] === 0x01 && buf[13] === 0x02 + ) { + return { + ext: 'mxf', + mime: 'application/mxf', + }; + } + + return null; } -/** - * Mixin the prototype properties. - * - * @param {Object} obj - * @return {Object} - * @api private - */ - -function mixin(obj) { - for (var key in RequestBase.prototype) { - obj[key] = RequestBase.prototype[key]; - } - return obj; -} - -/** - * Clear previous timeout. - * - * @return {Request} for chaining - * @api public - */ - -RequestBase.prototype.clearTimeout = function _clearTimeout(){ - clearTimeout(this._timer); - clearTimeout(this._responseTimeoutTimer); - delete this._timer; - delete this._responseTimeoutTimer; - return this; -}; - -/** - * Override default response body parser - * - * This function will be called to convert incoming data into request.body - * - * @param {Function} - * @api public - */ - -RequestBase.prototype.parse = function parse(fn){ - this._parser = fn; - return this; -}; - -/** - * Set format of binary response body. - * In browser valid formats are 'blob' and 'arraybuffer', - * which return Blob and ArrayBuffer, respectively. - * - * In Node all values result in Buffer. - * - * Examples: - * - * req.get('/') - * .responseType('blob') - * .end(callback); - * - * @param {String} val - * @return {Request} for chaining - * @api public - */ - -RequestBase.prototype.responseType = function(val){ - this._responseType = val; - return this; -}; - -/** - * Override default request body serializer - * - * This function will be called to convert data set via .send or .attach into payload to send - * - * @param {Function} - * @api public - */ - -RequestBase.prototype.serialize = function serialize(fn){ - this._serializer = fn; - return this; -}; - -/** - * Set timeouts. - * - * - response timeout is time between sending request and receiving the first byte of the response. Includes DNS and connection time. - * - deadline is the time from start of the request to receiving response body in full. If the deadline is too short large files may not load at all on slow connections. - * - * Value of 0 or false means no timeout. - * - * @param {Number|Object} ms or {response, read, deadline} - * @return {Request} for chaining - * @api public - */ - -RequestBase.prototype.timeout = function timeout(options){ - if (!options || 'object' !== typeof options) { - this._timeout = options; - this._responseTimeout = 0; - return this; - } - - if ('undefined' !== typeof options.deadline) { - this._timeout = options.deadline; - } - if ('undefined' !== typeof options.response) { - this._responseTimeout = options.response; - } - return this; -}; - -/** - * Set number of retry attempts on error. - * - * Failed requests will be retried 'count' times if timeout or err.code >= 500. - * - * @param {Number} count - * @return {Request} for chaining - * @api public - */ - -RequestBase.prototype.retry = function retry(count){ - // Default to 1 if no count passed or true - if (arguments.length === 0 || count === true) count = 1; - if (count <= 0) count = 0; - this._maxRetries = count; - this._retries = 0; - return this; -}; - -/** - * Retry request - * - * @return {Request} for chaining - * @api private - */ - -RequestBase.prototype._retry = function() { - this.clearTimeout(); - - // node - if (this.req) { - this.req = null; - this.req = this.request(); - } - - this._aborted = false; - this.timedout = false; - - return this._end(); -}; - -/** - * Promise support - * - * @param {Function} resolve - * @param {Function} [reject] - * @return {Request} - */ - -RequestBase.prototype.then = function then(resolve, reject) { - if (!this._fullfilledPromise) { - var self = this; - if (this._endCalled) { - console.warn("Warning: superagent request was sent twice, because both .end() and .then() were called. Never call .end() if you use promises"); - } - this._fullfilledPromise = new Promise(function(innerResolve, innerReject){ - self.end(function(err, res){ - if (err) innerReject(err); else innerResolve(res); - }); - }); - } - return this._fullfilledPromise.then(resolve, reject); -} - -RequestBase.prototype.catch = function(cb) { - return this.then(undefined, cb); -}; - -/** - * Allow for extension - */ - -RequestBase.prototype.use = function use(fn) { - fn(this); - return this; -} - -RequestBase.prototype.ok = function(cb) { - if ('function' !== typeof cb) throw Error("Callback required"); - this._okCallback = cb; - return this; -}; - -RequestBase.prototype._isResponseOK = function(res) { - if (!res) { - return false; - } - - if (this._okCallback) { - return this._okCallback(res); - } - - return res.status >= 200 && res.status < 300; -}; - - -/** - * Get request header `field`. - * Case-insensitive. - * - * @param {String} field - * @return {String} - * @api public - */ - -RequestBase.prototype.get = function(field){ - return this._header[field.toLowerCase()]; -}; - -/** - * Get case-insensitive header `field` value. - * This is a deprecated internal API. Use `.get(field)` instead. - * - * (getHeader is no longer used internally by the superagent code base) - * - * @param {String} field - * @return {String} - * @api private - * @deprecated - */ - -RequestBase.prototype.getHeader = RequestBase.prototype.get; - -/** - * Set header `field` to `val`, or multiple fields with one object. - * Case-insensitive. - * - * Examples: - * - * req.get('/') - * .set('Accept', 'application/json') - * .set('X-API-Key', 'foobar') - * .end(callback); - * - * req.get('/') - * .set({ Accept: 'application/json', 'X-API-Key': 'foobar' }) - * .end(callback); - * - * @param {String|Object} field - * @param {String} val - * @return {Request} for chaining - * @api public - */ - -RequestBase.prototype.set = function(field, val){ - if (isObject(field)) { - for (var key in field) { - this.set(key, field[key]); - } - return this; - } - this._header[field.toLowerCase()] = val; - this.header[field] = val; - return this; -}; - -/** - * Remove header `field`. - * Case-insensitive. - * - * Example: - * - * req.get('/') - * .unset('User-Agent') - * .end(callback); - * - * @param {String} field - */ -RequestBase.prototype.unset = function(field){ - delete this._header[field.toLowerCase()]; - delete this.header[field]; - return this; -}; - -/** - * Write the field `name` and `val`, or multiple fields with one object - * for "multipart/form-data" request bodies. - * - * ``` js - * request.post('/upload') - * .field('foo', 'bar') - * .end(callback); - * - * request.post('/upload') - * .field({ foo: 'bar', baz: 'qux' }) - * .end(callback); - * ``` - * - * @param {String|Object} name - * @param {String|Blob|File|Buffer|fs.ReadStream} val - * @return {Request} for chaining - * @api public - */ -RequestBase.prototype.field = function(name, val) { - - // name should be either a string or an object. - if (null === name || undefined === name) { - throw new Error('.field(name, val) name can not be empty'); - } - - if (this._data) { - console.error(".field() can't be used if .send() is used. Please use only .send() or only .field() & .attach()"); - } - - if (isObject(name)) { - for (var key in name) { - this.field(key, name[key]); - } - return this; - } - - if (Array.isArray(val)) { - for (var i in val) { - this.field(name, val[i]); - } - return this; - } - - // val should be defined now - if (null === val || undefined === val) { - throw new Error('.field(name, val) val can not be empty'); - } - if ('boolean' === typeof val) { - val = '' + val; - } - this._getFormData().append(name, val); - return this; -}; - -/** - * Abort the request, and clear potential timeout. - * - * @return {Request} - * @api public - */ -RequestBase.prototype.abort = function(){ - if (this._aborted) { - return this; - } - this._aborted = true; - this.xhr && this.xhr.abort(); // browser - this.req && this.req.abort(); // node - this.clearTimeout(); - this.emit('abort'); - return this; -}; - -/** - * Enable transmission of cookies with x-domain requests. - * - * Note that for this to work the origin must not be - * using "Access-Control-Allow-Origin" with a wildcard, - * and also must set "Access-Control-Allow-Credentials" - * to "true". - * - * @api public - */ - -RequestBase.prototype.withCredentials = function(){ - // This is browser-only functionality. Node side is no-op. - this._withCredentials = true; - return this; -}; - -/** - * Set the max redirects to `n`. Does noting in browser XHR implementation. - * - * @param {Number} n - * @return {Request} for chaining - * @api public - */ - -RequestBase.prototype.redirects = function(n){ - this._maxRedirects = n; - return this; -}; - -/** - * Convert to a plain javascript object (not JSON string) of scalar properties. - * Note as this method is designed to return a useful non-this value, - * it cannot be chained. - * - * @return {Object} describing method, url, and data of this request - * @api public - */ - -RequestBase.prototype.toJSON = function(){ - return { - method: this.method, - url: this.url, - data: this._data, - headers: this._header - }; -}; - - -/** - * Send `data` as the request body, defaulting the `.type()` to "json" when - * an object is given. - * - * Examples: - * - * // manual json - * request.post('/user') - * .type('json') - * .send('{"name":"tj"}') - * .end(callback) - * - * // auto json - * request.post('/user') - * .send({ name: 'tj' }) - * .end(callback) - * - * // manual x-www-form-urlencoded - * request.post('/user') - * .type('form') - * .send('name=tj') - * .end(callback) - * - * // auto x-www-form-urlencoded - * request.post('/user') - * .type('form') - * .send({ name: 'tj' }) - * .end(callback) - * - * // defaults to x-www-form-urlencoded - * request.post('/user') - * .send('name=tobi') - * .send('species=ferret') - * .end(callback) - * - * @param {String|Object} data - * @return {Request} for chaining - * @api public - */ - -RequestBase.prototype.send = function(data){ - var isObj = isObject(data); - var type = this._header['content-type']; - - if (this._formData) { - console.error(".send() can't be used if .attach() or .field() is used. Please use only .send() or only .field() & .attach()"); - } - - if (isObj && !this._data) { - if (Array.isArray(data)) { - this._data = []; - } else if (!this._isHost(data)) { - this._data = {}; - } - } else if (data && this._data && this._isHost(this._data)) { - throw Error("Can't merge these send calls"); - } - - // merge - if (isObj && isObject(this._data)) { - for (var key in data) { - this._data[key] = data[key]; - } - } else if ('string' == typeof data) { - // default to x-www-form-urlencoded - if (!type) this.type('form'); - type = this._header['content-type']; - if ('application/x-www-form-urlencoded' == type) { - this._data = this._data - ? this._data + '&' + data - : data; - } else { - this._data = (this._data || '') + data; - } - } else { - this._data = data; - } - - if (!isObj || this._isHost(data)) { - return this; - } - - // default to json - if (!type) this.type('json'); - return this; -}; - - -/** - * Sort `querystring` by the sort function - * - * - * Examples: - * - * // default order - * request.get('/user') - * .query('name=Nick') - * .query('search=Manny') - * .sortQuery() - * .end(callback) - * - * // customized sort function - * request.get('/user') - * .query('name=Nick') - * .query('search=Manny') - * .sortQuery(function(a, b){ - * return a.length - b.length; - * }) - * .end(callback) - * - * - * @param {Function} sort - * @return {Request} for chaining - * @api public - */ - -RequestBase.prototype.sortQuery = function(sort) { - // _sort default to true but otherwise can be a function or boolean - this._sort = typeof sort === 'undefined' ? true : sort; - return this; -}; - -/** - * Invoke callback with timeout error. - * - * @api private - */ - -RequestBase.prototype._timeoutError = function(reason, timeout){ - if (this._aborted) { - return; - } - var err = new Error(reason + timeout + 'ms exceeded'); - err.timeout = timeout; - err.code = 'ECONNABORTED'; - this.timedout = true; - this.abort(); - this.callback(err); -}; - -RequestBase.prototype._setTimeouts = function() { - var self = this; - - // deadline - if (this._timeout && !this._timer) { - this._timer = setTimeout(function(){ - self._timeoutError('Timeout of ', self._timeout); - }, this._timeout); - } - // response timeout - if (this._responseTimeout && !this._responseTimeoutTimer) { - this._responseTimeoutTimer = setTimeout(function(){ - self._timeoutError('Response timeout of ', self._responseTimeout); - }, this._responseTimeout); - } -} +module.exports = mimeOfBuffer; /***/ }), /* 61 */ -/***/ (function(module, exports, __webpack_require__) { +/***/ (function(module, exports) { - -/** - * Module dependencies. - */ - -var utils = __webpack_require__(63); - -/** - * Expose `ResponseBase`. - */ - -module.exports = ResponseBase; - -/** - * Initialize a new `ResponseBase`. - * - * @api public - */ - -function ResponseBase(obj) { - if (obj) return mixin(obj); -} - -/** - * Mixin the prototype properties. - * - * @param {Object} obj - * @return {Object} - * @api private - */ - -function mixin(obj) { - for (var key in ResponseBase.prototype) { - obj[key] = ResponseBase.prototype[key]; - } - return obj; -} - -/** - * Get case-insensitive `field` value. - * - * @param {String} field - * @return {String} - * @api public - */ - -ResponseBase.prototype.get = function(field){ - return this.header[field.toLowerCase()]; +module.exports = { + "123": "application/vnd.lotus-1-2-3", + "ez": "application/andrew-inset", + "aw": "application/applixware", + "atom": "application/atom+xml", + "atomcat": "application/atomcat+xml", + "atomsvc": "application/atomsvc+xml", + "bdoc": "application/x-bdoc", + "ccxml": "application/ccxml+xml", + "cdmia": "application/cdmi-capability", + "cdmic": "application/cdmi-container", + "cdmid": "application/cdmi-domain", + "cdmio": "application/cdmi-object", + "cdmiq": "application/cdmi-queue", + "cu": "application/cu-seeme", + "mpd": "application/dash+xml", + "davmount": "application/davmount+xml", + "dbk": "application/docbook+xml", + "dssc": "application/dssc+der", + "xdssc": "application/dssc+xml", + "ecma": "application/ecmascript", + "emma": "application/emma+xml", + "epub": "application/epub+zip", + "exi": "application/exi", + "pfr": "application/font-tdpfr", + "woff": "application/font-woff", + "woff2": "application/font-woff2", + "geojson": "application/geo+json", + "gml": "application/gml+xml", + "gpx": "application/gpx+xml", + "gxf": "application/gxf", + "stk": "application/hyperstudio", + "ink": "application/inkml+xml", + "inkml": "application/inkml+xml", + "ipfix": "application/ipfix", + "jar": "application/java-archive", + "war": "application/java-archive", + "ear": "application/java-archive", + "ser": "application/java-serialized-object", + "class": "application/java-vm", + "js": "application/javascript", + "json": "application/json", + "map": "application/json", + "json5": "application/json5", + "jsonml": "application/jsonml+json", + "jsonld": "application/ld+json", + "lostxml": "application/lost+xml", + "hqx": "application/mac-binhex40", + "cpt": "application/mac-compactpro", + "mads": "application/mads+xml", + "webmanifest": "application/manifest+json", + "mrc": "application/marc", + "mrcx": "application/marcxml+xml", + "ma": "application/mathematica", + "nb": "application/mathematica", + "mb": "application/mathematica", + "mathml": "application/mathml+xml", + "mbox": "application/mbox", + "mscml": "application/mediaservercontrol+xml", + "metalink": "application/metalink+xml", + "meta4": "application/metalink4+xml", + "mets": "application/mets+xml", + "mods": "application/mods+xml", + "m21": "application/mp21", + "mp21": "application/mp21", + "mp4s": "application/mp4", + "m4p": "application/mp4", + "doc": "application/msword", + "dot": "application/msword", + "mxf": "application/mxf", + "bin": "application/octet-stream", + "dms": "application/octet-stream", + "lrf": "application/octet-stream", + "mar": "application/octet-stream", + "so": "application/octet-stream", + "dist": "application/octet-stream", + "distz": "application/octet-stream", + "pkg": "application/octet-stream", + "bpk": "application/octet-stream", + "dump": "application/octet-stream", + "elc": "application/octet-stream", + "deploy": "application/octet-stream", + "exe": "application/x-msdownload", + "dll": "application/x-msdownload", + "deb": "application/x-debian-package", + "dmg": "application/x-apple-diskimage", + "iso": "application/x-iso9660-image", + "img": "application/octet-stream", + "msi": "application/x-msdownload", + "msp": "application/octet-stream", + "msm": "application/octet-stream", + "buffer": "application/octet-stream", + "oda": "application/oda", + "opf": "application/oebps-package+xml", + "ogx": "application/ogg", + "omdoc": "application/omdoc+xml", + "onetoc": "application/onenote", + "onetoc2": "application/onenote", + "onetmp": "application/onenote", + "onepkg": "application/onenote", + "oxps": "application/oxps", + "xer": "application/patch-ops-error+xml", + "pdf": "application/pdf", + "pgp": "application/pgp-encrypted", + "asc": "application/pgp-signature", + "sig": "application/pgp-signature", + "prf": "application/pics-rules", + "p10": "application/pkcs10", + "p7m": "application/pkcs7-mime", + "p7c": "application/pkcs7-mime", + "p7s": "application/pkcs7-signature", + "p8": "application/pkcs8", + "ac": "application/pkix-attr-cert", + "cer": "application/pkix-cert", + "crl": "application/pkix-crl", + "pkipath": "application/pkix-pkipath", + "pki": "application/pkixcmp", + "pls": "application/pls+xml", + "ai": "application/postscript", + "eps": "application/postscript", + "ps": "application/postscript", + "cww": "application/prs.cww", + "pskcxml": "application/pskc+xml", + "rdf": "application/rdf+xml", + "rif": "application/reginfo+xml", + "rnc": "application/relax-ng-compact-syntax", + "rl": "application/resource-lists+xml", + "rld": "application/resource-lists-diff+xml", + "rs": "application/rls-services+xml", + "gbr": "application/rpki-ghostbusters", + "mft": "application/rpki-manifest", + "roa": "application/rpki-roa", + "rsd": "application/rsd+xml", + "rss": "application/rss+xml", + "rtf": "text/rtf", + "sbml": "application/sbml+xml", + "scq": "application/scvp-cv-request", + "scs": "application/scvp-cv-response", + "spq": "application/scvp-vp-request", + "spp": "application/scvp-vp-response", + "sdp": "application/sdp", + "setpay": "application/set-payment-initiation", + "setreg": "application/set-registration-initiation", + "shf": "application/shf+xml", + "smi": "application/smil+xml", + "smil": "application/smil+xml", + "rq": "application/sparql-query", + "srx": "application/sparql-results+xml", + "gram": "application/srgs", + "grxml": "application/srgs+xml", + "sru": "application/sru+xml", + "ssdl": "application/ssdl+xml", + "ssml": "application/ssml+xml", + "tei": "application/tei+xml", + "teicorpus": "application/tei+xml", + "tfi": "application/thraud+xml", + "tsd": "application/timestamped-data", + "plb": "application/vnd.3gpp.pic-bw-large", + "psb": "application/vnd.3gpp.pic-bw-small", + "pvb": "application/vnd.3gpp.pic-bw-var", + "tcap": "application/vnd.3gpp2.tcap", + "pwn": "application/vnd.3m.post-it-notes", + "aso": "application/vnd.accpac.simply.aso", + "imp": "application/vnd.accpac.simply.imp", + "acu": "application/vnd.acucobol", + "atc": "application/vnd.acucorp", + "acutc": "application/vnd.acucorp", + "air": "application/vnd.adobe.air-application-installer-package+zip", + "fcdt": "application/vnd.adobe.formscentral.fcdt", + "fxp": "application/vnd.adobe.fxp", + "fxpl": "application/vnd.adobe.fxp", + "xdp": "application/vnd.adobe.xdp+xml", + "xfdf": "application/vnd.adobe.xfdf", + "ahead": "application/vnd.ahead.space", + "azf": "application/vnd.airzip.filesecure.azf", + "azs": "application/vnd.airzip.filesecure.azs", + "azw": "application/vnd.amazon.ebook", + "acc": "application/vnd.americandynamics.acc", + "ami": "application/vnd.amiga.ami", + "apk": "application/vnd.android.package-archive", + "cii": "application/vnd.anser-web-certificate-issue-initiation", + "fti": "application/vnd.anser-web-funds-transfer-initiation", + "atx": "application/vnd.antix.game-component", + "mpkg": "application/vnd.apple.installer+xml", + "m3u8": "application/vnd.apple.mpegurl", + "pkpass": "application/vnd.apple.pkpass", + "swi": "application/vnd.aristanetworks.swi", + "iota": "application/vnd.astraea-software.iota", + "aep": "application/vnd.audiograph", + "mpm": "application/vnd.blueice.multipass", + "bmi": "application/vnd.bmi", + "rep": "application/vnd.businessobjects", + "cdxml": "application/vnd.chemdraw+xml", + "mmd": "application/vnd.chipnuts.karaoke-mmd", + "cdy": "application/vnd.cinderella", + "cla": "application/vnd.claymore", + "rp9": "application/vnd.cloanto.rp9", + "c4g": "application/vnd.clonk.c4group", + "c4d": "application/vnd.clonk.c4group", + "c4f": "application/vnd.clonk.c4group", + "c4p": "application/vnd.clonk.c4group", + "c4u": "application/vnd.clonk.c4group", + "c11amc": "application/vnd.cluetrust.cartomobile-config", + "c11amz": "application/vnd.cluetrust.cartomobile-config-pkg", + "csp": "application/vnd.commonspace", + "cdbcmsg": "application/vnd.contact.cmsg", + "cmc": "application/vnd.cosmocaller", + "clkx": "application/vnd.crick.clicker", + "clkk": "application/vnd.crick.clicker.keyboard", + "clkp": "application/vnd.crick.clicker.palette", + "clkt": "application/vnd.crick.clicker.template", + "clkw": "application/vnd.crick.clicker.wordbank", + "wbs": "application/vnd.criticaltools.wbs+xml", + "pml": "application/vnd.ctc-posml", + "ppd": "application/vnd.cups-ppd", + "car": "application/vnd.curl.car", + "pcurl": "application/vnd.curl.pcurl", + "dart": "application/vnd.dart", + "rdz": "application/vnd.data-vision.rdz", + "uvf": "application/vnd.dece.data", + "uvvf": "application/vnd.dece.data", + "uvd": "application/vnd.dece.data", + "uvvd": "application/vnd.dece.data", + "uvt": "application/vnd.dece.ttml+xml", + "uvvt": "application/vnd.dece.ttml+xml", + "uvx": "application/vnd.dece.unspecified", + "uvvx": "application/vnd.dece.unspecified", + "uvz": "application/vnd.dece.zip", + "uvvz": "application/vnd.dece.zip", + "fe_launch": "application/vnd.denovo.fcselayout-link", + "dna": "application/vnd.dna", + "mlp": "application/vnd.dolby.mlp", + "dpg": "application/vnd.dpgraph", + "dfac": "application/vnd.dreamfactory", + "kpxx": "application/vnd.ds-keypoint", + "ait": "application/vnd.dvb.ait", + "svc": "application/vnd.dvb.service", + "geo": "application/vnd.dynageo", + "mag": "application/vnd.ecowin.chart", + "nml": "application/vnd.enliven", + "esf": "application/vnd.epson.esf", + "msf": "application/vnd.epson.msf", + "qam": "application/vnd.epson.quickanime", + "slt": "application/vnd.epson.salt", + "ssf": "application/vnd.epson.ssf", + "es3": "application/vnd.eszigno3+xml", + "et3": "application/vnd.eszigno3+xml", + "ez2": "application/vnd.ezpix-album", + "ez3": "application/vnd.ezpix-package", + "fdf": "application/vnd.fdf", + "mseed": "application/vnd.fdsn.mseed", + "seed": "application/vnd.fdsn.seed", + "dataless": "application/vnd.fdsn.seed", + "gph": "application/vnd.flographit", + "ftc": "application/vnd.fluxtime.clip", + "fm": "application/vnd.framemaker", + "frame": "application/vnd.framemaker", + "maker": "application/vnd.framemaker", + "book": "application/vnd.framemaker", + "fnc": "application/vnd.frogans.fnc", + "ltf": "application/vnd.frogans.ltf", + "fsc": "application/vnd.fsc.weblaunch", + "oas": "application/vnd.fujitsu.oasys", + "oa2": "application/vnd.fujitsu.oasys2", + "oa3": "application/vnd.fujitsu.oasys3", + "fg5": "application/vnd.fujitsu.oasysgp", + "bh2": "application/vnd.fujitsu.oasysprs", + "ddd": "application/vnd.fujixerox.ddd", + "xdw": "application/vnd.fujixerox.docuworks", + "xbd": "application/vnd.fujixerox.docuworks.binder", + "fzs": "application/vnd.fuzzysheet", + "txd": "application/vnd.genomatix.tuxedo", + "ggb": "application/vnd.geogebra.file", + "ggt": "application/vnd.geogebra.tool", + "gex": "application/vnd.geometry-explorer", + "gre": "application/vnd.geometry-explorer", + "gxt": "application/vnd.geonext", + "g2w": "application/vnd.geoplan", + "g3w": "application/vnd.geospace", + "gmx": "application/vnd.gmx", + "gdoc": "application/vnd.google-apps.document", + "gslides": "application/vnd.google-apps.presentation", + "gsheet": "application/vnd.google-apps.spreadsheet", + "kml": "application/vnd.google-earth.kml+xml", + "kmz": "application/vnd.google-earth.kmz", + "gqf": "application/vnd.grafeq", + "gqs": "application/vnd.grafeq", + "gac": "application/vnd.groove-account", + "ghf": "application/vnd.groove-help", + "gim": "application/vnd.groove-identity-message", + "grv": "application/vnd.groove-injector", + "gtm": "application/vnd.groove-tool-message", + "tpl": "application/vnd.groove-tool-template", + "vcg": "application/vnd.groove-vcard", + "hal": "application/vnd.hal+xml", + "zmm": "application/vnd.handheld-entertainment+xml", + "hbci": "application/vnd.hbci", + "les": "application/vnd.hhe.lesson-player", + "hpgl": "application/vnd.hp-hpgl", + "hpid": "application/vnd.hp-hpid", + "hps": "application/vnd.hp-hps", + "jlt": "application/vnd.hp-jlyt", + "pcl": "application/vnd.hp-pcl", + "pclxl": "application/vnd.hp-pclxl", + "sfd-hdstx": "application/vnd.hydrostatix.sof-data", + "mpy": "application/vnd.ibm.minipay", + "afp": "application/vnd.ibm.modcap", + "listafp": "application/vnd.ibm.modcap", + "list3820": "application/vnd.ibm.modcap", + "irm": "application/vnd.ibm.rights-management", + "sc": "application/vnd.ibm.secure-container", + "icc": "application/vnd.iccprofile", + "icm": "application/vnd.iccprofile", + "igl": "application/vnd.igloader", + "ivp": "application/vnd.immervision-ivp", + "ivu": "application/vnd.immervision-ivu", + "igm": "application/vnd.insors.igm", + "xpw": "application/vnd.intercon.formnet", + "xpx": "application/vnd.intercon.formnet", + "i2g": "application/vnd.intergeo", + "qbo": "application/vnd.intu.qbo", + "qfx": "application/vnd.intu.qfx", + "rcprofile": "application/vnd.ipunplugged.rcprofile", + "irp": "application/vnd.irepository.package+xml", + "xpr": "application/vnd.is-xpr", + "fcs": "application/vnd.isac.fcs", + "jam": "application/vnd.jam", + "rms": "application/vnd.jcp.javame.midlet-rms", + "jisp": "application/vnd.jisp", + "joda": "application/vnd.joost.joda-archive", + "ktz": "application/vnd.kahootz", + "ktr": "application/vnd.kahootz", + "karbon": "application/vnd.kde.karbon", + "chrt": "application/vnd.kde.kchart", + "kfo": "application/vnd.kde.kformula", + "flw": "application/vnd.kde.kivio", + "kon": "application/vnd.kde.kontour", + "kpr": "application/vnd.kde.kpresenter", + "kpt": "application/vnd.kde.kpresenter", + "ksp": "application/vnd.kde.kspread", + "kwd": "application/vnd.kde.kword", + "kwt": "application/vnd.kde.kword", + "htke": "application/vnd.kenameaapp", + "kia": "application/vnd.kidspiration", + "kne": "application/vnd.kinar", + "knp": "application/vnd.kinar", + "skp": "application/vnd.koan", + "skd": "application/vnd.koan", + "skt": "application/vnd.koan", + "skm": "application/vnd.koan", + "sse": "application/vnd.kodak-descriptor", + "lasxml": "application/vnd.las.las+xml", + "lbd": "application/vnd.llamagraphics.life-balance.desktop", + "lbe": "application/vnd.llamagraphics.life-balance.exchange+xml", + "apr": "application/vnd.lotus-approach", + "pre": "application/vnd.lotus-freelance", + "nsf": "application/vnd.lotus-notes", + "org": "application/vnd.lotus-organizer", + "scm": "application/vnd.lotus-screencam", + "lwp": "application/vnd.lotus-wordpro", + "portpkg": "application/vnd.macports.portpkg", + "mcd": "application/vnd.mcd", + "mc1": "application/vnd.medcalcdata", + "cdkey": "application/vnd.mediastation.cdkey", + "mwf": "application/vnd.mfer", + "mfm": "application/vnd.mfmp", + "flo": "application/vnd.micrografx.flo", + "igx": "application/vnd.micrografx.igx", + "mif": "application/vnd.mif", + "daf": "application/vnd.mobius.daf", + "dis": "application/vnd.mobius.dis", + "mbk": "application/vnd.mobius.mbk", + "mqy": "application/vnd.mobius.mqy", + "msl": "application/vnd.mobius.msl", + "plc": "application/vnd.mobius.plc", + "txf": "application/vnd.mobius.txf", + "mpn": "application/vnd.mophun.application", + "mpc": "application/vnd.mophun.certificate", + "xul": "application/vnd.mozilla.xul+xml", + "cil": "application/vnd.ms-artgalry", + "cab": "application/vnd.ms-cab-compressed", + "xls": "application/vnd.ms-excel", + "xlm": "application/vnd.ms-excel", + "xla": "application/vnd.ms-excel", + "xlc": "application/vnd.ms-excel", + "xlt": "application/vnd.ms-excel", + "xlw": "application/vnd.ms-excel", + "xlam": "application/vnd.ms-excel.addin.macroenabled.12", + "xlsb": "application/vnd.ms-excel.sheet.binary.macroenabled.12", + "xlsm": "application/vnd.ms-excel.sheet.macroenabled.12", + "xltm": "application/vnd.ms-excel.template.macroenabled.12", + "eot": "application/vnd.ms-fontobject", + "chm": "application/vnd.ms-htmlhelp", + "ims": "application/vnd.ms-ims", + "lrm": "application/vnd.ms-lrm", + "thmx": "application/vnd.ms-officetheme", + "cat": "application/vnd.ms-pki.seccat", + "stl": "application/vnd.ms-pki.stl", + "ppt": "application/vnd.ms-powerpoint", + "pps": "application/vnd.ms-powerpoint", + "pot": "application/vnd.ms-powerpoint", + "ppam": "application/vnd.ms-powerpoint.addin.macroenabled.12", + "pptm": "application/vnd.ms-powerpoint.presentation.macroenabled.12", + "sldm": "application/vnd.ms-powerpoint.slide.macroenabled.12", + "ppsm": "application/vnd.ms-powerpoint.slideshow.macroenabled.12", + "potm": "application/vnd.ms-powerpoint.template.macroenabled.12", + "mpp": "application/vnd.ms-project", + "mpt": "application/vnd.ms-project", + "docm": "application/vnd.ms-word.document.macroenabled.12", + "dotm": "application/vnd.ms-word.template.macroenabled.12", + "wps": "application/vnd.ms-works", + "wks": "application/vnd.ms-works", + "wcm": "application/vnd.ms-works", + "wdb": "application/vnd.ms-works", + "wpl": "application/vnd.ms-wpl", + "xps": "application/vnd.ms-xpsdocument", + "mseq": "application/vnd.mseq", + "mus": "application/vnd.musician", + "msty": "application/vnd.muvee.style", + "taglet": "application/vnd.mynfc", + "nlu": "application/vnd.neurolanguage.nlu", + "ntf": "application/vnd.nitf", + "nitf": "application/vnd.nitf", + "nnd": "application/vnd.noblenet-directory", + "nns": "application/vnd.noblenet-sealer", + "nnw": "application/vnd.noblenet-web", + "ngdat": "application/vnd.nokia.n-gage.data", + "n-gage": "application/vnd.nokia.n-gage.symbian.install", + "rpst": "application/vnd.nokia.radio-preset", + "rpss": "application/vnd.nokia.radio-presets", + "edm": "application/vnd.novadigm.edm", + "edx": "application/vnd.novadigm.edx", + "ext": "application/vnd.novadigm.ext", + "odc": "application/vnd.oasis.opendocument.chart", + "otc": "application/vnd.oasis.opendocument.chart-template", + "odb": "application/vnd.oasis.opendocument.database", + "odf": "application/vnd.oasis.opendocument.formula", + "odft": "application/vnd.oasis.opendocument.formula-template", + "odg": "application/vnd.oasis.opendocument.graphics", + "otg": "application/vnd.oasis.opendocument.graphics-template", + "odi": "application/vnd.oasis.opendocument.image", + "oti": "application/vnd.oasis.opendocument.image-template", + "odp": "application/vnd.oasis.opendocument.presentation", + "otp": "application/vnd.oasis.opendocument.presentation-template", + "ods": "application/vnd.oasis.opendocument.spreadsheet", + "ots": "application/vnd.oasis.opendocument.spreadsheet-template", + "odt": "application/vnd.oasis.opendocument.text", + "odm": "application/vnd.oasis.opendocument.text-master", + "ott": "application/vnd.oasis.opendocument.text-template", + "oth": "application/vnd.oasis.opendocument.text-web", + "xo": "application/vnd.olpc-sugar", + "dd2": "application/vnd.oma.dd2+xml", + "oxt": "application/vnd.openofficeorg.extension", + "pptx": "application/vnd.openxmlformats-officedocument.presentationml.presentation", + "sldx": "application/vnd.openxmlformats-officedocument.presentationml.slide", + "ppsx": "application/vnd.openxmlformats-officedocument.presentationml.slideshow", + "potx": "application/vnd.openxmlformats-officedocument.presentationml.template", + "xlsx": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", + "xltx": "application/vnd.openxmlformats-officedocument.spreadsheetml.template", + "docx": "application/vnd.openxmlformats-officedocument.wordprocessingml.document", + "dotx": "application/vnd.openxmlformats-officedocument.wordprocessingml.template", + "mgp": "application/vnd.osgeo.mapguide.package", + "dp": "application/vnd.osgi.dp", + "esa": "application/vnd.osgi.subsystem", + "pdb": "application/x-pilot", + "pqa": "application/vnd.palm", + "oprc": "application/vnd.palm", + "paw": "application/vnd.pawaafile", + "str": "application/vnd.pg.format", + "ei6": "application/vnd.pg.osasli", + "efif": "application/vnd.picsel", + "wg": "application/vnd.pmi.widget", + "plf": "application/vnd.pocketlearn", + "pbd": "application/vnd.powerbuilder6", + "box": "application/vnd.previewsystems.box", + "mgz": "application/vnd.proteus.magazine", + "qps": "application/vnd.publishare-delta-tree", + "ptid": "application/vnd.pvi.ptid1", + "qxd": "application/vnd.quark.quarkxpress", + "qxt": "application/vnd.quark.quarkxpress", + "qwd": "application/vnd.quark.quarkxpress", + "qwt": "application/vnd.quark.quarkxpress", + "qxl": "application/vnd.quark.quarkxpress", + "qxb": "application/vnd.quark.quarkxpress", + "bed": "application/vnd.realvnc.bed", + "mxl": "application/vnd.recordare.musicxml", + "musicxml": "application/vnd.recordare.musicxml+xml", + "cryptonote": "application/vnd.rig.cryptonote", + "cod": "application/vnd.rim.cod", + "rm": "application/vnd.rn-realmedia", + "rmvb": "application/vnd.rn-realmedia-vbr", + "link66": "application/vnd.route66.link66+xml", + "st": "application/vnd.sailingtracker.track", + "see": "application/vnd.seemail", + "sema": "application/vnd.sema", + "semd": "application/vnd.semd", + "semf": "application/vnd.semf", + "ifm": "application/vnd.shana.informed.formdata", + "itp": "application/vnd.shana.informed.formtemplate", + "iif": "application/vnd.shana.informed.interchange", + "ipk": "application/vnd.shana.informed.package", + "twd": "application/vnd.simtech-mindmapper", + "twds": "application/vnd.simtech-mindmapper", + "mmf": "application/vnd.smaf", + "teacher": "application/vnd.smart.teacher", + "sdkm": "application/vnd.solent.sdkm+xml", + "sdkd": "application/vnd.solent.sdkm+xml", + "dxp": "application/vnd.spotfire.dxp", + "sfs": "application/vnd.spotfire.sfs", + "sdc": "application/vnd.stardivision.calc", + "sda": "application/vnd.stardivision.draw", + "sdd": "application/vnd.stardivision.impress", + "smf": "application/vnd.stardivision.math", + "sdw": "application/vnd.stardivision.writer", + "vor": "application/vnd.stardivision.writer", + "sgl": "application/vnd.stardivision.writer-global", + "smzip": "application/vnd.stepmania.package", + "sm": "application/vnd.stepmania.stepchart", + "sxc": "application/vnd.sun.xml.calc", + "stc": "application/vnd.sun.xml.calc.template", + "sxd": "application/vnd.sun.xml.draw", + "std": "application/vnd.sun.xml.draw.template", + "sxi": "application/vnd.sun.xml.impress", + "sti": "application/vnd.sun.xml.impress.template", + "sxm": "application/vnd.sun.xml.math", + "sxw": "application/vnd.sun.xml.writer", + "sxg": "application/vnd.sun.xml.writer.global", + "stw": "application/vnd.sun.xml.writer.template", + "sus": "application/vnd.sus-calendar", + "susp": "application/vnd.sus-calendar", + "svd": "application/vnd.svd", + "sis": "application/vnd.symbian.install", + "sisx": "application/vnd.symbian.install", + "xsm": "application/vnd.syncml+xml", + "bdm": "application/vnd.syncml.dm+wbxml", + "xdm": "application/vnd.syncml.dm+xml", + "tao": "application/vnd.tao.intent-module-archive", + "pcap": "application/vnd.tcpdump.pcap", + "cap": "application/vnd.tcpdump.pcap", + "dmp": "application/vnd.tcpdump.pcap", + "tmo": "application/vnd.tmobile-livetv", + "tpt": "application/vnd.trid.tpt", + "mxs": "application/vnd.triscape.mxs", + "tra": "application/vnd.trueapp", + "ufd": "application/vnd.ufdl", + "ufdl": "application/vnd.ufdl", + "utz": "application/vnd.uiq.theme", + "umj": "application/vnd.umajin", + "unityweb": "application/vnd.unity", + "uoml": "application/vnd.uoml+xml", + "vcx": "application/vnd.vcx", + "vsd": "application/vnd.visio", + "vst": "application/vnd.visio", + "vss": "application/vnd.visio", + "vsw": "application/vnd.visio", + "vis": "application/vnd.visionary", + "vsf": "application/vnd.vsf", + "wbxml": "application/vnd.wap.wbxml", + "wmlc": "application/vnd.wap.wmlc", + "wmlsc": "application/vnd.wap.wmlscriptc", + "wtb": "application/vnd.webturbo", + "nbp": "application/vnd.wolfram.player", + "wpd": "application/vnd.wordperfect", + "wqd": "application/vnd.wqd", + "stf": "application/vnd.wt.stf", + "xar": "application/vnd.xara", + "xfdl": "application/vnd.xfdl", + "hvd": "application/vnd.yamaha.hv-dic", + "hvs": "application/vnd.yamaha.hv-script", + "hvp": "application/vnd.yamaha.hv-voice", + "osf": "application/vnd.yamaha.openscoreformat", + "osfpvg": "application/vnd.yamaha.openscoreformat.osfpvg+xml", + "saf": "application/vnd.yamaha.smaf-audio", + "spf": "application/vnd.yamaha.smaf-phrase", + "cmp": "application/vnd.yellowriver-custom-menu", + "zir": "application/vnd.zul", + "zirz": "application/vnd.zul", + "zaz": "application/vnd.zzazz.deck+xml", + "vxml": "application/voicexml+xml", + "wgt": "application/widget", + "hlp": "application/winhlp", + "wsdl": "application/wsdl+xml", + "wspolicy": "application/wspolicy+xml", + "7z": "application/x-7z-compressed", + "abw": "application/x-abiword", + "ace": "application/x-ace-compressed", + "aab": "application/x-authorware-bin", + "x32": "application/x-authorware-bin", + "u32": "application/x-authorware-bin", + "vox": "application/x-authorware-bin", + "aam": "application/x-authorware-map", + "aas": "application/x-authorware-seg", + "bcpio": "application/x-bcpio", + "torrent": "application/x-bittorrent", + "blb": "application/x-blorb", + "blorb": "application/x-blorb", + "bz": "application/x-bzip", + "bz2": "application/x-bzip2", + "boz": "application/x-bzip2", + "cbr": "application/x-cbr", + "cba": "application/x-cbr", + "cbt": "application/x-cbr", + "cbz": "application/x-cbr", + "cb7": "application/x-cbr", + "vcd": "application/x-cdlink", + "cfs": "application/x-cfs-compressed", + "chat": "application/x-chat", + "pgn": "application/x-chess-pgn", + "crx": "application/x-chrome-extension", + "cco": "application/x-cocoa", + "nsc": "application/x-conference", + "cpio": "application/x-cpio", + "csh": "application/x-csh", + "udeb": "application/x-debian-package", + "dgc": "application/x-dgc-compressed", + "dir": "application/x-director", + "dcr": "application/x-director", + "dxr": "application/x-director", + "cst": "application/x-director", + "cct": "application/x-director", + "cxt": "application/x-director", + "w3d": "application/x-director", + "fgd": "application/x-director", + "swa": "application/x-director", + "wad": "application/x-doom", + "ncx": "application/x-dtbncx+xml", + "dtb": "application/x-dtbook+xml", + "res": "application/x-dtbresource+xml", + "dvi": "application/x-dvi", + "evy": "application/x-envoy", + "eva": "application/x-eva", + "bdf": "application/x-font-bdf", + "gsf": "application/x-font-ghostscript", + "psf": "application/x-font-linux-psf", + "otf": "font/opentype", + "pcf": "application/x-font-pcf", + "snf": "application/x-font-snf", + "ttf": "application/x-font-ttf", + "ttc": "application/x-font-ttf", + "pfa": "application/x-font-type1", + "pfb": "application/x-font-type1", + "pfm": "application/x-font-type1", + "afm": "application/x-font-type1", + "arc": "application/x-freearc", + "spl": "application/x-futuresplash", + "gca": "application/x-gca-compressed", + "ulx": "application/x-glulx", + "gnumeric": "application/x-gnumeric", + "gramps": "application/x-gramps-xml", + "gtar": "application/x-gtar", + "hdf": "application/x-hdf", + "php": "application/x-httpd-php", + "install": "application/x-install-instructions", + "jardiff": "application/x-java-archive-diff", + "jnlp": "application/x-java-jnlp-file", + "latex": "application/x-latex", + "luac": "application/x-lua-bytecode", + "lzh": "application/x-lzh-compressed", + "lha": "application/x-lzh-compressed", + "run": "application/x-makeself", + "mie": "application/x-mie", + "prc": "application/x-pilot", + "mobi": "application/x-mobipocket-ebook", + "application": "application/x-ms-application", + "lnk": "application/x-ms-shortcut", + "wmd": "application/x-ms-wmd", + "wmz": "application/x-msmetafile", + "xbap": "application/x-ms-xbap", + "mdb": "application/x-msaccess", + "obd": "application/x-msbinder", + "crd": "application/x-mscardfile", + "clp": "application/x-msclip", + "com": "application/x-msdownload", + "bat": "application/x-msdownload", + "mvb": "application/x-msmediaview", + "m13": "application/x-msmediaview", + "m14": "application/x-msmediaview", + "wmf": "application/x-msmetafile", + "emf": "application/x-msmetafile", + "emz": "application/x-msmetafile", + "mny": "application/x-msmoney", + "pub": "application/x-mspublisher", + "scd": "application/x-msschedule", + "trm": "application/x-msterminal", + "wri": "application/x-mswrite", + "nc": "application/x-netcdf", + "cdf": "application/x-netcdf", + "pac": "application/x-ns-proxy-autoconfig", + "nzb": "application/x-nzb", + "pl": "application/x-perl", + "pm": "application/x-perl", + "p12": "application/x-pkcs12", + "pfx": "application/x-pkcs12", + "p7b": "application/x-pkcs7-certificates", + "spc": "application/x-pkcs7-certificates", + "p7r": "application/x-pkcs7-certreqresp", + "rar": "application/x-rar-compressed", + "rpm": "application/x-redhat-package-manager", + "ris": "application/x-research-info-systems", + "sea": "application/x-sea", + "sh": "application/x-sh", + "shar": "application/x-shar", + "swf": "application/x-shockwave-flash", + "xap": "application/x-silverlight-app", + "sql": "application/x-sql", + "sit": "application/x-stuffit", + "sitx": "application/x-stuffitx", + "srt": "application/x-subrip", + "sv4cpio": "application/x-sv4cpio", + "sv4crc": "application/x-sv4crc", + "t3": "application/x-t3vm-image", + "gam": "application/x-tads", + "tar": "application/x-tar", + "tcl": "application/x-tcl", + "tk": "application/x-tcl", + "tex": "application/x-tex", + "tfm": "application/x-tex-tfm", + "texinfo": "application/x-texinfo", + "texi": "application/x-texinfo", + "obj": "application/x-tgif", + "ustar": "application/x-ustar", + "src": "application/x-wais-source", + "webapp": "application/x-web-app-manifest+json", + "der": "application/x-x509-ca-cert", + "crt": "application/x-x509-ca-cert", + "pem": "application/x-x509-ca-cert", + "fig": "application/x-xfig", + "xlf": "application/x-xliff+xml", + "xpi": "application/x-xpinstall", + "xz": "application/x-xz", + "z1": "application/x-zmachine", + "z2": "application/x-zmachine", + "z3": "application/x-zmachine", + "z4": "application/x-zmachine", + "z5": "application/x-zmachine", + "z6": "application/x-zmachine", + "z7": "application/x-zmachine", + "z8": "application/x-zmachine", + "xaml": "application/xaml+xml", + "xdf": "application/xcap-diff+xml", + "xenc": "application/xenc+xml", + "xhtml": "application/xhtml+xml", + "xht": "application/xhtml+xml", + "xml": "text/xml", + "xsl": "application/xml", + "xsd": "application/xml", + "rng": "application/xml", + "dtd": "application/xml-dtd", + "xop": "application/xop+xml", + "xpl": "application/xproc+xml", + "xslt": "application/xslt+xml", + "xspf": "application/xspf+xml", + "mxml": "application/xv+xml", + "xhvml": "application/xv+xml", + "xvml": "application/xv+xml", + "xvm": "application/xv+xml", + "yang": "application/yang", + "yin": "application/yin+xml", + "zip": "application/zip", + "3gpp": "video/3gpp", + "adp": "audio/adpcm", + "au": "audio/basic", + "snd": "audio/basic", + "mid": "audio/midi", + "midi": "audio/midi", + "kar": "audio/midi", + "rmi": "audio/midi", + "mp3": "audio/mpeg", + "m4a": "audio/x-m4a", + "mp4a": "audio/mp4", + "mpga": "audio/mpeg", + "mp2": "audio/mpeg", + "mp2a": "audio/mpeg", + "m2a": "audio/mpeg", + "m3a": "audio/mpeg", + "oga": "audio/ogg", + "ogg": "audio/ogg", + "spx": "audio/ogg", + "s3m": "audio/s3m", + "sil": "audio/silk", + "uva": "audio/vnd.dece.audio", + "uvva": "audio/vnd.dece.audio", + "eol": "audio/vnd.digital-winds", + "dra": "audio/vnd.dra", + "dts": "audio/vnd.dts", + "dtshd": "audio/vnd.dts.hd", + "lvp": "audio/vnd.lucent.voice", + "pya": "audio/vnd.ms-playready.media.pya", + "ecelp4800": "audio/vnd.nuera.ecelp4800", + "ecelp7470": "audio/vnd.nuera.ecelp7470", + "ecelp9600": "audio/vnd.nuera.ecelp9600", + "rip": "audio/vnd.rip", + "wav": "audio/x-wav", + "weba": "audio/webm", + "aac": "audio/x-aac", + "aif": "audio/x-aiff", + "aiff": "audio/x-aiff", + "aifc": "audio/x-aiff", + "caf": "audio/x-caf", + "flac": "audio/x-flac", + "mka": "audio/x-matroska", + "m3u": "audio/x-mpegurl", + "wax": "audio/x-ms-wax", + "wma": "audio/x-ms-wma", + "ram": "audio/x-pn-realaudio", + "ra": "audio/x-realaudio", + "rmp": "audio/x-pn-realaudio-plugin", + "xm": "audio/xm", + "cdx": "chemical/x-cdx", + "cif": "chemical/x-cif", + "cmdf": "chemical/x-cmdf", + "cml": "chemical/x-cml", + "csml": "chemical/x-csml", + "xyz": "chemical/x-xyz", + "bmp": "image/x-ms-bmp", + "cgm": "image/cgm", + "g3": "image/g3fax", + "gif": "image/gif", + "ief": "image/ief", + "jpeg": "image/jpeg", + "jpg": "image/jpeg", + "jpe": "image/jpeg", + "ktx": "image/ktx", + "png": "image/png", + "btif": "image/prs.btif", + "sgi": "image/sgi", + "svg": "image/svg+xml", + "svgz": "image/svg+xml", + "tiff": "image/tiff", + "tif": "image/tiff", + "psd": "image/vnd.adobe.photoshop", + "uvi": "image/vnd.dece.graphic", + "uvvi": "image/vnd.dece.graphic", + "uvg": "image/vnd.dece.graphic", + "uvvg": "image/vnd.dece.graphic", + "djvu": "image/vnd.djvu", + "djv": "image/vnd.djvu", + "sub": "text/vnd.dvb.subtitle", + "dwg": "image/vnd.dwg", + "dxf": "image/vnd.dxf", + "fbs": "image/vnd.fastbidsheet", + "fpx": "image/vnd.fpx", + "fst": "image/vnd.fst", + "mmr": "image/vnd.fujixerox.edmics-mmr", + "rlc": "image/vnd.fujixerox.edmics-rlc", + "mdi": "image/vnd.ms-modi", + "wdp": "image/vnd.ms-photo", + "npx": "image/vnd.net-fpx", + "wbmp": "image/vnd.wap.wbmp", + "xif": "image/vnd.xiff", + "webp": "image/webp", + "3ds": "image/x-3ds", + "ras": "image/x-cmu-raster", + "cmx": "image/x-cmx", + "fh": "image/x-freehand", + "fhc": "image/x-freehand", + "fh4": "image/x-freehand", + "fh5": "image/x-freehand", + "fh7": "image/x-freehand", + "ico": "image/x-icon", + "jng": "image/x-jng", + "sid": "image/x-mrsid-image", + "pcx": "image/x-pcx", + "pic": "image/x-pict", + "pct": "image/x-pict", + "pnm": "image/x-portable-anymap", + "pbm": "image/x-portable-bitmap", + "pgm": "image/x-portable-graymap", + "ppm": "image/x-portable-pixmap", + "rgb": "image/x-rgb", + "tga": "image/x-tga", + "xbm": "image/x-xbitmap", + "xpm": "image/x-xpixmap", + "xwd": "image/x-xwindowdump", + "eml": "message/rfc822", + "mime": "message/rfc822", + "igs": "model/iges", + "iges": "model/iges", + "msh": "model/mesh", + "mesh": "model/mesh", + "silo": "model/mesh", + "dae": "model/vnd.collada+xml", + "dwf": "model/vnd.dwf", + "gdl": "model/vnd.gdl", + "gtw": "model/vnd.gtw", + "mts": "model/vnd.mts", + "vtu": "model/vnd.vtu", + "wrl": "model/vrml", + "vrml": "model/vrml", + "x3db": "model/x3d+binary", + "x3dbz": "model/x3d+binary", + "x3dv": "model/x3d+vrml", + "x3dvz": "model/x3d+vrml", + "x3d": "model/x3d+xml", + "x3dz": "model/x3d+xml", + "appcache": "text/cache-manifest", + "manifest": "text/cache-manifest", + "ics": "text/calendar", + "ifb": "text/calendar", + "coffee": "text/coffeescript", + "litcoffee": "text/coffeescript", + "css": "text/css", + "csv": "text/csv", + "hjson": "text/hjson", + "html": "text/html", + "htm": "text/html", + "shtml": "text/html", + "jade": "text/jade", + "jsx": "text/jsx", + "less": "text/less", + "mml": "text/mathml", + "n3": "text/n3", + "txt": "text/plain", + "text": "text/plain", + "conf": "text/plain", + "def": "text/plain", + "list": "text/plain", + "log": "text/plain", + "in": "text/plain", + "ini": "text/plain", + "dsc": "text/prs.lines.tag", + "rtx": "text/richtext", + "sgml": "text/sgml", + "sgm": "text/sgml", + "slim": "text/slim", + "slm": "text/slim", + "stylus": "text/stylus", + "styl": "text/stylus", + "tsv": "text/tab-separated-values", + "t": "text/troff", + "tr": "text/troff", + "roff": "text/troff", + "man": "text/troff", + "me": "text/troff", + "ms": "text/troff", + "ttl": "text/turtle", + "uri": "text/uri-list", + "uris": "text/uri-list", + "urls": "text/uri-list", + "vcard": "text/vcard", + "curl": "text/vnd.curl", + "dcurl": "text/vnd.curl.dcurl", + "mcurl": "text/vnd.curl.mcurl", + "scurl": "text/vnd.curl.scurl", + "fly": "text/vnd.fly", + "flx": "text/vnd.fmi.flexstor", + "gv": "text/vnd.graphviz", + "3dml": "text/vnd.in3d.3dml", + "spot": "text/vnd.in3d.spot", + "jad": "text/vnd.sun.j2me.app-descriptor", + "wml": "text/vnd.wap.wml", + "wmls": "text/vnd.wap.wmlscript", + "vtt": "text/vtt", + "s": "text/x-asm", + "asm": "text/x-asm", + "c": "text/x-c", + "cc": "text/x-c", + "cxx": "text/x-c", + "cpp": "text/x-c", + "h": "text/x-c", + "hh": "text/x-c", + "dic": "text/x-c", + "htc": "text/x-component", + "f": "text/x-fortran", + "for": "text/x-fortran", + "f77": "text/x-fortran", + "f90": "text/x-fortran", + "hbs": "text/x-handlebars-template", + "java": "text/x-java-source", + "lua": "text/x-lua", + "markdown": "text/x-markdown", + "md": "text/x-markdown", + "mkd": "text/x-markdown", + "nfo": "text/x-nfo", + "opml": "text/x-opml", + "p": "text/x-pascal", + "pas": "text/x-pascal", + "pde": "text/x-processing", + "sass": "text/x-sass", + "scss": "text/x-scss", + "etx": "text/x-setext", + "sfv": "text/x-sfv", + "ymp": "text/x-suse-ymp", + "uu": "text/x-uuencode", + "vcs": "text/x-vcalendar", + "vcf": "text/x-vcard", + "yaml": "text/yaml", + "yml": "text/yaml", + "3gp": "video/3gpp", + "3g2": "video/3gpp2", + "h261": "video/h261", + "h263": "video/h263", + "h264": "video/h264", + "jpgv": "video/jpeg", + "jpm": "video/jpm", + "jpgm": "video/jpm", + "mj2": "video/mj2", + "mjp2": "video/mj2", + "ts": "video/mp2t", + "mp4": "video/mp4", + "mp4v": "video/mp4", + "mpg4": "video/mp4", + "mpeg": "video/mpeg", + "mpg": "video/mpeg", + "mpe": "video/mpeg", + "m1v": "video/mpeg", + "m2v": "video/mpeg", + "ogv": "video/ogg", + "qt": "video/quicktime", + "mov": "video/quicktime", + "uvh": "video/vnd.dece.hd", + "uvvh": "video/vnd.dece.hd", + "uvm": "video/vnd.dece.mobile", + "uvvm": "video/vnd.dece.mobile", + "uvp": "video/vnd.dece.pd", + "uvvp": "video/vnd.dece.pd", + "uvs": "video/vnd.dece.sd", + "uvvs": "video/vnd.dece.sd", + "uvv": "video/vnd.dece.video", + "uvvv": "video/vnd.dece.video", + "dvb": "video/vnd.dvb.file", + "fvt": "video/vnd.fvt", + "mxu": "video/vnd.mpegurl", + "m4u": "video/vnd.mpegurl", + "pyv": "video/vnd.ms-playready.media.pyv", + "uvu": "video/vnd.uvvu.mp4", + "uvvu": "video/vnd.uvvu.mp4", + "viv": "video/vnd.vivo", + "webm": "video/webm", + "f4v": "video/x-f4v", + "fli": "video/x-fli", + "flv": "video/x-flv", + "m4v": "video/x-m4v", + "mkv": "video/x-matroska", + "mk3d": "video/x-matroska", + "mks": "video/x-matroska", + "mng": "video/x-mng", + "asf": "video/x-ms-asf", + "asx": "video/x-ms-asf", + "vob": "video/x-ms-vob", + "wm": "video/x-ms-wm", + "wmv": "video/x-ms-wmv", + "wmx": "video/x-ms-wmx", + "wvx": "video/x-ms-wvx", + "avi": "video/x-msvideo", + "movie": "video/x-sgi-movie", + "smv": "video/x-smv", + "ice": "x-conference/x-cooltalk" }; -/** - * Set header related properties: - * - * - `.type` the content type without params - * - * A response of "Content-Type: text/plain; charset=utf-8" - * will provide you with a `.type` of "text/plain". - * - * @param {Object} header - * @api private - */ - -ResponseBase.prototype._setHeaderProperties = function(header){ - // TODO: moar! - // TODO: make this a util - - // content-type - var ct = header['content-type'] || ''; - this.type = utils.type(ct); - - // params - var params = utils.params(ct); - for (var key in params) this[key] = params[key]; - - this.links = {}; - - // links - try { - if (header.link) { - this.links = utils.parseLinks(header.link); - } - } catch (err) { - // ignore - } -}; - -/** - * Set flags such as `.ok` based on `status`. - * - * For example a 2xx response will give you a `.ok` of __true__ - * whereas 5xx will be __false__ and `.error` will be __true__. The - * `.clientError` and `.serverError` are also available to be more - * specific, and `.statusType` is the class of error ranging from 1..5 - * sometimes useful for mapping respond colors etc. - * - * "sugar" properties are also defined for common cases. Currently providing: - * - * - .noContent - * - .badRequest - * - .unauthorized - * - .notAcceptable - * - .notFound - * - * @param {Number} status - * @api private - */ - -ResponseBase.prototype._setStatusProperties = function(status){ - var type = status / 100 | 0; - - // status / class - this.status = this.statusCode = status; - this.statusType = type; - - // basics - this.info = 1 == type; - this.ok = 2 == type; - this.redirect = 3 == type; - this.clientError = 4 == type; - this.serverError = 5 == type; - this.error = (4 == type || 5 == type) - ? this.toError() - : false; - - // sugar - this.accepted = 202 == status; - this.noContent = 204 == status; - this.badRequest = 400 == status; - this.unauthorized = 401 == status; - this.notAcceptable = 406 == status; - this.forbidden = 403 == status; - this.notFound = 404 == status; -}; - - /***/ }), /* 62 */ /***/ (function(module, exports) { -var ERROR_CODES = [ - 'ECONNRESET', - 'ETIMEDOUT', - 'EADDRINFO', - 'ESOCKETTIMEDOUT' -]; - -/** - * Determine if a request should be retried. - * (Borrowed from segmentio/superagent-retry) - * - * @param {Error} err - * @param {Response} [res] - * @returns {Boolean} - */ -module.exports = function shouldRetry(err, res) { - if (err && err.code && ~ERROR_CODES.indexOf(err.code)) return true; - if (res && res.status && res.status >= 500) return true; - // Superagent timeout - if (err && 'timeout' in err && err.code == 'ECONNABORTED') return true; - return false; -}; - -/***/ }), -/* 63 */ -/***/ (function(module, exports) { - - -/** - * Return the mime type for the given `str`. - * - * @param {String} str - * @return {String} - * @api private - */ - -exports.type = function(str){ - return str.split(/ *; */).shift(); -}; - -/** - * Return header field parameters. - * - * @param {String} str - * @return {Object} - * @api private - */ - -exports.params = function(str){ - return str.split(/ *; */).reduce(function(obj, str){ - var parts = str.split(/ *= */); - var key = parts.shift(); - var val = parts.shift(); - - if (key && val) obj[key] = val; - return obj; - }, {}); -}; - -/** - * Parse Link header fields. - * - * @param {String} str - * @return {Object} - * @api private - */ - -exports.parseLinks = function(str){ - return str.split(/ *, */).reduce(function(obj, str){ - var parts = str.split(/ *; */); - var url = parts[0].slice(1, -1); - var rel = parts[1].split(/ *= */)[1].slice(1, -1); - obj[rel] = url; - return obj; - }, {}); -}; - -/** - * Strip content related fields from `header`. - * - * @param {Object} header - * @return {Object} header - * @api private - */ - -exports.cleanHeader = function(header, shouldStripCookie){ - delete header['content-type']; - delete header['content-length']; - delete header['transfer-encoding']; - delete header['host']; - if (shouldStripCookie) { - delete header['cookie']; - } - return header; -}; - -/***/ }), -/* 64 */ -/***/ (function(module, exports) { - var g; // This works in non-strict mode @@ -15355,19 +15312,19 @@ module.exports = g; /***/ }), -/* 65 */ +/* 63 */ /***/ (function(module, exports, __webpack_require__) { const Constants = __webpack_require__(0); const Util = __webpack_require__(4); -const Guild = __webpack_require__(16); +const Guild = __webpack_require__(17); const User = __webpack_require__(11); -const DMChannel = __webpack_require__(31); +const DMChannel = __webpack_require__(30); const Emoji = __webpack_require__(12); -const TextChannel = __webpack_require__(41); -const VoiceChannel = __webpack_require__(42); -const GuildChannel = __webpack_require__(17); -const GroupDMChannel = __webpack_require__(19); +const TextChannel = __webpack_require__(40); +const VoiceChannel = __webpack_require__(41); +const GuildChannel = __webpack_require__(18); +const GroupDMChannel = __webpack_require__(21); class ClientDataManager { constructor(client) { @@ -15491,7 +15448,7 @@ module.exports = ClientDataManager; /***/ }), -/* 66 */ +/* 64 */ /***/ (function(module, exports, __webpack_require__) { const Constants = __webpack_require__(0); @@ -15566,40 +15523,40 @@ module.exports = ClientManager; /***/ }), -/* 67 */ +/* 65 */ /***/ (function(module, exports, __webpack_require__) { class ActionsManager { constructor(client) { this.client = client; + this.register(__webpack_require__(83)); + this.register(__webpack_require__(84)); this.register(__webpack_require__(85)); + this.register(__webpack_require__(89)); this.register(__webpack_require__(86)); this.register(__webpack_require__(87)); - this.register(__webpack_require__(91)); this.register(__webpack_require__(88)); - this.register(__webpack_require__(89)); - this.register(__webpack_require__(90)); + this.register(__webpack_require__(66)); + this.register(__webpack_require__(67)); this.register(__webpack_require__(68)); - this.register(__webpack_require__(69)); - this.register(__webpack_require__(70)); - this.register(__webpack_require__(73)); - this.register(__webpack_require__(84)); - this.register(__webpack_require__(77)); - this.register(__webpack_require__(78)); this.register(__webpack_require__(71)); - this.register(__webpack_require__(79)); - this.register(__webpack_require__(80)); - this.register(__webpack_require__(81)); - this.register(__webpack_require__(92)); - this.register(__webpack_require__(94)); - this.register(__webpack_require__(93)); - this.register(__webpack_require__(83)); - this.register(__webpack_require__(74)); + this.register(__webpack_require__(82)); this.register(__webpack_require__(75)); this.register(__webpack_require__(76)); - this.register(__webpack_require__(82)); + this.register(__webpack_require__(69)); + this.register(__webpack_require__(77)); + this.register(__webpack_require__(78)); + this.register(__webpack_require__(79)); + this.register(__webpack_require__(90)); + this.register(__webpack_require__(92)); + this.register(__webpack_require__(91)); + this.register(__webpack_require__(81)); this.register(__webpack_require__(72)); + this.register(__webpack_require__(73)); + this.register(__webpack_require__(74)); + this.register(__webpack_require__(80)); + this.register(__webpack_require__(70)); } register(Action) { @@ -15611,7 +15568,7 @@ module.exports = ActionsManager; /***/ }), -/* 68 */ +/* 66 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -15630,7 +15587,7 @@ module.exports = ChannelCreateAction; /***/ }), -/* 69 */ +/* 67 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -15667,7 +15624,7 @@ module.exports = ChannelDeleteAction; /***/ }), -/* 70 */ +/* 68 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -15707,7 +15664,7 @@ module.exports = ChannelUpdateAction; /***/ }), -/* 71 */ +/* 69 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -15726,7 +15683,7 @@ module.exports = GuildBanRemove; /***/ }), -/* 72 */ +/* 70 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -15753,7 +15710,7 @@ module.exports = GuildChannelsPositionUpdate; /***/ }), -/* 73 */ +/* 71 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -15814,7 +15771,7 @@ module.exports = GuildDeleteAction; /***/ }), -/* 74 */ +/* 72 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -15838,7 +15795,7 @@ module.exports = GuildEmojiCreateAction; /***/ }), -/* 75 */ +/* 73 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -15862,7 +15819,7 @@ module.exports = GuildEmojiDeleteAction; /***/ }), -/* 76 */ +/* 74 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -15886,7 +15843,7 @@ module.exports = GuildEmojiUpdateAction; /***/ }), -/* 77 */ +/* 75 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -15904,7 +15861,7 @@ module.exports = GuildMemberGetAction; /***/ }), -/* 78 */ +/* 76 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -15959,7 +15916,7 @@ module.exports = GuildMemberRemoveAction; /***/ }), -/* 79 */ +/* 77 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -15998,7 +15955,7 @@ module.exports = GuildRoleCreate; /***/ }), -/* 80 */ +/* 78 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -16050,7 +16007,7 @@ module.exports = GuildRoleDeleteAction; /***/ }), -/* 81 */ +/* 79 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -16097,7 +16054,7 @@ module.exports = GuildRoleUpdateAction; /***/ }), -/* 82 */ +/* 80 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -16124,7 +16081,7 @@ module.exports = GuildRolesPositionUpdate; /***/ }), -/* 83 */ +/* 81 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -16159,7 +16116,7 @@ module.exports = GuildSync; /***/ }), -/* 84 */ +/* 82 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -16199,7 +16156,7 @@ module.exports = GuildUpdateAction; /***/ }), -/* 85 */ +/* 83 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -16260,7 +16217,7 @@ module.exports = MessageCreateAction; /***/ }), -/* 86 */ +/* 84 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -16306,7 +16263,7 @@ module.exports = MessageDeleteAction; /***/ }), -/* 87 */ +/* 85 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -16336,7 +16293,7 @@ module.exports = MessageDeleteBulkAction; /***/ }), -/* 88 */ +/* 86 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -16385,7 +16342,7 @@ module.exports = MessageReactionAdd; /***/ }), -/* 89 */ +/* 87 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -16434,7 +16391,7 @@ module.exports = MessageReactionRemove; /***/ }), -/* 90 */ +/* 88 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -16465,7 +16422,7 @@ module.exports = MessageReactionRemoveAll; /***/ }), -/* 91 */ +/* 89 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -16538,7 +16495,7 @@ module.exports = MessageUpdateAction; /***/ }), -/* 92 */ +/* 90 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -16557,7 +16514,7 @@ module.exports = UserGetAction; /***/ }), -/* 93 */ +/* 91 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -16593,7 +16550,7 @@ module.exports = UserNoteUpdateAction; /***/ }), -/* 94 */ +/* 92 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -16632,10 +16589,10 @@ module.exports = UserUpdateAction; /***/ }), -/* 95 */ +/* 93 */ /***/ (function(module, exports, __webpack_require__) { -const request = __webpack_require__(26); +const snekfetch = __webpack_require__(26); const Constants = __webpack_require__(0); class APIRequest { @@ -16671,17 +16628,16 @@ class APIRequest { gen() { const API = `${this.client.options.http.host}/api/v${this.client.options.http.version}`; - const apiRequest = request[this.method](`${API}${this.path}`); - if (this.auth) apiRequest.set('authorization', this.getAuth()); + const request = snekfetch[this.method](`${API}${this.path}`); + if (this.auth) request.set('Authorization', this.getAuth()); + if (!this.rest.client.browser) request.set('User-Agent', this.rest.userAgentManager.userAgent); if (this.files) { - for (const file of this.files) if (file && file.file) apiRequest.attach(file.name, file.file, file.name); - this.data = this.data || {}; - apiRequest.field('payload_json', JSON.stringify(this.data)); + for (const file of this.files) if (file && file.file) request.attach(file.name, file.file, file.name); + if (typeof this.data !== 'undefined') request.attach('payload_json', JSON.stringify(this.data)); } else if (this.data) { - apiRequest.send(this.data); + request.send(this.data); } - if (!this.client.browser) apiRequest.set('User-Agent', this.rest.userAgentManager.userAgent); - return apiRequest; + return request; } } @@ -16689,11 +16645,11 @@ module.exports = APIRequest; /***/ }), -/* 96 */ +/* 94 */ /***/ (function(module, exports, __webpack_require__) { -const querystring = __webpack_require__(58); -const long = __webpack_require__(24); +const querystring = __webpack_require__(56); +const long = __webpack_require__(25); const Permissions = __webpack_require__(6); const Constants = __webpack_require__(0); const Endpoints = Constants.Endpoints; @@ -16705,14 +16661,14 @@ const User = __webpack_require__(11); const GuildMember = __webpack_require__(13); const Message = __webpack_require__(9); const Role = __webpack_require__(10); -const Invite = __webpack_require__(32); -const Webhook = __webpack_require__(21); -const UserProfile = __webpack_require__(137); -const OAuth2Application = __webpack_require__(37); +const Invite = __webpack_require__(31); +const Webhook = __webpack_require__(23); +const UserProfile = __webpack_require__(135); +const OAuth2Application = __webpack_require__(36); const Channel = __webpack_require__(8); -const GroupDMChannel = __webpack_require__(19); -const Guild = __webpack_require__(16); -const VoiceRegion = __webpack_require__(138); +const GroupDMChannel = __webpack_require__(21); +const Guild = __webpack_require__(17); +const VoiceRegion = __webpack_require__(136); class RESTMethods { constructor(restManager) { @@ -17581,10 +17537,10 @@ module.exports = RESTMethods; /***/ }), -/* 97 */ +/* 95 */ /***/ (function(module, exports, __webpack_require__) { -const RequestHandler = __webpack_require__(45); +const RequestHandler = __webpack_require__(44); class BurstRequestHandler extends RequestHandler { constructor(restManager, endpoint) { @@ -17651,10 +17607,10 @@ module.exports = BurstRequestHandler; /***/ }), -/* 98 */ +/* 96 */ /***/ (function(module, exports, __webpack_require__) { -const RequestHandler = __webpack_require__(45); +const RequestHandler = __webpack_require__(44); /** * Handles API Requests sequentially, i.e. we wait until the current request is finished before moving onto @@ -17747,7 +17703,7 @@ module.exports = SequentialRequestHandler; /***/ }), -/* 99 */ +/* 97 */ /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(process) {const Constants = __webpack_require__(0); @@ -17776,18 +17732,18 @@ UserAgentManager.DEFAULT = { module.exports = UserAgentManager; -/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(18))) +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(20))) /***/ }), -/* 100 */ +/* 98 */ /***/ (function(module, exports, __webpack_require__) { -/* WEBPACK VAR INJECTION */(function(Buffer) {const browser = __webpack_require__(15).platform() === 'browser'; -const EventEmitter = __webpack_require__(23).EventEmitter; +/* WEBPACK VAR INJECTION */(function(Buffer) {const browser = __webpack_require__(16).platform() === 'browser'; +const EventEmitter = __webpack_require__(24).EventEmitter; const Constants = __webpack_require__(0); const convertToBuffer = __webpack_require__(4).convertToBuffer; -const zlib = __webpack_require__(43); -const PacketManager = __webpack_require__(101); +const zlib = __webpack_require__(42); +const PacketManager = __webpack_require__(99); let WebSocket, erlpack; let serialize = JSON.stringify; @@ -17795,13 +17751,13 @@ if (browser) { WebSocket = window.WebSocket; // eslint-disable-line no-undef } else { try { - WebSocket = __webpack_require__(143); + WebSocket = __webpack_require__(142); } catch (err) { - WebSocket = __webpack_require__(144); + WebSocket = __webpack_require__(143); } try { - erlpack = __webpack_require__(142); + erlpack = __webpack_require__(141); serialize = erlpack.pack; } catch (err) { erlpack = null; @@ -18153,10 +18109,10 @@ class WebSocketManager extends EventEmitter { module.exports = WebSocketManager; -/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(22).Buffer)) +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(14).Buffer)) /***/ }), -/* 101 */ +/* 99 */ /***/ (function(module, exports, __webpack_require__) { const Constants = __webpack_require__(0); @@ -18176,40 +18132,40 @@ class WebSocketPacketManager { this.handlers = {}; this.queue = []; - this.register(Constants.WSEvents.READY, __webpack_require__(128)); - this.register(Constants.WSEvents.GUILD_CREATE, __webpack_require__(108)); - this.register(Constants.WSEvents.GUILD_DELETE, __webpack_require__(109)); - this.register(Constants.WSEvents.GUILD_UPDATE, __webpack_require__(119)); - this.register(Constants.WSEvents.GUILD_BAN_ADD, __webpack_require__(106)); - this.register(Constants.WSEvents.GUILD_BAN_REMOVE, __webpack_require__(107)); - this.register(Constants.WSEvents.GUILD_MEMBER_ADD, __webpack_require__(111)); - this.register(Constants.WSEvents.GUILD_MEMBER_REMOVE, __webpack_require__(112)); - this.register(Constants.WSEvents.GUILD_MEMBER_UPDATE, __webpack_require__(113)); - this.register(Constants.WSEvents.GUILD_ROLE_CREATE, __webpack_require__(115)); - this.register(Constants.WSEvents.GUILD_ROLE_DELETE, __webpack_require__(116)); - this.register(Constants.WSEvents.GUILD_ROLE_UPDATE, __webpack_require__(117)); - this.register(Constants.WSEvents.GUILD_EMOJIS_UPDATE, __webpack_require__(110)); - this.register(Constants.WSEvents.GUILD_MEMBERS_CHUNK, __webpack_require__(114)); - this.register(Constants.WSEvents.CHANNEL_CREATE, __webpack_require__(102)); - this.register(Constants.WSEvents.CHANNEL_DELETE, __webpack_require__(103)); - this.register(Constants.WSEvents.CHANNEL_UPDATE, __webpack_require__(105)); - this.register(Constants.WSEvents.CHANNEL_PINS_UPDATE, __webpack_require__(104)); - this.register(Constants.WSEvents.PRESENCE_UPDATE, __webpack_require__(127)); - this.register(Constants.WSEvents.USER_UPDATE, __webpack_require__(133)); - this.register(Constants.WSEvents.USER_NOTE_UPDATE, __webpack_require__(132)); - this.register(Constants.WSEvents.VOICE_STATE_UPDATE, __webpack_require__(135)); - this.register(Constants.WSEvents.TYPING_START, __webpack_require__(131)); - this.register(Constants.WSEvents.MESSAGE_CREATE, __webpack_require__(120)); - this.register(Constants.WSEvents.MESSAGE_DELETE, __webpack_require__(121)); - this.register(Constants.WSEvents.MESSAGE_UPDATE, __webpack_require__(126)); - this.register(Constants.WSEvents.MESSAGE_DELETE_BULK, __webpack_require__(122)); - this.register(Constants.WSEvents.VOICE_SERVER_UPDATE, __webpack_require__(134)); - this.register(Constants.WSEvents.GUILD_SYNC, __webpack_require__(118)); - this.register(Constants.WSEvents.RELATIONSHIP_ADD, __webpack_require__(129)); - this.register(Constants.WSEvents.RELATIONSHIP_REMOVE, __webpack_require__(130)); - this.register(Constants.WSEvents.MESSAGE_REACTION_ADD, __webpack_require__(123)); - this.register(Constants.WSEvents.MESSAGE_REACTION_REMOVE, __webpack_require__(124)); - this.register(Constants.WSEvents.MESSAGE_REACTION_REMOVE_ALL, __webpack_require__(125)); + this.register(Constants.WSEvents.READY, __webpack_require__(126)); + this.register(Constants.WSEvents.GUILD_CREATE, __webpack_require__(106)); + this.register(Constants.WSEvents.GUILD_DELETE, __webpack_require__(107)); + this.register(Constants.WSEvents.GUILD_UPDATE, __webpack_require__(117)); + this.register(Constants.WSEvents.GUILD_BAN_ADD, __webpack_require__(104)); + this.register(Constants.WSEvents.GUILD_BAN_REMOVE, __webpack_require__(105)); + this.register(Constants.WSEvents.GUILD_MEMBER_ADD, __webpack_require__(109)); + this.register(Constants.WSEvents.GUILD_MEMBER_REMOVE, __webpack_require__(110)); + this.register(Constants.WSEvents.GUILD_MEMBER_UPDATE, __webpack_require__(111)); + this.register(Constants.WSEvents.GUILD_ROLE_CREATE, __webpack_require__(113)); + this.register(Constants.WSEvents.GUILD_ROLE_DELETE, __webpack_require__(114)); + this.register(Constants.WSEvents.GUILD_ROLE_UPDATE, __webpack_require__(115)); + this.register(Constants.WSEvents.GUILD_EMOJIS_UPDATE, __webpack_require__(108)); + this.register(Constants.WSEvents.GUILD_MEMBERS_CHUNK, __webpack_require__(112)); + this.register(Constants.WSEvents.CHANNEL_CREATE, __webpack_require__(100)); + this.register(Constants.WSEvents.CHANNEL_DELETE, __webpack_require__(101)); + this.register(Constants.WSEvents.CHANNEL_UPDATE, __webpack_require__(103)); + this.register(Constants.WSEvents.CHANNEL_PINS_UPDATE, __webpack_require__(102)); + this.register(Constants.WSEvents.PRESENCE_UPDATE, __webpack_require__(125)); + this.register(Constants.WSEvents.USER_UPDATE, __webpack_require__(131)); + this.register(Constants.WSEvents.USER_NOTE_UPDATE, __webpack_require__(130)); + this.register(Constants.WSEvents.VOICE_STATE_UPDATE, __webpack_require__(133)); + this.register(Constants.WSEvents.TYPING_START, __webpack_require__(129)); + this.register(Constants.WSEvents.MESSAGE_CREATE, __webpack_require__(118)); + this.register(Constants.WSEvents.MESSAGE_DELETE, __webpack_require__(119)); + this.register(Constants.WSEvents.MESSAGE_UPDATE, __webpack_require__(124)); + this.register(Constants.WSEvents.MESSAGE_DELETE_BULK, __webpack_require__(120)); + this.register(Constants.WSEvents.VOICE_SERVER_UPDATE, __webpack_require__(132)); + this.register(Constants.WSEvents.GUILD_SYNC, __webpack_require__(116)); + this.register(Constants.WSEvents.RELATIONSHIP_ADD, __webpack_require__(127)); + this.register(Constants.WSEvents.RELATIONSHIP_REMOVE, __webpack_require__(128)); + this.register(Constants.WSEvents.MESSAGE_REACTION_ADD, __webpack_require__(121)); + this.register(Constants.WSEvents.MESSAGE_REACTION_REMOVE, __webpack_require__(122)); + this.register(Constants.WSEvents.MESSAGE_REACTION_REMOVE_ALL, __webpack_require__(123)); } get client() { @@ -18287,7 +18243,7 @@ module.exports = WebSocketPacketManager; /***/ }), -/* 102 */ +/* 100 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -18310,7 +18266,7 @@ module.exports = ChannelCreateHandler; /***/ }), -/* 103 */ +/* 101 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -18336,7 +18292,7 @@ module.exports = ChannelDeleteHandler; /***/ }), -/* 104 */ +/* 102 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -18373,7 +18329,7 @@ module.exports = ChannelPinsUpdate; /***/ }), -/* 105 */ +/* 103 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -18390,7 +18346,7 @@ module.exports = ChannelUpdateHandler; /***/ }), -/* 106 */ +/* 104 */ /***/ (function(module, exports, __webpack_require__) { // ##untested handler## @@ -18419,7 +18375,7 @@ module.exports = GuildBanAddHandler; /***/ }), -/* 107 */ +/* 105 */ /***/ (function(module, exports, __webpack_require__) { // ##untested handler## @@ -18445,7 +18401,7 @@ module.exports = GuildBanRemoveHandler; /***/ }), -/* 108 */ +/* 106 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -18473,7 +18429,7 @@ module.exports = GuildCreateHandler; /***/ }), -/* 109 */ +/* 107 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -18498,7 +18454,7 @@ module.exports = GuildDeleteHandler; /***/ }), -/* 110 */ +/* 108 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -18544,7 +18500,7 @@ module.exports = GuildEmojisUpdate; /***/ }), -/* 111 */ +/* 109 */ /***/ (function(module, exports, __webpack_require__) { // ##untested handler## @@ -18567,7 +18523,7 @@ module.exports = GuildMemberAddHandler; /***/ }), -/* 112 */ +/* 110 */ /***/ (function(module, exports, __webpack_require__) { // ##untested handler## @@ -18586,7 +18542,7 @@ module.exports = GuildMemberRemoveHandler; /***/ }), -/* 113 */ +/* 111 */ /***/ (function(module, exports, __webpack_require__) { // ##untested handler## @@ -18610,7 +18566,7 @@ module.exports = GuildMemberUpdateHandler; /***/ }), -/* 114 */ +/* 112 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -18649,7 +18605,7 @@ module.exports = GuildMembersChunkHandler; /***/ }), -/* 115 */ +/* 113 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -18666,7 +18622,7 @@ module.exports = GuildRoleCreateHandler; /***/ }), -/* 116 */ +/* 114 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -18683,7 +18639,7 @@ module.exports = GuildRoleDeleteHandler; /***/ }), -/* 117 */ +/* 115 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -18700,7 +18656,7 @@ module.exports = GuildRoleUpdateHandler; /***/ }), -/* 118 */ +/* 116 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -18717,7 +18673,7 @@ module.exports = GuildSyncHandler; /***/ }), -/* 119 */ +/* 117 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -18734,7 +18690,7 @@ module.exports = GuildUpdateHandler; /***/ }), -/* 120 */ +/* 118 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -18759,7 +18715,7 @@ module.exports = MessageCreateHandler; /***/ }), -/* 121 */ +/* 119 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -18784,7 +18740,7 @@ module.exports = MessageDeleteHandler; /***/ }), -/* 122 */ +/* 120 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -18807,7 +18763,7 @@ module.exports = MessageDeleteBulkHandler; /***/ }), -/* 123 */ +/* 121 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -18824,7 +18780,7 @@ module.exports = MessageReactionAddHandler; /***/ }), -/* 124 */ +/* 122 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -18841,7 +18797,7 @@ module.exports = MessageReactionRemove; /***/ }), -/* 125 */ +/* 123 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -18858,7 +18814,7 @@ module.exports = MessageReactionRemoveAll; /***/ }), -/* 126 */ +/* 124 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -18875,7 +18831,7 @@ module.exports = MessageUpdateHandler; /***/ }), -/* 127 */ +/* 125 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -18957,12 +18913,12 @@ module.exports = PresenceUpdateHandler; /***/ }), -/* 128 */ +/* 126 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); -const ClientUser = __webpack_require__(30); +const ClientUser = __webpack_require__(29); class ReadyHandler extends AbstractHandler { handle(packet) { @@ -19033,7 +18989,7 @@ module.exports = ReadyHandler; /***/ }), -/* 129 */ +/* 127 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -19058,7 +19014,7 @@ module.exports = RelationshipAddHandler; /***/ }), -/* 130 */ +/* 128 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -19083,7 +19039,7 @@ module.exports = RelationshipRemoveHandler; /***/ }), -/* 131 */ +/* 129 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -19157,7 +19113,7 @@ module.exports = TypingStartHandler; /***/ }), -/* 132 */ +/* 130 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -19175,7 +19131,7 @@ module.exports = UserNoteUpdateHandler; /***/ }), -/* 133 */ +/* 131 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -19192,7 +19148,7 @@ module.exports = UserUpdateHandler; /***/ }), -/* 134 */ +/* 132 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -19217,7 +19173,7 @@ module.exports = VoiceServerUpdate; /***/ }), -/* 135 */ +/* 133 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -19272,7 +19228,7 @@ module.exports = VoiceStateUpdateHandler; /***/ }), -/* 136 */ +/* 134 */ /***/ (function(module, exports) { /** @@ -19326,11 +19282,11 @@ module.exports = UserConnection; /***/ }), -/* 137 */ +/* 135 */ /***/ (function(module, exports, __webpack_require__) { const Collection = __webpack_require__(3); -const UserConnection = __webpack_require__(136); +const UserConnection = __webpack_require__(134); /** * Represents a user's profile on Discord. @@ -19394,7 +19350,7 @@ module.exports = UserProfile; /***/ }), -/* 138 */ +/* 136 */ /***/ (function(module, exports) { /** @@ -19449,6 +19405,18 @@ class VoiceRegion { module.exports = VoiceRegion; +/***/ }), +/* 137 */ +/***/ (function(module, exports) { + +/* (ignored) */ + +/***/ }), +/* 138 */ +/***/ (function(module, exports) { + +/* (ignored) */ + /***/ }), /* 139 */ /***/ (function(module, exports) { @@ -19481,23 +19449,17 @@ module.exports = VoiceRegion; /***/ }), /* 144 */ -/***/ (function(module, exports) { - -/* (ignored) */ - -/***/ }), -/* 145 */ /***/ (function(module, exports, __webpack_require__) { const Util = __webpack_require__(4); module.exports = { // "Root" classes (starting points) - Client: __webpack_require__(46), - Shard: __webpack_require__(49), - ShardClientUtil: __webpack_require__(50), - ShardingManager: __webpack_require__(51), - WebhookClient: __webpack_require__(47), + Client: __webpack_require__(45), + Shard: __webpack_require__(48), + ShardClientUtil: __webpack_require__(49), + ShardingManager: __webpack_require__(50), + WebhookClient: __webpack_require__(46), // Utilities Collection: __webpack_require__(3), @@ -19508,7 +19470,7 @@ module.exports = { SnowflakeUtil: __webpack_require__(5), Util: Util, util: Util, - version: __webpack_require__(29).version, + version: __webpack_require__(28).version, // Shortcuts to Util methods escapeMarkdown: Util.escapeMarkdown, @@ -19517,35 +19479,35 @@ module.exports = { // Structures Channel: __webpack_require__(8), - ClientUser: __webpack_require__(30), - DMChannel: __webpack_require__(31), + ClientUser: __webpack_require__(29), + DMChannel: __webpack_require__(30), Emoji: __webpack_require__(12), Game: __webpack_require__(7).Game, - GroupDMChannel: __webpack_require__(19), - Guild: __webpack_require__(16), - GuildChannel: __webpack_require__(17), + GroupDMChannel: __webpack_require__(21), + Guild: __webpack_require__(17), + GuildChannel: __webpack_require__(18), GuildMember: __webpack_require__(13), - Invite: __webpack_require__(32), + Invite: __webpack_require__(31), Message: __webpack_require__(9), - MessageAttachment: __webpack_require__(33), - MessageCollector: __webpack_require__(34), - MessageEmbed: __webpack_require__(35), - MessageReaction: __webpack_require__(36), - OAuth2Application: __webpack_require__(37), - PartialGuild: __webpack_require__(38), - PartialGuildChannel: __webpack_require__(39), - PermissionOverwrites: __webpack_require__(40), + MessageAttachment: __webpack_require__(32), + MessageCollector: __webpack_require__(33), + MessageEmbed: __webpack_require__(34), + MessageReaction: __webpack_require__(35), + OAuth2Application: __webpack_require__(36), + PartialGuild: __webpack_require__(37), + PartialGuildChannel: __webpack_require__(38), + PermissionOverwrites: __webpack_require__(39), Presence: __webpack_require__(7).Presence, - ReactionEmoji: __webpack_require__(20), - RichEmbed: __webpack_require__(48), + ReactionEmoji: __webpack_require__(22), + RichEmbed: __webpack_require__(47), Role: __webpack_require__(10), - TextChannel: __webpack_require__(41), + TextChannel: __webpack_require__(40), User: __webpack_require__(11), - VoiceChannel: __webpack_require__(42), - Webhook: __webpack_require__(21), + VoiceChannel: __webpack_require__(41), + Webhook: __webpack_require__(23), }; -if (__webpack_require__(15).platform() === 'browser') window.Discord = module.exports; // eslint-disable-line no-undef +if (__webpack_require__(16).platform() === 'browser') window.Discord = module.exports; // eslint-disable-line no-undef /***/ }) diff --git a/discord.master.min.js b/discord.master.min.js index 8fba954c..d534bbbd 100644 --- a/discord.master.min.js +++ b/discord.master.min.js @@ -1,18 +1,24 @@ -!function(t){function e(i){if(n[i])return n[i].exports;var s=n[i]={i:i,l:!1,exports:{}};return t[i].call(s.exports,s,s.exports,e),s.l=!0,s.exports}var n={};return e.m=t,e.c=n,e.i=function(t){return t},e.d=function(t,n,i){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:i})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=145)}([function(t,e,n){(function(t){e.Package=n(29),e.DefaultOptions={apiRequestMethod:"sequential",shardId:0,shardCount:0,messageCacheMaxSize:200,messageCacheLifetime:0,messageSweepInterval:0,fetchAllMembers:!1,disableEveryone:!1,sync:!1,restWsBridgeTimeout:5e3,disabledEvents:[],restTimeOffset:500,ws:{large_threshold:250,compress:"browser"!==n(15).platform(),properties:{$os:t?t.platform:"discord.js",$browser:"discord.js",$device:"discord.js",$referrer:"",$referring_domain:""},version:6},http:{version:6,host:"https://discordapp.com",cdn:"https://cdn.discordapp.com"}},e.Errors={NO_TOKEN:"Request to use token, but token was unavailable to the client.",NO_BOT_ACCOUNT:"Only bot accounts are able to make use of this feature.",NO_USER_ACCOUNT:"Only user accounts are able to make use of this feature.",BAD_WS_MESSAGE:"A bad message was received from the websocket; either bad compression, or not JSON.",TOOK_TOO_LONG:"Something took too long to do.",NOT_A_PERMISSION:"Invalid permission string or number.",INVALID_RATE_LIMIT_METHOD:"Unknown rate limiting method.",BAD_LOGIN:"Incorrect login details were provided.",INVALID_SHARD:"Invalid shard settings were provided.",SHARDING_REQUIRED:"This session would have handled too many guilds - Sharding is required.",INVALID_TOKEN:"An invalid token was provided."};const i=e.Endpoints={User:t=>{t.id&&(t=t.id);const e=`/users/${t}`;return{toString:()=>e,channels:`${e}/channels`,profile:`${e}/profile`,relationships:`${e}/relationships`,Relationship:t=>`${e}/relationships/${t}`,Guild:t=>`${e}/guilds/${t}`,Note:t=>`${e}/notes/${t}`,Mentions:(t,n,i,s)=>`${e}/mentions?limit=${t}&roles=${n}&everyone=${i}${s?`&guild_id=${s}`:""}`,Avatar:(e,n)=>{return"1"===t?n:i.CDN(e).Avatar(t,n)}}},guilds:"/guilds",Guild:t=>{t.id&&(t=t.id);const e=`/guilds/${t}`;return{toString:()=>e,prune:`${e}/prune`,embed:`${e}/embed`,bans:`${e}/bans`,integrations:`${e}/integrations`,members:`${e}/members`,channels:`${e}/channels`,invites:`${e}/invites`,roles:`${e}/roles`,emojis:`${e}/emojis`,search:`${e}/messages/search`,voiceRegions:`${e}/regions`,webhooks:`${e}/webhooks`,ack:`${e}/ack`,settings:`${e}/settings`,Emoji:t=>`${e}/emojis/${t}`,Icon:(e,n)=>i.CDN(e).Icon(t,n),Splash:(e,n)=>i.CDN(e).Splash(t,n),Role:t=>`${e}/roles/${t}`,Member:t=>{t.id&&(t=t.id);const n=`${e}/members/${t}`;return{toString:()=>n,Role:t=>`${n}/roles/${t}`,nickname:`${e}/members/@me/nick`}}}},channels:"/channels",Channel:t=>{t.id&&(t=t.id);const e=`/channels/${t}`;return{toString:()=>e,messages:{toString:()=>`${e}/messages`,bulkDelete:`${e}/messages/bulk-delete`},invites:`${e}/invites`,typing:`${e}/typing`,permissions:`${e}/permissions`,webhooks:`${e}/webhooks`,search:`${e}/search`,ack:`${e}/ack`,pins:`${e}/pins`,Pin:t=>`${e}/pins/${t}`,Recipient:t=>`${e}/recipients/${t}`,Message:t=>{t.id&&(t=t.id);const n=`${e}/messages/${t}`;return{toString:()=>n,reactions:`${n}/reactions`,ack:`${e}/ack`,Reaction:(t,e)=>{const i=`${n}/reactions/${t}${e?`?limit=${e}`:""}`;return{toString:()=>i,User:t=>`${i}/${t}`}}}}}},Message:t=>e.Endpoints.Channel(t.channel).Message(t),Member:t=>e.Endpoints.Guild(t.guild).Member(t),CDN(t){return{Emoji:e=>`${t}/emojis/$${e}.png`,Asset:e=>`${t}/assets/${e}`,Avatar:(e,n)=>`${t}/avatars/${e}/${n}.${n.startsWith("a_")?"gif":"png"}?size=2048`,Icon:(e,n)=>`${t}/icons/${e}/${n}.jpg`,Splash:(e,n)=>`${t}/splashes/${e}/${n}.jpg`}},OAUTH2:{Application:t=>{const e=`/oauth2/applications/${t}`;return{toString:()=>e,reset:`${e}/reset`}},App:t=>`/oauth2/authorize?client_id=${t}`},login:"/auth/login",logout:"/auth/logout",voiceRegions:"/voice/regions",gateway:{toString:()=>"/gateway",bot:"/gateway/bot"},Invite:t=>`/invite/${t}`,Webhook:(t,e)=>`/webhooks/${t}${e?`/${e}`:""}`};e.Status={READY:0,CONNECTING:1,RECONNECTING:2,IDLE:3,NEARLY:4,DISCONNECTED:5},e.VoiceStatus={CONNECTED:0,CONNECTING:1,AUTHENTICATING:2,RECONNECTING:3,DISCONNECTED:4},e.ChannelTypes={TEXT:0,DM:1,VOICE:2,GROUP_DM:3},e.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},e.VoiceOPCodes={IDENTIFY:0,SELECT_PROTOCOL:1,READY:2,HEARTBEAT:3,SESSION_DESCRIPTION:4,SPEAKING:5},e.Events={READY:"ready",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",PRESENCE_UPDATE:"presenceUpdate",VOICE_STATE_UPDATE:"voiceStateUpdate",TYPING_START:"typingStart",TYPING_STOP:"typingStop",DISCONNECT:"disconnect",RECONNECTING:"reconnecting",ERROR:"error",WARN:"warn",DEBUG:"debug"},e.WSEvents={READY:"READY",GUILD_SYNC:"GUILD_SYNC",GUILD_CREATE:"GUILD_CREATE",GUILD_DELETE:"GUILD_DELETE",GUILD_UPDATE:"GUILD_UPDATE",GUILD_MEMBER_ADD:"GUILD_MEMBER_ADD",GUILD_MEMBER_REMOVE:"GUILD_MEMBER_REMOVE",GUILD_MEMBER_UPDATE:"GUILD_MEMBER_UPDATE",GUILD_MEMBERS_CHUNK:"GUILD_MEMBERS_CHUNK",GUILD_ROLE_CREATE:"GUILD_ROLE_CREATE",GUILD_ROLE_DELETE:"GUILD_ROLE_DELETE",GUILD_ROLE_UPDATE:"GUILD_ROLE_UPDATE",GUILD_BAN_ADD:"GUILD_BAN_ADD",GUILD_BAN_REMOVE:"GUILD_BAN_REMOVE",GUILD_EMOJIS_UPDATE:"GUILD_EMOJIS_UPDATE",CHANNEL_CREATE:"CHANNEL_CREATE",CHANNEL_DELETE:"CHANNEL_DELETE",CHANNEL_UPDATE:"CHANNEL_UPDATE",CHANNEL_PINS_UPDATE:"CHANNEL_PINS_UPDATE",MESSAGE_CREATE:"MESSAGE_CREATE",MESSAGE_DELETE:"MESSAGE_DELETE",MESSAGE_UPDATE:"MESSAGE_UPDATE",MESSAGE_DELETE_BULK:"MESSAGE_DELETE_BULK",MESSAGE_REACTION_ADD:"MESSAGE_REACTION_ADD",MESSAGE_REACTION_REMOVE:"MESSAGE_REACTION_REMOVE",MESSAGE_REACTION_REMOVE_ALL:"MESSAGE_REACTION_REMOVE_ALL",USER_UPDATE:"USER_UPDATE",USER_NOTE_UPDATE:"USER_NOTE_UPDATE",PRESENCE_UPDATE:"PRESENCE_UPDATE",VOICE_STATE_UPDATE:"VOICE_STATE_UPDATE",TYPING_START:"TYPING_START",VOICE_SERVER_UPDATE:"VOICE_SERVER_UPDATE",RELATIONSHIP_ADD:"RELATIONSHIP_ADD",RELATIONSHIP_REMOVE:"RELATIONSHIP_REMOVE"},e.MessageTypes=["DEFAULT","RECIPIENT_ADD","RECIPIENT_REMOVE","CALL","CHANNEL_NAME_CHANGE","CHANNEL_ICON_CHANGE","PINS_ADD","GUILD_MEMBER_JOIN"],e.DefaultAvatars={BLURPLE:"6debd47ed13483642cf09e832ed0bc1b",GREY:"322c936a8c8be1b803cd94861bdfa868",GREEN:"dd4dbc0016779df1378e7812eabaa04d",ORANGE:"0e291f67c9274a1abdddeb3fd919cbaa",RED:"1cbd08c76f8af6dddce02c5138971129"},e.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}}).call(e,n(18))},function(t,e){class n{constructor(t){this.packetManager=t}handle(t){return t}}t.exports=n},function(t,e){class n{constructor(t){this.client=t}handle(t){return t}}t.exports=n},function(t,e){class n extends Map{constructor(t){super(t),Object.defineProperty(this,"_array",{value:null,writable:!0,configurable:!0}),Object.defineProperty(this,"_keyArray",{value:null,writable:!0,configurable:!0})}set(t,e){return this._array=null,this._keyArray=null,super.set(t,e)}delete(t){return this._array=null,this._keyArray=null,super.delete(t)}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(){return this.values().next().value}firstKey(){return this.keys().next().value}last(){const t=this.array();return t[t.length-1]}lastKey(){const t=this.keyArray();return t[t.length-1]}random(){const t=this.array();return t[Math.floor(Math.random()*t.length)]}randomKey(){const t=this.keyArray();return t[Math.floor(Math.random()*t.length)]}findAll(t,e){if("string"!=typeof t)throw new TypeError("Key must be a string.");if("undefined"==typeof e)throw new Error("Value must be specified.");const n=[];for(const i of this.values())i[t]===e&&n.push(i);return n}find(t,e){if("string"==typeof t){if("undefined"==typeof e)throw new Error("Value must be specified.");for(const n of this.values())if(n[t]===e)return n;return null}if("function"==typeof t){for(const[e,n]of this)if(t(n,e,this))return n;return null}throw new Error("First argument must be a property string or a function.")}findKey(t,e){if("string"==typeof t){if("undefined"==typeof e)throw new Error("Value must be specified.");for(const[n,i]of this)if(i[t]===e)return n;return null}if("function"==typeof t){for(const[e,n]of this)if(t(n,e,this))return e;return null}throw new Error("First argument must be a property string or a function.")}exists(t,e){return Boolean(this.find(t,e))}filter(t,e){e&&(t=t.bind(e));const i=new n;for(const[s,r]of this)t(r,s,this)&&i.set(s,r);return i}filterArray(t,e){e&&(t=t.bind(e));const n=[];for(const[i,s]of this)t(s,i,this)&&n.push(s);return n}map(t,e){e&&(t=t.bind(e));const n=new Array(this.size);let i=0;for(const[s,r]of this)n[i++]=t(r,s,this);return n}some(t,e){e&&(t=t.bind(e));for(const[n,i]of this)if(t(i,n,this))return!0;return!1}every(t,e){e&&(t=t.bind(e));for(const[n,i]of this)if(!t(i,n,this))return!1;return!0}reduce(t,e){let n;if("undefined"!=typeof e){n=e;for(const[i,s]of this)n=t(n,s,i,this)}else{let e=!0;for(const[i,s]of this)e?(n=s,e=!1):n=t(n,s,i,this)}return n}clone(){return new this.constructor(this)}concat(...t){const e=this.clone();for(const n of t)for(const[i,s]of n)e.set(i,s);return e}deleteAll(){const t=[];for(const e of this.values())e.delete&&t.push(e.delete());return t}equals(t){return!!t&&(this===t||this.size===t.size&&!this.find((e,n)=>{const i=t.get(n);return i!==e||void 0===i&&!t.has(n)}))}sort(t=(t,e)=>+(t>e)||+(t===e)-1){return new n(Array.from(this.entries()).sort((e,n)=>t(e[1],n[1],e[0],n[0])))}}t.exports=n},function(t,e,n){(function(e){const i=n(26),s=n(0);class r{constructor(){throw new Error(`The ${this.constructor.name} class may not be instantiated.`)}static splitMessage(t,{maxLength=1950,char="\n",prepend="",append=""}={}){if(t.length<=maxLength)return t;const e=t.split(char);if(1===e.length)throw new Error("Message exceeds the max length and contains no split characters.");const n=[""];let i=0;for(let s=0;smaxLength&&(n[i]+=append,n.push(prepend),i++),n[i]+=(n[i].length>0&&n[i]!==prepend?char:"")+e[s];return n}static escapeMarkdown(t,e=false,n=false){return e?t.replace(/```/g,"`​``"):n?t.replace(/\\(`|\\)/g,"$1").replace(/(`|\\)/g,"\\$1"):t.replace(/\\(\*|_|`|~|\\)/g,"$1").replace(/(\*|_|`|~|\\)/g,"\\$1")}static fetchRecommendedShards(t,e=1e3){return new Promise((n,r)=>{if(!t)throw new Error("A token must be provided.");i.get(s.Endpoints.gateway.bot).set("Authorization",`Bot ${t.replace(/^Bot\s*/i,"")}`).end((t,i)=>{t&&r(t),n(i.body.shards*(1e3/e))})})}static parseEmoji(t){if(t.includes("%")&&(t=decodeURIComponent(t)),t.includes(":")){const[e,n]=t.split(":");return{name:e,id:n}}return{name:t,id:null}}static arraysEqual(t,e){if(t===e)return!0;if(t.length!==e.length)return!1;for(const n in t){const i=t[n],s=e.indexOf(i);s&&e.splice(s,1)}return 0===e.length}static cloneObject(t){return Object.assign(Object.create(t),t)}static mergeDefault(t,e){if(!e)return t;for(const n in t)({}).hasOwnProperty.call(e,n)?e[n]===Object(e[n])&&(e[n]=this.mergeDefault(t[n],e[n])):e[n]=t[n];return e}static convertToBuffer(t){return"string"==typeof t&&(t=this.str2ab(t)),e.from(t)}static str2ab(t){const e=new ArrayBuffer(2*t.length),n=new Uint16Array(e);for(var i=0,s=t.length;i-1&&n=e?String(t):(String(n).repeat(e)+t).slice(-e)}const s=n(24),r=14200704e5;let o=0;class u{static generate(){o>=4095&&(o=0);const t=`${i((Date.now()-r).toString(2),42)}0000100000${i((o++).toString(2),12)}`;return s.fromString(t,2).toString()}static deconstruct(t){const e=i(s.fromString(t).toString(2),64),n={timestamp:parseInt(e.substring(0,42),2)+r,workerID:parseInt(e.substring(42,47),2),processID:parseInt(e.substring(47,52),2),increment:parseInt(e.substring(52,64),2),binary:e};return Object.defineProperty(n,"date",{get:function(){return new Date(this.timestamp)},enumerable:!0}),n}}t.exports=u},function(t,e,n){const i=n(0);class s{constructor(t,e){e="object"!=typeof t||t instanceof Array?t:e,this.member="object"==typeof t?t:null,this.bitfield="number"==typeof e?e:this.constructor.resolve(e)}get raw(){return this.bitfield}set raw(t){this.bitfield=t}has(t,e=true){return t instanceof Array?t.every(t=>this.has(t,e)):(t=this.constructor.resolve(t),!!(e&&(this.bitfield&this.constructor.FLAGS.ADMINISTRATOR)>0)||(this.bitfield&t)===t)}missing(t,e=true){return t.filter(t=>!this.has(t,e))}add(...t){let e=0;for(let n=0;nthis.resolve(t)).reduce((t,e)=>t|e,0);if("string"==typeof t&&(t=this.FLAGS[t]),"number"!=typeof t||t<1)throw new RangeError(i.Errors.NOT_A_PERMISSION);return t}}s.FLAGS={CREATE_INSTANT_INVITE:1,KICK_MEMBERS:2,BAN_MEMBERS:4,ADMINISTRATOR:8,MANAGE_CHANNELS:16,MANAGE_GUILD:32,ADD_REACTIONS:64,READ_MESSAGES: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,EXTERNAL_EMOJIS:1<<18,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_ROLES_OR_PERMISSIONS:1<<28,MANAGE_WEBHOOKS:1<<29,MANAGE_EMOJIS:1<<30},s.ALL=Object.keys(s.FLAGS).reduce((t,e)=>t|s.FLAGS[e],0),s.DEFAULT=104324097,t.exports=s},function(t,e){class n{constructor(t={}){this.status=t.status||"offline",this.game=t.game?new i(t.game):null}update(t){this.status=t.status||this.status,this.game=t.game?new i(t.game):null}equals(t){return this===t||(t&&this.status===t.status&&this.game?this.game.equals(t.game):!t.game)}}class i{constructor(t){this.name=t.name,this.type=t.type,this.url=t.url||null}get streaming(){return 1===this.type}equals(t){return this===t||t&&this.name===t.name&&this.type===t.type&&this.url===t.url}}e.Presence=n,e.Game=i},function(t,e,n){const i=n(5);class s{constructor(t,e){Object.defineProperty(this,"client",{value:t}),this.type=null,e&&this.setup(e)}setup(t){this.id=t.id}get createdTimestamp(){return i.deconstruct(this.id).timestamp}get createdAt(){return new Date(this.createdTimestamp)}delete(){return this.client.rest.methods.deleteChannel(this)}}t.exports=s},function(t,e,n){const i=n(33),s=n(35),r=n(36),o=n(4),u=n(3),c=n(0),h=n(6);let a;class l{constructor(t,e,n){Object.defineProperty(this,"client",{value:n}),this.channel=t,e&&this.setup(e)}setup(t){this.id=t.id,this.type=c.MessageTypes[t.type],this.content=t.content,this.author=this.client.dataManager.newUser(t.author),this.member=this.guild?this.guild.member(this.author)||null:null,this.pinned=t.pinned,this.tts=t.tts,this.nonce=t.nonce,this.system=6===t.type,this.embeds=t.embeds.map(t=>new s(this,t)),this.attachments=new u;for(const e of t.attachments)this.attachments.set(e.id,new i(this,e));this.createdTimestamp=new Date(t.timestamp).getTime(),this.editedTimestamp=t.edited_timestamp?new Date(t.edited_timestamp).getTime():null,this.mentions={users:new u,roles:new u,channels:new u,everyone:t.mention_everyone};for(const n of t.mentions){let t=this.client.users.get(n.id);t||(t=this.client.dataManager.newUser(n)),this.mentions.users.set(t.id,t)}if(Object.defineProperty(this.mentions,"members",{get:()=>{if("text"!==this.channel.type)return null;const t=new u;return this.mentions.users.forEach(e=>{const n=this.client.resolver.resolveGuildMember(this.channel.guild,e);n&&t.set(n.id,n)}),t}}),t.mention_roles)for(const n of t.mention_roles){const t=this.channel.guild.roles.get(n);t&&this.mentions.roles.set(t.id,t)}if("text"===this.channel.type){const e=t.content.match(/<#([0-9]{14,20})>/g)||[];for(const n of e){const t=this.channel.guild.channels.get(n.match(/([0-9]{14,20})/g)[0]);t&&this.mentions.channels.set(t.id,t)}}if(this._edits=[],this.reactions=new u,t.reactions&&t.reactions.length>0)for(const o of t.reactions){const t=o.emoji.id?`${o.emoji.name}:${o.emoji.id}`:o.emoji.name;this.reactions.set(t,new r(this,o.emoji,o.count,o.me))}this.webhookID=t.webhook_id||null,this.hit="boolean"==typeof t.hit?t.hit:null}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,t=>{const e=t.replace(/<|!|>|@/g,"");if("dm"===this.channel.type||"group"===this.channel.type)return this.client.users.has(e)?`@${this.client.users.get(e).username}`:t;const n=this.channel.guild.members.get(e);if(n)return n.nickname?`@${n.nickname}`:`@${n.user.username}`;{const n=this.client.users.get(e);return n?`@${n.username}`:t}}).replace(/<#[0-9]+>/g,t=>{const e=this.client.channels.get(t.replace(/<|#|>/g,""));return e?`#${e.name}`:t}).replace(/<@&[0-9]+>/g,t=>{if("dm"===this.channel.type||"group"===this.channel.type)return t;const e=this.guild.roles.get(t.replace(/<|@|>|&/g,""));return e?`@${e.name}`:t})}get edits(){const t=this._edits.slice();return t.unshift(this),t}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).hasPermission(h.FLAGS.MANAGE_MESSAGES)}get pinnable(){return!this.guild||this.channel.permissionsFor(this.client.user).hasPermission(h.FLAGS.MANAGE_MESSAGES)}isMentioned(t){return t=t&&t.id?t.id:t,this.mentions.users.has(t)||this.mentions.channels.has(t)||this.mentions.roles.has(t)}isMemberMentioned(t){return a||(a=n(13)),!!this.mentions.everyone||(!!this.mentions.users.has(t.id)||!!(t instanceof a&&t.roles.some(t=>this.mentions.roles.has(t.id))))}edit(t,e){return e||"object"!=typeof t||t instanceof Array?e||(e={}):(e=t,t=""),this.client.rest.methods.updateMessage(this,t,e)}editCode(t,e){return e=o.escapeMarkdown(this.client.resolver.resolveString(e),!0),this.edit(`\`\`\`${t||""} +!function(t){function e(n){if(i[n])return i[n].exports;var s=i[n]={i:n,l:!1,exports:{}};return t[n].call(s.exports,s,s.exports,e),s.l=!0,s.exports}var i={};return e.m=t,e.c=i,e.i=function(t){return t},e.d=function(t,i,n){e.o(t,i)||Object.defineProperty(t,i,{configurable:!1,enumerable:!0,get:n})},e.n=function(t){var i=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(i,"a",i),i},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=144)}([function(t,e,i){(function(t){e.Package=i(28),e.DefaultOptions={apiRequestMethod:"sequential",shardId:0,shardCount:0,messageCacheMaxSize:200,messageCacheLifetime:0,messageSweepInterval:0,fetchAllMembers:!1,disableEveryone:!1,sync:!1,restWsBridgeTimeout:5e3,disabledEvents:[],restTimeOffset:500,ws:{large_threshold:250,compress:"browser"!==i(16).platform(),properties:{$os:t?t.platform:"discord.js",$browser:"discord.js",$device:"discord.js",$referrer:"",$referring_domain:""},version:6},http:{version:6,host:"https://discordapp.com",cdn:"https://cdn.discordapp.com"}},e.Errors={NO_TOKEN:"Request to use token, but token was unavailable to the client.",NO_BOT_ACCOUNT:"Only bot accounts are able to make use of this feature.",NO_USER_ACCOUNT:"Only user accounts are able to make use of this feature.",BAD_WS_MESSAGE:"A bad message was received from the websocket; either bad compression, or not JSON.",TOOK_TOO_LONG:"Something took too long to do.",NOT_A_PERMISSION:"Invalid permission string or number.",INVALID_RATE_LIMIT_METHOD:"Unknown rate limiting method.",BAD_LOGIN:"Incorrect login details were provided.",INVALID_SHARD:"Invalid shard settings were provided.",SHARDING_REQUIRED:"This session would have handled too many guilds - Sharding is required.",INVALID_TOKEN:"An invalid token was provided."};const n=e.Endpoints={User:t=>{t.id&&(t=t.id);const e=`/users/${t}`;return{toString:()=>e,channels:`${e}/channels`,profile:`${e}/profile`,relationships:`${e}/relationships`,Relationship:t=>`${e}/relationships/${t}`,Guild:t=>`${e}/guilds/${t}`,Note:t=>`${e}/notes/${t}`,Mentions:(t,i,n,s)=>`${e}/mentions?limit=${t}&roles=${i}&everyone=${n}${s?`&guild_id=${s}`:""}`,Avatar:(e,i)=>{return"1"===t?i:n.CDN(e).Avatar(t,i)}}},guilds:"/guilds",Guild:t=>{t.id&&(t=t.id);const e=`/guilds/${t}`;return{toString:()=>e,prune:`${e}/prune`,embed:`${e}/embed`,bans:`${e}/bans`,integrations:`${e}/integrations`,members:`${e}/members`,channels:`${e}/channels`,invites:`${e}/invites`,roles:`${e}/roles`,emojis:`${e}/emojis`,search:`${e}/messages/search`,voiceRegions:`${e}/regions`,webhooks:`${e}/webhooks`,ack:`${e}/ack`,settings:`${e}/settings`,Emoji:t=>`${e}/emojis/${t}`,Icon:(e,i)=>n.CDN(e).Icon(t,i),Splash:(e,i)=>n.CDN(e).Splash(t,i),Role:t=>`${e}/roles/${t}`,Member:t=>{t.id&&(t=t.id);const i=`${e}/members/${t}`;return{toString:()=>i,Role:t=>`${i}/roles/${t}`,nickname:`${e}/members/@me/nick`}}}},channels:"/channels",Channel:t=>{t.id&&(t=t.id);const e=`/channels/${t}`;return{toString:()=>e,messages:{toString:()=>`${e}/messages`,bulkDelete:`${e}/messages/bulk-delete`},invites:`${e}/invites`,typing:`${e}/typing`,permissions:`${e}/permissions`,webhooks:`${e}/webhooks`,search:`${e}/search`,ack:`${e}/ack`,pins:`${e}/pins`,Pin:t=>`${e}/pins/${t}`,Recipient:t=>`${e}/recipients/${t}`,Message:t=>{t.id&&(t=t.id);const i=`${e}/messages/${t}`;return{toString:()=>i,reactions:`${i}/reactions`,ack:`${e}/ack`,Reaction:(t,e)=>{const n=`${i}/reactions/${t}${e?`?limit=${e}`:""}`;return{toString:()=>n,User:t=>`${n}/${t}`}}}}}},Message:t=>e.Endpoints.Channel(t.channel).Message(t),Member:t=>e.Endpoints.Guild(t.guild).Member(t),CDN(t){return{Emoji:e=>`${t}/emojis/$${e}.png`,Asset:e=>`${t}/assets/${e}`,Avatar:(e,i)=>`${t}/avatars/${e}/${i}.${i.startsWith("a_")?"gif":"png"}?size=2048`,Icon:(e,i)=>`${t}/icons/${e}/${i}.jpg`,Splash:(e,i)=>`${t}/splashes/${e}/${i}.jpg`}},OAUTH2:{Application:t=>{const e=`/oauth2/applications/${t}`;return{toString:()=>e,reset:`${e}/reset`}},App:t=>`/oauth2/authorize?client_id=${t}`},login:"/auth/login",logout:"/auth/logout",voiceRegions:"/voice/regions",gateway:{toString:()=>"/gateway",bot:"/gateway/bot"},Invite:t=>`/invite/${t}`,Webhook:(t,e)=>`/webhooks/${t}${e?`/${e}`:""}`};e.Status={READY:0,CONNECTING:1,RECONNECTING:2,IDLE:3,NEARLY:4,DISCONNECTED:5},e.VoiceStatus={CONNECTED:0,CONNECTING:1,AUTHENTICATING:2,RECONNECTING:3,DISCONNECTED:4},e.ChannelTypes={TEXT:0,DM:1,VOICE:2,GROUP_DM:3},e.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},e.VoiceOPCodes={IDENTIFY:0,SELECT_PROTOCOL:1,READY:2,HEARTBEAT:3,SESSION_DESCRIPTION:4,SPEAKING:5},e.Events={READY:"ready",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",PRESENCE_UPDATE:"presenceUpdate",VOICE_STATE_UPDATE:"voiceStateUpdate",TYPING_START:"typingStart",TYPING_STOP:"typingStop",DISCONNECT:"disconnect",RECONNECTING:"reconnecting",ERROR:"error",WARN:"warn",DEBUG:"debug"},e.WSEvents={READY:"READY",GUILD_SYNC:"GUILD_SYNC",GUILD_CREATE:"GUILD_CREATE",GUILD_DELETE:"GUILD_DELETE",GUILD_UPDATE:"GUILD_UPDATE",GUILD_MEMBER_ADD:"GUILD_MEMBER_ADD",GUILD_MEMBER_REMOVE:"GUILD_MEMBER_REMOVE",GUILD_MEMBER_UPDATE:"GUILD_MEMBER_UPDATE",GUILD_MEMBERS_CHUNK:"GUILD_MEMBERS_CHUNK",GUILD_ROLE_CREATE:"GUILD_ROLE_CREATE",GUILD_ROLE_DELETE:"GUILD_ROLE_DELETE",GUILD_ROLE_UPDATE:"GUILD_ROLE_UPDATE",GUILD_BAN_ADD:"GUILD_BAN_ADD",GUILD_BAN_REMOVE:"GUILD_BAN_REMOVE",GUILD_EMOJIS_UPDATE:"GUILD_EMOJIS_UPDATE",CHANNEL_CREATE:"CHANNEL_CREATE",CHANNEL_DELETE:"CHANNEL_DELETE",CHANNEL_UPDATE:"CHANNEL_UPDATE",CHANNEL_PINS_UPDATE:"CHANNEL_PINS_UPDATE",MESSAGE_CREATE:"MESSAGE_CREATE",MESSAGE_DELETE:"MESSAGE_DELETE",MESSAGE_UPDATE:"MESSAGE_UPDATE",MESSAGE_DELETE_BULK:"MESSAGE_DELETE_BULK",MESSAGE_REACTION_ADD:"MESSAGE_REACTION_ADD",MESSAGE_REACTION_REMOVE:"MESSAGE_REACTION_REMOVE",MESSAGE_REACTION_REMOVE_ALL:"MESSAGE_REACTION_REMOVE_ALL",USER_UPDATE:"USER_UPDATE",USER_NOTE_UPDATE:"USER_NOTE_UPDATE",PRESENCE_UPDATE:"PRESENCE_UPDATE",VOICE_STATE_UPDATE:"VOICE_STATE_UPDATE",TYPING_START:"TYPING_START",VOICE_SERVER_UPDATE:"VOICE_SERVER_UPDATE",RELATIONSHIP_ADD:"RELATIONSHIP_ADD",RELATIONSHIP_REMOVE:"RELATIONSHIP_REMOVE"},e.MessageTypes=["DEFAULT","RECIPIENT_ADD","RECIPIENT_REMOVE","CALL","CHANNEL_NAME_CHANGE","CHANNEL_ICON_CHANGE","PINS_ADD","GUILD_MEMBER_JOIN"],e.DefaultAvatars={BLURPLE:"6debd47ed13483642cf09e832ed0bc1b",GREY:"322c936a8c8be1b803cd94861bdfa868",GREEN:"dd4dbc0016779df1378e7812eabaa04d",ORANGE:"0e291f67c9274a1abdddeb3fd919cbaa",RED:"1cbd08c76f8af6dddce02c5138971129"},e.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}}).call(e,i(20))},function(t,e){class i{constructor(t){this.packetManager=t}handle(t){return t}}t.exports=i},function(t,e){class i{constructor(t){this.client=t}handle(t){return t}}t.exports=i},function(t,e){class i extends Map{constructor(t){super(t),Object.defineProperty(this,"_array",{value:null,writable:!0,configurable:!0}),Object.defineProperty(this,"_keyArray",{value:null,writable:!0,configurable:!0})}set(t,e){return this._array=null,this._keyArray=null,super.set(t,e)}delete(t){return this._array=null,this._keyArray=null,super.delete(t)}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(){return this.values().next().value}firstKey(){return this.keys().next().value}last(){const t=this.array();return t[t.length-1]}lastKey(){const t=this.keyArray();return t[t.length-1]}random(){const t=this.array();return t[Math.floor(Math.random()*t.length)]}randomKey(){const t=this.keyArray();return t[Math.floor(Math.random()*t.length)]}findAll(t,e){if("string"!=typeof t)throw new TypeError("Key must be a string.");if("undefined"==typeof e)throw new Error("Value must be specified.");const i=[];for(const n of this.values())n[t]===e&&i.push(n);return i}find(t,e){if("string"==typeof t){if("undefined"==typeof e)throw new Error("Value must be specified.");for(const i of this.values())if(i[t]===e)return i;return null}if("function"==typeof t){for(const[e,i]of this)if(t(i,e,this))return i;return null}throw new Error("First argument must be a property string or a function.")}findKey(t,e){if("string"==typeof t){if("undefined"==typeof e)throw new Error("Value must be specified.");for(const[i,n]of this)if(n[t]===e)return i;return null}if("function"==typeof t){for(const[e,i]of this)if(t(i,e,this))return e;return null}throw new Error("First argument must be a property string or a function.")}exists(t,e){return Boolean(this.find(t,e))}filter(t,e){e&&(t=t.bind(e));const n=new i;for(const[s,o]of this)t(o,s,this)&&n.set(s,o);return n}filterArray(t,e){e&&(t=t.bind(e));const i=[];for(const[n,s]of this)t(s,n,this)&&i.push(s);return i}map(t,e){e&&(t=t.bind(e));const i=new Array(this.size);let n=0;for(const[s,o]of this)i[n++]=t(o,s,this);return i}some(t,e){e&&(t=t.bind(e));for(const[i,n]of this)if(t(n,i,this))return!0;return!1}every(t,e){e&&(t=t.bind(e));for(const[i,n]of this)if(!t(n,i,this))return!1;return!0}reduce(t,e){let i;if("undefined"!=typeof e){i=e;for(const[n,s]of this)i=t(i,s,n,this)}else{let e=!0;for(const[n,s]of this)e?(i=s,e=!1):i=t(i,s,n,this)}return i}clone(){return new this.constructor(this)}concat(...t){const e=this.clone();for(const i of t)for(const[n,s]of i)e.set(n,s);return e}deleteAll(){const t=[];for(const e of this.values())e.delete&&t.push(e.delete());return t}equals(t){return!!t&&(this===t||this.size===t.size&&!this.find((e,i)=>{const n=t.get(i);return n!==e||void 0===n&&!t.has(i)}))}sort(t=(t,e)=>+(t>e)||+(t===e)-1){return new i(Array.from(this.entries()).sort((e,i)=>t(e[1],i[1],e[0],i[0])))}}t.exports=i},function(t,e,i){(function(e){const n=i(26),s=i(0);class o{constructor(){throw new Error(`The ${this.constructor.name} class may not be instantiated.`)}static splitMessage(t,{maxLength=1950,char="\n",prepend="",append=""}={}){if(t.length<=maxLength)return t;const e=t.split(char);if(1===e.length)throw new Error("Message exceeds the max length and contains no split characters.");const i=[""];let n=0;for(let s=0;smaxLength&&(i[n]+=append,i.push(prepend),n++),i[n]+=(i[n].length>0&&i[n]!==prepend?char:"")+e[s];return i}static escapeMarkdown(t,e=false,i=false){return e?t.replace(/```/g,"`​``"):i?t.replace(/\\(`|\\)/g,"$1").replace(/(`|\\)/g,"\\$1"):t.replace(/\\(\*|_|`|~|\\)/g,"$1").replace(/(\*|_|`|~|\\)/g,"\\$1")}static fetchRecommendedShards(t,e=1e3){return new Promise((i,o)=>{if(!t)throw new Error("A token must be provided.");n.get(s.Endpoints.gateway.bot).set("Authorization",`Bot ${t.replace(/^Bot\s*/i,"")}`).end((t,n)=>{t&&o(t),i(n.body.shards*(1e3/e))})})}static parseEmoji(t){if(t.includes("%")&&(t=decodeURIComponent(t)),t.includes(":")){const[e,i]=t.split(":");return{name:e,id:i}}return{name:t,id:null}}static arraysEqual(t,e){if(t===e)return!0;if(t.length!==e.length)return!1;for(const i in t){const n=t[i],s=e.indexOf(n);s&&e.splice(s,1)}return 0===e.length}static cloneObject(t){return Object.assign(Object.create(t),t)}static mergeDefault(t,e){if(!e)return t;for(const i in t)({}).hasOwnProperty.call(e,i)?e[i]===Object(e[i])&&(e[i]=this.mergeDefault(t[i],e[i])):e[i]=t[i];return e}static convertToBuffer(t){return"string"==typeof t&&(t=this.str2ab(t)),e.from(t)}static str2ab(t){const e=new ArrayBuffer(2*t.length),i=new Uint16Array(e);for(var n=0,s=t.length;n-1&&i=e?String(t):(String(i).repeat(e)+t).slice(-e)}const s=i(25),o=14200704e5;let r=0;class a{static generate(){r>=4095&&(r=0);const t=`${n((Date.now()-o).toString(2),42)}0000100000${n((r++).toString(2),12)}`;return s.fromString(t,2).toString()}static deconstruct(t){const e=n(s.fromString(t).toString(2),64),i={timestamp:parseInt(e.substring(0,42),2)+o,workerID:parseInt(e.substring(42,47),2),processID:parseInt(e.substring(47,52),2),increment:parseInt(e.substring(52,64),2),binary:e};return Object.defineProperty(i,"date",{get:function(){return new Date(this.timestamp)},enumerable:!0}),i}}t.exports=a},function(t,e,i){const n=i(0);class s{constructor(t,e){e="object"!=typeof t||t instanceof Array?t:e,this.member="object"==typeof t?t:null,this.bitfield="number"==typeof e?e:this.constructor.resolve(e)}get raw(){return this.bitfield}set raw(t){this.bitfield=t}has(t,e=true){return t instanceof Array?t.every(t=>this.has(t,e)):(t=this.constructor.resolve(t),!!(e&&(this.bitfield&this.constructor.FLAGS.ADMINISTRATOR)>0)||(this.bitfield&t)===t)}missing(t,e=true){return t.filter(t=>!this.has(t,e))}add(...t){let e=0;for(let i=0;ithis.resolve(t)).reduce((t,e)=>t|e,0);if("string"==typeof t&&(t=this.FLAGS[t]),"number"!=typeof t||t<1)throw new RangeError(n.Errors.NOT_A_PERMISSION);return t}}s.FLAGS={CREATE_INSTANT_INVITE:1,KICK_MEMBERS:2,BAN_MEMBERS:4,ADMINISTRATOR:8,MANAGE_CHANNELS:16,MANAGE_GUILD:32,ADD_REACTIONS:64,READ_MESSAGES: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,EXTERNAL_EMOJIS:1<<18,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_ROLES_OR_PERMISSIONS:1<<28,MANAGE_WEBHOOKS:1<<29,MANAGE_EMOJIS:1<<30},s.ALL=Object.keys(s.FLAGS).reduce((t,e)=>t|s.FLAGS[e],0),s.DEFAULT=104324097,t.exports=s},function(t,e){class i{constructor(t={}){this.status=t.status||"offline",this.game=t.game?new n(t.game):null}update(t){this.status=t.status||this.status,this.game=t.game?new n(t.game):null}equals(t){return this===t||(t&&this.status===t.status&&this.game?this.game.equals(t.game):!t.game)}}class n{constructor(t){this.name=t.name,this.type=t.type,this.url=t.url||null}get streaming(){return 1===this.type}equals(t){return this===t||t&&this.name===t.name&&this.type===t.type&&this.url===t.url}}e.Presence=i,e.Game=n},function(t,e,i){const n=i(5);class s{constructor(t,e){Object.defineProperty(this,"client",{value:t}),this.type=null,e&&this.setup(e)}setup(t){this.id=t.id}get createdTimestamp(){return n.deconstruct(this.id).timestamp}get createdAt(){return new Date(this.createdTimestamp)}delete(){return this.client.rest.methods.deleteChannel(this)}}t.exports=s},function(t,e,i){const n=i(32),s=i(34),o=i(35),r=i(4),a=i(3),c=i(0),l=i(6);let u;class h{constructor(t,e,i){Object.defineProperty(this,"client",{value:i}),this.channel=t,e&&this.setup(e)}setup(t){this.id=t.id,this.type=c.MessageTypes[t.type],this.content=t.content,this.author=this.client.dataManager.newUser(t.author),this.member=this.guild?this.guild.member(this.author)||null:null,this.pinned=t.pinned,this.tts=t.tts,this.nonce=t.nonce,this.system=6===t.type,this.embeds=t.embeds.map(t=>new s(this,t)),this.attachments=new a;for(const e of t.attachments)this.attachments.set(e.id,new n(this,e));this.createdTimestamp=new Date(t.timestamp).getTime(),this.editedTimestamp=t.edited_timestamp?new Date(t.edited_timestamp).getTime():null,this.mentions={users:new a,roles:new a,channels:new a,everyone:t.mention_everyone};for(const i of t.mentions){let t=this.client.users.get(i.id);t||(t=this.client.dataManager.newUser(i)),this.mentions.users.set(t.id,t)}if(Object.defineProperty(this.mentions,"members",{get:()=>{if("text"!==this.channel.type)return null;const t=new a;return this.mentions.users.forEach(e=>{const i=this.client.resolver.resolveGuildMember(this.channel.guild,e);i&&t.set(i.id,i)}),t}}),t.mention_roles)for(const i of t.mention_roles){const t=this.channel.guild.roles.get(i);t&&this.mentions.roles.set(t.id,t)}if("text"===this.channel.type){const e=t.content.match(/<#([0-9]{14,20})>/g)||[];for(const i of e){const t=this.channel.guild.channels.get(i.match(/([0-9]{14,20})/g)[0]);t&&this.mentions.channels.set(t.id,t)}}if(this._edits=[],this.reactions=new a,t.reactions&&t.reactions.length>0)for(const r of t.reactions){const t=r.emoji.id?`${r.emoji.name}:${r.emoji.id}`:r.emoji.name;this.reactions.set(t,new o(this,r.emoji,r.count,r.me))}this.webhookID=t.webhook_id||null,this.hit="boolean"==typeof t.hit?t.hit:null}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,t=>{const e=t.replace(/<|!|>|@/g,"");if("dm"===this.channel.type||"group"===this.channel.type)return this.client.users.has(e)?`@${this.client.users.get(e).username}`:t;const i=this.channel.guild.members.get(e);if(i)return i.nickname?`@${i.nickname}`:`@${i.user.username}`;{const i=this.client.users.get(e);return i?`@${i.username}`:t}}).replace(/<#[0-9]+>/g,t=>{const e=this.client.channels.get(t.replace(/<|#|>/g,""));return e?`#${e.name}`:t}).replace(/<@&[0-9]+>/g,t=>{if("dm"===this.channel.type||"group"===this.channel.type)return t;const e=this.guild.roles.get(t.replace(/<|@|>|&/g,""));return e?`@${e.name}`:t})}get edits(){const t=this._edits.slice();return t.unshift(this),t}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).hasPermission(l.FLAGS.MANAGE_MESSAGES)}get pinnable(){return!this.guild||this.channel.permissionsFor(this.client.user).hasPermission(l.FLAGS.MANAGE_MESSAGES)}isMentioned(t){return t=t&&t.id?t.id:t,this.mentions.users.has(t)||this.mentions.channels.has(t)||this.mentions.roles.has(t)}isMemberMentioned(t){return u||(u=i(13)),!!this.mentions.everyone||(!!this.mentions.users.has(t.id)||!!(t instanceof u&&t.roles.some(t=>this.mentions.roles.has(t.id))))}edit(t,e){return e||"object"!=typeof t||t instanceof Array?e||(e={}):(e=t,t=""),this.client.rest.methods.updateMessage(this,t,e)}editCode(t,e){return e=r.escapeMarkdown(this.client.resolver.resolveString(e),!0),this.edit(`\`\`\`${t||""} ${e} -\`\`\``)}pin(){return this.client.rest.methods.pinMessage(this)}unpin(){return this.client.rest.methods.unpinMessage(this)}react(t){if(t=this.client.resolver.resolveEmojiIdentifier(t),!t)throw new TypeError("Emoji must be a string or Emoji/ReactionEmoji");return this.client.rest.methods.addMessageReaction(this,t)}clearReactions(){return this.client.rest.methods.removeMessageReactions(this)}delete(t=0){return t<=0?this.client.rest.methods.deleteMessage(this):new Promise(e=>{this.client.setTimeout(()=>{e(this.delete())},t)})}reply(t,e){return e||"object"!=typeof t||t instanceof Array?e||(e={}):(e=t,t=""),this.channel.send(t,Object.assign(e,{reply:this.member||this.author}))}acknowledge(){return this.client.rest.methods.ackMessage(this)}fetchWebhook(){return this.webhookID?this.client.fetchWebhook(this.webhookID):Promise.reject(new Error("The message was not sent by a webhook."))}equals(t,e){if(!t)return!1;const n=!t.author&&!t.attachments;if(n)return this.id===t.id&&this.embeds.length===t.embeds.length;let i=this.id===t.id&&this.author.id===t.author.id&&this.content===t.content&&this.tts===t.tts&&this.nonce===t.nonce&&this.embeds.length===t.embeds.length&&this.attachments.length===t.attachments.length;return i&&e&&(i=this.mentions.everyone===t.mentions.everyone&&this.createdTimestamp===new Date(e.timestamp).getTime()&&this.editedTimestamp===new Date(e.edited_timestamp).getTime()),i}toString(){return this.content}_addReaction(t,e){const n=t.id?`${t.name}:${t.id}`:encodeURIComponent(t.name);let i;return this.reactions.has(n)?(i=this.reactions.get(n),i.me||(i.me=e.id===this.client.user.id)):(i=new r(this,t,0,e.id===this.client.user.id),this.reactions.set(n,i)),i.users.has(e.id)||i.users.set(e.id,e),i.count++,i}_removeReaction(t,e){const n=t.id?`${t.name}:${t.id}`:encodeURIComponent(t.name);if(this.reactions.has(n)){const t=this.reactions.get(n);if(t.users.has(e.id))return t.users.delete(e.id),t.count--,e.id===this.client.user.id&&(t.me=!1),t}return null}_clearReactions(){this.reactions.clear()}}t.exports=l},function(t,e,n){const i=n(5),s=n(6);class r{constructor(t,e){Object.defineProperty(this,"client",{value:t.client}),this.guild=t,e&&this.setup(e)}setup(t){this.id=t.id,this.name=t.name,this.color=t.color,this.hoist=t.hoist,this.position=t.position,this.permissions=t.permissions,this.managed=t.managed,this.mentionable=t.mentionable}get createdTimestamp(){return i.deconstruct(this.id).timestamp}get createdAt(){return new Date(this.createdTimestamp)}get hexColor(){let t=this.color.toString(16);for(;t.length<6;)t=`0${t}`;return`#${t}`}get members(){return this.guild.members.filter(t=>t.roles.has(this.id))}get editable(){if(this.managed)return!1;const t=this.guild.member(this.client.user);return!!t.hasPermission(s.FLAGS.MANAGE_ROLES_OR_PERMISSIONS)&&t.highestRole.comparePositionTo(this)>0}get calculatedPosition(){const t=this.guild._sortedRoles();return t.array().indexOf(t.get(this.id))}serialize(){return new s(this.permissions).serialize()}hasPermission(t,e=false,n){return new s(this.permissions).has(t,"undefined"!=typeof n?n:!e)}hasPermissions(t,e=false){return new s(this.permissions).has(t,!e)}comparePositionTo(t){return this.constructor.comparePositions(this,t)}edit(t){return this.client.rest.methods.updateGuildRole(this,t)}setName(t){return this.edit({name:t})}setColor(t){return this.edit({color:t})}setHoist(t){return this.edit({hoist:t})}setPosition(t,e){return this.guild.setRolePosition(this,t,e).then(()=>this)}setPermissions(t){return this.edit({permissions:t})}setMentionable(t){return this.edit({mentionable:t})}delete(){return this.client.rest.methods.deleteGuildRole(this)}equals(t){return t&&this.id===t.id&&this.name===t.name&&this.color===t.color&&this.hoist===t.hoist&&this.position===t.position&&this.permissions===t.permissions&&this.managed===t.managed}toString(){return this.id===this.guild.id?"@everyone":`<@&${this.id}>`}static comparePositions(t,e){return t.position===e.position?e.id-t.id:t.position-e.position}}t.exports=r},function(t,e,n){const i=n(14),s=n(0),r=n(7).Presence,o=n(5);class u{constructor(t,e){Object.defineProperty(this,"client",{value:t}),e&&this.setup(e)}setup(t){this.id=t.id,this.username=t.username,this.discriminator=t.discriminator,this.avatar=t.avatar,this.bot=Boolean(t.bot),this.lastMessageID=null,this.lastMessage=null}patch(t){for(const e of["id","username","discriminator","avatar","bot"])"undefined"!=typeof t[e]&&(this[e]=t[e]);t.token&&(this.client.token=t.token)}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 t of this.client.guilds.values())if(t.presences.has(this.id))return t.presences.get(this.id);return new r}get avatarURL(){return this.avatar?s.Endpoints.User(this).Avatar(this.client.options.http.cdn,this.avatar):null}get defaultAvatarURL(){const t=Object.keys(s.DefaultAvatars),e=t[this.discriminator%t.length];return s.Endpoints.assets(`${s.DefaultAvatars[e]}.png`)}get displayAvatarURL(){return this.avatarURL||this.defaultAvatarURL}get note(){return this.client.user.notes.get(this.id)||null}typingIn(t){return t=this.client.resolver.resolveChannel(t),t._typing.has(this.id)}typingSinceIn(t){return t=this.client.resolver.resolveChannel(t),t._typing.has(this.id)?new Date(t._typing.get(this.id).since):null}typingDurationIn(t){return t=this.client.resolver.resolveChannel(t),t._typing.has(this.id)?t._typing.get(this.id).elapsedTime:-1}get dmChannel(){return this.client.channels.filter(t=>"dm"===t.type).find(t=>t.recipient.id===this.id)}createDM(){return this.client.rest.methods.createDM(this)}deleteDM(){return this.client.rest.methods.deleteChannel(this)}addFriend(){return this.client.rest.methods.addFriend(this)}removeFriend(){return this.client.rest.methods.removeFriend(this)}block(){return this.client.rest.methods.blockUser(this)}unblock(){return this.client.rest.methods.unblockUser(this)}fetchProfile(){return this.client.rest.methods.fetchUserProfile(this)}setNote(t){return this.client.rest.methods.setNote(this,t)}equals(t){let e=t&&this.id===t.id&&this.username===t.username&&this.discriminator===t.discriminator&&this.avatar===t.avatar&&this.bot===Boolean(t.bot);return e}toString(){return`<@${this.id}>`}send(){}sendMessage(){}sendEmbed(){}sendFile(){}sendCode(){}}i.applyToClass(u),t.exports=u},function(t,e,n){const i=n(0),s=n(3),r=n(5);class o{constructor(t,e){Object.defineProperty(this,"client",{value:t.client}),this.guild=t,this.setup(e)}setup(t){this.id=t.id,this.name=t.name,this.requiresColons=t.require_colons,this.managed=t.managed,this._roles=t.roles}get createdTimestamp(){return r.deconstruct(this.id).timestamp}get createdAt(){return new Date(this.createdTimestamp)}get roles(){const t=new s;for(const e of this._roles)this.guild.roles.has(e)&&t.set(e,this.guild.roles.get(e));return t}get url(){return i.Endpoints.emoji(this.id)}get identifier(){return this.id?`${this.name}:${this.id}`:encodeURIComponent(this.name)}edit(t){return this.client.rest.methods.updateEmoji(this,t)}toString(){return this.requiresColons?`<:${this.name}:${this.id}>`:this.name}equals(t){return t instanceof o?t.id===this.id&&t.name===this.name&&t.managed===this.managed&&t.requiresColons===this.requiresColons:t.id===this.id&&t.name===this.name}}t.exports=o},function(t,e,n){const i=n(14),s=n(10),r=n(6),o=n(3),u=n(7).Presence;class c{constructor(t,e){Object.defineProperty(this,"client",{value:t.client}),this.guild=t,this.user={},this._roles=[],e&&this.setup(e),this.lastMessageID=null,this.lastMessage=null}setup(t){this.serverDeaf=t.deaf,this.serverMute=t.mute,this.selfMute=t.self_mute,this.selfDeaf=t.self_deaf,this.voiceSessionID=t.session_id,this.voiceChannelID=t.channel_id,this.speaking=!1,this.nickname=t.nick||null,this.joinedTimestamp=new Date(t.joined_at).getTime(),this.user=t.user,this._roles=t.roles}get joinedAt(){return new Date(this.joinedTimestamp)}get presence(){return this.frozenPresence||this.guild.presences.get(this.id)||new u}get roles(){const t=new o,e=this.guild.roles.get(this.guild.id);e&&t.set(e.id,e);for(const n of this._roles){const e=this.guild.roles.get(n);e&&t.set(e.id,e)}return t}get highestRole(){return this.roles.reduce((t,e)=>!t||e.comparePositionTo(t)>0?e:t)}get colorRole(){const t=this.roles.filter(t=>t.color);return t.size?t.reduce((t,e)=>!t||e.comparePositionTo(t)>0?e:t):null}get displayColor(){const t=this.colorRole;return t&&t.color||0}get displayHexColor(){const t=this.colorRole;return t&&t.hexColor||"#000000"}get hoistRole(){const t=this.roles.filter(t=>t.hoist);return t.size?t.reduce((t,e)=>!t||e.comparePositionTo(t)>0?e:t):null}get mute(){return this.selfMute||this.serverMute}get deaf(){return this.selfDeaf||this.serverDeaf}get voiceChannel(){return this.guild.channels.get(this.voiceChannelID)}get id(){return this.user.id}get displayName(){return this.nickname||this.user.username}get permissions(){if(this.user.id===this.guild.ownerID)return new r(this,r.ALL);let t=0;const e=this.roles;for(const n of e.values())t|=n.permissions;return new r(this,t)}get kickable(){if(this.user.id===this.guild.ownerID)return!1;if(this.user.id===this.client.user.id)return!1;const t=this.guild.member(this.client.user);return!!t.hasPermission(r.FLAGS.KICK_MEMBERS)&&t.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 t=this.guild.member(this.client.user);return!!t.hasPermission(r.FLAGS.BAN_MEMBERS)&&t.highestRole.comparePositionTo(this.highestRole)>0}permissionsIn(t){if(t=this.client.resolver.resolveChannel(t),!t||!t.guild)throw new Error("Could not resolve channel to a guild channel.");return t.permissionsFor(this)}hasPermission(t,e=false,n,i){return"undefined"==typeof n&&(n=!e),"undefined"==typeof i&&(i=!e),!(!i||this.user.id!==this.guild.ownerID)||this.roles.some(e=>e.hasPermission(t,void 0,n))}hasPermissions(t,e=false){return!e&&this.user.id===this.guild.ownerID||t.every(t=>this.hasPermission(t,e))}missingPermissions(t,e=false){return t.filter(t=>!this.hasPermission(t,e))}edit(t){return this.client.rest.methods.updateGuildMember(this,t)}setMute(t){return this.edit({mute:t})}setDeaf(t){return this.edit({deaf:t})}setVoiceChannel(t){return this.edit({channel:t})}setRoles(t){return this.edit({roles:t})}addRole(t){return t instanceof s||(t=this.guild.roles.get(t)),this.client.rest.methods.addMemberRole(this,t)}addRoles(t){let e;if(t instanceof o){e=this._roles.slice();for(const n of t.values())e.push(n.id)}else e=this._roles.concat(t);return this.edit({roles:e})}removeRole(t){return t instanceof s||(t=this.guild.roles.get(t)),this.client.rest.methods.removeMemberRole(this,t)}removeRoles(t){const e=this._roles.slice();if(t instanceof o)for(const n of t.values()){const t=e.indexOf(n.id);t>=0&&e.splice(t,1)}else for(const n of t){const t=e.indexOf(n instanceof s?n.id:n);t>=0&&e.splice(t,1)}return this.edit({roles:e})}setNickname(t){return this.edit({nick:t})}createDM(){return this.user.createDM()}deleteDM(){return this.user.deleteDM()}kick(){return this.client.rest.methods.kickGuildMember(this.guild,this)}ban(t=0){return this.client.rest.methods.banGuildMember(this.guild,this,t)}toString(){return`<@${this.nickname?"!":""}${this.user.id}>`}send(){}sendMessage(){}sendEmbed(){}sendFile(){}sendCode(){}}i.applyToClass(c),t.exports=c},function(t,e,n){const i=n(25),s=n(9),r=n(34),o=n(3);class u{constructor(){this.messages=new o,this.lastMessageID=null,this.lastMessage=null}send(t,e){if(e||"object"!=typeof t||t instanceof Array?e||(e={}):(e=t,t=""),e.embed&&e.embed.file&&(e.file=e.embed.file),e.file&&(e.files?e.files.push(e.file):e.files=[e.file]),e.files){for(const n in e.files){let t=e.files[n];"string"==typeof t&&(t={attachment:t}),t.name||("string"==typeof t.attachment?t.name=i.basename(t.attachment):t.attachment&&t.attachment.path?t.name=i.basename(t.attachment.path):t.name="file.jpg"),e.files[n]=t}return Promise.all(e.files.map(t=>this.client.resolver.resolveBuffer(t.attachment).then(e=>{return t.file=e,t}))).then(n=>this.client.rest.methods.sendMessage(this,t,e,n))}return this.client.rest.methods.sendMessage(this,t,e)}sendMessage(t,e){return this.send(t,e)}sendEmbed(t,e,n){return n||"object"!=typeof e||e instanceof Array?n||(n={}):(n=e,e=""),this.send(e,Object.assign(n,{embed:t}))}sendFiles(t,e,n={}){return this.send(e,Object.assign(n,{files:t}))}sendFile(t,e,n,i={}){return this.sendFiles([{attachment:t,name:e}],n,i)}sendCode(t,e,n={}){return this.send(e,Object.assign(n,{code:t}))}fetchMessage(t){return this.client.user.bot?this.client.rest.methods.getChannelMessage(this,t).then(t=>{const e=t instanceof s?t:new s(this,t,this.client);return this._cacheMessage(e),e}):this.fetchMessages({limit:1,around:t}).then(e=>{const n=e.first();if(n.id!==t)throw new Error("Message not found.");return n})}fetchMessages(t={}){return this.client.rest.methods.getChannelMessages(this,t).then(t=>{const e=new o;for(const n of t){const t=new s(this,n,this.client);e.set(n.id,t),this._cacheMessage(t)}return e})}fetchPinnedMessages(){return this.client.rest.methods.getChannelPinnedMessages(this).then(t=>{const e=new o;for(const n of t){const t=new s(this,n,this.client);e.set(n.id,t),this._cacheMessage(t)}return e})}search(t){return this.client.rest.methods.search(this,t)}startTyping(t){if("undefined"!=typeof t&&t<1)throw new RangeError("Count must be at least 1.");if(this.client.user._typing.has(this.id)){const e=this.client.user._typing.get(this.id);e.count=t||e.count+1}else this.client.user._typing.set(this.id,{count:t||1,interval:this.client.setInterval(()=>{this.client.rest.methods.sendTyping(this.id)},9e3)}),this.client.rest.methods.sendTyping(this.id)}stopTyping(t=false){if(this.client.user._typing.has(this.id)){const e=this.client.user._typing.get(this.id);e.count--,(e.count<=0||t)&&(this.client.clearInterval(e.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}createCollector(t,e={}){return new r(this,t,e)}awaitMessages(t,e={}){return new Promise((n,i)=>{const s=this.createCollector(t,e);s.on("end",(t,s)=>{e.errors&&e.errors.includes(s)?i(t):n(t)})})}bulkDelete(t,e=false){if(!isNaN(t))return this.fetchMessages({limit:t}).then(t=>this.bulkDelete(t,e));if(t instanceof Array||t instanceof o){const n=t instanceof o?t.keyArray():t.map(t=>t.id);return this.client.rest.methods.bulkDeleteMessages(this,n,e)}throw new TypeError("The messages must be an Array, Collection, or number.")}acknowledge(){return this.client.rest.methods.ackTextMessage(this)}_cacheMessage(t){const e=this.client.options.messageCacheMaxSize;return 0===e?null:(this.messages.size>=e&&e>0&&this.messages.delete(this.messages.firstKey()),this.messages.set(t.id,t),t)}}e.applyToClass=((t,e=false,n=[])=>{const i=["send","sendMessage","sendEmbed","sendFile","sendFiles","sendCode"];e&&i.push("_cacheMessage","fetchMessages","fetchMessage","search","bulkDelete","startTyping","stopTyping","typing","typingCount","fetchPinnedMessages","createCollector","awaitMessages");for(const s of i)n.includes(s)||Object.defineProperty(t.prototype,s,Object.getOwnPropertyDescriptor(u.prototype,s))})},function(t,e){e.endianness=function(){return"LE"},e.hostname=function(){return"undefined"!=typeof location?location.hostname:""},e.loadavg=function(){return[]},e.uptime=function(){return 0},e.freemem=function(){return Number.MAX_VALUE},e.totalmem=function(){return Number.MAX_VALUE},e.cpus=function(){return[]},e.type=function(){return"Browser"},e.release=function(){return"undefined"!=typeof navigator?navigator.appVersion:""},e.networkInterfaces=e.getNetworkInterfaces=function(){return{}},e.arch=function(){return"javascript"},e.platform=function(){return"browser"},e.tmpdir=e.tmpDir=function(){return"/tmp"},e.EOL="\n"},function(t,e,n){const i=n(24),s=n(11),r=n(10),o=n(12),u=n(7).Presence,c=n(13),h=n(0),a=n(3),l=n(4),f=n(5);class d{constructor(t,e){Object.defineProperty(this,"client",{value:t}),this.members=new a,this.channels=new a,this.roles=new a,this.presences=new a,e&&(e.unavailable?(this.available=!1,this.id=e.id):(this.available=!0,this.setup(e)))}setup(t){this.name=t.name,this.icon=t.icon,this.splash=t.splash,this.region=t.region,this.memberCount=t.member_count||this.memberCount,this.large=Boolean("large"in t?t.large:this.large),this.features=t.features,this.applicationID=t.application_id,this.emojis=new a;for(const e of t.emojis)this.emojis.set(e.id,new o(this,e));if(this.afkTimeout=t.afk_timeout,this.afkChannelID=t.afk_channel_id,this.embedEnabled=t.embed_enabled,this.verificationLevel=t.verification_level,this.joinedTimestamp=t.joined_at?new Date(t.joined_at).getTime():this.joinedTimestamp,this.id=t.id,this.available=!t.unavailable,this.features=t.features||this.features||[],t.members){this.members.clear();for(const e of t.members)this._addMember(e,!1)}if(t.owner_id&&(this.ownerID=t.owner_id),t.channels){this.channels.clear();for(const e of t.channels)this.client.dataManager.newChannel(e,this)}if(t.roles){this.roles.clear();for(const e of t.roles){const t=new r(this,e);this.roles.set(t.id,t)}}if(t.presences)for(const n of t.presences)this._setPresence(n.user.id,n);if(this._rawVoiceStates=new a,t.voice_states)for(const i of t.voice_states){this._rawVoiceStates.set(i.user_id,i);const t=this.members.get(i.user_id);t&&(t.serverMute=i.mute,t.serverDeaf=i.deaf,t.selfMute=i.self_mute,t.selfDeaf=i.self_deaf,t.voiceSessionID=i.session_id,t.voiceChannelID=i.channel_id,this.channels.get(i.channel_id).members.set(t.user.id,t))}}get createdTimestamp(){return f.deconstruct(this.id).timestamp}get createdAt(){return new Date(this.createdTimestamp)}get joinedAt(){return new Date(this.joinedTimestamp)}get iconURL(){return this.icon?h.Endpoints.Guild(this).Icon(this.client.options.http.cdn,this.icon):null}get splashURL(){return this.splash?h.Endpoints.Guild(this).Splash(this.client.options.http.cdn,this.splash):null}get owner(){return this.members.get(this.ownerID)}get voiceConnection(){return this.client.browser?null:this.client.voice.connections.get(this.id)||null}get defaultChannel(){return this.channels.get(this.id)}get defaultRole(){return this.roles.get(this.id)}get _sortedRoles(){return this._sortPositionWithID(this.roles)}member(t){return this.client.resolver.resolveGuildMember(this,t)}fetchBans(){return this.client.rest.methods.getGuildBans(this)}fetchInvites(){return this.client.rest.methods.getGuildInvites(this)}fetchWebhooks(){return this.client.rest.methods.getGuildWebhooks(this)}fetchVoiceRegions(){return this.client.rest.methods.fetchVoiceRegions(this.id)}addMember(t,e){return this.members.has(t.id)?Promise.resolve(this.members.get(t.id)):this.client.rest.methods.putGuildMember(this,t,e)}fetchMember(t,e=true){return t=this.client.resolver.resolveUser(t),t?this.members.has(t.id)?Promise.resolve(this.members.get(t.id)):this.client.rest.methods.getGuildMember(this,t,e):Promise.reject(new Error("User is not cached. Use Client.fetchUser first."))}fetchMembers(t="",e=0){return new Promise((n,i)=>{if(this.memberCount===this.members.size)return void n(this);this.client.ws.send({op:h.OPCodes.REQUEST_GUILD_MEMBERS,d:{guild_id:this.id,query:t,limit:e}});const s=(t,e)=>{e.id===this.id&&(this.memberCount===this.members.size||t.length<1e3)&&(this.client.removeListener(h.Events.GUILD_MEMBERS_CHUNK,s),n(this))};this.client.on(h.Events.GUILD_MEMBERS_CHUNK,s),this.client.setTimeout(()=>i(new Error("Members didn't arrive in time.")),12e4)})}search(t){return this.client.rest.methods.search(this,t)}edit(t){return this.client.rest.methods.updateGuild(this,t)}setName(t){return this.edit({name:t})}setRegion(t){return this.edit({region:t})}setVerificationLevel(t){return this.edit({verificationLevel:t})}setAFKChannel(t){return this.edit({afkChannel:t})}setAFKTimeout(t){return this.edit({afkTimeout:t})}setIcon(t){return this.edit({icon:t})}setOwner(t){return this.edit({owner:t})}setSplash(t){return this.edit({splash:t})}ban(t,e=0){return this.client.rest.methods.banGuildMember(this,t,e)}unban(t){return this.client.rest.methods.unbanGuildMember(this,t)}pruneMembers(t,e=false){if("number"!=typeof t)throw new TypeError("Days must be a number.");return this.client.rest.methods.pruneGuildMembers(this,t,e)}sync(){this.client.user.bot||this.client.syncGuilds([this])}createChannel(t,e,n){return this.client.rest.methods.createChannel(this,t,e,n)}setChannelPositions(t){return this.client.rest.methods.updateChannelPositions(this.id,t)}createRole(t={}){return this.client.rest.methods.createGuildRole(this,t)}createEmoji(t,e,n){return new Promise(i=>{"string"==typeof t&&t.startsWith("data:")?i(this.client.rest.methods.createEmoji(this,t,e,n)):this.client.resolver.resolveBuffer(t).then(t=>{const s=this.client.resolver.resolveBase64(t);i(this.client.rest.methods.createEmoji(this,s,e,n))})})}deleteEmoji(t){return t instanceof o||(t=this.emojis.get(t)),this.client.rest.methods.deleteEmoji(t)}leave(){return this.client.rest.methods.leaveGuild(this)}delete(){return this.client.rest.methods.deleteGuild(this)}acknowledge(){return this.client.rest.methods.ackGuild(this)}equals(t){let e=t&&this.id===t.id&&this.available===!t.unavailable&&this.splash===t.splash&&this.region===t.region&&this.name===t.name&&this.memberCount===t.member_count&&this.large===t.large&&this.icon===t.icon&&l.arraysEqual(this.features,t.features)&&this.ownerID===t.owner_id&&this.verificationLevel===t.verification_level&&this.embedEnabled===t.embed_enabled;return e&&(this.embedChannel?this.embedChannel.id!==t.embed_channel_id&&(e=!1):t.embed_channel_id&&(e=!1)),e}toString(){return this.name}_addMember(t,e=true){const n=this.members.has(t.user.id);t.user instanceof s||(t.user=this.client.dataManager.newUser(t.user)),t.joined_at=t.joined_at||0;const i=new c(this,t);if(this.members.set(i.id,i),this._rawVoiceStates&&this._rawVoiceStates.has(i.user.id)){const t=this._rawVoiceStates.get(i.user.id);i.serverMute=t.mute,i.serverDeaf=t.deaf,i.selfMute=t.self_mute,i.selfDeaf=t.self_deaf,i.voiceSessionID=t.session_id,i.voiceChannelID=t.channel_id,this.client.channels.has(t.channel_id)?this.client.channels.get(t.channel_id).members.set(i.user.id,i):this.client.emit("warn",`Member ${i.id} added in guild ${this.id} with an uncached voice channel`)}return this.client.ws.status===h.Status.READY&&e&&!n&&this.client.emit(h.Events.GUILD_MEMBER_ADD,i),i}_updateMember(t,e){const n=l.cloneObject(t);e.roles&&(t._roles=e.roles),"undefined"!=typeof e.nick&&(t.nickname=e.nick);const i=t.nickname!==n.nickname||!l.arraysEqual(t._roles,n._roles);return this.client.ws.status===h.Status.READY&&i&&this.client.emit(h.Events.GUILD_MEMBER_UPDATE,n,t),{old:n,mem:t}}_removeMember(t){this.members.delete(t.id)}_memberSpeakUpdate(t,e){const n=this.members.get(t);n&&n.speaking!==e&&(n.speaking=e,this.client.emit(h.Events.GUILD_MEMBER_SPEAKING,n,e))}_setPresence(t,e){return this.presences.get(t)?void this.presences.get(t).update(e):void this.presences.set(t,new u(e))}setRolePosition(t,e,n=false){if("string"==typeof t&&(t=this.roles.get(t),!t))return Promise.reject(new Error("Supplied role is not a role or snowflake."));if(e=Number(e),isNaN(e))return Promise.reject(new Error("Supplied position is not a number."));let i=this._sortedRoles().array();return l.moveElementInArray(i,t,e,n),i=i.map((t,e)=>({id:t.id,position:e})),this.client.rest.methods.setRolePositions(this.id,i)}setChannelPosition(t,e,n=false){if("string"==typeof t&&(t=this.channels.get(t),!t))return Promise.reject(new Error("Supplied channel is not a channel or snowflake."));if(e=Number(e),isNaN(e))return Promise.reject(new Error("Supplied position is not a number."));let i=this._sortedChannels(t.type).array();return l.moveElementInArray(i,t,e,n),i=i.map((t,e)=>({id:t.id,position:e})),this.client.rest.methods.setChannelPositions(this.id,i)}_sortedChannels(t){return this._sortPositionWithID(this.channels.filter(e=>{return"voice"===t&&"voice"===e.type||("voice"!==t&&"voice"!==e.type||t===e.type)}))}_sortPositionWithID(t){return t.sort((t,e)=>t.position!==e.position?t.position-e.position:i.fromString(t.id).sub(i.fromString(e.id)).toNumber())}}t.exports=d},function(t,e,n){const i=n(8),s=n(10),r=n(40),o=n(6),u=n(3);class c extends i{constructor(t,e){super(t.client,e),this.guild=t}setup(t){if(super.setup(t),this.name=t.name,this.position=t.position,this.permissionOverwrites=new u,t.permission_overwrites)for(const e of t.permission_overwrites)this.permissionOverwrites.set(e.id,new r(this,e))}get calculatedPosition(){const t=this.guild._sortedChannels(this.type);return t.array().indexOf(t.get(this.id))}permissionsFor(t){if(t=this.client.resolver.resolveGuildMember(this.guild,t),!t)return null;if(t.id===this.guild.ownerID)return new o(t,o.ALL);let e=0;const n=t.roles;for(const i of n.values())e|=i.permissions;const s=this.overwritesFor(t,!0,n);s.everyone&&(e&=~s.everyone.deny,e|=s.everyone.allow);let r=0;for(const u of s.roles)e&=~u.deny,r|=u.allow;e|=r,s.member&&(e&=~s.member.deny,e|=s.member.allow);const c=Boolean(e&o.FLAGS.ADMINISTRATOR);return c&&(e=o.ALL),new o(t,e)}overwritesFor(t,e=false,n=null){if(e||(t=this.client.resolver.resolveGuildMember(this.guild,t)),!t)return[];n=n||t.roles;const i=[];let s,r;for(const o of this.permissionOverwrites.values())o.id===this.guild.id?r=o:n.has(o.id)?i.push(o):o.id===t.id&&(s=o);return{everyone:r,roles:i,member:s}}overwritePermissions(t,e){const n={allow:0,deny:0};if(t instanceof s)n.type="role";else if(this.guild.roles.has(t))t=this.guild.roles.get(t),n.type="role";else if(t=this.client.resolver.resolveUser(t),n.type="member",!t)return Promise.reject(new TypeError("Supplied parameter was neither a User nor a Role."));n.id=t.id;const i=this.permissionOverwrites.get(t.id);i&&(n.allow=i.allow,n.deny=i.deny);for(const r in e)e[r]===!0?(n.allow|=o.FLAGS[r]||0,n.deny&=~(o.FLAGS[r]||0)):e[r]===!1?(n.allow&=~(o.FLAGS[r]||0),n.deny|=o.FLAGS[r]||0):null===e[r]&&(n.allow&=~(o.FLAGS[r]||0),n.deny&=~(o.FLAGS[r]||0));return this.client.rest.methods.setChannelOverwrite(this,n)}edit(t){return this.client.rest.methods.updateChannel(this,t)}setName(t){return this.edit({name:t})}setPosition(t,e){return this.guild.setChannelPosition(this,t,e).then(()=>this)}setTopic(t){return this.client.rest.methods.updateChannel(this,{topic:t})}createInvite(t={}){return this.client.rest.methods.createChannelInvite(this,t)}clone(t=this.name,e=true,n=true){return this.guild.createChannel(t,this.type,e?this.permissionOverwrites:[]).then(t=>n?t.setTopic(this.topic):t)}equals(t){let e=t&&this.id===t.id&&this.type===t.type&&this.topic===t.topic&&this.position===t.position&&this.name===t.name;return e&&(e=this.permissionOverwrites&&t.permissionOverwrites?this.permissionOverwrites.equals(t.permissionOverwrites):!this.permissionOverwrites&&!t.permissionOverwrites),e}get deletable(){return this.id!==this.guild.id&&this.permissionsFor(this.client.user).hasPermission(o.FLAGS.MANAGE_CHANNELS)}toString(){return`<#${this.id}>`}}t.exports=c},function(t,e){function n(){throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}function s(t){if(a===setTimeout)return setTimeout(t,0);if((a===n||!a)&&setTimeout)return a=setTimeout,setTimeout(t,0);try{return a(t,0)}catch(e){try{return a.call(null,t,0)}catch(e){return a.call(this,t,0)}}}function r(t){if(l===clearTimeout)return clearTimeout(t);if((l===i||!l)&&clearTimeout)return l=clearTimeout,clearTimeout(t);try{return l(t)}catch(e){try{return l.call(null,t)}catch(e){return l.call(this,t)}}}function o(){m&&d&&(m=!1,d.length?p=d.concat(p):g=-1,p.length&&u())}function u(){if(!m){var t=s(o);m=!0;for(var e=p.length;e;){for(d=p,p=[];++g1)for(var n=1;n[t.id,t.nick]))),this.recipients||(this.recipients=new r),t.recipients)for(const e of t.recipients){const t=this.client.dataManager.newUser(e);this.recipients.set(t.id,t)}this.lastMessageID=t.last_message_id}get owner(){return this.client.users.get(this.ownerID)}equals(t){const e=t&&this.id===t.id&&this.name===t.name&&this.icon===t.icon&&this.ownerID===t.ownerID;return e?this.recipients.equals(t.recipients):e}addUser(t,e){return this.client.rest.methods.addUserToGroupDM(this,{nick:e,id:this.client.resolver.resolveUserID(t),accessToken:t})}toString(){return this.name}send(){}sendMessage(){}sendEmbed(){}sendFile(){}sendFiles(){}sendCode(){}fetchMessage(){}fetchMessages(){}fetchPinnedMessages(){}search(){}startTyping(){}stopTyping(){}get typing(){}get typingCount(){}createCollector(){}awaitMessages(){}acknowledge(){}_cacheMessage(){}}s.applyToClass(o,!0,["bulkDelete"]),t.exports=o},function(t,e){class n{constructor(t,e,n){this.reaction=t,this.name=e,this.id=n}get identifier(){return this.id?`${this.name}:${this.id}`:encodeURIComponent(this.name)}toString(){return this.id?`<:${this.name}:${this.id}>`:this.name}}t.exports=n},function(t,e,n){const i=n(25);class s{constructor(t,e,n){t?(Object.defineProperty(this,"client",{value:t}),e&&this.setup(e)):(this.id=e,this.token=n,Object.defineProperty(this,"client",{value:this}))}setup(t){this.name=t.name,this.token=t.token,this.avatar=t.avatar,this.id=t.id,this.guildID=t.guild_id,this.channelID=t.channel_id,t.user?this.owner=this.client.users?this.client.users.get(t.user.id):t.user:this.owner=null}send(t,e){return e||"object"!=typeof t||t instanceof Array?e||(e={}):(e=t,t=""),e.file?("string"==typeof e.file&&(e.file={attachment:e.file}),e.file.name||("string"==typeof e.file.attachment?e.file.name=i.basename(e.file.attachment):e.file.attachment&&e.file.attachment.path?e.file.name=i.basename(e.file.attachment.path):e.file.name="file.jpg"),this.client.resolver.resolveBuffer(e.file.attachment).then(n=>this.client.rest.methods.sendWebhookMessage(this,t,e,{file:n,name:e.file.name}))):this.client.rest.methods.sendWebhookMessage(this,t,e)}sendMessage(t,e={}){return this.send(t,e)}sendFile(t,e,n,i={}){return this.send(n,Object.assign(i,{file:{attachment:t,name:e}}))}sendCode(t,e,n={}){return this.send(e,Object.assign(n,{code:t}))}sendSlackMessage(t){return this.client.rest.methods.sendSlackWebhookMessage(this,t)}edit(t=this.name,e){return e?this.client.resolver.resolveBuffer(e).then(e=>{const n=this.client.resolver.resolveBase64(e);return this.client.rest.methods.editWebhook(this,t,n)}):this.client.rest.methods.editWebhook(this,t).then(t=>{return this.setup(t),this})}delete(){return this.client.rest.methods.deleteWebhook(this)}}t.exports=s},function(t,e,n){"use strict";(function(t){function i(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength; -}catch(t){return!1}}function s(){return o.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function r(t,e){if(s()=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().toString(16)+" bytes");return 0|t}function g(t){return+t!=t&&(t=0),o.alloc(+t)}function E(t,e){if(o.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var n=t.length;if(0===n)return 0;for(var i=!1;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return Y(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return z(t).length;default:if(i)return Y(t).length;e=(""+e).toLowerCase(),i=!0}}function _(t,e,n){var i=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if(n>>>=0,e>>>=0,n<=e)return"";for(t||(t="utf8");;)switch(t){case"hex":return k(this,e,n);case"utf8":case"utf-8":return I(this,e,n);case"ascii":return U(this,e,n);case"latin1":case"binary":return L(this,e,n);case"base64":return S(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return N(this,e,n);default:if(i)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),i=!0}}function v(t,e,n){var i=t[e];t[e]=t[n],t[n]=i}function y(t,e,n,i,s){if(0===t.length)return-1;if("string"==typeof n?(i=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=s?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(s)return-1;n=t.length-1}else if(n<0){if(!s)return-1;n=0}if("string"==typeof e&&(e=o.from(e,i)),o.isBuffer(e))return 0===e.length?-1:w(t,e,n,i,s);if("number"==typeof e)return e&=255,o.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?s?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):w(t,[e],n,i,s);throw new TypeError("val must be string, number or Buffer")}function w(t,e,n,i,s){function r(t,e){return 1===o?t[e]:t.readUInt16BE(e*o)}var o=1,u=t.length,c=e.length;if(void 0!==i&&(i=String(i).toLowerCase(),"ucs2"===i||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(t.length<2||e.length<2)return-1;o=2,u/=2,c/=2,n/=2}var h;if(s){var a=-1;for(h=n;hu&&(n=u-c),h=n;h>=0;h--){for(var l=!0,f=0;fs&&(i=s)):i=s;var r=e.length;if(r%2!==0)throw new TypeError("Invalid hex string");i>r/2&&(i=r/2);for(var o=0;o239?4:r>223?3:r>191?2:1;if(s+u<=n){var c,h,a,l;switch(u){case 1:r<128&&(o=r);break;case 2:c=t[s+1],128===(192&c)&&(l=(31&r)<<6|63&c,l>127&&(o=l));break;case 3:c=t[s+1],h=t[s+2],128===(192&c)&&128===(192&h)&&(l=(15&r)<<12|(63&c)<<6|63&h,l>2047&&(l<55296||l>57343)&&(o=l));break;case 4:c=t[s+1],h=t[s+2],a=t[s+3],128===(192&c)&&128===(192&h)&&128===(192&a)&&(l=(15&r)<<18|(63&c)<<12|(63&h)<<6|63&a,l>65535&&l<1114112&&(o=l))}}null===o?(o=65533,u=1):o>65535&&(o-=65536,i.push(o>>>10&1023|55296),o=56320|1023&o),i.push(o),s+=u}return C(i)}function C(t){var e=t.length;if(e<=tt)return String.fromCharCode.apply(String,t);for(var n="",i=0;ii)&&(n=i);for(var s="",r=e;rn)throw new RangeError("Trying to access beyond buffer length")}function P(t,e,n,i,s,r){if(!o.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>s||et.length)throw new RangeError("Index out of range")}function G(t,e,n,i){e<0&&(e=65535+e+1);for(var s=0,r=Math.min(t.length-n,2);s>>8*(i?s:1-s)}function x(t,e,n,i){e<0&&(e=4294967295+e+1);for(var s=0,r=Math.min(t.length-n,4);s>>8*(i?s:3-s)&255}function j(t,e,n,i,s,r){if(n+i>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function B(t,e,n,i,s){return s||j(t,e,n,4,3.4028234663852886e38,-3.4028234663852886e38),Q.write(t,e,n,i,23,4),n+4}function q(t,e,n,i,s){return s||j(t,e,n,8,1.7976931348623157e308,-1.7976931348623157e308),Q.write(t,e,n,i,52,8),n+8}function H(t){if(t=V(t).replace(et,""),t.length<2)return"";for(;t.length%4!==0;)t+="=";return t}function V(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function W(t){return t<16?"0"+t.toString(16):t.toString(16)}function Y(t,e){e=e||1/0;for(var n,i=t.length,s=null,r=[],o=0;o55295&&n<57344){if(!s){if(n>56319){(e-=3)>-1&&r.push(239,191,189);continue}if(o+1===i){(e-=3)>-1&&r.push(239,191,189);continue}s=n;continue}if(n<56320){(e-=3)>-1&&r.push(239,191,189),s=n;continue}n=(s-55296<<10|n-56320)+65536}else s&&(e-=3)>-1&&r.push(239,191,189);if(s=null,n<128){if((e-=1)<0)break;r.push(n)}else if(n<2048){if((e-=2)<0)break;r.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;r.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;r.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return r}function F(t){for(var e=[],n=0;n>8,s=n%256,r.push(s),r.push(i);return r}function z(t){return $.toByteArray(H(t))}function X(t,e,n,i){for(var s=0;s=e.length||s>=t.length);++s)e[s+n]=t[s];return s}function J(t){return t!==t}/*! +\`\`\``)}pin(){return this.client.rest.methods.pinMessage(this)}unpin(){return this.client.rest.methods.unpinMessage(this)}react(t){if(t=this.client.resolver.resolveEmojiIdentifier(t),!t)throw new TypeError("Emoji must be a string or Emoji/ReactionEmoji");return this.client.rest.methods.addMessageReaction(this,t)}clearReactions(){return this.client.rest.methods.removeMessageReactions(this)}delete(t=0){return t<=0?this.client.rest.methods.deleteMessage(this):new Promise(e=>{this.client.setTimeout(()=>{e(this.delete())},t)})}reply(t,e){return e||"object"!=typeof t||t instanceof Array?e||(e={}):(e=t,t=""),this.channel.send(t,Object.assign(e,{reply:this.member||this.author}))}acknowledge(){return this.client.rest.methods.ackMessage(this)}fetchWebhook(){return this.webhookID?this.client.fetchWebhook(this.webhookID):Promise.reject(new Error("The message was not sent by a webhook."))}equals(t,e){if(!t)return!1;const i=!t.author&&!t.attachments;if(i)return this.id===t.id&&this.embeds.length===t.embeds.length;let n=this.id===t.id&&this.author.id===t.author.id&&this.content===t.content&&this.tts===t.tts&&this.nonce===t.nonce&&this.embeds.length===t.embeds.length&&this.attachments.length===t.attachments.length;return n&&e&&(n=this.mentions.everyone===t.mentions.everyone&&this.createdTimestamp===new Date(e.timestamp).getTime()&&this.editedTimestamp===new Date(e.edited_timestamp).getTime()),n}toString(){return this.content}_addReaction(t,e){const i=t.id?`${t.name}:${t.id}`:encodeURIComponent(t.name);let n;return this.reactions.has(i)?(n=this.reactions.get(i),n.me||(n.me=e.id===this.client.user.id)):(n=new o(this,t,0,e.id===this.client.user.id),this.reactions.set(i,n)),n.users.has(e.id)||n.users.set(e.id,e),n.count++,n}_removeReaction(t,e){const i=t.id?`${t.name}:${t.id}`:encodeURIComponent(t.name);if(this.reactions.has(i)){const t=this.reactions.get(i);if(t.users.has(e.id))return t.users.delete(e.id),t.count--,e.id===this.client.user.id&&(t.me=!1),t}return null}_clearReactions(){this.reactions.clear()}}t.exports=h},function(t,e,i){const n=i(5),s=i(6);class o{constructor(t,e){Object.defineProperty(this,"client",{value:t.client}),this.guild=t,e&&this.setup(e)}setup(t){this.id=t.id,this.name=t.name,this.color=t.color,this.hoist=t.hoist,this.position=t.position,this.permissions=t.permissions,this.managed=t.managed,this.mentionable=t.mentionable}get createdTimestamp(){return n.deconstruct(this.id).timestamp}get createdAt(){return new Date(this.createdTimestamp)}get hexColor(){let t=this.color.toString(16);for(;t.length<6;)t=`0${t}`;return`#${t}`}get members(){return this.guild.members.filter(t=>t.roles.has(this.id))}get editable(){if(this.managed)return!1;const t=this.guild.member(this.client.user);return!!t.hasPermission(s.FLAGS.MANAGE_ROLES_OR_PERMISSIONS)&&t.highestRole.comparePositionTo(this)>0}get calculatedPosition(){const t=this.guild._sortedRoles();return t.array().indexOf(t.get(this.id))}serialize(){return new s(this.permissions).serialize()}hasPermission(t,e=false,i){return new s(this.permissions).has(t,"undefined"!=typeof i?i:!e)}hasPermissions(t,e=false){return new s(this.permissions).has(t,!e)}comparePositionTo(t){return this.constructor.comparePositions(this,t)}edit(t){return this.client.rest.methods.updateGuildRole(this,t)}setName(t){return this.edit({name:t})}setColor(t){return this.edit({color:t})}setHoist(t){return this.edit({hoist:t})}setPosition(t,e){return this.guild.setRolePosition(this,t,e).then(()=>this)}setPermissions(t){return this.edit({permissions:t})}setMentionable(t){return this.edit({mentionable:t})}delete(){return this.client.rest.methods.deleteGuildRole(this)}equals(t){return t&&this.id===t.id&&this.name===t.name&&this.color===t.color&&this.hoist===t.hoist&&this.position===t.position&&this.permissions===t.permissions&&this.managed===t.managed}toString(){return this.id===this.guild.id?"@everyone":`<@&${this.id}>`}static comparePositions(t,e){return t.position===e.position?e.id-t.id:t.position-e.position}}t.exports=o},function(t,e,i){const n=i(15),s=i(0),o=i(7).Presence,r=i(5);class a{constructor(t,e){Object.defineProperty(this,"client",{value:t}),e&&this.setup(e)}setup(t){this.id=t.id,this.username=t.username,this.discriminator=t.discriminator,this.avatar=t.avatar,this.bot=Boolean(t.bot),this.lastMessageID=null,this.lastMessage=null}patch(t){for(const e of["id","username","discriminator","avatar","bot"])"undefined"!=typeof t[e]&&(this[e]=t[e]);t.token&&(this.client.token=t.token)}get createdTimestamp(){return r.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 t of this.client.guilds.values())if(t.presences.has(this.id))return t.presences.get(this.id);return new o}get avatarURL(){return this.avatar?s.Endpoints.User(this).Avatar(this.client.options.http.cdn,this.avatar):null}get defaultAvatarURL(){const t=Object.keys(s.DefaultAvatars),e=t[this.discriminator%t.length];return s.Endpoints.assets(`${s.DefaultAvatars[e]}.png`)}get displayAvatarURL(){return this.avatarURL||this.defaultAvatarURL}get note(){return this.client.user.notes.get(this.id)||null}typingIn(t){return t=this.client.resolver.resolveChannel(t),t._typing.has(this.id)}typingSinceIn(t){return t=this.client.resolver.resolveChannel(t),t._typing.has(this.id)?new Date(t._typing.get(this.id).since):null}typingDurationIn(t){return t=this.client.resolver.resolveChannel(t),t._typing.has(this.id)?t._typing.get(this.id).elapsedTime:-1}get dmChannel(){return this.client.channels.filter(t=>"dm"===t.type).find(t=>t.recipient.id===this.id)}createDM(){return this.client.rest.methods.createDM(this)}deleteDM(){return this.client.rest.methods.deleteChannel(this)}addFriend(){return this.client.rest.methods.addFriend(this)}removeFriend(){return this.client.rest.methods.removeFriend(this)}block(){return this.client.rest.methods.blockUser(this)}unblock(){return this.client.rest.methods.unblockUser(this)}fetchProfile(){return this.client.rest.methods.fetchUserProfile(this)}setNote(t){return this.client.rest.methods.setNote(this,t)}equals(t){let e=t&&this.id===t.id&&this.username===t.username&&this.discriminator===t.discriminator&&this.avatar===t.avatar&&this.bot===Boolean(t.bot);return e}toString(){return`<@${this.id}>`}send(){}sendMessage(){}sendEmbed(){}sendFile(){}sendCode(){}}n.applyToClass(a),t.exports=a},function(t,e,i){const n=i(0),s=i(3),o=i(5);class r{constructor(t,e){Object.defineProperty(this,"client",{value:t.client}),this.guild=t,this.setup(e)}setup(t){this.id=t.id,this.name=t.name,this.requiresColons=t.require_colons,this.managed=t.managed,this._roles=t.roles}get createdTimestamp(){return o.deconstruct(this.id).timestamp}get createdAt(){return new Date(this.createdTimestamp)}get roles(){const t=new s;for(const e of this._roles)this.guild.roles.has(e)&&t.set(e,this.guild.roles.get(e));return t}get url(){return n.Endpoints.emoji(this.id)}get identifier(){return this.id?`${this.name}:${this.id}`:encodeURIComponent(this.name)}edit(t){return this.client.rest.methods.updateEmoji(this,t)}toString(){return this.requiresColons?`<:${this.name}:${this.id}>`:this.name}equals(t){return t instanceof r?t.id===this.id&&t.name===this.name&&t.managed===this.managed&&t.requiresColons===this.requiresColons:t.id===this.id&&t.name===this.name}}t.exports=r},function(t,e,i){const n=i(15),s=i(10),o=i(6),r=i(3),a=i(7).Presence;class c{constructor(t,e){Object.defineProperty(this,"client",{value:t.client}),this.guild=t,this.user={},this._roles=[],e&&this.setup(e),this.lastMessageID=null,this.lastMessage=null}setup(t){this.serverDeaf=t.deaf,this.serverMute=t.mute,this.selfMute=t.self_mute,this.selfDeaf=t.self_deaf,this.voiceSessionID=t.session_id,this.voiceChannelID=t.channel_id,this.speaking=!1,this.nickname=t.nick||null,this.joinedTimestamp=new Date(t.joined_at).getTime(),this.user=t.user,this._roles=t.roles}get joinedAt(){return new Date(this.joinedTimestamp)}get presence(){return this.frozenPresence||this.guild.presences.get(this.id)||new a}get roles(){const t=new r,e=this.guild.roles.get(this.guild.id);e&&t.set(e.id,e);for(const i of this._roles){const e=this.guild.roles.get(i);e&&t.set(e.id,e)}return t}get highestRole(){return this.roles.reduce((t,e)=>!t||e.comparePositionTo(t)>0?e:t)}get colorRole(){const t=this.roles.filter(t=>t.color);return t.size?t.reduce((t,e)=>!t||e.comparePositionTo(t)>0?e:t):null}get displayColor(){const t=this.colorRole;return t&&t.color||0}get displayHexColor(){const t=this.colorRole;return t&&t.hexColor||"#000000"}get hoistRole(){const t=this.roles.filter(t=>t.hoist);return t.size?t.reduce((t,e)=>!t||e.comparePositionTo(t)>0?e:t):null}get mute(){return this.selfMute||this.serverMute}get deaf(){return this.selfDeaf||this.serverDeaf}get voiceChannel(){return this.guild.channels.get(this.voiceChannelID)}get id(){return this.user.id}get displayName(){return this.nickname||this.user.username}get permissions(){if(this.user.id===this.guild.ownerID)return new o(this,o.ALL);let t=0;const e=this.roles;for(const i of e.values())t|=i.permissions;return new o(this,t)}get kickable(){if(this.user.id===this.guild.ownerID)return!1;if(this.user.id===this.client.user.id)return!1;const t=this.guild.member(this.client.user);return!!t.hasPermission(o.FLAGS.KICK_MEMBERS)&&t.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 t=this.guild.member(this.client.user);return!!t.hasPermission(o.FLAGS.BAN_MEMBERS)&&t.highestRole.comparePositionTo(this.highestRole)>0}permissionsIn(t){if(t=this.client.resolver.resolveChannel(t),!t||!t.guild)throw new Error("Could not resolve channel to a guild channel.");return t.permissionsFor(this)}hasPermission(t,e=false,i,n){return"undefined"==typeof i&&(i=!e),"undefined"==typeof n&&(n=!e),!(!n||this.user.id!==this.guild.ownerID)||this.roles.some(e=>e.hasPermission(t,void 0,i))}hasPermissions(t,e=false){return!e&&this.user.id===this.guild.ownerID||t.every(t=>this.hasPermission(t,e))}missingPermissions(t,e=false){return t.filter(t=>!this.hasPermission(t,e))}edit(t){return this.client.rest.methods.updateGuildMember(this,t)}setMute(t){return this.edit({mute:t})}setDeaf(t){return this.edit({deaf:t})}setVoiceChannel(t){return this.edit({channel:t})}setRoles(t){return this.edit({roles:t})}addRole(t){return t instanceof s||(t=this.guild.roles.get(t)),this.client.rest.methods.addMemberRole(this,t)}addRoles(t){let e;if(t instanceof r){e=this._roles.slice();for(const i of t.values())e.push(i.id)}else e=this._roles.concat(t);return this.edit({roles:e})}removeRole(t){return t instanceof s||(t=this.guild.roles.get(t)),this.client.rest.methods.removeMemberRole(this,t)}removeRoles(t){const e=this._roles.slice();if(t instanceof r)for(const i of t.values()){const t=e.indexOf(i.id);t>=0&&e.splice(t,1)}else for(const i of t){const t=e.indexOf(i instanceof s?i.id:i);t>=0&&e.splice(t,1)}return this.edit({roles:e})}setNickname(t){return this.edit({nick:t})}createDM(){return this.user.createDM()}deleteDM(){return this.user.deleteDM()}kick(){return this.client.rest.methods.kickGuildMember(this.guild,this)}ban(t=0){return this.client.rest.methods.banGuildMember(this.guild,this,t)}toString(){return`<@${this.nickname?"!":""}${this.user.id}>`}send(){}sendMessage(){}sendEmbed(){}sendFile(){}sendCode(){}}n.applyToClass(c),t.exports=c},function(t,e,i){"use strict";(function(t){function n(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(t){return!1}}function s(){return r.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function o(t,e){if(s()=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().toString(16)+" bytes");return 0|t}function g(t){return+t!=t&&(t=0),r.alloc(+t)}function v(t,e){if(r.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var i=t.length;if(0===i)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return i;case"utf8":case"utf-8":case void 0:return Y(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*i;case"hex":return i>>>1;case"base64":return K(t).length;default:if(n)return Y(t).length;e=(""+e).toLowerCase(),n=!0}}function E(t,e,i){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===i||i>this.length)&&(i=this.length),i<=0)return"";if(i>>>=0,e>>>=0,i<=e)return"";for(t||(t="utf8");;)switch(t){case"hex":return C(this,e,i);case"utf8":case"utf-8":return M(this,e,i);case"ascii":return I(this,e,i);case"latin1":case"binary":return U(this,e,i);case"base64":return D(this,e,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return L(this,e,i);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function x(t,e,i){var n=t[e];t[e]=t[i],t[i]=n}function b(t,e,i,n,s){if(0===t.length)return-1;if("string"==typeof i?(n=i,i=0):i>2147483647?i=2147483647:i<-2147483648&&(i=-2147483648),i=+i,isNaN(i)&&(i=s?0:t.length-1),i<0&&(i=t.length+i),i>=t.length){if(s)return-1;i=t.length-1}else if(i<0){if(!s)return-1;i=0}if("string"==typeof e&&(e=r.from(e,n)),r.isBuffer(e))return 0===e.length?-1:w(t,e,i,n,s);if("number"==typeof e)return e&=255,r.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?s?Uint8Array.prototype.indexOf.call(t,e,i):Uint8Array.prototype.lastIndexOf.call(t,e,i):w(t,[e],i,n,s);throw new TypeError("val must be string, number or Buffer")}function w(t,e,i,n,s){function o(t,e){return 1===r?t[e]:t.readUInt16BE(e*r)}var r=1,a=t.length,c=e.length;if(void 0!==n&&(n=String(n).toLowerCase(),"ucs2"===n||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;r=2,a/=2,c/=2,i/=2}var l;if(s){var u=-1;for(l=i;la&&(i=a-c),l=i;l>=0;l--){for(var h=!0,p=0;ps&&(n=s)):n=s;var o=e.length;if(o%2!==0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var r=0;r239?4:o>223?3:o>191?2:1;if(s+a<=i){var c,l,u,h;switch(a){case 1:o<128&&(r=o);break;case 2:c=t[s+1],128===(192&c)&&(h=(31&o)<<6|63&c,h>127&&(r=h));break;case 3:c=t[s+1],l=t[s+2],128===(192&c)&&128===(192&l)&&(h=(15&o)<<12|(63&c)<<6|63&l,h>2047&&(h<55296||h>57343)&&(r=h));break;case 4:c=t[s+1],l=t[s+2],u=t[s+3],128===(192&c)&&128===(192&l)&&128===(192&u)&&(h=(15&o)<<18|(63&c)<<12|(63&l)<<6|63&u,h>65535&&h<1114112&&(r=h))}}null===r?(r=65533,a=1):r>65535&&(r-=65536,n.push(r>>>10&1023|55296),r=56320|1023&r),n.push(r),s+=a}return S(n)}function S(t){var e=t.length;if(e<=tt)return String.fromCharCode.apply(String,t);for(var i="",n=0;nn)&&(i=n);for(var s="",o=e;oi)throw new RangeError("Trying to access beyond buffer length")}function O(t,e,i,n,s,o){if(!r.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>s||et.length)throw new RangeError("Index out of range")}function P(t,e,i,n){e<0&&(e=65535+e+1);for(var s=0,o=Math.min(t.length-i,2);s>>8*(n?s:1-s)}function G(t,e,i,n){e<0&&(e=4294967295+e+1);for(var s=0,o=Math.min(t.length-i,4);s>>8*(n?s:3-s)&255}function j(t,e,i,n,s,o){if(i+n>t.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("Index out of range")}function q(t,e,i,n,s){return s||j(t,e,i,4,3.4028234663852886e38,-3.4028234663852886e38),Z.write(t,e,i,n,23,4),i+4}function B(t,e,i,n,s){return s||j(t,e,i,8,1.7976931348623157e308,-1.7976931348623157e308),Z.write(t,e,i,n,52,8),i+8}function z(t){if(t=V(t).replace(et,""),t.length<2)return"";for(;t.length%4!==0;)t+="=";return t}function V(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function W(t){return t<16?"0"+t.toString(16):t.toString(16)}function Y(t,e){e=e||1/0;for(var i,n=t.length,s=null,o=[],r=0;r55295&&i<57344){if(!s){if(i>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(r+1===n){(e-=3)>-1&&o.push(239,191,189);continue}s=i;continue}if(i<56320){(e-=3)>-1&&o.push(239,191,189),s=i;continue}i=(s-55296<<10|i-56320)+65536}else s&&(e-=3)>-1&&o.push(239,191,189);if(s=null,i<128){if((e-=1)<0)break;o.push(i)}else if(i<2048){if((e-=2)<0)break;o.push(i>>6|192,63&i|128)}else if(i<65536){if((e-=3)<0)break;o.push(i>>12|224,i>>6&63|128,63&i|128)}else{if(!(i<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(i>>18|240,i>>12&63|128,i>>6&63|128,63&i|128)}}return o}function H(t){for(var e=[],i=0;i>8,s=i%256,o.push(s),o.push(n);return o}function K(t){return Q.toByteArray(z(t))}function J(t,e,i,n){for(var s=0;s=e.length||s>=t.length);++s)e[s+i]=t[s];return s}function $(t){return t!==t}/*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh * @license MIT */ -var $=n(52),Q=n(54),Z=n(55);e.Buffer=o,e.SlowBuffer=g,e.INSPECT_MAX_BYTES=50,o.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:i(),e.kMaxLength=s(),o.poolSize=8192,o._augment=function(t){return t.__proto__=o.prototype,t},o.from=function(t,e,n){return u(null,t,e,n)},o.TYPED_ARRAY_SUPPORT&&(o.prototype.__proto__=Uint8Array.prototype,o.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&o[Symbol.species]===o&&Object.defineProperty(o,Symbol.species,{value:null,configurable:!0})),o.alloc=function(t,e,n){return h(null,t,e,n)},o.allocUnsafe=function(t){return a(null,t)},o.allocUnsafeSlow=function(t){return a(null,t)},o.isBuffer=function(t){return!(null==t||!t._isBuffer)},o.compare=function(t,e){if(!o.isBuffer(t)||!o.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var n=t.length,i=e.length,s=0,r=Math.min(n,i);s0&&(t=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(t+=" ... ")),""},o.prototype.compare=function(t,e,n,i,s){if(!o.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===i&&(i=0),void 0===s&&(s=this.length),e<0||n>t.length||i<0||s>this.length)throw new RangeError("out of range index");if(i>=s&&e>=n)return 0;if(i>=s)return-1;if(e>=n)return 1;if(e>>>=0,n>>>=0,i>>>=0,s>>>=0,this===t)return 0;for(var r=s-i,u=n-e,c=Math.min(r,u),h=this.slice(i,s),a=t.slice(e,n),l=0;ls)&&(n=s),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var r=!1;;)switch(i){case"hex":return b(this,t,e,n);case"utf8":case"utf-8":return A(this,t,e,n);case"ascii":return T(this,t,e,n);case"latin1":case"binary":return R(this,t,e,n);case"base64":return D(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return M(this,t,e,n);default:if(r)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),r=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var tt=4096;o.prototype.slice=function(t,e){var n=this.length;t=~~t,e=void 0===e?n:~~e,t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),e0&&(s*=256);)i+=this[t+--e]*s;return i},o.prototype.readUInt8=function(t,e){return e||O(t,1,this.length),this[t]},o.prototype.readUInt16LE=function(t,e){return e||O(t,2,this.length),this[t]|this[t+1]<<8},o.prototype.readUInt16BE=function(t,e){return e||O(t,2,this.length),this[t]<<8|this[t+1]},o.prototype.readUInt32LE=function(t,e){return e||O(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},o.prototype.readUInt32BE=function(t,e){return e||O(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},o.prototype.readIntLE=function(t,e,n){t|=0,e|=0,n||O(t,e,this.length);for(var i=this[t],s=1,r=0;++r=s&&(i-=Math.pow(2,8*e)),i},o.prototype.readIntBE=function(t,e,n){t|=0,e|=0,n||O(t,e,this.length);for(var i=e,s=1,r=this[t+--i];i>0&&(s*=256);)r+=this[t+--i]*s;return s*=128,r>=s&&(r-=Math.pow(2,8*e)),r},o.prototype.readInt8=function(t,e){return e||O(t,1,this.length),128&this[t]?(255-this[t]+1)*-1:this[t]},o.prototype.readInt16LE=function(t,e){e||O(t,2,this.length);var n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},o.prototype.readInt16BE=function(t,e){e||O(t,2,this.length);var n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},o.prototype.readInt32LE=function(t,e){return e||O(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},o.prototype.readInt32BE=function(t,e){return e||O(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},o.prototype.readFloatLE=function(t,e){return e||O(t,4,this.length),Q.read(this,t,!0,23,4)},o.prototype.readFloatBE=function(t,e){return e||O(t,4,this.length),Q.read(this,t,!1,23,4)},o.prototype.readDoubleLE=function(t,e){return e||O(t,8,this.length),Q.read(this,t,!0,52,8)},o.prototype.readDoubleBE=function(t,e){return e||O(t,8,this.length),Q.read(this,t,!1,52,8)},o.prototype.writeUIntLE=function(t,e,n,i){if(t=+t,e|=0,n|=0,!i){var s=Math.pow(2,8*n)-1;P(this,t,e,n,s,0)}var r=1,o=0;for(this[e]=255&t;++o=0&&(o*=256);)this[e+r]=t/o&255;return e+n},o.prototype.writeUInt8=function(t,e,n){return t=+t,e|=0,n||P(this,t,e,1,255,0),o.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},o.prototype.writeUInt16LE=function(t,e,n){return t=+t,e|=0,n||P(this,t,e,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):G(this,t,e,!0),e+2},o.prototype.writeUInt16BE=function(t,e,n){return t=+t,e|=0,n||P(this,t,e,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):G(this,t,e,!1),e+2},o.prototype.writeUInt32LE=function(t,e,n){return t=+t,e|=0,n||P(this,t,e,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):x(this,t,e,!0),e+4},o.prototype.writeUInt32BE=function(t,e,n){return t=+t,e|=0,n||P(this,t,e,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):x(this,t,e,!1),e+4},o.prototype.writeIntLE=function(t,e,n,i){if(t=+t,e|=0,!i){var s=Math.pow(2,8*n-1);P(this,t,e,n,s-1,-s)}var r=0,o=1,u=0;for(this[e]=255&t;++r>0)-u&255;return e+n},o.prototype.writeIntBE=function(t,e,n,i){if(t=+t,e|=0,!i){var s=Math.pow(2,8*n-1);P(this,t,e,n,s-1,-s)}var r=n-1,o=1,u=0;for(this[e+r]=255&t;--r>=0&&(o*=256);)t<0&&0===u&&0!==this[e+r+1]&&(u=1),this[e+r]=(t/o>>0)-u&255;return e+n},o.prototype.writeInt8=function(t,e,n){return t=+t,e|=0,n||P(this,t,e,1,127,-128),o.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},o.prototype.writeInt16LE=function(t,e,n){return t=+t,e|=0,n||P(this,t,e,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):G(this,t,e,!0),e+2},o.prototype.writeInt16BE=function(t,e,n){return t=+t,e|=0,n||P(this,t,e,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):G(this,t,e,!1),e+2},o.prototype.writeInt32LE=function(t,e,n){return t=+t,e|=0,n||P(this,t,e,4,2147483647,-2147483648),o.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):x(this,t,e,!0),e+4},o.prototype.writeInt32BE=function(t,e,n){return t=+t,e|=0,n||P(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):x(this,t,e,!1),e+4},o.prototype.writeFloatLE=function(t,e,n){return B(this,t,e,!0,n)},o.prototype.writeFloatBE=function(t,e,n){return B(this,t,e,!1,n)},o.prototype.writeDoubleLE=function(t,e,n){return q(this,t,e,!0,n)},o.prototype.writeDoubleBE=function(t,e,n){return q(this,t,e,!1,n)},o.prototype.copy=function(t,e,n,i){if(n||(n=0),i||0===i||(i=this.length),e>=t.length&&(e=t.length),e||(e=0),i>0&&i=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-e=0;--s)t[s+e]=this[s+n];else if(r<1e3||!o.TYPED_ARRAY_SUPPORT)for(s=0;s>>=0,n=void 0===n?this.length:n>>>0,t||(t=0);var r;if("number"==typeof t)for(r=e;r0&&this._events[t].length>s&&(this._events[t].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[t].length),"function"==typeof console.trace&&console.trace())),this},n.prototype.on=n.prototype.addListener,n.prototype.once=function(t,e){function n(){this.removeListener(t,n),s||(s=!0,e.apply(this,arguments))}if(!i(e))throw TypeError("listener must be a function");var s=!1;return n.listener=e,this.on(t,n),this},n.prototype.removeListener=function(t,e){var n,s,o,u;if(!i(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(n=this._events[t],o=n.length,s=-1,n===e||i(n.listener)&&n.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(r(n)){for(u=o;u-- >0;)if(n[u]===e||n[u].listener&&n[u].listener===e){s=u;break}if(s<0)return this;1===n.length?(n.length=0,delete this._events[t]):n.splice(s,1),this._events.removeListener&&this.emit("removeListener",t,e)}return this},n.prototype.removeAllListeners=function(t){var e,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[t]&&delete this._events[t],this;if(0===arguments.length){for(e in this._events)"removeListener"!==e&&this.removeAllListeners(e);return this.removeAllListeners("removeListener"),this._events={},this}if(n=this._events[t],i(n))this.removeListener(t,n);else if(n)for(;n.length;)this.removeListener(t,n[n.length-1]);return delete this._events[t],this},n.prototype.listeners=function(t){var e;return e=this._events&&this._events[t]?i(this._events[t])?[this._events[t]]:this._events[t].slice():[]},n.prototype.listenerCount=function(t){if(this._events){var e=this._events[t];if(i(e))return 1;if(e)return e.length}return 0},n.listenerCount=function(t,e){return t.listenerCount(e)}},function(t,e,n){var i,s,r;!function(n,o){s=[],i=o,r="function"==typeof i?i.apply(e,s):i,!(void 0!==r&&(t.exports=r))}(this,function(){"use strict";function t(t,e,n){this.low=0|t,this.high=0|e,this.unsigned=!!n}function e(t){return(t&&t.__isLong__)===!0}function n(t,e){var n,i,r;return e?(t>>>=0,(r=0<=t&&t<256)&&(i=c[t])?i:(n=s(t,(0|t)<0?-1:0,!0),r&&(c[t]=n),n)):(t|=0,(r=-128<=t&&t<128)&&(i=u[t])?i:(n=s(t,t<0?-1:0,!1),r&&(u[t]=n),n))}function i(t,e){if(isNaN(t)||!isFinite(t))return e?m:p;if(e){if(t<0)return m;if(t>=l)return y}else{if(t<=-f)return w;if(t+1>=f)return v}return t<0?i(-t,e).neg():s(t%4294967296|0,t/4294967296|0,e)}function s(e,n,i){return new t(e,n,i)}function r(t,e,n){if(0===t.length)throw Error("empty string");if("NaN"===t||"Infinity"===t||"+Infinity"===t||"-Infinity"===t)return p;if("number"==typeof e?(n=e,e=!1):e=!!e,n=n||10,n<2||360)throw Error("interior hyphen");if(0===s)return r(t.substring(1),e,n).neg();for(var o=i(h(n,8)),u=p,c=0;c>>0:this.low},b.toNumber=function(){return this.unsigned?4294967296*(this.high>>>0)+(this.low>>>0):4294967296*this.high+(this.low>>>0)},b.toString=function(t){if(t=t||10,t<2||36>>0,l=a.toString(t);if(o=c,o.isZero())return l+u;for(;l.length<6;)l="0"+l;u=""+l+u}},b.getHighBits=function(){return this.high},b.getHighBitsUnsigned=function(){return this.high>>>0},b.getLowBits=function(){return this.low},b.getLowBitsUnsigned=function(){return this.low>>>0},b.getNumBitsAbs=function(){if(this.isNegative())return this.eq(w)?64:this.neg().getNumBitsAbs();for(var t=0!=this.high?this.high:this.low,e=31;e>0&&0==(t&1<=0},b.isOdd=function(){return 1===(1&this.low)},b.isEven=function(){return 0===(1&this.low)},b.equals=function(t){return e(t)||(t=o(t)),(this.unsigned===t.unsigned||this.high>>>31!==1||t.high>>>31!==1)&&(this.high===t.high&&this.low===t.low)},b.eq=b.equals,b.notEquals=function(t){return!this.eq(t)},b.neq=b.notEquals,b.lessThan=function(t){return this.comp(t)<0},b.lt=b.lessThan,b.lessThanOrEqual=function(t){return this.comp(t)<=0},b.lte=b.lessThanOrEqual,b.greaterThan=function(t){return this.comp(t)>0},b.gt=b.greaterThan,b.greaterThanOrEqual=function(t){return this.comp(t)>=0},b.gte=b.greaterThanOrEqual,b.compare=function(t){if(e(t)||(t=o(t)),this.eq(t))return 0;var n=this.isNegative(),i=t.isNegative();return n&&!i?-1:!n&&i?1:this.unsigned?t.high>>>0>this.high>>>0||t.high===this.high&&t.low>>>0>this.low>>>0?-1:1:this.sub(t).isNegative()?-1:1},b.comp=b.compare,b.negate=function(){return!this.unsigned&&this.eq(w)?w:this.not().add(g)},b.neg=b.negate,b.add=function(t){e(t)||(t=o(t));var n=this.high>>>16,i=65535&this.high,r=this.low>>>16,u=65535&this.low,c=t.high>>>16,h=65535&t.high,a=t.low>>>16,l=65535&t.low,f=0,d=0,p=0,m=0;return m+=u+l,p+=m>>>16,m&=65535,p+=r+a,d+=p>>>16,p&=65535,d+=i+h,f+=d>>>16,d&=65535,f+=n+c,f&=65535,s(p<<16|m,f<<16|d,this.unsigned)},b.subtract=function(t){return e(t)||(t=o(t)),this.add(t.neg())},b.sub=b.subtract,b.multiply=function(t){if(this.isZero())return p;if(e(t)||(t=o(t)),t.isZero())return p;if(this.eq(w))return t.isOdd()?w:p;if(t.eq(w))return this.isOdd()?w:p;if(this.isNegative())return t.isNegative()?this.neg().mul(t.neg()):this.neg().mul(t).neg();if(t.isNegative())return this.mul(t.neg()).neg();if(this.lt(d)&&t.lt(d))return i(this.toNumber()*t.toNumber(),this.unsigned);var n=this.high>>>16,r=65535&this.high,u=this.low>>>16,c=65535&this.low,h=t.high>>>16,a=65535&t.high,l=t.low>>>16,f=65535&t.low,m=0,g=0,E=0,_=0;return _+=c*f,E+=_>>>16,_&=65535,E+=u*f,g+=E>>>16,E&=65535,E+=c*l,g+=E>>>16,E&=65535,g+=r*f,m+=g>>>16,g&=65535,g+=u*l,m+=g>>>16,g&=65535,g+=c*a,m+=g>>>16,g&=65535,m+=n*f+r*l+u*a+c*h,m&=65535,s(E<<16|_,m<<16|g,this.unsigned)},b.mul=b.multiply,b.divide=function(t){if(e(t)||(t=o(t)),t.isZero())throw Error("division by zero");if(this.isZero())return this.unsigned?m:p;var n,s,r;if(this.unsigned){if(t.unsigned||(t=t.toUnsigned()),t.gt(this))return m;if(t.gt(this.shru(1)))return E;r=m}else{if(this.eq(w)){if(t.eq(g)||t.eq(_))return w;if(t.eq(w))return g;var u=this.shr(1);return n=u.div(t).shl(1),n.eq(p)?t.isNegative()?g:_:(s=this.sub(t.mul(n)),r=n.add(s.div(t)))}if(t.eq(w))return this.unsigned?m:p;if(this.isNegative())return t.isNegative()?this.neg().div(t.neg()):this.neg().div(t).neg();if(t.isNegative())return this.div(t.neg()).neg();r=p}for(s=this;s.gte(t);){n=Math.max(1,Math.floor(s.toNumber()/t.toNumber()));for(var c=Math.ceil(Math.log(n)/Math.LN2),a=c<=48?1:h(2,c-48),l=i(n),f=l.mul(t);f.isNegative()||f.gt(s);)n-=a,l=i(n,this.unsigned),f=l.mul(t);l.isZero()&&(l=g),r=r.add(l),s=s.sub(f)}return r},b.div=b.divide,b.modulo=function(t){return e(t)||(t=o(t)),this.sub(this.div(t).mul(t))},b.mod=b.modulo,b.not=function(){return s(~this.low,~this.high,this.unsigned)},b.and=function(t){return e(t)||(t=o(t)),s(this.low&t.low,this.high&t.high,this.unsigned)},b.or=function(t){return e(t)||(t=o(t)),s(this.low|t.low,this.high|t.high,this.unsigned)},b.xor=function(t){return e(t)||(t=o(t)),s(this.low^t.low,this.high^t.high,this.unsigned)},b.shiftLeft=function(t){return e(t)&&(t=t.toInt()),0===(t&=63)?this:t<32?s(this.low<>>32-t,this.unsigned):s(0,this.low<>>t|this.high<<32-t,this.high>>t,this.unsigned):s(this.high>>t-32,this.high>=0?0:-1,this.unsigned)},b.shr=b.shiftRight,b.shiftRightUnsigned=function(t){if(e(t)&&(t=t.toInt()),t&=63,0===t)return this;var n=this.high;if(t<32){var i=this.low;return s(i>>>t|n<<32-t,n>>>t,this.unsigned)}return 32===t?s(n,0,this.unsigned):s(n>>>t-32,0,this.unsigned)},b.shru=b.shiftRightUnsigned,b.toSigned=function(){return this.unsigned?s(this.low,this.high,!1):this},b.toUnsigned=function(){return this.unsigned?this:s(this.low,this.high,!0)},b.toBytes=function(t){return t?this.toBytesLE():this.toBytesBE()},b.toBytesLE=function(){var t=this.high,e=this.low;return[255&e,e>>>8&255,e>>>16&255,e>>>24&255,255&t,t>>>8&255,t>>>16&255,t>>>24&255]},b.toBytesBE=function(){var t=this.high,e=this.low;return[t>>>24&255,t>>>16&255,t>>>8&255,255&t,e>>>24&255,e>>>16&255,e>>>8&255,255&e]},t})},function(t,e,n){(function(t){function n(t,e){for(var n=0,i=t.length-1;i>=0;i--){var s=t[i];"."===s?t.splice(i,1):".."===s?(t.splice(i,1),n++):n&&(t.splice(i,1),n--)}if(e)for(;n--;n)t.unshift("..");return t}function i(t,e){if(t.filter)return t.filter(e);for(var n=[],i=0;i=-1&&!s;r--){var o=r>=0?arguments[r]:t.cwd();if("string"!=typeof o)throw new TypeError("Arguments to path.resolve must be strings");o&&(e=o+"/"+e,s="/"===o.charAt(0))}return e=n(i(e.split("/"),function(t){return!!t}),!s).join("/"),(s?"/":"")+e||"."},e.normalize=function(t){var s=e.isAbsolute(t),r="/"===o(t,-1);return t=n(i(t.split("/"),function(t){return!!t}),!s).join("/"),t||s||(t="."),t&&r&&(t+="/"),(s?"/":"")+t},e.isAbsolute=function(t){return"/"===t.charAt(0)},e.join=function(){var t=Array.prototype.slice.call(arguments,0);return e.normalize(i(t,function(t,e){if("string"!=typeof t)throw new TypeError("Arguments to path.join must be strings");return t}).join("/"))},e.relative=function(t,n){function i(t){for(var e=0;e=0&&""===t[n];n--);return e>n?[]:t.slice(e,n-e+1)}t=e.resolve(t).substr(1),n=e.resolve(n).substr(1);for(var s=i(t.split("/")),r=i(n.split("/")),o=Math.min(s.length,r.length),u=o,c=0;c=0?"&":"?")+t),this._sort){var e=this.url.indexOf("?");if(e>=0){var n=this.url.substring(e+1).split("&");g(this._sort)?n.sort(this._sort):n.sort(),this.url=this.url.substring(0,e)+"?"+n.join("&")}}},a.prototype._isHost=function(t){return t&&"object"==typeof t&&!Array.isArray(t)&&"[object Object]"!==Object.prototype.toString.call(t)},a.prototype.end=function(t){return this._endCalled&&console.warn("Warning: .end() was called twice. This is not supported in superagent"),this._endCalled=!0,this._callback=t||i,this._appendQueryString(),this._end()},a.prototype._end=function(){var t=this,e=this.xhr=v.getXHR(),n=this._formData||this._data;this._setTimeouts(),e.onreadystatechange=function(){var n=e.readyState;if(n>=2&&t._responseTimeoutTimer&&clearTimeout(t._responseTimeoutTimer),4==n){var i;try{i=e.status}catch(t){i=0}if(!i){if(t.timedout||t._aborted)return;return t.crossDomainError()}t.emit("end")}};var i=function(e,n){n.total>0&&(n.percent=n.loaded/n.total*100),n.direction=e,t.emit("progress",n)};if(this.hasListeners("progress"))try{e.onprogress=i.bind(null,"download"),e.upload&&(e.upload.onprogress=i.bind(null,"upload"))}catch(t){}try{this.username&&this.password?e.open(this.method,this.url,!0,this.username,this.password):e.open(this.method,this.url,!0)}catch(t){return this.callback(t)}if(this._withCredentials&&(e.withCredentials=!0),!this._formData&&"GET"!=this.method&&"HEAD"!=this.method&&"string"!=typeof n&&!this._isHost(n)){var s=this._header["content-type"],r=this._serializer||v.serialize[s?s.split(";")[0]:""];!r&&c(s)&&(r=v.serialize["application/json"]),r&&(n=r(n))}for(var o in this.header)null!=this.header[o]&&e.setRequestHeader(o,this.header[o]);return this._responseType&&(e.responseType=this._responseType),this.emit("request",this),e.send("undefined"!=typeof n?n:null),this},v.get=function(t,e,n){var i=v("GET",t);return"function"==typeof e&&(n=e,e=null),e&&i.query(e),n&&i.end(n),i},v.head=function(t,e,n){var i=v("HEAD",t);return"function"==typeof e&&(n=e,e=null),e&&i.send(e),n&&i.end(n),i},v.options=function(t,e,n){var i=v("OPTIONS",t);return"function"==typeof e&&(n=e,e=null),e&&i.send(e),n&&i.end(n),i},v.del=l,v.delete=l,v.patch=function(t,e,n){var i=v("PATCH",t);return"function"==typeof e&&(n=e,e=null),e&&i.send(e),n&&i.end(n),i},v.post=function(t,e,n){var i=v("POST",t); -return"function"==typeof e&&(n=e,e=null),e&&i.send(e),n&&i.end(n),i},v.put=function(t,e,n){var i=v("PUT",t);return"function"==typeof e&&(n=e,e=null),e&&i.send(e),n&&i.end(n),i}},function(t,e){function n(t){return null!==t&&"object"==typeof t}t.exports=n},function(t,e,n){(function(e){const i=n(25),s=n(43),r=n(26),o=n(0),u=n(4).convertToBuffer,c=n(11),h=n(9),a=n(16),l=n(8),f=n(13),d=n(12),p=n(20);class m{constructor(t){this.client=t}resolveUser(t){return t instanceof c?t:"string"==typeof t?this.client.users.get(t)||null:t instanceof f?t.user:t instanceof h?t.author:t instanceof a?t.owner:null}resolveUserID(t){return t instanceof c||t instanceof f?t.id:"string"==typeof t?t||null:t instanceof h?t.author.id:t instanceof a?t.ownerID:null}resolveGuild(t){return t instanceof a?t:"string"==typeof t?this.client.guilds.get(t)||null:null}resolveGuildMember(t,e){return e instanceof f?e:(t=this.resolveGuild(t),e=this.resolveUser(e),t&&e?t.members.get(e.id)||null:null)}resolveChannel(t){return t instanceof l?t:"string"==typeof t?this.client.channels.get(t)||null:t instanceof h?t.channel:t instanceof a?t.channels.get(t.id)||null:null}resolveChannelID(t){return t instanceof l?t.id:"string"==typeof t?t:t instanceof h?t.channel.id:t instanceof a?t.defaultChannel.id:null}resolveInviteCode(t){const e=/discord(?:app\.com\/invite|\.gg)\/([\w-]{2,255})/i,n=e.exec(t);return n&&n[1]?n[1]:t}resolveString(t){return"string"==typeof t?t:t instanceof Array?t.join("\n"):String(t)}resolveBase64(t){return t instanceof e?`data:image/jpg;base64,${t.toString("base64")}`:t}resolveBuffer(t){return t instanceof e?Promise.resolve(t):this.client.browser&&t instanceof ArrayBuffer?Promise.resolve(u(t)):"string"==typeof t?new Promise((n,o)=>{if(/^https?:\/\//.test(t)){const i=r.get(t).set("Content-Type","blob");this.client.browser&&i.responseType("arraybuffer"),i.end((t,i)=>{return t?o(t):this.client.browser?n(u(i.xhr.response)):i.body instanceof e?n(i.body):o(new TypeError("The response body isn't a Buffer."))})}else{const e=i.resolve(t);s.stat(e,(t,i)=>{return t?o(t):i&&i.isFile()?(s.readFile(e,(t,e)=>{t?o(t):n(e)}),null):o(new Error(`The file could not be found: ${e}`))})}}):Promise.reject(new TypeError("The resource must be a string or Buffer."))}resolveEmojiIdentifier(t){return t instanceof d||t instanceof p?t.identifier:"string"!=typeof t||t.includes("%")?null:encodeURIComponent(t)}static resolveColor(t){if("string"==typeof t){if("RANDOM"===t)return Math.floor(16777216*Math.random());t=o.Colors[t]||parseInt(t.replace("#",""),16)}else t instanceof Array&&(t=(t[0]<<16)+(t[1]<<8)+t[2]);if(t<0||t>16777215)throw new RangeError("Color must be within the range 0 - 16777215 (0xFFFFFF).");if(t&&isNaN(t))throw new TypeError("Unable to convert color to a number.");return t}resolveColor(t){return this.constructor.resolveColor(t)}}t.exports=m}).call(e,n(22).Buffer)},function(t,e){t.exports={name:"discord.js",version:"11.0.0",description:"A powerful library for interacting with the Discord API",main:"./src/index",types:"./typings/index.d.ts",scripts:{test:"npm run lint && npm run docs:test",docs:"docgen --source src --custom docs/index.yml --output docs/docs.json","docs:test":"docgen --source src --custom docs/index.yml",lint:"eslint src","lint:fix":"eslint --fix src",webpack:"parallel-webpack"},repository:{type:"git",url:"git+https://github.com/hydrabolt/discord.js.git"},keywords:["discord","api","bot","client","node","discordapp"],author:"Amish Shah ",license:"Apache-2.0",bugs:{url:"https://github.com/hydrabolt/discord.js/issues"},homepage:"https://github.com/hydrabolt/discord.js#readme",runkitExampleFilename:"./docs/examples/ping.js",dependencies:{"@types/node":"^7.0.0",long:"^3.2.0","prism-media":"hydrabolt/prism-media",superagent:"^3.4.0",tweetnacl:"^0.14.0",ws:"^2.0.0"},peerDependencies:{bufferutil:"^2.0.0",erlpack:"hammerandchisel/erlpack","node-opus":"^0.2.0",opusscript:"^0.0.2",sodium:"^2.0.1",uws:"^0.14.1"},devDependencies:{"discord.js-docgen":"hydrabolt/discord.js-docgen",eslint:"^3.17.0","parallel-webpack":"^1.6.0","uglify-js":"mishoo/UglifyJS2#harmony",webpack:"^2.2.0"},engines:{node:">=6.0.0"},browser:{ws:!1,uws:!1,erlpack:!1,"prism-media":!1,opusscript:!1,"node-opus":!1,tweetnacl:!1,sodium:!1,"src/sharding/Shard.js":!1,"src/sharding/ShardClientUtil.js":!1,"src/sharding/ShardingManager.js":!1,"src/client/voice/dispatcher/StreamDispatcher.js":!1,"src/client/voice/opus/BaseOpusEngine.js":!1,"src/client/voice/opus/NodeOpusEngine.js":!1,"src/client/voice/opus/OpusEngineList.js":!1,"src/client/voice/opus/OpusScriptEngine.js":!1,"src/client/voice/pcm/ConverterEngine.js":!1,"src/client/voice/pcm/ConverterEngineList.js":!1,"src/client/voice/pcm/FfmpegConverterEngine.js":!1,"src/client/voice/player/AudioPlayer.js":!1,"src/client/voice/receiver/VoiceReadable.js":!1,"src/client/voice/receiver/VoiceReceiver.js":!1,"src/client/voice/util/Secretbox.js":!1,"src/client/voice/util/SecretKey.js":!1,"src/client/voice/util/VolumeInterface.js":!1,"src/client/voice/ClientVoiceManager.js":!1,"src/client/voice/VoiceBroadcast.js":!1,"src/client/voice/VoiceConnection.js":!1,"src/client/voice/VoiceUDPClient.js":!1,"src/client/voice/VoiceWebSocket.js":!1}}},function(t,e,n){const i=n(11),s=n(3);class r extends i{setup(t){super.setup(t),this.verified=t.verified,this.email=t.email,this.localPresence={},this._typing=new Map,this.friends=new s,this.blocked=new s,this.notes=new s,this.settings={},this.premium="boolean"==typeof t.premium?t.premium:null,this.mfaEnabled="boolean"==typeof t.mfa_enabled?t.mfa_enabled:null,this.mobile="boolean"==typeof t.mobile?t.mobile:null}edit(t){return this.client.rest.methods.updateCurrentUser(t)}setUsername(t,e){return this.client.rest.methods.updateCurrentUser({username:t},e)}setEmail(t,e){return this.client.rest.methods.updateCurrentUser({email:t},e)}setPassword(t,e){return this.client.rest.methods.updateCurrentUser({password:t},e)}setAvatar(t){return"string"==typeof t&&t.startsWith("data:")?this.client.rest.methods.updateCurrentUser({avatar:t}):this.client.resolver.resolveBuffer(t).then(t=>this.client.rest.methods.updateCurrentUser({avatar:t}))}setPresence(t){return new Promise(e=>{let n=this.localPresence.status||this.presence.status,i=this.localPresence.game,s=this.localPresence.afk||this.presence.afk;if(!i&&this.presence.game&&(i={name:this.presence.game.name,type:this.presence.game.type,url:this.presence.game.url}),t.status){if("string"!=typeof t.status)throw new TypeError("Status must be a string");n=t.status}t.game&&(i=t.game,i.url&&(i.type=1)),null===t.game&&(i=null),"undefined"!=typeof t.afk&&(s=t.afk),s=Boolean(s),this.localPresence={status:n,game:i,afk:s},this.localPresence.since=0,this.localPresence.game=this.localPresence.game||null,this.client.ws.send({op:3,d:this.localPresence}),this.client._setPresence(this.id,this.localPresence),e(this)})}setStatus(t){return this.setPresence({status:t})}setGame(t,e){return null===t?this.setPresence({game:t}):this.setPresence({game:{name:t,url:e}})}setAFK(t){return this.setPresence({afk:t})}fetchMentions(t={limit:25,roles:true,everyone:true,guild:null}){return this.client.rest.methods.fetchMentions(t)}addFriend(t){return t=this.client.resolver.resolveUser(t),this.client.rest.methods.addFriend(t)}removeFriend(t){return t=this.client.resolver.resolveUser(t),this.client.rest.methods.removeFriend(t)}createGuild(t,e,n=null){return n?"string"==typeof n&&n.startsWith("data:")?this.client.rest.methods.createGuild({name:t,icon:n,region:e}):this.client.resolver.resolveBuffer(n).then(n=>this.client.rest.methods.createGuild({name:t,icon:n,region:e})):this.client.rest.methods.createGuild({name:t,icon:n,region:e})}createGroupDM(t){return this.client.rest.methods.createGroupDM({recipients:t.map(t=>this.client.resolver.resolveUserID(t.user)),accessTokens:t.map(t=>t.accessToken),nicks:t.map(t=>t.nick)})}acceptInvite(t){return this.client.rest.methods.acceptInvite(t)}}t.exports=r},function(t,e,n){const i=n(8),s=n(14),r=n(3);class o extends i{constructor(t,e){super(t,e),this.type="dm",this.messages=new r,this._typing=new Map}setup(t){super.setup(t),this.recipient=this.client.dataManager.newUser(t.recipients[0]),this.lastMessageID=t.last_message_id}toString(){return this.recipient.toString()}send(){}sendMessage(){}sendEmbed(){}sendFile(){}sendFiles(){}sendCode(){}fetchMessage(){}fetchMessages(){}fetchPinnedMessages(){}search(){}startTyping(){}stopTyping(){}get typing(){}get typingCount(){}createCollector(){}awaitMessages(){}acknowledge(){}_cacheMessage(){}}s.applyToClass(o,!0,["bulkDelete"]),t.exports=o},function(t,e,n){const i=n(38),s=n(39),r=n(0);class o{constructor(t,e){Object.defineProperty(this,"client",{value:t}),this.setup(e)}setup(t){this.guild=this.client.guilds.get(t.guild.id)||new i(this.client,t.guild),this.code=t.code,this.temporary=t.temporary,this.maxAge=t.max_age,this.uses=t.uses,this.maxUses=t.max_uses,t.inviter&&(this.inviter=this.client.dataManager.newUser(t.inviter)),this.channel=this.client.channels.get(t.channel.id)||new s(this.client,t.channel),this.createdTimestamp=new Date(t.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 r.Endpoints.inviteLink(this.code)}delete(){return this.client.rest.methods.deleteInvite(this)}toString(){return this.url}}t.exports=o},function(t,e){class n{constructor(t,e){Object.defineProperty(this,"client",{value:t.client}),this.message=t,this.setup(e)}setup(t){this.id=t.id,this.filename=t.filename,this.filesize=t.size,this.url=t.url,this.proxyURL=t.proxy_url,this.height=t.height,this.width=t.width}}t.exports=n},function(t,e,n){const i=n(23).EventEmitter,s=n(3);class r extends i{constructor(t,e,n={}){super(),this.channel=t,this.filter=e,this.options=n,this.ended=!1,this.collected=new s,this.listener=(t=>this.verify(t)),this.channel.client.on("message",this.listener),n.time&&this.channel.client.setTimeout(()=>this.stop("time"),n.time)}verify(t){return(!this.channel||this.channel.id===t.channel.id)&&(!!this.filter(t,this)&&(this.collected.set(t.id,t),this.emit("message",t,this),this.collected.size>=this.options.maxMatches?this.stop("matchesLimit"):this.options.max&&this.collected.size===this.options.max&&this.stop("limit"),!0))}get next(){return new Promise((t,e)=>{if(this.ended)return void e(this.collected);const n=()=>{this.removeListener("message",i),this.removeListener("end",s)},i=(...e)=>{n(),t(...e)},s=(...t)=>{n(),e(...t)};this.once("message",i),this.once("end",s)})}stop(t="user"){this.ended||(this.ended=!0,this.channel.client.removeListener("message",this.listener),this.emit("end",this.collected,t))}}t.exports=r},function(t,e){class n{constructor(t,e){Object.defineProperty(this,"client",{value:t.client}),this.message=t,this.setup(e)}setup(t){if(this.type=t.type,this.title=t.title,this.description=t.description,this.url=t.url,this.color=t.color,this.fields=[],t.fields)for(const e of t.fields)this.fields.push(new c(this,e));this.createdTimestamp=t.timestamp,this.thumbnail=t.thumbnail?new i(this,t.thumbnail):null,this.image=t.image?new s(this,t.image):null,this.video=t.video?new r(this,t.video):null,this.author=t.author?new u(this,t.author):null,this.provider=t.provider?new o(this,t.provider):null,this.footer=t.footer?new h(this,t.footer):null}get createdAt(){return new Date(this.createdTimestamp)}get hexColor(){let t=this.color.toString(16);for(;t.length<6;)t=`0${t}`;return`#${t}`}}class i{constructor(t,e){this.embed=t,this.setup(e)}setup(t){this.url=t.url,this.proxyURL=t.proxy_url,this.height=t.height,this.width=t.width}}class s{constructor(t,e){this.embed=t,this.setup(e)}setup(t){this.url=t.url,this.proxyURL=t.proxy_url,this.height=t.height,this.width=t.width}}class r{constructor(t,e){this.embed=t,this.setup(e)}setup(t){this.url=t.url,this.height=t.height,this.width=t.width}}class o{constructor(t,e){this.embed=t,this.setup(e)}setup(t){this.name=t.name,this.url=t.url}}class u{constructor(t,e){this.embed=t,this.setup(e)}setup(t){this.name=t.name,this.url=t.url,this.iconURL=t.icon_url}}class c{constructor(t,e){this.embed=t,this.setup(e)}setup(t){this.name=t.name,this.value=t.value,this.inline=t.inline}}class h{constructor(t,e){this.embed=t,this.setup(e)}setup(t){this.text=t.text,this.iconURL=t.icon_url,this.proxyIconUrl=t.proxy_icon_url}}n.Thumbnail=i,n.Image=s,n.Video=r,n.Provider=o,n.Author=u,n.Field=c,n.Footer=h,t.exports=n},function(t,e,n){const i=n(3),s=n(12),r=n(20);class o{constructor(t,e,n,s){this.message=t,this.me=s,this.count=n||0,this.users=new i,this._emoji=new r(this,e.name,e.id)}get emoji(){if(this._emoji instanceof s)return this._emoji;if(this._emoji.id){const t=this.message.client.emojis;if(t.has(this._emoji.id)){const e=t.get(this._emoji.id);return this._emoji=e,e}}return this._emoji}remove(t=this.message.client.user){const e=this.message;return t=this.message.client.resolver.resolveUserID(t),t?e.client.rest.methods.removeMessageReaction(e,this.emoji.identifier,t):Promise.reject(new Error("Couldn't resolve the user ID to remove from the reaction."))}fetchUsers(t=100){const e=this.message;return e.client.rest.methods.getMessageReactionUsers(e,this.emoji.identifier,t).then(t=>{this.users=new i;for(const e of t){const t=this.message.client.dataManager.newUser(e);this.users.set(t.id,t)}return this.count=this.users.size,this.users})}}t.exports=o},function(t,e,n){const i=n(5);class s{constructor(t,e){Object.defineProperty(this,"client",{value:t}),this.setup(e)}setup(t){this.id=t.id,this.name=t.name,this.description=t.description,this.icon=t.icon,this.iconURL=`https://cdn.discordapp.com/app-icons/${this.id}/${this.icon}.jpg`,this.rpcOrigins=t.rpc_origins,this.redirectURIs=t.redirect_uris,this.botRequireCodeGrant=t.bot_require_code_grant,this.botPublic=t.bot_public,this.rpcApplicationState=t.rpc_application_state,this.bot=t.bot,this.flags=t.flags,this.secret=t.secret}get createdTimestamp(){return i.deconstruct(this.id).timestamp}get createdAt(){return new Date(this.createdTimestamp)}reset(){return this.client.rest.methods.resetApplication(this.id)}toString(){return this.name}}t.exports=s},function(t,e){class n{constructor(t,e){Object.defineProperty(this,"client",{value:t}),this.setup(e)}setup(t){this.id=t.id,this.name=t.name,this.icon=t.icon,this.splash=t.splash}}t.exports=n},function(t,e,n){const i=n(0);class s{constructor(t,e){Object.defineProperty(this,"client",{value:t}),this.setup(e)}setup(t){this.id=t.id,this.name=t.name,this.type=i.ChannelTypes.TEXT===t.type?"text":"voice"}}t.exports=s},function(t,e){class n{constructor(t,e){Object.defineProperty(this,"channel",{value:t}),e&&this.setup(e)}setup(t){this.id=t.id,this.type=t.type,this.deny=t.deny,this.allow=t.allow}delete(){return this.channel.client.rest.methods.deletePermissionOverwrites(this)}}t.exports=n},function(t,e,n){const i=n(17),s=n(14),r=n(3);class o extends i{constructor(t,e){super(t,e),this.type="text",this.messages=new r,this._typing=new Map}setup(t){super.setup(t),this.topic=t.topic,this.lastMessageID=t.last_message_id}get members(){const t=new r;for(const e of this.guild.members.values())this.permissionsFor(e).hasPermission("READ_MESSAGES")&&t.set(e.id,e);return t}fetchWebhooks(){return this.client.rest.methods.getChannelWebhooks(this)}createWebhook(t,e){return new Promise(n=>{"string"==typeof e&&e.startsWith("data:")?n(this.client.rest.methods.createWebhook(this,t,e)):this.client.resolver.resolveBuffer(e).then(e=>n(this.client.rest.methods.createWebhook(this,t,e)))})}send(){}sendMessage(){}sendEmbed(){}sendFile(){}sendFiles(){}sendCode(){}fetchMessage(){}fetchMessages(){}fetchPinnedMessages(){}search(){}startTyping(){}stopTyping(){}get typing(){}get typingCount(){}createCollector(){}awaitMessages(){}bulkDelete(){}acknowledge(){}_cacheMessage(){}}s.applyToClass(o,!0),t.exports=o},function(t,e,n){const i=n(17),s=n(3);class r extends i{constructor(t,e){super(t,e),this.members=new s,this.type="voice"}setup(t){super.setup(t),this.bitrate=t.bitrate,this.userLimit=t.user_limit}get connection(){const t=this.guild.voiceConnection;return t&&t.channel.id===this.id?t:null}get full(){return this.userLimit>0&&this.members.size>=this.userLimit}get joinable(){return!this.client.browser&&(!!this.permissionsFor(this.client.user).hasPermission("CONNECT")&&!(this.full&&!this.permissionsFor(this.client.user).hasPermission("MOVE_MEMBERS")))}get speakable(){return this.permissionsFor(this.client.user).hasPermission("SPEAK")}setBitrate(t){return this.edit({bitrate:t})}setUserLimit(t){return this.edit({userLimit:t})}join(){return this.client.browser?Promise.reject(new Error("Voice connections are not available in browsers.")):this.client.voice.joinChannel(this)}leave(){if(!this.client.browser){const t=this.client.voice.connections.get(this.guild.id);t&&t.channel.id===this.id&&t.disconnect()}}}t.exports=r},function(t,e){},function(t,e,n){const i=n(99),s=n(96),r=n(98),o=n(97),u=n(95),c=n(0);class h{constructor(t){this.client=t,this.handlers={},this.userAgentManager=new i(this),this.methods=new s(this),this.rateLimitedEndpoints={},this.globallyRateLimited=!1}push(t,e){return new Promise((n,i)=>{t.push({request:e,resolve:n,reject:i})})}getRequestHandler(){switch(this.client.options.apiRequestMethod){case"sequential":return r;case"burst":return o;default:throw new Error(c.Errors.INVALID_RATE_LIMIT_METHOD)}}makeRequest(t,e,n,i,s){const r=new u(this,t,e,n,i,s);if(!this.handlers[r.route]){const t=this.getRequestHandler();this.handlers[r.route]=new t(this,r.route)}return this.push(this.handlers[r.route],r)}}t.exports=h},function(t,e){class n{constructor(t){this.restManager=t,this.queue=[]}get globalLimit(){return this.restManager.globallyRateLimited}set globalLimit(t){this.restManager.globallyRateLimited=t}push(t){this.queue.push(t)}handle(){}}t.exports=n},function(module,exports,__webpack_require__){(function(process){const os=__webpack_require__(15),EventEmitter=__webpack_require__(23).EventEmitter,Constants=__webpack_require__(0),Permissions=__webpack_require__(6),Util=__webpack_require__(4),RESTManager=__webpack_require__(44),ClientDataManager=__webpack_require__(65),ClientManager=__webpack_require__(66),ClientDataResolver=__webpack_require__(28),ClientVoiceManager=__webpack_require__(140),WebSocketManager=__webpack_require__(100),ActionsManager=__webpack_require__(67),Collection=__webpack_require__(3),Presence=__webpack_require__(7).Presence,ShardClientUtil=__webpack_require__(139),VoiceBroadcast=__webpack_require__(141);class Client extends EventEmitter{constructor(t={}){super(),!t.shardId&&"SHARD_ID"in process.env&&(t.shardId=Number(process.env.SHARD_ID)),!t.shardCount&&"SHARD_COUNT"in process.env&&(t.shardCount=Number(process.env.SHARD_COUNT)),this.options=Util.mergeDefault(Constants.DefaultOptions,t),this._validateOptions(),this.rest=new RESTManager(this),this.dataManager=new ClientDataManager(this),this.manager=new ClientManager(this),this.ws=new WebSocketManager(this),this.resolver=new ClientDataResolver(this),this.actions=new ActionsManager(this),this.voice=this.browser?null:new ClientVoiceManager(this),this.shard=process.send?ShardClientUtil.singleton(this):null,this.users=new Collection,this.guilds=new Collection,this.channels=new Collection,this.presences=new Collection,!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._pingTimestamp=0,this._timeouts=new Set,this._intervals=new Set,this.options.messageSweepInterval>0&&this.setInterval(this.sweepMessages.bind(this),1e3*this.options.messageSweepInterval)}get status(){return this.ws.status}get uptime(){return this.readyAt?Date.now()-this.readyAt:null}get ping(){return this.pings.reduce((t,e)=>t+e,0)/this.pings.length}get voiceConnections(){return this.browser?new Collection:this.voice.connections}get emojis(){const t=new Collection;for(const e of this.guilds.values())for(const n of e.emojis.values())t.set(n.id,n);return t}get readyTimestamp(){return this.readyAt?this.readyAt.getTime():null}get browser(){return"browser"===os.platform()}createVoiceBroadcast(){const t=new VoiceBroadcast(this);return this.broadcasts.push(t),t}login(t){return this.rest.methods.login(t)}destroy(){for(const t of this._timeouts)clearTimeout(t);for(const e of this._intervals)clearInterval(e);return this._timeouts.clear(),this._intervals.clear(),this.manager.destroy()}syncGuilds(t=this.guilds){this.user.bot||this.ws.send({op:12,d:t instanceof Collection?t.keyArray():t.map(t=>t.id)})}fetchUser(t,e=true){return this.users.has(t)?Promise.resolve(this.users.get(t)):this.rest.methods.getUser(t,e)}fetchInvite(t){const e=this.resolver.resolveInviteCode(t);return this.rest.methods.getInvite(e)}fetchWebhook(t,e){return this.rest.methods.getWebhook(t,e)}fetchVoiceRegions(){return this.rest.methods.fetchVoiceRegions()}sweepMessages(t=this.options.messageCacheLifetime){if("number"!=typeof t||isNaN(t))throw new TypeError("The lifetime must be a number.");if(t<=0)return this.emit("debug","Didn't sweep messages - lifetime is unlimited"),-1;const e=1e3*t,n=Date.now();let i=0,s=0;for(const r of this.channels.values())if(r.messages){i++;for(const t of r.messages.values())n-(t.editedTimestamp||t.createdTimestamp)>e&&(r.messages.delete(t.id),s++)}return this.emit("debug",`Swept ${s} messages older than ${t} seconds in ${i} text-based channels`),s}fetchApplication(t="@me"){return this.rest.methods.getApplication(t)}generateInvite(t){return t?t instanceof Array&&(t=Permissions.resolve(t)):t=0,this.fetchApplication().then(e=>`https://discordapp.com/oauth2/authorize?client_id=${e.id}&permissions=${t}&scope=bot`)}setTimeout(t,e,...n){const i=setTimeout(()=>{t(),this._timeouts.delete(i)},e,...n);return this._timeouts.add(i),i}clearTimeout(t){clearTimeout(t),this._timeouts.delete(t)}setInterval(t,e,...n){const i=setInterval(t,e,...n);return this._intervals.add(i),i}clearInterval(t){clearInterval(t),this._intervals.delete(t)}_pong(t){this.pings.unshift(Date.now()-t),this.pings.length>3&&(this.pings.length=3),this.ws.lastHeartbeatAck=!0}_setPresence(t,e){return this.presences.has(t)?void this.presences.get(t).update(e):void this.presences.set(t,new Presence(e))}_eval(script){return eval(script)}_validateOptions(t=this.options){if("number"!=typeof t.shardCount||isNaN(t.shardCount))throw new TypeError("The shardCount option must be a number.");if("number"!=typeof t.shardId||isNaN(t.shardId))throw new TypeError("The shardId option must be a number.");if(t.shardCount<0)throw new RangeError("The shardCount option must be at least 0.");if(t.shardId<0)throw new RangeError("The shardId option must be at least 0.");if(0!==t.shardId&&t.shardId>=t.shardCount)throw new RangeError("The shardId option must be less than shardCount.");if("number"!=typeof t.messageCacheMaxSize||isNaN(t.messageCacheMaxSize))throw new TypeError("The messageCacheMaxSize option must be a number.");if("number"!=typeof t.messageCacheLifetime||isNaN(t.messageCacheLifetime))throw new TypeError("The messageCacheLifetime option must be a number.");if("number"!=typeof t.messageSweepInterval||isNaN(t.messageSweepInterval))throw new TypeError("The messageSweepInterval option must be a number.");if("boolean"!=typeof t.fetchAllMembers)throw new TypeError("The fetchAllMembers option must be a boolean.");if("boolean"!=typeof t.disableEveryone)throw new TypeError("The disableEveryone option must be a boolean.");if("number"!=typeof t.restWsBridgeTimeout||isNaN(t.restWsBridgeTimeout))throw new TypeError("The restWsBridgeTimeout option must be a number.");if(!(t.disabledEvents instanceof Array))throw new TypeError("The disabledEvents option must be an Array.")}}module.exports=Client}).call(exports,__webpack_require__(18))},function(t,e,n){const i=n(21),s=n(44),r=n(28),o=n(0),u=n(4);class c extends i{constructor(t,e,n){super(null,t,e),this.options=u.mergeDefault(o.DefaultOptions,n),this.rest=new s(this),this.resolver=new r(this),this._timeouts=new Set,this._intervals=new Set}setTimeout(t,e,...n){const i=setTimeout(()=>{t(),this._timeouts.delete(i)},e,...n);return this._timeouts.add(i),i}clearTimeout(t){clearTimeout(t),this._timeouts.delete(t)}setInterval(t,e,...n){const i=setInterval(t,e,...n);return this._intervals.add(i),i}clearInterval(t){clearInterval(t),this._intervals.delete(t)}destroy(){for(const t of this._timeouts)clearTimeout(t);for(const e of this._intervals)clearInterval(e);this._timeouts.clear(),this._intervals.clear()}}t.exports=c},function(t,e,n){function i(t){return"string"==typeof t?t:t instanceof Array?t.join("\n"):String(t)}const s=n(28);class r{constructor(t={}){this.title=t.title,this.description=t.description,this.url=t.url,this.color=t.color,this.author=t.author,this.timestamp=t.timestamp,this.fields=t.fields||[],this.thumbnail=t.thumbnail,this.image=t.image,this.footer=t.footer,this.file=t.file}setTitle(t){if(t=i(t),t.length>256)throw new RangeError("RichEmbed titles may not exceed 256 characters.");return this.title=t,this}setDescription(t){if(t=i(t),t.length>2048)throw new RangeError("RichEmbed descriptions may not exceed 2048 characters.");return this.description=t,this}setURL(t){return this.url=t,this}setColor(t){return this.color=s.resolveColor(t),this}setAuthor(t,e,n){return this.author={name:i(t),icon_url:e,url:n},this}setTimestamp(t=new Date){return this.timestamp=t,this}addField(t,e,n=false){if(this.fields.length>=25)throw new RangeError("RichEmbeds may not exceed 25 fields.");if(t=i(t),t.length>256)throw new RangeError("RichEmbed field names may not exceed 256 characters.");if(!/\S/.test(t))throw new RangeError("RichEmbed field names may not be empty.");if(e=i(e),e.length>1024)throw new RangeError("RichEmbed field values may not exceed 1024 characters.");if(!/\S/.test(e))throw new RangeError("RichEmbed field values may not be empty.");return this.fields.push({name:t,value:e,inline:n}),this}addBlankField(t=false){return this.addField("​","​",t)}setThumbnail(t){return this.thumbnail={url:t},this}setImage(t){return this.image={url:t},this}setFooter(t,e){if(t=i(t),t.length>2048)throw new RangeError("RichEmbed footer text may not exceed 2048 characters.");return this.footer={text:t,icon_url:e},this}attachFile(t){if(this.file)throw new RangeError("You may not upload more than one file at once.");return this.file=t,this}}t.exports=r},function(t,e){},function(t,e){},function(t,e){},function(t,e,n){"use strict";function i(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===t[e-2]?2:"="===t[e-1]?1:0}function s(t){return 3*t.length/4-i(t)}function r(t){var e,n,s,r,o,u,c=t.length;o=i(t),u=new l(3*c/4-o),s=o>0?c-4:c;var h=0;for(e=0,n=0;e>16&255,u[h++]=r>>8&255,u[h++]=255&r;return 2===o?(r=a[t.charCodeAt(e)]<<2|a[t.charCodeAt(e+1)]>>4,u[h++]=255&r):1===o&&(r=a[t.charCodeAt(e)]<<10|a[t.charCodeAt(e+1)]<<4|a[t.charCodeAt(e+2)]>>2,u[h++]=r>>8&255,u[h++]=255&r),u}function o(t){return h[t>>18&63]+h[t>>12&63]+h[t>>6&63]+h[63&t]}function u(t,e,n){for(var i,s=[],r=e;ra?a:c+o));return 1===i?(e=t[n-1],s+=h[e>>2],s+=h[e<<4&63],s+="=="):2===i&&(e=(t[n-2]<<8)+t[n-1],s+=h[e>>10],s+=h[e>>4&63],s+=h[e<<2&63],s+="="),r.push(s),r.join("")}e.byteLength=s,e.toByteArray=r,e.fromByteArray=c;for(var h=[],a=[],l="undefined"!=typeof Uint8Array?Uint8Array:Array,f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",d=0,p=f.length;d>1,a=-7,l=n?s-1:0,f=n?-1:1,d=t[e+l];for(l+=f,r=d&(1<<-a)-1,d>>=-a,a+=u;a>0;r=256*r+t[e+l],l+=f,a-=8);for(o=r&(1<<-a)-1,r>>=-a,a+=i;a>0;o=256*o+t[e+l],l+=f,a-=8);if(0===r)r=1-h;else{if(r===c)return o?NaN:(d?-1:1)*(1/0);o+=Math.pow(2,i),r-=h}return(d?-1:1)*o*Math.pow(2,r-i)},e.write=function(t,e,n,i,s,r){var o,u,c,h=8*r-s-1,a=(1<>1,f=23===s?Math.pow(2,-24)-Math.pow(2,-77):0,d=i?0:r-1,p=i?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(u=isNaN(e)?1:0,o=a):(o=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-o))<1&&(o--,c*=2),e+=o+l>=1?f/c:f*Math.pow(2,1-l),e*c>=2&&(o++,c/=2),o+l>=a?(u=0,o=a):o+l>=1?(u=(e*c-1)*Math.pow(2,s),o+=l):(u=e*Math.pow(2,l-1)*Math.pow(2,s),o=0));s>=8;t[n+d]=255&u,d+=p,u/=256,s-=8);for(o=o<0;t[n+d]=255&o,d+=p,o/=256,h-=8);t[n+d-p]|=128*m}},function(t,e){var n={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==n.call(t)}},function(t,e,n){"use strict";function i(t,e){return Object.prototype.hasOwnProperty.call(t,e)}t.exports=function(t,e,n,r){e=e||"&",n=n||"=";var o={};if("string"!=typeof t||0===t.length)return o;var u=/\+/g;t=t.split(e);var c=1e3;r&&"number"==typeof r.maxKeys&&(c=r.maxKeys);var h=t.length;c>0&&h>c&&(h=c);for(var a=0;a=0?(l=m.substr(0,g),f=m.substr(g+1)):(l=m,f=""),d=decodeURIComponent(l),p=decodeURIComponent(f),i(o,d)?s(o[d])?o[d].push(p):o[d]=[o[d],p]:o[d]=p}return o};var s=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)}},function(t,e,n){"use strict";function i(t,e){if(t.map)return t.map(e);for(var n=[],i=0;i=200&&t.status<300)},i.prototype.get=function(t){return this._header[t.toLowerCase()]},i.prototype.getHeader=i.prototype.get,i.prototype.set=function(t,e){if(r(t)){for(var n in t)this.set(n,t[n]);return this}return this._header[t.toLowerCase()]=e,this.header[t]=e,this},i.prototype.unset=function(t){return delete this._header[t.toLowerCase()],delete this.header[t],this},i.prototype.field=function(t,e){if(null===t||void 0===t)throw new Error(".field(name, val) name can not be empty");if(this._data&&console.error(".field() can't be used if .send() is used. Please use only .send() or only .field() & .attach()"),r(t)){for(var n in t)this.field(n,t[n]);return this}if(Array.isArray(e)){for(var i in e)this.field(t,e[i]);return this}if(null===e||void 0===e)throw new Error(".field(name, val) val can not be empty");return"boolean"==typeof e&&(e=""+e),this._getFormData().append(t,e),this},i.prototype.abort=function(){return this._aborted?this:(this._aborted=!0,this.xhr&&this.xhr.abort(),this.req&&this.req.abort(),this.clearTimeout(),this.emit("abort"),this)},i.prototype.withCredentials=function(){return this._withCredentials=!0,this},i.prototype.redirects=function(t){return this._maxRedirects=t,this},i.prototype.toJSON=function(){return{method:this.method,url:this.url,data:this._data,headers:this._header}},i.prototype.send=function(t){var e=r(t),n=this._header["content-type"];if(this._formData&&console.error(".send() can't be used if .attach() or .field() is used. Please use only .send() or only .field() & .attach()"),e&&!this._data)Array.isArray(t)?this._data=[]:this._isHost(t)||(this._data={});else if(t&&this._data&&this._isHost(this._data))throw Error("Can't merge these send calls");if(e&&r(this._data))for(var i in t)this._data[i]=t[i];else"string"==typeof t?(n||this.type("form"),n=this._header["content-type"],"application/x-www-form-urlencoded"==n?this._data=this._data?this._data+"&"+t:t:this._data=(this._data||"")+t):this._data=t;return!e||this._isHost(t)?this:(n||this.type("json"),this)},i.prototype.sortQuery=function(t){return this._sort="undefined"==typeof t||t,this},i.prototype._timeoutError=function(t,e){if(!this._aborted){var n=new Error(t+e+"ms exceeded");n.timeout=e,n.code="ECONNABORTED",this.timedout=!0,this.abort(),this.callback(n)}},i.prototype._setTimeouts=function(){var t=this;this._timeout&&!this._timer&&(this._timer=setTimeout(function(){t._timeoutError("Timeout of ",t._timeout)},this._timeout)),this._responseTimeout&&!this._responseTimeoutTimer&&(this._responseTimeoutTimer=setTimeout(function(){t._timeoutError("Response timeout of ",t._responseTimeout)},this._responseTimeout))}},function(t,e,n){function i(t){if(t)return s(t)}function s(t){for(var e in i.prototype)t[e]=i.prototype[e];return t}var r=n(63);t.exports=i,i.prototype.get=function(t){return this.header[t.toLowerCase()]},i.prototype._setHeaderProperties=function(t){var e=t["content-type"]||"";this.type=r.type(e);var n=r.params(e);for(var i in n)this[i]=n[i];this.links={};try{t.link&&(this.links=r.parseLinks(t.link))}catch(t){}},i.prototype._setStatusProperties=function(t){var e=t/100|0;this.status=this.statusCode=t,this.statusType=e,this.info=1==e,this.ok=2==e,this.redirect=3==e,this.clientError=4==e,this.serverError=5==e,this.error=(4==e||5==e)&&this.toError(),this.accepted=202==t,this.noContent=204==t,this.badRequest=400==t,this.unauthorized=401==t,this.notAcceptable=406==t,this.forbidden=403==t,this.notFound=404==t}},function(t,e){var n=["ECONNRESET","ETIMEDOUT","EADDRINFO","ESOCKETTIMEDOUT"];t.exports=function(t,e){return!!(t&&t.code&&~n.indexOf(t.code))||(!!(e&&e.status&&e.status>=500)||!!(t&&"timeout"in t&&"ECONNABORTED"==t.code))}},function(t,e){e.type=function(t){return t.split(/ *; */).shift()},e.params=function(t){return t.split(/ *; */).reduce(function(t,e){var n=e.split(/ *= */),i=n.shift(),s=n.shift();return i&&s&&(t[i]=s),t},{})},e.parseLinks=function(t){return t.split(/ *, */).reduce(function(t,e){var n=e.split(/ *; */),i=n[0].slice(1,-1),s=n[1].split(/ *= */)[1].slice(1,-1);return t[s]=i,t},{})},e.cleanHeader=function(t,e){return delete t["content-type"],delete t["content-length"],delete t["transfer-encoding"],delete t.host,e&&delete t.cookie,t}},function(t,e){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e,n){const i=n(0),s=n(4),r=n(16),o=n(11),u=n(31),c=n(12),h=n(41),a=n(42),l=n(17),f=n(19);class d{constructor(t){this.client=t}get pastReady(){return this.client.ws.status===i.Status.READY}newGuild(t){const e=this.client.guilds.has(t.id),n=new r(this.client,t);return this.client.guilds.set(n.id,n),this.pastReady&&!e&&(this.client.options.fetchAllMembers?n.fetchMembers().then(()=>{this.client.emit(i.Events.GUILD_CREATE,n)}):this.client.emit(i.Events.GUILD_CREATE,n)),n}newUser(t){if(this.client.users.has(t.id))return this.client.users.get(t.id);const e=new o(this.client,t);return this.client.users.set(e.id,e),e}newChannel(t,e){const n=this.client.channels.has(t.id);let s;return t.type===i.ChannelTypes.DM?s=new u(this.client,t):t.type===i.ChannelTypes.GROUP_DM?s=new f(this.client,t):(e=e||this.client.guilds.get(t.guild_id),e&&(t.type===i.ChannelTypes.TEXT?(s=new h(e,t),e.channels.set(s.id,s)):t.type===i.ChannelTypes.VOICE&&(s=new a(e,t),e.channels.set(s.id,s)))),s?(this.pastReady&&!n&&this.client.emit(i.Events.CHANNEL_CREATE,s),this.client.channels.set(s.id,s),s):null}newEmoji(t,e){const n=e.emojis.has(t.id);if(t&&!n){let n=new c(e,t);return this.client.emit(i.Events.GUILD_EMOJI_CREATE,n),e.emojis.set(n.id,n),n}return n?e.emojis.get(t.id):null}killEmoji(t){t instanceof c&&t.guild&&(this.client.emit(i.Events.GUILD_EMOJI_DELETE,t),t.guild.emojis.delete(t.id))}killGuild(t){const e=this.client.guilds.has(t.id);this.client.guilds.delete(t.id),e&&this.pastReady&&this.client.emit(i.Events.GUILD_DELETE,t)}killUser(t){this.client.users.delete(t.id)}killChannel(t){this.client.channels.delete(t.id),t instanceof l&&t.guild.channels.delete(t.id)}updateGuild(t,e){const n=s.cloneObject(t);t.setup(e),this.pastReady&&this.client.emit(i.Events.GUILD_UPDATE,n,t)}updateChannel(t,e){t.setup(e)}updateEmoji(t,e){const n=s.cloneObject(t);return t.setup(e),this.client.emit(i.Events.GUILD_EMOJI_UPDATE,n,t),t}}t.exports=d},function(t,e,n){const i=n(0);class s{constructor(t){this.client=t,this.heartbeatInterval=null}connectToWebSocket(t,e,n){this.client.emit(i.Events.DEBUG,`Authenticated using token ${t}`),this.client.token=t;const s=this.client.setTimeout(()=>n(new Error(i.Errors.TOOK_TOO_LONG)),3e5);this.client.rest.methods.getGateway().then(r=>{this.client.emit(i.Events.DEBUG,`Using gateway ${r}`),this.client.ws.connect(r),this.client.ws.once("close",t=>{4004===t.code&&n(new Error(i.Errors.BAD_LOGIN)),4010===t.code&&n(new Error(i.Errors.INVALID_SHARD)),4011===t.code&&n(new Error(i.Errors.SHARDING_REQUIRED))}),this.client.once(i.Events.READY,()=>{e(t),this.client.clearTimeout(s)})},n)}setupKeepAlive(t){this.heartbeatInterval=this.client.setInterval(()=>this.client.ws.heartbeat(!0),t)}destroy(){return this.client.ws.destroy(),this.client.user?this.client.user.bot?(this.client.token=null,Promise.resolve()):this.client.rest.methods.logout().then(()=>{this.client.token=null}):Promise.resolve()}}t.exports=s},function(t,e,n){class i{constructor(t){this.client=t,this.register(n(85)),this.register(n(86)),this.register(n(87)),this.register(n(91)),this.register(n(88)),this.register(n(89)),this.register(n(90)),this.register(n(68)),this.register(n(69)),this.register(n(70)),this.register(n(73)),this.register(n(84)),this.register(n(77)),this.register(n(78)),this.register(n(71)),this.register(n(79)),this.register(n(80)),this.register(n(81)),this.register(n(92)),this.register(n(94)),this.register(n(93)),this.register(n(83)),this.register(n(74)),this.register(n(75)),this.register(n(76)),this.register(n(82)),this.register(n(72))}register(t){this[t.name.replace(/Action$/,"")]=new t(this.client)}}t.exports=i},function(t,e,n){const i=n(2);class s extends i{handle(t){const e=this.client,n=e.dataManager.newChannel(t);return{channel:n}}}t.exports=s},function(t,e,n){const i=n(2);class s extends i{constructor(t){super(t),this.deleted=new Map}handle(t){const e=this.client;let n=e.channels.get(t.id);return n?(e.dataManager.killChannel(n),this.deleted.set(n.id,n),this.scheduleForDeletion(n.id)):n=this.deleted.get(t.id)||null,{channel:n}}scheduleForDeletion(t){this.client.setTimeout(()=>this.deleted.delete(t),this.client.options.restWsBridgeTimeout)}}t.exports=s},function(t,e,n){const i=n(2),s=n(0),r=n(4);class o extends i{handle(t){const e=this.client,n=e.channels.get(t.id);if(n){const i=r.cloneObject(n);return n.setup(t),e.emit(s.Events.CHANNEL_UPDATE,i,n),{old:i,updated:n}}return{old:null,updated:null}}}t.exports=o},function(t,e,n){const i=n(2),s=n(0);class r extends i{handle(t){const e=this.client,n=e.guilds.get(t.guild_id),i=e.dataManager.newUser(t.user);n&&i&&e.emit(s.Events.GUILD_BAN_REMOVE,n,i)}}t.exports=r},function(t,e,n){const i=n(2);class s extends i{handle(t){const e=this.client,n=e.guilds.get(t.guild_id);if(n)for(const i of t.channels){const t=n.channels.get(i.id);t&&(t.position=i.position)}return{guild:n}}}t.exports=s},function(t,e,n){const i=n(2),s=n(0);class r extends i{constructor(t){super(t),this.deleted=new Map}handle(t){const e=this.client;let n=e.guilds.get(t.id);if(n){for(const i of n.channels.values())"text"===i.type&&i.stopTyping(!0);if(n.available&&t.unavailable)return n.available=!1,e.emit(s.Events.GUILD_UNAVAILABLE,n),{guild:null};e.guilds.delete(n.id),this.deleted.set(n.id,n),this.scheduleForDeletion(n.id)}else n=this.deleted.get(t.id)||null;return{guild:n}}scheduleForDeletion(t){this.client.setTimeout(()=>this.deleted.delete(t),this.client.options.restWsBridgeTimeout)}}t.exports=r},function(t,e,n){const i=n(2);class s extends i{handle(t,e){const n=this.client,i=n.dataManager.newEmoji(e,t);return{emoji:i}}}t.exports=s},function(t,e,n){const i=n(2);class s extends i{handle(t){const e=this.client;return e.dataManager.killEmoji(t),{emoji:t}}}t.exports=s},function(t,e,n){const i=n(2);class s extends i{handle(t,e){const n=this.client.dataManager.updateEmoji(t,e);return{emoji:n}}}t.exports=s},function(t,e,n){const i=n(2);class s extends i{handle(t,e){const n=t._addMember(e,!1);return{member:n}}}t.exports=s},function(t,e,n){const i=n(2),s=n(0);class r extends i{constructor(t){super(t),this.deleted=new Map}handle(t){const e=this.client,n=e.guilds.get(t.guild_id);if(n){let i=n.members.get(t.user.id);return i?(n.memberCount--,n._removeMember(i),this.deleted.set(n.id+t.user.id,i),e.status===s.Status.READY&&e.emit(s.Events.GUILD_MEMBER_REMOVE,i),this.scheduleForDeletion(n.id,t.user.id)):i=this.deleted.get(n.id+t.user.id)||null,{guild:n,member:i}}return{guild:n,member:null}}scheduleForDeletion(t,e){this.client.setTimeout(()=>this.deleted.delete(t+e),this.client.options.restWsBridgeTimeout)}}t.exports=r},function(t,e,n){const i=n(2),s=n(0),r=n(10);class o extends i{handle(t){const e=this.client,n=e.guilds.get(t.guild_id);if(n){const i=n.roles.has(t.role.id),o=new r(n,t.role);return n.roles.set(o.id,o),i||e.emit(s.Events.GUILD_ROLE_CREATE,o),{role:o}}return{role:null}}}t.exports=o},function(t,e,n){const i=n(2),s=n(0);class r extends i{constructor(t){super(t),this.deleted=new Map}handle(t){const e=this.client,n=e.guilds.get(t.guild_id);if(n){let i=n.roles.get(t.role_id);return i?(n.roles.delete(t.role_id),this.deleted.set(n.id+t.role_id,i),this.scheduleForDeletion(n.id,t.role_id),e.emit(s.Events.GUILD_ROLE_DELETE,i)):i=this.deleted.get(n.id+t.role_id)||null,{role:i}}return{role:null}}scheduleForDeletion(t,e){this.client.setTimeout(()=>this.deleted.delete(t+e),this.client.options.restWsBridgeTimeout)}}t.exports=r},function(t,e,n){const i=n(2),s=n(0),r=n(4);class o extends i{handle(t){const e=this.client,n=e.guilds.get(t.guild_id);if(n){const i=t.role;let o=null;const u=n.roles.get(i.id);return u&&(o=r.cloneObject(u),u.setup(t.role),e.emit(s.Events.GUILD_ROLE_UPDATE,o,u)),{old:o,updated:u}}return{old:null,updated:null}}}t.exports=o},function(t,e,n){const i=n(2);class s extends i{handle(t){const e=this.client,n=e.guilds.get(t.guild_id);if(n)for(const i of t.roles){const t=n.roles.get(i.id);t&&(t.position=i.position)}return{guild:n}}}t.exports=s},function(t,e,n){const i=n(2);class s extends i{handle(t){const e=this.client,n=e.guilds.get(t.id);if(n){if(t.presences)for(const e of t.presences)n._setPresence(e.user.id,e);if(t.members)for(const i of t.members){const t=n.members.get(i.user.id);t?n._updateMember(t,i):n._addMember(i,!1)}"large"in t&&(n.large=t.large)}}}t.exports=s},function(t,e,n){const i=n(2),s=n(0),r=n(4);class o extends i{handle(t){const e=this.client,n=e.guilds.get(t.id);if(n){const i=r.cloneObject(n);return n.setup(t),e.emit(s.Events.GUILD_UPDATE,i,n),{old:i,updated:n}}return{old:null,updated:null}}}t.exports=o},function(t,e,n){const i=n(2),s=n(9);class r extends i{handle(t){const e=this.client,n=e.channels.get((t instanceof Array?t[0]:t).channel_id),i=e.users.get((t instanceof Array?t[0]:t).author.id);if(n){const r=n.guild?n.guild.member(i):null;if(t instanceof Array){const o=new Array(t.length);for(let u=0;uthis.deleted.delete(t+e),this.client.options.restWsBridgeTimeout)}}t.exports=s},function(t,e,n){const i=n(2),s=n(3),r=n(0);class o extends i{handle(t){const e=this.client,n=e.channels.get(t.channel_id),i=t.ids,o=new s;for(const u of i){const t=n.messages.get(u);t&&o.set(t.id,t)}return o.size>0&&e.emit(r.Events.MESSAGE_BULK_DELETE,o),{messages:o}}}t.exports=o},function(t,e,n){const i=n(2),s=n(0);class r extends i{handle(t){const e=this.client.users.get(t.user_id);if(!e)return!1;const n=this.client.channels.get(t.channel_id);if(!n||"voice"===n.type)return!1;const i=n.messages.get(t.message_id);if(!i)return!1;if(!t.emoji)return!1;const r=i._addReaction(t.emoji,e);return r&&this.client.emit(s.Events.MESSAGE_REACTION_ADD,r,e),{message:i,reaction:r,user:e}}}t.exports=r},function(t,e,n){const i=n(2),s=n(0);class r extends i{handle(t){const e=this.client.users.get(t.user_id);if(!e)return!1;const n=this.client.channels.get(t.channel_id);if(!n||"voice"===n.type)return!1;const i=n.messages.get(t.message_id);if(!i)return!1;if(!t.emoji)return!1;const r=i._removeReaction(t.emoji,e);return r&&this.client.emit(s.Events.MESSAGE_REACTION_REMOVE,r,e),{message:i,reaction:r,user:e}}}t.exports=r},function(t,e,n){const i=n(2),s=n(0);class r extends i{handle(t){const e=this.client.channels.get(t.channel_id);if(!e||"voice"===e.type)return!1;const n=e.messages.get(t.message_id);return!!n&&(n._clearReactions(),this.client.emit(s.Events.MESSAGE_REACTION_REMOVE_ALL,n),{message:n})}}t.exports=r},function(t,e,n){const i=n(2),s=n(0),r=n(9);class o extends i{handle(t){const e=this.client,n=e.channels.get(t.channel_id);if(n){const i=n.messages.get(t.id);if(i){const o=new r(i.channel,this.patchDataPacket(t,i),e);return o._edits.push(i,...i._edits),o.reactions=i.reactions,n.messages.set(t.id,o),e.emit(s.Events.MESSAGE_UPDATE,i,o),{old:i,updated:o}}return{old:i,updated:i}}return{old:null,updated:null}}patchDataPacket(t,e){return t.type="type"in t?t.type:s.MessageTypes.indexOf(e.type),t.tts="tts"in t?t.tts:e.tts,t.timestamp="timestamp"in t?t.timestamp:e.createdAt.toString(),t.pinned="pinned"in t?t.pinned:e.pinned,t.nonce="nonce"in t?t.nonce:e.nonce,t.mentions="mentions"in t?t.mentions:e.mentions.users.keyArray(),t.mentions_roles="mentions_roles"in t?t.mentions_roles:e.mentions.roles.keyArray(),t.mention_everyone="mention_everyone"in t?t.mention_everyone:e.mentions.everyone,t.embeds="embeds"in t?t.embeds:e.embeds,t.content="content"in t?t.content:e.content,t.author="author"in t?t.author:{username:e.author.username,id:e.author.id,discriminator:e.author.discriminator,avatar:e.author.avatar},t.attachments="attachments"in t?t.attachments:e.attachments.array(),t}}t.exports=o},function(t,e,n){const i=n(2);class s extends i{handle(t){const e=this.client,n=e.dataManager.newUser(t);return{user:n}}}t.exports=s},function(t,e,n){const i=n(2),s=n(0);class r extends i{handle(t){const e=this.client,n=e.user.notes.get(t.id),i=t.note.length?t.note:null;return e.user.notes.set(t.id,i),e.emit(s.Events.USER_NOTE_UPDATE,t.id,n,i),{old:n,updated:i}}}t.exports=r},function(t,e,n){const i=n(2),s=n(0),r=n(4);class o extends i{handle(t){const e=this.client;if(e.user){if(e.user.equals(t))return{old:e.user,updated:e.user};const n=r.cloneObject(e.user);return e.user.patch(t),e.emit(s.Events.USER_UPDATE,n,e.user),{old:n,updated:e.user}}return{old:null,updated:null}}}t.exports=o},function(t,e,n){const i=n(26),s=n(0);class r{constructor(t,e,n,i,s,r){this.rest=t,this.client=t.client,this.method=e,this.path=n.toString(),this.auth=i,this.data=s,this.files=r,this.route=this.getRoute(this.path)}getRoute(t){let e=t.split("?")[0];if(e.includes("/channels/")||e.includes("/guilds/")){const t=e.includes("/channels/")?e.indexOf("/channels/"):e.indexOf("/guilds/"),n=e.substring(t).split("/")[2];e=e.replace(/(\d{8,})/g,":id").replace(":id",n)}return e}getAuth(){if(this.client.token&&this.client.user&&this.client.user.bot)return`Bot ${this.client.token}`;if(this.client.token)return this.client.token;throw new Error(s.Errors.NO_TOKEN)}gen(){const t=`${this.client.options.http.host}/api/v${this.client.options.http.version}`,e=i[this.method](`${t}${this.path}`);if(this.auth&&e.set("authorization",this.getAuth()),this.files){for(const t of this.files)t&&t.file&&e.attach(t.name,t.file,t.name);this.data=this.data||{},e.field("payload_json",JSON.stringify(this.data))}else this.data&&e.send(this.data);return this.client.browser||e.set("User-Agent",this.rest.userAgentManager.userAgent),e}}t.exports=r},function(t,e,n){const i=n(58),s=n(24),r=n(6),o=n(0),u=o.Endpoints,c=n(3),h=n(5),a=n(4),l=n(11),f=n(13),d=n(9),p=n(10),m=n(32),g=n(21),E=n(137),_=n(37),v=n(8),y=n(19),w=n(16),b=n(138);class A{constructor(t){this.rest=t,this.client=t.client,this._ackToken=null}login(t=this.client.token){return new Promise((e,n)=>{if("string"!=typeof t)throw new Error(o.Errors.INVALID_TOKEN);t=t.replace(/^Bot\s*/i,""),this.client.manager.connectToWebSocket(t,e,n)})}logout(){return this.rest.makeRequest("post",u.logout,!0,{})}getGateway(){return this.rest.makeRequest("get",u.gateway,!0).then(t=>{return this.client.ws.gateway=`${t.url}/?v=${this.client.options.ws.version}`,this.client.ws.gateway})}getBotGateway(){return this.rest.makeRequest("get",u.gateway.bot,!0)}fetchVoiceRegions(t){let e;return e=t?u.Guild(t).voiceRegions:u.voiceRegions,this.rest.makeRequest("get",e,!0).then(t=>{const e=new c;for(const n of t)e.set(n.id,new b(n));return e})}sendMessage(t,e,{tts,nonce,embed,disableEveryone,split,code,reply}={},n=null){return new Promise((i,s)=>{if("undefined"!=typeof e&&(e=this.client.resolver.resolveString(e)),"undefined"!=typeof nonce&&(nonce=parseInt(nonce),isNaN(nonce)||nonce<0))throw new RangeError("Message nonce must fit in an unsigned 64-bit integer.");if(e){if(split&&"object"!=typeof split&&(split={}),"undefined"==typeof code||"boolean"==typeof code&&code!==!0||(e=a.escapeMarkdown(this.client.resolver.resolveString(e),!0),e=`\`\`\`${"boolean"!=typeof code?code||"":""} +var Q=i(51),Z=i(52),X=i(53);e.Buffer=r,e.SlowBuffer=g,e.INSPECT_MAX_BYTES=50,r.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:n(),e.kMaxLength=s(),r.poolSize=8192,r._augment=function(t){return t.__proto__=r.prototype,t},r.from=function(t,e,i){return a(null,t,e,i)},r.TYPED_ARRAY_SUPPORT&&(r.prototype.__proto__=Uint8Array.prototype,r.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&r[Symbol.species]===r&&Object.defineProperty(r,Symbol.species,{value:null,configurable:!0})),r.alloc=function(t,e,i){return l(null,t,e,i)},r.allocUnsafe=function(t){return u(null,t)},r.allocUnsafeSlow=function(t){return u(null,t)},r.isBuffer=function(t){return!(null==t||!t._isBuffer)},r.compare=function(t,e){if(!r.isBuffer(t)||!r.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var i=t.length,n=e.length,s=0,o=Math.min(i,n);s0&&(t=this.toString("hex",0,i).match(/.{2}/g).join(" "),this.length>i&&(t+=" ... ")),""},r.prototype.compare=function(t,e,i,n,s){if(!r.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===i&&(i=t?t.length:0),void 0===n&&(n=0),void 0===s&&(s=this.length),e<0||i>t.length||n<0||s>this.length)throw new RangeError("out of range index");if(n>=s&&e>=i)return 0;if(n>=s)return-1;if(e>=i)return 1;if(e>>>=0,i>>>=0,n>>>=0,s>>>=0,this===t)return 0;for(var o=s-n,a=i-e,c=Math.min(o,a),l=this.slice(n,s),u=t.slice(e,i),h=0;hs)&&(i=s),t.length>0&&(i<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return _(this,t,e,i);case"utf8":case"utf-8":return y(this,t,e,i);case"ascii":return A(this,t,e,i);case"latin1":case"binary":return k(this,t,e,i);case"base64":return R(this,t,e,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,t,e,i);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},r.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var tt=4096;r.prototype.slice=function(t,e){var i=this.length;t=~~t,e=void 0===e?i:~~e,t<0?(t+=i,t<0&&(t=0)):t>i&&(t=i),e<0?(e+=i,e<0&&(e=0)):e>i&&(e=i),e0&&(s*=256);)n+=this[t+--e]*s;return n},r.prototype.readUInt8=function(t,e){return e||N(t,1,this.length),this[t]},r.prototype.readUInt16LE=function(t,e){return e||N(t,2,this.length),this[t]|this[t+1]<<8},r.prototype.readUInt16BE=function(t,e){return e||N(t,2,this.length),this[t]<<8|this[t+1]},r.prototype.readUInt32LE=function(t,e){return e||N(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},r.prototype.readUInt32BE=function(t,e){return e||N(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},r.prototype.readIntLE=function(t,e,i){t|=0,e|=0,i||N(t,e,this.length);for(var n=this[t],s=1,o=0;++o=s&&(n-=Math.pow(2,8*e)),n},r.prototype.readIntBE=function(t,e,i){t|=0,e|=0,i||N(t,e,this.length);for(var n=e,s=1,o=this[t+--n];n>0&&(s*=256);)o+=this[t+--n]*s;return s*=128,o>=s&&(o-=Math.pow(2,8*e)),o},r.prototype.readInt8=function(t,e){return e||N(t,1,this.length),128&this[t]?(255-this[t]+1)*-1:this[t]},r.prototype.readInt16LE=function(t,e){e||N(t,2,this.length);var i=this[t]|this[t+1]<<8;return 32768&i?4294901760|i:i},r.prototype.readInt16BE=function(t,e){e||N(t,2,this.length);var i=this[t+1]|this[t]<<8;return 32768&i?4294901760|i:i},r.prototype.readInt32LE=function(t,e){return e||N(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},r.prototype.readInt32BE=function(t,e){return e||N(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},r.prototype.readFloatLE=function(t,e){return e||N(t,4,this.length),Z.read(this,t,!0,23,4)},r.prototype.readFloatBE=function(t,e){return e||N(t,4,this.length),Z.read(this,t,!1,23,4)},r.prototype.readDoubleLE=function(t,e){return e||N(t,8,this.length),Z.read(this,t,!0,52,8)},r.prototype.readDoubleBE=function(t,e){return e||N(t,8,this.length),Z.read(this,t,!1,52,8)},r.prototype.writeUIntLE=function(t,e,i,n){if(t=+t,e|=0,i|=0,!n){var s=Math.pow(2,8*i)-1;O(this,t,e,i,s,0)}var o=1,r=0;for(this[e]=255&t;++r=0&&(r*=256);)this[e+o]=t/r&255;return e+i},r.prototype.writeUInt8=function(t,e,i){return t=+t,e|=0,i||O(this,t,e,1,255,0),r.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},r.prototype.writeUInt16LE=function(t,e,i){return t=+t,e|=0,i||O(this,t,e,2,65535,0),r.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):P(this,t,e,!0),e+2},r.prototype.writeUInt16BE=function(t,e,i){return t=+t,e|=0,i||O(this,t,e,2,65535,0),r.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):P(this,t,e,!1),e+2},r.prototype.writeUInt32LE=function(t,e,i){return t=+t,e|=0,i||O(this,t,e,4,4294967295,0),r.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):G(this,t,e,!0),e+4},r.prototype.writeUInt32BE=function(t,e,i){return t=+t,e|=0,i||O(this,t,e,4,4294967295,0),r.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):G(this,t,e,!1),e+4},r.prototype.writeIntLE=function(t,e,i,n){if(t=+t,e|=0,!n){var s=Math.pow(2,8*i-1);O(this,t,e,i,s-1,-s)}var o=0,r=1,a=0;for(this[e]=255&t;++o>0)-a&255;return e+i},r.prototype.writeIntBE=function(t,e,i,n){if(t=+t,e|=0,!n){var s=Math.pow(2,8*i-1);O(this,t,e,i,s-1,-s)}var o=i-1,r=1,a=0;for(this[e+o]=255&t;--o>=0&&(r*=256);)t<0&&0===a&&0!==this[e+o+1]&&(a=1),this[e+o]=(t/r>>0)-a&255;return e+i},r.prototype.writeInt8=function(t,e,i){return t=+t,e|=0,i||O(this,t,e,1,127,-128),r.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},r.prototype.writeInt16LE=function(t,e,i){return t=+t,e|=0,i||O(this,t,e,2,32767,-32768),r.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):P(this,t,e,!0),e+2},r.prototype.writeInt16BE=function(t,e,i){return t=+t,e|=0,i||O(this,t,e,2,32767,-32768),r.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):P(this,t,e,!1),e+2},r.prototype.writeInt32LE=function(t,e,i){return t=+t,e|=0,i||O(this,t,e,4,2147483647,-2147483648),r.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):G(this,t,e,!0),e+4},r.prototype.writeInt32BE=function(t,e,i){return t=+t,e|=0,i||O(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),r.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):G(this,t,e,!1),e+4},r.prototype.writeFloatLE=function(t,e,i){return q(this,t,e,!0,i)},r.prototype.writeFloatBE=function(t,e,i){return q(this,t,e,!1,i)},r.prototype.writeDoubleLE=function(t,e,i){return B(this,t,e,!0,i)},r.prototype.writeDoubleBE=function(t,e,i){return B(this,t,e,!1,i)},r.prototype.copy=function(t,e,i,n){if(i||(i=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e=0;--s)t[s+e]=this[s+i];else if(o<1e3||!r.TYPED_ARRAY_SUPPORT)for(s=0;s>>=0,i=void 0===i?this.length:i>>>0,t||(t=0);var o;if("number"==typeof t)for(o=e;othis.client.resolver.resolveBuffer(t.attachment).then(e=>{return t.file=e,t}))).then(i=>this.client.rest.methods.sendMessage(this,t,e,i))}return this.client.rest.methods.sendMessage(this,t,e)}sendMessage(t,e){return this.send(t,e)}sendEmbed(t,e,i){return i||"object"!=typeof e||e instanceof Array?i||(i={}):(i=e,e=""),this.send(e,Object.assign(i,{embed:t}))}sendFiles(t,e,i={}){return this.send(e,Object.assign(i,{files:t}))}sendFile(t,e,i,n={}){return this.sendFiles([{attachment:t,name:e}],i,n)}sendCode(t,e,i={}){return this.send(e,Object.assign(i,{code:t}))}fetchMessage(t){return this.client.user.bot?this.client.rest.methods.getChannelMessage(this,t).then(t=>{const e=t instanceof s?t:new s(this,t,this.client);return this._cacheMessage(e),e}):this.fetchMessages({limit:1,around:t}).then(e=>{const i=e.first();if(i.id!==t)throw new Error("Message not found.");return i})}fetchMessages(t={}){return this.client.rest.methods.getChannelMessages(this,t).then(t=>{const e=new r;for(const i of t){const t=new s(this,i,this.client);e.set(i.id,t),this._cacheMessage(t)}return e})}fetchPinnedMessages(){return this.client.rest.methods.getChannelPinnedMessages(this).then(t=>{const e=new r;for(const i of t){const t=new s(this,i,this.client);e.set(i.id,t),this._cacheMessage(t)}return e})}search(t){return this.client.rest.methods.search(this,t)}startTyping(t){if("undefined"!=typeof t&&t<1)throw new RangeError("Count must be at least 1.");if(this.client.user._typing.has(this.id)){const e=this.client.user._typing.get(this.id);e.count=t||e.count+1}else this.client.user._typing.set(this.id,{count:t||1,interval:this.client.setInterval(()=>{this.client.rest.methods.sendTyping(this.id)},9e3)}),this.client.rest.methods.sendTyping(this.id)}stopTyping(t=false){if(this.client.user._typing.has(this.id)){const e=this.client.user._typing.get(this.id);e.count--,(e.count<=0||t)&&(this.client.clearInterval(e.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}createCollector(t,e={}){return new o(this,t,e)}awaitMessages(t,e={}){return new Promise((i,n)=>{const s=this.createCollector(t,e);s.on("end",(t,s)=>{e.errors&&e.errors.includes(s)?n(t):i(t)})})}bulkDelete(t,e=false){if(!isNaN(t))return this.fetchMessages({limit:t}).then(t=>this.bulkDelete(t,e));if(t instanceof Array||t instanceof r){const i=t instanceof r?t.keyArray():t.map(t=>t.id);return this.client.rest.methods.bulkDeleteMessages(this,i,e)}throw new TypeError("The messages must be an Array, Collection, or number.")}acknowledge(){return this.client.rest.methods.ackTextMessage(this)}_cacheMessage(t){const e=this.client.options.messageCacheMaxSize;return 0===e?null:(this.messages.size>=e&&e>0&&this.messages.delete(this.messages.firstKey()),this.messages.set(t.id,t),t)}}e.applyToClass=((t,e=false,i=[])=>{const n=["send","sendMessage","sendEmbed","sendFile","sendFiles","sendCode"];e&&n.push("_cacheMessage","fetchMessages","fetchMessage","search","bulkDelete","startTyping","stopTyping","typing","typingCount","fetchPinnedMessages","createCollector","awaitMessages");for(const s of n)i.includes(s)||Object.defineProperty(t.prototype,s,Object.getOwnPropertyDescriptor(a.prototype,s))})},function(t,e){e.endianness=function(){return"LE"},e.hostname=function(){return"undefined"!=typeof location?location.hostname:""},e.loadavg=function(){return[]},e.uptime=function(){return 0},e.freemem=function(){return Number.MAX_VALUE},e.totalmem=function(){return Number.MAX_VALUE},e.cpus=function(){return[]},e.type=function(){return"Browser"},e.release=function(){return"undefined"!=typeof navigator?navigator.appVersion:""},e.networkInterfaces=e.getNetworkInterfaces=function(){return{}},e.arch=function(){return"javascript"},e.platform=function(){return"browser"},e.tmpdir=e.tmpDir=function(){return"/tmp"},e.EOL="\n"},function(t,e,i){const n=i(25),s=i(11),o=i(10),r=i(12),a=i(7).Presence,c=i(13),l=i(0),u=i(3),h=i(4),p=i(5);class d{constructor(t,e){Object.defineProperty(this,"client",{value:t}),this.members=new u,this.channels=new u,this.roles=new u,this.presences=new u,e&&(e.unavailable?(this.available=!1,this.id=e.id):(this.available=!0,this.setup(e)))}setup(t){this.name=t.name,this.icon=t.icon,this.splash=t.splash,this.region=t.region,this.memberCount=t.member_count||this.memberCount,this.large=Boolean("large"in t?t.large:this.large),this.features=t.features,this.applicationID=t.application_id,this.emojis=new u;for(const e of t.emojis)this.emojis.set(e.id,new r(this,e));if(this.afkTimeout=t.afk_timeout,this.afkChannelID=t.afk_channel_id,this.embedEnabled=t.embed_enabled,this.verificationLevel=t.verification_level,this.joinedTimestamp=t.joined_at?new Date(t.joined_at).getTime():this.joinedTimestamp,this.id=t.id,this.available=!t.unavailable,this.features=t.features||this.features||[],t.members){this.members.clear();for(const e of t.members)this._addMember(e,!1)}if(t.owner_id&&(this.ownerID=t.owner_id),t.channels){this.channels.clear();for(const e of t.channels)this.client.dataManager.newChannel(e,this)}if(t.roles){this.roles.clear();for(const e of t.roles){const t=new o(this,e);this.roles.set(t.id,t)}}if(t.presences)for(const i of t.presences)this._setPresence(i.user.id,i);if(this._rawVoiceStates=new u,t.voice_states)for(const n of t.voice_states){this._rawVoiceStates.set(n.user_id,n);const t=this.members.get(n.user_id);t&&(t.serverMute=n.mute,t.serverDeaf=n.deaf,t.selfMute=n.self_mute,t.selfDeaf=n.self_deaf,t.voiceSessionID=n.session_id,t.voiceChannelID=n.channel_id,this.channels.get(n.channel_id).members.set(t.user.id,t))}}get createdTimestamp(){return p.deconstruct(this.id).timestamp}get createdAt(){return new Date(this.createdTimestamp)}get joinedAt(){return new Date(this.joinedTimestamp)}get iconURL(){return this.icon?l.Endpoints.Guild(this).Icon(this.client.options.http.cdn,this.icon):null}get splashURL(){return this.splash?l.Endpoints.Guild(this).Splash(this.client.options.http.cdn,this.splash):null}get owner(){return this.members.get(this.ownerID)}get voiceConnection(){return this.client.browser?null:this.client.voice.connections.get(this.id)||null}get defaultChannel(){return this.channels.get(this.id)}get defaultRole(){return this.roles.get(this.id)}get _sortedRoles(){return this._sortPositionWithID(this.roles)}member(t){return this.client.resolver.resolveGuildMember(this,t)}fetchBans(){return this.client.rest.methods.getGuildBans(this)}fetchInvites(){return this.client.rest.methods.getGuildInvites(this)}fetchWebhooks(){return this.client.rest.methods.getGuildWebhooks(this)}fetchVoiceRegions(){return this.client.rest.methods.fetchVoiceRegions(this.id)}addMember(t,e){return this.members.has(t.id)?Promise.resolve(this.members.get(t.id)):this.client.rest.methods.putGuildMember(this,t,e)}fetchMember(t,e=true){return t=this.client.resolver.resolveUser(t),t?this.members.has(t.id)?Promise.resolve(this.members.get(t.id)):this.client.rest.methods.getGuildMember(this,t,e):Promise.reject(new Error("User is not cached. Use Client.fetchUser first."))}fetchMembers(t="",e=0){return new Promise((i,n)=>{if(this.memberCount===this.members.size)return void i(this);this.client.ws.send({op:l.OPCodes.REQUEST_GUILD_MEMBERS,d:{guild_id:this.id,query:t,limit:e}});const s=(t,e)=>{e.id===this.id&&(this.memberCount===this.members.size||t.length<1e3)&&(this.client.removeListener(l.Events.GUILD_MEMBERS_CHUNK,s),i(this))};this.client.on(l.Events.GUILD_MEMBERS_CHUNK,s),this.client.setTimeout(()=>n(new Error("Members didn't arrive in time.")),12e4)})}search(t){return this.client.rest.methods.search(this,t)}edit(t){return this.client.rest.methods.updateGuild(this,t)}setName(t){return this.edit({name:t})}setRegion(t){return this.edit({region:t})}setVerificationLevel(t){return this.edit({verificationLevel:t})}setAFKChannel(t){return this.edit({afkChannel:t})}setAFKTimeout(t){return this.edit({afkTimeout:t})}setIcon(t){return this.edit({icon:t})}setOwner(t){return this.edit({owner:t})}setSplash(t){return this.edit({splash:t})}ban(t,e=0){return this.client.rest.methods.banGuildMember(this,t,e)}unban(t){return this.client.rest.methods.unbanGuildMember(this,t)}pruneMembers(t,e=false){if("number"!=typeof t)throw new TypeError("Days must be a number.");return this.client.rest.methods.pruneGuildMembers(this,t,e)}sync(){this.client.user.bot||this.client.syncGuilds([this])}createChannel(t,e,i){return this.client.rest.methods.createChannel(this,t,e,i)}setChannelPositions(t){return this.client.rest.methods.updateChannelPositions(this.id,t)}createRole(t={}){return this.client.rest.methods.createGuildRole(this,t)}createEmoji(t,e,i){return new Promise(n=>{"string"==typeof t&&t.startsWith("data:")?n(this.client.rest.methods.createEmoji(this,t,e,i)):this.client.resolver.resolveBuffer(t).then(t=>{const s=this.client.resolver.resolveBase64(t);n(this.client.rest.methods.createEmoji(this,s,e,i))})})}deleteEmoji(t){return t instanceof r||(t=this.emojis.get(t)),this.client.rest.methods.deleteEmoji(t)}leave(){return this.client.rest.methods.leaveGuild(this)}delete(){return this.client.rest.methods.deleteGuild(this)}acknowledge(){return this.client.rest.methods.ackGuild(this)}equals(t){let e=t&&this.id===t.id&&this.available===!t.unavailable&&this.splash===t.splash&&this.region===t.region&&this.name===t.name&&this.memberCount===t.member_count&&this.large===t.large&&this.icon===t.icon&&h.arraysEqual(this.features,t.features)&&this.ownerID===t.owner_id&&this.verificationLevel===t.verification_level&&this.embedEnabled===t.embed_enabled;return e&&(this.embedChannel?this.embedChannel.id!==t.embed_channel_id&&(e=!1):t.embed_channel_id&&(e=!1)),e}toString(){return this.name}_addMember(t,e=true){const i=this.members.has(t.user.id);t.user instanceof s||(t.user=this.client.dataManager.newUser(t.user)),t.joined_at=t.joined_at||0;const n=new c(this,t);if(this.members.set(n.id,n),this._rawVoiceStates&&this._rawVoiceStates.has(n.user.id)){const t=this._rawVoiceStates.get(n.user.id);n.serverMute=t.mute,n.serverDeaf=t.deaf,n.selfMute=t.self_mute,n.selfDeaf=t.self_deaf,n.voiceSessionID=t.session_id,n.voiceChannelID=t.channel_id,this.client.channels.has(t.channel_id)?this.client.channels.get(t.channel_id).members.set(n.user.id,n):this.client.emit("warn",`Member ${n.id} added in guild ${this.id} with an uncached voice channel`)}return this.client.ws.status===l.Status.READY&&e&&!i&&this.client.emit(l.Events.GUILD_MEMBER_ADD,n),n}_updateMember(t,e){const i=h.cloneObject(t);e.roles&&(t._roles=e.roles),"undefined"!=typeof e.nick&&(t.nickname=e.nick);const n=t.nickname!==i.nickname||!h.arraysEqual(t._roles,i._roles);return this.client.ws.status===l.Status.READY&&n&&this.client.emit(l.Events.GUILD_MEMBER_UPDATE,i,t),{old:i,mem:t}}_removeMember(t){this.members.delete(t.id)}_memberSpeakUpdate(t,e){const i=this.members.get(t);i&&i.speaking!==e&&(i.speaking=e,this.client.emit(l.Events.GUILD_MEMBER_SPEAKING,i,e))}_setPresence(t,e){return this.presences.get(t)?void this.presences.get(t).update(e):void this.presences.set(t,new a(e))}setRolePosition(t,e,i=false){if("string"==typeof t&&(t=this.roles.get(t),!t))return Promise.reject(new Error("Supplied role is not a role or snowflake."));if(e=Number(e),isNaN(e))return Promise.reject(new Error("Supplied position is not a number."));let n=this._sortedRoles().array();return h.moveElementInArray(n,t,e,i),n=n.map((t,e)=>({id:t.id,position:e})),this.client.rest.methods.setRolePositions(this.id,n)}setChannelPosition(t,e,i=false){if("string"==typeof t&&(t=this.channels.get(t),!t))return Promise.reject(new Error("Supplied channel is not a channel or snowflake."));if(e=Number(e),isNaN(e))return Promise.reject(new Error("Supplied position is not a number."));let n=this._sortedChannels(t.type).array();return h.moveElementInArray(n,t,e,i),n=n.map((t,e)=>({id:t.id,position:e})),this.client.rest.methods.setChannelPositions(this.id,n)}_sortedChannels(t){return this._sortPositionWithID(this.channels.filter(e=>{return"voice"===t&&"voice"===e.type||("voice"!==t&&"voice"!==e.type||t===e.type)}))}_sortPositionWithID(t){return t.sort((t,e)=>t.position!==e.position?t.position-e.position:n.fromString(t.id).sub(n.fromString(e.id)).toNumber())}}t.exports=d},function(t,e,i){const n=i(8),s=i(10),o=i(39),r=i(6),a=i(3);class c extends n{constructor(t,e){super(t.client,e),this.guild=t}setup(t){if(super.setup(t),this.name=t.name,this.position=t.position,this.permissionOverwrites=new a,t.permission_overwrites)for(const e of t.permission_overwrites)this.permissionOverwrites.set(e.id,new o(this,e))}get calculatedPosition(){const t=this.guild._sortedChannels(this.type);return t.array().indexOf(t.get(this.id))}permissionsFor(t){if(t=this.client.resolver.resolveGuildMember(this.guild,t),!t)return null;if(t.id===this.guild.ownerID)return new r(t,r.ALL);let e=0;const i=t.roles;for(const n of i.values())e|=n.permissions;const s=this.overwritesFor(t,!0,i);s.everyone&&(e&=~s.everyone.deny,e|=s.everyone.allow);let o=0;for(const a of s.roles)e&=~a.deny,o|=a.allow;e|=o,s.member&&(e&=~s.member.deny,e|=s.member.allow);const c=Boolean(e&r.FLAGS.ADMINISTRATOR);return c&&(e=r.ALL),new r(t,e)}overwritesFor(t,e=false,i=null){if(e||(t=this.client.resolver.resolveGuildMember(this.guild,t)),!t)return[];i=i||t.roles;const n=[];let s,o;for(const r of this.permissionOverwrites.values())r.id===this.guild.id?o=r:i.has(r.id)?n.push(r):r.id===t.id&&(s=r);return{everyone:o,roles:n,member:s}}overwritePermissions(t,e){const i={allow:0,deny:0};if(t instanceof s)i.type="role";else if(this.guild.roles.has(t))t=this.guild.roles.get(t),i.type="role";else if(t=this.client.resolver.resolveUser(t),i.type="member",!t)return Promise.reject(new TypeError("Supplied parameter was neither a User nor a Role."));i.id=t.id;const n=this.permissionOverwrites.get(t.id);n&&(i.allow=n.allow,i.deny=n.deny);for(const o in e)e[o]===!0?(i.allow|=r.FLAGS[o]||0,i.deny&=~(r.FLAGS[o]||0)):e[o]===!1?(i.allow&=~(r.FLAGS[o]||0),i.deny|=r.FLAGS[o]||0):null===e[o]&&(i.allow&=~(r.FLAGS[o]||0),i.deny&=~(r.FLAGS[o]||0));return this.client.rest.methods.setChannelOverwrite(this,i)}edit(t){return this.client.rest.methods.updateChannel(this,t)}setName(t){return this.edit({name:t})}setPosition(t,e){return this.guild.setChannelPosition(this,t,e).then(()=>this)}setTopic(t){return this.client.rest.methods.updateChannel(this,{topic:t})}createInvite(t={}){return this.client.rest.methods.createChannelInvite(this,t)}clone(t=this.name,e=true,i=true){return this.guild.createChannel(t,this.type,e?this.permissionOverwrites:[]).then(t=>i?t.setTopic(this.topic):t)}equals(t){let e=t&&this.id===t.id&&this.type===t.type&&this.topic===t.topic&&this.position===t.position&&this.name===t.name;return e&&(e=this.permissionOverwrites&&t.permissionOverwrites?this.permissionOverwrites.equals(t.permissionOverwrites):!this.permissionOverwrites&&!t.permissionOverwrites),e}get deletable(){return this.id!==this.guild.id&&this.permissionsFor(this.client.user).hasPermission(r.FLAGS.MANAGE_CHANNELS)}toString(){return`<#${this.id}>`}}t.exports=c},function(t,e,i){(function(t){function i(t,e){for(var i=0,n=t.length-1;n>=0;n--){var s=t[n];"."===s?t.splice(n,1):".."===s?(t.splice(n,1),i++):i&&(t.splice(n,1),i--)}if(e)for(;i--;i)t.unshift("..");return t}function n(t,e){if(t.filter)return t.filter(e);for(var i=[],n=0;n=-1&&!s;o--){var r=o>=0?arguments[o]:t.cwd();if("string"!=typeof r)throw new TypeError("Arguments to path.resolve must be strings");r&&(e=r+"/"+e,s="/"===r.charAt(0))}return e=i(n(e.split("/"),function(t){return!!t}),!s).join("/"),(s?"/":"")+e||"."},e.normalize=function(t){var s=e.isAbsolute(t),o="/"===r(t,-1);return t=i(n(t.split("/"),function(t){return!!t}),!s).join("/"),t||s||(t="."),t&&o&&(t+="/"),(s?"/":"")+t},e.isAbsolute=function(t){return"/"===t.charAt(0)},e.join=function(){var t=Array.prototype.slice.call(arguments,0);return e.normalize(n(t,function(t,e){if("string"!=typeof t)throw new TypeError("Arguments to path.join must be strings");return t}).join("/"))},e.relative=function(t,i){function n(t){for(var e=0;e=0&&""===t[i];i--);return e>i?[]:t.slice(e,i-e+1)}t=e.resolve(t).substr(1),i=e.resolve(i).substr(1);for(var s=n(t.split("/")),o=n(i.split("/")),r=Math.min(s.length,o.length),a=r,c=0;c1)for(var i=1;i[t.id,t.nick]))),this.recipients||(this.recipients=new o),t.recipients)for(const e of t.recipients){const t=this.client.dataManager.newUser(e);this.recipients.set(t.id,t)}this.lastMessageID=t.last_message_id}get owner(){return this.client.users.get(this.ownerID)}equals(t){const e=t&&this.id===t.id&&this.name===t.name&&this.icon===t.icon&&this.ownerID===t.ownerID;return e?this.recipients.equals(t.recipients):e}addUser(t,e){return this.client.rest.methods.addUserToGroupDM(this,{nick:e,id:this.client.resolver.resolveUserID(t),accessToken:t})}toString(){return this.name}send(){}sendMessage(){}sendEmbed(){}sendFile(){}sendFiles(){}sendCode(){}fetchMessage(){}fetchMessages(){}fetchPinnedMessages(){}search(){}startTyping(){}stopTyping(){}get typing(){}get typingCount(){}createCollector(){}awaitMessages(){}acknowledge(){}_cacheMessage(){}}s.applyToClass(r,!0,["bulkDelete"]),t.exports=r},function(t,e){class i{constructor(t,e,i){this.reaction=t,this.name=e,this.id=i}get identifier(){return this.id?`${this.name}:${this.id}`:encodeURIComponent(this.name)}toString(){return this.id?`<:${this.name}:${this.id}>`:this.name}}t.exports=i},function(t,e,i){const n=i(19);class s{constructor(t,e,i){t?(Object.defineProperty(this,"client",{value:t}),e&&this.setup(e)):(this.id=e,this.token=i,Object.defineProperty(this,"client",{value:this}))}setup(t){this.name=t.name,this.token=t.token,this.avatar=t.avatar, +this.id=t.id,this.guildID=t.guild_id,this.channelID=t.channel_id,t.user?this.owner=this.client.users?this.client.users.get(t.user.id):t.user:this.owner=null}send(t,e){return e||"object"!=typeof t||t instanceof Array?e||(e={}):(e=t,t=""),e.file?("string"==typeof e.file&&(e.file={attachment:e.file}),e.file.name||("string"==typeof e.file.attachment?e.file.name=n.basename(e.file.attachment):e.file.attachment&&e.file.attachment.path?e.file.name=n.basename(e.file.attachment.path):e.file.name="file.jpg"),this.client.resolver.resolveBuffer(e.file.attachment).then(i=>this.client.rest.methods.sendWebhookMessage(this,t,e,{file:i,name:e.file.name}))):this.client.rest.methods.sendWebhookMessage(this,t,e)}sendMessage(t,e={}){return this.send(t,e)}sendFile(t,e,i,n={}){return this.send(i,Object.assign(n,{file:{attachment:t,name:e}}))}sendCode(t,e,i={}){return this.send(e,Object.assign(i,{code:t}))}sendSlackMessage(t){return this.client.rest.methods.sendSlackWebhookMessage(this,t)}edit(t=this.name,e){return e?this.client.resolver.resolveBuffer(e).then(e=>{const i=this.client.resolver.resolveBase64(e);return this.client.rest.methods.editWebhook(this,t,i)}):this.client.rest.methods.editWebhook(this,t).then(t=>{return this.setup(t),this})}delete(){return this.client.rest.methods.deleteWebhook(this)}}t.exports=s},function(t,e){function i(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function n(t){return"function"==typeof t}function s(t){return"number"==typeof t}function o(t){return"object"==typeof t&&null!==t}function r(t){return void 0===t}t.exports=i,i.EventEmitter=i,i.prototype._events=void 0,i.prototype._maxListeners=void 0,i.defaultMaxListeners=10,i.prototype.setMaxListeners=function(t){if(!s(t)||t<0||isNaN(t))throw TypeError("n must be a positive number");return this._maxListeners=t,this},i.prototype.emit=function(t){var e,i,s,a,c,l;if(this._events||(this._events={}),"error"===t&&(!this._events.error||o(this._events.error)&&!this._events.error.length)){if(e=arguments[1],e instanceof Error)throw e;var u=new Error('Uncaught, unspecified "error" event. ('+e+")");throw u.context=e,u}if(i=this._events[t],r(i))return!1;if(n(i))switch(arguments.length){case 1:i.call(this);break;case 2:i.call(this,arguments[1]);break;case 3:i.call(this,arguments[1],arguments[2]);break;default:a=Array.prototype.slice.call(arguments,1),i.apply(this,a)}else if(o(i))for(a=Array.prototype.slice.call(arguments,1),l=i.slice(),s=l.length,c=0;c0&&this._events[t].length>s&&(this._events[t].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[t].length),"function"==typeof console.trace&&console.trace())),this},i.prototype.on=i.prototype.addListener,i.prototype.once=function(t,e){function i(){this.removeListener(t,i),s||(s=!0,e.apply(this,arguments))}if(!n(e))throw TypeError("listener must be a function");var s=!1;return i.listener=e,this.on(t,i),this},i.prototype.removeListener=function(t,e){var i,s,r,a;if(!n(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(i=this._events[t],r=i.length,s=-1,i===e||n(i.listener)&&i.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(o(i)){for(a=r;a-- >0;)if(i[a]===e||i[a].listener&&i[a].listener===e){s=a;break}if(s<0)return this;1===i.length?(i.length=0,delete this._events[t]):i.splice(s,1),this._events.removeListener&&this.emit("removeListener",t,e)}return this},i.prototype.removeAllListeners=function(t){var e,i;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[t]&&delete this._events[t],this;if(0===arguments.length){for(e in this._events)"removeListener"!==e&&this.removeAllListeners(e);return this.removeAllListeners("removeListener"),this._events={},this}if(i=this._events[t],n(i))this.removeListener(t,i);else if(i)for(;i.length;)this.removeListener(t,i[i.length-1]);return delete this._events[t],this},i.prototype.listeners=function(t){var e;return e=this._events&&this._events[t]?n(this._events[t])?[this._events[t]]:this._events[t].slice():[]},i.prototype.listenerCount=function(t){if(this._events){var e=this._events[t];if(n(e))return 1;if(e)return e.length}return 0},i.listenerCount=function(t,e){return t.listenerCount(e)}},function(t,e,i){var n,s,o;!function(i,r){s=[],n=r,o="function"==typeof n?n.apply(e,s):n,!(void 0!==o&&(t.exports=o))}(this,function(){"use strict";function t(t,e,i){this.low=0|t,this.high=0|e,this.unsigned=!!i}function e(t){return(t&&t.__isLong__)===!0}function i(t,e){var i,n,o;return e?(t>>>=0,(o=0<=t&&t<256)&&(n=c[t])?n:(i=s(t,(0|t)<0?-1:0,!0),o&&(c[t]=i),i)):(t|=0,(o=-128<=t&&t<128)&&(n=a[t])?n:(i=s(t,t<0?-1:0,!1),o&&(a[t]=i),i))}function n(t,e){if(isNaN(t)||!isFinite(t))return e?m:f;if(e){if(t<0)return m;if(t>=h)return b}else{if(t<=-p)return w;if(t+1>=p)return x}return t<0?n(-t,e).neg():s(t%4294967296|0,t/4294967296|0,e)}function s(e,i,n){return new t(e,i,n)}function o(t,e,i){if(0===t.length)throw Error("empty string");if("NaN"===t||"Infinity"===t||"+Infinity"===t||"-Infinity"===t)return f;if("number"==typeof e?(i=e,e=!1):e=!!e,i=i||10,i<2||360)throw Error("interior hyphen");if(0===s)return o(t.substring(1),e,i).neg();for(var r=n(l(i,8)),a=f,c=0;c>>0:this.low},_.toNumber=function(){return this.unsigned?4294967296*(this.high>>>0)+(this.low>>>0):4294967296*this.high+(this.low>>>0)},_.toString=function(t){if(t=t||10,t<2||36>>0,h=u.toString(t);if(r=c,r.isZero())return h+a;for(;h.length<6;)h="0"+h;a=""+h+a}},_.getHighBits=function(){return this.high},_.getHighBitsUnsigned=function(){return this.high>>>0},_.getLowBits=function(){return this.low},_.getLowBitsUnsigned=function(){return this.low>>>0},_.getNumBitsAbs=function(){if(this.isNegative())return this.eq(w)?64:this.neg().getNumBitsAbs();for(var t=0!=this.high?this.high:this.low,e=31;e>0&&0==(t&1<=0},_.isOdd=function(){return 1===(1&this.low)},_.isEven=function(){return 0===(1&this.low)},_.equals=function(t){return e(t)||(t=r(t)),(this.unsigned===t.unsigned||this.high>>>31!==1||t.high>>>31!==1)&&(this.high===t.high&&this.low===t.low)},_.eq=_.equals,_.notEquals=function(t){return!this.eq(t)},_.neq=_.notEquals,_.lessThan=function(t){return this.comp(t)<0},_.lt=_.lessThan,_.lessThanOrEqual=function(t){return this.comp(t)<=0},_.lte=_.lessThanOrEqual,_.greaterThan=function(t){return this.comp(t)>0},_.gt=_.greaterThan,_.greaterThanOrEqual=function(t){return this.comp(t)>=0},_.gte=_.greaterThanOrEqual,_.compare=function(t){if(e(t)||(t=r(t)),this.eq(t))return 0;var i=this.isNegative(),n=t.isNegative();return i&&!n?-1:!i&&n?1:this.unsigned?t.high>>>0>this.high>>>0||t.high===this.high&&t.low>>>0>this.low>>>0?-1:1:this.sub(t).isNegative()?-1:1},_.comp=_.compare,_.negate=function(){return!this.unsigned&&this.eq(w)?w:this.not().add(g)},_.neg=_.negate,_.add=function(t){e(t)||(t=r(t));var i=this.high>>>16,n=65535&this.high,o=this.low>>>16,a=65535&this.low,c=t.high>>>16,l=65535&t.high,u=t.low>>>16,h=65535&t.low,p=0,d=0,f=0,m=0;return m+=a+h,f+=m>>>16,m&=65535,f+=o+u,d+=f>>>16,f&=65535,d+=n+l,p+=d>>>16,d&=65535,p+=i+c,p&=65535,s(f<<16|m,p<<16|d,this.unsigned)},_.subtract=function(t){return e(t)||(t=r(t)),this.add(t.neg())},_.sub=_.subtract,_.multiply=function(t){if(this.isZero())return f;if(e(t)||(t=r(t)),t.isZero())return f;if(this.eq(w))return t.isOdd()?w:f;if(t.eq(w))return this.isOdd()?w:f;if(this.isNegative())return t.isNegative()?this.neg().mul(t.neg()):this.neg().mul(t).neg();if(t.isNegative())return this.mul(t.neg()).neg();if(this.lt(d)&&t.lt(d))return n(this.toNumber()*t.toNumber(),this.unsigned);var i=this.high>>>16,o=65535&this.high,a=this.low>>>16,c=65535&this.low,l=t.high>>>16,u=65535&t.high,h=t.low>>>16,p=65535&t.low,m=0,g=0,v=0,E=0;return E+=c*p,v+=E>>>16,E&=65535,v+=a*p,g+=v>>>16,v&=65535,v+=c*h,g+=v>>>16,v&=65535,g+=o*p,m+=g>>>16,g&=65535,g+=a*h,m+=g>>>16,g&=65535,g+=c*u,m+=g>>>16,g&=65535,m+=i*p+o*h+a*u+c*l,m&=65535,s(v<<16|E,m<<16|g,this.unsigned)},_.mul=_.multiply,_.divide=function(t){if(e(t)||(t=r(t)),t.isZero())throw Error("division by zero");if(this.isZero())return this.unsigned?m:f;var i,s,o;if(this.unsigned){if(t.unsigned||(t=t.toUnsigned()),t.gt(this))return m;if(t.gt(this.shru(1)))return v;o=m}else{if(this.eq(w)){if(t.eq(g)||t.eq(E))return w;if(t.eq(w))return g;var a=this.shr(1);return i=a.div(t).shl(1),i.eq(f)?t.isNegative()?g:E:(s=this.sub(t.mul(i)),o=i.add(s.div(t)))}if(t.eq(w))return this.unsigned?m:f;if(this.isNegative())return t.isNegative()?this.neg().div(t.neg()):this.neg().div(t).neg();if(t.isNegative())return this.div(t.neg()).neg();o=f}for(s=this;s.gte(t);){i=Math.max(1,Math.floor(s.toNumber()/t.toNumber()));for(var c=Math.ceil(Math.log(i)/Math.LN2),u=c<=48?1:l(2,c-48),h=n(i),p=h.mul(t);p.isNegative()||p.gt(s);)i-=u,h=n(i,this.unsigned),p=h.mul(t);h.isZero()&&(h=g),o=o.add(h),s=s.sub(p)}return o},_.div=_.divide,_.modulo=function(t){return e(t)||(t=r(t)),this.sub(this.div(t).mul(t))},_.mod=_.modulo,_.not=function(){return s(~this.low,~this.high,this.unsigned)},_.and=function(t){return e(t)||(t=r(t)),s(this.low&t.low,this.high&t.high,this.unsigned)},_.or=function(t){return e(t)||(t=r(t)),s(this.low|t.low,this.high|t.high,this.unsigned)},_.xor=function(t){return e(t)||(t=r(t)),s(this.low^t.low,this.high^t.high,this.unsigned)},_.shiftLeft=function(t){return e(t)&&(t=t.toInt()),0===(t&=63)?this:t<32?s(this.low<>>32-t,this.unsigned):s(0,this.low<>>t|this.high<<32-t,this.high>>t,this.unsigned):s(this.high>>t-32,this.high>=0?0:-1,this.unsigned)},_.shr=_.shiftRight,_.shiftRightUnsigned=function(t){if(e(t)&&(t=t.toInt()),t&=63,0===t)return this;var i=this.high;if(t<32){var n=this.low;return s(n>>>t|i<<32-t,i>>>t,this.unsigned)}return 32===t?s(i,0,this.unsigned):s(i>>>t-32,0,this.unsigned)},_.shru=_.shiftRightUnsigned,_.toSigned=function(){return this.unsigned?s(this.low,this.high,!1):this},_.toUnsigned=function(){return this.unsigned?this:s(this.low,this.high,!0)},_.toBytes=function(t){return t?this.toBytesLE():this.toBytesBE()},_.toBytesLE=function(){var t=this.high,e=this.low;return[255&e,e>>>8&255,e>>>16&255,e>>>24&255,255&t,t>>>8&255,t>>>16&255,t>>>24&255]},_.toBytesBE=function(){var t=this.high,e=this.low;return[t>>>24&255,t>>>16&255,t>>>8&255,255&t,e>>>24&255,e>>>16&255,e>>>8&255,255&e]},t})},function(t,e,i){(function(e){function n(t){function i(t){const e=new ArrayBuffer(2*t.length),i=new Uint16Array(e);for(var n=0,s=t.length;nt.split("=")))e[i]=n;return e}const o="undefined"!=typeof window;let r,a;o?(r=window.fetch,a=window.FormData):(r=i(137),a=i(58));class c{constructor(t,e){this.url=e,this.method=t.toUpperCase(),this.headers={},this.data=null}set(t,e){return this.headers[t]=e,this}attach(t,e,i){const n=this._getFormData();return this.set("Content-Type",`multipart/form-data; boundary=${n.boundary}`),n.append(t,e,i),this.data=n,this}send(t){return"object"==typeof t?(this.set("Content-Type","application/json"),this.data=JSON.stringify(t)):this.data=t,this}end(t){let e={headers:{},text:"",body:{}};const i=this.data?this.data.end?this.data.end():this.data:null;return r(this.url,{method:this.method,headers:this.headers,body:i}).then(t=>{const i=t.headers.get("Content-Type");return i.includes("application/json")?t.text().then(i=>{return e.text=i,e.body=JSON.parse(i),t}):i.includes("application/x-www-form-urlencoded")?t.text().then(i=>{return e.text=i,e.body=s(i),t}):(o?t.arrayBuffer():t.buffer()).then(i=>{return i instanceof ArrayBuffer&&(i=n(i)),e.body=i,e.text=i.toString(),t})}).then(i=>{const{body,text}=e;if(Object.assign(e,i),e.body=body,e.text=text,i.headers.raw)for(const[n,s]of Object.entries(i.headers.raw()))e.headers[n]=s[0];else for(const[n,s]of i.headers.entries())e.headers[n]=s;return["4","5"].includes(e.status.toString().substr(0,1))?t(e,e):t(null,e)}).catch(e=>{t(e)})}then(t,e){return new Promise((i,n)=>{this.end((s,o)=>{s?n(e?e(s):s):i(t?t(o):o)})})}catch(t){return this.then(null,t)}_getFormData(){return this._formData||(this._formData=new a),this._formData}}const l=["GET","HEAD","POST","PUT","DELETE","CONNECT","OPTIONS","TRACE","PATCH","BREW"];for(const u of l)c[u.toLowerCase()]=(t=>new c(u,t));c.version=i(57).version,t.exports=c,o&&(window.Fetcher=c)}).call(e,i(14).Buffer)},function(t,e,i){(function(e){const n=i(19),s=i(42),o=i(26),r=i(0),a=i(4).convertToBuffer,c=i(11),l=i(9),u=i(17),h=i(8),p=i(13),d=i(12),f=i(22);class m{constructor(t){this.client=t}resolveUser(t){return t instanceof c?t:"string"==typeof t?this.client.users.get(t)||null:t instanceof p?t.user:t instanceof l?t.author:t instanceof u?t.owner:null}resolveUserID(t){return t instanceof c||t instanceof p?t.id:"string"==typeof t?t||null:t instanceof l?t.author.id:t instanceof u?t.ownerID:null}resolveGuild(t){return t instanceof u?t:"string"==typeof t?this.client.guilds.get(t)||null:null}resolveGuildMember(t,e){return e instanceof p?e:(t=this.resolveGuild(t),e=this.resolveUser(e),t&&e?t.members.get(e.id)||null:null)}resolveChannel(t){return t instanceof h?t:"string"==typeof t?this.client.channels.get(t)||null:t instanceof l?t.channel:t instanceof u?t.channels.get(t.id)||null:null}resolveChannelID(t){return t instanceof h?t.id:"string"==typeof t?t:t instanceof l?t.channel.id:t instanceof u?t.defaultChannel.id:null}resolveInviteCode(t){const e=/discord(?:app\.com\/invite|\.gg)\/([\w-]{2,255})/i,i=e.exec(t);return i&&i[1]?i[1]:t}resolveString(t){return"string"==typeof t?t:t instanceof Array?t.join("\n"):String(t)}resolveBase64(t){return t instanceof e?`data:image/jpg;base64,${t.toString("base64")}`:t}resolveBuffer(t){return t instanceof e?Promise.resolve(t):this.client.browser&&t instanceof ArrayBuffer?Promise.resolve(a(t)):"string"==typeof t?new Promise((i,r)=>{if(/^https?:\/\//.test(t))o.get(t).end((t,n)=>{return t?r(t):n.body instanceof e?i(n.body):r(new TypeError("The response body isn't a Buffer."))});else{const e=n.resolve(t);s.stat(e,(t,n)=>{return t?r(t):n&&n.isFile()?(s.readFile(e,(t,e)=>{t?r(t):i(e)}),null):r(new Error(`The file could not be found: ${e}`))})}}):Promise.reject(new TypeError("The resource must be a string or Buffer."))}resolveEmojiIdentifier(t){return t instanceof d||t instanceof f?t.identifier:"string"!=typeof t||t.includes("%")?null:encodeURIComponent(t)}static resolveColor(t){if("string"==typeof t){if("RANDOM"===t)return Math.floor(16777216*Math.random());t=r.Colors[t]||parseInt(t.replace("#",""),16)}else t instanceof Array&&(t=(t[0]<<16)+(t[1]<<8)+t[2]);if(t<0||t>16777215)throw new RangeError("Color must be within the range 0 - 16777215 (0xFFFFFF).");if(t&&isNaN(t))throw new TypeError("Unable to convert color to a number.");return t}resolveColor(t){return this.constructor.resolveColor(t)}}t.exports=m}).call(e,i(14).Buffer)},function(t,e){t.exports={name:"discord.js",version:"11.0.0",description:"A powerful library for interacting with the Discord API",main:"./src/index",types:"./typings/index.d.ts",scripts:{test:"npm run lint && npm run docs:test",docs:"docgen --source src --custom docs/index.yml --output docs/docs.json","docs:test":"docgen --source src --custom docs/index.yml",lint:"eslint src","lint:fix":"eslint --fix src",webpack:"parallel-webpack"},repository:{type:"git",url:"git+https://github.com/hydrabolt/discord.js.git"},keywords:["discord","api","bot","client","node","discordapp"],author:"Amish Shah ",license:"Apache-2.0",bugs:{url:"https://github.com/hydrabolt/discord.js/issues"},homepage:"https://github.com/hydrabolt/discord.js#readme",runkitExampleFilename:"./docs/examples/ping.js",dependencies:{"@types/node":"^7.0.0",long:"^3.2.0","prism-media":"hydrabolt/prism-media",snekfetch:"github:guscaplan/snekfetch",tweetnacl:"^0.14.0",ws:"^2.0.0"},peerDependencies:{bufferutil:"^2.0.0",erlpack:"hammerandchisel/erlpack","node-opus":"^0.2.0",opusscript:"^0.0.2",sodium:"^2.0.1",uws:"^0.14.1"},devDependencies:{"discord.js-docgen":"hydrabolt/discord.js-docgen",eslint:"^3.17.0","parallel-webpack":"^1.6.0","uglify-js":"mishoo/UglifyJS2#harmony",webpack:"^2.2.0"},engines:{node:">=6.0.0"},browser:{ws:!1,uws:!1,erlpack:!1,"prism-media":!1,opusscript:!1,"node-opus":!1,tweetnacl:!1,sodium:!1,"node-fetch":!1,"src/sharding/Shard.js":!1,"src/sharding/ShardClientUtil.js":!1,"src/sharding/ShardingManager.js":!1,"src/client/voice/dispatcher/StreamDispatcher.js":!1,"src/client/voice/opus/BaseOpusEngine.js":!1,"src/client/voice/opus/NodeOpusEngine.js":!1,"src/client/voice/opus/OpusEngineList.js":!1,"src/client/voice/opus/OpusScriptEngine.js":!1,"src/client/voice/pcm/ConverterEngine.js":!1,"src/client/voice/pcm/ConverterEngineList.js":!1,"src/client/voice/pcm/FfmpegConverterEngine.js":!1,"src/client/voice/player/AudioPlayer.js":!1,"src/client/voice/receiver/VoiceReadable.js":!1,"src/client/voice/receiver/VoiceReceiver.js":!1,"src/client/voice/util/Secretbox.js":!1,"src/client/voice/util/SecretKey.js":!1,"src/client/voice/util/VolumeInterface.js":!1,"src/client/voice/ClientVoiceManager.js":!1,"src/client/voice/VoiceBroadcast.js":!1,"src/client/voice/VoiceConnection.js":!1,"src/client/voice/VoiceUDPClient.js":!1,"src/client/voice/VoiceWebSocket.js":!1}}},function(t,e,i){const n=i(11),s=i(3);class o extends n{setup(t){super.setup(t),this.verified=t.verified,this.email=t.email,this.localPresence={},this._typing=new Map,this.friends=new s,this.blocked=new s,this.notes=new s,this.settings={},this.premium="boolean"==typeof t.premium?t.premium:null,this.mfaEnabled="boolean"==typeof t.mfa_enabled?t.mfa_enabled:null,this.mobile="boolean"==typeof t.mobile?t.mobile:null}edit(t){return this.client.rest.methods.updateCurrentUser(t)}setUsername(t,e){return this.client.rest.methods.updateCurrentUser({username:t},e)}setEmail(t,e){return this.client.rest.methods.updateCurrentUser({email:t},e)}setPassword(t,e){return this.client.rest.methods.updateCurrentUser({password:t},e)}setAvatar(t){return"string"==typeof t&&t.startsWith("data:")?this.client.rest.methods.updateCurrentUser({avatar:t}):this.client.resolver.resolveBuffer(t).then(t=>this.client.rest.methods.updateCurrentUser({avatar:t}))}setPresence(t){return new Promise(e=>{let i=this.localPresence.status||this.presence.status,n=this.localPresence.game,s=this.localPresence.afk||this.presence.afk;if(!n&&this.presence.game&&(n={name:this.presence.game.name,type:this.presence.game.type,url:this.presence.game.url}),t.status){if("string"!=typeof t.status)throw new TypeError("Status must be a string");i=t.status}t.game&&(n=t.game,n.url&&(n.type=1)),null===t.game&&(n=null),"undefined"!=typeof t.afk&&(s=t.afk),s=Boolean(s),this.localPresence={status:i,game:n,afk:s},this.localPresence.since=0,this.localPresence.game=this.localPresence.game||null,this.client.ws.send({op:3,d:this.localPresence}),this.client._setPresence(this.id,this.localPresence),e(this)})}setStatus(t){return this.setPresence({status:t})}setGame(t,e){return null===t?this.setPresence({game:t}):this.setPresence({game:{name:t,url:e}})}setAFK(t){return this.setPresence({afk:t})}fetchMentions(t={limit:25,roles:true,everyone:true,guild:null}){return this.client.rest.methods.fetchMentions(t)}addFriend(t){return t=this.client.resolver.resolveUser(t),this.client.rest.methods.addFriend(t)}removeFriend(t){return t=this.client.resolver.resolveUser(t),this.client.rest.methods.removeFriend(t)}createGuild(t,e,i=null){return i?"string"==typeof i&&i.startsWith("data:")?this.client.rest.methods.createGuild({name:t,icon:i,region:e}):this.client.resolver.resolveBuffer(i).then(i=>this.client.rest.methods.createGuild({name:t,icon:i,region:e})):this.client.rest.methods.createGuild({name:t,icon:i,region:e})}createGroupDM(t){return this.client.rest.methods.createGroupDM({recipients:t.map(t=>this.client.resolver.resolveUserID(t.user)),accessTokens:t.map(t=>t.accessToken),nicks:t.map(t=>t.nick)})}acceptInvite(t){return this.client.rest.methods.acceptInvite(t)}}t.exports=o},function(t,e,i){const n=i(8),s=i(15),o=i(3);class r extends n{constructor(t,e){super(t,e),this.type="dm",this.messages=new o,this._typing=new Map}setup(t){super.setup(t),this.recipient=this.client.dataManager.newUser(t.recipients[0]),this.lastMessageID=t.last_message_id}toString(){return this.recipient.toString()}send(){}sendMessage(){}sendEmbed(){}sendFile(){}sendFiles(){}sendCode(){}fetchMessage(){}fetchMessages(){}fetchPinnedMessages(){}search(){}startTyping(){}stopTyping(){}get typing(){}get typingCount(){}createCollector(){}awaitMessages(){}acknowledge(){}_cacheMessage(){}}s.applyToClass(r,!0,["bulkDelete"]),t.exports=r},function(t,e,i){const n=i(37),s=i(38),o=i(0);class r{constructor(t,e){Object.defineProperty(this,"client",{value:t}),this.setup(e)}setup(t){this.guild=this.client.guilds.get(t.guild.id)||new n(this.client,t.guild),this.code=t.code,this.temporary=t.temporary,this.maxAge=t.max_age,this.uses=t.uses,this.maxUses=t.max_uses,t.inviter&&(this.inviter=this.client.dataManager.newUser(t.inviter)),this.channel=this.client.channels.get(t.channel.id)||new s(this.client,t.channel),this.createdTimestamp=new Date(t.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 o.Endpoints.inviteLink(this.code)}delete(){return this.client.rest.methods.deleteInvite(this)}toString(){return this.url}}t.exports=r},function(t,e){class i{constructor(t,e){Object.defineProperty(this,"client",{value:t.client}),this.message=t,this.setup(e)}setup(t){this.id=t.id,this.filename=t.filename,this.filesize=t.size,this.url=t.url,this.proxyURL=t.proxy_url,this.height=t.height,this.width=t.width}}t.exports=i},function(t,e,i){const n=i(24).EventEmitter,s=i(3);class o extends n{constructor(t,e,i={}){super(),this.channel=t,this.filter=e,this.options=i,this.ended=!1,this.collected=new s,this.listener=(t=>this.verify(t)),this.channel.client.on("message",this.listener),i.time&&this.channel.client.setTimeout(()=>this.stop("time"),i.time)}verify(t){return(!this.channel||this.channel.id===t.channel.id)&&(!!this.filter(t,this)&&(this.collected.set(t.id,t),this.emit("message",t,this),this.collected.size>=this.options.maxMatches?this.stop("matchesLimit"):this.options.max&&this.collected.size===this.options.max&&this.stop("limit"),!0))}get next(){return new Promise((t,e)=>{if(this.ended)return void e(this.collected);const i=()=>{this.removeListener("message",n),this.removeListener("end",s)},n=(...e)=>{i(),t(...e)},s=(...t)=>{i(),e(...t)};this.once("message",n),this.once("end",s)})}stop(t="user"){this.ended||(this.ended=!0,this.channel.client.removeListener("message",this.listener),this.emit("end",this.collected,t))}}t.exports=o},function(t,e){class i{constructor(t,e){Object.defineProperty(this,"client",{value:t.client}),this.message=t,this.setup(e)}setup(t){if(this.type=t.type,this.title=t.title,this.description=t.description,this.url=t.url,this.color=t.color,this.fields=[],t.fields)for(const e of t.fields)this.fields.push(new c(this,e));this.createdTimestamp=t.timestamp,this.thumbnail=t.thumbnail?new n(this,t.thumbnail):null,this.image=t.image?new s(this,t.image):null,this.video=t.video?new o(this,t.video):null,this.author=t.author?new a(this,t.author):null,this.provider=t.provider?new r(this,t.provider):null,this.footer=t.footer?new l(this,t.footer):null}get createdAt(){return new Date(this.createdTimestamp)}get hexColor(){let t=this.color.toString(16);for(;t.length<6;)t=`0${t}`;return`#${t}`}}class n{constructor(t,e){this.embed=t,this.setup(e)}setup(t){this.url=t.url,this.proxyURL=t.proxy_url,this.height=t.height,this.width=t.width}}class s{constructor(t,e){this.embed=t,this.setup(e)}setup(t){this.url=t.url,this.proxyURL=t.proxy_url,this.height=t.height,this.width=t.width}}class o{constructor(t,e){this.embed=t,this.setup(e)}setup(t){this.url=t.url,this.height=t.height,this.width=t.width}}class r{constructor(t,e){this.embed=t,this.setup(e)}setup(t){this.name=t.name,this.url=t.url}}class a{constructor(t,e){this.embed=t,this.setup(e)}setup(t){this.name=t.name,this.url=t.url,this.iconURL=t.icon_url}}class c{constructor(t,e){this.embed=t,this.setup(e)}setup(t){this.name=t.name,this.value=t.value,this.inline=t.inline}}class l{constructor(t,e){this.embed=t,this.setup(e)}setup(t){this.text=t.text,this.iconURL=t.icon_url,this.proxyIconUrl=t.proxy_icon_url}}i.Thumbnail=n,i.Image=s,i.Video=o,i.Provider=r,i.Author=a,i.Field=c,i.Footer=l,t.exports=i},function(t,e,i){const n=i(3),s=i(12),o=i(22);class r{constructor(t,e,i,s){this.message=t,this.me=s,this.count=i||0,this.users=new n,this._emoji=new o(this,e.name,e.id)}get emoji(){if(this._emoji instanceof s)return this._emoji;if(this._emoji.id){const t=this.message.client.emojis;if(t.has(this._emoji.id)){const e=t.get(this._emoji.id);return this._emoji=e,e}}return this._emoji}remove(t=this.message.client.user){const e=this.message;return t=this.message.client.resolver.resolveUserID(t),t?e.client.rest.methods.removeMessageReaction(e,this.emoji.identifier,t):Promise.reject(new Error("Couldn't resolve the user ID to remove from the reaction."))}fetchUsers(t=100){const e=this.message;return e.client.rest.methods.getMessageReactionUsers(e,this.emoji.identifier,t).then(t=>{this.users=new n;for(const e of t){const t=this.message.client.dataManager.newUser(e);this.users.set(t.id,t)}return this.count=this.users.size,this.users})}}t.exports=r},function(t,e,i){const n=i(5);class s{constructor(t,e){Object.defineProperty(this,"client",{value:t}),this.setup(e)}setup(t){this.id=t.id,this.name=t.name,this.description=t.description,this.icon=t.icon,this.iconURL=`https://cdn.discordapp.com/app-icons/${this.id}/${this.icon}.jpg`,this.rpcOrigins=t.rpc_origins,this.redirectURIs=t.redirect_uris,this.botRequireCodeGrant=t.bot_require_code_grant,this.botPublic=t.bot_public,this.rpcApplicationState=t.rpc_application_state,this.bot=t.bot,this.flags=t.flags,this.secret=t.secret}get createdTimestamp(){return n.deconstruct(this.id).timestamp}get createdAt(){return new Date(this.createdTimestamp)}reset(){return this.client.rest.methods.resetApplication(this.id)}toString(){return this.name}}t.exports=s},function(t,e){class i{constructor(t,e){Object.defineProperty(this,"client",{value:t}),this.setup(e)}setup(t){this.id=t.id,this.name=t.name,this.icon=t.icon,this.splash=t.splash}}t.exports=i},function(t,e,i){const n=i(0);class s{constructor(t,e){Object.defineProperty(this,"client",{value:t}),this.setup(e)}setup(t){this.id=t.id,this.name=t.name,this.type=n.ChannelTypes.TEXT===t.type?"text":"voice"}}t.exports=s},function(t,e){class i{constructor(t,e){Object.defineProperty(this,"channel",{value:t}),e&&this.setup(e)}setup(t){this.id=t.id,this.type=t.type,this.deny=t.deny,this.allow=t.allow}delete(){return this.channel.client.rest.methods.deletePermissionOverwrites(this)}}t.exports=i},function(t,e,i){const n=i(18),s=i(15),o=i(3);class r extends n{constructor(t,e){super(t,e),this.type="text",this.messages=new o,this._typing=new Map}setup(t){super.setup(t),this.topic=t.topic,this.lastMessageID=t.last_message_id}get members(){const t=new o;for(const e of this.guild.members.values())this.permissionsFor(e).hasPermission("READ_MESSAGES")&&t.set(e.id,e);return t}fetchWebhooks(){return this.client.rest.methods.getChannelWebhooks(this)}createWebhook(t,e){return new Promise(i=>{"string"==typeof e&&e.startsWith("data:")?i(this.client.rest.methods.createWebhook(this,t,e)):this.client.resolver.resolveBuffer(e).then(e=>i(this.client.rest.methods.createWebhook(this,t,e)))})}send(){}sendMessage(){}sendEmbed(){}sendFile(){}sendFiles(){}sendCode(){}fetchMessage(){}fetchMessages(){}fetchPinnedMessages(){}search(){}startTyping(){}stopTyping(){}get typing(){}get typingCount(){}createCollector(){}awaitMessages(){}bulkDelete(){}acknowledge(){}_cacheMessage(){}}s.applyToClass(r,!0),t.exports=r},function(t,e,i){const n=i(18),s=i(3);class o extends n{constructor(t,e){super(t,e),this.members=new s,this.type="voice"}setup(t){super.setup(t),this.bitrate=t.bitrate,this.userLimit=t.user_limit}get connection(){const t=this.guild.voiceConnection;return t&&t.channel.id===this.id?t:null}get full(){return this.userLimit>0&&this.members.size>=this.userLimit}get joinable(){return!this.client.browser&&(!!this.permissionsFor(this.client.user).hasPermission("CONNECT")&&!(this.full&&!this.permissionsFor(this.client.user).hasPermission("MOVE_MEMBERS")))}get speakable(){return this.permissionsFor(this.client.user).hasPermission("SPEAK")}setBitrate(t){return this.edit({bitrate:t})}setUserLimit(t){return this.edit({userLimit:t})}join(){return this.client.browser?Promise.reject(new Error("Voice connections are not available in browsers.")):this.client.voice.joinChannel(this)}leave(){if(!this.client.browser){const t=this.client.voice.connections.get(this.guild.id);t&&t.channel.id===this.id&&t.disconnect()}}}t.exports=o},function(t,e){},function(t,e,i){const n=i(97),s=i(94),o=i(96),r=i(95),a=i(93),c=i(0);class l{constructor(t){this.client=t,this.handlers={},this.userAgentManager=new n(this),this.methods=new s(this),this.rateLimitedEndpoints={},this.globallyRateLimited=!1}push(t,e){return new Promise((i,n)=>{t.push({request:e,resolve:i,reject:n})})}getRequestHandler(){switch(this.client.options.apiRequestMethod){case"sequential":return o;case"burst":return r;default:throw new Error(c.Errors.INVALID_RATE_LIMIT_METHOD)}}makeRequest(t,e,i,n,s){const o=new a(this,t,e,i,n,s);if(!this.handlers[o.route]){const t=this.getRequestHandler();this.handlers[o.route]=new t(this,o.route)}return this.push(this.handlers[o.route],o)}}t.exports=l},function(t,e){class i{constructor(t){this.restManager=t,this.queue=[]}get globalLimit(){return this.restManager.globallyRateLimited}set globalLimit(t){this.restManager.globallyRateLimited=t}push(t){ +this.queue.push(t)}handle(){}}t.exports=i},function(module,exports,__webpack_require__){(function(process){const os=__webpack_require__(16),EventEmitter=__webpack_require__(24).EventEmitter,Constants=__webpack_require__(0),Permissions=__webpack_require__(6),Util=__webpack_require__(4),RESTManager=__webpack_require__(43),ClientDataManager=__webpack_require__(63),ClientManager=__webpack_require__(64),ClientDataResolver=__webpack_require__(27),ClientVoiceManager=__webpack_require__(139),WebSocketManager=__webpack_require__(98),ActionsManager=__webpack_require__(65),Collection=__webpack_require__(3),Presence=__webpack_require__(7).Presence,ShardClientUtil=__webpack_require__(138),VoiceBroadcast=__webpack_require__(140);class Client extends EventEmitter{constructor(t={}){super(),!t.shardId&&"SHARD_ID"in process.env&&(t.shardId=Number(process.env.SHARD_ID)),!t.shardCount&&"SHARD_COUNT"in process.env&&(t.shardCount=Number(process.env.SHARD_COUNT)),this.options=Util.mergeDefault(Constants.DefaultOptions,t),this._validateOptions(),this.rest=new RESTManager(this),this.dataManager=new ClientDataManager(this),this.manager=new ClientManager(this),this.ws=new WebSocketManager(this),this.resolver=new ClientDataResolver(this),this.actions=new ActionsManager(this),this.voice=this.browser?null:new ClientVoiceManager(this),this.shard=process.send?ShardClientUtil.singleton(this):null,this.users=new Collection,this.guilds=new Collection,this.channels=new Collection,this.presences=new Collection,!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._pingTimestamp=0,this._timeouts=new Set,this._intervals=new Set,this.options.messageSweepInterval>0&&this.setInterval(this.sweepMessages.bind(this),1e3*this.options.messageSweepInterval)}get status(){return this.ws.status}get uptime(){return this.readyAt?Date.now()-this.readyAt:null}get ping(){return this.pings.reduce((t,e)=>t+e,0)/this.pings.length}get voiceConnections(){return this.browser?new Collection:this.voice.connections}get emojis(){const t=new Collection;for(const e of this.guilds.values())for(const i of e.emojis.values())t.set(i.id,i);return t}get readyTimestamp(){return this.readyAt?this.readyAt.getTime():null}get browser(){return"browser"===os.platform()}createVoiceBroadcast(){const t=new VoiceBroadcast(this);return this.broadcasts.push(t),t}login(t){return this.rest.methods.login(t)}destroy(){for(const t of this._timeouts)clearTimeout(t);for(const e of this._intervals)clearInterval(e);return this._timeouts.clear(),this._intervals.clear(),this.manager.destroy()}syncGuilds(t=this.guilds){this.user.bot||this.ws.send({op:12,d:t instanceof Collection?t.keyArray():t.map(t=>t.id)})}fetchUser(t,e=true){return this.users.has(t)?Promise.resolve(this.users.get(t)):this.rest.methods.getUser(t,e)}fetchInvite(t){const e=this.resolver.resolveInviteCode(t);return this.rest.methods.getInvite(e)}fetchWebhook(t,e){return this.rest.methods.getWebhook(t,e)}fetchVoiceRegions(){return this.rest.methods.fetchVoiceRegions()}sweepMessages(t=this.options.messageCacheLifetime){if("number"!=typeof t||isNaN(t))throw new TypeError("The lifetime must be a number.");if(t<=0)return this.emit("debug","Didn't sweep messages - lifetime is unlimited"),-1;const e=1e3*t,i=Date.now();let n=0,s=0;for(const o of this.channels.values())if(o.messages){n++;for(const t of o.messages.values())i-(t.editedTimestamp||t.createdTimestamp)>e&&(o.messages.delete(t.id),s++)}return this.emit("debug",`Swept ${s} messages older than ${t} seconds in ${n} text-based channels`),s}fetchApplication(t="@me"){return this.rest.methods.getApplication(t)}generateInvite(t){return t?t instanceof Array&&(t=Permissions.resolve(t)):t=0,this.fetchApplication().then(e=>`https://discordapp.com/oauth2/authorize?client_id=${e.id}&permissions=${t}&scope=bot`)}setTimeout(t,e,...i){const n=setTimeout(()=>{t(),this._timeouts.delete(n)},e,...i);return this._timeouts.add(n),n}clearTimeout(t){clearTimeout(t),this._timeouts.delete(t)}setInterval(t,e,...i){const n=setInterval(t,e,...i);return this._intervals.add(n),n}clearInterval(t){clearInterval(t),this._intervals.delete(t)}_pong(t){this.pings.unshift(Date.now()-t),this.pings.length>3&&(this.pings.length=3),this.ws.lastHeartbeatAck=!0}_setPresence(t,e){return this.presences.has(t)?void this.presences.get(t).update(e):void this.presences.set(t,new Presence(e))}_eval(script){return eval(script)}_validateOptions(t=this.options){if("number"!=typeof t.shardCount||isNaN(t.shardCount))throw new TypeError("The shardCount option must be a number.");if("number"!=typeof t.shardId||isNaN(t.shardId))throw new TypeError("The shardId option must be a number.");if(t.shardCount<0)throw new RangeError("The shardCount option must be at least 0.");if(t.shardId<0)throw new RangeError("The shardId option must be at least 0.");if(0!==t.shardId&&t.shardId>=t.shardCount)throw new RangeError("The shardId option must be less than shardCount.");if("number"!=typeof t.messageCacheMaxSize||isNaN(t.messageCacheMaxSize))throw new TypeError("The messageCacheMaxSize option must be a number.");if("number"!=typeof t.messageCacheLifetime||isNaN(t.messageCacheLifetime))throw new TypeError("The messageCacheLifetime option must be a number.");if("number"!=typeof t.messageSweepInterval||isNaN(t.messageSweepInterval))throw new TypeError("The messageSweepInterval option must be a number.");if("boolean"!=typeof t.fetchAllMembers)throw new TypeError("The fetchAllMembers option must be a boolean.");if("boolean"!=typeof t.disableEveryone)throw new TypeError("The disableEveryone option must be a boolean.");if("number"!=typeof t.restWsBridgeTimeout||isNaN(t.restWsBridgeTimeout))throw new TypeError("The restWsBridgeTimeout option must be a number.");if(!(t.disabledEvents instanceof Array))throw new TypeError("The disabledEvents option must be an Array.")}}module.exports=Client}).call(exports,__webpack_require__(20))},function(t,e,i){const n=i(23),s=i(43),o=i(27),r=i(0),a=i(4);class c extends n{constructor(t,e,i){super(null,t,e),this.options=a.mergeDefault(r.DefaultOptions,i),this.rest=new s(this),this.resolver=new o(this),this._timeouts=new Set,this._intervals=new Set}setTimeout(t,e,...i){const n=setTimeout(()=>{t(),this._timeouts.delete(n)},e,...i);return this._timeouts.add(n),n}clearTimeout(t){clearTimeout(t),this._timeouts.delete(t)}setInterval(t,e,...i){const n=setInterval(t,e,...i);return this._intervals.add(n),n}clearInterval(t){clearInterval(t),this._intervals.delete(t)}destroy(){for(const t of this._timeouts)clearTimeout(t);for(const e of this._intervals)clearInterval(e);this._timeouts.clear(),this._intervals.clear()}}t.exports=c},function(t,e,i){function n(t){return"string"==typeof t?t:t instanceof Array?t.join("\n"):String(t)}const s=i(27);class o{constructor(t={}){this.title=t.title,this.description=t.description,this.url=t.url,this.color=t.color,this.author=t.author,this.timestamp=t.timestamp,this.fields=t.fields||[],this.thumbnail=t.thumbnail,this.image=t.image,this.footer=t.footer,this.file=t.file}setTitle(t){if(t=n(t),t.length>256)throw new RangeError("RichEmbed titles may not exceed 256 characters.");return this.title=t,this}setDescription(t){if(t=n(t),t.length>2048)throw new RangeError("RichEmbed descriptions may not exceed 2048 characters.");return this.description=t,this}setURL(t){return this.url=t,this}setColor(t){return this.color=s.resolveColor(t),this}setAuthor(t,e,i){return this.author={name:n(t),icon_url:e,url:i},this}setTimestamp(t=new Date){return this.timestamp=t,this}addField(t,e,i=false){if(this.fields.length>=25)throw new RangeError("RichEmbeds may not exceed 25 fields.");if(t=n(t),t.length>256)throw new RangeError("RichEmbed field names may not exceed 256 characters.");if(!/\S/.test(t))throw new RangeError("RichEmbed field names may not be empty.");if(e=n(e),e.length>1024)throw new RangeError("RichEmbed field values may not exceed 1024 characters.");if(!/\S/.test(e))throw new RangeError("RichEmbed field values may not be empty.");return this.fields.push({name:t,value:e,inline:i}),this}addBlankField(t=false){return this.addField("​","​",t)}setThumbnail(t){return this.thumbnail={url:t},this}setImage(t){return this.image={url:t},this}setFooter(t,e){if(t=n(t),t.length>2048)throw new RangeError("RichEmbed footer text may not exceed 2048 characters.");return this.footer={text:t,icon_url:e},this}attachFile(t){if(this.file)throw new RangeError("You may not upload more than one file at once.");return this.file=t,this}}t.exports=o},function(t,e){},function(t,e){},function(t,e){},function(t,e,i){"use strict";function n(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===t[e-2]?2:"="===t[e-1]?1:0}function s(t){return 3*t.length/4-n(t)}function o(t){var e,i,s,o,r,a,c=t.length;r=n(t),a=new h(3*c/4-r),s=r>0?c-4:c;var l=0;for(e=0,i=0;e>16&255,a[l++]=o>>8&255,a[l++]=255&o;return 2===r?(o=u[t.charCodeAt(e)]<<2|u[t.charCodeAt(e+1)]>>4,a[l++]=255&o):1===r&&(o=u[t.charCodeAt(e)]<<10|u[t.charCodeAt(e+1)]<<4|u[t.charCodeAt(e+2)]>>2,a[l++]=o>>8&255,a[l++]=255&o),a}function r(t){return l[t>>18&63]+l[t>>12&63]+l[t>>6&63]+l[63&t]}function a(t,e,i){for(var n,s=[],o=e;ou?u:c+r));return 1===n?(e=t[i-1],s+=l[e>>2],s+=l[e<<4&63],s+="=="):2===n&&(e=(t[i-2]<<8)+t[i-1],s+=l[e>>10],s+=l[e>>4&63],s+=l[e<<2&63],s+="="),o.push(s),o.join("")}e.byteLength=s,e.toByteArray=o,e.fromByteArray=c;for(var l=[],u=[],h="undefined"!=typeof Uint8Array?Uint8Array:Array,p="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",d=0,f=p.length;d>1,u=-7,h=i?s-1:0,p=i?-1:1,d=t[e+h];for(h+=p,o=d&(1<<-u)-1,d>>=-u,u+=a;u>0;o=256*o+t[e+h],h+=p,u-=8);for(r=o&(1<<-u)-1,o>>=-u,u+=n;u>0;r=256*r+t[e+h],h+=p,u-=8);if(0===o)o=1-l;else{if(o===c)return r?NaN:(d?-1:1)*(1/0);r+=Math.pow(2,n),o-=l}return(d?-1:1)*r*Math.pow(2,o-n)},e.write=function(t,e,i,n,s,o){var r,a,c,l=8*o-s-1,u=(1<>1,p=23===s?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:o-1,f=n?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,r=u):(r=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-r))<1&&(r--,c*=2),e+=r+h>=1?p/c:p*Math.pow(2,1-h),e*c>=2&&(r++,c/=2),r+h>=u?(a=0,r=u):r+h>=1?(a=(e*c-1)*Math.pow(2,s),r+=h):(a=e*Math.pow(2,h-1)*Math.pow(2,s),r=0));s>=8;t[i+d]=255&a,d+=f,a/=256,s-=8);for(r=r<0;t[i+d]=255&r,d+=f,r/=256,l-=8);t[i+d-f]|=128*m}},function(t,e){var i={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==i.call(t)}},function(t,e,i){"use strict";function n(t,e){return Object.prototype.hasOwnProperty.call(t,e)}t.exports=function(t,e,i,o){e=e||"&",i=i||"=";var r={};if("string"!=typeof t||0===t.length)return r;var a=/\+/g;t=t.split(e);var c=1e3;o&&"number"==typeof o.maxKeys&&(c=o.maxKeys);var l=t.length;c>0&&l>c&&(l=c);for(var u=0;u=0?(h=m.substr(0,g),p=m.substr(g+1)):(h=m,p=""),d=decodeURIComponent(h),f=decodeURIComponent(p),n(r,d)?s(r[d])?r[d].push(f):r[d]=[r[d],f]:r[d]=f}return r};var s=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)}},function(t,e,i){"use strict";function n(t,e){if(t.map)return t.map(e);for(var i=[],n=0;n fs.writeFile('download.jpg', r.body));\n```\n\n```js\nconst snekfetch = require('snekfetch');\n\nsnekfetch.post('https://httpbin.org/post')\n .send({ meme: 'dream' })\n .then(r => console.log(r.body));\n```\n",readmeFilename:"README.md",repository:{type:"git",url:"git+https://github.com/GusCaplan/snekfetch.git"},scripts:{test:'echo "Error: no test specified" && exit 1'},version:"1.0.1"}},function(t,e,i){(function(e){const n=i(19),s=i(59);class o{constructor(){this.boundary=`-----------${Math.random().toString().slice(2)}`,this.buffer=new e(0)}append(t,i,o){if("undefined"!=typeof i){let r=` +--${this.boundary} +Content-Disposition: form-data; name="${t}"`,a=null;if(o){r+=`; filename="${o}"`,a="application/octet-stream";const t=n.extname(o);t&&(a=s.lookup(t))}i instanceof e?a=s.buffer(i):"object"==typeof i?(a="application/json",i=e.from(JSON.stringify(i))):i=e.from(String(i)),a&&(r+=` +Content-Type: ${a}`),this.buffer=e.concat([this.buffer,e.from(`${r} + +`),i])}}end(){return this.buffer=e.concat([this.buffer,e.from(` +--${this.boundary}--`)]),this.buffer}}t.exports=o}).call(e,i(14).Buffer)},function(t,e,i){function n(t){return o[t]||o.bin}function s(t){const e=r(t);return e?e.mime:o.bin}const o=i(61),r=i(60);t.exports={buffer:s,lookup:n}},function(t,e){function i(t){const e=new Uint8Array(t);if(!(e&&e.length>1))return null;if(255===e[0]&&216===e[1]&&255===e[2])return{ext:"jpg",mime:"image/jpeg"};if(137===e[0]&&80===e[1]&&78===e[2]&&71===e[3])return{ext:"png",mime:"image/png"};if(71===e[0]&&73===e[1]&&70===e[2])return{ext:"gif",mime:"image/gif"};if(87===e[8]&&69===e[9]&&66===e[10]&&80===e[11])return{ext:"webp",mime:"image/webp"};if(70===e[0]&&76===e[1]&&73===e[2]&&70===e[3])return{ext:"flif",mime:"image/flif"};if((73===e[0]&&73===e[1]&&42===e[2]&&0===e[3]||77===e[0]&&77===e[1]&&0===e[2]&&42===e[3])&&67===e[8]&&82===e[9])return{ext:"cr2",mime:"image/x-canon-cr2"};if(73===e[0]&&73===e[1]&&42===e[2]&&0===e[3]||77===e[0]&&77===e[1]&&0===e[2]&&42===e[3])return{ext:"tif",mime:"image/tiff"};if(66===e[0]&&77===e[1])return{ext:"bmp",mime:"image/bmp"};if(73===e[0]&&73===e[1]&&188===e[2])return{ext:"jxr",mime:"image/vnd.ms-photo"};if(56===e[0]&&66===e[1]&&80===e[2]&&83===e[3])return{ext:"psd",mime:"image/vnd.adobe.photoshop"};if(80===e[0]&&75===e[1]&&3===e[2]&&4===e[3]&&109===e[30]&&105===e[31]&&109===e[32]&&101===e[33]&&116===e[34]&&121===e[35]&&112===e[36]&&101===e[37]&&97===e[38]&&112===e[39]&&112===e[40]&&108===e[41]&&105===e[42]&&99===e[43]&&97===e[44]&&116===e[45]&&105===e[46]&&111===e[47]&&110===e[48]&&47===e[49]&&101===e[50]&&112===e[51]&&117===e[52]&&98===e[53]&&43===e[54]&&122===e[55]&&105===e[56]&&112===e[57])return{ext:"epub",mime:"application/epub+zip"};if(80===e[0]&&75===e[1]&&3===e[2]&&4===e[3]&&77===e[30]&&69===e[31]&&84===e[32]&&65===e[33]&&45===e[34]&&73===e[35]&&78===e[36]&&70===e[37]&&47===e[38]&&109===e[39]&&111===e[40]&&122===e[41]&&105===e[42]&&108===e[43]&&108===e[44]&&97===e[45]&&46===e[46]&&114===e[47]&&115===e[48]&&97===e[49])return{ext:"xpi",mime:"application/x-xpinstall"};if(!(80!==e[0]||75!==e[1]||3!==e[2]&&5!==e[2]&&7!==e[2]||4!==e[3]&&6!==e[3]&&8!==e[3]))return{ext:"zip",mime:"application/zip"};if(117===e[257]&&115===e[258]&&116===e[259]&&97===e[260]&&114===e[261])return{ext:"tar",mime:"application/x-tar"};if(82===e[0]&&97===e[1]&&114===e[2]&&33===e[3]&&26===e[4]&&7===e[5]&&(0===e[6]||1===e[6]))return{ext:"rar",mime:"application/x-rar-compressed"};if(31===e[0]&&139===e[1]&&8===e[2])return{ext:"gz",mime:"application/gzip"};if(66===e[0]&&90===e[1]&&104===e[2])return{ext:"bz2",mime:"application/x-bzip2"};if(55===e[0]&&122===e[1]&&188===e[2]&&175===e[3]&&39===e[4]&&28===e[5])return{ext:"7z",mime:"application/x-7z-compressed"};if(120===e[0]&&1===e[1])return{ext:"dmg",mime:"application/x-apple-diskimage"};if(0===e[0]&&0===e[1]&&0===e[2]&&(24===e[3]||32===e[3])&&102===e[4]&&116===e[5]&&121===e[6]&&112===e[7]||51===e[0]&&103===e[1]&&112===e[2]&&53===e[3]||0===e[0]&&0===e[1]&&0===e[2]&&28===e[3]&&102===e[4]&&116===e[5]&&121===e[6]&&112===e[7]&&109===e[8]&&112===e[9]&&52===e[10]&&50===e[11]&&109===e[16]&&112===e[17]&&52===e[18]&&49===e[19]&&109===e[20]&&112===e[21]&&52===e[22]&&50===e[23]&&105===e[24]&&115===e[25]&&111===e[26]&&109===e[27]||0===e[0]&&0===e[1]&&0===e[2]&&28===e[3]&&102===e[4]&&116===e[5]&&121===e[6]&&112===e[7]&&105===e[8]&&115===e[9]&&111===e[10]&&109===e[11]||0===e[0]&&0===e[1]&&0===e[2]&&28===e[3]&&102===e[4]&&116===e[5]&&121===e[6]&&112===e[7]&&109===e[8]&&112===e[9]&&52===e[10]&&50===e[11]&&0===e[12]&&0===e[13]&&0===e[14]&&0===e[15])return{ext:"mp4",mime:"video/mp4"};if(0===e[0]&&0===e[1]&&0===e[2]&&28===e[3]&&102===e[4]&&116===e[5]&&121===e[6]&&112===e[7]&&77===e[8]&&52===e[9]&&86===e[10])return{ext:"m4v",mime:"video/x-m4v"};if(77===e[0]&&84===e[1]&&104===e[2]&&100===e[3])return{ext:"mid",mime:"audio/midi"};if(26===e[0]&&69===e[1]&&223===e[2]&&163===e[3]){const t=e.subarray(4,4100),i=t.findIndex((t,e,i)=>66===i[e]&&130===i[e+1]);if(i>=0){const e=i+3,n=i=>Array.from(i).every((i,n)=>t[e+n]===i.charCodeAt(0));if(n("matroska"))return{ext:"mkv",mime:"video/x-matroska"};if(n("webm"))return{ext:"webm",mime:"video/webm"}}}return 0===e[0]&&0===e[1]&&0===e[2]&&20===e[3]&&102===e[4]&&116===e[5]&&121===e[6]&&112===e[7]?{ext:"mov",mime:"video/quicktime"}:82===e[0]&&73===e[1]&&70===e[2]&&70===e[3]&&65===e[8]&&86===e[9]&&73===e[10]?{ext:"avi",mime:"video/x-msvideo"}:48===e[0]&&38===e[1]&&178===e[2]&&117===e[3]&&142===e[4]&&102===e[5]&&207===e[6]&&17===e[7]&&166===e[8]&&217===e[9]?{ext:"wmv",mime:"video/x-ms-wmv"}:0===e[0]&&0===e[1]&&1===e[2]&&"b"===e[3].toString(16)[0]?{ext:"mpg",mime:"video/mpeg"}:73===e[0]&&68===e[1]&&51===e[2]||255===e[0]&&251===e[1]?{ext:"mp3",mime:"audio/mpeg"}:102===e[4]&&116===e[5]&&121===e[6]&&112===e[7]&&77===e[8]&&52===e[9]&&65===e[10]||77===e[0]&&52===e[1]&&65===e[2]&&32===e[3]?{ext:"m4a",mime:"audio/m4a"}:79===e[28]&&112===e[29]&&117===e[30]&&115===e[31]&&72===e[32]&&101===e[33]&&97===e[34]&&100===e[35]?{ext:"opus",mime:"audio/opus"}:79===e[0]&&103===e[1]&&103===e[2]&&83===e[3]?{ext:"ogg",mime:"audio/ogg"}:102===e[0]&&76===e[1]&&97===e[2]&&67===e[3]?{ext:"flac",mime:"audio/x-flac"}:82===e[0]&&73===e[1]&&70===e[2]&&70===e[3]&&87===e[8]&&65===e[9]&&86===e[10]&&69===e[11]?{ext:"wav",mime:"audio/x-wav"}:35===e[0]&&33===e[1]&&65===e[2]&&77===e[3]&&82===e[4]&&10===e[5]?{ext:"amr",mime:"audio/amr"}:37===e[0]&&80===e[1]&&68===e[2]&&70===e[3]?{ext:"pdf",mime:"application/pdf"}:77===e[0]&&90===e[1]?{ext:"exe",mime:"application/x-msdownload"}:67!==e[0]&&70!==e[0]||87!==e[1]||83!==e[2]?123===e[0]&&92===e[1]&&114===e[2]&&116===e[3]&&102===e[4]?{ext:"rtf",mime:"application/rtf"}:119===e[0]&&79===e[1]&&70===e[2]&&70===e[3]&&(0===e[4]&&1===e[5]&&0===e[6]&&0===e[7]||79===e[4]&&84===e[5]&&84===e[6]&&79===e[7])?{ext:"woff",mime:"application/font-woff"}:119===e[0]&&79===e[1]&&70===e[2]&&50===e[3]&&(0===e[4]&&1===e[5]&&0===e[6]&&0===e[7]||79===e[4]&&84===e[5]&&84===e[6]&&79===e[7])?{ext:"woff2",mime:"application/font-woff"}:76===e[34]&&80===e[35]&&(0===e[8]&&0===e[9]&&1===e[10]||1===e[8]&&0===e[9]&&2===e[10]||2===e[8]&&0===e[9]&&2===e[10])?{ext:"eot",mime:"application/octet-stream"}:0===e[0]&&1===e[1]&&0===e[2]&&0===e[3]&&0===e[4]?{ext:"ttf",mime:"application/font-sfnt"}:79===e[0]&&84===e[1]&&84===e[2]&&79===e[3]&&0===e[4]?{ext:"otf",mime:"application/font-sfnt"}:0===e[0]&&0===e[1]&&1===e[2]&&0===e[3]?{ext:"ico",mime:"image/x-icon"}:70===e[0]&&76===e[1]&&86===e[2]&&1===e[3]?{ext:"flv",mime:"video/x-flv"}:37===e[0]&&33===e[1]?{ext:"ps",mime:"application/postscript"}:253===e[0]&&55===e[1]&&122===e[2]&&88===e[3]&&90===e[4]&&0===e[5]?{ext:"xz",mime:"application/x-xz"}:83===e[0]&&81===e[1]&&76===e[2]&&105===e[3]?{ext:"sqlite",mime:"application/x-sqlite3"}:78===e[0]&&69===e[1]&&83===e[2]&&26===e[3]?{ext:"nes",mime:"application/x-nintendo-nes-rom"}:67===e[0]&&114===e[1]&&50===e[2]&&52===e[3]?{ext:"crx",mime:"application/x-google-chrome-extension"}:77===e[0]&&83===e[1]&&67===e[2]&&70===e[3]||73===e[0]&&83===e[1]&&99===e[2]&&40===e[3]?{ext:"cab",mime:"application/vnd.ms-cab-compressed"}:33===e[0]&&60===e[1]&&97===e[2]&&114===e[3]&&99===e[4]&&104===e[5]&&62===e[6]&&10===e[7]&&100===e[8]&&101===e[9]&&98===e[10]&&105===e[11]&&97===e[12]&&110===e[13]&&45===e[14]&&98===e[15]&&105===e[16]&&110===e[17]&&97===e[18]&&114===e[19]&&121===e[20]?{ext:"deb",mime:"application/x-deb"}:33===e[0]&&60===e[1]&&97===e[2]&&114===e[3]&&99===e[4]&&104===e[5]&&62===e[6]?{ext:"ar",mime:"application/x-unix-archive"}:237===e[0]&&171===e[1]&&238===e[2]&&219===e[3]?{ext:"rpm",mime:"application/x-rpm"}:31===e[0]&&160===e[1]||31===e[0]&&157===e[1]?{ext:"Z",mime:"application/x-compress"}:76===e[0]&&90===e[1]&&73===e[2]&&80===e[3]?{ext:"lz",mime:"application/x-lzip"}:208===e[0]&&207===e[1]&&17===e[2]&&224===e[3]&&161===e[4]&&177===e[5]&&26===e[6]&&225===e[7]?{ext:"msi",mime:"application/x-msi"}:6===e[0]&&14===e[1]&&43===e[2]&&52===e[3]&&2===e[4]&&5===e[5]&&1===e[6]&&1===e[7]&&13===e[8]&&1===e[9]&&2===e[10]&&1===e[11]&&1===e[12]&&2===e[13]?{ext:"mxf",mime:"application/mxf"}:null:{ext:"swf",mime:"application/x-shockwave-flash"}}t.exports=i},function(t,e){t.exports={123:"application/vnd.lotus-1-2-3",ez:"application/andrew-inset",aw:"application/applixware",atom:"application/atom+xml",atomcat:"application/atomcat+xml",atomsvc:"application/atomsvc+xml",bdoc:"application/x-bdoc",ccxml:"application/ccxml+xml",cdmia:"application/cdmi-capability",cdmic:"application/cdmi-container",cdmid:"application/cdmi-domain",cdmio:"application/cdmi-object",cdmiq:"application/cdmi-queue",cu:"application/cu-seeme",mpd:"application/dash+xml",davmount:"application/davmount+xml",dbk:"application/docbook+xml",dssc:"application/dssc+der",xdssc:"application/dssc+xml",ecma:"application/ecmascript",emma:"application/emma+xml",epub:"application/epub+zip",exi:"application/exi",pfr:"application/font-tdpfr",woff:"application/font-woff",woff2:"application/font-woff2",geojson:"application/geo+json",gml:"application/gml+xml",gpx:"application/gpx+xml",gxf:"application/gxf",stk:"application/hyperstudio",ink:"application/inkml+xml",inkml:"application/inkml+xml",ipfix:"application/ipfix",jar:"application/java-archive",war:"application/java-archive",ear:"application/java-archive",ser:"application/java-serialized-object",class:"application/java-vm",js:"application/javascript",json:"application/json",map:"application/json",json5:"application/json5",jsonml:"application/jsonml+json",jsonld:"application/ld+json",lostxml:"application/lost+xml",hqx:"application/mac-binhex40",cpt:"application/mac-compactpro",mads:"application/mads+xml",webmanifest:"application/manifest+json",mrc:"application/marc",mrcx:"application/marcxml+xml",ma:"application/mathematica",nb:"application/mathematica",mb:"application/mathematica",mathml:"application/mathml+xml",mbox:"application/mbox",mscml:"application/mediaservercontrol+xml",metalink:"application/metalink+xml",meta4:"application/metalink4+xml",mets:"application/mets+xml",mods:"application/mods+xml",m21:"application/mp21",mp21:"application/mp21",mp4s:"application/mp4",m4p:"application/mp4",doc:"application/msword",dot:"application/msword",mxf:"application/mxf",bin:"application/octet-stream",dms:"application/octet-stream",lrf:"application/octet-stream",mar:"application/octet-stream",so:"application/octet-stream",dist:"application/octet-stream",distz:"application/octet-stream",pkg:"application/octet-stream",bpk:"application/octet-stream",dump:"application/octet-stream",elc:"application/octet-stream",deploy:"application/octet-stream",exe:"application/x-msdownload",dll:"application/x-msdownload",deb:"application/x-debian-package",dmg:"application/x-apple-diskimage",iso:"application/x-iso9660-image",img:"application/octet-stream",msi:"application/x-msdownload",msp:"application/octet-stream",msm:"application/octet-stream",buffer:"application/octet-stream",oda:"application/oda",opf:"application/oebps-package+xml",ogx:"application/ogg",omdoc:"application/omdoc+xml",onetoc:"application/onenote",onetoc2:"application/onenote",onetmp:"application/onenote",onepkg:"application/onenote",oxps:"application/oxps",xer:"application/patch-ops-error+xml",pdf:"application/pdf",pgp:"application/pgp-encrypted",asc:"application/pgp-signature",sig:"application/pgp-signature",prf:"application/pics-rules",p10:"application/pkcs10",p7m:"application/pkcs7-mime",p7c:"application/pkcs7-mime",p7s:"application/pkcs7-signature",p8:"application/pkcs8",ac:"application/pkix-attr-cert",cer:"application/pkix-cert",crl:"application/pkix-crl",pkipath:"application/pkix-pkipath",pki:"application/pkixcmp",pls:"application/pls+xml",ai:"application/postscript",eps:"application/postscript",ps:"application/postscript",cww:"application/prs.cww",pskcxml:"application/pskc+xml",rdf:"application/rdf+xml",rif:"application/reginfo+xml",rnc:"application/relax-ng-compact-syntax",rl:"application/resource-lists+xml",rld:"application/resource-lists-diff+xml",rs:"application/rls-services+xml",gbr:"application/rpki-ghostbusters",mft:"application/rpki-manifest",roa:"application/rpki-roa",rsd:"application/rsd+xml",rss:"application/rss+xml",rtf:"text/rtf",sbml:"application/sbml+xml",scq:"application/scvp-cv-request",scs:"application/scvp-cv-response",spq:"application/scvp-vp-request",spp:"application/scvp-vp-response",sdp:"application/sdp",setpay:"application/set-payment-initiation",setreg:"application/set-registration-initiation",shf:"application/shf+xml",smi:"application/smil+xml",smil:"application/smil+xml",rq:"application/sparql-query",srx:"application/sparql-results+xml",gram:"application/srgs",grxml:"application/srgs+xml",sru:"application/sru+xml",ssdl:"application/ssdl+xml",ssml:"application/ssml+xml",tei:"application/tei+xml",teicorpus:"application/tei+xml",tfi:"application/thraud+xml",tsd:"application/timestamped-data",plb:"application/vnd.3gpp.pic-bw-large",psb:"application/vnd.3gpp.pic-bw-small",pvb:"application/vnd.3gpp.pic-bw-var",tcap:"application/vnd.3gpp2.tcap",pwn:"application/vnd.3m.post-it-notes",aso:"application/vnd.accpac.simply.aso",imp:"application/vnd.accpac.simply.imp",acu:"application/vnd.acucobol",atc:"application/vnd.acucorp",acutc:"application/vnd.acucorp",air:"application/vnd.adobe.air-application-installer-package+zip",fcdt:"application/vnd.adobe.formscentral.fcdt",fxp:"application/vnd.adobe.fxp",fxpl:"application/vnd.adobe.fxp",xdp:"application/vnd.adobe.xdp+xml",xfdf:"application/vnd.adobe.xfdf",ahead:"application/vnd.ahead.space",azf:"application/vnd.airzip.filesecure.azf",azs:"application/vnd.airzip.filesecure.azs",azw:"application/vnd.amazon.ebook",acc:"application/vnd.americandynamics.acc",ami:"application/vnd.amiga.ami",apk:"application/vnd.android.package-archive",cii:"application/vnd.anser-web-certificate-issue-initiation",fti:"application/vnd.anser-web-funds-transfer-initiation",atx:"application/vnd.antix.game-component",mpkg:"application/vnd.apple.installer+xml",m3u8:"application/vnd.apple.mpegurl",pkpass:"application/vnd.apple.pkpass",swi:"application/vnd.aristanetworks.swi",iota:"application/vnd.astraea-software.iota",aep:"application/vnd.audiograph",mpm:"application/vnd.blueice.multipass",bmi:"application/vnd.bmi",rep:"application/vnd.businessobjects",cdxml:"application/vnd.chemdraw+xml",mmd:"application/vnd.chipnuts.karaoke-mmd",cdy:"application/vnd.cinderella",cla:"application/vnd.claymore",rp9:"application/vnd.cloanto.rp9",c4g:"application/vnd.clonk.c4group",c4d:"application/vnd.clonk.c4group",c4f:"application/vnd.clonk.c4group",c4p:"application/vnd.clonk.c4group",c4u:"application/vnd.clonk.c4group",c11amc:"application/vnd.cluetrust.cartomobile-config",c11amz:"application/vnd.cluetrust.cartomobile-config-pkg",csp:"application/vnd.commonspace",cdbcmsg:"application/vnd.contact.cmsg",cmc:"application/vnd.cosmocaller",clkx:"application/vnd.crick.clicker",clkk:"application/vnd.crick.clicker.keyboard",clkp:"application/vnd.crick.clicker.palette",clkt:"application/vnd.crick.clicker.template",clkw:"application/vnd.crick.clicker.wordbank",wbs:"application/vnd.criticaltools.wbs+xml",pml:"application/vnd.ctc-posml",ppd:"application/vnd.cups-ppd",car:"application/vnd.curl.car",pcurl:"application/vnd.curl.pcurl",dart:"application/vnd.dart",rdz:"application/vnd.data-vision.rdz",uvf:"application/vnd.dece.data",uvvf:"application/vnd.dece.data",uvd:"application/vnd.dece.data",uvvd:"application/vnd.dece.data",uvt:"application/vnd.dece.ttml+xml",uvvt:"application/vnd.dece.ttml+xml",uvx:"application/vnd.dece.unspecified",uvvx:"application/vnd.dece.unspecified",uvz:"application/vnd.dece.zip",uvvz:"application/vnd.dece.zip",fe_launch:"application/vnd.denovo.fcselayout-link",dna:"application/vnd.dna",mlp:"application/vnd.dolby.mlp",dpg:"application/vnd.dpgraph",dfac:"application/vnd.dreamfactory",kpxx:"application/vnd.ds-keypoint",ait:"application/vnd.dvb.ait",svc:"application/vnd.dvb.service",geo:"application/vnd.dynageo",mag:"application/vnd.ecowin.chart",nml:"application/vnd.enliven",esf:"application/vnd.epson.esf",msf:"application/vnd.epson.msf",qam:"application/vnd.epson.quickanime",slt:"application/vnd.epson.salt",ssf:"application/vnd.epson.ssf",es3:"application/vnd.eszigno3+xml",et3:"application/vnd.eszigno3+xml",ez2:"application/vnd.ezpix-album",ez3:"application/vnd.ezpix-package",fdf:"application/vnd.fdf",mseed:"application/vnd.fdsn.mseed",seed:"application/vnd.fdsn.seed",dataless:"application/vnd.fdsn.seed",gph:"application/vnd.flographit",ftc:"application/vnd.fluxtime.clip",fm:"application/vnd.framemaker",frame:"application/vnd.framemaker",maker:"application/vnd.framemaker",book:"application/vnd.framemaker",fnc:"application/vnd.frogans.fnc",ltf:"application/vnd.frogans.ltf",fsc:"application/vnd.fsc.weblaunch",oas:"application/vnd.fujitsu.oasys",oa2:"application/vnd.fujitsu.oasys2",oa3:"application/vnd.fujitsu.oasys3",fg5:"application/vnd.fujitsu.oasysgp",bh2:"application/vnd.fujitsu.oasysprs",ddd:"application/vnd.fujixerox.ddd",xdw:"application/vnd.fujixerox.docuworks",xbd:"application/vnd.fujixerox.docuworks.binder",fzs:"application/vnd.fuzzysheet",txd:"application/vnd.genomatix.tuxedo",ggb:"application/vnd.geogebra.file",ggt:"application/vnd.geogebra.tool",gex:"application/vnd.geometry-explorer",gre:"application/vnd.geometry-explorer",gxt:"application/vnd.geonext",g2w:"application/vnd.geoplan",g3w:"application/vnd.geospace",gmx:"application/vnd.gmx",gdoc:"application/vnd.google-apps.document",gslides:"application/vnd.google-apps.presentation",gsheet:"application/vnd.google-apps.spreadsheet",kml:"application/vnd.google-earth.kml+xml",kmz:"application/vnd.google-earth.kmz",gqf:"application/vnd.grafeq",gqs:"application/vnd.grafeq",gac:"application/vnd.groove-account",ghf:"application/vnd.groove-help",gim:"application/vnd.groove-identity-message",grv:"application/vnd.groove-injector",gtm:"application/vnd.groove-tool-message",tpl:"application/vnd.groove-tool-template",vcg:"application/vnd.groove-vcard",hal:"application/vnd.hal+xml",zmm:"application/vnd.handheld-entertainment+xml",hbci:"application/vnd.hbci",les:"application/vnd.hhe.lesson-player",hpgl:"application/vnd.hp-hpgl",hpid:"application/vnd.hp-hpid",hps:"application/vnd.hp-hps",jlt:"application/vnd.hp-jlyt",pcl:"application/vnd.hp-pcl",pclxl:"application/vnd.hp-pclxl","sfd-hdstx":"application/vnd.hydrostatix.sof-data",mpy:"application/vnd.ibm.minipay",afp:"application/vnd.ibm.modcap",listafp:"application/vnd.ibm.modcap",list3820:"application/vnd.ibm.modcap",irm:"application/vnd.ibm.rights-management",sc:"application/vnd.ibm.secure-container",icc:"application/vnd.iccprofile",icm:"application/vnd.iccprofile",igl:"application/vnd.igloader",ivp:"application/vnd.immervision-ivp",ivu:"application/vnd.immervision-ivu",igm:"application/vnd.insors.igm",xpw:"application/vnd.intercon.formnet",xpx:"application/vnd.intercon.formnet",i2g:"application/vnd.intergeo",qbo:"application/vnd.intu.qbo",qfx:"application/vnd.intu.qfx",rcprofile:"application/vnd.ipunplugged.rcprofile",irp:"application/vnd.irepository.package+xml",xpr:"application/vnd.is-xpr",fcs:"application/vnd.isac.fcs",jam:"application/vnd.jam",rms:"application/vnd.jcp.javame.midlet-rms",jisp:"application/vnd.jisp",joda:"application/vnd.joost.joda-archive",ktz:"application/vnd.kahootz",ktr:"application/vnd.kahootz",karbon:"application/vnd.kde.karbon",chrt:"application/vnd.kde.kchart",kfo:"application/vnd.kde.kformula",flw:"application/vnd.kde.kivio",kon:"application/vnd.kde.kontour",kpr:"application/vnd.kde.kpresenter",kpt:"application/vnd.kde.kpresenter",ksp:"application/vnd.kde.kspread",kwd:"application/vnd.kde.kword",kwt:"application/vnd.kde.kword",htke:"application/vnd.kenameaapp",kia:"application/vnd.kidspiration",kne:"application/vnd.kinar",knp:"application/vnd.kinar",skp:"application/vnd.koan",skd:"application/vnd.koan",skt:"application/vnd.koan",skm:"application/vnd.koan",sse:"application/vnd.kodak-descriptor",lasxml:"application/vnd.las.las+xml",lbd:"application/vnd.llamagraphics.life-balance.desktop",lbe:"application/vnd.llamagraphics.life-balance.exchange+xml",apr:"application/vnd.lotus-approach",pre:"application/vnd.lotus-freelance",nsf:"application/vnd.lotus-notes",org:"application/vnd.lotus-organizer",scm:"application/vnd.lotus-screencam",lwp:"application/vnd.lotus-wordpro",portpkg:"application/vnd.macports.portpkg",mcd:"application/vnd.mcd",mc1:"application/vnd.medcalcdata",cdkey:"application/vnd.mediastation.cdkey",mwf:"application/vnd.mfer",mfm:"application/vnd.mfmp",flo:"application/vnd.micrografx.flo",igx:"application/vnd.micrografx.igx",mif:"application/vnd.mif",daf:"application/vnd.mobius.daf",dis:"application/vnd.mobius.dis",mbk:"application/vnd.mobius.mbk",mqy:"application/vnd.mobius.mqy",msl:"application/vnd.mobius.msl",plc:"application/vnd.mobius.plc",txf:"application/vnd.mobius.txf",mpn:"application/vnd.mophun.application",mpc:"application/vnd.mophun.certificate",xul:"application/vnd.mozilla.xul+xml",cil:"application/vnd.ms-artgalry",cab:"application/vnd.ms-cab-compressed",xls:"application/vnd.ms-excel",xlm:"application/vnd.ms-excel",xla:"application/vnd.ms-excel",xlc:"application/vnd.ms-excel",xlt:"application/vnd.ms-excel",xlw:"application/vnd.ms-excel",xlam:"application/vnd.ms-excel.addin.macroenabled.12",xlsb:"application/vnd.ms-excel.sheet.binary.macroenabled.12",xlsm:"application/vnd.ms-excel.sheet.macroenabled.12",xltm:"application/vnd.ms-excel.template.macroenabled.12",eot:"application/vnd.ms-fontobject",chm:"application/vnd.ms-htmlhelp",ims:"application/vnd.ms-ims",lrm:"application/vnd.ms-lrm",thmx:"application/vnd.ms-officetheme",cat:"application/vnd.ms-pki.seccat",stl:"application/vnd.ms-pki.stl",ppt:"application/vnd.ms-powerpoint",pps:"application/vnd.ms-powerpoint",pot:"application/vnd.ms-powerpoint",ppam:"application/vnd.ms-powerpoint.addin.macroenabled.12",pptm:"application/vnd.ms-powerpoint.presentation.macroenabled.12",sldm:"application/vnd.ms-powerpoint.slide.macroenabled.12",ppsm:"application/vnd.ms-powerpoint.slideshow.macroenabled.12",potm:"application/vnd.ms-powerpoint.template.macroenabled.12",mpp:"application/vnd.ms-project",mpt:"application/vnd.ms-project",docm:"application/vnd.ms-word.document.macroenabled.12",dotm:"application/vnd.ms-word.template.macroenabled.12",wps:"application/vnd.ms-works",wks:"application/vnd.ms-works",wcm:"application/vnd.ms-works",wdb:"application/vnd.ms-works",wpl:"application/vnd.ms-wpl",xps:"application/vnd.ms-xpsdocument",mseq:"application/vnd.mseq",mus:"application/vnd.musician",msty:"application/vnd.muvee.style",taglet:"application/vnd.mynfc",nlu:"application/vnd.neurolanguage.nlu",ntf:"application/vnd.nitf",nitf:"application/vnd.nitf",nnd:"application/vnd.noblenet-directory",nns:"application/vnd.noblenet-sealer",nnw:"application/vnd.noblenet-web",ngdat:"application/vnd.nokia.n-gage.data","n-gage":"application/vnd.nokia.n-gage.symbian.install",rpst:"application/vnd.nokia.radio-preset",rpss:"application/vnd.nokia.radio-presets",edm:"application/vnd.novadigm.edm",edx:"application/vnd.novadigm.edx",ext:"application/vnd.novadigm.ext",odc:"application/vnd.oasis.opendocument.chart",otc:"application/vnd.oasis.opendocument.chart-template",odb:"application/vnd.oasis.opendocument.database",odf:"application/vnd.oasis.opendocument.formula",odft:"application/vnd.oasis.opendocument.formula-template",odg:"application/vnd.oasis.opendocument.graphics",otg:"application/vnd.oasis.opendocument.graphics-template",odi:"application/vnd.oasis.opendocument.image",oti:"application/vnd.oasis.opendocument.image-template",odp:"application/vnd.oasis.opendocument.presentation",otp:"application/vnd.oasis.opendocument.presentation-template",ods:"application/vnd.oasis.opendocument.spreadsheet",ots:"application/vnd.oasis.opendocument.spreadsheet-template",odt:"application/vnd.oasis.opendocument.text",odm:"application/vnd.oasis.opendocument.text-master",ott:"application/vnd.oasis.opendocument.text-template",oth:"application/vnd.oasis.opendocument.text-web",xo:"application/vnd.olpc-sugar",dd2:"application/vnd.oma.dd2+xml",oxt:"application/vnd.openofficeorg.extension",pptx:"application/vnd.openxmlformats-officedocument.presentationml.presentation",sldx:"application/vnd.openxmlformats-officedocument.presentationml.slide",ppsx:"application/vnd.openxmlformats-officedocument.presentationml.slideshow",potx:"application/vnd.openxmlformats-officedocument.presentationml.template",xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",xltx:"application/vnd.openxmlformats-officedocument.spreadsheetml.template",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",dotx:"application/vnd.openxmlformats-officedocument.wordprocessingml.template",mgp:"application/vnd.osgeo.mapguide.package",dp:"application/vnd.osgi.dp",esa:"application/vnd.osgi.subsystem",pdb:"application/x-pilot",pqa:"application/vnd.palm",oprc:"application/vnd.palm",paw:"application/vnd.pawaafile",str:"application/vnd.pg.format",ei6:"application/vnd.pg.osasli",efif:"application/vnd.picsel",wg:"application/vnd.pmi.widget",plf:"application/vnd.pocketlearn",pbd:"application/vnd.powerbuilder6",box:"application/vnd.previewsystems.box",mgz:"application/vnd.proteus.magazine",qps:"application/vnd.publishare-delta-tree",ptid:"application/vnd.pvi.ptid1",qxd:"application/vnd.quark.quarkxpress",qxt:"application/vnd.quark.quarkxpress",qwd:"application/vnd.quark.quarkxpress",qwt:"application/vnd.quark.quarkxpress",qxl:"application/vnd.quark.quarkxpress",qxb:"application/vnd.quark.quarkxpress",bed:"application/vnd.realvnc.bed",mxl:"application/vnd.recordare.musicxml",musicxml:"application/vnd.recordare.musicxml+xml",cryptonote:"application/vnd.rig.cryptonote",cod:"application/vnd.rim.cod",rm:"application/vnd.rn-realmedia",rmvb:"application/vnd.rn-realmedia-vbr",link66:"application/vnd.route66.link66+xml",st:"application/vnd.sailingtracker.track",see:"application/vnd.seemail",sema:"application/vnd.sema",semd:"application/vnd.semd",semf:"application/vnd.semf",ifm:"application/vnd.shana.informed.formdata",itp:"application/vnd.shana.informed.formtemplate",iif:"application/vnd.shana.informed.interchange",ipk:"application/vnd.shana.informed.package",twd:"application/vnd.simtech-mindmapper",twds:"application/vnd.simtech-mindmapper",mmf:"application/vnd.smaf",teacher:"application/vnd.smart.teacher",sdkm:"application/vnd.solent.sdkm+xml",sdkd:"application/vnd.solent.sdkm+xml",dxp:"application/vnd.spotfire.dxp",sfs:"application/vnd.spotfire.sfs",sdc:"application/vnd.stardivision.calc",sda:"application/vnd.stardivision.draw",sdd:"application/vnd.stardivision.impress",smf:"application/vnd.stardivision.math",sdw:"application/vnd.stardivision.writer",vor:"application/vnd.stardivision.writer",sgl:"application/vnd.stardivision.writer-global",smzip:"application/vnd.stepmania.package",sm:"application/vnd.stepmania.stepchart",sxc:"application/vnd.sun.xml.calc",stc:"application/vnd.sun.xml.calc.template",sxd:"application/vnd.sun.xml.draw",std:"application/vnd.sun.xml.draw.template",sxi:"application/vnd.sun.xml.impress",sti:"application/vnd.sun.xml.impress.template",sxm:"application/vnd.sun.xml.math",sxw:"application/vnd.sun.xml.writer",sxg:"application/vnd.sun.xml.writer.global",stw:"application/vnd.sun.xml.writer.template",sus:"application/vnd.sus-calendar",susp:"application/vnd.sus-calendar",svd:"application/vnd.svd",sis:"application/vnd.symbian.install",sisx:"application/vnd.symbian.install",xsm:"application/vnd.syncml+xml",bdm:"application/vnd.syncml.dm+wbxml",xdm:"application/vnd.syncml.dm+xml",tao:"application/vnd.tao.intent-module-archive",pcap:"application/vnd.tcpdump.pcap",cap:"application/vnd.tcpdump.pcap",dmp:"application/vnd.tcpdump.pcap",tmo:"application/vnd.tmobile-livetv",tpt:"application/vnd.trid.tpt",mxs:"application/vnd.triscape.mxs",tra:"application/vnd.trueapp",ufd:"application/vnd.ufdl",ufdl:"application/vnd.ufdl",utz:"application/vnd.uiq.theme",umj:"application/vnd.umajin",unityweb:"application/vnd.unity",uoml:"application/vnd.uoml+xml",vcx:"application/vnd.vcx",vsd:"application/vnd.visio",vst:"application/vnd.visio",vss:"application/vnd.visio",vsw:"application/vnd.visio",vis:"application/vnd.visionary",vsf:"application/vnd.vsf",wbxml:"application/vnd.wap.wbxml",wmlc:"application/vnd.wap.wmlc",wmlsc:"application/vnd.wap.wmlscriptc",wtb:"application/vnd.webturbo",nbp:"application/vnd.wolfram.player",wpd:"application/vnd.wordperfect",wqd:"application/vnd.wqd",stf:"application/vnd.wt.stf",xar:"application/vnd.xara",xfdl:"application/vnd.xfdl",hvd:"application/vnd.yamaha.hv-dic",hvs:"application/vnd.yamaha.hv-script",hvp:"application/vnd.yamaha.hv-voice",osf:"application/vnd.yamaha.openscoreformat",osfpvg:"application/vnd.yamaha.openscoreformat.osfpvg+xml",saf:"application/vnd.yamaha.smaf-audio",spf:"application/vnd.yamaha.smaf-phrase",cmp:"application/vnd.yellowriver-custom-menu",zir:"application/vnd.zul",zirz:"application/vnd.zul",zaz:"application/vnd.zzazz.deck+xml",vxml:"application/voicexml+xml",wgt:"application/widget",hlp:"application/winhlp",wsdl:"application/wsdl+xml",wspolicy:"application/wspolicy+xml","7z":"application/x-7z-compressed",abw:"application/x-abiword",ace:"application/x-ace-compressed",aab:"application/x-authorware-bin",x32:"application/x-authorware-bin",u32:"application/x-authorware-bin",vox:"application/x-authorware-bin",aam:"application/x-authorware-map",aas:"application/x-authorware-seg",bcpio:"application/x-bcpio",torrent:"application/x-bittorrent",blb:"application/x-blorb",blorb:"application/x-blorb",bz:"application/x-bzip",bz2:"application/x-bzip2",boz:"application/x-bzip2",cbr:"application/x-cbr",cba:"application/x-cbr",cbt:"application/x-cbr",cbz:"application/x-cbr",cb7:"application/x-cbr",vcd:"application/x-cdlink",cfs:"application/x-cfs-compressed",chat:"application/x-chat",pgn:"application/x-chess-pgn",crx:"application/x-chrome-extension",cco:"application/x-cocoa",nsc:"application/x-conference",cpio:"application/x-cpio",csh:"application/x-csh",udeb:"application/x-debian-package",dgc:"application/x-dgc-compressed",dir:"application/x-director",dcr:"application/x-director",dxr:"application/x-director",cst:"application/x-director",cct:"application/x-director",cxt:"application/x-director",w3d:"application/x-director",fgd:"application/x-director",swa:"application/x-director",wad:"application/x-doom",ncx:"application/x-dtbncx+xml",dtb:"application/x-dtbook+xml",res:"application/x-dtbresource+xml",dvi:"application/x-dvi",evy:"application/x-envoy",eva:"application/x-eva",bdf:"application/x-font-bdf",gsf:"application/x-font-ghostscript",psf:"application/x-font-linux-psf",otf:"font/opentype",pcf:"application/x-font-pcf",snf:"application/x-font-snf",ttf:"application/x-font-ttf",ttc:"application/x-font-ttf",pfa:"application/x-font-type1",pfb:"application/x-font-type1",pfm:"application/x-font-type1",afm:"application/x-font-type1",arc:"application/x-freearc",spl:"application/x-futuresplash",gca:"application/x-gca-compressed",ulx:"application/x-glulx",gnumeric:"application/x-gnumeric",gramps:"application/x-gramps-xml",gtar:"application/x-gtar",hdf:"application/x-hdf",php:"application/x-httpd-php",install:"application/x-install-instructions",jardiff:"application/x-java-archive-diff",jnlp:"application/x-java-jnlp-file",latex:"application/x-latex",luac:"application/x-lua-bytecode",lzh:"application/x-lzh-compressed",lha:"application/x-lzh-compressed",run:"application/x-makeself",mie:"application/x-mie",prc:"application/x-pilot",mobi:"application/x-mobipocket-ebook",application:"application/x-ms-application",lnk:"application/x-ms-shortcut",wmd:"application/x-ms-wmd",wmz:"application/x-msmetafile",xbap:"application/x-ms-xbap",mdb:"application/x-msaccess",obd:"application/x-msbinder",crd:"application/x-mscardfile",clp:"application/x-msclip",com:"application/x-msdownload",bat:"application/x-msdownload",mvb:"application/x-msmediaview",m13:"application/x-msmediaview",m14:"application/x-msmediaview",wmf:"application/x-msmetafile",emf:"application/x-msmetafile",emz:"application/x-msmetafile",mny:"application/x-msmoney",pub:"application/x-mspublisher", +scd:"application/x-msschedule",trm:"application/x-msterminal",wri:"application/x-mswrite",nc:"application/x-netcdf",cdf:"application/x-netcdf",pac:"application/x-ns-proxy-autoconfig",nzb:"application/x-nzb",pl:"application/x-perl",pm:"application/x-perl",p12:"application/x-pkcs12",pfx:"application/x-pkcs12",p7b:"application/x-pkcs7-certificates",spc:"application/x-pkcs7-certificates",p7r:"application/x-pkcs7-certreqresp",rar:"application/x-rar-compressed",rpm:"application/x-redhat-package-manager",ris:"application/x-research-info-systems",sea:"application/x-sea",sh:"application/x-sh",shar:"application/x-shar",swf:"application/x-shockwave-flash",xap:"application/x-silverlight-app",sql:"application/x-sql",sit:"application/x-stuffit",sitx:"application/x-stuffitx",srt:"application/x-subrip",sv4cpio:"application/x-sv4cpio",sv4crc:"application/x-sv4crc",t3:"application/x-t3vm-image",gam:"application/x-tads",tar:"application/x-tar",tcl:"application/x-tcl",tk:"application/x-tcl",tex:"application/x-tex",tfm:"application/x-tex-tfm",texinfo:"application/x-texinfo",texi:"application/x-texinfo",obj:"application/x-tgif",ustar:"application/x-ustar",src:"application/x-wais-source",webapp:"application/x-web-app-manifest+json",der:"application/x-x509-ca-cert",crt:"application/x-x509-ca-cert",pem:"application/x-x509-ca-cert",fig:"application/x-xfig",xlf:"application/x-xliff+xml",xpi:"application/x-xpinstall",xz:"application/x-xz",z1:"application/x-zmachine",z2:"application/x-zmachine",z3:"application/x-zmachine",z4:"application/x-zmachine",z5:"application/x-zmachine",z6:"application/x-zmachine",z7:"application/x-zmachine",z8:"application/x-zmachine",xaml:"application/xaml+xml",xdf:"application/xcap-diff+xml",xenc:"application/xenc+xml",xhtml:"application/xhtml+xml",xht:"application/xhtml+xml",xml:"text/xml",xsl:"application/xml",xsd:"application/xml",rng:"application/xml",dtd:"application/xml-dtd",xop:"application/xop+xml",xpl:"application/xproc+xml",xslt:"application/xslt+xml",xspf:"application/xspf+xml",mxml:"application/xv+xml",xhvml:"application/xv+xml",xvml:"application/xv+xml",xvm:"application/xv+xml",yang:"application/yang",yin:"application/yin+xml",zip:"application/zip","3gpp":"video/3gpp",adp:"audio/adpcm",au:"audio/basic",snd:"audio/basic",mid:"audio/midi",midi:"audio/midi",kar:"audio/midi",rmi:"audio/midi",mp3:"audio/mpeg",m4a:"audio/x-m4a",mp4a:"audio/mp4",mpga:"audio/mpeg",mp2:"audio/mpeg",mp2a:"audio/mpeg",m2a:"audio/mpeg",m3a:"audio/mpeg",oga:"audio/ogg",ogg:"audio/ogg",spx:"audio/ogg",s3m:"audio/s3m",sil:"audio/silk",uva:"audio/vnd.dece.audio",uvva:"audio/vnd.dece.audio",eol:"audio/vnd.digital-winds",dra:"audio/vnd.dra",dts:"audio/vnd.dts",dtshd:"audio/vnd.dts.hd",lvp:"audio/vnd.lucent.voice",pya:"audio/vnd.ms-playready.media.pya",ecelp4800:"audio/vnd.nuera.ecelp4800",ecelp7470:"audio/vnd.nuera.ecelp7470",ecelp9600:"audio/vnd.nuera.ecelp9600",rip:"audio/vnd.rip",wav:"audio/x-wav",weba:"audio/webm",aac:"audio/x-aac",aif:"audio/x-aiff",aiff:"audio/x-aiff",aifc:"audio/x-aiff",caf:"audio/x-caf",flac:"audio/x-flac",mka:"audio/x-matroska",m3u:"audio/x-mpegurl",wax:"audio/x-ms-wax",wma:"audio/x-ms-wma",ram:"audio/x-pn-realaudio",ra:"audio/x-realaudio",rmp:"audio/x-pn-realaudio-plugin",xm:"audio/xm",cdx:"chemical/x-cdx",cif:"chemical/x-cif",cmdf:"chemical/x-cmdf",cml:"chemical/x-cml",csml:"chemical/x-csml",xyz:"chemical/x-xyz",bmp:"image/x-ms-bmp",cgm:"image/cgm",g3:"image/g3fax",gif:"image/gif",ief:"image/ief",jpeg:"image/jpeg",jpg:"image/jpeg",jpe:"image/jpeg",ktx:"image/ktx",png:"image/png",btif:"image/prs.btif",sgi:"image/sgi",svg:"image/svg+xml",svgz:"image/svg+xml",tiff:"image/tiff",tif:"image/tiff",psd:"image/vnd.adobe.photoshop",uvi:"image/vnd.dece.graphic",uvvi:"image/vnd.dece.graphic",uvg:"image/vnd.dece.graphic",uvvg:"image/vnd.dece.graphic",djvu:"image/vnd.djvu",djv:"image/vnd.djvu",sub:"text/vnd.dvb.subtitle",dwg:"image/vnd.dwg",dxf:"image/vnd.dxf",fbs:"image/vnd.fastbidsheet",fpx:"image/vnd.fpx",fst:"image/vnd.fst",mmr:"image/vnd.fujixerox.edmics-mmr",rlc:"image/vnd.fujixerox.edmics-rlc",mdi:"image/vnd.ms-modi",wdp:"image/vnd.ms-photo",npx:"image/vnd.net-fpx",wbmp:"image/vnd.wap.wbmp",xif:"image/vnd.xiff",webp:"image/webp","3ds":"image/x-3ds",ras:"image/x-cmu-raster",cmx:"image/x-cmx",fh:"image/x-freehand",fhc:"image/x-freehand",fh4:"image/x-freehand",fh5:"image/x-freehand",fh7:"image/x-freehand",ico:"image/x-icon",jng:"image/x-jng",sid:"image/x-mrsid-image",pcx:"image/x-pcx",pic:"image/x-pict",pct:"image/x-pict",pnm:"image/x-portable-anymap",pbm:"image/x-portable-bitmap",pgm:"image/x-portable-graymap",ppm:"image/x-portable-pixmap",rgb:"image/x-rgb",tga:"image/x-tga",xbm:"image/x-xbitmap",xpm:"image/x-xpixmap",xwd:"image/x-xwindowdump",eml:"message/rfc822",mime:"message/rfc822",igs:"model/iges",iges:"model/iges",msh:"model/mesh",mesh:"model/mesh",silo:"model/mesh",dae:"model/vnd.collada+xml",dwf:"model/vnd.dwf",gdl:"model/vnd.gdl",gtw:"model/vnd.gtw",mts:"model/vnd.mts",vtu:"model/vnd.vtu",wrl:"model/vrml",vrml:"model/vrml",x3db:"model/x3d+binary",x3dbz:"model/x3d+binary",x3dv:"model/x3d+vrml",x3dvz:"model/x3d+vrml",x3d:"model/x3d+xml",x3dz:"model/x3d+xml",appcache:"text/cache-manifest",manifest:"text/cache-manifest",ics:"text/calendar",ifb:"text/calendar",coffee:"text/coffeescript",litcoffee:"text/coffeescript",css:"text/css",csv:"text/csv",hjson:"text/hjson",html:"text/html",htm:"text/html",shtml:"text/html",jade:"text/jade",jsx:"text/jsx",less:"text/less",mml:"text/mathml",n3:"text/n3",txt:"text/plain",text:"text/plain",conf:"text/plain",def:"text/plain",list:"text/plain",log:"text/plain",in:"text/plain",ini:"text/plain",dsc:"text/prs.lines.tag",rtx:"text/richtext",sgml:"text/sgml",sgm:"text/sgml",slim:"text/slim",slm:"text/slim",stylus:"text/stylus",styl:"text/stylus",tsv:"text/tab-separated-values",t:"text/troff",tr:"text/troff",roff:"text/troff",man:"text/troff",me:"text/troff",ms:"text/troff",ttl:"text/turtle",uri:"text/uri-list",uris:"text/uri-list",urls:"text/uri-list",vcard:"text/vcard",curl:"text/vnd.curl",dcurl:"text/vnd.curl.dcurl",mcurl:"text/vnd.curl.mcurl",scurl:"text/vnd.curl.scurl",fly:"text/vnd.fly",flx:"text/vnd.fmi.flexstor",gv:"text/vnd.graphviz","3dml":"text/vnd.in3d.3dml",spot:"text/vnd.in3d.spot",jad:"text/vnd.sun.j2me.app-descriptor",wml:"text/vnd.wap.wml",wmls:"text/vnd.wap.wmlscript",vtt:"text/vtt",s:"text/x-asm",asm:"text/x-asm",c:"text/x-c",cc:"text/x-c",cxx:"text/x-c",cpp:"text/x-c",h:"text/x-c",hh:"text/x-c",dic:"text/x-c",htc:"text/x-component",f:"text/x-fortran",for:"text/x-fortran",f77:"text/x-fortran",f90:"text/x-fortran",hbs:"text/x-handlebars-template",java:"text/x-java-source",lua:"text/x-lua",markdown:"text/x-markdown",md:"text/x-markdown",mkd:"text/x-markdown",nfo:"text/x-nfo",opml:"text/x-opml",p:"text/x-pascal",pas:"text/x-pascal",pde:"text/x-processing",sass:"text/x-sass",scss:"text/x-scss",etx:"text/x-setext",sfv:"text/x-sfv",ymp:"text/x-suse-ymp",uu:"text/x-uuencode",vcs:"text/x-vcalendar",vcf:"text/x-vcard",yaml:"text/yaml",yml:"text/yaml","3gp":"video/3gpp","3g2":"video/3gpp2",h261:"video/h261",h263:"video/h263",h264:"video/h264",jpgv:"video/jpeg",jpm:"video/jpm",jpgm:"video/jpm",mj2:"video/mj2",mjp2:"video/mj2",ts:"video/mp2t",mp4:"video/mp4",mp4v:"video/mp4",mpg4:"video/mp4",mpeg:"video/mpeg",mpg:"video/mpeg",mpe:"video/mpeg",m1v:"video/mpeg",m2v:"video/mpeg",ogv:"video/ogg",qt:"video/quicktime",mov:"video/quicktime",uvh:"video/vnd.dece.hd",uvvh:"video/vnd.dece.hd",uvm:"video/vnd.dece.mobile",uvvm:"video/vnd.dece.mobile",uvp:"video/vnd.dece.pd",uvvp:"video/vnd.dece.pd",uvs:"video/vnd.dece.sd",uvvs:"video/vnd.dece.sd",uvv:"video/vnd.dece.video",uvvv:"video/vnd.dece.video",dvb:"video/vnd.dvb.file",fvt:"video/vnd.fvt",mxu:"video/vnd.mpegurl",m4u:"video/vnd.mpegurl",pyv:"video/vnd.ms-playready.media.pyv",uvu:"video/vnd.uvvu.mp4",uvvu:"video/vnd.uvvu.mp4",viv:"video/vnd.vivo",webm:"video/webm",f4v:"video/x-f4v",fli:"video/x-fli",flv:"video/x-flv",m4v:"video/x-m4v",mkv:"video/x-matroska",mk3d:"video/x-matroska",mks:"video/x-matroska",mng:"video/x-mng",asf:"video/x-ms-asf",asx:"video/x-ms-asf",vob:"video/x-ms-vob",wm:"video/x-ms-wm",wmv:"video/x-ms-wmv",wmx:"video/x-ms-wmx",wvx:"video/x-ms-wvx",avi:"video/x-msvideo",movie:"video/x-sgi-movie",smv:"video/x-smv",ice:"x-conference/x-cooltalk"}},function(t,e){var i;i=function(){return this}();try{i=i||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(i=window)}t.exports=i},function(t,e,i){const n=i(0),s=i(4),o=i(17),r=i(11),a=i(30),c=i(12),l=i(40),u=i(41),h=i(18),p=i(21);class d{constructor(t){this.client=t}get pastReady(){return this.client.ws.status===n.Status.READY}newGuild(t){const e=this.client.guilds.has(t.id),i=new o(this.client,t);return this.client.guilds.set(i.id,i),this.pastReady&&!e&&(this.client.options.fetchAllMembers?i.fetchMembers().then(()=>{this.client.emit(n.Events.GUILD_CREATE,i)}):this.client.emit(n.Events.GUILD_CREATE,i)),i}newUser(t){if(this.client.users.has(t.id))return this.client.users.get(t.id);const e=new r(this.client,t);return this.client.users.set(e.id,e),e}newChannel(t,e){const i=this.client.channels.has(t.id);let s;return t.type===n.ChannelTypes.DM?s=new a(this.client,t):t.type===n.ChannelTypes.GROUP_DM?s=new p(this.client,t):(e=e||this.client.guilds.get(t.guild_id),e&&(t.type===n.ChannelTypes.TEXT?(s=new l(e,t),e.channels.set(s.id,s)):t.type===n.ChannelTypes.VOICE&&(s=new u(e,t),e.channels.set(s.id,s)))),s?(this.pastReady&&!i&&this.client.emit(n.Events.CHANNEL_CREATE,s),this.client.channels.set(s.id,s),s):null}newEmoji(t,e){const i=e.emojis.has(t.id);if(t&&!i){let i=new c(e,t);return this.client.emit(n.Events.GUILD_EMOJI_CREATE,i),e.emojis.set(i.id,i),i}return i?e.emojis.get(t.id):null}killEmoji(t){t instanceof c&&t.guild&&(this.client.emit(n.Events.GUILD_EMOJI_DELETE,t),t.guild.emojis.delete(t.id))}killGuild(t){const e=this.client.guilds.has(t.id);this.client.guilds.delete(t.id),e&&this.pastReady&&this.client.emit(n.Events.GUILD_DELETE,t)}killUser(t){this.client.users.delete(t.id)}killChannel(t){this.client.channels.delete(t.id),t instanceof h&&t.guild.channels.delete(t.id)}updateGuild(t,e){const i=s.cloneObject(t);t.setup(e),this.pastReady&&this.client.emit(n.Events.GUILD_UPDATE,i,t)}updateChannel(t,e){t.setup(e)}updateEmoji(t,e){const i=s.cloneObject(t);return t.setup(e),this.client.emit(n.Events.GUILD_EMOJI_UPDATE,i,t),t}}t.exports=d},function(t,e,i){const n=i(0);class s{constructor(t){this.client=t,this.heartbeatInterval=null}connectToWebSocket(t,e,i){this.client.emit(n.Events.DEBUG,`Authenticated using token ${t}`),this.client.token=t;const s=this.client.setTimeout(()=>i(new Error(n.Errors.TOOK_TOO_LONG)),3e5);this.client.rest.methods.getGateway().then(o=>{this.client.emit(n.Events.DEBUG,`Using gateway ${o}`),this.client.ws.connect(o),this.client.ws.once("close",t=>{4004===t.code&&i(new Error(n.Errors.BAD_LOGIN)),4010===t.code&&i(new Error(n.Errors.INVALID_SHARD)),4011===t.code&&i(new Error(n.Errors.SHARDING_REQUIRED))}),this.client.once(n.Events.READY,()=>{e(t),this.client.clearTimeout(s)})},i)}setupKeepAlive(t){this.heartbeatInterval=this.client.setInterval(()=>this.client.ws.heartbeat(!0),t)}destroy(){return this.client.ws.destroy(),this.client.user?this.client.user.bot?(this.client.token=null,Promise.resolve()):this.client.rest.methods.logout().then(()=>{this.client.token=null}):Promise.resolve()}}t.exports=s},function(t,e,i){class n{constructor(t){this.client=t,this.register(i(83)),this.register(i(84)),this.register(i(85)),this.register(i(89)),this.register(i(86)),this.register(i(87)),this.register(i(88)),this.register(i(66)),this.register(i(67)),this.register(i(68)),this.register(i(71)),this.register(i(82)),this.register(i(75)),this.register(i(76)),this.register(i(69)),this.register(i(77)),this.register(i(78)),this.register(i(79)),this.register(i(90)),this.register(i(92)),this.register(i(91)),this.register(i(81)),this.register(i(72)),this.register(i(73)),this.register(i(74)),this.register(i(80)),this.register(i(70))}register(t){this[t.name.replace(/Action$/,"")]=new t(this.client)}}t.exports=n},function(t,e,i){const n=i(2);class s extends n{handle(t){const e=this.client,i=e.dataManager.newChannel(t);return{channel:i}}}t.exports=s},function(t,e,i){const n=i(2);class s extends n{constructor(t){super(t),this.deleted=new Map}handle(t){const e=this.client;let i=e.channels.get(t.id);return i?(e.dataManager.killChannel(i),this.deleted.set(i.id,i),this.scheduleForDeletion(i.id)):i=this.deleted.get(t.id)||null,{channel:i}}scheduleForDeletion(t){this.client.setTimeout(()=>this.deleted.delete(t),this.client.options.restWsBridgeTimeout)}}t.exports=s},function(t,e,i){const n=i(2),s=i(0),o=i(4);class r extends n{handle(t){const e=this.client,i=e.channels.get(t.id);if(i){const n=o.cloneObject(i);return i.setup(t),e.emit(s.Events.CHANNEL_UPDATE,n,i),{old:n,updated:i}}return{old:null,updated:null}}}t.exports=r},function(t,e,i){const n=i(2),s=i(0);class o extends n{handle(t){const e=this.client,i=e.guilds.get(t.guild_id),n=e.dataManager.newUser(t.user);i&&n&&e.emit(s.Events.GUILD_BAN_REMOVE,i,n)}}t.exports=o},function(t,e,i){const n=i(2);class s extends n{handle(t){const e=this.client,i=e.guilds.get(t.guild_id);if(i)for(const n of t.channels){const t=i.channels.get(n.id);t&&(t.position=n.position)}return{guild:i}}}t.exports=s},function(t,e,i){const n=i(2),s=i(0);class o extends n{constructor(t){super(t),this.deleted=new Map}handle(t){const e=this.client;let i=e.guilds.get(t.id);if(i){for(const n of i.channels.values())"text"===n.type&&n.stopTyping(!0);if(i.available&&t.unavailable)return i.available=!1,e.emit(s.Events.GUILD_UNAVAILABLE,i),{guild:null};e.guilds.delete(i.id),this.deleted.set(i.id,i),this.scheduleForDeletion(i.id)}else i=this.deleted.get(t.id)||null;return{guild:i}}scheduleForDeletion(t){this.client.setTimeout(()=>this.deleted.delete(t),this.client.options.restWsBridgeTimeout)}}t.exports=o},function(t,e,i){const n=i(2);class s extends n{handle(t,e){const i=this.client,n=i.dataManager.newEmoji(e,t);return{emoji:n}}}t.exports=s},function(t,e,i){const n=i(2);class s extends n{handle(t){const e=this.client;return e.dataManager.killEmoji(t),{emoji:t}}}t.exports=s},function(t,e,i){const n=i(2);class s extends n{handle(t,e){const i=this.client.dataManager.updateEmoji(t,e);return{emoji:i}}}t.exports=s},function(t,e,i){const n=i(2);class s extends n{handle(t,e){const i=t._addMember(e,!1);return{member:i}}}t.exports=s},function(t,e,i){const n=i(2),s=i(0);class o extends n{constructor(t){super(t),this.deleted=new Map}handle(t){const e=this.client,i=e.guilds.get(t.guild_id);if(i){let n=i.members.get(t.user.id);return n?(i.memberCount--,i._removeMember(n),this.deleted.set(i.id+t.user.id,n),e.status===s.Status.READY&&e.emit(s.Events.GUILD_MEMBER_REMOVE,n),this.scheduleForDeletion(i.id,t.user.id)):n=this.deleted.get(i.id+t.user.id)||null,{guild:i,member:n}}return{guild:i,member:null}}scheduleForDeletion(t,e){this.client.setTimeout(()=>this.deleted.delete(t+e),this.client.options.restWsBridgeTimeout)}}t.exports=o},function(t,e,i){const n=i(2),s=i(0),o=i(10);class r extends n{handle(t){const e=this.client,i=e.guilds.get(t.guild_id);if(i){const n=i.roles.has(t.role.id),r=new o(i,t.role);return i.roles.set(r.id,r),n||e.emit(s.Events.GUILD_ROLE_CREATE,r),{role:r}}return{role:null}}}t.exports=r},function(t,e,i){const n=i(2),s=i(0);class o extends n{constructor(t){super(t),this.deleted=new Map}handle(t){const e=this.client,i=e.guilds.get(t.guild_id);if(i){let n=i.roles.get(t.role_id);return n?(i.roles.delete(t.role_id),this.deleted.set(i.id+t.role_id,n),this.scheduleForDeletion(i.id,t.role_id),e.emit(s.Events.GUILD_ROLE_DELETE,n)):n=this.deleted.get(i.id+t.role_id)||null,{role:n}}return{role:null}}scheduleForDeletion(t,e){this.client.setTimeout(()=>this.deleted.delete(t+e),this.client.options.restWsBridgeTimeout)}}t.exports=o},function(t,e,i){const n=i(2),s=i(0),o=i(4);class r extends n{handle(t){const e=this.client,i=e.guilds.get(t.guild_id);if(i){const n=t.role;let r=null;const a=i.roles.get(n.id);return a&&(r=o.cloneObject(a),a.setup(t.role),e.emit(s.Events.GUILD_ROLE_UPDATE,r,a)),{old:r,updated:a}}return{old:null,updated:null}}}t.exports=r},function(t,e,i){const n=i(2);class s extends n{handle(t){const e=this.client,i=e.guilds.get(t.guild_id);if(i)for(const n of t.roles){const t=i.roles.get(n.id);t&&(t.position=n.position)}return{guild:i}}}t.exports=s},function(t,e,i){const n=i(2);class s extends n{handle(t){const e=this.client,i=e.guilds.get(t.id);if(i){if(t.presences)for(const e of t.presences)i._setPresence(e.user.id,e);if(t.members)for(const n of t.members){const t=i.members.get(n.user.id);t?i._updateMember(t,n):i._addMember(n,!1)}"large"in t&&(i.large=t.large)}}}t.exports=s},function(t,e,i){const n=i(2),s=i(0),o=i(4);class r extends n{handle(t){const e=this.client,i=e.guilds.get(t.id);if(i){const n=o.cloneObject(i);return i.setup(t),e.emit(s.Events.GUILD_UPDATE,n,i),{old:n,updated:i}}return{old:null,updated:null}}}t.exports=r},function(t,e,i){const n=i(2),s=i(9);class o extends n{handle(t){const e=this.client,i=e.channels.get((t instanceof Array?t[0]:t).channel_id),n=e.users.get((t instanceof Array?t[0]:t).author.id);if(i){const o=i.guild?i.guild.member(n):null;if(t instanceof Array){const r=new Array(t.length);for(let a=0;athis.deleted.delete(t+e),this.client.options.restWsBridgeTimeout)}}t.exports=s},function(t,e,i){const n=i(2),s=i(3),o=i(0);class r extends n{handle(t){const e=this.client,i=e.channels.get(t.channel_id),n=t.ids,r=new s;for(const a of n){const t=i.messages.get(a);t&&r.set(t.id,t)}return r.size>0&&e.emit(o.Events.MESSAGE_BULK_DELETE,r),{messages:r}}}t.exports=r},function(t,e,i){const n=i(2),s=i(0);class o extends n{handle(t){const e=this.client.users.get(t.user_id);if(!e)return!1;const i=this.client.channels.get(t.channel_id);if(!i||"voice"===i.type)return!1;const n=i.messages.get(t.message_id);if(!n)return!1;if(!t.emoji)return!1;const o=n._addReaction(t.emoji,e);return o&&this.client.emit(s.Events.MESSAGE_REACTION_ADD,o,e),{message:n,reaction:o,user:e}}}t.exports=o},function(t,e,i){const n=i(2),s=i(0);class o extends n{handle(t){const e=this.client.users.get(t.user_id);if(!e)return!1;const i=this.client.channels.get(t.channel_id);if(!i||"voice"===i.type)return!1;const n=i.messages.get(t.message_id);if(!n)return!1;if(!t.emoji)return!1;const o=n._removeReaction(t.emoji,e);return o&&this.client.emit(s.Events.MESSAGE_REACTION_REMOVE,o,e),{message:n,reaction:o,user:e}}}t.exports=o},function(t,e,i){const n=i(2),s=i(0);class o extends n{handle(t){const e=this.client.channels.get(t.channel_id);if(!e||"voice"===e.type)return!1;const i=e.messages.get(t.message_id);return!!i&&(i._clearReactions(),this.client.emit(s.Events.MESSAGE_REACTION_REMOVE_ALL,i),{message:i})}}t.exports=o},function(t,e,i){const n=i(2),s=i(0),o=i(9);class r extends n{handle(t){const e=this.client,i=e.channels.get(t.channel_id);if(i){const n=i.messages.get(t.id);if(n){const r=new o(n.channel,this.patchDataPacket(t,n),e);return r._edits.push(n,...n._edits),r.reactions=n.reactions,i.messages.set(t.id,r),e.emit(s.Events.MESSAGE_UPDATE,n,r),{old:n,updated:r}}return{old:n,updated:n}}return{old:null,updated:null}}patchDataPacket(t,e){return t.type="type"in t?t.type:s.MessageTypes.indexOf(e.type),t.tts="tts"in t?t.tts:e.tts,t.timestamp="timestamp"in t?t.timestamp:e.createdAt.toString(),t.pinned="pinned"in t?t.pinned:e.pinned,t.nonce="nonce"in t?t.nonce:e.nonce,t.mentions="mentions"in t?t.mentions:e.mentions.users.keyArray(),t.mentions_roles="mentions_roles"in t?t.mentions_roles:e.mentions.roles.keyArray(),t.mention_everyone="mention_everyone"in t?t.mention_everyone:e.mentions.everyone,t.embeds="embeds"in t?t.embeds:e.embeds,t.content="content"in t?t.content:e.content,t.author="author"in t?t.author:{username:e.author.username,id:e.author.id,discriminator:e.author.discriminator,avatar:e.author.avatar},t.attachments="attachments"in t?t.attachments:e.attachments.array(),t}}t.exports=r},function(t,e,i){const n=i(2);class s extends n{handle(t){const e=this.client,i=e.dataManager.newUser(t);return{user:i}}}t.exports=s},function(t,e,i){const n=i(2),s=i(0);class o extends n{handle(t){const e=this.client,i=e.user.notes.get(t.id),n=t.note.length?t.note:null;return e.user.notes.set(t.id,n),e.emit(s.Events.USER_NOTE_UPDATE,t.id,i,n),{old:i,updated:n}}}t.exports=o},function(t,e,i){const n=i(2),s=i(0),o=i(4);class r extends n{handle(t){const e=this.client;if(e.user){if(e.user.equals(t))return{old:e.user,updated:e.user};const i=o.cloneObject(e.user);return e.user.patch(t),e.emit(s.Events.USER_UPDATE,i,e.user),{old:i,updated:e.user}}return{old:null,updated:null}}}t.exports=r},function(t,e,i){const n=i(26),s=i(0);class o{constructor(t,e,i,n,s,o){this.rest=t,this.client=t.client,this.method=e,this.path=i.toString(),this.auth=n,this.data=s,this.files=o,this.route=this.getRoute(this.path)}getRoute(t){let e=t.split("?")[0];if(e.includes("/channels/")||e.includes("/guilds/")){const t=e.includes("/channels/")?e.indexOf("/channels/"):e.indexOf("/guilds/"),i=e.substring(t).split("/")[2];e=e.replace(/(\d{8,})/g,":id").replace(":id",i)}return e}getAuth(){if(this.client.token&&this.client.user&&this.client.user.bot)return`Bot ${this.client.token}`;if(this.client.token)return this.client.token;throw new Error(s.Errors.NO_TOKEN)}gen(){const t=`${this.client.options.http.host}/api/v${this.client.options.http.version}`,e=n[this.method](`${t}${this.path}`);if(this.auth&&e.set("Authorization",this.getAuth()),this.rest.client.browser||e.set("User-Agent",this.rest.userAgentManager.userAgent),this.files){for(const t of this.files)t&&t.file&&e.attach(t.name,t.file,t.name);"undefined"!=typeof this.data&&e.attach("payload_json",JSON.stringify(this.data))}else this.data&&e.send(this.data);return e}}t.exports=o},function(t,e,i){const n=i(56),s=i(25),o=i(6),r=i(0),a=r.Endpoints,c=i(3),l=i(5),u=i(4),h=i(11),p=i(13),d=i(9),f=i(10),m=i(31),g=i(23),v=i(135),E=i(36),x=i(8),b=i(21),w=i(17),_=i(136);class y{constructor(t){this.rest=t,this.client=t.client,this._ackToken=null}login(t=this.client.token){return new Promise((e,i)=>{if("string"!=typeof t)throw new Error(r.Errors.INVALID_TOKEN);t=t.replace(/^Bot\s*/i,""),this.client.manager.connectToWebSocket(t,e,i)})}logout(){return this.rest.makeRequest("post",a.logout,!0,{})}getGateway(){return this.rest.makeRequest("get",a.gateway,!0).then(t=>{return this.client.ws.gateway=`${t.url}/?v=${this.client.options.ws.version}`,this.client.ws.gateway})}getBotGateway(){return this.rest.makeRequest("get",a.gateway.bot,!0)}fetchVoiceRegions(t){let e;return e=t?a.Guild(t).voiceRegions:a.voiceRegions,this.rest.makeRequest("get",e,!0).then(t=>{const e=new c;for(const i of t)e.set(i.id,new _(i));return e})}sendMessage(t,e,{tts,nonce,embed,disableEveryone,split,code,reply}={},i=null){return new Promise((n,s)=>{if("undefined"!=typeof e&&(e=this.client.resolver.resolveString(e)),"undefined"!=typeof nonce&&(nonce=parseInt(nonce),isNaN(nonce)||nonce<0))throw new RangeError("Message nonce must fit in an unsigned 64-bit integer.");if(e){if(split&&"object"!=typeof split&&(split={}),"undefined"==typeof code||"boolean"==typeof code&&code!==!0||(e=u.escapeMarkdown(this.client.resolver.resolveString(e),!0),e=`\`\`\`${"boolean"!=typeof code?code||"":""} ${e} \`\`\``,split&&(split.prepend=`\`\`\`${"boolean"!=typeof code?code||"":""} -`,split.append="\n```")),(disableEveryone||"undefined"==typeof disableEveryone&&this.client.options.disableEveryone)&&(e=e.replace(/@(everyone|here)/g,"@​$1")),reply&&!(t instanceof l||t instanceof f)&&"dm"!==t.type){const t=this.client.resolver.resolveUserID(reply),n=`<@${reply instanceof f&&reply.nickname?"!":""}${t}>`;e=`${n}${e?`, ${e}`:""}`,split&&(split.prepend=`${n}, ${split.prepend||""}`)}split&&(e=a.splitMessage(e,split))}else if(reply&&!(t instanceof l||t instanceof f)&&"dm"!==t.type){const t=this.client.resolver.resolveUserID(reply);e=`<@${reply instanceof f&&reply.nickname?"!":""}${t}>`}const r=t=>{if(e instanceof Array){const s=[];!function e(r,o){const u=o===r.length?{tts:tts,embed:embed}:{tts:tts};t.send(r[o],u,o===r.length?n:null).then(t=>{return s.push(t),o>=r.length-1?i(s):e(r,++o)})}(e,0)}else this.rest.makeRequest("post",u.Channel(t).messages,!0,{content:e,tts:tts,nonce:nonce,embed:embed},n).then(t=>i(this.client.actions.MessageCreate.handle(t).message),s)};t instanceof l||t instanceof f?this.createDM(t).then(r,s):r(t)})}updateMessage(t,e,{embed,code,reply}={}){if("undefined"!=typeof e&&(e=this.client.resolver.resolveString(e)),"undefined"==typeof code||"boolean"==typeof code&&code!==!0||(e=a.escapeMarkdown(this.client.resolver.resolveString(e),!0),e=`\`\`\`${"boolean"!=typeof code?code||"":""} +`,split.append="\n```")),(disableEveryone||"undefined"==typeof disableEveryone&&this.client.options.disableEveryone)&&(e=e.replace(/@(everyone|here)/g,"@​$1")),reply&&!(t instanceof h||t instanceof p)&&"dm"!==t.type){const t=this.client.resolver.resolveUserID(reply),i=`<@${reply instanceof p&&reply.nickname?"!":""}${t}>`;e=`${i}${e?`, ${e}`:""}`,split&&(split.prepend=`${i}, ${split.prepend||""}`)}split&&(e=u.splitMessage(e,split))}else if(reply&&!(t instanceof h||t instanceof p)&&"dm"!==t.type){const t=this.client.resolver.resolveUserID(reply);e=`<@${reply instanceof p&&reply.nickname?"!":""}${t}>`}const o=t=>{if(e instanceof Array){const s=[];!function e(o,r){const a=r===o.length?{tts:tts,embed:embed}:{tts:tts};t.send(o[r],a,r===o.length?i:null).then(t=>{return s.push(t),r>=o.length-1?n(s):e(o,++r)})}(e,0)}else this.rest.makeRequest("post",a.Channel(t).messages,!0,{content:e,tts:tts,nonce:nonce,embed:embed},i).then(t=>n(this.client.actions.MessageCreate.handle(t).message),s)};t instanceof h||t instanceof p?this.createDM(t).then(o,s):o(t)})}updateMessage(t,e,{embed,code,reply}={}){if("undefined"!=typeof e&&(e=this.client.resolver.resolveString(e)),"undefined"==typeof code||"boolean"==typeof code&&code!==!0||(e=u.escapeMarkdown(this.client.resolver.resolveString(e),!0),e=`\`\`\`${"boolean"!=typeof code?code||"":""} ${e} -\`\`\``),reply&&"dm"!==t.channel.type){const t=this.client.resolver.resolveUserID(reply),n=`<@${reply instanceof f&&reply.nickname?"!":""}${t}>`;e=`${n}${e?`, ${e}`:""}`}return this.rest.makeRequest("patch",u.Message(t),!0,{content:e,embed:embed}).then(t=>this.client.actions.MessageUpdate.handle(t).updated)}deleteMessage(t){return this.rest.makeRequest("del",u.Message(t),!0).then(()=>this.client.actions.MessageDelete.handle({id:t.id,channel_id:t.channel.id}).message)}ackMessage(t){return this.rest.makeRequest("post",u.Message(t).ack,!0,{token:this._ackToken}).then(e=>{return e.token&&(this._ackToken=e.token),t})}ackTextChannel(t){return this.rest.makeRequest("post",u.Channel(t).ack,!0,{token:this._ackToken}).then(e=>{return e.token&&(this._ackToken=e.token),t})}ackGuild(t){return this.rest.makeRequest("post",u.Guild(t).ack,!0).then(()=>t)}bulkDeleteMessages(t,e,n){return n&&(e=e.filter(t=>Date.now()-h.deconstruct(t).date.getTime()<12096e5)),this.rest.makeRequest("post",u.Channel(t).messages.bulkDelete,!0,{messages:e}).then(()=>this.client.actions.MessageDeleteBulk.handle({channel_id:t.id,ids:e}).messages)}search(t,e){if(e.before&&(e.before instanceof Date||(e.before=new Date(e.before)),e.maxID=s.fromNumber(e.before.getTime()-14200704e5).shiftLeft(22).toString()),e.after&&(e.after instanceof Date||(e.after=new Date(e.after)),e.minID=s.fromNumber(e.after.getTime()-14200704e5).shiftLeft(22).toString()),e.during){e.during instanceof Date||(e.during=new Date(e.during));const t=e.during.getTime()-14200704e5;e.minID=s.fromNumber(t).shiftLeft(22).toString(),e.maxID=s.fromNumber(t+864e5).shiftLeft(22).toString()}e.channel&&(e.channel=this.client.resolver.resolveChannelID(e.channel)),e.author&&(e.author=this.client.resolver.resolveUserID(e.author)),e.mentions&&(e.mentions=this.client.resolver.resolveUserID(e.options.mentions)),e={content:e.content,max_id:e.maxID,min_id:e.minID,has:e.has,channel_id:e.channel,author_id:e.author,author_type:e.authorType,context_size:e.contextSize,sort_by:e.sortBy,sort_order:e.sortOrder,limit:e.limit,offset:e.offset,mentions:e.mentions,mentions_everyone:e.mentionsEveryone,link_hostname:e.linkHostname,embed_provider:e.embedProvider,embed_type:e.embedType,attachment_filename:e.attachmentFilename,attachment_extension:e.attachmentExtension};for(const n in e)void 0===e[n]&&delete e[n];const r=(i.stringify(e).match(/[^=&?]+=[^=&?]+/g)||[]).join("&");let o;if(t instanceof v)o=u.Channel(t).search;else{if(!(t instanceof w))throw new TypeError("Target must be a TextChannel, DMChannel, GroupDMChannel, or Guild.");o=u.Guild(t).search}return this.rest.makeRequest("get",`${o}?${r}`,!0).then(t=>{const e=t.messages.map(t=>t.map(t=>new d(this.client.channels.get(t.channel_id),t,this.client)));return{totalResults:t.total_results,messages:e}})}createChannel(t,e,n,i){return i instanceof c&&(i=i.array()),this.rest.makeRequest("post",u.Guild(t).channels,!0,{name:e,type:n,permission_overwrites:i}).then(t=>this.client.actions.ChannelCreate.handle(t).channel)}createDM(t){const e=this.getExistingDM(t);return e?Promise.resolve(e):this.rest.makeRequest("post",u.User(this.client.user).channels,!0,{recipient_id:t.id}).then(t=>this.client.actions.ChannelCreate.handle(t).channel)}createGroupDM(t){const e=this.client.user.bot?{access_tokens:t.accessTokens,nicks:t.nicks}:{recipients:t.recipients};return this.rest.makeRequest("post",u.User("@me").channels,!0,e).then(t=>new y(this.client,t))}addUserToGroupDM(t,e){const n=this.client.user.bot?{nick:e.nick,access_token:e.accessToken}:{recipient:e.id};return this.rest.makeRequest("put",u.Channel(t).Recipient(e.id),!0,n).then(()=>t)}getExistingDM(t){return this.client.channels.find(e=>e.recipient&&e.recipient.id===t.id)}deleteChannel(t){return(t instanceof l||t instanceof f)&&(t=this.getExistingDM(t)),t?this.rest.makeRequest("del",u.Channel(t),!0).then(e=>{return e.id=t.id,this.client.actions.ChannelDelete.handle(e).channel}):Promise.reject(new Error("No channel to delete."))}updateChannel(t,e){const n={};return n.name=(e.name||t.name).trim(),n.topic=e.topic||t.topic,n.position=e.position||t.position,n.bitrate=e.bitrate||t.bitrate,n.user_limit=e.userLimit||t.userLimit,this.rest.makeRequest("patch",u.Channel(t),!0,n).then(t=>this.client.actions.ChannelUpdate.handle(t).updated)}leaveGuild(t){return t.ownerID===this.client.user.id?Promise.reject(new Error("Guild is owned by the client.")):this.rest.makeRequest("del",u.User("@me").Guild(t.id),!0).then(()=>this.client.actions.GuildDelete.handle({id:t.id}).guild)}createGuild(t){return t.icon=this.client.resolver.resolveBase64(t.icon)||null,t.region=t.region||"us-central",new Promise((e,n)=>{this.rest.makeRequest("post",u.guilds,!0,t).then(t=>{if(this.client.guilds.has(t.id))return e(this.client.guilds.get(t.id));const i=n=>{n.id===t.id&&(this.client.removeListener(o.Events.GUILD_CREATE,i),this.client.clearTimeout(s),e(n))};this.client.on(o.Events.GUILD_CREATE,i);const s=this.client.setTimeout(()=>{this.client.removeListener(o.Events.GUILD_CREATE,i),n(new Error("Took too long to receive guild data."))},1e4)},n)})}deleteGuild(t){return this.rest.makeRequest("del",u.Guild(t),!0).then(()=>this.client.actions.GuildDelete.handle({id:t.id}).guild)}getUser(t,e){return this.rest.makeRequest("get",u.User(t),!0).then(t=>{return e?this.client.actions.UserGet.handle(t).user:new l(this.client,t)})}updateCurrentUser(t,e){const n=this.client.user,i={};return i.username=t.username||n.username,i.avatar=this.client.resolver.resolveBase64(t.avatar)||n.avatar,n.bot||(i.email=t.email||n.email,i.password=e,t.new_password&&(i.new_password=t.newPassword)),this.rest.makeRequest("patch",u.User("@me"),!0,i).then(t=>this.client.actions.UserUpdate.handle(t).updated)}updateGuild(t,e){const n={};return e.name&&(n.name=e.name),e.region&&(n.region=e.region),e.verificationLevel&&(n.verification_level=Number(e.verificationLevel)),e.afkChannel&&(n.afk_channel_id=this.client.resolver.resolveChannel(e.afkChannel).id),e.afkTimeout&&(n.afk_timeout=Number(e.afkTimeout)),e.icon&&(n.icon=this.client.resolver.resolveBase64(e.icon)),e.owner&&(n.owner_id=this.client.resolver.resolveUser(e.owner).id),e.splash&&(n.splash=this.client.resolver.resolveBase64(e.splash)),this.rest.makeRequest("patch",u.Guild(t),!0,n).then(t=>this.client.actions.GuildUpdate.handle(t).updated)}kickGuildMember(t,e){return this.rest.makeRequest("del",u.Guild(t).Member(e),!0).then(()=>this.client.actions.GuildMemberRemove.handle({guild_id:t.id,user:e.user}).member)}createGuildRole(t,e){return e.color&&(e.color=this.client.resolver.resolveColor(e.color)),e.permissions&&(e.permissions=r.resolve(e.permissions)),this.rest.makeRequest("post",u.Guild(t).roles,!0,e).then(e=>this.client.actions.GuildRoleCreate.handle({guild_id:t.id,role:e}).role)}deleteGuildRole(t){return this.rest.makeRequest("del",u.Guild(t.guild).Role(t.id),!0).then(()=>this.client.actions.GuildRoleDelete.handle({guild_id:t.guild.id,role_id:t.id}).role)}setChannelOverwrite(t,e){return this.rest.makeRequest("put",`${u.Channel(t).permissions}/${e.id}`,!0,e)}deletePermissionOverwrites(t){return this.rest.makeRequest("del",`${u.Channel(t.channel).permissions}/${t.id}`,!0).then(()=>t)}getChannelMessages(t,e={}){const n=[];e.limit&&n.push(`limit=${e.limit}`),e.around?n.push(`around=${e.around}`):e.before?n.push(`before=${e.before}`):e.after&&n.push(`after=${e.after}`);let i=u.Channel(t).messages;return n.length>0&&(i+=`?${n.join("&")}`),this.rest.makeRequest("get",i,!0)}getChannelMessage(t,e){const n=t.messages.get(e);return n?Promise.resolve(n):this.rest.makeRequest("get",u.Channel(t).Message(e),!0)}putGuildMember(t,e,n){if(n.access_token=n.accessToken,n.roles){const t=n.roles;(t instanceof c||t instanceof Array&&t[0]instanceof p)&&(n.roles=t.map(t=>t.id))}return this.rest.makeRequest("put",u.Guild(t).Member(e.id),!0,n).then(e=>this.client.actions.GuildMemberGet.handle(t,e).member)}getGuildMember(t,e,n){return this.rest.makeRequest("get",u.Guild(t).Member(e.id),!0).then(e=>{return n?this.client.actions.GuildMemberGet.handle(t,e).member:new f(t,e)})}updateGuildMember(t,e){e.channel&&(e.channel_id=this.client.resolver.resolveChannel(e.channel).id),e.roles&&(e.roles=e.roles.map(t=>t instanceof p?t.id:t));let n=u.Member(t);if(t.id===this.client.user.id){const i=Object.keys(e);1===i.length&&"nick"===i[0]&&(n=u.Member(t).nickname)}return this.rest.makeRequest("patch",n,!0,e).then(e=>t.guild._updateMember(t,e).mem)}addMemberRole(t,e){return new Promise((n,i)=>{if(t._roles.includes(e.id))return n(t);const s=(t,i)=>{!t._roles.includes(e.id)&&i._roles.includes(e.id)&&(this.client.removeListener(o.Events.GUILD_MEMBER_UPDATE,s),n(i))};this.client.on(o.Events.GUILD_MEMBER_UPDATE,s);const r=this.client.setTimeout(()=>this.client.removeListener(o.Events.GUILD_MEMBER_UPDATE,s),1e4);return this.rest.makeRequest("put",u.Member(t).Role(e.id),!0).catch(t=>{this.client.removeListener(o.Events.GUILD_BAN_REMOVE,s),this.client.clearTimeout(r),i(t)})})}removeMemberRole(t,e){return new Promise((n,i)=>{if(!t._roles.includes(e.id))return n(t);const s=(t,i)=>{t._roles.includes(e.id)&&!i._roles.includes(e.id)&&(this.client.removeListener(o.Events.GUILD_MEMBER_UPDATE,s),n(i))};this.client.on(o.Events.GUILD_MEMBER_UPDATE,s);const r=this.client.setTimeout(()=>this.client.removeListener(o.Events.GUILD_MEMBER_UPDATE,s),1e4);return this.rest.makeRequest("delete",u.Member(t).Role(e.id),!0).catch(t=>{this.client.removeListener(o.Events.GUILD_BAN_REMOVE,s),this.client.clearTimeout(r),i(t)})})}sendTyping(t){return this.rest.makeRequest("post",u.Channel(t).typing,!0)}banGuildMember(t,e,n=0){const i=this.client.resolver.resolveUserID(e);return i?this.rest.makeRequest("put",`${u.Guild(t).bans}/${i}?delete-message-days=${n}`,!0,{"delete-message-days":n}).then(()=>{if(e instanceof f)return e;const n=this.client.resolver.resolveUser(i);return n?(e=this.client.resolver.resolveGuildMember(t,n),e||n):i}):Promise.reject(new Error("Couldn't resolve the user ID to ban."))}unbanGuildMember(t,e){return new Promise((n,i)=>{const s=this.client.resolver.resolveUserID(e);if(!s)throw new Error("Couldn't resolve the user ID to unban.");const r=(e,i)=>{e.id===t.id&&i.id===s&&(this.client.removeListener(o.Events.GUILD_BAN_REMOVE,r),this.client.clearTimeout(c),n(i))};this.client.on(o.Events.GUILD_BAN_REMOVE,r);const c=this.client.setTimeout(()=>{this.client.removeListener(o.Events.GUILD_BAN_REMOVE,r),i(new Error("Took too long to receive the ban remove event."))},1e4);this.rest.makeRequest("del",`${u.Guild(t).bans}/${s}`,!0).catch(t=>{this.client.removeListener(o.Events.GUILD_BAN_REMOVE,r),this.client.clearTimeout(c),i(t)})})}getGuildBans(t){return this.rest.makeRequest("get",u.Guild(t).bans,!0).then(t=>{const e=new c;for(const n of t){const t=this.client.dataManager.newUser(n.user);e.set(t.id,t)}return e})}updateGuildRole(t,e){const n={};return n.name=e.name||t.name,n.position="undefined"!=typeof e.position?e.position:t.position,n.color=this.client.resolver.resolveColor(e.color||t.color),n.hoist="undefined"!=typeof e.hoist?e.hoist:t.hoist,n.mentionable="undefined"!=typeof e.mentionable?e.mentionable:t.mentionable,e.permissions?n.permissions=r.resolve(e.permissions):n.permissions=t.permissions,this.rest.makeRequest("patch",u.Guild(t.guild).Role(t.id),!0,n).then(e=>this.client.actions.GuildRoleUpdate.handle({role:e,guild_id:t.guild.id}).updated)}pinMessage(t){return this.rest.makeRequest("put",u.Channel(t.channel).Pin(t.id),!0).then(()=>t)}unpinMessage(t){return this.rest.makeRequest("del",u.Channel(t.channel).Pin(t.id),!0).then(()=>t)}getChannelPinnedMessages(t){return this.rest.makeRequest("get",u.Channel(t).pins,!0)}createChannelInvite(t,e){const n={};return n.temporary=e.temporary,n.max_age=e.maxAge,n.max_uses=e.maxUses,this.rest.makeRequest("post",u.Channel(t).invites,!0,n).then(t=>new m(this.client,t))}deleteInvite(t){return this.rest.makeRequest("del",u.Invite(t.code),!0).then(()=>t)}getInvite(t){return this.rest.makeRequest("get",u.Invite(t),!0).then(t=>new m(this.client,t))}getGuildInvites(t){return this.rest.makeRequest("get",u.Guild(t).invites,!0).then(t=>{const e=new c;for(const n of t){const t=new m(this.client,n);e.set(t.code,t)}return e})}pruneGuildMembers(t,e,n){return this.rest.makeRequest(n?"get":"post",`${u.Guild(t).prune}?days=${e}`,!0).then(t=>t.pruned)}createEmoji(t,e,n,i){const s={image:e,name:n};return i&&(s.roles=i.map(t=>t.id?t.id:t)),this.rest.makeRequest("post",u.Guild(t).emojis,!0,s).then(e=>this.client.actions.GuildEmojiCreate.handle(t,e).emoji)}updateEmoji(t,e){const n={};return e.name&&(n.name=e.name),e.roles&&(n.roles=e.roles.map(t=>t.id?t.id:t)),this.rest.makeRequest("patch",u.Guild(t.guild).Emoji(t.id),!0,n).then(e=>this.client.actions.GuildEmojiUpdate.handle(t,e).emoji)}deleteEmoji(t){return this.rest.makeRequest("delete",u.Guild(t.guild).Emoji(t.id),!0).then(()=>this.client.actions.GuildEmojiDelete.handle(t).data)}getWebhook(t,e){return this.rest.makeRequest("get",u.Webhook(t,e),!e).then(t=>new g(this.client,t))}getGuildWebhooks(t){return this.rest.makeRequest("get",u.Guild(t).webhooks,!0).then(t=>{const e=new c;for(const n of t)e.set(n.id,new g(this.client,n));return e})}getChannelWebhooks(t){return this.rest.makeRequest("get",u.Channel(t).webhooks,!0).then(t=>{const e=new c;for(const n of t)e.set(n.id,new g(this.client,n));return e})}createWebhook(t,e,n){return this.rest.makeRequest("post",u.Channel(t).webhooks,!0,{name:e,avatar:n}).then(t=>new g(this.client,t))}editWebhook(t,e,n){return this.rest.makeRequest("patch",u.Webhook(t.id,t.token),!1,{name:e,avatar:n}).then(e=>{return t.name=e.name,t.avatar=e.avatar,t})}deleteWebhook(t){return this.rest.makeRequest("delete",u.Webhook(t.id,t.token),!1)}sendWebhookMessage(t,e,{avatarURL,tts,disableEveryone,embeds,username}={},n=null){return username=username||t.name,"undefined"!=typeof e&&(e=this.client.resolver.resolveString(e)),e&&(disableEveryone||"undefined"==typeof disableEveryone&&this.client.options.disableEveryone)&&(e=e.replace(/@(everyone|here)/g,"@​$1")),this.rest.makeRequest("post",`${u.Webhook(t.id,t.token)}?wait=true`,!1,{username:username,avatar_url:avatarURL,content:e,tts:tts,embeds:embeds},n)}sendSlackWebhookMessage(t,e){return this.rest.makeRequest("post",`${u.Webhook(t.id,t.token)}/slack?wait=true`,!1,e)}fetchUserProfile(t){return this.rest.makeRequest("get",u.User(t).profile,!0).then(e=>new E(t,e))}fetchMeMentions(t){return t.guild&&(t.guild=t.guild.id?t.guild.id:t.guild),this.rest.makeRequest("get",u.User("@me").mentions(t.limit,t.roles,t.everyone,t.guild)).then(t=>t.body.map(t=>new d(this.client.channels.get(t.channel_id),t,this.client)))}addFriend(t){return this.rest.makeRequest("post",u.User("@me"),!0,{username:t.username,discriminator:t.discriminator}).then(()=>t)}removeFriend(t){return this.rest.makeRequest("delete",u.User("@me").Relationship(t.id),!0).then(()=>t)}blockUser(t){return this.rest.makeRequest("put",u.User("@me").Relationship(t.id),!0,{type:2}).then(()=>t)}unblockUser(t){return this.rest.makeRequest("delete",u.User("@me").Relationship(t.id),!0).then(()=>t)}updateChannelPositions(t,e){const n=new Array(e.length);for(let i=0;ithis.client.actions.GuildChannelsPositionUpdate.handle({guild_id:t,channels:e}).guild)}setRolePositions(t,e){return this.rest.makeRequest("patch",u.Guild(t).roles,!0,e).then(()=>this.client.actions.GuildRolesPositionUpdate.handle({guild_id:t,roles:e}).guild)}setChannelPositions(t,e){return this.rest.makeRequest("patch",u.Guild(t).channels,!0,e).then(()=>this.client.actions.GuildChannelsPositionUpdate.handle({guild_id:t,channels:e}).guild)}addMessageReaction(t,e){return this.rest.makeRequest("put",u.Message(t).Reaction(e).User("@me"),!0).then(()=>this.client.actions.MessageReactionAdd.handle({user_id:this.client.user.id,message_id:t.id,emoji:a.parseEmoji(e),channel_id:t.channel.id}).reaction)}removeMessageReaction(t,e,n){const i=u.Message(t).Reaction(e).User(n===this.client.user.id?"@me":n.id);return this.rest.makeRequest("delete",i,!0).then(()=>this.client.actions.MessageReactionRemove.handle({user_id:n,message_id:t.id,emoji:a.parseEmoji(e),channel_id:t.channel.id}).reaction)}removeMessageReactions(t){return this.rest.makeRequest("delete",u.Message(t).reactions,!0).then(()=>t)}getMessageReactionUsers(t,e,n=100){return this.rest.makeRequest("get",u.Message(t).Reaction(e,n),!0)}getApplication(t){return this.rest.makeRequest("get",u.OAUTH2.Application(t),!0).then(t=>new _(this.client,t))}resetApplication(t){return this.rest.makeRequest("post",u.OAUTH2.Application(t).reset,!0).then(t=>new _(this.client,t))}setNote(t,e){return this.rest.makeRequest("put",u.User(t).note,!0,{note:e}).then(()=>t)}acceptInvite(t){return t.id&&(t=t.id),new Promise((e,n)=>this.rest.makeRequest("post",u.Invite(t),!0).then(t=>{const i=n=>{n.id===t.id&&(e(n),this.client.removeListener(o.Events.GUILD_CREATE,i))};this.client.on(o.Events.GUILD_CREATE,i),this.client.setTimeout(()=>{this.client.removeListener(o.Events.GUILD_CREATE,i),n(new Error("Accepting invite timed out"))},12e4)}))}}t.exports=A},function(t,e,n){const i=n(45);class s extends i{constructor(t,e){super(t,e),this.client=t.client,this.limit=1/0,this.resetTime=null,this.remaining=1,this.timeDifference=0,this.resetTimeout=null}push(t){super.push(t),this.handle()}execute(t){t&&t.request.gen().end((e,n)=>{if(n&&n.headers&&(this.limit=Number(n.headers["x-ratelimit-limit"]),this.resetTime=1e3*Number(n.headers["x-ratelimit-reset"]),this.remaining=Number(n.headers["x-ratelimit-remaining"]),this.timeDifference=Date.now()-new Date(n.headers.date).getTime()),e)if(429===e.status){if(this.queue.unshift(t),n.headers["x-ratelimit-global"]&&(this.globalLimit=!0),this.resetTimeout)return;this.resetTimeout=this.client.setTimeout(()=>{this.remaining=this.limit,this.globalLimit=!1,this.handle(),this.resetTimeout=null},Number(n.headers["retry-after"])+this.client.options.restTimeOffset)}else t.reject(e),this.handle();else{this.globalLimit=!1;const e=n&&n.body?n.body:{};t.resolve(e),this.handle()}})}handle(){super.handle(),this.remaining<=0||0===this.queue.length||this.globalLimit||(this.execute(this.queue.shift()),this.remaining--,this.handle())}}t.exports=s},function(t,e,n){const i=n(45);class s extends i{constructor(t,e){super(t,e),this.endpoint=e,this.timeDifference=0}push(t){super.push(t),this.handle()}execute(t){return new Promise(e=>{t.request.gen().end((n,i)=>{if(i&&i.headers&&(this.requestLimit=Number(i.headers["x-ratelimit-limit"]),this.requestResetTime=1e3*Number(i.headers["x-ratelimit-reset"]),this.requestRemaining=Number(i.headers["x-ratelimit-remaining"]),this.timeDifference=Date.now()-new Date(i.headers.date).getTime()),n)429===n.status?(this.queue.unshift(t),this.restManager.client.setTimeout(()=>{this.globalLimit=!1,e()},Number(i.headers["retry-after"])+this.restManager.client.options.restTimeOffset),i.headers["x-ratelimit-global"]&&(this.globalLimit=!0)):(t.reject(n),e(n));else{this.globalLimit=!1;const n=i&&i.body?i.body:{};t.resolve(n),0===this.requestRemaining?this.restManager.client.setTimeout(()=>{this.waiting=!1,e(n)},this.requestResetTime-Date.now()+this.timeDifference+this.restManager.client.options.restTimeOffset):e(n)}})})}handle(){super.handle(),0===this.remaining||0===this.queue.length||this.globalLimit||this.execute(this.queue.shift()).then(()=>this.handle())}}t.exports=s},function(t,e,n){(function(e){const i=n(0);class s{constructor(){this.build(this.constructor.DEFAULT)}set({url,version}={}){this.build({url:url||this.constructor.DFEAULT.url,version:version||this.constructor.DEFAULT.version})}build(t){this.userAgent=`DiscordBot (${t.url}, ${t.version}) Node.js/${e.version}`}}s.DEFAULT={url:i.Package.homepage.split("#")[0],version:i.Package.version},t.exports=s}).call(e,n(18))},function(t,e,n){(function(e){const i="browser"===n(15).platform(),s=n(23).EventEmitter,r=n(0),o=n(4).convertToBuffer,u=n(43),c=n(101);let h,a,l=JSON.stringify;if(i)h=window.WebSocket;else{try{h=n(143)}catch(t){h=n(144)}try{a=n(142),l=a.pack}catch(t){a=null}}class f extends s{constructor(t){super(),this.client=t,this.packetManager=new c(this),this.status=r.Status.IDLE,this.sessionID=null,this.sequence=-1,this.gateway=null,this.normalReady=!1,this.ws=null,this.disabledEvents={};for(const e of t.options.disabledEvents)this.disabledEvents[e]=!0;this.first=!0,this.lastHeartbeatAck=!0}_connect(t){this.client.emit("debug",`Connecting to gateway ${t}`),this.normalReady=!1,this.status!==r.Status.RECONNECTING&&(this.status=r.Status.CONNECTING),this.ws=new h(t),i&&(this.ws.binaryType="arraybuffer"),this.ws.onopen=this.eventOpen.bind(this),this.ws.onmessage=this.eventMessage.bind(this),this.ws.onclose=this.eventClose.bind(this),this.ws.onerror=this.eventError.bind(this),this._queue=[],this._remaining=120,this.client.setInterval(()=>{this._remaining=120,this._remainingReset=Date.now()},6e4)}connect(t){t=`${t}&encoding=${a?"etf":"json"}`,this.first?(this._connect(t),this.first=!1):this.client.setTimeout(()=>this._connect(t),5500)}heartbeat(t){return t&&!this.lastHeartbeatAck?void this.ws.close(1007):(this.client.emit("debug","Sending heartbeat"),this.client._pingTimestamp=Date.now(),this.client.ws.send({op:r.OPCodes.HEARTBEAT,d:this.sequence},!0),void(this.lastHeartbeatAck=!1))}send(t,e=false){return e?void this._send(l(t)):(this._queue.push(l(t)),void this.doQueue())}destroy(){this.ws&&this.ws.close(1e3),this._queue=[],this.status=r.Status.IDLE}_send(t){this.ws.readyState===h.OPEN&&(this.emit("send",t),this.ws.send(t))}doQueue(){const t=this._queue[0];if(this.ws.readyState===h.OPEN&&t){if(0===this.remaining)return void this.client.setTimeout(this.doQueue.bind(this),Date.now()-this.remainingReset);this._remaining--,this._send(t),this._queue.shift(),this.doQueue()}}eventOpen(){this.client.emit("debug","Connection to gateway opened"),this.lastHeartbeatAck=!0,this.status===r.Status.RECONNECTING?this._sendResume():this._sendNewIdentify()}_sendResume(){if(!this.sessionID)return void this._sendNewIdentify();this.client.emit("debug","Identifying as resumed session");const t={token:this.client.token,session_id:this.sessionID,seq:this.sequence};this.send({op:r.OPCodes.RESUME,d:t})}_sendNewIdentify(){this.reconnecting=!1;const t=this.client.options.ws;t.token=this.client.token,this.client.options.shardCount>0&&(t.shard=[Number(this.client.options.shardId),Number(this.client.options.shardCount)]),this.client.emit("debug","Identifying as new session"),this.send({op:r.OPCodes.IDENTIFY,d:t}),this.sequence=-1}eventClose(t){this.emit("close",t),this.client.clearInterval(this.client.manager.heartbeatInterval),this.status=r.Status.DISCONNECTED,this._queue=[],this.reconnecting||this.client.emit(r.Events.DISCONNECT,t),[4004,4010,4011].includes(t.code)||this.reconnecting||1e3===t.code||this.tryReconnect()}eventMessage(t){const e=this.tryParseEventData(t.data);return null===e?(this.eventError(new Error(r.Errors.BAD_WS_MESSAGE)),!1):(this.client.emit("raw",e),e.op===r.OPCodes.HELLO&&this.client.manager.setupKeepAlive(e.d.heartbeat_interval),this.packetManager.handle(e))}parseEventData(t){return a?(t instanceof ArrayBuffer&&(t=o(t)),a.unpack(t)):((t instanceof e||t instanceof ArrayBuffer)&&(t=u.inflateSync(t).toString()),JSON.parse(t))}tryParseEventData(t){try{return this.parseEventData(t)}catch(t){return null}}eventError(t){this.client.listenerCount("error")>0&&this.client.emit("error",t),this.tryReconnect()}_emitReady(t=true){this.status=r.Status.READY,this.client.emit(r.Events.READY),this.packetManager.handleQueue(),this.normalReady=t}checkIfReady(){if(this.status!==r.Status.READY&&this.status!==r.Status.NEARLY){let t=0;for(const e of this.client.guilds.keys())t+=this.client.guilds.get(e).available?0:1;if(0===t){if(this.status=r.Status.NEARLY,this.client.options.fetchAllMembers){const t=this.client.guilds.map(t=>t.fetchMembers());return void Promise.all(t).then(()=>this._emitReady(),t=>{this.client.emit(r.Events.WARN,"Error in pre-ready guild member fetching"),this.client.emit(r.Events.ERROR,t),this._emitReady()})}this._emitReady()}}}tryReconnect(){this.status!==r.Status.RECONNECTING&&this.status!==r.Status.CONNECTING&&(this.status=r.Status.RECONNECTING,this.ws.close(),this.packetManager.handleQueue(),this.client.emit(r.Events.RECONNECTING),this.connect(this.client.ws.gateway))}}t.exports=f}).call(e,n(22).Buffer)},function(t,e,n){const i=n(0),s=[i.WSEvents.READY,i.WSEvents.GUILD_CREATE,i.WSEvents.GUILD_DELETE,i.WSEvents.GUILD_MEMBERS_CHUNK,i.WSEvents.GUILD_MEMBER_ADD,i.WSEvents.GUILD_MEMBER_REMOVE];class r{constructor(t){this.ws=t,this.handlers={},this.queue=[],this.register(i.WSEvents.READY,n(128)),this.register(i.WSEvents.GUILD_CREATE,n(108)),this.register(i.WSEvents.GUILD_DELETE,n(109)),this.register(i.WSEvents.GUILD_UPDATE,n(119)),this.register(i.WSEvents.GUILD_BAN_ADD,n(106)),this.register(i.WSEvents.GUILD_BAN_REMOVE,n(107)),this.register(i.WSEvents.GUILD_MEMBER_ADD,n(111)),this.register(i.WSEvents.GUILD_MEMBER_REMOVE,n(112)),this.register(i.WSEvents.GUILD_MEMBER_UPDATE,n(113)),this.register(i.WSEvents.GUILD_ROLE_CREATE,n(115)),this.register(i.WSEvents.GUILD_ROLE_DELETE,n(116)),this.register(i.WSEvents.GUILD_ROLE_UPDATE,n(117)),this.register(i.WSEvents.GUILD_EMOJIS_UPDATE,n(110)),this.register(i.WSEvents.GUILD_MEMBERS_CHUNK,n(114)),this.register(i.WSEvents.CHANNEL_CREATE,n(102)),this.register(i.WSEvents.CHANNEL_DELETE,n(103)),this.register(i.WSEvents.CHANNEL_UPDATE,n(105)),this.register(i.WSEvents.CHANNEL_PINS_UPDATE,n(104)),this.register(i.WSEvents.PRESENCE_UPDATE,n(127)),this.register(i.WSEvents.USER_UPDATE,n(133)),this.register(i.WSEvents.USER_NOTE_UPDATE,n(132)),this.register(i.WSEvents.VOICE_STATE_UPDATE,n(135)),this.register(i.WSEvents.TYPING_START,n(131)),this.register(i.WSEvents.MESSAGE_CREATE,n(120)),this.register(i.WSEvents.MESSAGE_DELETE,n(121)),this.register(i.WSEvents.MESSAGE_UPDATE,n(126)),this.register(i.WSEvents.MESSAGE_DELETE_BULK,n(122)),this.register(i.WSEvents.VOICE_SERVER_UPDATE,n(134)),this.register(i.WSEvents.GUILD_SYNC,n(118)),this.register(i.WSEvents.RELATIONSHIP_ADD,n(129)),this.register(i.WSEvents.RELATIONSHIP_REMOVE,n(130)),this.register(i.WSEvents.MESSAGE_REACTION_ADD,n(123)),this.register(i.WSEvents.MESSAGE_REACTION_REMOVE,n(124)),this.register(i.WSEvents.MESSAGE_REACTION_REMOVE_ALL,n(125))}get client(){return this.ws.client}register(t,e){this.handlers[t]=new e(this)}handleQueue(){this.queue.forEach((t,e)=>{this.handle(this.queue[e]),this.queue.splice(e,1)})}setSequence(t){t&&t>this.ws.sequence&&(this.ws.sequence=t)}handle(t){return t.op===i.OPCodes.RECONNECT?(this.setSequence(t.s),this.ws.tryReconnect(),!1):t.op===i.OPCodes.INVALID_SESSION?(t.d?setTimeout(()=>{this.ws._sendResume()},2500):(this.ws.sessionID=null,this.ws._sendNewIdentify()),!1):(t.op===i.OPCodes.HEARTBEAT_ACK?(this.ws.client._pong(this.ws.client._pingTimestamp),this.ws.lastHeartbeatAck=!0,this.ws.client.emit("debug","Heartbeat acknowledged")):t.op===i.OPCodes.HEARTBEAT&&(this.client.ws.send({op:i.OPCodes.HEARTBEAT,d:this.client.ws.sequence}),this.ws.client.emit("debug","Received gateway heartbeat")),this.ws.status===i.Status.RECONNECTING&&(this.ws.reconnecting=!1,this.ws.checkIfReady()),this.setSequence(t.s),void 0===this.ws.disabledEvents[t.t]&&(this.ws.status!==i.Status.READY&&s.indexOf(t.t)===-1?(this.queue.push(t),!1):!!this.handlers[t.t]&&this.handlers[t.t].handle(t)))}}t.exports=r},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.ChannelCreate.handle(n)}}t.exports=s},function(t,e,n){const i=n(1),s=n(0);class r extends i{handle(t){const e=this.packetManager.client,n=t.d,i=e.actions.ChannelDelete.handle(n);i.channel&&e.emit(s.Events.CHANNEL_DELETE,i.channel)}}t.exports=r},function(t,e,n){const i=n(1),s=n(0);class r extends i{handle(t){const e=this.packetManager.client,n=t.d,i=e.channels.get(n.channel_id),r=new Date(n.last_pin_timestamp);i&&r&&e.emit(s.Events.CHANNEL_PINS_UPDATE,i,r)}}t.exports=r},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.ChannelUpdate.handle(n)}}t.exports=s},function(t,e,n){const i=n(1),s=n(0);class r extends i{handle(t){const e=this.packetManager.client,n=t.d,i=e.guilds.get(n.guild_id),r=e.users.get(n.user.id);i&&r&&e.emit(s.Events.GUILD_BAN_ADD,i,r)}}t.exports=r},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.GuildBanRemove.handle(n)}}t.exports=s},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d,i=e.guilds.get(n.id);i?i.available||n.unavailable||(i.setup(n),this.packetManager.ws.checkIfReady()):e.dataManager.newGuild(n)}}t.exports=s},function(t,e,n){const i=n(1),s=n(0);class r extends i{handle(t){const e=this.packetManager.client,n=t.d,i=e.actions.GuildDelete.handle(n);i.guild&&e.emit(s.Events.GUILD_DELETE,i.guild)}}t.exports=r},function(t,e,n){function i(t){const e=new Map;for(const n of t)e.set(...n);return e}const s=n(1);class r extends s{handle(t){const e=this.packetManager.client,n=t.d,s=e.guilds.get(n.guild_id);if(s&&s.emojis){const t=i(s.emojis.entries());for(const r of n.emojis){const n=s.emojis.get(r.id);n?(t.delete(r.id),n.equals(r,!0)||e.actions.GuildEmojiUpdate.handle(n,r)):e.actions.GuildEmojiCreate.handle(s,r)}for(const r of t.values())e.actions.GuildEmojiDelete.handle(r)}}}t.exports=r},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d,i=e.guilds.get(n.guild_id);i&&(i.memberCount++,i._addMember(n))}}t.exports=s},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.GuildMemberRemove.handle(n)}}t.exports=s},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d,i=e.guilds.get(n.guild_id);if(i){const t=i.members.get(n.user.id);t&&i._updateMember(t,n)}}}t.exports=s},function(t,e,n){const i=n(1),s=n(0);class r extends i{handle(t){const e=this.packetManager.client,n=t.d,i=e.guilds.get(n.guild_id);if(i){const t=n.members.map(t=>i._addMember(t,!1));e.emit(s.Events.GUILD_MEMBERS_CHUNK,t,i),e.ws.lastHeartbeatAck=!0}}}t.exports=r},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.GuildRoleCreate.handle(n)}}t.exports=s},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.GuildRoleDelete.handle(n)}}t.exports=s},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.GuildRoleUpdate.handle(n)}}t.exports=s},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.GuildSync.handle(n)}}t.exports=s},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.GuildUpdate.handle(n)}}t.exports=s},function(t,e,n){const i=n(1),s=n(0);class r extends i{handle(t){const e=this.packetManager.client,n=t.d,i=e.actions.MessageCreate.handle(n);i.message&&e.emit(s.Events.MESSAGE_CREATE,i.message)}}t.exports=r},function(t,e,n){const i=n(1),s=n(0);class r extends i{handle(t){const e=this.packetManager.client,n=t.d,i=e.actions.MessageDelete.handle(n);i.message&&e.emit(s.Events.MESSAGE_DELETE,i.message)}}t.exports=r},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.MessageDeleteBulk.handle(n)}}t.exports=s},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.MessageReactionAdd.handle(n)}}t.exports=s},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.MessageReactionRemove.handle(n)}}t.exports=s},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.MessageReactionRemoveAll.handle(n); -}}t.exports=s},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.MessageUpdate.handle(n)}}t.exports=s},function(t,e,n){const i=n(1),s=n(0),r=n(4);class o extends i{handle(t){const e=this.packetManager.client,n=t.d;let i=e.users.get(n.user.id);const o=e.guilds.get(n.guild_id);if(!i){if(!n.user.username)return;i=e.dataManager.newUser(n.user)}const u=r.cloneObject(i);if(i.patch(n.user),i.equals(u)||e.emit(s.Events.USER_UPDATE,u,i),o){let t=o.members.get(i.id);if(t||"offline"===n.status||(t=o._addMember({user:i,roles:n.roles,deaf:!1,mute:!1},!1),e.emit(s.Events.GUILD_MEMBER_AVAILABLE,t)),t){if(0===e.listenerCount(s.Events.PRESENCE_UPDATE))return void o._setPresence(i.id,n);const u=r.cloneObject(t);t.presence&&(u.frozenPresence=r.cloneObject(t.presence)),o._setPresence(i.id,n),e.emit(s.Events.PRESENCE_UPDATE,u,t)}else o._setPresence(i.id,n)}}}t.exports=o},function(t,e,n){const i=n(1),s=n(30);class r extends i{handle(t){const e=this.packetManager.client,n=t.d;e.ws.heartbeat();const i=new s(e,n.user);i.settings=n.user_settings,e.user=i,e.readyAt=new Date,e.users.set(i.id,i);for(const r of n.guilds)e.dataManager.newGuild(r);for(const o of n.private_channels)e.dataManager.newChannel(o);for(const u of n.relationships){const t=e.dataManager.newUser(u.user);1===u.type?e.user.friends.set(t.id,t):2===u.type&&e.user.blocked.set(t.id,t)}n.presences=n.presences||[];for(const c of n.presences)e.dataManager.newUser(c.user),e._setPresence(c.user.id,c);if(n.notes)for(const h in n.notes){let t=n.notes[h];t.length||(t=null),e.user.notes.set(h,t)}!e.user.bot&&e.options.sync&&e.setInterval(e.syncGuilds.bind(e),3e4),e.once("ready",e.syncGuilds.bind(e)),e.users.has("1")||e.dataManager.newUser({id:"1",username:"Clyde",discriminator:"0000",avatar:"https://discordapp.com/assets/f78426a064bc9dd24847519259bc42af.png",bot:!0,status:"online",game:null,verified:!0}),e.setTimeout(()=>{e.ws.normalReady||e.ws._emitReady(!1)},1200*n.guilds.length),this.packetManager.ws.sessionID=n.session_id,this.packetManager.ws.checkIfReady()}}t.exports=r},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;1===n.type?e.fetchUser(n.id).then(t=>{e.user.friends.set(t.id,t)}):2===n.type&&e.fetchUser(n.id).then(t=>{e.user.blocked.set(t.id,t)})}}t.exports=s},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;2===n.type?e.user.blocked.has(n.id)&&e.user.blocked.delete(n.id):1===n.type&&e.user.friends.has(n.id)&&e.user.friends.delete(n.id)}}t.exports=s},function(t,e,n){function i(t,e){return t.client.setTimeout(()=>{t.client.emit(r.Events.TYPING_STOP,t,e,t._typing.get(e.id)),t._typing.delete(e.id)},6e3)}const s=n(1),r=n(0);class o extends s{handle(t){const e=this.packetManager.client,n=t.d,s=e.channels.get(n.channel_id),o=e.users.get(n.user_id),c=new Date(1e3*n.timestamp);if(s&&o){if("voice"===s.type)return void e.emit(r.Events.WARN,`Discord sent a typing packet to voice channel ${s.id}`);if(s._typing.has(o.id)){const t=s._typing.get(o.id);t.lastTimestamp=c,t.resetTimeout(i(s,o))}else s._typing.set(o.id,new u(e,c,c,i(s,o))),e.emit(r.Events.TYPING_START,s,o)}}}class u{constructor(t,e,n,i){this.client=t,this.since=e,this.lastTimestamp=n,this._timeout=i}resetTimeout(t){this.client.clearTimeout(this._timeout),this._timeout=t}get elapsedTime(){return Date.now()-this.since}}t.exports=o},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.UserNoteUpdate.handle(n)}}t.exports=s},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.UserUpdate.handle(n)}}t.exports=s},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.emit("self.voiceServer",n)}}t.exports=s},function(t,e,n){const i=n(1),s=n(0),r=n(4);class o extends i{handle(t){const e=this.packetManager.client,n=t.d,i=e.guilds.get(n.guild_id);if(i){const t=i.members.get(n.user_id);if(t){const i=r.cloneObject(t);t.voiceChannel&&t.voiceChannel.id!==n.channel_id&&t.voiceChannel.members.delete(i.id),n.channel_id||(t.speaking=null),t.user.id===e.user.id&&n.channel_id&&e.emit("self.voiceStateUpdate",n);const o=e.channels.get(n.channel_id);o&&o.members.set(t.user.id,t),t.serverMute=n.mute,t.serverDeaf=n.deaf,t.selfMute=n.self_mute,t.selfDeaf=n.self_deaf,t.voiceSessionID=n.session_id,t.voiceChannelID=n.channel_id,e.emit(s.Events.VOICE_STATE_UPDATE,i,t)}}}}t.exports=o},function(t,e){class n{constructor(t,e){this.user=t,this.setup(e)}setup(t){this.type=t.type,this.name=t.name,this.id=t.id,this.revoked=t.revoked,this.integrations=t.integrations}}t.exports=n},function(t,e,n){const i=n(3),s=n(136);class r{constructor(t,e){this.user=t,Object.defineProperty(this,"client",{value:t.client}),this.mutualGuilds=new i,this.connections=new i,this.setup(e)}setup(t){this.premium=t.premium,this.premiumSince=t.premium_since?new Date(t.premium_since):null;for(const e of t.mutual_guilds)this.client.guilds.has(e.id)&&this.mutualGuilds.set(e.id,this.client.guilds.get(e.id));for(const n of t.connected_accounts)this.connections.set(n.id,new s(this.user,n))}}t.exports=r},function(t,e){class n{constructor(t){this.id=t.id,this.name=t.name,this.vip=t.vip,this.deprecated=t.deprecated,this.optimal=t.optimal,this.custom=t.custom,this.sampleHostname=t.sample_hostname}}t.exports=n},function(t,e){},function(t,e){},function(t,e){},function(t,e){},function(t,e){},function(t,e){},function(t,e,n){const i=n(4);t.exports={Client:n(46),Shard:n(49),ShardClientUtil:n(50),ShardingManager:n(51),WebhookClient:n(47),Collection:n(3),Constants:n(0),EvaluatedPermissions:n(6),Permissions:n(6),Snowflake:n(5),SnowflakeUtil:n(5),Util:i,util:i,version:n(29).version,escapeMarkdown:i.escapeMarkdown,fetchRecommendedShards:i.fetchRecommendedShards,splitMessage:i.splitMessage,Channel:n(8),ClientUser:n(30),DMChannel:n(31),Emoji:n(12),Game:n(7).Game,GroupDMChannel:n(19),Guild:n(16),GuildChannel:n(17),GuildMember:n(13),Invite:n(32),Message:n(9),MessageAttachment:n(33),MessageCollector:n(34),MessageEmbed:n(35),MessageReaction:n(36),OAuth2Application:n(37),PartialGuild:n(38),PartialGuildChannel:n(39),PermissionOverwrites:n(40),Presence:n(7).Presence,ReactionEmoji:n(20),RichEmbed:n(48),Role:n(10),TextChannel:n(41),User:n(11),VoiceChannel:n(42),Webhook:n(21)},"browser"===n(15).platform()&&(window.Discord=t.exports)}]); \ No newline at end of file +\`\`\``),reply&&"dm"!==t.channel.type){const t=this.client.resolver.resolveUserID(reply),i=`<@${reply instanceof p&&reply.nickname?"!":""}${t}>`;e=`${i}${e?`, ${e}`:""}`}return this.rest.makeRequest("patch",a.Message(t),!0,{content:e,embed:embed}).then(t=>this.client.actions.MessageUpdate.handle(t).updated)}deleteMessage(t){return this.rest.makeRequest("del",a.Message(t),!0).then(()=>this.client.actions.MessageDelete.handle({id:t.id,channel_id:t.channel.id}).message)}ackMessage(t){return this.rest.makeRequest("post",a.Message(t).ack,!0,{token:this._ackToken}).then(e=>{return e.token&&(this._ackToken=e.token),t})}ackTextChannel(t){return this.rest.makeRequest("post",a.Channel(t).ack,!0,{token:this._ackToken}).then(e=>{return e.token&&(this._ackToken=e.token),t})}ackGuild(t){return this.rest.makeRequest("post",a.Guild(t).ack,!0).then(()=>t)}bulkDeleteMessages(t,e,i){return i&&(e=e.filter(t=>Date.now()-l.deconstruct(t).date.getTime()<12096e5)),this.rest.makeRequest("post",a.Channel(t).messages.bulkDelete,!0,{messages:e}).then(()=>this.client.actions.MessageDeleteBulk.handle({channel_id:t.id,ids:e}).messages)}search(t,e){if(e.before&&(e.before instanceof Date||(e.before=new Date(e.before)),e.maxID=s.fromNumber(e.before.getTime()-14200704e5).shiftLeft(22).toString()),e.after&&(e.after instanceof Date||(e.after=new Date(e.after)),e.minID=s.fromNumber(e.after.getTime()-14200704e5).shiftLeft(22).toString()),e.during){e.during instanceof Date||(e.during=new Date(e.during));const t=e.during.getTime()-14200704e5;e.minID=s.fromNumber(t).shiftLeft(22).toString(),e.maxID=s.fromNumber(t+864e5).shiftLeft(22).toString()}e.channel&&(e.channel=this.client.resolver.resolveChannelID(e.channel)),e.author&&(e.author=this.client.resolver.resolveUserID(e.author)),e.mentions&&(e.mentions=this.client.resolver.resolveUserID(e.options.mentions)),e={content:e.content,max_id:e.maxID,min_id:e.minID,has:e.has,channel_id:e.channel,author_id:e.author,author_type:e.authorType,context_size:e.contextSize,sort_by:e.sortBy,sort_order:e.sortOrder,limit:e.limit,offset:e.offset,mentions:e.mentions,mentions_everyone:e.mentionsEveryone,link_hostname:e.linkHostname,embed_provider:e.embedProvider,embed_type:e.embedType,attachment_filename:e.attachmentFilename,attachment_extension:e.attachmentExtension};for(const i in e)void 0===e[i]&&delete e[i];const o=(n.stringify(e).match(/[^=&?]+=[^=&?]+/g)||[]).join("&");let r;if(t instanceof x)r=a.Channel(t).search;else{if(!(t instanceof w))throw new TypeError("Target must be a TextChannel, DMChannel, GroupDMChannel, or Guild.");r=a.Guild(t).search}return this.rest.makeRequest("get",`${r}?${o}`,!0).then(t=>{const e=t.messages.map(t=>t.map(t=>new d(this.client.channels.get(t.channel_id),t,this.client)));return{totalResults:t.total_results,messages:e}})}createChannel(t,e,i,n){return n instanceof c&&(n=n.array()),this.rest.makeRequest("post",a.Guild(t).channels,!0,{name:e,type:i,permission_overwrites:n}).then(t=>this.client.actions.ChannelCreate.handle(t).channel)}createDM(t){const e=this.getExistingDM(t);return e?Promise.resolve(e):this.rest.makeRequest("post",a.User(this.client.user).channels,!0,{recipient_id:t.id}).then(t=>this.client.actions.ChannelCreate.handle(t).channel)}createGroupDM(t){const e=this.client.user.bot?{access_tokens:t.accessTokens,nicks:t.nicks}:{recipients:t.recipients};return this.rest.makeRequest("post",a.User("@me").channels,!0,e).then(t=>new b(this.client,t))}addUserToGroupDM(t,e){const i=this.client.user.bot?{nick:e.nick,access_token:e.accessToken}:{recipient:e.id};return this.rest.makeRequest("put",a.Channel(t).Recipient(e.id),!0,i).then(()=>t)}getExistingDM(t){return this.client.channels.find(e=>e.recipient&&e.recipient.id===t.id)}deleteChannel(t){return(t instanceof h||t instanceof p)&&(t=this.getExistingDM(t)),t?this.rest.makeRequest("del",a.Channel(t),!0).then(e=>{return e.id=t.id,this.client.actions.ChannelDelete.handle(e).channel}):Promise.reject(new Error("No channel to delete."))}updateChannel(t,e){const i={};return i.name=(e.name||t.name).trim(),i.topic=e.topic||t.topic,i.position=e.position||t.position,i.bitrate=e.bitrate||t.bitrate,i.user_limit=e.userLimit||t.userLimit,this.rest.makeRequest("patch",a.Channel(t),!0,i).then(t=>this.client.actions.ChannelUpdate.handle(t).updated)}leaveGuild(t){return t.ownerID===this.client.user.id?Promise.reject(new Error("Guild is owned by the client.")):this.rest.makeRequest("del",a.User("@me").Guild(t.id),!0).then(()=>this.client.actions.GuildDelete.handle({id:t.id}).guild)}createGuild(t){return t.icon=this.client.resolver.resolveBase64(t.icon)||null,t.region=t.region||"us-central",new Promise((e,i)=>{this.rest.makeRequest("post",a.guilds,!0,t).then(t=>{if(this.client.guilds.has(t.id))return e(this.client.guilds.get(t.id));const n=i=>{i.id===t.id&&(this.client.removeListener(r.Events.GUILD_CREATE,n),this.client.clearTimeout(s),e(i))};this.client.on(r.Events.GUILD_CREATE,n);const s=this.client.setTimeout(()=>{this.client.removeListener(r.Events.GUILD_CREATE,n),i(new Error("Took too long to receive guild data."))},1e4)},i)})}deleteGuild(t){return this.rest.makeRequest("del",a.Guild(t),!0).then(()=>this.client.actions.GuildDelete.handle({id:t.id}).guild)}getUser(t,e){return this.rest.makeRequest("get",a.User(t),!0).then(t=>{return e?this.client.actions.UserGet.handle(t).user:new h(this.client,t)})}updateCurrentUser(t,e){const i=this.client.user,n={};return n.username=t.username||i.username,n.avatar=this.client.resolver.resolveBase64(t.avatar)||i.avatar,i.bot||(n.email=t.email||i.email,n.password=e,t.new_password&&(n.new_password=t.newPassword)),this.rest.makeRequest("patch",a.User("@me"),!0,n).then(t=>this.client.actions.UserUpdate.handle(t).updated)}updateGuild(t,e){const i={};return e.name&&(i.name=e.name),e.region&&(i.region=e.region),e.verificationLevel&&(i.verification_level=Number(e.verificationLevel)),e.afkChannel&&(i.afk_channel_id=this.client.resolver.resolveChannel(e.afkChannel).id),e.afkTimeout&&(i.afk_timeout=Number(e.afkTimeout)),e.icon&&(i.icon=this.client.resolver.resolveBase64(e.icon)),e.owner&&(i.owner_id=this.client.resolver.resolveUser(e.owner).id),e.splash&&(i.splash=this.client.resolver.resolveBase64(e.splash)),this.rest.makeRequest("patch",a.Guild(t),!0,i).then(t=>this.client.actions.GuildUpdate.handle(t).updated)}kickGuildMember(t,e){return this.rest.makeRequest("del",a.Guild(t).Member(e),!0).then(()=>this.client.actions.GuildMemberRemove.handle({guild_id:t.id,user:e.user}).member)}createGuildRole(t,e){return e.color&&(e.color=this.client.resolver.resolveColor(e.color)),e.permissions&&(e.permissions=o.resolve(e.permissions)),this.rest.makeRequest("post",a.Guild(t).roles,!0,e).then(e=>this.client.actions.GuildRoleCreate.handle({guild_id:t.id,role:e}).role)}deleteGuildRole(t){return this.rest.makeRequest("del",a.Guild(t.guild).Role(t.id),!0).then(()=>this.client.actions.GuildRoleDelete.handle({guild_id:t.guild.id,role_id:t.id}).role)}setChannelOverwrite(t,e){return this.rest.makeRequest("put",`${a.Channel(t).permissions}/${e.id}`,!0,e)}deletePermissionOverwrites(t){return this.rest.makeRequest("del",`${a.Channel(t.channel).permissions}/${t.id}`,!0).then(()=>t)}getChannelMessages(t,e={}){const i=[];e.limit&&i.push(`limit=${e.limit}`),e.around?i.push(`around=${e.around}`):e.before?i.push(`before=${e.before}`):e.after&&i.push(`after=${e.after}`);let n=a.Channel(t).messages;return i.length>0&&(n+=`?${i.join("&")}`),this.rest.makeRequest("get",n,!0)}getChannelMessage(t,e){const i=t.messages.get(e);return i?Promise.resolve(i):this.rest.makeRequest("get",a.Channel(t).Message(e),!0)}putGuildMember(t,e,i){if(i.access_token=i.accessToken,i.roles){const t=i.roles;(t instanceof c||t instanceof Array&&t[0]instanceof f)&&(i.roles=t.map(t=>t.id))}return this.rest.makeRequest("put",a.Guild(t).Member(e.id),!0,i).then(e=>this.client.actions.GuildMemberGet.handle(t,e).member)}getGuildMember(t,e,i){return this.rest.makeRequest("get",a.Guild(t).Member(e.id),!0).then(e=>{return i?this.client.actions.GuildMemberGet.handle(t,e).member:new p(t,e)})}updateGuildMember(t,e){e.channel&&(e.channel_id=this.client.resolver.resolveChannel(e.channel).id),e.roles&&(e.roles=e.roles.map(t=>t instanceof f?t.id:t));let i=a.Member(t);if(t.id===this.client.user.id){const n=Object.keys(e);1===n.length&&"nick"===n[0]&&(i=a.Member(t).nickname)}return this.rest.makeRequest("patch",i,!0,e).then(e=>t.guild._updateMember(t,e).mem)}addMemberRole(t,e){return new Promise((i,n)=>{if(t._roles.includes(e.id))return i(t);const s=(t,n)=>{!t._roles.includes(e.id)&&n._roles.includes(e.id)&&(this.client.removeListener(r.Events.GUILD_MEMBER_UPDATE,s),i(n))};this.client.on(r.Events.GUILD_MEMBER_UPDATE,s);const o=this.client.setTimeout(()=>this.client.removeListener(r.Events.GUILD_MEMBER_UPDATE,s),1e4);return this.rest.makeRequest("put",a.Member(t).Role(e.id),!0).catch(t=>{this.client.removeListener(r.Events.GUILD_BAN_REMOVE,s),this.client.clearTimeout(o),n(t)})})}removeMemberRole(t,e){return new Promise((i,n)=>{if(!t._roles.includes(e.id))return i(t);const s=(t,n)=>{t._roles.includes(e.id)&&!n._roles.includes(e.id)&&(this.client.removeListener(r.Events.GUILD_MEMBER_UPDATE,s),i(n))};this.client.on(r.Events.GUILD_MEMBER_UPDATE,s);const o=this.client.setTimeout(()=>this.client.removeListener(r.Events.GUILD_MEMBER_UPDATE,s),1e4);return this.rest.makeRequest("delete",a.Member(t).Role(e.id),!0).catch(t=>{this.client.removeListener(r.Events.GUILD_BAN_REMOVE,s),this.client.clearTimeout(o),n(t)})})}sendTyping(t){return this.rest.makeRequest("post",a.Channel(t).typing,!0)}banGuildMember(t,e,i=0){const n=this.client.resolver.resolveUserID(e);return n?this.rest.makeRequest("put",`${a.Guild(t).bans}/${n}?delete-message-days=${i}`,!0,{"delete-message-days":i}).then(()=>{if(e instanceof p)return e;const i=this.client.resolver.resolveUser(n);return i?(e=this.client.resolver.resolveGuildMember(t,i),e||i):n}):Promise.reject(new Error("Couldn't resolve the user ID to ban."))}unbanGuildMember(t,e){return new Promise((i,n)=>{const s=this.client.resolver.resolveUserID(e);if(!s)throw new Error("Couldn't resolve the user ID to unban.");const o=(e,n)=>{e.id===t.id&&n.id===s&&(this.client.removeListener(r.Events.GUILD_BAN_REMOVE,o),this.client.clearTimeout(c),i(n))};this.client.on(r.Events.GUILD_BAN_REMOVE,o);const c=this.client.setTimeout(()=>{this.client.removeListener(r.Events.GUILD_BAN_REMOVE,o),n(new Error("Took too long to receive the ban remove event."))},1e4);this.rest.makeRequest("del",`${a.Guild(t).bans}/${s}`,!0).catch(t=>{this.client.removeListener(r.Events.GUILD_BAN_REMOVE,o),this.client.clearTimeout(c),n(t)})})}getGuildBans(t){return this.rest.makeRequest("get",a.Guild(t).bans,!0).then(t=>{const e=new c;for(const i of t){const t=this.client.dataManager.newUser(i.user);e.set(t.id,t)}return e})}updateGuildRole(t,e){const i={};return i.name=e.name||t.name,i.position="undefined"!=typeof e.position?e.position:t.position,i.color=this.client.resolver.resolveColor(e.color||t.color),i.hoist="undefined"!=typeof e.hoist?e.hoist:t.hoist,i.mentionable="undefined"!=typeof e.mentionable?e.mentionable:t.mentionable,e.permissions?i.permissions=o.resolve(e.permissions):i.permissions=t.permissions,this.rest.makeRequest("patch",a.Guild(t.guild).Role(t.id),!0,i).then(e=>this.client.actions.GuildRoleUpdate.handle({role:e,guild_id:t.guild.id}).updated)}pinMessage(t){return this.rest.makeRequest("put",a.Channel(t.channel).Pin(t.id),!0).then(()=>t)}unpinMessage(t){return this.rest.makeRequest("del",a.Channel(t.channel).Pin(t.id),!0).then(()=>t)}getChannelPinnedMessages(t){return this.rest.makeRequest("get",a.Channel(t).pins,!0)}createChannelInvite(t,e){const i={};return i.temporary=e.temporary,i.max_age=e.maxAge,i.max_uses=e.maxUses,this.rest.makeRequest("post",a.Channel(t).invites,!0,i).then(t=>new m(this.client,t))}deleteInvite(t){return this.rest.makeRequest("del",a.Invite(t.code),!0).then(()=>t)}getInvite(t){return this.rest.makeRequest("get",a.Invite(t),!0).then(t=>new m(this.client,t))}getGuildInvites(t){return this.rest.makeRequest("get",a.Guild(t).invites,!0).then(t=>{const e=new c;for(const i of t){const t=new m(this.client,i);e.set(t.code,t)}return e})}pruneGuildMembers(t,e,i){return this.rest.makeRequest(i?"get":"post",`${a.Guild(t).prune}?days=${e}`,!0).then(t=>t.pruned)}createEmoji(t,e,i,n){const s={image:e,name:i};return n&&(s.roles=n.map(t=>t.id?t.id:t)),this.rest.makeRequest("post",a.Guild(t).emojis,!0,s).then(e=>this.client.actions.GuildEmojiCreate.handle(t,e).emoji)}updateEmoji(t,e){const i={};return e.name&&(i.name=e.name),e.roles&&(i.roles=e.roles.map(t=>t.id?t.id:t)),this.rest.makeRequest("patch",a.Guild(t.guild).Emoji(t.id),!0,i).then(e=>this.client.actions.GuildEmojiUpdate.handle(t,e).emoji)}deleteEmoji(t){return this.rest.makeRequest("delete",a.Guild(t.guild).Emoji(t.id),!0).then(()=>this.client.actions.GuildEmojiDelete.handle(t).data)}getWebhook(t,e){return this.rest.makeRequest("get",a.Webhook(t,e),!e).then(t=>new g(this.client,t))}getGuildWebhooks(t){return this.rest.makeRequest("get",a.Guild(t).webhooks,!0).then(t=>{const e=new c;for(const i of t)e.set(i.id,new g(this.client,i));return e})}getChannelWebhooks(t){return this.rest.makeRequest("get",a.Channel(t).webhooks,!0).then(t=>{const e=new c;for(const i of t)e.set(i.id,new g(this.client,i));return e})}createWebhook(t,e,i){return this.rest.makeRequest("post",a.Channel(t).webhooks,!0,{name:e,avatar:i}).then(t=>new g(this.client,t))}editWebhook(t,e,i){return this.rest.makeRequest("patch",a.Webhook(t.id,t.token),!1,{name:e,avatar:i}).then(e=>{return t.name=e.name,t.avatar=e.avatar,t})}deleteWebhook(t){return this.rest.makeRequest("delete",a.Webhook(t.id,t.token),!1)}sendWebhookMessage(t,e,{avatarURL,tts,disableEveryone,embeds,username}={},i=null){return username=username||t.name,"undefined"!=typeof e&&(e=this.client.resolver.resolveString(e)),e&&(disableEveryone||"undefined"==typeof disableEveryone&&this.client.options.disableEveryone)&&(e=e.replace(/@(everyone|here)/g,"@​$1")),this.rest.makeRequest("post",`${a.Webhook(t.id,t.token)}?wait=true`,!1,{username:username,avatar_url:avatarURL,content:e,tts:tts,embeds:embeds},i)}sendSlackWebhookMessage(t,e){return this.rest.makeRequest("post",`${a.Webhook(t.id,t.token)}/slack?wait=true`,!1,e)}fetchUserProfile(t){return this.rest.makeRequest("get",a.User(t).profile,!0).then(e=>new v(t,e))}fetchMeMentions(t){return t.guild&&(t.guild=t.guild.id?t.guild.id:t.guild),this.rest.makeRequest("get",a.User("@me").mentions(t.limit,t.roles,t.everyone,t.guild)).then(t=>t.body.map(t=>new d(this.client.channels.get(t.channel_id),t,this.client)))}addFriend(t){return this.rest.makeRequest("post",a.User("@me"),!0,{username:t.username,discriminator:t.discriminator}).then(()=>t)}removeFriend(t){return this.rest.makeRequest("delete",a.User("@me").Relationship(t.id),!0).then(()=>t)}blockUser(t){return this.rest.makeRequest("put",a.User("@me").Relationship(t.id),!0,{type:2}).then(()=>t)}unblockUser(t){return this.rest.makeRequest("delete",a.User("@me").Relationship(t.id),!0).then(()=>t)}updateChannelPositions(t,e){const i=new Array(e.length);for(let n=0;nthis.client.actions.GuildChannelsPositionUpdate.handle({guild_id:t,channels:e}).guild)}setRolePositions(t,e){return this.rest.makeRequest("patch",a.Guild(t).roles,!0,e).then(()=>this.client.actions.GuildRolesPositionUpdate.handle({guild_id:t,roles:e}).guild)}setChannelPositions(t,e){return this.rest.makeRequest("patch",a.Guild(t).channels,!0,e).then(()=>this.client.actions.GuildChannelsPositionUpdate.handle({guild_id:t,channels:e}).guild)}addMessageReaction(t,e){return this.rest.makeRequest("put",a.Message(t).Reaction(e).User("@me"),!0).then(()=>this.client.actions.MessageReactionAdd.handle({user_id:this.client.user.id,message_id:t.id,emoji:u.parseEmoji(e),channel_id:t.channel.id}).reaction)}removeMessageReaction(t,e,i){const n=a.Message(t).Reaction(e).User(i===this.client.user.id?"@me":i.id);return this.rest.makeRequest("delete",n,!0).then(()=>this.client.actions.MessageReactionRemove.handle({user_id:i,message_id:t.id,emoji:u.parseEmoji(e),channel_id:t.channel.id}).reaction)}removeMessageReactions(t){return this.rest.makeRequest("delete",a.Message(t).reactions,!0).then(()=>t)}getMessageReactionUsers(t,e,i=100){return this.rest.makeRequest("get",a.Message(t).Reaction(e,i),!0)}getApplication(t){return this.rest.makeRequest("get",a.OAUTH2.Application(t),!0).then(t=>new E(this.client,t))}resetApplication(t){return this.rest.makeRequest("post",a.OAUTH2.Application(t).reset,!0).then(t=>new E(this.client,t))}setNote(t,e){return this.rest.makeRequest("put",a.User(t).note,!0,{note:e}).then(()=>t)}acceptInvite(t){return t.id&&(t=t.id),new Promise((e,i)=>this.rest.makeRequest("post",a.Invite(t),!0).then(t=>{const n=i=>{i.id===t.id&&(e(i),this.client.removeListener(r.Events.GUILD_CREATE,n))};this.client.on(r.Events.GUILD_CREATE,n),this.client.setTimeout(()=>{this.client.removeListener(r.Events.GUILD_CREATE,n),i(new Error("Accepting invite timed out"))},12e4)}))}}t.exports=y},function(t,e,i){const n=i(44);class s extends n{constructor(t,e){super(t,e),this.client=t.client,this.limit=1/0,this.resetTime=null,this.remaining=1,this.timeDifference=0,this.resetTimeout=null}push(t){super.push(t),this.handle()}execute(t){t&&t.request.gen().end((e,i)=>{if(i&&i.headers&&(this.limit=Number(i.headers["x-ratelimit-limit"]),this.resetTime=1e3*Number(i.headers["x-ratelimit-reset"]),this.remaining=Number(i.headers["x-ratelimit-remaining"]),this.timeDifference=Date.now()-new Date(i.headers.date).getTime()),e)if(429===e.status){if(this.queue.unshift(t),i.headers["x-ratelimit-global"]&&(this.globalLimit=!0),this.resetTimeout)return;this.resetTimeout=this.client.setTimeout(()=>{this.remaining=this.limit,this.globalLimit=!1,this.handle(),this.resetTimeout=null},Number(i.headers["retry-after"])+this.client.options.restTimeOffset)}else t.reject(e),this.handle();else{this.globalLimit=!1;const e=i&&i.body?i.body:{};t.resolve(e),this.handle()}})}handle(){super.handle(),this.remaining<=0||0===this.queue.length||this.globalLimit||(this.execute(this.queue.shift()),this.remaining--,this.handle())}}t.exports=s},function(t,e,i){const n=i(44);class s extends n{constructor(t,e){super(t,e),this.endpoint=e,this.timeDifference=0}push(t){super.push(t),this.handle()}execute(t){return new Promise(e=>{t.request.gen().end((i,n)=>{if(n&&n.headers&&(this.requestLimit=Number(n.headers["x-ratelimit-limit"]),this.requestResetTime=1e3*Number(n.headers["x-ratelimit-reset"]),this.requestRemaining=Number(n.headers["x-ratelimit-remaining"]),this.timeDifference=Date.now()-new Date(n.headers.date).getTime()),i)429===i.status?(this.queue.unshift(t),this.restManager.client.setTimeout(()=>{this.globalLimit=!1,e()},Number(n.headers["retry-after"])+this.restManager.client.options.restTimeOffset),n.headers["x-ratelimit-global"]&&(this.globalLimit=!0)):(t.reject(i),e(i));else{this.globalLimit=!1;const i=n&&n.body?n.body:{};t.resolve(i),0===this.requestRemaining?this.restManager.client.setTimeout(()=>{this.waiting=!1,e(i)},this.requestResetTime-Date.now()+this.timeDifference+this.restManager.client.options.restTimeOffset):e(i)}})})}handle(){super.handle(),0===this.remaining||0===this.queue.length||this.globalLimit||this.execute(this.queue.shift()).then(()=>this.handle())}}t.exports=s},function(t,e,i){(function(e){const n=i(0);class s{constructor(){this.build(this.constructor.DEFAULT)}set({url,version}={}){this.build({url:url||this.constructor.DFEAULT.url,version:version||this.constructor.DEFAULT.version})}build(t){this.userAgent=`DiscordBot (${t.url}, ${t.version}) Node.js/${e.version}`}}s.DEFAULT={url:n.Package.homepage.split("#")[0],version:n.Package.version},t.exports=s}).call(e,i(20))},function(t,e,i){(function(e){const n="browser"===i(16).platform(),s=i(24).EventEmitter,o=i(0),r=i(4).convertToBuffer,a=i(42),c=i(99);let l,u,h=JSON.stringify;if(n)l=window.WebSocket;else{try{l=i(142)}catch(t){l=i(143)}try{u=i(141),h=u.pack}catch(t){u=null}}class p extends s{constructor(t){super(),this.client=t,this.packetManager=new c(this),this.status=o.Status.IDLE,this.sessionID=null,this.sequence=-1,this.gateway=null,this.normalReady=!1,this.ws=null,this.disabledEvents={};for(const e of t.options.disabledEvents)this.disabledEvents[e]=!0;this.first=!0,this.lastHeartbeatAck=!0}_connect(t){this.client.emit("debug",`Connecting to gateway ${t}`),this.normalReady=!1,this.status!==o.Status.RECONNECTING&&(this.status=o.Status.CONNECTING),this.ws=new l(t),n&&(this.ws.binaryType="arraybuffer"),this.ws.onopen=this.eventOpen.bind(this),this.ws.onmessage=this.eventMessage.bind(this),this.ws.onclose=this.eventClose.bind(this),this.ws.onerror=this.eventError.bind(this),this._queue=[],this._remaining=120,this.client.setInterval(()=>{this._remaining=120,this._remainingReset=Date.now()},6e4)}connect(t){t=`${t}&encoding=${u?"etf":"json"}`,this.first?(this._connect(t),this.first=!1):this.client.setTimeout(()=>this._connect(t),5500)}heartbeat(t){return t&&!this.lastHeartbeatAck?void this.ws.close(1007):(this.client.emit("debug","Sending heartbeat"),this.client._pingTimestamp=Date.now(),this.client.ws.send({op:o.OPCodes.HEARTBEAT,d:this.sequence},!0),void(this.lastHeartbeatAck=!1))}send(t,e=false){return e?void this._send(h(t)):(this._queue.push(h(t)),void this.doQueue())}destroy(){this.ws&&this.ws.close(1e3),this._queue=[],this.status=o.Status.IDLE}_send(t){this.ws.readyState===l.OPEN&&(this.emit("send",t),this.ws.send(t))}doQueue(){const t=this._queue[0];if(this.ws.readyState===l.OPEN&&t){if(0===this.remaining)return void this.client.setTimeout(this.doQueue.bind(this),Date.now()-this.remainingReset);this._remaining--,this._send(t),this._queue.shift(),this.doQueue()}}eventOpen(){this.client.emit("debug","Connection to gateway opened"),this.lastHeartbeatAck=!0,this.status===o.Status.RECONNECTING?this._sendResume():this._sendNewIdentify()}_sendResume(){if(!this.sessionID)return void this._sendNewIdentify();this.client.emit("debug","Identifying as resumed session");const t={token:this.client.token,session_id:this.sessionID,seq:this.sequence};this.send({op:o.OPCodes.RESUME,d:t})}_sendNewIdentify(){this.reconnecting=!1;const t=this.client.options.ws;t.token=this.client.token,this.client.options.shardCount>0&&(t.shard=[Number(this.client.options.shardId),Number(this.client.options.shardCount)]),this.client.emit("debug","Identifying as new session"),this.send({op:o.OPCodes.IDENTIFY,d:t}),this.sequence=-1}eventClose(t){this.emit("close",t),this.client.clearInterval(this.client.manager.heartbeatInterval),this.status=o.Status.DISCONNECTED,this._queue=[],this.reconnecting||this.client.emit(o.Events.DISCONNECT,t),[4004,4010,4011].includes(t.code)||this.reconnecting||1e3===t.code||this.tryReconnect()}eventMessage(t){const e=this.tryParseEventData(t.data);return null===e?(this.eventError(new Error(o.Errors.BAD_WS_MESSAGE)),!1):(this.client.emit("raw",e),e.op===o.OPCodes.HELLO&&this.client.manager.setupKeepAlive(e.d.heartbeat_interval),this.packetManager.handle(e))}parseEventData(t){return u?(t instanceof ArrayBuffer&&(t=r(t)),u.unpack(t)):((t instanceof e||t instanceof ArrayBuffer)&&(t=a.inflateSync(t).toString()),JSON.parse(t))}tryParseEventData(t){try{return this.parseEventData(t)}catch(t){return null}}eventError(t){this.client.listenerCount("error")>0&&this.client.emit("error",t),this.tryReconnect()}_emitReady(t=true){this.status=o.Status.READY,this.client.emit(o.Events.READY),this.packetManager.handleQueue(),this.normalReady=t}checkIfReady(){if(this.status!==o.Status.READY&&this.status!==o.Status.NEARLY){let t=0;for(const e of this.client.guilds.keys())t+=this.client.guilds.get(e).available?0:1;if(0===t){if(this.status=o.Status.NEARLY,this.client.options.fetchAllMembers){const t=this.client.guilds.map(t=>t.fetchMembers());return void Promise.all(t).then(()=>this._emitReady(),t=>{this.client.emit(o.Events.WARN,"Error in pre-ready guild member fetching"),this.client.emit(o.Events.ERROR,t),this._emitReady()})}this._emitReady()}}}tryReconnect(){this.status!==o.Status.RECONNECTING&&this.status!==o.Status.CONNECTING&&(this.status=o.Status.RECONNECTING,this.ws.close(),this.packetManager.handleQueue(),this.client.emit(o.Events.RECONNECTING),this.connect(this.client.ws.gateway))}}t.exports=p}).call(e,i(14).Buffer)},function(t,e,i){const n=i(0),s=[n.WSEvents.READY,n.WSEvents.GUILD_CREATE,n.WSEvents.GUILD_DELETE,n.WSEvents.GUILD_MEMBERS_CHUNK,n.WSEvents.GUILD_MEMBER_ADD,n.WSEvents.GUILD_MEMBER_REMOVE];class o{constructor(t){this.ws=t,this.handlers={},this.queue=[],this.register(n.WSEvents.READY,i(126)),this.register(n.WSEvents.GUILD_CREATE,i(106)),this.register(n.WSEvents.GUILD_DELETE,i(107)),this.register(n.WSEvents.GUILD_UPDATE,i(117)),this.register(n.WSEvents.GUILD_BAN_ADD,i(104)),this.register(n.WSEvents.GUILD_BAN_REMOVE,i(105)),this.register(n.WSEvents.GUILD_MEMBER_ADD,i(109)),this.register(n.WSEvents.GUILD_MEMBER_REMOVE,i(110)),this.register(n.WSEvents.GUILD_MEMBER_UPDATE,i(111)),this.register(n.WSEvents.GUILD_ROLE_CREATE,i(113)),this.register(n.WSEvents.GUILD_ROLE_DELETE,i(114)),this.register(n.WSEvents.GUILD_ROLE_UPDATE,i(115)),this.register(n.WSEvents.GUILD_EMOJIS_UPDATE,i(108)),this.register(n.WSEvents.GUILD_MEMBERS_CHUNK,i(112)),this.register(n.WSEvents.CHANNEL_CREATE,i(100)),this.register(n.WSEvents.CHANNEL_DELETE,i(101)),this.register(n.WSEvents.CHANNEL_UPDATE,i(103)),this.register(n.WSEvents.CHANNEL_PINS_UPDATE,i(102)),this.register(n.WSEvents.PRESENCE_UPDATE,i(125)),this.register(n.WSEvents.USER_UPDATE,i(131)),this.register(n.WSEvents.USER_NOTE_UPDATE,i(130)),this.register(n.WSEvents.VOICE_STATE_UPDATE,i(133)),this.register(n.WSEvents.TYPING_START,i(129)),this.register(n.WSEvents.MESSAGE_CREATE,i(118)),this.register(n.WSEvents.MESSAGE_DELETE,i(119)),this.register(n.WSEvents.MESSAGE_UPDATE,i(124)),this.register(n.WSEvents.MESSAGE_DELETE_BULK,i(120)),this.register(n.WSEvents.VOICE_SERVER_UPDATE,i(132)),this.register(n.WSEvents.GUILD_SYNC,i(116)),this.register(n.WSEvents.RELATIONSHIP_ADD,i(127)),this.register(n.WSEvents.RELATIONSHIP_REMOVE,i(128)),this.register(n.WSEvents.MESSAGE_REACTION_ADD,i(121)),this.register(n.WSEvents.MESSAGE_REACTION_REMOVE,i(122)),this.register(n.WSEvents.MESSAGE_REACTION_REMOVE_ALL,i(123))}get client(){return this.ws.client}register(t,e){this.handlers[t]=new e(this)}handleQueue(){this.queue.forEach((t,e)=>{this.handle(this.queue[e]),this.queue.splice(e,1)})}setSequence(t){t&&t>this.ws.sequence&&(this.ws.sequence=t)}handle(t){return t.op===n.OPCodes.RECONNECT?(this.setSequence(t.s),this.ws.tryReconnect(),!1):t.op===n.OPCodes.INVALID_SESSION?(t.d?setTimeout(()=>{this.ws._sendResume()},2500):(this.ws.sessionID=null,this.ws._sendNewIdentify()),!1):(t.op===n.OPCodes.HEARTBEAT_ACK?(this.ws.client._pong(this.ws.client._pingTimestamp),this.ws.lastHeartbeatAck=!0,this.ws.client.emit("debug","Heartbeat acknowledged")):t.op===n.OPCodes.HEARTBEAT&&(this.client.ws.send({op:n.OPCodes.HEARTBEAT,d:this.client.ws.sequence}),this.ws.client.emit("debug","Received gateway heartbeat")),this.ws.status===n.Status.RECONNECTING&&(this.ws.reconnecting=!1,this.ws.checkIfReady()),this.setSequence(t.s),void 0===this.ws.disabledEvents[t.t]&&(this.ws.status!==n.Status.READY&&s.indexOf(t.t)===-1?(this.queue.push(t),!1):!!this.handlers[t.t]&&this.handlers[t.t].handle(t)))}}t.exports=o},function(t,e,i){const n=i(1);class s extends n{handle(t){const e=this.packetManager.client,i=t.d;e.actions.ChannelCreate.handle(i)}}t.exports=s},function(t,e,i){const n=i(1),s=i(0);class o extends n{handle(t){const e=this.packetManager.client,i=t.d,n=e.actions.ChannelDelete.handle(i);n.channel&&e.emit(s.Events.CHANNEL_DELETE,n.channel)}}t.exports=o},function(t,e,i){const n=i(1),s=i(0);class o extends n{handle(t){const e=this.packetManager.client,i=t.d,n=e.channels.get(i.channel_id),o=new Date(i.last_pin_timestamp);n&&o&&e.emit(s.Events.CHANNEL_PINS_UPDATE,n,o)}}t.exports=o},function(t,e,i){const n=i(1);class s extends n{handle(t){const e=this.packetManager.client,i=t.d;e.actions.ChannelUpdate.handle(i)}}t.exports=s},function(t,e,i){const n=i(1),s=i(0);class o extends n{handle(t){const e=this.packetManager.client,i=t.d,n=e.guilds.get(i.guild_id),o=e.users.get(i.user.id);n&&o&&e.emit(s.Events.GUILD_BAN_ADD,n,o)}}t.exports=o},function(t,e,i){const n=i(1);class s extends n{handle(t){const e=this.packetManager.client,i=t.d;e.actions.GuildBanRemove.handle(i)}}t.exports=s},function(t,e,i){const n=i(1);class s extends n{handle(t){const e=this.packetManager.client,i=t.d,n=e.guilds.get(i.id);n?n.available||i.unavailable||(n.setup(i),this.packetManager.ws.checkIfReady()):e.dataManager.newGuild(i)}}t.exports=s},function(t,e,i){const n=i(1),s=i(0);class o extends n{handle(t){const e=this.packetManager.client,i=t.d,n=e.actions.GuildDelete.handle(i);n.guild&&e.emit(s.Events.GUILD_DELETE,n.guild)}}t.exports=o},function(t,e,i){function n(t){const e=new Map;for(const i of t)e.set(...i);return e}const s=i(1);class o extends s{handle(t){const e=this.packetManager.client,i=t.d,s=e.guilds.get(i.guild_id);if(s&&s.emojis){const t=n(s.emojis.entries());for(const o of i.emojis){const i=s.emojis.get(o.id);i?(t.delete(o.id),i.equals(o,!0)||e.actions.GuildEmojiUpdate.handle(i,o)):e.actions.GuildEmojiCreate.handle(s,o)}for(const o of t.values())e.actions.GuildEmojiDelete.handle(o)}}}t.exports=o},function(t,e,i){const n=i(1);class s extends n{handle(t){const e=this.packetManager.client,i=t.d,n=e.guilds.get(i.guild_id);n&&(n.memberCount++,n._addMember(i))}}t.exports=s},function(t,e,i){const n=i(1);class s extends n{handle(t){const e=this.packetManager.client,i=t.d;e.actions.GuildMemberRemove.handle(i)}}t.exports=s},function(t,e,i){const n=i(1);class s extends n{handle(t){const e=this.packetManager.client,i=t.d,n=e.guilds.get(i.guild_id);if(n){const t=n.members.get(i.user.id);t&&n._updateMember(t,i)}}}t.exports=s},function(t,e,i){const n=i(1),s=i(0);class o extends n{handle(t){const e=this.packetManager.client,i=t.d,n=e.guilds.get(i.guild_id);if(n){const t=i.members.map(t=>n._addMember(t,!1));e.emit(s.Events.GUILD_MEMBERS_CHUNK,t,n),e.ws.lastHeartbeatAck=!0}}}t.exports=o},function(t,e,i){const n=i(1);class s extends n{handle(t){const e=this.packetManager.client,i=t.d;e.actions.GuildRoleCreate.handle(i)}}t.exports=s},function(t,e,i){const n=i(1);class s extends n{handle(t){const e=this.packetManager.client,i=t.d;e.actions.GuildRoleDelete.handle(i)}}t.exports=s},function(t,e,i){const n=i(1);class s extends n{handle(t){const e=this.packetManager.client,i=t.d;e.actions.GuildRoleUpdate.handle(i)}}t.exports=s},function(t,e,i){const n=i(1);class s extends n{handle(t){const e=this.packetManager.client,i=t.d;e.actions.GuildSync.handle(i)}}t.exports=s},function(t,e,i){const n=i(1);class s extends n{handle(t){const e=this.packetManager.client,i=t.d;e.actions.GuildUpdate.handle(i)}}t.exports=s},function(t,e,i){const n=i(1),s=i(0);class o extends n{handle(t){const e=this.packetManager.client,i=t.d,n=e.actions.MessageCreate.handle(i);n.message&&e.emit(s.Events.MESSAGE_CREATE,n.message)}}t.exports=o},function(t,e,i){const n=i(1),s=i(0);class o extends n{handle(t){const e=this.packetManager.client,i=t.d,n=e.actions.MessageDelete.handle(i);n.message&&e.emit(s.Events.MESSAGE_DELETE,n.message)}}t.exports=o},function(t,e,i){const n=i(1);class s extends n{handle(t){const e=this.packetManager.client,i=t.d;e.actions.MessageDeleteBulk.handle(i)}}t.exports=s},function(t,e,i){const n=i(1);class s extends n{handle(t){const e=this.packetManager.client,i=t.d;e.actions.MessageReactionAdd.handle(i)}}t.exports=s},function(t,e,i){const n=i(1);class s extends n{handle(t){const e=this.packetManager.client,i=t.d;e.actions.MessageReactionRemove.handle(i)}}t.exports=s},function(t,e,i){const n=i(1);class s extends n{handle(t){const e=this.packetManager.client,i=t.d;e.actions.MessageReactionRemoveAll.handle(i); +}}t.exports=s},function(t,e,i){const n=i(1);class s extends n{handle(t){const e=this.packetManager.client,i=t.d;e.actions.MessageUpdate.handle(i)}}t.exports=s},function(t,e,i){const n=i(1),s=i(0),o=i(4);class r extends n{handle(t){const e=this.packetManager.client,i=t.d;let n=e.users.get(i.user.id);const r=e.guilds.get(i.guild_id);if(!n){if(!i.user.username)return;n=e.dataManager.newUser(i.user)}const a=o.cloneObject(n);if(n.patch(i.user),n.equals(a)||e.emit(s.Events.USER_UPDATE,a,n),r){let t=r.members.get(n.id);if(t||"offline"===i.status||(t=r._addMember({user:n,roles:i.roles,deaf:!1,mute:!1},!1),e.emit(s.Events.GUILD_MEMBER_AVAILABLE,t)),t){if(0===e.listenerCount(s.Events.PRESENCE_UPDATE))return void r._setPresence(n.id,i);const a=o.cloneObject(t);t.presence&&(a.frozenPresence=o.cloneObject(t.presence)),r._setPresence(n.id,i),e.emit(s.Events.PRESENCE_UPDATE,a,t)}else r._setPresence(n.id,i)}}}t.exports=r},function(t,e,i){const n=i(1),s=i(29);class o extends n{handle(t){const e=this.packetManager.client,i=t.d;e.ws.heartbeat();const n=new s(e,i.user);n.settings=i.user_settings,e.user=n,e.readyAt=new Date,e.users.set(n.id,n);for(const o of i.guilds)e.dataManager.newGuild(o);for(const r of i.private_channels)e.dataManager.newChannel(r);for(const a of i.relationships){const t=e.dataManager.newUser(a.user);1===a.type?e.user.friends.set(t.id,t):2===a.type&&e.user.blocked.set(t.id,t)}i.presences=i.presences||[];for(const c of i.presences)e.dataManager.newUser(c.user),e._setPresence(c.user.id,c);if(i.notes)for(const l in i.notes){let t=i.notes[l];t.length||(t=null),e.user.notes.set(l,t)}!e.user.bot&&e.options.sync&&e.setInterval(e.syncGuilds.bind(e),3e4),e.once("ready",e.syncGuilds.bind(e)),e.users.has("1")||e.dataManager.newUser({id:"1",username:"Clyde",discriminator:"0000",avatar:"https://discordapp.com/assets/f78426a064bc9dd24847519259bc42af.png",bot:!0,status:"online",game:null,verified:!0}),e.setTimeout(()=>{e.ws.normalReady||e.ws._emitReady(!1)},1200*i.guilds.length),this.packetManager.ws.sessionID=i.session_id,this.packetManager.ws.checkIfReady()}}t.exports=o},function(t,e,i){const n=i(1);class s extends n{handle(t){const e=this.packetManager.client,i=t.d;1===i.type?e.fetchUser(i.id).then(t=>{e.user.friends.set(t.id,t)}):2===i.type&&e.fetchUser(i.id).then(t=>{e.user.blocked.set(t.id,t)})}}t.exports=s},function(t,e,i){const n=i(1);class s extends n{handle(t){const e=this.packetManager.client,i=t.d;2===i.type?e.user.blocked.has(i.id)&&e.user.blocked.delete(i.id):1===i.type&&e.user.friends.has(i.id)&&e.user.friends.delete(i.id)}}t.exports=s},function(t,e,i){function n(t,e){return t.client.setTimeout(()=>{t.client.emit(o.Events.TYPING_STOP,t,e,t._typing.get(e.id)),t._typing.delete(e.id)},6e3)}const s=i(1),o=i(0);class r extends s{handle(t){const e=this.packetManager.client,i=t.d,s=e.channels.get(i.channel_id),r=e.users.get(i.user_id),c=new Date(1e3*i.timestamp);if(s&&r){if("voice"===s.type)return void e.emit(o.Events.WARN,`Discord sent a typing packet to voice channel ${s.id}`);if(s._typing.has(r.id)){const t=s._typing.get(r.id);t.lastTimestamp=c,t.resetTimeout(n(s,r))}else s._typing.set(r.id,new a(e,c,c,n(s,r))),e.emit(o.Events.TYPING_START,s,r)}}}class a{constructor(t,e,i,n){this.client=t,this.since=e,this.lastTimestamp=i,this._timeout=n}resetTimeout(t){this.client.clearTimeout(this._timeout),this._timeout=t}get elapsedTime(){return Date.now()-this.since}}t.exports=r},function(t,e,i){const n=i(1);class s extends n{handle(t){const e=this.packetManager.client,i=t.d;e.actions.UserNoteUpdate.handle(i)}}t.exports=s},function(t,e,i){const n=i(1);class s extends n{handle(t){const e=this.packetManager.client,i=t.d;e.actions.UserUpdate.handle(i)}}t.exports=s},function(t,e,i){const n=i(1);class s extends n{handle(t){const e=this.packetManager.client,i=t.d;e.emit("self.voiceServer",i)}}t.exports=s},function(t,e,i){const n=i(1),s=i(0),o=i(4);class r extends n{handle(t){const e=this.packetManager.client,i=t.d,n=e.guilds.get(i.guild_id);if(n){const t=n.members.get(i.user_id);if(t){const n=o.cloneObject(t);t.voiceChannel&&t.voiceChannel.id!==i.channel_id&&t.voiceChannel.members.delete(n.id),i.channel_id||(t.speaking=null),t.user.id===e.user.id&&i.channel_id&&e.emit("self.voiceStateUpdate",i);const r=e.channels.get(i.channel_id);r&&r.members.set(t.user.id,t),t.serverMute=i.mute,t.serverDeaf=i.deaf,t.selfMute=i.self_mute,t.selfDeaf=i.self_deaf,t.voiceSessionID=i.session_id,t.voiceChannelID=i.channel_id,e.emit(s.Events.VOICE_STATE_UPDATE,n,t)}}}}t.exports=r},function(t,e){class i{constructor(t,e){this.user=t,this.setup(e)}setup(t){this.type=t.type,this.name=t.name,this.id=t.id,this.revoked=t.revoked,this.integrations=t.integrations}}t.exports=i},function(t,e,i){const n=i(3),s=i(134);class o{constructor(t,e){this.user=t,Object.defineProperty(this,"client",{value:t.client}),this.mutualGuilds=new n,this.connections=new n,this.setup(e)}setup(t){this.premium=t.premium,this.premiumSince=t.premium_since?new Date(t.premium_since):null;for(const e of t.mutual_guilds)this.client.guilds.has(e.id)&&this.mutualGuilds.set(e.id,this.client.guilds.get(e.id));for(const i of t.connected_accounts)this.connections.set(i.id,new s(this.user,i))}}t.exports=o},function(t,e){class i{constructor(t){this.id=t.id,this.name=t.name,this.vip=t.vip,this.deprecated=t.deprecated,this.optimal=t.optimal,this.custom=t.custom,this.sampleHostname=t.sample_hostname}}t.exports=i},function(t,e){},function(t,e){},function(t,e){},function(t,e){},function(t,e){},function(t,e){},function(t,e){},function(t,e,i){const n=i(4);t.exports={Client:i(45),Shard:i(48),ShardClientUtil:i(49),ShardingManager:i(50),WebhookClient:i(46),Collection:i(3),Constants:i(0),EvaluatedPermissions:i(6),Permissions:i(6),Snowflake:i(5),SnowflakeUtil:i(5),Util:n,util:n,version:i(28).version,escapeMarkdown:n.escapeMarkdown,fetchRecommendedShards:n.fetchRecommendedShards,splitMessage:n.splitMessage,Channel:i(8),ClientUser:i(29),DMChannel:i(30),Emoji:i(12),Game:i(7).Game,GroupDMChannel:i(21),Guild:i(17),GuildChannel:i(18),GuildMember:i(13),Invite:i(31),Message:i(9),MessageAttachment:i(32),MessageCollector:i(33),MessageEmbed:i(34),MessageReaction:i(35),OAuth2Application:i(36),PartialGuild:i(37),PartialGuildChannel:i(38),PermissionOverwrites:i(39),Presence:i(7).Presence,ReactionEmoji:i(22),RichEmbed:i(47),Role:i(10),TextChannel:i(40),User:i(11),VoiceChannel:i(41),Webhook:i(23)},"browser"===i(16).platform()&&(window.Discord=t.exports)}]); \ No newline at end of file