diff --git a/discord.master.js b/discord.master.js index 45f1c6c7..2db72841 100644 --- a/discord.master.js +++ b/discord.master.js @@ -10173,8 +10173,8 @@ module.exports = { "peerDependencies": { "bufferutil": "^2.0.0", "erlpack": "hammerandchisel/erlpack", - "node-opus": "^0.2.0", - "opusscript": "^0.0.2", + "node-opus": "^0.2.5", + "opusscript": "^0.0.3", "sodium": "^2.0.1", "uws": "^0.14.1" }, diff --git a/discord.master.min.js b/discord.master.min.js index a67c4753..862a754b 100644 --- a/discord.master.min.js +++ b/discord.master.min.js @@ -7,7 +7,7 @@ ${e} * @license MIT */ var Q=i(51),Z=i(52),X=i(53);e.Buffer=r,e.SlowBuffer=g,e.INSPECT_MAX_BYTES=50,r.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:n(),e.kMaxLength=s(),r.poolSize=8192,r._augment=function(t){return t.__proto__=r.prototype,t},r.from=function(t,e,i){return a(null,t,e,i)},r.TYPED_ARRAY_SUPPORT&&(r.prototype.__proto__=Uint8Array.prototype,r.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&r[Symbol.species]===r&&Object.defineProperty(r,Symbol.species,{value:null,configurable:!0})),r.alloc=function(t,e,i){return l(null,t,e,i)},r.allocUnsafe=function(t){return u(null,t)},r.allocUnsafeSlow=function(t){return u(null,t)},r.isBuffer=function(t){return!(null==t||!t._isBuffer)},r.compare=function(t,e){if(!r.isBuffer(t)||!r.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var i=t.length,n=e.length,s=0,o=Math.min(i,n);s0&&(t=this.toString("hex",0,i).match(/.{2}/g).join(" "),this.length>i&&(t+=" ... ")),""},r.prototype.compare=function(t,e,i,n,s){if(!r.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===i&&(i=t?t.length:0),void 0===n&&(n=0),void 0===s&&(s=this.length),e<0||i>t.length||n<0||s>this.length)throw new RangeError("out of range index");if(n>=s&&e>=i)return 0;if(n>=s)return-1;if(e>=i)return 1;if(e>>>=0,i>>>=0,n>>>=0,s>>>=0,this===t)return 0;for(var o=s-n,a=i-e,c=Math.min(o,a),l=this.slice(n,s),u=t.slice(e,i),h=0;hs)&&(i=s),t.length>0&&(i<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return _(this,t,e,i);case"utf8":case"utf-8":return y(this,t,e,i);case"ascii":return A(this,t,e,i);case"latin1":case"binary":return k(this,t,e,i);case"base64":return R(this,t,e,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,t,e,i);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},r.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var tt=4096;r.prototype.slice=function(t,e){var i=this.length;t=~~t,e=void 0===e?i:~~e,t<0?(t+=i,t<0&&(t=0)):t>i&&(t=i),e<0?(e+=i,e<0&&(e=0)):e>i&&(e=i),e0&&(s*=256);)n+=this[t+--e]*s;return n},r.prototype.readUInt8=function(t,e){return e||N(t,1,this.length),this[t]},r.prototype.readUInt16LE=function(t,e){return e||N(t,2,this.length),this[t]|this[t+1]<<8},r.prototype.readUInt16BE=function(t,e){return e||N(t,2,this.length),this[t]<<8|this[t+1]},r.prototype.readUInt32LE=function(t,e){return e||N(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},r.prototype.readUInt32BE=function(t,e){return e||N(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},r.prototype.readIntLE=function(t,e,i){t|=0,e|=0,i||N(t,e,this.length);for(var n=this[t],s=1,o=0;++o=s&&(n-=Math.pow(2,8*e)),n},r.prototype.readIntBE=function(t,e,i){t|=0,e|=0,i||N(t,e,this.length);for(var n=e,s=1,o=this[t+--n];n>0&&(s*=256);)o+=this[t+--n]*s;return s*=128,o>=s&&(o-=Math.pow(2,8*e)),o},r.prototype.readInt8=function(t,e){return e||N(t,1,this.length),128&this[t]?(255-this[t]+1)*-1:this[t]},r.prototype.readInt16LE=function(t,e){e||N(t,2,this.length);var i=this[t]|this[t+1]<<8;return 32768&i?4294901760|i:i},r.prototype.readInt16BE=function(t,e){e||N(t,2,this.length);var i=this[t+1]|this[t]<<8;return 32768&i?4294901760|i:i},r.prototype.readInt32LE=function(t,e){return e||N(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},r.prototype.readInt32BE=function(t,e){return e||N(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},r.prototype.readFloatLE=function(t,e){return e||N(t,4,this.length),Z.read(this,t,!0,23,4)},r.prototype.readFloatBE=function(t,e){return e||N(t,4,this.length),Z.read(this,t,!1,23,4)},r.prototype.readDoubleLE=function(t,e){return e||N(t,8,this.length),Z.read(this,t,!0,52,8)},r.prototype.readDoubleBE=function(t,e){return e||N(t,8,this.length),Z.read(this,t,!1,52,8)},r.prototype.writeUIntLE=function(t,e,i,n){if(t=+t,e|=0,i|=0,!n){var s=Math.pow(2,8*i)-1;O(this,t,e,i,s,0)}var o=1,r=0;for(this[e]=255&t;++r=0&&(r*=256);)this[e+o]=t/r&255;return e+i},r.prototype.writeUInt8=function(t,e,i){return t=+t,e|=0,i||O(this,t,e,1,255,0),r.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},r.prototype.writeUInt16LE=function(t,e,i){return t=+t,e|=0,i||O(this,t,e,2,65535,0),r.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):P(this,t,e,!0),e+2},r.prototype.writeUInt16BE=function(t,e,i){return t=+t,e|=0,i||O(this,t,e,2,65535,0),r.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):P(this,t,e,!1),e+2},r.prototype.writeUInt32LE=function(t,e,i){return t=+t,e|=0,i||O(this,t,e,4,4294967295,0),r.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):G(this,t,e,!0),e+4},r.prototype.writeUInt32BE=function(t,e,i){return t=+t,e|=0,i||O(this,t,e,4,4294967295,0),r.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):G(this,t,e,!1),e+4},r.prototype.writeIntLE=function(t,e,i,n){if(t=+t,e|=0,!n){var s=Math.pow(2,8*i-1);O(this,t,e,i,s-1,-s)}var o=0,r=1,a=0;for(this[e]=255&t;++o>0)-a&255;return e+i},r.prototype.writeIntBE=function(t,e,i,n){if(t=+t,e|=0,!n){var s=Math.pow(2,8*i-1);O(this,t,e,i,s-1,-s)}var o=i-1,r=1,a=0;for(this[e+o]=255&t;--o>=0&&(r*=256);)t<0&&0===a&&0!==this[e+o+1]&&(a=1),this[e+o]=(t/r>>0)-a&255;return e+i},r.prototype.writeInt8=function(t,e,i){return t=+t,e|=0,i||O(this,t,e,1,127,-128),r.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},r.prototype.writeInt16LE=function(t,e,i){return t=+t,e|=0,i||O(this,t,e,2,32767,-32768),r.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):P(this,t,e,!0),e+2},r.prototype.writeInt16BE=function(t,e,i){return t=+t,e|=0,i||O(this,t,e,2,32767,-32768),r.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):P(this,t,e,!1),e+2},r.prototype.writeInt32LE=function(t,e,i){return t=+t,e|=0,i||O(this,t,e,4,2147483647,-2147483648),r.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):G(this,t,e,!0),e+4},r.prototype.writeInt32BE=function(t,e,i){return t=+t,e|=0,i||O(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),r.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):G(this,t,e,!1),e+4},r.prototype.writeFloatLE=function(t,e,i){return q(this,t,e,!0,i)},r.prototype.writeFloatBE=function(t,e,i){return q(this,t,e,!1,i)},r.prototype.writeDoubleLE=function(t,e,i){return B(this,t,e,!0,i)},r.prototype.writeDoubleBE=function(t,e,i){return B(this,t,e,!1,i)},r.prototype.copy=function(t,e,i,n){if(i||(i=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e=0;--s)t[s+e]=this[s+i];else if(o<1e3||!r.TYPED_ARRAY_SUPPORT)for(s=0;s>>=0,i=void 0===i?this.length:i>>>0,t||(t=0);var o;if("number"==typeof t)for(o=e;othis.client.resolver.resolveBuffer(t.attachment).then(e=>{return t.file=e,t}))).then(i=>this.client.rest.methods.sendMessage(this,t,e,i))}return this.client.rest.methods.sendMessage(this,t,e)}sendMessage(t,e){return this.send(t,e)}sendEmbed(t,e,i){return i||"object"!=typeof e||e instanceof Array?i||(i={}):(i=e,e=""),this.send(e,Object.assign(i,{embed:t}))}sendFiles(t,e,i={}){return this.send(e,Object.assign(i,{files:t}))}sendFile(t,e,i,n={}){return this.sendFiles([{attachment:t,name:e}],i,n)}sendCode(t,e,i={}){return this.send(e,Object.assign(i,{code:t}))}fetchMessage(t){return this.client.user.bot?this.client.rest.methods.getChannelMessage(this,t).then(t=>{const e=t instanceof s?t:new s(this,t,this.client);return this._cacheMessage(e),e}):this.fetchMessages({limit:1,around:t}).then(e=>{const i=e.first();if(i.id!==t)throw new Error("Message not found.");return i})}fetchMessages(t={}){return this.client.rest.methods.getChannelMessages(this,t).then(t=>{const e=new r;for(const i of t){const t=new s(this,i,this.client);e.set(i.id,t),this._cacheMessage(t)}return e})}fetchPinnedMessages(){return this.client.rest.methods.getChannelPinnedMessages(this).then(t=>{const e=new r;for(const i of t){const t=new s(this,i,this.client);e.set(i.id,t),this._cacheMessage(t)}return e})}search(t){return this.client.rest.methods.search(this,t)}startTyping(t){if("undefined"!=typeof t&&t<1)throw new RangeError("Count must be at least 1.");if(this.client.user._typing.has(this.id)){const e=this.client.user._typing.get(this.id);e.count=t||e.count+1}else this.client.user._typing.set(this.id,{count:t||1,interval:this.client.setInterval(()=>{this.client.rest.methods.sendTyping(this.id)},9e3)}),this.client.rest.methods.sendTyping(this.id)}stopTyping(t=false){if(this.client.user._typing.has(this.id)){const e=this.client.user._typing.get(this.id);e.count--,(e.count<=0||t)&&(this.client.clearInterval(e.interval),this.client.user._typing.delete(this.id))}}get typing(){return this.client.user._typing.has(this.id)}get typingCount(){return this.client.user._typing.has(this.id)?this.client.user._typing.get(this.id).count:0}createCollector(t,e={}){return new o(this,t,e)}awaitMessages(t,e={}){return new Promise((i,n)=>{const s=this.createCollector(t,e);s.on("end",(t,s)=>{e.errors&&e.errors.includes(s)?n(t):i(t)})})}bulkDelete(t,e=false){if(!isNaN(t))return this.fetchMessages({limit:t}).then(t=>this.bulkDelete(t,e));if(t instanceof Array||t instanceof r){const i=t instanceof r?t.keyArray():t.map(t=>t.id);return this.client.rest.methods.bulkDeleteMessages(this,i,e)}throw new TypeError("The messages must be an Array, Collection, or number.")}acknowledge(){return this.client.rest.methods.ackTextMessage(this)}_cacheMessage(t){const e=this.client.options.messageCacheMaxSize;return 0===e?null:(this.messages.size>=e&&e>0&&this.messages.delete(this.messages.firstKey()),this.messages.set(t.id,t),t)}}e.applyToClass=((t,e=false,i=[])=>{const n=["send","sendMessage","sendEmbed","sendFile","sendFiles","sendCode"];e&&n.push("_cacheMessage","fetchMessages","fetchMessage","search","bulkDelete","startTyping","stopTyping","typing","typingCount","fetchPinnedMessages","createCollector","awaitMessages");for(const s of n)i.includes(s)||Object.defineProperty(t.prototype,s,Object.getOwnPropertyDescriptor(a.prototype,s))})},function(t,e){e.endianness=function(){return"LE"},e.hostname=function(){return"undefined"!=typeof location?location.hostname:""},e.loadavg=function(){return[]},e.uptime=function(){return 0},e.freemem=function(){return Number.MAX_VALUE},e.totalmem=function(){return Number.MAX_VALUE},e.cpus=function(){return[]},e.type=function(){return"Browser"},e.release=function(){return"undefined"!=typeof navigator?navigator.appVersion:""},e.networkInterfaces=e.getNetworkInterfaces=function(){return{}},e.arch=function(){return"javascript"},e.platform=function(){return"browser"},e.tmpdir=e.tmpDir=function(){return"/tmp"},e.EOL="\n"},function(t,e,i){const n=i(25),s=i(11),o=i(10),r=i(12),a=i(7).Presence,c=i(13),l=i(0),u=i(3),h=i(4),p=i(5);class d{constructor(t,e){Object.defineProperty(this,"client",{value:t}),this.members=new u,this.channels=new u,this.roles=new u,this.presences=new u,e&&(e.unavailable?(this.available=!1,this.id=e.id):(this.available=!0,this.setup(e)))}setup(t){this.name=t.name,this.icon=t.icon,this.splash=t.splash,this.region=t.region,this.memberCount=t.member_count||this.memberCount,this.large=Boolean("large"in t?t.large:this.large),this.features=t.features,this.applicationID=t.application_id,this.emojis=new u;for(const e of t.emojis)this.emojis.set(e.id,new r(this,e));if(this.afkTimeout=t.afk_timeout,this.afkChannelID=t.afk_channel_id,this.embedEnabled=t.embed_enabled,this.verificationLevel=t.verification_level,this.explicitContentFilter=t.explicit_content_filter,this.joinedTimestamp=t.joined_at?new Date(t.joined_at).getTime():this.joinedTimestamp,this.id=t.id,this.available=!t.unavailable,this.features=t.features||this.features||[],t.members){this.members.clear();for(const e of t.members)this._addMember(e,!1)}if(t.owner_id&&(this.ownerID=t.owner_id),t.channels){this.channels.clear();for(const e of t.channels)this.client.dataManager.newChannel(e,this)}if(t.roles){this.roles.clear();for(const e of t.roles){const t=new o(this,e);this.roles.set(t.id,t)}}if(t.presences)for(const i of t.presences)this._setPresence(i.user.id,i);if(this._rawVoiceStates=new u,t.voice_states)for(const n of t.voice_states){this._rawVoiceStates.set(n.user_id,n);const t=this.members.get(n.user_id);t&&(t.serverMute=n.mute,t.serverDeaf=n.deaf,t.selfMute=n.self_mute,t.selfDeaf=n.self_deaf,t.voiceSessionID=n.session_id,t.voiceChannelID=n.channel_id,this.channels.get(n.channel_id).members.set(t.user.id,t))}}get createdTimestamp(){return p.deconstruct(this.id).timestamp}get createdAt(){return new Date(this.createdTimestamp)}get joinedAt(){return new Date(this.joinedTimestamp)}get iconURL(){return this.icon?l.Endpoints.Guild(this).Icon(this.client.options.http.cdn,this.icon):null}get splashURL(){return this.splash?l.Endpoints.Guild(this).Splash(this.client.options.http.cdn,this.splash):null}get owner(){return this.members.get(this.ownerID)}get voiceConnection(){return this.client.browser?null:this.client.voice.connections.get(this.id)||null}get defaultChannel(){return this.channels.get(this.id)}get defaultRole(){return this.roles.get(this.id)}get _sortedRoles(){return this._sortPositionWithID(this.roles)}member(t){return this.client.resolver.resolveGuildMember(this,t)}fetchBans(){return this.client.rest.methods.getGuildBans(this)}fetchInvites(){return this.client.rest.methods.getGuildInvites(this)}fetchWebhooks(){return this.client.rest.methods.getGuildWebhooks(this)}fetchVoiceRegions(){return this.client.rest.methods.fetchVoiceRegions(this.id)}addMember(t,e){return this.members.has(t.id)?Promise.resolve(this.members.get(t.id)):this.client.rest.methods.putGuildMember(this,t,e)}fetchMember(t,e=true){return t=this.client.resolver.resolveUser(t),t?this.members.has(t.id)?Promise.resolve(this.members.get(t.id)):this.client.rest.methods.getGuildMember(this,t,e):Promise.reject(new Error("User is not cached. Use Client.fetchUser first."))}fetchMembers(t="",e=0){return new Promise((i,n)=>{if(this.memberCount===this.members.size)return void i(this);this.client.ws.send({op:l.OPCodes.REQUEST_GUILD_MEMBERS,d:{guild_id:this.id,query:t,limit:e}});const s=(t,e)=>{e.id===this.id&&(this.memberCount===this.members.size||t.length<1e3)&&(this.client.removeListener(l.Events.GUILD_MEMBERS_CHUNK,s),i(this))};this.client.on(l.Events.GUILD_MEMBERS_CHUNK,s),this.client.setTimeout(()=>n(new Error("Members didn't arrive in time.")),12e4)})}search(t){return this.client.rest.methods.search(this,t)}edit(t){return this.client.rest.methods.updateGuild(this,t)}setName(t){return this.edit({name:t})}setRegion(t){return this.edit({region:t})}setVerificationLevel(t){return this.edit({verificationLevel:t})}setAFKChannel(t){return this.edit({afkChannel:t})}setAFKTimeout(t){return this.edit({afkTimeout:t})}setIcon(t){return this.edit({icon:t})}setOwner(t){return this.edit({owner:t})}setSplash(t){return this.edit({splash:t})}ban(t,e=0){return this.client.rest.methods.banGuildMember(this,t,e)}unban(t){return this.client.rest.methods.unbanGuildMember(this,t)}pruneMembers(t,e=false){if("number"!=typeof t)throw new TypeError("Days must be a number.");return this.client.rest.methods.pruneGuildMembers(this,t,e)}sync(){this.client.user.bot||this.client.syncGuilds([this])}createChannel(t,e,i){return this.client.rest.methods.createChannel(this,t,e,i)}setChannelPositions(t){return this.client.rest.methods.updateChannelPositions(this.id,t)}createRole(t={}){return this.client.rest.methods.createGuildRole(this,t)}createEmoji(t,e,i){return new Promise(n=>{"string"==typeof t&&t.startsWith("data:")?n(this.client.rest.methods.createEmoji(this,t,e,i)):this.client.resolver.resolveBuffer(t).then(t=>{const s=this.client.resolver.resolveBase64(t);n(this.client.rest.methods.createEmoji(this,s,e,i))})})}deleteEmoji(t){return t instanceof r||(t=this.emojis.get(t)),this.client.rest.methods.deleteEmoji(t)}leave(){return this.client.rest.methods.leaveGuild(this)}delete(){return this.client.rest.methods.deleteGuild(this)}acknowledge(){return this.client.rest.methods.ackGuild(this)}equals(t){let e=t&&this.id===t.id&&this.available===!t.unavailable&&this.splash===t.splash&&this.region===t.region&&this.name===t.name&&this.memberCount===t.member_count&&this.large===t.large&&this.icon===t.icon&&h.arraysEqual(this.features,t.features)&&this.ownerID===t.owner_id&&this.verificationLevel===t.verification_level&&this.embedEnabled===t.embed_enabled;return e&&(this.embedChannel?this.embedChannel.id!==t.embed_channel_id&&(e=!1):t.embed_channel_id&&(e=!1)),e}toString(){return this.name}_addMember(t,e=true){const i=this.members.has(t.user.id);t.user instanceof s||(t.user=this.client.dataManager.newUser(t.user)),t.joined_at=t.joined_at||0;const n=new c(this,t);if(this.members.set(n.id,n),this._rawVoiceStates&&this._rawVoiceStates.has(n.user.id)){const t=this._rawVoiceStates.get(n.user.id);n.serverMute=t.mute,n.serverDeaf=t.deaf,n.selfMute=t.self_mute,n.selfDeaf=t.self_deaf,n.voiceSessionID=t.session_id,n.voiceChannelID=t.channel_id,this.client.channels.has(t.channel_id)?this.client.channels.get(t.channel_id).members.set(n.user.id,n):this.client.emit("warn",`Member ${n.id} added in guild ${this.id} with an uncached voice channel`)}return this.client.ws.status===l.Status.READY&&e&&!i&&this.client.emit(l.Events.GUILD_MEMBER_ADD,n),n}_updateMember(t,e){const i=h.cloneObject(t);e.roles&&(t._roles=e.roles),"undefined"!=typeof e.nick&&(t.nickname=e.nick);const n=t.nickname!==i.nickname||!h.arraysEqual(t._roles,i._roles);return this.client.ws.status===l.Status.READY&&n&&this.client.emit(l.Events.GUILD_MEMBER_UPDATE,i,t),{old:i,mem:t}}_removeMember(t){this.members.delete(t.id)}_memberSpeakUpdate(t,e){const i=this.members.get(t);i&&i.speaking!==e&&(i.speaking=e,this.client.emit(l.Events.GUILD_MEMBER_SPEAKING,i,e))}_setPresence(t,e){return this.presences.get(t)?void this.presences.get(t).update(e):void this.presences.set(t,new a(e))}setRolePosition(t,e,i=false){if("string"==typeof t&&(t=this.roles.get(t),!t))return Promise.reject(new Error("Supplied role is not a role or snowflake."));if(e=Number(e),isNaN(e))return Promise.reject(new Error("Supplied position is not a number."));let n=this._sortedRoles.array();return h.moveElementInArray(n,t,e,i),n=n.map((t,e)=>({id:t.id,position:e})),this.client.rest.methods.setRolePositions(this.id,n)}setChannelPosition(t,e,i=false){if("string"==typeof t&&(t=this.channels.get(t),!t))return Promise.reject(new Error("Supplied channel is not a channel or snowflake."));if(e=Number(e),isNaN(e))return Promise.reject(new Error("Supplied position is not a number."));let n=this._sortedChannels(t.type).array();return h.moveElementInArray(n,t,e,i),n=n.map((t,e)=>({id:t.id,position:e})),this.client.rest.methods.setChannelPositions(this.id,n)}_sortedChannels(t){return this._sortPositionWithID(this.channels.filter(e=>{return"voice"===t&&"voice"===e.type||("voice"!==t&&"voice"!==e.type||t===e.type)}))}_sortPositionWithID(t){return t.sort((t,e)=>t.position!==e.position?t.position-e.position:n.fromString(t.id).sub(n.fromString(e.id)).toNumber())}}t.exports=d},function(t,e,i){const n=i(8),s=i(10),o=i(39),r=i(6),a=i(3);class c extends n{constructor(t,e){super(t.client,e),this.guild=t}setup(t){if(super.setup(t),this.name=t.name,this.position=t.position,this.permissionOverwrites=new a,t.permission_overwrites)for(const e of t.permission_overwrites)this.permissionOverwrites.set(e.id,new o(this,e))}get calculatedPosition(){const t=this.guild._sortedChannels(this.type);return t.array().indexOf(t.get(this.id))}permissionsFor(t){if(t=this.client.resolver.resolveGuildMember(this.guild,t),!t)return null;if(t.id===this.guild.ownerID)return new r(t,r.ALL);let e=0;const i=t.roles;for(const n of i.values())e|=n.permissions;const s=this.overwritesFor(t,!0,i);s.everyone&&(e&=~s.everyone.deny,e|=s.everyone.allow);let o=0;for(const a of s.roles)e&=~a.deny,o|=a.allow;e|=o,s.member&&(e&=~s.member.deny,e|=s.member.allow);const c=Boolean(e&r.FLAGS.ADMINISTRATOR);return c&&(e=r.ALL),new r(t,e)}overwritesFor(t,e=false,i=null){if(e||(t=this.client.resolver.resolveGuildMember(this.guild,t)),!t)return[];i=i||t.roles;const n=[];let s,o;for(const r of this.permissionOverwrites.values())r.id===this.guild.id?o=r:i.has(r.id)?n.push(r):r.id===t.id&&(s=r);return{everyone:o,roles:n,member:s}}overwritePermissions(t,e){const i={allow:0,deny:0};if(t instanceof s)i.type="role";else if(this.guild.roles.has(t))t=this.guild.roles.get(t),i.type="role";else if(t=this.client.resolver.resolveUser(t),i.type="member",!t)return Promise.reject(new TypeError("Supplied parameter was neither a User nor a Role."));i.id=t.id;const n=this.permissionOverwrites.get(t.id);n&&(i.allow=n.allow,i.deny=n.deny);for(const o in e)e[o]===!0?(i.allow|=r.FLAGS[o]||0,i.deny&=~(r.FLAGS[o]||0)):e[o]===!1?(i.allow&=~(r.FLAGS[o]||0),i.deny|=r.FLAGS[o]||0):null===e[o]&&(i.allow&=~(r.FLAGS[o]||0),i.deny&=~(r.FLAGS[o]||0));return this.client.rest.methods.setChannelOverwrite(this,i)}edit(t){return this.client.rest.methods.updateChannel(this,t)}setName(t){return this.edit({name:t})}setPosition(t,e){return this.guild.setChannelPosition(this,t,e).then(()=>this)}setTopic(t){return this.client.rest.methods.updateChannel(this,{topic:t})}createInvite(t={}){return this.client.rest.methods.createChannelInvite(this,t)}clone(t=this.name,e=true,i=true){return this.guild.createChannel(t,this.type,e?this.permissionOverwrites:[]).then(t=>i?t.setTopic(this.topic):t)}equals(t){let e=t&&this.id===t.id&&this.type===t.type&&this.topic===t.topic&&this.position===t.position&&this.name===t.name;return e&&(e=this.permissionOverwrites&&t.permissionOverwrites?this.permissionOverwrites.equals(t.permissionOverwrites):!this.permissionOverwrites&&!t.permissionOverwrites),e}get deletable(){return this.id!==this.guild.id&&this.permissionsFor(this.client.user).hasPermission(r.FLAGS.MANAGE_CHANNELS)}toString(){return`<#${this.id}>`}}t.exports=c},function(t,e,i){(function(t){function i(t,e){for(var i=0,n=t.length-1;n>=0;n--){var s=t[n];"."===s?t.splice(n,1):".."===s?(t.splice(n,1),i++):i&&(t.splice(n,1),i--)}if(e)for(;i--;i)t.unshift("..");return t}function n(t,e){if(t.filter)return t.filter(e);for(var i=[],n=0;n=-1&&!s;o--){var r=o>=0?arguments[o]:t.cwd();if("string"!=typeof r)throw new TypeError("Arguments to path.resolve must be strings");r&&(e=r+"/"+e,s="/"===r.charAt(0))}return e=i(n(e.split("/"),function(t){return!!t}),!s).join("/"),(s?"/":"")+e||"."},e.normalize=function(t){var s=e.isAbsolute(t),o="/"===r(t,-1);return t=i(n(t.split("/"),function(t){return!!t}),!s).join("/"),t||s||(t="."),t&&o&&(t+="/"),(s?"/":"")+t},e.isAbsolute=function(t){return"/"===t.charAt(0)},e.join=function(){var t=Array.prototype.slice.call(arguments,0);return e.normalize(n(t,function(t,e){if("string"!=typeof t)throw new TypeError("Arguments to path.join must be strings");return t}).join("/"))},e.relative=function(t,i){function n(t){for(var e=0;e=0&&""===t[i];i--);return e>i?[]:t.slice(e,i-e+1)}t=e.resolve(t).substr(1),i=e.resolve(i).substr(1);for(var s=n(t.split("/")),o=n(i.split("/")),r=Math.min(s.length,o.length),a=r,c=0;c1)for(var i=1;i[t.id,t.nick]))),this.recipients||(this.recipients=new o),t.recipients)for(const e of t.recipients){const t=this.client.dataManager.newUser(e);this.recipients.set(t.id,t)}this.lastMessageID=t.last_message_id}get owner(){return this.client.users.get(this.ownerID)}equals(t){const e=t&&this.id===t.id&&this.name===t.name&&this.icon===t.icon&&this.ownerID===t.ownerID;return e?this.recipients.equals(t.recipients):e}addUser(t,e){return this.client.rest.methods.addUserToGroupDM(this,{nick:e,id:this.client.resolver.resolveUserID(t),accessToken:t})}toString(){return this.name}send(){}sendMessage(){}sendEmbed(){}sendFile(){}sendFiles(){}sendCode(){}fetchMessage(){}fetchMessages(){}fetchPinnedMessages(){}search(){}startTyping(){}stopTyping(){}get typing(){}get typingCount(){}createCollector(){}awaitMessages(){}acknowledge(){}_cacheMessage(){}}s.applyToClass(r,!0,["bulkDelete"]),t.exports=r},function(t,e){class i{constructor(t,e,i){this.reaction=t,this.name=e,this.id=i}get identifier(){return this.id?`${this.name}:${this.id}`:encodeURIComponent(this.name)}toString(){return this.id?`<:${this.name}:${this.id}>`:this.name}}t.exports=i},function(t,e,i){const n=i(19);class s{constructor(t,e,i){t?(Object.defineProperty(this,"client",{value:t}),e&&this.setup(e)):(this.id=e,this.token=i,Object.defineProperty(this,"client",{value:this}))}setup(t){this.name=t.name, -this.token=t.token,this.avatar=t.avatar,this.id=t.id,this.guildID=t.guild_id,this.channelID=t.channel_id,t.user?this.owner=this.client.users?this.client.users.get(t.user.id):t.user:this.owner=null}send(t,e){return e||"object"!=typeof t||t instanceof Array?e||(e={}):(e=t,t=""),e.file?("string"==typeof e.file&&(e.file={attachment:e.file}),e.file.name||("string"==typeof e.file.attachment?e.file.name=n.basename(e.file.attachment):e.file.attachment&&e.file.attachment.path?e.file.name=n.basename(e.file.attachment.path):e.file.name="file.jpg"),this.client.resolver.resolveBuffer(e.file.attachment).then(i=>this.client.rest.methods.sendWebhookMessage(this,t,e,{file:i,name:e.file.name}))):this.client.rest.methods.sendWebhookMessage(this,t,e)}sendMessage(t,e={}){return this.send(t,e)}sendFile(t,e,i,n={}){return this.send(i,Object.assign(n,{file:{attachment:t,name:e}}))}sendCode(t,e,i={}){return this.send(e,Object.assign(i,{code:t}))}sendSlackMessage(t){return this.client.rest.methods.sendSlackWebhookMessage(this,t)}edit(t=this.name,e){return e?this.client.resolver.resolveBuffer(e).then(e=>{const i=this.client.resolver.resolveBase64(e);return this.client.rest.methods.editWebhook(this,t,i)}):this.client.rest.methods.editWebhook(this,t).then(t=>{return this.setup(t),this})}delete(){return this.client.rest.methods.deleteWebhook(this)}}t.exports=s},function(t,e){function i(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function n(t){return"function"==typeof t}function s(t){return"number"==typeof t}function o(t){return"object"==typeof t&&null!==t}function r(t){return void 0===t}t.exports=i,i.EventEmitter=i,i.prototype._events=void 0,i.prototype._maxListeners=void 0,i.defaultMaxListeners=10,i.prototype.setMaxListeners=function(t){if(!s(t)||t<0||isNaN(t))throw TypeError("n must be a positive number");return this._maxListeners=t,this},i.prototype.emit=function(t){var e,i,s,a,c,l;if(this._events||(this._events={}),"error"===t&&(!this._events.error||o(this._events.error)&&!this._events.error.length)){if(e=arguments[1],e instanceof Error)throw e;var u=new Error('Uncaught, unspecified "error" event. ('+e+")");throw u.context=e,u}if(i=this._events[t],r(i))return!1;if(n(i))switch(arguments.length){case 1:i.call(this);break;case 2:i.call(this,arguments[1]);break;case 3:i.call(this,arguments[1],arguments[2]);break;default:a=Array.prototype.slice.call(arguments,1),i.apply(this,a)}else if(o(i))for(a=Array.prototype.slice.call(arguments,1),l=i.slice(),s=l.length,c=0;c0&&this._events[t].length>s&&(this._events[t].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[t].length),"function"==typeof console.trace&&console.trace())),this},i.prototype.on=i.prototype.addListener,i.prototype.once=function(t,e){function i(){this.removeListener(t,i),s||(s=!0,e.apply(this,arguments))}if(!n(e))throw TypeError("listener must be a function");var s=!1;return i.listener=e,this.on(t,i),this},i.prototype.removeListener=function(t,e){var i,s,r,a;if(!n(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(i=this._events[t],r=i.length,s=-1,i===e||n(i.listener)&&i.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(o(i)){for(a=r;a-- >0;)if(i[a]===e||i[a].listener&&i[a].listener===e){s=a;break}if(s<0)return this;1===i.length?(i.length=0,delete this._events[t]):i.splice(s,1),this._events.removeListener&&this.emit("removeListener",t,e)}return this},i.prototype.removeAllListeners=function(t){var e,i;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[t]&&delete this._events[t],this;if(0===arguments.length){for(e in this._events)"removeListener"!==e&&this.removeAllListeners(e);return this.removeAllListeners("removeListener"),this._events={},this}if(i=this._events[t],n(i))this.removeListener(t,i);else if(i)for(;i.length;)this.removeListener(t,i[i.length-1]);return delete this._events[t],this},i.prototype.listeners=function(t){var e;return e=this._events&&this._events[t]?n(this._events[t])?[this._events[t]]:this._events[t].slice():[]},i.prototype.listenerCount=function(t){if(this._events){var e=this._events[t];if(n(e))return 1;if(e)return e.length}return 0},i.listenerCount=function(t,e){return t.listenerCount(e)}},function(t,e,i){var n,s,o;!function(i,r){s=[],n=r,o="function"==typeof n?n.apply(e,s):n,!(void 0!==o&&(t.exports=o))}(this,function(){"use strict";function t(t,e,i){this.low=0|t,this.high=0|e,this.unsigned=!!i}function e(t){return(t&&t.__isLong__)===!0}function i(t,e){var i,n,o;return e?(t>>>=0,(o=0<=t&&t<256)&&(n=c[t])?n:(i=s(t,(0|t)<0?-1:0,!0),o&&(c[t]=i),i)):(t|=0,(o=-128<=t&&t<128)&&(n=a[t])?n:(i=s(t,t<0?-1:0,!1),o&&(a[t]=i),i))}function n(t,e){if(isNaN(t)||!isFinite(t))return e?m:f;if(e){if(t<0)return m;if(t>=h)return b}else{if(t<=-p)return w;if(t+1>=p)return x}return t<0?n(-t,e).neg():s(t%4294967296|0,t/4294967296|0,e)}function s(e,i,n){return new t(e,i,n)}function o(t,e,i){if(0===t.length)throw Error("empty string");if("NaN"===t||"Infinity"===t||"+Infinity"===t||"-Infinity"===t)return f;if("number"==typeof e?(i=e,e=!1):e=!!e,i=i||10,i<2||360)throw Error("interior hyphen");if(0===s)return o(t.substring(1),e,i).neg();for(var r=n(l(i,8)),a=f,c=0;c>>0:this.low},_.toNumber=function(){return this.unsigned?4294967296*(this.high>>>0)+(this.low>>>0):4294967296*this.high+(this.low>>>0)},_.toString=function(t){if(t=t||10,t<2||36>>0,h=u.toString(t);if(r=c,r.isZero())return h+a;for(;h.length<6;)h="0"+h;a=""+h+a}},_.getHighBits=function(){return this.high},_.getHighBitsUnsigned=function(){return this.high>>>0},_.getLowBits=function(){return this.low},_.getLowBitsUnsigned=function(){return this.low>>>0},_.getNumBitsAbs=function(){if(this.isNegative())return this.eq(w)?64:this.neg().getNumBitsAbs();for(var 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=r(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=r(t)),this.eq(t))return 0;var i=this.isNegative(),n=t.isNegative();return i&&!n?-1:!i&&n?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(w)?w:this.not().add(g)},_.neg=_.negate,_.add=function(t){e(t)||(t=r(t));var i=this.high>>>16,n=65535&this.high,o=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+=o+u,d+=f>>>16,f&=65535,d+=n+l,p+=d>>>16,d&=65535,p+=i+c,p&=65535,s(f<<16|m,p<<16|d,this.unsigned)},_.subtract=function(t){return e(t)||(t=r(t)),this.add(t.neg())},_.sub=_.subtract,_.multiply=function(t){if(this.isZero())return f;if(e(t)||(t=r(t)),t.isZero())return f;if(this.eq(w))return t.isOdd()?w:f;if(t.eq(w))return this.isOdd()?w:f;if(this.isNegative())return t.isNegative()?this.neg().mul(t.neg()):this.neg().mul(t).neg();if(t.isNegative())return this.mul(t.neg()).neg();if(this.lt(d)&&t.lt(d))return n(this.toNumber()*t.toNumber(),this.unsigned);var i=this.high>>>16,o=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+=o*p,m+=g>>>16,g&=65535,g+=a*h,m+=g>>>16,g&=65535,g+=c*u,m+=g>>>16,g&=65535,m+=i*p+o*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=r(t)),t.isZero())throw Error("division by zero");if(this.isZero())return this.unsigned?m:f;var i,s,o;if(this.unsigned){if(t.unsigned||(t=t.toUnsigned()),t.gt(this))return m;if(t.gt(this.shru(1)))return v;o=m}else{if(this.eq(w)){if(t.eq(g)||t.eq(E))return w;if(t.eq(w))return g;var a=this.shr(1);return i=a.div(t).shl(1),i.eq(f)?t.isNegative()?g:E:(s=this.sub(t.mul(i)),o=i.add(s.div(t)))}if(t.eq(w))return this.unsigned?m:f;if(this.isNegative())return t.isNegative()?this.neg().div(t.neg()):this.neg().div(t).neg();if(t.isNegative())return this.div(t.neg()).neg();o=f}for(s=this;s.gte(t);){i=Math.max(1,Math.floor(s.toNumber()/t.toNumber()));for(var c=Math.ceil(Math.log(i)/Math.LN2),u=c<=48?1:l(2,c-48),h=n(i),p=h.mul(t);p.isNegative()||p.gt(s);)i-=u,h=n(i,this.unsigned),p=h.mul(t);h.isZero()&&(h=g),o=o.add(h),s=s.sub(p)}return o},_.div=_.divide,_.modulo=function(t){return e(t)||(t=r(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=r(t)),s(this.low&t.low,this.high&t.high,this.unsigned)},_.or=function(t){return e(t)||(t=r(t)),s(this.low|t.low,this.high|t.high,this.unsigned)},_.xor=function(t){return e(t)||(t=r(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()),t&=63,0===t)return this;var i=this.high;if(t<32){var n=this.low;return s(n>>>t|i<<32-t,i>>>t,this.unsigned)}return 32===t?s(i,0,this.unsigned):s(i>>>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,i){(function(e){function n(t){function i(t){const e=new ArrayBuffer(2*t.length),i=new Uint16Array(e);for(var n=0,s=t.length;nt.split("=")))e[i]=n;return e}const o="undefined"!=typeof window;let r,a;o?(r=window.fetch,a=window.FormData):(r=i(137),a=i(58));class c{constructor(t,e){this.url=e,this.method=t.toUpperCase(),this.headers={},this.data=null}set(t,e){return this.headers[t]=e,this}attach(t,e,i){const n=this._getFormData();return this.set("Content-Type",`multipart/form-data; boundary=${n.boundary}`),n.append(t,e,i),this.data=n,this}send(t){return"object"==typeof t?(this.set("Content-Type","application/json"),this.data=JSON.stringify(t)):this.data=t,this}end(t){let e={headers:{},text:"",body:{}};const i=this.data?this.data.end?this.data.end():this.data:null;return r(this.url,{method:this.method,headers:this.headers,body:i}).then(t=>{const i=t.headers.get("Content-Type");return i.includes("application/json")?t.text().then(i=>{return e.text=i,e.body=JSON.parse(i),t}):i.includes("application/x-www-form-urlencoded")?t.text().then(i=>{return e.text=i,e.body=s(i),t}):(o?t.arrayBuffer():t.buffer()).then(i=>{return i instanceof ArrayBuffer&&(i=n(i)),e.body=i,e.text=i.toString(),t})}).then(i=>{const{body,text}=e;if(Object.assign(e,i),e.body=body,e.text=text,i.headers.raw)for(const[n,s]of Object.entries(i.headers.raw()))e.headers[n]=s[0];else for(const[n,s]of i.headers.entries())e.headers[n]=s;return["4","5"].includes(e.status.toString().substr(0,1))?t(e,e):t(null,e)}).catch(e=>{t(e)})}then(t,e){return new Promise((i,n)=>{this.end((s,o)=>{s?n(e?e(s):s):i(t?t(o):o)})})}catch(t){return this.then(null,t)}_getFormData(){return this._formData||(this._formData=new a),this._formData}}const l=["GET","HEAD","POST","PUT","DELETE","CONNECT","OPTIONS","TRACE","PATCH","BREW"];for(const u of l)c[u.toLowerCase()]=(t=>new c(u,t));c.version=i(57).version,t.exports=c,o&&(window.Fetcher=c)}).call(e,i(14).Buffer)},function(t,e,i){(function(e){const n=i(19),s=i(42),o=i(26),r=i(0),a=i(4).convertToBuffer,c=i(11),l=i(9),u=i(17),h=i(8),p=i(13),d=i(12),f=i(22);class m{constructor(t){this.client=t}resolveUser(t){return t instanceof c?t:"string"==typeof t?this.client.users.get(t)||null:t instanceof p?t.user:t instanceof l?t.author:t instanceof u?t.owner:null}resolveUserID(t){return t instanceof c||t instanceof p?t.id:"string"==typeof t?t||null:t instanceof l?t.author.id:t instanceof u?t.ownerID:null}resolveGuild(t){return t instanceof u?t:"string"==typeof t?this.client.guilds.get(t)||null:null}resolveGuildMember(t,e){return e instanceof p?e:(t=this.resolveGuild(t),e=this.resolveUser(e),t&&e?t.members.get(e.id)||null:null)}resolveChannel(t){return t instanceof h?t:"string"==typeof t?this.client.channels.get(t)||null:t instanceof l?t.channel:t instanceof u?t.channels.get(t.id)||null:null}resolveChannelID(t){return t instanceof h?t.id:"string"==typeof t?t:t instanceof l?t.channel.id:t instanceof u?t.defaultChannel.id:null}resolveInviteCode(t){const e=/discord(?:app\.com\/invite|\.gg)\/([\w-]{2,255})/i,i=e.exec(t);return i&&i[1]?i[1]:t}resolveString(t){return"string"==typeof t?t:t instanceof Array?t.join("\n"):String(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(a(t)):"string"==typeof t?new Promise((i,r)=>{if(/^https?:\/\//.test(t))o.get(t).end((t,n)=>{return t?r(t):n.body instanceof e?i(n.body):r(new TypeError("The response body isn't a Buffer."))});else{const e=n.resolve(t);s.stat(e,(t,n)=>{return t?r(t):n&&n.isFile()?(s.readFile(e,(t,e)=>{t?r(t):i(e)}),null):r(new Error(`The file could not be found: ${e}`))})}}):Promise.reject(new TypeError("The resource must be a string or Buffer."))}resolveEmojiIdentifier(t){return t instanceof d||t instanceof f?t.identifier:"string"!=typeof t||t.includes("%")?null:encodeURIComponent(t)}static resolveColor(t){if("string"==typeof t){if("RANDOM"===t)return Math.floor(16777216*Math.random());t=r.Colors[t]||parseInt(t.replace("#",""),16)}else t instanceof Array&&(t=(t[0]<<16)+(t[1]<<8)+t[2]);if(t<0||t>16777215)throw new RangeError("Color must be within the range 0 - 16777215 (0xFFFFFF).");if(t&&isNaN(t))throw new TypeError("Unable to convert color to a number.");return t}resolveColor(t){return this.constructor.resolveColor(t)}}t.exports=m}).call(e,i(14).Buffer)},function(t,e){t.exports={name:"discord.js",version:"11.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:{"@types/node":"^7.0.0",long:"^3.2.0","prism-media":"hydrabolt/prism-media",snekfetch:"github:guscaplan/snekfetch",tweetnacl:"^0.14.0",ws:"^2.0.0"},peerDependencies:{bufferutil:"^2.0.0",erlpack:"hammerandchisel/erlpack","node-opus":"^0.2.0",opusscript:"^0.0.2",sodium:"^2.0.1",uws:"^0.14.1"},devDependencies:{"discord.js-docgen":"hydrabolt/discord.js-docgen",eslint:"^3.17.0","parallel-webpack":"^1.6.0","uglify-js":"mishoo/UglifyJS2#harmony",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,"node-fetch":!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,i){const n=i(11),s=i(3);class o extends n{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.settings={},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}edit(t){return this.client.rest.methods.updateCurrentUser(t)}setUsername(t,e){return this.client.rest.methods.updateCurrentUser({username:t},e)}setEmail(t,e){return this.client.rest.methods.updateCurrentUser({email:t},e)}setPassword(t,e){return this.client.rest.methods.updateCurrentUser({password:t},e)}setAvatar(t){return"string"==typeof t&&t.startsWith("data:")?this.client.rest.methods.updateCurrentUser({avatar:t}):this.client.resolver.resolveBuffer(t).then(t=>this.client.rest.methods.updateCurrentUser({avatar:t}))}setPresence(t){return new Promise(e=>{let i=this.localPresence.status||this.presence.status,n=this.localPresence.game,s=this.localPresence.afk||this.presence.afk;if(!n&&this.presence.game&&(n={name:this.presence.game.name,type:this.presence.game.type,url:this.presence.game.url}),t.status){if("string"!=typeof t.status)throw new TypeError("Status must be a string");i=t.status}t.game&&(n=t.game,n.url&&(n.type=1)),null===t.game&&(n=null),"undefined"!=typeof t.afk&&(s=t.afk),s=Boolean(s),this.localPresence={status:i,game:n,afk:s},this.localPresence.since=0,this.localPresence.game=this.localPresence.game||null,this.client.ws.send({op:3,d:this.localPresence}),this.client._setPresence(this.id,this.localPresence),e(this)})}setStatus(t){return this.setPresence({status:t})}setGame(t,e){return null===t?this.setPresence({game:t}):this.setPresence({game:{name:t,url:e}})}setAFK(t){return this.setPresence({afk:t})}fetchMentions(t={limit:25,roles:true,everyone:true,guild:null}){return this.client.rest.methods.fetchMentions(t)}addFriend(t){return t=this.client.resolver.resolveUser(t),this.client.rest.methods.addFriend(t)}removeFriend(t){return t=this.client.resolver.resolveUser(t),this.client.rest.methods.removeFriend(t)}createGuild(t,e,i=null){return i?"string"==typeof i&&i.startsWith("data:")?this.client.rest.methods.createGuild({name:t,icon:i,region:e}):this.client.resolver.resolveBuffer(i).then(i=>this.client.rest.methods.createGuild({name:t,icon:i,region:e})):this.client.rest.methods.createGuild({name:t,icon:i,region:e})}createGroupDM(t){return this.client.rest.methods.createGroupDM({recipients:t.map(t=>this.client.resolver.resolveUserID(t.user)),accessTokens:t.map(t=>t.accessToken),nicks:t.map(t=>t.nick)})}acceptInvite(t){return this.client.rest.methods.acceptInvite(t)}}t.exports=o},function(t,e,i){const n=i(8),s=i(15),o=i(3);class r extends n{constructor(t,e){super(t,e),this.type="dm",this.messages=new o,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(){}sendMessage(){}sendEmbed(){}sendFile(){}sendFiles(){}sendCode(){}fetchMessage(){}fetchMessages(){}fetchPinnedMessages(){}search(){}startTyping(){}stopTyping(){}get typing(){}get typingCount(){}createCollector(){}awaitMessages(){}acknowledge(){}_cacheMessage(){}}s.applyToClass(r,!0,["bulkDelete"]),t.exports=r},function(t,e,i){const n=i(37),s=i(38),o=i(0);class r{constructor(t,e){Object.defineProperty(this,"client",{value:t}),this.setup(e)}setup(t){this.guild=this.client.guilds.get(t.guild.id)||new n(this.client,t.guild),this.code=t.code,this.temporary=t.temporary,this.maxAge=t.max_age,this.uses=t.uses,this.maxUses=t.max_uses,t.inviter&&(this.inviter=this.client.dataManager.newUser(t.inviter)),this.channel=this.client.channels.get(t.channel.id)||new s(this.client,t.channel),this.createdTimestamp=new Date(t.created_at).getTime()}get createdAt(){return new Date(this.createdTimestamp)}get expiresTimestamp(){return this.createdTimestamp+1e3*this.maxAge}get expiresAt(){return new Date(this.expiresTimestamp)}get url(){return o.Endpoints.inviteLink(this.code)}delete(){return this.client.rest.methods.deleteInvite(this)}toString(){return this.url}}t.exports=r},function(t,e){class i{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=i},function(t,e,i){const n=i(24).EventEmitter,s=i(3);class o extends n{constructor(t,e,i={}){super(),this.channel=t,this.filter=e,this.options=i,this.ended=!1,this.collected=new s,this.listener=(t=>this.verify(t)),this.channel.client.on("message",this.listener),i.time&&this.channel.client.setTimeout(()=>this.stop("time"),i.time)}verify(t){return(!this.channel||this.channel.id===t.channel.id)&&(!!this.filter(t,this)&&(this.collected.set(t.id,t),this.emit("message",t,this),this.collected.size>=this.options.maxMatches?this.stop("matchesLimit"):this.options.max&&this.collected.size===this.options.max&&this.stop("limit"),!0))}get next(){return new Promise((t,e)=>{if(this.ended)return void e(this.collected);const i=()=>{this.removeListener("message",n),this.removeListener("end",s)},n=(...e)=>{i(),t(...e)},s=(...t)=>{i(),e(...t)};this.once("message",n),this.once("end",s)})}stop(t="user"){this.ended||(this.ended=!0,this.channel.client.removeListener("message",this.listener),this.emit("end",this.collected,t))}}t.exports=o},function(t,e){class i{constructor(t,e){Object.defineProperty(this,"client",{value:t.client}),this.message=t,this.setup(e)}setup(t){if(this.type=t.type,this.title=t.title,this.description=t.description,this.url=t.url,this.color=t.color,this.fields=[],t.fields)for(const e of t.fields)this.fields.push(new c(this,e));this.createdTimestamp=t.timestamp,this.thumbnail=t.thumbnail?new n(this,t.thumbnail):null,this.image=t.image?new s(this,t.image):null,this.video=t.video?new o(this,t.video):null,this.author=t.author?new a(this,t.author):null,this.provider=t.provider?new r(this,t.provider):null,this.footer=t.footer?new l(this,t.footer):null}get createdAt(){return new Date(this.createdTimestamp)}get hexColor(){let t=this.color.toString(16);for(;t.length<6;)t=`0${t}`;return`#${t}`}}class n{constructor(t,e){this.embed=t,this.setup(e)}setup(t){this.url=t.url,this.proxyURL=t.proxy_url,this.height=t.height,this.width=t.width}}class s{constructor(t,e){this.embed=t,this.setup(e)}setup(t){this.url=t.url,this.proxyURL=t.proxy_url,this.height=t.height,this.width=t.width}}class o{constructor(t,e){this.embed=t,this.setup(e)}setup(t){this.url=t.url,this.height=t.height,this.width=t.width}}class r{constructor(t,e){this.embed=t,this.setup(e)}setup(t){this.name=t.name,this.url=t.url}}class a{constructor(t,e){this.embed=t,this.setup(e)}setup(t){this.name=t.name,this.url=t.url,this.iconURL=t.icon_url}}class c{constructor(t,e){this.embed=t,this.setup(e)}setup(t){this.name=t.name,this.value=t.value,this.inline=t.inline}}class l{constructor(t,e){this.embed=t,this.setup(e)}setup(t){this.text=t.text,this.iconURL=t.icon_url,this.proxyIconUrl=t.proxy_icon_url}}i.Thumbnail=n,i.Image=s,i.Video=o,i.Provider=r,i.Author=a,i.Field=c,i.Footer=l,t.exports=i},function(t,e,i){const n=i(3),s=i(12),o=i(22);class r{constructor(t,e,i,s){this.message=t,this.me=s,this.count=i||0,this.users=new n,this._emoji=new o(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;return t=this.message.client.resolver.resolveUserID(t),t?e.client.rest.methods.removeMessageReaction(e,this.emoji.identifier,t):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.rest.methods.getMessageReactionUsers(e,this.emoji.identifier,t).then(t=>{this.users=new n;for(const e of t){const t=this.message.client.dataManager.newUser(e);this.users.set(t.id,t)}return this.count=this.users.size,this.users})}}t.exports=r},function(t,e,i){const n=i(5);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.description=t.description,this.icon=t.icon,this.iconURL=`https://cdn.discordapp.com/app-icons/${this.id}/${this.icon}.jpg`,this.rpcOrigins=t.rpc_origins,this.redirectURIs=t.redirect_uris,this.botRequireCodeGrant=t.bot_require_code_grant,this.botPublic=t.bot_public,this.rpcApplicationState=t.rpc_application_state,this.bot=t.bot,this.flags=t.flags,this.secret=t.secret}get createdTimestamp(){return n.deconstruct(this.id).timestamp}get createdAt(){return new Date(this.createdTimestamp)}reset(){return this.client.rest.methods.resetApplication(this.id)}toString(){return this.name}}t.exports=s},function(t,e){class i{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=i},function(t,e,i){const n=i(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=n.ChannelTypes.TEXT===t.type?"text":"voice"}}t.exports=s},function(t,e){class i{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(){return this.channel.client.rest.methods.deletePermissionOverwrites(this)}}t.exports=i},function(t,e,i){const n=i(18),s=i(15),o=i(3);class r extends n{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).hasPermission("READ_MESSAGES")&&t.set(e.id,e);return t}fetchWebhooks(){return this.client.rest.methods.getChannelWebhooks(this)}createWebhook(t,e){return new Promise(i=>{"string"==typeof e&&e.startsWith("data:")?i(this.client.rest.methods.createWebhook(this,t,e)):this.client.resolver.resolveBuffer(e).then(e=>i(this.client.rest.methods.createWebhook(this,t,e)))})}send(){}sendMessage(){}sendEmbed(){}sendFile(){}sendFiles(){}sendCode(){}fetchMessage(){}fetchMessages(){}fetchPinnedMessages(){}search(){}startTyping(){}stopTyping(){}get typing(){}get typingCount(){}createCollector(){}awaitMessages(){}bulkDelete(){}acknowledge(){}_cacheMessage(){}}s.applyToClass(r,!0),t.exports=r},function(t,e,i){const n=i(18),s=i(3);class o extends n{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).hasPermission("CONNECT")&&!(this.full&&!this.permissionsFor(this.client.user).hasPermission("MOVE_MEMBERS")))}get speakable(){return this.permissionsFor(this.client.user).hasPermission("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=o},function(t,e){},function(t,e,i){const n=i(97),s=i(94),o=i(96),r=i(95),a=i(93),c=i(0);class l{constructor(t){this.client=t,this.handlers={},this.userAgentManager=new n(this),this.methods=new s(this),this.rateLimitedEndpoints={},this.globallyRateLimited=!1}push(t,e){return new Promise((i,n)=>{t.push({request:e,resolve:i,reject:n})})}getRequestHandler(){switch(this.client.options.apiRequestMethod){case"sequential":return o;case"burst":return r;default:throw new Error(c.Errors.INVALID_RATE_LIMIT_METHOD)}}makeRequest(t,e,i,n,s){const o=new a(this,t,e,i,n,s);if(!this.handlers[o.route]){const t=this.getRequestHandler();this.handlers[o.route]=new t(this,o.route)}return this.push(this.handlers[o.route],o)}}t.exports=l},function(t,e){class i{constructor(t){this.restManager=t,this.queue=[]}get globalLimit(){return this.restManager.globallyRateLimited}set globalLimit(t){this.restManager.globallyRateLimited=t; +this.token=t.token,this.avatar=t.avatar,this.id=t.id,this.guildID=t.guild_id,this.channelID=t.channel_id,t.user?this.owner=this.client.users?this.client.users.get(t.user.id):t.user:this.owner=null}send(t,e){return e||"object"!=typeof t||t instanceof Array?e||(e={}):(e=t,t=""),e.file?("string"==typeof e.file&&(e.file={attachment:e.file}),e.file.name||("string"==typeof e.file.attachment?e.file.name=n.basename(e.file.attachment):e.file.attachment&&e.file.attachment.path?e.file.name=n.basename(e.file.attachment.path):e.file.name="file.jpg"),this.client.resolver.resolveBuffer(e.file.attachment).then(i=>this.client.rest.methods.sendWebhookMessage(this,t,e,{file:i,name:e.file.name}))):this.client.rest.methods.sendWebhookMessage(this,t,e)}sendMessage(t,e={}){return this.send(t,e)}sendFile(t,e,i,n={}){return this.send(i,Object.assign(n,{file:{attachment:t,name:e}}))}sendCode(t,e,i={}){return this.send(e,Object.assign(i,{code:t}))}sendSlackMessage(t){return this.client.rest.methods.sendSlackWebhookMessage(this,t)}edit(t=this.name,e){return e?this.client.resolver.resolveBuffer(e).then(e=>{const i=this.client.resolver.resolveBase64(e);return this.client.rest.methods.editWebhook(this,t,i)}):this.client.rest.methods.editWebhook(this,t).then(t=>{return this.setup(t),this})}delete(){return this.client.rest.methods.deleteWebhook(this)}}t.exports=s},function(t,e){function i(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function n(t){return"function"==typeof t}function s(t){return"number"==typeof t}function o(t){return"object"==typeof t&&null!==t}function r(t){return void 0===t}t.exports=i,i.EventEmitter=i,i.prototype._events=void 0,i.prototype._maxListeners=void 0,i.defaultMaxListeners=10,i.prototype.setMaxListeners=function(t){if(!s(t)||t<0||isNaN(t))throw TypeError("n must be a positive number");return this._maxListeners=t,this},i.prototype.emit=function(t){var e,i,s,a,c,l;if(this._events||(this._events={}),"error"===t&&(!this._events.error||o(this._events.error)&&!this._events.error.length)){if(e=arguments[1],e instanceof Error)throw e;var u=new Error('Uncaught, unspecified "error" event. ('+e+")");throw u.context=e,u}if(i=this._events[t],r(i))return!1;if(n(i))switch(arguments.length){case 1:i.call(this);break;case 2:i.call(this,arguments[1]);break;case 3:i.call(this,arguments[1],arguments[2]);break;default:a=Array.prototype.slice.call(arguments,1),i.apply(this,a)}else if(o(i))for(a=Array.prototype.slice.call(arguments,1),l=i.slice(),s=l.length,c=0;c0&&this._events[t].length>s&&(this._events[t].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[t].length),"function"==typeof console.trace&&console.trace())),this},i.prototype.on=i.prototype.addListener,i.prototype.once=function(t,e){function i(){this.removeListener(t,i),s||(s=!0,e.apply(this,arguments))}if(!n(e))throw TypeError("listener must be a function");var s=!1;return i.listener=e,this.on(t,i),this},i.prototype.removeListener=function(t,e){var i,s,r,a;if(!n(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(i=this._events[t],r=i.length,s=-1,i===e||n(i.listener)&&i.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(o(i)){for(a=r;a-- >0;)if(i[a]===e||i[a].listener&&i[a].listener===e){s=a;break}if(s<0)return this;1===i.length?(i.length=0,delete this._events[t]):i.splice(s,1),this._events.removeListener&&this.emit("removeListener",t,e)}return this},i.prototype.removeAllListeners=function(t){var e,i;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[t]&&delete this._events[t],this;if(0===arguments.length){for(e in this._events)"removeListener"!==e&&this.removeAllListeners(e);return this.removeAllListeners("removeListener"),this._events={},this}if(i=this._events[t],n(i))this.removeListener(t,i);else if(i)for(;i.length;)this.removeListener(t,i[i.length-1]);return delete this._events[t],this},i.prototype.listeners=function(t){var e;return e=this._events&&this._events[t]?n(this._events[t])?[this._events[t]]:this._events[t].slice():[]},i.prototype.listenerCount=function(t){if(this._events){var e=this._events[t];if(n(e))return 1;if(e)return e.length}return 0},i.listenerCount=function(t,e){return t.listenerCount(e)}},function(t,e,i){var n,s,o;!function(i,r){s=[],n=r,o="function"==typeof n?n.apply(e,s):n,!(void 0!==o&&(t.exports=o))}(this,function(){"use strict";function t(t,e,i){this.low=0|t,this.high=0|e,this.unsigned=!!i}function e(t){return(t&&t.__isLong__)===!0}function i(t,e){var i,n,o;return e?(t>>>=0,(o=0<=t&&t<256)&&(n=c[t])?n:(i=s(t,(0|t)<0?-1:0,!0),o&&(c[t]=i),i)):(t|=0,(o=-128<=t&&t<128)&&(n=a[t])?n:(i=s(t,t<0?-1:0,!1),o&&(a[t]=i),i))}function n(t,e){if(isNaN(t)||!isFinite(t))return e?m:f;if(e){if(t<0)return m;if(t>=h)return b}else{if(t<=-p)return w;if(t+1>=p)return x}return t<0?n(-t,e).neg():s(t%4294967296|0,t/4294967296|0,e)}function s(e,i,n){return new t(e,i,n)}function o(t,e,i){if(0===t.length)throw Error("empty string");if("NaN"===t||"Infinity"===t||"+Infinity"===t||"-Infinity"===t)return f;if("number"==typeof e?(i=e,e=!1):e=!!e,i=i||10,i<2||360)throw Error("interior hyphen");if(0===s)return o(t.substring(1),e,i).neg();for(var r=n(l(i,8)),a=f,c=0;c>>0:this.low},_.toNumber=function(){return this.unsigned?4294967296*(this.high>>>0)+(this.low>>>0):4294967296*this.high+(this.low>>>0)},_.toString=function(t){if(t=t||10,t<2||36>>0,h=u.toString(t);if(r=c,r.isZero())return h+a;for(;h.length<6;)h="0"+h;a=""+h+a}},_.getHighBits=function(){return this.high},_.getHighBitsUnsigned=function(){return this.high>>>0},_.getLowBits=function(){return this.low},_.getLowBitsUnsigned=function(){return this.low>>>0},_.getNumBitsAbs=function(){if(this.isNegative())return this.eq(w)?64:this.neg().getNumBitsAbs();for(var 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=r(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=r(t)),this.eq(t))return 0;var i=this.isNegative(),n=t.isNegative();return i&&!n?-1:!i&&n?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(w)?w:this.not().add(g)},_.neg=_.negate,_.add=function(t){e(t)||(t=r(t));var i=this.high>>>16,n=65535&this.high,o=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+=o+u,d+=f>>>16,f&=65535,d+=n+l,p+=d>>>16,d&=65535,p+=i+c,p&=65535,s(f<<16|m,p<<16|d,this.unsigned)},_.subtract=function(t){return e(t)||(t=r(t)),this.add(t.neg())},_.sub=_.subtract,_.multiply=function(t){if(this.isZero())return f;if(e(t)||(t=r(t)),t.isZero())return f;if(this.eq(w))return t.isOdd()?w:f;if(t.eq(w))return this.isOdd()?w:f;if(this.isNegative())return t.isNegative()?this.neg().mul(t.neg()):this.neg().mul(t).neg();if(t.isNegative())return this.mul(t.neg()).neg();if(this.lt(d)&&t.lt(d))return n(this.toNumber()*t.toNumber(),this.unsigned);var i=this.high>>>16,o=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+=o*p,m+=g>>>16,g&=65535,g+=a*h,m+=g>>>16,g&=65535,g+=c*u,m+=g>>>16,g&=65535,m+=i*p+o*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=r(t)),t.isZero())throw Error("division by zero");if(this.isZero())return this.unsigned?m:f;var i,s,o;if(this.unsigned){if(t.unsigned||(t=t.toUnsigned()),t.gt(this))return m;if(t.gt(this.shru(1)))return v;o=m}else{if(this.eq(w)){if(t.eq(g)||t.eq(E))return w;if(t.eq(w))return g;var a=this.shr(1);return i=a.div(t).shl(1),i.eq(f)?t.isNegative()?g:E:(s=this.sub(t.mul(i)),o=i.add(s.div(t)))}if(t.eq(w))return this.unsigned?m:f;if(this.isNegative())return t.isNegative()?this.neg().div(t.neg()):this.neg().div(t).neg();if(t.isNegative())return this.div(t.neg()).neg();o=f}for(s=this;s.gte(t);){i=Math.max(1,Math.floor(s.toNumber()/t.toNumber()));for(var c=Math.ceil(Math.log(i)/Math.LN2),u=c<=48?1:l(2,c-48),h=n(i),p=h.mul(t);p.isNegative()||p.gt(s);)i-=u,h=n(i,this.unsigned),p=h.mul(t);h.isZero()&&(h=g),o=o.add(h),s=s.sub(p)}return o},_.div=_.divide,_.modulo=function(t){return e(t)||(t=r(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=r(t)),s(this.low&t.low,this.high&t.high,this.unsigned)},_.or=function(t){return e(t)||(t=r(t)),s(this.low|t.low,this.high|t.high,this.unsigned)},_.xor=function(t){return e(t)||(t=r(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()),t&=63,0===t)return this;var i=this.high;if(t<32){var n=this.low;return s(n>>>t|i<<32-t,i>>>t,this.unsigned)}return 32===t?s(i,0,this.unsigned):s(i>>>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,i){(function(e){function n(t){function i(t){const e=new ArrayBuffer(2*t.length),i=new Uint16Array(e);for(var n=0,s=t.length;nt.split("=")))e[i]=n;return e}const o="undefined"!=typeof window;let r,a;o?(r=window.fetch,a=window.FormData):(r=i(137),a=i(58));class c{constructor(t,e){this.url=e,this.method=t.toUpperCase(),this.headers={},this.data=null}set(t,e){return this.headers[t]=e,this}attach(t,e,i){const n=this._getFormData();return this.set("Content-Type",`multipart/form-data; boundary=${n.boundary}`),n.append(t,e,i),this.data=n,this}send(t){return"object"==typeof t?(this.set("Content-Type","application/json"),this.data=JSON.stringify(t)):this.data=t,this}end(t){let e={headers:{},text:"",body:{}};const i=this.data?this.data.end?this.data.end():this.data:null;return r(this.url,{method:this.method,headers:this.headers,body:i}).then(t=>{const i=t.headers.get("Content-Type");return i.includes("application/json")?t.text().then(i=>{return e.text=i,e.body=JSON.parse(i),t}):i.includes("application/x-www-form-urlencoded")?t.text().then(i=>{return e.text=i,e.body=s(i),t}):(o?t.arrayBuffer():t.buffer()).then(i=>{return i instanceof ArrayBuffer&&(i=n(i)),e.body=i,e.text=i.toString(),t})}).then(i=>{const{body,text}=e;if(Object.assign(e,i),e.body=body,e.text=text,i.headers.raw)for(const[n,s]of Object.entries(i.headers.raw()))e.headers[n]=s[0];else for(const[n,s]of i.headers.entries())e.headers[n]=s;return["4","5"].includes(e.status.toString().substr(0,1))?t(e,e):t(null,e)}).catch(e=>{t(e)})}then(t,e){return new Promise((i,n)=>{this.end((s,o)=>{s?n(e?e(s):s):i(t?t(o):o)})})}catch(t){return this.then(null,t)}_getFormData(){return this._formData||(this._formData=new a),this._formData}}const l=["GET","HEAD","POST","PUT","DELETE","CONNECT","OPTIONS","TRACE","PATCH","BREW"];for(const u of l)c[u.toLowerCase()]=(t=>new c(u,t));c.version=i(57).version,t.exports=c,o&&(window.Fetcher=c)}).call(e,i(14).Buffer)},function(t,e,i){(function(e){const n=i(19),s=i(42),o=i(26),r=i(0),a=i(4).convertToBuffer,c=i(11),l=i(9),u=i(17),h=i(8),p=i(13),d=i(12),f=i(22);class m{constructor(t){this.client=t}resolveUser(t){return t instanceof c?t:"string"==typeof t?this.client.users.get(t)||null:t instanceof p?t.user:t instanceof l?t.author:t instanceof u?t.owner:null}resolveUserID(t){return t instanceof c||t instanceof p?t.id:"string"==typeof t?t||null:t instanceof l?t.author.id:t instanceof u?t.ownerID:null}resolveGuild(t){return t instanceof u?t:"string"==typeof t?this.client.guilds.get(t)||null:null}resolveGuildMember(t,e){return e instanceof p?e:(t=this.resolveGuild(t),e=this.resolveUser(e),t&&e?t.members.get(e.id)||null:null)}resolveChannel(t){return t instanceof h?t:"string"==typeof t?this.client.channels.get(t)||null:t instanceof l?t.channel:t instanceof u?t.channels.get(t.id)||null:null}resolveChannelID(t){return t instanceof h?t.id:"string"==typeof t?t:t instanceof l?t.channel.id:t instanceof u?t.defaultChannel.id:null}resolveInviteCode(t){const e=/discord(?:app\.com\/invite|\.gg)\/([\w-]{2,255})/i,i=e.exec(t);return i&&i[1]?i[1]:t}resolveString(t){return"string"==typeof t?t:t instanceof Array?t.join("\n"):String(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(a(t)):"string"==typeof t?new Promise((i,r)=>{if(/^https?:\/\//.test(t))o.get(t).end((t,n)=>{return t?r(t):n.body instanceof e?i(n.body):r(new TypeError("The response body isn't a Buffer."))});else{const e=n.resolve(t);s.stat(e,(t,n)=>{return t?r(t):n&&n.isFile()?(s.readFile(e,(t,e)=>{t?r(t):i(e)}),null):r(new Error(`The file could not be found: ${e}`))})}}):Promise.reject(new TypeError("The resource must be a string or Buffer."))}resolveEmojiIdentifier(t){return t instanceof d||t instanceof f?t.identifier:"string"!=typeof t||t.includes("%")?null:encodeURIComponent(t)}static resolveColor(t){if("string"==typeof t){if("RANDOM"===t)return Math.floor(16777216*Math.random());t=r.Colors[t]||parseInt(t.replace("#",""),16)}else t instanceof Array&&(t=(t[0]<<16)+(t[1]<<8)+t[2]);if(t<0||t>16777215)throw new RangeError("Color must be within the range 0 - 16777215 (0xFFFFFF).");if(t&&isNaN(t))throw new TypeError("Unable to convert color to a number.");return t}resolveColor(t){return this.constructor.resolveColor(t)}}t.exports=m}).call(e,i(14).Buffer)},function(t,e){t.exports={name:"discord.js",version:"11.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:{"@types/node":"^7.0.0",long:"^3.2.0","prism-media":"hydrabolt/prism-media",snekfetch:"github:guscaplan/snekfetch",tweetnacl:"^0.14.0",ws:"^2.0.0"},peerDependencies:{bufferutil:"^2.0.0",erlpack:"hammerandchisel/erlpack","node-opus":"^0.2.5",opusscript:"^0.0.3",sodium:"^2.0.1",uws:"^0.14.1"},devDependencies:{"discord.js-docgen":"hydrabolt/discord.js-docgen",eslint:"^3.17.0","parallel-webpack":"^1.6.0","uglify-js":"mishoo/UglifyJS2#harmony",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,"node-fetch":!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,i){const n=i(11),s=i(3);class o extends n{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.settings={},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}edit(t){return this.client.rest.methods.updateCurrentUser(t)}setUsername(t,e){return this.client.rest.methods.updateCurrentUser({username:t},e)}setEmail(t,e){return this.client.rest.methods.updateCurrentUser({email:t},e)}setPassword(t,e){return this.client.rest.methods.updateCurrentUser({password:t},e)}setAvatar(t){return"string"==typeof t&&t.startsWith("data:")?this.client.rest.methods.updateCurrentUser({avatar:t}):this.client.resolver.resolveBuffer(t).then(t=>this.client.rest.methods.updateCurrentUser({avatar:t}))}setPresence(t){return new Promise(e=>{let i=this.localPresence.status||this.presence.status,n=this.localPresence.game,s=this.localPresence.afk||this.presence.afk;if(!n&&this.presence.game&&(n={name:this.presence.game.name,type:this.presence.game.type,url:this.presence.game.url}),t.status){if("string"!=typeof t.status)throw new TypeError("Status must be a string");i=t.status}t.game&&(n=t.game,n.url&&(n.type=1)),null===t.game&&(n=null),"undefined"!=typeof t.afk&&(s=t.afk),s=Boolean(s),this.localPresence={status:i,game:n,afk:s},this.localPresence.since=0,this.localPresence.game=this.localPresence.game||null,this.client.ws.send({op:3,d:this.localPresence}),this.client._setPresence(this.id,this.localPresence),e(this)})}setStatus(t){return this.setPresence({status:t})}setGame(t,e){return null===t?this.setPresence({game:t}):this.setPresence({game:{name:t,url:e}})}setAFK(t){return this.setPresence({afk:t})}fetchMentions(t={limit:25,roles:true,everyone:true,guild:null}){return this.client.rest.methods.fetchMentions(t)}addFriend(t){return t=this.client.resolver.resolveUser(t),this.client.rest.methods.addFriend(t)}removeFriend(t){return t=this.client.resolver.resolveUser(t),this.client.rest.methods.removeFriend(t)}createGuild(t,e,i=null){return i?"string"==typeof i&&i.startsWith("data:")?this.client.rest.methods.createGuild({name:t,icon:i,region:e}):this.client.resolver.resolveBuffer(i).then(i=>this.client.rest.methods.createGuild({name:t,icon:i,region:e})):this.client.rest.methods.createGuild({name:t,icon:i,region:e})}createGroupDM(t){return this.client.rest.methods.createGroupDM({recipients:t.map(t=>this.client.resolver.resolveUserID(t.user)),accessTokens:t.map(t=>t.accessToken),nicks:t.map(t=>t.nick)})}acceptInvite(t){return this.client.rest.methods.acceptInvite(t)}}t.exports=o},function(t,e,i){const n=i(8),s=i(15),o=i(3);class r extends n{constructor(t,e){super(t,e),this.type="dm",this.messages=new o,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(){}sendMessage(){}sendEmbed(){}sendFile(){}sendFiles(){}sendCode(){}fetchMessage(){}fetchMessages(){}fetchPinnedMessages(){}search(){}startTyping(){}stopTyping(){}get typing(){}get typingCount(){}createCollector(){}awaitMessages(){}acknowledge(){}_cacheMessage(){}}s.applyToClass(r,!0,["bulkDelete"]),t.exports=r},function(t,e,i){const n=i(37),s=i(38),o=i(0);class r{constructor(t,e){Object.defineProperty(this,"client",{value:t}),this.setup(e)}setup(t){this.guild=this.client.guilds.get(t.guild.id)||new n(this.client,t.guild),this.code=t.code,this.temporary=t.temporary,this.maxAge=t.max_age,this.uses=t.uses,this.maxUses=t.max_uses,t.inviter&&(this.inviter=this.client.dataManager.newUser(t.inviter)),this.channel=this.client.channels.get(t.channel.id)||new s(this.client,t.channel),this.createdTimestamp=new Date(t.created_at).getTime()}get createdAt(){return new Date(this.createdTimestamp)}get expiresTimestamp(){return this.createdTimestamp+1e3*this.maxAge}get expiresAt(){return new Date(this.expiresTimestamp)}get url(){return o.Endpoints.inviteLink(this.code)}delete(){return this.client.rest.methods.deleteInvite(this)}toString(){return this.url}}t.exports=r},function(t,e){class i{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=i},function(t,e,i){const n=i(24).EventEmitter,s=i(3);class o extends n{constructor(t,e,i={}){super(),this.channel=t,this.filter=e,this.options=i,this.ended=!1,this.collected=new s,this.listener=(t=>this.verify(t)),this.channel.client.on("message",this.listener),i.time&&this.channel.client.setTimeout(()=>this.stop("time"),i.time)}verify(t){return(!this.channel||this.channel.id===t.channel.id)&&(!!this.filter(t,this)&&(this.collected.set(t.id,t),this.emit("message",t,this),this.collected.size>=this.options.maxMatches?this.stop("matchesLimit"):this.options.max&&this.collected.size===this.options.max&&this.stop("limit"),!0))}get next(){return new Promise((t,e)=>{if(this.ended)return void e(this.collected);const i=()=>{this.removeListener("message",n),this.removeListener("end",s)},n=(...e)=>{i(),t(...e)},s=(...t)=>{i(),e(...t)};this.once("message",n),this.once("end",s)})}stop(t="user"){this.ended||(this.ended=!0,this.channel.client.removeListener("message",this.listener),this.emit("end",this.collected,t))}}t.exports=o},function(t,e){class i{constructor(t,e){Object.defineProperty(this,"client",{value:t.client}),this.message=t,this.setup(e)}setup(t){if(this.type=t.type,this.title=t.title,this.description=t.description,this.url=t.url,this.color=t.color,this.fields=[],t.fields)for(const e of t.fields)this.fields.push(new c(this,e));this.createdTimestamp=t.timestamp,this.thumbnail=t.thumbnail?new n(this,t.thumbnail):null,this.image=t.image?new s(this,t.image):null,this.video=t.video?new o(this,t.video):null,this.author=t.author?new a(this,t.author):null,this.provider=t.provider?new r(this,t.provider):null,this.footer=t.footer?new l(this,t.footer):null}get createdAt(){return new Date(this.createdTimestamp)}get hexColor(){let t=this.color.toString(16);for(;t.length<6;)t=`0${t}`;return`#${t}`}}class n{constructor(t,e){this.embed=t,this.setup(e)}setup(t){this.url=t.url,this.proxyURL=t.proxy_url,this.height=t.height,this.width=t.width}}class s{constructor(t,e){this.embed=t,this.setup(e)}setup(t){this.url=t.url,this.proxyURL=t.proxy_url,this.height=t.height,this.width=t.width}}class o{constructor(t,e){this.embed=t,this.setup(e)}setup(t){this.url=t.url,this.height=t.height,this.width=t.width}}class r{constructor(t,e){this.embed=t,this.setup(e)}setup(t){this.name=t.name,this.url=t.url}}class a{constructor(t,e){this.embed=t,this.setup(e)}setup(t){this.name=t.name,this.url=t.url,this.iconURL=t.icon_url}}class c{constructor(t,e){this.embed=t,this.setup(e)}setup(t){this.name=t.name,this.value=t.value,this.inline=t.inline}}class l{constructor(t,e){this.embed=t,this.setup(e)}setup(t){this.text=t.text,this.iconURL=t.icon_url,this.proxyIconUrl=t.proxy_icon_url}}i.Thumbnail=n,i.Image=s,i.Video=o,i.Provider=r,i.Author=a,i.Field=c,i.Footer=l,t.exports=i},function(t,e,i){const n=i(3),s=i(12),o=i(22);class r{constructor(t,e,i,s){this.message=t,this.me=s,this.count=i||0,this.users=new n,this._emoji=new o(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;return t=this.message.client.resolver.resolveUserID(t),t?e.client.rest.methods.removeMessageReaction(e,this.emoji.identifier,t):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.rest.methods.getMessageReactionUsers(e,this.emoji.identifier,t).then(t=>{this.users=new n;for(const e of t){const t=this.message.client.dataManager.newUser(e);this.users.set(t.id,t)}return this.count=this.users.size,this.users})}}t.exports=r},function(t,e,i){const n=i(5);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.description=t.description,this.icon=t.icon,this.iconURL=`https://cdn.discordapp.com/app-icons/${this.id}/${this.icon}.jpg`,this.rpcOrigins=t.rpc_origins,this.redirectURIs=t.redirect_uris,this.botRequireCodeGrant=t.bot_require_code_grant,this.botPublic=t.bot_public,this.rpcApplicationState=t.rpc_application_state,this.bot=t.bot,this.flags=t.flags,this.secret=t.secret}get createdTimestamp(){return n.deconstruct(this.id).timestamp}get createdAt(){return new Date(this.createdTimestamp)}reset(){return this.client.rest.methods.resetApplication(this.id)}toString(){return this.name}}t.exports=s},function(t,e){class i{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=i},function(t,e,i){const n=i(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=n.ChannelTypes.TEXT===t.type?"text":"voice"}}t.exports=s},function(t,e){class i{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(){return this.channel.client.rest.methods.deletePermissionOverwrites(this)}}t.exports=i},function(t,e,i){const n=i(18),s=i(15),o=i(3);class r extends n{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).hasPermission("READ_MESSAGES")&&t.set(e.id,e);return t}fetchWebhooks(){return this.client.rest.methods.getChannelWebhooks(this)}createWebhook(t,e){return new Promise(i=>{"string"==typeof e&&e.startsWith("data:")?i(this.client.rest.methods.createWebhook(this,t,e)):this.client.resolver.resolveBuffer(e).then(e=>i(this.client.rest.methods.createWebhook(this,t,e)))})}send(){}sendMessage(){}sendEmbed(){}sendFile(){}sendFiles(){}sendCode(){}fetchMessage(){}fetchMessages(){}fetchPinnedMessages(){}search(){}startTyping(){}stopTyping(){}get typing(){}get typingCount(){}createCollector(){}awaitMessages(){}bulkDelete(){}acknowledge(){}_cacheMessage(){}}s.applyToClass(r,!0),t.exports=r},function(t,e,i){const n=i(18),s=i(3);class o extends n{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).hasPermission("CONNECT")&&!(this.full&&!this.permissionsFor(this.client.user).hasPermission("MOVE_MEMBERS")))}get speakable(){return this.permissionsFor(this.client.user).hasPermission("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=o},function(t,e){},function(t,e,i){const n=i(97),s=i(94),o=i(96),r=i(95),a=i(93),c=i(0);class l{constructor(t){this.client=t,this.handlers={},this.userAgentManager=new n(this),this.methods=new s(this),this.rateLimitedEndpoints={},this.globallyRateLimited=!1}push(t,e){return new Promise((i,n)=>{t.push({request:e,resolve:i,reject:n})})}getRequestHandler(){switch(this.client.options.apiRequestMethod){case"sequential":return o;case"burst":return r;default:throw new Error(c.Errors.INVALID_RATE_LIMIT_METHOD)}}makeRequest(t,e,i,n,s){const o=new a(this,t,e,i,n,s);if(!this.handlers[o.route]){const t=this.getRequestHandler();this.handlers[o.route]=new t(this,o.route)}return this.push(this.handlers[o.route],o)}}t.exports=l},function(t,e){class i{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(){}}t.exports=i},function(module,exports,__webpack_require__){(function(process){const os=__webpack_require__(16),EventEmitter=__webpack_require__(24).EventEmitter,Constants=__webpack_require__(0),Permissions=__webpack_require__(6),Util=__webpack_require__(4),RESTManager=__webpack_require__(43),ClientDataManager=__webpack_require__(63),ClientManager=__webpack_require__(64),ClientDataResolver=__webpack_require__(27),ClientVoiceManager=__webpack_require__(139),WebSocketManager=__webpack_require__(98),ActionsManager=__webpack_require__(65),Collection=__webpack_require__(3),Presence=__webpack_require__(7).Presence,ShardClientUtil=__webpack_require__(138),VoiceBroadcast=__webpack_require__(140);class Client extends EventEmitter{constructor(t={}){super(),!t.shardId&&"SHARD_ID"in process.env&&(t.shardId=Number(process.env.SHARD_ID)),!t.shardCount&&"SHARD_COUNT"in process.env&&(t.shardCount=Number(process.env.SHARD_COUNT)),this.options=Util.mergeDefault(Constants.DefaultOptions,t),this._validateOptions(),this.rest=new RESTManager(this),this.dataManager=new ClientDataManager(this),this.manager=new ClientManager(this),this.ws=new WebSocketManager(this),this.resolver=new ClientDataResolver(this),this.actions=new ActionsManager(this),this.voice=this.browser?null:new ClientVoiceManager(this),this.shard=process.send?ShardClientUtil.singleton(this):null,this.users=new Collection,this.guilds=new Collection,this.channels=new Collection,this.presences=new Collection,!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._pingTimestamp=0,this._timeouts=new Set,this._intervals=new Set,this.options.messageSweepInterval>0&&this.setInterval(this.sweepMessages.bind(this),1e3*this.options.messageSweepInterval)}get status(){return this.ws.status}get uptime(){return this.readyAt?Date.now()-this.readyAt:null}get 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 i of e.emojis.values())t.set(i.id,i);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 this.rest.methods.login(t)}destroy(){for(const t of this._timeouts)clearTimeout(t);for(const e of this._intervals)clearInterval(e);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=true){return this.users.has(t)?Promise.resolve(this.users.get(t)):this.rest.methods.getUser(t,e)}fetchInvite(t){const e=this.resolver.resolveInviteCode(t);return this.rest.methods.getInvite(e)}fetchWebhook(t,e){return this.rest.methods.getWebhook(t,e)}fetchVoiceRegions(){return this.rest.methods.fetchVoiceRegions()}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,i=Date.now();let n=0,s=0;for(const o of this.channels.values())if(o.messages){n++;for(const t of o.messages.values())i-(t.editedTimestamp||t.createdTimestamp)>e&&(o.messages.delete(t.id),s++)}return this.emit("debug",`Swept ${s} messages older than ${t} seconds in ${n} text-based channels`),s}fetchApplication(t="@me"){return this.rest.methods.getApplication(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,...i){const n=setTimeout(()=>{t(),this._timeouts.delete(n)},e,...i);return this._timeouts.add(n),n}clearTimeout(t){clearTimeout(t),this._timeouts.delete(t)}setInterval(t,e,...i){const n=setInterval(t,e,...i);return this._intervals.add(n),n}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){return this.presences.has(t)?void this.presences.get(t).update(e):void 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__(20))},function(t,e,i){const n=i(23),s=i(43),o=i(27),r=i(0),a=i(4);class c extends n{constructor(t,e,i){super(null,t,e),this.options=a.mergeDefault(r.DefaultOptions,i),this.rest=new s(this),this.resolver=new o(this),this._timeouts=new Set,this._intervals=new Set}setTimeout(t,e,...i){const n=setTimeout(()=>{t(),this._timeouts.delete(n)},e,...i);return this._timeouts.add(n),n}clearTimeout(t){clearTimeout(t),this._timeouts.delete(t)}setInterval(t,e,...i){const n=setInterval(t,e,...i);return this._intervals.add(n),n}clearInterval(t){clearInterval(t),this._intervals.delete(t)}destroy(){for(const t of this._timeouts)clearTimeout(t);for(const e of this._intervals)clearInterval(e);this._timeouts.clear(),this._intervals.clear()}}t.exports=c},function(t,e,i){function n(t){return"string"==typeof t?t:t instanceof Array?t.join("\n"):String(t)}const s=i(27);class o{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=n(t),t.length>256)throw new RangeError("RichEmbed titles may not exceed 256 characters.");return this.title=t,this}setDescription(t){if(t=n(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=s.resolveColor(t),this}setAuthor(t,e,i){return this.author={name:n(t),icon_url:e,url:i},this}setTimestamp(t=new Date){return this.timestamp=t,this}addField(t,e,i=false){if(this.fields.length>=25)throw new RangeError("RichEmbeds may not exceed 25 fields.");if(t=n(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=n(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:i}),this}addBlankField(t=false){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=n(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=o},function(t,e){},function(t,e){},function(t,e){},function(t,e,i){"use strict";function n(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-n(t)}function o(t){var e,i,s,o,r,a,c=t.length;r=n(t),a=new h(3*c/4-r),s=r>0?c-4:c;var l=0;for(e=0,i=0;e>16&255,a[l++]=o>>8&255,a[l++]=255&o;return 2===r?(o=u[t.charCodeAt(e)]<<2|u[t.charCodeAt(e+1)]>>4,a[l++]=255&o):1===r&&(o=u[t.charCodeAt(e)]<<10|u[t.charCodeAt(e+1)]<<4|u[t.charCodeAt(e+2)]>>2,a[l++]=o>>8&255,a[l++]=255&o),a}function r(t){return l[t>>18&63]+l[t>>12&63]+l[t>>6&63]+l[63&t]}function a(t,e,i){for(var n,s=[],o=e;ou?u:c+r));return 1===n?(e=t[i-1],s+=l[e>>2],s+=l[e<<4&63],s+="=="):2===n&&(e=(t[i-2]<<8)+t[i-1],s+=l[e>>10],s+=l[e>>4&63],s+=l[e<<2&63],s+="="),o.push(s),o.join("")}e.byteLength=s,e.toByteArray=o,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=i?s-1:0,p=i?-1:1,d=t[e+h];for(h+=p,o=d&(1<<-u)-1,d>>=-u,u+=a;u>0;o=256*o+t[e+h],h+=p,u-=8);for(r=o&(1<<-u)-1,o>>=-u,u+=n;u>0;r=256*r+t[e+h],h+=p,u-=8);if(0===o)o=1-l;else{if(o===c)return r?NaN:(d?-1:1)*(1/0);r+=Math.pow(2,n),o-=l}return(d?-1:1)*r*Math.pow(2,o-n)},e.write=function(t,e,i,n,s,o){var r,a,c,l=8*o-s-1,u=(1<>1,p=23===s?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:o-1,f=n?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,r=u):(r=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-r))<1&&(r--,c*=2),e+=r+h>=1?p/c:p*Math.pow(2,1-h),e*c>=2&&(r++,c/=2),r+h>=u?(a=0,r=u):r+h>=1?(a=(e*c-1)*Math.pow(2,s),r+=h):(a=e*Math.pow(2,h-1)*Math.pow(2,s),r=0));s>=8;t[i+d]=255&a,d+=f,a/=256,s-=8);for(r=r<0;t[i+d]=255&r,d+=f,r/=256,l-=8);t[i+d-f]|=128*m}},function(t,e){var i={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==i.call(t)}},function(t,e,i){"use strict";function n(t,e){return Object.prototype.hasOwnProperty.call(t,e)}t.exports=function(t,e,i,o){e=e||"&",i=i||"=";var r={};if("string"!=typeof t||0===t.length)return r;var a=/\+/g;t=t.split(e);var c=1e3;o&&"number"==typeof o.maxKeys&&(c=o.maxKeys);var l=t.length;c>0&&l>c&&(l=c);for(var u=0;u=0?(h=m.substr(0,g),p=m.substr(g+1)):(h=m,p=""),d=decodeURIComponent(h),f=decodeURIComponent(p),n(r,d)?s(r[d])?r[d].push(f):r[d]=[r[d],f]:r[d]=f}return r};var s=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)}},function(t,e,i){"use strict";function n(t,e){if(t.map)return t.map(e);for(var i=[],n=0;n fs.writeFile('download.jpg', r.body));\n```\n\n```js\nconst snekfetch = require('snekfetch');\n\nsnekfetch.post('https://httpbin.org/post')\n .send({ meme: 'dream' })\n .then(r => console.log(r.body));\n```\n",readmeFilename:"README.md",repository:{type:"git",url:"git+https://github.com/GusCaplan/snekfetch.git"},scripts:{test:'echo "Error: no test specified" && exit 1'},version:"1.0.1"}},function(t,e,i){(function(e){const n=i(19),s=i(59);class o{constructor(){this.boundary=`-----------${Math.random().toString().slice(2)}`,this.buffer=new e(0)}append(t,i,o){if("undefined"!=typeof i){let r=` --${this.boundary} Content-Disposition: form-data; name="${t}"`,a=null;if(o){r+=`; filename="${o}"`,a="application/octet-stream";const t=n.extname(o);t&&(a=s.lookup(t))}i instanceof e?a=s.buffer(i):"object"==typeof i?(a="application/json",i=e.from(JSON.stringify(i))):i=e.from(String(i)),a&&(r+=`