From 2e6122869ca86345de82a8fab5161f8c443e8f36 Mon Sep 17 00:00:00 2001 From: Travis CI Date: Mon, 25 Sep 2017 18:49:25 +0000 Subject: [PATCH] Webpack build for branch master: 4d4d2f2db76d6f9ded2b4a8b6f61951b9721f160 --- discord.master.js | 355 ++++++++++++++++++++++-------------------- discord.master.min.js | 2 +- 2 files changed, 183 insertions(+), 174 deletions(-) diff --git a/discord.master.js b/discord.master.js index 281ddab0..73596073 100644 --- a/discord.master.js +++ b/discord.master.js @@ -2165,7 +2165,7 @@ class Channel extends Base { const GroupDMChannel = __webpack_require__(51); const TextChannel = __webpack_require__(52); const VoiceChannel = __webpack_require__(54); - const CategoryChannel = __webpack_require__(93); + const CategoryChannel = __webpack_require__(94); const GuildChannel = __webpack_require__(15); let channel; if (data.type === ChannelTypes.DM) { @@ -6878,7 +6878,7 @@ function isUndefined(arg) { const TextBasedChannel = __webpack_require__(19); const { Presence } = __webpack_require__(13); -const UserProfile = __webpack_require__(98); +const UserProfile = __webpack_require__(99); const Snowflake = __webpack_require__(6); const Base = __webpack_require__(7); const { Error } = __webpack_require__(4); @@ -7802,10 +7802,10 @@ const DataResolver = __webpack_require__(10); const Snowflake = __webpack_require__(6); const Permissions = __webpack_require__(9); const Shared = __webpack_require__(45); -const GuildMemberStore = __webpack_require__(94); -const RoleStore = __webpack_require__(95); +const GuildMemberStore = __webpack_require__(95); +const RoleStore = __webpack_require__(96); const EmojiStore = __webpack_require__(57); -const GuildChannelStore = __webpack_require__(96); +const GuildChannelStore = __webpack_require__(97); const PresenceStore = __webpack_require__(58); const Base = __webpack_require__(7); const { Error, TypeError } = __webpack_require__(4); @@ -11393,7 +11393,7 @@ const ReactionCollector = __webpack_require__(48); const ClientApplication = __webpack_require__(36); const Util = __webpack_require__(5); const Collection = __webpack_require__(3); -const ReactionStore = __webpack_require__(92); +const ReactionStore = __webpack_require__(93); const { MessageTypes } = __webpack_require__(0); const Permissions = __webpack_require__(9); const GuildMember = __webpack_require__(12); @@ -12475,7 +12475,7 @@ module.exports = ReactionEmoji; /* 39 */ /***/ (function(module, exports) { -module.exports = {"name":"discord.js","version":"12.0.0-dev","description":"A powerful library for interacting with the Discord API","main":"./src/index","types":"./typings/index.d.ts","scripts":{"test":"npm run lint && npm run docs:test","docs":"docgen --source src --custom docs/index.yml --output docs/docs.json --jsdoc jsdoc.json","docs:test":"docgen --source src --custom docs/index.yml --jsdoc jsdoc.json","lint":"eslint src *.js","lint:fix":"eslint --fix src","webpack":"parallel-webpack"},"repository":{"type":"git","url":"git+https://github.com/hydrabolt/discord.js.git"},"keywords":["discord","api","bot","client","node","discordapp"],"author":"Amish Shah ","license":"Apache-2.0","bugs":{"url":"https://github.com/hydrabolt/discord.js/issues"},"homepage":"https://github.com/hydrabolt/discord.js#readme","runkitExampleFilename":"./docs/examples/ping.js","dependencies":{"long":"^3.0.0","prism-media":"^0.0.1","snekfetch":"^3.0.0","tweetnacl":"^1.0.0","ws":"^3.0.0"},"peerDependencies":{"bufferutil":"^3.0.0","erlpack":"discordapp/erlpack","node-opus":"^0.2.0","opusscript":"^0.0.3","sodium":"^2.0.0","libsodium-wrappers":"^0.5.0","uws":"^8.14.0"},"devDependencies":{"@types/node":"^8.0.0","discord.js-docgen":"hydrabolt/discord.js-docgen","eslint":"^4.0.0","jsdoc-strip-async-await":"^0.1.0","parallel-webpack":"^2.0.0","uglifyjs-webpack-plugin":"^1.0.0-beta.2","webpack":"^3.0.0"},"engines":{"node":">=8.0.0"},"browser":{"ws":false,"uws":false,"erlpack":false,"prism-media":false,"opusscript":false,"node-opus":false,"tweetnacl":false,"sodium":false,"src/sharding/Shard.js":false,"src/sharding/ShardClientUtil.js":false,"src/sharding/ShardingManager.js":false,"src/client/voice/dispatcher/StreamDispatcher.js":false,"src/client/voice/opus/BaseOpusEngine.js":false,"src/client/voice/opus/NodeOpusEngine.js":false,"src/client/voice/opus/OpusEngineList.js":false,"src/client/voice/opus/OpusScriptEngine.js":false,"src/client/voice/pcm/ConverterEngine.js":false,"src/client/voice/pcm/ConverterEngineList.js":false,"src/client/voice/pcm/FfmpegConverterEngine.js":false,"src/client/voice/player/AudioPlayer.js":false,"src/client/voice/receiver/VoiceReadable.js":false,"src/client/voice/receiver/VoiceReceiver.js":false,"src/client/voice/util/Secretbox.js":false,"src/client/voice/util/SecretKey.js":false,"src/client/voice/util/VolumeInterface.js":false,"src/client/voice/ClientVoiceManager.js":false,"src/client/voice/VoiceBroadcast.js":false,"src/client/voice/VoiceConnection.js":false,"src/client/voice/VoiceUDPClient.js":false,"src/client/voice/VoiceWebSocket.js":false}} +module.exports = {"name":"discord.js","version":"12.0.0-dev","description":"A powerful library for interacting with the Discord API","main":"./src/index","types":"./typings/index.d.ts","scripts":{"test":"npm run lint && npm run docs:test","docs":"docgen --source src --custom docs/index.yml --output docs/docs.json --jsdoc jsdoc.json","docs:test":"docgen --source src --custom docs/index.yml --jsdoc jsdoc.json","lint":"eslint src *.js","lint:fix":"eslint --fix src","webpack":"parallel-webpack"},"repository":{"type":"git","url":"git+https://github.com/hydrabolt/discord.js.git"},"keywords":["discord","api","bot","client","node","discordapp"],"author":"Amish Shah ","license":"Apache-2.0","bugs":{"url":"https://github.com/hydrabolt/discord.js/issues"},"homepage":"https://github.com/hydrabolt/discord.js#readme","runkitExampleFilename":"./docs/examples/ping.js","dependencies":{"long":"^3.0.0","prism-media":"^0.0.1","snekfetch":"^3.0.0","tweetnacl":"^1.0.0","ws":"^3.0.0"},"peerDependencies":{"bufferutil":"^3.0.0","erlpack":"discordapp/erlpack","node-opus":"^0.2.0","opusscript":"^0.0.3","sodium":"^2.0.0","libsodium-wrappers":"^0.5.0","uws":"^8.14.0"},"devDependencies":{"@types/node":"^8.0.0","discord.js-docgen":"hydrabolt/discord.js-docgen","eslint":"^4.0.0","jsdoc-strip-async-await":"^0.1.0","parallel-webpack":"^2.0.0","uglifyjs-webpack-plugin":"^1.0.0-beta.2","webpack":"^3.0.0"},"engines":{"node":">=8.0.0"},"browser":{"https":false,"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}} /***/ }), /* 40 */ @@ -12555,7 +12555,7 @@ module.exports = { const UserAgentManager = __webpack_require__(77); const handlers = __webpack_require__(78); const APIRequest = __webpack_require__(82); -const routeBuilder = __webpack_require__(83); +const routeBuilder = __webpack_require__(84); const { Error } = __webpack_require__(4); const { Endpoints } = __webpack_require__(0); @@ -13121,8 +13121,8 @@ module.exports = MessageCollector; /***/ (function(module, exports, __webpack_require__) { module.exports = { - search: __webpack_require__(91), - sendMessage: __webpack_require__(97), + search: __webpack_require__(92), + sendMessage: __webpack_require__(98), }; @@ -14775,7 +14775,7 @@ module.exports = ClientUserSettings; const { UserGuildSettingsMap } = __webpack_require__(0); const Collection = __webpack_require__(3); -const ClientUserChannelOverride = __webpack_require__(100); +const ClientUserChannelOverride = __webpack_require__(101); /** * A wrapper around the ClientUser's guild settings. @@ -14847,14 +14847,14 @@ if (browser) { exports.WebSocket = window.WebSocket; // eslint-disable-line no-undef } else { try { - exports.WebSocket = __webpack_require__(137); - } catch (err) { exports.WebSocket = __webpack_require__(138); + } catch (err) { + exports.WebSocket = __webpack_require__(139); } } try { - var erlpack = __webpack_require__(139); + var erlpack = __webpack_require__(140); if (!erlpack.pack) erlpack = null; } catch (err) {} // eslint-disable-line no-empty @@ -14891,11 +14891,11 @@ const Util = __webpack_require__(5); module.exports = { // "Root" classes (starting points) BaseClient: __webpack_require__(32), - Client: __webpack_require__(84), - Shard: __webpack_require__(175), - ShardClientUtil: __webpack_require__(176), - ShardingManager: __webpack_require__(177), - WebhookClient: __webpack_require__(178), + Client: __webpack_require__(85), + Shard: __webpack_require__(176), + ShardClientUtil: __webpack_require__(177), + ShardingManager: __webpack_require__(178), + WebhookClient: __webpack_require__(179), // Utilities Collection: __webpack_require__(3), @@ -16528,6 +16528,9 @@ module.exports = RequestHandler; const querystring = __webpack_require__(30); const snekfetch = __webpack_require__(29); +const https = __webpack_require__(83); + +if (https.Agent) var agent = new https.Agent({ keepAlive: true }); class APIRequest { constructor(rest, method, path, options) { @@ -16548,7 +16551,7 @@ class APIRequest { this.path += `?${queryString}`; } - const request = snekfetch[this.method](`${API}${this.path}`); + const request = snekfetch[this.method](`${API}${this.path}`, { agent }); if (this.options.auth !== false) request.set('Authorization', this.rest.getAuth()); if (this.options.reason) request.set('X-Audit-Log-Reason', encodeURIComponent(this.options.reason)); @@ -16570,6 +16573,12 @@ module.exports = APIRequest; /***/ }), /* 83 */ +/***/ (function(module, exports) { + +/* (ignored) */ + +/***/ }), +/* 84 */ /***/ (function(module, exports, __webpack_require__) { const util = __webpack_require__(31); @@ -16610,27 +16619,27 @@ module.exports = buildRoute; /***/ }), -/* 84 */ +/* 85 */ /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(process) {const BaseClient = __webpack_require__(32); const Permissions = __webpack_require__(9); const RESTManager = __webpack_require__(41); -const ClientManager = __webpack_require__(85); -const ClientVoiceManager = __webpack_require__(86); -const WebSocketManager = __webpack_require__(87); -const ActionsManager = __webpack_require__(140); +const ClientManager = __webpack_require__(86); +const ClientVoiceManager = __webpack_require__(87); +const WebSocketManager = __webpack_require__(88); +const ActionsManager = __webpack_require__(141); const Collection = __webpack_require__(3); const VoiceRegion = __webpack_require__(56); const Webhook = __webpack_require__(16); const Invite = __webpack_require__(25); const ClientApplication = __webpack_require__(36); -const ShardClientUtil = __webpack_require__(169); -const VoiceBroadcast = __webpack_require__(170); -const UserStore = __webpack_require__(171); -const ChannelStore = __webpack_require__(172); -const GuildStore = __webpack_require__(173); -const ClientPresenceStore = __webpack_require__(174); +const ShardClientUtil = __webpack_require__(170); +const VoiceBroadcast = __webpack_require__(171); +const UserStore = __webpack_require__(172); +const ChannelStore = __webpack_require__(173); +const GuildStore = __webpack_require__(174); +const ClientPresenceStore = __webpack_require__(175); const EmojiStore = __webpack_require__(57); const { Events } = __webpack_require__(0); const DataResolver = __webpack_require__(10); @@ -17090,7 +17099,7 @@ module.exports = Client; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(18))) /***/ }), -/* 85 */ +/* 86 */ /***/ (function(module, exports, __webpack_require__) { const { Events, Status } = __webpack_require__(0); @@ -17169,18 +17178,18 @@ module.exports = ClientManager; /***/ }), -/* 86 */ +/* 87 */ /***/ (function(module, exports) { /* (ignored) */ /***/ }), -/* 87 */ +/* 88 */ /***/ (function(module, exports, __webpack_require__) { const EventEmitter = __webpack_require__(21); const { Events, Status } = __webpack_require__(0); -const WebSocketConnection = __webpack_require__(88); +const WebSocketConnection = __webpack_require__(89); /** * WebSocket Manager of the client. @@ -17271,12 +17280,12 @@ module.exports = WebSocketManager; /***/ }), -/* 88 */ +/* 89 */ /***/ (function(module, exports, __webpack_require__) { const EventEmitter = __webpack_require__(21); const { DefaultOptions, Events, OPCodes, Status, WSCodes } = __webpack_require__(0); -const PacketManager = __webpack_require__(89); +const PacketManager = __webpack_require__(90); const WebSocket = __webpack_require__(61); /** @@ -17733,7 +17742,7 @@ module.exports = WebSocketConnection; /***/ }), -/* 89 */ +/* 90 */ /***/ (function(module, exports, __webpack_require__) { const { OPCodes, Status, WSEvents } = __webpack_require__(0); @@ -17754,43 +17763,43 @@ class WebSocketPacketManager { this.handlers = {}; this.queue = []; - this.register(WSEvents.READY, __webpack_require__(90)); - this.register(WSEvents.RESUMED, __webpack_require__(101)); - this.register(WSEvents.GUILD_CREATE, __webpack_require__(102)); - this.register(WSEvents.GUILD_DELETE, __webpack_require__(103)); - this.register(WSEvents.GUILD_UPDATE, __webpack_require__(104)); - this.register(WSEvents.GUILD_BAN_ADD, __webpack_require__(105)); - this.register(WSEvents.GUILD_BAN_REMOVE, __webpack_require__(106)); - this.register(WSEvents.GUILD_MEMBER_ADD, __webpack_require__(107)); - this.register(WSEvents.GUILD_MEMBER_REMOVE, __webpack_require__(108)); - this.register(WSEvents.GUILD_MEMBER_UPDATE, __webpack_require__(109)); - this.register(WSEvents.GUILD_ROLE_CREATE, __webpack_require__(110)); - this.register(WSEvents.GUILD_ROLE_DELETE, __webpack_require__(111)); - this.register(WSEvents.GUILD_ROLE_UPDATE, __webpack_require__(112)); - this.register(WSEvents.GUILD_EMOJIS_UPDATE, __webpack_require__(113)); - this.register(WSEvents.GUILD_MEMBERS_CHUNK, __webpack_require__(114)); - this.register(WSEvents.CHANNEL_CREATE, __webpack_require__(115)); - this.register(WSEvents.CHANNEL_DELETE, __webpack_require__(116)); - this.register(WSEvents.CHANNEL_UPDATE, __webpack_require__(117)); - this.register(WSEvents.CHANNEL_PINS_UPDATE, __webpack_require__(118)); - this.register(WSEvents.PRESENCE_UPDATE, __webpack_require__(119)); - this.register(WSEvents.USER_UPDATE, __webpack_require__(120)); - this.register(WSEvents.USER_NOTE_UPDATE, __webpack_require__(121)); - this.register(WSEvents.USER_SETTINGS_UPDATE, __webpack_require__(122)); - this.register(WSEvents.USER_GUILD_SETTINGS_UPDATE, __webpack_require__(123)); - this.register(WSEvents.VOICE_STATE_UPDATE, __webpack_require__(124)); - this.register(WSEvents.TYPING_START, __webpack_require__(125)); - this.register(WSEvents.MESSAGE_CREATE, __webpack_require__(126)); - this.register(WSEvents.MESSAGE_DELETE, __webpack_require__(127)); - this.register(WSEvents.MESSAGE_UPDATE, __webpack_require__(128)); - this.register(WSEvents.MESSAGE_DELETE_BULK, __webpack_require__(129)); - this.register(WSEvents.VOICE_SERVER_UPDATE, __webpack_require__(130)); - this.register(WSEvents.GUILD_SYNC, __webpack_require__(131)); - this.register(WSEvents.RELATIONSHIP_ADD, __webpack_require__(132)); - this.register(WSEvents.RELATIONSHIP_REMOVE, __webpack_require__(133)); - this.register(WSEvents.MESSAGE_REACTION_ADD, __webpack_require__(134)); - this.register(WSEvents.MESSAGE_REACTION_REMOVE, __webpack_require__(135)); - this.register(WSEvents.MESSAGE_REACTION_REMOVE_ALL, __webpack_require__(136)); + this.register(WSEvents.READY, __webpack_require__(91)); + this.register(WSEvents.RESUMED, __webpack_require__(102)); + this.register(WSEvents.GUILD_CREATE, __webpack_require__(103)); + this.register(WSEvents.GUILD_DELETE, __webpack_require__(104)); + this.register(WSEvents.GUILD_UPDATE, __webpack_require__(105)); + this.register(WSEvents.GUILD_BAN_ADD, __webpack_require__(106)); + this.register(WSEvents.GUILD_BAN_REMOVE, __webpack_require__(107)); + this.register(WSEvents.GUILD_MEMBER_ADD, __webpack_require__(108)); + this.register(WSEvents.GUILD_MEMBER_REMOVE, __webpack_require__(109)); + this.register(WSEvents.GUILD_MEMBER_UPDATE, __webpack_require__(110)); + this.register(WSEvents.GUILD_ROLE_CREATE, __webpack_require__(111)); + this.register(WSEvents.GUILD_ROLE_DELETE, __webpack_require__(112)); + this.register(WSEvents.GUILD_ROLE_UPDATE, __webpack_require__(113)); + this.register(WSEvents.GUILD_EMOJIS_UPDATE, __webpack_require__(114)); + this.register(WSEvents.GUILD_MEMBERS_CHUNK, __webpack_require__(115)); + this.register(WSEvents.CHANNEL_CREATE, __webpack_require__(116)); + this.register(WSEvents.CHANNEL_DELETE, __webpack_require__(117)); + this.register(WSEvents.CHANNEL_UPDATE, __webpack_require__(118)); + this.register(WSEvents.CHANNEL_PINS_UPDATE, __webpack_require__(119)); + this.register(WSEvents.PRESENCE_UPDATE, __webpack_require__(120)); + this.register(WSEvents.USER_UPDATE, __webpack_require__(121)); + this.register(WSEvents.USER_NOTE_UPDATE, __webpack_require__(122)); + this.register(WSEvents.USER_SETTINGS_UPDATE, __webpack_require__(123)); + this.register(WSEvents.USER_GUILD_SETTINGS_UPDATE, __webpack_require__(124)); + this.register(WSEvents.VOICE_STATE_UPDATE, __webpack_require__(125)); + this.register(WSEvents.TYPING_START, __webpack_require__(126)); + this.register(WSEvents.MESSAGE_CREATE, __webpack_require__(127)); + this.register(WSEvents.MESSAGE_DELETE, __webpack_require__(128)); + this.register(WSEvents.MESSAGE_UPDATE, __webpack_require__(129)); + this.register(WSEvents.MESSAGE_DELETE_BULK, __webpack_require__(130)); + this.register(WSEvents.VOICE_SERVER_UPDATE, __webpack_require__(131)); + this.register(WSEvents.GUILD_SYNC, __webpack_require__(132)); + this.register(WSEvents.RELATIONSHIP_ADD, __webpack_require__(133)); + this.register(WSEvents.RELATIONSHIP_REMOVE, __webpack_require__(134)); + this.register(WSEvents.MESSAGE_REACTION_ADD, __webpack_require__(135)); + this.register(WSEvents.MESSAGE_REACTION_REMOVE, __webpack_require__(136)); + this.register(WSEvents.MESSAGE_REACTION_REMOVE_ALL, __webpack_require__(137)); } get client() { @@ -17847,7 +17856,7 @@ module.exports = WebSocketPacketManager; /***/ }), -/* 90 */ +/* 91 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -17930,7 +17939,7 @@ module.exports = ReadyHandler; /***/ }), -/* 91 */ +/* 92 */ /***/ (function(module, exports, __webpack_require__) { const long = __webpack_require__(28); @@ -18036,7 +18045,7 @@ module.exports = function search(target, options) { /***/ }), -/* 92 */ +/* 93 */ /***/ (function(module, exports, __webpack_require__) { const DataStore = __webpack_require__(8); @@ -18087,7 +18096,7 @@ module.exports = ReactionStore; /***/ }), -/* 93 */ +/* 94 */ /***/ (function(module, exports, __webpack_require__) { const GuildChannel = __webpack_require__(15); @@ -18111,7 +18120,7 @@ module.exports = CategoryChannel; /***/ }), -/* 94 */ +/* 95 */ /***/ (function(module, exports, __webpack_require__) { const DataStore = __webpack_require__(8); @@ -18262,7 +18271,7 @@ module.exports = GuildMemberStore; /***/ }), -/* 95 */ +/* 96 */ /***/ (function(module, exports, __webpack_require__) { const DataStore = __webpack_require__(8); @@ -18313,7 +18322,7 @@ module.exports = RoleStore; /***/ }), -/* 96 */ +/* 97 */ /***/ (function(module, exports, __webpack_require__) { const DataStore = __webpack_require__(8); @@ -18368,7 +18377,7 @@ module.exports = GuildChannelStore; /***/ }), -/* 97 */ +/* 98 */ /***/ (function(module, exports, __webpack_require__) { const Util = __webpack_require__(5); @@ -18439,12 +18448,12 @@ module.exports = function sendMessage(channel, options) { // eslint-disable-line /***/ }), -/* 98 */ +/* 99 */ /***/ (function(module, exports, __webpack_require__) { const Collection = __webpack_require__(3); const { UserFlags } = __webpack_require__(0); -const UserConnection = __webpack_require__(99); +const UserConnection = __webpack_require__(100); const Base = __webpack_require__(7); /** @@ -18524,7 +18533,7 @@ module.exports = UserProfile; /***/ }), -/* 99 */ +/* 100 */ /***/ (function(module, exports) { /** @@ -18578,7 +18587,7 @@ module.exports = UserConnection; /***/ }), -/* 100 */ +/* 101 */ /***/ (function(module, exports, __webpack_require__) { const { UserChannelOverrideMap } = __webpack_require__(0); @@ -18612,7 +18621,7 @@ module.exports = ClientUserChannelOverride; /***/ }), -/* 101 */ +/* 102 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -18646,7 +18655,7 @@ module.exports = ResumedHandler; /***/ }), -/* 102 */ +/* 103 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -18685,7 +18694,7 @@ module.exports = GuildCreateHandler; /***/ }), -/* 103 */ +/* 104 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -18707,7 +18716,7 @@ module.exports = GuildDeleteHandler; /***/ }), -/* 104 */ +/* 105 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -18724,7 +18733,7 @@ module.exports = GuildUpdateHandler; /***/ }), -/* 105 */ +/* 106 */ /***/ (function(module, exports, __webpack_require__) { // ##untested handler## @@ -18753,7 +18762,7 @@ module.exports = GuildBanAddHandler; /***/ }), -/* 106 */ +/* 107 */ /***/ (function(module, exports, __webpack_require__) { // ##untested handler## @@ -18779,7 +18788,7 @@ module.exports = GuildBanRemoveHandler; /***/ }), -/* 107 */ +/* 108 */ /***/ (function(module, exports, __webpack_require__) { // ##untested handler## @@ -18812,7 +18821,7 @@ module.exports = GuildMemberAddHandler; /***/ }), -/* 108 */ +/* 109 */ /***/ (function(module, exports, __webpack_require__) { // ##untested handler## @@ -18831,7 +18840,7 @@ module.exports = GuildMemberRemoveHandler; /***/ }), -/* 109 */ +/* 110 */ /***/ (function(module, exports, __webpack_require__) { // ##untested handler## @@ -18866,7 +18875,7 @@ module.exports = GuildMemberUpdateHandler; /***/ }), -/* 110 */ +/* 111 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -18883,7 +18892,7 @@ module.exports = GuildRoleCreateHandler; /***/ }), -/* 111 */ +/* 112 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -18900,7 +18909,7 @@ module.exports = GuildRoleDeleteHandler; /***/ }), -/* 112 */ +/* 113 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -18917,7 +18926,7 @@ module.exports = GuildRoleUpdateHandler; /***/ }), -/* 113 */ +/* 114 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -18934,7 +18943,7 @@ module.exports = GuildEmojisUpdate; /***/ }), -/* 114 */ +/* 115 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -18968,7 +18977,7 @@ module.exports = GuildMembersChunkHandler; /***/ }), -/* 115 */ +/* 116 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -18989,7 +18998,7 @@ module.exports = ChannelCreateHandler; /***/ }), -/* 116 */ +/* 117 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -19004,7 +19013,7 @@ module.exports = ChannelDeleteHandler; /***/ }), -/* 117 */ +/* 118 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -19030,7 +19039,7 @@ module.exports = ChannelUpdateHandler; /***/ }), -/* 118 */ +/* 119 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -19067,7 +19076,7 @@ module.exports = ChannelPinsUpdate; /***/ }), -/* 119 */ +/* 120 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -19147,7 +19156,7 @@ module.exports = PresenceUpdateHandler; /***/ }), -/* 120 */ +/* 121 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -19164,7 +19173,7 @@ module.exports = UserUpdateHandler; /***/ }), -/* 121 */ +/* 122 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -19182,7 +19191,7 @@ module.exports = UserNoteUpdateHandler; /***/ }), -/* 122 */ +/* 123 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -19206,7 +19215,7 @@ module.exports = UserSettingsUpdateHandler; /***/ }), -/* 123 */ +/* 124 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -19233,7 +19242,7 @@ module.exports = UserGuildSettingsUpdateHandler; /***/ }), -/* 124 */ +/* 125 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -19275,7 +19284,7 @@ module.exports = VoiceStateUpdateHandler; /***/ }), -/* 125 */ +/* 126 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -19349,7 +19358,7 @@ module.exports = TypingStartHandler; /***/ }), -/* 126 */ +/* 127 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -19364,7 +19373,7 @@ module.exports = MessageCreateHandler; /***/ }), -/* 127 */ +/* 128 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -19379,7 +19388,7 @@ module.exports = MessageDeleteHandler; /***/ }), -/* 128 */ +/* 129 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -19405,7 +19414,7 @@ module.exports = MessageUpdateHandler; /***/ }), -/* 129 */ +/* 130 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -19420,7 +19429,7 @@ module.exports = MessageDeleteBulkHandler; /***/ }), -/* 130 */ +/* 131 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -19445,7 +19454,7 @@ module.exports = VoiceServerUpdate; /***/ }), -/* 131 */ +/* 132 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -19462,7 +19471,7 @@ module.exports = GuildSyncHandler; /***/ }), -/* 132 */ +/* 133 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -19487,7 +19496,7 @@ module.exports = RelationshipAddHandler; /***/ }), -/* 133 */ +/* 134 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -19512,7 +19521,7 @@ module.exports = RelationshipRemoveHandler; /***/ }), -/* 134 */ +/* 135 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -19531,7 +19540,7 @@ module.exports = MessageReactionAddHandler; /***/ }), -/* 135 */ +/* 136 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -19548,7 +19557,7 @@ module.exports = MessageReactionRemove; /***/ }), -/* 136 */ +/* 137 */ /***/ (function(module, exports, __webpack_require__) { const AbstractHandler = __webpack_require__(1); @@ -19564,12 +19573,6 @@ class MessageReactionRemoveAll extends AbstractHandler { module.exports = MessageReactionRemoveAll; -/***/ }), -/* 137 */ -/***/ (function(module, exports) { - -/* (ignored) */ - /***/ }), /* 138 */ /***/ (function(module, exports) { @@ -19584,13 +19587,18 @@ module.exports = MessageReactionRemoveAll; /***/ }), /* 140 */ +/***/ (function(module, exports) { + +/* (ignored) */ + +/***/ }), +/* 141 */ /***/ (function(module, exports, __webpack_require__) { class ActionsManager { constructor(client) { this.client = client; - this.register(__webpack_require__(141)); this.register(__webpack_require__(142)); this.register(__webpack_require__(143)); this.register(__webpack_require__(144)); @@ -19618,6 +19626,7 @@ class ActionsManager { this.register(__webpack_require__(166)); this.register(__webpack_require__(167)); this.register(__webpack_require__(168)); + this.register(__webpack_require__(169)); } register(Action) { @@ -19629,7 +19638,7 @@ module.exports = ActionsManager; /***/ }), -/* 141 */ +/* 142 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -19674,7 +19683,7 @@ module.exports = MessageCreateAction; /***/ }), -/* 142 */ +/* 143 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -19708,7 +19717,7 @@ module.exports = MessageDeleteAction; /***/ }), -/* 143 */ +/* 144 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -19745,7 +19754,7 @@ module.exports = MessageDeleteBulkAction; /***/ }), -/* 144 */ +/* 145 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -19774,7 +19783,7 @@ module.exports = MessageUpdateAction; /***/ }), -/* 145 */ +/* 146 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -19819,7 +19828,7 @@ module.exports = MessageReactionAdd; /***/ }), -/* 146 */ +/* 147 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -19865,7 +19874,7 @@ module.exports = MessageReactionRemove; /***/ }), -/* 147 */ +/* 148 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -19896,7 +19905,7 @@ module.exports = MessageReactionRemoveAll; /***/ }), -/* 148 */ +/* 149 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -19918,7 +19927,7 @@ module.exports = ChannelCreateAction; /***/ }), -/* 149 */ +/* 150 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -19953,7 +19962,7 @@ module.exports = ChannelDeleteAction; /***/ }), -/* 150 */ +/* 151 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -19979,7 +19988,7 @@ module.exports = ChannelUpdateAction; /***/ }), -/* 151 */ +/* 152 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -20039,7 +20048,7 @@ module.exports = GuildDeleteAction; /***/ }), -/* 152 */ +/* 153 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -20077,7 +20086,7 @@ module.exports = GuildUpdateAction; /***/ }), -/* 153 */ +/* 154 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -20093,7 +20102,7 @@ module.exports = GuildMemberGetAction; /***/ }), -/* 154 */ +/* 155 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -20126,7 +20135,7 @@ module.exports = GuildMemberRemoveAction; /***/ }), -/* 155 */ +/* 156 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -20145,7 +20154,7 @@ module.exports = GuildBanRemove; /***/ }), -/* 156 */ +/* 157 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -20175,7 +20184,7 @@ module.exports = GuildRoleCreate; /***/ }), -/* 157 */ +/* 158 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -20209,7 +20218,7 @@ module.exports = GuildRoleDeleteAction; /***/ }), -/* 158 */ +/* 159 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -20253,7 +20262,7 @@ module.exports = GuildRoleUpdateAction; /***/ }), -/* 159 */ +/* 160 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -20270,7 +20279,7 @@ module.exports = UserGetAction; /***/ }), -/* 160 */ +/* 161 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -20307,7 +20316,7 @@ module.exports = UserUpdateAction; /***/ }), -/* 161 */ +/* 162 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -20343,7 +20352,7 @@ module.exports = UserNoteUpdateAction; /***/ }), -/* 162 */ +/* 163 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -20378,7 +20387,7 @@ module.exports = GuildSync; /***/ }), -/* 163 */ +/* 164 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -20402,7 +20411,7 @@ module.exports = GuildEmojiCreateAction; /***/ }), -/* 164 */ +/* 165 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -20426,7 +20435,7 @@ module.exports = GuildEmojiDeleteAction; /***/ }), -/* 165 */ +/* 166 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -20451,7 +20460,7 @@ module.exports = GuildEmojiUpdateAction; /***/ }), -/* 166 */ +/* 167 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -20495,7 +20504,7 @@ module.exports = GuildEmojisUpdateAction; /***/ }), -/* 167 */ +/* 168 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -20520,7 +20529,7 @@ module.exports = GuildRolesPositionUpdate; /***/ }), -/* 168 */ +/* 169 */ /***/ (function(module, exports, __webpack_require__) { const Action = __webpack_require__(2); @@ -20544,12 +20553,6 @@ class GuildChannelsPositionUpdate extends Action { module.exports = GuildChannelsPositionUpdate; -/***/ }), -/* 169 */ -/***/ (function(module, exports) { - -/* (ignored) */ - /***/ }), /* 170 */ /***/ (function(module, exports) { @@ -20558,6 +20561,12 @@ module.exports = GuildChannelsPositionUpdate; /***/ }), /* 171 */ +/***/ (function(module, exports) { + +/* (ignored) */ + +/***/ }), +/* 172 */ /***/ (function(module, exports, __webpack_require__) { const DataStore = __webpack_require__(8); @@ -20624,7 +20633,7 @@ module.exports = UserStore; /***/ }), -/* 172 */ +/* 173 */ /***/ (function(module, exports, __webpack_require__) { const DataStore = __webpack_require__(8); @@ -20732,7 +20741,7 @@ module.exports = ChannelStore; /***/ }), -/* 173 */ +/* 174 */ /***/ (function(module, exports, __webpack_require__) { const DataStore = __webpack_require__(8); @@ -20778,7 +20787,7 @@ module.exports = GuildStore; /***/ }), -/* 174 */ +/* 175 */ /***/ (function(module, exports, __webpack_require__) { const PresenceStore = __webpack_require__(58); @@ -20850,12 +20859,6 @@ class ClientPresenceStore extends PresenceStore { module.exports = ClientPresenceStore; -/***/ }), -/* 175 */ -/***/ (function(module, exports) { - -/* (ignored) */ - /***/ }), /* 176 */ /***/ (function(module, exports) { @@ -20870,6 +20873,12 @@ module.exports = ClientPresenceStore; /***/ }), /* 178 */ +/***/ (function(module, exports) { + +/* (ignored) */ + +/***/ }), +/* 179 */ /***/ (function(module, exports, __webpack_require__) { const Webhook = __webpack_require__(16); diff --git a/discord.master.min.js b/discord.master.min.js index 3637d3b6..c6951e7e 100644 --- a/discord.master.min.js +++ b/discord.master.min.js @@ -1 +1 @@ -window.Discord=function(e){function t(i){if(s[i])return s[i].exports;var n=s[i]={i:i,l:!1,exports:{}};return e[i].call(n.exports,n,n.exports,t),n.l=!0,n.exports}var s={};return t.m=e,t.c=s,t.d=function(e,s,i){t.o(e,s)||Object.defineProperty(e,s,{configurable:!1,enumerable:!0,get:i})},t.n=function(e){var s=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(s,"a",s),s},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=62)}([function(e,t,s){(function(e){function i(e,{format:t="webp",size:s}={}){if(t&&!o.includes(t))throw new n("IMAGE_FORMAT",t);if(s&&!a.includes(s))throw new r("IMAGE_SIZE",s);return`${e}.${t}${s?`?size=${s}`:""}`}t.Package=s(39);const{Error:n,RangeError:r}=s(4);t.DefaultOptions={apiRequestMethod:"sequential",shardId:0,shardCount:0,internalSharding:!1,messageCacheMaxSize:200,messageCacheLifetime:0,messageSweepInterval:0,fetchAllMembers:!1,disableEveryone:!1,sync:!1,restWsBridgeTimeout:5e3,disabledEvents:[],restTimeOffset:500,ws:{large_threshold:250,compress:"browser"!==s(76).platform(),properties:{$os:e?e.platform:"discord.js",$browser:"discord.js",$device:"discord.js"},version:6},http:{version:7,api:"https://discordapp.com/api",cdn:"https://cdn.discordapp.com",invite:"https://discord.gg"}},t.WSCodes={1e3:"Connection gracefully closed",4004:"Tried to identify with an invalid token",4010:"Sharding data provided was invalid",4011:"Shard would be on too many guilds if connected"};const o=["webp","png","jpg","gif"],a=Array.from({length:8},(e,t)=>2**(t+4));t.Endpoints={CDN:e=>({Emoji:t=>`${e}/emojis/${t}.png`,Asset:t=>`${e}/assets/${t}`,DefaultAvatar:t=>`${e}/embed/avatars/${t}.png`,Avatar:(t,s,n="default",r)=>("default"===n&&(n=s.startsWith("a_")?"gif":"webp"),i(`${e}/avatars/${t}/${s}`,{format:n,size:r})),Icon:(t,s,n="webp",r)=>i(`${e}/icons/${t}/${s}`,{format:n,size:r}),AppIcon:(t,s,{format:n="webp",size:r}={})=>i(`${e}/app-icons/${t}/${s}`,{size:r,format:n}),AppAsset:(t,s,{format:n="webp",size:r}={})=>i(`${e}/app-assets/${t}/${s}`,{size:r,format:n}),GDMIcon:(t,s,n="webp",r)=>i(`${e}/channel-icons/${t}/${s}`,{size:r,format:n}),Splash:(t,s,n="webp",r)=>i(`${e}/splashes/${t}/${s}`,{size:r,format:n})}),invite:(e,t)=>`${e}/${t}`,botGateway:"/gateway/bot"},t.Status={READY:0,CONNECTING:1,RECONNECTING:2,IDLE:3,NEARLY:4,DISCONNECTED:5},t.VoiceStatus={CONNECTED:0,CONNECTING:1,AUTHENTICATING:2,RECONNECTING:3,DISCONNECTED:4},t.OPCodes={DISPATCH:0,HEARTBEAT:1,IDENTIFY:2,STATUS_UPDATE:3,VOICE_STATE_UPDATE:4,VOICE_GUILD_PING:5,RESUME:6,RECONNECT:7,REQUEST_GUILD_MEMBERS:8,INVALID_SESSION:9,HELLO:10,HEARTBEAT_ACK:11},t.VoiceOPCodes={IDENTIFY:0,SELECT_PROTOCOL:1,READY:2,HEARTBEAT:3,SESSION_DESCRIPTION:4,SPEAKING:5},t.Events={READY:"ready",RESUMED:"resumed",GUILD_CREATE:"guildCreate",GUILD_DELETE:"guildDelete",GUILD_UPDATE:"guildUpdate",GUILD_UNAVAILABLE:"guildUnavailable",GUILD_AVAILABLE:"guildAvailable",GUILD_MEMBER_ADD:"guildMemberAdd",GUILD_MEMBER_REMOVE:"guildMemberRemove",GUILD_MEMBER_UPDATE:"guildMemberUpdate",GUILD_MEMBER_AVAILABLE:"guildMemberAvailable",GUILD_MEMBER_SPEAKING:"guildMemberSpeaking",GUILD_MEMBERS_CHUNK:"guildMembersChunk",GUILD_ROLE_CREATE:"roleCreate",GUILD_ROLE_DELETE:"roleDelete",GUILD_ROLE_UPDATE:"roleUpdate",GUILD_EMOJI_CREATE:"emojiCreate",GUILD_EMOJI_DELETE:"emojiDelete",GUILD_EMOJI_UPDATE:"emojiUpdate",GUILD_BAN_ADD:"guildBanAdd",GUILD_BAN_REMOVE:"guildBanRemove",CHANNEL_CREATE:"channelCreate",CHANNEL_DELETE:"channelDelete",CHANNEL_UPDATE:"channelUpdate",CHANNEL_PINS_UPDATE:"channelPinsUpdate",MESSAGE_CREATE:"message",MESSAGE_DELETE:"messageDelete",MESSAGE_UPDATE:"messageUpdate",MESSAGE_BULK_DELETE:"messageDeleteBulk",MESSAGE_REACTION_ADD:"messageReactionAdd",MESSAGE_REACTION_REMOVE:"messageReactionRemove",MESSAGE_REACTION_REMOVE_ALL:"messageReactionRemoveAll",USER_UPDATE:"userUpdate",USER_NOTE_UPDATE:"userNoteUpdate",USER_SETTINGS_UPDATE:"clientUserSettingsUpdate",USER_GUILD_SETTINGS_UPDATE:"clientUserGuildSettingsUpdate",PRESENCE_UPDATE:"presenceUpdate",VOICE_STATE_UPDATE:"voiceStateUpdate",TYPING_START:"typingStart",TYPING_STOP:"typingStop",DISCONNECT:"disconnect",RECONNECTING:"reconnecting",ERROR:"error",WARN:"warn",DEBUG:"debug"},t.WSEvents=function(e){let t=Object.create(null);for(const s of e)t[s]=s;return t}(["READY","RESUMED","GUILD_SYNC","GUILD_CREATE","GUILD_DELETE","GUILD_UPDATE","GUILD_MEMBER_ADD","GUILD_MEMBER_REMOVE","GUILD_MEMBER_UPDATE","GUILD_MEMBERS_CHUNK","GUILD_ROLE_CREATE","GUILD_ROLE_DELETE","GUILD_ROLE_UPDATE","GUILD_BAN_ADD","GUILD_BAN_REMOVE","GUILD_EMOJIS_UPDATE","CHANNEL_CREATE","CHANNEL_DELETE","CHANNEL_UPDATE","CHANNEL_PINS_UPDATE","MESSAGE_CREATE","MESSAGE_DELETE","MESSAGE_UPDATE","MESSAGE_DELETE_BULK","MESSAGE_REACTION_ADD","MESSAGE_REACTION_REMOVE","MESSAGE_REACTION_REMOVE_ALL","USER_UPDATE","USER_NOTE_UPDATE","USER_SETTINGS_UPDATE","USER_GUILD_SETTINGS_UPDATE","PRESENCE_UPDATE","VOICE_STATE_UPDATE","TYPING_START","VOICE_SERVER_UPDATE","RELATIONSHIP_ADD","RELATIONSHIP_REMOVE"]),t.MessageTypes=["DEFAULT","RECIPIENT_ADD","RECIPIENT_REMOVE","CALL","CHANNEL_NAME_CHANGE","CHANNEL_ICON_CHANGE","PINS_ADD","GUILD_MEMBER_JOIN"],t.ActivityTypes=["PLAYING","STREAMING","LISTENING","WATCHING"],t.ExplicitContentFilterTypes=["DISABLED","NON_FRIENDS","FRIENDS_AND_NON_FRIENDS"],t.MessageNotificationTypes=["EVERYTHING","MENTIONS","NOTHING","INHERIT"],t.UserSettingsMap={convert_emoticons:"convertEmoticons",default_guilds_restricted:"defaultGuildsRestricted",detect_platform_accounts:"detectPlatformAccounts",developer_mode:"developerMode",enable_tts_command:"enableTTSCommand",theme:"theme",status:"status",show_current_game:"showCurrentGame",inline_attachment_media:"inlineAttachmentMedia",inline_embed_media:"inlineEmbedMedia",locale:"locale",message_display_compact:"messageDisplayCompact",render_reactions:"renderReactions",guild_positions:"guildPositions",restricted_guilds:"restrictedGuilds",explicit_content_filter:function(e){return t.ExplicitContentFilterTypes[e]},friend_source_flags:function(e){return{all:e.all||!1,mutualGuilds:!!e.all||(e.mutual_guilds||!1),mutualFriends:!!e.all||(e.mutualFriends||!1)}}},t.UserGuildSettingsMap={message_notifications:function(e){return t.MessageNotificationTypes[e]},mobile_push:"mobilePush",muted:"muted",suppress_everyone:"suppressEveryone",channel_overrides:"channelOverrides"},t.UserChannelOverrideMap={message_notifications:function(e){return t.MessageNotificationTypes[e]},muted:"muted"},t.UserFlags={STAFF:1,PARTNER:2,HYPESQUAD:4},t.ChannelTypes={TEXT:0,DM:1,VOICE:2,GROUP:3,CATEGORY:4},t.ClientApplicationAssetTypes={SMALL:1,BIG:2},t.Colors={DEFAULT:0,AQUA:1752220,GREEN:3066993,BLUE:3447003,PURPLE:10181046,GOLD:15844367,ORANGE:15105570,RED:15158332,GREY:9807270,NAVY:3426654,DARK_AQUA:1146986,DARK_GREEN:2067276,DARK_BLUE:2123412,DARK_PURPLE:7419530,DARK_GOLD:12745742,DARK_ORANGE:11027200,DARK_RED:10038562,DARK_GREY:9936031,DARKER_GREY:8359053,LIGHT_GREY:12370112,DARK_NAVY:2899536,BLURPLE:7506394,GREYPLE:10070709,DARK_BUT_NOT_BLACK:2895667,NOT_QUITE_BLACK:2303786},t.APIErrors={UNKNOWN_ACCOUNT:10001,UNKNOWN_APPLICATION:10002,UNKNOWN_CHANNEL:10003,UNKNOWN_GUILD:10004,UNKNOWN_INTEGRATION:10005,UNKNOWN_INVITE:10006,UNKNOWN_MEMBER:10007,UNKNOWN_MESSAGE:10008,UNKNOWN_OVERWRITE:10009,UNKNOWN_PROVIDER:10010,UNKNOWN_ROLE:10011,UNKNOWN_TOKEN:10012,UNKNOWN_USER:10013,UNKNOWN_EMOJI:10014,BOT_PROHIBITED_ENDPOINT:20001,BOT_ONLY_ENDPOINT:20002,MAXIMUM_GUILDS:30001,MAXIMUM_FRIENDS:30002,MAXIMUM_PINS:30003,MAXIMUM_ROLES:30005,MAXIMUM_REACTIONS:30010,UNAUTHORIZED:40001,MISSING_ACCESS:50001,INVALID_ACCOUNT_TYPE:50002,CANNOT_EXECUTE_ON_DM:50003,EMBED_DISABLED:50004,CANNOT_EDIT_MESSAGE_BY_OTHER:50005,CANNOT_SEND_EMPTY_MESSAGE:50006,CANNOT_MESSAGE_USER:50007,CANNOT_SEND_MESSAGES_IN_VOICE_CHANNEL:50008,CHANNEL_VERIFICATION_LEVEL_TOO_HIGH:50009,OAUTH2_APPLICATION_BOT_ABSENT:50010,MAXIMUM_OAUTH2_APPLICATIONS:50011,INVALID_OAUTH_STATE:50012,MISSING_PERMISSIONS:50013,INVALID_AUTHENTICATION_TOKEN:50014,NOTE_TOO_LONG:50015,INVALID_BULK_DELETE_QUANTITY:50016,CANNOT_PIN_MESSAGE_IN_OTHER_CHANNEL:50019,CANNOT_EXECUTE_ON_SYSTEM_MESSAGE:50021,BULK_DELETE_MESSAGE_TOO_OLD:50034,INVITE_ACCEPTED_TO_GUILD_NOT_CONTANING_BOT:50036,REACTION_BLOCKED:90001}}).call(t,s(18))},function(e,t){class AbstractHandler{constructor(e){this.packetManager=e}handle(e){return e}}e.exports=AbstractHandler},function(e,t){class GenericAction{constructor(e){this.client=e}handle(e){return e}}e.exports=GenericAction},function(e,t){class Collection extends Map{constructor(e){super(e),Object.defineProperty(this,"_array",{value:null,writable:!0,configurable:!0}),Object.defineProperty(this,"_keyArray",{value:null,writable:!0,configurable:!0})}set(e,t){return this._array=null,this._keyArray=null,super.set(e,t)}delete(e){return this._array=null,this._keyArray=null,super.delete(e)}array(){return this._array&&this._array.length===this.size||(this._array=Array.from(this.values())),this._array}keyArray(){return this._keyArray&&this._keyArray.length===this.size||(this._keyArray=Array.from(this.keys())),this._keyArray}first(e){if(void 0===e)return this.values().next().value;if(e<0)return this.last(-1*e);e=Math.min(this.size,e);const t=new Array(e),s=this.values();for(let i=0;i{const i=e.get(s);return i!==t||void 0===i&&!e.has(s)}))}sort(e=((e,t)=>+(e>t)||+(e===t)-1)){return new Collection(Array.from(this.entries()).sort((t,s)=>e(t[1],s[1],t[0],s[0])))}}e.exports=Collection},function(e,t,s){e.exports=s(40),e.exports.Messages=s(75)},function(e,t,s){(function(t){const i=s(28),n=s(29),{Colors:r,DefaultOptions:o,Endpoints:a}=s(0),{Error:c,RangeError:l,TypeError:h}=s(4),u=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);class Util{constructor(){throw new Error(`The ${this.constructor.name} class may not be instantiated.`)}static splitMessage(e,{maxLength:t=1950,char:s="\n",prepend:i="",append:n=""}={}){if(e.length<=t)return e;const r=e.split(s);if(1===r.length)throw new l("SPLIT_MAX_LEN");const o=[""];let a=0;for(let e=0;et&&(o[a]+=n,o.push(i),a++),o[a]+=(o[a].length>0&&o[a]!==i?s:"")+r[e];return o.filter(e=>e)}static escapeMarkdown(e,t=!1,s=!1){return t?e.replace(/```/g,"`​``"):s?e.replace(/\\(`|\\)/g,"$1").replace(/(`|\\)/g,"\\$1"):e.replace(/\\(\*|_|`|~|\\)/g,"$1").replace(/(\*|_|`|~|\\)/g,"\\$1")}static fetchRecommendedShards(e,t=1e3){return new Promise((s,i)=>{if(!e)throw new c("TOKEN_MISSING");n.get(`${o.http.api}/v${o.http.version}${a.botGateway}`).set("Authorization",`Bot ${e.replace(/^Bot\s*/i,"")}`).end((e,n)=>{e&&i(e),s(n.body.shards*(1e3/t))})})}static parseEmoji(e){if(e.includes("%")&&(e=decodeURIComponent(e)),e.includes(":")){const[t,s]=e.split(":");return{name:t,id:s}}return{name:e,id:null}}static arraysEqual(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(const s of e){const e=t.indexOf(s);-1!==e&&t.splice(e,1)}return 0===t.length}static cloneObject(e){return Object.assign(Object.create(e),e)}static mergeDefault(e,t){if(!t)return e;for(const s in e)u(t,s)&&void 0!==t[s]?t[s]===Object(t[s])&&(t[s]=this.mergeDefault(e[s],t[s])):t[s]=e[s];return t}static convertToBuffer(e){return"string"==typeof e&&(e=this.str2ab(e)),t.from(e)}static str2ab(e){const t=new ArrayBuffer(2*e.length),s=new Uint16Array(t);for(var i=0,n=e.length;i-1&&s16777215)throw new l("COLOR_RANGE");if(e&&isNaN(e))throw new h("COLOR_CONVERT");return e}static discordSort(e){return e.sort((e,t)=>e.rawPosition-t.rawPosition||i.fromString(e.id).sub(i.fromString(t.id)).toNumber())}static setPosition(e,t,s,i,n,r){let o=i.array();return Util.moveElementInArray(o,e,t,s),o=o.map((e,t)=>({id:e.id,position:t})),n.patch({data:o,reason:r})}}e.exports=Util}).call(t,s(17).Buffer)},function(e,t,s){function i(e,t,s="0"){return String(e).length>=t?String(e):(String(s).repeat(t)+e).slice(-t)}const n=s(28),r=14200704e5;let o=0;class SnowflakeUtil{constructor(){throw new Error(`The ${this.constructor.name} class may not be instantiated.`)}static generate(){o>=4095&&(o=0);const e=`${i((Date.now()-r).toString(2),42)}0000100000${i((o++).toString(2),12)}`;return n.fromString(e,2).toString()}static deconstruct(e){const t=i(n.fromString(e).toString(2),64),s={timestamp:parseInt(t.substring(0,42),2)+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(s,"date",{get:function(){return new Date(this.timestamp)},enumerable:!0}),s}}e.exports=SnowflakeUtil},function(e,t){class Base{constructor(e){Object.defineProperty(this,"client",{value:e})}_clone(){return Object.assign(Object.create(this),this)}_patch(e){return e}_update(e){const t=this._clone();return this._patch(e),t}}e.exports=Base},function(e,t,s){const i=s(3);class DataStore extends i{constructor(e,t,s){if(super(),Object.defineProperty(this,"client",{value:e}),Object.defineProperty(this,"holds",{value:s}),t)for(const e of t)this.create(e)}create(e,t=!0,{id:s,extras:i=[]}={}){const n=this.get(s||e.id);if(n)return n;const r=this.holds?new this.holds(this.client,e,...i):e;return t&&this.set(s||r.id,r),r}remove(e){return this.delete(e)}resolve(e){return e instanceof this.holds?e:"string"==typeof e?this.get(e)||null:null}resolveID(e){return e instanceof this.holds?e.id:"string"==typeof e?e:null}}e.exports=DataStore},function(e,t,s){const{RangeError:i}=s(4);class Permissions{constructor(e){this.bitfield="number"==typeof e?e:this.constructor.resolve(e)}has(e,t=!0){return e instanceof Array?e.every(e=>this.has(e,t)):(e=this.constructor.resolve(e),!!(t&&(this.bitfield&this.constructor.FLAGS.ADMINISTRATOR)>0)||(this.bitfield&e)===e)}missing(e,t=!0){return e.filter(e=>!this.has(e,t))}freeze(){return Object.freeze(this)}add(...e){let t=0;for(let s=e.length-1;s>=0;s--)t|=this.constructor.resolve(e[s]);return Object.isFrozen(this)?new this.constructor(this.bitfield|t):(this.bitfield|=t,this)}remove(...e){let t=0;for(let s=e.length-1;s>=0;s--)t|=this.constructor.resolve(e[s]);return Object.isFrozen(this)?new this.constructor(this.bitfield&~t):(this.bitfield&=~t,this)}serialize(e=!0){const t={};for(const s in this.constructor.FLAGS)t[s]=this.has(s,e);return t}static resolve(e){if("number"==typeof e&&e>=0)return e;if(e instanceof Permissions)return e.bitfield;if(e instanceof Array)return e.map(e=>this.resolve(e)).reduce((e,t)=>e|t,0);if("string"==typeof e)return this.FLAGS[e];throw new i("PERMISSIONS_INVALID")}}Permissions.FLAGS={CREATE_INSTANT_INVITE:1,KICK_MEMBERS:2,BAN_MEMBERS:4,ADMINISTRATOR:8,MANAGE_CHANNELS:16,MANAGE_GUILD:32,ADD_REACTIONS:64,VIEW_AUDIT_LOG:128,VIEW_CHANNEL:1024,SEND_MESSAGES:2048,SEND_TTS_MESSAGES:4096,MANAGE_MESSAGES:8192,EMBED_LINKS:16384,ATTACH_FILES:32768,READ_MESSAGE_HISTORY:65536,MENTION_EVERYONE:1<<17,USE_EXTERNAL_EMOJIS:1<<18,CONNECT:1<<20,SPEAK:1<<21,MUTE_MEMBERS:1<<22,DEAFEN_MEMBERS:1<<23,MOVE_MEMBERS:1<<24,USE_VAD:1<<25,CHANGE_NICKNAME:1<<26,MANAGE_NICKNAMES:1<<27,MANAGE_ROLES:1<<28,MANAGE_WEBHOOKS:1<<29,MANAGE_EMOJIS:1<<30},Permissions.ALL=Object.values(Permissions.FLAGS).reduce((e,t)=>e|t,0),Permissions.DEFAULT=104324097,e.exports=Permissions},function(e,t,s){(function(t){const i=s(33),n=s(49),r=s(29),o=s(5),{Error:a,TypeError:c}=s(4);class DataResolver{constructor(){throw new a(`The ${this.constructor.name} class may not be instantiated.`)}static resolveInviteCode(e){const t=/discord(?:app\.com\/invite|\.gg)\/([\w-]{2,255})/i.exec(e);return t&&t[1]?t[1]:e}static async resolveImage(e,t){if(!e)return null;if("string"==typeof e&&e.startsWith("data:"))return e;const s=await this.resolveFile(e,t);return DataResolver.resolveBase64(s)}static resolveBase64(e){return e instanceof t?`data:image/jpg;base64,${e.toString("base64")}`:e}static resolveFile(e,s){return e instanceof t?Promise.resolve(e):s&&e instanceof ArrayBuffer?Promise.resolve(o.convertToBuffer(e)):"string"==typeof e?new Promise((s,o)=>{if(/^https?:\/\//.test(e))r.get(e).end((e,i)=>e?o(e):i.body instanceof t?s(i.body):o(new c("REQ_BODY_TYPE")));else{const t=i.resolve(e);n.stat(t,(e,i)=>e?o(e):i&&i.isFile()?(n.readFile(t,(e,t)=>{e?o(e):s(t)}),null):o(new a("FILE_NOT_FOUND",t)))}}):e.pipe&&"function"==typeof e.pipe?new Promise((s,i)=>{const n=[];e.once("error",i),e.on("data",e=>n.push(e)),e.once("end",()=>s(t.concat(n)))}):Promise.reject(new c("REQ_RESOURCE_TYPE"))}}e.exports=DataResolver}).call(t,s(17).Buffer)},function(e,t,s){const i=s(6),n=s(7),{ChannelTypes:r}=s(0);class Channel extends n{constructor(e,t){super(e);const s=Object.keys(r)[t.type];this.type=s?s.toLowerCase():"unknown",t&&this._patch(t)}_patch(e){this.id=e.id}get createdTimestamp(){return i.deconstruct(this.id).timestamp}get createdAt(){return new Date(this.createdTimestamp)}delete(){return this.client.api.channels(this.id).delete().then(()=>this)}static create(e,t,i){const n=s(46),o=s(51),a=s(52),c=s(54),l=s(93),h=s(15);let u;if(t.type===r.DM)u=new n(e,t);else if(t.type===r.GROUP)u=new o(e,t);else if(i=i||e.guilds.get(t.guild_id)){switch(t.type){case r.TEXT:u=new a(i,t);break;case r.VOICE:u=new c(i,t);break;case r.CATEGORY:u=new l(i,t);break;default:u=new h(i,t)}i.channels.set(u.id,u)}return u}}e.exports=Channel},function(e,t,s){const i=s(19),n=s(24),r=s(9),o=s(3),a=s(7),{Presence:c}=s(13),{Error:l,TypeError:h}=s(4);class GuildMember extends a{constructor(e,t,s){super(e),this.guild=s,this.user={},this._roles=[],t&&this._patch(t),this.lastMessageID=null,this.lastMessage=null}_patch(e){void 0===this.speaking&&(this.speaking=!1),void 0!==e.nick&&(this.nickname=e.nick),void 0!==e.joined_at&&(this.joinedTimestamp=new Date(e.joined_at).getTime()),this.user=this.guild.client.users.create(e.user),e.roles&&(this._roles=e.roles)}get voiceState(){return this._frozenVoiceState||this.guild.voiceStates.get(this.id)||{}}get serverDeaf(){return this.voiceState.deaf}get serverMute(){return this.voiceState.mute}get selfMute(){return this.voiceState.self_mute}get selfDeaf(){return this.voiceState.self_deaf}get voiceSessionID(){return this.voiceState.session_id}get voiceChannelID(){return this.voiceState.channel_id}get joinedAt(){return new Date(this.joinedTimestamp)}get presence(){return this.frozenPresence||this.guild.presences.get(this.id)||new c}get roles(){const e=new o,t=this.guild.roles.get(this.guild.id);t&&e.set(t.id,t);for(const t of this._roles){const s=this.guild.roles.get(t);s&&e.set(s.id,s)}return e}get highestRole(){return this.roles.reduce((e,t)=>!e||t.comparePositionTo(e)>0?t:e)}get colorRole(){const e=this.roles.filter(e=>e.color);return e.size?e.reduce((e,t)=>!e||t.comparePositionTo(e)>0?t:e):null}get displayColor(){const e=this.colorRole;return e&&e.color||0}get displayHexColor(){const e=this.colorRole;return e&&e.hexColor||"#000000"}get hoistRole(){const e=this.roles.filter(e=>e.hoist);return e.size?e.reduce((e,t)=>!e||t.comparePositionTo(e)>0?t:e):null}get mute(){return this.selfMute||this.serverMute}get deaf(){return this.selfDeaf||this.serverDeaf}get voiceChannel(){return this.guild.channels.get(this.voiceChannelID)}get id(){return this.user.id}get displayName(){return this.nickname||this.user.username}get permissions(){return this.user.id===this.guild.ownerID?new r(r.ALL).freeze():new r(this.roles.map(e=>e.permissions)).freeze()}get kickable(){if(this.user.id===this.guild.ownerID)return!1;if(this.user.id===this.client.user.id)return!1;const e=this.guild.member(this.client.user);return!!e.permissions.has(r.FLAGS.KICK_MEMBERS)&&e.highestRole.comparePositionTo(this.highestRole)>0}get bannable(){if(this.user.id===this.guild.ownerID)return!1;if(this.user.id===this.client.user.id)return!1;const e=this.guild.member(this.client.user);return!!e.permissions.has(r.FLAGS.BAN_MEMBERS)&&e.highestRole.comparePositionTo(this.highestRole)>0}permissionsIn(e){if(!(e=this.client.channels.resolve(e))||!e.guild)throw new l("GUILD_CHANNEL_RESOLVE");return e.permissionsFor(this)}hasPermission(e,t=!1,s,i){return void 0===s&&(s=!t),void 0===i&&(i=!t),!(!i||this.user.id!==this.guild.ownerID)||this.roles.some(t=>t.permissions.has(e,void 0,s))}missingPermissions(e,t=!1){return this.permissions.missing(e,t)}edit(e,t){e.channel&&(e.channel_id=this.client.channels.resolve(e.channel).id,e.channel=null),e.roles&&(e.roles=e.roles.map(e=>e instanceof n?e.id:e));let s=this.client.api.guilds(this.guild.id);if(this.user.id===this.client.user.id){const t=Object.keys(e);s=1===t.length&&"nick"===t[0]?s.members("@me").nick:s.members(this.id)}else s=s.members(this.id);return s.patch({data:e,reason:t}).then(()=>{const t=this._clone();return e.user=this.user,t._patch(e),t._frozenVoiceState=this.voiceState,void 0!==e.mute&&(t._frozenVoiceState.mute=e.mute),void 0!==e.deaf&&(t._frozenVoiceState.mute=e.deaf),void 0!==e.channel_id&&(t._frozenVoiceState.channel_id=e.channel_id),t})}setMute(e,t){return this.edit({mute:e},t)}setDeaf(e,t){return this.edit({deaf:e},t)}setVoiceChannel(e){return this.edit({channel:e})}setRoles(e,t){return this.edit({roles:e},t)}addRole(e,t){return(e=this.guild.roles.resolve(e))?this._roles.includes(e.id)?Promise.resolve(this):this.client.api.guilds(this.guild.id).members(this.user.id).roles(e.id).put({reason:t}).then(()=>{const t=this._clone();return t._roles.includes(e.id)||t._roles.push(e.id),t}):Promise.reject(new h("INVALID_TYPE","role","Role nor a Snowflake"))}addRoles(e,t){let s=this._roles.slice();for(let t of e instanceof o?e.values():e){if(!(t=this.guild.roles.resolve(t)))return Promise.reject(new h("INVALID_TYPE","roles","Array or Collection of Roles or Snowflakes",!0));s.push(t.id)}return this.edit({roles:s},t)}removeRole(e,t){return(e=this.guild.roles.resolve(e))?this._roles.includes(e.id)?this.client.api.guilds(this.guild.id).members(this.user.id).roles(e.id).delete({reason:t}).then(()=>{const t=this._clone(),s=t._roles.indexOf(e.id);return~s&&t._roles.splice(s,1),t}):Promise.resolve(this):Promise.reject(new h("INVALID_TYPE","role","Role nor a Snowflake"))}removeRoles(e,t){const s=this._roles.slice();for(let t of e instanceof o?e.values():e){if(!(t=this.guild.roles.resolve(t)))return Promise.reject(new h("INVALID_TYPE","roles","Array or Collection of Roles or Snowflakes",!0));const e=s.indexOf(t.id);e>=0&&s.splice(e,1)}return this.edit({roles:s},t)}setNickname(e,t){return this.edit({nick:e},t)}createDM(){return this.user.createDM()}deleteDM(){return this.user.deleteDM()}kick(e){return this.client.api.guilds(this.guild.id).members(this.user.id).delete({reason:e}).then(()=>this.client.actions.GuildMemberRemove.handle({guild_id:this.guild.id,user:this.user}).member)}ban(e){return this.guild.ban(this,e)}toString(){return`<@${this.nickname?"!":""}${this.user.id}>`}send(){}}i.applyToClass(GuildMember),e.exports=GuildMember},function(e,t,s){const{ActivityTypes:i}=s(0);class Presence{constructor(e,t={}){Object.defineProperty(this,"client",{value:e}),this.patch(t)}patch(e){this.status=e.status||this.status;const t=e.game||e.activity;return this.activity=t?new Activity(this,t):null,this}_clone(){const e=Object.assign(Object.create(this),this);return this.activity&&(e.activity=this.activity._clone()),e}equals(e){return this===e||(e&&this.status===e.status&&this.activity?this.activity.equals(e.activity):!e.activity)}}class Activity{constructor(e,t){Object.defineProperty(this,"presence",{value:e}),this.name=t.name,this.type=i[t.type],this.url=t.url||null,this.details=t.details||null,this.state=t.state||null,this.applicationID=t.application_id||null,this.timestamps=t.timestamps?{start:t.timestamps.start?new Date(t.timestamps.start):null,end:t.timestamps.end?new Date(t.timestamps.end):null}:null,this.party=t.party||null,this.assets=t.assets?new RichPresenceAssets(this,t.assets):null}equals(e){return this===e||e&&this.name===e.name&&this.type===e.type&&this.url===e.url}_clone(){return Object.assign(Object.create(this),this)}}class RichPresenceAssets{constructor(e,t){Object.defineProperty(this,"activity",{value:e}),this.largeText=t.large_text||null,this.smallText=t.small_text||null,this.largeImage=t.large_image||null,this.smallImage=t.small_image||null}smallImageURL({format:e,size:t}={}){return this.smallImage?this.activity.presence.client.rest.cdn.AppAsset(this.activity.applicationID,this.smallImage,{format:e,size:t}):null}largeImageURL({format:e,size:t}={}){return this.largeImage?this.activity.presence.client.rest.cdn.AppAsset(this.activity.applicationID,this.largeImage,{format:e,size:t}):null}}t.Presence=Presence,t.Activity=Activity,t.RichPresenceAssets=RichPresenceAssets},function(e,t,s){const i=s(20),n=s(5),{RangeError:r}=s(4);class MessageEmbed{constructor(e={}){this.setup(e)}setup(e){this.type=e.type,this.title=e.title,this.description=e.description,this.url=e.url,this.color=e.color,this.timestamp=e.timestamp?new Date(e.timestamp).getTime():null,this.fields=e.fields?e.fields.map(n.cloneObject):[],this.thumbnail=e.thumbnail?{url:e.thumbnail.url,proxyURL:e.thumbnail.proxy_url,height:e.height,width:e.width}:null,this.image=e.image?{url:e.image.url,proxyURL:e.image.proxy_url,height:e.height,width:e.width}:null,this.video=e.video,this.author=e.author?{name:e.author.name,url:e.author.url,iconURL:e.author.iconURL||e.author.icon_url,proxyIconURL:e.author.proxyIconUrl||e.author.proxy_icon_url}:null,this.provider=e.provider,this.footer=e.footer?{text:e.footer.text,iconURL:e.footer.iconURL||e.footer.icon_url,proxyIconURL:e.footer.proxyIconURL||e.footer.proxy_icon_url}:null,e.files&&(this.files=e.files.map(e=>e instanceof i?"string"==typeof e.file?e.file:n.cloneObject(e.file):e))}get createdAt(){return this.timestamp?new Date(this.timestamp):null}get hexColor(){return this.color?`#${this.color.toString(16).padStart(6,"0")}`:null}addField(e,t,s=!1){if(this.fields.length>=25)throw new r("EMBED_FIELD_COUNT");if(e=n.resolveString(e),!String(e)||e.length>256)throw new r("EMBED_FIELD_NAME");if(t=n.resolveString(t),!String(t)||t.length>1024)throw new r("EMBED_FIELD_VALUE");return this.fields.push({name:e,value:t,inline:s}),this}addBlankField(e=!1){return this.addField("​","​",e)}attachFiles(e){this.files?this.files=this.files.concat(e):this.files=e;for(let t of e)t instanceof i&&(t=t.file);return this}setAuthor(e,t,s){return this.author={name:n.resolveString(e),iconURL:t,url:s},this}setColor(e){return this.color=n.resolveColor(e),this}setDescription(e){if((e=n.resolveString(e)).length>2048)throw new r("EMBED_DESCRIPTION");return this.description=e,this}setFooter(e,t){if((e=n.resolveString(e)).length>2048)throw new r("EMBED_FOOTER_TEXT");return this.footer={text:e,iconURL:t},this}setImage(e){return this.image={url:e},this}setThumbnail(e){return this.thumbnail={url:e},this}setTimestamp(e=new Date){return this.timestamp=e.getTime(),this}setTitle(e){if((e=n.resolveString(e)).length>256)throw new r("EMBED_TITLE");return this.title=e,this}setURL(e){return this.url=e,this}_apiTransform(){return{title:this.title,type:"rich",description:this.description,url:this.url,timestamp:this.timestamp?new Date(this.timestamp):null,color:this.color,fields:this.fields,files:this.files,thumbnail:this.thumbnail,image:this.image,author:this.author?{name:this.author.name,url:this.author.url,icon_url:this.author.iconURL}:null,footer:this.footer?{text:this.footer.text,icon_url:this.footer.iconURL}:null}}}e.exports=MessageEmbed},function(e,t,s){const i=s(11),n=s(24),r=s(25),o=s(53),a=s(5),c=s(9),l=s(3),{MessageNotificationTypes:h}=s(0),{Error:u,TypeError:d}=s(4);class GuildChannel extends i{constructor(e,t){super(e.client,t),this.guild=e}_patch(e){if(super._patch(e),this.name=e.name,this.rawPosition=e.position,this.parentID=e.parent_id,this.permissionOverwrites=new l,e.permission_overwrites)for(const t of e.permission_overwrites)this.permissionOverwrites.set(t.id,new o(this,t))}get parent(){return this.guild.channels.get(this.parentID)}get permissionsLocked(){return this.parent?this.permissionOverwrites.size===this.parent.permissionOverwrites.size&&!this.permissionOverwrites.find((e,t)=>{const s=this.parent.permissionOverwrites.get(t);return void 0===s||s.denied.bitfield!==e.denied.bitfield||s.allowed.bitfield!==e.allowed.bitfield}):null}get position(){const e=this.guild._sortedChannels(this);return e.array().indexOf(e.get(this.id))}permissionsFor(e){if(!(e=this.guild.members.resolve(e)))return null;if(e.id===this.guild.ownerID)return new c(c.ALL).freeze();const t=e.roles,s=new c(t.map(e=>e.permissions));if(s.has(c.FLAGS.ADMINISTRATOR))return new c(c.ALL).freeze();const i=this.overwritesFor(e,!0,t);return s.remove(i.everyone?i.everyone.denied:0).add(i.everyone?i.everyone.allowed:0).remove(i.roles.length>0?i.roles.map(e=>e.denied):0).add(i.roles.length>0?i.roles.map(e=>e.allowed):0).remove(i.member?i.member.denied:0).add(i.member?i.member.allowed:0).freeze()}overwritesFor(e,t=!1,s=null){if(t||(e=this.guild.members.resolve(e)),!e)return[];s=s||e.roles;const i=[];let n,r;for(const t of this.permissionOverwrites.values())t.id===this.guild.id?r=t:s.has(t.id)?i.push(t):t.id===e.id&&(n=t);return{everyone:r,roles:i,member:n}}overwritePermissions(e,t,s){const i=new c(0),r=new c(0);let o;const a=this.guild.roles.get(e);if(a||e instanceof n)e=a||e,o="role";else if(e=this.client.users.resolve(e),o="member",!e)return Promise.reject(new d("INVALID_TYPE","parameter","User nor a Role",!0));const l=this.permissionOverwrites.get(e.id);l&&(i.add(l.allowed),r.add(l.denied));for(const e in t)!0===t[e]?(i.add(c.FLAGS[e]||0),r.remove(c.FLAGS[e]||0)):!1===t[e]?(i.remove(c.FLAGS[e]||0),r.add(c.FLAGS[e]||0)):null===t[e]&&(i.remove(c.FLAGS[e]||0),r.remove(c.FLAGS[e]||0));return this.client.api.channels(this.id).permissions[e.id].put({data:{id:e.id,type:o,allow:i.bitfield,deny:r.bitfield},reason:s}).then(()=>this)}lockPermissions(){if(!this.parent)return Promise.reject(new u("GUILD_CHANNEL_ORPHAN"));const e=this.parent.permissionOverwrites.map(e=>({deny:e.denied.bitfield,allow:e.allowed.bitfield,id:e.id,type:e.type}));return this.edit({permissionOverwrites:e})}get members(){const e=new l;for(const t of this.guild.members.values())this.permissionsFor(t).has("VIEW_CHANNEL")&&e.set(t.id,t);return e}edit(e,t){return this.client.api.channels(this.id).patch({data:{name:(e.name||this.name).trim(),topic:e.topic,position:e.position||this.rawPosition,bitrate:e.bitrate||(this.bitrate?1e3*this.bitrate:void 0),user_limit:null!=e.userLimit?e.userLimit:this.userLimit,parent_id:e.parentID,lock_permissions:e.lockPermissions,permission_overwrites:e.permissionOverwrites},reason:t}).then(e=>{const t=this._clone();return t._patch(e),t})}setName(e,t){return this.edit({name:e},t)}setParent(e,{lockPermissions:t=!0,reason:s}={}){return this.edit({parentID:e.id?e.id:e,lockPermissions:t},s)}setTopic(e,t){return this.edit({topic:e},t)}setPosition(e,{relative:t,reason:s}={}){return a.setPosition(this,e,t,this.guild._sortedChannels(this),this.client.api.guilds(this.guild.id).channels,s).then(e=>(this.client.actions.GuildChannelsPositionUpdate.handle({guild_id:this.id,channels:e}),this))}createInvite({temporary:e=!1,maxAge:t=86400,maxUses:s=0,unique:i,reason:n}={}){return this.client.api.channels(this.id).invites.post({data:{temporary:e,max_age:t,max_uses:s,unique:i},reason:n}).then(e=>new r(this.client,e))}clone({name:e=this.name,withPermissions:t=!0,withTopic:s=!0,reason:i}={}){const n={overwrites:t?this.permissionOverwrites:[],reason:i};return this.guild.createChannel(e,this.type,n).then(e=>s?e.setTopic(this.topic):e)}equals(e){let t=e&&this.id===e.id&&this.type===e.type&&this.topic===e.topic&&this.position===e.position&&this.name===e.name;return t&&(t=this.permissionOverwrites&&e.permissionOverwrites?this.permissionOverwrites.equals(e.permissionOverwrites):!this.permissionOverwrites&&!e.permissionOverwrites),t}get deletable(){return this.permissionsFor(this.client.user).has(c.FLAGS.MANAGE_CHANNELS)}delete(e){return this.client.api.channels(this.id).delete({reason:e}).then(()=>this)}get muted(){if(this.client.user.bot)return null;try{return this.client.user.guildSettings.get(this.guild.id).channelOverrides.get(this.id).muted}catch(e){return!1}}get messageNotifications(){if(this.client.user.bot)return null;try{return this.client.user.guildSettings.get(this.guild.id).channelOverrides.get(this.id).messageNotifications}catch(e){return h[3]}}toString(){return`<#${this.id}>`}}e.exports=GuildChannel},function(e,t,s){(function(t){const i=s(33),n=s(5),r=s(10),o=s(14),a=s(20),c=s(14);class Webhook{constructor(e,t){Object.defineProperty(this,"client",{value:e}),t&&this._patch(t)}_patch(e){this.name=e.name,this.token=e.token,this.avatar=e.avatar,this.id=e.id,this.guildID=e.guild_id,this.channelID=e.channel_id,e.user?this.owner=this.client.users?this.client.users.get(e.user.id):e.user:this.owner=null}send(e,s){if(s||"object"!=typeof e||e instanceof Array?s||(s={}):(s=e,e=""),s instanceof a&&(s={files:[s.file]}),s instanceof c&&(s={embeds:[s]}),s.embed&&(s={embeds:[s.embed]}),e instanceof Array||s instanceof Array){const t=e instanceof Array?e:s,i=t.filter(e=>e instanceof a),n=t.filter(e=>e instanceof c);i.length&&(s={files:i}),n.length&&(s={embeds:n}),(n.length||i.length)&&e instanceof Array&&(e="")}if(s.username||(s.username=this.name),s.avatarURL&&(s.avatar_url=s.avatarURL,s.avatarURL=null),e){e=n.resolveString(e);let{split:t,code:i,disableEveryone:r}=s;t&&"object"!=typeof t&&(t={}),void 0===i||"boolean"==typeof i&&!0!==i||(e=n.escapeMarkdown(e,!0),e=`\`\`\`${"boolean"!=typeof i?i||"":""}\n${e}\n\`\`\``,t&&(t.prepend=`\`\`\`${"boolean"!=typeof i?i||"":""}\n`,t.append="\n```")),(r||void 0===r&&this.client.options.disableEveryone)&&(e=e.replace(/@(everyone|here)/g,"@​$1")),t&&(e=n.splitMessage(e,t))}if(s.content=e,s.embeds&&(s.embeds=s.embeds.map(e=>new o(e)._apiTransform())),s.files){for(let e=0;er.resolveFile(e.attachment,this.client.browser).then(t=>(e.file=t,e)))).then(e=>this.client.api.webhooks(this.id,this.token).post({data:s,query:{wait:!0},files:e,auth:!1}))}return e instanceof Array?new Promise((t,i)=>{const n=[];(function r(){const o=e.length?null:{embeds:s.embeds,files:s.files};this.client.api.webhooks(this.id,this.token).post({data:{content:e.shift(),opt:o},query:{wait:!0},auth:!1}).then(s=>(n.push(s),0===e.length?t(n):r.call(this))).catch(i)}).call(this)}):this.client.api.webhooks(this.id,this.token).post({data:s,query:{wait:!0},auth:!1}).then(e=>this.client.channels?this.client.channels.get(e.channel_id).messages.create(e,!1):e)}sendSlackMessage(e){return this.client.api.webhooks(this.id,this.token).slack.post({query:{wait:!0},auth:!1,data:e}).then(e=>this.client.channels?this.client.channels.get(e.channel_id).messages.create(e,!1):e)}edit({name:e=this.name,avatar:t},s){return t&&"string"==typeof t&&!t.startsWith("data:")?r.resolveImage(t,this.client.browser).then(t=>this.edit({name:e,avatar:t},s)):this.client.api.webhooks(this.id,this.token).patch({data:{name:e,avatar:t},reason:s}).then(e=>(this.name=e.name,this.avatar=e.avatar,this))}delete(e){return this.client.api.webhooks(this.id,this.token).delete({reason:e})}static applyToClass(e){for(const t of["send","sendSlackMessage","edit","delete"])Object.defineProperty(e.prototype,t,Object.getOwnPropertyDescriptor(Webhook.prototype,t))}}e.exports=Webhook}).call(t,s(17).Buffer)},function(e,t,s){"use strict";(function(e){function i(){return r.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function n(e,t){if(i()=i())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i().toString(16)+" bytes");return 0|e}function g(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 s=e.length;if(0===s)return 0;for(var i=!1;;)switch(t){case"ascii":case"latin1":case"binary":return s;case"utf8":case"utf-8":case void 0:return V(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*s;case"hex":return s>>>1;case"base64":return Y(e).length;default:if(i)return V(e).length;t=(""+t).toLowerCase(),i=!0}}function m(e,t,s){var i=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===s||s>this.length)&&(s=this.length),s<=0)return"";if(s>>>=0,t>>>=0,s<=t)return"";for(e||(e="utf8");;)switch(e){case"hex":return M(this,t,s);case"utf8":case"utf-8":return D(this,t,s);case"ascii":return N(this,t,s);case"latin1":case"binary":return C(this,t,s);case"base64":return S(this,t,s);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O(this,t,s);default:if(i)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),i=!0}}function E(e,t,s){var i=e[t];e[t]=e[s],e[s]=i}function _(e,t,s,i,n){if(0===e.length)return-1;if("string"==typeof s?(i=s,s=0):s>2147483647?s=2147483647:s<-2147483648&&(s=-2147483648),s=+s,isNaN(s)&&(s=n?0:e.length-1),s<0&&(s=e.length+s),s>=e.length){if(n)return-1;s=e.length-1}else if(s<0){if(!n)return-1;s=0}if("string"==typeof t&&(t=r.from(t,i)),r.isBuffer(t))return 0===t.length?-1:y(e,t,s,i,n);if("number"==typeof t)return t&=255,r.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?n?Uint8Array.prototype.indexOf.call(e,t,s):Uint8Array.prototype.lastIndexOf.call(e,t,s):y(e,[t],s,i,n);throw new TypeError("val must be string, number or Buffer")}function y(e,t,s,i,n){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!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(e.length<2||t.length<2)return-1;o=2,a/=2,c/=2,s/=2}var l;if(n){var h=-1;for(l=s;la&&(s=a-c),l=s;l>=0;l--){for(var u=!0,d=0;dn&&(i=n):i=n;var r=t.length;if(r%2!=0)throw new TypeError("Invalid hex string");i>r/2&&(i=r/2);for(var o=0;o239?4:r>223?3:r>191?2:1;if(n+a<=s){var c,l,h,u;switch(a){case 1:r<128&&(o=r);break;case 2:128==(192&(c=e[n+1]))&&(u=(31&r)<<6|63&c)>127&&(o=u);break;case 3:c=e[n+1],l=e[n+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[n+1],l=e[n+2],h=e[n+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,i.push(o>>>10&1023|55296),o=56320|1023&o),i.push(o),n+=a}return R(i)}function R(e){var t=e.length;if(t<=Q)return String.fromCharCode.apply(String,e);for(var s="",i=0;ii)&&(s=i);for(var n="",r=t;rs)throw new RangeError("Trying to access beyond buffer length")}function U(e,t,s,i,n,o){if(!r.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>n||te.length)throw new RangeError("Index out of range")}function x(e,t,s,i){t<0&&(t=65535+t+1);for(var n=0,r=Math.min(e.length-s,2);n>>8*(i?n:1-n)}function P(e,t,s,i){t<0&&(t=4294967295+t+1);for(var n=0,r=Math.min(e.length-s,4);n>>8*(i?n:3-n)&255}function k(e,t,s,i,n,r){if(s+i>e.length)throw new RangeError("Index out of range");if(s<0)throw new RangeError("Index out of range")}function G(e,t,s,i,n){return n||k(e,t,s,4,3.4028234663852886e38,-3.4028234663852886e38),J.write(e,t,s,i,23,4),s+4}function j(e,t,s,i,n){return n||k(e,t,s,8,1.7976931348623157e308,-1.7976931348623157e308),J.write(e,t,s,i,52,8),s+8}function B(e){if((e=H(e).replace(Z,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}function H(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function q(e){return e<16?"0"+e.toString(16):e.toString(16)}function V(e,t){t=t||1/0;for(var s,i=e.length,n=null,r=[],o=0;o55295&&s<57344){if(!n){if(s>56319){(t-=3)>-1&&r.push(239,191,189);continue}if(o+1===i){(t-=3)>-1&&r.push(239,191,189);continue}n=s;continue}if(s<56320){(t-=3)>-1&&r.push(239,191,189),n=s;continue}s=65536+(n-55296<<10|s-56320)}else n&&(t-=3)>-1&&r.push(239,191,189);if(n=null,s<128){if((t-=1)<0)break;r.push(s)}else if(s<2048){if((t-=2)<0)break;r.push(s>>6|192,63&s|128)}else if(s<65536){if((t-=3)<0)break;r.push(s>>12|224,s>>6&63|128,63&s|128)}else{if(!(s<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;r.push(s>>18|240,s>>12&63|128,s>>6&63|128,63&s|128)}}return r}function $(e){for(var t=[],s=0;s>8,n=s%256,r.push(n),r.push(i);return r}function Y(e){return K.toByteArray(B(e))}function z(e,t,s,i){for(var n=0;n=t.length||n>=e.length);++n)t[n+s]=e[n];return n}function W(e){return e!==e}var K=s(63),J=s(64),X=s(65);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=i(),r.poolSize=8192,r._augment=function(e){return e.__proto__=r.prototype,e},r.from=function(e,t,s){return o(null,e,t,s)},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,s){return c(null,e,t,s)},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 s=e.length,i=t.length,n=0,o=Math.min(s,i);n0&&(e=this.toString("hex",0,s).match(/.{2}/g).join(" "),this.length>s&&(e+=" ... ")),""},r.prototype.compare=function(e,t,s,i,n){if(!r.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===s&&(s=e?e.length:0),void 0===i&&(i=0),void 0===n&&(n=this.length),t<0||s>e.length||i<0||n>this.length)throw new RangeError("out of range index");if(i>=n&&t>=s)return 0;if(i>=n)return-1;if(t>=s)return 1;if(t>>>=0,s>>>=0,i>>>=0,n>>>=0,this===e)return 0;for(var o=n-i,a=s-t,c=Math.min(o,a),l=this.slice(i,n),h=e.slice(t,s),u=0;un)&&(s=n),e.length>0&&(s<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var r=!1;;)switch(i){case"hex":return v(this,e,t,s);case"utf8":case"utf-8":return A(this,e,t,s);case"ascii":return b(this,e,t,s);case"latin1":case"binary":return w(this,e,t,s);case"base64":return T(this,e,t,s);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,e,t,s);default:if(r)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),r=!0}},r.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Q=4096;r.prototype.slice=function(e,t){var s=this.length;e=~~e,t=void 0===t?s:~~t,e<0?(e+=s)<0&&(e=0):e>s&&(e=s),t<0?(t+=s)<0&&(t=0):t>s&&(t=s),t0&&(n*=256);)i+=this[e+--t]*n;return i},r.prototype.readUInt8=function(e,t){return t||L(e,1,this.length),this[e]},r.prototype.readUInt16LE=function(e,t){return t||L(e,2,this.length),this[e]|this[e+1]<<8},r.prototype.readUInt16BE=function(e,t){return t||L(e,2,this.length),this[e]<<8|this[e+1]},r.prototype.readUInt32LE=function(e,t){return t||L(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||L(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},r.prototype.readIntLE=function(e,t,s){e|=0,t|=0,s||L(e,t,this.length);for(var i=this[e],n=1,r=0;++r=n&&(i-=Math.pow(2,8*t)),i},r.prototype.readIntBE=function(e,t,s){e|=0,t|=0,s||L(e,t,this.length);for(var i=t,n=1,r=this[e+--i];i>0&&(n*=256);)r+=this[e+--i]*n;return n*=128,r>=n&&(r-=Math.pow(2,8*t)),r},r.prototype.readInt8=function(e,t){return t||L(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},r.prototype.readInt16LE=function(e,t){t||L(e,2,this.length);var s=this[e]|this[e+1]<<8;return 32768&s?4294901760|s:s},r.prototype.readInt16BE=function(e,t){t||L(e,2,this.length);var s=this[e+1]|this[e]<<8;return 32768&s?4294901760|s:s},r.prototype.readInt32LE=function(e,t){return t||L(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||L(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||L(e,4,this.length),J.read(this,e,!0,23,4)},r.prototype.readFloatBE=function(e,t){return t||L(e,4,this.length),J.read(this,e,!1,23,4)},r.prototype.readDoubleLE=function(e,t){return t||L(e,8,this.length),J.read(this,e,!0,52,8)},r.prototype.readDoubleBE=function(e,t){return t||L(e,8,this.length),J.read(this,e,!1,52,8)},r.prototype.writeUIntLE=function(e,t,s,i){e=+e,t|=0,s|=0,i||U(this,e,t,s,Math.pow(2,8*s)-1,0);var n=1,r=0;for(this[t]=255&e;++r=0&&(r*=256);)this[t+n]=e/r&255;return t+s},r.prototype.writeUInt8=function(e,t,s){return e=+e,t|=0,s||U(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,s){return e=+e,t|=0,s||U(this,e,t,2,65535,0),r.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):x(this,e,t,!0),t+2},r.prototype.writeUInt16BE=function(e,t,s){return e=+e,t|=0,s||U(this,e,t,2,65535,0),r.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):x(this,e,t,!1),t+2},r.prototype.writeUInt32LE=function(e,t,s){return e=+e,t|=0,s||U(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):P(this,e,t,!0),t+4},r.prototype.writeUInt32BE=function(e,t,s){return e=+e,t|=0,s||U(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):P(this,e,t,!1),t+4},r.prototype.writeIntLE=function(e,t,s,i){if(e=+e,t|=0,!i){var n=Math.pow(2,8*s-1);U(this,e,t,s,n-1,-n)}var r=0,o=1,a=0;for(this[t]=255&e;++r>0)-a&255;return t+s},r.prototype.writeIntBE=function(e,t,s,i){if(e=+e,t|=0,!i){var n=Math.pow(2,8*s-1);U(this,e,t,s,n-1,-n)}var r=s-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+s},r.prototype.writeInt8=function(e,t,s){return e=+e,t|=0,s||U(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,s){return e=+e,t|=0,s||U(this,e,t,2,32767,-32768),r.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):x(this,e,t,!0),t+2},r.prototype.writeInt16BE=function(e,t,s){return e=+e,t|=0,s||U(this,e,t,2,32767,-32768),r.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):x(this,e,t,!1),t+2},r.prototype.writeInt32LE=function(e,t,s){return e=+e,t|=0,s||U(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):P(this,e,t,!0),t+4},r.prototype.writeInt32BE=function(e,t,s){return e=+e,t|=0,s||U(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):P(this,e,t,!1),t+4},r.prototype.writeFloatLE=function(e,t,s){return G(this,e,t,!0,s)},r.prototype.writeFloatBE=function(e,t,s){return G(this,e,t,!1,s)},r.prototype.writeDoubleLE=function(e,t,s){return j(this,e,t,!0,s)},r.prototype.writeDoubleBE=function(e,t,s){return j(this,e,t,!1,s)},r.prototype.copy=function(e,t,s,i){if(s||(s=0),i||0===i||(i=this.length),t>=e.length&&(t=e.length),t||(t=0),i>0&&i=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-t=0;--n)e[n+t]=this[n+s];else if(o<1e3||!r.TYPED_ARRAY_SUPPORT)for(n=0;n>>=0,s=void 0===s?this.length:s>>>0,e||(e=0);var o;if("number"==typeof e)for(o=t;o1)for(var s=1;se instanceof l);t.length&&(s={files:t},e instanceof Array&&(e=""))}if(s.content||(s.content=e),s.embed&&s.embed.files&&(s.files?s.files=s.files.concat(s.embed.files):s.files=s.embed.files),s.files){for(let e=0;ec.resolveFile(e.attachment,this.client.browser).then(t=>(e.file=t,e)))).then(e=>(s.files=e,r.sendMessage(this,s)))}return r.sendMessage(this,s)}search(e={}){return r.search(this,e)}startTyping(e){if(void 0!==e&&e<1)throw new u("TYPING_COUNT");if(this.client.user._typing.has(this.id)){const t=this.client.user._typing.get(this.id);t.count=e||t.count+1}else{const t=this.client.api.channels[this.id].typing;this.client.user._typing.set(this.id,{count:e||1,interval:this.client.setInterval(()=>{t.post()},9e3)}),t.post()}}stopTyping(e=!1){if(this.client.user._typing.has(this.id)){const t=this.client.user._typing.get(this.id);t.count--,(t.count<=0||e)&&(this.client.clearInterval(t.interval),this.client.user._typing.delete(this.id))}}get typing(){return this.client.user._typing.has(this.id)}get typingCount(){return this.client.user._typing.has(this.id)?this.client.user._typing.get(this.id).count:0}createMessageCollector(e,t={}){return new n(this,e,t)}awaitMessages(e,t={}){return new Promise((s,i)=>{this.createMessageCollector(e,t).once("end",(e,n)=>{t.errors&&t.errors.includes(n)?i(e):s(e)})})}bulkDelete(e,t=!1){if(!isNaN(e))return this.messages.fetch({limit:e}).then(e=>this.bulkDelete(e,t));if(e instanceof Array||e instanceof a){let s=e instanceof a?e.keyArray():e.map(e=>e.id);return t&&(s=s.filter(e=>Date.now()-o.deconstruct(e).date.getTime()<12096e5)),this.client.api.channels[this.id].messages["bulk-delete"].post({data:{messages:s}}).then(()=>this.client.actions.MessageDeleteBulk.handle({channel_id:this.id,ids:s}).messages)}throw new d("MESSAGE_BULK_DELETE_TYPE")}acknowledge(){return this.lastMessageID?this.client.api.channels[this.id].messages[this.lastMessageID].ack.post({data:{token:this.client.rest._ackToken}}).then(e=>(e.token&&(this.client.rest._ackToken=e.token),this)):Promise.resolve(this)}static applyToClass(e,t=!1,s=[]){const i=["send"];t&&i.push("acknowledge","search","bulkDelete","startTyping","stopTyping","typing","typingCount","createMessageCollector","awaitMessages");for(const t of i)s.includes(t)||Object.defineProperty(e.prototype,t,Object.getOwnPropertyDescriptor(TextBasedChannel.prototype,t))}}e.exports=TextBasedChannel;const p=s(23)}).call(t,s(17).Buffer)},function(e,t){class MessageAttachment{constructor(e,t,s){this.file=null,s&&this._patch(s),t?this.setAttachment(e,t):this._attach(e)}get name(){return this.file.name}get attachment(){return this.file.attachment}setAttachment(e,t){return this.file={attachment:e,name:t},this}setFile(e){return this.file={attachment:e},this}setName(e){return this.file.name=e,this}_attach(e,t){"string"==typeof e?this.file=e:this.setAttachment(e,t)}_patch(e){this.id=e.id,this.size=e.size,this.url=e.url,this.proxyURL=e.proxy_url,this.height=e.height,this.width=e.width}}e.exports=MessageAttachment},function(e,t){function s(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function i(e){return"function"==typeof e}function n(e){return"number"==typeof e}function r(e){return"object"==typeof e&&null!==e}function o(e){return void 0===e}e.exports=s,s.EventEmitter=s,s.prototype._events=void 0,s.prototype._maxListeners=void 0,s.defaultMaxListeners=10,s.prototype.setMaxListeners=function(e){if(!n(e)||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},s.prototype.emit=function(e){var t,s,n,a,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(s=this._events[e],o(s))return!1;if(i(s))switch(arguments.length){case 1:s.call(this);break;case 2:s.call(this,arguments[1]);break;case 3:s.call(this,arguments[1],arguments[2]);break;default:a=Array.prototype.slice.call(arguments,1),s.apply(this,a)}else if(r(s))for(a=Array.prototype.slice.call(arguments,1),n=(l=s.slice()).length,c=0;c0&&this._events[e].length>n&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace()),this},s.prototype.on=s.prototype.addListener,s.prototype.once=function(e,t){function s(){this.removeListener(e,s),n||(n=!0,t.apply(this,arguments))}if(!i(t))throw TypeError("listener must be a function");var n=!1;return s.listener=t,this.on(e,s),this},s.prototype.removeListener=function(e,t){var s,n,o,a;if(!i(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(s=this._events[e],o=s.length,n=-1,s===t||i(s.listener)&&s.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(r(s)){for(a=o;a-- >0;)if(s[a]===t||s[a].listener&&s[a].listener===t){n=a;break}if(n<0)return this;1===s.length?(s.length=0,delete this._events[e]):s.splice(n,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},s.prototype.removeAllListeners=function(e){var t,s;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(s=this._events[e],i(s))this.removeListener(e,s);else if(s)for(;s.length;)this.removeListener(e,s[s.length-1]);return delete this._events[e],this},s.prototype.listeners=function(e){return this._events&&this._events[e]?i(this._events[e])?[this._events[e]]:this._events[e].slice():[]},s.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(i(t))return 1;if(t)return t.length}return 0},s.listenerCount=function(e,t){return e.listenerCount(t)}},function(e,t,s){const i=s(19),{Presence:n}=s(13),r=s(98),o=s(6),a=s(7),{Error:c}=s(4);class User extends a{constructor(e,t){super(e),this.id=t.id,this._patch(t)}_patch(e){e.username&&(this.username=e.username),e.discriminator&&(this.discriminator=e.discriminator),void 0!==e.avatar&&(this.avatar=e.avatar),void 0===this.bot&&void 0!==e.bot&&(this.bot=Boolean(e.bot)),this.lastMessageID=null,this.lastMessage=null,e.token&&(this.client.token=e.token)}get createdTimestamp(){return o.deconstruct(this.id).timestamp}get createdAt(){return new Date(this.createdTimestamp)}get presence(){if(this.client.presences.has(this.id))return this.client.presences.get(this.id);for(const e of this.client.guilds.values())if(e.presences.has(this.id))return e.presences.get(this.id);return new n}avatarURL({format:e,size:t}={}){return this.avatar?this.client.rest.cdn.Avatar(this.id,this.avatar,e,t):null}get defaultAvatarURL(){return this.client.rest.cdn.DefaultAvatar(this.discriminator%5)}displayAvatarURL(e){return this.avatarURL(e)||this.defaultAvatarURL}get tag(){return`${this.username}#${this.discriminator}`}get note(){return this.client.user.notes.get(this.id)||null}typingIn(e){return(e=this.client.channels.resolve(e))._typing.has(this.id)}typingSinceIn(e){return(e=this.client.channels.resolve(e))._typing.has(this.id)?new Date(e._typing.get(this.id).since):null}typingDurationIn(e){return(e=this.client.channels.resolve(e))._typing.has(this.id)?e._typing.get(this.id).elapsedTime:-1}get dmChannel(){return this.client.channels.filter(e=>"dm"===e.type).find(e=>e.recipient.id===this.id)}createDM(){return this.dmChannel?Promise.resolve(this.dmChannel):this.client.api.users(this.client.user.id).channels.post({data:{recipient_id:this.id}}).then(e=>this.client.actions.ChannelCreate.handle(e).channel)}deleteDM(){return this.dmChannel?this.client.api.channels(this.dmChannel.id).delete().then(e=>this.client.actions.ChannelDelete.handle(e).channel):Promise.reject(new c("USER_NO_DMCHANNEL"))}fetchProfile(){return this.client.api.users(this.id).profile.get().then(e=>new r(this,e))}setNote(e){return this.client.api.users("@me").notes(this.id).put({data:{note:e}}).then(()=>this)}equals(e){return e&&this.id===e.id&&this.username===e.username&&this.discriminator===e.discriminator&&this.avatar===e.avatar}toString(){return`<@${this.id}>`}send(){}}i.applyToClass(User),e.exports=User},function(e,t,s){const i=s(8),n=s(3),r=s(35),{Error:o}=s(4);class MessageStore extends i{constructor(e,t){super(e.client,t,r),this.channel=e}create(e,t){return super.create(e,t,{extras:[this.channel]})}set(e,t){const s=this.client.options.messageCacheMaxSize;0!==s&&(this.size>=s&&s>0&&this.delete(this.firstKey()),super.set(e,t))}fetch(e){return"string"==typeof e?this._fetchId(e):this._fetchMany(e)}fetchPinned(){return this.client.api.channels[this.channel.id].pins.get().then(e=>{const t=new n;for(const s of e)t.set(s.id,this.create(s));return t})}_fetchId(e){return this.client.user.bot?this.client.api.channels[this.channel.id].messages[e].get().then(e=>this.create(e)):this._fetchMany({limit:1,around:e}).then(t=>{const s=t.get(e);if(!s)throw new o("MESSAGE_MISSING");return s})}_fetchMany(e={}){return this.client.api.channels[this.channel.id].messages.get({query:e}).then(e=>{const t=new n;for(const s of e)t.set(s.id,this.create(s));return t})}}e.exports=MessageStore},function(e,t,s){const i=s(6),n=s(9),r=s(5),o=s(7),{TypeError:a}=s(4);class Role extends o{constructor(e,t,s){super(e),this.guild=s,t&&this._patch(t)}_patch(e){this.id=e.id,this.name=e.name,this.color=e.color,this.hoist=e.hoist,this.rawPosition=e.position,this.permissions=new n(e.permissions).freeze(),this.managed=e.managed,this.mentionable=e.mentionable}get createdTimestamp(){return i.deconstruct(this.id).timestamp}get createdAt(){return new Date(this.createdTimestamp)}get hexColor(){let e=this.color.toString(16);for(;e.length<6;)e=`0${e}`;return`#${e}`}get members(){return this.guild.members.filter(e=>e.roles.has(this.id))}get editable(){if(this.managed)return!1;const e=this.guild.member(this.client.user);return!!e.permissions.has(n.FLAGS.MANAGE_ROLES)&&e.highestRole.comparePositionTo(this)>0}get position(){const e=this.guild._sortedRoles();return e.array().indexOf(e.get(this.id))}comparePositionTo(e){return(e=this.guild.roles.resolve(e))?this.constructor.comparePositions(this,e):Promise.reject(new a("INVALID_TYPE","role","Role nor a Snowflake"))}edit(e,t){return e.permissions?e.permissions=n.resolve(e.permissions):e.permissions=this.permissions.bitfield,this.client.api.guilds[this.guild.id].roles[this.id].patch({data:{name:e.name||this.name,color:r.resolveColor(e.color||this.color),hoist:void 0!==e.hoist?e.hoist:this.hoist,position:void 0!==e.position?e.position:this.position,permissions:e.permissions,mentionable:void 0!==e.mentionable?e.mentionable:this.mentionable},reason:t}).then(e=>{const t=this._clone();return t._patch(e),t})}setName(e,t){return this.edit({name:e},t)}setColor(e,t){return this.edit({color:e},t)}setHoist(e,t){return this.edit({hoist:e},t)}setPermissions(e,t){return this.edit({permissions:e},t)}setMentionable(e,t){return this.edit({mentionable:e},t)}setPosition(e,{relative:t,reason:s}={}){return r.setPosition(this,e,t,this.guild._sortedRoles(),this.client.api.guilds(this.guild.id).roles,s).then(e=>(this.client.actions.GuildRolesPositionUpdate.handle({guild_id:this.id,channels:e}),this))}delete(e){return this.client.api.guilds[this.guild.id].roles[this.id].delete({reason:e}).then(()=>(this.client.actions.GuildRoleDelete.handle({guild_id:this.guild.id,role_id:this.id}),this))}equals(e){return e&&this.id===e.id&&this.name===e.name&&this.color===e.color&&this.hoist===e.hoist&&this.position===e.position&&this.permissions.bitfield===e.permissions.bitfield&&this.managed===e.managed}toString(){return this.id===this.guild.id?"@everyone":`<@&${this.id}>`}static comparePositions(e,t){return e.position===t.position?t.id-e.id:e.position-t.position}}e.exports=Role},function(e,t,s){const{Endpoints:i}=s(0),n=s(7);class Invite extends n{constructor(e,t){super(e),this._patch(t)}_patch(e){this.guild=this.client.guilds.create(e.guild,!1),this.code=e.code,this.presenceCount=e.approximate_presence_count,this.memberCount=e.approximate_member_count,this.textChannelCount=e.guild.text_channel_count,this.voiceChannelCount=e.guild.voice_channel_count,this.temporary=e.temporary,this.maxAge=e.max_age,this.uses=e.uses,this.maxUses=e.max_uses,e.inviter&&(this.inviter=this.client.users.create(e.inviter)),this.channel=this.client.channels.create(e.channel,this.guild,!1),this.createdTimestamp=new Date(e.created_at).getTime()}get createdAt(){return new Date(this.createdTimestamp)}get expiresTimestamp(){return this.createdTimestamp+1e3*this.maxAge}get expiresAt(){return new Date(this.expiresTimestamp)}get url(){return i.invite(this.client.options.http.invite,this.code)}delete(e){return this.client.api.invites[this.code].delete({reason:e}).then(()=>this)}toString(){return this.url}}e.exports=Invite},function(e,t,s){const i=s(25),n=s(55),r=s(16),o=s(12),a=s(56),{ChannelTypes:c,Events:l}=s(0),h=s(3),u=s(5),d=s(10),p=s(6),f=s(9),g=s(45),m=s(94),E=s(95),_=s(57),y=s(96),v=s(58),A=s(7),{Error:b,TypeError:w}=s(4);class Guild extends A{constructor(e,t){super(e),this.members=new m(this),this.channels=new y(this),this.roles=new E(this),this.presences=new v(this.client),t&&(t.unavailable?(this.available=!1,this.id=t.id):(this._patch(t),t.channels||(this.available=!1)))}_patch(e){if(this.name=e.name,this.icon=e.icon,this.splash=e.splash,this.region=e.region,this.memberCount=e.member_count||this.memberCount,this.large=Boolean("large"in e?e.large:this.large),this.features=e.features,this.applicationID=e.application_id,this.afkTimeout=e.afk_timeout,this.afkChannelID=e.afk_channel_id,this.systemChannelID=e.system_channel_id,this.embedEnabled=e.embed_enabled,this.verificationLevel=e.verification_level,this.explicitContentFilter=e.explicit_content_filter,this.joinedTimestamp=e.joined_at?new Date(e.joined_at).getTime():this.joinedTimestamp,this.id=e.id,this.available=!e.unavailable,this.features=e.features||this.features||[],e.members){this.members.clear();for(const t of e.members)this.members.create(t)}if(e.owner_id&&(this.ownerID=e.owner_id),e.channels){this.channels.clear();for(const t of e.channels)this.client.channels.create(t,this)}if(e.roles){this.roles.clear();for(const t of e.roles)this.roles.create(t)}if(e.presences)for(const t of e.presences)this.presences.create(t);if(this.voiceStates=new VoiceStateCollection(this),e.voice_states)for(const t of e.voice_states)this.voiceStates.set(t.user_id,t);if(this.emojis)this.client.actions.GuildEmojisUpdate.handle({guild_id:this.id,emojis:e.emojis});else if(this.emojis=new _(this),e.emojis)for(const t of e.emojis)this.emojis.create(t)}get createdTimestamp(){return p.deconstruct(this.id).timestamp}get createdAt(){return new Date(this.createdTimestamp)}get joinedAt(){return new Date(this.joinedTimestamp)}iconURL({format:e,size:t}={}){return this.icon?this.client.rest.cdn.Icon(this.id,this.icon,e,t):null}get nameAcronym(){return this.name.replace(/\w+/g,e=>e[0]).replace(/\s/g,"")}splashURL({format:e,size:t}={}){return this.splash?this.client.rest.cdn.Splash(this.id,this.splash,e,t):null}get owner(){return this.members.get(this.ownerID)}get afkChannel(){return this.client.channels.get(this.afkChannelID)||null}get systemChannel(){return this.client.channels.get(this.systemChannelID)||null}get voiceConnection(){return this.client.browser?null:this.client.voice.connections.get(this.id)||null}get position(){return this.client.user.bot?null:this.client.user.settings.guildPositions?this.client.user.settings.guildPositions.indexOf(this.id):null}get muted(){if(this.client.user.bot)return null;try{return this.client.user.guildSettings.get(this.id).muted}catch(e){return!1}}get messageNotifications(){if(this.client.user.bot)return null;try{return this.client.user.guildSettings.get(this.id).messageNotifications}catch(e){return null}}get mobilePush(){if(this.client.user.bot)return null;try{return this.client.user.guildSettings.get(this.id).mobilePush}catch(e){return!1}}get suppressEveryone(){if(this.client.user.bot)return null;try{return this.client.user.guildSettings.get(this.id).suppressEveryone}catch(e){return null}}get defaultRole(){return this.roles.get(this.id)}get me(){return this.members.get(this.client.user.id)}member(e){return this.members.resolve(e)}fetchBans(){return this.client.api.guilds(this.id).bans.get().then(e=>e.reduce((e,t)=>(e.set(t.user.id,{reason:t.reason,user:this.client.users.create(t.user)}),e),new h))}fetchInvites(){return this.client.api.guilds(this.id).invites.get().then(e=>{const t=new h;for(const s of e){const e=new i(this.client,s);t.set(e.code,e)}return t})}fetchWebhooks(){return this.client.api.guilds(this.id).webhooks.get().then(e=>{const t=new h;for(const s of e)t.set(s.id,new r(this.client,s));return t})}fetchVoiceRegions(){return this.client.api.guilds(this.id).regions.get().then(e=>{const t=new h;for(const s of e)t.set(s.id,new a(s));return t})}fetchAuditLogs(e={}){return e.before&&e.before instanceof n.Entry&&(e.before=e.before.id),e.after&&e.after instanceof n.Entry&&(e.after=e.after.id),"string"==typeof e.type&&(e.type=n.Actions[e.type]),this.client.api.guilds(this.id)["audit-logs"].get({query:{before:e.before,after:e.after,limit:e.limit,user_id:this.client.users.resolveID(e.user),action_type:e.type}}).then(e=>n.build(this,e))}addMember(e,t){if(this.members.has(e.id))return Promise.resolve(this.members.get(e.id));if(t.access_token=t.accessToken,t.roles){const e=[];for(let s of t.roles instanceof h?t.roles.values():t.roles){if(!(s=this.roles.resolve(s)))return Promise.reject(new w("INVALID_TYPE","options.roles","Array or Collection of Roles or Snowflakes",!0));e.push(s.id)}}return this.client.api.guilds(this.id).members(e.id).put({data:t}).then(e=>this.client.actions.GuildMemberGet.handle(this,e).member)}search(e={}){return g.search(this,e)}edit(e,t){const s={};return e.name&&(s.name=e.name),e.region&&(s.region=e.region),void 0!==e.verificationLevel&&(s.verification_level=Number(e.verificationLevel)),void 0!==e.afkChannel&&(s.afk_channel_id=this.client.channels.resolveID(e.afkChannel)),void 0!==e.systemChannel&&(s.system_channel_id=this.client.channels.resolveID(e.systemChannel)),e.afkTimeout&&(s.afk_timeout=Number(e.afkTimeout)),void 0!==e.icon&&(s.icon=e.icon),e.owner&&(s.owner_id=this.client.users.resolve(e.owner).id),e.splash&&(s.splash=e.splash),void 0!==e.explicitContentFilter&&(s.explicit_content_filter=Number(e.explicitContentFilter)),this.client.api.guilds(this.id).patch({data:s,reason:t}).then(e=>this.client.actions.GuildUpdate.handle(e).updated)}setExplicitContentFilter(e,t){return this.edit({explicitContentFilter:e},t)}setName(e,t){return this.edit({name:e},t)}setRegion(e,t){return this.edit({region:e},t)}setVerificationLevel(e,t){return this.edit({verificationLevel:e},t)}setAFKChannel(e,t){return this.edit({afkChannel:e},t)}setSystemChannel(e,t){return this.edit({systemChannel:e},t)}setAFKTimeout(e,t){return this.edit({afkTimeout:e},t)}async setIcon(e,t){return this.edit({icon:await d.resolveImage(e,this.client.browser),reason:t})}setOwner(e,t){return this.edit({owner:e},t)}async setSplash(e,t){return this.edit({splash:await d.resolveImage(e,this.client.browser),reason:t})}setPosition(e,t){return this.client.user.bot?Promise.reject(new b("FEATURE_USER_ONLY")):this.client.user.settings.setGuildPosition(this,e,t)}acknowledge(){return this.client.api.guilds(this.id).ack.post({data:{token:this.client.rest._ackToken}}).then(e=>(e.token&&(this.client.rest._ackToken=e.token),this))}allowDMs(e){const t=this.client.user.settings;return e?t.removeRestrictedGuild(this):t.addRestrictedGuild(this)}ban(e,t={days:0}){t.days&&(t["delete-message-days"]=t.days);const s=this.client.users.resolveID(e);return s?this.client.api.guilds(this.id).bans[s].put({query:t}).then(()=>{if(e instanceof o)return e;const t=this.client.users.resolve(s);return t?this.members.resolve(t)||t:s}):Promise.reject(new b("BAN_RESOLVE_ID",!0))}unban(e,t){const s=this.client.users.resolveID(e);if(!s)throw new b("BAN_RESOLVE_ID");return this.client.api.guilds(this.id).bans[s].delete({reason:t}).then(()=>e)}pruneMembers({days:e=7,dry:t=!1,reason:s}={}){if("number"!=typeof e)throw new w("PRUNE_DAYS_TYPE");return this.client.api.guilds(this.id).prune[t?"get":"post"]({query:{days:e},reason:s}).then(e=>e.pruned)}sync(){this.client.user.bot||this.client.syncGuilds([this])}createChannel(e,t,{overwrites:s,reason:i}={}){return(s instanceof h||s instanceof Array)&&(s=s.map(e=>{let t=e.allow||e.allowed.bitfield,s=e.deny||e.denied.bitfield;t instanceof Array&&(t=f.resolve(t)),s instanceof Array&&(s=f.resolve(s));const i=this.roles.resolve(e.id);return i?(e.id=i.id,e.type="role"):(e.id=this.client.users.resolveID(e.id),e.type="member"),{allow:t,deny:s,type:e.type,id:e.id}})),this.client.api.guilds(this.id).channels.post({data:{name:e,type:c[t.toUpperCase()],permission_overwrites:s},reason:i}).then(e=>this.client.actions.ChannelCreate.handle(e).channel)}setChannelPositions(e){const t=e.map(e=>({id:this.client.channels.resolveID(e.channel),position:e.position}));return this.client.api.guilds(this.id).channels.patch({data:t}).then(()=>this.client.actions.GuildChannelsPositionUpdate.handle({guild_id:this.id,channels:t}).guild)}createRole({data:e={},reason:t}={}){return e.color&&(e.color=u.resolveColor(e.color)),e.permissions&&(e.permissions=f.resolve(e.permissions)),this.client.api.guilds(this.id).roles.post({data:e,reason:t}).then(s=>{const{role:i}=this.client.actions.GuildRoleCreate.handle({guild_id:this.id,role:s});return e.position?i.setPosition(e.position,t):i})}createEmoji(e,t,{roles:s,reason:i}={}){if("string"==typeof e&&e.startsWith("data:")){const n={image:e,name:t};if(s){n.roles=[];for(let e of s instanceof h?s.values():s){if(!(e=this.roles.resolve(e)))return Promise.reject(new w("INVALID_TYPE","options.roles","Array or Collection of Roles or Snowflakes",!0));n.roles.push(e.id)}}return this.client.api.guilds(this.id).emojis.post({data:n,reason:i}).then(e=>this.client.actions.GuildEmojiCreate.handle(this,e).emoji)}return d.resolveImage(e,this.client.browser).then(e=>this.createEmoji(e,t,{roles:s,reason:i}))}leave(){return this.ownerID===this.client.user.id?Promise.reject(new b("GUILD_OWNED")):this.client.api.users("@me").guilds(this.id).delete().then(()=>this.client.actions.GuildDelete.handle({id:this.id}).guild)}delete(){return this.client.api.guilds(this.id).delete().then(()=>this.client.actions.GuildDelete.handle({id:this.id}).guild)}equals(e){let t=e&&e instanceof this.constructor&&this.id===e.id&&this.available===e.available&&this.splash===e.splash&&this.region===e.region&&this.name===e.name&&this.memberCount===e.memberCount&&this.large===e.large&&this.icon===e.icon&&u.arraysEqual(this.features,e.features)&&this.ownerID===e.ownerID&&this.verificationLevel===e.verificationLevel&&this.embedEnabled===e.embedEnabled;return t&&(this.embedChannel?e.embedChannel&&this.embedChannel.id===e.embedChannel.id||(t=!1):e.embedChannel&&(t=!1)),t}toString(){return this.name}_memberSpeakUpdate(e,t){const s=this.members.get(e);s&&s.speaking!==t&&(s.speaking=t,this.client.emit(l.GUILD_MEMBER_SPEAKING,s,t))}_sortedRoles(){return u.discordSort(this.roles)}_sortedChannels(e){const t=e.type===c.CATEGORY;return u.discordSort(this.channels.filter(s=>s.type===e.type&&(t||s.parent===e.parent)))}}class VoiceStateCollection extends h{constructor(e){super(),this.guild=e}set(e,t){const s=this.guild.members.get(e);if(s){s.voiceChannel&&s.voiceChannel.id!==t.channel_id&&s.voiceChannel.members.delete(s.id),t.channel_id||(s.speaking=null);const e=this.guild.channels.get(t.channel_id);e&&e.members.set(s.user.id,s)}super.set(e,t)}}e.exports=Guild},function(e,t){var s;s=function(){return this}();try{s=s||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(s=window)}e.exports=s},function(e,t,s){var i,n,r;!function(s,o){n=[],void 0!==(r="function"==typeof(i=o)?i.apply(t,n):i)&&(e.exports=r)}(0,function(){"use strict";function e(e,t,s){this.low=0|e,this.high=0|t,this.unsigned=!!s}function t(e){return!0===(e&&e.__isLong__)}function s(e,t){var s,i,r;return t?(e>>>=0,(r=0<=e&&e<256)&&(i=c[e])?i:(s=n(e,(0|e)<0?-1:0,!0),r&&(c[e]=s),s)):(e|=0,(r=-128<=e&&e<128)&&(i=a[e])?i:(s=n(e,e<0?-1:0,!1),r&&(a[e]=s),s))}function i(e,t){if(isNaN(e)||!isFinite(e))return t?g:f;if(t){if(e<0)return g;if(e>=u)return v}else{if(e<=-d)return A;if(e+1>=d)return y}return e<0?i(-e,t).neg():n(e%h|0,e/h|0,t)}function n(t,s,i){return new e(t,s,i)}function r(e,t,s){if(0===e.length)throw Error("empty string");if("NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return f;if("number"==typeof t?(s=t,t=!1):t=!!t,(s=s||10)<2||360)throw Error("interior hyphen");if(0===n)return r(e.substring(1),t,s).neg();for(var o=i(l(s,8)),a=f,c=0;c>>0:this.low},b.toNumber=function(){return this.unsigned?(this.high>>>0)*h+(this.low>>>0):this.high*h+(this.low>>>0)},b.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}},b.getHighBits=function(){return this.high},b.getHighBitsUnsigned=function(){return this.high>>>0},b.getLowBits=function(){return this.low},b.getLowBitsUnsigned=function(){return this.low>>>0},b.getNumBitsAbs=function(){if(this.isNegative())return this.eq(A)?64:this.neg().getNumBitsAbs();for(var e=0!=this.high?this.high:this.low,t=31;t>0&&0==(e&1<=0},b.isOdd=function(){return 1==(1&this.low)},b.isEven=function(){return 0==(1&this.low)},b.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)},b.eq=b.equals,b.notEquals=function(e){return!this.eq(e)},b.neq=b.notEquals,b.lessThan=function(e){return this.comp(e)<0},b.lt=b.lessThan,b.lessThanOrEqual=function(e){return this.comp(e)<=0},b.lte=b.lessThanOrEqual,b.greaterThan=function(e){return this.comp(e)>0},b.gt=b.greaterThan,b.greaterThanOrEqual=function(e){return this.comp(e)>=0},b.gte=b.greaterThanOrEqual,b.compare=function(e){if(t(e)||(e=o(e)),this.eq(e))return 0;var s=this.isNegative(),i=e.isNegative();return s&&!i?-1:!s&&i?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1},b.comp=b.compare,b.negate=function(){return!this.unsigned&&this.eq(A)?A:this.not().add(m)},b.neg=b.negate,b.add=function(e){t(e)||(e=o(e));var s=this.high>>>16,i=65535&this.high,r=this.low>>>16,a=65535&this.low,c=e.high>>>16,l=65535&e.high,h=e.low>>>16,u=0,d=0,p=0,f=0;return f+=a+(65535&e.low),p+=f>>>16,f&=65535,p+=r+h,d+=p>>>16,p&=65535,d+=i+l,u+=d>>>16,d&=65535,u+=s+c,u&=65535,n(p<<16|f,u<<16|d,this.unsigned)},b.subtract=function(e){return t(e)||(e=o(e)),this.add(e.neg())},b.sub=b.subtract,b.multiply=function(e){if(this.isZero())return f;if(t(e)||(e=o(e)),e.isZero())return f;if(this.eq(A))return e.isOdd()?A:f;if(e.eq(A))return this.isOdd()?A:f;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(p)&&e.lt(p))return i(this.toNumber()*e.toNumber(),this.unsigned);var s=this.high>>>16,r=65535&this.high,a=this.low>>>16,c=65535&this.low,l=e.high>>>16,h=65535&e.high,u=e.low>>>16,d=65535&e.low,g=0,m=0,E=0,_=0;return _+=c*d,E+=_>>>16,_&=65535,E+=a*d,m+=E>>>16,E&=65535,E+=c*u,m+=E>>>16,E&=65535,m+=r*d,g+=m>>>16,m&=65535,m+=a*u,g+=m>>>16,m&=65535,m+=c*h,g+=m>>>16,m&=65535,g+=s*d+r*u+a*h+c*l,g&=65535,n(E<<16|_,g<<16|m,this.unsigned)},b.mul=b.multiply,b.divide=function(e){if(t(e)||(e=o(e)),e.isZero())throw Error("division by zero");if(this.isZero())return this.unsigned?g:f;var s,n,r;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return g;if(e.gt(this.shru(1)))return E;r=g}else{if(this.eq(A))return e.eq(m)||e.eq(_)?A:e.eq(A)?m:(s=this.shr(1).div(e).shl(1)).eq(f)?e.isNegative()?m:_:(n=this.sub(e.mul(s)),r=s.add(n.div(e)));if(e.eq(A))return this.unsigned?g:f;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();r=f}for(n=this;n.gte(e);){s=Math.max(1,Math.floor(n.toNumber()/e.toNumber()));for(var a=Math.ceil(Math.log(s)/Math.LN2),c=a<=48?1:l(2,a-48),h=i(s),u=h.mul(e);u.isNegative()||u.gt(n);)u=(h=i(s-=c,this.unsigned)).mul(e);h.isZero()&&(h=m),r=r.add(h),n=n.sub(u)}return r},b.div=b.divide,b.modulo=function(e){return t(e)||(e=o(e)),this.sub(this.div(e).mul(e))},b.mod=b.modulo,b.not=function(){return n(~this.low,~this.high,this.unsigned)},b.and=function(e){return t(e)||(e=o(e)),n(this.low&e.low,this.high&e.high,this.unsigned)},b.or=function(e){return t(e)||(e=o(e)),n(this.low|e.low,this.high|e.high,this.unsigned)},b.xor=function(e){return t(e)||(e=o(e)),n(this.low^e.low,this.high^e.high,this.unsigned)},b.shiftLeft=function(e){return t(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?n(this.low<>>32-e,this.unsigned):n(0,this.low<>>e|this.high<<32-e,this.high>>e,this.unsigned):n(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},b.shr=b.shiftRight,b.shiftRightUnsigned=function(e){if(t(e)&&(e=e.toInt()),0===(e&=63))return this;var s=this.high;return e<32?n(this.low>>>e|s<<32-e,s>>>e,this.unsigned):32===e?n(s,0,this.unsigned):n(s>>>e-32,0,this.unsigned)},b.shru=b.shiftRightUnsigned,b.toSigned=function(){return this.unsigned?n(this.low,this.high,!1):this},b.toUnsigned=function(){return this.unsigned?this:n(this.low,this.high,!0)},b.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},b.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]},b.toBytesBE=function(){var e=this.high,t=this.low;return[e>>>24&255,e>>>16&255,e>>>8&255,255&e,t>>>24&255,t>>>16&255,t>>>8&255,255&t]},e})},function(e,t,s){e.exports=s(66)},function(e,t,s){"use strict";t.decode=t.parse=s(67),t.encode=t.stringify=s(68)},function(e,t,s){(function(e,i){function n(e,s){var i={seen:[],stylize:o};return arguments.length>=3&&(i.depth=arguments[2]),arguments.length>=4&&(i.colors=arguments[3]),g(s)?i.showHidden=s:s&&t._extend(i,s),y(i.showHidden)&&(i.showHidden=!1),y(i.depth)&&(i.depth=2),y(i.colors)&&(i.colors=!1),y(i.customInspect)&&(i.customInspect=!0),i.colors&&(i.stylize=r),c(i,e,i.depth)}function r(e,t){var s=n.styles[t];return s?"["+n.colors[s][0]+"m"+e+"["+n.colors[s][1]+"m":e}function o(e,t){return e}function a(e){var t={};return e.forEach(function(e,s){t[e]=!0}),t}function c(e,s,i){if(e.customInspect&&s&&T(s.inspect)&&s.inspect!==t.inspect&&(!s.constructor||s.constructor.prototype!==s)){var n=s.inspect(i,e);return _(n)||(n=c(e,n,i)),n}var r=l(e,s);if(r)return r;var o=Object.keys(s),g=a(o);if(e.showHidden&&(o=Object.getOwnPropertyNames(s)),w(s)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return h(s);if(0===o.length){if(T(s)){var m=s.name?": "+s.name:"";return e.stylize("[Function"+m+"]","special")}if(v(s))return e.stylize(RegExp.prototype.toString.call(s),"regexp");if(b(s))return e.stylize(Date.prototype.toString.call(s),"date");if(w(s))return h(s)}var E="",y=!1,A=["{","}"];if(f(s)&&(y=!0,A=["[","]"]),T(s)&&(E=" [Function"+(s.name?": "+s.name:"")+"]"),v(s)&&(E=" "+RegExp.prototype.toString.call(s)),b(s)&&(E=" "+Date.prototype.toUTCString.call(s)),w(s)&&(E=" "+h(s)),0===o.length&&(!y||0==s.length))return A[0]+E+A[1];if(i<0)return v(s)?e.stylize(RegExp.prototype.toString.call(s),"regexp"):e.stylize("[Object]","special");e.seen.push(s);var I;return I=y?u(e,s,i,g,o):o.map(function(t){return d(e,s,i,g,t,y)}),e.seen.pop(),p(I,E,A)}function l(e,t){if(y(t))return e.stylize("undefined","undefined");if(_(t)){var s="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(s,"string")}return E(t)?e.stylize(""+t,"number"):g(t)?e.stylize(""+t,"boolean"):m(t)?e.stylize("null","null"):void 0}function h(e){return"["+Error.prototype.toString.call(e)+"]"}function u(e,t,s,i,n){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")),y(o)){if(r&&n.match(/^\d+$/))return a;(o=JSON.stringify(""+n)).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,s){var i=0;return e.reduce(function(e,t){return i++,t.indexOf("\n")>=0&&i++,e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0)>60?s[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+s[1]:s[0]+t+" "+e.join(", ")+" "+s[1]}function f(e){return Array.isArray(e)}function g(e){return"boolean"==typeof e}function m(e){return null===e}function E(e){return"number"==typeof e}function _(e){return"string"==typeof e}function y(e){return void 0===e}function v(e){return A(e)&&"[object RegExp]"===I(e)}function A(e){return"object"==typeof e&&null!==e}function b(e){return A(e)&&"[object Date]"===I(e)}function w(e){return A(e)&&("[object Error]"===I(e)||e instanceof Error)}function T(e){return"function"==typeof e}function I(e){return Object.prototype.toString.call(e)}function S(e){return e<10?"0"+e.toString(10):e.toString(10)}function D(){var e=new Date,t=[S(e.getHours()),S(e.getMinutes()),S(e.getSeconds())].join(":");return[e.getDate(),O[e.getMonth()],t].join(" ")}function R(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var N=/%[sdj%]/g;t.format=function(e){if(!_(e)){for(var t=[],s=0;s=r)return e;switch(e){case"%s":return String(i[s++]);case"%d":return Number(i[s++]);case"%j":try{return JSON.stringify(i[s++])}catch(e){return"[Circular]"}default:return e}}),a=i[s];s{e(...s),this._timeouts.delete(i)},t);return this._timeouts.add(i),i}clearTimeout(e){clearTimeout(e),this._timeouts.delete(e)}setInterval(e,t,...s){const i=setInterval(e,t,...s);return this._intervals.add(i),i}clearInterval(e){clearInterval(e),this._intervals.delete(e)}}e.exports=BaseClient},function(e,t,s){(function(e){function s(e,t){for(var s=0,i=e.length-1;i>=0;i--){var n=e[i];"."===n?e.splice(i,1):".."===n?(e.splice(i,1),s++):s&&(e.splice(i,1),s--)}if(t)for(;s--;s)e.unshift("..");return e}function i(e,t){if(e.filter)return e.filter(t);for(var s=[],i=0;i=-1&&!n;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,n="/"===o.charAt(0))}return t=s(i(t.split("/"),function(e){return!!e}),!n).join("/"),(n?"/":"")+t||"."},t.normalize=function(e){var n=t.isAbsolute(e),r="/"===o(e,-1);return(e=s(i(e.split("/"),function(e){return!!e}),!n).join("/"))||n||(e="."),e&&r&&(e+="/"),(n?"/":"")+e},t.isAbsolute=function(e){return"/"===e.charAt(0)},t.join=function(){var e=Array.prototype.slice.call(arguments,0);return t.normalize(i(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,s){function i(e){for(var t=0;t=0&&""===e[s];s--);return t>s?[]:e.slice(t,s-t+1)}e=t.resolve(e).substr(1),s=t.resolve(s).substr(1);for(var n=i(e.split("/")),r=i(s.split("/")),o=Math.min(n.length,r.length),a=o,c=0;cthis.stop("time"),s.time))}handleCollect(...e){const t=this.collect(...e);t&&this.filter(...e,this.collected)&&(this.collected.set(t.key,t.value),this.emit("collect",t.value,...e),this.checkEnd())}handleDispose(...e){if(!this.options.dispose)return;const t=this.dispose(...e);if(!t||!this.filter(...e)||!this.collected.has(t))return;const s=this.collected.get(t);this.collected.delete(t),this.emit("dispose",s,...e),this.checkEnd()}get next(){return new Promise((e,t)=>{if(this.ended)return void t(this.collected);const s=()=>{this.removeListener("collect",i),this.removeListener("end",n)},i=t=>{s(),e(t)},n=()=>{s(),t(this.collected)};this.on("collect",i),this.on("end",n)})}stop(e="user"){this.ended||(this._timeout&&this.client.clearTimeout(this._timeout),this.ended=!0,this.emit("end",this.collected,e))}checkEnd(){const e=this.endReason();e&&this.stop(e)}collect(){}dispose(){}endReason(){}}e.exports=Collector},function(e,t,s){const i=s(47),n=s(20),r=s(14),o=s(48),a=s(36),c=s(5),l=s(3),h=s(92),{MessageTypes:u}=s(0),d=s(9),p=s(12),f=s(7),{Error:g,TypeError:m}=s(4);class Message extends f{constructor(e,t,s){super(e),this.channel=s,t&&this._patch(t)}_patch(e){this.id=e.id,this.type=u[e.type],this.content=e.content,this.author=this.client.users.create(e.author,!e.webhook_id),this.member=this.guild?this.guild.member(this.author)||null:null,this.pinned=e.pinned,this.tts=e.tts,this.nonce=e.nonce,this.system=6===e.type,this.embeds=e.embeds.map(e=>new r(e)),this.attachments=new l;for(const t of e.attachments)this.attachments.set(t.id,new n(t.url,t.filename,t));if(this.createdTimestamp=new Date(e.timestamp).getTime(),this.editedTimestamp=e.edited_timestamp?new Date(e.edited_timestamp).getTime():null,this.reactions=new h(this),e.reactions&&e.reactions.length>0)for(const t of e.reactions)this.reactions.create(t);this.mentions=new i(this,e.mentions,e.mention_roles,e.mention_everyone),this.webhookID=e.webhook_id||null,this.application=e.application?new a(this.client,e.application):null,this.activity=e.activity?{partyID:e.activity.party_id,type:e.activity.type}:null,this.hit="boolean"==typeof e.hit?e.hit:null,this._edits=[]}patch(e){const t=this._clone();if(this._edits.unshift(t),this.editedTimestamp=new Date(e.edited_timestamp).getTime(),"content"in e&&(this.content=e.content),"pinned"in e&&(this.pinned=e.pinned),"tts"in e&&(this.tts=e.tts),this.embeds="embeds"in e?e.embeds.map(e=>new r(e)):this.embeds.slice(),"attachments"in e){this.attachments=new l;for(const t of e.attachments)this.attachments.set(t.id,new n(t.url,t.filename,t))}else this.attachments=new l(this.attachments);this.mentions=new i(this,"mentions"in e?e.mentions:this.mentions.users,"mentions_roles"in e?e.mentions_roles:this.mentions.roles,"mention_everyone"in e?e.mention_everyone:this.mentions.everyone)}get createdAt(){return new Date(this.createdTimestamp)}get editedAt(){return this.editedTimestamp?new Date(this.editedTimestamp):null}get guild(){return this.channel.guild||null}get cleanContent(){return this.content.replace(/@(everyone|here)/g,"@​$1").replace(/<@!?[0-9]+>/g,e=>{const t=e.replace(/<|!|>|@/g,"");if("dm"===this.channel.type||"group"===this.channel.type)return this.client.users.has(t)?`@${this.client.users.get(t).username}`:e;const s=this.channel.guild.members.get(t);if(s)return s.nickname?`@${s.nickname}`:`@${s.user.username}`;{const s=this.client.users.get(t);return s?`@${s.username}`:e}}).replace(/<#[0-9]+>/g,e=>{const t=this.client.channels.get(e.replace(/<|#|>/g,""));return t?`#${t.name}`:e}).replace(/<@&[0-9]+>/g,e=>{if("dm"===this.channel.type||"group"===this.channel.type)return e;const t=this.guild.roles.get(e.replace(/<|@|>|&/g,""));return t?`@${t.name}`:e})}createReactionCollector(e,t={}){return new o(this,e,t)}awaitReactions(e,t={}){return new Promise((s,i)=>{this.createReactionCollector(e,t).once("end",(e,n)=>{t.errors&&t.errors.includes(n)?i(e):s(e)})})}get edits(){const e=this._edits.slice();return e.unshift(this),e}get editable(){return this.author.id===this.client.user.id}get deletable(){return this.author.id===this.client.user.id||this.guild&&this.channel.permissionsFor(this.client.user).has(d.FLAGS.MANAGE_MESSAGES)}get pinnable(){return!this.guild||this.channel.permissionsFor(this.client.user).has(d.FLAGS.MANAGE_MESSAGES)}edit(e,t){t||"object"!=typeof e||e instanceof Array?t||(t={}):(t=e,e=""),t instanceof r&&(t={embed:t}),void 0!==t.content&&(e=t.content),void 0!==e&&(e=c.resolveString(e));let{embed:s,code:i,reply:n}=t;if(s&&(s=new r(s)._apiTransform()),void 0===i||"boolean"==typeof i&&!0!==i||(e=c.escapeMarkdown(c.resolveString(e),!0),e=`\`\`\`${"boolean"!=typeof i?i||"":""}\n${e}\n\`\`\``),n&&"dm"!==this.channel.type){const t=this.client.users.resolveID(n);e=`${`<@${n instanceof p&&n.nickname?"!":""}${t}>`}${e?`, ${e}`:""}`}return this.client.api.channels[this.channel.id].messages[this.id].patch({data:{content:e,embed:s}}).then(e=>{const t=this._clone();return t._patch(e),t})}pin(){return this.client.api.channels(this.channel.id).pins(this.id).put().then(()=>this)}unpin(){return this.client.api.channels(this.channel.id).pins(this.id).delete().then(()=>this)}react(e){if(!(e=this.client.emojis.resolveIdentifier(e)))throw new m("EMOJI_TYPE");return this.client.api.channels(this.channel.id).messages(this.id).reactions(e,"@me").put().then(()=>this.client.actions.MessageReactionAdd.handle({user:this.client.user,channel:this.channel,message:this,emoji:c.parseEmoji(e)}).reaction)}clearReactions(){return this.client.api.channels(this.channel.id).messages(this.id).reactions.delete().then(()=>this)}delete({timeout:e=0,reason:t}={}){return e<=0?this.client.api.channels(this.channel.id).messages(this.id).delete({reason:t}).then(()=>this.client.actions.MessageDelete.handle({id:this.id,channel_id:this.channel.id}).message):new Promise(s=>{this.client.setTimeout(()=>{s(this.delete({reason:t}))},e)})}reply(e,t){return t||"object"!=typeof e||e instanceof Array?t||(t={}):(t=e,e=""),this.channel.send(e,Object.assign(t,{reply:this.member||this.author}))}acknowledge(){return this.client.api.channels(this.channel.id).messages(this.id).ack.post({data:{token:this.client.rest._ackToken}}).then(e=>(e.token&&(this.client.rest._ackToken=e.token),this))}fetchWebhook(){return this.webhookID?this.client.fetchWebhook(this.webhookID):Promise.reject(new g("WEBHOOK_MESSAGE"))}equals(e,t){if(!e)return!1;if(!e.author&&!e.attachments)return this.id===e.id&&this.embeds.length===e.embeds.length;let s=this.id===e.id&&this.author.id===e.author.id&&this.content===e.content&&this.tts===e.tts&&this.nonce===e.nonce&&this.embeds.length===e.embeds.length&&this.attachments.length===e.attachments.length;return s&&t&&(s=this.mentions.everyone===e.mentions.everyone&&this.createdTimestamp===new Date(t.timestamp).getTime()&&this.editedTimestamp===new Date(t.edited_timestamp).getTime()),s}toString(){return this.content}}e.exports=Message},function(e,t,s){const i=s(6),{ClientApplicationAssetTypes:n,Endpoints:r}=s(0),o=s(10),a=s(7);class ClientApplication extends a{constructor(e,t){super(e),this._patch(t)}_patch(e){this.id=e.id,this.name=e.name,this.description=e.description,this.icon=e.icon,this.cover=e.cover_image,this.rpcOrigins=e.rpc_origins,this.redirectURIs=e.redirect_uris,this.botRequireCodeGrant=e.bot_require_code_grant,this.botPublic=e.bot_public,this.rpcApplicationState=e.rpc_application_state,this.bot=e.bot,this.flags=e.flags,this.secret=e.secret,e.owner&&(this.owner=this.client.users.create(e.owner))}get createdTimestamp(){return i.deconstruct(this.id).timestamp}get createdAt(){return new Date(this.createdTimestamp)}iconURL({format:e,size:t}={}){return this.icon?this.client.rest.cdn.AppIcon(this.id,this.icon,{format:e,size:t}):null}coverImage({format:e,size:t}={}){return this.cover?r.CDN(this.client.options.http.cdn).AppIcon(this.id,this.cover,{format:e,size:t}):null}fetchAssets(){return this.client.api.applications(this.id).assets.get().then(e=>e.map(e=>({id:e.id,name:e.name,type:Object.keys(n)[e.type-1]})))}createAsset(e,t,s){return o.resolveBase64(t).then(t=>this.client.api.applications(this.id).assets.post({data:{name:e,data:t,type:n[s.toUpperCase()]}}))}resetSecret(){return this.client.api.oauth2.applications[this.id].reset.post().then(e=>new ClientApplication(this.client,e))}resetToken(){return this.client.api.oauth2.applications[this.id].bot.reset.post().then(e=>new ClientApplication(this.client,Object.assign({},this,{bot:e})))}toString(){return this.name}}e.exports=ClientApplication},function(e,t,s){const i=s(3),n=s(6),r=s(7),{TypeError:o}=s(4);class Emoji extends r{constructor(e,t,s){super(e),this.guild=s,this._patch(t)}_patch(e){this.id=e.id,this.name=e.name,this.requiresColons=e.require_colons,this.managed=e.managed,this._roles=e.roles}get createdTimestamp(){return n.deconstruct(this.id).timestamp}get createdAt(){return new Date(this.createdTimestamp)}get roles(){const e=new i;for(const t of this._roles)this.guild.roles.has(t)&&e.set(t,this.guild.roles.get(t));return e}get url(){return this.client.rest.cdn.Emoji(this.id)}get identifier(){return this.id?`${this.name}:${this.id}`:encodeURIComponent(this.name)}edit(e,t){return this.client.api.guilds(this.guild.id).emojis(this.id).patch({data:{name:e.name,roles:e.roles?e.roles.map(e=>e.id?e.id:e):void 0},reason:t}).then(()=>this)}setName(e,t){return this.edit({name:e},t)}addRestrictedRole(e){return this.addRestrictedRoles([e])}addRestrictedRoles(e){const t=new i(this.roles);for(let s of e instanceof i?e.values():e){if(!(s=this.guild.roles.resolve(s)))return Promise.reject(new o("INVALID_TYPE","roles","Array or Collection of Roles or Snowflakes",!0));t.set(s.id,s)}return this.edit({roles:t})}removeRestrictedRole(e){return this.removeRestrictedRoles([e])}removeRestrictedRoles(e){const t=new i(this.roles);for(let s of e instanceof i?e.values():e){if(!(s=this.guild.roles.resolve(s)))return Promise.reject(new o("INVALID_TYPE","roles","Array or Collection of Roles or Snowflakes",!0));t.has(s.id)&&t.delete(s.id)}return this.edit({roles:t})}toString(){return this.requiresColons?`<:${this.name}:${this.id}>`:this.name}delete(e){return this.client.api.guilds(this.guild.id).emojis(this.id).delete({reason:e}).then(()=>this)}equals(e){return e instanceof Emoji?e.id===this.id&&e.name===this.name&&e.managed===this.managed&&e.requiresColons===this.requiresColons&&e._roles===this._roles:e.id===this.id&&e.name===this.name&&e._roles===this._roles}}e.exports=Emoji},function(e,t){class ReactionEmoji{constructor(e,t,s){this.reaction=e,this.name=t,this.id=s}get identifier(){return this.id?`${this.name}:${this.id}`:encodeURIComponent(this.name)}toString(){return this.id?`<:${this.name}:${this.id}>`:this.name}}e.exports=ReactionEmoji},function(e,t){e.exports={name:"discord.js",version:"12.0.0-dev",description:"A powerful library for interacting with the Discord API",main:"./src/index",types:"./typings/index.d.ts",scripts:{test:"npm run lint && npm run docs:test",docs:"docgen --source src --custom docs/index.yml --output docs/docs.json --jsdoc jsdoc.json","docs:test":"docgen --source src --custom docs/index.yml --jsdoc jsdoc.json",lint:"eslint src *.js","lint:fix":"eslint --fix src",webpack:"parallel-webpack"},repository:{type:"git",url:"git+https://github.com/hydrabolt/discord.js.git"},keywords:["discord","api","bot","client","node","discordapp"],author:"Amish Shah ",license:"Apache-2.0",bugs:{url:"https://github.com/hydrabolt/discord.js/issues"},homepage:"https://github.com/hydrabolt/discord.js#readme",runkitExampleFilename:"./docs/examples/ping.js",dependencies:{long:"^3.0.0","prism-media":"^0.0.1",snekfetch:"^3.0.0",tweetnacl:"^1.0.0",ws:"^3.0.0"},peerDependencies:{bufferutil:"^3.0.0",erlpack:"discordapp/erlpack","node-opus":"^0.2.0",opusscript:"^0.0.3",sodium:"^2.0.0","libsodium-wrappers":"^0.5.0",uws:"^8.14.0"},devDependencies:{"@types/node":"^8.0.0","discord.js-docgen":"hydrabolt/discord.js-docgen",eslint:"^4.0.0","jsdoc-strip-async-await":"^0.1.0","parallel-webpack":"^2.0.0","uglifyjs-webpack-plugin":"^1.0.0-beta.2",webpack:"^3.0.0"},engines:{node:">=8.0.0"},browser:{ws:!1,uws:!1,erlpack:!1,"prism-media":!1,opusscript:!1,"node-opus":!1,tweetnacl:!1,sodium:!1,"src/sharding/Shard.js":!1,"src/sharding/ShardClientUtil.js":!1,"src/sharding/ShardingManager.js":!1,"src/client/voice/dispatcher/StreamDispatcher.js":!1,"src/client/voice/opus/BaseOpusEngine.js":!1,"src/client/voice/opus/NodeOpusEngine.js":!1,"src/client/voice/opus/OpusEngineList.js":!1,"src/client/voice/opus/OpusScriptEngine.js":!1,"src/client/voice/pcm/ConverterEngine.js":!1,"src/client/voice/pcm/ConverterEngineList.js":!1,"src/client/voice/pcm/FfmpegConverterEngine.js":!1,"src/client/voice/player/AudioPlayer.js":!1,"src/client/voice/receiver/VoiceReadable.js":!1,"src/client/voice/receiver/VoiceReceiver.js":!1,"src/client/voice/util/Secretbox.js":!1,"src/client/voice/util/SecretKey.js":!1,"src/client/voice/util/VolumeInterface.js":!1,"src/client/voice/ClientVoiceManager.js":!1,"src/client/voice/VoiceBroadcast.js":!1,"src/client/voice/VoiceConnection.js":!1,"src/client/voice/VoiceUDPClient.js":!1,"src/client/voice/VoiceWebSocket.js":!1}}},function(e,t,s){function i(e){return class DiscordjsError extends e{constructor(e,...t){super(n(e,t)),this[r]=e,Error.captureStackTrace&&Error.captureStackTrace(this,DiscordjsError)}get name(){return`${super.name} [${this[r]}]`}get code(){return this[r]}}}function n(e,t){a.strictEqual(typeof e,"string");const s=o.get(e);a(s,`An invalid error message key was used: ${e}.`);let i=c.format;if("function"==typeof s)i=s;else{if(void 0===t||0===t.length)return s;t.unshift(s)}return String(i(...t))}const r=Symbol("code"),o=new Map,a=s(72),c=s(31);e.exports={register:function(e,t){o.set(e,"function"==typeof t?t:String(t))},Error:i(Error),TypeError:i(TypeError),RangeError:i(RangeError)}},function(e,t,s){const i=s(77),n=s(78),r=s(82),o=s(83),{Error:a}=s(4),{Endpoints:c}=s(0);class RESTManager{constructor(e,t="Bot"){this.client=e,this.handlers={},this.userAgentManager=new i(this),this.rateLimitedEndpoints={},this.globallyRateLimited=!1,this.tokenPrefix=t,this.versioned=!0}get api(){return o(this)}getAuth(){const e=this.client.token||this.client.accessToken,t=!!this.client.application||this.client.user&&this.client.user.bot;if(e&&t)return`${this.tokenPrefix} ${e}`;if(e)return e;throw new a("TOKEN_MISSING")}get cdn(){return c.CDN(this.client.options.http.cdn)}destroy(){for(const e of Object.values(this.handlers))e.destroy&&e.destroy()}push(e,t){return new Promise((s,i)=>{e.push({request:t,resolve:s,reject:i})})}getRequestHandler(){const e=this.client.options.apiRequestMethod;if("function"==typeof e)return e;const t=n[e];if(!t)throw new a("RATELIMIT_INVALID_METHOD");return t}request(e,t,s={}){const i=new r(this,e,t,s);return this.handlers[i.route]||(this.handlers[i.route]=new n.RequestHandler(this,this.getRequestHandler())),this.push(this.handlers[i.route],i)}set endpoint(e){this.client.options.http.api=e}}e.exports=RESTManager},function(e,t){class DiscordAPIError extends Error{constructor(e,t){super();const s=this.constructor.flattenErrors(t.errors||t).join("\n");this.name="DiscordAPIError",this.message=t.message&&s?`${t.message}\n${s}`:t.message||s,this.path=e,this.code=t.code}static flattenErrors(e,t=""){let s=[];for(const[i,n]of Object.entries(e)){if("message"===i)continue;const e=t?isNaN(i)?`${t}.${i}`:`${t}[${i}]`:i;n._errors?s.push(`${e}: ${n._errors.map(e=>e.message).join(" ")}`):n.code||n.message?s.push(`${n.code?`${n.code}: `:""}${n.message}`.trim()):"string"==typeof n?s.push(n):s=s.concat(this.flattenErrors(n,e))}return s}}e.exports=DiscordAPIError},function(e,t,s){const i=s(22),n=s(3),r=s(59),o=s(60),{Events:a}=s(0),c=s(5),l=s(10),h=s(26);class ClientUser extends i{_patch(e){if(super._patch(e),this.verified=e.verified,this.email=e.email,this._typing=new Map,this.friends=new n,this.blocked=new n,this.notes=new n,this.premium="boolean"==typeof e.premium?e.premium:null,this.mfaEnabled="boolean"==typeof e.mfa_enabled?e.mfa_enabled:null,this.mobile="boolean"==typeof e.mobile?e.mobile:null,this.settings=e.user_settings?new r(this,e.user_settings):null,this.guildSettings=new n,e.user_guild_settings)for(const t of e.user_guild_settings)this.guildSettings.set(t.guild_id,new o(this.client,t))}get presence(){return this.client.presences.clientPresence}edit(e,t){return this.bot||("object"!=typeof t?e.password=t:(e.code=t.mfaCode,e.password=t.password)),this.client.api.users("@me").patch({data:e}).then(e=>(this.client.token=e.token,this.client.actions.UserUpdate.handle(e).updated))}setUsername(e,t){return this.edit({username:e},t)}setEmail(e,t){return this.edit({email:e},t)}setPassword(e,t){return this.edit({new_password:e},{password:t.oldPassword,mfaCode:t.mfaCode})}async setAvatar(e){return this.edit({avatar:await l.resolveImage(e,this.client.browser)})}setPresence(e){return this.client.presences.setClientPresence(e)}setStatus(e){return this.setPresence({status:e})}setActivity(e,{url:t,type:s}={}){return e?this.setPresence({activity:{name:e,type:s,url:t}}):this.setPresence({activity:null})}setAFK(e){return this.setPresence({afk:e})}fetchMentions(e={}){return e.guild instanceof h&&(e.guild=e.guild.id),c.mergeDefault({limit:25,roles:!0,everyone:!0,guild:null},e),this.client.api.users("@me").mentions.get({query:e}).then(e=>e.map(e=>this.client.channels.get(e.channel_id).messages.create(e,!1)))}createGuild(e,{region:t,icon:s=null}={}){return!s||"string"==typeof s&&s.startsWith("data:")?new Promise((i,n)=>this.client.api.guilds.post({data:{name:e,region:t,icon:s}}).then(e=>{if(this.client.guilds.has(e.id))return i(this.client.guilds.get(e.id));const t=n=>{n.id===e.id&&(this.client.removeListener(a.GUILD_CREATE,t),this.client.clearTimeout(s),i(n))};this.client.on(a.GUILD_CREATE,t);const s=this.client.setTimeout(()=>{this.client.removeListener(a.GUILD_CREATE,t),i(this.client.guilds.create(e))},1e4)},n)):l.resolveImage(s,this.client.browser).then(s=>this.createGuild(e,{region:t,icon:s||null}))}createGroupDM(e){const t=this.bot?{access_tokens:e.map(e=>e.accessToken),nicks:e.reduce((e,t)=>(t.nick&&(e[t.user?t.user.id:t.id]=t.nick),e),{})}:{recipients:e.map(e=>this.client.users.resolveID(e.user||e.id))};return this.client.api.users("@me").channels.post({data:t}).then(e=>this.client.channels.create(e))}}e.exports=ClientUser},function(e,t,s){const i=s(34),{Events:n}=s(0);class MessageCollector extends i{constructor(e,t,s={}){super(e.client,t,s),this.channel=e,this.received=0;const i=(e=>{for(const t of e.values())this.handleDispose(t)}).bind(this);this.client.on(n.MESSAGE_CREATE,this.handleCollect),this.client.on(n.MESSAGE_DELETE,this.handleDispose),this.client.on(n.MESSAGE_BULK_DELETE,i),this.once("end",()=>{this.client.removeListener(n.MESSAGE_CREATE,this.handleCollect),this.client.removeListener(n.MESSAGE_DELETE,this.handleDispose),this.client.removeListener(n.MESSAGE_BULK_DELETE,i)})}collect(e){return e.channel.id!==this.channel.id?null:(this.received++,{key:e.id,value:e})}dispose(e){return e.channel.id===this.channel.id?e.id:null}endReason(){return this.options.max&&this.collected.size>=this.options.max?"limit":this.options.maxProcessed&&this.received===this.options.maxProcessed?"processedLimit":null}}e.exports=MessageCollector},function(e,t,s){e.exports={search:s(91),sendMessage:s(97)}},function(e,t,s){const i=s(11),n=s(19),r=s(23);class DMChannel extends i{constructor(e,t){super(e,t),this.messages=new r(this),this._typing=new Map}_patch(e){super._patch(e),this.recipient=this.client.users.create(e.recipients[0]),this.lastMessageID=e.last_message_id}toString(){return this.recipient.toString()}send(){}search(){}startTyping(){}stopTyping(){}get typing(){}get typingCount(){}createMessageCollector(){}awaitMessages(){}acknowledge(){}_cacheMessage(){}}n.applyToClass(DMChannel,!0,["bulkDelete"]),e.exports=DMChannel},function(e,t,s){const i=s(3),n=s(12);class MessageMentions{constructor(e,t,s,n){if(this.everyone=Boolean(n),t)if(t instanceof i)this.users=new i(t);else{this.users=new i;for(const s of t){let t=e.client.users.create(s);this.users.set(t.id,t)}}else this.users=new i;if(s)if(s instanceof i)this.roles=new i(s);else{this.roles=new i;for(const t of s){const s=e.channel.guild.roles.get(t);s&&this.roles.set(s.id,s)}}else this.roles=new i;this._content=e.content,this._client=e.client,this._guild=e.channel.guild,this._members=null,this._channels=null}get members(){return this._members?this._members:this._guild?(this._members=new i,this.users.forEach(e=>{const t=this._guild.member(e);t&&this._members.set(t.user.id,t)}),this._members):null}get channels(){if(this._channels)return this._channels;this._channels=new i;let e;for(;null!==(e=this.constructor.CHANNELS_PATTERN.exec(this._content));){const t=this._client.channels.get(e[1]);t&&this._channels.set(t.id,t)}return this._channels}has(e,t=!0){if(t&&this.everyone)return!0;if(t&&e instanceof n)for(const t of this.roles.values())if(e.roles.has(t.id))return!0;const s=e.id||e;return this.users.has(s)||this.channels.has(s)||this.roles.has(s)}}MessageMentions.EVERYONE_PATTERN=/@(everyone|here)/g,MessageMentions.USERS_PATTERN=/<@!?(1|\d{17,19})>/g,MessageMentions.ROLES_PATTERN=/<@&(\d{17,19})>/g,MessageMentions.CHANNELS_PATTERN=/<#(\d{17,19})>/g,e.exports=MessageMentions},function(e,t,s){const i=s(34),n=s(3),{Events:r}=s(0);class ReactionCollector extends i{constructor(e,t,s={}){super(e.client,t,s),this.message=e,this.users=new n,this.total=0,this.empty=this.empty.bind(this),this.client.on(r.MESSAGE_REACTION_ADD,this.handleCollect),this.client.on(r.MESSAGE_REACTION_REMOVE,this.handleDispose),this.client.on(r.MESSAGE_REACTION_REMOVE_ALL,this.empty),this.once("end",()=>{this.client.removeListener(r.MESSAGE_REACTION_ADD,this.handleCollect),this.client.removeListener(r.MESSAGE_REACTION_REMOVE,this.handleDispose),this.client.removeListener(r.MESSAGE_REACTION_REMOVE_ALL,this.empty)}),this.on("collect",(e,t,s)=>{this.total++,this.users.set(s.id,s)}),this.on("dispose",(e,t,s)=>{this.total--,this.collected.some(e=>e.users.has(s.id))||this.users.delete(s.id)})}collect(e){return e.message.id!==this.message.id?null:{key:ReactionCollector.key(e),value:e}}dispose(e){return e.message.id!==this.message.id||e.count?null:ReactionCollector.key(e)}empty(){this.total=0,this.collected.clear(),this.users.clear(),this.checkEnd()}endReason(){return this.options.max&&this.total>=this.options.max?"limit":this.options.maxEmojis&&this.collected.size>=this.options.maxEmojis?"emojiLimit":this.options.maxUsers&&this.users.size>=this.options.maxUsers?"userLimit":null}static key(e){return e.emoji.id||e.emoji.name}}e.exports=ReactionCollector},function(e,t){},function(e,t,s){const i=s(3),n=s(37),r=s(38),{Error:o}=s(4);class MessageReaction{constructor(e,t,s){this.message=s,this.me=t.me,this.count=t.count||0,this.users=new i,this._emoji=new r(this,t.emoji.name,t.emoji.id)}get emoji(){if(this._emoji instanceof n)return this._emoji;if(this._emoji.id){const e=this.message.client.emojis;if(e.has(this._emoji.id)){const t=e.get(this._emoji.id);return this._emoji=t,t}}return this._emoji}remove(e=this.message.client.user){const t=this.message.client.users.resolveID(e);return t?this.message.client.api.channels[this.message.channel.id].messages[this.message.id].reactions[this.emoji.identifier][t===this.message.client.user.id?"@me":t].delete().then(()=>this.message.client.actions.MessageReactionRemove.handle({user_id:t,message_id:this.message.id,emoji:this.emoji,channel_id:this.message.channel.id}).reaction):Promise.reject(new o("REACTION_RESOLVE_USER"))}async fetchUsers({limit:e=100,after:t}={}){const s=this.message,i=await s.client.api.channels[s.channel.id].messages[s.id].reactions[this.emoji.identifier].get({query:{limit:e,after:t}});for(const e of i){const t=s.client.users.create(e);this.users.set(t.id,t)}return this.count=this.users.size,this.users}_add(e){this.users.has(e.id)||(this.users.set(e.id,e),this.count++),this.me||(this.me=e.id===this.message.client.user.id)}_remove(e){this.users.has(e.id)&&(this.users.delete(e.id),this.count--,e.id===this.message.client.user.id&&(this.me=!1),this.count<=0&&this.message.reactions.remove(this.emoji.id||this.emoji.name))}}e.exports=MessageReaction},function(e,t,s){const i=s(11),n=s(19),r=s(3),o=s(10),a=s(23);class GroupDMChannel extends i{constructor(e,t){super(e,t),this.messages=new a(this),this._typing=new Map}_patch(e){if(super._patch(e),this.name=e.name,this.icon=e.icon,this.ownerID=e.owner_id,this.managed=e.managed,this.applicationID=e.application_id,e.nicks&&(this.nicks=new r(e.nicks.map(e=>[e.id,e.nick]))),this.recipients||(this.recipients=new r),e.recipients)for(const t of e.recipients){const e=this.client.users.create(t);this.recipients.set(e.id,e)}this.lastMessageID=e.last_message_id}get owner(){return this.client.users.get(this.ownerID)}iconURL({format:e,size:t}={}){return this.icon?this.client.rest.cdn.GDMIcon(this.id,this.icon,e,t):null}equals(e){const t=e&&this.id===e.id&&this.name===e.name&&this.icon===e.icon&&this.ownerID===e.ownerID;return t?this.recipients.equals(e.recipients):t}edit(e,t){return this.client.api.channels[this.id].patch({data:{icon:e.icon,name:null===e.name?null:e.name||this.name},reason:t}).then(()=>this)}async setIcon(e){return this.edit({icon:await o.resolveImage(e,this.client.browser)})}setName(e){return this.edit({name:e})}addUser({user:e,accessToken:t,nick:s}){const i=this.client.users.resolveID(e),n=this.client.user.bot?{nick:s,access_token:t}:{recipient:i};return this.client.api.channels[this.id].recipients[i].put({data:n}).then(()=>this)}removeUser(e){const t=this.client.users.resolveID(e);return this.client.api.channels[this.id].recipients[t].delete().then(()=>this)}toString(){return this.name}send(){}search(){}startTyping(){}stopTyping(){}get typing(){}get typingCount(){}createMessageCollector(){}awaitMessages(){}acknowledge(){}_cacheMessage(){}}n.applyToClass(GroupDMChannel,!0,["bulkDelete"]),e.exports=GroupDMChannel},function(e,t,s){const i=s(15),n=s(16),r=s(19),o=s(3),a=s(10),c=s(23);class TextChannel extends i{constructor(e,t){super(e,t),this.messages=new c(this),this._typing=new Map}_patch(e){if(super._patch(e),this.topic=e.topic,this.nsfw=Boolean(e.nsfw),this.lastMessageID=e.last_message_id,e.messages)for(const t of e.messages)this.messages.create(t)}fetchWebhooks(){return this.client.api.channels[this.id].webhooks.get().then(e=>{const t=new o;for(const s of e)t.set(s.id,new n(this.client,s));return t})}async createWebhook(e,{avatar:t,reason:s}={}){return"string"!=typeof t||t.startsWith("data:")||(t=await a.resolveImage(t,this.client.browser)),this.client.api.channels[this.id].webhooks.post({data:{name:e,avatar:t},reason:s}).then(e=>new n(this.client,e))}send(){}search(){}startTyping(){}stopTyping(){}get typing(){}get typingCount(){}createMessageCollector(){}awaitMessages(){}bulkDelete(){}acknowledge(){}_cacheMessage(){}}r.applyToClass(TextChannel,!0),e.exports=TextChannel},function(e,t,s){const i=s(9);class PermissionOverwrites{constructor(e,t){Object.defineProperty(this,"channel",{value:e}),t&&this._patch(t)}_patch(e){this.id=e.id,this.type=e.type,this.denied=new i(e.deny).freeze(),this.allowed=new i(e.allow).freeze()}delete(e){return this.channel.client.api.channels[this.channel.id].permissions[this.id].delete({reason:e}).then(()=>this)}}e.exports=PermissionOverwrites},function(e,t,s){const i=s(15),n=s(3),{Error:r}=s(4);class VoiceChannel extends i{constructor(e,t){super(e,t),Object.defineProperty(this,"members",{value:new n})}_patch(e){super._patch(e),this.bitrate=.001*e.bitrate,this.userLimit=e.user_limit}get connection(){const e=this.guild.voiceConnection;return e&&e.channel.id===this.id?e:null}get full(){return this.userLimit>0&&this.members.size>=this.userLimit}get joinable(){return!this.client.browser&&(!!this.permissionsFor(this.client.user).has("CONNECT")&&!(this.full&&!this.permissionsFor(this.client.user).has("MOVE_MEMBERS")))}get speakable(){return this.permissionsFor(this.client.user).has("SPEAK")}setBitrate(e,t){return e*=1e3,this.edit({bitrate:e},t)}setUserLimit(e,t){return this.edit({userLimit:e},t)}join(){return this.client.browser?Promise.reject(new r("VOICE_NO_BROWSER")):this.client.voice.joinChannel(this)}leave(){if(this.client.browser)return;const e=this.client.voice.connections.get(this.guild.id);e&&e.channel.id===this.id&&e.disconnect()}}e.exports=VoiceChannel},function(e,t,s){const i=s(3),n=s(6),r=s(16),o={ALL:"ALL",GUILD:"GUILD",CHANNEL:"CHANNEL",USER:"USER",ROLE:"ROLE",INVITE:"INVITE",WEBHOOK:"WEBHOOK",EMOJI:"EMOJI",MESSAGE:"MESSAGE",UNKNOWN:"UNKNOWN"},a={ALL:null,GUILD_UPDATE:1,CHANNEL_CREATE:10,CHANNEL_UPDATE:11,CHANNEL_DELETE:12,CHANNEL_OVERWRITE_CREATE:13,CHANNEL_OVERWRITE_UPDATE:14,CHANNEL_OVERWRITE_DELETE:15,MEMBER_KICK:20,MEMBER_PRUNE:21,MEMBER_BAN_ADD:22,MEMBER_BAN_REMOVE:23,MEMBER_UPDATE:24,MEMBER_ROLE_UPDATE:25,ROLE_CREATE:30,ROLE_UPDATE:31,ROLE_DELETE:32,INVITE_CREATE:40,INVITE_UPDATE:41,INVITE_DELETE:42,WEBHOOK_CREATE:50,WEBHOOK_UPDATE:51,WEBHOOK_DELETE:52,EMOJI_CREATE:60,EMOJI_UPDATE:61,EMOJI_DELETE:62,MESSAGE_DELETE:72};class GuildAuditLogs{constructor(e,t){if(t.users)for(const s of t.users)e.client.users.create(s);if(this.webhooks=new i,t.webhooks)for(const s of t.webhooks)this.webhooks.set(s.id,new r(e.client,s));this.entries=new i;for(const s of t.audit_log_entries){const t=new GuildAuditLogsEntry(e,s);this.entries.set(t.id,t)}}static build(...e){const t=new GuildAuditLogs(...e);return Promise.all(t.entries.map(e=>e.target)).then(()=>t)}static targetType(e){return e<10?o.GUILD:e<20?o.CHANNEL:e<30?o.USER:e<40?o.ROLE:e<50?o.INVITE:e<60?o.WEBHOOK:e<70?o.EMOJI:e<80?o.MESSAGE:o.UNKNOWN}static actionType(e){return[a.CHANNEL_CREATE,a.CHANNEL_OVERWRITE_CREATE,a.MEMBER_BAN_REMOVE,a.ROLE_CREATE,a.INVITE_CREATE,a.WEBHOOK_CREATE,a.EMOJI_CREATE].includes(e)?"CREATE":[a.CHANNEL_DELETE,a.CHANNEL_OVERWRITE_DELETE,a.MEMBER_KICK,a.MEMBER_PRUNE,a.MEMBER_BAN_ADD,a.ROLE_DELETE,a.INVITE_DELETE,a.WEBHOOK_DELETE,a.EMOJI_DELETE,a.MESSAGE_DELETE].includes(e)?"DELETE":[a.GUILD_UPDATE,a.CHANNEL_UPDATE,a.CHANNEL_OVERWRITE_UPDATE,a.MEMBER_UPDATE,a.MEMBER_ROLE_UPDATE,a.ROLE_UPDATE,a.INVITE_UPDATE,a.WEBHOOK_UPDATE,a.EMOJI_UPDATE].includes(e)?"UPDATE":"ALL"}}class GuildAuditLogsEntry{constructor(e,t){const s=GuildAuditLogs.targetType(t.action_type);if(this.targetType=s,this.actionType=GuildAuditLogs.actionType(t.action_type),this.action=Object.keys(a).find(e=>a[e]===t.action_type),this.reason=t.reason||null,this.executor=e.client.users.get(t.user_id),this.changes=t.changes?t.changes.map(e=>({key:e.key,old:e.old_value,new:e.new_value})):null,this.id=t.id,this.extra=null,t.options)if(t.action_type===a.MEMBER_PRUNE)this.extra={removed:t.options.members_removed,days:t.options.delete_member_days};else if(t.action_type===a.MESSAGE_DELETE)this.extra={count:t.options.count,channel:e.channels.get(t.options.channel_id)};else switch(t.options.type){case"member":this.extra=e.members.get(t.options.id),this.extra||(this.extra={id:t.options.id});break;case"role":this.extra=e.roles.get(t.options.id),this.extra||(this.extra={id:t.options.id,name:t.options.role_name})}if(s===o.UNKNOWN)this.target=this.changes.reduce((e,t)=>(e[t.key]=t.new||t.old,e),{}),this.target.id=t.target_id;else if([o.USER,o.GUILD].includes(s))this.target=e.client[`${s.toLowerCase()}s`].get(t.target_id);else if(s===o.WEBHOOK)this.target=this.webhooks.get(t.target_id);else if(s===o.INVITE)if(e.me.permissions.has("MANAGE_GUILD")){const t=this.changes.find(e=>"code"===e.key);this.target=e.fetchInvites().then(e=>(this.target=e.find(e=>e.code===(t.new||t.old)),this.target))}else this.target=this.changes.reduce((e,t)=>(e[t.key]=t.new||t.old,e),{});else s===o.MESSAGE?this.target=e.client.users.get(t.target_id):this.target=e[`${s.toLowerCase()}s`].get(t.target_id)}get createdTimestamp(){return n.deconstruct(this.id).timestamp}get createdAt(){return new Date(this.createdTimestamp)}}GuildAuditLogs.Actions=a,GuildAuditLogs.Targets=o,GuildAuditLogs.Entry=GuildAuditLogsEntry,e.exports=GuildAuditLogs},function(e,t){class VoiceRegion{constructor(e){this.id=e.id,this.name=e.name,this.vip=e.vip,this.deprecated=e.deprecated,this.optimal=e.optimal,this.custom=e.custom,this.sampleHostname=e.sample_hostname}}e.exports=VoiceRegion},function(e,t,s){const i=s(8),n=s(37),r=s(38);class EmojiStore extends i{constructor(e,t){super(e.client,t,n),this.guild=e}create(e,t){return super.create(e,t,{extras:[this.guild]})}resolve(e){return e instanceof r?super.resolve(e.id):super.resolve(e)}resolveID(e){return e instanceof r?e.id:super.resolveID(e)}resolveIdentifier(e){const t=this.resolve(e);return t?t.identifier:"string"==typeof e?e.includes("%")?e:encodeURIComponent(e):null}}e.exports=EmojiStore},function(e,t,s){const i=s(8),{Presence:n}=s(13);class PresenceStore extends i{constructor(e,t){super(e,t,n)}create(e,t){const s=this.get(e.user.id);return s?s.patch(e):super.create(e,t,{id:e.user.id})}resolve(e){const t=super.resolve(e);if(t)return t;const s=this.client.users.resolveID(e);return super.resolve(s)||null}resolveID(e){const t=super.resolveID(e);if(t)return t;const s=this.client.users.resolveID(e);return this.has(s)?s:null}}e.exports=PresenceStore},function(e,t,s){const{UserSettingsMap:i}=s(0),n=s(5),{Error:r}=s(4);class ClientUserSettings{constructor(e,t){this.user=e,this.patch(t)}patch(e){for(const[t,s]of Object.entries(i))e.hasOwnProperty(t)&&("function"==typeof s?this[s.name]=s(e[t]):this[s]=e[t])}update(e,t){return this.user.client.api.users["@me"].settings.patch({data:{[e]:t}})}setGuildPosition(e,t,s){const i=Object.assign([],this.guildPositions);return n.moveElementInArray(i,e.id,t,s),this.update("guild_positions",i).then(()=>e)}addRestrictedGuild(e){const t=Object.assign([],this.restrictedGuilds);return t.includes(e.id)?Promise.reject(new r("GUILD_RESTRICTED",!0)):(t.push(e.id),this.update("restricted_guilds",t).then(()=>e))}removeRestrictedGuild(e){const t=Object.assign([],this.restrictedGuilds),s=t.indexOf(e.id);return s<0?Promise.reject(new r("GUILD_RESTRICTED")):(t.splice(s,1),this.update("restricted_guilds",t).then(()=>e))}}e.exports=ClientUserSettings},function(e,t,s){const{UserGuildSettingsMap:i}=s(0),n=s(3),r=s(100);class ClientUserGuildSettings{constructor(e,t){Object.defineProperty(this,"client",{value:e}),this.guildID=t.guild_id,this.channelOverrides=new n,this.patch(t)}patch(e){for(const[t,s]of Object.entries(i))if(e.hasOwnProperty(t))if("channel_overrides"===t)for(const s of e[t]){const e=this.channelOverrides.get(s.channel_id);e?e.patch(s):this.channelOverrides.set(s.channel_id,new r(s))}else"function"==typeof s?this[s.name]=s(e[t]):this[s]=e[t]}update(e,t){return this.client.api.users("@me").guilds(this.guildID).settings.patch({data:{[e]:t}})}}e.exports=ClientUserGuildSettings},function(e,t,s){(function(e){const i="undefined"!=typeof window,n=s(49),r=s(30);if(i)t.WebSocket=window.WebSocket;else try{t.WebSocket=s(137)}catch(e){t.WebSocket=s(138)}try{var o=s(139);o.pack||(o=null)}catch(e){}t.encoding=o?"etf":"json",t.pack=o?o.pack:JSON.stringify,t.unpack=(t=>(Array.isArray(t)&&(t=e.concat(t)),t instanceof ArrayBuffer&&(t=e.from(new Uint8Array(t))),o&&"string"!=typeof t?o.unpack(t):(t instanceof e&&(t=n.inflateSync(t).toString()),JSON.parse(t)))),t.create=((e,s={},...n)=>{s.encoding=t.encoding;const o=new t.WebSocket(`${e}?${r.stringify(s)}`,...n);return i&&(o.binaryType="arraybuffer"),o});for(const e of["CONNECTING","OPEN","CLOSING","CLOSED"])t[e]=t.WebSocket[e]}).call(t,s(17).Buffer)},function(e,t,s){const i=s(5);e.exports={BaseClient:s(32),Client:s(84),Shard:s(175),ShardClientUtil:s(176),ShardingManager:s(177),WebhookClient:s(178),Collection:s(3),Constants:s(0),DataResolver:s(10),DiscordAPIError:s(42),EvaluatedPermissions:s(9),Permissions:s(9),Snowflake:s(6),SnowflakeUtil:s(6),Util:i,util:i,version:s(39).version,escapeMarkdown:i.escapeMarkdown,fetchRecommendedShards:i.fetchRecommendedShards,splitMessage:i.splitMessage,Activity:s(13).Activity,Channel:s(11),ClientUser:s(43),ClientUserSettings:s(59),Collector:s(34),DMChannel:s(46),Emoji:s(37),GroupDMChannel:s(51),Guild:s(26),GuildAuditLogs:s(55),GuildChannel:s(15),GuildMember:s(12),Invite:s(25),Message:s(35),MessageAttachment:s(20),MessageCollector:s(44),MessageEmbed:s(14),MessageMentions:s(47),MessageReaction:s(50),ClientApplication:s(36),PermissionOverwrites:s(53),Presence:s(13).Presence,ReactionEmoji:s(38),ReactionCollector:s(48),Role:s(24),TextChannel:s(52),User:s(22),VoiceChannel:s(54),Webhook:s(16),WebSocket:s(61)}},function(e,t,s){"use strict";function i(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 n(e){return o[e>>18&63]+o[e>>12&63]+o[e>>6&63]+o[63&e]}function r(e,t,s){for(var i,r=[],o=t;o0?l-4:l;var h=0;for(t=0;t>16&255,o[h++]=n>>8&255,o[h++]=255&n;return 2===r?(n=a[e.charCodeAt(t)]<<2|a[e.charCodeAt(t+1)]>>4,o[h++]=255&n):1===r&&(n=a[e.charCodeAt(t)]<<10|a[e.charCodeAt(t+1)]<<4|a[e.charCodeAt(t+2)]>>2,o[h++]=n>>8&255,o[h++]=255&n),o},t.fromByteArray=function(e){for(var t,s=e.length,i=s%3,n="",a=[],c=0,l=s-i;cl?l:c+16383));return 1===i?(t=e[s-1],n+=o[t>>2],n+=o[t<<4&63],n+="=="):2===i&&(t=(e[s-2]<<8)+e[s-1],n+=o[t>>10],n+=o[t>>4&63],n+=o[t<<2&63],n+="="),a.push(n),a.join("")};for(var o=[],a=[],c="undefined"!=typeof Uint8Array?Uint8Array:Array,l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",h=0,u=l.length;h>1,h=-7,u=s?n-1:0,d=s?-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+=i;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,i),r-=l}return(p?-1:1)*o*Math.pow(2,r-i)},t.write=function(e,t,s,i,n,r){var o,a,c,l=8*r-n-1,h=(1<>1,d=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,p=i?0:r-1,f=i?1:-1,g=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,n),o+=u):(a=t*Math.pow(2,u-1)*Math.pow(2,n),o=0));n>=8;e[s+p]=255&a,p+=f,a/=256,n-=8);for(o=o<0;e[s+p]=255&o,p+=f,o/=256,l-=8);e[s+p-f]|=128*g}},function(e,t){var s={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==s.call(e)}},function(e,t,s){const i="undefined"!=typeof window,n=s(30),r=s(69),o=s(i?70:71);class Snekfetch extends(o.extension||Object){constructor(e,t,s={headers:null,data:null,query:null,version:1}){super(),this.options=s,this.request=o.buildRequest.call(this,e,t,s),s.query&&this.query(s.query),s.data&&this.send(s.data)}query(e,t){if(this.response)throw new Error("Cannot modify query after being sent!");if(this.request.query||(this.request.query=i?new URLSearchParams:{}),null!==e&&"object"==typeof e)for(const[t,s]of Object.entries(e))this.query(t,s);else i?this.request.query.set(e,t):this.request.query[e]=t;return 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,s){if(this.response)throw new Error("Cannot modify data after being sent!");const i=this._getFormData();return this.set("Content-Type",`multipart/form-data; boundary=${i.boundary}`),i.append(e,t,s),this.data=i,this}send(e){if(this.response)throw new Error("Cannot modify data after being sent!");if(o.shouldSendRaw(e))this.data=e;else if(null!==e&&"object"==typeof e){const t=this._getRequestHeader("content-type");let s;t?t.includes("json")?s=JSON.stringify:t.includes("urlencoded")&&(s=n.stringify):(this.set("Content-Type","application/json"),s=JSON.stringify),this.data=s(e)}else this.data=e;return this}then(e,t){o.finalizeRequest.call(this,{data:this.data?this.data.end?this.data.end():this.data:null}).then(({response:e,raw:t,redirect:s,headers:i})=>{if(s){let t=this.request.method;[301,302].includes(e.statusCode)?("HEAD"!==t&&(t="GET"),this.data=null):303===e.statusCode&&(t="GET");const i={};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}return new Snekfetch(t,s,{data:this.data,headers:i,agent:this.options._req.agent})}const r=e.statusCode||e.status,a={request:this.request,get body(){delete a.body;const e=this.headers["content-type"];if(e&&e.includes("application/json"))try{a.body=JSON.parse(a.text)}catch(e){a.body=a.text}else e&&e.includes("application/x-www-form-urlencoded")?a.body=n.parse(a.text):a.body=t;return a.body},text:t.toString(),ok:r>=200&&r<400,headers:i||e.headers,status:r,statusText:e.statusText||o.STATUS_CODES[e.statusCode]};if(a.ok)return a;{const e=new Error(`${a.status} ${a.statusText}`.trim());return Object.assign(e,a),Promise.reject(e)}}).then(e,t)}catch(e){return this.then(null,e)}end(e){return this.then(t=>e?e(null,t):t,t=>e?e(t,t.status?t:null):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!1!==this.options.followRedirects&&[301,302,303,307,308].includes(e.statusCode)}_getFormData(){return this._formData||(this._formData=new o.FormData),this._formData}_addFinalHeaders(){this.request&&(this._getRequestHeader("user-agent")||this.set("User-Agent",`snekfetch/${Snekfetch.version} (${r.repository.url.replace(/\.?git/,"")})`),"HEAD"!==this.request.method&&this.set("Accept-Encoding","gzip, deflate"),this.data&&this.data.end&&this.set("Content-Length",this.data.length))}get response(){return this.request?this.request.res||this.request._response||null:null}_getRequestHeader(e){try{return this.request.getHeader(e)}catch(e){return null}}}Snekfetch.version=r.version,Snekfetch.METHODS=o.METHODS.concat("BREW");for(const e of Snekfetch.METHODS)Snekfetch["M-SEARCH"===e?"msearch":e.toLowerCase()]=((t,s)=>new Snekfetch(e,t,s));e.exports=Snekfetch},function(e,t,s){"use strict";function i(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.exports=function(e,t,s,r){t=t||"&",s=s||"=";var o={};if("string"!=typeof e||0===e.length)return o;var a=/\+/g;e=e.split(t);var c=1e3;r&&"number"==typeof r.maxKeys&&(c=r.maxKeys);var l=e.length;c>0&&l>c&&(l=c);for(var h=0;h=0?(u=g.substr(0,m),d=g.substr(m+1)):(u=g,d=""),p=decodeURIComponent(u),f=decodeURIComponent(d),i(o,p)?n(o[p])?o[p].push(f):o[p]=[o[p],f]:o[p]=f}return o};var n=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},function(e,t,s){"use strict";function i(e,t){if(e.map)return e.map(t);for(var s=[],i=0;ie.text().then(t=>{const s={};for(const[t,i]of e.headers)s[t.toLowerCase()]=i;return{response:e,raw:t,headers:s}}))},shouldSendRaw:function(){return!1},METHODS:["GET","POST","PUT","DELETE","OPTIONS","HEAD"],STATUS_CODES:{},FormData:window.FormData}},function(e,t){},function(e,t,s){"use strict";(function(t){function i(e,t){if(e===t)return 0;for(var s=e.length,i=t.length,n=0,r=Math.min(s,i);n=0;a--)if(c[a]!==l[a])return!1;for(a=c.length-1;a>=0;a--)if(o=c[a],!p(e[o],t[o],s,i))return!1;return!0}function m(e,t,s){p(e,t,!0)&&u(e,t,s,"notDeepStrictEqual",m)}function E(e,t){if(!e||!t)return!1;if("[object RegExp]"==Object.prototype.toString.call(t))return t.test(e);try{if(e instanceof t)return!0}catch(e){}return!Error.isPrototypeOf(t)&&!0===t.call({},e)}function _(e){var t;try{e()}catch(e){t=e}return t}function y(e,t,s,i){var n;if("function"!=typeof t)throw new TypeError('"block" argument must be a function');"string"==typeof s&&(i=s,s=null),n=_(t),i=(s&&s.name?" ("+s.name+").":".")+(i?" "+i:"."),e&&!n&&u(n,s,"Missing expected exception"+i);var r="string"==typeof i,o=!e&&v.isError(n),a=!e&&n&&!s;if((o&&r&&E(n,s)||a)&&u(n,s,"Got unwanted exception"+i),e&&n&&s&&!E(n,s)||!e&&n)throw n}var v=s(31),A=Object.prototype.hasOwnProperty,b=Array.prototype.slice,w="foo"===function(){}.name,T=e.exports=d,I=/\s*function\s+([^\(\s]*)\s*/;T.AssertionError=function(e){this.name="AssertionError",this.actual=e.actual,this.expected=e.expected,this.operator=e.operator,e.message?(this.message=e.message,this.generatedMessage=!1):(this.message=h(this),this.generatedMessage=!0);var t=e.stackStartFunction||u;if(Error.captureStackTrace)Error.captureStackTrace(this,t);else{var s=new Error;if(s.stack){var i=s.stack,n=a(t),r=i.indexOf("\n"+n);if(r>=0){var o=i.indexOf("\n",r+1);i=i.substring(o+1)}this.stack=i}}},v.inherits(T.AssertionError,Error),T.fail=u,T.ok=d,T.equal=function(e,t,s){e!=t&&u(e,t,s,"==",T.equal)},T.notEqual=function(e,t,s){e==t&&u(e,t,s,"!=",T.notEqual)},T.deepEqual=function(e,t,s){p(e,t,!1)||u(e,t,s,"deepEqual",T.deepEqual)},T.deepStrictEqual=function(e,t,s){p(e,t,!0)||u(e,t,s,"deepStrictEqual",T.deepStrictEqual)},T.notDeepEqual=function(e,t,s){p(e,t,!1)&&u(e,t,s,"notDeepEqual",T.notDeepEqual)},T.notDeepStrictEqual=m,T.strictEqual=function(e,t,s){e!==t&&u(e,t,s,"===",T.strictEqual)},T.notStrictEqual=function(e,t,s){e===t&&u(e,t,s,"!==",T.notStrictEqual)},T.throws=function(e,t,s){y(!0,e,t,s)},T.doesNotThrow=function(e,t,s){y(!1,e,t,s)},T.ifError=function(e){if(e)throw e};var S=Object.keys||function(e){var t=[];for(var s in e)A.call(e,s)&&t.push(s);return t}}).call(t,s(27))},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 s=function(){};s.prototype=t.prototype,e.prototype=new s,e.prototype.constructor=e}},function(e,t,s){const{register:i}=s(40),n={CLIENT_INVALID_OPTION:(e,t)=>`The ${e} option must be ${t}`,TOKEN_INVALID:"An invalid token was provided.",TOKEN_MISSING:"Request to use token, but token was unavailable to the client.",FEATURE_USER_ONLY:"Only user accounts are able to make use of this feature.",WS_CONNECTION_TIMEOUT:"The connection to the gateway timed out.",WS_CONNECTION_EXISTS:"There is already an existing WebSocket connection.",WS_NOT_OPEN:(e="data")=>`Websocket not open to send ${e}`,PERMISSION_INVALID:"Invalid permission string or number.",RATELIMIT_INVALID_METHOD:"Unknown rate limiting method.",SHARDING_INVALID:"Invalid shard settings were provided.",SHARDING_REQUIRED:"This session would have handled too many guilds - Sharding is required.",SHARDING_CHILD_CONNECTION:"Failed to send message to shard's process.",SHARDING_PARENT_CONNECTION:"Failed to send message to master process.",SHARDING_NO_SHARDS:"No shards have been spawned",SHARDING_IN_PROCESS:"Shards are still being spawned",SHARDING_ALREADY_SPAWNED:e=>`Already spawned ${e} shards`,COLOR_RANGE:"Color must be within the range 0 - 16777215 (0xFFFFFF).",COLOR_CONVERT:"Unable to convert color to a number.",EMBED_FIELD_COUNT:"MessageEmbeds may not exceed 25 fields.",EMBED_FIELD_NAME:"MessageEmbed field names may not exceed 256 characters or be empty.",EMBED_FIELD_VALUE:"MessageEmbed field values may not exceed 1024 characters or be empty.",EMBED_DESCRIPTION:"MessageEmbed descriptions may not exceed 2048 characters.",EMBED_FOOTER_TEXT:"MessageEmbed footer text may not exceed 2048 characters.",EMBED_TITLE:"MessageEmbed titles may not exceed 256 characters.",FILE_NOT_FOUND:e=>`File could not be found: ${e}`,USER_NO_DMCHANNEL:"No DM Channel exists!",VOICE_INVALID_HEARTBEAT:"Tried to set voice heartbeat but no valid interval was specified.",VOICE_USER_MISSING:"Couldn't resolve the user to create stream.",VOICE_STREAM_EXISTS:"There is already an existing stream for that user.",VOICE_JOIN_CHANNEL:(e=!1)=>`You do not have permission to join this voice channel${e?"; it is full.":"."}`,VOICE_CONNECTION_TIMEOUT:"Connection not established within 15 seconds.",VOICE_TOKEN_ABSENT:"Token not provided from voice server packet.",VOICE_SESSION_ABSENT:"Session ID not supplied.",VOICE_INVALID_ENDPOINT:"Invalid endpoint received.",VOICE_NO_BROWSER:"Voice connections are not available in browsers.",VOICE_CONNECTION_ATTEMPTS_EXCEEDED:e=>`Too many connection attempts (${e}).`,VOICE_JOIN_SOCKET_CLOSED:"Tried to send join packet, but the WebSocket is not open.",OPUS_ENGINE_MISSING:"Couldn't find an Opus engine.",UDP_SEND_FAIL:"Tried to send a UDP packet, but there is no socket available.",UDP_ADDRESS_MALFORMED:"Malformed UDP address or port.",UDP_CONNECTION_EXISTS:"There is already an existing UDP connection.",REQ_BODY_TYPE:"The response body isn't a Buffer.",REQ_RESOURCE_TYPE:"The resource must be a string, Buffer or a valid file stream.",IMAGE_FORMAT:e=>`Invalid image format: ${e}`,IMAGE_SIZE:e=>`Invalid image size: ${e}`,MESSAGE_MISSING:"Message not found",MESSAGE_BULK_DELETE_TYPE:"The messages must be an Array, Collection, or number.",MESSAGE_NONCE_TYPE:"Message nonce must fit in an unsigned 64-bit integer.",TYPING_COUNT:"Count must be at least 1",SPLIT_MAX_LEN:"Message exceeds the max length and contains no split characters.",BAN_RESOLVE_ID:(e=!1)=>`Couldn't resolve the user ID to ${e?"ban":"unban"}.`,PRUNE_DAYS_TYPE:"Days must be a number",SEARCH_CHANNEL_TYPE:"Target must be a TextChannel, DMChannel, GroupDMChannel, or Guild.",MESSAGE_SPLIT_MISSING:"Message exceeds the max length and contains no split characters.",GUILD_CHANNEL_RESOLVE:"Could not resolve channel to a guild channel.",GUILD_CHANNEL_ORPHAN:"Could not find a parent to this guild channel.",GUILD_OWNED:"Guild is owned by the client.",GUILD_RESTRICTED:(e=!1)=>`Guild is ${e?"already":"not"} restricted.`,GUILD_MEMBERS_TIMEOUT:"Members didn't arrive in time.",INVALID_TYPE:(e,t,s=!1)=>`Supplied ${e} is not a${s?"n":""} ${t}.`,WEBHOOK_MESSAGE:"The message was not sent by a webhook.",EMOJI_TYPE:"Emoji must be a string or Emoji/ReactionEmoji",REACTION_RESOLVE_USER:"Couldn't resolve the user ID to remove from the reaction."};for(const[e,t]of Object.entries(n))i(e,t)},function(e,t){t.endianness=function(){return"LE"},t.hostname=function(){return"undefined"!=typeof location?location.hostname:""},t.loadavg=function(){return[]},t.uptime=function(){return 0},t.freemem=function(){return Number.MAX_VALUE},t.totalmem=function(){return Number.MAX_VALUE},t.cpus=function(){return[]},t.type=function(){return"Browser"},t.release=function(){return"undefined"!=typeof navigator?navigator.appVersion:""},t.networkInterfaces=t.getNetworkInterfaces=function(){return{}},t.arch=function(){return"javascript"},t.platform=function(){return"browser"},t.tmpdir=t.tmpDir=function(){return"/tmp"},t.EOL="\n"},function(e,t,s){(function(t){const{Package:i}=s(0);class UserAgentManager{constructor(){this.build(this.constructor.DEFAULT)}set({url:e,version:t}={}){this.build({url:e||this.constructor.DFEAULT.url,version:t||this.constructor.DEFAULT.version})}build(e){this.userAgent=`DiscordBot (${e.url}, ${e.version}) Node.js/${t.version}`}}UserAgentManager.DEFAULT={url:i.homepage.split("#")[0],version:i.version},e.exports=UserAgentManager}).call(t,s(18))},function(e,t,s){e.exports={sequential:s(79),burst:s(80),RequestHandler:s(81)}},function(e,t){e.exports=function(){this.busy||this.limited||0===this.queue.length||(this.busy=!0,this.execute(this.queue.shift()).then(()=>{this.busy=!1,this.handle()}).catch(({timeout:e})=>{this.client.setTimeout(()=>{this.reset(),this.busy=!1,this.handle()},e||this.resetTime-Date.now()+this.timeDifference+this.client.options.restTimeOffset)}))}},function(e,t){e.exports=function(){this.limited||0===this.queue.length||(this.execute(this.queue.shift()).then(this.handle.bind(this)).catch(({timeout:e})=>{this.client.setTimeout(()=>{this.reset(),this.handle()},e||this.resetTime-Date.now()+this.timeDifference+this.client.options.restTimeOffset)}),this.remaining--,this.handle())}},function(e,t,s){const i=s(42);class RequestHandler{constructor(e,t){this.manager=e,this.client=this.manager.client,this.handle=t.bind(this),this.limit=1/0,this.resetTime=null,this.remaining=1,this.timeDifference=0,this.queue=[]}get limited(){return this.manager.globallyRateLimited||this.remaining<=0}set globallyLimited(e){this.manager.globallyRateLimited=e}push(e){this.queue.push(e),this.handle()}execute(e){return new Promise((t,s)=>{const n=e=>{e||this.limited?s({timeout:e,limited:this.limited}):t()};e.request.gen().end((t,s)=>{if(s&&s.headers&&(s.headers["x-ratelimit-global"]&&(this.globallyLimited=!0),this.limit=Number(s.headers["x-ratelimit-limit"]),this.resetTime=1e3*Number(s.headers["x-ratelimit-reset"]),this.remaining=Number(s.headers["x-ratelimit-remaining"]),this.timeDifference=Date.now()-new Date(s.headers.date).getTime()),t)429===t.status?(this.queue.unshift(e),n(Number(s.headers["retry-after"])+this.client.options.restTimeOffset)):t.status>=500&&t.status<600?(this.queue.unshift(e),n(1e3+this.client.options.restTimeOffset)):(e.reject(t.status>=400&&t.status<500?new i(s.request.path,s.body):t),n());else{const t=s&&s.body?s.body:{};e.resolve(t),n()}})})}reset(){this.globallyLimited=!1,this.remaining=1}}e.exports=RequestHandler},function(e,t,s){const i=s(30),n=s(29);class APIRequest{constructor(e,t,s,i){this.rest=e,this.client=e.client,this.method=t,this.path=s.toString(),this.route=i.route,this.options=i}gen(){const e=!1===this.options.versioned?this.client.options.http.api:`${this.client.options.http.api}/v${this.client.options.http.version}`;if(this.options.query){const e=(i.stringify(this.options.query).match(/[^=&?]+=[^=&?]+/g)||[]).join("&");this.path+=`?${e}`}const t=n[this.method](`${e}${this.path}`);if(!1!==this.options.auth&&t.set("Authorization",this.rest.getAuth()),this.options.reason&&t.set("X-Audit-Log-Reason",encodeURIComponent(this.options.reason)),this.rest.client.browser||t.set("User-Agent",this.rest.userAgentManager.userAgent),this.options.headers&&t.set(this.options.headers),this.options.files){for(const e of this.options.files)e&&e.file&&t.attach(e.name,e.file,e.name);void 0!==this.options.data&&t.attach("payload_json",JSON.stringify(this.options.data))}else void 0!==this.options.data&&t.send(this.options.data);return t}}e.exports=APIRequest},function(e,t,s){const i=s(31),n=()=>{},r=["get","post","delete","patch","put"],o=["toString","valueOf","inspect","constructor",Symbol.toPrimitive,i.inspect.custom];e.exports=function(e){const t=[""],s={get:(i,a)=>o.includes(a)?()=>t.join("/"):r.includes(a)?s=>e.request(a,t.join("/"),Object.assign({versioned:e.versioned,route:t.map((e,s)=>/\d{16,19}/g.test(e)?/channels|guilds/.test(t[s-1])?e:":id":e).join("/")},s)):(t.push(a),new Proxy(n,s)),apply:(e,i,r)=>(t.push(...r.filter(e=>null!=e)),new Proxy(n,s))};return new Proxy(n,s)}},function(module,exports,__webpack_require__){(function(process){const BaseClient=__webpack_require__(32),Permissions=__webpack_require__(9),RESTManager=__webpack_require__(41),ClientManager=__webpack_require__(85),ClientVoiceManager=__webpack_require__(86),WebSocketManager=__webpack_require__(87),ActionsManager=__webpack_require__(140),Collection=__webpack_require__(3),VoiceRegion=__webpack_require__(56),Webhook=__webpack_require__(16),Invite=__webpack_require__(25),ClientApplication=__webpack_require__(36),ShardClientUtil=__webpack_require__(169),VoiceBroadcast=__webpack_require__(170),UserStore=__webpack_require__(171),ChannelStore=__webpack_require__(172),GuildStore=__webpack_require__(173),ClientPresenceStore=__webpack_require__(174),EmojiStore=__webpack_require__(57),{Events:Events}=__webpack_require__(0),DataResolver=__webpack_require__(10),{Error:Error,TypeError:TypeError,RangeError:RangeError}=__webpack_require__(4);class Client extends BaseClient{constructor(e={}){super(Object.assign({_tokenType:"Bot"},e)),!this.options.shardId&&"SHARD_ID"in process.env&&(this.options.shardId=Number(process.env.SHARD_ID)),!this.options.shardCount&&"SHARD_COUNT"in process.env&&(this.options.shardCount=Number(process.env.SHARD_COUNT)),this._validateOptions(),this.rest=new RESTManager(this),this.manager=new ClientManager(this),this.ws=new WebSocketManager(this),this.actions=new ActionsManager(this),this.voice=this.browser?null:new ClientVoiceManager(this),this.shard=process.send?ShardClientUtil.singleton(this):null,this.users=new UserStore(this),this.guilds=new GuildStore(this),this.channels=new ChannelStore(this),this.presences=new ClientPresenceStore(this),Object.defineProperty(this,"token",{writable:!0}),!this.token&&"CLIENT_TOKEN"in process.env?this.token=process.env.CLIENT_TOKEN:this.token=null,this.user=null,this.readyAt=null,this.broadcasts=[],this.pings=[],this._timeouts=new Set,this._intervals=new Set,this.options.messageSweepInterval>0&&this.setInterval(this.sweepMessages.bind(this),1e3*this.options.messageSweepInterval)}get _pingTimestamp(){return this.ws.connection?this.ws.connection.lastPingTimestamp:0}get status(){return this.ws.connection?this.ws.connection.status:null}get uptime(){return this.readyAt?Date.now()-this.readyAt:null}get ping(){return this.pings.reduce((e,t)=>e+t,0)/this.pings.length}get voiceConnections(){return this.browser?new Collection:this.voice.connections}get emojis(){const e=new EmojiStore({client:this});for(const t of this.guilds.values())if(t.available)for(const s of t.emojis.values())e.set(s.id,s);return e}get readyTimestamp(){return this.readyAt?this.readyAt.getTime():null}createVoiceBroadcast(){const e=new VoiceBroadcast(this);return this.broadcasts.push(e),e}login(e){return new Promise((t,s)=>{if("string"!=typeof e)throw new Error("TOKEN_INVALID");e=e.replace(/^Bot\s*/i,""),this.manager.connectToWebSocket(e,t,s)}).catch(e=>(this.destroy(),Promise.reject(e)))}destroy(){return super.destroy(),this.manager.destroy()}syncGuilds(e=this.guilds){this.user.bot||this.ws.send({op:12,d:e instanceof Collection?e.keyArray():e.map(e=>e.id)})}fetchInvite(e){const t=DataResolver.resolveInviteCode(e);return this.api.invites(t).get({query:{with_counts:!0}}).then(e=>new Invite(this,e))}fetchWebhook(e,t){return this.api.webhooks(e,t).get().then(e=>new Webhook(this,e))}fetchVoiceRegions(){return this.api.voice.regions.get().then(e=>{const t=new Collection;for(const s of e)t.set(s.id,new VoiceRegion(s));return t})}sweepMessages(e=this.options.messageCacheLifetime){if("number"!=typeof e||isNaN(e))throw new TypeError("CLIENT_INVALID_OPTION","Lifetime","a number");if(e<=0)return this.emit(Events.DEBUG,"Didn't sweep messages - lifetime is unlimited"),-1;const t=1e3*e,s=Date.now();let i=0,n=0;for(const e of this.channels.values())if(e.messages){i++;for(const i of e.messages.values())s-(i.editedTimestamp||i.createdTimestamp)>t&&(e.messages.delete(i.id),n++)}return this.emit(Events.DEBUG,`Swept ${n} messages older than ${e} seconds in ${i} text-based channels`),n}fetchApplication(e="@me"){return this.api.oauth2.applications(e).get().then(e=>new ClientApplication(this,e))}generateInvite(e){return e?e instanceof Array&&(e=Permissions.resolve(e)):e=0,this.fetchApplication().then(t=>`https://discordapp.com/oauth2/authorize?client_id=${t.id}&permissions=${e}&scope=bot`)}_pong(e){this.pings.unshift(Date.now()-e),this.pings.length>3&&(this.pings.length=3),this.ws.lastHeartbeatAck=!0}_eval(script){return eval(script)}_validateOptions(e=this.options){if("number"!=typeof e.shardCount||isNaN(e.shardCount))throw new TypeError("CLIENT_INVALID_OPTION","shardCount","a number");if("number"!=typeof e.shardId||isNaN(e.shardId))throw new TypeError("CLIENT_INVALID_OPTION","shardId","a number");if(e.shardCount<0)throw new RangeError("CLIENT_INVALID_OPTION","shardCount","at least 0");if(e.shardId<0)throw new RangeError("CLIENT_INVALID_OPTION","shardId","at least 0");if(0!==e.shardId&&e.shardId>=e.shardCount)throw new RangeError("CLIENT_INVALID_OPTION","shardId","less than shardCount");if("number"!=typeof e.messageCacheMaxSize||isNaN(e.messageCacheMaxSize))throw new TypeError("CLIENT_INVALID_OPTION","messageCacheMaxSize","a number");if("number"!=typeof e.messageCacheLifetime||isNaN(e.messageCacheLifetime))throw new TypeError("CLIENT_INVALID_OPTION","The messageCacheLifetime","a number");if("number"!=typeof e.messageSweepInterval||isNaN(e.messageSweepInterval))throw new TypeError("CLIENT_INVALID_OPTION","messageSweepInterval","a number");if("boolean"!=typeof e.fetchAllMembers)throw new TypeError("CLIENT_INVALID_OPTION","fetchAllMembers","a boolean");if("boolean"!=typeof e.disableEveryone)throw new TypeError("CLIENT_INVALID_OPTION","disableEveryone","a boolean");if("number"!=typeof e.restWsBridgeTimeout||isNaN(e.restWsBridgeTimeout))throw new TypeError("CLIENT_INVALID_OPTION","restWsBridgeTimeout","a number");if("boolean"!=typeof e.internalSharding)throw new TypeError("CLIENT_INVALID_OPTION","internalSharding","a boolean");if(!(e.disabledEvents instanceof Array))throw new TypeError("CLIENT_INVALID_OPTION","disabledEvents","an Array")}}module.exports=Client}).call(exports,__webpack_require__(18))},function(e,t,s){const{Events:i,Status:n}=s(0),{Error:r}=s(4);class ClientManager{constructor(e){this.client=e,this.heartbeatInterval=null}get status(){return this.connection?this.connection.status:n.IDLE}connectToWebSocket(e,t,s){this.client.emit(i.DEBUG,`Authenticated using token ${e}`),this.client.token=e;const n=this.client.setTimeout(()=>s(new r("WS_CONNECTION_TIMEOUT")),3e5);this.client.api.gateway.get().then(o=>{const a=`${o.url}/`;this.client.emit(i.DEBUG,`Using gateway ${a}`),this.client.ws.connect(a),this.client.ws.connection.once("error",s),this.client.ws.connection.once("close",e=>{4004===e.code&&s(new r("TOKEN_INVALID")),4010===e.code&&s(new r("SHARDING_INVALID")),4011===e.code&&s(new r("SHARDING_REQUIRED"))}),this.client.once(i.READY,()=>{t(e),this.client.clearTimeout(n)})},s)}destroy(){return this.client.ws.destroy(),this.client.rest.destroy(),this.client.user?this.client.user.bot?(this.client.token=null,Promise.resolve()):this.client.api.logout.post().then(()=>{this.client.token=null}):Promise.resolve()}}e.exports=ClientManager},function(e,t){},function(e,t,s){const i=s(21),{Events:n,Status:r}=s(0),o=s(88);class WebSocketManager extends i{constructor(e){super(),this.client=e,this.connection=null}heartbeat(){return this.connection?this.connection.heartbeat():this.debug("No connection to heartbeat")}debug(e){return this.client.emit(n.DEBUG,`[ws] ${e}`)}destroy(){return this.connection?this.connection.destroy():(this.debug("Attempted to destroy WebSocket but no connection exists!"),!1)}send(e){this.connection?this.connection.send(e):this.debug("No connection to websocket")}connect(e){if(!this.connection)return this.connection=new o(this,e),!0;switch(this.connection.status){case r.IDLE:case r.DISCONNECTED:return this.connection.connect(e,5500),!0;default:return this.debug(`Couldn't connect to ${e} as the websocket is at state ${this.connection.status}`),!1}}}e.exports=WebSocketManager},function(e,t,s){const i=s(21),{DefaultOptions:n,Events:r,OPCodes:o,Status:a,WSCodes:c}=s(0),l=s(89),h=s(61);class WebSocketConnection extends i{constructor(e,t){super(),this.manager=e,this.client=e.client,this.ws=null,this.sequence=-1,this.status=a.IDLE,this.packetManager=new l(this),this.lastPingTimestamp=0,this.ratelimit={queue:[],remaining:60,total:60,resetTimer:null},this.connect(t),this.disabledEvents={},this.closeSequence=0,this.expectingClose=!1;for(const e of this.client.options.disabledEvents)this.disabledEvents[e]=!0}triggerReady(){this.status!==a.READY?(this.status=a.READY,this.client.emit(r.READY),this.packetManager.handleQueue()):this.debug("Tried to mark self as ready, but already ready")}checkIfReady(){if(this.status===a.READY||this.status===a.NEARLY)return!1;let e=0;for(const t of this.client.guilds.values())t.available||e++;if(0===e){if(this.status=a.NEARLY,!this.client.options.fetchAllMembers)return this.triggerReady();const e=this.client.guilds.map(e=>e.members.fetch());Promise.all(e).then(()=>this.triggerReady()).catch(e=>{this.debug(`Failed to fetch all members before ready! ${e}`),this.triggerReady()})}return!0}debug(e){return e instanceof Error&&(e=e.stack),this.manager.debug(`[connection] ${e}`)}processQueue(){if(0!==this.ratelimit.remaining&&0!==this.ratelimit.queue.length)for(this.ratelimit.remaining===this.ratelimit.total&&(this.ratelimit.resetTimer=this.client.setTimeout(()=>{this.ratelimit.remaining=this.ratelimit.total,this.processQueue()},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===h.OPEN?this.ws.send(h.pack(e)):this.debug(`Tried to send packet ${e} but no WebSocket is available!`)}send(e){this.ws&&this.ws.readyState===h.OPEN?(this.ratelimit.queue.push(e),this.processQueue()):this.debug(`Tried to send packet ${e} but no WebSocket is available!`)}connect(e=this.gateway,t=0,s=!1){if(t)return this.client.setTimeout(()=>this.connect(e,0,s),t);if(this.ws&&!s)return this.debug("WebSocket connection already exists"),!1;if("string"!=typeof e)return this.debug(`Tried to connect to an invalid gateway: ${e}`),!1;this.expectingClose=!1,this.gateway=e,this.debug(`Connecting to ${e}`);const i=this.ws=h.create(e,{v:n.ws.version});return i.onmessage=this.onMessage.bind(this),i.onopen=this.onOpen.bind(this),i.onerror=this.onError.bind(this),i.onclose=this.onClose.bind(this),this.status=a.CONNECTING,!0}destroy(){const e=this.ws;return e?(this.heartbeat(-1),this.expectingClose=!0,e.close(1e3),this.packetManager.handleQueue(),this.ws=null,this.status=a.DISCONNECTED,this.ratelimit.remaining=this.ratelimit.total,!0):(this.debug("Attempted to destroy WebSocket but no connection exists!"),!1)}onMessage(e){let t;try{t=h.unpack(e.data)}catch(e){this.emit("debug",e)}const s=this.onPacket(t);return this.client.emit("raw",t),s}setSequence(e){this.sequence=e>this.sequence?e:this.sequence}onPacket(e){if(!e)return this.debug("Received null packet"),!1;switch(e.op){case o.HELLO:return this.heartbeat(e.d.heartbeat_interval);case o.RECONNECT:return this.reconnect();case o.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 o.HEARTBEAT_ACK:return this.ackHeartbeat();case o.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.RECONNECTING),this.connect(this.gateway,5500,!0)}onError(e){e&&"uWs client connection error"===e.message?this.reconnect():this.client.emit(r.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:c[e.code])return this.expectingClose=!1,this.client.emit(r.DISCONNECT,e),this.debug(c[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:o.HEARTBEAT,d:this.sequence})):-1===e?(this.debug("Clearing heartbeat interval"),this.client.clearInterval(this.heartbeatInterval),this.heartbeatInterval=null):(this.debug(`Setting a heartbeat interval for ${e}ms`),this.heartbeatInterval=this.client.setInterval(()=>this.heartbeat(),e))}identify(e){return e?this.client.setTimeout(this.identify.bind(this),e):this.sessionID?this.identifyResume():this.identifyNew()}identifyNew(){if(!this.client.token)return void this.debug("No token available to identify a new session with");const e=Object.assign({token:this.client.token},this.client.options.ws),{shardId:t,shardCount:s}=this.client.options;s>0&&(e.shard=[Number(t),Number(s)]),this.debug("Identifying as a new session"),this.send({op:o.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:o.RESUME,d:e})}}e.exports=WebSocketConnection},function(e,t,s){const{OPCodes:i,Status:n,WSEvents:r}=s(0),o=[r.READY,r.RESUMED,r.GUILD_CREATE,r.GUILD_DELETE,r.GUILD_MEMBERS_CHUNK,r.GUILD_MEMBER_ADD,r.GUILD_MEMBER_REMOVE];class WebSocketPacketManager{constructor(e){this.ws=e,this.handlers={},this.queue=[],this.register(r.READY,s(90)),this.register(r.RESUMED,s(101)),this.register(r.GUILD_CREATE,s(102)),this.register(r.GUILD_DELETE,s(103)),this.register(r.GUILD_UPDATE,s(104)),this.register(r.GUILD_BAN_ADD,s(105)),this.register(r.GUILD_BAN_REMOVE,s(106)),this.register(r.GUILD_MEMBER_ADD,s(107)),this.register(r.GUILD_MEMBER_REMOVE,s(108)),this.register(r.GUILD_MEMBER_UPDATE,s(109)),this.register(r.GUILD_ROLE_CREATE,s(110)),this.register(r.GUILD_ROLE_DELETE,s(111)),this.register(r.GUILD_ROLE_UPDATE,s(112)),this.register(r.GUILD_EMOJIS_UPDATE,s(113)),this.register(r.GUILD_MEMBERS_CHUNK,s(114)),this.register(r.CHANNEL_CREATE,s(115)),this.register(r.CHANNEL_DELETE,s(116)),this.register(r.CHANNEL_UPDATE,s(117)),this.register(r.CHANNEL_PINS_UPDATE,s(118)),this.register(r.PRESENCE_UPDATE,s(119)),this.register(r.USER_UPDATE,s(120)),this.register(r.USER_NOTE_UPDATE,s(121)),this.register(r.USER_SETTINGS_UPDATE,s(122)),this.register(r.USER_GUILD_SETTINGS_UPDATE,s(123)),this.register(r.VOICE_STATE_UPDATE,s(124)),this.register(r.TYPING_START,s(125)),this.register(r.MESSAGE_CREATE,s(126)),this.register(r.MESSAGE_DELETE,s(127)),this.register(r.MESSAGE_UPDATE,s(128)),this.register(r.MESSAGE_DELETE_BULK,s(129)),this.register(r.VOICE_SERVER_UPDATE,s(130)),this.register(r.GUILD_SYNC,s(131)),this.register(r.RELATIONSHIP_ADD,s(132)),this.register(r.RELATIONSHIP_REMOVE,s(133)),this.register(r.MESSAGE_REACTION_ADD,s(134)),this.register(r.MESSAGE_REACTION_REMOVE,s(135)),this.register(r.MESSAGE_REACTION_REMOVE_ALL,s(136))}get client(){return this.ws.client}register(e,t){this.handlers[e]=new t(this)}handleQueue(){this.queue.forEach((e,t)=>{this.handle(this.queue[t],!0),this.queue.splice(t,1)})}handle(e,t=!1){return e.op===i.HEARTBEAT_ACK?(this.ws.client._pong(this.ws.client._pingTimestamp),this.ws.lastHeartbeatAck=!0,this.ws.client.emit("debug","Heartbeat acknowledged")):e.op===i.HEARTBEAT&&(this.client.ws.send({op:i.HEARTBEAT,d:this.client.ws.sequence}),this.ws.client.emit("debug","Received gateway heartbeat")),this.ws.status===n.RECONNECTING&&(this.ws.reconnecting=!1,this.ws.checkIfReady()),this.ws.setSequence(e.s),void 0===this.ws.disabledEvents[e.t]&&(this.ws.status!==n.READY&&-1===o.indexOf(e.t)?(this.queue.push(e),!1):(!t&&this.queue.length>0&&this.handleQueue(),!!this.handlers[e.t]&&this.handlers[e.t].handle(e)))}}e.exports=WebSocketPacketManager},function(e,t,s){const i=s(1),{Events:n}=s(0),r=s(43);class ReadyHandler extends i{handle(e){const t=this.packetManager.client,s=e.d;t.ws.heartbeat(),s.user.user_settings=s.user_settings,s.user.user_guild_settings=s.user_guild_settings;const i=new r(t,s.user);t.user=i,t.readyAt=new Date,t.users.set(i.id,i);for(const e of s.guilds)t.guilds.create(e);for(const e of s.private_channels)t.channels.create(e);for(const e of s.relationships){const s=t.users.create(e.user);1===e.type?t.user.friends.set(s.id,s):2===e.type&&t.user.blocked.set(s.id,s)}for(const e of s.presences||[])t.presences.create(e);if(s.notes)for(const e in s.notes){let i=s.notes[e];i.length||(i=null),t.user.notes.set(e,i)}t.users.has("1")||t.users.create({id:"1",username:"Clyde",discriminator:"0000",avatar:"https://discordapp.com/assets/f78426a064bc9dd24847519259bc42af.png",bot:!0,status:"online",activity:null,verified:!0});const o=t.setTimeout(()=>{t.ws.connection.triggerReady()},1200*s.guilds.length);t.setMaxListeners(s.guilds.length+10),t.once("ready",()=>{t.syncGuilds(),t.setMaxListeners(10),t.clearTimeout(o)});const a=this.packetManager.ws;a.sessionID=s.session_id,a._trace=s._trace,t.emit(n.DEBUG,`READY ${a._trace.join(" -> ")} ${a.sessionID}`),a.checkIfReady()}}e.exports=ReadyHandler},function(e,t,s){const i=s(28),{TypeError:n}=s(4);e.exports=function(e,t){if("string"==typeof t&&(t={content:t}),t.before&&(t.before instanceof Date||(t.before=new Date(t.before)),t.maxID=i.fromNumber(t.before.getTime()-14200704e5).shiftLeft(22).toString()),t.after&&(t.after instanceof Date||(t.after=new Date(t.after)),t.minID=i.fromNumber(t.after.getTime()-14200704e5).shiftLeft(22).toString()),t.during){t.during instanceof Date||(t.during=new Date(t.during));const e=t.during.getTime()-14200704e5;t.minID=i.fromNumber(e).shiftLeft(22).toString(),t.maxID=i.fromNumber(e+864e5).shiftLeft(22).toString()}t.channel&&(t.channel=e.client.channels.resolveID(t.channel)),t.author&&(t.author=e.client.users.resolveID(t.author)),t.mentions&&(t.mentions=e.client.users.resolveID(t.options.mentions)),t.sortOrder&&(t.sortOrder={ascending:"asc",descending:"desc"}[t.sortOrder]||t.sortOrder),t={content:t.content,max_id:t.maxID,min_id:t.minID,has:t.has,channel_id:t.channel,author_id:t.author,author_type:t.authorType,context_size:t.contextSize,sort_by:t.sortBy,sort_order:t.sortOrder,limit:t.limit,offset:t.offset,mentions:t.mentions,mentions_everyone:t.mentionsEveryone,link_hostname:t.linkHostname,embed_provider:t.embedProvider,embed_type:t.embedType,attachment_filename:t.attachmentFilename,attachment_extension:t.attachmentExtension,include_nsfw:t.nsfw};const r=s(11),o=s(26);if(!(e instanceof r||e instanceof o))throw new n("SEARCH_CHANNEL_TYPE");return e.client.api[e instanceof r?"channels":"guilds"](e.id).messages().search.get({query:t}).then(t=>{const s=t.messages.map(t=>t.map(t=>e.client.channels.get(t.channel_id).messages.create(t,!1)));return{total:t.total_results,results:s}})}},function(e,t,s){const i=s(8),n=s(50);class ReactionStore extends i{constructor(e,t){super(e.client,t,n),this.message=e}create(e,t){return super.create(e,t,{id:e.emoji.id||e.emoji.name,extras:[this.message]})}}e.exports=ReactionStore},function(e,t,s){const i=s(15);class CategoryChannel extends i{get children(){return this.guild.channels.filter(e=>e.parentID===this.id)}}e.exports=CategoryChannel},function(e,t,s){const i=s(8),n=s(12),{Events:r,OPCodes:o}=s(0),a=s(3),{Error:c}=s(4);class GuildMemberStore extends i{constructor(e,t){super(e.client,t,n),this.guild=e}create(e,t){return super.create(e,t,{extras:[this.guild]})}resolve(e){const t=super.resolve(e);if(t)return t;const s=this.client.users.resolveID(e);return s?super.resolve(s):null}resolveID(e){const t=super.resolveID(e);if(t)return t;const s=this.client.users.resolveID(e);return this.has(s)?s:null}fetch(e){if(!e)return this._fetchMany();const t=this.client.users.resolveID(e);return t?this._fetchSingle({user:t,cache:!0}):e.user&&(e.user=this.client.users.resolveID(e.user),e.user)?this._fetchSingle(e):this._fetchMany(e)}_fetchSingle({user:e,cache:t}){const s=this.get(e);return s?Promise.resolve(s):this.client.api.guilds(this.guild.id).members(e).get().then(e=>this.create(e,t))}_fetchMany({query:e="",limit:t=0}={}){return new Promise((s,i)=>{if(this.guild.memberCount===this.size)return void s(e||t?new a:this);this.guild.client.ws.send({op:o.REQUEST_GUILD_MEMBERS,d:{guild_id:this.guild.id,query:e,limit:t}});const n=new a,l=(i,o)=>{if(o.id===this.guild.id){for(const s of i.values())(e||t)&&n.set(s.id,s);(this.guild.memberCount<=this.size||(e||t)&&i.size<1e3||t&&n.size>=t)&&(this.guild.client.removeListener(r.GUILD_MEMBERS_CHUNK,l),s(e||t?n:this))}};this.guild.client.on(r.GUILD_MEMBERS_CHUNK,l),this.guild.client.setTimeout(()=>{this.guild.client.removeListener(r.GUILD_MEMBERS_CHUNK,l),i(new c("GUILD_MEMBERS_TIMEOUT"))},12e4)})}}e.exports=GuildMemberStore},function(e,t,s){const i=s(8),n=s(24);class RoleStore extends i{constructor(e,t){super(e.client,t,n),this.guild=e}create(e,t){return super.create(e,t,{extras:[this.guild]})}}e.exports=RoleStore},function(e,t,s){const i=s(8),n=s(11),r=s(15);class GuildChannelStore extends i{constructor(e,t){super(e.client,t,r),this.guild=e}create(e){const t=this.get(e.id);return t||n.create(this.client,e,this.guild)}}e.exports=GuildChannelStore},function(e,t,s){const i=s(5),n=s(14),{RangeError:r}=s(4);e.exports=function(e,t){const o=s(22),a=s(12);if(e instanceof o||e instanceof a)return e.createDM().then(e=>e.send(t));let{content:c,nonce:l,reply:h,code:u,disableEveryone:d,tts:p,embed:f,files:g,split:m}=t;if(f&&(f=new n(f)._apiTransform()),void 0!==l&&(l=parseInt(l),isNaN(l)||l<0))throw new r("MESSAGE_NONCE_TYPE");if(h&&!(e instanceof o||e instanceof a)&&"dm"!==e.type){const t=e.client.users.resolveID(h),s=`<@${h instanceof a&&h.nickname?"!":""}${t}>`;m&&(m.prepend=`${s}, ${m.prepend||""}`),c=`${s}${void 0!==c?`, ${c}`:""}`}return c&&(c=i.resolveString(c),m&&"object"!=typeof m&&(m={}),void 0===u||"boolean"==typeof u&&!0!==u||(c=i.escapeMarkdown(c,!0),c=`\`\`\`${"boolean"!=typeof u?u||"":""}\n${c}\n\`\`\``,m&&(m.prepend=`\`\`\`${"boolean"!=typeof u?u||"":""}\n`,m.append="\n```")),(d||void 0===d&&e.client.options.disableEveryone)&&(c=c.replace(/@(everyone|here)/g,"@​$1")),m&&(c=i.splitMessage(c,m))),c instanceof Array?new Promise((t,s)=>{const i=[];!function n(){const r=c.length?{tts:p}:{tts:p,embed:f,files:g};e.send(c.shift(),r).then(e=>(i.push(e),0===c.length?t(i):n())).catch(s)}()}):e.client.api.channels[e.id].messages.post({data:{content:c,tts:p,nonce:l,embed:f},files:g}).then(t=>e.client.actions.MessageCreate.handle(t).message)}},function(e,t,s){const i=s(3),{UserFlags:n}=s(0),r=s(99),o=s(7);class UserProfile extends o{constructor(e,t){super(e.client),this.user=e,this.mutualGuilds=new i,this.connections=new i,this._patch(t)}_patch(e){this.premium=Boolean(e.premium_since),this._flags=e.user.flags,this.premiumSince=e.premium_since?new Date(e.premium_since):null;for(const t of e.mutual_guilds)this.client.guilds.has(t.id)&&this.mutualGuilds.set(t.id,this.client.guilds.get(t.id));for(const t of e.connected_accounts)this.connections.set(t.id,new r(this.user,t))}get flags(){const e=[];for(const[t,s]of Object.entries(n))(this._flags&s)===s&&e.push(t);return e}}e.exports=UserProfile},function(e,t){class UserConnection{constructor(e,t){this.user=e,this._patch(t)}_patch(e){this.type=e.type,this.name=e.name,this.id=e.id,this.revoked=e.revoked,this.integrations=e.integrations}}e.exports=UserConnection},function(e,t,s){const{UserChannelOverrideMap:i}=s(0);class ClientUserChannelOverride{constructor(e){this.patch(e)}patch(e){for(const[t,s]of Object.entries(i))e.hasOwnProperty(t)&&("function"==typeof s?this[s.name]=s(e[t]):this[s]=e[t])}}e.exports=ClientUserChannelOverride},function(e,t,s){const i=s(1),{Events:n,Status:r}=s(0);class ResumedHandler extends i{handle(e){const t=this.packetManager.client,s=t.ws.connection;s._trace=e.d._trace,s.status=r.READY,this.packetManager.handleQueue();const i=s.sequence-s.closeSequence;s.debug(`RESUMED ${s._trace.join(" -> ")} | replayed ${i} events.`),t.emit(n.RESUMED,i),s.heartbeat()}}e.exports=ResumedHandler},function(e,t,s){const i=s(1),{Events:n,Status:r}=s(0);class GuildCreateHandler extends i{async handle(e){const t=this.packetManager.client,s=e.d;let i=t.guilds.get(s.id);i?i.available||s.unavailable||(i._patch(s),this.packetManager.ws.checkIfReady()):(i=t.guilds.create(s),t.ws.connection.status===r.READY&&(t.options.fetchAllMembers&&await i.members.fetch(),t.emit(n.GUILD_CREATE,i)))}}e.exports=GuildCreateHandler},function(e,t,s){const i=s(1);class GuildDeleteHandler extends i{handle(e){this.packetManager.client.actions.GuildDelete.handle(e.d)}}e.exports=GuildDeleteHandler},function(e,t,s){const i=s(1);class GuildUpdateHandler extends i{handle(e){const t=this.packetManager.client,s=e.d;t.actions.GuildUpdate.handle(s)}}e.exports=GuildUpdateHandler},function(e,t,s){const i=s(1),{Events:n}=s(0);class GuildBanAddHandler extends i{handle(e){const t=this.packetManager.client,s=e.d,i=t.guilds.get(s.guild_id),r=t.users.get(s.user.id);i&&r&&t.emit(n.GUILD_BAN_ADD,i,r)}}e.exports=GuildBanAddHandler},function(e,t,s){const i=s(1);class GuildBanRemoveHandler extends i{handle(e){const t=this.packetManager.client,s=e.d;t.actions.GuildBanRemove.handle(s)}}e.exports=GuildBanRemoveHandler},function(e,t,s){const i=s(1),{Events:n,Status:r}=s(0);class GuildMemberAddHandler extends i{handle(e){const t=this.packetManager.client,s=e.d,i=t.guilds.get(s.guild_id);if(i){i.memberCount++;const e=i.members.create(s);t.ws.connection.status===r.READY&&t.emit(n.GUILD_MEMBER_ADD,e)}}}e.exports=GuildMemberAddHandler},function(e,t,s){const i=s(1);class GuildMemberRemoveHandler extends i{handle(e){const t=this.packetManager.client,s=e.d;t.actions.GuildMemberRemove.handle(s)}}e.exports=GuildMemberRemoveHandler},function(e,t,s){const i=s(1),{Events:n,Status:r}=s(0);class GuildMemberUpdateHandler extends i{handle(e){const t=this.packetManager.client,s=e.d,i=t.guilds.get(s.guild_id);if(i){const e=i.members.get(s.user.id);if(e){const i=e._update(s);t.ws.connection.status===r.READY&&t.emit(n.GUILD_MEMBER_UPDATE,i,e)}}}}e.exports=GuildMemberUpdateHandler},function(e,t,s){const i=s(1);class GuildRoleCreateHandler extends i{handle(e){const t=this.packetManager.client,s=e.d;t.actions.GuildRoleCreate.handle(s)}}e.exports=GuildRoleCreateHandler},function(e,t,s){const i=s(1);class GuildRoleDeleteHandler extends i{handle(e){const t=this.packetManager.client,s=e.d;t.actions.GuildRoleDelete.handle(s)}}e.exports=GuildRoleDeleteHandler},function(e,t,s){const i=s(1);class GuildRoleUpdateHandler extends i{handle(e){const t=this.packetManager.client,s=e.d;t.actions.GuildRoleUpdate.handle(s)}}e.exports=GuildRoleUpdateHandler},function(e,t,s){const i=s(1);class GuildEmojisUpdate extends i{handle(e){const t=this.packetManager.client,s=e.d;t.actions.GuildEmojisUpdate.handle(s)}}e.exports=GuildEmojisUpdate},function(e,t,s){const i=s(1),{Events:n}=s(0),r=s(3);class GuildMembersChunkHandler extends i{handle(e){const t=this.packetManager.client,s=e.d,i=t.guilds.get(s.guild_id);if(!i)return;const o=new r;for(const e of s.members)o.set(e.user.id,i.members.create(e));t.emit(n.GUILD_MEMBERS_CHUNK,o,i),t.ws.lastHeartbeatAck=!0}}e.exports=GuildMembersChunkHandler},function(e,t,s){const i=s(1);class ChannelCreateHandler extends i{handle(e){this.packetManager.client.actions.ChannelCreate.handle(e.d)}}e.exports=ChannelCreateHandler},function(e,t,s){const i=s(1);class ChannelDeleteHandler extends i{handle(e){this.packetManager.client.actions.ChannelDelete.handle(e.d)}}e.exports=ChannelDeleteHandler},function(e,t,s){const i=s(1),{Events:n}=s(0);class ChannelUpdateHandler extends i{handle(e){const{old:t,updated:s}=this.packetManager.client.actions.ChannelUpdate.handle(e.d);t&&s&&this.packetManager.client.emit(n.CHANNEL_UPDATE,t,s)}}e.exports=ChannelUpdateHandler},function(e,t,s){const i=s(1),{Events:n}=s(0);class ChannelPinsUpdate extends i{handle(e){const t=this.packetManager.client,s=e.d,i=t.channels.get(s.channel_id),r=new Date(s.last_pin_timestamp);i&&r&&t.emit(n.CHANNEL_PINS_UPDATE,i,r)}}e.exports=ChannelPinsUpdate},function(e,t,s){const i=s(1),{Events:n}=s(0);class PresenceUpdateHandler extends i{handle(e){const t=this.packetManager.client,s=e.d;let i=t.users.get(s.user.id);const r=t.guilds.get(s.guild_id);if(!i){if(!s.user.username)return;i=t.users.create(s.user)}const o=i._update(s.user);if(i.equals(o)||t.emit(n.USER_UPDATE,o,i),r){let e=r.members.get(i.id);if(e||"offline"===s.status||(e=r.members.create({user:i,roles:s.roles,deaf:!1,mute:!1}),t.emit(n.GUILD_MEMBER_AVAILABLE,e)),e){if(0===t.listenerCount(n.PRESENCE_UPDATE))return void r.presences.create(s);const i=e._clone();e.presence&&(i.frozenPresence=e.presence._clone()),r.presences.create(s),t.emit(n.PRESENCE_UPDATE,i,e)}else r.presences.create(s)}}}e.exports=PresenceUpdateHandler},function(e,t,s){const i=s(1);class UserUpdateHandler extends i{handle(e){const t=this.packetManager.client,s=e.d;t.actions.UserUpdate.handle(s)}}e.exports=UserUpdateHandler},function(e,t,s){const i=s(1);class UserNoteUpdateHandler extends i{handle(e){const t=this.packetManager.client,s=e.d;t.actions.UserNoteUpdate.handle(s)}}e.exports=UserNoteUpdateHandler},function(e,t,s){const i=s(1),{Events:n}=s(0);class UserSettingsUpdateHandler extends i{handle(e){const t=this.packetManager.client;t.user.settings.patch(e.d),t.emit(n.USER_SETTINGS_UPDATE,t.user.settings)}}e.exports=UserSettingsUpdateHandler},function(e,t,s){const i=s(1),{Events:n}=s(0),r=s(60);class UserGuildSettingsUpdateHandler extends i{handle(e){const t=this.packetManager.client,s=t.user.guildSettings.get(e.d.guild_id);s?s.patch(e.d):t.user.guildSettings.set(e.d.guild_id,new r(this.client,e.d)),t.emit(n.USER_GUILD_SETTINGS_UPDATE,t.user.guildSettings.get(e.d.guild_id))}}e.exports=UserGuildSettingsUpdateHandler},function(e,t,s){const i=s(1),{Events:n}=s(0);class VoiceStateUpdateHandler extends i{handle(e){const t=this.packetManager.client,s=e.d,i=t.guilds.get(s.guild_id);if(i){const e=i.members.get(s.user_id);if(e){const r=e._clone();r._frozenVoiceState=r.voiceState,e.user.id===t.user.id&&s.channel_id&&t.emit("self.voiceStateUpdate",s),i.voiceStates.set(e.user.id,s),t.emit(n.VOICE_STATE_UPDATE,r,e)}}}}e.exports=VoiceStateUpdateHandler},function(e,t,s){function i(e,t){return e.client.setTimeout(()=>{e.client.emit(r.TYPING_STOP,e,t,e._typing.get(t.id)),e._typing.delete(t.id)},6e3)}const n=s(1),{Events:r}=s(0);class TypingStartHandler extends n{handle(e){const t=this.packetManager.client,s=e.d,n=t.channels.get(s.channel_id),o=t.users.get(s.user_id),a=new Date(1e3*s.timestamp);if(n&&o){if("voice"===n.type)return void t.emit(r.WARN,`Discord sent a typing packet to voice channel ${n.id}`);if(n._typing.has(o.id)){const e=n._typing.get(o.id);e.lastTimestamp=a,e.resetTimeout(i(n,o))}else n._typing.set(o.id,new TypingData(t,a,a,i(n,o))),t.emit(r.TYPING_START,n,o)}}}class TypingData{constructor(e,t,s,i){this.client=e,this.since=t,this.lastTimestamp=s,this._timeout=i}resetTimeout(e){this.client.clearTimeout(this._timeout),this._timeout=e}get elapsedTime(){return Date.now()-this.since}}e.exports=TypingStartHandler},function(e,t,s){const i=s(1);class MessageCreateHandler extends i{handle(e){this.packetManager.client.actions.MessageCreate.handle(e.d)}}e.exports=MessageCreateHandler},function(e,t,s){const i=s(1);class MessageDeleteHandler extends i{handle(e){this.packetManager.client.actions.MessageDelete.handle(e.d)}}e.exports=MessageDeleteHandler},function(e,t,s){const i=s(1),{Events:n}=s(0);class MessageUpdateHandler extends i{handle(e){const{old:t,updated:s}=this.packetManager.client.actions.MessageUpdate.handle(e.d);t&&s&&this.packetManager.client.emit(n.MESSAGE_UPDATE,t,s)}}e.exports=MessageUpdateHandler},function(e,t,s){const i=s(1);class MessageDeleteBulkHandler extends i{handle(e){this.packetManager.client.actions.MessageDeleteBulk.handle(e.d)}}e.exports=MessageDeleteBulkHandler},function(e,t,s){const i=s(1);class VoiceServerUpdate extends i{handle(e){const t=this.packetManager.client,s=e.d;t.emit("self.voiceServer",s)}}e.exports=VoiceServerUpdate},function(e,t,s){const i=s(1);class GuildSyncHandler extends i{handle(e){const t=this.packetManager.client,s=e.d;t.actions.GuildSync.handle(s)}}e.exports=GuildSyncHandler},function(e,t,s){const i=s(1);class RelationshipAddHandler extends i{handle(e){const t=this.packetManager.client,s=e.d;1===s.type?t.users.fetch(s.id).then(e=>{t.user.friends.set(e.id,e)}):2===s.type&&t.users.fetch(s.id).then(e=>{t.user.blocked.set(e.id,e)})}}e.exports=RelationshipAddHandler},function(e,t,s){const i=s(1);class RelationshipRemoveHandler extends i{handle(e){const t=this.packetManager.client,s=e.d;2===s.type?t.user.blocked.has(s.id)&&t.user.blocked.delete(s.id):1===s.type&&t.user.friends.has(s.id)&&t.user.friends.delete(s.id)}}e.exports=RelationshipRemoveHandler},function(e,t,s){const i=s(1),{Events:n}=s(0);class MessageReactionAddHandler extends i{handle(e){const t=this.packetManager.client,s=e.d,{user:i,reaction:r}=t.actions.MessageReactionAdd.handle(s);r&&t.emit(n.MESSAGE_REACTION_ADD,r,i)}}e.exports=MessageReactionAddHandler},function(e,t,s){const i=s(1);class MessageReactionRemove extends i{handle(e){const t=this.packetManager.client,s=e.d;t.actions.MessageReactionRemove.handle(s)}}e.exports=MessageReactionRemove},function(e,t,s){const i=s(1);class MessageReactionRemoveAll extends i{handle(e){const t=this.packetManager.client,s=e.d;t.actions.MessageReactionRemoveAll.handle(s)}}e.exports=MessageReactionRemoveAll},function(e,t){},function(e,t){},function(e,t){},function(e,t,s){class ActionsManager{constructor(e){this.client=e,this.register(s(141)),this.register(s(142)),this.register(s(143)),this.register(s(144)),this.register(s(145)),this.register(s(146)),this.register(s(147)),this.register(s(148)),this.register(s(149)),this.register(s(150)),this.register(s(151)),this.register(s(152)),this.register(s(153)),this.register(s(154)),this.register(s(155)),this.register(s(156)),this.register(s(157)),this.register(s(158)),this.register(s(159)),this.register(s(160)),this.register(s(161)),this.register(s(162)),this.register(s(163)),this.register(s(164)),this.register(s(165)),this.register(s(166)),this.register(s(167)),this.register(s(168))}register(e){this[e.name.replace(/Action$/,"")]=new e(this.client)}}e.exports=ActionsManager},function(e,t,s){const i=s(2),{Events:n}=s(0);class MessageCreateAction extends i{handle(e){const t=this.client,s=t.channels.get(e.channel_id);if(s){const i=s.messages.get(e.id);if(i)return{message:i};const r=s.messages.create(e),o=r.author,a=s.guild?s.guild.member(o):null;return s.lastMessageID=e.id,s.lastMessage=r,o&&(o.lastMessageID=e.id,o.lastMessage=r),a&&(a.lastMessageID=e.id,a.lastMessage=r),t.emit(n.MESSAGE_CREATE,r),{message:r}}return{}}}e.exports=MessageCreateAction},function(e,t,s){const i=s(2),{Events:n}=s(0);class MessageDeleteAction extends i{handle(e){const t=this.client,s=t.channels.get(e.channel_id);let i;return s&&(i=s.messages.get(e.id))&&(s.messages.delete(i.id),t.emit(n.MESSAGE_DELETE,i)),{message:i}}}e.exports=MessageDeleteAction},function(e,t,s){const i=s(2),n=s(3),{Events:r}=s(0);class MessageDeleteBulkAction extends i{handle(e){const t=this.client,s=t.channels.get(e.channel_id);if(s){const i=e.ids,o=new n;for(const e of i){const t=s.messages.get(e);t&&o.set(t.id,t)}return o.size>0&&t.emit(r.MESSAGE_BULK_DELETE,o),{messages:o}}return{}}}e.exports=MessageDeleteBulkAction},function(e,t,s){const i=s(2);class MessageUpdateAction extends i{handle(e){const t=this.client.channels.get(e.channel_id);if(t){const s=t.messages.get(e.id);if(s)return s.patch(e),{old:s._edits[0],updated:s}}return{}}}e.exports=MessageUpdateAction},function(e,t,s){const i=s(2);class MessageReactionAdd extends i{handle(e){const t=e.user||this.client.users.get(e.user_id);if(!t)return!1;const s=e.channel||this.client.channels.get(e.channel_id);if(!s||"voice"===s.type)return!1;const i=e.message||s.messages.get(e.message_id);if(!i)return!1;if(!e.emoji)return!1;const n=i.reactions.create({emoji:e.emoji,count:0,me:t.id===this.client.user.id});return n._add(t),{message:i,reaction:n,user:t}}}e.exports=MessageReactionAdd},function(e,t,s){const i=s(2),{Events:n}=s(0);class MessageReactionRemove extends i{handle(e){const t=this.client.users.get(e.user_id);if(!t)return!1;const s=this.client.channels.get(e.channel_id);if(!s||"voice"===s.type)return!1;const i=s.messages.get(e.message_id);if(!i)return!1;if(!e.emoji)return!1;const r=e.emoji.id||decodeURIComponent(e.emoji.name),o=i.reactions.get(r);return!!o&&(o._remove(t),this.client.emit(n.MESSAGE_REACTION_REMOVE,o,t),{message:i,reaction:o,user:t})}}e.exports=MessageReactionRemove},function(e,t,s){const i=s(2),{Events:n}=s(0);class MessageReactionRemoveAll extends i{handle(e){const t=this.client.channels.get(e.channel_id);if(!t||"voice"===t.type)return!1;const s=t.messages.get(e.message_id);return!!s&&(s.reactions.clear(),this.client.emit(n.MESSAGE_REACTION_REMOVE_ALL,s),{message:s})}}e.exports=MessageReactionRemoveAll},function(e,t,s){const i=s(2),{Events:n}=s(0);class ChannelCreateAction extends i{handle(e){const t=this.client,s=t.channels.has(e.id),i=t.channels.create(e);return!s&&i&&t.emit(n.CHANNEL_CREATE,i),{channel:i}}}e.exports=ChannelCreateAction},function(e,t,s){const i=s(2),{Events:n}=s(0);class ChannelDeleteAction extends i{constructor(e){super(e),this.deleted=new Map}handle(e){const t=this.client;let s=t.channels.get(e.id);return s&&(t.channels.remove(s.id),t.emit(n.CHANNEL_DELETE,s)),{channel:s}}}e.exports=ChannelDeleteAction},function(e,t,s){const i=s(2);class ChannelUpdateAction extends i{handle(e){const t=this.client.channels.get(e.id);return t?{old:t._update(e),updated:t}:{}}}e.exports=ChannelUpdateAction},function(e,t,s){const i=s(2),{Events:n}=s(0);class GuildDeleteAction extends i{constructor(e){super(e),this.deleted=new Map}handle(e){const t=this.client;let s=t.guilds.get(e.id);if(s){for(const e of s.channels.values())"text"===e.type&&e.stopTyping(!0);if(s.available&&e.unavailable)return s.available=!1,t.emit(n.GUILD_UNAVAILABLE,s),{guild:null};t.guilds.remove(s.id),t.emit(n.GUILD_DELETE,s),this.deleted.set(s.id,s),this.scheduleForDeletion(s.id)}else s=this.deleted.get(e.id)||null;return{guild:s}}scheduleForDeletion(e){this.client.setTimeout(()=>this.deleted.delete(e),this.client.options.restWsBridgeTimeout)}}e.exports=GuildDeleteAction},function(e,t,s){const i=s(2),{Events:n}=s(0);class GuildUpdateAction extends i{handle(e){const t=this.client,s=t.guilds.get(e.id);if(s){const i=s._update(e);return t.emit(n.GUILD_UPDATE,i,s),{old:i,updated:s}}return{old:null,updated:null}}}e.exports=GuildUpdateAction},function(e,t,s){const i=s(2);class GuildMemberGetAction extends i{handle(e,t){return{member:e.members.create(t)}}}e.exports=GuildMemberGetAction},function(e,t,s){const i=s(2),{Events:n,Status:r}=s(0);class GuildMemberRemoveAction extends i{handle(e){const t=this.client,s=t.guilds.get(e.guild_id);let i=null;return s&&(i=s.members.get(e.user.id))&&(s.memberCount--,s.members.remove(i.id),t.status===r.READY&&t.emit(n.GUILD_MEMBER_REMOVE,i)),{guild:s,member:i}}}e.exports=GuildMemberRemoveAction},function(e,t,s){const i=s(2),{Events:n}=s(0);class GuildBanRemove extends i{handle(e){const t=this.client,s=t.guilds.get(e.guild_id),i=t.users.create(e.user);s&&i&&t.emit(n.GUILD_BAN_REMOVE,s,i)}}e.exports=GuildBanRemove},function(e,t,s){const i=s(2),{Events:n}=s(0);class GuildRoleCreate extends i{handle(e){const t=this.client,s=t.guilds.get(e.guild_id);let i;if(s){const r=s.roles.has(e.role.id);i=s.roles.create(e.role),r||t.emit(n.GUILD_ROLE_CREATE,i)}return{role:i}}}e.exports=GuildRoleCreate},function(e,t,s){const i=s(2),{Events:n}=s(0);class GuildRoleDeleteAction extends i{handle(e){const t=this.client,s=t.guilds.get(e.guild_id);let i;return s&&(i=s.roles.get(e.role_id))&&(s.roles.remove(e.role_id),t.emit(n.GUILD_ROLE_DELETE,i)),{role:i}}}e.exports=GuildRoleDeleteAction},function(e,t,s){const i=s(2),{Events:n}=s(0);class GuildRoleUpdateAction extends i{handle(e){const t=this.client,s=t.guilds.get(e.guild_id);if(s){let i=null;const r=s.roles.get(e.role.id);return r&&(i=r._update(e.role),t.emit(n.GUILD_ROLE_UPDATE,i,r)),{old:i,updated:r}}return{old:null,updated:null}}}e.exports=GuildRoleUpdateAction},function(e,t,s){const i=s(2);class UserGetAction extends i{handle(e){return{user:this.client.users.create(e)}}}e.exports=UserGetAction},function(e,t,s){const i=s(2),{Events:n}=s(0);class UserUpdateAction extends i{handle(e){const t=this.client;if(t.user){if(t.user.equals(e))return{old:t.user,updated:t.user};const s=t.user._update(e);return t.emit(n.USER_UPDATE,s,t.user),{old:s,updated:t.user}}return{old:null,updated:null}}}e.exports=UserUpdateAction},function(e,t,s){const i=s(2),{Events:n}=s(0);class UserNoteUpdateAction extends i{handle(e){const t=this.client,s=t.user.notes.get(e.id),i=e.note.length?e.note:null;return t.user.notes.set(e.id,i),t.emit(n.USER_NOTE_UPDATE,e.id,s,i),{old:s,updated:i}}}e.exports=UserNoteUpdateAction},function(e,t,s){const i=s(2);class GuildSync extends i{handle(e){const t=this.client.guilds.get(e.id);if(t){if(e.presences)for(const s of e.presences)t.presences.create(s);if(e.members)for(const s of e.members){const e=t.members.get(s.user.id);e?e._patch(s):t.members.create(s,!1)}"large"in e&&(t.large=e.large)}}}e.exports=GuildSync},function(e,t,s){const i=s(2),{Events:n}=s(0);class GuildEmojiCreateAction extends i{handle(e,t){const s=e.emojis.create(t);return this.client.emit(n.GUILD_EMOJI_CREATE,s),{emoji:s}}}e.exports=GuildEmojiCreateAction},function(e,t,s){const i=s(2),{Events:n}=s(0);class GuildEmojiDeleteAction extends i{handle(e){return e.guild.emojis.remove(e.id),this.client.emit(n.GUILD_EMOJI_DELETE,e),{emoji:e}}}e.exports=GuildEmojiDeleteAction},function(e,t,s){const i=s(2),{Events:n}=s(0);class GuildEmojiUpdateAction extends i{handle(e,t){const s=e._update(t);return this.client.emit(n.GUILD_EMOJI_UPDATE,s,e),{emoji:e}}}e.exports=GuildEmojiUpdateAction},function(e,t,s){function i(e){const t=new Map;for(const s of e)t.set(...s);return t}const n=s(2);class GuildEmojisUpdateAction extends n{handle(e){const t=this.client.guilds.get(e.guild_id);if(!t||!t.emojis)return;const s=i(t.emojis.entries());for(const i of e.emojis){const e=t.emojis.get(i.id);e?(s.delete(i.id),e.equals(i,!0)||this.client.actions.GuildEmojiUpdate.handle(e,i)):this.client.actions.GuildEmojiCreate.handle(t,i)}for(const e of s.values())this.client.actions.GuildEmojiDelete.handle(e)}}e.exports=GuildEmojisUpdateAction},function(e,t,s){const i=s(2);class GuildRolesPositionUpdate extends i{handle(e){const t=this.client.guilds.get(e.guild_id);if(t)for(const s of e.roles){const e=t.roles.get(s.id);e&&(e.rawPosition=s.position)}return{guild:t}}}e.exports=GuildRolesPositionUpdate},function(e,t,s){const i=s(2);class GuildChannelsPositionUpdate extends i{handle(e){const t=this.client.guilds.get(e.guild_id);if(t)for(const s of e.channels){const e=t.channels.get(s.id);e&&(e.rawPosition=s.position)}return{guild:t}}}e.exports=GuildChannelsPositionUpdate},function(e,t){},function(e,t){},function(e,t,s){const i=s(8),n=s(22),r=s(12),o=s(35);class UserStore extends i{constructor(e,t){super(e,t,n)}resolve(e){return e instanceof r?e.user:e instanceof o?e.author:super.resolve(e)}resolveID(e){return e instanceof r?e.user.id:e instanceof o?e.author.id:super.resolveID(e)}fetch(e,t=!0){const s=this.get(e);return s?Promise.resolve(s):this.client.api.users(e).get().then(e=>this.create(e,t))}}e.exports=UserStore},function(e,t,s){const i=s(8),n=s(11),{Events:r}=s(0),o=Symbol("LRU"),a=["group","dm"];class ChannelStore extends i{constructor(e,t={},s){if(s||"function"==typeof t[Symbol.iterator]||(s=t,t=void 0),super(e,t,n),s.lru){const e=this[o]=[];e.add=(t=>{for(e.remove(t),e.unshift(t);e.length>s.lru;)this.remove(e[e.length-1])}),e.remove=(t=>{const s=e.indexOf(t);s>-1&&e.splice(s,1)})}}get(e,t=!1){const s=super.get(e);return s&&a.includes(s.type)?(!t&&this[o]&&this[o].add(e),s):s}set(e,t){return this[o]&&a.includes(t.type)&&this[o].add(e),super.set(e,t)}delete(e){const t=this.get(e,!0);return!!t&&(this[o]&&a.includes(t.type)&&this[o].remove(e),super.delete(e))}create(e,t,s=!0){const i=this.get(e.id);if(i)return i;const o=n.create(this.client,e,t);return o?(s&&this.set(o.id,o),o):(this.client.emit(r.DEBUG,`Failed to find guild for channel ${e.id} ${e.type}`),null)}remove(e){const t=this.get(e);t.guild&&t.guild.channels.remove(e),super.remove(e)}}e.exports=ChannelStore},function(e,t,s){const i=s(8),n=s(26);class GuildStore extends i{constructor(e,t){super(e,t,n)}}e.exports=GuildStore},function(e,t,s){const i=s(58),n=s(3),{ActivityTypes:r,OPCodes:o}=s(0),{Presence:a}=s(13),{TypeError:c}=s(4);class ClientPresenceStore extends i{constructor(...e){super(...e),this.clientPresence=new a(this.client,{status:"online",afk:!1,since:null,activity:null})}async setClientPresence({status:e,since:t,afk:s,activity:i}){const a=i&&(i.application?i.application.id||i.application:null);let l=new n;if(i){if("string"!=typeof i.name)throw new c("INVALID_TYPE","name","string");if(i.type||(i.type=0),i.assets&&a)try{const e=await this.client.api.oauth2.applications(a).assets.get();for(const t of e)l.set(t.name,t.id)}catch(e){}}const h={afk:null!=s&&s,since:null!=t?t:null,status:e||this.clientPresence.status,game:i?{type:"number"==typeof i.type?i.type:r.indexOf(i.type),name:i.name,url:i.url,details:i.details||void 0,state:i.state||void 0,assets:i.assets?{large_text:i.assets.largeText||void 0,small_text:i.assets.smallText||void 0,large_image:l.get(i.assets.largeImage)||i.assets.largeImage,small_image:l.get(i.assets.smallImage)||i.assets.smallImage}:void 0,timestamps:i.timestamps||void 0,party:i.party||void 0,application_id:a||void 0,secrets:i.secrets||void 0,instance:i.instance||void 0}:null};return this.clientPresence.patch(h),this.client.ws.send({op:o.STATUS_UPDATE,d:h}),this.clientPresence}}e.exports=ClientPresenceStore},function(e,t){},function(e,t){},function(e,t){},function(e,t,s){const i=s(16),n=s(32);class WebhookClient extends n{constructor(e,t,s){super(s),Object.defineProperty(this,"client",{value:this}),this.id=e,this.token=t}}i.applyToClass(WebhookClient),e.exports=WebhookClient}]); \ No newline at end of file +window.Discord=function(e){function t(i){if(s[i])return s[i].exports;var n=s[i]={i:i,l:!1,exports:{}};return e[i].call(n.exports,n,n.exports,t),n.l=!0,n.exports}var s={};return t.m=e,t.c=s,t.d=function(e,s,i){t.o(e,s)||Object.defineProperty(e,s,{configurable:!1,enumerable:!0,get:i})},t.n=function(e){var s=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(s,"a",s),s},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=62)}([function(e,t,s){(function(e){function i(e,{format:t="webp",size:s}={}){if(t&&!o.includes(t))throw new n("IMAGE_FORMAT",t);if(s&&!a.includes(s))throw new r("IMAGE_SIZE",s);return`${e}.${t}${s?`?size=${s}`:""}`}t.Package=s(39);const{Error:n,RangeError:r}=s(4);t.DefaultOptions={apiRequestMethod:"sequential",shardId:0,shardCount:0,internalSharding:!1,messageCacheMaxSize:200,messageCacheLifetime:0,messageSweepInterval:0,fetchAllMembers:!1,disableEveryone:!1,sync:!1,restWsBridgeTimeout:5e3,disabledEvents:[],restTimeOffset:500,ws:{large_threshold:250,compress:"browser"!==s(76).platform(),properties:{$os:e?e.platform:"discord.js",$browser:"discord.js",$device:"discord.js"},version:6},http:{version:7,api:"https://discordapp.com/api",cdn:"https://cdn.discordapp.com",invite:"https://discord.gg"}},t.WSCodes={1e3:"Connection gracefully closed",4004:"Tried to identify with an invalid token",4010:"Sharding data provided was invalid",4011:"Shard would be on too many guilds if connected"};const o=["webp","png","jpg","gif"],a=Array.from({length:8},(e,t)=>2**(t+4));t.Endpoints={CDN:e=>({Emoji:t=>`${e}/emojis/${t}.png`,Asset:t=>`${e}/assets/${t}`,DefaultAvatar:t=>`${e}/embed/avatars/${t}.png`,Avatar:(t,s,n="default",r)=>("default"===n&&(n=s.startsWith("a_")?"gif":"webp"),i(`${e}/avatars/${t}/${s}`,{format:n,size:r})),Icon:(t,s,n="webp",r)=>i(`${e}/icons/${t}/${s}`,{format:n,size:r}),AppIcon:(t,s,{format:n="webp",size:r}={})=>i(`${e}/app-icons/${t}/${s}`,{size:r,format:n}),AppAsset:(t,s,{format:n="webp",size:r}={})=>i(`${e}/app-assets/${t}/${s}`,{size:r,format:n}),GDMIcon:(t,s,n="webp",r)=>i(`${e}/channel-icons/${t}/${s}`,{size:r,format:n}),Splash:(t,s,n="webp",r)=>i(`${e}/splashes/${t}/${s}`,{size:r,format:n})}),invite:(e,t)=>`${e}/${t}`,botGateway:"/gateway/bot"},t.Status={READY:0,CONNECTING:1,RECONNECTING:2,IDLE:3,NEARLY:4,DISCONNECTED:5},t.VoiceStatus={CONNECTED:0,CONNECTING:1,AUTHENTICATING:2,RECONNECTING:3,DISCONNECTED:4},t.OPCodes={DISPATCH:0,HEARTBEAT:1,IDENTIFY:2,STATUS_UPDATE:3,VOICE_STATE_UPDATE:4,VOICE_GUILD_PING:5,RESUME:6,RECONNECT:7,REQUEST_GUILD_MEMBERS:8,INVALID_SESSION:9,HELLO:10,HEARTBEAT_ACK:11},t.VoiceOPCodes={IDENTIFY:0,SELECT_PROTOCOL:1,READY:2,HEARTBEAT:3,SESSION_DESCRIPTION:4,SPEAKING:5},t.Events={READY:"ready",RESUMED:"resumed",GUILD_CREATE:"guildCreate",GUILD_DELETE:"guildDelete",GUILD_UPDATE:"guildUpdate",GUILD_UNAVAILABLE:"guildUnavailable",GUILD_AVAILABLE:"guildAvailable",GUILD_MEMBER_ADD:"guildMemberAdd",GUILD_MEMBER_REMOVE:"guildMemberRemove",GUILD_MEMBER_UPDATE:"guildMemberUpdate",GUILD_MEMBER_AVAILABLE:"guildMemberAvailable",GUILD_MEMBER_SPEAKING:"guildMemberSpeaking",GUILD_MEMBERS_CHUNK:"guildMembersChunk",GUILD_ROLE_CREATE:"roleCreate",GUILD_ROLE_DELETE:"roleDelete",GUILD_ROLE_UPDATE:"roleUpdate",GUILD_EMOJI_CREATE:"emojiCreate",GUILD_EMOJI_DELETE:"emojiDelete",GUILD_EMOJI_UPDATE:"emojiUpdate",GUILD_BAN_ADD:"guildBanAdd",GUILD_BAN_REMOVE:"guildBanRemove",CHANNEL_CREATE:"channelCreate",CHANNEL_DELETE:"channelDelete",CHANNEL_UPDATE:"channelUpdate",CHANNEL_PINS_UPDATE:"channelPinsUpdate",MESSAGE_CREATE:"message",MESSAGE_DELETE:"messageDelete",MESSAGE_UPDATE:"messageUpdate",MESSAGE_BULK_DELETE:"messageDeleteBulk",MESSAGE_REACTION_ADD:"messageReactionAdd",MESSAGE_REACTION_REMOVE:"messageReactionRemove",MESSAGE_REACTION_REMOVE_ALL:"messageReactionRemoveAll",USER_UPDATE:"userUpdate",USER_NOTE_UPDATE:"userNoteUpdate",USER_SETTINGS_UPDATE:"clientUserSettingsUpdate",USER_GUILD_SETTINGS_UPDATE:"clientUserGuildSettingsUpdate",PRESENCE_UPDATE:"presenceUpdate",VOICE_STATE_UPDATE:"voiceStateUpdate",TYPING_START:"typingStart",TYPING_STOP:"typingStop",DISCONNECT:"disconnect",RECONNECTING:"reconnecting",ERROR:"error",WARN:"warn",DEBUG:"debug"},t.WSEvents=function(e){let t=Object.create(null);for(const s of e)t[s]=s;return t}(["READY","RESUMED","GUILD_SYNC","GUILD_CREATE","GUILD_DELETE","GUILD_UPDATE","GUILD_MEMBER_ADD","GUILD_MEMBER_REMOVE","GUILD_MEMBER_UPDATE","GUILD_MEMBERS_CHUNK","GUILD_ROLE_CREATE","GUILD_ROLE_DELETE","GUILD_ROLE_UPDATE","GUILD_BAN_ADD","GUILD_BAN_REMOVE","GUILD_EMOJIS_UPDATE","CHANNEL_CREATE","CHANNEL_DELETE","CHANNEL_UPDATE","CHANNEL_PINS_UPDATE","MESSAGE_CREATE","MESSAGE_DELETE","MESSAGE_UPDATE","MESSAGE_DELETE_BULK","MESSAGE_REACTION_ADD","MESSAGE_REACTION_REMOVE","MESSAGE_REACTION_REMOVE_ALL","USER_UPDATE","USER_NOTE_UPDATE","USER_SETTINGS_UPDATE","USER_GUILD_SETTINGS_UPDATE","PRESENCE_UPDATE","VOICE_STATE_UPDATE","TYPING_START","VOICE_SERVER_UPDATE","RELATIONSHIP_ADD","RELATIONSHIP_REMOVE"]),t.MessageTypes=["DEFAULT","RECIPIENT_ADD","RECIPIENT_REMOVE","CALL","CHANNEL_NAME_CHANGE","CHANNEL_ICON_CHANGE","PINS_ADD","GUILD_MEMBER_JOIN"],t.ActivityTypes=["PLAYING","STREAMING","LISTENING","WATCHING"],t.ExplicitContentFilterTypes=["DISABLED","NON_FRIENDS","FRIENDS_AND_NON_FRIENDS"],t.MessageNotificationTypes=["EVERYTHING","MENTIONS","NOTHING","INHERIT"],t.UserSettingsMap={convert_emoticons:"convertEmoticons",default_guilds_restricted:"defaultGuildsRestricted",detect_platform_accounts:"detectPlatformAccounts",developer_mode:"developerMode",enable_tts_command:"enableTTSCommand",theme:"theme",status:"status",show_current_game:"showCurrentGame",inline_attachment_media:"inlineAttachmentMedia",inline_embed_media:"inlineEmbedMedia",locale:"locale",message_display_compact:"messageDisplayCompact",render_reactions:"renderReactions",guild_positions:"guildPositions",restricted_guilds:"restrictedGuilds",explicit_content_filter:function(e){return t.ExplicitContentFilterTypes[e]},friend_source_flags:function(e){return{all:e.all||!1,mutualGuilds:!!e.all||(e.mutual_guilds||!1),mutualFriends:!!e.all||(e.mutualFriends||!1)}}},t.UserGuildSettingsMap={message_notifications:function(e){return t.MessageNotificationTypes[e]},mobile_push:"mobilePush",muted:"muted",suppress_everyone:"suppressEveryone",channel_overrides:"channelOverrides"},t.UserChannelOverrideMap={message_notifications:function(e){return t.MessageNotificationTypes[e]},muted:"muted"},t.UserFlags={STAFF:1,PARTNER:2,HYPESQUAD:4},t.ChannelTypes={TEXT:0,DM:1,VOICE:2,GROUP:3,CATEGORY:4},t.ClientApplicationAssetTypes={SMALL:1,BIG:2},t.Colors={DEFAULT:0,AQUA:1752220,GREEN:3066993,BLUE:3447003,PURPLE:10181046,GOLD:15844367,ORANGE:15105570,RED:15158332,GREY:9807270,NAVY:3426654,DARK_AQUA:1146986,DARK_GREEN:2067276,DARK_BLUE:2123412,DARK_PURPLE:7419530,DARK_GOLD:12745742,DARK_ORANGE:11027200,DARK_RED:10038562,DARK_GREY:9936031,DARKER_GREY:8359053,LIGHT_GREY:12370112,DARK_NAVY:2899536,BLURPLE:7506394,GREYPLE:10070709,DARK_BUT_NOT_BLACK:2895667,NOT_QUITE_BLACK:2303786},t.APIErrors={UNKNOWN_ACCOUNT:10001,UNKNOWN_APPLICATION:10002,UNKNOWN_CHANNEL:10003,UNKNOWN_GUILD:10004,UNKNOWN_INTEGRATION:10005,UNKNOWN_INVITE:10006,UNKNOWN_MEMBER:10007,UNKNOWN_MESSAGE:10008,UNKNOWN_OVERWRITE:10009,UNKNOWN_PROVIDER:10010,UNKNOWN_ROLE:10011,UNKNOWN_TOKEN:10012,UNKNOWN_USER:10013,UNKNOWN_EMOJI:10014,BOT_PROHIBITED_ENDPOINT:20001,BOT_ONLY_ENDPOINT:20002,MAXIMUM_GUILDS:30001,MAXIMUM_FRIENDS:30002,MAXIMUM_PINS:30003,MAXIMUM_ROLES:30005,MAXIMUM_REACTIONS:30010,UNAUTHORIZED:40001,MISSING_ACCESS:50001,INVALID_ACCOUNT_TYPE:50002,CANNOT_EXECUTE_ON_DM:50003,EMBED_DISABLED:50004,CANNOT_EDIT_MESSAGE_BY_OTHER:50005,CANNOT_SEND_EMPTY_MESSAGE:50006,CANNOT_MESSAGE_USER:50007,CANNOT_SEND_MESSAGES_IN_VOICE_CHANNEL:50008,CHANNEL_VERIFICATION_LEVEL_TOO_HIGH:50009,OAUTH2_APPLICATION_BOT_ABSENT:50010,MAXIMUM_OAUTH2_APPLICATIONS:50011,INVALID_OAUTH_STATE:50012,MISSING_PERMISSIONS:50013,INVALID_AUTHENTICATION_TOKEN:50014,NOTE_TOO_LONG:50015,INVALID_BULK_DELETE_QUANTITY:50016,CANNOT_PIN_MESSAGE_IN_OTHER_CHANNEL:50019,CANNOT_EXECUTE_ON_SYSTEM_MESSAGE:50021,BULK_DELETE_MESSAGE_TOO_OLD:50034,INVITE_ACCEPTED_TO_GUILD_NOT_CONTANING_BOT:50036,REACTION_BLOCKED:90001}}).call(t,s(18))},function(e,t){class AbstractHandler{constructor(e){this.packetManager=e}handle(e){return e}}e.exports=AbstractHandler},function(e,t){class GenericAction{constructor(e){this.client=e}handle(e){return e}}e.exports=GenericAction},function(e,t){class Collection extends Map{constructor(e){super(e),Object.defineProperty(this,"_array",{value:null,writable:!0,configurable:!0}),Object.defineProperty(this,"_keyArray",{value:null,writable:!0,configurable:!0})}set(e,t){return this._array=null,this._keyArray=null,super.set(e,t)}delete(e){return this._array=null,this._keyArray=null,super.delete(e)}array(){return this._array&&this._array.length===this.size||(this._array=Array.from(this.values())),this._array}keyArray(){return this._keyArray&&this._keyArray.length===this.size||(this._keyArray=Array.from(this.keys())),this._keyArray}first(e){if(void 0===e)return this.values().next().value;if(e<0)return this.last(-1*e);e=Math.min(this.size,e);const t=new Array(e),s=this.values();for(let i=0;i{const i=e.get(s);return i!==t||void 0===i&&!e.has(s)}))}sort(e=((e,t)=>+(e>t)||+(e===t)-1)){return new Collection(Array.from(this.entries()).sort((t,s)=>e(t[1],s[1],t[0],s[0])))}}e.exports=Collection},function(e,t,s){e.exports=s(40),e.exports.Messages=s(75)},function(e,t,s){(function(t){const i=s(28),n=s(29),{Colors:r,DefaultOptions:o,Endpoints:a}=s(0),{Error:c,RangeError:l,TypeError:h}=s(4),u=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);class Util{constructor(){throw new Error(`The ${this.constructor.name} class may not be instantiated.`)}static splitMessage(e,{maxLength:t=1950,char:s="\n",prepend:i="",append:n=""}={}){if(e.length<=t)return e;const r=e.split(s);if(1===r.length)throw new l("SPLIT_MAX_LEN");const o=[""];let a=0;for(let e=0;et&&(o[a]+=n,o.push(i),a++),o[a]+=(o[a].length>0&&o[a]!==i?s:"")+r[e];return o.filter(e=>e)}static escapeMarkdown(e,t=!1,s=!1){return t?e.replace(/```/g,"`​``"):s?e.replace(/\\(`|\\)/g,"$1").replace(/(`|\\)/g,"\\$1"):e.replace(/\\(\*|_|`|~|\\)/g,"$1").replace(/(\*|_|`|~|\\)/g,"\\$1")}static fetchRecommendedShards(e,t=1e3){return new Promise((s,i)=>{if(!e)throw new c("TOKEN_MISSING");n.get(`${o.http.api}/v${o.http.version}${a.botGateway}`).set("Authorization",`Bot ${e.replace(/^Bot\s*/i,"")}`).end((e,n)=>{e&&i(e),s(n.body.shards*(1e3/t))})})}static parseEmoji(e){if(e.includes("%")&&(e=decodeURIComponent(e)),e.includes(":")){const[t,s]=e.split(":");return{name:t,id:s}}return{name:e,id:null}}static arraysEqual(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(const s of e){const e=t.indexOf(s);-1!==e&&t.splice(e,1)}return 0===t.length}static cloneObject(e){return Object.assign(Object.create(e),e)}static mergeDefault(e,t){if(!t)return e;for(const s in e)u(t,s)&&void 0!==t[s]?t[s]===Object(t[s])&&(t[s]=this.mergeDefault(e[s],t[s])):t[s]=e[s];return t}static convertToBuffer(e){return"string"==typeof e&&(e=this.str2ab(e)),t.from(e)}static str2ab(e){const t=new ArrayBuffer(2*e.length),s=new Uint16Array(t);for(var i=0,n=e.length;i-1&&s16777215)throw new l("COLOR_RANGE");if(e&&isNaN(e))throw new h("COLOR_CONVERT");return e}static discordSort(e){return e.sort((e,t)=>e.rawPosition-t.rawPosition||i.fromString(e.id).sub(i.fromString(t.id)).toNumber())}static setPosition(e,t,s,i,n,r){let o=i.array();return Util.moveElementInArray(o,e,t,s),o=o.map((e,t)=>({id:e.id,position:t})),n.patch({data:o,reason:r})}}e.exports=Util}).call(t,s(17).Buffer)},function(e,t,s){function i(e,t,s="0"){return String(e).length>=t?String(e):(String(s).repeat(t)+e).slice(-t)}const n=s(28),r=14200704e5;let o=0;class SnowflakeUtil{constructor(){throw new Error(`The ${this.constructor.name} class may not be instantiated.`)}static generate(){o>=4095&&(o=0);const e=`${i((Date.now()-r).toString(2),42)}0000100000${i((o++).toString(2),12)}`;return n.fromString(e,2).toString()}static deconstruct(e){const t=i(n.fromString(e).toString(2),64),s={timestamp:parseInt(t.substring(0,42),2)+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(s,"date",{get:function(){return new Date(this.timestamp)},enumerable:!0}),s}}e.exports=SnowflakeUtil},function(e,t){class Base{constructor(e){Object.defineProperty(this,"client",{value:e})}_clone(){return Object.assign(Object.create(this),this)}_patch(e){return e}_update(e){const t=this._clone();return this._patch(e),t}}e.exports=Base},function(e,t,s){const i=s(3);class DataStore extends i{constructor(e,t,s){if(super(),Object.defineProperty(this,"client",{value:e}),Object.defineProperty(this,"holds",{value:s}),t)for(const e of t)this.create(e)}create(e,t=!0,{id:s,extras:i=[]}={}){const n=this.get(s||e.id);if(n)return n;const r=this.holds?new this.holds(this.client,e,...i):e;return t&&this.set(s||r.id,r),r}remove(e){return this.delete(e)}resolve(e){return e instanceof this.holds?e:"string"==typeof e?this.get(e)||null:null}resolveID(e){return e instanceof this.holds?e.id:"string"==typeof e?e:null}}e.exports=DataStore},function(e,t,s){const{RangeError:i}=s(4);class Permissions{constructor(e){this.bitfield="number"==typeof e?e:this.constructor.resolve(e)}has(e,t=!0){return e instanceof Array?e.every(e=>this.has(e,t)):(e=this.constructor.resolve(e),!!(t&&(this.bitfield&this.constructor.FLAGS.ADMINISTRATOR)>0)||(this.bitfield&e)===e)}missing(e,t=!0){return e.filter(e=>!this.has(e,t))}freeze(){return Object.freeze(this)}add(...e){let t=0;for(let s=e.length-1;s>=0;s--)t|=this.constructor.resolve(e[s]);return Object.isFrozen(this)?new this.constructor(this.bitfield|t):(this.bitfield|=t,this)}remove(...e){let t=0;for(let s=e.length-1;s>=0;s--)t|=this.constructor.resolve(e[s]);return Object.isFrozen(this)?new this.constructor(this.bitfield&~t):(this.bitfield&=~t,this)}serialize(e=!0){const t={};for(const s in this.constructor.FLAGS)t[s]=this.has(s,e);return t}static resolve(e){if("number"==typeof e&&e>=0)return e;if(e instanceof Permissions)return e.bitfield;if(e instanceof Array)return e.map(e=>this.resolve(e)).reduce((e,t)=>e|t,0);if("string"==typeof e)return this.FLAGS[e];throw new i("PERMISSIONS_INVALID")}}Permissions.FLAGS={CREATE_INSTANT_INVITE:1,KICK_MEMBERS:2,BAN_MEMBERS:4,ADMINISTRATOR:8,MANAGE_CHANNELS:16,MANAGE_GUILD:32,ADD_REACTIONS:64,VIEW_AUDIT_LOG:128,VIEW_CHANNEL:1024,SEND_MESSAGES:2048,SEND_TTS_MESSAGES:4096,MANAGE_MESSAGES:8192,EMBED_LINKS:16384,ATTACH_FILES:32768,READ_MESSAGE_HISTORY:65536,MENTION_EVERYONE:1<<17,USE_EXTERNAL_EMOJIS:1<<18,CONNECT:1<<20,SPEAK:1<<21,MUTE_MEMBERS:1<<22,DEAFEN_MEMBERS:1<<23,MOVE_MEMBERS:1<<24,USE_VAD:1<<25,CHANGE_NICKNAME:1<<26,MANAGE_NICKNAMES:1<<27,MANAGE_ROLES:1<<28,MANAGE_WEBHOOKS:1<<29,MANAGE_EMOJIS:1<<30},Permissions.ALL=Object.values(Permissions.FLAGS).reduce((e,t)=>e|t,0),Permissions.DEFAULT=104324097,e.exports=Permissions},function(e,t,s){(function(t){const i=s(33),n=s(49),r=s(29),o=s(5),{Error:a,TypeError:c}=s(4);class DataResolver{constructor(){throw new a(`The ${this.constructor.name} class may not be instantiated.`)}static resolveInviteCode(e){const t=/discord(?:app\.com\/invite|\.gg)\/([\w-]{2,255})/i.exec(e);return t&&t[1]?t[1]:e}static async resolveImage(e,t){if(!e)return null;if("string"==typeof e&&e.startsWith("data:"))return e;const s=await this.resolveFile(e,t);return DataResolver.resolveBase64(s)}static resolveBase64(e){return e instanceof t?`data:image/jpg;base64,${e.toString("base64")}`:e}static resolveFile(e,s){return e instanceof t?Promise.resolve(e):s&&e instanceof ArrayBuffer?Promise.resolve(o.convertToBuffer(e)):"string"==typeof e?new Promise((s,o)=>{if(/^https?:\/\//.test(e))r.get(e).end((e,i)=>e?o(e):i.body instanceof t?s(i.body):o(new c("REQ_BODY_TYPE")));else{const t=i.resolve(e);n.stat(t,(e,i)=>e?o(e):i&&i.isFile()?(n.readFile(t,(e,t)=>{e?o(e):s(t)}),null):o(new a("FILE_NOT_FOUND",t)))}}):e.pipe&&"function"==typeof e.pipe?new Promise((s,i)=>{const n=[];e.once("error",i),e.on("data",e=>n.push(e)),e.once("end",()=>s(t.concat(n)))}):Promise.reject(new c("REQ_RESOURCE_TYPE"))}}e.exports=DataResolver}).call(t,s(17).Buffer)},function(e,t,s){const i=s(6),n=s(7),{ChannelTypes:r}=s(0);class Channel extends n{constructor(e,t){super(e);const s=Object.keys(r)[t.type];this.type=s?s.toLowerCase():"unknown",t&&this._patch(t)}_patch(e){this.id=e.id}get createdTimestamp(){return i.deconstruct(this.id).timestamp}get createdAt(){return new Date(this.createdTimestamp)}delete(){return this.client.api.channels(this.id).delete().then(()=>this)}static create(e,t,i){const n=s(46),o=s(51),a=s(52),c=s(54),l=s(94),h=s(15);let u;if(t.type===r.DM)u=new n(e,t);else if(t.type===r.GROUP)u=new o(e,t);else if(i=i||e.guilds.get(t.guild_id)){switch(t.type){case r.TEXT:u=new a(i,t);break;case r.VOICE:u=new c(i,t);break;case r.CATEGORY:u=new l(i,t);break;default:u=new h(i,t)}i.channels.set(u.id,u)}return u}}e.exports=Channel},function(e,t,s){const i=s(19),n=s(24),r=s(9),o=s(3),a=s(7),{Presence:c}=s(13),{Error:l,TypeError:h}=s(4);class GuildMember extends a{constructor(e,t,s){super(e),this.guild=s,this.user={},this._roles=[],t&&this._patch(t),this.lastMessageID=null,this.lastMessage=null}_patch(e){void 0===this.speaking&&(this.speaking=!1),void 0!==e.nick&&(this.nickname=e.nick),void 0!==e.joined_at&&(this.joinedTimestamp=new Date(e.joined_at).getTime()),this.user=this.guild.client.users.create(e.user),e.roles&&(this._roles=e.roles)}get voiceState(){return this._frozenVoiceState||this.guild.voiceStates.get(this.id)||{}}get serverDeaf(){return this.voiceState.deaf}get serverMute(){return this.voiceState.mute}get selfMute(){return this.voiceState.self_mute}get selfDeaf(){return this.voiceState.self_deaf}get voiceSessionID(){return this.voiceState.session_id}get voiceChannelID(){return this.voiceState.channel_id}get joinedAt(){return new Date(this.joinedTimestamp)}get presence(){return this.frozenPresence||this.guild.presences.get(this.id)||new c}get roles(){const e=new o,t=this.guild.roles.get(this.guild.id);t&&e.set(t.id,t);for(const t of this._roles){const s=this.guild.roles.get(t);s&&e.set(s.id,s)}return e}get highestRole(){return this.roles.reduce((e,t)=>!e||t.comparePositionTo(e)>0?t:e)}get colorRole(){const e=this.roles.filter(e=>e.color);return e.size?e.reduce((e,t)=>!e||t.comparePositionTo(e)>0?t:e):null}get displayColor(){const e=this.colorRole;return e&&e.color||0}get displayHexColor(){const e=this.colorRole;return e&&e.hexColor||"#000000"}get hoistRole(){const e=this.roles.filter(e=>e.hoist);return e.size?e.reduce((e,t)=>!e||t.comparePositionTo(e)>0?t:e):null}get mute(){return this.selfMute||this.serverMute}get deaf(){return this.selfDeaf||this.serverDeaf}get voiceChannel(){return this.guild.channels.get(this.voiceChannelID)}get id(){return this.user.id}get displayName(){return this.nickname||this.user.username}get permissions(){return this.user.id===this.guild.ownerID?new r(r.ALL).freeze():new r(this.roles.map(e=>e.permissions)).freeze()}get kickable(){if(this.user.id===this.guild.ownerID)return!1;if(this.user.id===this.client.user.id)return!1;const e=this.guild.member(this.client.user);return!!e.permissions.has(r.FLAGS.KICK_MEMBERS)&&e.highestRole.comparePositionTo(this.highestRole)>0}get bannable(){if(this.user.id===this.guild.ownerID)return!1;if(this.user.id===this.client.user.id)return!1;const e=this.guild.member(this.client.user);return!!e.permissions.has(r.FLAGS.BAN_MEMBERS)&&e.highestRole.comparePositionTo(this.highestRole)>0}permissionsIn(e){if(!(e=this.client.channels.resolve(e))||!e.guild)throw new l("GUILD_CHANNEL_RESOLVE");return e.permissionsFor(this)}hasPermission(e,t=!1,s,i){return void 0===s&&(s=!t),void 0===i&&(i=!t),!(!i||this.user.id!==this.guild.ownerID)||this.roles.some(t=>t.permissions.has(e,void 0,s))}missingPermissions(e,t=!1){return this.permissions.missing(e,t)}edit(e,t){e.channel&&(e.channel_id=this.client.channels.resolve(e.channel).id,e.channel=null),e.roles&&(e.roles=e.roles.map(e=>e instanceof n?e.id:e));let s=this.client.api.guilds(this.guild.id);if(this.user.id===this.client.user.id){const t=Object.keys(e);s=1===t.length&&"nick"===t[0]?s.members("@me").nick:s.members(this.id)}else s=s.members(this.id);return s.patch({data:e,reason:t}).then(()=>{const t=this._clone();return e.user=this.user,t._patch(e),t._frozenVoiceState=this.voiceState,void 0!==e.mute&&(t._frozenVoiceState.mute=e.mute),void 0!==e.deaf&&(t._frozenVoiceState.mute=e.deaf),void 0!==e.channel_id&&(t._frozenVoiceState.channel_id=e.channel_id),t})}setMute(e,t){return this.edit({mute:e},t)}setDeaf(e,t){return this.edit({deaf:e},t)}setVoiceChannel(e){return this.edit({channel:e})}setRoles(e,t){return this.edit({roles:e},t)}addRole(e,t){return(e=this.guild.roles.resolve(e))?this._roles.includes(e.id)?Promise.resolve(this):this.client.api.guilds(this.guild.id).members(this.user.id).roles(e.id).put({reason:t}).then(()=>{const t=this._clone();return t._roles.includes(e.id)||t._roles.push(e.id),t}):Promise.reject(new h("INVALID_TYPE","role","Role nor a Snowflake"))}addRoles(e,t){let s=this._roles.slice();for(let t of e instanceof o?e.values():e){if(!(t=this.guild.roles.resolve(t)))return Promise.reject(new h("INVALID_TYPE","roles","Array or Collection of Roles or Snowflakes",!0));s.push(t.id)}return this.edit({roles:s},t)}removeRole(e,t){return(e=this.guild.roles.resolve(e))?this._roles.includes(e.id)?this.client.api.guilds(this.guild.id).members(this.user.id).roles(e.id).delete({reason:t}).then(()=>{const t=this._clone(),s=t._roles.indexOf(e.id);return~s&&t._roles.splice(s,1),t}):Promise.resolve(this):Promise.reject(new h("INVALID_TYPE","role","Role nor a Snowflake"))}removeRoles(e,t){const s=this._roles.slice();for(let t of e instanceof o?e.values():e){if(!(t=this.guild.roles.resolve(t)))return Promise.reject(new h("INVALID_TYPE","roles","Array or Collection of Roles or Snowflakes",!0));const e=s.indexOf(t.id);e>=0&&s.splice(e,1)}return this.edit({roles:s},t)}setNickname(e,t){return this.edit({nick:e},t)}createDM(){return this.user.createDM()}deleteDM(){return this.user.deleteDM()}kick(e){return this.client.api.guilds(this.guild.id).members(this.user.id).delete({reason:e}).then(()=>this.client.actions.GuildMemberRemove.handle({guild_id:this.guild.id,user:this.user}).member)}ban(e){return this.guild.ban(this,e)}toString(){return`<@${this.nickname?"!":""}${this.user.id}>`}send(){}}i.applyToClass(GuildMember),e.exports=GuildMember},function(e,t,s){const{ActivityTypes:i}=s(0);class Presence{constructor(e,t={}){Object.defineProperty(this,"client",{value:e}),this.patch(t)}patch(e){this.status=e.status||this.status;const t=e.game||e.activity;return this.activity=t?new Activity(this,t):null,this}_clone(){const e=Object.assign(Object.create(this),this);return this.activity&&(e.activity=this.activity._clone()),e}equals(e){return this===e||(e&&this.status===e.status&&this.activity?this.activity.equals(e.activity):!e.activity)}}class Activity{constructor(e,t){Object.defineProperty(this,"presence",{value:e}),this.name=t.name,this.type=i[t.type],this.url=t.url||null,this.details=t.details||null,this.state=t.state||null,this.applicationID=t.application_id||null,this.timestamps=t.timestamps?{start:t.timestamps.start?new Date(t.timestamps.start):null,end:t.timestamps.end?new Date(t.timestamps.end):null}:null,this.party=t.party||null,this.assets=t.assets?new RichPresenceAssets(this,t.assets):null}equals(e){return this===e||e&&this.name===e.name&&this.type===e.type&&this.url===e.url}_clone(){return Object.assign(Object.create(this),this)}}class RichPresenceAssets{constructor(e,t){Object.defineProperty(this,"activity",{value:e}),this.largeText=t.large_text||null,this.smallText=t.small_text||null,this.largeImage=t.large_image||null,this.smallImage=t.small_image||null}smallImageURL({format:e,size:t}={}){return this.smallImage?this.activity.presence.client.rest.cdn.AppAsset(this.activity.applicationID,this.smallImage,{format:e,size:t}):null}largeImageURL({format:e,size:t}={}){return this.largeImage?this.activity.presence.client.rest.cdn.AppAsset(this.activity.applicationID,this.largeImage,{format:e,size:t}):null}}t.Presence=Presence,t.Activity=Activity,t.RichPresenceAssets=RichPresenceAssets},function(e,t,s){const i=s(20),n=s(5),{RangeError:r}=s(4);class MessageEmbed{constructor(e={}){this.setup(e)}setup(e){this.type=e.type,this.title=e.title,this.description=e.description,this.url=e.url,this.color=e.color,this.timestamp=e.timestamp?new Date(e.timestamp).getTime():null,this.fields=e.fields?e.fields.map(n.cloneObject):[],this.thumbnail=e.thumbnail?{url:e.thumbnail.url,proxyURL:e.thumbnail.proxy_url,height:e.height,width:e.width}:null,this.image=e.image?{url:e.image.url,proxyURL:e.image.proxy_url,height:e.height,width:e.width}:null,this.video=e.video,this.author=e.author?{name:e.author.name,url:e.author.url,iconURL:e.author.iconURL||e.author.icon_url,proxyIconURL:e.author.proxyIconUrl||e.author.proxy_icon_url}:null,this.provider=e.provider,this.footer=e.footer?{text:e.footer.text,iconURL:e.footer.iconURL||e.footer.icon_url,proxyIconURL:e.footer.proxyIconURL||e.footer.proxy_icon_url}:null,e.files&&(this.files=e.files.map(e=>e instanceof i?"string"==typeof e.file?e.file:n.cloneObject(e.file):e))}get createdAt(){return this.timestamp?new Date(this.timestamp):null}get hexColor(){return this.color?`#${this.color.toString(16).padStart(6,"0")}`:null}addField(e,t,s=!1){if(this.fields.length>=25)throw new r("EMBED_FIELD_COUNT");if(e=n.resolveString(e),!String(e)||e.length>256)throw new r("EMBED_FIELD_NAME");if(t=n.resolveString(t),!String(t)||t.length>1024)throw new r("EMBED_FIELD_VALUE");return this.fields.push({name:e,value:t,inline:s}),this}addBlankField(e=!1){return this.addField("​","​",e)}attachFiles(e){this.files?this.files=this.files.concat(e):this.files=e;for(let t of e)t instanceof i&&(t=t.file);return this}setAuthor(e,t,s){return this.author={name:n.resolveString(e),iconURL:t,url:s},this}setColor(e){return this.color=n.resolveColor(e),this}setDescription(e){if((e=n.resolveString(e)).length>2048)throw new r("EMBED_DESCRIPTION");return this.description=e,this}setFooter(e,t){if((e=n.resolveString(e)).length>2048)throw new r("EMBED_FOOTER_TEXT");return this.footer={text:e,iconURL:t},this}setImage(e){return this.image={url:e},this}setThumbnail(e){return this.thumbnail={url:e},this}setTimestamp(e=new Date){return this.timestamp=e.getTime(),this}setTitle(e){if((e=n.resolveString(e)).length>256)throw new r("EMBED_TITLE");return this.title=e,this}setURL(e){return this.url=e,this}_apiTransform(){return{title:this.title,type:"rich",description:this.description,url:this.url,timestamp:this.timestamp?new Date(this.timestamp):null,color:this.color,fields:this.fields,files:this.files,thumbnail:this.thumbnail,image:this.image,author:this.author?{name:this.author.name,url:this.author.url,icon_url:this.author.iconURL}:null,footer:this.footer?{text:this.footer.text,icon_url:this.footer.iconURL}:null}}}e.exports=MessageEmbed},function(e,t,s){const i=s(11),n=s(24),r=s(25),o=s(53),a=s(5),c=s(9),l=s(3),{MessageNotificationTypes:h}=s(0),{Error:u,TypeError:d}=s(4);class GuildChannel extends i{constructor(e,t){super(e.client,t),this.guild=e}_patch(e){if(super._patch(e),this.name=e.name,this.rawPosition=e.position,this.parentID=e.parent_id,this.permissionOverwrites=new l,e.permission_overwrites)for(const t of e.permission_overwrites)this.permissionOverwrites.set(t.id,new o(this,t))}get parent(){return this.guild.channels.get(this.parentID)}get permissionsLocked(){return this.parent?this.permissionOverwrites.size===this.parent.permissionOverwrites.size&&!this.permissionOverwrites.find((e,t)=>{const s=this.parent.permissionOverwrites.get(t);return void 0===s||s.denied.bitfield!==e.denied.bitfield||s.allowed.bitfield!==e.allowed.bitfield}):null}get position(){const e=this.guild._sortedChannels(this);return e.array().indexOf(e.get(this.id))}permissionsFor(e){if(!(e=this.guild.members.resolve(e)))return null;if(e.id===this.guild.ownerID)return new c(c.ALL).freeze();const t=e.roles,s=new c(t.map(e=>e.permissions));if(s.has(c.FLAGS.ADMINISTRATOR))return new c(c.ALL).freeze();const i=this.overwritesFor(e,!0,t);return s.remove(i.everyone?i.everyone.denied:0).add(i.everyone?i.everyone.allowed:0).remove(i.roles.length>0?i.roles.map(e=>e.denied):0).add(i.roles.length>0?i.roles.map(e=>e.allowed):0).remove(i.member?i.member.denied:0).add(i.member?i.member.allowed:0).freeze()}overwritesFor(e,t=!1,s=null){if(t||(e=this.guild.members.resolve(e)),!e)return[];s=s||e.roles;const i=[];let n,r;for(const t of this.permissionOverwrites.values())t.id===this.guild.id?r=t:s.has(t.id)?i.push(t):t.id===e.id&&(n=t);return{everyone:r,roles:i,member:n}}overwritePermissions(e,t,s){const i=new c(0),r=new c(0);let o;const a=this.guild.roles.get(e);if(a||e instanceof n)e=a||e,o="role";else if(e=this.client.users.resolve(e),o="member",!e)return Promise.reject(new d("INVALID_TYPE","parameter","User nor a Role",!0));const l=this.permissionOverwrites.get(e.id);l&&(i.add(l.allowed),r.add(l.denied));for(const e in t)!0===t[e]?(i.add(c.FLAGS[e]||0),r.remove(c.FLAGS[e]||0)):!1===t[e]?(i.remove(c.FLAGS[e]||0),r.add(c.FLAGS[e]||0)):null===t[e]&&(i.remove(c.FLAGS[e]||0),r.remove(c.FLAGS[e]||0));return this.client.api.channels(this.id).permissions[e.id].put({data:{id:e.id,type:o,allow:i.bitfield,deny:r.bitfield},reason:s}).then(()=>this)}lockPermissions(){if(!this.parent)return Promise.reject(new u("GUILD_CHANNEL_ORPHAN"));const e=this.parent.permissionOverwrites.map(e=>({deny:e.denied.bitfield,allow:e.allowed.bitfield,id:e.id,type:e.type}));return this.edit({permissionOverwrites:e})}get members(){const e=new l;for(const t of this.guild.members.values())this.permissionsFor(t).has("VIEW_CHANNEL")&&e.set(t.id,t);return e}edit(e,t){return this.client.api.channels(this.id).patch({data:{name:(e.name||this.name).trim(),topic:e.topic,position:e.position||this.rawPosition,bitrate:e.bitrate||(this.bitrate?1e3*this.bitrate:void 0),user_limit:null!=e.userLimit?e.userLimit:this.userLimit,parent_id:e.parentID,lock_permissions:e.lockPermissions,permission_overwrites:e.permissionOverwrites},reason:t}).then(e=>{const t=this._clone();return t._patch(e),t})}setName(e,t){return this.edit({name:e},t)}setParent(e,{lockPermissions:t=!0,reason:s}={}){return this.edit({parentID:e.id?e.id:e,lockPermissions:t},s)}setTopic(e,t){return this.edit({topic:e},t)}setPosition(e,{relative:t,reason:s}={}){return a.setPosition(this,e,t,this.guild._sortedChannels(this),this.client.api.guilds(this.guild.id).channels,s).then(e=>(this.client.actions.GuildChannelsPositionUpdate.handle({guild_id:this.id,channels:e}),this))}createInvite({temporary:e=!1,maxAge:t=86400,maxUses:s=0,unique:i,reason:n}={}){return this.client.api.channels(this.id).invites.post({data:{temporary:e,max_age:t,max_uses:s,unique:i},reason:n}).then(e=>new r(this.client,e))}clone({name:e=this.name,withPermissions:t=!0,withTopic:s=!0,reason:i}={}){const n={overwrites:t?this.permissionOverwrites:[],reason:i};return this.guild.createChannel(e,this.type,n).then(e=>s?e.setTopic(this.topic):e)}equals(e){let t=e&&this.id===e.id&&this.type===e.type&&this.topic===e.topic&&this.position===e.position&&this.name===e.name;return t&&(t=this.permissionOverwrites&&e.permissionOverwrites?this.permissionOverwrites.equals(e.permissionOverwrites):!this.permissionOverwrites&&!e.permissionOverwrites),t}get deletable(){return this.permissionsFor(this.client.user).has(c.FLAGS.MANAGE_CHANNELS)}delete(e){return this.client.api.channels(this.id).delete({reason:e}).then(()=>this)}get muted(){if(this.client.user.bot)return null;try{return this.client.user.guildSettings.get(this.guild.id).channelOverrides.get(this.id).muted}catch(e){return!1}}get messageNotifications(){if(this.client.user.bot)return null;try{return this.client.user.guildSettings.get(this.guild.id).channelOverrides.get(this.id).messageNotifications}catch(e){return h[3]}}toString(){return`<#${this.id}>`}}e.exports=GuildChannel},function(e,t,s){(function(t){const i=s(33),n=s(5),r=s(10),o=s(14),a=s(20),c=s(14);class Webhook{constructor(e,t){Object.defineProperty(this,"client",{value:e}),t&&this._patch(t)}_patch(e){this.name=e.name,this.token=e.token,this.avatar=e.avatar,this.id=e.id,this.guildID=e.guild_id,this.channelID=e.channel_id,e.user?this.owner=this.client.users?this.client.users.get(e.user.id):e.user:this.owner=null}send(e,s){if(s||"object"!=typeof e||e instanceof Array?s||(s={}):(s=e,e=""),s instanceof a&&(s={files:[s.file]}),s instanceof c&&(s={embeds:[s]}),s.embed&&(s={embeds:[s.embed]}),e instanceof Array||s instanceof Array){const t=e instanceof Array?e:s,i=t.filter(e=>e instanceof a),n=t.filter(e=>e instanceof c);i.length&&(s={files:i}),n.length&&(s={embeds:n}),(n.length||i.length)&&e instanceof Array&&(e="")}if(s.username||(s.username=this.name),s.avatarURL&&(s.avatar_url=s.avatarURL,s.avatarURL=null),e){e=n.resolveString(e);let{split:t,code:i,disableEveryone:r}=s;t&&"object"!=typeof t&&(t={}),void 0===i||"boolean"==typeof i&&!0!==i||(e=n.escapeMarkdown(e,!0),e=`\`\`\`${"boolean"!=typeof i?i||"":""}\n${e}\n\`\`\``,t&&(t.prepend=`\`\`\`${"boolean"!=typeof i?i||"":""}\n`,t.append="\n```")),(r||void 0===r&&this.client.options.disableEveryone)&&(e=e.replace(/@(everyone|here)/g,"@​$1")),t&&(e=n.splitMessage(e,t))}if(s.content=e,s.embeds&&(s.embeds=s.embeds.map(e=>new o(e)._apiTransform())),s.files){for(let e=0;er.resolveFile(e.attachment,this.client.browser).then(t=>(e.file=t,e)))).then(e=>this.client.api.webhooks(this.id,this.token).post({data:s,query:{wait:!0},files:e,auth:!1}))}return e instanceof Array?new Promise((t,i)=>{const n=[];(function r(){const o=e.length?null:{embeds:s.embeds,files:s.files};this.client.api.webhooks(this.id,this.token).post({data:{content:e.shift(),opt:o},query:{wait:!0},auth:!1}).then(s=>(n.push(s),0===e.length?t(n):r.call(this))).catch(i)}).call(this)}):this.client.api.webhooks(this.id,this.token).post({data:s,query:{wait:!0},auth:!1}).then(e=>this.client.channels?this.client.channels.get(e.channel_id).messages.create(e,!1):e)}sendSlackMessage(e){return this.client.api.webhooks(this.id,this.token).slack.post({query:{wait:!0},auth:!1,data:e}).then(e=>this.client.channels?this.client.channels.get(e.channel_id).messages.create(e,!1):e)}edit({name:e=this.name,avatar:t},s){return t&&"string"==typeof t&&!t.startsWith("data:")?r.resolveImage(t,this.client.browser).then(t=>this.edit({name:e,avatar:t},s)):this.client.api.webhooks(this.id,this.token).patch({data:{name:e,avatar:t},reason:s}).then(e=>(this.name=e.name,this.avatar=e.avatar,this))}delete(e){return this.client.api.webhooks(this.id,this.token).delete({reason:e})}static applyToClass(e){for(const t of["send","sendSlackMessage","edit","delete"])Object.defineProperty(e.prototype,t,Object.getOwnPropertyDescriptor(Webhook.prototype,t))}}e.exports=Webhook}).call(t,s(17).Buffer)},function(e,t,s){"use strict";(function(e){function i(){return r.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function n(e,t){if(i()=i())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i().toString(16)+" bytes");return 0|e}function g(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 s=e.length;if(0===s)return 0;for(var i=!1;;)switch(t){case"ascii":case"latin1":case"binary":return s;case"utf8":case"utf-8":case void 0:return V(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*s;case"hex":return s>>>1;case"base64":return Y(e).length;default:if(i)return V(e).length;t=(""+t).toLowerCase(),i=!0}}function m(e,t,s){var i=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===s||s>this.length)&&(s=this.length),s<=0)return"";if(s>>>=0,t>>>=0,s<=t)return"";for(e||(e="utf8");;)switch(e){case"hex":return M(this,t,s);case"utf8":case"utf-8":return D(this,t,s);case"ascii":return N(this,t,s);case"latin1":case"binary":return C(this,t,s);case"base64":return S(this,t,s);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O(this,t,s);default:if(i)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),i=!0}}function E(e,t,s){var i=e[t];e[t]=e[s],e[s]=i}function _(e,t,s,i,n){if(0===e.length)return-1;if("string"==typeof s?(i=s,s=0):s>2147483647?s=2147483647:s<-2147483648&&(s=-2147483648),s=+s,isNaN(s)&&(s=n?0:e.length-1),s<0&&(s=e.length+s),s>=e.length){if(n)return-1;s=e.length-1}else if(s<0){if(!n)return-1;s=0}if("string"==typeof t&&(t=r.from(t,i)),r.isBuffer(t))return 0===t.length?-1:y(e,t,s,i,n);if("number"==typeof t)return t&=255,r.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?n?Uint8Array.prototype.indexOf.call(e,t,s):Uint8Array.prototype.lastIndexOf.call(e,t,s):y(e,[t],s,i,n);throw new TypeError("val must be string, number or Buffer")}function y(e,t,s,i,n){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!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(e.length<2||t.length<2)return-1;o=2,a/=2,c/=2,s/=2}var l;if(n){var h=-1;for(l=s;la&&(s=a-c),l=s;l>=0;l--){for(var u=!0,d=0;dn&&(i=n):i=n;var r=t.length;if(r%2!=0)throw new TypeError("Invalid hex string");i>r/2&&(i=r/2);for(var o=0;o239?4:r>223?3:r>191?2:1;if(n+a<=s){var c,l,h,u;switch(a){case 1:r<128&&(o=r);break;case 2:128==(192&(c=e[n+1]))&&(u=(31&r)<<6|63&c)>127&&(o=u);break;case 3:c=e[n+1],l=e[n+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[n+1],l=e[n+2],h=e[n+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,i.push(o>>>10&1023|55296),o=56320|1023&o),i.push(o),n+=a}return R(i)}function R(e){var t=e.length;if(t<=Q)return String.fromCharCode.apply(String,e);for(var s="",i=0;ii)&&(s=i);for(var n="",r=t;rs)throw new RangeError("Trying to access beyond buffer length")}function U(e,t,s,i,n,o){if(!r.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>n||te.length)throw new RangeError("Index out of range")}function x(e,t,s,i){t<0&&(t=65535+t+1);for(var n=0,r=Math.min(e.length-s,2);n>>8*(i?n:1-n)}function P(e,t,s,i){t<0&&(t=4294967295+t+1);for(var n=0,r=Math.min(e.length-s,4);n>>8*(i?n:3-n)&255}function k(e,t,s,i,n,r){if(s+i>e.length)throw new RangeError("Index out of range");if(s<0)throw new RangeError("Index out of range")}function G(e,t,s,i,n){return n||k(e,t,s,4,3.4028234663852886e38,-3.4028234663852886e38),J.write(e,t,s,i,23,4),s+4}function j(e,t,s,i,n){return n||k(e,t,s,8,1.7976931348623157e308,-1.7976931348623157e308),J.write(e,t,s,i,52,8),s+8}function B(e){if((e=H(e).replace(Z,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}function H(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function q(e){return e<16?"0"+e.toString(16):e.toString(16)}function V(e,t){t=t||1/0;for(var s,i=e.length,n=null,r=[],o=0;o55295&&s<57344){if(!n){if(s>56319){(t-=3)>-1&&r.push(239,191,189);continue}if(o+1===i){(t-=3)>-1&&r.push(239,191,189);continue}n=s;continue}if(s<56320){(t-=3)>-1&&r.push(239,191,189),n=s;continue}s=65536+(n-55296<<10|s-56320)}else n&&(t-=3)>-1&&r.push(239,191,189);if(n=null,s<128){if((t-=1)<0)break;r.push(s)}else if(s<2048){if((t-=2)<0)break;r.push(s>>6|192,63&s|128)}else if(s<65536){if((t-=3)<0)break;r.push(s>>12|224,s>>6&63|128,63&s|128)}else{if(!(s<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;r.push(s>>18|240,s>>12&63|128,s>>6&63|128,63&s|128)}}return r}function $(e){for(var t=[],s=0;s>8,n=s%256,r.push(n),r.push(i);return r}function Y(e){return K.toByteArray(B(e))}function z(e,t,s,i){for(var n=0;n=t.length||n>=e.length);++n)t[n+s]=e[n];return n}function W(e){return e!==e}var K=s(63),J=s(64),X=s(65);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=i(),r.poolSize=8192,r._augment=function(e){return e.__proto__=r.prototype,e},r.from=function(e,t,s){return o(null,e,t,s)},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,s){return c(null,e,t,s)},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 s=e.length,i=t.length,n=0,o=Math.min(s,i);n0&&(e=this.toString("hex",0,s).match(/.{2}/g).join(" "),this.length>s&&(e+=" ... ")),""},r.prototype.compare=function(e,t,s,i,n){if(!r.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===s&&(s=e?e.length:0),void 0===i&&(i=0),void 0===n&&(n=this.length),t<0||s>e.length||i<0||n>this.length)throw new RangeError("out of range index");if(i>=n&&t>=s)return 0;if(i>=n)return-1;if(t>=s)return 1;if(t>>>=0,s>>>=0,i>>>=0,n>>>=0,this===e)return 0;for(var o=n-i,a=s-t,c=Math.min(o,a),l=this.slice(i,n),h=e.slice(t,s),u=0;un)&&(s=n),e.length>0&&(s<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var r=!1;;)switch(i){case"hex":return v(this,e,t,s);case"utf8":case"utf-8":return A(this,e,t,s);case"ascii":return b(this,e,t,s);case"latin1":case"binary":return w(this,e,t,s);case"base64":return T(this,e,t,s);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,e,t,s);default:if(r)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),r=!0}},r.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Q=4096;r.prototype.slice=function(e,t){var s=this.length;e=~~e,t=void 0===t?s:~~t,e<0?(e+=s)<0&&(e=0):e>s&&(e=s),t<0?(t+=s)<0&&(t=0):t>s&&(t=s),t0&&(n*=256);)i+=this[e+--t]*n;return i},r.prototype.readUInt8=function(e,t){return t||L(e,1,this.length),this[e]},r.prototype.readUInt16LE=function(e,t){return t||L(e,2,this.length),this[e]|this[e+1]<<8},r.prototype.readUInt16BE=function(e,t){return t||L(e,2,this.length),this[e]<<8|this[e+1]},r.prototype.readUInt32LE=function(e,t){return t||L(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||L(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},r.prototype.readIntLE=function(e,t,s){e|=0,t|=0,s||L(e,t,this.length);for(var i=this[e],n=1,r=0;++r=n&&(i-=Math.pow(2,8*t)),i},r.prototype.readIntBE=function(e,t,s){e|=0,t|=0,s||L(e,t,this.length);for(var i=t,n=1,r=this[e+--i];i>0&&(n*=256);)r+=this[e+--i]*n;return n*=128,r>=n&&(r-=Math.pow(2,8*t)),r},r.prototype.readInt8=function(e,t){return t||L(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},r.prototype.readInt16LE=function(e,t){t||L(e,2,this.length);var s=this[e]|this[e+1]<<8;return 32768&s?4294901760|s:s},r.prototype.readInt16BE=function(e,t){t||L(e,2,this.length);var s=this[e+1]|this[e]<<8;return 32768&s?4294901760|s:s},r.prototype.readInt32LE=function(e,t){return t||L(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||L(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||L(e,4,this.length),J.read(this,e,!0,23,4)},r.prototype.readFloatBE=function(e,t){return t||L(e,4,this.length),J.read(this,e,!1,23,4)},r.prototype.readDoubleLE=function(e,t){return t||L(e,8,this.length),J.read(this,e,!0,52,8)},r.prototype.readDoubleBE=function(e,t){return t||L(e,8,this.length),J.read(this,e,!1,52,8)},r.prototype.writeUIntLE=function(e,t,s,i){e=+e,t|=0,s|=0,i||U(this,e,t,s,Math.pow(2,8*s)-1,0);var n=1,r=0;for(this[t]=255&e;++r=0&&(r*=256);)this[t+n]=e/r&255;return t+s},r.prototype.writeUInt8=function(e,t,s){return e=+e,t|=0,s||U(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,s){return e=+e,t|=0,s||U(this,e,t,2,65535,0),r.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):x(this,e,t,!0),t+2},r.prototype.writeUInt16BE=function(e,t,s){return e=+e,t|=0,s||U(this,e,t,2,65535,0),r.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):x(this,e,t,!1),t+2},r.prototype.writeUInt32LE=function(e,t,s){return e=+e,t|=0,s||U(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):P(this,e,t,!0),t+4},r.prototype.writeUInt32BE=function(e,t,s){return e=+e,t|=0,s||U(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):P(this,e,t,!1),t+4},r.prototype.writeIntLE=function(e,t,s,i){if(e=+e,t|=0,!i){var n=Math.pow(2,8*s-1);U(this,e,t,s,n-1,-n)}var r=0,o=1,a=0;for(this[t]=255&e;++r>0)-a&255;return t+s},r.prototype.writeIntBE=function(e,t,s,i){if(e=+e,t|=0,!i){var n=Math.pow(2,8*s-1);U(this,e,t,s,n-1,-n)}var r=s-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+s},r.prototype.writeInt8=function(e,t,s){return e=+e,t|=0,s||U(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,s){return e=+e,t|=0,s||U(this,e,t,2,32767,-32768),r.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):x(this,e,t,!0),t+2},r.prototype.writeInt16BE=function(e,t,s){return e=+e,t|=0,s||U(this,e,t,2,32767,-32768),r.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):x(this,e,t,!1),t+2},r.prototype.writeInt32LE=function(e,t,s){return e=+e,t|=0,s||U(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):P(this,e,t,!0),t+4},r.prototype.writeInt32BE=function(e,t,s){return e=+e,t|=0,s||U(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):P(this,e,t,!1),t+4},r.prototype.writeFloatLE=function(e,t,s){return G(this,e,t,!0,s)},r.prototype.writeFloatBE=function(e,t,s){return G(this,e,t,!1,s)},r.prototype.writeDoubleLE=function(e,t,s){return j(this,e,t,!0,s)},r.prototype.writeDoubleBE=function(e,t,s){return j(this,e,t,!1,s)},r.prototype.copy=function(e,t,s,i){if(s||(s=0),i||0===i||(i=this.length),t>=e.length&&(t=e.length),t||(t=0),i>0&&i=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-t=0;--n)e[n+t]=this[n+s];else if(o<1e3||!r.TYPED_ARRAY_SUPPORT)for(n=0;n>>=0,s=void 0===s?this.length:s>>>0,e||(e=0);var o;if("number"==typeof e)for(o=t;o1)for(var s=1;se instanceof l);t.length&&(s={files:t},e instanceof Array&&(e=""))}if(s.content||(s.content=e),s.embed&&s.embed.files&&(s.files?s.files=s.files.concat(s.embed.files):s.files=s.embed.files),s.files){for(let e=0;ec.resolveFile(e.attachment,this.client.browser).then(t=>(e.file=t,e)))).then(e=>(s.files=e,r.sendMessage(this,s)))}return r.sendMessage(this,s)}search(e={}){return r.search(this,e)}startTyping(e){if(void 0!==e&&e<1)throw new u("TYPING_COUNT");if(this.client.user._typing.has(this.id)){const t=this.client.user._typing.get(this.id);t.count=e||t.count+1}else{const t=this.client.api.channels[this.id].typing;this.client.user._typing.set(this.id,{count:e||1,interval:this.client.setInterval(()=>{t.post()},9e3)}),t.post()}}stopTyping(e=!1){if(this.client.user._typing.has(this.id)){const t=this.client.user._typing.get(this.id);t.count--,(t.count<=0||e)&&(this.client.clearInterval(t.interval),this.client.user._typing.delete(this.id))}}get typing(){return this.client.user._typing.has(this.id)}get typingCount(){return this.client.user._typing.has(this.id)?this.client.user._typing.get(this.id).count:0}createMessageCollector(e,t={}){return new n(this,e,t)}awaitMessages(e,t={}){return new Promise((s,i)=>{this.createMessageCollector(e,t).once("end",(e,n)=>{t.errors&&t.errors.includes(n)?i(e):s(e)})})}bulkDelete(e,t=!1){if(!isNaN(e))return this.messages.fetch({limit:e}).then(e=>this.bulkDelete(e,t));if(e instanceof Array||e instanceof a){let s=e instanceof a?e.keyArray():e.map(e=>e.id);return t&&(s=s.filter(e=>Date.now()-o.deconstruct(e).date.getTime()<12096e5)),this.client.api.channels[this.id].messages["bulk-delete"].post({data:{messages:s}}).then(()=>this.client.actions.MessageDeleteBulk.handle({channel_id:this.id,ids:s}).messages)}throw new d("MESSAGE_BULK_DELETE_TYPE")}acknowledge(){return this.lastMessageID?this.client.api.channels[this.id].messages[this.lastMessageID].ack.post({data:{token:this.client.rest._ackToken}}).then(e=>(e.token&&(this.client.rest._ackToken=e.token),this)):Promise.resolve(this)}static applyToClass(e,t=!1,s=[]){const i=["send"];t&&i.push("acknowledge","search","bulkDelete","startTyping","stopTyping","typing","typingCount","createMessageCollector","awaitMessages");for(const t of i)s.includes(t)||Object.defineProperty(e.prototype,t,Object.getOwnPropertyDescriptor(TextBasedChannel.prototype,t))}}e.exports=TextBasedChannel;const p=s(23)}).call(t,s(17).Buffer)},function(e,t){class MessageAttachment{constructor(e,t,s){this.file=null,s&&this._patch(s),t?this.setAttachment(e,t):this._attach(e)}get name(){return this.file.name}get attachment(){return this.file.attachment}setAttachment(e,t){return this.file={attachment:e,name:t},this}setFile(e){return this.file={attachment:e},this}setName(e){return this.file.name=e,this}_attach(e,t){"string"==typeof e?this.file=e:this.setAttachment(e,t)}_patch(e){this.id=e.id,this.size=e.size,this.url=e.url,this.proxyURL=e.proxy_url,this.height=e.height,this.width=e.width}}e.exports=MessageAttachment},function(e,t){function s(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function i(e){return"function"==typeof e}function n(e){return"number"==typeof e}function r(e){return"object"==typeof e&&null!==e}function o(e){return void 0===e}e.exports=s,s.EventEmitter=s,s.prototype._events=void 0,s.prototype._maxListeners=void 0,s.defaultMaxListeners=10,s.prototype.setMaxListeners=function(e){if(!n(e)||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},s.prototype.emit=function(e){var t,s,n,a,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(s=this._events[e],o(s))return!1;if(i(s))switch(arguments.length){case 1:s.call(this);break;case 2:s.call(this,arguments[1]);break;case 3:s.call(this,arguments[1],arguments[2]);break;default:a=Array.prototype.slice.call(arguments,1),s.apply(this,a)}else if(r(s))for(a=Array.prototype.slice.call(arguments,1),n=(l=s.slice()).length,c=0;c0&&this._events[e].length>n&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace()),this},s.prototype.on=s.prototype.addListener,s.prototype.once=function(e,t){function s(){this.removeListener(e,s),n||(n=!0,t.apply(this,arguments))}if(!i(t))throw TypeError("listener must be a function");var n=!1;return s.listener=t,this.on(e,s),this},s.prototype.removeListener=function(e,t){var s,n,o,a;if(!i(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(s=this._events[e],o=s.length,n=-1,s===t||i(s.listener)&&s.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(r(s)){for(a=o;a-- >0;)if(s[a]===t||s[a].listener&&s[a].listener===t){n=a;break}if(n<0)return this;1===s.length?(s.length=0,delete this._events[e]):s.splice(n,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},s.prototype.removeAllListeners=function(e){var t,s;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(s=this._events[e],i(s))this.removeListener(e,s);else if(s)for(;s.length;)this.removeListener(e,s[s.length-1]);return delete this._events[e],this},s.prototype.listeners=function(e){return this._events&&this._events[e]?i(this._events[e])?[this._events[e]]:this._events[e].slice():[]},s.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(i(t))return 1;if(t)return t.length}return 0},s.listenerCount=function(e,t){return e.listenerCount(t)}},function(e,t,s){const i=s(19),{Presence:n}=s(13),r=s(99),o=s(6),a=s(7),{Error:c}=s(4);class User extends a{constructor(e,t){super(e),this.id=t.id,this._patch(t)}_patch(e){e.username&&(this.username=e.username),e.discriminator&&(this.discriminator=e.discriminator),void 0!==e.avatar&&(this.avatar=e.avatar),void 0===this.bot&&void 0!==e.bot&&(this.bot=Boolean(e.bot)),this.lastMessageID=null,this.lastMessage=null,e.token&&(this.client.token=e.token)}get createdTimestamp(){return o.deconstruct(this.id).timestamp}get createdAt(){return new Date(this.createdTimestamp)}get presence(){if(this.client.presences.has(this.id))return this.client.presences.get(this.id);for(const e of this.client.guilds.values())if(e.presences.has(this.id))return e.presences.get(this.id);return new n}avatarURL({format:e,size:t}={}){return this.avatar?this.client.rest.cdn.Avatar(this.id,this.avatar,e,t):null}get defaultAvatarURL(){return this.client.rest.cdn.DefaultAvatar(this.discriminator%5)}displayAvatarURL(e){return this.avatarURL(e)||this.defaultAvatarURL}get tag(){return`${this.username}#${this.discriminator}`}get note(){return this.client.user.notes.get(this.id)||null}typingIn(e){return(e=this.client.channels.resolve(e))._typing.has(this.id)}typingSinceIn(e){return(e=this.client.channels.resolve(e))._typing.has(this.id)?new Date(e._typing.get(this.id).since):null}typingDurationIn(e){return(e=this.client.channels.resolve(e))._typing.has(this.id)?e._typing.get(this.id).elapsedTime:-1}get dmChannel(){return this.client.channels.filter(e=>"dm"===e.type).find(e=>e.recipient.id===this.id)}createDM(){return this.dmChannel?Promise.resolve(this.dmChannel):this.client.api.users(this.client.user.id).channels.post({data:{recipient_id:this.id}}).then(e=>this.client.actions.ChannelCreate.handle(e).channel)}deleteDM(){return this.dmChannel?this.client.api.channels(this.dmChannel.id).delete().then(e=>this.client.actions.ChannelDelete.handle(e).channel):Promise.reject(new c("USER_NO_DMCHANNEL"))}fetchProfile(){return this.client.api.users(this.id).profile.get().then(e=>new r(this,e))}setNote(e){return this.client.api.users("@me").notes(this.id).put({data:{note:e}}).then(()=>this)}equals(e){return e&&this.id===e.id&&this.username===e.username&&this.discriminator===e.discriminator&&this.avatar===e.avatar}toString(){return`<@${this.id}>`}send(){}}i.applyToClass(User),e.exports=User},function(e,t,s){const i=s(8),n=s(3),r=s(35),{Error:o}=s(4);class MessageStore extends i{constructor(e,t){super(e.client,t,r),this.channel=e}create(e,t){return super.create(e,t,{extras:[this.channel]})}set(e,t){const s=this.client.options.messageCacheMaxSize;0!==s&&(this.size>=s&&s>0&&this.delete(this.firstKey()),super.set(e,t))}fetch(e){return"string"==typeof e?this._fetchId(e):this._fetchMany(e)}fetchPinned(){return this.client.api.channels[this.channel.id].pins.get().then(e=>{const t=new n;for(const s of e)t.set(s.id,this.create(s));return t})}_fetchId(e){return this.client.user.bot?this.client.api.channels[this.channel.id].messages[e].get().then(e=>this.create(e)):this._fetchMany({limit:1,around:e}).then(t=>{const s=t.get(e);if(!s)throw new o("MESSAGE_MISSING");return s})}_fetchMany(e={}){return this.client.api.channels[this.channel.id].messages.get({query:e}).then(e=>{const t=new n;for(const s of e)t.set(s.id,this.create(s));return t})}}e.exports=MessageStore},function(e,t,s){const i=s(6),n=s(9),r=s(5),o=s(7),{TypeError:a}=s(4);class Role extends o{constructor(e,t,s){super(e),this.guild=s,t&&this._patch(t)}_patch(e){this.id=e.id,this.name=e.name,this.color=e.color,this.hoist=e.hoist,this.rawPosition=e.position,this.permissions=new n(e.permissions).freeze(),this.managed=e.managed,this.mentionable=e.mentionable}get createdTimestamp(){return i.deconstruct(this.id).timestamp}get createdAt(){return new Date(this.createdTimestamp)}get hexColor(){let e=this.color.toString(16);for(;e.length<6;)e=`0${e}`;return`#${e}`}get members(){return this.guild.members.filter(e=>e.roles.has(this.id))}get editable(){if(this.managed)return!1;const e=this.guild.member(this.client.user);return!!e.permissions.has(n.FLAGS.MANAGE_ROLES)&&e.highestRole.comparePositionTo(this)>0}get position(){const e=this.guild._sortedRoles();return e.array().indexOf(e.get(this.id))}comparePositionTo(e){return(e=this.guild.roles.resolve(e))?this.constructor.comparePositions(this,e):Promise.reject(new a("INVALID_TYPE","role","Role nor a Snowflake"))}edit(e,t){return e.permissions?e.permissions=n.resolve(e.permissions):e.permissions=this.permissions.bitfield,this.client.api.guilds[this.guild.id].roles[this.id].patch({data:{name:e.name||this.name,color:r.resolveColor(e.color||this.color),hoist:void 0!==e.hoist?e.hoist:this.hoist,position:void 0!==e.position?e.position:this.position,permissions:e.permissions,mentionable:void 0!==e.mentionable?e.mentionable:this.mentionable},reason:t}).then(e=>{const t=this._clone();return t._patch(e),t})}setName(e,t){return this.edit({name:e},t)}setColor(e,t){return this.edit({color:e},t)}setHoist(e,t){return this.edit({hoist:e},t)}setPermissions(e,t){return this.edit({permissions:e},t)}setMentionable(e,t){return this.edit({mentionable:e},t)}setPosition(e,{relative:t,reason:s}={}){return r.setPosition(this,e,t,this.guild._sortedRoles(),this.client.api.guilds(this.guild.id).roles,s).then(e=>(this.client.actions.GuildRolesPositionUpdate.handle({guild_id:this.id,channels:e}),this))}delete(e){return this.client.api.guilds[this.guild.id].roles[this.id].delete({reason:e}).then(()=>(this.client.actions.GuildRoleDelete.handle({guild_id:this.guild.id,role_id:this.id}),this))}equals(e){return e&&this.id===e.id&&this.name===e.name&&this.color===e.color&&this.hoist===e.hoist&&this.position===e.position&&this.permissions.bitfield===e.permissions.bitfield&&this.managed===e.managed}toString(){return this.id===this.guild.id?"@everyone":`<@&${this.id}>`}static comparePositions(e,t){return e.position===t.position?t.id-e.id:e.position-t.position}}e.exports=Role},function(e,t,s){const{Endpoints:i}=s(0),n=s(7);class Invite extends n{constructor(e,t){super(e),this._patch(t)}_patch(e){this.guild=this.client.guilds.create(e.guild,!1),this.code=e.code,this.presenceCount=e.approximate_presence_count,this.memberCount=e.approximate_member_count,this.textChannelCount=e.guild.text_channel_count,this.voiceChannelCount=e.guild.voice_channel_count,this.temporary=e.temporary,this.maxAge=e.max_age,this.uses=e.uses,this.maxUses=e.max_uses,e.inviter&&(this.inviter=this.client.users.create(e.inviter)),this.channel=this.client.channels.create(e.channel,this.guild,!1),this.createdTimestamp=new Date(e.created_at).getTime()}get createdAt(){return new Date(this.createdTimestamp)}get expiresTimestamp(){return this.createdTimestamp+1e3*this.maxAge}get expiresAt(){return new Date(this.expiresTimestamp)}get url(){return i.invite(this.client.options.http.invite,this.code)}delete(e){return this.client.api.invites[this.code].delete({reason:e}).then(()=>this)}toString(){return this.url}}e.exports=Invite},function(e,t,s){const i=s(25),n=s(55),r=s(16),o=s(12),a=s(56),{ChannelTypes:c,Events:l}=s(0),h=s(3),u=s(5),d=s(10),p=s(6),f=s(9),g=s(45),m=s(95),E=s(96),_=s(57),y=s(97),v=s(58),A=s(7),{Error:b,TypeError:w}=s(4);class Guild extends A{constructor(e,t){super(e),this.members=new m(this),this.channels=new y(this),this.roles=new E(this),this.presences=new v(this.client),t&&(t.unavailable?(this.available=!1,this.id=t.id):(this._patch(t),t.channels||(this.available=!1)))}_patch(e){if(this.name=e.name,this.icon=e.icon,this.splash=e.splash,this.region=e.region,this.memberCount=e.member_count||this.memberCount,this.large=Boolean("large"in e?e.large:this.large),this.features=e.features,this.applicationID=e.application_id,this.afkTimeout=e.afk_timeout,this.afkChannelID=e.afk_channel_id,this.systemChannelID=e.system_channel_id,this.embedEnabled=e.embed_enabled,this.verificationLevel=e.verification_level,this.explicitContentFilter=e.explicit_content_filter,this.joinedTimestamp=e.joined_at?new Date(e.joined_at).getTime():this.joinedTimestamp,this.id=e.id,this.available=!e.unavailable,this.features=e.features||this.features||[],e.members){this.members.clear();for(const t of e.members)this.members.create(t)}if(e.owner_id&&(this.ownerID=e.owner_id),e.channels){this.channels.clear();for(const t of e.channels)this.client.channels.create(t,this)}if(e.roles){this.roles.clear();for(const t of e.roles)this.roles.create(t)}if(e.presences)for(const t of e.presences)this.presences.create(t);if(this.voiceStates=new VoiceStateCollection(this),e.voice_states)for(const t of e.voice_states)this.voiceStates.set(t.user_id,t);if(this.emojis)this.client.actions.GuildEmojisUpdate.handle({guild_id:this.id,emojis:e.emojis});else if(this.emojis=new _(this),e.emojis)for(const t of e.emojis)this.emojis.create(t)}get createdTimestamp(){return p.deconstruct(this.id).timestamp}get createdAt(){return new Date(this.createdTimestamp)}get joinedAt(){return new Date(this.joinedTimestamp)}iconURL({format:e,size:t}={}){return this.icon?this.client.rest.cdn.Icon(this.id,this.icon,e,t):null}get nameAcronym(){return this.name.replace(/\w+/g,e=>e[0]).replace(/\s/g,"")}splashURL({format:e,size:t}={}){return this.splash?this.client.rest.cdn.Splash(this.id,this.splash,e,t):null}get owner(){return this.members.get(this.ownerID)}get afkChannel(){return this.client.channels.get(this.afkChannelID)||null}get systemChannel(){return this.client.channels.get(this.systemChannelID)||null}get voiceConnection(){return this.client.browser?null:this.client.voice.connections.get(this.id)||null}get position(){return this.client.user.bot?null:this.client.user.settings.guildPositions?this.client.user.settings.guildPositions.indexOf(this.id):null}get muted(){if(this.client.user.bot)return null;try{return this.client.user.guildSettings.get(this.id).muted}catch(e){return!1}}get messageNotifications(){if(this.client.user.bot)return null;try{return this.client.user.guildSettings.get(this.id).messageNotifications}catch(e){return null}}get mobilePush(){if(this.client.user.bot)return null;try{return this.client.user.guildSettings.get(this.id).mobilePush}catch(e){return!1}}get suppressEveryone(){if(this.client.user.bot)return null;try{return this.client.user.guildSettings.get(this.id).suppressEveryone}catch(e){return null}}get defaultRole(){return this.roles.get(this.id)}get me(){return this.members.get(this.client.user.id)}member(e){return this.members.resolve(e)}fetchBans(){return this.client.api.guilds(this.id).bans.get().then(e=>e.reduce((e,t)=>(e.set(t.user.id,{reason:t.reason,user:this.client.users.create(t.user)}),e),new h))}fetchInvites(){return this.client.api.guilds(this.id).invites.get().then(e=>{const t=new h;for(const s of e){const e=new i(this.client,s);t.set(e.code,e)}return t})}fetchWebhooks(){return this.client.api.guilds(this.id).webhooks.get().then(e=>{const t=new h;for(const s of e)t.set(s.id,new r(this.client,s));return t})}fetchVoiceRegions(){return this.client.api.guilds(this.id).regions.get().then(e=>{const t=new h;for(const s of e)t.set(s.id,new a(s));return t})}fetchAuditLogs(e={}){return e.before&&e.before instanceof n.Entry&&(e.before=e.before.id),e.after&&e.after instanceof n.Entry&&(e.after=e.after.id),"string"==typeof e.type&&(e.type=n.Actions[e.type]),this.client.api.guilds(this.id)["audit-logs"].get({query:{before:e.before,after:e.after,limit:e.limit,user_id:this.client.users.resolveID(e.user),action_type:e.type}}).then(e=>n.build(this,e))}addMember(e,t){if(this.members.has(e.id))return Promise.resolve(this.members.get(e.id));if(t.access_token=t.accessToken,t.roles){const e=[];for(let s of t.roles instanceof h?t.roles.values():t.roles){if(!(s=this.roles.resolve(s)))return Promise.reject(new w("INVALID_TYPE","options.roles","Array or Collection of Roles or Snowflakes",!0));e.push(s.id)}}return this.client.api.guilds(this.id).members(e.id).put({data:t}).then(e=>this.client.actions.GuildMemberGet.handle(this,e).member)}search(e={}){return g.search(this,e)}edit(e,t){const s={};return e.name&&(s.name=e.name),e.region&&(s.region=e.region),void 0!==e.verificationLevel&&(s.verification_level=Number(e.verificationLevel)),void 0!==e.afkChannel&&(s.afk_channel_id=this.client.channels.resolveID(e.afkChannel)),void 0!==e.systemChannel&&(s.system_channel_id=this.client.channels.resolveID(e.systemChannel)),e.afkTimeout&&(s.afk_timeout=Number(e.afkTimeout)),void 0!==e.icon&&(s.icon=e.icon),e.owner&&(s.owner_id=this.client.users.resolve(e.owner).id),e.splash&&(s.splash=e.splash),void 0!==e.explicitContentFilter&&(s.explicit_content_filter=Number(e.explicitContentFilter)),this.client.api.guilds(this.id).patch({data:s,reason:t}).then(e=>this.client.actions.GuildUpdate.handle(e).updated)}setExplicitContentFilter(e,t){return this.edit({explicitContentFilter:e},t)}setName(e,t){return this.edit({name:e},t)}setRegion(e,t){return this.edit({region:e},t)}setVerificationLevel(e,t){return this.edit({verificationLevel:e},t)}setAFKChannel(e,t){return this.edit({afkChannel:e},t)}setSystemChannel(e,t){return this.edit({systemChannel:e},t)}setAFKTimeout(e,t){return this.edit({afkTimeout:e},t)}async setIcon(e,t){return this.edit({icon:await d.resolveImage(e,this.client.browser),reason:t})}setOwner(e,t){return this.edit({owner:e},t)}async setSplash(e,t){return this.edit({splash:await d.resolveImage(e,this.client.browser),reason:t})}setPosition(e,t){return this.client.user.bot?Promise.reject(new b("FEATURE_USER_ONLY")):this.client.user.settings.setGuildPosition(this,e,t)}acknowledge(){return this.client.api.guilds(this.id).ack.post({data:{token:this.client.rest._ackToken}}).then(e=>(e.token&&(this.client.rest._ackToken=e.token),this))}allowDMs(e){const t=this.client.user.settings;return e?t.removeRestrictedGuild(this):t.addRestrictedGuild(this)}ban(e,t={days:0}){t.days&&(t["delete-message-days"]=t.days);const s=this.client.users.resolveID(e);return s?this.client.api.guilds(this.id).bans[s].put({query:t}).then(()=>{if(e instanceof o)return e;const t=this.client.users.resolve(s);return t?this.members.resolve(t)||t:s}):Promise.reject(new b("BAN_RESOLVE_ID",!0))}unban(e,t){const s=this.client.users.resolveID(e);if(!s)throw new b("BAN_RESOLVE_ID");return this.client.api.guilds(this.id).bans[s].delete({reason:t}).then(()=>e)}pruneMembers({days:e=7,dry:t=!1,reason:s}={}){if("number"!=typeof e)throw new w("PRUNE_DAYS_TYPE");return this.client.api.guilds(this.id).prune[t?"get":"post"]({query:{days:e},reason:s}).then(e=>e.pruned)}sync(){this.client.user.bot||this.client.syncGuilds([this])}createChannel(e,t,{overwrites:s,reason:i}={}){return(s instanceof h||s instanceof Array)&&(s=s.map(e=>{let t=e.allow||e.allowed.bitfield,s=e.deny||e.denied.bitfield;t instanceof Array&&(t=f.resolve(t)),s instanceof Array&&(s=f.resolve(s));const i=this.roles.resolve(e.id);return i?(e.id=i.id,e.type="role"):(e.id=this.client.users.resolveID(e.id),e.type="member"),{allow:t,deny:s,type:e.type,id:e.id}})),this.client.api.guilds(this.id).channels.post({data:{name:e,type:c[t.toUpperCase()],permission_overwrites:s},reason:i}).then(e=>this.client.actions.ChannelCreate.handle(e).channel)}setChannelPositions(e){const t=e.map(e=>({id:this.client.channels.resolveID(e.channel),position:e.position}));return this.client.api.guilds(this.id).channels.patch({data:t}).then(()=>this.client.actions.GuildChannelsPositionUpdate.handle({guild_id:this.id,channels:t}).guild)}createRole({data:e={},reason:t}={}){return e.color&&(e.color=u.resolveColor(e.color)),e.permissions&&(e.permissions=f.resolve(e.permissions)),this.client.api.guilds(this.id).roles.post({data:e,reason:t}).then(s=>{const{role:i}=this.client.actions.GuildRoleCreate.handle({guild_id:this.id,role:s});return e.position?i.setPosition(e.position,t):i})}createEmoji(e,t,{roles:s,reason:i}={}){if("string"==typeof e&&e.startsWith("data:")){const n={image:e,name:t};if(s){n.roles=[];for(let e of s instanceof h?s.values():s){if(!(e=this.roles.resolve(e)))return Promise.reject(new w("INVALID_TYPE","options.roles","Array or Collection of Roles or Snowflakes",!0));n.roles.push(e.id)}}return this.client.api.guilds(this.id).emojis.post({data:n,reason:i}).then(e=>this.client.actions.GuildEmojiCreate.handle(this,e).emoji)}return d.resolveImage(e,this.client.browser).then(e=>this.createEmoji(e,t,{roles:s,reason:i}))}leave(){return this.ownerID===this.client.user.id?Promise.reject(new b("GUILD_OWNED")):this.client.api.users("@me").guilds(this.id).delete().then(()=>this.client.actions.GuildDelete.handle({id:this.id}).guild)}delete(){return this.client.api.guilds(this.id).delete().then(()=>this.client.actions.GuildDelete.handle({id:this.id}).guild)}equals(e){let t=e&&e instanceof this.constructor&&this.id===e.id&&this.available===e.available&&this.splash===e.splash&&this.region===e.region&&this.name===e.name&&this.memberCount===e.memberCount&&this.large===e.large&&this.icon===e.icon&&u.arraysEqual(this.features,e.features)&&this.ownerID===e.ownerID&&this.verificationLevel===e.verificationLevel&&this.embedEnabled===e.embedEnabled;return t&&(this.embedChannel?e.embedChannel&&this.embedChannel.id===e.embedChannel.id||(t=!1):e.embedChannel&&(t=!1)),t}toString(){return this.name}_memberSpeakUpdate(e,t){const s=this.members.get(e);s&&s.speaking!==t&&(s.speaking=t,this.client.emit(l.GUILD_MEMBER_SPEAKING,s,t))}_sortedRoles(){return u.discordSort(this.roles)}_sortedChannels(e){const t=e.type===c.CATEGORY;return u.discordSort(this.channels.filter(s=>s.type===e.type&&(t||s.parent===e.parent)))}}class VoiceStateCollection extends h{constructor(e){super(),this.guild=e}set(e,t){const s=this.guild.members.get(e);if(s){s.voiceChannel&&s.voiceChannel.id!==t.channel_id&&s.voiceChannel.members.delete(s.id),t.channel_id||(s.speaking=null);const e=this.guild.channels.get(t.channel_id);e&&e.members.set(s.user.id,s)}super.set(e,t)}}e.exports=Guild},function(e,t){var s;s=function(){return this}();try{s=s||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(s=window)}e.exports=s},function(e,t,s){var i,n,r;!function(s,o){n=[],void 0!==(r="function"==typeof(i=o)?i.apply(t,n):i)&&(e.exports=r)}(0,function(){"use strict";function e(e,t,s){this.low=0|e,this.high=0|t,this.unsigned=!!s}function t(e){return!0===(e&&e.__isLong__)}function s(e,t){var s,i,r;return t?(e>>>=0,(r=0<=e&&e<256)&&(i=c[e])?i:(s=n(e,(0|e)<0?-1:0,!0),r&&(c[e]=s),s)):(e|=0,(r=-128<=e&&e<128)&&(i=a[e])?i:(s=n(e,e<0?-1:0,!1),r&&(a[e]=s),s))}function i(e,t){if(isNaN(e)||!isFinite(e))return t?g:f;if(t){if(e<0)return g;if(e>=u)return v}else{if(e<=-d)return A;if(e+1>=d)return y}return e<0?i(-e,t).neg():n(e%h|0,e/h|0,t)}function n(t,s,i){return new e(t,s,i)}function r(e,t,s){if(0===e.length)throw Error("empty string");if("NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return f;if("number"==typeof t?(s=t,t=!1):t=!!t,(s=s||10)<2||360)throw Error("interior hyphen");if(0===n)return r(e.substring(1),t,s).neg();for(var o=i(l(s,8)),a=f,c=0;c>>0:this.low},b.toNumber=function(){return this.unsigned?(this.high>>>0)*h+(this.low>>>0):this.high*h+(this.low>>>0)},b.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}},b.getHighBits=function(){return this.high},b.getHighBitsUnsigned=function(){return this.high>>>0},b.getLowBits=function(){return this.low},b.getLowBitsUnsigned=function(){return this.low>>>0},b.getNumBitsAbs=function(){if(this.isNegative())return this.eq(A)?64:this.neg().getNumBitsAbs();for(var e=0!=this.high?this.high:this.low,t=31;t>0&&0==(e&1<=0},b.isOdd=function(){return 1==(1&this.low)},b.isEven=function(){return 0==(1&this.low)},b.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)},b.eq=b.equals,b.notEquals=function(e){return!this.eq(e)},b.neq=b.notEquals,b.lessThan=function(e){return this.comp(e)<0},b.lt=b.lessThan,b.lessThanOrEqual=function(e){return this.comp(e)<=0},b.lte=b.lessThanOrEqual,b.greaterThan=function(e){return this.comp(e)>0},b.gt=b.greaterThan,b.greaterThanOrEqual=function(e){return this.comp(e)>=0},b.gte=b.greaterThanOrEqual,b.compare=function(e){if(t(e)||(e=o(e)),this.eq(e))return 0;var s=this.isNegative(),i=e.isNegative();return s&&!i?-1:!s&&i?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1},b.comp=b.compare,b.negate=function(){return!this.unsigned&&this.eq(A)?A:this.not().add(m)},b.neg=b.negate,b.add=function(e){t(e)||(e=o(e));var s=this.high>>>16,i=65535&this.high,r=this.low>>>16,a=65535&this.low,c=e.high>>>16,l=65535&e.high,h=e.low>>>16,u=0,d=0,p=0,f=0;return f+=a+(65535&e.low),p+=f>>>16,f&=65535,p+=r+h,d+=p>>>16,p&=65535,d+=i+l,u+=d>>>16,d&=65535,u+=s+c,u&=65535,n(p<<16|f,u<<16|d,this.unsigned)},b.subtract=function(e){return t(e)||(e=o(e)),this.add(e.neg())},b.sub=b.subtract,b.multiply=function(e){if(this.isZero())return f;if(t(e)||(e=o(e)),e.isZero())return f;if(this.eq(A))return e.isOdd()?A:f;if(e.eq(A))return this.isOdd()?A:f;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(p)&&e.lt(p))return i(this.toNumber()*e.toNumber(),this.unsigned);var s=this.high>>>16,r=65535&this.high,a=this.low>>>16,c=65535&this.low,l=e.high>>>16,h=65535&e.high,u=e.low>>>16,d=65535&e.low,g=0,m=0,E=0,_=0;return _+=c*d,E+=_>>>16,_&=65535,E+=a*d,m+=E>>>16,E&=65535,E+=c*u,m+=E>>>16,E&=65535,m+=r*d,g+=m>>>16,m&=65535,m+=a*u,g+=m>>>16,m&=65535,m+=c*h,g+=m>>>16,m&=65535,g+=s*d+r*u+a*h+c*l,g&=65535,n(E<<16|_,g<<16|m,this.unsigned)},b.mul=b.multiply,b.divide=function(e){if(t(e)||(e=o(e)),e.isZero())throw Error("division by zero");if(this.isZero())return this.unsigned?g:f;var s,n,r;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return g;if(e.gt(this.shru(1)))return E;r=g}else{if(this.eq(A))return e.eq(m)||e.eq(_)?A:e.eq(A)?m:(s=this.shr(1).div(e).shl(1)).eq(f)?e.isNegative()?m:_:(n=this.sub(e.mul(s)),r=s.add(n.div(e)));if(e.eq(A))return this.unsigned?g:f;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();r=f}for(n=this;n.gte(e);){s=Math.max(1,Math.floor(n.toNumber()/e.toNumber()));for(var a=Math.ceil(Math.log(s)/Math.LN2),c=a<=48?1:l(2,a-48),h=i(s),u=h.mul(e);u.isNegative()||u.gt(n);)u=(h=i(s-=c,this.unsigned)).mul(e);h.isZero()&&(h=m),r=r.add(h),n=n.sub(u)}return r},b.div=b.divide,b.modulo=function(e){return t(e)||(e=o(e)),this.sub(this.div(e).mul(e))},b.mod=b.modulo,b.not=function(){return n(~this.low,~this.high,this.unsigned)},b.and=function(e){return t(e)||(e=o(e)),n(this.low&e.low,this.high&e.high,this.unsigned)},b.or=function(e){return t(e)||(e=o(e)),n(this.low|e.low,this.high|e.high,this.unsigned)},b.xor=function(e){return t(e)||(e=o(e)),n(this.low^e.low,this.high^e.high,this.unsigned)},b.shiftLeft=function(e){return t(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?n(this.low<>>32-e,this.unsigned):n(0,this.low<>>e|this.high<<32-e,this.high>>e,this.unsigned):n(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},b.shr=b.shiftRight,b.shiftRightUnsigned=function(e){if(t(e)&&(e=e.toInt()),0===(e&=63))return this;var s=this.high;return e<32?n(this.low>>>e|s<<32-e,s>>>e,this.unsigned):32===e?n(s,0,this.unsigned):n(s>>>e-32,0,this.unsigned)},b.shru=b.shiftRightUnsigned,b.toSigned=function(){return this.unsigned?n(this.low,this.high,!1):this},b.toUnsigned=function(){return this.unsigned?this:n(this.low,this.high,!0)},b.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},b.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]},b.toBytesBE=function(){var e=this.high,t=this.low;return[e>>>24&255,e>>>16&255,e>>>8&255,255&e,t>>>24&255,t>>>16&255,t>>>8&255,255&t]},e})},function(e,t,s){e.exports=s(66)},function(e,t,s){"use strict";t.decode=t.parse=s(67),t.encode=t.stringify=s(68)},function(e,t,s){(function(e,i){function n(e,s){var i={seen:[],stylize:o};return arguments.length>=3&&(i.depth=arguments[2]),arguments.length>=4&&(i.colors=arguments[3]),g(s)?i.showHidden=s:s&&t._extend(i,s),y(i.showHidden)&&(i.showHidden=!1),y(i.depth)&&(i.depth=2),y(i.colors)&&(i.colors=!1),y(i.customInspect)&&(i.customInspect=!0),i.colors&&(i.stylize=r),c(i,e,i.depth)}function r(e,t){var s=n.styles[t];return s?"["+n.colors[s][0]+"m"+e+"["+n.colors[s][1]+"m":e}function o(e,t){return e}function a(e){var t={};return e.forEach(function(e,s){t[e]=!0}),t}function c(e,s,i){if(e.customInspect&&s&&T(s.inspect)&&s.inspect!==t.inspect&&(!s.constructor||s.constructor.prototype!==s)){var n=s.inspect(i,e);return _(n)||(n=c(e,n,i)),n}var r=l(e,s);if(r)return r;var o=Object.keys(s),g=a(o);if(e.showHidden&&(o=Object.getOwnPropertyNames(s)),w(s)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return h(s);if(0===o.length){if(T(s)){var m=s.name?": "+s.name:"";return e.stylize("[Function"+m+"]","special")}if(v(s))return e.stylize(RegExp.prototype.toString.call(s),"regexp");if(b(s))return e.stylize(Date.prototype.toString.call(s),"date");if(w(s))return h(s)}var E="",y=!1,A=["{","}"];if(f(s)&&(y=!0,A=["[","]"]),T(s)&&(E=" [Function"+(s.name?": "+s.name:"")+"]"),v(s)&&(E=" "+RegExp.prototype.toString.call(s)),b(s)&&(E=" "+Date.prototype.toUTCString.call(s)),w(s)&&(E=" "+h(s)),0===o.length&&(!y||0==s.length))return A[0]+E+A[1];if(i<0)return v(s)?e.stylize(RegExp.prototype.toString.call(s),"regexp"):e.stylize("[Object]","special");e.seen.push(s);var I;return I=y?u(e,s,i,g,o):o.map(function(t){return d(e,s,i,g,t,y)}),e.seen.pop(),p(I,E,A)}function l(e,t){if(y(t))return e.stylize("undefined","undefined");if(_(t)){var s="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(s,"string")}return E(t)?e.stylize(""+t,"number"):g(t)?e.stylize(""+t,"boolean"):m(t)?e.stylize("null","null"):void 0}function h(e){return"["+Error.prototype.toString.call(e)+"]"}function u(e,t,s,i,n){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")),y(o)){if(r&&n.match(/^\d+$/))return a;(o=JSON.stringify(""+n)).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,s){var i=0;return e.reduce(function(e,t){return i++,t.indexOf("\n")>=0&&i++,e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0)>60?s[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+s[1]:s[0]+t+" "+e.join(", ")+" "+s[1]}function f(e){return Array.isArray(e)}function g(e){return"boolean"==typeof e}function m(e){return null===e}function E(e){return"number"==typeof e}function _(e){return"string"==typeof e}function y(e){return void 0===e}function v(e){return A(e)&&"[object RegExp]"===I(e)}function A(e){return"object"==typeof e&&null!==e}function b(e){return A(e)&&"[object Date]"===I(e)}function w(e){return A(e)&&("[object Error]"===I(e)||e instanceof Error)}function T(e){return"function"==typeof e}function I(e){return Object.prototype.toString.call(e)}function S(e){return e<10?"0"+e.toString(10):e.toString(10)}function D(){var e=new Date,t=[S(e.getHours()),S(e.getMinutes()),S(e.getSeconds())].join(":");return[e.getDate(),O[e.getMonth()],t].join(" ")}function R(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var N=/%[sdj%]/g;t.format=function(e){if(!_(e)){for(var t=[],s=0;s=r)return e;switch(e){case"%s":return String(i[s++]);case"%d":return Number(i[s++]);case"%j":try{return JSON.stringify(i[s++])}catch(e){return"[Circular]"}default:return e}}),a=i[s];s{e(...s),this._timeouts.delete(i)},t);return this._timeouts.add(i),i}clearTimeout(e){clearTimeout(e),this._timeouts.delete(e)}setInterval(e,t,...s){const i=setInterval(e,t,...s);return this._intervals.add(i),i}clearInterval(e){clearInterval(e),this._intervals.delete(e)}}e.exports=BaseClient},function(e,t,s){(function(e){function s(e,t){for(var s=0,i=e.length-1;i>=0;i--){var n=e[i];"."===n?e.splice(i,1):".."===n?(e.splice(i,1),s++):s&&(e.splice(i,1),s--)}if(t)for(;s--;s)e.unshift("..");return e}function i(e,t){if(e.filter)return e.filter(t);for(var s=[],i=0;i=-1&&!n;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,n="/"===o.charAt(0))}return t=s(i(t.split("/"),function(e){return!!e}),!n).join("/"),(n?"/":"")+t||"."},t.normalize=function(e){var n=t.isAbsolute(e),r="/"===o(e,-1);return(e=s(i(e.split("/"),function(e){return!!e}),!n).join("/"))||n||(e="."),e&&r&&(e+="/"),(n?"/":"")+e},t.isAbsolute=function(e){return"/"===e.charAt(0)},t.join=function(){var e=Array.prototype.slice.call(arguments,0);return t.normalize(i(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,s){function i(e){for(var t=0;t=0&&""===e[s];s--);return t>s?[]:e.slice(t,s-t+1)}e=t.resolve(e).substr(1),s=t.resolve(s).substr(1);for(var n=i(e.split("/")),r=i(s.split("/")),o=Math.min(n.length,r.length),a=o,c=0;cthis.stop("time"),s.time))}handleCollect(...e){const t=this.collect(...e);t&&this.filter(...e,this.collected)&&(this.collected.set(t.key,t.value),this.emit("collect",t.value,...e),this.checkEnd())}handleDispose(...e){if(!this.options.dispose)return;const t=this.dispose(...e);if(!t||!this.filter(...e)||!this.collected.has(t))return;const s=this.collected.get(t);this.collected.delete(t),this.emit("dispose",s,...e),this.checkEnd()}get next(){return new Promise((e,t)=>{if(this.ended)return void t(this.collected);const s=()=>{this.removeListener("collect",i),this.removeListener("end",n)},i=t=>{s(),e(t)},n=()=>{s(),t(this.collected)};this.on("collect",i),this.on("end",n)})}stop(e="user"){this.ended||(this._timeout&&this.client.clearTimeout(this._timeout),this.ended=!0,this.emit("end",this.collected,e))}checkEnd(){const e=this.endReason();e&&this.stop(e)}collect(){}dispose(){}endReason(){}}e.exports=Collector},function(e,t,s){const i=s(47),n=s(20),r=s(14),o=s(48),a=s(36),c=s(5),l=s(3),h=s(93),{MessageTypes:u}=s(0),d=s(9),p=s(12),f=s(7),{Error:g,TypeError:m}=s(4);class Message extends f{constructor(e,t,s){super(e),this.channel=s,t&&this._patch(t)}_patch(e){this.id=e.id,this.type=u[e.type],this.content=e.content,this.author=this.client.users.create(e.author,!e.webhook_id),this.member=this.guild?this.guild.member(this.author)||null:null,this.pinned=e.pinned,this.tts=e.tts,this.nonce=e.nonce,this.system=6===e.type,this.embeds=e.embeds.map(e=>new r(e)),this.attachments=new l;for(const t of e.attachments)this.attachments.set(t.id,new n(t.url,t.filename,t));if(this.createdTimestamp=new Date(e.timestamp).getTime(),this.editedTimestamp=e.edited_timestamp?new Date(e.edited_timestamp).getTime():null,this.reactions=new h(this),e.reactions&&e.reactions.length>0)for(const t of e.reactions)this.reactions.create(t);this.mentions=new i(this,e.mentions,e.mention_roles,e.mention_everyone),this.webhookID=e.webhook_id||null,this.application=e.application?new a(this.client,e.application):null,this.activity=e.activity?{partyID:e.activity.party_id,type:e.activity.type}:null,this.hit="boolean"==typeof e.hit?e.hit:null,this._edits=[]}patch(e){const t=this._clone();if(this._edits.unshift(t),this.editedTimestamp=new Date(e.edited_timestamp).getTime(),"content"in e&&(this.content=e.content),"pinned"in e&&(this.pinned=e.pinned),"tts"in e&&(this.tts=e.tts),this.embeds="embeds"in e?e.embeds.map(e=>new r(e)):this.embeds.slice(),"attachments"in e){this.attachments=new l;for(const t of e.attachments)this.attachments.set(t.id,new n(t.url,t.filename,t))}else this.attachments=new l(this.attachments);this.mentions=new i(this,"mentions"in e?e.mentions:this.mentions.users,"mentions_roles"in e?e.mentions_roles:this.mentions.roles,"mention_everyone"in e?e.mention_everyone:this.mentions.everyone)}get createdAt(){return new Date(this.createdTimestamp)}get editedAt(){return this.editedTimestamp?new Date(this.editedTimestamp):null}get guild(){return this.channel.guild||null}get cleanContent(){return this.content.replace(/@(everyone|here)/g,"@​$1").replace(/<@!?[0-9]+>/g,e=>{const t=e.replace(/<|!|>|@/g,"");if("dm"===this.channel.type||"group"===this.channel.type)return this.client.users.has(t)?`@${this.client.users.get(t).username}`:e;const s=this.channel.guild.members.get(t);if(s)return s.nickname?`@${s.nickname}`:`@${s.user.username}`;{const s=this.client.users.get(t);return s?`@${s.username}`:e}}).replace(/<#[0-9]+>/g,e=>{const t=this.client.channels.get(e.replace(/<|#|>/g,""));return t?`#${t.name}`:e}).replace(/<@&[0-9]+>/g,e=>{if("dm"===this.channel.type||"group"===this.channel.type)return e;const t=this.guild.roles.get(e.replace(/<|@|>|&/g,""));return t?`@${t.name}`:e})}createReactionCollector(e,t={}){return new o(this,e,t)}awaitReactions(e,t={}){return new Promise((s,i)=>{this.createReactionCollector(e,t).once("end",(e,n)=>{t.errors&&t.errors.includes(n)?i(e):s(e)})})}get edits(){const e=this._edits.slice();return e.unshift(this),e}get editable(){return this.author.id===this.client.user.id}get deletable(){return this.author.id===this.client.user.id||this.guild&&this.channel.permissionsFor(this.client.user).has(d.FLAGS.MANAGE_MESSAGES)}get pinnable(){return!this.guild||this.channel.permissionsFor(this.client.user).has(d.FLAGS.MANAGE_MESSAGES)}edit(e,t){t||"object"!=typeof e||e instanceof Array?t||(t={}):(t=e,e=""),t instanceof r&&(t={embed:t}),void 0!==t.content&&(e=t.content),void 0!==e&&(e=c.resolveString(e));let{embed:s,code:i,reply:n}=t;if(s&&(s=new r(s)._apiTransform()),void 0===i||"boolean"==typeof i&&!0!==i||(e=c.escapeMarkdown(c.resolveString(e),!0),e=`\`\`\`${"boolean"!=typeof i?i||"":""}\n${e}\n\`\`\``),n&&"dm"!==this.channel.type){const t=this.client.users.resolveID(n);e=`${`<@${n instanceof p&&n.nickname?"!":""}${t}>`}${e?`, ${e}`:""}`}return this.client.api.channels[this.channel.id].messages[this.id].patch({data:{content:e,embed:s}}).then(e=>{const t=this._clone();return t._patch(e),t})}pin(){return this.client.api.channels(this.channel.id).pins(this.id).put().then(()=>this)}unpin(){return this.client.api.channels(this.channel.id).pins(this.id).delete().then(()=>this)}react(e){if(!(e=this.client.emojis.resolveIdentifier(e)))throw new m("EMOJI_TYPE");return this.client.api.channels(this.channel.id).messages(this.id).reactions(e,"@me").put().then(()=>this.client.actions.MessageReactionAdd.handle({user:this.client.user,channel:this.channel,message:this,emoji:c.parseEmoji(e)}).reaction)}clearReactions(){return this.client.api.channels(this.channel.id).messages(this.id).reactions.delete().then(()=>this)}delete({timeout:e=0,reason:t}={}){return e<=0?this.client.api.channels(this.channel.id).messages(this.id).delete({reason:t}).then(()=>this.client.actions.MessageDelete.handle({id:this.id,channel_id:this.channel.id}).message):new Promise(s=>{this.client.setTimeout(()=>{s(this.delete({reason:t}))},e)})}reply(e,t){return t||"object"!=typeof e||e instanceof Array?t||(t={}):(t=e,e=""),this.channel.send(e,Object.assign(t,{reply:this.member||this.author}))}acknowledge(){return this.client.api.channels(this.channel.id).messages(this.id).ack.post({data:{token:this.client.rest._ackToken}}).then(e=>(e.token&&(this.client.rest._ackToken=e.token),this))}fetchWebhook(){return this.webhookID?this.client.fetchWebhook(this.webhookID):Promise.reject(new g("WEBHOOK_MESSAGE"))}equals(e,t){if(!e)return!1;if(!e.author&&!e.attachments)return this.id===e.id&&this.embeds.length===e.embeds.length;let s=this.id===e.id&&this.author.id===e.author.id&&this.content===e.content&&this.tts===e.tts&&this.nonce===e.nonce&&this.embeds.length===e.embeds.length&&this.attachments.length===e.attachments.length;return s&&t&&(s=this.mentions.everyone===e.mentions.everyone&&this.createdTimestamp===new Date(t.timestamp).getTime()&&this.editedTimestamp===new Date(t.edited_timestamp).getTime()),s}toString(){return this.content}}e.exports=Message},function(e,t,s){const i=s(6),{ClientApplicationAssetTypes:n,Endpoints:r}=s(0),o=s(10),a=s(7);class ClientApplication extends a{constructor(e,t){super(e),this._patch(t)}_patch(e){this.id=e.id,this.name=e.name,this.description=e.description,this.icon=e.icon,this.cover=e.cover_image,this.rpcOrigins=e.rpc_origins,this.redirectURIs=e.redirect_uris,this.botRequireCodeGrant=e.bot_require_code_grant,this.botPublic=e.bot_public,this.rpcApplicationState=e.rpc_application_state,this.bot=e.bot,this.flags=e.flags,this.secret=e.secret,e.owner&&(this.owner=this.client.users.create(e.owner))}get createdTimestamp(){return i.deconstruct(this.id).timestamp}get createdAt(){return new Date(this.createdTimestamp)}iconURL({format:e,size:t}={}){return this.icon?this.client.rest.cdn.AppIcon(this.id,this.icon,{format:e,size:t}):null}coverImage({format:e,size:t}={}){return this.cover?r.CDN(this.client.options.http.cdn).AppIcon(this.id,this.cover,{format:e,size:t}):null}fetchAssets(){return this.client.api.applications(this.id).assets.get().then(e=>e.map(e=>({id:e.id,name:e.name,type:Object.keys(n)[e.type-1]})))}createAsset(e,t,s){return o.resolveBase64(t).then(t=>this.client.api.applications(this.id).assets.post({data:{name:e,data:t,type:n[s.toUpperCase()]}}))}resetSecret(){return this.client.api.oauth2.applications[this.id].reset.post().then(e=>new ClientApplication(this.client,e))}resetToken(){return this.client.api.oauth2.applications[this.id].bot.reset.post().then(e=>new ClientApplication(this.client,Object.assign({},this,{bot:e})))}toString(){return this.name}}e.exports=ClientApplication},function(e,t,s){const i=s(3),n=s(6),r=s(7),{TypeError:o}=s(4);class Emoji extends r{constructor(e,t,s){super(e),this.guild=s,this._patch(t)}_patch(e){this.id=e.id,this.name=e.name,this.requiresColons=e.require_colons,this.managed=e.managed,this._roles=e.roles}get createdTimestamp(){return n.deconstruct(this.id).timestamp}get createdAt(){return new Date(this.createdTimestamp)}get roles(){const e=new i;for(const t of this._roles)this.guild.roles.has(t)&&e.set(t,this.guild.roles.get(t));return e}get url(){return this.client.rest.cdn.Emoji(this.id)}get identifier(){return this.id?`${this.name}:${this.id}`:encodeURIComponent(this.name)}edit(e,t){return this.client.api.guilds(this.guild.id).emojis(this.id).patch({data:{name:e.name,roles:e.roles?e.roles.map(e=>e.id?e.id:e):void 0},reason:t}).then(()=>this)}setName(e,t){return this.edit({name:e},t)}addRestrictedRole(e){return this.addRestrictedRoles([e])}addRestrictedRoles(e){const t=new i(this.roles);for(let s of e instanceof i?e.values():e){if(!(s=this.guild.roles.resolve(s)))return Promise.reject(new o("INVALID_TYPE","roles","Array or Collection of Roles or Snowflakes",!0));t.set(s.id,s)}return this.edit({roles:t})}removeRestrictedRole(e){return this.removeRestrictedRoles([e])}removeRestrictedRoles(e){const t=new i(this.roles);for(let s of e instanceof i?e.values():e){if(!(s=this.guild.roles.resolve(s)))return Promise.reject(new o("INVALID_TYPE","roles","Array or Collection of Roles or Snowflakes",!0));t.has(s.id)&&t.delete(s.id)}return this.edit({roles:t})}toString(){return this.requiresColons?`<:${this.name}:${this.id}>`:this.name}delete(e){return this.client.api.guilds(this.guild.id).emojis(this.id).delete({reason:e}).then(()=>this)}equals(e){return e instanceof Emoji?e.id===this.id&&e.name===this.name&&e.managed===this.managed&&e.requiresColons===this.requiresColons&&e._roles===this._roles:e.id===this.id&&e.name===this.name&&e._roles===this._roles}}e.exports=Emoji},function(e,t){class ReactionEmoji{constructor(e,t,s){this.reaction=e,this.name=t,this.id=s}get identifier(){return this.id?`${this.name}:${this.id}`:encodeURIComponent(this.name)}toString(){return this.id?`<:${this.name}:${this.id}>`:this.name}}e.exports=ReactionEmoji},function(e,t){e.exports={name:"discord.js",version:"12.0.0-dev",description:"A powerful library for interacting with the Discord API",main:"./src/index",types:"./typings/index.d.ts",scripts:{test:"npm run lint && npm run docs:test",docs:"docgen --source src --custom docs/index.yml --output docs/docs.json --jsdoc jsdoc.json","docs:test":"docgen --source src --custom docs/index.yml --jsdoc jsdoc.json",lint:"eslint src *.js","lint:fix":"eslint --fix src",webpack:"parallel-webpack"},repository:{type:"git",url:"git+https://github.com/hydrabolt/discord.js.git"},keywords:["discord","api","bot","client","node","discordapp"],author:"Amish Shah ",license:"Apache-2.0",bugs:{url:"https://github.com/hydrabolt/discord.js/issues"},homepage:"https://github.com/hydrabolt/discord.js#readme",runkitExampleFilename:"./docs/examples/ping.js",dependencies:{long:"^3.0.0","prism-media":"^0.0.1",snekfetch:"^3.0.0",tweetnacl:"^1.0.0",ws:"^3.0.0"},peerDependencies:{bufferutil:"^3.0.0",erlpack:"discordapp/erlpack","node-opus":"^0.2.0",opusscript:"^0.0.3",sodium:"^2.0.0","libsodium-wrappers":"^0.5.0",uws:"^8.14.0"},devDependencies:{"@types/node":"^8.0.0","discord.js-docgen":"hydrabolt/discord.js-docgen",eslint:"^4.0.0","jsdoc-strip-async-await":"^0.1.0","parallel-webpack":"^2.0.0","uglifyjs-webpack-plugin":"^1.0.0-beta.2",webpack:"^3.0.0"},engines:{node:">=8.0.0"},browser:{https:!1,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,s){function i(e){return class DiscordjsError extends e{constructor(e,...t){super(n(e,t)),this[r]=e,Error.captureStackTrace&&Error.captureStackTrace(this,DiscordjsError)}get name(){return`${super.name} [${this[r]}]`}get code(){return this[r]}}}function n(e,t){a.strictEqual(typeof e,"string");const s=o.get(e);a(s,`An invalid error message key was used: ${e}.`);let i=c.format;if("function"==typeof s)i=s;else{if(void 0===t||0===t.length)return s;t.unshift(s)}return String(i(...t))}const r=Symbol("code"),o=new Map,a=s(72),c=s(31);e.exports={register:function(e,t){o.set(e,"function"==typeof t?t:String(t))},Error:i(Error),TypeError:i(TypeError),RangeError:i(RangeError)}},function(e,t,s){const i=s(77),n=s(78),r=s(82),o=s(84),{Error:a}=s(4),{Endpoints:c}=s(0);class RESTManager{constructor(e,t="Bot"){this.client=e,this.handlers={},this.userAgentManager=new i(this),this.rateLimitedEndpoints={},this.globallyRateLimited=!1,this.tokenPrefix=t,this.versioned=!0}get api(){return o(this)}getAuth(){const e=this.client.token||this.client.accessToken,t=!!this.client.application||this.client.user&&this.client.user.bot;if(e&&t)return`${this.tokenPrefix} ${e}`;if(e)return e;throw new a("TOKEN_MISSING")}get cdn(){return c.CDN(this.client.options.http.cdn)}destroy(){for(const e of Object.values(this.handlers))e.destroy&&e.destroy()}push(e,t){return new Promise((s,i)=>{e.push({request:t,resolve:s,reject:i})})}getRequestHandler(){const e=this.client.options.apiRequestMethod;if("function"==typeof e)return e;const t=n[e];if(!t)throw new a("RATELIMIT_INVALID_METHOD");return t}request(e,t,s={}){const i=new r(this,e,t,s);return this.handlers[i.route]||(this.handlers[i.route]=new n.RequestHandler(this,this.getRequestHandler())),this.push(this.handlers[i.route],i)}set endpoint(e){this.client.options.http.api=e}}e.exports=RESTManager},function(e,t){class DiscordAPIError extends Error{constructor(e,t){super();const s=this.constructor.flattenErrors(t.errors||t).join("\n");this.name="DiscordAPIError",this.message=t.message&&s?`${t.message}\n${s}`:t.message||s,this.path=e,this.code=t.code}static flattenErrors(e,t=""){let s=[];for(const[i,n]of Object.entries(e)){if("message"===i)continue;const e=t?isNaN(i)?`${t}.${i}`:`${t}[${i}]`:i;n._errors?s.push(`${e}: ${n._errors.map(e=>e.message).join(" ")}`):n.code||n.message?s.push(`${n.code?`${n.code}: `:""}${n.message}`.trim()):"string"==typeof n?s.push(n):s=s.concat(this.flattenErrors(n,e))}return s}}e.exports=DiscordAPIError},function(e,t,s){const i=s(22),n=s(3),r=s(59),o=s(60),{Events:a}=s(0),c=s(5),l=s(10),h=s(26);class ClientUser extends i{_patch(e){if(super._patch(e),this.verified=e.verified,this.email=e.email,this._typing=new Map,this.friends=new n,this.blocked=new n,this.notes=new n,this.premium="boolean"==typeof e.premium?e.premium:null,this.mfaEnabled="boolean"==typeof e.mfa_enabled?e.mfa_enabled:null,this.mobile="boolean"==typeof e.mobile?e.mobile:null,this.settings=e.user_settings?new r(this,e.user_settings):null,this.guildSettings=new n,e.user_guild_settings)for(const t of e.user_guild_settings)this.guildSettings.set(t.guild_id,new o(this.client,t))}get presence(){return this.client.presences.clientPresence}edit(e,t){return this.bot||("object"!=typeof t?e.password=t:(e.code=t.mfaCode,e.password=t.password)),this.client.api.users("@me").patch({data:e}).then(e=>(this.client.token=e.token,this.client.actions.UserUpdate.handle(e).updated))}setUsername(e,t){return this.edit({username:e},t)}setEmail(e,t){return this.edit({email:e},t)}setPassword(e,t){return this.edit({new_password:e},{password:t.oldPassword,mfaCode:t.mfaCode})}async setAvatar(e){return this.edit({avatar:await l.resolveImage(e,this.client.browser)})}setPresence(e){return this.client.presences.setClientPresence(e)}setStatus(e){return this.setPresence({status:e})}setActivity(e,{url:t,type:s}={}){return e?this.setPresence({activity:{name:e,type:s,url:t}}):this.setPresence({activity:null})}setAFK(e){return this.setPresence({afk:e})}fetchMentions(e={}){return e.guild instanceof h&&(e.guild=e.guild.id),c.mergeDefault({limit:25,roles:!0,everyone:!0,guild:null},e),this.client.api.users("@me").mentions.get({query:e}).then(e=>e.map(e=>this.client.channels.get(e.channel_id).messages.create(e,!1)))}createGuild(e,{region:t,icon:s=null}={}){return!s||"string"==typeof s&&s.startsWith("data:")?new Promise((i,n)=>this.client.api.guilds.post({data:{name:e,region:t,icon:s}}).then(e=>{if(this.client.guilds.has(e.id))return i(this.client.guilds.get(e.id));const t=n=>{n.id===e.id&&(this.client.removeListener(a.GUILD_CREATE,t),this.client.clearTimeout(s),i(n))};this.client.on(a.GUILD_CREATE,t);const s=this.client.setTimeout(()=>{this.client.removeListener(a.GUILD_CREATE,t),i(this.client.guilds.create(e))},1e4)},n)):l.resolveImage(s,this.client.browser).then(s=>this.createGuild(e,{region:t,icon:s||null}))}createGroupDM(e){const t=this.bot?{access_tokens:e.map(e=>e.accessToken),nicks:e.reduce((e,t)=>(t.nick&&(e[t.user?t.user.id:t.id]=t.nick),e),{})}:{recipients:e.map(e=>this.client.users.resolveID(e.user||e.id))};return this.client.api.users("@me").channels.post({data:t}).then(e=>this.client.channels.create(e))}}e.exports=ClientUser},function(e,t,s){const i=s(34),{Events:n}=s(0);class MessageCollector extends i{constructor(e,t,s={}){super(e.client,t,s),this.channel=e,this.received=0;const i=(e=>{for(const t of e.values())this.handleDispose(t)}).bind(this);this.client.on(n.MESSAGE_CREATE,this.handleCollect),this.client.on(n.MESSAGE_DELETE,this.handleDispose),this.client.on(n.MESSAGE_BULK_DELETE,i),this.once("end",()=>{this.client.removeListener(n.MESSAGE_CREATE,this.handleCollect),this.client.removeListener(n.MESSAGE_DELETE,this.handleDispose),this.client.removeListener(n.MESSAGE_BULK_DELETE,i)})}collect(e){return e.channel.id!==this.channel.id?null:(this.received++,{key:e.id,value:e})}dispose(e){return e.channel.id===this.channel.id?e.id:null}endReason(){return this.options.max&&this.collected.size>=this.options.max?"limit":this.options.maxProcessed&&this.received===this.options.maxProcessed?"processedLimit":null}}e.exports=MessageCollector},function(e,t,s){e.exports={search:s(92),sendMessage:s(98)}},function(e,t,s){const i=s(11),n=s(19),r=s(23);class DMChannel extends i{constructor(e,t){super(e,t),this.messages=new r(this),this._typing=new Map}_patch(e){super._patch(e),this.recipient=this.client.users.create(e.recipients[0]),this.lastMessageID=e.last_message_id}toString(){return this.recipient.toString()}send(){}search(){}startTyping(){}stopTyping(){}get typing(){}get typingCount(){}createMessageCollector(){}awaitMessages(){}acknowledge(){}_cacheMessage(){}}n.applyToClass(DMChannel,!0,["bulkDelete"]),e.exports=DMChannel},function(e,t,s){const i=s(3),n=s(12);class MessageMentions{constructor(e,t,s,n){if(this.everyone=Boolean(n),t)if(t instanceof i)this.users=new i(t);else{this.users=new i;for(const s of t){let t=e.client.users.create(s);this.users.set(t.id,t)}}else this.users=new i;if(s)if(s instanceof i)this.roles=new i(s);else{this.roles=new i;for(const t of s){const s=e.channel.guild.roles.get(t);s&&this.roles.set(s.id,s)}}else this.roles=new i;this._content=e.content,this._client=e.client,this._guild=e.channel.guild,this._members=null,this._channels=null}get members(){return this._members?this._members:this._guild?(this._members=new i,this.users.forEach(e=>{const t=this._guild.member(e);t&&this._members.set(t.user.id,t)}),this._members):null}get channels(){if(this._channels)return this._channels;this._channels=new i;let e;for(;null!==(e=this.constructor.CHANNELS_PATTERN.exec(this._content));){const t=this._client.channels.get(e[1]);t&&this._channels.set(t.id,t)}return this._channels}has(e,t=!0){if(t&&this.everyone)return!0;if(t&&e instanceof n)for(const t of this.roles.values())if(e.roles.has(t.id))return!0;const s=e.id||e;return this.users.has(s)||this.channels.has(s)||this.roles.has(s)}}MessageMentions.EVERYONE_PATTERN=/@(everyone|here)/g,MessageMentions.USERS_PATTERN=/<@!?(1|\d{17,19})>/g,MessageMentions.ROLES_PATTERN=/<@&(\d{17,19})>/g,MessageMentions.CHANNELS_PATTERN=/<#(\d{17,19})>/g,e.exports=MessageMentions},function(e,t,s){const i=s(34),n=s(3),{Events:r}=s(0);class ReactionCollector extends i{constructor(e,t,s={}){super(e.client,t,s),this.message=e,this.users=new n,this.total=0,this.empty=this.empty.bind(this),this.client.on(r.MESSAGE_REACTION_ADD,this.handleCollect),this.client.on(r.MESSAGE_REACTION_REMOVE,this.handleDispose),this.client.on(r.MESSAGE_REACTION_REMOVE_ALL,this.empty),this.once("end",()=>{this.client.removeListener(r.MESSAGE_REACTION_ADD,this.handleCollect),this.client.removeListener(r.MESSAGE_REACTION_REMOVE,this.handleDispose),this.client.removeListener(r.MESSAGE_REACTION_REMOVE_ALL,this.empty)}),this.on("collect",(e,t,s)=>{this.total++,this.users.set(s.id,s)}),this.on("dispose",(e,t,s)=>{this.total--,this.collected.some(e=>e.users.has(s.id))||this.users.delete(s.id)})}collect(e){return e.message.id!==this.message.id?null:{key:ReactionCollector.key(e),value:e}}dispose(e){return e.message.id!==this.message.id||e.count?null:ReactionCollector.key(e)}empty(){this.total=0,this.collected.clear(),this.users.clear(),this.checkEnd()}endReason(){return this.options.max&&this.total>=this.options.max?"limit":this.options.maxEmojis&&this.collected.size>=this.options.maxEmojis?"emojiLimit":this.options.maxUsers&&this.users.size>=this.options.maxUsers?"userLimit":null}static key(e){return e.emoji.id||e.emoji.name}}e.exports=ReactionCollector},function(e,t){},function(e,t,s){const i=s(3),n=s(37),r=s(38),{Error:o}=s(4);class MessageReaction{constructor(e,t,s){this.message=s,this.me=t.me,this.count=t.count||0,this.users=new i,this._emoji=new r(this,t.emoji.name,t.emoji.id)}get emoji(){if(this._emoji instanceof n)return this._emoji;if(this._emoji.id){const e=this.message.client.emojis;if(e.has(this._emoji.id)){const t=e.get(this._emoji.id);return this._emoji=t,t}}return this._emoji}remove(e=this.message.client.user){const t=this.message.client.users.resolveID(e);return t?this.message.client.api.channels[this.message.channel.id].messages[this.message.id].reactions[this.emoji.identifier][t===this.message.client.user.id?"@me":t].delete().then(()=>this.message.client.actions.MessageReactionRemove.handle({user_id:t,message_id:this.message.id,emoji:this.emoji,channel_id:this.message.channel.id}).reaction):Promise.reject(new o("REACTION_RESOLVE_USER"))}async fetchUsers({limit:e=100,after:t}={}){const s=this.message,i=await s.client.api.channels[s.channel.id].messages[s.id].reactions[this.emoji.identifier].get({query:{limit:e,after:t}});for(const e of i){const t=s.client.users.create(e);this.users.set(t.id,t)}return this.count=this.users.size,this.users}_add(e){this.users.has(e.id)||(this.users.set(e.id,e),this.count++),this.me||(this.me=e.id===this.message.client.user.id)}_remove(e){this.users.has(e.id)&&(this.users.delete(e.id),this.count--,e.id===this.message.client.user.id&&(this.me=!1),this.count<=0&&this.message.reactions.remove(this.emoji.id||this.emoji.name))}}e.exports=MessageReaction},function(e,t,s){const i=s(11),n=s(19),r=s(3),o=s(10),a=s(23);class GroupDMChannel extends i{constructor(e,t){super(e,t),this.messages=new a(this),this._typing=new Map}_patch(e){if(super._patch(e),this.name=e.name,this.icon=e.icon,this.ownerID=e.owner_id,this.managed=e.managed,this.applicationID=e.application_id,e.nicks&&(this.nicks=new r(e.nicks.map(e=>[e.id,e.nick]))),this.recipients||(this.recipients=new r),e.recipients)for(const t of e.recipients){const e=this.client.users.create(t);this.recipients.set(e.id,e)}this.lastMessageID=e.last_message_id}get owner(){return this.client.users.get(this.ownerID)}iconURL({format:e,size:t}={}){return this.icon?this.client.rest.cdn.GDMIcon(this.id,this.icon,e,t):null}equals(e){const t=e&&this.id===e.id&&this.name===e.name&&this.icon===e.icon&&this.ownerID===e.ownerID;return t?this.recipients.equals(e.recipients):t}edit(e,t){return this.client.api.channels[this.id].patch({data:{icon:e.icon,name:null===e.name?null:e.name||this.name},reason:t}).then(()=>this)}async setIcon(e){return this.edit({icon:await o.resolveImage(e,this.client.browser)})}setName(e){return this.edit({name:e})}addUser({user:e,accessToken:t,nick:s}){const i=this.client.users.resolveID(e),n=this.client.user.bot?{nick:s,access_token:t}:{recipient:i};return this.client.api.channels[this.id].recipients[i].put({data:n}).then(()=>this)}removeUser(e){const t=this.client.users.resolveID(e);return this.client.api.channels[this.id].recipients[t].delete().then(()=>this)}toString(){return this.name}send(){}search(){}startTyping(){}stopTyping(){}get typing(){}get typingCount(){}createMessageCollector(){}awaitMessages(){}acknowledge(){}_cacheMessage(){}}n.applyToClass(GroupDMChannel,!0,["bulkDelete"]),e.exports=GroupDMChannel},function(e,t,s){const i=s(15),n=s(16),r=s(19),o=s(3),a=s(10),c=s(23);class TextChannel extends i{constructor(e,t){super(e,t),this.messages=new c(this),this._typing=new Map}_patch(e){if(super._patch(e),this.topic=e.topic,this.nsfw=Boolean(e.nsfw),this.lastMessageID=e.last_message_id,e.messages)for(const t of e.messages)this.messages.create(t)}fetchWebhooks(){return this.client.api.channels[this.id].webhooks.get().then(e=>{const t=new o;for(const s of e)t.set(s.id,new n(this.client,s));return t})}async createWebhook(e,{avatar:t,reason:s}={}){return"string"!=typeof t||t.startsWith("data:")||(t=await a.resolveImage(t,this.client.browser)),this.client.api.channels[this.id].webhooks.post({data:{name:e,avatar:t},reason:s}).then(e=>new n(this.client,e))}send(){}search(){}startTyping(){}stopTyping(){}get typing(){}get typingCount(){}createMessageCollector(){}awaitMessages(){}bulkDelete(){}acknowledge(){}_cacheMessage(){}}r.applyToClass(TextChannel,!0),e.exports=TextChannel},function(e,t,s){const i=s(9);class PermissionOverwrites{constructor(e,t){Object.defineProperty(this,"channel",{value:e}),t&&this._patch(t)}_patch(e){this.id=e.id,this.type=e.type,this.denied=new i(e.deny).freeze(),this.allowed=new i(e.allow).freeze()}delete(e){return this.channel.client.api.channels[this.channel.id].permissions[this.id].delete({reason:e}).then(()=>this)}}e.exports=PermissionOverwrites},function(e,t,s){const i=s(15),n=s(3),{Error:r}=s(4);class VoiceChannel extends i{constructor(e,t){super(e,t),Object.defineProperty(this,"members",{value:new n})}_patch(e){super._patch(e),this.bitrate=.001*e.bitrate,this.userLimit=e.user_limit}get connection(){const e=this.guild.voiceConnection;return e&&e.channel.id===this.id?e:null}get full(){return this.userLimit>0&&this.members.size>=this.userLimit}get joinable(){return!this.client.browser&&(!!this.permissionsFor(this.client.user).has("CONNECT")&&!(this.full&&!this.permissionsFor(this.client.user).has("MOVE_MEMBERS")))}get speakable(){return this.permissionsFor(this.client.user).has("SPEAK")}setBitrate(e,t){return e*=1e3,this.edit({bitrate:e},t)}setUserLimit(e,t){return this.edit({userLimit:e},t)}join(){return this.client.browser?Promise.reject(new r("VOICE_NO_BROWSER")):this.client.voice.joinChannel(this)}leave(){if(this.client.browser)return;const e=this.client.voice.connections.get(this.guild.id);e&&e.channel.id===this.id&&e.disconnect()}}e.exports=VoiceChannel},function(e,t,s){const i=s(3),n=s(6),r=s(16),o={ALL:"ALL",GUILD:"GUILD",CHANNEL:"CHANNEL",USER:"USER",ROLE:"ROLE",INVITE:"INVITE",WEBHOOK:"WEBHOOK",EMOJI:"EMOJI",MESSAGE:"MESSAGE",UNKNOWN:"UNKNOWN"},a={ALL:null,GUILD_UPDATE:1,CHANNEL_CREATE:10,CHANNEL_UPDATE:11,CHANNEL_DELETE:12,CHANNEL_OVERWRITE_CREATE:13,CHANNEL_OVERWRITE_UPDATE:14,CHANNEL_OVERWRITE_DELETE:15,MEMBER_KICK:20,MEMBER_PRUNE:21,MEMBER_BAN_ADD:22,MEMBER_BAN_REMOVE:23,MEMBER_UPDATE:24,MEMBER_ROLE_UPDATE:25,ROLE_CREATE:30,ROLE_UPDATE:31,ROLE_DELETE:32,INVITE_CREATE:40,INVITE_UPDATE:41,INVITE_DELETE:42,WEBHOOK_CREATE:50,WEBHOOK_UPDATE:51,WEBHOOK_DELETE:52,EMOJI_CREATE:60,EMOJI_UPDATE:61,EMOJI_DELETE:62,MESSAGE_DELETE:72};class GuildAuditLogs{constructor(e,t){if(t.users)for(const s of t.users)e.client.users.create(s);if(this.webhooks=new i,t.webhooks)for(const s of t.webhooks)this.webhooks.set(s.id,new r(e.client,s));this.entries=new i;for(const s of t.audit_log_entries){const t=new GuildAuditLogsEntry(e,s);this.entries.set(t.id,t)}}static build(...e){const t=new GuildAuditLogs(...e);return Promise.all(t.entries.map(e=>e.target)).then(()=>t)}static targetType(e){return e<10?o.GUILD:e<20?o.CHANNEL:e<30?o.USER:e<40?o.ROLE:e<50?o.INVITE:e<60?o.WEBHOOK:e<70?o.EMOJI:e<80?o.MESSAGE:o.UNKNOWN}static actionType(e){return[a.CHANNEL_CREATE,a.CHANNEL_OVERWRITE_CREATE,a.MEMBER_BAN_REMOVE,a.ROLE_CREATE,a.INVITE_CREATE,a.WEBHOOK_CREATE,a.EMOJI_CREATE].includes(e)?"CREATE":[a.CHANNEL_DELETE,a.CHANNEL_OVERWRITE_DELETE,a.MEMBER_KICK,a.MEMBER_PRUNE,a.MEMBER_BAN_ADD,a.ROLE_DELETE,a.INVITE_DELETE,a.WEBHOOK_DELETE,a.EMOJI_DELETE,a.MESSAGE_DELETE].includes(e)?"DELETE":[a.GUILD_UPDATE,a.CHANNEL_UPDATE,a.CHANNEL_OVERWRITE_UPDATE,a.MEMBER_UPDATE,a.MEMBER_ROLE_UPDATE,a.ROLE_UPDATE,a.INVITE_UPDATE,a.WEBHOOK_UPDATE,a.EMOJI_UPDATE].includes(e)?"UPDATE":"ALL"}}class GuildAuditLogsEntry{constructor(e,t){const s=GuildAuditLogs.targetType(t.action_type);if(this.targetType=s,this.actionType=GuildAuditLogs.actionType(t.action_type),this.action=Object.keys(a).find(e=>a[e]===t.action_type),this.reason=t.reason||null,this.executor=e.client.users.get(t.user_id),this.changes=t.changes?t.changes.map(e=>({key:e.key,old:e.old_value,new:e.new_value})):null,this.id=t.id,this.extra=null,t.options)if(t.action_type===a.MEMBER_PRUNE)this.extra={removed:t.options.members_removed,days:t.options.delete_member_days};else if(t.action_type===a.MESSAGE_DELETE)this.extra={count:t.options.count,channel:e.channels.get(t.options.channel_id)};else switch(t.options.type){case"member":this.extra=e.members.get(t.options.id),this.extra||(this.extra={id:t.options.id});break;case"role":this.extra=e.roles.get(t.options.id),this.extra||(this.extra={id:t.options.id,name:t.options.role_name})}if(s===o.UNKNOWN)this.target=this.changes.reduce((e,t)=>(e[t.key]=t.new||t.old,e),{}),this.target.id=t.target_id;else if([o.USER,o.GUILD].includes(s))this.target=e.client[`${s.toLowerCase()}s`].get(t.target_id);else if(s===o.WEBHOOK)this.target=this.webhooks.get(t.target_id);else if(s===o.INVITE)if(e.me.permissions.has("MANAGE_GUILD")){const t=this.changes.find(e=>"code"===e.key);this.target=e.fetchInvites().then(e=>(this.target=e.find(e=>e.code===(t.new||t.old)),this.target))}else this.target=this.changes.reduce((e,t)=>(e[t.key]=t.new||t.old,e),{});else s===o.MESSAGE?this.target=e.client.users.get(t.target_id):this.target=e[`${s.toLowerCase()}s`].get(t.target_id)}get createdTimestamp(){return n.deconstruct(this.id).timestamp}get createdAt(){return new Date(this.createdTimestamp)}}GuildAuditLogs.Actions=a,GuildAuditLogs.Targets=o,GuildAuditLogs.Entry=GuildAuditLogsEntry,e.exports=GuildAuditLogs},function(e,t){class VoiceRegion{constructor(e){this.id=e.id,this.name=e.name,this.vip=e.vip,this.deprecated=e.deprecated,this.optimal=e.optimal,this.custom=e.custom,this.sampleHostname=e.sample_hostname}}e.exports=VoiceRegion},function(e,t,s){const i=s(8),n=s(37),r=s(38);class EmojiStore extends i{constructor(e,t){super(e.client,t,n),this.guild=e}create(e,t){return super.create(e,t,{extras:[this.guild]})}resolve(e){return e instanceof r?super.resolve(e.id):super.resolve(e)}resolveID(e){return e instanceof r?e.id:super.resolveID(e)}resolveIdentifier(e){const t=this.resolve(e);return t?t.identifier:"string"==typeof e?e.includes("%")?e:encodeURIComponent(e):null}}e.exports=EmojiStore},function(e,t,s){const i=s(8),{Presence:n}=s(13);class PresenceStore extends i{constructor(e,t){super(e,t,n)}create(e,t){const s=this.get(e.user.id);return s?s.patch(e):super.create(e,t,{id:e.user.id})}resolve(e){const t=super.resolve(e);if(t)return t;const s=this.client.users.resolveID(e);return super.resolve(s)||null}resolveID(e){const t=super.resolveID(e);if(t)return t;const s=this.client.users.resolveID(e);return this.has(s)?s:null}}e.exports=PresenceStore},function(e,t,s){const{UserSettingsMap:i}=s(0),n=s(5),{Error:r}=s(4);class ClientUserSettings{constructor(e,t){this.user=e,this.patch(t)}patch(e){for(const[t,s]of Object.entries(i))e.hasOwnProperty(t)&&("function"==typeof s?this[s.name]=s(e[t]):this[s]=e[t])}update(e,t){return this.user.client.api.users["@me"].settings.patch({data:{[e]:t}})}setGuildPosition(e,t,s){const i=Object.assign([],this.guildPositions);return n.moveElementInArray(i,e.id,t,s),this.update("guild_positions",i).then(()=>e)}addRestrictedGuild(e){const t=Object.assign([],this.restrictedGuilds);return t.includes(e.id)?Promise.reject(new r("GUILD_RESTRICTED",!0)):(t.push(e.id),this.update("restricted_guilds",t).then(()=>e))}removeRestrictedGuild(e){const t=Object.assign([],this.restrictedGuilds),s=t.indexOf(e.id);return s<0?Promise.reject(new r("GUILD_RESTRICTED")):(t.splice(s,1),this.update("restricted_guilds",t).then(()=>e))}}e.exports=ClientUserSettings},function(e,t,s){const{UserGuildSettingsMap:i}=s(0),n=s(3),r=s(101);class ClientUserGuildSettings{constructor(e,t){Object.defineProperty(this,"client",{value:e}),this.guildID=t.guild_id,this.channelOverrides=new n,this.patch(t)}patch(e){for(const[t,s]of Object.entries(i))if(e.hasOwnProperty(t))if("channel_overrides"===t)for(const s of e[t]){const e=this.channelOverrides.get(s.channel_id);e?e.patch(s):this.channelOverrides.set(s.channel_id,new r(s))}else"function"==typeof s?this[s.name]=s(e[t]):this[s]=e[t]}update(e,t){return this.client.api.users("@me").guilds(this.guildID).settings.patch({data:{[e]:t}})}}e.exports=ClientUserGuildSettings},function(e,t,s){(function(e){const i="undefined"!=typeof window,n=s(49),r=s(30);if(i)t.WebSocket=window.WebSocket;else try{t.WebSocket=s(138)}catch(e){t.WebSocket=s(139)}try{var o=s(140);o.pack||(o=null)}catch(e){}t.encoding=o?"etf":"json",t.pack=o?o.pack:JSON.stringify,t.unpack=(t=>(Array.isArray(t)&&(t=e.concat(t)),t instanceof ArrayBuffer&&(t=e.from(new Uint8Array(t))),o&&"string"!=typeof t?o.unpack(t):(t instanceof e&&(t=n.inflateSync(t).toString()),JSON.parse(t)))),t.create=((e,s={},...n)=>{s.encoding=t.encoding;const o=new t.WebSocket(`${e}?${r.stringify(s)}`,...n);return i&&(o.binaryType="arraybuffer"),o});for(const e of["CONNECTING","OPEN","CLOSING","CLOSED"])t[e]=t.WebSocket[e]}).call(t,s(17).Buffer)},function(e,t,s){const i=s(5);e.exports={BaseClient:s(32),Client:s(85),Shard:s(176),ShardClientUtil:s(177),ShardingManager:s(178),WebhookClient:s(179),Collection:s(3),Constants:s(0),DataResolver:s(10),DiscordAPIError:s(42),EvaluatedPermissions:s(9),Permissions:s(9),Snowflake:s(6),SnowflakeUtil:s(6),Util:i,util:i,version:s(39).version,escapeMarkdown:i.escapeMarkdown,fetchRecommendedShards:i.fetchRecommendedShards,splitMessage:i.splitMessage,Activity:s(13).Activity,Channel:s(11),ClientUser:s(43),ClientUserSettings:s(59),Collector:s(34),DMChannel:s(46),Emoji:s(37),GroupDMChannel:s(51),Guild:s(26),GuildAuditLogs:s(55),GuildChannel:s(15),GuildMember:s(12),Invite:s(25),Message:s(35),MessageAttachment:s(20),MessageCollector:s(44),MessageEmbed:s(14),MessageMentions:s(47),MessageReaction:s(50),ClientApplication:s(36),PermissionOverwrites:s(53),Presence:s(13).Presence,ReactionEmoji:s(38),ReactionCollector:s(48),Role:s(24),TextChannel:s(52),User:s(22),VoiceChannel:s(54),Webhook:s(16),WebSocket:s(61)}},function(e,t,s){"use strict";function i(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 n(e){return o[e>>18&63]+o[e>>12&63]+o[e>>6&63]+o[63&e]}function r(e,t,s){for(var i,r=[],o=t;o0?l-4:l;var h=0;for(t=0;t>16&255,o[h++]=n>>8&255,o[h++]=255&n;return 2===r?(n=a[e.charCodeAt(t)]<<2|a[e.charCodeAt(t+1)]>>4,o[h++]=255&n):1===r&&(n=a[e.charCodeAt(t)]<<10|a[e.charCodeAt(t+1)]<<4|a[e.charCodeAt(t+2)]>>2,o[h++]=n>>8&255,o[h++]=255&n),o},t.fromByteArray=function(e){for(var t,s=e.length,i=s%3,n="",a=[],c=0,l=s-i;cl?l:c+16383));return 1===i?(t=e[s-1],n+=o[t>>2],n+=o[t<<4&63],n+="=="):2===i&&(t=(e[s-2]<<8)+e[s-1],n+=o[t>>10],n+=o[t>>4&63],n+=o[t<<2&63],n+="="),a.push(n),a.join("")};for(var o=[],a=[],c="undefined"!=typeof Uint8Array?Uint8Array:Array,l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",h=0,u=l.length;h>1,h=-7,u=s?n-1:0,d=s?-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+=i;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,i),r-=l}return(p?-1:1)*o*Math.pow(2,r-i)},t.write=function(e,t,s,i,n,r){var o,a,c,l=8*r-n-1,h=(1<>1,d=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,p=i?0:r-1,f=i?1:-1,g=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,n),o+=u):(a=t*Math.pow(2,u-1)*Math.pow(2,n),o=0));n>=8;e[s+p]=255&a,p+=f,a/=256,n-=8);for(o=o<0;e[s+p]=255&o,p+=f,o/=256,l-=8);e[s+p-f]|=128*g}},function(e,t){var s={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==s.call(e)}},function(e,t,s){const i="undefined"!=typeof window,n=s(30),r=s(69),o=s(i?70:71);class Snekfetch extends(o.extension||Object){constructor(e,t,s={headers:null,data:null,query:null,version:1}){super(),this.options=s,this.request=o.buildRequest.call(this,e,t,s),s.query&&this.query(s.query),s.data&&this.send(s.data)}query(e,t){if(this.response)throw new Error("Cannot modify query after being sent!");if(this.request.query||(this.request.query=i?new URLSearchParams:{}),null!==e&&"object"==typeof e)for(const[t,s]of Object.entries(e))this.query(t,s);else i?this.request.query.set(e,t):this.request.query[e]=t;return 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,s){if(this.response)throw new Error("Cannot modify data after being sent!");const i=this._getFormData();return this.set("Content-Type",`multipart/form-data; boundary=${i.boundary}`),i.append(e,t,s),this.data=i,this}send(e){if(this.response)throw new Error("Cannot modify data after being sent!");if(o.shouldSendRaw(e))this.data=e;else if(null!==e&&"object"==typeof e){const t=this._getRequestHeader("content-type");let s;t?t.includes("json")?s=JSON.stringify:t.includes("urlencoded")&&(s=n.stringify):(this.set("Content-Type","application/json"),s=JSON.stringify),this.data=s(e)}else this.data=e;return this}then(e,t){o.finalizeRequest.call(this,{data:this.data?this.data.end?this.data.end():this.data:null}).then(({response:e,raw:t,redirect:s,headers:i})=>{if(s){let t=this.request.method;[301,302].includes(e.statusCode)?("HEAD"!==t&&(t="GET"),this.data=null):303===e.statusCode&&(t="GET");const i={};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}return new Snekfetch(t,s,{data:this.data,headers:i,agent:this.options._req.agent})}const r=e.statusCode||e.status,a={request:this.request,get body(){delete a.body;const e=this.headers["content-type"];if(e&&e.includes("application/json"))try{a.body=JSON.parse(a.text)}catch(e){a.body=a.text}else e&&e.includes("application/x-www-form-urlencoded")?a.body=n.parse(a.text):a.body=t;return a.body},text:t.toString(),ok:r>=200&&r<400,headers:i||e.headers,status:r,statusText:e.statusText||o.STATUS_CODES[e.statusCode]};if(a.ok)return a;{const e=new Error(`${a.status} ${a.statusText}`.trim());return Object.assign(e,a),Promise.reject(e)}}).then(e,t)}catch(e){return this.then(null,e)}end(e){return this.then(t=>e?e(null,t):t,t=>e?e(t,t.status?t:null):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!1!==this.options.followRedirects&&[301,302,303,307,308].includes(e.statusCode)}_getFormData(){return this._formData||(this._formData=new o.FormData),this._formData}_addFinalHeaders(){this.request&&(this._getRequestHeader("user-agent")||this.set("User-Agent",`snekfetch/${Snekfetch.version} (${r.repository.url.replace(/\.?git/,"")})`),"HEAD"!==this.request.method&&this.set("Accept-Encoding","gzip, deflate"),this.data&&this.data.end&&this.set("Content-Length",this.data.length))}get response(){return this.request?this.request.res||this.request._response||null:null}_getRequestHeader(e){try{return this.request.getHeader(e)}catch(e){return null}}}Snekfetch.version=r.version,Snekfetch.METHODS=o.METHODS.concat("BREW");for(const e of Snekfetch.METHODS)Snekfetch["M-SEARCH"===e?"msearch":e.toLowerCase()]=((t,s)=>new Snekfetch(e,t,s));e.exports=Snekfetch},function(e,t,s){"use strict";function i(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.exports=function(e,t,s,r){t=t||"&",s=s||"=";var o={};if("string"!=typeof e||0===e.length)return o;var a=/\+/g;e=e.split(t);var c=1e3;r&&"number"==typeof r.maxKeys&&(c=r.maxKeys);var l=e.length;c>0&&l>c&&(l=c);for(var h=0;h=0?(u=g.substr(0,m),d=g.substr(m+1)):(u=g,d=""),p=decodeURIComponent(u),f=decodeURIComponent(d),i(o,p)?n(o[p])?o[p].push(f):o[p]=[o[p],f]:o[p]=f}return o};var n=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},function(e,t,s){"use strict";function i(e,t){if(e.map)return e.map(t);for(var s=[],i=0;ie.text().then(t=>{const s={};for(const[t,i]of e.headers)s[t.toLowerCase()]=i;return{response:e,raw:t,headers:s}}))},shouldSendRaw:function(){return!1},METHODS:["GET","POST","PUT","DELETE","OPTIONS","HEAD"],STATUS_CODES:{},FormData:window.FormData}},function(e,t){},function(e,t,s){"use strict";(function(t){function i(e,t){if(e===t)return 0;for(var s=e.length,i=t.length,n=0,r=Math.min(s,i);n=0;a--)if(c[a]!==l[a])return!1;for(a=c.length-1;a>=0;a--)if(o=c[a],!p(e[o],t[o],s,i))return!1;return!0}function m(e,t,s){p(e,t,!0)&&u(e,t,s,"notDeepStrictEqual",m)}function E(e,t){if(!e||!t)return!1;if("[object RegExp]"==Object.prototype.toString.call(t))return t.test(e);try{if(e instanceof t)return!0}catch(e){}return!Error.isPrototypeOf(t)&&!0===t.call({},e)}function _(e){var t;try{e()}catch(e){t=e}return t}function y(e,t,s,i){var n;if("function"!=typeof t)throw new TypeError('"block" argument must be a function');"string"==typeof s&&(i=s,s=null),n=_(t),i=(s&&s.name?" ("+s.name+").":".")+(i?" "+i:"."),e&&!n&&u(n,s,"Missing expected exception"+i);var r="string"==typeof i,o=!e&&v.isError(n),a=!e&&n&&!s;if((o&&r&&E(n,s)||a)&&u(n,s,"Got unwanted exception"+i),e&&n&&s&&!E(n,s)||!e&&n)throw n}var v=s(31),A=Object.prototype.hasOwnProperty,b=Array.prototype.slice,w="foo"===function(){}.name,T=e.exports=d,I=/\s*function\s+([^\(\s]*)\s*/;T.AssertionError=function(e){this.name="AssertionError",this.actual=e.actual,this.expected=e.expected,this.operator=e.operator,e.message?(this.message=e.message,this.generatedMessage=!1):(this.message=h(this),this.generatedMessage=!0);var t=e.stackStartFunction||u;if(Error.captureStackTrace)Error.captureStackTrace(this,t);else{var s=new Error;if(s.stack){var i=s.stack,n=a(t),r=i.indexOf("\n"+n);if(r>=0){var o=i.indexOf("\n",r+1);i=i.substring(o+1)}this.stack=i}}},v.inherits(T.AssertionError,Error),T.fail=u,T.ok=d,T.equal=function(e,t,s){e!=t&&u(e,t,s,"==",T.equal)},T.notEqual=function(e,t,s){e==t&&u(e,t,s,"!=",T.notEqual)},T.deepEqual=function(e,t,s){p(e,t,!1)||u(e,t,s,"deepEqual",T.deepEqual)},T.deepStrictEqual=function(e,t,s){p(e,t,!0)||u(e,t,s,"deepStrictEqual",T.deepStrictEqual)},T.notDeepEqual=function(e,t,s){p(e,t,!1)&&u(e,t,s,"notDeepEqual",T.notDeepEqual)},T.notDeepStrictEqual=m,T.strictEqual=function(e,t,s){e!==t&&u(e,t,s,"===",T.strictEqual)},T.notStrictEqual=function(e,t,s){e===t&&u(e,t,s,"!==",T.notStrictEqual)},T.throws=function(e,t,s){y(!0,e,t,s)},T.doesNotThrow=function(e,t,s){y(!1,e,t,s)},T.ifError=function(e){if(e)throw e};var S=Object.keys||function(e){var t=[];for(var s in e)A.call(e,s)&&t.push(s);return t}}).call(t,s(27))},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 s=function(){};s.prototype=t.prototype,e.prototype=new s,e.prototype.constructor=e}},function(e,t,s){const{register:i}=s(40),n={CLIENT_INVALID_OPTION:(e,t)=>`The ${e} option must be ${t}`,TOKEN_INVALID:"An invalid token was provided.",TOKEN_MISSING:"Request to use token, but token was unavailable to the client.",FEATURE_USER_ONLY:"Only user accounts are able to make use of this feature.",WS_CONNECTION_TIMEOUT:"The connection to the gateway timed out.",WS_CONNECTION_EXISTS:"There is already an existing WebSocket connection.",WS_NOT_OPEN:(e="data")=>`Websocket not open to send ${e}`,PERMISSION_INVALID:"Invalid permission string or number.",RATELIMIT_INVALID_METHOD:"Unknown rate limiting method.",SHARDING_INVALID:"Invalid shard settings were provided.",SHARDING_REQUIRED:"This session would have handled too many guilds - Sharding is required.",SHARDING_CHILD_CONNECTION:"Failed to send message to shard's process.",SHARDING_PARENT_CONNECTION:"Failed to send message to master process.",SHARDING_NO_SHARDS:"No shards have been spawned",SHARDING_IN_PROCESS:"Shards are still being spawned",SHARDING_ALREADY_SPAWNED:e=>`Already spawned ${e} shards`,COLOR_RANGE:"Color must be within the range 0 - 16777215 (0xFFFFFF).",COLOR_CONVERT:"Unable to convert color to a number.",EMBED_FIELD_COUNT:"MessageEmbeds may not exceed 25 fields.",EMBED_FIELD_NAME:"MessageEmbed field names may not exceed 256 characters or be empty.",EMBED_FIELD_VALUE:"MessageEmbed field values may not exceed 1024 characters or be empty.",EMBED_DESCRIPTION:"MessageEmbed descriptions may not exceed 2048 characters.",EMBED_FOOTER_TEXT:"MessageEmbed footer text may not exceed 2048 characters.",EMBED_TITLE:"MessageEmbed titles may not exceed 256 characters.",FILE_NOT_FOUND:e=>`File could not be found: ${e}`,USER_NO_DMCHANNEL:"No DM Channel exists!",VOICE_INVALID_HEARTBEAT:"Tried to set voice heartbeat but no valid interval was specified.",VOICE_USER_MISSING:"Couldn't resolve the user to create stream.",VOICE_STREAM_EXISTS:"There is already an existing stream for that user.",VOICE_JOIN_CHANNEL:(e=!1)=>`You do not have permission to join this voice channel${e?"; it is full.":"."}`,VOICE_CONNECTION_TIMEOUT:"Connection not established within 15 seconds.",VOICE_TOKEN_ABSENT:"Token not provided from voice server packet.",VOICE_SESSION_ABSENT:"Session ID not supplied.",VOICE_INVALID_ENDPOINT:"Invalid endpoint received.",VOICE_NO_BROWSER:"Voice connections are not available in browsers.",VOICE_CONNECTION_ATTEMPTS_EXCEEDED:e=>`Too many connection attempts (${e}).`,VOICE_JOIN_SOCKET_CLOSED:"Tried to send join packet, but the WebSocket is not open.",OPUS_ENGINE_MISSING:"Couldn't find an Opus engine.",UDP_SEND_FAIL:"Tried to send a UDP packet, but there is no socket available.",UDP_ADDRESS_MALFORMED:"Malformed UDP address or port.",UDP_CONNECTION_EXISTS:"There is already an existing UDP connection.",REQ_BODY_TYPE:"The response body isn't a Buffer.",REQ_RESOURCE_TYPE:"The resource must be a string, Buffer or a valid file stream.",IMAGE_FORMAT:e=>`Invalid image format: ${e}`,IMAGE_SIZE:e=>`Invalid image size: ${e}`,MESSAGE_MISSING:"Message not found",MESSAGE_BULK_DELETE_TYPE:"The messages must be an Array, Collection, or number.",MESSAGE_NONCE_TYPE:"Message nonce must fit in an unsigned 64-bit integer.",TYPING_COUNT:"Count must be at least 1",SPLIT_MAX_LEN:"Message exceeds the max length and contains no split characters.",BAN_RESOLVE_ID:(e=!1)=>`Couldn't resolve the user ID to ${e?"ban":"unban"}.`,PRUNE_DAYS_TYPE:"Days must be a number",SEARCH_CHANNEL_TYPE:"Target must be a TextChannel, DMChannel, GroupDMChannel, or Guild.",MESSAGE_SPLIT_MISSING:"Message exceeds the max length and contains no split characters.",GUILD_CHANNEL_RESOLVE:"Could not resolve channel to a guild channel.",GUILD_CHANNEL_ORPHAN:"Could not find a parent to this guild channel.",GUILD_OWNED:"Guild is owned by the client.",GUILD_RESTRICTED:(e=!1)=>`Guild is ${e?"already":"not"} restricted.`,GUILD_MEMBERS_TIMEOUT:"Members didn't arrive in time.",INVALID_TYPE:(e,t,s=!1)=>`Supplied ${e} is not a${s?"n":""} ${t}.`,WEBHOOK_MESSAGE:"The message was not sent by a webhook.",EMOJI_TYPE:"Emoji must be a string or Emoji/ReactionEmoji",REACTION_RESOLVE_USER:"Couldn't resolve the user ID to remove from the reaction."};for(const[e,t]of Object.entries(n))i(e,t)},function(e,t){t.endianness=function(){return"LE"},t.hostname=function(){return"undefined"!=typeof location?location.hostname:""},t.loadavg=function(){return[]},t.uptime=function(){return 0},t.freemem=function(){return Number.MAX_VALUE},t.totalmem=function(){return Number.MAX_VALUE},t.cpus=function(){return[]},t.type=function(){return"Browser"},t.release=function(){return"undefined"!=typeof navigator?navigator.appVersion:""},t.networkInterfaces=t.getNetworkInterfaces=function(){return{}},t.arch=function(){return"javascript"},t.platform=function(){return"browser"},t.tmpdir=t.tmpDir=function(){return"/tmp"},t.EOL="\n"},function(e,t,s){(function(t){const{Package:i}=s(0);class UserAgentManager{constructor(){this.build(this.constructor.DEFAULT)}set({url:e,version:t}={}){this.build({url:e||this.constructor.DFEAULT.url,version:t||this.constructor.DEFAULT.version})}build(e){this.userAgent=`DiscordBot (${e.url}, ${e.version}) Node.js/${t.version}`}}UserAgentManager.DEFAULT={url:i.homepage.split("#")[0],version:i.version},e.exports=UserAgentManager}).call(t,s(18))},function(e,t,s){e.exports={sequential:s(79),burst:s(80),RequestHandler:s(81)}},function(e,t){e.exports=function(){this.busy||this.limited||0===this.queue.length||(this.busy=!0,this.execute(this.queue.shift()).then(()=>{this.busy=!1,this.handle()}).catch(({timeout:e})=>{this.client.setTimeout(()=>{this.reset(),this.busy=!1,this.handle()},e||this.resetTime-Date.now()+this.timeDifference+this.client.options.restTimeOffset)}))}},function(e,t){e.exports=function(){this.limited||0===this.queue.length||(this.execute(this.queue.shift()).then(this.handle.bind(this)).catch(({timeout:e})=>{this.client.setTimeout(()=>{this.reset(),this.handle()},e||this.resetTime-Date.now()+this.timeDifference+this.client.options.restTimeOffset)}),this.remaining--,this.handle())}},function(e,t,s){const i=s(42);class RequestHandler{constructor(e,t){this.manager=e,this.client=this.manager.client,this.handle=t.bind(this),this.limit=1/0,this.resetTime=null,this.remaining=1,this.timeDifference=0,this.queue=[]}get limited(){return this.manager.globallyRateLimited||this.remaining<=0}set globallyLimited(e){this.manager.globallyRateLimited=e}push(e){this.queue.push(e),this.handle()}execute(e){return new Promise((t,s)=>{const n=e=>{e||this.limited?s({timeout:e,limited:this.limited}):t()};e.request.gen().end((t,s)=>{if(s&&s.headers&&(s.headers["x-ratelimit-global"]&&(this.globallyLimited=!0),this.limit=Number(s.headers["x-ratelimit-limit"]),this.resetTime=1e3*Number(s.headers["x-ratelimit-reset"]),this.remaining=Number(s.headers["x-ratelimit-remaining"]),this.timeDifference=Date.now()-new Date(s.headers.date).getTime()),t)429===t.status?(this.queue.unshift(e),n(Number(s.headers["retry-after"])+this.client.options.restTimeOffset)):t.status>=500&&t.status<600?(this.queue.unshift(e),n(1e3+this.client.options.restTimeOffset)):(e.reject(t.status>=400&&t.status<500?new i(s.request.path,s.body):t),n());else{const t=s&&s.body?s.body:{};e.resolve(t),n()}})})}reset(){this.globallyLimited=!1,this.remaining=1}}e.exports=RequestHandler},function(e,t,s){const i=s(30),n=s(29),r=s(83);if(r.Agent)var o=new r.Agent({keepAlive:!0});class APIRequest{constructor(e,t,s,i){this.rest=e,this.client=e.client,this.method=t,this.path=s.toString(),this.route=i.route,this.options=i}gen(){const e=!1===this.options.versioned?this.client.options.http.api:`${this.client.options.http.api}/v${this.client.options.http.version}`;if(this.options.query){const e=(i.stringify(this.options.query).match(/[^=&?]+=[^=&?]+/g)||[]).join("&");this.path+=`?${e}`}const t=n[this.method](`${e}${this.path}`,{agent:o});if(!1!==this.options.auth&&t.set("Authorization",this.rest.getAuth()),this.options.reason&&t.set("X-Audit-Log-Reason",encodeURIComponent(this.options.reason)),this.rest.client.browser||t.set("User-Agent",this.rest.userAgentManager.userAgent),this.options.headers&&t.set(this.options.headers),this.options.files){for(const e of this.options.files)e&&e.file&&t.attach(e.name,e.file,e.name);void 0!==this.options.data&&t.attach("payload_json",JSON.stringify(this.options.data))}else void 0!==this.options.data&&t.send(this.options.data);return t}}e.exports=APIRequest},function(e,t){},function(e,t,s){const i=s(31),n=()=>{},r=["get","post","delete","patch","put"],o=["toString","valueOf","inspect","constructor",Symbol.toPrimitive,i.inspect.custom];e.exports=function(e){const t=[""],s={get:(i,a)=>o.includes(a)?()=>t.join("/"):r.includes(a)?s=>e.request(a,t.join("/"),Object.assign({versioned:e.versioned,route:t.map((e,s)=>/\d{16,19}/g.test(e)?/channels|guilds/.test(t[s-1])?e:":id":e).join("/")},s)):(t.push(a),new Proxy(n,s)),apply:(e,i,r)=>(t.push(...r.filter(e=>null!=e)),new Proxy(n,s))};return new Proxy(n,s)}},function(module,exports,__webpack_require__){(function(process){const BaseClient=__webpack_require__(32),Permissions=__webpack_require__(9),RESTManager=__webpack_require__(41),ClientManager=__webpack_require__(86),ClientVoiceManager=__webpack_require__(87),WebSocketManager=__webpack_require__(88),ActionsManager=__webpack_require__(141),Collection=__webpack_require__(3),VoiceRegion=__webpack_require__(56),Webhook=__webpack_require__(16),Invite=__webpack_require__(25),ClientApplication=__webpack_require__(36),ShardClientUtil=__webpack_require__(170),VoiceBroadcast=__webpack_require__(171),UserStore=__webpack_require__(172),ChannelStore=__webpack_require__(173),GuildStore=__webpack_require__(174),ClientPresenceStore=__webpack_require__(175),EmojiStore=__webpack_require__(57),{Events:Events}=__webpack_require__(0),DataResolver=__webpack_require__(10),{Error:Error,TypeError:TypeError,RangeError:RangeError}=__webpack_require__(4);class Client extends BaseClient{constructor(e={}){super(Object.assign({_tokenType:"Bot"},e)),!this.options.shardId&&"SHARD_ID"in process.env&&(this.options.shardId=Number(process.env.SHARD_ID)),!this.options.shardCount&&"SHARD_COUNT"in process.env&&(this.options.shardCount=Number(process.env.SHARD_COUNT)),this._validateOptions(),this.rest=new RESTManager(this),this.manager=new ClientManager(this),this.ws=new WebSocketManager(this),this.actions=new ActionsManager(this),this.voice=this.browser?null:new ClientVoiceManager(this),this.shard=process.send?ShardClientUtil.singleton(this):null,this.users=new UserStore(this),this.guilds=new GuildStore(this),this.channels=new ChannelStore(this),this.presences=new ClientPresenceStore(this),Object.defineProperty(this,"token",{writable:!0}),!this.token&&"CLIENT_TOKEN"in process.env?this.token=process.env.CLIENT_TOKEN:this.token=null,this.user=null,this.readyAt=null,this.broadcasts=[],this.pings=[],this._timeouts=new Set,this._intervals=new Set,this.options.messageSweepInterval>0&&this.setInterval(this.sweepMessages.bind(this),1e3*this.options.messageSweepInterval)}get _pingTimestamp(){return this.ws.connection?this.ws.connection.lastPingTimestamp:0}get status(){return this.ws.connection?this.ws.connection.status:null}get uptime(){return this.readyAt?Date.now()-this.readyAt:null}get ping(){return this.pings.reduce((e,t)=>e+t,0)/this.pings.length}get voiceConnections(){return this.browser?new Collection:this.voice.connections}get emojis(){const e=new EmojiStore({client:this});for(const t of this.guilds.values())if(t.available)for(const s of t.emojis.values())e.set(s.id,s);return e}get readyTimestamp(){return this.readyAt?this.readyAt.getTime():null}createVoiceBroadcast(){const e=new VoiceBroadcast(this);return this.broadcasts.push(e),e}login(e){return new Promise((t,s)=>{if("string"!=typeof e)throw new Error("TOKEN_INVALID");e=e.replace(/^Bot\s*/i,""),this.manager.connectToWebSocket(e,t,s)}).catch(e=>(this.destroy(),Promise.reject(e)))}destroy(){return super.destroy(),this.manager.destroy()}syncGuilds(e=this.guilds){this.user.bot||this.ws.send({op:12,d:e instanceof Collection?e.keyArray():e.map(e=>e.id)})}fetchInvite(e){const t=DataResolver.resolveInviteCode(e);return this.api.invites(t).get({query:{with_counts:!0}}).then(e=>new Invite(this,e))}fetchWebhook(e,t){return this.api.webhooks(e,t).get().then(e=>new Webhook(this,e))}fetchVoiceRegions(){return this.api.voice.regions.get().then(e=>{const t=new Collection;for(const s of e)t.set(s.id,new VoiceRegion(s));return t})}sweepMessages(e=this.options.messageCacheLifetime){if("number"!=typeof e||isNaN(e))throw new TypeError("CLIENT_INVALID_OPTION","Lifetime","a number");if(e<=0)return this.emit(Events.DEBUG,"Didn't sweep messages - lifetime is unlimited"),-1;const t=1e3*e,s=Date.now();let i=0,n=0;for(const e of this.channels.values())if(e.messages){i++;for(const i of e.messages.values())s-(i.editedTimestamp||i.createdTimestamp)>t&&(e.messages.delete(i.id),n++)}return this.emit(Events.DEBUG,`Swept ${n} messages older than ${e} seconds in ${i} text-based channels`),n}fetchApplication(e="@me"){return this.api.oauth2.applications(e).get().then(e=>new ClientApplication(this,e))}generateInvite(e){return e?e instanceof Array&&(e=Permissions.resolve(e)):e=0,this.fetchApplication().then(t=>`https://discordapp.com/oauth2/authorize?client_id=${t.id}&permissions=${e}&scope=bot`)}_pong(e){this.pings.unshift(Date.now()-e),this.pings.length>3&&(this.pings.length=3),this.ws.lastHeartbeatAck=!0}_eval(script){return eval(script)}_validateOptions(e=this.options){if("number"!=typeof e.shardCount||isNaN(e.shardCount))throw new TypeError("CLIENT_INVALID_OPTION","shardCount","a number");if("number"!=typeof e.shardId||isNaN(e.shardId))throw new TypeError("CLIENT_INVALID_OPTION","shardId","a number");if(e.shardCount<0)throw new RangeError("CLIENT_INVALID_OPTION","shardCount","at least 0");if(e.shardId<0)throw new RangeError("CLIENT_INVALID_OPTION","shardId","at least 0");if(0!==e.shardId&&e.shardId>=e.shardCount)throw new RangeError("CLIENT_INVALID_OPTION","shardId","less than shardCount");if("number"!=typeof e.messageCacheMaxSize||isNaN(e.messageCacheMaxSize))throw new TypeError("CLIENT_INVALID_OPTION","messageCacheMaxSize","a number");if("number"!=typeof e.messageCacheLifetime||isNaN(e.messageCacheLifetime))throw new TypeError("CLIENT_INVALID_OPTION","The messageCacheLifetime","a number");if("number"!=typeof e.messageSweepInterval||isNaN(e.messageSweepInterval))throw new TypeError("CLIENT_INVALID_OPTION","messageSweepInterval","a number");if("boolean"!=typeof e.fetchAllMembers)throw new TypeError("CLIENT_INVALID_OPTION","fetchAllMembers","a boolean");if("boolean"!=typeof e.disableEveryone)throw new TypeError("CLIENT_INVALID_OPTION","disableEveryone","a boolean");if("number"!=typeof e.restWsBridgeTimeout||isNaN(e.restWsBridgeTimeout))throw new TypeError("CLIENT_INVALID_OPTION","restWsBridgeTimeout","a number");if("boolean"!=typeof e.internalSharding)throw new TypeError("CLIENT_INVALID_OPTION","internalSharding","a boolean");if(!(e.disabledEvents instanceof Array))throw new TypeError("CLIENT_INVALID_OPTION","disabledEvents","an Array")}}module.exports=Client}).call(exports,__webpack_require__(18))},function(e,t,s){const{Events:i,Status:n}=s(0),{Error:r}=s(4);class ClientManager{constructor(e){this.client=e,this.heartbeatInterval=null}get status(){return this.connection?this.connection.status:n.IDLE}connectToWebSocket(e,t,s){this.client.emit(i.DEBUG,`Authenticated using token ${e}`),this.client.token=e;const n=this.client.setTimeout(()=>s(new r("WS_CONNECTION_TIMEOUT")),3e5);this.client.api.gateway.get().then(o=>{const a=`${o.url}/`;this.client.emit(i.DEBUG,`Using gateway ${a}`),this.client.ws.connect(a),this.client.ws.connection.once("error",s),this.client.ws.connection.once("close",e=>{4004===e.code&&s(new r("TOKEN_INVALID")),4010===e.code&&s(new r("SHARDING_INVALID")),4011===e.code&&s(new r("SHARDING_REQUIRED"))}),this.client.once(i.READY,()=>{t(e),this.client.clearTimeout(n)})},s)}destroy(){return this.client.ws.destroy(),this.client.rest.destroy(),this.client.user?this.client.user.bot?(this.client.token=null,Promise.resolve()):this.client.api.logout.post().then(()=>{this.client.token=null}):Promise.resolve()}}e.exports=ClientManager},function(e,t){},function(e,t,s){const i=s(21),{Events:n,Status:r}=s(0),o=s(89);class WebSocketManager extends i{constructor(e){super(),this.client=e,this.connection=null}heartbeat(){return this.connection?this.connection.heartbeat():this.debug("No connection to heartbeat")}debug(e){return this.client.emit(n.DEBUG,`[ws] ${e}`)}destroy(){return this.connection?this.connection.destroy():(this.debug("Attempted to destroy WebSocket but no connection exists!"),!1)}send(e){this.connection?this.connection.send(e):this.debug("No connection to websocket")}connect(e){if(!this.connection)return this.connection=new o(this,e),!0;switch(this.connection.status){case r.IDLE:case r.DISCONNECTED:return this.connection.connect(e,5500),!0;default:return this.debug(`Couldn't connect to ${e} as the websocket is at state ${this.connection.status}`),!1}}}e.exports=WebSocketManager},function(e,t,s){const i=s(21),{DefaultOptions:n,Events:r,OPCodes:o,Status:a,WSCodes:c}=s(0),l=s(90),h=s(61);class WebSocketConnection extends i{constructor(e,t){super(),this.manager=e,this.client=e.client,this.ws=null,this.sequence=-1,this.status=a.IDLE,this.packetManager=new l(this),this.lastPingTimestamp=0,this.ratelimit={queue:[],remaining:60,total:60,resetTimer:null},this.connect(t),this.disabledEvents={},this.closeSequence=0,this.expectingClose=!1;for(const e of this.client.options.disabledEvents)this.disabledEvents[e]=!0}triggerReady(){this.status!==a.READY?(this.status=a.READY,this.client.emit(r.READY),this.packetManager.handleQueue()):this.debug("Tried to mark self as ready, but already ready")}checkIfReady(){if(this.status===a.READY||this.status===a.NEARLY)return!1;let e=0;for(const t of this.client.guilds.values())t.available||e++;if(0===e){if(this.status=a.NEARLY,!this.client.options.fetchAllMembers)return this.triggerReady();const e=this.client.guilds.map(e=>e.members.fetch());Promise.all(e).then(()=>this.triggerReady()).catch(e=>{this.debug(`Failed to fetch all members before ready! ${e}`),this.triggerReady()})}return!0}debug(e){return e instanceof Error&&(e=e.stack),this.manager.debug(`[connection] ${e}`)}processQueue(){if(0!==this.ratelimit.remaining&&0!==this.ratelimit.queue.length)for(this.ratelimit.remaining===this.ratelimit.total&&(this.ratelimit.resetTimer=this.client.setTimeout(()=>{this.ratelimit.remaining=this.ratelimit.total,this.processQueue()},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===h.OPEN?this.ws.send(h.pack(e)):this.debug(`Tried to send packet ${e} but no WebSocket is available!`)}send(e){this.ws&&this.ws.readyState===h.OPEN?(this.ratelimit.queue.push(e),this.processQueue()):this.debug(`Tried to send packet ${e} but no WebSocket is available!`)}connect(e=this.gateway,t=0,s=!1){if(t)return this.client.setTimeout(()=>this.connect(e,0,s),t);if(this.ws&&!s)return this.debug("WebSocket connection already exists"),!1;if("string"!=typeof e)return this.debug(`Tried to connect to an invalid gateway: ${e}`),!1;this.expectingClose=!1,this.gateway=e,this.debug(`Connecting to ${e}`);const i=this.ws=h.create(e,{v:n.ws.version});return i.onmessage=this.onMessage.bind(this),i.onopen=this.onOpen.bind(this),i.onerror=this.onError.bind(this),i.onclose=this.onClose.bind(this),this.status=a.CONNECTING,!0}destroy(){const e=this.ws;return e?(this.heartbeat(-1),this.expectingClose=!0,e.close(1e3),this.packetManager.handleQueue(),this.ws=null,this.status=a.DISCONNECTED,this.ratelimit.remaining=this.ratelimit.total,!0):(this.debug("Attempted to destroy WebSocket but no connection exists!"),!1)}onMessage(e){let t;try{t=h.unpack(e.data)}catch(e){this.emit("debug",e)}const s=this.onPacket(t);return this.client.emit("raw",t),s}setSequence(e){this.sequence=e>this.sequence?e:this.sequence}onPacket(e){if(!e)return this.debug("Received null packet"),!1;switch(e.op){case o.HELLO:return this.heartbeat(e.d.heartbeat_interval);case o.RECONNECT:return this.reconnect();case o.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 o.HEARTBEAT_ACK:return this.ackHeartbeat();case o.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.RECONNECTING),this.connect(this.gateway,5500,!0)}onError(e){e&&"uWs client connection error"===e.message?this.reconnect():this.client.emit(r.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:c[e.code])return this.expectingClose=!1,this.client.emit(r.DISCONNECT,e),this.debug(c[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:o.HEARTBEAT,d:this.sequence})):-1===e?(this.debug("Clearing heartbeat interval"),this.client.clearInterval(this.heartbeatInterval),this.heartbeatInterval=null):(this.debug(`Setting a heartbeat interval for ${e}ms`),this.heartbeatInterval=this.client.setInterval(()=>this.heartbeat(),e))}identify(e){return e?this.client.setTimeout(this.identify.bind(this),e):this.sessionID?this.identifyResume():this.identifyNew()}identifyNew(){if(!this.client.token)return void this.debug("No token available to identify a new session with");const e=Object.assign({token:this.client.token},this.client.options.ws),{shardId:t,shardCount:s}=this.client.options;s>0&&(e.shard=[Number(t),Number(s)]),this.debug("Identifying as a new session"),this.send({op:o.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:o.RESUME,d:e})}}e.exports=WebSocketConnection},function(e,t,s){const{OPCodes:i,Status:n,WSEvents:r}=s(0),o=[r.READY,r.RESUMED,r.GUILD_CREATE,r.GUILD_DELETE,r.GUILD_MEMBERS_CHUNK,r.GUILD_MEMBER_ADD,r.GUILD_MEMBER_REMOVE];class WebSocketPacketManager{constructor(e){this.ws=e,this.handlers={},this.queue=[],this.register(r.READY,s(91)),this.register(r.RESUMED,s(102)),this.register(r.GUILD_CREATE,s(103)),this.register(r.GUILD_DELETE,s(104)),this.register(r.GUILD_UPDATE,s(105)),this.register(r.GUILD_BAN_ADD,s(106)),this.register(r.GUILD_BAN_REMOVE,s(107)),this.register(r.GUILD_MEMBER_ADD,s(108)),this.register(r.GUILD_MEMBER_REMOVE,s(109)),this.register(r.GUILD_MEMBER_UPDATE,s(110)),this.register(r.GUILD_ROLE_CREATE,s(111)),this.register(r.GUILD_ROLE_DELETE,s(112)),this.register(r.GUILD_ROLE_UPDATE,s(113)),this.register(r.GUILD_EMOJIS_UPDATE,s(114)),this.register(r.GUILD_MEMBERS_CHUNK,s(115)),this.register(r.CHANNEL_CREATE,s(116)),this.register(r.CHANNEL_DELETE,s(117)),this.register(r.CHANNEL_UPDATE,s(118)),this.register(r.CHANNEL_PINS_UPDATE,s(119)),this.register(r.PRESENCE_UPDATE,s(120)),this.register(r.USER_UPDATE,s(121)),this.register(r.USER_NOTE_UPDATE,s(122)),this.register(r.USER_SETTINGS_UPDATE,s(123)),this.register(r.USER_GUILD_SETTINGS_UPDATE,s(124)),this.register(r.VOICE_STATE_UPDATE,s(125)),this.register(r.TYPING_START,s(126)),this.register(r.MESSAGE_CREATE,s(127)),this.register(r.MESSAGE_DELETE,s(128)),this.register(r.MESSAGE_UPDATE,s(129)),this.register(r.MESSAGE_DELETE_BULK,s(130)),this.register(r.VOICE_SERVER_UPDATE,s(131)),this.register(r.GUILD_SYNC,s(132)),this.register(r.RELATIONSHIP_ADD,s(133)),this.register(r.RELATIONSHIP_REMOVE,s(134)),this.register(r.MESSAGE_REACTION_ADD,s(135)),this.register(r.MESSAGE_REACTION_REMOVE,s(136)),this.register(r.MESSAGE_REACTION_REMOVE_ALL,s(137))}get client(){return this.ws.client}register(e,t){this.handlers[e]=new t(this)}handleQueue(){this.queue.forEach((e,t)=>{this.handle(this.queue[t],!0),this.queue.splice(t,1)})}handle(e,t=!1){return e.op===i.HEARTBEAT_ACK?(this.ws.client._pong(this.ws.client._pingTimestamp),this.ws.lastHeartbeatAck=!0,this.ws.client.emit("debug","Heartbeat acknowledged")):e.op===i.HEARTBEAT&&(this.client.ws.send({op:i.HEARTBEAT,d:this.client.ws.sequence}),this.ws.client.emit("debug","Received gateway heartbeat")),this.ws.status===n.RECONNECTING&&(this.ws.reconnecting=!1,this.ws.checkIfReady()),this.ws.setSequence(e.s),void 0===this.ws.disabledEvents[e.t]&&(this.ws.status!==n.READY&&-1===o.indexOf(e.t)?(this.queue.push(e),!1):(!t&&this.queue.length>0&&this.handleQueue(),!!this.handlers[e.t]&&this.handlers[e.t].handle(e)))}}e.exports=WebSocketPacketManager},function(e,t,s){const i=s(1),{Events:n}=s(0),r=s(43);class ReadyHandler extends i{handle(e){const t=this.packetManager.client,s=e.d;t.ws.heartbeat(),s.user.user_settings=s.user_settings,s.user.user_guild_settings=s.user_guild_settings;const i=new r(t,s.user);t.user=i,t.readyAt=new Date,t.users.set(i.id,i);for(const e of s.guilds)t.guilds.create(e);for(const e of s.private_channels)t.channels.create(e);for(const e of s.relationships){const s=t.users.create(e.user);1===e.type?t.user.friends.set(s.id,s):2===e.type&&t.user.blocked.set(s.id,s)}for(const e of s.presences||[])t.presences.create(e);if(s.notes)for(const e in s.notes){let i=s.notes[e];i.length||(i=null),t.user.notes.set(e,i)}t.users.has("1")||t.users.create({id:"1",username:"Clyde",discriminator:"0000",avatar:"https://discordapp.com/assets/f78426a064bc9dd24847519259bc42af.png",bot:!0,status:"online",activity:null,verified:!0});const o=t.setTimeout(()=>{t.ws.connection.triggerReady()},1200*s.guilds.length);t.setMaxListeners(s.guilds.length+10),t.once("ready",()=>{t.syncGuilds(),t.setMaxListeners(10),t.clearTimeout(o)});const a=this.packetManager.ws;a.sessionID=s.session_id,a._trace=s._trace,t.emit(n.DEBUG,`READY ${a._trace.join(" -> ")} ${a.sessionID}`),a.checkIfReady()}}e.exports=ReadyHandler},function(e,t,s){const i=s(28),{TypeError:n}=s(4);e.exports=function(e,t){if("string"==typeof t&&(t={content:t}),t.before&&(t.before instanceof Date||(t.before=new Date(t.before)),t.maxID=i.fromNumber(t.before.getTime()-14200704e5).shiftLeft(22).toString()),t.after&&(t.after instanceof Date||(t.after=new Date(t.after)),t.minID=i.fromNumber(t.after.getTime()-14200704e5).shiftLeft(22).toString()),t.during){t.during instanceof Date||(t.during=new Date(t.during));const e=t.during.getTime()-14200704e5;t.minID=i.fromNumber(e).shiftLeft(22).toString(),t.maxID=i.fromNumber(e+864e5).shiftLeft(22).toString()}t.channel&&(t.channel=e.client.channels.resolveID(t.channel)),t.author&&(t.author=e.client.users.resolveID(t.author)),t.mentions&&(t.mentions=e.client.users.resolveID(t.options.mentions)),t.sortOrder&&(t.sortOrder={ascending:"asc",descending:"desc"}[t.sortOrder]||t.sortOrder),t={content:t.content,max_id:t.maxID,min_id:t.minID,has:t.has,channel_id:t.channel,author_id:t.author,author_type:t.authorType,context_size:t.contextSize,sort_by:t.sortBy,sort_order:t.sortOrder,limit:t.limit,offset:t.offset,mentions:t.mentions,mentions_everyone:t.mentionsEveryone,link_hostname:t.linkHostname,embed_provider:t.embedProvider,embed_type:t.embedType,attachment_filename:t.attachmentFilename,attachment_extension:t.attachmentExtension,include_nsfw:t.nsfw};const r=s(11),o=s(26);if(!(e instanceof r||e instanceof o))throw new n("SEARCH_CHANNEL_TYPE");return e.client.api[e instanceof r?"channels":"guilds"](e.id).messages().search.get({query:t}).then(t=>{const s=t.messages.map(t=>t.map(t=>e.client.channels.get(t.channel_id).messages.create(t,!1)));return{total:t.total_results,results:s}})}},function(e,t,s){const i=s(8),n=s(50);class ReactionStore extends i{constructor(e,t){super(e.client,t,n),this.message=e}create(e,t){return super.create(e,t,{id:e.emoji.id||e.emoji.name,extras:[this.message]})}}e.exports=ReactionStore},function(e,t,s){const i=s(15);class CategoryChannel extends i{get children(){return this.guild.channels.filter(e=>e.parentID===this.id)}}e.exports=CategoryChannel},function(e,t,s){const i=s(8),n=s(12),{Events:r,OPCodes:o}=s(0),a=s(3),{Error:c}=s(4);class GuildMemberStore extends i{constructor(e,t){super(e.client,t,n),this.guild=e}create(e,t){return super.create(e,t,{extras:[this.guild]})}resolve(e){const t=super.resolve(e);if(t)return t;const s=this.client.users.resolveID(e);return s?super.resolve(s):null}resolveID(e){const t=super.resolveID(e);if(t)return t;const s=this.client.users.resolveID(e);return this.has(s)?s:null}fetch(e){if(!e)return this._fetchMany();const t=this.client.users.resolveID(e);return t?this._fetchSingle({user:t,cache:!0}):e.user&&(e.user=this.client.users.resolveID(e.user),e.user)?this._fetchSingle(e):this._fetchMany(e)}_fetchSingle({user:e,cache:t}){const s=this.get(e);return s?Promise.resolve(s):this.client.api.guilds(this.guild.id).members(e).get().then(e=>this.create(e,t))}_fetchMany({query:e="",limit:t=0}={}){return new Promise((s,i)=>{if(this.guild.memberCount===this.size)return void s(e||t?new a:this);this.guild.client.ws.send({op:o.REQUEST_GUILD_MEMBERS,d:{guild_id:this.guild.id,query:e,limit:t}});const n=new a,l=(i,o)=>{if(o.id===this.guild.id){for(const s of i.values())(e||t)&&n.set(s.id,s);(this.guild.memberCount<=this.size||(e||t)&&i.size<1e3||t&&n.size>=t)&&(this.guild.client.removeListener(r.GUILD_MEMBERS_CHUNK,l),s(e||t?n:this))}};this.guild.client.on(r.GUILD_MEMBERS_CHUNK,l),this.guild.client.setTimeout(()=>{this.guild.client.removeListener(r.GUILD_MEMBERS_CHUNK,l),i(new c("GUILD_MEMBERS_TIMEOUT"))},12e4)})}}e.exports=GuildMemberStore},function(e,t,s){const i=s(8),n=s(24);class RoleStore extends i{constructor(e,t){super(e.client,t,n),this.guild=e}create(e,t){return super.create(e,t,{extras:[this.guild]})}}e.exports=RoleStore},function(e,t,s){const i=s(8),n=s(11),r=s(15);class GuildChannelStore extends i{constructor(e,t){super(e.client,t,r),this.guild=e}create(e){const t=this.get(e.id);return t||n.create(this.client,e,this.guild)}}e.exports=GuildChannelStore},function(e,t,s){const i=s(5),n=s(14),{RangeError:r}=s(4);e.exports=function(e,t){const o=s(22),a=s(12);if(e instanceof o||e instanceof a)return e.createDM().then(e=>e.send(t));let{content:c,nonce:l,reply:h,code:u,disableEveryone:d,tts:p,embed:f,files:g,split:m}=t;if(f&&(f=new n(f)._apiTransform()),void 0!==l&&(l=parseInt(l),isNaN(l)||l<0))throw new r("MESSAGE_NONCE_TYPE");if(h&&!(e instanceof o||e instanceof a)&&"dm"!==e.type){const t=e.client.users.resolveID(h),s=`<@${h instanceof a&&h.nickname?"!":""}${t}>`;m&&(m.prepend=`${s}, ${m.prepend||""}`),c=`${s}${void 0!==c?`, ${c}`:""}`}return c&&(c=i.resolveString(c),m&&"object"!=typeof m&&(m={}),void 0===u||"boolean"==typeof u&&!0!==u||(c=i.escapeMarkdown(c,!0),c=`\`\`\`${"boolean"!=typeof u?u||"":""}\n${c}\n\`\`\``,m&&(m.prepend=`\`\`\`${"boolean"!=typeof u?u||"":""}\n`,m.append="\n```")),(d||void 0===d&&e.client.options.disableEveryone)&&(c=c.replace(/@(everyone|here)/g,"@​$1")),m&&(c=i.splitMessage(c,m))),c instanceof Array?new Promise((t,s)=>{const i=[];!function n(){const r=c.length?{tts:p}:{tts:p,embed:f,files:g};e.send(c.shift(),r).then(e=>(i.push(e),0===c.length?t(i):n())).catch(s)}()}):e.client.api.channels[e.id].messages.post({data:{content:c,tts:p,nonce:l,embed:f},files:g}).then(t=>e.client.actions.MessageCreate.handle(t).message)}},function(e,t,s){const i=s(3),{UserFlags:n}=s(0),r=s(100),o=s(7);class UserProfile extends o{constructor(e,t){super(e.client),this.user=e,this.mutualGuilds=new i,this.connections=new i,this._patch(t)}_patch(e){this.premium=Boolean(e.premium_since),this._flags=e.user.flags,this.premiumSince=e.premium_since?new Date(e.premium_since):null;for(const t of e.mutual_guilds)this.client.guilds.has(t.id)&&this.mutualGuilds.set(t.id,this.client.guilds.get(t.id));for(const t of e.connected_accounts)this.connections.set(t.id,new r(this.user,t))}get flags(){const e=[];for(const[t,s]of Object.entries(n))(this._flags&s)===s&&e.push(t);return e}}e.exports=UserProfile},function(e,t){class UserConnection{constructor(e,t){this.user=e,this._patch(t)}_patch(e){this.type=e.type,this.name=e.name,this.id=e.id,this.revoked=e.revoked,this.integrations=e.integrations}}e.exports=UserConnection},function(e,t,s){const{UserChannelOverrideMap:i}=s(0);class ClientUserChannelOverride{constructor(e){this.patch(e)}patch(e){for(const[t,s]of Object.entries(i))e.hasOwnProperty(t)&&("function"==typeof s?this[s.name]=s(e[t]):this[s]=e[t])}}e.exports=ClientUserChannelOverride},function(e,t,s){const i=s(1),{Events:n,Status:r}=s(0);class ResumedHandler extends i{handle(e){const t=this.packetManager.client,s=t.ws.connection;s._trace=e.d._trace,s.status=r.READY,this.packetManager.handleQueue();const i=s.sequence-s.closeSequence;s.debug(`RESUMED ${s._trace.join(" -> ")} | replayed ${i} events.`),t.emit(n.RESUMED,i),s.heartbeat()}}e.exports=ResumedHandler},function(e,t,s){const i=s(1),{Events:n,Status:r}=s(0);class GuildCreateHandler extends i{async handle(e){const t=this.packetManager.client,s=e.d;let i=t.guilds.get(s.id);i?i.available||s.unavailable||(i._patch(s),this.packetManager.ws.checkIfReady()):(i=t.guilds.create(s),t.ws.connection.status===r.READY&&(t.options.fetchAllMembers&&await i.members.fetch(),t.emit(n.GUILD_CREATE,i)))}}e.exports=GuildCreateHandler},function(e,t,s){const i=s(1);class GuildDeleteHandler extends i{handle(e){this.packetManager.client.actions.GuildDelete.handle(e.d)}}e.exports=GuildDeleteHandler},function(e,t,s){const i=s(1);class GuildUpdateHandler extends i{handle(e){const t=this.packetManager.client,s=e.d;t.actions.GuildUpdate.handle(s)}}e.exports=GuildUpdateHandler},function(e,t,s){const i=s(1),{Events:n}=s(0);class GuildBanAddHandler extends i{handle(e){const t=this.packetManager.client,s=e.d,i=t.guilds.get(s.guild_id),r=t.users.get(s.user.id);i&&r&&t.emit(n.GUILD_BAN_ADD,i,r)}}e.exports=GuildBanAddHandler},function(e,t,s){const i=s(1);class GuildBanRemoveHandler extends i{handle(e){const t=this.packetManager.client,s=e.d;t.actions.GuildBanRemove.handle(s)}}e.exports=GuildBanRemoveHandler},function(e,t,s){const i=s(1),{Events:n,Status:r}=s(0);class GuildMemberAddHandler extends i{handle(e){const t=this.packetManager.client,s=e.d,i=t.guilds.get(s.guild_id);if(i){i.memberCount++;const e=i.members.create(s);t.ws.connection.status===r.READY&&t.emit(n.GUILD_MEMBER_ADD,e)}}}e.exports=GuildMemberAddHandler},function(e,t,s){const i=s(1);class GuildMemberRemoveHandler extends i{handle(e){const t=this.packetManager.client,s=e.d;t.actions.GuildMemberRemove.handle(s)}}e.exports=GuildMemberRemoveHandler},function(e,t,s){const i=s(1),{Events:n,Status:r}=s(0);class GuildMemberUpdateHandler extends i{handle(e){const t=this.packetManager.client,s=e.d,i=t.guilds.get(s.guild_id);if(i){const e=i.members.get(s.user.id);if(e){const i=e._update(s);t.ws.connection.status===r.READY&&t.emit(n.GUILD_MEMBER_UPDATE,i,e)}}}}e.exports=GuildMemberUpdateHandler},function(e,t,s){const i=s(1);class GuildRoleCreateHandler extends i{handle(e){const t=this.packetManager.client,s=e.d;t.actions.GuildRoleCreate.handle(s)}}e.exports=GuildRoleCreateHandler},function(e,t,s){const i=s(1);class GuildRoleDeleteHandler extends i{handle(e){const t=this.packetManager.client,s=e.d;t.actions.GuildRoleDelete.handle(s)}}e.exports=GuildRoleDeleteHandler},function(e,t,s){const i=s(1);class GuildRoleUpdateHandler extends i{handle(e){const t=this.packetManager.client,s=e.d;t.actions.GuildRoleUpdate.handle(s)}}e.exports=GuildRoleUpdateHandler},function(e,t,s){const i=s(1);class GuildEmojisUpdate extends i{handle(e){const t=this.packetManager.client,s=e.d;t.actions.GuildEmojisUpdate.handle(s)}}e.exports=GuildEmojisUpdate},function(e,t,s){const i=s(1),{Events:n}=s(0),r=s(3);class GuildMembersChunkHandler extends i{handle(e){const t=this.packetManager.client,s=e.d,i=t.guilds.get(s.guild_id);if(!i)return;const o=new r;for(const e of s.members)o.set(e.user.id,i.members.create(e));t.emit(n.GUILD_MEMBERS_CHUNK,o,i),t.ws.lastHeartbeatAck=!0}}e.exports=GuildMembersChunkHandler},function(e,t,s){const i=s(1);class ChannelCreateHandler extends i{handle(e){this.packetManager.client.actions.ChannelCreate.handle(e.d)}}e.exports=ChannelCreateHandler},function(e,t,s){const i=s(1);class ChannelDeleteHandler extends i{handle(e){this.packetManager.client.actions.ChannelDelete.handle(e.d)}}e.exports=ChannelDeleteHandler},function(e,t,s){const i=s(1),{Events:n}=s(0);class ChannelUpdateHandler extends i{handle(e){const{old:t,updated:s}=this.packetManager.client.actions.ChannelUpdate.handle(e.d);t&&s&&this.packetManager.client.emit(n.CHANNEL_UPDATE,t,s)}}e.exports=ChannelUpdateHandler},function(e,t,s){const i=s(1),{Events:n}=s(0);class ChannelPinsUpdate extends i{handle(e){const t=this.packetManager.client,s=e.d,i=t.channels.get(s.channel_id),r=new Date(s.last_pin_timestamp);i&&r&&t.emit(n.CHANNEL_PINS_UPDATE,i,r)}}e.exports=ChannelPinsUpdate},function(e,t,s){const i=s(1),{Events:n}=s(0);class PresenceUpdateHandler extends i{handle(e){const t=this.packetManager.client,s=e.d;let i=t.users.get(s.user.id);const r=t.guilds.get(s.guild_id);if(!i){if(!s.user.username)return;i=t.users.create(s.user)}const o=i._update(s.user);if(i.equals(o)||t.emit(n.USER_UPDATE,o,i),r){let e=r.members.get(i.id);if(e||"offline"===s.status||(e=r.members.create({user:i,roles:s.roles,deaf:!1,mute:!1}),t.emit(n.GUILD_MEMBER_AVAILABLE,e)),e){if(0===t.listenerCount(n.PRESENCE_UPDATE))return void r.presences.create(s);const i=e._clone();e.presence&&(i.frozenPresence=e.presence._clone()),r.presences.create(s),t.emit(n.PRESENCE_UPDATE,i,e)}else r.presences.create(s)}}}e.exports=PresenceUpdateHandler},function(e,t,s){const i=s(1);class UserUpdateHandler extends i{handle(e){const t=this.packetManager.client,s=e.d;t.actions.UserUpdate.handle(s)}}e.exports=UserUpdateHandler},function(e,t,s){const i=s(1);class UserNoteUpdateHandler extends i{handle(e){const t=this.packetManager.client,s=e.d;t.actions.UserNoteUpdate.handle(s)}}e.exports=UserNoteUpdateHandler},function(e,t,s){const i=s(1),{Events:n}=s(0);class UserSettingsUpdateHandler extends i{handle(e){const t=this.packetManager.client;t.user.settings.patch(e.d),t.emit(n.USER_SETTINGS_UPDATE,t.user.settings)}}e.exports=UserSettingsUpdateHandler},function(e,t,s){const i=s(1),{Events:n}=s(0),r=s(60);class UserGuildSettingsUpdateHandler extends i{handle(e){const t=this.packetManager.client,s=t.user.guildSettings.get(e.d.guild_id);s?s.patch(e.d):t.user.guildSettings.set(e.d.guild_id,new r(this.client,e.d)),t.emit(n.USER_GUILD_SETTINGS_UPDATE,t.user.guildSettings.get(e.d.guild_id))}}e.exports=UserGuildSettingsUpdateHandler},function(e,t,s){const i=s(1),{Events:n}=s(0);class VoiceStateUpdateHandler extends i{handle(e){const t=this.packetManager.client,s=e.d,i=t.guilds.get(s.guild_id);if(i){const e=i.members.get(s.user_id);if(e){const r=e._clone();r._frozenVoiceState=r.voiceState,e.user.id===t.user.id&&s.channel_id&&t.emit("self.voiceStateUpdate",s),i.voiceStates.set(e.user.id,s),t.emit(n.VOICE_STATE_UPDATE,r,e)}}}}e.exports=VoiceStateUpdateHandler},function(e,t,s){function i(e,t){return e.client.setTimeout(()=>{e.client.emit(r.TYPING_STOP,e,t,e._typing.get(t.id)),e._typing.delete(t.id)},6e3)}const n=s(1),{Events:r}=s(0);class TypingStartHandler extends n{handle(e){const t=this.packetManager.client,s=e.d,n=t.channels.get(s.channel_id),o=t.users.get(s.user_id),a=new Date(1e3*s.timestamp);if(n&&o){if("voice"===n.type)return void t.emit(r.WARN,`Discord sent a typing packet to voice channel ${n.id}`);if(n._typing.has(o.id)){const e=n._typing.get(o.id);e.lastTimestamp=a,e.resetTimeout(i(n,o))}else n._typing.set(o.id,new TypingData(t,a,a,i(n,o))),t.emit(r.TYPING_START,n,o)}}}class TypingData{constructor(e,t,s,i){this.client=e,this.since=t,this.lastTimestamp=s,this._timeout=i}resetTimeout(e){this.client.clearTimeout(this._timeout),this._timeout=e}get elapsedTime(){return Date.now()-this.since}}e.exports=TypingStartHandler},function(e,t,s){const i=s(1);class MessageCreateHandler extends i{handle(e){this.packetManager.client.actions.MessageCreate.handle(e.d)}}e.exports=MessageCreateHandler},function(e,t,s){const i=s(1);class MessageDeleteHandler extends i{handle(e){this.packetManager.client.actions.MessageDelete.handle(e.d)}}e.exports=MessageDeleteHandler},function(e,t,s){const i=s(1),{Events:n}=s(0);class MessageUpdateHandler extends i{handle(e){const{old:t,updated:s}=this.packetManager.client.actions.MessageUpdate.handle(e.d);t&&s&&this.packetManager.client.emit(n.MESSAGE_UPDATE,t,s)}}e.exports=MessageUpdateHandler},function(e,t,s){const i=s(1);class MessageDeleteBulkHandler extends i{handle(e){this.packetManager.client.actions.MessageDeleteBulk.handle(e.d)}}e.exports=MessageDeleteBulkHandler},function(e,t,s){const i=s(1);class VoiceServerUpdate extends i{handle(e){const t=this.packetManager.client,s=e.d;t.emit("self.voiceServer",s)}}e.exports=VoiceServerUpdate},function(e,t,s){const i=s(1);class GuildSyncHandler extends i{handle(e){const t=this.packetManager.client,s=e.d;t.actions.GuildSync.handle(s)}}e.exports=GuildSyncHandler},function(e,t,s){const i=s(1);class RelationshipAddHandler extends i{handle(e){const t=this.packetManager.client,s=e.d;1===s.type?t.users.fetch(s.id).then(e=>{t.user.friends.set(e.id,e)}):2===s.type&&t.users.fetch(s.id).then(e=>{t.user.blocked.set(e.id,e)})}}e.exports=RelationshipAddHandler},function(e,t,s){const i=s(1);class RelationshipRemoveHandler extends i{handle(e){const t=this.packetManager.client,s=e.d;2===s.type?t.user.blocked.has(s.id)&&t.user.blocked.delete(s.id):1===s.type&&t.user.friends.has(s.id)&&t.user.friends.delete(s.id)}}e.exports=RelationshipRemoveHandler},function(e,t,s){const i=s(1),{Events:n}=s(0);class MessageReactionAddHandler extends i{handle(e){const t=this.packetManager.client,s=e.d,{user:i,reaction:r}=t.actions.MessageReactionAdd.handle(s);r&&t.emit(n.MESSAGE_REACTION_ADD,r,i)}}e.exports=MessageReactionAddHandler},function(e,t,s){const i=s(1);class MessageReactionRemove extends i{handle(e){const t=this.packetManager.client,s=e.d;t.actions.MessageReactionRemove.handle(s)}}e.exports=MessageReactionRemove},function(e,t,s){const i=s(1);class MessageReactionRemoveAll extends i{handle(e){const t=this.packetManager.client,s=e.d;t.actions.MessageReactionRemoveAll.handle(s)}}e.exports=MessageReactionRemoveAll},function(e,t){},function(e,t){},function(e,t){},function(e,t,s){class ActionsManager{constructor(e){this.client=e,this.register(s(142)),this.register(s(143)),this.register(s(144)),this.register(s(145)),this.register(s(146)),this.register(s(147)),this.register(s(148)),this.register(s(149)),this.register(s(150)),this.register(s(151)),this.register(s(152)),this.register(s(153)),this.register(s(154)),this.register(s(155)),this.register(s(156)),this.register(s(157)),this.register(s(158)),this.register(s(159)),this.register(s(160)),this.register(s(161)),this.register(s(162)),this.register(s(163)),this.register(s(164)),this.register(s(165)),this.register(s(166)),this.register(s(167)),this.register(s(168)),this.register(s(169))}register(e){this[e.name.replace(/Action$/,"")]=new e(this.client)}}e.exports=ActionsManager},function(e,t,s){const i=s(2),{Events:n}=s(0);class MessageCreateAction extends i{handle(e){const t=this.client,s=t.channels.get(e.channel_id);if(s){const i=s.messages.get(e.id);if(i)return{message:i};const r=s.messages.create(e),o=r.author,a=s.guild?s.guild.member(o):null;return s.lastMessageID=e.id,s.lastMessage=r,o&&(o.lastMessageID=e.id,o.lastMessage=r),a&&(a.lastMessageID=e.id,a.lastMessage=r),t.emit(n.MESSAGE_CREATE,r),{message:r}}return{}}}e.exports=MessageCreateAction},function(e,t,s){const i=s(2),{Events:n}=s(0);class MessageDeleteAction extends i{handle(e){const t=this.client,s=t.channels.get(e.channel_id);let i;return s&&(i=s.messages.get(e.id))&&(s.messages.delete(i.id),t.emit(n.MESSAGE_DELETE,i)),{message:i}}}e.exports=MessageDeleteAction},function(e,t,s){const i=s(2),n=s(3),{Events:r}=s(0);class MessageDeleteBulkAction extends i{handle(e){const t=this.client,s=t.channels.get(e.channel_id);if(s){const i=e.ids,o=new n;for(const e of i){const t=s.messages.get(e);t&&o.set(t.id,t)}return o.size>0&&t.emit(r.MESSAGE_BULK_DELETE,o),{messages:o}}return{}}}e.exports=MessageDeleteBulkAction},function(e,t,s){const i=s(2);class MessageUpdateAction extends i{handle(e){const t=this.client.channels.get(e.channel_id);if(t){const s=t.messages.get(e.id);if(s)return s.patch(e),{old:s._edits[0],updated:s}}return{}}}e.exports=MessageUpdateAction},function(e,t,s){const i=s(2);class MessageReactionAdd extends i{handle(e){const t=e.user||this.client.users.get(e.user_id);if(!t)return!1;const s=e.channel||this.client.channels.get(e.channel_id);if(!s||"voice"===s.type)return!1;const i=e.message||s.messages.get(e.message_id);if(!i)return!1;if(!e.emoji)return!1;const n=i.reactions.create({emoji:e.emoji,count:0,me:t.id===this.client.user.id});return n._add(t),{message:i,reaction:n,user:t}}}e.exports=MessageReactionAdd},function(e,t,s){const i=s(2),{Events:n}=s(0);class MessageReactionRemove extends i{handle(e){const t=this.client.users.get(e.user_id);if(!t)return!1;const s=this.client.channels.get(e.channel_id);if(!s||"voice"===s.type)return!1;const i=s.messages.get(e.message_id);if(!i)return!1;if(!e.emoji)return!1;const r=e.emoji.id||decodeURIComponent(e.emoji.name),o=i.reactions.get(r);return!!o&&(o._remove(t),this.client.emit(n.MESSAGE_REACTION_REMOVE,o,t),{message:i,reaction:o,user:t})}}e.exports=MessageReactionRemove},function(e,t,s){const i=s(2),{Events:n}=s(0);class MessageReactionRemoveAll extends i{handle(e){const t=this.client.channels.get(e.channel_id);if(!t||"voice"===t.type)return!1;const s=t.messages.get(e.message_id);return!!s&&(s.reactions.clear(),this.client.emit(n.MESSAGE_REACTION_REMOVE_ALL,s),{message:s})}}e.exports=MessageReactionRemoveAll},function(e,t,s){const i=s(2),{Events:n}=s(0);class ChannelCreateAction extends i{handle(e){const t=this.client,s=t.channels.has(e.id),i=t.channels.create(e);return!s&&i&&t.emit(n.CHANNEL_CREATE,i),{channel:i}}}e.exports=ChannelCreateAction},function(e,t,s){const i=s(2),{Events:n}=s(0);class ChannelDeleteAction extends i{constructor(e){super(e),this.deleted=new Map}handle(e){const t=this.client;let s=t.channels.get(e.id);return s&&(t.channels.remove(s.id),t.emit(n.CHANNEL_DELETE,s)),{channel:s}}}e.exports=ChannelDeleteAction},function(e,t,s){const i=s(2);class ChannelUpdateAction extends i{handle(e){const t=this.client.channels.get(e.id);return t?{old:t._update(e),updated:t}:{}}}e.exports=ChannelUpdateAction},function(e,t,s){const i=s(2),{Events:n}=s(0);class GuildDeleteAction extends i{constructor(e){super(e),this.deleted=new Map}handle(e){const t=this.client;let s=t.guilds.get(e.id);if(s){for(const e of s.channels.values())"text"===e.type&&e.stopTyping(!0);if(s.available&&e.unavailable)return s.available=!1,t.emit(n.GUILD_UNAVAILABLE,s),{guild:null};t.guilds.remove(s.id),t.emit(n.GUILD_DELETE,s),this.deleted.set(s.id,s),this.scheduleForDeletion(s.id)}else s=this.deleted.get(e.id)||null;return{guild:s}}scheduleForDeletion(e){this.client.setTimeout(()=>this.deleted.delete(e),this.client.options.restWsBridgeTimeout)}}e.exports=GuildDeleteAction},function(e,t,s){const i=s(2),{Events:n}=s(0);class GuildUpdateAction extends i{handle(e){const t=this.client,s=t.guilds.get(e.id);if(s){const i=s._update(e);return t.emit(n.GUILD_UPDATE,i,s),{old:i,updated:s}}return{old:null,updated:null}}}e.exports=GuildUpdateAction},function(e,t,s){const i=s(2);class GuildMemberGetAction extends i{handle(e,t){return{member:e.members.create(t)}}}e.exports=GuildMemberGetAction},function(e,t,s){const i=s(2),{Events:n,Status:r}=s(0);class GuildMemberRemoveAction extends i{handle(e){const t=this.client,s=t.guilds.get(e.guild_id);let i=null;return s&&(i=s.members.get(e.user.id))&&(s.memberCount--,s.members.remove(i.id),t.status===r.READY&&t.emit(n.GUILD_MEMBER_REMOVE,i)),{guild:s,member:i}}}e.exports=GuildMemberRemoveAction},function(e,t,s){const i=s(2),{Events:n}=s(0);class GuildBanRemove extends i{handle(e){const t=this.client,s=t.guilds.get(e.guild_id),i=t.users.create(e.user);s&&i&&t.emit(n.GUILD_BAN_REMOVE,s,i)}}e.exports=GuildBanRemove},function(e,t,s){const i=s(2),{Events:n}=s(0);class GuildRoleCreate extends i{handle(e){const t=this.client,s=t.guilds.get(e.guild_id);let i;if(s){const r=s.roles.has(e.role.id);i=s.roles.create(e.role),r||t.emit(n.GUILD_ROLE_CREATE,i)}return{role:i}}}e.exports=GuildRoleCreate},function(e,t,s){const i=s(2),{Events:n}=s(0);class GuildRoleDeleteAction extends i{handle(e){const t=this.client,s=t.guilds.get(e.guild_id);let i;return s&&(i=s.roles.get(e.role_id))&&(s.roles.remove(e.role_id),t.emit(n.GUILD_ROLE_DELETE,i)),{role:i}}}e.exports=GuildRoleDeleteAction},function(e,t,s){const i=s(2),{Events:n}=s(0);class GuildRoleUpdateAction extends i{handle(e){const t=this.client,s=t.guilds.get(e.guild_id);if(s){let i=null;const r=s.roles.get(e.role.id);return r&&(i=r._update(e.role),t.emit(n.GUILD_ROLE_UPDATE,i,r)),{old:i,updated:r}}return{old:null,updated:null}}}e.exports=GuildRoleUpdateAction},function(e,t,s){const i=s(2);class UserGetAction extends i{handle(e){return{user:this.client.users.create(e)}}}e.exports=UserGetAction},function(e,t,s){const i=s(2),{Events:n}=s(0);class UserUpdateAction extends i{handle(e){const t=this.client;if(t.user){if(t.user.equals(e))return{old:t.user,updated:t.user};const s=t.user._update(e);return t.emit(n.USER_UPDATE,s,t.user),{old:s,updated:t.user}}return{old:null,updated:null}}}e.exports=UserUpdateAction},function(e,t,s){const i=s(2),{Events:n}=s(0);class UserNoteUpdateAction extends i{handle(e){const t=this.client,s=t.user.notes.get(e.id),i=e.note.length?e.note:null;return t.user.notes.set(e.id,i),t.emit(n.USER_NOTE_UPDATE,e.id,s,i),{old:s,updated:i}}}e.exports=UserNoteUpdateAction},function(e,t,s){const i=s(2);class GuildSync extends i{handle(e){const t=this.client.guilds.get(e.id);if(t){if(e.presences)for(const s of e.presences)t.presences.create(s);if(e.members)for(const s of e.members){const e=t.members.get(s.user.id);e?e._patch(s):t.members.create(s,!1)}"large"in e&&(t.large=e.large)}}}e.exports=GuildSync},function(e,t,s){const i=s(2),{Events:n}=s(0);class GuildEmojiCreateAction extends i{handle(e,t){const s=e.emojis.create(t);return this.client.emit(n.GUILD_EMOJI_CREATE,s),{emoji:s}}}e.exports=GuildEmojiCreateAction},function(e,t,s){const i=s(2),{Events:n}=s(0);class GuildEmojiDeleteAction extends i{handle(e){return e.guild.emojis.remove(e.id),this.client.emit(n.GUILD_EMOJI_DELETE,e),{emoji:e}}}e.exports=GuildEmojiDeleteAction},function(e,t,s){const i=s(2),{Events:n}=s(0);class GuildEmojiUpdateAction extends i{handle(e,t){const s=e._update(t);return this.client.emit(n.GUILD_EMOJI_UPDATE,s,e),{emoji:e}}}e.exports=GuildEmojiUpdateAction},function(e,t,s){function i(e){const t=new Map;for(const s of e)t.set(...s);return t}const n=s(2);class GuildEmojisUpdateAction extends n{handle(e){const t=this.client.guilds.get(e.guild_id);if(!t||!t.emojis)return;const s=i(t.emojis.entries());for(const i of e.emojis){const e=t.emojis.get(i.id);e?(s.delete(i.id),e.equals(i,!0)||this.client.actions.GuildEmojiUpdate.handle(e,i)):this.client.actions.GuildEmojiCreate.handle(t,i)}for(const e of s.values())this.client.actions.GuildEmojiDelete.handle(e)}}e.exports=GuildEmojisUpdateAction},function(e,t,s){const i=s(2);class GuildRolesPositionUpdate extends i{handle(e){const t=this.client.guilds.get(e.guild_id);if(t)for(const s of e.roles){const e=t.roles.get(s.id);e&&(e.rawPosition=s.position)}return{guild:t}}}e.exports=GuildRolesPositionUpdate},function(e,t,s){const i=s(2);class GuildChannelsPositionUpdate extends i{handle(e){const t=this.client.guilds.get(e.guild_id);if(t)for(const s of e.channels){const e=t.channels.get(s.id);e&&(e.rawPosition=s.position)}return{guild:t}}}e.exports=GuildChannelsPositionUpdate},function(e,t){},function(e,t){},function(e,t,s){const i=s(8),n=s(22),r=s(12),o=s(35);class UserStore extends i{constructor(e,t){super(e,t,n)}resolve(e){return e instanceof r?e.user:e instanceof o?e.author:super.resolve(e)}resolveID(e){return e instanceof r?e.user.id:e instanceof o?e.author.id:super.resolveID(e)}fetch(e,t=!0){const s=this.get(e);return s?Promise.resolve(s):this.client.api.users(e).get().then(e=>this.create(e,t))}}e.exports=UserStore},function(e,t,s){const i=s(8),n=s(11),{Events:r}=s(0),o=Symbol("LRU"),a=["group","dm"];class ChannelStore extends i{constructor(e,t={},s){if(s||"function"==typeof t[Symbol.iterator]||(s=t,t=void 0),super(e,t,n),s.lru){const e=this[o]=[];e.add=(t=>{for(e.remove(t),e.unshift(t);e.length>s.lru;)this.remove(e[e.length-1])}),e.remove=(t=>{const s=e.indexOf(t);s>-1&&e.splice(s,1)})}}get(e,t=!1){const s=super.get(e);return s&&a.includes(s.type)?(!t&&this[o]&&this[o].add(e),s):s}set(e,t){return this[o]&&a.includes(t.type)&&this[o].add(e),super.set(e,t)}delete(e){const t=this.get(e,!0);return!!t&&(this[o]&&a.includes(t.type)&&this[o].remove(e),super.delete(e))}create(e,t,s=!0){const i=this.get(e.id);if(i)return i;const o=n.create(this.client,e,t);return o?(s&&this.set(o.id,o),o):(this.client.emit(r.DEBUG,`Failed to find guild for channel ${e.id} ${e.type}`),null)}remove(e){const t=this.get(e);t.guild&&t.guild.channels.remove(e),super.remove(e)}}e.exports=ChannelStore},function(e,t,s){const i=s(8),n=s(26);class GuildStore extends i{constructor(e,t){super(e,t,n)}}e.exports=GuildStore},function(e,t,s){const i=s(58),n=s(3),{ActivityTypes:r,OPCodes:o}=s(0),{Presence:a}=s(13),{TypeError:c}=s(4);class ClientPresenceStore extends i{constructor(...e){super(...e),this.clientPresence=new a(this.client,{status:"online",afk:!1,since:null,activity:null})}async setClientPresence({status:e,since:t,afk:s,activity:i}){const a=i&&(i.application?i.application.id||i.application:null);let l=new n;if(i){if("string"!=typeof i.name)throw new c("INVALID_TYPE","name","string");if(i.type||(i.type=0),i.assets&&a)try{const e=await this.client.api.oauth2.applications(a).assets.get();for(const t of e)l.set(t.name,t.id)}catch(e){}}const h={afk:null!=s&&s,since:null!=t?t:null,status:e||this.clientPresence.status,game:i?{type:"number"==typeof i.type?i.type:r.indexOf(i.type),name:i.name,url:i.url,details:i.details||void 0,state:i.state||void 0,assets:i.assets?{large_text:i.assets.largeText||void 0,small_text:i.assets.smallText||void 0,large_image:l.get(i.assets.largeImage)||i.assets.largeImage,small_image:l.get(i.assets.smallImage)||i.assets.smallImage}:void 0,timestamps:i.timestamps||void 0,party:i.party||void 0,application_id:a||void 0,secrets:i.secrets||void 0,instance:i.instance||void 0}:null};return this.clientPresence.patch(h),this.client.ws.send({op:o.STATUS_UPDATE,d:h}),this.clientPresence}}e.exports=ClientPresenceStore},function(e,t){},function(e,t){},function(e,t){},function(e,t,s){const i=s(16),n=s(32);class WebhookClient extends n{constructor(e,t,s){super(s),Object.defineProperty(this,"client",{value:this}),this.id=e,this.token=t}}i.applyToClass(WebhookClient),e.exports=WebhookClient}]); \ No newline at end of file