From ce6818122951a07019fa74986ad7fa618dac704d Mon Sep 17 00:00:00 2001 From: Travis CI Date: Sun, 2 Jul 2017 00:34:46 +0000 Subject: [PATCH] Webpack build for branch master: 8da557faabb1029e0129d6fd1dfba0329208b9bd --- discord.master.js | 2 +- discord.master.min.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/discord.master.js b/discord.master.js index 9df545e7..85a430a5 100644 --- a/discord.master.js +++ b/discord.master.js @@ -18337,7 +18337,7 @@ class Client extends EventEmitter { * @returns {Promise} */ fetchApplication(id = '@me') { - return this.api.oauth2.applications(id).get() + return this.api.oauth2.applications[id].get() .then(app => new OAuth2Application(this, app)); } diff --git a/discord.master.min.js b/discord.master.min.js index a5ee867a..f8588df5 100644 --- a/discord.master.min.js +++ b/discord.master.min.js @@ -12,7 +12,7 @@ ${this.constructor.flattenErrors(e.errors).join("\n")}`:"";this.name="DiscordAPI * Released under the Apache License, Version 2.0 * see: https://github.com/dcodeIO/long.js for details */ -!function(n,o){s=[],i=o,void 0!==(r="function"==typeof i?i.apply(e,s):i)&&(t.exports=r)}(0,function(){"use strict";function t(t,e,n){this.low=0|t,this.high=0|e,this.unsigned=!!n}function e(t){return!0===(t&&t.__isLong__)}function n(t,e){var n,i,r;return e?(t>>>=0,(r=0<=t&&t<256)&&(i=c[t])?i:(n=s(t,(0|t)<0?-1:0,!0),r&&(c[t]=n),n)):(t|=0,(r=-128<=t&&t<128)&&(i=a[t])?i:(n=s(t,t<0?-1:0,!1),r&&(a[t]=n),n))}function i(t,e){if(isNaN(t)||!isFinite(t))return e?m:f;if(e){if(t<0)return m;if(t>=h)return b}else{if(t<=-p)return w;if(t+1>=p)return _}return t<0?i(-t,e).neg():s(t%u|0,t/u|0,e)}function s(e,n,i){return new t(e,n,i)}function r(t,e,n){if(0===t.length)throw Error("empty string");if("NaN"===t||"Infinity"===t||"+Infinity"===t||"-Infinity"===t)return f;if("number"==typeof e?(n=e,e=!1):e=!!e,(n=n||10)<2||360)throw Error("interior hyphen");if(0===s)return r(t.substring(1),e,n).neg();for(var o=i(l(n,8)),a=f,c=0;c>>0:this.low},y.toNumber=function(){return this.unsigned?(this.high>>>0)*u+(this.low>>>0):this.high*u+(this.low>>>0)},y.toString=function(t){if((t=t||10)<2||36>>0,h=u.toString(t);if(o=c,o.isZero())return h+a;for(;h.length<6;)h="0"+h;a=""+h+a}},y.getHighBits=function(){return this.high},y.getHighBitsUnsigned=function(){return this.high>>>0},y.getLowBits=function(){return this.low},y.getLowBitsUnsigned=function(){return this.low>>>0},y.getNumBitsAbs=function(){if(this.isNegative())return this.eq(w)?64:this.neg().getNumBitsAbs();for(var t=0!=this.high?this.high:this.low,e=31;e>0&&0==(t&1<=0},y.isOdd=function(){return 1==(1&this.low)},y.isEven=function(){return 0==(1&this.low)},y.equals=function(t){return e(t)||(t=o(t)),(this.unsigned===t.unsigned||this.high>>>31!=1||t.high>>>31!=1)&&(this.high===t.high&&this.low===t.low)},y.eq=y.equals,y.notEquals=function(t){return!this.eq(t)},y.neq=y.notEquals,y.lessThan=function(t){return this.comp(t)<0},y.lt=y.lessThan,y.lessThanOrEqual=function(t){return this.comp(t)<=0},y.lte=y.lessThanOrEqual,y.greaterThan=function(t){return this.comp(t)>0},y.gt=y.greaterThan,y.greaterThanOrEqual=function(t){return this.comp(t)>=0},y.gte=y.greaterThanOrEqual,y.compare=function(t){if(e(t)||(t=o(t)),this.eq(t))return 0;var n=this.isNegative(),i=t.isNegative();return n&&!i?-1:!n&&i?1:this.unsigned?t.high>>>0>this.high>>>0||t.high===this.high&&t.low>>>0>this.low>>>0?-1:1:this.sub(t).isNegative()?-1:1},y.comp=y.compare,y.negate=function(){return!this.unsigned&&this.eq(w)?w:this.not().add(g)},y.neg=y.negate,y.add=function(t){e(t)||(t=o(t));var n=this.high>>>16,i=65535&this.high,r=this.low>>>16,a=65535&this.low,c=t.high>>>16,l=65535&t.high,u=t.low>>>16,h=65535&t.low,p=0,d=0,f=0,m=0;return m+=a+h,f+=m>>>16,m&=65535,f+=r+u,d+=f>>>16,f&=65535,d+=i+l,p+=d>>>16,d&=65535,p+=n+c,p&=65535,s(f<<16|m,p<<16|d,this.unsigned)},y.subtract=function(t){return e(t)||(t=o(t)),this.add(t.neg())},y.sub=y.subtract,y.multiply=function(t){if(this.isZero())return f;if(e(t)||(t=o(t)),t.isZero())return f;if(this.eq(w))return t.isOdd()?w:f;if(t.eq(w))return this.isOdd()?w:f;if(this.isNegative())return t.isNegative()?this.neg().mul(t.neg()):this.neg().mul(t).neg();if(t.isNegative())return this.mul(t.neg()).neg();if(this.lt(d)&&t.lt(d))return i(this.toNumber()*t.toNumber(),this.unsigned);var n=this.high>>>16,r=65535&this.high,a=this.low>>>16,c=65535&this.low,l=t.high>>>16,u=65535&t.high,h=t.low>>>16,p=65535&t.low,m=0,g=0,v=0,E=0;return E+=c*p,v+=E>>>16,E&=65535,v+=a*p,g+=v>>>16,v&=65535,v+=c*h,g+=v>>>16,v&=65535,g+=r*p,m+=g>>>16,g&=65535,g+=a*h,m+=g>>>16,g&=65535,g+=c*u,m+=g>>>16,g&=65535,m+=n*p+r*h+a*u+c*l,m&=65535,s(v<<16|E,m<<16|g,this.unsigned)},y.mul=y.multiply,y.divide=function(t){if(e(t)||(t=o(t)),t.isZero())throw Error("division by zero");if(this.isZero())return this.unsigned?m:f;var n,s,r;if(this.unsigned){if(t.unsigned||(t=t.toUnsigned()),t.gt(this))return m;if(t.gt(this.shru(1)))return v;r=m}else{if(this.eq(w)){if(t.eq(g)||t.eq(E))return w;if(t.eq(w))return g;return n=this.shr(1).div(t).shl(1),n.eq(f)?t.isNegative()?g:E:(s=this.sub(t.mul(n)),r=n.add(s.div(t)))}if(t.eq(w))return this.unsigned?m:f;if(this.isNegative())return t.isNegative()?this.neg().div(t.neg()):this.neg().div(t).neg();if(t.isNegative())return this.div(t.neg()).neg();r=f}for(s=this;s.gte(t);){n=Math.max(1,Math.floor(s.toNumber()/t.toNumber()));for(var a=Math.ceil(Math.log(n)/Math.LN2),c=a<=48?1:l(2,a-48),u=i(n),h=u.mul(t);h.isNegative()||h.gt(s);)n-=c,u=i(n,this.unsigned),h=u.mul(t);u.isZero()&&(u=g),r=r.add(u),s=s.sub(h)}return r},y.div=y.divide,y.modulo=function(t){return e(t)||(t=o(t)),this.sub(this.div(t).mul(t))},y.mod=y.modulo,y.not=function(){return s(~this.low,~this.high,this.unsigned)},y.and=function(t){return e(t)||(t=o(t)),s(this.low&t.low,this.high&t.high,this.unsigned)},y.or=function(t){return e(t)||(t=o(t)),s(this.low|t.low,this.high|t.high,this.unsigned)},y.xor=function(t){return e(t)||(t=o(t)),s(this.low^t.low,this.high^t.high,this.unsigned)},y.shiftLeft=function(t){return e(t)&&(t=t.toInt()),0==(t&=63)?this:t<32?s(this.low<>>32-t,this.unsigned):s(0,this.low<>>t|this.high<<32-t,this.high>>t,this.unsigned):s(this.high>>t-32,this.high>=0?0:-1,this.unsigned)},y.shr=y.shiftRight,y.shiftRightUnsigned=function(t){if(e(t)&&(t=t.toInt()),0===(t&=63))return this;var n=this.high;if(t<32){return s(this.low>>>t|n<<32-t,n>>>t,this.unsigned)}return 32===t?s(n,0,this.unsigned):s(n>>>t-32,0,this.unsigned)},y.shru=y.shiftRightUnsigned,y.toSigned=function(){return this.unsigned?s(this.low,this.high,!1):this},y.toUnsigned=function(){return this.unsigned?this:s(this.low,this.high,!0)},y.toBytes=function(t){return t?this.toBytesLE():this.toBytesBE()},y.toBytesLE=function(){var t=this.high,e=this.low;return[255&e,e>>>8&255,e>>>16&255,e>>>24&255,255&t,t>>>8&255,t>>>16&255,t>>>24&255]},y.toBytesBE=function(){var t=this.high,e=this.low;return[t>>>24&255,t>>>16&255,t>>>8&255,255&t,e>>>24&255,e>>>16&255,e>>>8&255,255&e]},t})},function(t,e,n){"use strict";(function(e){function n(t,n,i,s){if("function"!=typeof t)throw new TypeError('"callback" argument must be a function');var r,o,a=arguments.length;switch(a){case 0:case 1:return e.nextTick(t);case 2:return e.nextTick(function(){t.call(null,n)});case 3:return e.nextTick(function(){t.call(null,n,i)});case 4:return e.nextTick(function(){t.call(null,n,i,s)});default:for(r=new Array(a-1),o=0;o-1?i:T;a.WritableState=o;var I=n(23);I.inherits=n(12);var D={deprecate:n(107)},R=n(62),N=n(39).Buffer;I.inherits(a,R),o.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(o.prototype,"buffer",{get:D.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.")})}catch(t){}}();var M;"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(M=Function.prototype[Symbol.hasInstance],Object.defineProperty(a,Symbol.hasInstance,{value:function(t){return!!M.call(this,t)||t&&t._writableState instanceof o}})):M=function(t){return t instanceof this},a.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},a.prototype.write=function(t,e,n){var i=this._writableState,r=!1,o=N.isBuffer(t);return"function"==typeof e&&(n=e,e=null),o?e="buffer":e||(e=i.defaultEncoding),"function"!=typeof n&&(n=s),i.ended?c(this,n):(o||l(this,i,t,n))&&(i.pendingcb++,r=h(this,i,o,t,e,n)),r},a.prototype.cork=function(){this._writableState.corked++},a.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,t.writing||t.corked||t.finished||t.bufferProcessing||!t.bufferedRequest||E(this,t))},a.prototype.setDefaultEncoding=function(t){if("string"==typeof t&&(t=t.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((t+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},a.prototype._write=function(t,e,n){n(new Error("_write() is not implemented"))},a.prototype._writev=null,a.prototype.end=function(t,e,n){var i=this._writableState;"function"==typeof t?(n=t,t=null,e=null):"function"==typeof e&&(n=e,e=null),null!==t&&void 0!==t&&this.write(t,e),i.corked&&(i.corked=1,this.uncork()),i.ending||i.finished||y(this,i,n)}}).call(e,n(8),n(104).setImmediate)},function(t,e,n){t.exports=n(6)},function(t,e,n){const i=n(98);t.exports=i},function(t,e,n){(function(t,i){function s(t,n){var i={seen:[],stylize:o};return arguments.length>=3&&(i.depth=arguments[2]),arguments.length>=4&&(i.colors=arguments[3]),m(n)?i.showHidden=n:n&&e._extend(i,n),w(i.showHidden)&&(i.showHidden=!1),w(i.depth)&&(i.depth=2),w(i.colors)&&(i.colors=!1),w(i.customInspect)&&(i.customInspect=!0),i.colors&&(i.stylize=r),c(i,t,i.depth)}function r(t,e){var n=s.styles[e];return n?"["+s.colors[n][0]+"m"+t+"["+s.colors[n][1]+"m":t}function o(t,e){return t}function a(t){var e={};return t.forEach(function(t,n){e[t]=!0}),e}function c(t,n,i){if(t.customInspect&&n&&S(n.inspect)&&n.inspect!==e.inspect&&(!n.constructor||n.constructor.prototype!==n)){var s=n.inspect(i,t);return _(s)||(s=c(t,s,i)),s}var r=l(t,n);if(r)return r;var o=Object.keys(n),m=a(o);if(t.showHidden&&(o=Object.getOwnPropertyNames(n)),T(n)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return u(n);if(0===o.length){if(S(n)){var g=n.name?": "+n.name:"";return t.stylize("[Function"+g+"]","special")}if(y(n))return t.stylize(RegExp.prototype.toString.call(n),"regexp");if(A(n))return t.stylize(Date.prototype.toString.call(n),"date");if(T(n))return u(n)}var v="",E=!1,b=["{","}"];if(f(n)&&(E=!0,b=["[","]"]),S(n)){v=" [Function"+(n.name?": "+n.name:"")+"]"}if(y(n)&&(v=" "+RegExp.prototype.toString.call(n)),A(n)&&(v=" "+Date.prototype.toUTCString.call(n)),T(n)&&(v=" "+u(n)),0===o.length&&(!E||0==n.length))return b[0]+v+b[1];if(i<0)return y(n)?t.stylize(RegExp.prototype.toString.call(n),"regexp"):t.stylize("[Object]","special");t.seen.push(n);var w;return w=E?h(t,n,i,m,o):o.map(function(e){return p(t,n,i,m,e,E)}),t.seen.pop(),d(w,v,b)}function l(t,e){if(w(e))return t.stylize("undefined","undefined");if(_(e)){var n="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(n,"string")}return E(e)?t.stylize(""+e,"number"):m(e)?t.stylize(""+e,"boolean"):g(e)?t.stylize("null","null"):void 0}function u(t){return"["+Error.prototype.toString.call(t)+"]"}function h(t,e,n,i,s){for(var r=[],o=0,a=e.length;o-1&&(a=r?a.split("\n").map(function(t){return" "+t}).join("\n").substr(2):"\n"+a.split("\n").map(function(t){return" "+t}).join("\n"))):a=t.stylize("[Circular]","special")),w(o)){if(r&&s.match(/^\d+$/))return a;o=JSON.stringify(""+s),o.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(o=o.substr(1,o.length-2),o=t.stylize(o,"name")):(o=o.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),o=t.stylize(o,"string"))}return o+": "+a}function d(t,e,n){var i=0;return t.reduce(function(t,e){return i++,e.indexOf("\n")>=0&&i++,t+e.replace(/\u001b\[\d\d?m/g,"").length+1},0)>60?n[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+n[1]:n[0]+e+" "+t.join(", ")+" "+n[1]}function f(t){return Array.isArray(t)}function m(t){return"boolean"==typeof t}function g(t){return null===t}function v(t){return null==t}function E(t){return"number"==typeof t}function _(t){return"string"==typeof t}function b(t){return"symbol"==typeof t}function w(t){return void 0===t}function y(t){return x(t)&&"[object RegExp]"===D(t)}function x(t){return"object"==typeof t&&null!==t}function A(t){return x(t)&&"[object Date]"===D(t)}function T(t){return x(t)&&("[object Error]"===D(t)||t instanceof Error)}function S(t){return"function"==typeof t}function I(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t}function D(t){return Object.prototype.toString.call(t)}function R(t){return t<10?"0"+t.toString(10):t.toString(10)}function N(){var t=new Date,e=[R(t.getHours()),R(t.getMinutes()),R(t.getSeconds())].join(":");return[t.getDate(),C[t.getMonth()],e].join(" ")}function M(t,e){return Object.prototype.hasOwnProperty.call(t,e)}e.format=function(t){if(!_(t)){for(var e=[],n=0;n=r)return t;switch(t){case"%s":return String(i[n++]);case"%d":return Number(i[n++]);case"%j":try{return JSON.stringify(i[n++])}catch(t){return"[Circular]"}default:return t}}),a=i[n];n",license:"Apache-2.0",bugs:{url:"https://github.com/hydrabolt/discord.js/issues"},homepage:"https://github.com/hydrabolt/discord.js#readme",runkitExampleFilename:"./docs/examples/ping.js",dependencies:{long:"^3.2.0","prism-media":"^0.0.1",snekfetch:"^3.1.0",tweetnacl:"^1.0.0",ws:"^3.0.0"},peerDependencies:{bufferutil:"^3.0.0",erlpack:"hammerandchisel/erlpack","node-opus":"^0.2.5",opusscript:"^0.0.3",sodium:"^2.0.1","libsodium-wrappers":"^0.5.1",uws:"^0.14.1"},devDependencies:{"@types/node":"^7.0.0","discord.js-docgen":"hydrabolt/discord.js-docgen",eslint:"^3.19.0","parallel-webpack":"^1.6.0","uglify-js":"mishoo/UglifyJS2#harmony-v2.8.22","uglifyjs-webpack-plugin":"^0.4.3",webpack:"^2.2.0"},engines:{node:">=8.0.0"},browser:{ws:!1,uws:!1,erlpack:!1,"prism-media":!1,opusscript:!1,"node-opus":!1,tweetnacl:!1,sodium:!1,"src/sharding/Shard.js":!1,"src/sharding/ShardClientUtil.js":!1,"src/sharding/ShardingManager.js":!1,"src/client/voice/dispatcher/StreamDispatcher.js":!1,"src/client/voice/opus/BaseOpusEngine.js":!1,"src/client/voice/opus/NodeOpusEngine.js":!1,"src/client/voice/opus/OpusEngineList.js":!1,"src/client/voice/opus/OpusScriptEngine.js":!1,"src/client/voice/pcm/ConverterEngine.js":!1,"src/client/voice/pcm/ConverterEngineList.js":!1,"src/client/voice/pcm/FfmpegConverterEngine.js":!1,"src/client/voice/player/AudioPlayer.js":!1,"src/client/voice/receiver/VoiceReadable.js":!1,"src/client/voice/receiver/VoiceReceiver.js":!1,"src/client/voice/util/Secretbox.js":!1,"src/client/voice/util/SecretKey.js":!1,"src/client/voice/util/VolumeInterface.js":!1,"src/client/voice/ClientVoiceManager.js":!1,"src/client/voice/VoiceBroadcast.js":!1,"src/client/voice/VoiceConnection.js":!1,"src/client/voice/VoiceUDPClient.js":!1,"src/client/voice/VoiceWebSocket.js":!1}}},function(t,e,n){(function(e){const i=n(13),s=n(3),r=n(45),o=n(0),a=n(4),c=n(19),l=n(9),u=n(32),{TypeError:TypeError}=n(5);class h extends i{setup(t){super.setup(t),this.verified=t.verified,this.email=t.email,this.localPresence={},this._typing=new Map,this.friends=new s,this.blocked=new s,this.notes=new s,this.premium="boolean"==typeof t.premium?t.premium:null,this.mfaEnabled="boolean"==typeof t.mfa_enabled?t.mfa_enabled:null,this.mobile="boolean"==typeof t.mobile?t.mobile:null,t.user_settings&&(this.settings=new r(this,t.user_settings))}edit(t,e){const n={};return n.username=t.username||this.username,n.avatar=this.client.resolver.resolveBase64(t.avatar),this.bot||(n.email=t.email||this.email,n.password=e,t.new_password&&(n.new_password=t.newPassword)),this.client.api.users["@me"].patch({data:t}).then(t=>this.client.actions.UserUpdate.handle(t).updated)}setUsername(t,e){return this.edit({username:t},e)}setEmail(t,e){return this.edit({email:t},e)}setPassword(t,e){return this.edit({password:t},e)}setAvatar(t){return"string"==typeof t&&t.startsWith("data:")?this.edit({avatar:t}):this.client.resolver.resolveBuffer(t||e.alloc(0)).then(t=>this.edit({avatar:this.client.resolver.resolveBase64(t)||null}))}setPresence(t){return new Promise(e=>{let n=this.localPresence.status||this.presence.status;let i=this.localPresence.game;let s=this.localPresence.afk||this.presence.afk;!i&&this.presence.game&&(i={name:this.presence.game.name,type:this.presence.game.type,url:this.presence.game.url});if(t.status){if("string"!=typeof t.status)throw new TypeError("STATUS_TYPE");this.bot?n=t.status:(this.settings.update(o.UserSettingsMap.status,t.status),n="invisible")}t.game?(i=t.game,i.url&&(i.type=1)):void 0!==t.game&&(i=null);void 0!==t.afk&&(s=t.afk);s=Boolean(s);this.localPresence={status:n,game:i,afk:s};this.localPresence.since=0;this.localPresence.game=this.localPresence.game||null;this.client.ws.send({op:3,d:this.localPresence});this.client._setPresence(this.id,this.localPresence);e(this)})}setStatus(t){return this.setPresence({status:t})}setGame(t,e){return t?this.setPresence({game:{name:t,url:e}}):this.setPresence({game:null})}setAFK(t){return this.setPresence({afk:t})}fetchMentions(t={}){return t.guild instanceof c&&(t.guild=t.guild.id),a.mergeDefault({limit:25,roles:!0,everyone:!0,guild:null},t),this.client.api.users["@me"].mentions.get({query:t}).then(t=>t.map(t=>new l(this.client.channels.get(t.channel_id),t,this.client)))}createGuild(t,{region:region,icon:icon=null}={}){return!icon||"string"==typeof icon&&icon.startsWith("data:")?new Promise((e,n)=>this.client.api.guilds.post({data:{name:t,region:region,icon:icon}}).then(t=>{if(this.client.guilds.has(t.id))return e(this.client.guilds.get(t.id));const n=s=>{s.id===t.id&&(this.client.removeListener(o.Events.GUILD_CREATE,n),this.client.clearTimeout(i),e(s))};this.client.on(o.Events.GUILD_CREATE,n);const i=this.client.setTimeout(()=>{this.client.removeListener(o.Events.GUILD_CREATE,n);e(this.client.dataManager.newGuild(t))},1e4);return},n)):this.client.resolver.resolveBuffer(icon).then(e=>this.createGuild(t,{region:region,icon:this.client.resolver.resolveBase64(e)||null}))}createGroupDM(t){const e=this.bot?{access_tokens:t.map(t=>t.accessToken),nicks:t.reduce((t,e)=>{e.nick&&(t[e.user?e.user.id:e.id]=e.nick);return t},{})}:{recipients:t.map(t=>this.client.resolver.resolveUserID(t))};return this.client.api.users["@me"].channels.post({data:e}).then(t=>new u(this.client,t))}}t.exports=h}).call(e,n(6).Buffer)},function(t,e,n){const i=n(0),s=n(4);class r{constructor(t,e){this.user=t,this.patch(e)}patch(t){for(const[e,n]of Object.entries(i.UserSettingsMap))t.hasOwnProperty(e)&&("function"==typeof n?this[n.name]=n(t[e]):this[n]=t[e])}update(t,e){return this.user.client.api.users["@me"].settings.patch({data:{[t]:e}})}setGuildPosition(t,e,n){const i=Object.assign([],this.guildPositions);return s.moveElementInArray(i,t.id,e,n),this.update("guild_positions",i).then(()=>t)}addRestrictedGuild(t){const e=Object.assign([],this.restrictedGuilds);return e.includes(t.id)?Promise.reject(new Error("Guild is already restricted")):(e.push(t.id),this.update("restricted_guilds",e).then(()=>t))}removeRestrictedGuild(t){const e=Object.assign([],this.restrictedGuilds),n=e.indexOf(t.id);return n<0?Promise.reject(new Error("Guild is not restricted")):(e.splice(n,1),this.update("restricted_guilds",e).then(()=>t))}}t.exports=r},function(t,e,n){const i=n(17),s=n(25),r=n(3);class o extends i{constructor(t,e){super(t,e),this.type="dm",this.messages=new r,this._typing=new Map}setup(t){super.setup(t),this.recipient=this.client.dataManager.newUser(t.recipients[0]),this.lastMessageID=t.last_message_id}toString(){return this.recipient.toString()}send(){}fetchMessage(){}fetchMessages(){}fetchPinnedMessages(){}search(){}startTyping(){}stopTyping(){}get typing(){}get typingCount(){}createMessageCollector(){}awaitMessages(){}acknowledge(){}_cacheMessage(){}}s.applyToClass(o,!0,["bulkDelete"]),t.exports=o},function(t,e,n){const i=n(3),s=n(7),r={ALL:"ALL",GUILD:"GUILD",CHANNEL:"CHANNEL",USER:"USER",ROLE:"ROLE",INVITE:"INVITE",WEBHOOK:"WEBHOOK",EMOJI:"EMOJI",MESSAGE:"MESSAGE",UNKNOWN:"UNKNOWN"},o={ALL:null,GUILD_UPDATE:1,CHANNEL_CREATE:10,CHANNEL_UPDATE:11,CHANNEL_DELETE:12,CHANNEL_OVERWRITE_CREATE:13,CHANNEL_OVERWRITE_UPDATE:14,CHANNEL_OVERWRITE_DELETE:15,MEMBER_KICK:20,MEMBER_PRUNE:21,MEMBER_BAN_ADD:22,MEMBER_BAN_REMOVE:23,MEMBER_UPDATE:24,MEMBER_ROLE_UPDATE:25,ROLE_CREATE:30,ROLE_UPDATE:31,ROLE_DELETE:32,INVITE_CREATE:40,INVITE_UPDATE:41,INVITE_DELETE:42,WEBHOOK_CREATE:50,WEBHOOK_UPDATE:51,WEBHOOK_DELETE:52,EMOJI_CREATE:60,EMOJI_UPDATE:61,EMOJI_DELETE:62,MESSAGE_DELETE:72};class a{constructor(t,e){if(e.users)for(const n of e.users)t.client.dataManager.newUser(n);this.entries=new i;for(const n of e.audit_log_entries){const e=new c(t,n);this.entries.set(e.id,e)}}static build(...t){const e=new a(...t);return Promise.all(e.entries.map(t=>t.target)).then(()=>e)}static targetType(t){return t<10?r.GUILD:t<20?r.CHANNEL:t<30?r.USER:t<40?r.ROLE:t<50?r.INVITE:t<60?r.WEBHOOK:t<70?r.EMOJI:t<80?r.MESSAGE:r.UNKNOWN}static actionType(t){return[o.CHANNEL_CREATE,o.CHANNEL_OVERWRITE_CREATE,o.MEMBER_BAN_REMOVE,o.ROLE_CREATE,o.INVITE_CREATE,o.WEBHOOK_CREATE,o.EMOJI_CREATE].includes(t)?"CREATE":[o.CHANNEL_DELETE,o.CHANNEL_OVERWRITE_DELETE,o.MEMBER_KICK,o.MEMBER_PRUNE,o.MEMBER_BAN_ADD,o.ROLE_DELETE,o.INVITE_DELETE,o.WEBHOOK_DELETE,o.EMOJI_DELETE,o.MESSAGE_DELETE].includes(t)?"DELETE":[o.GUILD_UPDATE,o.CHANNEL_UPDATE,o.CHANNEL_OVERWRITE_UPDATE,o.MEMBER_UPDATE,o.MEMBER_ROLE_UPDATE,o.ROLE_UPDATE,o.INVITE_UPDATE,o.WEBHOOK_UPDATE,o.EMOJI_UPDATE].includes(t)?"UPDATE":"ALL"}}class c{constructor(t,e){const n=a.targetType(e.action_type);if(this.targetType=n,this.actionType=a.actionType(e.action_type),this.action=Object.keys(o).find(t=>o[t]===e.action_type),this.reason=e.reason||null,this.executor=t.client.users.get(e.user_id),this.changes=e.changes?e.changes.map(t=>({key:t.key,old:t.old_value,new:t.new_value})):null,this.id=e.id,this.extra=null,e.options)if(e.action_type===o.MEMBER_PRUNE)this.extra={removed:e.options.members_removed,days:e.options.delete_member_days};else if(e.action_type===o.MESSAGE_DELETE)this.extra={count:e.options.count,channel:t.channels.get(e.options.channel_id)};else switch(e.options.type){case"member":this.extra=t.members.get(e.options.id),this.extra||(this.extra={id:e.options.id});break;case"role":this.extra=t.roles.get(e.options.id),this.extra||(this.extra={id:e.options.id,name:e.options.role_name})}if(n===r.UNKNOWN)this.target=e.target_id;else if([r.USER,r.GUILD].includes(n))this.target=t.client[`${n.toLowerCase()}s`].get(e.target_id);else if(n===r.WEBHOOK)this.target=t.fetchWebhooks().then(t=>{this.target=t.find(t=>t.id===e.target_id);return this.target});else if(n===r.INVITE){const e=this.changes.find(t=>"code"===t.key);this.target=t.fetchInvites().then(t=>{this.target=t.find(t=>t.code===(e.new_value||e.old_value));return this.target})}else this.target=n===r.MESSAGE?t.client.users.get(e.target_id):t[`${n.toLowerCase()}s`].get(e.target_id)}get createdTimestamp(){return s.deconstruct(this.id).timestamp}get createdAt(){return new Date(this.createdTimestamp)}}a.Actions=o,a.Targets=r,a.Entry=c,t.exports=a},function(t,e){class n{constructor(t,e){Object.defineProperty(this,"client",{value:t.client}),this.message=t,this.setup(e)}setup(t){this.id=t.id,this.filename=t.filename,this.filesize=t.size,this.url=t.url,this.proxyURL=t.proxy_url,this.height=t.height,this.width=t.width}}t.exports=n},function(t,e,n){const i=n(34);class s extends i{constructor(t,e,n={}){super(t.client,e,n),this.channel=t,this.received=0,this.client.on("message",this.listener)}handle(t){return t.channel.id!==this.channel.id?null:(this.received++,{key:t.id,value:t})}postCheck(){return this.options.max&&this.collected.size>=this.options.max?"limit":this.options.maxProcessed&&this.received===this.options.maxProcessed?"processedLimit":null}cleanup(){this.client.removeListener("message",this.listener)}}t.exports=s},function(t,e,n){const i=n(4),{RangeError:RangeError}=n(5);class s{constructor(t){this.setup(t)}setup(t){this.type=t.type,this.title=t.title||null,this.description=t.description||null,this.url=t.url||null,this.color=t.color||null,this.timestamp=new Date(t.timestamp)||null,this.fields=t.fields||null,this.thumbnail=t.thumbnail?{url:t.thumbnail.url||null,proxyURL:t.thumbnail.proxy_url,height:t.height,width:t.width}:null,this.image=t.image?{url:t.image.url||null,proxyURL:t.image.proxy_url,height:t.height,width:t.width}:null,this.video=t.video?{url:t.video.url||null,height:t.video.height,width:t.video.width}:null,this.author=t.author?{name:t.author.name||null,url:t.author.url||null,iconURL:t.author.iconURL||t.author.icon_url||null,proxyIconURL:t.author.proxyIconUrl||t.author.proxy_icon_url||null}:null,this.provider=t.provider?{name:t.provider.name,url:t.provider.url}:null,this.footer=t.footer?{text:t.footer.text||null,iconURL:t.footer.iconURL||t.footer.icon_url||null,proxyIconURL:t.footer.proxyIconURL||t.footer.proxy_icon_url||null}:null}get createdAt(){return new Date(this.timestamp)}get hexColor(){let t=this.color.toString(16);for(;t.length<6;)t=`0${t}`;return`#${t}`}addField(t,e,n=!1){if(this.fields.length>=25)throw new RangeError("EMBED_FIELD_COUNT");if(t=i.resolveString(t),!String(t)||t.length>256)throw new RangeError("EMBED_FIELD_NAME");if(e=i.resolveString(e),!String(t)||e.length>1024)throw new RangeError("EMBED_FIELD_VALUE");return this.fields.push({name:t,value:e,inline:n}),this}attachFile(t){if(this.file)throw new RangeError("EMBED_FILE_LIMIT");return this.file=t,this}setAuthor(t,e,n){return this.author={name:i.resolveString(t),iconURL:e,url:n},this}setColor(t){return this.color=i.resolveColor(t),this}setDescription(t){if(t=i.resolveString(t),t.length>2048)throw new RangeError("EMBED_DESCRIPTION");return this.description=t,this}setFooter(t,e){if(t=i.resolveString(t),t.length>2048)throw new RangeError("EMBED_FOOTER_TEXT");return this.footer={text:t,iconURL:e},this}setImage(t){return this.image={url:t},this}setThumbnail(t){return this.thumbnail={url:t},this}setTimestamp(t=new Date){return this.timestamp=t,this}setTitle(t){if(t=i.resolveString(t),t.length>256)throw new RangeError("EMBED_TITLE");return this.title=t,this}setURL(t){return this.url=t,this}}t.exports=s},function(t,e,n){const i=n(3);class s{constructor(t,e,n,s){if(this.everyone=Boolean(s),e)if(e instanceof i)this.users=new i(e);else{this.users=new i;for(const n of e){let e=t.client.users.get(n.id);e||(e=t.client.dataManager.newUser(n)),this.users.set(e.id,e)}}else this.users=new i;if(n)if(n instanceof i)this.roles=new i(n);else{this.roles=new i;for(const e of n){const n=t.channel.guild.roles.get(e);n&&this.roles.set(n.id,n)}}else this.roles=new i;this._content=t.content,this._client=t.client,this._guild=t.channel.guild,this._members=null,this._channels=null}get members(){return this._members?this._members:this._guild?(this._members=new i,this.users.forEach(t=>{const e=this._guild.member(t);e&&this._members.set(e.user.id,e)}),this._members):null}get channels(){if(this._channels)return this._channels;this._channels=new i;let t;for(;null!==(t=this.constructor.CHANNELS_PATTERN.exec(this._content));){const e=this._client.channels.get(t[1]);e&&this._channels.set(e.id,e)}return this._channels}}s.EVERYONE_PATTERN=/@(everyone|here)/g,s.USERS_PATTERN=/<@!?[0-9]+>/g,s.ROLES_PATTERN=/<@&[0-9]+>/g,s.CHANNELS_PATTERN=/<#([0-9]+)>/g,t.exports=s},function(t,e,n){const i=n(3),s=n(18),r=n(33);class o{constructor(t,e,n,s){this.message=t,this.me=s,this.count=n||0,this.users=new i,this._emoji=new r(this,e.name,e.id)}get emoji(){if(this._emoji instanceof s)return this._emoji;if(this._emoji.id){const t=this.message.client.emojis;if(t.has(this._emoji.id)){const e=t.get(this._emoji.id);return this._emoji=e,e}}return this._emoji}remove(t=this.message.client.user){const e=this.message.client.resolver.resolveUserID(t);return e?this.message.client.api.channels[this.message.channel.id].messages[this.message.id].reactions[this.emoji.identifier][e===this.message.client.user.id?"@me":e].delete().then(()=>this.message.client.actions.MessageReactionRemove.handle({user_id:e,message_id:this.message.id,emoji:this.emoji,channel_id:this.message.channel.id}).reaction):Promise.reject(new Error("Couldn't resolve the user ID to remove from the reaction."))}fetchUsers(t=100){const e=this.message;return e.client.api.channels[e.channel.id].messages[e.id].reactions[this.emoji.identifier].get({query:{limit:t}}).then(t=>{this.users=new i;for(const n of t){const t=e.client.dataManager.newUser(n);this.users.set(t.id,t)}this.count=this.users.size;return this.users})}}t.exports=o},function(t,e){class n{constructor(t,e){Object.defineProperty(this,"client",{value:t}),this.setup(e)}setup(t){this.id=t.id,this.name=t.name,this.icon=t.icon,this.splash=t.splash}}t.exports=n},function(t,e,n){const i=n(0);class s{constructor(t,e){Object.defineProperty(this,"client",{value:t}),this.setup(e)}setup(t){this.id=t.id,this.name=t.name,this.type=i.ChannelTypes.TEXT===t.type?"text":"voice"}}t.exports=s},function(t,e,n){const i=n(10);class s{constructor(t,e){Object.defineProperty(this,"channel",{value:t}),e&&this.setup(e)}setup(t){this.id=t.id,this.type=t.type,this._denied=t.deny,this._allowed=t.allow,this.denied=new i(this._denied),this.allowed=new i(this._allowed)}delete(t){return this.channel.client.api.channels[this.channel.id].permissions[this.id].delete({reason:t}).then(()=>this)}}t.exports=s},function(t,e,n){const i=n(34),s=n(3);class r extends i{constructor(t,e,n={}){super(t.client,e,n),this.message=t,this.users=new s,this.total=0,this.client.on("messageReactionAdd",this.listener)}handle(t){return t.message.id!==this.message.id?null:{key:t.emoji.id||t.emoji.name,value:t}}postCheck(t,e){return this.users.set(e.id,e),this.options.max&&++this.total>=this.options.max?"limit":this.options.maxEmojis&&this.collected.size>=this.options.maxEmojis?"emojiLimit":this.options.maxUsers&&this.users.size>=this.options.maxUsers?"userLimit":null}cleanup(){this.client.removeListener("messageReactionAdd",this.listener)}}t.exports=r},function(t,e,n){const i=n(27),s=n(22),r=n(25),o=n(3);class a extends i{constructor(t,e){super(t,e),this.type="text",this.messages=new o,this._typing=new Map}setup(t){super.setup(t),this.topic=t.topic,this.lastMessageID=t.last_message_id}get members(){const t=new o;for(const e of this.guild.members.values())this.permissionsFor(e).has("READ_MESSAGES")&&t.set(e.id,e);return t}get nsfw(){return/^nsfw(-|$)/.test(this.name)}fetchWebhooks(){return this.client.api.channels[this.id].webhooks.get().then(t=>{const e=new o;for(const n of t)e.set(n.id,new s(this.client,n));return e})}createWebhook(t,e){return"string"==typeof e&&e.startsWith("data:")?this.client.api.channels[this.id].webhooks.post({data:{name:t,avatar:e}}).then(t=>new s(this.client,t)):this.client.resolver.resolveBuffer(e).then(e=>this.createWebhook(t,this.client.resolver.resolveBase64(e)||null))}send(){}fetchMessage(){}fetchMessages(){}fetchPinnedMessages(){}search(){}startTyping(){}stopTyping(){}get typing(){}get typingCount(){}createMessageCollector(){}awaitMessages(){}bulkDelete(){}acknowledge(){}_cacheMessage(){}}r.applyToClass(a,!0),t.exports=a},function(t,e,n){const i=n(27),s=n(3);class r extends i{constructor(t,e){super(t,e),this.members=new s,this.type="voice"}setup(t){super.setup(t),this.bitrate=t.bitrate,this.userLimit=t.user_limit}get connection(){const t=this.guild.voiceConnection;return t&&t.channel.id===this.id?t:null}get full(){return this.userLimit>0&&this.members.size>=this.userLimit}get joinable(){return!this.client.browser&&(!!this.permissionsFor(this.client.user).has("CONNECT")&&!(this.full&&!this.permissionsFor(this.client.user).has("MOVE_MEMBERS")))}get speakable(){return this.permissionsFor(this.client.user).has("SPEAK")}setBitrate(t){return this.edit({bitrate:t})}setUserLimit(t){return this.edit({userLimit:t})}join(){return this.client.browser?Promise.reject(new Error("Voice connections are not available in browsers.")):this.client.voice.joinChannel(this)}leave(){if(!this.client.browser){const t=this.client.voice.connections.get(this.guild.id);t&&t.channel.id===this.id&&t.disconnect()}}}t.exports=r},function(t,e){var n={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==n.call(t)}},function(t,e,n){"use strict";(function(e){function i(t,e,n){if("function"==typeof t.prependListener)return t.prependListener(e,n);t._events&&t._events[e]?N(t._events[e])?t._events[e].unshift(n):t._events[e]=[n,t._events[e]]:t.on(e,n)}function s(t,e){D=D||n(16),t=t||{},this.objectMode=!!t.objectMode,e instanceof D&&(this.objectMode=this.objectMode||!!t.readableObjectMode);var i=t.highWaterMark,s=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:s,this.highWaterMark=~~this.highWaterMark,this.buffer=new j,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.ranOut=!1,this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(P||(P=n(67).StringDecoder),this.decoder=new P(t.encoding),this.encoding=t.encoding)}function r(t){if(D=D||n(16),!(this instanceof r))return new r(t);this._readableState=new s(t,this),this.readable=!0,t&&"function"==typeof t.read&&(this._read=t.read),k.call(this)}function o(t,e,n,i,s){var r=u(e,n);if(r)t.emit("error",r);else if(null===n)e.reading=!1,h(t,e);else if(e.objectMode||n&&n.length>0)if(e.ended&&!s){var o=new Error("stream.push() after EOF");t.emit("error",o)}else if(e.endEmitted&&s){var c=new Error("stream.unshift() after end event");t.emit("error",c)}else{var l;!e.decoder||s||i||(n=e.decoder.write(n),l=!e.objectMode&&0===n.length),s||(e.reading=!1),l||(e.flowing&&0===e.length&&!e.sync?(t.emit("data",n),t.read(0)):(e.length+=e.objectMode?1:n.length,s?e.buffer.unshift(n):e.buffer.push(n),e.needReadable&&p(t))),f(t,e)}else s||(e.reading=!1);return a(e)}function a(t){return!t.ended&&(t.needReadable||t.length=B?t=B:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}function l(t,e){return t<=0||0===e.length&&e.ended?0:e.objectMode?1:t!==t?e.flowing&&e.length?e.buffer.head.data.length:e.length:(t>e.highWaterMark&&(e.highWaterMark=c(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function u(t,e){var n=null;return O.isBuffer(e)||"string"==typeof e||null===e||void 0===e||t.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}function h(t,e){if(!e.ended){if(e.decoder){var n=e.decoder.end();n&&n.length&&(e.buffer.push(n),e.length+=e.objectMode?1:n.length)}e.ended=!0,p(t)}}function p(t){var e=t._readableState;e.needReadable=!1,e.emittedReadable||(U("emitReadable",e.flowing),e.emittedReadable=!0,e.sync?R(d,t):d(t))}function d(t){U("emit readable"),t.emit("readable"),b(t)}function f(t,e){e.readingMore||(e.readingMore=!0,R(m,t,e))}function m(t,e){for(var n=e.length;!e.reading&&!e.flowing&&!e.ended&&e.length=e.length?(n=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.head.data:e.buffer.concat(e.length),e.buffer.clear()):n=y(t,e.buffer,e.decoder),n}function y(t,e,n){var i;return tr.length?r.length:t;if(o===r.length?s+=r:s+=r.slice(0,t),0===(t-=o)){o===r.length?(++i,n.next?e.head=n.next:e.head=e.tail=null):(e.head=n,n.data=r.slice(o));break}++i}return e.length-=i,s}function A(t,e){var n=O.allocUnsafe(t),i=e.head,s=1;for(i.data.copy(n),t-=i.data.length;i=i.next;){var r=i.data,o=t>r.length?r.length:t;if(r.copy(n,n.length-t,0,o),0===(t-=o)){o===r.length?(++s,i.next?e.head=i.next:e.head=e.tail=null):(e.head=i,i.data=r.slice(o));break}++s}return e.length-=s,n}function T(t){var e=t._readableState;if(e.length>0)throw new Error('"endReadable()" called on non-empty stream');e.endEmitted||(e.ended=!0,R(S,e,t))}function S(t,e){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}function I(t,e){for(var n=0,i=t.length;n=e.highWaterMark||e.ended))return U("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?T(this):p(this),null;if(0===(t=l(t,e))&&e.ended)return 0===e.length&&T(this),null;var i=e.needReadable;U("need readable",i),(0===e.length||e.length-t0?w(t,e):null,null===s?(e.needReadable=!0,t=0):e.length-=t,0===e.length&&(e.ended||(e.needReadable=!0),n!==t&&e.ended&&T(this)),null!==s&&this.emit("data",s),s},r.prototype._read=function(t){this.emit("error",new Error("_read() is not implemented"))},r.prototype.pipe=function(t,n){function s(t){U("onunpipe"),t===p&&o()}function r(){U("onend"),t.end()}function o(){U("cleanup"),t.removeListener("close",l),t.removeListener("finish",u),t.removeListener("drain",v),t.removeListener("error",c),t.removeListener("unpipe",s),p.removeListener("end",r),p.removeListener("end",h),p.removeListener("data",a),E=!0,!d.awaitDrain||t._writableState&&!t._writableState.needDrain||v()}function a(e){U("ondata"),_=!1,!1!==t.write(e)||_||((1===d.pipesCount&&d.pipes===t||d.pipesCount>1&&-1!==I(d.pipes,t))&&!E&&(U("false write response, pause",p._readableState.awaitDrain),p._readableState.awaitDrain++,_=!0),p.pause())}function c(e){U("onerror",e),h(),t.removeListener("error",c),0===M(t,"error")&&t.emit("error",e)}function l(){t.removeListener("finish",u),h()}function u(){U("onfinish"),t.removeListener("close",l),h()}function h(){U("unpipe"),p.unpipe(t)}var p=this,d=this._readableState;switch(d.pipesCount){case 0:d.pipes=t;break;case 1:d.pipes=[d.pipes,t];break;default:d.pipes.push(t)}d.pipesCount+=1,U("pipe count=%d opts=%j",d.pipesCount,n);var f=(!n||!1!==n.end)&&t!==e.stdout&&t!==e.stderr,m=f?r:h;d.endEmitted?R(m):p.once("end",m),t.on("unpipe",s);var v=g(p);t.on("drain",v);var E=!1,_=!1;return p.on("data",a),i(t,"error",c),t.once("close",l),t.once("finish",u),t.emit("pipe",p),d.flowing||(U("pipe resume"),p.resume()),t},r.prototype.unpipe=function(t){var e=this._readableState;if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes?this:(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this),this);if(!t){var n=e.pipes,i=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var s=0;s",'"',"`"," ","\r","\n","\t"],f=["{","}","|","\\","^","`"].concat(d),m=["'"].concat(f),g=["%","/","?",";","#"].concat(m),v=["/","?","#"],E={javascript:!0,"javascript:":!0},_={javascript:!0,"javascript:":!0},b={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},w=n(37);i.prototype.parse=function(t,e,n){if(!l.isString(t))throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var i=t.indexOf("?"),s=-1!==i&&i127?M+="x":M+=N[k];if(!M.match(/^[+a-z0-9A-Z_-]{0,63}$/)){var C=D.slice(0,x),L=D.slice(x+1),U=N.match(/^([+a-z0-9A-Z_-]{0,63})(.*)$/);U&&(C.push(U[1]),L.unshift(U[2])),L.length&&(o="/"+L.join(".")+o),this.hostname=C.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),I||(this.hostname=c.toASCII(this.hostname));var P=this.port?":"+this.port:"",j=this.hostname||"";this.host=j+P,this.href+=this.host,I&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==o[0]&&(o="/"+o))}if(!E[d])for(var x=0,R=m.length;x0)&&n.host.split("@");T&&(n.auth=T.shift(),n.host=n.hostname=T.shift())}return n.search=t.search,n.query=t.query,l.isNull(n.pathname)&&l.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.href=n.format(),n}if(!x.length)return n.pathname=null,n.search?n.path="/"+n.search:n.path=null,n.href=n.format(),n;for(var S=x.slice(-1)[0],I=(n.host||t.host||x.length>1)&&("."===S||".."===S)||""===S,D=0,R=x.length;R>=0;R--)S=x[R],"."===S?x.splice(R,1):".."===S?(x.splice(R,1),D++):D&&(x.splice(R,1),D--);if(!w&&!y)for(;D--;D)x.unshift("..");!w||""===x[0]||x[0]&&"/"===x[0].charAt(0)||x.unshift(""),I&&"/"!==x.join("/").substr(-1)&&x.push("");var N=""===x[0]||x[0]&&"/"===x[0].charAt(0);if(A){n.hostname=n.host=N?"":x.length?x.shift():"";var T=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@");T&&(n.auth=T.shift(),n.host=n.hostname=T.shift())}return w=w||n.host&&x.length,w&&!N&&x.unshift(""),x.length?n.pathname=x.join("/"):(n.pathname=null,n.path=null),l.isNull(n.pathname)&&l.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.auth=t.auth||n.auth,n.slashes=n.slashes||t.slashes,n.href=n.format(),n},i.prototype.parseHost=function(){var t=this.host,e=h.exec(t);e&&(e=e[0],":"!==e&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)}},function(t,e,n){function i(t){if(t&&!c(t))throw new Error("Unknown encoding: "+t)}function s(t){return t.toString(this.encoding)}function r(t){this.charReceived=t.length%2,this.charLength=this.charReceived?2:0}function o(t){this.charReceived=t.length%3,this.charLength=this.charReceived?3:0}var a=n(6).Buffer,c=a.isEncoding||function(t){switch(t&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}},l=e.StringDecoder=function(t){switch(this.encoding=(t||"utf8").toLowerCase().replace(/[-_]/,""),i(t),this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=r;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=o;break;default:return void(this.write=s)}this.charBuffer=new a(6),this.charReceived=0,this.charLength=0};l.prototype.write=function(t){for(var e="";this.charLength;){var n=t.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:t.length;if(t.copy(this.charBuffer,this.charReceived,0,n),this.charReceived+=n,this.charReceived=55296&&i<=56319)){if(this.charReceived=this.charLength=0,0===t.length)return e;break}this.charLength+=this.surrogateSize,e=""}this.detectIncompleteChar(t);var s=t.length;this.charLength&&(t.copy(this.charBuffer,0,t.length-this.charReceived,s),s-=this.charReceived),e+=t.toString(this.encoding,0,s);var s=e.length-1,i=e.charCodeAt(s);if(i>=55296&&i<=56319){var r=this.surrogateSize;return this.charLength+=r,this.charReceived+=r,this.charBuffer.copy(this.charBuffer,r,0,r),t.copy(this.charBuffer,0,0,r),e.substring(0,s)}return e},l.prototype.detectIncompleteChar=function(t){for(var e=t.length>=3?3:t.length;e>0;e--){var n=t[t.length-e];if(1==e&&n>>5==6){this.charLength=2;break}if(e<=2&&n>>4==14){this.charLength=3;break}if(e<=3&&n>>3==30){this.charLength=4;break}}this.charReceived=e},l.prototype.end=function(t){var e="";if(t&&t.length&&(e=this.write(t)),this.charReceived){var n=this.charReceived,i=this.charBuffer,s=this.encoding;e+=i.slice(0,n).toString(s)}return e}},function(t,e,n){(function(e){const i=n(30),s=n(42),r=n(40),o=n(4),a=n(13),c=n(9),l=n(19),u=n(17),h=n(20),p=n(18),d=n(33),{Error:Error,TypeError:TypeError}=n(5);class f{constructor(t){this.client=t}resolveUser(t){return t instanceof a?t:"string"==typeof t?this.client.users.get(t)||null:t instanceof h?t.user:t instanceof c?t.author:t instanceof l?t.owner:null}resolveUserID(t){return t instanceof a||t instanceof h?t.id:"string"==typeof t?t||null:t instanceof c?t.author.id:t instanceof l?t.ownerID:null}resolveGuild(t){return t instanceof l?t:"string"==typeof t?this.client.guilds.get(t)||null:null}resolveGuildMember(t,e){return e instanceof h?e:(t=this.resolveGuild(t),e=this.resolveUser(e),t&&e?t.members.get(e.id)||null:null)}resolveChannel(t){return t instanceof u?t:"string"==typeof t?this.client.channels.get(t)||null:t instanceof c?t.channel:t instanceof l?t.channels.get(t.id)||null:null}resolveChannelID(t){return t instanceof u?t.id:"string"==typeof t?t:t instanceof c?t.channel.id:t instanceof l?t.defaultChannel.id:null}resolveInviteCode(t){const e=/discord(?:app\.com\/invite|\.gg)\/([\w-]{2,255})/i,n=e.exec(t);return n&&n[1]?n[1]:t}resolveBase64(t){return t instanceof e?`data:image/jpg;base64,${t.toString("base64")}`:t}resolveBuffer(t){return t instanceof e?Promise.resolve(t):this.client.browser&&t instanceof ArrayBuffer?Promise.resolve(o.convertToBuffer(t)):"string"==typeof t?new Promise((n,o)=>{if(/^https?:\/\//.test(t))r.get(t).end((t,i)=>{if(t)return o(t);if(!(i.body instanceof e))return o(new TypeError("REQ_BODY_TYPE"));return n(i.body)});else{const e=i.resolve(t);s.stat(e,(t,i)=>{if(t)return o(t);if(!i||!i.isFile())return o(new Error("FILE_NOT_FOUND",e));s.readFile(e,(t,e)=>{t?o(t):n(e)});return null})}}):Promise.reject(new TypeError("REQ_RESOURCE_TYPE"))}resolveEmojiIdentifier(t){return t instanceof p||t instanceof d?t.identifier:"string"==typeof t?this.client.emojis.has(t)?this.client.emojis.get(t).identifier:t.includes("%")?t:encodeURIComponent(t):null}}t.exports=f}).call(e,n(6).Buffer)},function(t,e,n){const i=n(147),s=n(146),r=n(145),o=n(143),a=n(144),{Error:Error}=n(5);class c{constructor(t){this.client=t,this.handlers={},this.userAgentManager=new i(this),this.rateLimitedEndpoints={},this.globallyRateLimited=!1}get api(){return a(this)}destroy(){for(const t in this.handlers)this.handlers[t].destroy()}push(t,e){return new Promise((n,i)=>{t.push({request:e,resolve:n,reject:i})})}getRequestHandler(){switch(this.client.options.apiRequestMethod){case"sequential":return s;case"burst":return r;default:throw new Error("RATELIMIT_INVALID_METHOD")}}request(t,e,n={}){const i=new o(this,t,e,n);if(!this.handlers[i.route]){const t=this.getRequestHandler();this.handlers[i.route]=new t(this,i.route)}return this.push(this.handlers[i.route],i)}}t.exports=c},function(t,e){class n{constructor(t){this.restManager=t,this.queue=[]}get globalLimit(){return this.restManager.globallyRateLimited}set globalLimit(t){this.restManager.globallyRateLimited=t}push(t){this.queue.push(t)}handle(){}destroy(){this.queue=[]}}t.exports=n},function(t,e,n){(function(e){const i="browser"===n(26).platform(),s=n(15),r=n(0),o=n(42),a=n(149),c=function(){try{const t=n(196);return t.pack?t:null}catch(t){return null}}(),l=function(){if(i)return window.WebSocket;try{return n(197)}catch(t){return n(198)}}();class u extends s{constructor(t,e){super(),this.manager=t,this.client=t.client,this.ws=null,this.sequence=-1,this.status=r.Status.IDLE,this.packetManager=new a(this),this.lastPingTimestamp=0,this.ratelimit={queue:[],remaining:120,resetTime:-1},this.connect(e),this.disabledEvents={},this.closeSequence=0,this.expectingClose=!1;for(const t of this.client.options.disabledEvents)this.disabledEvents[t]=!0}triggerReady(){if(this.status===r.Status.READY)return void this.debug("Tried to mark self as ready, but already ready");this.status=r.Status.READY,this.client.emit(r.Events.READY),this.packetManager.handleQueue()}checkIfReady(){if(this.status===r.Status.READY||this.status===r.Status.NEARLY)return!1;let t=0;for(const e of this.client.guilds.values())e.available||t++;if(0===t){if(this.status=r.Status.NEARLY,!this.client.options.fetchAllMembers)return this.triggerReady();const t=this.client.guilds.map(t=>t.fetchMembers());Promise.all(t).then(()=>this.triggerReady()).catch(t=>{this.debug(`Failed to fetch all members before ready! ${t}`);this.triggerReady()})}return!0}debug(t){return t instanceof Error&&(t=t.stack),this.manager.debug(`[connection] ${t}`)}unpack(t){return t instanceof ArrayBuffer&&(t=e.from(new Uint8Array(t))),c&&"string"!=typeof t?c.unpack(t):(t instanceof e&&(t=o.inflateSync(t).toString()),JSON.parse(t))}pack(t){return c?c.pack(t):JSON.stringify(t)}processQueue(){if(0!==this.ratelimit.remaining&&0!==this.ratelimit.queue.length)for(120===this.ratelimit.remaining&&(this.ratelimit.resetTimer=setTimeout(()=>{this.ratelimit.remaining=120;this.processQueue()},12e4));this.ratelimit.remaining>0;){const t=this.ratelimit.queue.shift();if(!t)return;this._send(t),this.ratelimit.remaining--}}_send(t){if(!this.ws||this.ws.readyState!==l.OPEN)return void this.debug(`Tried to send packet ${t} but no WebSocket is available!`);this.ws.send(this.pack(t))}send(t){if(!this.ws||this.ws.readyState!==l.OPEN)return void this.debug(`Tried to send packet ${t} but no WebSocket is available!`);this.ratelimit.queue.push(t),this.processQueue()}connect(t=this.gateway,e=0,n=!1){if(e)return this.client.setTimeout(()=>this.connect(t,0,n),e);if(this.ws&&!n)return this.debug("WebSocket connection already exists"),!1;if("string"!=typeof t)return this.debug(`Tried to connect to an invalid gateway: ${t}`),!1;this.expectingClose=!1,this.gateway=t,this.debug(`Connecting to ${t}`);const s=this.ws=new l(t);return i&&(s.binaryType="arraybuffer"),s.onmessage=this.onMessage.bind(this),s.onopen=this.onOpen.bind(this),s.onerror=this.onError.bind(this),s.onclose=this.onClose.bind(this),this.status=r.Status.CONNECTING,!0}destroy(){const t=this.ws;return t?(this.heartbeat(-1),this.expectingClose=!0,t.close(1e3),this.packetManager.handleQueue(),this.ws=null,this.status=r.Status.DISCONNECTED,!0):(this.debug("Attempted to destroy WebSocket but no connection exists!"),!1)}onMessage(t){let e;try{e=this.unpack(t.data)}catch(t){this.emit("debug",t)}return this.onPacket(e)}setSequence(t){this.sequence=t>this.sequence?t:this.sequence}onPacket(t){if(!t)return this.debug("Received null packet"),!1;switch(this.client.emit("raw",t),t.op){case r.OPCodes.HELLO:return this.heartbeat(t.d.heartbeat_interval);case r.OPCodes.RECONNECT:return this.reconnect();case r.OPCodes.INVALID_SESSION:return t.d||(this.sessionID=null),this.sequence=-1,this.debug("Session invalidated -- will identify with a new session"),this.identify(t.d?2500:0);case r.OPCodes.HEARTBEAT_ACK:return this.ackHeartbeat();case r.OPCodes.HEARTBEAT:return this.heartbeat();default:return this.packetManager.handle(t)}}onOpen(t){t&&t.target&&t.target.url&&(this.gateway=t.target.url),this.debug(`Connected to gateway ${this.gateway}`),this.identify()}reconnect(){this.debug("Attemping to reconnect in 5500ms..."),this.client.emit(r.Events.RECONNECTING),this.connect(this.gateway,5500,!0)}onError(t){if(t&&"uWs client connection error"===t.message)return void this.reconnect();this.client.emit(r.Events.ERROR,t)}onClose(t){if(this.debug(`${this.expectingClose?"Client":"Server"} closed the WebSocket connection: ${t.code}`),this.closeSequence=this.sequence,this.emit("close",t),this.heartbeat(-1),1e3===t.code?this.expectingClose:r.WSCodes[t.code])return this.expectingClose=!1,this.client.emit(r.Events.DISCONNECT,t),this.debug(r.WSCodes[t.code]),void this.destroy();this.expectingClose=!1,this.reconnect()}ackHeartbeat(){this.debug(`Heartbeat acknowledged, latency of ${Date.now()-this.lastPingTimestamp}ms`),this.client._pong(this.lastPingTimestamp)}heartbeat(t){if(!isNaN(t))return void(-1===t?(this.debug("Clearing heartbeat interval"),this.client.clearInterval(this.heartbeatInterval),this.heartbeatInterval=null):(this.debug(`Setting a heartbeat interval for ${t}ms`),this.heartbeatInterval=this.client.setInterval(()=>this.heartbeat(),t)));this.debug("Sending a heartbeat"),this.lastPingTimestamp=Date.now(),this.send({op:r.OPCodes.HEARTBEAT,d:this.sequence})}identify(t){return t?this.client.setTimeout(this.identify.apply(this),t):this.sessionID?this.identifyResume():this.identifyNew()}identifyNew(){if(!this.client.token)return void this.debug("No token available to identify a new session with");const t=Object.assign({token:this.client.token},this.client.options.ws),{shardId:shardId,shardCount:shardCount}=this.client.options;shardCount>0&&(t.shard=[Number(shardId),Number(shardCount)]),this.debug("Identifying as a new session"),this.send({op:r.OPCodes.IDENTIFY,d:t})}identifyResume(){if(!this.sessionID)return this.debug("Warning: wanted to resume but session ID not available; identifying as a new session instead"),this.identifyNew();this.debug(`Attempting to resume session ${this.sessionID}`);const t={token:this.client.token,session_id:this.sessionID,seq:this.sequence};return this.send({op:r.OPCodes.RESUME,d:t})}}u.ENCODING=c?"etf":"json",u.WebSocket=l,t.exports=u}).call(e,n(6).Buffer)},function(t,e,n){function i(t){return class e extends t{constructor(t,...n){super(s(t,n)),this[o]=t,Error.captureStackTrace&&Error.captureStackTrace(this,e)}get name(){return`${super.name} [${this[o]}]`}get code(){return this[o]}}}function s(t,e){c.strictEqual(typeof t,"string");const n=a.get(t);c(n,`An invalid error message key was used: ${t}.`);let i=l.format;if("function"==typeof n)i=n;else{if(void 0===e||0===e.length)return n;e.unshift(n)}return String(i(...e))}function r(t,e){a.set(t,"function"==typeof e?e:String(e))}const o=Symbol("code"),a=new Map,c=n(81),l=n(41);t.exports={register:r,Error:i(Error),TypeError:i(TypeError),RangeError:i(RangeError)}},function(t,e){class n{constructor(t){this.id=t.id,this.name=t.name,this.vip=t.vip,this.deprecated=t.deprecated,this.optimal=t.optimal,this.custom=t.custom,this.sampleHostname=t.sample_hostname}}t.exports=n},function(t,e,n){t.exports={search:n(190),sendMessage:n(191)}},function(module,exports,__webpack_require__){(function(process){const os=__webpack_require__(26),EventEmitter=__webpack_require__(15),Constants=__webpack_require__(0),Permissions=__webpack_require__(10),Util=__webpack_require__(4),RESTManager=__webpack_require__(69),ClientDataManager=__webpack_require__(112),ClientManager=__webpack_require__(113),ClientDataResolver=__webpack_require__(68),ClientVoiceManager=__webpack_require__(194),WebSocketManager=__webpack_require__(148),ActionsManager=__webpack_require__(114),Collection=__webpack_require__(3),{Presence:Presence}=__webpack_require__(14),VoiceRegion=__webpack_require__(73),Webhook=__webpack_require__(22),User=__webpack_require__(13),Invite=__webpack_require__(28),OAuth2Application=__webpack_require__(29),ShardClientUtil=__webpack_require__(193),VoiceBroadcast=__webpack_require__(195),{Error:Error,TypeError:TypeError,RangeError:RangeError}=__webpack_require__(5);class Client extends EventEmitter{constructor(t={}){super(),!t.shardId&&"SHARD_ID"in process.env&&(t.shardId=Number(process.env.SHARD_ID)),!t.shardCount&&"SHARD_COUNT"in process.env&&(t.shardCount=Number(process.env.SHARD_COUNT)),this.options=Util.mergeDefault(Constants.DefaultOptions,t),this._validateOptions(),this.rest=new RESTManager(this),this.dataManager=new ClientDataManager(this),this.manager=new ClientManager(this),this.ws=new WebSocketManager(this),this.resolver=new ClientDataResolver(this),this.actions=new ActionsManager(this),this.voice=this.browser?null:new ClientVoiceManager(this),this.shard=process.send?ShardClientUtil.singleton(this):null,this.users=new Collection,this.guilds=new Collection,this.channels=new Collection,this.presences=new Collection,Object.defineProperty(this,"token",{writable:!0}),!this.token&&"CLIENT_TOKEN"in process.env?this.token=process.env.CLIENT_TOKEN:this.token=null,this.user=null,this.readyAt=null,this.broadcasts=[],this.pings=[],this._timeouts=new Set,this._intervals=new Set,this.options.messageSweepInterval>0&&this.setInterval(this.sweepMessages.bind(this),1e3*this.options.messageSweepInterval)}get _pingTimestamp(){return this.ws.connection?this.ws.connection.lastPingTimestamp:0}get api(){return this.rest.api}get status(){return this.ws.connection.status}get uptime(){return this.readyAt?Date.now()-this.readyAt:null}get ping(){return this.pings.reduce((t,e)=>t+e,0)/this.pings.length}get voiceConnections(){return this.browser?new Collection:this.voice.connections}get emojis(){const t=new Collection;for(const e of this.guilds.values())for(const n of e.emojis.values())t.set(n.id,n);return t}get readyTimestamp(){return this.readyAt?this.readyAt.getTime():null}get browser(){return"browser"===os.platform()}createVoiceBroadcast(){const t=new VoiceBroadcast(this);return this.broadcasts.push(t),t}login(t){return new Promise((e,n)=>{if("string"!=typeof t)throw new Error("TOKEN_INVALID");t=t.replace(/^Bot\s*/i,"");this.manager.connectToWebSocket(t,e,n)})}destroy(){for(const t of this._timeouts)clearTimeout(t);for(const t of this._intervals)clearInterval(t);return this._timeouts.clear(),this._intervals.clear(),this.manager.destroy()}syncGuilds(t=this.guilds){this.user.bot||this.ws.send({op:12,d:t instanceof Collection?t.keyArray():t.map(t=>t.id)})}fetchUser(t,e=!0){return this.users.has(t)?Promise.resolve(this.users.get(t)):this.api.users[t].get().then(t=>e?this.dataManager.newUser(t):new User(this,t))}fetchInvite(t){const e=this.resolver.resolveInviteCode(t);return this.api.invites[e].get({query:{with_counts:!0}}).then(t=>new Invite(this,t))}fetchWebhook(t,e){return this.api.webhooks.opts(t,e).get().then(t=>new Webhook(this,t))}fetchVoiceRegions(){return this.api.voice.regions.get().then(t=>{const e=new Collection;for(const n of t)e.set(n.id,new VoiceRegion(n));return e})}sweepMessages(t=this.options.messageCacheLifetime){if("number"!=typeof t||isNaN(t))throw new TypeError("CLIENT_INVALID_OPTION","Lifetime","a number");if(t<=0)return this.emit("debug","Didn't sweep messages - lifetime is unlimited"),-1;const e=1e3*t,n=Date.now();let i=0,s=0;for(const t of this.channels.values())if(t.messages){i++;for(const i of t.messages.values())n-(i.editedTimestamp||i.createdTimestamp)>e&&(t.messages.delete(i.id),s++)}return this.emit("debug",`Swept ${s} messages older than ${t} seconds in ${i} text-based channels`),s}fetchApplication(t="@me"){return this.api.oauth2.applications(t).get().then(t=>new OAuth2Application(this,t))}generateInvite(t){return t?t instanceof Array&&(t=Permissions.resolve(t)):t=0,this.fetchApplication().then(e=>`https://discordapp.com/oauth2/authorize?client_id=${e.id}&permissions=${t}&scope=bot`)}setTimeout(t,e,...n){const i=setTimeout(()=>{t(...n);this._timeouts.delete(i)},e);return this._timeouts.add(i),i}clearTimeout(t){clearTimeout(t),this._timeouts.delete(t)}setInterval(t,e,...n){const i=setInterval(t,e,...n);return this._intervals.add(i),i}clearInterval(t){clearInterval(t),this._intervals.delete(t)}_pong(t){this.pings.unshift(Date.now()-t),this.pings.length>3&&(this.pings.length=3),this.ws.lastHeartbeatAck=!0}_setPresence(t,e){if(this.presences.has(t))return void this.presences.get(t).update(e);this.presences.set(t,new Presence(e))}_eval(script){return eval(script)}_validateOptions(t=this.options){if("number"!=typeof t.shardCount||isNaN(t.shardCount))throw new TypeError("CLIENT_INVALID_OPTION","shardCount","a number");if("number"!=typeof t.shardId||isNaN(t.shardId))throw new TypeError("CLIENT_INVALID_OPTION","shardId","a number");if(t.shardCount<0)throw new RangeError("CLIENT_INVALID_OPTION","shardCount","at least 0");if(t.shardId<0)throw new RangeError("CLIENT_INVALID_OPTION","shardId","at least 0");if(0!==t.shardId&&t.shardId>=t.shardCount)throw new RangeError("CLIENT_INVALID_OPTION","shardId","less than shardCount");if("number"!=typeof t.messageCacheMaxSize||isNaN(t.messageCacheMaxSize))throw new TypeError("CLIENT_INVALID_OPTION","messageCacheMaxSize","a number");if("number"!=typeof t.messageCacheLifetime||isNaN(t.messageCacheLifetime))throw new TypeError("CLIENT_INVALID_OPTION","The messageCacheLifetime","a number");if("number"!=typeof t.messageSweepInterval||isNaN(t.messageSweepInterval))throw new TypeError("CLIENT_INVALID_OPTION","messageSweepInterval","a number");if("boolean"!=typeof t.fetchAllMembers)throw new TypeError("CLIENT_INVALID_OPTION","fetchAllMembers","a boolean");if("boolean"!=typeof t.disableEveryone)throw new TypeError("CLIENT_INVALID_OPTION","disableEveryone","a boolean");if("number"!=typeof t.restWsBridgeTimeout||isNaN(t.restWsBridgeTimeout))throw new TypeError("CLIENT_INVALID_OPTION","restWsBridgeTimeout","a number");if("boolean"!=typeof t.internalSharding)throw new TypeError("CLIENT_INVALID_OPTION","internalSharding","a boolean");if(!(t.disabledEvents instanceof Array))throw new TypeError("CLIENT_INVALID_OPTION","disabledEvents","an Array")}}module.exports=Client}).call(exports,__webpack_require__(8))},function(t,e,n){const i=n(22),s=n(69),r=n(68),o=n(0),a=n(4);class c extends i{constructor(t,e,n){super(null,t,e),this.options=a.mergeDefault(o.DefaultOptions,n),this.rest=new s(this),this.resolver=new r(this),this._timeouts=new Set,this._intervals=new Set}get api(){return this.rest.api}setTimeout(t,e,...n){const i=setTimeout(()=>{t(...n);this._timeouts.delete(i)},e);return this._timeouts.add(i),i}clearTimeout(t){clearTimeout(t),this._timeouts.delete(t)}setInterval(t,e,...n){const i=setInterval(t,e,...n);return this._intervals.add(i),i}clearInterval(t){clearInterval(t),this._intervals.delete(t)}destroy(){for(const t of this._timeouts)clearTimeout(t);for(const t of this._intervals)clearInterval(t);this._timeouts.clear(),this._intervals.clear()}}t.exports=c},function(t,e,n){const i=n(4);class s{constructor(t={}){this.title=t.title,this.description=t.description,this.url=t.url,this.color=t.color,this.author=t.author,this.timestamp=t.timestamp,this.fields=t.fields||[],this.thumbnail=t.thumbnail,this.image=t.image,this.footer=t.footer,this.file=t.file}setTitle(t){if(t=i.resolveString(t),t.length>256)throw new RangeError("RichEmbed titles may not exceed 256 characters.");return this.title=t,this}setDescription(t){if(t=i.resolveString(t),t.length>2048)throw new RangeError("RichEmbed descriptions may not exceed 2048 characters.");return this.description=t,this}setURL(t){return this.url=t,this}setColor(t){return this.color=i.resolveColor(t),this}setAuthor(t,e,n){return this.author={name:i.resolveString(t),icon_url:e,url:n},this}setTimestamp(t=new Date){return this.timestamp=t,this}addField(t,e,n=!1){if(this.fields.length>=25)throw new RangeError("RichEmbeds may not exceed 25 fields.");if(t=i.resolveString(t),t.length>256)throw new RangeError("RichEmbed field names may not exceed 256 characters.");if(!/\S/.test(t))throw new RangeError("RichEmbed field names may not be empty.");if(e=i.resolveString(e),e.length>1024)throw new RangeError("RichEmbed field values may not exceed 1024 characters.");if(!/\S/.test(e))throw new RangeError("RichEmbed field values may not be empty.");return this.fields.push({name:t,value:e,inline:n}),this}addBlankField(t=!1){return this.addField("​","​",t)}setThumbnail(t){return this.thumbnail={url:t},this}setImage(t){return this.image={url:t},this}setFooter(t,e){if(t=i.resolveString(t),t.length>2048)throw new RangeError("RichEmbed footer text may not exceed 2048 characters.");return this.footer={text:t,icon_url:e},this}attachFile(t){if(this.file)throw new RangeError("You may not upload more than one file at once.");return this.file=t,this}}t.exports=s},function(t,e){},function(t,e){},function(t,e){},function(t,e,n){"use strict";(function(e){/*! +!function(n,o){s=[],i=o,void 0!==(r="function"==typeof i?i.apply(e,s):i)&&(t.exports=r)}(0,function(){"use strict";function t(t,e,n){this.low=0|t,this.high=0|e,this.unsigned=!!n}function e(t){return!0===(t&&t.__isLong__)}function n(t,e){var n,i,r;return e?(t>>>=0,(r=0<=t&&t<256)&&(i=c[t])?i:(n=s(t,(0|t)<0?-1:0,!0),r&&(c[t]=n),n)):(t|=0,(r=-128<=t&&t<128)&&(i=a[t])?i:(n=s(t,t<0?-1:0,!1),r&&(a[t]=n),n))}function i(t,e){if(isNaN(t)||!isFinite(t))return e?m:f;if(e){if(t<0)return m;if(t>=h)return b}else{if(t<=-p)return w;if(t+1>=p)return _}return t<0?i(-t,e).neg():s(t%u|0,t/u|0,e)}function s(e,n,i){return new t(e,n,i)}function r(t,e,n){if(0===t.length)throw Error("empty string");if("NaN"===t||"Infinity"===t||"+Infinity"===t||"-Infinity"===t)return f;if("number"==typeof e?(n=e,e=!1):e=!!e,(n=n||10)<2||360)throw Error("interior hyphen");if(0===s)return r(t.substring(1),e,n).neg();for(var o=i(l(n,8)),a=f,c=0;c>>0:this.low},y.toNumber=function(){return this.unsigned?(this.high>>>0)*u+(this.low>>>0):this.high*u+(this.low>>>0)},y.toString=function(t){if((t=t||10)<2||36>>0,h=u.toString(t);if(o=c,o.isZero())return h+a;for(;h.length<6;)h="0"+h;a=""+h+a}},y.getHighBits=function(){return this.high},y.getHighBitsUnsigned=function(){return this.high>>>0},y.getLowBits=function(){return this.low},y.getLowBitsUnsigned=function(){return this.low>>>0},y.getNumBitsAbs=function(){if(this.isNegative())return this.eq(w)?64:this.neg().getNumBitsAbs();for(var t=0!=this.high?this.high:this.low,e=31;e>0&&0==(t&1<=0},y.isOdd=function(){return 1==(1&this.low)},y.isEven=function(){return 0==(1&this.low)},y.equals=function(t){return e(t)||(t=o(t)),(this.unsigned===t.unsigned||this.high>>>31!=1||t.high>>>31!=1)&&(this.high===t.high&&this.low===t.low)},y.eq=y.equals,y.notEquals=function(t){return!this.eq(t)},y.neq=y.notEquals,y.lessThan=function(t){return this.comp(t)<0},y.lt=y.lessThan,y.lessThanOrEqual=function(t){return this.comp(t)<=0},y.lte=y.lessThanOrEqual,y.greaterThan=function(t){return this.comp(t)>0},y.gt=y.greaterThan,y.greaterThanOrEqual=function(t){return this.comp(t)>=0},y.gte=y.greaterThanOrEqual,y.compare=function(t){if(e(t)||(t=o(t)),this.eq(t))return 0;var n=this.isNegative(),i=t.isNegative();return n&&!i?-1:!n&&i?1:this.unsigned?t.high>>>0>this.high>>>0||t.high===this.high&&t.low>>>0>this.low>>>0?-1:1:this.sub(t).isNegative()?-1:1},y.comp=y.compare,y.negate=function(){return!this.unsigned&&this.eq(w)?w:this.not().add(g)},y.neg=y.negate,y.add=function(t){e(t)||(t=o(t));var n=this.high>>>16,i=65535&this.high,r=this.low>>>16,a=65535&this.low,c=t.high>>>16,l=65535&t.high,u=t.low>>>16,h=65535&t.low,p=0,d=0,f=0,m=0;return m+=a+h,f+=m>>>16,m&=65535,f+=r+u,d+=f>>>16,f&=65535,d+=i+l,p+=d>>>16,d&=65535,p+=n+c,p&=65535,s(f<<16|m,p<<16|d,this.unsigned)},y.subtract=function(t){return e(t)||(t=o(t)),this.add(t.neg())},y.sub=y.subtract,y.multiply=function(t){if(this.isZero())return f;if(e(t)||(t=o(t)),t.isZero())return f;if(this.eq(w))return t.isOdd()?w:f;if(t.eq(w))return this.isOdd()?w:f;if(this.isNegative())return t.isNegative()?this.neg().mul(t.neg()):this.neg().mul(t).neg();if(t.isNegative())return this.mul(t.neg()).neg();if(this.lt(d)&&t.lt(d))return i(this.toNumber()*t.toNumber(),this.unsigned);var n=this.high>>>16,r=65535&this.high,a=this.low>>>16,c=65535&this.low,l=t.high>>>16,u=65535&t.high,h=t.low>>>16,p=65535&t.low,m=0,g=0,v=0,E=0;return E+=c*p,v+=E>>>16,E&=65535,v+=a*p,g+=v>>>16,v&=65535,v+=c*h,g+=v>>>16,v&=65535,g+=r*p,m+=g>>>16,g&=65535,g+=a*h,m+=g>>>16,g&=65535,g+=c*u,m+=g>>>16,g&=65535,m+=n*p+r*h+a*u+c*l,m&=65535,s(v<<16|E,m<<16|g,this.unsigned)},y.mul=y.multiply,y.divide=function(t){if(e(t)||(t=o(t)),t.isZero())throw Error("division by zero");if(this.isZero())return this.unsigned?m:f;var n,s,r;if(this.unsigned){if(t.unsigned||(t=t.toUnsigned()),t.gt(this))return m;if(t.gt(this.shru(1)))return v;r=m}else{if(this.eq(w)){if(t.eq(g)||t.eq(E))return w;if(t.eq(w))return g;return n=this.shr(1).div(t).shl(1),n.eq(f)?t.isNegative()?g:E:(s=this.sub(t.mul(n)),r=n.add(s.div(t)))}if(t.eq(w))return this.unsigned?m:f;if(this.isNegative())return t.isNegative()?this.neg().div(t.neg()):this.neg().div(t).neg();if(t.isNegative())return this.div(t.neg()).neg();r=f}for(s=this;s.gte(t);){n=Math.max(1,Math.floor(s.toNumber()/t.toNumber()));for(var a=Math.ceil(Math.log(n)/Math.LN2),c=a<=48?1:l(2,a-48),u=i(n),h=u.mul(t);h.isNegative()||h.gt(s);)n-=c,u=i(n,this.unsigned),h=u.mul(t);u.isZero()&&(u=g),r=r.add(u),s=s.sub(h)}return r},y.div=y.divide,y.modulo=function(t){return e(t)||(t=o(t)),this.sub(this.div(t).mul(t))},y.mod=y.modulo,y.not=function(){return s(~this.low,~this.high,this.unsigned)},y.and=function(t){return e(t)||(t=o(t)),s(this.low&t.low,this.high&t.high,this.unsigned)},y.or=function(t){return e(t)||(t=o(t)),s(this.low|t.low,this.high|t.high,this.unsigned)},y.xor=function(t){return e(t)||(t=o(t)),s(this.low^t.low,this.high^t.high,this.unsigned)},y.shiftLeft=function(t){return e(t)&&(t=t.toInt()),0==(t&=63)?this:t<32?s(this.low<>>32-t,this.unsigned):s(0,this.low<>>t|this.high<<32-t,this.high>>t,this.unsigned):s(this.high>>t-32,this.high>=0?0:-1,this.unsigned)},y.shr=y.shiftRight,y.shiftRightUnsigned=function(t){if(e(t)&&(t=t.toInt()),0===(t&=63))return this;var n=this.high;if(t<32){return s(this.low>>>t|n<<32-t,n>>>t,this.unsigned)}return 32===t?s(n,0,this.unsigned):s(n>>>t-32,0,this.unsigned)},y.shru=y.shiftRightUnsigned,y.toSigned=function(){return this.unsigned?s(this.low,this.high,!1):this},y.toUnsigned=function(){return this.unsigned?this:s(this.low,this.high,!0)},y.toBytes=function(t){return t?this.toBytesLE():this.toBytesBE()},y.toBytesLE=function(){var t=this.high,e=this.low;return[255&e,e>>>8&255,e>>>16&255,e>>>24&255,255&t,t>>>8&255,t>>>16&255,t>>>24&255]},y.toBytesBE=function(){var t=this.high,e=this.low;return[t>>>24&255,t>>>16&255,t>>>8&255,255&t,e>>>24&255,e>>>16&255,e>>>8&255,255&e]},t})},function(t,e,n){"use strict";(function(e){function n(t,n,i,s){if("function"!=typeof t)throw new TypeError('"callback" argument must be a function');var r,o,a=arguments.length;switch(a){case 0:case 1:return e.nextTick(t);case 2:return e.nextTick(function(){t.call(null,n)});case 3:return e.nextTick(function(){t.call(null,n,i)});case 4:return e.nextTick(function(){t.call(null,n,i,s)});default:for(r=new Array(a-1),o=0;o-1?i:T;a.WritableState=o;var I=n(23);I.inherits=n(12);var D={deprecate:n(107)},R=n(62),N=n(39).Buffer;I.inherits(a,R),o.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(o.prototype,"buffer",{get:D.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.")})}catch(t){}}();var M;"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(M=Function.prototype[Symbol.hasInstance],Object.defineProperty(a,Symbol.hasInstance,{value:function(t){return!!M.call(this,t)||t&&t._writableState instanceof o}})):M=function(t){return t instanceof this},a.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},a.prototype.write=function(t,e,n){var i=this._writableState,r=!1,o=N.isBuffer(t);return"function"==typeof e&&(n=e,e=null),o?e="buffer":e||(e=i.defaultEncoding),"function"!=typeof n&&(n=s),i.ended?c(this,n):(o||l(this,i,t,n))&&(i.pendingcb++,r=h(this,i,o,t,e,n)),r},a.prototype.cork=function(){this._writableState.corked++},a.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,t.writing||t.corked||t.finished||t.bufferProcessing||!t.bufferedRequest||E(this,t))},a.prototype.setDefaultEncoding=function(t){if("string"==typeof t&&(t=t.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((t+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},a.prototype._write=function(t,e,n){n(new Error("_write() is not implemented"))},a.prototype._writev=null,a.prototype.end=function(t,e,n){var i=this._writableState;"function"==typeof t?(n=t,t=null,e=null):"function"==typeof e&&(n=e,e=null),null!==t&&void 0!==t&&this.write(t,e),i.corked&&(i.corked=1,this.uncork()),i.ending||i.finished||y(this,i,n)}}).call(e,n(8),n(104).setImmediate)},function(t,e,n){t.exports=n(6)},function(t,e,n){const i=n(98);t.exports=i},function(t,e,n){(function(t,i){function s(t,n){var i={seen:[],stylize:o};return arguments.length>=3&&(i.depth=arguments[2]),arguments.length>=4&&(i.colors=arguments[3]),m(n)?i.showHidden=n:n&&e._extend(i,n),w(i.showHidden)&&(i.showHidden=!1),w(i.depth)&&(i.depth=2),w(i.colors)&&(i.colors=!1),w(i.customInspect)&&(i.customInspect=!0),i.colors&&(i.stylize=r),c(i,t,i.depth)}function r(t,e){var n=s.styles[e];return n?"["+s.colors[n][0]+"m"+t+"["+s.colors[n][1]+"m":t}function o(t,e){return t}function a(t){var e={};return t.forEach(function(t,n){e[t]=!0}),e}function c(t,n,i){if(t.customInspect&&n&&S(n.inspect)&&n.inspect!==e.inspect&&(!n.constructor||n.constructor.prototype!==n)){var s=n.inspect(i,t);return _(s)||(s=c(t,s,i)),s}var r=l(t,n);if(r)return r;var o=Object.keys(n),m=a(o);if(t.showHidden&&(o=Object.getOwnPropertyNames(n)),T(n)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return u(n);if(0===o.length){if(S(n)){var g=n.name?": "+n.name:"";return t.stylize("[Function"+g+"]","special")}if(y(n))return t.stylize(RegExp.prototype.toString.call(n),"regexp");if(A(n))return t.stylize(Date.prototype.toString.call(n),"date");if(T(n))return u(n)}var v="",E=!1,b=["{","}"];if(f(n)&&(E=!0,b=["[","]"]),S(n)){v=" [Function"+(n.name?": "+n.name:"")+"]"}if(y(n)&&(v=" "+RegExp.prototype.toString.call(n)),A(n)&&(v=" "+Date.prototype.toUTCString.call(n)),T(n)&&(v=" "+u(n)),0===o.length&&(!E||0==n.length))return b[0]+v+b[1];if(i<0)return y(n)?t.stylize(RegExp.prototype.toString.call(n),"regexp"):t.stylize("[Object]","special");t.seen.push(n);var w;return w=E?h(t,n,i,m,o):o.map(function(e){return p(t,n,i,m,e,E)}),t.seen.pop(),d(w,v,b)}function l(t,e){if(w(e))return t.stylize("undefined","undefined");if(_(e)){var n="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(n,"string")}return E(e)?t.stylize(""+e,"number"):m(e)?t.stylize(""+e,"boolean"):g(e)?t.stylize("null","null"):void 0}function u(t){return"["+Error.prototype.toString.call(t)+"]"}function h(t,e,n,i,s){for(var r=[],o=0,a=e.length;o-1&&(a=r?a.split("\n").map(function(t){return" "+t}).join("\n").substr(2):"\n"+a.split("\n").map(function(t){return" "+t}).join("\n"))):a=t.stylize("[Circular]","special")),w(o)){if(r&&s.match(/^\d+$/))return a;o=JSON.stringify(""+s),o.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(o=o.substr(1,o.length-2),o=t.stylize(o,"name")):(o=o.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),o=t.stylize(o,"string"))}return o+": "+a}function d(t,e,n){var i=0;return t.reduce(function(t,e){return i++,e.indexOf("\n")>=0&&i++,t+e.replace(/\u001b\[\d\d?m/g,"").length+1},0)>60?n[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+n[1]:n[0]+e+" "+t.join(", ")+" "+n[1]}function f(t){return Array.isArray(t)}function m(t){return"boolean"==typeof t}function g(t){return null===t}function v(t){return null==t}function E(t){return"number"==typeof t}function _(t){return"string"==typeof t}function b(t){return"symbol"==typeof t}function w(t){return void 0===t}function y(t){return x(t)&&"[object RegExp]"===D(t)}function x(t){return"object"==typeof t&&null!==t}function A(t){return x(t)&&"[object Date]"===D(t)}function T(t){return x(t)&&("[object Error]"===D(t)||t instanceof Error)}function S(t){return"function"==typeof t}function I(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t}function D(t){return Object.prototype.toString.call(t)}function R(t){return t<10?"0"+t.toString(10):t.toString(10)}function N(){var t=new Date,e=[R(t.getHours()),R(t.getMinutes()),R(t.getSeconds())].join(":");return[t.getDate(),C[t.getMonth()],e].join(" ")}function M(t,e){return Object.prototype.hasOwnProperty.call(t,e)}e.format=function(t){if(!_(t)){for(var e=[],n=0;n=r)return t;switch(t){case"%s":return String(i[n++]);case"%d":return Number(i[n++]);case"%j":try{return JSON.stringify(i[n++])}catch(t){return"[Circular]"}default:return t}}),a=i[n];n",license:"Apache-2.0",bugs:{url:"https://github.com/hydrabolt/discord.js/issues"},homepage:"https://github.com/hydrabolt/discord.js#readme",runkitExampleFilename:"./docs/examples/ping.js",dependencies:{long:"^3.2.0","prism-media":"^0.0.1",snekfetch:"^3.1.0",tweetnacl:"^1.0.0",ws:"^3.0.0"},peerDependencies:{bufferutil:"^3.0.0",erlpack:"hammerandchisel/erlpack","node-opus":"^0.2.5",opusscript:"^0.0.3",sodium:"^2.0.1","libsodium-wrappers":"^0.5.1",uws:"^0.14.1"},devDependencies:{"@types/node":"^7.0.0","discord.js-docgen":"hydrabolt/discord.js-docgen",eslint:"^3.19.0","parallel-webpack":"^1.6.0","uglify-js":"mishoo/UglifyJS2#harmony-v2.8.22","uglifyjs-webpack-plugin":"^0.4.3",webpack:"^2.2.0"},engines:{node:">=8.0.0"},browser:{ws:!1,uws:!1,erlpack:!1,"prism-media":!1,opusscript:!1,"node-opus":!1,tweetnacl:!1,sodium:!1,"src/sharding/Shard.js":!1,"src/sharding/ShardClientUtil.js":!1,"src/sharding/ShardingManager.js":!1,"src/client/voice/dispatcher/StreamDispatcher.js":!1,"src/client/voice/opus/BaseOpusEngine.js":!1,"src/client/voice/opus/NodeOpusEngine.js":!1,"src/client/voice/opus/OpusEngineList.js":!1,"src/client/voice/opus/OpusScriptEngine.js":!1,"src/client/voice/pcm/ConverterEngine.js":!1,"src/client/voice/pcm/ConverterEngineList.js":!1,"src/client/voice/pcm/FfmpegConverterEngine.js":!1,"src/client/voice/player/AudioPlayer.js":!1,"src/client/voice/receiver/VoiceReadable.js":!1,"src/client/voice/receiver/VoiceReceiver.js":!1,"src/client/voice/util/Secretbox.js":!1,"src/client/voice/util/SecretKey.js":!1,"src/client/voice/util/VolumeInterface.js":!1,"src/client/voice/ClientVoiceManager.js":!1,"src/client/voice/VoiceBroadcast.js":!1,"src/client/voice/VoiceConnection.js":!1,"src/client/voice/VoiceUDPClient.js":!1,"src/client/voice/VoiceWebSocket.js":!1}}},function(t,e,n){(function(e){const i=n(13),s=n(3),r=n(45),o=n(0),a=n(4),c=n(19),l=n(9),u=n(32),{TypeError:TypeError}=n(5);class h extends i{setup(t){super.setup(t),this.verified=t.verified,this.email=t.email,this.localPresence={},this._typing=new Map,this.friends=new s,this.blocked=new s,this.notes=new s,this.premium="boolean"==typeof t.premium?t.premium:null,this.mfaEnabled="boolean"==typeof t.mfa_enabled?t.mfa_enabled:null,this.mobile="boolean"==typeof t.mobile?t.mobile:null,t.user_settings&&(this.settings=new r(this,t.user_settings))}edit(t,e){const n={};return n.username=t.username||this.username,n.avatar=this.client.resolver.resolveBase64(t.avatar),this.bot||(n.email=t.email||this.email,n.password=e,t.new_password&&(n.new_password=t.newPassword)),this.client.api.users["@me"].patch({data:t}).then(t=>this.client.actions.UserUpdate.handle(t).updated)}setUsername(t,e){return this.edit({username:t},e)}setEmail(t,e){return this.edit({email:t},e)}setPassword(t,e){return this.edit({password:t},e)}setAvatar(t){return"string"==typeof t&&t.startsWith("data:")?this.edit({avatar:t}):this.client.resolver.resolveBuffer(t||e.alloc(0)).then(t=>this.edit({avatar:this.client.resolver.resolveBase64(t)||null}))}setPresence(t){return new Promise(e=>{let n=this.localPresence.status||this.presence.status;let i=this.localPresence.game;let s=this.localPresence.afk||this.presence.afk;!i&&this.presence.game&&(i={name:this.presence.game.name,type:this.presence.game.type,url:this.presence.game.url});if(t.status){if("string"!=typeof t.status)throw new TypeError("STATUS_TYPE");this.bot?n=t.status:(this.settings.update(o.UserSettingsMap.status,t.status),n="invisible")}t.game?(i=t.game,i.url&&(i.type=1)):void 0!==t.game&&(i=null);void 0!==t.afk&&(s=t.afk);s=Boolean(s);this.localPresence={status:n,game:i,afk:s};this.localPresence.since=0;this.localPresence.game=this.localPresence.game||null;this.client.ws.send({op:3,d:this.localPresence});this.client._setPresence(this.id,this.localPresence);e(this)})}setStatus(t){return this.setPresence({status:t})}setGame(t,e){return t?this.setPresence({game:{name:t,url:e}}):this.setPresence({game:null})}setAFK(t){return this.setPresence({afk:t})}fetchMentions(t={}){return t.guild instanceof c&&(t.guild=t.guild.id),a.mergeDefault({limit:25,roles:!0,everyone:!0,guild:null},t),this.client.api.users["@me"].mentions.get({query:t}).then(t=>t.map(t=>new l(this.client.channels.get(t.channel_id),t,this.client)))}createGuild(t,{region:region,icon:icon=null}={}){return!icon||"string"==typeof icon&&icon.startsWith("data:")?new Promise((e,n)=>this.client.api.guilds.post({data:{name:t,region:region,icon:icon}}).then(t=>{if(this.client.guilds.has(t.id))return e(this.client.guilds.get(t.id));const n=s=>{s.id===t.id&&(this.client.removeListener(o.Events.GUILD_CREATE,n),this.client.clearTimeout(i),e(s))};this.client.on(o.Events.GUILD_CREATE,n);const i=this.client.setTimeout(()=>{this.client.removeListener(o.Events.GUILD_CREATE,n);e(this.client.dataManager.newGuild(t))},1e4);return},n)):this.client.resolver.resolveBuffer(icon).then(e=>this.createGuild(t,{region:region,icon:this.client.resolver.resolveBase64(e)||null}))}createGroupDM(t){const e=this.bot?{access_tokens:t.map(t=>t.accessToken),nicks:t.reduce((t,e)=>{e.nick&&(t[e.user?e.user.id:e.id]=e.nick);return t},{})}:{recipients:t.map(t=>this.client.resolver.resolveUserID(t))};return this.client.api.users["@me"].channels.post({data:e}).then(t=>new u(this.client,t))}}t.exports=h}).call(e,n(6).Buffer)},function(t,e,n){const i=n(0),s=n(4);class r{constructor(t,e){this.user=t,this.patch(e)}patch(t){for(const[e,n]of Object.entries(i.UserSettingsMap))t.hasOwnProperty(e)&&("function"==typeof n?this[n.name]=n(t[e]):this[n]=t[e])}update(t,e){return this.user.client.api.users["@me"].settings.patch({data:{[t]:e}})}setGuildPosition(t,e,n){const i=Object.assign([],this.guildPositions);return s.moveElementInArray(i,t.id,e,n),this.update("guild_positions",i).then(()=>t)}addRestrictedGuild(t){const e=Object.assign([],this.restrictedGuilds);return e.includes(t.id)?Promise.reject(new Error("Guild is already restricted")):(e.push(t.id),this.update("restricted_guilds",e).then(()=>t))}removeRestrictedGuild(t){const e=Object.assign([],this.restrictedGuilds),n=e.indexOf(t.id);return n<0?Promise.reject(new Error("Guild is not restricted")):(e.splice(n,1),this.update("restricted_guilds",e).then(()=>t))}}t.exports=r},function(t,e,n){const i=n(17),s=n(25),r=n(3);class o extends i{constructor(t,e){super(t,e),this.type="dm",this.messages=new r,this._typing=new Map}setup(t){super.setup(t),this.recipient=this.client.dataManager.newUser(t.recipients[0]),this.lastMessageID=t.last_message_id}toString(){return this.recipient.toString()}send(){}fetchMessage(){}fetchMessages(){}fetchPinnedMessages(){}search(){}startTyping(){}stopTyping(){}get typing(){}get typingCount(){}createMessageCollector(){}awaitMessages(){}acknowledge(){}_cacheMessage(){}}s.applyToClass(o,!0,["bulkDelete"]),t.exports=o},function(t,e,n){const i=n(3),s=n(7),r={ALL:"ALL",GUILD:"GUILD",CHANNEL:"CHANNEL",USER:"USER",ROLE:"ROLE",INVITE:"INVITE",WEBHOOK:"WEBHOOK",EMOJI:"EMOJI",MESSAGE:"MESSAGE",UNKNOWN:"UNKNOWN"},o={ALL:null,GUILD_UPDATE:1,CHANNEL_CREATE:10,CHANNEL_UPDATE:11,CHANNEL_DELETE:12,CHANNEL_OVERWRITE_CREATE:13,CHANNEL_OVERWRITE_UPDATE:14,CHANNEL_OVERWRITE_DELETE:15,MEMBER_KICK:20,MEMBER_PRUNE:21,MEMBER_BAN_ADD:22,MEMBER_BAN_REMOVE:23,MEMBER_UPDATE:24,MEMBER_ROLE_UPDATE:25,ROLE_CREATE:30,ROLE_UPDATE:31,ROLE_DELETE:32,INVITE_CREATE:40,INVITE_UPDATE:41,INVITE_DELETE:42,WEBHOOK_CREATE:50,WEBHOOK_UPDATE:51,WEBHOOK_DELETE:52,EMOJI_CREATE:60,EMOJI_UPDATE:61,EMOJI_DELETE:62,MESSAGE_DELETE:72};class a{constructor(t,e){if(e.users)for(const n of e.users)t.client.dataManager.newUser(n);this.entries=new i;for(const n of e.audit_log_entries){const e=new c(t,n);this.entries.set(e.id,e)}}static build(...t){const e=new a(...t);return Promise.all(e.entries.map(t=>t.target)).then(()=>e)}static targetType(t){return t<10?r.GUILD:t<20?r.CHANNEL:t<30?r.USER:t<40?r.ROLE:t<50?r.INVITE:t<60?r.WEBHOOK:t<70?r.EMOJI:t<80?r.MESSAGE:r.UNKNOWN}static actionType(t){return[o.CHANNEL_CREATE,o.CHANNEL_OVERWRITE_CREATE,o.MEMBER_BAN_REMOVE,o.ROLE_CREATE,o.INVITE_CREATE,o.WEBHOOK_CREATE,o.EMOJI_CREATE].includes(t)?"CREATE":[o.CHANNEL_DELETE,o.CHANNEL_OVERWRITE_DELETE,o.MEMBER_KICK,o.MEMBER_PRUNE,o.MEMBER_BAN_ADD,o.ROLE_DELETE,o.INVITE_DELETE,o.WEBHOOK_DELETE,o.EMOJI_DELETE,o.MESSAGE_DELETE].includes(t)?"DELETE":[o.GUILD_UPDATE,o.CHANNEL_UPDATE,o.CHANNEL_OVERWRITE_UPDATE,o.MEMBER_UPDATE,o.MEMBER_ROLE_UPDATE,o.ROLE_UPDATE,o.INVITE_UPDATE,o.WEBHOOK_UPDATE,o.EMOJI_UPDATE].includes(t)?"UPDATE":"ALL"}}class c{constructor(t,e){const n=a.targetType(e.action_type);if(this.targetType=n,this.actionType=a.actionType(e.action_type),this.action=Object.keys(o).find(t=>o[t]===e.action_type),this.reason=e.reason||null,this.executor=t.client.users.get(e.user_id),this.changes=e.changes?e.changes.map(t=>({key:t.key,old:t.old_value,new:t.new_value})):null,this.id=e.id,this.extra=null,e.options)if(e.action_type===o.MEMBER_PRUNE)this.extra={removed:e.options.members_removed,days:e.options.delete_member_days};else if(e.action_type===o.MESSAGE_DELETE)this.extra={count:e.options.count,channel:t.channels.get(e.options.channel_id)};else switch(e.options.type){case"member":this.extra=t.members.get(e.options.id),this.extra||(this.extra={id:e.options.id});break;case"role":this.extra=t.roles.get(e.options.id),this.extra||(this.extra={id:e.options.id,name:e.options.role_name})}if(n===r.UNKNOWN)this.target=e.target_id;else if([r.USER,r.GUILD].includes(n))this.target=t.client[`${n.toLowerCase()}s`].get(e.target_id);else if(n===r.WEBHOOK)this.target=t.fetchWebhooks().then(t=>{this.target=t.find(t=>t.id===e.target_id);return this.target});else if(n===r.INVITE){const e=this.changes.find(t=>"code"===t.key);this.target=t.fetchInvites().then(t=>{this.target=t.find(t=>t.code===(e.new_value||e.old_value));return this.target})}else this.target=n===r.MESSAGE?t.client.users.get(e.target_id):t[`${n.toLowerCase()}s`].get(e.target_id)}get createdTimestamp(){return s.deconstruct(this.id).timestamp}get createdAt(){return new Date(this.createdTimestamp)}}a.Actions=o,a.Targets=r,a.Entry=c,t.exports=a},function(t,e){class n{constructor(t,e){Object.defineProperty(this,"client",{value:t.client}),this.message=t,this.setup(e)}setup(t){this.id=t.id,this.filename=t.filename,this.filesize=t.size,this.url=t.url,this.proxyURL=t.proxy_url,this.height=t.height,this.width=t.width}}t.exports=n},function(t,e,n){const i=n(34);class s extends i{constructor(t,e,n={}){super(t.client,e,n),this.channel=t,this.received=0,this.client.on("message",this.listener)}handle(t){return t.channel.id!==this.channel.id?null:(this.received++,{key:t.id,value:t})}postCheck(){return this.options.max&&this.collected.size>=this.options.max?"limit":this.options.maxProcessed&&this.received===this.options.maxProcessed?"processedLimit":null}cleanup(){this.client.removeListener("message",this.listener)}}t.exports=s},function(t,e,n){const i=n(4),{RangeError:RangeError}=n(5);class s{constructor(t){this.setup(t)}setup(t){this.type=t.type,this.title=t.title||null,this.description=t.description||null,this.url=t.url||null,this.color=t.color||null,this.timestamp=new Date(t.timestamp)||null,this.fields=t.fields||null,this.thumbnail=t.thumbnail?{url:t.thumbnail.url||null,proxyURL:t.thumbnail.proxy_url,height:t.height,width:t.width}:null,this.image=t.image?{url:t.image.url||null,proxyURL:t.image.proxy_url,height:t.height,width:t.width}:null,this.video=t.video?{url:t.video.url||null,height:t.video.height,width:t.video.width}:null,this.author=t.author?{name:t.author.name||null,url:t.author.url||null,iconURL:t.author.iconURL||t.author.icon_url||null,proxyIconURL:t.author.proxyIconUrl||t.author.proxy_icon_url||null}:null,this.provider=t.provider?{name:t.provider.name,url:t.provider.url}:null,this.footer=t.footer?{text:t.footer.text||null,iconURL:t.footer.iconURL||t.footer.icon_url||null,proxyIconURL:t.footer.proxyIconURL||t.footer.proxy_icon_url||null}:null}get createdAt(){return new Date(this.timestamp)}get hexColor(){let t=this.color.toString(16);for(;t.length<6;)t=`0${t}`;return`#${t}`}addField(t,e,n=!1){if(this.fields.length>=25)throw new RangeError("EMBED_FIELD_COUNT");if(t=i.resolveString(t),!String(t)||t.length>256)throw new RangeError("EMBED_FIELD_NAME");if(e=i.resolveString(e),!String(t)||e.length>1024)throw new RangeError("EMBED_FIELD_VALUE");return this.fields.push({name:t,value:e,inline:n}),this}attachFile(t){if(this.file)throw new RangeError("EMBED_FILE_LIMIT");return this.file=t,this}setAuthor(t,e,n){return this.author={name:i.resolveString(t),iconURL:e,url:n},this}setColor(t){return this.color=i.resolveColor(t),this}setDescription(t){if(t=i.resolveString(t),t.length>2048)throw new RangeError("EMBED_DESCRIPTION");return this.description=t,this}setFooter(t,e){if(t=i.resolveString(t),t.length>2048)throw new RangeError("EMBED_FOOTER_TEXT");return this.footer={text:t,iconURL:e},this}setImage(t){return this.image={url:t},this}setThumbnail(t){return this.thumbnail={url:t},this}setTimestamp(t=new Date){return this.timestamp=t,this}setTitle(t){if(t=i.resolveString(t),t.length>256)throw new RangeError("EMBED_TITLE");return this.title=t,this}setURL(t){return this.url=t,this}}t.exports=s},function(t,e,n){const i=n(3);class s{constructor(t,e,n,s){if(this.everyone=Boolean(s),e)if(e instanceof i)this.users=new i(e);else{this.users=new i;for(const n of e){let e=t.client.users.get(n.id);e||(e=t.client.dataManager.newUser(n)),this.users.set(e.id,e)}}else this.users=new i;if(n)if(n instanceof i)this.roles=new i(n);else{this.roles=new i;for(const e of n){const n=t.channel.guild.roles.get(e);n&&this.roles.set(n.id,n)}}else this.roles=new i;this._content=t.content,this._client=t.client,this._guild=t.channel.guild,this._members=null,this._channels=null}get members(){return this._members?this._members:this._guild?(this._members=new i,this.users.forEach(t=>{const e=this._guild.member(t);e&&this._members.set(e.user.id,e)}),this._members):null}get channels(){if(this._channels)return this._channels;this._channels=new i;let t;for(;null!==(t=this.constructor.CHANNELS_PATTERN.exec(this._content));){const e=this._client.channels.get(t[1]);e&&this._channels.set(e.id,e)}return this._channels}}s.EVERYONE_PATTERN=/@(everyone|here)/g,s.USERS_PATTERN=/<@!?[0-9]+>/g,s.ROLES_PATTERN=/<@&[0-9]+>/g,s.CHANNELS_PATTERN=/<#([0-9]+)>/g,t.exports=s},function(t,e,n){const i=n(3),s=n(18),r=n(33);class o{constructor(t,e,n,s){this.message=t,this.me=s,this.count=n||0,this.users=new i,this._emoji=new r(this,e.name,e.id)}get emoji(){if(this._emoji instanceof s)return this._emoji;if(this._emoji.id){const t=this.message.client.emojis;if(t.has(this._emoji.id)){const e=t.get(this._emoji.id);return this._emoji=e,e}}return this._emoji}remove(t=this.message.client.user){const e=this.message.client.resolver.resolveUserID(t);return e?this.message.client.api.channels[this.message.channel.id].messages[this.message.id].reactions[this.emoji.identifier][e===this.message.client.user.id?"@me":e].delete().then(()=>this.message.client.actions.MessageReactionRemove.handle({user_id:e,message_id:this.message.id,emoji:this.emoji,channel_id:this.message.channel.id}).reaction):Promise.reject(new Error("Couldn't resolve the user ID to remove from the reaction."))}fetchUsers(t=100){const e=this.message;return e.client.api.channels[e.channel.id].messages[e.id].reactions[this.emoji.identifier].get({query:{limit:t}}).then(t=>{this.users=new i;for(const n of t){const t=e.client.dataManager.newUser(n);this.users.set(t.id,t)}this.count=this.users.size;return this.users})}}t.exports=o},function(t,e){class n{constructor(t,e){Object.defineProperty(this,"client",{value:t}),this.setup(e)}setup(t){this.id=t.id,this.name=t.name,this.icon=t.icon,this.splash=t.splash}}t.exports=n},function(t,e,n){const i=n(0);class s{constructor(t,e){Object.defineProperty(this,"client",{value:t}),this.setup(e)}setup(t){this.id=t.id,this.name=t.name,this.type=i.ChannelTypes.TEXT===t.type?"text":"voice"}}t.exports=s},function(t,e,n){const i=n(10);class s{constructor(t,e){Object.defineProperty(this,"channel",{value:t}),e&&this.setup(e)}setup(t){this.id=t.id,this.type=t.type,this._denied=t.deny,this._allowed=t.allow,this.denied=new i(this._denied),this.allowed=new i(this._allowed)}delete(t){return this.channel.client.api.channels[this.channel.id].permissions[this.id].delete({reason:t}).then(()=>this)}}t.exports=s},function(t,e,n){const i=n(34),s=n(3);class r extends i{constructor(t,e,n={}){super(t.client,e,n),this.message=t,this.users=new s,this.total=0,this.client.on("messageReactionAdd",this.listener)}handle(t){return t.message.id!==this.message.id?null:{key:t.emoji.id||t.emoji.name,value:t}}postCheck(t,e){return this.users.set(e.id,e),this.options.max&&++this.total>=this.options.max?"limit":this.options.maxEmojis&&this.collected.size>=this.options.maxEmojis?"emojiLimit":this.options.maxUsers&&this.users.size>=this.options.maxUsers?"userLimit":null}cleanup(){this.client.removeListener("messageReactionAdd",this.listener)}}t.exports=r},function(t,e,n){const i=n(27),s=n(22),r=n(25),o=n(3);class a extends i{constructor(t,e){super(t,e),this.type="text",this.messages=new o,this._typing=new Map}setup(t){super.setup(t),this.topic=t.topic,this.lastMessageID=t.last_message_id}get members(){const t=new o;for(const e of this.guild.members.values())this.permissionsFor(e).has("READ_MESSAGES")&&t.set(e.id,e);return t}get nsfw(){return/^nsfw(-|$)/.test(this.name)}fetchWebhooks(){return this.client.api.channels[this.id].webhooks.get().then(t=>{const e=new o;for(const n of t)e.set(n.id,new s(this.client,n));return e})}createWebhook(t,e){return"string"==typeof e&&e.startsWith("data:")?this.client.api.channels[this.id].webhooks.post({data:{name:t,avatar:e}}).then(t=>new s(this.client,t)):this.client.resolver.resolveBuffer(e).then(e=>this.createWebhook(t,this.client.resolver.resolveBase64(e)||null))}send(){}fetchMessage(){}fetchMessages(){}fetchPinnedMessages(){}search(){}startTyping(){}stopTyping(){}get typing(){}get typingCount(){}createMessageCollector(){}awaitMessages(){}bulkDelete(){}acknowledge(){}_cacheMessage(){}}r.applyToClass(a,!0),t.exports=a},function(t,e,n){const i=n(27),s=n(3);class r extends i{constructor(t,e){super(t,e),this.members=new s,this.type="voice"}setup(t){super.setup(t),this.bitrate=t.bitrate,this.userLimit=t.user_limit}get connection(){const t=this.guild.voiceConnection;return t&&t.channel.id===this.id?t:null}get full(){return this.userLimit>0&&this.members.size>=this.userLimit}get joinable(){return!this.client.browser&&(!!this.permissionsFor(this.client.user).has("CONNECT")&&!(this.full&&!this.permissionsFor(this.client.user).has("MOVE_MEMBERS")))}get speakable(){return this.permissionsFor(this.client.user).has("SPEAK")}setBitrate(t){return this.edit({bitrate:t})}setUserLimit(t){return this.edit({userLimit:t})}join(){return this.client.browser?Promise.reject(new Error("Voice connections are not available in browsers.")):this.client.voice.joinChannel(this)}leave(){if(!this.client.browser){const t=this.client.voice.connections.get(this.guild.id);t&&t.channel.id===this.id&&t.disconnect()}}}t.exports=r},function(t,e){var n={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==n.call(t)}},function(t,e,n){"use strict";(function(e){function i(t,e,n){if("function"==typeof t.prependListener)return t.prependListener(e,n);t._events&&t._events[e]?N(t._events[e])?t._events[e].unshift(n):t._events[e]=[n,t._events[e]]:t.on(e,n)}function s(t,e){D=D||n(16),t=t||{},this.objectMode=!!t.objectMode,e instanceof D&&(this.objectMode=this.objectMode||!!t.readableObjectMode);var i=t.highWaterMark,s=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:s,this.highWaterMark=~~this.highWaterMark,this.buffer=new j,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.ranOut=!1,this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(P||(P=n(67).StringDecoder),this.decoder=new P(t.encoding),this.encoding=t.encoding)}function r(t){if(D=D||n(16),!(this instanceof r))return new r(t);this._readableState=new s(t,this),this.readable=!0,t&&"function"==typeof t.read&&(this._read=t.read),k.call(this)}function o(t,e,n,i,s){var r=u(e,n);if(r)t.emit("error",r);else if(null===n)e.reading=!1,h(t,e);else if(e.objectMode||n&&n.length>0)if(e.ended&&!s){var o=new Error("stream.push() after EOF");t.emit("error",o)}else if(e.endEmitted&&s){var c=new Error("stream.unshift() after end event");t.emit("error",c)}else{var l;!e.decoder||s||i||(n=e.decoder.write(n),l=!e.objectMode&&0===n.length),s||(e.reading=!1),l||(e.flowing&&0===e.length&&!e.sync?(t.emit("data",n),t.read(0)):(e.length+=e.objectMode?1:n.length,s?e.buffer.unshift(n):e.buffer.push(n),e.needReadable&&p(t))),f(t,e)}else s||(e.reading=!1);return a(e)}function a(t){return!t.ended&&(t.needReadable||t.length=B?t=B:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}function l(t,e){return t<=0||0===e.length&&e.ended?0:e.objectMode?1:t!==t?e.flowing&&e.length?e.buffer.head.data.length:e.length:(t>e.highWaterMark&&(e.highWaterMark=c(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function u(t,e){var n=null;return O.isBuffer(e)||"string"==typeof e||null===e||void 0===e||t.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}function h(t,e){if(!e.ended){if(e.decoder){var n=e.decoder.end();n&&n.length&&(e.buffer.push(n),e.length+=e.objectMode?1:n.length)}e.ended=!0,p(t)}}function p(t){var e=t._readableState;e.needReadable=!1,e.emittedReadable||(U("emitReadable",e.flowing),e.emittedReadable=!0,e.sync?R(d,t):d(t))}function d(t){U("emit readable"),t.emit("readable"),b(t)}function f(t,e){e.readingMore||(e.readingMore=!0,R(m,t,e))}function m(t,e){for(var n=e.length;!e.reading&&!e.flowing&&!e.ended&&e.length=e.length?(n=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.head.data:e.buffer.concat(e.length),e.buffer.clear()):n=y(t,e.buffer,e.decoder),n}function y(t,e,n){var i;return tr.length?r.length:t;if(o===r.length?s+=r:s+=r.slice(0,t),0===(t-=o)){o===r.length?(++i,n.next?e.head=n.next:e.head=e.tail=null):(e.head=n,n.data=r.slice(o));break}++i}return e.length-=i,s}function A(t,e){var n=O.allocUnsafe(t),i=e.head,s=1;for(i.data.copy(n),t-=i.data.length;i=i.next;){var r=i.data,o=t>r.length?r.length:t;if(r.copy(n,n.length-t,0,o),0===(t-=o)){o===r.length?(++s,i.next?e.head=i.next:e.head=e.tail=null):(e.head=i,i.data=r.slice(o));break}++s}return e.length-=s,n}function T(t){var e=t._readableState;if(e.length>0)throw new Error('"endReadable()" called on non-empty stream');e.endEmitted||(e.ended=!0,R(S,e,t))}function S(t,e){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}function I(t,e){for(var n=0,i=t.length;n=e.highWaterMark||e.ended))return U("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?T(this):p(this),null;if(0===(t=l(t,e))&&e.ended)return 0===e.length&&T(this),null;var i=e.needReadable;U("need readable",i),(0===e.length||e.length-t0?w(t,e):null,null===s?(e.needReadable=!0,t=0):e.length-=t,0===e.length&&(e.ended||(e.needReadable=!0),n!==t&&e.ended&&T(this)),null!==s&&this.emit("data",s),s},r.prototype._read=function(t){this.emit("error",new Error("_read() is not implemented"))},r.prototype.pipe=function(t,n){function s(t){U("onunpipe"),t===p&&o()}function r(){U("onend"),t.end()}function o(){U("cleanup"),t.removeListener("close",l),t.removeListener("finish",u),t.removeListener("drain",v),t.removeListener("error",c),t.removeListener("unpipe",s),p.removeListener("end",r),p.removeListener("end",h),p.removeListener("data",a),E=!0,!d.awaitDrain||t._writableState&&!t._writableState.needDrain||v()}function a(e){U("ondata"),_=!1,!1!==t.write(e)||_||((1===d.pipesCount&&d.pipes===t||d.pipesCount>1&&-1!==I(d.pipes,t))&&!E&&(U("false write response, pause",p._readableState.awaitDrain),p._readableState.awaitDrain++,_=!0),p.pause())}function c(e){U("onerror",e),h(),t.removeListener("error",c),0===M(t,"error")&&t.emit("error",e)}function l(){t.removeListener("finish",u),h()}function u(){U("onfinish"),t.removeListener("close",l),h()}function h(){U("unpipe"),p.unpipe(t)}var p=this,d=this._readableState;switch(d.pipesCount){case 0:d.pipes=t;break;case 1:d.pipes=[d.pipes,t];break;default:d.pipes.push(t)}d.pipesCount+=1,U("pipe count=%d opts=%j",d.pipesCount,n);var f=(!n||!1!==n.end)&&t!==e.stdout&&t!==e.stderr,m=f?r:h;d.endEmitted?R(m):p.once("end",m),t.on("unpipe",s);var v=g(p);t.on("drain",v);var E=!1,_=!1;return p.on("data",a),i(t,"error",c),t.once("close",l),t.once("finish",u),t.emit("pipe",p),d.flowing||(U("pipe resume"),p.resume()),t},r.prototype.unpipe=function(t){var e=this._readableState;if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes?this:(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this),this);if(!t){var n=e.pipes,i=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var s=0;s",'"',"`"," ","\r","\n","\t"],f=["{","}","|","\\","^","`"].concat(d),m=["'"].concat(f),g=["%","/","?",";","#"].concat(m),v=["/","?","#"],E={javascript:!0,"javascript:":!0},_={javascript:!0,"javascript:":!0},b={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},w=n(37);i.prototype.parse=function(t,e,n){if(!l.isString(t))throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var i=t.indexOf("?"),s=-1!==i&&i127?M+="x":M+=N[k];if(!M.match(/^[+a-z0-9A-Z_-]{0,63}$/)){var C=D.slice(0,x),L=D.slice(x+1),U=N.match(/^([+a-z0-9A-Z_-]{0,63})(.*)$/);U&&(C.push(U[1]),L.unshift(U[2])),L.length&&(o="/"+L.join(".")+o),this.hostname=C.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),I||(this.hostname=c.toASCII(this.hostname));var P=this.port?":"+this.port:"",j=this.hostname||"";this.host=j+P,this.href+=this.host,I&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==o[0]&&(o="/"+o))}if(!E[d])for(var x=0,R=m.length;x0)&&n.host.split("@");T&&(n.auth=T.shift(),n.host=n.hostname=T.shift())}return n.search=t.search,n.query=t.query,l.isNull(n.pathname)&&l.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.href=n.format(),n}if(!x.length)return n.pathname=null,n.search?n.path="/"+n.search:n.path=null,n.href=n.format(),n;for(var S=x.slice(-1)[0],I=(n.host||t.host||x.length>1)&&("."===S||".."===S)||""===S,D=0,R=x.length;R>=0;R--)S=x[R],"."===S?x.splice(R,1):".."===S?(x.splice(R,1),D++):D&&(x.splice(R,1),D--);if(!w&&!y)for(;D--;D)x.unshift("..");!w||""===x[0]||x[0]&&"/"===x[0].charAt(0)||x.unshift(""),I&&"/"!==x.join("/").substr(-1)&&x.push("");var N=""===x[0]||x[0]&&"/"===x[0].charAt(0);if(A){n.hostname=n.host=N?"":x.length?x.shift():"";var T=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@");T&&(n.auth=T.shift(),n.host=n.hostname=T.shift())}return w=w||n.host&&x.length,w&&!N&&x.unshift(""),x.length?n.pathname=x.join("/"):(n.pathname=null,n.path=null),l.isNull(n.pathname)&&l.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.auth=t.auth||n.auth,n.slashes=n.slashes||t.slashes,n.href=n.format(),n},i.prototype.parseHost=function(){var t=this.host,e=h.exec(t);e&&(e=e[0],":"!==e&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)}},function(t,e,n){function i(t){if(t&&!c(t))throw new Error("Unknown encoding: "+t)}function s(t){return t.toString(this.encoding)}function r(t){this.charReceived=t.length%2,this.charLength=this.charReceived?2:0}function o(t){this.charReceived=t.length%3,this.charLength=this.charReceived?3:0}var a=n(6).Buffer,c=a.isEncoding||function(t){switch(t&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}},l=e.StringDecoder=function(t){switch(this.encoding=(t||"utf8").toLowerCase().replace(/[-_]/,""),i(t),this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=r;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=o;break;default:return void(this.write=s)}this.charBuffer=new a(6),this.charReceived=0,this.charLength=0};l.prototype.write=function(t){for(var e="";this.charLength;){var n=t.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:t.length;if(t.copy(this.charBuffer,this.charReceived,0,n),this.charReceived+=n,this.charReceived=55296&&i<=56319)){if(this.charReceived=this.charLength=0,0===t.length)return e;break}this.charLength+=this.surrogateSize,e=""}this.detectIncompleteChar(t);var s=t.length;this.charLength&&(t.copy(this.charBuffer,0,t.length-this.charReceived,s),s-=this.charReceived),e+=t.toString(this.encoding,0,s);var s=e.length-1,i=e.charCodeAt(s);if(i>=55296&&i<=56319){var r=this.surrogateSize;return this.charLength+=r,this.charReceived+=r,this.charBuffer.copy(this.charBuffer,r,0,r),t.copy(this.charBuffer,0,0,r),e.substring(0,s)}return e},l.prototype.detectIncompleteChar=function(t){for(var e=t.length>=3?3:t.length;e>0;e--){var n=t[t.length-e];if(1==e&&n>>5==6){this.charLength=2;break}if(e<=2&&n>>4==14){this.charLength=3;break}if(e<=3&&n>>3==30){this.charLength=4;break}}this.charReceived=e},l.prototype.end=function(t){var e="";if(t&&t.length&&(e=this.write(t)),this.charReceived){var n=this.charReceived,i=this.charBuffer,s=this.encoding;e+=i.slice(0,n).toString(s)}return e}},function(t,e,n){(function(e){const i=n(30),s=n(42),r=n(40),o=n(4),a=n(13),c=n(9),l=n(19),u=n(17),h=n(20),p=n(18),d=n(33),{Error:Error,TypeError:TypeError}=n(5);class f{constructor(t){this.client=t}resolveUser(t){return t instanceof a?t:"string"==typeof t?this.client.users.get(t)||null:t instanceof h?t.user:t instanceof c?t.author:t instanceof l?t.owner:null}resolveUserID(t){return t instanceof a||t instanceof h?t.id:"string"==typeof t?t||null:t instanceof c?t.author.id:t instanceof l?t.ownerID:null}resolveGuild(t){return t instanceof l?t:"string"==typeof t?this.client.guilds.get(t)||null:null}resolveGuildMember(t,e){return e instanceof h?e:(t=this.resolveGuild(t),e=this.resolveUser(e),t&&e?t.members.get(e.id)||null:null)}resolveChannel(t){return t instanceof u?t:"string"==typeof t?this.client.channels.get(t)||null:t instanceof c?t.channel:t instanceof l?t.channels.get(t.id)||null:null}resolveChannelID(t){return t instanceof u?t.id:"string"==typeof t?t:t instanceof c?t.channel.id:t instanceof l?t.defaultChannel.id:null}resolveInviteCode(t){const e=/discord(?:app\.com\/invite|\.gg)\/([\w-]{2,255})/i,n=e.exec(t);return n&&n[1]?n[1]:t}resolveBase64(t){return t instanceof e?`data:image/jpg;base64,${t.toString("base64")}`:t}resolveBuffer(t){return t instanceof e?Promise.resolve(t):this.client.browser&&t instanceof ArrayBuffer?Promise.resolve(o.convertToBuffer(t)):"string"==typeof t?new Promise((n,o)=>{if(/^https?:\/\//.test(t))r.get(t).end((t,i)=>{if(t)return o(t);if(!(i.body instanceof e))return o(new TypeError("REQ_BODY_TYPE"));return n(i.body)});else{const e=i.resolve(t);s.stat(e,(t,i)=>{if(t)return o(t);if(!i||!i.isFile())return o(new Error("FILE_NOT_FOUND",e));s.readFile(e,(t,e)=>{t?o(t):n(e)});return null})}}):Promise.reject(new TypeError("REQ_RESOURCE_TYPE"))}resolveEmojiIdentifier(t){return t instanceof p||t instanceof d?t.identifier:"string"==typeof t?this.client.emojis.has(t)?this.client.emojis.get(t).identifier:t.includes("%")?t:encodeURIComponent(t):null}}t.exports=f}).call(e,n(6).Buffer)},function(t,e,n){const i=n(147),s=n(146),r=n(145),o=n(143),a=n(144),{Error:Error}=n(5);class c{constructor(t){this.client=t,this.handlers={},this.userAgentManager=new i(this),this.rateLimitedEndpoints={},this.globallyRateLimited=!1}get api(){return a(this)}destroy(){for(const t in this.handlers)this.handlers[t].destroy()}push(t,e){return new Promise((n,i)=>{t.push({request:e,resolve:n,reject:i})})}getRequestHandler(){switch(this.client.options.apiRequestMethod){case"sequential":return s;case"burst":return r;default:throw new Error("RATELIMIT_INVALID_METHOD")}}request(t,e,n={}){const i=new o(this,t,e,n);if(!this.handlers[i.route]){const t=this.getRequestHandler();this.handlers[i.route]=new t(this,i.route)}return this.push(this.handlers[i.route],i)}}t.exports=c},function(t,e){class n{constructor(t){this.restManager=t,this.queue=[]}get globalLimit(){return this.restManager.globallyRateLimited}set globalLimit(t){this.restManager.globallyRateLimited=t}push(t){this.queue.push(t)}handle(){}destroy(){this.queue=[]}}t.exports=n},function(t,e,n){(function(e){const i="browser"===n(26).platform(),s=n(15),r=n(0),o=n(42),a=n(149),c=function(){try{const t=n(196);return t.pack?t:null}catch(t){return null}}(),l=function(){if(i)return window.WebSocket;try{return n(197)}catch(t){return n(198)}}();class u extends s{constructor(t,e){super(),this.manager=t,this.client=t.client,this.ws=null,this.sequence=-1,this.status=r.Status.IDLE,this.packetManager=new a(this),this.lastPingTimestamp=0,this.ratelimit={queue:[],remaining:120,resetTime:-1},this.connect(e),this.disabledEvents={},this.closeSequence=0,this.expectingClose=!1;for(const t of this.client.options.disabledEvents)this.disabledEvents[t]=!0}triggerReady(){if(this.status===r.Status.READY)return void this.debug("Tried to mark self as ready, but already ready");this.status=r.Status.READY,this.client.emit(r.Events.READY),this.packetManager.handleQueue()}checkIfReady(){if(this.status===r.Status.READY||this.status===r.Status.NEARLY)return!1;let t=0;for(const e of this.client.guilds.values())e.available||t++;if(0===t){if(this.status=r.Status.NEARLY,!this.client.options.fetchAllMembers)return this.triggerReady();const t=this.client.guilds.map(t=>t.fetchMembers());Promise.all(t).then(()=>this.triggerReady()).catch(t=>{this.debug(`Failed to fetch all members before ready! ${t}`);this.triggerReady()})}return!0}debug(t){return t instanceof Error&&(t=t.stack),this.manager.debug(`[connection] ${t}`)}unpack(t){return t instanceof ArrayBuffer&&(t=e.from(new Uint8Array(t))),c&&"string"!=typeof t?c.unpack(t):(t instanceof e&&(t=o.inflateSync(t).toString()),JSON.parse(t))}pack(t){return c?c.pack(t):JSON.stringify(t)}processQueue(){if(0!==this.ratelimit.remaining&&0!==this.ratelimit.queue.length)for(120===this.ratelimit.remaining&&(this.ratelimit.resetTimer=setTimeout(()=>{this.ratelimit.remaining=120;this.processQueue()},12e4));this.ratelimit.remaining>0;){const t=this.ratelimit.queue.shift();if(!t)return;this._send(t),this.ratelimit.remaining--}}_send(t){if(!this.ws||this.ws.readyState!==l.OPEN)return void this.debug(`Tried to send packet ${t} but no WebSocket is available!`);this.ws.send(this.pack(t))}send(t){if(!this.ws||this.ws.readyState!==l.OPEN)return void this.debug(`Tried to send packet ${t} but no WebSocket is available!`);this.ratelimit.queue.push(t),this.processQueue()}connect(t=this.gateway,e=0,n=!1){if(e)return this.client.setTimeout(()=>this.connect(t,0,n),e);if(this.ws&&!n)return this.debug("WebSocket connection already exists"),!1;if("string"!=typeof t)return this.debug(`Tried to connect to an invalid gateway: ${t}`),!1;this.expectingClose=!1,this.gateway=t,this.debug(`Connecting to ${t}`);const s=this.ws=new l(t);return i&&(s.binaryType="arraybuffer"),s.onmessage=this.onMessage.bind(this),s.onopen=this.onOpen.bind(this),s.onerror=this.onError.bind(this),s.onclose=this.onClose.bind(this),this.status=r.Status.CONNECTING,!0}destroy(){const t=this.ws;return t?(this.heartbeat(-1),this.expectingClose=!0,t.close(1e3),this.packetManager.handleQueue(),this.ws=null,this.status=r.Status.DISCONNECTED,!0):(this.debug("Attempted to destroy WebSocket but no connection exists!"),!1)}onMessage(t){let e;try{e=this.unpack(t.data)}catch(t){this.emit("debug",t)}return this.onPacket(e)}setSequence(t){this.sequence=t>this.sequence?t:this.sequence}onPacket(t){if(!t)return this.debug("Received null packet"),!1;switch(this.client.emit("raw",t),t.op){case r.OPCodes.HELLO:return this.heartbeat(t.d.heartbeat_interval);case r.OPCodes.RECONNECT:return this.reconnect();case r.OPCodes.INVALID_SESSION:return t.d||(this.sessionID=null),this.sequence=-1,this.debug("Session invalidated -- will identify with a new session"),this.identify(t.d?2500:0);case r.OPCodes.HEARTBEAT_ACK:return this.ackHeartbeat();case r.OPCodes.HEARTBEAT:return this.heartbeat();default:return this.packetManager.handle(t)}}onOpen(t){t&&t.target&&t.target.url&&(this.gateway=t.target.url),this.debug(`Connected to gateway ${this.gateway}`),this.identify()}reconnect(){this.debug("Attemping to reconnect in 5500ms..."),this.client.emit(r.Events.RECONNECTING),this.connect(this.gateway,5500,!0)}onError(t){if(t&&"uWs client connection error"===t.message)return void this.reconnect();this.client.emit(r.Events.ERROR,t)}onClose(t){if(this.debug(`${this.expectingClose?"Client":"Server"} closed the WebSocket connection: ${t.code}`),this.closeSequence=this.sequence,this.emit("close",t),this.heartbeat(-1),1e3===t.code?this.expectingClose:r.WSCodes[t.code])return this.expectingClose=!1,this.client.emit(r.Events.DISCONNECT,t),this.debug(r.WSCodes[t.code]),void this.destroy();this.expectingClose=!1,this.reconnect()}ackHeartbeat(){this.debug(`Heartbeat acknowledged, latency of ${Date.now()-this.lastPingTimestamp}ms`),this.client._pong(this.lastPingTimestamp)}heartbeat(t){if(!isNaN(t))return void(-1===t?(this.debug("Clearing heartbeat interval"),this.client.clearInterval(this.heartbeatInterval),this.heartbeatInterval=null):(this.debug(`Setting a heartbeat interval for ${t}ms`),this.heartbeatInterval=this.client.setInterval(()=>this.heartbeat(),t)));this.debug("Sending a heartbeat"),this.lastPingTimestamp=Date.now(),this.send({op:r.OPCodes.HEARTBEAT,d:this.sequence})}identify(t){return t?this.client.setTimeout(this.identify.apply(this),t):this.sessionID?this.identifyResume():this.identifyNew()}identifyNew(){if(!this.client.token)return void this.debug("No token available to identify a new session with");const t=Object.assign({token:this.client.token},this.client.options.ws),{shardId:shardId,shardCount:shardCount}=this.client.options;shardCount>0&&(t.shard=[Number(shardId),Number(shardCount)]),this.debug("Identifying as a new session"),this.send({op:r.OPCodes.IDENTIFY,d:t})}identifyResume(){if(!this.sessionID)return this.debug("Warning: wanted to resume but session ID not available; identifying as a new session instead"),this.identifyNew();this.debug(`Attempting to resume session ${this.sessionID}`);const t={token:this.client.token,session_id:this.sessionID,seq:this.sequence};return this.send({op:r.OPCodes.RESUME,d:t})}}u.ENCODING=c?"etf":"json",u.WebSocket=l,t.exports=u}).call(e,n(6).Buffer)},function(t,e,n){function i(t){return class e extends t{constructor(t,...n){super(s(t,n)),this[o]=t,Error.captureStackTrace&&Error.captureStackTrace(this,e)}get name(){return`${super.name} [${this[o]}]`}get code(){return this[o]}}}function s(t,e){c.strictEqual(typeof t,"string");const n=a.get(t);c(n,`An invalid error message key was used: ${t}.`);let i=l.format;if("function"==typeof n)i=n;else{if(void 0===e||0===e.length)return n;e.unshift(n)}return String(i(...e))}function r(t,e){a.set(t,"function"==typeof e?e:String(e))}const o=Symbol("code"),a=new Map,c=n(81),l=n(41);t.exports={register:r,Error:i(Error),TypeError:i(TypeError),RangeError:i(RangeError)}},function(t,e){class n{constructor(t){this.id=t.id,this.name=t.name,this.vip=t.vip,this.deprecated=t.deprecated,this.optimal=t.optimal,this.custom=t.custom,this.sampleHostname=t.sample_hostname}}t.exports=n},function(t,e,n){t.exports={search:n(190),sendMessage:n(191)}},function(module,exports,__webpack_require__){(function(process){const os=__webpack_require__(26),EventEmitter=__webpack_require__(15),Constants=__webpack_require__(0),Permissions=__webpack_require__(10),Util=__webpack_require__(4),RESTManager=__webpack_require__(69),ClientDataManager=__webpack_require__(112),ClientManager=__webpack_require__(113),ClientDataResolver=__webpack_require__(68),ClientVoiceManager=__webpack_require__(194),WebSocketManager=__webpack_require__(148),ActionsManager=__webpack_require__(114),Collection=__webpack_require__(3),{Presence:Presence}=__webpack_require__(14),VoiceRegion=__webpack_require__(73),Webhook=__webpack_require__(22),User=__webpack_require__(13),Invite=__webpack_require__(28),OAuth2Application=__webpack_require__(29),ShardClientUtil=__webpack_require__(193),VoiceBroadcast=__webpack_require__(195),{Error:Error,TypeError:TypeError,RangeError:RangeError}=__webpack_require__(5);class Client extends EventEmitter{constructor(t={}){super(),!t.shardId&&"SHARD_ID"in process.env&&(t.shardId=Number(process.env.SHARD_ID)),!t.shardCount&&"SHARD_COUNT"in process.env&&(t.shardCount=Number(process.env.SHARD_COUNT)),this.options=Util.mergeDefault(Constants.DefaultOptions,t),this._validateOptions(),this.rest=new RESTManager(this),this.dataManager=new ClientDataManager(this),this.manager=new ClientManager(this),this.ws=new WebSocketManager(this),this.resolver=new ClientDataResolver(this),this.actions=new ActionsManager(this),this.voice=this.browser?null:new ClientVoiceManager(this),this.shard=process.send?ShardClientUtil.singleton(this):null,this.users=new Collection,this.guilds=new Collection,this.channels=new Collection,this.presences=new Collection,Object.defineProperty(this,"token",{writable:!0}),!this.token&&"CLIENT_TOKEN"in process.env?this.token=process.env.CLIENT_TOKEN:this.token=null,this.user=null,this.readyAt=null,this.broadcasts=[],this.pings=[],this._timeouts=new Set,this._intervals=new Set,this.options.messageSweepInterval>0&&this.setInterval(this.sweepMessages.bind(this),1e3*this.options.messageSweepInterval)}get _pingTimestamp(){return this.ws.connection?this.ws.connection.lastPingTimestamp:0}get api(){return this.rest.api}get status(){return this.ws.connection.status}get uptime(){return this.readyAt?Date.now()-this.readyAt:null}get ping(){return this.pings.reduce((t,e)=>t+e,0)/this.pings.length}get voiceConnections(){return this.browser?new Collection:this.voice.connections}get emojis(){const t=new Collection;for(const e of this.guilds.values())for(const n of e.emojis.values())t.set(n.id,n);return t}get readyTimestamp(){return this.readyAt?this.readyAt.getTime():null}get browser(){return"browser"===os.platform()}createVoiceBroadcast(){const t=new VoiceBroadcast(this);return this.broadcasts.push(t),t}login(t){return new Promise((e,n)=>{if("string"!=typeof t)throw new Error("TOKEN_INVALID");t=t.replace(/^Bot\s*/i,"");this.manager.connectToWebSocket(t,e,n)})}destroy(){for(const t of this._timeouts)clearTimeout(t);for(const t of this._intervals)clearInterval(t);return this._timeouts.clear(),this._intervals.clear(),this.manager.destroy()}syncGuilds(t=this.guilds){this.user.bot||this.ws.send({op:12,d:t instanceof Collection?t.keyArray():t.map(t=>t.id)})}fetchUser(t,e=!0){return this.users.has(t)?Promise.resolve(this.users.get(t)):this.api.users[t].get().then(t=>e?this.dataManager.newUser(t):new User(this,t))}fetchInvite(t){const e=this.resolver.resolveInviteCode(t);return this.api.invites[e].get({query:{with_counts:!0}}).then(t=>new Invite(this,t))}fetchWebhook(t,e){return this.api.webhooks.opts(t,e).get().then(t=>new Webhook(this,t))}fetchVoiceRegions(){return this.api.voice.regions.get().then(t=>{const e=new Collection;for(const n of t)e.set(n.id,new VoiceRegion(n));return e})}sweepMessages(t=this.options.messageCacheLifetime){if("number"!=typeof t||isNaN(t))throw new TypeError("CLIENT_INVALID_OPTION","Lifetime","a number");if(t<=0)return this.emit("debug","Didn't sweep messages - lifetime is unlimited"),-1;const e=1e3*t,n=Date.now();let i=0,s=0;for(const t of this.channels.values())if(t.messages){i++;for(const i of t.messages.values())n-(i.editedTimestamp||i.createdTimestamp)>e&&(t.messages.delete(i.id),s++)}return this.emit("debug",`Swept ${s} messages older than ${t} seconds in ${i} text-based channels`),s}fetchApplication(t="@me"){return this.api.oauth2.applications[t].get().then(t=>new OAuth2Application(this,t))}generateInvite(t){return t?t instanceof Array&&(t=Permissions.resolve(t)):t=0,this.fetchApplication().then(e=>`https://discordapp.com/oauth2/authorize?client_id=${e.id}&permissions=${t}&scope=bot`)}setTimeout(t,e,...n){const i=setTimeout(()=>{t(...n);this._timeouts.delete(i)},e);return this._timeouts.add(i),i}clearTimeout(t){clearTimeout(t),this._timeouts.delete(t)}setInterval(t,e,...n){const i=setInterval(t,e,...n);return this._intervals.add(i),i}clearInterval(t){clearInterval(t),this._intervals.delete(t)}_pong(t){this.pings.unshift(Date.now()-t),this.pings.length>3&&(this.pings.length=3),this.ws.lastHeartbeatAck=!0}_setPresence(t,e){if(this.presences.has(t))return void this.presences.get(t).update(e);this.presences.set(t,new Presence(e))}_eval(script){return eval(script)}_validateOptions(t=this.options){if("number"!=typeof t.shardCount||isNaN(t.shardCount))throw new TypeError("CLIENT_INVALID_OPTION","shardCount","a number");if("number"!=typeof t.shardId||isNaN(t.shardId))throw new TypeError("CLIENT_INVALID_OPTION","shardId","a number");if(t.shardCount<0)throw new RangeError("CLIENT_INVALID_OPTION","shardCount","at least 0");if(t.shardId<0)throw new RangeError("CLIENT_INVALID_OPTION","shardId","at least 0");if(0!==t.shardId&&t.shardId>=t.shardCount)throw new RangeError("CLIENT_INVALID_OPTION","shardId","less than shardCount");if("number"!=typeof t.messageCacheMaxSize||isNaN(t.messageCacheMaxSize))throw new TypeError("CLIENT_INVALID_OPTION","messageCacheMaxSize","a number");if("number"!=typeof t.messageCacheLifetime||isNaN(t.messageCacheLifetime))throw new TypeError("CLIENT_INVALID_OPTION","The messageCacheLifetime","a number");if("number"!=typeof t.messageSweepInterval||isNaN(t.messageSweepInterval))throw new TypeError("CLIENT_INVALID_OPTION","messageSweepInterval","a number");if("boolean"!=typeof t.fetchAllMembers)throw new TypeError("CLIENT_INVALID_OPTION","fetchAllMembers","a boolean");if("boolean"!=typeof t.disableEveryone)throw new TypeError("CLIENT_INVALID_OPTION","disableEveryone","a boolean");if("number"!=typeof t.restWsBridgeTimeout||isNaN(t.restWsBridgeTimeout))throw new TypeError("CLIENT_INVALID_OPTION","restWsBridgeTimeout","a number");if("boolean"!=typeof t.internalSharding)throw new TypeError("CLIENT_INVALID_OPTION","internalSharding","a boolean");if(!(t.disabledEvents instanceof Array))throw new TypeError("CLIENT_INVALID_OPTION","disabledEvents","an Array")}}module.exports=Client}).call(exports,__webpack_require__(8))},function(t,e,n){const i=n(22),s=n(69),r=n(68),o=n(0),a=n(4);class c extends i{constructor(t,e,n){super(null,t,e),this.options=a.mergeDefault(o.DefaultOptions,n),this.rest=new s(this),this.resolver=new r(this),this._timeouts=new Set,this._intervals=new Set}get api(){return this.rest.api}setTimeout(t,e,...n){const i=setTimeout(()=>{t(...n);this._timeouts.delete(i)},e);return this._timeouts.add(i),i}clearTimeout(t){clearTimeout(t),this._timeouts.delete(t)}setInterval(t,e,...n){const i=setInterval(t,e,...n);return this._intervals.add(i),i}clearInterval(t){clearInterval(t),this._intervals.delete(t)}destroy(){for(const t of this._timeouts)clearTimeout(t);for(const t of this._intervals)clearInterval(t);this._timeouts.clear(),this._intervals.clear()}}t.exports=c},function(t,e,n){const i=n(4);class s{constructor(t={}){this.title=t.title,this.description=t.description,this.url=t.url,this.color=t.color,this.author=t.author,this.timestamp=t.timestamp,this.fields=t.fields||[],this.thumbnail=t.thumbnail,this.image=t.image,this.footer=t.footer,this.file=t.file}setTitle(t){if(t=i.resolveString(t),t.length>256)throw new RangeError("RichEmbed titles may not exceed 256 characters.");return this.title=t,this}setDescription(t){if(t=i.resolveString(t),t.length>2048)throw new RangeError("RichEmbed descriptions may not exceed 2048 characters.");return this.description=t,this}setURL(t){return this.url=t,this}setColor(t){return this.color=i.resolveColor(t),this}setAuthor(t,e,n){return this.author={name:i.resolveString(t),icon_url:e,url:n},this}setTimestamp(t=new Date){return this.timestamp=t,this}addField(t,e,n=!1){if(this.fields.length>=25)throw new RangeError("RichEmbeds may not exceed 25 fields.");if(t=i.resolveString(t),t.length>256)throw new RangeError("RichEmbed field names may not exceed 256 characters.");if(!/\S/.test(t))throw new RangeError("RichEmbed field names may not be empty.");if(e=i.resolveString(e),e.length>1024)throw new RangeError("RichEmbed field values may not exceed 1024 characters.");if(!/\S/.test(e))throw new RangeError("RichEmbed field values may not be empty.");return this.fields.push({name:t,value:e,inline:n}),this}addBlankField(t=!1){return this.addField("​","​",t)}setThumbnail(t){return this.thumbnail={url:t},this}setImage(t){return this.image={url:t},this}setFooter(t,e){if(t=i.resolveString(t),t.length>2048)throw new RangeError("RichEmbed footer text may not exceed 2048 characters.");return this.footer={text:t,icon_url:e},this}attachFile(t){if(this.file)throw new RangeError("You may not upload more than one file at once.");return this.file=t,this}}t.exports=s},function(t,e){},function(t,e){},function(t,e){},function(t,e,n){"use strict";(function(e){/*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh