mirror of
https://github.com/danbulant/discord.js
synced 2026-06-20 15:11:32 +00:00
13 lines
No EOL
172 KiB
JavaScript
13 lines
No EOL
172 KiB
JavaScript
!function(t){function e(i){if(n[i])return n[i].exports;var s=n[i]={i:i,l:!1,exports:{}};return t[i].call(s.exports,s,s.exports,e),s.l=!0,s.exports}var n={};return e.m=t,e.c=n,e.i=function(t){return t},e.d=function(t,e,n){Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:n})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=138)}([function(t,e,n){(function(t){e.Package=n(25),e.DefaultOptions={apiRequestMethod:"sequential",shardId:0,shardCount:0,messageCacheMaxSize:200,messageCacheLifetime:0,messageSweepInterval:0,fetchAllMembers:!1,disableEveryone:!1,sync:!1,restWsBridgeTimeout:5e3,disabledEvents:[],ws:{large_threshold:250,compress:"undefined"==typeof window,properties:{$os:t?t.platform:"discord.js",$browser:"discord.js",$device:"discord.js",$referrer:"",$referring_domain:""}}},e.Errors={NO_TOKEN:"Request to use token, but token was unavailable to the client.",NO_BOT_ACCOUNT:"Only bot accounts are able to make use of this feature.",NO_USER_ACCOUNT:"Only user accounts are able to make use of this feature.",BAD_WS_MESSAGE:"A bad message was received from the websocket; either bad compression, or not JSON.",TOOK_TOO_LONG:"Something took too long to do.",NOT_A_PERMISSION:"Invalid permission string or number.",INVALID_RATE_LIMIT_METHOD:"Unknown rate limiting method.",BAD_LOGIN:"Incorrect login details were provided.",INVALID_SHARD:"Invalid shard settings were provided."};const i=e.PROTOCOL_VERSION=6,s=e.API=`https://discordapp.com/api/v${i}`,r=e.Endpoints={login:`${s}/auth/login`,logout:`${s}/auth/logout`,gateway:`${s}/gateway`,botGateway:`${s}/gateway/bot`,invite:t=>`${s}/invite/${t}`,inviteLink:t=>`https://discord.gg/${t}`,CDN:"https://cdn.discordapp.com",user:t=>`${s}/users/${t}`,userChannels:t=>`${r.user(t)}/channels`,userProfile:t=>`${r.user(t)}/profile`,avatar:(t,e)=>"1"===t?e:`${r.user(t)}/avatars/${e}.jpg`,me:`${s}/users/@me`,meGuild:t=>`${r.me}/guilds/${t}`,relationships:t=>`${r.user(t)}/relationships`,note:t=>`${r.me}/notes/${t}`,guilds:`${s}/guilds`,guild:t=>`${r.guilds}/${t}`,guildIcon:(t,e)=>`${r.guild(t)}/icons/${e}.jpg`,guildPrune:t=>`${r.guild(t)}/prune`,guildEmbed:t=>`${r.guild(t)}/embed`,guildInvites:t=>`${r.guild(t)}/invites`,guildRoles:t=>`${r.guild(t)}/roles`,guildRole:(t,e)=>`${r.guildRoles(t)}/${e}`,guildBans:t=>`${r.guild(t)}/bans`,guildIntegrations:t=>`${r.guild(t)}/integrations`,guildMembers:t=>`${r.guild(t)}/members`,guildMember:(t,e)=>`${r.guildMembers(t)}/${e}`,stupidInconsistentGuildEndpoint:t=>`${r.guildMember(t,"@me")}/nick`,guildChannels:t=>`${r.guild(t)}/channels`,guildEmojis:t=>`${r.guild(t)}/emojis`,channels:`${s}/channels`,channel:t=>`${r.channels}/${t}`,channelMessages:t=>`${r.channel(t)}/messages`,channelInvites:t=>`${r.channel(t)}/invites`,channelTyping:t=>`${r.channel(t)}/typing`,channelPermissions:t=>`${r.channel(t)}/permissions`,channelMessage:(t,e)=>`${r.channelMessages(t)}/${e}`,channelWebhooks:t=>`${r.channel(t)}/webhooks`,messageReactions:(t,e)=>`${r.channelMessage(t,e)}/reactions`,messageReaction:(t,e,n,i)=>`${r.messageReactions(t,e)}/${n}`+`${i?`?limit=${i}`:""}`,selfMessageReaction:(t,e,n,i)=>`${r.messageReaction(t,e,n,i)}/@me`,userMessageReaction:(t,e,n,i,s)=>`${r.messageReaction(t,e,n,i)}/${s}`,webhook:(t,e)=>`${s}/webhooks/${t}${e?`/${e}`:""}`,myApplication:`${s}/oauth2/applications/@me`,getApp:t=>`${s}/oauth2/authorize?client_id=${t}`};e.Status={READY:0,CONNECTING:1,RECONNECTING:2,IDLE:3,NEARLY:4},e.ChannelTypes={text:0,DM:1,voice:2,groupDM:3},e.OPCodes={DISPATCH:0,HEARTBEAT:1,IDENTIFY:2,STATUS_UPDATE:3,VOICE_STATE_UPDATE:4,VOICE_GUILD_PING:5,RESUME:6,RECONNECT:7,REQUEST_GUILD_MEMBERS:8,INVALID_SESSION:9,HELLO:10,HEARTBEAT_ACK:11},e.VoiceOPCodes={IDENTIFY:0,SELECT_PROTOCOL:1,READY:2,HEARTBEAT:3,SESSION_DESCRIPTION:4,SPEAKING:5},e.Events={READY:"ready",GUILD_CREATE:"guildCreate",GUILD_DELETE:"guildDelete",GUILD_UPDATE:"guildUpdate",GUILD_UNAVAILABLE:"guildUnavailable",GUILD_AVAILABLE:"guildAvailable",GUILD_MEMBER_ADD:"guildMemberAdd",GUILD_MEMBER_REMOVE:"guildMemberRemove",GUILD_MEMBER_UPDATE:"guildMemberUpdate",GUILD_MEMBER_AVAILABLE:"guildMemberAvailable",GUILD_MEMBER_SPEAKING:"guildMemberSpeaking",GUILD_MEMBERS_CHUNK:"guildMembersChunk",GUILD_ROLE_CREATE:"roleCreate",GUILD_ROLE_DELETE:"roleDelete",GUILD_ROLE_UPDATE:"roleUpdate",GUILD_EMOJI_CREATE:"guildEmojiCreate",GUILD_EMOJI_DELETE:"guildEmojiDelete",GUILD_EMOJI_UPDATE:"guildEmojiUpdate",GUILD_BAN_ADD:"guildBanAdd",GUILD_BAN_REMOVE:"guildBanRemove",CHANNEL_CREATE:"channelCreate",CHANNEL_DELETE:"channelDelete",CHANNEL_UPDATE:"channelUpdate",CHANNEL_PINS_UPDATE:"channelPinsUpdate",MESSAGE_CREATE:"message",MESSAGE_DELETE:"messageDelete",MESSAGE_UPDATE:"messageUpdate",MESSAGE_BULK_DELETE:"messageDeleteBulk",MESSAGE_REACTION_ADD:"messageReactionAdd",MESSAGE_REACTION_REMOVE:"messageReactionRemove",MESSAGE_REACTION_REMOVE_ALL:"messageReactionRemoveAll",USER_UPDATE:"userUpdate",USER_NOTE_UPDATE:"userNoteUpdate",PRESENCE_UPDATE:"presenceUpdate",VOICE_STATE_UPDATE:"voiceStateUpdate",TYPING_START:"typingStart",TYPING_STOP:"typingStop",DISCONNECT:"disconnect",RECONNECTING:"reconnecting",ERROR:"error",WARN:"warn",DEBUG:"debug"},e.WSEvents={READY:"READY",GUILD_SYNC:"GUILD_SYNC",GUILD_CREATE:"GUILD_CREATE",GUILD_DELETE:"GUILD_DELETE",GUILD_UPDATE:"GUILD_UPDATE",GUILD_MEMBER_ADD:"GUILD_MEMBER_ADD",GUILD_MEMBER_REMOVE:"GUILD_MEMBER_REMOVE",GUILD_MEMBER_UPDATE:"GUILD_MEMBER_UPDATE",GUILD_MEMBERS_CHUNK:"GUILD_MEMBERS_CHUNK",GUILD_ROLE_CREATE:"GUILD_ROLE_CREATE",GUILD_ROLE_DELETE:"GUILD_ROLE_DELETE",GUILD_ROLE_UPDATE:"GUILD_ROLE_UPDATE",GUILD_BAN_ADD:"GUILD_BAN_ADD",GUILD_BAN_REMOVE:"GUILD_BAN_REMOVE",CHANNEL_CREATE:"CHANNEL_CREATE",CHANNEL_DELETE:"CHANNEL_DELETE",CHANNEL_UPDATE:"CHANNEL_UPDATE",CHANNEL_PINS_UPDATE:"CHANNEL_PINS_UPDATE",MESSAGE_CREATE:"MESSAGE_CREATE",MESSAGE_DELETE:"MESSAGE_DELETE",MESSAGE_UPDATE:"MESSAGE_UPDATE",MESSAGE_DELETE_BULK:"MESSAGE_DELETE_BULK",MESSAGE_REACTION_ADD:"MESSAGE_REACTION_ADD",MESSAGE_REACTION_REMOVE:"MESSAGE_REACTION_REMOVE",MESSAGE_REACTION_REMOVE_ALL:"MESSAGE_REACTION_REMOVE_ALL",USER_UPDATE:"USER_UPDATE",USER_NOTE_UPDATE:"USER_NOTE_UPDATE",PRESENCE_UPDATE:"PRESENCE_UPDATE",VOICE_STATE_UPDATE:"VOICE_STATE_UPDATE",TYPING_START:"TYPING_START",FRIEND_ADD:"RELATIONSHIP_ADD",FRIEND_REMOVE:"RELATIONSHIP_REMOVE",VOICE_SERVER_UPDATE:"VOICE_SERVER_UPDATE",RELATIONSHIP_ADD:"RELATIONSHIP_ADD",RELATIONSHIP_REMOVE:"RELATIONSHIP_REMOVE"},e.MessageTypes={0:"DEFAULT",1:"RECIPIENT_ADD",2:"RECIPIENT_REMOVE",3:"CALL",4:"CHANNEL_NAME_CHANGE",5:"CHANNEL_ICON_CHANGE",6:"PINS_ADD"};const o=e.PermissionFlags={CREATE_INSTANT_INVITE:1,KICK_MEMBERS:2,BAN_MEMBERS:4,ADMINISTRATOR:8,MANAGE_CHANNELS:16,MANAGE_GUILD:32,ADD_REACTIONS:64,READ_MESSAGES:1024,SEND_MESSAGES:2048,SEND_TTS_MESSAGES:4096,MANAGE_MESSAGES:8192,EMBED_LINKS:16384,ATTACH_FILES:32768,READ_MESSAGE_HISTORY:65536,MENTION_EVERYONE:1<<17,EXTERNAL_EMOJIS:1<<18,CONNECT:1<<20,SPEAK:1<<21,MUTE_MEMBERS:1<<22,DEAFEN_MEMBERS:1<<23,MOVE_MEMBERS:1<<24,USE_VAD:1<<25,CHANGE_NICKNAME:1<<26,MANAGE_NICKNAMES:1<<27,MANAGE_ROLES_OR_PERMISSIONS:1<<28,MANAGE_WEBHOOKS:1<<29,MANAGE_EMOJIS:1<<30};let u=0;for(const h in o)u|=o[h];e.ALL_PERMISSIONS=u,e.DEFAULT_PERMISSIONS=104324097}).call(e,n(16))},function(t,e){class n{constructor(t){this.packetManager=t}handle(t){return t}}t.exports=n},function(t,e){class n{constructor(t){this.client=t}handle(t){return t}}t.exports=n},function(t,e){class n extends Map{constructor(t){super(t),this._array=null,this._keyArray=null}set(t,e){super.set(t,e),this._array=null,this._keyArray=null}delete(t){super.delete(t),this._array=null,this._keyArray=null}array(){return this._array&&this._array.length===this.size||(this._array=Array.from(this.values())),this._array}keyArray(){return this._keyArray&&this._keyArray.length===this.size||(this._keyArray=Array.from(this.keys())),this._keyArray}first(){return this.values().next().value}firstKey(){return this.keys().next().value}last(){const t=this.array();return t[t.length-1]}lastKey(){const t=this.keyArray();return t[t.length-1]}random(){const t=this.array();return t[Math.floor(Math.random()*t.length)]}randomKey(){const t=this.keyArray();return t[Math.floor(Math.random()*t.length)]}findAll(t,e){if("string"!=typeof t)throw new TypeError("Key must be a string.");if("undefined"==typeof e)throw new Error("Value must be specified.");const n=[];for(const i of this.values())i[t]===e&&n.push(i);return n}find(t,e){if("string"==typeof t){if("undefined"==typeof e)throw new Error("Value must be specified.");if("id"===t)throw new RangeError("Don't use .find() with IDs. Instead, use .get(id).");for(const n of this.values())if(n[t]===e)return n;return null}if("function"==typeof t){for(const[e,n]of this)if(t(n,e,this))return n;return null}throw new Error("First argument must be a property string or a function.")}findKey(t,e){if("string"==typeof t){if("undefined"==typeof e)throw new Error("Value must be specified.");for(const[n,i]of this)if(i[t]===e)return n;return null}if("function"==typeof t){for(const[e,n]of this)if(t(n,e,this))return e;return null}throw new Error("First argument must be a property string or a function.")}exists(t,e){if("id"===t)throw new RangeError("Don't use .exists() with IDs. Instead, use .has(id).");return Boolean(this.find(t,e))}filter(t,e){e&&(t=t.bind(e));const i=new n;for(const[s,r]of this)t(r,s,this)&&i.set(s,r);return i}filterArray(t,e){e&&(t=t.bind(e));const n=[];for(const[i,s]of this)t(s,i,this)&&n.push(s);return n}map(t,e){e&&(t=t.bind(e));const n=new Array(this.size);let i=0;for(const[s,r]of this)n[i++]=t(r,s,this);return n}some(t,e){e&&(t=t.bind(e));for(const[n,i]of this)if(t(i,n,this))return!0;return!1}every(t,e){e&&(t=t.bind(e));for(const[n,i]of this)if(!t(i,n,this))return!1;return!0}reduce(t,e){let n=e;for(const[i,s]of this)n=t(n,s,i,this);return n}concat(...t){const e=new this.constructor;for(const[n,i]of this)e.set(n,i);for(const s of t)for(const[n,i]of s)e.set(n,i);return e}deleteAll(){const t=[];for(const e of this.values())e.delete&&t.push(e.delete());return t}}t.exports=n},function(t,e){t.exports=function(t){const e=Object.create(t);return Object.assign(e,t),e}},function(t,e,n){const i=n(10),s=n(0),r=n(6).Presence;class o{constructor(t,e){this.client=t,Object.defineProperty(this,"client",{enumerable:!1,configurable:!1}),e&&this.setup(e)}setup(t){this.id=t.id,this.username=t.username,this.discriminator=t.discriminator,this.avatar=t.avatar,this.bot=Boolean(t.bot)}patch(t){for(const e of["id","username","discriminator","avatar","bot"])"undefined"!=typeof t[e]&&(this[e]=t[e])}get createdTimestamp(){return this.id/4194304+14200704e5}get createdAt(){return new Date(this.createdTimestamp)}get presence(){if(this.client.presences.has(this.id))return this.client.presences.get(this.id);for(const t of this.client.guilds.values())if(t.presences.has(this.id))return t.presences.get(this.id);return new r}get avatarURL(){return this.avatar?s.Endpoints.avatar(this.id,this.avatar):null}get note(){return this.client.user.notes.get(this.id)||null}typingIn(t){return t=this.client.resolver.resolveChannel(t),t._typing.has(this.id)}typingSinceIn(t){return t=this.client.resolver.resolveChannel(t),t._typing.has(this.id)?new Date(t._typing.get(this.id).since):null}typingDurationIn(t){return t=this.client.resolver.resolveChannel(t),t._typing.has(this.id)?t._typing.get(this.id).elapsedTime:-1}deleteDM(){return this.client.rest.methods.deleteChannel(this)}addFriend(){return this.client.rest.methods.addFriend(this)}removeFriend(){return this.client.rest.methods.removeFriend(this)}block(){return this.client.rest.methods.blockUser(this)}unblock(){return this.client.rest.methods.unblockUser(this)}fetchProfile(){return this.client.rest.methods.fetchUserProfile(this)}setNote(t){return this.client.rest.methods.setNote(this,t)}equals(t){let e=t&&this.id===t.id&&this.username===t.username&&this.discriminator===t.discriminator&&this.avatar===t.avatar&&this.bot===Boolean(t.bot);return e}toString(){return`<@${this.id}>`}sendMessage(){}sendTTSMessage(){}sendFile(){}sendCode(){}}i.applyToClass(o),t.exports=o},function(t,e){class n{constructor(t={}){this.status=t.status||"offline",this.game=t.game?new i(t.game):null}update(t){this.status=t.status||this.status,this.game=t.game?new i(t.game):null}equals(t){return t&&this.status===t.status&&this.game?this.game.equals(t.game):!t.game}}class i{constructor(t){this.name=t.name,this.type=t.type,this.url=t.url||null}get streaming(){return 1===this.type}equals(t){return t&&this.name===t.name&&this.type===t.type&&this.url===t.url}}e.Presence=n,e.Game=i},function(t,e,n){const i=n(0);class s{constructor(t,e){this.client=t.client,Object.defineProperty(this,"client",{enumerable:!1,configurable:!1}),this.guild=t,e&&this.setup(e)}setup(t){this.id=t.id,this.name=t.name,this.color=t.color,this.hoist=t.hoist,this.position=t.position,this.permissions=t.permissions,this.managed=t.managed,this.mentionable=t.mentionable}get createdTimestamp(){return this.id/4194304+14200704e5}get createdAt(){return new Date(this.createdTimestamp)}get hexColor(){let t=this.color.toString(16);for(;t.length<6;)t=`0${t}`;return`#${t}`}get members(){return this.guild.members.filter(t=>t.roles.has(this.id))}serialize(){const t={};for(const e in i.PermissionFlags)t[e]=this.hasPermission(e);return t}hasPermission(t,e=false){return t=this.client.resolver.resolvePermission(t),!e&&(this.permissions&i.PermissionFlags.ADMINISTRATOR)>0||(this.permissions&t)>0}hasPermissions(t,e=false){return t.every(t=>this.hasPermission(t,e))}comparePositionTo(t){return this.constructor.comparePositions(this,t)}edit(t){return this.client.rest.methods.updateGuildRole(this,t)}setName(t){return this.edit({name:t})}setColor(t){return this.edit({color:t})}setHoist(t){return this.edit({hoist:t})}setPosition(t){return this.guild.setRolePosition(this,t)}setPermissions(t){return this.edit({permissions:t})}setMentionable(t){return this.edit({mentionable:t})}delete(){return this.client.rest.methods.deleteGuildRole(this)}get editable(){if(this.managed)return!1;const t=this.guild.member(this.client.user);return!!t.hasPermission(i.PermissionFlags.MANAGE_ROLES_OR_PERMISSIONS)&&t.highestRole.comparePositionTo(this)>0}equals(t){return t&&this.id===t.id&&this.name===t.name&&this.color===t.color&&this.hoist===t.hoist&&this.position===t.position&&this.permissions===t.permissions&&this.managed===t.managed}toString(){return`<@&${this.id}>`}static comparePositions(t,e){return t.position===e.position?e.id-t.id:t.position-e.position}}t.exports=s},function(t,e){class n{constructor(t,e){this.client=t,Object.defineProperty(this,"client",{enumerable:!1,configurable:!1}),this.type=null,e&&this.setup(e)}setup(t){this.id=t.id}get createdTimestamp(){return this.id/4194304+14200704e5}get createdAt(){return new Date(this.createdTimestamp)}delete(){return this.client.rest.methods.deleteChannel(this)}}t.exports=n},function(t,e,n){const i=n(0),s=n(3);class r{constructor(t,e){this.client=t.client,Object.defineProperty(this,"client",{enumerable:!1,configurable:!1}),this.guild=t,this.setup(e)}setup(t){this.id=t.id,this.name=t.name,this.requiresColons=t.require_colons,this.managed=t.managed,this._roles=t.roles}get createdTimestamp(){return this.id/4194304+14200704e5}get createdAt(){return new Date(this.createdTimestamp)}get roles(){const t=new s;for(const e of this._roles)this.guild.roles.has(e)&&t.set(e,this.guild.roles.get(e));return t}get url(){return`${i.Endpoints.CDN}/emojis/${this.id}.png`}toString(){return this.requiresColons?`<:${this.name}:${this.id}>`:this.name}get identifier(){return this.id?`${this.name}:${this.id}`:encodeURIComponent(this.name)}}t.exports=r},function(t,e,n){function i(t,e){Object.defineProperty(t.prototype,e,Object.getOwnPropertyDescriptor(a.prototype,e))}const s=n(22),r=n(13),o=n(32),u=n(3),h=n(14);class a{constructor(){this.messages=new u,this.lastMessageID=null}sendMessage(t,e={}){return this.client.rest.methods.sendMessage(this,t,e)}sendTTSMessage(t,e={}){return Object.assign(e,{tts:!0}),this.client.rest.methods.sendMessage(this,t,e)}sendFile(t,e,n,i={}){return e||(e="string"==typeof t?s.basename(t):t&&t.path?s.basename(t.path):"file.jpg"),this.client.resolver.resolveBuffer(t).then(t=>this.client.rest.methods.sendMessage(this,n,i,{file:t,name:e}))}sendCode(t,e,n={}){return n.split&&("object"!=typeof n.split&&(n.split={}),n.split.prepend||(n.split.prepend=`\`\`\`${t||""}
|
||
`),n.split.append||(n.split.append="\n```")),e=h(this.client.resolver.resolveString(e),!0),this.sendMessage(`\`\`\`${t||""}
|
||
${e}
|
||
\`\`\``,n)}fetchMessage(t){return this.client.rest.methods.getChannelMessage(this,t).then(t=>{const e=t instanceof r?t:new r(this,t,this.client);return this._cacheMessage(e),e})}fetchMessages(t={}){return this.client.rest.methods.getChannelMessages(this,t).then(t=>{const e=new u;for(const n of t){const t=new r(this,n,this.client);e.set(n.id,t),this._cacheMessage(t)}return e})}fetchPinnedMessages(){return this.client.rest.methods.getChannelPinnedMessages(this).then(t=>{const e=new u;for(const n of t){const t=new r(this,n,this.client);e.set(n.id,t),this._cacheMessage(t)}return e})}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)},4e3)}),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((n,i)=>{const s=this.createCollector(t,e);s.on("end",(t,s)=>{e.errors&&e.errors.includes(s)?i(t):n(t)})})}bulkDelete(t){if(!isNaN(t))return this.fetchMessages({limit:t}).then(t=>this.bulkDelete(t));if(t instanceof Array||t instanceof u){const e=t instanceof u?t.keyArray():t.map(t=>t.id);return this.client.rest.methods.bulkDeleteMessages(this,e)}throw new TypeError("The messages must be an Array, Collection, or number.")}_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)=>{const n=["sendMessage","sendTTSMessage","sendFile","sendCode"];e&&(n.push("_cacheMessage"),n.push("fetchMessages"),n.push("fetchMessage"),n.push("bulkDelete"),n.push("startTyping"),n.push("stopTyping"),n.push("typing"),n.push("typingCount"),n.push("fetchPinnedMessages"),n.push("createCollector"),n.push("awaitMessages"));for(const s of n)i(t,s)})},function(t,e,n){const i=n(8),s=n(7),r=n(38),o=n(17),u=n(0),h=n(3),a=n(24);class c extends i{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 h,t.permission_overwrites)for(const e of t.permission_overwrites)this.permissionOverwrites.set(e.id,new r(this,e))}permissionsFor(t){if(t=this.client.resolver.resolveGuildMember(this.guild,t),!t)return null;if(t.id===this.guild.ownerID)return new o(t,u.ALL_PERMISSIONS);let e=0;const n=t.roles;for(const i of n.values())e|=i.permissions;const s=this.overwritesFor(t,!0,n);for(const r of s.role.concat(s.member))e&=~r.denyData,e|=r.allowData;const h=Boolean(e&u.PermissionFlags.ADMINISTRATOR);return h&&(e=u.ALL_PERMISSIONS),new o(t,e)}overwritesFor(t,e=false,n=null){if(e||(t=this.client.resolver.resolveGuildMember(this.guild,t)),!t)return[];n=n||t.roles;const i=[],s=[];for(const r of this.permissionOverwrites.values())r.id===t.id?s.push(r):n.has(r.id)&&i.push(r);return{role:i,member:s}}overwritePermissions(t,e){const n={allow:0,deny:0};if(t instanceof s)n.type="role";else if(this.guild.roles.has(t))t=this.guild.roles.get(t),n.type="role";else if(t=this.client.resolver.resolveUser(t),n.type="member",!t)return Promise.reject(new TypeError("Supplied parameter was neither a User nor a Role."));n.id=t.id;const i=this.permissionOverwrites.get(t.id);i&&(n.allow=i.allowData,n.deny=i.denyData);for(const r in e)e[r]===!0?(n.allow|=u.PermissionFlags[r]||0,n.deny&=~(u.PermissionFlags[r]||0)):e[r]===!1?(n.allow&=~(u.PermissionFlags[r]||0),n.deny|=u.PermissionFlags[r]||0):null===e[r]&&(n.allow&=~(u.PermissionFlags[r]||0),n.deny&=~(u.PermissionFlags[r]||0));return this.client.rest.methods.setChannelOverwrite(this,n)}edit(t){return this.client.rest.methods.updateChannel(this,t)}setName(t){return this.edit({name:t})}setPosition(t){return this.client.rest.methods.updateChannel(this,{position:t})}setTopic(t){return this.client.rest.methods.updateChannel(this,{topic:t})}createInvite(t={}){return this.client.rest.methods.createChannelInvite(this,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;if(e)if(this.permissionOverwrites&&t.permissionOverwrites){const n=this.permissionOverwrites.keyArray(),i=t.permissionOverwrites.keyArray();e=a(n,i)}else e=!this.permissionOverwrites&&!t.permissionOverwrites;return e}toString(){return`<#${this.id}>`}}t.exports=c},function(t,e,n){const i=n(10),s=n(7),r=n(17),o=n(0),u=n(3),h=n(6).Presence;class a{constructor(t,e){this.client=t.client,Object.defineProperty(this,"client",{enumerable:!1,configurable:!1}),this.guild=t,this.user={},this._roles=[],e&&this.setup(e)}setup(t){this.serverDeaf=t.deaf,this.serverMute=t.mute,this.selfMute=t.self_mute,this.selfDeaf=t.self_deaf,this.voiceSessionID=t.session_id,this.voiceChannelID=t.channel_id,this.speaking=!1,this.nickname=t.nick||null,this.joinedTimestamp=new Date(t.joined_at).getTime(),this.user=t.user,this._roles=t.roles}get joinedAt(){return new Date(this.joinedTimestamp)}get presence(){return this.frozenPresence||this.guild.presences.get(this.id)||new h}get roles(){const t=new u,e=this.guild.roles.get(this.guild.id);e&&t.set(e.id,e);for(const n of this._roles){const e=this.guild.roles.get(n);e&&t.set(e.id,e)}return t}get highestRole(){return this.roles.reduce((t,e)=>!t||e.comparePositionTo(t)>0?e:t)}get mute(){return this.selfMute||this.serverMute}get deaf(){return this.selfDeaf||this.serverDeaf}get voiceChannel(){return this.guild.channels.get(this.voiceChannelID)}get id(){return this.user.id}get permissions(){if(this.user.id===this.guild.ownerID)return new r(this,o.ALL_PERMISSIONS);let t=0;const e=this.roles;for(const n of e.values())t|=n.permissions;const i=Boolean(t&o.PermissionFlags.ADMINISTRATOR);return i&&(t=o.ALL_PERMISSIONS),new r(this,t)}get kickable(){if(this.user.id===this.guild.ownerID)return!1;if(this.user.id===this.client.user.id)return!1;const t=this.guild.member(this.client.user);return!!t.hasPermission(o.PermissionFlags.KICK_MEMBERS)&&t.highestRole.comparePositionTo(this.highestRole)>0}get bannable(){if(this.user.id===this.guild.ownerID)return!1;if(this.user.id===this.client.user.id)return!1;const t=this.guild.member(this.client.user);return!!t.hasPermission(o.PermissionFlags.BAN_MEMBERS)&&t.highestRole.comparePositionTo(this.highestRole)>0}permissionsIn(t){if(t=this.client.resolver.resolveChannel(t),!t||!t.guild)throw new Error("Could not resolve channel to a guild channel.");return t.permissionsFor(this)}hasPermission(t,e=false){return!e&&this.user.id===this.guild.ownerID||this.roles.some(n=>n.hasPermission(t,e))}hasPermissions(t,e=false){return!e&&this.user.id===this.guild.ownerID||t.every(t=>this.hasPermission(t,e))}missingPermissions(t,e=false){return t.filter(t=>!this.hasPermission(t,e))}edit(t){return this.client.rest.methods.updateGuildMember(this,t)}setMute(t){return this.edit({mute:t})}setDeaf(t){return this.edit({deaf:t})}setVoiceChannel(t){return this.edit({channel:t})}setRoles(t){return this.edit({roles:t})}addRole(t){return this.addRoles([t])}addRoles(t){let e;if(t instanceof u){e=this._roles.slice();for(const n of t.values())e.push(n.id)}else e=this._roles.concat(t);return this.edit({roles:e})}removeRole(t){return this.removeRoles([t])}removeRoles(t){const e=this._roles.slice();if(t instanceof u)for(const n of t.values()){const t=e.indexOf(n.id);t>=0&&e.splice(t,1)}else for(const n of t){const t=e.indexOf(n instanceof s?n.id:n);t>=0&&e.splice(t,1)}return this.edit({roles:e})}setNickname(t){return this.edit({nick:t})}deleteDM(){return this.client.rest.methods.deleteChannel(this)}kick(){return this.client.rest.methods.kickGuildMember(this.guild,this)}ban(t=0){return this.client.rest.methods.banGuildMember(this.guild,this,t)}toString(){return`<@${this.nickname?"!":""}${this.user.id}>`}sendMessage(){}sendTTSMessage(){}sendFile(){}sendCode(){}}i.applyToClass(a),t.exports=a},function(t,e,n){const i=n(31),s=n(33),r=n(3),o=n(0),u=n(14),h=n(34);class a{constructor(t,e,n){this.client=n,Object.defineProperty(this,"client",{enumerable:!1,configurable:!1}),this.channel=t,e&&this.setup(e)}setup(t){this.id=t.id,this.type=o.MessageTypes[t.type],this.content=t.content,this.author=this.client.dataManager.newUser(t.author),this.member=this.guild?this.guild.member(this.author)||null:null,this.pinned=t.pinned,this.tts=t.tts,this.nonce=t.nonce,this.system=6===t.type,this.embeds=t.embeds.map(t=>new s(this,t)),this.attachments=new r;for(const e of t.attachments)this.attachments.set(e.id,new i(this,e));this.createdTimestamp=new Date(t.timestamp).getTime(),this.editedTimestamp=t.edited_timestamp?new Date(t.edited_timestamp).getTime():null,this.mentions={users:new r,roles:new r,channels:new r,everyone:t.mention_everyone};for(const n of t.mentions){let t=this.client.users.get(n.id);t?this.mentions.users.set(t.id,t):(t=this.client.dataManager.newUser(n),this.mentions.users.set(t.id,t))}if(t.mention_roles)for(const n of t.mention_roles){const t=this.channel.guild.roles.get(n);t&&this.mentions.roles.set(t.id,t)}if(this.channel.guild){const e=t.content.match(/<#([0-9]{14,20})>/g)||[];for(const n of e){const t=this.channel.guild.channels.get(n.match(/([0-9]{14,20})/g)[0]);t&&this.mentions.channels.set(t.id,t)}}if(this._edits=[],this.reactions=new r,t.reactions&&t.reactions.length>0)for(const u of t.reactions){const t=u.emoji.id?`${u.emoji.name}:${u.emoji.id}`:u.emoji.name;this.reactions.set(t,new h(this,u.emoji,u.count,u.me))}}patch(t){if(t.author&&(this.author=this.client.users.get(t.author.id),this.guild&&(this.member=this.guild.member(this.author))),t.content&&(this.content=t.content),t.timestamp&&(this.createdTimestamp=new Date(t.timestamp).getTime()),t.edited_timestamp&&(this.editedTimestamp=t.edited_timestamp?new Date(t.edited_timestamp).getTime():null),"tts"in t&&(this.tts=t.tts),"mention_everyone"in t&&(this.mentions.everyone=t.mention_everyone),t.nonce&&(this.nonce=t.nonce),t.embeds&&(this.embeds=t.embeds.map(t=>new s(this,t))),t.type>-1&&(this.system=!1,6===t.type&&(this.system=!0)),t.attachments){this.attachments=new r;for(const e of t.attachments)this.attachments.set(e.id,new i(this,e))}if(t.mentions)for(const e of t.mentions){let t=this.client.users.get(e.id);t?this.mentions.users.set(t.id,t):(t=this.client.dataManager.newUser(e),this.mentions.users.set(t.id,t))}if(t.mention_roles)for(const e of t.mention_roles){const t=this.channel.guild.roles.get(e);t&&this.mentions.roles.set(t.id,t)}if(t.id&&(this.id=t.id),this.channel.guild&&t.content){const e=t.content.match(/<#([0-9]{14,20})>/g)||[];for(const n of e){const t=this.channel.guild.channels.get(n.match(/([0-9]{14,20})/g)[0]);t&&this.mentions.channels.set(t.id,t)}}if(t.reactions&&(this.reactions=new r,t.reactions.length>0))for(const n of t.reactions){const e=n.emoji.id?`${n.emoji.name}:${n.emoji.id}`:n.emoji.name;this.reactions.set(e,new h(this,t.emoji,t.count,t.me))}}get createdAt(){return new Date(this.createdTimestamp)}get editedAt(){return this.editedTimestamp?new Date(this.editedTimestamp):null}get guild(){return this.channel.guild||null}get cleanContent(){return this.content.replace(/@(everyone|here)/g,"@$1").replace(/<@!?[0-9]+>/g,t=>{const e=t.replace(/<|!|>|@/g,"");if("dm"===this.channel.type||"group"===this.channel.type)return this.client.users.has(e)?`@${this.client.users.get(e).username}`:t;const n=this.channel.guild.members.get(e);if(n)return n.nickname?`@${n.nickname}`:`@${n.user.username}`;{const n=this.client.users.get(e);return n?`@${n.username}`:t}}).replace(/<#[0-9]+>/g,t=>{const e=this.client.channels.get(t.replace(/<|#|>/g,""));return e?`#${e.name}`:t}).replace(/<@&[0-9]+>/g,t=>{if("dm"===this.channel.type||"group"===this.channel.type)return t;const e=this.guild.roles.get(t.replace(/<|@|>|&/g,""));return e?`@${e.name}`:t})}get edits(){return this._edits.slice().unshift(this)}get editable(){return this.author.id===this.client.user.id}get deletable(){return this.author.id===this.client.user.id||this.guild&&this.channel.permissionsFor(this.client.user).hasPermission(o.PermissionFlags.MANAGE_MESSAGES)}get pinnable(){return!this.guild||this.channel.permissionsFor(this.client.user).hasPermission(o.PermissionFlags.MANAGE_MESSAGES)}isMentioned(t){return t=t&&t.id?t.id:t,this.mentions.users.has(t)||this.mentions.channels.has(t)||this.mentions.roles.has(t)}edit(t,e={}){return this.client.rest.methods.updateMessage(this,t,e)}editCode(t,e){return e=u(this.client.resolver.resolveString(e),!0),this.edit(`\`\`\`${t||""}
|
||
${e}
|
||
\`\`\``)}pin(){return this.client.rest.methods.pinMessage(this)}unpin(){return this.client.rest.methods.unpinMessage(this)}react(t){if(t=this.client.resolver.resolveEmojiIdentifier(t),!t)throw new TypeError("Emoji must be a string or Emoji/ReactionEmoji");return this.client.rest.methods.addMessageReaction(this,t)}clearReactions(){return this.client.rest.methods.removeMessageReactions(this)}delete(t=0){return t<=0?this.client.rest.methods.deleteMessage(this):new Promise(e=>{this.client.setTimeout(()=>{e(this.delete())},t)})}reply(t,e={}){t=this.client.resolver.resolveString(t);const n=this.guild?`${this.author}, `:"";return t=`${n}${t}`,e.split&&("object"!=typeof e.split&&(e.split={}),e.split.prepend||(e.split.prepend=n)),this.client.rest.methods.sendMessage(this.channel,t,e)}equals(t,e){if(!t)return!1;const n=!t.author&&!t.attachments;if(n)return this.id===t.id&&this.embeds.length===t.embeds.length;let i=this.id===t.id&&this.author.id===t.author.id&&this.content===t.content&&this.tts===t.tts&&this.nonce===t.nonce&&this.embeds.length===t.embeds.length&&this.attachments.length===t.attachments.length;return i&&e&&(i=this.mentions.everyone===t.mentions.everyone&&this.createdTimestamp===new Date(e.timestamp).getTime()&&this.editedTimestamp===new Date(e.edited_timestamp).getTime()),i}toString(){return this.content}_addReaction(t,e){const n=t.id?`${t.name}:${t.id}`:t.name;let i;return this.reactions.has(n)?(i=this.reactions.get(n),i.me||(i.me=e.id===this.client.user.id)):(i=new h(this,t,0,e.id===this.client.user.id),this.reactions.set(n,i)),i.users.has(e.id)?null:(i.users.set(e.id,e),i.count++,i)}_removeReaction(t,e){const n=t.id||t;if(this.reactions.has(n)){const t=this.reactions.get(n);if(t.users.has(e.id))return t.users.delete(e.id),t.count--,e.id===this.client.user.id&&(t.me=!1),t}return null}_clearReactions(){this.reactions.clear()}}t.exports=a},function(t,e){t.exports=function(t,e=false,n=false){return e?t.replace(/```/g,"```"):n?t.replace(/\\(`|\\)/g,"$1").replace(/(`|\\)/g,"\\$1"):t.replace(/\\(\*|_|`|~|\\)/g,"$1").replace(/(\*|_|`|~|\\)/g,"\\$1")}},function(t,e,n){"use strict";(function(t,i){function s(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(t){return!1}}function r(){return t.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function o(e,n){if(r()<n)throw new RangeError("Invalid typed array length");return t.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(n),e.__proto__=t.prototype):(null===e&&(e=new t(n)),e.length=n),e}function t(e,n,i){if(!(t.TYPED_ARRAY_SUPPORT||this instanceof t))return new t(e,n,i);if("number"==typeof e){if("string"==typeof n)throw new Error("If encoding is specified then the first argument must be a string");return c(this,e)}return u(this,e,n,i)}function u(t,e,n,i){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?d(t,e,n,i):"string"==typeof e?l(t,e,n):p(t,e)}function h(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function a(t,e,n,i){return h(e),e<=0?o(t,e):void 0!==n?"string"==typeof i?o(t,e).fill(n,i):o(t,e).fill(n):o(t,e)}function c(e,n){if(h(n),e=o(e,n<0?0:0|m(n)),!t.TYPED_ARRAY_SUPPORT)for(var i=0;i<n;++i)e[i]=0;return e}function l(e,n,i){if("string"==typeof i&&""!==i||(i="utf8"),!t.isEncoding(i))throw new TypeError('"encoding" must be a valid string encoding');var s=0|E(n,i);e=o(e,s);var r=e.write(n,i);return r!==s&&(e=e.slice(0,r)),e}function f(t,e){var n=e.length<0?0:0|m(e.length);t=o(t,n);for(var i=0;i<n;i+=1)t[i]=255&e[i];return t}function d(e,n,i,s){if(n.byteLength,i<0||n.byteLength<i)throw new RangeError("'offset' is out of bounds");if(n.byteLength<i+(s||0))throw new RangeError("'length' is out of bounds");return n=void 0===i&&void 0===s?new Uint8Array(n):void 0===s?new Uint8Array(n,i):new Uint8Array(n,i,s),t.TYPED_ARRAY_SUPPORT?(e=n,e.__proto__=t.prototype):e=f(e,n),e}function p(e,n){if(t.isBuffer(n)){var i=0|m(n.length);return e=o(e,i),0===e.length?e:(n.copy(e,0,0,i),e)}if(n){if("undefined"!=typeof ArrayBuffer&&n.buffer instanceof ArrayBuffer||"length"in n)return"number"!=typeof n.length||J(n.length)?o(e,0):f(e,n);if("Buffer"===n.type&&Z(n.data))return f(e,n.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function m(t){if(t>=r())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+r().toString(16)+" bytes");return 0|t}function g(e){return+e!=e&&(e=0),t.alloc(+e)}function E(e,n){if(t.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var i=e.length;if(0===i)return 0;for(var s=!1;;)switch(n){case"ascii":case"latin1":case"binary":return i;case"utf8":case"utf-8":case void 0:return Y(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*i;case"hex":return i>>>1;case"base64":return K(e).length;default:if(s)return Y(e).length;n=(""+n).toLowerCase(),s=!0}}function _(t,e,n){var i=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if(n>>>=0,e>>>=0,n<=e)return"";for(t||(t="utf8");;)switch(t){case"hex":return L(this,e,n);case"utf8":case"utf-8":return I(this,e,n);case"ascii":return k(this,e,n);case"latin1":case"binary":return U(this,e,n);case"base64":return S(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,e,n);default:if(i)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),i=!0}}function y(t,e,n){var i=t[e];t[e]=t[n],t[n]=i}function v(e,n,i,s,r){if(0===e.length)return-1;if("string"==typeof i?(s=i,i=0):i>2147483647?i=2147483647:i<-2147483648&&(i=-2147483648),i=+i,isNaN(i)&&(i=r?0:e.length-1),i<0&&(i=e.length+i),i>=e.length){if(r)return-1;i=e.length-1}else if(i<0){if(!r)return-1;i=0}if("string"==typeof n&&(n=t.from(n,s)),t.isBuffer(n))return 0===n.length?-1:w(e,n,i,s,r);if("number"==typeof n)return n&=255,t.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?r?Uint8Array.prototype.indexOf.call(e,n,i):Uint8Array.prototype.lastIndexOf.call(e,n,i):w(e,[n],i,s,r);throw new TypeError("val must be string, number or Buffer")}function w(t,e,n,i,s){function r(t,e){return 1===o?t[e]:t.readUInt16BE(e*o)}var o=1,u=t.length,h=e.length;if(void 0!==i&&(i=String(i).toLowerCase(),"ucs2"===i||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(t.length<2||e.length<2)return-1;o=2,u/=2,h/=2,n/=2}var a;if(s){var c=-1;for(a=n;a<u;a++)if(r(t,a)===r(e,c===-1?0:a-c)){if(c===-1&&(c=a),a-c+1===h)return c*o}else c!==-1&&(a-=a-c),c=-1}else for(n+h>u&&(n=u-h),a=n;a>=0;a--){for(var l=!0,f=0;f<h;f++)if(r(t,a+f)!==r(e,f)){l=!1;break}if(l)return a}return-1}function b(t,e,n,i){n=Number(n)||0;var s=t.length-n;i?(i=Number(i),i>s&&(i=s)):i=s;var r=e.length;if(r%2!==0)throw new TypeError("Invalid hex string");i>r/2&&(i=r/2);for(var o=0;o<i;++o){var u=parseInt(e.substr(2*o,2),16);if(isNaN(u))return o;t[n+o]=u}return o}function A(t,e,n,i){return $(Y(e,t.length-n),t,n,i)}function T(t,e,n,i){return $(F(e),t,n,i)}function R(t,e,n,i){return T(t,e,n,i)}function M(t,e,n,i){return $(K(e),t,n,i)}function D(t,e,n,i){return $(z(e,t.length-n),t,n,i)}function S(t,e,n){return 0===e&&n===t.length?X.fromByteArray(t):X.fromByteArray(t.slice(e,n))}function I(t,e,n){n=Math.min(t.length,n);for(var i=[],s=e;s<n;){var r=t[s],o=null,u=r>239?4:r>223?3:r>191?2:1;if(s+u<=n){var h,a,c,l;switch(u){case 1:r<128&&(o=r);break;case 2:h=t[s+1],128===(192&h)&&(l=(31&r)<<6|63&h,l>127&&(o=l));break;case 3:h=t[s+1],a=t[s+2],128===(192&h)&&128===(192&a)&&(l=(15&r)<<12|(63&h)<<6|63&a,l>2047&&(l<55296||l>57343)&&(o=l));break;case 4:h=t[s+1],a=t[s+2],c=t[s+3],128===(192&h)&&128===(192&a)&&128===(192&c)&&(l=(15&r)<<18|(63&h)<<12|(63&a)<<6|63&c,l>65535&&l<1114112&&(o=l))}}null===o?(o=65533,u=1):o>65535&&(o-=65536,i.push(o>>>10&1023|55296),o=56320|1023&o),i.push(o),s+=u}return C(i)}function C(t){var e=t.length;if(e<=tt)return String.fromCharCode.apply(String,t);for(var n="",i=0;i<e;)n+=String.fromCharCode.apply(String,t.slice(i,i+=tt));return n}function k(t,e,n){var i="";n=Math.min(t.length,n);for(var s=e;s<n;++s)i+=String.fromCharCode(127&t[s]);return i}function U(t,e,n){var i="";n=Math.min(t.length,n);for(var s=e;s<n;++s)i+=String.fromCharCode(t[s]);return i}function L(t,e,n){var i=t.length;(!e||e<0)&&(e=0),(!n||n<0||n>i)&&(n=i);for(var s="",r=e;r<n;++r)s+=V(t[r]);return s}function P(t,e,n){for(var i=t.slice(e,n),s="",r=0;r<i.length;r+=2)s+=String.fromCharCode(i[r]+256*i[r+1]);return s}function N(t,e,n){if(t%1!==0||t<0)throw new RangeError("offset is not uint");if(t+e>n)throw new RangeError("Trying to access beyond buffer length")}function O(e,n,i,s,r,o){if(!t.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(n>r||n<o)throw new RangeError('"value" argument is out of bounds');if(i+s>e.length)throw new RangeError("Index out of range")}function x(t,e,n,i){e<0&&(e=65535+e+1);for(var s=0,r=Math.min(t.length-n,2);s<r;++s)t[n+s]=(e&255<<8*(i?s:1-s))>>>8*(i?s:1-s)}function G(t,e,n,i){e<0&&(e=4294967295+e+1);for(var s=0,r=Math.min(t.length-n,4);s<r;++s)t[n+s]=e>>>8*(i?s:3-s)&255}function B(t,e,n,i,s,r){if(n+i>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function j(t,e,n,i,s){return s||B(t,e,n,4,3.4028234663852886e38,-3.4028234663852886e38),Q.write(t,e,n,i,23,4),n+4}function q(t,e,n,i,s){return s||B(t,e,n,8,1.7976931348623157e308,-1.7976931348623157e308),Q.write(t,e,n,i,52,8),n+8}function W(t){if(t=H(t).replace(et,""),t.length<2)return"";for(;t.length%4!==0;)t+="=";return t}function H(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function V(t){return t<16?"0"+t.toString(16):t.toString(16)}function Y(t,e){e=e||1/0;for(var n,i=t.length,s=null,r=[],o=0;o<i;++o){if(n=t.charCodeAt(o),n>55295&&n<57344){if(!s){if(n>56319){(e-=3)>-1&&r.push(239,191,189);continue}if(o+1===i){(e-=3)>-1&&r.push(239,191,189);continue}s=n;continue}if(n<56320){(e-=3)>-1&&r.push(239,191,189),s=n;continue}n=(s-55296<<10|n-56320)+65536}else s&&(e-=3)>-1&&r.push(239,191,189);if(s=null,n<128){if((e-=1)<0)break;r.push(n)}else if(n<2048){if((e-=2)<0)break;r.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;r.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;r.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return r}function F(t){for(var e=[],n=0;n<t.length;++n)e.push(255&t.charCodeAt(n));return e}function z(t,e){for(var n,i,s,r=[],o=0;o<t.length&&!((e-=2)<0);++o)n=t.charCodeAt(o),i=n>>8,s=n%256,r.push(s),r.push(i);return r}function K(t){return X.toByteArray(W(t))}function $(t,e,n,i){for(var s=0;s<i&&!(s+n>=e.length||s>=t.length);++s)e[s+n]=t[s];return s}function J(t){return t!==t}var X=n(55),Q=n(57),Z=n(58);e.Buffer=t,e.SlowBuffer=g,e.INSPECT_MAX_BYTES=50,t.TYPED_ARRAY_SUPPORT=void 0!==i.TYPED_ARRAY_SUPPORT?i.TYPED_ARRAY_SUPPORT:s(),e.kMaxLength=r(),t.poolSize=8192,t._augment=function(e){return e.__proto__=t.prototype,e},t.from=function(t,e,n){return u(null,t,e,n)},t.TYPED_ARRAY_SUPPORT&&(t.prototype.__proto__=Uint8Array.prototype,t.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&t[Symbol.species]===t&&Object.defineProperty(t,Symbol.species,{value:null,configurable:!0})),t.alloc=function(t,e,n){return a(null,t,e,n)},t.allocUnsafe=function(t){return c(null,t)},t.allocUnsafeSlow=function(t){return c(null,t)},t.isBuffer=function(t){return!(null==t||!t._isBuffer)},t.compare=function(e,n){if(!t.isBuffer(e)||!t.isBuffer(n))throw new TypeError("Arguments must be Buffers");if(e===n)return 0;for(var i=e.length,s=n.length,r=0,o=Math.min(i,s);r<o;++r)if(e[r]!==n[r]){i=e[r],s=n[r];break}return i<s?-1:s<i?1:0},t.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},t.concat=function(e,n){if(!Z(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return t.alloc(0);var i;if(void 0===n)for(n=0,i=0;i<e.length;++i)n+=e[i].length;var s=t.allocUnsafe(n),r=0;for(i=0;i<e.length;++i){var o=e[i];if(!t.isBuffer(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(s,r),r+=o.length}return s},t.byteLength=E,t.prototype._isBuffer=!0,t.prototype.swap16=function(){var t=this.length;if(t%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)y(this,e,e+1);return this},t.prototype.swap32=function(){var t=this.length;if(t%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)y(this,e,e+3),y(this,e+1,e+2);return this},t.prototype.swap64=function(){var t=this.length;if(t%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)y(this,e,e+7),y(this,e+1,e+6),y(this,e+2,e+5),y(this,e+3,e+4);return this},t.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?I(this,0,t):_.apply(this,arguments)},t.prototype.equals=function(e){if(!t.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===t.compare(this,e)},t.prototype.inspect=function(){var t="",n=e.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(t+=" ... ")),"<Buffer "+t+">"},t.prototype.compare=function(e,n,i,s,r){if(!t.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===n&&(n=0),void 0===i&&(i=e?e.length:0),void 0===s&&(s=0),void 0===r&&(r=this.length),n<0||i>e.length||s<0||r>this.length)throw new RangeError("out of range index");if(s>=r&&n>=i)return 0;if(s>=r)return-1;if(n>=i)return 1;if(n>>>=0,i>>>=0,s>>>=0,r>>>=0,this===e)return 0;for(var o=r-s,u=i-n,h=Math.min(o,u),a=this.slice(s,r),c=e.slice(n,i),l=0;l<h;++l)if(a[l]!==c[l]){o=a[l],u=c[l];break}return o<u?-1:u<o?1:0},t.prototype.includes=function(t,e,n){return this.indexOf(t,e,n)!==-1},t.prototype.indexOf=function(t,e,n){return v(this,t,e,n,!0)},t.prototype.lastIndexOf=function(t,e,n){return v(this,t,e,n,!1)},t.prototype.write=function(t,e,n,i){if(void 0===e)i="utf8",n=this.length,e=0;else if(void 0===n&&"string"==typeof e)i=e,n=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e|=0,isFinite(n)?(n|=0,void 0===i&&(i="utf8")):(i=n,n=void 0)}var s=this.length-e;if((void 0===n||n>s)&&(n=s),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var r=!1;;)switch(i){case"hex":return b(this,t,e,n);case"utf8":case"utf-8":return A(this,t,e,n);case"ascii":return T(this,t,e,n);case"latin1":case"binary":return R(this,t,e,n);case"base64":return M(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return D(this,t,e,n);default:if(r)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),r=!0}},t.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var tt=4096;t.prototype.slice=function(e,n){var i=this.length;e=~~e,n=void 0===n?i:~~n,e<0?(e+=i,e<0&&(e=0)):e>i&&(e=i),n<0?(n+=i,n<0&&(n=0)):n>i&&(n=i),n<e&&(n=e);var s;if(t.TYPED_ARRAY_SUPPORT)s=this.subarray(e,n),s.__proto__=t.prototype;else{var r=n-e;s=new t(r,void 0);for(var o=0;o<r;++o)s[o]=this[o+e]}return s},t.prototype.readUIntLE=function(t,e,n){t|=0,e|=0,n||N(t,e,this.length);for(var i=this[t],s=1,r=0;++r<e&&(s*=256);)i+=this[t+r]*s;return i},t.prototype.readUIntBE=function(t,e,n){t|=0,e|=0,n||N(t,e,this.length);for(var i=this[t+--e],s=1;e>0&&(s*=256);)i+=this[t+--e]*s;return i},t.prototype.readUInt8=function(t,e){return e||N(t,1,this.length),this[t]},t.prototype.readUInt16LE=function(t,e){return e||N(t,2,this.length),this[t]|this[t+1]<<8},t.prototype.readUInt16BE=function(t,e){return e||N(t,2,this.length),this[t]<<8|this[t+1]},t.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]},t.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])},t.prototype.readIntLE=function(t,e,n){t|=0,e|=0,n||N(t,e,this.length);for(var i=this[t],s=1,r=0;++r<e&&(s*=256);)i+=this[t+r]*s;return s*=128,i>=s&&(i-=Math.pow(2,8*e)),i},t.prototype.readIntBE=function(t,e,n){t|=0,e|=0,n||N(t,e,this.length);for(var i=e,s=1,r=this[t+--i];i>0&&(s*=256);)r+=this[t+--i]*s;return s*=128,r>=s&&(r-=Math.pow(2,8*e)),r},t.prototype.readInt8=function(t,e){return e||N(t,1,this.length),128&this[t]?(255-this[t]+1)*-1:this[t]},t.prototype.readInt16LE=function(t,e){e||N(t,2,this.length);var n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},t.prototype.readInt16BE=function(t,e){e||N(t,2,this.length);var n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},t.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},t.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]},t.prototype.readFloatLE=function(t,e){return e||N(t,4,this.length),Q.read(this,t,!0,23,4)},t.prototype.readFloatBE=function(t,e){return e||N(t,4,this.length),Q.read(this,t,!1,23,4)},t.prototype.readDoubleLE=function(t,e){return e||N(t,8,this.length),Q.read(this,t,!0,52,8)},t.prototype.readDoubleBE=function(t,e){return e||N(t,8,this.length),Q.read(this,t,!1,52,8)},t.prototype.writeUIntLE=function(t,e,n,i){if(t=+t,e|=0,n|=0,!i){var s=Math.pow(2,8*n)-1;O(this,t,e,n,s,0)}var r=1,o=0;for(this[e]=255&t;++o<n&&(r*=256);)this[e+o]=t/r&255;return e+n},t.prototype.writeUIntBE=function(t,e,n,i){if(t=+t,e|=0,n|=0,!i){var s=Math.pow(2,8*n)-1;O(this,t,e,n,s,0)}var r=n-1,o=1;for(this[e+r]=255&t;--r>=0&&(o*=256);)this[e+r]=t/o&255;return e+n},t.prototype.writeUInt8=function(e,n,i){return e=+e,n|=0,i||O(this,e,n,1,255,0),t.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[n]=255&e,n+1},t.prototype.writeUInt16LE=function(e,n,i){return e=+e,n|=0,i||O(this,e,n,2,65535,0),t.TYPED_ARRAY_SUPPORT?(this[n]=255&e,this[n+1]=e>>>8):x(this,e,n,!0),n+2},t.prototype.writeUInt16BE=function(e,n,i){return e=+e,n|=0,i||O(this,e,n,2,65535,0),t.TYPED_ARRAY_SUPPORT?(this[n]=e>>>8,this[n+1]=255&e):x(this,e,n,!1),n+2},t.prototype.writeUInt32LE=function(e,n,i){return e=+e,n|=0,i||O(this,e,n,4,4294967295,0),t.TYPED_ARRAY_SUPPORT?(this[n+3]=e>>>24,this[n+2]=e>>>16,this[n+1]=e>>>8,this[n]=255&e):G(this,e,n,!0),n+4},t.prototype.writeUInt32BE=function(e,n,i){return e=+e,n|=0,i||O(this,e,n,4,4294967295,0),t.TYPED_ARRAY_SUPPORT?(this[n]=e>>>24,this[n+1]=e>>>16,this[n+2]=e>>>8,this[n+3]=255&e):G(this,e,n,!1),n+4},t.prototype.writeIntLE=function(t,e,n,i){if(t=+t,e|=0,!i){var s=Math.pow(2,8*n-1);O(this,t,e,n,s-1,-s)}var r=0,o=1,u=0;for(this[e]=255&t;++r<n&&(o*=256);)t<0&&0===u&&0!==this[e+r-1]&&(u=1),this[e+r]=(t/o>>0)-u&255;return e+n},t.prototype.writeIntBE=function(t,e,n,i){if(t=+t,e|=0,!i){var s=Math.pow(2,8*n-1);O(this,t,e,n,s-1,-s)}var r=n-1,o=1,u=0;for(this[e+r]=255&t;--r>=0&&(o*=256);)t<0&&0===u&&0!==this[e+r+1]&&(u=1),this[e+r]=(t/o>>0)-u&255;return e+n},t.prototype.writeInt8=function(e,n,i){return e=+e,n|=0,i||O(this,e,n,1,127,-128),t.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[n]=255&e,n+1},t.prototype.writeInt16LE=function(e,n,i){return e=+e,n|=0,i||O(this,e,n,2,32767,-32768),t.TYPED_ARRAY_SUPPORT?(this[n]=255&e,this[n+1]=e>>>8):x(this,e,n,!0),n+2},t.prototype.writeInt16BE=function(e,n,i){return e=+e,n|=0,i||O(this,e,n,2,32767,-32768),t.TYPED_ARRAY_SUPPORT?(this[n]=e>>>8,this[n+1]=255&e):x(this,e,n,!1),n+2},t.prototype.writeInt32LE=function(e,n,i){return e=+e,n|=0,i||O(this,e,n,4,2147483647,-2147483648),t.TYPED_ARRAY_SUPPORT?(this[n]=255&e,this[n+1]=e>>>8,this[n+2]=e>>>16,this[n+3]=e>>>24):G(this,e,n,!0),n+4},t.prototype.writeInt32BE=function(e,n,i){return e=+e,n|=0,i||O(this,e,n,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),t.TYPED_ARRAY_SUPPORT?(this[n]=e>>>24,this[n+1]=e>>>16,this[n+2]=e>>>8,this[n+3]=255&e):G(this,e,n,!1),n+4},t.prototype.writeFloatLE=function(t,e,n){return j(this,t,e,!0,n)},t.prototype.writeFloatBE=function(t,e,n){return j(this,t,e,!1,n)},t.prototype.writeDoubleLE=function(t,e,n){return q(this,t,e,!0,n)},t.prototype.writeDoubleBE=function(t,e,n){return q(this,t,e,!1,n)},t.prototype.copy=function(e,n,i,s){if(i||(i=0),s||0===s||(s=this.length),n>=e.length&&(n=e.length),n||(n=0),s>0&&s<i&&(s=i),s===i)return 0;if(0===e.length||0===this.length)return 0;if(n<0)throw new RangeError("targetStart out of bounds");if(i<0||i>=this.length)throw new RangeError("sourceStart out of bounds");if(s<0)throw new RangeError("sourceEnd out of bounds");s>this.length&&(s=this.length),e.length-n<s-i&&(s=e.length-n+i);var r,o=s-i;if(this===e&&i<n&&n<s)for(r=o-1;r>=0;--r)e[r+n]=this[r+i];else if(o<1e3||!t.TYPED_ARRAY_SUPPORT)for(r=0;r<o;++r)e[r+n]=this[r+i];else Uint8Array.prototype.set.call(e,this.subarray(i,i+o),n);return o},t.prototype.fill=function(e,n,i,s){if("string"==typeof e){if("string"==typeof n?(s=n,n=0,i=this.length):"string"==typeof i&&(s=i,i=this.length),1===e.length){var r=e.charCodeAt(0);r<256&&(e=r)}if(void 0!==s&&"string"!=typeof s)throw new TypeError("encoding must be a string");if("string"==typeof s&&!t.isEncoding(s))throw new TypeError("Unknown encoding: "+s)}else"number"==typeof e&&(e&=255);if(n<0||this.length<n||this.length<i)throw new RangeError("Out of range index");if(i<=n)return this;n>>>=0,i=void 0===i?this.length:i>>>0,e||(e=0);var o;if("number"==typeof e)for(o=n;o<i;++o)this[o]=e;else{var u=t.isBuffer(e)?e:Y(new t(e,s).toString()),h=u.length;for(o=0;o<i-n;++o)this[o+n]=u[o%h]}return this};var et=/[^+\/0-9A-Za-z-_]/g}).call(e,n(15).Buffer,n(61))},function(t,e){function n(){throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}function s(t){if(c===setTimeout)return setTimeout(t,0);if((c===n||!c)&&setTimeout)return c=setTimeout,setTimeout(t,0);try{return c(t,0)}catch(e){try{return c.call(null,t,0)}catch(e){return c.call(this,t,0)}}}function r(t){if(l===clearTimeout)return clearTimeout(t);if((l===i||!l)&&clearTimeout)return l=clearTimeout,clearTimeout(t);try{return l(t)}catch(e){try{return l.call(null,t)}catch(e){return l.call(this,t)}}}function o(){m&&d&&(m=!1,d.length?p=d.concat(p):g=-1,p.length&&u())}function u(){if(!m){var t=s(o);m=!0;for(var e=p.length;e;){for(d=p,p=[];++g<e;)d&&d[g].run();g=-1,e=p.length}d=null,m=!1,r(t)}}function h(t,e){this.fun=t,this.array=e}function a(){}var c,l,f=t.exports={};!function(){try{c="function"==typeof setTimeout?setTimeout:n}catch(t){c=n}try{l="function"==typeof clearTimeout?clearTimeout:i}catch(t){l=i}}();var d,p=[],m=!1,g=-1;f.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];p.push(new h(t,e)),1!==p.length||m||s(u)},h.prototype.run=function(){this.fun.apply(null,this.array)},f.title="browser",f.browser=!0,f.env={},f.argv=[],f.version="",f.versions={},f.on=a,f.addListener=a,f.once=a,f.off=a,f.removeListener=a,f.removeAllListeners=a,f.emit=a,f.binding=function(t){throw new Error("process.binding is not supported")},f.cwd=function(){return"/"},f.chdir=function(t){throw new Error("process.chdir is not supported")},f.umask=function(){return 0}},function(t,e,n){const i=n(0);class s{constructor(t,e){this.member=t,this.raw=e}serialize(){const t={};for(const e in i.PermissionFlags)t[e]=this.hasPermission(e);return t}hasPermission(t,e=false){return t=this.member.client.resolver.resolvePermission(t),!e&&(this.raw&i.PermissionFlags.ADMINISTRATOR)>0||(this.raw&t)>0}hasPermissions(t,e=false){return t.every(t=>this.hasPermission(t,e))}missingPermissions(t,e=false){return t.filter(t=>!this.hasPermission(t,e))}}t.exports=s},function(t,e,n){const i=n(5),s=n(7),r=n(9),o=n(6).Presence,u=n(12),h=n(0),a=n(3),c=n(4),l=n(24);class f{constructor(t,e){this.client=t,Object.defineProperty(this,"client",{enumerable:!1,configurable:!1}),this.members=new a,this.channels=new a,this.roles=new a,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=t.large||this.large,this.presences=new a,this.features=t.features,this.emojis=new a;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.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 s(this,e);this.roles.set(t.id,t)}}if(t.presences)for(const n of t.presences)this._setPresence(n.user.id,n);if(this._rawVoiceStates=new a,t.voice_states)for(const i of t.voice_states){this._rawVoiceStates.set(i.user_id,i);const t=this.members.get(i.user_id);t&&(t.serverMute=i.mute,t.serverDeaf=i.deaf,t.selfMute=i.self_mute,t.selfDeaf=i.self_deaf,t.voiceSessionID=i.session_id,t.voiceChannelID=i.channel_id,this.channels.get(i.channel_id).members.set(t.user.id,t))}}get createdTimestamp(){return this.id/4194304+14200704e5}get createdAt(){return new Date(this.createdTimestamp)}get joinedAt(){return new Date(this.joinedTimestamp)}get iconURL(){return this.icon?h.Endpoints.guildIcon(this.id,this.icon):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)}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)}fetchMember(t){return this._fetchWaiter?Promise.reject(new Error("Already fetching guild members.")):(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):Promise.reject(new Error("User is not cached. Use Client.fetchUser first.")))}fetchMembers(t=""){return new Promise((e,n)=>{if(this._fetchWaiter)throw new Error("Already fetching guild members in ${this.id}.");return this.memberCount===this.members.size?void e(this):(this._fetchWaiter=e,this.client.ws.send({op:h.OPCodes.REQUEST_GUILD_MEMBERS,d:{guild_id:this.id,query:t,limit:0}}),this._checkChunks(),void this.client.setTimeout(()=>n(new Error("Members didn't arrive in time.")),12e4))})}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){return this.client.rest.methods.createChannel(this,t,e)}createRole(t){const e=this.client.rest.methods.createGuildRole(this);return t?e.then(e=>e.edit(t)):e}createEmoji(t,e){return new Promise(n=>{t.startsWith("data:")?n(this.client.rest.methods.createEmoji(this,t,e)):this.client.resolver.resolveBuffer(t).then(t=>n(this.client.rest.methods.createEmoji(this,t,e)))})}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)}setRolePosition(t,e){if(t instanceof s)t=t.id;else if("string"!=typeof t)return Promise.reject(new Error("Supplied role is not a role or string"));if(e=Number(e),isNaN(e))return Promise.reject(new Error("Supplied position is not a number"));const n=this.roles.array().map(n=>({id:n.id,position:n.id===t?e:n.position<e?n.position:n.position+1}));return this.client.rest.methods.setRolePositions(this.id,n)}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&&l(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 n=this.members.has(t.user.id);t.user instanceof i||(t.user=this.client.dataManager.newUser(t.user)),t.joined_at=t.joined_at||0;const s=new u(this,t);if(this.members.set(s.id,s),this._rawVoiceStates&&this._rawVoiceStates.get(s.user.id)){const t=this._rawVoiceStates.get(s.user.id);s.serverMute=t.mute,s.serverDeaf=t.deaf,s.selfMute=t.self_mute,s.selfDeaf=t.self_deaf,s.voiceSessionID=t.session_id,s.voiceChannelID=t.channel_id,this.channels.get(t.channel_id).members.set(s.user.id,s)}return this.client.ws.status===h.Status.READY&&e&&!n&&this.client.emit(h.Events.GUILD_MEMBER_ADD,s),this._checkChunks(),s}_updateMember(t,e){const n=c(t);e.roles&&(t._roles=e.roles),"undefined"!=typeof e.nick&&(t.nickname=e.nick);const i=t.nickname!==n.nickname||!l(t._roles,n._roles);return this.client.ws.status===h.Status.READY&&i&&this.client.emit(h.Events.GUILD_MEMBER_UPDATE,n,t),{old:n,mem:t}}_removeMember(t){this.members.delete(t.id),this._checkChunks()}_memberSpeakUpdate(t,e){const n=this.members.get(t);n&&n.speaking!==e&&(n.speaking=e,this.client.emit(h.Events.GUILD_MEMBER_SPEAKING,n,e))}_setPresence(t,e){return this.presences.get(t)?void this.presences.get(t).update(e):void this.presences.set(t,new o(e))}_checkChunks(){this._fetchWaiter&&this.members.size===this.memberCount&&(this._fetchWaiter(this),this._fetchWaiter=null)}}t.exports=f},function(t,e){class n{constructor(t,e,n){this.reaction=t,this.name=e,this.id=n}get identifier(){return this.id?`${this.name}:${this.id}`:encodeURIComponent(this.name)}toString(){return this.id?`<:${this.name}:${this.id}>`:this.name}}t.exports=n},function(t,e,n){const i=n(22),s=n(14);class r{constructor(t,e,n){t?(this.client=t,Object.defineProperty(this,"client",{enumerable:!1,configurable:!1}),e&&this.setup(e)):(this.id=e,this.token=n,this.client=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=t.user)}sendMessage(t,e={}){return this.client.rest.methods.sendWebhookMessage(this,t,e)}sendSlackMessage(t){return this.client.rest.methods.sendSlackWebhookMessage(this,t)}sendTTSMessage(t,e={}){return Object.assign(e,{tts:!0}),this.client.rest.methods.sendWebhookMessage(this,t,e)}sendFile(t,e,n,s={}){return e||(e="string"==typeof t?i.basename(t):t&&t.path?i.basename(t.path):"file.jpg"),this.client.resolver.resolveBuffer(t).then(t=>this.client.rest.methods.sendWebhookMessage(this,n,s,{
|
||
file:t,name:e}))}sendCode(t,e,n={}){return n.split&&("object"!=typeof n.split&&(n.split={}),n.split.prepend||(n.split.prepend=`\`\`\`${t||""}
|
||
`),n.split.append||(n.split.append="\n```")),e=s(this.client.resolver.resolveString(e),!0),this.sendMessage(`\`\`\`${t||""}
|
||
${e}
|
||
\`\`\``,n)}edit(t=this.name,e){return e?this.client.resolver.resolveBuffer(e).then(e=>{const n=this.client.resolver.resolveBase64(e);return this.client.rest.methods.editWebhook(this,t,n)}):this.client.rest.methods.editWebhook(this,t).then(t=>{return this.setup(t),this})}delete(){return this.client.rest.methods.deleteWebhook(this)}}t.exports=r},function(t,e){function n(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function i(t){return"function"==typeof t}function s(t){return"number"==typeof t}function r(t){return"object"==typeof t&&null!==t}function o(t){return void 0===t}t.exports=n,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._maxListeners=void 0,n.defaultMaxListeners=10,n.prototype.setMaxListeners=function(t){if(!s(t)||t<0||isNaN(t))throw TypeError("n must be a positive number");return this._maxListeners=t,this},n.prototype.emit=function(t){var e,n,s,u,h,a;if(this._events||(this._events={}),"error"===t&&(!this._events.error||r(this._events.error)&&!this._events.error.length)){if(e=arguments[1],e instanceof Error)throw e;var c=new Error('Uncaught, unspecified "error" event. ('+e+")");throw c.context=e,c}if(n=this._events[t],o(n))return!1;if(i(n))switch(arguments.length){case 1:n.call(this);break;case 2:n.call(this,arguments[1]);break;case 3:n.call(this,arguments[1],arguments[2]);break;default:u=Array.prototype.slice.call(arguments,1),n.apply(this,u)}else if(r(n))for(u=Array.prototype.slice.call(arguments,1),a=n.slice(),s=a.length,h=0;h<s;h++)a[h].apply(this,u);return!0},n.prototype.addListener=function(t,e){var s;if(!i(e))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",t,i(e.listener)?e.listener:e),this._events[t]?r(this._events[t])?this._events[t].push(e):this._events[t]=[this._events[t],e]:this._events[t]=e,r(this._events[t])&&!this._events[t].warned&&(s=o(this._maxListeners)?n.defaultMaxListeners:this._maxListeners,s&&s>0&&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},n.prototype.on=n.prototype.addListener,n.prototype.once=function(t,e){function n(){this.removeListener(t,n),s||(s=!0,e.apply(this,arguments))}if(!i(e))throw TypeError("listener must be a function");var s=!1;return n.listener=e,this.on(t,n),this},n.prototype.removeListener=function(t,e){var n,s,o,u;if(!i(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(n=this._events[t],o=n.length,s=-1,n===e||i(n.listener)&&n.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(r(n)){for(u=o;u-- >0;)if(n[u]===e||n[u].listener&&n[u].listener===e){s=u;break}if(s<0)return this;1===n.length?(n.length=0,delete this._events[t]):n.splice(s,1),this._events.removeListener&&this.emit("removeListener",t,e)}return this},n.prototype.removeAllListeners=function(t){var e,n;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(n=this._events[t],i(n))this.removeListener(t,n);else if(n)for(;n.length;)this.removeListener(t,n[n.length-1]);return delete this._events[t],this},n.prototype.listeners=function(t){var e;return e=this._events&&this._events[t]?i(this._events[t])?[this._events[t]]:this._events[t].slice():[]},n.prototype.listenerCount=function(t){if(this._events){var e=this._events[t];if(i(e))return 1;if(e)return e.length}return 0},n.listenerCount=function(t,e){return t.listenerCount(e)}},function(t,e,n){(function(t){function n(t,e){for(var n=0,i=t.length-1;i>=0;i--){var s=t[i];"."===s?t.splice(i,1):".."===s?(t.splice(i,1),n++):n&&(t.splice(i,1),n--)}if(e)for(;n--;n)t.unshift("..");return t}function i(t,e){if(t.filter)return t.filter(e);for(var n=[],i=0;i<t.length;i++)e(t[i],i,t)&&n.push(t[i]);return n}var s=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,r=function(t){return s.exec(t).slice(1)};e.resolve=function(){for(var e="",s=!1,r=arguments.length-1;r>=-1&&!s;r--){var o=r>=0?arguments[r]:t.cwd();if("string"!=typeof o)throw new TypeError("Arguments to path.resolve must be strings");o&&(e=o+"/"+e,s="/"===o.charAt(0))}return e=n(i(e.split("/"),function(t){return!!t}),!s).join("/"),(s?"/":"")+e||"."},e.normalize=function(t){var s=e.isAbsolute(t),r="/"===o(t,-1);return t=n(i(t.split("/"),function(t){return!!t}),!s).join("/"),t||s||(t="."),t&&r&&(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(i(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,n){function i(t){for(var e=0;e<t.length&&""===t[e];e++);for(var n=t.length-1;n>=0&&""===t[n];n--);return e>n?[]:t.slice(e,n-e+1)}t=e.resolve(t).substr(1),n=e.resolve(n).substr(1);for(var s=i(t.split("/")),r=i(n.split("/")),o=Math.min(s.length,r.length),u=o,h=0;h<o;h++)if(s[h]!==r[h]){u=h;break}for(var a=[],h=u;h<s.length;h++)a.push("..");return a=a.concat(r.slice(u)),a.join("/")},e.sep="/",e.delimiter=":",e.dirname=function(t){var e=r(t),n=e[0],i=e[1];return n||i?(i&&(i=i.substr(0,i.length-1)),n+i):"."},e.basename=function(t,e){var n=r(t)[2];return e&&n.substr(-1*e.length)===e&&(n=n.substr(0,n.length-e.length)),n},e.extname=function(t){return r(t)[3]};var o="b"==="ab".substr(-1)?function(t,e,n){return t.substr(e,n)}:function(t,e,n){return e<0&&(e=t.length+e),t.substr(e,n)}}).call(e,n(16))},function(t,e,n){function i(){}function s(t){if(!E(t))return t;var e=[];for(var n in t)r(e,n,t[n]);return e.join("&")}function r(t,e,n){if(null!=n)if(Array.isArray(n))n.forEach(function(n){r(t,e,n)});else if(E(n))for(var i in n)r(t,e+"["+i+"]",n[i]);else t.push(encodeURIComponent(e)+"="+encodeURIComponent(n));else null===n&&t.push(encodeURIComponent(e))}function o(t){for(var e,n,i={},s=t.split("&"),r=0,o=s.length;r<o;++r)e=s[r],n=e.indexOf("="),n==-1?i[decodeURIComponent(e)]="":i[decodeURIComponent(e.slice(0,n))]=decodeURIComponent(e.slice(n+1));return i}function u(t){var e,n,i,s,r=t.split(/\r?\n/),o={};r.pop();for(var u=0,h=r.length;u<h;++u)n=r[u],e=n.indexOf(":"),i=n.slice(0,e).toLowerCase(),s=y(n.slice(e+1)),o[i]=s;return o}function h(t){return/[\/+]json\b/.test(t)}function a(t){return t.split(/ *; */).shift()}function c(t){return t.split(/ *; */).reduce(function(t,e){var n=e.split(/ *= */),i=n.shift(),s=n.shift();return i&&s&&(t[i]=s),t},{})}function l(t,e){e=e||{},this.req=t,this.xhr=this.req.xhr,this.text="HEAD"!=this.req.method&&(""===this.xhr.responseType||"text"===this.xhr.responseType)||"undefined"==typeof this.xhr.responseType?this.xhr.responseText:null,this.statusText=this.req.xhr.statusText,this._setStatusProperties(this.xhr.status),this.header=this.headers=u(this.xhr.getAllResponseHeaders()),this.header["content-type"]=this.xhr.getResponseHeader("content-type"),this._setHeaderProperties(this.header),this.body="HEAD"!=this.req.method?this._parseBody(this.text?this.text:this.xhr.response):null}function f(t,e){var n=this;this._query=this._query||[],this.method=t,this.url=e,this.header={},this._header={},this.on("end",function(){var t=null,e=null;try{e=new l(n)}catch(e){return t=new Error("Parser is unable to parse the response"),t.parse=!0,t.original=e,n.xhr?(t.rawResponse="undefined"==typeof n.xhr.responseType?n.xhr.responseText:n.xhr.response,t.statusCode=n.xhr.status?n.xhr.status:null):(t.rawResponse=null,t.statusCode=null),n.callback(t)}n.emit("response",e);var i;try{(e.status<200||e.status>=300)&&(i=new Error(e.statusText||"Unsuccessful HTTP response"),i.original=t,i.response=e,i.status=e.status)}catch(t){i=t}i?n.callback(i,e):n.callback(null,e)})}function d(t,e){var n=_("DELETE",t);return e&&n.end(e),n}var p;"undefined"!=typeof window?p=window:"undefined"!=typeof self?p=self:(console.warn("Using browser-only version of superagent in non-browser environment"),p=this);var m=n(56),g=n(59),E=n(42),_=t.exports=n(60).bind(null,f);_.getXHR=function(){if(!(!p.XMLHttpRequest||p.location&&"file:"==p.location.protocol&&p.ActiveXObject))return new XMLHttpRequest;try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(t){}try{return new ActiveXObject("Msxml2.XMLHTTP.6.0")}catch(t){}try{return new ActiveXObject("Msxml2.XMLHTTP.3.0")}catch(t){}try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(t){}throw Error("Browser-only verison of superagent could not find XHR")};var y="".trim?function(t){return t.trim()}:function(t){return t.replace(/(^\s*|\s*$)/g,"")};_.serializeObject=s,_.parseString=o,_.types={html:"text/html",json:"application/json",xml:"application/xml",urlencoded:"application/x-www-form-urlencoded",form:"application/x-www-form-urlencoded","form-data":"application/x-www-form-urlencoded"},_.serialize={"application/x-www-form-urlencoded":s,"application/json":JSON.stringify},_.parse={"application/x-www-form-urlencoded":o,"application/json":JSON.parse},l.prototype.get=function(t){return this.header[t.toLowerCase()]},l.prototype._setHeaderProperties=function(t){var e=this.header["content-type"]||"";this.type=a(e);var n=c(e);for(var i in n)this[i]=n[i]},l.prototype._parseBody=function(t){var e=_.parse[this.type];return!e&&h(this.type)&&(e=_.parse["application/json"]),e&&t&&(t.length||t instanceof Object)?e(t):null},l.prototype._setStatusProperties=function(t){1223===t&&(t=204);var e=t/100|0;this.status=this.statusCode=t,this.statusType=e,this.info=1==e,this.ok=2==e,this.clientError=4==e,this.serverError=5==e,this.error=(4==e||5==e)&&this.toError(),this.accepted=202==t,this.noContent=204==t,this.badRequest=400==t,this.unauthorized=401==t,this.notAcceptable=406==t,this.notFound=404==t,this.forbidden=403==t},l.prototype.toError=function(){var t=this.req,e=t.method,n=t.url,i="cannot "+e+" "+n+" ("+this.status+")",s=new Error(i);return s.status=this.status,s.method=e,s.url=n,s},_.Response=l,m(f.prototype),g(f.prototype),f.prototype.type=function(t){return this.set("Content-Type",_.types[t]||t),this},f.prototype.responseType=function(t){return this._responseType=t,this},f.prototype.accept=function(t){return this.set("Accept",_.types[t]||t),this},f.prototype.auth=function(t,e,n){switch(n||(n={type:"basic"}),n.type){case"basic":var i=btoa(t+":"+e);this.set("Authorization","Basic "+i);break;case"auto":this.username=t,this.password=e}return this},f.prototype.query=function(t){return"string"!=typeof t&&(t=s(t)),t&&this._query.push(t),this},f.prototype.attach=function(t,e,n){if(this._data)throw Error("superagent can't mix .send() and .attach()");return this._getFormData().append(t,e,n||e.name),this},f.prototype._getFormData=function(){return this._formData||(this._formData=new p.FormData),this._formData},f.prototype.callback=function(t,e){var n=this._callback;this.clearTimeout(),t&&this.emit("error",t),n(t,e)},f.prototype.crossDomainError=function(){var t=new Error("Request has been terminated\nPossible causes: the network is offline, Origin is not allowed by Access-Control-Allow-Origin, the page is being unloaded, etc.");t.crossDomain=!0,t.status=this.status,t.method=this.method,t.url=this.url,this.callback(t)},f.prototype.buffer=f.prototype.ca=f.prototype.agent=function(){return console.warn("This is not supported in browser version of superagent"),this},f.prototype.pipe=f.prototype.write=function(){throw Error("Streaming is not supported in browser version of superagent")},f.prototype._timeoutError=function(){var t=this._timeout,e=new Error("timeout of "+t+"ms exceeded");e.timeout=t,this.callback(e)},f.prototype._appendQueryString=function(){var t=this._query.join("&");t&&(this.url+=~this.url.indexOf("?")?"&"+t:"?"+t)},f.prototype._isHost=function(t){return t&&"object"==typeof t&&!Array.isArray(t)&&"[object Object]"!==Object.prototype.toString.call(t)},f.prototype.end=function(t){var e=this,n=this.xhr=_.getXHR(),s=this._timeout,r=this._formData||this._data;this._callback=t||i,n.onreadystatechange=function(){if(4==n.readyState){var t;try{t=n.status}catch(e){t=0}if(0==t){if(e.timedout)return e._timeoutError();if(e._aborted)return;return e.crossDomainError()}e.emit("end")}};var o=function(t,n){n.total>0&&(n.percent=n.loaded/n.total*100),n.direction=t,e.emit("progress",n)};if(this.hasListeners("progress"))try{n.onprogress=o.bind(null,"download"),n.upload&&(n.upload.onprogress=o.bind(null,"upload"))}catch(t){}if(s&&!this._timer&&(this._timer=setTimeout(function(){e.timedout=!0,e.abort()},s)),this._appendQueryString(),this.username&&this.password?n.open(this.method,this.url,!0,this.username,this.password):n.open(this.method,this.url,!0),this._withCredentials&&(n.withCredentials=!0),"GET"!=this.method&&"HEAD"!=this.method&&"string"!=typeof r&&!this._isHost(r)){var u=this._header["content-type"],a=this._serializer||_.serialize[u?u.split(";")[0]:""];!a&&h(u)&&(a=_.serialize["application/json"]),a&&(r=a(r))}for(var c in this.header)null!=this.header[c]&&n.setRequestHeader(c,this.header[c]);return this._responseType&&(n.responseType=this._responseType),this.emit("request",this),n.send("undefined"!=typeof r?r:null),this},_.Request=f,_.get=function(t,e,n){var i=_("GET",t);return"function"==typeof e&&(n=e,e=null),e&&i.query(e),n&&i.end(n),i},_.head=function(t,e,n){var i=_("HEAD",t);return"function"==typeof e&&(n=e,e=null),e&&i.send(e),n&&i.end(n),i},_.options=function(t,e,n){var i=_("OPTIONS",t);return"function"==typeof e&&(n=e,e=null),e&&i.send(e),n&&i.end(n),i},_.del=d,_.delete=d,_.patch=function(t,e,n){var i=_("PATCH",t);return"function"==typeof e&&(n=e,e=null),e&&i.send(e),n&&i.end(n),i},_.post=function(t,e,n){var i=_("POST",t);return"function"==typeof e&&(n=e,e=null),e&&i.send(e),n&&i.end(n),i},_.put=function(t,e,n){var i=_("PUT",t);return"function"==typeof e&&(n=e,e=null),e&&i.send(e),n&&i.end(n),i}},function(t,e){t.exports=function(t,e){if(t===e)return!0;if(t.length!==e.length)return!1;for(const n in t){const i=t[n],s=e.indexOf(i);s&&e.splice(s,1)}return 0===e.length}},function(t,e){t.exports={name:"discord.js",version:"10.0.1",description:"A powerful library for interacting with the Discord API",main:"./src/index",scripts:{test:"eslint src && node docs/generator test",docs:"node docs/generator","test-docs":"node docs/generator test",lint:"eslint src","web-dist":"node ./node_modules/parallel-webpack/bin/run.js"},repository:{type:"git",url:"git+https://github.com/hydrabolt/discord.js.git"},keywords:["discord","api","bot","client","node","discordapp"],author:"Amish Shah <amishshah.2k@gmail.com>",license:"Apache-2.0",bugs:{url:"https://github.com/hydrabolt/discord.js/issues"},homepage:"https://github.com/hydrabolt/discord.js#readme",dependencies:{superagent:"^3.0.0",tweetnacl:"^0.14.3",ws:"^1.1.1"},peerDependencies:{"node-opus":"^0.2.0",opusscript:"^0.0.1"},devDependencies:{bufferutil:"^1.2.1",eslint:"^3.10.0","jsdoc-to-markdown":"^2.0.0","json-loader":"^0.5.4","parallel-webpack":"^1.5.0","uglify-js":"github:mishoo/UglifyJS2#harmony","utf-8-validate":"^1.2.1",webpack:"2.1.0-beta.27",zlibjs:"github:imaya/zlib.js"},engines:{node:">=6.0.0"},browser:{"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/player/BasePlayer.js":!1,"src/client/voice/player/DefaultPlayer.js":!1,"src/client/voice/receiver/VoiceReadable.js":!1,"src/client/voice/receiver/VoiceReceiver.js":!1,"src/client/voice/util/SecretKey.js":!1,"src/client/voice/ClientVoiceManager.js":!1,"src/client/voice/VoiceConnection.js":!1,"src/client/voice/VoiceUDPClient.js":!1,"src/client/voice/VoiceWebSocket.js":!1}}},function(t,e,n){const i=n(5),s=n(35);class r extends s{setup(t){super.setup(t),this.flags=t.flags,this.owner=new i(this.client,t.owner)}}t.exports=r},function(t,e,n){const i=n(5),s=n(3);class r extends i{setup(t){super.setup(t),this.verified=t.verified,this.email=t.email,this.localPresence={},this._typing=new Map,this.friends=new s,this.blocked=new s,this.notes=new s}edit(t){return this.client.rest.methods.updateCurrentUser(t)}setUsername(t){return this.client.rest.methods.updateCurrentUser({username:t})}setEmail(t){return this.client.rest.methods.updateCurrentUser({email:t})}setPassword(t){return this.client.rest.methods.updateCurrentUser({password:t})}setAvatar(t){return t.startsWith("data:")?this.client.rest.methods.updateCurrentUser({avatar:t}):this.client.resolver.resolveBuffer(t).then(t=>this.client.rest.methods.updateCurrentUser({avatar:t}))}setStatus(t){return this.setPresence({status:t})}setGame(t,e){return this.setPresence({game:{name:t,url:e}})}setAFK(t){return this.setPresence({afk: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,n=null){return n?n.startsWith("data:")?this.client.rest.methods.createGuild({name:t,icon:n,region:e}):this.client.resolver.resolveBuffer(n).then(n=>this.client.rest.methods.createGuild({name:t,icon:n,region:e})):this.client.rest.methods.createGuild({name:t,icon:n,region:e})}setPresence(t){return new Promise(e=>{let n=this.localPresence.status||this.presence.status,i=this.localPresence.game,s=this.localPresence.afk||this.presence.afk;if(!i&&this.presence.game&&(i={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");n=t.status}t.game&&(i=t.game,i.url&&(i.type=1)),"undefined"!=typeof t.afk&&(s=t.afk),s=Boolean(s),this.localPresence={status:n,game:i,afk:s},this.localPresence.since=0,this.localPresence.game=this.localPresence.game||null,this.client.ws.send({op:3,d:this.localPresence}),this.client._setPresence(this.id,this.localPresence),e(this)})}}t.exports=r},function(t,e,n){const i=n(8),s=n(10),r=n(3);class o extends i{constructor(t,e){super(t,e),this.type="dm",this.messages=new r,this._typing=new Map}setup(t){super.setup(t),this.recipient=this.client.dataManager.newUser(t.recipients[0]),this.lastMessageID=t.last_message_id}toString(){return this.recipient.toString()}sendMessage(){}sendTTSMessage(){}sendFile(){}sendCode(){}fetchMessage(){}fetchMessages(){}fetchPinnedMessages(){}startTyping(){}stopTyping(){}get typing(){}get typingCount(){}createCollector(){}awaitMessages(){}bulkDelete(){}_cacheMessage(){}}s.applyToClass(o,!0),t.exports=o},function(t,e,n){const i=n(8),s=n(10),r=n(3),o=n(24);class u extends i{constructor(t,e){super(t,e),this.type="group",this.messages=new r,this._typing=new Map}setup(t){if(super.setup(t),this.name=t.name,this.icon=t.icon,this.ownerID=t.owner_id,this.recipients||(this.recipients=new r),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;if(e){const e=this.recipients.keyArray(),n=t.recipients.keyArray();return o(e,n)}return e}toString(){return this.name}sendMessage(){}sendTTSMessage(){}sendFile(){}sendCode(){}fetchMessage(){}fetchMessages(){}fetchPinnedMessages(){}startTyping(){}stopTyping(){}get typing(){}get typingCount(){}createCollector(){}awaitMessages(){}bulkDelete(){}_cacheMessage(){}}s.applyToClass(u,!0),t.exports=u},function(t,e,n){const i=n(36),s=n(37),r=n(0);class o{constructor(t,e){this.client=t,Object.defineProperty(this,"client",{enumerable:!1,configurable:!1}),this.setup(e)}setup(t){this.guild=this.client.guilds.get(t.guild.id)||new i(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 r.Endpoints.inviteLink(this.code)}delete(){return this.client.rest.methods.deleteInvite(this)}toString(){return this.url}}t.exports=o},function(t,e){class n{constructor(t,e){this.client=t.client,Object.defineProperty(this,"client",{enumerable:!1,configurable:!1}),this.message=t,this.setup(e)}setup(t){this.id=t.id,this.filename=t.filename,this.filesize=t.size,this.url=t.url,this.proxyURL=t.proxy_url,this.height=t.height,this.width=t.width}}t.exports=n},function(t,e,n){const i=n(21).EventEmitter,s=n(3);class r extends i{constructor(t,e,n={}){super(),this.channel=t,this.filter=e,this.options=n,this.ended=!1,this.collected=new s,this.listener=(t=>this.verify(t)),this.channel.client.on("message",this.listener),n.time&&this.channel.client.setTimeout(()=>this.stop("time"),n.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 n=()=>{this.removeListener("message",i),this.removeListener("end",s)},i=(...e)=>{n(),t(...e)},s=(...t)=>{n(),e(...t)};this.once("message",i),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=r},function(t,e){class n{constructor(t,e){this.client=t.client,Object.defineProperty(this,"client",{enumerable:!1,configurable:!1}),this.message=t,this.setup(e)}setup(t){if(this.title=t.title,this.type=t.type,this.description=t.description,this.url=t.url,this.fields=[],t.fields)for(const e of t.fields)this.fields.push(new o(this,e));this.createdTimestamp=t.timestamp,this.thumbnail=t.thumbnail?new i(this,t.thumbnail):null,this.author=t.author?new r(this,t.author):null,this.provider=t.provider?new s(this,t.provider):null,this.footer=t.footer?new u(this,t.footer):null}get createdAt(){return new Date(this.createdTimestamp)}}class i{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.name=t.name,this.url=t.url}}class r{constructor(t,e){this.embed=t,this.setup(e)}setup(t){this.name=t.name,this.url=t.url}}class o{constructor(t,e){this.embed=t,this.setup(e)}setup(t){this.name=t.name,this.value=t.value,this.inline=t.inline}}class u{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}}n.Thumbnail=i,n.Provider=s,n.Author=r,n.Field=o,n.Footer=u,t.exports=n},function(t,e,n){const i=n(3),s=n(9),r=n(19);class o{constructor(t,e,n,s){this.message=t,this.me=s,this.count=n||0,this.users=new i,this._emoji=new r(this,e.name,e.id)}get emoji(){if(this._emoji instanceof s)return this._emoji;if(this._emoji.id){const t=this.message.client.emojis;if(t.has(this._emoji.id)){const e=t.get(this._emoji.id);return this._emoji=e,e}}return this._emoji}remove(t=this.message.client.user){const e=this.message;return t=this.message.client.resolver.resolveUserID(t),t?e.client.rest.methods.removeMessageReaction(e,this.emoji.identifier,t):Promise.reject("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 i;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,t})}}t.exports=o},function(t,e){class n{constructor(t,e){this.client=t,Object.defineProperty(this,"client",{enumerable:!1,configurable:!1}),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}get createdTimestamp(){return this.id/4194304+14200704e5}get createdAt(){return new Date(this.createdTimestamp)}toString(){return this.name}}t.exports=n},function(t,e){class n{constructor(t,e){this.client=t,Object.defineProperty(this,"client",{enumerable:!1,configurable:!1}),this.setup(e)}setup(t){this.id=t.id,this.name=t.name,this.icon=t.icon,this.splash=t.splash}}t.exports=n},function(t,e,n){const i=n(0);class s{constructor(t,e){this.client=t,Object.defineProperty(this,"client",{enumerable:!1,configurable:!1}),this.setup(e)}setup(t){this.id=t.id,this.name=t.name,this.type=i.ChannelTypes.text===t.type?"text":"voice"}}t.exports=s},function(t,e){class n{constructor(t,e){this.channel=t,e&&this.setup(e)}setup(t){this.id=t.id,this.type=t.type,this.denyData=t.deny,this.allowData=t.allow}delete(){return this.channel.client.rest.methods.deletePermissionOverwrites(this)}}t.exports=n},function(t,e,n){const i=n(11),s=n(10),r=n(3);class o extends i{constructor(t,e){super(t,e),this.type="text",this.messages=new r,this._typing=new Map}setup(t){super.setup(t),this.topic=t.topic,this.lastMessageID=t.last_message_id}get members(){const t=new r;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(n=>{e.startsWith("data:")?n(this.client.rest.methods.createWebhook(this,t,e)):this.client.resolver.resolveBuffer(e).then(e=>n(this.client.rest.methods.createWebhook(this,t,e)))})}sendMessage(){}sendTTSMessage(){}sendFile(){}sendCode(){}fetchMessage(){}fetchMessages(){}fetchPinnedMessages(){}startTyping(){}stopTyping(){}get typing(){}get typingCount(){}createCollector(){}awaitMessages(){}bulkDelete(){}_cacheMessage(){}}s.applyToClass(o,!0),t.exports=o},function(t,e,n){const i=n(11),s=n(3);class r extends i{constructor(t,e){super(t,e),this.members=new s,this.type="voice"}setup(t){super.setup(t),this.bitrate=t.bitrate,this.userLimit=t.user_limit}get connection(){const t=this.guild.voiceConnection;return t&&t.channel.id===this.id?t:null}get joinable(){return!this.client.browser&&this.permissionsFor(this.client.user).hasPermission("CONNECT")}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=r},function(t,e){t.exports=function(t,{maxLength=1950,char="\n",prepend="",append=""}={}){if(t.length<=maxLength)return t;const e=t.split(char);if(1===e.length)throw new Error("Message exceeds the max length and contains no split characters.");const n=[""];let i=0;for(let s=0;s<e.length;s++)n[i].length+e[s].length+1>maxLength&&(n[i]+=append,n.push(prepend),i++),n[i]+=(n[i].length>0&&n[i]!==prepend?char:"")+e[s];return n}},function(t,e){function n(t){return null!==t&&"object"==typeof t}t.exports=n},function(t,e){},function(t,e,n){(function(e){const i=n(22),s=n(43),r=n(23),o=n(0),u=n(47),h=n(5),a=n(13),c=n(18),l=n(8),f=n(12),d=n(9),p=n(19);class m{constructor(t){this.client=t}resolveUser(t){return t instanceof h?t:"string"==typeof t?this.client.users.get(t)||null:t instanceof f?t.user:t instanceof a?t.author:t instanceof c?t.owner:null}resolveUserID(t){return t instanceof h||t instanceof f?t.id:"string"==typeof t?t||null:t instanceof a?t.author.id:t instanceof c?t.ownerID:null}resolveGuild(t){return t instanceof c?t:"string"==typeof t?this.client.guilds.get(t)||null:null}resolveGuildMember(t,e){return e instanceof f?e:(t=this.resolveGuild(t),e=this.resolveUser(e),t&&e?t.members.get(e.id)||null:null)}resolveChannel(t){return t instanceof l?t:t instanceof a?t.channel:t instanceof c?t.channels.get(t.id)||null:"string"==typeof t?this.client.channels.get(t)||null:null}resolveInviteCode(t){const e=/discord(?:app)?\.(?:gg|com\/invite)\/([a-z0-9]{5})/i,n=e.exec(t);return n&&n[1]?n[1]:t}resolvePermission(t){if("string"==typeof t&&(t=o.PermissionFlags[t]),"number"!=typeof t||t<1)throw new Error(o.Errors.NOT_A_PERMISSION);return 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(u(t)):"string"==typeof t?new Promise((n,o)=>{if(/^https?:\/\//.test(t)){const i=r.get(t).set("Content-Type","blob");this.client.browser&&i.responseType("arraybuffer"),i.end((t,i)=>{return t?o(t):this.client.browser?n(u(i.xhr.response)):i.body instanceof e?n(i.body):o(new TypeError("Body is not a Buffer"))})}else{const e=i.resolve(t);s.stat(e,(t,i)=>{if(t&&o(t),!i||!i.isFile())throw new Error(`The file could not be found: ${e}`);s.readFile(e,(t,e)=>{t?o(t):n(e)})})}}):Promise.reject(new TypeError("The resource must be a string or Buffer."))}resolveEmojiIdentifier(t){return t instanceof d||t instanceof p?t.identifier:"string"!=typeof t||t.includes("%")?null:encodeURIComponent(t)}}t.exports=m}).call(e,n(15).Buffer)},function(t,e,n){const i=n(96),s=n(93),r=n(95),o=n(94),u=n(92),h=n(0);class a{constructor(t){this.client=t,this.handlers={},this.userAgentManager=new i(this),this.methods=new s(this),this.rateLimitedEndpoints={},this.globallyRateLimited=!1}push(t,e){return new Promise((n,i)=>{t.push({request:e,resolve:n,reject:i})})}getRequestHandler(){switch(this.client.options.apiRequestMethod){case"sequential":return r;case"burst":return o;default:throw new Error(h.Errors.INVALID_RATE_LIMIT_METHOD)}}makeRequest(t,e,n,i,s){const r=new u(this,t,e,n,i,s);if(!this.handlers[r.route]){const t=this.getRequestHandler();this.handlers[r.route]=new t(this,r.route)}return this.push(this.handlers[r.route],r)}}t.exports=a},function(t,e){class n{constructor(t){this.restManager=t,this.queue=[]}get globalLimit(){return this.restManager.globallyRateLimited}set globalLimit(t){this.restManager.globallyRateLimited=t}push(t){this.queue.push(t)}handle(){}}t.exports=n},function(t,e,n){(function(e){function n(t){const n=new e(t.byteLength),i=new Uint8Array(t);for(var s=0;s<n.length;++s)n[s]=i[s];return n}function i(t){const e=new ArrayBuffer(2*t.length),n=new Uint16Array(e);for(var i=0,s=t.length;i<s;i++)n[i]=t.charCodeAt(i);return e}t.exports=function(t){return"string"==typeof t&&(t=i(t)),n(t)}}).call(e,n(15).Buffer)},function(t,e){t.exports=function t(e,n){if(!n)return e;for(const i in e)({}).hasOwnProperty.call(n,i)?n[i]===Object(n[i])&&(n[i]=t(e[i],n[i])):n[i]=e[i];return n}},function(module,exports,__webpack_require__){(function(process){const EventEmitter=__webpack_require__(21).EventEmitter,mergeDefault=__webpack_require__(48),Constants=__webpack_require__(0),RESTManager=__webpack_require__(45),ClientDataManager=__webpack_require__(63),ClientManager=__webpack_require__(64),ClientDataResolver=__webpack_require__(44),ClientVoiceManager=__webpack_require__(137),WebSocketManager=__webpack_require__(97),ActionsManager=__webpack_require__(65),Collection=__webpack_require__(3),Presence=__webpack_require__(6).Presence,ShardClientUtil=__webpack_require__(136);
|
||
class Client extends EventEmitter{constructor(t={}){super(),this.browser="undefined"!=typeof window,!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=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.email=null,this.password=null,this.user=null,this.readyAt=null,this._timeouts=new Set,this._intervals=new Set,this.options.messageSweepInterval>0&&this.setInterval(this.sweepMessages.bind(this),1e3*this.options.messageSweepInterval)}get status(){return this.ws.status}get uptime(){return this.readyAt?Date.now()-this.readyAt:null}get voiceConnections(){return this.browser?new Collection:this.voice.connections}get emojis(){const t=new Collection;for(const e of this.guilds.values())for(const n of e.emojis.values())t.set(n.id,n);return t}get readyTimestamp(){return this.readyAt?this.readyAt.getTime():null}login(t,e=null){return e?this.rest.methods.loginEmailPassword(t,e):this.rest.methods.loginToken(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.token=null,this.email=null,this.password=null,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){return this.users.has(t)?Promise.resolve(this.users.get(t)):this.rest.methods.getUser(t)}fetchInvite(t){const e=this.resolver.resolveInviteCode(t);return this.rest.methods.getInvite(e)}fetchWebhook(t,e){return this.rest.methods.getWebhook(t,e)}sweepMessages(t=this.options.messageCacheLifetime){if("number"!=typeof t||isNaN(t))throw new TypeError("The lifetime must be a number.");if(t<=0)return this.emit("debug","Didn't sweep messages - lifetime is unlimited"),-1;const e=1e3*t,n=Date.now();let i=0,s=0;for(const r of this.channels.values())if(r.messages){i++;for(const t of r.messages.values())n-(t.editedTimestamp||t.createdTimestamp)>e&&(r.messages.delete(t.id),s++)}return this.emit("debug",`Swept ${s} messages older than ${t} seconds in ${i} text-based channels`),s}fetchApplication(){if(!this.user.bot)throw new Error(Constants.Errors.NO_BOT_ACCOUNT);return this.rest.methods.getMyApplication()}setTimeout(t,e,...n){const i=setTimeout(()=>{t(),this._timeouts.delete(i)},e,...n);return this._timeouts.add(i),i}clearTimeout(t){clearTimeout(t),this._timeouts.delete(t)}setInterval(t,e,...n){const i=setInterval(t,e,...n);return this._intervals.add(i),i}clearInterval(t){clearInterval(t),this._intervals.delete(t)}_setPresence(t,e){return this.presences.get(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__(16))},function(t,e,n){const i=n(20),s=n(45),r=n(44),o=n(48),u=n(0);class h extends i{constructor(t,e,n){super(null,t,e),this.options=o(u.DefaultOptions,n),this.rest=new s(this),this.resolver=new r(this)}}t.exports=h},function(t,e,n){const i=n(23),s=n(0).Endpoints.botGateway;t.exports=function(t){return new Promise((e,n)=>{if(!t)throw new Error("A token must be provided.");i.get(s).set("Authorization",`Bot ${t.replace(/^Bot\s*/i,"")}`).end((t,i)=>{t&&n(t),e(i.body.shards)})})}},function(t,e){},function(t,e){},function(t,e){},function(t,e){"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 i(t){return 3*t.length/4-n(t)}function s(t){var e,i,s,r,o,u,h=t.length;o=n(t),u=new c(3*h/4-o),s=o>0?h-4:h;var l=0;for(e=0,i=0;e<s;e+=4,i+=3)r=a[t.charCodeAt(e)]<<18|a[t.charCodeAt(e+1)]<<12|a[t.charCodeAt(e+2)]<<6|a[t.charCodeAt(e+3)],u[l++]=r>>16&255,u[l++]=r>>8&255,u[l++]=255&r;return 2===o?(r=a[t.charCodeAt(e)]<<2|a[t.charCodeAt(e+1)]>>4,u[l++]=255&r):1===o&&(r=a[t.charCodeAt(e)]<<10|a[t.charCodeAt(e+1)]<<4|a[t.charCodeAt(e+2)]>>2,u[l++]=r>>8&255,u[l++]=255&r),u}function r(t){return h[t>>18&63]+h[t>>12&63]+h[t>>6&63]+h[63&t]}function o(t,e,n){for(var i,s=[],o=e;o<n;o+=3)i=(t[o]<<16)+(t[o+1]<<8)+t[o+2],s.push(r(i));return s.join("")}function u(t){for(var e,n=t.length,i=n%3,s="",r=[],u=16383,a=0,c=n-i;a<c;a+=u)r.push(o(t,a,a+u>c?c:a+u));return 1===i?(e=t[n-1],s+=h[e>>2],s+=h[e<<4&63],s+="=="):2===i&&(e=(t[n-2]<<8)+t[n-1],s+=h[e>>10],s+=h[e>>4&63],s+=h[e<<2&63],s+="="),r.push(s),r.join("")}e.byteLength=i,e.toByteArray=s,e.fromByteArray=u;for(var h=[],a=[],c="undefined"!=typeof Uint8Array?Uint8Array:Array,l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",f=0,d=l.length;f<d;++f)h[f]=l[f],a[l.charCodeAt(f)]=f;a["-".charCodeAt(0)]=62,a["_".charCodeAt(0)]=63},function(t,e,n){function i(t){if(t)return s(t)}function s(t){for(var e in i.prototype)t[e]=i.prototype[e];return t}t.exports=i,i.prototype.on=i.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this},i.prototype.once=function(t,e){function n(){this.off(t,n),e.apply(this,arguments)}return n.fn=e,this.on(t,n),this},i.prototype.off=i.prototype.removeListener=i.prototype.removeAllListeners=i.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n=this._callbacks["$"+t];if(!n)return this;if(1==arguments.length)return delete this._callbacks["$"+t],this;for(var i,s=0;s<n.length;s++)if(i=n[s],i===e||i.fn===e){n.splice(s,1);break}return this},i.prototype.emit=function(t){this._callbacks=this._callbacks||{};var e=[].slice.call(arguments,1),n=this._callbacks["$"+t];if(n){n=n.slice(0);for(var i=0,s=n.length;i<s;++i)n[i].apply(this,e)}return this},i.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]},i.prototype.hasListeners=function(t){return!!this.listeners(t).length}},function(t,e){e.read=function(t,e,n,i,s){var r,o,u=8*s-i-1,h=(1<<u)-1,a=h>>1,c=-7,l=n?s-1:0,f=n?-1:1,d=t[e+l];for(l+=f,r=d&(1<<-c)-1,d>>=-c,c+=u;c>0;r=256*r+t[e+l],l+=f,c-=8);for(o=r&(1<<-c)-1,r>>=-c,c+=i;c>0;o=256*o+t[e+l],l+=f,c-=8);if(0===r)r=1-a;else{if(r===h)return o?NaN:(d?-1:1)*(1/0);o+=Math.pow(2,i),r-=a}return(d?-1:1)*o*Math.pow(2,r-i)},e.write=function(t,e,n,i,s,r){var o,u,h,a=8*r-s-1,c=(1<<a)-1,l=c>>1,f=23===s?Math.pow(2,-24)-Math.pow(2,-77):0,d=i?0:r-1,p=i?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(u=isNaN(e)?1:0,o=c):(o=Math.floor(Math.log(e)/Math.LN2),e*(h=Math.pow(2,-o))<1&&(o--,h*=2),e+=o+l>=1?f/h:f*Math.pow(2,1-l),e*h>=2&&(o++,h/=2),o+l>=c?(u=0,o=c):o+l>=1?(u=(e*h-1)*Math.pow(2,s),o+=l):(u=e*Math.pow(2,l-1)*Math.pow(2,s),o=0));s>=8;t[n+d]=255&u,d+=p,u/=256,s-=8);for(o=o<<s|u,a+=s;a>0;t[n+d]=255&o,d+=p,o/=256,a-=8);t[n+d-p]|=128*m}},function(t,e){var n={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==n.call(t)}},function(t,e,n){function i(t){if(t)return s(t)}function s(t){for(var e in i.prototype)t[e]=i.prototype[e];return t}var r=n(42);t.exports=i,i.prototype.clearTimeout=function(){return this._timeout=0,clearTimeout(this._timer),this},i.prototype.parse=function(t){return this._parser=t,this},i.prototype.serialize=function(t){return this._serializer=t,this},i.prototype.timeout=function(t){return this._timeout=t,this},i.prototype.then=function(t,e){if(!this._fullfilledPromise){var n=this;this._fullfilledPromise=new Promise(function(t,e){n.end(function(n,i){n?e(n):t(i)})})}return this._fullfilledPromise.then(t,e)},i.prototype.catch=function(t){return this.then(void 0,t)},i.prototype.use=function(t){return t(this),this},i.prototype.get=function(t){return this._header[t.toLowerCase()]},i.prototype.getHeader=i.prototype.get,i.prototype.set=function(t,e){if(r(t)){for(var n in t)this.set(n,t[n]);return this}return this._header[t.toLowerCase()]=e,this.header[t]=e,this},i.prototype.unset=function(t){return delete this._header[t.toLowerCase()],delete this.header[t],this},i.prototype.field=function(t,e){if(null===t||void 0===t)throw new Error(".field(name, val) name can not be empty");if(r(t)){for(var n in t)this.field(n,t[n]);return this}if(null===e||void 0===e)throw new Error(".field(name, val) val can not be empty");return this._getFormData().append(t,e),this},i.prototype.abort=function(){return this._aborted?this:(this._aborted=!0,this.xhr&&this.xhr.abort(),this.req&&this.req.abort(),this.clearTimeout(),this.emit("abort"),this)},i.prototype.withCredentials=function(){return this._withCredentials=!0,this},i.prototype.redirects=function(t){return this._maxRedirects=t,this},i.prototype.toJSON=function(){return{method:this.method,url:this.url,data:this._data,headers:this._header}},i.prototype.send=function(t){var e=r(t),n=this._header["content-type"];if(e&&!this._data)Array.isArray(t)?this._data=[]:this._isHost(t)||(this._data={});else if(t&&this._data&&this._isHost(this._data))throw Error("Can't merge these send calls");if(e&&r(this._data))for(var i in t)this._data[i]=t[i];else"string"==typeof t?(n||this.type("form"),n=this._header["content-type"],"application/x-www-form-urlencoded"==n?this._data=this._data?this._data+"&"+t:t:this._data=(this._data||"")+t):this._data=t;return!e||this._isHost(t)?this:(n||this.type("json"),this)}},function(t,e){function n(t,e,n){return"function"==typeof n?new t("GET",e).end(n):2==arguments.length?new t("GET",e):new t(e,n)}t.exports=n},function(t,e){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e,n){(function(t,n){/** @license zlib.js 2012 - imaya [ https://github.com/imaya/zlib.js ] The MIT License */(function(){"use strict";function i(t){throw t}function s(t,e){this.index="number"==typeof e?e:0,this.m=0,this.buffer=t instanceof(O?Uint8Array:Array)?t:new(O?Uint8Array:Array)(32768),2*this.buffer.length<=this.index&&i(Error("invalid index")),this.buffer.length<=this.index&&this.f()}function r(t,e,n){var i,s="number"==typeof e?e:e=0,r="number"==typeof n?n:t.length;for(i=-1,s=7&r;s--;++e)i=i>>>8^V[255&(i^t[e])];for(s=r>>3;s--;e+=8)i=i>>>8^V[255&(i^t[e])],i=i>>>8^V[255&(i^t[e+1])],i=i>>>8^V[255&(i^t[e+2])],i=i>>>8^V[255&(i^t[e+3])],i=i>>>8^V[255&(i^t[e+4])],i=i>>>8^V[255&(i^t[e+5])],i=i>>>8^V[255&(i^t[e+6])],i=i>>>8^V[255&(i^t[e+7])];return(4294967295^i)>>>0}function o(){}function u(t){this.buffer=new(O?Uint16Array:Array)(2*t),this.length=0}function h(t){var e,n,i,s,r,o,u,h,a,c,l=t.length,f=0,d=Number.POSITIVE_INFINITY;for(h=0;h<l;++h)t[h]>f&&(f=t[h]),t[h]<d&&(d=t[h]);for(e=1<<f,n=new(O?Uint32Array:Array)(e),i=1,s=0,r=2;i<=f;){for(h=0;h<l;++h)if(t[h]===i){for(o=0,u=s,a=0;a<i;++a)o=o<<1|1&u,u>>=1;for(c=i<<16|h,a=o;a<e;a+=r)n[a]=c;++s}++i,s<<=1,r<<=1}return[n,f,d]}function a(t,e){this.k=F,this.F=0,this.input=O&&t instanceof Array?new Uint8Array(t):t,this.b=0,e&&(e.lazy&&(this.F=e.lazy),"number"==typeof e.compressionType&&(this.k=e.compressionType),e.outputBuffer&&(this.a=O&&e.outputBuffer instanceof Array?new Uint8Array(e.outputBuffer):e.outputBuffer),"number"==typeof e.outputIndex&&(this.b=e.outputIndex)),this.a||(this.a=new(O?Uint8Array:Array)(32768))}function c(t,e){this.length=t,this.O=e}function l(t,e){function n(t,e){var n,s=t.O,r=[],o=0;n=J[t.length],r[o++]=65535&n,r[o++]=n>>16&255,r[o++]=n>>24;var u;switch(N){case 1===s:u=[0,s-1,0];break;case 2===s:u=[1,s-2,0];break;case 3===s:u=[2,s-3,0];break;case 4===s:u=[3,s-4,0];break;case 6>=s:u=[4,s-5,1];break;case 8>=s:u=[5,s-7,1];break;case 12>=s:u=[6,s-9,2];break;case 16>=s:u=[7,s-13,2];break;case 24>=s:u=[8,s-17,3];break;case 32>=s:u=[9,s-25,3];break;case 48>=s:u=[10,s-33,4];break;case 64>=s:u=[11,s-49,4];break;case 96>=s:u=[12,s-65,5];break;case 128>=s:u=[13,s-97,5];break;case 192>=s:u=[14,s-129,6];break;case 256>=s:u=[15,s-193,6];break;case 384>=s:u=[16,s-257,7];break;case 512>=s:u=[17,s-385,7];break;case 768>=s:u=[18,s-513,8];break;case 1024>=s:u=[19,s-769,8];break;case 1536>=s:u=[20,s-1025,9];break;case 2048>=s:u=[21,s-1537,9];break;case 3072>=s:u=[22,s-2049,10];break;case 4096>=s:u=[23,s-3073,10];break;case 6144>=s:u=[24,s-4097,11];break;case 8192>=s:u=[25,s-6145,11];break;case 12288>=s:u=[26,s-8193,12];break;case 16384>=s:u=[27,s-12289,12];break;case 24576>=s:u=[28,s-16385,13];break;case 32768>=s:u=[29,s-24577,13];break;default:i("invalid distance")}n=u,r[o++]=n[0],r[o++]=n[1],r[o++]=n[2];var h,a;for(h=0,a=r.length;h<a;++h)m[g++]=r[h];_[r[0]]++,y[r[3]]++,E=t.length+e-1,l=null}var s,r,o,u,h,a,c,l,d,p={},m=O?new Uint16Array(2*e.length):[],g=0,E=0,_=new(O?Uint32Array:Array)(286),y=new(O?Uint32Array:Array)(30),v=t.F;if(!O){for(o=0;285>=o;)_[o++]=0;for(o=0;29>=o;)y[o++]=0}for(_[256]=1,s=0,r=e.length;s<r;++s){for(o=h=0,u=3;o<u&&s+o!==r;++o)h=h<<8|e[s+o];if(p[h]===P&&(p[h]=[]),a=p[h],!(0<E--)){for(;0<a.length&&32768<s-a[0];)a.shift();if(s+3>=r){for(l&&n(l,-1),o=0,u=r-s;o<u;++o)d=e[s+o],m[g++]=d,++_[d];break}0<a.length?(c=f(e,s,a),l?l.length<c.length?(d=e[s-1],m[g++]=d,++_[d],n(c,0)):n(l,-1):c.length<v?l=c:n(c,0)):l?n(l,-1):(d=e[s],m[g++]=d,++_[d])}a.push(s)}return m[g++]=256,_[256]++,t.V=_,t.U=y,O?m.subarray(0,g):m}function f(t,e,n){var i,s,r,o,u,h,a=0,l=t.length;o=0,h=n.length;t:for(;o<h;o++){if(i=n[h-o-1],r=3,3<a){for(u=a;3<u;u--)if(t[i+u-1]!==t[e+u-1])continue t;r=a}for(;258>r&&e+r<l&&t[i+r]===t[e+r];)++r;if(r>a&&(s=i,a=r),258===r)break}return new c(a,e-s)}function d(t,e){var n,i,s,r,o,h=t.length,a=new u(572),c=new(O?Uint8Array:Array)(h);if(!O)for(r=0;r<h;r++)c[r]=0;for(r=0;r<h;++r)0<t[r]&&a.push(r,t[r]);if(n=Array(a.length/2),i=new(O?Uint32Array:Array)(a.length/2),1===n.length)return c[a.pop().index]=1,c;for(r=0,o=a.length/2;r<o;++r)n[r]=a.pop(),i[r]=n[r].value;for(s=p(i,i.length,e),r=0,o=n.length;r<o;++r)c[n[r].index]=s[r];return c}function p(t,e,n){function i(t){var n=d[t][p[t]];n===e?(i(t+1),i(t+1)):--l[n],++p[t]}var s,r,o,u,h,a=new(O?Uint16Array:Array)(n),c=new(O?Uint8Array:Array)(n),l=new(O?Uint8Array:Array)(e),f=Array(n),d=Array(n),p=Array(n),m=(1<<n)-e,g=1<<n-1;for(a[n-1]=e,r=0;r<n;++r)m<g?c[r]=0:(c[r]=1,m-=g),m<<=1,a[n-2-r]=(a[n-1-r]/2|0)+e;for(a[0]=c[0],f[0]=Array(a[0]),d[0]=Array(a[0]),r=1;r<n;++r)a[r]>2*a[r-1]+c[r]&&(a[r]=2*a[r-1]+c[r]),f[r]=Array(a[r]),d[r]=Array(a[r]);for(s=0;s<e;++s)l[s]=n;for(o=0;o<a[n-1];++o)f[n-1][o]=t[o],d[n-1][o]=o;for(s=0;s<n;++s)p[s]=0;for(1===c[n-1]&&(--l[0],++p[n-1]),r=n-2;0<=r;--r){for(u=s=0,h=p[r+1],o=0;o<a[r];o++)u=f[r+1][h]+f[r+1][h+1],u>t[s]?(f[r][o]=u,d[r][o]=e,h+=2):(f[r][o]=t[s],d[r][o]=s,++s);p[r]=0,1===c[r]&&i(r)}return l}function m(t){var e,n,i,s,r=new(O?Uint16Array:Array)(t.length),o=[],u=[],h=0;for(e=0,n=t.length;e<n;e++)o[t[e]]=(0|o[t[e]])+1;for(e=1,n=16;e<=n;e++)u[e]=h,h+=0|o[e],h<<=1;for(e=0,n=t.length;e<n;e++)for(h=u[t[e]],u[t[e]]+=1,i=r[e]=0,s=t[e];i<s;i++)r[e]=r[e]<<1|1&h,h>>>=1;return r}function g(t,e){this.input=t,this.b=this.c=0,this.g={},e&&(e.flags&&(this.g=e.flags),"string"==typeof e.filename&&(this.filename=e.filename),"string"==typeof e.comment&&(this.w=e.comment),e.deflateOptions&&(this.l=e.deflateOptions)),this.l||(this.l={})}function E(t,e){switch(this.o=[],this.p=32768,this.e=this.j=this.c=this.s=0,this.input=O?new Uint8Array(t):t,this.u=!1,this.q=nt,this.L=!1,!e&&(e={})||(e.index&&(this.c=e.index),e.bufferSize&&(this.p=e.bufferSize),e.bufferType&&(this.q=e.bufferType),e.resize&&(this.L=e.resize)),this.q){case et:this.b=32768,this.a=new(O?Uint8Array:Array)(32768+this.p+258);break;case nt:this.b=0,this.a=new(O?Uint8Array:Array)(this.p),this.f=this.T,this.z=this.P,this.r=this.R;break;default:i(Error("invalid inflate mode"))}}function _(t,e){for(var n,s=t.j,r=t.e,o=t.input,u=t.c,h=o.length;r<e;)u>=h&&i(Error("input buffer is broken")),s|=o[u++]<<r,r+=8;return n=s&(1<<e)-1,t.j=s>>>e,t.e=r-e,t.c=u,n}function y(t,e){for(var n,i,s=t.j,r=t.e,o=t.input,u=t.c,h=o.length,a=e[0],c=e[1];r<c&&!(u>=h);)s|=o[u++]<<r,r+=8;return n=a[s&(1<<c)-1],i=n>>>16,t.j=s>>i,t.e=r-i,t.c=u,65535&n}function v(t){function e(t,e,n){var i,s,r,o=this.I;for(r=0;r<t;)switch(i=y(this,e)){case 16:for(s=3+_(this,2);s--;)n[r++]=o;break;case 17:for(s=3+_(this,3);s--;)n[r++]=0;o=0;break;case 18:for(s=11+_(this,7);s--;)n[r++]=0;o=0;break;default:o=n[r++]=i}return this.I=o,n}var n,i,s,r,o=_(t,5)+257,u=_(t,5)+1,a=_(t,4)+4,c=new(O?Uint8Array:Array)(ot.length);for(r=0;r<a;++r)c[ot[r]]=_(t,3);if(!O)for(r=a,a=c.length;r<a;++r)c[ot[r]]=0;n=h(c),i=new(O?Uint8Array:Array)(o),s=new(O?Uint8Array:Array)(u),t.I=0,t.r(h(e.call(t,o,n,i)),h(e.call(t,u,n,s)))}function w(t){this.input=t,this.c=0,this.G=[],this.S=!1}function b(t){if("string"==typeof t){var e,n,i=t.split("");for(e=0,n=i.length;e<n;e++)i[e]=(255&i[e].charCodeAt(0))>>>0;t=i}for(var s,r=1,o=0,u=t.length,h=0;0<u;){s=1024<u?1024:u,u-=s;do r+=t[h++],o+=r;while(--s);r%=65521,o%=65521}return(o<<16|r)>>>0}function A(t,e){var n,s;switch(this.input=t,this.c=0,!e&&(e={})||(e.index&&(this.c=e.index),e.verify&&(this.W=e.verify)),n=t[this.c++],s=t[this.c++],15&n){case wt:this.method=wt;break;default:i(Error("unsupported compression method"))}0!==((n<<8)+s)%31&&i(Error("invalid fcheck flag:"+((n<<8)+s)%31)),32&s&&i(Error("fdict flag is not supported")),this.K=new E(t,{index:this.c,bufferSize:e.bufferSize,bufferType:e.bufferType,resize:e.resize})}function T(t,e){this.input=t,this.a=new(O?Uint8Array:Array)(32768),this.k=bt.t;var n,i={};!e&&(e={})||"number"!=typeof e.compressionType||(this.k=e.compressionType);for(n in e)i[n]=e[n];i.outputBuffer=this.a,this.J=new a(this.input,i)}function R(e,n,i){t.nextTick(function(){var t,s;try{s=M(e,i)}catch(e){t=e}n(t,s)})}function M(t,e){var n;return n=new T(t).h(),e||(e={}),e.H?n:L(n)}function D(e,n,i){t.nextTick(function(){var t,s;try{s=S(e,i)}catch(e){t=e}n(t,s)})}function S(t,e){var n;return t.subarray=t.slice,n=new A(t).i(),e||(e={}),e.noBuffer?n:L(n)}function I(e,n,i){t.nextTick(function(){var t,s;try{s=C(e,i)}catch(e){t=e}n(t,s)})}function C(t,e){var n;return t.subarray=t.slice,n=new g(t).h(),e||(e={}),e.H?n:L(n)}function k(e,n,i){t.nextTick(function(){var t,s;try{s=U(e,i)}catch(e){t=e}n(t,s)})}function U(t,e){var n;return t.subarray=t.slice,n=new w(t).i(),e||(e={}),e.H?n:L(n)}function L(t){var e,i,s=new n(t.length);for(e=0,i=t.length;e<i;++e)s[e]=t[e];return s}var P=void 0,N=!0,O="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array&&"undefined"!=typeof DataView;s.prototype.f=function(){var t,e=this.buffer,n=e.length,i=new(O?Uint8Array:Array)(n<<1);if(O)i.set(e);else for(t=0;t<n;++t)i[t]=e[t];return this.buffer=i},s.prototype.d=function(t,e,n){var i,s=this.buffer,r=this.index,o=this.m,u=s[r];if(n&&1<e&&(t=8<e?(W[255&t]<<24|W[t>>>8&255]<<16|W[t>>>16&255]<<8|W[t>>>24&255])>>32-e:W[t]>>8-e),8>e+o)u=u<<e|t,o+=e;else for(i=0;i<e;++i)u=u<<1|t>>e-i-1&1,8===++o&&(o=0,s[r++]=W[u],u=0,r===s.length&&(s=this.f()));s[r]=u,this.buffer=s,this.m=o,this.index=r},s.prototype.finish=function(){var t,e=this.buffer,n=this.index;return 0<this.m&&(e[n]<<=8-this.m,e[n]=W[e[n]],n++),O?t=e.subarray(0,n):(e.length=n,t=e),t};var x,G=new(O?Uint8Array:Array)(256);for(x=0;256>x;++x){for(var B=x,j=B,q=7,B=B>>>1;B;B>>>=1)j<<=1,j|=1&B,--q;G[x]=(j<<q&255)>>>0}var W=G,H=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117],V=O?new Uint32Array(H):H;u.prototype.getParent=function(t){return 2*((t-2)/4|0)},u.prototype.push=function(t,e){var n,i,s,r=this.buffer;for(n=this.length,r[this.length++]=e,r[this.length++]=t;0<n&&(i=this.getParent(n),r[n]>r[i]);)s=r[n],r[n]=r[i],r[i]=s,s=r[n+1],r[n+1]=r[i+1],r[i+1]=s,n=i;return this.length},u.prototype.pop=function(){var t,e,n,i,s,r=this.buffer;for(e=r[0],t=r[1],this.length-=2,r[0]=r[this.length],r[1]=r[this.length+1],s=0;(i=2*s+2,!(i>=this.length))&&(i+2<this.length&&r[i+2]>r[i]&&(i+=2),r[i]>r[s]);)n=r[s],r[s]=r[i],r[i]=n,n=r[s+1],r[s+1]=r[i+1],r[i+1]=n,s=i;return{index:t,value:e,length:this.length}};var Y,F=2,z={NONE:0,M:1,t:F,Y:3},K=[];for(Y=0;288>Y;Y++)switch(N){case 143>=Y:K.push([Y+48,8]);break;case 255>=Y:K.push([Y-144+400,9]);break;case 279>=Y:K.push([Y-256+0,7]);break;case 287>=Y:K.push([Y-280+192,8]);break;default:i("invalid literal: "+Y)}a.prototype.h=function(){var t,e,n,r,o=this.input;switch(this.k){case 0:for(n=0,r=o.length;n<r;){e=O?o.subarray(n,n+65535):o.slice(n,n+65535),n+=e.length;var u=e,h=n===r,a=P,c=P,f=P,p=P,g=P,E=this.a,_=this.b;if(O){for(E=new Uint8Array(this.a.buffer);E.length<=_+u.length+5;)E=new Uint8Array(E.length<<1);E.set(this.a)}if(a=h?1:0,E[_++]=0|a,c=u.length,f=~c+65536&65535,E[_++]=255&c,E[_++]=c>>>8&255,E[_++]=255&f,E[_++]=f>>>8&255,O)E.set(u,_),_+=u.length,E=E.subarray(0,_);else{for(p=0,g=u.length;p<g;++p)E[_++]=u[p];E.length=_}this.b=_,this.a=E}break;case 1:var y=new s(O?new Uint8Array(this.a.buffer):this.a,this.b);y.d(1,1,N),y.d(1,2,N);var v,w,b,A=l(this,o);for(v=0,w=A.length;v<w;v++)if(b=A[v],s.prototype.d.apply(y,K[b]),256<b)y.d(A[++v],A[++v],N),y.d(A[++v],5),y.d(A[++v],A[++v],N);else if(256===b)break;this.a=y.finish(),this.b=this.a.length;break;case F:var T,R,M,D,S,I,C,k,U,L,x,G,B,j,q,W=new s(O?new Uint8Array(this.a.buffer):this.a,this.b),H=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],V=Array(19);for(T=F,W.d(1,1,N),W.d(T,2,N),R=l(this,o),I=d(this.V,15),C=m(I),k=d(this.U,7),U=m(k),M=286;257<M&&0===I[M-1];M--);for(D=30;1<D&&0===k[D-1];D--);var Y,z,$,J,X,Q,Z=M,tt=D,et=new(O?Uint32Array:Array)(Z+tt),nt=new(O?Uint32Array:Array)(316),it=new(O?Uint8Array:Array)(19);for(Y=z=0;Y<Z;Y++)et[z++]=I[Y];for(Y=0;Y<tt;Y++)et[z++]=k[Y];if(!O)for(Y=0,J=it.length;Y<J;++Y)it[Y]=0;for(Y=X=0,J=et.length;Y<J;Y+=z){for(z=1;Y+z<J&&et[Y+z]===et[Y];++z);if($=z,0===et[Y])if(3>$)for(;0<$--;)nt[X++]=0,it[0]++;else for(;0<$;)Q=138>$?$:138,Q>$-3&&Q<$&&(Q=$-3),10>=Q?(nt[X++]=17,nt[X++]=Q-3,it[17]++):(nt[X++]=18,nt[X++]=Q-11,it[18]++),$-=Q;else if(nt[X++]=et[Y],it[et[Y]]++,$--,3>$)for(;0<$--;)nt[X++]=et[Y],it[et[Y]]++;else for(;0<$;)Q=6>$?$:6,Q>$-3&&Q<$&&(Q=$-3),nt[X++]=16,nt[X++]=Q-3,it[16]++,$-=Q}for(t=O?nt.subarray(0,X):nt.slice(0,X),L=d(it,7),j=0;19>j;j++)V[j]=L[H[j]];for(S=19;4<S&&0===V[S-1];S--);for(x=m(L),W.d(M-257,5,N),W.d(D-1,5,N),W.d(S-4,4,N),j=0;j<S;j++)W.d(V[j],3,N);for(j=0,q=t.length;j<q;j++)if(G=t[j],W.d(x[G],L[G],N),16<=G){switch(j++,G){case 16:B=2;break;case 17:B=3;break;case 18:B=7;break;default:i("invalid code: "+G)}W.d(t[j],B,N)}var st,rt,ot,ut,ht,at,ct,lt,ft=[C,I],dt=[U,k];for(ht=ft[0],at=ft[1],ct=dt[0],lt=dt[1],st=0,rt=R.length;st<rt;++st)if(ot=R[st],W.d(ht[ot],at[ot],N),256<ot)W.d(R[++st],R[++st],N),ut=R[++st],W.d(ct[ut],lt[ut],N),W.d(R[++st],R[++st],N);else if(256===ot)break;this.a=W.finish(),this.b=this.a.length;break;default:i("invalid compression type")}return this.a};var $=function(){function t(t){switch(N){case 3===t:return[257,t-3,0];case 4===t:return[258,t-4,0];case 5===t:return[259,t-5,0];case 6===t:return[260,t-6,0];case 7===t:return[261,t-7,0];case 8===t:return[262,t-8,0];case 9===t:return[263,t-9,0];case 10===t:return[264,t-10,0];case 12>=t:return[265,t-11,1];case 14>=t:return[266,t-13,1];case 16>=t:return[267,t-15,1];case 18>=t:return[268,t-17,1];case 22>=t:return[269,t-19,2];case 26>=t:return[270,t-23,2];case 30>=t:return[271,t-27,2];case 34>=t:return[272,t-31,2];case 42>=t:return[273,t-35,3];case 50>=t:return[274,t-43,3];case 58>=t:return[275,t-51,3];case 66>=t:return[276,t-59,3];case 82>=t:return[277,t-67,4];case 98>=t:return[278,t-83,4];case 114>=t:return[279,t-99,4];case 130>=t:return[280,t-115,4];case 162>=t:return[281,t-131,5];case 194>=t:return[282,t-163,5];case 226>=t:return[283,t-195,5];case 257>=t:return[284,t-227,5];case 258===t:return[285,t-258,0];default:i("invalid length: "+t)}}var e,n,s=[];for(e=3;258>=e;e++)n=t(e),s[e]=n[2]<<24|n[1]<<16|n[0];return s}(),J=O?new Uint32Array($):$;g.prototype.h=function(){var t,e,n,i,s,o,u,h,c=new(O?Uint8Array:Array)(32768),l=0,f=this.input,d=this.c,p=this.filename,m=this.w;if(c[l++]=31,c[l++]=139,c[l++]=8,t=0,this.g.fname&&(t|=Z),this.g.fcomment&&(t|=tt),this.g.fhcrc&&(t|=Q),c[l++]=t,e=(Date.now?Date.now():+new Date)/1e3|0,c[l++]=255&e,c[l++]=e>>>8&255,c[l++]=e>>>16&255,c[l++]=e>>>24&255,c[l++]=0,c[l++]=X,this.g.fname!==P){for(u=0,h=p.length;u<h;++u)o=p.charCodeAt(u),255<o&&(c[l++]=o>>>8&255),c[l++]=255&o;c[l++]=0}if(this.g.comment){for(u=0,h=m.length;u<h;++u)o=m.charCodeAt(u),255<o&&(c[l++]=o>>>8&255),c[l++]=255&o;c[l++]=0}return this.g.fhcrc&&(n=65535&r(c,0,l),c[l++]=255&n,c[l++]=n>>>8&255),this.l.outputBuffer=c,this.l.outputIndex=l,s=new a(f,this.l),c=s.h(),l=s.b,O&&(l+8>c.buffer.byteLength?(this.a=new Uint8Array(l+8),this.a.set(new Uint8Array(c.buffer)),c=this.a):c=new Uint8Array(c.buffer)),i=r(f,P,P),c[l++]=255&i,c[l++]=i>>>8&255,c[l++]=i>>>16&255,c[l++]=i>>>24&255,h=f.length,c[l++]=255&h,c[l++]=h>>>8&255,c[l++]=h>>>16&255,c[l++]=h>>>24&255,this.c=d,O&&l<c.length&&(this.a=c=c.subarray(0,l)),c};var X=255,Q=2,Z=8,tt=16,et=0,nt=1;E.prototype.i=function(){for(;!this.u;){var t=_(this,3);switch(1&t&&(this.u=N),t>>>=1){case 0:var e=this.input,n=this.c,s=this.a,r=this.b,o=e.length,u=P,h=P,a=s.length,c=P;switch(this.e=this.j=0,n+1>=o&&i(Error("invalid uncompressed block header: LEN")),u=e[n++]|e[n++]<<8,n+1>=o&&i(Error("invalid uncompressed block header: NLEN")),h=e[n++]|e[n++]<<8,u===~h&&i(Error("invalid uncompressed block header: length verify")),n+u>e.length&&i(Error("input buffer is broken")),this.q){case et:for(;r+u>s.length;){if(c=a-r,u-=c,O)s.set(e.subarray(n,n+c),r),r+=c,n+=c;else for(;c--;)s[r++]=e[n++];this.b=r,s=this.f(),r=this.b}break;case nt:for(;r+u>s.length;)s=this.f({B:2});break;default:i(Error("invalid inflate mode"))}if(O)s.set(e.subarray(n,n+u),r),r+=u,n+=u;else for(;u--;)s[r++]=e[n++];this.c=n,this.b=r,this.a=s;break;case 1:this.r(_t,vt);break;case 2:v(this);break;default:i(Error("unknown BTYPE: "+t))}}return this.z()};var it,st,rt=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],ot=O?new Uint16Array(rt):rt,ut=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,258,258],ht=O?new Uint16Array(ut):ut,at=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0],ct=O?new Uint8Array(at):at,lt=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577],ft=O?new Uint16Array(lt):lt,dt=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],pt=O?new Uint8Array(dt):dt,mt=new(O?Uint8Array:Array)(288);for(it=0,st=mt.length;it<st;++it)mt[it]=143>=it?8:255>=it?9:279>=it?7:8;var gt,Et,_t=h(mt),yt=new(O?Uint8Array:Array)(30);for(gt=0,Et=yt.length;gt<Et;++gt)yt[gt]=5;var vt=h(yt);E.prototype.r=function(t,e){var n=this.a,i=this.b;this.A=t;for(var s,r,o,u,h=n.length-258;256!==(s=y(this,t));)if(256>s)i>=h&&(this.b=i,n=this.f(),i=this.b),n[i++]=s;else for(r=s-257,u=ht[r],0<ct[r]&&(u+=_(this,ct[r])),s=y(this,e),o=ft[s],0<pt[s]&&(o+=_(this,pt[s])),i>=h&&(this.b=i,n=this.f(),i=this.b);u--;)n[i]=n[i++-o];for(;8<=this.e;)this.e-=8,this.c--;this.b=i},E.prototype.R=function(t,e){var n=this.a,i=this.b;this.A=t;for(var s,r,o,u,h=n.length;256!==(s=y(this,t));)if(256>s)i>=h&&(n=this.f(),h=n.length),n[i++]=s;else for(r=s-257,u=ht[r],0<ct[r]&&(u+=_(this,ct[r])),s=y(this,e),o=ft[s],0<pt[s]&&(o+=_(this,pt[s])),i+u>h&&(n=this.f(),h=n.length);u--;)n[i]=n[i++-o];for(;8<=this.e;)this.e-=8,this.c--;this.b=i},E.prototype.f=function(){var t,e,n=new(O?Uint8Array:Array)(this.b-32768),i=this.b-32768,s=this.a;if(O)n.set(s.subarray(32768,n.length));else for(t=0,e=n.length;t<e;++t)n[t]=s[t+32768];
|
||
if(this.o.push(n),this.s+=n.length,O)s.set(s.subarray(i,i+32768));else for(t=0;32768>t;++t)s[t]=s[i+t];return this.b=32768,s},E.prototype.T=function(t){var e,n,i,s,r=this.input.length/this.c+1|0,o=this.input,u=this.a;return t&&("number"==typeof t.B&&(r=t.B),"number"==typeof t.N&&(r+=t.N)),2>r?(n=(o.length-this.c)/this.A[2],s=258*(n/2)|0,i=s<u.length?u.length+s:u.length<<1):i=u.length*r,O?(e=new Uint8Array(i),e.set(u)):e=u,this.a=e},E.prototype.z=function(){var t,e,n,i,s,r=0,o=this.a,u=this.o,h=new(O?Uint8Array:Array)(this.s+(this.b-32768));if(0===u.length)return O?this.a.subarray(32768,this.b):this.a.slice(32768,this.b);for(e=0,n=u.length;e<n;++e)for(t=u[e],i=0,s=t.length;i<s;++i)h[r++]=t[i];for(e=32768,n=this.b;e<n;++e)h[r++]=o[e];return this.o=[],this.buffer=h},E.prototype.P=function(){var t,e=this.b;return O?this.L?(t=new Uint8Array(e),t.set(this.a.subarray(0,e))):t=this.a.subarray(0,e):(this.a.length>e&&(this.a.length=e),t=this.a),this.buffer=t},w.prototype.i=function(){for(var t=this.input.length;this.c<t;){var e=new o,n=P,s=P,u=P,h=P,a=P,c=P,l=P,f=P,d=P,p=this.input,m=this.c;switch(e.C=p[m++],e.D=p[m++],(31!==e.C||139!==e.D)&&i(Error("invalid file signature:"+e.C+","+e.D)),e.v=p[m++],e.v){case 8:break;default:i(Error("unknown compression method: "+e.v))}if(e.n=p[m++],f=p[m++]|p[m++]<<8|p[m++]<<16|p[m++]<<24,e.aa=new Date(1e3*f),e.ca=p[m++],e.ba=p[m++],0<(4&e.n)&&(e.X=p[m++]|p[m++]<<8,m+=e.X),0<(e.n&Z)){for(l=[],c=0;0<(a=p[m++]);)l[c++]=String.fromCharCode(a);e.name=l.join("")}if(0<(e.n&tt)){for(l=[],c=0;0<(a=p[m++]);)l[c++]=String.fromCharCode(a);e.w=l.join("")}0<(e.n&Q)&&(e.Q=65535&r(p,0,m),e.Q!==(p[m++]|p[m++]<<8)&&i(Error("invalid header crc16"))),n=p[p.length-4]|p[p.length-3]<<8|p[p.length-2]<<16|p[p.length-1]<<24,p.length-m-4-4<512*n&&(h=n),s=new E(p,{index:m,bufferSize:h}),e.data=u=s.i(),m=s.c,e.Z=d=(p[m++]|p[m++]<<8|p[m++]<<16|p[m++]<<24)>>>0,r(u,P,P)!==d&&i(Error("invalid CRC-32 checksum: 0x"+r(u,P,P).toString(16)+" / 0x"+d.toString(16))),e.$=n=(p[m++]|p[m++]<<8|p[m++]<<16|p[m++]<<24)>>>0,(4294967295&u.length)!==n&&i(Error("invalid input size: "+(4294967295&u.length)+" / "+n)),this.G.push(e),this.c=m}this.S=N;var g,_,y,v=this.G,w=0,b=0;for(g=0,_=v.length;g<_;++g)b+=v[g].data.length;if(O)for(y=new Uint8Array(b),g=0;g<_;++g)y.set(v[g].data,w),w+=v[g].data.length;else{for(y=[],g=0;g<_;++g)y[g]=v[g].data;y=Array.prototype.concat.apply([],y)}return y},A.prototype.i=function(){var t,e,n=this.input;return t=this.K.i(),this.c=this.K.c,this.W&&(e=(n[this.c++]<<24|n[this.c++]<<16|n[this.c++]<<8|n[this.c++])>>>0,e!==b(t)&&i(Error("invalid adler-32 checksum"))),t};var wt=8,bt=z;T.prototype.h=function(){var t,e,n,s,r,o,u,h=0;switch(u=this.a,t=wt){case wt:e=Math.LOG2E*Math.log(32768)-8;break;default:i(Error("invalid compression method"))}switch(n=e<<4|t,u[h++]=n,t){case wt:switch(this.k){case bt.NONE:r=0;break;case bt.M:r=1;break;case bt.t:r=2;break;default:i(Error("unsupported compression type"))}break;default:i(Error("invalid compression method"))}return s=r<<6|0,u[h++]=s|31-(256*n+s)%31,o=b(this.input),this.J.b=h,u=this.J.h(),h=u.length,O&&(u=new Uint8Array(u.buffer),u.length<=h+4&&(this.a=new Uint8Array(u.length+4),this.a.set(u),u=this.a),u=u.subarray(0,h+4)),u[h++]=o>>24&255,u[h++]=o>>16&255,u[h++]=o>>8&255,u[h++]=255&o,u},e.deflate=R,e.deflateSync=M,e.inflate=D,e.inflateSync=S,e.gzip=I,e.gzipSync=C,e.gunzip=k,e.gunzipSync=U}).call(this)}).call(e,n(16),n(15).Buffer)},function(t,e,n){const i=n(0),s=n(4),r=n(18),o=n(5),u=n(28),h=n(9),a=n(39),c=n(40),l=n(11),f=n(29);class d{constructor(t){this.client=t}get pastReady(){return this.client.ws.status===i.Status.READY}newGuild(t){const e=this.client.guilds.has(t.id),n=new r(this.client,t);return this.client.guilds.set(n.id,n),this.pastReady&&!e&&(this.client.options.fetchAllMembers?n.fetchMembers().then(()=>{this.client.emit(i.Events.GUILD_CREATE,n)}):this.client.emit(i.Events.GUILD_CREATE,n)),n}newUser(t){if(this.client.users.has(t.id))return this.client.users.get(t.id);const e=new o(this.client,t);return this.client.users.set(e.id,e),e}newChannel(t,e){const n=this.client.channels.has(t.id);let s;return t.type===i.ChannelTypes.DM?s=new u(this.client,t):t.type===i.ChannelTypes.groupDM?s=new f(this.client,t):(e=e||this.client.guilds.get(t.guild_id),e&&(t.type===i.ChannelTypes.text?(s=new a(e,t),e.channels.set(s.id,s)):t.type===i.ChannelTypes.voice&&(s=new c(e,t),e.channels.set(s.id,s)))),s?(this.pastReady&&!n&&this.client.emit(i.Events.CHANNEL_CREATE,s),this.client.channels.set(s.id,s),s):null}newEmoji(t,e){const n=e.emojis.has(t.id);if(t&&!n){let n=new h(e,t);return this.client.emit(i.Events.EMOJI_CREATE,n),e.emojis.set(n.id,n),n}return n?e.emojis.get(t.id):null}killEmoji(t){t instanceof h&&t.guild&&(this.client.emit(i.Events.EMOJI_DELETE,t),t.guild.emojis.delete(t.id))}killGuild(t){const e=this.client.guilds.has(t.id);this.client.guilds.delete(t.id),e&&this.pastReady&&this.client.emit(i.Events.GUILD_DELETE,t)}killUser(t){this.client.users.delete(t.id)}killChannel(t){this.client.channels.delete(t.id),t instanceof l&&t.guild.channels.delete(t.id)}updateGuild(t,e){const n=s(t);t.setup(e),this.pastReady&&this.client.emit(i.Events.GUILD_UPDATE,n,t)}updateChannel(t,e){t.setup(e)}updateEmoji(t,e){const n=s(t);t.setup(e),this.client.emit(i.Events.GUILD_EMOJI_UPDATE,n,t)}}t.exports=d},function(t,e,n){const i=n(0);class s{constructor(t){this.client=t,this.heartbeatInterval=null}connectToWebSocket(t,e,n){this.client.emit(i.Events.DEBUG,`Authenticated using token ${t}`),this.client.token=t;const s=this.client.setTimeout(()=>n(new Error(i.Errors.TOOK_TOO_LONG)),3e5);this.client.rest.methods.getGateway().then(r=>{this.client.emit(i.Events.DEBUG,`Using gateway ${r}`),this.client.ws.connect(r),this.client.ws.once("close",t=>{4004===t.code&&n(new Error(i.Errors.BAD_LOGIN)),4010===t.code&&n(new Error(i.Errors.INVALID_SHARD))}),this.client.once(i.Events.READY,()=>{e(t),this.client.clearTimeout(s)})},n)}setupKeepAlive(t){this.heartbeatInterval=this.client.setInterval(()=>{this.client.emit("debug","Sending heartbeat"),this.client.ws.send({op:i.OPCodes.HEARTBEAT,d:this.client.ws.sequence},!0)},t)}destroy(){return new Promise(t=>{this.client.ws.destroy(),this.client.user.bot?t():t(this.client.rest.methods.logout())})}}t.exports=s},function(t,e,n){class i{constructor(t){this.client=t,this.register(n(82)),this.register(n(83)),this.register(n(84)),this.register(n(88)),this.register(n(85)),this.register(n(86)),this.register(n(87)),this.register(n(66)),this.register(n(67)),this.register(n(68)),this.register(n(70)),this.register(n(81)),this.register(n(74)),this.register(n(75)),this.register(n(69)),this.register(n(76)),this.register(n(77)),this.register(n(78)),this.register(n(89)),this.register(n(91)),this.register(n(90)),this.register(n(80)),this.register(n(71)),this.register(n(72)),this.register(n(73)),this.register(n(79))}register(t){this[t.name.replace(/Action$/,"")]=new t(this.client)}}t.exports=i},function(t,e,n){const i=n(2);class s extends i{handle(t){const e=this.client,n=e.dataManager.newChannel(t);return{channel:n}}}t.exports=s},function(t,e,n){const i=n(2);class s extends i{constructor(t){super(t),this.deleted=new Map}handle(t){const e=this.client;let n=e.channels.get(t.id);return n?(e.dataManager.killChannel(n),this.deleted.set(n.id,n),this.scheduleForDeletion(n.id)):n=this.deleted.get(t.id)||null,{channel:n}}scheduleForDeletion(t){this.client.setTimeout(()=>this.deleted.delete(t),this.client.options.restWsBridgeTimeout)}}t.exports=s},function(t,e,n){const i=n(2),s=n(0),r=n(4);class o extends i{handle(t){const e=this.client,n=e.channels.get(t.id);if(n){const i=r(n);return n.setup(t),e.emit(s.Events.CHANNEL_UPDATE,i,n),{old:i,updated:n}}return{old:null,updated:null}}}t.exports=o},function(t,e,n){const i=n(2),s=n(0);class r extends i{handle(t){const e=this.client,n=e.guilds.get(t.guild_id),i=e.dataManager.newUser(t.user);n&&i&&e.emit(s.Events.GUILD_BAN_REMOVE,n,i)}}t.exports=r},function(t,e,n){const i=n(2),s=n(0);class r extends i{constructor(t){super(t),this.deleted=new Map}handle(t){const e=this.client;let n=e.guilds.get(t.id);if(n){if(n.available&&t.unavailable)return n.available=!1,e.emit(s.Events.GUILD_UNAVAILABLE,n),{guild:null};e.guilds.delete(n.id),this.deleted.set(n.id,n),this.scheduleForDeletion(n.id)}else n=this.deleted.get(t.id)||null;return{guild:n}}scheduleForDeletion(t){this.client.setTimeout(()=>this.deleted.delete(t),this.client.options.restWsBridgeTimeout)}}t.exports=r},function(t,e,n){const i=n(2);class s extends i{handle(t,e){const n=this.client,i=n.dataManager.newEmoji(t,e);return{emoji:i}}}t.exports=s},function(t,e,n){const i=n(2);class s extends i{handle(t){const e=this.client;return e.dataManager.killEmoji(t),{data:t}}}t.exports=s},function(t,e,n){const i=n(2);class s extends i{handle(t,e){const n=this.client;for(let i of t.emojis){const t=e.emojis.has(i.id);t?n.dataManager.updateEmoji(e.emojis.get(i.id),i):i=n.dataManager.newEmoji(i,e)}for(let i of e.emojis)t.emoijs.has(i.id)||n.dataManager.killEmoji(i);return{emojis:t.emojis}}}t.exports=s},function(t,e,n){const i=n(2);class s extends i{handle(t,e){const n=t._addMember(e,!1);return{member:n}}}t.exports=s},function(t,e,n){const i=n(2),s=n(0);class r extends i{constructor(t){super(t),this.deleted=new Map}handle(t){const e=this.client,n=e.guilds.get(t.guild_id);if(n){let i=n.members.get(t.user.id);return i?(n.memberCount--,n._removeMember(i),this.deleted.set(n.id+t.user.id,i),e.status===s.Status.READY&&e.emit(s.Events.GUILD_MEMBER_REMOVE,i),this.scheduleForDeletion(n.id,t.user.id)):i=this.deleted.get(n.id+t.user.id)||null,{guild:n,member:i}}return{guild:n,member:null}}scheduleForDeletion(t,e){this.client.setTimeout(()=>this.deleted.delete(t+e),this.client.options.restWsBridgeTimeout)}}t.exports=r},function(t,e,n){const i=n(2),s=n(0),r=n(7);class o extends i{handle(t){const e=this.client,n=e.guilds.get(t.guild_id);if(n){const i=n.roles.has(t.role.id),o=new r(n,t.role);return n.roles.set(o.id,o),i||e.emit(s.Events.GUILD_ROLE_CREATE,o),{role:o}}return{role:null}}}t.exports=o},function(t,e,n){const i=n(2),s=n(0);class r extends i{constructor(t){super(t),this.deleted=new Map}handle(t){const e=this.client,n=e.guilds.get(t.guild_id);if(n){let i=n.roles.get(t.role_id);return i?(n.roles.delete(t.role_id),this.deleted.set(n.id+t.role_id,i),this.scheduleForDeletion(n.id,t.role_id),e.emit(s.Events.GUILD_ROLE_DELETE,i)):i=this.deleted.get(n.id+t.role_id)||null,{role:i}}return{role:null}}scheduleForDeletion(t,e){this.client.setTimeout(()=>this.deleted.delete(t+e),this.client.options.restWsBridgeTimeout)}}t.exports=r},function(t,e,n){const i=n(2),s=n(0),r=n(4);class o extends i{handle(t){const e=this.client,n=e.guilds.get(t.guild_id);if(n){const i=t.role;let o=null;const u=n.roles.get(i.id);return u&&(o=r(u),u.setup(t.role),e.emit(s.Events.GUILD_ROLE_UPDATE,o,u)),{old:o,updated:u}}return{old:null,updated:null}}}t.exports=o},function(t,e,n){const i=n(2);class s extends i{handle(t){const e=this.client,n=e.guilds.get(t.guild_id);if(n)for(const i of t.roles){const t=n.roles.get(i.id);t&&(t.position=i.position)}return{guild:n}}}t.exports=s},function(t,e,n){const i=n(2);class s extends i{handle(t){const e=this.client,n=e.guilds.get(t.id);if(n){t.presences=t.presences||[];for(const e of t.presences)n._setPresence(e.user.id,e);t.members=t.members||[];for(const i of t.members){const t=n.members.get(i.user.id);t?n._updateMember(t,i):n._addMember(i)}}}}t.exports=s},function(t,e,n){const i=n(2),s=n(0),r=n(4);class o extends i{handle(t){const e=this.client,n=e.guilds.get(t.id);if(n){const i=r(n);return n.setup(t),e.emit(s.Events.GUILD_UPDATE,i,n),{old:i,updated:n}}return{old:null,updated:null}}}t.exports=o},function(t,e,n){const i=n(2),s=n(13);class r extends i{handle(t){const e=this.client,n=e.channels.get((t instanceof Array?t[0]:t).channel_id);if(n){if(t instanceof Array){const i=new Array(t.length);for(let r=0;r<t.length;r++)i[r]=n._cacheMessage(new s(n,t[r],e));return n.lastMessageID=i[i.length-1].id,{messages:i}}{const i=n._cacheMessage(new s(n,t,e));return n.lastMessageID=t.id,{message:i}}}return{message:null}}}t.exports=r},function(t,e,n){const i=n(2);class s extends i{constructor(t){super(t),this.deleted=new Map}handle(t){const e=this.client,n=e.channels.get(t.channel_id);if(n){let e=n.messages.get(t.id);return e?(n.messages.delete(e.id),this.deleted.set(n.id+e.id,e),this.scheduleForDeletion(n.id,e.id)):e=this.deleted.get(n.id+t.id)||null,{message:e}}return{message:null}}scheduleForDeletion(t,e){this.client.setTimeout(()=>this.deleted.delete(t+e),this.client.options.restWsBridgeTimeout)}}t.exports=s},function(t,e,n){const i=n(2),s=n(3),r=n(0);class o extends i{handle(t){const e=this.client,n=e.channels.get(t.channel_id),i=t.ids,o=new s;for(const u of i){const t=n.messages.get(u);t&&o.set(t.id,t)}return o.size>0&&e.emit(r.Events.MESSAGE_BULK_DELETE,o),{messages:o}}}t.exports=o},function(t,e,n){const i=n(2),s=n(0);class r extends i{handle(t){const e=this.client.users.get(t.user_id);if(!e)return!1;const n=this.client.channels.get(t.channel_id);if(!n||"voice"===n.type)return!1;const i=n.messages.get(t.message_id);if(!i)return!1;if(!t.emoji)return!1;const r=i._addReaction(t.emoji,e);return r&&this.client.emit(s.Events.MESSAGE_REACTION_ADD,r,e),{message:i,reaction:r,user:e}}}t.exports=r},function(t,e,n){const i=n(2),s=n(0);class r extends i{handle(t){const e=this.client.users.get(t.user_id);if(!e)return!1;const n=this.client.channels.get(t.channel_id);if(!n||"voice"===n.type)return!1;const i=n.messages.get(t.message_id);if(!i)return!1;if(!t.emoji)return!1;const r=i._removeReaction(t.emoji,e);return r&&this.client.emit(s.Events.MESSAGE_REACTION_REMOVE,r,e),{message:i,reaction:r,user:e}}}t.exports=r},function(t,e,n){const i=n(2),s=n(0);class r extends i{handle(t){const e=this.client.channels.get(t.channel_id);if(!e||"voice"===e.type)return!1;const n=e.messages.get(t.message_id);return!!n&&(n._clearReactions(),this.client.emit(s.Events.MESSAGE_REACTION_REMOVE_ALL,n),{message:n})}}t.exports=r},function(t,e,n){const i=n(2),s=n(0),r=n(4);class o extends i{handle(t){const e=this.client,n=e.channels.get(t.channel_id);if(n){const i=n.messages.get(t.id);if(i){const n=r(i);return i.patch(t),i._edits.unshift(n),e.emit(s.Events.MESSAGE_UPDATE,n,i),{old:n,updated:i}}return{old:i,updated:i}}return{old:null,updated:null}}}t.exports=o},function(t,e,n){const i=n(2);class s extends i{handle(t){const e=this.client,n=e.dataManager.newUser(t);return{user:n}}}t.exports=s},function(t,e,n){const i=n(2),s=n(0);class r extends i{handle(t){const e=this.client,n=e.user.notes.get(t.id),i=t.note.length?t.note:null;return e.user.notes.set(t.id,i),e.emit(s.Events.USER_NOTE_UPDATE,t.id,n,i),{old:n,updated:i}}}t.exports=r},function(t,e,n){const i=n(2),s=n(0),r=n(4);class o extends i{handle(t){const e=this.client;if(e.user){if(e.user.equals(t))return{old:e.user,updated:e.user};const n=r(e.user);return e.user.patch(t),e.emit(s.Events.USER_UPDATE,n,e.user),{old:n,updated:e.user}}return{old:null,updated:null}}}t.exports=o},function(t,e,n){function i(t){let e=t.split("?")[0];if(e.includes("/channels/")||e.includes("/guilds/")){const t=~e.indexOf("/channels/")?e.indexOf("/channels/"):e.indexOf("/guilds/"),n=e.substring(t).split("/")[2];e=e.replace(/(\d{8,})/g,":id").replace(":id",n)}return e}const s=n(23),r=n(0);class o{constructor(t,e,n,s,r,o){this.rest=t,this.method=e,this.url=n,this.auth=s,this.data=r,this.file=o,this.route=i(this.url)}getAuth(){if(this.rest.client.token&&this.rest.client.user&&this.rest.client.user.bot)return`Bot ${this.rest.client.token}`;if(this.rest.client.token)return this.rest.client.token;throw new Error(r.Errors.NO_TOKEN)}gen(){const t=s[this.method](this.url);if(this.auth&&t.set("authorization",this.getAuth()),this.file&&this.file.file){t.attach("file",this.file.file,this.file.name),this.data=this.data||{};for(const e in this.data)this.data[e]&&t.field(e,this.data[e])}else this.data&&t.send(this.data);return t.set("User-Agent",this.rest.userAgentManager.userAgent),t}}t.exports=o},function(t,e,n){const i=n(0),s=n(3),r=n(41),o=n(134),u=n(5),h=n(12),a=n(7),c=n(30),l=n(20),f=n(133),d=n(26);class p{constructor(t){this.rest=t}loginToken(t=this.rest.client.token){return new Promise((e,n)=>{t=t.replace(/^Bot\s*/i,""),this.rest.client.manager.connectToWebSocket(t,e,n)})}loginEmailPassword(t,e){return this.rest.client.emit("warn","Client launched using email and password - should use token instead"),this.rest.client.email=t,this.rest.client.password=e,this.rest.makeRequest("post",i.Endpoints.login,!1,{email:t,password:e}).then(t=>this.loginToken(t.token))}logout(){return this.rest.makeRequest("post",i.Endpoints.logout,!0,{})}getGateway(){return this.rest.makeRequest("get",i.Endpoints.gateway,!0).then(t=>{return this.rest.client.ws.gateway=`${t.url}/?encoding=json&v=${i.PROTOCOL_VERSION}`,this.rest.client.ws.gateway})}getBotGateway(){return this.rest.makeRequest("get",i.Endpoints.botGateway,!0)}sendMessage(t,e,{tts,nonce,embed,disableEveryone,split}={},n=null){return new Promise((i,s)=>{"undefined"!=typeof e&&(e=this.rest.client.resolver.resolveString(e)),e&&((disableEveryone||"undefined"==typeof disableEveryone&&this.rest.client.options.disableEveryone)&&(e=e.replace(/@(everyone|here)/g,"@$1")),split&&(e=r(e,"object"==typeof split?split:{}))),t instanceof u||t instanceof h?this.createDM(t).then(t=>{this._sendMessageRequest(t,e,n,tts,nonce,embed,i,s)},s):this._sendMessageRequest(t,e,n,tts,nonce,embed,i,s)})}_sendMessageRequest(t,e,n,s,r,o,u,h){if(e instanceof Array){const a=[];let c=this.rest.makeRequest("post",i.Endpoints.channelMessages(t.id),!0,{content:e[0],tts:s,nonce:r},n).catch(h);for(let l=1;l<=e.length;l++)if(l<e.length){const u=l;c=c.then(h=>{return a.push(h),this.rest.makeRequest("post",i.Endpoints.channelMessages(t.id),!0,{content:e[u],tts:s,nonce:r,embed:o},n)},h)}else c.then(t=>{a.push(t),u(this.rest.client.actions.MessageCreate.handle(a).messages)},h)}else this.rest.makeRequest("post",i.Endpoints.channelMessages(t.id),!0,{content:e,tts:s,nonce:r,embed:o},n).then(t=>u(this.rest.client.actions.MessageCreate.handle(t).message),h)}deleteMessage(t){return this.rest.makeRequest("del",i.Endpoints.channelMessage(t.channel.id,t.id),!0).then(()=>this.rest.client.actions.MessageDelete.handle({id:t.id,channel_id:t.channel.id}).message)}bulkDeleteMessages(t,e){return this.rest.makeRequest("post",`${i.Endpoints.channelMessages(t.id)}/bulk_delete`,!0,{messages:e}).then(()=>this.rest.client.actions.MessageDeleteBulk.handle({channel_id:t.id,ids:e}).messages)}updateMessage(t,e,{embed}={}){return e=this.rest.client.resolver.resolveString(e),this.rest.makeRequest("patch",i.Endpoints.channelMessage(t.channel.id,t.id),!0,{content:e,embed:embed}).then(t=>this.rest.client.actions.MessageUpdate.handle(t).updated)}createChannel(t,e,n){return this.rest.makeRequest("post",i.Endpoints.guildChannels(t.id),!0,{name:e,type:n}).then(t=>this.rest.client.actions.ChannelCreate.handle(t).channel)}createDM(t){const e=this.getExistingDM(t);return e?Promise.resolve(e):this.rest.makeRequest("post",i.Endpoints.userChannels(this.rest.client.user.id),!0,{recipient_id:t.id}).then(t=>this.rest.client.actions.ChannelCreate.handle(t).channel)}getExistingDM(t){return this.rest.client.channels.find(e=>e.recipient&&e.recipient.id===t.id)}deleteChannel(t){return(t instanceof u||t instanceof h)&&(t=this.getExistingDM(t)),t?this.rest.makeRequest("del",i.Endpoints.channel(t.id),!0).then(e=>{return e.id=t.id,this.rest.client.actions.ChannelDelete.handle(e).channel}):Promise.reject(new Error("No channel to delete."))}updateChannel(t,e){const n={};return n.name=(e.name||t.name).trim(),n.topic=e.topic||t.topic,n.position=e.position||t.position,n.bitrate=e.bitrate||t.bitrate,n.user_limit=e.userLimit||t.userLimit,this.rest.makeRequest("patch",i.Endpoints.channel(t.id),!0,n).then(t=>this.rest.client.actions.ChannelUpdate.handle(t).updated)}leaveGuild(t){return t.ownerID===this.rest.client.user.id?Promise.reject(new Error("Guild is owned by the client.")):this.rest.makeRequest("del",i.Endpoints.meGuild(t.id),!0).then(()=>this.rest.client.actions.GuildDelete.handle({id:t.id}).guild)}createGuild(t){return t.icon=this.rest.client.resolver.resolveBase64(t.icon)||null,t.region=t.region||"us-central",new Promise((e,n)=>{this.rest.makeRequest("post",i.Endpoints.guilds,!0,t).then(t=>{if(this.rest.client.guilds.has(t.id))return void e(this.rest.client.guilds.get(t.id));const i=n=>{n.id===t.id&&(this.rest.client.removeListener("guildCreate",i),this.rest.client.clearTimeout(s),e(n))};this.rest.client.on("guildCreate",i);const s=this.rest.client.setTimeout(()=>{this.rest.client.removeListener("guildCreate",i),n(new Error("Took too long to receive guild data."))},1e4)},n)})}deleteGuild(t){return this.rest.makeRequest("del",i.Endpoints.guild(t.id),!0).then(()=>this.rest.client.actions.GuildDelete.handle({id:t.id}).guild)}getUser(t){return this.rest.makeRequest("get",i.Endpoints.user(t),!0).then(t=>this.rest.client.actions.UserGet.handle(t).user)}updateCurrentUser(t){const e=this.rest.client.user,n={};return n.username=t.username||e.username,n.avatar=this.rest.client.resolver.resolveBase64(t.avatar)||e.avatar,e.bot||(n.email=t.email||e.email,n.password=this.rest.client.password,t.new_password&&(n.new_password=t.newPassword)),this.rest.makeRequest("patch",i.Endpoints.me,!0,n).then(t=>this.rest.client.actions.UserUpdate.handle(t).updated)}updateGuild(t,e){const n={};return e.name&&(n.name=e.name),e.region&&(n.region=e.region),e.verificationLevel&&(n.verification_level=Number(e.verificationLevel)),e.afkChannel&&(n.afk_channel_id=this.rest.client.resolver.resolveChannel(e.afkChannel).id),e.afkTimeout&&(n.afk_timeout=Number(e.afkTimeout)),e.icon&&(n.icon=this.rest.client.resolver.resolveBase64(e.icon)),e.owner&&(n.owner_id=this.rest.client.resolver.resolveUser(e.owner).id),e.splash&&(n.splash=this.rest.client.resolver.resolveBase64(e.splash)),this.rest.makeRequest("patch",i.Endpoints.guild(t.id),!0,n).then(t=>this.rest.client.actions.GuildUpdate.handle(t).updated)}kickGuildMember(t,e){return this.rest.makeRequest("del",i.Endpoints.guildMember(t.id,e.id),!0).then(()=>this.rest.client.actions.GuildMemberRemove.handle({guild_id:t.id,user:e.user}).member)}createGuildRole(t){return this.rest.makeRequest("post",i.Endpoints.guildRoles(t.id),!0).then(e=>this.rest.client.actions.GuildRoleCreate.handle({guild_id:t.id,role:e}).role)}deleteGuildRole(t){return this.rest.makeRequest("del",i.Endpoints.guildRole(t.guild.id,t.id),!0).then(()=>this.rest.client.actions.GuildRoleDelete.handle({guild_id:t.guild.id,role_id:t.id}).role)}setChannelOverwrite(t,e){return this.rest.makeRequest("put",`${i.Endpoints.channelPermissions(t.id)}/${e.id}`,!0,e)}deletePermissionOverwrites(t){return this.rest.makeRequest("del",`${i.Endpoints.channelPermissions(t.channel.id)}/${t.id}`,!0).then(()=>t)}getChannelMessages(t,e={}){const n=[];e.limit&&n.push(`limit=${e.limit}`),e.around?n.push(`around=${e.around}`):e.before?n.push(`before=${e.before}`):e.after&&n.push(`after=${e.after}`);let s=i.Endpoints.channelMessages(t.id);return n.length>0&&(s+=`?${n.join("&")}`),this.rest.makeRequest("get",s,!0)}getChannelMessage(t,e){const n=t.messages.get(e);return n?Promise.resolve(n):this.rest.makeRequest("get",i.Endpoints.channelMessage(t.id,e),!0)}getGuildMember(t,e){return this.rest.makeRequest("get",i.Endpoints.guildMember(t.id,e.id),!0).then(e=>this.rest.client.actions.GuildMemberGet.handle(t,e).member)}updateGuildMember(t,e){e.channel&&(e.channel_id=this.rest.client.resolver.resolveChannel(e.channel).id),e.roles&&(e.roles=e.roles.map(t=>t instanceof a?t.id:t));let n=i.Endpoints.guildMember(t.guild.id,t.id);if(t.id===this.rest.client.user.id){const s=Object.keys(e);1===s.length&&"nick"===s[0]&&(n=i.Endpoints.stupidInconsistentGuildEndpoint(t.guild.id))}return this.rest.makeRequest("patch",n,!0,e).then(e=>t.guild._updateMember(t,e).mem)}sendTyping(t){return this.rest.makeRequest("post",`${i.Endpoints.channel(t)}/typing`,!0)}banGuildMember(t,e,n=0){const s=this.rest.client.resolver.resolveUserID(e);return s?this.rest.makeRequest("put",`${i.Endpoints.guildBans(t.id)}/${s}?delete-message-days=${n}`,!0,{"delete-message-days":n}).then(()=>{if(e instanceof h)return e;const n=this.rest.client.resolver.resolveUser(s);return n?(e=this.rest.client.resolver.resolveGuildMember(t,n),e||n):s}):Promise.reject(new Error("Couldn't resolve the user ID to ban."))}unbanGuildMember(t,e){return new Promise((n,s)=>{const r=this.rest.client.resolver.resolveUserID(e);if(!r)throw new Error("Couldn't resolve the user ID to unban.");const o=(e,s)=>{e.id===t.id&&s.id===r&&(this.rest.client.removeListener(i.Events.GUILD_BAN_REMOVE,o),this.rest.client.clearTimeout(u),n(s))};this.rest.client.on(i.Events.GUILD_BAN_REMOVE,o);const u=this.rest.client.setTimeout(()=>{this.rest.client.removeListener(i.Events.GUILD_BAN_REMOVE,o),s(new Error("Took too long to receive the ban remove event."))},1e4);this.rest.makeRequest("del",`${i.Endpoints.guildBans(t.id)}/${r}`,!0).catch(t=>{this.rest.client.removeListener(i.Events.GUILD_BAN_REMOVE,o),this.rest.client.clearTimeout(u),s(t)})})}getGuildBans(t){return this.rest.makeRequest("get",i.Endpoints.guildBans(t.id),!0).then(t=>{const e=new s;for(const n of t){const t=this.rest.client.dataManager.newUser(n.user);e.set(t.id,t)}return e})}updateGuildRole(t,e){const n={};if(n.name=e.name||t.name,n.position="undefined"!=typeof e.position?e.position:t.position,n.color=e.color||t.color,"string"==typeof n.color&&n.color.startsWith("#")&&(n.color=parseInt(n.color.replace("#",""),16)),n.hoist="undefined"!=typeof e.hoist?e.hoist:t.hoist,n.mentionable="undefined"!=typeof e.mentionable?e.mentionable:t.mentionable,e.permissions){let t=0;for(let s of e.permissions)"string"==typeof s&&(s=i.PermissionFlags[s]),t|=s;n.permissions=t}else n.permissions=t.permissions;return this.rest.makeRequest("patch",i.Endpoints.guildRole(t.guild.id,t.id),!0,n).then(e=>this.rest.client.actions.GuildRoleUpdate.handle({role:e,guild_id:t.guild.id}).updated)}pinMessage(t){return this.rest.makeRequest("put",`${i.Endpoints.channel(t.channel.id)}/pins/${t.id}`,!0).then(()=>t)}unpinMessage(t){return this.rest.makeRequest("del",`${i.Endpoints.channel(t.channel.id)}/pins/${t.id}`,!0).then(()=>t)}getChannelPinnedMessages(t){return this.rest.makeRequest("get",`${i.Endpoints.channel(t.id)}/pins`,!0)}createChannelInvite(t,e){const n={};return n.temporary=e.temporary,n.max_age=e.maxAge,n.max_uses=e.maxUses,this.rest.makeRequest("post",`${i.Endpoints.channelInvites(t.id)}`,!0,n).then(t=>new c(this.rest.client,t))}deleteInvite(t){return this.rest.makeRequest("del",i.Endpoints.invite(t.code),!0).then(()=>t)}getInvite(t){return this.rest.makeRequest("get",i.Endpoints.invite(t),!0).then(t=>new c(this.rest.client,t))}getGuildInvites(t){return this.rest.makeRequest("get",i.Endpoints.guildInvites(t.id),!0).then(t=>{const e=new s;for(const n of t){const t=new c(this.rest.client,n);e.set(t.code,t)}return e})}pruneGuildMembers(t,e,n){return this.rest.makeRequest(n?"get":"post",`${i.Endpoints.guildPrune(t.id)}?days=${e}`,!0).then(t=>t.pruned)}createEmoji(t,e,n){return this.rest.makeRequest("post",`${i.Endpoints.guildEmojis(t.id)}`,!0,{name:n,image:e}).then(e=>this.rest.client.actions.EmojiCreate.handle(e,t).emoji)}deleteEmoji(t){return this.rest.makeRequest("delete",`${i.Endpoints.guildEmojis(t.guild.id)}/${t.id}`,!0).then(()=>this.rest.client.actions.EmojiDelete.handle(t).data)}getWebhook(t,e){return this.rest.makeRequest("get",i.Endpoints.webhook(t,e),!e).then(t=>new l(this.rest.client,t))}getGuildWebhooks(t){return this.rest.makeRequest("get",i.Endpoints.guildWebhooks(t.id),!0).then(t=>{const e=new s;for(const n of t)e.set(n.id,new l(this.rest.client,n));return e})}getChannelWebhooks(t){return this.rest.makeRequest("get",i.Endpoints.channelWebhooks(t.id),!0).then(t=>{const e=new s;for(const n of t)e.set(n.id,new l(this.rest.client,n));return e})}createWebhook(t,e,n){return this.rest.makeRequest("post",i.Endpoints.channelWebhooks(t.id),!0,{name:e,avatar:n}).then(t=>new l(this.rest.client,t))}editWebhook(t,e,n){return this.rest.makeRequest("patch",i.Endpoints.webhook(t.id,t.token),!1,{name:e,avatar:n}).then(e=>{return t.name=e.name,t.avatar=e.avatar,t})}deleteWebhook(t){return this.rest.makeRequest("delete",i.Endpoints.webhook(t.id,t.token),!1)}sendWebhookMessage(t,e,{avatarURL,tts,disableEveryone,embeds}={},n=null){return"undefined"!=typeof e&&(e=this.rest.client.resolver.resolveString(e)),e&&(disableEveryone||"undefined"==typeof disableEveryone&&this.rest.client.options.disableEveryone)&&(e=e.replace(/@(everyone|here)/g,"@$1")),this.rest.makeRequest("post",`${i.Endpoints.webhook(t.id,t.token)}?wait=true`,!1,{username:t.name,avatar_url:avatarURL,content:e,tts:tts,file:n,embeds:embeds})}sendSlackWebhookMessage(t,e){return this.rest.makeRequest("post",`${i.Endpoints.webhook(t.id,t.token)}/slack?wait=true`,!1,e)}fetchUserProfile(t){return this.rest.makeRequest("get",i.Endpoints.userProfile(t.id),!0).then(e=>new f(t,e))}addFriend(t){return this.rest.makeRequest("post",i.Endpoints.relationships("@me"),!0,{username:t.username,discriminator:t.discriminator}).then(()=>t)}removeFriend(t){return this.rest.makeRequest("delete",`${i.Endpoints.relationships("@me")}/${t.id}`,!0).then(()=>t)}blockUser(t){return this.rest.makeRequest("put",`${i.Endpoints.relationships("@me")}/${t.id}`,!0,{type:2}).then(()=>t)}unblockUser(t){return this.rest.makeRequest("delete",`${i.Endpoints.relationships("@me")}/${t.id}`,!0).then(()=>t)}setRolePositions(t,e){return this.rest.makeRequest("patch",i.Endpoints.guildRoles(t),!0,e).then(()=>this.rest.client.actions.GuildRolesPositionUpdate.handle({guild_id:t,roles:e}).guild)}addMessageReaction(t,e){return this.rest.makeRequest("put",i.Endpoints.selfMessageReaction(t.channel.id,t.id,e),!0).then(()=>this.rest.client.actions.MessageReactionAdd.handle({user_id:this.rest.client.user.id,message_id:t.id,emoji:o(e),channel_id:t.channel.id}).reaction)}removeMessageReaction(t,e,n){let s=i.Endpoints.selfMessageReaction(t.channel.id,t.id,e);return n.id!==this.rest.client.user.id&&(s=i.Endpoints.userMessageReaction(t.channel.id,t.id,e,null,n.id)),this.rest.makeRequest("delete",s,!0).then(()=>this.rest.client.actions.MessageReactionRemove.handle({user_id:n.id,message_id:t.id,emoji:o(e),channel_id:t.channel.id}).reaction)}removeMessageReactions(t){this.rest.makeRequest("delete",i.Endpoints.messageReactions(t.channel.id,t.id),!0).then(()=>t)}getMessageReactionUsers(t,e,n=100){return this.rest.makeRequest("get",i.Endpoints.messageReaction(t.channel.id,t.id,e,n),!0)}getMyApplication(){return this.rest.makeRequest("get",i.Endpoints.myApplication,!0).then(t=>new d(this.rest.client,t))}setNote(t,e){return this.rest.makeRequest("put",i.Endpoints.note(t.id),!0,{note:e}).then(()=>t)}}t.exports=p},function(t,e,n){const i=n(46);class s extends i{constructor(t,e){super(t,e),this.requestRemaining=1,this.first=!0}push(t){super.push(t),this.handle()}handleNext(t){this.waiting||(this.waiting=!0,this.restManager.client.setTimeout(()=>{this.requestRemaining=this.requestLimit,this.waiting=!1,this.handle()},t))}execute(t){t.request.gen().end((e,n)=>{if(n&&n.headers&&(this.requestLimit=n.headers["x-ratelimit-limit"],this.requestResetTime=1e3*Number(n.headers["x-ratelimit-reset"]),this.requestRemaining=Number(n.headers["x-ratelimit-remaining"]),this.timeDifference=Date.now()-new Date(n.headers.date).getTime(),this.handleNext(this.requestResetTime-Date.now()+this.timeDifference+1e3)),e)429===e.status?(this.requestRemaining=0,this.queue.unshift(t),this.restManager.client.setTimeout(()=>{this.globalLimit=!1,this.handle()},Number(n.headers["retry-after"])+500),n.headers["x-ratelimit-global"]&&(this.globalLimit=!0)):t.reject(e);else{this.globalLimit=!1;const e=n&&n.body?n.body:{};t.resolve(e),this.first&&(this.first=!1,this.handle())}})}handle(){if(super.handle(),!(this.requestRemaining<1||0===this.queue.length||this.globalLimit))for(;this.queue.length>0&&this.requestRemaining>0;)this.execute(this.queue.shift()),
|
||
this.requestRemaining--}}t.exports=s},function(t,e,n){const i=n(46);class s extends i{constructor(t,e){super(t,e),this.waiting=!1,this.endpoint=e,this.timeDifference=0}push(t){super.push(t),this.handle()}execute(t){return new Promise(e=>{t.request.gen().end((n,i)=>{if(i&&i.headers&&(this.requestLimit=i.headers["x-ratelimit-limit"],this.requestResetTime=1e3*Number(i.headers["x-ratelimit-reset"]),this.requestRemaining=Number(i.headers["x-ratelimit-remaining"]),this.timeDifference=Date.now()-new Date(i.headers.date).getTime()),n)429===n.status?(this.restManager.client.setTimeout(()=>{this.waiting=!1,this.globalLimit=!1,e()},Number(i.headers["retry-after"])+500),i.headers["x-ratelimit-global"]&&(this.globalLimit=!0)):(this.queue.shift(),this.waiting=!1,t.reject(n),e(n));else{this.queue.shift(),this.globalLimit=!1;const n=i&&i.body?i.body:{};t.resolve(n),0===this.requestRemaining?this.restManager.client.setTimeout(()=>{this.waiting=!1,e(n)},this.requestResetTime-Date.now()+this.timeDifference+1e3):(this.waiting=!1,e(n))}})})}handle(){if(super.handle(),!this.waiting&&0!==this.queue.length&&!this.globalLimit){this.waiting=!0;const t=this.queue[0];this.execute(t).then(()=>this.handle())}}}t.exports=s},function(t,e,n){const i=n(0);class s{constructor(t){this.restManager=t,this._userAgent={url:"https://github.com/hydrabolt/discord.js",version:i.Package.version}}set(t){this._userAgent.url=t.url||"https://github.com/hydrabolt/discord.js",this._userAgent.version=t.version||i.Package.version}get userAgent(){return`DiscordBot (${this._userAgent.url}, ${this._userAgent.version})`}}t.exports=s},function(t,e,n){const i="undefined"!=typeof window,s=i?window.WebSocket:n(135),r=n(21).EventEmitter,o=n(0),u=i?n(62).inflateSync:n(43).inflateSync,h=n(98),a=n(47);class c extends r{constructor(t){super(),this.client=t,this.packetManager=new h(this),this.status=o.Status.IDLE,this.sessionID=null,this.sequence=-1,this.gateway=null,this.normalReady=!1,this.ws=null,this.disabledEvents={};for(const e in t.options.disabledEvents)this.disabledEvents[e]=!0;this.first=!0}_connect(t){this.client.emit("debug",`Connecting to gateway ${t}`),this.normalReady=!1,this.status!==o.Status.RECONNECTING&&(this.status=o.Status.CONNECTING),this.ws=new s(t),i&&(this.ws.binaryType="arraybuffer"),this.ws.onopen=(()=>this.eventOpen()),this.ws.onclose=(t=>this.eventClose(t)),this.ws.onmessage=(t=>this.eventMessage(t)),this.ws.onerror=(t=>this.eventError(t)),this._queue=[],this._remaining=3}connect(t){this.first?(this._connect(t),this.first=!1):this.client.setTimeout(()=>this._connect(t),5500)}send(t,e=false){return e?void this._send(JSON.stringify(t)):(this._queue.push(JSON.stringify(t)),void this.doQueue())}destroy(){this.ws.close(1e3),this._queue=[],this.status=o.Status.IDLE}_send(t){this.ws.readyState===s.OPEN&&(this.emit("send",t),this.ws.send(t))}doQueue(){const t=this._queue[0];if(this.ws.readyState===s.OPEN&&t){if(0===this._remaining)return void this.client.setTimeout(()=>{this.doQueue()},1e3);this._remaining--,this._send(t),this._queue.shift(),this.doQueue(),this.client.setTimeout(()=>this._remaining++,1e3)}}eventOpen(){this.client.emit("debug","Connection to gateway opened"),this.status===o.Status.RECONNECTING?this._sendResume():this._sendNewIdentify()}_sendResume(){if(!this.sessionID)return void this._sendNewIdentify();this.client.emit("debug","Identifying as resumed session");const t={token:this.client.token,session_id:this.sessionID,seq:this.sequence};this.send({op:o.OPCodes.RESUME,d:t})}_sendNewIdentify(){this.reconnecting=!1;const t=this.client.options.ws;t.token=this.client.token,this.client.options.shardCount>0&&(t.shard=[Number(this.client.options.shardId),Number(this.client.options.shardCount)]),this.client.emit("debug","Identifying as new session"),this.send({op:o.OPCodes.IDENTIFY,d:t}),this.sequence=-1}eventClose(t){this.emit("close",t),this.client.clearInterval(this.client.manager.heartbeatInterval),this.reconnecting||this.client.emit(o.Events.DISCONNECT),4004!==t.code&&4010!==t.code&&(this.reconnecting||1e3===t.code||this.tryReconnect())}eventMessage(t){let e=t.data;try{"string"!=typeof e&&(e instanceof ArrayBuffer&&(e=a(e)),e=u(e).toString()),e=JSON.parse(e)}catch(t){return this.eventError(new Error(o.Errors.BAD_WS_MESSAGE))}return this.client.emit("raw",e),e.op===o.OPCodes.HELLO&&this.client.manager.setupKeepAlive(e.d.heartbeat_interval),this.packetManager.handle(e)}eventError(t){this.client.listenerCount("error")>0&&this.client.emit("error",t),this.ws.close()}_emitReady(t=true){this.status=o.Status.READY,this.client.emit(o.Events.READY),this.packetManager.handleQueue(),this.normalReady=t}checkIfReady(){if(this.status!==o.Status.READY&&this.status!==o.Status.NEARLY){let t=0;for(const e of this.client.guilds.keys())t+=this.client.guilds.get(e).available?0:1;if(0===t){if(this.status=o.Status.NEARLY,this.client.options.fetchAllMembers){const t=this.client.guilds.map(t=>t.fetchMembers());return void Promise.all(t).then(()=>this._emitReady(),t=>{this.client.emit(o.Events.WARN,"Error in pre-ready guild member fetching"),this.client.emit(o.Events.ERROR,t),this._emitReady()})}this._emitReady()}}}tryReconnect(){this.status=o.Status.RECONNECTING,this.ws.close(),this.packetManager.handleQueue(),this.client.emit(o.Events.RECONNECTING),this.connect(this.client.ws.gateway)}}t.exports=c},function(t,e,n){const i=n(0),s=[i.WSEvents.READY,i.WSEvents.GUILD_CREATE,i.WSEvents.GUILD_DELETE,i.WSEvents.GUILD_MEMBERS_CHUNK,i.WSEvents.GUILD_MEMBER_ADD,i.WSEvents.GUILD_MEMBER_REMOVE];class r{constructor(t){this.ws=t,this.handlers={},this.queue=[],this.register(i.WSEvents.READY,n(124)),this.register(i.WSEvents.GUILD_CREATE,n(105)),this.register(i.WSEvents.GUILD_DELETE,n(106)),this.register(i.WSEvents.GUILD_UPDATE,n(115)),this.register(i.WSEvents.GUILD_BAN_ADD,n(103)),this.register(i.WSEvents.GUILD_BAN_REMOVE,n(104)),this.register(i.WSEvents.GUILD_MEMBER_ADD,n(107)),this.register(i.WSEvents.GUILD_MEMBER_REMOVE,n(108)),this.register(i.WSEvents.GUILD_MEMBER_UPDATE,n(109)),this.register(i.WSEvents.GUILD_ROLE_CREATE,n(111)),this.register(i.WSEvents.GUILD_ROLE_DELETE,n(112)),this.register(i.WSEvents.GUILD_ROLE_UPDATE,n(113)),this.register(i.WSEvents.GUILD_MEMBERS_CHUNK,n(110)),this.register(i.WSEvents.CHANNEL_CREATE,n(99)),this.register(i.WSEvents.CHANNEL_DELETE,n(100)),this.register(i.WSEvents.CHANNEL_UPDATE,n(102)),this.register(i.WSEvents.CHANNEL_PINS_UPDATE,n(101)),this.register(i.WSEvents.PRESENCE_UPDATE,n(123)),this.register(i.WSEvents.USER_UPDATE,n(129)),this.register(i.WSEvents.USER_NOTE_UPDATE,n(128)),this.register(i.WSEvents.VOICE_STATE_UPDATE,n(131)),this.register(i.WSEvents.TYPING_START,n(127)),this.register(i.WSEvents.MESSAGE_CREATE,n(116)),this.register(i.WSEvents.MESSAGE_DELETE,n(117)),this.register(i.WSEvents.MESSAGE_UPDATE,n(122)),this.register(i.WSEvents.MESSAGE_DELETE_BULK,n(118)),this.register(i.WSEvents.VOICE_SERVER_UPDATE,n(130)),this.register(i.WSEvents.GUILD_SYNC,n(114)),this.register(i.WSEvents.RELATIONSHIP_ADD,n(125)),this.register(i.WSEvents.RELATIONSHIP_REMOVE,n(126)),this.register(i.WSEvents.MESSAGE_REACTION_ADD,n(119)),this.register(i.WSEvents.MESSAGE_REACTION_REMOVE,n(120)),this.register(i.WSEvents.MESSAGE_REACTION_REMOVE_ALL,n(121))}get client(){return this.ws.client}register(t,e){this.handlers[t]=new e(this)}handleQueue(){this.queue.forEach((t,e)=>{this.handle(this.queue[e]),this.queue.splice(e,1)})}setSequence(t){t&&t>this.ws.sequence&&(this.ws.sequence=t)}handle(t){return t.op===i.OPCodes.RECONNECT?(this.setSequence(t.s),this.ws.tryReconnect(),!1):t.op===i.OPCodes.INVALID_SESSION?(this.ws.sessionID=null,this.ws._sendNewIdentify(),!1):(t.op===i.OPCodes.HEARTBEAT_ACK&&this.ws.client.emit("debug","Heartbeat acknowledged"),this.ws.status===i.Status.RECONNECTING&&(this.ws.reconnecting=!1,this.ws.checkIfReady()),this.setSequence(t.s),void 0===this.ws.disabledEvents[t.t]&&(this.ws.status!==i.Status.READY&&s.indexOf(t.t)===-1?(this.queue.push(t),!1):!!this.handlers[t.t]&&this.handlers[t.t].handle(t)))}}t.exports=r},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.ChannelCreate.handle(n)}}t.exports=s},function(t,e,n){const i=n(1),s=n(0);class r extends i{handle(t){const e=this.packetManager.client,n=t.d,i=e.actions.ChannelDelete.handle(n);i.channel&&e.emit(s.Events.CHANNEL_DELETE,i.channel)}}t.exports=r},function(t,e,n){const i=n(1),s=n(0);class r extends i{handle(t){const e=this.packetManager.client,n=t.d,i=e.channels.get(n.channel_id),r=new Date(n.last_pin_timestamp);i&&r&&e.emit(s.Events.CHANNEL_PINS_UPDATE,i,r)}}t.exports=r},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.ChannelUpdate.handle(n)}}t.exports=s},function(t,e,n){const i=n(1),s=n(0);class r extends i{handle(t){const e=this.packetManager.client,n=t.d,i=e.guilds.get(n.guild_id),r=e.users.get(n.user.id);i&&r&&e.emit(s.Events.GUILD_BAN_ADD,i,r)}}t.exports=r},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.GuildBanRemove.handle(n)}}t.exports=s},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d,i=e.guilds.get(n.id);i?i.available||n.unavailable||(i.setup(n),this.packetManager.ws.checkIfReady()):e.dataManager.newGuild(n)}}t.exports=s},function(t,e,n){const i=n(1),s=n(0);class r extends i{handle(t){const e=this.packetManager.client,n=t.d,i=e.actions.GuildDelete.handle(n);i.guild&&e.emit(s.Events.GUILD_DELETE,i.guild)}}t.exports=r},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d,i=e.guilds.get(n.guild_id);i&&(i.memberCount++,i._addMember(n))}}t.exports=s},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.GuildMemberRemove.handle(n)}}t.exports=s},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d,i=e.guilds.get(n.guild_id);if(i){const t=i.members.get(n.user.id);t&&i._updateMember(t,n)}}}t.exports=s},function(t,e,n){const i=n(1),s=n(0);class r extends i{handle(t){const e=this.packetManager.client,n=t.d,i=e.guilds.get(n.guild_id),r=[];if(i)for(const o of n.members)r.push(i._addMember(o,!1));i._checkChunks(),e.emit(s.Events.GUILD_MEMBERS_CHUNK,r)}}t.exports=r},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.GuildRoleCreate.handle(n)}}t.exports=s},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.GuildRoleDelete.handle(n)}}t.exports=s},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.GuildRoleUpdate.handle(n)}}t.exports=s},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.GuildSync.handle(n)}}t.exports=s},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.GuildUpdate.handle(n)}}t.exports=s},function(t,e,n){const i=n(1),s=n(0);class r extends i{handle(t){const e=this.packetManager.client,n=t.d,i=e.actions.MessageCreate.handle(n);i.message&&e.emit(s.Events.MESSAGE_CREATE,i.message)}}t.exports=r},function(t,e,n){const i=n(1),s=n(0);class r extends i{handle(t){const e=this.packetManager.client,n=t.d,i=e.actions.MessageDelete.handle(n);i.message&&e.emit(s.Events.MESSAGE_DELETE,i.message)}}t.exports=r},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.MessageDeleteBulk.handle(n)}}t.exports=s},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.MessageReactionAdd.handle(n)}}t.exports=s},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.MessageReactionRemove.handle(n)}}t.exports=s},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.MessageReactionRemoveAll.handle(n)}}t.exports=s},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.MessageUpdate.handle(n)}}t.exports=s},function(t,e,n){const i=n(1),s=n(0),r=n(4);class o extends i{handle(t){const e=this.packetManager.client,n=t.d;let i=e.users.get(n.user.id);const o=e.guilds.get(n.guild_id);if(!i){if(!n.user.username)return;i=e.dataManager.newUser(n.user)}const u=r(i);if(i.patch(n.user),i.equals(u)||e.emit(s.Events.USER_UPDATE,u,i),o){let t=o.members.get(i.id);if(t||"offline"===n.status||(t=o._addMember({user:i,roles:n.roles,deaf:!1,mute:!1},!1),e.emit(s.Events.GUILD_MEMBER_AVAILABLE,t)),t){const u=r(t);t.presence&&(u.frozenPresence=r(t.presence)),o._setPresence(i.id,n),e.emit(s.Events.PRESENCE_UPDATE,u,t)}else o._setPresence(i.id,n)}}}t.exports=o},function(t,e,n){const i=n(1),s=n(27);class r extends i{handle(t){const e=this.packetManager.client,n=t.d,i=new s(e,n.user);e.user=i,e.readyAt=new Date,e.users.set(i.id,i);for(const r of n.guilds)e.dataManager.newGuild(r);for(const o of n.private_channels)e.dataManager.newChannel(o);for(const u of n.relationships){const t=e.dataManager.newUser(u.user);1===u.type?e.user.friends.set(t.id,t):2===u.type&&e.user.blocked.set(t.id,t)}n.presences=n.presences||[];for(const h of n.presences)e.dataManager.newUser(h.user),e._setPresence(h.user.id,h);if(n.notes)for(const a in n.notes){let t=n.notes[a];t.length||(t=null),e.user.notes.set(a,t)}!e.user.bot&&e.options.sync&&e.setInterval(e.syncGuilds.bind(e),3e4),e.once("ready",e.syncGuilds.bind(e)),e.users.has("1")||e.dataManager.newUser({id:"1",username:"Clyde",discriminator:"0000",avatar:"https://discordapp.com/assets/f78426a064bc9dd24847519259bc42af.png",bot:!0,status:"online",game:null,verified:!0}),e.setTimeout(()=>{e.ws.normalReady||e.ws._emitReady(!1)},1200*n.guilds.length),this.packetManager.ws.sessionID=n.session_id,this.packetManager.ws.checkIfReady()}}t.exports=r},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;1===n.type?e.fetchUser(n.id).then(t=>{e.user.friends.set(t.id,t)}):2===n.type&&e.fetchUser(n.id).then(t=>{e.user.blocked.set(t.id,t)})}}t.exports=s},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;2===n.type?e.user.blocked.has(n.id)&&e.user.blocked.delete(n.id):1===n.type&&e.user.friends.has(n.id)&&e.user.friends.delete(n.id)}}t.exports=s},function(t,e,n){function i(t,e){return t.client.setTimeout(()=>{t.client.emit(r.Events.TYPING_STOP,t,e,t._typing.get(e.id)),t._typing.delete(e.id)},6e3)}const s=n(1),r=n(0);class o extends s{handle(t){const e=this.packetManager.client,n=t.d,s=e.channels.get(n.channel_id),o=e.users.get(n.user_id),h=new Date(1e3*n.timestamp);if(s&&o){if("voice"===s.type)return void e.emit(r.Events.WARN,`Discord sent a typing packet to voice channel ${s.id}`);if(s._typing.has(o.id)){const t=s._typing.get(o.id);t.lastTimestamp=h,t.resetTimeout(i(s,o))}else s._typing.set(o.id,new u(e,h,h,i(s,o))),e.emit(r.Events.TYPING_START,s,o)}}}class u{constructor(t,e,n,i){this.client=t,this.since=e,this.lastTimestamp=n,this._timeout=i}resetTimeout(t){this.client.clearTimeout(this._timeout),this._timeout=t}get elapsedTime(){return Date.now()-this.since}}t.exports=o},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.UserNoteUpdate.handle(n)}}t.exports=s},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.UserUpdate.handle(n)}}t.exports=s},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.emit("self.voiceServer",n)}}t.exports=s},function(t,e,n){const i=n(1),s=n(0),r=n(4);class o extends i{handle(t){const e=this.packetManager.client,n=t.d,i=e.guilds.get(n.guild_id);if(i){const t=i.members.get(n.user_id);if(t){const i=r(t);t.voiceChannel&&t.voiceChannel.id!==n.channel_id&&t.voiceChannel.members.delete(i.id),n.channel_id||(t.speaking=null),t.user.id===e.user.id&&n.channel_id&&e.emit("self.voiceStateUpdate",n);const o=e.channels.get(n.channel_id);o&&o.members.set(t.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,e.emit(s.Events.VOICE_STATE_UPDATE,i,t)}}}}t.exports=o},function(t,e){class n{constructor(t,e){this.user=t,this.setup(e)}setup(t){this.type=t.type,this.name=t.name,this.id=t.id,this.revoked=t.revoked,this.integrations=t.integrations}}t.exports=n},function(t,e,n){const i=n(3),s=n(132);class r{constructor(t,e){this.user=t,this.client=this.user.client,Object.defineProperty(this,"client",{enumerable:!1,configurable:!1}),this.mutualGuilds=new i,this.connections=new i,this.setup(e)}setup(t){for(const e of t.mutual_guilds)this.client.guilds.has(e.id)&&this.mutualGuilds.set(e.id,this.client.guilds.get(e.id));for(const n of t.connected_accounts)this.connections.set(n.id,new s(this.user,n))}}t.exports=r},function(t,e){t.exports=function(t){if(t.includes("%")&&(t=decodeURIComponent(t)),t.includes(":")){const[e,n]=t.split(":");return{name:e,id:n}}return{name:t,id:null}}},function(t,e){t.exports=void 0},function(t,e){},function(t,e){},function(t,e,n){t.exports={Client:n(49),WebhookClient:n(50),Shard:n(52),ShardClientUtil:n(53),ShardingManager:n(54),Collection:n(3),splitMessage:n(41),escapeMarkdown:n(14),fetchRecommendedShards:n(51),Channel:n(8),ClientOAuth2Application:n(26),ClientUser:n(27),DMChannel:n(28),Emoji:n(9),EvaluatedPermissions:n(17),Game:n(6).Game,GroupDMChannel:n(29),Guild:n(18),GuildChannel:n(11),GuildMember:n(12),Invite:n(30),Message:n(13),MessageAttachment:n(31),MessageCollector:n(32),MessageEmbed:n(33),MessageReaction:n(34),OAuth2Application:n(35),PartialGuild:n(36),PartialGuildChannel:n(37),PermissionOverwrites:n(38),Presence:n(6).Presence,ReactionEmoji:n(19),Role:n(7),TextChannel:n(39),User:n(5),VoiceChannel:n(40),Webhook:n(20),version:n(25).version},"undefined"!=typeof window&&(window.Discord=t.exports)}]); |