diff --git a/discord.master.js b/discord.master.js index 03a08a01..5485f659 100644 --- a/discord.master.js +++ b/discord.master.js @@ -12363,6 +12363,7 @@ class GuildAuditLogs { Actions.CHANNEL_UPDATE, Actions.CHANNEL_OVERWRITE_UPDATE, Actions.MEMBER_UPDATE, + Actions.MEMBER_ROLE_UPDATE, Actions.ROLE_UPDATE, Actions.INVITE_UPDATE, Actions.WEBHOOK_UPDATE, diff --git a/discord.master.min.js b/discord.master.min.js index 29779785..eccb279b 100644 --- a/discord.master.min.js +++ b/discord.master.min.js @@ -11,7 +11,7 @@ ${t} * 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 w}else{if(t<=-p)return y;if(t+1>=p)return b}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},_.toNumber=function(){return this.unsigned?(this.high>>>0)*u+(this.low>>>0):this.high*u+(this.low>>>0)},_.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}},_.getHighBits=function(){return this.high},_.getHighBitsUnsigned=function(){return this.high>>>0},_.getLowBits=function(){return this.low},_.getLowBitsUnsigned=function(){return this.low>>>0},_.getNumBitsAbs=function(){if(this.isNegative())return this.eq(y)?64:this.neg().getNumBitsAbs();for(var t=0!=this.high?this.high:this.low,e=31;e>0&&0==(t&1<=0},_.isOdd=function(){return 1==(1&this.low)},_.isEven=function(){return 0==(1&this.low)},_.equals=function(t){return e(t)||(t=o(t)),(this.unsigned===t.unsigned||this.high>>>31!=1||t.high>>>31!=1)&&(this.high===t.high&&this.low===t.low)},_.eq=_.equals,_.notEquals=function(t){return!this.eq(t)},_.neq=_.notEquals,_.lessThan=function(t){return this.comp(t)<0},_.lt=_.lessThan,_.lessThanOrEqual=function(t){return this.comp(t)<=0},_.lte=_.lessThanOrEqual,_.greaterThan=function(t){return this.comp(t)>0},_.gt=_.greaterThan,_.greaterThanOrEqual=function(t){return this.comp(t)>=0},_.gte=_.greaterThanOrEqual,_.compare=function(t){if(e(t)||(t=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},_.comp=_.compare,_.negate=function(){return!this.unsigned&&this.eq(y)?y:this.not().add(g)},_.neg=_.negate,_.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)},_.subtract=function(t){return e(t)||(t=o(t)),this.add(t.neg())},_.sub=_.subtract,_.multiply=function(t){if(this.isZero())return f;if(e(t)||(t=o(t)),t.isZero())return f;if(this.eq(y))return t.isOdd()?y:f;if(t.eq(y))return this.isOdd()?y: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)},_.mul=_.multiply,_.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(y)){if(t.eq(g)||t.eq(E))return y;if(t.eq(y))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(y))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},_.div=_.divide,_.modulo=function(t){return e(t)||(t=o(t)),this.sub(this.div(t).mul(t))},_.mod=_.modulo,_.not=function(){return s(~this.low,~this.high,this.unsigned)},_.and=function(t){return e(t)||(t=o(t)),s(this.low&t.low,this.high&t.high,this.unsigned)},_.or=function(t){return e(t)||(t=o(t)),s(this.low|t.low,this.high|t.high,this.unsigned)},_.xor=function(t){return e(t)||(t=o(t)),s(this.low^t.low,this.high^t.high,this.unsigned)},_.shiftLeft=function(t){return e(t)&&(t=t.toInt()),0==(t&=63)?this:t<32?s(this.low<>>32-t,this.unsigned):s(0,this.low<>>t|this.high<<32-t,this.high>>t,this.unsigned):s(this.high>>t-32,this.high>=0?0:-1,this.unsigned)},_.shr=_.shiftRight,_.shiftRightUnsigned=function(t){if(e(t)&&(t=t.toInt()),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)},_.shru=_.shiftRightUnsigned,_.toSigned=function(){return this.unsigned?s(this.low,this.high,!1):this},_.toUnsigned=function(){return this.unsigned?this:s(this.low,this.high,!0)},_.toBytes=function(t){return t?this.toBytesLE():this.toBytesBE()},_.toBytesLE=function(){var t=this.high,e=this.low;return[255&e,e>>>8&255,e>>>16&255,e>>>24&255,255&t,t>>>8&255,t>>>16&255,t>>>24&255]},_.toBytesBE=function(){var t=this.high,e=this.low;return[t>>>24&255,t>>>16&255,t>>>8&255,255&t,e>>>24&255,e>>>16&255,e>>>8&255,255&e]},t})},function(t,e,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 S=n(22);S.inherits=n(11);var k={deprecate:n(103)},D=n(59),M=n(5).Buffer,C=n(33);S.inherits(a,D),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:k.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.")})}catch(t){}}();var I;"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(I=Function.prototype[Symbol.hasInstance],Object.defineProperty(a,Symbol.hasInstance,{value:function(t){return!!I.call(this,t)||t&&t._writableState instanceof o}})):I=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=M.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||_(this,i,n)}}).call(e,n(7),n(100).setImmediate)},function(t,e,n){const i=n(94);t.exports=i},function(t,e){},function(t,e){t.exports={name:"discord.js",version:"12.0.0",description:"A powerful library for interacting with the Discord API",main:"./src/index",types:"./typings/index.d.ts",scripts:{test:"npm run lint && npm run docs:test",docs:"docgen --source src --custom docs/index.yml --output docs/docs.json","docs:test":"docgen --source src --custom docs/index.yml",lint:"eslint src","lint:fix":"eslint --fix src",webpack:"parallel-webpack"},repository:{type:"git",url:"git+https://github.com/hydrabolt/discord.js.git"},keywords:["discord","api","bot","client","node","discordapp"],author:"Amish Shah ",license:"Apache-2.0",bugs:{url:"https://github.com/hydrabolt/discord.js/issues"},homepage:"https://github.com/hydrabolt/discord.js#readme",runkitExampleFilename:"./docs/examples/ping.js",dependencies:{long:"^3.2.0","prism-media":"^0.0.1",snekfetch:"^3.1.0",tweetnacl:"^0.14.0",ws:"^2.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:">=6.0.0"},browser:{ws:!1,uws:!1,erlpack:!1,"prism-media":!1,opusscript:!1,"node-opus":!1,tweetnacl:!1,sodium:!1,"src/sharding/Shard.js":!1,"src/sharding/ShardClientUtil.js":!1,"src/sharding/ShardingManager.js":!1,"src/client/voice/dispatcher/StreamDispatcher.js":!1,"src/client/voice/opus/BaseOpusEngine.js":!1,"src/client/voice/opus/NodeOpusEngine.js":!1,"src/client/voice/opus/OpusEngineList.js":!1,"src/client/voice/opus/OpusScriptEngine.js":!1,"src/client/voice/pcm/ConverterEngine.js":!1,"src/client/voice/pcm/ConverterEngineList.js":!1,"src/client/voice/pcm/FfmpegConverterEngine.js":!1,"src/client/voice/player/AudioPlayer.js":!1,"src/client/voice/receiver/VoiceReadable.js":!1,"src/client/voice/receiver/VoiceReceiver.js":!1,"src/client/voice/util/Secretbox.js":!1,"src/client/voice/util/SecretKey.js":!1,"src/client/voice/util/VolumeInterface.js":!1,"src/client/voice/ClientVoiceManager.js":!1,"src/client/voice/VoiceBroadcast.js":!1,"src/client/voice/VoiceConnection.js":!1,"src/client/voice/VoiceUDPClient.js":!1,"src/client/voice/VoiceWebSocket.js":!1}}},function(t,e,n){const i=n(12),s=n(3),r=n(42),o=n(0),a=n(4),c=n(18),l=n(8),u=n(30);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.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).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 must be a string");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:")?this.client.api.guilds.post({data:{name:t,region:region,icon:icon}}).then(t=>this.client.dataManager.newGuild(t)):this.client.resolver.resolveBuffer(icon).then(e=>this.createGuild(t,region,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},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 of Object.keys(i.UserSettingsMap)){const n=i.UserSettingsMap[e];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(16),s=n(24),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(){}createCollector(){}awaitMessages(){}acknowledge(){}_cacheMessage(){}}s.applyToClass(o,!0,["bulkDelete"]),t.exports=o},function(t,e,n){const i=n(3),s=n(6),r={GUILD:"GUILD",CHANNEL:"CHANNEL",USER:"USER",ROLE:"ROLE",INVITE:"INVITE",WEBHOOK:"WEBHOOK",EMOJI:"EMOJI",MESSAGE:"MESSAGE",UNKNOWN:"UNKNOWN"},o={GUILD_UPDATE:1,CHANNEL_CREATE:10,CHANNEL_UPDATE:11,CHANNEL_DELETE:12,CHANNEL_OVERWRITE_CREATE:13,CHANNEL_OVERWRITE_UPDATE:14,CHANNEL_OVERWRITE_DELETE:15,MEMBER_KICK:20,MEMBER_PRUNE:21,MEMBER_BAN_ADD:22,MEMBER_BAN_REMOVE:23,MEMBER_UPDATE:24,MEMBER_ROLE_UPDATE:25,ROLE_CREATE:30,ROLE_UPDATE:31,ROLE_DELETE:32,INVITE_CREATE:40,INVITE_UPDATE:41,INVITE_DELETE:42,WEBHOOK_CREATE:50,WEBHOOK_UPDATE:51,WEBHOOK_DELETE:52,EMOJI_CREATE:60,EMOJI_UPDATE:61,EMOJI_DELETE:62,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.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(32);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);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("MessageEmbeds may not exceed 25 fields.");if(t=i.resolveString(t),t.length>256)throw new RangeError("MessageEmbed field names may not exceed 256 characters.");if(!/\S/.test(t))throw new RangeError("MessageEmbed field names may not be empty.");if(e=i.resolveString(e),e.length>1024)throw new RangeError("MessageEmbed field values may not exceed 1024 characters.");if(!/\S/.test(e))throw new RangeError("MessageEmbed field values may not be empty.");return this.fields.push({name:t,value:e,inline:n}),this}attachFile(t){if(this.file)throw new RangeError("You may not upload more than one file at once.");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("MessageEmbed descriptions may not exceed 2048 characters.");return this.description=t,this}setFooter(t,e){if(t=i.resolveString(t),t.length>2048)throw new RangeError("MessageEmbed footer text may not exceed 2048 characters.");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("MessageEmbed titles may not exceed 256 characters.");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(17),r=n(31);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){class n{constructor(t,e){Object.defineProperty(this,"channel",{value:t}),e&&this.setup(e)}setup(t){this.id=t.id,this.type=t.type,this.deny=t.deny,this.allow=t.allow}delete(t){return this.channel.client.api.channels(this.channel.id).permissions(this.id).delete({reason:t}).then(()=>this)}}t.exports=n},function(t,e,n){const i=n(32),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(26),s=n(21),r=n(24),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(){}createCollector(){}createMessageCollector(){}awaitMessages(){}bulkDelete(){}acknowledge(){}_cacheMessage(){}}r.applyToClass(a,!0),t.exports=a},function(t,e,n){const i=n(26),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]?M(t._events[e])?t._events[e].unshift(n):t._events[e]=[n,t._events[e]]:t.on(e,n)}function s(t,e){k=k||n(15),t=t||{},this.objectMode=!!t.objectMode,e instanceof k&&(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 G,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(64).StringDecoder),this.decoder=new P(t.encoding),this.encoding=t.encoding)}function r(t){if(k=k||n(15),!(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),I.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=q?t=q:(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 L.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||(j("emitReadable",e.flowing),e.emittedReadable=!0,e.sync?D(d,t):d(t))}function d(t){j("emit readable"),t.emit("readable"),w(t)}function f(t,e){e.readingMore||(e.readingMore=!0,D(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=_(t,e.buffer,e.decoder),n}function _(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,D(R,e,t))}function R(t,e){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}function S(t,e){for(var n=0,i=t.length;n=e.highWaterMark||e.ended))return j("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;j("need readable",i),(0===e.length||e.length-t0?y(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){j("onunpipe"),t===p&&o()}function r(){j("onend"),t.end()}function o(){j("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",o),p.removeListener("data",a),E=!0,!d.awaitDrain||t._writableState&&!t._writableState.needDrain||v()}function a(e){j("ondata"),b=!1,!1!==t.write(e)||b||((1===d.pipesCount&&d.pipes===t||d.pipesCount>1&&-1!==S(d.pipes,t))&&!E&&(j("false write response, pause",p._readableState.awaitDrain),p._readableState.awaitDrain++,b=!0),p.pause())}function c(e){j("onerror",e),h(),t.removeListener("error",c),0===C(t,"error")&&t.emit("error",e)}function l(){t.removeListener("finish",u),h()}function u(){j("onfinish"),t.removeListener("close",l),h()}function h(){j("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,j("pipe count=%d opts=%j",d.pipesCount,n);var f=(!n||!1!==n.end)&&t!==e.stdout&&t!==e.stderr,m=f?r:o;d.endEmitted?D(m):p.once("end",m),t.on("unpipe",s);var v=g(p);t.on("drain",v);var E=!1,b=!1;return p.on("data",a),i(t,"error",c),t.once("close",l),t.once("finish",u),t.emit("pipe",p),d.flowing||(j("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},b={javascript:!0,"javascript:":!0},w={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},y=n(36);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?C+="x":C+=M[I];if(!C.match(/^[+a-z0-9A-Z_-]{0,63}$/)){var O=k.slice(0,x),U=k.slice(x+1),N=M.match(/^([+a-z0-9A-Z_-]{0,63})(.*)$/);N&&(O.push(N[1]),U.unshift(N[2])),U.length&&(o="/"+U.join(".")+o),this.hostname=O.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),S||(this.hostname=c.toASCII(this.hostname));var j=this.port?":"+this.port:"",P=this.hostname||"";this.host=P+j,this.href+=this.host,S&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==o[0]&&(o="/"+o))}if(!E[d])for(var x=0,D=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 R=x.slice(-1)[0],S=(n.host||t.host||x.length>1)&&("."===R||".."===R)||""===R,k=0,D=x.length;D>=0;D--)R=x[D],"."===R?x.splice(D,1):".."===R?(x.splice(D,1),k++):k&&(x.splice(D,1),k--);if(!y&&!_)for(;k--;k)x.unshift("..");!y||""===x[0]||x[0]&&"/"===x[0].charAt(0)||x.unshift(""),S&&"/"!==x.join("/").substr(-1)&&x.push("");var M=""===x[0]||x[0]&&"/"===x[0].charAt(0);if(A){n.hostname=n.host=M?"":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 y=y||n.host&&x.length,y&&!M&&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(5).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(29),s=n(39),r=n(38),o=n(4),a=n(12),c=n(8),l=n(18),u=n(16),h=n(19),p=n(17),d=n(31);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("The response body isn't a Buffer."));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(`The file could not be found: ${e}`));s.readFile(e,(t,e)=>{t?o(t):n(e)});return null})}}):Promise.reject(new TypeError("The resource must be a string or Buffer."))}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(5).Buffer)},function(t,e){class n extends Error{constructor(t){super();const e=t.errors?` +!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 w}else{if(t<=-p)return y;if(t+1>=p)return b}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},_.toNumber=function(){return this.unsigned?(this.high>>>0)*u+(this.low>>>0):this.high*u+(this.low>>>0)},_.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}},_.getHighBits=function(){return this.high},_.getHighBitsUnsigned=function(){return this.high>>>0},_.getLowBits=function(){return this.low},_.getLowBitsUnsigned=function(){return this.low>>>0},_.getNumBitsAbs=function(){if(this.isNegative())return this.eq(y)?64:this.neg().getNumBitsAbs();for(var t=0!=this.high?this.high:this.low,e=31;e>0&&0==(t&1<=0},_.isOdd=function(){return 1==(1&this.low)},_.isEven=function(){return 0==(1&this.low)},_.equals=function(t){return e(t)||(t=o(t)),(this.unsigned===t.unsigned||this.high>>>31!=1||t.high>>>31!=1)&&(this.high===t.high&&this.low===t.low)},_.eq=_.equals,_.notEquals=function(t){return!this.eq(t)},_.neq=_.notEquals,_.lessThan=function(t){return this.comp(t)<0},_.lt=_.lessThan,_.lessThanOrEqual=function(t){return this.comp(t)<=0},_.lte=_.lessThanOrEqual,_.greaterThan=function(t){return this.comp(t)>0},_.gt=_.greaterThan,_.greaterThanOrEqual=function(t){return this.comp(t)>=0},_.gte=_.greaterThanOrEqual,_.compare=function(t){if(e(t)||(t=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},_.comp=_.compare,_.negate=function(){return!this.unsigned&&this.eq(y)?y:this.not().add(g)},_.neg=_.negate,_.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)},_.subtract=function(t){return e(t)||(t=o(t)),this.add(t.neg())},_.sub=_.subtract,_.multiply=function(t){if(this.isZero())return f;if(e(t)||(t=o(t)),t.isZero())return f;if(this.eq(y))return t.isOdd()?y:f;if(t.eq(y))return this.isOdd()?y: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)},_.mul=_.multiply,_.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(y)){if(t.eq(g)||t.eq(E))return y;if(t.eq(y))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(y))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},_.div=_.divide,_.modulo=function(t){return e(t)||(t=o(t)),this.sub(this.div(t).mul(t))},_.mod=_.modulo,_.not=function(){return s(~this.low,~this.high,this.unsigned)},_.and=function(t){return e(t)||(t=o(t)),s(this.low&t.low,this.high&t.high,this.unsigned)},_.or=function(t){return e(t)||(t=o(t)),s(this.low|t.low,this.high|t.high,this.unsigned)},_.xor=function(t){return e(t)||(t=o(t)),s(this.low^t.low,this.high^t.high,this.unsigned)},_.shiftLeft=function(t){return e(t)&&(t=t.toInt()),0==(t&=63)?this:t<32?s(this.low<>>32-t,this.unsigned):s(0,this.low<>>t|this.high<<32-t,this.high>>t,this.unsigned):s(this.high>>t-32,this.high>=0?0:-1,this.unsigned)},_.shr=_.shiftRight,_.shiftRightUnsigned=function(t){if(e(t)&&(t=t.toInt()),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)},_.shru=_.shiftRightUnsigned,_.toSigned=function(){return this.unsigned?s(this.low,this.high,!1):this},_.toUnsigned=function(){return this.unsigned?this:s(this.low,this.high,!0)},_.toBytes=function(t){return t?this.toBytesLE():this.toBytesBE()},_.toBytesLE=function(){var t=this.high,e=this.low;return[255&e,e>>>8&255,e>>>16&255,e>>>24&255,255&t,t>>>8&255,t>>>16&255,t>>>24&255]},_.toBytesBE=function(){var t=this.high,e=this.low;return[t>>>24&255,t>>>16&255,t>>>8&255,255&t,e>>>24&255,e>>>16&255,e>>>8&255,255&e]},t})},function(t,e,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 S=n(22);S.inherits=n(11);var k={deprecate:n(103)},D=n(59),M=n(5).Buffer,C=n(33);S.inherits(a,D),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:k.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.")})}catch(t){}}();var I;"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(I=Function.prototype[Symbol.hasInstance],Object.defineProperty(a,Symbol.hasInstance,{value:function(t){return!!I.call(this,t)||t&&t._writableState instanceof o}})):I=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=M.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||_(this,i,n)}}).call(e,n(7),n(100).setImmediate)},function(t,e,n){const i=n(94);t.exports=i},function(t,e){},function(t,e){t.exports={name:"discord.js",version:"12.0.0",description:"A powerful library for interacting with the Discord API",main:"./src/index",types:"./typings/index.d.ts",scripts:{test:"npm run lint && npm run docs:test",docs:"docgen --source src --custom docs/index.yml --output docs/docs.json","docs:test":"docgen --source src --custom docs/index.yml",lint:"eslint src","lint:fix":"eslint --fix src",webpack:"parallel-webpack"},repository:{type:"git",url:"git+https://github.com/hydrabolt/discord.js.git"},keywords:["discord","api","bot","client","node","discordapp"],author:"Amish Shah ",license:"Apache-2.0",bugs:{url:"https://github.com/hydrabolt/discord.js/issues"},homepage:"https://github.com/hydrabolt/discord.js#readme",runkitExampleFilename:"./docs/examples/ping.js",dependencies:{long:"^3.2.0","prism-media":"^0.0.1",snekfetch:"^3.1.0",tweetnacl:"^0.14.0",ws:"^2.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:">=6.0.0"},browser:{ws:!1,uws:!1,erlpack:!1,"prism-media":!1,opusscript:!1,"node-opus":!1,tweetnacl:!1,sodium:!1,"src/sharding/Shard.js":!1,"src/sharding/ShardClientUtil.js":!1,"src/sharding/ShardingManager.js":!1,"src/client/voice/dispatcher/StreamDispatcher.js":!1,"src/client/voice/opus/BaseOpusEngine.js":!1,"src/client/voice/opus/NodeOpusEngine.js":!1,"src/client/voice/opus/OpusEngineList.js":!1,"src/client/voice/opus/OpusScriptEngine.js":!1,"src/client/voice/pcm/ConverterEngine.js":!1,"src/client/voice/pcm/ConverterEngineList.js":!1,"src/client/voice/pcm/FfmpegConverterEngine.js":!1,"src/client/voice/player/AudioPlayer.js":!1,"src/client/voice/receiver/VoiceReadable.js":!1,"src/client/voice/receiver/VoiceReceiver.js":!1,"src/client/voice/util/Secretbox.js":!1,"src/client/voice/util/SecretKey.js":!1,"src/client/voice/util/VolumeInterface.js":!1,"src/client/voice/ClientVoiceManager.js":!1,"src/client/voice/VoiceBroadcast.js":!1,"src/client/voice/VoiceConnection.js":!1,"src/client/voice/VoiceUDPClient.js":!1,"src/client/voice/VoiceWebSocket.js":!1}}},function(t,e,n){const i=n(12),s=n(3),r=n(42),o=n(0),a=n(4),c=n(18),l=n(8),u=n(30);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.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).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 must be a string");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:")?this.client.api.guilds.post({data:{name:t,region:region,icon:icon}}).then(t=>this.client.dataManager.newGuild(t)):this.client.resolver.resolveBuffer(icon).then(e=>this.createGuild(t,region,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},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 of Object.keys(i.UserSettingsMap)){const n=i.UserSettingsMap[e];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(16),s=n(24),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(){}createCollector(){}awaitMessages(){}acknowledge(){}_cacheMessage(){}}s.applyToClass(o,!0,["bulkDelete"]),t.exports=o},function(t,e,n){const i=n(3),s=n(6),r={GUILD:"GUILD",CHANNEL:"CHANNEL",USER:"USER",ROLE:"ROLE",INVITE:"INVITE",WEBHOOK:"WEBHOOK",EMOJI:"EMOJI",MESSAGE:"MESSAGE",UNKNOWN:"UNKNOWN"},o={GUILD_UPDATE:1,CHANNEL_CREATE:10,CHANNEL_UPDATE:11,CHANNEL_DELETE:12,CHANNEL_OVERWRITE_CREATE:13,CHANNEL_OVERWRITE_UPDATE:14,CHANNEL_OVERWRITE_DELETE:15,MEMBER_KICK:20,MEMBER_PRUNE:21,MEMBER_BAN_ADD:22,MEMBER_BAN_REMOVE:23,MEMBER_UPDATE:24,MEMBER_ROLE_UPDATE:25,ROLE_CREATE:30,ROLE_UPDATE:31,ROLE_DELETE:32,INVITE_CREATE:40,INVITE_UPDATE:41,INVITE_DELETE:42,WEBHOOK_CREATE:50,WEBHOOK_UPDATE:51,WEBHOOK_DELETE:52,EMOJI_CREATE:60,EMOJI_UPDATE:61,EMOJI_DELETE:62,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(32);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);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("MessageEmbeds may not exceed 25 fields.");if(t=i.resolveString(t),t.length>256)throw new RangeError("MessageEmbed field names may not exceed 256 characters.");if(!/\S/.test(t))throw new RangeError("MessageEmbed field names may not be empty.");if(e=i.resolveString(e),e.length>1024)throw new RangeError("MessageEmbed field values may not exceed 1024 characters.");if(!/\S/.test(e))throw new RangeError("MessageEmbed field values may not be empty.");return this.fields.push({name:t,value:e,inline:n}),this}attachFile(t){if(this.file)throw new RangeError("You may not upload more than one file at once.");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("MessageEmbed descriptions may not exceed 2048 characters.");return this.description=t,this}setFooter(t,e){if(t=i.resolveString(t),t.length>2048)throw new RangeError("MessageEmbed footer text may not exceed 2048 characters.");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("MessageEmbed titles may not exceed 256 characters.");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(17),r=n(31);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){class n{constructor(t,e){Object.defineProperty(this,"channel",{value:t}),e&&this.setup(e)}setup(t){this.id=t.id,this.type=t.type,this.deny=t.deny,this.allow=t.allow}delete(t){return this.channel.client.api.channels(this.channel.id).permissions(this.id).delete({reason:t}).then(()=>this)}}t.exports=n},function(t,e,n){const i=n(32),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(26),s=n(21),r=n(24),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(){}createCollector(){}createMessageCollector(){}awaitMessages(){}bulkDelete(){}acknowledge(){}_cacheMessage(){}}r.applyToClass(a,!0),t.exports=a},function(t,e,n){const i=n(26),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]?M(t._events[e])?t._events[e].unshift(n):t._events[e]=[n,t._events[e]]:t.on(e,n)}function s(t,e){k=k||n(15),t=t||{},this.objectMode=!!t.objectMode,e instanceof k&&(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 G,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(64).StringDecoder),this.decoder=new P(t.encoding),this.encoding=t.encoding)}function r(t){if(k=k||n(15),!(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),I.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=q?t=q:(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 L.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||(j("emitReadable",e.flowing),e.emittedReadable=!0,e.sync?D(d,t):d(t))}function d(t){j("emit readable"),t.emit("readable"),w(t)}function f(t,e){e.readingMore||(e.readingMore=!0,D(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=_(t,e.buffer,e.decoder),n}function _(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,D(R,e,t))}function R(t,e){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}function S(t,e){for(var n=0,i=t.length;n=e.highWaterMark||e.ended))return j("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;j("need readable",i),(0===e.length||e.length-t0?y(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){j("onunpipe"),t===p&&o()}function r(){j("onend"),t.end()}function o(){j("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",o),p.removeListener("data",a),E=!0,!d.awaitDrain||t._writableState&&!t._writableState.needDrain||v()}function a(e){j("ondata"),b=!1,!1!==t.write(e)||b||((1===d.pipesCount&&d.pipes===t||d.pipesCount>1&&-1!==S(d.pipes,t))&&!E&&(j("false write response, pause",p._readableState.awaitDrain),p._readableState.awaitDrain++,b=!0),p.pause())}function c(e){j("onerror",e),h(),t.removeListener("error",c),0===C(t,"error")&&t.emit("error",e)}function l(){t.removeListener("finish",u),h()}function u(){j("onfinish"),t.removeListener("close",l),h()}function h(){j("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,j("pipe count=%d opts=%j",d.pipesCount,n);var f=(!n||!1!==n.end)&&t!==e.stdout&&t!==e.stderr,m=f?r:o;d.endEmitted?D(m):p.once("end",m),t.on("unpipe",s);var v=g(p);t.on("drain",v);var E=!1,b=!1;return p.on("data",a),i(t,"error",c),t.once("close",l),t.once("finish",u),t.emit("pipe",p),d.flowing||(j("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},b={javascript:!0,"javascript:":!0},w={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},y=n(36);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?C+="x":C+=M[I];if(!C.match(/^[+a-z0-9A-Z_-]{0,63}$/)){var O=k.slice(0,x),U=k.slice(x+1),N=M.match(/^([+a-z0-9A-Z_-]{0,63})(.*)$/);N&&(O.push(N[1]),U.unshift(N[2])),U.length&&(o="/"+U.join(".")+o),this.hostname=O.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),S||(this.hostname=c.toASCII(this.hostname));var j=this.port?":"+this.port:"",P=this.hostname||"";this.host=P+j,this.href+=this.host,S&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==o[0]&&(o="/"+o))}if(!E[d])for(var x=0,D=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 R=x.slice(-1)[0],S=(n.host||t.host||x.length>1)&&("."===R||".."===R)||""===R,k=0,D=x.length;D>=0;D--)R=x[D],"."===R?x.splice(D,1):".."===R?(x.splice(D,1),k++):k&&(x.splice(D,1),k--);if(!y&&!_)for(;k--;k)x.unshift("..");!y||""===x[0]||x[0]&&"/"===x[0].charAt(0)||x.unshift(""),S&&"/"!==x.join("/").substr(-1)&&x.push("");var M=""===x[0]||x[0]&&"/"===x[0].charAt(0);if(A){n.hostname=n.host=M?"":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 y=y||n.host&&x.length,y&&!M&&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(5).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(29),s=n(39),r=n(38),o=n(4),a=n(12),c=n(8),l=n(18),u=n(16),h=n(19),p=n(17),d=n(31);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("The response body isn't a Buffer."));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(`The file could not be found: ${e}`));s.readFile(e,(t,e)=>{t?o(t):n(e)});return null})}}):Promise.reject(new TypeError("The resource must be a string or Buffer."))}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(5).Buffer)},function(t,e){class n extends Error{constructor(t){super();const e=t.errors?` ${this.constructor.flattenErrors(t.errors).join("\n")}`:"";this.name="DiscordAPIError",this.message=`${t.message}${e}`,this.code=t.code}static flattenErrors(t,e=""){let n=[];for(const i of Object.keys(t)){const s=e?isNaN(i)?`${e}.${i}`:`${e}[${i}]`:i;t[i]._errors?n.push(`${s}: ${t[i]._errors.map(t=>t.message).join(" ")}`):t[i].code||t[i].message?n.push(`${t[i].code?`${t[i].code}: `:""}${t[i].message}`.trim()):n=n.concat(this.flattenErrors(t[i],s))}return n}}t.exports=n},function(t,e,n){const i=n(144),s=n(143),r=n(142),o=n(140),a=n(141),c=n(0);class l{constructor(t){this.client=t,this.handlers={},this.userAgentManager=new i(this),this.rateLimitedEndpoints={},this.globallyRateLimited=!1,this.api=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(c.Errors.INVALID_RATE_LIMIT_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=l},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(25).platform(),s=n(14),r=n(0),o=n(39),a=n(146),c=function(){try{const t=n(192);return t.pack?t:null}catch(t){return null}}(),l=function(){if(i)return window.WebSocket;try{return n(193)}catch(t){return n(194)}}();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(5).Buffer)},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(186),sendMessage:n(187)}},function(module,exports,__webpack_require__){(function(process){const os=__webpack_require__(25),EventEmitter=__webpack_require__(14).EventEmitter,Constants=__webpack_require__(0),Permissions=__webpack_require__(10),Util=__webpack_require__(4),RESTManager=__webpack_require__(67),ClientDataManager=__webpack_require__(109),ClientManager=__webpack_require__(110),ClientDataResolver=__webpack_require__(65),ClientVoiceManager=__webpack_require__(190),WebSocketManager=__webpack_require__(145),ActionsManager=__webpack_require__(111),Collection=__webpack_require__(3),Presence=__webpack_require__(13).Presence,VoiceRegion=__webpack_require__(70),Webhook=__webpack_require__(21),User=__webpack_require__(12),Invite=__webpack_require__(27),OAuth2Application=__webpack_require__(28),ShardClientUtil=__webpack_require__(189),VoiceBroadcast=__webpack_require__(191);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.api=this.rest.api,this.dataManager=new ClientDataManager(this),this.manager=new ClientManager(this),this.ws=new WebSocketManager(this),this.resolver=new ClientDataResolver(this),this.actions=new ActionsManager(this),this.voice=this.browser?null:new ClientVoiceManager(this),this.shard=process.send?ShardClientUtil.singleton(this):null,this.users=new Collection,this.guilds=new Collection,this.channels=new Collection,this.presences=new Collection,!this.token&&"CLIENT_TOKEN"in process.env?this.token=process.env.CLIENT_TOKEN:this.token=null,this.user=null,this.readyAt=null,this.broadcasts=[],this.pings=[],this._timeouts=new Set,this._intervals=new Set,this.options.messageSweepInterval>0&&this.setInterval(this.sweepMessages.bind(this),1e3*this.options.messageSweepInterval)}get _pingTimestamp(){return this.ws.connection?this.ws.connection.lastPingTimestamp:0}get status(){return this.ws.connection.status}get uptime(){return this.readyAt?Date.now()-this.readyAt:null}get ping(){return this.pings.reduce((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(Constants.Errors.INVALID_TOKEN);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(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("The lifetime must be a number.");if(t<=0)return this.emit("debug","Didn't sweep messages - lifetime is unlimited"),-1;const e=1e3*t,n=Date.now();let i=0,s=0;for(const 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.rest.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();this._timeouts.delete(i)},e,...n);return this._timeouts.add(i),i}clearTimeout(t){clearTimeout(t),this._timeouts.delete(t)}setInterval(t,e,...n){const i=setInterval(t,e,...n);return this._intervals.add(i),i}clearInterval(t){clearInterval(t),this._intervals.delete(t)}_pong(t){this.pings.unshift(Date.now()-t),this.pings.length>3&&(this.pings.length=3),this.ws.lastHeartbeatAck=!0}_setPresence(t,e){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("The shardCount option must be a number.");if("number"!=typeof t.shardId||isNaN(t.shardId))throw new TypeError("The shardId option must be a number.");if(t.shardCount<0)throw new RangeError("The shardCount option must be at least 0.");if(t.shardId<0)throw new RangeError("The shardId option must be at least 0.");if(0!==t.shardId&&t.shardId>=t.shardCount)throw new RangeError("The shardId option must be less than shardCount.");if("number"!=typeof t.messageCacheMaxSize||isNaN(t.messageCacheMaxSize))throw new TypeError("The messageCacheMaxSize option must be a number.");if("number"!=typeof t.messageCacheLifetime||isNaN(t.messageCacheLifetime))throw new TypeError("The messageCacheLifetime option must be a number.");if("number"!=typeof t.messageSweepInterval||isNaN(t.messageSweepInterval))throw new TypeError("The messageSweepInterval option must be a number.");if("boolean"!=typeof t.fetchAllMembers)throw new TypeError("The fetchAllMembers option must be a boolean.");if("boolean"!=typeof t.disableEveryone)throw new TypeError("The disableEveryone option must be a boolean.");if("number"!=typeof t.restWsBridgeTimeout||isNaN(t.restWsBridgeTimeout))throw new TypeError("The restWsBridgeTimeout option must be a number.");if(!(t.disabledEvents instanceof Array))throw new TypeError("The disabledEvents option must be an Array.")}}module.exports=Client}).call(exports,__webpack_require__(7))},function(t,e,n){const i=n(21),s=n(67),r=n(65),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.api=this.rest.api,this.resolver=new r(this),this._timeouts=new Set,this._intervals=new Set}setTimeout(t,e,...n){const i=setTimeout(()=>{t();this._timeouts.delete(i)},e,...n);return this._timeouts.add(i),i}clearTimeout(t){clearTimeout(t),this._timeouts.delete(t)}setInterval(t,e,...n){const i=setInterval(t,e,...n);return this._intervals.add(i),i}clearInterval(t){clearInterval(t),this._intervals.delete(t)}destroy(){for(const t of this._timeouts)clearTimeout(t);for(const 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 i(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===t[e-2]?2:"="===t[e-1]?1:0}function s(t){return 3*t.length/4-i(t)}function r(t){var e,n,s,r,o,a,c=t.length;o=i(t),a=new h(3*c/4-o),s=o>0?c-4:c;var l=0;for(e=0,n=0;e>16&255,a[l++]=r>>8&255,a[l++]=255&r;return 2===o?(r=u[t.charCodeAt(e)]<<2|u[t.charCodeAt(e+1)]>>4,a[l++]=255&r):1===o&&(r=u[t.charCodeAt(e)]<<10|u[t.charCodeAt(e+1)]<<4|u[t.charCodeAt(e+2)]>>2,a[l++]=r>>8&255,a[l++]=255&r),a}function o(t){return l[t>>18&63]+l[t>>12&63]+l[t>>6&63]+l[63&t]}function a(t,e,n){for(var i,s=[],r=e;rc?c:o+16383));return 1===i?(e=t[n-1],s+=l[e>>2],s+=l[e<<4&63],s+="=="):2===i&&(e=(t[n-2]<<8)+t[n-1],s+=l[e>>10],s+=l[e>>4&63],s+=l[e<<2&63],s+="="),r.push(s),r.join("")}e.byteLength=s,e.toByteArray=r,e.fromByteArray=c;for(var l=[],u=[],h="undefined"!=typeof Uint8Array?Uint8Array:Array,p="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",d=0,f=p.length;d>1,u=-7,h=n?s-1:0,p=n?-1:1,d=t[e+h];for(h+=p,r=d&(1<<-u)-1,d>>=-u,u+=a;u>0;r=256*r+t[e+h],h+=p,u-=8);for(o=r&(1<<-u)-1,r>>=-u,u+=i;u>0;o=256*o+t[e+h],h+=p,u-=8);if(0===r)r=1-l;else{if(r===c)return o?NaN:1/0*(d?-1:1);o+=Math.pow(2,i),r-=l}return(d?-1:1)*o*Math.pow(2,r-i)},e.write=function(t,e,n,i,s,r){var o,a,c,l=8*r-s-1,u=(1<>1,p=23===s?Math.pow(2,-24)-Math.pow(2,-77):0,d=i?0:r-1,f=i?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=u):(o=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-o))<1&&(o--,c*=2),e+=o+h>=1?p/c:p*Math.pow(2,1-h),e*c>=2&&(o++,c/=2),o+h>=u?(a=0,o=u):o+h>=1?(a=(e*c-1)*Math.pow(2,s),o+=h):(a=e*Math.pow(2,h-1)*Math.pow(2,s),o=0));s>=8;t[n+d]=255&a,d+=f,a/=256,s-=8);for(o=o<0;t[n+d]=255&o,d+=f,o/=256,l-=8);t[n+d-f]|=128*m}},function(t,e,n){(function(t,i){var s;!function(r){function o(t){throw new RangeError(I[t])}function a(t,e){for(var n=t.length,i=[];n--;)i[n]=e(t[n]);return i}function c(t,e){var n=t.split("@"),i="";return n.length>1&&(i=n[0]+"@",t=n[1]),t=t.replace(C,"."),i+a(t.split("."),e).join(".")}function l(t){for(var e,n,i=[],s=0,r=t.length;s=55296&&e<=56319&&s65535&&(t-=65536,e+=U(t>>>10&1023|55296),t=56320|1023&t),e+=U(t)}).join("")}function h(t){return t-48<10?t-22:t-65<26?t-65:t-97<26?t-97:y}function p(t,e){return t+22+75*(t<26)-((0!=e)<<5)}function d(t,e,n){var i=0;for(t=n?O(t/T):t>>1,t+=O(t/e);t>L*x>>1;i+=y)t=O(t/L);return O(i+(L+1)*t/(t+A))}function f(t){var e,n,i,s,r,a,c,l,p,f,m=[],g=t.length,v=0,E=S,b=R;for(n=t.lastIndexOf(k),n<0&&(n=0),i=0;i=128&&o("not-basic"),m.push(t.charCodeAt(i));for(s=n>0?n+1:0;s=g&&o("invalid-input"),l=h(t.charCodeAt(s++)),(l>=y||l>O((w-v)/a))&&o("overflow"),v+=l*a,p=c<=b?_:c>=b+x?x:c-b,!(lO(w/f)&&o("overflow"),a*=f;e=m.length+1,b=d(v-r,e,0==r),O(v/e)>w-E&&o("overflow"),E+=O(v/e),v%=e,m.splice(v++,0,E)}return u(m)}function m(t){var e,n,i,s,r,a,c,u,h,f,m,g,v,E,b,A=[];for(t=l(t),g=t.length,e=S,n=0,r=R,a=0;a=e&&mO((w-n)/v)&&o("overflow"),n+=(c-e)*v,e=c,a=0;aw&&o("overflow"),m==e){for(u=n,h=y;f=h<=r?_:h>=r+x?x:h-r,!(u= 0x80 (not a basic code point)","invalid-input":"Invalid input"},L=y-_,O=Math.floor,U=String.fromCharCode;b={version:"1.4.1",ucs2:{decode:l,encode:u},decode:f,encode:m,toASCII:v,toUnicode:g},void 0!==(s=function(){return b}.call(e,n,e,t))&&(t.exports=s)}()}).call(e,n(107)(t),n(9))},function(t,e,n){"use strict";function i(t,e){return Object.prototype.hasOwnProperty.call(t,e)}t.exports=function(t,e,n,r){e=e||"&",n=n||"=";var o={};if("string"!=typeof t||0===t.length)return o;t=t.split(e);var a=1e3;r&&"number"==typeof r.maxKeys&&(a=r.maxKeys);var c=t.length;a>0&&c>a&&(c=a);for(var l=0;l=0?(u=f.substr(0,m),h=f.substr(m+1)):(u=f,h=""),p=decodeURIComponent(u),d=decodeURIComponent(h),i(o,p)?s(o[p])?o[p].push(d):o[p]=[o[p],d]:o[p]=d}return o};var s=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)}},function(t,e,n){"use strict";function i(t,e){if(t.map)return t.map(e);for(var n=[],i=0;i0?this.tail.next=e:this.head=e,this.tail=e,++this.length},i.prototype.unshift=function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length},i.prototype.shift=function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}},i.prototype.clear=function(){this.head=this.tail=null,this.length=0},i.prototype.join=function(t){if(0===this.length)return"";for(var e=this.head,n=""+e.data;e=e.next;)n+=t+e.data;return n},i.prototype.concat=function(t){if(0===this.length)return s.alloc(0);if(1===this.length)return this.head.data;for(var e=s.allocUnsafe(t>>>0),n=this.head,i=0;n;)n.data.copy(e,i),i+=n.data.length,n=n.next;return e}},function(t,e,n){t.exports=n(23).PassThrough},function(t,e,n){t.exports=n(23).Transform},function(t,e,n){t.exports=n(37)},function(t,e,n){(function(t,e){!function(t,n){"use strict";function i(t){"function"!=typeof t&&(t=new Function(""+t));for(var e=new Array(arguments.length-1),n=0;n=3.1.0 <4.0.0",type:"range"},"/home/travis/build/hydrabolt/discord.js"]],_from:"snekfetch@>=3.1.0 <4.0.0",_id:"snekfetch@3.1.7",_inCache:!0,_location:"/snekfetch",_nodeVersion:"8.0.0-rc.0",_npmOperationalInternal:{host:"packages-12-west.internal.npmjs.com",tmp:"tmp/snekfetch-3.1.7.tgz_1494815163487_0.09571001585572958"},_npmUser:{name:"snek",email:"me@gus.host"},_npmVersion:"4.5.0",_phantomChildren:{},_requested:{raw:"snekfetch@^3.1.0",scope:null,escapedName:"snekfetch",name:"snekfetch",rawSpec:"^3.1.0",spec:">=3.1.0 <4.0.0",type:"range"},_requiredBy:["/"],_resolved:"https://registry.npmjs.org/snekfetch/-/snekfetch-3.1.7.tgz",_shasum:"5eb980d29c3b455bf0b13359647909b0737315e9",_shrinkwrap:null,_spec:"snekfetch@^3.1.0",_where:"/home/travis/build/hydrabolt/discord.js",author:{name:"Gus Caplan",email:"me@gus.host"},bugs:{url:"https://github.com/devsnek/snekfetch/issues"},dependencies:{},description:"Just do http requests without all that weird nastiness from other libs",devDependencies:{},directories:{},dist:{shasum:"5eb980d29c3b455bf0b13359647909b0737315e9",tarball:"https://registry.npmjs.org/snekfetch/-/snekfetch-3.1.7.tgz"},gitHead:"f47ae6179addc843c76041a5b0a1013c67759729",homepage:"https://github.com/devsnek/snekfetch#readme",license:"MIT",main:"index.js",maintainers:[{name:"crawl",email:"icrawltogo@gmail.com"},{name:"hydrabolt",email:"amishshah.2k@gmail.com"},{name:"snek",email:"me@gus.host"}],name:"snekfetch",optionalDependencies:{},readme:"ERROR: No README data found!",repository:{type:"git",url:"git+https://github.com/devsnek/snekfetch.git"},scripts:{},version:"3.1.7"}},function(t,e,n){(function(e){const i=n(29),s=n(95);class r{constructor(){this.boundary=`--snekfetch--${Math.random().toString().slice(2,7)}`,this.buffer=new e(0)}append(t,n,r){if(void 0!==n){let o=` --${this.boundary} Content-Disposition: form-data; name="${t}"`,a=null;if(r){o+=`; filename="${r}"`,a="application/octet-stream";const t=i.extname(r).slice(1);t&&(a=s.lookup(t))}n instanceof e?a=s.buffer(n):"object"==typeof n?(a="application/json",n=e.from(JSON.stringify(n))):n=e.from(String(n)),a&&(o+=`