From 0fdcae8d3a06f987360b0f1071f430907f71757d Mon Sep 17 00:00:00 2001 From: Travis CI Date: Sun, 3 Sep 2017 17:21:07 +0000 Subject: [PATCH] Webpack build for branch stable: 42c195c8571b28ecc076af3679b7af4e385f3b45 --- discord.stable.js | 8114 +++++++++++++++++++++++------------------ discord.stable.min.js | 2 +- 2 files changed, 4588 insertions(+), 3528 deletions(-) diff --git a/discord.stable.js b/discord.stable.js index 8292bbd3..827dfd82 100644 --- a/discord.stable.js +++ b/discord.stable.js @@ -60,14 +60,14 @@ /******/ __webpack_require__.p = ""; /******/ /******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = 73); +/******/ return __webpack_require__(__webpack_require__.s = 75); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ /***/ (function(module, exports, __webpack_require__) { -/* WEBPACK VAR INJECTION */(function(process) {exports.Package = __webpack_require__(52); +/* WEBPACK VAR INJECTION */(function(process) {exports.Package = __webpack_require__(55); /** * Options for a client. @@ -98,6 +98,7 @@ * 100% certain you don't need, as many are important, but not obviously so. The safest one to disable with the * most impact is typically `TYPING_START`. * @property {WebsocketOptions} [ws] Options for the WebSocket + * @property {HTTPOptions} [http] HTTP options */ exports.DefaultOptions = { apiRequestMethod: 'sequential', @@ -122,7 +123,7 @@ exports.DefaultOptions = { */ ws: { large_threshold: 250, - compress: __webpack_require__(27).platform() !== 'browser', + compress: __webpack_require__(107).platform() !== 'browser', properties: { $os: process ? process.platform : 'discord.js', $browser: 'discord.js', @@ -132,6 +133,15 @@ exports.DefaultOptions = { }, version: 6, }, + + /** + * HTTP options + * @typedef {Object} HTTPOptions + * @property {number} [version=7] API version to use + * @property {string} [api='https://discordapp.com/api'] Base url of the API + * @property {string} [cdn='https://cdn.discordapp.com'] Base url of the CDN + * @property {string} [invite='https://discord.gg'] Base url of invites + */ http: { version: 7, host: 'https://discordapp.com', @@ -171,7 +181,10 @@ const Endpoints = exports.Endpoints = { relationships: `${base}/relationships`, settings: `${base}/settings`, Relationship: uID => `${base}/relationships/${uID}`, - Guild: guildID => `${base}/guilds/${guildID}`, + Guild: guildID => ({ + toString: () => `${base}/guilds/${guildID}`, + settings: `${base}/guilds/${guildID}/settings`, + }), Note: id => `${base}/notes/${id}`, Mentions: (limit, roles, everyone, guildID) => `${base}/mentions?limit=${limit}&roles=${roles}&everyone=${everyone}${guildID ? `&guild_id=${guildID}` : ''}`, @@ -202,7 +215,7 @@ const Endpoints = exports.Endpoints = { ack: `${base}/ack`, settings: `${base}/settings`, auditLogs: `${base}/audit-logs`, - Emoji: emojiID => Endpoints.CDN(root).Emoji(emojiID), + Emoji: emojiID => `${base}/emojis/${emojiID}`, Icon: (root, hash) => Endpoints.CDN(root).Icon(guildID, hash), Splash: (root, hash) => Endpoints.CDN(root).Splash(guildID, hash), Role: roleID => `${base}/roles/${roleID}`, @@ -233,6 +246,7 @@ const Endpoints = exports.Endpoints = { webhooks: `${base}/webhooks`, search: `${base}/messages/search`, pins: `${base}/pins`, + Icon: (root, hash) => Endpoints.CDN(root).GDMIcon(channelID, hash), Pin: messageID => `${base}/pins/${messageID}`, Recipient: recipientID => `${base}/recipients/${recipientID}`, Message: messageID => { @@ -261,6 +275,7 @@ const Endpoints = exports.Endpoints = { Asset: name => `${root}/assets/${name}`, Avatar: (userID, hash) => `${root}/avatars/${userID}/${hash}.${hash.startsWith('a_') ? 'gif' : 'png'}?size=2048`, Icon: (guildID, hash) => `${root}/icons/${guildID}/${hash}.jpg`, + GDMIcon: (channelID, hash) => `${root}/channel-icons/${channelID}/${hash}.jpg?size=2048`, Splash: (guildID, hash) => `${root}/splashes/${guildID}/${hash}.jpg`, }; }, @@ -269,7 +284,8 @@ const Endpoints = exports.Endpoints = { const base = `/oauth2/applications/${appID}`; return { toString: () => base, - reset: `${base}/reset`, + resetSecret: `${base}/reset`, + resetToken: `${base}/bot/reset`, }; }, App: appID => `/oauth2/authorize?client_id=${appID}`, @@ -281,7 +297,7 @@ const Endpoints = exports.Endpoints = { toString: () => '/gateway', bot: '/gateway/bot', }, - Invite: inviteID => `/invite/${inviteID}`, + Invite: inviteID => `/invite/${inviteID}?with_counts=true`, inviteLink: id => `https://discord.gg/${id}`, Webhook: (webhookID, token) => `/webhooks/${webhookID}${token ? `/${token}` : ''}`, }; @@ -289,12 +305,12 @@ const Endpoints = exports.Endpoints = { /** * The current status of the client. Here are the available statuses: - * - READY - * - CONNECTING - * - RECONNECTING - * - IDLE - * - NEARLY - * - DISCONNECTED + * * READY + * * CONNECTING + * * RECONNECTING + * * IDLE + * * NEARLY + * * DISCONNECTED * @typedef {number} Status */ exports.Status = { @@ -308,11 +324,11 @@ exports.Status = { /** * The current status of a voice connection. Here are the available statuses: - * - CONNECTED - * - CONNECTING - * - AUTHENTICATING - * - RECONNECTING - * - DISCONNECTED + * * CONNECTED + * * CONNECTING + * * AUTHENTICATING + * * RECONNECTING + * * DISCONNECTED * @typedef {number} VoiceStatus */ exports.VoiceStatus = { @@ -356,6 +372,7 @@ exports.VoiceOPCodes = { exports.Events = { READY: 'ready', + RESUME: 'resume', GUILD_CREATE: 'guildCreate', GUILD_DELETE: 'guildDelete', GUILD_UPDATE: 'guildUpdate', @@ -389,6 +406,7 @@ exports.Events = { USER_UPDATE: 'userUpdate', USER_NOTE_UPDATE: 'userNoteUpdate', USER_SETTINGS_UPDATE: 'clientUserSettingsUpdate', + USER_GUILD_SETTINGS_UPDATE: 'clientUserGuildSettingsUpdate', PRESENCE_UPDATE: 'presenceUpdate', VOICE_STATE_UPDATE: 'voiceStateUpdate', TYPING_START: 'typingStart', @@ -402,41 +420,41 @@ exports.Events = { /** * The type of a websocket message event, e.g. `MESSAGE_CREATE`. Here are the available events: - * - READY - * - RESUMED - * - GUILD_SYNC - * - GUILD_CREATE - * - GUILD_DELETE - * - GUILD_UPDATE - * - GUILD_MEMBER_ADD - * - GUILD_MEMBER_REMOVE - * - GUILD_MEMBER_UPDATE - * - GUILD_MEMBERS_CHUNK - * - GUILD_ROLE_CREATE - * - GUILD_ROLE_DELETE - * - GUILD_ROLE_UPDATE - * - GUILD_BAN_ADD - * - GUILD_BAN_REMOVE - * - CHANNEL_CREATE - * - CHANNEL_DELETE - * - CHANNEL_UPDATE - * - CHANNEL_PINS_UPDATE - * - MESSAGE_CREATE - * - MESSAGE_DELETE - * - MESSAGE_UPDATE - * - MESSAGE_DELETE_BULK - * - MESSAGE_REACTION_ADD - * - MESSAGE_REACTION_REMOVE - * - MESSAGE_REACTION_REMOVE_ALL - * - USER_UPDATE - * - USER_NOTE_UPDATE - * - USER_SETTINGS_UPDATE - * - PRESENCE_UPDATE - * - VOICE_STATE_UPDATE - * - TYPING_START - * - VOICE_SERVER_UPDATE - * - RELATIONSHIP_ADD - * - RELATIONSHIP_REMOVE + * * READY + * * RESUMED + * * GUILD_SYNC + * * GUILD_CREATE + * * GUILD_DELETE + * * GUILD_UPDATE + * * GUILD_MEMBER_ADD + * * GUILD_MEMBER_REMOVE + * * GUILD_MEMBER_UPDATE + * * GUILD_MEMBERS_CHUNK + * * GUILD_ROLE_CREATE + * * GUILD_ROLE_DELETE + * * GUILD_ROLE_UPDATE + * * GUILD_BAN_ADD + * * GUILD_BAN_REMOVE + * * CHANNEL_CREATE + * * CHANNEL_DELETE + * * CHANNEL_UPDATE + * * CHANNEL_PINS_UPDATE + * * MESSAGE_CREATE + * * MESSAGE_DELETE + * * MESSAGE_UPDATE + * * MESSAGE_DELETE_BULK + * * MESSAGE_REACTION_ADD + * * MESSAGE_REACTION_REMOVE + * * MESSAGE_REACTION_REMOVE_ALL + * * USER_UPDATE + * * USER_NOTE_UPDATE + * * USER_SETTINGS_UPDATE + * * PRESENCE_UPDATE + * * VOICE_STATE_UPDATE + * * TYPING_START + * * VOICE_SERVER_UPDATE + * * RELATIONSHIP_ADD + * * RELATIONSHIP_REMOVE * @typedef {string} WSEventType */ exports.WSEvents = { @@ -470,6 +488,7 @@ exports.WSEvents = { USER_UPDATE: 'USER_UPDATE', USER_NOTE_UPDATE: 'USER_NOTE_UPDATE', USER_SETTINGS_UPDATE: 'USER_SETTINGS_UPDATE', + USER_GUILD_SETTINGS_UPDATE: 'USER_GUILD_SETTINGS_UPDATE', PRESENCE_UPDATE: 'PRESENCE_UPDATE', VOICE_STATE_UPDATE: 'VOICE_STATE_UPDATE', TYPING_START: 'TYPING_START', @@ -478,6 +497,18 @@ exports.WSEvents = { RELATIONSHIP_REMOVE: 'RELATIONSHIP_REMOVE', }; +/** + * The type of a message, e.g. `DEFAULT`. Here are the available types: + * * DEFAULT + * * RECIPIENT_ADD + * * RECIPIENT_REMOVE + * * CALL + * * CHANNEL_NAME_CHANGE + * * CHANNEL_ICON_CHANGE + * * PINS_ADD + * * GUILD_MEMBER_JOIN + * @typedef {string} MessageType + */ exports.MessageTypes = [ 'DEFAULT', 'RECIPIENT_ADD', @@ -489,6 +520,21 @@ exports.MessageTypes = [ 'GUILD_MEMBER_JOIN', ]; +/** + * The type of a message notification setting. Here are the available types: + * * EVERYTHING + * * MENTIONS + * * NOTHING + * * INHERIT (only for GuildChannel) + * @typedef {string} MessageNotificationType + */ +exports.MessageNotificationTypes = [ + 'EVERYTHING', + 'MENTIONS', + 'NOTHING', + 'INHERIT', +]; + exports.DefaultAvatars = { BLURPLE: '6debd47ed13483642cf09e832ed0bc1b', GREY: '322c936a8c8be1b803cd94861bdfa868', @@ -612,8 +658,8 @@ exports.UserSettingsMap = { explicit_content_filter: function explicitContentFilter(type) { // eslint-disable-line func-name-matching /** - * Safe direct messaging; force people's messages with images to be scanned before they are sent to you - * one of `DISABLED`, `NON_FRIENDS`, `FRIENDS_AND_NON_FRIENDS` + * Safe direct messaging; force people's messages with images to be scanned before they are sent to you. + * One of `DISABLED`, `NON_FRIENDS`, `FRIENDS_AND_NON_FRIENDS` * @name ClientUserSettings#explicitContentFilter * @type {string} */ @@ -636,6 +682,58 @@ exports.UserSettingsMap = { }, }; +exports.UserGuildSettingsMap = { + message_notifications: function messageNotifications(type) { // eslint-disable-line func-name-matching + /** + * The type of message that should notify you + * @name ClientUserGuildSettings#messageNotifications + * @type {MessageNotificationType} + */ + return exports.MessageNotificationTypes[type]; + }, + /** + * Whether to receive mobile push notifications + * @name ClientUserGuildSettings#mobilePush + * @type {boolean} + */ + mobile_push: 'mobilePush', + /** + * Whether the guild is muted + * @name ClientUserGuildSettings#muted + * @type {boolean} + */ + muted: 'muted', + /** + * Whether to suppress everyone mention + * @name ClientUserGuildSettings#suppressEveryone + * @type {boolean} + */ + suppress_everyone: 'suppressEveryone', + /** + * A collection containing all the channel overrides + * @name ClientUserGuildSettings#channelOverrides + * @type {Collection} + */ + channel_overrides: 'channelOverrides', +}; + +exports.UserChannelOverrideMap = { + message_notifications: function messageNotifications(type) { // eslint-disable-line func-name-matching + /** + * The type of message that should notify you + * @name ClientUserChannelOverride#messageNotifications + * @type {MessageNotificationType} + */ + return exports.MessageNotificationTypes[type]; + }, + /** + * Whether the channel is muted + * @name ClientUserChannelOverride#muted + * @type {boolean} + */ + muted: 'muted', +}; + exports.Colors = { DEFAULT: 0x000000, AQUA: 0x1ABC9C, @@ -664,6 +762,99 @@ exports.Colors = { NOT_QUITE_BLACK: 0x23272A, }; +/** + * An error encountered while performing an API request. Here are the potential errors: + * * UNKNOWN_ACCOUNT + * * UNKNOWN_APPLICATION + * * UNKNOWN_CHANNEL + * * UNKNOWN_GUILD + * * UNKNOWN_INTEGRATION + * * UNKNOWN_INVITE + * * UNKNOWN_MEMBER + * * UNKNOWN_MESSAGE + * * UNKNOWN_OVERWRITE + * * UNKNOWN_PROVIDER + * * UNKNOWN_ROLE + * * UNKNOWN_TOKEN + * * UNKNOWN_USER + * * UNKNOWN_EMOJI + * * BOT_PROHIBITED_ENDPOINT + * * BOT_ONLY_ENDPOINT + * * MAXIMUM_GUILDS + * * MAXIMUM_FRIENDS + * * MAXIMUM_PINS + * * MAXIMUM_ROLES + * * MAXIMUM_REACTIONS + * * UNAUTHORIZED + * * MISSING_ACCESS + * * INVALID_ACCOUNT_TYPE + * * CANNOT_EXECUTE_ON_DM + * * EMBED_DISABLED + * * CANNOT_EDIT_MESSAGE_BY_OTHER + * * CANNOT_SEND_EMPTY_MESSAGE + * * CANNOT_MESSAGE_USER + * * CANNOT_SEND_MESSAGES_IN_VOICE_CHANNEL + * * CHANNEL_VERIFICATION_LEVEL_TOO_HIGH + * * OAUTH2_APPLICATION_BOT_ABSENT + * * MAXIMUM_OAUTH2_APPLICATIONS + * * INVALID_OAUTH_STATE + * * MISSING_PERMISSIONS + * * INVALID_AUTHENTICATION_TOKEN + * * NOTE_TOO_LONG + * * INVALID_BULK_DELETE_QUANTITY + * * CANNOT_PIN_MESSAGE_IN_OTHER_CHANNEL + * * CANNOT_EXECUTE_ON_SYSTEM_MESSAGE + * * BULK_DELETE_MESSAGE_TOO_OLD + * * INVITE_ACCEPTED_TO_GUILD_NOT_CONTANING_BOT + * * REACTION_BLOCKED + * @typedef {string} APIError + */ +exports.APIErrors = { + UNKNOWN_ACCOUNT: 10001, + UNKNOWN_APPLICATION: 10002, + UNKNOWN_CHANNEL: 10003, + UNKNOWN_GUILD: 10004, + UNKNOWN_INTEGRATION: 10005, + UNKNOWN_INVITE: 10006, + UNKNOWN_MEMBER: 10007, + UNKNOWN_MESSAGE: 10008, + UNKNOWN_OVERWRITE: 10009, + UNKNOWN_PROVIDER: 10010, + UNKNOWN_ROLE: 10011, + UNKNOWN_TOKEN: 10012, + UNKNOWN_USER: 10013, + UNKNOWN_EMOJI: 10014, + BOT_PROHIBITED_ENDPOINT: 20001, + BOT_ONLY_ENDPOINT: 20002, + MAXIMUM_GUILDS: 30001, + MAXIMUM_FRIENDS: 30002, + MAXIMUM_PINS: 30003, + MAXIMUM_ROLES: 30005, + MAXIMUM_REACTIONS: 30010, + UNAUTHORIZED: 40001, + MISSING_ACCESS: 50001, + INVALID_ACCOUNT_TYPE: 50002, + CANNOT_EXECUTE_ON_DM: 50003, + EMBED_DISABLED: 50004, + CANNOT_EDIT_MESSAGE_BY_OTHER: 50005, + CANNOT_SEND_EMPTY_MESSAGE: 50006, + CANNOT_MESSAGE_USER: 50007, + CANNOT_SEND_MESSAGES_IN_VOICE_CHANNEL: 50008, + CHANNEL_VERIFICATION_LEVEL_TOO_HIGH: 50009, + OAUTH2_APPLICATION_BOT_ABSENT: 50010, + MAXIMUM_OAUTH2_APPLICATIONS: 50011, + INVALID_OAUTH_STATE: 50012, + MISSING_PERMISSIONS: 50013, + INVALID_AUTHENTICATION_TOKEN: 50014, + NOTE_TOO_LONG: 50015, + INVALID_BULK_DELETE_QUANTITY: 50016, + CANNOT_PIN_MESSAGE_IN_OTHER_CHANNEL: 50019, + CANNOT_EXECUTE_ON_SYSTEM_MESSAGE: 50021, + BULK_DELETE_MESSAGE_TOO_OLD: 50034, + INVITE_ACCEPTED_TO_GUILD_NOT_CONTANING_BOT: 50036, + REACTION_BLOCKED: 90001, +}; + /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(7))) /***/ }), @@ -777,59 +968,99 @@ class Collection extends Map { } /** - * Obtains the first item in this collection. - * @returns {*} + * Obtains the first value(s) in this collection. + * @param {number} [count] Number of values to obtain from the beginning + * @returns {*|Array<*>} The single value if `count` is undefined, or an array of values of `count` length */ - first() { - return this.values().next().value; + first(count) { + if (count === undefined) return this.values().next().value; + if (typeof count !== 'number') throw new TypeError('The count must be a number.'); + if (!Number.isInteger(count) || count < 1) throw new RangeError('The count must be an integer greater than 0.'); + count = Math.min(this.size, count); + const arr = new Array(count); + const iter = this.values(); + for (let i = 0; i < count; i++) arr[i] = iter.next().value; + return arr; } /** - * Obtains the first key in this collection. - * @returns {*} + * Obtains the first key(s) in this collection. + * @param {number} [count] Number of keys to obtain from the beginning + * @returns {*|Array<*>} The single key if `count` is undefined, or an array of keys of `count` length */ - firstKey() { - return this.keys().next().value; + firstKey(count) { + if (count === undefined) return this.keys().next().value; + if (typeof count !== 'number') throw new TypeError('The count must be a number.'); + if (!Number.isInteger(count) || count < 1) throw new RangeError('The count must be an integer greater than 0.'); + count = Math.min(this.size, count); + const arr = new Array(count); + const iter = this.iter(); + for (let i = 0; i < count; i++) arr[i] = iter.next().value; + return arr; } /** - * Obtains the last item in this collection. This relies on the `array()` method, and thus the caching mechanism - * applies here as well. - * @returns {*} + * Obtains the last value(s) in this collection. This relies on {@link Collection#array}, and thus the caching + * mechanism applies here as well. + * @param {number} [count] Number of values to obtain from the end + * @returns {*|Array<*>} The single value if `count` is undefined, or an array of values of `count` length */ - last() { + last(count) { const arr = this.array(); - return arr[arr.length - 1]; + if (count === undefined) return arr[arr.length - 1]; + if (typeof count !== 'number') throw new TypeError('The count must be a number.'); + if (!Number.isInteger(count) || count < 1) throw new RangeError('The count must be an integer greater than 0.'); + return arr.slice(-count); } /** - * Obtains the last key in this collection. This relies on the `keyArray()` method, and thus the caching mechanism - * applies here as well. - * @returns {*} + * Obtains the last key(s) in this collection. This relies on {@link Collection#keyArray}, and thus the caching + * mechanism applies here as well. + * @param {number} [count] Number of keys to obtain from the end + * @returns {*|Array<*>} The single key if `count` is undefined, or an array of keys of `count` length */ - lastKey() { + lastKey(count) { const arr = this.keyArray(); - return arr[arr.length - 1]; + if (count === undefined) return arr[arr.length - 1]; + if (typeof count !== 'number') throw new TypeError('The count must be a number.'); + if (!Number.isInteger(count) || count < 1) throw new RangeError('The count must be an integer greater than 0.'); + return arr.slice(-count); } /** - * Obtains a random item from this collection. This relies on the `array()` method, and thus the caching mechanism - * applies here as well. - * @returns {*} + * Obtains random value(s) from this collection. This relies on {@link Collection#array}, and thus the caching + * mechanism applies here as well. + * @param {number} [count] Number of values to obtain randomly + * @returns {*|Array<*>} The single value if `count` is undefined, or an array of values of `count` length */ - random() { - const arr = this.array(); - return arr[Math.floor(Math.random() * arr.length)]; + random(count) { + let arr = this.array(); + if (count === undefined) return arr[Math.floor(Math.random() * arr.length)]; + if (typeof count !== 'number') throw new TypeError('The count must be a number.'); + if (!Number.isInteger(count) || count < 1) throw new RangeError('The count must be an integer greater than 0.'); + if (arr.length === 0) return []; + const rand = new Array(count); + arr = arr.slice(); + for (let i = 0; i < count; i++) rand[i] = arr.splice(Math.floor(Math.random() * arr.length), 1)[0]; + return rand; } /** - * Obtains a random key from this collection. This relies on the `keyArray()` method, and thus the caching mechanism - * applies here as well. - * @returns {*} + * Obtains random key(s) from this collection. This relies on {@link Collection#keyArray}, and thus the caching + * mechanism applies here as well. + * @param {number} [count] Number of keys to obtain randomly + * @returns {*|Array<*>} The single key if `count` is undefined, or an array of keys of `count` length */ - randomKey() { - const arr = this.keyArray(); - return arr[Math.floor(Math.random() * arr.length)]; + randomKey(count) { + let arr = this.keyArray(); + if (count === undefined) return arr[Math.floor(Math.random() * arr.length)]; + if (typeof count !== 'number') throw new TypeError('The count must be a number.'); + if (!Number.isInteger(count) || count < 1) throw new RangeError('The count must be an integer greater than 0.'); + if (arr.length === 0) return []; + const rand = new Array(count); + arr = arr.slice(); + for (let i = 0; i < count; i++) rand[i] = arr.splice(Math.floor(Math.random() * arr.length), 1)[0]; + return rand; } /** @@ -1108,7 +1339,7 @@ module.exports = Collection; /* 4 */ /***/ (function(module, exports, __webpack_require__) { -/* WEBPACK VAR INJECTION */(function(Buffer) {const snekfetch = __webpack_require__(30); +/* WEBPACK VAR INJECTION */(function(Buffer) {const snekfetch = __webpack_require__(32); const Constants = __webpack_require__(0); const ConstantsHttp = Constants.DefaultOptions.http; @@ -1176,9 +1407,9 @@ class Util { /** * Parses emoji info out of a string. The string must be one of: - * - A UTF-8 emoji (no ID) - * - A URL-encoded UTF-8 emoji (no ID) - * - A Discord custom emoji (`<:name:id>`) + * * A UTF-8 emoji (no ID) + * * A URL-encoded UTF-8 emoji (no ID) + * * A Discord custom emoji (`<:name:id>`) * @param {string} text Emoji string to parse * @returns {Object} Object with `name` and `id` properties * @private @@ -1338,9 +1569,9 @@ module.exports = Util; -var base64 = __webpack_require__(74) -var ieee754 = __webpack_require__(75) -var isArray = __webpack_require__(42) +var base64 = __webpack_require__(77) +var ieee754 = __webpack_require__(78) +var isArray = __webpack_require__(45) exports.Buffer = Buffer exports.SlowBuffer = SlowBuffer @@ -3341,7 +3572,7 @@ process.umask = function() { return 0; }; /* 8 */ /***/ (function(module, exports, __webpack_require__) { -const Long = __webpack_require__(35); +const Long = __webpack_require__(37); // Discord epoch (2015-01-01T00:00:00.000Z) const EPOCH = 1420070400000; @@ -3760,7 +3991,7 @@ if (typeof Object.create === 'function') { /***/ (function(module, exports, __webpack_require__) { const Constants = __webpack_require__(0); -const util = __webpack_require__(20); +const util = __webpack_require__(13); /** * Data structure that makes it easy to interact with a permission bitfield. All {@link GuildMember}s have a set of @@ -3864,7 +4095,7 @@ class Permissions { } /** - * Gets an object mapping permission name (like `READ_MESSAGES`) to a {@link boolean} indicating whether the + * Gets an object mapping permission name (like `VIEW_CHANNEL`) to a {@link boolean} indicating whether the * permission is available. * @param {boolean} [checkAdmin=true] Whether to allow the administrator permission to override * @returns {Object} @@ -3913,8 +4144,8 @@ class Permissions { /** * Data that can be resolved to give a permission number. This can be: - * - A string (see {@link Permissions.flags}) - * - A permission number + * * A string (see {@link Permissions.FLAGS}) + * * A permission number * @typedef {string|number} PermissionResolvable */ @@ -3941,7 +4172,8 @@ class Permissions { * - `MANAGE_GUILD` (edit the guild information, region, etc.) * - `ADD_REACTIONS` (add new reactions to messages) * - `VIEW_AUDIT_LOG` - * - `READ_MESSAGES` + * - `VIEW_CHANNEL` + * - `READ_MESSAGES` **(deprecated)** * - `SEND_MESSAGES` * - `SEND_TTS_MESSAGES` * - `MANAGE_MESSAGES` (delete messages and reactions) @@ -3976,6 +4208,7 @@ Permissions.FLAGS = { ADD_REACTIONS: 1 << 6, VIEW_AUDIT_LOG: 1 << 7, + VIEW_CHANNEL: 1 << 10, READ_MESSAGES: 1 << 10, SEND_MESSAGES: 1 << 11, SEND_TTS_MESSAGES: 1 << 12, @@ -4029,8 +4262,8 @@ Permissions.prototype.missingPermissions = util.deprecate(Permissions.prototype. 'EvaluatedPermissions#missingPermissions is deprecated, use Permissions#missing instead'); Object.defineProperty(Permissions.prototype, 'member', { get: util - .deprecate(Object.getOwnPropertyDescriptor(Permissions.prototype, 'member').get, - 'EvaluatedPermissions#member is deprecated'), + .deprecate(Object.getOwnPropertyDescriptor(Permissions.prototype, 'member').get, + 'EvaluatedPermissions#member is deprecated'), }); module.exports = Permissions; @@ -4071,7 +4304,7 @@ module.exports = Permissions; /**/ -var processNextTick = __webpack_require__(25); +var processNextTick = __webpack_require__(26); /**/ /**/ @@ -4086,12 +4319,12 @@ var objectKeys = Object.keys || function (obj) { module.exports = Duplex; /**/ -var util = __webpack_require__(18); +var util = __webpack_require__(19); util.inherits = __webpack_require__(10); /**/ -var Readable = __webpack_require__(43); -var Writable = __webpack_require__(33); +var Readable = __webpack_require__(46); +var Writable = __webpack_require__(34); util.inherits(Duplex, Readable); @@ -4170,1210 +4403,6 @@ function forEach(xs, f) { /* 13 */ /***/ (function(module, exports, __webpack_require__) { -const TextBasedChannel = __webpack_require__(21); -const Constants = __webpack_require__(0); -const Presence = __webpack_require__(15).Presence; -const Snowflake = __webpack_require__(8); - -/** - * Represents a user on Discord. - * @implements {TextBasedChannel} - */ -class User { - constructor(client, data) { - /** - * The client that created the instance of the the user - * @name User#client - * @type {} - * @readonly - */ - Object.defineProperty(this, 'client', { value: client }); - - if (data) this.setup(data); - } - - setup(data) { - /** - * The ID of the user - * @type {Snowflake} - */ - this.id = data.id; - - /** - * The username of the user - * @type {string} - */ - this.username = data.username; - - /** - * A discriminator based on username for the user - * @type {string} - */ - this.discriminator = data.discriminator; - - /** - * The ID of the user's avatar - * @type {string} - */ - this.avatar = data.avatar; - - /** - * Whether or not the user is a bot - * @type {boolean} - */ - this.bot = Boolean(data.bot); - - /** - * The ID of the last message sent by the user, if one was sent - * @type {?Snowflake} - */ - this.lastMessageID = null; - - /** - * The Message object of the last message sent by the user, if one was sent - * @type {?Message} - */ - this.lastMessage = null; - } - - patch(data) { - for (const prop of ['id', 'username', 'discriminator', 'avatar', 'bot']) { - if (typeof data[prop] !== 'undefined') this[prop] = data[prop]; - } - if (data.token) this.client.token = data.token; - } - - /** - * The timestamp the user was created at - * @type {number} - * @readonly - */ - get createdTimestamp() { - return Snowflake.deconstruct(this.id).timestamp; - } - - /** - * The time the user was created - * @type {Date} - * @readonly - */ - get createdAt() { - return new Date(this.createdTimestamp); - } - - /** - * The presence of this user - * @type {Presence} - * @readonly - */ - get presence() { - if (this.client.presences.has(this.id)) return this.client.presences.get(this.id); - for (const guild of this.client.guilds.values()) { - if (guild.presences.has(this.id)) return guild.presences.get(this.id); - } - return new Presence(); - } - - /** - * A link to the user's avatar - * @type {?string} - * @readonly - */ - get avatarURL() { - if (!this.avatar) return null; - return Constants.Endpoints.User(this).Avatar(this.client.options.http.cdn, this.avatar); - } - - /** - * A link to the user's default avatar - * @type {string} - * @readonly - */ - get defaultAvatarURL() { - const avatars = Object.keys(Constants.DefaultAvatars); - const avatar = avatars[this.discriminator % avatars.length]; - return Constants.Endpoints.CDN(this.client.options.http.host).Asset(`${Constants.DefaultAvatars[avatar]}.png`); - } - - /** - * A link to the user's avatar if they have one. Otherwise a link to their default avatar will be returned - * @type {string} - * @readonly - */ - get displayAvatarURL() { - return this.avatarURL || this.defaultAvatarURL; - } - - /** - * The Discord "tag" for this user - * @type {string} - * @readonly - */ - get tag() { - return `${this.username}#${this.discriminator}`; - } - - /** - * The note that is set for the user - * This is only available when using a user account. - * @type {?string} - * @readonly - */ - get note() { - return this.client.user.notes.get(this.id) || null; - } - - /** - * Check whether the user is typing in a channel. - * @param {ChannelResolvable} channel The channel to check in - * @returns {boolean} - */ - typingIn(channel) { - channel = this.client.resolver.resolveChannel(channel); - return channel._typing.has(this.id); - } - - /** - * Get the time that the user started typing. - * @param {ChannelResolvable} channel The channel to get the time in - * @returns {?Date} - */ - typingSinceIn(channel) { - channel = this.client.resolver.resolveChannel(channel); - return channel._typing.has(this.id) ? new Date(channel._typing.get(this.id).since) : null; - } - - /** - * Get the amount of time the user has been typing in a channel for (in milliseconds), or -1 if they're not typing. - * @param {ChannelResolvable} channel The channel to get the time in - * @returns {number} - */ - typingDurationIn(channel) { - channel = this.client.resolver.resolveChannel(channel); - return channel._typing.has(this.id) ? channel._typing.get(this.id).elapsedTime : -1; - } - - /** - * The DM between the client's user and this user - * @type {?DMChannel} - * @readonly - */ - get dmChannel() { - return this.client.channels.filter(c => c.type === 'dm').find(c => c.recipient.id === this.id); - } - - /** - * Creates a DM channel between the client and the user. - * @returns {Promise} - */ - createDM() { - return this.client.rest.methods.createDM(this); - } - - /** - * Deletes a DM channel (if one exists) between the client and the user. Resolves with the channel if successful. - * @returns {Promise} - */ - deleteDM() { - return this.client.rest.methods.deleteChannel(this); - } - - /** - * Sends a friend request to the user. - * This is only available when using a user account. - * @returns {Promise} - */ - addFriend() { - return this.client.rest.methods.addFriend(this); - } - - /** - * Removes the user from your friends. - * This is only available when using a user account. - * @returns {Promise} - */ - removeFriend() { - return this.client.rest.methods.removeFriend(this); - } - - /** - * Blocks the user. - * This is only available when using a user account. - * @returns {Promise} - */ - block() { - return this.client.rest.methods.blockUser(this); - } - - /** - * Unblocks the user. - * This is only available when using a user account. - * @returns {Promise} - */ - unblock() { - return this.client.rest.methods.unblockUser(this); - } - - /** - * Get the profile of the user. - * This is only available when using a user account. - * @returns {Promise} - */ - fetchProfile() { - return this.client.rest.methods.fetchUserProfile(this); - } - - /** - * Sets a note for the user. - * This is only available when using a user account. - * @param {string} note The note to set for the user - * @returns {Promise} - */ - setNote(note) { - return this.client.rest.methods.setNote(this, note); - } - - /** - * Checks if the user is equal to another. It compares ID, username, discriminator, avatar, and bot flags. - * It is recommended to compare equality by using `user.id === user2.id` unless you want to compare all properties. - * @param {User} user User to compare with - * @returns {boolean} - */ - equals(user) { - let equal = user && - this.id === user.id && - this.username === user.username && - this.discriminator === user.discriminator && - this.avatar === user.avatar && - this.bot === Boolean(user.bot); - - return equal; - } - - /** - * When concatenated with a string, this automatically concatenates the user's mention instead of the User object. - * @returns {string} - * @example - * // logs: Hello from <@123456789>! - * console.log(`Hello from ${user}!`); - */ - toString() { - return `<@${this.id}>`; - } - - // These are here only for documentation purposes - they are implemented by TextBasedChannel - /* eslint-disable no-empty-function */ - send() {} - sendMessage() {} - sendEmbed() {} - sendFile() {} - sendCode() {} -} - -TextBasedChannel.applyToClass(User); - -module.exports = User; - - -/***/ }), -/* 14 */ -/***/ (function(module, exports, __webpack_require__) { - -const Snowflake = __webpack_require__(8); -const Permissions = __webpack_require__(11); -const util = __webpack_require__(20); - -/** - * Represents a role on Discord. - */ -class Role { - constructor(guild, data) { - /** - * The client that instantiated the role - * @name Role#client - * @type {Client} - * @readonly - */ - Object.defineProperty(this, 'client', { value: guild.client }); - - /** - * The guild that the role belongs to - * @type {Guild} - */ - this.guild = guild; - - if (data) this.setup(data); - } - - setup(data) { - /** - * The ID of the role (unique to the guild it is part of) - * @type {Snowflake} - */ - this.id = data.id; - - /** - * The name of the role - * @type {string} - */ - this.name = data.name; - - /** - * The base 10 color of the role - * @type {number} - */ - this.color = data.color; - - /** - * If true, users that are part of this role will appear in a separate category in the users list - * @type {boolean} - */ - this.hoist = data.hoist; - - /** - * The position of the role from the API - * @type {number} - */ - this.position = data.position; - - /** - * The permissions bitfield of the role - * @type {number} - */ - this.permissions = data.permissions; - - /** - * Whether or not the role is managed by an external service - * @type {boolean} - */ - this.managed = data.managed; - - /** - * Whether or not the role can be mentioned by anyone - * @type {boolean} - */ - this.mentionable = data.mentionable; - } - - /** - * The timestamp the role was created at - * @type {number} - * @readonly - */ - get createdTimestamp() { - return Snowflake.deconstruct(this.id).timestamp; - } - - /** - * The time the role was created - * @type {Date} - * @readonly - */ - get createdAt() { - return new Date(this.createdTimestamp); - } - - /** - * The hexadecimal version of the role color, with a leading hashtag - * @type {string} - * @readonly - */ - get hexColor() { - let col = this.color.toString(16); - while (col.length < 6) col = `0${col}`; - return `#${col}`; - } - - /** - * The cached guild members that have this role - * @type {Collection} - * @readonly - */ - get members() { - return this.guild.members.filter(m => m.roles.has(this.id)); - } - - /** - * Whether the role is editable by the client user - * @type {boolean} - * @readonly - */ - get editable() { - if (this.managed) return false; - const clientMember = this.guild.member(this.client.user); - if (!clientMember.permissions.has(Permissions.FLAGS.MANAGE_ROLES_OR_PERMISSIONS)) return false; - return clientMember.highestRole.comparePositionTo(this) > 0; - } - - /** - * The position of the role in the role manager - * @type {number} - * @readonly - */ - get calculatedPosition() { - const sorted = this.guild._sortedRoles; - return sorted.array().indexOf(sorted.get(this.id)); - } - - /** - * Get an object mapping permission names to whether or not the role enables that permission - * @returns {Object} - * @example - * // Print the serialized role permissions - * console.log(role.serialize()); - */ - serialize() { - return new Permissions(this.permissions).serialize(); - } - - /** - * Checks if the role has a permission. - * @param {PermissionResolvable|PermissionResolvable[]} permission Permission(s) to check for - * @param {boolean} [explicit=false] Whether to require the role to explicitly have the exact permission - * **(deprecated)** - * @param {boolean} [checkAdmin] Whether to allow the administrator permission to override - * (takes priority over `explicit`) - * @returns {boolean} - * @example - * // See if a role can ban a member - * if (role.hasPermission('BAN_MEMBERS')) { - * console.log('This role can ban members'); - * } else { - * console.log('This role can\'t ban members'); - * } - */ - hasPermission(permission, explicit = false, checkAdmin) { - return new Permissions(this.permissions).has( - permission, typeof checkAdmin !== 'undefined' ? checkAdmin : !explicit - ); - } - - /** - * Checks if the role has all specified permissions. - * @param {PermissionResolvable[]} permissions The permissions to check for - * @param {boolean} [explicit=false] Whether to require the role to explicitly have the exact permissions - * @returns {boolean} - * @deprecated - */ - hasPermissions(permissions, explicit = false) { - return new Permissions(this.permissions).has(permissions, !explicit); - } - - /** - * Compares this role's position to another role's. - * @param {Role} role Role to compare to this one - * @returns {number} Negative number if the this role's position is lower (other role's is higher), - * positive number if the this one is higher (other's is lower), 0 if equal - */ - comparePositionTo(role) { - return this.constructor.comparePositions(this, role); - } - - /** - * The data for a role. - * @typedef {Object} RoleData - * @property {string} [name] The name of the role - * @property {ColorResolvable} [color] The color of the role, either a hex string or a base 10 number - * @property {boolean} [hoist] Whether or not the role should be hoisted - * @property {number} [position] The position of the role - * @property {string[]} [permissions] The permissions of the role - * @property {boolean} [mentionable] Whether or not the role should be mentionable - */ - - /** - * Edits the role. - * @param {RoleData} data The new data for the role - * @returns {Promise} - * @example - * // Edit a role - * role.edit({name: 'new role'}) - * .then(r => console.log(`Edited role ${r}`)) - * .catch(console.error); - */ - edit(data) { - return this.client.rest.methods.updateGuildRole(this, data); - } - - /** - * Set a new name for the role. - * @param {string} name The new name of the role - * @returns {Promise} - * @example - * // Set the name of the role - * role.setName('new role') - * .then(r => console.log(`Edited name of role ${r}`)) - * .catch(console.error); - */ - setName(name) { - return this.edit({ name }); - } - - /** - * Set a new color for the role. - * @param {ColorResolvable} color The color of the role - * @returns {Promise} - * @example - * // Set the color of a role - * role.setColor('#FF0000') - * .then(r => console.log(`Set color of role ${r}`)) - * .catch(console.error); - */ - setColor(color) { - return this.edit({ color }); - } - - /** - * Set whether or not the role should be hoisted. - * @param {boolean} hoist Whether or not to hoist the role - * @returns {Promise} - * @example - * // Set the hoist of the role - * role.setHoist(true) - * .then(r => console.log(`Role hoisted: ${r.hoist}`)) - * .catch(console.error); - */ - setHoist(hoist) { - return this.edit({ hoist }); - } - - /** - * Set the position of the role. - * @param {number} position The position of the role - * @param {boolean} [relative=false] Move the position relative to its current value - * @returns {Promise} - * @example - * // Set the position of the role - * role.setPosition(1) - * .then(r => console.log(`Role position: ${r.position}`)) - * .catch(console.error); - */ - setPosition(position, relative) { - return this.guild.setRolePosition(this, position, relative).then(() => this); - } - - /** - * Set the permissions of the role. - * @param {string[]} permissions The permissions of the role - * @returns {Promise} - * @example - * // Set the permissions of the role - * role.setPermissions(['KICK_MEMBERS', 'BAN_MEMBERS']) - * .then(r => console.log(`Role updated ${r}`)) - * .catch(console.error); - */ - setPermissions(permissions) { - return this.edit({ permissions }); - } - - /** - * Set whether this role is mentionable. - * @param {boolean} mentionable Whether this role should be mentionable - * @returns {Promise} - * @example - * // Make the role mentionable - * role.setMentionable(true) - * .then(r => console.log(`Role updated ${r}`)) - * .catch(console.error); - */ - setMentionable(mentionable) { - return this.edit({ mentionable }); - } - - /** - * Deletes the role. - * @returns {Promise} - * @example - * // Delete a role - * role.delete() - * .then(r => console.log(`Deleted role ${r}`)) - * .catch(console.error); - */ - delete() { - return this.client.rest.methods.deleteGuildRole(this); - } - - /** - * Whether this role equals another role. It compares all properties, so for most operations - * it is advisable to just compare `role.id === role2.id` as it is much faster and is often - * what most users need. - * @param {Role} role Role to compare with - * @returns {boolean} - */ - equals(role) { - return role && - this.id === role.id && - this.name === role.name && - this.color === role.color && - this.hoist === role.hoist && - this.position === role.position && - this.permissions === role.permissions && - this.managed === role.managed; - } - - /** - * When concatenated with a string, this automatically concatenates the role mention rather than the Role object. - * @returns {string} - */ - toString() { - if (this.id === this.guild.id) return '@everyone'; - return `<@&${this.id}>`; - } - - /** - * Compares the positions of two roles. - * @param {Role} role1 First role to compare - * @param {Role} role2 Second role to compare - * @returns {number} Negative number if the first role's position is lower (second role's is higher), - * positive number if the first's is higher (second's is lower), 0 if equal - */ - static comparePositions(role1, role2) { - if (role1.position === role2.position) return role2.id - role1.id; - return role1.position - role2.position; - } -} - -Role.prototype.hasPermissions = util - .deprecate(Role.prototype.hasPermissions, - 'Role#hasPermissions is deprecated - use Role#hasPermission instead, it now takes an array'); - -module.exports = Role; - - -/***/ }), -/* 15 */ -/***/ (function(module, exports) { - -/** - * Represents a user's presence. - */ -class Presence { - constructor(data = {}) { - /** - * The status of the presence: - * - * * **`online`** - user is online - * * **`offline`** - user is offline or invisible - * * **`idle`** - user is AFK - * * **`dnd`** - user is in Do not Disturb - * @type {string} - */ - this.status = data.status || 'offline'; - - /** - * The game that the user is playing - * @type {?Game} - */ - this.game = data.game ? new Game(data.game) : null; - } - - update(data) { - this.status = data.status || this.status; - this.game = data.game ? new Game(data.game) : null; - } - - /** - * Whether this presence is equal to another - * @param {Presence} presence The presence to compare with - * @returns {boolean} - */ - equals(presence) { - return this === presence || ( - presence && - this.status === presence.status && - this.game ? this.game.equals(presence.game) : !presence.game - ); - } -} - -/** - * Represents a game that is part of a user's presence. - */ -class Game { - constructor(data) { - /** - * The name of the game being played - * @type {string} - */ - this.name = data.name; - - /** - * The type of the game status - * @type {number} - */ - this.type = data.type; - - /** - * If the game is being streamed, a link to the stream - * @type {?string} - */ - this.url = data.url || null; - } - - /** - * Whether or not the game is being streamed - * @type {boolean} - * @readonly - */ - get streaming() { - return this.type === 1; - } - - /** - * Whether this game is equal to another game - * @param {Game} game The game to compare with - * @returns {boolean} - */ - equals(game) { - return this === game || ( - game && - this.name === game.name && - this.type === game.type && - this.url === game.url - ); - } -} - -exports.Presence = Presence; -exports.Game = Game; - - -/***/ }), -/* 16 */ -/***/ (function(module, exports, __webpack_require__) { - -const Snowflake = __webpack_require__(8); - -/** - * Represents any channel on Discord. - */ -class Channel { - constructor(client, data) { - /** - * The client that instantiated the Channel - * @name Channel#client - * @type {Client} - * @readonly - */ - Object.defineProperty(this, 'client', { value: client }); - - /** - * The type of the channel, either: - * * `dm` - a DM channel - * * `group` - a Group DM channel - * * `text` - a guild text channel - * * `voice` - a guild voice channel - * @type {string} - */ - this.type = null; - - if (data) this.setup(data); - } - - setup(data) { - /** - * The unique ID of the channel - * @type {Snowflake} - */ - this.id = data.id; - } - - /** - * The timestamp the channel was created at - * @type {number} - * @readonly - */ - get createdTimestamp() { - return Snowflake.deconstruct(this.id).timestamp; - } - - /** - * The time the channel was created - * @type {Date} - * @readonly - */ - get createdAt() { - return new Date(this.createdTimestamp); - } - - /** - * Deletes the channel. - * @returns {Promise} - * @example - * // Delete the channel - * channel.delete() - * .then() // Success - * .catch(console.error); // Log error - */ - delete() { - return this.client.rest.methods.deleteChannel(this); - } -} - -module.exports = Channel; - - -/***/ }), -/* 17 */ -/***/ (function(module, exports, __webpack_require__) { - -exports = module.exports = __webpack_require__(43); -exports.Stream = exports; -exports.Readable = exports; -exports.Writable = __webpack_require__(33); -exports.Duplex = __webpack_require__(12); -exports.Transform = __webpack_require__(47); -exports.PassThrough = __webpack_require__(82); - - -/***/ }), -/* 18 */ -/***/ (function(module, exports, __webpack_require__) { - -/* WEBPACK VAR INJECTION */(function(Buffer) {// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -// NOTE: These type checking functions intentionally don't use `instanceof` -// because it is fragile and can be easily faked with `Object.create()`. - -function isArray(arg) { - if (Array.isArray) { - return Array.isArray(arg); - } - return objectToString(arg) === '[object Array]'; -} -exports.isArray = isArray; - -function isBoolean(arg) { - return typeof arg === 'boolean'; -} -exports.isBoolean = isBoolean; - -function isNull(arg) { - return arg === null; -} -exports.isNull = isNull; - -function isNullOrUndefined(arg) { - return arg == null; -} -exports.isNullOrUndefined = isNullOrUndefined; - -function isNumber(arg) { - return typeof arg === 'number'; -} -exports.isNumber = isNumber; - -function isString(arg) { - return typeof arg === 'string'; -} -exports.isString = isString; - -function isSymbol(arg) { - return typeof arg === 'symbol'; -} -exports.isSymbol = isSymbol; - -function isUndefined(arg) { - return arg === void 0; -} -exports.isUndefined = isUndefined; - -function isRegExp(re) { - return objectToString(re) === '[object RegExp]'; -} -exports.isRegExp = isRegExp; - -function isObject(arg) { - return typeof arg === 'object' && arg !== null; -} -exports.isObject = isObject; - -function isDate(d) { - return objectToString(d) === '[object Date]'; -} -exports.isDate = isDate; - -function isError(e) { - return (objectToString(e) === '[object Error]' || e instanceof Error); -} -exports.isError = isError; - -function isFunction(arg) { - return typeof arg === 'function'; -} -exports.isFunction = isFunction; - -function isPrimitive(arg) { - return arg === null || - typeof arg === 'boolean' || - typeof arg === 'number' || - typeof arg === 'string' || - typeof arg === 'symbol' || // ES6 symbol - typeof arg === 'undefined'; -} -exports.isPrimitive = isPrimitive; - -exports.isBuffer = Buffer.isBuffer; - -function objectToString(o) { - return Object.prototype.toString.call(o); -} - -/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5).Buffer)) - -/***/ }), -/* 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__(7))) - -/***/ }), -/* 20 */ -/***/ (function(module, exports, __webpack_require__) { - /* WEBPACK VAR INJECTION */(function(global, process) {// Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -5473,7 +4502,7 @@ var debugs = {}; var debugEnviron; exports.debuglog = function(set) { if (isUndefined(debugEnviron)) - debugEnviron = process.env.NODE_DEBUG || ''; + debugEnviron = Object({"__DISCORD_WEBPACK__":"true"}).NODE_DEBUG || ''; set = set.toUpperCase(); if (!debugs[set]) { if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) { @@ -5899,7 +4928,7 @@ function isPrimitive(arg) { } exports.isPrimitive = isPrimitive; -exports.isBuffer = __webpack_require__(104); +exports.isBuffer = __webpack_require__(109); function objectToString(o) { return Object.prototype.toString.call(o); @@ -5943,7 +4972,7 @@ exports.log = function() { * prototype. * @param {function} superCtor Constructor function to inherit prototype from. */ -exports.inherits = __webpack_require__(105); +exports.inherits = __webpack_require__(110); exports._extend = function(origin, add) { // Don't do anything if add isn't an object @@ -5963,15 +4992,1228 @@ function hasOwnProperty(obj, prop) { /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6), __webpack_require__(7))) +/***/ }), +/* 14 */ +/***/ (function(module, exports, __webpack_require__) { + +const TextBasedChannel = __webpack_require__(21); +const Constants = __webpack_require__(0); +const Presence = __webpack_require__(16).Presence; +const Snowflake = __webpack_require__(8); + +/** + * Represents a user on Discord. + * @implements {TextBasedChannel} + */ +class User { + constructor(client, data) { + /** + * The client that created the instance of the user + * @name User#client + * @type {Client} + * @readonly + */ + Object.defineProperty(this, 'client', { value: client }); + + if (data) this.setup(data); + } + + setup(data) { + /** + * The ID of the user + * @type {Snowflake} + */ + this.id = data.id; + + /** + * The username of the user + * @type {string} + */ + this.username = data.username; + + /** + * A discriminator based on username for the user + * @type {string} + */ + this.discriminator = data.discriminator; + + /** + * The ID of the user's avatar + * @type {string} + */ + this.avatar = data.avatar; + + /** + * Whether or not the user is a bot + * @type {boolean} + */ + this.bot = Boolean(data.bot); + + /** + * The ID of the last message sent by the user, if one was sent + * @type {?Snowflake} + */ + this.lastMessageID = null; + + /** + * The Message object of the last message sent by the user, if one was sent + * @type {?Message} + */ + this.lastMessage = null; + } + + patch(data) { + for (const prop of ['id', 'username', 'discriminator', 'avatar', 'bot']) { + if (typeof data[prop] !== 'undefined') this[prop] = data[prop]; + } + if (data.token) this.client.token = data.token; + } + + /** + * The timestamp the user was created at + * @type {number} + * @readonly + */ + get createdTimestamp() { + return Snowflake.deconstruct(this.id).timestamp; + } + + /** + * The time the user was created + * @type {Date} + * @readonly + */ + get createdAt() { + return new Date(this.createdTimestamp); + } + + /** + * The presence of this user + * @type {Presence} + * @readonly + */ + get presence() { + if (this.client.presences.has(this.id)) return this.client.presences.get(this.id); + for (const guild of this.client.guilds.values()) { + if (guild.presences.has(this.id)) return guild.presences.get(this.id); + } + return new Presence(); + } + + /** + * A link to the user's avatar + * @type {?string} + * @readonly + */ + get avatarURL() { + if (!this.avatar) return null; + return Constants.Endpoints.User(this).Avatar(this.client.options.http.cdn, this.avatar); + } + + /** + * A link to the user's default avatar + * @type {string} + * @readonly + */ + get defaultAvatarURL() { + const avatars = Object.keys(Constants.DefaultAvatars); + const avatar = avatars[this.discriminator % avatars.length]; + return Constants.Endpoints.CDN(this.client.options.http.host).Asset(`${Constants.DefaultAvatars[avatar]}.png`); + } + + /** + * A link to the user's avatar if they have one. Otherwise a link to their default avatar will be returned + * @type {string} + * @readonly + */ + get displayAvatarURL() { + return this.avatarURL || this.defaultAvatarURL; + } + + /** + * The Discord "tag" for this user + * @type {string} + * @readonly + */ + get tag() { + return `${this.username}#${this.discriminator}`; + } + + /** + * The note that is set for the user + * This is only available when using a user account. + * @type {?string} + * @readonly + */ + get note() { + return this.client.user.notes.get(this.id) || null; + } + + /** + * Check whether the user is typing in a channel. + * @param {ChannelResolvable} channel The channel to check in + * @returns {boolean} + */ + typingIn(channel) { + channel = this.client.resolver.resolveChannel(channel); + return channel._typing.has(this.id); + } + + /** + * Get the time that the user started typing. + * @param {ChannelResolvable} channel The channel to get the time in + * @returns {?Date} + */ + typingSinceIn(channel) { + channel = this.client.resolver.resolveChannel(channel); + return channel._typing.has(this.id) ? new Date(channel._typing.get(this.id).since) : null; + } + + /** + * Get the amount of time the user has been typing in a channel for (in milliseconds), or -1 if they're not typing. + * @param {ChannelResolvable} channel The channel to get the time in + * @returns {number} + */ + typingDurationIn(channel) { + channel = this.client.resolver.resolveChannel(channel); + return channel._typing.has(this.id) ? channel._typing.get(this.id).elapsedTime : -1; + } + + /** + * The DM between the client's user and this user + * @type {?DMChannel} + * @readonly + */ + get dmChannel() { + return this.client.channels.filter(c => c.type === 'dm').find(c => c.recipient.id === this.id); + } + + /** + * Creates a DM channel between the client and the user. + * @returns {Promise} + */ + createDM() { + return this.client.rest.methods.createDM(this); + } + + /** + * Deletes a DM channel (if one exists) between the client and the user. Resolves with the channel if successful. + * @returns {Promise} + */ + deleteDM() { + return this.client.rest.methods.deleteChannel(this); + } + + /** + * Sends a friend request to the user. + * This is only available when using a user account. + * @returns {Promise} + */ + addFriend() { + return this.client.rest.methods.addFriend(this); + } + + /** + * Removes the user from your friends. + * This is only available when using a user account. + * @returns {Promise} + */ + removeFriend() { + return this.client.rest.methods.removeFriend(this); + } + + /** + * Blocks the user. + * This is only available when using a user account. + * @returns {Promise} + */ + block() { + return this.client.rest.methods.blockUser(this); + } + + /** + * Unblocks the user. + * This is only available when using a user account. + * @returns {Promise} + */ + unblock() { + return this.client.rest.methods.unblockUser(this); + } + + /** + * Get the profile of the user. + * This is only available when using a user account. + * @returns {Promise} + */ + fetchProfile() { + return this.client.rest.methods.fetchUserProfile(this); + } + + /** + * Sets a note for the user. + * This is only available when using a user account. + * @param {string} note The note to set for the user + * @returns {Promise} + */ + setNote(note) { + return this.client.rest.methods.setNote(this, note); + } + + /** + * Checks if the user is equal to another. It compares ID, username, discriminator, avatar, and bot flags. + * It is recommended to compare equality by using `user.id === user2.id` unless you want to compare all properties. + * @param {User} user User to compare with + * @returns {boolean} + */ + equals(user) { + let equal = user && + this.id === user.id && + this.username === user.username && + this.discriminator === user.discriminator && + this.avatar === user.avatar && + this.bot === Boolean(user.bot); + + return equal; + } + + /** + * When concatenated with a string, this automatically concatenates the user's mention instead of the User object. + * @returns {string} + * @example + * // logs: Hello from <@123456789>! + * console.log(`Hello from ${user}!`); + */ + toString() { + return `<@${this.id}>`; + } + + // These are here only for documentation purposes - they are implemented by TextBasedChannel + /* eslint-disable no-empty-function */ + send() {} + sendMessage() {} + sendEmbed() {} + sendFile() {} + sendCode() {} +} + +TextBasedChannel.applyToClass(User); + +module.exports = User; + + +/***/ }), +/* 15 */ +/***/ (function(module, exports, __webpack_require__) { + +const Snowflake = __webpack_require__(8); +const Permissions = __webpack_require__(11); +const util = __webpack_require__(13); + +/** + * Represents a role on Discord. + */ +class Role { + constructor(guild, data) { + /** + * The client that instantiated the role + * @name Role#client + * @type {Client} + * @readonly + */ + Object.defineProperty(this, 'client', { value: guild.client }); + + /** + * The guild that the role belongs to + * @type {Guild} + */ + this.guild = guild; + + if (data) this.setup(data); + } + + setup(data) { + /** + * The ID of the role (unique to the guild it is part of) + * @type {Snowflake} + */ + this.id = data.id; + + /** + * The name of the role + * @type {string} + */ + this.name = data.name; + + /** + * The base 10 color of the role + * @type {number} + */ + this.color = data.color; + + /** + * If true, users that are part of this role will appear in a separate category in the users list + * @type {boolean} + */ + this.hoist = data.hoist; + + /** + * The position of the role from the API + * @type {number} + */ + this.position = data.position; + + /** + * The permissions bitfield of the role + * @type {number} + */ + this.permissions = data.permissions; + + /** + * Whether or not the role is managed by an external service + * @type {boolean} + */ + this.managed = data.managed; + + /** + * Whether or not the role can be mentioned by anyone + * @type {boolean} + */ + this.mentionable = data.mentionable; + } + + /** + * The timestamp the role was created at + * @type {number} + * @readonly + */ + get createdTimestamp() { + return Snowflake.deconstruct(this.id).timestamp; + } + + /** + * The time the role was created + * @type {Date} + * @readonly + */ + get createdAt() { + return new Date(this.createdTimestamp); + } + + /** + * The hexadecimal version of the role color, with a leading hashtag + * @type {string} + * @readonly + */ + get hexColor() { + let col = this.color.toString(16); + while (col.length < 6) col = `0${col}`; + return `#${col}`; + } + + /** + * The cached guild members that have this role + * @type {Collection} + * @readonly + */ + get members() { + return this.guild.members.filter(m => m.roles.has(this.id)); + } + + /** + * Whether the role is editable by the client user + * @type {boolean} + * @readonly + */ + get editable() { + if (this.managed) return false; + const clientMember = this.guild.member(this.client.user); + if (!clientMember.permissions.has(Permissions.FLAGS.MANAGE_ROLES_OR_PERMISSIONS)) return false; + return clientMember.highestRole.comparePositionTo(this) > 0; + } + + /** + * The position of the role in the role manager + * @type {number} + * @readonly + */ + get calculatedPosition() { + const sorted = this.guild._sortedRoles; + return sorted.array().indexOf(sorted.get(this.id)); + } + + /** + * Get an object mapping permission names to whether or not the role enables that permission. + * @returns {Object} + * @example + * // Print the serialized role permissions + * console.log(role.serialize()); + */ + serialize() { + return new Permissions(this.permissions).serialize(); + } + + /** + * Checks if the role has a permission. + * @param {PermissionResolvable|PermissionResolvable[]} permission Permission(s) to check for + * @param {boolean} [explicit=false] Whether to require the role to explicitly have the exact permission + * **(deprecated)** + * @param {boolean} [checkAdmin] Whether to allow the administrator permission to override + * (takes priority over `explicit`) + * @returns {boolean} + * @example + * // See if a role can ban a member + * if (role.hasPermission('BAN_MEMBERS')) { + * console.log('This role can ban members'); + * } else { + * console.log('This role can\'t ban members'); + * } + */ + hasPermission(permission, explicit = false, checkAdmin) { + return new Permissions(this.permissions).has( + permission, typeof checkAdmin !== 'undefined' ? checkAdmin : !explicit + ); + } + + /** + * Checks if the role has all specified permissions. + * @param {PermissionResolvable[]} permissions The permissions to check for + * @param {boolean} [explicit=false] Whether to require the role to explicitly have the exact permissions + * @returns {boolean} + * @deprecated + */ + hasPermissions(permissions, explicit = false) { + return new Permissions(this.permissions).has(permissions, !explicit); + } + + /** + * Compares this role's position to another role's. + * @param {Role} role Role to compare to this one + * @returns {number} Negative number if the this role's position is lower (other role's is higher), + * positive number if the this one is higher (other's is lower), 0 if equal + */ + comparePositionTo(role) { + return this.constructor.comparePositions(this, role); + } + + /** + * The data for a role. + * @typedef {Object} RoleData + * @property {string} [name] The name of the role + * @property {ColorResolvable} [color] The color of the role, either a hex string or a base 10 number + * @property {boolean} [hoist] Whether or not the role should be hoisted + * @property {number} [position] The position of the role + * @property {PermissionResolvable[]|number} [permissions] The permissions of the role + * @property {boolean} [mentionable] Whether or not the role should be mentionable + */ + + /** + * Edits the role. + * @param {RoleData} data The new data for the role + * @param {string} [reason] The reason for editing this role + * @returns {Promise} + * @example + * // Edit a role + * role.edit({name: 'new role'}) + * .then(r => console.log(`Edited role ${r}`)) + * .catch(console.error); + */ + edit(data, reason) { + return this.client.rest.methods.updateGuildRole(this, data, reason); + } + + /** + * Set a new name for the role. + * @param {string} name The new name of the role + * @param {string} [reason] Reason for changing the role's name + * @returns {Promise} + * @example + * // Set the name of the role + * role.setName('new role') + * .then(r => console.log(`Edited name of role ${r}`)) + * .catch(console.error); + */ + setName(name, reason) { + return this.edit({ name }, reason); + } + + /** + * Set a new color for the role. + * @param {ColorResolvable} color The color of the role + * @param {string} [reason] Reason for changing the role's color + * @returns {Promise} + * @example + * // Set the color of a role + * role.setColor('#FF0000') + * .then(r => console.log(`Set color of role ${r}`)) + * .catch(console.error); + */ + setColor(color, reason) { + return this.edit({ color }, reason); + } + + /** + * Set whether or not the role should be hoisted. + * @param {boolean} hoist Whether or not to hoist the role + * @param {string} [reason] Reason for setting whether or not the role should be hoisted + * @returns {Promise} + * @example + * // Set the hoist of the role + * role.setHoist(true) + * .then(r => console.log(`Role hoisted: ${r.hoist}`)) + * .catch(console.error); + */ + setHoist(hoist, reason) { + return this.edit({ hoist }, reason); + } + + /** + * Set the position of the role. + * @param {number} position The position of the role + * @param {boolean} [relative=false] Move the position relative to its current value + * @returns {Promise} + * @example + * // Set the position of the role + * role.setPosition(1) + * .then(r => console.log(`Role position: ${r.position}`)) + * .catch(console.error); + */ + setPosition(position, relative) { + return this.guild.setRolePosition(this, position, relative).then(() => this); + } + + /** + * Set the permissions of the role. + * @param {string[]} permissions The permissions of the role + * @param {string} [reason] Reason for changing the role's permissions + * @returns {Promise} + * @example + * // Set the permissions of the role + * role.setPermissions(['KICK_MEMBERS', 'BAN_MEMBERS']) + * .then(r => console.log(`Role updated ${r}`)) + * .catch(console.error); + */ + setPermissions(permissions, reason) { + return this.edit({ permissions }, reason); + } + + /** + * Set whether this role is mentionable. + * @param {boolean} mentionable Whether this role should be mentionable + * @param {string} [reason] Reason for setting whether or not this role should be mentionable + * @returns {Promise} + * @example + * // Make the role mentionable + * role.setMentionable(true) + * .then(r => console.log(`Role updated ${r}`)) + * .catch(console.error); + */ + setMentionable(mentionable, reason) { + return this.edit({ mentionable }, reason); + } + + /** + * Deletes the role. + * @param {string} [reason] Reason for deleting the role + * @returns {Promise} + * @example + * // Delete a role + * role.delete() + * .then(r => console.log(`Deleted role ${r}`)) + * .catch(console.error); + */ + delete(reason) { + return this.client.rest.methods.deleteGuildRole(this, reason); + } + + /** + * Whether this role equals another role. It compares all properties, so for most operations + * it is advisable to just compare `role.id === role2.id` as it is much faster and is often + * what most users need. + * @param {Role} role Role to compare with + * @returns {boolean} + */ + equals(role) { + return role && + this.id === role.id && + this.name === role.name && + this.color === role.color && + this.hoist === role.hoist && + this.position === role.position && + this.permissions === role.permissions && + this.managed === role.managed; + } + + /** + * When concatenated with a string, this automatically concatenates the role mention rather than the Role object. + * @returns {string} + */ + toString() { + if (this.id === this.guild.id) return '@everyone'; + return `<@&${this.id}>`; + } + + /** + * Compares the positions of two roles. + * @param {Role} role1 First role to compare + * @param {Role} role2 Second role to compare + * @returns {number} Negative number if the first role's position is lower (second role's is higher), + * positive number if the first's is higher (second's is lower), 0 if equal + */ + static comparePositions(role1, role2) { + if (role1.position === role2.position) return role2.id - role1.id; + return role1.position - role2.position; + } +} + +Role.prototype.hasPermissions = util + .deprecate(Role.prototype.hasPermissions, + 'Role#hasPermissions is deprecated - use Role#hasPermission instead, it now takes an array'); + +module.exports = Role; + + +/***/ }), +/* 16 */ +/***/ (function(module, exports) { + +/** + * Represents a user's presence. + */ +class Presence { + constructor(data = {}) { + /** + * The status of the presence: + * + * * **`online`** - user is online + * * **`offline`** - user is offline or invisible + * * **`idle`** - user is AFK + * * **`dnd`** - user is in Do not Disturb + * @type {string} + */ + this.status = data.status || 'offline'; + + /** + * The game that the user is playing + * @type {?Game} + */ + this.game = data.game ? new Game(data.game) : null; + } + + update(data) { + this.status = data.status || this.status; + this.game = data.game ? new Game(data.game) : null; + } + + /** + * Whether this presence is equal to another + * @param {Presence} presence The presence to compare with + * @returns {boolean} + */ + equals(presence) { + return this === presence || ( + presence && + this.status === presence.status && + this.game ? this.game.equals(presence.game) : !presence.game + ); + } +} + +/** + * Represents a game that is part of a user's presence. + */ +class Game { + constructor(data) { + /** + * The name of the game being played + * @type {string} + */ + this.name = data.name; + + /** + * The type of the game status + * @type {number} + */ + this.type = data.type; + + /** + * If the game is being streamed, a link to the stream + * @type {?string} + */ + this.url = data.url || null; + } + + /** + * Whether or not the game is being streamed + * @type {boolean} + * @readonly + */ + get streaming() { + return this.type === 1; + } + + /** + * Whether this game is equal to another game + * @param {Game} game The game to compare with + * @returns {boolean} + */ + equals(game) { + return this === game || ( + game && + this.name === game.name && + this.type === game.type && + this.url === game.url + ); + } +} + +exports.Presence = Presence; +exports.Game = Game; + + +/***/ }), +/* 17 */ +/***/ (function(module, exports, __webpack_require__) { + +const Snowflake = __webpack_require__(8); + +/** + * Represents any channel on Discord. + */ +class Channel { + constructor(client, data) { + /** + * The client that instantiated the Channel + * @name Channel#client + * @type {Client} + * @readonly + */ + Object.defineProperty(this, 'client', { value: client }); + + /** + * The type of the channel, either: + * * `dm` - a DM channel + * * `group` - a Group DM channel + * * `text` - a guild text channel + * * `voice` - a guild voice channel + * @type {string} + */ + this.type = null; + + if (data) this.setup(data); + } + + setup(data) { + /** + * The unique ID of the channel + * @type {Snowflake} + */ + this.id = data.id; + } + + /** + * The timestamp the channel was created at + * @type {number} + * @readonly + */ + get createdTimestamp() { + return Snowflake.deconstruct(this.id).timestamp; + } + + /** + * The time the channel was created + * @type {Date} + * @readonly + */ + get createdAt() { + return new Date(this.createdTimestamp); + } + + /** + * Deletes the channel. + * @returns {Promise} + * @example + * // Delete the channel + * channel.delete() + * .then() // Success + * .catch(console.error); // Log error + */ + delete() { + return this.client.rest.methods.deleteChannel(this); + } +} + +module.exports = Channel; + + +/***/ }), +/* 18 */ +/***/ (function(module, exports, __webpack_require__) { + +exports = module.exports = __webpack_require__(46); +exports.Stream = exports; +exports.Readable = exports; +exports.Writable = __webpack_require__(34); +exports.Duplex = __webpack_require__(12); +exports.Transform = __webpack_require__(50); +exports.PassThrough = __webpack_require__(85); + + +/***/ }), +/* 19 */ +/***/ (function(module, exports, __webpack_require__) { + +/* WEBPACK VAR INJECTION */(function(Buffer) {// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +// NOTE: These type checking functions intentionally don't use `instanceof` +// because it is fragile and can be easily faked with `Object.create()`. + +function isArray(arg) { + if (Array.isArray) { + return Array.isArray(arg); + } + return objectToString(arg) === '[object Array]'; +} +exports.isArray = isArray; + +function isBoolean(arg) { + return typeof arg === 'boolean'; +} +exports.isBoolean = isBoolean; + +function isNull(arg) { + return arg === null; +} +exports.isNull = isNull; + +function isNullOrUndefined(arg) { + return arg == null; +} +exports.isNullOrUndefined = isNullOrUndefined; + +function isNumber(arg) { + return typeof arg === 'number'; +} +exports.isNumber = isNumber; + +function isString(arg) { + return typeof arg === 'string'; +} +exports.isString = isString; + +function isSymbol(arg) { + return typeof arg === 'symbol'; +} +exports.isSymbol = isSymbol; + +function isUndefined(arg) { + return arg === void 0; +} +exports.isUndefined = isUndefined; + +function isRegExp(re) { + return objectToString(re) === '[object RegExp]'; +} +exports.isRegExp = isRegExp; + +function isObject(arg) { + return typeof arg === 'object' && arg !== null; +} +exports.isObject = isObject; + +function isDate(d) { + return objectToString(d) === '[object Date]'; +} +exports.isDate = isDate; + +function isError(e) { + return (objectToString(e) === '[object Error]' || e instanceof Error); +} +exports.isError = isError; + +function isFunction(arg) { + return typeof arg === 'function'; +} +exports.isFunction = isFunction; + +function isPrimitive(arg) { + return arg === null || + typeof arg === 'boolean' || + typeof arg === 'number' || + typeof arg === 'string' || + typeof arg === 'symbol' || // ES6 symbol + typeof arg === 'undefined'; +} +exports.isPrimitive = isPrimitive; + +exports.isBuffer = Buffer.isBuffer; + +function objectToString(o) { + return Object.prototype.toString.call(o); +} + +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5).Buffer)) + +/***/ }), +/* 20 */ +/***/ (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__(7))) + /***/ }), /* 21 */ /***/ (function(module, exports, __webpack_require__) { -const path = __webpack_require__(19); +/* WEBPACK VAR INJECTION */(function(Buffer) {const path = __webpack_require__(20); const Message = __webpack_require__(22); -const MessageCollector = __webpack_require__(59); +const MessageCollector = __webpack_require__(62); const Collection = __webpack_require__(3); -const util = __webpack_require__(20); +const Attachment = __webpack_require__(29); +const RichEmbed = __webpack_require__(28); +const util = __webpack_require__(13); /** * Interface for classes that have text-channel-like features. @@ -6007,8 +6249,8 @@ class TextBasedChannel { * (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 {FileOptions|BufferResolvable|Attachment} [file] A file to send with the message **(deprecated)** + * @property {FileOptions[]|BufferResolvable[]|Attachment[]} [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 @@ -6033,13 +6275,14 @@ class TextBasedChannel { /** * Send a message to this channel. * @param {StringResolvable} [content] Text for the message - * @param {MessageOptions} [options={}] Options for the message + * @param {MessageOptions|Attachment|RichEmbed} [options] Options for the message, + * can also be just a RichEmbed or Attachment * @returns {Promise} * @example * // Send a message * channel.send('hello!') - * .then(message => console.log(`Sent message: ${message.content}`)) - * .catch(console.error); + * .then(message => console.log(`Sent message: ${message.content}`)) + * .catch(console.error); */ send(content, options) { if (!options && typeof content === 'object' && !(content instanceof Array)) { @@ -6049,7 +6292,13 @@ class TextBasedChannel { options = {}; } - if (options.embed && options.embed.file) options.file = options.embed.file; + if (options instanceof Attachment) options = { files: [options.file] }; + if (options instanceof RichEmbed) options = { embed: options }; + + if (options.embed && options.embed.file) { + if (options.files) options.files.push(options.embed.file); + else options.files = [options.embed.file]; + } if (options.file) { if (options.files) options.files.push(options.file); @@ -6057,24 +6306,28 @@ class TextBasedChannel { } if (options.files) { - for (const i in options.files) { + for (let i = 0; i < options.files.length; i++) { let file = options.files[i]; - if (typeof file === 'string') file = { attachment: file }; + if (typeof file === 'string' || Buffer.isBuffer(file)) file = { attachment: file }; if (!file.name) { if (typeof file.attachment === 'string') { file.name = path.basename(file.attachment); } else if (file.attachment && file.attachment.path) { file.name = path.basename(file.attachment.path); + } else if (file instanceof Attachment) { + file = { attachment: file.file, name: path.basename(file.file) || 'file.jpg' }; } else { file.name = 'file.jpg'; } + } else if (file instanceof Attachment) { + file = file.file; } options.files[i] = file; } return Promise.all(options.files.map(file => - this.client.resolver.resolveBuffer(file.attachment).then(buffer => { - file.file = buffer; + this.client.resolver.resolveFile(file.attachment).then(resource => { + file.file = resource; return file; }) )).then(files => this.client.rest.methods.sendMessage(this, content, options, files)); @@ -6127,8 +6380,8 @@ class TextBasedChannel { * @example * // Get messages * channel.fetchMessages({limit: 10}) - * .then(messages => console.log(`Received ${messages.size} messages`)) - * .catch(console.error); + * .then(messages => console.log(`Received ${messages.size} messages`)) + * .catch(console.error); */ fetchMessages(options = {}) { return this.client.rest.methods.getChannelMessages(this, options).then(data => { @@ -6183,15 +6436,21 @@ class TextBasedChannel { * @property {Date} [before] Date to find messages before * @property {Date} [after] Date to find messages before * @property {Date} [during] Date to find messages during (range of date to date + 24 hours) + * @property {boolean} [nsfw=false] Include results from NSFW channels + */ + + /** + * @typedef {Object} MessageSearchResult + * @property {number} totalResults Total result count + * @property {Message[][]} messages Array of message results + * The message which has triggered the result will have the `hit` property set to `true` */ /** * Performs a search within the channel. * This is only available when using a user account. * @param {MessageSearchOptions} [options={}] Options to pass to the search - * @returns {Promise>} - * 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` + * @returns {Promise} * @example * channel.search({ * content: 'discord.js', @@ -6288,11 +6547,11 @@ class TextBasedChannel { * @returns {MessageCollector} * @example * // Create a message collector - * const collector = channel.createCollector( - * m => m.content.includes('discord'), - * { time: 15000 } + * const collector = channel.createMessageCollector( + * m => m.content.includes('discord'), + * { time: 15000 } * ); - * collector.on('message', m => console.log(`Collected ${m.content}`)); + * collector.on('collect', m => console.log(`Collected ${m.content}`)); * collector.on('end', collected => console.log(`Collected ${collected.size} items`)); */ createMessageCollector(filter, options = {}) { @@ -6316,8 +6575,8 @@ class TextBasedChannel { * 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.`)); + * .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) => { @@ -6471,16 +6730,18 @@ exports.applyToClass = (structure, full = false, ignore = []) => { } }; +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5).Buffer)) /***/ }), /* 22 */ /***/ (function(module, exports, __webpack_require__) { -const Mentions = __webpack_require__(54); -const Attachment = __webpack_require__(55); -const Embed = __webpack_require__(56); -const MessageReaction = __webpack_require__(57); -const ReactionCollector = __webpack_require__(58); +const Mentions = __webpack_require__(57); +const Attachment = __webpack_require__(58); +const Embed = __webpack_require__(59); +const RichEmbed = __webpack_require__(28); +const MessageReaction = __webpack_require__(60); +const ReactionCollector = __webpack_require__(61); const Util = __webpack_require__(4); const Collection = __webpack_require__(3); const Constants = __webpack_require__(0); @@ -6511,7 +6772,7 @@ class Message { setup(data) { // eslint-disable-line complexity /** - * The ID of the message (unique in the channel it was sent) + * The ID of the message * @type {Snowflake} */ this.id = data.id; @@ -6535,8 +6796,8 @@ class Message { this.author = this.client.dataManager.newUser(data.author); /** - * Represents the author of the message as a guild member. Only available if the message comes from a guild - * where the author is still a member. + * Represents the author of the message as a guild member + * Only available if the message comes from a guild where the author is still a member * @type {?GuildMember} */ this.member = this.guild ? this.guild.member(this.author) || null : null; @@ -6687,8 +6948,8 @@ class Message { } /** - * The message contents with all mentions replaced by the equivalent text. If mentions cannot be resolved to a name, - * the relevant mention in the message content will not be converted + * The message contents with all mentions replaced by the equivalent text. + * If mentions cannot be resolved to a name, the relevant mention in the message content will not be converted. * @type {string} * @readonly */ @@ -6732,8 +6993,8 @@ class Message { * @example * // Create a reaction collector * const collector = message.createReactionCollector( - * (reaction, user) => reaction.emoji.id === '👌' && user.id === 'someID', - * { time: 15000 } + * (reaction, user) => reaction.emoji.name === '👌' && user.id === 'someID', + * { time: 15000 } * ); * collector.on('collect', r => console.log(`Collected ${r.emoji.name}`)); * collector.on('end', collected => console.log(`Collected ${collected.size} items`)); @@ -6749,8 +7010,8 @@ class Message { */ /** - * Similar to createCollector but in promise form. Resolves with a collection of reactions that pass the specified - * filter. + * Similar to createMessageCollector but in promise form. + * Resolves with a collection of reactions that pass the specified filter. * @param {CollectorFilter} filter The filter function to use * @param {AwaitReactionsOptions} [options={}] Optional options to pass to the internal collector * @returns {Promise>} @@ -6843,13 +7104,13 @@ class Message { /** * Edit the content of the message. * @param {StringResolvable} [content] The new content for the message - * @param {MessageEditOptions} [options] The options to provide + * @param {MessageEditOptions|RichEmbed} [options] The options to provide * @returns {Promise} * @example * // Update the content of a message * message.edit('This is my new content!') - * .then(msg => console.log(`Updated the content of a message from ${msg.author}`)) - * .catch(console.error); + * .then(msg => console.log(`Updated the content of a message from ${msg.author}`)) + * .catch(console.error); */ edit(content, options) { if (!options && typeof content === 'object' && !(content instanceof Array)) { @@ -6858,6 +7119,7 @@ class Message { } else if (!options) { options = {}; } + if (options instanceof RichEmbed) options = { embed: options }; return this.client.rest.methods.updateMessage(this, content, options); } @@ -6866,6 +7128,7 @@ class Message { * @param {string} lang The language for the code block * @param {StringResolvable} content The new content for the message * @returns {Promise} + * @deprecated */ editCode(lang, content) { content = Util.escapeMarkdown(this.client.resolver.resolveString(content), true); @@ -6915,8 +7178,8 @@ class Message { * @example * // Delete a message * message.delete() - * .then(msg => console.log(`Deleted message from ${msg.author}`)) - * .catch(console.error); + * .then(msg => console.log(`Deleted message from ${msg.author}`)) + * .catch(console.error); */ delete(timeout = 0) { if (timeout <= 0) { @@ -6938,8 +7201,8 @@ class Message { * @example * // Reply to a message * message.reply('Hey, I\'m a reply!') - * .then(msg => console.log(`Sent a reply to ${msg.author}`)) - * .catch(console.error); + * .then(msg => console.log(`Sent a reply to ${msg.author}`)) + * .catch(console.error); */ reply(content, options) { if (!options && typeof content === 'object' && !(content instanceof Array)) { @@ -7011,7 +7274,7 @@ class Message { } _addReaction(emoji, user) { - const emojiID = emoji.id ? `${emoji.name}:${emoji.id}` : encodeURIComponent(emoji.name); + const emojiID = emoji.id ? `${emoji.name}:${emoji.id}` : emoji.name; let reaction; if (this.reactions.has(emojiID)) { reaction = this.reactions.get(emojiID); @@ -7020,13 +7283,15 @@ class Message { reaction = new MessageReaction(this, emoji, 0, user.id === this.client.user.id); this.reactions.set(emojiID, reaction); } - if (!reaction.users.has(user.id)) reaction.users.set(user.id, user); - reaction.count++; + if (!reaction.users.has(user.id)) { + reaction.users.set(user.id, user); + reaction.count++; + } return reaction; } _removeReaction(emoji, user) { - const emojiID = emoji.id ? `${emoji.name}:${emoji.id}` : encodeURIComponent(emoji.name); + const emojiID = emoji.id ? `${emoji.name}:${emoji.id}` : emoji.name; if (this.reactions.has(emojiID)) { const reaction = this.reactions.get(emojiID); if (reaction.users.has(user.id)) { @@ -7166,24 +7431,26 @@ class Emoji { /** * Edits the emoji. * @param {EmojiEditData} data The new data for the emoji + * @param {string} [reason] Reason for editing this emoji * @returns {Promise} * @example - * // Edit a emoji + * // Edit an emoji * emoji.edit({name: 'newemoji'}) - * .then(e => console.log(`Edited emoji ${e}`)) - * .catch(console.error); + * .then(e => console.log(`Edited emoji ${e}`)) + * .catch(console.error); */ - edit(data) { - return this.client.rest.methods.updateEmoji(this, data); + edit(data, reason) { + return this.client.rest.methods.updateEmoji(this, data, reason); } /** * Set the name of the emoji. * @param {string} name The new name for the emoji + * @param {string} [reason] The reason for changing the emoji's name * @returns {Promise} */ - setName(name) { - return this.edit({ name }); + setName(name, reason) { + return this.edit({ name }, reason); } /** @@ -7272,11 +7539,11 @@ module.exports = Emoji; /***/ (function(module, exports, __webpack_require__) { const TextBasedChannel = __webpack_require__(21); -const Role = __webpack_require__(14); +const Role = __webpack_require__(15); const Permissions = __webpack_require__(11); const Collection = __webpack_require__(3); -const Presence = __webpack_require__(15).Presence; -const util = __webpack_require__(20); +const Presence = __webpack_require__(16).Presence; +const util = __webpack_require__(13); /** * Represents a member of a guild on Discord. @@ -7618,28 +7885,31 @@ class GuildMember { /** * Edit a guild member. * @param {GuildMemberEditData} data The data to edit the member with + * @param {string} [reason] Reason for editing this user * @returns {Promise} */ - edit(data) { - return this.client.rest.methods.updateGuildMember(this, data); + edit(data, reason) { + return this.client.rest.methods.updateGuildMember(this, data, reason); } /** * Mute/unmute a user. * @param {boolean} mute Whether or not the member should be muted + * @param {string} [reason] Reason for muting or unmuting * @returns {Promise} */ - setMute(mute) { - return this.edit({ mute }); + setMute(mute, reason) { + return this.edit({ mute }, reason); } /** * Deafen/undeafen a user. * @param {boolean} deaf Whether or not the member should be deafened + * @param {string} [reason] Reason for deafening or undeafening * @returns {Promise} */ - setDeaf(deaf) { - return this.edit({ deaf }); + setDeaf(deaf, reason) { + return this.edit({ deaf }, reason); } /** @@ -7654,29 +7924,32 @@ class GuildMember { /** * Sets the roles applied to the member. * @param {Collection|Role[]|Snowflake[]} roles The roles or role IDs to apply + * @param {string} [reason] Reason for applying the roles * @returns {Promise} */ - setRoles(roles) { - return this.edit({ roles }); + setRoles(roles, reason) { + return this.edit({ roles }, reason); } /** * Adds a single role to the member. * @param {Role|Snowflake} role The role or ID of the role to add + * @param {string} [reason] Reason for adding the role * @returns {Promise} */ - addRole(role) { + addRole(role, reason) { if (!(role instanceof Role)) role = this.guild.roles.get(role); - if (!role) throw new TypeError('Supplied parameter was neither a Role nor a Snowflake.'); - return this.client.rest.methods.addMemberRole(this, role); + if (!role) return Promise.reject(new TypeError('Supplied parameter was neither a Role nor a Snowflake.')); + return this.client.rest.methods.addMemberRole(this, role, reason); } /** * Adds multiple roles to the member. * @param {Collection|Role[]|Snowflake[]} roles The roles or role IDs to add + * @param {string} [reason] Reason for adding the roles * @returns {Promise} */ - addRoles(roles) { + addRoles(roles, reason) { let allRoles; if (roles instanceof Collection) { allRoles = this._roles.slice(); @@ -7684,26 +7957,28 @@ class GuildMember { } else { allRoles = this._roles.concat(roles); } - return this.edit({ roles: allRoles }); + return this.edit({ roles: allRoles }, reason); } /** * Removes a single role from the member. * @param {Role|Snowflake} role The role or ID of the role to remove + * @param {string} [reason] Reason for removing the role * @returns {Promise} */ - removeRole(role) { + removeRole(role, reason) { if (!(role instanceof Role)) role = this.guild.roles.get(role); - if (!role) throw new TypeError('Supplied parameter was neither a Role nor a Snowflake.'); - return this.client.rest.methods.removeMemberRole(this, role); + if (!role) return Promise.reject(new TypeError('Supplied parameter was neither a Role nor a Snowflake.')); + return this.client.rest.methods.removeMemberRole(this, role, reason); } /** * Removes multiple roles from the member. * @param {Collection|Role[]|Snowflake[]} roles The roles or role IDs to remove + * @param {string} [reason] Reason for removing the roles * @returns {Promise} */ - removeRoles(roles) { + removeRoles(roles, reason) { const allRoles = this._roles.slice(); if (roles instanceof Collection) { for (const role of roles.values()) { @@ -7716,16 +7991,17 @@ class GuildMember { if (index >= 0) allRoles.splice(index, 1); } } - return this.edit({ roles: allRoles }); + return this.edit({ roles: allRoles }, reason); } /** * Set the nickname for the guild member. * @param {string} nick The nickname for the guild member + * @param {string} [reason] Reason for setting the nickname * @returns {Promise} */ - setNickname(nick) { - return this.edit({ nick }); + setNickname(nick, reason) { + return this.edit({ nick }, reason); } /** @@ -7754,7 +8030,7 @@ class GuildMember { } /** - * Ban this guild member + * Ban this guild member. * @param {Object|number|string} [options] Ban options. If a number, the number of days to delete messages for, if a * string, the ban reason. Supplying an object allows you to do both. * @param {number} [options.days=0] Number of days of messages to delete @@ -7800,6 +8076,139 @@ module.exports = GuildMember; /* 25 */ /***/ (function(module, exports, __webpack_require__) { +// 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. + +module.exports = Stream; + +var EE = __webpack_require__(9).EventEmitter; +var inherits = __webpack_require__(10); + +inherits(Stream, EE); +Stream.Readable = __webpack_require__(18); +Stream.Writable = __webpack_require__(86); +Stream.Duplex = __webpack_require__(87); +Stream.Transform = __webpack_require__(88); +Stream.PassThrough = __webpack_require__(89); + +// Backwards-compat with node 0.4.x +Stream.Stream = Stream; + + + +// old-style streams. Note that the pipe method (the only relevant +// part of this class) is overridden in the Readable class. + +function Stream() { + EE.call(this); +} + +Stream.prototype.pipe = function(dest, options) { + var source = this; + + function ondata(chunk) { + if (dest.writable) { + if (false === dest.write(chunk) && source.pause) { + source.pause(); + } + } + } + + source.on('data', ondata); + + function ondrain() { + if (source.readable && source.resume) { + source.resume(); + } + } + + dest.on('drain', ondrain); + + // If the 'end' option is not supplied, dest.end() will be called when + // source gets the 'end' or 'close' events. Only dest.end() once. + if (!dest._isStdio && (!options || options.end !== false)) { + source.on('end', onend); + source.on('close', onclose); + } + + var didOnEnd = false; + function onend() { + if (didOnEnd) return; + didOnEnd = true; + + dest.end(); + } + + + function onclose() { + if (didOnEnd) return; + didOnEnd = true; + + if (typeof dest.destroy === 'function') dest.destroy(); + } + + // don't leave dangling pipes when there are errors. + function onerror(er) { + cleanup(); + if (EE.listenerCount(this, 'error') === 0) { + throw er; // Unhandled stream error in pipe. + } + } + + source.on('error', onerror); + dest.on('error', onerror); + + // remove all the event listeners that were added. + function cleanup() { + source.removeListener('data', ondata); + dest.removeListener('drain', ondrain); + + source.removeListener('end', onend); + source.removeListener('close', onclose); + + source.removeListener('error', onerror); + dest.removeListener('error', onerror); + + source.removeListener('end', cleanup); + source.removeListener('close', cleanup); + + dest.removeListener('close', cleanup); + } + + source.on('end', cleanup); + source.on('close', cleanup); + + dest.on('close', cleanup); + + dest.emit('pipe', source); + + // Allow for unix-like usage: A.pipe(B).pipe(C) + return dest; +}; + + +/***/ }), +/* 26 */ +/***/ (function(module, exports, __webpack_require__) { + "use strict"; /* WEBPACK VAR INJECTION */(function(process) { @@ -7847,72 +8256,335 @@ function nextTick(fn, arg1, arg2, arg3) { /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(7))) -/***/ }), -/* 26 */ -/***/ (function(module, exports) { - - - /***/ }), /* 27 */ /***/ (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'; /***/ }), /* 28 */ /***/ (function(module, exports, __webpack_require__) { -const Long = __webpack_require__(35); -const User = __webpack_require__(13); -const Role = __webpack_require__(14); +const Attachment = __webpack_require__(29); +let ClientDataResolver; + +/** + * A rich embed to be sent with a message with a fluent interface for creation. + * @param {Object} [data] Data to set in the rich embed + */ +class RichEmbed { + constructor(data = {}) { + /** + * Title for this Embed + * @type {string} + */ + this.title = data.title; + + /** + * Description for this Embed + * @type {string} + */ + this.description = data.description; + + /** + * URL for this Embed + * @type {string} + */ + this.url = data.url; + + /** + * Color for this Embed + * @type {number} + */ + this.color = data.color; + + /** + * Author for this Embed + * @type {Object} + */ + this.author = data.author; + + /** + * Timestamp for this Embed + * @type {Date} + */ + this.timestamp = data.timestamp; + + /** + * Fields for this Embed + * @type {Object[]} + */ + this.fields = data.fields || []; + + /** + * Thumbnail for this Embed + * @type {Object} + */ + this.thumbnail = data.thumbnail; + + /** + * Image for this Embed + * @type {Object} + */ + this.image = data.image; + + /** + * Footer for this Embed + * @type {Object} + */ + this.footer = data.footer; + + /** + * File to upload alongside this Embed + * @type {FileOptions|string|Attachment} + */ + this.file = data.file; + } + + /** + * Sets the title of this embed. + * @param {StringResolvable} title The title + * @returns {RichEmbed} This embed + */ + setTitle(title) { + title = resolveString(title); + if (title.length > 256) throw new RangeError('RichEmbed titles may not exceed 256 characters.'); + this.title = title; + return this; + } + + /** + * Sets the description of this embed. + * @param {StringResolvable} description The description + * @returns {RichEmbed} This embed + */ + setDescription(description) { + description = resolveString(description); + if (description.length > 2048) throw new RangeError('RichEmbed descriptions may not exceed 2048 characters.'); + this.description = description; + return this; + } + + /** + * Sets the URL of this embed. + * @param {string} url The URL + * @returns {RichEmbed} This embed + */ + setURL(url) { + this.url = url; + return this; + } + + /** + * Sets the color of this embed. + * @param {ColorResolvable} color The color of the embed + * @returns {RichEmbed} This embed + */ + setColor(color) { + if (!ClientDataResolver) ClientDataResolver = __webpack_require__(38); + this.color = ClientDataResolver.resolveColor(color); + return this; + } + + /** + * Sets the author of this embed. + * @param {StringResolvable} name The name of the author + * @param {string} [icon] The icon URL of the author + * @param {string} [url] The URL of the author + * @returns {RichEmbed} This embed + */ + setAuthor(name, icon, url) { + this.author = { name: resolveString(name), icon_url: icon, url }; + return this; + } + + /** + * Sets the timestamp of this embed. + * @param {Date} [timestamp=current date] The timestamp + * @returns {RichEmbed} This embed + */ + setTimestamp(timestamp = new Date()) { + this.timestamp = timestamp; + return this; + } + + /** + * Adds a field to the embed (max 25). + * @param {StringResolvable} name The name of the field + * @param {StringResolvable} value The value of the field + * @param {boolean} [inline=false] Set the field to display inline + * @returns {RichEmbed} This embed + */ + addField(name, value, inline = false) { + if (this.fields.length >= 25) throw new RangeError('RichEmbeds may not exceed 25 fields.'); + name = resolveString(name); + if (name.length > 256) throw new RangeError('RichEmbed field names may not exceed 256 characters.'); + if (!/\S/.test(name)) throw new RangeError('RichEmbed field names may not be empty.'); + value = resolveString(value); + if (value.length > 1024) throw new RangeError('RichEmbed field values may not exceed 1024 characters.'); + if (!/\S/.test(value)) throw new RangeError('RichEmbed field values may not be empty.'); + this.fields.push({ name, value, inline }); + return this; + } + + /** + * Convenience function for `.addField('\u200B', '\u200B', inline)`. + * @param {boolean} [inline=false] Set the field to display inline + * @returns {RichEmbed} This embed + */ + addBlankField(inline = false) { + return this.addField('\u200B', '\u200B', inline); + } + + /** + * Set the thumbnail of this embed. + * @param {string} url The URL of the thumbnail + * @returns {RichEmbed} This embed + */ + setThumbnail(url) { + this.thumbnail = { url }; + return this; + } + + /** + * Set the image of this embed. + * @param {string} url The URL of the image + * @returns {RichEmbed} This embed + */ + setImage(url) { + this.image = { url }; + return this; + } + + /** + * Sets the footer of this embed. + * @param {StringResolvable} text The text of the footer + * @param {string} [icon] The icon URL of the footer + * @returns {RichEmbed} This embed + */ + setFooter(text, icon) { + text = resolveString(text); + if (text.length > 2048) throw new RangeError('RichEmbed footer text may not exceed 2048 characters.'); + this.footer = { text, icon_url: icon }; + return this; + } + + /** + * Sets the file to upload alongside the embed. This file can be accessed via `attachment://fileName.extension` when + * setting an embed image or author/footer icons. Only one file may be attached. + * @param {FileOptions|string|Attachment} file Local path or URL to the file to attach, + * or valid FileOptions for a file to attach + * @returns {RichEmbed} This embed + */ + attachFile(file) { + if (this.file) throw new RangeError('You may not upload more than one file at once.'); + if (file instanceof Attachment) file = file.file; + this.file = file; + return this; + } +} + +module.exports = RichEmbed; + +function resolveString(data) { + if (typeof data === 'string') return data; + if (data instanceof Array) return data.join('\n'); + return String(data); +} + + +/***/ }), +/* 29 */ +/***/ (function(module, exports) { + +/** + * Represents an attachment in a message. + * @param {BufferResolvable|Stream} file The file + * @param {string} [name] The name of the file, if any + */ +class Attachment { + constructor(file, name) { + this.file = null; + if (name) this.setAttachment(file, name); + else this._attach(file); + } + + /** + * The name of the file + * @type {?string} + * @readonly + */ + get name() { + return this.file.name; + } + + /** + * The file + * @type {?BufferResolvable|Stream} + * @readonly + */ + get attachment() { + return this.file.attachment; + } + + /** + * Set the file of this attachment. + * @param {BufferResolvable|Stream} file The file + * @param {string} name The name of the file + * @returns {Attachment} This attachment + */ + setAttachment(file, name) { + this.file = { attachment: file, name }; + return this; + } + + /** + * Set the file of this attachment. + * @param {BufferResolvable|Stream} attachment The file + * @returns {Attachment} This attachment + */ + setFile(attachment) { + this.file = { attachment }; + return this; + } + + /** + * Set the name of this attachment. + * @param {string} name The name of the image + * @returns {Attachment} This attachment + */ + setName(name) { + this.file.name = name; + return this; + } + + /** + * Set the file of this attachment. + * @param {BufferResolvable|Stream} file The file + * @param {string} name The name of the file + * @returns {void} + * @private + */ + _attach(file, name) { + if (typeof file === 'string') this.file = file; + else this.setAttachment(file, name); + } +} + +module.exports = Attachment; + + +/***/ }), +/* 30 */ +/***/ (function(module, exports, __webpack_require__) { + +const util = __webpack_require__(13); +const Long = __webpack_require__(37); +const User = __webpack_require__(14); +const Role = __webpack_require__(15); const Emoji = __webpack_require__(23); -const Presence = __webpack_require__(15).Presence; +const Presence = __webpack_require__(16).Presence; const GuildMember = __webpack_require__(24); const Constants = __webpack_require__(0); const Collection = __webpack_require__(3); @@ -7927,7 +8599,7 @@ const Snowflake = __webpack_require__(8); class Guild { constructor(client, data) { /** - * The client that created the instance of the the guild + * The client that created the instance of the guild * @name Guild#client * @type {Client} * @readonly @@ -7972,8 +8644,8 @@ class Guild { */ this.id = data.id; } else { - this.available = true; this.setup(data); + if (!data.channels) this.available = false; } } @@ -8043,6 +8715,12 @@ class Guild { */ this.afkChannelID = data.afk_channel_id; + /** + * The ID of the system channel + * @type {?Snowflake} + */ + this.systemChannelID = data.system_channel_id; + /** * Whether embedded images are enabled on this guild * @type {boolean} @@ -8122,7 +8800,8 @@ class Guild { if (!this.emojis) { /** - * A collection of emojis that are in this guild. The key is the emoji's ID, the value is the emoji. + * A collection of emojis that are in this guild + * The key is the emoji's ID, the value is the emoji * @type {Collection} */ this.emojis = new Collection(); @@ -8172,6 +8851,15 @@ class Guild { return Constants.Endpoints.Guild(this).Icon(this.client.options.http.cdn, this.icon); } + /** + * The acronym that shows up in place of a guild icon. + * @type {string} + * @readonly + */ + get nameAcronym() { + return this.name.replace(/\w+/g, name => name[0]).replace(/\s/g, ''); + } + /** * The URL to this guild's splash * @type {?string} @@ -8191,6 +8879,24 @@ class Guild { return this.members.get(this.ownerID); } + /** + * AFK voice channel for this guild + * @type {?VoiceChannel} + * @readonly + */ + get afkChannel() { + return this.client.channels.get(this.afkChannelID) || null; + } + + /** + * System channel for this guild + * @type {?GuildChannel} + * @readonly + */ + get systemChannel() { + return this.client.channels.get(this.systemChannelID) || null; + } + /** * If the client is connected to any voice channel in this guild, this will be the relevant VoiceConnection * @type {?VoiceConnection} @@ -8201,19 +8907,11 @@ class Guild { 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 position of this guild * This is only available when using a user account. * @type {?number} + * @readonly */ get position() { if (this.client.user.bot) return null; @@ -8221,6 +8919,66 @@ class Guild { return this.client.user.settings.guildPositions.indexOf(this.id); } + /** + * Whether the guild is muted + * This is only available when using a user account. + * @type {?boolean} + * @readonly + */ + get muted() { + if (this.client.user.bot) return null; + try { + return this.client.user.guildSettings.get(this.id).muted; + } catch (err) { + return false; + } + } + + /** + * The type of message that should notify you + * This is only available when using a user account. + * @type {?MessageNotificationType} + * @readonly + */ + get messageNotifications() { + if (this.client.user.bot) return null; + try { + return this.client.user.guildSettings.get(this.id).messageNotifications; + } catch (err) { + return null; + } + } + + /** + * Whether to receive mobile push notifications + * This is only available when using a user account. + * @type {?boolean} + * @readonly + */ + get mobilePush() { + if (this.client.user.bot) return null; + try { + return this.client.user.guildSettings.get(this.id).mobilePush; + } catch (err) { + return false; + } + } + + /** + * Whether to suppress everyone messages + * This is only available when using a user account. + * @type {?boolean} + * @readonly + */ + get suppressEveryone() { + if (this.client.user.bot) return null; + try { + return this.client.user.guildSettings.get(this.id).suppressEveryone; + } catch (err) { + return null; + } + } + /** * The `@everyone` role of the guild * @type {Role} @@ -8276,7 +9034,8 @@ class Guild { } /** - * Fetch a collection of invites to this guild. Resolves with a collection mapping invites by their codes. + * Fetch a collection of invites to this guild. + * Resolves with a collection mapping invites by their codes. * @returns {Promise>} */ fetchInvites() { @@ -8334,7 +9093,7 @@ class Guild { /** * 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 + * @param {boolean} [cache=true] Insert the member into the members cache * @returns {Promise} */ fetchMember(user, cache = true) { @@ -8385,9 +9144,7 @@ class Guild { * Performs a search within the entire guild. * This is only available when using a user account. * @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`. + * @returns {Promise} * @example * guild.search({ * content: 'discord.js', @@ -8407,7 +9164,9 @@ class Guild { * @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 {number} [explicitContentFilter] The level of the explicit content filter * @property {ChannelResolvable} [afkChannel] The AFK channel of the guild + * @property {ChannelResolvable} [systemChannel] The system 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 @@ -8417,23 +9176,52 @@ class Guild { /** * Updates the guild with new information - e.g. a new name. * @param {GuildEditData} data The data to update the guild with + * @param {string} [reason] Reason for editing the guild * @returns {Promise} * @example * // Set the guild name and region * guild.edit({ - * name: 'Discord Guild', - * region: 'london', + * name: 'Discord Guild', + * region: 'london', * }) - * .then(updated => console.log(`New guild name ${updated.name} in region ${updated.region}`)) - * .catch(console.error); + * .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(data, reason) { + const _data = {}; + if (data.name) _data.name = data.name; + if (data.region) _data.region = data.region; + if (typeof data.verificationLevel !== 'undefined') _data.verification_level = Number(data.verificationLevel); + if (typeof data.afkChannel !== 'undefined') { + _data.afk_channel_id = this.client.resolver.resolveChannelID(data.afkChannel); + } + if (typeof data.systemChannel !== 'undefined') { + _data.system_channel_id = this.client.resolver.resolveChannelID(data.systemChannel); + } + if (data.afkTimeout) _data.afk_timeout = Number(data.afkTimeout); + if (typeof data.icon !== 'undefined') _data.icon = data.icon; + if (data.owner) _data.owner_id = this.client.resolver.resolveUser(data.owner).id; + if (typeof data.splash !== 'undefined') _data.splash = data.splash; + if (typeof data.explicitContentFilter !== 'undefined') { + _data.explicit_content_filter = Number(data.explicitContentFilter); + } + return this.client.rest.methods.updateGuild(this, _data, reason); + } + + /** + * Edit the level of the explicit content filter. + * @param {number} explicitContentFilter The new level of the explicit content filter + * @param {string} [reason] Reason for changing the level of the guild's explicit content filter + * @returns {Promise} + */ + setExplicitContentFilter(explicitContentFilter, reason) { + return this.edit({ explicitContentFilter }, reason); } /** * Edit the name of the guild. * @param {string} name The new name of the guild + * @param {string} [reason] Reason for changing the guild's name * @returns {Promise} * @example * // Edit the guild name @@ -8441,13 +9229,14 @@ class Guild { * .then(updated => console.log(`Updated guild name to ${guild.name}`)) * .catch(console.error); */ - setName(name) { - return this.edit({ name }); + setName(name, reason) { + return this.edit({ name }, reason); } /** * Edit the region of the guild. * @param {string} region The new region of the guild + * @param {string} [reason] Reason for changing the guild's region * @returns {Promise} * @example * // Edit the guild region @@ -8455,13 +9244,14 @@ class Guild { * .then(updated => console.log(`Updated guild region to ${guild.region}`)) * .catch(console.error); */ - setRegion(region) { - return this.edit({ region }); + setRegion(region, reason) { + return this.edit({ region }, reason); } /** * Edit the verification level of the guild. * @param {number} verificationLevel The new verification level of the guild + * @param {string} [reason] Reason for changing the guild's verification level * @returns {Promise} * @example * // Edit the guild verification level @@ -8469,13 +9259,14 @@ class Guild { * .then(updated => console.log(`Updated guild verification level to ${guild.verificationLevel}`)) * .catch(console.error); */ - setVerificationLevel(verificationLevel) { - return this.edit({ verificationLevel }); + setVerificationLevel(verificationLevel, reason) { + return this.edit({ verificationLevel }, reason); } /** * Edit the AFK channel of the guild. * @param {ChannelResolvable} afkChannel The new AFK channel + * @param {string} [reason] Reason for changing the guild's AFK channel * @returns {Promise} * @example * // Edit the guild AFK channel @@ -8483,13 +9274,24 @@ class Guild { * .then(updated => console.log(`Updated guild AFK channel to ${guild.afkChannel}`)) * .catch(console.error); */ - setAFKChannel(afkChannel) { - return this.edit({ afkChannel }); + setAFKChannel(afkChannel, reason) { + return this.edit({ afkChannel }, reason); + } + + /** + * Edit the system channel of the guild. + * @param {ChannelResolvable} systemChannel The new system channel + * @param {string} [reason] Reason for changing the guild's system channel + * @returns {Promise} + */ + setSystemChannel(systemChannel, reason) { + return this.edit({ systemChannel }, reason); } /** * Edit the AFK timeout of the guild. * @param {number} afkTimeout The time in seconds that a user must be idle to be considered AFK + * @param {string} [reason] Reason for changing the guild's AFK timeout * @returns {Promise} * @example * // Edit the guild AFK channel @@ -8497,27 +9299,29 @@ class Guild { * .then(updated => console.log(`Updated guild AFK timeout to ${guild.afkTimeout}`)) * .catch(console.error); */ - setAFKTimeout(afkTimeout) { - return this.edit({ afkTimeout }); + setAFKTimeout(afkTimeout, reason) { + return this.edit({ afkTimeout }, reason); } /** * Set a new guild icon. - * @param {Base64Resolvable} icon The new icon of the guild + * @param {Base64Resolvable|BufferResolvable} icon The new icon of the guild + * @param {string} [reason] Reason for changing the guild's icon * @returns {Promise} * @example * // Edit the guild icon - * guild.setIcon(fs.readFileSync('./icon.png')) + * guild.setIcon('./icon.png') * .then(updated => console.log('Updated the guild icon')) * .catch(console.error); */ - setIcon(icon) { - return this.edit({ icon }); + setIcon(icon, reason) { + return this.client.resolver.resolveImage(icon).then(data => this.edit({ icon: data, reason })); } /** * Sets a new owner of the guild. * @param {GuildMemberResolvable} owner The new owner of the guild + * @param {string} [reason] Reason for setting the new owner * @returns {Promise} * @example * // Edit the guild owner @@ -8525,25 +9329,28 @@ class Guild { * .then(updated => console.log(`Updated the guild owner to ${updated.owner.username}`)) * .catch(console.error); */ - setOwner(owner) { - return this.edit({ owner }); + setOwner(owner, reason) { + return this.edit({ owner }, reason); } /** * Set a new guild splash screen. - * @param {Base64Resolvable} splash The new splash screen of the guild + * @param {BufferResolvable|Base64Resolvable} splash The new splash screen of the guild + * @param {string} [reason] Reason for changing the guild's splash screen * @returns {Promise} * @example * // Edit the guild splash - * guild.setIcon(fs.readFileSync('./splash.png')) + * guild.setSplash('./splash.png') * .then(updated => console.log('Updated the guild splash')) * .catch(console.error); */ setSplash(splash) { - return this.edit({ splash }); + return this.client.resolver.resolveImage(splash).then(data => this.edit({ splash: data })); } /** + * Sets the position of the guild in the guild listing. + * This is only available when using a user account. * @param {number} position Absolute or relative position * @param {boolean} [relative=false] Whether to position relatively or absolutely * @returns {Promise} @@ -8558,7 +9365,7 @@ class Guild { /** * Marks all messages in this guild as read. * This is only available when using a user account. - * @returns {Promise} This guild + * @returns {Promise} */ acknowledge() { return this.client.rest.methods.ackGuild(this); @@ -8566,6 +9373,7 @@ class Guild { /** * Allow direct messages from guild members. + * This is only available when using a user account. * @param {boolean} allow Whether to allow direct messages * @returns {Promise} */ @@ -8588,8 +9396,8 @@ class Guild { * @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); + * .then(user => console.log(`Banned ${user.username || user.id || user} from ${guild.name}`)) + * .catch(console.error); */ ban(user, options = {}) { if (typeof options === 'number') { @@ -8604,21 +9412,23 @@ class Guild { /** * Unbans a user from the guild. * @param {UserResolvable} user The user to unban + * @param {string} [reason] Reason for unbanning the user * @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); + * .then(user => console.log(`Unbanned ${user.username} from ${guild.name}`)) + * .catch(console.error); */ - unban(user) { - return this.client.rest.methods.unbanGuildMember(this, user); + unban(user, reason) { + return this.client.rest.methods.unbanGuildMember(this, user, reason); } /** * 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 + * @param {string} [reason] Reason for this prune * @returns {Promise} The number of members that were/will be kicked * @example * // See how many members will be pruned @@ -8631,9 +9441,9 @@ class Guild { * .then(pruned => console.log(`I just pruned ${pruned} people!`)) * .catch(console.error); */ - pruneMembers(days, dry = false) { + pruneMembers(days, dry = false, reason) { if (typeof days !== 'number') throw new TypeError('Days must be a number.'); - return this.client.rest.methods.pruneGuildMembers(this, days, dry); + return this.client.rest.methods.pruneGuildMembers(this, days, dry, reason); } /** @@ -8648,16 +9458,17 @@ class Guild { * 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 + * @param {Array} [overwrites] Permission overwrites to apply to the new channel + * @param {string} [reason] Reason for creating this 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); + * .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); + createChannel(name, type, overwrites, reason) { + return this.client.rest.methods.createChannel(this, name, type, overwrites, reason); } /** @@ -8673,8 +9484,8 @@ class Guild { * @returns {Promise} * @example * guild.updateChannels([{ channel: channelID, position: newChannelIndex }]) - * .then(guild => console.log(`Updated channel positions for ${guild.id}`)) - * .catch(console.error); + * .then(guild => console.log(`Updated channel positions for ${guild.id}`)) + * .catch(console.error); */ setChannelPositions(channelPositions) { return this.client.rest.methods.updateChannelPositions(this.id, channelPositions); @@ -8683,23 +9494,24 @@ class Guild { /** * Creates a new role in the guild with given information * @param {RoleData} [data] The data to update the role with + * @param {string} [reason] Reason for creating this role * @returns {Promise} * @example * // Create a new role * guild.createRole() - * .then(role => console.log(`Created role ${role}`)) - * .catch(console.error); + * .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) + * .then(role => console.log(`Created role ${role}`)) + * .catch(console.error) */ - createRole(data = {}) { - return this.client.rest.methods.createGuildRole(this, data); + createRole(data = {}, reason) { + return this.client.rest.methods.createGuildRole(this, data, reason); } /** @@ -8707,39 +9519,38 @@ class 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 + * @param {string} [reason] Reason for creating the emoji * @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); + * .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); + * .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)); - }); - } - }); + createEmoji(attachment, name, roles, reason) { + if (typeof attachment === 'string' && attachment.startsWith('data:')) { + return this.client.rest.methods.createEmoji(this, attachment, name, roles, reason); + } else { + return this.client.resolver.resolveImage(attachment).then(data => + this.client.rest.methods.createEmoji(this, data, name, roles, reason) + ); + } } /** * Delete an emoji. * @param {Emoji|string} emoji The emoji to delete + * @param {string} [reason] Reason for deleting the emoji * @returns {Promise} */ - deleteEmoji(emoji) { + deleteEmoji(emoji, reason) { if (!(emoji instanceof Emoji)) emoji = this.emojis.get(emoji); - return this.client.rest.methods.deleteEmoji(emoji); + return this.client.rest.methods.deleteEmoji(emoji, reason); } /** @@ -8748,8 +9559,8 @@ class Guild { * @example * // Leave a guild * guild.leave() - * .then(g => console.log(`Left the guild ${g}`)) - * .catch(console.error); + * .then(g => console.log(`Left the guild ${g}`)) + * .catch(console.error); */ leave() { return this.client.rest.methods.leaveGuild(this); @@ -8761,8 +9572,8 @@ class Guild { * @example * // Delete a guild * guild.delete() - * .then(g => console.log(`Deleted the guild ${g}`)) - * .catch(console.error); + * .then(g => console.log(`Deleted the guild ${g}`)) + * .catch(console.error); */ delete() { return this.client.rest.methods.deleteGuild(this); @@ -8973,24 +9784,37 @@ class Guild { _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() + a.position - b.position : + Long.fromString(a.id).sub(Long.fromString(b.id)).toNumber() ); } } +/** + * The `#general` TextChannel of the guild + * @name Guild#defaultChannel + * @type {TextChannel} + * @readonly + */ +Object.defineProperty(Guild.prototype, 'defaultChannel', { + get: util.deprecate(function defaultChannel() { + return this.channels.get(this.id); + }, 'Guild#defaultChannel: This property is obsolete, will be removed in v12.0.0, and may not function as expected.'), +}); + module.exports = Guild; /***/ }), -/* 29 */ +/* 31 */ /***/ (function(module, exports, __webpack_require__) { -const Channel = __webpack_require__(16); -const Role = __webpack_require__(14); -const PermissionOverwrites = __webpack_require__(68); +const Channel = __webpack_require__(17); +const Role = __webpack_require__(15); +const PermissionOverwrites = __webpack_require__(70); const Permissions = __webpack_require__(11); const Collection = __webpack_require__(3); +const Constants = __webpack_require__(0); /** * Represents a guild channel (i.e. text channels and voice channels). @@ -9060,6 +9884,9 @@ class GuildChannel extends Channel { const roles = member.roles; for (const role of roles.values()) permissions |= role.permissions; + const admin = Boolean(permissions & Permissions.FLAGS.ADMINISTRATOR); + if (admin) return new Permissions(Permissions.ALL); + const overwrites = this.overwritesFor(member, true, roles); if (overwrites.everyone) { @@ -9079,9 +9906,6 @@ class GuildChannel extends Channel { permissions |= overwrites.member.allow; } - const admin = Boolean(permissions & Permissions.FLAGS.ADMINISTRATOR); - if (admin) permissions = Permissions.ALL; - return new Permissions(member, permissions); } @@ -9124,18 +9948,19 @@ class GuildChannel extends Channel { /** * Overwrites the permissions for a user or role in this channel. - * @param {RoleResolvable|UserResolvable} userOrRole The user or role to update + * @param {Role|Snowflake|UserResolvable} userOrRole The user or role to update * @param {PermissionOverwriteOptions} options The configuration for the update + * @param {string} [reason] Reason for creating/editing this overwrite * @returns {Promise} * @example * // Overwrite permissions for a message author * message.channel.overwritePermissions(message.author, { - * SEND_MESSAGES: false + * SEND_MESSAGES: false * }) - * .then(() => console.log('Done!')) - * .catch(console.error); + * .then(() => console.log('Done!')) + * .catch(console.error); */ - overwritePermissions(userOrRole, options) { + overwritePermissions(userOrRole, options, reason) { const payload = { allow: 0, deny: 0, @@ -9174,7 +9999,7 @@ class GuildChannel extends Channel { } } - return this.client.rest.methods.setChannelOverwrite(this, payload); + return this.client.rest.methods.setChannelOverwrite(this, payload, reason); } /** @@ -9190,29 +10015,31 @@ class GuildChannel extends Channel { /** * Edits the channel. * @param {ChannelData} data The new data for the channel + * @param {string} [reason] Reason for editing this channel * @returns {Promise} * @example * // Edit a channel * channel.edit({name: 'new-channel'}) - * .then(c => console.log(`Edited channel ${c}`)) - * .catch(console.error); + * .then(c => console.log(`Edited channel ${c}`)) + * .catch(console.error); */ - edit(data) { - return this.client.rest.methods.updateChannel(this, data); + edit(data, reason) { + return this.client.rest.methods.updateChannel(this, data, reason); } /** * Set a new name for the guild channel. * @param {string} name The new name for the guild channel + * @param {string} [reason] Reason for changing the guild channel's name * @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); + * .then(newChannel => console.log(`Channel's new name is ${newChannel.name}`)) + * .catch(console.error); */ - setName(name) { - return this.edit({ name }); + setName(name, reason) { + return this.edit({ name }, reason); } /** @@ -9223,8 +10050,8 @@ class GuildChannel extends Channel { * @example * // Set a new channel position * channel.setPosition(2) - * .then(newChannel => console.log(`Channel's new position is ${newChannel.position}`)) - * .catch(console.error); + * .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); @@ -9233,34 +10060,32 @@ class GuildChannel extends Channel { /** * Set a new topic for the guild channel. * @param {string} topic The new topic for the guild channel + * @param {string} [reason] Reason for changing the guild channel's topic * @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); + * .then(newChannel => console.log(`Channel's new topic is ${newChannel.topic}`)) + * .catch(console.error); */ - setTopic(topic) { - return this.client.rest.methods.updateChannel(this, { topic }); + setTopic(topic, reason) { + return this.edit({ topic }, reason); } - /** - * 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 + * This is only available when using a bot account. + * @param {Object} [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 + * @param {boolean} [options.unique=false] Create a unique invite, or use an existing one with similar settings + * @param {string} [reason] Reason for creating the invite * @returns {Promise} */ - createInvite(options = {}) { - return this.client.rest.methods.createChannelInvite(this, options); + createInvite(options = {}, reason) { + return this.client.rest.methods.createChannelInvite(this, options, reason); } /** @@ -9268,13 +10093,28 @@ class GuildChannel extends 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 + * @param {string} [reason] Reason for cloning this channel * @returns {Promise} */ - clone(name = this.name, withPermissions = true, withTopic = true) { - return this.guild.createChannel(name, this.type, withPermissions ? this.permissionOverwrites : []) + clone(name = this.name, withPermissions = true, withTopic = true, reason) { + return this.guild.createChannel(name, this.type, withPermissions ? this.permissionOverwrites : [], reason) .then(channel => withTopic ? channel.setTopic(this.topic) : channel); } + /** + * Deletes this channel. + * @param {string} [reason] Reason for deleting this channel + * @returns {Promise} + * @example + * // Delete the channel + * channel.delete('making room for new channels') + * .then(channel => console.log(`Deleted ${channel.name} to make room for new channels`)) + * .catch(console.error); // Log error + */ + delete(reason) { + return this.client.rest.methods.deleteChannel(this, reason); + } + /** * 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. @@ -9310,6 +10150,36 @@ class GuildChannel extends Channel { this.permissionsFor(this.client.user).has(Permissions.FLAGS.MANAGE_CHANNELS); } + /** + * Whether the channel is muted + * This is only available when using a user account. + * @type {?boolean} + * @readonly + */ + get muted() { + if (this.client.user.bot) return null; + try { + return this.client.user.guildSettings.get(this.guild.id).channelOverrides.get(this.id).muted; + } catch (err) { + return false; + } + } + + /** + * The type of message that should notify you + * This is only available when using a user account. + * @type {?MessageNotificationType} + * @readonly + */ + get messageNotifications() { + if (this.client.user.bot) return null; + try { + return this.client.user.guildSettings.get(this.guild.id).channelOverrides.get(this.id).messageNotifications; + } catch (err) { + return Constants.MessageNotificationTypes[3]; + } + } + /** * When concatenated with a string, this automatically returns the channel's mention instead of the Channel object. * @returns {string} @@ -9329,10 +10199,10 @@ module.exports = GuildChannel; /***/ }), -/* 30 */ +/* 32 */ /***/ (function(module, exports, __webpack_require__) { -const Snekfetch = __webpack_require__(76); +const Snekfetch = __webpack_require__(79); // Sync stuff might go here @@ -9340,140 +10210,7 @@ module.exports = Snekfetch; /***/ }), -/* 31 */ -/***/ (function(module, exports, __webpack_require__) { - -// 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. - -module.exports = Stream; - -var EE = __webpack_require__(9).EventEmitter; -var inherits = __webpack_require__(10); - -inherits(Stream, EE); -Stream.Readable = __webpack_require__(17); -Stream.Writable = __webpack_require__(83); -Stream.Duplex = __webpack_require__(84); -Stream.Transform = __webpack_require__(85); -Stream.PassThrough = __webpack_require__(86); - -// Backwards-compat with node 0.4.x -Stream.Stream = Stream; - - - -// old-style streams. Note that the pipe method (the only relevant -// part of this class) is overridden in the Readable class. - -function Stream() { - EE.call(this); -} - -Stream.prototype.pipe = function(dest, options) { - var source = this; - - function ondata(chunk) { - if (dest.writable) { - if (false === dest.write(chunk) && source.pause) { - source.pause(); - } - } - } - - source.on('data', ondata); - - function ondrain() { - if (source.readable && source.resume) { - source.resume(); - } - } - - dest.on('drain', ondrain); - - // If the 'end' option is not supplied, dest.end() will be called when - // source gets the 'end' or 'close' events. Only dest.end() once. - if (!dest._isStdio && (!options || options.end !== false)) { - source.on('end', onend); - source.on('close', onclose); - } - - var didOnEnd = false; - function onend() { - if (didOnEnd) return; - didOnEnd = true; - - dest.end(); - } - - - function onclose() { - if (didOnEnd) return; - didOnEnd = true; - - if (typeof dest.destroy === 'function') dest.destroy(); - } - - // don't leave dangling pipes when there are errors. - function onerror(er) { - cleanup(); - if (EE.listenerCount(this, 'error') === 0) { - throw er; // Unhandled stream error in pipe. - } - } - - source.on('error', onerror); - dest.on('error', onerror); - - // remove all the event listeners that were added. - function cleanup() { - source.removeListener('data', ondata); - dest.removeListener('drain', ondrain); - - source.removeListener('end', onend); - source.removeListener('close', onclose); - - source.removeListener('error', onerror); - dest.removeListener('error', onerror); - - source.removeListener('end', cleanup); - source.removeListener('close', cleanup); - - dest.removeListener('close', cleanup); - } - - source.on('end', cleanup); - source.on('close', cleanup); - - dest.on('close', cleanup); - - dest.emit('pipe', source); - - // Allow for unix-like usage: A.pipe(B).pipe(C) - return dest; -}; - - -/***/ }), -/* 32 */ +/* 33 */ /***/ (function(module, exports, __webpack_require__) { /* eslint-disable node/no-deprecated-api */ @@ -9541,7 +10278,7 @@ SafeBuffer.allocUnsafeSlow = function (size) { /***/ }), -/* 33 */ +/* 34 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -9574,7 +10311,7 @@ SafeBuffer.allocUnsafeSlow = function (size) { /**/ -var processNextTick = __webpack_require__(25); +var processNextTick = __webpack_require__(26); /**/ module.exports = Writable; @@ -9611,22 +10348,22 @@ var Duplex; Writable.WritableState = WritableState; /**/ -var util = __webpack_require__(18); +var util = __webpack_require__(19); util.inherits = __webpack_require__(10); /**/ /**/ var internalUtil = { - deprecate: __webpack_require__(81) + deprecate: __webpack_require__(84) }; /**/ /**/ -var Stream = __webpack_require__(44); +var Stream = __webpack_require__(47); /**/ /**/ -var Buffer = __webpack_require__(32).Buffer; +var Buffer = __webpack_require__(33).Buffer; var OurUint8Array = global.Uint8Array || function () {}; function _uint8ArrayToBuffer(chunk) { return Buffer.from(chunk); @@ -9636,7 +10373,7 @@ function _isUint8Array(obj) { } /**/ -var destroyImpl = __webpack_require__(45); +var destroyImpl = __webpack_require__(48); util.inherits(Writable, Stream); @@ -10209,21 +10946,106 @@ Writable.prototype._destroy = function (err, cb) { this.end(); cb(err); }; -/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(7), __webpack_require__(79).setImmediate, __webpack_require__(6))) +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(7), __webpack_require__(82).setImmediate, __webpack_require__(6))) /***/ }), -/* 34 */ +/* 35 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -exports.decode = exports.parse = __webpack_require__(87); -exports.encode = exports.stringify = __webpack_require__(88); +exports.decode = exports.parse = __webpack_require__(90); +exports.encode = exports.stringify = __webpack_require__(91); /***/ }), -/* 35 */ +/* 36 */ +/***/ (function(module, exports, __webpack_require__) { + +/* WEBPACK VAR INJECTION */(function(global) {var ClientRequest = __webpack_require__(92) +var extend = __webpack_require__(95) +var statusCodes = __webpack_require__(96) +var url = __webpack_require__(52) + +var http = exports + +http.request = function (opts, cb) { + if (typeof opts === 'string') + opts = url.parse(opts) + else + opts = extend(opts) + + // Normally, the page is loaded from http or https, so not specifying a protocol + // will result in a (valid) protocol-relative url. However, this won't work if + // the protocol is something else, like 'file:' + var defaultProtocol = global.location.protocol.search(/^https?:$/) === -1 ? 'http:' : '' + + var protocol = opts.protocol || defaultProtocol + var host = opts.hostname || opts.host + var port = opts.port + var path = opts.path || '/' + + // Necessary for IPv6 addresses + if (host && host.indexOf(':') !== -1) + host = '[' + host + ']' + + // This may be a relative url. The browser should always be able to interpret it correctly. + opts.url = (host ? (protocol + '//' + host) : '') + (port ? ':' + port : '') + path + opts.method = (opts.method || 'GET').toUpperCase() + opts.headers = opts.headers || {} + + // Also valid opts.auth, opts.mode + + var req = new ClientRequest(opts) + if (cb) + req.on('response', cb) + return req +} + +http.get = function get (opts, cb) { + var req = http.request(opts, cb) + req.end() + return req +} + +http.Agent = function () {} +http.Agent.defaultMaxSockets = 4 + +http.STATUS_CODES = statusCodes + +http.METHODS = [ + 'CHECKOUT', + 'CONNECT', + 'COPY', + 'DELETE', + 'GET', + 'HEAD', + 'LOCK', + 'M-SEARCH', + 'MERGE', + 'MKACTIVITY', + 'MKCOL', + 'MOVE', + 'NOTIFY', + 'OPTIONS', + 'PATCH', + 'POST', + 'PROPFIND', + 'PROPPATCH', + 'PURGE', + 'PUT', + 'REPORT', + 'SEARCH', + 'SUBSCRIBE', + 'TRACE', + 'UNLOCK', + 'UNSUBSCRIBE' +] +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) + +/***/ }), +/* 37 */ /***/ (function(module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* @@ -11440,817 +12262,23 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ }); -/***/ }), -/* 36 */ -/***/ (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; - - -/***/ }), -/* 37 */ -/***/ (function(module, exports, __webpack_require__) { - -const Collection = __webpack_require__(3); -const EventEmitter = __webpack_require__(9).EventEmitter; - -/** - * Filter to be applied to the collector. - * @typedef {Function} CollectorFilter - * @param {...*} args Any arguments received by the listener - * @returns {boolean} To collect or not collect - */ - -/** - * Options to be applied to the collector. - * @typedef {Object} CollectorOptions - * @property {number} [time] How long to run the collector for - */ - -/** - * Abstract class for defining a new Collector. - * @abstract - */ -class Collector extends EventEmitter { - constructor(client, filter, options = {}) { - super(); - - /** - * The client - * @name Collector#client - * @type {Client} - * @readonly - */ - Object.defineProperty(this, 'client', { value: client }); - - /** - * The filter applied to this collector - * @type {CollectorFilter} - */ - this.filter = filter; - - /** - * The options of this collector - * @type {CollectorOptions} - */ - this.options = options; - - /** - * The items collected by this collector - * @type {Collection} - */ - this.collected = new Collection(); - - /** - * Whether this collector has finished collecting - * @type {boolean} - */ - this.ended = false; - - /** - * Timeout for cleanup - * @type {?Timeout} - * @private - */ - this._timeout = null; - - /** - * Call this to handle an event as a collectable element - * Accepts any event data as parameters - * @type {Function} - * @private - */ - this.listener = this._handle.bind(this); - if (options.time) this._timeout = this.client.setTimeout(() => this.stop('time'), options.time); - } - - /** - * @param {...*} args The arguments emitted by the listener - * @emits Collector#collect - * @private - */ - _handle(...args) { - const collect = this.handle(...args); - if (!collect || !this.filter(...args)) return; - - this.collected.set(collect.key, collect.value); - - /** - * Emitted whenever an element is collected. - * @event Collector#collect - * @param {*} element The element that got collected - * @param {Collector} collector The collector - */ - this.emit('collect', collect.value, this); - - const post = this.postCheck(...args); - if (post) this.stop(post); - } - - /** - * Return a promise that resolves with the next collected element; - * rejects with collected elements if the collector finishes without receving a next element - * @type {Promise} - * @readonly - */ - get next() { - return new Promise((resolve, reject) => { - if (this.ended) { - reject(this.collected); - return; - } - - const cleanup = () => { - this.removeListener('collect', onCollect); - this.removeListener('end', onEnd); - }; - - const onCollect = item => { - cleanup(); - resolve(item); - }; - - const onEnd = () => { - cleanup(); - reject(this.collected); // eslint-disable-line prefer-promise-reject-errors - }; - - this.on('collect', onCollect); - this.on('end', onEnd); - }); - } - - /** - * Stop this collector and emit the `end` event. - * @param {string} [reason='user'] The reason this collector is ending - * @emits Collector#end - */ - stop(reason = 'user') { - if (this.ended) return; - - if (this._timeout) this.client.clearTimeout(this._timeout); - this.ended = true; - this.cleanup(); - - /** - * Emitted when the collector is finished collecting. - * @event Collector#end - * @param {Collection} collected The elements collected by the collector - * @param {string} reason The reason the collector ended - */ - this.emit('end', this.collected, reason); - } - - /* eslint-disable no-empty-function, valid-jsdoc */ - /** - * Handles incoming events from the `listener` function. Returns null if the event should not be collected, - * or returns an object describing the data that should be stored. - * @see Collector#listener - * @param {...*} args Any args the event listener emits - * @returns {?{key: string, value}} Data to insert into collection, if any - * @abstract - */ - handle() {} - - /** - * This method runs after collection to see if the collector should finish. - * @param {...*} args Any args the event listener emits - * @returns {?string} Reason to end the collector, if any - * @abstract - */ - postCheck() {} - - /** - * Called when the collector is ending. - * @abstract - */ - cleanup() {} - /* eslint-enable no-empty-function, valid-jsdoc */ -} - -module.exports = Collector; - - /***/ }), /* 38 */ /***/ (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; - - -/***/ }), -/* 39 */ -/***/ (function(module, exports, __webpack_require__) { - -const Snowflake = __webpack_require__(8); - -/** - * Represents an OAuth2 Application. - */ -class OAuth2Application { - constructor(client, data) { - /** - * The client that instantiated the application - * @name OAuth2Application#client - * @type {Client} - * @readonly - */ - Object.defineProperty(this, 'client', { value: client }); - - this.setup(data); - } - - setup(data) { - /** - * The ID of the app - * @type {Snowflake} - */ - this.id = data.id; - - /** - * The name of the app - * @type {string} - */ - this.name = data.name; - - /** - * The app's description - * @type {string} - */ - this.description = data.description; - - /** - * The app's icon hash - * @type {string} - */ - this.icon = data.icon; - - /** - * The app's icon URL - * @type {string} - */ - this.iconURL = `https://cdn.discordapp.com/app-icons/${this.id}/${this.icon}.jpg`; - - /** - * The app's RPC origins - * @type {?string[]} - */ - this.rpcOrigins = data.rpc_origins; - - /** - * The app's redirect URIs - * @type {string[]} - */ - this.redirectURIs = data.redirect_uris; - - /** - * If this app's bot requires a code grant when using the OAuth2 flow - * @type {boolean} - */ - this.botRequireCodeGrant = data.bot_require_code_grant; - - /** - * If this app's bot is public - * @type {boolean} - */ - this.botPublic = data.bot_public; - - /** - * If this app can use rpc - * @type {boolean} - */ - this.rpcApplicationState = data.rpc_application_state; - - /** - * Object containing basic info about this app's bot - * @type {Object} - */ - this.bot = data.bot; - - /** - * The flags for the app - * @type {number} - */ - this.flags = data.flags; - - /** - * OAuth2 secret for the application - * @type {boolean} - */ - this.secret = data.secret; - - if (data.owner) { - /** - * The owner of this OAuth application - * @type {?User} - */ - this.owner = this.client.dataManager.newUser(data.owner); - } - } - - /** - * The timestamp the app was created at - * @type {number} - * @readonly - */ - get createdTimestamp() { - return Snowflake.deconstruct(this.id).timestamp; - } - - /** - * The time the app was created - * @type {Date} - * @readonly - */ - get createdAt() { - return new Date(this.createdTimestamp); - } - - /** - * Reset the app's secret and bot token. - * @returns {OAuth2Application} - */ - reset() { - return this.client.rest.methods.resetApplication(this.id); - } - - /** - * When concatenated with a string, this automatically concatenates the app name rather than the app object. - * @returns {string} - */ - toString() { - return this.name; - } -} - -module.exports = OAuth2Application; - - -/***/ }), -/* 40 */ -/***/ (function(module, exports, __webpack_require__) { - -const Channel = __webpack_require__(16); -const TextBasedChannel = __webpack_require__(21); -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; - - -/***/ }), -/* 41 */ -/***/ (function(module, exports, __webpack_require__) { - -/* WEBPACK VAR INJECTION */(function(Buffer) {const path = __webpack_require__(19); -const fs = __webpack_require__(26); -const snekfetch = __webpack_require__(30); +/* WEBPACK VAR INJECTION */(function(Buffer) {const path = __webpack_require__(20); +const fs = __webpack_require__(27); +const snekfetch = __webpack_require__(32); const Constants = __webpack_require__(0); const convertToBuffer = __webpack_require__(4).convertToBuffer; -const User = __webpack_require__(13); +const User = __webpack_require__(14); const Message = __webpack_require__(22); -const Guild = __webpack_require__(28); -const Channel = __webpack_require__(16); +const Guild = __webpack_require__(30); +const Channel = __webpack_require__(17); const GuildMember = __webpack_require__(24); const Emoji = __webpack_require__(23); -const ReactionEmoji = __webpack_require__(36); +const ReactionEmoji = __webpack_require__(39); /** * The DataResolver identifies different objects and tries to resolve a specific piece of information from them, e.g. @@ -12268,7 +12296,7 @@ class ClientDataResolver { /** * Data that resolves to give a User object. This can be: * * A User object - * * A user ID + * * A Snowflake * * A Message object (resolves to the message author) * * A Guild object (owner of the guild) * * A GuildMember object @@ -12305,7 +12333,7 @@ class ClientDataResolver { /** * Data that resolves to give a Guild object. This can be: * * A Guild object - * * A Guild ID + * * A Snowflake * @typedef {Guild|Snowflake} GuildResolvable */ @@ -12346,7 +12374,7 @@ class ClientDataResolver { * * A Channel object * * A Message object (the channel the message was sent in) * * A Guild object (the #general channel) - * * A channel ID + * * A Snowflake * @typedef {Channel|Guild|Message|Snowflake} ChannelResolvable */ @@ -12414,6 +12442,20 @@ class ClientDataResolver { return String(data); } + + /** + * Resolves a Base64Resolvable, a string, or a BufferResolvable to a Base 64 image. + * @param {BufferResolvable|Base64Resolvable} image The image to be resolved + * @returns {Promise} + */ + resolveImage(image) { + if (!image) return Promise.resolve(null); + if (typeof image === 'string' && image.startsWith('data:')) { + return Promise.resolve(image); + } + return this.resolveFile(image).then(this.resolveBase64); + } + /** * Data that resolves to give a Base64 string, typically for image uploading. This can be: * * A Buffer @@ -12432,19 +12474,25 @@ class ClientDataResolver { } /** - * Data that can be resolved to give a Buffer. This can be: - * * A Buffer - * * The path to a local file - * * A URL - * @typedef {string|Buffer} BufferResolvable - */ + * Data that can be resolved to give a Buffer. This can be: + * * A Buffer + * * The path to a local file + * * A URL + * * A Stream + * @typedef {string|Buffer} BufferResolvable + */ /** - * Resolves a BufferResolvable to a Buffer. - * @param {BufferResolvable} resource The buffer resolvable to resolve - * @returns {Promise} - */ - resolveBuffer(resource) { + * @external Stream + * @see {@link https://nodejs.org/api/stream.html} + */ + + /** + * Resolves a BufferResolvable to a Buffer. + * @param {BufferResolvable|Stream} resource The buffer or stream resolvable to resolve + * @returns {Promise} + */ + resolveFile(resource) { if (resource instanceof Buffer) return Promise.resolve(resource); if (this.client.browser && resource instanceof ArrayBuffer) return Promise.resolve(convertToBuffer(resource)); @@ -12452,11 +12500,11 @@ class ClientDataResolver { return new Promise((resolve, reject) => { if (/^https?:\/\//.test(resource)) { snekfetch.get(resource) - .end((err, res) => { - if (err) return reject(err); - if (!(res.body instanceof Buffer)) return reject(new TypeError('The response body isn\'t a Buffer.')); - return resolve(res.body); - }); + .end((err, res) => { + if (err) return reject(err); + if (!(res.body instanceof Buffer)) return reject(new TypeError('The response body isn\'t a Buffer.')); + return resolve(res.body); + }); } else { const file = path.resolve(resource); fs.stat(file, (err, stats) => { @@ -12469,6 +12517,13 @@ class ClientDataResolver { }); } }); + } else if (resource.pipe && typeof resource.pipe === 'function') { + return new Promise((resolve, reject) => { + const buffers = []; + resource.once('error', reject); + resource.on('data', data => buffers.push(data)); + resource.once('end', () => resolve(Buffer.concat(buffers))); + }); } return Promise.reject(new TypeError('The resource must be a string or Buffer.')); @@ -12569,8 +12624,972 @@ module.exports = ClientDataResolver; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5).Buffer)) +/***/ }), +/* 39 */ +/***/ (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.send(`The emoji used is ${reaction.emoji}`); + * @returns {string} + */ + toString() { + return this.id ? `<:${this.name}:${this.id}>` : this.name; + } +} + +module.exports = ReactionEmoji; + + +/***/ }), +/* 40 */ +/***/ (function(module, exports, __webpack_require__) { + +const Collection = __webpack_require__(3); +const EventEmitter = __webpack_require__(9).EventEmitter; + +/** + * Filter to be applied to the collector. + * @typedef {Function} CollectorFilter + * @param {...*} args Any arguments received by the listener + * @param {Collection} collection The items collected by this collector + * @returns {boolean} + */ + +/** + * Options to be applied to the collector. + * @typedef {Object} CollectorOptions + * @property {number} [time] How long to run the collector for + */ + +/** + * Abstract class for defining a new Collector. + * @abstract + */ +class Collector extends EventEmitter { + constructor(client, filter, options = {}) { + super(); + + /** + * The client + * @name Collector#client + * @type {Client} + * @readonly + */ + Object.defineProperty(this, 'client', { value: client }); + + /** + * The filter applied to this collector + * @type {CollectorFilter} + */ + this.filter = filter; + + /** + * The options of this collector + * @type {CollectorOptions} + */ + this.options = options; + + /** + * The items collected by this collector + * @type {Collection} + */ + this.collected = new Collection(); + + /** + * Whether this collector has finished collecting + * @type {boolean} + */ + this.ended = false; + + /** + * Timeout for cleanup + * @type {?Timeout} + * @private + */ + this._timeout = null; + + /** + * Call this to handle an event as a collectable element + * Accepts any event data as parameters + * @type {Function} + * @private + */ + this.listener = this._handle.bind(this); + if (options.time) this._timeout = this.client.setTimeout(() => this.stop('time'), options.time); + } + + /** + * @param {...*} args The arguments emitted by the listener + * @emits Collector#collect + * @private + */ + _handle(...args) { + const collect = this.handle(...args); + if (!collect || !this.filter(...args, this.collected)) return; + + this.collected.set(collect.key, collect.value); + + /** + * Emitted whenever an element is collected. + * @event Collector#collect + * @param {*} element The element that got collected + * @param {Collector} collector The collector + */ + this.emit('collect', collect.value, this); + + const post = this.postCheck(...args); + if (post) this.stop(post); + } + + /** + * Return a promise that resolves with the next collected element; + * rejects with collected elements if the collector finishes without receving a next element + * @type {Promise} + * @readonly + */ + get next() { + return new Promise((resolve, reject) => { + if (this.ended) { + reject(this.collected); + return; + } + + const cleanup = () => { + this.removeListener('collect', onCollect); + this.removeListener('end', onEnd); + }; + + const onCollect = item => { + cleanup(); + resolve(item); + }; + + const onEnd = () => { + cleanup(); + reject(this.collected); // eslint-disable-line prefer-promise-reject-errors + }; + + this.on('collect', onCollect); + this.on('end', onEnd); + }); + } + + /** + * Stop this collector and emit the `end` event. + * @param {string} [reason='user'] The reason this collector is ending + * @emits Collector#end + */ + stop(reason = 'user') { + if (this.ended) return; + + if (this._timeout) this.client.clearTimeout(this._timeout); + this.ended = true; + this.cleanup(); + + /** + * Emitted when the collector is finished collecting. + * @event Collector#end + * @param {Collection} collected The elements collected by the collector + * @param {string} reason The reason the collector ended + */ + this.emit('end', this.collected, reason); + } + + /* eslint-disable no-empty-function, valid-jsdoc */ + /** + * Handles incoming events from the `listener` function. Returns null if the event should not be collected, + * or returns an object describing the data that should be stored. + * @see Collector#listener + * @param {...*} args Any args the event listener emits + * @returns {?{key: string, value}} Data to insert into collection, if any + * @abstract + */ + handle() {} + + /** + * This method runs after collection to see if the collector should finish. + * @param {...*} args Any args the event listener emits + * @returns {?string} Reason to end the collector, if any + * @abstract + */ + postCheck() {} + + /** + * Called when the collector is ending. + * @abstract + */ + cleanup() {} + /* eslint-enable no-empty-function, valid-jsdoc */ +} + +module.exports = Collector; + + +/***/ }), +/* 41 */ +/***/ (function(module, exports, __webpack_require__) { + +/* WEBPACK VAR INJECTION */(function(Buffer) {const path = __webpack_require__(20); +const Util = __webpack_require__(4); +const Attachment = __webpack_require__(29); +const RichEmbed = __webpack_require__(28); + +/** + * 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 {Array} [embeds] An array of embeds for the message + * (see [here](https://discordapp.com/developers/docs/resources/channel#embed-object) for more details) + * @property {boolean} [disableEveryone=this.client.options.disableEveryone] Whether or not @everyone and @here + * should be replaced with plain-text + * @property {FileOptions|BufferResolvable|Attachment} [file] A file to send with the message **(deprecated)** + * @property {FileOptions[]|BufferResolvable[]|Attachment[]} [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. + */ + + /** + * Send a message with this webhook. + * @param {StringResolvable} content The content to send + * @param {WebhookMessageOptions|Attachment|RichEmbed} [options] The options to provide + * can also be just a RichEmbed or Attachment + * @returns {Promise} + * @example + * // Send a message + * webhook.send('hello!') + * .then(message => console.log(`Sent message: ${message.content}`)) + * .catch(console.error); + */ + send(content, options) { // eslint-disable-line complexity + if (!options && typeof content === 'object' && !(content instanceof Array)) { + options = content; + content = ''; + } else if (!options) { + options = {}; + } + + if (options instanceof Attachment) options = { files: [options] }; + if (options instanceof RichEmbed) options = { embeds: [options] }; + + if (content) { + content = this.client.resolver.resolveString(content); + let { split, code, disableEveryone } = options; + if (split && typeof split !== 'object') split = {}; + if (typeof code !== 'undefined' && (typeof code !== 'boolean' || code === true)) { + content = Util.escapeMarkdown(content, true); + content = `\`\`\`${typeof code !== 'boolean' ? code || '' : ''}\n${content}\n\`\`\``; + if (split) { + split.prepend = `\`\`\`${typeof code !== 'boolean' ? code || '' : ''}\n`; + split.append = '\n```'; + } + } + if (disableEveryone || (typeof disableEveryone === 'undefined' && this.client.options.disableEveryone)) { + content = content.replace(/@(everyone|here)/g, '@\u200b$1'); + } + + if (split) content = Util.splitMessage(content, split); + } + + if (options.file) { + if (options.files) options.files.push(options.file); + else options.files = [options.file]; + } + + if (options.embeds) { + const files = []; + for (const embed of options.embeds) { + if (embed.file) files.push(embed.file); + } + if (options.files) options.files.push(...files); + else options.files = files; + } + + if (options.files) { + for (let i = 0; i < options.files.length; i++) { + let file = options.files[i]; + if (typeof file === 'string' || Buffer.isBuffer(file)) file = { attachment: file }; + if (!file.name) { + if (typeof file.attachment === 'string') { + file.name = path.basename(file.attachment); + } else if (file.attachment && file.attachment.path) { + file.name = path.basename(file.attachment.path); + } else if (file instanceof Attachment) { + file = { attachment: file.file, name: path.basename(file.file) || 'file.jpg' }; + } else { + file.name = 'file.jpg'; + } + } else if (file instanceof Attachment) { + file = file.file; + } + options.files[i] = file; + } + + return Promise.all(options.files.map(file => + this.client.resolver.resolveFile(file.attachment).then(resource => { + file.file = resource; + return file; + }) + )).then(files => this.client.rest.methods.sendWebhookMessage(this, content, options, files)); + } + + 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} + * @deprecated + * @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} + * @deprecated + */ + 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} + * @deprecated + */ + 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.resolveImage(avatar).then(data => + this.client.rest.methods.editWebhook(this, name, data) + ); + } + return this.client.rest.methods.editWebhook(this, name); + } + + /** + * Delete the webhook. + * @param {string} [reason] Reason for deleting the webhook + * @returns {Promise} + */ + delete(reason) { + return this.client.rest.methods.deleteWebhook(this, reason); + } +} + +module.exports = Webhook; + +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5).Buffer)) + /***/ }), /* 42 */ +/***/ (function(module, exports, __webpack_require__) { + +const Snowflake = __webpack_require__(8); + +/** + * Represents an OAuth2 Application. + */ +class OAuth2Application { + constructor(client, data) { + /** + * The client that instantiated the application + * @name OAuth2Application#client + * @type {Client} + * @readonly + */ + Object.defineProperty(this, 'client', { value: client }); + + this.setup(data); + } + + setup(data) { + /** + * The ID of the app + * @type {Snowflake} + */ + this.id = data.id; + + /** + * The name of the app + * @type {string} + */ + this.name = data.name; + + /** + * The app's description + * @type {string} + */ + this.description = data.description; + + /** + * The app's icon hash + * @type {?string} + */ + this.icon = data.icon; + + /** + * The app's icon URL + * @type {string} + */ + this.iconURL = `https://cdn.discordapp.com/app-icons/${this.id}/${this.icon}.jpg`; + + /** + * The app's RPC origins + * @type {?string[]} + */ + this.rpcOrigins = data.rpc_origins; + + /** + * The app's redirect URIs + * @type {string[]} + */ + this.redirectURIs = data.redirect_uris; + + /** + * If this app's bot requires a code grant when using the OAuth2 flow + * @type {boolean} + */ + this.botRequireCodeGrant = data.bot_require_code_grant; + + /** + * If this app's bot is public + * @type {boolean} + */ + this.botPublic = data.bot_public; + + /** + * If this app can use rpc + * @type {boolean} + */ + this.rpcApplicationState = data.rpc_application_state; + + /** + * Object containing basic info about this app's bot + * @type {Object} + */ + this.bot = data.bot; + + /** + * The flags for the app + * @type {number} + */ + this.flags = data.flags; + + /** + * OAuth2 secret for the application + * @type {boolean} + */ + this.secret = data.secret; + + if (data.owner) { + /** + * The owner of this OAuth application + * @type {?User} + */ + this.owner = this.client.dataManager.newUser(data.owner); + } + } + + /** + * The timestamp the app was created at + * @type {number} + * @readonly + */ + get createdTimestamp() { + return Snowflake.deconstruct(this.id).timestamp; + } + + /** + * The time the app was created + * @type {Date} + * @readonly + */ + get createdAt() { + return new Date(this.createdTimestamp); + } + + /** + * Reset the app's secret and bot token. + * This is only available when using a user account. + * @returns {OAuth2Application} + */ + reset() { + return this.client.rest.methods.resetApplication(this.id); + } + + /** + * When concatenated with a string, this automatically concatenates the app name rather than the app object. + * @returns {string} + */ + toString() { + return this.name; + } +} + +module.exports = OAuth2Application; + + +/***/ }), +/* 43 */ +/***/ (function(module, exports, __webpack_require__) { + +const Channel = __webpack_require__(17); +const TextBasedChannel = __webpack_require__(21); +const Collection = __webpack_require__(3); +const Constants = __webpack_require__(0); + +/* +{ 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 this 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; + + if (data.nicks) { + /** + * Nicknames for group members + * @type {?Collection} + */ + 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); + } + + /** + * The URL to this guild's icon + * @type {?string} + * @readonly + */ + get iconURL() { + if (!this.icon) return null; + return Constants.Endpoints.Channel(this).Icon(this.client.options.http.cdn, this.icon); + } + + edit(data) { + const _data = {}; + if (data.name) _data.name = data.name; + if (typeof data.icon !== 'undefined') _data.icon = data.icon; + return this.client.rest.methods.updateGroupDMChannel(this, _data); + } + + /** + * 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) + * @returns {Promise} + */ + + addUser(accessTokenOrID, nick) { + return this.client.rest.methods.addUserToGroupDM(this, { + nick, + id: this.client.resolver.resolveUserID(accessTokenOrID), + accessToken: accessTokenOrID, + }); + } + + /** + * Set a new GroupDMChannel icon. + * @param {Base64Resolvable|BufferResolvable} icon The new icon of the group dm + * @returns {Promise} + * @example + * // Edit the group dm icon + * channel.setIcon('./icon.png') + * .then(updated => console.log('Updated the channel icon')) + * .catch(console.error); + */ + setIcon(icon) { + return this.client.resolver.resolveImage(icon).then(data => this.edit({ icon: data })); + } + + /** + * Sets a new name for this Group DM. + * @param {string} name New name for this Group DM + * @returns {Promise} + */ + setName(name) { + return this.edit({ name }); + } + + /** + * Removes an user from this Group DM. + * @param {UserResolvable} user User to remove + * @returns {Promise} + */ + removeUser(user) { + const id = this.client.resolver.resolveUserID(user); + return this.client.rest.methods.removeUserFromGroupDM(this, id); + } + + /** + * 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() {} + createMessageCollector() {} + awaitMessages() {} + // Doesn't work on Group DMs; bulkDelete() {} + acknowledge() {} + _cacheMessage() {} +} + +TextBasedChannel.applyToClass(GroupDMChannel, true, ['bulkDelete']); + +module.exports = GroupDMChannel; + + +/***/ }), +/* 44 */ +/***/ (function(module, exports) { + +/** + * Represents an error from the Discord API. + * @extends Error + */ +class DiscordAPIError extends Error { + constructor(path, error) { + super(); + const flattened = this.constructor.flattenErrors(error.errors || error).join('\n'); + this.name = 'DiscordAPIError'; + this.message = error.message && flattened ? `${error.message}\n${flattened}` : error.message || flattened; + + /** + * The path of the request relative to the HTTP endpoint + * @type {string} + */ + this.path = path; + + /** + * HTTP error code returned by Discord + * @type {number} + */ + this.code = error.code; + } + + /** + * Flattens an errors object returned from the API into an array. + * @param {Object} obj Discord errors object + * @param {string} [key] Used internally to determine key names of nested fields + * @returns {string[]} + * @private + */ + static flattenErrors(obj, key = '') { + let messages = []; + + for (const k of Object.keys(obj)) { + if (k === 'message') continue; + const newKey = key ? isNaN(k) ? `${key}.${k}` : `${key}[${k}]` : k; + + if (obj[k]._errors) { + messages.push(`${newKey}: ${obj[k]._errors.map(e => e.message).join(' ')}`); + } else if (obj[k].code || obj[k].message) { + messages.push(`${obj[k].code ? `${obj[k].code}: ` : ''}: ${obj[k].message}`.trim()); + } else if (typeof obj[k] === 'string') { + messages.push(obj[k]); + } else { + messages = messages.concat(this.flattenErrors(obj[k], newKey)); + } + } + + return messages; + } +} + +module.exports = DiscordAPIError; + + +/***/ }), +/* 45 */ /***/ (function(module, exports) { var toString = {}.toString; @@ -12581,7 +13600,7 @@ module.exports = Array.isArray || function (arr) { /***/ }), -/* 43 */ +/* 46 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -12610,13 +13629,13 @@ module.exports = Array.isArray || function (arr) { /**/ -var processNextTick = __webpack_require__(25); +var processNextTick = __webpack_require__(26); /**/ module.exports = Readable; /**/ -var isArray = __webpack_require__(42); +var isArray = __webpack_require__(45); /**/ /**/ @@ -12634,13 +13653,13 @@ var EElistenerCount = function (emitter, type) { /**/ /**/ -var Stream = __webpack_require__(44); +var Stream = __webpack_require__(47); /**/ // TODO(bmeurer): Change this back to const once hole checks are // properly optimized away early in Ignition+TurboFan. /**/ -var Buffer = __webpack_require__(32).Buffer; +var Buffer = __webpack_require__(33).Buffer; var OurUint8Array = global.Uint8Array || function () {}; function _uint8ArrayToBuffer(chunk) { return Buffer.from(chunk); @@ -12651,12 +13670,12 @@ function _isUint8Array(obj) { /**/ /**/ -var util = __webpack_require__(18); +var util = __webpack_require__(19); util.inherits = __webpack_require__(10); /**/ /**/ -var debugUtil = __webpack_require__(77); +var debugUtil = __webpack_require__(80); var debug = void 0; if (debugUtil && debugUtil.debuglog) { debug = debugUtil.debuglog('stream'); @@ -12665,8 +13684,8 @@ if (debugUtil && debugUtil.debuglog) { } /**/ -var BufferList = __webpack_require__(78); -var destroyImpl = __webpack_require__(45); +var BufferList = __webpack_require__(81); +var destroyImpl = __webpack_require__(48); var StringDecoder; util.inherits(Readable, Stream); @@ -12749,7 +13768,7 @@ function ReadableState(options, stream) { this.decoder = null; this.encoding = null; if (options.encoding) { - if (!StringDecoder) StringDecoder = __webpack_require__(46).StringDecoder; + if (!StringDecoder) StringDecoder = __webpack_require__(49).StringDecoder; this.decoder = new StringDecoder(options.encoding); this.encoding = options.encoding; } @@ -12905,7 +13924,7 @@ Readable.prototype.isPaused = function () { // backwards compatibility. Readable.prototype.setEncoding = function (enc) { - if (!StringDecoder) StringDecoder = __webpack_require__(46).StringDecoder; + if (!StringDecoder) StringDecoder = __webpack_require__(49).StringDecoder; this._readableState.decoder = new StringDecoder(enc); this._readableState.encoding = enc; return this; @@ -13595,14 +14614,14 @@ function indexOf(xs, x) { /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6), __webpack_require__(7))) /***/ }), -/* 44 */ +/* 47 */ /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(9).EventEmitter; /***/ }), -/* 45 */ +/* 48 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -13610,7 +14629,7 @@ module.exports = __webpack_require__(9).EventEmitter; /**/ -var processNextTick = __webpack_require__(25); +var processNextTick = __webpack_require__(26); /**/ // undocumented cb() API, needed for core, not for public API @@ -13680,7 +14699,7 @@ module.exports = { }; /***/ }), -/* 46 */ +/* 49 */ /***/ (function(module, exports, __webpack_require__) { // Copyright Joyent, Inc. and other Node contributors. @@ -13907,7 +14926,7 @@ function base64DetectIncompleteChar(buffer) { /***/ }), -/* 47 */ +/* 50 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -13981,7 +15000,7 @@ module.exports = Transform; var Duplex = __webpack_require__(12); /**/ -var util = __webpack_require__(18); +var util = __webpack_require__(19); util.inherits = __webpack_require__(10); /**/ @@ -14127,92 +15146,7 @@ function done(stream, er, data) { } /***/ }), -/* 48 */ -/***/ (function(module, exports, __webpack_require__) { - -/* WEBPACK VAR INJECTION */(function(global) {var ClientRequest = __webpack_require__(89) -var extend = __webpack_require__(92) -var statusCodes = __webpack_require__(93) -var url = __webpack_require__(50) - -var http = exports - -http.request = function (opts, cb) { - if (typeof opts === 'string') - opts = url.parse(opts) - else - opts = extend(opts) - - // Normally, the page is loaded from http or https, so not specifying a protocol - // will result in a (valid) protocol-relative url. However, this won't work if - // the protocol is something else, like 'file:' - var defaultProtocol = global.location.protocol.search(/^https?:$/) === -1 ? 'http:' : '' - - var protocol = opts.protocol || defaultProtocol - var host = opts.hostname || opts.host - var port = opts.port - var path = opts.path || '/' - - // Necessary for IPv6 addresses - if (host && host.indexOf(':') !== -1) - host = '[' + host + ']' - - // This may be a relative url. The browser should always be able to interpret it correctly. - opts.url = (host ? (protocol + '//' + host) : '') + (port ? ':' + port : '') + path - opts.method = (opts.method || 'GET').toUpperCase() - opts.headers = opts.headers || {} - - // Also valid opts.auth, opts.mode - - var req = new ClientRequest(opts) - if (cb) - req.on('response', cb) - return req -} - -http.get = function get (opts, cb) { - var req = http.request(opts, cb) - req.end() - return req -} - -http.Agent = function () {} -http.Agent.defaultMaxSockets = 4 - -http.STATUS_CODES = statusCodes - -http.METHODS = [ - 'CHECKOUT', - 'CONNECT', - 'COPY', - 'DELETE', - 'GET', - 'HEAD', - 'LOCK', - 'M-SEARCH', - 'MERGE', - 'MKACTIVITY', - 'MKCOL', - 'MOVE', - 'NOTIFY', - 'OPTIONS', - 'PATCH', - 'POST', - 'PROPFIND', - 'PROPPATCH', - 'PURGE', - 'PUT', - 'REPORT', - 'SEARCH', - 'SUBSCRIBE', - 'TRACE', - 'UNLOCK', - 'UNSUBSCRIBE' -] -/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) - -/***/ }), -/* 49 */ +/* 51 */ /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(global) {exports.fetch = isFunction(global.fetch) && isFunction(global.ReadableStream) @@ -14288,7 +15222,7 @@ xhr = null // Help gc /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) /***/ }), -/* 50 */ +/* 52 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -14315,8 +15249,8 @@ xhr = null // Help gc -var punycode = __webpack_require__(94); -var util = __webpack_require__(96); +var punycode = __webpack_require__(97); +var util = __webpack_require__(99); exports.parse = urlParse; exports.resolve = urlResolve; @@ -14391,7 +15325,7 @@ var protocolPattern = /^([a-z0-9.+-]+:)/i, 'gopher:': true, 'file:': true }, - querystring = __webpack_require__(34); + querystring = __webpack_require__(35); function urlParse(url, parseQueryString, slashesDenoteHost) { if (url && util.isObject(url) && url instanceof Url) return url; @@ -15027,11 +15961,11 @@ Url.prototype.parseHost = function() { /***/ }), -/* 51 */ +/* 53 */ /***/ (function(module, exports, __webpack_require__) { -const mimes = __webpack_require__(100); -const mimeOfBuffer = __webpack_require__(101); +const mimes = __webpack_require__(103); +const mimeOfBuffer = __webpack_require__(104); function lookupMime(ext) { return mimes[ext.replace(/^\./, '')] || mimes.bin; @@ -15049,20 +15983,49 @@ module.exports = { /***/ }), -/* 52 */ -/***/ (function(module, exports) { - -module.exports = {"name":"discord.js","version":"11.1.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":{"long":"^3.2.0","prism-media":"^0.0.1","snekfetch":"^3.0.0","tweetnacl":"^0.14.0","ws":"^2.0.0"},"peerDependencies":{"bufferutil":"^3.0.0","erlpack":"hammerandchisel/erlpack","node-opus":"^0.2.0","opusscript":"^0.0.3","sodium":"^2.0.1","libsodium-wrappers":"^0.5.0","uws":"^0.14.0"},"devDependencies":{"@types/node":"^7.0.0","discord.js-docgen":"hydrabolt/discord.js-docgen","eslint":"^3.19.0","parallel-webpack":"^2.0.0","uglifyjs-webpack-plugin":"^1.0.0-beta.1","webpack":"^3.0.0"},"engines":{"node":">=6.0.0"},"browser":{"ws":false,"uws":false,"erlpack":false,"prism-media":false,"opusscript":false,"node-opus":false,"tweetnacl":false,"sodium":false,"src/sharding/Shard.js":false,"src/sharding/ShardClientUtil.js":false,"src/sharding/ShardingManager.js":false,"src/client/voice/dispatcher/StreamDispatcher.js":false,"src/client/voice/opus/BaseOpusEngine.js":false,"src/client/voice/opus/NodeOpusEngine.js":false,"src/client/voice/opus/OpusEngineList.js":false,"src/client/voice/opus/OpusScriptEngine.js":false,"src/client/voice/pcm/ConverterEngine.js":false,"src/client/voice/pcm/ConverterEngineList.js":false,"src/client/voice/pcm/FfmpegConverterEngine.js":false,"src/client/voice/player/AudioPlayer.js":false,"src/client/voice/receiver/VoiceReadable.js":false,"src/client/voice/receiver/VoiceReceiver.js":false,"src/client/voice/util/Secretbox.js":false,"src/client/voice/util/SecretKey.js":false,"src/client/voice/util/VolumeInterface.js":false,"src/client/voice/ClientVoiceManager.js":false,"src/client/voice/VoiceBroadcast.js":false,"src/client/voice/VoiceConnection.js":false,"src/client/voice/VoiceUDPClient.js":false,"src/client/voice/VoiceWebSocket.js":false}} - -/***/ }), -/* 53 */ +/* 54 */ /***/ (function(module, exports, __webpack_require__) { -const UserAgentManager = __webpack_require__(106); -const RESTMethods = __webpack_require__(107); -const SequentialRequestHandler = __webpack_require__(111); -const BurstRequestHandler = __webpack_require__(112); -const APIRequest = __webpack_require__(113); +const Stream = __webpack_require__(25); + +class ResponseStream extends Stream.Readable { + constructor() { + super(); + this.statusCode = 200; + this.status = 'OK'; + } + + error(code, message) { + this.statusCode = code; + this.status = message; + return this; + } + + on(event, handler) { + if (['end', 'open'].includes(event)) handler(); + } + + _read() {} // eslint-disable-line no-empty-function +} + +module.exports = ResponseStream; + + +/***/ }), +/* 55 */ +/***/ (function(module, exports) { + +module.exports = {"name":"discord.js","version":"11.2.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":{"long":"^3.2.0","prism-media":"^0.0.1","snekfetch":"^3.3.0","tweetnacl":"^1.0.0","ws":"^3.1.0"},"peerDependencies":{"bufferutil":"^3.0.2","erlpack":"hammerandchisel/erlpack","node-opus":"^0.2.6","opusscript":"^0.0.3","sodium":"^2.0.1","libsodium-wrappers":"^0.5.4","uws":"^0.14.5"},"devDependencies":{"@types/node":"^7.0.43","discord.js-docgen":"hydrabolt/discord.js-docgen","eslint":"^4.6.0","parallel-webpack":"^2.1.0","uglifyjs-webpack-plugin":"^1.0.0-beta.1","webpack":"^3.5.5"},"engines":{"node":">=6.0.0"},"browser":{"ws":false,"uws":false,"erlpack":false,"prism-media":false,"opusscript":false,"node-opus":false,"tweetnacl":false,"sodium":false,"src/sharding/Shard.js":false,"src/sharding/ShardClientUtil.js":false,"src/sharding/ShardingManager.js":false,"src/client/voice/dispatcher/StreamDispatcher.js":false,"src/client/voice/opus/BaseOpusEngine.js":false,"src/client/voice/opus/NodeOpusEngine.js":false,"src/client/voice/opus/OpusEngineList.js":false,"src/client/voice/opus/OpusScriptEngine.js":false,"src/client/voice/pcm/ConverterEngine.js":false,"src/client/voice/pcm/ConverterEngineList.js":false,"src/client/voice/pcm/FfmpegConverterEngine.js":false,"src/client/voice/player/AudioPlayer.js":false,"src/client/voice/receiver/VoiceReadable.js":false,"src/client/voice/receiver/VoiceReceiver.js":false,"src/client/voice/util/Secretbox.js":false,"src/client/voice/util/SecretKey.js":false,"src/client/voice/util/VolumeInterface.js":false,"src/client/voice/ClientVoiceManager.js":false,"src/client/voice/VoiceBroadcast.js":false,"src/client/voice/VoiceConnection.js":false,"src/client/voice/VoiceUDPClient.js":false,"src/client/voice/VoiceWebSocket.js":false}} + +/***/ }), +/* 56 */ +/***/ (function(module, exports, __webpack_require__) { + +const UserAgentManager = __webpack_require__(111); +const RESTMethods = __webpack_require__(112); +const SequentialRequestHandler = __webpack_require__(116); +const BurstRequestHandler = __webpack_require__(117); +const APIRequest = __webpack_require__(118); const Constants = __webpack_require__(0); class RESTManager { @@ -15102,8 +16065,8 @@ class RESTManager { } } - makeRequest(method, url, auth, data, file) { - const apiRequest = new APIRequest(this, method, url, auth, data, file); + makeRequest(method, url, auth, data, file, reason) { + const apiRequest = new APIRequest(this, method, url, auth, data, file, reason); if (!this.handlers[apiRequest.route]) { const RequestHandlerType = this.getRequestHandler(); this.handlers[apiRequest.route] = new RequestHandlerType(this, apiRequest.route); @@ -15117,7 +16080,7 @@ module.exports = RESTManager; /***/ }), -/* 54 */ +/* 57 */ /***/ (function(module, exports, __webpack_require__) { const Collection = __webpack_require__(3); @@ -15224,7 +16187,7 @@ class MessageMentions { /** * Any channels that were mentioned - * @type {?Collection} + * @type {Collection} * @readonly */ get channels() { @@ -15246,7 +16209,7 @@ class MessageMentions { MessageMentions.EVERYONE_PATTERN = /@(everyone|here)/g; /** - * Regular expression that globally matches user mentions like `<#81440962496172032>` + * Regular expression that globally matches user mentions like `<@81440962496172032>` * @type {RegExp} */ MessageMentions.USERS_PATTERN = /<@!?[0-9]+>/g; @@ -15267,7 +16230,7 @@ module.exports = MessageMentions; /***/ }), -/* 55 */ +/* 58 */ /***/ (function(module, exports) { /** @@ -15341,7 +16304,7 @@ module.exports = MessageAttachment; /***/ }), -/* 56 */ +/* 59 */ /***/ (function(module, exports) { /** @@ -15732,12 +16695,12 @@ module.exports = MessageEmbed; /***/ }), -/* 57 */ +/* 60 */ /***/ (function(module, exports, __webpack_require__) { const Collection = __webpack_require__(3); const Emoji = __webpack_require__(23); -const ReactionEmoji = __webpack_require__(36); +const ReactionEmoji = __webpack_require__(39); /** * Represents a reaction to a message. @@ -15831,10 +16794,10 @@ module.exports = MessageReaction; /***/ }), -/* 58 */ +/* 61 */ /***/ (function(module, exports, __webpack_require__) { -const Collector = __webpack_require__(37); +const Collector = __webpack_require__(40); const Collection = __webpack_require__(3); /** @@ -15849,7 +16812,6 @@ const Collection = __webpack_require__(3); * @extends {Collector} */ class ReactionCollector extends Collector { - /** * @param {Message} message The message upon which to collect reactions * @param {CollectorFilter} filter The filter to apply to this collector @@ -15882,7 +16844,7 @@ class ReactionCollector extends Collector { /** * Handle an incoming reaction for possible collection. * @param {MessageReaction} reaction The reaction to possibly collect - * @returns {?{key: Snowflake, value: MessageReaction}} Reaction data to collect + * @returns {?{key: Snowflake, value: MessageReaction}} * @private */ handle(reaction) { @@ -15921,11 +16883,11 @@ module.exports = ReactionCollector; /***/ }), -/* 59 */ +/* 62 */ /***/ (function(module, exports, __webpack_require__) { -const Collector = __webpack_require__(37); -const util = __webpack_require__(20); +const Collector = __webpack_require__(40); +const util = __webpack_require__(13); /** * @typedef {CollectorOptions} MessageCollectorOptions @@ -15938,7 +16900,6 @@ const util = __webpack_require__(20); * @extends {Collector} */ class MessageCollector extends Collector { - /** * @param {TextChannel|DMChannel|GroupDMChannel} channel The channel * @param {CollectorFilter} filter The filter to be applied to this collector @@ -15949,7 +16910,8 @@ class MessageCollector extends Collector { super(channel.client, filter, options); /** - * @type {TextBasedChannel} channel The channel + * The channel + * @type {TextBasedChannel} */ this.channel = channel; @@ -15987,7 +16949,7 @@ class MessageCollector extends Collector { /** * Handle an incoming message for possible collection. * @param {Message} message The message that could be collected - * @returns {?{key: Snowflake, value: Message}} Message data to collect + * @returns {?{key: Snowflake, value: Message}} * @private */ handle(message) { @@ -16025,34 +16987,13 @@ module.exports = MessageCollector; /***/ }), -/* 60 */ +/* 63 */ /***/ (function(module, exports, __webpack_require__) { -const PartialGuild = __webpack_require__(61); -const PartialGuildChannel = __webpack_require__(62); +const PartialGuild = __webpack_require__(64); +const PartialGuildChannel = __webpack_require__(65); const Constants = __webpack_require__(0); -/* -{ max_age: 86400, - code: 'CG9A5', - guild: - { splash: null, - id: '123123123', - icon: '123123123', - name: 'name' }, - created_at: '2016-08-28T19:07:04.763368+00:00', - temporary: false, - uses: 0, - max_uses: 0, - inviter: - { username: '123', - discriminator: '4204', - bot: true, - id: '123123123', - avatar: '123123123' }, - channel: { type: 0, id: '123123', name: 'heavy-testing' } } -*/ - /** * Represents an invitation to a guild channel. * The only guaranteed properties are `code`, `guild` and `channel`. Other properties can be missing. @@ -16084,6 +17025,30 @@ class Invite { */ this.code = data.code; + /** + * The approximate number of online members of the guild this invite is for + * @type {number} + */ + this.presenceCount = data.approximate_presence_count; + + /** + * The approximate total number of members of the guild this invite is for + * @type {number} + */ + this.memberCount = data.approximate_member_count; + + /** + * The number of text channels the guild this invite goes to has + * @type {number} + */ + this.textChannelCount = data.guild.text_channel_count; + + /** + * The number of voice channels the guild this invite goes to has + * @type {number} + */ + this.voiceChannelCount = data.guild.voice_channel_count; + /** * Whether or not this invite is temporary * @type {boolean} @@ -16168,10 +17133,11 @@ class Invite { /** * Deletes this invite. + * @param {string} [reason] Reason for deleting this invite * @returns {Promise} */ - delete() { - return this.client.rest.methods.deleteInvite(this); + delete(reason) { + return this.client.rest.methods.deleteInvite(this, reason); } /** @@ -16190,7 +17156,7 @@ module.exports = Invite; /***/ }), -/* 61 */ +/* 64 */ /***/ (function(module, exports) { /* @@ -16247,7 +17213,7 @@ module.exports = PartialGuild; /***/ }), -/* 62 */ +/* 65 */ /***/ (function(module, exports, __webpack_require__) { const Constants = __webpack_require__(0); @@ -16297,13 +17263,14 @@ module.exports = PartialGuildChannel; /***/ }), -/* 63 */ +/* 66 */ /***/ (function(module, exports, __webpack_require__) { const Collection = __webpack_require__(3); const Snowflake = __webpack_require__(8); const Targets = { + ALL: 'ALL', GUILD: 'GUILD', CHANNEL: 'CHANNEL', USER: 'USER', @@ -16311,9 +17278,11 @@ const Targets = { INVITE: 'INVITE', WEBHOOK: 'WEBHOOK', EMOJI: 'EMOJI', + MESSAGE: 'MESSAGE', }; const Actions = { + ALL: null, GUILD_UPDATE: 1, CHANNEL_CREATE: 10, CHANNEL_UPDATE: 11, @@ -16339,6 +17308,7 @@ const Actions = { EMOJI_CREATE: 60, EMOJI_UPDATE: 61, EMOJI_DELETE: 62, + MESSAGE_DELETE: 72, }; @@ -16362,13 +17332,11 @@ class GuildAuditLogs { /** * Handles possible promises for entry targets. - * @returns {GuildAuditLogs} + * @returns {Promise} */ static build(...args) { - return new Promise(resolve => { - const logs = new GuildAuditLogs(...args); - Promise.all(logs.entries.map(e => e.target)).then(() => resolve(logs)); - }); + const logs = new GuildAuditLogs(...args); + return Promise.all(logs.entries.map(e => e.target)).then(() => logs); } /** @@ -16384,6 +17352,7 @@ class GuildAuditLogs { if (target < 50) return Targets.INVITE; if (target < 60) return Targets.WEBHOOK; if (target < 70) return Targets.EMOJI; + if (target < 80) return Targets.MESSAGE; return null; } @@ -16414,6 +17383,7 @@ class GuildAuditLogs { Actions.INVITE_DELETE, Actions.WEBHOOK_DELETE, Actions.EMOJI_DELETE, + Actions.MESSAGE_DELETE, ].includes(action)) return 'DELETE'; if ([ @@ -16421,6 +17391,7 @@ class GuildAuditLogs { Actions.CHANNEL_UPDATE, Actions.CHANNEL_OVERWRITE_UPDATE, Actions.MEMBER_UPDATE, + Actions.MEMBER_ROLE_UPDATE, Actions.ROLE_UPDATE, Actions.INVITE_UPDATE, Actions.WEBHOOK_UPDATE, @@ -16468,10 +17439,18 @@ class GuildAuditLogsEntry { this.executor = guild.client.users.get(data.user_id); /** - * Specific property changes - * @type {Object[]} + * An entry in the audit log representing a specific change. + * @typedef {object} AuditLogChange + * @property {string} key The property that was changed, e.g. `nick` for nickname changes + * @property {*} [old] The old value of the change, e.g. for nicknames, the old nickname + * @property {*} [new] The new value of the change, e.g. for nicknames, the new nickname */ - this.changes = data.changes ? data.changes.map(c => ({ name: c.key, old: c.old_value, new: c.new_value })) : null; + + /** + * Specific property changes + * @type {AuditLogChange[]} + */ + this.changes = data.changes ? data.changes.map(c => ({ key: c.key, old: c.old_value, new: c.new_value })) : null; /** * The ID of this entry @@ -16490,15 +17469,20 @@ class GuildAuditLogsEntry { removed: data.options.members_removed, days: data.options.delete_member_days, }; + } else if (data.action_type === Actions.MESSAGE_DELETE) { + this.extra = { + count: data.options.count, + channel: guild.channels.get(data.options.channel_id), + }; } else { switch (data.options.type) { case 'member': - this.extra = guild.members.get(this.options.id); - if (!this.extra) this.extra = { id: this.options.id }; + this.extra = guild.members.get(data.options.id); + if (!this.extra) this.extra = { id: data.options.id }; break; case 'role': - this.extra = guild.roles.get(this.options.id); - if (!this.extra) this.extra = { id: this.options.id, name: this.options.role_name }; + this.extra = guild.roles.get(data.options.id); + if (!this.extra) this.extra = { id: data.options.id, name: data.options.role_name }; break; default: break; @@ -16519,12 +17503,14 @@ class GuildAuditLogsEntry { return this.target; }); } else if (targetType === Targets.INVITE) { - const change = this.changes.find(c => c.name === 'code'); + const change = this.changes.find(c => c.key === 'code'); this.target = guild.fetchInvites() .then(invites => { - this.target = invites.find(i => i.code === (change.new || change.old)); + this.target = invites.find(i => i.code === (change.new_value || change.old_value)); return this.target; }); + } else if (targetType === Targets.MESSAGE) { + this.target = guild.client.users.get(data.target_id); } else { this.target = guild[`${targetType.toLowerCase()}s`].get(data.target_id); } @@ -16557,7 +17543,7 @@ module.exports = GuildAuditLogs; /***/ }), -/* 64 */ +/* 67 */ /***/ (function(module, exports) { /** @@ -16617,55 +17603,10 @@ module.exports = RequestHandler; /***/ }), -/* 65 */ -/***/ (function(module, exports) { - -/** - * Represents an error from the Discord API. - */ -class DiscordAPIError extends Error { - constructor(error) { - super(); - const flattened = error.errors ? `\n${this.constructor.flattenErrors(error.errors).join('\n')}` : ''; - this.name = 'DiscordAPIError'; - this.message = `${error.message}${flattened}`; - - /** - * HTTP error code returned by Discord - * @type {number} - */ - this.code = error.code; - } - - /** - * Flattens an errors object returned from the API into an array. - * @param {Object} obj Discord errors object - * @param {string} [key] idklol - * @returns {string[]} - */ - static flattenErrors(obj, key = '') { - let messages = []; - for (const k of Object.keys(obj)) { - const newKey = key ? isNaN(k) ? `${key}.${k}` : `${key}[${k}]` : k; - if (obj[k]._errors) { - messages.push(`${newKey}: ${obj[k]._errors.map(e => e.message).join(' ')}`); - } else { - messages = messages.concat(this.flattenErrors(obj[k], newKey)); - } - } - - return messages; - } -} - -module.exports = DiscordAPIError; - - -/***/ }), -/* 66 */ +/* 68 */ /***/ (function(module, exports, __webpack_require__) { -const Channel = __webpack_require__(16); +const Channel = __webpack_require__(17); const TextBasedChannel = __webpack_require__(21); const Collection = __webpack_require__(3); @@ -16720,6 +17661,7 @@ class DMChannel extends Channel { get typing() {} get typingCount() {} createCollector() {} + createMessageCollector() {} awaitMessages() {} // Doesn't work on DM channels; bulkDelete() {} acknowledge() {} @@ -16732,10 +17674,10 @@ module.exports = DMChannel; /***/ }), -/* 67 */ +/* 69 */ /***/ (function(module, exports, __webpack_require__) { -const GuildChannel = __webpack_require__(29); +const GuildChannel = __webpack_require__(31); const TextBasedChannel = __webpack_require__(21); const Collection = __webpack_require__(3); @@ -16761,6 +17703,13 @@ class TextChannel extends GuildChannel { */ this.topic = data.topic; + /** + * If the Discord considers this channel NSFW + * @type {boolean} + * @readonly + */ + this.nsfw = Boolean(data.nsfw); + this.lastMessageID = data.last_message_id; } @@ -16779,15 +17728,6 @@ class TextChannel extends GuildChannel { return members; } - /** - * If the Discord considers this channel NSFW - * @type {boolean} - * @readonly - */ - get nsfw() { - return /^nsfw(-|$)/.test(this.name); - } - /** * Fetch all webhooks for the channel. * @returns {Promise>} @@ -16799,23 +17739,22 @@ class TextChannel extends GuildChannel { /** * Create a webhook for the channel. * @param {string} name The name of the webhook - * @param {BufferResolvable|Base64Resolvable} avatar The avatar for the webhook + * @param {BufferResolvable|Base64Resolvable} [avatar] The avatar for the webhook + * @param {string} [reason] Reason for creating this webhook * @returns {Promise} webhook The created webhook * @example - * channel.createWebhook('Snek', 'http://snek.s3.amazonaws.com/topSnek.png') - * .then(webhook => console.log(`Created webhook ${webhook}`)) - * .catch(console.error) + * channel.createWebhook('Snek', 'https://i.imgur.com/mI8XcpG.jpg') + * .then(webhook => console.log(`Created webhook ${webhook}`)) + * .catch(console.error) */ - createWebhook(name, avatar) { - return new Promise(resolve => { - if (typeof avatar === 'string' && avatar.startsWith('data:')) { - resolve(this.client.rest.methods.createWebhook(this, name, avatar)); - } else { - this.client.resolver.resolveBuffer(avatar).then(data => - resolve(this.client.rest.methods.createWebhook(this, name, data)) - ); - } - }); + createWebhook(name, avatar, reason) { + if (typeof avatar === 'string' && avatar.startsWith('data:')) { + return this.client.rest.methods.createWebhook(this, name, avatar, reason); + } else { + return this.client.resolver.resolveImage(avatar).then(data => + this.client.rest.methods.createWebhook(this, name, data, reason) + ); + } } // These are here only for documentation purposes - they are implemented by TextBasedChannel @@ -16848,7 +17787,7 @@ module.exports = TextChannel; /***/ }), -/* 68 */ +/* 70 */ /***/ (function(module, exports) { /** @@ -16886,10 +17825,11 @@ class PermissionOverwrites { /** * Delete this Permission Overwrite. + * @param {string} [reason] Reason for deleting this overwrite * @returns {Promise} */ - delete() { - return this.channel.client.rest.methods.deletePermissionOverwrites(this); + delete(reason) { + return this.channel.client.rest.methods.deletePermissionOverwrites(this, reason); } } @@ -16897,10 +17837,10 @@ module.exports = PermissionOverwrites; /***/ }), -/* 69 */ +/* 71 */ /***/ (function(module, exports, __webpack_require__) { -const GuildChannel = __webpack_require__(29); +const GuildChannel = __webpack_require__(31); const Collection = __webpack_require__(3); /** @@ -16927,7 +17867,7 @@ class VoiceChannel extends GuildChannel { * The bitrate of this voice channel * @type {number} */ - this.bitrate = data.bitrate; + this.bitrate = data.bitrate * 0.001; /** * The maximum amount of users allowed in this channel - 0 means unlimited. @@ -16978,31 +17918,34 @@ class VoiceChannel extends GuildChannel { } /** - * Sets the bitrate of the channel. + * Sets the bitrate of the channel (in kbps). * @param {number} bitrate The new bitrate + * @param {string} [reason] Reason for changing the channel's bitrate * @returns {Promise} * @example * // Set the bitrate of a voice channel - * voiceChannel.setBitrate(48000) - * .then(vc => console.log(`Set bitrate to ${vc.bitrate} for ${vc.name}`)) - * .catch(console.error); + * voiceChannel.setBitrate(48) + * .then(vc => console.log(`Set bitrate to ${vc.bitrate}kbps for ${vc.name}`)) + * .catch(console.error); */ - setBitrate(bitrate) { - return this.edit({ bitrate }); + setBitrate(bitrate, reason) { + bitrate *= 1000; + return this.edit({ bitrate }, reason); } /** * Sets the user limit of the channel. * @param {number} userLimit The new user limit + * @param {string} [reason] Reason for changing the user limit * @returns {Promise} * @example * // Set the user limit of a voice channel * voiceChannel.setUserLimit(42) - * .then(vc => console.log(`Set user limit to ${vc.userLimit} for ${vc.name}`)) - * .catch(console.error); + * .then(vc => console.log(`Set user limit to ${vc.userLimit} for ${vc.name}`)) + * .catch(console.error); */ - setUserLimit(userLimit) { - return this.edit({ userLimit }); + setUserLimit(userLimit, reason) { + return this.edit({ userLimit }, reason); } /** @@ -17011,8 +17954,8 @@ class VoiceChannel extends GuildChannel { * @example * // Join a voice channel * voiceChannel.join() - * .then(connection => console.log('Connected!')) - * .catch(console.error); + * .then(connection => console.log('Connected!')) + * .catch(console.error); */ join() { if (this.client.browser) return Promise.reject(new Error('Voice connections are not available in browsers.')); @@ -17036,17 +17979,17 @@ module.exports = VoiceChannel; /***/ }), -/* 70 */ +/* 72 */ /***/ (function(module, exports, __webpack_require__) { -/* WEBPACK VAR INJECTION */(function(Buffer) {const browser = __webpack_require__(27).platform() === 'browser'; +/* WEBPACK VAR INJECTION */(function(Buffer) {const browser = typeof window !== 'undefined'; const EventEmitter = __webpack_require__(9); const Constants = __webpack_require__(0); -const zlib = __webpack_require__(26); -const PacketManager = __webpack_require__(116); +const zlib = __webpack_require__(27); +const PacketManager = __webpack_require__(121); const erlpack = (function findErlpack() { try { - const e = __webpack_require__(153); + const e = __webpack_require__(161); if (!e.pack) return null; return e; } catch (e) { @@ -17057,9 +18000,9 @@ const erlpack = (function findErlpack() { const WebSocket = (function findWebSocket() { if (browser) return window.WebSocket; // eslint-disable-line no-undef try { - return __webpack_require__(154); + return __webpack_require__(162); } catch (e) { - return __webpack_require__(155); + return __webpack_require__(163); } }()); @@ -17070,12 +18013,12 @@ const WebSocket = (function findWebSocket() { class WebSocketConnection extends EventEmitter { /** * @param {WebSocketManager} manager The WebSocket manager - * @param {string} gateway WebSocket gateway to connect to + * @param {string} gateway The WebSocket gateway to connect to */ constructor(manager, gateway) { super(); /** - * WebSocket Manager of this connection + * The WebSocket Manager of this connection * @type {WebSocketManager} */ this.manager = manager; @@ -17156,6 +18099,10 @@ class WebSocketConnection extends EventEmitter { this.debug('Tried to mark self as ready, but already ready'); return; } + /** + * Emitted when the client becomes ready to start working. + * @event Client#ready + */ this.status = Constants.Status.READY; this.client.emit(Constants.Events.READY); this.packetManager.handleQueue(); @@ -17269,7 +18216,7 @@ class WebSocketConnection extends EventEmitter { /** * Creates a connection to a gateway. - * @param {string} gateway Gateway to connect to + * @param {string} gateway The gateway to connect to * @param {number} [after=0] How long to wait before connecting * @param {boolean} [force=false] Whether or not to force a new connection even if one already exists * @returns {boolean} @@ -17321,12 +18268,13 @@ class WebSocketConnection extends EventEmitter { * @returns {boolean} */ onMessage(event) { + let data; try { - event.data = this.unpack(event.data); + data = this.unpack(event.data); } catch (err) { this.emit('debug', err); } - return this.onPacket(event.data); + return this.onPacket(data); } /** @@ -17392,11 +18340,19 @@ class WebSocketConnection extends EventEmitter { /** * Called whenever an error occurs with the WebSocket. - * @param {Error} error Error that occurred + * @param {Error} error The error that occurred */ onError(error) { + if (error && error.message === 'uWs client connection error') { + this.reconnect(); + return; + } + /** + * Emitted whenever the client's WebSocket encounters a connection error. + * @event Client#error + * @param {Error} error The encountered error + */ this.client.emit(Constants.Events.ERROR, error); - if (error.message === 'uWs client connection error') this.reconnect(); } /** @@ -17472,7 +18428,7 @@ class WebSocketConnection extends EventEmitter { * @returns {void} */ identify(after) { - if (after) return this.client.setTimeout(this.identify.apply(this), after); + if (after) return this.client.setTimeout(this.identify.bind(this), after); return this.sessionID ? this.identifyResume() : this.identifyNew(); } @@ -17533,12 +18489,13 @@ module.exports = WebSocketConnection; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5).Buffer)) /***/ }), -/* 71 */ +/* 73 */ /***/ (function(module, exports, __webpack_require__) { -const User = __webpack_require__(13); +const User = __webpack_require__(14); const Collection = __webpack_require__(3); -const ClientUserSettings = __webpack_require__(72); +const ClientUserSettings = __webpack_require__(74); +const ClientUserGuildSettings = __webpack_require__(123); const Constants = __webpack_require__(0); /** @@ -17610,7 +18567,19 @@ class ClientUser extends User { * This is only filled when using a user account. * @type {?ClientUserSettings} */ - if (data.user_settings) this.settings = new ClientUserSettings(this, data.user_settings); + this.settings = data.user_settings ? new ClientUserSettings(this, data.user_settings) : null; + + /** + * All of the user's guild settings + * This is only filled when using a user account + * @type {Collection} + */ + this.guildSettings = new Collection(); + if (data.user_guild_settings) { + for (const settings of data.user_guild_settings) { + this.guildSettings.set(settings.guild_id, new ClientUserGuildSettings(settings, this.client)); + } + } } edit(data) { @@ -17627,8 +18596,8 @@ class ClientUser extends User { * @example * // Set username * client.user.setUsername('discordjs') - * .then(user => console.log(`My new username is ${user.username}`)) - * .catch(console.error); + * .then(user => console.log(`My new username is ${user.username}`)) + * .catch(console.error); */ setUsername(username, password) { return this.client.rest.methods.updateCurrentUser({ username }, password); @@ -17643,8 +18612,8 @@ class ClientUser extends User { * @example * // Set email * client.user.setEmail('bob@gmail.com', 'some amazing password 123') - * .then(user => console.log(`My new email is ${user.email}`)) - * .catch(console.error); + * .then(user => console.log(`My new email is ${user.email}`)) + * .catch(console.error); */ setEmail(email, password) { return this.client.rest.methods.updateCurrentUser({ email }, password); @@ -17659,8 +18628,8 @@ class ClientUser extends User { * @example * // Set password * client.user.setPassword('some new amazing password 456', 'some amazing password 123') - * .then(user => console.log('New password set!')) - * .catch(console.error); + * .then(user => console.log('New password set!')) + * .catch(console.error); */ setPassword(newPassword, oldPassword) { return this.client.rest.methods.updateCurrentUser({ password: newPassword }, oldPassword); @@ -17673,17 +18642,13 @@ class ClientUser extends User { * @example * // Set avatar * client.user.setAvatar('./avatar.png') - * .then(user => console.log(`New avatar set!`)) - * .catch(console.error); + * .then(user => console.log(`New avatar set!`)) + * .catch(console.error); */ setAvatar(avatar) { - if (typeof avatar === 'string' && avatar.startsWith('data:')) { - return this.client.rest.methods.updateCurrentUser({ avatar }); - } else { - return this.client.resolver.resolveBuffer(avatar).then(data => - this.client.rest.methods.updateCurrentUser({ avatar: data }) - ); - } + return this.client.resolver.resolveImage(avatar).then(data => + this.client.rest.methods.updateCurrentUser({ avatar: data }) + ); } /** @@ -17728,7 +18693,7 @@ class ClientUser extends User { if (data.game) { game = data.game; - if (game.url) game.type = 1; + game.type = game.url ? 1 : 0; } else if (typeof data.game !== 'undefined') { game = null; } @@ -17753,10 +18718,10 @@ class ClientUser extends User { /** * A user's status. Must be one of: - * - `online` - * - `idle` - * - `invisible` - * - `dnd` (do not disturb) + * * `online` + * * `idle` + * * `invisible` + * * `dnd` (do not disturb) * @typedef {string} PresenceStatus */ @@ -17803,7 +18768,7 @@ class ClientUser extends User { * @param {Guild|Snowflake} [options.guild] Limit the search to a specific guild * @returns {Promise} */ - fetchMentions(options = { limit: 25, roles: true, everyone: true, guild: null }) { + fetchMentions(options = {}) { return this.client.rest.methods.fetchMentions(options); } @@ -17833,16 +18798,15 @@ class ClientUser extends User { * Creates a guild. * This is only available when using a user account. * @param {string} name The name of the guild - * @param {string} region The region for the server + * @param {string} [region] The region for the server * @param {BufferResolvable|Base64Resolvable} [icon=null] The icon for the guild * @returns {Promise} The guild that was created */ createGuild(name, region, icon = null) { - if (!icon) return this.client.rest.methods.createGuild({ name, icon, region }); if (typeof icon === 'string' && icon.startsWith('data:')) { return this.client.rest.methods.createGuild({ name, icon, region }); } else { - return this.client.resolver.resolveBuffer(icon).then(data => + return this.client.resolver.resolveImage(icon).then(data => this.client.rest.methods.createGuild({ name, icon: data, region }) ); } @@ -17886,7 +18850,7 @@ module.exports = ClientUser; /***/ }), -/* 72 */ +/* 74 */ /***/ (function(module, exports, __webpack_require__) { const Constants = __webpack_require__(0); @@ -17904,6 +18868,8 @@ class ClientUserSettings { /** * Patch the data contained in this class with new partial data. * @param {Object} data Data to patch this with + * @returns {void} + * @private */ patch(data) { for (const key of Object.keys(Constants.UserSettingsMap)) { @@ -17920,7 +18886,7 @@ class ClientUserSettings { /** * Update a specific property of of user settings. * @param {string} name Name of property - * @param {value} value Value to patch + * @param {*} value Value to patch * @returns {Promise} */ update(name, value) { @@ -17928,6 +18894,7 @@ class ClientUserSettings { } /** + * Sets the position at which this guild will appear in the Discord client. * @param {Guild} guild The guild to move * @param {number} position Absolute or relative position * @param {boolean} [relative=false] Whether to position relatively or absolutely @@ -17969,29 +18936,45 @@ module.exports = ClientUserSettings; /***/ }), -/* 73 */ +/* 75 */ +/***/ (function(module, exports, __webpack_require__) { + +const browser = typeof window !== 'undefined'; +const webpack = !!"true"; + +const Discord = __webpack_require__(76); + +module.exports = Discord; +if (browser && webpack) window.Discord = Discord; // eslint-disable-line no-undef +// eslint-disable-next-line no-console +else if (!browser) console.warn('Warning: Attempting to use browser version of Discord.js in a non-browser environment!'); + + +/***/ }), +/* 76 */ /***/ (function(module, exports, __webpack_require__) { const Util = __webpack_require__(4); module.exports = { // "Root" classes (starting points) - Client: __webpack_require__(103), - Shard: __webpack_require__(189), - ShardClientUtil: __webpack_require__(190), - ShardingManager: __webpack_require__(191), - WebhookClient: __webpack_require__(192), + Client: __webpack_require__(108), + Shard: __webpack_require__(197), + ShardClientUtil: __webpack_require__(198), + ShardingManager: __webpack_require__(199), + WebhookClient: __webpack_require__(200), // Utilities Collection: __webpack_require__(3), Constants: __webpack_require__(0), + DiscordAPIError: __webpack_require__(44), EvaluatedPermissions: __webpack_require__(11), Permissions: __webpack_require__(11), Snowflake: __webpack_require__(8), SnowflakeUtil: __webpack_require__(8), Util: Util, util: Util, - version: __webpack_require__(52).version, + version: __webpack_require__(55).version, // Shortcuts to Util methods escapeMarkdown: Util.escapeMarkdown, @@ -17999,46 +18982,45 @@ module.exports = { splitMessage: Util.splitMessage, // Structures - Channel: __webpack_require__(16), - ClientUser: __webpack_require__(71), - ClientUserSettings: __webpack_require__(72), - Collector: __webpack_require__(37), - DMChannel: __webpack_require__(66), + Attachment: __webpack_require__(29), + Channel: __webpack_require__(17), + ClientUser: __webpack_require__(73), + ClientUserSettings: __webpack_require__(74), + Collector: __webpack_require__(40), + DMChannel: __webpack_require__(68), Emoji: __webpack_require__(23), - Game: __webpack_require__(15).Game, - GroupDMChannel: __webpack_require__(40), - Guild: __webpack_require__(28), - GuildAuditLogs: __webpack_require__(63), - GuildChannel: __webpack_require__(29), + Game: __webpack_require__(16).Game, + GroupDMChannel: __webpack_require__(43), + Guild: __webpack_require__(30), + GuildAuditLogs: __webpack_require__(66), + GuildChannel: __webpack_require__(31), GuildMember: __webpack_require__(24), - Invite: __webpack_require__(60), + Invite: __webpack_require__(63), Message: __webpack_require__(22), - MessageAttachment: __webpack_require__(55), - MessageCollector: __webpack_require__(59), - MessageEmbed: __webpack_require__(56), - MessageMentions: __webpack_require__(54), - MessageReaction: __webpack_require__(57), - OAuth2Application: __webpack_require__(39), - ClientOAuth2Application: __webpack_require__(39), - PartialGuild: __webpack_require__(61), - PartialGuildChannel: __webpack_require__(62), - PermissionOverwrites: __webpack_require__(68), - Presence: __webpack_require__(15).Presence, - ReactionEmoji: __webpack_require__(36), - ReactionCollector: __webpack_require__(58), - RichEmbed: __webpack_require__(193), - Role: __webpack_require__(14), - TextChannel: __webpack_require__(67), - User: __webpack_require__(13), - VoiceChannel: __webpack_require__(69), - Webhook: __webpack_require__(38), + MessageAttachment: __webpack_require__(58), + MessageCollector: __webpack_require__(62), + MessageEmbed: __webpack_require__(59), + MessageMentions: __webpack_require__(57), + MessageReaction: __webpack_require__(60), + OAuth2Application: __webpack_require__(42), + ClientOAuth2Application: __webpack_require__(42), + PartialGuild: __webpack_require__(64), + PartialGuildChannel: __webpack_require__(65), + PermissionOverwrites: __webpack_require__(70), + Presence: __webpack_require__(16).Presence, + ReactionEmoji: __webpack_require__(39), + ReactionCollector: __webpack_require__(61), + RichEmbed: __webpack_require__(28), + Role: __webpack_require__(15), + TextChannel: __webpack_require__(69), + User: __webpack_require__(14), + VoiceChannel: __webpack_require__(71), + Webhook: __webpack_require__(41), }; -if (__webpack_require__(27).platform() === 'browser') window.Discord = module.exports; // eslint-disable-line no-undef - /***/ }), -/* 74 */ +/* 77 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -18159,7 +19141,7 @@ function fromByteArray (uint8) { /***/ }), -/* 75 */ +/* 78 */ /***/ (function(module, exports) { exports.read = function (buffer, offset, isLE, mLen, nBytes) { @@ -18249,19 +19231,25 @@ exports.write = function (buffer, value, offset, isLE, mLen, nBytes) { /***/ }), -/* 76 */ +/* 79 */ /***/ (function(module, exports, __webpack_require__) { -/* WEBPACK VAR INJECTION */(function(Buffer) {__webpack_require__(31); -const zlib = __webpack_require__(26); -const qs = __webpack_require__(34); -const http = __webpack_require__(48); -const https = __webpack_require__(97); -const URL = __webpack_require__(50); -const Package = __webpack_require__(98); -const Stream = __webpack_require__(31); -const FormData = __webpack_require__(99); -const fileLoader = __webpack_require__(102); +/* WEBPACK VAR INJECTION */(function(Buffer) {__webpack_require__(25); +const zlib = __webpack_require__(27); +const qs = __webpack_require__(35); +const http = __webpack_require__(36); +const https = __webpack_require__(100); +const URL = __webpack_require__(52); +const Package = __webpack_require__(101); +const Stream = __webpack_require__(25); +const FormData = __webpack_require__(102); + +const transports = { + http, + https, + file: __webpack_require__(105), + http2: __webpack_require__(106), +}; /** * Snekfetch @@ -18278,7 +19266,7 @@ class Snekfetch extends Stream.Readable { * @param {Object|string|Buffer} [opts.data] Data to initialize the request with * @param {string|Object} [opts.query] Query to intialize the request with */ - constructor(method, url, opts = { headers: null, data: null, query: null }) { + constructor(method, url, opts = { headers: null, data: null, query: null, version: 1 }) { super(); const options = URL.parse(url); @@ -18286,7 +19274,8 @@ class Snekfetch extends Stream.Readable { if (opts.headers) options.headers = opts.headers; if ('agent' in opts) options.agent = opts.agent; - this.request = { https, http, file: fileLoader }[options.protocol.replace(':', '')].request(options); + const transport = opts.version === 2 ? transports.http2 : transports[options.protocol.replace(':', '')]; + this.request = transport.request(options); this.request.followRedirects = opts.followRedirects; if (opts.query) this.query(opts.query); if (opts.data) this.send(opts.data); @@ -18300,9 +19289,8 @@ class Snekfetch extends Stream.Readable { */ query(name, value) { if (this.response) throw new Error('Cannot modify query after being sent!'); - if (!this.request.query) this.request.query = {}; if (name !== null && typeof name === 'object') { - this.request.query = Object.assign(this.request.query, name); + this.request.query = Object.assign(this.request.query || {}, name); } else { this.request.query[name] = value; } @@ -18403,7 +19391,7 @@ class Snekfetch extends Stream.Readable { this.push(null); const concated = Buffer.concat(body); - if (this.request.followRedirects !== false && this._shouldRedirect(response)) { + if (this.request.followRedirects && this._shouldRedirect(response)) { let method = this.request.method; if ([301, 302].includes(response.statusCode)) { if (method !== 'HEAD') method = 'GET'; @@ -18462,7 +19450,7 @@ class Snekfetch extends Stream.Readable { return res.body; }, text: concated.toString(), - ok: response.statusCode >= 200 && response.statusCode < 300, + ok: response.statusCode >= 200 && response.statusCode < 400, headers: response.headers, status: response.statusCode, statusText: response.statusText || http.STATUS_CODES[response.statusCode], @@ -18493,7 +19481,7 @@ class Snekfetch extends Stream.Readable { request.end(data); } }) - .then(resolver, rejector); + .then(resolver, rejector); } catch(rejector) { @@ -18503,7 +19491,7 @@ class Snekfetch extends Stream.Readable { /** * End the request * @param {Function} [cb] Optional callback to handle the response - * @returns {Snekfetch} This request + * @returns {Promise} This request */ end(cb) { return this.then( @@ -18558,9 +19546,7 @@ class Snekfetch extends Stream.Readable { Snekfetch.version = Package.version; -Snekfetch.METHODS = http.METHODS ? - http.METHODS.concat('BREW') : - ['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS', 'HEAD']; +Snekfetch.METHODS = (http.METHODS || ['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS', 'HEAD']).concat('BREW'); for (const method of Snekfetch.METHODS) { Snekfetch[method === 'M-SEARCH' ? 'msearch' : method.toLowerCase()] = (url, opts) => new Snekfetch(method, url, opts); } @@ -18580,13 +19566,13 @@ function makeURLFromRequest(request) { /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5).Buffer)) /***/ }), -/* 77 */ +/* 80 */ /***/ (function(module, exports) { /* (ignored) */ /***/ }), -/* 78 */ +/* 81 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -18596,7 +19582,7 @@ function makeURLFromRequest(request) { function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -var Buffer = __webpack_require__(32).Buffer; +var Buffer = __webpack_require__(33).Buffer; /**/ function copyBuffer(src, target, offset) { @@ -18666,7 +19652,7 @@ module.exports = function () { }(); /***/ }), -/* 79 */ +/* 82 */ /***/ (function(module, exports, __webpack_require__) { var apply = Function.prototype.apply; @@ -18719,13 +19705,13 @@ exports._unrefActive = exports.active = function(item) { }; // setimmediate attaches itself to the global object -__webpack_require__(80); +__webpack_require__(83); exports.setImmediate = setImmediate; exports.clearImmediate = clearImmediate; /***/ }), -/* 80 */ +/* 83 */ /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(global, process) {(function (global, undefined) { @@ -18918,7 +19904,7 @@ exports.clearImmediate = clearImmediate; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6), __webpack_require__(7))) /***/ }), -/* 81 */ +/* 84 */ /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(global) { @@ -18992,7 +19978,7 @@ function config (name) { /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) /***/ }), -/* 82 */ +/* 85 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -19025,10 +20011,10 @@ function config (name) { module.exports = PassThrough; -var Transform = __webpack_require__(47); +var Transform = __webpack_require__(50); /**/ -var util = __webpack_require__(18); +var util = __webpack_require__(19); util.inherits = __webpack_require__(10); /**/ @@ -19045,35 +20031,35 @@ PassThrough.prototype._transform = function (chunk, encoding, cb) { }; /***/ }), -/* 83 */ +/* 86 */ /***/ (function(module, exports, __webpack_require__) { -module.exports = __webpack_require__(33); +module.exports = __webpack_require__(34); /***/ }), -/* 84 */ +/* 87 */ /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(12); /***/ }), -/* 85 */ +/* 88 */ /***/ (function(module, exports, __webpack_require__) { -module.exports = __webpack_require__(17).Transform +module.exports = __webpack_require__(18).Transform /***/ }), -/* 86 */ +/* 89 */ /***/ (function(module, exports, __webpack_require__) { -module.exports = __webpack_require__(17).PassThrough +module.exports = __webpack_require__(18).PassThrough /***/ }), -/* 87 */ +/* 90 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -19164,7 +20150,7 @@ var isArray = Array.isArray || function (xs) { /***/ }), -/* 88 */ +/* 91 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -19256,14 +20242,14 @@ var objectKeys = Object.keys || function (obj) { /***/ }), -/* 89 */ +/* 92 */ /***/ (function(module, exports, __webpack_require__) { -/* WEBPACK VAR INJECTION */(function(Buffer, global, process) {var capability = __webpack_require__(49) +/* WEBPACK VAR INJECTION */(function(Buffer, global, process) {var capability = __webpack_require__(51) var inherits = __webpack_require__(10) -var response = __webpack_require__(90) -var stream = __webpack_require__(17) -var toArrayBuffer = __webpack_require__(91) +var response = __webpack_require__(93) +var stream = __webpack_require__(18) +var toArrayBuffer = __webpack_require__(94) var IncomingMessage = response.IncomingMessage var rStates = response.readyStates @@ -19569,12 +20555,12 @@ var unsafeHeaders = [ /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5).Buffer, __webpack_require__(6), __webpack_require__(7))) /***/ }), -/* 90 */ +/* 93 */ /***/ (function(module, exports, __webpack_require__) { -/* WEBPACK VAR INJECTION */(function(process, Buffer, global) {var capability = __webpack_require__(49) +/* WEBPACK VAR INJECTION */(function(process, Buffer, global) {var capability = __webpack_require__(51) var inherits = __webpack_require__(10) -var stream = __webpack_require__(17) +var stream = __webpack_require__(18) var rStates = exports.readyStates = { UNSENT: 0, @@ -19758,7 +20744,7 @@ IncomingMessage.prototype._onXHRProgress = function () { /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(7), __webpack_require__(5).Buffer, __webpack_require__(6))) /***/ }), -/* 91 */ +/* 94 */ /***/ (function(module, exports, __webpack_require__) { var Buffer = __webpack_require__(5).Buffer @@ -19791,7 +20777,7 @@ module.exports = function (buf) { /***/ }), -/* 92 */ +/* 95 */ /***/ (function(module, exports) { module.exports = extend @@ -19816,7 +20802,7 @@ function extend() { /***/ }), -/* 93 */ +/* 96 */ /***/ (function(module, exports) { module.exports = { @@ -19886,7 +20872,7 @@ module.exports = { /***/ }), -/* 94 */ +/* 97 */ /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(module, global) {var __WEBPACK_AMD_DEFINE_RESULT__;/*! https://mths.be/punycode v1.4.1 by @mathias */ @@ -20422,10 +21408,10 @@ module.exports = { }(this)); -/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(95)(module), __webpack_require__(6))) +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(98)(module), __webpack_require__(6))) /***/ }), -/* 95 */ +/* 98 */ /***/ (function(module, exports) { module.exports = function(module) { @@ -20453,7 +21439,7 @@ module.exports = function(module) { /***/ }), -/* 96 */ +/* 99 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -20476,10 +21462,10 @@ module.exports = { /***/ }), -/* 97 */ +/* 100 */ /***/ (function(module, exports, __webpack_require__) { -var http = __webpack_require__(48); +var http = __webpack_require__(36); var https = module.exports; @@ -20496,17 +21482,17 @@ https.request = function (params, cb) { /***/ }), -/* 98 */ +/* 101 */ /***/ (function(module, exports) { -module.exports = {"_from":"snekfetch@^3.0.0","_id":"snekfetch@3.2.9","_inBundle":false,"_integrity":"sha512-0ZYxGRMtgBska6uQ616F0jcPYad/sLe+uBJJ2vewD62ftEFnh6rY5mza05KoUS5UWcclMuiUfAZSf10ZYnkOZA==","_location":"/snekfetch","_phantomChildren":{},"_requested":{"type":"range","registry":true,"raw":"snekfetch@^3.0.0","name":"snekfetch","escapedName":"snekfetch","rawSpec":"^3.0.0","saveSpec":null,"fetchSpec":"^3.0.0"},"_requiredBy":["/"],"_resolved":"https://registry.npmjs.org/snekfetch/-/snekfetch-3.2.9.tgz","_shasum":"cdd28c7e88c889d86b9ff289a8e985a2f484f206","_spec":"snekfetch@^3.0.0","_where":"C:\\Users\\crawl\\Documents\\Coding\\Javascript\\Discord\\Frameworks\\test\\discord.js","author":{"name":"Gus Caplan","email":"me@gus.host"},"bugs":{"url":"https://github.com/devsnek/snekfetch/issues"},"bundleDependencies":false,"dependencies":{},"deprecated":false,"description":"Just do http requests without all that weird nastiness from other libs","devDependencies":{},"homepage":"https://github.com/devsnek/snekfetch#readme","license":"MIT","main":"index.js","name":"snekfetch","repository":{"type":"git","url":"git+https://github.com/devsnek/snekfetch.git"},"version":"3.2.9"} +module.exports = {"_args":[[{"raw":"snekfetch@^3.1.0","scope":null,"escapedName":"snekfetch","name":"snekfetch","rawSpec":"^3.1.0","spec":">=3.1.0 <4.0.0","type":"range"},"/home/travis/build/hydrabolt/discord.js"]],"_from":"snekfetch@>=3.1.0 <4.0.0","_id":"snekfetch@3.3.0","_inCache":true,"_location":"/snekfetch","_nodeVersion":"8.4.0","_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/snekfetch-3.3.0.tgz_1504416679797_0.3850039339158684"},"_npmUser":{"name":"snek","email":"me@gus.host"},"_npmVersion":"5.3.0","_phantomChildren":{},"_requested":{"raw":"snekfetch@^3.1.0","scope":null,"escapedName":"snekfetch","name":"snekfetch","rawSpec":"^3.1.0","spec":">=3.1.0 <4.0.0","type":"range"},"_requiredBy":["/"],"_resolved":"https://registry.npmjs.org/snekfetch/-/snekfetch-3.3.0.tgz","_shasum":"97aa0d79d5920f18c26d4c8a7fddbe91205ad0fa","_shrinkwrap":null,"_spec":"snekfetch@^3.1.0","_where":"/home/travis/build/hydrabolt/discord.js","author":{"name":"Gus Caplan","email":"me@gus.host"},"bugs":{"url":"https://github.com/devsnek/snekfetch/issues"},"dependencies":{},"description":"Just do http requests without all that weird nastiness from other libs","devDependencies":{},"directories":{},"dist":{"integrity":"sha512-R0VGqazwvZChkYuidDdaAzkvD6hUJ/qxfFUykyD1eovfH6PC2d9C9Qv+z4bUjMmKjBp0FE6GxMZtE9IKY/dngA==","shasum":"97aa0d79d5920f18c26d4c8a7fddbe91205ad0fa","tarball":"https://registry.npmjs.org/snekfetch/-/snekfetch-3.3.0.tgz"},"gitHead":"7b4fff64301580b46668d46e45a88fbd0330b055","homepage":"https://github.com/devsnek/snekfetch#readme","license":"MIT","main":"index.js","maintainers":[{"name":"snek","email":"me@gus.host"}],"name":"snekfetch","optionalDependencies":{},"readme":"ERROR: No README data found!","repository":{"type":"git","url":"git+https://github.com/devsnek/snekfetch.git"},"version":"3.3.0"} /***/ }), -/* 99 */ +/* 102 */ /***/ (function(module, exports, __webpack_require__) { -/* WEBPACK VAR INJECTION */(function(Buffer) {const path = __webpack_require__(19); -const mime = __webpack_require__(51); +/* WEBPACK VAR INJECTION */(function(Buffer) {const path = __webpack_require__(20); +const mime = __webpack_require__(53); class FormData { constructor() { @@ -20554,13 +21540,13 @@ module.exports = FormData; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5).Buffer)) /***/ }), -/* 100 */ +/* 103 */ /***/ (function(module, exports) { module.exports = {"123":"application/vnd.lotus-1-2-3","ez":"application/andrew-inset","aw":"application/applixware","atom":"application/atom+xml","atomcat":"application/atomcat+xml","atomsvc":"application/atomsvc+xml","bdoc":"application/x-bdoc","ccxml":"application/ccxml+xml","cdmia":"application/cdmi-capability","cdmic":"application/cdmi-container","cdmid":"application/cdmi-domain","cdmio":"application/cdmi-object","cdmiq":"application/cdmi-queue","cu":"application/cu-seeme","mpd":"application/dash+xml","davmount":"application/davmount+xml","dbk":"application/docbook+xml","dssc":"application/dssc+der","xdssc":"application/dssc+xml","ecma":"application/ecmascript","emma":"application/emma+xml","epub":"application/epub+zip","exi":"application/exi","pfr":"application/font-tdpfr","woff":"application/font-woff","woff2":"application/font-woff2","geojson":"application/geo+json","gml":"application/gml+xml","gpx":"application/gpx+xml","gxf":"application/gxf","stk":"application/hyperstudio","ink":"application/inkml+xml","inkml":"application/inkml+xml","ipfix":"application/ipfix","jar":"application/java-archive","war":"application/java-archive","ear":"application/java-archive","ser":"application/java-serialized-object","class":"application/java-vm","js":"application/javascript","json":"application/json","map":"application/json","json5":"application/json5","jsonml":"application/jsonml+json","jsonld":"application/ld+json","lostxml":"application/lost+xml","hqx":"application/mac-binhex40","cpt":"application/mac-compactpro","mads":"application/mads+xml","webmanifest":"application/manifest+json","mrc":"application/marc","mrcx":"application/marcxml+xml","ma":"application/mathematica","nb":"application/mathematica","mb":"application/mathematica","mathml":"application/mathml+xml","mbox":"application/mbox","mscml":"application/mediaservercontrol+xml","metalink":"application/metalink+xml","meta4":"application/metalink4+xml","mets":"application/mets+xml","mods":"application/mods+xml","m21":"application/mp21","mp21":"application/mp21","mp4s":"application/mp4","m4p":"application/mp4","doc":"application/msword","dot":"application/msword","mxf":"application/mxf","bin":"application/octet-stream","dms":"application/octet-stream","lrf":"application/octet-stream","mar":"application/octet-stream","so":"application/octet-stream","dist":"application/octet-stream","distz":"application/octet-stream","pkg":"application/octet-stream","bpk":"application/octet-stream","dump":"application/octet-stream","elc":"application/octet-stream","deploy":"application/octet-stream","exe":"application/x-msdownload","dll":"application/x-msdownload","deb":"application/x-debian-package","dmg":"application/x-apple-diskimage","iso":"application/x-iso9660-image","img":"application/octet-stream","msi":"application/x-msdownload","msp":"application/octet-stream","msm":"application/octet-stream","buffer":"application/octet-stream","oda":"application/oda","opf":"application/oebps-package+xml","ogx":"application/ogg","omdoc":"application/omdoc+xml","onetoc":"application/onenote","onetoc2":"application/onenote","onetmp":"application/onenote","onepkg":"application/onenote","oxps":"application/oxps","xer":"application/patch-ops-error+xml","pdf":"application/pdf","pgp":"application/pgp-encrypted","asc":"application/pgp-signature","sig":"application/pgp-signature","prf":"application/pics-rules","p10":"application/pkcs10","p7m":"application/pkcs7-mime","p7c":"application/pkcs7-mime","p7s":"application/pkcs7-signature","p8":"application/pkcs8","ac":"application/pkix-attr-cert","cer":"application/pkix-cert","crl":"application/pkix-crl","pkipath":"application/pkix-pkipath","pki":"application/pkixcmp","pls":"application/pls+xml","ai":"application/postscript","eps":"application/postscript","ps":"application/postscript","cww":"application/prs.cww","pskcxml":"application/pskc+xml","rdf":"application/rdf+xml","rif":"application/reginfo+xml","rnc":"application/relax-ng-compact-syntax","rl":"application/resource-lists+xml","rld":"application/resource-lists-diff+xml","rs":"application/rls-services+xml","gbr":"application/rpki-ghostbusters","mft":"application/rpki-manifest","roa":"application/rpki-roa","rsd":"application/rsd+xml","rss":"application/rss+xml","rtf":"text/rtf","sbml":"application/sbml+xml","scq":"application/scvp-cv-request","scs":"application/scvp-cv-response","spq":"application/scvp-vp-request","spp":"application/scvp-vp-response","sdp":"application/sdp","setpay":"application/set-payment-initiation","setreg":"application/set-registration-initiation","shf":"application/shf+xml","smi":"application/smil+xml","smil":"application/smil+xml","rq":"application/sparql-query","srx":"application/sparql-results+xml","gram":"application/srgs","grxml":"application/srgs+xml","sru":"application/sru+xml","ssdl":"application/ssdl+xml","ssml":"application/ssml+xml","tei":"application/tei+xml","teicorpus":"application/tei+xml","tfi":"application/thraud+xml","tsd":"application/timestamped-data","plb":"application/vnd.3gpp.pic-bw-large","psb":"application/vnd.3gpp.pic-bw-small","pvb":"application/vnd.3gpp.pic-bw-var","tcap":"application/vnd.3gpp2.tcap","pwn":"application/vnd.3m.post-it-notes","aso":"application/vnd.accpac.simply.aso","imp":"application/vnd.accpac.simply.imp","acu":"application/vnd.acucobol","atc":"application/vnd.acucorp","acutc":"application/vnd.acucorp","air":"application/vnd.adobe.air-application-installer-package+zip","fcdt":"application/vnd.adobe.formscentral.fcdt","fxp":"application/vnd.adobe.fxp","fxpl":"application/vnd.adobe.fxp","xdp":"application/vnd.adobe.xdp+xml","xfdf":"application/vnd.adobe.xfdf","ahead":"application/vnd.ahead.space","azf":"application/vnd.airzip.filesecure.azf","azs":"application/vnd.airzip.filesecure.azs","azw":"application/vnd.amazon.ebook","acc":"application/vnd.americandynamics.acc","ami":"application/vnd.amiga.ami","apk":"application/vnd.android.package-archive","cii":"application/vnd.anser-web-certificate-issue-initiation","fti":"application/vnd.anser-web-funds-transfer-initiation","atx":"application/vnd.antix.game-component","mpkg":"application/vnd.apple.installer+xml","m3u8":"application/vnd.apple.mpegurl","pkpass":"application/vnd.apple.pkpass","swi":"application/vnd.aristanetworks.swi","iota":"application/vnd.astraea-software.iota","aep":"application/vnd.audiograph","mpm":"application/vnd.blueice.multipass","bmi":"application/vnd.bmi","rep":"application/vnd.businessobjects","cdxml":"application/vnd.chemdraw+xml","mmd":"application/vnd.chipnuts.karaoke-mmd","cdy":"application/vnd.cinderella","cla":"application/vnd.claymore","rp9":"application/vnd.cloanto.rp9","c4g":"application/vnd.clonk.c4group","c4d":"application/vnd.clonk.c4group","c4f":"application/vnd.clonk.c4group","c4p":"application/vnd.clonk.c4group","c4u":"application/vnd.clonk.c4group","c11amc":"application/vnd.cluetrust.cartomobile-config","c11amz":"application/vnd.cluetrust.cartomobile-config-pkg","csp":"application/vnd.commonspace","cdbcmsg":"application/vnd.contact.cmsg","cmc":"application/vnd.cosmocaller","clkx":"application/vnd.crick.clicker","clkk":"application/vnd.crick.clicker.keyboard","clkp":"application/vnd.crick.clicker.palette","clkt":"application/vnd.crick.clicker.template","clkw":"application/vnd.crick.clicker.wordbank","wbs":"application/vnd.criticaltools.wbs+xml","pml":"application/vnd.ctc-posml","ppd":"application/vnd.cups-ppd","car":"application/vnd.curl.car","pcurl":"application/vnd.curl.pcurl","dart":"application/vnd.dart","rdz":"application/vnd.data-vision.rdz","uvf":"application/vnd.dece.data","uvvf":"application/vnd.dece.data","uvd":"application/vnd.dece.data","uvvd":"application/vnd.dece.data","uvt":"application/vnd.dece.ttml+xml","uvvt":"application/vnd.dece.ttml+xml","uvx":"application/vnd.dece.unspecified","uvvx":"application/vnd.dece.unspecified","uvz":"application/vnd.dece.zip","uvvz":"application/vnd.dece.zip","fe_launch":"application/vnd.denovo.fcselayout-link","dna":"application/vnd.dna","mlp":"application/vnd.dolby.mlp","dpg":"application/vnd.dpgraph","dfac":"application/vnd.dreamfactory","kpxx":"application/vnd.ds-keypoint","ait":"application/vnd.dvb.ait","svc":"application/vnd.dvb.service","geo":"application/vnd.dynageo","mag":"application/vnd.ecowin.chart","nml":"application/vnd.enliven","esf":"application/vnd.epson.esf","msf":"application/vnd.epson.msf","qam":"application/vnd.epson.quickanime","slt":"application/vnd.epson.salt","ssf":"application/vnd.epson.ssf","es3":"application/vnd.eszigno3+xml","et3":"application/vnd.eszigno3+xml","ez2":"application/vnd.ezpix-album","ez3":"application/vnd.ezpix-package","fdf":"application/vnd.fdf","mseed":"application/vnd.fdsn.mseed","seed":"application/vnd.fdsn.seed","dataless":"application/vnd.fdsn.seed","gph":"application/vnd.flographit","ftc":"application/vnd.fluxtime.clip","fm":"application/vnd.framemaker","frame":"application/vnd.framemaker","maker":"application/vnd.framemaker","book":"application/vnd.framemaker","fnc":"application/vnd.frogans.fnc","ltf":"application/vnd.frogans.ltf","fsc":"application/vnd.fsc.weblaunch","oas":"application/vnd.fujitsu.oasys","oa2":"application/vnd.fujitsu.oasys2","oa3":"application/vnd.fujitsu.oasys3","fg5":"application/vnd.fujitsu.oasysgp","bh2":"application/vnd.fujitsu.oasysprs","ddd":"application/vnd.fujixerox.ddd","xdw":"application/vnd.fujixerox.docuworks","xbd":"application/vnd.fujixerox.docuworks.binder","fzs":"application/vnd.fuzzysheet","txd":"application/vnd.genomatix.tuxedo","ggb":"application/vnd.geogebra.file","ggt":"application/vnd.geogebra.tool","gex":"application/vnd.geometry-explorer","gre":"application/vnd.geometry-explorer","gxt":"application/vnd.geonext","g2w":"application/vnd.geoplan","g3w":"application/vnd.geospace","gmx":"application/vnd.gmx","gdoc":"application/vnd.google-apps.document","gslides":"application/vnd.google-apps.presentation","gsheet":"application/vnd.google-apps.spreadsheet","kml":"application/vnd.google-earth.kml+xml","kmz":"application/vnd.google-earth.kmz","gqf":"application/vnd.grafeq","gqs":"application/vnd.grafeq","gac":"application/vnd.groove-account","ghf":"application/vnd.groove-help","gim":"application/vnd.groove-identity-message","grv":"application/vnd.groove-injector","gtm":"application/vnd.groove-tool-message","tpl":"application/vnd.groove-tool-template","vcg":"application/vnd.groove-vcard","hal":"application/vnd.hal+xml","zmm":"application/vnd.handheld-entertainment+xml","hbci":"application/vnd.hbci","les":"application/vnd.hhe.lesson-player","hpgl":"application/vnd.hp-hpgl","hpid":"application/vnd.hp-hpid","hps":"application/vnd.hp-hps","jlt":"application/vnd.hp-jlyt","pcl":"application/vnd.hp-pcl","pclxl":"application/vnd.hp-pclxl","sfd-hdstx":"application/vnd.hydrostatix.sof-data","mpy":"application/vnd.ibm.minipay","afp":"application/vnd.ibm.modcap","listafp":"application/vnd.ibm.modcap","list3820":"application/vnd.ibm.modcap","irm":"application/vnd.ibm.rights-management","sc":"application/vnd.ibm.secure-container","icc":"application/vnd.iccprofile","icm":"application/vnd.iccprofile","igl":"application/vnd.igloader","ivp":"application/vnd.immervision-ivp","ivu":"application/vnd.immervision-ivu","igm":"application/vnd.insors.igm","xpw":"application/vnd.intercon.formnet","xpx":"application/vnd.intercon.formnet","i2g":"application/vnd.intergeo","qbo":"application/vnd.intu.qbo","qfx":"application/vnd.intu.qfx","rcprofile":"application/vnd.ipunplugged.rcprofile","irp":"application/vnd.irepository.package+xml","xpr":"application/vnd.is-xpr","fcs":"application/vnd.isac.fcs","jam":"application/vnd.jam","rms":"application/vnd.jcp.javame.midlet-rms","jisp":"application/vnd.jisp","joda":"application/vnd.joost.joda-archive","ktz":"application/vnd.kahootz","ktr":"application/vnd.kahootz","karbon":"application/vnd.kde.karbon","chrt":"application/vnd.kde.kchart","kfo":"application/vnd.kde.kformula","flw":"application/vnd.kde.kivio","kon":"application/vnd.kde.kontour","kpr":"application/vnd.kde.kpresenter","kpt":"application/vnd.kde.kpresenter","ksp":"application/vnd.kde.kspread","kwd":"application/vnd.kde.kword","kwt":"application/vnd.kde.kword","htke":"application/vnd.kenameaapp","kia":"application/vnd.kidspiration","kne":"application/vnd.kinar","knp":"application/vnd.kinar","skp":"application/vnd.koan","skd":"application/vnd.koan","skt":"application/vnd.koan","skm":"application/vnd.koan","sse":"application/vnd.kodak-descriptor","lasxml":"application/vnd.las.las+xml","lbd":"application/vnd.llamagraphics.life-balance.desktop","lbe":"application/vnd.llamagraphics.life-balance.exchange+xml","apr":"application/vnd.lotus-approach","pre":"application/vnd.lotus-freelance","nsf":"application/vnd.lotus-notes","org":"application/vnd.lotus-organizer","scm":"application/vnd.lotus-screencam","lwp":"application/vnd.lotus-wordpro","portpkg":"application/vnd.macports.portpkg","mcd":"application/vnd.mcd","mc1":"application/vnd.medcalcdata","cdkey":"application/vnd.mediastation.cdkey","mwf":"application/vnd.mfer","mfm":"application/vnd.mfmp","flo":"application/vnd.micrografx.flo","igx":"application/vnd.micrografx.igx","mif":"application/vnd.mif","daf":"application/vnd.mobius.daf","dis":"application/vnd.mobius.dis","mbk":"application/vnd.mobius.mbk","mqy":"application/vnd.mobius.mqy","msl":"application/vnd.mobius.msl","plc":"application/vnd.mobius.plc","txf":"application/vnd.mobius.txf","mpn":"application/vnd.mophun.application","mpc":"application/vnd.mophun.certificate","xul":"application/vnd.mozilla.xul+xml","cil":"application/vnd.ms-artgalry","cab":"application/vnd.ms-cab-compressed","xls":"application/vnd.ms-excel","xlm":"application/vnd.ms-excel","xla":"application/vnd.ms-excel","xlc":"application/vnd.ms-excel","xlt":"application/vnd.ms-excel","xlw":"application/vnd.ms-excel","xlam":"application/vnd.ms-excel.addin.macroenabled.12","xlsb":"application/vnd.ms-excel.sheet.binary.macroenabled.12","xlsm":"application/vnd.ms-excel.sheet.macroenabled.12","xltm":"application/vnd.ms-excel.template.macroenabled.12","eot":"application/vnd.ms-fontobject","chm":"application/vnd.ms-htmlhelp","ims":"application/vnd.ms-ims","lrm":"application/vnd.ms-lrm","thmx":"application/vnd.ms-officetheme","cat":"application/vnd.ms-pki.seccat","stl":"application/vnd.ms-pki.stl","ppt":"application/vnd.ms-powerpoint","pps":"application/vnd.ms-powerpoint","pot":"application/vnd.ms-powerpoint","ppam":"application/vnd.ms-powerpoint.addin.macroenabled.12","pptm":"application/vnd.ms-powerpoint.presentation.macroenabled.12","sldm":"application/vnd.ms-powerpoint.slide.macroenabled.12","ppsm":"application/vnd.ms-powerpoint.slideshow.macroenabled.12","potm":"application/vnd.ms-powerpoint.template.macroenabled.12","mpp":"application/vnd.ms-project","mpt":"application/vnd.ms-project","docm":"application/vnd.ms-word.document.macroenabled.12","dotm":"application/vnd.ms-word.template.macroenabled.12","wps":"application/vnd.ms-works","wks":"application/vnd.ms-works","wcm":"application/vnd.ms-works","wdb":"application/vnd.ms-works","wpl":"application/vnd.ms-wpl","xps":"application/vnd.ms-xpsdocument","mseq":"application/vnd.mseq","mus":"application/vnd.musician","msty":"application/vnd.muvee.style","taglet":"application/vnd.mynfc","nlu":"application/vnd.neurolanguage.nlu","ntf":"application/vnd.nitf","nitf":"application/vnd.nitf","nnd":"application/vnd.noblenet-directory","nns":"application/vnd.noblenet-sealer","nnw":"application/vnd.noblenet-web","ngdat":"application/vnd.nokia.n-gage.data","n-gage":"application/vnd.nokia.n-gage.symbian.install","rpst":"application/vnd.nokia.radio-preset","rpss":"application/vnd.nokia.radio-presets","edm":"application/vnd.novadigm.edm","edx":"application/vnd.novadigm.edx","ext":"application/vnd.novadigm.ext","odc":"application/vnd.oasis.opendocument.chart","otc":"application/vnd.oasis.opendocument.chart-template","odb":"application/vnd.oasis.opendocument.database","odf":"application/vnd.oasis.opendocument.formula","odft":"application/vnd.oasis.opendocument.formula-template","odg":"application/vnd.oasis.opendocument.graphics","otg":"application/vnd.oasis.opendocument.graphics-template","odi":"application/vnd.oasis.opendocument.image","oti":"application/vnd.oasis.opendocument.image-template","odp":"application/vnd.oasis.opendocument.presentation","otp":"application/vnd.oasis.opendocument.presentation-template","ods":"application/vnd.oasis.opendocument.spreadsheet","ots":"application/vnd.oasis.opendocument.spreadsheet-template","odt":"application/vnd.oasis.opendocument.text","odm":"application/vnd.oasis.opendocument.text-master","ott":"application/vnd.oasis.opendocument.text-template","oth":"application/vnd.oasis.opendocument.text-web","xo":"application/vnd.olpc-sugar","dd2":"application/vnd.oma.dd2+xml","oxt":"application/vnd.openofficeorg.extension","pptx":"application/vnd.openxmlformats-officedocument.presentationml.presentation","sldx":"application/vnd.openxmlformats-officedocument.presentationml.slide","ppsx":"application/vnd.openxmlformats-officedocument.presentationml.slideshow","potx":"application/vnd.openxmlformats-officedocument.presentationml.template","xlsx":"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","xltx":"application/vnd.openxmlformats-officedocument.spreadsheetml.template","docx":"application/vnd.openxmlformats-officedocument.wordprocessingml.document","dotx":"application/vnd.openxmlformats-officedocument.wordprocessingml.template","mgp":"application/vnd.osgeo.mapguide.package","dp":"application/vnd.osgi.dp","esa":"application/vnd.osgi.subsystem","pdb":"application/x-pilot","pqa":"application/vnd.palm","oprc":"application/vnd.palm","paw":"application/vnd.pawaafile","str":"application/vnd.pg.format","ei6":"application/vnd.pg.osasli","efif":"application/vnd.picsel","wg":"application/vnd.pmi.widget","plf":"application/vnd.pocketlearn","pbd":"application/vnd.powerbuilder6","box":"application/vnd.previewsystems.box","mgz":"application/vnd.proteus.magazine","qps":"application/vnd.publishare-delta-tree","ptid":"application/vnd.pvi.ptid1","qxd":"application/vnd.quark.quarkxpress","qxt":"application/vnd.quark.quarkxpress","qwd":"application/vnd.quark.quarkxpress","qwt":"application/vnd.quark.quarkxpress","qxl":"application/vnd.quark.quarkxpress","qxb":"application/vnd.quark.quarkxpress","bed":"application/vnd.realvnc.bed","mxl":"application/vnd.recordare.musicxml","musicxml":"application/vnd.recordare.musicxml+xml","cryptonote":"application/vnd.rig.cryptonote","cod":"application/vnd.rim.cod","rm":"application/vnd.rn-realmedia","rmvb":"application/vnd.rn-realmedia-vbr","link66":"application/vnd.route66.link66+xml","st":"application/vnd.sailingtracker.track","see":"application/vnd.seemail","sema":"application/vnd.sema","semd":"application/vnd.semd","semf":"application/vnd.semf","ifm":"application/vnd.shana.informed.formdata","itp":"application/vnd.shana.informed.formtemplate","iif":"application/vnd.shana.informed.interchange","ipk":"application/vnd.shana.informed.package","twd":"application/vnd.simtech-mindmapper","twds":"application/vnd.simtech-mindmapper","mmf":"application/vnd.smaf","teacher":"application/vnd.smart.teacher","sdkm":"application/vnd.solent.sdkm+xml","sdkd":"application/vnd.solent.sdkm+xml","dxp":"application/vnd.spotfire.dxp","sfs":"application/vnd.spotfire.sfs","sdc":"application/vnd.stardivision.calc","sda":"application/vnd.stardivision.draw","sdd":"application/vnd.stardivision.impress","smf":"application/vnd.stardivision.math","sdw":"application/vnd.stardivision.writer","vor":"application/vnd.stardivision.writer","sgl":"application/vnd.stardivision.writer-global","smzip":"application/vnd.stepmania.package","sm":"application/vnd.stepmania.stepchart","sxc":"application/vnd.sun.xml.calc","stc":"application/vnd.sun.xml.calc.template","sxd":"application/vnd.sun.xml.draw","std":"application/vnd.sun.xml.draw.template","sxi":"application/vnd.sun.xml.impress","sti":"application/vnd.sun.xml.impress.template","sxm":"application/vnd.sun.xml.math","sxw":"application/vnd.sun.xml.writer","sxg":"application/vnd.sun.xml.writer.global","stw":"application/vnd.sun.xml.writer.template","sus":"application/vnd.sus-calendar","susp":"application/vnd.sus-calendar","svd":"application/vnd.svd","sis":"application/vnd.symbian.install","sisx":"application/vnd.symbian.install","xsm":"application/vnd.syncml+xml","bdm":"application/vnd.syncml.dm+wbxml","xdm":"application/vnd.syncml.dm+xml","tao":"application/vnd.tao.intent-module-archive","pcap":"application/vnd.tcpdump.pcap","cap":"application/vnd.tcpdump.pcap","dmp":"application/vnd.tcpdump.pcap","tmo":"application/vnd.tmobile-livetv","tpt":"application/vnd.trid.tpt","mxs":"application/vnd.triscape.mxs","tra":"application/vnd.trueapp","ufd":"application/vnd.ufdl","ufdl":"application/vnd.ufdl","utz":"application/vnd.uiq.theme","umj":"application/vnd.umajin","unityweb":"application/vnd.unity","uoml":"application/vnd.uoml+xml","vcx":"application/vnd.vcx","vsd":"application/vnd.visio","vst":"application/vnd.visio","vss":"application/vnd.visio","vsw":"application/vnd.visio","vis":"application/vnd.visionary","vsf":"application/vnd.vsf","wbxml":"application/vnd.wap.wbxml","wmlc":"application/vnd.wap.wmlc","wmlsc":"application/vnd.wap.wmlscriptc","wtb":"application/vnd.webturbo","nbp":"application/vnd.wolfram.player","wpd":"application/vnd.wordperfect","wqd":"application/vnd.wqd","stf":"application/vnd.wt.stf","xar":"application/vnd.xara","xfdl":"application/vnd.xfdl","hvd":"application/vnd.yamaha.hv-dic","hvs":"application/vnd.yamaha.hv-script","hvp":"application/vnd.yamaha.hv-voice","osf":"application/vnd.yamaha.openscoreformat","osfpvg":"application/vnd.yamaha.openscoreformat.osfpvg+xml","saf":"application/vnd.yamaha.smaf-audio","spf":"application/vnd.yamaha.smaf-phrase","cmp":"application/vnd.yellowriver-custom-menu","zir":"application/vnd.zul","zirz":"application/vnd.zul","zaz":"application/vnd.zzazz.deck+xml","vxml":"application/voicexml+xml","wgt":"application/widget","hlp":"application/winhlp","wsdl":"application/wsdl+xml","wspolicy":"application/wspolicy+xml","7z":"application/x-7z-compressed","abw":"application/x-abiword","ace":"application/x-ace-compressed","aab":"application/x-authorware-bin","x32":"application/x-authorware-bin","u32":"application/x-authorware-bin","vox":"application/x-authorware-bin","aam":"application/x-authorware-map","aas":"application/x-authorware-seg","bcpio":"application/x-bcpio","torrent":"application/x-bittorrent","blb":"application/x-blorb","blorb":"application/x-blorb","bz":"application/x-bzip","bz2":"application/x-bzip2","boz":"application/x-bzip2","cbr":"application/x-cbr","cba":"application/x-cbr","cbt":"application/x-cbr","cbz":"application/x-cbr","cb7":"application/x-cbr","vcd":"application/x-cdlink","cfs":"application/x-cfs-compressed","chat":"application/x-chat","pgn":"application/x-chess-pgn","crx":"application/x-chrome-extension","cco":"application/x-cocoa","nsc":"application/x-conference","cpio":"application/x-cpio","csh":"application/x-csh","udeb":"application/x-debian-package","dgc":"application/x-dgc-compressed","dir":"application/x-director","dcr":"application/x-director","dxr":"application/x-director","cst":"application/x-director","cct":"application/x-director","cxt":"application/x-director","w3d":"application/x-director","fgd":"application/x-director","swa":"application/x-director","wad":"application/x-doom","ncx":"application/x-dtbncx+xml","dtb":"application/x-dtbook+xml","res":"application/x-dtbresource+xml","dvi":"application/x-dvi","evy":"application/x-envoy","eva":"application/x-eva","bdf":"application/x-font-bdf","gsf":"application/x-font-ghostscript","psf":"application/x-font-linux-psf","otf":"font/opentype","pcf":"application/x-font-pcf","snf":"application/x-font-snf","ttf":"application/x-font-ttf","ttc":"application/x-font-ttf","pfa":"application/x-font-type1","pfb":"application/x-font-type1","pfm":"application/x-font-type1","afm":"application/x-font-type1","arc":"application/x-freearc","spl":"application/x-futuresplash","gca":"application/x-gca-compressed","ulx":"application/x-glulx","gnumeric":"application/x-gnumeric","gramps":"application/x-gramps-xml","gtar":"application/x-gtar","hdf":"application/x-hdf","php":"application/x-httpd-php","install":"application/x-install-instructions","jardiff":"application/x-java-archive-diff","jnlp":"application/x-java-jnlp-file","latex":"application/x-latex","luac":"application/x-lua-bytecode","lzh":"application/x-lzh-compressed","lha":"application/x-lzh-compressed","run":"application/x-makeself","mie":"application/x-mie","prc":"application/x-pilot","mobi":"application/x-mobipocket-ebook","application":"application/x-ms-application","lnk":"application/x-ms-shortcut","wmd":"application/x-ms-wmd","wmz":"application/x-msmetafile","xbap":"application/x-ms-xbap","mdb":"application/x-msaccess","obd":"application/x-msbinder","crd":"application/x-mscardfile","clp":"application/x-msclip","com":"application/x-msdownload","bat":"application/x-msdownload","mvb":"application/x-msmediaview","m13":"application/x-msmediaview","m14":"application/x-msmediaview","wmf":"application/x-msmetafile","emf":"application/x-msmetafile","emz":"application/x-msmetafile","mny":"application/x-msmoney","pub":"application/x-mspublisher","scd":"application/x-msschedule","trm":"application/x-msterminal","wri":"application/x-mswrite","nc":"application/x-netcdf","cdf":"application/x-netcdf","pac":"application/x-ns-proxy-autoconfig","nzb":"application/x-nzb","pl":"application/x-perl","pm":"application/x-perl","p12":"application/x-pkcs12","pfx":"application/x-pkcs12","p7b":"application/x-pkcs7-certificates","spc":"application/x-pkcs7-certificates","p7r":"application/x-pkcs7-certreqresp","rar":"application/x-rar-compressed","rpm":"application/x-redhat-package-manager","ris":"application/x-research-info-systems","sea":"application/x-sea","sh":"application/x-sh","shar":"application/x-shar","swf":"application/x-shockwave-flash","xap":"application/x-silverlight-app","sql":"application/x-sql","sit":"application/x-stuffit","sitx":"application/x-stuffitx","srt":"application/x-subrip","sv4cpio":"application/x-sv4cpio","sv4crc":"application/x-sv4crc","t3":"application/x-t3vm-image","gam":"application/x-tads","tar":"application/x-tar","tcl":"application/x-tcl","tk":"application/x-tcl","tex":"application/x-tex","tfm":"application/x-tex-tfm","texinfo":"application/x-texinfo","texi":"application/x-texinfo","obj":"application/x-tgif","ustar":"application/x-ustar","src":"application/x-wais-source","webapp":"application/x-web-app-manifest+json","der":"application/x-x509-ca-cert","crt":"application/x-x509-ca-cert","pem":"application/x-x509-ca-cert","fig":"application/x-xfig","xlf":"application/x-xliff+xml","xpi":"application/x-xpinstall","xz":"application/x-xz","z1":"application/x-zmachine","z2":"application/x-zmachine","z3":"application/x-zmachine","z4":"application/x-zmachine","z5":"application/x-zmachine","z6":"application/x-zmachine","z7":"application/x-zmachine","z8":"application/x-zmachine","xaml":"application/xaml+xml","xdf":"application/xcap-diff+xml","xenc":"application/xenc+xml","xhtml":"application/xhtml+xml","xht":"application/xhtml+xml","xml":"text/xml","xsl":"application/xml","xsd":"application/xml","rng":"application/xml","dtd":"application/xml-dtd","xop":"application/xop+xml","xpl":"application/xproc+xml","xslt":"application/xslt+xml","xspf":"application/xspf+xml","mxml":"application/xv+xml","xhvml":"application/xv+xml","xvml":"application/xv+xml","xvm":"application/xv+xml","yang":"application/yang","yin":"application/yin+xml","zip":"application/zip","3gpp":"video/3gpp","adp":"audio/adpcm","au":"audio/basic","snd":"audio/basic","mid":"audio/midi","midi":"audio/midi","kar":"audio/midi","rmi":"audio/midi","mp3":"audio/mpeg","m4a":"audio/x-m4a","mp4a":"audio/mp4","mpga":"audio/mpeg","mp2":"audio/mpeg","mp2a":"audio/mpeg","m2a":"audio/mpeg","m3a":"audio/mpeg","oga":"audio/ogg","ogg":"audio/ogg","spx":"audio/ogg","s3m":"audio/s3m","sil":"audio/silk","uva":"audio/vnd.dece.audio","uvva":"audio/vnd.dece.audio","eol":"audio/vnd.digital-winds","dra":"audio/vnd.dra","dts":"audio/vnd.dts","dtshd":"audio/vnd.dts.hd","lvp":"audio/vnd.lucent.voice","pya":"audio/vnd.ms-playready.media.pya","ecelp4800":"audio/vnd.nuera.ecelp4800","ecelp7470":"audio/vnd.nuera.ecelp7470","ecelp9600":"audio/vnd.nuera.ecelp9600","rip":"audio/vnd.rip","wav":"audio/x-wav","weba":"audio/webm","aac":"audio/x-aac","aif":"audio/x-aiff","aiff":"audio/x-aiff","aifc":"audio/x-aiff","caf":"audio/x-caf","flac":"audio/x-flac","mka":"audio/x-matroska","m3u":"audio/x-mpegurl","wax":"audio/x-ms-wax","wma":"audio/x-ms-wma","ram":"audio/x-pn-realaudio","ra":"audio/x-realaudio","rmp":"audio/x-pn-realaudio-plugin","xm":"audio/xm","cdx":"chemical/x-cdx","cif":"chemical/x-cif","cmdf":"chemical/x-cmdf","cml":"chemical/x-cml","csml":"chemical/x-csml","xyz":"chemical/x-xyz","bmp":"image/x-ms-bmp","cgm":"image/cgm","g3":"image/g3fax","gif":"image/gif","ief":"image/ief","jpeg":"image/jpeg","jpg":"image/jpeg","jpe":"image/jpeg","ktx":"image/ktx","png":"image/png","btif":"image/prs.btif","sgi":"image/sgi","svg":"image/svg+xml","svgz":"image/svg+xml","tiff":"image/tiff","tif":"image/tiff","psd":"image/vnd.adobe.photoshop","uvi":"image/vnd.dece.graphic","uvvi":"image/vnd.dece.graphic","uvg":"image/vnd.dece.graphic","uvvg":"image/vnd.dece.graphic","djvu":"image/vnd.djvu","djv":"image/vnd.djvu","sub":"text/vnd.dvb.subtitle","dwg":"image/vnd.dwg","dxf":"image/vnd.dxf","fbs":"image/vnd.fastbidsheet","fpx":"image/vnd.fpx","fst":"image/vnd.fst","mmr":"image/vnd.fujixerox.edmics-mmr","rlc":"image/vnd.fujixerox.edmics-rlc","mdi":"image/vnd.ms-modi","wdp":"image/vnd.ms-photo","npx":"image/vnd.net-fpx","wbmp":"image/vnd.wap.wbmp","xif":"image/vnd.xiff","webp":"image/webp","3ds":"image/x-3ds","ras":"image/x-cmu-raster","cmx":"image/x-cmx","fh":"image/x-freehand","fhc":"image/x-freehand","fh4":"image/x-freehand","fh5":"image/x-freehand","fh7":"image/x-freehand","ico":"image/x-icon","jng":"image/x-jng","sid":"image/x-mrsid-image","pcx":"image/x-pcx","pic":"image/x-pict","pct":"image/x-pict","pnm":"image/x-portable-anymap","pbm":"image/x-portable-bitmap","pgm":"image/x-portable-graymap","ppm":"image/x-portable-pixmap","rgb":"image/x-rgb","tga":"image/x-tga","xbm":"image/x-xbitmap","xpm":"image/x-xpixmap","xwd":"image/x-xwindowdump","eml":"message/rfc822","mime":"message/rfc822","igs":"model/iges","iges":"model/iges","msh":"model/mesh","mesh":"model/mesh","silo":"model/mesh","dae":"model/vnd.collada+xml","dwf":"model/vnd.dwf","gdl":"model/vnd.gdl","gtw":"model/vnd.gtw","mts":"model/vnd.mts","vtu":"model/vnd.vtu","wrl":"model/vrml","vrml":"model/vrml","x3db":"model/x3d+binary","x3dbz":"model/x3d+binary","x3dv":"model/x3d+vrml","x3dvz":"model/x3d+vrml","x3d":"model/x3d+xml","x3dz":"model/x3d+xml","appcache":"text/cache-manifest","manifest":"text/cache-manifest","ics":"text/calendar","ifb":"text/calendar","coffee":"text/coffeescript","litcoffee":"text/coffeescript","css":"text/css","csv":"text/csv","hjson":"text/hjson","html":"text/html","htm":"text/html","shtml":"text/html","jade":"text/jade","jsx":"text/jsx","less":"text/less","mml":"text/mathml","n3":"text/n3","txt":"text/plain","text":"text/plain","conf":"text/plain","def":"text/plain","list":"text/plain","log":"text/plain","in":"text/plain","ini":"text/plain","dsc":"text/prs.lines.tag","rtx":"text/richtext","sgml":"text/sgml","sgm":"text/sgml","slim":"text/slim","slm":"text/slim","stylus":"text/stylus","styl":"text/stylus","tsv":"text/tab-separated-values","t":"text/troff","tr":"text/troff","roff":"text/troff","man":"text/troff","me":"text/troff","ms":"text/troff","ttl":"text/turtle","uri":"text/uri-list","uris":"text/uri-list","urls":"text/uri-list","vcard":"text/vcard","curl":"text/vnd.curl","dcurl":"text/vnd.curl.dcurl","mcurl":"text/vnd.curl.mcurl","scurl":"text/vnd.curl.scurl","fly":"text/vnd.fly","flx":"text/vnd.fmi.flexstor","gv":"text/vnd.graphviz","3dml":"text/vnd.in3d.3dml","spot":"text/vnd.in3d.spot","jad":"text/vnd.sun.j2me.app-descriptor","wml":"text/vnd.wap.wml","wmls":"text/vnd.wap.wmlscript","vtt":"text/vtt","s":"text/x-asm","asm":"text/x-asm","c":"text/x-c","cc":"text/x-c","cxx":"text/x-c","cpp":"text/x-c","h":"text/x-c","hh":"text/x-c","dic":"text/x-c","htc":"text/x-component","f":"text/x-fortran","for":"text/x-fortran","f77":"text/x-fortran","f90":"text/x-fortran","hbs":"text/x-handlebars-template","java":"text/x-java-source","lua":"text/x-lua","markdown":"text/x-markdown","md":"text/x-markdown","mkd":"text/x-markdown","nfo":"text/x-nfo","opml":"text/x-opml","p":"text/x-pascal","pas":"text/x-pascal","pde":"text/x-processing","sass":"text/x-sass","scss":"text/x-scss","etx":"text/x-setext","sfv":"text/x-sfv","ymp":"text/x-suse-ymp","uu":"text/x-uuencode","vcs":"text/x-vcalendar","vcf":"text/x-vcard","yaml":"text/yaml","yml":"text/yaml","3gp":"video/3gpp","3g2":"video/3gpp2","h261":"video/h261","h263":"video/h263","h264":"video/h264","jpgv":"video/jpeg","jpm":"video/jpm","jpgm":"video/jpm","mj2":"video/mj2","mjp2":"video/mj2","ts":"video/mp2t","mp4":"video/mp4","mp4v":"video/mp4","mpg4":"video/mp4","mpeg":"video/mpeg","mpg":"video/mpeg","mpe":"video/mpeg","m1v":"video/mpeg","m2v":"video/mpeg","ogv":"video/ogg","qt":"video/quicktime","mov":"video/quicktime","uvh":"video/vnd.dece.hd","uvvh":"video/vnd.dece.hd","uvm":"video/vnd.dece.mobile","uvvm":"video/vnd.dece.mobile","uvp":"video/vnd.dece.pd","uvvp":"video/vnd.dece.pd","uvs":"video/vnd.dece.sd","uvvs":"video/vnd.dece.sd","uvv":"video/vnd.dece.video","uvvv":"video/vnd.dece.video","dvb":"video/vnd.dvb.file","fvt":"video/vnd.fvt","mxu":"video/vnd.mpegurl","m4u":"video/vnd.mpegurl","pyv":"video/vnd.ms-playready.media.pyv","uvu":"video/vnd.uvvu.mp4","uvvu":"video/vnd.uvvu.mp4","viv":"video/vnd.vivo","webm":"video/webm","f4v":"video/x-f4v","fli":"video/x-fli","flv":"video/x-flv","m4v":"video/x-m4v","mkv":"video/x-matroska","mk3d":"video/x-matroska","mks":"video/x-matroska","mng":"video/x-mng","asf":"video/x-ms-asf","asx":"video/x-ms-asf","vob":"video/x-ms-vob","wm":"video/x-ms-wm","wmv":"video/x-ms-wmv","wmx":"video/x-ms-wmx","wvx":"video/x-ms-wvx","avi":"video/x-msvideo","movie":"video/x-sgi-movie","smv":"video/x-smv","ice":"x-conference/x-cooltalk"} /***/ }), -/* 101 */ +/* 104 */ /***/ (function(module, exports) { /* eslint complexity: 0 */ @@ -21112,34 +22098,14 @@ module.exports = mimeOfBuffer; /***/ }), -/* 102 */ +/* 105 */ /***/ (function(module, exports, __webpack_require__) { -const fs = __webpack_require__(26); -const path = __webpack_require__(19); -const mime = __webpack_require__(51); +const fs = __webpack_require__(27); +const path = __webpack_require__(20); +const mime = __webpack_require__(53); const EventEmitter = __webpack_require__(9); -const Stream = __webpack_require__(31); - -class ResponseStream extends Stream.Readable { - constructor() { - super(); - this.statusCode = 200; - this.status = 'OK'; - } - - error(code, message) { - this.statusCode = code; - this.status = message; - return this; - } - - on(event, handler) { - if (['end', 'open'].includes(event)) handler(); - } - - _read() {} // eslint-disable-line no-empty-function -} +const ResponseStream = __webpack_require__(54); const methods = { GET: (filename, req) => { @@ -21245,25 +22211,165 @@ module.exports = { /***/ }), -/* 103 */ +/* 106 */ /***/ (function(module, exports, __webpack_require__) { -/* WEBPACK VAR INJECTION */(function(process) {const os = __webpack_require__(27); -const EventEmitter = __webpack_require__(9).EventEmitter; +const http = __webpack_require__(36); +const Stream = __webpack_require__(25); +const ResponseStream = __webpack_require__(54); +const http2 = (() => { + try { + return __webpack_require__(!(function webpackMissingModule() { var e = new Error("Cannot find module \"http2\""); e.code = 'MODULE_NOT_FOUND'; throw e; }())); + } catch (err) { + return { + constants: {}, + connect: () => { + throw new Error('Please run node with --expose-http2 to use the http2 request transport'); + }, + }; + } +})(); + +const { + HTTP2_HEADER_PATH, + HTTP2_HEADER_METHOD, + HTTP2_HEADER_STATUS, +} = http2.constants; + +class Http2Request extends Stream.Transform { + constructor(options) { + super(); + this.options = options; + this.headers = { + [HTTP2_HEADER_PATH]: options.pathname, + [HTTP2_HEADER_METHOD]: options.method.toUpperCase(), + }; + } + + setHeader(name, value) { + this.headers[name.toLowerCase()] = value; + } + + getHeader(name) { + return this.headers[name]; + } + + end() { + const options = this.options; + const client = http2.connect(`${options.protocol}//${options.hostname}`); + + const req = client.request(this.headers); + + const stream = new ResponseStream(); + + client.on('error', (e) => this.emit('error', e)); + client.on('frameError', (e) => this.emit('error', e)); + + req.on('response', (headers) => { + req.on('data', (chunk) => { + if (!stream.push(chunk)) req.pause(); + }); + + stream.headers = headers; + stream.statusCode = headers[HTTP2_HEADER_STATUS]; + stream.status = http.STATUS_CODES[stream.statusCode]; + + stream.on('error', (err) => { + stream.statusCode = 400; + stream.status = err.message; + }); + + this.emit('response', stream); + }); + + req.on('end', () => { + this.emit('end'); + stream.emit('end'); + client.destroy(); + }); + + return req; + } +} + + +function request(options) { + return new Http2Request(options); +} + +module.exports = { request }; + + +/***/ }), +/* 107 */ +/***/ (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'; + + +/***/ }), +/* 108 */ +/***/ (function(module, exports, __webpack_require__) { + +/* WEBPACK VAR INJECTION */(function(process) {const EventEmitter = __webpack_require__(9); const Constants = __webpack_require__(0); const Permissions = __webpack_require__(11); const Util = __webpack_require__(4); -const RESTManager = __webpack_require__(53); -const ClientDataManager = __webpack_require__(114); -const ClientManager = __webpack_require__(115); -const ClientDataResolver = __webpack_require__(41); -const ClientVoiceManager = __webpack_require__(156); -const WebSocketManager = __webpack_require__(157); -const ActionsManager = __webpack_require__(158); +const RESTManager = __webpack_require__(56); +const ClientDataManager = __webpack_require__(119); +const ClientManager = __webpack_require__(120); +const ClientDataResolver = __webpack_require__(38); +const ClientVoiceManager = __webpack_require__(164); +const WebSocketManager = __webpack_require__(165); +const ActionsManager = __webpack_require__(166); const Collection = __webpack_require__(3); -const Presence = __webpack_require__(15).Presence; -const ShardClientUtil = __webpack_require__(187); -const VoiceBroadcast = __webpack_require__(188); +const Presence = __webpack_require__(16).Presence; +const ShardClientUtil = __webpack_require__(195); +const VoiceBroadcast = __webpack_require__(196); /** * The main hub for interacting with the Discord API, and the starting point for any bot. @@ -21277,8 +22383,8 @@ class Client extends EventEmitter { super(); // Obtain shard details from environment - if (!options.shardId && 'SHARD_ID' in process.env) options.shardId = Number(process.env.SHARD_ID); - if (!options.shardCount && 'SHARD_COUNT' in process.env) options.shardCount = Number(process.env.SHARD_COUNT); + if (!options.shardId && 'SHARD_ID' in Object({"__DISCORD_WEBPACK__":"true"})) options.shardId = Number(Object({"__DISCORD_WEBPACK__":"true"}).SHARD_ID); + if (!options.shardCount && 'SHARD_COUNT' in Object({"__DISCORD_WEBPACK__":"true"})) options.shardCount = Number(Object({"__DISCORD_WEBPACK__":"true"}).SHARD_COUNT); /** * The options the client was instantiated with @@ -21370,13 +22476,14 @@ class Client extends EventEmitter { */ this.presences = new Collection(); - if (!this.token && 'CLIENT_TOKEN' in process.env) { + Object.defineProperty(this, 'token', { writable: true }); + if (!this.token && 'CLIENT_TOKEN' in Object({"__DISCORD_WEBPACK__":"true"})) { /** * Authorization token for the logged in user/bot * This should be kept private at all times. * @type {?string} */ - this.token = process.env.CLIENT_TOKEN; + this.token = Object({"__DISCORD_WEBPACK__":"true"}).CLIENT_TOKEN; } else { this.token = null; } @@ -21499,7 +22606,7 @@ class Client extends EventEmitter { * @readonly */ get browser() { - return os.platform() === 'browser'; + return typeof window !== 'undefined'; } /** @@ -21669,9 +22776,9 @@ class Client extends EventEmitter { */ setTimeout(fn, delay, ...args) { const timeout = setTimeout(() => { - fn(); + fn(...args); this._timeouts.delete(timeout); - }, delay, ...args); + }, delay); this._timeouts.add(timeout); return timeout; } @@ -21799,7 +22906,7 @@ module.exports = Client; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(7))) /***/ }), -/* 104 */ +/* 109 */ /***/ (function(module, exports) { module.exports = function isBuffer(arg) { @@ -21810,7 +22917,7 @@ module.exports = function isBuffer(arg) { } /***/ }), -/* 105 */ +/* 110 */ /***/ (function(module, exports) { if (typeof Object.create === 'function') { @@ -21839,7 +22946,7 @@ if (typeof Object.create === 'function') { /***/ }), -/* 106 */ +/* 111 */ /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(process) {const Constants = __webpack_require__(0); @@ -21871,11 +22978,11 @@ module.exports = UserAgentManager; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(7))) /***/ }), -/* 107 */ +/* 112 */ /***/ (function(module, exports, __webpack_require__) { -const querystring = __webpack_require__(34); -const long = __webpack_require__(35); +const querystring = __webpack_require__(35); +const long = __webpack_require__(37); const Permissions = __webpack_require__(11); const Constants = __webpack_require__(0); const Endpoints = Constants.Endpoints; @@ -21883,19 +22990,19 @@ const Collection = __webpack_require__(3); const Snowflake = __webpack_require__(8); const Util = __webpack_require__(4); -const User = __webpack_require__(13); +const User = __webpack_require__(14); const GuildMember = __webpack_require__(24); const Message = __webpack_require__(22); -const Role = __webpack_require__(14); -const Invite = __webpack_require__(60); -const Webhook = __webpack_require__(38); -const UserProfile = __webpack_require__(108); -const OAuth2Application = __webpack_require__(39); -const Channel = __webpack_require__(16); -const GroupDMChannel = __webpack_require__(40); -const Guild = __webpack_require__(28); -const VoiceRegion = __webpack_require__(110); -const GuildAuditLogs = __webpack_require__(63); +const Role = __webpack_require__(15); +const Invite = __webpack_require__(63); +const Webhook = __webpack_require__(41); +const UserProfile = __webpack_require__(113); +const OAuth2Application = __webpack_require__(42); +const Channel = __webpack_require__(17); +const GroupDMChannel = __webpack_require__(43); +const Guild = __webpack_require__(30); +const VoiceRegion = __webpack_require__(115); +const GuildAuditLogs = __webpack_require__(66); class RESTMethods { constructor(restManager) { @@ -21978,12 +23085,12 @@ class RESTMethods { if (content instanceof Array) { const messages = []; (function sendChunk(list, index) { - const options = index === list.length ? { tts, embed } : { tts }; - chan.send(list[index], options, index === list.length ? files : null).then(message => { + const options = index === list.length - 1 ? { tts, embed, files } : { tts }; + chan.send(list[index], options).then(message => { messages.push(message); if (index >= list.length - 1) return resolve(messages); return sendChunk(list, ++index); - }); + }).catch(reject); }(content, 0)); } else { this.rest.makeRequest('post', Endpoints.Channel(chan).messages, true, { @@ -22103,6 +23210,7 @@ class RESTMethods { embed_type: options.embedType, attachment_filename: options.attachmentFilename, attachment_extension: options.attachmentExtension, + include_nsfw: options.nsfw, }; for (const key in options) if (options[key] === undefined) delete options[key]; @@ -22127,13 +23235,13 @@ class RESTMethods { }); } - createChannel(guild, channelName, channelType, overwrites) { + createChannel(guild, channelName, channelType, overwrites, reason) { if (overwrites instanceof Collection) overwrites = overwrites.array(); return this.rest.makeRequest('post', Endpoints.Guild(guild).channels, true, { name: channelName, type: channelType, permission_overwrites: overwrites, - }).then(data => this.client.actions.ChannelCreate.handle(data).channel); + }, undefined, reason).then(data => this.client.actions.ChannelCreate.handle(data).channel); } createDM(recipient) { @@ -22160,29 +23268,42 @@ class RESTMethods { .then(() => channel); } + removeUserFromGroupDM(channel, userId) { + return this.rest.makeRequest('delete', Endpoints.Channel(channel).Recipient(userId), true) + .then(() => channel); + } + + updateGroupDMChannel(channel, _data) { + const data = {}; + data.name = _data.name; + data.icon = _data.icon; + return this.rest.makeRequest('patch', Endpoints.Channel(channel), true, data).then(() => channel); + } + getExistingDM(recipient) { return this.client.channels.find(channel => channel.recipient && channel.recipient.id === recipient.id ); } - deleteChannel(channel) { + deleteChannel(channel, reason) { if (channel instanceof User || channel instanceof GuildMember) channel = this.getExistingDM(channel); if (!channel) return Promise.reject(new Error('No channel to delete.')); - return this.rest.makeRequest('delete', Endpoints.Channel(channel), true).then(data => { - data.id = channel.id; - return this.client.actions.ChannelDelete.handle(data).channel; - }); + return this.rest.makeRequest('delete', Endpoints.Channel(channel), true, undefined, undefined, reason) + .then(data => { + data.id = channel.id; + return this.client.actions.ChannelDelete.handle(data).channel; + }); } - updateChannel(channel, _data) { + updateChannel(channel, _data, reason) { const data = {}; data.name = (_data.name || channel.name).trim(); data.topic = _data.topic || channel.topic; data.position = _data.position || channel.position; data.bitrate = _data.bitrate || channel.bitrate; data.user_limit = _data.userLimit || channel.userLimit; - return this.rest.makeRequest('patch', Endpoints.Channel(channel), true, data).then(newData => + return this.rest.makeRequest('patch', Endpoints.Channel(channel), true, data, undefined, reason).then(newData => this.client.actions.ChannelUpdate.handle(newData).updated ); } @@ -22237,7 +23358,7 @@ class RESTMethods { const user = this.client.user; const data = {}; data.username = _data.username || user.username; - data.avatar = this.client.resolver.resolveBase64(_data.avatar) || user.avatar; + data.avatar = typeof _data.avatar === 'undefined' ? user.avatar : this.client.resolver.resolveBase64(_data.avatar); if (!user.bot) { data.email = _data.email || user.email; data.password = password; @@ -22248,58 +23369,57 @@ class RESTMethods { ); } - updateGuild(guild, _data) { - const data = {}; - if (_data.name) data.name = _data.name; - if (_data.region) data.region = _data.region; - if (_data.verificationLevel) data.verification_level = Number(_data.verificationLevel); - if (_data.afkChannel) data.afk_channel_id = this.client.resolver.resolveChannel(_data.afkChannel).id; - if (_data.afkTimeout) data.afk_timeout = Number(_data.afkTimeout); - if (_data.icon) data.icon = this.client.resolver.resolveBase64(_data.icon); - if (_data.owner) data.owner_id = this.client.resolver.resolveUser(_data.owner).id; - if (_data.splash) data.splash = this.client.resolver.resolveBase64(_data.splash); - return this.rest.makeRequest('patch', Endpoints.Guild(guild), true, data).then(newData => + updateGuild(guild, data, reason) { + return this.rest.makeRequest('patch', Endpoints.Guild(guild), true, data, undefined, reason).then(newData => this.client.actions.GuildUpdate.handle(newData).updated ); } kickGuildMember(guild, member, reason) { - const url = `${Endpoints.Guild(guild).Member(member)}?reason=${reason}`; - return this.rest.makeRequest('delete', url, true).then(() => - this.client.actions.GuildMemberRemove.handle({ - guild_id: guild.id, - user: member.user, - }).member - ); + return this.rest.makeRequest( + 'delete', Endpoints.Guild(guild).Member(member), true, + undefined, undefined, reason) + .then(() => + this.client.actions.GuildMemberRemove.handle({ + guild_id: guild.id, + user: member.user, + }).member + ); } - createGuildRole(guild, data) { + createGuildRole(guild, data, reason) { if (data.color) data.color = this.client.resolver.resolveColor(data.color); if (data.permissions) data.permissions = Permissions.resolve(data.permissions); - return this.rest.makeRequest('post', Endpoints.Guild(guild).roles, true, data).then(role => - this.client.actions.GuildRoleCreate.handle({ + return this.rest.makeRequest('post', Endpoints.Guild(guild).roles, true, data, undefined, reason).then(r => { + const { role } = this.client.actions.GuildRoleCreate.handle({ guild_id: guild.id, - role, - }).role - ); + role: r, + }); + if (data.position) return role.setPosition(data.position, reason); + return role; + }); } - deleteGuildRole(role) { - return this.rest.makeRequest('delete', Endpoints.Guild(role.guild).Role(role.id), true).then(() => - this.client.actions.GuildRoleDelete.handle({ - guild_id: role.guild.id, - role_id: role.id, - }).role - ); + deleteGuildRole(role, reason) { + return this.rest.makeRequest( + 'delete', Endpoints.Guild(role.guild).Role(role.id), true, + undefined, undefined, reason) + .then(() => + this.client.actions.GuildRoleDelete.handle({ + guild_id: role.guild.id, + role_id: role.id, + }).role + ); } setChannelOverwrite(channel, payload) { return this.rest.makeRequest('put', `${Endpoints.Channel(channel).permissions}/${payload.id}`, true, payload); } - deletePermissionOverwrites(overwrite) { + deletePermissionOverwrites(overwrite, reason) { return this.rest.makeRequest( - 'delete', `${Endpoints.Channel(overwrite.channel).permissions}/${overwrite.id}`, true + 'delete', `${Endpoints.Channel(overwrite.channel).permissions}/${overwrite.id}`, + true, undefined, undefined, reason ).then(() => overwrite); } @@ -22340,8 +23460,11 @@ class RESTMethods { }); } - updateGuildMember(member, data) { - if (data.channel) data.channel_id = this.client.resolver.resolveChannel(data.channel).id; + updateGuildMember(member, data, reason) { + if (data.channel) { + data.channel_id = this.client.resolver.resolveChannel(data.channel).id; + data.channel = null; + } if (data.roles) data.roles = data.roles.map(role => role instanceof Role ? role.id : role); let endpoint = Endpoints.Member(member); @@ -22353,12 +23476,12 @@ class RESTMethods { } } - return this.rest.makeRequest('patch', endpoint, true, data).then(newData => + return this.rest.makeRequest('patch', endpoint, true, data, undefined, reason).then(newData => member.guild._updateMember(member, newData).mem ); } - addMemberRole(member, role) { + addMemberRole(member, role, reason) { return new Promise((resolve, reject) => { if (member._roles.includes(role.id)) return resolve(member); @@ -22373,15 +23496,16 @@ class RESTMethods { const timeout = this.client.setTimeout(() => this.client.removeListener(Constants.Events.GUILD_MEMBER_UPDATE, listener), 10e3); - return this.rest.makeRequest('put', Endpoints.Member(member).Role(role.id), true).catch(err => { - this.client.removeListener(Constants.Events.GUILD_BAN_REMOVE, listener); - this.client.clearTimeout(timeout); - reject(err); - }); + return this.rest.makeRequest('put', Endpoints.Member(member).Role(role.id), true, undefined, undefined, reason) + .catch(err => { + this.client.removeListener(Constants.Events.GUILD_BAN_REMOVE, listener); + this.client.clearTimeout(timeout); + reject(err); + }); }); } - removeMemberRole(member, role) { + removeMemberRole(member, role, reason) { return new Promise((resolve, reject) => { if (!member._roles.includes(role.id)) return resolve(member); @@ -22396,11 +23520,12 @@ class RESTMethods { const timeout = this.client.setTimeout(() => this.client.removeListener(Constants.Events.GUILD_MEMBER_UPDATE, listener), 10e3); - return this.rest.makeRequest('delete', Endpoints.Member(member).Role(role.id), true).catch(err => { - this.client.removeListener(Constants.Events.GUILD_BAN_REMOVE, listener); - this.client.clearTimeout(timeout); - reject(err); - }); + return this.rest.makeRequest('delete', Endpoints.Member(member).Role(role.id), true, undefined, undefined, reason) + .catch(err => { + this.client.removeListener(Constants.Events.GUILD_BAN_REMOVE, listener); + this.client.clearTimeout(timeout); + reject(err); + }); }); } @@ -22424,7 +23549,7 @@ class RESTMethods { }); } - unbanGuildMember(guild, member) { + unbanGuildMember(guild, member, reason) { return new Promise((resolve, reject) => { const id = this.client.resolver.resolveUserID(member); if (!id) throw new Error('Couldn\'t resolve the user ID to unban.'); @@ -22443,11 +23568,12 @@ class RESTMethods { reject(new Error('Took too long to receive the ban remove event.')); }, 10000); - this.rest.makeRequest('delete', `${Endpoints.Guild(guild).bans}/${id}`, true).catch(err => { - this.client.removeListener(Constants.Events.GUILD_BAN_REMOVE, listener); - this.client.clearTimeout(timeout); - reject(err); - }); + this.rest.makeRequest('delete', `${Endpoints.Guild(guild).bans}/${id}`, true, undefined, undefined, reason) + .catch(err => { + this.client.removeListener(Constants.Events.GUILD_BAN_REMOVE, listener); + this.client.clearTimeout(timeout); + reject(err); + }); }); } @@ -22463,7 +23589,7 @@ class RESTMethods { ); } - updateGuildRole(role, _data) { + updateGuildRole(role, _data, reason) { const data = {}; data.name = _data.name || role.name; data.position = typeof _data.position !== 'undefined' ? _data.position : role.position; @@ -22474,12 +23600,13 @@ class RESTMethods { if (_data.permissions) data.permissions = Permissions.resolve(_data.permissions); else data.permissions = role.permissions; - return this.rest.makeRequest('patch', Endpoints.Guild(role.guild).Role(role.id), true, data).then(_role => - this.client.actions.GuildRoleUpdate.handle({ - role: _role, - guild_id: role.guild.id, - }).updated - ); + return this.rest.makeRequest('patch', Endpoints.Guild(role.guild).Role(role.id), true, data, undefined, reason) + .then(_role => + this.client.actions.GuildRoleUpdate.handle({ + role: _role, + guild_id: role.guild.id, + }).updated + ); } pinMessage(message) { @@ -22496,17 +23623,19 @@ class RESTMethods { return this.rest.makeRequest('get', Endpoints.Channel(channel).pins, true); } - createChannelInvite(channel, options) { + createChannelInvite(channel, options, reason) { const payload = {}; payload.temporary = options.temporary; payload.max_age = options.maxAge; payload.max_uses = options.maxUses; - return this.rest.makeRequest('post', Endpoints.Channel(channel).invites, true, payload) + payload.unique = options.unique; + return this.rest.makeRequest('post', Endpoints.Channel(channel).invites, true, payload, undefined, reason) .then(invite => new Invite(this.client, invite)); } - deleteInvite(invite) { - return this.rest.makeRequest('delete', Endpoints.Invite(invite.code), true).then(() => invite); + deleteInvite(invite, reason) { + return this.rest.makeRequest('delete', Endpoints.Invite(invite.code), true, undefined, undefined, reason) + .then(() => invite); } getInvite(code) { @@ -22526,28 +23655,31 @@ class RESTMethods { }); } - pruneGuildMembers(guild, days, dry) { - return this.rest.makeRequest(dry ? 'get' : 'post', `${Endpoints.Guild(guild).prune}?days=${days}`, true) + pruneGuildMembers(guild, days, dry, reason) { + return this.rest.makeRequest(dry ? + 'get' : + 'post', + `${Endpoints.Guild(guild).prune}?days=${days}`, true, undefined, undefined, reason) .then(data => data.pruned); } - createEmoji(guild, image, name, roles) { + createEmoji(guild, image, name, roles, reason) { const data = { image, name }; if (roles) data.roles = roles.map(r => r.id ? r.id : r); - return this.rest.makeRequest('post', Endpoints.Guild(guild).emojis, true, data) + return this.rest.makeRequest('post', Endpoints.Guild(guild).emojis, true, data, undefined, reason) .then(emoji => this.client.actions.GuildEmojiCreate.handle(guild, emoji).emoji); } - updateEmoji(emoji, _data) { + updateEmoji(emoji, _data, reason) { const data = {}; if (_data.name) data.name = _data.name; if (_data.roles) data.roles = _data.roles.map(r => r.id ? r.id : r); - return this.rest.makeRequest('patch', Endpoints.Guild(emoji.guild).Emoji(emoji.id), true, data) + return this.rest.makeRequest('patch', Endpoints.Guild(emoji.guild).Emoji(emoji.id), true, data, undefined, reason) .then(newEmoji => this.client.actions.GuildEmojiUpdate.handle(emoji, newEmoji).emoji); } - deleteEmoji(emoji) { - return this.rest.makeRequest('delete', Endpoints.Guild(emoji.guild).Emoji(emoji.id), true) + deleteEmoji(emoji, reason) { + return this.rest.makeRequest('delete', Endpoints.Guild(emoji.guild).Emoji(emoji.id), true, undefined, reason) .then(() => this.client.actions.GuildEmojiDelete.handle(emoji).data); } @@ -22590,8 +23722,8 @@ class RESTMethods { }); } - createWebhook(channel, name, avatar) { - return this.rest.makeRequest('post', Endpoints.Channel(channel).webhooks, true, { name, avatar }) + createWebhook(channel, name, avatar, reason) { + return this.rest.makeRequest('post', Endpoints.Channel(channel).webhooks, true, { name, avatar }, undefined, reason) .then(data => new Webhook(this.client, data)); } @@ -22606,25 +23738,36 @@ class RESTMethods { }); } - deleteWebhook(webhook) { - return this.rest.makeRequest('delete', Endpoints.Webhook(webhook.id, webhook.token), false); + deleteWebhook(webhook, reason) { + return this.rest.makeRequest( + 'delete', Endpoints.Webhook(webhook.id, webhook.token), + false, undefined, undefined, reason); } - sendWebhookMessage(webhook, content, { avatarURL, tts, disableEveryone, embeds, username } = {}, file = null) { - username = username || webhook.name; - if (typeof content !== 'undefined') content = this.client.resolver.resolveString(content); - if (content) { - if (disableEveryone || (typeof disableEveryone === 'undefined' && this.client.options.disableEveryone)) { - content = content.replace(/@(everyone|here)/g, '@\u200b$1'); + sendWebhookMessage(webhook, content, { avatarURL, tts, embeds, username } = {}, files = null) { + return new Promise((resolve, reject) => { + username = username || webhook.name; + + if (content instanceof Array) { + const messages = []; + (function sendChunk(list, index) { + const options = index === list.length - 1 ? { tts, embeds, files } : { tts }; + webhook.send(list[index], options).then(message => { + messages.push(message); + if (index >= list.length - 1) return resolve(messages); + return sendChunk(list, ++index); + }).catch(reject); + }(content, 0)); + } else { + this.rest.makeRequest('post', `${Endpoints.Webhook(webhook.id, webhook.token)}?wait=true`, false, { + username, + avatar_url: avatarURL, + content, + tts, + embeds, + }, files).then(resolve, reject); } - } - return this.rest.makeRequest('post', `${Endpoints.Webhook(webhook.id, webhook.token)}?wait=true`, false, { - username, - avatar_url: avatarURL, - content, - tts, - embeds, - }, file); + }); } sendSlackWebhookMessage(webhook, body) { @@ -22639,12 +23782,13 @@ class RESTMethods { ); } - fetchMeMentions(options) { - if (options.guild) options.guild = options.guild.id ? options.guild.id : options.guild; + fetchMentions(options) { + if (options.guild instanceof Guild) options.guild = options.guild.id; + Util.mergeDefault({ limit: 25, roles: true, everyone: true, guild: null }, options); + return this.rest.makeRequest( - 'get', - Endpoints.User('@me').mentions(options.limit, options.roles, options.everyone, options.guild) - ).then(res => res.body.map(m => new Message(this.client.channels.get(m.channel_id), m, this.client))); + 'get', Endpoints.User('@me').Mentions(options.limit, options.roles, options.everyone, options.guild), true + ).then(data => data.map(m => new Message(this.client.channels.get(m.channel_id), m, this.client))); } addFriend(user) { @@ -22709,7 +23853,7 @@ class RESTMethods { 'put', Endpoints.Message(message).Reaction(emoji).User('@me'), true ).then(() => message._addReaction(Util.parseEmoji(emoji), message.client.user) - ); + ); } removeMessageReaction(message, emoji, userID) { @@ -22740,7 +23884,8 @@ class RESTMethods { } resetApplication(id) { - return this.rest.makeRequest('post', Endpoints.OAUTH2.Application(id).reset, true) + return this.rest.makeRequest('post', Endpoints.OAUTH2.Application(id).resetToken, true) + .then(() => this.rest.makeRequest('post', Endpoints.OAUTH2.Application(id).resetSecret, true)) .then(app => new OAuth2Application(this.client, app)); } @@ -22770,17 +23915,21 @@ class RESTMethods { patchUserSettings(data) { return this.rest.makeRequest('patch', Constants.Endpoints.User('@me').settings, true, data); } + + patchClientUserGuildSettings(guildID, data) { + return this.rest.makeRequest('patch', Constants.Endpoints.User('@me').Guild(guildID).settings, true, data); + } } module.exports = RESTMethods; /***/ }), -/* 108 */ +/* 113 */ /***/ (function(module, exports, __webpack_require__) { const Collection = __webpack_require__(3); -const UserConnection = __webpack_require__(109); +const UserConnection = __webpack_require__(114); /** * Represents a user's profile on Discord. @@ -22794,7 +23943,7 @@ class UserProfile { this.user = user; /** - * The client that created the instance of the the UserProfile. + * The client that created the instance of the UserProfile * @name UserProfile#client * @type {Client} * @readonly @@ -22844,7 +23993,7 @@ module.exports = UserProfile; /***/ }), -/* 109 */ +/* 114 */ /***/ (function(module, exports) { /** @@ -22898,7 +24047,7 @@ module.exports = UserConnection; /***/ }), -/* 110 */ +/* 115 */ /***/ (function(module, exports) { /** @@ -22954,11 +24103,11 @@ module.exports = VoiceRegion; /***/ }), -/* 111 */ +/* 116 */ /***/ (function(module, exports, __webpack_require__) { -const RequestHandler = __webpack_require__(64); -const DiscordAPIError = __webpack_require__(65); +const RequestHandler = __webpack_require__(67); +const DiscordAPIError = __webpack_require__(44); /** * Handles API Requests sequentially, i.e. we wait until the current request is finished before moving onto @@ -23023,8 +24172,11 @@ class SequentialRequestHandler extends RequestHandler { resolve(); }, Number(res.headers['retry-after']) + this.restManager.client.options.restTimeOffset); if (res.headers['x-ratelimit-global']) this.globalLimit = true; + } else if (err.status >= 500 && err.status < 600) { + this.queue.unshift(item); + this.restManager.client.setTimeout(resolve, 1e3 + this.client.options.restTimeOffset); } else { - item.reject(err.status >= 400 && err.status < 500 ? new DiscordAPIError(res.body) : err); + item.reject(err.status >= 400 && err.status < 500 ? new DiscordAPIError(res.request.path, res.body) : err); resolve(err); } } else { @@ -23058,11 +24210,11 @@ module.exports = SequentialRequestHandler; /***/ }), -/* 112 */ +/* 117 */ /***/ (function(module, exports, __webpack_require__) { -const RequestHandler = __webpack_require__(64); -const DiscordAPIError = __webpack_require__(65); +const RequestHandler = __webpack_require__(67); +const DiscordAPIError = __webpack_require__(44); class BurstRequestHandler extends RequestHandler { constructor(restManager, endpoint) { @@ -23103,8 +24255,14 @@ class BurstRequestHandler extends RequestHandler { this.handle(); this.resetTimeout = null; }, Number(res.headers['retry-after']) + this.client.options.restTimeOffset); + } else if (err.status >= 500 && err.status < 600) { + this.queue.unshift(item); + this.resetTimeout = this.client.setTimeout(() => { + this.handle(); + this.resetTimeout = null; + }, 1e3 + this.client.options.restTimeOffset); } else { - item.reject(err.status === 400 ? new DiscordAPIError(res.body) : err); + item.reject(err.status >= 400 && err.status < 500 ? new DiscordAPIError(res.request.path, res.body) : err); this.handle(); } } else { @@ -23129,14 +24287,14 @@ module.exports = BurstRequestHandler; /***/ }), -/* 113 */ +/* 118 */ /***/ (function(module, exports, __webpack_require__) { -const snekfetch = __webpack_require__(30); +const snekfetch = __webpack_require__(32); const Constants = __webpack_require__(0); class APIRequest { - constructor(rest, method, path, auth, data, files) { + constructor(rest, method, path, auth, data, files, reason) { this.rest = rest; this.client = rest.client; this.method = method; @@ -23145,6 +24303,7 @@ class APIRequest { this.data = data; this.files = files; this.route = this.getRoute(this.path); + this.reason = reason; } getRoute(url) { @@ -23170,6 +24329,7 @@ class APIRequest { const API = `${this.client.options.http.host}/api/v${this.client.options.http.version}`; const request = snekfetch[this.method](`${API}${this.path}`); if (this.auth) request.set('Authorization', this.getAuth()); + if (this.reason) request.set('X-Audit-Log-Reason', encodeURIComponent(this.reason)); 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) request.attach(file.name, file.file, file.name); @@ -23185,19 +24345,19 @@ module.exports = APIRequest; /***/ }), -/* 114 */ +/* 119 */ /***/ (function(module, exports, __webpack_require__) { const Constants = __webpack_require__(0); const Util = __webpack_require__(4); -const Guild = __webpack_require__(28); -const User = __webpack_require__(13); -const DMChannel = __webpack_require__(66); +const Guild = __webpack_require__(30); +const User = __webpack_require__(14); +const DMChannel = __webpack_require__(68); const Emoji = __webpack_require__(23); -const TextChannel = __webpack_require__(67); -const VoiceChannel = __webpack_require__(69); -const GuildChannel = __webpack_require__(29); -const GroupDMChannel = __webpack_require__(40); +const TextChannel = __webpack_require__(69); +const VoiceChannel = __webpack_require__(71); +const GuildChannel = __webpack_require__(31); +const GroupDMChannel = __webpack_require__(43); class ClientDataManager { constructor(client) { @@ -23321,11 +24481,11 @@ module.exports = ClientDataManager; /***/ }), -/* 115 */ +/* 120 */ /***/ (function(module, exports, __webpack_require__) { const Constants = __webpack_require__(0); -const WebSocketConnection = __webpack_require__(70); +const WebSocketConnection = __webpack_require__(72); /** * Manages the state and background tasks of the client. @@ -23369,7 +24529,7 @@ class ClientManager { const gateway = `${res.url}/?v=${protocolVersion}&encoding=${WebSocketConnection.ENCODING}`; this.client.emit(Constants.Events.DEBUG, `Using gateway ${gateway}`); this.client.ws.connect(gateway); - this.client.ws.once('close', event => { + this.client.ws.connection.once('close', event => { if (event.code === 4004) reject(new Error(Constants.Errors.BAD_LOGIN)); if (event.code === 4010) reject(new Error(Constants.Errors.INVALID_SHARD)); if (event.code === 4011) reject(new Error(Constants.Errors.SHARDING_REQUIRED)); @@ -23400,7 +24560,7 @@ module.exports = ClientManager; /***/ }), -/* 116 */ +/* 121 */ /***/ (function(module, exports, __webpack_require__) { const Constants = __webpack_require__(0); @@ -23421,42 +24581,43 @@ class WebSocketPacketManager { this.handlers = {}; this.queue = []; - this.register(Constants.WSEvents.READY, __webpack_require__(117)); - this.register(Constants.WSEvents.RESUMED, __webpack_require__(118)); - this.register(Constants.WSEvents.GUILD_CREATE, __webpack_require__(119)); - this.register(Constants.WSEvents.GUILD_DELETE, __webpack_require__(120)); - this.register(Constants.WSEvents.GUILD_UPDATE, __webpack_require__(121)); - this.register(Constants.WSEvents.GUILD_BAN_ADD, __webpack_require__(122)); - this.register(Constants.WSEvents.GUILD_BAN_REMOVE, __webpack_require__(123)); - this.register(Constants.WSEvents.GUILD_MEMBER_ADD, __webpack_require__(124)); - this.register(Constants.WSEvents.GUILD_MEMBER_REMOVE, __webpack_require__(125)); - this.register(Constants.WSEvents.GUILD_MEMBER_UPDATE, __webpack_require__(126)); - this.register(Constants.WSEvents.GUILD_ROLE_CREATE, __webpack_require__(127)); - this.register(Constants.WSEvents.GUILD_ROLE_DELETE, __webpack_require__(128)); - this.register(Constants.WSEvents.GUILD_ROLE_UPDATE, __webpack_require__(129)); - this.register(Constants.WSEvents.GUILD_EMOJIS_UPDATE, __webpack_require__(130)); - this.register(Constants.WSEvents.GUILD_MEMBERS_CHUNK, __webpack_require__(131)); - this.register(Constants.WSEvents.CHANNEL_CREATE, __webpack_require__(132)); - this.register(Constants.WSEvents.CHANNEL_DELETE, __webpack_require__(133)); - this.register(Constants.WSEvents.CHANNEL_UPDATE, __webpack_require__(134)); - this.register(Constants.WSEvents.CHANNEL_PINS_UPDATE, __webpack_require__(135)); - this.register(Constants.WSEvents.PRESENCE_UPDATE, __webpack_require__(136)); - this.register(Constants.WSEvents.USER_UPDATE, __webpack_require__(137)); - this.register(Constants.WSEvents.USER_NOTE_UPDATE, __webpack_require__(138)); - this.register(Constants.WSEvents.USER_SETTINGS_UPDATE, __webpack_require__(139)); - this.register(Constants.WSEvents.VOICE_STATE_UPDATE, __webpack_require__(140)); - this.register(Constants.WSEvents.TYPING_START, __webpack_require__(141)); - this.register(Constants.WSEvents.MESSAGE_CREATE, __webpack_require__(142)); - this.register(Constants.WSEvents.MESSAGE_DELETE, __webpack_require__(143)); - this.register(Constants.WSEvents.MESSAGE_UPDATE, __webpack_require__(144)); - this.register(Constants.WSEvents.MESSAGE_DELETE_BULK, __webpack_require__(145)); - this.register(Constants.WSEvents.VOICE_SERVER_UPDATE, __webpack_require__(146)); - this.register(Constants.WSEvents.GUILD_SYNC, __webpack_require__(147)); - this.register(Constants.WSEvents.RELATIONSHIP_ADD, __webpack_require__(148)); - this.register(Constants.WSEvents.RELATIONSHIP_REMOVE, __webpack_require__(149)); - this.register(Constants.WSEvents.MESSAGE_REACTION_ADD, __webpack_require__(150)); - this.register(Constants.WSEvents.MESSAGE_REACTION_REMOVE, __webpack_require__(151)); - this.register(Constants.WSEvents.MESSAGE_REACTION_REMOVE_ALL, __webpack_require__(152)); + this.register(Constants.WSEvents.READY, __webpack_require__(122)); + this.register(Constants.WSEvents.RESUMED, __webpack_require__(125)); + this.register(Constants.WSEvents.GUILD_CREATE, __webpack_require__(126)); + this.register(Constants.WSEvents.GUILD_DELETE, __webpack_require__(127)); + this.register(Constants.WSEvents.GUILD_UPDATE, __webpack_require__(128)); + this.register(Constants.WSEvents.GUILD_BAN_ADD, __webpack_require__(129)); + this.register(Constants.WSEvents.GUILD_BAN_REMOVE, __webpack_require__(130)); + this.register(Constants.WSEvents.GUILD_MEMBER_ADD, __webpack_require__(131)); + this.register(Constants.WSEvents.GUILD_MEMBER_REMOVE, __webpack_require__(132)); + this.register(Constants.WSEvents.GUILD_MEMBER_UPDATE, __webpack_require__(133)); + this.register(Constants.WSEvents.GUILD_ROLE_CREATE, __webpack_require__(134)); + this.register(Constants.WSEvents.GUILD_ROLE_DELETE, __webpack_require__(135)); + this.register(Constants.WSEvents.GUILD_ROLE_UPDATE, __webpack_require__(136)); + this.register(Constants.WSEvents.GUILD_EMOJIS_UPDATE, __webpack_require__(137)); + this.register(Constants.WSEvents.GUILD_MEMBERS_CHUNK, __webpack_require__(138)); + this.register(Constants.WSEvents.CHANNEL_CREATE, __webpack_require__(139)); + this.register(Constants.WSEvents.CHANNEL_DELETE, __webpack_require__(140)); + this.register(Constants.WSEvents.CHANNEL_UPDATE, __webpack_require__(141)); + this.register(Constants.WSEvents.CHANNEL_PINS_UPDATE, __webpack_require__(142)); + this.register(Constants.WSEvents.PRESENCE_UPDATE, __webpack_require__(143)); + this.register(Constants.WSEvents.USER_UPDATE, __webpack_require__(144)); + this.register(Constants.WSEvents.USER_NOTE_UPDATE, __webpack_require__(145)); + this.register(Constants.WSEvents.USER_SETTINGS_UPDATE, __webpack_require__(146)); + this.register(Constants.WSEvents.USER_GUILD_SETTINGS_UPDATE, __webpack_require__(147)); + this.register(Constants.WSEvents.VOICE_STATE_UPDATE, __webpack_require__(148)); + this.register(Constants.WSEvents.TYPING_START, __webpack_require__(149)); + this.register(Constants.WSEvents.MESSAGE_CREATE, __webpack_require__(150)); + this.register(Constants.WSEvents.MESSAGE_DELETE, __webpack_require__(151)); + this.register(Constants.WSEvents.MESSAGE_UPDATE, __webpack_require__(152)); + this.register(Constants.WSEvents.MESSAGE_DELETE_BULK, __webpack_require__(153)); + this.register(Constants.WSEvents.VOICE_SERVER_UPDATE, __webpack_require__(154)); + this.register(Constants.WSEvents.GUILD_SYNC, __webpack_require__(155)); + this.register(Constants.WSEvents.RELATIONSHIP_ADD, __webpack_require__(156)); + this.register(Constants.WSEvents.RELATIONSHIP_REMOVE, __webpack_require__(157)); + this.register(Constants.WSEvents.MESSAGE_REACTION_ADD, __webpack_require__(158)); + this.register(Constants.WSEvents.MESSAGE_REACTION_REMOVE, __webpack_require__(159)); + this.register(Constants.WSEvents.MESSAGE_REACTION_REMOVE_ALL, __webpack_require__(160)); } get client() { @@ -23513,12 +24674,12 @@ module.exports = WebSocketPacketManager; /***/ }), -/* 117 */ +/* 122 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); -const ClientUser = __webpack_require__(71); +const ClientUser = __webpack_require__(73); class ReadyHandler extends AbstractHandler { handle(packet) { @@ -23528,6 +24689,7 @@ class ReadyHandler extends AbstractHandler { client.ws.heartbeat(); data.user.user_settings = data.user_settings; + data.user.user_guild_settings = data.user_guild_settings; const clientUser = new ClientUser(client, data.user); client.user = clientUser; @@ -23601,7 +24763,109 @@ module.exports = ReadyHandler; /***/ }), -/* 118 */ +/* 123 */ +/***/ (function(module, exports, __webpack_require__) { + +const Constants = __webpack_require__(0); +const Collection = __webpack_require__(3); +const ClientUserChannelOverride = __webpack_require__(124); + +/** + * A wrapper around the ClientUser's guild settings. + */ +class ClientUserGuildSettings { + constructor(data, client) { + /** + * The client that created the instance of the ClientUserGuildSettings + * @name ClientUserGuildSettings#client + * @type {Client} + * @readonly + */ + Object.defineProperty(this, 'client', { value: client }); + /** + * The ID of the guild this settings are for + * @type {Snowflake} + */ + this.guildID = data.guild_id; + this.channelOverrides = new Collection(); + this.patch(data); + } + + /** + * Patch the data contained in this class with new partial data. + * @param {Object} data Data to patch this with + * @returns {void} + * @private + */ + patch(data) { + for (const key of Object.keys(Constants.UserGuildSettingsMap)) { + const value = Constants.UserGuildSettingsMap[key]; + if (!data.hasOwnProperty(key)) continue; + if (key === 'channel_overrides') { + for (const channel of data[key]) { + this.channelOverrides.set(channel.channel_id, + new ClientUserChannelOverride(channel)); + } + } else if (typeof value === 'function') { + this[value.name] = value(data[key]); + } else { + this[value] = data[key]; + } + } + } + + /** + * Update a specific property of the guild settings. + * @param {string} name Name of property + * @param {value} value Value to patch + * @returns {Promise} + */ + update(name, value) { + return this.client.rest.methods.patchClientUserGuildSettings(this.guildID, { [name]: value }); + } +} + +module.exports = ClientUserGuildSettings; + + +/***/ }), +/* 124 */ +/***/ (function(module, exports, __webpack_require__) { + +const Constants = __webpack_require__(0); + +/** + * A wrapper around the ClientUser's channel overrides. + */ +class ClientUserChannelOverride { + constructor(data) { + this.patch(data); + } + + /** + * Patch the data contained in this class with new partial data. + * @param {Object} data Data to patch this with + * @returns {void} + * @private + */ + patch(data) { + for (const key of Object.keys(Constants.UserChannelOverrideMap)) { + const value = Constants.UserChannelOverrideMap[key]; + if (!data.hasOwnProperty(key)) continue; + if (typeof value === 'function') { + this[value.name] = value(data[key]); + } else { + this[value] = data[key]; + } + } + } +} + +module.exports = ClientUserChannelOverride; + + +/***/ }), +/* 125 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -23620,7 +24884,7 @@ class ResumedHandler extends AbstractHandler { const replayed = ws.sequence - ws.closeSequence; ws.debug(`RESUMED ${ws._trace.join(' -> ')} | replayed ${replayed} events.`); - client.emit('resume', replayed); + client.emit(Constants.Events.RESUME, replayed); ws.heartbeat(); } } @@ -23635,7 +24899,7 @@ module.exports = ResumedHandler; /***/ }), -/* 119 */ +/* 126 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -23663,7 +24927,7 @@ module.exports = GuildCreateHandler; /***/ }), -/* 120 */ +/* 127 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -23688,7 +24952,7 @@ module.exports = GuildDeleteHandler; /***/ }), -/* 121 */ +/* 128 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -23705,7 +24969,7 @@ module.exports = GuildUpdateHandler; /***/ }), -/* 122 */ +/* 129 */ /***/ (function(module, exports, __webpack_require__) { // ##untested handler## @@ -23734,7 +24998,7 @@ module.exports = GuildBanAddHandler; /***/ }), -/* 123 */ +/* 130 */ /***/ (function(module, exports, __webpack_require__) { // ##untested handler## @@ -23760,7 +25024,7 @@ module.exports = GuildBanRemoveHandler; /***/ }), -/* 124 */ +/* 131 */ /***/ (function(module, exports, __webpack_require__) { // ##untested handler## @@ -23783,7 +25047,7 @@ module.exports = GuildMemberAddHandler; /***/ }), -/* 125 */ +/* 132 */ /***/ (function(module, exports, __webpack_require__) { // ##untested handler## @@ -23802,7 +25066,7 @@ module.exports = GuildMemberRemoveHandler; /***/ }), -/* 126 */ +/* 133 */ /***/ (function(module, exports, __webpack_require__) { // ##untested handler## @@ -23826,7 +25090,7 @@ module.exports = GuildMemberUpdateHandler; /***/ }), -/* 127 */ +/* 134 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -23843,7 +25107,7 @@ module.exports = GuildRoleCreateHandler; /***/ }), -/* 128 */ +/* 135 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -23860,7 +25124,7 @@ module.exports = GuildRoleDeleteHandler; /***/ }), -/* 129 */ +/* 136 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -23877,7 +25141,7 @@ module.exports = GuildRoleUpdateHandler; /***/ }), -/* 130 */ +/* 137 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -23894,7 +25158,7 @@ module.exports = GuildEmojisUpdate; /***/ }), -/* 131 */ +/* 138 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -23925,7 +25189,7 @@ class GuildMembersChunkHandler extends AbstractHandler { /** * Emitted whenever a chunk of guild members is received (all members come from the same guild). * @event Client#guildMembersChunk - * @param {Collection} members The members in the chunk + * @param {GuildMember[]} members The members in the chunk * @param {Guild} guild The guild related to the member chunk */ @@ -23933,7 +25197,7 @@ module.exports = GuildMembersChunkHandler; /***/ }), -/* 132 */ +/* 139 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -23956,7 +25220,7 @@ module.exports = ChannelCreateHandler; /***/ }), -/* 133 */ +/* 140 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -23982,7 +25246,7 @@ module.exports = ChannelDeleteHandler; /***/ }), -/* 134 */ +/* 141 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -23999,7 +25263,7 @@ module.exports = ChannelUpdateHandler; /***/ }), -/* 135 */ +/* 142 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -24036,7 +25300,7 @@ module.exports = ChannelPinsUpdate; /***/ }), -/* 136 */ +/* 143 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -24118,7 +25382,7 @@ module.exports = PresenceUpdateHandler; /***/ }), -/* 137 */ +/* 144 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -24135,7 +25399,7 @@ module.exports = UserUpdateHandler; /***/ }), -/* 138 */ +/* 145 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -24153,7 +25417,7 @@ module.exports = UserNoteUpdateHandler; /***/ }), -/* 139 */ +/* 146 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -24177,7 +25441,31 @@ module.exports = UserSettingsUpdateHandler; /***/ }), -/* 140 */ +/* 147 */ +/***/ (function(module, exports, __webpack_require__) { + +const AbstractHandler = __webpack_require__(1); +const Constants = __webpack_require__(0); + +class UserGuildSettingsUpdateHandler extends AbstractHandler { + handle(packet) { + const client = this.packetManager.client; + client.user.guildSettings.get(packet.d.guild_id).patch(packet.d); + client.emit(Constants.Events.USER_GUILD_SETTINGS_UPDATE, client.user.guildSettings.get(packet.d.guild_id)); + } +} + +/** + * Emitted whenever the client user's settings update. + * @event Client#clientUserGuildSettingsUpdate + * @param {ClientUserGuildSettings} clientUserGuildSettings The new client user guild settings + */ + +module.exports = UserGuildSettingsUpdateHandler; + + +/***/ }), +/* 148 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -24232,7 +25520,7 @@ module.exports = VoiceStateUpdateHandler; /***/ }), -/* 141 */ +/* 149 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -24306,7 +25594,7 @@ module.exports = TypingStartHandler; /***/ }), -/* 142 */ +/* 150 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -24331,7 +25619,7 @@ module.exports = MessageCreateHandler; /***/ }), -/* 143 */ +/* 151 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -24356,7 +25644,7 @@ module.exports = MessageDeleteHandler; /***/ }), -/* 144 */ +/* 152 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -24373,7 +25661,7 @@ module.exports = MessageUpdateHandler; /***/ }), -/* 145 */ +/* 153 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -24396,7 +25684,7 @@ module.exports = MessageDeleteBulkHandler; /***/ }), -/* 146 */ +/* 154 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -24421,7 +25709,7 @@ module.exports = VoiceServerUpdate; /***/ }), -/* 147 */ +/* 155 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -24438,7 +25726,7 @@ module.exports = GuildSyncHandler; /***/ }), -/* 148 */ +/* 156 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -24463,7 +25751,7 @@ module.exports = RelationshipAddHandler; /***/ }), -/* 149 */ +/* 157 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -24488,7 +25776,7 @@ module.exports = RelationshipRemoveHandler; /***/ }), -/* 150 */ +/* 158 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -24505,7 +25793,7 @@ module.exports = MessageReactionAddHandler; /***/ }), -/* 151 */ +/* 159 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -24522,7 +25810,7 @@ module.exports = MessageReactionRemove; /***/ }), -/* 152 */ +/* 160 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -24539,39 +25827,39 @@ module.exports = MessageReactionRemoveAll; /***/ }), -/* 153 */ +/* 161 */ /***/ (function(module, exports) { /* (ignored) */ /***/ }), -/* 154 */ +/* 162 */ /***/ (function(module, exports) { /* (ignored) */ /***/ }), -/* 155 */ +/* 163 */ /***/ (function(module, exports) { /* (ignored) */ /***/ }), -/* 156 */ +/* 164 */ /***/ (function(module, exports) { /* (ignored) */ /***/ }), -/* 157 */ +/* 165 */ /***/ (function(module, exports, __webpack_require__) { const EventEmitter = __webpack_require__(9).EventEmitter; const Constants = __webpack_require__(0); -const WebSocketConnection = __webpack_require__(70); +const WebSocketConnection = __webpack_require__(72); /** - * WebSocket Manager of the client + * WebSocket Manager of the client. * @private */ class WebSocketManager extends EventEmitter { @@ -24591,7 +25879,7 @@ class WebSocketManager extends EventEmitter { } /** - * Sends a heartbeat on the available connection + * Sends a heartbeat on the available connection. * @returns {void} */ heartbeat() { @@ -24635,7 +25923,7 @@ class WebSocketManager extends EventEmitter { /** * Connects the client to a gateway. - * @param {string} gateway Gateway to connect to + * @param {string} gateway The gateway to connect to * @returns {boolean} */ connect(gateway) { @@ -24659,21 +25947,13 @@ module.exports = WebSocketManager; /***/ }), -/* 158 */ +/* 166 */ /***/ (function(module, exports, __webpack_require__) { class ActionsManager { constructor(client) { this.client = client; - this.register(__webpack_require__(159)); - this.register(__webpack_require__(160)); - this.register(__webpack_require__(161)); - this.register(__webpack_require__(162)); - this.register(__webpack_require__(163)); - this.register(__webpack_require__(164)); - this.register(__webpack_require__(165)); - this.register(__webpack_require__(166)); this.register(__webpack_require__(167)); this.register(__webpack_require__(168)); this.register(__webpack_require__(169)); @@ -24694,6 +25974,14 @@ class ActionsManager { this.register(__webpack_require__(184)); this.register(__webpack_require__(185)); this.register(__webpack_require__(186)); + this.register(__webpack_require__(187)); + this.register(__webpack_require__(188)); + this.register(__webpack_require__(189)); + this.register(__webpack_require__(190)); + this.register(__webpack_require__(191)); + this.register(__webpack_require__(192)); + this.register(__webpack_require__(193)); + this.register(__webpack_require__(194)); } register(Action) { @@ -24705,7 +25993,7 @@ module.exports = ActionsManager; /***/ }), -/* 159 */ +/* 167 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -24766,7 +26054,7 @@ module.exports = MessageCreateAction; /***/ }), -/* 160 */ +/* 168 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -24806,7 +26094,7 @@ module.exports = MessageDeleteAction; /***/ }), -/* 161 */ +/* 169 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -24834,7 +26122,7 @@ module.exports = MessageDeleteBulkAction; /***/ }), -/* 162 */ +/* 170 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -24880,7 +26168,7 @@ module.exports = MessageUpdateAction; /***/ }), -/* 163 */ +/* 171 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -24923,7 +26211,7 @@ module.exports = MessageReactionAdd; /***/ }), -/* 164 */ +/* 172 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -24966,7 +26254,7 @@ module.exports = MessageReactionRemove; /***/ }), -/* 165 */ +/* 173 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -24997,7 +26285,7 @@ module.exports = MessageReactionRemoveAll; /***/ }), -/* 166 */ +/* 174 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -25014,7 +26302,7 @@ module.exports = ChannelCreateAction; /***/ }), -/* 167 */ +/* 175 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -25049,7 +26337,7 @@ module.exports = ChannelDeleteAction; /***/ }), -/* 168 */ +/* 176 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -25089,7 +26377,7 @@ module.exports = ChannelUpdateAction; /***/ }), -/* 169 */ +/* 177 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -25148,7 +26436,7 @@ module.exports = GuildDeleteAction; /***/ }), -/* 170 */ +/* 178 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -25188,7 +26476,7 @@ module.exports = GuildUpdateAction; /***/ }), -/* 171 */ +/* 179 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -25204,7 +26492,7 @@ module.exports = GuildMemberGetAction; /***/ }), -/* 172 */ +/* 180 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -25250,7 +26538,7 @@ module.exports = GuildMemberRemoveAction; /***/ }), -/* 173 */ +/* 181 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -25269,12 +26557,12 @@ module.exports = GuildBanRemove; /***/ }), -/* 174 */ +/* 182 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); const Constants = __webpack_require__(0); -const Role = __webpack_require__(14); +const Role = __webpack_require__(15); class GuildRoleCreate extends Action { handle(data) { @@ -25301,7 +26589,7 @@ module.exports = GuildRoleCreate; /***/ }), -/* 175 */ +/* 183 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -25348,7 +26636,7 @@ module.exports = GuildRoleDeleteAction; /***/ }), -/* 176 */ +/* 184 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -25395,7 +26683,7 @@ module.exports = GuildRoleUpdateAction; /***/ }), -/* 177 */ +/* 185 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -25412,7 +26700,7 @@ module.exports = UserGetAction; /***/ }), -/* 178 */ +/* 186 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -25451,7 +26739,7 @@ module.exports = UserUpdateAction; /***/ }), -/* 179 */ +/* 187 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -25487,7 +26775,7 @@ module.exports = UserNoteUpdateAction; /***/ }), -/* 180 */ +/* 188 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -25522,7 +26810,7 @@ module.exports = GuildSync; /***/ }), -/* 181 */ +/* 189 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -25545,7 +26833,7 @@ module.exports = GuildEmojiCreateAction; /***/ }), -/* 182 */ +/* 190 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -25568,7 +26856,7 @@ module.exports = GuildEmojiDeleteAction; /***/ }), -/* 183 */ +/* 191 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -25591,7 +26879,7 @@ module.exports = GuildEmojiUpdateAction; /***/ }), -/* 184 */ +/* 192 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -25635,7 +26923,7 @@ module.exports = GuildEmojisUpdateAction; /***/ }), -/* 185 */ +/* 193 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -25660,7 +26948,7 @@ module.exports = GuildRolesPositionUpdate; /***/ }), -/* 186 */ +/* 194 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -25685,42 +26973,42 @@ module.exports = GuildChannelsPositionUpdate; /***/ }), -/* 187 */ +/* 195 */ /***/ (function(module, exports) { /* (ignored) */ /***/ }), -/* 188 */ +/* 196 */ /***/ (function(module, exports) { /* (ignored) */ /***/ }), -/* 189 */ +/* 197 */ /***/ (function(module, exports) { /* (ignored) */ /***/ }), -/* 190 */ +/* 198 */ /***/ (function(module, exports) { /* (ignored) */ /***/ }), -/* 191 */ +/* 199 */ /***/ (function(module, exports) { /* (ignored) */ /***/ }), -/* 192 */ +/* 200 */ /***/ (function(module, exports, __webpack_require__) { -const Webhook = __webpack_require__(38); -const RESTManager = __webpack_require__(53); -const ClientDataResolver = __webpack_require__(41); +const Webhook = __webpack_require__(41); +const RESTManager = __webpack_require__(56); +const ClientDataResolver = __webpack_require__(38); const Constants = __webpack_require__(0); const Util = __webpack_require__(4); @@ -25785,9 +27073,9 @@ class WebhookClient extends Webhook { */ setTimeout(fn, delay, ...args) { const timeout = setTimeout(() => { - fn(); + fn(...args); this._timeouts.delete(timeout); - }, delay, ...args); + }, delay); this._timeouts.add(timeout); return timeout; } @@ -25838,233 +27126,5 @@ class WebhookClient extends Webhook { module.exports = WebhookClient; -/***/ }), -/* 193 */ -/***/ (function(module, exports, __webpack_require__) { - -const ClientDataResolver = __webpack_require__(41); - -/** - * A rich embed to be sent with a message with a fluent interface for creation. - * @param {Object} [data] Data to set in the rich embed - */ -class RichEmbed { - constructor(data = {}) { - /** - * Title for this Embed - * @type {string} - */ - this.title = data.title; - - /** - * Description for this Embed - * @type {string} - */ - this.description = data.description; - - /** - * URL for this Embed - * @type {string} - */ - this.url = data.url; - - /** - * Color for this Embed - * @type {number} - */ - this.color = data.color; - - /** - * Author for this Embed - * @type {Object} - */ - this.author = data.author; - - /** - * Timestamp for this Embed - * @type {Date} - */ - this.timestamp = data.timestamp; - - /** - * Fields for this Embed - * @type {Object[]} - */ - this.fields = data.fields || []; - - /** - * Thumbnail for this Embed - * @type {Object} - */ - this.thumbnail = data.thumbnail; - - /** - * Image for this Embed - * @type {Object} - */ - this.image = data.image; - - /** - * Footer for this Embed - * @type {Object} - */ - this.footer = data.footer; - - /** - * File to upload alongside this Embed - * @type {string} - */ - this.file = data.file; - } - - /** - * Sets the title of this embed. - * @param {StringResolvable} title The title - * @returns {RichEmbed} This embed - */ - setTitle(title) { - title = resolveString(title); - if (title.length > 256) throw new RangeError('RichEmbed titles may not exceed 256 characters.'); - this.title = title; - return this; - } - - /** - * Sets the description of this embed. - * @param {StringResolvable} description The description - * @returns {RichEmbed} This embed - */ - setDescription(description) { - description = resolveString(description); - if (description.length > 2048) throw new RangeError('RichEmbed descriptions may not exceed 2048 characters.'); - this.description = description; - return this; - } - - /** - * Sets the URL of this embed. - * @param {string} url The URL - * @returns {RichEmbed} This embed - */ - setURL(url) { - this.url = url; - return this; - } - - /** - * Sets the color of this embed. - * @param {ColorResolvable} color The color of the embed - * @returns {RichEmbed} This embed - */ - setColor(color) { - this.color = ClientDataResolver.resolveColor(color); - return this; - } - - /** - * Sets the author of this embed. - * @param {StringResolvable} name The name of the author - * @param {string} [icon] The icon URL of the author - * @param {string} [url] The URL of the author - * @returns {RichEmbed} This embed - */ - setAuthor(name, icon, url) { - this.author = { name: resolveString(name), icon_url: icon, url }; - return this; - } - - /** - * Sets the timestamp of this embed. - * @param {Date} [timestamp=current date] The timestamp - * @returns {RichEmbed} This embed - */ - setTimestamp(timestamp = new Date()) { - this.timestamp = timestamp; - return this; - } - - /** - * Adds a field to the embed (max 25). - * @param {StringResolvable} name The name of the field - * @param {StringResolvable} value The value of the field - * @param {boolean} [inline=false] Set the field to display inline - * @returns {RichEmbed} This embed - */ - addField(name, value, inline = false) { - if (this.fields.length >= 25) throw new RangeError('RichEmbeds may not exceed 25 fields.'); - name = resolveString(name); - if (name.length > 256) throw new RangeError('RichEmbed field names may not exceed 256 characters.'); - if (!/\S/.test(name)) throw new RangeError('RichEmbed field names may not be empty.'); - value = resolveString(value); - if (value.length > 1024) throw new RangeError('RichEmbed field values may not exceed 1024 characters.'); - if (!/\S/.test(value)) throw new RangeError('RichEmbed field values may not be empty.'); - this.fields.push({ name, value, inline }); - return this; - } - - /** - * Convenience function for `.addField('\u200B', '\u200B', inline)`. - * @param {boolean} [inline=false] Set the field to display inline - * @returns {RichEmbed} This embed - */ - addBlankField(inline = false) { - return this.addField('\u200B', '\u200B', inline); - } - - /** - * Set the thumbnail of this embed. - * @param {string} url The URL of the thumbnail - * @returns {RichEmbed} This embed - */ - setThumbnail(url) { - this.thumbnail = { url }; - return this; - } - - /** - * Set the image of this embed. - * @param {string} url The URL of the image - * @returns {RichEmbed} This embed - */ - setImage(url) { - this.image = { url }; - return this; - } - - /** - * Sets the footer of this embed. - * @param {StringResolvable} text The text of the footer - * @param {string} [icon] The icon URL of the footer - * @returns {RichEmbed} This embed - */ - setFooter(text, icon) { - text = resolveString(text); - if (text.length > 2048) throw new RangeError('RichEmbed footer text may not exceed 2048 characters.'); - this.footer = { text, icon_url: icon }; - return this; - } - - /** - * Sets the file to upload alongside the embed. This file can be accessed via `attachment://fileName.extension` when - * setting an embed image or author/footer icons. Only one file may be attached. - * @param {FileOptions|string} file Local path or URL to the file to attach, or valid FileOptions for a file to attach - * @returns {RichEmbed} This embed - */ - attachFile(file) { - if (this.file) throw new RangeError('You may not upload more than one file at once.'); - this.file = file; - return this; - } -} - -module.exports = RichEmbed; - -function resolveString(data) { - if (typeof data === 'string') return data; - if (data instanceof Array) return data.join('\n'); - return String(data); -} - - /***/ }) /******/ ]); \ No newline at end of file diff --git a/discord.stable.min.js b/discord.stable.min.js index 0deb0f69..cd992442 100644 --- a/discord.stable.min.js +++ b/discord.stable.min.js @@ -1 +1 @@ -!function(e){function t(n){if(i[n])return i[n].exports;var s=i[n]={i:n,l:!1,exports:{}};return e[n].call(s.exports,s,s.exports,t),s.l=!0,s.exports}var i={};t.m=e,t.c=i,t.d=function(e,i,n){t.o(e,i)||Object.defineProperty(e,i,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var i=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(i,"a",i),i},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=73)}([function(e,t,i){(function(e){t.Package=i(52),t.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(27).platform(),properties:{$os:e?e.platform:"discord.js",$browser:"discord.js",$device:"discord.js",$referrer:"",$referring_domain:""},version:6},http:{version:7,host:"https://discordapp.com",cdn:"https://cdn.discordapp.com"}},t.WSCodes={1e3:"Connection gracefully closed",4004:"Tried to identify with an invalid token",4010:"Sharding data provided was invalid",4011:"Shard would be on too many guilds if connected"},t.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=t.Endpoints={User:e=>{e.id&&(e=e.id);const t=`/users/${e}`;return{toString:()=>t,channels:`${t}/channels`,profile:`${t}/profile`,relationships:`${t}/relationships`,settings:`${t}/settings`,Relationship:e=>`${t}/relationships/${e}`,Guild:e=>`${t}/guilds/${e}`,Note:e=>`${t}/notes/${e}`,Mentions:(e,i,n,s)=>`${t}/mentions?limit=${e}&roles=${i}&everyone=${n}${s?`&guild_id=${s}`:""}`,Avatar:(t,i)=>"1"===e?i:n.CDN(t).Avatar(e,i)}},guilds:"/guilds",Guild:e=>{e.id&&(e=e.id);const t=`/guilds/${e}`;return{toString:()=>t,prune:`${t}/prune`,embed:`${t}/embed`,bans:`${t}/bans`,integrations:`${t}/integrations`,members:`${t}/members`,channels:`${t}/channels`,invites:`${t}/invites`,roles:`${t}/roles`,emojis:`${t}/emojis`,search:`${t}/messages/search`,voiceRegions:`${t}/regions`,webhooks:`${t}/webhooks`,ack:`${t}/ack`,settings:`${t}/settings`,auditLogs:`${t}/audit-logs`,Emoji:e=>n.CDN(root).Emoji(e),Icon:(t,i)=>n.CDN(t).Icon(e,i),Splash:(t,i)=>n.CDN(t).Splash(e,i),Role:e=>`${t}/roles/${e}`,Member:e=>{e.id&&(e=e.id);const i=`${t}/members/${e}`;return{toString:()=>i,Role:e=>`${i}/roles/${e}`,nickname:`${t}/members/@me/nick`}}}},channels:"/channels",Channel:e=>{e.id&&(e=e.id);const t=`/channels/${e}`;return{toString:()=>t,messages:{toString:()=>`${t}/messages`,bulkDelete:`${t}/messages/bulk-delete`},invites:`${t}/invites`,typing:`${t}/typing`,permissions:`${t}/permissions`,webhooks:`${t}/webhooks`,search:`${t}/messages/search`,pins:`${t}/pins`,Pin:e=>`${t}/pins/${e}`,Recipient:e=>`${t}/recipients/${e}`,Message:e=>{e.id&&(e=e.id);const i=`${t}/messages/${e}`;return{toString:()=>i,reactions:`${i}/reactions`,ack:`${i}/ack`,Reaction:(e,t)=>{const n=`${i}/reactions/${e}${t?`?limit=${t}`:""}`;return{toString:()=>n,User:e=>`${n}/${e}`}}}}}},Message:e=>t.Endpoints.Channel(e.channel).Message(e),Member:e=>t.Endpoints.Guild(e.guild).Member(e),CDN:e=>({Emoji:t=>`${e}/emojis/${t}.png`,Asset:t=>`${e}/assets/${t}`,Avatar:(t,i)=>`${e}/avatars/${t}/${i}.${i.startsWith("a_")?"gif":"png"}?size=2048`,Icon:(t,i)=>`${e}/icons/${t}/${i}.jpg`,Splash:(t,i)=>`${e}/splashes/${t}/${i}.jpg`}),OAUTH2:{Application:e=>{const t=`/oauth2/applications/${e}`;return{toString:()=>t,reset:`${t}/reset`}},App:e=>`/oauth2/authorize?client_id=${e}`},login:"/auth/login",logout:"/auth/logout",voiceRegions:"/voice/regions",gateway:{toString:()=>"/gateway",bot:"/gateway/bot"},Invite:e=>`/invite/${e}`,inviteLink:e=>`https://discord.gg/${e}`,Webhook:(e,t)=>`/webhooks/${e}${t?`/${t}`:""}`};t.Status={READY:0,CONNECTING:1,RECONNECTING:2,IDLE:3,NEARLY:4,DISCONNECTED:5},t.VoiceStatus={CONNECTED:0,CONNECTING:1,AUTHENTICATING:2,RECONNECTING:3,DISCONNECTED:4},t.ChannelTypes={TEXT:0,DM:1,VOICE:2,GROUP_DM:3},t.OPCodes={DISPATCH:0,HEARTBEAT:1,IDENTIFY:2,STATUS_UPDATE:3,VOICE_STATE_UPDATE:4,VOICE_GUILD_PING:5,RESUME:6,RECONNECT:7,REQUEST_GUILD_MEMBERS:8,INVALID_SESSION:9,HELLO:10,HEARTBEAT_ACK:11},t.VoiceOPCodes={IDENTIFY:0,SELECT_PROTOCOL:1,READY:2,HEARTBEAT:3,SESSION_DESCRIPTION:4,SPEAKING:5},t.Events={READY:"ready",GUILD_CREATE:"guildCreate",GUILD_DELETE:"guildDelete",GUILD_UPDATE:"guildUpdate",GUILD_UNAVAILABLE:"guildUnavailable",GUILD_AVAILABLE:"guildAvailable",GUILD_MEMBER_ADD:"guildMemberAdd",GUILD_MEMBER_REMOVE:"guildMemberRemove",GUILD_MEMBER_UPDATE:"guildMemberUpdate",GUILD_MEMBER_AVAILABLE:"guildMemberAvailable",GUILD_MEMBER_SPEAKING:"guildMemberSpeaking",GUILD_MEMBERS_CHUNK:"guildMembersChunk",GUILD_ROLE_CREATE:"roleCreate",GUILD_ROLE_DELETE:"roleDelete",GUILD_ROLE_UPDATE:"roleUpdate",GUILD_EMOJI_CREATE:"emojiCreate",GUILD_EMOJI_DELETE:"emojiDelete",GUILD_EMOJI_UPDATE:"emojiUpdate",GUILD_BAN_ADD:"guildBanAdd",GUILD_BAN_REMOVE:"guildBanRemove",CHANNEL_CREATE:"channelCreate",CHANNEL_DELETE:"channelDelete",CHANNEL_UPDATE:"channelUpdate",CHANNEL_PINS_UPDATE:"channelPinsUpdate",MESSAGE_CREATE:"message",MESSAGE_DELETE:"messageDelete",MESSAGE_UPDATE:"messageUpdate",MESSAGE_BULK_DELETE:"messageDeleteBulk",MESSAGE_REACTION_ADD:"messageReactionAdd",MESSAGE_REACTION_REMOVE:"messageReactionRemove",MESSAGE_REACTION_REMOVE_ALL:"messageReactionRemoveAll",USER_UPDATE:"userUpdate",USER_NOTE_UPDATE:"userNoteUpdate",USER_SETTINGS_UPDATE:"clientUserSettingsUpdate",PRESENCE_UPDATE:"presenceUpdate",VOICE_STATE_UPDATE:"voiceStateUpdate",TYPING_START:"typingStart",TYPING_STOP:"typingStop",DISCONNECT:"disconnect",RECONNECTING:"reconnecting",ERROR:"error",WARN:"warn",DEBUG:"debug"},t.WSEvents={READY:"READY",RESUMED:"RESUMED",GUILD_SYNC:"GUILD_SYNC",GUILD_CREATE:"GUILD_CREATE",GUILD_DELETE:"GUILD_DELETE",GUILD_UPDATE:"GUILD_UPDATE",GUILD_MEMBER_ADD:"GUILD_MEMBER_ADD",GUILD_MEMBER_REMOVE:"GUILD_MEMBER_REMOVE",GUILD_MEMBER_UPDATE:"GUILD_MEMBER_UPDATE",GUILD_MEMBERS_CHUNK:"GUILD_MEMBERS_CHUNK",GUILD_ROLE_CREATE:"GUILD_ROLE_CREATE",GUILD_ROLE_DELETE:"GUILD_ROLE_DELETE",GUILD_ROLE_UPDATE:"GUILD_ROLE_UPDATE",GUILD_BAN_ADD:"GUILD_BAN_ADD",GUILD_BAN_REMOVE:"GUILD_BAN_REMOVE",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",USER_SETTINGS_UPDATE:"USER_SETTINGS_UPDATE",PRESENCE_UPDATE:"PRESENCE_UPDATE",VOICE_STATE_UPDATE:"VOICE_STATE_UPDATE",TYPING_START:"TYPING_START",VOICE_SERVER_UPDATE:"VOICE_SERVER_UPDATE",RELATIONSHIP_ADD:"RELATIONSHIP_ADD",RELATIONSHIP_REMOVE:"RELATIONSHIP_REMOVE"},t.MessageTypes=["DEFAULT","RECIPIENT_ADD","RECIPIENT_REMOVE","CALL","CHANNEL_NAME_CHANGE","CHANNEL_ICON_CHANGE","PINS_ADD","GUILD_MEMBER_JOIN"],t.DefaultAvatars={BLURPLE:"6debd47ed13483642cf09e832ed0bc1b",GREY:"322c936a8c8be1b803cd94861bdfa868",GREEN:"dd4dbc0016779df1378e7812eabaa04d",ORANGE:"0e291f67c9274a1abdddeb3fd919cbaa",RED:"1cbd08c76f8af6dddce02c5138971129"},t.ExplicitContentFilterTypes=["DISABLED","NON_FRIENDS","FRIENDS_AND_NON_FRIENDS"],t.UserSettingsMap={convert_emoticons:"convertEmoticons",default_guilds_restricted:"defaultGuildsRestricted",detect_platform_accounts:"detectPlatformAccounts",developer_mode:"developerMode",enable_tts_command:"enableTTSCommand",theme:"theme",status:"status",show_current_game:"showCurrentGame",inline_attachment_media:"inlineAttachmentMedia",inline_embed_media:"inlineEmbedMedia",locale:"locale",message_display_compact:"messageDisplayCompact",render_reactions:"renderReactions",guild_positions:"guildPositions",restricted_guilds:"restrictedGuilds",explicit_content_filter:function(e){return t.ExplicitContentFilterTypes[e]},friend_source_flags:function(e){return{all:e.all||!1,mutualGuilds:!!e.all||(e.mutual_guilds||!1),mutualFriends:!!e.all||(e.mutualFriends||!1)}}},t.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(t,i(7))},function(e,t){class i{constructor(e){this.packetManager=e}handle(e){return e}}e.exports=i},function(e,t){class i{constructor(e){this.client=e}handle(e){return e}}e.exports=i},function(e,t){class i extends Map{constructor(e){super(e),Object.defineProperty(this,"_array",{value:null,writable:!0,configurable:!0}),Object.defineProperty(this,"_keyArray",{value:null,writable:!0,configurable:!0})}set(e,t){return this._array=null,this._keyArray=null,super.set(e,t)}delete(e){return this._array=null,this._keyArray=null,super.delete(e)}array(){return this._array&&this._array.length===this.size||(this._array=Array.from(this.values())),this._array}keyArray(){return this._keyArray&&this._keyArray.length===this.size||(this._keyArray=Array.from(this.keys())),this._keyArray}first(){return this.values().next().value}firstKey(){return this.keys().next().value}last(){const e=this.array();return e[e.length-1]}lastKey(){const e=this.keyArray();return e[e.length-1]}random(){const e=this.array();return e[Math.floor(Math.random()*e.length)]}randomKey(){const e=this.keyArray();return e[Math.floor(Math.random()*e.length)]}findAll(e,t){if("string"!=typeof e)throw new TypeError("Key must be a string.");if(void 0===t)throw new Error("Value must be specified.");const i=[];for(const n of this.values())n[e]===t&&i.push(n);return i}find(e,t){if("string"==typeof e){if(void 0===t)throw new Error("Value must be specified.");for(const i of this.values())if(i[e]===t)return i;return null}if("function"==typeof e){for(const[t,i]of this)if(e(i,t,this))return i;return null}throw new Error("First argument must be a property string or a function.")}findKey(e,t){if("string"==typeof e){if(void 0===t)throw new Error("Value must be specified.");for(const[i,n]of this)if(n[e]===t)return i;return null}if("function"==typeof e){for(const[t,i]of this)if(e(i,t,this))return t;return null}throw new Error("First argument must be a property string or a function.")}exists(e,t){return Boolean(this.find(e,t))}filter(e,t){t&&(e=e.bind(t));const n=new i;for(const[t,i]of this)e(i,t,this)&&n.set(t,i);return n}filterArray(e,t){t&&(e=e.bind(t));const i=[];for(const[t,n]of this)e(n,t,this)&&i.push(n);return i}map(e,t){t&&(e=e.bind(t));const i=new Array(this.size);let n=0;for(const[t,s]of this)i[n++]=e(s,t,this);return i}some(e,t){t&&(e=e.bind(t));for(const[t,i]of this)if(e(i,t,this))return!0;return!1}every(e,t){t&&(e=e.bind(t));for(const[t,i]of this)if(!e(i,t,this))return!1;return!0}reduce(e,t){let i;if(void 0!==t){i=t;for(const[t,n]of this)i=e(i,n,t,this)}else{let t=!0;for(const[n,s]of this)t?(i=s,t=!1):i=e(i,s,n,this)}return i}clone(){return new this.constructor(this)}concat(...e){const t=this.clone();for(const i of e)for(const[e,n]of i)t.set(e,n);return t}deleteAll(){const e=[];for(const t of this.values())t.delete&&e.push(t.delete());return e}equals(e){return!!e&&(this===e||this.size===e.size&&!this.find((t,i)=>{const n=e.get(i);return n!==t||void 0===n&&!e.has(i)}))}sort(e=((e,t)=>+(e>t)||+(e===t)-1)){return new i(Array.from(this.entries()).sort((t,i)=>e(t[1],i[1],t[0],i[0])))}}e.exports=i},function(e,t,i){(function(t){const n=i(30),s=i(0),r=s.DefaultOptions.http;class o{constructor(){throw new Error(`The ${this.constructor.name} class may not be instantiated.`)}static splitMessage(e,{maxLength:t=1950,char:i="\n",prepend:n="",append:s=""}={}){if(e.length<=t)return e;const r=e.split(i);if(1===r.length)throw new Error("Message exceeds the max length and contains no split characters.");const o=[""];let a=0;for(let e=0;et&&(o[a]+=s,o.push(n),a++),o[a]+=(o[a].length>0&&o[a]!==n?i:"")+r[e];return o}static escapeMarkdown(e,t=!1,i=!1){return t?e.replace(/```/g,"`​``"):i?e.replace(/\\(`|\\)/g,"$1").replace(/(`|\\)/g,"\\$1"):e.replace(/\\(\*|_|`|~|\\)/g,"$1").replace(/(\*|_|`|~|\\)/g,"\\$1")}static fetchRecommendedShards(e,t=1e3){return new Promise((i,o)=>{if(!e)throw new Error("A token must be provided.");n.get(`${r.host}/api/v${r.version}${s.Endpoints.gateway.bot}`).set("Authorization",`Bot ${e.replace(/^Bot\s*/i,"")}`).end((e,n)=>{e&&o(e),i(n.body.shards*(1e3/t))})})}static parseEmoji(e){if(e.includes("%")&&(e=decodeURIComponent(e)),e.includes(":")){const[t,i]=e.split(":");return{name:t,id:i}}return{name:e,id:null}}static arraysEqual(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(const i of e){const e=t.indexOf(i);-1!==e&&t.splice(e,1)}return 0===t.length}static cloneObject(e){return Object.assign(Object.create(e),e)}static mergeDefault(e,t){if(!t)return e;for(const i in e)!{}.hasOwnProperty.call(t,i)?t[i]=e[i]:t[i]===Object(t[i])&&(t[i]=this.mergeDefault(e[i],t[i]));return t}static convertToBuffer(e){return"string"==typeof e&&(e=this.str2ab(e)),t.from(e)}static str2ab(e){const t=new ArrayBuffer(2*e.length),i=new Uint16Array(t);for(var n=0,s=e.length;n-1&&i=n())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+n().toString(16)+" bytes");return 0|e}function f(e,t){if(r.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var i=e.length;if(0===i)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return i;case"utf8":case"utf-8":case void 0:return z(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*i;case"hex":return i>>>1;case"base64":return F(e).length;default:if(n)return z(e).length;t=(""+t).toLowerCase(),n=!0}}function g(e,t,i){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===i||i>this.length)&&(i=this.length),i<=0)return"";if(i>>>=0,t>>>=0,i<=t)return"";for(e||(e="utf8");;)switch(e){case"hex":return C(this,t,i);case"utf8":case"utf-8":return T(this,t,i);case"ascii":return M(this,t,i);case"latin1":case"binary":return D(this,t,i);case"base64":return k(this,t,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,t,i);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function v(e,t,i){var n=e[t];e[t]=e[i],e[i]=n}function b(e,t,i,n,s){if(0===e.length)return-1;if("string"==typeof i?(n=i,i=0):i>2147483647?i=2147483647:i<-2147483648&&(i=-2147483648),i=+i,isNaN(i)&&(i=s?0:e.length-1),i<0&&(i=e.length+i),i>=e.length){if(s)return-1;i=e.length-1}else if(i<0){if(!s)return-1;i=0}if("string"==typeof t&&(t=r.from(t,n)),r.isBuffer(t))return 0===t.length?-1:E(e,t,i,n,s);if("number"==typeof t)return t&=255,r.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?s?Uint8Array.prototype.indexOf.call(e,t,i):Uint8Array.prototype.lastIndexOf.call(e,t,i):E(e,[t],i,n,s);throw new TypeError("val must be string, number or Buffer")}function E(e,t,i,n,s){function r(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}var o=1,a=e.length,c=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;o=2,a/=2,c/=2,i/=2}var l;if(s){var h=-1;for(l=i;la&&(i=a-c),l=i;l>=0;l--){for(var u=!0,d=0;ds&&(n=s):n=s;var r=t.length;if(r%2!=0)throw new TypeError("Invalid hex string");n>r/2&&(n=r/2);for(var o=0;o239?4:r>223?3:r>191?2:1;if(s+a<=i){var c,l,h,u;switch(a){case 1:r<128&&(o=r);break;case 2:128==(192&(c=e[s+1]))&&(u=(31&r)<<6|63&c)>127&&(o=u);break;case 3:c=e[s+1],l=e[s+2],128==(192&c)&&128==(192&l)&&(u=(15&r)<<12|(63&c)<<6|63&l)>2047&&(u<55296||u>57343)&&(o=u);break;case 4:c=e[s+1],l=e[s+2],h=e[s+3],128==(192&c)&&128==(192&l)&&128==(192&h)&&(u=(15&r)<<18|(63&c)<<12|(63&l)<<6|63&h)>65535&&u<1114112&&(o=u)}}null===o?(o=65533,a=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|1023&o),n.push(o),s+=a}return S(n)}function S(e){var t=e.length;if(t<=X)return String.fromCharCode.apply(String,e);for(var i="",n=0;nn)&&(i=n);for(var s="",r=t;ri)throw new RangeError("Trying to access beyond buffer length")}function L(e,t,i,n,s,o){if(!r.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>s||te.length)throw new RangeError("Index out of range")}function O(e,t,i,n){t<0&&(t=65535+t+1);for(var s=0,r=Math.min(e.length-i,2);s>>8*(n?s:1-s)}function N(e,t,i,n){t<0&&(t=4294967295+t+1);for(var s=0,r=Math.min(e.length-i,4);s>>8*(n?s:3-s)&255}function P(e,t,i,n,s,r){if(i+n>e.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("Index out of range")}function j(e,t,i,n,s){return s||P(e,t,i,4,3.4028234663852886e38,-3.4028234663852886e38),J.write(e,t,i,n,23,4),i+4}function G(e,t,i,n,s){return s||P(e,t,i,8,1.7976931348623157e308,-1.7976931348623157e308),J.write(e,t,i,n,52,8),i+8}function q(e){if((e=B(e).replace(Q,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}function B(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function $(e){return e<16?"0"+e.toString(16):e.toString(16)}function z(e,t){t=t||1/0;for(var i,n=e.length,s=null,r=[],o=0;o55295&&i<57344){if(!s){if(i>56319){(t-=3)>-1&&r.push(239,191,189);continue}if(o+1===n){(t-=3)>-1&&r.push(239,191,189);continue}s=i;continue}if(i<56320){(t-=3)>-1&&r.push(239,191,189),s=i;continue}i=65536+(s-55296<<10|i-56320)}else s&&(t-=3)>-1&&r.push(239,191,189);if(s=null,i<128){if((t-=1)<0)break;r.push(i)}else if(i<2048){if((t-=2)<0)break;r.push(i>>6|192,63&i|128)}else if(i<65536){if((t-=3)<0)break;r.push(i>>12|224,i>>6&63|128,63&i|128)}else{if(!(i<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;r.push(i>>18|240,i>>12&63|128,i>>6&63|128,63&i|128)}}return r}function H(e){for(var t=[],i=0;i>8,s=i%256,r.push(s),r.push(n);return r}function F(e){return K.toByteArray(q(e))}function V(e,t,i,n){for(var s=0;s=t.length||s>=e.length);++s)t[s+i]=e[s];return s}function Y(e){return e!==e}var K=i(74),J=i(75),Z=i(42);t.Buffer=r,t.SlowBuffer=function(e){return+e!=e&&(e=0),r.alloc(+e)},t.INSPECT_MAX_BYTES=50,r.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}(),t.kMaxLength=n(),r.poolSize=8192,r._augment=function(e){return e.__proto__=r.prototype,e},r.from=function(e,t,i){return o(null,e,t,i)},r.TYPED_ARRAY_SUPPORT&&(r.prototype.__proto__=Uint8Array.prototype,r.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&r[Symbol.species]===r&&Object.defineProperty(r,Symbol.species,{value:null,configurable:!0})),r.alloc=function(e,t,i){return c(null,e,t,i)},r.allocUnsafe=function(e){return l(null,e)},r.allocUnsafeSlow=function(e){return l(null,e)},r.isBuffer=function(e){return!(null==e||!e._isBuffer)},r.compare=function(e,t){if(!r.isBuffer(e)||!r.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var i=e.length,n=t.length,s=0,o=Math.min(i,n);s0&&(e=this.toString("hex",0,i).match(/.{2}/g).join(" "),this.length>i&&(e+=" ... ")),""},r.prototype.compare=function(e,t,i,n,s){if(!r.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===i&&(i=e?e.length:0),void 0===n&&(n=0),void 0===s&&(s=this.length),t<0||i>e.length||n<0||s>this.length)throw new RangeError("out of range index");if(n>=s&&t>=i)return 0;if(n>=s)return-1;if(t>=i)return 1;if(t>>>=0,i>>>=0,n>>>=0,s>>>=0,this===e)return 0;for(var o=s-n,a=i-t,c=Math.min(o,a),l=this.slice(n,s),h=e.slice(t,i),u=0;us)&&(i=s),e.length>0&&(i<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var r=!1;;)switch(n){case"hex":return y(this,e,t,i);case"utf8":case"utf-8":return w(this,e,t,i);case"ascii":return _(this,e,t,i);case"latin1":case"binary":return x(this,e,t,i);case"base64":return R(this,e,t,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,e,t,i);default:if(r)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),r=!0}},r.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var X=4096;r.prototype.slice=function(e,t){var i=this.length;e=~~e,t=void 0===t?i:~~t,e<0?(e+=i)<0&&(e=0):e>i&&(e=i),t<0?(t+=i)<0&&(t=0):t>i&&(t=i),t0&&(s*=256);)n+=this[e+--t]*s;return n},r.prototype.readUInt8=function(e,t){return t||U(e,1,this.length),this[e]},r.prototype.readUInt16LE=function(e,t){return t||U(e,2,this.length),this[e]|this[e+1]<<8},r.prototype.readUInt16BE=function(e,t){return t||U(e,2,this.length),this[e]<<8|this[e+1]},r.prototype.readUInt32LE=function(e,t){return t||U(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},r.prototype.readUInt32BE=function(e,t){return t||U(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},r.prototype.readIntLE=function(e,t,i){e|=0,t|=0,i||U(e,t,this.length);for(var n=this[e],s=1,r=0;++r=s&&(n-=Math.pow(2,8*t)),n},r.prototype.readIntBE=function(e,t,i){e|=0,t|=0,i||U(e,t,this.length);for(var n=t,s=1,r=this[e+--n];n>0&&(s*=256);)r+=this[e+--n]*s;return s*=128,r>=s&&(r-=Math.pow(2,8*t)),r},r.prototype.readInt8=function(e,t){return t||U(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},r.prototype.readInt16LE=function(e,t){t||U(e,2,this.length);var i=this[e]|this[e+1]<<8;return 32768&i?4294901760|i:i},r.prototype.readInt16BE=function(e,t){t||U(e,2,this.length);var i=this[e+1]|this[e]<<8;return 32768&i?4294901760|i:i},r.prototype.readInt32LE=function(e,t){return t||U(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},r.prototype.readInt32BE=function(e,t){return t||U(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},r.prototype.readFloatLE=function(e,t){return t||U(e,4,this.length),J.read(this,e,!0,23,4)},r.prototype.readFloatBE=function(e,t){return t||U(e,4,this.length),J.read(this,e,!1,23,4)},r.prototype.readDoubleLE=function(e,t){return t||U(e,8,this.length),J.read(this,e,!0,52,8)},r.prototype.readDoubleBE=function(e,t){return t||U(e,8,this.length),J.read(this,e,!1,52,8)},r.prototype.writeUIntLE=function(e,t,i,n){e=+e,t|=0,i|=0,n||L(this,e,t,i,Math.pow(2,8*i)-1,0);var s=1,r=0;for(this[t]=255&e;++r=0&&(r*=256);)this[t+s]=e/r&255;return t+i},r.prototype.writeUInt8=function(e,t,i){return e=+e,t|=0,i||L(this,e,t,1,255,0),r.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},r.prototype.writeUInt16LE=function(e,t,i){return e=+e,t|=0,i||L(this,e,t,2,65535,0),r.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):O(this,e,t,!0),t+2},r.prototype.writeUInt16BE=function(e,t,i){return e=+e,t|=0,i||L(this,e,t,2,65535,0),r.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):O(this,e,t,!1),t+2},r.prototype.writeUInt32LE=function(e,t,i){return e=+e,t|=0,i||L(this,e,t,4,4294967295,0),r.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):N(this,e,t,!0),t+4},r.prototype.writeUInt32BE=function(e,t,i){return e=+e,t|=0,i||L(this,e,t,4,4294967295,0),r.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):N(this,e,t,!1),t+4},r.prototype.writeIntLE=function(e,t,i,n){if(e=+e,t|=0,!n){var s=Math.pow(2,8*i-1);L(this,e,t,i,s-1,-s)}var r=0,o=1,a=0;for(this[t]=255&e;++r>0)-a&255;return t+i},r.prototype.writeIntBE=function(e,t,i,n){if(e=+e,t|=0,!n){var s=Math.pow(2,8*i-1);L(this,e,t,i,s-1,-s)}var r=i-1,o=1,a=0;for(this[t+r]=255&e;--r>=0&&(o*=256);)e<0&&0===a&&0!==this[t+r+1]&&(a=1),this[t+r]=(e/o>>0)-a&255;return t+i},r.prototype.writeInt8=function(e,t,i){return e=+e,t|=0,i||L(this,e,t,1,127,-128),r.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},r.prototype.writeInt16LE=function(e,t,i){return e=+e,t|=0,i||L(this,e,t,2,32767,-32768),r.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):O(this,e,t,!0),t+2},r.prototype.writeInt16BE=function(e,t,i){return e=+e,t|=0,i||L(this,e,t,2,32767,-32768),r.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):O(this,e,t,!1),t+2},r.prototype.writeInt32LE=function(e,t,i){return e=+e,t|=0,i||L(this,e,t,4,2147483647,-2147483648),r.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):N(this,e,t,!0),t+4},r.prototype.writeInt32BE=function(e,t,i){return e=+e,t|=0,i||L(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),r.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):N(this,e,t,!1),t+4},r.prototype.writeFloatLE=function(e,t,i){return j(this,e,t,!0,i)},r.prototype.writeFloatBE=function(e,t,i){return j(this,e,t,!1,i)},r.prototype.writeDoubleLE=function(e,t,i){return G(this,e,t,!0,i)},r.prototype.writeDoubleBE=function(e,t,i){return G(this,e,t,!1,i)},r.prototype.copy=function(e,t,i,n){if(i||(i=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t=0;--s)e[s+t]=this[s+i];else if(o<1e3||!r.TYPED_ARRAY_SUPPORT)for(s=0;s>>=0,i=void 0===i?this.length:i>>>0,e||(e=0);var o;if("number"==typeof e)for(o=t;o1)for(var i=1;i=t?String(e):(String(i).repeat(t)+e).slice(-t)}const s=i(35),r=14200704e5;let o=0;class a{constructor(){throw new Error(`The ${this.constructor.name} class may not be instantiated.`)}static generate(){o>=4095&&(o=0);const e=`${n((Date.now()-r).toString(2),42)}0000100000${n((o++).toString(2),12)}`;return s.fromString(e,2).toString()}static deconstruct(e){const t=n(s.fromString(e).toString(2),64),i={timestamp:parseInt(t.substring(0,42),2)+r,workerID:parseInt(t.substring(42,47),2),processID:parseInt(t.substring(47,52),2),increment:parseInt(t.substring(52,64),2),binary:t};return Object.defineProperty(i,"date",{get:function(){return new Date(this.timestamp)},enumerable:!0}),i}}e.exports=a},function(e,t){function i(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function n(e){return"function"==typeof e}function s(e){return"number"==typeof e}function r(e){return"object"==typeof e&&null!==e}function o(e){return void 0===e}e.exports=i,i.EventEmitter=i,i.prototype._events=void 0,i.prototype._maxListeners=void 0,i.defaultMaxListeners=10,i.prototype.setMaxListeners=function(e){if(!s(e)||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},i.prototype.emit=function(e){var t,i,s,a,c,l;if(this._events||(this._events={}),"error"===e&&(!this._events.error||r(this._events.error)&&!this._events.error.length)){if((t=arguments[1])instanceof Error)throw t;var h=new Error('Uncaught, unspecified "error" event. ('+t+")");throw h.context=t,h}if(i=this._events[e],o(i))return!1;if(n(i))switch(arguments.length){case 1:i.call(this);break;case 2:i.call(this,arguments[1]);break;case 3:i.call(this,arguments[1],arguments[2]);break;default:a=Array.prototype.slice.call(arguments,1),i.apply(this,a)}else if(r(i))for(a=Array.prototype.slice.call(arguments,1),s=(l=i.slice()).length,c=0;c0&&this._events[e].length>s&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace()),this},i.prototype.on=i.prototype.addListener,i.prototype.once=function(e,t){function i(){this.removeListener(e,i),s||(s=!0,t.apply(this,arguments))}if(!n(t))throw TypeError("listener must be a function");var s=!1;return i.listener=t,this.on(e,i),this},i.prototype.removeListener=function(e,t){var i,s,o,a;if(!n(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(i=this._events[e],o=i.length,s=-1,i===t||n(i.listener)&&i.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(r(i)){for(a=o;a-- >0;)if(i[a]===t||i[a].listener&&i[a].listener===t){s=a;break}if(s<0)return this;1===i.length?(i.length=0,delete this._events[e]):i.splice(s,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},i.prototype.removeAllListeners=function(e){var t,i;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(i=this._events[e],n(i))this.removeListener(e,i);else if(i)for(;i.length;)this.removeListener(e,i[i.length-1]);return delete this._events[e],this},i.prototype.listeners=function(e){return this._events&&this._events[e]?n(this._events[e])?[this._events[e]]:this._events[e].slice():[]},i.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(n(t))return 1;if(t)return t.length}return 0},i.listenerCount=function(e,t){return e.listenerCount(t)}},function(e,t){"function"==typeof Object.create?e.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(e,t){e.super_=t;var i=function(){};i.prototype=t.prototype,e.prototype=new i,e.prototype.constructor=e}},function(e,t,i){const n=i(0),s=i(20);class r{constructor(e,t){t="object"!=typeof e||e instanceof Array?e:t,this._member="object"==typeof e?e:null,this.bitfield="number"==typeof t?t:this.constructor.resolve(t)}get member(){return this._member}set member(e){this._member=e}get raw(){return this.bitfield}set raw(e){this.bitfield=e}has(e,t=!0){return e instanceof Array?e.every(e=>this.has(e,t)):(e=this.constructor.resolve(e),!!(t&&(this.bitfield&this.constructor.FLAGS.ADMINISTRATOR)>0)||(this.bitfield&e)===e)}missing(e,t=!0){return e.filter(e=>!this.has(e,t))}add(...e){let t=0;for(let i=0;ithis.resolve(e)).reduce((e,t)=>e|t,0);if("string"==typeof e&&(e=this.FLAGS[e]),"number"!=typeof e||e<1)throw new RangeError(n.Errors.NOT_A_PERMISSION);return e}}r.FLAGS={CREATE_INSTANT_INVITE:1,KICK_MEMBERS:2,BAN_MEMBERS:4,ADMINISTRATOR:8,MANAGE_CHANNELS:16,MANAGE_GUILD:32,ADD_REACTIONS:64,VIEW_AUDIT_LOG:128,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},r.ALL=Object.keys(r.FLAGS).reduce((e,t)=>e|r.FLAGS[t],0),r.DEFAULT=104324097,r.prototype.hasPermission=s.deprecate(r.prototype.hasPermission,"EvaluatedPermissions#hasPermission is deprecated, use Permissions#has instead"),r.prototype.hasPermissions=s.deprecate(r.prototype.hasPermissions,"EvaluatedPermissions#hasPermissions is deprecated, use Permissions#has instead"),r.prototype.missingPermissions=s.deprecate(r.prototype.missingPermissions,"EvaluatedPermissions#missingPermissions is deprecated, use Permissions#missing instead"),Object.defineProperty(r.prototype,"member",{get:s.deprecate(Object.getOwnPropertyDescriptor(r.prototype,"member").get,"EvaluatedPermissions#member is deprecated")}),e.exports=r},function(e,t,i){"use strict";function n(e){if(!(this instanceof n))return new n(e);l.call(this,e),h.call(this,e),e&&!1===e.readable&&(this.readable=!1),e&&!1===e.writable&&(this.writable=!1),this.allowHalfOpen=!0,e&&!1===e.allowHalfOpen&&(this.allowHalfOpen=!1),this.once("end",s)}function s(){this.allowHalfOpen||this._writableState.ended||o(r,this)}function r(e){e.end()}var o=i(25),a=Object.keys||function(e){var t=[];for(var i in e)t.push(i);return t};e.exports=n;var c=i(18);c.inherits=i(10);var l=i(43),h=i(33);c.inherits(n,l);for(var u=a(h.prototype),d=0;d"dm"===e.type).find(e=>e.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(e){return this.client.rest.methods.setNote(this,e)}equals(e){return e&&this.id===e.id&&this.username===e.username&&this.discriminator===e.discriminator&&this.avatar===e.avatar&&this.bot===Boolean(e.bot)}toString(){return`<@${this.id}>`}send(){}sendMessage(){}sendEmbed(){}sendFile(){}sendCode(){}}n.applyToClass(a),e.exports=a},function(e,t,i){const n=i(8),s=i(11),r=i(20);class o{constructor(e,t){Object.defineProperty(this,"client",{value:e.client}),this.guild=e,t&&this.setup(t)}setup(e){this.id=e.id,this.name=e.name,this.color=e.color,this.hoist=e.hoist,this.position=e.position,this.permissions=e.permissions,this.managed=e.managed,this.mentionable=e.mentionable}get createdTimestamp(){return n.deconstruct(this.id).timestamp}get createdAt(){return new Date(this.createdTimestamp)}get hexColor(){let e=this.color.toString(16);for(;e.length<6;)e=`0${e}`;return`#${e}`}get members(){return this.guild.members.filter(e=>e.roles.has(this.id))}get editable(){if(this.managed)return!1;const e=this.guild.member(this.client.user);return!!e.permissions.has(s.FLAGS.MANAGE_ROLES_OR_PERMISSIONS)&&e.highestRole.comparePositionTo(this)>0}get calculatedPosition(){const e=this.guild._sortedRoles;return e.array().indexOf(e.get(this.id))}serialize(){return new s(this.permissions).serialize()}hasPermission(e,t=!1,i){return new s(this.permissions).has(e,void 0!==i?i:!t)}hasPermissions(e,t=!1){return new s(this.permissions).has(e,!t)}comparePositionTo(e){return this.constructor.comparePositions(this,e)}edit(e){return this.client.rest.methods.updateGuildRole(this,e)}setName(e){return this.edit({name:e})}setColor(e){return this.edit({color:e})}setHoist(e){return this.edit({hoist:e})}setPosition(e,t){return this.guild.setRolePosition(this,e,t).then(()=>this)}setPermissions(e){return this.edit({permissions:e})}setMentionable(e){return this.edit({mentionable:e})}delete(){return this.client.rest.methods.deleteGuildRole(this)}equals(e){return e&&this.id===e.id&&this.name===e.name&&this.color===e.color&&this.hoist===e.hoist&&this.position===e.position&&this.permissions===e.permissions&&this.managed===e.managed}toString(){return this.id===this.guild.id?"@everyone":`<@&${this.id}>`}static comparePositions(e,t){return e.position===t.position?t.id-e.id:e.position-t.position}}o.prototype.hasPermissions=r.deprecate(o.prototype.hasPermissions,"Role#hasPermissions is deprecated - use Role#hasPermission instead, it now takes an array"),e.exports=o},function(e,t){class i{constructor(e={}){this.status=e.status||"offline",this.game=e.game?new n(e.game):null}update(e){this.status=e.status||this.status,this.game=e.game?new n(e.game):null}equals(e){return this===e||(e&&this.status===e.status&&this.game?this.game.equals(e.game):!e.game)}}class n{constructor(e){this.name=e.name,this.type=e.type,this.url=e.url||null}get streaming(){return 1===this.type}equals(e){return this===e||e&&this.name===e.name&&this.type===e.type&&this.url===e.url}}t.Presence=i,t.Game=n},function(e,t,i){const n=i(8);class s{constructor(e,t){Object.defineProperty(this,"client",{value:e}),this.type=null,t&&this.setup(t)}setup(e){this.id=e.id}get createdTimestamp(){return n.deconstruct(this.id).timestamp}get createdAt(){return new Date(this.createdTimestamp)}delete(){return this.client.rest.methods.deleteChannel(this)}}e.exports=s},function(e,t,i){(t=e.exports=i(43)).Stream=t,t.Readable=t,t.Writable=i(33),t.Duplex=i(12),t.Transform=i(47),t.PassThrough=i(82)},function(e,t,i){(function(e){function i(e){return Object.prototype.toString.call(e)}t.isArray=function(e){return Array.isArray?Array.isArray(e):"[object Array]"===i(e)},t.isBoolean=function(e){return"boolean"==typeof e},t.isNull=function(e){return null===e},t.isNullOrUndefined=function(e){return null==e},t.isNumber=function(e){return"number"==typeof e},t.isString=function(e){return"string"==typeof e},t.isSymbol=function(e){return"symbol"==typeof e},t.isUndefined=function(e){return void 0===e},t.isRegExp=function(e){return"[object RegExp]"===i(e)},t.isObject=function(e){return"object"==typeof e&&null!==e},t.isDate=function(e){return"[object Date]"===i(e)},t.isError=function(e){return"[object Error]"===i(e)||e instanceof Error},t.isFunction=function(e){return"function"==typeof e},t.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},t.isBuffer=e.isBuffer}).call(t,i(5).Buffer)},function(e,t,i){(function(e){function i(e,t){for(var i=0,n=e.length-1;n>=0;n--){var s=e[n];"."===s?e.splice(n,1):".."===s?(e.splice(n,1),i++):i&&(e.splice(n,1),i--)}if(t)for(;i--;i)e.unshift("..");return e}function n(e,t){if(e.filter)return e.filter(t);for(var i=[],n=0;n=-1&&!s;r--){var o=r>=0?arguments[r]:e.cwd();if("string"!=typeof o)throw new TypeError("Arguments to path.resolve must be strings");o&&(t=o+"/"+t,s="/"===o.charAt(0))}return t=i(n(t.split("/"),function(e){return!!e}),!s).join("/"),(s?"/":"")+t||"."},t.normalize=function(e){var s=t.isAbsolute(e),r="/"===o(e,-1);return(e=i(n(e.split("/"),function(e){return!!e}),!s).join("/"))||s||(e="."),e&&r&&(e+="/"),(s?"/":"")+e},t.isAbsolute=function(e){return"/"===e.charAt(0)},t.join=function(){var e=Array.prototype.slice.call(arguments,0);return t.normalize(n(e,function(e,t){if("string"!=typeof e)throw new TypeError("Arguments to path.join must be strings");return e}).join("/"))},t.relative=function(e,i){function n(e){for(var t=0;t=0&&""===e[i];i--);return t>i?[]:e.slice(t,i-t+1)}e=t.resolve(e).substr(1),i=t.resolve(i).substr(1);for(var s=n(e.split("/")),r=n(i.split("/")),o=Math.min(s.length,r.length),a=o,c=0;c=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),f(i)?n.showHidden=i:i&&t._extend(n,i),E(n.showHidden)&&(n.showHidden=!1),E(n.depth)&&(n.depth=2),E(n.colors)&&(n.colors=!1),E(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=r),c(n,e,n.depth)}function r(e,t){var i=s.styles[t];return i?"["+s.colors[i][0]+"m"+e+"["+s.colors[i][1]+"m":e}function o(e,t){return e}function a(e){var t={};return e.forEach(function(e,i){t[e]=!0}),t}function c(e,i,n){if(e.customInspect&&i&&R(i.inspect)&&i.inspect!==t.inspect&&(!i.constructor||i.constructor.prototype!==i)){var s=i.inspect(n,e);return b(s)||(s=c(e,s,n)),s}var r=l(e,i);if(r)return r;var o=Object.keys(i),f=a(o);if(e.showHidden&&(o=Object.getOwnPropertyNames(i)),x(i)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return h(i);if(0===o.length){if(R(i)){var g=i.name?": "+i.name:"";return e.stylize("[Function"+g+"]","special")}if(y(i))return e.stylize(RegExp.prototype.toString.call(i),"regexp");if(_(i))return e.stylize(Date.prototype.toString.call(i),"date");if(x(i))return h(i)}var v="",E=!1,w=["{","}"];if(m(i)&&(E=!0,w=["[","]"]),R(i)&&(v=" [Function"+(i.name?": "+i.name:"")+"]"),y(i)&&(v=" "+RegExp.prototype.toString.call(i)),_(i)&&(v=" "+Date.prototype.toUTCString.call(i)),x(i)&&(v=" "+h(i)),0===o.length&&(!E||0==i.length))return w[0]+v+w[1];if(n<0)return y(i)?e.stylize(RegExp.prototype.toString.call(i),"regexp"):e.stylize("[Object]","special");e.seen.push(i);var A;return A=E?u(e,i,n,f,o):o.map(function(t){return d(e,i,n,f,t,E)}),e.seen.pop(),p(A,v,w)}function l(e,t){if(E(t))return e.stylize("undefined","undefined");if(b(t)){var i="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(i,"string")}return v(t)?e.stylize(""+t,"number"):f(t)?e.stylize(""+t,"boolean"):g(t)?e.stylize("null","null"):void 0}function h(e){return"["+Error.prototype.toString.call(e)+"]"}function u(e,t,i,n,s){for(var r=[],o=0,a=t.length;o-1&&(a=r?a.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+a.split("\n").map(function(e){return" "+e}).join("\n")):a=e.stylize("[Circular]","special")),E(o)){if(r&&s.match(/^\d+$/))return a;(o=JSON.stringify(""+s)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(o=o.substr(1,o.length-2),o=e.stylize(o,"name")):(o=o.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),o=e.stylize(o,"string"))}return o+": "+a}function p(e,t,i){var n=0;return e.reduce(function(e,t){return n++,t.indexOf("\n")>=0&&n++,e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0)>60?i[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+i[1]:i[0]+t+" "+e.join(", ")+" "+i[1]}function m(e){return Array.isArray(e)}function f(e){return"boolean"==typeof e}function g(e){return null===e}function v(e){return"number"==typeof e}function b(e){return"string"==typeof e}function E(e){return void 0===e}function y(e){return w(e)&&"[object RegExp]"===A(e)}function w(e){return"object"==typeof e&&null!==e}function _(e){return w(e)&&"[object Date]"===A(e)}function x(e){return w(e)&&("[object Error]"===A(e)||e instanceof Error)}function R(e){return"function"==typeof e}function A(e){return Object.prototype.toString.call(e)}function k(e){return e<10?"0"+e.toString(10):e.toString(10)}function T(){var e=new Date,t=[k(e.getHours()),k(e.getMinutes()),k(e.getSeconds())].join(":");return[e.getDate(),I[e.getMonth()],t].join(" ")}function S(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var M=/%[sdj%]/g;t.format=function(e){if(!b(e)){for(var t=[],i=0;i=r)return e;switch(e){case"%s":return String(n[i++]);case"%d":return Number(n[i++]);case"%j":try{return JSON.stringify(n[i++])}catch(e){return"[Circular]"}default:return e}}),a=n[i];ithis.client.resolver.resolveBuffer(e.attachment).then(t=>(e.file=t,e)))).then(i=>this.client.rest.methods.sendMessage(this,e,t,i))}return this.client.rest.methods.sendMessage(this,e,t)}fetchMessage(e){return this.client.user.bot?this.client.rest.methods.getChannelMessage(this,e).then(e=>{const t=e instanceof s?e:new s(this,e,this.client);return this._cacheMessage(t),t}):this.fetchMessages({limit:1,around:e}).then(t=>{const i=t.get(e);if(!i)throw new Error("Message not found.");return i})}fetchMessages(e={}){return this.client.rest.methods.getChannelMessages(this,e).then(e=>{const t=new o;for(const i of e){const e=new s(this,i,this.client);t.set(i.id,e),this._cacheMessage(e)}return t})}fetchPinnedMessages(){return this.client.rest.methods.getChannelPinnedMessages(this).then(e=>{const t=new o;for(const i of e){const e=new s(this,i,this.client);t.set(i.id,e),this._cacheMessage(e)}return t})}search(e={}){return this.client.rest.methods.search(this,e)}startTyping(e){if(void 0!==e&&e<1)throw new RangeError("Count must be at least 1.");if(this.client.user._typing.has(this.id)){const t=this.client.user._typing.get(this.id);t.count=e||t.count+1}else this.client.user._typing.set(this.id,{count:e||1,interval:this.client.setInterval(()=>{this.client.rest.methods.sendTyping(this.id)},9e3)}),this.client.rest.methods.sendTyping(this.id)}stopTyping(e=!1){if(this.client.user._typing.has(this.id)){const t=this.client.user._typing.get(this.id);t.count--,(t.count<=0||e)&&(this.client.clearInterval(t.interval),this.client.user._typing.delete(this.id))}}get typing(){return this.client.user._typing.has(this.id)}get typingCount(){return this.client.user._typing.has(this.id)?this.client.user._typing.get(this.id).count:0}createCollector(e,t){return this.createMessageCollector(e,t)}createMessageCollector(e,t={}){return new r(this,e,t)}awaitMessages(e,t={}){return new Promise((i,n)=>{this.createCollector(e,t).once("end",(e,s)=>{t.errors&&t.errors.includes(s)?n(e):i(e)})})}bulkDelete(e,t=!1){if(!isNaN(e))return this.fetchMessages({limit:e}).then(e=>this.bulkDelete(e,t));if(e instanceof Array||e instanceof o){const i=e instanceof o?e.keyArray():e.map(e=>e.id);return this.client.rest.methods.bulkDeleteMessages(this,i,t)}throw new TypeError("The messages must be an Array, Collection, or number.")}acknowledge(){return this.lastMessageID?this.client.rest.methods.ackTextChannel(this):Promise.resolve(this)}_cacheMessage(e){const t=this.client.options.messageCacheMaxSize;return 0===t?null:(this.messages.size>=t&&t>0&&this.messages.delete(this.messages.firstKey()),this.messages.set(e.id,e),e)}}const l={sendMessage(e,t){return this.send(e,t)},sendEmbed(e,t,i){return i||"object"!=typeof t||t instanceof Array?i||(i={}):(i=t,t=""),this.send(t,Object.assign(i,{embed:e}))},sendFiles(e,t,i={}){return this.send(t,Object.assign(i,{files:e}))},sendFile(e,t,i,n={}){return this.send({files:[{attachment:e,name:t}],content:i,options:n})},sendCode(e,t,i={}){return this.send(t,Object.assign(i,{code:e}))}};for(const e of Object.keys(l))c.prototype[e]=a.deprecate(l[e],`TextChannel#${e}: use TextChannel#send instead`);t.applyToClass=((e,t=!1,i=[])=>{const n=["send","sendMessage","sendEmbed","sendFile","sendFiles","sendCode"];t&&n.push("_cacheMessage","acknowledge","fetchMessages","fetchMessage","search","bulkDelete","startTyping","stopTyping","typing","typingCount","fetchPinnedMessages","createCollector","createMessageCollector","awaitMessages");for(const t of n)i.includes(t)||Object.defineProperty(e.prototype,t,Object.getOwnPropertyDescriptor(c.prototype,t))})},function(e,t,i){const n=i(54),s=i(55),r=i(56),o=i(57),a=i(58),c=i(4),l=i(3),h=i(0),u=i(11);let d;class p{constructor(e,t,i){Object.defineProperty(this,"client",{value:i}),this.channel=e,t&&this.setup(t)}setup(e){this.id=e.id,this.type=h.MessageTypes[e.type],this.content=e.content,this.author=this.client.dataManager.newUser(e.author),this.member=this.guild?this.guild.member(this.author)||null:null,this.pinned=e.pinned,this.tts=e.tts,this.nonce=e.nonce,this.system=6===e.type,this.embeds=e.embeds.map(e=>new r(this,e)),this.attachments=new l;for(const t of e.attachments)this.attachments.set(t.id,new s(this,t));if(this.createdTimestamp=new Date(e.timestamp).getTime(),this.editedTimestamp=e.edited_timestamp?new Date(e.edited_timestamp).getTime():null,this.reactions=new l,e.reactions&&e.reactions.length>0)for(const t of e.reactions){const e=t.emoji.id?`${t.emoji.name}:${t.emoji.id}`:t.emoji.name;this.reactions.set(e,new o(this,t.emoji,t.count,t.me))}this.mentions=new n(this,e.mentions,e.mention_roles,e.mention_everyone),this.webhookID=e.webhook_id||null,this.hit="boolean"==typeof e.hit?e.hit:null,this._edits=[]}patch(e){const t=c.cloneObject(this);if(this._edits.unshift(t),this.editedTimestamp=new Date(e.edited_timestamp).getTime(),"content"in e&&(this.content=e.content),"pinned"in e&&(this.pinned=e.pinned),"tts"in e&&(this.tts=e.tts),this.embeds="embeds"in e?e.embeds.map(e=>new r(this,e)):this.embeds.slice(),"attachments"in e){this.attachments=new l;for(const t of e.attachments)this.attachments.set(t.id,new s(this,t))}else this.attachments=new l(this.attachments);this.mentions=new n(this,"mentions"in e?e.mentions:this.mentions.users,"mentions_roles"in e?e.mentions_roles:this.mentions.roles,"mention_everyone"in e?e.mention_everyone:this.mentions.everyone)}get createdAt(){return new Date(this.createdTimestamp)}get editedAt(){return this.editedTimestamp?new Date(this.editedTimestamp):null}get guild(){return this.channel.guild||null}get cleanContent(){return this.content.replace(/@(everyone|here)/g,"@​$1").replace(/<@!?[0-9]+>/g,e=>{const t=e.replace(/<|!|>|@/g,"");if("dm"===this.channel.type||"group"===this.channel.type)return this.client.users.has(t)?`@${this.client.users.get(t).username}`:e;const i=this.channel.guild.members.get(t);if(i)return i.nickname?`@${i.nickname}`:`@${i.user.username}`;{const i=this.client.users.get(t);return i?`@${i.username}`:e}}).replace(/<#[0-9]+>/g,e=>{const t=this.client.channels.get(e.replace(/<|#|>/g,""));return t?`#${t.name}`:e}).replace(/<@&[0-9]+>/g,e=>{if("dm"===this.channel.type||"group"===this.channel.type)return e;const t=this.guild.roles.get(e.replace(/<|@|>|&/g,""));return t?`@${t.name}`:e})}createReactionCollector(e,t={}){return new a(this,e,t)}awaitReactions(e,t={}){return new Promise((i,n)=>{this.createReactionCollector(e,t).once("end",(e,s)=>{t.errors&&t.errors.includes(s)?n(e):i(e)})})}get edits(){const e=this._edits.slice();return e.unshift(this),e}get editable(){return this.author.id===this.client.user.id}get deletable(){return this.author.id===this.client.user.id||this.guild&&this.channel.permissionsFor(this.client.user).has(u.FLAGS.MANAGE_MESSAGES)}get pinnable(){return!this.guild||this.channel.permissionsFor(this.client.user).has(u.FLAGS.MANAGE_MESSAGES)}isMentioned(e){return e=e&&e.id?e.id:e,this.mentions.users.has(e)||this.mentions.channels.has(e)||this.mentions.roles.has(e)}isMemberMentioned(e){return d||(d=i(24)),!!this.mentions.everyone||(!!this.mentions.users.has(e.id)||!!(e instanceof d&&e.roles.some(e=>this.mentions.roles.has(e.id))))}edit(e,t){return t||"object"!=typeof e||e instanceof Array?t||(t={}):(t=e,e=""),this.client.rest.methods.updateMessage(this,e,t)}editCode(e,t){return t=c.escapeMarkdown(this.client.resolver.resolveString(t),!0),this.edit(`\`\`\`${e||""}\n${t}\n\`\`\``)}pin(){return this.client.rest.methods.pinMessage(this)}unpin(){return this.client.rest.methods.unpinMessage(this)}react(e){if(!(e=this.client.resolver.resolveEmojiIdentifier(e)))throw new TypeError("Emoji must be a string or Emoji/ReactionEmoji");return this.client.rest.methods.addMessageReaction(this,e)}clearReactions(){return this.client.rest.methods.removeMessageReactions(this)}delete(e=0){return e<=0?this.client.rest.methods.deleteMessage(this):new Promise(t=>{this.client.setTimeout(()=>{t(this.delete())},e)})}reply(e,t){return t||"object"!=typeof e||e instanceof Array?t||(t={}):(t=e,e=""),this.channel.send(e,Object.assign(t,{reply:this.member||this.author}))}acknowledge(){return this.client.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(e,t){if(!e)return!1;if(!e.author&&!e.attachments)return this.id===e.id&&this.embeds.length===e.embeds.length;let i=this.id===e.id&&this.author.id===e.author.id&&this.content===e.content&&this.tts===e.tts&&this.nonce===e.nonce&&this.embeds.length===e.embeds.length&&this.attachments.length===e.attachments.length;return i&&t&&(i=this.mentions.everyone===e.mentions.everyone&&this.createdTimestamp===new Date(t.timestamp).getTime()&&this.editedTimestamp===new Date(t.edited_timestamp).getTime()),i}toString(){return this.content}_addReaction(e,t){const i=e.id?`${e.name}:${e.id}`:encodeURIComponent(e.name);let n;return this.reactions.has(i)?(n=this.reactions.get(i)).me||(n.me=t.id===this.client.user.id):(n=new o(this,e,0,t.id===this.client.user.id),this.reactions.set(i,n)),n.users.has(t.id)||n.users.set(t.id,t),n.count++,n}_removeReaction(e,t){const i=e.id?`${e.name}:${e.id}`:encodeURIComponent(e.name);if(this.reactions.has(i)){const e=this.reactions.get(i);if(e.users.has(t.id))return e.users.delete(t.id),e.count--,t.id===this.client.user.id&&(e.me=!1),e.count<=0&&this.reactions.delete(i),e}return null}_clearReactions(){this.reactions.clear()}}e.exports=p},function(e,t,i){const n=i(0),s=i(3),r=i(8);class o{constructor(e,t){Object.defineProperty(this,"client",{value:e.client}),this.guild=e,this.setup(t)}setup(e){this.id=e.id,this.name=e.name,this.requiresColons=e.require_colons,this.managed=e.managed,this._roles=e.roles}get createdTimestamp(){return r.deconstruct(this.id).timestamp}get createdAt(){return new Date(this.createdTimestamp)}get roles(){const e=new s;for(const t of this._roles)this.guild.roles.has(t)&&e.set(t,this.guild.roles.get(t));return e}get url(){return n.Endpoints.CDN(this.client.options.http.cdn).Emoji(this.id)}get identifier(){return this.id?`${this.name}:${this.id}`:encodeURIComponent(this.name)}edit(e){return this.client.rest.methods.updateEmoji(this,e)}setName(e){return this.edit({name:e})}addRestrictedRole(e){return this.addRestrictedRoles([e])}addRestrictedRoles(e){const t=new s(this.roles);for(const i of e)this.guild.roles.has(i.id)&&t.set(i.id,i);return this.edit({roles:t})}removeRestrictedRole(e){return this.removeRestrictedRoles([e])}removeRestrictedRoles(e){const t=new s(this.roles);for(const i of e)t.has(i.id)&&t.delete(i.id);return this.edit({roles:t})}toString(){return this.requiresColons?`<:${this.name}:${this.id}>`:this.name}equals(e){return e instanceof o?e.id===this.id&&e.name===this.name&&e.managed===this.managed&&e.requiresColons===this.requiresColons:e.id===this.id&&e.name===this.name}}e.exports=o},function(e,t,i){const n=i(21),s=i(14),r=i(11),o=i(3),a=i(15).Presence,c=i(20);class l{constructor(e,t){Object.defineProperty(this,"client",{value:e.client}),this.guild=e,this.user={},this._roles=[],t&&this.setup(t),this.lastMessageID=null,this.lastMessage=null}setup(e){this.serverDeaf=e.deaf,this.serverMute=e.mute,this.selfMute=e.self_mute,this.selfDeaf=e.self_deaf,this.voiceSessionID=e.session_id,this.voiceChannelID=e.channel_id,this.speaking=!1,this.nickname=e.nick||null,this.joinedTimestamp=new Date(e.joined_at).getTime(),this.user=e.user,this._roles=e.roles}get joinedAt(){return new Date(this.joinedTimestamp)}get presence(){return this.frozenPresence||this.guild.presences.get(this.id)||new a}get roles(){const e=new o,t=this.guild.roles.get(this.guild.id);t&&e.set(t.id,t);for(const t of this._roles){const i=this.guild.roles.get(t);i&&e.set(i.id,i)}return e}get highestRole(){return this.roles.reduce((e,t)=>!e||t.comparePositionTo(e)>0?t:e)}get colorRole(){const e=this.roles.filter(e=>e.color);return e.size?e.reduce((e,t)=>!e||t.comparePositionTo(e)>0?t:e):null}get displayColor(){const e=this.colorRole;return e&&e.color||0}get displayHexColor(){const e=this.colorRole;return e&&e.hexColor||"#000000"}get hoistRole(){const e=this.roles.filter(e=>e.hoist);return e.size?e.reduce((e,t)=>!e||t.comparePositionTo(e)>0?t:e):null}get mute(){return this.selfMute||this.serverMute}get deaf(){return this.selfDeaf||this.serverDeaf}get voiceChannel(){return this.guild.channels.get(this.voiceChannelID)}get id(){return this.user.id}get displayName(){return this.nickname||this.user.username}get permissions(){if(this.user.id===this.guild.ownerID)return new r(this,r.ALL);let e=0;const t=this.roles;for(const i of t.values())e|=i.permissions;return new r(this,e)}get kickable(){if(this.user.id===this.guild.ownerID)return!1;if(this.user.id===this.client.user.id)return!1;const e=this.guild.member(this.client.user);return!!e.permissions.has(r.FLAGS.KICK_MEMBERS)&&e.highestRole.comparePositionTo(this.highestRole)>0}get bannable(){if(this.user.id===this.guild.ownerID)return!1;if(this.user.id===this.client.user.id)return!1;const e=this.guild.member(this.client.user);return!!e.permissions.has(r.FLAGS.BAN_MEMBERS)&&e.highestRole.comparePositionTo(this.highestRole)>0}permissionsIn(e){if(!(e=this.client.resolver.resolveChannel(e))||!e.guild)throw new Error("Could not resolve channel to a guild channel.");return e.permissionsFor(this)}hasPermission(e,t=!1,i,n){return void 0===i&&(i=!t),void 0===n&&(n=!t),!(!n||this.user.id!==this.guild.ownerID)||this.roles.some(t=>t.hasPermission(e,void 0,i))}hasPermissions(e,t=!1){return!t&&this.user.id===this.guild.ownerID||this.hasPermission(e,t)}missingPermissions(e,t=!1){return e.missing(e,t)}edit(e){return this.client.rest.methods.updateGuildMember(this,e)}setMute(e){return this.edit({mute:e})}setDeaf(e){return this.edit({deaf:e})}setVoiceChannel(e){return this.edit({channel:e})}setRoles(e){return this.edit({roles:e})}addRole(e){if(e instanceof s||(e=this.guild.roles.get(e)),!e)throw new TypeError("Supplied parameter was neither a Role nor a Snowflake.");return this.client.rest.methods.addMemberRole(this,e)}addRoles(e){let t;if(e instanceof o){t=this._roles.slice();for(const i of e.values())t.push(i.id)}else t=this._roles.concat(e);return this.edit({roles:t})}removeRole(e){if(e instanceof s||(e=this.guild.roles.get(e)),!e)throw new TypeError("Supplied parameter was neither a Role nor a Snowflake.");return this.client.rest.methods.removeMemberRole(this,e)}removeRoles(e){const t=this._roles.slice();if(e instanceof o)for(const i of e.values()){const e=t.indexOf(i.id);e>=0&&t.splice(e,1)}else for(const i of e){const e=t.indexOf(i instanceof s?i.id:i);e>=0&&t.splice(e,1)}return this.edit({roles:t})}setNickname(e){return this.edit({nick:e})}createDM(){return this.user.createDM()}deleteDM(){return this.user.deleteDM()}kick(e){return this.client.rest.methods.kickGuildMember(this.guild,this,e)}ban(e){return this.guild.ban(this,e)}toString(){return`<@${this.nickname?"!":""}${this.user.id}>`}send(){}sendMessage(){}sendEmbed(){}sendFile(){}sendCode(){}}n.applyToClass(l),l.prototype.hasPermissions=c.deprecate(l.prototype.hasPermissions,"GuildMember#hasPermissions is deprecated - use GuildMember#hasPermission, it now takes an array"),e.exports=l},function(e,t,i){"use strict";(function(t){!t.version||0===t.version.indexOf("v0.")||0===t.version.indexOf("v1.")&&0!==t.version.indexOf("v1.8.")?e.exports=function(e,i,n,s){if("function"!=typeof e)throw new TypeError('"callback" argument must be a function');var r,o,a=arguments.length;switch(a){case 0:case 1:return t.nextTick(e);case 2:return t.nextTick(function(){e.call(null,i)});case 3:return t.nextTick(function(){e.call(null,i,n)});case 4:return t.nextTick(function(){e.call(null,i,n,s)});default:for(r=new Array(a-1),o=0;o{const t=new h;for(const i of e.values())t.set(i.user.id,i.user);return t})}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)}fetchAuditLogs(e){return this.client.rest.methods.getGuildAuditLogs(this,e)}addMember(e,t){return this.members.has(e.id)?Promise.resolve(this.members.get(e.id)):this.client.rest.methods.putGuildMember(this,e,t)}fetchMember(e,t=!0){return(e=this.client.resolver.resolveUser(e))?this.members.has(e.id)?Promise.resolve(this.members.get(e.id)):this.client.rest.methods.getGuildMember(this,e,t):Promise.reject(new Error("User is not cached. Use Client.fetchUser first."))}fetchMembers(e="",t=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:e,limit:t}});const s=(e,t)=>{t.id===this.id&&(this.memberCount===this.members.size||e.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(e={}){return this.client.rest.methods.search(this,e)}edit(e){return this.client.rest.methods.updateGuild(this,e)}setName(e){return this.edit({name:e})}setRegion(e){return this.edit({region:e})}setVerificationLevel(e){return this.edit({verificationLevel:e})}setAFKChannel(e){return this.edit({afkChannel:e})}setAFKTimeout(e){return this.edit({afkTimeout:e})}setIcon(e){return this.edit({icon:e})}setOwner(e){return this.edit({owner:e})}setSplash(e){return this.edit({splash:e})}setPosition(e,t){return this.client.user.bot?Promise.reject(new Error("Setting guild position is only available for user accounts")):this.client.user.settings.setGuildPosition(this,e,t)}acknowledge(){return this.client.rest.methods.ackGuild(this)}allowDMs(e){const t=this.client.user.settings;return e?t.removeRestrictedGuild(this):t.addRestrictedGuild(this)}ban(e,t={}){return"number"==typeof t?t={reason:null,"delete-message-days":t}:"string"==typeof t&&(t={reason:t,"delete-message-days":0}),t.days&&(t["delete-message-days"]=t.days),this.client.rest.methods.banGuildMember(this,e,t)}unban(e){return this.client.rest.methods.unbanGuildMember(this,e)}pruneMembers(e,t=!1){if("number"!=typeof e)throw new TypeError("Days must be a number.");return this.client.rest.methods.pruneGuildMembers(this,e,t)}sync(){this.client.user.bot||this.client.syncGuilds([this])}createChannel(e,t,i){return this.client.rest.methods.createChannel(this,e,t,i)}setChannelPositions(e){return this.client.rest.methods.updateChannelPositions(this.id,e)}createRole(e={}){return this.client.rest.methods.createGuildRole(this,e)}createEmoji(e,t,i){return new Promise(n=>{"string"==typeof e&&e.startsWith("data:")?n(this.client.rest.methods.createEmoji(this,e,t,i)):this.client.resolver.resolveBuffer(e).then(e=>{const s=this.client.resolver.resolveBase64(e);n(this.client.rest.methods.createEmoji(this,s,t,i))})})}deleteEmoji(e){return e instanceof o||(e=this.emojis.get(e)),this.client.rest.methods.deleteEmoji(e)}leave(){return this.client.rest.methods.leaveGuild(this)}delete(){return this.client.rest.methods.deleteGuild(this)}equals(e){let t=e&&this.id===e.id&&this.available===!e.unavailable&&this.splash===e.splash&&this.region===e.region&&this.name===e.name&&this.memberCount===e.member_count&&this.large===e.large&&this.icon===e.icon&&u.arraysEqual(this.features,e.features)&&this.ownerID===e.owner_id&&this.verificationLevel===e.verification_level&&this.embedEnabled===e.embed_enabled;return t&&(this.embedChannel?this.embedChannel.id!==e.embed_channel_id&&(t=!1):e.embed_channel_id&&(t=!1)),t}toString(){return this.name}_addMember(e,t=!0){const i=this.members.has(e.user.id);e.user instanceof s||(e.user=this.client.dataManager.newUser(e.user)),e.joined_at=e.joined_at||0;const n=new c(this,e);if(this.members.set(n.id,n),this._rawVoiceStates&&this._rawVoiceStates.has(n.user.id)){const e=this._rawVoiceStates.get(n.user.id);n.serverMute=e.mute,n.serverDeaf=e.deaf,n.selfMute=e.self_mute,n.selfDeaf=e.self_deaf,n.voiceSessionID=e.session_id,n.voiceChannelID=e.channel_id,this.client.channels.has(e.channel_id)?this.client.channels.get(e.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.connection.status===l.Status.READY&&t&&!i&&this.client.emit(l.Events.GUILD_MEMBER_ADD,n),n}_updateMember(e,t){const i=u.cloneObject(e);t.roles&&(e._roles=t.roles),void 0!==t.nick&&(e.nickname=t.nick);const n=e.nickname!==i.nickname||!u.arraysEqual(e._roles,i._roles);return this.client.ws.connection.status===l.Status.READY&&n&&this.client.emit(l.Events.GUILD_MEMBER_UPDATE,i,e),{old:i,mem:e}}_removeMember(e){this.members.delete(e.id)}_memberSpeakUpdate(e,t){const i=this.members.get(e);i&&i.speaking!==t&&(i.speaking=t,this.client.emit(l.Events.GUILD_MEMBER_SPEAKING,i,t))}_setPresence(e,t){this.presences.get(e)?this.presences.get(e).update(t):this.presences.set(e,new a(t))}setRolePosition(e,t,i=!1){if("string"==typeof e&&!(e=this.roles.get(e)))return Promise.reject(new Error("Supplied role is not a role or snowflake."));if(t=Number(t),isNaN(t))return Promise.reject(new Error("Supplied position is not a number."));let n=this._sortedRoles.array();return u.moveElementInArray(n,e,t,i),n=n.map((e,t)=>({id:e.id,position:t})),this.client.rest.methods.setRolePositions(this.id,n)}setChannelPosition(e,t,i=!1){if("string"==typeof e&&!(e=this.channels.get(e)))return Promise.reject(new Error("Supplied channel is not a channel or snowflake."));if(t=Number(t),isNaN(t))return Promise.reject(new Error("Supplied position is not a number."));let n=this._sortedChannels(e.type).array();return u.moveElementInArray(n,e,t,i),n=n.map((e,t)=>({id:e.id,position:t})),this.client.rest.methods.setChannelPositions(this.id,n)}_sortedChannels(e){return this._sortPositionWithID(this.channels.filter(t=>"voice"===e&&"voice"===t.type||("voice"!==e&&"voice"!==t.type||e===t.type)))}_sortPositionWithID(e){return e.sort((e,t)=>e.position!==t.position?e.position-t.position:n.fromString(e.id).sub(n.fromString(t.id)).toNumber())}}e.exports=p},function(e,t,i){const n=i(16),s=i(14),r=i(68),o=i(11),a=i(3);class c extends n{constructor(e,t){super(e.client,t),this.guild=e}setup(e){if(super.setup(e),this.name=e.name,this.position=e.position,this.permissionOverwrites=new a,e.permission_overwrites)for(const t of e.permission_overwrites)this.permissionOverwrites.set(t.id,new r(this,t))}get calculatedPosition(){const e=this.guild._sortedChannels(this.type);return e.array().indexOf(e.get(this.id))}permissionsFor(e){if(!(e=this.client.resolver.resolveGuildMember(this.guild,e)))return null;if(e.id===this.guild.ownerID)return new o(e,o.ALL);let t=0;const i=e.roles;for(const e of i.values())t|=e.permissions;const n=this.overwritesFor(e,!0,i);n.everyone&&(t&=~n.everyone.deny,t|=n.everyone.allow);let s=0;for(const e of n.roles)t&=~e.deny,s|=e.allow;return t|=s,n.member&&(t&=~n.member.deny,t|=n.member.allow),Boolean(t&o.FLAGS.ADMINISTRATOR)&&(t=o.ALL),new o(e,t)}overwritesFor(e,t=!1,i=null){if(t||(e=this.client.resolver.resolveGuildMember(this.guild,e)),!e)return[];i=i||e.roles;const n=[];let s,r;for(const t of this.permissionOverwrites.values())t.id===this.guild.id?r=t:i.has(t.id)?n.push(t):t.id===e.id&&(s=t);return{everyone:r,roles:n,member:s}}overwritePermissions(e,t){const i={allow:0,deny:0};if(e instanceof s)i.type="role";else if(this.guild.roles.has(e))e=this.guild.roles.get(e),i.type="role";else if(e=this.client.resolver.resolveUser(e),i.type="member",!e)return Promise.reject(new TypeError("Supplied parameter was neither a User nor a Role."));i.id=e.id;const n=this.permissionOverwrites.get(e.id);n&&(i.allow=n.allow,i.deny=n.deny);for(const e in t)!0===t[e]?(i.allow|=o.FLAGS[e]||0,i.deny&=~(o.FLAGS[e]||0)):!1===t[e]?(i.allow&=~(o.FLAGS[e]||0),i.deny|=o.FLAGS[e]||0):null===t[e]&&(i.allow&=~(o.FLAGS[e]||0),i.deny&=~(o.FLAGS[e]||0));return this.client.rest.methods.setChannelOverwrite(this,i)}edit(e){return this.client.rest.methods.updateChannel(this,e)}setName(e){return this.edit({name:e})}setPosition(e,t){return this.guild.setChannelPosition(this,e,t).then(()=>this)}setTopic(e){return this.client.rest.methods.updateChannel(this,{topic:e})}createInvite(e={}){return this.client.rest.methods.createChannelInvite(this,e)}clone(e=this.name,t=!0,i=!0){return this.guild.createChannel(e,this.type,t?this.permissionOverwrites:[]).then(e=>i?e.setTopic(this.topic):e)}equals(e){let t=e&&this.id===e.id&&this.type===e.type&&this.topic===e.topic&&this.position===e.position&&this.name===e.name;return t&&(t=this.permissionOverwrites&&e.permissionOverwrites?this.permissionOverwrites.equals(e.permissionOverwrites):!this.permissionOverwrites&&!e.permissionOverwrites),t}get deletable(){return this.id!==this.guild.id&&this.permissionsFor(this.client.user).has(o.FLAGS.MANAGE_CHANNELS)}toString(){return`<#${this.id}>`}}e.exports=c},function(e,t,i){const n=i(76);e.exports=n},function(e,t,i){function n(){s.call(this)}e.exports=n;var s=i(9).EventEmitter;i(10)(n,s),n.Readable=i(17),n.Writable=i(83),n.Duplex=i(84),n.Transform=i(85),n.PassThrough=i(86),n.Stream=n,n.prototype.pipe=function(e,t){function i(t){e.writable&&!1===e.write(t)&&l.pause&&l.pause()}function n(){l.readable&&l.resume&&l.resume()}function r(){h||(h=!0,e.end())}function o(){h||(h=!0,"function"==typeof e.destroy&&e.destroy())}function a(e){if(c(),0===s.listenerCount(this,"error"))throw e}function c(){l.removeListener("data",i),e.removeListener("drain",n),l.removeListener("end",r),l.removeListener("close",o),l.removeListener("error",a),e.removeListener("error",a),l.removeListener("end",c),l.removeListener("close",c),e.removeListener("close",c)}var l=this;l.on("data",i),e.on("drain",n),e._isStdio||t&&!1===t.end||(l.on("end",r),l.on("close",o));var h=!1;return l.on("error",a),e.on("error",a),l.on("end",c),l.on("close",c),e.on("close",c),e.emit("pipe",l),e}},function(e,t,i){function n(e,t){for(var i in e)t[i]=e[i]}function s(e,t,i){return o(e,t,i)}var r=i(5),o=r.Buffer;o.from&&o.alloc&&o.allocUnsafe&&o.allocUnsafeSlow?e.exports=r:(n(r,t),t.Buffer=s),n(o,s),s.from=function(e,t,i){if("number"==typeof e)throw new TypeError("Argument must not be a number");return o(e,t,i)},s.alloc=function(e,t,i){if("number"!=typeof e)throw new TypeError("Argument must be a number");var n=o(e);return void 0!==t?"string"==typeof i?n.fill(t,i):n.fill(t):n.fill(0),n},s.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return o(e)},s.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return r.SlowBuffer(e)}},function(e,t,i){"use strict";(function(t,n,s){function r(e){var t=this;this.next=null,this.entry=null,this.finish=function(){T(t,e)}}function o(e){return L.from(e)}function a(e){return L.isBuffer(e)||e instanceof O}function c(){}function l(e,t){M=M||i(12),e=e||{},this.objectMode=!!e.objectMode,t instanceof M&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var n=e.highWaterMark,s=this.objectMode?16:16384;this.highWaterMark=n||0===n?n:s,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var o=!1===e.decodeStrings;this.decodeStrings=!o,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){b(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new r(this)}function h(e){if(M=M||i(12),!(P.call(h,this)||this instanceof M))return new h(e);this._writableState=new l(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),U.call(this)}function u(e,t){var i=new Error("write after end");e.emit("error",i),S(t,i)}function d(e,t,i,n){var s=!0,r=!1;return null===i?r=new TypeError("May not write null values to stream"):"string"==typeof i||void 0===i||t.objectMode||(r=new TypeError("Invalid non-string/buffer chunk")),r&&(e.emit("error",r),S(n,r),s=!1),s}function p(e,t,i){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=L.from(t,i)),t}function m(e,t,i,n,s,r){if(!i){var o=p(t,n,s);n!==o&&(i=!0,s="buffer",n=o)}var a=t.objectMode?1:n.length;t.length+=a;var c=t.length-1?n:S;h.WritableState=l;var C=i(18);C.inherits=i(10);var I={deprecate:i(81)},U=i(44),L=i(32).Buffer,O=s.Uint8Array||function(){},N=i(45);C.inherits(h,U),l.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(l.prototype,"buffer",{get:I.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}();var P;"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(P=Function.prototype[Symbol.hasInstance],Object.defineProperty(h,Symbol.hasInstance,{value:function(e){return!!P.call(this,e)||e&&e._writableState instanceof l}})):P=function(e){return e instanceof this},h.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},h.prototype.write=function(e,t,i){var n=this._writableState,s=!1,r=a(e)&&!n.objectMode;return r&&!L.isBuffer(e)&&(e=o(e)),"function"==typeof t&&(i=t,t=null),r?t="buffer":t||(t=n.defaultEncoding),"function"!=typeof i&&(i=c),n.ended?u(this,i):(r||d(this,n,e,i))&&(n.pendingcb++,s=m(this,n,r,e,t,i)),s},h.prototype.cork=function(){this._writableState.corked++},h.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.finished||e.bufferProcessing||!e.bufferedRequest||w(this,e))},h.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},h.prototype._write=function(e,t,i){i(new Error("_write() is not implemented"))},h.prototype._writev=null,h.prototype.end=function(e,t,i){var n=this._writableState;"function"==typeof e?(i=e,e=null,t=null):"function"==typeof t&&(i=t,t=null),null!==e&&void 0!==e&&this.write(e,t),n.corked&&(n.corked=1,this.uncork()),n.ending||n.finished||k(this,n,i)},Object.defineProperty(h.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),h.prototype.destroy=N.destroy,h.prototype._undestroy=N.undestroy,h.prototype._destroy=function(e,t){this.end(),t(e)}}).call(t,i(7),i(79).setImmediate,i(6))},function(e,t,i){"use strict";t.decode=t.parse=i(87),t.encode=t.stringify=i(88)},function(e,t,i){var n,s,r;!function(i,o){s=[],void 0!==(r="function"==typeof(n=o)?n.apply(t,s):n)&&(e.exports=r)}(0,function(){"use strict";function e(e,t,i){this.low=0|e,this.high=0|t,this.unsigned=!!i}function t(e){return!0===(e&&e.__isLong__)}function i(e,t){var i,n,r;return t?(e>>>=0,(r=0<=e&&e<256)&&(n=c[e])?n:(i=s(e,(0|e)<0?-1:0,!0),r&&(c[e]=i),i)):(e|=0,(r=-128<=e&&e<128)&&(n=a[e])?n:(i=s(e,e<0?-1:0,!1),r&&(a[e]=i),i))}function n(e,t){if(isNaN(e)||!isFinite(e))return t?f:m;if(t){if(e<0)return f;if(e>=u)return y}else{if(e<=-d)return w;if(e+1>=d)return E}return e<0?n(-e,t).neg():s(e%h|0,e/h|0,t)}function s(t,i,n){return new e(t,i,n)}function r(e,t,i){if(0===e.length)throw Error("empty string");if("NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return m;if("number"==typeof t?(i=t,t=!1):t=!!t,(i=i||10)<2||360)throw Error("interior hyphen");if(0===s)return r(e.substring(1),t,i).neg();for(var o=n(l(i,8)),a=m,c=0;c>>0:this.low},_.toNumber=function(){return this.unsigned?(this.high>>>0)*h+(this.low>>>0):this.high*h+(this.low>>>0)},_.toString=function(e){if((e=e||10)<2||36>>0).toString(e);if((o=c).isZero())return h+a;for(;h.length<6;)h="0"+h;a=""+h+a}},_.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 e=0!=this.high?this.high:this.low,t=31;t>0&&0==(e&1<=0},_.isOdd=function(){return 1==(1&this.low)},_.isEven=function(){return 0==(1&this.low)},_.equals=function(e){return t(e)||(e=o(e)),(this.unsigned===e.unsigned||this.high>>>31!=1||e.high>>>31!=1)&&(this.high===e.high&&this.low===e.low)},_.eq=_.equals,_.notEquals=function(e){return!this.eq(e)},_.neq=_.notEquals,_.lessThan=function(e){return this.comp(e)<0},_.lt=_.lessThan,_.lessThanOrEqual=function(e){return this.comp(e)<=0},_.lte=_.lessThanOrEqual,_.greaterThan=function(e){return this.comp(e)>0},_.gt=_.greaterThan,_.greaterThanOrEqual=function(e){return this.comp(e)>=0},_.gte=_.greaterThanOrEqual,_.compare=function(e){if(t(e)||(e=o(e)),this.eq(e))return 0;var i=this.isNegative(),n=e.isNegative();return i&&!n?-1:!i&&n?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1},_.comp=_.compare,_.negate=function(){return!this.unsigned&&this.eq(w)?w:this.not().add(g)},_.neg=_.negate,_.add=function(e){t(e)||(e=o(e));var i=this.high>>>16,n=65535&this.high,r=this.low>>>16,a=65535&this.low,c=e.high>>>16,l=65535&e.high,h=e.low>>>16,u=0,d=0,p=0,m=0;return m+=a+(65535&e.low),p+=m>>>16,m&=65535,p+=r+h,d+=p>>>16,p&=65535,d+=n+l,u+=d>>>16,d&=65535,u+=i+c,u&=65535,s(p<<16|m,u<<16|d,this.unsigned)},_.subtract=function(e){return t(e)||(e=o(e)),this.add(e.neg())},_.sub=_.subtract,_.multiply=function(e){if(this.isZero())return m;if(t(e)||(e=o(e)),e.isZero())return m;if(this.eq(w))return e.isOdd()?w:m;if(e.eq(w))return this.isOdd()?w:m;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(p)&&e.lt(p))return n(this.toNumber()*e.toNumber(),this.unsigned);var i=this.high>>>16,r=65535&this.high,a=this.low>>>16,c=65535&this.low,l=e.high>>>16,h=65535&e.high,u=e.low>>>16,d=65535&e.low,f=0,g=0,v=0,b=0;return b+=c*d,v+=b>>>16,b&=65535,v+=a*d,g+=v>>>16,v&=65535,v+=c*u,g+=v>>>16,v&=65535,g+=r*d,f+=g>>>16,g&=65535,g+=a*u,f+=g>>>16,g&=65535,g+=c*h,f+=g>>>16,g&=65535,f+=i*d+r*u+a*h+c*l,f&=65535,s(v<<16|b,f<<16|g,this.unsigned)},_.mul=_.multiply,_.divide=function(e){if(t(e)||(e=o(e)),e.isZero())throw Error("division by zero");if(this.isZero())return this.unsigned?f:m;var i,s,r;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return f;if(e.gt(this.shru(1)))return v;r=f}else{if(this.eq(w))return e.eq(g)||e.eq(b)?w:e.eq(w)?g:(i=this.shr(1).div(e).shl(1)).eq(m)?e.isNegative()?g:b:(s=this.sub(e.mul(i)),r=i.add(s.div(e)));if(e.eq(w))return this.unsigned?f:m;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();r=m}for(s=this;s.gte(e);){i=Math.max(1,Math.floor(s.toNumber()/e.toNumber()));for(var a=Math.ceil(Math.log(i)/Math.LN2),c=a<=48?1:l(2,a-48),h=n(i),u=h.mul(e);u.isNegative()||u.gt(s);)u=(h=n(i-=c,this.unsigned)).mul(e);h.isZero()&&(h=g),r=r.add(h),s=s.sub(u)}return r},_.div=_.divide,_.modulo=function(e){return t(e)||(e=o(e)),this.sub(this.div(e).mul(e))},_.mod=_.modulo,_.not=function(){return s(~this.low,~this.high,this.unsigned)},_.and=function(e){return t(e)||(e=o(e)),s(this.low&e.low,this.high&e.high,this.unsigned)},_.or=function(e){return t(e)||(e=o(e)),s(this.low|e.low,this.high|e.high,this.unsigned)},_.xor=function(e){return t(e)||(e=o(e)),s(this.low^e.low,this.high^e.high,this.unsigned)},_.shiftLeft=function(e){return t(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?s(this.low<>>32-e,this.unsigned):s(0,this.low<>>e|this.high<<32-e,this.high>>e,this.unsigned):s(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},_.shr=_.shiftRight,_.shiftRightUnsigned=function(e){if(t(e)&&(e=e.toInt()),0===(e&=63))return this;var i=this.high;return e<32?s(this.low>>>e|i<<32-e,i>>>e,this.unsigned):32===e?s(i,0,this.unsigned):s(i>>>e-32,0,this.unsigned)},_.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(e){return e?this.toBytesLE():this.toBytesBE()},_.toBytesLE=function(){var e=this.high,t=this.low;return[255&t,t>>>8&255,t>>>16&255,t>>>24&255,255&e,e>>>8&255,e>>>16&255,e>>>24&255]},_.toBytesBE=function(){var e=this.high,t=this.low;return[e>>>24&255,e>>>16&255,e>>>8&255,255&e,t>>>24&255,t>>>16&255,t>>>8&255,255&t]},e})},function(e,t){class i{constructor(e,t,i){this.reaction=e,this.name=t,this.id=i}get identifier(){return this.id?`${this.name}:${this.id}`:encodeURIComponent(this.name)}toString(){return this.id?`<:${this.name}:${this.id}>`:this.name}}e.exports=i},function(e,t,i){const n=i(3),s=i(9).EventEmitter;class r extends s{constructor(e,t,i={}){super(),Object.defineProperty(this,"client",{value:e}),this.filter=t,this.options=i,this.collected=new n,this.ended=!1,this._timeout=null,this.listener=this._handle.bind(this),i.time&&(this._timeout=this.client.setTimeout(()=>this.stop("time"),i.time))}_handle(...e){const t=this.handle(...e);if(!t||!this.filter(...e))return;this.collected.set(t.key,t.value),this.emit("collect",t.value,this);const i=this.postCheck(...e);i&&this.stop(i)}get next(){return new Promise((e,t)=>{if(this.ended)return void t(this.collected);const i=()=>{this.removeListener("collect",n),this.removeListener("end",s)},n=t=>{i(),e(t)},s=()=>{i(),t(this.collected)};this.on("collect",n),this.on("end",s)})}stop(e="user"){this.ended||(this._timeout&&this.client.clearTimeout(this._timeout),this.ended=!0,this.cleanup(),this.emit("end",this.collected,e))}handle(){}postCheck(){}cleanup(){}}e.exports=r},function(e,t,i){const n=i(19);class s{constructor(e,t,i){e?(Object.defineProperty(this,"client",{value:e}),t&&this.setup(t)):(this.id=t,this.token=i,Object.defineProperty(this,"client",{value:this}))}setup(e){this.name=e.name,this.token=e.token,this.avatar=e.avatar,this.id=e.id,this.guildID=e.guild_id,this.channelID=e.channel_id,e.user?this.owner=this.client.users?this.client.users.get(e.user.id):e.user:this.owner=null}send(e,t){return t||"object"!=typeof e||e instanceof Array?t||(t={}):(t=e,e=""),t.file?("string"==typeof t.file&&(t.file={attachment:t.file}),t.file.name||("string"==typeof t.file.attachment?t.file.name=n.basename(t.file.attachment):t.file.attachment&&t.file.attachment.path?t.file.name=n.basename(t.file.attachment.path):t.file.name="file.jpg"),this.client.resolver.resolveBuffer(t.file.attachment).then(i=>this.client.rest.methods.sendWebhookMessage(this,e,t,{file:i,name:t.file.name}))):this.client.rest.methods.sendWebhookMessage(this,e,t)}sendMessage(e,t={}){return this.send(e,t)}sendFile(e,t,i,n={}){return this.send(i,Object.assign(n,{file:{attachment:e,name:t}}))}sendCode(e,t,i={}){return this.send(t,Object.assign(i,{code:e}))}sendSlackMessage(e){return this.client.rest.methods.sendSlackWebhookMessage(this,e)}edit(e=this.name,t){return t?this.client.resolver.resolveBuffer(t).then(t=>{const i=this.client.resolver.resolveBase64(t);return this.client.rest.methods.editWebhook(this,e,i)}):this.client.rest.methods.editWebhook(this,e).then(e=>(this.setup(e),this))}delete(){return this.client.rest.methods.deleteWebhook(this)}}e.exports=s},function(e,t,i){const n=i(8);class s{constructor(e,t){Object.defineProperty(this,"client",{value:e}),this.setup(t)}setup(e){this.id=e.id,this.name=e.name,this.description=e.description,this.icon=e.icon,this.iconURL=`https://cdn.discordapp.com/app-icons/${this.id}/${this.icon}.jpg`,this.rpcOrigins=e.rpc_origins,this.redirectURIs=e.redirect_uris,this.botRequireCodeGrant=e.bot_require_code_grant,this.botPublic=e.bot_public,this.rpcApplicationState=e.rpc_application_state,this.bot=e.bot,this.flags=e.flags,this.secret=e.secret,e.owner&&(this.owner=this.client.dataManager.newUser(e.owner))}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}}e.exports=s},function(e,t,i){const n=i(16),s=i(21),r=i(3);class o extends n{constructor(e,t){super(e,t),this.type="group",this.messages=new r,this._typing=new Map}setup(e){if(super.setup(e),this.name=e.name,this.icon=e.icon,this.ownerID=e.owner_id,this.managed=e.managed,this.applicationID=e.application_id,e.nicks&&(this.nicks=new r(e.nicks.map(e=>[e.id,e.nick]))),this.recipients||(this.recipients=new r),e.recipients)for(const t of e.recipients){const e=this.client.dataManager.newUser(t);this.recipients.set(e.id,e)}this.lastMessageID=e.last_message_id}get owner(){return this.client.users.get(this.ownerID)}equals(e){const t=e&&this.id===e.id&&this.name===e.name&&this.icon===e.icon&&this.ownerID===e.ownerID;return t?this.recipients.equals(e.recipients):t}addUser(e,t){return this.client.rest.methods.addUserToGroupDM(this,{nick:t,id:this.client.resolver.resolveUserID(e),accessToken:e})}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"]),e.exports=o},function(e,t,i){(function(t){const n=i(19),s=i(26),r=i(30),o=i(0),a=i(4).convertToBuffer,c=i(13),l=i(22),h=i(28),u=i(16),d=i(24),p=i(23),m=i(36);class f{constructor(e){this.client=e}resolveUser(e){return e instanceof c?e:"string"==typeof e?this.client.users.get(e)||null:e instanceof d?e.user:e instanceof l?e.author:e instanceof h?e.owner:null}resolveUserID(e){return e instanceof c||e instanceof d?e.id:"string"==typeof e?e||null:e instanceof l?e.author.id:e instanceof h?e.ownerID:null}resolveGuild(e){return e instanceof h?e:"string"==typeof e?this.client.guilds.get(e)||null:null}resolveGuildMember(e,t){return t instanceof d?t:(e=this.resolveGuild(e),t=this.resolveUser(t),e&&t?e.members.get(t.id)||null:null)}resolveChannel(e){return e instanceof u?e:"string"==typeof e?this.client.channels.get(e)||null:e instanceof l?e.channel:e instanceof h?e.channels.get(e.id)||null:null}resolveChannelID(e){return e instanceof u?e.id:"string"==typeof e?e:e instanceof l?e.channel.id:e instanceof h?e.defaultChannel.id:null}resolveInviteCode(e){const t=/discord(?:app\.com\/invite|\.gg)\/([\w-]{2,255})/i.exec(e);return t&&t[1]?t[1]:e}resolveString(e){return"string"==typeof e?e:e instanceof Array?e.join("\n"):String(e)}resolveBase64(e){return e instanceof t?`data:image/jpg;base64,${e.toString("base64")}`:e}resolveBuffer(e){return e instanceof t?Promise.resolve(e):this.client.browser&&e instanceof ArrayBuffer?Promise.resolve(a(e)):"string"==typeof e?new Promise((i,o)=>{if(/^https?:\/\//.test(e))r.get(e).end((e,n)=>e?o(e):n.body instanceof t?i(n.body):o(new TypeError("The response body isn't a Buffer.")));else{const t=n.resolve(e);s.stat(t,(e,n)=>e?o(e):n&&n.isFile()?(s.readFile(t,(e,t)=>{e?o(e):i(t)}),null):o(new Error(`The file could not be found: ${t}`)))}}):Promise.reject(new TypeError("The resource must be a string or Buffer."))}resolveEmojiIdentifier(e){return e instanceof p||e instanceof m?e.identifier:"string"==typeof e?this.client.emojis.has(e)?this.client.emojis.get(e).identifier:e.includes("%")?e:encodeURIComponent(e):null}static resolveColor(e){if("string"==typeof e){if("RANDOM"===e)return Math.floor(16777216*Math.random());e=o.Colors[e]||parseInt(e.replace("#",""),16)}else e instanceof Array&&(e=(e[0]<<16)+(e[1]<<8)+e[2]);if(e<0||e>16777215)throw new RangeError("Color must be within the range 0 - 16777215 (0xFFFFFF).");if(e&&isNaN(e))throw new TypeError("Unable to convert color to a number.");return e}resolveColor(e){return this.constructor.resolveColor(e)}}e.exports=f}).call(t,i(5).Buffer)},function(e,t){var i={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==i.call(e)}},function(e,t,i){"use strict";(function(t,n){function s(e){return P.from(e)}function r(e){return P.isBuffer(e)||e instanceof j}function o(e,t,i){if("function"==typeof e.prependListener)return e.prependListener(t,i);e._events&&e._events[t]?L(e._events[t])?e._events[t].unshift(i):e._events[t]=[i,e._events[t]]:e.on(t,i)}function a(e,t){U=U||i(12),e=e||{},this.objectMode=!!e.objectMode,t instanceof U&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var n=e.highWaterMark,s=this.objectMode?16:16384;this.highWaterMark=n||0===n?n:s,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new z,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&($||($=i(46).StringDecoder),this.decoder=new $(e.encoding),this.encoding=e.encoding)}function c(e){if(U=U||i(12),!(this instanceof c))return new c(e);this._readableState=new a(e,this),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),N.call(this)}function l(e,t,i,n,r){var o=e._readableState;if(null===t)o.reading=!1,f(e,o);else{var a;r||(a=u(o,t)),a?e.emit("error",a):o.objectMode||t&&t.length>0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===P.prototype||(t=s(t)),n?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):h(e,o,t,!0):o.ended?e.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!i?(t=o.decoder.write(t),o.objectMode||0!==t.length?h(e,o,t,!1):b(e,o)):h(e,o,t,!1))):n||(o.reading=!1)}return d(o)}function h(e,t,i,n){t.flowing&&0===t.length&&!t.sync?(e.emit("data",i),e.read(0)):(t.length+=t.objectMode?1:i.length,n?t.buffer.unshift(i):t.buffer.push(i),t.needReadable&&g(e)),b(e,t)}function u(e,t){var i;return r(t)||"string"==typeof t||void 0===t||e.objectMode||(i=new TypeError("Invalid non-string/buffer chunk")),i}function d(e){return!e.ended&&(e.needReadable||e.length=F?e=F:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function m(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!==e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=p(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function f(e,t){if(!t.ended){if(t.decoder){var i=t.decoder.end();i&&i.length&&(t.buffer.push(i),t.length+=t.objectMode?1:i.length)}t.ended=!0,g(e)}}function g(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(B("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?I(v,e):v(e))}function v(e){B("emit readable"),e.emit("readable"),R(e)}function b(e,t){t.readingMore||(t.readingMore=!0,I(E,e,t))}function E(e,t){for(var i=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(i=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):i=k(e,t.buffer,t.decoder),i}function k(e,t,i){var n;return er.length?r.length:e;if(o===r.length?s+=r:s+=r.slice(0,e),0===(e-=o)){o===r.length?(++n,i.next?t.head=i.next:t.head=t.tail=null):(t.head=i,i.data=r.slice(o));break}++n}return t.length-=n,s}function S(e,t){var i=P.allocUnsafe(e),n=t.head,s=1;for(n.data.copy(i),e-=n.data.length;n=n.next;){var r=n.data,o=e>r.length?r.length:e;if(r.copy(i,i.length-e,0,o),0===(e-=o)){o===r.length?(++s,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=r.slice(o));break}++s}return t.length-=s,i}function M(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,I(D,t,e))}function D(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function C(e,t){for(var i=0,n=e.length;i=t.highWaterMark||t.ended))return B("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?M(this):g(this),null;if(0===(e=m(e,t))&&t.ended)return 0===t.length&&M(this),null;var n=t.needReadable;B("need readable",n),(0===t.length||t.length-e0?A(e,t):null)?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),i!==e&&t.ended&&M(this)),null!==s&&this.emit("data",s),s},c.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},c.prototype.pipe=function(e,t){function i(e,t){B("onunpipe"),e===d&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,r())}function s(){B("onend"),e.end()}function r(){B("cleanup"),e.removeListener("close",l),e.removeListener("finish",h),e.removeListener("drain",f),e.removeListener("error",c),e.removeListener("unpipe",i),d.removeListener("end",s),d.removeListener("end",u),d.removeListener("data",a),g=!0,!p.awaitDrain||e._writableState&&!e._writableState.needDrain||f()}function a(t){B("ondata"),v=!1,!1!==e.write(t)||v||((1===p.pipesCount&&p.pipes===e||p.pipesCount>1&&-1!==C(p.pipes,e))&&!g&&(B("false write response, pause",d._readableState.awaitDrain),d._readableState.awaitDrain++,v=!0),d.pause())}function c(t){B("onerror",t),u(),e.removeListener("error",c),0===O(e,"error")&&e.emit("error",t)}function l(){e.removeListener("finish",h),u()}function h(){B("onfinish"),e.removeListener("close",l),u()}function u(){B("unpipe"),d.unpipe(e)}var d=this,p=this._readableState;switch(p.pipesCount){case 0:p.pipes=e;break;case 1:p.pipes=[p.pipes,e];break;default:p.pipes.push(e)}p.pipesCount+=1,B("pipe count=%d opts=%j",p.pipesCount,t);var m=(!t||!1!==t.end)&&e!==n.stdout&&e!==n.stderr?s:u;p.endEmitted?I(m):d.once("end",m),e.on("unpipe",i);var f=y(d);e.on("drain",f);var g=!1,v=!1;return d.on("data",a),o(e,"error",c),e.once("close",l),e.once("finish",h),e.emit("pipe",d),p.flowing||(B("pipe resume"),d.resume()),e},c.prototype.unpipe=function(e){var t=this._readableState,i={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,i),this);if(!e){var n=t.pipes,s=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var r=0;r=this.charLength-this.charReceived?this.charLength-this.charReceived:e.length;if(e.copy(this.charBuffer,this.charReceived,0,i),this.charReceived+=i,this.charReceived=55296&&s<=56319)){if(this.charReceived=this.charLength=0,0===e.length)return t;break}this.charLength+=this.surrogateSize,t=""}this.detectIncompleteChar(e);n=e.length;this.charLength&&(e.copy(this.charBuffer,0,e.length-this.charReceived,n),n-=this.charReceived);var n=(t+=e.toString(this.encoding,0,n)).length-1,s=t.charCodeAt(n);if(s>=55296&&s<=56319){var r=this.surrogateSize;return this.charLength+=r,this.charReceived+=r,this.charBuffer.copy(this.charBuffer,r,0,r),e.copy(this.charBuffer,0,0,r),t.substring(0,n)}return t},l.prototype.detectIncompleteChar=function(e){for(var t=e.length>=3?3:e.length;t>0;t--){var i=e[e.length-t];if(1==t&&i>>5==6){this.charLength=2;break}if(t<=2&&i>>4==14){this.charLength=3;break}if(t<=3&&i>>3==30){this.charLength=4;break}}this.charReceived=t},l.prototype.end=function(e){var t="";if(e&&e.length&&(t=this.write(e)),this.charReceived){var i=this.charReceived,n=this.charBuffer,s=this.encoding;t+=n.slice(0,i).toString(s)}return t}},function(e,t,i){"use strict";function n(e){this.afterTransform=function(t,i){return s(e,t,i)},this.needTransform=!1,this.transforming=!1,this.writecb=null,this.writechunk=null,this.writeencoding=null}function s(e,t,i){var n=e._transformState;n.transforming=!1;var s=n.writecb;if(!s)return e.emit("error",new Error("write callback called multiple times"));n.writechunk=null,n.writecb=null,null!==i&&void 0!==i&&e.push(i),s(t);var r=e._readableState;r.reading=!1,(r.needReadable||r.length",'"',"`"," ","\r","\n","\t"],u=["{","}","|","\\","^","`"].concat(h),d=["'"].concat(u),p=["%","/","?",";","#"].concat(d),m=["/","?","#"],f=/^[+a-z0-9A-Z_-]{0,63}$/,g=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,v={javascript:!0,"javascript:":!0},b={javascript:!0,"javascript:":!0},E={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},y=i(34);n.prototype.parse=function(e,t,i){if(!o.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var n=e.indexOf("?"),s=-1!==n&&n127?L+="x":L+=U[O];if(!L.match(f)){var P=C.slice(0,k),j=C.slice(k+1),G=U.match(g);G&&(P.push(G[1]),j.unshift(G[2])),j.length&&(u="/"+j.join(".")+u),this.hostname=P.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),D||(this.hostname=r.toASCII(this.hostname));var q=this.port?":"+this.port:"",B=this.hostname||"";this.host=B+q,this.href+=this.host,D&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==u[0]&&(u="/"+u))}if(!v[x])for(var k=0,I=d.length;k0)&&i.host.split("@"))&&(i.auth=D.shift(),i.host=i.hostname=D.shift())),i.search=e.search,i.query=e.query,o.isNull(i.pathname)&&o.isNull(i.search)||(i.path=(i.pathname?i.pathname:"")+(i.search?i.search:"")),i.href=i.format(),i;if(!_.length)return i.pathname=null,i.search?i.path="/"+i.search:i.path=null,i.href=i.format(),i;for(var A=_.slice(-1)[0],k=(i.host||e.host||_.length>1)&&("."===A||".."===A)||""===A,T=0,S=_.length;S>=0;S--)"."===(A=_[S])?_.splice(S,1):".."===A?(_.splice(S,1),T++):T&&(_.splice(S,1),T--);if(!y&&!w)for(;T--;T)_.unshift("..");!y||""===_[0]||_[0]&&"/"===_[0].charAt(0)||_.unshift(""),k&&"/"!==_.join("/").substr(-1)&&_.push("");var M=""===_[0]||_[0]&&"/"===_[0].charAt(0);if(R){i.hostname=i.host=M?"":_.length?_.shift():"";var D=!!(i.host&&i.host.indexOf("@")>0)&&i.host.split("@");D&&(i.auth=D.shift(),i.host=i.hostname=D.shift())}return(y=y||i.host&&_.length)&&!M&&_.unshift(""),_.length?i.pathname=_.join("/"):(i.pathname=null,i.path=null),o.isNull(i.pathname)&&o.isNull(i.search)||(i.path=(i.pathname?i.pathname:"")+(i.search?i.search:"")),i.auth=e.auth||i.auth,i.slashes=i.slashes||e.slashes,i.href=i.format(),i},n.prototype.parseHost=function(){var e=this.host,t=c.exec(e);t&&(":"!==(t=t[0])&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)}},function(e,t,i){const n=i(100),s=i(101);e.exports={buffer:function(e){const t=s(e);return t?t.mime:n.bin},lookup:function(e){return n[e.replace(/^\./,"")]||n.bin}}},function(e,t){e.exports={name:"discord.js",version:"11.1.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:{long:"^3.2.0","prism-media":"^0.0.1",snekfetch:"^3.0.0",tweetnacl:"^0.14.0",ws:"^2.0.0"},peerDependencies:{bufferutil:"^3.0.0",erlpack:"hammerandchisel/erlpack","node-opus":"^0.2.0",opusscript:"^0.0.3",sodium:"^2.0.1","libsodium-wrappers":"^0.5.0",uws:"^0.14.0"},devDependencies:{"@types/node":"^7.0.0","discord.js-docgen":"hydrabolt/discord.js-docgen",eslint:"^3.19.0","parallel-webpack":"^2.0.0","uglifyjs-webpack-plugin":"^1.0.0-beta.1",webpack:"^3.0.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(e,t,i){const n=i(106),s=i(107),r=i(111),o=i(112),a=i(113),c=i(0);class l{constructor(e){this.client=e,this.handlers={},this.userAgentManager=new n(this),this.methods=new s(this),this.rateLimitedEndpoints={},this.globallyRateLimited=!1}destroy(){for(const e in this.handlers)this.handlers[e].destroy()}push(e,t){return new Promise((i,n)=>{e.push({request:t,resolve:i,reject:n})})}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(e,t,i,n,s){const r=new a(this,e,t,i,n,s);if(!this.handlers[r.route]){const e=this.getRequestHandler();this.handlers[r.route]=new e(this,r.route)}return this.push(this.handlers[r.route],r)}}e.exports=l},function(e,t,i){const n=i(3);class s{constructor(e,t,i,s){if(this.everyone=Boolean(s),t)if(t instanceof n)this.users=new n(t);else{this.users=new n;for(const i of t){let t=e.client.users.get(i.id);t||(t=e.client.dataManager.newUser(i)),this.users.set(t.id,t)}}else this.users=new n;if(i)if(i instanceof n)this.roles=new n(i);else{this.roles=new n;for(const t of i){const i=e.channel.guild.roles.get(t);i&&this.roles.set(i.id,i)}}else this.roles=new n;this._content=e.content,this._client=e.client,this._guild=e.channel.guild,this._members=null,this._channels=null}get members(){return this._members?this._members:this._guild?(this._members=new n,this.users.forEach(e=>{const t=this._guild.member(e);t&&this._members.set(t.user.id,t)}),this._members):null}get channels(){if(this._channels)return this._channels;this._channels=new n;let e;for(;null!==(e=this.constructor.CHANNELS_PATTERN.exec(this._content));){const t=this._client.channels.get(e[1]);t&&this._channels.set(t.id,t)}return this._channels}}s.EVERYONE_PATTERN=/@(everyone|here)/g,s.USERS_PATTERN=/<@!?[0-9]+>/g,s.ROLES_PATTERN=/<@&[0-9]+>/g,s.CHANNELS_PATTERN=/<#([0-9]+)>/g,e.exports=s},function(e,t){class i{constructor(e,t){Object.defineProperty(this,"client",{value:e.client}),this.message=e,this.setup(t)}setup(e){this.id=e.id,this.filename=e.filename,this.filesize=e.size,this.url=e.url,this.proxyURL=e.proxy_url,this.height=e.height,this.width=e.width}}e.exports=i},function(e,t){class i{constructor(e,t){Object.defineProperty(this,"client",{value:e.client}),this.message=e,this.setup(t)}setup(e){if(this.type=e.type,this.title=e.title,this.description=e.description,this.url=e.url,this.color=e.color,this.fields=[],e.fields)for(const t of e.fields)this.fields.push(new c(this,t));this.createdTimestamp=e.timestamp,this.thumbnail=e.thumbnail?new n(this,e.thumbnail):null,this.image=e.image?new s(this,e.image):null,this.video=e.video?new r(this,e.video):null,this.author=e.author?new a(this,e.author):null,this.provider=e.provider?new o(this,e.provider):null,this.footer=e.footer?new l(this,e.footer):null}get createdAt(){return new Date(this.createdTimestamp)}get hexColor(){let e=this.color.toString(16);for(;e.length<6;)e=`0${e}`;return`#${e}`}}class n{constructor(e,t){this.embed=e,this.setup(t)}setup(e){this.url=e.url,this.proxyURL=e.proxy_url,this.height=e.height,this.width=e.width}}class s{constructor(e,t){this.embed=e,this.setup(t)}setup(e){this.url=e.url,this.proxyURL=e.proxy_url,this.height=e.height,this.width=e.width}}class r{constructor(e,t){this.embed=e,this.setup(t)}setup(e){this.url=e.url,this.height=e.height,this.width=e.width}}class o{constructor(e,t){this.embed=e,this.setup(t)}setup(e){this.name=e.name,this.url=e.url}}class a{constructor(e,t){this.embed=e,this.setup(t)}setup(e){this.name=e.name,this.url=e.url,this.iconURL=e.icon_url}}class c{constructor(e,t){this.embed=e,this.setup(t)}setup(e){this.name=e.name,this.value=e.value,this.inline=e.inline}}class l{constructor(e,t){this.embed=e,this.setup(t)}setup(e){this.text=e.text,this.iconURL=e.icon_url,this.proxyIconUrl=e.proxy_icon_url}}i.Thumbnail=n,i.Image=s,i.Video=r,i.Provider=o,i.Author=a,i.Field=c,i.Footer=l,e.exports=i},function(e,t,i){const n=i(3),s=i(23),r=i(36);class o{constructor(e,t,i,s){this.message=e,this.me=s,this.count=i||0,this.users=new n,this._emoji=new r(this,t.name,t.id)}get emoji(){if(this._emoji instanceof s)return this._emoji;if(this._emoji.id){const e=this.message.client.emojis;if(e.has(this._emoji.id)){const t=e.get(this._emoji.id);return this._emoji=t,t}}return this._emoji}remove(e=this.message.client.user){const t=this.message,i=this.message.client.resolver.resolveUserID(e);return i?t.client.rest.methods.removeMessageReaction(t,this.emoji.identifier,i):Promise.reject(new Error("Couldn't resolve the user ID to remove from the reaction."))}fetchUsers(e=100){const t=this.message;return t.client.rest.methods.getMessageReactionUsers(t,this.emoji.identifier,e).then(e=>{this.users=new n;for(const t of e){const e=this.message.client.dataManager.newUser(t);this.users.set(e.id,e)}return this.count=this.users.size,this.users})}}e.exports=o},function(e,t,i){const n=i(37),s=i(3);class r extends n{constructor(e,t,i={}){super(e.client,t,i),this.message=e,this.users=new s,this.total=0,this.client.on("messageReactionAdd",this.listener)}handle(e){return e.message.id!==this.message.id?null:{key:e.emoji.id||e.emoji.name,value:e}}postCheck(e,t){return this.users.set(t.id,t),this.options.max&&++this.total>=this.options.max?"limit":this.options.maxEmojis&&this.collected.size>=this.options.maxEmojis?"emojiLimit":this.options.maxUsers&&this.users.size>=this.options.maxUsers?"userLimit":null}cleanup(){this.client.removeListener("messageReactionAdd",this.listener)}}e.exports=r},function(e,t,i){const n=i(37),s=i(20);class r extends n{constructor(e,t,i={}){super(e.client,t,i),this.channel=e,this.received=0,this.client.on("message",this.listener),this.options.max&&(this.options.maxProcessed=this.options.max),this.options.maxMatches&&(this.options.max=this.options.maxMatches),this._reEmitter=(e=>{this.emit("message",e)}),this.on("collect",this._reEmitter)}on(e,t){"message"===e&&(t=s.deprecate(t,'MessageCollector will soon no longer emit "message", use "collect" instead')),super.on(e,t)}handle(e){return e.channel.id!==this.channel.id?null:(this.received++,{key:e.id,value:e})}postCheck(){return this.options.maxMatches&&this.collected.size>=this.options.max?"matchesLimit":this.options.max&&this.received>=this.options.maxProcessed?"limit":null}cleanup(){this.removeListener("collect",this._reEmitter),this.client.removeListener("message",this.listener)}}e.exports=r},function(e,t,i){const n=i(61),s=i(62),r=i(0);class o{constructor(e,t){Object.defineProperty(this,"client",{value:e}),this.setup(t)}setup(e){this.guild=this.client.guilds.get(e.guild.id)||new n(this.client,e.guild),this.code=e.code,this.temporary=e.temporary,this.maxAge=e.max_age,this.uses=e.uses,this.maxUses=e.max_uses,e.inviter&&(this.inviter=this.client.dataManager.newUser(e.inviter)),this.channel=this.client.channels.get(e.channel.id)||new s(this.client,e.channel),this.createdTimestamp=new Date(e.created_at).getTime()}get createdAt(){return new Date(this.createdTimestamp)}get expiresTimestamp(){return this.createdTimestamp+1e3*this.maxAge}get expiresAt(){return new Date(this.expiresTimestamp)}get url(){return r.Endpoints.inviteLink(this.code)}delete(){return this.client.rest.methods.deleteInvite(this)}toString(){return this.url}}e.exports=o},function(e,t){class i{constructor(e,t){Object.defineProperty(this,"client",{value:e}),this.setup(t)}setup(e){this.id=e.id,this.name=e.name,this.icon=e.icon,this.splash=e.splash}}e.exports=i},function(e,t,i){const n=i(0);class s{constructor(e,t){Object.defineProperty(this,"client",{value:e}),this.setup(t)}setup(e){this.id=e.id,this.name=e.name,this.type=n.ChannelTypes.TEXT===e.type?"text":"voice"}}e.exports=s},function(e,t,i){const n=i(3),s=i(8),r={GUILD:"GUILD",CHANNEL:"CHANNEL",USER:"USER",ROLE:"ROLE",INVITE:"INVITE",WEBHOOK:"WEBHOOK",EMOJI:"EMOJI"},o={GUILD_UPDATE:1,CHANNEL_CREATE:10,CHANNEL_UPDATE:11,CHANNEL_DELETE:12,CHANNEL_OVERWRITE_CREATE:13,CHANNEL_OVERWRITE_UPDATE:14,CHANNEL_OVERWRITE_DELETE:15,MEMBER_KICK:20,MEMBER_PRUNE:21,MEMBER_BAN_ADD:22,MEMBER_BAN_REMOVE:23,MEMBER_UPDATE:24,MEMBER_ROLE_UPDATE:25,ROLE_CREATE:30,ROLE_UPDATE:31,ROLE_DELETE:32,INVITE_CREATE:40,INVITE_UPDATE:41,INVITE_DELETE:42,WEBHOOK_CREATE:50,WEBHOOK_UPDATE:51,WEBHOOK_DELETE:52,EMOJI_CREATE:60,EMOJI_UPDATE:61,EMOJI_DELETE:62};class a{constructor(e,t){if(t.users)for(const i of t.users)e.client.dataManager.newUser(i);this.entries=new n;for(const i of t.audit_log_entries){const t=new c(e,i);this.entries.set(t.id,t)}}static build(...e){return new Promise(t=>{const i=new a(...e);Promise.all(i.entries.map(e=>e.target)).then(()=>t(i))})}static targetType(e){return e<10?r.GUILD:e<20?r.CHANNEL:e<30?r.USER:e<40?r.ROLE:e<50?r.INVITE:e<60?r.WEBHOOK:e<70?r.EMOJI:null}static actionType(e){return[o.CHANNEL_CREATE,o.CHANNEL_OVERWRITE_CREATE,o.MEMBER_BAN_REMOVE,o.ROLE_CREATE,o.INVITE_CREATE,o.WEBHOOK_CREATE,o.EMOJI_CREATE].includes(e)?"CREATE":[o.CHANNEL_DELETE,o.CHANNEL_OVERWRITE_DELETE,o.MEMBER_KICK,o.MEMBER_PRUNE,o.MEMBER_BAN_ADD,o.ROLE_DELETE,o.INVITE_DELETE,o.WEBHOOK_DELETE,o.EMOJI_DELETE].includes(e)?"DELETE":[o.GUILD_UPDATE,o.CHANNEL_UPDATE,o.CHANNEL_OVERWRITE_UPDATE,o.MEMBER_UPDATE,o.ROLE_UPDATE,o.INVITE_UPDATE,o.WEBHOOK_UPDATE,o.EMOJI_UPDATE].includes(e)?"UPDATE":"ALL"}}class c{constructor(e,t){const i=a.targetType(t.action_type);if(this.targetType=i,this.actionType=a.actionType(t.action_type),this.action=Object.keys(o).find(e=>o[e]===t.action_type),this.reason=t.reason||null,this.executor=e.client.users.get(t.user_id),this.changes=t.changes?t.changes.map(e=>({name:e.key,old:e.old_value,new:e.new_value})):null,this.id=t.id,this.extra=null,t.options)if(t.action_type===o.MEMBER_PRUNE)this.extra={removed:t.options.members_removed,days:t.options.delete_member_days};else switch(t.options.type){case"member":this.extra=e.members.get(this.options.id),this.extra||(this.extra={id:this.options.id});break;case"role":this.extra=e.roles.get(this.options.id),this.extra||(this.extra={id:this.options.id,name:this.options.role_name})}if([r.USER,r.GUILD].includes(i))this.target=e.client[`${i.toLowerCase()}s`].get(t.target_id);else if(i===r.WEBHOOK)this.target=e.fetchWebhooks().then(e=>(this.target=e.find(e=>e.id===t.target_id),this.target));else if(i===r.INVITE){const t=this.changes.find(e=>"code"===e.name);this.target=e.fetchInvites().then(e=>(this.target=e.find(e=>e.code===(t.new||t.old)),this.target))}else this.target=e[`${i.toLowerCase()}s`].get(t.target_id)}get createdTimestamp(){return s.deconstruct(this.id).timestamp}get createdAt(){return new Date(this.createdTimestamp)}}a.Actions=o,a.Targets=r,a.Entry=c,e.exports=a},function(e,t){class i{constructor(e){this.restManager=e,this.queue=[]}get globalLimit(){return this.restManager.globallyRateLimited}set globalLimit(e){this.restManager.globallyRateLimited=e}push(e){this.queue.push(e)}handle(){}destroy(){this.queue=[]}}e.exports=i},function(e,t){class i extends Error{constructor(e){super();const t=e.errors?`\n${this.constructor.flattenErrors(e.errors).join("\n")}`:"";this.name="DiscordAPIError",this.message=`${e.message}${t}`,this.code=e.code}static flattenErrors(e,t=""){let i=[];for(const n of Object.keys(e)){const s=t?isNaN(n)?`${t}.${n}`:`${t}[${n}]`:n;e[n]._errors?i.push(`${s}: ${e[n]._errors.map(e=>e.message).join(" ")}`):i=i.concat(this.flattenErrors(e[n],s))}return i}}e.exports=i},function(e,t,i){const n=i(16),s=i(21),r=i(3);class o extends n{constructor(e,t){super(e,t),this.type="dm",this.messages=new r,this._typing=new Map}setup(e){super.setup(e),this.recipient=this.client.dataManager.newUser(e.recipients[0]),this.lastMessageID=e.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"]),e.exports=o},function(e,t,i){const n=i(29),s=i(21),r=i(3);class o extends n{constructor(e,t){super(e,t),this.type="text",this.messages=new r,this._typing=new Map}setup(e){super.setup(e),this.topic=e.topic,this.lastMessageID=e.last_message_id}get members(){const e=new r;for(const t of this.guild.members.values())this.permissionsFor(t).has("READ_MESSAGES")&&e.set(t.id,t);return e}get nsfw(){return/^nsfw(-|$)/.test(this.name)}fetchWebhooks(){return this.client.rest.methods.getChannelWebhooks(this)}createWebhook(e,t){return new Promise(i=>{"string"==typeof t&&t.startsWith("data:")?i(this.client.rest.methods.createWebhook(this,e,t)):this.client.resolver.resolveBuffer(t).then(t=>i(this.client.rest.methods.createWebhook(this,e,t)))})}send(){}sendMessage(){}sendEmbed(){}sendFile(){}sendFiles(){}sendCode(){}fetchMessage(){}fetchMessages(){}fetchPinnedMessages(){}search(){}startTyping(){}stopTyping(){}get typing(){}get typingCount(){}createCollector(){}createMessageCollector(){}awaitMessages(){}bulkDelete(){}acknowledge(){}_cacheMessage(){}}s.applyToClass(o,!0),e.exports=o},function(e,t){class i{constructor(e,t){Object.defineProperty(this,"channel",{value:e}),t&&this.setup(t)}setup(e){this.id=e.id,this.type=e.type,this.deny=e.deny,this.allow=e.allow}delete(){return this.channel.client.rest.methods.deletePermissionOverwrites(this)}}e.exports=i},function(e,t,i){const n=i(29),s=i(3);class r extends n{constructor(e,t){super(e,t),this.members=new s,this.type="voice"}setup(e){super.setup(e),this.bitrate=e.bitrate,this.userLimit=e.user_limit}get connection(){const e=this.guild.voiceConnection;return e&&e.channel.id===this.id?e:null}get full(){return this.userLimit>0&&this.members.size>=this.userLimit}get joinable(){return!this.client.browser&&(!!this.permissionsFor(this.client.user).has("CONNECT")&&!(this.full&&!this.permissionsFor(this.client.user).has("MOVE_MEMBERS")))}get speakable(){return this.permissionsFor(this.client.user).has("SPEAK")}setBitrate(e){return this.edit({bitrate:e})}setUserLimit(e){return this.edit({userLimit:e})}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)return;const e=this.client.voice.connections.get(this.guild.id);e&&e.channel.id===this.id&&e.disconnect()}}e.exports=r},function(e,t,i){(function(t){const n="browser"===i(27).platform(),s=i(9),r=i(0),o=i(26),a=i(116),c=function(){try{const e=i(153);return e.pack?e:null}catch(e){return null}}(),l=function(){if(n)return window.WebSocket;try{return i(154)}catch(e){return i(155)}}();class h extends s{constructor(e,t){super(),this.manager=e,this.client=e.client,this.ws=null,this.sequence=-1,this.status=r.Status.IDLE,this.packetManager=new a(this),this.lastPingTimestamp=0,this.ratelimit={queue:[],remaining:120,resetTime:-1},this.connect(t),this.disabledEvents={},this.closeSequence=0,this.expectingClose=!1;for(const e of this.client.options.disabledEvents)this.disabledEvents[e]=!0}triggerReady(){this.status!==r.Status.READY?(this.status=r.Status.READY,this.client.emit(r.Events.READY),this.packetManager.handleQueue()):this.debug("Tried to mark self as ready, but already ready")}checkIfReady(){if(this.status===r.Status.READY||this.status===r.Status.NEARLY)return!1;let e=0;for(const t of this.client.guilds.values())t.available||e++;if(0===e){if(this.status=r.Status.NEARLY,!this.client.options.fetchAllMembers)return this.triggerReady();const e=this.client.guilds.map(e=>e.fetchMembers());Promise.all(e).then(()=>this.triggerReady()).catch(e=>{this.debug(`Failed to fetch all members before ready! ${e}`),this.triggerReady()})}return!0}debug(e){return e instanceof Error&&(e=e.stack),this.manager.debug(`[connection] ${e}`)}unpack(e){return e instanceof ArrayBuffer&&(e=t.from(new Uint8Array(e))),c&&"string"!=typeof e?c.unpack(e):(e instanceof t&&(e=o.inflateSync(e).toString()),JSON.parse(e))}pack(e){return c?c.pack(e):JSON.stringify(e)}processQueue(){if(0!==this.ratelimit.remaining&&0!==this.ratelimit.queue.length)for(120===this.ratelimit.remaining&&(this.ratelimit.resetTimer=setTimeout(()=>{this.ratelimit.remaining=120,this.processQueue()},12e4));this.ratelimit.remaining>0;){const e=this.ratelimit.queue.shift();if(!e)return;this._send(e),this.ratelimit.remaining--}}_send(e){this.ws&&this.ws.readyState===l.OPEN?this.ws.send(this.pack(e)):this.debug(`Tried to send packet ${e} but no WebSocket is available!`)}send(e){this.ws&&this.ws.readyState===l.OPEN?(this.ratelimit.queue.push(e),this.processQueue()):this.debug(`Tried to send packet ${e} but no WebSocket is available!`)}connect(e=this.gateway,t=0,i=!1){if(t)return this.client.setTimeout(()=>this.connect(e,0,i),t);if(this.ws&&!i)return this.debug("WebSocket connection already exists"),!1;if("string"!=typeof e)return this.debug(`Tried to connect to an invalid gateway: ${e}`),!1;this.expectingClose=!1,this.gateway=e,this.debug(`Connecting to ${e}`);const s=this.ws=new l(e);return n&&(s.binaryType="arraybuffer"),s.onmessage=this.onMessage.bind(this),s.onopen=this.onOpen.bind(this),s.onerror=this.onError.bind(this),s.onclose=this.onClose.bind(this),this.status=r.Status.CONNECTING,!0}destroy(){const e=this.ws;return e?(this.heartbeat(-1),this.expectingClose=!0,e.close(1e3),this.packetManager.handleQueue(),this.ws=null,this.status=r.Status.DISCONNECTED,!0):(this.debug("Attempted to destroy WebSocket but no connection exists!"),!1)}onMessage(e){try{e.data=this.unpack(e.data)}catch(e){this.emit("debug",e)}return this.onPacket(e.data)}setSequence(e){this.sequence=e>this.sequence?e:this.sequence}onPacket(e){if(!e)return this.debug("Received null packet"),!1;switch(this.client.emit("raw",e),e.op){case r.OPCodes.HELLO:return this.heartbeat(e.d.heartbeat_interval);case r.OPCodes.RECONNECT:return this.reconnect();case r.OPCodes.INVALID_SESSION:return e.d||(this.sessionID=null),this.sequence=-1,this.debug("Session invalidated -- will identify with a new session"),this.identify(e.d?2500:0);case r.OPCodes.HEARTBEAT_ACK:return this.ackHeartbeat();case r.OPCodes.HEARTBEAT:return this.heartbeat();default:return this.packetManager.handle(e)}}onOpen(e){e&&e.target&&e.target.url&&(this.gateway=e.target.url),this.debug(`Connected to gateway ${this.gateway}`),this.identify()}reconnect(){this.debug("Attemping to reconnect in 5500ms..."),this.client.emit(r.Events.RECONNECTING),this.connect(this.gateway,5500,!0)}onError(e){this.client.emit(r.Events.ERROR,e),"uWs client connection error"===e.message&&this.reconnect()}onClose(e){if(this.debug(`${this.expectingClose?"Client":"Server"} closed the WebSocket connection: ${e.code}`),this.closeSequence=this.sequence,this.emit("close",e),this.heartbeat(-1),1e3===e.code?this.expectingClose:r.WSCodes[e.code])return this.expectingClose=!1,this.client.emit(r.Events.DISCONNECT,e),this.debug(r.WSCodes[e.code]),void this.destroy();this.expectingClose=!1,this.reconnect()}ackHeartbeat(){this.debug(`Heartbeat acknowledged, latency of ${Date.now()-this.lastPingTimestamp}ms`),this.client._pong(this.lastPingTimestamp)}heartbeat(e){isNaN(e)?(this.debug("Sending a heartbeat"),this.lastPingTimestamp=Date.now(),this.send({op:r.OPCodes.HEARTBEAT,d:this.sequence})):-1===e?(this.debug("Clearing heartbeat interval"),this.client.clearInterval(this.heartbeatInterval),this.heartbeatInterval=null):(this.debug(`Setting a heartbeat interval for ${e}ms`),this.heartbeatInterval=this.client.setInterval(()=>this.heartbeat(),e))}identify(e){return e?this.client.setTimeout(this.identify.apply(this),e):this.sessionID?this.identifyResume():this.identifyNew()}identifyNew(){if(!this.client.token)return void this.debug("No token available to identify a new session with");const e=Object.assign({token:this.client.token},this.client.options.ws),{shardId:t,shardCount:i}=this.client.options;i>0&&(e.shard=[Number(t),Number(i)]),this.debug("Identifying as a new session"),this.send({op:r.OPCodes.IDENTIFY,d:e})}identifyResume(){if(!this.sessionID)return this.debug("Warning: wanted to resume but session ID not available; identifying as a new session instead"),this.identifyNew();this.debug(`Attempting to resume session ${this.sessionID}`);const e={token:this.client.token,session_id:this.sessionID,seq:this.sequence};return this.send({op:r.OPCodes.RESUME,d:e})}}h.ENCODING=c?"etf":"json",h.WebSocket=l,e.exports=h}).call(t,i(5).Buffer)},function(e,t,i){const n=i(13),s=i(3),r=i(72),o=i(0);class a extends n{setup(e){super.setup(e),this.verified=e.verified,this.email=e.email,this.localPresence={},this._typing=new Map,this.friends=new s,this.blocked=new s,this.notes=new s,this.premium="boolean"==typeof e.premium?e.premium:null,this.mfaEnabled="boolean"==typeof e.mfa_enabled?e.mfa_enabled:null,this.mobile="boolean"==typeof e.mobile?e.mobile:null,e.user_settings&&(this.settings=new r(this,e.user_settings))}edit(e){return this.client.rest.methods.updateCurrentUser(e)}setUsername(e,t){return this.client.rest.methods.updateCurrentUser({username:e},t)}setEmail(e,t){return this.client.rest.methods.updateCurrentUser({email:e},t)}setPassword(e,t){return this.client.rest.methods.updateCurrentUser({password:e},t)}setAvatar(e){return"string"==typeof e&&e.startsWith("data:")?this.client.rest.methods.updateCurrentUser({avatar:e}):this.client.resolver.resolveBuffer(e).then(e=>this.client.rest.methods.updateCurrentUser({avatar:e}))}setPresence(e){return new Promise(t=>{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}),e.status){if("string"!=typeof e.status)throw new TypeError("Status must be a string");this.bot?i=e.status:(this.settings.update(o.UserSettingsMap.status,e.status),i="invisible")}e.game?(n=e.game).url&&(n.type=1):void 0!==e.game&&(n=null),void 0!==e.afk&&(s=e.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),t(this)})}setStatus(e){return this.setPresence({status:e})}setGame(e,t){return e?this.setPresence({game:{name:e,url:t}}):this.setPresence({game:null})}setAFK(e){return this.setPresence({afk:e})}fetchMentions(e={limit:25,roles:!0,everyone:!0,guild:null}){return this.client.rest.methods.fetchMentions(e)}addFriend(e){return e=this.client.resolver.resolveUser(e),this.client.rest.methods.addFriend(e)}removeFriend(e){return e=this.client.resolver.resolveUser(e),this.client.rest.methods.removeFriend(e)}createGuild(e,t,i=null){return i?"string"==typeof i&&i.startsWith("data:")?this.client.rest.methods.createGuild({name:e,icon:i,region:t}):this.client.resolver.resolveBuffer(i).then(i=>this.client.rest.methods.createGuild({name:e,icon:i,region:t})):this.client.rest.methods.createGuild({name:e,icon:i,region:t})}createGroupDM(e){return this.client.rest.methods.createGroupDM({recipients:e.map(e=>this.client.resolver.resolveUserID(e.user)),accessTokens:e.map(e=>e.accessToken),nicks:e.map(e=>e.nick)})}acceptInvite(e){return this.client.rest.methods.acceptInvite(e)}}e.exports=a},function(e,t,i){const n=i(0),s=i(4);class r{constructor(e,t){this.user=e,this.patch(t)}patch(e){for(const t of Object.keys(n.UserSettingsMap)){const i=n.UserSettingsMap[t];e.hasOwnProperty(t)&&("function"==typeof i?this[i.name]=i(e[t]):this[i]=e[t])}}update(e,t){return this.user.client.rest.methods.patchUserSettings({[e]:t})}setGuildPosition(e,t,i){const n=Object.assign([],this.guildPositions);return s.moveElementInArray(n,e.id,t,i),this.update("guild_positions",n).then(()=>e)}addRestrictedGuild(e){const t=Object.assign([],this.restrictedGuilds);return t.includes(e.id)?Promise.reject(new Error("Guild is already restricted")):(t.push(e.id),this.update("restricted_guilds",t).then(()=>e))}removeRestrictedGuild(e){const t=Object.assign([],this.restrictedGuilds),i=t.indexOf(e.id);return i<0?Promise.reject(new Error("Guild is not restricted")):(t.splice(i,1),this.update("restricted_guilds",t).then(()=>e))}}e.exports=r},function(e,t,i){const n=i(4);e.exports={Client:i(103),Shard:i(189),ShardClientUtil:i(190),ShardingManager:i(191),WebhookClient:i(192),Collection:i(3),Constants:i(0),EvaluatedPermissions:i(11),Permissions:i(11),Snowflake:i(8),SnowflakeUtil:i(8),Util:n,util:n,version:i(52).version,escapeMarkdown:n.escapeMarkdown,fetchRecommendedShards:n.fetchRecommendedShards,splitMessage:n.splitMessage,Channel:i(16),ClientUser:i(71),ClientUserSettings:i(72),Collector:i(37),DMChannel:i(66),Emoji:i(23),Game:i(15).Game,GroupDMChannel:i(40),Guild:i(28),GuildAuditLogs:i(63),GuildChannel:i(29),GuildMember:i(24),Invite:i(60),Message:i(22),MessageAttachment:i(55),MessageCollector:i(59),MessageEmbed:i(56),MessageMentions:i(54),MessageReaction:i(57),OAuth2Application:i(39),ClientOAuth2Application:i(39),PartialGuild:i(61),PartialGuildChannel:i(62),PermissionOverwrites:i(68),Presence:i(15).Presence,ReactionEmoji:i(36),ReactionCollector:i(58),RichEmbed:i(193),Role:i(14),TextChannel:i(67),User:i(13),VoiceChannel:i(69),Webhook:i(38)},"browser"===i(27).platform()&&(window.Discord=e.exports)},function(e,t,i){"use strict";function n(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===e[t-2]?2:"="===e[t-1]?1:0}function s(e){return o[e>>18&63]+o[e>>12&63]+o[e>>6&63]+o[63&e]}function r(e,t,i){for(var n,r=[],o=t;o0?l-4:l;var h=0;for(t=0;t>16&255,o[h++]=s>>8&255,o[h++]=255&s;return 2===r?(s=a[e.charCodeAt(t)]<<2|a[e.charCodeAt(t+1)]>>4,o[h++]=255&s):1===r&&(s=a[e.charCodeAt(t)]<<10|a[e.charCodeAt(t+1)]<<4|a[e.charCodeAt(t+2)]>>2,o[h++]=s>>8&255,o[h++]=255&s),o},t.fromByteArray=function(e){for(var t,i=e.length,n=i%3,s="",a=[],c=0,l=i-n;cl?l:c+16383));return 1===n?(t=e[i-1],s+=o[t>>2],s+=o[t<<4&63],s+="=="):2===n&&(t=(e[i-2]<<8)+e[i-1],s+=o[t>>10],s+=o[t>>4&63],s+=o[t<<2&63],s+="="),a.push(s),a.join("")};for(var o=[],a=[],c="undefined"!=typeof Uint8Array?Uint8Array:Array,l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",h=0,u=l.length;h>1,h=-7,u=i?s-1:0,d=i?-1:1,p=e[t+u];for(u+=d,r=p&(1<<-h)-1,p>>=-h,h+=a;h>0;r=256*r+e[t+u],u+=d,h-=8);for(o=r&(1<<-h)-1,r>>=-h,h+=n;h>0;o=256*o+e[t+u],u+=d,h-=8);if(0===r)r=1-l;else{if(r===c)return o?NaN:1/0*(p?-1:1);o+=Math.pow(2,n),r-=l}return(p?-1:1)*o*Math.pow(2,r-n)},t.write=function(e,t,i,n,s,r){var o,a,c,l=8*r-s-1,h=(1<>1,d=23===s?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:r-1,m=n?1:-1,f=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,o=h):(o=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-o))<1&&(o--,c*=2),(t+=o+u>=1?d/c:d*Math.pow(2,1-u))*c>=2&&(o++,c/=2),o+u>=h?(a=0,o=h):o+u>=1?(a=(t*c-1)*Math.pow(2,s),o+=u):(a=t*Math.pow(2,u-1)*Math.pow(2,s),o=0));s>=8;e[i+p]=255&a,p+=m,a/=256,s-=8);for(o=o<0;e[i+p]=255&o,p+=m,o/=256,l-=8);e[i+p-m]|=128*f}},function(e,t,i){(function(t){function n(e){return c.format({protocol:e.connection.encrypted?"https:":"http:",hostname:e.getHeader("host"),pathname:e.path.split("?")[0],query:e.query})}i(31);const s=i(26),r=i(34),o=i(48),a=i(97),c=i(50),l=i(98),h=i(31),u=i(99),d=i(102);class p extends h.Readable{constructor(e,t,i={headers:null,data:null,query:null}){super();const n=c.parse(t);n.method=e.toUpperCase(),i.headers&&(n.headers=i.headers),"agent"in i&&(n.agent=i.agent),this.request={https:a,http:o,file:d}[n.protocol.replace(":","")].request(n),this.request.followRedirects=i.followRedirects,i.query&&this.query(i.query),i.data&&this.send(i.data)}query(e,t){if(this.response)throw new Error("Cannot modify query after being sent!");return this.request.query||(this.request.query={}),null!==e&&"object"==typeof e?this.request.query=Object.assign(this.request.query,e):this.request.query[e]=t,this}set(e,t){if(this.response)throw new Error("Cannot modify headers after being sent!");if(null!==e&&"object"==typeof e)for(const t of Object.keys(e))this.set(t,e[t]);else this.request.setHeader(e,t);return this}attach(e,t,i){if(this.response)throw new Error("Cannot modify data after being sent!");const n=this._getFormData();return this.set("Content-Type",`multipart/form-data; boundary=${n.boundary}`),n.append(e,t,i),this.data=n,this}send(e){if(this.response)throw new Error("Cannot modify data after being sent!");if(e instanceof t||e instanceof h)this.data=e;else if(null!==e&&"object"==typeof e){const t=this._getRequestHeader("content-type");let i;t?t.includes("json")?i=JSON.stringify:t.includes("urlencoded")&&(i=r.stringify):(this.set("Content-Type","application/json"),i=JSON.stringify),this.data=i(e)}else this.data=e;return this}then(e,i){return new Promise((e,i)=>{const a=this.request,l=e=>{e||(e=new Error("Unknown error occured")),e.request=a,i(e)};a.once("abort",l),a.once("aborted",l),a.once("error",l),a.once("response",l=>{const u=new h.PassThrough;this._shouldUnzip(l)?l.pipe(s.createUnzip({flush:s.Z_SYNC_FLUSH,finishFlush:s.Z_SYNC_FLUSH})).pipe(u):l.pipe(u);const d=[];u.on("data",e=>{this.push(e)||this.pause(),d.push(e)}),u.once("end",()=>{this.push(null);const s=t.concat(d);if(!1!==this.request.followRedirects&&this._shouldRedirect(l)){let t=this.request.method;[301,302].includes(l.statusCode)?("HEAD"!==t&&(t="GET"),this.data=null):303===l.statusCode&&(t="GET");const i={};if(this.request._headerNames)for(const e of Object.keys(this.request._headerNames))"host"!==e.toLowerCase()&&(i[this.request._headerNames[e]]=this.request._headers[e]);else for(const e of Object.keys(this.request._headers)){if("host"===e.toLowerCase())continue;const t=this.request._headers[e];i[t.name]=t.value}const s=/^https?:\/\//i.test(l.headers.location)?l.headers.location:c.resolve(n(a),l.headers.location);return void e(new p(t,s,{data:this.data,headers:i}))}const h={request:this.request,get body(){delete h.body;const e=l.headers["content-type"];if(e&&e.includes("application/json"))try{h.body=JSON.parse(h.text)}catch(e){h.body=h.text}else e&&e.includes("application/x-www-form-urlencoded")?h.body=r.parse(h.text):h.body=s;return h.body},text:s.toString(),ok:l.statusCode>=200&&l.statusCode<300,headers:l.headers,status:l.statusCode,statusText:l.statusText||o.STATUS_CODES[l.statusCode]};if(h.ok)e(h);else{const e=new Error(`${h.status} ${h.statusText}`.trim());Object.assign(e,h),i(e)}})});const u=this.data?this.data.end?this.data.end():this.data:null;if(this._addFinalHeaders(),this.request.query&&(this.request.path=`${this.request.path}?${r.stringify(this.request.query)}`),Array.isArray(u)){for(const e of u)a.write(e);a.end()}else u instanceof h?u.pipe(a):u instanceof t?(this.set("Content-Length",t.byteLength(u)),a.end(u)):a.end(u)}).then(e,i)}catch(e){return this.then(null,e)}end(e){return this.then(t=>e?e(null,t):t,t=>e?e(t,t.status?t:null):t)}_read(){this.resume(),this.response||this.catch(e=>this.emit("error",e))}_shouldUnzip(e){return 204!==e.statusCode&&304!==e.statusCode&&("0"!==e.headers["content-length"]&&/^\s*(?:deflate|gzip)\s*$/.test(e.headers["content-encoding"]))}_shouldRedirect(e){return[301,302,303,307,308].includes(e.statusCode)}_getFormData(){return this._formData||(this._formData=new u),this._formData}_addFinalHeaders(){this.request&&(this._getRequestHeader("user-agent")||this.set("User-Agent",`snekfetch/${p.version} (${l.repository.url.replace(/\.?git/,"")})`),"HEAD"!==this.request.method&&this.set("Accept-Encoding","gzip, deflate"),this.data&&this.data.end&&this.set("Content-Length",this.data.length))}get response(){return this.request?this.request.res||this.request._response||null:null}_getRequestHeader(e){try{return this.request.getHeader(e)}catch(e){return null}}}p.version=l.version,p.METHODS=o.METHODS?o.METHODS.concat("BREW"):["GET","POST","PUT","DELETE","OPTIONS","HEAD"];for(const e of p.METHODS)p["M-SEARCH"===e?"msearch":e.toLowerCase()]=((t,i)=>new p(e,t,i));e.exports=p}).call(t,i(5).Buffer)},function(e,t){},function(e,t,i){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t,i){e.copy(t,i)}var r=i(32).Buffer;e.exports=function(){function e(){n(this,e),this.head=null,this.tail=null,this.length=0}return e.prototype.push=function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length},e.prototype.unshift=function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length},e.prototype.shift=function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}},e.prototype.clear=function(){this.head=this.tail=null,this.length=0},e.prototype.join=function(e){if(0===this.length)return"";for(var t=this.head,i=""+t.data;t=t.next;)i+=e+t.data;return i},e.prototype.concat=function(e){if(0===this.length)return r.alloc(0);if(1===this.length)return this.head.data;for(var t=r.allocUnsafe(e>>>0),i=this.head,n=0;i;)s(i.data,t,n),n+=i.data.length,i=i.next;return t},e}()},function(e,t,i){function n(e,t){this._id=e,this._clearFn=t}var s=Function.prototype.apply;t.setTimeout=function(){return new n(s.call(setTimeout,window,arguments),clearTimeout)},t.setInterval=function(){return new n(s.call(setInterval,window,arguments),clearInterval)},t.clearTimeout=t.clearInterval=function(e){e&&e.close()},n.prototype.unref=n.prototype.ref=function(){},n.prototype.close=function(){this._clearFn.call(window,this._id)},t.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},t.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},t._unrefActive=t.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;t>=0&&(e._idleTimeoutId=setTimeout(function(){e._onTimeout&&e._onTimeout()},t))},i(80),t.setImmediate=setImmediate,t.clearImmediate=clearImmediate},function(e,t,i){(function(e,t){!function(e,i){"use strict";function n(e){delete c[e]}function s(e){var t=e.callback,n=e.args;switch(n.length){case 0:t();break;case 1:t(n[0]);break;case 2:t(n[0],n[1]);break;case 3:t(n[0],n[1],n[2]);break;default:t.apply(i,n)}}function r(e){if(l)setTimeout(r,0,e);else{var t=c[e];if(t){l=!0;try{s(t)}finally{n(e),l=!1}}}}if(!e.setImmediate){var o,a=1,c={},l=!1,h=e.document,u=Object.getPrototypeOf&&Object.getPrototypeOf(e);u=u&&u.setTimeout?u:e,"[object process]"==={}.toString.call(e.process)?o=function(e){t.nextTick(function(){r(e)})}:function(){if(e.postMessage&&!e.importScripts){var t=!0,i=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=i,t}}()?function(){var t="setImmediate$"+Math.random()+"$",i=function(i){i.source===e&&"string"==typeof i.data&&0===i.data.indexOf(t)&&r(+i.data.slice(t.length))};e.addEventListener?e.addEventListener("message",i,!1):e.attachEvent("onmessage",i),o=function(i){e.postMessage(t+i,"*")}}():e.MessageChannel?function(){var e=new MessageChannel;e.port1.onmessage=function(e){r(e.data)},o=function(t){e.port2.postMessage(t)}}():h&&"onreadystatechange"in h.createElement("script")?function(){var e=h.documentElement;o=function(t){var i=h.createElement("script");i.onreadystatechange=function(){r(t),i.onreadystatechange=null,e.removeChild(i),i=null},e.appendChild(i)}}():o=function(e){setTimeout(r,0,e)},u.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),i=0;i0&&l>c&&(l=c);for(var h=0;h=0?(u=f.substr(0,g),d=f.substr(g+1)):(u=f,d=""),p=decodeURIComponent(u),m=decodeURIComponent(d),n(o,p)?s(o[p])?o[p].push(m):o[p]=[o[p],m]:o[p]=m}return o};var s=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},function(e,t,i){"use strict";function n(e,t){if(e.map)return e.map(t);for(var i=[],n=0;ne._pos){var r=i.substr(e._pos);if("x-user-defined"===e._charset){for(var o=new n(r.length),a=0;ae._pos&&(e.push(new n(new Uint8Array(l.result.slice(e._pos)))),e._pos=l.result.byteLength)},l.onload=function(){e.push(null)},l.readAsArrayBuffer(i)}e._xhr.readyState===c.DONE&&"ms-stream"!==e._mode&&e.push(null)}}).call(t,i(7),i(5).Buffer,i(6))},function(e,t,i){var n=i(5).Buffer;e.exports=function(e){if(e instanceof Uint8Array){if(0===e.byteOffset&&e.byteLength===e.buffer.byteLength)return e.buffer;if("function"==typeof e.buffer.slice)return e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}if(n.isBuffer(e)){for(var t=new Uint8Array(e.length),i=e.length,s=0;s1&&(n=i[0]+"@",e=i[1]),n+a((e=e.replace(M,".")).split("."),t).join(".")}function l(e){for(var t,i,n=[],s=0,r=e.length;s=55296&&t<=56319&&s65535&&(t+=U((e-=65536)>>>10&1023|55296),e=56320|1023&e),t+=U(e)}).join("")}function u(e){return e-48<10?e-22:e-65<26?e-65:e-97<26?e-97:E}function d(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function p(e,t,i){var n=0;for(e=i?I(e/x):e>>1,e+=I(e/t);e>C*w>>1;n+=E)e=I(e/C);return I(n+(C+1)*e/(e+_))}function m(e){var t,i,n,s,r,a,c,l,d,m,f=[],g=e.length,v=0,_=A,x=R;for((i=e.lastIndexOf(k))<0&&(i=0),n=0;n=128&&o("not-basic"),f.push(e.charCodeAt(n));for(s=i>0?i+1:0;s=g&&o("invalid-input"),((l=u(e.charCodeAt(s++)))>=E||l>I((b-v)/a))&&o("overflow"),v+=l*a,d=c<=x?y:c>=x+w?w:c-x,!(lI(b/(m=E-d))&&o("overflow"),a*=m;x=p(v-r,t=f.length+1,0==r),I(v/t)>b-_&&o("overflow"),_+=I(v/t),v%=t,f.splice(v++,0,_)}return h(f)}function f(e){var t,i,n,s,r,a,c,h,u,m,f,g,v,_,x,T=[];for(g=(e=l(e)).length,t=A,i=0,r=R,a=0;a=t&&fI((b-i)/(v=n+1))&&o("overflow"),i+=(c-t)*v,t=c,a=0;ab&&o("overflow"),f==t){for(h=i,u=E;m=u<=r?y:u>=r+w?w:u-r,!(h= 0x80 (not a basic code point)","invalid-input":"Invalid input"},C=E-y,I=Math.floor,U=String.fromCharCode;v={version:"1.4.1",ucs2:{decode:l,encode:h},decode:m,encode:f,toASCII:function(e){return c(e,function(e){return S.test(e)?"xn--"+f(e):e})},toUnicode:function(e){return c(e,function(e){return T.test(e)?m(e.slice(4).toLowerCase()):e})}},void 0!==(s=function(){return v}.call(t,i,t,e))&&(e.exports=s)}()}).call(t,i(95)(e),i(6))},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,i){"use strict";e.exports={isString:function(e){return"string"==typeof e},isObject:function(e){return"object"==typeof e&&null!==e},isNull:function(e){return null===e},isNullOrUndefined:function(e){return null==e}}},function(e,t,i){var n=i(48),s=e.exports;for(var r in n)n.hasOwnProperty(r)&&(s[r]=n[r]);s.request=function(e,t){return e||(e={}),e.scheme="https",e.protocol="https:",n.request.call(this,e,t)}},function(e,t){e.exports={_from:"snekfetch@^3.0.0",_id:"snekfetch@3.2.9",_inBundle:!1,_integrity:"sha512-0ZYxGRMtgBska6uQ616F0jcPYad/sLe+uBJJ2vewD62ftEFnh6rY5mza05KoUS5UWcclMuiUfAZSf10ZYnkOZA==",_location:"/snekfetch",_phantomChildren:{},_requested:{type:"range",registry:!0,raw:"snekfetch@^3.0.0",name:"snekfetch",escapedName:"snekfetch",rawSpec:"^3.0.0",saveSpec:null,fetchSpec:"^3.0.0"},_requiredBy:["/"],_resolved:"https://registry.npmjs.org/snekfetch/-/snekfetch-3.2.9.tgz",_shasum:"cdd28c7e88c889d86b9ff289a8e985a2f484f206",_spec:"snekfetch@^3.0.0",_where:"C:\\Users\\crawl\\Documents\\Coding\\Javascript\\Discord\\Frameworks\\test\\discord.js",author:{name:"Gus Caplan",email:"me@gus.host"},bugs:{url:"https://github.com/devsnek/snekfetch/issues"},bundleDependencies:!1,dependencies:{},deprecated:!1,description:"Just do http requests without all that weird nastiness from other libs",devDependencies:{},homepage:"https://github.com/devsnek/snekfetch#readme",license:"MIT",main:"index.js",name:"snekfetch",repository:{type:"git",url:"git+https://github.com/devsnek/snekfetch.git"},version:"3.2.9"}},function(e,t,i){(function(t){const n=i(19),s=i(51);class r{constructor(){this.boundary=`--snekfetch--${Math.random().toString().slice(2,7)}`,this.buffers=[]}append(e,i,r){if(void 0===i)return;let o=`\r\n--${this.boundary}\r\nContent-Disposition: form-data; name="${e}"`,a=null;if(r){o+=`; filename="${r}"`,a="application/octet-stream";const e=n.extname(r).slice(1);e&&(a=s.lookup(e))}i instanceof t?a=s.buffer(i):"object"==typeof i?(a="application/json",i=t.from(JSON.stringify(i))):i=t.from(String(i)),a&&(o+=`\r\nContent-Type: ${a}`),this.buffers.push(`${o}\r\n\r\n`),this.buffers.push(i)}end(){return this.buffers.push(`\r\n--${this.boundary}--`),this.buffers}get length(){return this.buffers.reduce((e,i)=>e+t.byteLength(i),0)}}e.exports=r}).call(t,i(5).Buffer)},function(e,t){e.exports={123:"application/vnd.lotus-1-2-3",ez:"application/andrew-inset",aw:"application/applixware",atom:"application/atom+xml",atomcat:"application/atomcat+xml",atomsvc:"application/atomsvc+xml",bdoc:"application/x-bdoc",ccxml:"application/ccxml+xml",cdmia:"application/cdmi-capability",cdmic:"application/cdmi-container",cdmid:"application/cdmi-domain",cdmio:"application/cdmi-object",cdmiq:"application/cdmi-queue",cu:"application/cu-seeme",mpd:"application/dash+xml",davmount:"application/davmount+xml",dbk:"application/docbook+xml",dssc:"application/dssc+der",xdssc:"application/dssc+xml",ecma:"application/ecmascript",emma:"application/emma+xml",epub:"application/epub+zip",exi:"application/exi",pfr:"application/font-tdpfr",woff:"application/font-woff",woff2:"application/font-woff2",geojson:"application/geo+json",gml:"application/gml+xml",gpx:"application/gpx+xml",gxf:"application/gxf",stk:"application/hyperstudio",ink:"application/inkml+xml",inkml:"application/inkml+xml",ipfix:"application/ipfix",jar:"application/java-archive",war:"application/java-archive",ear:"application/java-archive",ser:"application/java-serialized-object",class:"application/java-vm",js:"application/javascript",json:"application/json",map:"application/json",json5:"application/json5",jsonml:"application/jsonml+json",jsonld:"application/ld+json",lostxml:"application/lost+xml",hqx:"application/mac-binhex40",cpt:"application/mac-compactpro",mads:"application/mads+xml",webmanifest:"application/manifest+json",mrc:"application/marc",mrcx:"application/marcxml+xml",ma:"application/mathematica",nb:"application/mathematica",mb:"application/mathematica",mathml:"application/mathml+xml",mbox:"application/mbox",mscml:"application/mediaservercontrol+xml",metalink:"application/metalink+xml",meta4:"application/metalink4+xml",mets:"application/mets+xml",mods:"application/mods+xml",m21:"application/mp21",mp21:"application/mp21",mp4s:"application/mp4",m4p:"application/mp4",doc:"application/msword",dot:"application/msword",mxf:"application/mxf",bin:"application/octet-stream",dms:"application/octet-stream",lrf:"application/octet-stream",mar:"application/octet-stream",so:"application/octet-stream",dist:"application/octet-stream",distz:"application/octet-stream",pkg:"application/octet-stream",bpk:"application/octet-stream",dump:"application/octet-stream",elc:"application/octet-stream",deploy:"application/octet-stream",exe:"application/x-msdownload",dll:"application/x-msdownload",deb:"application/x-debian-package",dmg:"application/x-apple-diskimage",iso:"application/x-iso9660-image",img:"application/octet-stream",msi:"application/x-msdownload",msp:"application/octet-stream",msm:"application/octet-stream",buffer:"application/octet-stream",oda:"application/oda",opf:"application/oebps-package+xml",ogx:"application/ogg",omdoc:"application/omdoc+xml",onetoc:"application/onenote",onetoc2:"application/onenote",onetmp:"application/onenote",onepkg:"application/onenote",oxps:"application/oxps",xer:"application/patch-ops-error+xml",pdf:"application/pdf",pgp:"application/pgp-encrypted",asc:"application/pgp-signature",sig:"application/pgp-signature",prf:"application/pics-rules",p10:"application/pkcs10",p7m:"application/pkcs7-mime",p7c:"application/pkcs7-mime",p7s:"application/pkcs7-signature",p8:"application/pkcs8",ac:"application/pkix-attr-cert",cer:"application/pkix-cert",crl:"application/pkix-crl",pkipath:"application/pkix-pkipath",pki:"application/pkixcmp",pls:"application/pls+xml",ai:"application/postscript",eps:"application/postscript",ps:"application/postscript",cww:"application/prs.cww",pskcxml:"application/pskc+xml",rdf:"application/rdf+xml",rif:"application/reginfo+xml",rnc:"application/relax-ng-compact-syntax",rl:"application/resource-lists+xml",rld:"application/resource-lists-diff+xml",rs:"application/rls-services+xml",gbr:"application/rpki-ghostbusters",mft:"application/rpki-manifest",roa:"application/rpki-roa",rsd:"application/rsd+xml",rss:"application/rss+xml",rtf:"text/rtf",sbml:"application/sbml+xml",scq:"application/scvp-cv-request",scs:"application/scvp-cv-response",spq:"application/scvp-vp-request",spp:"application/scvp-vp-response",sdp:"application/sdp",setpay:"application/set-payment-initiation",setreg:"application/set-registration-initiation",shf:"application/shf+xml",smi:"application/smil+xml",smil:"application/smil+xml",rq:"application/sparql-query",srx:"application/sparql-results+xml",gram:"application/srgs",grxml:"application/srgs+xml",sru:"application/sru+xml",ssdl:"application/ssdl+xml",ssml:"application/ssml+xml",tei:"application/tei+xml",teicorpus:"application/tei+xml",tfi:"application/thraud+xml",tsd:"application/timestamped-data",plb:"application/vnd.3gpp.pic-bw-large",psb:"application/vnd.3gpp.pic-bw-small",pvb:"application/vnd.3gpp.pic-bw-var",tcap:"application/vnd.3gpp2.tcap",pwn:"application/vnd.3m.post-it-notes",aso:"application/vnd.accpac.simply.aso",imp:"application/vnd.accpac.simply.imp",acu:"application/vnd.acucobol",atc:"application/vnd.acucorp",acutc:"application/vnd.acucorp",air:"application/vnd.adobe.air-application-installer-package+zip",fcdt:"application/vnd.adobe.formscentral.fcdt",fxp:"application/vnd.adobe.fxp",fxpl:"application/vnd.adobe.fxp",xdp:"application/vnd.adobe.xdp+xml",xfdf:"application/vnd.adobe.xfdf",ahead:"application/vnd.ahead.space",azf:"application/vnd.airzip.filesecure.azf",azs:"application/vnd.airzip.filesecure.azs",azw:"application/vnd.amazon.ebook",acc:"application/vnd.americandynamics.acc",ami:"application/vnd.amiga.ami",apk:"application/vnd.android.package-archive",cii:"application/vnd.anser-web-certificate-issue-initiation",fti:"application/vnd.anser-web-funds-transfer-initiation",atx:"application/vnd.antix.game-component",mpkg:"application/vnd.apple.installer+xml",m3u8:"application/vnd.apple.mpegurl",pkpass:"application/vnd.apple.pkpass",swi:"application/vnd.aristanetworks.swi",iota:"application/vnd.astraea-software.iota",aep:"application/vnd.audiograph",mpm:"application/vnd.blueice.multipass",bmi:"application/vnd.bmi",rep:"application/vnd.businessobjects",cdxml:"application/vnd.chemdraw+xml",mmd:"application/vnd.chipnuts.karaoke-mmd",cdy:"application/vnd.cinderella",cla:"application/vnd.claymore",rp9:"application/vnd.cloanto.rp9",c4g:"application/vnd.clonk.c4group",c4d:"application/vnd.clonk.c4group",c4f:"application/vnd.clonk.c4group",c4p:"application/vnd.clonk.c4group",c4u:"application/vnd.clonk.c4group",c11amc:"application/vnd.cluetrust.cartomobile-config",c11amz:"application/vnd.cluetrust.cartomobile-config-pkg",csp:"application/vnd.commonspace",cdbcmsg:"application/vnd.contact.cmsg",cmc:"application/vnd.cosmocaller",clkx:"application/vnd.crick.clicker",clkk:"application/vnd.crick.clicker.keyboard",clkp:"application/vnd.crick.clicker.palette",clkt:"application/vnd.crick.clicker.template",clkw:"application/vnd.crick.clicker.wordbank",wbs:"application/vnd.criticaltools.wbs+xml",pml:"application/vnd.ctc-posml",ppd:"application/vnd.cups-ppd",car:"application/vnd.curl.car",pcurl:"application/vnd.curl.pcurl",dart:"application/vnd.dart",rdz:"application/vnd.data-vision.rdz",uvf:"application/vnd.dece.data",uvvf:"application/vnd.dece.data",uvd:"application/vnd.dece.data",uvvd:"application/vnd.dece.data",uvt:"application/vnd.dece.ttml+xml",uvvt:"application/vnd.dece.ttml+xml",uvx:"application/vnd.dece.unspecified",uvvx:"application/vnd.dece.unspecified",uvz:"application/vnd.dece.zip",uvvz:"application/vnd.dece.zip",fe_launch:"application/vnd.denovo.fcselayout-link",dna:"application/vnd.dna",mlp:"application/vnd.dolby.mlp",dpg:"application/vnd.dpgraph",dfac:"application/vnd.dreamfactory",kpxx:"application/vnd.ds-keypoint",ait:"application/vnd.dvb.ait",svc:"application/vnd.dvb.service",geo:"application/vnd.dynageo",mag:"application/vnd.ecowin.chart",nml:"application/vnd.enliven",esf:"application/vnd.epson.esf",msf:"application/vnd.epson.msf",qam:"application/vnd.epson.quickanime",slt:"application/vnd.epson.salt",ssf:"application/vnd.epson.ssf",es3:"application/vnd.eszigno3+xml",et3:"application/vnd.eszigno3+xml",ez2:"application/vnd.ezpix-album",ez3:"application/vnd.ezpix-package",fdf:"application/vnd.fdf",mseed:"application/vnd.fdsn.mseed",seed:"application/vnd.fdsn.seed",dataless:"application/vnd.fdsn.seed",gph:"application/vnd.flographit",ftc:"application/vnd.fluxtime.clip",fm:"application/vnd.framemaker",frame:"application/vnd.framemaker",maker:"application/vnd.framemaker",book:"application/vnd.framemaker",fnc:"application/vnd.frogans.fnc",ltf:"application/vnd.frogans.ltf",fsc:"application/vnd.fsc.weblaunch",oas:"application/vnd.fujitsu.oasys",oa2:"application/vnd.fujitsu.oasys2",oa3:"application/vnd.fujitsu.oasys3",fg5:"application/vnd.fujitsu.oasysgp",bh2:"application/vnd.fujitsu.oasysprs",ddd:"application/vnd.fujixerox.ddd",xdw:"application/vnd.fujixerox.docuworks",xbd:"application/vnd.fujixerox.docuworks.binder",fzs:"application/vnd.fuzzysheet",txd:"application/vnd.genomatix.tuxedo",ggb:"application/vnd.geogebra.file",ggt:"application/vnd.geogebra.tool",gex:"application/vnd.geometry-explorer",gre:"application/vnd.geometry-explorer",gxt:"application/vnd.geonext",g2w:"application/vnd.geoplan",g3w:"application/vnd.geospace",gmx:"application/vnd.gmx",gdoc:"application/vnd.google-apps.document",gslides:"application/vnd.google-apps.presentation",gsheet:"application/vnd.google-apps.spreadsheet",kml:"application/vnd.google-earth.kml+xml",kmz:"application/vnd.google-earth.kmz",gqf:"application/vnd.grafeq",gqs:"application/vnd.grafeq",gac:"application/vnd.groove-account",ghf:"application/vnd.groove-help",gim:"application/vnd.groove-identity-message",grv:"application/vnd.groove-injector",gtm:"application/vnd.groove-tool-message",tpl:"application/vnd.groove-tool-template",vcg:"application/vnd.groove-vcard",hal:"application/vnd.hal+xml",zmm:"application/vnd.handheld-entertainment+xml",hbci:"application/vnd.hbci",les:"application/vnd.hhe.lesson-player",hpgl:"application/vnd.hp-hpgl",hpid:"application/vnd.hp-hpid",hps:"application/vnd.hp-hps",jlt:"application/vnd.hp-jlyt",pcl:"application/vnd.hp-pcl",pclxl:"application/vnd.hp-pclxl","sfd-hdstx":"application/vnd.hydrostatix.sof-data",mpy:"application/vnd.ibm.minipay",afp:"application/vnd.ibm.modcap",listafp:"application/vnd.ibm.modcap",list3820:"application/vnd.ibm.modcap",irm:"application/vnd.ibm.rights-management",sc:"application/vnd.ibm.secure-container",icc:"application/vnd.iccprofile",icm:"application/vnd.iccprofile",igl:"application/vnd.igloader",ivp:"application/vnd.immervision-ivp",ivu:"application/vnd.immervision-ivu",igm:"application/vnd.insors.igm",xpw:"application/vnd.intercon.formnet",xpx:"application/vnd.intercon.formnet",i2g:"application/vnd.intergeo",qbo:"application/vnd.intu.qbo",qfx:"application/vnd.intu.qfx",rcprofile:"application/vnd.ipunplugged.rcprofile",irp:"application/vnd.irepository.package+xml",xpr:"application/vnd.is-xpr",fcs:"application/vnd.isac.fcs",jam:"application/vnd.jam",rms:"application/vnd.jcp.javame.midlet-rms",jisp:"application/vnd.jisp",joda:"application/vnd.joost.joda-archive",ktz:"application/vnd.kahootz",ktr:"application/vnd.kahootz",karbon:"application/vnd.kde.karbon",chrt:"application/vnd.kde.kchart",kfo:"application/vnd.kde.kformula",flw:"application/vnd.kde.kivio",kon:"application/vnd.kde.kontour",kpr:"application/vnd.kde.kpresenter",kpt:"application/vnd.kde.kpresenter",ksp:"application/vnd.kde.kspread",kwd:"application/vnd.kde.kword",kwt:"application/vnd.kde.kword",htke:"application/vnd.kenameaapp",kia:"application/vnd.kidspiration",kne:"application/vnd.kinar",knp:"application/vnd.kinar",skp:"application/vnd.koan",skd:"application/vnd.koan",skt:"application/vnd.koan",skm:"application/vnd.koan",sse:"application/vnd.kodak-descriptor",lasxml:"application/vnd.las.las+xml",lbd:"application/vnd.llamagraphics.life-balance.desktop",lbe:"application/vnd.llamagraphics.life-balance.exchange+xml",apr:"application/vnd.lotus-approach",pre:"application/vnd.lotus-freelance",nsf:"application/vnd.lotus-notes",org:"application/vnd.lotus-organizer",scm:"application/vnd.lotus-screencam",lwp:"application/vnd.lotus-wordpro",portpkg:"application/vnd.macports.portpkg",mcd:"application/vnd.mcd",mc1:"application/vnd.medcalcdata",cdkey:"application/vnd.mediastation.cdkey",mwf:"application/vnd.mfer",mfm:"application/vnd.mfmp",flo:"application/vnd.micrografx.flo",igx:"application/vnd.micrografx.igx",mif:"application/vnd.mif",daf:"application/vnd.mobius.daf",dis:"application/vnd.mobius.dis",mbk:"application/vnd.mobius.mbk",mqy:"application/vnd.mobius.mqy",msl:"application/vnd.mobius.msl",plc:"application/vnd.mobius.plc",txf:"application/vnd.mobius.txf",mpn:"application/vnd.mophun.application",mpc:"application/vnd.mophun.certificate",xul:"application/vnd.mozilla.xul+xml",cil:"application/vnd.ms-artgalry",cab:"application/vnd.ms-cab-compressed",xls:"application/vnd.ms-excel",xlm:"application/vnd.ms-excel",xla:"application/vnd.ms-excel",xlc:"application/vnd.ms-excel",xlt:"application/vnd.ms-excel",xlw:"application/vnd.ms-excel",xlam:"application/vnd.ms-excel.addin.macroenabled.12",xlsb:"application/vnd.ms-excel.sheet.binary.macroenabled.12",xlsm:"application/vnd.ms-excel.sheet.macroenabled.12",xltm:"application/vnd.ms-excel.template.macroenabled.12",eot:"application/vnd.ms-fontobject",chm:"application/vnd.ms-htmlhelp",ims:"application/vnd.ms-ims",lrm:"application/vnd.ms-lrm",thmx:"application/vnd.ms-officetheme",cat:"application/vnd.ms-pki.seccat",stl:"application/vnd.ms-pki.stl",ppt:"application/vnd.ms-powerpoint",pps:"application/vnd.ms-powerpoint",pot:"application/vnd.ms-powerpoint",ppam:"application/vnd.ms-powerpoint.addin.macroenabled.12",pptm:"application/vnd.ms-powerpoint.presentation.macroenabled.12",sldm:"application/vnd.ms-powerpoint.slide.macroenabled.12",ppsm:"application/vnd.ms-powerpoint.slideshow.macroenabled.12",potm:"application/vnd.ms-powerpoint.template.macroenabled.12",mpp:"application/vnd.ms-project",mpt:"application/vnd.ms-project",docm:"application/vnd.ms-word.document.macroenabled.12",dotm:"application/vnd.ms-word.template.macroenabled.12",wps:"application/vnd.ms-works",wks:"application/vnd.ms-works",wcm:"application/vnd.ms-works",wdb:"application/vnd.ms-works",wpl:"application/vnd.ms-wpl",xps:"application/vnd.ms-xpsdocument",mseq:"application/vnd.mseq",mus:"application/vnd.musician",msty:"application/vnd.muvee.style",taglet:"application/vnd.mynfc",nlu:"application/vnd.neurolanguage.nlu",ntf:"application/vnd.nitf",nitf:"application/vnd.nitf",nnd:"application/vnd.noblenet-directory",nns:"application/vnd.noblenet-sealer",nnw:"application/vnd.noblenet-web",ngdat:"application/vnd.nokia.n-gage.data","n-gage":"application/vnd.nokia.n-gage.symbian.install",rpst:"application/vnd.nokia.radio-preset",rpss:"application/vnd.nokia.radio-presets",edm:"application/vnd.novadigm.edm",edx:"application/vnd.novadigm.edx",ext:"application/vnd.novadigm.ext",odc:"application/vnd.oasis.opendocument.chart",otc:"application/vnd.oasis.opendocument.chart-template",odb:"application/vnd.oasis.opendocument.database",odf:"application/vnd.oasis.opendocument.formula",odft:"application/vnd.oasis.opendocument.formula-template",odg:"application/vnd.oasis.opendocument.graphics",otg:"application/vnd.oasis.opendocument.graphics-template",odi:"application/vnd.oasis.opendocument.image",oti:"application/vnd.oasis.opendocument.image-template",odp:"application/vnd.oasis.opendocument.presentation",otp:"application/vnd.oasis.opendocument.presentation-template",ods:"application/vnd.oasis.opendocument.spreadsheet",ots:"application/vnd.oasis.opendocument.spreadsheet-template",odt:"application/vnd.oasis.opendocument.text",odm:"application/vnd.oasis.opendocument.text-master",ott:"application/vnd.oasis.opendocument.text-template",oth:"application/vnd.oasis.opendocument.text-web",xo:"application/vnd.olpc-sugar",dd2:"application/vnd.oma.dd2+xml",oxt:"application/vnd.openofficeorg.extension",pptx:"application/vnd.openxmlformats-officedocument.presentationml.presentation",sldx:"application/vnd.openxmlformats-officedocument.presentationml.slide",ppsx:"application/vnd.openxmlformats-officedocument.presentationml.slideshow",potx:"application/vnd.openxmlformats-officedocument.presentationml.template",xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",xltx:"application/vnd.openxmlformats-officedocument.spreadsheetml.template",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",dotx:"application/vnd.openxmlformats-officedocument.wordprocessingml.template",mgp:"application/vnd.osgeo.mapguide.package",dp:"application/vnd.osgi.dp",esa:"application/vnd.osgi.subsystem",pdb:"application/x-pilot",pqa:"application/vnd.palm",oprc:"application/vnd.palm",paw:"application/vnd.pawaafile",str:"application/vnd.pg.format",ei6:"application/vnd.pg.osasli",efif:"application/vnd.picsel",wg:"application/vnd.pmi.widget",plf:"application/vnd.pocketlearn",pbd:"application/vnd.powerbuilder6",box:"application/vnd.previewsystems.box",mgz:"application/vnd.proteus.magazine",qps:"application/vnd.publishare-delta-tree",ptid:"application/vnd.pvi.ptid1",qxd:"application/vnd.quark.quarkxpress",qxt:"application/vnd.quark.quarkxpress",qwd:"application/vnd.quark.quarkxpress",qwt:"application/vnd.quark.quarkxpress",qxl:"application/vnd.quark.quarkxpress",qxb:"application/vnd.quark.quarkxpress",bed:"application/vnd.realvnc.bed",mxl:"application/vnd.recordare.musicxml",musicxml:"application/vnd.recordare.musicxml+xml",cryptonote:"application/vnd.rig.cryptonote",cod:"application/vnd.rim.cod",rm:"application/vnd.rn-realmedia",rmvb:"application/vnd.rn-realmedia-vbr",link66:"application/vnd.route66.link66+xml",st:"application/vnd.sailingtracker.track",see:"application/vnd.seemail",sema:"application/vnd.sema",semd:"application/vnd.semd",semf:"application/vnd.semf",ifm:"application/vnd.shana.informed.formdata",itp:"application/vnd.shana.informed.formtemplate",iif:"application/vnd.shana.informed.interchange",ipk:"application/vnd.shana.informed.package",twd:"application/vnd.simtech-mindmapper",twds:"application/vnd.simtech-mindmapper",mmf:"application/vnd.smaf",teacher:"application/vnd.smart.teacher",sdkm:"application/vnd.solent.sdkm+xml",sdkd:"application/vnd.solent.sdkm+xml",dxp:"application/vnd.spotfire.dxp",sfs:"application/vnd.spotfire.sfs",sdc:"application/vnd.stardivision.calc",sda:"application/vnd.stardivision.draw",sdd:"application/vnd.stardivision.impress",smf:"application/vnd.stardivision.math",sdw:"application/vnd.stardivision.writer",vor:"application/vnd.stardivision.writer",sgl:"application/vnd.stardivision.writer-global",smzip:"application/vnd.stepmania.package",sm:"application/vnd.stepmania.stepchart",sxc:"application/vnd.sun.xml.calc",stc:"application/vnd.sun.xml.calc.template",sxd:"application/vnd.sun.xml.draw",std:"application/vnd.sun.xml.draw.template",sxi:"application/vnd.sun.xml.impress",sti:"application/vnd.sun.xml.impress.template",sxm:"application/vnd.sun.xml.math",sxw:"application/vnd.sun.xml.writer",sxg:"application/vnd.sun.xml.writer.global",stw:"application/vnd.sun.xml.writer.template",sus:"application/vnd.sus-calendar",susp:"application/vnd.sus-calendar",svd:"application/vnd.svd",sis:"application/vnd.symbian.install",sisx:"application/vnd.symbian.install",xsm:"application/vnd.syncml+xml",bdm:"application/vnd.syncml.dm+wbxml",xdm:"application/vnd.syncml.dm+xml",tao:"application/vnd.tao.intent-module-archive",pcap:"application/vnd.tcpdump.pcap",cap:"application/vnd.tcpdump.pcap",dmp:"application/vnd.tcpdump.pcap",tmo:"application/vnd.tmobile-livetv",tpt:"application/vnd.trid.tpt",mxs:"application/vnd.triscape.mxs",tra:"application/vnd.trueapp",ufd:"application/vnd.ufdl",ufdl:"application/vnd.ufdl",utz:"application/vnd.uiq.theme",umj:"application/vnd.umajin",unityweb:"application/vnd.unity",uoml:"application/vnd.uoml+xml",vcx:"application/vnd.vcx",vsd:"application/vnd.visio",vst:"application/vnd.visio",vss:"application/vnd.visio",vsw:"application/vnd.visio",vis:"application/vnd.visionary",vsf:"application/vnd.vsf",wbxml:"application/vnd.wap.wbxml",wmlc:"application/vnd.wap.wmlc",wmlsc:"application/vnd.wap.wmlscriptc",wtb:"application/vnd.webturbo",nbp:"application/vnd.wolfram.player",wpd:"application/vnd.wordperfect",wqd:"application/vnd.wqd",stf:"application/vnd.wt.stf",xar:"application/vnd.xara",xfdl:"application/vnd.xfdl",hvd:"application/vnd.yamaha.hv-dic",hvs:"application/vnd.yamaha.hv-script",hvp:"application/vnd.yamaha.hv-voice",osf:"application/vnd.yamaha.openscoreformat",osfpvg:"application/vnd.yamaha.openscoreformat.osfpvg+xml",saf:"application/vnd.yamaha.smaf-audio",spf:"application/vnd.yamaha.smaf-phrase",cmp:"application/vnd.yellowriver-custom-menu",zir:"application/vnd.zul",zirz:"application/vnd.zul",zaz:"application/vnd.zzazz.deck+xml",vxml:"application/voicexml+xml",wgt:"application/widget",hlp:"application/winhlp",wsdl:"application/wsdl+xml",wspolicy:"application/wspolicy+xml","7z":"application/x-7z-compressed",abw:"application/x-abiword",ace:"application/x-ace-compressed",aab:"application/x-authorware-bin",x32:"application/x-authorware-bin",u32:"application/x-authorware-bin",vox:"application/x-authorware-bin",aam:"application/x-authorware-map",aas:"application/x-authorware-seg",bcpio:"application/x-bcpio",torrent:"application/x-bittorrent",blb:"application/x-blorb",blorb:"application/x-blorb",bz:"application/x-bzip",bz2:"application/x-bzip2",boz:"application/x-bzip2",cbr:"application/x-cbr",cba:"application/x-cbr",cbt:"application/x-cbr",cbz:"application/x-cbr",cb7:"application/x-cbr",vcd:"application/x-cdlink",cfs:"application/x-cfs-compressed",chat:"application/x-chat",pgn:"application/x-chess-pgn",crx:"application/x-chrome-extension",cco:"application/x-cocoa",nsc:"application/x-conference",cpio:"application/x-cpio",csh:"application/x-csh",udeb:"application/x-debian-package",dgc:"application/x-dgc-compressed",dir:"application/x-director",dcr:"application/x-director",dxr:"application/x-director",cst:"application/x-director",cct:"application/x-director",cxt:"application/x-director",w3d:"application/x-director",fgd:"application/x-director",swa:"application/x-director",wad:"application/x-doom",ncx:"application/x-dtbncx+xml",dtb:"application/x-dtbook+xml",res:"application/x-dtbresource+xml",dvi:"application/x-dvi",evy:"application/x-envoy",eva:"application/x-eva",bdf:"application/x-font-bdf",gsf:"application/x-font-ghostscript",psf:"application/x-font-linux-psf",otf:"font/opentype",pcf:"application/x-font-pcf",snf:"application/x-font-snf",ttf:"application/x-font-ttf",ttc:"application/x-font-ttf",pfa:"application/x-font-type1",pfb:"application/x-font-type1",pfm:"application/x-font-type1",afm:"application/x-font-type1",arc:"application/x-freearc",spl:"application/x-futuresplash",gca:"application/x-gca-compressed",ulx:"application/x-glulx",gnumeric:"application/x-gnumeric",gramps:"application/x-gramps-xml",gtar:"application/x-gtar",hdf:"application/x-hdf",php:"application/x-httpd-php",install:"application/x-install-instructions",jardiff:"application/x-java-archive-diff",jnlp:"application/x-java-jnlp-file",latex:"application/x-latex",luac:"application/x-lua-bytecode",lzh:"application/x-lzh-compressed",lha:"application/x-lzh-compressed",run:"application/x-makeself",mie:"application/x-mie",prc:"application/x-pilot",mobi:"application/x-mobipocket-ebook",application:"application/x-ms-application",lnk:"application/x-ms-shortcut",wmd:"application/x-ms-wmd",wmz:"application/x-msmetafile",xbap:"application/x-ms-xbap",mdb:"application/x-msaccess",obd:"application/x-msbinder",crd:"application/x-mscardfile",clp:"application/x-msclip",com:"application/x-msdownload",bat:"application/x-msdownload",mvb:"application/x-msmediaview",m13:"application/x-msmediaview",m14:"application/x-msmediaview",wmf:"application/x-msmetafile",emf:"application/x-msmetafile",emz:"application/x-msmetafile",mny:"application/x-msmoney",pub:"application/x-mspublisher",scd:"application/x-msschedule",trm:"application/x-msterminal",wri:"application/x-mswrite",nc:"application/x-netcdf",cdf:"application/x-netcdf",pac:"application/x-ns-proxy-autoconfig",nzb:"application/x-nzb",pl:"application/x-perl",pm:"application/x-perl",p12:"application/x-pkcs12",pfx:"application/x-pkcs12",p7b:"application/x-pkcs7-certificates",spc:"application/x-pkcs7-certificates",p7r:"application/x-pkcs7-certreqresp",rar:"application/x-rar-compressed",rpm:"application/x-redhat-package-manager",ris:"application/x-research-info-systems",sea:"application/x-sea",sh:"application/x-sh",shar:"application/x-shar",swf:"application/x-shockwave-flash",xap:"application/x-silverlight-app",sql:"application/x-sql",sit:"application/x-stuffit",sitx:"application/x-stuffitx",srt:"application/x-subrip",sv4cpio:"application/x-sv4cpio",sv4crc:"application/x-sv4crc",t3:"application/x-t3vm-image",gam:"application/x-tads",tar:"application/x-tar",tcl:"application/x-tcl",tk:"application/x-tcl",tex:"application/x-tex",tfm:"application/x-tex-tfm",texinfo:"application/x-texinfo",texi:"application/x-texinfo",obj:"application/x-tgif",ustar:"application/x-ustar",src:"application/x-wais-source",webapp:"application/x-web-app-manifest+json",der:"application/x-x509-ca-cert",crt:"application/x-x509-ca-cert",pem:"application/x-x509-ca-cert",fig:"application/x-xfig",xlf:"application/x-xliff+xml",xpi:"application/x-xpinstall",xz:"application/x-xz",z1:"application/x-zmachine",z2:"application/x-zmachine",z3:"application/x-zmachine",z4:"application/x-zmachine",z5:"application/x-zmachine",z6:"application/x-zmachine",z7:"application/x-zmachine",z8:"application/x-zmachine",xaml:"application/xaml+xml",xdf:"application/xcap-diff+xml",xenc:"application/xenc+xml",xhtml:"application/xhtml+xml",xht:"application/xhtml+xml",xml:"text/xml",xsl:"application/xml",xsd:"application/xml",rng:"application/xml",dtd:"application/xml-dtd",xop:"application/xop+xml",xpl:"application/xproc+xml",xslt:"application/xslt+xml",xspf:"application/xspf+xml",mxml:"application/xv+xml",xhvml:"application/xv+xml",xvml:"application/xv+xml",xvm:"application/xv+xml",yang:"application/yang",yin:"application/yin+xml",zip:"application/zip","3gpp":"video/3gpp",adp:"audio/adpcm",au:"audio/basic",snd:"audio/basic",mid:"audio/midi",midi:"audio/midi",kar:"audio/midi",rmi:"audio/midi",mp3:"audio/mpeg",m4a:"audio/x-m4a",mp4a:"audio/mp4",mpga:"audio/mpeg",mp2:"audio/mpeg",mp2a:"audio/mpeg",m2a:"audio/mpeg",m3a:"audio/mpeg",oga:"audio/ogg",ogg:"audio/ogg",spx:"audio/ogg",s3m:"audio/s3m",sil:"audio/silk",uva:"audio/vnd.dece.audio",uvva:"audio/vnd.dece.audio",eol:"audio/vnd.digital-winds",dra:"audio/vnd.dra",dts:"audio/vnd.dts",dtshd:"audio/vnd.dts.hd",lvp:"audio/vnd.lucent.voice",pya:"audio/vnd.ms-playready.media.pya",ecelp4800:"audio/vnd.nuera.ecelp4800",ecelp7470:"audio/vnd.nuera.ecelp7470",ecelp9600:"audio/vnd.nuera.ecelp9600",rip:"audio/vnd.rip",wav:"audio/x-wav",weba:"audio/webm",aac:"audio/x-aac",aif:"audio/x-aiff",aiff:"audio/x-aiff",aifc:"audio/x-aiff",caf:"audio/x-caf",flac:"audio/x-flac",mka:"audio/x-matroska",m3u:"audio/x-mpegurl",wax:"audio/x-ms-wax",wma:"audio/x-ms-wma",ram:"audio/x-pn-realaudio",ra:"audio/x-realaudio",rmp:"audio/x-pn-realaudio-plugin",xm:"audio/xm",cdx:"chemical/x-cdx",cif:"chemical/x-cif",cmdf:"chemical/x-cmdf",cml:"chemical/x-cml",csml:"chemical/x-csml",xyz:"chemical/x-xyz",bmp:"image/x-ms-bmp",cgm:"image/cgm",g3:"image/g3fax",gif:"image/gif",ief:"image/ief",jpeg:"image/jpeg",jpg:"image/jpeg",jpe:"image/jpeg",ktx:"image/ktx",png:"image/png",btif:"image/prs.btif",sgi:"image/sgi",svg:"image/svg+xml",svgz:"image/svg+xml",tiff:"image/tiff",tif:"image/tiff",psd:"image/vnd.adobe.photoshop",uvi:"image/vnd.dece.graphic",uvvi:"image/vnd.dece.graphic",uvg:"image/vnd.dece.graphic",uvvg:"image/vnd.dece.graphic",djvu:"image/vnd.djvu",djv:"image/vnd.djvu",sub:"text/vnd.dvb.subtitle",dwg:"image/vnd.dwg",dxf:"image/vnd.dxf",fbs:"image/vnd.fastbidsheet",fpx:"image/vnd.fpx",fst:"image/vnd.fst",mmr:"image/vnd.fujixerox.edmics-mmr",rlc:"image/vnd.fujixerox.edmics-rlc",mdi:"image/vnd.ms-modi",wdp:"image/vnd.ms-photo",npx:"image/vnd.net-fpx",wbmp:"image/vnd.wap.wbmp",xif:"image/vnd.xiff",webp:"image/webp","3ds":"image/x-3ds",ras:"image/x-cmu-raster",cmx:"image/x-cmx",fh:"image/x-freehand",fhc:"image/x-freehand",fh4:"image/x-freehand",fh5:"image/x-freehand",fh7:"image/x-freehand",ico:"image/x-icon",jng:"image/x-jng",sid:"image/x-mrsid-image",pcx:"image/x-pcx",pic:"image/x-pict",pct:"image/x-pict",pnm:"image/x-portable-anymap",pbm:"image/x-portable-bitmap",pgm:"image/x-portable-graymap",ppm:"image/x-portable-pixmap",rgb:"image/x-rgb",tga:"image/x-tga",xbm:"image/x-xbitmap",xpm:"image/x-xpixmap",xwd:"image/x-xwindowdump",eml:"message/rfc822",mime:"message/rfc822",igs:"model/iges",iges:"model/iges",msh:"model/mesh",mesh:"model/mesh",silo:"model/mesh",dae:"model/vnd.collada+xml",dwf:"model/vnd.dwf",gdl:"model/vnd.gdl",gtw:"model/vnd.gtw",mts:"model/vnd.mts",vtu:"model/vnd.vtu",wrl:"model/vrml",vrml:"model/vrml",x3db:"model/x3d+binary",x3dbz:"model/x3d+binary",x3dv:"model/x3d+vrml",x3dvz:"model/x3d+vrml",x3d:"model/x3d+xml",x3dz:"model/x3d+xml",appcache:"text/cache-manifest",manifest:"text/cache-manifest",ics:"text/calendar",ifb:"text/calendar",coffee:"text/coffeescript",litcoffee:"text/coffeescript",css:"text/css",csv:"text/csv",hjson:"text/hjson",html:"text/html",htm:"text/html",shtml:"text/html",jade:"text/jade",jsx:"text/jsx",less:"text/less",mml:"text/mathml",n3:"text/n3",txt:"text/plain",text:"text/plain",conf:"text/plain",def:"text/plain",list:"text/plain",log:"text/plain",in:"text/plain",ini:"text/plain",dsc:"text/prs.lines.tag",rtx:"text/richtext",sgml:"text/sgml",sgm:"text/sgml",slim:"text/slim",slm:"text/slim",stylus:"text/stylus",styl:"text/stylus",tsv:"text/tab-separated-values",t:"text/troff",tr:"text/troff",roff:"text/troff",man:"text/troff",me:"text/troff",ms:"text/troff",ttl:"text/turtle",uri:"text/uri-list",uris:"text/uri-list",urls:"text/uri-list",vcard:"text/vcard",curl:"text/vnd.curl",dcurl:"text/vnd.curl.dcurl",mcurl:"text/vnd.curl.mcurl",scurl:"text/vnd.curl.scurl",fly:"text/vnd.fly",flx:"text/vnd.fmi.flexstor",gv:"text/vnd.graphviz","3dml":"text/vnd.in3d.3dml",spot:"text/vnd.in3d.spot",jad:"text/vnd.sun.j2me.app-descriptor",wml:"text/vnd.wap.wml",wmls:"text/vnd.wap.wmlscript",vtt:"text/vtt",s:"text/x-asm",asm:"text/x-asm",c:"text/x-c",cc:"text/x-c",cxx:"text/x-c",cpp:"text/x-c",h:"text/x-c",hh:"text/x-c",dic:"text/x-c",htc:"text/x-component",f:"text/x-fortran",for:"text/x-fortran",f77:"text/x-fortran",f90:"text/x-fortran",hbs:"text/x-handlebars-template",java:"text/x-java-source",lua:"text/x-lua",markdown:"text/x-markdown",md:"text/x-markdown",mkd:"text/x-markdown",nfo:"text/x-nfo",opml:"text/x-opml",p:"text/x-pascal",pas:"text/x-pascal",pde:"text/x-processing",sass:"text/x-sass",scss:"text/x-scss",etx:"text/x-setext",sfv:"text/x-sfv",ymp:"text/x-suse-ymp",uu:"text/x-uuencode",vcs:"text/x-vcalendar",vcf:"text/x-vcard",yaml:"text/yaml",yml:"text/yaml","3gp":"video/3gpp","3g2":"video/3gpp2",h261:"video/h261",h263:"video/h263",h264:"video/h264",jpgv:"video/jpeg",jpm:"video/jpm",jpgm:"video/jpm",mj2:"video/mj2",mjp2:"video/mj2",ts:"video/mp2t",mp4:"video/mp4",mp4v:"video/mp4",mpg4:"video/mp4",mpeg:"video/mpeg",mpg:"video/mpeg",mpe:"video/mpeg",m1v:"video/mpeg",m2v:"video/mpeg",ogv:"video/ogg",qt:"video/quicktime",mov:"video/quicktime",uvh:"video/vnd.dece.hd",uvvh:"video/vnd.dece.hd",uvm:"video/vnd.dece.mobile",uvvm:"video/vnd.dece.mobile",uvp:"video/vnd.dece.pd",uvvp:"video/vnd.dece.pd",uvs:"video/vnd.dece.sd",uvvs:"video/vnd.dece.sd",uvv:"video/vnd.dece.video",uvvv:"video/vnd.dece.video",dvb:"video/vnd.dvb.file",fvt:"video/vnd.fvt",mxu:"video/vnd.mpegurl",m4u:"video/vnd.mpegurl",pyv:"video/vnd.ms-playready.media.pyv",uvu:"video/vnd.uvvu.mp4",uvvu:"video/vnd.uvvu.mp4",viv:"video/vnd.vivo",webm:"video/webm",f4v:"video/x-f4v",fli:"video/x-fli",flv:"video/x-flv",m4v:"video/x-m4v",mkv:"video/x-matroska",mk3d:"video/x-matroska",mks:"video/x-matroska",mng:"video/x-mng",asf:"video/x-ms-asf",asx:"video/x-ms-asf",vob:"video/x-ms-vob",wm:"video/x-ms-wm",wmv:"video/x-ms-wmv",wmx:"video/x-ms-wmx",wvx:"video/x-ms-wvx",avi:"video/x-msvideo",movie:"video/x-sgi-movie",smv:"video/x-smv",ice:"x-conference/x-cooltalk"}},function(e,t){e.exports=function(e){const t=new Uint8Array(e);if(!(t&&t.length>1))return null;if(255===t[0]&&216===t[1]&&255===t[2])return{ext:"jpg",mime:"image/jpeg"};if(137===t[0]&&80===t[1]&&78===t[2]&&71===t[3])return{ext:"png",mime:"image/png"};if(71===t[0]&&73===t[1]&&70===t[2])return{ext:"gif",mime:"image/gif"};if(87===t[8]&&69===t[9]&&66===t[10]&&80===t[11])return{ext:"webp",mime:"image/webp"};if(70===t[0]&&76===t[1]&&73===t[2]&&70===t[3])return{ext:"flif",mime:"image/flif"};if((73===t[0]&&73===t[1]&&42===t[2]&&0===t[3]||77===t[0]&&77===t[1]&&0===t[2]&&42===t[3])&&67===t[8]&&82===t[9])return{ext:"cr2",mime:"image/x-canon-cr2"};if(73===t[0]&&73===t[1]&&42===t[2]&&0===t[3]||77===t[0]&&77===t[1]&&0===t[2]&&42===t[3])return{ext:"tif",mime:"image/tiff"};if(66===t[0]&&77===t[1])return{ext:"bmp",mime:"image/bmp"};if(73===t[0]&&73===t[1]&&188===t[2])return{ext:"jxr",mime:"image/vnd.ms-photo"};if(56===t[0]&&66===t[1]&&80===t[2]&&83===t[3])return{ext:"psd",mime:"image/vnd.adobe.photoshop"};if(80===t[0]&&75===t[1]&&3===t[2]&&4===t[3]&&109===t[30]&&105===t[31]&&109===t[32]&&101===t[33]&&116===t[34]&&121===t[35]&&112===t[36]&&101===t[37]&&97===t[38]&&112===t[39]&&112===t[40]&&108===t[41]&&105===t[42]&&99===t[43]&&97===t[44]&&116===t[45]&&105===t[46]&&111===t[47]&&110===t[48]&&47===t[49]&&101===t[50]&&112===t[51]&&117===t[52]&&98===t[53]&&43===t[54]&&122===t[55]&&105===t[56]&&112===t[57])return{ext:"epub",mime:"application/epub+zip"};if(80===t[0]&&75===t[1]&&3===t[2]&&4===t[3]&&77===t[30]&&69===t[31]&&84===t[32]&&65===t[33]&&45===t[34]&&73===t[35]&&78===t[36]&&70===t[37]&&47===t[38]&&109===t[39]&&111===t[40]&&122===t[41]&&105===t[42]&&108===t[43]&&108===t[44]&&97===t[45]&&46===t[46]&&114===t[47]&&115===t[48]&&97===t[49])return{ext:"xpi",mime:"application/x-xpinstall"};if(!(80!==t[0]||75!==t[1]||3!==t[2]&&5!==t[2]&&7!==t[2]||4!==t[3]&&6!==t[3]&&8!==t[3]))return{ext:"zip",mime:"application/zip"};if(117===t[257]&&115===t[258]&&116===t[259]&&97===t[260]&&114===t[261])return{ext:"tar",mime:"application/x-tar"};if(82===t[0]&&97===t[1]&&114===t[2]&&33===t[3]&&26===t[4]&&7===t[5]&&(0===t[6]||1===t[6]))return{ext:"rar",mime:"application/x-rar-compressed"};if(31===t[0]&&139===t[1]&&8===t[2])return{ext:"gz",mime:"application/gzip"};if(66===t[0]&&90===t[1]&&104===t[2])return{ext:"bz2",mime:"application/x-bzip2"};if(55===t[0]&&122===t[1]&&188===t[2]&&175===t[3]&&39===t[4]&&28===t[5])return{ext:"7z",mime:"application/x-7z-compressed"};if(120===t[0]&&1===t[1])return{ext:"dmg",mime:"application/x-apple-diskimage"};if(0===t[0]&&0===t[1]&&0===t[2]&&(24===t[3]||32===t[3])&&102===t[4]&&116===t[5]&&121===t[6]&&112===t[7]||51===t[0]&&103===t[1]&&112===t[2]&&53===t[3]||0===t[0]&&0===t[1]&&0===t[2]&&28===t[3]&&102===t[4]&&116===t[5]&&121===t[6]&&112===t[7]&&109===t[8]&&112===t[9]&&52===t[10]&&50===t[11]&&109===t[16]&&112===t[17]&&52===t[18]&&49===t[19]&&109===t[20]&&112===t[21]&&52===t[22]&&50===t[23]&&105===t[24]&&115===t[25]&&111===t[26]&&109===t[27]||0===t[0]&&0===t[1]&&0===t[2]&&28===t[3]&&102===t[4]&&116===t[5]&&121===t[6]&&112===t[7]&&105===t[8]&&115===t[9]&&111===t[10]&&109===t[11]||0===t[0]&&0===t[1]&&0===t[2]&&28===t[3]&&102===t[4]&&116===t[5]&&121===t[6]&&112===t[7]&&109===t[8]&&112===t[9]&&52===t[10]&&50===t[11]&&0===t[12]&&0===t[13]&&0===t[14]&&0===t[15])return{ext:"mp4",mime:"video/mp4"};if(0===t[0]&&0===t[1]&&0===t[2]&&28===t[3]&&102===t[4]&&116===t[5]&&121===t[6]&&112===t[7]&&77===t[8]&&52===t[9]&&86===t[10])return{ext:"m4v",mime:"video/x-m4v"};if(77===t[0]&&84===t[1]&&104===t[2]&&100===t[3])return{ext:"mid",mime:"audio/midi"};if(26===t[0]&&69===t[1]&&223===t[2]&&163===t[3]){const e=t.subarray(4,4100),i=e.findIndex((e,t,i)=>66===i[t]&&130===i[t+1]);if(i>=0){const t=i+3,n=i=>Array.from(i).every((i,n)=>e[t+n]===i.charCodeAt(0));if(n("matroska"))return{ext:"mkv",mime:"video/x-matroska"};if(n("webm"))return{ext:"webm",mime:"video/webm"}}}return 0===t[0]&&0===t[1]&&0===t[2]&&20===t[3]&&102===t[4]&&116===t[5]&&121===t[6]&&112===t[7]?{ext:"mov",mime:"video/quicktime"}:82===t[0]&&73===t[1]&&70===t[2]&&70===t[3]&&65===t[8]&&86===t[9]&&73===t[10]?{ext:"avi",mime:"video/x-msvideo"}:48===t[0]&&38===t[1]&&178===t[2]&&117===t[3]&&142===t[4]&&102===t[5]&&207===t[6]&&17===t[7]&&166===t[8]&&217===t[9]?{ext:"wmv",mime:"video/x-ms-wmv"}:0===t[0]&&0===t[1]&&1===t[2]&&"b"===t[3].toString(16)[0]?{ext:"mpg",mime:"video/mpeg"}:73===t[0]&&68===t[1]&&51===t[2]||255===t[0]&&251===t[1]?{ext:"mp3",mime:"audio/mpeg"}:102===t[4]&&116===t[5]&&121===t[6]&&112===t[7]&&77===t[8]&&52===t[9]&&65===t[10]||77===t[0]&&52===t[1]&&65===t[2]&&32===t[3]?{ext:"m4a",mime:"audio/m4a"}:79===t[28]&&112===t[29]&&117===t[30]&&115===t[31]&&72===t[32]&&101===t[33]&&97===t[34]&&100===t[35]?{ext:"opus",mime:"audio/opus"}:79===t[0]&&103===t[1]&&103===t[2]&&83===t[3]?{ext:"ogg",mime:"audio/ogg"}:102===t[0]&&76===t[1]&&97===t[2]&&67===t[3]?{ext:"flac",mime:"audio/x-flac"}:82===t[0]&&73===t[1]&&70===t[2]&&70===t[3]&&87===t[8]&&65===t[9]&&86===t[10]&&69===t[11]?{ext:"wav",mime:"audio/x-wav"}:35===t[0]&&33===t[1]&&65===t[2]&&77===t[3]&&82===t[4]&&10===t[5]?{ext:"amr",mime:"audio/amr"}:37===t[0]&&80===t[1]&&68===t[2]&&70===t[3]?{ext:"pdf",mime:"application/pdf"}:77===t[0]&&90===t[1]?{ext:"exe",mime:"application/x-msdownload"}:67!==t[0]&&70!==t[0]||87!==t[1]||83!==t[2]?123===t[0]&&92===t[1]&&114===t[2]&&116===t[3]&&102===t[4]?{ext:"rtf",mime:"application/rtf"}:119===t[0]&&79===t[1]&&70===t[2]&&70===t[3]&&(0===t[4]&&1===t[5]&&0===t[6]&&0===t[7]||79===t[4]&&84===t[5]&&84===t[6]&&79===t[7])?{ext:"woff",mime:"application/font-woff"}:119===t[0]&&79===t[1]&&70===t[2]&&50===t[3]&&(0===t[4]&&1===t[5]&&0===t[6]&&0===t[7]||79===t[4]&&84===t[5]&&84===t[6]&&79===t[7])?{ext:"woff2",mime:"application/font-woff"}:76===t[34]&&80===t[35]&&(0===t[8]&&0===t[9]&&1===t[10]||1===t[8]&&0===t[9]&&2===t[10]||2===t[8]&&0===t[9]&&2===t[10])?{ext:"eot",mime:"application/octet-stream"}:0===t[0]&&1===t[1]&&0===t[2]&&0===t[3]&&0===t[4]?{ext:"ttf",mime:"application/font-sfnt"}:79===t[0]&&84===t[1]&&84===t[2]&&79===t[3]&&0===t[4]?{ext:"otf",mime:"application/font-sfnt"}:0===t[0]&&0===t[1]&&1===t[2]&&0===t[3]?{ext:"ico",mime:"image/x-icon"}:70===t[0]&&76===t[1]&&86===t[2]&&1===t[3]?{ext:"flv",mime:"video/x-flv"}:37===t[0]&&33===t[1]?{ext:"ps",mime:"application/postscript"}:253===t[0]&&55===t[1]&&122===t[2]&&88===t[3]&&90===t[4]&&0===t[5]?{ext:"xz",mime:"application/x-xz"}:83===t[0]&&81===t[1]&&76===t[2]&&105===t[3]?{ext:"sqlite",mime:"application/x-sqlite3"}:78===t[0]&&69===t[1]&&83===t[2]&&26===t[3]?{ext:"nes",mime:"application/x-nintendo-nes-rom"}:67===t[0]&&114===t[1]&&50===t[2]&&52===t[3]?{ext:"crx",mime:"application/x-google-chrome-extension"}:77===t[0]&&83===t[1]&&67===t[2]&&70===t[3]||73===t[0]&&83===t[1]&&99===t[2]&&40===t[3]?{ext:"cab",mime:"application/vnd.ms-cab-compressed"}:33===t[0]&&60===t[1]&&97===t[2]&&114===t[3]&&99===t[4]&&104===t[5]&&62===t[6]&&10===t[7]&&100===t[8]&&101===t[9]&&98===t[10]&&105===t[11]&&97===t[12]&&110===t[13]&&45===t[14]&&98===t[15]&&105===t[16]&&110===t[17]&&97===t[18]&&114===t[19]&&121===t[20]?{ext:"deb",mime:"application/x-deb"}:33===t[0]&&60===t[1]&&97===t[2]&&114===t[3]&&99===t[4]&&104===t[5]&&62===t[6]?{ext:"ar",mime:"application/x-unix-archive"}:237===t[0]&&171===t[1]&&238===t[2]&&219===t[3]?{ext:"rpm",mime:"application/x-rpm"}:31===t[0]&&160===t[1]||31===t[0]&&157===t[1]?{ext:"Z",mime:"application/x-compress"}:76===t[0]&&90===t[1]&&73===t[2]&&80===t[3]?{ext:"lz",mime:"application/x-lzip"}:208===t[0]&&207===t[1]&&17===t[2]&&224===t[3]&&161===t[4]&&177===t[5]&&26===t[6]&&225===t[7]?{ext:"msi",mime:"application/x-msi"}:6===t[0]&&14===t[1]&&43===t[2]&&52===t[3]&&2===t[4]&&5===t[5]&&1===t[6]&&1===t[7]&&13===t[8]&&1===t[9]&&2===t[10]&&1===t[11]&&1===t[12]&&2===t[13]?{ext:"mxf",mime:"application/mxf"}:null:{ext:"swf",mime:"application/x-shockwave-flash"}}},function(e,t,i){function n(e){try{return s.lstatSync(e).isDirectory()}catch(e){return!0}}const s=i(26),r=i(19),o=i(51),a=i(9),c=i(31);class l extends c.Readable{constructor(){super(),this.statusCode=200,this.status="OK"}error(e,t){return this.statusCode=e,this.status=t,this}on(e,t){["end","open"].includes(e)&&t()}_read(){}}const h={GET:(e,t)=>{t.end=(()=>{const i=n(e)?(new l).error(404,`ENOENT: no such file or directory, open '${e}'`):s.createReadStream(e);t.res=i,i.headers={"content-length":0,"content-type":o.lookup(r.extname(e))},i.on("open",()=>{t.emit("response",i)}),i instanceof l||(i.statusCode=200,i.on("end",()=>{i.headers["content-length"]=i.bytesRead}),i.on("error",e=>{i.statusCode=400,i.status=e.message}))})},POST:(e,t)=>{const i=[];t.write=(e=>{i.push(e)}),t.end=(n=>{i.push(n);const a=s.createWriteStream(e),c=new l;t.res=c,c.headers={"content-length":0,"content-type":o.lookup(r.extname(e))},a.on("finish",()=>{t.emit("response",c)}),a.on("open",()=>{!function e(){const t=i.shift();t&&(a.write(t)?e():a.once("drain",e))}(),a.end()})})},DELETE:(e,t)=>{t.end=(()=>{const i=new l;t.res=i,i.headers={"content-length":0,"content-type":o.lookup(r.extname(e))},s.unlink(e,e=>{t.emit("response",e?i.error(400,e.message):i)})})}};class u extends a{constructor(){super(),this._headers={}}setHeader(){}}e.exports={request:function(e){const t=h[e.method];if(!t)throw new Error(`Invalid request method "${t}"`);const i=e.href.replace("file://",""),n=new u;return t(i,n,e),n}}},function(module,exports,__webpack_require__){(function(process){const os=__webpack_require__(27),EventEmitter=__webpack_require__(9).EventEmitter,Constants=__webpack_require__(0),Permissions=__webpack_require__(11),Util=__webpack_require__(4),RESTManager=__webpack_require__(53),ClientDataManager=__webpack_require__(114),ClientManager=__webpack_require__(115),ClientDataResolver=__webpack_require__(41),ClientVoiceManager=__webpack_require__(156),WebSocketManager=__webpack_require__(157),ActionsManager=__webpack_require__(158),Collection=__webpack_require__(3),Presence=__webpack_require__(15).Presence,ShardClientUtil=__webpack_require__(187),VoiceBroadcast=__webpack_require__(188);class Client extends EventEmitter{constructor(e={}){super(),!e.shardId&&"SHARD_ID"in process.env&&(e.shardId=Number(process.env.SHARD_ID)),!e.shardCount&&"SHARD_COUNT"in process.env&&(e.shardCount=Number(process.env.SHARD_COUNT)),this.options=Util.mergeDefault(Constants.DefaultOptions,e),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._timeouts=new Set,this._intervals=new Set,this.options.messageSweepInterval>0&&this.setInterval(this.sweepMessages.bind(this),1e3*this.options.messageSweepInterval)}get _pingTimestamp(){return this.ws.connection?this.ws.connection.lastPingTimestamp:0}get status(){return this.ws.connection.status}get uptime(){return this.readyAt?Date.now()-this.readyAt:null}get ping(){return this.pings.reduce((e,t)=>e+t,0)/this.pings.length}get voiceConnections(){return this.browser?new Collection:this.voice.connections}get emojis(){const e=new Collection;for(const t of this.guilds.values())for(const i of t.emojis.values())e.set(i.id,i);return e}get readyTimestamp(){return this.readyAt?this.readyAt.getTime():null}get browser(){return"browser"===os.platform()}createVoiceBroadcast(){const e=new VoiceBroadcast(this);return this.broadcasts.push(e),e}login(e){return this.rest.methods.login(e)}destroy(){for(const e of this._timeouts)clearTimeout(e);for(const e of this._intervals)clearInterval(e);return this._timeouts.clear(),this._intervals.clear(),this.manager.destroy()}syncGuilds(e=this.guilds){this.user.bot||this.ws.send({op:12,d:e instanceof Collection?e.keyArray():e.map(e=>e.id)})}fetchUser(e,t=!0){return this.users.has(e)?Promise.resolve(this.users.get(e)):this.rest.methods.getUser(e,t)}fetchInvite(e){const t=this.resolver.resolveInviteCode(e);return this.rest.methods.getInvite(t)}fetchWebhook(e,t){return this.rest.methods.getWebhook(e,t)}fetchVoiceRegions(){return this.rest.methods.fetchVoiceRegions()}sweepMessages(e=this.options.messageCacheLifetime){if("number"!=typeof e||isNaN(e))throw new TypeError("The lifetime must be a number.");if(e<=0)return this.emit("debug","Didn't sweep messages - lifetime is unlimited"),-1;const t=1e3*e,i=Date.now();let n=0,s=0;for(const e of this.channels.values())if(e.messages){n++;for(const n of e.messages.values())i-(n.editedTimestamp||n.createdTimestamp)>t&&(e.messages.delete(n.id),s++)}return this.emit("debug",`Swept ${s} messages older than ${e} seconds in ${n} text-based channels`),s}fetchApplication(e="@me"){return this.rest.methods.getApplication(e)}generateInvite(e){return e?e instanceof Array&&(e=Permissions.resolve(e)):e=0,this.fetchApplication().then(t=>`https://discordapp.com/oauth2/authorize?client_id=${t.id}&permissions=${e}&scope=bot`)}setTimeout(e,t,...i){const n=setTimeout(()=>{e(),this._timeouts.delete(n)},t,...i);return this._timeouts.add(n),n}clearTimeout(e){clearTimeout(e),this._timeouts.delete(e)}setInterval(e,t,...i){const n=setInterval(e,t,...i);return this._intervals.add(n),n}clearInterval(e){clearInterval(e),this._intervals.delete(e)}_pong(e){this.pings.unshift(Date.now()-e),this.pings.length>3&&(this.pings.length=3),this.ws.lastHeartbeatAck=!0}_setPresence(e,t){this.presences.has(e)?this.presences.get(e).update(t):this.presences.set(e,new Presence(t))}_eval(script){return eval(script)}_validateOptions(e=this.options){if("number"!=typeof e.shardCount||isNaN(e.shardCount))throw new TypeError("The shardCount option must be a number.");if("number"!=typeof e.shardId||isNaN(e.shardId))throw new TypeError("The shardId option must be a number.");if(e.shardCount<0)throw new RangeError("The shardCount option must be at least 0.");if(e.shardId<0)throw new RangeError("The shardId option must be at least 0.");if(0!==e.shardId&&e.shardId>=e.shardCount)throw new RangeError("The shardId option must be less than shardCount.");if("number"!=typeof e.messageCacheMaxSize||isNaN(e.messageCacheMaxSize))throw new TypeError("The messageCacheMaxSize option must be a number.");if("number"!=typeof e.messageCacheLifetime||isNaN(e.messageCacheLifetime))throw new TypeError("The messageCacheLifetime option must be a number.");if("number"!=typeof e.messageSweepInterval||isNaN(e.messageSweepInterval))throw new TypeError("The messageSweepInterval option must be a number.");if("boolean"!=typeof e.fetchAllMembers)throw new TypeError("The fetchAllMembers option must be a boolean.");if("boolean"!=typeof e.disableEveryone)throw new TypeError("The disableEveryone option must be a boolean.");if("number"!=typeof e.restWsBridgeTimeout||isNaN(e.restWsBridgeTimeout))throw new TypeError("The restWsBridgeTimeout option must be a number.");if(!(e.disabledEvents instanceof Array))throw new TypeError("The disabledEvents option must be an Array.")}}module.exports=Client}).call(exports,__webpack_require__(7))},function(e,t){e.exports=function(e){return e&&"object"==typeof e&&"function"==typeof e.copy&&"function"==typeof e.fill&&"function"==typeof e.readUInt8}},function(e,t){"function"==typeof Object.create?e.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(e,t){e.super_=t;var i=function(){};i.prototype=t.prototype,e.prototype=new i,e.prototype.constructor=e}},function(e,t,i){(function(t){const n=i(0);class s{constructor(){this.build(this.constructor.DEFAULT)}set({url:e,version:t}={}){this.build({url:e||this.constructor.DFEAULT.url,version:t||this.constructor.DEFAULT.version})}build(e){this.userAgent=`DiscordBot (${e.url}, ${e.version}) Node.js/${t.version}`}}s.DEFAULT={url:n.Package.homepage.split("#")[0],version:n.Package.version},e.exports=s}).call(t,i(7))},function(e,t,i){const n=i(34),s=i(35),r=i(11),o=i(0),a=o.Endpoints,c=i(3),l=i(8),h=i(4),u=i(13),d=i(24),p=i(22),m=i(14),f=i(60),g=i(38),v=i(108),b=i(39),E=i(16),y=i(40),w=i(28),_=i(110),x=i(63);class R{constructor(e){this.rest=e,this.client=e.client,this._ackToken=null}login(e=this.client.token){return new Promise((t,i)=>{if("string"!=typeof e)throw new Error(o.Errors.INVALID_TOKEN);e=e.replace(/^Bot\s*/i,""),this.client.manager.connectToWebSocket(e,t,i)})}logout(){return this.rest.makeRequest("post",a.logout,!0,{})}getGateway(e=!1){return this.rest.makeRequest("get",e?a.gateway.bot:a.gateway,!0)}fetchVoiceRegions(e){let t;return t=e?a.Guild(e).voiceRegions:a.voiceRegions,this.rest.makeRequest("get",t,!0).then(e=>{const t=new c;for(const i of e)t.set(i.id,new _(i));return t})}sendMessage(e,t,{tts:i,nonce:n,embed:s,disableEveryone:r,split:o,code:c,reply:l}={},p=null){return new Promise((m,f)=>{if(void 0!==t&&(t=this.client.resolver.resolveString(t)),void 0!==n&&(n=parseInt(n),isNaN(n)||n<0))throw new RangeError("Message nonce must fit in an unsigned 64-bit integer.");if(t){if(o&&"object"!=typeof o&&(o={}),void 0===c||"boolean"==typeof c&&!0!==c||(t=h.escapeMarkdown(this.client.resolver.resolveString(t),!0),t=`\`\`\`${"boolean"!=typeof c?c||"":""}\n${t}\n\`\`\``,o&&(o.prepend=`\`\`\`${"boolean"!=typeof c?c||"":""}\n`,o.append="\n```")),(r||void 0===r&&this.client.options.disableEveryone)&&(t=t.replace(/@(everyone|here)/g,"@​$1")),l&&!(e instanceof u||e instanceof d)&&"dm"!==e.type){const e=this.client.resolver.resolveUserID(l),i=`<@${l instanceof d&&l.nickname?"!":""}${e}>`;t=`${i}${t?`, ${t}`:""}`,o&&(o.prepend=`${i}, ${o.prepend||""}`)}o&&(t=h.splitMessage(t,o))}else if(l&&!(e instanceof u||e instanceof d)&&"dm"!==e.type){const e=this.client.resolver.resolveUserID(l);t=`<@${l instanceof d&&l.nickname?"!":""}${e}>`}const g=e=>{if(t instanceof Array){const n=[];!function t(r,o){const a=o===r.length?{tts:i,embed:s}:{tts:i};e.send(r[o],a,o===r.length?p:null).then(e=>(n.push(e),o>=r.length-1?m(n):t(r,++o)))}(t,0)}else this.rest.makeRequest("post",a.Channel(e).messages,!0,{content:t,tts:i,nonce:n,embed:s},p).then(e=>m(this.client.actions.MessageCreate.handle(e).message),f)};e instanceof u||e instanceof d?this.createDM(e).then(g,f):g(e)})}updateMessage(e,t,{embed:i,code:n,reply:s}={}){if(void 0!==t&&(t=this.client.resolver.resolveString(t)),void 0===n||"boolean"==typeof n&&!0!==n||(t=h.escapeMarkdown(this.client.resolver.resolveString(t),!0),t=`\`\`\`${"boolean"!=typeof n?n||"":""}\n${t}\n\`\`\``),s&&"dm"!==e.channel.type){const e=this.client.resolver.resolveUserID(s);t=`${`<@${s instanceof d&&s.nickname?"!":""}${e}>`}${t?`, ${t}`:""}`}return this.rest.makeRequest("patch",a.Message(e),!0,{content:t,embed:i}).then(e=>this.client.actions.MessageUpdate.handle(e).updated)}deleteMessage(e){return this.rest.makeRequest("delete",a.Message(e),!0).then(()=>this.client.actions.MessageDelete.handle({id:e.id,channel_id:e.channel.id}).message)}ackMessage(e){return this.rest.makeRequest("post",a.Message(e).ack,!0,{token:this._ackToken}).then(t=>(t.token&&(this._ackToken=t.token),e))}ackTextChannel(e){return this.rest.makeRequest("post",a.Channel(e).Message(e.lastMessageID).ack,!0,{token:this._ackToken}).then(t=>(t.token&&(this._ackToken=t.token),e))}ackGuild(e){return this.rest.makeRequest("post",a.Guild(e).ack,!0).then(()=>e)}bulkDeleteMessages(e,t,i){return i&&(t=t.filter(e=>Date.now()-l.deconstruct(e).date.getTime()<12096e5)),this.rest.makeRequest("post",a.Channel(e).messages.bulkDelete,!0,{messages:t}).then(()=>this.client.actions.MessageDeleteBulk.handle({channel_id:e.id,ids:t}).messages)}search(e,t){if("string"==typeof t&&(t={content:t}),t.before&&(t.before instanceof Date||(t.before=new Date(t.before)),t.maxID=s.fromNumber(t.before.getTime()-14200704e5).shiftLeft(22).toString()),t.after&&(t.after instanceof Date||(t.after=new Date(t.after)),t.minID=s.fromNumber(t.after.getTime()-14200704e5).shiftLeft(22).toString()),t.during){t.during instanceof Date||(t.during=new Date(t.during));const e=t.during.getTime()-14200704e5;t.minID=s.fromNumber(e).shiftLeft(22).toString(),t.maxID=s.fromNumber(e+864e5).shiftLeft(22).toString()}t.channel&&(t.channel=this.client.resolver.resolveChannelID(t.channel)),t.author&&(t.author=this.client.resolver.resolveUserID(t.author)),t.mentions&&(t.mentions=this.client.resolver.resolveUserID(t.options.mentions)),t={content:t.content,max_id:t.maxID,min_id:t.minID,has:t.has,channel_id:t.channel,author_id:t.author,author_type:t.authorType,context_size:t.contextSize,sort_by:t.sortBy,sort_order:t.sortOrder,limit:t.limit,offset:t.offset,mentions:t.mentions,mentions_everyone:t.mentionsEveryone,link_hostname:t.linkHostname,embed_provider:t.embedProvider,embed_type:t.embedType,attachment_filename:t.attachmentFilename,attachment_extension:t.attachmentExtension};for(const e in t)void 0===t[e]&&delete t[e];const i=(n.stringify(t).match(/[^=&?]+=[^=&?]+/g)||[]).join("&");let r;if(e instanceof E)r=a.Channel(e).search;else{if(!(e instanceof w))throw new TypeError("Target must be a TextChannel, DMChannel, GroupDMChannel, or Guild.");r=a.Guild(e).search}return this.rest.makeRequest("get",`${r}?${i}`,!0).then(e=>{const t=e.messages.map(e=>e.map(e=>new p(this.client.channels.get(e.channel_id),e,this.client)));return{totalResults:e.total_results,messages:t}})}createChannel(e,t,i,n){return n instanceof c&&(n=n.array()),this.rest.makeRequest("post",a.Guild(e).channels,!0,{name:t,type:i,permission_overwrites:n}).then(e=>this.client.actions.ChannelCreate.handle(e).channel)}createDM(e){const t=this.getExistingDM(e);return t?Promise.resolve(t):this.rest.makeRequest("post",a.User(this.client.user).channels,!0,{recipient_id:e.id}).then(e=>this.client.actions.ChannelCreate.handle(e).channel)}createGroupDM(e){const t=this.client.user.bot?{access_tokens:e.accessTokens,nicks:e.nicks}:{recipients:e.recipients};return this.rest.makeRequest("post",a.User("@me").channels,!0,t).then(e=>new y(this.client,e))}addUserToGroupDM(e,t){const i=this.client.user.bot?{nick:t.nick,access_token:t.accessToken}:{recipient:t.id};return this.rest.makeRequest("put",a.Channel(e).Recipient(t.id),!0,i).then(()=>e)}getExistingDM(e){return this.client.channels.find(t=>t.recipient&&t.recipient.id===e.id)}deleteChannel(e){return(e instanceof u||e instanceof d)&&(e=this.getExistingDM(e)),e?this.rest.makeRequest("delete",a.Channel(e),!0).then(t=>(t.id=e.id,this.client.actions.ChannelDelete.handle(t).channel)):Promise.reject(new Error("No channel to delete."))}updateChannel(e,t){const i={};return i.name=(t.name||e.name).trim(),i.topic=t.topic||e.topic,i.position=t.position||e.position,i.bitrate=t.bitrate||e.bitrate,i.user_limit=t.userLimit||e.userLimit,this.rest.makeRequest("patch",a.Channel(e),!0,i).then(e=>this.client.actions.ChannelUpdate.handle(e).updated)}leaveGuild(e){return e.ownerID===this.client.user.id?Promise.reject(new Error("Guild is owned by the client.")):this.rest.makeRequest("delete",a.User("@me").Guild(e.id),!0).then(()=>this.client.actions.GuildDelete.handle({id:e.id}).guild)}createGuild(e){return e.icon=this.client.resolver.resolveBase64(e.icon)||null,e.region=e.region||"us-central",new Promise((t,i)=>{this.rest.makeRequest("post",a.guilds,!0,e).then(e=>{if(this.client.guilds.has(e.id))return t(this.client.guilds.get(e.id));const n=i=>{i.id===e.id&&(this.client.removeListener(o.Events.GUILD_CREATE,n),this.client.clearTimeout(s),t(i))};this.client.on(o.Events.GUILD_CREATE,n);const s=this.client.setTimeout(()=>{this.client.removeListener(o.Events.GUILD_CREATE,n),i(new Error("Took too long to receive guild data."))},1e4)},i)})}deleteGuild(e){return this.rest.makeRequest("delete",a.Guild(e),!0).then(()=>this.client.actions.GuildDelete.handle({id:e.id}).guild)}getUser(e,t){return this.rest.makeRequest("get",a.User(e),!0).then(e=>t?this.client.actions.UserGet.handle(e).user:new u(this.client,e))}updateCurrentUser(e,t){const i=this.client.user,n={};return n.username=e.username||i.username,n.avatar=this.client.resolver.resolveBase64(e.avatar)||i.avatar,i.bot||(n.email=e.email||i.email,n.password=t,e.new_password&&(n.new_password=e.newPassword)),this.rest.makeRequest("patch",a.User("@me"),!0,n).then(e=>this.client.actions.UserUpdate.handle(e).updated)}updateGuild(e,t){const i={};return t.name&&(i.name=t.name),t.region&&(i.region=t.region),t.verificationLevel&&(i.verification_level=Number(t.verificationLevel)),t.afkChannel&&(i.afk_channel_id=this.client.resolver.resolveChannel(t.afkChannel).id),t.afkTimeout&&(i.afk_timeout=Number(t.afkTimeout)),t.icon&&(i.icon=this.client.resolver.resolveBase64(t.icon)),t.owner&&(i.owner_id=this.client.resolver.resolveUser(t.owner).id),t.splash&&(i.splash=this.client.resolver.resolveBase64(t.splash)),this.rest.makeRequest("patch",a.Guild(e),!0,i).then(e=>this.client.actions.GuildUpdate.handle(e).updated)}kickGuildMember(e,t,i){const n=`${a.Guild(e).Member(t)}?reason=${i}`;return this.rest.makeRequest("delete",n,!0).then(()=>this.client.actions.GuildMemberRemove.handle({guild_id:e.id,user:t.user}).member)}createGuildRole(e,t){return t.color&&(t.color=this.client.resolver.resolveColor(t.color)),t.permissions&&(t.permissions=r.resolve(t.permissions)),this.rest.makeRequest("post",a.Guild(e).roles,!0,t).then(t=>this.client.actions.GuildRoleCreate.handle({guild_id:e.id,role:t}).role)}deleteGuildRole(e){return this.rest.makeRequest("delete",a.Guild(e.guild).Role(e.id),!0).then(()=>this.client.actions.GuildRoleDelete.handle({guild_id:e.guild.id,role_id:e.id}).role)}setChannelOverwrite(e,t){return this.rest.makeRequest("put",`${a.Channel(e).permissions}/${t.id}`,!0,t)}deletePermissionOverwrites(e){return this.rest.makeRequest("delete",`${a.Channel(e.channel).permissions}/${e.id}`,!0).then(()=>e)}getChannelMessages(e,t={}){const i=[];t.limit&&i.push(`limit=${t.limit}`),t.around?i.push(`around=${t.around}`):t.before?i.push(`before=${t.before}`):t.after&&i.push(`after=${t.after}`);let n=a.Channel(e).messages;return i.length>0&&(n+=`?${i.join("&")}`),this.rest.makeRequest("get",n,!0)}getChannelMessage(e,t){const i=e.messages.get(t);return i?Promise.resolve(i):this.rest.makeRequest("get",a.Channel(e).Message(t),!0)}putGuildMember(e,t,i){if(i.access_token=i.accessToken,i.roles){const e=i.roles;(e instanceof c||e instanceof Array&&e[0]instanceof m)&&(i.roles=e.map(e=>e.id))}return this.rest.makeRequest("put",a.Guild(e).Member(t.id),!0,i).then(t=>this.client.actions.GuildMemberGet.handle(e,t).member)}getGuildMember(e,t,i){return this.rest.makeRequest("get",a.Guild(e).Member(t.id),!0).then(t=>i?this.client.actions.GuildMemberGet.handle(e,t).member:new d(e,t))}updateGuildMember(e,t){t.channel&&(t.channel_id=this.client.resolver.resolveChannel(t.channel).id),t.roles&&(t.roles=t.roles.map(e=>e instanceof m?e.id:e));let i=a.Member(e);if(e.id===this.client.user.id){const n=Object.keys(t);1===n.length&&"nick"===n[0]&&(i=a.Member(e).nickname)}return this.rest.makeRequest("patch",i,!0,t).then(t=>e.guild._updateMember(e,t).mem)}addMemberRole(e,t){return new Promise((i,n)=>{if(e._roles.includes(t.id))return i(e);const s=(e,n)=>{!e._roles.includes(t.id)&&n._roles.includes(t.id)&&(this.client.removeListener(o.Events.GUILD_MEMBER_UPDATE,s),i(n))};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",a.Member(e).Role(t.id),!0).catch(e=>{this.client.removeListener(o.Events.GUILD_BAN_REMOVE,s),this.client.clearTimeout(r),n(e)})})}removeMemberRole(e,t){return new Promise((i,n)=>{if(!e._roles.includes(t.id))return i(e);const s=(e,n)=>{e._roles.includes(t.id)&&!n._roles.includes(t.id)&&(this.client.removeListener(o.Events.GUILD_MEMBER_UPDATE,s),i(n))};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",a.Member(e).Role(t.id),!0).catch(e=>{this.client.removeListener(o.Events.GUILD_BAN_REMOVE,s),this.client.clearTimeout(r),n(e)})})}sendTyping(e){return this.rest.makeRequest("post",a.Channel(e).typing,!0)}banGuildMember(e,t,i){const s=this.client.resolver.resolveUserID(t);if(!s)return Promise.reject(new Error("Couldn't resolve the user ID to ban."));const r=`${a.Guild(e).bans}/${s}?${n.stringify(i)}`;return this.rest.makeRequest("put",r,!0).then(()=>{if(t instanceof d)return t;const i=this.client.resolver.resolveUser(s);return i?(t=this.client.resolver.resolveGuildMember(e,i))||i:s})}unbanGuildMember(e,t){return new Promise((i,n)=>{const s=this.client.resolver.resolveUserID(t);if(!s)throw new Error("Couldn't resolve the user ID to unban.");const r=(t,n)=>{t.id===e.id&&n.id===s&&(this.client.removeListener(o.Events.GUILD_BAN_REMOVE,r),this.client.clearTimeout(c),i(n))};this.client.on(o.Events.GUILD_BAN_REMOVE,r);const c=this.client.setTimeout(()=>{this.client.removeListener(o.Events.GUILD_BAN_REMOVE,r),n(new Error("Took too long to receive the ban remove event."))},1e4);this.rest.makeRequest("delete",`${a.Guild(e).bans}/${s}`,!0).catch(e=>{this.client.removeListener(o.Events.GUILD_BAN_REMOVE,r),this.client.clearTimeout(c),n(e)})})}getGuildBans(e){return this.rest.makeRequest("get",a.Guild(e).bans,!0).then(e=>e.reduce((e,t)=>(e.set(t.user.id,{reason:t.reason,user:this.client.dataManager.newUser(t.user)}),e),new c))}updateGuildRole(e,t){const i={};return i.name=t.name||e.name,i.position=void 0!==t.position?t.position:e.position,i.color=this.client.resolver.resolveColor(t.color||e.color),i.hoist=void 0!==t.hoist?t.hoist:e.hoist,i.mentionable=void 0!==t.mentionable?t.mentionable:e.mentionable,t.permissions?i.permissions=r.resolve(t.permissions):i.permissions=e.permissions,this.rest.makeRequest("patch",a.Guild(e.guild).Role(e.id),!0,i).then(t=>this.client.actions.GuildRoleUpdate.handle({role:t,guild_id:e.guild.id}).updated)}pinMessage(e){return this.rest.makeRequest("put",a.Channel(e.channel).Pin(e.id),!0).then(()=>e)}unpinMessage(e){return this.rest.makeRequest("delete",a.Channel(e.channel).Pin(e.id),!0).then(()=>e)}getChannelPinnedMessages(e){return this.rest.makeRequest("get",a.Channel(e).pins,!0)}createChannelInvite(e,t){const i={};return i.temporary=t.temporary,i.max_age=t.maxAge,i.max_uses=t.maxUses,this.rest.makeRequest("post",a.Channel(e).invites,!0,i).then(e=>new f(this.client,e))}deleteInvite(e){return this.rest.makeRequest("delete",a.Invite(e.code),!0).then(()=>e)}getInvite(e){return this.rest.makeRequest("get",a.Invite(e),!0).then(e=>new f(this.client,e))}getGuildInvites(e){return this.rest.makeRequest("get",a.Guild(e).invites,!0).then(e=>{const t=new c;for(const i of e){const e=new f(this.client,i);t.set(e.code,e)}return t})}pruneGuildMembers(e,t,i){return this.rest.makeRequest(i?"get":"post",`${a.Guild(e).prune}?days=${t}`,!0).then(e=>e.pruned)}createEmoji(e,t,i,n){const s={image:t,name:i};return n&&(s.roles=n.map(e=>e.id?e.id:e)),this.rest.makeRequest("post",a.Guild(e).emojis,!0,s).then(t=>this.client.actions.GuildEmojiCreate.handle(e,t).emoji)}updateEmoji(e,t){const i={};return t.name&&(i.name=t.name),t.roles&&(i.roles=t.roles.map(e=>e.id?e.id:e)),this.rest.makeRequest("patch",a.Guild(e.guild).Emoji(e.id),!0,i).then(t=>this.client.actions.GuildEmojiUpdate.handle(e,t).emoji)}deleteEmoji(e){return this.rest.makeRequest("delete",a.Guild(e.guild).Emoji(e.id),!0).then(()=>this.client.actions.GuildEmojiDelete.handle(e).data)}getGuildAuditLogs(e,t={}){t.before&&t.before instanceof x.Entry&&(t.before=t.before.id),t.after&&t.after instanceof x.Entry&&(t.after=t.after.id),"string"==typeof t.type&&(t.type=x.Actions[t.type]);const i=(n.stringify({before:t.before,after:t.after,limit:t.limit,user_id:this.client.resolver.resolveUserID(t.user),action_type:t.type}).match(/[^=&?]+=[^=&?]+/g)||[]).join("&");return this.rest.makeRequest("get",`${a.Guild(e).auditLogs}?${i}`,!0).then(t=>x.build(e,t))}getWebhook(e,t){return this.rest.makeRequest("get",a.Webhook(e,t),!t).then(e=>new g(this.client,e))}getGuildWebhooks(e){return this.rest.makeRequest("get",a.Guild(e).webhooks,!0).then(e=>{const t=new c;for(const i of e)t.set(i.id,new g(this.client,i));return t})}getChannelWebhooks(e){return this.rest.makeRequest("get",a.Channel(e).webhooks,!0).then(e=>{const t=new c;for(const i of e)t.set(i.id,new g(this.client,i));return t})}createWebhook(e,t,i){return this.rest.makeRequest("post",a.Channel(e).webhooks,!0,{name:t,avatar:i}).then(e=>new g(this.client,e))}editWebhook(e,t,i){return this.rest.makeRequest("patch",a.Webhook(e.id,e.token),!1,{name:t,avatar:i}).then(t=>(e.name=t.name,e.avatar=t.avatar,e))}deleteWebhook(e){return this.rest.makeRequest("delete",a.Webhook(e.id,e.token),!1)}sendWebhookMessage(e,t,{avatarURL:i,tts:n,disableEveryone:s,embeds:r,username:o}={},c=null){return o=o||e.name,void 0!==t&&(t=this.client.resolver.resolveString(t)),t&&(s||void 0===s&&this.client.options.disableEveryone)&&(t=t.replace(/@(everyone|here)/g,"@​$1")),this.rest.makeRequest("post",`${a.Webhook(e.id,e.token)}?wait=true`,!1,{username:o,avatar_url:i,content:t,tts:n,embeds:r},c)}sendSlackWebhookMessage(e,t){return this.rest.makeRequest("post",`${a.Webhook(e.id,e.token)}/slack?wait=true`,!1,t)}fetchUserProfile(e){return this.rest.makeRequest("get",a.User(e).profile,!0).then(t=>new v(e,t))}fetchMeMentions(e){return e.guild&&(e.guild=e.guild.id?e.guild.id:e.guild),this.rest.makeRequest("get",a.User("@me").mentions(e.limit,e.roles,e.everyone,e.guild)).then(e=>e.body.map(e=>new p(this.client.channels.get(e.channel_id),e,this.client)))}addFriend(e){return this.rest.makeRequest("post",a.User("@me"),!0,{username:e.username,discriminator:e.discriminator}).then(()=>e)}removeFriend(e){return this.rest.makeRequest("delete",a.User("@me").Relationship(e.id),!0).then(()=>e)}blockUser(e){return this.rest.makeRequest("put",a.User("@me").Relationship(e.id),!0,{type:2}).then(()=>e)}unblockUser(e){return this.rest.makeRequest("delete",a.User("@me").Relationship(e.id),!0).then(()=>e)}updateChannelPositions(e,t){const i=new Array(t.length);for(let e=0;ethis.client.actions.GuildChannelsPositionUpdate.handle({guild_id:e,channels:t}).guild)}setRolePositions(e,t){return this.rest.makeRequest("patch",a.Guild(e).roles,!0,t).then(()=>this.client.actions.GuildRolesPositionUpdate.handle({guild_id:e,roles:t}).guild)}setChannelPositions(e,t){return this.rest.makeRequest("patch",a.Guild(e).channels,!0,t).then(()=>this.client.actions.GuildChannelsPositionUpdate.handle({guild_id:e,channels:t}).guild)}addMessageReaction(e,t){return this.rest.makeRequest("put",a.Message(e).Reaction(t).User("@me"),!0).then(()=>e._addReaction(h.parseEmoji(t),e.client.user))}removeMessageReaction(e,t,i){const n=a.Message(e).Reaction(t).User(i===this.client.user.id?"@me":i);return this.rest.makeRequest("delete",n,!0).then(()=>this.client.actions.MessageReactionRemove.handle({user_id:i,message_id:e.id,emoji:h.parseEmoji(t),channel_id:e.channel.id}).reaction)}removeMessageReactions(e){return this.rest.makeRequest("delete",a.Message(e).reactions,!0).then(()=>e)}getMessageReactionUsers(e,t,i=100){return this.rest.makeRequest("get",a.Message(e).Reaction(t,i),!0)}getApplication(e){return this.rest.makeRequest("get",a.OAUTH2.Application(e),!0).then(e=>new b(this.client,e))}resetApplication(e){return this.rest.makeRequest("post",a.OAUTH2.Application(e).reset,!0).then(e=>new b(this.client,e))}setNote(e,t){return this.rest.makeRequest("put",a.User(e).note,!0,{note:t}).then(()=>e)}acceptInvite(e){return e.id&&(e=e.id),new Promise((t,i)=>this.rest.makeRequest("post",a.Invite(e),!0).then(e=>{const n=i=>{i.id===e.id&&(t(i),this.client.removeListener(o.Events.GUILD_CREATE,n))};this.client.on(o.Events.GUILD_CREATE,n),this.client.setTimeout(()=>{this.client.removeListener(o.Events.GUILD_CREATE,n),i(new Error("Accepting invite timed out"))},12e4)}))}patchUserSettings(e){return this.rest.makeRequest("patch",o.Endpoints.User("@me").settings,!0,e)}}e.exports=R},function(e,t,i){const n=i(3),s=i(109);class r{constructor(e,t){this.user=e,Object.defineProperty(this,"client",{value:e.client}),this.mutualGuilds=new n,this.connections=new n,this.setup(t)}setup(e){this.premium=e.premium,this.premiumSince=e.premium_since?new Date(e.premium_since):null;for(const t of e.mutual_guilds)this.client.guilds.has(t.id)&&this.mutualGuilds.set(t.id,this.client.guilds.get(t.id));for(const t of e.connected_accounts)this.connections.set(t.id,new s(this.user,t))}}e.exports=r},function(e,t){class i{constructor(e,t){this.user=e,this.setup(t)}setup(e){this.type=e.type,this.name=e.name,this.id=e.id,this.revoked=e.revoked,this.integrations=e.integrations}}e.exports=i},function(e,t){class i{constructor(e){this.id=e.id,this.name=e.name,this.vip=e.vip,this.deprecated=e.deprecated,this.optimal=e.optimal,this.custom=e.custom,this.sampleHostname=e.sample_hostname}}e.exports=i},function(e,t,i){const n=i(64),s=i(65);class r extends n{constructor(e,t){super(e,t),this.endpoint=t,this.timeDifference=0,this.busy=!1}push(e){super.push(e),this.handle()}execute(e){return this.busy=!0,new Promise(t=>{e.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(e),this.restManager.client.setTimeout(()=>{this.globalLimit=!1,t()},Number(n.headers["retry-after"])+this.restManager.client.options.restTimeOffset),n.headers["x-ratelimit-global"]&&(this.globalLimit=!0)):(e.reject(i.status>=400&&i.status<500?new s(n.body):i),t(i));else{this.globalLimit=!1;const i=n&&n.body?n.body:{};e.resolve(i),0===this.requestRemaining?this.restManager.client.setTimeout(()=>t(i),this.requestResetTime-Date.now()+this.timeDifference+this.restManager.client.options.restTimeOffset):t(i)}})})}handle(){super.handle(),this.busy||0===this.remaining||0===this.queue.length||this.globalLimit||this.execute(this.queue.shift()).then(()=>{this.busy=!1,this.handle()})}}e.exports=r},function(e,t,i){const n=i(64),s=i(65);class r extends n{constructor(e,t){super(e,t),this.client=e.client,this.limit=1/0,this.resetTime=null,this.remaining=1,this.timeDifference=0,this.resetTimeout=null}push(e){super.push(e),this.handle()}execute(e){e&&e.request.gen().end((t,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()),t)if(429===t.status){if(this.queue.unshift(e),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 e.reject(400===t.status?new s(i.body):t),this.handle();else{this.globalLimit=!1;const t=i&&i.body?i.body:{};e.resolve(t),this.handle()}})}handle(){super.handle(),this.remaining<=0||0===this.queue.length||this.globalLimit||(this.execute(this.queue.shift()),this.remaining--,this.handle())}}e.exports=r},function(e,t,i){const n=i(30),s=i(0);class r{constructor(e,t,i,n,s,r){this.rest=e,this.client=e.client,this.method=t,this.path=i.toString(),this.auth=n,this.data=s,this.files=r,this.route=this.getRoute(this.path)}getRoute(e){let t=e.split("?")[0];if(t.includes("/channels/")||t.includes("/guilds/")){const e=t.includes("/channels/")?t.indexOf("/channels/"):t.indexOf("/guilds/"),i=t.substring(e).split("/")[2];t=t.replace(/(\d{8,})/g,":id").replace(":id",i)}return t}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 e=`${this.client.options.http.host}/api/v${this.client.options.http.version}`,t=n[this.method](`${e}${this.path}`);if(this.auth&&t.set("Authorization",this.getAuth()),this.rest.client.browser||t.set("User-Agent",this.rest.userAgentManager.userAgent),this.files){for(const e of this.files)e&&e.file&&t.attach(e.name,e.file,e.name);void 0!==this.data&&t.attach("payload_json",JSON.stringify(this.data))}else this.data&&t.send(this.data);return t}}e.exports=r},function(e,t,i){const n=i(0),s=i(4),r=i(28),o=i(13),a=i(66),c=i(23),l=i(67),h=i(69),u=i(29),d=i(40);class p{constructor(e){this.client=e}get pastReady(){return this.client.ws.connection.status===n.Status.READY}newGuild(e){const t=this.client.guilds.has(e.id),i=new r(this.client,e);return this.client.guilds.set(i.id,i),this.pastReady&&!t&&(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(e){if(this.client.users.has(e.id))return this.client.users.get(e.id);const t=new o(this.client,e);return this.client.users.set(t.id,t),t}newChannel(e,t){const i=this.client.channels.has(e.id);let s;return e.type===n.ChannelTypes.DM?s=new a(this.client,e):e.type===n.ChannelTypes.GROUP_DM?s=new d(this.client,e):(t=t||this.client.guilds.get(e.guild_id))&&(e.type===n.ChannelTypes.TEXT?(s=new l(t,e),t.channels.set(s.id,s)):e.type===n.ChannelTypes.VOICE&&(s=new h(t,e),t.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(e,t){const i=t.emojis.has(e.id);if(e&&!i){let i=new c(t,e);return this.client.emit(n.Events.GUILD_EMOJI_CREATE,i),t.emojis.set(i.id,i),i}return i?t.emojis.get(e.id):null}killEmoji(e){e instanceof c&&e.guild&&(this.client.emit(n.Events.GUILD_EMOJI_DELETE,e),e.guild.emojis.delete(e.id))}killGuild(e){const t=this.client.guilds.has(e.id);this.client.guilds.delete(e.id),t&&this.pastReady&&this.client.emit(n.Events.GUILD_DELETE,e)}killUser(e){this.client.users.delete(e.id)}killChannel(e){this.client.channels.delete(e.id),e instanceof u&&e.guild.channels.delete(e.id)}updateGuild(e,t){const i=s.cloneObject(e);e.setup(t),this.pastReady&&this.client.emit(n.Events.GUILD_UPDATE,i,e)}updateChannel(e,t){e.setup(t)}updateEmoji(e,t){const i=s.cloneObject(e);return e.setup(t),this.client.emit(n.Events.GUILD_EMOJI_UPDATE,i,e),e}}e.exports=p},function(e,t,i){const n=i(0),s=i(70);class r{constructor(e){this.client=e,this.heartbeatInterval=null}get status(){return this.connection?this.connection.status:n.Status.IDLE}connectToWebSocket(e,t,i){this.client.emit(n.Events.DEBUG,`Authenticated using token ${e}`),this.client.token=e;const r=this.client.setTimeout(()=>i(new Error(n.Errors.TOOK_TOO_LONG)),3e5);this.client.rest.methods.getGateway().then(o=>{const a=n.DefaultOptions.ws.version,c=`${o.url}/?v=${a}&encoding=${s.ENCODING}`;this.client.emit(n.Events.DEBUG,`Using gateway ${c}`),this.client.ws.connect(c),this.client.ws.once("close",e=>{4004===e.code&&i(new Error(n.Errors.BAD_LOGIN)),4010===e.code&&i(new Error(n.Errors.INVALID_SHARD)),4011===e.code&&i(new Error(n.Errors.SHARDING_REQUIRED))}),this.client.once(n.Events.READY,()=>{t(e),this.client.clearTimeout(r)})},i)}destroy(){return this.client.ws.destroy(),this.client.rest.destroy(),this.client.user?this.client.user.bot?(this.client.token=null,Promise.resolve()):this.client.rest.methods.logout().then(()=>{this.client.token=null}):Promise.resolve()}}e.exports=r},function(e,t,i){const n=i(0),s=[n.WSEvents.READY,n.WSEvents.RESUMED,n.WSEvents.GUILD_CREATE,n.WSEvents.GUILD_DELETE,n.WSEvents.GUILD_MEMBERS_CHUNK,n.WSEvents.GUILD_MEMBER_ADD,n.WSEvents.GUILD_MEMBER_REMOVE];class r{constructor(e){this.ws=e,this.handlers={},this.queue=[],this.register(n.WSEvents.READY,i(117)),this.register(n.WSEvents.RESUMED,i(118)),this.register(n.WSEvents.GUILD_CREATE,i(119)),this.register(n.WSEvents.GUILD_DELETE,i(120)),this.register(n.WSEvents.GUILD_UPDATE,i(121)),this.register(n.WSEvents.GUILD_BAN_ADD,i(122)),this.register(n.WSEvents.GUILD_BAN_REMOVE,i(123)),this.register(n.WSEvents.GUILD_MEMBER_ADD,i(124)),this.register(n.WSEvents.GUILD_MEMBER_REMOVE,i(125)),this.register(n.WSEvents.GUILD_MEMBER_UPDATE,i(126)),this.register(n.WSEvents.GUILD_ROLE_CREATE,i(127)),this.register(n.WSEvents.GUILD_ROLE_DELETE,i(128)),this.register(n.WSEvents.GUILD_ROLE_UPDATE,i(129)),this.register(n.WSEvents.GUILD_EMOJIS_UPDATE,i(130)),this.register(n.WSEvents.GUILD_MEMBERS_CHUNK,i(131)),this.register(n.WSEvents.CHANNEL_CREATE,i(132)),this.register(n.WSEvents.CHANNEL_DELETE,i(133)),this.register(n.WSEvents.CHANNEL_UPDATE,i(134)),this.register(n.WSEvents.CHANNEL_PINS_UPDATE,i(135)),this.register(n.WSEvents.PRESENCE_UPDATE,i(136)),this.register(n.WSEvents.USER_UPDATE,i(137)),this.register(n.WSEvents.USER_NOTE_UPDATE,i(138)),this.register(n.WSEvents.USER_SETTINGS_UPDATE,i(139)),this.register(n.WSEvents.VOICE_STATE_UPDATE,i(140)),this.register(n.WSEvents.TYPING_START,i(141)),this.register(n.WSEvents.MESSAGE_CREATE,i(142)),this.register(n.WSEvents.MESSAGE_DELETE,i(143)),this.register(n.WSEvents.MESSAGE_UPDATE,i(144)),this.register(n.WSEvents.MESSAGE_DELETE_BULK,i(145)),this.register(n.WSEvents.VOICE_SERVER_UPDATE,i(146)),this.register(n.WSEvents.GUILD_SYNC,i(147)),this.register(n.WSEvents.RELATIONSHIP_ADD,i(148)),this.register(n.WSEvents.RELATIONSHIP_REMOVE,i(149)),this.register(n.WSEvents.MESSAGE_REACTION_ADD,i(150)),this.register(n.WSEvents.MESSAGE_REACTION_REMOVE,i(151)),this.register(n.WSEvents.MESSAGE_REACTION_REMOVE_ALL,i(152))}get client(){return this.ws.client}register(e,t){this.handlers[e]=new t(this)}handleQueue(){this.queue.forEach((e,t)=>{this.handle(this.queue[t],!0),this.queue.splice(t,1)})}handle(e,t=!1){return e.op===n.OPCodes.HEARTBEAT_ACK?(this.ws.client._pong(this.ws.client._pingTimestamp),this.ws.lastHeartbeatAck=!0,this.ws.client.emit("debug","Heartbeat acknowledged")):e.op===n.OPCodes.HEARTBEAT&&(this.client.ws.send({op:n.OPCodes.HEARTBEAT,d:this.client.ws.sequence}),this.ws.client.emit("debug","Received gateway heartbeat")),this.ws.status===n.Status.RECONNECTING&&(this.ws.reconnecting=!1,this.ws.checkIfReady()),this.ws.setSequence(e.s),void 0===this.ws.disabledEvents[e.t]&&(this.ws.status!==n.Status.READY&&-1===s.indexOf(e.t)?(this.queue.push(e),!1):(!t&&this.queue.length>0&&this.handleQueue(),!!this.handlers[e.t]&&this.handlers[e.t].handle(e)))}}e.exports=r},function(e,t,i){const n=i(1),s=i(71);class r extends n{handle(e){const t=this.packetManager.client,i=e.d;t.ws.heartbeat(),i.user.user_settings=i.user_settings;const n=new s(t,i.user);t.user=n,t.readyAt=new Date,t.users.set(n.id,n);for(const e of i.guilds)t.dataManager.newGuild(e);for(const e of i.private_channels)t.dataManager.newChannel(e);for(const e of i.relationships){const i=t.dataManager.newUser(e.user);1===e.type?t.user.friends.set(i.id,i):2===e.type&&t.user.blocked.set(i.id,i)}i.presences=i.presences||[];for(const e of i.presences)t.dataManager.newUser(e.user),t._setPresence(e.user.id,e);if(i.notes)for(const e in i.notes){let n=i.notes[e];n.length||(n=null),t.user.notes.set(e,n)}!t.user.bot&&t.options.sync&&t.setInterval(t.syncGuilds.bind(t),3e4),t.users.has("1")||t.dataManager.newUser({id:"1",username:"Clyde",discriminator:"0000",avatar:"https://discordapp.com/assets/f78426a064bc9dd24847519259bc42af.png",bot:!0,status:"online",game:null,verified:!0});const r=t.setTimeout(()=>{t.ws.connection.triggerReady()},1200*i.guilds.length);t.setMaxListeners(i.guilds.length+10),t.once("ready",()=>{t.syncGuilds(),t.setMaxListeners(10),t.clearTimeout(r)});const o=this.packetManager.ws;o.sessionID=i.session_id,o._trace=i._trace,t.emit("debug",`READY ${o._trace.join(" -> ")} ${o.sessionID}`),o.checkIfReady()}}e.exports=r},function(e,t,i){const n=i(1),s=i(0);class r extends n{handle(e){const t=this.packetManager.client,i=t.ws.connection;i._trace=e.d._trace,i.status=s.Status.READY,this.packetManager.handleQueue();const n=i.sequence-i.closeSequence;i.debug(`RESUMED ${i._trace.join(" -> ")} | replayed ${n} events.`),t.emit("resume",n),i.heartbeat()}}e.exports=r},function(e,t,i){const n=i(1);class s extends n{handle(e){const t=this.packetManager.client,i=e.d,n=t.guilds.get(i.id);n?n.available||i.unavailable||(n.setup(i),this.packetManager.ws.checkIfReady()):t.dataManager.newGuild(i)}}e.exports=s},function(e,t,i){const n=i(1),s=i(0);class r extends n{handle(e){const t=this.packetManager.client,i=e.d,n=t.actions.GuildDelete.handle(i);n.guild&&t.emit(s.Events.GUILD_DELETE,n.guild)}}e.exports=r},function(e,t,i){const n=i(1);class s extends n{handle(e){const t=this.packetManager.client,i=e.d;t.actions.GuildUpdate.handle(i)}}e.exports=s},function(e,t,i){const n=i(1),s=i(0);class r extends n{handle(e){const t=this.packetManager.client,i=e.d,n=t.guilds.get(i.guild_id),r=t.users.get(i.user.id);n&&r&&t.emit(s.Events.GUILD_BAN_ADD,n,r)}}e.exports=r},function(e,t,i){const n=i(1);class s extends n{handle(e){const t=this.packetManager.client,i=e.d;t.actions.GuildBanRemove.handle(i)}}e.exports=s},function(e,t,i){const n=i(1);class s extends n{handle(e){const t=this.packetManager.client,i=e.d,n=t.guilds.get(i.guild_id);n&&(n.memberCount++,n._addMember(i))}}e.exports=s},function(e,t,i){const n=i(1);class s extends n{handle(e){const t=this.packetManager.client,i=e.d;t.actions.GuildMemberRemove.handle(i)}}e.exports=s},function(e,t,i){const n=i(1);class s extends n{handle(e){const t=this.packetManager.client,i=e.d,n=t.guilds.get(i.guild_id);if(n){const e=n.members.get(i.user.id);e&&n._updateMember(e,i)}}}e.exports=s},function(e,t,i){const n=i(1);class s extends n{handle(e){const t=this.packetManager.client,i=e.d;t.actions.GuildRoleCreate.handle(i)}}e.exports=s},function(e,t,i){const n=i(1);class s extends n{handle(e){const t=this.packetManager.client,i=e.d;t.actions.GuildRoleDelete.handle(i)}}e.exports=s},function(e,t,i){const n=i(1);class s extends n{handle(e){const t=this.packetManager.client,i=e.d;t.actions.GuildRoleUpdate.handle(i)}}e.exports=s},function(e,t,i){const n=i(1);class s extends n{handle(e){const t=this.packetManager.client,i=e.d;t.actions.GuildEmojisUpdate.handle(i)}}e.exports=s},function(e,t,i){const n=i(1),s=i(0);class r extends n{handle(e){const t=this.packetManager.client,i=e.d,n=t.guilds.get(i.guild_id);if(!n)return;const r=i.members.map(e=>n._addMember(e,!1));t.emit(s.Events.GUILD_MEMBERS_CHUNK,r,n),t.ws.lastHeartbeatAck=!0}}e.exports=r},function(e,t,i){const n=i(1);class s extends n{handle(e){const t=this.packetManager.client,i=e.d;t.actions.ChannelCreate.handle(i)}}e.exports=s},function(e,t,i){const n=i(1),s=i(0);class r extends n{handle(e){const t=this.packetManager.client,i=e.d,n=t.actions.ChannelDelete.handle(i);n.channel&&t.emit(s.Events.CHANNEL_DELETE,n.channel)}}e.exports=r},function(e,t,i){const n=i(1);class s extends n{handle(e){const t=this.packetManager.client,i=e.d;t.actions.ChannelUpdate.handle(i)}}e.exports=s},function(e,t,i){const n=i(1),s=i(0);class r extends n{handle(e){const t=this.packetManager.client,i=e.d,n=t.channels.get(i.channel_id),r=new Date(i.last_pin_timestamp);n&&r&&t.emit(s.Events.CHANNEL_PINS_UPDATE,n,r)}}e.exports=r},function(e,t,i){const n=i(1),s=i(0),r=i(4);class o extends n{handle(e){const t=this.packetManager.client,i=e.d;let n=t.users.get(i.user.id);const o=t.guilds.get(i.guild_id);if(!n){if(!i.user.username)return;n=t.dataManager.newUser(i.user)}const a=r.cloneObject(n);if(n.patch(i.user),n.equals(a)||t.emit(s.Events.USER_UPDATE,a,n),o){let e=o.members.get(n.id);if(e||"offline"===i.status||(e=o._addMember({user:n,roles:i.roles,deaf:!1,mute:!1},!1),t.emit(s.Events.GUILD_MEMBER_AVAILABLE,e)),e){if(0===t.listenerCount(s.Events.PRESENCE_UPDATE))return void o._setPresence(n.id,i);const a=r.cloneObject(e);e.presence&&(a.frozenPresence=r.cloneObject(e.presence)),o._setPresence(n.id,i),t.emit(s.Events.PRESENCE_UPDATE,a,e)}else o._setPresence(n.id,i)}}}e.exports=o},function(e,t,i){const n=i(1);class s extends n{handle(e){const t=this.packetManager.client,i=e.d;t.actions.UserUpdate.handle(i)}}e.exports=s},function(e,t,i){const n=i(1);class s extends n{handle(e){const t=this.packetManager.client,i=e.d;t.actions.UserNoteUpdate.handle(i)}}e.exports=s},function(e,t,i){const n=i(1),s=i(0);class r extends n{handle(e){const t=this.packetManager.client;t.user.settings.patch(e.d),t.emit(s.Events.USER_SETTINGS_UPDATE,t.user.settings)}}e.exports=r},function(e,t,i){const n=i(1),s=i(0),r=i(4);class o extends n{handle(e){const t=this.packetManager.client,i=e.d,n=t.guilds.get(i.guild_id);if(n){const e=n.members.get(i.user_id);if(e){const n=r.cloneObject(e);e.voiceChannel&&e.voiceChannel.id!==i.channel_id&&e.voiceChannel.members.delete(n.id),i.channel_id||(e.speaking=null),e.user.id===t.user.id&&i.channel_id&&t.emit("self.voiceStateUpdate",i);const o=t.channels.get(i.channel_id);o&&o.members.set(e.user.id,e),e.serverMute=i.mute,e.serverDeaf=i.deaf,e.selfMute=i.self_mute,e.selfDeaf=i.self_deaf,e.voiceSessionID=i.session_id,e.voiceChannelID=i.channel_id,t.emit(s.Events.VOICE_STATE_UPDATE,n,e)}}}}e.exports=o},function(e,t,i){function n(e,t){return e.client.setTimeout(()=>{e.client.emit(r.Events.TYPING_STOP,e,t,e._typing.get(t.id)),e._typing.delete(t.id)},6e3)}const s=i(1),r=i(0);class o extends s{handle(e){const t=this.packetManager.client,i=e.d,s=t.channels.get(i.channel_id),o=t.users.get(i.user_id),c=new Date(1e3*i.timestamp);if(s&&o){if("voice"===s.type)return void t.emit(r.Events.WARN,`Discord sent a typing packet to voice channel ${s.id}`);if(s._typing.has(o.id)){const e=s._typing.get(o.id);e.lastTimestamp=c,e.resetTimeout(n(s,o))}else s._typing.set(o.id,new a(t,c,c,n(s,o))),t.emit(r.Events.TYPING_START,s,o)}}}class a{constructor(e,t,i,n){this.client=e,this.since=t,this.lastTimestamp=i,this._timeout=n}resetTimeout(e){this.client.clearTimeout(this._timeout),this._timeout=e}get elapsedTime(){return Date.now()-this.since}}e.exports=o},function(e,t,i){const n=i(1),s=i(0);class r extends n{handle(e){const t=this.packetManager.client,i=e.d,n=t.actions.MessageCreate.handle(i);n.message&&t.emit(s.Events.MESSAGE_CREATE,n.message)}}e.exports=r},function(e,t,i){const n=i(1),s=i(0);class r extends n{handle(e){const t=this.packetManager.client,i=e.d,n=t.actions.MessageDelete.handle(i);n.message&&t.emit(s.Events.MESSAGE_DELETE,n.message)}}e.exports=r},function(e,t,i){const n=i(1);class s extends n{handle(e){const t=this.packetManager.client,i=e.d;t.actions.MessageUpdate.handle(i)}}e.exports=s},function(e,t,i){const n=i(1);class s extends n{handle(e){const t=this.packetManager.client,i=e.d;t.actions.MessageDeleteBulk.handle(i)}}e.exports=s},function(e,t,i){const n=i(1);class s extends n{handle(e){const t=this.packetManager.client,i=e.d;t.emit("self.voiceServer",i)}}e.exports=s},function(e,t,i){const n=i(1);class s extends n{handle(e){const t=this.packetManager.client,i=e.d;t.actions.GuildSync.handle(i)}}e.exports=s},function(e,t,i){const n=i(1);class s extends n{handle(e){const t=this.packetManager.client,i=e.d;1===i.type?t.fetchUser(i.id).then(e=>{t.user.friends.set(e.id,e)}):2===i.type&&t.fetchUser(i.id).then(e=>{t.user.blocked.set(e.id,e)})}}e.exports=s},function(e,t,i){const n=i(1);class s extends n{handle(e){const t=this.packetManager.client,i=e.d;2===i.type?t.user.blocked.has(i.id)&&t.user.blocked.delete(i.id):1===i.type&&t.user.friends.has(i.id)&&t.user.friends.delete(i.id)}}e.exports=s},function(e,t,i){const n=i(1);class s extends n{handle(e){const t=this.packetManager.client,i=e.d;t.actions.MessageReactionAdd.handle(i)}}e.exports=s},function(e,t,i){const n=i(1);class s extends n{handle(e){const t=this.packetManager.client,i=e.d;t.actions.MessageReactionRemove.handle(i)}}e.exports=s},function(e,t,i){const n=i(1);class s extends n{handle(e){const t=this.packetManager.client,i=e.d;t.actions.MessageReactionRemoveAll.handle(i)}}e.exports=s},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t,i){const n=i(9).EventEmitter,s=i(0),r=i(70);class o extends n{constructor(e){super(),this.client=e,this.connection=null}heartbeat(){return this.connection?this.connection.heartbeat():this.debug("No connection to heartbeat")}debug(e){return this.client.emit("debug",`[ws] ${e}`)}destroy(){return this.connection?this.connection.destroy():(this.debug("Attempted to destroy WebSocket but no connection exists!"),!1)}send(e){this.connection?this.connection.send(e):this.debug("No connection to websocket")}connect(e){if(!this.connection)return this.connection=new r(this,e),!0;switch(this.connection.status){case s.Status.IDLE:case s.Status.DISCONNECTED:return this.connection.connect(e,5500),!0;default:return this.debug(`Couldn't connect to ${e} as the websocket is at state ${this.connection.status}`),!1}}}e.exports=o},function(e,t,i){class n{constructor(e){this.client=e,this.register(i(159)),this.register(i(160)),this.register(i(161)),this.register(i(162)),this.register(i(163)),this.register(i(164)),this.register(i(165)),this.register(i(166)),this.register(i(167)),this.register(i(168)),this.register(i(169)),this.register(i(170)),this.register(i(171)),this.register(i(172)),this.register(i(173)),this.register(i(174)),this.register(i(175)),this.register(i(176)),this.register(i(177)),this.register(i(178)),this.register(i(179)),this.register(i(180)),this.register(i(181)),this.register(i(182)),this.register(i(183)),this.register(i(184)),this.register(i(185)),this.register(i(186))}register(e){this[e.name.replace(/Action$/,"")]=new e(this.client)}}e.exports=n},function(e,t,i){const n=i(2),s=i(22);class r extends n{handle(e){const t=this.client,i=t.channels.get((e instanceof Array?e[0]:e).channel_id),n=t.users.get((e instanceof Array?e[0]:e).author.id);if(i){const r=i.guild?i.guild.member(n):null;if(e instanceof Array){const o=new Array(e.length);for(let n=0;nthis.deleted.delete(e+t),this.client.options.restWsBridgeTimeout)}}e.exports=s},function(e,t,i){const n=i(2),s=i(3),r=i(0);class o extends n{handle(e){const t=this.client,i=t.channels.get(e.channel_id),n=e.ids,o=new s;for(const e of n){const t=i.messages.get(e);t&&o.set(t.id,t)}return o.size>0&&t.emit(r.Events.MESSAGE_BULK_DELETE,o),{messages:o}}}e.exports=o},function(e,t,i){const n=i(2),s=i(0);class r extends n{handle(e){const t=this.client,i=t.channels.get(e.channel_id);if(i){const n=i.messages.get(e.id);return n?(n.patch(e),t.emit(s.Events.MESSAGE_UPDATE,n._edits[0],n),{old:n._edits[0],updated:n}):{old:n,updated:n}}return{old:null,updated:null}}}e.exports=r},function(e,t,i){const n=i(2),s=i(0);class r extends n{handle(e){const t=this.client.users.get(e.user_id);if(!t)return!1;const i=this.client.channels.get(e.channel_id);if(!i||"voice"===i.type)return!1;const n=i.messages.get(e.message_id);if(!n)return!1;if(!e.emoji)return!1;const r=n._addReaction(e.emoji,t);return r&&this.client.emit(s.Events.MESSAGE_REACTION_ADD,r,t),{message:n,reaction:r,user:t}}}e.exports=r},function(e,t,i){const n=i(2),s=i(0);class r extends n{handle(e){const t=this.client.users.get(e.user_id);if(!t)return!1;const i=this.client.channels.get(e.channel_id);if(!i||"voice"===i.type)return!1;const n=i.messages.get(e.message_id);if(!n)return!1;if(!e.emoji)return!1;const r=n._removeReaction(e.emoji,t);return r&&this.client.emit(s.Events.MESSAGE_REACTION_REMOVE,r,t),{message:n,reaction:r,user:t}}}e.exports=r},function(e,t,i){const n=i(2),s=i(0);class r extends n{handle(e){const t=this.client.channels.get(e.channel_id);if(!t||"voice"===t.type)return!1;const i=t.messages.get(e.message_id);return!!i&&(i._clearReactions(),this.client.emit(s.Events.MESSAGE_REACTION_REMOVE_ALL,i),{message:i})}}e.exports=r},function(e,t,i){const n=i(2);class s extends n{handle(e){return{channel:this.client.dataManager.newChannel(e)}}}e.exports=s},function(e,t,i){const n=i(2);class s extends n{constructor(e){super(e),this.deleted=new Map}handle(e){const t=this.client;let i=t.channels.get(e.id);return i?(t.dataManager.killChannel(i),this.deleted.set(i.id,i),this.scheduleForDeletion(i.id)):i=this.deleted.get(e.id)||null,{channel:i}}scheduleForDeletion(e){this.client.setTimeout(()=>this.deleted.delete(e),this.client.options.restWsBridgeTimeout)}}e.exports=s},function(e,t,i){const n=i(2),s=i(0),r=i(4);class o extends n{handle(e){const t=this.client,i=t.channels.get(e.id);if(i){const n=r.cloneObject(i);return i.setup(e),t.emit(s.Events.CHANNEL_UPDATE,n,i),{old:n,updated:i}}return{old:null,updated:null}}}e.exports=o},function(e,t,i){const n=i(2),s=i(0);class r extends n{constructor(e){super(e),this.deleted=new Map}handle(e){const t=this.client;let i=t.guilds.get(e.id);if(i){for(const e of i.channels.values())"text"===e.type&&e.stopTyping(!0);if(i.available&&e.unavailable)return i.available=!1,t.emit(s.Events.GUILD_UNAVAILABLE,i),{guild:null};t.guilds.delete(i.id),this.deleted.set(i.id,i),this.scheduleForDeletion(i.id)}else i=this.deleted.get(e.id)||null;return{guild:i}}scheduleForDeletion(e){this.client.setTimeout(()=>this.deleted.delete(e),this.client.options.restWsBridgeTimeout)}}e.exports=r},function(e,t,i){const n=i(2),s=i(0),r=i(4);class o extends n{handle(e){const t=this.client,i=t.guilds.get(e.id);if(i){const n=r.cloneObject(i);return i.setup(e),t.emit(s.Events.GUILD_UPDATE,n,i),{old:n,updated:i}}return{old:null,updated:null}}}e.exports=o},function(e,t,i){const n=i(2);class s extends n{handle(e,t){return{member:e._addMember(t,!1)}}}e.exports=s},function(e,t,i){const n=i(2),s=i(0);class r extends n{constructor(e){super(e),this.deleted=new Map}handle(e){const t=this.client,i=t.guilds.get(e.guild_id);let n=null;return i&&((n=i.members.get(e.user.id))?(i.memberCount--,i._removeMember(n),this.deleted.set(i.id+e.user.id,n),t.status===s.Status.READY&&t.emit(s.Events.GUILD_MEMBER_REMOVE,n),this.scheduleForDeletion(i.id,e.user.id)):n=this.deleted.get(i.id+e.user.id)||null),{guild:i,member:n}}scheduleForDeletion(e,t){this.client.setTimeout(()=>this.deleted.delete(e+t),this.client.options.restWsBridgeTimeout)}}e.exports=r},function(e,t,i){const n=i(2),s=i(0);class r extends n{handle(e){const t=this.client,i=t.guilds.get(e.guild_id),n=t.dataManager.newUser(e.user);i&&n&&t.emit(s.Events.GUILD_BAN_REMOVE,i,n)}}e.exports=r},function(e,t,i){const n=i(2),s=i(0),r=i(14);class o extends n{handle(e){const t=this.client,i=t.guilds.get(e.guild_id);let n;if(i){const o=i.roles.has(e.role.id);n=new r(i,e.role),i.roles.set(n.id,n),o||t.emit(s.Events.GUILD_ROLE_CREATE,n)}return{role:n}}}e.exports=o},function(e,t,i){const n=i(2),s=i(0);class r extends n{constructor(e){super(e),this.deleted=new Map}handle(e){const t=this.client,i=t.guilds.get(e.guild_id);let n;return i&&((n=i.roles.get(e.role_id))?(i.roles.delete(e.role_id),this.deleted.set(i.id+e.role_id,n),this.scheduleForDeletion(i.id,e.role_id),t.emit(s.Events.GUILD_ROLE_DELETE,n)):n=this.deleted.get(i.id+e.role_id)||null),{role:n}}scheduleForDeletion(e,t){this.client.setTimeout(()=>this.deleted.delete(e+t),this.client.options.restWsBridgeTimeout)}}e.exports=r},function(e,t,i){const n=i(2),s=i(0),r=i(4);class o extends n{handle(e){const t=this.client,i=t.guilds.get(e.guild_id);if(i){const n=e.role;let o=null;const a=i.roles.get(n.id);return a&&(o=r.cloneObject(a),a.setup(e.role),t.emit(s.Events.GUILD_ROLE_UPDATE,o,a)),{old:o,updated:a}}return{old:null,updated:null}}}e.exports=o},function(e,t,i){const n=i(2);class s extends n{handle(e){return{user:this.client.dataManager.newUser(e)}}}e.exports=s},function(e,t,i){const n=i(2),s=i(0),r=i(4);class o extends n{handle(e){const t=this.client;if(t.user){if(t.user.equals(e))return{old:t.user,updated:t.user};const i=r.cloneObject(t.user);return t.user.patch(e),t.emit(s.Events.USER_UPDATE,i,t.user),{old:i,updated:t.user}}return{old:null,updated:null}}}e.exports=o},function(e,t,i){const n=i(2),s=i(0);class r extends n{handle(e){const t=this.client,i=t.user.notes.get(e.id),n=e.note.length?e.note:null;return t.user.notes.set(e.id,n),t.emit(s.Events.USER_NOTE_UPDATE,e.id,i,n),{old:i,updated:n}}}e.exports=r},function(e,t,i){const n=i(2);class s extends n{handle(e){const t=this.client.guilds.get(e.id);if(t){if(e.presences)for(const i of e.presences)t._setPresence(i.user.id,i);if(e.members)for(const i of e.members){const e=t.members.get(i.user.id);e?t._updateMember(e,i):t._addMember(i,!1)}"large"in e&&(t.large=e.large)}}}e.exports=s},function(e,t,i){const n=i(2);class s extends n{handle(e,t){return{emoji:this.client.dataManager.newEmoji(t,e)}}}e.exports=s},function(e,t,i){const n=i(2);class s extends n{handle(e){return this.client.dataManager.killEmoji(e),{emoji:e}}}e.exports=s},function(e,t,i){const n=i(2);class s extends n{handle(e,t){return{emoji:this.client.dataManager.updateEmoji(e,t)}}}e.exports=s},function(e,t,i){function n(e){const t=new Map;for(const i of e)t.set(...i);return t}const s=i(2);class r extends s{handle(e){const t=this.client.guilds.get(e.guild_id);if(!t||!t.emojis)return;const i=n(t.emojis.entries());for(const n of e.emojis){const e=t.emojis.get(n.id);e?(i.delete(n.id),e.equals(n,!0)||this.client.actions.GuildEmojiUpdate.handle(e,n)):this.client.actions.GuildEmojiCreate.handle(t,n)}for(const e of i.values())this.client.actions.GuildEmojiDelete.handle(e)}}e.exports=r},function(e,t,i){const n=i(2);class s extends n{handle(e){const t=this.client.guilds.get(e.guild_id);if(t)for(const i of e.roles){const e=t.roles.get(i.id);e&&(e.position=i.position)}return{guild:t}}}e.exports=s},function(e,t,i){const n=i(2);class s extends n{handle(e){const t=this.client.guilds.get(e.guild_id);if(t)for(const i of e.channels){const e=t.channels.get(i.id);e&&(e.position=i.position)}return{guild:t}}}e.exports=s},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t,i){const n=i(38),s=i(53),r=i(41),o=i(0),a=i(4);class c extends n{constructor(e,t,i){super(null,e,t),this.options=a.mergeDefault(o.DefaultOptions,i),this.rest=new s(this),this.resolver=new r(this),this._timeouts=new Set,this._intervals=new Set}setTimeout(e,t,...i){const n=setTimeout(()=>{e(),this._timeouts.delete(n)},t,...i);return this._timeouts.add(n),n}clearTimeout(e){clearTimeout(e),this._timeouts.delete(e)}setInterval(e,t,...i){const n=setInterval(e,t,...i);return this._intervals.add(n),n}clearInterval(e){clearInterval(e),this._intervals.delete(e)}destroy(){for(const e of this._timeouts)clearTimeout(e);for(const e of this._intervals)clearInterval(e);this._timeouts.clear(),this._intervals.clear()}}e.exports=c},function(e,t,i){function n(e){return"string"==typeof e?e:e instanceof Array?e.join("\n"):String(e)}const s=i(41);class r{constructor(e={}){this.title=e.title,this.description=e.description,this.url=e.url,this.color=e.color,this.author=e.author,this.timestamp=e.timestamp,this.fields=e.fields||[],this.thumbnail=e.thumbnail,this.image=e.image,this.footer=e.footer,this.file=e.file}setTitle(e){if((e=n(e)).length>256)throw new RangeError("RichEmbed titles may not exceed 256 characters.");return this.title=e,this}setDescription(e){if((e=n(e)).length>2048)throw new RangeError("RichEmbed descriptions may not exceed 2048 characters.");return this.description=e,this}setURL(e){return this.url=e,this}setColor(e){return this.color=s.resolveColor(e),this}setAuthor(e,t,i){return this.author={name:n(e),icon_url:t,url:i},this}setTimestamp(e=new Date){return this.timestamp=e,this}addField(e,t,i=!1){if(this.fields.length>=25)throw new RangeError("RichEmbeds may not exceed 25 fields.");if((e=n(e)).length>256)throw new RangeError("RichEmbed field names may not exceed 256 characters.");if(!/\S/.test(e))throw new RangeError("RichEmbed field names may not be empty.");if((t=n(t)).length>1024)throw new RangeError("RichEmbed field values may not exceed 1024 characters.");if(!/\S/.test(t))throw new RangeError("RichEmbed field values may not be empty.");return this.fields.push({name:e,value:t,inline:i}),this}addBlankField(e=!1){return this.addField("​","​",e)}setThumbnail(e){return this.thumbnail={url:e},this}setImage(e){return this.image={url:e},this}setFooter(e,t){if((e=n(e)).length>2048)throw new RangeError("RichEmbed footer text may not exceed 2048 characters.");return this.footer={text:e,icon_url:t},this}attachFile(e){if(this.file)throw new RangeError("You may not upload more than one file at once.");return this.file=e,this}}e.exports=r}]); \ No newline at end of file +!function(e){function t(n){if(i[n])return i[n].exports;var s=i[n]={i:n,l:!1,exports:{}};return e[n].call(s.exports,s,s.exports,t),s.l=!0,s.exports}var i={};t.m=e,t.c=i,t.d=function(e,i,n){t.o(e,i)||Object.defineProperty(e,i,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var i=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(i,"a",i),i},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=75)}([function(e,t,i){(function(e){t.Package=i(55),t.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(107).platform(),properties:{$os:e?e.platform:"discord.js",$browser:"discord.js",$device:"discord.js",$referrer:"",$referring_domain:""},version:6},http:{version:7,host:"https://discordapp.com",cdn:"https://cdn.discordapp.com"}},t.WSCodes={1e3:"Connection gracefully closed",4004:"Tried to identify with an invalid token",4010:"Sharding data provided was invalid",4011:"Shard would be on too many guilds if connected"},t.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=t.Endpoints={User:e=>{e.id&&(e=e.id);const t=`/users/${e}`;return{toString:()=>t,channels:`${t}/channels`,profile:`${t}/profile`,relationships:`${t}/relationships`,settings:`${t}/settings`,Relationship:e=>`${t}/relationships/${e}`,Guild:e=>({toString:()=>`${t}/guilds/${e}`,settings:`${t}/guilds/${e}/settings`}),Note:e=>`${t}/notes/${e}`,Mentions:(e,i,n,s)=>`${t}/mentions?limit=${e}&roles=${i}&everyone=${n}${s?`&guild_id=${s}`:""}`,Avatar:(t,i)=>"1"===e?i:n.CDN(t).Avatar(e,i)}},guilds:"/guilds",Guild:e=>{e.id&&(e=e.id);const t=`/guilds/${e}`;return{toString:()=>t,prune:`${t}/prune`,embed:`${t}/embed`,bans:`${t}/bans`,integrations:`${t}/integrations`,members:`${t}/members`,channels:`${t}/channels`,invites:`${t}/invites`,roles:`${t}/roles`,emojis:`${t}/emojis`,search:`${t}/messages/search`,voiceRegions:`${t}/regions`,webhooks:`${t}/webhooks`,ack:`${t}/ack`,settings:`${t}/settings`,auditLogs:`${t}/audit-logs`,Emoji:e=>`${t}/emojis/${e}`,Icon:(t,i)=>n.CDN(t).Icon(e,i),Splash:(t,i)=>n.CDN(t).Splash(e,i),Role:e=>`${t}/roles/${e}`,Member:e=>{e.id&&(e=e.id);const i=`${t}/members/${e}`;return{toString:()=>i,Role:e=>`${i}/roles/${e}`,nickname:`${t}/members/@me/nick`}}}},channels:"/channels",Channel:e=>{e.id&&(e=e.id);const t=`/channels/${e}`;return{toString:()=>t,messages:{toString:()=>`${t}/messages`,bulkDelete:`${t}/messages/bulk-delete`},invites:`${t}/invites`,typing:`${t}/typing`,permissions:`${t}/permissions`,webhooks:`${t}/webhooks`,search:`${t}/messages/search`,pins:`${t}/pins`,Icon:(t,i)=>n.CDN(t).GDMIcon(e,i),Pin:e=>`${t}/pins/${e}`,Recipient:e=>`${t}/recipients/${e}`,Message:e=>{e.id&&(e=e.id);const i=`${t}/messages/${e}`;return{toString:()=>i,reactions:`${i}/reactions`,ack:`${i}/ack`,Reaction:(e,t)=>{const n=`${i}/reactions/${e}${t?`?limit=${t}`:""}`;return{toString:()=>n,User:e=>`${n}/${e}`}}}}}},Message:e=>t.Endpoints.Channel(e.channel).Message(e),Member:e=>t.Endpoints.Guild(e.guild).Member(e),CDN:e=>({Emoji:t=>`${e}/emojis/${t}.png`,Asset:t=>`${e}/assets/${t}`,Avatar:(t,i)=>`${e}/avatars/${t}/${i}.${i.startsWith("a_")?"gif":"png"}?size=2048`,Icon:(t,i)=>`${e}/icons/${t}/${i}.jpg`,GDMIcon:(t,i)=>`${e}/channel-icons/${t}/${i}.jpg?size=2048`,Splash:(t,i)=>`${e}/splashes/${t}/${i}.jpg`}),OAUTH2:{Application:e=>{const t=`/oauth2/applications/${e}`;return{toString:()=>t,resetSecret:`${t}/reset`,resetToken:`${t}/bot/reset`}},App:e=>`/oauth2/authorize?client_id=${e}`},login:"/auth/login",logout:"/auth/logout",voiceRegions:"/voice/regions",gateway:{toString:()=>"/gateway",bot:"/gateway/bot"},Invite:e=>`/invite/${e}?with_counts=true`,inviteLink:e=>`https://discord.gg/${e}`,Webhook:(e,t)=>`/webhooks/${e}${t?`/${t}`:""}`};t.Status={READY:0,CONNECTING:1,RECONNECTING:2,IDLE:3,NEARLY:4,DISCONNECTED:5},t.VoiceStatus={CONNECTED:0,CONNECTING:1,AUTHENTICATING:2,RECONNECTING:3,DISCONNECTED:4},t.ChannelTypes={TEXT:0,DM:1,VOICE:2,GROUP_DM:3},t.OPCodes={DISPATCH:0,HEARTBEAT:1,IDENTIFY:2,STATUS_UPDATE:3,VOICE_STATE_UPDATE:4,VOICE_GUILD_PING:5,RESUME:6,RECONNECT:7,REQUEST_GUILD_MEMBERS:8,INVALID_SESSION:9,HELLO:10,HEARTBEAT_ACK:11},t.VoiceOPCodes={IDENTIFY:0,SELECT_PROTOCOL:1,READY:2,HEARTBEAT:3,SESSION_DESCRIPTION:4,SPEAKING:5},t.Events={READY:"ready",RESUME:"resume",GUILD_CREATE:"guildCreate",GUILD_DELETE:"guildDelete",GUILD_UPDATE:"guildUpdate",GUILD_UNAVAILABLE:"guildUnavailable",GUILD_AVAILABLE:"guildAvailable",GUILD_MEMBER_ADD:"guildMemberAdd",GUILD_MEMBER_REMOVE:"guildMemberRemove",GUILD_MEMBER_UPDATE:"guildMemberUpdate",GUILD_MEMBER_AVAILABLE:"guildMemberAvailable",GUILD_MEMBER_SPEAKING:"guildMemberSpeaking",GUILD_MEMBERS_CHUNK:"guildMembersChunk",GUILD_ROLE_CREATE:"roleCreate",GUILD_ROLE_DELETE:"roleDelete",GUILD_ROLE_UPDATE:"roleUpdate",GUILD_EMOJI_CREATE:"emojiCreate",GUILD_EMOJI_DELETE:"emojiDelete",GUILD_EMOJI_UPDATE:"emojiUpdate",GUILD_BAN_ADD:"guildBanAdd",GUILD_BAN_REMOVE:"guildBanRemove",CHANNEL_CREATE:"channelCreate",CHANNEL_DELETE:"channelDelete",CHANNEL_UPDATE:"channelUpdate",CHANNEL_PINS_UPDATE:"channelPinsUpdate",MESSAGE_CREATE:"message",MESSAGE_DELETE:"messageDelete",MESSAGE_UPDATE:"messageUpdate",MESSAGE_BULK_DELETE:"messageDeleteBulk",MESSAGE_REACTION_ADD:"messageReactionAdd",MESSAGE_REACTION_REMOVE:"messageReactionRemove",MESSAGE_REACTION_REMOVE_ALL:"messageReactionRemoveAll",USER_UPDATE:"userUpdate",USER_NOTE_UPDATE:"userNoteUpdate",USER_SETTINGS_UPDATE:"clientUserSettingsUpdate",USER_GUILD_SETTINGS_UPDATE:"clientUserGuildSettingsUpdate",PRESENCE_UPDATE:"presenceUpdate",VOICE_STATE_UPDATE:"voiceStateUpdate",TYPING_START:"typingStart",TYPING_STOP:"typingStop",DISCONNECT:"disconnect",RECONNECTING:"reconnecting",ERROR:"error",WARN:"warn",DEBUG:"debug"},t.WSEvents={READY:"READY",RESUMED:"RESUMED",GUILD_SYNC:"GUILD_SYNC",GUILD_CREATE:"GUILD_CREATE",GUILD_DELETE:"GUILD_DELETE",GUILD_UPDATE:"GUILD_UPDATE",GUILD_MEMBER_ADD:"GUILD_MEMBER_ADD",GUILD_MEMBER_REMOVE:"GUILD_MEMBER_REMOVE",GUILD_MEMBER_UPDATE:"GUILD_MEMBER_UPDATE",GUILD_MEMBERS_CHUNK:"GUILD_MEMBERS_CHUNK",GUILD_ROLE_CREATE:"GUILD_ROLE_CREATE",GUILD_ROLE_DELETE:"GUILD_ROLE_DELETE",GUILD_ROLE_UPDATE:"GUILD_ROLE_UPDATE",GUILD_BAN_ADD:"GUILD_BAN_ADD",GUILD_BAN_REMOVE:"GUILD_BAN_REMOVE",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",USER_SETTINGS_UPDATE:"USER_SETTINGS_UPDATE",USER_GUILD_SETTINGS_UPDATE:"USER_GUILD_SETTINGS_UPDATE",PRESENCE_UPDATE:"PRESENCE_UPDATE",VOICE_STATE_UPDATE:"VOICE_STATE_UPDATE",TYPING_START:"TYPING_START",VOICE_SERVER_UPDATE:"VOICE_SERVER_UPDATE",RELATIONSHIP_ADD:"RELATIONSHIP_ADD",RELATIONSHIP_REMOVE:"RELATIONSHIP_REMOVE"},t.MessageTypes=["DEFAULT","RECIPIENT_ADD","RECIPIENT_REMOVE","CALL","CHANNEL_NAME_CHANGE","CHANNEL_ICON_CHANGE","PINS_ADD","GUILD_MEMBER_JOIN"],t.MessageNotificationTypes=["EVERYTHING","MENTIONS","NOTHING","INHERIT"],t.DefaultAvatars={BLURPLE:"6debd47ed13483642cf09e832ed0bc1b",GREY:"322c936a8c8be1b803cd94861bdfa868",GREEN:"dd4dbc0016779df1378e7812eabaa04d",ORANGE:"0e291f67c9274a1abdddeb3fd919cbaa",RED:"1cbd08c76f8af6dddce02c5138971129"},t.ExplicitContentFilterTypes=["DISABLED","NON_FRIENDS","FRIENDS_AND_NON_FRIENDS"],t.UserSettingsMap={convert_emoticons:"convertEmoticons",default_guilds_restricted:"defaultGuildsRestricted",detect_platform_accounts:"detectPlatformAccounts",developer_mode:"developerMode",enable_tts_command:"enableTTSCommand",theme:"theme",status:"status",show_current_game:"showCurrentGame",inline_attachment_media:"inlineAttachmentMedia",inline_embed_media:"inlineEmbedMedia",locale:"locale",message_display_compact:"messageDisplayCompact",render_reactions:"renderReactions",guild_positions:"guildPositions",restricted_guilds:"restrictedGuilds",explicit_content_filter:function(e){return t.ExplicitContentFilterTypes[e]},friend_source_flags:function(e){return{all:e.all||!1,mutualGuilds:!!e.all||(e.mutual_guilds||!1),mutualFriends:!!e.all||(e.mutualFriends||!1)}}},t.UserGuildSettingsMap={message_notifications:function(e){return t.MessageNotificationTypes[e]},mobile_push:"mobilePush",muted:"muted",suppress_everyone:"suppressEveryone",channel_overrides:"channelOverrides"},t.UserChannelOverrideMap={message_notifications:function(e){return t.MessageNotificationTypes[e]},muted:"muted"},t.Colors={DEFAULT:0,AQUA:1752220,GREEN:3066993,BLUE:3447003,PURPLE:10181046,GOLD:15844367,ORANGE:15105570,RED:15158332,GREY:9807270,NAVY:3426654,DARK_AQUA:1146986,DARK_GREEN:2067276,DARK_BLUE:2123412,DARK_PURPLE:7419530,DARK_GOLD:12745742,DARK_ORANGE:11027200,DARK_RED:10038562,DARK_GREY:9936031,DARKER_GREY:8359053,LIGHT_GREY:12370112,DARK_NAVY:2899536,BLURPLE:7506394,GREYPLE:10070709,DARK_BUT_NOT_BLACK:2895667,NOT_QUITE_BLACK:2303786},t.APIErrors={UNKNOWN_ACCOUNT:10001,UNKNOWN_APPLICATION:10002,UNKNOWN_CHANNEL:10003,UNKNOWN_GUILD:10004,UNKNOWN_INTEGRATION:10005,UNKNOWN_INVITE:10006,UNKNOWN_MEMBER:10007,UNKNOWN_MESSAGE:10008,UNKNOWN_OVERWRITE:10009,UNKNOWN_PROVIDER:10010,UNKNOWN_ROLE:10011,UNKNOWN_TOKEN:10012,UNKNOWN_USER:10013,UNKNOWN_EMOJI:10014,BOT_PROHIBITED_ENDPOINT:20001,BOT_ONLY_ENDPOINT:20002,MAXIMUM_GUILDS:30001,MAXIMUM_FRIENDS:30002,MAXIMUM_PINS:30003,MAXIMUM_ROLES:30005,MAXIMUM_REACTIONS:30010,UNAUTHORIZED:40001,MISSING_ACCESS:50001,INVALID_ACCOUNT_TYPE:50002,CANNOT_EXECUTE_ON_DM:50003,EMBED_DISABLED:50004,CANNOT_EDIT_MESSAGE_BY_OTHER:50005,CANNOT_SEND_EMPTY_MESSAGE:50006,CANNOT_MESSAGE_USER:50007,CANNOT_SEND_MESSAGES_IN_VOICE_CHANNEL:50008,CHANNEL_VERIFICATION_LEVEL_TOO_HIGH:50009,OAUTH2_APPLICATION_BOT_ABSENT:50010,MAXIMUM_OAUTH2_APPLICATIONS:50011,INVALID_OAUTH_STATE:50012,MISSING_PERMISSIONS:50013,INVALID_AUTHENTICATION_TOKEN:50014,NOTE_TOO_LONG:50015,INVALID_BULK_DELETE_QUANTITY:50016,CANNOT_PIN_MESSAGE_IN_OTHER_CHANNEL:50019,CANNOT_EXECUTE_ON_SYSTEM_MESSAGE:50021,BULK_DELETE_MESSAGE_TOO_OLD:50034,INVITE_ACCEPTED_TO_GUILD_NOT_CONTANING_BOT:50036,REACTION_BLOCKED:90001}}).call(t,i(7))},function(e,t){class i{constructor(e){this.packetManager=e}handle(e){return e}}e.exports=i},function(e,t){class i{constructor(e){this.client=e}handle(e){return e}}e.exports=i},function(e,t){class i extends Map{constructor(e){super(e),Object.defineProperty(this,"_array",{value:null,writable:!0,configurable:!0}),Object.defineProperty(this,"_keyArray",{value:null,writable:!0,configurable:!0})}set(e,t){return this._array=null,this._keyArray=null,super.set(e,t)}delete(e){return this._array=null,this._keyArray=null,super.delete(e)}array(){return this._array&&this._array.length===this.size||(this._array=Array.from(this.values())),this._array}keyArray(){return this._keyArray&&this._keyArray.length===this.size||(this._keyArray=Array.from(this.keys())),this._keyArray}first(e){if(void 0===e)return this.values().next().value;if("number"!=typeof e)throw new TypeError("The count must be a number.");if(!Number.isInteger(e)||e<1)throw new RangeError("The count must be an integer greater than 0.");e=Math.min(this.size,e);const t=new Array(e),i=this.values();for(let n=0;n{const n=e.get(i);return n!==t||void 0===n&&!e.has(i)}))}sort(e=((e,t)=>+(e>t)||+(e===t)-1)){return new i(Array.from(this.entries()).sort((t,i)=>e(t[1],i[1],t[0],i[0])))}}e.exports=i},function(e,t,i){(function(t){const n=i(32),s=i(0),r=s.DefaultOptions.http;class o{constructor(){throw new Error(`The ${this.constructor.name} class may not be instantiated.`)}static splitMessage(e,{maxLength:t=1950,char:i="\n",prepend:n="",append:s=""}={}){if(e.length<=t)return e;const r=e.split(i);if(1===r.length)throw new Error("Message exceeds the max length and contains no split characters.");const o=[""];let a=0;for(let e=0;et&&(o[a]+=s,o.push(n),a++),o[a]+=(o[a].length>0&&o[a]!==n?i:"")+r[e];return o}static escapeMarkdown(e,t=!1,i=!1){return t?e.replace(/```/g,"`​``"):i?e.replace(/\\(`|\\)/g,"$1").replace(/(`|\\)/g,"\\$1"):e.replace(/\\(\*|_|`|~|\\)/g,"$1").replace(/(\*|_|`|~|\\)/g,"\\$1")}static fetchRecommendedShards(e,t=1e3){return new Promise((i,o)=>{if(!e)throw new Error("A token must be provided.");n.get(`${r.host}/api/v${r.version}${s.Endpoints.gateway.bot}`).set("Authorization",`Bot ${e.replace(/^Bot\s*/i,"")}`).end((e,n)=>{e&&o(e),i(n.body.shards*(1e3/t))})})}static parseEmoji(e){if(e.includes("%")&&(e=decodeURIComponent(e)),e.includes(":")){const[t,i]=e.split(":");return{name:t,id:i}}return{name:e,id:null}}static arraysEqual(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(const i of e){const e=t.indexOf(i);-1!==e&&t.splice(e,1)}return 0===t.length}static cloneObject(e){return Object.assign(Object.create(e),e)}static mergeDefault(e,t){if(!t)return e;for(const i in e)!{}.hasOwnProperty.call(t,i)?t[i]=e[i]:t[i]===Object(t[i])&&(t[i]=this.mergeDefault(e[i],t[i]));return t}static convertToBuffer(e){return"string"==typeof e&&(e=this.str2ab(e)),t.from(e)}static str2ab(e){const t=new ArrayBuffer(2*e.length),i=new Uint16Array(t);for(var n=0,s=e.length;n-1&&i=n())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+n().toString(16)+" bytes");return 0|e}function f(e,t){if(r.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var i=e.length;if(0===i)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return i;case"utf8":case"utf-8":case void 0:return H(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*i;case"hex":return i>>>1;case"base64":return F(e).length;default:if(n)return H(e).length;t=(""+t).toLowerCase(),n=!0}}function g(e,t,i){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===i||i>this.length)&&(i=this.length),i<=0)return"";if(i>>>=0,t>>>=0,i<=t)return"";for(e||(e="utf8");;)switch(e){case"hex":return C(this,t,i);case"utf8":case"utf-8":return S(this,t,i);case"ascii":return M(this,t,i);case"latin1":case"binary":return D(this,t,i);case"base64":return R(this,t,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,t,i);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function v(e,t,i){var n=e[t];e[t]=e[i],e[i]=n}function E(e,t,i,n,s){if(0===e.length)return-1;if("string"==typeof i?(n=i,i=0):i>2147483647?i=2147483647:i<-2147483648&&(i=-2147483648),i=+i,isNaN(i)&&(i=s?0:e.length-1),i<0&&(i=e.length+i),i>=e.length){if(s)return-1;i=e.length-1}else if(i<0){if(!s)return-1;i=0}if("string"==typeof t&&(t=r.from(t,n)),r.isBuffer(t))return 0===t.length?-1:b(e,t,i,n,s);if("number"==typeof t)return t&=255,r.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?s?Uint8Array.prototype.indexOf.call(e,t,i):Uint8Array.prototype.lastIndexOf.call(e,t,i):b(e,[t],i,n,s);throw new TypeError("val must be string, number or Buffer")}function b(e,t,i,n,s){function r(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}var o=1,a=e.length,c=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;o=2,a/=2,c/=2,i/=2}var l;if(s){var h=-1;for(l=i;la&&(i=a-c),l=i;l>=0;l--){for(var u=!0,d=0;ds&&(n=s):n=s;var r=t.length;if(r%2!=0)throw new TypeError("Invalid hex string");n>r/2&&(n=r/2);for(var o=0;o239?4:r>223?3:r>191?2:1;if(s+a<=i){var c,l,h,u;switch(a){case 1:r<128&&(o=r);break;case 2:128==(192&(c=e[s+1]))&&(u=(31&r)<<6|63&c)>127&&(o=u);break;case 3:c=e[s+1],l=e[s+2],128==(192&c)&&128==(192&l)&&(u=(15&r)<<12|(63&c)<<6|63&l)>2047&&(u<55296||u>57343)&&(o=u);break;case 4:c=e[s+1],l=e[s+2],h=e[s+3],128==(192&c)&&128==(192&l)&&128==(192&h)&&(u=(15&r)<<18|(63&c)<<12|(63&l)<<6|63&h)>65535&&u<1114112&&(o=u)}}null===o?(o=65533,a=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|1023&o),n.push(o),s+=a}return k(n)}function k(e){var t=e.length;if(t<=Z)return String.fromCharCode.apply(String,e);for(var i="",n=0;nn)&&(i=n);for(var s="",r=t;ri)throw new RangeError("Trying to access beyond buffer length")}function N(e,t,i,n,s,o){if(!r.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>s||te.length)throw new RangeError("Index out of range")}function O(e,t,i,n){t<0&&(t=65535+t+1);for(var s=0,r=Math.min(e.length-i,2);s>>8*(n?s:1-s)}function L(e,t,i,n){t<0&&(t=4294967295+t+1);for(var s=0,r=Math.min(e.length-i,4);s>>8*(n?s:3-s)&255}function P(e,t,i,n,s,r){if(i+n>e.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("Index out of range")}function j(e,t,i,n,s){return s||P(e,t,i,4,3.4028234663852886e38,-3.4028234663852886e38),J.write(e,t,i,n,23,4),i+4}function G(e,t,i,n,s){return s||P(e,t,i,8,1.7976931348623157e308,-1.7976931348623157e308),J.write(e,t,i,n,52,8),i+8}function q(e){if((e=B(e).replace(Q,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}function B(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function $(e){return e<16?"0"+e.toString(16):e.toString(16)}function H(e,t){t=t||1/0;for(var i,n=e.length,s=null,r=[],o=0;o55295&&i<57344){if(!s){if(i>56319){(t-=3)>-1&&r.push(239,191,189);continue}if(o+1===n){(t-=3)>-1&&r.push(239,191,189);continue}s=i;continue}if(i<56320){(t-=3)>-1&&r.push(239,191,189),s=i;continue}i=65536+(s-55296<<10|i-56320)}else s&&(t-=3)>-1&&r.push(239,191,189);if(s=null,i<128){if((t-=1)<0)break;r.push(i)}else if(i<2048){if((t-=2)<0)break;r.push(i>>6|192,63&i|128)}else if(i<65536){if((t-=3)<0)break;r.push(i>>12|224,i>>6&63|128,63&i|128)}else{if(!(i<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;r.push(i>>18|240,i>>12&63|128,i>>6&63|128,63&i|128)}}return r}function z(e){for(var t=[],i=0;i>8,s=i%256,r.push(s),r.push(n);return r}function F(e){return Y.toByteArray(q(e))}function V(e,t,i,n){for(var s=0;s=t.length||s>=e.length);++s)t[s+i]=e[s];return s}function K(e){return e!==e}var Y=i(77),J=i(78),X=i(45);t.Buffer=r,t.SlowBuffer=function(e){return+e!=e&&(e=0),r.alloc(+e)},t.INSPECT_MAX_BYTES=50,r.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}(),t.kMaxLength=n(),r.poolSize=8192,r._augment=function(e){return e.__proto__=r.prototype,e},r.from=function(e,t,i){return o(null,e,t,i)},r.TYPED_ARRAY_SUPPORT&&(r.prototype.__proto__=Uint8Array.prototype,r.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&r[Symbol.species]===r&&Object.defineProperty(r,Symbol.species,{value:null,configurable:!0})),r.alloc=function(e,t,i){return c(null,e,t,i)},r.allocUnsafe=function(e){return l(null,e)},r.allocUnsafeSlow=function(e){return l(null,e)},r.isBuffer=function(e){return!(null==e||!e._isBuffer)},r.compare=function(e,t){if(!r.isBuffer(e)||!r.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var i=e.length,n=t.length,s=0,o=Math.min(i,n);s0&&(e=this.toString("hex",0,i).match(/.{2}/g).join(" "),this.length>i&&(e+=" ... ")),""},r.prototype.compare=function(e,t,i,n,s){if(!r.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===i&&(i=e?e.length:0),void 0===n&&(n=0),void 0===s&&(s=this.length),t<0||i>e.length||n<0||s>this.length)throw new RangeError("out of range index");if(n>=s&&t>=i)return 0;if(n>=s)return-1;if(t>=i)return 1;if(t>>>=0,i>>>=0,n>>>=0,s>>>=0,this===e)return 0;for(var o=s-n,a=i-t,c=Math.min(o,a),l=this.slice(n,s),h=e.slice(t,i),u=0;us)&&(i=s),e.length>0&&(i<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var r=!1;;)switch(n){case"hex":return _(this,e,t,i);case"utf8":case"utf-8":return y(this,e,t,i);case"ascii":return w(this,e,t,i);case"latin1":case"binary":return x(this,e,t,i);case"base64":return A(this,e,t,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,e,t,i);default:if(r)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),r=!0}},r.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Z=4096;r.prototype.slice=function(e,t){var i=this.length;e=~~e,t=void 0===t?i:~~t,e<0?(e+=i)<0&&(e=0):e>i&&(e=i),t<0?(t+=i)<0&&(t=0):t>i&&(t=i),t0&&(s*=256);)n+=this[e+--t]*s;return n},r.prototype.readUInt8=function(e,t){return t||U(e,1,this.length),this[e]},r.prototype.readUInt16LE=function(e,t){return t||U(e,2,this.length),this[e]|this[e+1]<<8},r.prototype.readUInt16BE=function(e,t){return t||U(e,2,this.length),this[e]<<8|this[e+1]},r.prototype.readUInt32LE=function(e,t){return t||U(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},r.prototype.readUInt32BE=function(e,t){return t||U(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},r.prototype.readIntLE=function(e,t,i){e|=0,t|=0,i||U(e,t,this.length);for(var n=this[e],s=1,r=0;++r=s&&(n-=Math.pow(2,8*t)),n},r.prototype.readIntBE=function(e,t,i){e|=0,t|=0,i||U(e,t,this.length);for(var n=t,s=1,r=this[e+--n];n>0&&(s*=256);)r+=this[e+--n]*s;return s*=128,r>=s&&(r-=Math.pow(2,8*t)),r},r.prototype.readInt8=function(e,t){return t||U(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},r.prototype.readInt16LE=function(e,t){t||U(e,2,this.length);var i=this[e]|this[e+1]<<8;return 32768&i?4294901760|i:i},r.prototype.readInt16BE=function(e,t){t||U(e,2,this.length);var i=this[e+1]|this[e]<<8;return 32768&i?4294901760|i:i},r.prototype.readInt32LE=function(e,t){return t||U(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},r.prototype.readInt32BE=function(e,t){return t||U(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},r.prototype.readFloatLE=function(e,t){return t||U(e,4,this.length),J.read(this,e,!0,23,4)},r.prototype.readFloatBE=function(e,t){return t||U(e,4,this.length),J.read(this,e,!1,23,4)},r.prototype.readDoubleLE=function(e,t){return t||U(e,8,this.length),J.read(this,e,!0,52,8)},r.prototype.readDoubleBE=function(e,t){return t||U(e,8,this.length),J.read(this,e,!1,52,8)},r.prototype.writeUIntLE=function(e,t,i,n){e=+e,t|=0,i|=0,n||N(this,e,t,i,Math.pow(2,8*i)-1,0);var s=1,r=0;for(this[t]=255&e;++r=0&&(r*=256);)this[t+s]=e/r&255;return t+i},r.prototype.writeUInt8=function(e,t,i){return e=+e,t|=0,i||N(this,e,t,1,255,0),r.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},r.prototype.writeUInt16LE=function(e,t,i){return e=+e,t|=0,i||N(this,e,t,2,65535,0),r.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):O(this,e,t,!0),t+2},r.prototype.writeUInt16BE=function(e,t,i){return e=+e,t|=0,i||N(this,e,t,2,65535,0),r.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):O(this,e,t,!1),t+2},r.prototype.writeUInt32LE=function(e,t,i){return e=+e,t|=0,i||N(this,e,t,4,4294967295,0),r.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):L(this,e,t,!0),t+4},r.prototype.writeUInt32BE=function(e,t,i){return e=+e,t|=0,i||N(this,e,t,4,4294967295,0),r.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):L(this,e,t,!1),t+4},r.prototype.writeIntLE=function(e,t,i,n){if(e=+e,t|=0,!n){var s=Math.pow(2,8*i-1);N(this,e,t,i,s-1,-s)}var r=0,o=1,a=0;for(this[t]=255&e;++r>0)-a&255;return t+i},r.prototype.writeIntBE=function(e,t,i,n){if(e=+e,t|=0,!n){var s=Math.pow(2,8*i-1);N(this,e,t,i,s-1,-s)}var r=i-1,o=1,a=0;for(this[t+r]=255&e;--r>=0&&(o*=256);)e<0&&0===a&&0!==this[t+r+1]&&(a=1),this[t+r]=(e/o>>0)-a&255;return t+i},r.prototype.writeInt8=function(e,t,i){return e=+e,t|=0,i||N(this,e,t,1,127,-128),r.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},r.prototype.writeInt16LE=function(e,t,i){return e=+e,t|=0,i||N(this,e,t,2,32767,-32768),r.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):O(this,e,t,!0),t+2},r.prototype.writeInt16BE=function(e,t,i){return e=+e,t|=0,i||N(this,e,t,2,32767,-32768),r.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):O(this,e,t,!1),t+2},r.prototype.writeInt32LE=function(e,t,i){return e=+e,t|=0,i||N(this,e,t,4,2147483647,-2147483648),r.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):L(this,e,t,!0),t+4},r.prototype.writeInt32BE=function(e,t,i){return e=+e,t|=0,i||N(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),r.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):L(this,e,t,!1),t+4},r.prototype.writeFloatLE=function(e,t,i){return j(this,e,t,!0,i)},r.prototype.writeFloatBE=function(e,t,i){return j(this,e,t,!1,i)},r.prototype.writeDoubleLE=function(e,t,i){return G(this,e,t,!0,i)},r.prototype.writeDoubleBE=function(e,t,i){return G(this,e,t,!1,i)},r.prototype.copy=function(e,t,i,n){if(i||(i=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t=0;--s)e[s+t]=this[s+i];else if(o<1e3||!r.TYPED_ARRAY_SUPPORT)for(s=0;s>>=0,i=void 0===i?this.length:i>>>0,e||(e=0);var o;if("number"==typeof e)for(o=t;o1)for(var i=1;i=t?String(e):(String(i).repeat(t)+e).slice(-t)}const s=i(37),r=14200704e5;let o=0;class a{constructor(){throw new Error(`The ${this.constructor.name} class may not be instantiated.`)}static generate(){o>=4095&&(o=0);const e=`${n((Date.now()-r).toString(2),42)}0000100000${n((o++).toString(2),12)}`;return s.fromString(e,2).toString()}static deconstruct(e){const t=n(s.fromString(e).toString(2),64),i={timestamp:parseInt(t.substring(0,42),2)+r,workerID:parseInt(t.substring(42,47),2),processID:parseInt(t.substring(47,52),2),increment:parseInt(t.substring(52,64),2),binary:t};return Object.defineProperty(i,"date",{get:function(){return new Date(this.timestamp)},enumerable:!0}),i}}e.exports=a},function(e,t){function i(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function n(e){return"function"==typeof e}function s(e){return"number"==typeof e}function r(e){return"object"==typeof e&&null!==e}function o(e){return void 0===e}e.exports=i,i.EventEmitter=i,i.prototype._events=void 0,i.prototype._maxListeners=void 0,i.defaultMaxListeners=10,i.prototype.setMaxListeners=function(e){if(!s(e)||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},i.prototype.emit=function(e){var t,i,s,a,c,l;if(this._events||(this._events={}),"error"===e&&(!this._events.error||r(this._events.error)&&!this._events.error.length)){if((t=arguments[1])instanceof Error)throw t;var h=new Error('Uncaught, unspecified "error" event. ('+t+")");throw h.context=t,h}if(i=this._events[e],o(i))return!1;if(n(i))switch(arguments.length){case 1:i.call(this);break;case 2:i.call(this,arguments[1]);break;case 3:i.call(this,arguments[1],arguments[2]);break;default:a=Array.prototype.slice.call(arguments,1),i.apply(this,a)}else if(r(i))for(a=Array.prototype.slice.call(arguments,1),s=(l=i.slice()).length,c=0;c0&&this._events[e].length>s&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace()),this},i.prototype.on=i.prototype.addListener,i.prototype.once=function(e,t){function i(){this.removeListener(e,i),s||(s=!0,t.apply(this,arguments))}if(!n(t))throw TypeError("listener must be a function");var s=!1;return i.listener=t,this.on(e,i),this},i.prototype.removeListener=function(e,t){var i,s,o,a;if(!n(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(i=this._events[e],o=i.length,s=-1,i===t||n(i.listener)&&i.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(r(i)){for(a=o;a-- >0;)if(i[a]===t||i[a].listener&&i[a].listener===t){s=a;break}if(s<0)return this;1===i.length?(i.length=0,delete this._events[e]):i.splice(s,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},i.prototype.removeAllListeners=function(e){var t,i;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(i=this._events[e],n(i))this.removeListener(e,i);else if(i)for(;i.length;)this.removeListener(e,i[i.length-1]);return delete this._events[e],this},i.prototype.listeners=function(e){return this._events&&this._events[e]?n(this._events[e])?[this._events[e]]:this._events[e].slice():[]},i.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(n(t))return 1;if(t)return t.length}return 0},i.listenerCount=function(e,t){return e.listenerCount(t)}},function(e,t){"function"==typeof Object.create?e.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(e,t){e.super_=t;var i=function(){};i.prototype=t.prototype,e.prototype=new i,e.prototype.constructor=e}},function(e,t,i){const n=i(0),s=i(13);class r{constructor(e,t){t="object"!=typeof e||e instanceof Array?e:t,this._member="object"==typeof e?e:null,this.bitfield="number"==typeof t?t:this.constructor.resolve(t)}get member(){return this._member}set member(e){this._member=e}get raw(){return this.bitfield}set raw(e){this.bitfield=e}has(e,t=!0){return e instanceof Array?e.every(e=>this.has(e,t)):(e=this.constructor.resolve(e),!!(t&&(this.bitfield&this.constructor.FLAGS.ADMINISTRATOR)>0)||(this.bitfield&e)===e)}missing(e,t=!0){return e.filter(e=>!this.has(e,t))}add(...e){let t=0;for(let i=0;ithis.resolve(e)).reduce((e,t)=>e|t,0);if("string"==typeof e&&(e=this.FLAGS[e]),"number"!=typeof e||e<1)throw new RangeError(n.Errors.NOT_A_PERMISSION);return e}}r.FLAGS={CREATE_INSTANT_INVITE:1,KICK_MEMBERS:2,BAN_MEMBERS:4,ADMINISTRATOR:8,MANAGE_CHANNELS:16,MANAGE_GUILD:32,ADD_REACTIONS:64,VIEW_AUDIT_LOG:128,VIEW_CHANNEL:1024,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},r.ALL=Object.keys(r.FLAGS).reduce((e,t)=>e|r.FLAGS[t],0),r.DEFAULT=104324097,r.prototype.hasPermission=s.deprecate(r.prototype.hasPermission,"EvaluatedPermissions#hasPermission is deprecated, use Permissions#has instead"),r.prototype.hasPermissions=s.deprecate(r.prototype.hasPermissions,"EvaluatedPermissions#hasPermissions is deprecated, use Permissions#has instead"),r.prototype.missingPermissions=s.deprecate(r.prototype.missingPermissions,"EvaluatedPermissions#missingPermissions is deprecated, use Permissions#missing instead"),Object.defineProperty(r.prototype,"member",{get:s.deprecate(Object.getOwnPropertyDescriptor(r.prototype,"member").get,"EvaluatedPermissions#member is deprecated")}),e.exports=r},function(e,t,i){"use strict";function n(e){if(!(this instanceof n))return new n(e);l.call(this,e),h.call(this,e),e&&!1===e.readable&&(this.readable=!1),e&&!1===e.writable&&(this.writable=!1),this.allowHalfOpen=!0,e&&!1===e.allowHalfOpen&&(this.allowHalfOpen=!1),this.once("end",s)}function s(){this.allowHalfOpen||this._writableState.ended||o(r,this)}function r(e){e.end()}var o=i(26),a=Object.keys||function(e){var t=[];for(var i in e)t.push(i);return t};e.exports=n;var c=i(19);c.inherits=i(10);var l=i(46),h=i(34);c.inherits(n,l);for(var u=a(h.prototype),d=0;d=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),f(i)?n.showHidden=i:i&&t._extend(n,i),b(n.showHidden)&&(n.showHidden=!1),b(n.depth)&&(n.depth=2),b(n.colors)&&(n.colors=!1),b(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=r),c(n,e,n.depth)}function r(e,t){var i=s.styles[t];return i?"["+s.colors[i][0]+"m"+e+"["+s.colors[i][1]+"m":e}function o(e,t){return e}function a(e){var t={};return e.forEach(function(e,i){t[e]=!0}),t}function c(e,i,n){if(e.customInspect&&i&&A(i.inspect)&&i.inspect!==t.inspect&&(!i.constructor||i.constructor.prototype!==i)){var s=i.inspect(n,e);return E(s)||(s=c(e,s,n)),s}var r=l(e,i);if(r)return r;var o=Object.keys(i),f=a(o);if(e.showHidden&&(o=Object.getOwnPropertyNames(i)),x(i)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return h(i);if(0===o.length){if(A(i)){var g=i.name?": "+i.name:"";return e.stylize("[Function"+g+"]","special")}if(_(i))return e.stylize(RegExp.prototype.toString.call(i),"regexp");if(w(i))return e.stylize(Date.prototype.toString.call(i),"date");if(x(i))return h(i)}var v="",b=!1,y=["{","}"];if(m(i)&&(b=!0,y=["[","]"]),A(i)&&(v=" [Function"+(i.name?": "+i.name:"")+"]"),_(i)&&(v=" "+RegExp.prototype.toString.call(i)),w(i)&&(v=" "+Date.prototype.toUTCString.call(i)),x(i)&&(v=" "+h(i)),0===o.length&&(!b||0==i.length))return y[0]+v+y[1];if(n<0)return _(i)?e.stylize(RegExp.prototype.toString.call(i),"regexp"):e.stylize("[Object]","special");e.seen.push(i);var T;return T=b?u(e,i,n,f,o):o.map(function(t){return d(e,i,n,f,t,b)}),e.seen.pop(),p(T,v,y)}function l(e,t){if(b(t))return e.stylize("undefined","undefined");if(E(t)){var i="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(i,"string")}return v(t)?e.stylize(""+t,"number"):f(t)?e.stylize(""+t,"boolean"):g(t)?e.stylize("null","null"):void 0}function h(e){return"["+Error.prototype.toString.call(e)+"]"}function u(e,t,i,n,s){for(var r=[],o=0,a=t.length;o-1&&(a=r?a.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+a.split("\n").map(function(e){return" "+e}).join("\n")):a=e.stylize("[Circular]","special")),b(o)){if(r&&s.match(/^\d+$/))return a;(o=JSON.stringify(""+s)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(o=o.substr(1,o.length-2),o=e.stylize(o,"name")):(o=o.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),o=e.stylize(o,"string"))}return o+": "+a}function p(e,t,i){var n=0;return e.reduce(function(e,t){return n++,t.indexOf("\n")>=0&&n++,e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0)>60?i[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+i[1]:i[0]+t+" "+e.join(", ")+" "+i[1]}function m(e){return Array.isArray(e)}function f(e){return"boolean"==typeof e}function g(e){return null===e}function v(e){return"number"==typeof e}function E(e){return"string"==typeof e}function b(e){return void 0===e}function _(e){return y(e)&&"[object RegExp]"===T(e)}function y(e){return"object"==typeof e&&null!==e}function w(e){return y(e)&&"[object Date]"===T(e)}function x(e){return y(e)&&("[object Error]"===T(e)||e instanceof Error)}function A(e){return"function"==typeof e}function T(e){return Object.prototype.toString.call(e)}function R(e){return e<10?"0"+e.toString(10):e.toString(10)}function S(){var e=new Date,t=[R(e.getHours()),R(e.getMinutes()),R(e.getSeconds())].join(":");return[e.getDate(),I[e.getMonth()],t].join(" ")}function k(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var M=/%[sdj%]/g;t.format=function(e){if(!E(e)){for(var t=[],i=0;i=r)return e;switch(e){case"%s":return String(n[i++]);case"%d":return Number(n[i++]);case"%j":try{return JSON.stringify(n[i++])}catch(e){return"[Circular]"}default:return e}}),a=n[i];i"dm"===e.type).find(e=>e.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(e){return this.client.rest.methods.setNote(this,e)}equals(e){return e&&this.id===e.id&&this.username===e.username&&this.discriminator===e.discriminator&&this.avatar===e.avatar&&this.bot===Boolean(e.bot)}toString(){return`<@${this.id}>`}send(){}sendMessage(){}sendEmbed(){}sendFile(){}sendCode(){}}n.applyToClass(a),e.exports=a},function(e,t,i){const n=i(8),s=i(11),r=i(13);class o{constructor(e,t){Object.defineProperty(this,"client",{value:e.client}),this.guild=e,t&&this.setup(t)}setup(e){this.id=e.id,this.name=e.name,this.color=e.color,this.hoist=e.hoist,this.position=e.position,this.permissions=e.permissions,this.managed=e.managed,this.mentionable=e.mentionable}get createdTimestamp(){return n.deconstruct(this.id).timestamp}get createdAt(){return new Date(this.createdTimestamp)}get hexColor(){let e=this.color.toString(16);for(;e.length<6;)e=`0${e}`;return`#${e}`}get members(){return this.guild.members.filter(e=>e.roles.has(this.id))}get editable(){if(this.managed)return!1;const e=this.guild.member(this.client.user);return!!e.permissions.has(s.FLAGS.MANAGE_ROLES_OR_PERMISSIONS)&&e.highestRole.comparePositionTo(this)>0}get calculatedPosition(){const e=this.guild._sortedRoles;return e.array().indexOf(e.get(this.id))}serialize(){return new s(this.permissions).serialize()}hasPermission(e,t=!1,i){return new s(this.permissions).has(e,void 0!==i?i:!t)}hasPermissions(e,t=!1){return new s(this.permissions).has(e,!t)}comparePositionTo(e){return this.constructor.comparePositions(this,e)}edit(e,t){return this.client.rest.methods.updateGuildRole(this,e,t)}setName(e,t){return this.edit({name:e},t)}setColor(e,t){return this.edit({color:e},t)}setHoist(e,t){return this.edit({hoist:e},t)}setPosition(e,t){return this.guild.setRolePosition(this,e,t).then(()=>this)}setPermissions(e,t){return this.edit({permissions:e},t)}setMentionable(e,t){return this.edit({mentionable:e},t)}delete(e){return this.client.rest.methods.deleteGuildRole(this,e)}equals(e){return e&&this.id===e.id&&this.name===e.name&&this.color===e.color&&this.hoist===e.hoist&&this.position===e.position&&this.permissions===e.permissions&&this.managed===e.managed}toString(){return this.id===this.guild.id?"@everyone":`<@&${this.id}>`}static comparePositions(e,t){return e.position===t.position?t.id-e.id:e.position-t.position}}o.prototype.hasPermissions=r.deprecate(o.prototype.hasPermissions,"Role#hasPermissions is deprecated - use Role#hasPermission instead, it now takes an array"),e.exports=o},function(e,t){class i{constructor(e={}){this.status=e.status||"offline",this.game=e.game?new n(e.game):null}update(e){this.status=e.status||this.status,this.game=e.game?new n(e.game):null}equals(e){return this===e||(e&&this.status===e.status&&this.game?this.game.equals(e.game):!e.game)}}class n{constructor(e){this.name=e.name,this.type=e.type,this.url=e.url||null}get streaming(){return 1===this.type}equals(e){return this===e||e&&this.name===e.name&&this.type===e.type&&this.url===e.url}}t.Presence=i,t.Game=n},function(e,t,i){const n=i(8);class s{constructor(e,t){Object.defineProperty(this,"client",{value:e}),this.type=null,t&&this.setup(t)}setup(e){this.id=e.id}get createdTimestamp(){return n.deconstruct(this.id).timestamp}get createdAt(){return new Date(this.createdTimestamp)}delete(){return this.client.rest.methods.deleteChannel(this)}}e.exports=s},function(e,t,i){(t=e.exports=i(46)).Stream=t,t.Readable=t,t.Writable=i(34),t.Duplex=i(12),t.Transform=i(50),t.PassThrough=i(85)},function(e,t,i){(function(e){function i(e){return Object.prototype.toString.call(e)}t.isArray=function(e){return Array.isArray?Array.isArray(e):"[object Array]"===i(e)},t.isBoolean=function(e){return"boolean"==typeof e},t.isNull=function(e){return null===e},t.isNullOrUndefined=function(e){return null==e},t.isNumber=function(e){return"number"==typeof e},t.isString=function(e){return"string"==typeof e},t.isSymbol=function(e){return"symbol"==typeof e},t.isUndefined=function(e){return void 0===e},t.isRegExp=function(e){return"[object RegExp]"===i(e)},t.isObject=function(e){return"object"==typeof e&&null!==e},t.isDate=function(e){return"[object Date]"===i(e)},t.isError=function(e){return"[object Error]"===i(e)||e instanceof Error},t.isFunction=function(e){return"function"==typeof e},t.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},t.isBuffer=e.isBuffer}).call(t,i(5).Buffer)},function(e,t,i){(function(e){function i(e,t){for(var i=0,n=e.length-1;n>=0;n--){var s=e[n];"."===s?e.splice(n,1):".."===s?(e.splice(n,1),i++):i&&(e.splice(n,1),i--)}if(t)for(;i--;i)e.unshift("..");return e}function n(e,t){if(e.filter)return e.filter(t);for(var i=[],n=0;n=-1&&!s;r--){var o=r>=0?arguments[r]:e.cwd();if("string"!=typeof o)throw new TypeError("Arguments to path.resolve must be strings");o&&(t=o+"/"+t,s="/"===o.charAt(0))}return t=i(n(t.split("/"),function(e){return!!e}),!s).join("/"),(s?"/":"")+t||"."},t.normalize=function(e){var s=t.isAbsolute(e),r="/"===o(e,-1);return(e=i(n(e.split("/"),function(e){return!!e}),!s).join("/"))||s||(e="."),e&&r&&(e+="/"),(s?"/":"")+e},t.isAbsolute=function(e){return"/"===e.charAt(0)},t.join=function(){var e=Array.prototype.slice.call(arguments,0);return t.normalize(n(e,function(e,t){if("string"!=typeof e)throw new TypeError("Arguments to path.join must be strings");return e}).join("/"))},t.relative=function(e,i){function n(e){for(var t=0;t=0&&""===e[i];i--);return t>i?[]:e.slice(t,i-t+1)}e=t.resolve(e).substr(1),i=t.resolve(i).substr(1);for(var s=n(e.split("/")),r=n(i.split("/")),o=Math.min(s.length,r.length),a=o,c=0;cthis.client.resolver.resolveFile(e.attachment).then(t=>(e.file=t,e)))).then(e=>this.client.rest.methods.sendMessage(this,t,i,e))}return this.client.rest.methods.sendMessage(this,t,i)}fetchMessage(e){return this.client.user.bot?this.client.rest.methods.getChannelMessage(this,e).then(e=>{const t=e instanceof s?e:new s(this,e,this.client);return this._cacheMessage(t),t}):this.fetchMessages({limit:1,around:e}).then(t=>{const i=t.get(e);if(!i)throw new Error("Message not found.");return i})}fetchMessages(e={}){return this.client.rest.methods.getChannelMessages(this,e).then(e=>{const t=new o;for(const i of e){const e=new s(this,i,this.client);t.set(i.id,e),this._cacheMessage(e)}return t})}fetchPinnedMessages(){return this.client.rest.methods.getChannelPinnedMessages(this).then(e=>{const t=new o;for(const i of e){const e=new s(this,i,this.client);t.set(i.id,e),this._cacheMessage(e)}return t})}search(e={}){return this.client.rest.methods.search(this,e)}startTyping(e){if(void 0!==e&&e<1)throw new RangeError("Count must be at least 1.");if(this.client.user._typing.has(this.id)){const t=this.client.user._typing.get(this.id);t.count=e||t.count+1}else this.client.user._typing.set(this.id,{count:e||1,interval:this.client.setInterval(()=>{this.client.rest.methods.sendTyping(this.id)},9e3)}),this.client.rest.methods.sendTyping(this.id)}stopTyping(e=!1){if(this.client.user._typing.has(this.id)){const t=this.client.user._typing.get(this.id);t.count--,(t.count<=0||e)&&(this.client.clearInterval(t.interval),this.client.user._typing.delete(this.id))}}get typing(){return this.client.user._typing.has(this.id)}get typingCount(){return this.client.user._typing.has(this.id)?this.client.user._typing.get(this.id).count:0}createCollector(e,t){return this.createMessageCollector(e,t)}createMessageCollector(e,t={}){return new r(this,e,t)}awaitMessages(e,t={}){return new Promise((i,n)=>{this.createCollector(e,t).once("end",(e,s)=>{t.errors&&t.errors.includes(s)?n(e):i(e)})})}bulkDelete(e,t=!1){if(!isNaN(e))return this.fetchMessages({limit:e}).then(e=>this.bulkDelete(e,t));if(e instanceof Array||e instanceof o){const i=e instanceof o?e.keyArray():e.map(e=>e.id);return this.client.rest.methods.bulkDeleteMessages(this,i,t)}throw new TypeError("The messages must be an Array, Collection, or number.")}acknowledge(){return this.lastMessageID?this.client.rest.methods.ackTextChannel(this):Promise.resolve(this)}_cacheMessage(e){const t=this.client.options.messageCacheMaxSize;return 0===t?null:(this.messages.size>=t&&t>0&&this.messages.delete(this.messages.firstKey()),this.messages.set(e.id,e),e)}}const u={sendMessage(e,t){return this.send(e,t)},sendEmbed(e,t,i){return i||"object"!=typeof t||t instanceof Array?i||(i={}):(i=t,t=""),this.send(t,Object.assign(i,{embed:e}))},sendFiles(e,t,i={}){return this.send(t,Object.assign(i,{files:e}))},sendFile(e,t,i,n={}){return this.send({files:[{attachment:e,name:t}],content:i,options:n})},sendCode(e,t,i={}){return this.send(t,Object.assign(i,{code:e}))}};for(const e of Object.keys(u))h.prototype[e]=l.deprecate(u[e],`TextChannel#${e}: use TextChannel#send instead`);t.applyToClass=((e,t=!1,i=[])=>{const n=["send","sendMessage","sendEmbed","sendFile","sendFiles","sendCode"];t&&n.push("_cacheMessage","acknowledge","fetchMessages","fetchMessage","search","bulkDelete","startTyping","stopTyping","typing","typingCount","fetchPinnedMessages","createCollector","createMessageCollector","awaitMessages");for(const t of n)i.includes(t)||Object.defineProperty(e.prototype,t,Object.getOwnPropertyDescriptor(h.prototype,t))})}).call(t,i(5).Buffer)},function(e,t,i){const n=i(57),s=i(58),r=i(59),o=i(28),a=i(60),c=i(61),l=i(4),h=i(3),u=i(0),d=i(11);let p;class m{constructor(e,t,i){Object.defineProperty(this,"client",{value:i}),this.channel=e,t&&this.setup(t)}setup(e){this.id=e.id,this.type=u.MessageTypes[e.type],this.content=e.content,this.author=this.client.dataManager.newUser(e.author),this.member=this.guild?this.guild.member(this.author)||null:null,this.pinned=e.pinned,this.tts=e.tts,this.nonce=e.nonce,this.system=6===e.type,this.embeds=e.embeds.map(e=>new r(this,e)),this.attachments=new h;for(const t of e.attachments)this.attachments.set(t.id,new s(this,t));if(this.createdTimestamp=new Date(e.timestamp).getTime(),this.editedTimestamp=e.edited_timestamp?new Date(e.edited_timestamp).getTime():null,this.reactions=new h,e.reactions&&e.reactions.length>0)for(const t of e.reactions){const e=t.emoji.id?`${t.emoji.name}:${t.emoji.id}`:t.emoji.name;this.reactions.set(e,new a(this,t.emoji,t.count,t.me))}this.mentions=new n(this,e.mentions,e.mention_roles,e.mention_everyone),this.webhookID=e.webhook_id||null,this.hit="boolean"==typeof e.hit?e.hit:null,this._edits=[]}patch(e){const t=l.cloneObject(this);if(this._edits.unshift(t),this.editedTimestamp=new Date(e.edited_timestamp).getTime(),"content"in e&&(this.content=e.content),"pinned"in e&&(this.pinned=e.pinned),"tts"in e&&(this.tts=e.tts),this.embeds="embeds"in e?e.embeds.map(e=>new r(this,e)):this.embeds.slice(),"attachments"in e){this.attachments=new h;for(const t of e.attachments)this.attachments.set(t.id,new s(this,t))}else this.attachments=new h(this.attachments);this.mentions=new n(this,"mentions"in e?e.mentions:this.mentions.users,"mentions_roles"in e?e.mentions_roles:this.mentions.roles,"mention_everyone"in e?e.mention_everyone:this.mentions.everyone)}get createdAt(){return new Date(this.createdTimestamp)}get editedAt(){return this.editedTimestamp?new Date(this.editedTimestamp):null}get guild(){return this.channel.guild||null}get cleanContent(){return this.content.replace(/@(everyone|here)/g,"@​$1").replace(/<@!?[0-9]+>/g,e=>{const t=e.replace(/<|!|>|@/g,"");if("dm"===this.channel.type||"group"===this.channel.type)return this.client.users.has(t)?`@${this.client.users.get(t).username}`:e;const i=this.channel.guild.members.get(t);if(i)return i.nickname?`@${i.nickname}`:`@${i.user.username}`;{const i=this.client.users.get(t);return i?`@${i.username}`:e}}).replace(/<#[0-9]+>/g,e=>{const t=this.client.channels.get(e.replace(/<|#|>/g,""));return t?`#${t.name}`:e}).replace(/<@&[0-9]+>/g,e=>{if("dm"===this.channel.type||"group"===this.channel.type)return e;const t=this.guild.roles.get(e.replace(/<|@|>|&/g,""));return t?`@${t.name}`:e})}createReactionCollector(e,t={}){return new c(this,e,t)}awaitReactions(e,t={}){return new Promise((i,n)=>{this.createReactionCollector(e,t).once("end",(e,s)=>{t.errors&&t.errors.includes(s)?n(e):i(e)})})}get edits(){const e=this._edits.slice();return e.unshift(this),e}get editable(){return this.author.id===this.client.user.id}get deletable(){return this.author.id===this.client.user.id||this.guild&&this.channel.permissionsFor(this.client.user).has(d.FLAGS.MANAGE_MESSAGES)}get pinnable(){return!this.guild||this.channel.permissionsFor(this.client.user).has(d.FLAGS.MANAGE_MESSAGES)}isMentioned(e){return e=e&&e.id?e.id:e,this.mentions.users.has(e)||this.mentions.channels.has(e)||this.mentions.roles.has(e)}isMemberMentioned(e){return p||(p=i(24)),!!this.mentions.everyone||(!!this.mentions.users.has(e.id)||!!(e instanceof p&&e.roles.some(e=>this.mentions.roles.has(e.id))))}edit(e,t){return t||"object"!=typeof e||e instanceof Array?t||(t={}):(t=e,e=""),t instanceof o&&(t={embed:t}),this.client.rest.methods.updateMessage(this,e,t)}editCode(e,t){return t=l.escapeMarkdown(this.client.resolver.resolveString(t),!0),this.edit(`\`\`\`${e||""}\n${t}\n\`\`\``)}pin(){return this.client.rest.methods.pinMessage(this)}unpin(){return this.client.rest.methods.unpinMessage(this)}react(e){if(!(e=this.client.resolver.resolveEmojiIdentifier(e)))throw new TypeError("Emoji must be a string or Emoji/ReactionEmoji");return this.client.rest.methods.addMessageReaction(this,e)}clearReactions(){return this.client.rest.methods.removeMessageReactions(this)}delete(e=0){return e<=0?this.client.rest.methods.deleteMessage(this):new Promise(t=>{this.client.setTimeout(()=>{t(this.delete())},e)})}reply(e,t){return t||"object"!=typeof e||e instanceof Array?t||(t={}):(t=e,e=""),this.channel.send(e,Object.assign(t,{reply:this.member||this.author}))}acknowledge(){return this.client.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(e,t){if(!e)return!1;if(!e.author&&!e.attachments)return this.id===e.id&&this.embeds.length===e.embeds.length;let i=this.id===e.id&&this.author.id===e.author.id&&this.content===e.content&&this.tts===e.tts&&this.nonce===e.nonce&&this.embeds.length===e.embeds.length&&this.attachments.length===e.attachments.length;return i&&t&&(i=this.mentions.everyone===e.mentions.everyone&&this.createdTimestamp===new Date(t.timestamp).getTime()&&this.editedTimestamp===new Date(t.edited_timestamp).getTime()),i}toString(){return this.content}_addReaction(e,t){const i=e.id?`${e.name}:${e.id}`:e.name;let n;return this.reactions.has(i)?(n=this.reactions.get(i)).me||(n.me=t.id===this.client.user.id):(n=new a(this,e,0,t.id===this.client.user.id),this.reactions.set(i,n)),n.users.has(t.id)||(n.users.set(t.id,t),n.count++),n}_removeReaction(e,t){const i=e.id?`${e.name}:${e.id}`:e.name;if(this.reactions.has(i)){const e=this.reactions.get(i);if(e.users.has(t.id))return e.users.delete(t.id),e.count--,t.id===this.client.user.id&&(e.me=!1),e.count<=0&&this.reactions.delete(i),e}return null}_clearReactions(){this.reactions.clear()}}e.exports=m},function(e,t,i){const n=i(0),s=i(3),r=i(8);class o{constructor(e,t){Object.defineProperty(this,"client",{value:e.client}),this.guild=e,this.setup(t)}setup(e){this.id=e.id,this.name=e.name,this.requiresColons=e.require_colons,this.managed=e.managed,this._roles=e.roles}get createdTimestamp(){return r.deconstruct(this.id).timestamp}get createdAt(){return new Date(this.createdTimestamp)}get roles(){const e=new s;for(const t of this._roles)this.guild.roles.has(t)&&e.set(t,this.guild.roles.get(t));return e}get url(){return n.Endpoints.CDN(this.client.options.http.cdn).Emoji(this.id)}get identifier(){return this.id?`${this.name}:${this.id}`:encodeURIComponent(this.name)}edit(e,t){return this.client.rest.methods.updateEmoji(this,e,t)}setName(e,t){return this.edit({name:e},t)}addRestrictedRole(e){return this.addRestrictedRoles([e])}addRestrictedRoles(e){const t=new s(this.roles);for(const i of e)this.guild.roles.has(i.id)&&t.set(i.id,i);return this.edit({roles:t})}removeRestrictedRole(e){return this.removeRestrictedRoles([e])}removeRestrictedRoles(e){const t=new s(this.roles);for(const i of e)t.has(i.id)&&t.delete(i.id);return this.edit({roles:t})}toString(){return this.requiresColons?`<:${this.name}:${this.id}>`:this.name}equals(e){return e instanceof o?e.id===this.id&&e.name===this.name&&e.managed===this.managed&&e.requiresColons===this.requiresColons:e.id===this.id&&e.name===this.name}}e.exports=o},function(e,t,i){const n=i(21),s=i(15),r=i(11),o=i(3),a=i(16).Presence,c=i(13);class l{constructor(e,t){Object.defineProperty(this,"client",{value:e.client}),this.guild=e,this.user={},this._roles=[],t&&this.setup(t),this.lastMessageID=null,this.lastMessage=null}setup(e){this.serverDeaf=e.deaf,this.serverMute=e.mute,this.selfMute=e.self_mute,this.selfDeaf=e.self_deaf,this.voiceSessionID=e.session_id,this.voiceChannelID=e.channel_id,this.speaking=!1,this.nickname=e.nick||null,this.joinedTimestamp=new Date(e.joined_at).getTime(),this.user=e.user,this._roles=e.roles}get joinedAt(){return new Date(this.joinedTimestamp)}get presence(){return this.frozenPresence||this.guild.presences.get(this.id)||new a}get roles(){const e=new o,t=this.guild.roles.get(this.guild.id);t&&e.set(t.id,t);for(const t of this._roles){const i=this.guild.roles.get(t);i&&e.set(i.id,i)}return e}get highestRole(){return this.roles.reduce((e,t)=>!e||t.comparePositionTo(e)>0?t:e)}get colorRole(){const e=this.roles.filter(e=>e.color);return e.size?e.reduce((e,t)=>!e||t.comparePositionTo(e)>0?t:e):null}get displayColor(){const e=this.colorRole;return e&&e.color||0}get displayHexColor(){const e=this.colorRole;return e&&e.hexColor||"#000000"}get hoistRole(){const e=this.roles.filter(e=>e.hoist);return e.size?e.reduce((e,t)=>!e||t.comparePositionTo(e)>0?t:e):null}get mute(){return this.selfMute||this.serverMute}get deaf(){return this.selfDeaf||this.serverDeaf}get voiceChannel(){return this.guild.channels.get(this.voiceChannelID)}get id(){return this.user.id}get displayName(){return this.nickname||this.user.username}get permissions(){if(this.user.id===this.guild.ownerID)return new r(this,r.ALL);let e=0;const t=this.roles;for(const i of t.values())e|=i.permissions;return new r(this,e)}get kickable(){if(this.user.id===this.guild.ownerID)return!1;if(this.user.id===this.client.user.id)return!1;const e=this.guild.member(this.client.user);return!!e.permissions.has(r.FLAGS.KICK_MEMBERS)&&e.highestRole.comparePositionTo(this.highestRole)>0}get bannable(){if(this.user.id===this.guild.ownerID)return!1;if(this.user.id===this.client.user.id)return!1;const e=this.guild.member(this.client.user);return!!e.permissions.has(r.FLAGS.BAN_MEMBERS)&&e.highestRole.comparePositionTo(this.highestRole)>0}permissionsIn(e){if(!(e=this.client.resolver.resolveChannel(e))||!e.guild)throw new Error("Could not resolve channel to a guild channel.");return e.permissionsFor(this)}hasPermission(e,t=!1,i,n){return void 0===i&&(i=!t),void 0===n&&(n=!t),!(!n||this.user.id!==this.guild.ownerID)||this.roles.some(t=>t.hasPermission(e,void 0,i))}hasPermissions(e,t=!1){return!t&&this.user.id===this.guild.ownerID||this.hasPermission(e,t)}missingPermissions(e,t=!1){return e.missing(e,t)}edit(e,t){return this.client.rest.methods.updateGuildMember(this,e,t)}setMute(e,t){return this.edit({mute:e},t)}setDeaf(e,t){return this.edit({deaf:e},t)}setVoiceChannel(e){return this.edit({channel:e})}setRoles(e,t){return this.edit({roles:e},t)}addRole(e,t){return e instanceof s||(e=this.guild.roles.get(e)),e?this.client.rest.methods.addMemberRole(this,e,t):Promise.reject(new TypeError("Supplied parameter was neither a Role nor a Snowflake."))}addRoles(e,t){let i;if(e instanceof o){i=this._roles.slice();for(const t of e.values())i.push(t.id)}else i=this._roles.concat(e);return this.edit({roles:i},t)}removeRole(e,t){return e instanceof s||(e=this.guild.roles.get(e)),e?this.client.rest.methods.removeMemberRole(this,e,t):Promise.reject(new TypeError("Supplied parameter was neither a Role nor a Snowflake."))}removeRoles(e,t){const i=this._roles.slice();if(e instanceof o)for(const t of e.values()){const e=i.indexOf(t.id);e>=0&&i.splice(e,1)}else for(const t of e){const e=i.indexOf(t instanceof s?t.id:t);e>=0&&i.splice(e,1)}return this.edit({roles:i},t)}setNickname(e,t){return this.edit({nick:e},t)}createDM(){return this.user.createDM()}deleteDM(){return this.user.deleteDM()}kick(e){return this.client.rest.methods.kickGuildMember(this.guild,this,e)}ban(e){return this.guild.ban(this,e)}toString(){return`<@${this.nickname?"!":""}${this.user.id}>`}send(){}sendMessage(){}sendEmbed(){}sendFile(){}sendCode(){}}n.applyToClass(l),l.prototype.hasPermissions=c.deprecate(l.prototype.hasPermissions,"GuildMember#hasPermissions is deprecated - use GuildMember#hasPermission, it now takes an array"),e.exports=l},function(e,t,i){function n(){s.call(this)}e.exports=n;var s=i(9).EventEmitter;i(10)(n,s),n.Readable=i(18),n.Writable=i(86),n.Duplex=i(87),n.Transform=i(88),n.PassThrough=i(89),n.Stream=n,n.prototype.pipe=function(e,t){function i(t){e.writable&&!1===e.write(t)&&l.pause&&l.pause()}function n(){l.readable&&l.resume&&l.resume()}function r(){h||(h=!0,e.end())}function o(){h||(h=!0,"function"==typeof e.destroy&&e.destroy())}function a(e){if(c(),0===s.listenerCount(this,"error"))throw e}function c(){l.removeListener("data",i),e.removeListener("drain",n),l.removeListener("end",r),l.removeListener("close",o),l.removeListener("error",a),e.removeListener("error",a),l.removeListener("end",c),l.removeListener("close",c),e.removeListener("close",c)}var l=this;l.on("data",i),e.on("drain",n),e._isStdio||t&&!1===t.end||(l.on("end",r),l.on("close",o));var h=!1;return l.on("error",a),e.on("error",a),l.on("end",c),l.on("close",c),e.on("close",c),e.emit("pipe",l),e}},function(e,t,i){"use strict";(function(t){!t.version||0===t.version.indexOf("v0.")||0===t.version.indexOf("v1.")&&0!==t.version.indexOf("v1.8.")?e.exports=function(e,i,n,s){if("function"!=typeof e)throw new TypeError('"callback" argument must be a function');var r,o,a=arguments.length;switch(a){case 0:case 1:return t.nextTick(e);case 2:return t.nextTick(function(){e.call(null,i)});case 3:return t.nextTick(function(){e.call(null,i,n)});case 4:return t.nextTick(function(){e.call(null,i,n,s)});default:for(r=new Array(a-1),o=0;o256)throw new RangeError("RichEmbed titles may not exceed 256 characters.");return this.title=e,this}setDescription(e){if((e=n(e)).length>2048)throw new RangeError("RichEmbed descriptions may not exceed 2048 characters.");return this.description=e,this}setURL(e){return this.url=e,this}setColor(e){return r||(r=i(38)),this.color=r.resolveColor(e),this}setAuthor(e,t,i){return this.author={name:n(e),icon_url:t,url:i},this}setTimestamp(e=new Date){return this.timestamp=e,this}addField(e,t,i=!1){if(this.fields.length>=25)throw new RangeError("RichEmbeds may not exceed 25 fields.");if((e=n(e)).length>256)throw new RangeError("RichEmbed field names may not exceed 256 characters.");if(!/\S/.test(e))throw new RangeError("RichEmbed field names may not be empty.");if((t=n(t)).length>1024)throw new RangeError("RichEmbed field values may not exceed 1024 characters.");if(!/\S/.test(t))throw new RangeError("RichEmbed field values may not be empty.");return this.fields.push({name:e,value:t,inline:i}),this}addBlankField(e=!1){return this.addField("​","​",e)}setThumbnail(e){return this.thumbnail={url:e},this}setImage(e){return this.image={url:e},this}setFooter(e,t){if((e=n(e)).length>2048)throw new RangeError("RichEmbed footer text may not exceed 2048 characters.");return this.footer={text:e,icon_url:t},this}attachFile(e){if(this.file)throw new RangeError("You may not upload more than one file at once.");return e instanceof s&&(e=e.file),this.file=e,this}}e.exports=o},function(e,t){class i{constructor(e,t){this.file=null,t?this.setAttachment(e,t):this._attach(e)}get name(){return this.file.name}get attachment(){return this.file.attachment}setAttachment(e,t){return this.file={attachment:e,name:t},this}setFile(e){return this.file={attachment:e},this}setName(e){return this.file.name=e,this}_attach(e,t){"string"==typeof e?this.file=e:this.setAttachment(e,t)}}e.exports=i},function(e,t,i){const n=i(13),s=i(37),r=i(14),o=i(15),a=i(23),c=i(16).Presence,l=i(24),h=i(0),u=i(3),d=i(4),p=i(8);class m{constructor(e,t){Object.defineProperty(this,"client",{value:e}),this.members=new u,this.channels=new u,this.roles=new u,this.presences=new u,t&&(t.unavailable?(this.available=!1,this.id=t.id):(this.setup(t),t.channels||(this.available=!1)))}setup(e){if(this.name=e.name,this.icon=e.icon,this.splash=e.splash,this.region=e.region,this.memberCount=e.member_count||this.memberCount,this.large=Boolean("large"in e?e.large:this.large),this.features=e.features,this.applicationID=e.application_id,this.afkTimeout=e.afk_timeout,this.afkChannelID=e.afk_channel_id,this.systemChannelID=e.system_channel_id,this.embedEnabled=e.embed_enabled,this.verificationLevel=e.verification_level,this.explicitContentFilter=e.explicit_content_filter,this.joinedTimestamp=e.joined_at?new Date(e.joined_at).getTime():this.joinedTimestamp,this.id=e.id,this.available=!e.unavailable,this.features=e.features||this.features||[],e.members){this.members.clear();for(const t of e.members)this._addMember(t,!1)}if(e.owner_id&&(this.ownerID=e.owner_id),e.channels){this.channels.clear();for(const t of e.channels)this.client.dataManager.newChannel(t,this)}if(e.roles){this.roles.clear();for(const t of e.roles){const e=new o(this,t);this.roles.set(e.id,e)}}if(e.presences)for(const t of e.presences)this._setPresence(t.user.id,t);if(this._rawVoiceStates=new u,e.voice_states)for(const t of e.voice_states){this._rawVoiceStates.set(t.user_id,t);const e=this.members.get(t.user_id);e&&(e.serverMute=t.mute,e.serverDeaf=t.deaf,e.selfMute=t.self_mute,e.selfDeaf=t.self_deaf,e.voiceSessionID=t.session_id,e.voiceChannelID=t.channel_id,this.channels.get(t.channel_id).members.set(e.user.id,e))}if(this.emojis)this.client.actions.GuildEmojisUpdate.handle({guild_id:this.id,emojis:e.emojis});else{this.emojis=new u;for(const t of e.emojis)this.emojis.set(t.id,new a(this,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?h.Endpoints.Guild(this).Icon(this.client.options.http.cdn,this.icon):null}get nameAcronym(){return this.name.replace(/\w+/g,e=>e[0]).replace(/\s/g,"")}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 afkChannel(){return this.client.channels.get(this.afkChannelID)||null}get systemChannel(){return this.client.channels.get(this.systemChannelID)||null}get voiceConnection(){return this.client.browser?null:this.client.voice.connections.get(this.id)||null}get position(){return this.client.user.bot?null:this.client.user.settings.guildPositions?this.client.user.settings.guildPositions.indexOf(this.id):null}get muted(){if(this.client.user.bot)return null;try{return this.client.user.guildSettings.get(this.id).muted}catch(e){return!1}}get messageNotifications(){if(this.client.user.bot)return null;try{return this.client.user.guildSettings.get(this.id).messageNotifications}catch(e){return null}}get mobilePush(){if(this.client.user.bot)return null;try{return this.client.user.guildSettings.get(this.id).mobilePush}catch(e){return!1}}get suppressEveryone(){if(this.client.user.bot)return null;try{return this.client.user.guildSettings.get(this.id).suppressEveryone}catch(e){return null}}get defaultRole(){return this.roles.get(this.id)}get me(){return this.members.get(this.client.user.id)}get _sortedRoles(){return this._sortPositionWithID(this.roles)}member(e){return this.client.resolver.resolveGuildMember(this,e)}fetchBans(){return this.client.rest.methods.getGuildBans(this).then(e=>{const t=new u;for(const i of e.values())t.set(i.user.id,i.user);return t})}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)}fetchAuditLogs(e){return this.client.rest.methods.getGuildAuditLogs(this,e)}addMember(e,t){return this.members.has(e.id)?Promise.resolve(this.members.get(e.id)):this.client.rest.methods.putGuildMember(this,e,t)}fetchMember(e,t=!0){return(e=this.client.resolver.resolveUser(e))?this.members.has(e.id)?Promise.resolve(this.members.get(e.id)):this.client.rest.methods.getGuildMember(this,e,t):Promise.reject(new Error("User is not cached. Use Client.fetchUser first."))}fetchMembers(e="",t=0){return new Promise((i,n)=>{if(this.memberCount===this.members.size)return void i(this);this.client.ws.send({op:h.OPCodes.REQUEST_GUILD_MEMBERS,d:{guild_id:this.id,query:e,limit:t}});const s=(e,t)=>{t.id===this.id&&(this.memberCount===this.members.size||e.length<1e3)&&(this.client.removeListener(h.Events.GUILD_MEMBERS_CHUNK,s),i(this))};this.client.on(h.Events.GUILD_MEMBERS_CHUNK,s),this.client.setTimeout(()=>n(new Error("Members didn't arrive in time.")),12e4)})}search(e={}){return this.client.rest.methods.search(this,e)}edit(e,t){const i={};return e.name&&(i.name=e.name),e.region&&(i.region=e.region),void 0!==e.verificationLevel&&(i.verification_level=Number(e.verificationLevel)),void 0!==e.afkChannel&&(i.afk_channel_id=this.client.resolver.resolveChannelID(e.afkChannel)),void 0!==e.systemChannel&&(i.system_channel_id=this.client.resolver.resolveChannelID(e.systemChannel)),e.afkTimeout&&(i.afk_timeout=Number(e.afkTimeout)),void 0!==e.icon&&(i.icon=e.icon),e.owner&&(i.owner_id=this.client.resolver.resolveUser(e.owner).id),void 0!==e.splash&&(i.splash=e.splash),void 0!==e.explicitContentFilter&&(i.explicit_content_filter=Number(e.explicitContentFilter)),this.client.rest.methods.updateGuild(this,i,t)}setExplicitContentFilter(e,t){return this.edit({explicitContentFilter:e},t)}setName(e,t){return this.edit({name:e},t)}setRegion(e,t){return this.edit({region:e},t)}setVerificationLevel(e,t){return this.edit({verificationLevel:e},t)}setAFKChannel(e,t){return this.edit({afkChannel:e},t)}setSystemChannel(e,t){return this.edit({systemChannel:e},t)}setAFKTimeout(e,t){return this.edit({afkTimeout:e},t)}setIcon(e,t){return this.client.resolver.resolveImage(e).then(e=>this.edit({icon:e,reason:t}))}setOwner(e,t){return this.edit({owner:e},t)}setSplash(e){return this.client.resolver.resolveImage(e).then(e=>this.edit({splash:e}))}setPosition(e,t){return this.client.user.bot?Promise.reject(new Error("Setting guild position is only available for user accounts")):this.client.user.settings.setGuildPosition(this,e,t)}acknowledge(){return this.client.rest.methods.ackGuild(this)}allowDMs(e){const t=this.client.user.settings;return e?t.removeRestrictedGuild(this):t.addRestrictedGuild(this)}ban(e,t={}){return"number"==typeof t?t={reason:null,"delete-message-days":t}:"string"==typeof t&&(t={reason:t,"delete-message-days":0}),t.days&&(t["delete-message-days"]=t.days),this.client.rest.methods.banGuildMember(this,e,t)}unban(e,t){return this.client.rest.methods.unbanGuildMember(this,e,t)}pruneMembers(e,t=!1,i){if("number"!=typeof e)throw new TypeError("Days must be a number.");return this.client.rest.methods.pruneGuildMembers(this,e,t,i)}sync(){this.client.user.bot||this.client.syncGuilds([this])}createChannel(e,t,i,n){return this.client.rest.methods.createChannel(this,e,t,i,n)}setChannelPositions(e){return this.client.rest.methods.updateChannelPositions(this.id,e)}createRole(e={},t){return this.client.rest.methods.createGuildRole(this,e,t)}createEmoji(e,t,i,n){return"string"==typeof e&&e.startsWith("data:")?this.client.rest.methods.createEmoji(this,e,t,i,n):this.client.resolver.resolveImage(e).then(e=>this.client.rest.methods.createEmoji(this,e,t,i,n))}deleteEmoji(e,t){return e instanceof a||(e=this.emojis.get(e)),this.client.rest.methods.deleteEmoji(e,t)}leave(){return this.client.rest.methods.leaveGuild(this)}delete(){return this.client.rest.methods.deleteGuild(this)}equals(e){let t=e&&this.id===e.id&&this.available===!e.unavailable&&this.splash===e.splash&&this.region===e.region&&this.name===e.name&&this.memberCount===e.member_count&&this.large===e.large&&this.icon===e.icon&&d.arraysEqual(this.features,e.features)&&this.ownerID===e.owner_id&&this.verificationLevel===e.verification_level&&this.embedEnabled===e.embed_enabled;return t&&(this.embedChannel?this.embedChannel.id!==e.embed_channel_id&&(t=!1):e.embed_channel_id&&(t=!1)),t}toString(){return this.name}_addMember(e,t=!0){const i=this.members.has(e.user.id);e.user instanceof r||(e.user=this.client.dataManager.newUser(e.user)),e.joined_at=e.joined_at||0;const n=new l(this,e);if(this.members.set(n.id,n),this._rawVoiceStates&&this._rawVoiceStates.has(n.user.id)){const e=this._rawVoiceStates.get(n.user.id);n.serverMute=e.mute,n.serverDeaf=e.deaf,n.selfMute=e.self_mute,n.selfDeaf=e.self_deaf,n.voiceSessionID=e.session_id,n.voiceChannelID=e.channel_id,this.client.channels.has(e.channel_id)?this.client.channels.get(e.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.connection.status===h.Status.READY&&t&&!i&&this.client.emit(h.Events.GUILD_MEMBER_ADD,n),n}_updateMember(e,t){const i=d.cloneObject(e);t.roles&&(e._roles=t.roles),void 0!==t.nick&&(e.nickname=t.nick);const n=e.nickname!==i.nickname||!d.arraysEqual(e._roles,i._roles);return this.client.ws.connection.status===h.Status.READY&&n&&this.client.emit(h.Events.GUILD_MEMBER_UPDATE,i,e),{old:i,mem:e}}_removeMember(e){this.members.delete(e.id)}_memberSpeakUpdate(e,t){const i=this.members.get(e);i&&i.speaking!==t&&(i.speaking=t,this.client.emit(h.Events.GUILD_MEMBER_SPEAKING,i,t))}_setPresence(e,t){this.presences.get(e)?this.presences.get(e).update(t):this.presences.set(e,new c(t))}setRolePosition(e,t,i=!1){if("string"==typeof e&&!(e=this.roles.get(e)))return Promise.reject(new Error("Supplied role is not a role or snowflake."));if(t=Number(t),isNaN(t))return Promise.reject(new Error("Supplied position is not a number."));let n=this._sortedRoles.array();return d.moveElementInArray(n,e,t,i),n=n.map((e,t)=>({id:e.id,position:t})),this.client.rest.methods.setRolePositions(this.id,n)}setChannelPosition(e,t,i=!1){if("string"==typeof e&&!(e=this.channels.get(e)))return Promise.reject(new Error("Supplied channel is not a channel or snowflake."));if(t=Number(t),isNaN(t))return Promise.reject(new Error("Supplied position is not a number."));let n=this._sortedChannels(e.type).array();return d.moveElementInArray(n,e,t,i),n=n.map((e,t)=>({id:e.id,position:t})),this.client.rest.methods.setChannelPositions(this.id,n)}_sortedChannels(e){return this._sortPositionWithID(this.channels.filter(t=>"voice"===e&&"voice"===t.type||("voice"!==e&&"voice"!==t.type||e===t.type)))}_sortPositionWithID(e){return e.sort((e,t)=>e.position!==t.position?e.position-t.position:s.fromString(e.id).sub(s.fromString(t.id)).toNumber())}}Object.defineProperty(m.prototype,"defaultChannel",{get:n.deprecate(function(){return this.channels.get(this.id)},"Guild#defaultChannel: This property is obsolete, will be removed in v12.0.0, and may not function as expected.")}),e.exports=m},function(e,t,i){const n=i(17),s=i(15),r=i(70),o=i(11),a=i(3),c=i(0);class l extends n{constructor(e,t){super(e.client,t),this.guild=e}setup(e){if(super.setup(e),this.name=e.name,this.position=e.position,this.permissionOverwrites=new a,e.permission_overwrites)for(const t of e.permission_overwrites)this.permissionOverwrites.set(t.id,new r(this,t))}get calculatedPosition(){const e=this.guild._sortedChannels(this.type);return e.array().indexOf(e.get(this.id))}permissionsFor(e){if(!(e=this.client.resolver.resolveGuildMember(this.guild,e)))return null;if(e.id===this.guild.ownerID)return new o(e,o.ALL);let t=0;const i=e.roles;for(const e of i.values())t|=e.permissions;if(Boolean(t&o.FLAGS.ADMINISTRATOR))return new o(o.ALL);const n=this.overwritesFor(e,!0,i);n.everyone&&(t&=~n.everyone.deny,t|=n.everyone.allow);let s=0;for(const e of n.roles)t&=~e.deny,s|=e.allow;return t|=s,n.member&&(t&=~n.member.deny,t|=n.member.allow),new o(e,t)}overwritesFor(e,t=!1,i=null){if(t||(e=this.client.resolver.resolveGuildMember(this.guild,e)),!e)return[];i=i||e.roles;const n=[];let s,r;for(const t of this.permissionOverwrites.values())t.id===this.guild.id?r=t:i.has(t.id)?n.push(t):t.id===e.id&&(s=t);return{everyone:r,roles:n,member:s}}overwritePermissions(e,t,i){const n={allow:0,deny:0};if(e instanceof s)n.type="role";else if(this.guild.roles.has(e))e=this.guild.roles.get(e),n.type="role";else if(e=this.client.resolver.resolveUser(e),n.type="member",!e)return Promise.reject(new TypeError("Supplied parameter was neither a User nor a Role."));n.id=e.id;const r=this.permissionOverwrites.get(e.id);r&&(n.allow=r.allow,n.deny=r.deny);for(const e in t)!0===t[e]?(n.allow|=o.FLAGS[e]||0,n.deny&=~(o.FLAGS[e]||0)):!1===t[e]?(n.allow&=~(o.FLAGS[e]||0),n.deny|=o.FLAGS[e]||0):null===t[e]&&(n.allow&=~(o.FLAGS[e]||0),n.deny&=~(o.FLAGS[e]||0));return this.client.rest.methods.setChannelOverwrite(this,n,i)}edit(e,t){return this.client.rest.methods.updateChannel(this,e,t)}setName(e,t){return this.edit({name:e},t)}setPosition(e,t){return this.guild.setChannelPosition(this,e,t).then(()=>this)}setTopic(e,t){return this.edit({topic:e},t)}createInvite(e={},t){return this.client.rest.methods.createChannelInvite(this,e,t)}clone(e=this.name,t=!0,i=!0,n){return this.guild.createChannel(e,this.type,t?this.permissionOverwrites:[],n).then(e=>i?e.setTopic(this.topic):e)}delete(e){return this.client.rest.methods.deleteChannel(this,e)}equals(e){let t=e&&this.id===e.id&&this.type===e.type&&this.topic===e.topic&&this.position===e.position&&this.name===e.name;return t&&(t=this.permissionOverwrites&&e.permissionOverwrites?this.permissionOverwrites.equals(e.permissionOverwrites):!this.permissionOverwrites&&!e.permissionOverwrites),t}get deletable(){return this.id!==this.guild.id&&this.permissionsFor(this.client.user).has(o.FLAGS.MANAGE_CHANNELS)}get muted(){if(this.client.user.bot)return null;try{return this.client.user.guildSettings.get(this.guild.id).channelOverrides.get(this.id).muted}catch(e){return!1}}get messageNotifications(){if(this.client.user.bot)return null;try{return this.client.user.guildSettings.get(this.guild.id).channelOverrides.get(this.id).messageNotifications}catch(e){return c.MessageNotificationTypes[3]}}toString(){return`<#${this.id}>`}}e.exports=l},function(e,t,i){const n=i(79);e.exports=n},function(e,t,i){function n(e,t){for(var i in e)t[i]=e[i]}function s(e,t,i){return o(e,t,i)}var r=i(5),o=r.Buffer;o.from&&o.alloc&&o.allocUnsafe&&o.allocUnsafeSlow?e.exports=r:(n(r,t),t.Buffer=s),n(o,s),s.from=function(e,t,i){if("number"==typeof e)throw new TypeError("Argument must not be a number");return o(e,t,i)},s.alloc=function(e,t,i){if("number"!=typeof e)throw new TypeError("Argument must be a number");var n=o(e);return void 0!==t?"string"==typeof i?n.fill(t,i):n.fill(t):n.fill(0),n},s.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return o(e)},s.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return r.SlowBuffer(e)}},function(e,t,i){"use strict";(function(t,n,s){function r(e){var t=this;this.next=null,this.entry=null,this.finish=function(){S(t,e)}}function o(e){return N.from(e)}function a(e){return N.isBuffer(e)||e instanceof O}function c(){}function l(e,t){M=M||i(12),e=e||{},this.objectMode=!!e.objectMode,t instanceof M&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var n=e.highWaterMark,s=this.objectMode?16:16384;this.highWaterMark=n||0===n?n:s,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var o=!1===e.decodeStrings;this.decodeStrings=!o,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){E(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new r(this)}function h(e){if(M=M||i(12),!(P.call(h,this)||this instanceof M))return new h(e);this._writableState=new l(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),U.call(this)}function u(e,t){var i=new Error("write after end");e.emit("error",i),k(t,i)}function d(e,t,i,n){var s=!0,r=!1;return null===i?r=new TypeError("May not write null values to stream"):"string"==typeof i||void 0===i||t.objectMode||(r=new TypeError("Invalid non-string/buffer chunk")),r&&(e.emit("error",r),k(n,r),s=!1),s}function p(e,t,i){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=N.from(t,i)),t}function m(e,t,i,n,s,r){if(!i){var o=p(t,n,s);n!==o&&(i=!0,s="buffer",n=o)}var a=t.objectMode?1:n.length;t.length+=a;var c=t.length-1?n:k;h.WritableState=l;var C=i(19);C.inherits=i(10);var I={deprecate:i(84)},U=i(47),N=i(33).Buffer,O=s.Uint8Array||function(){},L=i(48);C.inherits(h,U),l.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(l.prototype,"buffer",{get:I.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}();var P;"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(P=Function.prototype[Symbol.hasInstance],Object.defineProperty(h,Symbol.hasInstance,{value:function(e){return!!P.call(this,e)||e&&e._writableState instanceof l}})):P=function(e){return e instanceof this},h.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},h.prototype.write=function(e,t,i){var n=this._writableState,s=!1,r=a(e)&&!n.objectMode;return r&&!N.isBuffer(e)&&(e=o(e)),"function"==typeof t&&(i=t,t=null),r?t="buffer":t||(t=n.defaultEncoding),"function"!=typeof i&&(i=c),n.ended?u(this,i):(r||d(this,n,e,i))&&(n.pendingcb++,s=m(this,n,r,e,t,i)),s},h.prototype.cork=function(){this._writableState.corked++},h.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.finished||e.bufferProcessing||!e.bufferedRequest||y(this,e))},h.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},h.prototype._write=function(e,t,i){i(new Error("_write() is not implemented"))},h.prototype._writev=null,h.prototype.end=function(e,t,i){var n=this._writableState;"function"==typeof e?(i=e,e=null,t=null):"function"==typeof t&&(i=t,t=null),null!==e&&void 0!==e&&this.write(e,t),n.corked&&(n.corked=1,this.uncork()),n.ending||n.finished||R(this,n,i)},Object.defineProperty(h.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),h.prototype.destroy=L.destroy,h.prototype._undestroy=L.undestroy,h.prototype._destroy=function(e,t){this.end(),t(e)}}).call(t,i(7),i(82).setImmediate,i(6))},function(e,t,i){"use strict";t.decode=t.parse=i(90),t.encode=t.stringify=i(91)},function(e,t,i){(function(e){var n=i(92),s=i(95),r=i(96),o=i(52),a=t;a.request=function(t,i){t="string"==typeof t?o.parse(t):s(t);var r=-1===e.location.protocol.search(/^https?:$/)?"http:":"",a=t.protocol||r,c=t.hostname||t.host,l=t.port,h=t.path||"/";c&&-1!==c.indexOf(":")&&(c="["+c+"]"),t.url=(c?a+"//"+c:"")+(l?":"+l:"")+h,t.method=(t.method||"GET").toUpperCase(),t.headers=t.headers||{};var u=new n(t);return i&&u.on("response",i),u},a.get=function(e,t){var i=a.request(e,t);return i.end(),i},a.Agent=function(){},a.Agent.defaultMaxSockets=4,a.STATUS_CODES=r,a.METHODS=["CHECKOUT","CONNECT","COPY","DELETE","GET","HEAD","LOCK","M-SEARCH","MERGE","MKACTIVITY","MKCOL","MOVE","NOTIFY","OPTIONS","PATCH","POST","PROPFIND","PROPPATCH","PURGE","PUT","REPORT","SEARCH","SUBSCRIBE","TRACE","UNLOCK","UNSUBSCRIBE"]}).call(t,i(6))},function(e,t,i){var n,s,r;!function(i,o){s=[],void 0!==(r="function"==typeof(n=o)?n.apply(t,s):n)&&(e.exports=r)}(0,function(){"use strict";function e(e,t,i){this.low=0|e,this.high=0|t,this.unsigned=!!i}function t(e){return!0===(e&&e.__isLong__)}function i(e,t){var i,n,r;return t?(e>>>=0,(r=0<=e&&e<256)&&(n=c[e])?n:(i=s(e,(0|e)<0?-1:0,!0),r&&(c[e]=i),i)):(e|=0,(r=-128<=e&&e<128)&&(n=a[e])?n:(i=s(e,e<0?-1:0,!1),r&&(a[e]=i),i))}function n(e,t){if(isNaN(e)||!isFinite(e))return t?f:m;if(t){if(e<0)return f;if(e>=u)return _}else{if(e<=-d)return y;if(e+1>=d)return b}return e<0?n(-e,t).neg():s(e%h|0,e/h|0,t)}function s(t,i,n){return new e(t,i,n)}function r(e,t,i){if(0===e.length)throw Error("empty string");if("NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return m;if("number"==typeof t?(i=t,t=!1):t=!!t,(i=i||10)<2||360)throw Error("interior hyphen");if(0===s)return r(e.substring(1),t,i).neg();for(var o=n(l(i,8)),a=m,c=0;c>>0:this.low},w.toNumber=function(){return this.unsigned?(this.high>>>0)*h+(this.low>>>0):this.high*h+(this.low>>>0)},w.toString=function(e){if((e=e||10)<2||36>>0).toString(e);if((o=c).isZero())return h+a;for(;h.length<6;)h="0"+h;a=""+h+a}},w.getHighBits=function(){return this.high},w.getHighBitsUnsigned=function(){return this.high>>>0},w.getLowBits=function(){return this.low},w.getLowBitsUnsigned=function(){return this.low>>>0},w.getNumBitsAbs=function(){if(this.isNegative())return this.eq(y)?64:this.neg().getNumBitsAbs();for(var e=0!=this.high?this.high:this.low,t=31;t>0&&0==(e&1<=0},w.isOdd=function(){return 1==(1&this.low)},w.isEven=function(){return 0==(1&this.low)},w.equals=function(e){return t(e)||(e=o(e)),(this.unsigned===e.unsigned||this.high>>>31!=1||e.high>>>31!=1)&&(this.high===e.high&&this.low===e.low)},w.eq=w.equals,w.notEquals=function(e){return!this.eq(e)},w.neq=w.notEquals,w.lessThan=function(e){return this.comp(e)<0},w.lt=w.lessThan,w.lessThanOrEqual=function(e){return this.comp(e)<=0},w.lte=w.lessThanOrEqual,w.greaterThan=function(e){return this.comp(e)>0},w.gt=w.greaterThan,w.greaterThanOrEqual=function(e){return this.comp(e)>=0},w.gte=w.greaterThanOrEqual,w.compare=function(e){if(t(e)||(e=o(e)),this.eq(e))return 0;var i=this.isNegative(),n=e.isNegative();return i&&!n?-1:!i&&n?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1},w.comp=w.compare,w.negate=function(){return!this.unsigned&&this.eq(y)?y:this.not().add(g)},w.neg=w.negate,w.add=function(e){t(e)||(e=o(e));var i=this.high>>>16,n=65535&this.high,r=this.low>>>16,a=65535&this.low,c=e.high>>>16,l=65535&e.high,h=e.low>>>16,u=0,d=0,p=0,m=0;return m+=a+(65535&e.low),p+=m>>>16,m&=65535,p+=r+h,d+=p>>>16,p&=65535,d+=n+l,u+=d>>>16,d&=65535,u+=i+c,u&=65535,s(p<<16|m,u<<16|d,this.unsigned)},w.subtract=function(e){return t(e)||(e=o(e)),this.add(e.neg())},w.sub=w.subtract,w.multiply=function(e){if(this.isZero())return m;if(t(e)||(e=o(e)),e.isZero())return m;if(this.eq(y))return e.isOdd()?y:m;if(e.eq(y))return this.isOdd()?y:m;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(p)&&e.lt(p))return n(this.toNumber()*e.toNumber(),this.unsigned);var i=this.high>>>16,r=65535&this.high,a=this.low>>>16,c=65535&this.low,l=e.high>>>16,h=65535&e.high,u=e.low>>>16,d=65535&e.low,f=0,g=0,v=0,E=0;return E+=c*d,v+=E>>>16,E&=65535,v+=a*d,g+=v>>>16,v&=65535,v+=c*u,g+=v>>>16,v&=65535,g+=r*d,f+=g>>>16,g&=65535,g+=a*u,f+=g>>>16,g&=65535,g+=c*h,f+=g>>>16,g&=65535,f+=i*d+r*u+a*h+c*l,f&=65535,s(v<<16|E,f<<16|g,this.unsigned)},w.mul=w.multiply,w.divide=function(e){if(t(e)||(e=o(e)),e.isZero())throw Error("division by zero");if(this.isZero())return this.unsigned?f:m;var i,s,r;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return f;if(e.gt(this.shru(1)))return v;r=f}else{if(this.eq(y))return e.eq(g)||e.eq(E)?y:e.eq(y)?g:(i=this.shr(1).div(e).shl(1)).eq(m)?e.isNegative()?g:E:(s=this.sub(e.mul(i)),r=i.add(s.div(e)));if(e.eq(y))return this.unsigned?f:m;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();r=m}for(s=this;s.gte(e);){i=Math.max(1,Math.floor(s.toNumber()/e.toNumber()));for(var a=Math.ceil(Math.log(i)/Math.LN2),c=a<=48?1:l(2,a-48),h=n(i),u=h.mul(e);u.isNegative()||u.gt(s);)u=(h=n(i-=c,this.unsigned)).mul(e);h.isZero()&&(h=g),r=r.add(h),s=s.sub(u)}return r},w.div=w.divide,w.modulo=function(e){return t(e)||(e=o(e)),this.sub(this.div(e).mul(e))},w.mod=w.modulo,w.not=function(){return s(~this.low,~this.high,this.unsigned)},w.and=function(e){return t(e)||(e=o(e)),s(this.low&e.low,this.high&e.high,this.unsigned)},w.or=function(e){return t(e)||(e=o(e)),s(this.low|e.low,this.high|e.high,this.unsigned)},w.xor=function(e){return t(e)||(e=o(e)),s(this.low^e.low,this.high^e.high,this.unsigned)},w.shiftLeft=function(e){return t(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?s(this.low<>>32-e,this.unsigned):s(0,this.low<>>e|this.high<<32-e,this.high>>e,this.unsigned):s(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},w.shr=w.shiftRight,w.shiftRightUnsigned=function(e){if(t(e)&&(e=e.toInt()),0===(e&=63))return this;var i=this.high;return e<32?s(this.low>>>e|i<<32-e,i>>>e,this.unsigned):32===e?s(i,0,this.unsigned):s(i>>>e-32,0,this.unsigned)},w.shru=w.shiftRightUnsigned,w.toSigned=function(){return this.unsigned?s(this.low,this.high,!1):this},w.toUnsigned=function(){return this.unsigned?this:s(this.low,this.high,!0)},w.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},w.toBytesLE=function(){var e=this.high,t=this.low;return[255&t,t>>>8&255,t>>>16&255,t>>>24&255,255&e,e>>>8&255,e>>>16&255,e>>>24&255]},w.toBytesBE=function(){var e=this.high,t=this.low;return[e>>>24&255,e>>>16&255,e>>>8&255,255&e,t>>>24&255,t>>>16&255,t>>>8&255,255&t]},e})},function(e,t,i){(function(t){const n=i(20),s=i(27),r=i(32),o=i(0),a=i(4).convertToBuffer,c=i(14),l=i(22),h=i(30),u=i(17),d=i(24),p=i(23),m=i(39);class f{constructor(e){this.client=e}resolveUser(e){return e instanceof c?e:"string"==typeof e?this.client.users.get(e)||null:e instanceof d?e.user:e instanceof l?e.author:e instanceof h?e.owner:null}resolveUserID(e){return e instanceof c||e instanceof d?e.id:"string"==typeof e?e||null:e instanceof l?e.author.id:e instanceof h?e.ownerID:null}resolveGuild(e){return e instanceof h?e:"string"==typeof e?this.client.guilds.get(e)||null:null}resolveGuildMember(e,t){return t instanceof d?t:(e=this.resolveGuild(e),t=this.resolveUser(t),e&&t?e.members.get(t.id)||null:null)}resolveChannel(e){return e instanceof u?e:"string"==typeof e?this.client.channels.get(e)||null:e instanceof l?e.channel:e instanceof h?e.channels.get(e.id)||null:null}resolveChannelID(e){return e instanceof u?e.id:"string"==typeof e?e:e instanceof l?e.channel.id:e instanceof h?e.defaultChannel.id:null}resolveInviteCode(e){const t=/discord(?:app\.com\/invite|\.gg)\/([\w-]{2,255})/i.exec(e);return t&&t[1]?t[1]:e}resolveString(e){return"string"==typeof e?e:e instanceof Array?e.join("\n"):String(e)}resolveImage(e){return e?"string"==typeof e&&e.startsWith("data:")?Promise.resolve(e):this.resolveFile(e).then(this.resolveBase64):Promise.resolve(null)}resolveBase64(e){return e instanceof t?`data:image/jpg;base64,${e.toString("base64")}`:e}resolveFile(e){return e instanceof t?Promise.resolve(e):this.client.browser&&e instanceof ArrayBuffer?Promise.resolve(a(e)):"string"==typeof e?new Promise((i,o)=>{if(/^https?:\/\//.test(e))r.get(e).end((e,n)=>e?o(e):n.body instanceof t?i(n.body):o(new TypeError("The response body isn't a Buffer.")));else{const t=n.resolve(e);s.stat(t,(e,n)=>e?o(e):n&&n.isFile()?(s.readFile(t,(e,t)=>{e?o(e):i(t)}),null):o(new Error(`The file could not be found: ${t}`)))}}):e.pipe&&"function"==typeof e.pipe?new Promise((i,n)=>{const s=[];e.once("error",n),e.on("data",e=>s.push(e)),e.once("end",()=>i(t.concat(s)))}):Promise.reject(new TypeError("The resource must be a string or Buffer."))}resolveEmojiIdentifier(e){return e instanceof p||e instanceof m?e.identifier:"string"==typeof e?this.client.emojis.has(e)?this.client.emojis.get(e).identifier:e.includes("%")?e:encodeURIComponent(e):null}static resolveColor(e){if("string"==typeof e){if("RANDOM"===e)return Math.floor(16777216*Math.random());e=o.Colors[e]||parseInt(e.replace("#",""),16)}else e instanceof Array&&(e=(e[0]<<16)+(e[1]<<8)+e[2]);if(e<0||e>16777215)throw new RangeError("Color must be within the range 0 - 16777215 (0xFFFFFF).");if(e&&isNaN(e))throw new TypeError("Unable to convert color to a number.");return e}resolveColor(e){return this.constructor.resolveColor(e)}}e.exports=f}).call(t,i(5).Buffer)},function(e,t){class i{constructor(e,t,i){this.reaction=e,this.name=t,this.id=i}get identifier(){return this.id?`${this.name}:${this.id}`:encodeURIComponent(this.name)}toString(){return this.id?`<:${this.name}:${this.id}>`:this.name}}e.exports=i},function(e,t,i){const n=i(3),s=i(9).EventEmitter;class r extends s{constructor(e,t,i={}){super(),Object.defineProperty(this,"client",{value:e}),this.filter=t,this.options=i,this.collected=new n,this.ended=!1,this._timeout=null,this.listener=this._handle.bind(this),i.time&&(this._timeout=this.client.setTimeout(()=>this.stop("time"),i.time))}_handle(...e){const t=this.handle(...e);if(!t||!this.filter(...e,this.collected))return;this.collected.set(t.key,t.value),this.emit("collect",t.value,this);const i=this.postCheck(...e);i&&this.stop(i)}get next(){return new Promise((e,t)=>{if(this.ended)return void t(this.collected);const i=()=>{this.removeListener("collect",n),this.removeListener("end",s)},n=t=>{i(),e(t)},s=()=>{i(),t(this.collected)};this.on("collect",n),this.on("end",s)})}stop(e="user"){this.ended||(this._timeout&&this.client.clearTimeout(this._timeout),this.ended=!0,this.cleanup(),this.emit("end",this.collected,e))}handle(){}postCheck(){}cleanup(){}}e.exports=r},function(e,t,i){(function(t){const n=i(20),s=i(4),r=i(29),o=i(28);class a{constructor(e,t,i){e?(Object.defineProperty(this,"client",{value:e}),t&&this.setup(t)):(this.id=t,this.token=i,Object.defineProperty(this,"client",{value:this}))}setup(e){this.name=e.name,this.token=e.token,this.avatar=e.avatar,this.id=e.id,this.guildID=e.guild_id,this.channelID=e.channel_id,e.user?this.owner=this.client.users?this.client.users.get(e.user.id):e.user:this.owner=null}send(e,i){if(i||"object"!=typeof e||e instanceof Array?i||(i={}):(i=e,e=""),i instanceof r&&(i={files:[i]}),i instanceof o&&(i={embeds:[i]}),e){e=this.client.resolver.resolveString(e);let{split:t,code:n,disableEveryone:r}=i;t&&"object"!=typeof t&&(t={}),void 0===n||"boolean"==typeof n&&!0!==n||(e=s.escapeMarkdown(e,!0),e=`\`\`\`${"boolean"!=typeof n?n||"":""}\n${e}\n\`\`\``,t&&(t.prepend=`\`\`\`${"boolean"!=typeof n?n||"":""}\n`,t.append="\n```")),(r||void 0===r&&this.client.options.disableEveryone)&&(e=e.replace(/@(everyone|here)/g,"@​$1")),t&&(e=s.splitMessage(e,t))}if(i.file&&(i.files?i.files.push(i.file):i.files=[i.file]),i.embeds){const e=[];for(const t of i.embeds)t.file&&e.push(t.file);i.files?i.files.push(...e):i.files=e}if(i.files){for(let e=0;ethis.client.resolver.resolveFile(e.attachment).then(t=>(e.file=t,e)))).then(t=>this.client.rest.methods.sendWebhookMessage(this,e,i,t))}return this.client.rest.methods.sendWebhookMessage(this,e,i)}sendMessage(e,t={}){return this.send(e,t)}sendFile(e,t,i,n={}){return this.send(i,Object.assign(n,{file:{attachment:e,name:t}}))}sendCode(e,t,i={}){return this.send(t,Object.assign(i,{code:e}))}sendSlackMessage(e){return this.client.rest.methods.sendSlackWebhookMessage(this,e)}edit(e=this.name,t){return t?this.client.resolver.resolveImage(t).then(t=>this.client.rest.methods.editWebhook(this,e,t)):this.client.rest.methods.editWebhook(this,e)}delete(e){return this.client.rest.methods.deleteWebhook(this,e)}}e.exports=a}).call(t,i(5).Buffer)},function(e,t,i){const n=i(8);class s{constructor(e,t){Object.defineProperty(this,"client",{value:e}),this.setup(t)}setup(e){this.id=e.id,this.name=e.name,this.description=e.description,this.icon=e.icon,this.iconURL=`https://cdn.discordapp.com/app-icons/${this.id}/${this.icon}.jpg`,this.rpcOrigins=e.rpc_origins,this.redirectURIs=e.redirect_uris,this.botRequireCodeGrant=e.bot_require_code_grant,this.botPublic=e.bot_public,this.rpcApplicationState=e.rpc_application_state,this.bot=e.bot,this.flags=e.flags,this.secret=e.secret,e.owner&&(this.owner=this.client.dataManager.newUser(e.owner))}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}}e.exports=s},function(e,t,i){const n=i(17),s=i(21),r=i(3),o=i(0);class a extends n{constructor(e,t){super(e,t),this.type="group",this.messages=new r,this._typing=new Map}setup(e){if(super.setup(e),this.name=e.name,this.icon=e.icon,this.ownerID=e.owner_id,this.managed=e.managed,this.applicationID=e.application_id,e.nicks&&(this.nicks=new r(e.nicks.map(e=>[e.id,e.nick]))),this.recipients||(this.recipients=new r),e.recipients)for(const t of e.recipients){const e=this.client.dataManager.newUser(t);this.recipients.set(e.id,e)}this.lastMessageID=e.last_message_id}get owner(){return this.client.users.get(this.ownerID)}get iconURL(){return this.icon?o.Endpoints.Channel(this).Icon(this.client.options.http.cdn,this.icon):null}edit(e){const t={};return e.name&&(t.name=e.name),void 0!==e.icon&&(t.icon=e.icon),this.client.rest.methods.updateGroupDMChannel(this,t)}equals(e){const t=e&&this.id===e.id&&this.name===e.name&&this.icon===e.icon&&this.ownerID===e.ownerID;return t?this.recipients.equals(e.recipients):t}addUser(e,t){return this.client.rest.methods.addUserToGroupDM(this,{nick:t,id:this.client.resolver.resolveUserID(e),accessToken:e})}setIcon(e){return this.client.resolver.resolveImage(e).then(e=>this.edit({icon:e}))}setName(e){return this.edit({name:e})}removeUser(e){const t=this.client.resolver.resolveUserID(e);return this.client.rest.methods.removeUserFromGroupDM(this,t)}toString(){return this.name}send(){}sendMessage(){}sendEmbed(){}sendFile(){}sendFiles(){}sendCode(){}fetchMessage(){}fetchMessages(){}fetchPinnedMessages(){}search(){}startTyping(){}stopTyping(){}get typing(){}get typingCount(){}createCollector(){}createMessageCollector(){}awaitMessages(){}acknowledge(){}_cacheMessage(){}}s.applyToClass(a,!0,["bulkDelete"]),e.exports=a},function(e,t){class i extends Error{constructor(e,t){super();const i=this.constructor.flattenErrors(t.errors||t).join("\n");this.name="DiscordAPIError",this.message=t.message&&i?`${t.message}\n${i}`:t.message||i,this.path=e,this.code=t.code}static flattenErrors(e,t=""){let i=[];for(const n of Object.keys(e)){if("message"===n)continue;const s=t?isNaN(n)?`${t}.${n}`:`${t}[${n}]`:n;e[n]._errors?i.push(`${s}: ${e[n]._errors.map(e=>e.message).join(" ")}`):e[n].code||e[n].message?i.push(`${e[n].code?`${e[n].code}: `:""}: ${e[n].message}`.trim()):"string"==typeof e[n]?i.push(e[n]):i=i.concat(this.flattenErrors(e[n],s))}return i}}e.exports=i},function(e,t){var i={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==i.call(e)}},function(e,t,i){"use strict";(function(t,n){function s(e){return P.from(e)}function r(e){return P.isBuffer(e)||e instanceof j}function o(e,t,i){if("function"==typeof e.prependListener)return e.prependListener(t,i);e._events&&e._events[t]?N(e._events[t])?e._events[t].unshift(i):e._events[t]=[i,e._events[t]]:e.on(t,i)}function a(e,t){U=U||i(12),e=e||{},this.objectMode=!!e.objectMode,t instanceof U&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var n=e.highWaterMark,s=this.objectMode?16:16384;this.highWaterMark=n||0===n?n:s,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new H,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&($||($=i(49).StringDecoder),this.decoder=new $(e.encoding),this.encoding=e.encoding)}function c(e){if(U=U||i(12),!(this instanceof c))return new c(e);this._readableState=new a(e,this),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),L.call(this)}function l(e,t,i,n,r){var o=e._readableState;if(null===t)o.reading=!1,f(e,o);else{var a;r||(a=u(o,t)),a?e.emit("error",a):o.objectMode||t&&t.length>0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===P.prototype||(t=s(t)),n?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):h(e,o,t,!0):o.ended?e.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!i?(t=o.decoder.write(t),o.objectMode||0!==t.length?h(e,o,t,!1):E(e,o)):h(e,o,t,!1))):n||(o.reading=!1)}return d(o)}function h(e,t,i,n){t.flowing&&0===t.length&&!t.sync?(e.emit("data",i),e.read(0)):(t.length+=t.objectMode?1:i.length,n?t.buffer.unshift(i):t.buffer.push(i),t.needReadable&&g(e)),E(e,t)}function u(e,t){var i;return r(t)||"string"==typeof t||void 0===t||e.objectMode||(i=new TypeError("Invalid non-string/buffer chunk")),i}function d(e){return!e.ended&&(e.needReadable||e.length=F?e=F:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function m(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!==e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=p(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function f(e,t){if(!t.ended){if(t.decoder){var i=t.decoder.end();i&&i.length&&(t.buffer.push(i),t.length+=t.objectMode?1:i.length)}t.ended=!0,g(e)}}function g(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(B("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?I(v,e):v(e))}function v(e){B("emit readable"),e.emit("readable"),A(e)}function E(e,t){t.readingMore||(t.readingMore=!0,I(b,e,t))}function b(e,t){for(var i=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(i=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):i=R(e,t.buffer,t.decoder),i}function R(e,t,i){var n;return er.length?r.length:e;if(o===r.length?s+=r:s+=r.slice(0,e),0===(e-=o)){o===r.length?(++n,i.next?t.head=i.next:t.head=t.tail=null):(t.head=i,i.data=r.slice(o));break}++n}return t.length-=n,s}function k(e,t){var i=P.allocUnsafe(e),n=t.head,s=1;for(n.data.copy(i),e-=n.data.length;n=n.next;){var r=n.data,o=e>r.length?r.length:e;if(r.copy(i,i.length-e,0,o),0===(e-=o)){o===r.length?(++s,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=r.slice(o));break}++s}return t.length-=s,i}function M(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,I(D,t,e))}function D(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function C(e,t){for(var i=0,n=e.length;i=t.highWaterMark||t.ended))return B("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?M(this):g(this),null;if(0===(e=m(e,t))&&t.ended)return 0===t.length&&M(this),null;var n=t.needReadable;B("need readable",n),(0===t.length||t.length-e0?T(e,t):null)?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),i!==e&&t.ended&&M(this)),null!==s&&this.emit("data",s),s},c.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},c.prototype.pipe=function(e,t){function i(e,t){B("onunpipe"),e===d&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,r())}function s(){B("onend"),e.end()}function r(){B("cleanup"),e.removeListener("close",l),e.removeListener("finish",h),e.removeListener("drain",f),e.removeListener("error",c),e.removeListener("unpipe",i),d.removeListener("end",s),d.removeListener("end",u),d.removeListener("data",a),g=!0,!p.awaitDrain||e._writableState&&!e._writableState.needDrain||f()}function a(t){B("ondata"),v=!1,!1!==e.write(t)||v||((1===p.pipesCount&&p.pipes===e||p.pipesCount>1&&-1!==C(p.pipes,e))&&!g&&(B("false write response, pause",d._readableState.awaitDrain),d._readableState.awaitDrain++,v=!0),d.pause())}function c(t){B("onerror",t),u(),e.removeListener("error",c),0===O(e,"error")&&e.emit("error",t)}function l(){e.removeListener("finish",h),u()}function h(){B("onfinish"),e.removeListener("close",l),u()}function u(){B("unpipe"),d.unpipe(e)}var d=this,p=this._readableState;switch(p.pipesCount){case 0:p.pipes=e;break;case 1:p.pipes=[p.pipes,e];break;default:p.pipes.push(e)}p.pipesCount+=1,B("pipe count=%d opts=%j",p.pipesCount,t);var m=(!t||!1!==t.end)&&e!==n.stdout&&e!==n.stderr?s:u;p.endEmitted?I(m):d.once("end",m),e.on("unpipe",i);var f=_(d);e.on("drain",f);var g=!1,v=!1;return d.on("data",a),o(e,"error",c),e.once("close",l),e.once("finish",h),e.emit("pipe",d),p.flowing||(B("pipe resume"),d.resume()),e},c.prototype.unpipe=function(e){var t=this._readableState,i={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,i),this);if(!e){var n=t.pipes,s=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var r=0;r=this.charLength-this.charReceived?this.charLength-this.charReceived:e.length;if(e.copy(this.charBuffer,this.charReceived,0,i),this.charReceived+=i,this.charReceived=55296&&s<=56319)){if(this.charReceived=this.charLength=0,0===e.length)return t;break}this.charLength+=this.surrogateSize,t=""}this.detectIncompleteChar(e);n=e.length;this.charLength&&(e.copy(this.charBuffer,0,e.length-this.charReceived,n),n-=this.charReceived);var n=(t+=e.toString(this.encoding,0,n)).length-1,s=t.charCodeAt(n);if(s>=55296&&s<=56319){var r=this.surrogateSize;return this.charLength+=r,this.charReceived+=r,this.charBuffer.copy(this.charBuffer,r,0,r),e.copy(this.charBuffer,0,0,r),t.substring(0,n)}return t},l.prototype.detectIncompleteChar=function(e){for(var t=e.length>=3?3:e.length;t>0;t--){var i=e[e.length-t];if(1==t&&i>>5==6){this.charLength=2;break}if(t<=2&&i>>4==14){this.charLength=3;break}if(t<=3&&i>>3==30){this.charLength=4;break}}this.charReceived=t},l.prototype.end=function(e){var t="";if(e&&e.length&&(t=this.write(e)),this.charReceived){var i=this.charReceived,n=this.charBuffer,s=this.encoding;t+=n.slice(0,i).toString(s)}return t}},function(e,t,i){"use strict";function n(e){this.afterTransform=function(t,i){return s(e,t,i)},this.needTransform=!1,this.transforming=!1,this.writecb=null,this.writechunk=null,this.writeencoding=null}function s(e,t,i){var n=e._transformState;n.transforming=!1;var s=n.writecb;if(!s)return e.emit("error",new Error("write callback called multiple times"));n.writechunk=null,n.writecb=null,null!==i&&void 0!==i&&e.push(i),s(t);var r=e._readableState;r.reading=!1,(r.needReadable||r.length",'"',"`"," ","\r","\n","\t"],u=["{","}","|","\\","^","`"].concat(h),d=["'"].concat(u),p=["%","/","?",";","#"].concat(d),m=["/","?","#"],f=/^[+a-z0-9A-Z_-]{0,63}$/,g=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,v={javascript:!0,"javascript:":!0},E={javascript:!0,"javascript:":!0},b={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},_=i(35);n.prototype.parse=function(e,t,i){if(!o.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var n=e.indexOf("?"),s=-1!==n&&n127?N+="x":N+=U[O];if(!N.match(f)){var P=C.slice(0,R),j=C.slice(R+1),G=U.match(g);G&&(P.push(G[1]),j.unshift(G[2])),j.length&&(u="/"+j.join(".")+u),this.hostname=P.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),D||(this.hostname=r.toASCII(this.hostname));var q=this.port?":"+this.port:"",B=this.hostname||"";this.host=B+q,this.href+=this.host,D&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==u[0]&&(u="/"+u))}if(!v[x])for(var R=0,I=d.length;R0)&&i.host.split("@"))&&(i.auth=D.shift(),i.host=i.hostname=D.shift())),i.search=e.search,i.query=e.query,o.isNull(i.pathname)&&o.isNull(i.search)||(i.path=(i.pathname?i.pathname:"")+(i.search?i.search:"")),i.href=i.format(),i;if(!w.length)return i.pathname=null,i.search?i.path="/"+i.search:i.path=null,i.href=i.format(),i;for(var T=w.slice(-1)[0],R=(i.host||e.host||w.length>1)&&("."===T||".."===T)||""===T,S=0,k=w.length;k>=0;k--)"."===(T=w[k])?w.splice(k,1):".."===T?(w.splice(k,1),S++):S&&(w.splice(k,1),S--);if(!_&&!y)for(;S--;S)w.unshift("..");!_||""===w[0]||w[0]&&"/"===w[0].charAt(0)||w.unshift(""),R&&"/"!==w.join("/").substr(-1)&&w.push("");var M=""===w[0]||w[0]&&"/"===w[0].charAt(0);if(A){i.hostname=i.host=M?"":w.length?w.shift():"";var D=!!(i.host&&i.host.indexOf("@")>0)&&i.host.split("@");D&&(i.auth=D.shift(),i.host=i.hostname=D.shift())}return(_=_||i.host&&w.length)&&!M&&w.unshift(""),w.length?i.pathname=w.join("/"):(i.pathname=null,i.path=null),o.isNull(i.pathname)&&o.isNull(i.search)||(i.path=(i.pathname?i.pathname:"")+(i.search?i.search:"")),i.auth=e.auth||i.auth,i.slashes=i.slashes||e.slashes,i.href=i.format(),i},n.prototype.parseHost=function(){var e=this.host,t=c.exec(e);t&&(":"!==(t=t[0])&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)}},function(e,t,i){const n=i(103),s=i(104);e.exports={buffer:function(e){const t=s(e);return t?t.mime:n.bin},lookup:function(e){return n[e.replace(/^\./,"")]||n.bin}}},function(e,t,i){const n=i(25);class s extends n.Readable{constructor(){super(),this.statusCode=200,this.status="OK"}error(e,t){return this.statusCode=e,this.status=t,this}on(e,t){["end","open"].includes(e)&&t()}_read(){}}e.exports=s},function(e,t){e.exports={name:"discord.js",version:"11.2.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:{long:"^3.2.0","prism-media":"^0.0.1",snekfetch:"^3.3.0",tweetnacl:"^1.0.0",ws:"^3.1.0"},peerDependencies:{bufferutil:"^3.0.2",erlpack:"hammerandchisel/erlpack","node-opus":"^0.2.6",opusscript:"^0.0.3",sodium:"^2.0.1","libsodium-wrappers":"^0.5.4",uws:"^0.14.5"},devDependencies:{"@types/node":"^7.0.43","discord.js-docgen":"hydrabolt/discord.js-docgen",eslint:"^4.6.0","parallel-webpack":"^2.1.0","uglifyjs-webpack-plugin":"^1.0.0-beta.1",webpack:"^3.5.5"},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(e,t,i){const n=i(111),s=i(112),r=i(116),o=i(117),a=i(118),c=i(0);class l{constructor(e){this.client=e,this.handlers={},this.userAgentManager=new n(this),this.methods=new s(this),this.rateLimitedEndpoints={},this.globallyRateLimited=!1}destroy(){for(const e in this.handlers)this.handlers[e].destroy()}push(e,t){return new Promise((i,n)=>{e.push({request:t,resolve:i,reject:n})})}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(e,t,i,n,s,r){const o=new a(this,e,t,i,n,s,r);if(!this.handlers[o.route]){const e=this.getRequestHandler();this.handlers[o.route]=new e(this,o.route)}return this.push(this.handlers[o.route],o)}}e.exports=l},function(e,t,i){const n=i(3);class s{constructor(e,t,i,s){if(this.everyone=Boolean(s),t)if(t instanceof n)this.users=new n(t);else{this.users=new n;for(const i of t){let t=e.client.users.get(i.id);t||(t=e.client.dataManager.newUser(i)),this.users.set(t.id,t)}}else this.users=new n;if(i)if(i instanceof n)this.roles=new n(i);else{this.roles=new n;for(const t of i){const i=e.channel.guild.roles.get(t);i&&this.roles.set(i.id,i)}}else this.roles=new n;this._content=e.content,this._client=e.client,this._guild=e.channel.guild,this._members=null,this._channels=null}get members(){return this._members?this._members:this._guild?(this._members=new n,this.users.forEach(e=>{const t=this._guild.member(e);t&&this._members.set(t.user.id,t)}),this._members):null}get channels(){if(this._channels)return this._channels;this._channels=new n;let e;for(;null!==(e=this.constructor.CHANNELS_PATTERN.exec(this._content));){const t=this._client.channels.get(e[1]);t&&this._channels.set(t.id,t)}return this._channels}}s.EVERYONE_PATTERN=/@(everyone|here)/g,s.USERS_PATTERN=/<@!?[0-9]+>/g,s.ROLES_PATTERN=/<@&[0-9]+>/g,s.CHANNELS_PATTERN=/<#([0-9]+)>/g,e.exports=s},function(e,t){class i{constructor(e,t){Object.defineProperty(this,"client",{value:e.client}),this.message=e,this.setup(t)}setup(e){this.id=e.id,this.filename=e.filename,this.filesize=e.size,this.url=e.url,this.proxyURL=e.proxy_url,this.height=e.height,this.width=e.width}}e.exports=i},function(e,t){class i{constructor(e,t){Object.defineProperty(this,"client",{value:e.client}),this.message=e,this.setup(t)}setup(e){if(this.type=e.type,this.title=e.title,this.description=e.description,this.url=e.url,this.color=e.color,this.fields=[],e.fields)for(const t of e.fields)this.fields.push(new c(this,t));this.createdTimestamp=e.timestamp,this.thumbnail=e.thumbnail?new n(this,e.thumbnail):null,this.image=e.image?new s(this,e.image):null,this.video=e.video?new r(this,e.video):null,this.author=e.author?new a(this,e.author):null,this.provider=e.provider?new o(this,e.provider):null,this.footer=e.footer?new l(this,e.footer):null}get createdAt(){return new Date(this.createdTimestamp)}get hexColor(){let e=this.color.toString(16);for(;e.length<6;)e=`0${e}`;return`#${e}`}}class n{constructor(e,t){this.embed=e,this.setup(t)}setup(e){this.url=e.url,this.proxyURL=e.proxy_url,this.height=e.height,this.width=e.width}}class s{constructor(e,t){this.embed=e,this.setup(t)}setup(e){this.url=e.url,this.proxyURL=e.proxy_url,this.height=e.height,this.width=e.width}}class r{constructor(e,t){this.embed=e,this.setup(t)}setup(e){this.url=e.url,this.height=e.height,this.width=e.width}}class o{constructor(e,t){this.embed=e,this.setup(t)}setup(e){this.name=e.name,this.url=e.url}}class a{constructor(e,t){this.embed=e,this.setup(t)}setup(e){this.name=e.name,this.url=e.url,this.iconURL=e.icon_url}}class c{constructor(e,t){this.embed=e,this.setup(t)}setup(e){this.name=e.name,this.value=e.value,this.inline=e.inline}}class l{constructor(e,t){this.embed=e,this.setup(t)}setup(e){this.text=e.text,this.iconURL=e.icon_url,this.proxyIconUrl=e.proxy_icon_url}}i.Thumbnail=n,i.Image=s,i.Video=r,i.Provider=o,i.Author=a,i.Field=c,i.Footer=l,e.exports=i},function(e,t,i){const n=i(3),s=i(23),r=i(39);class o{constructor(e,t,i,s){this.message=e,this.me=s,this.count=i||0,this.users=new n,this._emoji=new r(this,t.name,t.id)}get emoji(){if(this._emoji instanceof s)return this._emoji;if(this._emoji.id){const e=this.message.client.emojis;if(e.has(this._emoji.id)){const t=e.get(this._emoji.id);return this._emoji=t,t}}return this._emoji}remove(e=this.message.client.user){const t=this.message,i=this.message.client.resolver.resolveUserID(e);return i?t.client.rest.methods.removeMessageReaction(t,this.emoji.identifier,i):Promise.reject(new Error("Couldn't resolve the user ID to remove from the reaction."))}fetchUsers(e=100){const t=this.message;return t.client.rest.methods.getMessageReactionUsers(t,this.emoji.identifier,e).then(e=>{this.users=new n;for(const t of e){const e=this.message.client.dataManager.newUser(t);this.users.set(e.id,e)}return this.count=this.users.size,this.users})}}e.exports=o},function(e,t,i){const n=i(40),s=i(3);class r extends n{constructor(e,t,i={}){super(e.client,t,i),this.message=e,this.users=new s,this.total=0,this.client.on("messageReactionAdd",this.listener)}handle(e){return e.message.id!==this.message.id?null:{key:e.emoji.id||e.emoji.name,value:e}}postCheck(e,t){return this.users.set(t.id,t),this.options.max&&++this.total>=this.options.max?"limit":this.options.maxEmojis&&this.collected.size>=this.options.maxEmojis?"emojiLimit":this.options.maxUsers&&this.users.size>=this.options.maxUsers?"userLimit":null}cleanup(){this.client.removeListener("messageReactionAdd",this.listener)}}e.exports=r},function(e,t,i){const n=i(40),s=i(13);class r extends n{constructor(e,t,i={}){super(e.client,t,i),this.channel=e,this.received=0,this.client.on("message",this.listener),this.options.max&&(this.options.maxProcessed=this.options.max),this.options.maxMatches&&(this.options.max=this.options.maxMatches),this._reEmitter=(e=>{this.emit("message",e)}),this.on("collect",this._reEmitter)}on(e,t){"message"===e&&(t=s.deprecate(t,'MessageCollector will soon no longer emit "message", use "collect" instead')),super.on(e,t)}handle(e){return e.channel.id!==this.channel.id?null:(this.received++,{key:e.id,value:e})}postCheck(){return this.options.maxMatches&&this.collected.size>=this.options.max?"matchesLimit":this.options.max&&this.received>=this.options.maxProcessed?"limit":null}cleanup(){this.removeListener("collect",this._reEmitter),this.client.removeListener("message",this.listener)}}e.exports=r},function(e,t,i){const n=i(64),s=i(65),r=i(0);class o{constructor(e,t){Object.defineProperty(this,"client",{value:e}),this.setup(t)}setup(e){this.guild=this.client.guilds.get(e.guild.id)||new n(this.client,e.guild),this.code=e.code,this.presenceCount=e.approximate_presence_count,this.memberCount=e.approximate_member_count,this.textChannelCount=e.guild.text_channel_count,this.voiceChannelCount=e.guild.voice_channel_count,this.temporary=e.temporary,this.maxAge=e.max_age,this.uses=e.uses,this.maxUses=e.max_uses,e.inviter&&(this.inviter=this.client.dataManager.newUser(e.inviter)),this.channel=this.client.channels.get(e.channel.id)||new s(this.client,e.channel),this.createdTimestamp=new Date(e.created_at).getTime()}get createdAt(){return new Date(this.createdTimestamp)}get expiresTimestamp(){return this.createdTimestamp+1e3*this.maxAge}get expiresAt(){return new Date(this.expiresTimestamp)}get url(){return r.Endpoints.inviteLink(this.code)}delete(e){return this.client.rest.methods.deleteInvite(this,e)}toString(){return this.url}}e.exports=o},function(e,t){class i{constructor(e,t){Object.defineProperty(this,"client",{value:e}),this.setup(t)}setup(e){this.id=e.id,this.name=e.name,this.icon=e.icon,this.splash=e.splash}}e.exports=i},function(e,t,i){const n=i(0);class s{constructor(e,t){Object.defineProperty(this,"client",{value:e}),this.setup(t)}setup(e){this.id=e.id,this.name=e.name,this.type=n.ChannelTypes.TEXT===e.type?"text":"voice"}}e.exports=s},function(e,t,i){const n=i(3),s=i(8),r={ALL:"ALL",GUILD:"GUILD",CHANNEL:"CHANNEL",USER:"USER",ROLE:"ROLE",INVITE:"INVITE",WEBHOOK:"WEBHOOK",EMOJI:"EMOJI",MESSAGE:"MESSAGE"},o={ALL:null,GUILD_UPDATE:1,CHANNEL_CREATE:10,CHANNEL_UPDATE:11,CHANNEL_DELETE:12,CHANNEL_OVERWRITE_CREATE:13,CHANNEL_OVERWRITE_UPDATE:14,CHANNEL_OVERWRITE_DELETE:15,MEMBER_KICK:20,MEMBER_PRUNE:21,MEMBER_BAN_ADD:22,MEMBER_BAN_REMOVE:23,MEMBER_UPDATE:24,MEMBER_ROLE_UPDATE:25,ROLE_CREATE:30,ROLE_UPDATE:31,ROLE_DELETE:32,INVITE_CREATE:40,INVITE_UPDATE:41,INVITE_DELETE:42,WEBHOOK_CREATE:50,WEBHOOK_UPDATE:51,WEBHOOK_DELETE:52,EMOJI_CREATE:60,EMOJI_UPDATE:61,EMOJI_DELETE:62,MESSAGE_DELETE:72};class a{constructor(e,t){if(t.users)for(const i of t.users)e.client.dataManager.newUser(i);this.entries=new n;for(const i of t.audit_log_entries){const t=new c(e,i);this.entries.set(t.id,t)}}static build(...e){const t=new a(...e);return Promise.all(t.entries.map(e=>e.target)).then(()=>t)}static targetType(e){return e<10?r.GUILD:e<20?r.CHANNEL:e<30?r.USER:e<40?r.ROLE:e<50?r.INVITE:e<60?r.WEBHOOK:e<70?r.EMOJI:e<80?r.MESSAGE:null}static actionType(e){return[o.CHANNEL_CREATE,o.CHANNEL_OVERWRITE_CREATE,o.MEMBER_BAN_REMOVE,o.ROLE_CREATE,o.INVITE_CREATE,o.WEBHOOK_CREATE,o.EMOJI_CREATE].includes(e)?"CREATE":[o.CHANNEL_DELETE,o.CHANNEL_OVERWRITE_DELETE,o.MEMBER_KICK,o.MEMBER_PRUNE,o.MEMBER_BAN_ADD,o.ROLE_DELETE,o.INVITE_DELETE,o.WEBHOOK_DELETE,o.EMOJI_DELETE,o.MESSAGE_DELETE].includes(e)?"DELETE":[o.GUILD_UPDATE,o.CHANNEL_UPDATE,o.CHANNEL_OVERWRITE_UPDATE,o.MEMBER_UPDATE,o.MEMBER_ROLE_UPDATE,o.ROLE_UPDATE,o.INVITE_UPDATE,o.WEBHOOK_UPDATE,o.EMOJI_UPDATE].includes(e)?"UPDATE":"ALL"}}class c{constructor(e,t){const i=a.targetType(t.action_type);if(this.targetType=i,this.actionType=a.actionType(t.action_type),this.action=Object.keys(o).find(e=>o[e]===t.action_type),this.reason=t.reason||null,this.executor=e.client.users.get(t.user_id),this.changes=t.changes?t.changes.map(e=>({key:e.key,old:e.old_value,new:e.new_value})):null,this.id=t.id,this.extra=null,t.options)if(t.action_type===o.MEMBER_PRUNE)this.extra={removed:t.options.members_removed,days:t.options.delete_member_days};else if(t.action_type===o.MESSAGE_DELETE)this.extra={count:t.options.count,channel:e.channels.get(t.options.channel_id)};else switch(t.options.type){case"member":this.extra=e.members.get(t.options.id),this.extra||(this.extra={id:t.options.id});break;case"role":this.extra=e.roles.get(t.options.id),this.extra||(this.extra={id:t.options.id,name:t.options.role_name})}if([r.USER,r.GUILD].includes(i))this.target=e.client[`${i.toLowerCase()}s`].get(t.target_id);else if(i===r.WEBHOOK)this.target=e.fetchWebhooks().then(e=>(this.target=e.find(e=>e.id===t.target_id),this.target));else if(i===r.INVITE){const t=this.changes.find(e=>"code"===e.key);this.target=e.fetchInvites().then(e=>(this.target=e.find(e=>e.code===(t.new_value||t.old_value)),this.target))}else i===r.MESSAGE?this.target=e.client.users.get(t.target_id):this.target=e[`${i.toLowerCase()}s`].get(t.target_id)}get createdTimestamp(){return s.deconstruct(this.id).timestamp}get createdAt(){return new Date(this.createdTimestamp)}}a.Actions=o,a.Targets=r,a.Entry=c,e.exports=a},function(e,t){class i{constructor(e){this.restManager=e,this.queue=[]}get globalLimit(){return this.restManager.globallyRateLimited}set globalLimit(e){this.restManager.globallyRateLimited=e}push(e){this.queue.push(e)}handle(){}destroy(){this.queue=[]}}e.exports=i},function(e,t,i){const n=i(17),s=i(21),r=i(3);class o extends n{constructor(e,t){super(e,t),this.type="dm",this.messages=new r,this._typing=new Map}setup(e){super.setup(e),this.recipient=this.client.dataManager.newUser(e.recipients[0]),this.lastMessageID=e.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(){}createMessageCollector(){}awaitMessages(){}acknowledge(){}_cacheMessage(){}}s.applyToClass(o,!0,["bulkDelete"]),e.exports=o},function(e,t,i){const n=i(31),s=i(21),r=i(3);class o extends n{constructor(e,t){super(e,t),this.type="text",this.messages=new r,this._typing=new Map}setup(e){super.setup(e),this.topic=e.topic,this.nsfw=Boolean(e.nsfw),this.lastMessageID=e.last_message_id}get members(){const e=new r;for(const t of this.guild.members.values())this.permissionsFor(t).has("READ_MESSAGES")&&e.set(t.id,t);return e}fetchWebhooks(){return this.client.rest.methods.getChannelWebhooks(this)}createWebhook(e,t,i){return"string"==typeof t&&t.startsWith("data:")?this.client.rest.methods.createWebhook(this,e,t,i):this.client.resolver.resolveImage(t).then(t=>this.client.rest.methods.createWebhook(this,e,t,i))}send(){}sendMessage(){}sendEmbed(){}sendFile(){}sendFiles(){}sendCode(){}fetchMessage(){}fetchMessages(){}fetchPinnedMessages(){}search(){}startTyping(){}stopTyping(){}get typing(){}get typingCount(){}createCollector(){}createMessageCollector(){}awaitMessages(){}bulkDelete(){}acknowledge(){}_cacheMessage(){}}s.applyToClass(o,!0),e.exports=o},function(e,t){class i{constructor(e,t){Object.defineProperty(this,"channel",{value:e}),t&&this.setup(t)}setup(e){this.id=e.id,this.type=e.type,this.deny=e.deny,this.allow=e.allow}delete(e){return this.channel.client.rest.methods.deletePermissionOverwrites(this,e)}}e.exports=i},function(e,t,i){const n=i(31),s=i(3);class r extends n{constructor(e,t){super(e,t),this.members=new s,this.type="voice"}setup(e){super.setup(e),this.bitrate=.001*e.bitrate,this.userLimit=e.user_limit}get connection(){const e=this.guild.voiceConnection;return e&&e.channel.id===this.id?e:null}get full(){return this.userLimit>0&&this.members.size>=this.userLimit}get joinable(){return!this.client.browser&&(!!this.permissionsFor(this.client.user).has("CONNECT")&&!(this.full&&!this.permissionsFor(this.client.user).has("MOVE_MEMBERS")))}get speakable(){return this.permissionsFor(this.client.user).has("SPEAK")}setBitrate(e,t){return e*=1e3,this.edit({bitrate:e},t)}setUserLimit(e,t){return this.edit({userLimit:e},t)}join(){return this.client.browser?Promise.reject(new Error("Voice connections are not available in browsers.")):this.client.voice.joinChannel(this)}leave(){if(this.client.browser)return;const e=this.client.voice.connections.get(this.guild.id);e&&e.channel.id===this.id&&e.disconnect()}}e.exports=r},function(e,t,i){(function(t){const n="undefined"!=typeof window,s=i(9),r=i(0),o=i(27),a=i(121),c=function(){try{const e=i(161);return e.pack?e:null}catch(e){return null}}(),l=function(){if(n)return window.WebSocket;try{return i(162)}catch(e){return i(163)}}();class h extends s{constructor(e,t){super(),this.manager=e,this.client=e.client,this.ws=null,this.sequence=-1,this.status=r.Status.IDLE,this.packetManager=new a(this),this.lastPingTimestamp=0,this.ratelimit={queue:[],remaining:120,resetTime:-1},this.connect(t),this.disabledEvents={},this.closeSequence=0,this.expectingClose=!1;for(const e of this.client.options.disabledEvents)this.disabledEvents[e]=!0}triggerReady(){this.status!==r.Status.READY?(this.status=r.Status.READY,this.client.emit(r.Events.READY),this.packetManager.handleQueue()):this.debug("Tried to mark self as ready, but already ready")}checkIfReady(){if(this.status===r.Status.READY||this.status===r.Status.NEARLY)return!1;let e=0;for(const t of this.client.guilds.values())t.available||e++;if(0===e){if(this.status=r.Status.NEARLY,!this.client.options.fetchAllMembers)return this.triggerReady();const e=this.client.guilds.map(e=>e.fetchMembers());Promise.all(e).then(()=>this.triggerReady()).catch(e=>{this.debug(`Failed to fetch all members before ready! ${e}`),this.triggerReady()})}return!0}debug(e){return e instanceof Error&&(e=e.stack),this.manager.debug(`[connection] ${e}`)}unpack(e){return e instanceof ArrayBuffer&&(e=t.from(new Uint8Array(e))),c&&"string"!=typeof e?c.unpack(e):(e instanceof t&&(e=o.inflateSync(e).toString()),JSON.parse(e))}pack(e){return c?c.pack(e):JSON.stringify(e)}processQueue(){if(0!==this.ratelimit.remaining&&0!==this.ratelimit.queue.length)for(120===this.ratelimit.remaining&&(this.ratelimit.resetTimer=setTimeout(()=>{this.ratelimit.remaining=120,this.processQueue()},12e4));this.ratelimit.remaining>0;){const e=this.ratelimit.queue.shift();if(!e)return;this._send(e),this.ratelimit.remaining--}}_send(e){this.ws&&this.ws.readyState===l.OPEN?this.ws.send(this.pack(e)):this.debug(`Tried to send packet ${e} but no WebSocket is available!`)}send(e){this.ws&&this.ws.readyState===l.OPEN?(this.ratelimit.queue.push(e),this.processQueue()):this.debug(`Tried to send packet ${e} but no WebSocket is available!`)}connect(e=this.gateway,t=0,i=!1){if(t)return this.client.setTimeout(()=>this.connect(e,0,i),t);if(this.ws&&!i)return this.debug("WebSocket connection already exists"),!1;if("string"!=typeof e)return this.debug(`Tried to connect to an invalid gateway: ${e}`),!1;this.expectingClose=!1,this.gateway=e,this.debug(`Connecting to ${e}`);const s=this.ws=new l(e);return n&&(s.binaryType="arraybuffer"),s.onmessage=this.onMessage.bind(this),s.onopen=this.onOpen.bind(this),s.onerror=this.onError.bind(this),s.onclose=this.onClose.bind(this),this.status=r.Status.CONNECTING,!0}destroy(){const e=this.ws;return e?(this.heartbeat(-1),this.expectingClose=!0,e.close(1e3),this.packetManager.handleQueue(),this.ws=null,this.status=r.Status.DISCONNECTED,!0):(this.debug("Attempted to destroy WebSocket but no connection exists!"),!1)}onMessage(e){let t;try{t=this.unpack(e.data)}catch(e){this.emit("debug",e)}return this.onPacket(t)}setSequence(e){this.sequence=e>this.sequence?e:this.sequence}onPacket(e){if(!e)return this.debug("Received null packet"),!1;switch(this.client.emit("raw",e),e.op){case r.OPCodes.HELLO:return this.heartbeat(e.d.heartbeat_interval);case r.OPCodes.RECONNECT:return this.reconnect();case r.OPCodes.INVALID_SESSION:return e.d||(this.sessionID=null),this.sequence=-1,this.debug("Session invalidated -- will identify with a new session"),this.identify(e.d?2500:0);case r.OPCodes.HEARTBEAT_ACK:return this.ackHeartbeat();case r.OPCodes.HEARTBEAT:return this.heartbeat();default:return this.packetManager.handle(e)}}onOpen(e){e&&e.target&&e.target.url&&(this.gateway=e.target.url),this.debug(`Connected to gateway ${this.gateway}`),this.identify()}reconnect(){this.debug("Attemping to reconnect in 5500ms..."),this.client.emit(r.Events.RECONNECTING),this.connect(this.gateway,5500,!0)}onError(e){e&&"uWs client connection error"===e.message?this.reconnect():this.client.emit(r.Events.ERROR,e)}onClose(e){if(this.debug(`${this.expectingClose?"Client":"Server"} closed the WebSocket connection: ${e.code}`),this.closeSequence=this.sequence,this.emit("close",e),this.heartbeat(-1),1e3===e.code?this.expectingClose:r.WSCodes[e.code])return this.expectingClose=!1,this.client.emit(r.Events.DISCONNECT,e),this.debug(r.WSCodes[e.code]),void this.destroy();this.expectingClose=!1,this.reconnect()}ackHeartbeat(){this.debug(`Heartbeat acknowledged, latency of ${Date.now()-this.lastPingTimestamp}ms`),this.client._pong(this.lastPingTimestamp)}heartbeat(e){isNaN(e)?(this.debug("Sending a heartbeat"),this.lastPingTimestamp=Date.now(),this.send({op:r.OPCodes.HEARTBEAT,d:this.sequence})):-1===e?(this.debug("Clearing heartbeat interval"),this.client.clearInterval(this.heartbeatInterval),this.heartbeatInterval=null):(this.debug(`Setting a heartbeat interval for ${e}ms`),this.heartbeatInterval=this.client.setInterval(()=>this.heartbeat(),e))}identify(e){return e?this.client.setTimeout(this.identify.bind(this),e):this.sessionID?this.identifyResume():this.identifyNew()}identifyNew(){if(!this.client.token)return void this.debug("No token available to identify a new session with");const e=Object.assign({token:this.client.token},this.client.options.ws),{shardId:t,shardCount:i}=this.client.options;i>0&&(e.shard=[Number(t),Number(i)]),this.debug("Identifying as a new session"),this.send({op:r.OPCodes.IDENTIFY,d:e})}identifyResume(){if(!this.sessionID)return this.debug("Warning: wanted to resume but session ID not available; identifying as a new session instead"),this.identifyNew();this.debug(`Attempting to resume session ${this.sessionID}`);const e={token:this.client.token,session_id:this.sessionID,seq:this.sequence};return this.send({op:r.OPCodes.RESUME,d:e})}}h.ENCODING=c?"etf":"json",h.WebSocket=l,e.exports=h}).call(t,i(5).Buffer)},function(e,t,i){const n=i(14),s=i(3),r=i(74),o=i(123),a=i(0);class c extends n{setup(e){if(super.setup(e),this.verified=e.verified,this.email=e.email,this.localPresence={},this._typing=new Map,this.friends=new s,this.blocked=new s,this.notes=new s,this.premium="boolean"==typeof e.premium?e.premium:null,this.mfaEnabled="boolean"==typeof e.mfa_enabled?e.mfa_enabled:null,this.mobile="boolean"==typeof e.mobile?e.mobile:null,this.settings=e.user_settings?new r(this,e.user_settings):null,this.guildSettings=new s,e.user_guild_settings)for(const t of e.user_guild_settings)this.guildSettings.set(t.guild_id,new o(t,this.client))}edit(e){return this.client.rest.methods.updateCurrentUser(e)}setUsername(e,t){return this.client.rest.methods.updateCurrentUser({username:e},t)}setEmail(e,t){return this.client.rest.methods.updateCurrentUser({email:e},t)}setPassword(e,t){return this.client.rest.methods.updateCurrentUser({password:e},t)}setAvatar(e){return this.client.resolver.resolveImage(e).then(e=>this.client.rest.methods.updateCurrentUser({avatar:e}))}setPresence(e){return new Promise(t=>{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}),e.status){if("string"!=typeof e.status)throw new TypeError("Status must be a string");this.bot?i=e.status:(this.settings.update(a.UserSettingsMap.status,e.status),i="invisible")}e.game?(n=e.game).type=n.url?1:0:void 0!==e.game&&(n=null),void 0!==e.afk&&(s=e.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),t(this)})}setStatus(e){return this.setPresence({status:e})}setGame(e,t){return e?this.setPresence({game:{name:e,url:t}}):this.setPresence({game:null})}setAFK(e){return this.setPresence({afk:e})}fetchMentions(e={}){return this.client.rest.methods.fetchMentions(e)}addFriend(e){return e=this.client.resolver.resolveUser(e),this.client.rest.methods.addFriend(e)}removeFriend(e){return e=this.client.resolver.resolveUser(e),this.client.rest.methods.removeFriend(e)}createGuild(e,t,i=null){return"string"==typeof i&&i.startsWith("data:")?this.client.rest.methods.createGuild({name:e,icon:i,region:t}):this.client.resolver.resolveImage(i).then(i=>this.client.rest.methods.createGuild({name:e,icon:i,region:t}))}createGroupDM(e){return this.client.rest.methods.createGroupDM({recipients:e.map(e=>this.client.resolver.resolveUserID(e.user)),accessTokens:e.map(e=>e.accessToken),nicks:e.map(e=>e.nick)})}acceptInvite(e){return this.client.rest.methods.acceptInvite(e)}}e.exports=c},function(e,t,i){const n=i(0),s=i(4);class r{constructor(e,t){this.user=e,this.patch(t)}patch(e){for(const t of Object.keys(n.UserSettingsMap)){const i=n.UserSettingsMap[t];e.hasOwnProperty(t)&&("function"==typeof i?this[i.name]=i(e[t]):this[i]=e[t])}}update(e,t){return this.user.client.rest.methods.patchUserSettings({[e]:t})}setGuildPosition(e,t,i){const n=Object.assign([],this.guildPositions);return s.moveElementInArray(n,e.id,t,i),this.update("guild_positions",n).then(()=>e)}addRestrictedGuild(e){const t=Object.assign([],this.restrictedGuilds);return t.includes(e.id)?Promise.reject(new Error("Guild is already restricted")):(t.push(e.id),this.update("restricted_guilds",t).then(()=>e))}removeRestrictedGuild(e){const t=Object.assign([],this.restrictedGuilds),i=t.indexOf(e.id);return i<0?Promise.reject(new Error("Guild is not restricted")):(t.splice(i,1),this.update("restricted_guilds",t).then(()=>e))}}e.exports=r},function(e,t,i){const n="undefined"!=typeof window,s=i(76);e.exports=s,n?window.Discord=s:n||console.warn("Warning: Attempting to use browser version of Discord.js in a non-browser environment!")},function(e,t,i){const n=i(4);e.exports={Client:i(108),Shard:i(197),ShardClientUtil:i(198),ShardingManager:i(199),WebhookClient:i(200),Collection:i(3),Constants:i(0),DiscordAPIError:i(44),EvaluatedPermissions:i(11),Permissions:i(11),Snowflake:i(8),SnowflakeUtil:i(8),Util:n,util:n,version:i(55).version,escapeMarkdown:n.escapeMarkdown,fetchRecommendedShards:n.fetchRecommendedShards,splitMessage:n.splitMessage,Attachment:i(29),Channel:i(17),ClientUser:i(73),ClientUserSettings:i(74),Collector:i(40),DMChannel:i(68),Emoji:i(23),Game:i(16).Game,GroupDMChannel:i(43),Guild:i(30),GuildAuditLogs:i(66),GuildChannel:i(31),GuildMember:i(24),Invite:i(63),Message:i(22),MessageAttachment:i(58),MessageCollector:i(62),MessageEmbed:i(59),MessageMentions:i(57),MessageReaction:i(60),OAuth2Application:i(42),ClientOAuth2Application:i(42),PartialGuild:i(64),PartialGuildChannel:i(65),PermissionOverwrites:i(70),Presence:i(16).Presence,ReactionEmoji:i(39),ReactionCollector:i(61),RichEmbed:i(28),Role:i(15),TextChannel:i(69),User:i(14),VoiceChannel:i(71),Webhook:i(41)}},function(e,t,i){"use strict";function n(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===e[t-2]?2:"="===e[t-1]?1:0}function s(e){return o[e>>18&63]+o[e>>12&63]+o[e>>6&63]+o[63&e]}function r(e,t,i){for(var n,r=[],o=t;o0?l-4:l;var h=0;for(t=0;t>16&255,o[h++]=s>>8&255,o[h++]=255&s;return 2===r?(s=a[e.charCodeAt(t)]<<2|a[e.charCodeAt(t+1)]>>4,o[h++]=255&s):1===r&&(s=a[e.charCodeAt(t)]<<10|a[e.charCodeAt(t+1)]<<4|a[e.charCodeAt(t+2)]>>2,o[h++]=s>>8&255,o[h++]=255&s),o},t.fromByteArray=function(e){for(var t,i=e.length,n=i%3,s="",a=[],c=0,l=i-n;cl?l:c+16383));return 1===n?(t=e[i-1],s+=o[t>>2],s+=o[t<<4&63],s+="=="):2===n&&(t=(e[i-2]<<8)+e[i-1],s+=o[t>>10],s+=o[t>>4&63],s+=o[t<<2&63],s+="="),a.push(s),a.join("")};for(var o=[],a=[],c="undefined"!=typeof Uint8Array?Uint8Array:Array,l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",h=0,u=l.length;h>1,h=-7,u=i?s-1:0,d=i?-1:1,p=e[t+u];for(u+=d,r=p&(1<<-h)-1,p>>=-h,h+=a;h>0;r=256*r+e[t+u],u+=d,h-=8);for(o=r&(1<<-h)-1,r>>=-h,h+=n;h>0;o=256*o+e[t+u],u+=d,h-=8);if(0===r)r=1-l;else{if(r===c)return o?NaN:1/0*(p?-1:1);o+=Math.pow(2,n),r-=l}return(p?-1:1)*o*Math.pow(2,r-n)},t.write=function(e,t,i,n,s,r){var o,a,c,l=8*r-s-1,h=(1<>1,d=23===s?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:r-1,m=n?1:-1,f=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,o=h):(o=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-o))<1&&(o--,c*=2),(t+=o+u>=1?d/c:d*Math.pow(2,1-u))*c>=2&&(o++,c/=2),o+u>=h?(a=0,o=h):o+u>=1?(a=(t*c-1)*Math.pow(2,s),o+=u):(a=t*Math.pow(2,u-1)*Math.pow(2,s),o=0));s>=8;e[i+p]=255&a,p+=m,a/=256,s-=8);for(o=o<0;e[i+p]=255&o,p+=m,o/=256,l-=8);e[i+p-m]|=128*f}},function(e,t,i){(function(t){function n(e){return c.format({protocol:e.connection.encrypted?"https:":"http:",hostname:e.getHeader("host"),pathname:e.path.split("?")[0],query:e.query})}i(25);const s=i(27),r=i(35),o=i(36),a=i(100),c=i(52),l=i(101),h=i(25),u=i(102),d={http:o,https:a,file:i(105),http2:i(106)};class p extends h.Readable{constructor(e,t,i={headers:null,data:null,query:null,version:1}){super();const n=c.parse(t);n.method=e.toUpperCase(),i.headers&&(n.headers=i.headers),"agent"in i&&(n.agent=i.agent);const s=2===i.version?d.http2:d[n.protocol.replace(":","")];this.request=s.request(n),this.request.followRedirects=i.followRedirects,i.query&&this.query(i.query),i.data&&this.send(i.data)}query(e,t){if(this.response)throw new Error("Cannot modify query after being sent!");return null!==e&&"object"==typeof e?this.request.query=Object.assign(this.request.query||{},e):this.request.query[e]=t,this}set(e,t){if(this.response)throw new Error("Cannot modify headers after being sent!");if(null!==e&&"object"==typeof e)for(const t of Object.keys(e))this.set(t,e[t]);else this.request.setHeader(e,t);return this}attach(e,t,i){if(this.response)throw new Error("Cannot modify data after being sent!");const n=this._getFormData();return this.set("Content-Type",`multipart/form-data; boundary=${n.boundary}`),n.append(e,t,i),this.data=n,this}send(e){if(this.response)throw new Error("Cannot modify data after being sent!");if(e instanceof t||e instanceof h)this.data=e;else if(null!==e&&"object"==typeof e){const t=this._getRequestHeader("content-type");let i;t?t.includes("json")?i=JSON.stringify:t.includes("urlencoded")&&(i=r.stringify):(this.set("Content-Type","application/json"),i=JSON.stringify),this.data=i(e)}else this.data=e;return this}then(e,i){return new Promise((e,i)=>{const a=this.request,l=e=>{e||(e=new Error("Unknown error occured")),e.request=a,i(e)};a.once("abort",l),a.once("aborted",l),a.once("error",l),a.once("response",l=>{const u=new h.PassThrough;this._shouldUnzip(l)?l.pipe(s.createUnzip({flush:s.Z_SYNC_FLUSH,finishFlush:s.Z_SYNC_FLUSH})).pipe(u):l.pipe(u);const d=[];u.on("data",e=>{this.push(e)||this.pause(),d.push(e)}),u.once("end",()=>{this.push(null);const s=t.concat(d);if(this.request.followRedirects&&this._shouldRedirect(l)){let t=this.request.method;[301,302].includes(l.statusCode)?("HEAD"!==t&&(t="GET"),this.data=null):303===l.statusCode&&(t="GET");const i={};if(this.request._headerNames)for(const e of Object.keys(this.request._headerNames))"host"!==e.toLowerCase()&&(i[this.request._headerNames[e]]=this.request._headers[e]);else for(const e of Object.keys(this.request._headers)){if("host"===e.toLowerCase())continue;const t=this.request._headers[e];i[t.name]=t.value}const s=/^https?:\/\//i.test(l.headers.location)?l.headers.location:c.resolve(n(a),l.headers.location);return void e(new p(t,s,{data:this.data,headers:i}))}const h={request:this.request,get body(){delete h.body;const e=l.headers["content-type"];if(e&&e.includes("application/json"))try{h.body=JSON.parse(h.text)}catch(e){h.body=h.text}else e&&e.includes("application/x-www-form-urlencoded")?h.body=r.parse(h.text):h.body=s;return h.body},text:s.toString(),ok:l.statusCode>=200&&l.statusCode<400,headers:l.headers,status:l.statusCode,statusText:l.statusText||o.STATUS_CODES[l.statusCode]};if(h.ok)e(h);else{const e=new Error(`${h.status} ${h.statusText}`.trim());Object.assign(e,h),i(e)}})});const u=this.data?this.data.end?this.data.end():this.data:null;if(this._addFinalHeaders(),this.request.query&&(this.request.path=`${this.request.path}?${r.stringify(this.request.query)}`),Array.isArray(u)){for(const e of u)a.write(e);a.end()}else u instanceof h?u.pipe(a):u instanceof t?(this.set("Content-Length",t.byteLength(u)),a.end(u)):a.end(u)}).then(e,i)}catch(e){return this.then(null,e)}end(e){return this.then(t=>e?e(null,t):t,t=>e?e(t,t.status?t:null):t)}_read(){this.resume(),this.response||this.catch(e=>this.emit("error",e))}_shouldUnzip(e){return 204!==e.statusCode&&304!==e.statusCode&&("0"!==e.headers["content-length"]&&/^\s*(?:deflate|gzip)\s*$/.test(e.headers["content-encoding"]))}_shouldRedirect(e){return[301,302,303,307,308].includes(e.statusCode)}_getFormData(){return this._formData||(this._formData=new u),this._formData}_addFinalHeaders(){this.request&&(this._getRequestHeader("user-agent")||this.set("User-Agent",`snekfetch/${p.version} (${l.repository.url.replace(/\.?git/,"")})`),"HEAD"!==this.request.method&&this.set("Accept-Encoding","gzip, deflate"),this.data&&this.data.end&&this.set("Content-Length",this.data.length))}get response(){return this.request?this.request.res||this.request._response||null:null}_getRequestHeader(e){try{return this.request.getHeader(e)}catch(e){return null}}}p.version=l.version,p.METHODS=(o.METHODS||["GET","POST","PUT","DELETE","OPTIONS","HEAD"]).concat("BREW");for(const e of p.METHODS)p["M-SEARCH"===e?"msearch":e.toLowerCase()]=((t,i)=>new p(e,t,i));e.exports=p}).call(t,i(5).Buffer)},function(e,t){},function(e,t,i){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t,i){e.copy(t,i)}var r=i(33).Buffer;e.exports=function(){function e(){n(this,e),this.head=null,this.tail=null,this.length=0}return e.prototype.push=function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length},e.prototype.unshift=function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length},e.prototype.shift=function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}},e.prototype.clear=function(){this.head=this.tail=null,this.length=0},e.prototype.join=function(e){if(0===this.length)return"";for(var t=this.head,i=""+t.data;t=t.next;)i+=e+t.data;return i},e.prototype.concat=function(e){if(0===this.length)return r.alloc(0);if(1===this.length)return this.head.data;for(var t=r.allocUnsafe(e>>>0),i=this.head,n=0;i;)s(i.data,t,n),n+=i.data.length,i=i.next;return t},e}()},function(e,t,i){function n(e,t){this._id=e,this._clearFn=t}var s=Function.prototype.apply;t.setTimeout=function(){return new n(s.call(setTimeout,window,arguments),clearTimeout)},t.setInterval=function(){return new n(s.call(setInterval,window,arguments),clearInterval)},t.clearTimeout=t.clearInterval=function(e){e&&e.close()},n.prototype.unref=n.prototype.ref=function(){},n.prototype.close=function(){this._clearFn.call(window,this._id)},t.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},t.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},t._unrefActive=t.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;t>=0&&(e._idleTimeoutId=setTimeout(function(){e._onTimeout&&e._onTimeout()},t))},i(83),t.setImmediate=setImmediate,t.clearImmediate=clearImmediate},function(e,t,i){(function(e,t){!function(e,i){"use strict";function n(e){delete c[e]}function s(e){var t=e.callback,n=e.args;switch(n.length){case 0:t();break;case 1:t(n[0]);break;case 2:t(n[0],n[1]);break;case 3:t(n[0],n[1],n[2]);break;default:t.apply(i,n)}}function r(e){if(l)setTimeout(r,0,e);else{var t=c[e];if(t){l=!0;try{s(t)}finally{n(e),l=!1}}}}if(!e.setImmediate){var o,a=1,c={},l=!1,h=e.document,u=Object.getPrototypeOf&&Object.getPrototypeOf(e);u=u&&u.setTimeout?u:e,"[object process]"==={}.toString.call(e.process)?o=function(e){t.nextTick(function(){r(e)})}:function(){if(e.postMessage&&!e.importScripts){var t=!0,i=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=i,t}}()?function(){var t="setImmediate$"+Math.random()+"$",i=function(i){i.source===e&&"string"==typeof i.data&&0===i.data.indexOf(t)&&r(+i.data.slice(t.length))};e.addEventListener?e.addEventListener("message",i,!1):e.attachEvent("onmessage",i),o=function(i){e.postMessage(t+i,"*")}}():e.MessageChannel?function(){var e=new MessageChannel;e.port1.onmessage=function(e){r(e.data)},o=function(t){e.port2.postMessage(t)}}():h&&"onreadystatechange"in h.createElement("script")?function(){var e=h.documentElement;o=function(t){var i=h.createElement("script");i.onreadystatechange=function(){r(t),i.onreadystatechange=null,e.removeChild(i),i=null},e.appendChild(i)}}():o=function(e){setTimeout(r,0,e)},u.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),i=0;i0&&l>c&&(l=c);for(var h=0;h=0?(u=f.substr(0,g),d=f.substr(g+1)):(u=f,d=""),p=decodeURIComponent(u),m=decodeURIComponent(d),n(o,p)?s(o[p])?o[p].push(m):o[p]=[o[p],m]:o[p]=m}return o};var s=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},function(e,t,i){"use strict";function n(e,t){if(e.map)return e.map(t);for(var i=[],n=0;ne._pos){var r=i.substr(e._pos);if("x-user-defined"===e._charset){for(var o=new n(r.length),a=0;ae._pos&&(e.push(new n(new Uint8Array(l.result.slice(e._pos)))),e._pos=l.result.byteLength)},l.onload=function(){e.push(null)},l.readAsArrayBuffer(i)}e._xhr.readyState===c.DONE&&"ms-stream"!==e._mode&&e.push(null)}}).call(t,i(7),i(5).Buffer,i(6))},function(e,t,i){var n=i(5).Buffer;e.exports=function(e){if(e instanceof Uint8Array){if(0===e.byteOffset&&e.byteLength===e.buffer.byteLength)return e.buffer;if("function"==typeof e.buffer.slice)return e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}if(n.isBuffer(e)){for(var t=new Uint8Array(e.length),i=e.length,s=0;s1&&(n=i[0]+"@",e=i[1]),n+a((e=e.replace(M,".")).split("."),t).join(".")}function l(e){for(var t,i,n=[],s=0,r=e.length;s=55296&&t<=56319&&s65535&&(t+=U((e-=65536)>>>10&1023|55296),e=56320|1023&e),t+=U(e)}).join("")}function u(e){return e-48<10?e-22:e-65<26?e-65:e-97<26?e-97:b}function d(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function p(e,t,i){var n=0;for(e=i?I(e/x):e>>1,e+=I(e/t);e>C*y>>1;n+=b)e=I(e/C);return I(n+(C+1)*e/(e+w))}function m(e){var t,i,n,s,r,a,c,l,d,m,f=[],g=e.length,v=0,w=T,x=A;for((i=e.lastIndexOf(R))<0&&(i=0),n=0;n=128&&o("not-basic"),f.push(e.charCodeAt(n));for(s=i>0?i+1:0;s=g&&o("invalid-input"),((l=u(e.charCodeAt(s++)))>=b||l>I((E-v)/a))&&o("overflow"),v+=l*a,d=c<=x?_:c>=x+y?y:c-x,!(lI(E/(m=b-d))&&o("overflow"),a*=m;x=p(v-r,t=f.length+1,0==r),I(v/t)>E-w&&o("overflow"),w+=I(v/t),v%=t,f.splice(v++,0,w)}return h(f)}function f(e){var t,i,n,s,r,a,c,h,u,m,f,g,v,w,x,S=[];for(g=(e=l(e)).length,t=T,i=0,r=A,a=0;a=t&&fI((E-i)/(v=n+1))&&o("overflow"),i+=(c-t)*v,t=c,a=0;aE&&o("overflow"),f==t){for(h=i,u=b;m=u<=r?_:u>=r+y?y:u-r,!(h= 0x80 (not a basic code point)","invalid-input":"Invalid input"},C=b-_,I=Math.floor,U=String.fromCharCode;v={version:"1.4.1",ucs2:{decode:l,encode:h},decode:m,encode:f,toASCII:function(e){return c(e,function(e){return k.test(e)?"xn--"+f(e):e})},toUnicode:function(e){return c(e,function(e){return S.test(e)?m(e.slice(4).toLowerCase()):e})}},void 0!==(s=function(){return v}.call(t,i,t,e))&&(e.exports=s)}()}).call(t,i(98)(e),i(6))},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,i){"use strict";e.exports={isString:function(e){return"string"==typeof e},isObject:function(e){return"object"==typeof e&&null!==e},isNull:function(e){return null===e},isNullOrUndefined:function(e){return null==e}}},function(e,t,i){var n=i(36),s=e.exports;for(var r in n)n.hasOwnProperty(r)&&(s[r]=n[r]);s.request=function(e,t){return e||(e={}),e.scheme="https",e.protocol="https:",n.request.call(this,e,t)}},function(e,t){e.exports={_args:[[{raw:"snekfetch@^3.1.0",scope:null,escapedName:"snekfetch",name:"snekfetch",rawSpec:"^3.1.0",spec:">=3.1.0 <4.0.0",type:"range"},"/home/travis/build/hydrabolt/discord.js"]],_from:"snekfetch@>=3.1.0 <4.0.0",_id:"snekfetch@3.3.0",_inCache:!0,_location:"/snekfetch",_nodeVersion:"8.4.0",_npmOperationalInternal:{host:"s3://npm-registry-packages",tmp:"tmp/snekfetch-3.3.0.tgz_1504416679797_0.3850039339158684"},_npmUser:{name:"snek",email:"me@gus.host"},_npmVersion:"5.3.0",_phantomChildren:{},_requested:{raw:"snekfetch@^3.1.0",scope:null,escapedName:"snekfetch",name:"snekfetch",rawSpec:"^3.1.0",spec:">=3.1.0 <4.0.0",type:"range"},_requiredBy:["/"],_resolved:"https://registry.npmjs.org/snekfetch/-/snekfetch-3.3.0.tgz",_shasum:"97aa0d79d5920f18c26d4c8a7fddbe91205ad0fa",_shrinkwrap:null,_spec:"snekfetch@^3.1.0",_where:"/home/travis/build/hydrabolt/discord.js",author:{name:"Gus Caplan",email:"me@gus.host"},bugs:{url:"https://github.com/devsnek/snekfetch/issues"},dependencies:{},description:"Just do http requests without all that weird nastiness from other libs",devDependencies:{},directories:{},dist:{integrity:"sha512-R0VGqazwvZChkYuidDdaAzkvD6hUJ/qxfFUykyD1eovfH6PC2d9C9Qv+z4bUjMmKjBp0FE6GxMZtE9IKY/dngA==",shasum:"97aa0d79d5920f18c26d4c8a7fddbe91205ad0fa",tarball:"https://registry.npmjs.org/snekfetch/-/snekfetch-3.3.0.tgz"},gitHead:"7b4fff64301580b46668d46e45a88fbd0330b055",homepage:"https://github.com/devsnek/snekfetch#readme",license:"MIT",main:"index.js",maintainers:[{name:"snek",email:"me@gus.host"}],name:"snekfetch",optionalDependencies:{},readme:"ERROR: No README data found!",repository:{type:"git",url:"git+https://github.com/devsnek/snekfetch.git"},version:"3.3.0"}},function(e,t,i){(function(t){const n=i(20),s=i(53);class r{constructor(){this.boundary=`--snekfetch--${Math.random().toString().slice(2,7)}`,this.buffers=[]}append(e,i,r){if(void 0===i)return;let o=`\r\n--${this.boundary}\r\nContent-Disposition: form-data; name="${e}"`,a=null;if(r){o+=`; filename="${r}"`,a="application/octet-stream";const e=n.extname(r).slice(1);e&&(a=s.lookup(e))}i instanceof t?a=s.buffer(i):"object"==typeof i?(a="application/json",i=t.from(JSON.stringify(i))):i=t.from(String(i)),a&&(o+=`\r\nContent-Type: ${a}`),this.buffers.push(`${o}\r\n\r\n`),this.buffers.push(i)}end(){return this.buffers.push(`\r\n--${this.boundary}--`),this.buffers}get length(){return this.buffers.reduce((e,i)=>e+t.byteLength(i),0)}}e.exports=r}).call(t,i(5).Buffer)},function(e,t){e.exports={123:"application/vnd.lotus-1-2-3",ez:"application/andrew-inset",aw:"application/applixware",atom:"application/atom+xml",atomcat:"application/atomcat+xml",atomsvc:"application/atomsvc+xml",bdoc:"application/x-bdoc",ccxml:"application/ccxml+xml",cdmia:"application/cdmi-capability",cdmic:"application/cdmi-container",cdmid:"application/cdmi-domain",cdmio:"application/cdmi-object",cdmiq:"application/cdmi-queue",cu:"application/cu-seeme",mpd:"application/dash+xml",davmount:"application/davmount+xml",dbk:"application/docbook+xml",dssc:"application/dssc+der",xdssc:"application/dssc+xml",ecma:"application/ecmascript",emma:"application/emma+xml",epub:"application/epub+zip",exi:"application/exi",pfr:"application/font-tdpfr",woff:"application/font-woff",woff2:"application/font-woff2",geojson:"application/geo+json",gml:"application/gml+xml",gpx:"application/gpx+xml",gxf:"application/gxf",stk:"application/hyperstudio",ink:"application/inkml+xml",inkml:"application/inkml+xml",ipfix:"application/ipfix",jar:"application/java-archive",war:"application/java-archive",ear:"application/java-archive",ser:"application/java-serialized-object",class:"application/java-vm",js:"application/javascript",json:"application/json",map:"application/json",json5:"application/json5",jsonml:"application/jsonml+json",jsonld:"application/ld+json",lostxml:"application/lost+xml",hqx:"application/mac-binhex40",cpt:"application/mac-compactpro",mads:"application/mads+xml",webmanifest:"application/manifest+json",mrc:"application/marc",mrcx:"application/marcxml+xml",ma:"application/mathematica",nb:"application/mathematica",mb:"application/mathematica",mathml:"application/mathml+xml",mbox:"application/mbox",mscml:"application/mediaservercontrol+xml",metalink:"application/metalink+xml",meta4:"application/metalink4+xml",mets:"application/mets+xml",mods:"application/mods+xml",m21:"application/mp21",mp21:"application/mp21",mp4s:"application/mp4",m4p:"application/mp4",doc:"application/msword",dot:"application/msword",mxf:"application/mxf",bin:"application/octet-stream",dms:"application/octet-stream",lrf:"application/octet-stream",mar:"application/octet-stream",so:"application/octet-stream",dist:"application/octet-stream",distz:"application/octet-stream",pkg:"application/octet-stream",bpk:"application/octet-stream",dump:"application/octet-stream",elc:"application/octet-stream",deploy:"application/octet-stream",exe:"application/x-msdownload",dll:"application/x-msdownload",deb:"application/x-debian-package",dmg:"application/x-apple-diskimage",iso:"application/x-iso9660-image",img:"application/octet-stream",msi:"application/x-msdownload",msp:"application/octet-stream",msm:"application/octet-stream",buffer:"application/octet-stream",oda:"application/oda",opf:"application/oebps-package+xml",ogx:"application/ogg",omdoc:"application/omdoc+xml",onetoc:"application/onenote",onetoc2:"application/onenote",onetmp:"application/onenote",onepkg:"application/onenote",oxps:"application/oxps",xer:"application/patch-ops-error+xml",pdf:"application/pdf",pgp:"application/pgp-encrypted",asc:"application/pgp-signature",sig:"application/pgp-signature",prf:"application/pics-rules",p10:"application/pkcs10",p7m:"application/pkcs7-mime",p7c:"application/pkcs7-mime",p7s:"application/pkcs7-signature",p8:"application/pkcs8",ac:"application/pkix-attr-cert",cer:"application/pkix-cert",crl:"application/pkix-crl",pkipath:"application/pkix-pkipath",pki:"application/pkixcmp",pls:"application/pls+xml",ai:"application/postscript",eps:"application/postscript",ps:"application/postscript",cww:"application/prs.cww",pskcxml:"application/pskc+xml",rdf:"application/rdf+xml",rif:"application/reginfo+xml",rnc:"application/relax-ng-compact-syntax",rl:"application/resource-lists+xml",rld:"application/resource-lists-diff+xml",rs:"application/rls-services+xml",gbr:"application/rpki-ghostbusters",mft:"application/rpki-manifest",roa:"application/rpki-roa",rsd:"application/rsd+xml",rss:"application/rss+xml",rtf:"text/rtf",sbml:"application/sbml+xml",scq:"application/scvp-cv-request",scs:"application/scvp-cv-response",spq:"application/scvp-vp-request",spp:"application/scvp-vp-response",sdp:"application/sdp",setpay:"application/set-payment-initiation",setreg:"application/set-registration-initiation",shf:"application/shf+xml",smi:"application/smil+xml",smil:"application/smil+xml",rq:"application/sparql-query",srx:"application/sparql-results+xml",gram:"application/srgs",grxml:"application/srgs+xml",sru:"application/sru+xml",ssdl:"application/ssdl+xml",ssml:"application/ssml+xml",tei:"application/tei+xml",teicorpus:"application/tei+xml",tfi:"application/thraud+xml",tsd:"application/timestamped-data",plb:"application/vnd.3gpp.pic-bw-large",psb:"application/vnd.3gpp.pic-bw-small",pvb:"application/vnd.3gpp.pic-bw-var",tcap:"application/vnd.3gpp2.tcap",pwn:"application/vnd.3m.post-it-notes",aso:"application/vnd.accpac.simply.aso",imp:"application/vnd.accpac.simply.imp",acu:"application/vnd.acucobol",atc:"application/vnd.acucorp",acutc:"application/vnd.acucorp",air:"application/vnd.adobe.air-application-installer-package+zip",fcdt:"application/vnd.adobe.formscentral.fcdt",fxp:"application/vnd.adobe.fxp",fxpl:"application/vnd.adobe.fxp",xdp:"application/vnd.adobe.xdp+xml",xfdf:"application/vnd.adobe.xfdf",ahead:"application/vnd.ahead.space",azf:"application/vnd.airzip.filesecure.azf",azs:"application/vnd.airzip.filesecure.azs",azw:"application/vnd.amazon.ebook",acc:"application/vnd.americandynamics.acc",ami:"application/vnd.amiga.ami",apk:"application/vnd.android.package-archive",cii:"application/vnd.anser-web-certificate-issue-initiation",fti:"application/vnd.anser-web-funds-transfer-initiation",atx:"application/vnd.antix.game-component",mpkg:"application/vnd.apple.installer+xml",m3u8:"application/vnd.apple.mpegurl",pkpass:"application/vnd.apple.pkpass",swi:"application/vnd.aristanetworks.swi",iota:"application/vnd.astraea-software.iota",aep:"application/vnd.audiograph",mpm:"application/vnd.blueice.multipass",bmi:"application/vnd.bmi",rep:"application/vnd.businessobjects",cdxml:"application/vnd.chemdraw+xml",mmd:"application/vnd.chipnuts.karaoke-mmd",cdy:"application/vnd.cinderella",cla:"application/vnd.claymore",rp9:"application/vnd.cloanto.rp9",c4g:"application/vnd.clonk.c4group",c4d:"application/vnd.clonk.c4group",c4f:"application/vnd.clonk.c4group",c4p:"application/vnd.clonk.c4group",c4u:"application/vnd.clonk.c4group",c11amc:"application/vnd.cluetrust.cartomobile-config",c11amz:"application/vnd.cluetrust.cartomobile-config-pkg",csp:"application/vnd.commonspace",cdbcmsg:"application/vnd.contact.cmsg",cmc:"application/vnd.cosmocaller",clkx:"application/vnd.crick.clicker",clkk:"application/vnd.crick.clicker.keyboard",clkp:"application/vnd.crick.clicker.palette",clkt:"application/vnd.crick.clicker.template",clkw:"application/vnd.crick.clicker.wordbank",wbs:"application/vnd.criticaltools.wbs+xml",pml:"application/vnd.ctc-posml",ppd:"application/vnd.cups-ppd",car:"application/vnd.curl.car",pcurl:"application/vnd.curl.pcurl",dart:"application/vnd.dart",rdz:"application/vnd.data-vision.rdz",uvf:"application/vnd.dece.data",uvvf:"application/vnd.dece.data",uvd:"application/vnd.dece.data",uvvd:"application/vnd.dece.data",uvt:"application/vnd.dece.ttml+xml",uvvt:"application/vnd.dece.ttml+xml",uvx:"application/vnd.dece.unspecified",uvvx:"application/vnd.dece.unspecified",uvz:"application/vnd.dece.zip",uvvz:"application/vnd.dece.zip",fe_launch:"application/vnd.denovo.fcselayout-link",dna:"application/vnd.dna",mlp:"application/vnd.dolby.mlp",dpg:"application/vnd.dpgraph",dfac:"application/vnd.dreamfactory",kpxx:"application/vnd.ds-keypoint",ait:"application/vnd.dvb.ait",svc:"application/vnd.dvb.service",geo:"application/vnd.dynageo",mag:"application/vnd.ecowin.chart",nml:"application/vnd.enliven",esf:"application/vnd.epson.esf",msf:"application/vnd.epson.msf",qam:"application/vnd.epson.quickanime",slt:"application/vnd.epson.salt",ssf:"application/vnd.epson.ssf",es3:"application/vnd.eszigno3+xml",et3:"application/vnd.eszigno3+xml",ez2:"application/vnd.ezpix-album",ez3:"application/vnd.ezpix-package",fdf:"application/vnd.fdf",mseed:"application/vnd.fdsn.mseed",seed:"application/vnd.fdsn.seed",dataless:"application/vnd.fdsn.seed",gph:"application/vnd.flographit",ftc:"application/vnd.fluxtime.clip",fm:"application/vnd.framemaker",frame:"application/vnd.framemaker",maker:"application/vnd.framemaker",book:"application/vnd.framemaker",fnc:"application/vnd.frogans.fnc",ltf:"application/vnd.frogans.ltf",fsc:"application/vnd.fsc.weblaunch",oas:"application/vnd.fujitsu.oasys",oa2:"application/vnd.fujitsu.oasys2",oa3:"application/vnd.fujitsu.oasys3",fg5:"application/vnd.fujitsu.oasysgp",bh2:"application/vnd.fujitsu.oasysprs",ddd:"application/vnd.fujixerox.ddd",xdw:"application/vnd.fujixerox.docuworks",xbd:"application/vnd.fujixerox.docuworks.binder",fzs:"application/vnd.fuzzysheet",txd:"application/vnd.genomatix.tuxedo",ggb:"application/vnd.geogebra.file",ggt:"application/vnd.geogebra.tool",gex:"application/vnd.geometry-explorer",gre:"application/vnd.geometry-explorer",gxt:"application/vnd.geonext",g2w:"application/vnd.geoplan",g3w:"application/vnd.geospace",gmx:"application/vnd.gmx",gdoc:"application/vnd.google-apps.document",gslides:"application/vnd.google-apps.presentation",gsheet:"application/vnd.google-apps.spreadsheet",kml:"application/vnd.google-earth.kml+xml",kmz:"application/vnd.google-earth.kmz",gqf:"application/vnd.grafeq",gqs:"application/vnd.grafeq",gac:"application/vnd.groove-account",ghf:"application/vnd.groove-help",gim:"application/vnd.groove-identity-message",grv:"application/vnd.groove-injector",gtm:"application/vnd.groove-tool-message",tpl:"application/vnd.groove-tool-template",vcg:"application/vnd.groove-vcard",hal:"application/vnd.hal+xml",zmm:"application/vnd.handheld-entertainment+xml",hbci:"application/vnd.hbci",les:"application/vnd.hhe.lesson-player",hpgl:"application/vnd.hp-hpgl",hpid:"application/vnd.hp-hpid",hps:"application/vnd.hp-hps",jlt:"application/vnd.hp-jlyt",pcl:"application/vnd.hp-pcl",pclxl:"application/vnd.hp-pclxl","sfd-hdstx":"application/vnd.hydrostatix.sof-data",mpy:"application/vnd.ibm.minipay",afp:"application/vnd.ibm.modcap",listafp:"application/vnd.ibm.modcap",list3820:"application/vnd.ibm.modcap",irm:"application/vnd.ibm.rights-management",sc:"application/vnd.ibm.secure-container",icc:"application/vnd.iccprofile",icm:"application/vnd.iccprofile",igl:"application/vnd.igloader",ivp:"application/vnd.immervision-ivp",ivu:"application/vnd.immervision-ivu",igm:"application/vnd.insors.igm",xpw:"application/vnd.intercon.formnet",xpx:"application/vnd.intercon.formnet",i2g:"application/vnd.intergeo",qbo:"application/vnd.intu.qbo",qfx:"application/vnd.intu.qfx",rcprofile:"application/vnd.ipunplugged.rcprofile",irp:"application/vnd.irepository.package+xml",xpr:"application/vnd.is-xpr",fcs:"application/vnd.isac.fcs",jam:"application/vnd.jam",rms:"application/vnd.jcp.javame.midlet-rms",jisp:"application/vnd.jisp",joda:"application/vnd.joost.joda-archive",ktz:"application/vnd.kahootz",ktr:"application/vnd.kahootz",karbon:"application/vnd.kde.karbon",chrt:"application/vnd.kde.kchart",kfo:"application/vnd.kde.kformula",flw:"application/vnd.kde.kivio",kon:"application/vnd.kde.kontour",kpr:"application/vnd.kde.kpresenter",kpt:"application/vnd.kde.kpresenter",ksp:"application/vnd.kde.kspread",kwd:"application/vnd.kde.kword",kwt:"application/vnd.kde.kword",htke:"application/vnd.kenameaapp",kia:"application/vnd.kidspiration",kne:"application/vnd.kinar",knp:"application/vnd.kinar",skp:"application/vnd.koan",skd:"application/vnd.koan",skt:"application/vnd.koan",skm:"application/vnd.koan",sse:"application/vnd.kodak-descriptor",lasxml:"application/vnd.las.las+xml",lbd:"application/vnd.llamagraphics.life-balance.desktop",lbe:"application/vnd.llamagraphics.life-balance.exchange+xml",apr:"application/vnd.lotus-approach",pre:"application/vnd.lotus-freelance",nsf:"application/vnd.lotus-notes",org:"application/vnd.lotus-organizer",scm:"application/vnd.lotus-screencam",lwp:"application/vnd.lotus-wordpro",portpkg:"application/vnd.macports.portpkg",mcd:"application/vnd.mcd",mc1:"application/vnd.medcalcdata",cdkey:"application/vnd.mediastation.cdkey",mwf:"application/vnd.mfer",mfm:"application/vnd.mfmp",flo:"application/vnd.micrografx.flo",igx:"application/vnd.micrografx.igx",mif:"application/vnd.mif",daf:"application/vnd.mobius.daf",dis:"application/vnd.mobius.dis",mbk:"application/vnd.mobius.mbk",mqy:"application/vnd.mobius.mqy",msl:"application/vnd.mobius.msl",plc:"application/vnd.mobius.plc",txf:"application/vnd.mobius.txf",mpn:"application/vnd.mophun.application",mpc:"application/vnd.mophun.certificate",xul:"application/vnd.mozilla.xul+xml",cil:"application/vnd.ms-artgalry",cab:"application/vnd.ms-cab-compressed",xls:"application/vnd.ms-excel",xlm:"application/vnd.ms-excel",xla:"application/vnd.ms-excel",xlc:"application/vnd.ms-excel",xlt:"application/vnd.ms-excel",xlw:"application/vnd.ms-excel",xlam:"application/vnd.ms-excel.addin.macroenabled.12",xlsb:"application/vnd.ms-excel.sheet.binary.macroenabled.12",xlsm:"application/vnd.ms-excel.sheet.macroenabled.12",xltm:"application/vnd.ms-excel.template.macroenabled.12",eot:"application/vnd.ms-fontobject",chm:"application/vnd.ms-htmlhelp",ims:"application/vnd.ms-ims",lrm:"application/vnd.ms-lrm",thmx:"application/vnd.ms-officetheme",cat:"application/vnd.ms-pki.seccat",stl:"application/vnd.ms-pki.stl",ppt:"application/vnd.ms-powerpoint",pps:"application/vnd.ms-powerpoint",pot:"application/vnd.ms-powerpoint",ppam:"application/vnd.ms-powerpoint.addin.macroenabled.12",pptm:"application/vnd.ms-powerpoint.presentation.macroenabled.12",sldm:"application/vnd.ms-powerpoint.slide.macroenabled.12",ppsm:"application/vnd.ms-powerpoint.slideshow.macroenabled.12",potm:"application/vnd.ms-powerpoint.template.macroenabled.12",mpp:"application/vnd.ms-project",mpt:"application/vnd.ms-project",docm:"application/vnd.ms-word.document.macroenabled.12",dotm:"application/vnd.ms-word.template.macroenabled.12",wps:"application/vnd.ms-works",wks:"application/vnd.ms-works",wcm:"application/vnd.ms-works",wdb:"application/vnd.ms-works",wpl:"application/vnd.ms-wpl",xps:"application/vnd.ms-xpsdocument",mseq:"application/vnd.mseq",mus:"application/vnd.musician",msty:"application/vnd.muvee.style",taglet:"application/vnd.mynfc",nlu:"application/vnd.neurolanguage.nlu",ntf:"application/vnd.nitf",nitf:"application/vnd.nitf",nnd:"application/vnd.noblenet-directory",nns:"application/vnd.noblenet-sealer",nnw:"application/vnd.noblenet-web",ngdat:"application/vnd.nokia.n-gage.data","n-gage":"application/vnd.nokia.n-gage.symbian.install",rpst:"application/vnd.nokia.radio-preset",rpss:"application/vnd.nokia.radio-presets",edm:"application/vnd.novadigm.edm",edx:"application/vnd.novadigm.edx",ext:"application/vnd.novadigm.ext",odc:"application/vnd.oasis.opendocument.chart",otc:"application/vnd.oasis.opendocument.chart-template",odb:"application/vnd.oasis.opendocument.database",odf:"application/vnd.oasis.opendocument.formula",odft:"application/vnd.oasis.opendocument.formula-template",odg:"application/vnd.oasis.opendocument.graphics",otg:"application/vnd.oasis.opendocument.graphics-template",odi:"application/vnd.oasis.opendocument.image",oti:"application/vnd.oasis.opendocument.image-template",odp:"application/vnd.oasis.opendocument.presentation",otp:"application/vnd.oasis.opendocument.presentation-template",ods:"application/vnd.oasis.opendocument.spreadsheet",ots:"application/vnd.oasis.opendocument.spreadsheet-template",odt:"application/vnd.oasis.opendocument.text",odm:"application/vnd.oasis.opendocument.text-master",ott:"application/vnd.oasis.opendocument.text-template",oth:"application/vnd.oasis.opendocument.text-web",xo:"application/vnd.olpc-sugar",dd2:"application/vnd.oma.dd2+xml",oxt:"application/vnd.openofficeorg.extension",pptx:"application/vnd.openxmlformats-officedocument.presentationml.presentation",sldx:"application/vnd.openxmlformats-officedocument.presentationml.slide",ppsx:"application/vnd.openxmlformats-officedocument.presentationml.slideshow",potx:"application/vnd.openxmlformats-officedocument.presentationml.template",xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",xltx:"application/vnd.openxmlformats-officedocument.spreadsheetml.template",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",dotx:"application/vnd.openxmlformats-officedocument.wordprocessingml.template",mgp:"application/vnd.osgeo.mapguide.package",dp:"application/vnd.osgi.dp",esa:"application/vnd.osgi.subsystem",pdb:"application/x-pilot",pqa:"application/vnd.palm",oprc:"application/vnd.palm",paw:"application/vnd.pawaafile",str:"application/vnd.pg.format",ei6:"application/vnd.pg.osasli",efif:"application/vnd.picsel",wg:"application/vnd.pmi.widget",plf:"application/vnd.pocketlearn",pbd:"application/vnd.powerbuilder6",box:"application/vnd.previewsystems.box",mgz:"application/vnd.proteus.magazine",qps:"application/vnd.publishare-delta-tree",ptid:"application/vnd.pvi.ptid1",qxd:"application/vnd.quark.quarkxpress",qxt:"application/vnd.quark.quarkxpress",qwd:"application/vnd.quark.quarkxpress",qwt:"application/vnd.quark.quarkxpress",qxl:"application/vnd.quark.quarkxpress",qxb:"application/vnd.quark.quarkxpress",bed:"application/vnd.realvnc.bed",mxl:"application/vnd.recordare.musicxml",musicxml:"application/vnd.recordare.musicxml+xml",cryptonote:"application/vnd.rig.cryptonote",cod:"application/vnd.rim.cod",rm:"application/vnd.rn-realmedia",rmvb:"application/vnd.rn-realmedia-vbr",link66:"application/vnd.route66.link66+xml",st:"application/vnd.sailingtracker.track",see:"application/vnd.seemail",sema:"application/vnd.sema",semd:"application/vnd.semd",semf:"application/vnd.semf",ifm:"application/vnd.shana.informed.formdata",itp:"application/vnd.shana.informed.formtemplate",iif:"application/vnd.shana.informed.interchange",ipk:"application/vnd.shana.informed.package",twd:"application/vnd.simtech-mindmapper",twds:"application/vnd.simtech-mindmapper",mmf:"application/vnd.smaf",teacher:"application/vnd.smart.teacher",sdkm:"application/vnd.solent.sdkm+xml",sdkd:"application/vnd.solent.sdkm+xml",dxp:"application/vnd.spotfire.dxp",sfs:"application/vnd.spotfire.sfs",sdc:"application/vnd.stardivision.calc",sda:"application/vnd.stardivision.draw",sdd:"application/vnd.stardivision.impress",smf:"application/vnd.stardivision.math",sdw:"application/vnd.stardivision.writer",vor:"application/vnd.stardivision.writer",sgl:"application/vnd.stardivision.writer-global",smzip:"application/vnd.stepmania.package",sm:"application/vnd.stepmania.stepchart",sxc:"application/vnd.sun.xml.calc",stc:"application/vnd.sun.xml.calc.template",sxd:"application/vnd.sun.xml.draw",std:"application/vnd.sun.xml.draw.template",sxi:"application/vnd.sun.xml.impress",sti:"application/vnd.sun.xml.impress.template",sxm:"application/vnd.sun.xml.math",sxw:"application/vnd.sun.xml.writer",sxg:"application/vnd.sun.xml.writer.global",stw:"application/vnd.sun.xml.writer.template",sus:"application/vnd.sus-calendar",susp:"application/vnd.sus-calendar",svd:"application/vnd.svd",sis:"application/vnd.symbian.install",sisx:"application/vnd.symbian.install",xsm:"application/vnd.syncml+xml",bdm:"application/vnd.syncml.dm+wbxml",xdm:"application/vnd.syncml.dm+xml",tao:"application/vnd.tao.intent-module-archive",pcap:"application/vnd.tcpdump.pcap",cap:"application/vnd.tcpdump.pcap",dmp:"application/vnd.tcpdump.pcap",tmo:"application/vnd.tmobile-livetv",tpt:"application/vnd.trid.tpt",mxs:"application/vnd.triscape.mxs",tra:"application/vnd.trueapp",ufd:"application/vnd.ufdl",ufdl:"application/vnd.ufdl",utz:"application/vnd.uiq.theme",umj:"application/vnd.umajin",unityweb:"application/vnd.unity",uoml:"application/vnd.uoml+xml",vcx:"application/vnd.vcx",vsd:"application/vnd.visio",vst:"application/vnd.visio",vss:"application/vnd.visio",vsw:"application/vnd.visio",vis:"application/vnd.visionary",vsf:"application/vnd.vsf",wbxml:"application/vnd.wap.wbxml",wmlc:"application/vnd.wap.wmlc",wmlsc:"application/vnd.wap.wmlscriptc",wtb:"application/vnd.webturbo",nbp:"application/vnd.wolfram.player",wpd:"application/vnd.wordperfect",wqd:"application/vnd.wqd",stf:"application/vnd.wt.stf",xar:"application/vnd.xara",xfdl:"application/vnd.xfdl",hvd:"application/vnd.yamaha.hv-dic",hvs:"application/vnd.yamaha.hv-script",hvp:"application/vnd.yamaha.hv-voice",osf:"application/vnd.yamaha.openscoreformat",osfpvg:"application/vnd.yamaha.openscoreformat.osfpvg+xml",saf:"application/vnd.yamaha.smaf-audio",spf:"application/vnd.yamaha.smaf-phrase",cmp:"application/vnd.yellowriver-custom-menu",zir:"application/vnd.zul",zirz:"application/vnd.zul",zaz:"application/vnd.zzazz.deck+xml",vxml:"application/voicexml+xml",wgt:"application/widget",hlp:"application/winhlp",wsdl:"application/wsdl+xml",wspolicy:"application/wspolicy+xml","7z":"application/x-7z-compressed",abw:"application/x-abiword",ace:"application/x-ace-compressed",aab:"application/x-authorware-bin",x32:"application/x-authorware-bin",u32:"application/x-authorware-bin",vox:"application/x-authorware-bin",aam:"application/x-authorware-map",aas:"application/x-authorware-seg",bcpio:"application/x-bcpio",torrent:"application/x-bittorrent",blb:"application/x-blorb",blorb:"application/x-blorb",bz:"application/x-bzip",bz2:"application/x-bzip2",boz:"application/x-bzip2",cbr:"application/x-cbr",cba:"application/x-cbr",cbt:"application/x-cbr",cbz:"application/x-cbr",cb7:"application/x-cbr",vcd:"application/x-cdlink",cfs:"application/x-cfs-compressed",chat:"application/x-chat",pgn:"application/x-chess-pgn",crx:"application/x-chrome-extension",cco:"application/x-cocoa",nsc:"application/x-conference",cpio:"application/x-cpio",csh:"application/x-csh",udeb:"application/x-debian-package",dgc:"application/x-dgc-compressed",dir:"application/x-director",dcr:"application/x-director",dxr:"application/x-director",cst:"application/x-director",cct:"application/x-director",cxt:"application/x-director",w3d:"application/x-director",fgd:"application/x-director",swa:"application/x-director",wad:"application/x-doom",ncx:"application/x-dtbncx+xml",dtb:"application/x-dtbook+xml",res:"application/x-dtbresource+xml",dvi:"application/x-dvi",evy:"application/x-envoy",eva:"application/x-eva",bdf:"application/x-font-bdf",gsf:"application/x-font-ghostscript",psf:"application/x-font-linux-psf",otf:"font/opentype",pcf:"application/x-font-pcf",snf:"application/x-font-snf",ttf:"application/x-font-ttf",ttc:"application/x-font-ttf",pfa:"application/x-font-type1",pfb:"application/x-font-type1",pfm:"application/x-font-type1",afm:"application/x-font-type1",arc:"application/x-freearc",spl:"application/x-futuresplash",gca:"application/x-gca-compressed",ulx:"application/x-glulx",gnumeric:"application/x-gnumeric",gramps:"application/x-gramps-xml",gtar:"application/x-gtar",hdf:"application/x-hdf",php:"application/x-httpd-php",install:"application/x-install-instructions",jardiff:"application/x-java-archive-diff",jnlp:"application/x-java-jnlp-file",latex:"application/x-latex",luac:"application/x-lua-bytecode",lzh:"application/x-lzh-compressed",lha:"application/x-lzh-compressed",run:"application/x-makeself",mie:"application/x-mie",prc:"application/x-pilot",mobi:"application/x-mobipocket-ebook",application:"application/x-ms-application",lnk:"application/x-ms-shortcut",wmd:"application/x-ms-wmd",wmz:"application/x-msmetafile",xbap:"application/x-ms-xbap",mdb:"application/x-msaccess",obd:"application/x-msbinder",crd:"application/x-mscardfile",clp:"application/x-msclip",com:"application/x-msdownload",bat:"application/x-msdownload",mvb:"application/x-msmediaview",m13:"application/x-msmediaview",m14:"application/x-msmediaview",wmf:"application/x-msmetafile",emf:"application/x-msmetafile",emz:"application/x-msmetafile",mny:"application/x-msmoney",pub:"application/x-mspublisher",scd:"application/x-msschedule",trm:"application/x-msterminal",wri:"application/x-mswrite",nc:"application/x-netcdf",cdf:"application/x-netcdf",pac:"application/x-ns-proxy-autoconfig",nzb:"application/x-nzb",pl:"application/x-perl",pm:"application/x-perl",p12:"application/x-pkcs12",pfx:"application/x-pkcs12",p7b:"application/x-pkcs7-certificates",spc:"application/x-pkcs7-certificates",p7r:"application/x-pkcs7-certreqresp",rar:"application/x-rar-compressed",rpm:"application/x-redhat-package-manager",ris:"application/x-research-info-systems",sea:"application/x-sea",sh:"application/x-sh",shar:"application/x-shar",swf:"application/x-shockwave-flash",xap:"application/x-silverlight-app",sql:"application/x-sql",sit:"application/x-stuffit",sitx:"application/x-stuffitx",srt:"application/x-subrip",sv4cpio:"application/x-sv4cpio",sv4crc:"application/x-sv4crc",t3:"application/x-t3vm-image",gam:"application/x-tads",tar:"application/x-tar",tcl:"application/x-tcl",tk:"application/x-tcl",tex:"application/x-tex",tfm:"application/x-tex-tfm",texinfo:"application/x-texinfo",texi:"application/x-texinfo",obj:"application/x-tgif",ustar:"application/x-ustar",src:"application/x-wais-source",webapp:"application/x-web-app-manifest+json",der:"application/x-x509-ca-cert",crt:"application/x-x509-ca-cert",pem:"application/x-x509-ca-cert",fig:"application/x-xfig",xlf:"application/x-xliff+xml",xpi:"application/x-xpinstall",xz:"application/x-xz",z1:"application/x-zmachine",z2:"application/x-zmachine",z3:"application/x-zmachine",z4:"application/x-zmachine",z5:"application/x-zmachine",z6:"application/x-zmachine",z7:"application/x-zmachine",z8:"application/x-zmachine",xaml:"application/xaml+xml",xdf:"application/xcap-diff+xml",xenc:"application/xenc+xml",xhtml:"application/xhtml+xml",xht:"application/xhtml+xml",xml:"text/xml",xsl:"application/xml",xsd:"application/xml",rng:"application/xml",dtd:"application/xml-dtd",xop:"application/xop+xml",xpl:"application/xproc+xml",xslt:"application/xslt+xml",xspf:"application/xspf+xml",mxml:"application/xv+xml",xhvml:"application/xv+xml",xvml:"application/xv+xml",xvm:"application/xv+xml",yang:"application/yang",yin:"application/yin+xml",zip:"application/zip","3gpp":"video/3gpp",adp:"audio/adpcm",au:"audio/basic",snd:"audio/basic",mid:"audio/midi",midi:"audio/midi",kar:"audio/midi",rmi:"audio/midi",mp3:"audio/mpeg",m4a:"audio/x-m4a",mp4a:"audio/mp4",mpga:"audio/mpeg",mp2:"audio/mpeg",mp2a:"audio/mpeg",m2a:"audio/mpeg",m3a:"audio/mpeg",oga:"audio/ogg",ogg:"audio/ogg",spx:"audio/ogg",s3m:"audio/s3m",sil:"audio/silk",uva:"audio/vnd.dece.audio",uvva:"audio/vnd.dece.audio",eol:"audio/vnd.digital-winds",dra:"audio/vnd.dra",dts:"audio/vnd.dts",dtshd:"audio/vnd.dts.hd",lvp:"audio/vnd.lucent.voice",pya:"audio/vnd.ms-playready.media.pya",ecelp4800:"audio/vnd.nuera.ecelp4800",ecelp7470:"audio/vnd.nuera.ecelp7470",ecelp9600:"audio/vnd.nuera.ecelp9600",rip:"audio/vnd.rip",wav:"audio/x-wav",weba:"audio/webm",aac:"audio/x-aac",aif:"audio/x-aiff",aiff:"audio/x-aiff",aifc:"audio/x-aiff",caf:"audio/x-caf",flac:"audio/x-flac",mka:"audio/x-matroska",m3u:"audio/x-mpegurl",wax:"audio/x-ms-wax",wma:"audio/x-ms-wma",ram:"audio/x-pn-realaudio",ra:"audio/x-realaudio",rmp:"audio/x-pn-realaudio-plugin",xm:"audio/xm",cdx:"chemical/x-cdx",cif:"chemical/x-cif",cmdf:"chemical/x-cmdf",cml:"chemical/x-cml",csml:"chemical/x-csml",xyz:"chemical/x-xyz",bmp:"image/x-ms-bmp",cgm:"image/cgm",g3:"image/g3fax",gif:"image/gif",ief:"image/ief",jpeg:"image/jpeg",jpg:"image/jpeg",jpe:"image/jpeg",ktx:"image/ktx",png:"image/png",btif:"image/prs.btif",sgi:"image/sgi",svg:"image/svg+xml",svgz:"image/svg+xml",tiff:"image/tiff",tif:"image/tiff",psd:"image/vnd.adobe.photoshop",uvi:"image/vnd.dece.graphic",uvvi:"image/vnd.dece.graphic",uvg:"image/vnd.dece.graphic",uvvg:"image/vnd.dece.graphic",djvu:"image/vnd.djvu",djv:"image/vnd.djvu",sub:"text/vnd.dvb.subtitle",dwg:"image/vnd.dwg",dxf:"image/vnd.dxf",fbs:"image/vnd.fastbidsheet",fpx:"image/vnd.fpx",fst:"image/vnd.fst",mmr:"image/vnd.fujixerox.edmics-mmr",rlc:"image/vnd.fujixerox.edmics-rlc",mdi:"image/vnd.ms-modi",wdp:"image/vnd.ms-photo",npx:"image/vnd.net-fpx",wbmp:"image/vnd.wap.wbmp",xif:"image/vnd.xiff",webp:"image/webp","3ds":"image/x-3ds",ras:"image/x-cmu-raster",cmx:"image/x-cmx",fh:"image/x-freehand",fhc:"image/x-freehand",fh4:"image/x-freehand",fh5:"image/x-freehand",fh7:"image/x-freehand",ico:"image/x-icon",jng:"image/x-jng",sid:"image/x-mrsid-image",pcx:"image/x-pcx",pic:"image/x-pict",pct:"image/x-pict",pnm:"image/x-portable-anymap",pbm:"image/x-portable-bitmap",pgm:"image/x-portable-graymap",ppm:"image/x-portable-pixmap",rgb:"image/x-rgb",tga:"image/x-tga",xbm:"image/x-xbitmap",xpm:"image/x-xpixmap",xwd:"image/x-xwindowdump",eml:"message/rfc822",mime:"message/rfc822",igs:"model/iges",iges:"model/iges",msh:"model/mesh",mesh:"model/mesh",silo:"model/mesh",dae:"model/vnd.collada+xml",dwf:"model/vnd.dwf",gdl:"model/vnd.gdl",gtw:"model/vnd.gtw",mts:"model/vnd.mts",vtu:"model/vnd.vtu",wrl:"model/vrml",vrml:"model/vrml",x3db:"model/x3d+binary",x3dbz:"model/x3d+binary",x3dv:"model/x3d+vrml",x3dvz:"model/x3d+vrml",x3d:"model/x3d+xml",x3dz:"model/x3d+xml",appcache:"text/cache-manifest",manifest:"text/cache-manifest",ics:"text/calendar",ifb:"text/calendar",coffee:"text/coffeescript",litcoffee:"text/coffeescript",css:"text/css",csv:"text/csv",hjson:"text/hjson",html:"text/html",htm:"text/html",shtml:"text/html",jade:"text/jade",jsx:"text/jsx",less:"text/less",mml:"text/mathml",n3:"text/n3",txt:"text/plain",text:"text/plain",conf:"text/plain",def:"text/plain",list:"text/plain",log:"text/plain",in:"text/plain",ini:"text/plain",dsc:"text/prs.lines.tag",rtx:"text/richtext",sgml:"text/sgml",sgm:"text/sgml",slim:"text/slim",slm:"text/slim",stylus:"text/stylus",styl:"text/stylus",tsv:"text/tab-separated-values",t:"text/troff",tr:"text/troff",roff:"text/troff",man:"text/troff",me:"text/troff",ms:"text/troff",ttl:"text/turtle",uri:"text/uri-list",uris:"text/uri-list",urls:"text/uri-list",vcard:"text/vcard",curl:"text/vnd.curl",dcurl:"text/vnd.curl.dcurl",mcurl:"text/vnd.curl.mcurl",scurl:"text/vnd.curl.scurl",fly:"text/vnd.fly",flx:"text/vnd.fmi.flexstor",gv:"text/vnd.graphviz","3dml":"text/vnd.in3d.3dml",spot:"text/vnd.in3d.spot",jad:"text/vnd.sun.j2me.app-descriptor",wml:"text/vnd.wap.wml",wmls:"text/vnd.wap.wmlscript",vtt:"text/vtt",s:"text/x-asm",asm:"text/x-asm",c:"text/x-c",cc:"text/x-c",cxx:"text/x-c",cpp:"text/x-c",h:"text/x-c",hh:"text/x-c",dic:"text/x-c",htc:"text/x-component",f:"text/x-fortran",for:"text/x-fortran",f77:"text/x-fortran",f90:"text/x-fortran",hbs:"text/x-handlebars-template",java:"text/x-java-source",lua:"text/x-lua",markdown:"text/x-markdown",md:"text/x-markdown",mkd:"text/x-markdown",nfo:"text/x-nfo",opml:"text/x-opml",p:"text/x-pascal",pas:"text/x-pascal",pde:"text/x-processing",sass:"text/x-sass",scss:"text/x-scss",etx:"text/x-setext",sfv:"text/x-sfv",ymp:"text/x-suse-ymp",uu:"text/x-uuencode",vcs:"text/x-vcalendar",vcf:"text/x-vcard",yaml:"text/yaml",yml:"text/yaml","3gp":"video/3gpp","3g2":"video/3gpp2",h261:"video/h261",h263:"video/h263",h264:"video/h264",jpgv:"video/jpeg",jpm:"video/jpm",jpgm:"video/jpm",mj2:"video/mj2",mjp2:"video/mj2",ts:"video/mp2t",mp4:"video/mp4",mp4v:"video/mp4",mpg4:"video/mp4",mpeg:"video/mpeg",mpg:"video/mpeg",mpe:"video/mpeg",m1v:"video/mpeg",m2v:"video/mpeg",ogv:"video/ogg",qt:"video/quicktime",mov:"video/quicktime",uvh:"video/vnd.dece.hd",uvvh:"video/vnd.dece.hd",uvm:"video/vnd.dece.mobile",uvvm:"video/vnd.dece.mobile",uvp:"video/vnd.dece.pd",uvvp:"video/vnd.dece.pd",uvs:"video/vnd.dece.sd",uvvs:"video/vnd.dece.sd",uvv:"video/vnd.dece.video",uvvv:"video/vnd.dece.video",dvb:"video/vnd.dvb.file",fvt:"video/vnd.fvt",mxu:"video/vnd.mpegurl",m4u:"video/vnd.mpegurl",pyv:"video/vnd.ms-playready.media.pyv",uvu:"video/vnd.uvvu.mp4",uvvu:"video/vnd.uvvu.mp4",viv:"video/vnd.vivo",webm:"video/webm",f4v:"video/x-f4v",fli:"video/x-fli",flv:"video/x-flv",m4v:"video/x-m4v",mkv:"video/x-matroska",mk3d:"video/x-matroska",mks:"video/x-matroska",mng:"video/x-mng",asf:"video/x-ms-asf",asx:"video/x-ms-asf",vob:"video/x-ms-vob",wm:"video/x-ms-wm",wmv:"video/x-ms-wmv",wmx:"video/x-ms-wmx",wvx:"video/x-ms-wvx",avi:"video/x-msvideo",movie:"video/x-sgi-movie",smv:"video/x-smv",ice:"x-conference/x-cooltalk"}},function(e,t){e.exports=function(e){const t=new Uint8Array(e);if(!(t&&t.length>1))return null;if(255===t[0]&&216===t[1]&&255===t[2])return{ext:"jpg",mime:"image/jpeg"};if(137===t[0]&&80===t[1]&&78===t[2]&&71===t[3])return{ext:"png",mime:"image/png"};if(71===t[0]&&73===t[1]&&70===t[2])return{ext:"gif",mime:"image/gif"};if(87===t[8]&&69===t[9]&&66===t[10]&&80===t[11])return{ext:"webp",mime:"image/webp"};if(70===t[0]&&76===t[1]&&73===t[2]&&70===t[3])return{ext:"flif",mime:"image/flif"};if((73===t[0]&&73===t[1]&&42===t[2]&&0===t[3]||77===t[0]&&77===t[1]&&0===t[2]&&42===t[3])&&67===t[8]&&82===t[9])return{ext:"cr2",mime:"image/x-canon-cr2"};if(73===t[0]&&73===t[1]&&42===t[2]&&0===t[3]||77===t[0]&&77===t[1]&&0===t[2]&&42===t[3])return{ext:"tif",mime:"image/tiff"};if(66===t[0]&&77===t[1])return{ext:"bmp",mime:"image/bmp"};if(73===t[0]&&73===t[1]&&188===t[2])return{ext:"jxr",mime:"image/vnd.ms-photo"};if(56===t[0]&&66===t[1]&&80===t[2]&&83===t[3])return{ext:"psd",mime:"image/vnd.adobe.photoshop"};if(80===t[0]&&75===t[1]&&3===t[2]&&4===t[3]&&109===t[30]&&105===t[31]&&109===t[32]&&101===t[33]&&116===t[34]&&121===t[35]&&112===t[36]&&101===t[37]&&97===t[38]&&112===t[39]&&112===t[40]&&108===t[41]&&105===t[42]&&99===t[43]&&97===t[44]&&116===t[45]&&105===t[46]&&111===t[47]&&110===t[48]&&47===t[49]&&101===t[50]&&112===t[51]&&117===t[52]&&98===t[53]&&43===t[54]&&122===t[55]&&105===t[56]&&112===t[57])return{ext:"epub",mime:"application/epub+zip"};if(80===t[0]&&75===t[1]&&3===t[2]&&4===t[3]&&77===t[30]&&69===t[31]&&84===t[32]&&65===t[33]&&45===t[34]&&73===t[35]&&78===t[36]&&70===t[37]&&47===t[38]&&109===t[39]&&111===t[40]&&122===t[41]&&105===t[42]&&108===t[43]&&108===t[44]&&97===t[45]&&46===t[46]&&114===t[47]&&115===t[48]&&97===t[49])return{ext:"xpi",mime:"application/x-xpinstall"};if(!(80!==t[0]||75!==t[1]||3!==t[2]&&5!==t[2]&&7!==t[2]||4!==t[3]&&6!==t[3]&&8!==t[3]))return{ext:"zip",mime:"application/zip"};if(117===t[257]&&115===t[258]&&116===t[259]&&97===t[260]&&114===t[261])return{ext:"tar",mime:"application/x-tar"};if(82===t[0]&&97===t[1]&&114===t[2]&&33===t[3]&&26===t[4]&&7===t[5]&&(0===t[6]||1===t[6]))return{ext:"rar",mime:"application/x-rar-compressed"};if(31===t[0]&&139===t[1]&&8===t[2])return{ext:"gz",mime:"application/gzip"};if(66===t[0]&&90===t[1]&&104===t[2])return{ext:"bz2",mime:"application/x-bzip2"};if(55===t[0]&&122===t[1]&&188===t[2]&&175===t[3]&&39===t[4]&&28===t[5])return{ext:"7z",mime:"application/x-7z-compressed"};if(120===t[0]&&1===t[1])return{ext:"dmg",mime:"application/x-apple-diskimage"};if(0===t[0]&&0===t[1]&&0===t[2]&&(24===t[3]||32===t[3])&&102===t[4]&&116===t[5]&&121===t[6]&&112===t[7]||51===t[0]&&103===t[1]&&112===t[2]&&53===t[3]||0===t[0]&&0===t[1]&&0===t[2]&&28===t[3]&&102===t[4]&&116===t[5]&&121===t[6]&&112===t[7]&&109===t[8]&&112===t[9]&&52===t[10]&&50===t[11]&&109===t[16]&&112===t[17]&&52===t[18]&&49===t[19]&&109===t[20]&&112===t[21]&&52===t[22]&&50===t[23]&&105===t[24]&&115===t[25]&&111===t[26]&&109===t[27]||0===t[0]&&0===t[1]&&0===t[2]&&28===t[3]&&102===t[4]&&116===t[5]&&121===t[6]&&112===t[7]&&105===t[8]&&115===t[9]&&111===t[10]&&109===t[11]||0===t[0]&&0===t[1]&&0===t[2]&&28===t[3]&&102===t[4]&&116===t[5]&&121===t[6]&&112===t[7]&&109===t[8]&&112===t[9]&&52===t[10]&&50===t[11]&&0===t[12]&&0===t[13]&&0===t[14]&&0===t[15])return{ext:"mp4",mime:"video/mp4"};if(0===t[0]&&0===t[1]&&0===t[2]&&28===t[3]&&102===t[4]&&116===t[5]&&121===t[6]&&112===t[7]&&77===t[8]&&52===t[9]&&86===t[10])return{ext:"m4v",mime:"video/x-m4v"};if(77===t[0]&&84===t[1]&&104===t[2]&&100===t[3])return{ext:"mid",mime:"audio/midi"};if(26===t[0]&&69===t[1]&&223===t[2]&&163===t[3]){const e=t.subarray(4,4100),i=e.findIndex((e,t,i)=>66===i[t]&&130===i[t+1]);if(i>=0){const t=i+3,n=i=>Array.from(i).every((i,n)=>e[t+n]===i.charCodeAt(0));if(n("matroska"))return{ext:"mkv",mime:"video/x-matroska"};if(n("webm"))return{ext:"webm",mime:"video/webm"}}}return 0===t[0]&&0===t[1]&&0===t[2]&&20===t[3]&&102===t[4]&&116===t[5]&&121===t[6]&&112===t[7]?{ext:"mov",mime:"video/quicktime"}:82===t[0]&&73===t[1]&&70===t[2]&&70===t[3]&&65===t[8]&&86===t[9]&&73===t[10]?{ext:"avi",mime:"video/x-msvideo"}:48===t[0]&&38===t[1]&&178===t[2]&&117===t[3]&&142===t[4]&&102===t[5]&&207===t[6]&&17===t[7]&&166===t[8]&&217===t[9]?{ext:"wmv",mime:"video/x-ms-wmv"}:0===t[0]&&0===t[1]&&1===t[2]&&"b"===t[3].toString(16)[0]?{ext:"mpg",mime:"video/mpeg"}:73===t[0]&&68===t[1]&&51===t[2]||255===t[0]&&251===t[1]?{ext:"mp3",mime:"audio/mpeg"}:102===t[4]&&116===t[5]&&121===t[6]&&112===t[7]&&77===t[8]&&52===t[9]&&65===t[10]||77===t[0]&&52===t[1]&&65===t[2]&&32===t[3]?{ext:"m4a",mime:"audio/m4a"}:79===t[28]&&112===t[29]&&117===t[30]&&115===t[31]&&72===t[32]&&101===t[33]&&97===t[34]&&100===t[35]?{ext:"opus",mime:"audio/opus"}:79===t[0]&&103===t[1]&&103===t[2]&&83===t[3]?{ext:"ogg",mime:"audio/ogg"}:102===t[0]&&76===t[1]&&97===t[2]&&67===t[3]?{ext:"flac",mime:"audio/x-flac"}:82===t[0]&&73===t[1]&&70===t[2]&&70===t[3]&&87===t[8]&&65===t[9]&&86===t[10]&&69===t[11]?{ext:"wav",mime:"audio/x-wav"}:35===t[0]&&33===t[1]&&65===t[2]&&77===t[3]&&82===t[4]&&10===t[5]?{ext:"amr",mime:"audio/amr"}:37===t[0]&&80===t[1]&&68===t[2]&&70===t[3]?{ext:"pdf",mime:"application/pdf"}:77===t[0]&&90===t[1]?{ext:"exe",mime:"application/x-msdownload"}:67!==t[0]&&70!==t[0]||87!==t[1]||83!==t[2]?123===t[0]&&92===t[1]&&114===t[2]&&116===t[3]&&102===t[4]?{ext:"rtf",mime:"application/rtf"}:119===t[0]&&79===t[1]&&70===t[2]&&70===t[3]&&(0===t[4]&&1===t[5]&&0===t[6]&&0===t[7]||79===t[4]&&84===t[5]&&84===t[6]&&79===t[7])?{ext:"woff",mime:"application/font-woff"}:119===t[0]&&79===t[1]&&70===t[2]&&50===t[3]&&(0===t[4]&&1===t[5]&&0===t[6]&&0===t[7]||79===t[4]&&84===t[5]&&84===t[6]&&79===t[7])?{ext:"woff2",mime:"application/font-woff"}:76===t[34]&&80===t[35]&&(0===t[8]&&0===t[9]&&1===t[10]||1===t[8]&&0===t[9]&&2===t[10]||2===t[8]&&0===t[9]&&2===t[10])?{ext:"eot",mime:"application/octet-stream"}:0===t[0]&&1===t[1]&&0===t[2]&&0===t[3]&&0===t[4]?{ext:"ttf",mime:"application/font-sfnt"}:79===t[0]&&84===t[1]&&84===t[2]&&79===t[3]&&0===t[4]?{ext:"otf",mime:"application/font-sfnt"}:0===t[0]&&0===t[1]&&1===t[2]&&0===t[3]?{ext:"ico",mime:"image/x-icon"}:70===t[0]&&76===t[1]&&86===t[2]&&1===t[3]?{ext:"flv",mime:"video/x-flv"}:37===t[0]&&33===t[1]?{ext:"ps",mime:"application/postscript"}:253===t[0]&&55===t[1]&&122===t[2]&&88===t[3]&&90===t[4]&&0===t[5]?{ext:"xz",mime:"application/x-xz"}:83===t[0]&&81===t[1]&&76===t[2]&&105===t[3]?{ext:"sqlite",mime:"application/x-sqlite3"}:78===t[0]&&69===t[1]&&83===t[2]&&26===t[3]?{ext:"nes",mime:"application/x-nintendo-nes-rom"}:67===t[0]&&114===t[1]&&50===t[2]&&52===t[3]?{ext:"crx",mime:"application/x-google-chrome-extension"}:77===t[0]&&83===t[1]&&67===t[2]&&70===t[3]||73===t[0]&&83===t[1]&&99===t[2]&&40===t[3]?{ext:"cab",mime:"application/vnd.ms-cab-compressed"}:33===t[0]&&60===t[1]&&97===t[2]&&114===t[3]&&99===t[4]&&104===t[5]&&62===t[6]&&10===t[7]&&100===t[8]&&101===t[9]&&98===t[10]&&105===t[11]&&97===t[12]&&110===t[13]&&45===t[14]&&98===t[15]&&105===t[16]&&110===t[17]&&97===t[18]&&114===t[19]&&121===t[20]?{ext:"deb",mime:"application/x-deb"}:33===t[0]&&60===t[1]&&97===t[2]&&114===t[3]&&99===t[4]&&104===t[5]&&62===t[6]?{ext:"ar",mime:"application/x-unix-archive"}:237===t[0]&&171===t[1]&&238===t[2]&&219===t[3]?{ext:"rpm",mime:"application/x-rpm"}:31===t[0]&&160===t[1]||31===t[0]&&157===t[1]?{ext:"Z",mime:"application/x-compress"}:76===t[0]&&90===t[1]&&73===t[2]&&80===t[3]?{ext:"lz",mime:"application/x-lzip"}:208===t[0]&&207===t[1]&&17===t[2]&&224===t[3]&&161===t[4]&&177===t[5]&&26===t[6]&&225===t[7]?{ext:"msi",mime:"application/x-msi"}:6===t[0]&&14===t[1]&&43===t[2]&&52===t[3]&&2===t[4]&&5===t[5]&&1===t[6]&&1===t[7]&&13===t[8]&&1===t[9]&&2===t[10]&&1===t[11]&&1===t[12]&&2===t[13]?{ext:"mxf",mime:"application/mxf"}:null:{ext:"swf",mime:"application/x-shockwave-flash"}}},function(e,t,i){function n(e){try{return s.lstatSync(e).isDirectory()}catch(e){return!0}}const s=i(27),r=i(20),o=i(53),a=i(9),c=i(54),l={GET:(e,t)=>{t.end=(()=>{const i=n(e)?(new c).error(404,`ENOENT: no such file or directory, open '${e}'`):s.createReadStream(e);t.res=i,i.headers={"content-length":0,"content-type":o.lookup(r.extname(e))},i.on("open",()=>{t.emit("response",i)}),i instanceof c||(i.statusCode=200,i.on("end",()=>{i.headers["content-length"]=i.bytesRead}),i.on("error",e=>{i.statusCode=400,i.status=e.message}))})},POST:(e,t)=>{const i=[];t.write=(e=>{i.push(e)}),t.end=(n=>{i.push(n);const a=s.createWriteStream(e),l=new c;t.res=l,l.headers={"content-length":0,"content-type":o.lookup(r.extname(e))},a.on("finish",()=>{t.emit("response",l)}),a.on("open",()=>{!function e(){const t=i.shift();t&&(a.write(t)?e():a.once("drain",e))}(),a.end()})})},DELETE:(e,t)=>{t.end=(()=>{const i=new c;t.res=i,i.headers={"content-length":0,"content-type":o.lookup(r.extname(e))},s.unlink(e,e=>{t.emit("response",e?i.error(400,e.message):i)})})}};class h extends a{constructor(){super(),this._headers={}}setHeader(){}}e.exports={request:function(e){const t=l[e.method];if(!t)throw new Error(`Invalid request method "${t}"`);const i=e.href.replace("file://",""),n=new h;return t(i,n,e),n}}},function(e,t,i){const n=i(36),s=i(25),r=i(54),o=(()=>{try{return i(!function(){var e=new Error('Cannot find module "http2"');throw e.code="MODULE_NOT_FOUND",e}())}catch(e){return{constants:{},connect:()=>{throw new Error("Please run node with --expose-http2 to use the http2 request transport")}}}})(),{HTTP2_HEADER_PATH:a,HTTP2_HEADER_METHOD:c,HTTP2_HEADER_STATUS:l}=o.constants;class h extends s.Transform{constructor(e){super(),this.options=e,this.headers={[a]:e.pathname,[c]:e.method.toUpperCase()}}setHeader(e,t){this.headers[e.toLowerCase()]=t}getHeader(e){return this.headers[e]}end(){const e=this.options,t=o.connect(`${e.protocol}//${e.hostname}`),i=t.request(this.headers),s=new r;return t.on("error",e=>this.emit("error",e)),t.on("frameError",e=>this.emit("error",e)),i.on("response",e=>{i.on("data",e=>{s.push(e)||i.pause()}),s.headers=e,s.statusCode=e[l],s.status=n.STATUS_CODES[s.statusCode],s.on("error",e=>{s.statusCode=400,s.status=e.message}),this.emit("response",s)}),i.on("end",()=>{this.emit("end"),s.emit("end"),t.destroy()}),i}}e.exports={request:function(e){return new h(e)}}},function(e,t){t.endianness=function(){return"LE"},t.hostname=function(){return"undefined"!=typeof location?location.hostname:""},t.loadavg=function(){return[]},t.uptime=function(){return 0},t.freemem=function(){return Number.MAX_VALUE},t.totalmem=function(){return Number.MAX_VALUE},t.cpus=function(){return[]},t.type=function(){return"Browser"},t.release=function(){return"undefined"!=typeof navigator?navigator.appVersion:""},t.networkInterfaces=t.getNetworkInterfaces=function(){return{}},t.arch=function(){return"javascript"},t.platform=function(){return"browser"},t.tmpdir=t.tmpDir=function(){return"/tmp"},t.EOL="\n"},function(module,exports,__webpack_require__){(function(process){const EventEmitter=__webpack_require__(9),Constants=__webpack_require__(0),Permissions=__webpack_require__(11),Util=__webpack_require__(4),RESTManager=__webpack_require__(56),ClientDataManager=__webpack_require__(119),ClientManager=__webpack_require__(120),ClientDataResolver=__webpack_require__(38),ClientVoiceManager=__webpack_require__(164),WebSocketManager=__webpack_require__(165),ActionsManager=__webpack_require__(166),Collection=__webpack_require__(3),Presence=__webpack_require__(16).Presence,ShardClientUtil=__webpack_require__(195),VoiceBroadcast=__webpack_require__(196);class Client extends EventEmitter{constructor(e={}){super(),!e.shardId&&"SHARD_ID"in Object({__DISCORD_WEBPACK__:"true"})&&(e.shardId=Number(Object({__DISCORD_WEBPACK__:"true"}).SHARD_ID)),!e.shardCount&&"SHARD_COUNT"in Object({__DISCORD_WEBPACK__:"true"})&&(e.shardCount=Number(Object({__DISCORD_WEBPACK__:"true"}).SHARD_COUNT)),this.options=Util.mergeDefault(Constants.DefaultOptions,e),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,Object.defineProperty(this,"token",{writable:!0}),!this.token&&"CLIENT_TOKEN"in Object({__DISCORD_WEBPACK__:"true"})?this.token=Object({__DISCORD_WEBPACK__:"true"}).CLIENT_TOKEN:this.token=null,this.user=null,this.readyAt=null,this.broadcasts=[],this.pings=[],this._timeouts=new Set,this._intervals=new Set,this.options.messageSweepInterval>0&&this.setInterval(this.sweepMessages.bind(this),1e3*this.options.messageSweepInterval)}get _pingTimestamp(){return this.ws.connection?this.ws.connection.lastPingTimestamp:0}get status(){return this.ws.connection.status}get uptime(){return this.readyAt?Date.now()-this.readyAt:null}get ping(){return this.pings.reduce((e,t)=>e+t,0)/this.pings.length}get voiceConnections(){return this.browser?new Collection:this.voice.connections}get emojis(){const e=new Collection;for(const t of this.guilds.values())for(const i of t.emojis.values())e.set(i.id,i);return e}get readyTimestamp(){return this.readyAt?this.readyAt.getTime():null}get browser(){return"undefined"!=typeof window}createVoiceBroadcast(){const e=new VoiceBroadcast(this);return this.broadcasts.push(e),e}login(e){return this.rest.methods.login(e)}destroy(){for(const e of this._timeouts)clearTimeout(e);for(const e of this._intervals)clearInterval(e);return this._timeouts.clear(),this._intervals.clear(),this.manager.destroy()}syncGuilds(e=this.guilds){this.user.bot||this.ws.send({op:12,d:e instanceof Collection?e.keyArray():e.map(e=>e.id)})}fetchUser(e,t=!0){return this.users.has(e)?Promise.resolve(this.users.get(e)):this.rest.methods.getUser(e,t)}fetchInvite(e){const t=this.resolver.resolveInviteCode(e);return this.rest.methods.getInvite(t)}fetchWebhook(e,t){return this.rest.methods.getWebhook(e,t)}fetchVoiceRegions(){return this.rest.methods.fetchVoiceRegions()}sweepMessages(e=this.options.messageCacheLifetime){if("number"!=typeof e||isNaN(e))throw new TypeError("The lifetime must be a number.");if(e<=0)return this.emit("debug","Didn't sweep messages - lifetime is unlimited"),-1;const t=1e3*e,i=Date.now();let n=0,s=0;for(const e of this.channels.values())if(e.messages){n++;for(const n of e.messages.values())i-(n.editedTimestamp||n.createdTimestamp)>t&&(e.messages.delete(n.id),s++)}return this.emit("debug",`Swept ${s} messages older than ${e} seconds in ${n} text-based channels`),s}fetchApplication(e="@me"){return this.rest.methods.getApplication(e)}generateInvite(e){return e?e instanceof Array&&(e=Permissions.resolve(e)):e=0,this.fetchApplication().then(t=>`https://discordapp.com/oauth2/authorize?client_id=${t.id}&permissions=${e}&scope=bot`)}setTimeout(e,t,...i){const n=setTimeout(()=>{e(...i),this._timeouts.delete(n)},t);return this._timeouts.add(n),n}clearTimeout(e){clearTimeout(e),this._timeouts.delete(e)}setInterval(e,t,...i){const n=setInterval(e,t,...i);return this._intervals.add(n),n}clearInterval(e){clearInterval(e),this._intervals.delete(e)}_pong(e){this.pings.unshift(Date.now()-e),this.pings.length>3&&(this.pings.length=3),this.ws.lastHeartbeatAck=!0}_setPresence(e,t){this.presences.has(e)?this.presences.get(e).update(t):this.presences.set(e,new Presence(t))}_eval(script){return eval(script)}_validateOptions(e=this.options){if("number"!=typeof e.shardCount||isNaN(e.shardCount))throw new TypeError("The shardCount option must be a number.");if("number"!=typeof e.shardId||isNaN(e.shardId))throw new TypeError("The shardId option must be a number.");if(e.shardCount<0)throw new RangeError("The shardCount option must be at least 0.");if(e.shardId<0)throw new RangeError("The shardId option must be at least 0.");if(0!==e.shardId&&e.shardId>=e.shardCount)throw new RangeError("The shardId option must be less than shardCount.");if("number"!=typeof e.messageCacheMaxSize||isNaN(e.messageCacheMaxSize))throw new TypeError("The messageCacheMaxSize option must be a number.");if("number"!=typeof e.messageCacheLifetime||isNaN(e.messageCacheLifetime))throw new TypeError("The messageCacheLifetime option must be a number.");if("number"!=typeof e.messageSweepInterval||isNaN(e.messageSweepInterval))throw new TypeError("The messageSweepInterval option must be a number.");if("boolean"!=typeof e.fetchAllMembers)throw new TypeError("The fetchAllMembers option must be a boolean.");if("boolean"!=typeof e.disableEveryone)throw new TypeError("The disableEveryone option must be a boolean.");if("number"!=typeof e.restWsBridgeTimeout||isNaN(e.restWsBridgeTimeout))throw new TypeError("The restWsBridgeTimeout option must be a number.");if(!(e.disabledEvents instanceof Array))throw new TypeError("The disabledEvents option must be an Array.")}}module.exports=Client}).call(exports,__webpack_require__(7))},function(e,t){e.exports=function(e){return e&&"object"==typeof e&&"function"==typeof e.copy&&"function"==typeof e.fill&&"function"==typeof e.readUInt8}},function(e,t){"function"==typeof Object.create?e.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(e,t){e.super_=t;var i=function(){};i.prototype=t.prototype,e.prototype=new i,e.prototype.constructor=e}},function(e,t,i){(function(t){const n=i(0);class s{constructor(){this.build(this.constructor.DEFAULT)}set({url:e,version:t}={}){this.build({url:e||this.constructor.DFEAULT.url,version:t||this.constructor.DEFAULT.version})}build(e){this.userAgent=`DiscordBot (${e.url}, ${e.version}) Node.js/${t.version}`}}s.DEFAULT={url:n.Package.homepage.split("#")[0],version:n.Package.version},e.exports=s}).call(t,i(7))},function(e,t,i){const n=i(35),s=i(37),r=i(11),o=i(0),a=o.Endpoints,c=i(3),l=i(8),h=i(4),u=i(14),d=i(24),p=i(22),m=i(15),f=i(63),g=i(41),v=i(113),E=i(42),b=i(17),_=i(43),y=i(30),w=i(115),x=i(66);class A{constructor(e){this.rest=e,this.client=e.client,this._ackToken=null}login(e=this.client.token){return new Promise((t,i)=>{if("string"!=typeof e)throw new Error(o.Errors.INVALID_TOKEN);e=e.replace(/^Bot\s*/i,""),this.client.manager.connectToWebSocket(e,t,i)})}logout(){return this.rest.makeRequest("post",a.logout,!0,{})}getGateway(e=!1){return this.rest.makeRequest("get",e?a.gateway.bot:a.gateway,!0)}fetchVoiceRegions(e){let t;return t=e?a.Guild(e).voiceRegions:a.voiceRegions,this.rest.makeRequest("get",t,!0).then(e=>{const t=new c;for(const i of e)t.set(i.id,new w(i));return t})}sendMessage(e,t,{tts:i,nonce:n,embed:s,disableEveryone:r,split:o,code:c,reply:l}={},p=null){return new Promise((m,f)=>{if(void 0!==t&&(t=this.client.resolver.resolveString(t)),void 0!==n&&(n=parseInt(n),isNaN(n)||n<0))throw new RangeError("Message nonce must fit in an unsigned 64-bit integer.");if(t){if(o&&"object"!=typeof o&&(o={}),void 0===c||"boolean"==typeof c&&!0!==c||(t=h.escapeMarkdown(this.client.resolver.resolveString(t),!0),t=`\`\`\`${"boolean"!=typeof c?c||"":""}\n${t}\n\`\`\``,o&&(o.prepend=`\`\`\`${"boolean"!=typeof c?c||"":""}\n`,o.append="\n```")),(r||void 0===r&&this.client.options.disableEveryone)&&(t=t.replace(/@(everyone|here)/g,"@​$1")),l&&!(e instanceof u||e instanceof d)&&"dm"!==e.type){const e=this.client.resolver.resolveUserID(l),i=`<@${l instanceof d&&l.nickname?"!":""}${e}>`;t=`${i}${t?`, ${t}`:""}`,o&&(o.prepend=`${i}, ${o.prepend||""}`)}o&&(t=h.splitMessage(t,o))}else if(l&&!(e instanceof u||e instanceof d)&&"dm"!==e.type){const e=this.client.resolver.resolveUserID(l);t=`<@${l instanceof d&&l.nickname?"!":""}${e}>`}const g=e=>{if(t instanceof Array){const n=[];!function t(r,o){const a=o===r.length-1?{tts:i,embed:s,files:p}:{tts:i};e.send(r[o],a).then(e=>(n.push(e),o>=r.length-1?m(n):t(r,++o))).catch(f)}(t,0)}else this.rest.makeRequest("post",a.Channel(e).messages,!0,{content:t,tts:i,nonce:n,embed:s},p).then(e=>m(this.client.actions.MessageCreate.handle(e).message),f)};e instanceof u||e instanceof d?this.createDM(e).then(g,f):g(e)})}updateMessage(e,t,{embed:i,code:n,reply:s}={}){if(void 0!==t&&(t=this.client.resolver.resolveString(t)),void 0===n||"boolean"==typeof n&&!0!==n||(t=h.escapeMarkdown(this.client.resolver.resolveString(t),!0),t=`\`\`\`${"boolean"!=typeof n?n||"":""}\n${t}\n\`\`\``),s&&"dm"!==e.channel.type){const e=this.client.resolver.resolveUserID(s);t=`${`<@${s instanceof d&&s.nickname?"!":""}${e}>`}${t?`, ${t}`:""}`}return this.rest.makeRequest("patch",a.Message(e),!0,{content:t,embed:i}).then(e=>this.client.actions.MessageUpdate.handle(e).updated)}deleteMessage(e){return this.rest.makeRequest("delete",a.Message(e),!0).then(()=>this.client.actions.MessageDelete.handle({id:e.id,channel_id:e.channel.id}).message)}ackMessage(e){return this.rest.makeRequest("post",a.Message(e).ack,!0,{token:this._ackToken}).then(t=>(t.token&&(this._ackToken=t.token),e))}ackTextChannel(e){return this.rest.makeRequest("post",a.Channel(e).Message(e.lastMessageID).ack,!0,{token:this._ackToken}).then(t=>(t.token&&(this._ackToken=t.token),e))}ackGuild(e){return this.rest.makeRequest("post",a.Guild(e).ack,!0).then(()=>e)}bulkDeleteMessages(e,t,i){return i&&(t=t.filter(e=>Date.now()-l.deconstruct(e).date.getTime()<12096e5)),this.rest.makeRequest("post",a.Channel(e).messages.bulkDelete,!0,{messages:t}).then(()=>this.client.actions.MessageDeleteBulk.handle({channel_id:e.id,ids:t}).messages)}search(e,t){if("string"==typeof t&&(t={content:t}),t.before&&(t.before instanceof Date||(t.before=new Date(t.before)),t.maxID=s.fromNumber(t.before.getTime()-14200704e5).shiftLeft(22).toString()),t.after&&(t.after instanceof Date||(t.after=new Date(t.after)),t.minID=s.fromNumber(t.after.getTime()-14200704e5).shiftLeft(22).toString()),t.during){t.during instanceof Date||(t.during=new Date(t.during));const e=t.during.getTime()-14200704e5;t.minID=s.fromNumber(e).shiftLeft(22).toString(),t.maxID=s.fromNumber(e+864e5).shiftLeft(22).toString()}t.channel&&(t.channel=this.client.resolver.resolveChannelID(t.channel)),t.author&&(t.author=this.client.resolver.resolveUserID(t.author)),t.mentions&&(t.mentions=this.client.resolver.resolveUserID(t.options.mentions)),t={content:t.content,max_id:t.maxID,min_id:t.minID,has:t.has,channel_id:t.channel,author_id:t.author,author_type:t.authorType,context_size:t.contextSize,sort_by:t.sortBy,sort_order:t.sortOrder,limit:t.limit,offset:t.offset,mentions:t.mentions,mentions_everyone:t.mentionsEveryone,link_hostname:t.linkHostname,embed_provider:t.embedProvider,embed_type:t.embedType,attachment_filename:t.attachmentFilename,attachment_extension:t.attachmentExtension,include_nsfw:t.nsfw};for(const e in t)void 0===t[e]&&delete t[e];const i=(n.stringify(t).match(/[^=&?]+=[^=&?]+/g)||[]).join("&");let r;if(e instanceof b)r=a.Channel(e).search;else{if(!(e instanceof y))throw new TypeError("Target must be a TextChannel, DMChannel, GroupDMChannel, or Guild.");r=a.Guild(e).search}return this.rest.makeRequest("get",`${r}?${i}`,!0).then(e=>{const t=e.messages.map(e=>e.map(e=>new p(this.client.channels.get(e.channel_id),e,this.client)));return{totalResults:e.total_results,messages:t}})}createChannel(e,t,i,n,s){return n instanceof c&&(n=n.array()),this.rest.makeRequest("post",a.Guild(e).channels,!0,{name:t,type:i,permission_overwrites:n},void 0,s).then(e=>this.client.actions.ChannelCreate.handle(e).channel)}createDM(e){const t=this.getExistingDM(e);return t?Promise.resolve(t):this.rest.makeRequest("post",a.User(this.client.user).channels,!0,{recipient_id:e.id}).then(e=>this.client.actions.ChannelCreate.handle(e).channel)}createGroupDM(e){const t=this.client.user.bot?{access_tokens:e.accessTokens,nicks:e.nicks}:{recipients:e.recipients};return this.rest.makeRequest("post",a.User("@me").channels,!0,t).then(e=>new _(this.client,e))}addUserToGroupDM(e,t){const i=this.client.user.bot?{nick:t.nick,access_token:t.accessToken}:{recipient:t.id};return this.rest.makeRequest("put",a.Channel(e).Recipient(t.id),!0,i).then(()=>e)}removeUserFromGroupDM(e,t){return this.rest.makeRequest("delete",a.Channel(e).Recipient(t),!0).then(()=>e)}updateGroupDMChannel(e,t){const i={};return i.name=t.name,i.icon=t.icon,this.rest.makeRequest("patch",a.Channel(e),!0,i).then(()=>e)}getExistingDM(e){return this.client.channels.find(t=>t.recipient&&t.recipient.id===e.id)}deleteChannel(e,t){return(e instanceof u||e instanceof d)&&(e=this.getExistingDM(e)),e?this.rest.makeRequest("delete",a.Channel(e),!0,void 0,void 0,t).then(t=>(t.id=e.id,this.client.actions.ChannelDelete.handle(t).channel)):Promise.reject(new Error("No channel to delete."))}updateChannel(e,t,i){const n={};return n.name=(t.name||e.name).trim(),n.topic=t.topic||e.topic,n.position=t.position||e.position,n.bitrate=t.bitrate||e.bitrate,n.user_limit=t.userLimit||e.userLimit,this.rest.makeRequest("patch",a.Channel(e),!0,n,void 0,i).then(e=>this.client.actions.ChannelUpdate.handle(e).updated)}leaveGuild(e){return e.ownerID===this.client.user.id?Promise.reject(new Error("Guild is owned by the client.")):this.rest.makeRequest("delete",a.User("@me").Guild(e.id),!0).then(()=>this.client.actions.GuildDelete.handle({id:e.id}).guild)}createGuild(e){return e.icon=this.client.resolver.resolveBase64(e.icon)||null,e.region=e.region||"us-central",new Promise((t,i)=>{this.rest.makeRequest("post",a.guilds,!0,e).then(e=>{if(this.client.guilds.has(e.id))return t(this.client.guilds.get(e.id));const n=i=>{i.id===e.id&&(this.client.removeListener(o.Events.GUILD_CREATE,n),this.client.clearTimeout(s),t(i))};this.client.on(o.Events.GUILD_CREATE,n);const s=this.client.setTimeout(()=>{this.client.removeListener(o.Events.GUILD_CREATE,n),i(new Error("Took too long to receive guild data."))},1e4)},i)})}deleteGuild(e){return this.rest.makeRequest("delete",a.Guild(e),!0).then(()=>this.client.actions.GuildDelete.handle({id:e.id}).guild)}getUser(e,t){return this.rest.makeRequest("get",a.User(e),!0).then(e=>t?this.client.actions.UserGet.handle(e).user:new u(this.client,e))}updateCurrentUser(e,t){const i=this.client.user,n={};return n.username=e.username||i.username,n.avatar=void 0===e.avatar?i.avatar:this.client.resolver.resolveBase64(e.avatar),i.bot||(n.email=e.email||i.email,n.password=t,e.new_password&&(n.new_password=e.newPassword)),this.rest.makeRequest("patch",a.User("@me"),!0,n).then(e=>this.client.actions.UserUpdate.handle(e).updated)}updateGuild(e,t,i){return this.rest.makeRequest("patch",a.Guild(e),!0,t,void 0,i).then(e=>this.client.actions.GuildUpdate.handle(e).updated)}kickGuildMember(e,t,i){return this.rest.makeRequest("delete",a.Guild(e).Member(t),!0,void 0,void 0,i).then(()=>this.client.actions.GuildMemberRemove.handle({guild_id:e.id,user:t.user}).member)}createGuildRole(e,t,i){return t.color&&(t.color=this.client.resolver.resolveColor(t.color)),t.permissions&&(t.permissions=r.resolve(t.permissions)),this.rest.makeRequest("post",a.Guild(e).roles,!0,t,void 0,i).then(n=>{const{role:s}=this.client.actions.GuildRoleCreate.handle({guild_id:e.id,role:n});return t.position?s.setPosition(t.position,i):s})}deleteGuildRole(e,t){return this.rest.makeRequest("delete",a.Guild(e.guild).Role(e.id),!0,void 0,void 0,t).then(()=>this.client.actions.GuildRoleDelete.handle({guild_id:e.guild.id,role_id:e.id}).role)}setChannelOverwrite(e,t){return this.rest.makeRequest("put",`${a.Channel(e).permissions}/${t.id}`,!0,t)}deletePermissionOverwrites(e,t){return this.rest.makeRequest("delete",`${a.Channel(e.channel).permissions}/${e.id}`,!0,void 0,void 0,t).then(()=>e)}getChannelMessages(e,t={}){const i=[];t.limit&&i.push(`limit=${t.limit}`),t.around?i.push(`around=${t.around}`):t.before?i.push(`before=${t.before}`):t.after&&i.push(`after=${t.after}`);let n=a.Channel(e).messages;return i.length>0&&(n+=`?${i.join("&")}`),this.rest.makeRequest("get",n,!0)}getChannelMessage(e,t){const i=e.messages.get(t);return i?Promise.resolve(i):this.rest.makeRequest("get",a.Channel(e).Message(t),!0)}putGuildMember(e,t,i){if(i.access_token=i.accessToken,i.roles){const e=i.roles;(e instanceof c||e instanceof Array&&e[0]instanceof m)&&(i.roles=e.map(e=>e.id))}return this.rest.makeRequest("put",a.Guild(e).Member(t.id),!0,i).then(t=>this.client.actions.GuildMemberGet.handle(e,t).member)}getGuildMember(e,t,i){return this.rest.makeRequest("get",a.Guild(e).Member(t.id),!0).then(t=>i?this.client.actions.GuildMemberGet.handle(e,t).member:new d(e,t))}updateGuildMember(e,t,i){t.channel&&(t.channel_id=this.client.resolver.resolveChannel(t.channel).id,t.channel=null),t.roles&&(t.roles=t.roles.map(e=>e instanceof m?e.id:e));let n=a.Member(e);if(e.id===this.client.user.id){const i=Object.keys(t);1===i.length&&"nick"===i[0]&&(n=a.Member(e).nickname)}return this.rest.makeRequest("patch",n,!0,t,void 0,i).then(t=>e.guild._updateMember(e,t).mem)}addMemberRole(e,t,i){return new Promise((n,s)=>{if(e._roles.includes(t.id))return n(e);const r=(e,i)=>{!e._roles.includes(t.id)&&i._roles.includes(t.id)&&(this.client.removeListener(o.Events.GUILD_MEMBER_UPDATE,r),n(i))};this.client.on(o.Events.GUILD_MEMBER_UPDATE,r);const c=this.client.setTimeout(()=>this.client.removeListener(o.Events.GUILD_MEMBER_UPDATE,r),1e4);return this.rest.makeRequest("put",a.Member(e).Role(t.id),!0,void 0,void 0,i).catch(e=>{this.client.removeListener(o.Events.GUILD_BAN_REMOVE,r),this.client.clearTimeout(c),s(e)})})}removeMemberRole(e,t,i){return new Promise((n,s)=>{if(!e._roles.includes(t.id))return n(e);const r=(e,i)=>{e._roles.includes(t.id)&&!i._roles.includes(t.id)&&(this.client.removeListener(o.Events.GUILD_MEMBER_UPDATE,r),n(i))};this.client.on(o.Events.GUILD_MEMBER_UPDATE,r);const c=this.client.setTimeout(()=>this.client.removeListener(o.Events.GUILD_MEMBER_UPDATE,r),1e4);return this.rest.makeRequest("delete",a.Member(e).Role(t.id),!0,void 0,void 0,i).catch(e=>{this.client.removeListener(o.Events.GUILD_BAN_REMOVE,r),this.client.clearTimeout(c),s(e)})})}sendTyping(e){return this.rest.makeRequest("post",a.Channel(e).typing,!0)}banGuildMember(e,t,i){const s=this.client.resolver.resolveUserID(t);if(!s)return Promise.reject(new Error("Couldn't resolve the user ID to ban."));const r=`${a.Guild(e).bans}/${s}?${n.stringify(i)}`;return this.rest.makeRequest("put",r,!0).then(()=>{if(t instanceof d)return t;const i=this.client.resolver.resolveUser(s);return i?(t=this.client.resolver.resolveGuildMember(e,i))||i:s})}unbanGuildMember(e,t,i){return new Promise((n,s)=>{const r=this.client.resolver.resolveUserID(t);if(!r)throw new Error("Couldn't resolve the user ID to unban.");const c=(t,i)=>{t.id===e.id&&i.id===r&&(this.client.removeListener(o.Events.GUILD_BAN_REMOVE,c),this.client.clearTimeout(l),n(i))};this.client.on(o.Events.GUILD_BAN_REMOVE,c);const l=this.client.setTimeout(()=>{this.client.removeListener(o.Events.GUILD_BAN_REMOVE,c),s(new Error("Took too long to receive the ban remove event."))},1e4);this.rest.makeRequest("delete",`${a.Guild(e).bans}/${r}`,!0,void 0,void 0,i).catch(e=>{this.client.removeListener(o.Events.GUILD_BAN_REMOVE,c),this.client.clearTimeout(l),s(e)})})}getGuildBans(e){return this.rest.makeRequest("get",a.Guild(e).bans,!0).then(e=>e.reduce((e,t)=>(e.set(t.user.id,{reason:t.reason,user:this.client.dataManager.newUser(t.user)}),e),new c))}updateGuildRole(e,t,i){const n={};return n.name=t.name||e.name,n.position=void 0!==t.position?t.position:e.position,n.color=this.client.resolver.resolveColor(t.color||e.color),n.hoist=void 0!==t.hoist?t.hoist:e.hoist,n.mentionable=void 0!==t.mentionable?t.mentionable:e.mentionable,t.permissions?n.permissions=r.resolve(t.permissions):n.permissions=e.permissions,this.rest.makeRequest("patch",a.Guild(e.guild).Role(e.id),!0,n,void 0,i).then(t=>this.client.actions.GuildRoleUpdate.handle({role:t,guild_id:e.guild.id}).updated)}pinMessage(e){return this.rest.makeRequest("put",a.Channel(e.channel).Pin(e.id),!0).then(()=>e)}unpinMessage(e){return this.rest.makeRequest("delete",a.Channel(e.channel).Pin(e.id),!0).then(()=>e)}getChannelPinnedMessages(e){return this.rest.makeRequest("get",a.Channel(e).pins,!0)}createChannelInvite(e,t,i){const n={};return n.temporary=t.temporary,n.max_age=t.maxAge,n.max_uses=t.maxUses,n.unique=t.unique,this.rest.makeRequest("post",a.Channel(e).invites,!0,n,void 0,i).then(e=>new f(this.client,e))}deleteInvite(e,t){return this.rest.makeRequest("delete",a.Invite(e.code),!0,void 0,void 0,t).then(()=>e)}getInvite(e){return this.rest.makeRequest("get",a.Invite(e),!0).then(e=>new f(this.client,e))}getGuildInvites(e){return this.rest.makeRequest("get",a.Guild(e).invites,!0).then(e=>{const t=new c;for(const i of e){const e=new f(this.client,i);t.set(e.code,e)}return t})}pruneGuildMembers(e,t,i,n){return this.rest.makeRequest(i?"get":"post",`${a.Guild(e).prune}?days=${t}`,!0,void 0,void 0,n).then(e=>e.pruned)}createEmoji(e,t,i,n,s){const r={image:t,name:i};return n&&(r.roles=n.map(e=>e.id?e.id:e)),this.rest.makeRequest("post",a.Guild(e).emojis,!0,r,void 0,s).then(t=>this.client.actions.GuildEmojiCreate.handle(e,t).emoji)}updateEmoji(e,t,i){const n={};return t.name&&(n.name=t.name),t.roles&&(n.roles=t.roles.map(e=>e.id?e.id:e)),this.rest.makeRequest("patch",a.Guild(e.guild).Emoji(e.id),!0,n,void 0,i).then(t=>this.client.actions.GuildEmojiUpdate.handle(e,t).emoji)}deleteEmoji(e,t){return this.rest.makeRequest("delete",a.Guild(e.guild).Emoji(e.id),!0,void 0,t).then(()=>this.client.actions.GuildEmojiDelete.handle(e).data)}getGuildAuditLogs(e,t={}){t.before&&t.before instanceof x.Entry&&(t.before=t.before.id),t.after&&t.after instanceof x.Entry&&(t.after=t.after.id),"string"==typeof t.type&&(t.type=x.Actions[t.type]);const i=(n.stringify({before:t.before,after:t.after,limit:t.limit,user_id:this.client.resolver.resolveUserID(t.user),action_type:t.type}).match(/[^=&?]+=[^=&?]+/g)||[]).join("&");return this.rest.makeRequest("get",`${a.Guild(e).auditLogs}?${i}`,!0).then(t=>x.build(e,t))}getWebhook(e,t){return this.rest.makeRequest("get",a.Webhook(e,t),!t).then(e=>new g(this.client,e))}getGuildWebhooks(e){return this.rest.makeRequest("get",a.Guild(e).webhooks,!0).then(e=>{const t=new c;for(const i of e)t.set(i.id,new g(this.client,i));return t})}getChannelWebhooks(e){return this.rest.makeRequest("get",a.Channel(e).webhooks,!0).then(e=>{const t=new c;for(const i of e)t.set(i.id,new g(this.client,i));return t})}createWebhook(e,t,i,n){return this.rest.makeRequest("post",a.Channel(e).webhooks,!0,{name:t,avatar:i},void 0,n).then(e=>new g(this.client,e))}editWebhook(e,t,i){return this.rest.makeRequest("patch",a.Webhook(e.id,e.token),!1,{name:t,avatar:i}).then(t=>(e.name=t.name,e.avatar=t.avatar,e))}deleteWebhook(e,t){return this.rest.makeRequest("delete",a.Webhook(e.id,e.token),!1,void 0,void 0,t)}sendWebhookMessage(e,t,{avatarURL:i,tts:n,embeds:s,username:r}={},o=null){return new Promise((c,l)=>{if(r=r||e.name,t instanceof Array){const i=[];!function t(r,a){const h=a===r.length-1?{tts:n,embeds:s,files:o}:{tts:n};e.send(r[a],h).then(e=>(i.push(e),a>=r.length-1?c(i):t(r,++a))).catch(l)}(t,0)}else this.rest.makeRequest("post",`${a.Webhook(e.id,e.token)}?wait=true`,!1,{username:r,avatar_url:i,content:t,tts:n,embeds:s},o).then(c,l)})}sendSlackWebhookMessage(e,t){return this.rest.makeRequest("post",`${a.Webhook(e.id,e.token)}/slack?wait=true`,!1,t)}fetchUserProfile(e){return this.rest.makeRequest("get",a.User(e).profile,!0).then(t=>new v(e,t))}fetchMentions(e){return e.guild instanceof y&&(e.guild=e.guild.id),h.mergeDefault({limit:25,roles:!0,everyone:!0,guild:null},e),this.rest.makeRequest("get",a.User("@me").Mentions(e.limit,e.roles,e.everyone,e.guild),!0).then(e=>e.map(e=>new p(this.client.channels.get(e.channel_id),e,this.client)))}addFriend(e){return this.rest.makeRequest("post",a.User("@me"),!0,{username:e.username,discriminator:e.discriminator}).then(()=>e)}removeFriend(e){return this.rest.makeRequest("delete",a.User("@me").Relationship(e.id),!0).then(()=>e)}blockUser(e){return this.rest.makeRequest("put",a.User("@me").Relationship(e.id),!0,{type:2}).then(()=>e)}unblockUser(e){return this.rest.makeRequest("delete",a.User("@me").Relationship(e.id),!0).then(()=>e)}updateChannelPositions(e,t){const i=new Array(t.length);for(let e=0;ethis.client.actions.GuildChannelsPositionUpdate.handle({guild_id:e,channels:t}).guild)}setRolePositions(e,t){return this.rest.makeRequest("patch",a.Guild(e).roles,!0,t).then(()=>this.client.actions.GuildRolesPositionUpdate.handle({guild_id:e,roles:t}).guild)}setChannelPositions(e,t){return this.rest.makeRequest("patch",a.Guild(e).channels,!0,t).then(()=>this.client.actions.GuildChannelsPositionUpdate.handle({guild_id:e,channels:t}).guild)}addMessageReaction(e,t){return this.rest.makeRequest("put",a.Message(e).Reaction(t).User("@me"),!0).then(()=>e._addReaction(h.parseEmoji(t),e.client.user))}removeMessageReaction(e,t,i){const n=a.Message(e).Reaction(t).User(i===this.client.user.id?"@me":i);return this.rest.makeRequest("delete",n,!0).then(()=>this.client.actions.MessageReactionRemove.handle({user_id:i,message_id:e.id,emoji:h.parseEmoji(t),channel_id:e.channel.id}).reaction)}removeMessageReactions(e){return this.rest.makeRequest("delete",a.Message(e).reactions,!0).then(()=>e)}getMessageReactionUsers(e,t,i=100){return this.rest.makeRequest("get",a.Message(e).Reaction(t,i),!0)}getApplication(e){return this.rest.makeRequest("get",a.OAUTH2.Application(e),!0).then(e=>new E(this.client,e))}resetApplication(e){return this.rest.makeRequest("post",a.OAUTH2.Application(e).resetToken,!0).then(()=>this.rest.makeRequest("post",a.OAUTH2.Application(e).resetSecret,!0)).then(e=>new E(this.client,e))}setNote(e,t){return this.rest.makeRequest("put",a.User(e).note,!0,{note:t}).then(()=>e)}acceptInvite(e){return e.id&&(e=e.id),new Promise((t,i)=>this.rest.makeRequest("post",a.Invite(e),!0).then(e=>{const n=i=>{i.id===e.id&&(t(i),this.client.removeListener(o.Events.GUILD_CREATE,n))};this.client.on(o.Events.GUILD_CREATE,n),this.client.setTimeout(()=>{this.client.removeListener(o.Events.GUILD_CREATE,n),i(new Error("Accepting invite timed out"))},12e4)}))}patchUserSettings(e){return this.rest.makeRequest("patch",o.Endpoints.User("@me").settings,!0,e)}patchClientUserGuildSettings(e,t){return this.rest.makeRequest("patch",o.Endpoints.User("@me").Guild(e).settings,!0,t)}}e.exports=A},function(e,t,i){const n=i(3),s=i(114);class r{constructor(e,t){this.user=e,Object.defineProperty(this,"client",{value:e.client}),this.mutualGuilds=new n,this.connections=new n,this.setup(t)}setup(e){this.premium=e.premium,this.premiumSince=e.premium_since?new Date(e.premium_since):null;for(const t of e.mutual_guilds)this.client.guilds.has(t.id)&&this.mutualGuilds.set(t.id,this.client.guilds.get(t.id));for(const t of e.connected_accounts)this.connections.set(t.id,new s(this.user,t))}}e.exports=r},function(e,t){class i{constructor(e,t){this.user=e,this.setup(t)}setup(e){this.type=e.type,this.name=e.name,this.id=e.id,this.revoked=e.revoked,this.integrations=e.integrations}}e.exports=i},function(e,t){class i{constructor(e){this.id=e.id,this.name=e.name,this.vip=e.vip,this.deprecated=e.deprecated,this.optimal=e.optimal,this.custom=e.custom,this.sampleHostname=e.sample_hostname}}e.exports=i},function(e,t,i){const n=i(67),s=i(44);class r extends n{constructor(e,t){super(e,t),this.endpoint=t,this.timeDifference=0,this.busy=!1}push(e){super.push(e),this.handle()}execute(e){return this.busy=!0,new Promise(t=>{e.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(e),this.restManager.client.setTimeout(()=>{this.globalLimit=!1,t()},Number(n.headers["retry-after"])+this.restManager.client.options.restTimeOffset),n.headers["x-ratelimit-global"]&&(this.globalLimit=!0)):i.status>=500&&i.status<600?(this.queue.unshift(e),this.restManager.client.setTimeout(t,1e3+this.client.options.restTimeOffset)):(e.reject(i.status>=400&&i.status<500?new s(n.request.path,n.body):i),t(i));else{this.globalLimit=!1;const i=n&&n.body?n.body:{};e.resolve(i),0===this.requestRemaining?this.restManager.client.setTimeout(()=>t(i),this.requestResetTime-Date.now()+this.timeDifference+this.restManager.client.options.restTimeOffset):t(i)}})})}handle(){super.handle(),this.busy||0===this.remaining||0===this.queue.length||this.globalLimit||this.execute(this.queue.shift()).then(()=>{this.busy=!1,this.handle()})}}e.exports=r},function(e,t,i){const n=i(67),s=i(44);class r extends n{constructor(e,t){super(e,t),this.client=e.client,this.limit=1/0,this.resetTime=null,this.remaining=1,this.timeDifference=0,this.resetTimeout=null}push(e){super.push(e),this.handle()}execute(e){e&&e.request.gen().end((t,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()),t)if(429===t.status){if(this.queue.unshift(e),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.status>=500&&t.status<600?(this.queue.unshift(e),this.resetTimeout=this.client.setTimeout(()=>{this.handle(),this.resetTimeout=null},1e3+this.client.options.restTimeOffset)):(e.reject(t.status>=400&&t.status<500?new s(i.request.path,i.body):t),this.handle());else{this.globalLimit=!1;const t=i&&i.body?i.body:{};e.resolve(t),this.handle()}})}handle(){super.handle(),this.remaining<=0||0===this.queue.length||this.globalLimit||(this.execute(this.queue.shift()),this.remaining--,this.handle())}}e.exports=r},function(e,t,i){const n=i(32),s=i(0);class r{constructor(e,t,i,n,s,r,o){this.rest=e,this.client=e.client,this.method=t,this.path=i.toString(),this.auth=n,this.data=s,this.files=r,this.route=this.getRoute(this.path),this.reason=o}getRoute(e){let t=e.split("?")[0];if(t.includes("/channels/")||t.includes("/guilds/")){const e=t.includes("/channels/")?t.indexOf("/channels/"):t.indexOf("/guilds/"),i=t.substring(e).split("/")[2];t=t.replace(/(\d{8,})/g,":id").replace(":id",i)}return t}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 e=`${this.client.options.http.host}/api/v${this.client.options.http.version}`,t=n[this.method](`${e}${this.path}`);if(this.auth&&t.set("Authorization",this.getAuth()),this.reason&&t.set("X-Audit-Log-Reason",encodeURIComponent(this.reason)),this.rest.client.browser||t.set("User-Agent",this.rest.userAgentManager.userAgent),this.files){for(const e of this.files)e&&e.file&&t.attach(e.name,e.file,e.name);void 0!==this.data&&t.attach("payload_json",JSON.stringify(this.data))}else this.data&&t.send(this.data);return t}}e.exports=r},function(e,t,i){const n=i(0),s=i(4),r=i(30),o=i(14),a=i(68),c=i(23),l=i(69),h=i(71),u=i(31),d=i(43);class p{constructor(e){this.client=e}get pastReady(){return this.client.ws.connection.status===n.Status.READY}newGuild(e){const t=this.client.guilds.has(e.id),i=new r(this.client,e);return this.client.guilds.set(i.id,i),this.pastReady&&!t&&(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(e){if(this.client.users.has(e.id))return this.client.users.get(e.id);const t=new o(this.client,e);return this.client.users.set(t.id,t),t}newChannel(e,t){const i=this.client.channels.has(e.id);let s;return e.type===n.ChannelTypes.DM?s=new a(this.client,e):e.type===n.ChannelTypes.GROUP_DM?s=new d(this.client,e):(t=t||this.client.guilds.get(e.guild_id))&&(e.type===n.ChannelTypes.TEXT?(s=new l(t,e),t.channels.set(s.id,s)):e.type===n.ChannelTypes.VOICE&&(s=new h(t,e),t.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(e,t){const i=t.emojis.has(e.id);if(e&&!i){let i=new c(t,e);return this.client.emit(n.Events.GUILD_EMOJI_CREATE,i),t.emojis.set(i.id,i),i}return i?t.emojis.get(e.id):null}killEmoji(e){e instanceof c&&e.guild&&(this.client.emit(n.Events.GUILD_EMOJI_DELETE,e),e.guild.emojis.delete(e.id))}killGuild(e){const t=this.client.guilds.has(e.id);this.client.guilds.delete(e.id),t&&this.pastReady&&this.client.emit(n.Events.GUILD_DELETE,e)}killUser(e){this.client.users.delete(e.id)}killChannel(e){this.client.channels.delete(e.id),e instanceof u&&e.guild.channels.delete(e.id)}updateGuild(e,t){const i=s.cloneObject(e);e.setup(t),this.pastReady&&this.client.emit(n.Events.GUILD_UPDATE,i,e)}updateChannel(e,t){e.setup(t)}updateEmoji(e,t){const i=s.cloneObject(e);return e.setup(t),this.client.emit(n.Events.GUILD_EMOJI_UPDATE,i,e),e}}e.exports=p},function(e,t,i){const n=i(0),s=i(72);class r{constructor(e){this.client=e,this.heartbeatInterval=null}get status(){return this.connection?this.connection.status:n.Status.IDLE}connectToWebSocket(e,t,i){this.client.emit(n.Events.DEBUG,`Authenticated using token ${e}`),this.client.token=e;const r=this.client.setTimeout(()=>i(new Error(n.Errors.TOOK_TOO_LONG)),3e5);this.client.rest.methods.getGateway().then(o=>{const a=n.DefaultOptions.ws.version,c=`${o.url}/?v=${a}&encoding=${s.ENCODING}`;this.client.emit(n.Events.DEBUG,`Using gateway ${c}`),this.client.ws.connect(c),this.client.ws.connection.once("close",e=>{4004===e.code&&i(new Error(n.Errors.BAD_LOGIN)),4010===e.code&&i(new Error(n.Errors.INVALID_SHARD)),4011===e.code&&i(new Error(n.Errors.SHARDING_REQUIRED))}),this.client.once(n.Events.READY,()=>{t(e),this.client.clearTimeout(r)})},i)}destroy(){return this.client.ws.destroy(),this.client.rest.destroy(),this.client.user?this.client.user.bot?(this.client.token=null,Promise.resolve()):this.client.rest.methods.logout().then(()=>{this.client.token=null}):Promise.resolve()}}e.exports=r},function(e,t,i){const n=i(0),s=[n.WSEvents.READY,n.WSEvents.RESUMED,n.WSEvents.GUILD_CREATE,n.WSEvents.GUILD_DELETE,n.WSEvents.GUILD_MEMBERS_CHUNK,n.WSEvents.GUILD_MEMBER_ADD,n.WSEvents.GUILD_MEMBER_REMOVE];class r{constructor(e){this.ws=e,this.handlers={},this.queue=[],this.register(n.WSEvents.READY,i(122)),this.register(n.WSEvents.RESUMED,i(125)),this.register(n.WSEvents.GUILD_CREATE,i(126)),this.register(n.WSEvents.GUILD_DELETE,i(127)),this.register(n.WSEvents.GUILD_UPDATE,i(128)),this.register(n.WSEvents.GUILD_BAN_ADD,i(129)),this.register(n.WSEvents.GUILD_BAN_REMOVE,i(130)),this.register(n.WSEvents.GUILD_MEMBER_ADD,i(131)),this.register(n.WSEvents.GUILD_MEMBER_REMOVE,i(132)),this.register(n.WSEvents.GUILD_MEMBER_UPDATE,i(133)),this.register(n.WSEvents.GUILD_ROLE_CREATE,i(134)),this.register(n.WSEvents.GUILD_ROLE_DELETE,i(135)),this.register(n.WSEvents.GUILD_ROLE_UPDATE,i(136)),this.register(n.WSEvents.GUILD_EMOJIS_UPDATE,i(137)),this.register(n.WSEvents.GUILD_MEMBERS_CHUNK,i(138)),this.register(n.WSEvents.CHANNEL_CREATE,i(139)),this.register(n.WSEvents.CHANNEL_DELETE,i(140)),this.register(n.WSEvents.CHANNEL_UPDATE,i(141)),this.register(n.WSEvents.CHANNEL_PINS_UPDATE,i(142)),this.register(n.WSEvents.PRESENCE_UPDATE,i(143)),this.register(n.WSEvents.USER_UPDATE,i(144)),this.register(n.WSEvents.USER_NOTE_UPDATE,i(145)),this.register(n.WSEvents.USER_SETTINGS_UPDATE,i(146)),this.register(n.WSEvents.USER_GUILD_SETTINGS_UPDATE,i(147)),this.register(n.WSEvents.VOICE_STATE_UPDATE,i(148)),this.register(n.WSEvents.TYPING_START,i(149)),this.register(n.WSEvents.MESSAGE_CREATE,i(150)),this.register(n.WSEvents.MESSAGE_DELETE,i(151)),this.register(n.WSEvents.MESSAGE_UPDATE,i(152)),this.register(n.WSEvents.MESSAGE_DELETE_BULK,i(153)),this.register(n.WSEvents.VOICE_SERVER_UPDATE,i(154)),this.register(n.WSEvents.GUILD_SYNC,i(155)),this.register(n.WSEvents.RELATIONSHIP_ADD,i(156)),this.register(n.WSEvents.RELATIONSHIP_REMOVE,i(157)),this.register(n.WSEvents.MESSAGE_REACTION_ADD,i(158)),this.register(n.WSEvents.MESSAGE_REACTION_REMOVE,i(159)),this.register(n.WSEvents.MESSAGE_REACTION_REMOVE_ALL,i(160))}get client(){return this.ws.client}register(e,t){this.handlers[e]=new t(this)}handleQueue(){this.queue.forEach((e,t)=>{this.handle(this.queue[t],!0),this.queue.splice(t,1)})}handle(e,t=!1){return e.op===n.OPCodes.HEARTBEAT_ACK?(this.ws.client._pong(this.ws.client._pingTimestamp),this.ws.lastHeartbeatAck=!0,this.ws.client.emit("debug","Heartbeat acknowledged")):e.op===n.OPCodes.HEARTBEAT&&(this.client.ws.send({op:n.OPCodes.HEARTBEAT,d:this.client.ws.sequence}),this.ws.client.emit("debug","Received gateway heartbeat")),this.ws.status===n.Status.RECONNECTING&&(this.ws.reconnecting=!1,this.ws.checkIfReady()),this.ws.setSequence(e.s),void 0===this.ws.disabledEvents[e.t]&&(this.ws.status!==n.Status.READY&&-1===s.indexOf(e.t)?(this.queue.push(e),!1):(!t&&this.queue.length>0&&this.handleQueue(),!!this.handlers[e.t]&&this.handlers[e.t].handle(e)))}}e.exports=r},function(e,t,i){const n=i(1),s=i(73);class r extends n{handle(e){const t=this.packetManager.client,i=e.d;t.ws.heartbeat(),i.user.user_settings=i.user_settings,i.user.user_guild_settings=i.user_guild_settings;const n=new s(t,i.user);t.user=n,t.readyAt=new Date,t.users.set(n.id,n);for(const e of i.guilds)t.dataManager.newGuild(e);for(const e of i.private_channels)t.dataManager.newChannel(e);for(const e of i.relationships){const i=t.dataManager.newUser(e.user);1===e.type?t.user.friends.set(i.id,i):2===e.type&&t.user.blocked.set(i.id,i)}i.presences=i.presences||[];for(const e of i.presences)t.dataManager.newUser(e.user),t._setPresence(e.user.id,e);if(i.notes)for(const e in i.notes){let n=i.notes[e];n.length||(n=null),t.user.notes.set(e,n)}!t.user.bot&&t.options.sync&&t.setInterval(t.syncGuilds.bind(t),3e4),t.users.has("1")||t.dataManager.newUser({id:"1",username:"Clyde",discriminator:"0000",avatar:"https://discordapp.com/assets/f78426a064bc9dd24847519259bc42af.png",bot:!0,status:"online",game:null,verified:!0});const r=t.setTimeout(()=>{t.ws.connection.triggerReady()},1200*i.guilds.length);t.setMaxListeners(i.guilds.length+10),t.once("ready",()=>{t.syncGuilds(),t.setMaxListeners(10),t.clearTimeout(r)});const o=this.packetManager.ws;o.sessionID=i.session_id,o._trace=i._trace,t.emit("debug",`READY ${o._trace.join(" -> ")} ${o.sessionID}`),o.checkIfReady()}}e.exports=r},function(e,t,i){const n=i(0),s=i(3),r=i(124);class o{constructor(e,t){Object.defineProperty(this,"client",{value:t}),this.guildID=e.guild_id,this.channelOverrides=new s,this.patch(e)}patch(e){for(const t of Object.keys(n.UserGuildSettingsMap)){const i=n.UserGuildSettingsMap[t];if(e.hasOwnProperty(t))if("channel_overrides"===t)for(const i of e[t])this.channelOverrides.set(i.channel_id,new r(i));else"function"==typeof i?this[i.name]=i(e[t]):this[i]=e[t]}}update(e,t){return this.client.rest.methods.patchClientUserGuildSettings(this.guildID,{[e]:t})}}e.exports=o},function(e,t,i){const n=i(0);class s{constructor(e){this.patch(e)}patch(e){for(const t of Object.keys(n.UserChannelOverrideMap)){const i=n.UserChannelOverrideMap[t];e.hasOwnProperty(t)&&("function"==typeof i?this[i.name]=i(e[t]):this[i]=e[t])}}}e.exports=s},function(e,t,i){const n=i(1),s=i(0);class r extends n{handle(e){const t=this.packetManager.client,i=t.ws.connection;i._trace=e.d._trace,i.status=s.Status.READY,this.packetManager.handleQueue();const n=i.sequence-i.closeSequence;i.debug(`RESUMED ${i._trace.join(" -> ")} | replayed ${n} events.`),t.emit(s.Events.RESUME,n),i.heartbeat()}}e.exports=r},function(e,t,i){const n=i(1);class s extends n{handle(e){const t=this.packetManager.client,i=e.d,n=t.guilds.get(i.id);n?n.available||i.unavailable||(n.setup(i),this.packetManager.ws.checkIfReady()):t.dataManager.newGuild(i)}}e.exports=s},function(e,t,i){const n=i(1),s=i(0);class r extends n{handle(e){const t=this.packetManager.client,i=e.d,n=t.actions.GuildDelete.handle(i);n.guild&&t.emit(s.Events.GUILD_DELETE,n.guild)}}e.exports=r},function(e,t,i){const n=i(1);class s extends n{handle(e){const t=this.packetManager.client,i=e.d;t.actions.GuildUpdate.handle(i)}}e.exports=s},function(e,t,i){const n=i(1),s=i(0);class r extends n{handle(e){const t=this.packetManager.client,i=e.d,n=t.guilds.get(i.guild_id),r=t.users.get(i.user.id);n&&r&&t.emit(s.Events.GUILD_BAN_ADD,n,r)}}e.exports=r},function(e,t,i){const n=i(1);class s extends n{handle(e){const t=this.packetManager.client,i=e.d;t.actions.GuildBanRemove.handle(i)}}e.exports=s},function(e,t,i){const n=i(1);class s extends n{handle(e){const t=this.packetManager.client,i=e.d,n=t.guilds.get(i.guild_id);n&&(n.memberCount++,n._addMember(i))}}e.exports=s},function(e,t,i){const n=i(1);class s extends n{handle(e){const t=this.packetManager.client,i=e.d;t.actions.GuildMemberRemove.handle(i)}}e.exports=s},function(e,t,i){const n=i(1);class s extends n{handle(e){const t=this.packetManager.client,i=e.d,n=t.guilds.get(i.guild_id);if(n){const e=n.members.get(i.user.id);e&&n._updateMember(e,i)}}}e.exports=s},function(e,t,i){const n=i(1);class s extends n{handle(e){const t=this.packetManager.client,i=e.d;t.actions.GuildRoleCreate.handle(i)}}e.exports=s},function(e,t,i){const n=i(1);class s extends n{handle(e){const t=this.packetManager.client,i=e.d;t.actions.GuildRoleDelete.handle(i)}}e.exports=s},function(e,t,i){const n=i(1);class s extends n{handle(e){const t=this.packetManager.client,i=e.d;t.actions.GuildRoleUpdate.handle(i)}}e.exports=s},function(e,t,i){const n=i(1);class s extends n{handle(e){const t=this.packetManager.client,i=e.d;t.actions.GuildEmojisUpdate.handle(i)}}e.exports=s},function(e,t,i){const n=i(1),s=i(0);class r extends n{handle(e){const t=this.packetManager.client,i=e.d,n=t.guilds.get(i.guild_id);if(!n)return;const r=i.members.map(e=>n._addMember(e,!1));t.emit(s.Events.GUILD_MEMBERS_CHUNK,r,n),t.ws.lastHeartbeatAck=!0}}e.exports=r},function(e,t,i){const n=i(1);class s extends n{handle(e){const t=this.packetManager.client,i=e.d;t.actions.ChannelCreate.handle(i)}}e.exports=s},function(e,t,i){const n=i(1),s=i(0);class r extends n{handle(e){const t=this.packetManager.client,i=e.d,n=t.actions.ChannelDelete.handle(i);n.channel&&t.emit(s.Events.CHANNEL_DELETE,n.channel)}}e.exports=r},function(e,t,i){const n=i(1);class s extends n{handle(e){const t=this.packetManager.client,i=e.d;t.actions.ChannelUpdate.handle(i)}}e.exports=s},function(e,t,i){const n=i(1),s=i(0);class r extends n{handle(e){const t=this.packetManager.client,i=e.d,n=t.channels.get(i.channel_id),r=new Date(i.last_pin_timestamp);n&&r&&t.emit(s.Events.CHANNEL_PINS_UPDATE,n,r)}}e.exports=r},function(e,t,i){const n=i(1),s=i(0),r=i(4);class o extends n{handle(e){const t=this.packetManager.client,i=e.d;let n=t.users.get(i.user.id);const o=t.guilds.get(i.guild_id);if(!n){if(!i.user.username)return;n=t.dataManager.newUser(i.user)}const a=r.cloneObject(n);if(n.patch(i.user),n.equals(a)||t.emit(s.Events.USER_UPDATE,a,n),o){let e=o.members.get(n.id);if(e||"offline"===i.status||(e=o._addMember({user:n,roles:i.roles,deaf:!1,mute:!1},!1),t.emit(s.Events.GUILD_MEMBER_AVAILABLE,e)),e){if(0===t.listenerCount(s.Events.PRESENCE_UPDATE))return void o._setPresence(n.id,i);const a=r.cloneObject(e);e.presence&&(a.frozenPresence=r.cloneObject(e.presence)),o._setPresence(n.id,i),t.emit(s.Events.PRESENCE_UPDATE,a,e)}else o._setPresence(n.id,i)}}}e.exports=o},function(e,t,i){const n=i(1);class s extends n{handle(e){const t=this.packetManager.client,i=e.d;t.actions.UserUpdate.handle(i)}}e.exports=s},function(e,t,i){const n=i(1);class s extends n{handle(e){const t=this.packetManager.client,i=e.d;t.actions.UserNoteUpdate.handle(i)}}e.exports=s},function(e,t,i){const n=i(1),s=i(0);class r extends n{handle(e){const t=this.packetManager.client;t.user.settings.patch(e.d),t.emit(s.Events.USER_SETTINGS_UPDATE,t.user.settings)}}e.exports=r},function(e,t,i){const n=i(1),s=i(0);class r extends n{handle(e){const t=this.packetManager.client;t.user.guildSettings.get(e.d.guild_id).patch(e.d),t.emit(s.Events.USER_GUILD_SETTINGS_UPDATE,t.user.guildSettings.get(e.d.guild_id))}}e.exports=r},function(e,t,i){const n=i(1),s=i(0),r=i(4);class o extends n{handle(e){const t=this.packetManager.client,i=e.d,n=t.guilds.get(i.guild_id);if(n){const e=n.members.get(i.user_id);if(e){const n=r.cloneObject(e);e.voiceChannel&&e.voiceChannel.id!==i.channel_id&&e.voiceChannel.members.delete(n.id),i.channel_id||(e.speaking=null),e.user.id===t.user.id&&i.channel_id&&t.emit("self.voiceStateUpdate",i);const o=t.channels.get(i.channel_id);o&&o.members.set(e.user.id,e),e.serverMute=i.mute,e.serverDeaf=i.deaf,e.selfMute=i.self_mute,e.selfDeaf=i.self_deaf,e.voiceSessionID=i.session_id,e.voiceChannelID=i.channel_id,t.emit(s.Events.VOICE_STATE_UPDATE,n,e)}}}}e.exports=o},function(e,t,i){function n(e,t){return e.client.setTimeout(()=>{e.client.emit(r.Events.TYPING_STOP,e,t,e._typing.get(t.id)),e._typing.delete(t.id)},6e3)}const s=i(1),r=i(0);class o extends s{handle(e){const t=this.packetManager.client,i=e.d,s=t.channels.get(i.channel_id),o=t.users.get(i.user_id),c=new Date(1e3*i.timestamp);if(s&&o){if("voice"===s.type)return void t.emit(r.Events.WARN,`Discord sent a typing packet to voice channel ${s.id}`);if(s._typing.has(o.id)){const e=s._typing.get(o.id);e.lastTimestamp=c,e.resetTimeout(n(s,o))}else s._typing.set(o.id,new a(t,c,c,n(s,o))),t.emit(r.Events.TYPING_START,s,o)}}}class a{constructor(e,t,i,n){this.client=e,this.since=t,this.lastTimestamp=i,this._timeout=n}resetTimeout(e){this.client.clearTimeout(this._timeout),this._timeout=e}get elapsedTime(){return Date.now()-this.since}}e.exports=o},function(e,t,i){const n=i(1),s=i(0);class r extends n{handle(e){const t=this.packetManager.client,i=e.d,n=t.actions.MessageCreate.handle(i);n.message&&t.emit(s.Events.MESSAGE_CREATE,n.message)}}e.exports=r},function(e,t,i){const n=i(1),s=i(0);class r extends n{handle(e){const t=this.packetManager.client,i=e.d,n=t.actions.MessageDelete.handle(i);n.message&&t.emit(s.Events.MESSAGE_DELETE,n.message)}}e.exports=r},function(e,t,i){const n=i(1);class s extends n{handle(e){const t=this.packetManager.client,i=e.d;t.actions.MessageUpdate.handle(i)}}e.exports=s},function(e,t,i){const n=i(1);class s extends n{handle(e){const t=this.packetManager.client,i=e.d;t.actions.MessageDeleteBulk.handle(i)}}e.exports=s},function(e,t,i){const n=i(1);class s extends n{handle(e){const t=this.packetManager.client,i=e.d;t.emit("self.voiceServer",i)}}e.exports=s},function(e,t,i){const n=i(1);class s extends n{handle(e){const t=this.packetManager.client,i=e.d;t.actions.GuildSync.handle(i)}}e.exports=s},function(e,t,i){const n=i(1);class s extends n{handle(e){const t=this.packetManager.client,i=e.d;1===i.type?t.fetchUser(i.id).then(e=>{t.user.friends.set(e.id,e)}):2===i.type&&t.fetchUser(i.id).then(e=>{t.user.blocked.set(e.id,e)})}}e.exports=s},function(e,t,i){const n=i(1);class s extends n{handle(e){const t=this.packetManager.client,i=e.d;2===i.type?t.user.blocked.has(i.id)&&t.user.blocked.delete(i.id):1===i.type&&t.user.friends.has(i.id)&&t.user.friends.delete(i.id)}}e.exports=s},function(e,t,i){const n=i(1);class s extends n{handle(e){const t=this.packetManager.client,i=e.d;t.actions.MessageReactionAdd.handle(i)}}e.exports=s},function(e,t,i){const n=i(1);class s extends n{handle(e){const t=this.packetManager.client,i=e.d;t.actions.MessageReactionRemove.handle(i)}}e.exports=s},function(e,t,i){const n=i(1);class s extends n{handle(e){const t=this.packetManager.client,i=e.d;t.actions.MessageReactionRemoveAll.handle(i)}}e.exports=s},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t,i){const n=i(9).EventEmitter,s=i(0),r=i(72);class o extends n{constructor(e){super(),this.client=e,this.connection=null}heartbeat(){return this.connection?this.connection.heartbeat():this.debug("No connection to heartbeat")}debug(e){return this.client.emit("debug",`[ws] ${e}`)}destroy(){return this.connection?this.connection.destroy():(this.debug("Attempted to destroy WebSocket but no connection exists!"),!1)}send(e){this.connection?this.connection.send(e):this.debug("No connection to websocket")}connect(e){if(!this.connection)return this.connection=new r(this,e),!0;switch(this.connection.status){case s.Status.IDLE:case s.Status.DISCONNECTED:return this.connection.connect(e,5500),!0;default:return this.debug(`Couldn't connect to ${e} as the websocket is at state ${this.connection.status}`),!1}}}e.exports=o},function(e,t,i){class n{constructor(e){this.client=e,this.register(i(167)),this.register(i(168)),this.register(i(169)),this.register(i(170)),this.register(i(171)),this.register(i(172)),this.register(i(173)),this.register(i(174)),this.register(i(175)),this.register(i(176)),this.register(i(177)),this.register(i(178)),this.register(i(179)),this.register(i(180)),this.register(i(181)),this.register(i(182)),this.register(i(183)),this.register(i(184)),this.register(i(185)),this.register(i(186)),this.register(i(187)),this.register(i(188)),this.register(i(189)),this.register(i(190)),this.register(i(191)),this.register(i(192)),this.register(i(193)),this.register(i(194))}register(e){this[e.name.replace(/Action$/,"")]=new e(this.client)}}e.exports=n},function(e,t,i){const n=i(2),s=i(22);class r extends n{handle(e){const t=this.client,i=t.channels.get((e instanceof Array?e[0]:e).channel_id),n=t.users.get((e instanceof Array?e[0]:e).author.id);if(i){const r=i.guild?i.guild.member(n):null;if(e instanceof Array){const o=new Array(e.length);for(let n=0;nthis.deleted.delete(e+t),this.client.options.restWsBridgeTimeout)}}e.exports=s},function(e,t,i){const n=i(2),s=i(3),r=i(0);class o extends n{handle(e){const t=this.client,i=t.channels.get(e.channel_id),n=e.ids,o=new s;for(const e of n){const t=i.messages.get(e);t&&o.set(t.id,t)}return o.size>0&&t.emit(r.Events.MESSAGE_BULK_DELETE,o),{messages:o}}}e.exports=o},function(e,t,i){const n=i(2),s=i(0);class r extends n{handle(e){const t=this.client,i=t.channels.get(e.channel_id);if(i){const n=i.messages.get(e.id);return n?(n.patch(e),t.emit(s.Events.MESSAGE_UPDATE,n._edits[0],n),{old:n._edits[0],updated:n}):{old:n,updated:n}}return{old:null,updated:null}}}e.exports=r},function(e,t,i){const n=i(2),s=i(0);class r extends n{handle(e){const t=this.client.users.get(e.user_id);if(!t)return!1;const i=this.client.channels.get(e.channel_id);if(!i||"voice"===i.type)return!1;const n=i.messages.get(e.message_id);if(!n)return!1;if(!e.emoji)return!1;const r=n._addReaction(e.emoji,t);return r&&this.client.emit(s.Events.MESSAGE_REACTION_ADD,r,t),{message:n,reaction:r,user:t}}}e.exports=r},function(e,t,i){const n=i(2),s=i(0);class r extends n{handle(e){const t=this.client.users.get(e.user_id);if(!t)return!1;const i=this.client.channels.get(e.channel_id);if(!i||"voice"===i.type)return!1;const n=i.messages.get(e.message_id);if(!n)return!1;if(!e.emoji)return!1;const r=n._removeReaction(e.emoji,t);return r&&this.client.emit(s.Events.MESSAGE_REACTION_REMOVE,r,t),{message:n,reaction:r,user:t}}}e.exports=r},function(e,t,i){const n=i(2),s=i(0);class r extends n{handle(e){const t=this.client.channels.get(e.channel_id);if(!t||"voice"===t.type)return!1;const i=t.messages.get(e.message_id);return!!i&&(i._clearReactions(),this.client.emit(s.Events.MESSAGE_REACTION_REMOVE_ALL,i),{message:i})}}e.exports=r},function(e,t,i){const n=i(2);class s extends n{handle(e){return{channel:this.client.dataManager.newChannel(e)}}}e.exports=s},function(e,t,i){const n=i(2);class s extends n{constructor(e){super(e),this.deleted=new Map}handle(e){const t=this.client;let i=t.channels.get(e.id);return i?(t.dataManager.killChannel(i),this.deleted.set(i.id,i),this.scheduleForDeletion(i.id)):i=this.deleted.get(e.id)||null,{channel:i}}scheduleForDeletion(e){this.client.setTimeout(()=>this.deleted.delete(e),this.client.options.restWsBridgeTimeout)}}e.exports=s},function(e,t,i){const n=i(2),s=i(0),r=i(4);class o extends n{handle(e){const t=this.client,i=t.channels.get(e.id);if(i){const n=r.cloneObject(i);return i.setup(e),t.emit(s.Events.CHANNEL_UPDATE,n,i),{old:n,updated:i}}return{old:null,updated:null}}}e.exports=o},function(e,t,i){const n=i(2),s=i(0);class r extends n{constructor(e){super(e),this.deleted=new Map}handle(e){const t=this.client;let i=t.guilds.get(e.id);if(i){for(const e of i.channels.values())"text"===e.type&&e.stopTyping(!0);if(i.available&&e.unavailable)return i.available=!1,t.emit(s.Events.GUILD_UNAVAILABLE,i),{guild:null};t.guilds.delete(i.id),this.deleted.set(i.id,i),this.scheduleForDeletion(i.id)}else i=this.deleted.get(e.id)||null;return{guild:i}}scheduleForDeletion(e){this.client.setTimeout(()=>this.deleted.delete(e),this.client.options.restWsBridgeTimeout)}}e.exports=r},function(e,t,i){const n=i(2),s=i(0),r=i(4);class o extends n{handle(e){const t=this.client,i=t.guilds.get(e.id);if(i){const n=r.cloneObject(i);return i.setup(e),t.emit(s.Events.GUILD_UPDATE,n,i),{old:n,updated:i}}return{old:null,updated:null}}}e.exports=o},function(e,t,i){const n=i(2);class s extends n{handle(e,t){return{member:e._addMember(t,!1)}}}e.exports=s},function(e,t,i){const n=i(2),s=i(0);class r extends n{constructor(e){super(e),this.deleted=new Map}handle(e){const t=this.client,i=t.guilds.get(e.guild_id);let n=null;return i&&((n=i.members.get(e.user.id))?(i.memberCount--,i._removeMember(n),this.deleted.set(i.id+e.user.id,n),t.status===s.Status.READY&&t.emit(s.Events.GUILD_MEMBER_REMOVE,n),this.scheduleForDeletion(i.id,e.user.id)):n=this.deleted.get(i.id+e.user.id)||null),{guild:i,member:n}}scheduleForDeletion(e,t){this.client.setTimeout(()=>this.deleted.delete(e+t),this.client.options.restWsBridgeTimeout)}}e.exports=r},function(e,t,i){const n=i(2),s=i(0);class r extends n{handle(e){const t=this.client,i=t.guilds.get(e.guild_id),n=t.dataManager.newUser(e.user);i&&n&&t.emit(s.Events.GUILD_BAN_REMOVE,i,n)}}e.exports=r},function(e,t,i){const n=i(2),s=i(0),r=i(15);class o extends n{handle(e){const t=this.client,i=t.guilds.get(e.guild_id);let n;if(i){const o=i.roles.has(e.role.id);n=new r(i,e.role),i.roles.set(n.id,n),o||t.emit(s.Events.GUILD_ROLE_CREATE,n)}return{role:n}}}e.exports=o},function(e,t,i){const n=i(2),s=i(0);class r extends n{constructor(e){super(e),this.deleted=new Map}handle(e){const t=this.client,i=t.guilds.get(e.guild_id);let n;return i&&((n=i.roles.get(e.role_id))?(i.roles.delete(e.role_id),this.deleted.set(i.id+e.role_id,n),this.scheduleForDeletion(i.id,e.role_id),t.emit(s.Events.GUILD_ROLE_DELETE,n)):n=this.deleted.get(i.id+e.role_id)||null),{role:n}}scheduleForDeletion(e,t){this.client.setTimeout(()=>this.deleted.delete(e+t),this.client.options.restWsBridgeTimeout)}}e.exports=r},function(e,t,i){const n=i(2),s=i(0),r=i(4);class o extends n{handle(e){const t=this.client,i=t.guilds.get(e.guild_id);if(i){const n=e.role;let o=null;const a=i.roles.get(n.id);return a&&(o=r.cloneObject(a),a.setup(e.role),t.emit(s.Events.GUILD_ROLE_UPDATE,o,a)),{old:o,updated:a}}return{old:null,updated:null}}}e.exports=o},function(e,t,i){const n=i(2);class s extends n{handle(e){return{user:this.client.dataManager.newUser(e)}}}e.exports=s},function(e,t,i){const n=i(2),s=i(0),r=i(4);class o extends n{handle(e){const t=this.client;if(t.user){if(t.user.equals(e))return{old:t.user,updated:t.user};const i=r.cloneObject(t.user);return t.user.patch(e),t.emit(s.Events.USER_UPDATE,i,t.user),{old:i,updated:t.user}}return{old:null,updated:null}}}e.exports=o},function(e,t,i){const n=i(2),s=i(0);class r extends n{handle(e){const t=this.client,i=t.user.notes.get(e.id),n=e.note.length?e.note:null;return t.user.notes.set(e.id,n),t.emit(s.Events.USER_NOTE_UPDATE,e.id,i,n),{old:i,updated:n}}}e.exports=r},function(e,t,i){const n=i(2);class s extends n{handle(e){const t=this.client.guilds.get(e.id);if(t){if(e.presences)for(const i of e.presences)t._setPresence(i.user.id,i);if(e.members)for(const i of e.members){const e=t.members.get(i.user.id);e?t._updateMember(e,i):t._addMember(i,!1)}"large"in e&&(t.large=e.large)}}}e.exports=s},function(e,t,i){const n=i(2);class s extends n{handle(e,t){return{emoji:this.client.dataManager.newEmoji(t,e)}}}e.exports=s},function(e,t,i){const n=i(2);class s extends n{handle(e){return this.client.dataManager.killEmoji(e),{emoji:e}}}e.exports=s},function(e,t,i){const n=i(2);class s extends n{handle(e,t){return{emoji:this.client.dataManager.updateEmoji(e,t)}}}e.exports=s},function(e,t,i){function n(e){const t=new Map;for(const i of e)t.set(...i);return t}const s=i(2);class r extends s{handle(e){const t=this.client.guilds.get(e.guild_id);if(!t||!t.emojis)return;const i=n(t.emojis.entries());for(const n of e.emojis){const e=t.emojis.get(n.id);e?(i.delete(n.id),e.equals(n,!0)||this.client.actions.GuildEmojiUpdate.handle(e,n)):this.client.actions.GuildEmojiCreate.handle(t,n)}for(const e of i.values())this.client.actions.GuildEmojiDelete.handle(e)}}e.exports=r},function(e,t,i){const n=i(2);class s extends n{handle(e){const t=this.client.guilds.get(e.guild_id);if(t)for(const i of e.roles){const e=t.roles.get(i.id);e&&(e.position=i.position)}return{guild:t}}}e.exports=s},function(e,t,i){const n=i(2);class s extends n{handle(e){const t=this.client.guilds.get(e.guild_id);if(t)for(const i of e.channels){const e=t.channels.get(i.id);e&&(e.position=i.position)}return{guild:t}}}e.exports=s},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t,i){const n=i(41),s=i(56),r=i(38),o=i(0),a=i(4);class c extends n{constructor(e,t,i){super(null,e,t),this.options=a.mergeDefault(o.DefaultOptions,i),this.rest=new s(this),this.resolver=new r(this),this._timeouts=new Set,this._intervals=new Set}setTimeout(e,t,...i){const n=setTimeout(()=>{e(...i),this._timeouts.delete(n)},t);return this._timeouts.add(n),n}clearTimeout(e){clearTimeout(e),this._timeouts.delete(e)}setInterval(e,t,...i){const n=setInterval(e,t,...i);return this._intervals.add(n),n}clearInterval(e){clearInterval(e),this._intervals.delete(e)}destroy(){for(const e of this._timeouts)clearTimeout(e);for(const e of this._intervals)clearInterval(e);this._timeouts.clear(),this._intervals.clear()}}e.exports=c}]); \ No newline at end of file