From d4871bd15cb9b767b2ca6571c17afd6cdabc9431 Mon Sep 17 00:00:00 2001 From: Travis CI Date: Wed, 7 Jun 2017 21:50:34 +0000 Subject: [PATCH] Webpack build for branch master: 577ab37a2b5adedaa31e8896a96d0a540f8de726 --- discord.master.js | 22 +++++++++++++--------- discord.master.min.js | 2 +- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/discord.master.js b/discord.master.js index 64ecba6f..5a657bfa 100644 --- a/discord.master.js +++ b/discord.master.js @@ -4343,12 +4343,13 @@ class User { /** * A link to the user's avatar - * @param {string} [format='webp'] One of `webp`, `png`, `jpg`, `gif`. If no format is provided, it will be `gif` - * for animated avatars or otherwise `webp` - * @param {number} [size=128] One of `128`, '256', `512`, `1024`, `2048` - * @returns {?string} avatarURL + * @param {Object} [options={}] Options for the avatar url + * @param {string} [options.format='webp'] One of `webp`, `png`, `jpg`, `gif`. If no format is provided, + * it will be `gif` for animated avatars or otherwise `webp` + * @param {number} [options.size=128] One of `128`, '256', `512`, `1024`, `2048` + * @returns {?string} */ - avatarURL(format, size) { + avatarURL({ format, size } = {}) { if (!this.avatar) return null; if (typeof format === 'number') { size = format; @@ -4368,11 +4369,14 @@ class User { /** * A link to the user's avatar if they have one. Otherwise a link to their default avatar will be returned - * @type {string} - * @readonly + * @param {Object} [options={}] Options for the avatar url + * @param {string} [options.format='webp'] One of `webp`, `png`, `jpg`, `gif`. If no format is provided, + * it will be `gif` for animated avatars or otherwise `webp` + * @param {number} [options.size=128] One of `128`, '256', `512`, `1024`, `2048` + * @returns {string} */ - get displayAvatarURL() { - return this.avatarURL() || this.defaultAvatarURL; + displayAvatarURL(options) { + return this.avatarURL(options) || this.defaultAvatarURL; } /** diff --git a/discord.master.min.js b/discord.master.min.js index 4870bb5e..006b4441 100644 --- a/discord.master.min.js +++ b/discord.master.min.js @@ -6,7 +6,7 @@ */ var $=n(78),X=n(81),Z=n(56);e.Buffer=r,e.SlowBuffer=m,e.INSPECT_MAX_BYTES=50,r.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(t){return!1}}(),e.kMaxLength=i(),r.poolSize=8192,r._augment=function(t){return t.__proto__=r.prototype,t},r.from=function(t,e,n){return o(null,t,e,n)},r.TYPED_ARRAY_SUPPORT&&(r.prototype.__proto__=Uint8Array.prototype,r.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&r[Symbol.species]===r&&Object.defineProperty(r,Symbol.species,{value:null,configurable:!0})),r.alloc=function(t,e,n){return c(null,t,e,n)},r.allocUnsafe=function(t){return l(null,t)},r.allocUnsafeSlow=function(t){return l(null,t)},r.isBuffer=function(t){return!(null==t||!t._isBuffer)},r.compare=function(t,e){if(!r.isBuffer(t)||!r.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var n=t.length,i=e.length,s=0,o=Math.min(n,i);s0&&(t=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(t+=" ... ")),""},r.prototype.compare=function(t,e,n,i,s){if(!r.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===i&&(i=0),void 0===s&&(s=this.length),e<0||n>t.length||i<0||s>this.length)throw new RangeError("out of range index");if(i>=s&&e>=n)return 0;if(i>=s)return-1;if(e>=n)return 1;if(e>>>=0,n>>>=0,i>>>=0,s>>>=0,this===t)return 0;for(var o=s-i,a=n-e,c=Math.min(o,a),l=this.slice(i,s),u=t.slice(e,n),h=0;hs)&&(n=s),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var r=!1;;)switch(i){case"hex":return _(this,t,e,n);case"utf8":case"utf-8":return y(this,t,e,n);case"ascii":return x(this,t,e,n);case"latin1":case"binary":return A(this,t,e,n);case"base64":return T(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,t,e,n);default:if(r)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),r=!0}},r.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Q=4096;r.prototype.slice=function(t,e){var n=this.length;t=~~t,e=void 0===e?n:~~e,t<0?(t+=n)<0&&(t=0):t>n&&(t=n),e<0?(e+=n)<0&&(e=0):e>n&&(e=n),e0&&(s*=256);)i+=this[t+--e]*s;return i},r.prototype.readUInt8=function(t,e){return e||O(t,1,this.length),this[t]},r.prototype.readUInt16LE=function(t,e){return e||O(t,2,this.length),this[t]|this[t+1]<<8},r.prototype.readUInt16BE=function(t,e){return e||O(t,2,this.length),this[t]<<8|this[t+1]},r.prototype.readUInt32LE=function(t,e){return e||O(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},r.prototype.readUInt32BE=function(t,e){return e||O(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},r.prototype.readIntLE=function(t,e,n){t|=0,e|=0,n||O(t,e,this.length);for(var i=this[t],s=1,r=0;++r=s&&(i-=Math.pow(2,8*e)),i},r.prototype.readIntBE=function(t,e,n){t|=0,e|=0,n||O(t,e,this.length);for(var i=e,s=1,r=this[t+--i];i>0&&(s*=256);)r+=this[t+--i]*s;return s*=128,r>=s&&(r-=Math.pow(2,8*e)),r},r.prototype.readInt8=function(t,e){return e||O(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},r.prototype.readInt16LE=function(t,e){e||O(t,2,this.length);var n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},r.prototype.readInt16BE=function(t,e){e||O(t,2,this.length);var n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},r.prototype.readInt32LE=function(t,e){return e||O(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},r.prototype.readInt32BE=function(t,e){return e||O(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},r.prototype.readFloatLE=function(t,e){return e||O(t,4,this.length),X.read(this,t,!0,23,4)},r.prototype.readFloatBE=function(t,e){return e||O(t,4,this.length),X.read(this,t,!1,23,4)},r.prototype.readDoubleLE=function(t,e){return e||O(t,8,this.length),X.read(this,t,!0,52,8)},r.prototype.readDoubleBE=function(t,e){return e||O(t,8,this.length),X.read(this,t,!1,52,8)},r.prototype.writeUIntLE=function(t,e,n,i){if(t=+t,e|=0,n|=0,!i){N(this,t,e,n,Math.pow(2,8*n)-1,0)}var s=1,r=0;for(this[e]=255&t;++r=0&&(r*=256);)this[e+s]=t/r&255;return e+n},r.prototype.writeUInt8=function(t,e,n){return t=+t,e|=0,n||N(this,t,e,1,255,0),r.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},r.prototype.writeUInt16LE=function(t,e,n){return t=+t,e|=0,n||N(this,t,e,2,65535,0),r.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):U(this,t,e,!0),e+2},r.prototype.writeUInt16BE=function(t,e,n){return t=+t,e|=0,n||N(this,t,e,2,65535,0),r.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):U(this,t,e,!1),e+2},r.prototype.writeUInt32LE=function(t,e,n){return t=+t,e|=0,n||N(this,t,e,4,4294967295,0),r.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):j(this,t,e,!0),e+4},r.prototype.writeUInt32BE=function(t,e,n){return t=+t,e|=0,n||N(this,t,e,4,4294967295,0),r.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):j(this,t,e,!1),e+4},r.prototype.writeIntLE=function(t,e,n,i){if(t=+t,e|=0,!i){var s=Math.pow(2,8*n-1);N(this,t,e,n,s-1,-s)}var r=0,o=1,a=0;for(this[e]=255&t;++r>0)-a&255;return e+n},r.prototype.writeIntBE=function(t,e,n,i){if(t=+t,e|=0,!i){var s=Math.pow(2,8*n-1);N(this,t,e,n,s-1,-s)}var r=n-1,o=1,a=0;for(this[e+r]=255&t;--r>=0&&(o*=256);)t<0&&0===a&&0!==this[e+r+1]&&(a=1),this[e+r]=(t/o>>0)-a&255;return e+n},r.prototype.writeInt8=function(t,e,n){return t=+t,e|=0,n||N(this,t,e,1,127,-128),r.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},r.prototype.writeInt16LE=function(t,e,n){return t=+t,e|=0,n||N(this,t,e,2,32767,-32768),r.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):U(this,t,e,!0),e+2},r.prototype.writeInt16BE=function(t,e,n){return t=+t,e|=0,n||N(this,t,e,2,32767,-32768),r.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):U(this,t,e,!1),e+2},r.prototype.writeInt32LE=function(t,e,n){return t=+t,e|=0,n||N(this,t,e,4,2147483647,-2147483648),r.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):j(this,t,e,!0),e+4},r.prototype.writeInt32BE=function(t,e,n){return t=+t,e|=0,n||N(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),r.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):j(this,t,e,!1),e+4},r.prototype.writeFloatLE=function(t,e,n){return G(this,t,e,!0,n)},r.prototype.writeFloatBE=function(t,e,n){return G(this,t,e,!1,n)},r.prototype.writeDoubleLE=function(t,e,n){return B(this,t,e,!0,n)},r.prototype.writeDoubleBE=function(t,e,n){return B(this,t,e,!1,n)},r.prototype.copy=function(t,e,n,i){if(n||(n=0),i||0===i||(i=this.length),e>=t.length&&(e=t.length),e||(e=0),i>0&&i=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-e=0;--s)t[s+e]=this[s+n];else if(o<1e3||!r.TYPED_ARRAY_SUPPORT)for(s=0;s>>=0,n=void 0===n?this.length:n>>>0,t||(t=0);var o;if("number"==typeof t)for(o=e;o=e?String(t):(String(n).repeat(e)+t).slice(-e)}const s=n(33);let r=0;class o{constructor(){throw new Error(`The ${this.constructor.name} class may not be instantiated.`)}static generate(){r>=4095&&(r=0);const t=`${i((Date.now()-14200704e5).toString(2),42)}0000100000${i((r++).toString(2),12)}`;return s.fromString(t,2).toString()}static deconstruct(t){const e=i(s.fromString(t).toString(2),64),n={timestamp:parseInt(e.substring(0,42),2)+14200704e5,workerID:parseInt(e.substring(42,47),2),processID:parseInt(e.substring(47,52),2),increment:parseInt(e.substring(52,64),2),binary:e};return Object.defineProperty(n,"date",{get:function(){return new Date(this.timestamp)},enumerable:!0}),n}}t.exports=o},function(t,e){function n(){throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}function s(t){if(u===setTimeout)return setTimeout(t,0);if((u===n||!u)&&setTimeout)return u=setTimeout,setTimeout(t,0);try{return u(t,0)}catch(e){try{return u.call(null,t,0)}catch(e){return u.call(this,t,0)}}}function r(t){if(h===clearTimeout)return clearTimeout(t);if((h===i||!h)&&clearTimeout)return h=clearTimeout,clearTimeout(t);try{return h(t)}catch(e){try{return h.call(null,t)}catch(e){return h.call(this,t)}}}function o(){m&&d&&(m=!1,d.length?f=d.concat(f):g=-1,f.length&&a())}function a(){if(!m){var t=s(o);m=!0;for(var e=f.length;e;){for(d=f,f=[];++g1)for(var n=1;nnew r(t)),this.attachments=new l;for(const e of t.attachments)this.attachments.set(e.id,new s(this,e));if(this.createdTimestamp=new Date(t.timestamp).getTime(),this.editedTimestamp=t.edited_timestamp?new Date(t.edited_timestamp).getTime():null,this.reactions=new l,t.reactions&&t.reactions.length>0)for(const e of t.reactions){const t=e.emoji.id?`${e.emoji.name}:${e.emoji.id}`:e.emoji.name;this.reactions.set(t,new o(this,e.emoji,e.count,e.me))}this.mentions=new i(this,t.mentions,t.mention_roles,t.mention_everyone),this.webhookID=t.webhook_id||null,this.hit="boolean"==typeof t.hit?t.hit:null,this._edits=[]}patch(t){const e=c.cloneObject(this);if(this._edits.unshift(e),this.editedTimestamp=new Date(t.edited_timestamp).getTime(),"content"in t&&(this.content=t.content),"pinned"in t&&(this.pinned=t.pinned),"tts"in t&&(this.tts=t.tts),this.embeds="embeds"in t?t.embeds.map(t=>new r(t)):this.embeds.slice(),"attachments"in t){this.attachments=new l;for(const e of t.attachments)this.attachments.set(e.id,new s(this,e))}else this.attachments=new l(this.attachments);this.mentions=new i(this,"mentions"in t?t.mentions:this.mentions.users,"mentions_roles"in t?t.mentions_roles:this.mentions.roles,"mention_everyone"in t?t.mention_everyone:this.mentions.everyone)}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,""));if(e)return`#${e.name}`;return 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,""));if(e)return`@${e.name}`;return t})}createReactionCollector(t,e={}){return new a(this,t,e)}awaitReactions(t,e={}){return new Promise((n,i)=>{const s=this.createReactionCollector(t,e);s.once("end",(t,s)=>{e.errors&&e.errors.includes(s)?i(t):n(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).has(h.FLAGS.MANAGE_MESSAGES)}get pinnable(){return!this.guild||this.channel.permissionsFor(this.client.user).has(h.FLAGS.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 p||(p=n(19)),!!this.mentions.everyone||(!!this.mentions.users.has(t.id)||!!(t instanceof p&&t.roles.some(t=>this.mentions.roles.has(t.id))))}edit(t,e){e||"object"!=typeof t||t instanceof Array?e||(e={}):(e=t,t=""),void 0!==t&&(t=c.resolveString(t));const{embed:embed,code:code,reply:reply}=e;if(void 0===code||"boolean"==typeof code&&!0!==code||(t=c.escapeMarkdown(c.resolveString(t),!0),t=`\`\`\`${"boolean"!=typeof code?code||"":""} ${t} -\`\`\``),reply&&"dm"!==this.channel.type){const e=this.client.resolver.resolveUserID(reply),n=`<@${reply instanceof p&&reply.nickname?"!":""}${e}>`;t=`${n}${t?`, ${t}`:""}`}return this.client.api.channels(this.channel.id).messages(this.id).patch({data:{content:t,embed:embed}}).then(t=>this.client.actions.MessageUpdate.handle(t).updated)}pin(){return this.client.api.channels(this.channel.id).pins(this.id).put().then(()=>this)}unpin(){return this.client.api.channels(this.channel.id).pins(this.id).delete().then(()=>this)}react(t){if(!(t=this.client.resolver.resolveEmojiIdentifier(t)))throw new TypeError("Emoji must be a string or Emoji/ReactionEmoji");return this.client.api.channels(this.channel.id).messages(this.id).reactions(t)["@me"].put().then(()=>this._addReaction(c.parseEmoji(t),this.client.user))}clearReactions(){return this.client.api.channels(this.channel.id).messages(this.id).reactions.delete().then(()=>this)}delete({timeout:timeout=0,reason:reason}={}){return timeout<=0?this.client.api.channels(this.channel.id).messages(this.id).delete({reason:reason}).then(()=>this.client.actions.MessageDelete.handle({id:this.id,channel_id:this.channel.id}).message):new Promise(t=>{this.client.setTimeout(()=>{t(this.delete({reason:reason}))},timeout)})}reply(t,e){return e||"object"!=typeof t||t instanceof Array?e||(e={}):(e=t,t=""),this.channel.send(t,Object.assign(e,{reply:this.member||this.author}))}acknowledge(){return this.client.api.channels(this.channel.id).messages(this.id).ack.post({data:{token:this.client.rest._ackToken}}).then(t=>{t.token&&(this.client.rest._ackToken=t.token);return this})}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;if(!t.author&&!t.attachments)return this.id===t.id&&this.embeds.length===t.embeds.length;let n=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 n&&e&&(n=this.mentions.everyone===t.mentions.everyone&&this.createdTimestamp===new Date(e.timestamp).getTime()&&this.editedTimestamp===new Date(e.edited_timestamp).getTime()),n}toString(){return this.content}_addReaction(t,e){const n=t.id?`${t.name}:${t.id}`:encodeURIComponent(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 o(this,t,0,e.id===this.client.user.id),this.reactions.set(n,i)),i.users.has(e.id)||i.users.set(e.id,e),i.count++,i}_removeReaction(t,e){const n=t.id?`${t.name}:${t.id}`:encodeURIComponent(t.name);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.count<=0&&this.reactions.delete(n),t}return null}_clearReactions(){this.reactions.clear()}}t.exports=d},function(t,e,n){const i=n(0);class s{constructor(t){this.bitfield="number"==typeof t?t:this.constructor.resolve(t)}has(t,e=!0){return t instanceof Array?t.every(t=>this.has(t,e)):(t=this.constructor.resolve(t),!!(e&&(this.bitfield&this.constructor.FLAGS.ADMINISTRATOR)>0)||(this.bitfield&t)===t)}missing(t,e=!0){return t.filter(t=>!this.has(t,e))}add(...t){let e=0;for(let n=0;nthis.resolve(t)).reduce((t,e)=>t|e,0);if("string"==typeof t&&(t=this.FLAGS[t]),"number"!=typeof t||t<1)throw new RangeError(i.Errors.NOT_A_PERMISSION);return t}}s.FLAGS={CREATE_INSTANT_INVITE:1,KICK_MEMBERS:2,BAN_MEMBERS:4,ADMINISTRATOR:8,MANAGE_CHANNELS:16,MANAGE_GUILD:32,ADD_REACTIONS:64,VIEW_AUDIT_LOG:128,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,USE_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:1<<28,MANAGE_WEBHOOKS:1<<29,MANAGE_EMOJIS:1<<30},s.ALL=Object.values(s.FLAGS).reduce((t,e)=>t|e,0),s.DEFAULT=104324097,t.exports=s},function(t,e){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e){"function"==typeof Object.create?t.exports=function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:t.exports=function(t,e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}},function(t,e,n){const i=n(24),s=n(0),r=n(13).Presence,o=n(185),a=n(6);class c{constructor(t,e){Object.defineProperty(this,"client",{value:t}),e&&this.setup(e)}setup(t){this.id=t.id,this.username=t.username,this.discriminator=t.discriminator,this.avatar=t.avatar,this.bot=Boolean(t.bot),this.lastMessageID=null,this.lastMessage=null}patch(t){for(const e of["id","username","discriminator","avatar","bot"])void 0!==t[e]&&(this[e]=t[e]);t.token&&(this.client.token=t.token)}get createdTimestamp(){return a.deconstruct(this.id).timestamp}get createdAt(){return new Date(this.createdTimestamp)}get presence(){if(this.client.presences.has(this.id))return this.client.presences.get(this.id);for(const t of this.client.guilds.values())if(t.presences.has(this.id))return t.presences.get(this.id);return new r}avatarURL(t,e){return this.avatar?("number"==typeof t&&(e=t,t="default"),s.Endpoints.CDN(this.client.options.http.cdn).Avatar(this.id,this.avatar,t,e)):null}get defaultAvatarURL(){return s.Endpoints.CDN(this.client.options.http.cdn).DefaultAvatar(this.discriminator%5)}get displayAvatarURL(){return this.avatarURL()||this.defaultAvatarURL}get tag(){return`${this.username}#${this.discriminator}`}get note(){return this.client.user.notes.get(this.id)||null}typingIn(t){return t=this.client.resolver.resolveChannel(t),t._typing.has(this.id)}typingSinceIn(t){return t=this.client.resolver.resolveChannel(t),t._typing.has(this.id)?new Date(t._typing.get(this.id).since):null}typingDurationIn(t){return t=this.client.resolver.resolveChannel(t),t._typing.has(this.id)?t._typing.get(this.id).elapsedTime:-1}get dmChannel(){return this.client.channels.filter(t=>"dm"===t.type).find(t=>t.recipient.id===this.id)}createDM(){return this.dmChannel?Promise.resolve(this.dmChannel):this.client.api.users(this.client.user.id).channels.post({data:{recipient_id:this.id}}).then(t=>this.client.actions.ChannelCreate.handle(t).channel)}deleteDM(){return this.dmChannel?this.client.api.channels(this.dmChannel.id).delete().then(t=>this.client.actions.ChannelDelete.handle(t).channel):Promise.reject(new Error("No DM Channel exists!"))}fetchProfile(){return this.client.api.users(this.id).profile.get().then(t=>new o(t))}setNote(t){return this.client.api.users("@me").notes(this.id).put({data:{note:t}}).then(()=>this)}equals(t){return t&&this.id===t.id&&this.username===t.username&&this.discriminator===t.discriminator&&this.avatar===t.avatar&&this.bot===Boolean(t.bot)}toString(){return`<@${this.id}>`}send(){}}i.applyToClass(c),t.exports=c},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){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,c,l;if(this._events||(this._events={}),"error"===t&&(!this._events.error||r(this._events.error)&&!this._events.error.length)){if((e=arguments[1])instanceof Error)throw e;var u=new Error('Uncaught, unspecified "error" event. ('+e+")");throw u.context=e,u}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),l=n.slice(),s=l.length,c=0;c0&&this._events[t].length>s&&(this._events[t].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[t].length),"function"==typeof console.trace&&console.trace()),this},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){return this._events&&this._events[t]?i(this._events[t])?[this._events[t]]:this._events[t].slice():[]},n.prototype.listenerCount=function(t){if(this._events){var e=this._events[t];if(i(e))return 1;if(e)return e.length}return 0},n.listenerCount=function(t,e){return t.listenerCount(e)}},function(t,e,n){"use strict";function i(t){if(!(this instanceof i))return new i(t);l.call(this,t),u.call(this,t),t&&!1===t.readable&&(this.readable=!1),t&&!1===t.writable&&(this.writable=!1),this.allowHalfOpen=!0,t&&!1===t.allowHalfOpen&&(this.allowHalfOpen=!1),this.once("end",s)}function s(){this.allowHalfOpen||this._writableState.ended||a(r,this)}function r(t){t.end()}var o=Object.keys||function(t){var e=[];for(var n in t)e.push(n);return e};t.exports=i;var a=n(34),c=n(22);c.inherits=n(11);var l=n(57),u=n(36);c.inherits(i,l);for(var h=o(u.prototype),p=0;pthis)}}t.exports=s},function(t,e,n){const i=n(0),s=n(3),r=n(6);class o{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 r.deconstruct(this.id).timestamp}get createdAt(){return new Date(this.createdTimestamp)}get roles(){const t=new s;for(const e of this._roles)this.guild.roles.has(e)&&t.set(e,this.guild.roles.get(e));return t}get url(){return i.Endpoints.CDN(this.client.options.http.cdn).Emoji(this.id)}get identifier(){return this.id?`${this.name}:${this.id}`:encodeURIComponent(this.name)}edit(t,e){return this.client.api.guilds(this.guild.id).emojis(this.id).patch({data:{name:t.name,roles:t.roles?t.roles.map(t=>t.id?t.id:t):[]},reason:e}).then(()=>this)}setName(t){return this.edit({name:t})}addRestrictedRole(t){return this.addRestrictedRoles([t])}addRestrictedRoles(t){const e=new s(this.roles);for(const n of t)this.guild.roles.has(n.id)&&e.set(n.id,n);return this.edit({roles:e})}removeRestrictedRole(t){return this.removeRestrictedRoles([t])}removeRestrictedRoles(t){const e=new s(this.roles);for(const n of t)e.has(n.id)&&e.delete(n.id);return this.edit({roles:e})}toString(){return this.requiresColons?`<:${this.name}:${this.id}>`:this.name}equals(t){return t instanceof o?t.id===this.id&&t.name===this.name&&t.managed===this.managed&&t.requiresColons===this.requiresColons:t.id===this.id&&t.name===this.name}}t.exports=o},function(t,e,n){const i=n(33),s=n(12),r=n(20),o=n(17),a=n(27),c=n(44),l=n(21),u=n(13).Presence,h=n(19),p=n(70),d=n(0),f=n(3),m=n(4),g=n(6),v=n(9),E=n(71);class b{constructor(t,e){Object.defineProperty(this,"client",{value:t}),this.members=new f,this.channels=new f,this.roles=new f,this.presences=new f,e&&(e.unavailable?(this.available=!1,this.id=e.id):(this.available=!0,this.setup(e)))}setup(t){if(this.name=t.name,this.icon=t.icon,this.splash=t.splash,this.region=t.region,this.memberCount=t.member_count||this.memberCount,this.large=Boolean("large"in t?t.large:this.large),this.features=t.features,this.applicationID=t.application_id,this.afkTimeout=t.afk_timeout,this.afkChannelID=t.afk_channel_id,this.embedEnabled=t.embed_enabled,this.verificationLevel=t.verification_level,this.explicitContentFilter=t.explicit_content_filter,this.joinedTimestamp=t.joined_at?new Date(t.joined_at).getTime():this.joinedTimestamp,this.id=t.id,this.available=!t.unavailable,this.features=t.features||this.features||[],t.members){this.members.clear();for(const e of t.members)this._addMember(e,!1)}if(t.owner_id&&(this.ownerID=t.owner_id),t.channels){this.channels.clear();for(const e of t.channels)this.client.dataManager.newChannel(e,this)}if(t.roles){this.roles.clear();for(const e of t.roles){const t=new r(this,e);this.roles.set(t.id,t)}}if(t.presences)for(const e of t.presences)this._setPresence(e.user.id,e);if(this._rawVoiceStates=new f,t.voice_states)for(const e of t.voice_states){this._rawVoiceStates.set(e.user_id,e);const t=this.members.get(e.user_id);t&&(t.serverMute=e.mute,t.serverDeaf=e.deaf,t.selfMute=e.self_mute,t.selfDeaf=e.self_deaf,t.voiceSessionID=e.session_id,t.voiceChannelID=e.channel_id,this.channels.get(e.channel_id).members.set(t.user.id,t))}if(this.emojis)this.client.actions.GuildEmojisUpdate.handle({guild_id:this.id,emojis:t.emojis});else{this.emojis=new f;for(const e of t.emojis)this.emojis.set(e.id,new o(this,e))}}get createdTimestamp(){return g.deconstruct(this.id).timestamp}get createdAt(){return new Date(this.createdTimestamp)}get joinedAt(){return new Date(this.joinedTimestamp)}iconURL(t,e){return this.icon?("number"==typeof t&&(e=t,t="default"),d.Endpoints.CDN(this.client.options.http.cdn).Icon(this.id,this.icon,t,e)):null}get nameAcronym(){return this.name.replace(/\w+/g,t=>t[0]).replace(/\s/g,"")}get splashURL(){return this.splash?d.Endpoints.CDN(this.client.options.http.cdn).Splash(this.id,this.splash):null}get owner(){return this.members.get(this.ownerID)}get voiceConnection(){return this.client.browser?null:this.client.voice.connections.get(this.id)||null}get defaultChannel(){return this.channels.get(this.id)}get position(){return this.client.user.bot?null:this.client.user.settings.guildPositions?this.client.user.settings.guildPositions.indexOf(this.id):null}get defaultRole(){return this.roles.get(this.id)}get me(){return this.members.get(this.client.user.id)}get _sortedRoles(){return this._sortPositionWithID(this.roles)}member(t){return this.client.resolver.resolveGuildMember(this,t)}fetchBans(){return this.client.api.guilds(this.id).bans.get().then(t=>t.reduce((t,e)=>{t.set(e.user.id,{reason:e.reason,user:this.client.dataManager.newUser(e.user)});return t},new f))}fetchInvites(){return this.client.api.guilds(this.id).invites.get().then(t=>{const e=new f;for(const n of t){const t=new a(this.client,n);e.set(t.code,t)}return e})}fetchWebhooks(){return this.client.api.guilds(this.id).webhooks.get().then(t=>{const e=new f;for(const n of t)e.set(n.id,new l(this.client,n));return e})}fetchVoiceRegions(){return this.client.api.guilds(this.id).regions.get().then(t=>{const e=new f;for(const n of t)e.set(n.id,new p(n));return e})}fetchAuditLogs(t={}){return t.before&&t.before instanceof c.Entry&&(t.before=t.before.id),t.after&&t.after instanceof c.Entry&&(t.after=t.after.id),"string"==typeof t.type&&(t.type=c.Actions[t.type]),this.client.api.guilds(this.id)["audit-logs"].get({query:{before:t.before,after:t.after,limit:t.limit,user_id:this.client.resolver.resolveUserID(t.user),action_type:t.type}}).then(t=>c.build(this,t))}addMember(t,e){if(this.members.has(t.id))return Promise.resolve(this.members.get(t.id));if(e.access_token=e.accessToken,e.roles){const t=e.roles;(t instanceof f||t instanceof Array&&t[0]instanceof r)&&(e.roles=t.map(t=>t.id))}return this.client.api.guilds(this.id).members(t.id).put({data:e}).then(t=>this.client.actions.GuildMemberGet.handle(this,t).member)}fetchMember(t,e=!0){return t=this.client.resolver.resolveUser(t),t?this.members.has(t.id)?Promise.resolve(this.members.get(t.id)):this.client.api.guilds(this.id).members(t.id).get().then(t=>e?this.client.actions.GuildMemberGet.handle(this,t).member:new h(this,t)):Promise.reject(new Error("User is not cached. Use Client.fetchUser first."))}fetchMembers(t="",e=0){return new Promise((n,i)=>{if(this.memberCount===this.members.size)return void n(new f);this.client.ws.send({op:d.OPCodes.REQUEST_GUILD_MEMBERS,d:{guild_id:this.id,query:t,limit:e}});const s=new f;const r=(i,o)=>{if(o.id!==this.id)return;for(const t of i.values())s.set(t.user.id,t);(this.memberCount===this.members.size||(t||e)&&i.size<1e3)&&(this.client.removeListener(d.Events.GUILD_MEMBERS_CHUNK,r),n(s))};this.client.on(d.Events.GUILD_MEMBERS_CHUNK,r);this.client.setTimeout(()=>{this.client.removeListener(d.Events.GUILD_MEMBERS_CHUNK,r);i(new Error("Members didn't arrive in time."))},12e4)})}search(t={}){return E.search(this,t)}edit(t,e){const n={};return t.name&&(n.name=t.name),t.region&&(n.region=t.region),t.verificationLevel&&(n.verification_level=Number(t.verificationLevel)),t.afkChannel&&(n.afk_channel_id=this.client.resolver.resolveChannel(t.afkChannel).id),t.afkTimeout&&(n.afk_timeout=Number(t.afkTimeout)),t.icon&&(n.icon=this.client.resolver.resolveBase64(t.icon)),t.owner&&(n.owner_id=this.client.resolver.resolveUser(t.owner).id),t.splash&&(n.splash=this.client.resolver.resolveBase64(t.splash)),this.client.api.guilds(this.id).patch({data:n,reason:e}).then(t=>this.client.actions.GuildUpdate.handle(t).updated)}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})}setPosition(t,e){return this.client.user.bot?Promise.reject(new Error("Setting guild position is only available for user accounts")):this.client.user.settings.setGuildPosition(this,t,e)}acknowledge(){return this.client.api.guilds(this.id).ack.post({data:{token:this.client.rest._ackToken}}).then(t=>{t.token&&(this.client.rest._ackToken=t.token);return this})}allowDMs(t){const e=this.client.user.settings;return t?e.removeRestrictedGuild(this):e.addRestrictedGuild(this)}ban(t,e={days:0}){e.days&&(e["delete-message-days"]=e.days);const n=this.client.resolver.resolveUserID(t);return n?this.client.api.guilds(this.id).bans(n).put({query:e}).then(()=>{if(t instanceof h)return t;const e=this.client.resolver.resolveUser(n);if(e){const t=this.client.resolver.resolveGuildMember(this,e);return t||e}return n}):Promise.reject(new Error("Couldn't resolve the user ID to ban."))}unban(t,e){const n=this.client.resolver.resolveUserID(t);if(!n)throw new Error("Couldn't resolve the user ID to unban.");return this.client.api.guilds(this.id).bans(n).delete({reason:e}).then(()=>t)}pruneMembers({days:days=7,dry:dry=!1,reason:reason}={}){if("number"!=typeof days)throw new TypeError("Days must be a number.");return this.client.api.guilds(this.id).prune[dry?"get":"post"]({query:{days:days},reason:reason}).then(t=>t.pruned)}sync(){this.client.user.bot||this.client.syncGuilds([this])}createChannel(t,e,{overwrites:overwrites,reason:reason}={}){return overwrites instanceof f&&(overwrites=overwrites.array()),this.client.api.guilds(this.id).channels.post({data:{name:t,type:e,permission_overwrites:overwrites},reason:reason}).then(t=>this.client.actions.ChannelCreate.handle(t).channel)}setChannelPositions(t){const e=new Array(t.length);for(let n=0;nthis.client.actions.GuildChannelsPositionUpdate.handle({guild_id:this.id,channels:t}).guild)}createRole({data:data={},reason:reason}={}){return data.color&&(data.color=m.resolveColor(data.color)),data.permissions&&(data.permissions=v.resolve(data.permissions)),this.client.api.guilds(this.id).roles.post({data:data,reason:reason}).then(t=>this.client.actions.GuildRoleCreate.handle({guild_id:this.id,role:t}).role)}createEmoji(t,e,n){if("string"==typeof attahment&&t.startsWith("data:")){const i={image:t,name:e};return n&&(i.roles=n.map(t=>t.id?t.id:t)),this.client.api.guilds(this.id).emojis.post({data:i}).then(t=>this.client.actions.GuildEmojiCreate.handle(this,t).emoji)}return this.client.resolver.resolveBuffer(t).then(t=>{const i=this.client.resolver.resolveBase64(t);return this.createEmoji(i,e,n)})}deleteEmoji(t){return t instanceof o||(t=this.emojis.get(t)),this.client.api.guilds(this.id).emojis(this.id).delete().then(()=>this.client.actions.GuildEmojiDelete.handle(t).data)}leave(){return this.ownerID===this.client.user.id?Promise.reject(new Error("Guild is owned by the client.")):this.client.api.users("@me").guilds(this.id).delete().then(()=>this.client.actions.GuildDelete.handle({id:this.id}).guild)}delete(){return this.client.api.guilds(this.id).delete().then(()=>this.client.actions.GuildDelete.handle({id:this.id}).guild)}equals(t){let e=t&&this.id===t.id&&this.available===!t.unavailable&&this.splash===t.splash&&this.region===t.region&&this.name===t.name&&this.memberCount===t.member_count&&this.large===t.large&&this.icon===t.icon&&m.arraysEqual(this.features,t.features)&&this.ownerID===t.owner_id&&this.verificationLevel===t.verification_level&&this.embedEnabled===t.embed_enabled;return e&&(this.embedChannel?this.embedChannel.id!==t.embed_channel_id&&(e=!1):t.embed_channel_id&&(e=!1)),e}toString(){return this.name}_addMember(t,e=!0){const n=this.members.has(t.user.id);t.user instanceof s||(t.user=this.client.dataManager.newUser(t.user)),t.joined_at=t.joined_at||0;const i=new h(this,t);if(this.members.set(i.id,i),this._rawVoiceStates&&this._rawVoiceStates.has(i.user.id)){const t=this._rawVoiceStates.get(i.user.id);i.serverMute=t.mute,i.serverDeaf=t.deaf,i.selfMute=t.self_mute,i.selfDeaf=t.self_deaf,i.voiceSessionID=t.session_id,i.voiceChannelID=t.channel_id,this.client.channels.has(t.channel_id)?this.client.channels.get(t.channel_id).members.set(i.user.id,i):this.client.emit("warn",`Member ${i.id} added in guild ${this.id} with an uncached voice channel`)}return this.client.ws.connection.status===d.Status.READY&&e&&!n&&this.client.emit(d.Events.GUILD_MEMBER_ADD,i),i}_updateMember(t,e){const n=m.cloneObject(t);e.roles&&(t._roles=e.roles),void 0!==e.nick&&(t.nickname=e.nick);const i=t.nickname!==n.nickname||!m.arraysEqual(t._roles,n._roles);return this.client.ws.connection.status===d.Status.READY&&i&&this.client.emit(d.Events.GUILD_MEMBER_UPDATE,n,t),{old:n,mem:t}}_removeMember(t){this.members.delete(t.id)}_memberSpeakUpdate(t,e){const n=this.members.get(t);n&&n.speaking!==e&&(n.speaking=e,this.client.emit(d.Events.GUILD_MEMBER_SPEAKING,n,e))}_setPresence(t,e){if(this.presences.get(t))return void this.presences.get(t).update(e);this.presences.set(t,new u(e))}setRolePosition(t,e,n=!1){if("string"==typeof t&&!(t=this.roles.get(t)))return Promise.reject(new Error("Supplied role is not a role or snowflake."));if(e=Number(e),isNaN(e))return Promise.reject(new Error("Supplied position is not a number."));let i=this._sortedRoles.array();return m.moveElementInArray(i,t,e,n),i=i.map((t,e)=>({id:t.id,position:e})),this.client.api.guilds(this.id).roles.patch({data:i}).then(()=>this.client.actions.GuildRolesPositionUpdate.handle({guild_id:this.id,roles:i}).guild)}setChannelPosition(t,e,n=!1){if("string"==typeof t&&!(t=this.channels.get(t)))return Promise.reject(new Error("Supplied channel is not a channel or snowflake."));if(e=Number(e),isNaN(e))return Promise.reject(new Error("Supplied position is not a number."));let i=this._sortedChannels(t.type).array();return m.moveElementInArray(i,t,e,n),i=i.map((t,e)=>({id:t.id,position:e})),this.client.api.guilds(this.id).channels.patch({data:i}).then(()=>this.client.actions.GuildChannelsPositionUpdate.handle({guild_id:this.id,roles:i}).guild)}_sortedChannels(t){return this._sortPositionWithID(this.channels.filter(e=>"voice"===t&&"voice"===e.type||("voice"!==t&&"voice"!==e.type||t===e.type)))}_sortPositionWithID(t){return t.sort((t,e)=>t.position!==e.position?t.position-e.position:i.fromString(t.id).sub(i.fromString(e.id)).toNumber())}}t.exports=b},function(t,e,n){const i=n(24),s=n(20),r=n(9),o=n(3),a=n(13).Presence;class c{constructor(t,e){Object.defineProperty(this,"client",{value:t.client}),this.guild=t,this.user={},this._roles=[],e&&this.setup(e),this.lastMessageID=null,this.lastMessage=null}setup(t){this.serverDeaf=t.deaf,this.serverMute=t.mute,this.selfMute=t.self_mute,this.selfDeaf=t.self_deaf,this.voiceSessionID=t.session_id,this.voiceChannelID=t.channel_id,this.speaking=!1,this.nickname=t.nick||null,this.joinedTimestamp=new Date(t.joined_at).getTime(),this.user=t.user,this._roles=t.roles}get joinedAt(){return new Date(this.joinedTimestamp)}get presence(){return this.frozenPresence||this.guild.presences.get(this.id)||new a}get roles(){const t=new o,e=this.guild.roles.get(this.guild.id);e&&t.set(e.id,e);for(const e of this._roles){const n=this.guild.roles.get(e);n&&t.set(n.id,n)}return t}get highestRole(){return this.roles.reduce((t,e)=>!t||e.comparePositionTo(t)>0?e:t)}get colorRole(){const t=this.roles.filter(t=>t.color);return t.size?t.reduce((t,e)=>!t||e.comparePositionTo(t)>0?e:t):null}get displayColor(){const t=this.colorRole;return t&&t.color||0}get displayHexColor(){const t=this.colorRole;return t&&t.hexColor||"#000000"}get hoistRole(){const t=this.roles.filter(t=>t.hoist);return t.size?t.reduce((t,e)=>!t||e.comparePositionTo(t)>0?e:t):null}get mute(){return this.selfMute||this.serverMute}get deaf(){return this.selfDeaf||this.serverDeaf}get voiceChannel(){return this.guild.channels.get(this.voiceChannelID)}get id(){return this.user.id}get displayName(){return this.nickname||this.user.username}get permissions(){if(this.user.id===this.guild.ownerID)return new r(r.ALL);let t=0;const e=this.roles;for(const n of e.values())t|=n.permissions;return new r(t)}get kickable(){if(this.user.id===this.guild.ownerID)return!1;if(this.user.id===this.client.user.id)return!1;const t=this.guild.member(this.client.user);return!!t.permissions.has(r.FLAGS.KICK_MEMBERS)&&t.highestRole.comparePositionTo(this.highestRole)>0}get bannable(){if(this.user.id===this.guild.ownerID)return!1;if(this.user.id===this.client.user.id)return!1;const t=this.guild.member(this.client.user);return!!t.permissions.has(r.FLAGS.BAN_MEMBERS)&&t.highestRole.comparePositionTo(this.highestRole)>0}permissionsIn(t){if(!(t=this.client.resolver.resolveChannel(t))||!t.guild)throw new Error("Could not resolve channel to a guild channel.");return t.permissionsFor(this)}hasPermission(t,e=!1,n,i){return void 0===n&&(n=!e),void 0===i&&(i=!e),!(!i||this.user.id!==this.guild.ownerID)||this.roles.some(e=>e.hasPermission(t,void 0,n))}missingPermissions(t,e=!1){return t.missing(t,e)}edit(t,e){t.channel&&(t.channel_id=this.client.resolver.resolveChannel(t.channel).id,t.channel=null),t.roles&&(t.roles=t.roles.map(t=>t instanceof s?t.id:t));let n=this.client.api.guilds(this.guild.id);if(this.user.id===this.client.user.id){const e=Object.keys(t);n=1===e.length&&"nick"===e[0]?n.members("@me").nick:n.members(this.id)}else n=n.members(this.id);return n.patch({data:t,reason:e}).then(t=>this.guild._updateMember(this,t).mem)}setMute(t){return this.edit({mute:t})}setDeaf(t){return this.edit({deaf:t})}setVoiceChannel(t){return this.edit({channel:t})}setRoles(t){return this.edit({roles:t})}addRole(t){return t instanceof s||(t=this.guild.roles.get(t)),t?this._roles.includes(t.id)?Promise.resolve(this):this.client.api.guilds(this.guild.id).members(this.user.id).roles(t.id).put().then(()=>this):Promise.reject(new TypeError("Supplied parameter was neither a Role nor a Snowflake."))}addRoles(t){let e;if(t instanceof o){e=this._roles.slice();for(const n of t.values())e.push(n.id?n.id:n)}else e=this._roles.concat(t.map(t=>t.id?t.id:t));return this.edit({roles:e})}removeRole(t){return t instanceof s||(t=this.guild.roles.get(t)),t?this.client.api.guilds(this.guild.id).members(this.user.id).roles(t.id).delete().then(()=>this):Promise.reject(new TypeError("Supplied parameter was neither a Role nor a Snowflake."))}removeRoles(t){const e=this._roles.slice();if(t instanceof o)for(const n of t.values()){const t=e.indexOf(n.id);t>=0&&e.splice(t,1)}else for(const n of t){const t=e.indexOf(n instanceof s?n.id:n);t>=0&&e.splice(t,1)}return this.edit({roles:e})}setNickname(t){return this.edit({nick:t})}createDM(){return this.user.createDM()}deleteDM(){return this.user.deleteDM()}kick(t){return this.client.api.guilds(this.guild.id).members(this.user.id).delete({reason:t}).then(()=>this.client.actions.GuildMemberRemove.handle({guild_id:this.guild.id,user:this.user}).member)}ban(t){return this.guild.ban(this,t)}toString(){return`<@${this.nickname?"!":""}${this.user.id}>`}send(){}}i.applyToClass(c),t.exports=c},function(t,e,n){const i=n(6),s=n(9),r=n(4);class o{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 i.deconstruct(this.id).timestamp}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.permissions.has(s.FLAGS.MANAGE_ROLES)&&t.highestRole.comparePositionTo(this)>0}get calculatedPosition(){const t=this.guild._sortedRoles;return t.array().indexOf(t.get(this.id))}serialize(){return new s(this.permissions).serialize()}hasPermission(t,e=!1,n){return new s(this.permissions).has(t,void 0!==n?n:!e)}comparePositionTo(t){return this.constructor.comparePositions(this,t)}edit(t,e){return t.permissions?t.permissions=s.resolve(t.permissions):t.permissions=this.permissions,this.client.api.guilds(this.guild.id).roles(this.id).patch({data:{name:t.name||this.name,position:void 0!==t.position?t.position:this.position,color:r.resolveColor(t.color||this.color),hoist:void 0!==t.hoist?t.hoist:this.hoist,mentionable:void 0!==t.mentionable?t.mentionable:this.mentionable},reason:e}).then(t=>this.client.actions.GuildRoleUpdate.handle({role:t,guild_id:this.guild.id}).updated)}setName(t){return this.edit({name:t})}setColor(t){return this.edit({color:t})}setHoist(t){return this.edit({hoist:t})}setPosition(t,e){return this.guild.setRolePosition(this,t,e).then(()=>this)}setPermissions(t){return this.edit({permissions:t})}setMentionable(t){return this.edit({mentionable:t})}delete(t){return this.client.api.guilds(this.guild.id).roles(this.id).delete({reason:t}).then(()=>this.client.actions.GuildRoleDelete.handle({guild_id:this.guild.id,role_id:this.id}).role)}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===this.guild.id?"@everyone":`<@&${this.id}>`}static comparePositions(t,e){return t.position===e.position?e.id-t.id:t.position-e.position}}t.exports=o},function(t,e,n){const i=n(29),s=n(4);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=this.client.users?this.client.users.get(t.user.id):t.user:this.owner=null}send(t,e){if(e||"object"!=typeof t||t instanceof Array?e||(e={}):(e=t,t=""),e.username||(e.username=this.name),e.avatarURL&&(e.avatar_url=e.avatarURL,e.avatarURL=null),void 0!==t&&(t=s.resolveString(t)),t&&(e.disableEveryone||void 0===e.disableEveryone&&this.client.options.disableEveryone)&&(t=t.replace(/@(everyone|here)/g,"@​$1")),e.content=t,e.file&&(e.files?e.files.push(e.file):e.files=[e.file]),e.files){for(let t=0;tthis.client.resolver.resolveBuffer(t.attachment).then(e=>{t.file=e;return t}))).then(t=>this.client.api.webhooks(this.id,this.token).post({data:e,query:{wait:!0},files:t,auth:!1}))}return this.client.api.webhooks(this.id,this.token).post({data:e,query:{wait:!0},auth:!1}).then(t=>{if(!this.client.channels)return t;const e=n(8);return new e(this.client.channels.get(t.channel_id,t,this.client))})}sendSlackMessage(t){return this.client.api.webhooks(this.id,this.token).slack.post({query:{wait:!0},auth:!1,data:t}).then(t=>{if(!this.client.channels)return t;const e=n(8);return new e(this.client.channels.get(t.channel_id,t,this.client))})}edit({name:name=this.name,avatar:avatar},t){return avatar&&"string"==typeof avatar&&!avatar.startsWith("data:")?this.client.resolver.resolveBuffer(avatar).then(e=>{const n=this.client.resolver.resolveBase64(e);return this.edit({name:name,avatar:n},t)}):this.client.api.webhooks(this.id,this.token).patch({data:{name:name,avatar:avatar},reason:t}).then(t=>{this.name=t.name;this.avatar=t.avatar;return this})}delete(t){return this.client.api.webhooks(this.id,this.token).delete({reason:t})}}t.exports=r},function(t,e,n){(function(t){function n(t){return Array.isArray?Array.isArray(t):"[object Array]"===g(t)}function i(t){return"boolean"==typeof t}function s(t){return null===t}function r(t){return null==t}function o(t){return"number"==typeof t}function a(t){return"string"==typeof t}function c(t){return"symbol"==typeof t}function l(t){return void 0===t}function u(t){return"[object RegExp]"===g(t)}function h(t){return"object"==typeof t&&null!==t}function p(t){return"[object Date]"===g(t)}function d(t){return"[object Error]"===g(t)||t instanceof Error}function f(t){return"function"==typeof t}function m(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t}function g(t){return Object.prototype.toString.call(t)}e.isArray=n,e.isBoolean=i,e.isNull=s,e.isNullOrUndefined=r,e.isNumber=o,e.isString=a,e.isSymbol=c,e.isUndefined=l,e.isRegExp=u,e.isObject=h,e.isDate=p,e.isError=d,e.isFunction=f,e.isPrimitive=m,e.isBuffer=t.isBuffer}).call(e,n(5).Buffer)},function(t,e,n){e=t.exports=n(57),e.Stream=e,e.Readable=e,e.Writable=n(36),e.Duplex=n(15),e.Transform=n(58),e.PassThrough=n(86)},function(t,e,n){const i=n(29),s=n(46),r=n(71),o=n(3),a=n(6);class c{constructor(){this.messages=new o,this.lastMessageID=null,this.lastMessage=null}send(t,e){if(e||"object"!=typeof t||t instanceof Array?e||(e={}):(e=t,t=""),e.content||(e.content=t),e.embed&&e.embed.file&&(e.file=e.embed.file),e.file&&(e.files?e.files.push(e.file):e.files=[e.file]),e.files){for(let t=0;tthis.client.resolver.resolveBuffer(t.attachment).then(e=>{t.file=e;return t}))).then(t=>{e.files=t;return r.sendMessage(this,e)})}return r.sendMessage(this,e)}fetchMessage(t){const e=n(8);return this.client.user.bot?this.client.api.channels(this.id).messages(t).get().then(t=>{const n=t instanceof e?t:new e(this,t,this.client);this._cacheMessage(n);return n}):this.fetchMessages({limit:1,around:t}).then(e=>{const n=e.get(t);if(!n)throw new Error("Message not found.");return n})}fetchMessages(t={}){const e=n(8);return this.client.api.channels(this.id).messages.get({query:t}).then(t=>{const n=new o;for(const i of t){const t=new e(this,i,this.client);n.set(i.id,t),this._cacheMessage(t)}return n})}fetchPinnedMessages(){const t=n(8);return this.client.api.channels(this.id).pins.get().then(e=>{const n=new o;for(const i of e){const e=new t(this,i,this.client);n.set(i.id,e),this._cacheMessage(e)}return n})}search(t={}){return r.search(this,t)}startTyping(t){if(void 0!==t&&t<1)throw new RangeError("Count must be at least 1.");if(this.client.user._typing.has(this.id)){const e=this.client.user._typing.get(this.id);e.count=t||e.count+1}else{const e=this.client.api.channels(this.id).typing;this.client.user._typing.set(this.id,{count:t||1,interval:this.client.setInterval(()=>{e.post()},9e3)}),e.post()}}stopTyping(t=!1){if(this.client.user._typing.has(this.id)){const e=this.client.user._typing.get(this.id);e.count--,(e.count<=0||t)&&(this.client.clearInterval(e.interval),this.client.user._typing.delete(this.id))}}get typing(){return this.client.user._typing.has(this.id)}get typingCount(){return this.client.user._typing.has(this.id)?this.client.user._typing.get(this.id).count:0}createMessageCollector(t,e={}){return new s(this,t,e)}awaitMessages(t,e={}){return new Promise((n,i)=>{const s=this.createMessageCollector(t,e);s.once("end",(t,s)=>{e.errors&&e.errors.includes(s)?i(t):n(t)})})}bulkDelete(t,e=!1){if(!isNaN(t))return this.fetchMessages({limit:t}).then(t=>this.bulkDelete(t,e));if(t instanceof Array||t instanceof o){let n=t instanceof o?t.keyArray():t.map(t=>t.id);return e&&(n=n.filter(t=>Date.now()-a.deconstruct(t).date.getTime()<12096e5)),this.client.api.channels(this.id).messages()["bulk-delete"].post({data:{messages:n}}).then(()=>this.client.actions.MessageDeleteBulk.handle({channel_id:this.id,ids:n}).messages)}throw new TypeError("The messages must be an Array, Collection, or number.")}acknowledge(){return this.lastMessageID?this.client.api.channels(this.id).messages(this.lastMessageID).ack.post({data:{token:this.client.rest._ackToken}}).then(t=>{t.token&&(this.client.rest._ackToken=t.token);return this}):Promise.resolve(this)}_cacheMessage(t){const e=this.client.options.messageCacheMaxSize;return 0===e?null:(this.messages.size>=e&&e>0&&this.messages.delete(this.messages.firstKey()),this.messages.set(t.id,t),t)}}e.applyToClass=((t,e=!1,n=[])=>{const i=["send"];e&&i.push("_cacheMessage","acknowledge","fetchMessages","fetchMessage","search","bulkDelete","startTyping","stopTyping","typing","typingCount","fetchPinnedMessages","createMessageCollector","awaitMessages");for(const e of i)n.includes(e)||Object.defineProperty(t.prototype,e,Object.getOwnPropertyDescriptor(c.prototype,e))})},function(t,e){e.endianness=function(){return"LE"},e.hostname=function(){return"undefined"!=typeof location?location.hostname:""},e.loadavg=function(){return[]},e.uptime=function(){return 0},e.freemem=function(){return Number.MAX_VALUE},e.totalmem=function(){return Number.MAX_VALUE},e.cpus=function(){return[]},e.type=function(){return"Browser"},e.release=function(){return"undefined"!=typeof navigator?navigator.appVersion:""},e.networkInterfaces=e.getNetworkInterfaces=function(){return{}},e.arch=function(){return"javascript"},e.platform=function(){return"browser"},e.tmpdir=e.tmpDir=function(){return"/tmp"},e.EOL="\n"},function(t,e,n){const i=n(16),s=n(20),r=n(27),o=n(52),a=n(9),c=n(3);class l extends i{constructor(t,e){super(t.client,e),this.guild=t}setup(t){if(super.setup(t),this.name=t.name,this.position=t.position,this.permissionOverwrites=new c,t.permission_overwrites)for(const e of t.permission_overwrites)this.permissionOverwrites.set(e.id,new o(this,e))}get calculatedPosition(){const t=this.guild._sortedChannels(this.type);return t.array().indexOf(t.get(this.id))}permissionsFor(t){if(!(t=this.client.resolver.resolveGuildMember(this.guild,t)))return null;if(t.id===this.guild.ownerID)return new a(a.ALL);let e=0;const n=t.roles;for(const t of n.values())e|=t.permissions;const i=this.overwritesFor(t,!0,n);i.everyone&&(e&=~i.everyone.deny,e|=i.everyone.allow);let s=0;for(const t of i.roles)e&=~t.deny,s|=t.allow;return e|=s,i.member&&(e&=~i.member.deny,e|=i.member.allow),Boolean(e&a.FLAGS.ADMINISTRATOR)&&(e=a.ALL),new a(e)}overwritesFor(t,e=!1,n=null){if(e||(t=this.client.resolver.resolveGuildMember(this.guild,t)),!t)return[];n=n||t.roles;const i=[];let s,r;for(const e of this.permissionOverwrites.values())e.id===this.guild.id?r=e:n.has(e.id)?i.push(e):e.id===t.id&&(s=e);return{everyone:r,roles:i,member:s}}overwritePermissions(t,e,n){const i={allow:0,deny:0};if(t instanceof s)i.type="role";else if(this.guild.roles.has(t))t=this.guild.roles.get(t),i.type="role";else if(t=this.client.resolver.resolveUser(t),i.type="member",!t)return Promise.reject(new TypeError("Supplied parameter was neither a User nor a Role."));i.id=t.id;const r=this.permissionOverwrites.get(t.id);r&&(i.allow=r.allow,i.deny=r.deny);for(const t in e)!0===e[t]?(i.allow|=a.FLAGS[t]||0,i.deny&=~(a.FLAGS[t]||0)):!1===e[t]?(i.allow&=~(a.FLAGS[t]||0),i.deny|=a.FLAGS[t]||0):null===e[t]&&(i.allow&=~(a.FLAGS[t]||0),i.deny&=~(a.FLAGS[t]||0));return this.client.api.channels(this.id).permissions(i.id).put({data:i,reason:n}).then(()=>this)}edit(t,e){return this.client.api.channels(this.id).patch({data:{name:(t.name||this.name).trim(),topic:t.topic||this.topic,position:t.position||this.position,bitrate:t.bitrate||this.bitrate,user_limit:t.userLimit||this.userLimit},reason:e}).then(t=>this.client.actions.ChannelUpdate.handle(t).updated)}setName(t){return this.edit({name:t})}setPosition(t,e){return this.guild.setChannelPosition(this,t,e).then(()=>this)}setTopic(t){return this.edit({topic:t})}createInvite({temporary:temporary=!1,maxAge:maxAge=86400,maxUses:maxUses=0,reason:reason}={}){return this.client.api.channels(this.id).invites.post({data:{temporary:temporary,max_age:maxAge,max_uses:maxUses},reason:reason}).then(t=>new r(this.client,t))}clone(t=this.name,e=!0,n=!0){return this.guild.createChannel(t,this.type,e?this.permissionOverwrites:[]).then(t=>n?t.setTopic(this.topic):t)}equals(t){let e=t&&this.id===t.id&&this.type===t.type&&this.topic===t.topic&&this.position===t.position&&this.name===t.name;return e&&(e=this.permissionOverwrites&&t.permissionOverwrites?this.permissionOverwrites.equals(t.permissionOverwrites):!this.permissionOverwrites&&!t.permissionOverwrites),e}get deletable(){return this.id!==this.guild.id&&this.permissionsFor(this.client.user).has(a.FLAGS.MANAGE_CHANNELS)}delete(t){return this.client.api.channels(this.id).delete({reason:t}).then(()=>this)}toString(){return`<#${this.id}>`}}t.exports=l},function(t,e,n){const i=n(50),s=n(51),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.presenceCount=t.approximate_presence_count,this.memberCount=t.approximate_member_count,this.textChannelCount=t.guild.text_channel_count,this.voiceChannelCount=t.guild.voice_channel_count,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.invite(this.code)}delete(t){return this.client.api.invites(this.code).delete({reason:t}).then(()=>this)}toString(){return this.url}}t.exports=o},function(t,e,n){const i=n(6),s=n(0);class r{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.rpcOrigins=t.rpc_origins,this.redirectURIs=t.redirect_uris,this.botRequireCodeGrant=t.bot_require_code_grant,this.botPublic=t.bot_public,this.rpcApplicationState=t.rpc_application_state,this.bot=t.bot,this.flags=t.flags,this.secret=t.secret,t.owner&&(this.owner=this.client.dataManager.newUser(t.owner))}get createdTimestamp(){return i.deconstruct(this.id).timestamp}get createdAt(){return new Date(this.createdTimestamp)}iconURL(t,e){return this.icon?("number"==typeof t&&(e=t,t="default"),s.Endpoints.CDN(this.client.options.http.cdn).AppIcon(this.id,this.icon,t,e)):null}reset(){return this.rest.api.oauth2.applications(this.id).reset.post().then(t=>new r(this.client,t))}toString(){return this.name}}t.exports=r},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,c=0;c[t.id,t.nick]))),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}addUser(t,e){const n=this.client.resolver.resolveUserID(t),i=this.client.user.bot?{nick:e,access_token:t}:{recipient:n};return this.client.api.channels(this.id).recipients(n).put({data:i}).then(()=>this)}toString(){return this.name}send(){}fetchMessage(){}fetchMessages(){}fetchPinnedMessages(){}search(){}startTyping(){}stopTyping(){}get typing(){}get typingCount(){}createCollector(){}awaitMessages(){}acknowledge(){}_cacheMessage(){}}s.applyToClass(o,!0,["bulkDelete"]),t.exports=o},function(t,e){class n{constructor(t,e,n){this.reaction=t,this.name=e,this.id=n}get identifier(){return this.id?`${this.name}:${this.id}`:encodeURIComponent(this.name)}toString(){return this.id?`<:${this.name}:${this.id}>`:this.name}}t.exports=n},function(t,e,n){const i=n(3),s=n(14).EventEmitter;class r extends s{constructor(t,e,n={}){super(),Object.defineProperty(this,"client",{value:t}),this.filter=e,this.options=n,this.collected=new i,this.ended=!1,this._timeout=null,this.listener=this._handle.bind(this),n.time&&(this._timeout=this.client.setTimeout(()=>this.stop("time"),n.time))}_handle(...t){const e=this.handle(...t);if(e&&this.filter(...t)){this.collected.set(e.key,e.value),this.emit("collect",e.value,this);const n=this.postCheck(...t);n&&this.stop(n)}}get next(){return new Promise((t,e)=>{if(this.ended)return void e(this.collected);const n=()=>{this.removeListener("collect",i);this.removeListener("end",s)};const i=e=>{n();t(e)};const s=()=>{n();e(this.collected)};this.on("collect",i);this.on("end",s)})}stop(t="user"){this.ended||(this._timeout&&this.client.clearTimeout(this._timeout),this.ended=!0,this.cleanup(),this.emit("end",this.collected,t))}handle(){}postCheck(){}cleanup(){}}t.exports=r},function(t,e,n){var i,s,r;/** +\`\`\``),reply&&"dm"!==this.channel.type){const e=this.client.resolver.resolveUserID(reply),n=`<@${reply instanceof p&&reply.nickname?"!":""}${e}>`;t=`${n}${t?`, ${t}`:""}`}return this.client.api.channels(this.channel.id).messages(this.id).patch({data:{content:t,embed:embed}}).then(t=>this.client.actions.MessageUpdate.handle(t).updated)}pin(){return this.client.api.channels(this.channel.id).pins(this.id).put().then(()=>this)}unpin(){return this.client.api.channels(this.channel.id).pins(this.id).delete().then(()=>this)}react(t){if(!(t=this.client.resolver.resolveEmojiIdentifier(t)))throw new TypeError("Emoji must be a string or Emoji/ReactionEmoji");return this.client.api.channels(this.channel.id).messages(this.id).reactions(t)["@me"].put().then(()=>this._addReaction(c.parseEmoji(t),this.client.user))}clearReactions(){return this.client.api.channels(this.channel.id).messages(this.id).reactions.delete().then(()=>this)}delete({timeout:timeout=0,reason:reason}={}){return timeout<=0?this.client.api.channels(this.channel.id).messages(this.id).delete({reason:reason}).then(()=>this.client.actions.MessageDelete.handle({id:this.id,channel_id:this.channel.id}).message):new Promise(t=>{this.client.setTimeout(()=>{t(this.delete({reason:reason}))},timeout)})}reply(t,e){return e||"object"!=typeof t||t instanceof Array?e||(e={}):(e=t,t=""),this.channel.send(t,Object.assign(e,{reply:this.member||this.author}))}acknowledge(){return this.client.api.channels(this.channel.id).messages(this.id).ack.post({data:{token:this.client.rest._ackToken}}).then(t=>{t.token&&(this.client.rest._ackToken=t.token);return this})}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;if(!t.author&&!t.attachments)return this.id===t.id&&this.embeds.length===t.embeds.length;let n=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 n&&e&&(n=this.mentions.everyone===t.mentions.everyone&&this.createdTimestamp===new Date(e.timestamp).getTime()&&this.editedTimestamp===new Date(e.edited_timestamp).getTime()),n}toString(){return this.content}_addReaction(t,e){const n=t.id?`${t.name}:${t.id}`:encodeURIComponent(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 o(this,t,0,e.id===this.client.user.id),this.reactions.set(n,i)),i.users.has(e.id)||i.users.set(e.id,e),i.count++,i}_removeReaction(t,e){const n=t.id?`${t.name}:${t.id}`:encodeURIComponent(t.name);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.count<=0&&this.reactions.delete(n),t}return null}_clearReactions(){this.reactions.clear()}}t.exports=d},function(t,e,n){const i=n(0);class s{constructor(t){this.bitfield="number"==typeof t?t:this.constructor.resolve(t)}has(t,e=!0){return t instanceof Array?t.every(t=>this.has(t,e)):(t=this.constructor.resolve(t),!!(e&&(this.bitfield&this.constructor.FLAGS.ADMINISTRATOR)>0)||(this.bitfield&t)===t)}missing(t,e=!0){return t.filter(t=>!this.has(t,e))}add(...t){let e=0;for(let n=0;nthis.resolve(t)).reduce((t,e)=>t|e,0);if("string"==typeof t&&(t=this.FLAGS[t]),"number"!=typeof t||t<1)throw new RangeError(i.Errors.NOT_A_PERMISSION);return t}}s.FLAGS={CREATE_INSTANT_INVITE:1,KICK_MEMBERS:2,BAN_MEMBERS:4,ADMINISTRATOR:8,MANAGE_CHANNELS:16,MANAGE_GUILD:32,ADD_REACTIONS:64,VIEW_AUDIT_LOG:128,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,USE_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:1<<28,MANAGE_WEBHOOKS:1<<29,MANAGE_EMOJIS:1<<30},s.ALL=Object.values(s.FLAGS).reduce((t,e)=>t|e,0),s.DEFAULT=104324097,t.exports=s},function(t,e){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e){"function"==typeof Object.create?t.exports=function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:t.exports=function(t,e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}},function(t,e,n){const i=n(24),s=n(0),r=n(13).Presence,o=n(185),a=n(6);class c{constructor(t,e){Object.defineProperty(this,"client",{value:t}),e&&this.setup(e)}setup(t){this.id=t.id,this.username=t.username,this.discriminator=t.discriminator,this.avatar=t.avatar,this.bot=Boolean(t.bot),this.lastMessageID=null,this.lastMessage=null}patch(t){for(const e of["id","username","discriminator","avatar","bot"])void 0!==t[e]&&(this[e]=t[e]);t.token&&(this.client.token=t.token)}get createdTimestamp(){return a.deconstruct(this.id).timestamp}get createdAt(){return new Date(this.createdTimestamp)}get presence(){if(this.client.presences.has(this.id))return this.client.presences.get(this.id);for(const t of this.client.guilds.values())if(t.presences.has(this.id))return t.presences.get(this.id);return new r}avatarURL({format:format,size:size}={}){return this.avatar?("number"==typeof format&&(size=format,format="default"),s.Endpoints.CDN(this.client.options.http.cdn).Avatar(this.id,this.avatar,format,size)):null}get defaultAvatarURL(){return s.Endpoints.CDN(this.client.options.http.cdn).DefaultAvatar(this.discriminator%5)}displayAvatarURL(t){return this.avatarURL(t)||this.defaultAvatarURL}get tag(){return`${this.username}#${this.discriminator}`}get note(){return this.client.user.notes.get(this.id)||null}typingIn(t){return t=this.client.resolver.resolveChannel(t),t._typing.has(this.id)}typingSinceIn(t){return t=this.client.resolver.resolveChannel(t),t._typing.has(this.id)?new Date(t._typing.get(this.id).since):null}typingDurationIn(t){return t=this.client.resolver.resolveChannel(t),t._typing.has(this.id)?t._typing.get(this.id).elapsedTime:-1}get dmChannel(){return this.client.channels.filter(t=>"dm"===t.type).find(t=>t.recipient.id===this.id)}createDM(){return this.dmChannel?Promise.resolve(this.dmChannel):this.client.api.users(this.client.user.id).channels.post({data:{recipient_id:this.id}}).then(t=>this.client.actions.ChannelCreate.handle(t).channel)}deleteDM(){return this.dmChannel?this.client.api.channels(this.dmChannel.id).delete().then(t=>this.client.actions.ChannelDelete.handle(t).channel):Promise.reject(new Error("No DM Channel exists!"))}fetchProfile(){return this.client.api.users(this.id).profile.get().then(t=>new o(t))}setNote(t){return this.client.api.users("@me").notes(this.id).put({data:{note:t}}).then(()=>this)}equals(t){return t&&this.id===t.id&&this.username===t.username&&this.discriminator===t.discriminator&&this.avatar===t.avatar&&this.bot===Boolean(t.bot)}toString(){return`<@${this.id}>`}send(){}}i.applyToClass(c),t.exports=c},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){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,c,l;if(this._events||(this._events={}),"error"===t&&(!this._events.error||r(this._events.error)&&!this._events.error.length)){if((e=arguments[1])instanceof Error)throw e;var u=new Error('Uncaught, unspecified "error" event. ('+e+")");throw u.context=e,u}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),l=n.slice(),s=l.length,c=0;c0&&this._events[t].length>s&&(this._events[t].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[t].length),"function"==typeof console.trace&&console.trace()),this},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){return this._events&&this._events[t]?i(this._events[t])?[this._events[t]]:this._events[t].slice():[]},n.prototype.listenerCount=function(t){if(this._events){var e=this._events[t];if(i(e))return 1;if(e)return e.length}return 0},n.listenerCount=function(t,e){return t.listenerCount(e)}},function(t,e,n){"use strict";function i(t){if(!(this instanceof i))return new i(t);l.call(this,t),u.call(this,t),t&&!1===t.readable&&(this.readable=!1),t&&!1===t.writable&&(this.writable=!1),this.allowHalfOpen=!0,t&&!1===t.allowHalfOpen&&(this.allowHalfOpen=!1),this.once("end",s)}function s(){this.allowHalfOpen||this._writableState.ended||a(r,this)}function r(t){t.end()}var o=Object.keys||function(t){var e=[];for(var n in t)e.push(n);return e};t.exports=i;var a=n(34),c=n(22);c.inherits=n(11);var l=n(57),u=n(36);c.inherits(i,l);for(var h=o(u.prototype),p=0;pthis)}}t.exports=s},function(t,e,n){const i=n(0),s=n(3),r=n(6);class o{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 r.deconstruct(this.id).timestamp}get createdAt(){return new Date(this.createdTimestamp)}get roles(){const t=new s;for(const e of this._roles)this.guild.roles.has(e)&&t.set(e,this.guild.roles.get(e));return t}get url(){return i.Endpoints.CDN(this.client.options.http.cdn).Emoji(this.id)}get identifier(){return this.id?`${this.name}:${this.id}`:encodeURIComponent(this.name)}edit(t,e){return this.client.api.guilds(this.guild.id).emojis(this.id).patch({data:{name:t.name,roles:t.roles?t.roles.map(t=>t.id?t.id:t):[]},reason:e}).then(()=>this)}setName(t){return this.edit({name:t})}addRestrictedRole(t){return this.addRestrictedRoles([t])}addRestrictedRoles(t){const e=new s(this.roles);for(const n of t)this.guild.roles.has(n.id)&&e.set(n.id,n);return this.edit({roles:e})}removeRestrictedRole(t){return this.removeRestrictedRoles([t])}removeRestrictedRoles(t){const e=new s(this.roles);for(const n of t)e.has(n.id)&&e.delete(n.id);return this.edit({roles:e})}toString(){return this.requiresColons?`<:${this.name}:${this.id}>`:this.name}equals(t){return t instanceof o?t.id===this.id&&t.name===this.name&&t.managed===this.managed&&t.requiresColons===this.requiresColons:t.id===this.id&&t.name===this.name}}t.exports=o},function(t,e,n){const i=n(33),s=n(12),r=n(20),o=n(17),a=n(27),c=n(44),l=n(21),u=n(13).Presence,h=n(19),p=n(70),d=n(0),f=n(3),m=n(4),g=n(6),v=n(9),E=n(71);class b{constructor(t,e){Object.defineProperty(this,"client",{value:t}),this.members=new f,this.channels=new f,this.roles=new f,this.presences=new f,e&&(e.unavailable?(this.available=!1,this.id=e.id):(this.available=!0,this.setup(e)))}setup(t){if(this.name=t.name,this.icon=t.icon,this.splash=t.splash,this.region=t.region,this.memberCount=t.member_count||this.memberCount,this.large=Boolean("large"in t?t.large:this.large),this.features=t.features,this.applicationID=t.application_id,this.afkTimeout=t.afk_timeout,this.afkChannelID=t.afk_channel_id,this.embedEnabled=t.embed_enabled,this.verificationLevel=t.verification_level,this.explicitContentFilter=t.explicit_content_filter,this.joinedTimestamp=t.joined_at?new Date(t.joined_at).getTime():this.joinedTimestamp,this.id=t.id,this.available=!t.unavailable,this.features=t.features||this.features||[],t.members){this.members.clear();for(const e of t.members)this._addMember(e,!1)}if(t.owner_id&&(this.ownerID=t.owner_id),t.channels){this.channels.clear();for(const e of t.channels)this.client.dataManager.newChannel(e,this)}if(t.roles){this.roles.clear();for(const e of t.roles){const t=new r(this,e);this.roles.set(t.id,t)}}if(t.presences)for(const e of t.presences)this._setPresence(e.user.id,e);if(this._rawVoiceStates=new f,t.voice_states)for(const e of t.voice_states){this._rawVoiceStates.set(e.user_id,e);const t=this.members.get(e.user_id);t&&(t.serverMute=e.mute,t.serverDeaf=e.deaf,t.selfMute=e.self_mute,t.selfDeaf=e.self_deaf,t.voiceSessionID=e.session_id,t.voiceChannelID=e.channel_id,this.channels.get(e.channel_id).members.set(t.user.id,t))}if(this.emojis)this.client.actions.GuildEmojisUpdate.handle({guild_id:this.id,emojis:t.emojis});else{this.emojis=new f;for(const e of t.emojis)this.emojis.set(e.id,new o(this,e))}}get createdTimestamp(){return g.deconstruct(this.id).timestamp}get createdAt(){return new Date(this.createdTimestamp)}get joinedAt(){return new Date(this.joinedTimestamp)}iconURL(t,e){return this.icon?("number"==typeof t&&(e=t,t="default"),d.Endpoints.CDN(this.client.options.http.cdn).Icon(this.id,this.icon,t,e)):null}get nameAcronym(){return this.name.replace(/\w+/g,t=>t[0]).replace(/\s/g,"")}get splashURL(){return this.splash?d.Endpoints.CDN(this.client.options.http.cdn).Splash(this.id,this.splash):null}get owner(){return this.members.get(this.ownerID)}get voiceConnection(){return this.client.browser?null:this.client.voice.connections.get(this.id)||null}get defaultChannel(){return this.channels.get(this.id)}get position(){return this.client.user.bot?null:this.client.user.settings.guildPositions?this.client.user.settings.guildPositions.indexOf(this.id):null}get defaultRole(){return this.roles.get(this.id)}get me(){return this.members.get(this.client.user.id)}get _sortedRoles(){return this._sortPositionWithID(this.roles)}member(t){return this.client.resolver.resolveGuildMember(this,t)}fetchBans(){return this.client.api.guilds(this.id).bans.get().then(t=>t.reduce((t,e)=>{t.set(e.user.id,{reason:e.reason,user:this.client.dataManager.newUser(e.user)});return t},new f))}fetchInvites(){return this.client.api.guilds(this.id).invites.get().then(t=>{const e=new f;for(const n of t){const t=new a(this.client,n);e.set(t.code,t)}return e})}fetchWebhooks(){return this.client.api.guilds(this.id).webhooks.get().then(t=>{const e=new f;for(const n of t)e.set(n.id,new l(this.client,n));return e})}fetchVoiceRegions(){return this.client.api.guilds(this.id).regions.get().then(t=>{const e=new f;for(const n of t)e.set(n.id,new p(n));return e})}fetchAuditLogs(t={}){return t.before&&t.before instanceof c.Entry&&(t.before=t.before.id),t.after&&t.after instanceof c.Entry&&(t.after=t.after.id),"string"==typeof t.type&&(t.type=c.Actions[t.type]),this.client.api.guilds(this.id)["audit-logs"].get({query:{before:t.before,after:t.after,limit:t.limit,user_id:this.client.resolver.resolveUserID(t.user),action_type:t.type}}).then(t=>c.build(this,t))}addMember(t,e){if(this.members.has(t.id))return Promise.resolve(this.members.get(t.id));if(e.access_token=e.accessToken,e.roles){const t=e.roles;(t instanceof f||t instanceof Array&&t[0]instanceof r)&&(e.roles=t.map(t=>t.id))}return this.client.api.guilds(this.id).members(t.id).put({data:e}).then(t=>this.client.actions.GuildMemberGet.handle(this,t).member)}fetchMember(t,e=!0){return t=this.client.resolver.resolveUser(t),t?this.members.has(t.id)?Promise.resolve(this.members.get(t.id)):this.client.api.guilds(this.id).members(t.id).get().then(t=>e?this.client.actions.GuildMemberGet.handle(this,t).member:new h(this,t)):Promise.reject(new Error("User is not cached. Use Client.fetchUser first."))}fetchMembers(t="",e=0){return new Promise((n,i)=>{if(this.memberCount===this.members.size)return void n(new f);this.client.ws.send({op:d.OPCodes.REQUEST_GUILD_MEMBERS,d:{guild_id:this.id,query:t,limit:e}});const s=new f;const r=(i,o)=>{if(o.id!==this.id)return;for(const t of i.values())s.set(t.user.id,t);(this.memberCount===this.members.size||(t||e)&&i.size<1e3)&&(this.client.removeListener(d.Events.GUILD_MEMBERS_CHUNK,r),n(s))};this.client.on(d.Events.GUILD_MEMBERS_CHUNK,r);this.client.setTimeout(()=>{this.client.removeListener(d.Events.GUILD_MEMBERS_CHUNK,r);i(new Error("Members didn't arrive in time."))},12e4)})}search(t={}){return E.search(this,t)}edit(t,e){const n={};return t.name&&(n.name=t.name),t.region&&(n.region=t.region),t.verificationLevel&&(n.verification_level=Number(t.verificationLevel)),t.afkChannel&&(n.afk_channel_id=this.client.resolver.resolveChannel(t.afkChannel).id),t.afkTimeout&&(n.afk_timeout=Number(t.afkTimeout)),t.icon&&(n.icon=this.client.resolver.resolveBase64(t.icon)),t.owner&&(n.owner_id=this.client.resolver.resolveUser(t.owner).id),t.splash&&(n.splash=this.client.resolver.resolveBase64(t.splash)),this.client.api.guilds(this.id).patch({data:n,reason:e}).then(t=>this.client.actions.GuildUpdate.handle(t).updated)}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})}setPosition(t,e){return this.client.user.bot?Promise.reject(new Error("Setting guild position is only available for user accounts")):this.client.user.settings.setGuildPosition(this,t,e)}acknowledge(){return this.client.api.guilds(this.id).ack.post({data:{token:this.client.rest._ackToken}}).then(t=>{t.token&&(this.client.rest._ackToken=t.token);return this})}allowDMs(t){const e=this.client.user.settings;return t?e.removeRestrictedGuild(this):e.addRestrictedGuild(this)}ban(t,e={days:0}){e.days&&(e["delete-message-days"]=e.days);const n=this.client.resolver.resolveUserID(t);return n?this.client.api.guilds(this.id).bans(n).put({query:e}).then(()=>{if(t instanceof h)return t;const e=this.client.resolver.resolveUser(n);if(e){const t=this.client.resolver.resolveGuildMember(this,e);return t||e}return n}):Promise.reject(new Error("Couldn't resolve the user ID to ban."))}unban(t,e){const n=this.client.resolver.resolveUserID(t);if(!n)throw new Error("Couldn't resolve the user ID to unban.");return this.client.api.guilds(this.id).bans(n).delete({reason:e}).then(()=>t)}pruneMembers({days:days=7,dry:dry=!1,reason:reason}={}){if("number"!=typeof days)throw new TypeError("Days must be a number.");return this.client.api.guilds(this.id).prune[dry?"get":"post"]({query:{days:days},reason:reason}).then(t=>t.pruned)}sync(){this.client.user.bot||this.client.syncGuilds([this])}createChannel(t,e,{overwrites:overwrites,reason:reason}={}){return overwrites instanceof f&&(overwrites=overwrites.array()),this.client.api.guilds(this.id).channels.post({data:{name:t,type:e,permission_overwrites:overwrites},reason:reason}).then(t=>this.client.actions.ChannelCreate.handle(t).channel)}setChannelPositions(t){const e=new Array(t.length);for(let n=0;nthis.client.actions.GuildChannelsPositionUpdate.handle({guild_id:this.id,channels:t}).guild)}createRole({data:data={},reason:reason}={}){return data.color&&(data.color=m.resolveColor(data.color)),data.permissions&&(data.permissions=v.resolve(data.permissions)),this.client.api.guilds(this.id).roles.post({data:data,reason:reason}).then(t=>this.client.actions.GuildRoleCreate.handle({guild_id:this.id,role:t}).role)}createEmoji(t,e,n){if("string"==typeof attahment&&t.startsWith("data:")){const i={image:t,name:e};return n&&(i.roles=n.map(t=>t.id?t.id:t)),this.client.api.guilds(this.id).emojis.post({data:i}).then(t=>this.client.actions.GuildEmojiCreate.handle(this,t).emoji)}return this.client.resolver.resolveBuffer(t).then(t=>{const i=this.client.resolver.resolveBase64(t);return this.createEmoji(i,e,n)})}deleteEmoji(t){return t instanceof o||(t=this.emojis.get(t)),this.client.api.guilds(this.id).emojis(this.id).delete().then(()=>this.client.actions.GuildEmojiDelete.handle(t).data)}leave(){return this.ownerID===this.client.user.id?Promise.reject(new Error("Guild is owned by the client.")):this.client.api.users("@me").guilds(this.id).delete().then(()=>this.client.actions.GuildDelete.handle({id:this.id}).guild)}delete(){return this.client.api.guilds(this.id).delete().then(()=>this.client.actions.GuildDelete.handle({id:this.id}).guild)}equals(t){let e=t&&this.id===t.id&&this.available===!t.unavailable&&this.splash===t.splash&&this.region===t.region&&this.name===t.name&&this.memberCount===t.member_count&&this.large===t.large&&this.icon===t.icon&&m.arraysEqual(this.features,t.features)&&this.ownerID===t.owner_id&&this.verificationLevel===t.verification_level&&this.embedEnabled===t.embed_enabled;return e&&(this.embedChannel?this.embedChannel.id!==t.embed_channel_id&&(e=!1):t.embed_channel_id&&(e=!1)),e}toString(){return this.name}_addMember(t,e=!0){const n=this.members.has(t.user.id);t.user instanceof s||(t.user=this.client.dataManager.newUser(t.user)),t.joined_at=t.joined_at||0;const i=new h(this,t);if(this.members.set(i.id,i),this._rawVoiceStates&&this._rawVoiceStates.has(i.user.id)){const t=this._rawVoiceStates.get(i.user.id);i.serverMute=t.mute,i.serverDeaf=t.deaf,i.selfMute=t.self_mute,i.selfDeaf=t.self_deaf,i.voiceSessionID=t.session_id,i.voiceChannelID=t.channel_id,this.client.channels.has(t.channel_id)?this.client.channels.get(t.channel_id).members.set(i.user.id,i):this.client.emit("warn",`Member ${i.id} added in guild ${this.id} with an uncached voice channel`)}return this.client.ws.connection.status===d.Status.READY&&e&&!n&&this.client.emit(d.Events.GUILD_MEMBER_ADD,i),i}_updateMember(t,e){const n=m.cloneObject(t);e.roles&&(t._roles=e.roles),void 0!==e.nick&&(t.nickname=e.nick);const i=t.nickname!==n.nickname||!m.arraysEqual(t._roles,n._roles);return this.client.ws.connection.status===d.Status.READY&&i&&this.client.emit(d.Events.GUILD_MEMBER_UPDATE,n,t),{old:n,mem:t}}_removeMember(t){this.members.delete(t.id)}_memberSpeakUpdate(t,e){const n=this.members.get(t);n&&n.speaking!==e&&(n.speaking=e,this.client.emit(d.Events.GUILD_MEMBER_SPEAKING,n,e))}_setPresence(t,e){if(this.presences.get(t))return void this.presences.get(t).update(e);this.presences.set(t,new u(e))}setRolePosition(t,e,n=!1){if("string"==typeof t&&!(t=this.roles.get(t)))return Promise.reject(new Error("Supplied role is not a role or snowflake."));if(e=Number(e),isNaN(e))return Promise.reject(new Error("Supplied position is not a number."));let i=this._sortedRoles.array();return m.moveElementInArray(i,t,e,n),i=i.map((t,e)=>({id:t.id,position:e})),this.client.api.guilds(this.id).roles.patch({data:i}).then(()=>this.client.actions.GuildRolesPositionUpdate.handle({guild_id:this.id,roles:i}).guild)}setChannelPosition(t,e,n=!1){if("string"==typeof t&&!(t=this.channels.get(t)))return Promise.reject(new Error("Supplied channel is not a channel or snowflake."));if(e=Number(e),isNaN(e))return Promise.reject(new Error("Supplied position is not a number."));let i=this._sortedChannels(t.type).array();return m.moveElementInArray(i,t,e,n),i=i.map((t,e)=>({id:t.id,position:e})),this.client.api.guilds(this.id).channels.patch({data:i}).then(()=>this.client.actions.GuildChannelsPositionUpdate.handle({guild_id:this.id,roles:i}).guild)}_sortedChannels(t){return this._sortPositionWithID(this.channels.filter(e=>"voice"===t&&"voice"===e.type||("voice"!==t&&"voice"!==e.type||t===e.type)))}_sortPositionWithID(t){return t.sort((t,e)=>t.position!==e.position?t.position-e.position:i.fromString(t.id).sub(i.fromString(e.id)).toNumber())}}t.exports=b},function(t,e,n){const i=n(24),s=n(20),r=n(9),o=n(3),a=n(13).Presence;class c{constructor(t,e){Object.defineProperty(this,"client",{value:t.client}),this.guild=t,this.user={},this._roles=[],e&&this.setup(e),this.lastMessageID=null,this.lastMessage=null}setup(t){this.serverDeaf=t.deaf,this.serverMute=t.mute,this.selfMute=t.self_mute,this.selfDeaf=t.self_deaf,this.voiceSessionID=t.session_id,this.voiceChannelID=t.channel_id,this.speaking=!1,this.nickname=t.nick||null,this.joinedTimestamp=new Date(t.joined_at).getTime(),this.user=t.user,this._roles=t.roles}get joinedAt(){return new Date(this.joinedTimestamp)}get presence(){return this.frozenPresence||this.guild.presences.get(this.id)||new a}get roles(){const t=new o,e=this.guild.roles.get(this.guild.id);e&&t.set(e.id,e);for(const e of this._roles){const n=this.guild.roles.get(e);n&&t.set(n.id,n)}return t}get highestRole(){return this.roles.reduce((t,e)=>!t||e.comparePositionTo(t)>0?e:t)}get colorRole(){const t=this.roles.filter(t=>t.color);return t.size?t.reduce((t,e)=>!t||e.comparePositionTo(t)>0?e:t):null}get displayColor(){const t=this.colorRole;return t&&t.color||0}get displayHexColor(){const t=this.colorRole;return t&&t.hexColor||"#000000"}get hoistRole(){const t=this.roles.filter(t=>t.hoist);return t.size?t.reduce((t,e)=>!t||e.comparePositionTo(t)>0?e:t):null}get mute(){return this.selfMute||this.serverMute}get deaf(){return this.selfDeaf||this.serverDeaf}get voiceChannel(){return this.guild.channels.get(this.voiceChannelID)}get id(){return this.user.id}get displayName(){return this.nickname||this.user.username}get permissions(){if(this.user.id===this.guild.ownerID)return new r(r.ALL);let t=0;const e=this.roles;for(const n of e.values())t|=n.permissions;return new r(t)}get kickable(){if(this.user.id===this.guild.ownerID)return!1;if(this.user.id===this.client.user.id)return!1;const t=this.guild.member(this.client.user);return!!t.permissions.has(r.FLAGS.KICK_MEMBERS)&&t.highestRole.comparePositionTo(this.highestRole)>0}get bannable(){if(this.user.id===this.guild.ownerID)return!1;if(this.user.id===this.client.user.id)return!1;const t=this.guild.member(this.client.user);return!!t.permissions.has(r.FLAGS.BAN_MEMBERS)&&t.highestRole.comparePositionTo(this.highestRole)>0}permissionsIn(t){if(!(t=this.client.resolver.resolveChannel(t))||!t.guild)throw new Error("Could not resolve channel to a guild channel.");return t.permissionsFor(this)}hasPermission(t,e=!1,n,i){return void 0===n&&(n=!e),void 0===i&&(i=!e),!(!i||this.user.id!==this.guild.ownerID)||this.roles.some(e=>e.hasPermission(t,void 0,n))}missingPermissions(t,e=!1){return t.missing(t,e)}edit(t,e){t.channel&&(t.channel_id=this.client.resolver.resolveChannel(t.channel).id,t.channel=null),t.roles&&(t.roles=t.roles.map(t=>t instanceof s?t.id:t));let n=this.client.api.guilds(this.guild.id);if(this.user.id===this.client.user.id){const e=Object.keys(t);n=1===e.length&&"nick"===e[0]?n.members("@me").nick:n.members(this.id)}else n=n.members(this.id);return n.patch({data:t,reason:e}).then(t=>this.guild._updateMember(this,t).mem)}setMute(t){return this.edit({mute:t})}setDeaf(t){return this.edit({deaf:t})}setVoiceChannel(t){return this.edit({channel:t})}setRoles(t){return this.edit({roles:t})}addRole(t){return t instanceof s||(t=this.guild.roles.get(t)),t?this._roles.includes(t.id)?Promise.resolve(this):this.client.api.guilds(this.guild.id).members(this.user.id).roles(t.id).put().then(()=>this):Promise.reject(new TypeError("Supplied parameter was neither a Role nor a Snowflake."))}addRoles(t){let e;if(t instanceof o){e=this._roles.slice();for(const n of t.values())e.push(n.id?n.id:n)}else e=this._roles.concat(t.map(t=>t.id?t.id:t));return this.edit({roles:e})}removeRole(t){return t instanceof s||(t=this.guild.roles.get(t)),t?this.client.api.guilds(this.guild.id).members(this.user.id).roles(t.id).delete().then(()=>this):Promise.reject(new TypeError("Supplied parameter was neither a Role nor a Snowflake."))}removeRoles(t){const e=this._roles.slice();if(t instanceof o)for(const n of t.values()){const t=e.indexOf(n.id);t>=0&&e.splice(t,1)}else for(const n of t){const t=e.indexOf(n instanceof s?n.id:n);t>=0&&e.splice(t,1)}return this.edit({roles:e})}setNickname(t){return this.edit({nick:t})}createDM(){return this.user.createDM()}deleteDM(){return this.user.deleteDM()}kick(t){return this.client.api.guilds(this.guild.id).members(this.user.id).delete({reason:t}).then(()=>this.client.actions.GuildMemberRemove.handle({guild_id:this.guild.id,user:this.user}).member)}ban(t){return this.guild.ban(this,t)}toString(){return`<@${this.nickname?"!":""}${this.user.id}>`}send(){}}i.applyToClass(c),t.exports=c},function(t,e,n){const i=n(6),s=n(9),r=n(4);class o{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 i.deconstruct(this.id).timestamp}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.permissions.has(s.FLAGS.MANAGE_ROLES)&&t.highestRole.comparePositionTo(this)>0}get calculatedPosition(){const t=this.guild._sortedRoles;return t.array().indexOf(t.get(this.id))}serialize(){return new s(this.permissions).serialize()}hasPermission(t,e=!1,n){return new s(this.permissions).has(t,void 0!==n?n:!e)}comparePositionTo(t){return this.constructor.comparePositions(this,t)}edit(t,e){return t.permissions?t.permissions=s.resolve(t.permissions):t.permissions=this.permissions,this.client.api.guilds(this.guild.id).roles(this.id).patch({data:{name:t.name||this.name,position:void 0!==t.position?t.position:this.position,color:r.resolveColor(t.color||this.color),hoist:void 0!==t.hoist?t.hoist:this.hoist,mentionable:void 0!==t.mentionable?t.mentionable:this.mentionable},reason:e}).then(t=>this.client.actions.GuildRoleUpdate.handle({role:t,guild_id:this.guild.id}).updated)}setName(t){return this.edit({name:t})}setColor(t){return this.edit({color:t})}setHoist(t){return this.edit({hoist:t})}setPosition(t,e){return this.guild.setRolePosition(this,t,e).then(()=>this)}setPermissions(t){return this.edit({permissions:t})}setMentionable(t){return this.edit({mentionable:t})}delete(t){return this.client.api.guilds(this.guild.id).roles(this.id).delete({reason:t}).then(()=>this.client.actions.GuildRoleDelete.handle({guild_id:this.guild.id,role_id:this.id}).role)}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===this.guild.id?"@everyone":`<@&${this.id}>`}static comparePositions(t,e){return t.position===e.position?e.id-t.id:t.position-e.position}}t.exports=o},function(t,e,n){const i=n(29),s=n(4);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=this.client.users?this.client.users.get(t.user.id):t.user:this.owner=null}send(t,e){if(e||"object"!=typeof t||t instanceof Array?e||(e={}):(e=t,t=""),e.username||(e.username=this.name),e.avatarURL&&(e.avatar_url=e.avatarURL,e.avatarURL=null),void 0!==t&&(t=s.resolveString(t)),t&&(e.disableEveryone||void 0===e.disableEveryone&&this.client.options.disableEveryone)&&(t=t.replace(/@(everyone|here)/g,"@​$1")),e.content=t,e.file&&(e.files?e.files.push(e.file):e.files=[e.file]),e.files){for(let t=0;tthis.client.resolver.resolveBuffer(t.attachment).then(e=>{t.file=e;return t}))).then(t=>this.client.api.webhooks(this.id,this.token).post({data:e,query:{wait:!0},files:t,auth:!1}))}return this.client.api.webhooks(this.id,this.token).post({data:e,query:{wait:!0},auth:!1}).then(t=>{if(!this.client.channels)return t;const e=n(8);return new e(this.client.channels.get(t.channel_id,t,this.client))})}sendSlackMessage(t){return this.client.api.webhooks(this.id,this.token).slack.post({query:{wait:!0},auth:!1,data:t}).then(t=>{if(!this.client.channels)return t;const e=n(8);return new e(this.client.channels.get(t.channel_id,t,this.client))})}edit({name:name=this.name,avatar:avatar},t){return avatar&&"string"==typeof avatar&&!avatar.startsWith("data:")?this.client.resolver.resolveBuffer(avatar).then(e=>{const n=this.client.resolver.resolveBase64(e);return this.edit({name:name,avatar:n},t)}):this.client.api.webhooks(this.id,this.token).patch({data:{name:name,avatar:avatar},reason:t}).then(t=>{this.name=t.name;this.avatar=t.avatar;return this})}delete(t){return this.client.api.webhooks(this.id,this.token).delete({reason:t})}}t.exports=r},function(t,e,n){(function(t){function n(t){return Array.isArray?Array.isArray(t):"[object Array]"===g(t)}function i(t){return"boolean"==typeof t}function s(t){return null===t}function r(t){return null==t}function o(t){return"number"==typeof t}function a(t){return"string"==typeof t}function c(t){return"symbol"==typeof t}function l(t){return void 0===t}function u(t){return"[object RegExp]"===g(t)}function h(t){return"object"==typeof t&&null!==t}function p(t){return"[object Date]"===g(t)}function d(t){return"[object Error]"===g(t)||t instanceof Error}function f(t){return"function"==typeof t}function m(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t}function g(t){return Object.prototype.toString.call(t)}e.isArray=n,e.isBoolean=i,e.isNull=s,e.isNullOrUndefined=r,e.isNumber=o,e.isString=a,e.isSymbol=c,e.isUndefined=l,e.isRegExp=u,e.isObject=h,e.isDate=p,e.isError=d,e.isFunction=f,e.isPrimitive=m,e.isBuffer=t.isBuffer}).call(e,n(5).Buffer)},function(t,e,n){e=t.exports=n(57),e.Stream=e,e.Readable=e,e.Writable=n(36),e.Duplex=n(15),e.Transform=n(58),e.PassThrough=n(86)},function(t,e,n){const i=n(29),s=n(46),r=n(71),o=n(3),a=n(6);class c{constructor(){this.messages=new o,this.lastMessageID=null,this.lastMessage=null}send(t,e){if(e||"object"!=typeof t||t instanceof Array?e||(e={}):(e=t,t=""),e.content||(e.content=t),e.embed&&e.embed.file&&(e.file=e.embed.file),e.file&&(e.files?e.files.push(e.file):e.files=[e.file]),e.files){for(let t=0;tthis.client.resolver.resolveBuffer(t.attachment).then(e=>{t.file=e;return t}))).then(t=>{e.files=t;return r.sendMessage(this,e)})}return r.sendMessage(this,e)}fetchMessage(t){const e=n(8);return this.client.user.bot?this.client.api.channels(this.id).messages(t).get().then(t=>{const n=t instanceof e?t:new e(this,t,this.client);this._cacheMessage(n);return n}):this.fetchMessages({limit:1,around:t}).then(e=>{const n=e.get(t);if(!n)throw new Error("Message not found.");return n})}fetchMessages(t={}){const e=n(8);return this.client.api.channels(this.id).messages.get({query:t}).then(t=>{const n=new o;for(const i of t){const t=new e(this,i,this.client);n.set(i.id,t),this._cacheMessage(t)}return n})}fetchPinnedMessages(){const t=n(8);return this.client.api.channels(this.id).pins.get().then(e=>{const n=new o;for(const i of e){const e=new t(this,i,this.client);n.set(i.id,e),this._cacheMessage(e)}return n})}search(t={}){return r.search(this,t)}startTyping(t){if(void 0!==t&&t<1)throw new RangeError("Count must be at least 1.");if(this.client.user._typing.has(this.id)){const e=this.client.user._typing.get(this.id);e.count=t||e.count+1}else{const e=this.client.api.channels(this.id).typing;this.client.user._typing.set(this.id,{count:t||1,interval:this.client.setInterval(()=>{e.post()},9e3)}),e.post()}}stopTyping(t=!1){if(this.client.user._typing.has(this.id)){const e=this.client.user._typing.get(this.id);e.count--,(e.count<=0||t)&&(this.client.clearInterval(e.interval),this.client.user._typing.delete(this.id))}}get typing(){return this.client.user._typing.has(this.id)}get typingCount(){return this.client.user._typing.has(this.id)?this.client.user._typing.get(this.id).count:0}createMessageCollector(t,e={}){return new s(this,t,e)}awaitMessages(t,e={}){return new Promise((n,i)=>{const s=this.createMessageCollector(t,e);s.once("end",(t,s)=>{e.errors&&e.errors.includes(s)?i(t):n(t)})})}bulkDelete(t,e=!1){if(!isNaN(t))return this.fetchMessages({limit:t}).then(t=>this.bulkDelete(t,e));if(t instanceof Array||t instanceof o){let n=t instanceof o?t.keyArray():t.map(t=>t.id);return e&&(n=n.filter(t=>Date.now()-a.deconstruct(t).date.getTime()<12096e5)),this.client.api.channels(this.id).messages()["bulk-delete"].post({data:{messages:n}}).then(()=>this.client.actions.MessageDeleteBulk.handle({channel_id:this.id,ids:n}).messages)}throw new TypeError("The messages must be an Array, Collection, or number.")}acknowledge(){return this.lastMessageID?this.client.api.channels(this.id).messages(this.lastMessageID).ack.post({data:{token:this.client.rest._ackToken}}).then(t=>{t.token&&(this.client.rest._ackToken=t.token);return this}):Promise.resolve(this)}_cacheMessage(t){const e=this.client.options.messageCacheMaxSize;return 0===e?null:(this.messages.size>=e&&e>0&&this.messages.delete(this.messages.firstKey()),this.messages.set(t.id,t),t)}}e.applyToClass=((t,e=!1,n=[])=>{const i=["send"];e&&i.push("_cacheMessage","acknowledge","fetchMessages","fetchMessage","search","bulkDelete","startTyping","stopTyping","typing","typingCount","fetchPinnedMessages","createMessageCollector","awaitMessages");for(const e of i)n.includes(e)||Object.defineProperty(t.prototype,e,Object.getOwnPropertyDescriptor(c.prototype,e))})},function(t,e){e.endianness=function(){return"LE"},e.hostname=function(){return"undefined"!=typeof location?location.hostname:""},e.loadavg=function(){return[]},e.uptime=function(){return 0},e.freemem=function(){return Number.MAX_VALUE},e.totalmem=function(){return Number.MAX_VALUE},e.cpus=function(){return[]},e.type=function(){return"Browser"},e.release=function(){return"undefined"!=typeof navigator?navigator.appVersion:""},e.networkInterfaces=e.getNetworkInterfaces=function(){return{}},e.arch=function(){return"javascript"},e.platform=function(){return"browser"},e.tmpdir=e.tmpDir=function(){return"/tmp"},e.EOL="\n"},function(t,e,n){const i=n(16),s=n(20),r=n(27),o=n(52),a=n(9),c=n(3);class l extends i{constructor(t,e){super(t.client,e),this.guild=t}setup(t){if(super.setup(t),this.name=t.name,this.position=t.position,this.permissionOverwrites=new c,t.permission_overwrites)for(const e of t.permission_overwrites)this.permissionOverwrites.set(e.id,new o(this,e))}get calculatedPosition(){const t=this.guild._sortedChannels(this.type);return t.array().indexOf(t.get(this.id))}permissionsFor(t){if(!(t=this.client.resolver.resolveGuildMember(this.guild,t)))return null;if(t.id===this.guild.ownerID)return new a(a.ALL);let e=0;const n=t.roles;for(const t of n.values())e|=t.permissions;const i=this.overwritesFor(t,!0,n);i.everyone&&(e&=~i.everyone.deny,e|=i.everyone.allow);let s=0;for(const t of i.roles)e&=~t.deny,s|=t.allow;return e|=s,i.member&&(e&=~i.member.deny,e|=i.member.allow),Boolean(e&a.FLAGS.ADMINISTRATOR)&&(e=a.ALL),new a(e)}overwritesFor(t,e=!1,n=null){if(e||(t=this.client.resolver.resolveGuildMember(this.guild,t)),!t)return[];n=n||t.roles;const i=[];let s,r;for(const e of this.permissionOverwrites.values())e.id===this.guild.id?r=e:n.has(e.id)?i.push(e):e.id===t.id&&(s=e);return{everyone:r,roles:i,member:s}}overwritePermissions(t,e,n){const i={allow:0,deny:0};if(t instanceof s)i.type="role";else if(this.guild.roles.has(t))t=this.guild.roles.get(t),i.type="role";else if(t=this.client.resolver.resolveUser(t),i.type="member",!t)return Promise.reject(new TypeError("Supplied parameter was neither a User nor a Role."));i.id=t.id;const r=this.permissionOverwrites.get(t.id);r&&(i.allow=r.allow,i.deny=r.deny);for(const t in e)!0===e[t]?(i.allow|=a.FLAGS[t]||0,i.deny&=~(a.FLAGS[t]||0)):!1===e[t]?(i.allow&=~(a.FLAGS[t]||0),i.deny|=a.FLAGS[t]||0):null===e[t]&&(i.allow&=~(a.FLAGS[t]||0),i.deny&=~(a.FLAGS[t]||0));return this.client.api.channels(this.id).permissions(i.id).put({data:i,reason:n}).then(()=>this)}edit(t,e){return this.client.api.channels(this.id).patch({data:{name:(t.name||this.name).trim(),topic:t.topic||this.topic,position:t.position||this.position,bitrate:t.bitrate||this.bitrate,user_limit:t.userLimit||this.userLimit},reason:e}).then(t=>this.client.actions.ChannelUpdate.handle(t).updated)}setName(t){return this.edit({name:t})}setPosition(t,e){return this.guild.setChannelPosition(this,t,e).then(()=>this)}setTopic(t){return this.edit({topic:t})}createInvite({temporary:temporary=!1,maxAge:maxAge=86400,maxUses:maxUses=0,reason:reason}={}){return this.client.api.channels(this.id).invites.post({data:{temporary:temporary,max_age:maxAge,max_uses:maxUses},reason:reason}).then(t=>new r(this.client,t))}clone(t=this.name,e=!0,n=!0){return this.guild.createChannel(t,this.type,e?this.permissionOverwrites:[]).then(t=>n?t.setTopic(this.topic):t)}equals(t){let e=t&&this.id===t.id&&this.type===t.type&&this.topic===t.topic&&this.position===t.position&&this.name===t.name;return e&&(e=this.permissionOverwrites&&t.permissionOverwrites?this.permissionOverwrites.equals(t.permissionOverwrites):!this.permissionOverwrites&&!t.permissionOverwrites),e}get deletable(){return this.id!==this.guild.id&&this.permissionsFor(this.client.user).has(a.FLAGS.MANAGE_CHANNELS)}delete(t){return this.client.api.channels(this.id).delete({reason:t}).then(()=>this)}toString(){return`<#${this.id}>`}}t.exports=l},function(t,e,n){const i=n(50),s=n(51),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.presenceCount=t.approximate_presence_count,this.memberCount=t.approximate_member_count,this.textChannelCount=t.guild.text_channel_count,this.voiceChannelCount=t.guild.voice_channel_count,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.invite(this.code)}delete(t){return this.client.api.invites(this.code).delete({reason:t}).then(()=>this)}toString(){return this.url}}t.exports=o},function(t,e,n){const i=n(6),s=n(0);class r{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.rpcOrigins=t.rpc_origins,this.redirectURIs=t.redirect_uris,this.botRequireCodeGrant=t.bot_require_code_grant,this.botPublic=t.bot_public,this.rpcApplicationState=t.rpc_application_state,this.bot=t.bot,this.flags=t.flags,this.secret=t.secret,t.owner&&(this.owner=this.client.dataManager.newUser(t.owner))}get createdTimestamp(){return i.deconstruct(this.id).timestamp}get createdAt(){return new Date(this.createdTimestamp)}iconURL(t,e){return this.icon?("number"==typeof t&&(e=t,t="default"),s.Endpoints.CDN(this.client.options.http.cdn).AppIcon(this.id,this.icon,t,e)):null}reset(){return this.rest.api.oauth2.applications(this.id).reset.post().then(t=>new r(this.client,t))}toString(){return this.name}}t.exports=r},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,c=0;c[t.id,t.nick]))),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}addUser(t,e){const n=this.client.resolver.resolveUserID(t),i=this.client.user.bot?{nick:e,access_token:t}:{recipient:n};return this.client.api.channels(this.id).recipients(n).put({data:i}).then(()=>this)}toString(){return this.name}send(){}fetchMessage(){}fetchMessages(){}fetchPinnedMessages(){}search(){}startTyping(){}stopTyping(){}get typing(){}get typingCount(){}createCollector(){}awaitMessages(){}acknowledge(){}_cacheMessage(){}}s.applyToClass(o,!0,["bulkDelete"]),t.exports=o},function(t,e){class n{constructor(t,e,n){this.reaction=t,this.name=e,this.id=n}get identifier(){return this.id?`${this.name}:${this.id}`:encodeURIComponent(this.name)}toString(){return this.id?`<:${this.name}:${this.id}>`:this.name}}t.exports=n},function(t,e,n){const i=n(3),s=n(14).EventEmitter;class r extends s{constructor(t,e,n={}){super(),Object.defineProperty(this,"client",{value:t}),this.filter=e,this.options=n,this.collected=new i,this.ended=!1,this._timeout=null,this.listener=this._handle.bind(this),n.time&&(this._timeout=this.client.setTimeout(()=>this.stop("time"),n.time))}_handle(...t){const e=this.handle(...t);if(e&&this.filter(...t)){this.collected.set(e.key,e.value),this.emit("collect",e.value,this);const n=this.postCheck(...t);n&&this.stop(n)}}get next(){return new Promise((t,e)=>{if(this.ended)return void e(this.collected);const n=()=>{this.removeListener("collect",i);this.removeListener("end",s)};const i=e=>{n();t(e)};const s=()=>{n();e(this.collected)};this.on("collect",i);this.on("end",s)})}stop(t="user"){this.ended||(this._timeout&&this.client.clearTimeout(this._timeout),this.ended=!0,this.cleanup(),this.emit("end",this.collected,t))}handle(){}postCheck(){}cleanup(){}}t.exports=r},function(t,e,n){var i,s,r;/** * @license long.js (c) 2013 Daniel Wirtz * Released under the Apache License, Version 2.0 * see: https://github.com/dcodeIO/long.js for details