diff --git a/discord.indev.js b/discord.indev.js index 4144c5b9..a70e445a 100644 --- a/discord.indev.js +++ b/discord.indev.js @@ -1410,7 +1410,7 @@ }, "homepage": "https://github.com/hydrabolt/discord.js#readme", "dependencies": { - "superagent": "^2.3.0", + "superagent": "^3.0.0", "tweetnacl": "^0.14.3", "ws": "^1.1.1" }, @@ -6675,7 +6675,7 @@ } var Emitter = __webpack_require__(41); - var requestBase = __webpack_require__(42); + var RequestBase = __webpack_require__(42); var isObject = __webpack_require__(43); /** @@ -7149,9 +7149,16 @@ err.parse = true; err.original = e; // issue #675: return the raw response if the response parsing fails - err.rawResponse = self.xhr && self.xhr.responseText ? self.xhr.responseText : null; - // issue #876: return the http status code if the response parsing fails - err.statusCode = self.xhr && self.xhr.status ? self.xhr.status : null; + if (self.xhr) { + // ie9 doesn't have 'response' property + err.rawResponse = typeof self.xhr.responseType == 'undefined' ? self.xhr.responseText : self.xhr.response; + // issue #876: return the http status code if the response parsing fails + err.statusCode = self.xhr.status ? self.xhr.status : null; + } else { + err.rawResponse = null; + err.statusCode = null; + } + return self.callback(err); } @@ -7179,13 +7186,11 @@ } /** - * Mixin `Emitter` and `requestBase`. + * Mixin `Emitter` and `RequestBase`. */ Emitter(Request.prototype); - for (var key in requestBase) { - Request.prototype[key] = requestBase[key]; - } + RequestBase(Request.prototype); /** * Set Content-Type to `type`, mapping values from `request.types`. @@ -7312,7 +7317,7 @@ /** * Queue the given `file` as an attachment to the specified `field`, - * with optional `filename`. + * with optional `options` (or filename). * * ``` js * request.post('/upload') @@ -7322,13 +7327,17 @@ * * @param {String} field * @param {Blob|File} file - * @param {String} filename + * @param {String|Object} options * @return {Request} for chaining * @api public */ - Request.prototype.attach = function(field, file, filename){ - this._getFormData().append(field, file, filename || file.name); + Request.prototype.attach = function(field, file, options){ + if (this._data) { + throw Error("superagent can't mix .send() and .attach()"); + } + + this._getFormData().append(field, file, options || file.name); return this; }; @@ -7351,6 +7360,11 @@ Request.prototype.callback = function(err, res){ var fn = this._callback; this.clearTimeout(); + + if (err) { + this.emit('error', err); + } + fn(err, res); }; @@ -7371,6 +7385,17 @@ this.callback(err); }; + // This only warns, because the request is still likely to work + Request.prototype.buffer = Request.prototype.ca = Request.prototype.agent = function(){ + console.warn("This is not supported in browser version of superagent"); + return this; + }; + + // This throws, because it can't send/receive data as expected + Request.prototype.pipe = Request.prototype.write = function(){ + throw Error("Streaming is not supported in browser version of superagent"); + }; + /** * Invoke callback with timeout error. * @@ -7399,6 +7424,19 @@ } }; + /** + * Check if `obj` is a host object, + * we don't want to serialize these :) + * + * @param {Object} obj + * @return {Boolean} + * @api private + */ + Request.prototype._isHost = function _isHost(obj) { + // Native objects stringify to [object File], [object Blob], [object FormData], etc. + return obj && 'object' === typeof obj && !Array.isArray(obj) && Object.prototype.toString.call(obj) !== '[object Object]'; + } + /** * Initiate request, invoking callback `fn(res)` * with an instanceof `Response`. @@ -7816,6 +7854,37 @@ */ var isObject = __webpack_require__(43); + /** + * Expose `RequestBase`. + */ + + module.exports = RequestBase; + + /** + * Initialize a new `RequestBase`. + * + * @api public + */ + + function RequestBase(obj) { + if (obj) return mixin(obj); + } + + /** + * Mixin the prototype properties. + * + * @param {Object} obj + * @return {Object} + * @api private + */ + + function mixin(obj) { + for (var key in RequestBase.prototype) { + obj[key] = RequestBase.prototype[key]; + } + return obj; + } + /** * Clear previous timeout. * @@ -7823,7 +7892,7 @@ * @api public */ - exports.clearTimeout = function _clearTimeout(){ + RequestBase.prototype.clearTimeout = function _clearTimeout(){ this._timeout = 0; clearTimeout(this._timer); return this; @@ -7838,7 +7907,7 @@ * @api public */ - exports.parse = function parse(fn){ + RequestBase.prototype.parse = function parse(fn){ this._parser = fn; return this; }; @@ -7852,7 +7921,7 @@ * @api public */ - exports.serialize = function serialize(fn){ + RequestBase.prototype.serialize = function serialize(fn){ this._serializer = fn; return this; }; @@ -7865,7 +7934,7 @@ * @api public */ - exports.timeout = function timeout(ms){ + RequestBase.prototype.timeout = function timeout(ms){ this._timeout = ms; return this; }; @@ -7878,7 +7947,7 @@ * @return {Request} */ - exports.then = function then(resolve, reject) { + RequestBase.prototype.then = function then(resolve, reject) { if (!this._fullfilledPromise) { var self = this; this._fullfilledPromise = new Promise(function(innerResolve, innerReject){ @@ -7890,7 +7959,7 @@ return this._fullfilledPromise.then(resolve, reject); } - exports.catch = function(cb) { + RequestBase.prototype.catch = function(cb) { return this.then(undefined, cb); }; @@ -7898,7 +7967,7 @@ * Allow for extension */ - exports.use = function use(fn) { + RequestBase.prototype.use = function use(fn) { fn(this); return this; } @@ -7913,7 +7982,7 @@ * @api public */ - exports.get = function(field){ + RequestBase.prototype.get = function(field){ return this._header[field.toLowerCase()]; }; @@ -7929,7 +7998,7 @@ * @deprecated */ - exports.getHeader = exports.get; + RequestBase.prototype.getHeader = RequestBase.prototype.get; /** * Set header `field` to `val`, or multiple fields with one object. @@ -7952,7 +8021,7 @@ * @api public */ - exports.set = function(field, val){ + RequestBase.prototype.set = function(field, val){ if (isObject(field)) { for (var key in field) { this.set(key, field[key]); @@ -7976,7 +8045,7 @@ * * @param {String} field */ - exports.unset = function(field){ + RequestBase.prototype.unset = function(field){ delete this._header[field.toLowerCase()]; delete this.header[field]; return this; @@ -8001,7 +8070,7 @@ * @return {Request} for chaining * @api public */ - exports.field = function(name, val) { + RequestBase.prototype.field = function(name, val) { // name should be either a string or an object. if (null === name || undefined === name) { @@ -8029,7 +8098,7 @@ * @return {Request} * @api public */ - exports.abort = function(){ + RequestBase.prototype.abort = function(){ if (this._aborted) { return this; } @@ -8052,7 +8121,7 @@ * @api public */ - exports.withCredentials = function(){ + RequestBase.prototype.withCredentials = function(){ // This is browser-only functionality. Node side is no-op. this._withCredentials = true; return this; @@ -8066,7 +8135,7 @@ * @api public */ - exports.redirects = function(n){ + RequestBase.prototype.redirects = function(n){ this._maxRedirects = n; return this; }; @@ -8080,7 +8149,7 @@ * @api public */ - exports.toJSON = function(){ + RequestBase.prototype.toJSON = function(){ return { method: this.method, url: this.url, @@ -8089,29 +8158,6 @@ }; }; - /** - * Check if `obj` is a host object, - * we don't want to serialize these :) - * - * TODO: future proof, move to compoent land - * - * @param {Object} obj - * @return {Boolean} - * @api private - */ - - exports._isHost = function _isHost(obj) { - var str = {}.toString.call(obj); - - switch (str) { - case '[object File]': - case '[object Blob]': - case '[object FormData]': - return true; - default: - return false; - } - } /** * Send `data` as the request body, defaulting the `.type()` to "json" when @@ -8153,12 +8199,22 @@ * @api public */ - exports.send = function(data){ - var obj = isObject(data); + RequestBase.prototype.send = function(data){ + var isObj = isObject(data); var type = this._header['content-type']; + if (isObj && !this._data) { + if (Array.isArray(data)) { + this._data = []; + } else if (!this._isHost(data)) { + this._data = {}; + } + } else if (data && this._data && this._isHost(this._data)) { + throw Error("Can't merge these send calls"); + } + // merge - if (obj && isObject(this._data)) { + if (isObj && isObject(this._data)) { for (var key in data) { this._data[key] = data[key]; } @@ -8177,7 +8233,7 @@ this._data = data; } - if (!obj || this._isHost(data)) return this; + if (!isObj || this._isHost(data)) return this; // default to json if (!type) this.type('json'); diff --git a/discord.indev.min.js b/discord.indev.min.js index 27b351cd..ecec6905 100644 --- a/discord.indev.min.js +++ b/discord.indev.min.js @@ -1,4 +1,4 @@ -!function(e){function t(n){if(i[n])return i[n].exports;var r=i[n]={exports:{},id:n,loaded:!1};return e[n].call(r.exports,r,r.exports,t),r.loaded=!0,r.exports}var i={};return t.m=e,t.c=i,t.p="",t(0)}([function(e,t,i){e.exports={Client:i(1),WebhookClient:i(248),Shard:i(249),ShardClientUtil:i(245),ShardingManager:i(250),Collection:i(10),splitMessage:i(11),escapeMarkdown:i(19),fetchRecommendedShards:i(251),Channel:i(50),ClientOAuth2Application:i(34),ClientUser:i(208),DMChannel:i(49),Emoji:i(21),EvaluatedPermissions:i(27),Game:i(24).Game,GroupDMChannel:i(55),Guild:i(47),GuildChannel:i(52),GuildMember:i(25),Invite:i(28),Message:i(16),MessageAttachment:i(17),MessageCollector:i(23),MessageEmbed:i(18),MessageReaction:i(20),OAuth2Application:i(35),PartialGuild:i(29),PartialGuildChannel:i(30),PermissionOverwrites:i(53),Presence:i(24).Presence,ReactionEmoji:i(22),Role:i(26),TextChannel:i(51),User:i(13),VoiceChannel:i(54),Webhook:i(31),version:i(6).version},"undefined"!=typeof window&&(window.Discord=e.exports)},function(module,exports,__webpack_require__){(function(process){const EventEmitter=__webpack_require__(3).EventEmitter,mergeDefault=__webpack_require__(4),Constants=__webpack_require__(5),RESTManager=__webpack_require__(7),ClientDataManager=__webpack_require__(45),ClientManager=__webpack_require__(56),ClientDataResolver=__webpack_require__(57),ClientVoiceManager=__webpack_require__(64),WebSocketManager=__webpack_require__(176),ActionsManager=__webpack_require__(216),Collection=__webpack_require__(10),Presence=__webpack_require__(24).Presence,ShardClientUtil=__webpack_require__(245);class Client extends EventEmitter{constructor(e={}){super(),this.browser="undefined"!=typeof window,!e.shardId&&"SHARD_ID"in process.env&&(e.shardId=Number(process.env.SHARD_ID)),!e.shardCount&&"SHARD_COUNT"in process.env&&(e.shardCount=Number(process.env.SHARD_COUNT)),this.options=mergeDefault(Constants.DefaultOptions,e),this._validateOptions(),this.rest=new RESTManager(this),this.dataManager=new ClientDataManager(this),this.manager=new ClientManager(this),this.ws=new WebSocketManager(this),this.resolver=new ClientDataResolver(this),this.actions=new ActionsManager(this),this.voice=new ClientVoiceManager(this),this.shard=process.send?ShardClientUtil.singleton(this):null,this.users=new Collection,this.guilds=new Collection,this.channels=new Collection,this.presences=new Collection,!this.token&&"CLIENT_TOKEN"in process.env?this.token=process.env.CLIENT_TOKEN:this.token=null,this.email=null,this.password=null,this.user=null,this.readyAt=null,this._timeouts=new Set,this._intervals=new Set,this.options.messageSweepInterval>0&&this.setInterval(this.sweepMessages.bind(this),1e3*this.options.messageSweepInterval)}get status(){return this.ws.status}get uptime(){return this.readyAt?Date.now()-this.readyAt:null}get voiceConnections(){return this.voice.connections}get emojis(){const e=new Collection;for(const t of this.guilds.values())for(const i of t.emojis.values())e.set(i.id,i);return e}get readyTimestamp(){return this.readyAt?this.readyAt.getTime():null}login(e,t=null){return t?this.rest.methods.loginEmailPassword(e,t):this.rest.methods.loginToken(e)}destroy(){for(const e of this._timeouts)clearTimeout(e);for(const t of this._intervals)clearInterval(t);return this._timeouts.clear(),this._intervals.clear(),this.token=null,this.email=null,this.password=null,this.manager.destroy()}syncGuilds(e=this.guilds){this.user.bot||this.ws.send({op:12,d:e instanceof Collection?e.keyArray():e.map(e=>e.id)})}fetchUser(e){return this.users.has(e)?Promise.resolve(this.users.get(e)):this.rest.methods.getUser(e)}fetchInvite(e){const t=this.resolver.resolveInviteCode(e);return this.rest.methods.getInvite(t)}fetchWebhook(e,t){return this.rest.methods.getWebhook(e,t)}sweepMessages(e=this.options.messageCacheLifetime){if("number"!=typeof e||isNaN(e))throw new TypeError("The lifetime must be a number.");if(e<=0)return this.emit("debug","Didn't sweep messages - lifetime is unlimited"),-1;const t=1e3*e,i=Date.now();let n=0,r=0;for(const s of this.channels.values())if(s.messages){n++;for(const e of s.messages.values())i-(e.editedTimestamp||e.createdTimestamp)>t&&(s.messages.delete(e.id),r++)}return this.emit("debug",`Swept ${r} messages older than ${e} seconds in ${n} text-based channels`),r}fetchApplication(){if(!this.user.bot)throw new Error(Constants.Errors.NO_BOT_ACCOUNT);return this.rest.methods.getMyApplication()}setTimeout(e,t,...i){const n=setTimeout(()=>{e(),this._timeouts.delete(n)},t,...i);return this._timeouts.add(n),n}clearTimeout(e){clearTimeout(e),this._timeouts.delete(e)}setInterval(e,t,...i){const n=setInterval(e,t,...i);return this._intervals.add(n),n}clearInterval(e){clearInterval(e),this._intervals.delete(e)}_setPresence(e,t){return this.presences.get(e)?void this.presences.get(e).update(t):void this.presences.set(e,new Presence(t))}_eval(script){return eval(script)}_validateOptions(e=this.options){if("number"!=typeof e.shardCount||isNaN(e.shardCount))throw new TypeError("The shardCount option must be a number.");if("number"!=typeof e.shardId||isNaN(e.shardId))throw new TypeError("The shardId option must be a number.");if(e.shardCount<0)throw new RangeError("The shardCount option must be at least 0.");if(e.shardId<0)throw new RangeError("The shardId option must be at least 0.");if(0!==e.shardId&&e.shardId>=e.shardCount)throw new RangeError("The shardId option must be less than shardCount.");if("number"!=typeof e.messageCacheMaxSize||isNaN(e.messageCacheMaxSize))throw new TypeError("The messageCacheMaxSize option must be a number.");if("number"!=typeof e.messageCacheLifetime||isNaN(e.messageCacheLifetime))throw new TypeError("The messageCacheLifetime option must be a number.");if("number"!=typeof e.messageSweepInterval||isNaN(e.messageSweepInterval))throw new TypeError("The messageSweepInterval option must be a number.");if("boolean"!=typeof e.fetchAllMembers)throw new TypeError("The fetchAllMembers option must be a boolean.");if("boolean"!=typeof e.disableEveryone)throw new TypeError("The disableEveryone option must be a boolean.");if("number"!=typeof e.restWsBridgeTimeout||isNaN(e.restWsBridgeTimeout))throw new TypeError("The restWsBridgeTimeout option must be a number.");if(!(e.disabledEvents instanceof Array))throw new TypeError("The disabledEvents option must be an Array.")}}module.exports=Client}).call(exports,__webpack_require__(2))},function(e,t){function i(){throw new Error("setTimeout has not been defined")}function n(){throw new Error("clearTimeout has not been defined")}function r(e){if(h===setTimeout)return setTimeout(e,0);if((h===i||!h)&&setTimeout)return h=setTimeout,setTimeout(e,0);try{return h(e,0)}catch(t){try{return h.call(null,e,0)}catch(t){return h.call(this,e,0)}}}function s(e){if(u===clearTimeout)return clearTimeout(e);if((u===n||!u)&&clearTimeout)return u=clearTimeout,clearTimeout(e);try{return u(e)}catch(t){try{return u.call(null,e)}catch(t){return u.call(this,e)}}}function o(){b&&d&&(b=!1,d.length?p=d.concat(p):w=-1,p.length&&a())}function a(){if(!b){var e=r(o);b=!0;for(var t=p.length;t;){for(d=p,p=[];++w1)for(var i=1;i0&&this._events[e].length>r&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace())),this},i.prototype.on=i.prototype.addListener,i.prototype.once=function(e,t){function i(){this.removeListener(e,i),r||(r=!0,t.apply(this,arguments))}if(!n(t))throw TypeError("listener must be a function");var r=!1;return i.listener=t,this.on(e,i),this},i.prototype.removeListener=function(e,t){var i,r,o,a;if(!n(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(i=this._events[e],o=i.length,r=-1,i===t||n(i.listener)&&i.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(s(i)){for(a=o;a-- >0;)if(i[a]===t||i[a].listener&&i[a].listener===t){r=a;break}if(r<0)return this;1===i.length?(i.length=0,delete this._events[e]):i.splice(r,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},i.prototype.removeAllListeners=function(e){var t,i;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(i=this._events[e],n(i))this.removeListener(e,i);else if(i)for(;i.length;)this.removeListener(e,i[i.length-1]);return delete this._events[e],this},i.prototype.listeners=function(e){var t;return t=this._events&&this._events[e]?n(this._events[e])?[this._events[e]]:this._events[e].slice():[]},i.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(n(t))return 1;if(t)return t.length}return 0},i.listenerCount=function(e,t){return e.listenerCount(t)}},function(e,t){e.exports=function e(t,i){if(!i)return t;for(const n in t)({}).hasOwnProperty.call(i,n)?i[n]===Object(i[n])&&(i[n]=e(t[n],i[n])):i[n]=t[n];return i}},function(e,t,i){(function(e){t.Package=i(6),t.DefaultOptions={apiRequestMethod:"sequential",shardId:0,shardCount:0,messageCacheMaxSize:200,messageCacheLifetime:0,messageSweepInterval:0,fetchAllMembers:!1,disableEveryone:!1,sync:!1,restWsBridgeTimeout:5e3,disabledEvents:[],ws:{large_threshold:250,compress:"undefined"==typeof window,properties:{$os:e?e.platform:"discord.js",$browser:"discord.js",$device:"discord.js",$referrer:"",$referring_domain:""}}},t.Errors={NO_TOKEN:"Request to use token, but token was unavailable to the client.",NO_BOT_ACCOUNT:"Only bot accounts are able to make use of this feature.",NO_USER_ACCOUNT:"Only user accounts are able to make use of this feature.",BAD_WS_MESSAGE:"A bad message was received from the websocket; either bad compression, or not JSON.",TOOK_TOO_LONG:"Something took too long to do.",NOT_A_PERMISSION:"Invalid permission string or number.",INVALID_RATE_LIMIT_METHOD:"Unknown rate limiting method.",BAD_LOGIN:"Incorrect login details were provided.",INVALID_SHARD:"Invalid shard settings were provided."};const n=t.PROTOCOL_VERSION=6,r=t.API=`https://discordapp.com/api/v${n}`,s=t.Endpoints={login:`${r}/auth/login`,logout:`${r}/auth/logout`,gateway:`${r}/gateway`,botGateway:`${r}/gateway/bot`,invite:e=>`${r}/invite/${e}`,inviteLink:e=>`https://discord.gg/${e}`,CDN:"https://cdn.discordapp.com",user:e=>`${r}/users/${e}`,userChannels:e=>`${s.user(e)}/channels`,userProfile:e=>`${s.user(e)}/profile`,avatar:(e,t)=>"1"===e?t:`${s.user(e)}/avatars/${t}.jpg`,me:`${r}/users/@me`,meGuild:e=>`${s.me}/guilds/${e}`,relationships:e=>`${s.user(e)}/relationships`,note:e=>`${s.me}/notes/${e}`,guilds:`${r}/guilds`,guild:e=>`${s.guilds}/${e}`,guildIcon:(e,t)=>`${s.guild(e)}/icons/${t}.jpg`,guildPrune:e=>`${s.guild(e)}/prune`,guildEmbed:e=>`${s.guild(e)}/embed`,guildInvites:e=>`${s.guild(e)}/invites`,guildRoles:e=>`${s.guild(e)}/roles`,guildRole:(e,t)=>`${s.guildRoles(e)}/${t}`,guildBans:e=>`${s.guild(e)}/bans`,guildIntegrations:e=>`${s.guild(e)}/integrations`,guildMembers:e=>`${s.guild(e)}/members`,guildMember:(e,t)=>`${s.guildMembers(e)}/${t}`,stupidInconsistentGuildEndpoint:e=>`${s.guildMember(e,"@me")}/nick`,guildChannels:e=>`${s.guild(e)}/channels`,guildEmojis:e=>`${s.guild(e)}/emojis`,channels:`${r}/channels`,channel:e=>`${s.channels}/${e}`,channelMessages:e=>`${s.channel(e)}/messages`,channelInvites:e=>`${s.channel(e)}/invites`,channelTyping:e=>`${s.channel(e)}/typing`,channelPermissions:e=>`${s.channel(e)}/permissions`,channelMessage:(e,t)=>`${s.channelMessages(e)}/${t}`,channelWebhooks:e=>`${s.channel(e)}/webhooks`,messageReactions:(e,t)=>`${s.channelMessage(e,t)}/reactions`,messageReaction:(e,t,i,n)=>`${s.messageReactions(e,t)}/${i}`+`${n?`?limit=${n}`:""}`,selfMessageReaction:(e,t,i,n)=>`${s.messageReaction(e,t,i,n)}/@me`,userMessageReaction:(e,t,i,n,r)=>`${s.messageReaction(e,t,i,n)}/${r}`,webhook:(e,t)=>`${r}/webhooks/${e}${t?`/${t}`:""}`,myApplication:`${r}/oauth2/applications/@me`,getApp:e=>`${r}/oauth2/authorize?client_id=${e}`};t.Status={READY:0,CONNECTING:1,RECONNECTING:2,IDLE:3,NEARLY:4},t.ChannelTypes={text:0,DM:1,voice:2,groupDM:3},t.OPCodes={DISPATCH:0,HEARTBEAT:1,IDENTIFY:2,STATUS_UPDATE:3,VOICE_STATE_UPDATE:4,VOICE_GUILD_PING:5,RESUME:6,RECONNECT:7,REQUEST_GUILD_MEMBERS:8,INVALID_SESSION:9,HELLO:10,HEARTBEAT_ACK:11},t.VoiceOPCodes={IDENTIFY:0,SELECT_PROTOCOL:1,READY:2,HEARTBEAT:3,SESSION_DESCRIPTION:4,SPEAKING:5},t.Events={READY:"ready",GUILD_CREATE:"guildCreate",GUILD_DELETE:"guildDelete",GUILD_UPDATE:"guildUpdate",GUILD_UNAVAILABLE:"guildUnavailable",GUILD_AVAILABLE:"guildAvailable",GUILD_MEMBER_ADD:"guildMemberAdd",GUILD_MEMBER_REMOVE:"guildMemberRemove",GUILD_MEMBER_UPDATE:"guildMemberUpdate",GUILD_MEMBER_AVAILABLE:"guildMemberAvailable",GUILD_MEMBER_SPEAKING:"guildMemberSpeaking",GUILD_MEMBERS_CHUNK:"guildMembersChunk",GUILD_ROLE_CREATE:"roleCreate",GUILD_ROLE_DELETE:"roleDelete",GUILD_ROLE_UPDATE:"roleUpdate",GUILD_EMOJI_CREATE:"guildEmojiCreate",GUILD_EMOJI_DELETE:"guildEmojiDelete",GUILD_EMOJI_UPDATE:"guildEmojiUpdate",GUILD_BAN_ADD:"guildBanAdd",GUILD_BAN_REMOVE:"guildBanRemove",CHANNEL_CREATE:"channelCreate",CHANNEL_DELETE:"channelDelete",CHANNEL_UPDATE:"channelUpdate",CHANNEL_PINS_UPDATE:"channelPinsUpdate",MESSAGE_CREATE:"message",MESSAGE_DELETE:"messageDelete",MESSAGE_UPDATE:"messageUpdate",MESSAGE_BULK_DELETE:"messageDeleteBulk",MESSAGE_REACTION_ADD:"messageReactionAdd",MESSAGE_REACTION_REMOVE:"messageReactionRemove",MESSAGE_REACTION_REMOVE_ALL:"messageReactionRemoveAll",USER_UPDATE:"userUpdate",USER_NOTE_UPDATE:"userNoteUpdate",PRESENCE_UPDATE:"presenceUpdate",VOICE_STATE_UPDATE:"voiceStateUpdate",TYPING_START:"typingStart",TYPING_STOP:"typingStop",DISCONNECT:"disconnect",RECONNECTING:"reconnecting",ERROR:"error",WARN:"warn",DEBUG:"debug"},t.WSEvents={READY:"READY",GUILD_SYNC:"GUILD_SYNC",GUILD_CREATE:"GUILD_CREATE",GUILD_DELETE:"GUILD_DELETE",GUILD_UPDATE:"GUILD_UPDATE",GUILD_MEMBER_ADD:"GUILD_MEMBER_ADD",GUILD_MEMBER_REMOVE:"GUILD_MEMBER_REMOVE",GUILD_MEMBER_UPDATE:"GUILD_MEMBER_UPDATE",GUILD_MEMBERS_CHUNK:"GUILD_MEMBERS_CHUNK",GUILD_ROLE_CREATE:"GUILD_ROLE_CREATE",GUILD_ROLE_DELETE:"GUILD_ROLE_DELETE",GUILD_ROLE_UPDATE:"GUILD_ROLE_UPDATE",GUILD_BAN_ADD:"GUILD_BAN_ADD",GUILD_BAN_REMOVE:"GUILD_BAN_REMOVE",CHANNEL_CREATE:"CHANNEL_CREATE",CHANNEL_DELETE:"CHANNEL_DELETE",CHANNEL_UPDATE:"CHANNEL_UPDATE",CHANNEL_PINS_UPDATE:"CHANNEL_PINS_UPDATE",MESSAGE_CREATE:"MESSAGE_CREATE",MESSAGE_DELETE:"MESSAGE_DELETE",MESSAGE_UPDATE:"MESSAGE_UPDATE",MESSAGE_DELETE_BULK:"MESSAGE_DELETE_BULK",MESSAGE_REACTION_ADD:"MESSAGE_REACTION_ADD",MESSAGE_REACTION_REMOVE:"MESSAGE_REACTION_REMOVE",MESSAGE_REACTION_REMOVE_ALL:"MESSAGE_REACTION_REMOVE_ALL",USER_UPDATE:"USER_UPDATE",USER_NOTE_UPDATE:"USER_NOTE_UPDATE",PRESENCE_UPDATE:"PRESENCE_UPDATE",VOICE_STATE_UPDATE:"VOICE_STATE_UPDATE",TYPING_START:"TYPING_START",FRIEND_ADD:"RELATIONSHIP_ADD",FRIEND_REMOVE:"RELATIONSHIP_REMOVE",VOICE_SERVER_UPDATE:"VOICE_SERVER_UPDATE",RELATIONSHIP_ADD:"RELATIONSHIP_ADD",RELATIONSHIP_REMOVE:"RELATIONSHIP_REMOVE"},t.MessageTypes={0:"DEFAULT",1:"RECIPIENT_ADD",2:"RECIPIENT_REMOVE",3:"CALL",4:"CHANNEL_NAME_CHANGE",5:"CHANNEL_ICON_CHANGE",6:"PINS_ADD"};const o=t.PermissionFlags={CREATE_INSTANT_INVITE:1,KICK_MEMBERS:2,BAN_MEMBERS:4,ADMINISTRATOR:8,MANAGE_CHANNELS:16,MANAGE_GUILD:32,ADD_REACTIONS:64,READ_MESSAGES:1024,SEND_MESSAGES:2048,SEND_TTS_MESSAGES:4096,MANAGE_MESSAGES:8192,EMBED_LINKS:16384,ATTACH_FILES:32768,READ_MESSAGE_HISTORY:65536,MENTION_EVERYONE:1<<17,EXTERNAL_EMOJIS:1<<18,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_OR_PERMISSIONS:1<<28,MANAGE_WEBHOOKS:1<<29,MANAGE_EMOJIS:1<<30};let a=0;for(const l in o)a|=o[l];t.ALL_PERMISSIONS=a,t.DEFAULT_PERMISSIONS=104324097}).call(t,i(2))},function(e,t){e.exports={name:"discord.js",version:"10.0.1",description:"A powerful library for interacting with the Discord API",main:"./src/index",scripts:{test:"eslint src && node docs/generator test",docs:"node docs/generator","test-docs":"node docs/generator test",lint:"eslint src","web-dist":"npm install && ./node_modules/parallel-webpack/bin/run.js"},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",dependencies:{superagent:"^2.3.0",tweetnacl:"^0.14.3",ws:"^1.1.1"},peerDependencies:{"node-opus":"^0.2.0",opusscript:"^0.0.1"},devDependencies:{bufferutil:"^1.2.1",eslint:"^3.10.0","jsdoc-to-markdown":"^2.0.0","json-loader":"^0.5.4","parallel-webpack":"^1.5.0","uglify-js":"github:mishoo/UglifyJS2#harmony","utf-8-validate":"^1.2.1",webpack:"^1.13.3",zlibjs:"github:imaya/zlib.js"},engines:{node:">=6.0.0"}}},function(e,t,i){const n=i(8),r=i(9),s=i(36),o=i(38),a=i(39),l=i(5);class f{constructor(e){this.client=e,this.handlers={},this.userAgentManager=new n(this),this.methods=new r(this),this.rateLimitedEndpoints={},this.globallyRateLimited=!1}push(e,t){return new Promise((i,n)=>{e.push({request:t,resolve:i,reject:n})})}getRequestHandler(){switch(this.client.options.apiRequestMethod){case"sequential":return s;case"burst":return o;default:throw new Error(l.Errors.INVALID_RATE_LIMIT_METHOD)}}makeRequest(e,t,i,n,r){const s=new a(this,e,t,i,n,r);if(!this.handlers[s.route]){const e=this.getRequestHandler();this.handlers[s.route]=new e(this,s.route)}return this.push(this.handlers[s.route],s)}}e.exports=f},function(e,t,i){const n=i(5);class r{constructor(e){this.restManager=e,this._userAgent={url:"https://github.com/hydrabolt/discord.js",version:n.Package.version}}set(e){this._userAgent.url=e.url||"https://github.com/hydrabolt/discord.js",this._userAgent.version=e.version||n.Package.version}get userAgent(){return`DiscordBot (${this._userAgent.url}, ${this._userAgent.version})`}}e.exports=r},function(e,t,i){const n=i(5),r=i(10),s=i(11),o=i(12),a=i(13),l=i(25),f=i(26),h=i(28),u=i(31),c=i(32),d=i(34);class p{constructor(e){this.rest=e}loginToken(e=this.rest.client.token){return new Promise((t,i)=>{e=e.replace(/^Bot\s*/i,""),this.rest.client.manager.connectToWebSocket(e,t,i)})}loginEmailPassword(e,t){return this.rest.client.emit("warn","Client launched using email and password - should use token instead"),this.rest.client.email=e,this.rest.client.password=t,this.rest.makeRequest("post",n.Endpoints.login,!1,{email:e,password:t}).then(e=>this.loginToken(e.token))}logout(){return this.rest.makeRequest("post",n.Endpoints.logout,!0,{})}getGateway(){return this.rest.makeRequest("get",n.Endpoints.gateway,!0).then(e=>{return this.rest.client.ws.gateway=`${e.url}/?encoding=json&v=${n.PROTOCOL_VERSION}`,this.rest.client.ws.gateway})}getBotGateway(){return this.rest.makeRequest("get",n.Endpoints.botGateway,!0)}sendMessage(e,t,{tts,nonce,embed,disableEveryone,split}={},i=null){return new Promise((n,r)=>{"undefined"!=typeof t&&(t=this.rest.client.resolver.resolveString(t)),t&&((disableEveryone||"undefined"==typeof disableEveryone&&this.rest.client.options.disableEveryone)&&(t=t.replace(/@(everyone|here)/g,"@​$1")),split&&(t=s(t,"object"==typeof split?split:{}))),e instanceof a||e instanceof l?this.createDM(e).then(e=>{this._sendMessageRequest(e,t,i,tts,nonce,embed,n,r)},r):this._sendMessageRequest(e,t,i,tts,nonce,embed,n,r)})}_sendMessageRequest(e,t,i,r,s,o,a,l){if(t instanceof Array){const f=[];let h=this.rest.makeRequest("post",n.Endpoints.channelMessages(e.id),!0,{content:t[0],tts:r,nonce:s},i).catch(l);for(let u=1;u<=t.length;u++)if(u{return f.push(l),this.rest.makeRequest("post",n.Endpoints.channelMessages(e.id),!0,{content:t[a],tts:r,nonce:s,embed:o},i)},l)}else h.then(e=>{f.push(e),a(this.rest.client.actions.MessageCreate.handle(f).messages)},l)}else this.rest.makeRequest("post",n.Endpoints.channelMessages(e.id),!0,{content:t,tts:r,nonce:s,embed:o},i).then(e=>a(this.rest.client.actions.MessageCreate.handle(e).message),l)}deleteMessage(e){return this.rest.makeRequest("del",n.Endpoints.channelMessage(e.channel.id,e.id),!0).then(()=>this.rest.client.actions.MessageDelete.handle({id:e.id,channel_id:e.channel.id}).message)}bulkDeleteMessages(e,t){return this.rest.makeRequest("post",`${n.Endpoints.channelMessages(e.id)}/bulk_delete`,!0,{messages:t}).then(()=>this.rest.client.actions.MessageDeleteBulk.handle({channel_id:e.id,ids:t}).messages)}updateMessage(e,t,{embed}={}){return t=this.rest.client.resolver.resolveString(t),this.rest.makeRequest("patch",n.Endpoints.channelMessage(e.channel.id,e.id),!0,{content:t,embed:embed}).then(e=>this.rest.client.actions.MessageUpdate.handle(e).updated)}createChannel(e,t,i){return this.rest.makeRequest("post",n.Endpoints.guildChannels(e.id),!0,{name:t,type:i}).then(e=>this.rest.client.actions.ChannelCreate.handle(e).channel)}createDM(e){const t=this.getExistingDM(e);return t?Promise.resolve(t):this.rest.makeRequest("post",n.Endpoints.userChannels(this.rest.client.user.id),!0,{recipient_id:e.id}).then(e=>this.rest.client.actions.ChannelCreate.handle(e).channel)}getExistingDM(e){return this.rest.client.channels.find(t=>t.recipient&&t.recipient.id===e.id)}deleteChannel(e){return(e instanceof a||e instanceof l)&&(e=this.getExistingDM(e)),e?this.rest.makeRequest("del",n.Endpoints.channel(e.id),!0).then(t=>{return t.id=e.id,this.rest.client.actions.ChannelDelete.handle(t).channel}):Promise.reject(new Error("No channel to delete."))}updateChannel(e,t){const i={};return i.name=(t.name||e.name).trim(),i.topic=t.topic||e.topic,i.position=t.position||e.position,i.bitrate=t.bitrate||e.bitrate,i.user_limit=t.userLimit||e.userLimit,this.rest.makeRequest("patch",n.Endpoints.channel(e.id),!0,i).then(e=>this.rest.client.actions.ChannelUpdate.handle(e).updated)}leaveGuild(e){return e.ownerID===this.rest.client.user.id?Promise.reject(new Error("Guild is owned by the client.")):this.rest.makeRequest("del",n.Endpoints.meGuild(e.id),!0).then(()=>this.rest.client.actions.GuildDelete.handle({id:e.id}).guild)}createGuild(e){return e.icon=this.rest.client.resolver.resolveBase64(e.icon)||null,e.region=e.region||"us-central",new Promise((t,i)=>{this.rest.makeRequest("post",n.Endpoints.guilds,!0,e).then(e=>{if(this.rest.client.guilds.has(e.id))return void t(this.rest.client.guilds.get(e.id));const n=i=>{i.id===e.id&&(this.rest.client.removeListener("guildCreate",n),this.rest.client.clearTimeout(r),t(i))};this.rest.client.on("guildCreate",n);const r=this.rest.client.setTimeout(()=>{this.rest.client.removeListener("guildCreate",n),i(new Error("Took too long to receive guild data."))},1e4)},i)})}deleteGuild(e){return this.rest.makeRequest("del",n.Endpoints.guild(e.id),!0).then(()=>this.rest.client.actions.GuildDelete.handle({id:e.id}).guild)}getUser(e){return this.rest.makeRequest("get",n.Endpoints.user(e),!0).then(e=>this.rest.client.actions.UserGet.handle(e).user)}updateCurrentUser(e){const t=this.rest.client.user,i={};return i.username=e.username||t.username,i.avatar=this.rest.client.resolver.resolveBase64(e.avatar)||t.avatar,t.bot||(i.email=e.email||t.email,i.password=this.rest.client.password,e.new_password&&(i.new_password=e.newPassword)),this.rest.makeRequest("patch",n.Endpoints.me,!0,i).then(e=>this.rest.client.actions.UserUpdate.handle(e).updated)}updateGuild(e,t){const i={};return t.name&&(i.name=t.name),t.region&&(i.region=t.region),t.verificationLevel&&(i.verification_level=Number(t.verificationLevel)),t.afkChannel&&(i.afk_channel_id=this.rest.client.resolver.resolveChannel(t.afkChannel).id),t.afkTimeout&&(i.afk_timeout=Number(t.afkTimeout)),t.icon&&(i.icon=this.rest.client.resolver.resolveBase64(t.icon)),t.owner&&(i.owner_id=this.rest.client.resolver.resolveUser(t.owner).id),t.splash&&(i.splash=this.rest.client.resolver.resolveBase64(t.splash)),this.rest.makeRequest("patch",n.Endpoints.guild(e.id),!0,i).then(e=>this.rest.client.actions.GuildUpdate.handle(e).updated)}kickGuildMember(e,t){return this.rest.makeRequest("del",n.Endpoints.guildMember(e.id,t.id),!0).then(()=>this.rest.client.actions.GuildMemberRemove.handle({guild_id:e.id,user:t.user}).member)}createGuildRole(e){return this.rest.makeRequest("post",n.Endpoints.guildRoles(e.id),!0).then(t=>this.rest.client.actions.GuildRoleCreate.handle({guild_id:e.id,role:t}).role)}deleteGuildRole(e){return this.rest.makeRequest("del",n.Endpoints.guildRole(e.guild.id,e.id),!0).then(()=>this.rest.client.actions.GuildRoleDelete.handle({guild_id:e.guild.id,role_id:e.id}).role)}setChannelOverwrite(e,t){return this.rest.makeRequest("put",`${n.Endpoints.channelPermissions(e.id)}/${t.id}`,!0,t)}deletePermissionOverwrites(e){return this.rest.makeRequest("del",`${n.Endpoints.channelPermissions(e.channel.id)}/${e.id}`,!0).then(()=>e)}getChannelMessages(e,t={}){const i=[];t.limit&&i.push(`limit=${t.limit}`),t.around?i.push(`around=${t.around}`):t.before?i.push(`before=${t.before}`):t.after&&i.push(`after=${t.after}`);let r=n.Endpoints.channelMessages(e.id);return i.length>0&&(r+=`?${i.join("&")}`),this.rest.makeRequest("get",r,!0)}getChannelMessage(e,t){const i=e.messages.get(t);return i?Promise.resolve(i):this.rest.makeRequest("get",n.Endpoints.channelMessage(e.id,t),!0)}getGuildMember(e,t){return this.rest.makeRequest("get",n.Endpoints.guildMember(e.id,t.id),!0).then(t=>this.rest.client.actions.GuildMemberGet.handle(e,t).member)}updateGuildMember(e,t){t.channel&&(t.channel_id=this.rest.client.resolver.resolveChannel(t.channel).id),t.roles&&(t.roles=t.roles.map(e=>e instanceof f?e.id:e));let i=n.Endpoints.guildMember(e.guild.id,e.id);if(e.id===this.rest.client.user.id){const r=Object.keys(t);1===r.length&&"nick"===r[0]&&(i=n.Endpoints.stupidInconsistentGuildEndpoint(e.guild.id))}return this.rest.makeRequest("patch",i,!0,t).then(t=>e.guild._updateMember(e,t).mem)}sendTyping(e){return this.rest.makeRequest("post",`${n.Endpoints.channel(e)}/typing`,!0)}banGuildMember(e,t,i=0){const r=this.rest.client.resolver.resolveUserID(t);return r?this.rest.makeRequest("put",`${n.Endpoints.guildBans(e.id)}/${r}?delete-message-days=${i}`,!0,{"delete-message-days":i}).then(()=>{if(t instanceof l)return t;const i=this.rest.client.resolver.resolveUser(r);return i?(t=this.rest.client.resolver.resolveGuildMember(e,i),t||i):r}):Promise.reject(new Error("Couldn't resolve the user ID to ban."))}unbanGuildMember(e,t){return new Promise((i,r)=>{const s=this.rest.client.resolver.resolveUserID(t);if(!s)throw new Error("Couldn't resolve the user ID to unban.");const o=(t,r)=>{t.id===e.id&&r.id===s&&(this.rest.client.removeListener(n.Events.GUILD_BAN_REMOVE,o),this.rest.client.clearTimeout(a),i(r))};this.rest.client.on(n.Events.GUILD_BAN_REMOVE,o);const a=this.rest.client.setTimeout(()=>{this.rest.client.removeListener(n.Events.GUILD_BAN_REMOVE,o),r(new Error("Took too long to receive the ban remove event."))},1e4);this.rest.makeRequest("del",`${n.Endpoints.guildBans(e.id)}/${s}`,!0).catch(e=>{this.rest.client.removeListener(n.Events.GUILD_BAN_REMOVE,o),this.rest.client.clearTimeout(a),r(e)})})}getGuildBans(e){return this.rest.makeRequest("get",n.Endpoints.guildBans(e.id),!0).then(e=>{const t=new r;for(const i of e){const e=this.rest.client.dataManager.newUser(i.user);t.set(e.id,e)}return t})}updateGuildRole(e,t){const i={};if(i.name=t.name||e.name,i.position="undefined"!=typeof t.position?t.position:e.position,i.color=t.color||e.color,"string"==typeof i.color&&i.color.startsWith("#")&&(i.color=parseInt(i.color.replace("#",""),16)),i.hoist="undefined"!=typeof t.hoist?t.hoist:e.hoist,i.mentionable="undefined"!=typeof t.mentionable?t.mentionable:e.mentionable,t.permissions){let e=0;for(let r of t.permissions)"string"==typeof r&&(r=n.PermissionFlags[r]),e|=r;i.permissions=e}else i.permissions=e.permissions;return this.rest.makeRequest("patch",n.Endpoints.guildRole(e.guild.id,e.id),!0,i).then(t=>this.rest.client.actions.GuildRoleUpdate.handle({role:t,guild_id:e.guild.id}).updated)}pinMessage(e){return this.rest.makeRequest("put",`${n.Endpoints.channel(e.channel.id)}/pins/${e.id}`,!0).then(()=>e)}unpinMessage(e){return this.rest.makeRequest("del",`${n.Endpoints.channel(e.channel.id)}/pins/${e.id}`,!0).then(()=>e)}getChannelPinnedMessages(e){return this.rest.makeRequest("get",`${n.Endpoints.channel(e.id)}/pins`,!0)}createChannelInvite(e,t){const i={};return i.temporary=t.temporary,i.max_age=t.maxAge,i.max_uses=t.maxUses,this.rest.makeRequest("post",`${n.Endpoints.channelInvites(e.id)}`,!0,i).then(e=>new h(this.rest.client,e))}deleteInvite(e){return this.rest.makeRequest("del",n.Endpoints.invite(e.code),!0).then(()=>e)}getInvite(e){return this.rest.makeRequest("get",n.Endpoints.invite(e),!0).then(e=>new h(this.rest.client,e))}getGuildInvites(e){return this.rest.makeRequest("get",n.Endpoints.guildInvites(e.id),!0).then(e=>{const t=new r;for(const i of e){const e=new h(this.rest.client,i);t.set(e.code,e)}return t})}pruneGuildMembers(e,t,i){return this.rest.makeRequest(i?"get":"post",`${n.Endpoints.guildPrune(e.id)}?days=${t}`,!0).then(e=>e.pruned)}createEmoji(e,t,i){return this.rest.makeRequest("post",`${n.Endpoints.guildEmojis(e.id)}`,!0,{name:i,image:t}).then(t=>this.rest.client.actions.EmojiCreate.handle(t,e).emoji); +!function(e){function t(n){if(i[n])return i[n].exports;var r=i[n]={exports:{},id:n,loaded:!1};return e[n].call(r.exports,r,r.exports,t),r.loaded=!0,r.exports}var i={};return t.m=e,t.c=i,t.p="",t(0)}([function(e,t,i){e.exports={Client:i(1),WebhookClient:i(248),Shard:i(249),ShardClientUtil:i(245),ShardingManager:i(250),Collection:i(10),splitMessage:i(11),escapeMarkdown:i(19),fetchRecommendedShards:i(251),Channel:i(50),ClientOAuth2Application:i(34),ClientUser:i(208),DMChannel:i(49),Emoji:i(21),EvaluatedPermissions:i(27),Game:i(24).Game,GroupDMChannel:i(55),Guild:i(47),GuildChannel:i(52),GuildMember:i(25),Invite:i(28),Message:i(16),MessageAttachment:i(17),MessageCollector:i(23),MessageEmbed:i(18),MessageReaction:i(20),OAuth2Application:i(35),PartialGuild:i(29),PartialGuildChannel:i(30),PermissionOverwrites:i(53),Presence:i(24).Presence,ReactionEmoji:i(22),Role:i(26),TextChannel:i(51),User:i(13),VoiceChannel:i(54),Webhook:i(31),version:i(6).version},"undefined"!=typeof window&&(window.Discord=e.exports)},function(module,exports,__webpack_require__){(function(process){const EventEmitter=__webpack_require__(3).EventEmitter,mergeDefault=__webpack_require__(4),Constants=__webpack_require__(5),RESTManager=__webpack_require__(7),ClientDataManager=__webpack_require__(45),ClientManager=__webpack_require__(56),ClientDataResolver=__webpack_require__(57),ClientVoiceManager=__webpack_require__(64),WebSocketManager=__webpack_require__(176),ActionsManager=__webpack_require__(216),Collection=__webpack_require__(10),Presence=__webpack_require__(24).Presence,ShardClientUtil=__webpack_require__(245);class Client extends EventEmitter{constructor(e={}){super(),this.browser="undefined"!=typeof window,!e.shardId&&"SHARD_ID"in process.env&&(e.shardId=Number(process.env.SHARD_ID)),!e.shardCount&&"SHARD_COUNT"in process.env&&(e.shardCount=Number(process.env.SHARD_COUNT)),this.options=mergeDefault(Constants.DefaultOptions,e),this._validateOptions(),this.rest=new RESTManager(this),this.dataManager=new ClientDataManager(this),this.manager=new ClientManager(this),this.ws=new WebSocketManager(this),this.resolver=new ClientDataResolver(this),this.actions=new ActionsManager(this),this.voice=new ClientVoiceManager(this),this.shard=process.send?ShardClientUtil.singleton(this):null,this.users=new Collection,this.guilds=new Collection,this.channels=new Collection,this.presences=new Collection,!this.token&&"CLIENT_TOKEN"in process.env?this.token=process.env.CLIENT_TOKEN:this.token=null,this.email=null,this.password=null,this.user=null,this.readyAt=null,this._timeouts=new Set,this._intervals=new Set,this.options.messageSweepInterval>0&&this.setInterval(this.sweepMessages.bind(this),1e3*this.options.messageSweepInterval)}get status(){return this.ws.status}get uptime(){return this.readyAt?Date.now()-this.readyAt:null}get voiceConnections(){return this.voice.connections}get emojis(){const e=new Collection;for(const t of this.guilds.values())for(const i of t.emojis.values())e.set(i.id,i);return e}get readyTimestamp(){return this.readyAt?this.readyAt.getTime():null}login(e,t=null){return t?this.rest.methods.loginEmailPassword(e,t):this.rest.methods.loginToken(e)}destroy(){for(const e of this._timeouts)clearTimeout(e);for(const t of this._intervals)clearInterval(t);return this._timeouts.clear(),this._intervals.clear(),this.token=null,this.email=null,this.password=null,this.manager.destroy()}syncGuilds(e=this.guilds){this.user.bot||this.ws.send({op:12,d:e instanceof Collection?e.keyArray():e.map(e=>e.id)})}fetchUser(e){return this.users.has(e)?Promise.resolve(this.users.get(e)):this.rest.methods.getUser(e)}fetchInvite(e){const t=this.resolver.resolveInviteCode(e);return this.rest.methods.getInvite(t)}fetchWebhook(e,t){return this.rest.methods.getWebhook(e,t)}sweepMessages(e=this.options.messageCacheLifetime){if("number"!=typeof e||isNaN(e))throw new TypeError("The lifetime must be a number.");if(e<=0)return this.emit("debug","Didn't sweep messages - lifetime is unlimited"),-1;const t=1e3*e,i=Date.now();let n=0,r=0;for(const s of this.channels.values())if(s.messages){n++;for(const e of s.messages.values())i-(e.editedTimestamp||e.createdTimestamp)>t&&(s.messages.delete(e.id),r++)}return this.emit("debug",`Swept ${r} messages older than ${e} seconds in ${n} text-based channels`),r}fetchApplication(){if(!this.user.bot)throw new Error(Constants.Errors.NO_BOT_ACCOUNT);return this.rest.methods.getMyApplication()}setTimeout(e,t,...i){const n=setTimeout(()=>{e(),this._timeouts.delete(n)},t,...i);return this._timeouts.add(n),n}clearTimeout(e){clearTimeout(e),this._timeouts.delete(e)}setInterval(e,t,...i){const n=setInterval(e,t,...i);return this._intervals.add(n),n}clearInterval(e){clearInterval(e),this._intervals.delete(e)}_setPresence(e,t){return this.presences.get(e)?void this.presences.get(e).update(t):void this.presences.set(e,new Presence(t))}_eval(script){return eval(script)}_validateOptions(e=this.options){if("number"!=typeof e.shardCount||isNaN(e.shardCount))throw new TypeError("The shardCount option must be a number.");if("number"!=typeof e.shardId||isNaN(e.shardId))throw new TypeError("The shardId option must be a number.");if(e.shardCount<0)throw new RangeError("The shardCount option must be at least 0.");if(e.shardId<0)throw new RangeError("The shardId option must be at least 0.");if(0!==e.shardId&&e.shardId>=e.shardCount)throw new RangeError("The shardId option must be less than shardCount.");if("number"!=typeof e.messageCacheMaxSize||isNaN(e.messageCacheMaxSize))throw new TypeError("The messageCacheMaxSize option must be a number.");if("number"!=typeof e.messageCacheLifetime||isNaN(e.messageCacheLifetime))throw new TypeError("The messageCacheLifetime option must be a number.");if("number"!=typeof e.messageSweepInterval||isNaN(e.messageSweepInterval))throw new TypeError("The messageSweepInterval option must be a number.");if("boolean"!=typeof e.fetchAllMembers)throw new TypeError("The fetchAllMembers option must be a boolean.");if("boolean"!=typeof e.disableEveryone)throw new TypeError("The disableEveryone option must be a boolean.");if("number"!=typeof e.restWsBridgeTimeout||isNaN(e.restWsBridgeTimeout))throw new TypeError("The restWsBridgeTimeout option must be a number.");if(!(e.disabledEvents instanceof Array))throw new TypeError("The disabledEvents option must be an Array.")}}module.exports=Client}).call(exports,__webpack_require__(2))},function(e,t){function i(){throw new Error("setTimeout has not been defined")}function n(){throw new Error("clearTimeout has not been defined")}function r(e){if(h===setTimeout)return setTimeout(e,0);if((h===i||!h)&&setTimeout)return h=setTimeout,setTimeout(e,0);try{return h(e,0)}catch(t){try{return h.call(null,e,0)}catch(t){return h.call(this,e,0)}}}function s(e){if(u===clearTimeout)return clearTimeout(e);if((u===n||!u)&&clearTimeout)return u=clearTimeout,clearTimeout(e);try{return u(e)}catch(t){try{return u.call(null,e)}catch(t){return u.call(this,e)}}}function o(){b&&d&&(b=!1,d.length?p=d.concat(p):w=-1,p.length&&a())}function a(){if(!b){var e=r(o);b=!0;for(var t=p.length;t;){for(d=p,p=[];++w1)for(var i=1;i0&&this._events[e].length>r&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace())),this},i.prototype.on=i.prototype.addListener,i.prototype.once=function(e,t){function i(){this.removeListener(e,i),r||(r=!0,t.apply(this,arguments))}if(!n(t))throw TypeError("listener must be a function");var r=!1;return i.listener=t,this.on(e,i),this},i.prototype.removeListener=function(e,t){var i,r,o,a;if(!n(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(i=this._events[e],o=i.length,r=-1,i===t||n(i.listener)&&i.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(s(i)){for(a=o;a-- >0;)if(i[a]===t||i[a].listener&&i[a].listener===t){r=a;break}if(r<0)return this;1===i.length?(i.length=0,delete this._events[e]):i.splice(r,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},i.prototype.removeAllListeners=function(e){var t,i;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(i=this._events[e],n(i))this.removeListener(e,i);else if(i)for(;i.length;)this.removeListener(e,i[i.length-1]);return delete this._events[e],this},i.prototype.listeners=function(e){var t;return t=this._events&&this._events[e]?n(this._events[e])?[this._events[e]]:this._events[e].slice():[]},i.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(n(t))return 1;if(t)return t.length}return 0},i.listenerCount=function(e,t){return e.listenerCount(t)}},function(e,t){e.exports=function e(t,i){if(!i)return t;for(const n in t)({}).hasOwnProperty.call(i,n)?i[n]===Object(i[n])&&(i[n]=e(t[n],i[n])):i[n]=t[n];return i}},function(e,t,i){(function(e){t.Package=i(6),t.DefaultOptions={apiRequestMethod:"sequential",shardId:0,shardCount:0,messageCacheMaxSize:200,messageCacheLifetime:0,messageSweepInterval:0,fetchAllMembers:!1,disableEveryone:!1,sync:!1,restWsBridgeTimeout:5e3,disabledEvents:[],ws:{large_threshold:250,compress:"undefined"==typeof window,properties:{$os:e?e.platform:"discord.js",$browser:"discord.js",$device:"discord.js",$referrer:"",$referring_domain:""}}},t.Errors={NO_TOKEN:"Request to use token, but token was unavailable to the client.",NO_BOT_ACCOUNT:"Only bot accounts are able to make use of this feature.",NO_USER_ACCOUNT:"Only user accounts are able to make use of this feature.",BAD_WS_MESSAGE:"A bad message was received from the websocket; either bad compression, or not JSON.",TOOK_TOO_LONG:"Something took too long to do.",NOT_A_PERMISSION:"Invalid permission string or number.",INVALID_RATE_LIMIT_METHOD:"Unknown rate limiting method.",BAD_LOGIN:"Incorrect login details were provided.",INVALID_SHARD:"Invalid shard settings were provided."};const n=t.PROTOCOL_VERSION=6,r=t.API=`https://discordapp.com/api/v${n}`,s=t.Endpoints={login:`${r}/auth/login`,logout:`${r}/auth/logout`,gateway:`${r}/gateway`,botGateway:`${r}/gateway/bot`,invite:e=>`${r}/invite/${e}`,inviteLink:e=>`https://discord.gg/${e}`,CDN:"https://cdn.discordapp.com",user:e=>`${r}/users/${e}`,userChannels:e=>`${s.user(e)}/channels`,userProfile:e=>`${s.user(e)}/profile`,avatar:(e,t)=>"1"===e?t:`${s.user(e)}/avatars/${t}.jpg`,me:`${r}/users/@me`,meGuild:e=>`${s.me}/guilds/${e}`,relationships:e=>`${s.user(e)}/relationships`,note:e=>`${s.me}/notes/${e}`,guilds:`${r}/guilds`,guild:e=>`${s.guilds}/${e}`,guildIcon:(e,t)=>`${s.guild(e)}/icons/${t}.jpg`,guildPrune:e=>`${s.guild(e)}/prune`,guildEmbed:e=>`${s.guild(e)}/embed`,guildInvites:e=>`${s.guild(e)}/invites`,guildRoles:e=>`${s.guild(e)}/roles`,guildRole:(e,t)=>`${s.guildRoles(e)}/${t}`,guildBans:e=>`${s.guild(e)}/bans`,guildIntegrations:e=>`${s.guild(e)}/integrations`,guildMembers:e=>`${s.guild(e)}/members`,guildMember:(e,t)=>`${s.guildMembers(e)}/${t}`,stupidInconsistentGuildEndpoint:e=>`${s.guildMember(e,"@me")}/nick`,guildChannels:e=>`${s.guild(e)}/channels`,guildEmojis:e=>`${s.guild(e)}/emojis`,channels:`${r}/channels`,channel:e=>`${s.channels}/${e}`,channelMessages:e=>`${s.channel(e)}/messages`,channelInvites:e=>`${s.channel(e)}/invites`,channelTyping:e=>`${s.channel(e)}/typing`,channelPermissions:e=>`${s.channel(e)}/permissions`,channelMessage:(e,t)=>`${s.channelMessages(e)}/${t}`,channelWebhooks:e=>`${s.channel(e)}/webhooks`,messageReactions:(e,t)=>`${s.channelMessage(e,t)}/reactions`,messageReaction:(e,t,i,n)=>`${s.messageReactions(e,t)}/${i}`+`${n?`?limit=${n}`:""}`,selfMessageReaction:(e,t,i,n)=>`${s.messageReaction(e,t,i,n)}/@me`,userMessageReaction:(e,t,i,n,r)=>`${s.messageReaction(e,t,i,n)}/${r}`,webhook:(e,t)=>`${r}/webhooks/${e}${t?`/${t}`:""}`,myApplication:`${r}/oauth2/applications/@me`,getApp:e=>`${r}/oauth2/authorize?client_id=${e}`};t.Status={READY:0,CONNECTING:1,RECONNECTING:2,IDLE:3,NEARLY:4},t.ChannelTypes={text:0,DM:1,voice:2,groupDM:3},t.OPCodes={DISPATCH:0,HEARTBEAT:1,IDENTIFY:2,STATUS_UPDATE:3,VOICE_STATE_UPDATE:4,VOICE_GUILD_PING:5,RESUME:6,RECONNECT:7,REQUEST_GUILD_MEMBERS:8,INVALID_SESSION:9,HELLO:10,HEARTBEAT_ACK:11},t.VoiceOPCodes={IDENTIFY:0,SELECT_PROTOCOL:1,READY:2,HEARTBEAT:3,SESSION_DESCRIPTION:4,SPEAKING:5},t.Events={READY:"ready",GUILD_CREATE:"guildCreate",GUILD_DELETE:"guildDelete",GUILD_UPDATE:"guildUpdate",GUILD_UNAVAILABLE:"guildUnavailable",GUILD_AVAILABLE:"guildAvailable",GUILD_MEMBER_ADD:"guildMemberAdd",GUILD_MEMBER_REMOVE:"guildMemberRemove",GUILD_MEMBER_UPDATE:"guildMemberUpdate",GUILD_MEMBER_AVAILABLE:"guildMemberAvailable",GUILD_MEMBER_SPEAKING:"guildMemberSpeaking",GUILD_MEMBERS_CHUNK:"guildMembersChunk",GUILD_ROLE_CREATE:"roleCreate",GUILD_ROLE_DELETE:"roleDelete",GUILD_ROLE_UPDATE:"roleUpdate",GUILD_EMOJI_CREATE:"guildEmojiCreate",GUILD_EMOJI_DELETE:"guildEmojiDelete",GUILD_EMOJI_UPDATE:"guildEmojiUpdate",GUILD_BAN_ADD:"guildBanAdd",GUILD_BAN_REMOVE:"guildBanRemove",CHANNEL_CREATE:"channelCreate",CHANNEL_DELETE:"channelDelete",CHANNEL_UPDATE:"channelUpdate",CHANNEL_PINS_UPDATE:"channelPinsUpdate",MESSAGE_CREATE:"message",MESSAGE_DELETE:"messageDelete",MESSAGE_UPDATE:"messageUpdate",MESSAGE_BULK_DELETE:"messageDeleteBulk",MESSAGE_REACTION_ADD:"messageReactionAdd",MESSAGE_REACTION_REMOVE:"messageReactionRemove",MESSAGE_REACTION_REMOVE_ALL:"messageReactionRemoveAll",USER_UPDATE:"userUpdate",USER_NOTE_UPDATE:"userNoteUpdate",PRESENCE_UPDATE:"presenceUpdate",VOICE_STATE_UPDATE:"voiceStateUpdate",TYPING_START:"typingStart",TYPING_STOP:"typingStop",DISCONNECT:"disconnect",RECONNECTING:"reconnecting",ERROR:"error",WARN:"warn",DEBUG:"debug"},t.WSEvents={READY:"READY",GUILD_SYNC:"GUILD_SYNC",GUILD_CREATE:"GUILD_CREATE",GUILD_DELETE:"GUILD_DELETE",GUILD_UPDATE:"GUILD_UPDATE",GUILD_MEMBER_ADD:"GUILD_MEMBER_ADD",GUILD_MEMBER_REMOVE:"GUILD_MEMBER_REMOVE",GUILD_MEMBER_UPDATE:"GUILD_MEMBER_UPDATE",GUILD_MEMBERS_CHUNK:"GUILD_MEMBERS_CHUNK",GUILD_ROLE_CREATE:"GUILD_ROLE_CREATE",GUILD_ROLE_DELETE:"GUILD_ROLE_DELETE",GUILD_ROLE_UPDATE:"GUILD_ROLE_UPDATE",GUILD_BAN_ADD:"GUILD_BAN_ADD",GUILD_BAN_REMOVE:"GUILD_BAN_REMOVE",CHANNEL_CREATE:"CHANNEL_CREATE",CHANNEL_DELETE:"CHANNEL_DELETE",CHANNEL_UPDATE:"CHANNEL_UPDATE",CHANNEL_PINS_UPDATE:"CHANNEL_PINS_UPDATE",MESSAGE_CREATE:"MESSAGE_CREATE",MESSAGE_DELETE:"MESSAGE_DELETE",MESSAGE_UPDATE:"MESSAGE_UPDATE",MESSAGE_DELETE_BULK:"MESSAGE_DELETE_BULK",MESSAGE_REACTION_ADD:"MESSAGE_REACTION_ADD",MESSAGE_REACTION_REMOVE:"MESSAGE_REACTION_REMOVE",MESSAGE_REACTION_REMOVE_ALL:"MESSAGE_REACTION_REMOVE_ALL",USER_UPDATE:"USER_UPDATE",USER_NOTE_UPDATE:"USER_NOTE_UPDATE",PRESENCE_UPDATE:"PRESENCE_UPDATE",VOICE_STATE_UPDATE:"VOICE_STATE_UPDATE",TYPING_START:"TYPING_START",FRIEND_ADD:"RELATIONSHIP_ADD",FRIEND_REMOVE:"RELATIONSHIP_REMOVE",VOICE_SERVER_UPDATE:"VOICE_SERVER_UPDATE",RELATIONSHIP_ADD:"RELATIONSHIP_ADD",RELATIONSHIP_REMOVE:"RELATIONSHIP_REMOVE"},t.MessageTypes={0:"DEFAULT",1:"RECIPIENT_ADD",2:"RECIPIENT_REMOVE",3:"CALL",4:"CHANNEL_NAME_CHANGE",5:"CHANNEL_ICON_CHANGE",6:"PINS_ADD"};const o=t.PermissionFlags={CREATE_INSTANT_INVITE:1,KICK_MEMBERS:2,BAN_MEMBERS:4,ADMINISTRATOR:8,MANAGE_CHANNELS:16,MANAGE_GUILD:32,ADD_REACTIONS:64,READ_MESSAGES:1024,SEND_MESSAGES:2048,SEND_TTS_MESSAGES:4096,MANAGE_MESSAGES:8192,EMBED_LINKS:16384,ATTACH_FILES:32768,READ_MESSAGE_HISTORY:65536,MENTION_EVERYONE:1<<17,EXTERNAL_EMOJIS:1<<18,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_OR_PERMISSIONS:1<<28,MANAGE_WEBHOOKS:1<<29,MANAGE_EMOJIS:1<<30};let a=0;for(const l in o)a|=o[l];t.ALL_PERMISSIONS=a,t.DEFAULT_PERMISSIONS=104324097}).call(t,i(2))},function(e,t){e.exports={name:"discord.js",version:"10.0.1",description:"A powerful library for interacting with the Discord API",main:"./src/index",scripts:{test:"eslint src && node docs/generator test",docs:"node docs/generator","test-docs":"node docs/generator test",lint:"eslint src","web-dist":"npm install && ./node_modules/parallel-webpack/bin/run.js"},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",dependencies:{superagent:"^3.0.0",tweetnacl:"^0.14.3",ws:"^1.1.1"},peerDependencies:{"node-opus":"^0.2.0",opusscript:"^0.0.1"},devDependencies:{bufferutil:"^1.2.1",eslint:"^3.10.0","jsdoc-to-markdown":"^2.0.0","json-loader":"^0.5.4","parallel-webpack":"^1.5.0","uglify-js":"github:mishoo/UglifyJS2#harmony","utf-8-validate":"^1.2.1",webpack:"^1.13.3",zlibjs:"github:imaya/zlib.js"},engines:{node:">=6.0.0"}}},function(e,t,i){const n=i(8),r=i(9),s=i(36),o=i(38),a=i(39),l=i(5);class f{constructor(e){this.client=e,this.handlers={},this.userAgentManager=new n(this),this.methods=new r(this),this.rateLimitedEndpoints={},this.globallyRateLimited=!1}push(e,t){return new Promise((i,n)=>{e.push({request:t,resolve:i,reject:n})})}getRequestHandler(){switch(this.client.options.apiRequestMethod){case"sequential":return s;case"burst":return o;default:throw new Error(l.Errors.INVALID_RATE_LIMIT_METHOD)}}makeRequest(e,t,i,n,r){const s=new a(this,e,t,i,n,r);if(!this.handlers[s.route]){const e=this.getRequestHandler();this.handlers[s.route]=new e(this,s.route)}return this.push(this.handlers[s.route],s)}}e.exports=f},function(e,t,i){const n=i(5);class r{constructor(e){this.restManager=e,this._userAgent={url:"https://github.com/hydrabolt/discord.js",version:n.Package.version}}set(e){this._userAgent.url=e.url||"https://github.com/hydrabolt/discord.js",this._userAgent.version=e.version||n.Package.version}get userAgent(){return`DiscordBot (${this._userAgent.url}, ${this._userAgent.version})`}}e.exports=r},function(e,t,i){const n=i(5),r=i(10),s=i(11),o=i(12),a=i(13),l=i(25),f=i(26),h=i(28),u=i(31),c=i(32),d=i(34);class p{constructor(e){this.rest=e}loginToken(e=this.rest.client.token){return new Promise((t,i)=>{e=e.replace(/^Bot\s*/i,""),this.rest.client.manager.connectToWebSocket(e,t,i)})}loginEmailPassword(e,t){return this.rest.client.emit("warn","Client launched using email and password - should use token instead"),this.rest.client.email=e,this.rest.client.password=t,this.rest.makeRequest("post",n.Endpoints.login,!1,{email:e,password:t}).then(e=>this.loginToken(e.token))}logout(){return this.rest.makeRequest("post",n.Endpoints.logout,!0,{})}getGateway(){return this.rest.makeRequest("get",n.Endpoints.gateway,!0).then(e=>{return this.rest.client.ws.gateway=`${e.url}/?encoding=json&v=${n.PROTOCOL_VERSION}`,this.rest.client.ws.gateway})}getBotGateway(){return this.rest.makeRequest("get",n.Endpoints.botGateway,!0)}sendMessage(e,t,{tts,nonce,embed,disableEveryone,split}={},i=null){return new Promise((n,r)=>{"undefined"!=typeof t&&(t=this.rest.client.resolver.resolveString(t)),t&&((disableEveryone||"undefined"==typeof disableEveryone&&this.rest.client.options.disableEveryone)&&(t=t.replace(/@(everyone|here)/g,"@​$1")),split&&(t=s(t,"object"==typeof split?split:{}))),e instanceof a||e instanceof l?this.createDM(e).then(e=>{this._sendMessageRequest(e,t,i,tts,nonce,embed,n,r)},r):this._sendMessageRequest(e,t,i,tts,nonce,embed,n,r)})}_sendMessageRequest(e,t,i,r,s,o,a,l){if(t instanceof Array){const f=[];let h=this.rest.makeRequest("post",n.Endpoints.channelMessages(e.id),!0,{content:t[0],tts:r,nonce:s},i).catch(l);for(let u=1;u<=t.length;u++)if(u{return f.push(l),this.rest.makeRequest("post",n.Endpoints.channelMessages(e.id),!0,{content:t[a],tts:r,nonce:s,embed:o},i)},l)}else h.then(e=>{f.push(e),a(this.rest.client.actions.MessageCreate.handle(f).messages)},l)}else this.rest.makeRequest("post",n.Endpoints.channelMessages(e.id),!0,{content:t,tts:r,nonce:s,embed:o},i).then(e=>a(this.rest.client.actions.MessageCreate.handle(e).message),l)}deleteMessage(e){return this.rest.makeRequest("del",n.Endpoints.channelMessage(e.channel.id,e.id),!0).then(()=>this.rest.client.actions.MessageDelete.handle({id:e.id,channel_id:e.channel.id}).message)}bulkDeleteMessages(e,t){return this.rest.makeRequest("post",`${n.Endpoints.channelMessages(e.id)}/bulk_delete`,!0,{messages:t}).then(()=>this.rest.client.actions.MessageDeleteBulk.handle({channel_id:e.id,ids:t}).messages)}updateMessage(e,t,{embed}={}){return t=this.rest.client.resolver.resolveString(t),this.rest.makeRequest("patch",n.Endpoints.channelMessage(e.channel.id,e.id),!0,{content:t,embed:embed}).then(e=>this.rest.client.actions.MessageUpdate.handle(e).updated)}createChannel(e,t,i){return this.rest.makeRequest("post",n.Endpoints.guildChannels(e.id),!0,{name:t,type:i}).then(e=>this.rest.client.actions.ChannelCreate.handle(e).channel)}createDM(e){const t=this.getExistingDM(e);return t?Promise.resolve(t):this.rest.makeRequest("post",n.Endpoints.userChannels(this.rest.client.user.id),!0,{recipient_id:e.id}).then(e=>this.rest.client.actions.ChannelCreate.handle(e).channel)}getExistingDM(e){return this.rest.client.channels.find(t=>t.recipient&&t.recipient.id===e.id)}deleteChannel(e){return(e instanceof a||e instanceof l)&&(e=this.getExistingDM(e)),e?this.rest.makeRequest("del",n.Endpoints.channel(e.id),!0).then(t=>{return t.id=e.id,this.rest.client.actions.ChannelDelete.handle(t).channel}):Promise.reject(new Error("No channel to delete."))}updateChannel(e,t){const i={};return i.name=(t.name||e.name).trim(),i.topic=t.topic||e.topic,i.position=t.position||e.position,i.bitrate=t.bitrate||e.bitrate,i.user_limit=t.userLimit||e.userLimit,this.rest.makeRequest("patch",n.Endpoints.channel(e.id),!0,i).then(e=>this.rest.client.actions.ChannelUpdate.handle(e).updated)}leaveGuild(e){return e.ownerID===this.rest.client.user.id?Promise.reject(new Error("Guild is owned by the client.")):this.rest.makeRequest("del",n.Endpoints.meGuild(e.id),!0).then(()=>this.rest.client.actions.GuildDelete.handle({id:e.id}).guild)}createGuild(e){return e.icon=this.rest.client.resolver.resolveBase64(e.icon)||null,e.region=e.region||"us-central",new Promise((t,i)=>{this.rest.makeRequest("post",n.Endpoints.guilds,!0,e).then(e=>{if(this.rest.client.guilds.has(e.id))return void t(this.rest.client.guilds.get(e.id));const n=i=>{i.id===e.id&&(this.rest.client.removeListener("guildCreate",n),this.rest.client.clearTimeout(r),t(i))};this.rest.client.on("guildCreate",n);const r=this.rest.client.setTimeout(()=>{this.rest.client.removeListener("guildCreate",n),i(new Error("Took too long to receive guild data."))},1e4)},i)})}deleteGuild(e){return this.rest.makeRequest("del",n.Endpoints.guild(e.id),!0).then(()=>this.rest.client.actions.GuildDelete.handle({id:e.id}).guild)}getUser(e){return this.rest.makeRequest("get",n.Endpoints.user(e),!0).then(e=>this.rest.client.actions.UserGet.handle(e).user)}updateCurrentUser(e){const t=this.rest.client.user,i={};return i.username=e.username||t.username,i.avatar=this.rest.client.resolver.resolveBase64(e.avatar)||t.avatar,t.bot||(i.email=e.email||t.email,i.password=this.rest.client.password,e.new_password&&(i.new_password=e.newPassword)),this.rest.makeRequest("patch",n.Endpoints.me,!0,i).then(e=>this.rest.client.actions.UserUpdate.handle(e).updated)}updateGuild(e,t){const i={};return t.name&&(i.name=t.name),t.region&&(i.region=t.region),t.verificationLevel&&(i.verification_level=Number(t.verificationLevel)),t.afkChannel&&(i.afk_channel_id=this.rest.client.resolver.resolveChannel(t.afkChannel).id),t.afkTimeout&&(i.afk_timeout=Number(t.afkTimeout)),t.icon&&(i.icon=this.rest.client.resolver.resolveBase64(t.icon)),t.owner&&(i.owner_id=this.rest.client.resolver.resolveUser(t.owner).id),t.splash&&(i.splash=this.rest.client.resolver.resolveBase64(t.splash)),this.rest.makeRequest("patch",n.Endpoints.guild(e.id),!0,i).then(e=>this.rest.client.actions.GuildUpdate.handle(e).updated)}kickGuildMember(e,t){return this.rest.makeRequest("del",n.Endpoints.guildMember(e.id,t.id),!0).then(()=>this.rest.client.actions.GuildMemberRemove.handle({guild_id:e.id,user:t.user}).member)}createGuildRole(e){return this.rest.makeRequest("post",n.Endpoints.guildRoles(e.id),!0).then(t=>this.rest.client.actions.GuildRoleCreate.handle({guild_id:e.id,role:t}).role)}deleteGuildRole(e){return this.rest.makeRequest("del",n.Endpoints.guildRole(e.guild.id,e.id),!0).then(()=>this.rest.client.actions.GuildRoleDelete.handle({guild_id:e.guild.id,role_id:e.id}).role)}setChannelOverwrite(e,t){return this.rest.makeRequest("put",`${n.Endpoints.channelPermissions(e.id)}/${t.id}`,!0,t)}deletePermissionOverwrites(e){return this.rest.makeRequest("del",`${n.Endpoints.channelPermissions(e.channel.id)}/${e.id}`,!0).then(()=>e)}getChannelMessages(e,t={}){const i=[];t.limit&&i.push(`limit=${t.limit}`),t.around?i.push(`around=${t.around}`):t.before?i.push(`before=${t.before}`):t.after&&i.push(`after=${t.after}`);let r=n.Endpoints.channelMessages(e.id);return i.length>0&&(r+=`?${i.join("&")}`),this.rest.makeRequest("get",r,!0)}getChannelMessage(e,t){const i=e.messages.get(t);return i?Promise.resolve(i):this.rest.makeRequest("get",n.Endpoints.channelMessage(e.id,t),!0)}getGuildMember(e,t){return this.rest.makeRequest("get",n.Endpoints.guildMember(e.id,t.id),!0).then(t=>this.rest.client.actions.GuildMemberGet.handle(e,t).member)}updateGuildMember(e,t){t.channel&&(t.channel_id=this.rest.client.resolver.resolveChannel(t.channel).id),t.roles&&(t.roles=t.roles.map(e=>e instanceof f?e.id:e));let i=n.Endpoints.guildMember(e.guild.id,e.id);if(e.id===this.rest.client.user.id){const r=Object.keys(t);1===r.length&&"nick"===r[0]&&(i=n.Endpoints.stupidInconsistentGuildEndpoint(e.guild.id))}return this.rest.makeRequest("patch",i,!0,t).then(t=>e.guild._updateMember(e,t).mem)}sendTyping(e){return this.rest.makeRequest("post",`${n.Endpoints.channel(e)}/typing`,!0)}banGuildMember(e,t,i=0){const r=this.rest.client.resolver.resolveUserID(t);return r?this.rest.makeRequest("put",`${n.Endpoints.guildBans(e.id)}/${r}?delete-message-days=${i}`,!0,{"delete-message-days":i}).then(()=>{if(t instanceof l)return t;const i=this.rest.client.resolver.resolveUser(r);return i?(t=this.rest.client.resolver.resolveGuildMember(e,i),t||i):r}):Promise.reject(new Error("Couldn't resolve the user ID to ban."))}unbanGuildMember(e,t){return new Promise((i,r)=>{const s=this.rest.client.resolver.resolveUserID(t);if(!s)throw new Error("Couldn't resolve the user ID to unban.");const o=(t,r)=>{t.id===e.id&&r.id===s&&(this.rest.client.removeListener(n.Events.GUILD_BAN_REMOVE,o),this.rest.client.clearTimeout(a),i(r))};this.rest.client.on(n.Events.GUILD_BAN_REMOVE,o);const a=this.rest.client.setTimeout(()=>{this.rest.client.removeListener(n.Events.GUILD_BAN_REMOVE,o),r(new Error("Took too long to receive the ban remove event."))},1e4);this.rest.makeRequest("del",`${n.Endpoints.guildBans(e.id)}/${s}`,!0).catch(e=>{this.rest.client.removeListener(n.Events.GUILD_BAN_REMOVE,o),this.rest.client.clearTimeout(a),r(e)})})}getGuildBans(e){return this.rest.makeRequest("get",n.Endpoints.guildBans(e.id),!0).then(e=>{const t=new r;for(const i of e){const e=this.rest.client.dataManager.newUser(i.user);t.set(e.id,e)}return t})}updateGuildRole(e,t){const i={};if(i.name=t.name||e.name,i.position="undefined"!=typeof t.position?t.position:e.position,i.color=t.color||e.color,"string"==typeof i.color&&i.color.startsWith("#")&&(i.color=parseInt(i.color.replace("#",""),16)),i.hoist="undefined"!=typeof t.hoist?t.hoist:e.hoist,i.mentionable="undefined"!=typeof t.mentionable?t.mentionable:e.mentionable,t.permissions){let e=0;for(let r of t.permissions)"string"==typeof r&&(r=n.PermissionFlags[r]),e|=r;i.permissions=e}else i.permissions=e.permissions;return this.rest.makeRequest("patch",n.Endpoints.guildRole(e.guild.id,e.id),!0,i).then(t=>this.rest.client.actions.GuildRoleUpdate.handle({role:t,guild_id:e.guild.id}).updated)}pinMessage(e){return this.rest.makeRequest("put",`${n.Endpoints.channel(e.channel.id)}/pins/${e.id}`,!0).then(()=>e)}unpinMessage(e){return this.rest.makeRequest("del",`${n.Endpoints.channel(e.channel.id)}/pins/${e.id}`,!0).then(()=>e)}getChannelPinnedMessages(e){return this.rest.makeRequest("get",`${n.Endpoints.channel(e.id)}/pins`,!0)}createChannelInvite(e,t){const i={};return i.temporary=t.temporary,i.max_age=t.maxAge,i.max_uses=t.maxUses,this.rest.makeRequest("post",`${n.Endpoints.channelInvites(e.id)}`,!0,i).then(e=>new h(this.rest.client,e))}deleteInvite(e){return this.rest.makeRequest("del",n.Endpoints.invite(e.code),!0).then(()=>e)}getInvite(e){return this.rest.makeRequest("get",n.Endpoints.invite(e),!0).then(e=>new h(this.rest.client,e))}getGuildInvites(e){return this.rest.makeRequest("get",n.Endpoints.guildInvites(e.id),!0).then(e=>{const t=new r;for(const i of e){const e=new h(this.rest.client,i);t.set(e.code,e)}return t})}pruneGuildMembers(e,t,i){return this.rest.makeRequest(i?"get":"post",`${n.Endpoints.guildPrune(e.id)}?days=${t}`,!0).then(e=>e.pruned)}createEmoji(e,t,i){return this.rest.makeRequest("post",`${n.Endpoints.guildEmojis(e.id)}`,!0,{name:i,image:t}).then(t=>this.rest.client.actions.EmojiCreate.handle(t,e).emoji); }deleteEmoji(e){return this.rest.makeRequest("delete",`${n.Endpoints.guildEmojis(e.guild.id)}/${e.id}`,!0).then(()=>this.rest.client.actions.EmojiDelete.handle(e).data)}getWebhook(e,t){return this.rest.makeRequest("get",n.Endpoints.webhook(e,t),!t).then(e=>new u(this.rest.client,e))}getGuildWebhooks(e){return this.rest.makeRequest("get",n.Endpoints.guildWebhooks(e.id),!0).then(e=>{const t=new r;for(const i of e)t.set(i.id,new u(this.rest.client,i));return t})}getChannelWebhooks(e){return this.rest.makeRequest("get",n.Endpoints.channelWebhooks(e.id),!0).then(e=>{const t=new r;for(const i of e)t.set(i.id,new u(this.rest.client,i));return t})}createWebhook(e,t,i){return this.rest.makeRequest("post",n.Endpoints.channelWebhooks(e.id),!0,{name:t,avatar:i}).then(e=>new u(this.rest.client,e))}editWebhook(e,t,i){return this.rest.makeRequest("patch",n.Endpoints.webhook(e.id,e.token),!1,{name:t,avatar:i}).then(t=>{return e.name=t.name,e.avatar=t.avatar,e})}deleteWebhook(e){return this.rest.makeRequest("delete",n.Endpoints.webhook(e.id,e.token),!1)}sendWebhookMessage(e,t,{avatarURL,tts,disableEveryone,embeds}={},i=null){return"undefined"!=typeof t&&(t=this.rest.client.resolver.resolveString(t)),t&&(disableEveryone||"undefined"==typeof disableEveryone&&this.rest.client.options.disableEveryone)&&(t=t.replace(/@(everyone|here)/g,"@​$1")),this.rest.makeRequest("post",`${n.Endpoints.webhook(e.id,e.token)}?wait=true`,!1,{username:e.name,avatar_url:avatarURL,content:t,tts:tts,file:i,embeds:embeds})}sendSlackWebhookMessage(e,t){return this.rest.makeRequest("post",`${n.Endpoints.webhook(e.id,e.token)}/slack?wait=true`,!1,t)}fetchUserProfile(e){return this.rest.makeRequest("get",n.Endpoints.userProfile(e.id),!0).then(t=>new c(e,t))}addFriend(e){return this.rest.makeRequest("post",n.Endpoints.relationships("@me"),!0,{username:e.username,discriminator:e.discriminator}).then(()=>e)}removeFriend(e){return this.rest.makeRequest("delete",`${n.Endpoints.relationships("@me")}/${e.id}`,!0).then(()=>e)}blockUser(e){return this.rest.makeRequest("put",`${n.Endpoints.relationships("@me")}/${e.id}`,!0,{type:2}).then(()=>e)}unblockUser(e){return this.rest.makeRequest("delete",`${n.Endpoints.relationships("@me")}/${e.id}`,!0).then(()=>e)}setRolePositions(e,t){return this.rest.makeRequest("patch",n.Endpoints.guildRoles(e),!0,t).then(()=>this.rest.client.actions.GuildRolesPositionUpdate.handle({guild_id:e,roles:t}).guild)}addMessageReaction(e,t){return this.rest.makeRequest("put",n.Endpoints.selfMessageReaction(e.channel.id,e.id,t),!0).then(()=>this.rest.client.actions.MessageReactionAdd.handle({user_id:this.rest.client.user.id,message_id:e.id,emoji:o(t),channel_id:e.channel.id}).reaction)}removeMessageReaction(e,t,i){let r=n.Endpoints.selfMessageReaction(e.channel.id,e.id,t);return i.id!==this.rest.client.user.id&&(r=n.Endpoints.userMessageReaction(e.channel.id,e.id,t,null,i.id)),this.rest.makeRequest("delete",r,!0).then(()=>this.rest.client.actions.MessageReactionRemove.handle({user_id:i.id,message_id:e.id,emoji:o(t),channel_id:e.channel.id}).reaction)}removeMessageReactions(e){this.rest.makeRequest("delete",n.Endpoints.messageReactions(e.channel.id,e.id),!0).then(()=>e)}getMessageReactionUsers(e,t,i=100){return this.rest.makeRequest("get",n.Endpoints.messageReaction(e.channel.id,e.id,t,i),!0)}getMyApplication(){return this.rest.makeRequest("get",n.Endpoints.myApplication,!0).then(e=>new d(this.rest.client,e))}setNote(e,t){return this.rest.makeRequest("put",n.Endpoints.note(e.id),!0,{note:t}).then(()=>e)}}e.exports=p},function(e,t){class i extends Map{constructor(e){super(e),this._array=null,this._keyArray=null}set(e,t){super.set(e,t),this._array=null,this._keyArray=null}delete(e){super.delete(e),this._array=null,this._keyArray=null}array(){return this._array&&this._array.length===this.size||(this._array=Array.from(this.values())),this._array}keyArray(){return this._keyArray&&this._keyArray.length===this.size||(this._keyArray=Array.from(this.keys())),this._keyArray}first(){return this.values().next().value}firstKey(){return this.keys().next().value}last(){const e=this.array();return e[e.length-1]}lastKey(){const e=this.keyArray();return e[e.length-1]}random(){const e=this.array();return e[Math.floor(Math.random()*e.length)]}randomKey(){const e=this.keyArray();return e[Math.floor(Math.random()*e.length)]}findAll(e,t){if("string"!=typeof e)throw new TypeError("Key must be a string.");if("undefined"==typeof t)throw new Error("Value must be specified.");const i=[];for(const n of this.values())n[e]===t&&i.push(n);return i}find(e,t){if("string"==typeof e){if("undefined"==typeof t)throw new Error("Value must be specified.");if("id"===e)throw new RangeError("Don't use .find() with IDs. Instead, use .get(id).");for(const i of this.values())if(i[e]===t)return i;return null}if("function"==typeof e){for(const[t,i]of this)if(e(i,t,this))return i;return null}throw new Error("First argument must be a property string or a function.")}findKey(e,t){if("string"==typeof e){if("undefined"==typeof t)throw new Error("Value must be specified.");for(const[i,n]of this)if(n[e]===t)return i;return null}if("function"==typeof e){for(const[t,i]of this)if(e(i,t,this))return t;return null}throw new Error("First argument must be a property string or a function.")}exists(e,t){if("id"===e)throw new RangeError("Don't use .exists() with IDs. Instead, use .has(id).");return Boolean(this.find(e,t))}filter(e,t){t&&(e=e.bind(t));const n=new i;for(const[r,s]of this)e(s,r,this)&&n.set(r,s);return n}filterArray(e,t){t&&(e=e.bind(t));const i=[];for(const[n,r]of this)e(r,n,this)&&i.push(r);return i}map(e,t){t&&(e=e.bind(t));const i=new Array(this.size);let n=0;for(const[r,s]of this)i[n++]=e(s,r,this);return i}some(e,t){t&&(e=e.bind(t));for(const[i,n]of this)if(e(n,i,this))return!0;return!1}every(e,t){t&&(e=e.bind(t));for(const[i,n]of this)if(!e(n,i,this))return!1;return!0}reduce(e,t){let i=t;for(const[n,r]of this)i=e(i,r,n,this);return i}concat(...e){const t=new this.constructor;for(const[i,n]of this)t.set(i,n);for(const r of e)for(const[i,n]of r)t.set(i,n);return t}deleteAll(){const e=[];for(const t of this.values())t.delete&&e.push(t.delete());return e}}e.exports=i},function(e,t){e.exports=function(e,{maxLength=1950,char="\n",prepend="",append=""}={}){if(e.length<=maxLength)return e;const t=e.split(char);if(1===t.length)throw new Error("Message exceeds the max length and contains no split characters.");const i=[""];let n=0;for(let r=0;rmaxLength&&(i[n]+=append,i.push(prepend),n++),i[n]+=(i[n].length>0&&i[n]!==prepend?char:"")+t[r];return i}},function(e,t){e.exports=function(e){if(e.includes("%")&&(e=decodeURIComponent(e)),e.includes(":")){const[t,i]=e.split(":");return{name:t,id:i}}return{name:e,id:null}}},function(e,t,i){const n=i(14),r=i(5),s=i(24).Presence;class o{constructor(e,t){this.client=e,Object.defineProperty(this,"client",{enumerable:!1,configurable:!1}),t&&this.setup(t)}setup(e){this.id=e.id,this.username=e.username,this.discriminator=e.discriminator,this.avatar=e.avatar,this.bot=Boolean(e.bot)}patch(e){for(const t of["id","username","discriminator","avatar","bot"])"undefined"!=typeof e[t]&&(this[t]=e[t])}get createdTimestamp(){return this.id/4194304+14200704e5}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 s}get avatarURL(){return this.avatar?r.Endpoints.avatar(this.id,this.avatar):null}get note(){return this.client.user.notes.get(this.id)||null}typingIn(e){return e=this.client.resolver.resolveChannel(e),e._typing.has(this.id)}typingSinceIn(e){return e=this.client.resolver.resolveChannel(e),e._typing.has(this.id)?new Date(e._typing.get(this.id).since):null}typingDurationIn(e){return e=this.client.resolver.resolveChannel(e),e._typing.has(this.id)?e._typing.get(this.id).elapsedTime:-1}deleteDM(){return this.client.rest.methods.deleteChannel(this)}addFriend(){return this.client.rest.methods.addFriend(this)}removeFriend(){return this.client.rest.methods.removeFriend(this)}block(){return this.client.rest.methods.blockUser(this)}unblock(){return this.client.rest.methods.unblockUser(this)}fetchProfile(){return this.client.rest.methods.fetchUserProfile(this)}setNote(e){return this.client.rest.methods.setNote(this,e)}equals(e){let t=e&&this.id===e.id&&this.username===e.username&&this.discriminator===e.discriminator&&this.avatar===e.avatar&&this.bot===Boolean(e.bot);return t}toString(){return`<@${this.id}>`}sendMessage(){}sendTTSMessage(){}sendFile(){}sendCode(){}}n.applyToClass(o),e.exports=o},function(e,t,i){function n(e,t){Object.defineProperty(e.prototype,t,Object.getOwnPropertyDescriptor(f.prototype,t))}const r=i(15),s=i(16),o=i(23),a=i(10),l=i(19);class f{constructor(){this.messages=new a,this.lastMessageID=null}sendMessage(e,t={}){return this.client.rest.methods.sendMessage(this,e,t)}sendTTSMessage(e,t={}){return Object.assign(t,{tts:!0}),this.client.rest.methods.sendMessage(this,e,t)}sendFile(e,t,i,n={}){return t||(t="string"==typeof e?r.basename(e):e&&e.path?r.basename(e.path):"file.jpg"),this.client.resolver.resolveBuffer(e).then(e=>this.client.rest.methods.sendMessage(this,i,n,{file:e,name:t}))}sendCode(e,t,i={}){return i.split&&("object"!=typeof i.split&&(i.split={}),i.split.prepend||(i.split.prepend=`\`\`\`${e||""} `),i.split.append||(i.split.append="\n```")),t=l(this.client.resolver.resolveString(t),!0),this.sendMessage(`\`\`\`${e||""} ${t} @@ -7,8 +7,8 @@ ${t} \`\`\``)}pin(){return this.client.rest.methods.pinMessage(this)}unpin(){return this.client.rest.methods.unpinMessage(this)}react(e){if(e=this.client.resolver.resolveEmojiIdentifier(e),!e)throw new TypeError("Emoji must be a string or Emoji/ReactionEmoji");return this.client.rest.methods.addMessageReaction(this,e)}clearReactions(){return this.client.rest.methods.removeMessageReactions(this)}delete(e=0){return e<=0?this.client.rest.methods.deleteMessage(this):new Promise(t=>{this.client.setTimeout(()=>{t(this.delete())},e)})}reply(e,t={}){e=this.client.resolver.resolveString(e);const i=this.guild?`${this.author}, `:"";return e=`${i}${e}`,t.split&&("object"!=typeof t.split&&(t.split={}),t.split.prepend||(t.split.prepend=i)),this.client.rest.methods.sendMessage(this.channel,e,t)}equals(e,t){if(!e)return!1;const i=!e.author&&!e.attachments;if(i)return this.id===e.id&&this.embeds.length===e.embeds.length;let n=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 n&&t&&(n=this.mentions.everyone===e.mentions.everyone&&this.createdTimestamp===new Date(t.timestamp).getTime()&&this.editedTimestamp===new Date(t.edited_timestamp).getTime()),n}toString(){return this.content}_addReaction(e,t){const i=e.id?`${e.name}:${e.id}`:e.name;let n;return this.reactions.has(i)?(n=this.reactions.get(i),n.me||(n.me=t.id===this.client.user.id)):(n=new l(this,e,0,t.id===this.client.user.id),this.reactions.set(i,n)),n.users.has(t.id)?null:(n.users.set(t.id,t),n.count++,n)}_removeReaction(e,t){const i=e.id||e;if(this.reactions.has(i)){const e=this.reactions.get(i);if(e.users.has(t.id))return e.users.delete(t.id),e.count--,t.id===this.client.user.id&&(e.me=!1),e}return null}_clearReactions(){this.reactions.clear()}}e.exports=f},function(e,t){class i{constructor(e,t){this.client=e.client,Object.defineProperty(this,"client",{enumerable:!1,configurable:!1}),this.message=e,this.setup(t)}setup(e){this.id=e.id,this.filename=e.filename,this.filesize=e.size,this.url=e.url,this.proxyURL=e.proxy_url,this.height=e.height,this.width=e.width}}e.exports=i},function(e,t){class i{constructor(e,t){this.client=e.client,Object.defineProperty(this,"client",{enumerable:!1,configurable:!1}),this.message=e,this.setup(t)}setup(e){if(this.title=e.title,this.type=e.type,this.description=e.description,this.url=e.url,this.fields=[],e.fields)for(const t of e.fields)this.fields.push(new o(this,t));this.createdTimestamp=e.timestamp,this.thumbnail=e.thumbnail?new n(this,e.thumbnail):null,this.author=e.author?new s(this,e.author):null,this.provider=e.provider?new r(this,e.provider):null,this.footer=e.footer?new a(this,e.footer):null}get createdAt(){return new Date(this.createdTimestamp)}}class n{constructor(e,t){this.embed=e,this.setup(t)}setup(e){this.url=e.url,this.proxyURL=e.proxy_url,this.height=e.height,this.width=e.width}}class r{constructor(e,t){this.embed=e,this.setup(t)}setup(e){this.name=e.name,this.url=e.url}}class s{constructor(e,t){this.embed=e,this.setup(t)}setup(e){this.name=e.name,this.url=e.url}}class o{constructor(e,t){this.embed=e,this.setup(t)}setup(e){this.name=e.name,this.value=e.value,this.inline=e.inline}}class a{constructor(e,t){this.embed=e,this.setup(t)}setup(e){this.text=e.text,this.iconUrl=e.icon_url,this.proxyIconUrl=e.proxy_icon_url}}i.Thumbnail=n,i.Provider=r,i.Author=s,i.Field=o,i.Footer=a,e.exports=i},function(e,t){e.exports=function(e,t=false,i=false){return t?e.replace(/```/g,"`​``"):i?e.replace(/\\(`|\\)/g,"$1").replace(/(`|\\)/g,"\\$1"):e.replace(/\\(\*|_|`|~|\\)/g,"$1").replace(/(\*|_|`|~|\\)/g,"\\$1")}},function(e,t,i){const n=i(10),r=i(21),s=i(22);class o{constructor(e,t,i,r){this.message=e,this.me=r,this.count=i||0,this.users=new n,this._emoji=new s(this,t.name,t.id)}get emoji(){if(this._emoji instanceof r)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;return e=this.message.client.resolver.resolveUserID(e),e?t.client.rest.methods.removeMessageReaction(t,this.emoji.identifier,e):Promise.reject("Couldn't resolve the user ID to remove from the reaction.")}fetchUsers(e=100){const t=this.message;return t.client.rest.methods.getMessageReactionUsers(t,this.emoji.identifier,e).then(e=>{this.users=new n;for(const t of e){const e=this.message.client.dataManager.newUser(t);this.users.set(e.id,e)}return this.count=this.users.size,e})}}e.exports=o},function(e,t,i){const n=i(5),r=i(10);class s{constructor(e,t){this.client=e.client,Object.defineProperty(this,"client",{enumerable:!1,configurable:!1}),this.guild=e,this.setup(t)}setup(e){this.id=e.id,this.name=e.name,this.requiresColons=e.require_colons,this.managed=e.managed,this._roles=e.roles}get createdTimestamp(){return this.id/4194304+14200704e5}get createdAt(){return new Date(this.createdTimestamp)}get roles(){const e=new r;for(const t of this._roles)this.guild.roles.has(t)&&e.set(t,this.guild.roles.get(t));return e}get url(){return`${n.Endpoints.CDN}/emojis/${this.id}.png`}toString(){return this.requiresColons?`<:${this.name}:${this.id}>`:this.name}get identifier(){return this.id?`${this.name}:${this.id}`:encodeURIComponent(this.name)}}e.exports=s},function(e,t){class i{constructor(e,t,i){this.reaction=e,this.name=t,this.id=i}get identifier(){return this.id?`${this.name}:${this.id}`:encodeURIComponent(this.name)}toString(){return this.id?`<:${this.name}:${this.id}>`:this.name}}e.exports=i},function(e,t,i){const n=i(3).EventEmitter,r=i(10);class s extends n{constructor(e,t,i={}){super(),this.channel=e,this.filter=t,this.options=i,this.ended=!1,this.collected=new r,this.listener=(e=>this.verify(e)),this.channel.client.on("message",this.listener),i.time&&this.channel.client.setTimeout(()=>this.stop("time"),i.time)}verify(e){return(!this.channel||this.channel.id===e.channel.id)&&(!!this.filter(e,this)&&(this.collected.set(e.id,e),this.emit("message",e,this),this.collected.size>=this.options.maxMatches?this.stop("matchesLimit"):this.options.max&&this.collected.size===this.options.max&&this.stop("limit"),!0))}get next(){return new Promise((e,t)=>{if(this.ended)return void t(this.collected);const i=()=>{this.removeListener("message",n),this.removeListener("end",r)},n=(...t)=>{i(),e(...t)},r=(...e)=>{i(),t(...e)};this.once("message",n),this.once("end",r)})}stop(e="user"){this.ended||(this.ended=!0,this.channel.client.removeListener("message",this.listener),this.emit("end",this.collected,e))}}e.exports=s},function(e,t){class i{constructor(e={}){this.status=e.status||"offline",this.game=e.game?new n(e.game):null}update(e){this.status=e.status||this.status,this.game=e.game?new n(e.game):null}equals(e){return e&&this.status===e.status&&this.game?this.game.equals(e.game):!e.game}}class n{constructor(e){this.name=e.name,this.type=e.type,this.url=e.url||null}get streaming(){return 1===this.type}equals(e){return e&&this.name===e.name&&this.type===e.type&&this.url===e.url}}t.Presence=i,t.Game=n},function(e,t,i){const n=i(14),r=i(26),s=i(27),o=i(5),a=i(10),l=i(24).Presence;class f{constructor(e,t){this.client=e.client,Object.defineProperty(this,"client",{enumerable:!1,configurable:!1}),this.guild=e,this.user={},this._roles=[],t&&this.setup(t)}setup(e){this.serverDeaf=e.deaf,this.serverMute=e.mute,this.selfMute=e.self_mute,this.selfDeaf=e.self_deaf,this.voiceSessionID=e.session_id,this.voiceChannelID=e.channel_id,this.speaking=!1,this.nickname=e.nick||null,this.joinedTimestamp=new Date(e.joined_at).getTime(),this.user=e.user,this._roles=e.roles}get joinedAt(){return new Date(this.joinedTimestamp)}get presence(){return this.frozenPresence||this.guild.presences.get(this.id)||new l}get roles(){const e=new a,t=this.guild.roles.get(this.guild.id);t&&e.set(t.id,t);for(const i of this._roles){const t=this.guild.roles.get(i);t&&e.set(t.id,t)}return e}get highestRole(){return this.roles.reduce((e,t)=>!e||t.comparePositionTo(e)>0?t:e)}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 permissions(){if(this.user.id===this.guild.ownerID)return new s(this,o.ALL_PERMISSIONS);let e=0;const t=this.roles;for(const i of t.values())e|=i.permissions;const n=Boolean(e&o.PermissionFlags.ADMINISTRATOR);return n&&(e=o.ALL_PERMISSIONS),new s(this,e)}get kickable(){if(this.user.id===this.guild.ownerID)return!1;if(this.user.id===this.client.user.id)return!1;const e=this.guild.member(this.client.user);return!!e.hasPermission(o.PermissionFlags.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.hasPermission(o.PermissionFlags.BAN_MEMBERS)&&e.highestRole.comparePositionTo(this.highestRole)>0}permissionsIn(e){if(e=this.client.resolver.resolveChannel(e),!e||!e.guild)throw new Error("Could not resolve channel to a guild channel.");return e.permissionsFor(this)}hasPermission(e,t=false){return!t&&this.user.id===this.guild.ownerID||this.roles.some(i=>i.hasPermission(e,t))}hasPermissions(e,t=false){return!t&&this.user.id===this.guild.ownerID||e.every(e=>this.hasPermission(e,t))}missingPermissions(e,t=false){return e.filter(e=>!this.hasPermission(e,t))}edit(e){return this.client.rest.methods.updateGuildMember(this,e)}setMute(e){return this.edit({mute:e})}setDeaf(e){return this.edit({deaf:e})}setVoiceChannel(e){return this.edit({channel:e})}setRoles(e){return this.edit({roles:e})}addRole(e){return this.addRoles([e])}addRoles(e){let t;if(e instanceof a){t=this._roles.slice();for(const i of e.values())t.push(i.id)}else t=this._roles.concat(e);return this.edit({roles:t})}removeRole(e){return this.removeRoles([e])}removeRoles(e){const t=this._roles.slice();if(e instanceof a)for(const i of e.values()){const e=t.indexOf(i.id);e>=0&&t.splice(e,1)}else for(const i of e){const e=t.indexOf(i instanceof r?i.id:i);e>=0&&t.splice(e,1)}return this.edit({roles:t})}setNickname(e){return this.edit({nick:e})}deleteDM(){return this.client.rest.methods.deleteChannel(this)}kick(){return this.client.rest.methods.kickGuildMember(this.guild,this)}ban(e=0){return this.client.rest.methods.banGuildMember(this.guild,this,e)}toString(){return`<@${this.nickname?"!":""}${this.user.id}>`}sendMessage(){}sendTTSMessage(){}sendFile(){}sendCode(){}}n.applyToClass(f),e.exports=f},function(e,t,i){const n=i(5);class r{constructor(e,t){this.client=e.client,Object.defineProperty(this,"client",{enumerable:!1,configurable:!1}),this.guild=e,t&&this.setup(t)}setup(e){this.id=e.id,this.name=e.name,this.color=e.color,this.hoist=e.hoist,this.position=e.position,this.permissions=e.permissions,this.managed=e.managed,this.mentionable=e.mentionable}get createdTimestamp(){return this.id/4194304+14200704e5}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))}serialize(){const e={};for(const t in n.PermissionFlags)e[t]=this.hasPermission(t);return e}hasPermission(e,t=false){return e=this.client.resolver.resolvePermission(e),!t&&(this.permissions&n.PermissionFlags.ADMINISTRATOR)>0||(this.permissions&e)>0}hasPermissions(e,t=false){return e.every(e=>this.hasPermission(e,t))}comparePositionTo(e){return this.constructor.comparePositions(this,e)}edit(e){return this.client.rest.methods.updateGuildRole(this,e)}setName(e){return this.edit({name:e})}setColor(e){return this.edit({color:e})}setHoist(e){return this.edit({hoist:e})}setPosition(e){return this.guild.setRolePosition(this,e)}setPermissions(e){return this.edit({permissions:e})}setMentionable(e){return this.edit({mentionable:e})}delete(){return this.client.rest.methods.deleteGuildRole(this)}get editable(){if(this.managed)return!1;const e=this.guild.member(this.client.user);return!!e.hasPermission(n.PermissionFlags.MANAGE_ROLES_OR_PERMISSIONS)&&e.highestRole.comparePositionTo(this)>0}equals(e){return e&&this.id===e.id&&this.name===e.name&&this.color===e.color&&this.hoist===e.hoist&&this.position===e.position&&this.permissions===e.permissions&&this.managed===e.managed}toString(){return`<@&${this.id}>`}static comparePositions(e,t){return e.position===t.position?t.id-e.id:e.position-t.position}}e.exports=r},function(e,t,i){const n=i(5);class r{constructor(e,t){this.member=e,this.raw=t}serialize(){const e={};for(const t in n.PermissionFlags)e[t]=this.hasPermission(t);return e}hasPermission(e,t=false){return e=this.member.client.resolver.resolvePermission(e),!t&&(this.raw&n.PermissionFlags.ADMINISTRATOR)>0||(this.raw&e)>0}hasPermissions(e,t=false){return e.every(e=>this.hasPermission(e,t))}missingPermissions(e,t=false){return e.filter(e=>!this.hasPermission(e,t))}}e.exports=r},function(e,t,i){const n=i(29),r=i(30),s=i(5);class o{constructor(e,t){this.client=e,Object.defineProperty(this,"client",{enumerable:!1,configurable:!1}),this.setup(t)}setup(e){this.guild=this.client.guilds.get(e.guild.id)||new n(this.client,e.guild),this.code=e.code,this.temporary=e.temporary,this.maxAge=e.max_age,this.uses=e.uses,this.maxUses=e.max_uses,e.inviter&&(this.inviter=this.client.dataManager.newUser(e.inviter)),this.channel=this.client.channels.get(e.channel.id)||new r(this.client,e.channel),this.createdTimestamp=new Date(e.created_at).getTime()}get createdAt(){return new Date(this.createdTimestamp)}get expiresTimestamp(){return this.createdTimestamp+1e3*this.maxAge}get expiresAt(){return new Date(this.expiresTimestamp)}get url(){return s.Endpoints.inviteLink(this.code)}delete(){return this.client.rest.methods.deleteInvite(this)}toString(){return this.url}}e.exports=o},function(e,t){class i{constructor(e,t){this.client=e,Object.defineProperty(this,"client",{enumerable:!1,configurable:!1}),this.setup(t)}setup(e){this.id=e.id,this.name=e.name,this.icon=e.icon,this.splash=e.splash}}e.exports=i},function(e,t,i){const n=i(5);class r{constructor(e,t){this.client=e,Object.defineProperty(this,"client",{enumerable:!1,configurable:!1}),this.setup(t)}setup(e){this.id=e.id,this.name=e.name,this.type=n.ChannelTypes.text===e.type?"text":"voice"}}e.exports=r},function(e,t,i){const n=i(15),r=i(19);class s{constructor(e,t,i){e?(this.client=e,Object.defineProperty(this,"client",{enumerable:!1,configurable:!1}),t&&this.setup(t)):(this.id=t,this.token=i,this.client=this)}setup(e){this.name=e.name,this.token=e.token,this.avatar=e.avatar,this.id=e.id,this.guildID=e.guild_id,this.channelID=e.channel_id,e.user&&(this.owner=e.user)}sendMessage(e,t={}){return this.client.rest.methods.sendWebhookMessage(this,e,t)}sendSlackMessage(e){return this.client.rest.methods.sendSlackWebhookMessage(this,e)}sendTTSMessage(e,t={}){return Object.assign(t,{tts:!0}),this.client.rest.methods.sendWebhookMessage(this,e,t)}sendFile(e,t,i,r={}){return t||(t="string"==typeof e?n.basename(e):e&&e.path?n.basename(e.path):"file.jpg"),this.client.resolver.resolveBuffer(e).then(e=>this.client.rest.methods.sendWebhookMessage(this,i,r,{file:e,name:t}))}sendCode(e,t,i={}){return i.split&&("object"!=typeof i.split&&(i.split={}),i.split.prepend||(i.split.prepend=`\`\`\`${e||""} `),i.split.append||(i.split.append="\n```")),t=r(this.client.resolver.resolveString(t),!0),this.sendMessage(`\`\`\`${e||""} ${t} -\`\`\``,i)}edit(e=this.name,t){return t?this.client.resolver.resolveBuffer(t).then(t=>{const i=this.client.resolver.resolveBase64(t);return this.client.rest.methods.editWebhook(this,e,i)}):this.client.rest.methods.editWebhook(this,e).then(e=>{return this.setup(e),this})}delete(){return this.client.rest.methods.deleteWebhook(this)}}e.exports=s},function(e,t,i){const n=i(10),r=i(33);class s{constructor(e,t){this.user=e,this.client=this.user.client,Object.defineProperty(this,"client",{enumerable:!1,configurable:!1}),this.mutualGuilds=new n,this.connections=new n,this.setup(t)}setup(e){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 i of e.connected_accounts)this.connections.set(i.id,new r(this.user,i))}}e.exports=s},function(e,t){class i{constructor(e,t){this.user=e,this.setup(t)}setup(e){this.type=e.type,this.name=e.name,this.id=e.id,this.revoked=e.revoked,this.integrations=e.integrations}}e.exports=i},function(e,t,i){const n=i(13),r=i(35);class s extends r{setup(e){super.setup(e),this.flags=e.flags,this.owner=new n(this.client,e.owner)}}e.exports=s},function(e,t){class i{constructor(e,t){this.client=e,Object.defineProperty(this,"client",{enumerable:!1,configurable:!1}),this.setup(t)}setup(e){this.id=e.id,this.name=e.name,this.description=e.description,this.icon=e.icon,this.iconURL=`https://cdn.discordapp.com/app-icons/${this.id}/${this.icon}.jpg`,this.rpcOrigins=e.rpc_origins}get createdTimestamp(){return this.id/4194304+14200704e5}get createdAt(){return new Date(this.createdTimestamp)}toString(){return this.name}}e.exports=i},function(e,t,i){const n=i(37);class r extends n{constructor(e,t){super(e,t),this.waiting=!1,this.endpoint=t,this.timeDifference=0}push(e){super.push(e),this.handle()}execute(e){return new Promise(t=>{e.request.gen().end((i,n)=>{if(n&&n.headers&&(this.requestLimit=n.headers["x-ratelimit-limit"],this.requestResetTime=1e3*Number(n.headers["x-ratelimit-reset"]),this.requestRemaining=Number(n.headers["x-ratelimit-remaining"]),this.timeDifference=Date.now()-new Date(n.headers.date).getTime()),i)429===i.status?(this.restManager.client.setTimeout(()=>{this.waiting=!1,this.globalLimit=!1,t()},Number(n.headers["retry-after"])+500),n.headers["x-ratelimit-global"]&&(this.globalLimit=!0)):(this.queue.shift(),this.waiting=!1,e.reject(i),t(i));else{this.queue.shift(),this.globalLimit=!1;const i=n&&n.body?n.body:{};e.resolve(i),0===this.requestRemaining?this.restManager.client.setTimeout(()=>{this.waiting=!1,t(i)},this.requestResetTime-Date.now()+this.timeDifference+1e3):(this.waiting=!1,t(i))}})})}handle(){if(super.handle(),!this.waiting&&0!==this.queue.length&&!this.globalLimit){this.waiting=!0;const e=this.queue[0];this.execute(e).then(()=>this.handle())}}}e.exports=r},function(e,t){class i{constructor(e){this.restManager=e,this.queue=[]}get globalLimit(){return this.restManager.globallyRateLimited}set globalLimit(e){this.restManager.globallyRateLimited=e}push(e){this.queue.push(e)}handle(){}}e.exports=i},function(e,t,i){const n=i(37);class r extends n{constructor(e,t){super(e,t),this.requestRemaining=1,this.first=!0}push(e){super.push(e),this.handle()}handleNext(e){this.waiting||(this.waiting=!0,this.restManager.client.setTimeout(()=>{this.requestRemaining=this.requestLimit,this.waiting=!1,this.handle()},e))}execute(e){e.request.gen().end((t,i)=>{if(i&&i.headers&&(this.requestLimit=i.headers["x-ratelimit-limit"],this.requestResetTime=1e3*Number(i.headers["x-ratelimit-reset"]),this.requestRemaining=Number(i.headers["x-ratelimit-remaining"]),this.timeDifference=Date.now()-new Date(i.headers.date).getTime(),this.handleNext(this.requestResetTime-Date.now()+this.timeDifference+1e3)),t)429===t.status?(this.requestRemaining=0,this.queue.unshift(e),this.restManager.client.setTimeout(()=>{this.globalLimit=!1,this.handle()},Number(i.headers["retry-after"])+500),i.headers["x-ratelimit-global"]&&(this.globalLimit=!0)):e.reject(t);else{this.globalLimit=!1;const t=i&&i.body?i.body:{};e.resolve(t),this.first&&(this.first=!1,this.handle())}})}handle(){if(super.handle(),!(this.requestRemaining<1||0===this.queue.length||this.globalLimit))for(;this.queue.length>0&&this.requestRemaining>0;)this.execute(this.queue.shift()),this.requestRemaining--}}e.exports=r},function(e,t,i){function n(e){let t=e.split("?")[0];if(t.includes("/channels/")||t.includes("/guilds/")){const e=~t.indexOf("/channels/")?t.indexOf("/channels/"):t.indexOf("/guilds/"),i=t.substring(e).split("/")[2];t=t.replace(/(\d{8,})/g,":id").replace(":id",i)}return t}const r=i(40),s=i(5);class o{constructor(e,t,i,r,s,o){this.rest=e,this.method=t,this.url=i,this.auth=r,this.data=s,this.file=o,this.route=n(this.url)}getAuth(){if(this.rest.client.token&&this.rest.client.user&&this.rest.client.user.bot)return`Bot ${this.rest.client.token}`;if(this.rest.client.token)return this.rest.client.token;throw new Error(s.Errors.NO_TOKEN)}gen(){const e=r[this.method](this.url);if(this.auth&&e.set("authorization",this.getAuth()),this.file&&this.file.file){e.attach("file",this.file.file,this.file.name),this.data=this.data||{};for(const t in this.data)this.data[t]&&e.field(t,this.data[t])}else this.data&&e.send(this.data);return e.set("User-Agent",this.rest.userAgentManager.userAgent),e}}e.exports=o},function(e,t,i){function n(){}function r(e){if(!m(e))return e;var t=[];for(var i in e)s(t,i,e[i]);return t.join("&")}function s(e,t,i){if(null!=i)if(Array.isArray(i))i.forEach(function(i){s(e,t,i)});else if(m(i))for(var n in i)s(e,t+"["+n+"]",i[n]);else e.push(encodeURIComponent(t)+"="+encodeURIComponent(i));else null===i&&e.push(encodeURIComponent(t))}function o(e){for(var t,i,n={},r=e.split("&"),s=0,o=r.length;s=300)&&(n=new Error(t.statusText||"Unsuccessful HTTP response"),n.original=e,n.response=t,n.status=t.status)}catch(e){n=e}n?i.callback(n,t):i.callback(null,t)})}function d(e,t){var i=g("DELETE",e);return t&&i.end(t),i}var p;"undefined"!=typeof window?p=window:"undefined"!=typeof self?p=self:(console.warn("Using browser-only version of superagent in non-browser environment"),p=this);var b=i(41),w=i(42),m=i(43),g=e.exports=i(44).bind(null,c);g.getXHR=function(){if(!(!p.XMLHttpRequest||p.location&&"file:"==p.location.protocol&&p.ActiveXObject))return new XMLHttpRequest;try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(e){}try{return new ActiveXObject("Msxml2.XMLHTTP.6.0")}catch(e){}try{return new ActiveXObject("Msxml2.XMLHTTP.3.0")}catch(e){}try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(e){}throw Error("Browser-only verison of superagent could not find XHR")};var _="".trim?function(e){return e.trim()}:function(e){return e.replace(/(^\s*|\s*$)/g,"")};g.serializeObject=r,g.parseString=o,g.types={html:"text/html",json:"application/json",xml:"application/xml",urlencoded:"application/x-www-form-urlencoded",form:"application/x-www-form-urlencoded","form-data":"application/x-www-form-urlencoded"},g.serialize={"application/x-www-form-urlencoded":r,"application/json":JSON.stringify},g.parse={"application/x-www-form-urlencoded":o,"application/json":JSON.parse},u.prototype.get=function(e){return this.header[e.toLowerCase()]},u.prototype._setHeaderProperties=function(e){var t=this.header["content-type"]||"";this.type=f(t);var i=h(t);for(var n in i)this[n]=i[n]},u.prototype._parseBody=function(e){var t=g.parse[this.type];return!t&&l(this.type)&&(t=g.parse["application/json"]),t&&e&&(e.length||e instanceof Object)?t(e):null},u.prototype._setStatusProperties=function(e){1223===e&&(e=204);var t=e/100|0;this.status=this.statusCode=e,this.statusType=t,this.info=1==t,this.ok=2==t,this.clientError=4==t,this.serverError=5==t,this.error=(4==t||5==t)&&this.toError(),this.accepted=202==e,this.noContent=204==e,this.badRequest=400==e,this.unauthorized=401==e,this.notAcceptable=406==e,this.notFound=404==e,this.forbidden=403==e},u.prototype.toError=function(){var e=this.req,t=e.method,i=e.url,n="cannot "+t+" "+i+" ("+this.status+")",r=new Error(n);return r.status=this.status,r.method=t,r.url=i,r},g.Response=u,b(c.prototype);for(var v in w)c.prototype[v]=w[v];c.prototype.type=function(e){return this.set("Content-Type",g.types[e]||e),this},c.prototype.responseType=function(e){return this._responseType=e,this},c.prototype.accept=function(e){return this.set("Accept",g.types[e]||e),this},c.prototype.auth=function(e,t,i){switch(i||(i={type:"basic"}),i.type){case"basic":var n=btoa(e+":"+t);this.set("Authorization","Basic "+n);break;case"auto":this.username=e,this.password=t}return this},c.prototype.query=function(e){return"string"!=typeof e&&(e=r(e)),e&&this._query.push(e),this},c.prototype.attach=function(e,t,i){return this._getFormData().append(e,t,i||t.name),this},c.prototype._getFormData=function(){return this._formData||(this._formData=new p.FormData),this._formData},c.prototype.callback=function(e,t){var i=this._callback;this.clearTimeout(),i(e,t)},c.prototype.crossDomainError=function(){var e=new Error("Request has been terminated\nPossible causes: the network is offline, Origin is not allowed by Access-Control-Allow-Origin, the page is being unloaded, etc.");e.crossDomain=!0,e.status=this.status,e.method=this.method,e.url=this.url,this.callback(e)},c.prototype._timeoutError=function(){var e=this._timeout,t=new Error("timeout of "+e+"ms exceeded");t.timeout=e,this.callback(t)},c.prototype._appendQueryString=function(){var e=this._query.join("&");e&&(this.url+=~this.url.indexOf("?")?"&"+e:"?"+e)},c.prototype.end=function(e){var t=this,i=this.xhr=g.getXHR(),r=this._timeout,s=this._formData||this._data;this._callback=e||n,i.onreadystatechange=function(){if(4==i.readyState){var e;try{e=i.status}catch(t){e=0}if(0==e){if(t.timedout)return t._timeoutError();if(t._aborted)return;return t.crossDomainError()}t.emit("end")}};var o=function(e,i){i.total>0&&(i.percent=i.loaded/i.total*100),i.direction=e,t.emit("progress",i)};if(this.hasListeners("progress"))try{i.onprogress=o.bind(null,"download"),i.upload&&(i.upload.onprogress=o.bind(null,"upload"))}catch(e){}if(r&&!this._timer&&(this._timer=setTimeout(function(){t.timedout=!0,t.abort()},r)),this._appendQueryString(),this.username&&this.password?i.open(this.method,this.url,!0,this.username,this.password):i.open(this.method,this.url,!0),this._withCredentials&&(i.withCredentials=!0),"GET"!=this.method&&"HEAD"!=this.method&&"string"!=typeof s&&!this._isHost(s)){var a=this._header["content-type"],f=this._serializer||g.serialize[a?a.split(";")[0]:""];!f&&l(a)&&(f=g.serialize["application/json"]),f&&(s=f(s))}for(var h in this.header)null!=this.header[h]&&i.setRequestHeader(h,this.header[h]);return this._responseType&&(i.responseType=this._responseType),this.emit("request",this),i.send("undefined"!=typeof s?s:null),this},g.Request=c,g.get=function(e,t,i){var n=g("GET",e);return"function"==typeof t&&(i=t,t=null),t&&n.query(t),i&&n.end(i),n},g.head=function(e,t,i){var n=g("HEAD",e);return"function"==typeof t&&(i=t,t=null),t&&n.send(t),i&&n.end(i),n},g.options=function(e,t,i){var n=g("OPTIONS",e);return"function"==typeof t&&(i=t,t=null),t&&n.send(t),i&&n.end(i),n},g.del=d,g.delete=d,g.patch=function(e,t,i){var n=g("PATCH",e);return"function"==typeof t&&(i=t,t=null),t&&n.send(t),i&&n.end(i),n},g.post=function(e,t,i){var n=g("POST",e);return"function"==typeof t&&(i=t,t=null),t&&n.send(t),i&&n.end(i),n},g.put=function(e,t,i){var n=g("PUT",e);return"function"==typeof t&&(i=t,t=null),t&&n.send(t),i&&n.end(i),n}},function(e,t,i){function n(e){if(e)return r(e)}function r(e){for(var t in n.prototype)e[t]=n.prototype[t];return e}e.exports=n,n.prototype.on=n.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},n.prototype.once=function(e,t){function i(){this.off(e,i),t.apply(this,arguments)}return i.fn=t,this.on(e,i),this},n.prototype.off=n.prototype.removeListener=n.prototype.removeAllListeners=n.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var i=this._callbacks["$"+e];if(!i)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var n,r=0;r{this.client.emit(n.Events.GUILD_CREATE,i)}):this.client.emit(n.Events.GUILD_CREATE,i)),i}newUser(e){if(this.client.users.has(e.id))return this.client.users.get(e.id);const t=new o(this.client,e);return this.client.users.set(t.id,t),t}newChannel(e,t){const i=this.client.channels.has(e.id);let r;return e.type===n.ChannelTypes.DM?r=new a(this.client,e):e.type===n.ChannelTypes.groupDM?r=new c(this.client,e):(t=t||this.client.guilds.get(e.guild_id),t&&(e.type===n.ChannelTypes.text?(r=new f(t,e),t.channels.set(r.id,r)):e.type===n.ChannelTypes.voice&&(r=new h(t,e),t.channels.set(r.id,r)))),r?(this.pastReady&&!i&&this.client.emit(n.Events.CHANNEL_CREATE,r),this.client.channels.set(r.id,r),r):null}newEmoji(e,t){const i=t.emojis.has(e.id);if(e&&!i){let i=new l(t,e);return this.client.emit(n.Events.EMOJI_CREATE,i),t.emojis.set(i.id,i),i}return i?t.emojis.get(e.id):null}killEmoji(e){e instanceof l&&e.guild&&(this.client.emit(n.Events.EMOJI_DELETE,e),e.guild.emojis.delete(e.id))}killGuild(e){const t=this.client.guilds.has(e.id);this.client.guilds.delete(e.id),t&&this.pastReady&&this.client.emit(n.Events.GUILD_DELETE,e)}killUser(e){this.client.users.delete(e.id)}killChannel(e){this.client.channels.delete(e.id),e instanceof u&&e.guild.channels.delete(e.id)}updateGuild(e,t){const i=r(e);e.setup(t),this.pastReady&&this.client.emit(n.Events.GUILD_UPDATE,i,e)}updateChannel(e,t){e.setup(t)}updateEmoji(e,t){const i=r(e);e.setup(t),this.client.emit(n.Events.GUILD_EMOJI_UPDATE,i,e)}}e.exports=d},function(e,t){e.exports=function(e){const t=Object.create(e);return Object.assign(t,e),t}},function(e,t,i){const n=i(13),r=i(26),s=i(21),o=i(24).Presence,a=i(25),l=i(5),f=i(10),h=i(46),u=i(48);class c{constructor(e,t){this.client=e,Object.defineProperty(this,"client",{enumerable:!1,configurable:!1}),this.members=new f,this.channels=new f,this.roles=new f,t&&(t.unavailable?(this.available=!1,this.id=t.id):(this.available=!0,this.setup(t)))}setup(e){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=e.large||this.large,this.presences=new f,this.features=e.features,this.emojis=new f;for(const t of e.emojis)this.emojis.set(t.id,new s(this,t));if(this.afkTimeout=e.afk_timeout,this.afkChannelID=e.afk_channel_id,this.embedEnabled=e.embed_enabled,this.verificationLevel=e.verification_level,this.joinedTimestamp=e.joined_at?new Date(e.joined_at).getTime():this.joinedTimestamp,this.id=e.id,this.available=!e.unavailable,this.features=e.features||this.features||[],e.members){this.members.clear();for(const t of e.members)this._addMember(t,!1)}if(e.owner_id&&(this.ownerID=e.owner_id),e.channels){this.channels.clear();for(const t of e.channels)this.client.dataManager.newChannel(t,this)}if(e.roles){this.roles.clear();for(const t of e.roles){const e=new r(this,t);this.roles.set(e.id,e)}}if(e.presences)for(const i of e.presences)this._setPresence(i.user.id,i);if(this._rawVoiceStates=new f,e.voice_states)for(const n of e.voice_states){this._rawVoiceStates.set(n.user_id,n);const e=this.members.get(n.user_id);e&&(e.serverMute=n.mute,e.serverDeaf=n.deaf,e.selfMute=n.self_mute,e.selfDeaf=n.self_deaf,e.voiceSessionID=n.session_id,e.voiceChannelID=n.channel_id,this.channels.get(n.channel_id).members.set(e.user.id,e))}}get createdTimestamp(){return this.id/4194304+14200704e5}get createdAt(){return new Date(this.createdTimestamp)}get joinedAt(){return new Date(this.joinedTimestamp)}get iconURL(){return this.icon?l.Endpoints.guildIcon(this.id,this.icon):null}get owner(){return this.members.get(this.ownerID)}get voiceConnection(){return this.client.voice.connections.get(this.id)||null}get defaultChannel(){return this.channels.get(this.id)}member(e){return this.client.resolver.resolveGuildMember(this,e)}fetchBans(){return this.client.rest.methods.getGuildBans(this)}fetchInvites(){return this.client.rest.methods.getGuildInvites(this)}fetchWebhooks(){return this.client.rest.methods.getGuildWebhooks(this)}fetchMember(e){return this._fetchWaiter?Promise.reject(new Error("Already fetching guild members.")):(e=this.client.resolver.resolveUser(e),e?this.members.has(e.id)?Promise.resolve(this.members.get(e.id)):this.client.rest.methods.getGuildMember(this,e):Promise.reject(new Error("User is not cached. Use Client.fetchUser first.")))}fetchMembers(e=""){return new Promise((t,i)=>{if(this._fetchWaiter)throw new Error("Already fetching guild members in ${this.id}.");return this.memberCount===this.members.size?void t(this):(this._fetchWaiter=t,this.client.ws.send({op:l.OPCodes.REQUEST_GUILD_MEMBERS,d:{guild_id:this.id,query:e,limit:0}}),this._checkChunks(),void this.client.setTimeout(()=>i(new Error("Members didn't arrive in time.")),12e4))})}edit(e){return this.client.rest.methods.updateGuild(this,e)}setName(e){return this.edit({name:e})}setRegion(e){return this.edit({region:e})}setVerificationLevel(e){return this.edit({verificationLevel:e})}setAFKChannel(e){return this.edit({afkChannel:e})}setAFKTimeout(e){return this.edit({afkTimeout:e})}setIcon(e){return this.edit({icon:e})}setOwner(e){return this.edit({owner:e})}setSplash(e){return this.edit({splash:e})}ban(e,t=0){return this.client.rest.methods.banGuildMember(this,e,t)}unban(e){return this.client.rest.methods.unbanGuildMember(this,e)}pruneMembers(e,t=false){if("number"!=typeof e)throw new TypeError("Days must be a number.");return this.client.rest.methods.pruneGuildMembers(this,e,t)}sync(){this.client.user.bot||this.client.syncGuilds([this])}createChannel(e,t){return this.client.rest.methods.createChannel(this,e,t)}createRole(e){const t=this.client.rest.methods.createGuildRole(this);return e?t.then(t=>t.edit(e)):t}createEmoji(e,t){return new Promise(i=>{e.startsWith("data:")?i(this.client.rest.methods.createEmoji(this,e,t)):this.client.resolver.resolveBuffer(e).then(e=>i(this.client.rest.methods.createEmoji(this,e,t)))})}deleteEmoji(e){return e instanceof s||(e=this.emojis.get(e)),this.client.rest.methods.deleteEmoji(e)}leave(){return this.client.rest.methods.leaveGuild(this)}delete(){return this.client.rest.methods.deleteGuild(this)}setRolePosition(e,t){if(e instanceof r)e=e.id;else if("string"!=typeof e)return Promise.reject(new Error("Supplied role is not a role or string"));if(t=Number(t),isNaN(t))return Promise.reject(new Error("Supplied position is not a number"));const i=this.roles.array().map(i=>({id:i.id,position:i.id===e?t:i.position{t.startsWith("data:")?i(this.client.rest.methods.createWebhook(this,e,t)):this.client.resolver.resolveBuffer(t).then(t=>i(this.client.rest.methods.createWebhook(this,e,t)))})}sendMessage(){}sendTTSMessage(){}sendFile(){}sendCode(){}fetchMessage(){}fetchMessages(){}fetchPinnedMessages(){}startTyping(){}stopTyping(){}get typing(){}get typingCount(){}createCollector(){}awaitMessages(){}bulkDelete(){}_cacheMessage(){}}r.applyToClass(o,!0),e.exports=o},function(e,t,i){const n=i(50),r=i(26),s=i(53),o=i(27),a=i(5),l=i(10),f=i(48);class h extends n{constructor(e,t){super(e.client,t),this.guild=e}setup(e){if(super.setup(e),this.name=e.name,this.position=e.position,this.permissionOverwrites=new l,e.permission_overwrites)for(const t of e.permission_overwrites)this.permissionOverwrites.set(t.id,new s(this,t))}permissionsFor(e){if(e=this.client.resolver.resolveGuildMember(this.guild,e),!e)return null;if(e.id===this.guild.ownerID)return new o(e,a.ALL_PERMISSIONS);let t=0;const i=e.roles;for(const n of i.values())t|=n.permissions;const r=this.overwritesFor(e,!0,i);for(const s of r.role.concat(r.member))t&=~s.denyData,t|=s.allowData;const l=Boolean(t&a.PermissionFlags.ADMINISTRATOR);return l&&(t=a.ALL_PERMISSIONS),new o(e,t)}overwritesFor(e,t=false,i=null){if(t||(e=this.client.resolver.resolveGuildMember(this.guild,e)),!e)return[];i=i||e.roles;const n=[],r=[];for(const s of this.permissionOverwrites.values())s.id===e.id?r.push(s):i.has(s.id)&&n.push(s);return{role:n,member:r}}overwritePermissions(e,t){const i={allow:0,deny:0};if(e instanceof r)i.type="role";else if(this.guild.roles.has(e))e=this.guild.roles.get(e),i.type="role";else if(e=this.client.resolver.resolveUser(e),i.type="member",!e)return Promise.reject(new TypeError("Supplied parameter was neither a User nor a Role."));i.id=e.id;const n=this.permissionOverwrites.get(e.id);n&&(i.allow=n.allowData,i.deny=n.denyData);for(const s in t)t[s]===!0?(i.allow|=a.PermissionFlags[s]||0,i.deny&=~(a.PermissionFlags[s]||0)):t[s]===!1?(i.allow&=~(a.PermissionFlags[s]||0),i.deny|=a.PermissionFlags[s]||0):null===t[s]&&(i.allow&=~(a.PermissionFlags[s]||0),i.deny&=~(a.PermissionFlags[s]||0));return this.client.rest.methods.setChannelOverwrite(this,i)}edit(e){return this.client.rest.methods.updateChannel(this,e)}setName(e){return this.edit({name:e})}setPosition(e){return this.client.rest.methods.updateChannel(this,{position:e})}setTopic(e){return this.client.rest.methods.updateChannel(this,{topic:e})}createInvite(e={}){return this.client.rest.methods.createChannelInvite(this,e)}equals(e){let t=e&&this.id===e.id&&this.type===e.type&&this.topic===e.topic&&this.position===e.position&&this.name===e.name;if(t)if(this.permissionOverwrites&&e.permissionOverwrites){const i=this.permissionOverwrites.keyArray(),n=e.permissionOverwrites.keyArray();t=f(i,n)}else t=!this.permissionOverwrites&&!e.permissionOverwrites;return t}toString(){return`<#${this.id}>`}}e.exports=h},function(e,t){class i{constructor(e,t){this.channel=e,t&&this.setup(t)}setup(e){this.id=e.id,this.type=e.type,this.denyData=e.deny,this.allowData=e.allow}delete(){return this.channel.client.rest.methods.deletePermissionOverwrites(this)}}e.exports=i},function(e,t,i){const n=i(52),r=i(10);class s extends n{constructor(e,t){super(e,t),this.members=new r,this.type="voice"}setup(e){super.setup(e),this.bitrate=e.bitrate,this.userLimit=e.user_limit}get connection(){const e=this.guild.voiceConnection;return e&&e.channel.id===this.id?e:null}get joinable(){return this.permissionsFor(this.client.user).hasPermission("CONNECT")}get speakable(){return this.permissionsFor(this.client.user).hasPermission("SPEAK")}setBitrate(e){return this.edit({bitrate:e})}setUserLimit(e){return this.edit({userLimit:e})}join(){return this.client.voice.joinChannel(this)}leave(){const e=this.client.voice.connections.get(this.guild.id);e&&e.channel.id===this.id&&e.disconnect()}}e.exports=s},function(e,t,i){const n=i(50),r=i(14),s=i(10),o=i(48);class a extends n{constructor(e,t){super(e,t),this.type="group",this.messages=new s,this._typing=new Map}setup(e){if(super.setup(e),this.name=e.name,this.icon=e.icon,this.ownerID=e.owner_id,this.recipients||(this.recipients=new s),e.recipients)for(const t of e.recipients){const e=this.client.dataManager.newUser(t);this.recipients.set(e.id,e)}this.lastMessageID=e.last_message_id}get owner(){return this.client.users.get(this.ownerID)}equals(e){const t=e&&this.id===e.id&&this.name===e.name&&this.icon===e.icon&&this.ownerID===e.ownerID;if(t){const t=this.recipients.keyArray(),i=e.recipients.keyArray();return o(t,i)}return t}toString(){return this.name}sendMessage(){}sendTTSMessage(){}sendFile(){}sendCode(){}fetchMessage(){}fetchMessages(){}fetchPinnedMessages(){}startTyping(){}stopTyping(){}get typing(){}get typingCount(){}createCollector(){}awaitMessages(){}bulkDelete(){}_cacheMessage(){}}r.applyToClass(a,!0),e.exports=a},function(e,t,i){const n=i(5);class r{constructor(e){this.client=e,this.heartbeatInterval=null}connectToWebSocket(e,t,i){this.client.emit(n.Events.DEBUG,`Authenticated using token ${e}`),this.client.token=e;const r=this.client.setTimeout(()=>i(new Error(n.Errors.TOOK_TOO_LONG)),3e5); -this.client.rest.methods.getGateway().then(s=>{this.client.emit(n.Events.DEBUG,`Using gateway ${s}`),this.client.ws.connect(s),this.client.ws.once("close",e=>{4004===e.code&&i(new Error(n.Errors.BAD_LOGIN)),4010===e.code&&i(new Error(n.Errors.INVALID_SHARD))}),this.client.once(n.Events.READY,()=>{t(e),this.client.clearTimeout(r)})},i)}setupKeepAlive(e){this.heartbeatInterval=this.client.setInterval(()=>{this.client.emit("debug","Sending heartbeat"),this.client.ws.send({op:n.OPCodes.HEARTBEAT,d:this.client.ws.sequence},!0)},e)}destroy(){return new Promise(e=>{this.client.ws.destroy(),this.client.user.bot?e():e(this.client.rest.methods.logout())})}}e.exports=r},function(e,t,i){(function(t){const n=i(15),r=i(62),s=i(40),o=i(5),a=i(63),l=i(13),f=i(16),h=i(47),u=i(50),c=i(25),d=i(21),p=i(22);class b{constructor(e){this.client=e}resolveUser(e){return e instanceof l?e:"string"==typeof e?this.client.users.get(e)||null:e instanceof c?e.user:e instanceof f?e.author:e instanceof h?e.owner:null}resolveUserID(e){return e instanceof l||e instanceof c?e.id:"string"==typeof e?e||null:e instanceof f?e.author.id:e instanceof h?e.ownerID:null}resolveGuild(e){return e instanceof h?e:"string"==typeof e?this.client.guilds.get(e)||null:null}resolveGuildMember(e,t){return t instanceof c?t:(e=this.resolveGuild(e),t=this.resolveUser(t),e&&t?e.members.get(t.id)||null:null)}resolveChannel(e){return e instanceof u?e:e instanceof f?e.channel:e instanceof h?e.channels.get(e.id)||null:"string"==typeof e?this.client.channels.get(e)||null:null}resolveInviteCode(e){const t=/discord(?:app)?\.(?:gg|com\/invite)\/([a-z0-9]{5})/i,i=t.exec(e);return i&&i[1]?i[1]:e}resolvePermission(e){if("string"==typeof e&&(e=o.PermissionFlags[e]),"number"!=typeof e||e<1)throw new Error(o.Errors.NOT_A_PERMISSION);return e}resolveString(e){return"string"==typeof e?e:e instanceof Array?e.join("\n"):String(e)}resolveBase64(e){return e instanceof t?`data:image/jpg;base64,${e.toString("base64")}`:e}resolveBuffer(e){return e instanceof t?Promise.resolve(e):this.client.browser&&e instanceof ArrayBuffer?Promise.resolve(a(e)):"string"==typeof e?new Promise((i,o)=>{if(/^https?:\/\//.test(e)){const n=s.get(e).set("Content-Type","blob");this.client.browser&&n.responseType("arraybuffer"),n.end((e,n)=>{return e?o(e):this.client.browser?i(a(n.xhr.response)):n.body instanceof t?i(n.body):o(new TypeError("Body is not a Buffer"))})}else{const t=n.resolve(e);r.stat(t,(e,n)=>{if(e&&o(e),!n||!n.isFile())throw new Error(`The file could not be found: ${t}`);r.readFile(t,(e,t)=>{e?o(e):i(t)})})}}):Promise.reject(new TypeError("The resource must be a string or Buffer."))}resolveEmojiIdentifier(e){return e instanceof d||e instanceof p?e.identifier:"string"!=typeof e||e.includes("%")?null:encodeURIComponent(e)}}e.exports=b}).call(t,i(58).Buffer)},function(e,t,i){(function(e,n){/*! +\`\`\``,i)}edit(e=this.name,t){return t?this.client.resolver.resolveBuffer(t).then(t=>{const i=this.client.resolver.resolveBase64(t);return this.client.rest.methods.editWebhook(this,e,i)}):this.client.rest.methods.editWebhook(this,e).then(e=>{return this.setup(e),this})}delete(){return this.client.rest.methods.deleteWebhook(this)}}e.exports=s},function(e,t,i){const n=i(10),r=i(33);class s{constructor(e,t){this.user=e,this.client=this.user.client,Object.defineProperty(this,"client",{enumerable:!1,configurable:!1}),this.mutualGuilds=new n,this.connections=new n,this.setup(t)}setup(e){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 i of e.connected_accounts)this.connections.set(i.id,new r(this.user,i))}}e.exports=s},function(e,t){class i{constructor(e,t){this.user=e,this.setup(t)}setup(e){this.type=e.type,this.name=e.name,this.id=e.id,this.revoked=e.revoked,this.integrations=e.integrations}}e.exports=i},function(e,t,i){const n=i(13),r=i(35);class s extends r{setup(e){super.setup(e),this.flags=e.flags,this.owner=new n(this.client,e.owner)}}e.exports=s},function(e,t){class i{constructor(e,t){this.client=e,Object.defineProperty(this,"client",{enumerable:!1,configurable:!1}),this.setup(t)}setup(e){this.id=e.id,this.name=e.name,this.description=e.description,this.icon=e.icon,this.iconURL=`https://cdn.discordapp.com/app-icons/${this.id}/${this.icon}.jpg`,this.rpcOrigins=e.rpc_origins}get createdTimestamp(){return this.id/4194304+14200704e5}get createdAt(){return new Date(this.createdTimestamp)}toString(){return this.name}}e.exports=i},function(e,t,i){const n=i(37);class r extends n{constructor(e,t){super(e,t),this.waiting=!1,this.endpoint=t,this.timeDifference=0}push(e){super.push(e),this.handle()}execute(e){return new Promise(t=>{e.request.gen().end((i,n)=>{if(n&&n.headers&&(this.requestLimit=n.headers["x-ratelimit-limit"],this.requestResetTime=1e3*Number(n.headers["x-ratelimit-reset"]),this.requestRemaining=Number(n.headers["x-ratelimit-remaining"]),this.timeDifference=Date.now()-new Date(n.headers.date).getTime()),i)429===i.status?(this.restManager.client.setTimeout(()=>{this.waiting=!1,this.globalLimit=!1,t()},Number(n.headers["retry-after"])+500),n.headers["x-ratelimit-global"]&&(this.globalLimit=!0)):(this.queue.shift(),this.waiting=!1,e.reject(i),t(i));else{this.queue.shift(),this.globalLimit=!1;const i=n&&n.body?n.body:{};e.resolve(i),0===this.requestRemaining?this.restManager.client.setTimeout(()=>{this.waiting=!1,t(i)},this.requestResetTime-Date.now()+this.timeDifference+1e3):(this.waiting=!1,t(i))}})})}handle(){if(super.handle(),!this.waiting&&0!==this.queue.length&&!this.globalLimit){this.waiting=!0;const e=this.queue[0];this.execute(e).then(()=>this.handle())}}}e.exports=r},function(e,t){class i{constructor(e){this.restManager=e,this.queue=[]}get globalLimit(){return this.restManager.globallyRateLimited}set globalLimit(e){this.restManager.globallyRateLimited=e}push(e){this.queue.push(e)}handle(){}}e.exports=i},function(e,t,i){const n=i(37);class r extends n{constructor(e,t){super(e,t),this.requestRemaining=1,this.first=!0}push(e){super.push(e),this.handle()}handleNext(e){this.waiting||(this.waiting=!0,this.restManager.client.setTimeout(()=>{this.requestRemaining=this.requestLimit,this.waiting=!1,this.handle()},e))}execute(e){e.request.gen().end((t,i)=>{if(i&&i.headers&&(this.requestLimit=i.headers["x-ratelimit-limit"],this.requestResetTime=1e3*Number(i.headers["x-ratelimit-reset"]),this.requestRemaining=Number(i.headers["x-ratelimit-remaining"]),this.timeDifference=Date.now()-new Date(i.headers.date).getTime(),this.handleNext(this.requestResetTime-Date.now()+this.timeDifference+1e3)),t)429===t.status?(this.requestRemaining=0,this.queue.unshift(e),this.restManager.client.setTimeout(()=>{this.globalLimit=!1,this.handle()},Number(i.headers["retry-after"])+500),i.headers["x-ratelimit-global"]&&(this.globalLimit=!0)):e.reject(t);else{this.globalLimit=!1;const t=i&&i.body?i.body:{};e.resolve(t),this.first&&(this.first=!1,this.handle())}})}handle(){if(super.handle(),!(this.requestRemaining<1||0===this.queue.length||this.globalLimit))for(;this.queue.length>0&&this.requestRemaining>0;)this.execute(this.queue.shift()),this.requestRemaining--}}e.exports=r},function(e,t,i){function n(e){let t=e.split("?")[0];if(t.includes("/channels/")||t.includes("/guilds/")){const e=~t.indexOf("/channels/")?t.indexOf("/channels/"):t.indexOf("/guilds/"),i=t.substring(e).split("/")[2];t=t.replace(/(\d{8,})/g,":id").replace(":id",i)}return t}const r=i(40),s=i(5);class o{constructor(e,t,i,r,s,o){this.rest=e,this.method=t,this.url=i,this.auth=r,this.data=s,this.file=o,this.route=n(this.url)}getAuth(){if(this.rest.client.token&&this.rest.client.user&&this.rest.client.user.bot)return`Bot ${this.rest.client.token}`;if(this.rest.client.token)return this.rest.client.token;throw new Error(s.Errors.NO_TOKEN)}gen(){const e=r[this.method](this.url);if(this.auth&&e.set("authorization",this.getAuth()),this.file&&this.file.file){e.attach("file",this.file.file,this.file.name),this.data=this.data||{};for(const t in this.data)this.data[t]&&e.field(t,this.data[t])}else this.data&&e.send(this.data);return e.set("User-Agent",this.rest.userAgentManager.userAgent),e}}e.exports=o},function(e,t,i){function n(){}function r(e){if(!m(e))return e;var t=[];for(var i in e)s(t,i,e[i]);return t.join("&")}function s(e,t,i){if(null!=i)if(Array.isArray(i))i.forEach(function(i){s(e,t,i)});else if(m(i))for(var n in i)s(e,t+"["+n+"]",i[n]);else e.push(encodeURIComponent(t)+"="+encodeURIComponent(i));else null===i&&e.push(encodeURIComponent(t))}function o(e){for(var t,i,n={},r=e.split("&"),s=0,o=r.length;s=300)&&(n=new Error(t.statusText||"Unsuccessful HTTP response"),n.original=e,n.response=t,n.status=t.status)}catch(e){n=e}n?i.callback(n,t):i.callback(null,t)})}function d(e,t){var i=g("DELETE",e);return t&&i.end(t),i}var p;"undefined"!=typeof window?p=window:"undefined"!=typeof self?p=self:(console.warn("Using browser-only version of superagent in non-browser environment"),p=this);var b=i(41),w=i(42),m=i(43),g=e.exports=i(44).bind(null,c);g.getXHR=function(){if(!(!p.XMLHttpRequest||p.location&&"file:"==p.location.protocol&&p.ActiveXObject))return new XMLHttpRequest;try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(e){}try{return new ActiveXObject("Msxml2.XMLHTTP.6.0")}catch(e){}try{return new ActiveXObject("Msxml2.XMLHTTP.3.0")}catch(e){}try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(e){}throw Error("Browser-only verison of superagent could not find XHR")};var _="".trim?function(e){return e.trim()}:function(e){return e.replace(/(^\s*|\s*$)/g,"")};g.serializeObject=r,g.parseString=o,g.types={html:"text/html",json:"application/json",xml:"application/xml",urlencoded:"application/x-www-form-urlencoded",form:"application/x-www-form-urlencoded","form-data":"application/x-www-form-urlencoded"},g.serialize={"application/x-www-form-urlencoded":r,"application/json":JSON.stringify},g.parse={"application/x-www-form-urlencoded":o,"application/json":JSON.parse},u.prototype.get=function(e){return this.header[e.toLowerCase()]},u.prototype._setHeaderProperties=function(e){var t=this.header["content-type"]||"";this.type=f(t);var i=h(t);for(var n in i)this[n]=i[n]},u.prototype._parseBody=function(e){var t=g.parse[this.type];return!t&&l(this.type)&&(t=g.parse["application/json"]),t&&e&&(e.length||e instanceof Object)?t(e):null},u.prototype._setStatusProperties=function(e){1223===e&&(e=204);var t=e/100|0;this.status=this.statusCode=e,this.statusType=t,this.info=1==t,this.ok=2==t,this.clientError=4==t,this.serverError=5==t,this.error=(4==t||5==t)&&this.toError(),this.accepted=202==e,this.noContent=204==e,this.badRequest=400==e,this.unauthorized=401==e,this.notAcceptable=406==e,this.notFound=404==e,this.forbidden=403==e},u.prototype.toError=function(){var e=this.req,t=e.method,i=e.url,n="cannot "+t+" "+i+" ("+this.status+")",r=new Error(n);return r.status=this.status,r.method=t,r.url=i,r},g.Response=u,b(c.prototype),w(c.prototype),c.prototype.type=function(e){return this.set("Content-Type",g.types[e]||e),this},c.prototype.responseType=function(e){return this._responseType=e,this},c.prototype.accept=function(e){return this.set("Accept",g.types[e]||e),this},c.prototype.auth=function(e,t,i){switch(i||(i={type:"basic"}),i.type){case"basic":var n=btoa(e+":"+t);this.set("Authorization","Basic "+n);break;case"auto":this.username=e,this.password=t}return this},c.prototype.query=function(e){return"string"!=typeof e&&(e=r(e)),e&&this._query.push(e),this},c.prototype.attach=function(e,t,i){if(this._data)throw Error("superagent can't mix .send() and .attach()");return this._getFormData().append(e,t,i||t.name),this},c.prototype._getFormData=function(){return this._formData||(this._formData=new p.FormData),this._formData},c.prototype.callback=function(e,t){var i=this._callback;this.clearTimeout(),e&&this.emit("error",e),i(e,t)},c.prototype.crossDomainError=function(){var e=new Error("Request has been terminated\nPossible causes: the network is offline, Origin is not allowed by Access-Control-Allow-Origin, the page is being unloaded, etc.");e.crossDomain=!0,e.status=this.status,e.method=this.method,e.url=this.url,this.callback(e)},c.prototype.buffer=c.prototype.ca=c.prototype.agent=function(){return console.warn("This is not supported in browser version of superagent"),this},c.prototype.pipe=c.prototype.write=function(){throw Error("Streaming is not supported in browser version of superagent")},c.prototype._timeoutError=function(){var e=this._timeout,t=new Error("timeout of "+e+"ms exceeded");t.timeout=e,this.callback(t)},c.prototype._appendQueryString=function(){var e=this._query.join("&");e&&(this.url+=~this.url.indexOf("?")?"&"+e:"?"+e)},c.prototype._isHost=function(e){return e&&"object"==typeof e&&!Array.isArray(e)&&"[object Object]"!==Object.prototype.toString.call(e)},c.prototype.end=function(e){var t=this,i=this.xhr=g.getXHR(),r=this._timeout,s=this._formData||this._data;this._callback=e||n,i.onreadystatechange=function(){if(4==i.readyState){var e;try{e=i.status}catch(t){e=0}if(0==e){if(t.timedout)return t._timeoutError();if(t._aborted)return;return t.crossDomainError()}t.emit("end")}};var o=function(e,i){i.total>0&&(i.percent=i.loaded/i.total*100),i.direction=e,t.emit("progress",i)};if(this.hasListeners("progress"))try{i.onprogress=o.bind(null,"download"),i.upload&&(i.upload.onprogress=o.bind(null,"upload"))}catch(e){}if(r&&!this._timer&&(this._timer=setTimeout(function(){t.timedout=!0,t.abort()},r)),this._appendQueryString(),this.username&&this.password?i.open(this.method,this.url,!0,this.username,this.password):i.open(this.method,this.url,!0),this._withCredentials&&(i.withCredentials=!0),"GET"!=this.method&&"HEAD"!=this.method&&"string"!=typeof s&&!this._isHost(s)){var a=this._header["content-type"],f=this._serializer||g.serialize[a?a.split(";")[0]:""];!f&&l(a)&&(f=g.serialize["application/json"]),f&&(s=f(s))}for(var h in this.header)null!=this.header[h]&&i.setRequestHeader(h,this.header[h]);return this._responseType&&(i.responseType=this._responseType),this.emit("request",this),i.send("undefined"!=typeof s?s:null),this},g.Request=c,g.get=function(e,t,i){var n=g("GET",e);return"function"==typeof t&&(i=t,t=null),t&&n.query(t),i&&n.end(i),n},g.head=function(e,t,i){var n=g("HEAD",e);return"function"==typeof t&&(i=t,t=null),t&&n.send(t),i&&n.end(i),n},g.options=function(e,t,i){var n=g("OPTIONS",e);return"function"==typeof t&&(i=t,t=null),t&&n.send(t),i&&n.end(i),n},g.del=d,g.delete=d,g.patch=function(e,t,i){var n=g("PATCH",e);return"function"==typeof t&&(i=t,t=null),t&&n.send(t),i&&n.end(i),n},g.post=function(e,t,i){var n=g("POST",e);return"function"==typeof t&&(i=t,t=null),t&&n.send(t),i&&n.end(i),n},g.put=function(e,t,i){var n=g("PUT",e);return"function"==typeof t&&(i=t,t=null),t&&n.send(t),i&&n.end(i),n}},function(e,t,i){function n(e){if(e)return r(e)}function r(e){for(var t in n.prototype)e[t]=n.prototype[t];return e}e.exports=n,n.prototype.on=n.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},n.prototype.once=function(e,t){function i(){this.off(e,i),t.apply(this,arguments)}return i.fn=t,this.on(e,i),this},n.prototype.off=n.prototype.removeListener=n.prototype.removeAllListeners=n.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var i=this._callbacks["$"+e];if(!i)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var n,r=0;r{this.client.emit(n.Events.GUILD_CREATE,i)}):this.client.emit(n.Events.GUILD_CREATE,i)),i}newUser(e){if(this.client.users.has(e.id))return this.client.users.get(e.id);const t=new o(this.client,e);return this.client.users.set(t.id,t),t}newChannel(e,t){const i=this.client.channels.has(e.id);let r;return e.type===n.ChannelTypes.DM?r=new a(this.client,e):e.type===n.ChannelTypes.groupDM?r=new c(this.client,e):(t=t||this.client.guilds.get(e.guild_id),t&&(e.type===n.ChannelTypes.text?(r=new f(t,e),t.channels.set(r.id,r)):e.type===n.ChannelTypes.voice&&(r=new h(t,e),t.channels.set(r.id,r)))),r?(this.pastReady&&!i&&this.client.emit(n.Events.CHANNEL_CREATE,r),this.client.channels.set(r.id,r),r):null}newEmoji(e,t){const i=t.emojis.has(e.id);if(e&&!i){let i=new l(t,e);return this.client.emit(n.Events.EMOJI_CREATE,i),t.emojis.set(i.id,i),i}return i?t.emojis.get(e.id):null}killEmoji(e){e instanceof l&&e.guild&&(this.client.emit(n.Events.EMOJI_DELETE,e),e.guild.emojis.delete(e.id))}killGuild(e){const t=this.client.guilds.has(e.id);this.client.guilds.delete(e.id),t&&this.pastReady&&this.client.emit(n.Events.GUILD_DELETE,e)}killUser(e){this.client.users.delete(e.id)}killChannel(e){this.client.channels.delete(e.id),e instanceof u&&e.guild.channels.delete(e.id)}updateGuild(e,t){const i=r(e);e.setup(t),this.pastReady&&this.client.emit(n.Events.GUILD_UPDATE,i,e)}updateChannel(e,t){e.setup(t)}updateEmoji(e,t){const i=r(e);e.setup(t),this.client.emit(n.Events.GUILD_EMOJI_UPDATE,i,e)}}e.exports=d},function(e,t){e.exports=function(e){const t=Object.create(e);return Object.assign(t,e),t}},function(e,t,i){const n=i(13),r=i(26),s=i(21),o=i(24).Presence,a=i(25),l=i(5),f=i(10),h=i(46),u=i(48);class c{constructor(e,t){this.client=e,Object.defineProperty(this,"client",{enumerable:!1,configurable:!1}),this.members=new f,this.channels=new f,this.roles=new f,t&&(t.unavailable?(this.available=!1,this.id=t.id):(this.available=!0,this.setup(t)))}setup(e){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=e.large||this.large,this.presences=new f,this.features=e.features,this.emojis=new f;for(const t of e.emojis)this.emojis.set(t.id,new s(this,t));if(this.afkTimeout=e.afk_timeout,this.afkChannelID=e.afk_channel_id,this.embedEnabled=e.embed_enabled,this.verificationLevel=e.verification_level,this.joinedTimestamp=e.joined_at?new Date(e.joined_at).getTime():this.joinedTimestamp,this.id=e.id,this.available=!e.unavailable,this.features=e.features||this.features||[],e.members){this.members.clear();for(const t of e.members)this._addMember(t,!1)}if(e.owner_id&&(this.ownerID=e.owner_id),e.channels){this.channels.clear();for(const t of e.channels)this.client.dataManager.newChannel(t,this)}if(e.roles){this.roles.clear();for(const t of e.roles){const e=new r(this,t);this.roles.set(e.id,e)}}if(e.presences)for(const i of e.presences)this._setPresence(i.user.id,i);if(this._rawVoiceStates=new f,e.voice_states)for(const n of e.voice_states){this._rawVoiceStates.set(n.user_id,n);const e=this.members.get(n.user_id);e&&(e.serverMute=n.mute,e.serverDeaf=n.deaf,e.selfMute=n.self_mute,e.selfDeaf=n.self_deaf,e.voiceSessionID=n.session_id,e.voiceChannelID=n.channel_id,this.channels.get(n.channel_id).members.set(e.user.id,e))}}get createdTimestamp(){return this.id/4194304+14200704e5}get createdAt(){return new Date(this.createdTimestamp)}get joinedAt(){return new Date(this.joinedTimestamp)}get iconURL(){return this.icon?l.Endpoints.guildIcon(this.id,this.icon):null}get owner(){return this.members.get(this.ownerID)}get voiceConnection(){return this.client.voice.connections.get(this.id)||null}get defaultChannel(){return this.channels.get(this.id)}member(e){return this.client.resolver.resolveGuildMember(this,e)}fetchBans(){return this.client.rest.methods.getGuildBans(this)}fetchInvites(){return this.client.rest.methods.getGuildInvites(this)}fetchWebhooks(){return this.client.rest.methods.getGuildWebhooks(this)}fetchMember(e){return this._fetchWaiter?Promise.reject(new Error("Already fetching guild members.")):(e=this.client.resolver.resolveUser(e),e?this.members.has(e.id)?Promise.resolve(this.members.get(e.id)):this.client.rest.methods.getGuildMember(this,e):Promise.reject(new Error("User is not cached. Use Client.fetchUser first.")))}fetchMembers(e=""){return new Promise((t,i)=>{if(this._fetchWaiter)throw new Error("Already fetching guild members in ${this.id}.");return this.memberCount===this.members.size?void t(this):(this._fetchWaiter=t,this.client.ws.send({op:l.OPCodes.REQUEST_GUILD_MEMBERS,d:{guild_id:this.id,query:e,limit:0}}),this._checkChunks(),void this.client.setTimeout(()=>i(new Error("Members didn't arrive in time.")),12e4))})}edit(e){return this.client.rest.methods.updateGuild(this,e)}setName(e){return this.edit({name:e})}setRegion(e){return this.edit({region:e})}setVerificationLevel(e){return this.edit({verificationLevel:e})}setAFKChannel(e){return this.edit({afkChannel:e})}setAFKTimeout(e){return this.edit({afkTimeout:e})}setIcon(e){return this.edit({icon:e})}setOwner(e){return this.edit({owner:e})}setSplash(e){return this.edit({splash:e})}ban(e,t=0){return this.client.rest.methods.banGuildMember(this,e,t)}unban(e){return this.client.rest.methods.unbanGuildMember(this,e)}pruneMembers(e,t=false){if("number"!=typeof e)throw new TypeError("Days must be a number.");return this.client.rest.methods.pruneGuildMembers(this,e,t)}sync(){this.client.user.bot||this.client.syncGuilds([this])}createChannel(e,t){return this.client.rest.methods.createChannel(this,e,t)}createRole(e){const t=this.client.rest.methods.createGuildRole(this);return e?t.then(t=>t.edit(e)):t}createEmoji(e,t){return new Promise(i=>{e.startsWith("data:")?i(this.client.rest.methods.createEmoji(this,e,t)):this.client.resolver.resolveBuffer(e).then(e=>i(this.client.rest.methods.createEmoji(this,e,t)))})}deleteEmoji(e){return e instanceof s||(e=this.emojis.get(e)),this.client.rest.methods.deleteEmoji(e)}leave(){return this.client.rest.methods.leaveGuild(this)}delete(){return this.client.rest.methods.deleteGuild(this)}setRolePosition(e,t){if(e instanceof r)e=e.id;else if("string"!=typeof e)return Promise.reject(new Error("Supplied role is not a role or string"));if(t=Number(t),isNaN(t))return Promise.reject(new Error("Supplied position is not a number"));const i=this.roles.array().map(i=>({id:i.id,position:i.id===e?t:i.position{t.startsWith("data:")?i(this.client.rest.methods.createWebhook(this,e,t)):this.client.resolver.resolveBuffer(t).then(t=>i(this.client.rest.methods.createWebhook(this,e,t)))})}sendMessage(){}sendTTSMessage(){}sendFile(){}sendCode(){}fetchMessage(){}fetchMessages(){}fetchPinnedMessages(){}startTyping(){}stopTyping(){}get typing(){}get typingCount(){}createCollector(){}awaitMessages(){}bulkDelete(){}_cacheMessage(){}}r.applyToClass(o,!0),e.exports=o},function(e,t,i){const n=i(50),r=i(26),s=i(53),o=i(27),a=i(5),l=i(10),f=i(48);class h extends n{constructor(e,t){super(e.client,t),this.guild=e}setup(e){if(super.setup(e),this.name=e.name,this.position=e.position,this.permissionOverwrites=new l,e.permission_overwrites)for(const t of e.permission_overwrites)this.permissionOverwrites.set(t.id,new s(this,t))}permissionsFor(e){if(e=this.client.resolver.resolveGuildMember(this.guild,e),!e)return null;if(e.id===this.guild.ownerID)return new o(e,a.ALL_PERMISSIONS);let t=0;const i=e.roles;for(const n of i.values())t|=n.permissions;const r=this.overwritesFor(e,!0,i);for(const s of r.role.concat(r.member))t&=~s.denyData,t|=s.allowData;const l=Boolean(t&a.PermissionFlags.ADMINISTRATOR);return l&&(t=a.ALL_PERMISSIONS),new o(e,t)}overwritesFor(e,t=false,i=null){if(t||(e=this.client.resolver.resolveGuildMember(this.guild,e)),!e)return[];i=i||e.roles;const n=[],r=[];for(const s of this.permissionOverwrites.values())s.id===e.id?r.push(s):i.has(s.id)&&n.push(s);return{role:n,member:r}}overwritePermissions(e,t){const i={allow:0,deny:0};if(e instanceof r)i.type="role";else if(this.guild.roles.has(e))e=this.guild.roles.get(e),i.type="role";else if(e=this.client.resolver.resolveUser(e),i.type="member",!e)return Promise.reject(new TypeError("Supplied parameter was neither a User nor a Role."));i.id=e.id;const n=this.permissionOverwrites.get(e.id);n&&(i.allow=n.allowData,i.deny=n.denyData);for(const s in t)t[s]===!0?(i.allow|=a.PermissionFlags[s]||0,i.deny&=~(a.PermissionFlags[s]||0)):t[s]===!1?(i.allow&=~(a.PermissionFlags[s]||0),i.deny|=a.PermissionFlags[s]||0):null===t[s]&&(i.allow&=~(a.PermissionFlags[s]||0),i.deny&=~(a.PermissionFlags[s]||0));return this.client.rest.methods.setChannelOverwrite(this,i)}edit(e){return this.client.rest.methods.updateChannel(this,e)}setName(e){return this.edit({name:e})}setPosition(e){return this.client.rest.methods.updateChannel(this,{position:e})}setTopic(e){return this.client.rest.methods.updateChannel(this,{topic:e})}createInvite(e={}){return this.client.rest.methods.createChannelInvite(this,e)}equals(e){let t=e&&this.id===e.id&&this.type===e.type&&this.topic===e.topic&&this.position===e.position&&this.name===e.name;if(t)if(this.permissionOverwrites&&e.permissionOverwrites){const i=this.permissionOverwrites.keyArray(),n=e.permissionOverwrites.keyArray();t=f(i,n)}else t=!this.permissionOverwrites&&!e.permissionOverwrites;return t}toString(){return`<#${this.id}>`}}e.exports=h},function(e,t){class i{constructor(e,t){this.channel=e,t&&this.setup(t)}setup(e){this.id=e.id,this.type=e.type,this.denyData=e.deny,this.allowData=e.allow}delete(){return this.channel.client.rest.methods.deletePermissionOverwrites(this)}}e.exports=i},function(e,t,i){const n=i(52),r=i(10);class s extends n{constructor(e,t){super(e,t),this.members=new r,this.type="voice"}setup(e){super.setup(e),this.bitrate=e.bitrate,this.userLimit=e.user_limit}get connection(){const e=this.guild.voiceConnection;return e&&e.channel.id===this.id?e:null}get joinable(){return this.permissionsFor(this.client.user).hasPermission("CONNECT")}get speakable(){return this.permissionsFor(this.client.user).hasPermission("SPEAK")}setBitrate(e){return this.edit({bitrate:e})}setUserLimit(e){return this.edit({userLimit:e})}join(){return this.client.voice.joinChannel(this)}leave(){const e=this.client.voice.connections.get(this.guild.id);e&&e.channel.id===this.id&&e.disconnect()}}e.exports=s},function(e,t,i){const n=i(50),r=i(14),s=i(10),o=i(48);class a extends n{constructor(e,t){super(e,t),this.type="group",this.messages=new s,this._typing=new Map}setup(e){if(super.setup(e),this.name=e.name,this.icon=e.icon,this.ownerID=e.owner_id,this.recipients||(this.recipients=new s),e.recipients)for(const t of e.recipients){const e=this.client.dataManager.newUser(t); +this.recipients.set(e.id,e)}this.lastMessageID=e.last_message_id}get owner(){return this.client.users.get(this.ownerID)}equals(e){const t=e&&this.id===e.id&&this.name===e.name&&this.icon===e.icon&&this.ownerID===e.ownerID;if(t){const t=this.recipients.keyArray(),i=e.recipients.keyArray();return o(t,i)}return t}toString(){return this.name}sendMessage(){}sendTTSMessage(){}sendFile(){}sendCode(){}fetchMessage(){}fetchMessages(){}fetchPinnedMessages(){}startTyping(){}stopTyping(){}get typing(){}get typingCount(){}createCollector(){}awaitMessages(){}bulkDelete(){}_cacheMessage(){}}r.applyToClass(a,!0),e.exports=a},function(e,t,i){const n=i(5);class r{constructor(e){this.client=e,this.heartbeatInterval=null}connectToWebSocket(e,t,i){this.client.emit(n.Events.DEBUG,`Authenticated using token ${e}`),this.client.token=e;const r=this.client.setTimeout(()=>i(new Error(n.Errors.TOOK_TOO_LONG)),3e5);this.client.rest.methods.getGateway().then(s=>{this.client.emit(n.Events.DEBUG,`Using gateway ${s}`),this.client.ws.connect(s),this.client.ws.once("close",e=>{4004===e.code&&i(new Error(n.Errors.BAD_LOGIN)),4010===e.code&&i(new Error(n.Errors.INVALID_SHARD))}),this.client.once(n.Events.READY,()=>{t(e),this.client.clearTimeout(r)})},i)}setupKeepAlive(e){this.heartbeatInterval=this.client.setInterval(()=>{this.client.emit("debug","Sending heartbeat"),this.client.ws.send({op:n.OPCodes.HEARTBEAT,d:this.client.ws.sequence},!0)},e)}destroy(){return new Promise(e=>{this.client.ws.destroy(),this.client.user.bot?e():e(this.client.rest.methods.logout())})}}e.exports=r},function(e,t,i){(function(t){const n=i(15),r=i(62),s=i(40),o=i(5),a=i(63),l=i(13),f=i(16),h=i(47),u=i(50),c=i(25),d=i(21),p=i(22);class b{constructor(e){this.client=e}resolveUser(e){return e instanceof l?e:"string"==typeof e?this.client.users.get(e)||null:e instanceof c?e.user:e instanceof f?e.author:e instanceof h?e.owner:null}resolveUserID(e){return e instanceof l||e instanceof c?e.id:"string"==typeof e?e||null:e instanceof f?e.author.id:e instanceof h?e.ownerID:null}resolveGuild(e){return e instanceof h?e:"string"==typeof e?this.client.guilds.get(e)||null:null}resolveGuildMember(e,t){return t instanceof c?t:(e=this.resolveGuild(e),t=this.resolveUser(t),e&&t?e.members.get(t.id)||null:null)}resolveChannel(e){return e instanceof u?e:e instanceof f?e.channel:e instanceof h?e.channels.get(e.id)||null:"string"==typeof e?this.client.channels.get(e)||null:null}resolveInviteCode(e){const t=/discord(?:app)?\.(?:gg|com\/invite)\/([a-z0-9]{5})/i,i=t.exec(e);return i&&i[1]?i[1]:e}resolvePermission(e){if("string"==typeof e&&(e=o.PermissionFlags[e]),"number"!=typeof e||e<1)throw new Error(o.Errors.NOT_A_PERMISSION);return e}resolveString(e){return"string"==typeof e?e:e instanceof Array?e.join("\n"):String(e)}resolveBase64(e){return e instanceof t?`data:image/jpg;base64,${e.toString("base64")}`:e}resolveBuffer(e){return e instanceof t?Promise.resolve(e):this.client.browser&&e instanceof ArrayBuffer?Promise.resolve(a(e)):"string"==typeof e?new Promise((i,o)=>{if(/^https?:\/\//.test(e)){const n=s.get(e).set("Content-Type","blob");this.client.browser&&n.responseType("arraybuffer"),n.end((e,n)=>{return e?o(e):this.client.browser?i(a(n.xhr.response)):n.body instanceof t?i(n.body):o(new TypeError("Body is not a Buffer"))})}else{const t=n.resolve(e);r.stat(t,(e,n)=>{if(e&&o(e),!n||!n.isFile())throw new Error(`The file could not be found: ${t}`);r.readFile(t,(e,t)=>{e?o(e):i(t)})})}}):Promise.reject(new TypeError("The resource must be a string or Buffer."))}resolveEmojiIdentifier(e){return e instanceof d||e instanceof p?e.identifier:"string"!=typeof e||e.includes("%")?null:encodeURIComponent(e)}}e.exports=b}).call(t,i(58).Buffer)},function(e,t,i){(function(e,n){/*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh