diff --git a/discord.indev.js b/discord.indev.js
index 12bedbe7..26714b8f 100644
--- a/discord.indev.js
+++ b/discord.indev.js
@@ -1027,6 +1027,7 @@ class User {
for (const prop of ['id', 'username', 'discriminator', 'avatar', 'bot']) {
if (typeof data[prop] !== 'undefined') this[prop] = data[prop];
}
+ if (data.token) this.client.token = data.token;
}
/**
@@ -8430,6 +8431,7 @@ class ClientUser extends User {
* Changing usernames in Discord is heavily rate limited, with only 2 requests
* every hour. Use this sparingly!
* @param {string} username The new username
+ * @param {string} [password] Current password (only for user accounts)
* @returns {Promise}
* @example
* // set username
@@ -8437,38 +8439,40 @@ class ClientUser extends User {
* .then(user => console.log(`My new username is ${user.username}`))
* .catch(console.error);
*/
- setUsername(username) {
- return this.client.rest.methods.updateCurrentUser({ username });
+ setUsername(username, password) {
+ return this.client.rest.methods.updateCurrentUser({ username }, password);
}
/**
- * If this user is a "self bot" or logged in using a normal user's details (which should be avoided), you can set the
- * email here.
- * @param {string} email The new email
+ * Changes the email for the client user's account.
+ * This is only available when using a user account.
+ * @param {string} email New email to change to
+ * @param {string} password Current password
* @returns {Promise}
* @example
* // set email
- * client.user.setEmail('bob@gmail.com')
+ * client.user.setEmail('bob@gmail.com', 'some amazing password 123')
* .then(user => console.log(`My new email is ${user.email}`))
* .catch(console.error);
*/
- setEmail(email) {
- return this.client.rest.methods.updateCurrentUser({ email });
+ setEmail(email, password) {
+ return this.client.rest.methods.updateCurrentUser({ email }, password);
}
/**
- * If this user is a "self bot" or logged in using a normal user's details (which should be avoided), you can set the
- * password here.
- * @param {string} password The new password
+ * Changes the password for the client user's account.
+ * This is only available when using a user account.
+ * @param {string} newPassword New password to change to
+ * @param {string} oldPassword Current password
* @returns {Promise}
* @example
* // set password
- * client.user.setPassword('password123')
+ * client.user.setPassword('some new amazing password 456', 'some amazing password 123')
* .then(user => console.log('New password set!'))
* .catch(console.error);
*/
- setPassword(password) {
- return this.client.rest.methods.updateCurrentUser({ password });
+ setPassword(newPassword, oldPassword) {
+ return this.client.rest.methods.updateCurrentUser({ password: newPassword }, oldPassword);
}
/**
@@ -20701,14 +20705,14 @@ class RESTMethods {
);
}
- updateCurrentUser(_data) {
+ updateCurrentUser(_data, password) {
const user = this.rest.client.user;
const data = {};
data.username = _data.username || user.username;
data.avatar = this.rest.client.resolver.resolveBase64(_data.avatar) || user.avatar;
if (!user.bot) {
data.email = _data.email || user.email;
- data.password = this.rest.client.password;
+ data.password = password;
if (_data.new_password) data.new_password = _data.newPassword;
}
return this.rest.makeRequest('patch', Constants.Endpoints.me, true, data).then(newData =>
diff --git a/discord.indev.min.js b/discord.indev.min.js
index 06a43ff6..5d0598bc 100644
--- a/discord.indev.min.js
+++ b/discord.indev.min.js
@@ -1,4 +1,4 @@
-!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=58)}([function(t,e,n){(function(t){e.Package=n(27),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.",INVALID_TOKEN:"An invalid token was provided."};const i=e.PROTOCOL_VERSION=6,s=e.HOST=`https://discordapp.com`,r=e.API=`${s}/api/v${i}`,o=e.Endpoints={login:`${r}/auth/login`,logout:`${r}/auth/logout`,gateway:`${r}/gateway`,botGateway:`${r}/gateway/bot`,invite:t=>`${r}/invite/${t}`,inviteLink:t=>`https://discord.gg/${t}`,assets:t=>`${s}/assets/${t}`,CDN:"https://cdn.discordapp.com",user:t=>`${r}/users/${t}`,userChannels:t=>`${o.user(t)}/channels`,userProfile:t=>`${o.user(t)}/profile`,avatar:(t,e)=>"1"===t?e:`${o.user(t)}/avatars/${e}.jpg`,me:`${r}/users/@me`,meGuild:t=>`${o.me}/guilds/${t}`,meMentions:(t,e,n,i)=>`users/@me/mentions?limit=${t}&roles=${e}&everyone=${n}${i?`&guild_id=${i}`:""}`,relationships:t=>`${o.user(t)}/relationships`,note:t=>`${o.me}/notes/${t}`,guilds:`${r}/guilds`,guild:t=>`${o.guilds}/${t}`,guildIcon:(t,e)=>`${o.CDN}/icons/${t}/${e}.jpg`,guildSplash:(t,e)=>`${o.CDN}/splashes/${t}/${e}.jpg`,guildPrune:t=>`${o.guild(t)}/prune`,guildEmbed:t=>`${o.guild(t)}/embed`,guildInvites:t=>`${o.guild(t)}/invites`,guildRoles:t=>`${o.guild(t)}/roles`,guildRole:(t,e)=>`${o.guildRoles(t)}/${e}`,guildBans:t=>`${o.guild(t)}/bans`,guildIntegrations:t=>`${o.guild(t)}/integrations`,guildMembers:t=>`${o.guild(t)}/members`,guildMember:(t,e)=>`${o.guildMembers(t)}/${e}`,guildMemberRole:(t,e,n)=>`${o.guildMember(t,e)}/roles/${n}`,guildMemberNickname:t=>`${o.guildMember(t,"@me")}/nick`,guildChannels:t=>`${o.guild(t)}/channels`,guildEmojis:t=>`${o.guild(t)}/emojis`,channels:`${r}/channels`,channel:t=>`${o.channels}/${t}`,channelMessages:t=>`${o.channel(t)}/messages`,channelInvites:t=>`${o.channel(t)}/invites`,channelTyping:t=>`${o.channel(t)}/typing`,channelPermissions:t=>`${o.channel(t)}/permissions`,channelMessage:(t,e)=>`${o.channelMessages(t)}/${e}`,channelWebhooks:t=>`${o.channel(t)}/webhooks`,messageReactions:(t,e)=>`${o.channelMessage(t,e)}/reactions`,messageReaction:(t,e,n,i)=>`${o.messageReactions(t,e)}/${n}`+`${i?`?limit=${i}`:""}`,selfMessageReaction:(t,e,n,i)=>`${o.messageReaction(t,e,n,i)}/@me`,userMessageReaction:(t,e,n,i,s)=>`${o.messageReaction(t,e,n,i)}/${s}`,webhook:(t,e)=>`${r}/webhooks/${t}${e?`/${e}`:""}`,myApplication:`${r}/oauth2/applications/@me`,getApp:t=>`${r}/oauth2/authorize?client_id=${t}`,emoji:t=>`${o.CDN}/emojis/${t}.png`};e.Status={READY:0,CONNECTING:1,RECONNECTING:2,IDLE:3,NEARLY:4,DISCONNECTED:5},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_CACHED:"guildCached",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_CACHED:"channelCached",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",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"},e.DefaultAvatars={BLURPLE:"6debd47ed13483642cf09e832ed0bc1b",GREY:"322c936a8c8be1b803cd94861bdfa868",GREEN:"dd4dbc0016779df1378e7812eabaa04d",ORANGE:"0e291f67c9274a1abdddeb3fd919cbaa",RED:"1cbd08c76f8af6dddce02c5138971129"};const a=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 h=0;for(const u in a)h|=a[u];e.ALL_PERMISSIONS=h,e.DEFAULT_PERMISSIONS=104324097}).call(e,n(24))},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){return this._array=null,this._keyArray=null,super.set(t,e)}delete(t){return this._array=null,this._keyArray=null,super.delete(t)}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}equals(t){return!!t&&(this===t||this.size===t.size&&!this.find((e,n)=>{const i=t.get(n);return i!==e||void 0===i&&!t.has(n)}))}}t.exports=n},function(t,e){t.exports=function(t){const e=Object.create(t);return Object.assign(e,t),e}},function(t,e){"use strict";var n="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;e.assign=function(t){for(var e=Array.prototype.slice.call(arguments,1);e.length;){var n=e.shift();if(n){if("object"!=typeof n)throw new TypeError(n+"must be non-object");for(var i in n)n.hasOwnProperty(i)&&(t[i]=n[i])}}return t},e.shrinkBuf=function(t,e){return t.length===e?t:t.subarray?t.subarray(0,e):(t.length=e,t)};var i={arraySet:function(t,e,n,i,s){if(e.subarray&&t.subarray)return void t.set(e.subarray(n,n+i),s);for(var r=0;r"dm"===t.type).find(t=>t.recipient.id===this.id)}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(){}sendEmbed(){}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 this===t||(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 this===t||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){Object.defineProperty(this,"client",{value:t.client}),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))}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}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).then(()=>this)}setPermissions(t){return this.edit({permissions:t})}setMentionable(t){return this.edit({mentionable:t})}delete(){return this.client.rest.methods.deleteGuildRole(this)}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){Object.defineProperty(this,"client",{value:t}),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){Object.defineProperty(this,"client",{value:t.client}),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.emoji(this.id)}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){const i=n(33),s=n(35),r=n(36),o=n(3),a=n(0),h=n(15),u=n(58);class c{constructor(t,e,n){Object.defineProperty(this,"client",{value:n}),this.channel=t,e&&this.setup(e)}setup(t){this.id=t.id,this.type=a.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 o;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 o,roles:new o,channels:new o,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 o,t.reactions&&t.reactions.length>0)for(const h of t.reactions){const t=h.emoji.id?`${h.emoji.name}:${h.emoji.id}`:h.emoji.name;this.reactions.set(t,new r(this,h.emoji,h.count,h.me))}this.webhookID=t.webhook_id||null}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 o;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 o,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 r(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(){const t=this._edits.slice();return t.unshift(this),t}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(a.PermissionFlags.MANAGE_MESSAGES)}get pinnable(){return!this.guild||this.channel.permissionsFor(this.client.user).hasPermission(a.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)}isMemberMentioned(t){return!!this.mentions.everyone||(!!this.mentions.users.has(t.id)||!!(t instanceof u.GuildMember&&t.roles.some(t=>this.mentions.roles.has(t.id))))}edit(t,e={}){return this.client.rest.methods.updateMessage(this,t,e)}editCode(t,e){return e=h(this.client.resolver.resolveString(e),!0),this.edit(`\`\`\`${t||""}
+!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=58)}([function(t,e,n){(function(t){e.Package=n(27),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.",INVALID_TOKEN:"An invalid token was provided."};const i=e.PROTOCOL_VERSION=6,s=e.HOST=`https://discordapp.com`,r=e.API=`${s}/api/v${i}`,o=e.Endpoints={login:`${r}/auth/login`,logout:`${r}/auth/logout`,gateway:`${r}/gateway`,botGateway:`${r}/gateway/bot`,invite:t=>`${r}/invite/${t}`,inviteLink:t=>`https://discord.gg/${t}`,assets:t=>`${s}/assets/${t}`,CDN:"https://cdn.discordapp.com",user:t=>`${r}/users/${t}`,userChannels:t=>`${o.user(t)}/channels`,userProfile:t=>`${o.user(t)}/profile`,avatar:(t,e)=>"1"===t?e:`${o.user(t)}/avatars/${e}.jpg`,me:`${r}/users/@me`,meGuild:t=>`${o.me}/guilds/${t}`,meMentions:(t,e,n,i)=>`users/@me/mentions?limit=${t}&roles=${e}&everyone=${n}${i?`&guild_id=${i}`:""}`,relationships:t=>`${o.user(t)}/relationships`,note:t=>`${o.me}/notes/${t}`,guilds:`${r}/guilds`,guild:t=>`${o.guilds}/${t}`,guildIcon:(t,e)=>`${o.CDN}/icons/${t}/${e}.jpg`,guildSplash:(t,e)=>`${o.CDN}/splashes/${t}/${e}.jpg`,guildPrune:t=>`${o.guild(t)}/prune`,guildEmbed:t=>`${o.guild(t)}/embed`,guildInvites:t=>`${o.guild(t)}/invites`,guildRoles:t=>`${o.guild(t)}/roles`,guildRole:(t,e)=>`${o.guildRoles(t)}/${e}`,guildBans:t=>`${o.guild(t)}/bans`,guildIntegrations:t=>`${o.guild(t)}/integrations`,guildMembers:t=>`${o.guild(t)}/members`,guildMember:(t,e)=>`${o.guildMembers(t)}/${e}`,guildMemberRole:(t,e,n)=>`${o.guildMember(t,e)}/roles/${n}`,guildMemberNickname:t=>`${o.guildMember(t,"@me")}/nick`,guildChannels:t=>`${o.guild(t)}/channels`,guildEmojis:t=>`${o.guild(t)}/emojis`,channels:`${r}/channels`,channel:t=>`${o.channels}/${t}`,channelMessages:t=>`${o.channel(t)}/messages`,channelInvites:t=>`${o.channel(t)}/invites`,channelTyping:t=>`${o.channel(t)}/typing`,channelPermissions:t=>`${o.channel(t)}/permissions`,channelMessage:(t,e)=>`${o.channelMessages(t)}/${e}`,channelWebhooks:t=>`${o.channel(t)}/webhooks`,messageReactions:(t,e)=>`${o.channelMessage(t,e)}/reactions`,messageReaction:(t,e,n,i)=>`${o.messageReactions(t,e)}/${n}`+`${i?`?limit=${i}`:""}`,selfMessageReaction:(t,e,n,i)=>`${o.messageReaction(t,e,n,i)}/@me`,userMessageReaction:(t,e,n,i,s)=>`${o.messageReaction(t,e,n,i)}/${s}`,webhook:(t,e)=>`${r}/webhooks/${t}${e?`/${e}`:""}`,myApplication:`${r}/oauth2/applications/@me`,getApp:t=>`${r}/oauth2/authorize?client_id=${t}`,emoji:t=>`${o.CDN}/emojis/${t}.png`};e.Status={READY:0,CONNECTING:1,RECONNECTING:2,IDLE:3,NEARLY:4,DISCONNECTED:5},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_CACHED:"guildCached",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_CACHED:"channelCached",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",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"},e.DefaultAvatars={BLURPLE:"6debd47ed13483642cf09e832ed0bc1b",GREY:"322c936a8c8be1b803cd94861bdfa868",GREEN:"dd4dbc0016779df1378e7812eabaa04d",ORANGE:"0e291f67c9274a1abdddeb3fd919cbaa",RED:"1cbd08c76f8af6dddce02c5138971129"};const a=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 h=0;for(const u in a)h|=a[u];e.ALL_PERMISSIONS=h,e.DEFAULT_PERMISSIONS=104324097}).call(e,n(24))},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){return this._array=null,this._keyArray=null,super.set(t,e)}delete(t){return this._array=null,this._keyArray=null,super.delete(t)}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}equals(t){return!!t&&(this===t||this.size===t.size&&!this.find((e,n)=>{const i=t.get(n);return i!==e||void 0===i&&!t.has(n)}))}}t.exports=n},function(t,e){t.exports=function(t){const e=Object.create(t);return Object.assign(e,t),e}},function(t,e){"use strict";var n="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;e.assign=function(t){for(var e=Array.prototype.slice.call(arguments,1);e.length;){var n=e.shift();if(n){if("object"!=typeof n)throw new TypeError(n+"must be non-object");for(var i in n)n.hasOwnProperty(i)&&(t[i]=n[i])}}return t},e.shrinkBuf=function(t,e){return t.length===e?t:t.subarray?t.subarray(0,e):(t.length=e,t)};var i={arraySet:function(t,e,n,i,s){if(e.subarray&&t.subarray)return void t.set(e.subarray(n,n+i),s);for(var r=0;r"dm"===t.type).find(t=>t.recipient.id===this.id)}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(){}sendEmbed(){}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 this===t||(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 this===t||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){Object.defineProperty(this,"client",{value:t.client}),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))}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}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).then(()=>this)}setPermissions(t){return this.edit({permissions:t})}setMentionable(t){return this.edit({mentionable:t})}delete(){return this.client.rest.methods.deleteGuildRole(this)}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){Object.defineProperty(this,"client",{value:t}),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){Object.defineProperty(this,"client",{value:t.client}),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.emoji(this.id)}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){const i=n(33),s=n(35),r=n(36),o=n(3),a=n(0),h=n(15),u=n(58);class c{constructor(t,e,n){Object.defineProperty(this,"client",{value:n}),this.channel=t,e&&this.setup(e)}setup(t){this.id=t.id,this.type=a.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 o;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 o,roles:new o,channels:new o,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 o,t.reactions&&t.reactions.length>0)for(const h of t.reactions){const t=h.emoji.id?`${h.emoji.name}:${h.emoji.id}`:h.emoji.name;this.reactions.set(t,new r(this,h.emoji,h.count,h.me))}this.webhookID=t.webhook_id||null}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 o;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 o,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 r(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(){const t=this._edits.slice();return t.unshift(this),t}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(a.PermissionFlags.MANAGE_MESSAGES)}get pinnable(){return!this.guild||this.channel.permissionsFor(this.client.user).hasPermission(a.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)}isMemberMentioned(t){return!!this.mentions.everyone||(!!this.mentions.users.has(t.id)||!!(t instanceof u.GuildMember&&t.roles.some(t=>this.mentions.roles.has(t.id))))}edit(t,e={}){return this.client.rest.methods.updateMessage(this,t,e)}editCode(t,e){return e=h(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)}fetchWebhook(){return this.webhookID?this.client.fetchWebhook(this.webhookID):Promise.reject(new Error("The message was not sent by a webhook."))}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 r(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=c},function(t,e,n){const i=n(23),s=n(11),r=n(34),o=n(3),a=n(41),h=n(15);class u{constructor(){this.messages=new o,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)}sendEmbed(t,e,n={}){t instanceof a||(t=new a(t));let i;return e&&("string"==typeof e?i=e:n=e),n.embed=t,this.sendMessage(i,n)}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.sendMessage(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=h(this.client.resolver.resolveString(e),!0),this.sendMessage(`\`\`\`${t||""}
@@ -7,8 +7,8 @@ ${e}
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,n){return this.client.rest.methods.createChannel(this,t,e,n)}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.map(n=>({id:n.id,position:n.id===t?e:n.position`:this.name}}t.exports=n},function(t,e,n){const i=n(23),s=n(15);class r{constructor(t,e,n){t?(Object.defineProperty(this,"client",{value:t}),e&&this.setup(e)):(this.id=e,this.token=n,Object.defineProperty(this,"client",{value:this}))}setup(t){this.name=t.name,this.token=t.token,this.avatar=t.avatar,this.id=t.id,this.guildID=t.guild_id,this.channelID=t.channel_id,t.user&&(this.owner=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,a,h,u;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:a=Array.prototype.slice.call(arguments,1),n.apply(this,a)}else if(r(n))for(a=Array.prototype.slice.call(arguments,1),u=n.slice(),s=u.length,h=0;h0&&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,a;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(a=o;a-- >0;)if(n[a]===e||n[a].listener&&n[a].listener===e){s=a;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){"use strict";t.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},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=-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=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),a=o,h=0;h1)for(var n=1;n=0?"&":"?")+t),this._sort){var e=this.url.indexOf("?");if(e>=0){var n=this.url.substring(e+1).split("&");g(this._sort)?n.sort(this._sort):n.sort(),this.url=this.url.substring(0,e)+"?"+n.join("&")}}},c.prototype._isHost=function(t){return t&&"object"==typeof t&&!Array.isArray(t)&&"[object Object]"!==Object.prototype.toString.call(t)},c.prototype.end=function(t){var e=this,n=this.xhr=E.getXHR(),s=this._formData||this._data;this._endCalled&&console.warn("Warning: .end() was called twice. This is not supported in superagent"),this._endCalled=!0,this._callback=t||i,n.onreadystatechange=function(){var t=n.readyState;if(t>=2&&e._responseTimeoutTimer&&clearTimeout(e._responseTimeoutTimer),4==t){var i;try{i=n.status}catch(t){i=0}if(!i){if(e.timedout||e._aborted)return;return e.crossDomainError()}e.emit("end")}};var r=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=r.bind(null,"download"),n.upload&&(n.upload.onprogress=r.bind(null,"upload"))}catch(t){}if(this._appendQueryString(),this._setTimeouts(),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),!this._formData&&"GET"!=this.method&&"HEAD"!=this.method&&"string"!=typeof s&&!this._isHost(s)){var o=this._header["content-type"],a=this._serializer||E.serialize[o?o.split(";")[0]:""];!a&&h(o)&&(a=E.serialize["application/json"]),a&&(s=a(s))}for(var u in this.header)null!=this.header[u]&&n.setRequestHeader(u,this.header[u]);return this._responseType&&(n.responseType=this._responseType),this.emit("request",this),n.send("undefined"!=typeof s?s:null),this},E.get=function(t,e,n){var i=E("GET",t);return"function"==typeof e&&(n=e,e=null),e&&i.query(e),n&&i.end(n),i},E.head=function(t,e,n){var i=E("HEAD",t);return"function"==typeof e&&(n=e,e=null),e&&i.send(e),n&&i.end(n),i},E.options=function(t,e,n){var i=E("OPTIONS",t);return"function"==typeof e&&(n=e,e=null),e&&i.send(e),n&&i.end(n),i},E.del=l,E.delete=l,E.patch=function(t,e,n){var i=E("PATCH",t);return"function"==typeof e&&(n=e,e=null),e&&i.send(e),n&&i.end(n),i},E.post=function(t,e,n){var i=E("POST",t);return"function"==typeof e&&(n=e,e=null),e&&i.send(e),n&&i.end(n),i},E.put=function(t,e,n){var i=E("PUT",t);return"function"==typeof e&&(n=e,e=null),e&&i.send(e),n&&i.end(n),i}},function(t,e){function n(t){return null!==t&&"object"==typeof t}t.exports=n},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",types:"./typings/index.d.ts",scripts:{test:"eslint src && docgen --source src --custom docs/index.yml",docs:"docgen --source src --custom docs/index.yml --output docs/docs.json","test-docs":"docgen --source src --custom docs",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 ",license:"Apache-2.0",bugs:{url:"https://github.com/hydrabolt/discord.js/issues"},homepage:"https://github.com/hydrabolt/discord.js#readme",runkitExampleFilename:"./docs/examples/ping.js",dependencies:{"@types/node":"^6.0.51",pako:"^1.0.3",superagent:"^3.0.0",tweetnacl:"^0.14.3",ws:"^1.1.1"},peerDependencies:{erlpack:"github:hammerandchisel/erlpack","node-opus":"^0.2.0",opusscript:"^0.0.1",uws:"^0.11.1"},devDependencies:{bufferutil:"^1.2.1","discord.js-docgen":"github:hydrabolt/discord.js-docgen",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"},engines:{node:">=6.0.0"},browser:{ws:!1,uws:!1,erlpack:!1,opusscript:!1,"node-opus":!1,"tweet-nacl":!1,"src/sharding/Shard.js":!1,"src/sharding/ShardClientUtil.js":!1,"src/sharding/ShardingManager.js":!1,"src/client/voice/dispatcher/StreamDispatcher.js":!1,"src/client/voice/opus/BaseOpusEngine.js":!1,"src/client/voice/opus/NodeOpusEngine.js":!1,"src/client/voice/opus/OpusEngineList.js":!1,"src/client/voice/opus/OpusScriptEngine.js":!1,"src/client/voice/pcm/ConverterEngine.js":!1,"src/client/voice/pcm/ConverterEngineList.js":!1,"src/client/voice/pcm/FfmpegConverterEngine.js":!1,"src/client/voice/player/AudioPlayer.js":!1,"src/client/voice/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(6),s=n(37);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(6),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})}fetchMentions(t={limit:25,roles:true,everyone:true,guild:null}){return this.client.rest.methods.fetchMentions(t)}addFriend(t){return t=this.client.resolver.resolveUser(t),this.client.rest.methods.addFriend(t)}removeFriend(t){return t=this.client.resolver.resolveUser(t),this.client.rest.methods.removeFriend(t)}createGuild(t,e,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(9),s=n(12),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(){}sendEmbed(){}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(9),s=n(12),r=n(3);class o 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;return e?this.recipients.equals(t.recipients):e}toString(){return this.name}sendMessage(){}sendTTSMessage(){}sendEmbed(){}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(38),s=n(39),r=n(0);class o{constructor(t,e){Object.defineProperty(this,"client",{value:t}),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){Object.defineProperty(this,"client",{value:t.client}),this.message=t,this.setup(e)}setup(t){this.id=t.id,this.filename=t.filename,this.filesize=t.size,this.url=t.url,this.proxyURL=t.proxy_url,this.height=t.height,this.width=t.width}}t.exports=n},function(t,e,n){const i=n(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){Object.defineProperty(this,"client",{value:t.client}),this.message=t,this.setup(e)}setup(t){if(this.type=t.type,this.title=t.title,this.description=t.description,this.url=t.url,this.color=t.color,this.fields=[],t.fields)for(const e of t.fields)this.fields.push(new 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 a(this,t.footer):null}get createdAt(){return new Date(this.createdTimestamp)}get hexColor(){let t=this.color.toString(16);for(;t.length<6;)t=`0${t}`;return`#${t}`}}class 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,this.iconURL=t.icon_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 a{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=a,t.exports=n},function(t,e,n){const i=n(3),s=n(10),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){Object.defineProperty(this,"client",{value:t}),this.setup(e)}setup(t){this.id=t.id,this.name=t.name,this.description=t.description,this.icon=t.icon,this.iconURL=`https://cdn.discordapp.com/app-icons/${this.id}/${this.icon}.jpg`,this.rpcOrigins=t.rpc_origins}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){Object.defineProperty(this,"client",{value:t}),this.setup(e)}setup(t){this.id=t.id,this.name=t.name,this.icon=t.icon,this.splash=t.splash}}t.exports=n},function(t,e,n){const i=n(0);class s{constructor(t,e){Object.defineProperty(this,"client",{value:t}),this.setup(e)}setup(t){this.id=t.id,this.name=t.name,this.type=i.ChannelTypes.text===t.type?"text":"voice"}}t.exports=s},function(t,e){class n{constructor(t,e){Object.defineProperty(this,"channel",{value:t}),e&&this.setup(e)}setup(t){this.id=t.id,this.type=t.type,this.deny=t.deny,this.allow=t.allow}delete(){return this.channel.client.rest.methods.deletePermissionOverwrites(this)}}t.exports=n},function(t,e){class n{constructor(t={}){this.title=t.title,this.description=t.description,this.url=t.url,this.color=t.color,this.author=t.author,this.timestamp=t.timestamp,this.fields=t.fields||[],this.thumbnail=t.thumbnail,this.image=t.image,this.footer=t.footer}setTitle(t){if(t.length>256)throw new RangeError("RichEmbed titles may not exceed 256 characters.");return this.title=t,this}setDescription(t){if(t.length>2048)throw new RangeError("RichEmbed descriptions may not exceed 2048 characters.");return this.description=t,this}setURL(t){return this.url=t,this}setColor(t){if(t instanceof Array?t=(t[0]<<16)+(t[1]<<8)+t[2]:"string"==typeof t&&t.startsWith("#")&&(t=parseInt(t.replace("#",""),16)),t<0||t>16777215)throw new RangeError("RichEmbed color must be within the range 0 - 16777215 (0xFFFFFF).");if(t&&isNaN(parseInt(t)))throw new TypeError("Unable to convert RichEmbed color to a number.");return this.color=t,this}setAuthor(t,e,n){return this.author={name:t,icon_url:e,url:n},this}setTimestamp(t=new Date){return this.timestamp=t,this}addField(t,e,n=false){if(this.fields.length>=25)throw new RangeError("RichEmbeds may not exceed 25 fields.");if(t.length>256)throw new RangeError("RichEmbed field names may not exceed 256 characters.");if("undefined"!=typeof e&&(e instanceof Array?e=e.join("\n"):"string"!=typeof e&&(e=String(e))),e.length>1024)throw new RangeError("RichEmbed field values may not exceed 1024 characters.");return this.fields.push({name:t,value:e,inline:n}),this}setThumbnail(t){return this.thumbnail={url:t},this}setImage(t){return this.image={url:t},this}setFooter(t,e){if(t.length>2048)throw new RangeError("RichEmbed footer text may not exceed 2048 characters.");return this.footer={text:t,icon_url:e},this}}t.exports=n},function(t,e,n){const i=n(13),s=n(12),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(){}sendEmbed(){}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(13),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;smaxLength&&(n[i]+=append,n.push(prepend),i++),n[i]+=(n[i].length>0&&n[i]!==prepend?char:"")+e[s];return n}},function(t,e,n){"use strict";function i(t,e){if(e<65537&&(t.subarray&&o||!t.subarray&&r))return String.fromCharCode.apply(null,s.shrinkBuf(t,e));for(var n="",i=0;i=252?6:h>=248?5:h>=240?4:h>=224?3:h>=192?2:1;a[254]=a[254]=1,e.string2buf=function(t){
-var e,n,i,r,o,a=t.length,h=0;for(r=0;r>>6,e[o++]=128|63&n):n<65536?(e[o++]=224|n>>>12,e[o++]=128|n>>>6&63,e[o++]=128|63&n):(e[o++]=240|n>>>18,e[o++]=128|n>>>12&63,e[o++]=128|n>>>6&63,e[o++]=128|63&n);return e},e.buf2binstring=function(t){return i(t,t.length)},e.binstring2buf=function(t){for(var e=new s.Buf8(t.length),n=0,i=e.length;n4)u[s++]=65533,n+=o-1;else{for(r&=2===o?31:3===o?15:7;o>1&&n1?u[s++]=65533:r<65536?u[s++]=r:(r-=65536,u[s++]=55296|r>>10&1023,u[s++]=56320|1023&r)}return i(u,s)},e.utf8border=function(t,e){var n;for(e=e||t.length,e>t.length&&(e=t.length),n=e-1;n>=0&&128===(192&t[n]);)n--;return n<0?e:0===n?e:n+a[t[n]]>e?n:e}},function(t,e){"use strict";function n(t,e,n,i){for(var s=65535&t|0,r=t>>>16&65535|0,o=0;0!==n;){o=n>2e3?2e3:n,n-=o;do s=s+e[i++]|0,r=r+s|0;while(--o);s%=65521,r%=65521}return s|r<<16|0}t.exports=n},function(t,e){"use strict";t.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},function(t,e){"use strict";function n(){for(var t,e=[],n=0;n<256;n++){t=n;for(var i=0;i<8;i++)t=1&t?3988292384^t>>>1:t>>>1;e[n]=t}return e}function i(t,e,n,i){var r=s,o=i+n;t^=-1;for(var a=i;a>>8^r[255&(t^e[a])];return t^-1}var s=n();t.exports=i},function(t,e){"use strict";function n(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}t.exports=n},function(t,e){},function(t,e,n){(function(e){const i=n(23),s=n(50),r=n(25),o=n(0),a=n(54),h=n(6),u=n(11),c=n(18),l=n(9),d=n(14),f=n(10),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 d?t.user:t instanceof u?t.author:t instanceof c?t.owner:null}resolveUserID(t){return t instanceof h||t instanceof d?t.id:"string"==typeof t?t||null:t instanceof u?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 d?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 u?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}resolvePermissions(t){let e=0;for(const n of t)e|=this.resolvePermission(n);return e}resolveString(t){return"string"==typeof t?t:t instanceof Array?t.join("\n"):String(t)}resolveBase64(t){return t instanceof e?`data:image/jpg;base64,${t.toString("base64")}`:t}resolveBuffer(t){return t instanceof e?Promise.resolve(t):this.client.browser&&t instanceof ArrayBuffer?Promise.resolve(a(t)):"string"==typeof t?new Promise((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(a(i.xhr.response)):i.body instanceof e?n(i.body):o(new TypeError("The response body isn't 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 f||t instanceof p?t.identifier:"string"!=typeof t||t.includes("%")?null:encodeURIComponent(t)}}t.exports=m}).call(e,n(16).Buffer)},function(t,e,n){const i=n(114),s=n(111),r=n(113),o=n(112),a=n(110),h=n(0);class u{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 a(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=u},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;s0&&this.setInterval(this.sweepMessages.bind(this),1e3*this.options.messageSweepInterval)}get status(){return this.ws.status}get uptime(){return this.readyAt?Date.now()-this.readyAt:null}get ping(){return this.pings.reduce((t,e)=>t+e,0)/this.pings.length}get voiceConnections(){return this.browser?new Collection:this.voice.connections}get emojis(){const t=new Collection;for(const e of this.guilds.values())for(const n of e.emojis.values())t.set(n.id,n);return t}get readyTimestamp(){return this.readyAt?this.readyAt.getTime():null}get browser(){return"undefined"!=typeof window}login(t){return this.rest.methods.login(t)}destroy(){for(const t of this._timeouts)clearTimeout(t);for(const e of this._intervals)clearInterval(e);return this._timeouts.clear(),this._intervals.clear(),this.manager.destroy()}syncGuilds(t=this.guilds){this.user.bot||this.ws.send({op:12,d:t instanceof Collection?t.keyArray():t.map(t=>t.id)})}fetchUser(t){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()}generateInvite(t){return t?t instanceof Array&&(t=this.resolver.resolvePermissions(t)):t=0,this.fetchApplication().then(e=>`https://discordapp.com/oauth2/authorize?client_id=${e.id}&permissions=${t}&scope=bot`)}setTimeout(t,e,...n){const i=setTimeout(()=>{t(),this._timeouts.delete(i)},e,...n);return this._timeouts.add(i),i}clearTimeout(t){clearTimeout(t),this._timeouts.delete(t)}setInterval(t,e,...n){const i=setInterval(t,e,...n);return this._intervals.add(i),i}clearInterval(t){clearInterval(t),this._intervals.delete(t)}_pong(t){this.pings.unshift(Date.now()-t),this.pings.length>3&&(this.pings.length=3)}_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__(24))},function(t,e,n){const i=n(20),s=n(52),r=n(51),o=n(55),a=n(0);class h extends i{constructor(t,e,n){super(null,t,e),this.options=o(a.DefaultOptions,n),this.rest=new s(this),this.resolver=new r(this)}}t.exports=h},function(t,e,n){t.exports={Client:n(56),WebhookClient:n(57),Shard:n(60),ShardClientUtil:n(61),ShardingManager:n(62),Collection:n(3),splitMessage:n(44),escapeMarkdown:n(15),fetchRecommendedShards:n(59),Channel:n(9),ClientOAuth2Application:n(28),ClientUser:n(29),DMChannel:n(30),Emoji:n(10),EvaluatedPermissions:n(17),Game:n(7).Game,GroupDMChannel:n(31),Guild:n(18),GuildChannel:n(13),GuildMember:n(14),Invite:n(32),Message:n(11),MessageAttachment:n(33),MessageCollector:n(34),MessageEmbed:n(35),MessageReaction:n(36),OAuth2Application:n(37),PartialGuild:n(38),PartialGuildChannel:n(39),PermissionOverwrites:n(40),Presence:n(7).Presence,ReactionEmoji:n(19),RichEmbed:n(41),Role:n(8),TextChannel:n(42),User:n(6),VoiceChannel:n(43),Webhook:n(20),version:n(27).version,Constants:n(0)},"undefined"!=typeof window&&(window.Discord=t.exports)},function(t,e,n){const i=n(25),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,a,h=t.length;o=n(t),a=new c(3*h/4-o),s=o>0?h-4:h;var l=0;for(e=0,i=0;e>16&255,a[l++]=r>>8&255,a[l++]=255&r;return 2===o?(r=u[t.charCodeAt(e)]<<2|u[t.charCodeAt(e+1)]>>4,a[l++]=255&r):1===o&&(r=u[t.charCodeAt(e)]<<10|u[t.charCodeAt(e+1)]<<4|u[t.charCodeAt(e+2)]>>2,a[l++]=r>>8&255,a[l++]=255&r),a}function 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;oc?c:u+a));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=a;for(var h=[],u=[],c="undefined"!=typeof Uint8Array?Uint8Array:Array,l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",d=0,f=l.length;d>1,c=-7,l=n?s-1:0,d=n?-1:1,f=t[e+l];for(l+=d,r=f&(1<<-c)-1,f>>=-c,c+=a;c>0;r=256*r+t[e+l],l+=d,c-=8);for(o=r&(1<<-c)-1,r>>=-c,c+=i;c>0;o=256*o+t[e+l],l+=d,c-=8);if(0===r)r=1-u;else{if(r===h)return o?NaN:(f?-1:1)*(1/0);o+=Math.pow(2,i),r-=u}return(f?-1:1)*o*Math.pow(2,r-i)},e.write=function(t,e,n,i,s,r){var o,a,h,u=8*r-s-1,c=(1<>1,d=23===s?Math.pow(2,-24)-Math.pow(2,-77):0,f=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?(a=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?d/h:d*Math.pow(2,1-l),e*h>=2&&(o++,h/=2),o+l>=c?(a=0,o=c):o+l>=1?(a=(e*h-1)*Math.pow(2,s),o+=l):(a=e*Math.pow(2,l-1)*Math.pow(2,s),o=0));s>=8;t[n+f]=255&a,f+=p,a/=256,s-=8);for(o=o<0;t[n+f]=255&o,f+=p,o/=256,u-=8);t[n+f-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){"use strict";var i=n(5).assign,s=n(68),r=n(69),o=n(47),a={};i(a,s,r,o),t.exports=a},function(t,e,n){"use strict";function i(t){if(!(this instanceof i))return new i(t);this.options=h.assign({level:E,method:v,chunkSize:16384,windowBits:15,memLevel:8,strategy:w,to:""},t||{});var e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new l,this.strm.avail_out=0;var n=a.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(n!==m)throw new Error(c[n]);if(e.header&&a.deflateSetHeader(this.strm,e.header),e.dictionary){var s;if(s="string"==typeof e.dictionary?u.string2buf(e.dictionary):"[object ArrayBuffer]"===d.call(e.dictionary)?new Uint8Array(e.dictionary):e.dictionary,n=a.deflateSetDictionary(this.strm,s),n!==m)throw new Error(c[n]);this._dict_set=!0}}function s(t,e){var n=new i(e);if(n.push(t,!0),n.err)throw n.msg||c[n.err];return n.result}function r(t,e){return e=e||{},e.raw=!0,s(t,e)}function o(t,e){return e=e||{},e.gzip=!0,s(t,e)}var a=n(70),h=n(5),u=n(45),c=n(22),l=n(49),d=Object.prototype.toString,f=0,p=4,m=0,g=1,_=2,E=-1,w=0,v=8;i.prototype.push=function(t,e){var n,i,s=this.strm,r=this.options.chunkSize;if(this.ended)return!1;i=e===~~e?e:e===!0?p:f,"string"==typeof t?s.input=u.string2buf(t):"[object ArrayBuffer]"===d.call(t)?s.input=new Uint8Array(t):s.input=t,s.next_in=0,s.avail_in=s.input.length;do{if(0===s.avail_out&&(s.output=new h.Buf8(r),s.next_out=0,s.avail_out=r),n=a.deflate(s,i),n!==g&&n!==m)return this.onEnd(n),this.ended=!0,!1;0!==s.avail_out&&(0!==s.avail_in||i!==p&&i!==_)||("string"===this.options.to?this.onData(u.buf2binstring(h.shrinkBuf(s.output,s.next_out))):this.onData(h.shrinkBuf(s.output,s.next_out)))}while((s.avail_in>0||0===s.avail_out)&&n!==g);return i===p?(n=a.deflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===m):i!==_||(this.onEnd(m),s.avail_out=0,!0)},i.prototype.onData=function(t){this.chunks.push(t)},i.prototype.onEnd=function(t){t===m&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=h.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},e.Deflate=i,e.deflate=s,e.deflateRaw=r,e.gzip=o},function(t,e,n){"use strict";function i(t){if(!(this instanceof i))return new i(t);this.options=a.assign({chunkSize:16384,windowBits:0,to:""},t||{});var e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,0===e.windowBits&&(e.windowBits=-15)),!(e.windowBits>=0&&e.windowBits<16)||t&&t.windowBits||(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&0===(15&e.windowBits)&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new l,this.strm.avail_out=0;var n=o.inflateInit2(this.strm,e.windowBits);if(n!==u.Z_OK)throw new Error(c[n]);this.header=new d,o.inflateGetHeader(this.strm,this.header)}function s(t,e){var n=new i(e);if(n.push(t,!0),n.err)throw n.msg||c[n.err];return n.result}function r(t,e){return e=e||{},e.raw=!0,s(t,e)}var o=n(73),a=n(5),h=n(45),u=n(47),c=n(22),l=n(49),d=n(71),f=Object.prototype.toString;i.prototype.push=function(t,e){var n,i,s,r,c,l,d=this.strm,p=this.options.chunkSize,m=this.options.dictionary,g=!1;if(this.ended)return!1;i=e===~~e?e:e===!0?u.Z_FINISH:u.Z_NO_FLUSH,"string"==typeof t?d.input=h.binstring2buf(t):"[object ArrayBuffer]"===f.call(t)?d.input=new Uint8Array(t):d.input=t,d.next_in=0,d.avail_in=d.input.length;do{if(0===d.avail_out&&(d.output=new a.Buf8(p),d.next_out=0,d.avail_out=p),n=o.inflate(d,u.Z_NO_FLUSH),n===u.Z_NEED_DICT&&m&&(l="string"==typeof m?h.string2buf(m):"[object ArrayBuffer]"===f.call(m)?new Uint8Array(m):m,n=o.inflateSetDictionary(this.strm,l)),n===u.Z_BUF_ERROR&&g===!0&&(n=u.Z_OK,g=!1),n!==u.Z_STREAM_END&&n!==u.Z_OK)return this.onEnd(n),this.ended=!0,!1;d.next_out&&(0!==d.avail_out&&n!==u.Z_STREAM_END&&(0!==d.avail_in||i!==u.Z_FINISH&&i!==u.Z_SYNC_FLUSH)||("string"===this.options.to?(s=h.utf8border(d.output,d.next_out),r=d.next_out-s,c=h.buf2string(d.output,s),d.next_out=r,d.avail_out=p-r,r&&a.arraySet(d.output,d.output,s,r,0),this.onData(c)):this.onData(a.shrinkBuf(d.output,d.next_out)))),0===d.avail_in&&0===d.avail_out&&(g=!0)}while((d.avail_in>0||0===d.avail_out)&&n!==u.Z_STREAM_END);return n===u.Z_STREAM_END&&(i=u.Z_FINISH),i===u.Z_FINISH?(n=o.inflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===u.Z_OK):i!==u.Z_SYNC_FLUSH||(this.onEnd(u.Z_OK),d.avail_out=0,!0)},i.prototype.onData=function(t){this.chunks.push(t)},i.prototype.onEnd=function(t){t===u.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=a.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},e.Inflate=i,e.inflate=s,e.inflateRaw=r,e.ungzip=s},function(t,e,n){"use strict";function i(t,e){return t.msg=U[e],e}function s(t){return(t<<1)-(t>4?9:0)}function r(t){for(var e=t.length;--e>=0;)t[e]=0}function o(t){var e=t.state,n=e.pending;n>t.avail_out&&(n=t.avail_out),0!==n&&(C.arraySet(t.output,e.pending_buf,e.pending_out,n,t.next_out),t.next_out+=n,e.pending_out+=n,t.total_out+=n,t.avail_out-=n,e.pending-=n,0===e.pending&&(e.pending_out=0))}function a(t,e){I._tr_flush_block(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,o(t.strm)}function h(t,e){t.pending_buf[t.pending++]=e}function u(t,e){t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e}function c(t,e,n,i){var s=t.avail_in;return s>i&&(s=i),0===s?0:(t.avail_in-=s,C.arraySet(e,t.input,t.next_in,s,n),1===t.state.wrap?t.adler=x(t.adler,e,s,n):2===t.state.wrap&&(t.adler=L(t.adler,e,s,n)),t.next_in+=s,t.total_in+=s,s)}function l(t,e){var n,i,s=t.max_chain_length,r=t.strstart,o=t.prev_length,a=t.nice_match,h=t.strstart>t.w_size-lt?t.strstart-(t.w_size-lt):0,u=t.window,c=t.w_mask,l=t.prev,d=t.strstart+ct,f=u[r+o-1],p=u[r+o];t.prev_length>=t.good_match&&(s>>=2),a>t.lookahead&&(a=t.lookahead);do if(n=e,u[n+o]===p&&u[n+o-1]===f&&u[n]===u[r]&&u[++n]===u[r+1]){r+=2,n++;do;while(u[++r]===u[++n]&&u[++r]===u[++n]&&u[++r]===u[++n]&&u[++r]===u[++n]&&u[++r]===u[++n]&&u[++r]===u[++n]&&u[++r]===u[++n]&&u[++r]===u[++n]&&ro){if(t.match_start=e,o=i,i>=a)break;f=u[r+o-1],p=u[r+o]}}while((e=l[e&c])>h&&0!==--s);return o<=t.lookahead?o:t.lookahead}function d(t){var e,n,i,s,r,o=t.w_size;do{if(s=t.window_size-t.lookahead-t.strstart,t.strstart>=o+(o-lt)){C.arraySet(t.window,t.window,o,o,0),t.match_start-=o,t.strstart-=o,t.block_start-=o,n=t.hash_size,e=n;do i=t.head[--e],t.head[e]=i>=o?i-o:0;while(--n);n=o,e=n;do i=t.prev[--e],t.prev[e]=i>=o?i-o:0;while(--n);s+=o}if(0===t.strm.avail_in)break;if(n=c(t.strm,t.window,t.strstart+t.lookahead,s),t.lookahead+=n,t.lookahead+t.insert>=ut)for(r=t.strstart-t.insert,t.ins_h=t.window[r],t.ins_h=(t.ins_h<t.pending_buf_size-5&&(n=t.pending_buf_size-5);;){if(t.lookahead<=1){if(d(t),0===t.lookahead&&e===N)return vt;if(0===t.lookahead)break}t.strstart+=t.lookahead,t.lookahead=0;var i=t.block_start+n;if((0===t.strstart||t.strstart>=i)&&(t.lookahead=t.strstart-i,t.strstart=i,a(t,!1),0===t.strm.avail_out))return vt;if(t.strstart-t.block_start>=t.w_size-lt&&(a(t,!1),0===t.strm.avail_out))return vt}return t.insert=0,e===B?(a(t,!0),0===t.strm.avail_out?yt:At):t.strstart>t.block_start&&(a(t,!1),0===t.strm.avail_out)?vt:vt}function p(t,e){for(var n,i;;){if(t.lookahead=ut&&(t.ins_h=(t.ins_h<=ut)if(i=I._tr_tally(t,t.strstart-t.match_start,t.match_length-ut),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=ut){t.match_length--;do t.strstart++,t.ins_h=(t.ins_h<=ut&&(t.ins_h=(t.ins_h<4096)&&(t.match_length=ut-1)),t.prev_length>=ut&&t.match_length<=t.prev_length){s=t.strstart+t.lookahead-ut,i=I._tr_tally(t,t.strstart-1-t.prev_match,t.prev_length-ut),t.lookahead-=t.prev_length-1,t.prev_length-=2;do++t.strstart<=s&&(t.ins_h=(t.ins_h<=ut&&t.strstart>0&&(s=t.strstart-1,i=o[s],i===o[++s]&&i===o[++s]&&i===o[++s])){r=t.strstart+ct;do;while(i===o[++s]&&i===o[++s]&&i===o[++s]&&i===o[++s]&&i===o[++s]&&i===o[++s]&&i===o[++s]&&i===o[++s]&&st.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=ut?(n=I._tr_tally(t,1,t.match_length-ut),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(n=I._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),n&&(a(t,!1),0===t.strm.avail_out))return vt}return t.insert=0,e===B?(a(t,!0),0===t.strm.avail_out?yt:At):t.last_lit&&(a(t,!1),0===t.strm.avail_out)?vt:bt}function _(t,e){for(var n;;){if(0===t.lookahead&&(d(t),0===t.lookahead)){if(e===N)return vt;break}if(t.match_length=0,n=I._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,n&&(a(t,!1),0===t.strm.avail_out))return vt}return t.insert=0,e===B?(a(t,!0),0===t.strm.avail_out?yt:At):t.last_lit&&(a(t,!1),0===t.strm.avail_out)?vt:bt}function E(t,e,n,i,s){this.good_length=t,this.max_lazy=e,this.nice_length=n,this.max_chain=i,this.func=s}function w(t){t.window_size=2*t.w_size,r(t.head),t.max_lazy_match=S[t.level].max_lazy,t.good_match=S[t.level].good_length,t.nice_match=S[t.level].nice_length,t.max_chain_length=S[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=ut-1,t.match_available=0,t.ins_h=0}function v(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=J,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new C.Buf16(2*at),this.dyn_dtree=new C.Buf16(2*(2*rt+1)),this.bl_tree=new C.Buf16(2*(2*ot+1)),r(this.dyn_ltree),r(this.dyn_dtree),r(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new C.Buf16(ht+1),this.heap=new C.Buf16(2*st+1),r(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new C.Buf16(2*st+1),r(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function b(t){var e;return t&&t.state?(t.total_in=t.total_out=0,t.data_type=X,e=t.state,e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap?ft:Et,t.adler=2===e.wrap?0:1,e.last_flush=N,I._tr_init(e),j):i(t,z)}function y(t){var e=b(t);return e===j&&w(t.state),e}function A(t,e){return t&&t.state?2!==t.state.wrap?z:(t.state.gzhead=e,j):z}function k(t,e,n,s,r,o){if(!t)return z;var a=1;if(e===W&&(e=6),s<0?(a=0,s=-s):s>15&&(a=2,s-=16),r<1||r>Q||n!==J||s<8||s>15||e<0||e>9||o<0||o>Z)return i(t,z);8===s&&(s=9);var h=new v;return t.state=h,h.strm=t,h.wrap=a,h.gzhead=null,h.w_bits=s,h.w_size=1<G||e<0)return t?i(t,z):z;if(a=t.state,!t.output||!t.input&&0!==t.avail_in||a.status===wt&&e!==B)return i(t,0===t.avail_out?F:z);if(a.strm=t,n=a.last_flush,a.last_flush=e,a.status===ft)if(2===a.wrap)t.adler=0,h(a,31),h(a,139),h(a,8),a.gzhead?(h(a,(a.gzhead.text?1:0)+(a.gzhead.hcrc?2:0)+(a.gzhead.extra?4:0)+(a.gzhead.name?8:0)+(a.gzhead.comment?16:0)),h(a,255&a.gzhead.time),h(a,a.gzhead.time>>8&255),h(a,a.gzhead.time>>16&255),h(a,a.gzhead.time>>24&255),h(a,9===a.level?2:a.strategy>=V||a.level<2?4:0),h(a,255&a.gzhead.os),a.gzhead.extra&&a.gzhead.extra.length&&(h(a,255&a.gzhead.extra.length),h(a,a.gzhead.extra.length>>8&255)),a.gzhead.hcrc&&(t.adler=L(t.adler,a.pending_buf,a.pending,0)),a.gzindex=0,a.status=pt):(h(a,0),h(a,0),h(a,0),h(a,0),h(a,0),h(a,9===a.level?2:a.strategy>=V||a.level<2?4:0),h(a,kt),a.status=Et);else{var d=J+(a.w_bits-8<<4)<<8,f=-1;f=a.strategy>=V||a.level<2?0:a.level<6?1:6===a.level?2:3,d|=f<<6,0!==a.strstart&&(d|=dt),d+=31-d%31,a.status=Et,u(a,d),0!==a.strstart&&(u(a,t.adler>>>16),u(a,65535&t.adler)),t.adler=1}if(a.status===pt)if(a.gzhead.extra){for(c=a.pending;a.gzindex<(65535&a.gzhead.extra.length)&&(a.pending!==a.pending_buf_size||(a.gzhead.hcrc&&a.pending>c&&(t.adler=L(t.adler,a.pending_buf,a.pending-c,c)),o(t),c=a.pending,
-a.pending!==a.pending_buf_size));)h(a,255&a.gzhead.extra[a.gzindex]),a.gzindex++;a.gzhead.hcrc&&a.pending>c&&(t.adler=L(t.adler,a.pending_buf,a.pending-c,c)),a.gzindex===a.gzhead.extra.length&&(a.gzindex=0,a.status=mt)}else a.status=mt;if(a.status===mt)if(a.gzhead.name){c=a.pending;do{if(a.pending===a.pending_buf_size&&(a.gzhead.hcrc&&a.pending>c&&(t.adler=L(t.adler,a.pending_buf,a.pending-c,c)),o(t),c=a.pending,a.pending===a.pending_buf_size)){l=1;break}l=a.gzindexc&&(t.adler=L(t.adler,a.pending_buf,a.pending-c,c)),0===l&&(a.gzindex=0,a.status=gt)}else a.status=gt;if(a.status===gt)if(a.gzhead.comment){c=a.pending;do{if(a.pending===a.pending_buf_size&&(a.gzhead.hcrc&&a.pending>c&&(t.adler=L(t.adler,a.pending_buf,a.pending-c,c)),o(t),c=a.pending,a.pending===a.pending_buf_size)){l=1;break}l=a.gzindexc&&(t.adler=L(t.adler,a.pending_buf,a.pending-c,c)),0===l&&(a.status=_t)}else a.status=_t;if(a.status===_t&&(a.gzhead.hcrc?(a.pending+2>a.pending_buf_size&&o(t),a.pending+2<=a.pending_buf_size&&(h(a,255&t.adler),h(a,t.adler>>8&255),t.adler=0,a.status=Et)):a.status=Et),0!==a.pending){if(o(t),0===t.avail_out)return a.last_flush=-1,j}else if(0===t.avail_in&&s(e)<=s(n)&&e!==B)return i(t,F);if(a.status===wt&&0!==t.avail_in)return i(t,F);if(0!==t.avail_in||0!==a.lookahead||e!==N&&a.status!==wt){var p=a.strategy===V?_(a,e):a.strategy===K?g(a,e):S[a.level].func(a,e);if(p!==yt&&p!==At||(a.status=wt),p===vt||p===yt)return 0===t.avail_out&&(a.last_flush=-1),j;if(p===bt&&(e===P?I._tr_align(a):e!==G&&(I._tr_stored_block(a,0,0,!1),e===O&&(r(a.head),0===a.lookahead&&(a.strstart=0,a.block_start=0,a.insert=0))),o(t),0===t.avail_out))return a.last_flush=-1,j}return e!==B?j:a.wrap<=0?q:(2===a.wrap?(h(a,255&t.adler),h(a,t.adler>>8&255),h(a,t.adler>>16&255),h(a,t.adler>>24&255),h(a,255&t.total_in),h(a,t.total_in>>8&255),h(a,t.total_in>>16&255),h(a,t.total_in>>24&255)):(u(a,t.adler>>>16),u(a,65535&t.adler)),o(t),a.wrap>0&&(a.wrap=-a.wrap),0!==a.pending?j:q)}function D(t){var e;return t&&t.state?(e=t.state.status,e!==ft&&e!==pt&&e!==mt&&e!==gt&&e!==_t&&e!==Et&&e!==wt?i(t,z):(t.state=null,e===Et?i(t,H):j)):z}function M(t,e){var n,i,s,o,a,h,u,c,l=e.length;if(!t||!t.state)return z;if(n=t.state,o=n.wrap,2===o||1===o&&n.status!==ft||n.lookahead)return z;for(1===o&&(t.adler=x(t.adler,e,l,0)),n.wrap=0,l>=n.w_size&&(0===o&&(r(n.head),n.strstart=0,n.block_start=0,n.insert=0),c=new C.Buf8(n.w_size),C.arraySet(c,e,l-n.w_size,n.w_size,0),e=c,l=n.w_size),a=t.avail_in,h=t.next_in,u=t.input,t.avail_in=l,t.next_in=0,t.input=e,d(n);n.lookahead>=ut;){i=n.strstart,s=n.lookahead-(ut-1);do n.ins_h=(n.ins_h<>>24,m>>>=y,g-=y,y=b>>>16&255,0===y)M[a++]=65535&b;else{if(!(16&y)){if(0===(64&y)){b=_[(65535&b)+(m&(1<>>=y,g-=y),g<15&&(m+=D[r++]<>>24,m>>>=y,g-=y,y=b>>>16&255,!(16&y)){if(0===(64&y)){b=E[(65535&b)+(m&(1<c){t.msg="invalid distance too far back",s.mode=n;break t}if(m>>>=y,g-=y,y=a-h,k>y){if(y=k-y,y>d&&s.sane){t.msg="invalid distance too far back",s.mode=n;break t}if(R=0,T=p,0===f){if(R+=l-y,y2;)M[a++]=T[R++],M[a++]=T[R++],M[a++]=T[R++],A-=3;A&&(M[a++]=T[R++],A>1&&(M[a++]=T[R++]))}else{R=a-k;do M[a++]=M[R++],M[a++]=M[R++],M[a++]=M[R++],A-=3;while(A>2);A&&(M[a++]=M[R++],A>1&&(M[a++]=M[R++]))}break}}break}}while(r>3,r-=A,g-=A<<3,m&=(1<>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24)}function s(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new E.Buf16(320),this.work=new E.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function r(t){var e;return t&&t.state?(e=t.state,t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=O,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new E.Buf32(mt),e.distcode=e.distdyn=new E.Buf32(gt),e.sane=1,e.back=-1,S):x}function o(t){var e;return t&&t.state?(e=t.state,e.wsize=0,e.whave=0,e.wnext=0,r(t)):x}function a(t,e){var n,i;return t&&t.state?(i=t.state,e<0?(n=0,e=-e):(n=(e>>4)+1,e<48&&(e&=15)),e&&(e<8||e>15)?x:(null!==i.window&&i.wbits!==e&&(i.window=null),i.wrap=n,i.wbits=e,o(t))):x}function h(t,e){var n,i;return t?(i=new s,t.state=i,i.window=null,n=a(t,e),n!==S&&(t.state=null),n):x}function u(t){return h(t,Et)}function c(t){if(wt){var e;for(g=new E.Buf32(512),_=new E.Buf32(32),e=0;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(y(k,t.lens,0,288,g,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;y(R,t.lens,0,32,_,0,t.work,{bits:5}),wt=!1}t.lencode=g,t.lenbits=9,t.distcode=_,t.distbits=5}function l(t,e,n,i){var s,r=t.state;return null===r.window&&(r.wsize=1<=r.wsize?(E.arraySet(r.window,e,n-r.wsize,r.wsize,0),r.wnext=0,r.whave=r.wsize):(s=r.wsize-r.wnext,s>i&&(s=i),E.arraySet(r.window,e,n-i,s,r.wnext),i-=s,i?(E.arraySet(r.window,e,n-i,i,0),r.wnext=i,r.whave=r.wsize):(r.wnext+=s,r.wnext===r.wsize&&(r.wnext=0),r.whave>>8&255,n.check=v(n.check,Dt,2,0),d=0,f=0,n.mode=B;break}if(n.flags=0,n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&d)<<8)+(d>>8))%31){t.msg="incorrect header check",n.mode=dt;break}if((15&d)!==P){t.msg="unknown compression method",n.mode=dt;break}if(d>>>=4,f-=4,yt=(15&d)+8,0===n.wbits)n.wbits=yt;else if(yt>n.wbits){t.msg="invalid window size",n.mode=dt;break}n.dmax=1<>8&1),512&n.flags&&(Dt[0]=255&d,Dt[1]=d>>>8&255,n.check=v(n.check,Dt,2,0)),d=0,f=0,n.mode=G;case G:for(;f<32;){if(0===h)break t;h--,d+=s[o++]<>>8&255,Dt[2]=d>>>16&255,Dt[3]=d>>>24&255,n.check=v(n.check,Dt,4,0)),d=0,f=0,n.mode=j;case j:for(;f<16;){if(0===h)break t;h--,d+=s[o++]<>8),512&n.flags&&(Dt[0]=255&d,Dt[1]=d>>>8&255,n.check=v(n.check,Dt,2,0)),d=0,f=0,n.mode=q;case q:if(1024&n.flags){for(;f<16;){if(0===h)break t;h--,d+=s[o++]<>>8&255,n.check=v(n.check,Dt,2,0)),d=0,f=0}else n.head&&(n.head.extra=null);n.mode=z;case z:if(1024&n.flags&&(g=n.length,g>h&&(g=h),g&&(n.head&&(yt=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Array(n.head.extra_len)),E.arraySet(n.head.extra,s,o,g,yt)),512&n.flags&&(n.check=v(n.check,s,g,o)),h-=g,o+=g,n.length-=g),n.length))break t;n.length=0,n.mode=H;case H:if(2048&n.flags){if(0===h)break t;g=0;do yt=s[o+g++],n.head&&yt&&n.length<65536&&(n.head.name+=String.fromCharCode(yt));while(yt&&g>9&1,n.head.done=!0),t.adler=n.check=0,n.mode=K;break;case Y:for(;f<32;){if(0===h)break t;h--,d+=s[o++]<>>=7&f,f-=7&f,n.mode=ut;break}for(;f<3;){if(0===h)break t;h--,d+=s[o++]<>>=1,f-=1,3&d){case 0:n.mode=$;break;case 1:if(c(n),n.mode=nt,e===M){d>>>=2,f-=2;break t}break;case 2:n.mode=Q;break;case 3:t.msg="invalid block type",n.mode=dt}d>>>=2,f-=2;break;case $:for(d>>>=7&f,f-=7&f;f<32;){if(0===h)break t;h--,d+=s[o++]<>>16^65535)){t.msg="invalid stored block lengths",n.mode=dt;break}if(n.length=65535&d,d=0,f=0,n.mode=X,e===M)break t;case X:n.mode=J;case J:if(g=n.length){if(g>h&&(g=h),g>u&&(g=u),0===g)break t;E.arraySet(r,s,o,g,a),h-=g,o+=g,u-=g,a+=g,n.length-=g;break}n.mode=K;break;case Q:for(;f<14;){if(0===h)break t;h--,d+=s[o++]<>>=5,f-=5,n.ndist=(31&d)+1,d>>>=5,f-=5,n.ncode=(15&d)+4,d>>>=4,f-=4,n.nlen>286||n.ndist>30){t.msg="too many length or distance symbols",n.mode=dt;break}n.have=0,n.mode=tt;case tt:for(;n.have>>=3,f-=3}for(;n.have<19;)n.lens[Mt[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,kt={bits:n.lenbits},At=y(A,n.lens,0,19,n.lencode,0,n.work,kt),n.lenbits=kt.bits,At){t.msg="invalid code lengths set",n.mode=dt;break}n.have=0,n.mode=et;case et:for(;n.have>>24,_t=Tt>>>16&255,Et=65535&Tt,!(gt<=f);){if(0===h)break t;h--,d+=s[o++]<>>=gt,f-=gt,n.lens[n.have++]=Et;else{if(16===Et){for(Rt=gt+2;f