From 87ea303ace5ea42f6e55a1247b7e8901d797bdcf Mon Sep 17 00:00:00 2001 From: Travis CI Date: Sat, 29 Feb 2020 15:02:07 +0000 Subject: [PATCH] Webpack build for branch stable: b3931eaebb099c83e28f985ee67e8b529e52cbf5 --- discord.stable.js | 251 +++++++++++++++++++++++++++++++++--------- discord.stable.min.js | 2 +- 2 files changed, 199 insertions(+), 54 deletions(-) diff --git a/discord.stable.js b/discord.stable.js index 339b776b..1980d581 100644 --- a/discord.stable.js +++ b/discord.stable.js @@ -107,7 +107,7 @@ eval("const browser = typeof window !== 'undefined';\nconst webpack = !!\"true\" /***/ (function(module, exports, __webpack_require__) { "use strict"; -eval("\n\nexports.byteLength = byteLength\nexports.toByteArray = toByteArray\nexports.fromByteArray = fromByteArray\n\nvar lookup = []\nvar revLookup = []\nvar Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array\n\nvar code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'\nfor (var i = 0, len = code.length; i < len; ++i) {\n lookup[i] = code[i]\n revLookup[code.charCodeAt(i)] = i\n}\n\n// Support decoding URL-safe base64 strings, as Node.js does.\n// See: https://en.wikipedia.org/wiki/Base64#URL_applications\nrevLookup['-'.charCodeAt(0)] = 62\nrevLookup['_'.charCodeAt(0)] = 63\n\nfunction getLens (b64) {\n var len = b64.length\n\n if (len % 4 > 0) {\n throw new Error('Invalid string. Length must be a multiple of 4')\n }\n\n // Trim off extra bytes after placeholder bytes are found\n // See: https://github.com/beatgammit/base64-js/issues/42\n var validLen = b64.indexOf('=')\n if (validLen === -1) validLen = len\n\n var placeHoldersLen = validLen === len\n ? 0\n : 4 - (validLen % 4)\n\n return [validLen, placeHoldersLen]\n}\n\n// base64 is 4/3 + up to two characters of the original data\nfunction byteLength (b64) {\n var lens = getLens(b64)\n var validLen = lens[0]\n var placeHoldersLen = lens[1]\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n}\n\nfunction _byteLength (b64, validLen, placeHoldersLen) {\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n}\n\nfunction toByteArray (b64) {\n var tmp\n var lens = getLens(b64)\n var validLen = lens[0]\n var placeHoldersLen = lens[1]\n\n var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))\n\n var curByte = 0\n\n // if there are placeholders, only get up to the last complete 4 chars\n var len = placeHoldersLen > 0\n ? validLen - 4\n : validLen\n\n for (var i = 0; i < len; i += 4) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 18) |\n (revLookup[b64.charCodeAt(i + 1)] << 12) |\n (revLookup[b64.charCodeAt(i + 2)] << 6) |\n revLookup[b64.charCodeAt(i + 3)]\n arr[curByte++] = (tmp >> 16) & 0xFF\n arr[curByte++] = (tmp >> 8) & 0xFF\n arr[curByte++] = tmp & 0xFF\n }\n\n if (placeHoldersLen === 2) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 2) |\n (revLookup[b64.charCodeAt(i + 1)] >> 4)\n arr[curByte++] = tmp & 0xFF\n }\n\n if (placeHoldersLen === 1) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 10) |\n (revLookup[b64.charCodeAt(i + 1)] << 4) |\n (revLookup[b64.charCodeAt(i + 2)] >> 2)\n arr[curByte++] = (tmp >> 8) & 0xFF\n arr[curByte++] = tmp & 0xFF\n }\n\n return arr\n}\n\nfunction tripletToBase64 (num) {\n return lookup[num >> 18 & 0x3F] +\n lookup[num >> 12 & 0x3F] +\n lookup[num >> 6 & 0x3F] +\n lookup[num & 0x3F]\n}\n\nfunction encodeChunk (uint8, start, end) {\n var tmp\n var output = []\n for (var i = start; i < end; i += 3) {\n tmp =\n ((uint8[i] << 16) & 0xFF0000) +\n ((uint8[i + 1] << 8) & 0xFF00) +\n (uint8[i + 2] & 0xFF)\n output.push(tripletToBase64(tmp))\n }\n return output.join('')\n}\n\nfunction fromByteArray (uint8) {\n var tmp\n var len = uint8.length\n var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes\n var parts = []\n var maxChunkLength = 16383 // must be multiple of 3\n\n // go through the array every three bytes, we'll deal with trailing stuff later\n for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {\n parts.push(encodeChunk(\n uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)\n ))\n }\n\n // pad the end with zeros, but make sure to not forget the extra bytes\n if (extraBytes === 1) {\n tmp = uint8[len - 1]\n parts.push(\n lookup[tmp >> 2] +\n lookup[(tmp << 4) & 0x3F] +\n '=='\n )\n } else if (extraBytes === 2) {\n tmp = (uint8[len - 2] << 8) + uint8[len - 1]\n parts.push(\n lookup[tmp >> 10] +\n lookup[(tmp >> 4) & 0x3F] +\n lookup[(tmp << 2) & 0x3F] +\n '='\n )\n }\n\n return parts.join('')\n}\n\n\n//# sourceURL=webpack:///./node_modules/base64-js/index.js?"); +eval("\n\nexports.byteLength = byteLength\nexports.toByteArray = toByteArray\nexports.fromByteArray = fromByteArray\n\nvar lookup = []\nvar revLookup = []\nvar Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array\n\nvar code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'\nfor (var i = 0, len = code.length; i < len; ++i) {\n lookup[i] = code[i]\n revLookup[code.charCodeAt(i)] = i\n}\n\n// Support decoding URL-safe base64 strings, as Node.js does.\n// See: https://en.wikipedia.org/wiki/Base64#URL_applications\nrevLookup['-'.charCodeAt(0)] = 62\nrevLookup['_'.charCodeAt(0)] = 63\n\nfunction getLens (b64) {\n var len = b64.length\n\n if (len % 4 > 0) {\n throw new Error('Invalid string. Length must be a multiple of 4')\n }\n\n // Trim off extra bytes after placeholder bytes are found\n // See: https://github.com/beatgammit/base64-js/issues/42\n var validLen = b64.indexOf('=')\n if (validLen === -1) validLen = len\n\n var placeHoldersLen = validLen === len\n ? 0\n : 4 - (validLen % 4)\n\n return [validLen, placeHoldersLen]\n}\n\n// base64 is 4/3 + up to two characters of the original data\nfunction byteLength (b64) {\n var lens = getLens(b64)\n var validLen = lens[0]\n var placeHoldersLen = lens[1]\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n}\n\nfunction _byteLength (b64, validLen, placeHoldersLen) {\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n}\n\nfunction toByteArray (b64) {\n var tmp\n var lens = getLens(b64)\n var validLen = lens[0]\n var placeHoldersLen = lens[1]\n\n var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))\n\n var curByte = 0\n\n // if there are placeholders, only get up to the last complete 4 chars\n var len = placeHoldersLen > 0\n ? validLen - 4\n : validLen\n\n var i\n for (i = 0; i < len; i += 4) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 18) |\n (revLookup[b64.charCodeAt(i + 1)] << 12) |\n (revLookup[b64.charCodeAt(i + 2)] << 6) |\n revLookup[b64.charCodeAt(i + 3)]\n arr[curByte++] = (tmp >> 16) & 0xFF\n arr[curByte++] = (tmp >> 8) & 0xFF\n arr[curByte++] = tmp & 0xFF\n }\n\n if (placeHoldersLen === 2) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 2) |\n (revLookup[b64.charCodeAt(i + 1)] >> 4)\n arr[curByte++] = tmp & 0xFF\n }\n\n if (placeHoldersLen === 1) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 10) |\n (revLookup[b64.charCodeAt(i + 1)] << 4) |\n (revLookup[b64.charCodeAt(i + 2)] >> 2)\n arr[curByte++] = (tmp >> 8) & 0xFF\n arr[curByte++] = tmp & 0xFF\n }\n\n return arr\n}\n\nfunction tripletToBase64 (num) {\n return lookup[num >> 18 & 0x3F] +\n lookup[num >> 12 & 0x3F] +\n lookup[num >> 6 & 0x3F] +\n lookup[num & 0x3F]\n}\n\nfunction encodeChunk (uint8, start, end) {\n var tmp\n var output = []\n for (var i = start; i < end; i += 3) {\n tmp =\n ((uint8[i] << 16) & 0xFF0000) +\n ((uint8[i + 1] << 8) & 0xFF00) +\n (uint8[i + 2] & 0xFF)\n output.push(tripletToBase64(tmp))\n }\n return output.join('')\n}\n\nfunction fromByteArray (uint8) {\n var tmp\n var len = uint8.length\n var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes\n var parts = []\n var maxChunkLength = 16383 // must be multiple of 3\n\n // go through the array every three bytes, we'll deal with trailing stuff later\n for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {\n parts.push(encodeChunk(\n uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)\n ))\n }\n\n // pad the end with zeros, but make sure to not forget the extra bytes\n if (extraBytes === 1) {\n tmp = uint8[len - 1]\n parts.push(\n lookup[tmp >> 2] +\n lookup[(tmp << 4) & 0x3F] +\n '=='\n )\n } else if (extraBytes === 2) {\n tmp = (uint8[len - 2] << 8) + uint8[len - 1]\n parts.push(\n lookup[tmp >> 10] +\n lookup[(tmp >> 4) & 0x3F] +\n lookup[(tmp << 2) & 0x3F] +\n '='\n )\n }\n\n return parts.join('')\n}\n\n\n//# sourceURL=webpack:///./node_modules/base64-js/index.js?"); /***/ }), @@ -120,7 +120,7 @@ eval("\n\nexports.byteLength = byteLength\nexports.toByteArray = toByteArray\nex /***/ (function(module, exports, __webpack_require__) { "use strict"; -eval("/* WEBPACK VAR INJECTION */(function(global) {/*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh \n * @license MIT\n */\n/* eslint-disable no-proto */\n\n\n\nvar base64 = __webpack_require__(/*! base64-js */ \"./node_modules/base64-js/index.js\")\nvar ieee754 = __webpack_require__(/*! ieee754 */ \"./node_modules/ieee754/index.js\")\nvar isArray = __webpack_require__(/*! isarray */ \"./node_modules/isarray/index.js\")\n\nexports.Buffer = Buffer\nexports.SlowBuffer = SlowBuffer\nexports.INSPECT_MAX_BYTES = 50\n\n/**\n * If `Buffer.TYPED_ARRAY_SUPPORT`:\n * === true Use Uint8Array implementation (fastest)\n * === false Use Object implementation (most compatible, even IE6)\n *\n * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,\n * Opera 11.6+, iOS 4.2+.\n *\n * Due to various browser bugs, sometimes the Object implementation will be used even\n * when the browser supports typed arrays.\n *\n * Note:\n *\n * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,\n * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.\n *\n * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.\n *\n * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of\n * incorrect length in some situations.\n\n * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they\n * get the Object implementation, which is slower but behaves correctly.\n */\nBuffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined\n ? global.TYPED_ARRAY_SUPPORT\n : typedArraySupport()\n\n/*\n * Export kMaxLength after typed array support is determined.\n */\nexports.kMaxLength = kMaxLength()\n\nfunction typedArraySupport () {\n try {\n var arr = new Uint8Array(1)\n arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}\n return arr.foo() === 42 && // typed array instances can be augmented\n typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`\n arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`\n } catch (e) {\n return false\n }\n}\n\nfunction kMaxLength () {\n return Buffer.TYPED_ARRAY_SUPPORT\n ? 0x7fffffff\n : 0x3fffffff\n}\n\nfunction createBuffer (that, length) {\n if (kMaxLength() < length) {\n throw new RangeError('Invalid typed array length')\n }\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n // Return an augmented `Uint8Array` instance, for best performance\n that = new Uint8Array(length)\n that.__proto__ = Buffer.prototype\n } else {\n // Fallback: Return an object instance of the Buffer class\n if (that === null) {\n that = new Buffer(length)\n }\n that.length = length\n }\n\n return that\n}\n\n/**\n * The Buffer constructor returns instances of `Uint8Array` that have their\n * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of\n * `Uint8Array`, so the returned instances will have all the node `Buffer` methods\n * and the `Uint8Array` methods. Square bracket notation works as expected -- it\n * returns a single octet.\n *\n * The `Uint8Array` prototype remains unmodified.\n */\n\nfunction Buffer (arg, encodingOrOffset, length) {\n if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {\n return new Buffer(arg, encodingOrOffset, length)\n }\n\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new Error(\n 'If encoding is specified then the first argument must be a string'\n )\n }\n return allocUnsafe(this, arg)\n }\n return from(this, arg, encodingOrOffset, length)\n}\n\nBuffer.poolSize = 8192 // not used by this implementation\n\n// TODO: Legacy, not needed anymore. Remove in next major version.\nBuffer._augment = function (arr) {\n arr.__proto__ = Buffer.prototype\n return arr\n}\n\nfunction from (that, value, encodingOrOffset, length) {\n if (typeof value === 'number') {\n throw new TypeError('\"value\" argument must not be a number')\n }\n\n if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {\n return fromArrayBuffer(that, value, encodingOrOffset, length)\n }\n\n if (typeof value === 'string') {\n return fromString(that, value, encodingOrOffset)\n }\n\n return fromObject(that, value)\n}\n\n/**\n * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError\n * if value is a number.\n * Buffer.from(str[, encoding])\n * Buffer.from(array)\n * Buffer.from(buffer)\n * Buffer.from(arrayBuffer[, byteOffset[, length]])\n **/\nBuffer.from = function (value, encodingOrOffset, length) {\n return from(null, value, encodingOrOffset, length)\n}\n\nif (Buffer.TYPED_ARRAY_SUPPORT) {\n Buffer.prototype.__proto__ = Uint8Array.prototype\n Buffer.__proto__ = Uint8Array\n if (typeof Symbol !== 'undefined' && Symbol.species &&\n Buffer[Symbol.species] === Buffer) {\n // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97\n Object.defineProperty(Buffer, Symbol.species, {\n value: null,\n configurable: true\n })\n }\n}\n\nfunction assertSize (size) {\n if (typeof size !== 'number') {\n throw new TypeError('\"size\" argument must be a number')\n } else if (size < 0) {\n throw new RangeError('\"size\" argument must not be negative')\n }\n}\n\nfunction alloc (that, size, fill, encoding) {\n assertSize(size)\n if (size <= 0) {\n return createBuffer(that, size)\n }\n if (fill !== undefined) {\n // Only pay attention to encoding if it's a string. This\n // prevents accidentally sending in a number that would\n // be interpretted as a start offset.\n return typeof encoding === 'string'\n ? createBuffer(that, size).fill(fill, encoding)\n : createBuffer(that, size).fill(fill)\n }\n return createBuffer(that, size)\n}\n\n/**\n * Creates a new filled Buffer instance.\n * alloc(size[, fill[, encoding]])\n **/\nBuffer.alloc = function (size, fill, encoding) {\n return alloc(null, size, fill, encoding)\n}\n\nfunction allocUnsafe (that, size) {\n assertSize(size)\n that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)\n if (!Buffer.TYPED_ARRAY_SUPPORT) {\n for (var i = 0; i < size; ++i) {\n that[i] = 0\n }\n }\n return that\n}\n\n/**\n * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.\n * */\nBuffer.allocUnsafe = function (size) {\n return allocUnsafe(null, size)\n}\n/**\n * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.\n */\nBuffer.allocUnsafeSlow = function (size) {\n return allocUnsafe(null, size)\n}\n\nfunction fromString (that, string, encoding) {\n if (typeof encoding !== 'string' || encoding === '') {\n encoding = 'utf8'\n }\n\n if (!Buffer.isEncoding(encoding)) {\n throw new TypeError('\"encoding\" must be a valid string encoding')\n }\n\n var length = byteLength(string, encoding) | 0\n that = createBuffer(that, length)\n\n var actual = that.write(string, encoding)\n\n if (actual !== length) {\n // Writing a hex string, for example, that contains invalid characters will\n // cause everything after the first invalid character to be ignored. (e.g.\n // 'abxxcd' will be treated as 'ab')\n that = that.slice(0, actual)\n }\n\n return that\n}\n\nfunction fromArrayLike (that, array) {\n var length = array.length < 0 ? 0 : checked(array.length) | 0\n that = createBuffer(that, length)\n for (var i = 0; i < length; i += 1) {\n that[i] = array[i] & 255\n }\n return that\n}\n\nfunction fromArrayBuffer (that, array, byteOffset, length) {\n array.byteLength // this throws if `array` is not a valid ArrayBuffer\n\n if (byteOffset < 0 || array.byteLength < byteOffset) {\n throw new RangeError('\\'offset\\' is out of bounds')\n }\n\n if (array.byteLength < byteOffset + (length || 0)) {\n throw new RangeError('\\'length\\' is out of bounds')\n }\n\n if (byteOffset === undefined && length === undefined) {\n array = new Uint8Array(array)\n } else if (length === undefined) {\n array = new Uint8Array(array, byteOffset)\n } else {\n array = new Uint8Array(array, byteOffset, length)\n }\n\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n // Return an augmented `Uint8Array` instance, for best performance\n that = array\n that.__proto__ = Buffer.prototype\n } else {\n // Fallback: Return an object instance of the Buffer class\n that = fromArrayLike(that, array)\n }\n return that\n}\n\nfunction fromObject (that, obj) {\n if (Buffer.isBuffer(obj)) {\n var len = checked(obj.length) | 0\n that = createBuffer(that, len)\n\n if (that.length === 0) {\n return that\n }\n\n obj.copy(that, 0, 0, len)\n return that\n }\n\n if (obj) {\n if ((typeof ArrayBuffer !== 'undefined' &&\n obj.buffer instanceof ArrayBuffer) || 'length' in obj) {\n if (typeof obj.length !== 'number' || isnan(obj.length)) {\n return createBuffer(that, 0)\n }\n return fromArrayLike(that, obj)\n }\n\n if (obj.type === 'Buffer' && isArray(obj.data)) {\n return fromArrayLike(that, obj.data)\n }\n }\n\n throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')\n}\n\nfunction checked (length) {\n // Note: cannot use `length < kMaxLength()` here because that fails when\n // length is NaN (which is otherwise coerced to zero.)\n if (length >= kMaxLength()) {\n throw new RangeError('Attempt to allocate Buffer larger than maximum ' +\n 'size: 0x' + kMaxLength().toString(16) + ' bytes')\n }\n return length | 0\n}\n\nfunction SlowBuffer (length) {\n if (+length != length) { // eslint-disable-line eqeqeq\n length = 0\n }\n return Buffer.alloc(+length)\n}\n\nBuffer.isBuffer = function isBuffer (b) {\n return !!(b != null && b._isBuffer)\n}\n\nBuffer.compare = function compare (a, b) {\n if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {\n throw new TypeError('Arguments must be Buffers')\n }\n\n if (a === b) return 0\n\n var x = a.length\n var y = b.length\n\n for (var i = 0, len = Math.min(x, y); i < len; ++i) {\n if (a[i] !== b[i]) {\n x = a[i]\n y = b[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\nBuffer.isEncoding = function isEncoding (encoding) {\n switch (String(encoding).toLowerCase()) {\n case 'hex':\n case 'utf8':\n case 'utf-8':\n case 'ascii':\n case 'latin1':\n case 'binary':\n case 'base64':\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return true\n default:\n return false\n }\n}\n\nBuffer.concat = function concat (list, length) {\n if (!isArray(list)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n }\n\n if (list.length === 0) {\n return Buffer.alloc(0)\n }\n\n var i\n if (length === undefined) {\n length = 0\n for (i = 0; i < list.length; ++i) {\n length += list[i].length\n }\n }\n\n var buffer = Buffer.allocUnsafe(length)\n var pos = 0\n for (i = 0; i < list.length; ++i) {\n var buf = list[i]\n if (!Buffer.isBuffer(buf)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n }\n buf.copy(buffer, pos)\n pos += buf.length\n }\n return buffer\n}\n\nfunction byteLength (string, encoding) {\n if (Buffer.isBuffer(string)) {\n return string.length\n }\n if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&\n (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {\n return string.byteLength\n }\n if (typeof string !== 'string') {\n string = '' + string\n }\n\n var len = string.length\n if (len === 0) return 0\n\n // Use a for loop to avoid recursion\n var loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'ascii':\n case 'latin1':\n case 'binary':\n return len\n case 'utf8':\n case 'utf-8':\n case undefined:\n return utf8ToBytes(string).length\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return len * 2\n case 'hex':\n return len >>> 1\n case 'base64':\n return base64ToBytes(string).length\n default:\n if (loweredCase) return utf8ToBytes(string).length // assume utf8\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\nBuffer.byteLength = byteLength\n\nfunction slowToString (encoding, start, end) {\n var loweredCase = false\n\n // No need to verify that \"this.length <= MAX_UINT32\" since it's a read-only\n // property of a typed array.\n\n // This behaves neither like String nor Uint8Array in that we set start/end\n // to their upper/lower bounds if the value passed is out of range.\n // undefined is handled specially as per ECMA-262 6th Edition,\n // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.\n if (start === undefined || start < 0) {\n start = 0\n }\n // Return early if start > this.length. Done here to prevent potential uint32\n // coercion fail below.\n if (start > this.length) {\n return ''\n }\n\n if (end === undefined || end > this.length) {\n end = this.length\n }\n\n if (end <= 0) {\n return ''\n }\n\n // Force coersion to uint32. This will also coerce falsey/NaN values to 0.\n end >>>= 0\n start >>>= 0\n\n if (end <= start) {\n return ''\n }\n\n if (!encoding) encoding = 'utf8'\n\n while (true) {\n switch (encoding) {\n case 'hex':\n return hexSlice(this, start, end)\n\n case 'utf8':\n case 'utf-8':\n return utf8Slice(this, start, end)\n\n case 'ascii':\n return asciiSlice(this, start, end)\n\n case 'latin1':\n case 'binary':\n return latin1Slice(this, start, end)\n\n case 'base64':\n return base64Slice(this, start, end)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return utf16leSlice(this, start, end)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = (encoding + '').toLowerCase()\n loweredCase = true\n }\n }\n}\n\n// The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect\n// Buffer instances.\nBuffer.prototype._isBuffer = true\n\nfunction swap (b, n, m) {\n var i = b[n]\n b[n] = b[m]\n b[m] = i\n}\n\nBuffer.prototype.swap16 = function swap16 () {\n var len = this.length\n if (len % 2 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 16-bits')\n }\n for (var i = 0; i < len; i += 2) {\n swap(this, i, i + 1)\n }\n return this\n}\n\nBuffer.prototype.swap32 = function swap32 () {\n var len = this.length\n if (len % 4 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 32-bits')\n }\n for (var i = 0; i < len; i += 4) {\n swap(this, i, i + 3)\n swap(this, i + 1, i + 2)\n }\n return this\n}\n\nBuffer.prototype.swap64 = function swap64 () {\n var len = this.length\n if (len % 8 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 64-bits')\n }\n for (var i = 0; i < len; i += 8) {\n swap(this, i, i + 7)\n swap(this, i + 1, i + 6)\n swap(this, i + 2, i + 5)\n swap(this, i + 3, i + 4)\n }\n return this\n}\n\nBuffer.prototype.toString = function toString () {\n var length = this.length | 0\n if (length === 0) return ''\n if (arguments.length === 0) return utf8Slice(this, 0, length)\n return slowToString.apply(this, arguments)\n}\n\nBuffer.prototype.equals = function equals (b) {\n if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')\n if (this === b) return true\n return Buffer.compare(this, b) === 0\n}\n\nBuffer.prototype.inspect = function inspect () {\n var str = ''\n var max = exports.INSPECT_MAX_BYTES\n if (this.length > 0) {\n str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')\n if (this.length > max) str += ' ... '\n }\n return ''\n}\n\nBuffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {\n if (!Buffer.isBuffer(target)) {\n throw new TypeError('Argument must be a Buffer')\n }\n\n if (start === undefined) {\n start = 0\n }\n if (end === undefined) {\n end = target ? target.length : 0\n }\n if (thisStart === undefined) {\n thisStart = 0\n }\n if (thisEnd === undefined) {\n thisEnd = this.length\n }\n\n if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {\n throw new RangeError('out of range index')\n }\n\n if (thisStart >= thisEnd && start >= end) {\n return 0\n }\n if (thisStart >= thisEnd) {\n return -1\n }\n if (start >= end) {\n return 1\n }\n\n start >>>= 0\n end >>>= 0\n thisStart >>>= 0\n thisEnd >>>= 0\n\n if (this === target) return 0\n\n var x = thisEnd - thisStart\n var y = end - start\n var len = Math.min(x, y)\n\n var thisCopy = this.slice(thisStart, thisEnd)\n var targetCopy = target.slice(start, end)\n\n for (var i = 0; i < len; ++i) {\n if (thisCopy[i] !== targetCopy[i]) {\n x = thisCopy[i]\n y = targetCopy[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\n// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,\n// OR the last index of `val` in `buffer` at offset <= `byteOffset`.\n//\n// Arguments:\n// - buffer - a Buffer to search\n// - val - a string, Buffer, or number\n// - byteOffset - an index into `buffer`; will be clamped to an int32\n// - encoding - an optional encoding, relevant is val is a string\n// - dir - true for indexOf, false for lastIndexOf\nfunction bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {\n // Empty buffer means no match\n if (buffer.length === 0) return -1\n\n // Normalize byteOffset\n if (typeof byteOffset === 'string') {\n encoding = byteOffset\n byteOffset = 0\n } else if (byteOffset > 0x7fffffff) {\n byteOffset = 0x7fffffff\n } else if (byteOffset < -0x80000000) {\n byteOffset = -0x80000000\n }\n byteOffset = +byteOffset // Coerce to Number.\n if (isNaN(byteOffset)) {\n // byteOffset: it it's undefined, null, NaN, \"foo\", etc, search whole buffer\n byteOffset = dir ? 0 : (buffer.length - 1)\n }\n\n // Normalize byteOffset: negative offsets start from the end of the buffer\n if (byteOffset < 0) byteOffset = buffer.length + byteOffset\n if (byteOffset >= buffer.length) {\n if (dir) return -1\n else byteOffset = buffer.length - 1\n } else if (byteOffset < 0) {\n if (dir) byteOffset = 0\n else return -1\n }\n\n // Normalize val\n if (typeof val === 'string') {\n val = Buffer.from(val, encoding)\n }\n\n // Finally, search either indexOf (if dir is true) or lastIndexOf\n if (Buffer.isBuffer(val)) {\n // Special case: looking for empty string/buffer always fails\n if (val.length === 0) {\n return -1\n }\n return arrayIndexOf(buffer, val, byteOffset, encoding, dir)\n } else if (typeof val === 'number') {\n val = val & 0xFF // Search for a byte value [0-255]\n if (Buffer.TYPED_ARRAY_SUPPORT &&\n typeof Uint8Array.prototype.indexOf === 'function') {\n if (dir) {\n return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)\n } else {\n return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)\n }\n }\n return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)\n }\n\n throw new TypeError('val must be string, number or Buffer')\n}\n\nfunction arrayIndexOf (arr, val, byteOffset, encoding, dir) {\n var indexSize = 1\n var arrLength = arr.length\n var valLength = val.length\n\n if (encoding !== undefined) {\n encoding = String(encoding).toLowerCase()\n if (encoding === 'ucs2' || encoding === 'ucs-2' ||\n encoding === 'utf16le' || encoding === 'utf-16le') {\n if (arr.length < 2 || val.length < 2) {\n return -1\n }\n indexSize = 2\n arrLength /= 2\n valLength /= 2\n byteOffset /= 2\n }\n }\n\n function read (buf, i) {\n if (indexSize === 1) {\n return buf[i]\n } else {\n return buf.readUInt16BE(i * indexSize)\n }\n }\n\n var i\n if (dir) {\n var foundIndex = -1\n for (i = byteOffset; i < arrLength; i++) {\n if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {\n if (foundIndex === -1) foundIndex = i\n if (i - foundIndex + 1 === valLength) return foundIndex * indexSize\n } else {\n if (foundIndex !== -1) i -= i - foundIndex\n foundIndex = -1\n }\n }\n } else {\n if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength\n for (i = byteOffset; i >= 0; i--) {\n var found = true\n for (var j = 0; j < valLength; j++) {\n if (read(arr, i + j) !== read(val, j)) {\n found = false\n break\n }\n }\n if (found) return i\n }\n }\n\n return -1\n}\n\nBuffer.prototype.includes = function includes (val, byteOffset, encoding) {\n return this.indexOf(val, byteOffset, encoding) !== -1\n}\n\nBuffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, true)\n}\n\nBuffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, false)\n}\n\nfunction hexWrite (buf, string, offset, length) {\n offset = Number(offset) || 0\n var remaining = buf.length - offset\n if (!length) {\n length = remaining\n } else {\n length = Number(length)\n if (length > remaining) {\n length = remaining\n }\n }\n\n // must be an even number of digits\n var strLen = string.length\n if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')\n\n if (length > strLen / 2) {\n length = strLen / 2\n }\n for (var i = 0; i < length; ++i) {\n var parsed = parseInt(string.substr(i * 2, 2), 16)\n if (isNaN(parsed)) return i\n buf[offset + i] = parsed\n }\n return i\n}\n\nfunction utf8Write (buf, string, offset, length) {\n return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nfunction asciiWrite (buf, string, offset, length) {\n return blitBuffer(asciiToBytes(string), buf, offset, length)\n}\n\nfunction latin1Write (buf, string, offset, length) {\n return asciiWrite(buf, string, offset, length)\n}\n\nfunction base64Write (buf, string, offset, length) {\n return blitBuffer(base64ToBytes(string), buf, offset, length)\n}\n\nfunction ucs2Write (buf, string, offset, length) {\n return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nBuffer.prototype.write = function write (string, offset, length, encoding) {\n // Buffer#write(string)\n if (offset === undefined) {\n encoding = 'utf8'\n length = this.length\n offset = 0\n // Buffer#write(string, encoding)\n } else if (length === undefined && typeof offset === 'string') {\n encoding = offset\n length = this.length\n offset = 0\n // Buffer#write(string, offset[, length][, encoding])\n } else if (isFinite(offset)) {\n offset = offset | 0\n if (isFinite(length)) {\n length = length | 0\n if (encoding === undefined) encoding = 'utf8'\n } else {\n encoding = length\n length = undefined\n }\n // legacy write(string, encoding, offset, length) - remove in v0.13\n } else {\n throw new Error(\n 'Buffer.write(string, encoding, offset[, length]) is no longer supported'\n )\n }\n\n var remaining = this.length - offset\n if (length === undefined || length > remaining) length = remaining\n\n if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {\n throw new RangeError('Attempt to write outside buffer bounds')\n }\n\n if (!encoding) encoding = 'utf8'\n\n var loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'hex':\n return hexWrite(this, string, offset, length)\n\n case 'utf8':\n case 'utf-8':\n return utf8Write(this, string, offset, length)\n\n case 'ascii':\n return asciiWrite(this, string, offset, length)\n\n case 'latin1':\n case 'binary':\n return latin1Write(this, string, offset, length)\n\n case 'base64':\n // Warning: maxLength not taken into account in base64Write\n return base64Write(this, string, offset, length)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return ucs2Write(this, string, offset, length)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\n\nBuffer.prototype.toJSON = function toJSON () {\n return {\n type: 'Buffer',\n data: Array.prototype.slice.call(this._arr || this, 0)\n }\n}\n\nfunction base64Slice (buf, start, end) {\n if (start === 0 && end === buf.length) {\n return base64.fromByteArray(buf)\n } else {\n return base64.fromByteArray(buf.slice(start, end))\n }\n}\n\nfunction utf8Slice (buf, start, end) {\n end = Math.min(buf.length, end)\n var res = []\n\n var i = start\n while (i < end) {\n var firstByte = buf[i]\n var codePoint = null\n var bytesPerSequence = (firstByte > 0xEF) ? 4\n : (firstByte > 0xDF) ? 3\n : (firstByte > 0xBF) ? 2\n : 1\n\n if (i + bytesPerSequence <= end) {\n var secondByte, thirdByte, fourthByte, tempCodePoint\n\n switch (bytesPerSequence) {\n case 1:\n if (firstByte < 0x80) {\n codePoint = firstByte\n }\n break\n case 2:\n secondByte = buf[i + 1]\n if ((secondByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)\n if (tempCodePoint > 0x7F) {\n codePoint = tempCodePoint\n }\n }\n break\n case 3:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)\n if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {\n codePoint = tempCodePoint\n }\n }\n break\n case 4:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n fourthByte = buf[i + 3]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)\n if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {\n codePoint = tempCodePoint\n }\n }\n }\n }\n\n if (codePoint === null) {\n // we did not generate a valid codePoint so insert a\n // replacement char (U+FFFD) and advance only 1 byte\n codePoint = 0xFFFD\n bytesPerSequence = 1\n } else if (codePoint > 0xFFFF) {\n // encode to utf16 (surrogate pair dance)\n codePoint -= 0x10000\n res.push(codePoint >>> 10 & 0x3FF | 0xD800)\n codePoint = 0xDC00 | codePoint & 0x3FF\n }\n\n res.push(codePoint)\n i += bytesPerSequence\n }\n\n return decodeCodePointsArray(res)\n}\n\n// Based on http://stackoverflow.com/a/22747272/680742, the browser with\n// the lowest limit is Chrome, with 0x10000 args.\n// We go 1 magnitude less, for safety\nvar MAX_ARGUMENTS_LENGTH = 0x1000\n\nfunction decodeCodePointsArray (codePoints) {\n var len = codePoints.length\n if (len <= MAX_ARGUMENTS_LENGTH) {\n return String.fromCharCode.apply(String, codePoints) // avoid extra slice()\n }\n\n // Decode in chunks to avoid \"call stack size exceeded\".\n var res = ''\n var i = 0\n while (i < len) {\n res += String.fromCharCode.apply(\n String,\n codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)\n )\n }\n return res\n}\n\nfunction asciiSlice (buf, start, end) {\n var ret = ''\n end = Math.min(buf.length, end)\n\n for (var i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i] & 0x7F)\n }\n return ret\n}\n\nfunction latin1Slice (buf, start, end) {\n var ret = ''\n end = Math.min(buf.length, end)\n\n for (var i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i])\n }\n return ret\n}\n\nfunction hexSlice (buf, start, end) {\n var len = buf.length\n\n if (!start || start < 0) start = 0\n if (!end || end < 0 || end > len) end = len\n\n var out = ''\n for (var i = start; i < end; ++i) {\n out += toHex(buf[i])\n }\n return out\n}\n\nfunction utf16leSlice (buf, start, end) {\n var bytes = buf.slice(start, end)\n var res = ''\n for (var i = 0; i < bytes.length; i += 2) {\n res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)\n }\n return res\n}\n\nBuffer.prototype.slice = function slice (start, end) {\n var len = this.length\n start = ~~start\n end = end === undefined ? len : ~~end\n\n if (start < 0) {\n start += len\n if (start < 0) start = 0\n } else if (start > len) {\n start = len\n }\n\n if (end < 0) {\n end += len\n if (end < 0) end = 0\n } else if (end > len) {\n end = len\n }\n\n if (end < start) end = start\n\n var newBuf\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n newBuf = this.subarray(start, end)\n newBuf.__proto__ = Buffer.prototype\n } else {\n var sliceLen = end - start\n newBuf = new Buffer(sliceLen, undefined)\n for (var i = 0; i < sliceLen; ++i) {\n newBuf[i] = this[i + start]\n }\n }\n\n return newBuf\n}\n\n/*\n * Need to make sure that buffer isn't trying to write out of bounds.\n */\nfunction checkOffset (offset, ext, length) {\n if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n}\n\nBuffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var val = this[offset]\n var mul = 1\n var i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n checkOffset(offset, byteLength, this.length)\n }\n\n var val = this[offset + --byteLength]\n var mul = 1\n while (byteLength > 0 && (mul *= 0x100)) {\n val += this[offset + --byteLength] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 1, this.length)\n return this[offset]\n}\n\nBuffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n return this[offset] | (this[offset + 1] << 8)\n}\n\nBuffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n return (this[offset] << 8) | this[offset + 1]\n}\n\nBuffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return ((this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16)) +\n (this[offset + 3] * 0x1000000)\n}\n\nBuffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] * 0x1000000) +\n ((this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n this[offset + 3])\n}\n\nBuffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var val = this[offset]\n var mul = 1\n var i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var i = byteLength\n var mul = 1\n var val = this[offset + --i]\n while (i > 0 && (mul *= 0x100)) {\n val += this[offset + --i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readInt8 = function readInt8 (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 1, this.length)\n if (!(this[offset] & 0x80)) return (this[offset])\n return ((0xff - this[offset] + 1) * -1)\n}\n\nBuffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n var val = this[offset] | (this[offset + 1] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n var val = this[offset + 1] | (this[offset] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16) |\n (this[offset + 3] << 24)\n}\n\nBuffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] << 24) |\n (this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n (this[offset + 3])\n}\n\nBuffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, true, 23, 4)\n}\n\nBuffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, false, 23, 4)\n}\n\nBuffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, true, 52, 8)\n}\n\nBuffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, false, 52, 8)\n}\n\nfunction checkInt (buf, value, offset, ext, max, min) {\n if (!Buffer.isBuffer(buf)) throw new TypeError('\"buffer\" argument must be a Buffer instance')\n if (value > max || value < min) throw new RangeError('\"value\" argument is out of bounds')\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n}\n\nBuffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n var maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n var mul = 1\n var i = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n var maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n var i = byteLength - 1\n var mul = 1\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)\n if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nfunction objectWriteUInt16 (buf, value, offset, littleEndian) {\n if (value < 0) value = 0xffff + value + 1\n for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {\n buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>\n (littleEndian ? i : 1 - i) * 8\n }\n}\n\nBuffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n } else {\n objectWriteUInt16(this, value, offset, true)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n } else {\n objectWriteUInt16(this, value, offset, false)\n }\n return offset + 2\n}\n\nfunction objectWriteUInt32 (buf, value, offset, littleEndian) {\n if (value < 0) value = 0xffffffff + value + 1\n for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {\n buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff\n }\n}\n\nBuffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset + 3] = (value >>> 24)\n this[offset + 2] = (value >>> 16)\n this[offset + 1] = (value >>> 8)\n this[offset] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, true)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, false)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) {\n var limit = Math.pow(2, 8 * byteLength - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n var i = 0\n var mul = 1\n var sub = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) {\n var limit = Math.pow(2, 8 * byteLength - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n var i = byteLength - 1\n var mul = 1\n var sub = 0\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)\n if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n if (value < 0) value = 0xff + value + 1\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nBuffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n } else {\n objectWriteUInt16(this, value, offset, true)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n } else {\n objectWriteUInt16(this, value, offset, false)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n this[offset + 2] = (value >>> 16)\n this[offset + 3] = (value >>> 24)\n } else {\n objectWriteUInt32(this, value, offset, true)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (value < 0) value = 0xffffffff + value + 1\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, false)\n }\n return offset + 4\n}\n\nfunction checkIEEE754 (buf, value, offset, ext, max, min) {\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n if (offset < 0) throw new RangeError('Index out of range')\n}\n\nfunction writeFloat (buf, value, offset, littleEndian, noAssert) {\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)\n }\n ieee754.write(buf, value, offset, littleEndian, 23, 4)\n return offset + 4\n}\n\nBuffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {\n return writeFloat(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {\n return writeFloat(this, value, offset, false, noAssert)\n}\n\nfunction writeDouble (buf, value, offset, littleEndian, noAssert) {\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)\n }\n ieee754.write(buf, value, offset, littleEndian, 52, 8)\n return offset + 8\n}\n\nBuffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {\n return writeDouble(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {\n return writeDouble(this, value, offset, false, noAssert)\n}\n\n// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)\nBuffer.prototype.copy = function copy (target, targetStart, start, end) {\n if (!start) start = 0\n if (!end && end !== 0) end = this.length\n if (targetStart >= target.length) targetStart = target.length\n if (!targetStart) targetStart = 0\n if (end > 0 && end < start) end = start\n\n // Copy 0 bytes; we're done\n if (end === start) return 0\n if (target.length === 0 || this.length === 0) return 0\n\n // Fatal error conditions\n if (targetStart < 0) {\n throw new RangeError('targetStart out of bounds')\n }\n if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')\n if (end < 0) throw new RangeError('sourceEnd out of bounds')\n\n // Are we oob?\n if (end > this.length) end = this.length\n if (target.length - targetStart < end - start) {\n end = target.length - targetStart + start\n }\n\n var len = end - start\n var i\n\n if (this === target && start < targetStart && targetStart < end) {\n // descending copy from end\n for (i = len - 1; i >= 0; --i) {\n target[i + targetStart] = this[i + start]\n }\n } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {\n // ascending copy from start\n for (i = 0; i < len; ++i) {\n target[i + targetStart] = this[i + start]\n }\n } else {\n Uint8Array.prototype.set.call(\n target,\n this.subarray(start, start + len),\n targetStart\n )\n }\n\n return len\n}\n\n// Usage:\n// buffer.fill(number[, offset[, end]])\n// buffer.fill(buffer[, offset[, end]])\n// buffer.fill(string[, offset[, end]][, encoding])\nBuffer.prototype.fill = function fill (val, start, end, encoding) {\n // Handle string cases:\n if (typeof val === 'string') {\n if (typeof start === 'string') {\n encoding = start\n start = 0\n end = this.length\n } else if (typeof end === 'string') {\n encoding = end\n end = this.length\n }\n if (val.length === 1) {\n var code = val.charCodeAt(0)\n if (code < 256) {\n val = code\n }\n }\n if (encoding !== undefined && typeof encoding !== 'string') {\n throw new TypeError('encoding must be a string')\n }\n if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {\n throw new TypeError('Unknown encoding: ' + encoding)\n }\n } else if (typeof val === 'number') {\n val = val & 255\n }\n\n // Invalid ranges are not set to a default, so can range check early.\n if (start < 0 || this.length < start || this.length < end) {\n throw new RangeError('Out of range index')\n }\n\n if (end <= start) {\n return this\n }\n\n start = start >>> 0\n end = end === undefined ? this.length : end >>> 0\n\n if (!val) val = 0\n\n var i\n if (typeof val === 'number') {\n for (i = start; i < end; ++i) {\n this[i] = val\n }\n } else {\n var bytes = Buffer.isBuffer(val)\n ? val\n : utf8ToBytes(new Buffer(val, encoding).toString())\n var len = bytes.length\n for (i = 0; i < end - start; ++i) {\n this[i + start] = bytes[i % len]\n }\n }\n\n return this\n}\n\n// HELPER FUNCTIONS\n// ================\n\nvar INVALID_BASE64_RE = /[^+\\/0-9A-Za-z-_]/g\n\nfunction base64clean (str) {\n // Node strips out invalid characters like \\n and \\t from the string, base64-js does not\n str = stringtrim(str).replace(INVALID_BASE64_RE, '')\n // Node converts strings with length < 2 to ''\n if (str.length < 2) return ''\n // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not\n while (str.length % 4 !== 0) {\n str = str + '='\n }\n return str\n}\n\nfunction stringtrim (str) {\n if (str.trim) return str.trim()\n return str.replace(/^\\s+|\\s+$/g, '')\n}\n\nfunction toHex (n) {\n if (n < 16) return '0' + n.toString(16)\n return n.toString(16)\n}\n\nfunction utf8ToBytes (string, units) {\n units = units || Infinity\n var codePoint\n var length = string.length\n var leadSurrogate = null\n var bytes = []\n\n for (var i = 0; i < length; ++i) {\n codePoint = string.charCodeAt(i)\n\n // is surrogate component\n if (codePoint > 0xD7FF && codePoint < 0xE000) {\n // last char was a lead\n if (!leadSurrogate) {\n // no lead yet\n if (codePoint > 0xDBFF) {\n // unexpected trail\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n } else if (i + 1 === length) {\n // unpaired lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n }\n\n // valid lead\n leadSurrogate = codePoint\n\n continue\n }\n\n // 2 leads in a row\n if (codePoint < 0xDC00) {\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n leadSurrogate = codePoint\n continue\n }\n\n // valid surrogate pair\n codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000\n } else if (leadSurrogate) {\n // valid bmp char, but last char was a lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n }\n\n leadSurrogate = null\n\n // encode utf8\n if (codePoint < 0x80) {\n if ((units -= 1) < 0) break\n bytes.push(codePoint)\n } else if (codePoint < 0x800) {\n if ((units -= 2) < 0) break\n bytes.push(\n codePoint >> 0x6 | 0xC0,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x10000) {\n if ((units -= 3) < 0) break\n bytes.push(\n codePoint >> 0xC | 0xE0,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x110000) {\n if ((units -= 4) < 0) break\n bytes.push(\n codePoint >> 0x12 | 0xF0,\n codePoint >> 0xC & 0x3F | 0x80,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else {\n throw new Error('Invalid code point')\n }\n }\n\n return bytes\n}\n\nfunction asciiToBytes (str) {\n var byteArray = []\n for (var i = 0; i < str.length; ++i) {\n // Node's code seems to be doing this and not & 0x7F..\n byteArray.push(str.charCodeAt(i) & 0xFF)\n }\n return byteArray\n}\n\nfunction utf16leToBytes (str, units) {\n var c, hi, lo\n var byteArray = []\n for (var i = 0; i < str.length; ++i) {\n if ((units -= 2) < 0) break\n\n c = str.charCodeAt(i)\n hi = c >> 8\n lo = c % 256\n byteArray.push(lo)\n byteArray.push(hi)\n }\n\n return byteArray\n}\n\nfunction base64ToBytes (str) {\n return base64.toByteArray(base64clean(str))\n}\n\nfunction blitBuffer (src, dst, offset, length) {\n for (var i = 0; i < length; ++i) {\n if ((i + offset >= dst.length) || (i >= src.length)) break\n dst[i + offset] = src[i]\n }\n return i\n}\n\nfunction isnan (val) {\n return val !== val // eslint-disable-line no-self-compare\n}\n\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ \"./node_modules/webpack/buildin/global.js\")))\n\n//# sourceURL=webpack:///./node_modules/buffer/index.js?"); +eval("/* WEBPACK VAR INJECTION */(function(global) {/*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh \n * @license MIT\n */\n/* eslint-disable no-proto */\n\n\n\nvar base64 = __webpack_require__(/*! base64-js */ \"./node_modules/base64-js/index.js\")\nvar ieee754 = __webpack_require__(/*! ieee754 */ \"./node_modules/ieee754/index.js\")\nvar isArray = __webpack_require__(/*! isarray */ \"./node_modules/isarray/index.js\")\n\nexports.Buffer = Buffer\nexports.SlowBuffer = SlowBuffer\nexports.INSPECT_MAX_BYTES = 50\n\n/**\n * If `Buffer.TYPED_ARRAY_SUPPORT`:\n * === true Use Uint8Array implementation (fastest)\n * === false Use Object implementation (most compatible, even IE6)\n *\n * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,\n * Opera 11.6+, iOS 4.2+.\n *\n * Due to various browser bugs, sometimes the Object implementation will be used even\n * when the browser supports typed arrays.\n *\n * Note:\n *\n * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,\n * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.\n *\n * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.\n *\n * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of\n * incorrect length in some situations.\n\n * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they\n * get the Object implementation, which is slower but behaves correctly.\n */\nBuffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined\n ? global.TYPED_ARRAY_SUPPORT\n : typedArraySupport()\n\n/*\n * Export kMaxLength after typed array support is determined.\n */\nexports.kMaxLength = kMaxLength()\n\nfunction typedArraySupport () {\n try {\n var arr = new Uint8Array(1)\n arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}\n return arr.foo() === 42 && // typed array instances can be augmented\n typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`\n arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`\n } catch (e) {\n return false\n }\n}\n\nfunction kMaxLength () {\n return Buffer.TYPED_ARRAY_SUPPORT\n ? 0x7fffffff\n : 0x3fffffff\n}\n\nfunction createBuffer (that, length) {\n if (kMaxLength() < length) {\n throw new RangeError('Invalid typed array length')\n }\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n // Return an augmented `Uint8Array` instance, for best performance\n that = new Uint8Array(length)\n that.__proto__ = Buffer.prototype\n } else {\n // Fallback: Return an object instance of the Buffer class\n if (that === null) {\n that = new Buffer(length)\n }\n that.length = length\n }\n\n return that\n}\n\n/**\n * The Buffer constructor returns instances of `Uint8Array` that have their\n * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of\n * `Uint8Array`, so the returned instances will have all the node `Buffer` methods\n * and the `Uint8Array` methods. Square bracket notation works as expected -- it\n * returns a single octet.\n *\n * The `Uint8Array` prototype remains unmodified.\n */\n\nfunction Buffer (arg, encodingOrOffset, length) {\n if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {\n return new Buffer(arg, encodingOrOffset, length)\n }\n\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new Error(\n 'If encoding is specified then the first argument must be a string'\n )\n }\n return allocUnsafe(this, arg)\n }\n return from(this, arg, encodingOrOffset, length)\n}\n\nBuffer.poolSize = 8192 // not used by this implementation\n\n// TODO: Legacy, not needed anymore. Remove in next major version.\nBuffer._augment = function (arr) {\n arr.__proto__ = Buffer.prototype\n return arr\n}\n\nfunction from (that, value, encodingOrOffset, length) {\n if (typeof value === 'number') {\n throw new TypeError('\"value\" argument must not be a number')\n }\n\n if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {\n return fromArrayBuffer(that, value, encodingOrOffset, length)\n }\n\n if (typeof value === 'string') {\n return fromString(that, value, encodingOrOffset)\n }\n\n return fromObject(that, value)\n}\n\n/**\n * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError\n * if value is a number.\n * Buffer.from(str[, encoding])\n * Buffer.from(array)\n * Buffer.from(buffer)\n * Buffer.from(arrayBuffer[, byteOffset[, length]])\n **/\nBuffer.from = function (value, encodingOrOffset, length) {\n return from(null, value, encodingOrOffset, length)\n}\n\nif (Buffer.TYPED_ARRAY_SUPPORT) {\n Buffer.prototype.__proto__ = Uint8Array.prototype\n Buffer.__proto__ = Uint8Array\n if (typeof Symbol !== 'undefined' && Symbol.species &&\n Buffer[Symbol.species] === Buffer) {\n // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97\n Object.defineProperty(Buffer, Symbol.species, {\n value: null,\n configurable: true\n })\n }\n}\n\nfunction assertSize (size) {\n if (typeof size !== 'number') {\n throw new TypeError('\"size\" argument must be a number')\n } else if (size < 0) {\n throw new RangeError('\"size\" argument must not be negative')\n }\n}\n\nfunction alloc (that, size, fill, encoding) {\n assertSize(size)\n if (size <= 0) {\n return createBuffer(that, size)\n }\n if (fill !== undefined) {\n // Only pay attention to encoding if it's a string. This\n // prevents accidentally sending in a number that would\n // be interpretted as a start offset.\n return typeof encoding === 'string'\n ? createBuffer(that, size).fill(fill, encoding)\n : createBuffer(that, size).fill(fill)\n }\n return createBuffer(that, size)\n}\n\n/**\n * Creates a new filled Buffer instance.\n * alloc(size[, fill[, encoding]])\n **/\nBuffer.alloc = function (size, fill, encoding) {\n return alloc(null, size, fill, encoding)\n}\n\nfunction allocUnsafe (that, size) {\n assertSize(size)\n that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)\n if (!Buffer.TYPED_ARRAY_SUPPORT) {\n for (var i = 0; i < size; ++i) {\n that[i] = 0\n }\n }\n return that\n}\n\n/**\n * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.\n * */\nBuffer.allocUnsafe = function (size) {\n return allocUnsafe(null, size)\n}\n/**\n * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.\n */\nBuffer.allocUnsafeSlow = function (size) {\n return allocUnsafe(null, size)\n}\n\nfunction fromString (that, string, encoding) {\n if (typeof encoding !== 'string' || encoding === '') {\n encoding = 'utf8'\n }\n\n if (!Buffer.isEncoding(encoding)) {\n throw new TypeError('\"encoding\" must be a valid string encoding')\n }\n\n var length = byteLength(string, encoding) | 0\n that = createBuffer(that, length)\n\n var actual = that.write(string, encoding)\n\n if (actual !== length) {\n // Writing a hex string, for example, that contains invalid characters will\n // cause everything after the first invalid character to be ignored. (e.g.\n // 'abxxcd' will be treated as 'ab')\n that = that.slice(0, actual)\n }\n\n return that\n}\n\nfunction fromArrayLike (that, array) {\n var length = array.length < 0 ? 0 : checked(array.length) | 0\n that = createBuffer(that, length)\n for (var i = 0; i < length; i += 1) {\n that[i] = array[i] & 255\n }\n return that\n}\n\nfunction fromArrayBuffer (that, array, byteOffset, length) {\n array.byteLength // this throws if `array` is not a valid ArrayBuffer\n\n if (byteOffset < 0 || array.byteLength < byteOffset) {\n throw new RangeError('\\'offset\\' is out of bounds')\n }\n\n if (array.byteLength < byteOffset + (length || 0)) {\n throw new RangeError('\\'length\\' is out of bounds')\n }\n\n if (byteOffset === undefined && length === undefined) {\n array = new Uint8Array(array)\n } else if (length === undefined) {\n array = new Uint8Array(array, byteOffset)\n } else {\n array = new Uint8Array(array, byteOffset, length)\n }\n\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n // Return an augmented `Uint8Array` instance, for best performance\n that = array\n that.__proto__ = Buffer.prototype\n } else {\n // Fallback: Return an object instance of the Buffer class\n that = fromArrayLike(that, array)\n }\n return that\n}\n\nfunction fromObject (that, obj) {\n if (Buffer.isBuffer(obj)) {\n var len = checked(obj.length) | 0\n that = createBuffer(that, len)\n\n if (that.length === 0) {\n return that\n }\n\n obj.copy(that, 0, 0, len)\n return that\n }\n\n if (obj) {\n if ((typeof ArrayBuffer !== 'undefined' &&\n obj.buffer instanceof ArrayBuffer) || 'length' in obj) {\n if (typeof obj.length !== 'number' || isnan(obj.length)) {\n return createBuffer(that, 0)\n }\n return fromArrayLike(that, obj)\n }\n\n if (obj.type === 'Buffer' && isArray(obj.data)) {\n return fromArrayLike(that, obj.data)\n }\n }\n\n throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')\n}\n\nfunction checked (length) {\n // Note: cannot use `length < kMaxLength()` here because that fails when\n // length is NaN (which is otherwise coerced to zero.)\n if (length >= kMaxLength()) {\n throw new RangeError('Attempt to allocate Buffer larger than maximum ' +\n 'size: 0x' + kMaxLength().toString(16) + ' bytes')\n }\n return length | 0\n}\n\nfunction SlowBuffer (length) {\n if (+length != length) { // eslint-disable-line eqeqeq\n length = 0\n }\n return Buffer.alloc(+length)\n}\n\nBuffer.isBuffer = function isBuffer (b) {\n return !!(b != null && b._isBuffer)\n}\n\nBuffer.compare = function compare (a, b) {\n if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {\n throw new TypeError('Arguments must be Buffers')\n }\n\n if (a === b) return 0\n\n var x = a.length\n var y = b.length\n\n for (var i = 0, len = Math.min(x, y); i < len; ++i) {\n if (a[i] !== b[i]) {\n x = a[i]\n y = b[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\nBuffer.isEncoding = function isEncoding (encoding) {\n switch (String(encoding).toLowerCase()) {\n case 'hex':\n case 'utf8':\n case 'utf-8':\n case 'ascii':\n case 'latin1':\n case 'binary':\n case 'base64':\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return true\n default:\n return false\n }\n}\n\nBuffer.concat = function concat (list, length) {\n if (!isArray(list)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n }\n\n if (list.length === 0) {\n return Buffer.alloc(0)\n }\n\n var i\n if (length === undefined) {\n length = 0\n for (i = 0; i < list.length; ++i) {\n length += list[i].length\n }\n }\n\n var buffer = Buffer.allocUnsafe(length)\n var pos = 0\n for (i = 0; i < list.length; ++i) {\n var buf = list[i]\n if (!Buffer.isBuffer(buf)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n }\n buf.copy(buffer, pos)\n pos += buf.length\n }\n return buffer\n}\n\nfunction byteLength (string, encoding) {\n if (Buffer.isBuffer(string)) {\n return string.length\n }\n if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&\n (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {\n return string.byteLength\n }\n if (typeof string !== 'string') {\n string = '' + string\n }\n\n var len = string.length\n if (len === 0) return 0\n\n // Use a for loop to avoid recursion\n var loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'ascii':\n case 'latin1':\n case 'binary':\n return len\n case 'utf8':\n case 'utf-8':\n case undefined:\n return utf8ToBytes(string).length\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return len * 2\n case 'hex':\n return len >>> 1\n case 'base64':\n return base64ToBytes(string).length\n default:\n if (loweredCase) return utf8ToBytes(string).length // assume utf8\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\nBuffer.byteLength = byteLength\n\nfunction slowToString (encoding, start, end) {\n var loweredCase = false\n\n // No need to verify that \"this.length <= MAX_UINT32\" since it's a read-only\n // property of a typed array.\n\n // This behaves neither like String nor Uint8Array in that we set start/end\n // to their upper/lower bounds if the value passed is out of range.\n // undefined is handled specially as per ECMA-262 6th Edition,\n // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.\n if (start === undefined || start < 0) {\n start = 0\n }\n // Return early if start > this.length. Done here to prevent potential uint32\n // coercion fail below.\n if (start > this.length) {\n return ''\n }\n\n if (end === undefined || end > this.length) {\n end = this.length\n }\n\n if (end <= 0) {\n return ''\n }\n\n // Force coersion to uint32. This will also coerce falsey/NaN values to 0.\n end >>>= 0\n start >>>= 0\n\n if (end <= start) {\n return ''\n }\n\n if (!encoding) encoding = 'utf8'\n\n while (true) {\n switch (encoding) {\n case 'hex':\n return hexSlice(this, start, end)\n\n case 'utf8':\n case 'utf-8':\n return utf8Slice(this, start, end)\n\n case 'ascii':\n return asciiSlice(this, start, end)\n\n case 'latin1':\n case 'binary':\n return latin1Slice(this, start, end)\n\n case 'base64':\n return base64Slice(this, start, end)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return utf16leSlice(this, start, end)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = (encoding + '').toLowerCase()\n loweredCase = true\n }\n }\n}\n\n// The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect\n// Buffer instances.\nBuffer.prototype._isBuffer = true\n\nfunction swap (b, n, m) {\n var i = b[n]\n b[n] = b[m]\n b[m] = i\n}\n\nBuffer.prototype.swap16 = function swap16 () {\n var len = this.length\n if (len % 2 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 16-bits')\n }\n for (var i = 0; i < len; i += 2) {\n swap(this, i, i + 1)\n }\n return this\n}\n\nBuffer.prototype.swap32 = function swap32 () {\n var len = this.length\n if (len % 4 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 32-bits')\n }\n for (var i = 0; i < len; i += 4) {\n swap(this, i, i + 3)\n swap(this, i + 1, i + 2)\n }\n return this\n}\n\nBuffer.prototype.swap64 = function swap64 () {\n var len = this.length\n if (len % 8 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 64-bits')\n }\n for (var i = 0; i < len; i += 8) {\n swap(this, i, i + 7)\n swap(this, i + 1, i + 6)\n swap(this, i + 2, i + 5)\n swap(this, i + 3, i + 4)\n }\n return this\n}\n\nBuffer.prototype.toString = function toString () {\n var length = this.length | 0\n if (length === 0) return ''\n if (arguments.length === 0) return utf8Slice(this, 0, length)\n return slowToString.apply(this, arguments)\n}\n\nBuffer.prototype.equals = function equals (b) {\n if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')\n if (this === b) return true\n return Buffer.compare(this, b) === 0\n}\n\nBuffer.prototype.inspect = function inspect () {\n var str = ''\n var max = exports.INSPECT_MAX_BYTES\n if (this.length > 0) {\n str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')\n if (this.length > max) str += ' ... '\n }\n return ''\n}\n\nBuffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {\n if (!Buffer.isBuffer(target)) {\n throw new TypeError('Argument must be a Buffer')\n }\n\n if (start === undefined) {\n start = 0\n }\n if (end === undefined) {\n end = target ? target.length : 0\n }\n if (thisStart === undefined) {\n thisStart = 0\n }\n if (thisEnd === undefined) {\n thisEnd = this.length\n }\n\n if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {\n throw new RangeError('out of range index')\n }\n\n if (thisStart >= thisEnd && start >= end) {\n return 0\n }\n if (thisStart >= thisEnd) {\n return -1\n }\n if (start >= end) {\n return 1\n }\n\n start >>>= 0\n end >>>= 0\n thisStart >>>= 0\n thisEnd >>>= 0\n\n if (this === target) return 0\n\n var x = thisEnd - thisStart\n var y = end - start\n var len = Math.min(x, y)\n\n var thisCopy = this.slice(thisStart, thisEnd)\n var targetCopy = target.slice(start, end)\n\n for (var i = 0; i < len; ++i) {\n if (thisCopy[i] !== targetCopy[i]) {\n x = thisCopy[i]\n y = targetCopy[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\n// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,\n// OR the last index of `val` in `buffer` at offset <= `byteOffset`.\n//\n// Arguments:\n// - buffer - a Buffer to search\n// - val - a string, Buffer, or number\n// - byteOffset - an index into `buffer`; will be clamped to an int32\n// - encoding - an optional encoding, relevant is val is a string\n// - dir - true for indexOf, false for lastIndexOf\nfunction bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {\n // Empty buffer means no match\n if (buffer.length === 0) return -1\n\n // Normalize byteOffset\n if (typeof byteOffset === 'string') {\n encoding = byteOffset\n byteOffset = 0\n } else if (byteOffset > 0x7fffffff) {\n byteOffset = 0x7fffffff\n } else if (byteOffset < -0x80000000) {\n byteOffset = -0x80000000\n }\n byteOffset = +byteOffset // Coerce to Number.\n if (isNaN(byteOffset)) {\n // byteOffset: it it's undefined, null, NaN, \"foo\", etc, search whole buffer\n byteOffset = dir ? 0 : (buffer.length - 1)\n }\n\n // Normalize byteOffset: negative offsets start from the end of the buffer\n if (byteOffset < 0) byteOffset = buffer.length + byteOffset\n if (byteOffset >= buffer.length) {\n if (dir) return -1\n else byteOffset = buffer.length - 1\n } else if (byteOffset < 0) {\n if (dir) byteOffset = 0\n else return -1\n }\n\n // Normalize val\n if (typeof val === 'string') {\n val = Buffer.from(val, encoding)\n }\n\n // Finally, search either indexOf (if dir is true) or lastIndexOf\n if (Buffer.isBuffer(val)) {\n // Special case: looking for empty string/buffer always fails\n if (val.length === 0) {\n return -1\n }\n return arrayIndexOf(buffer, val, byteOffset, encoding, dir)\n } else if (typeof val === 'number') {\n val = val & 0xFF // Search for a byte value [0-255]\n if (Buffer.TYPED_ARRAY_SUPPORT &&\n typeof Uint8Array.prototype.indexOf === 'function') {\n if (dir) {\n return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)\n } else {\n return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)\n }\n }\n return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)\n }\n\n throw new TypeError('val must be string, number or Buffer')\n}\n\nfunction arrayIndexOf (arr, val, byteOffset, encoding, dir) {\n var indexSize = 1\n var arrLength = arr.length\n var valLength = val.length\n\n if (encoding !== undefined) {\n encoding = String(encoding).toLowerCase()\n if (encoding === 'ucs2' || encoding === 'ucs-2' ||\n encoding === 'utf16le' || encoding === 'utf-16le') {\n if (arr.length < 2 || val.length < 2) {\n return -1\n }\n indexSize = 2\n arrLength /= 2\n valLength /= 2\n byteOffset /= 2\n }\n }\n\n function read (buf, i) {\n if (indexSize === 1) {\n return buf[i]\n } else {\n return buf.readUInt16BE(i * indexSize)\n }\n }\n\n var i\n if (dir) {\n var foundIndex = -1\n for (i = byteOffset; i < arrLength; i++) {\n if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {\n if (foundIndex === -1) foundIndex = i\n if (i - foundIndex + 1 === valLength) return foundIndex * indexSize\n } else {\n if (foundIndex !== -1) i -= i - foundIndex\n foundIndex = -1\n }\n }\n } else {\n if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength\n for (i = byteOffset; i >= 0; i--) {\n var found = true\n for (var j = 0; j < valLength; j++) {\n if (read(arr, i + j) !== read(val, j)) {\n found = false\n break\n }\n }\n if (found) return i\n }\n }\n\n return -1\n}\n\nBuffer.prototype.includes = function includes (val, byteOffset, encoding) {\n return this.indexOf(val, byteOffset, encoding) !== -1\n}\n\nBuffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, true)\n}\n\nBuffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, false)\n}\n\nfunction hexWrite (buf, string, offset, length) {\n offset = Number(offset) || 0\n var remaining = buf.length - offset\n if (!length) {\n length = remaining\n } else {\n length = Number(length)\n if (length > remaining) {\n length = remaining\n }\n }\n\n // must be an even number of digits\n var strLen = string.length\n if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')\n\n if (length > strLen / 2) {\n length = strLen / 2\n }\n for (var i = 0; i < length; ++i) {\n var parsed = parseInt(string.substr(i * 2, 2), 16)\n if (isNaN(parsed)) return i\n buf[offset + i] = parsed\n }\n return i\n}\n\nfunction utf8Write (buf, string, offset, length) {\n return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nfunction asciiWrite (buf, string, offset, length) {\n return blitBuffer(asciiToBytes(string), buf, offset, length)\n}\n\nfunction latin1Write (buf, string, offset, length) {\n return asciiWrite(buf, string, offset, length)\n}\n\nfunction base64Write (buf, string, offset, length) {\n return blitBuffer(base64ToBytes(string), buf, offset, length)\n}\n\nfunction ucs2Write (buf, string, offset, length) {\n return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nBuffer.prototype.write = function write (string, offset, length, encoding) {\n // Buffer#write(string)\n if (offset === undefined) {\n encoding = 'utf8'\n length = this.length\n offset = 0\n // Buffer#write(string, encoding)\n } else if (length === undefined && typeof offset === 'string') {\n encoding = offset\n length = this.length\n offset = 0\n // Buffer#write(string, offset[, length][, encoding])\n } else if (isFinite(offset)) {\n offset = offset | 0\n if (isFinite(length)) {\n length = length | 0\n if (encoding === undefined) encoding = 'utf8'\n } else {\n encoding = length\n length = undefined\n }\n // legacy write(string, encoding, offset, length) - remove in v0.13\n } else {\n throw new Error(\n 'Buffer.write(string, encoding, offset[, length]) is no longer supported'\n )\n }\n\n var remaining = this.length - offset\n if (length === undefined || length > remaining) length = remaining\n\n if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {\n throw new RangeError('Attempt to write outside buffer bounds')\n }\n\n if (!encoding) encoding = 'utf8'\n\n var loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'hex':\n return hexWrite(this, string, offset, length)\n\n case 'utf8':\n case 'utf-8':\n return utf8Write(this, string, offset, length)\n\n case 'ascii':\n return asciiWrite(this, string, offset, length)\n\n case 'latin1':\n case 'binary':\n return latin1Write(this, string, offset, length)\n\n case 'base64':\n // Warning: maxLength not taken into account in base64Write\n return base64Write(this, string, offset, length)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return ucs2Write(this, string, offset, length)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\n\nBuffer.prototype.toJSON = function toJSON () {\n return {\n type: 'Buffer',\n data: Array.prototype.slice.call(this._arr || this, 0)\n }\n}\n\nfunction base64Slice (buf, start, end) {\n if (start === 0 && end === buf.length) {\n return base64.fromByteArray(buf)\n } else {\n return base64.fromByteArray(buf.slice(start, end))\n }\n}\n\nfunction utf8Slice (buf, start, end) {\n end = Math.min(buf.length, end)\n var res = []\n\n var i = start\n while (i < end) {\n var firstByte = buf[i]\n var codePoint = null\n var bytesPerSequence = (firstByte > 0xEF) ? 4\n : (firstByte > 0xDF) ? 3\n : (firstByte > 0xBF) ? 2\n : 1\n\n if (i + bytesPerSequence <= end) {\n var secondByte, thirdByte, fourthByte, tempCodePoint\n\n switch (bytesPerSequence) {\n case 1:\n if (firstByte < 0x80) {\n codePoint = firstByte\n }\n break\n case 2:\n secondByte = buf[i + 1]\n if ((secondByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)\n if (tempCodePoint > 0x7F) {\n codePoint = tempCodePoint\n }\n }\n break\n case 3:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)\n if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {\n codePoint = tempCodePoint\n }\n }\n break\n case 4:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n fourthByte = buf[i + 3]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)\n if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {\n codePoint = tempCodePoint\n }\n }\n }\n }\n\n if (codePoint === null) {\n // we did not generate a valid codePoint so insert a\n // replacement char (U+FFFD) and advance only 1 byte\n codePoint = 0xFFFD\n bytesPerSequence = 1\n } else if (codePoint > 0xFFFF) {\n // encode to utf16 (surrogate pair dance)\n codePoint -= 0x10000\n res.push(codePoint >>> 10 & 0x3FF | 0xD800)\n codePoint = 0xDC00 | codePoint & 0x3FF\n }\n\n res.push(codePoint)\n i += bytesPerSequence\n }\n\n return decodeCodePointsArray(res)\n}\n\n// Based on http://stackoverflow.com/a/22747272/680742, the browser with\n// the lowest limit is Chrome, with 0x10000 args.\n// We go 1 magnitude less, for safety\nvar MAX_ARGUMENTS_LENGTH = 0x1000\n\nfunction decodeCodePointsArray (codePoints) {\n var len = codePoints.length\n if (len <= MAX_ARGUMENTS_LENGTH) {\n return String.fromCharCode.apply(String, codePoints) // avoid extra slice()\n }\n\n // Decode in chunks to avoid \"call stack size exceeded\".\n var res = ''\n var i = 0\n while (i < len) {\n res += String.fromCharCode.apply(\n String,\n codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)\n )\n }\n return res\n}\n\nfunction asciiSlice (buf, start, end) {\n var ret = ''\n end = Math.min(buf.length, end)\n\n for (var i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i] & 0x7F)\n }\n return ret\n}\n\nfunction latin1Slice (buf, start, end) {\n var ret = ''\n end = Math.min(buf.length, end)\n\n for (var i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i])\n }\n return ret\n}\n\nfunction hexSlice (buf, start, end) {\n var len = buf.length\n\n if (!start || start < 0) start = 0\n if (!end || end < 0 || end > len) end = len\n\n var out = ''\n for (var i = start; i < end; ++i) {\n out += toHex(buf[i])\n }\n return out\n}\n\nfunction utf16leSlice (buf, start, end) {\n var bytes = buf.slice(start, end)\n var res = ''\n for (var i = 0; i < bytes.length; i += 2) {\n res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)\n }\n return res\n}\n\nBuffer.prototype.slice = function slice (start, end) {\n var len = this.length\n start = ~~start\n end = end === undefined ? len : ~~end\n\n if (start < 0) {\n start += len\n if (start < 0) start = 0\n } else if (start > len) {\n start = len\n }\n\n if (end < 0) {\n end += len\n if (end < 0) end = 0\n } else if (end > len) {\n end = len\n }\n\n if (end < start) end = start\n\n var newBuf\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n newBuf = this.subarray(start, end)\n newBuf.__proto__ = Buffer.prototype\n } else {\n var sliceLen = end - start\n newBuf = new Buffer(sliceLen, undefined)\n for (var i = 0; i < sliceLen; ++i) {\n newBuf[i] = this[i + start]\n }\n }\n\n return newBuf\n}\n\n/*\n * Need to make sure that buffer isn't trying to write out of bounds.\n */\nfunction checkOffset (offset, ext, length) {\n if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n}\n\nBuffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var val = this[offset]\n var mul = 1\n var i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n checkOffset(offset, byteLength, this.length)\n }\n\n var val = this[offset + --byteLength]\n var mul = 1\n while (byteLength > 0 && (mul *= 0x100)) {\n val += this[offset + --byteLength] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 1, this.length)\n return this[offset]\n}\n\nBuffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n return this[offset] | (this[offset + 1] << 8)\n}\n\nBuffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n return (this[offset] << 8) | this[offset + 1]\n}\n\nBuffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return ((this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16)) +\n (this[offset + 3] * 0x1000000)\n}\n\nBuffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] * 0x1000000) +\n ((this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n this[offset + 3])\n}\n\nBuffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var val = this[offset]\n var mul = 1\n var i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var i = byteLength\n var mul = 1\n var val = this[offset + --i]\n while (i > 0 && (mul *= 0x100)) {\n val += this[offset + --i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readInt8 = function readInt8 (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 1, this.length)\n if (!(this[offset] & 0x80)) return (this[offset])\n return ((0xff - this[offset] + 1) * -1)\n}\n\nBuffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n var val = this[offset] | (this[offset + 1] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n var val = this[offset + 1] | (this[offset] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16) |\n (this[offset + 3] << 24)\n}\n\nBuffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] << 24) |\n (this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n (this[offset + 3])\n}\n\nBuffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, true, 23, 4)\n}\n\nBuffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, false, 23, 4)\n}\n\nBuffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, true, 52, 8)\n}\n\nBuffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, false, 52, 8)\n}\n\nfunction checkInt (buf, value, offset, ext, max, min) {\n if (!Buffer.isBuffer(buf)) throw new TypeError('\"buffer\" argument must be a Buffer instance')\n if (value > max || value < min) throw new RangeError('\"value\" argument is out of bounds')\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n}\n\nBuffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n var maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n var mul = 1\n var i = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n var maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n var i = byteLength - 1\n var mul = 1\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)\n if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nfunction objectWriteUInt16 (buf, value, offset, littleEndian) {\n if (value < 0) value = 0xffff + value + 1\n for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {\n buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>\n (littleEndian ? i : 1 - i) * 8\n }\n}\n\nBuffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n } else {\n objectWriteUInt16(this, value, offset, true)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n } else {\n objectWriteUInt16(this, value, offset, false)\n }\n return offset + 2\n}\n\nfunction objectWriteUInt32 (buf, value, offset, littleEndian) {\n if (value < 0) value = 0xffffffff + value + 1\n for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {\n buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff\n }\n}\n\nBuffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset + 3] = (value >>> 24)\n this[offset + 2] = (value >>> 16)\n this[offset + 1] = (value >>> 8)\n this[offset] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, true)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, false)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) {\n var limit = Math.pow(2, 8 * byteLength - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n var i = 0\n var mul = 1\n var sub = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) {\n var limit = Math.pow(2, 8 * byteLength - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n var i = byteLength - 1\n var mul = 1\n var sub = 0\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)\n if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n if (value < 0) value = 0xff + value + 1\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nBuffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n } else {\n objectWriteUInt16(this, value, offset, true)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n } else {\n objectWriteUInt16(this, value, offset, false)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n this[offset + 2] = (value >>> 16)\n this[offset + 3] = (value >>> 24)\n } else {\n objectWriteUInt32(this, value, offset, true)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (value < 0) value = 0xffffffff + value + 1\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, false)\n }\n return offset + 4\n}\n\nfunction checkIEEE754 (buf, value, offset, ext, max, min) {\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n if (offset < 0) throw new RangeError('Index out of range')\n}\n\nfunction writeFloat (buf, value, offset, littleEndian, noAssert) {\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)\n }\n ieee754.write(buf, value, offset, littleEndian, 23, 4)\n return offset + 4\n}\n\nBuffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {\n return writeFloat(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {\n return writeFloat(this, value, offset, false, noAssert)\n}\n\nfunction writeDouble (buf, value, offset, littleEndian, noAssert) {\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)\n }\n ieee754.write(buf, value, offset, littleEndian, 52, 8)\n return offset + 8\n}\n\nBuffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {\n return writeDouble(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {\n return writeDouble(this, value, offset, false, noAssert)\n}\n\n// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)\nBuffer.prototype.copy = function copy (target, targetStart, start, end) {\n if (!start) start = 0\n if (!end && end !== 0) end = this.length\n if (targetStart >= target.length) targetStart = target.length\n if (!targetStart) targetStart = 0\n if (end > 0 && end < start) end = start\n\n // Copy 0 bytes; we're done\n if (end === start) return 0\n if (target.length === 0 || this.length === 0) return 0\n\n // Fatal error conditions\n if (targetStart < 0) {\n throw new RangeError('targetStart out of bounds')\n }\n if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')\n if (end < 0) throw new RangeError('sourceEnd out of bounds')\n\n // Are we oob?\n if (end > this.length) end = this.length\n if (target.length - targetStart < end - start) {\n end = target.length - targetStart + start\n }\n\n var len = end - start\n var i\n\n if (this === target && start < targetStart && targetStart < end) {\n // descending copy from end\n for (i = len - 1; i >= 0; --i) {\n target[i + targetStart] = this[i + start]\n }\n } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {\n // ascending copy from start\n for (i = 0; i < len; ++i) {\n target[i + targetStart] = this[i + start]\n }\n } else {\n Uint8Array.prototype.set.call(\n target,\n this.subarray(start, start + len),\n targetStart\n )\n }\n\n return len\n}\n\n// Usage:\n// buffer.fill(number[, offset[, end]])\n// buffer.fill(buffer[, offset[, end]])\n// buffer.fill(string[, offset[, end]][, encoding])\nBuffer.prototype.fill = function fill (val, start, end, encoding) {\n // Handle string cases:\n if (typeof val === 'string') {\n if (typeof start === 'string') {\n encoding = start\n start = 0\n end = this.length\n } else if (typeof end === 'string') {\n encoding = end\n end = this.length\n }\n if (val.length === 1) {\n var code = val.charCodeAt(0)\n if (code < 256) {\n val = code\n }\n }\n if (encoding !== undefined && typeof encoding !== 'string') {\n throw new TypeError('encoding must be a string')\n }\n if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {\n throw new TypeError('Unknown encoding: ' + encoding)\n }\n } else if (typeof val === 'number') {\n val = val & 255\n }\n\n // Invalid ranges are not set to a default, so can range check early.\n if (start < 0 || this.length < start || this.length < end) {\n throw new RangeError('Out of range index')\n }\n\n if (end <= start) {\n return this\n }\n\n start = start >>> 0\n end = end === undefined ? this.length : end >>> 0\n\n if (!val) val = 0\n\n var i\n if (typeof val === 'number') {\n for (i = start; i < end; ++i) {\n this[i] = val\n }\n } else {\n var bytes = Buffer.isBuffer(val)\n ? val\n : utf8ToBytes(new Buffer(val, encoding).toString())\n var len = bytes.length\n for (i = 0; i < end - start; ++i) {\n this[i + start] = bytes[i % len]\n }\n }\n\n return this\n}\n\n// HELPER FUNCTIONS\n// ================\n\nvar INVALID_BASE64_RE = /[^+\\/0-9A-Za-z-_]/g\n\nfunction base64clean (str) {\n // Node strips out invalid characters like \\n and \\t from the string, base64-js does not\n str = stringtrim(str).replace(INVALID_BASE64_RE, '')\n // Node converts strings with length < 2 to ''\n if (str.length < 2) return ''\n // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not\n while (str.length % 4 !== 0) {\n str = str + '='\n }\n return str\n}\n\nfunction stringtrim (str) {\n if (str.trim) return str.trim()\n return str.replace(/^\\s+|\\s+$/g, '')\n}\n\nfunction toHex (n) {\n if (n < 16) return '0' + n.toString(16)\n return n.toString(16)\n}\n\nfunction utf8ToBytes (string, units) {\n units = units || Infinity\n var codePoint\n var length = string.length\n var leadSurrogate = null\n var bytes = []\n\n for (var i = 0; i < length; ++i) {\n codePoint = string.charCodeAt(i)\n\n // is surrogate component\n if (codePoint > 0xD7FF && codePoint < 0xE000) {\n // last char was a lead\n if (!leadSurrogate) {\n // no lead yet\n if (codePoint > 0xDBFF) {\n // unexpected trail\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n } else if (i + 1 === length) {\n // unpaired lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n }\n\n // valid lead\n leadSurrogate = codePoint\n\n continue\n }\n\n // 2 leads in a row\n if (codePoint < 0xDC00) {\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n leadSurrogate = codePoint\n continue\n }\n\n // valid surrogate pair\n codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000\n } else if (leadSurrogate) {\n // valid bmp char, but last char was a lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n }\n\n leadSurrogate = null\n\n // encode utf8\n if (codePoint < 0x80) {\n if ((units -= 1) < 0) break\n bytes.push(codePoint)\n } else if (codePoint < 0x800) {\n if ((units -= 2) < 0) break\n bytes.push(\n codePoint >> 0x6 | 0xC0,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x10000) {\n if ((units -= 3) < 0) break\n bytes.push(\n codePoint >> 0xC | 0xE0,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x110000) {\n if ((units -= 4) < 0) break\n bytes.push(\n codePoint >> 0x12 | 0xF0,\n codePoint >> 0xC & 0x3F | 0x80,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else {\n throw new Error('Invalid code point')\n }\n }\n\n return bytes\n}\n\nfunction asciiToBytes (str) {\n var byteArray = []\n for (var i = 0; i < str.length; ++i) {\n // Node's code seems to be doing this and not & 0x7F..\n byteArray.push(str.charCodeAt(i) & 0xFF)\n }\n return byteArray\n}\n\nfunction utf16leToBytes (str, units) {\n var c, hi, lo\n var byteArray = []\n for (var i = 0; i < str.length; ++i) {\n if ((units -= 2) < 0) break\n\n c = str.charCodeAt(i)\n hi = c >> 8\n lo = c % 256\n byteArray.push(lo)\n byteArray.push(hi)\n }\n\n return byteArray\n}\n\nfunction base64ToBytes (str) {\n return base64.toByteArray(base64clean(str))\n}\n\nfunction blitBuffer (src, dst, offset, length) {\n for (var i = 0; i < length; ++i) {\n if ((i + offset >= dst.length) || (i >= src.length)) break\n dst[i + offset] = src[i]\n }\n return i\n}\n\nfunction isnan (val) {\n return val !== val // eslint-disable-line no-self-compare\n}\n\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ \"./node_modules/webpack/buildin/global.js\")))\n\n//# sourceURL=webpack:///./node_modules/buffer/index.js?"); /***/ }), @@ -133,7 +133,7 @@ eval("/* WEBPACK VAR INJECTION */(function(global) {/*!\n * The buffer module fr /***/ (function(module, exports, __webpack_require__) { "use strict"; -eval("// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n\n\nvar R = typeof Reflect === 'object' ? Reflect : null\nvar ReflectApply = R && typeof R.apply === 'function'\n ? R.apply\n : function ReflectApply(target, receiver, args) {\n return Function.prototype.apply.call(target, receiver, args);\n }\n\nvar ReflectOwnKeys\nif (R && typeof R.ownKeys === 'function') {\n ReflectOwnKeys = R.ownKeys\n} else if (Object.getOwnPropertySymbols) {\n ReflectOwnKeys = function ReflectOwnKeys(target) {\n return Object.getOwnPropertyNames(target)\n .concat(Object.getOwnPropertySymbols(target));\n };\n} else {\n ReflectOwnKeys = function ReflectOwnKeys(target) {\n return Object.getOwnPropertyNames(target);\n };\n}\n\nfunction ProcessEmitWarning(warning) {\n if (console && console.warn) console.warn(warning);\n}\n\nvar NumberIsNaN = Number.isNaN || function NumberIsNaN(value) {\n return value !== value;\n}\n\nfunction EventEmitter() {\n EventEmitter.init.call(this);\n}\nmodule.exports = EventEmitter;\n\n// Backwards-compat with node 0.10.x\nEventEmitter.EventEmitter = EventEmitter;\n\nEventEmitter.prototype._events = undefined;\nEventEmitter.prototype._eventsCount = 0;\nEventEmitter.prototype._maxListeners = undefined;\n\n// By default EventEmitters will print a warning if more than 10 listeners are\n// added to it. This is a useful default which helps finding memory leaks.\nvar defaultMaxListeners = 10;\n\nObject.defineProperty(EventEmitter, 'defaultMaxListeners', {\n enumerable: true,\n get: function() {\n return defaultMaxListeners;\n },\n set: function(arg) {\n if (typeof arg !== 'number' || arg < 0 || NumberIsNaN(arg)) {\n throw new RangeError('The value of \"defaultMaxListeners\" is out of range. It must be a non-negative number. Received ' + arg + '.');\n }\n defaultMaxListeners = arg;\n }\n});\n\nEventEmitter.init = function() {\n\n if (this._events === undefined ||\n this._events === Object.getPrototypeOf(this)._events) {\n this._events = Object.create(null);\n this._eventsCount = 0;\n }\n\n this._maxListeners = this._maxListeners || undefined;\n};\n\n// Obviously not all Emitters should be limited to 10. This function allows\n// that to be increased. Set to zero for unlimited.\nEventEmitter.prototype.setMaxListeners = function setMaxListeners(n) {\n if (typeof n !== 'number' || n < 0 || NumberIsNaN(n)) {\n throw new RangeError('The value of \"n\" is out of range. It must be a non-negative number. Received ' + n + '.');\n }\n this._maxListeners = n;\n return this;\n};\n\nfunction $getMaxListeners(that) {\n if (that._maxListeners === undefined)\n return EventEmitter.defaultMaxListeners;\n return that._maxListeners;\n}\n\nEventEmitter.prototype.getMaxListeners = function getMaxListeners() {\n return $getMaxListeners(this);\n};\n\nEventEmitter.prototype.emit = function emit(type) {\n var args = [];\n for (var i = 1; i < arguments.length; i++) args.push(arguments[i]);\n var doError = (type === 'error');\n\n var events = this._events;\n if (events !== undefined)\n doError = (doError && events.error === undefined);\n else if (!doError)\n return false;\n\n // If there is no 'error' event listener then throw.\n if (doError) {\n var er;\n if (args.length > 0)\n er = args[0];\n if (er instanceof Error) {\n // Note: The comments on the `throw` lines are intentional, they show\n // up in Node's output if this results in an unhandled exception.\n throw er; // Unhandled 'error' event\n }\n // At least give some kind of context to the user\n var err = new Error('Unhandled error.' + (er ? ' (' + er.message + ')' : ''));\n err.context = er;\n throw err; // Unhandled 'error' event\n }\n\n var handler = events[type];\n\n if (handler === undefined)\n return false;\n\n if (typeof handler === 'function') {\n ReflectApply(handler, this, args);\n } else {\n var len = handler.length;\n var listeners = arrayClone(handler, len);\n for (var i = 0; i < len; ++i)\n ReflectApply(listeners[i], this, args);\n }\n\n return true;\n};\n\nfunction _addListener(target, type, listener, prepend) {\n var m;\n var events;\n var existing;\n\n if (typeof listener !== 'function') {\n throw new TypeError('The \"listener\" argument must be of type Function. Received type ' + typeof listener);\n }\n\n events = target._events;\n if (events === undefined) {\n events = target._events = Object.create(null);\n target._eventsCount = 0;\n } else {\n // To avoid recursion in the case that type === \"newListener\"! Before\n // adding it to the listeners, first emit \"newListener\".\n if (events.newListener !== undefined) {\n target.emit('newListener', type,\n listener.listener ? listener.listener : listener);\n\n // Re-assign `events` because a newListener handler could have caused the\n // this._events to be assigned to a new object\n events = target._events;\n }\n existing = events[type];\n }\n\n if (existing === undefined) {\n // Optimize the case of one listener. Don't need the extra array object.\n existing = events[type] = listener;\n ++target._eventsCount;\n } else {\n if (typeof existing === 'function') {\n // Adding the second element, need to change to array.\n existing = events[type] =\n prepend ? [listener, existing] : [existing, listener];\n // If we've already got an array, just append.\n } else if (prepend) {\n existing.unshift(listener);\n } else {\n existing.push(listener);\n }\n\n // Check for listener leak\n m = $getMaxListeners(target);\n if (m > 0 && existing.length > m && !existing.warned) {\n existing.warned = true;\n // No error code for this since it is a Warning\n // eslint-disable-next-line no-restricted-syntax\n var w = new Error('Possible EventEmitter memory leak detected. ' +\n existing.length + ' ' + String(type) + ' listeners ' +\n 'added. Use emitter.setMaxListeners() to ' +\n 'increase limit');\n w.name = 'MaxListenersExceededWarning';\n w.emitter = target;\n w.type = type;\n w.count = existing.length;\n ProcessEmitWarning(w);\n }\n }\n\n return target;\n}\n\nEventEmitter.prototype.addListener = function addListener(type, listener) {\n return _addListener(this, type, listener, false);\n};\n\nEventEmitter.prototype.on = EventEmitter.prototype.addListener;\n\nEventEmitter.prototype.prependListener =\n function prependListener(type, listener) {\n return _addListener(this, type, listener, true);\n };\n\nfunction onceWrapper() {\n var args = [];\n for (var i = 0; i < arguments.length; i++) args.push(arguments[i]);\n if (!this.fired) {\n this.target.removeListener(this.type, this.wrapFn);\n this.fired = true;\n ReflectApply(this.listener, this.target, args);\n }\n}\n\nfunction _onceWrap(target, type, listener) {\n var state = { fired: false, wrapFn: undefined, target: target, type: type, listener: listener };\n var wrapped = onceWrapper.bind(state);\n wrapped.listener = listener;\n state.wrapFn = wrapped;\n return wrapped;\n}\n\nEventEmitter.prototype.once = function once(type, listener) {\n if (typeof listener !== 'function') {\n throw new TypeError('The \"listener\" argument must be of type Function. Received type ' + typeof listener);\n }\n this.on(type, _onceWrap(this, type, listener));\n return this;\n};\n\nEventEmitter.prototype.prependOnceListener =\n function prependOnceListener(type, listener) {\n if (typeof listener !== 'function') {\n throw new TypeError('The \"listener\" argument must be of type Function. Received type ' + typeof listener);\n }\n this.prependListener(type, _onceWrap(this, type, listener));\n return this;\n };\n\n// Emits a 'removeListener' event if and only if the listener was removed.\nEventEmitter.prototype.removeListener =\n function removeListener(type, listener) {\n var list, events, position, i, originalListener;\n\n if (typeof listener !== 'function') {\n throw new TypeError('The \"listener\" argument must be of type Function. Received type ' + typeof listener);\n }\n\n events = this._events;\n if (events === undefined)\n return this;\n\n list = events[type];\n if (list === undefined)\n return this;\n\n if (list === listener || list.listener === listener) {\n if (--this._eventsCount === 0)\n this._events = Object.create(null);\n else {\n delete events[type];\n if (events.removeListener)\n this.emit('removeListener', type, list.listener || listener);\n }\n } else if (typeof list !== 'function') {\n position = -1;\n\n for (i = list.length - 1; i >= 0; i--) {\n if (list[i] === listener || list[i].listener === listener) {\n originalListener = list[i].listener;\n position = i;\n break;\n }\n }\n\n if (position < 0)\n return this;\n\n if (position === 0)\n list.shift();\n else {\n spliceOne(list, position);\n }\n\n if (list.length === 1)\n events[type] = list[0];\n\n if (events.removeListener !== undefined)\n this.emit('removeListener', type, originalListener || listener);\n }\n\n return this;\n };\n\nEventEmitter.prototype.off = EventEmitter.prototype.removeListener;\n\nEventEmitter.prototype.removeAllListeners =\n function removeAllListeners(type) {\n var listeners, events, i;\n\n events = this._events;\n if (events === undefined)\n return this;\n\n // not listening for removeListener, no need to emit\n if (events.removeListener === undefined) {\n if (arguments.length === 0) {\n this._events = Object.create(null);\n this._eventsCount = 0;\n } else if (events[type] !== undefined) {\n if (--this._eventsCount === 0)\n this._events = Object.create(null);\n else\n delete events[type];\n }\n return this;\n }\n\n // emit removeListener for all listeners on all events\n if (arguments.length === 0) {\n var keys = Object.keys(events);\n var key;\n for (i = 0; i < keys.length; ++i) {\n key = keys[i];\n if (key === 'removeListener') continue;\n this.removeAllListeners(key);\n }\n this.removeAllListeners('removeListener');\n this._events = Object.create(null);\n this._eventsCount = 0;\n return this;\n }\n\n listeners = events[type];\n\n if (typeof listeners === 'function') {\n this.removeListener(type, listeners);\n } else if (listeners !== undefined) {\n // LIFO order\n for (i = listeners.length - 1; i >= 0; i--) {\n this.removeListener(type, listeners[i]);\n }\n }\n\n return this;\n };\n\nfunction _listeners(target, type, unwrap) {\n var events = target._events;\n\n if (events === undefined)\n return [];\n\n var evlistener = events[type];\n if (evlistener === undefined)\n return [];\n\n if (typeof evlistener === 'function')\n return unwrap ? [evlistener.listener || evlistener] : [evlistener];\n\n return unwrap ?\n unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length);\n}\n\nEventEmitter.prototype.listeners = function listeners(type) {\n return _listeners(this, type, true);\n};\n\nEventEmitter.prototype.rawListeners = function rawListeners(type) {\n return _listeners(this, type, false);\n};\n\nEventEmitter.listenerCount = function(emitter, type) {\n if (typeof emitter.listenerCount === 'function') {\n return emitter.listenerCount(type);\n } else {\n return listenerCount.call(emitter, type);\n }\n};\n\nEventEmitter.prototype.listenerCount = listenerCount;\nfunction listenerCount(type) {\n var events = this._events;\n\n if (events !== undefined) {\n var evlistener = events[type];\n\n if (typeof evlistener === 'function') {\n return 1;\n } else if (evlistener !== undefined) {\n return evlistener.length;\n }\n }\n\n return 0;\n}\n\nEventEmitter.prototype.eventNames = function eventNames() {\n return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : [];\n};\n\nfunction arrayClone(arr, n) {\n var copy = new Array(n);\n for (var i = 0; i < n; ++i)\n copy[i] = arr[i];\n return copy;\n}\n\nfunction spliceOne(list, index) {\n for (; index + 1 < list.length; index++)\n list[index] = list[index + 1];\n list.pop();\n}\n\nfunction unwrapListeners(arr) {\n var ret = new Array(arr.length);\n for (var i = 0; i < ret.length; ++i) {\n ret[i] = arr[i].listener || arr[i];\n }\n return ret;\n}\n\n\n//# sourceURL=webpack:///./node_modules/events/events.js?"); +eval("// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n\n\nvar R = typeof Reflect === 'object' ? Reflect : null\nvar ReflectApply = R && typeof R.apply === 'function'\n ? R.apply\n : function ReflectApply(target, receiver, args) {\n return Function.prototype.apply.call(target, receiver, args);\n }\n\nvar ReflectOwnKeys\nif (R && typeof R.ownKeys === 'function') {\n ReflectOwnKeys = R.ownKeys\n} else if (Object.getOwnPropertySymbols) {\n ReflectOwnKeys = function ReflectOwnKeys(target) {\n return Object.getOwnPropertyNames(target)\n .concat(Object.getOwnPropertySymbols(target));\n };\n} else {\n ReflectOwnKeys = function ReflectOwnKeys(target) {\n return Object.getOwnPropertyNames(target);\n };\n}\n\nfunction ProcessEmitWarning(warning) {\n if (console && console.warn) console.warn(warning);\n}\n\nvar NumberIsNaN = Number.isNaN || function NumberIsNaN(value) {\n return value !== value;\n}\n\nfunction EventEmitter() {\n EventEmitter.init.call(this);\n}\nmodule.exports = EventEmitter;\n\n// Backwards-compat with node 0.10.x\nEventEmitter.EventEmitter = EventEmitter;\n\nEventEmitter.prototype._events = undefined;\nEventEmitter.prototype._eventsCount = 0;\nEventEmitter.prototype._maxListeners = undefined;\n\n// By default EventEmitters will print a warning if more than 10 listeners are\n// added to it. This is a useful default which helps finding memory leaks.\nvar defaultMaxListeners = 10;\n\nfunction checkListener(listener) {\n if (typeof listener !== 'function') {\n throw new TypeError('The \"listener\" argument must be of type Function. Received type ' + typeof listener);\n }\n}\n\nObject.defineProperty(EventEmitter, 'defaultMaxListeners', {\n enumerable: true,\n get: function() {\n return defaultMaxListeners;\n },\n set: function(arg) {\n if (typeof arg !== 'number' || arg < 0 || NumberIsNaN(arg)) {\n throw new RangeError('The value of \"defaultMaxListeners\" is out of range. It must be a non-negative number. Received ' + arg + '.');\n }\n defaultMaxListeners = arg;\n }\n});\n\nEventEmitter.init = function() {\n\n if (this._events === undefined ||\n this._events === Object.getPrototypeOf(this)._events) {\n this._events = Object.create(null);\n this._eventsCount = 0;\n }\n\n this._maxListeners = this._maxListeners || undefined;\n};\n\n// Obviously not all Emitters should be limited to 10. This function allows\n// that to be increased. Set to zero for unlimited.\nEventEmitter.prototype.setMaxListeners = function setMaxListeners(n) {\n if (typeof n !== 'number' || n < 0 || NumberIsNaN(n)) {\n throw new RangeError('The value of \"n\" is out of range. It must be a non-negative number. Received ' + n + '.');\n }\n this._maxListeners = n;\n return this;\n};\n\nfunction _getMaxListeners(that) {\n if (that._maxListeners === undefined)\n return EventEmitter.defaultMaxListeners;\n return that._maxListeners;\n}\n\nEventEmitter.prototype.getMaxListeners = function getMaxListeners() {\n return _getMaxListeners(this);\n};\n\nEventEmitter.prototype.emit = function emit(type) {\n var args = [];\n for (var i = 1; i < arguments.length; i++) args.push(arguments[i]);\n var doError = (type === 'error');\n\n var events = this._events;\n if (events !== undefined)\n doError = (doError && events.error === undefined);\n else if (!doError)\n return false;\n\n // If there is no 'error' event listener then throw.\n if (doError) {\n var er;\n if (args.length > 0)\n er = args[0];\n if (er instanceof Error) {\n // Note: The comments on the `throw` lines are intentional, they show\n // up in Node's output if this results in an unhandled exception.\n throw er; // Unhandled 'error' event\n }\n // At least give some kind of context to the user\n var err = new Error('Unhandled error.' + (er ? ' (' + er.message + ')' : ''));\n err.context = er;\n throw err; // Unhandled 'error' event\n }\n\n var handler = events[type];\n\n if (handler === undefined)\n return false;\n\n if (typeof handler === 'function') {\n ReflectApply(handler, this, args);\n } else {\n var len = handler.length;\n var listeners = arrayClone(handler, len);\n for (var i = 0; i < len; ++i)\n ReflectApply(listeners[i], this, args);\n }\n\n return true;\n};\n\nfunction _addListener(target, type, listener, prepend) {\n var m;\n var events;\n var existing;\n\n checkListener(listener);\n\n events = target._events;\n if (events === undefined) {\n events = target._events = Object.create(null);\n target._eventsCount = 0;\n } else {\n // To avoid recursion in the case that type === \"newListener\"! Before\n // adding it to the listeners, first emit \"newListener\".\n if (events.newListener !== undefined) {\n target.emit('newListener', type,\n listener.listener ? listener.listener : listener);\n\n // Re-assign `events` because a newListener handler could have caused the\n // this._events to be assigned to a new object\n events = target._events;\n }\n existing = events[type];\n }\n\n if (existing === undefined) {\n // Optimize the case of one listener. Don't need the extra array object.\n existing = events[type] = listener;\n ++target._eventsCount;\n } else {\n if (typeof existing === 'function') {\n // Adding the second element, need to change to array.\n existing = events[type] =\n prepend ? [listener, existing] : [existing, listener];\n // If we've already got an array, just append.\n } else if (prepend) {\n existing.unshift(listener);\n } else {\n existing.push(listener);\n }\n\n // Check for listener leak\n m = _getMaxListeners(target);\n if (m > 0 && existing.length > m && !existing.warned) {\n existing.warned = true;\n // No error code for this since it is a Warning\n // eslint-disable-next-line no-restricted-syntax\n var w = new Error('Possible EventEmitter memory leak detected. ' +\n existing.length + ' ' + String(type) + ' listeners ' +\n 'added. Use emitter.setMaxListeners() to ' +\n 'increase limit');\n w.name = 'MaxListenersExceededWarning';\n w.emitter = target;\n w.type = type;\n w.count = existing.length;\n ProcessEmitWarning(w);\n }\n }\n\n return target;\n}\n\nEventEmitter.prototype.addListener = function addListener(type, listener) {\n return _addListener(this, type, listener, false);\n};\n\nEventEmitter.prototype.on = EventEmitter.prototype.addListener;\n\nEventEmitter.prototype.prependListener =\n function prependListener(type, listener) {\n return _addListener(this, type, listener, true);\n };\n\nfunction onceWrapper() {\n if (!this.fired) {\n this.target.removeListener(this.type, this.wrapFn);\n this.fired = true;\n if (arguments.length === 0)\n return this.listener.call(this.target);\n return this.listener.apply(this.target, arguments);\n }\n}\n\nfunction _onceWrap(target, type, listener) {\n var state = { fired: false, wrapFn: undefined, target: target, type: type, listener: listener };\n var wrapped = onceWrapper.bind(state);\n wrapped.listener = listener;\n state.wrapFn = wrapped;\n return wrapped;\n}\n\nEventEmitter.prototype.once = function once(type, listener) {\n checkListener(listener);\n this.on(type, _onceWrap(this, type, listener));\n return this;\n};\n\nEventEmitter.prototype.prependOnceListener =\n function prependOnceListener(type, listener) {\n checkListener(listener);\n this.prependListener(type, _onceWrap(this, type, listener));\n return this;\n };\n\n// Emits a 'removeListener' event if and only if the listener was removed.\nEventEmitter.prototype.removeListener =\n function removeListener(type, listener) {\n var list, events, position, i, originalListener;\n\n checkListener(listener);\n\n events = this._events;\n if (events === undefined)\n return this;\n\n list = events[type];\n if (list === undefined)\n return this;\n\n if (list === listener || list.listener === listener) {\n if (--this._eventsCount === 0)\n this._events = Object.create(null);\n else {\n delete events[type];\n if (events.removeListener)\n this.emit('removeListener', type, list.listener || listener);\n }\n } else if (typeof list !== 'function') {\n position = -1;\n\n for (i = list.length - 1; i >= 0; i--) {\n if (list[i] === listener || list[i].listener === listener) {\n originalListener = list[i].listener;\n position = i;\n break;\n }\n }\n\n if (position < 0)\n return this;\n\n if (position === 0)\n list.shift();\n else {\n spliceOne(list, position);\n }\n\n if (list.length === 1)\n events[type] = list[0];\n\n if (events.removeListener !== undefined)\n this.emit('removeListener', type, originalListener || listener);\n }\n\n return this;\n };\n\nEventEmitter.prototype.off = EventEmitter.prototype.removeListener;\n\nEventEmitter.prototype.removeAllListeners =\n function removeAllListeners(type) {\n var listeners, events, i;\n\n events = this._events;\n if (events === undefined)\n return this;\n\n // not listening for removeListener, no need to emit\n if (events.removeListener === undefined) {\n if (arguments.length === 0) {\n this._events = Object.create(null);\n this._eventsCount = 0;\n } else if (events[type] !== undefined) {\n if (--this._eventsCount === 0)\n this._events = Object.create(null);\n else\n delete events[type];\n }\n return this;\n }\n\n // emit removeListener for all listeners on all events\n if (arguments.length === 0) {\n var keys = Object.keys(events);\n var key;\n for (i = 0; i < keys.length; ++i) {\n key = keys[i];\n if (key === 'removeListener') continue;\n this.removeAllListeners(key);\n }\n this.removeAllListeners('removeListener');\n this._events = Object.create(null);\n this._eventsCount = 0;\n return this;\n }\n\n listeners = events[type];\n\n if (typeof listeners === 'function') {\n this.removeListener(type, listeners);\n } else if (listeners !== undefined) {\n // LIFO order\n for (i = listeners.length - 1; i >= 0; i--) {\n this.removeListener(type, listeners[i]);\n }\n }\n\n return this;\n };\n\nfunction _listeners(target, type, unwrap) {\n var events = target._events;\n\n if (events === undefined)\n return [];\n\n var evlistener = events[type];\n if (evlistener === undefined)\n return [];\n\n if (typeof evlistener === 'function')\n return unwrap ? [evlistener.listener || evlistener] : [evlistener];\n\n return unwrap ?\n unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length);\n}\n\nEventEmitter.prototype.listeners = function listeners(type) {\n return _listeners(this, type, true);\n};\n\nEventEmitter.prototype.rawListeners = function rawListeners(type) {\n return _listeners(this, type, false);\n};\n\nEventEmitter.listenerCount = function(emitter, type) {\n if (typeof emitter.listenerCount === 'function') {\n return emitter.listenerCount(type);\n } else {\n return listenerCount.call(emitter, type);\n }\n};\n\nEventEmitter.prototype.listenerCount = listenerCount;\nfunction listenerCount(type) {\n var events = this._events;\n\n if (events !== undefined) {\n var evlistener = events[type];\n\n if (typeof evlistener === 'function') {\n return 1;\n } else if (evlistener !== undefined) {\n return evlistener.length;\n }\n }\n\n return 0;\n}\n\nEventEmitter.prototype.eventNames = function eventNames() {\n return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : [];\n};\n\nfunction arrayClone(arr, n) {\n var copy = new Array(n);\n for (var i = 0; i < n; ++i)\n copy[i] = arr[i];\n return copy;\n}\n\nfunction spliceOne(list, index) {\n for (; index + 1 < list.length; index++)\n list[index] = list[index + 1];\n list.pop();\n}\n\nfunction unwrapListeners(arr) {\n var ret = new Array(arr.length);\n for (var i = 0; i < ret.length; ++i) {\n ret[i] = arr[i].listener || arr[i];\n }\n return ret;\n}\n\n\n//# sourceURL=webpack:///./node_modules/events/events.js?"); /***/ }), @@ -149,18 +149,6 @@ eval("exports.read = function (buffer, offset, isLE, mLen, nBytes) {\n var e, m /***/ }), -/***/ "./node_modules/inherits/inherits_browser.js": -/*!***************************************************!*\ - !*** ./node_modules/inherits/inherits_browser.js ***! - \***************************************************/ -/*! no static exports found */ -/*! ModuleConcatenation bailout: Module is not an ECMAScript module */ -/***/ (function(module, exports) { - -eval("if (typeof Object.create === 'function') {\n // implementation from standard node.js 'util' module\n module.exports = function inherits(ctor, superCtor) {\n ctor.super_ = superCtor\n ctor.prototype = Object.create(superCtor.prototype, {\n constructor: {\n value: ctor,\n enumerable: false,\n writable: true,\n configurable: true\n }\n });\n };\n} else {\n // old school shim for old browsers\n module.exports = function inherits(ctor, superCtor) {\n ctor.super_ = superCtor\n var TempCtor = function () {}\n TempCtor.prototype = superCtor.prototype\n ctor.prototype = new TempCtor()\n ctor.prototype.constructor = ctor\n }\n}\n\n\n//# sourceURL=webpack:///./node_modules/inherits/inherits_browser.js?"); - -/***/ }), - /***/ "./node_modules/isarray/index.js": /*!***************************************!*\ !*** ./node_modules/isarray/index.js ***! @@ -217,7 +205,7 @@ eval("exports.endianness = function () { return 'LE' };\n\nexports.hostname = fu /*! ModuleConcatenation bailout: Module is not an ECMAScript module */ /***/ (function(module, exports, __webpack_require__) { -eval("/* WEBPACK VAR INJECTION */(function(process) {// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// resolves . and .. elements in a path array with directory names there\n// must be no slashes, empty elements, or device names (c:\\) in the array\n// (so also no leading and trailing slashes - it does not distinguish\n// relative and absolute paths)\nfunction normalizeArray(parts, allowAboveRoot) {\n // if the path tries to go above the root, `up` ends up > 0\n var up = 0;\n for (var i = parts.length - 1; i >= 0; i--) {\n var last = parts[i];\n if (last === '.') {\n parts.splice(i, 1);\n } else if (last === '..') {\n parts.splice(i, 1);\n up++;\n } else if (up) {\n parts.splice(i, 1);\n up--;\n }\n }\n\n // if the path is allowed to go above the root, restore leading ..s\n if (allowAboveRoot) {\n for (; up--; up) {\n parts.unshift('..');\n }\n }\n\n return parts;\n}\n\n// Split a filename into [root, dir, basename, ext], unix version\n// 'root' is just a slash, or nothing.\nvar splitPathRe =\n /^(\\/?|)([\\s\\S]*?)((?:\\.{1,2}|[^\\/]+?|)(\\.[^.\\/]*|))(?:[\\/]*)$/;\nvar splitPath = function(filename) {\n return splitPathRe.exec(filename).slice(1);\n};\n\n// path.resolve([from ...], to)\n// posix version\nexports.resolve = function() {\n var resolvedPath = '',\n resolvedAbsolute = false;\n\n for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {\n var path = (i >= 0) ? arguments[i] : process.cwd();\n\n // Skip empty and invalid entries\n if (typeof path !== 'string') {\n throw new TypeError('Arguments to path.resolve must be strings');\n } else if (!path) {\n continue;\n }\n\n resolvedPath = path + '/' + resolvedPath;\n resolvedAbsolute = path.charAt(0) === '/';\n }\n\n // At this point the path should be resolved to a full absolute path, but\n // handle relative paths to be safe (might happen when process.cwd() fails)\n\n // Normalize the path\n resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) {\n return !!p;\n }), !resolvedAbsolute).join('/');\n\n return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.';\n};\n\n// path.normalize(path)\n// posix version\nexports.normalize = function(path) {\n var isAbsolute = exports.isAbsolute(path),\n trailingSlash = substr(path, -1) === '/';\n\n // Normalize the path\n path = normalizeArray(filter(path.split('/'), function(p) {\n return !!p;\n }), !isAbsolute).join('/');\n\n if (!path && !isAbsolute) {\n path = '.';\n }\n if (path && trailingSlash) {\n path += '/';\n }\n\n return (isAbsolute ? '/' : '') + path;\n};\n\n// posix version\nexports.isAbsolute = function(path) {\n return path.charAt(0) === '/';\n};\n\n// posix version\nexports.join = function() {\n var paths = Array.prototype.slice.call(arguments, 0);\n return exports.normalize(filter(paths, function(p, index) {\n if (typeof p !== 'string') {\n throw new TypeError('Arguments to path.join must be strings');\n }\n return p;\n }).join('/'));\n};\n\n\n// path.relative(from, to)\n// posix version\nexports.relative = function(from, to) {\n from = exports.resolve(from).substr(1);\n to = exports.resolve(to).substr(1);\n\n function trim(arr) {\n var start = 0;\n for (; start < arr.length; start++) {\n if (arr[start] !== '') break;\n }\n\n var end = arr.length - 1;\n for (; end >= 0; end--) {\n if (arr[end] !== '') break;\n }\n\n if (start > end) return [];\n return arr.slice(start, end - start + 1);\n }\n\n var fromParts = trim(from.split('/'));\n var toParts = trim(to.split('/'));\n\n var length = Math.min(fromParts.length, toParts.length);\n var samePartsLength = length;\n for (var i = 0; i < length; i++) {\n if (fromParts[i] !== toParts[i]) {\n samePartsLength = i;\n break;\n }\n }\n\n var outputParts = [];\n for (var i = samePartsLength; i < fromParts.length; i++) {\n outputParts.push('..');\n }\n\n outputParts = outputParts.concat(toParts.slice(samePartsLength));\n\n return outputParts.join('/');\n};\n\nexports.sep = '/';\nexports.delimiter = ':';\n\nexports.dirname = function(path) {\n var result = splitPath(path),\n root = result[0],\n dir = result[1];\n\n if (!root && !dir) {\n // No dirname whatsoever\n return '.';\n }\n\n if (dir) {\n // It has a dirname, strip trailing slash\n dir = dir.substr(0, dir.length - 1);\n }\n\n return root + dir;\n};\n\n\nexports.basename = function(path, ext) {\n var f = splitPath(path)[2];\n // TODO: make this comparison case-insensitive on windows?\n if (ext && f.substr(-1 * ext.length) === ext) {\n f = f.substr(0, f.length - ext.length);\n }\n return f;\n};\n\n\nexports.extname = function(path) {\n return splitPath(path)[3];\n};\n\nfunction filter (xs, f) {\n if (xs.filter) return xs.filter(f);\n var res = [];\n for (var i = 0; i < xs.length; i++) {\n if (f(xs[i], i, xs)) res.push(xs[i]);\n }\n return res;\n}\n\n// String.prototype.substr - negative index don't work in IE8\nvar substr = 'ab'.substr(-1) === 'b'\n ? function (str, start, len) { return str.substr(start, len) }\n : function (str, start, len) {\n if (start < 0) start = str.length + start;\n return str.substr(start, len);\n }\n;\n\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../process/browser.js */ \"./node_modules/process/browser.js\")))\n\n//# sourceURL=webpack:///./node_modules/path-browserify/index.js?"); +eval("/* WEBPACK VAR INJECTION */(function(process) {// .dirname, .basename, and .extname methods are extracted from Node.js v8.11.1,\n// backported and transplited with Babel, with backwards-compat fixes\n\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// resolves . and .. elements in a path array with directory names there\n// must be no slashes, empty elements, or device names (c:\\) in the array\n// (so also no leading and trailing slashes - it does not distinguish\n// relative and absolute paths)\nfunction normalizeArray(parts, allowAboveRoot) {\n // if the path tries to go above the root, `up` ends up > 0\n var up = 0;\n for (var i = parts.length - 1; i >= 0; i--) {\n var last = parts[i];\n if (last === '.') {\n parts.splice(i, 1);\n } else if (last === '..') {\n parts.splice(i, 1);\n up++;\n } else if (up) {\n parts.splice(i, 1);\n up--;\n }\n }\n\n // if the path is allowed to go above the root, restore leading ..s\n if (allowAboveRoot) {\n for (; up--; up) {\n parts.unshift('..');\n }\n }\n\n return parts;\n}\n\n// path.resolve([from ...], to)\n// posix version\nexports.resolve = function() {\n var resolvedPath = '',\n resolvedAbsolute = false;\n\n for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {\n var path = (i >= 0) ? arguments[i] : process.cwd();\n\n // Skip empty and invalid entries\n if (typeof path !== 'string') {\n throw new TypeError('Arguments to path.resolve must be strings');\n } else if (!path) {\n continue;\n }\n\n resolvedPath = path + '/' + resolvedPath;\n resolvedAbsolute = path.charAt(0) === '/';\n }\n\n // At this point the path should be resolved to a full absolute path, but\n // handle relative paths to be safe (might happen when process.cwd() fails)\n\n // Normalize the path\n resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) {\n return !!p;\n }), !resolvedAbsolute).join('/');\n\n return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.';\n};\n\n// path.normalize(path)\n// posix version\nexports.normalize = function(path) {\n var isAbsolute = exports.isAbsolute(path),\n trailingSlash = substr(path, -1) === '/';\n\n // Normalize the path\n path = normalizeArray(filter(path.split('/'), function(p) {\n return !!p;\n }), !isAbsolute).join('/');\n\n if (!path && !isAbsolute) {\n path = '.';\n }\n if (path && trailingSlash) {\n path += '/';\n }\n\n return (isAbsolute ? '/' : '') + path;\n};\n\n// posix version\nexports.isAbsolute = function(path) {\n return path.charAt(0) === '/';\n};\n\n// posix version\nexports.join = function() {\n var paths = Array.prototype.slice.call(arguments, 0);\n return exports.normalize(filter(paths, function(p, index) {\n if (typeof p !== 'string') {\n throw new TypeError('Arguments to path.join must be strings');\n }\n return p;\n }).join('/'));\n};\n\n\n// path.relative(from, to)\n// posix version\nexports.relative = function(from, to) {\n from = exports.resolve(from).substr(1);\n to = exports.resolve(to).substr(1);\n\n function trim(arr) {\n var start = 0;\n for (; start < arr.length; start++) {\n if (arr[start] !== '') break;\n }\n\n var end = arr.length - 1;\n for (; end >= 0; end--) {\n if (arr[end] !== '') break;\n }\n\n if (start > end) return [];\n return arr.slice(start, end - start + 1);\n }\n\n var fromParts = trim(from.split('/'));\n var toParts = trim(to.split('/'));\n\n var length = Math.min(fromParts.length, toParts.length);\n var samePartsLength = length;\n for (var i = 0; i < length; i++) {\n if (fromParts[i] !== toParts[i]) {\n samePartsLength = i;\n break;\n }\n }\n\n var outputParts = [];\n for (var i = samePartsLength; i < fromParts.length; i++) {\n outputParts.push('..');\n }\n\n outputParts = outputParts.concat(toParts.slice(samePartsLength));\n\n return outputParts.join('/');\n};\n\nexports.sep = '/';\nexports.delimiter = ':';\n\nexports.dirname = function (path) {\n if (typeof path !== 'string') path = path + '';\n if (path.length === 0) return '.';\n var code = path.charCodeAt(0);\n var hasRoot = code === 47 /*/*/;\n var end = -1;\n var matchedSlash = true;\n for (var i = path.length - 1; i >= 1; --i) {\n code = path.charCodeAt(i);\n if (code === 47 /*/*/) {\n if (!matchedSlash) {\n end = i;\n break;\n }\n } else {\n // We saw the first non-path separator\n matchedSlash = false;\n }\n }\n\n if (end === -1) return hasRoot ? '/' : '.';\n if (hasRoot && end === 1) {\n // return '//';\n // Backwards-compat fix:\n return '/';\n }\n return path.slice(0, end);\n};\n\nfunction basename(path) {\n if (typeof path !== 'string') path = path + '';\n\n var start = 0;\n var end = -1;\n var matchedSlash = true;\n var i;\n\n for (i = path.length - 1; i >= 0; --i) {\n if (path.charCodeAt(i) === 47 /*/*/) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash) {\n start = i + 1;\n break;\n }\n } else if (end === -1) {\n // We saw the first non-path separator, mark this as the end of our\n // path component\n matchedSlash = false;\n end = i + 1;\n }\n }\n\n if (end === -1) return '';\n return path.slice(start, end);\n}\n\n// Uses a mixed approach for backwards-compatibility, as ext behavior changed\n// in new Node.js versions, so only basename() above is backported here\nexports.basename = function (path, ext) {\n var f = basename(path);\n if (ext && f.substr(-1 * ext.length) === ext) {\n f = f.substr(0, f.length - ext.length);\n }\n return f;\n};\n\nexports.extname = function (path) {\n if (typeof path !== 'string') path = path + '';\n var startDot = -1;\n var startPart = 0;\n var end = -1;\n var matchedSlash = true;\n // Track the state of characters (if any) we see before our first dot and\n // after any path separator we find\n var preDotState = 0;\n for (var i = path.length - 1; i >= 0; --i) {\n var code = path.charCodeAt(i);\n if (code === 47 /*/*/) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash) {\n startPart = i + 1;\n break;\n }\n continue;\n }\n if (end === -1) {\n // We saw the first non-path separator, mark this as the end of our\n // extension\n matchedSlash = false;\n end = i + 1;\n }\n if (code === 46 /*.*/) {\n // If this is our first dot, mark it as the start of our extension\n if (startDot === -1)\n startDot = i;\n else if (preDotState !== 1)\n preDotState = 1;\n } else if (startDot !== -1) {\n // We saw a non-dot and non-path separator before our dot, so we should\n // have a good chance at having a non-empty extension\n preDotState = -1;\n }\n }\n\n if (startDot === -1 || end === -1 ||\n // We saw a non-dot character immediately before the dot\n preDotState === 0 ||\n // The (right-most) trimmed path component is exactly '..'\n preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {\n return '';\n }\n return path.slice(startDot, end);\n};\n\nfunction filter (xs, f) {\n if (xs.filter) return xs.filter(f);\n var res = [];\n for (var i = 0; i < xs.length; i++) {\n if (f(xs[i], i, xs)) res.push(xs[i]);\n }\n return res;\n}\n\n// String.prototype.substr - negative index don't work in IE8\nvar substr = 'ab'.substr(-1) === 'b'\n ? function (str, start, len) { return str.substr(start, len) }\n : function (str, start, len) {\n if (start < 0) start = str.length + start;\n return str.substr(start, len);\n }\n;\n\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../process/browser.js */ \"./node_modules/process/browser.js\")))\n\n//# sourceURL=webpack:///./node_modules/path-browserify/index.js?"); /***/ }), @@ -321,6 +309,18 @@ eval("const browser = typeof window !== 'undefined';\nconst querystring = __webp /***/ }), +/***/ "./node_modules/util/node_modules/inherits/inherits_browser.js": +/*!*********************************************************************!*\ + !*** ./node_modules/util/node_modules/inherits/inherits_browser.js ***! + \*********************************************************************/ +/*! no static exports found */ +/*! ModuleConcatenation bailout: Module is not an ECMAScript module */ +/***/ (function(module, exports) { + +eval("if (typeof Object.create === 'function') {\n // implementation from standard node.js 'util' module\n module.exports = function inherits(ctor, superCtor) {\n ctor.super_ = superCtor\n ctor.prototype = Object.create(superCtor.prototype, {\n constructor: {\n value: ctor,\n enumerable: false,\n writable: true,\n configurable: true\n }\n });\n };\n} else {\n // old school shim for old browsers\n module.exports = function inherits(ctor, superCtor) {\n ctor.super_ = superCtor\n var TempCtor = function () {}\n TempCtor.prototype = superCtor.prototype\n ctor.prototype = new TempCtor()\n ctor.prototype.constructor = ctor\n }\n}\n\n\n//# sourceURL=webpack:///./node_modules/util/node_modules/inherits/inherits_browser.js?"); + +/***/ }), + /***/ "./node_modules/util/support/isBufferBrowser.js": /*!******************************************************!*\ !*** ./node_modules/util/support/isBufferBrowser.js ***! @@ -341,7 +341,7 @@ eval("module.exports = function isBuffer(arg) {\n return arg && typeof arg === /*! ModuleConcatenation bailout: Module is not an ECMAScript module */ /***/ (function(module, exports, __webpack_require__) { -eval("/* WEBPACK VAR INJECTION */(function(process) {// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nvar getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors ||\n function getOwnPropertyDescriptors(obj) {\n var keys = Object.keys(obj);\n var descriptors = {};\n for (var i = 0; i < keys.length; i++) {\n descriptors[keys[i]] = Object.getOwnPropertyDescriptor(obj, keys[i]);\n }\n return descriptors;\n };\n\nvar formatRegExp = /%[sdj%]/g;\nexports.format = function(f) {\n if (!isString(f)) {\n var objects = [];\n for (var i = 0; i < arguments.length; i++) {\n objects.push(inspect(arguments[i]));\n }\n return objects.join(' ');\n }\n\n var i = 1;\n var args = arguments;\n var len = args.length;\n var str = String(f).replace(formatRegExp, function(x) {\n if (x === '%%') return '%';\n if (i >= len) return x;\n switch (x) {\n case '%s': return String(args[i++]);\n case '%d': return Number(args[i++]);\n case '%j':\n try {\n return JSON.stringify(args[i++]);\n } catch (_) {\n return '[Circular]';\n }\n default:\n return x;\n }\n });\n for (var x = args[i]; i < len; x = args[++i]) {\n if (isNull(x) || !isObject(x)) {\n str += ' ' + x;\n } else {\n str += ' ' + inspect(x);\n }\n }\n return str;\n};\n\n\n// Mark that a method should not be used.\n// Returns a modified function which warns once by default.\n// If --no-deprecation is set, then it is a no-op.\nexports.deprecate = function(fn, msg) {\n if (typeof process !== 'undefined' && process.noDeprecation === true) {\n return fn;\n }\n\n // Allow for deprecating things in the process of starting up.\n if (typeof process === 'undefined') {\n return function() {\n return exports.deprecate(fn, msg).apply(this, arguments);\n };\n }\n\n var warned = false;\n function deprecated() {\n if (!warned) {\n if (process.throwDeprecation) {\n throw new Error(msg);\n } else if (process.traceDeprecation) {\n console.trace(msg);\n } else {\n console.error(msg);\n }\n warned = true;\n }\n return fn.apply(this, arguments);\n }\n\n return deprecated;\n};\n\n\nvar debugs = {};\nvar debugEnviron;\nexports.debuglog = function(set) {\n if (isUndefined(debugEnviron))\n debugEnviron = Object({\"__DISCORD_WEBPACK__\":\"true\"}).NODE_DEBUG || '';\n set = set.toUpperCase();\n if (!debugs[set]) {\n if (new RegExp('\\\\b' + set + '\\\\b', 'i').test(debugEnviron)) {\n var pid = process.pid;\n debugs[set] = function() {\n var msg = exports.format.apply(exports, arguments);\n console.error('%s %d: %s', set, pid, msg);\n };\n } else {\n debugs[set] = function() {};\n }\n }\n return debugs[set];\n};\n\n\n/**\n * Echos the value of a value. Trys to print the value out\n * in the best way possible given the different types.\n *\n * @param {Object} obj The object to print out.\n * @param {Object} opts Optional options object that alters the output.\n */\n/* legacy: obj, showHidden, depth, colors*/\nfunction inspect(obj, opts) {\n // default options\n var ctx = {\n seen: [],\n stylize: stylizeNoColor\n };\n // legacy...\n if (arguments.length >= 3) ctx.depth = arguments[2];\n if (arguments.length >= 4) ctx.colors = arguments[3];\n if (isBoolean(opts)) {\n // legacy...\n ctx.showHidden = opts;\n } else if (opts) {\n // got an \"options\" object\n exports._extend(ctx, opts);\n }\n // set default options\n if (isUndefined(ctx.showHidden)) ctx.showHidden = false;\n if (isUndefined(ctx.depth)) ctx.depth = 2;\n if (isUndefined(ctx.colors)) ctx.colors = false;\n if (isUndefined(ctx.customInspect)) ctx.customInspect = true;\n if (ctx.colors) ctx.stylize = stylizeWithColor;\n return formatValue(ctx, obj, ctx.depth);\n}\nexports.inspect = inspect;\n\n\n// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics\ninspect.colors = {\n 'bold' : [1, 22],\n 'italic' : [3, 23],\n 'underline' : [4, 24],\n 'inverse' : [7, 27],\n 'white' : [37, 39],\n 'grey' : [90, 39],\n 'black' : [30, 39],\n 'blue' : [34, 39],\n 'cyan' : [36, 39],\n 'green' : [32, 39],\n 'magenta' : [35, 39],\n 'red' : [31, 39],\n 'yellow' : [33, 39]\n};\n\n// Don't use 'blue' not visible on cmd.exe\ninspect.styles = {\n 'special': 'cyan',\n 'number': 'yellow',\n 'boolean': 'yellow',\n 'undefined': 'grey',\n 'null': 'bold',\n 'string': 'green',\n 'date': 'magenta',\n // \"name\": intentionally not styling\n 'regexp': 'red'\n};\n\n\nfunction stylizeWithColor(str, styleType) {\n var style = inspect.styles[styleType];\n\n if (style) {\n return '\\u001b[' + inspect.colors[style][0] + 'm' + str +\n '\\u001b[' + inspect.colors[style][1] + 'm';\n } else {\n return str;\n }\n}\n\n\nfunction stylizeNoColor(str, styleType) {\n return str;\n}\n\n\nfunction arrayToHash(array) {\n var hash = {};\n\n array.forEach(function(val, idx) {\n hash[val] = true;\n });\n\n return hash;\n}\n\n\nfunction formatValue(ctx, value, recurseTimes) {\n // Provide a hook for user-specified inspect functions.\n // Check that value is an object with an inspect function on it\n if (ctx.customInspect &&\n value &&\n isFunction(value.inspect) &&\n // Filter out the util module, it's inspect function is special\n value.inspect !== exports.inspect &&\n // Also filter out any prototype objects using the circular check.\n !(value.constructor && value.constructor.prototype === value)) {\n var ret = value.inspect(recurseTimes, ctx);\n if (!isString(ret)) {\n ret = formatValue(ctx, ret, recurseTimes);\n }\n return ret;\n }\n\n // Primitive types cannot have properties\n var primitive = formatPrimitive(ctx, value);\n if (primitive) {\n return primitive;\n }\n\n // Look up the keys of the object.\n var keys = Object.keys(value);\n var visibleKeys = arrayToHash(keys);\n\n if (ctx.showHidden) {\n keys = Object.getOwnPropertyNames(value);\n }\n\n // IE doesn't make error fields non-enumerable\n // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx\n if (isError(value)\n && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {\n return formatError(value);\n }\n\n // Some type of object without properties can be shortcutted.\n if (keys.length === 0) {\n if (isFunction(value)) {\n var name = value.name ? ': ' + value.name : '';\n return ctx.stylize('[Function' + name + ']', 'special');\n }\n if (isRegExp(value)) {\n return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');\n }\n if (isDate(value)) {\n return ctx.stylize(Date.prototype.toString.call(value), 'date');\n }\n if (isError(value)) {\n return formatError(value);\n }\n }\n\n var base = '', array = false, braces = ['{', '}'];\n\n // Make Array say that they are Array\n if (isArray(value)) {\n array = true;\n braces = ['[', ']'];\n }\n\n // Make functions say that they are functions\n if (isFunction(value)) {\n var n = value.name ? ': ' + value.name : '';\n base = ' [Function' + n + ']';\n }\n\n // Make RegExps say that they are RegExps\n if (isRegExp(value)) {\n base = ' ' + RegExp.prototype.toString.call(value);\n }\n\n // Make dates with properties first say the date\n if (isDate(value)) {\n base = ' ' + Date.prototype.toUTCString.call(value);\n }\n\n // Make error with message first say the error\n if (isError(value)) {\n base = ' ' + formatError(value);\n }\n\n if (keys.length === 0 && (!array || value.length == 0)) {\n return braces[0] + base + braces[1];\n }\n\n if (recurseTimes < 0) {\n if (isRegExp(value)) {\n return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');\n } else {\n return ctx.stylize('[Object]', 'special');\n }\n }\n\n ctx.seen.push(value);\n\n var output;\n if (array) {\n output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);\n } else {\n output = keys.map(function(key) {\n return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);\n });\n }\n\n ctx.seen.pop();\n\n return reduceToSingleString(output, base, braces);\n}\n\n\nfunction formatPrimitive(ctx, value) {\n if (isUndefined(value))\n return ctx.stylize('undefined', 'undefined');\n if (isString(value)) {\n var simple = '\\'' + JSON.stringify(value).replace(/^\"|\"$/g, '')\n .replace(/'/g, \"\\\\'\")\n .replace(/\\\\\"/g, '\"') + '\\'';\n return ctx.stylize(simple, 'string');\n }\n if (isNumber(value))\n return ctx.stylize('' + value, 'number');\n if (isBoolean(value))\n return ctx.stylize('' + value, 'boolean');\n // For some reason typeof null is \"object\", so special case here.\n if (isNull(value))\n return ctx.stylize('null', 'null');\n}\n\n\nfunction formatError(value) {\n return '[' + Error.prototype.toString.call(value) + ']';\n}\n\n\nfunction formatArray(ctx, value, recurseTimes, visibleKeys, keys) {\n var output = [];\n for (var i = 0, l = value.length; i < l; ++i) {\n if (hasOwnProperty(value, String(i))) {\n output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,\n String(i), true));\n } else {\n output.push('');\n }\n }\n keys.forEach(function(key) {\n if (!key.match(/^\\d+$/)) {\n output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,\n key, true));\n }\n });\n return output;\n}\n\n\nfunction formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {\n var name, str, desc;\n desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };\n if (desc.get) {\n if (desc.set) {\n str = ctx.stylize('[Getter/Setter]', 'special');\n } else {\n str = ctx.stylize('[Getter]', 'special');\n }\n } else {\n if (desc.set) {\n str = ctx.stylize('[Setter]', 'special');\n }\n }\n if (!hasOwnProperty(visibleKeys, key)) {\n name = '[' + key + ']';\n }\n if (!str) {\n if (ctx.seen.indexOf(desc.value) < 0) {\n if (isNull(recurseTimes)) {\n str = formatValue(ctx, desc.value, null);\n } else {\n str = formatValue(ctx, desc.value, recurseTimes - 1);\n }\n if (str.indexOf('\\n') > -1) {\n if (array) {\n str = str.split('\\n').map(function(line) {\n return ' ' + line;\n }).join('\\n').substr(2);\n } else {\n str = '\\n' + str.split('\\n').map(function(line) {\n return ' ' + line;\n }).join('\\n');\n }\n }\n } else {\n str = ctx.stylize('[Circular]', 'special');\n }\n }\n if (isUndefined(name)) {\n if (array && key.match(/^\\d+$/)) {\n return str;\n }\n name = JSON.stringify('' + key);\n if (name.match(/^\"([a-zA-Z_][a-zA-Z_0-9]*)\"$/)) {\n name = name.substr(1, name.length - 2);\n name = ctx.stylize(name, 'name');\n } else {\n name = name.replace(/'/g, \"\\\\'\")\n .replace(/\\\\\"/g, '\"')\n .replace(/(^\"|\"$)/g, \"'\");\n name = ctx.stylize(name, 'string');\n }\n }\n\n return name + ': ' + str;\n}\n\n\nfunction reduceToSingleString(output, base, braces) {\n var numLinesEst = 0;\n var length = output.reduce(function(prev, cur) {\n numLinesEst++;\n if (cur.indexOf('\\n') >= 0) numLinesEst++;\n return prev + cur.replace(/\\u001b\\[\\d\\d?m/g, '').length + 1;\n }, 0);\n\n if (length > 60) {\n return braces[0] +\n (base === '' ? '' : base + '\\n ') +\n ' ' +\n output.join(',\\n ') +\n ' ' +\n braces[1];\n }\n\n return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];\n}\n\n\n// NOTE: These type checking functions intentionally don't use `instanceof`\n// because it is fragile and can be easily faked with `Object.create()`.\nfunction isArray(ar) {\n return Array.isArray(ar);\n}\nexports.isArray = isArray;\n\nfunction isBoolean(arg) {\n return typeof arg === 'boolean';\n}\nexports.isBoolean = isBoolean;\n\nfunction isNull(arg) {\n return arg === null;\n}\nexports.isNull = isNull;\n\nfunction isNullOrUndefined(arg) {\n return arg == null;\n}\nexports.isNullOrUndefined = isNullOrUndefined;\n\nfunction isNumber(arg) {\n return typeof arg === 'number';\n}\nexports.isNumber = isNumber;\n\nfunction isString(arg) {\n return typeof arg === 'string';\n}\nexports.isString = isString;\n\nfunction isSymbol(arg) {\n return typeof arg === 'symbol';\n}\nexports.isSymbol = isSymbol;\n\nfunction isUndefined(arg) {\n return arg === void 0;\n}\nexports.isUndefined = isUndefined;\n\nfunction isRegExp(re) {\n return isObject(re) && objectToString(re) === '[object RegExp]';\n}\nexports.isRegExp = isRegExp;\n\nfunction isObject(arg) {\n return typeof arg === 'object' && arg !== null;\n}\nexports.isObject = isObject;\n\nfunction isDate(d) {\n return isObject(d) && objectToString(d) === '[object Date]';\n}\nexports.isDate = isDate;\n\nfunction isError(e) {\n return isObject(e) &&\n (objectToString(e) === '[object Error]' || e instanceof Error);\n}\nexports.isError = isError;\n\nfunction isFunction(arg) {\n return typeof arg === 'function';\n}\nexports.isFunction = isFunction;\n\nfunction isPrimitive(arg) {\n return arg === null ||\n typeof arg === 'boolean' ||\n typeof arg === 'number' ||\n typeof arg === 'string' ||\n typeof arg === 'symbol' || // ES6 symbol\n typeof arg === 'undefined';\n}\nexports.isPrimitive = isPrimitive;\n\nexports.isBuffer = __webpack_require__(/*! ./support/isBuffer */ \"./node_modules/util/support/isBufferBrowser.js\");\n\nfunction objectToString(o) {\n return Object.prototype.toString.call(o);\n}\n\n\nfunction pad(n) {\n return n < 10 ? '0' + n.toString(10) : n.toString(10);\n}\n\n\nvar months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',\n 'Oct', 'Nov', 'Dec'];\n\n// 26 Feb 16:19:34\nfunction timestamp() {\n var d = new Date();\n var time = [pad(d.getHours()),\n pad(d.getMinutes()),\n pad(d.getSeconds())].join(':');\n return [d.getDate(), months[d.getMonth()], time].join(' ');\n}\n\n\n// log is just a thin wrapper to console.log that prepends a timestamp\nexports.log = function() {\n console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));\n};\n\n\n/**\n * Inherit the prototype methods from one constructor into another.\n *\n * The Function.prototype.inherits from lang.js rewritten as a standalone\n * function (not on Function.prototype). NOTE: If this file is to be loaded\n * during bootstrapping this function needs to be rewritten using some native\n * functions as prototype setup using normal JavaScript does not work as\n * expected during bootstrapping (see mirror.js in r114903).\n *\n * @param {function} ctor Constructor function which needs to inherit the\n * prototype.\n * @param {function} superCtor Constructor function to inherit prototype from.\n */\nexports.inherits = __webpack_require__(/*! inherits */ \"./node_modules/inherits/inherits_browser.js\");\n\nexports._extend = function(origin, add) {\n // Don't do anything if add isn't an object\n if (!add || !isObject(add)) return origin;\n\n var keys = Object.keys(add);\n var i = keys.length;\n while (i--) {\n origin[keys[i]] = add[keys[i]];\n }\n return origin;\n};\n\nfunction hasOwnProperty(obj, prop) {\n return Object.prototype.hasOwnProperty.call(obj, prop);\n}\n\nvar kCustomPromisifiedSymbol = typeof Symbol !== 'undefined' ? Symbol('util.promisify.custom') : undefined;\n\nexports.promisify = function promisify(original) {\n if (typeof original !== 'function')\n throw new TypeError('The \"original\" argument must be of type Function');\n\n if (kCustomPromisifiedSymbol && original[kCustomPromisifiedSymbol]) {\n var fn = original[kCustomPromisifiedSymbol];\n if (typeof fn !== 'function') {\n throw new TypeError('The \"util.promisify.custom\" argument must be of type Function');\n }\n Object.defineProperty(fn, kCustomPromisifiedSymbol, {\n value: fn, enumerable: false, writable: false, configurable: true\n });\n return fn;\n }\n\n function fn() {\n var promiseResolve, promiseReject;\n var promise = new Promise(function (resolve, reject) {\n promiseResolve = resolve;\n promiseReject = reject;\n });\n\n var args = [];\n for (var i = 0; i < arguments.length; i++) {\n args.push(arguments[i]);\n }\n args.push(function (err, value) {\n if (err) {\n promiseReject(err);\n } else {\n promiseResolve(value);\n }\n });\n\n try {\n original.apply(this, args);\n } catch (err) {\n promiseReject(err);\n }\n\n return promise;\n }\n\n Object.setPrototypeOf(fn, Object.getPrototypeOf(original));\n\n if (kCustomPromisifiedSymbol) Object.defineProperty(fn, kCustomPromisifiedSymbol, {\n value: fn, enumerable: false, writable: false, configurable: true\n });\n return Object.defineProperties(\n fn,\n getOwnPropertyDescriptors(original)\n );\n}\n\nexports.promisify.custom = kCustomPromisifiedSymbol\n\nfunction callbackifyOnRejected(reason, cb) {\n // `!reason` guard inspired by bluebird (Ref: https://goo.gl/t5IS6M).\n // Because `null` is a special error value in callbacks which means \"no error\n // occurred\", we error-wrap so the callback consumer can distinguish between\n // \"the promise rejected with null\" or \"the promise fulfilled with undefined\".\n if (!reason) {\n var newReason = new Error('Promise was rejected with a falsy value');\n newReason.reason = reason;\n reason = newReason;\n }\n return cb(reason);\n}\n\nfunction callbackify(original) {\n if (typeof original !== 'function') {\n throw new TypeError('The \"original\" argument must be of type Function');\n }\n\n // We DO NOT return the promise as it gives the user a false sense that\n // the promise is actually somehow related to the callback's execution\n // and that the callback throwing will reject the promise.\n function callbackified() {\n var args = [];\n for (var i = 0; i < arguments.length; i++) {\n args.push(arguments[i]);\n }\n\n var maybeCb = args.pop();\n if (typeof maybeCb !== 'function') {\n throw new TypeError('The last argument must be of type Function');\n }\n var self = this;\n var cb = function() {\n return maybeCb.apply(self, arguments);\n };\n // In true node style we process the callback on `nextTick` with all the\n // implications (stack, `uncaughtException`, `async_hooks`)\n original.apply(this, args)\n .then(function(ret) { process.nextTick(cb, null, ret) },\n function(rej) { process.nextTick(callbackifyOnRejected, rej, cb) });\n }\n\n Object.setPrototypeOf(callbackified, Object.getPrototypeOf(original));\n Object.defineProperties(callbackified,\n getOwnPropertyDescriptors(original));\n return callbackified;\n}\nexports.callbackify = callbackify;\n\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../process/browser.js */ \"./node_modules/process/browser.js\")))\n\n//# sourceURL=webpack:///./node_modules/util/util.js?"); +eval("/* WEBPACK VAR INJECTION */(function(process) {// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nvar getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors ||\n function getOwnPropertyDescriptors(obj) {\n var keys = Object.keys(obj);\n var descriptors = {};\n for (var i = 0; i < keys.length; i++) {\n descriptors[keys[i]] = Object.getOwnPropertyDescriptor(obj, keys[i]);\n }\n return descriptors;\n };\n\nvar formatRegExp = /%[sdj%]/g;\nexports.format = function(f) {\n if (!isString(f)) {\n var objects = [];\n for (var i = 0; i < arguments.length; i++) {\n objects.push(inspect(arguments[i]));\n }\n return objects.join(' ');\n }\n\n var i = 1;\n var args = arguments;\n var len = args.length;\n var str = String(f).replace(formatRegExp, function(x) {\n if (x === '%%') return '%';\n if (i >= len) return x;\n switch (x) {\n case '%s': return String(args[i++]);\n case '%d': return Number(args[i++]);\n case '%j':\n try {\n return JSON.stringify(args[i++]);\n } catch (_) {\n return '[Circular]';\n }\n default:\n return x;\n }\n });\n for (var x = args[i]; i < len; x = args[++i]) {\n if (isNull(x) || !isObject(x)) {\n str += ' ' + x;\n } else {\n str += ' ' + inspect(x);\n }\n }\n return str;\n};\n\n\n// Mark that a method should not be used.\n// Returns a modified function which warns once by default.\n// If --no-deprecation is set, then it is a no-op.\nexports.deprecate = function(fn, msg) {\n if (typeof process !== 'undefined' && process.noDeprecation === true) {\n return fn;\n }\n\n // Allow for deprecating things in the process of starting up.\n if (typeof process === 'undefined') {\n return function() {\n return exports.deprecate(fn, msg).apply(this, arguments);\n };\n }\n\n var warned = false;\n function deprecated() {\n if (!warned) {\n if (process.throwDeprecation) {\n throw new Error(msg);\n } else if (process.traceDeprecation) {\n console.trace(msg);\n } else {\n console.error(msg);\n }\n warned = true;\n }\n return fn.apply(this, arguments);\n }\n\n return deprecated;\n};\n\n\nvar debugs = {};\nvar debugEnviron;\nexports.debuglog = function(set) {\n if (isUndefined(debugEnviron))\n debugEnviron = Object({\"__DISCORD_WEBPACK__\":\"true\"}).NODE_DEBUG || '';\n set = set.toUpperCase();\n if (!debugs[set]) {\n if (new RegExp('\\\\b' + set + '\\\\b', 'i').test(debugEnviron)) {\n var pid = process.pid;\n debugs[set] = function() {\n var msg = exports.format.apply(exports, arguments);\n console.error('%s %d: %s', set, pid, msg);\n };\n } else {\n debugs[set] = function() {};\n }\n }\n return debugs[set];\n};\n\n\n/**\n * Echos the value of a value. Trys to print the value out\n * in the best way possible given the different types.\n *\n * @param {Object} obj The object to print out.\n * @param {Object} opts Optional options object that alters the output.\n */\n/* legacy: obj, showHidden, depth, colors*/\nfunction inspect(obj, opts) {\n // default options\n var ctx = {\n seen: [],\n stylize: stylizeNoColor\n };\n // legacy...\n if (arguments.length >= 3) ctx.depth = arguments[2];\n if (arguments.length >= 4) ctx.colors = arguments[3];\n if (isBoolean(opts)) {\n // legacy...\n ctx.showHidden = opts;\n } else if (opts) {\n // got an \"options\" object\n exports._extend(ctx, opts);\n }\n // set default options\n if (isUndefined(ctx.showHidden)) ctx.showHidden = false;\n if (isUndefined(ctx.depth)) ctx.depth = 2;\n if (isUndefined(ctx.colors)) ctx.colors = false;\n if (isUndefined(ctx.customInspect)) ctx.customInspect = true;\n if (ctx.colors) ctx.stylize = stylizeWithColor;\n return formatValue(ctx, obj, ctx.depth);\n}\nexports.inspect = inspect;\n\n\n// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics\ninspect.colors = {\n 'bold' : [1, 22],\n 'italic' : [3, 23],\n 'underline' : [4, 24],\n 'inverse' : [7, 27],\n 'white' : [37, 39],\n 'grey' : [90, 39],\n 'black' : [30, 39],\n 'blue' : [34, 39],\n 'cyan' : [36, 39],\n 'green' : [32, 39],\n 'magenta' : [35, 39],\n 'red' : [31, 39],\n 'yellow' : [33, 39]\n};\n\n// Don't use 'blue' not visible on cmd.exe\ninspect.styles = {\n 'special': 'cyan',\n 'number': 'yellow',\n 'boolean': 'yellow',\n 'undefined': 'grey',\n 'null': 'bold',\n 'string': 'green',\n 'date': 'magenta',\n // \"name\": intentionally not styling\n 'regexp': 'red'\n};\n\n\nfunction stylizeWithColor(str, styleType) {\n var style = inspect.styles[styleType];\n\n if (style) {\n return '\\u001b[' + inspect.colors[style][0] + 'm' + str +\n '\\u001b[' + inspect.colors[style][1] + 'm';\n } else {\n return str;\n }\n}\n\n\nfunction stylizeNoColor(str, styleType) {\n return str;\n}\n\n\nfunction arrayToHash(array) {\n var hash = {};\n\n array.forEach(function(val, idx) {\n hash[val] = true;\n });\n\n return hash;\n}\n\n\nfunction formatValue(ctx, value, recurseTimes) {\n // Provide a hook for user-specified inspect functions.\n // Check that value is an object with an inspect function on it\n if (ctx.customInspect &&\n value &&\n isFunction(value.inspect) &&\n // Filter out the util module, it's inspect function is special\n value.inspect !== exports.inspect &&\n // Also filter out any prototype objects using the circular check.\n !(value.constructor && value.constructor.prototype === value)) {\n var ret = value.inspect(recurseTimes, ctx);\n if (!isString(ret)) {\n ret = formatValue(ctx, ret, recurseTimes);\n }\n return ret;\n }\n\n // Primitive types cannot have properties\n var primitive = formatPrimitive(ctx, value);\n if (primitive) {\n return primitive;\n }\n\n // Look up the keys of the object.\n var keys = Object.keys(value);\n var visibleKeys = arrayToHash(keys);\n\n if (ctx.showHidden) {\n keys = Object.getOwnPropertyNames(value);\n }\n\n // IE doesn't make error fields non-enumerable\n // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx\n if (isError(value)\n && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {\n return formatError(value);\n }\n\n // Some type of object without properties can be shortcutted.\n if (keys.length === 0) {\n if (isFunction(value)) {\n var name = value.name ? ': ' + value.name : '';\n return ctx.stylize('[Function' + name + ']', 'special');\n }\n if (isRegExp(value)) {\n return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');\n }\n if (isDate(value)) {\n return ctx.stylize(Date.prototype.toString.call(value), 'date');\n }\n if (isError(value)) {\n return formatError(value);\n }\n }\n\n var base = '', array = false, braces = ['{', '}'];\n\n // Make Array say that they are Array\n if (isArray(value)) {\n array = true;\n braces = ['[', ']'];\n }\n\n // Make functions say that they are functions\n if (isFunction(value)) {\n var n = value.name ? ': ' + value.name : '';\n base = ' [Function' + n + ']';\n }\n\n // Make RegExps say that they are RegExps\n if (isRegExp(value)) {\n base = ' ' + RegExp.prototype.toString.call(value);\n }\n\n // Make dates with properties first say the date\n if (isDate(value)) {\n base = ' ' + Date.prototype.toUTCString.call(value);\n }\n\n // Make error with message first say the error\n if (isError(value)) {\n base = ' ' + formatError(value);\n }\n\n if (keys.length === 0 && (!array || value.length == 0)) {\n return braces[0] + base + braces[1];\n }\n\n if (recurseTimes < 0) {\n if (isRegExp(value)) {\n return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');\n } else {\n return ctx.stylize('[Object]', 'special');\n }\n }\n\n ctx.seen.push(value);\n\n var output;\n if (array) {\n output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);\n } else {\n output = keys.map(function(key) {\n return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);\n });\n }\n\n ctx.seen.pop();\n\n return reduceToSingleString(output, base, braces);\n}\n\n\nfunction formatPrimitive(ctx, value) {\n if (isUndefined(value))\n return ctx.stylize('undefined', 'undefined');\n if (isString(value)) {\n var simple = '\\'' + JSON.stringify(value).replace(/^\"|\"$/g, '')\n .replace(/'/g, \"\\\\'\")\n .replace(/\\\\\"/g, '\"') + '\\'';\n return ctx.stylize(simple, 'string');\n }\n if (isNumber(value))\n return ctx.stylize('' + value, 'number');\n if (isBoolean(value))\n return ctx.stylize('' + value, 'boolean');\n // For some reason typeof null is \"object\", so special case here.\n if (isNull(value))\n return ctx.stylize('null', 'null');\n}\n\n\nfunction formatError(value) {\n return '[' + Error.prototype.toString.call(value) + ']';\n}\n\n\nfunction formatArray(ctx, value, recurseTimes, visibleKeys, keys) {\n var output = [];\n for (var i = 0, l = value.length; i < l; ++i) {\n if (hasOwnProperty(value, String(i))) {\n output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,\n String(i), true));\n } else {\n output.push('');\n }\n }\n keys.forEach(function(key) {\n if (!key.match(/^\\d+$/)) {\n output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,\n key, true));\n }\n });\n return output;\n}\n\n\nfunction formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {\n var name, str, desc;\n desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };\n if (desc.get) {\n if (desc.set) {\n str = ctx.stylize('[Getter/Setter]', 'special');\n } else {\n str = ctx.stylize('[Getter]', 'special');\n }\n } else {\n if (desc.set) {\n str = ctx.stylize('[Setter]', 'special');\n }\n }\n if (!hasOwnProperty(visibleKeys, key)) {\n name = '[' + key + ']';\n }\n if (!str) {\n if (ctx.seen.indexOf(desc.value) < 0) {\n if (isNull(recurseTimes)) {\n str = formatValue(ctx, desc.value, null);\n } else {\n str = formatValue(ctx, desc.value, recurseTimes - 1);\n }\n if (str.indexOf('\\n') > -1) {\n if (array) {\n str = str.split('\\n').map(function(line) {\n return ' ' + line;\n }).join('\\n').substr(2);\n } else {\n str = '\\n' + str.split('\\n').map(function(line) {\n return ' ' + line;\n }).join('\\n');\n }\n }\n } else {\n str = ctx.stylize('[Circular]', 'special');\n }\n }\n if (isUndefined(name)) {\n if (array && key.match(/^\\d+$/)) {\n return str;\n }\n name = JSON.stringify('' + key);\n if (name.match(/^\"([a-zA-Z_][a-zA-Z_0-9]*)\"$/)) {\n name = name.substr(1, name.length - 2);\n name = ctx.stylize(name, 'name');\n } else {\n name = name.replace(/'/g, \"\\\\'\")\n .replace(/\\\\\"/g, '\"')\n .replace(/(^\"|\"$)/g, \"'\");\n name = ctx.stylize(name, 'string');\n }\n }\n\n return name + ': ' + str;\n}\n\n\nfunction reduceToSingleString(output, base, braces) {\n var numLinesEst = 0;\n var length = output.reduce(function(prev, cur) {\n numLinesEst++;\n if (cur.indexOf('\\n') >= 0) numLinesEst++;\n return prev + cur.replace(/\\u001b\\[\\d\\d?m/g, '').length + 1;\n }, 0);\n\n if (length > 60) {\n return braces[0] +\n (base === '' ? '' : base + '\\n ') +\n ' ' +\n output.join(',\\n ') +\n ' ' +\n braces[1];\n }\n\n return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];\n}\n\n\n// NOTE: These type checking functions intentionally don't use `instanceof`\n// because it is fragile and can be easily faked with `Object.create()`.\nfunction isArray(ar) {\n return Array.isArray(ar);\n}\nexports.isArray = isArray;\n\nfunction isBoolean(arg) {\n return typeof arg === 'boolean';\n}\nexports.isBoolean = isBoolean;\n\nfunction isNull(arg) {\n return arg === null;\n}\nexports.isNull = isNull;\n\nfunction isNullOrUndefined(arg) {\n return arg == null;\n}\nexports.isNullOrUndefined = isNullOrUndefined;\n\nfunction isNumber(arg) {\n return typeof arg === 'number';\n}\nexports.isNumber = isNumber;\n\nfunction isString(arg) {\n return typeof arg === 'string';\n}\nexports.isString = isString;\n\nfunction isSymbol(arg) {\n return typeof arg === 'symbol';\n}\nexports.isSymbol = isSymbol;\n\nfunction isUndefined(arg) {\n return arg === void 0;\n}\nexports.isUndefined = isUndefined;\n\nfunction isRegExp(re) {\n return isObject(re) && objectToString(re) === '[object RegExp]';\n}\nexports.isRegExp = isRegExp;\n\nfunction isObject(arg) {\n return typeof arg === 'object' && arg !== null;\n}\nexports.isObject = isObject;\n\nfunction isDate(d) {\n return isObject(d) && objectToString(d) === '[object Date]';\n}\nexports.isDate = isDate;\n\nfunction isError(e) {\n return isObject(e) &&\n (objectToString(e) === '[object Error]' || e instanceof Error);\n}\nexports.isError = isError;\n\nfunction isFunction(arg) {\n return typeof arg === 'function';\n}\nexports.isFunction = isFunction;\n\nfunction isPrimitive(arg) {\n return arg === null ||\n typeof arg === 'boolean' ||\n typeof arg === 'number' ||\n typeof arg === 'string' ||\n typeof arg === 'symbol' || // ES6 symbol\n typeof arg === 'undefined';\n}\nexports.isPrimitive = isPrimitive;\n\nexports.isBuffer = __webpack_require__(/*! ./support/isBuffer */ \"./node_modules/util/support/isBufferBrowser.js\");\n\nfunction objectToString(o) {\n return Object.prototype.toString.call(o);\n}\n\n\nfunction pad(n) {\n return n < 10 ? '0' + n.toString(10) : n.toString(10);\n}\n\n\nvar months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',\n 'Oct', 'Nov', 'Dec'];\n\n// 26 Feb 16:19:34\nfunction timestamp() {\n var d = new Date();\n var time = [pad(d.getHours()),\n pad(d.getMinutes()),\n pad(d.getSeconds())].join(':');\n return [d.getDate(), months[d.getMonth()], time].join(' ');\n}\n\n\n// log is just a thin wrapper to console.log that prepends a timestamp\nexports.log = function() {\n console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));\n};\n\n\n/**\n * Inherit the prototype methods from one constructor into another.\n *\n * The Function.prototype.inherits from lang.js rewritten as a standalone\n * function (not on Function.prototype). NOTE: If this file is to be loaded\n * during bootstrapping this function needs to be rewritten using some native\n * functions as prototype setup using normal JavaScript does not work as\n * expected during bootstrapping (see mirror.js in r114903).\n *\n * @param {function} ctor Constructor function which needs to inherit the\n * prototype.\n * @param {function} superCtor Constructor function to inherit prototype from.\n */\nexports.inherits = __webpack_require__(/*! inherits */ \"./node_modules/util/node_modules/inherits/inherits_browser.js\");\n\nexports._extend = function(origin, add) {\n // Don't do anything if add isn't an object\n if (!add || !isObject(add)) return origin;\n\n var keys = Object.keys(add);\n var i = keys.length;\n while (i--) {\n origin[keys[i]] = add[keys[i]];\n }\n return origin;\n};\n\nfunction hasOwnProperty(obj, prop) {\n return Object.prototype.hasOwnProperty.call(obj, prop);\n}\n\nvar kCustomPromisifiedSymbol = typeof Symbol !== 'undefined' ? Symbol('util.promisify.custom') : undefined;\n\nexports.promisify = function promisify(original) {\n if (typeof original !== 'function')\n throw new TypeError('The \"original\" argument must be of type Function');\n\n if (kCustomPromisifiedSymbol && original[kCustomPromisifiedSymbol]) {\n var fn = original[kCustomPromisifiedSymbol];\n if (typeof fn !== 'function') {\n throw new TypeError('The \"util.promisify.custom\" argument must be of type Function');\n }\n Object.defineProperty(fn, kCustomPromisifiedSymbol, {\n value: fn, enumerable: false, writable: false, configurable: true\n });\n return fn;\n }\n\n function fn() {\n var promiseResolve, promiseReject;\n var promise = new Promise(function (resolve, reject) {\n promiseResolve = resolve;\n promiseReject = reject;\n });\n\n var args = [];\n for (var i = 0; i < arguments.length; i++) {\n args.push(arguments[i]);\n }\n args.push(function (err, value) {\n if (err) {\n promiseReject(err);\n } else {\n promiseResolve(value);\n }\n });\n\n try {\n original.apply(this, args);\n } catch (err) {\n promiseReject(err);\n }\n\n return promise;\n }\n\n Object.setPrototypeOf(fn, Object.getPrototypeOf(original));\n\n if (kCustomPromisifiedSymbol) Object.defineProperty(fn, kCustomPromisifiedSymbol, {\n value: fn, enumerable: false, writable: false, configurable: true\n });\n return Object.defineProperties(\n fn,\n getOwnPropertyDescriptors(original)\n );\n}\n\nexports.promisify.custom = kCustomPromisifiedSymbol\n\nfunction callbackifyOnRejected(reason, cb) {\n // `!reason` guard inspired by bluebird (Ref: https://goo.gl/t5IS6M).\n // Because `null` is a special error value in callbacks which means \"no error\n // occurred\", we error-wrap so the callback consumer can distinguish between\n // \"the promise rejected with null\" or \"the promise fulfilled with undefined\".\n if (!reason) {\n var newReason = new Error('Promise was rejected with a falsy value');\n newReason.reason = reason;\n reason = newReason;\n }\n return cb(reason);\n}\n\nfunction callbackify(original) {\n if (typeof original !== 'function') {\n throw new TypeError('The \"original\" argument must be of type Function');\n }\n\n // We DO NOT return the promise as it gives the user a false sense that\n // the promise is actually somehow related to the callback's execution\n // and that the callback throwing will reject the promise.\n function callbackified() {\n var args = [];\n for (var i = 0; i < arguments.length; i++) {\n args.push(arguments[i]);\n }\n\n var maybeCb = args.pop();\n if (typeof maybeCb !== 'function') {\n throw new TypeError('The last argument must be of type Function');\n }\n var self = this;\n var cb = function() {\n return maybeCb.apply(self, arguments);\n };\n // In true node style we process the callback on `nextTick` with all the\n // implications (stack, `uncaughtException`, `async_hooks`)\n original.apply(this, args)\n .then(function(ret) { process.nextTick(cb, null, ret) },\n function(rej) { process.nextTick(callbackifyOnRejected, rej, cb) });\n }\n\n Object.setPrototypeOf(callbackified, Object.getPrototypeOf(original));\n Object.defineProperties(callbackified,\n getOwnPropertyDescriptors(original));\n return callbackified;\n}\nexports.callbackify = callbackify;\n\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../process/browser.js */ \"./node_modules/process/browser.js\")))\n\n//# sourceURL=webpack:///./node_modules/util/util.js?"); /***/ }), @@ -365,7 +365,7 @@ eval("var g;\n\n// This works in non-strict mode\ng = (function() {\n\treturn th /*! ModuleConcatenation bailout: Module is not an ECMAScript module */ /***/ (function(module) { -eval("module.exports = {\"name\":\"discord.js\",\"version\":\"11.5.1\",\"description\":\"A powerful library for interacting with the Discord API\",\"main\":\"./src/index\",\"types\":\"./typings/index.d.ts\",\"scripts\":{\"test\":\"npm run lint && npm run docs:test\",\"docs\":\"docgen --source src --custom docs/index.yml --output docs/docs.json\",\"docs:test\":\"docgen --source src --custom docs/index.yml\",\"lint\":\"eslint src\",\"lint:fix\":\"eslint --fix src\",\"lint:typings\":\"tslint typings/index.d.ts typings/discord.js-test.ts\",\"webpack\":\"parallel-webpack\"},\"repository\":{\"type\":\"git\",\"url\":\"git+https://github.com/discordjs/discord.js.git\"},\"keywords\":[\"discord\",\"api\",\"bot\",\"client\",\"node\",\"discordapp\"],\"author\":\"Amish Shah \",\"license\":\"Apache-2.0\",\"bugs\":{\"url\":\"https://github.com/discordjs/discord.js/issues\"},\"homepage\":\"https://github.com/discordjs/discord.js#readme\",\"runkitExampleFilename\":\"./docs/examples/ping.js\",\"dependencies\":{\"long\":\"^4.0.0\",\"prism-media\":\"^0.0.3\",\"snekfetch\":\"^3.6.4\",\"tweetnacl\":\"^1.0.0\",\"ws\":\"^6.0.0\"},\"peerDependencies\":{\"@discordjs/uws\":\"^10.149.0\",\"bufferutil\":\"^4.0.0\",\"erlpack\":\"discordapp/erlpack\",\"libsodium-wrappers\":\"^0.7.3\",\"node-opus\":\"^0.2.7\",\"opusscript\":\"^0.0.6\",\"sodium\":\"^2.0.3\"},\"peerDependenciesMeta\":{\"bufferutil\":{\"optional\":true},\"erlpack\":{\"optional\":true},\"node-opus\":{\"optional\":true},\"opusscript\":{\"optional\":true},\"sodium\":{\"optional\":true},\"libsodium-wrappers\":{\"optional\":true},\"uws\":{\"optional\":true}},\"devDependencies\":{\"@types/node\":\"^9.4.6\",\"discord.js-docgen\":\"discordjs/docgen\",\"eslint\":\"^5.4.0\",\"parallel-webpack\":\"^2.3.0\",\"tslint\":\"^3.15.1\",\"tslint-config-typings\":\"^0.2.4\",\"typescript\":\"^3.0.1\",\"uglifyjs-webpack-plugin\":\"^1.3.0\",\"webpack\":\"^4.17.0\"},\"engines\":{\"node\":\">=6.0.0\"},\"browser\":{\"ws\":false,\"uws\":false,\"@discordjs/uws\":false,\"erlpack\":false,\"prism-media\":false,\"opusscript\":false,\"node-opus\":false,\"tweetnacl\":false,\"sodium\":false,\"src/sharding/Shard.js\":false,\"src/sharding/ShardClientUtil.js\":false,\"src/sharding/ShardingManager.js\":false,\"src/client/voice/dispatcher/StreamDispatcher.js\":false,\"src/client/voice/opus/BaseOpusEngine.js\":false,\"src/client/voice/opus/NodeOpusEngine.js\":false,\"src/client/voice/opus/OpusEngineList.js\":false,\"src/client/voice/opus/OpusScriptEngine.js\":false,\"src/client/voice/pcm/ConverterEngine.js\":false,\"src/client/voice/pcm/ConverterEngineList.js\":false,\"src/client/voice/pcm/FfmpegConverterEngine.js\":false,\"src/client/voice/player/AudioPlayer.js\":false,\"src/client/voice/receiver/VoiceReadable.js\":false,\"src/client/voice/receiver/VoiceReceiver.js\":false,\"src/client/voice/util/Secretbox.js\":false,\"src/client/voice/util/SecretKey.js\":false,\"src/client/voice/util/VolumeInterface.js\":false,\"src/client/voice/ClientVoiceManager.js\":false,\"src/client/voice/VoiceBroadcast.js\":false,\"src/client/voice/VoiceConnection.js\":false,\"src/client/voice/VoiceUDPClient.js\":false,\"src/client/voice/VoiceWebSocket.js\":false}};\n\n//# sourceURL=webpack:///./package.json?"); +eval("module.exports = JSON.parse(\"{\\\"name\\\":\\\"discord.js\\\",\\\"version\\\":\\\"11.6.0\\\",\\\"description\\\":\\\"A powerful library for interacting with the Discord API\\\",\\\"main\\\":\\\"./src/index\\\",\\\"types\\\":\\\"./typings/index.d.ts\\\",\\\"scripts\\\":{\\\"test\\\":\\\"npm run lint && npm run docs:test\\\",\\\"docs\\\":\\\"docgen --source src --custom docs/index.yml --output docs/docs.json\\\",\\\"docs:test\\\":\\\"docgen --source src --custom docs/index.yml\\\",\\\"lint\\\":\\\"eslint src\\\",\\\"lint:fix\\\":\\\"eslint --fix src\\\",\\\"lint:typings\\\":\\\"tslint typings/index.d.ts typings/discord.js-test.ts\\\",\\\"webpack\\\":\\\"parallel-webpack\\\"},\\\"repository\\\":{\\\"type\\\":\\\"git\\\",\\\"url\\\":\\\"git+https://github.com/discordjs/discord.js.git\\\"},\\\"keywords\\\":[\\\"discord\\\",\\\"api\\\",\\\"bot\\\",\\\"client\\\",\\\"node\\\",\\\"discordapp\\\"],\\\"author\\\":\\\"Amish Shah \\\",\\\"license\\\":\\\"Apache-2.0\\\",\\\"bugs\\\":{\\\"url\\\":\\\"https://github.com/discordjs/discord.js/issues\\\"},\\\"homepage\\\":\\\"https://github.com/discordjs/discord.js#readme\\\",\\\"runkitExampleFilename\\\":\\\"./docs/examples/ping.js\\\",\\\"dependencies\\\":{\\\"long\\\":\\\"^4.0.0\\\",\\\"prism-media\\\":\\\"^0.0.4\\\",\\\"snekfetch\\\":\\\"^3.6.4\\\",\\\"tweetnacl\\\":\\\"^1.0.0\\\",\\\"ws\\\":\\\"^6.0.0\\\"},\\\"peerDependencies\\\":{\\\"@discordjs/uws\\\":\\\"^10.149.0\\\",\\\"bufferutil\\\":\\\"^4.0.0\\\",\\\"erlpack\\\":\\\"discordapp/erlpack\\\",\\\"libsodium-wrappers\\\":\\\"^0.7.3\\\",\\\"@discordjs/opus\\\":\\\"^0.1.0\\\",\\\"node-opus\\\":\\\"^0.2.7\\\",\\\"opusscript\\\":\\\"^0.0.6\\\",\\\"sodium\\\":\\\"^2.0.3\\\"},\\\"peerDependenciesMeta\\\":{\\\"bufferutil\\\":{\\\"optional\\\":true},\\\"erlpack\\\":{\\\"optional\\\":true},\\\"@discordjs/opus\\\":{\\\"optional\\\":true},\\\"node-opus\\\":{\\\"optional\\\":true},\\\"opusscript\\\":{\\\"optional\\\":true},\\\"sodium\\\":{\\\"optional\\\":true},\\\"libsodium-wrappers\\\":{\\\"optional\\\":true},\\\"uws\\\":{\\\"optional\\\":true}},\\\"devDependencies\\\":{\\\"@types/node\\\":\\\"^9.4.6\\\",\\\"discord.js-docgen\\\":\\\"discordjs/docgen\\\",\\\"eslint\\\":\\\"^5.4.0\\\",\\\"parallel-webpack\\\":\\\"^2.3.0\\\",\\\"tslint\\\":\\\"^3.15.1\\\",\\\"tslint-config-typings\\\":\\\"^0.2.4\\\",\\\"typescript\\\":\\\"^3.0.1\\\",\\\"uglifyjs-webpack-plugin\\\":\\\"^1.3.0\\\",\\\"webpack\\\":\\\"^4.17.0\\\"},\\\"engines\\\":{\\\"node\\\":\\\">=6.0.0\\\"},\\\"browser\\\":{\\\"ws\\\":false,\\\"uws\\\":false,\\\"@discordjs/uws\\\":false,\\\"erlpack\\\":false,\\\"prism-media\\\":false,\\\"opusscript\\\":false,\\\"node-opus\\\":false,\\\"@discordjs/opus\\\":false,\\\"tweetnacl\\\":false,\\\"sodium\\\":false,\\\"src/sharding/Shard.js\\\":false,\\\"src/sharding/ShardClientUtil.js\\\":false,\\\"src/sharding/ShardingManager.js\\\":false,\\\"src/client/voice/dispatcher/StreamDispatcher.js\\\":false,\\\"src/client/voice/opus/BaseOpusEngine.js\\\":false,\\\"src/client/voice/opus/NodeOpusEngine.js\\\":false,\\\"src/client/voice/opus/DiscordJsOpusEngine.js\\\":false,\\\"src/client/voice/opus/OpusEngineList.js\\\":false,\\\"src/client/voice/opus/OpusScriptEngine.js\\\":false,\\\"src/client/voice/pcm/ConverterEngine.js\\\":false,\\\"src/client/voice/pcm/ConverterEngineList.js\\\":false,\\\"src/client/voice/pcm/FfmpegConverterEngine.js\\\":false,\\\"src/client/voice/player/AudioPlayer.js\\\":false,\\\"src/client/voice/receiver/VoiceReadable.js\\\":false,\\\"src/client/voice/receiver/VoiceReceiver.js\\\":false,\\\"src/client/voice/util/Secretbox.js\\\":false,\\\"src/client/voice/util/SecretKey.js\\\":false,\\\"src/client/voice/util/VolumeInterface.js\\\":false,\\\"src/client/voice/ClientVoiceManager.js\\\":false,\\\"src/client/voice/VoiceBroadcast.js\\\":false,\\\"src/client/voice/VoiceConnection.js\\\":false,\\\"src/client/voice/VoiceUDPClient.js\\\":false,\\\"src/client/voice/VoiceWebSocket.js\\\":false}}\");\n\n//# sourceURL=webpack:///./package.json?"); /***/ }), @@ -377,7 +377,7 @@ eval("module.exports = {\"name\":\"discord.js\",\"version\":\"11.5.1\",\"descrip /*! ModuleConcatenation bailout: Module is not an ECMAScript module */ /***/ (function(module, exports, __webpack_require__) { -eval("/* WEBPACK VAR INJECTION */(function(process) {const EventEmitter = __webpack_require__(/*! events */ \"./node_modules/events/events.js\");\nconst Constants = __webpack_require__(/*! ../util/Constants */ \"./src/util/Constants.js\");\nconst Permissions = __webpack_require__(/*! ../util/Permissions */ \"./src/util/Permissions.js\");\nconst Util = __webpack_require__(/*! ../util/Util */ \"./src/util/Util.js\");\nconst RESTManager = __webpack_require__(/*! ./rest/RESTManager */ \"./src/client/rest/RESTManager.js\");\nconst ClientDataManager = __webpack_require__(/*! ./ClientDataManager */ \"./src/client/ClientDataManager.js\");\nconst ClientManager = __webpack_require__(/*! ./ClientManager */ \"./src/client/ClientManager.js\");\nconst ClientDataResolver = __webpack_require__(/*! ./ClientDataResolver */ \"./src/client/ClientDataResolver.js\");\nconst ClientVoiceManager = __webpack_require__(/*! ./voice/ClientVoiceManager */ 4);\nconst WebSocketManager = __webpack_require__(/*! ./websocket/WebSocketManager */ \"./src/client/websocket/WebSocketManager.js\");\nconst ActionsManager = __webpack_require__(/*! ./actions/ActionsManager */ \"./src/client/actions/ActionsManager.js\");\nconst Collection = __webpack_require__(/*! ../util/Collection */ \"./src/util/Collection.js\");\nconst Presence = __webpack_require__(/*! ../structures/Presence */ \"./src/structures/Presence.js\").Presence;\nconst ShardClientUtil = __webpack_require__(/*! ../sharding/ShardClientUtil */ 5);\nconst VoiceBroadcast = __webpack_require__(/*! ./voice/VoiceBroadcast */ 6);\n\n/**\n * The main hub for interacting with the Discord API, and the starting point for any bot.\n * @extends {EventEmitter}\n */\nclass Client extends EventEmitter {\n /**\n * @param {ClientOptions} [options] Options for the client\n */\n constructor(options = {}) {\n super();\n\n // Obtain shard details from environment\n if (!options.shardId && 'SHARD_ID' in Object({\"__DISCORD_WEBPACK__\":\"true\"})) options.shardId = Number(Object({\"__DISCORD_WEBPACK__\":\"true\"}).SHARD_ID);\n if (!options.shardCount && 'SHARD_COUNT' in Object({\"__DISCORD_WEBPACK__\":\"true\"})) options.shardCount = Number(Object({\"__DISCORD_WEBPACK__\":\"true\"}).SHARD_COUNT);\n\n /**\n * The options the client was instantiated with\n * @type {ClientOptions}\n */\n this.options = Util.mergeDefault(Constants.DefaultOptions, options);\n this._validateOptions();\n\n /**\n * The REST manager of the client\n * @type {RESTManager}\n * @private\n */\n this.rest = new RESTManager(this);\n\n /**\n * The data manager of the client\n * @type {ClientDataManager}\n * @private\n */\n this.dataManager = new ClientDataManager(this);\n\n /**\n * The manager of the client\n * @type {ClientManager}\n * @private\n */\n this.manager = new ClientManager(this);\n\n /**\n * The WebSocket manager of the client\n * @type {WebSocketManager}\n * @private\n */\n this.ws = new WebSocketManager(this);\n\n /**\n * The data resolver of the client\n * @type {ClientDataResolver}\n * @private\n */\n this.resolver = new ClientDataResolver(this);\n\n /**\n * The action manager of the client\n * @type {ActionsManager}\n * @private\n */\n this.actions = new ActionsManager(this);\n\n /**\n * The voice manager of the client (`null` in browsers)\n * @type {?ClientVoiceManager}\n * @private\n */\n this.voice = !this.browser ? new ClientVoiceManager(this) : null;\n\n /**\n * The shard helpers for the client\n * (only if the process was spawned as a child, such as from a {@link ShardingManager})\n * @type {?ShardClientUtil}\n */\n this.shard = process.send ? ShardClientUtil.singleton(this) : null;\n\n /**\n * All of the {@link User} objects that have been cached at any point, mapped by their IDs\n * @type {Collection}\n */\n this.users = new Collection();\n\n /**\n * All of the guilds the client is currently handling, mapped by their IDs -\n * as long as sharding isn't being used, this will be *every* guild the bot is a member of\n * @type {Collection}\n */\n this.guilds = new Collection();\n\n /**\n * All of the {@link Channel}s that the client is currently handling, mapped by their IDs -\n * as long as sharding isn't being used, this will be *every* channel in *every* guild, and all DM channels\n * @type {Collection}\n */\n this.channels = new Collection();\n\n /**\n * Presences that have been received for the client user's friends, mapped by user IDs\n * This is only filled when using a user account.\n * @type {Collection}\n * @deprecated\n */\n this.presences = new Collection();\n\n Object.defineProperty(this, 'token', { writable: true });\n if (!this.token && 'CLIENT_TOKEN' in Object({\"__DISCORD_WEBPACK__\":\"true\"})) {\n /**\n * Authorization token for the logged in user/bot\n * This should be kept private at all times.\n * @type {?string}\n */\n this.token = Object({\"__DISCORD_WEBPACK__\":\"true\"}).CLIENT_TOKEN;\n } else {\n this.token = null;\n }\n\n /**\n * User that the client is logged in as\n * @type {?ClientUser}\n */\n this.user = null;\n\n /**\n * Time at which the client was last regarded as being in the `READY` state\n * (each time the client disconnects and successfully reconnects, this will be overwritten)\n * @type {?Date}\n */\n this.readyAt = null;\n\n /**\n * Active voice broadcasts that have been created\n * @type {VoiceBroadcast[]}\n */\n this.broadcasts = [];\n\n /**\n * Previous heartbeat pings of the websocket (most recent first, limited to three elements)\n * @type {number[]}\n */\n this.pings = [];\n\n /**\n * Timeouts set by {@link Client#setTimeout} that are still active\n * @type {Set}\n * @private\n */\n this._timeouts = new Set();\n\n /**\n * Intervals set by {@link Client#setInterval} that are still active\n * @type {Set}\n * @private\n */\n this._intervals = new Set();\n\n if (this.options.messageSweepInterval > 0) {\n this.setInterval(this.sweepMessages.bind(this), this.options.messageSweepInterval * 1000);\n }\n }\n\n /**\n * Timestamp of the latest ping's start time\n * @type {number}\n * @private\n */\n get _pingTimestamp() {\n return this.ws.connection ? this.ws.connection.lastPingTimestamp : 0;\n }\n\n /**\n * Current status of the client's connection to Discord\n * @type {Status}\n * @readonly\n */\n get status() {\n return this.ws.connection ? this.ws.connection.status : Constants.Status.IDLE;\n }\n\n /**\n * How long it has been since the client last entered the `READY` state in milliseconds\n * @type {?number}\n * @readonly\n */\n get uptime() {\n return this.readyAt ? Date.now() - this.readyAt : null;\n }\n\n /**\n * Average heartbeat ping of the websocket, obtained by averaging the {@link Client#pings} property\n * @type {number}\n * @readonly\n */\n get ping() {\n return this.pings.reduce((prev, p) => prev + p, 0) / this.pings.length;\n }\n\n /**\n * All active voice connections that have been established, mapped by guild ID\n * @type {Collection}\n * @readonly\n */\n get voiceConnections() {\n if (this.browser) return new Collection();\n return this.voice.connections;\n }\n\n /**\n * All custom emojis that the client has access to, mapped by their IDs\n * @type {Collection}\n * @readonly\n */\n get emojis() {\n const emojis = new Collection();\n for (const guild of this.guilds.values()) {\n for (const emoji of guild.emojis.values()) emojis.set(emoji.id, emoji);\n }\n return emojis;\n }\n\n /**\n * Timestamp of the time the client was last `READY` at\n * @type {?number}\n * @readonly\n */\n get readyTimestamp() {\n return this.readyAt ? this.readyAt.getTime() : null;\n }\n\n /**\n * Whether the client is in a browser environment\n * @type {boolean}\n * @readonly\n */\n get browser() {\n return typeof window !== 'undefined';\n }\n\n /**\n * Creates a voice broadcast.\n * @returns {VoiceBroadcast}\n */\n createVoiceBroadcast() {\n const broadcast = new VoiceBroadcast(this);\n this.broadcasts.push(broadcast);\n return broadcast;\n }\n\n /**\n * Logs the client in, establishing a websocket connection to Discord.\n * Both bot and regular user accounts are supported, but it is highly recommended to use a bot account whenever\n * possible. User accounts are subject to harsher ratelimits and other restrictions that don't apply to bot accounts.\n * Bot accounts also have access to many features that user accounts cannot utilise. Automating a user account is\n * considered a violation of the ToS.\n * @param {string} token Token of the account to log in with\n * @returns {Promise} Token of the account used\n * @example\n * client.login('my token')\n * .then(console.log)\n * .catch(console.error);\n */\n login(token = this.token) {\n return this.rest.methods.login(token);\n }\n\n /**\n * Logs out, terminates the connection to Discord, and destroys the client.\n * @returns {Promise}\n */\n destroy() {\n for (const t of this._timeouts) clearTimeout(t);\n for (const i of this._intervals) clearInterval(i);\n this._timeouts.clear();\n this._intervals.clear();\n return this.manager.destroy();\n }\n\n /**\n * Requests a sync of guild data with Discord.\n * This can be done automatically every 30 seconds by enabling {@link ClientOptions#sync}.\n * This is only available when using a user account.\n * @param {Guild[]|Collection} [guilds=this.guilds] An array or collection of guilds to sync\n * @deprecated\n */\n syncGuilds(guilds = this.guilds) {\n if (this.user.bot) return;\n this.ws.send({\n op: 12,\n d: guilds instanceof Collection ? guilds.keyArray() : guilds.map(g => g.id),\n });\n }\n\n /**\n * Obtains a user from Discord, or the user cache if it's already available.\n * This is only available when using a bot account.\n * @param {Snowflake} id ID of the user\n * @param {boolean} [cache=true] Whether to cache the new user object if it isn't already\n * @returns {Promise}\n */\n fetchUser(id, cache = true) {\n if (this.users.has(id)) return Promise.resolve(this.users.get(id));\n return this.rest.methods.getUser(id, cache);\n }\n\n /**\n * Obtains an invite from Discord.\n * @param {InviteResolvable} invite Invite code or URL\n * @returns {Promise}\n * @example\n * client.fetchInvite('https://discord.gg/bRCvFy9')\n * .then(invite => console.log(`Obtained invite with code: ${invite.code}`))\n * .catch(console.error);\n */\n fetchInvite(invite) {\n const code = this.resolver.resolveInviteCode(invite);\n return this.rest.methods.getInvite(code);\n }\n\n /**\n * Obtains a webhook from Discord.\n * @param {Snowflake} id ID of the webhook\n * @param {string} [token] Token for the webhook\n * @returns {Promise}\n * @example\n * client.fetchWebhook('id', 'token')\n * .then(webhook => console.log(`Obtained webhook with name: ${webhook.name}`))\n * .catch(console.error);\n */\n fetchWebhook(id, token) {\n return this.rest.methods.getWebhook(id, token);\n }\n\n /**\n * Obtains the available voice regions from Discord.\n * @returns {Collection}\n * @example\n * client.fetchVoiceRegions()\n * .then(regions => console.log(`Available regions are: ${regions.map(region => region.name).join(', ')}`))\n * .catch(console.error);\n */\n fetchVoiceRegions() {\n return this.rest.methods.fetchVoiceRegions();\n }\n\n /**\n * Sweeps all text-based channels' messages and removes the ones older than the max message lifetime.\n * If the message has been edited, the time of the edit is used rather than the time of the original message.\n * @param {number} [lifetime=this.options.messageCacheLifetime] Messages that are older than this (in seconds)\n * will be removed from the caches. The default is based on {@link ClientOptions#messageCacheLifetime}\n * @returns {number} Amount of messages that were removed from the caches,\n * or -1 if the message cache lifetime is unlimited\n */\n sweepMessages(lifetime = this.options.messageCacheLifetime) {\n if (typeof lifetime !== 'number' || isNaN(lifetime)) throw new TypeError('The lifetime must be a number.');\n if (lifetime <= 0) {\n this.emit('debug', 'Didn\\'t sweep messages - lifetime is unlimited');\n return -1;\n }\n\n const lifetimeMs = lifetime * 1000;\n const now = Date.now();\n let channels = 0;\n let messages = 0;\n\n for (const channel of this.channels.values()) {\n if (!channel.messages) continue;\n channels++;\n\n messages += channel.messages.sweep(\n message => now - (message.editedTimestamp || message.createdTimestamp) > lifetimeMs\n );\n }\n\n this.emit('debug', `Swept ${messages} messages older than ${lifetime} seconds in ${channels} text-based channels`);\n return messages;\n }\n\n /**\n * Obtains the OAuth Application of the bot from Discord.\n * Bots can only fetch their own profile.\n * @param {Snowflake} [id='@me'] ID of application to fetch\n * @returns {Promise}\n * @example\n * client.fetchApplication()\n * .then(application => console.log(`Obtained application with name: ${application.name}`))\n * .catch(console.error);\n */\n fetchApplication(id = '@me') {\n if (id !== '@me') ((any, ...more) => console.warn(any, more))('fetchApplication: use \"@me\" as an argument', 'DeprecationWarning');\n return this.rest.methods.getApplication(id);\n }\n\n /**\n * Generates a link that can be used to invite the bot to a guild.\n * This is only available when using a bot account.\n * @param {PermissionResolvable} [permissions] Permissions to request\n * @returns {Promise}\n * @example\n * client.generateInvite(['SEND_MESSAGES', 'MANAGE_GUILD', 'MENTION_EVERYONE'])\n * .then(link => console.log(`Generated bot invite link: ${link}`))\n * .catch(console.error);\n */\n generateInvite(permissions) {\n permissions = typeof permissions === 'undefined' ? 0 : Permissions.resolve(permissions);\n return this.fetchApplication().then(application =>\n `https://discordapp.com/oauth2/authorize?client_id=${application.id}&permissions=${permissions}&scope=bot`\n );\n }\n\n /**\n * Sets a timeout that will be automatically cancelled if the client is destroyed.\n * @param {Function} fn Function to execute\n * @param {number} delay Time to wait before executing (in milliseconds)\n * @param {...*} args Arguments for the function\n * @returns {Timeout}\n */\n setTimeout(fn, delay, ...args) {\n const timeout = setTimeout(() => {\n fn(...args);\n this._timeouts.delete(timeout);\n }, delay);\n this._timeouts.add(timeout);\n return timeout;\n }\n\n /**\n * Clears a timeout.\n * @param {Timeout} timeout Timeout to cancel\n */\n clearTimeout(timeout) {\n clearTimeout(timeout);\n this._timeouts.delete(timeout);\n }\n\n /**\n * Sets an interval that will be automatically cancelled if the client is destroyed.\n * @param {Function} fn Function to execute\n * @param {number} delay Time to wait before executing (in milliseconds)\n * @param {...*} args Arguments for the function\n * @returns {Timeout}\n */\n setInterval(fn, delay, ...args) {\n const interval = setInterval(fn, delay, ...args);\n this._intervals.add(interval);\n return interval;\n }\n\n /**\n * Clears an interval.\n * @param {Timeout} interval Interval to cancel\n */\n clearInterval(interval) {\n clearInterval(interval);\n this._intervals.delete(interval);\n }\n\n /**\n * Adds a ping to {@link Client#pings}.\n * @param {number} startTime Starting time of the ping\n * @private\n */\n _pong(startTime) {\n this.pings.unshift(Date.now() - startTime);\n if (this.pings.length > 3) this.pings.length = 3;\n this.ws.lastHeartbeatAck = true;\n }\n\n /**\n * Adds/updates a friend's presence in {@link Client#presences}.\n * @param {Snowflake} id ID of the user\n * @param {Object} presence Raw presence object from Discord\n * @private\n */\n _setPresence(id, presence) {\n if (this.presences.has(id)) {\n this.presences.get(id).update(presence);\n return;\n }\n this.presences.set(id, new Presence(presence, this));\n }\n\n /**\n * Calls {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/eval} on a script\n * with the client as `this`.\n * @param {string} script Script to eval\n * @returns {*}\n * @private\n */\n _eval(script) {\n return eval(script);\n }\n\n /**\n * Validates the client options.\n * @param {ClientOptions} [options=this.options] Options to validate\n * @private\n */\n _validateOptions(options = this.options) { // eslint-disable-line complexity\n if (typeof options.shardCount !== 'number' || isNaN(options.shardCount)) {\n throw new TypeError('The shardCount option must be a number.');\n }\n if (typeof options.shardId !== 'number' || isNaN(options.shardId)) {\n throw new TypeError('The shardId option must be a number.');\n }\n if (options.shardCount < 0) throw new RangeError('The shardCount option must be at least 0.');\n if (options.shardId < 0) throw new RangeError('The shardId option must be at least 0.');\n if (options.shardId !== 0 && options.shardId >= options.shardCount) {\n throw new RangeError('The shardId option must be less than shardCount.');\n }\n if (typeof options.messageCacheMaxSize !== 'number' || isNaN(options.messageCacheMaxSize)) {\n throw new TypeError('The messageCacheMaxSize option must be a number.');\n }\n if (typeof options.messageCacheLifetime !== 'number' || isNaN(options.messageCacheLifetime)) {\n throw new TypeError('The messageCacheLifetime option must be a number.');\n }\n if (typeof options.messageSweepInterval !== 'number' || isNaN(options.messageSweepInterval)) {\n throw new TypeError('The messageSweepInterval option must be a number.');\n }\n if (typeof options.fetchAllMembers !== 'boolean') {\n throw new TypeError('The fetchAllMembers option must be a boolean.');\n }\n if (typeof options.disableEveryone !== 'boolean') {\n throw new TypeError('The disableEveryone option must be a boolean.');\n }\n if (typeof options.restWsBridgeTimeout !== 'number' || isNaN(options.restWsBridgeTimeout)) {\n throw new TypeError('The restWsBridgeTimeout option must be a number.');\n }\n if (!(options.disabledEvents instanceof Array)) throw new TypeError('The disabledEvents option must be an Array.');\n if (typeof options.retryLimit !== 'number' || isNaN(options.retryLimit)) {\n throw new TypeError('The retryLimit options must be a number.');\n }\n }\n}\n\nmodule.exports = Client;\n\n/**\n * Emitted for general warnings.\n * @event Client#warn\n * @param {string} info The warning\n */\n\n/**\n * Emitted for general debugging information.\n * @event Client#debug\n * @param {string} info The debug information\n */\n\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../node_modules/process/browser.js */ \"./node_modules/process/browser.js\")))\n\n//# sourceURL=webpack:///./src/client/Client.js?"); +eval("/* WEBPACK VAR INJECTION */(function(process) {const EventEmitter = __webpack_require__(/*! events */ \"./node_modules/events/events.js\");\nconst Constants = __webpack_require__(/*! ../util/Constants */ \"./src/util/Constants.js\");\nconst Permissions = __webpack_require__(/*! ../util/Permissions */ \"./src/util/Permissions.js\");\nconst Util = __webpack_require__(/*! ../util/Util */ \"./src/util/Util.js\");\nconst RESTManager = __webpack_require__(/*! ./rest/RESTManager */ \"./src/client/rest/RESTManager.js\");\nconst ClientDataManager = __webpack_require__(/*! ./ClientDataManager */ \"./src/client/ClientDataManager.js\");\nconst ClientManager = __webpack_require__(/*! ./ClientManager */ \"./src/client/ClientManager.js\");\nconst ClientDataResolver = __webpack_require__(/*! ./ClientDataResolver */ \"./src/client/ClientDataResolver.js\");\nconst ClientVoiceManager = __webpack_require__(/*! ./voice/ClientVoiceManager */ 4);\nconst WebSocketManager = __webpack_require__(/*! ./websocket/WebSocketManager */ \"./src/client/websocket/WebSocketManager.js\");\nconst ActionsManager = __webpack_require__(/*! ./actions/ActionsManager */ \"./src/client/actions/ActionsManager.js\");\nconst Collection = __webpack_require__(/*! ../util/Collection */ \"./src/util/Collection.js\");\nconst Presence = __webpack_require__(/*! ../structures/Presence */ \"./src/structures/Presence.js\").Presence;\nconst ShardClientUtil = __webpack_require__(/*! ../sharding/ShardClientUtil */ 5);\nconst VoiceBroadcast = __webpack_require__(/*! ./voice/VoiceBroadcast */ 6);\n\n/**\n * The main hub for interacting with the Discord API, and the starting point for any bot.\n * @extends {EventEmitter}\n */\nclass Client extends EventEmitter {\n /**\n * @param {ClientOptions} [options] Options for the client\n */\n constructor(options = {}) {\n super();\n\n // Obtain shard details from environment\n if (!options.shardId && 'SHARD_ID' in Object({\"__DISCORD_WEBPACK__\":\"true\"})) options.shardId = Number(Object({\"__DISCORD_WEBPACK__\":\"true\"}).SHARD_ID);\n if (!options.shardCount && 'SHARD_COUNT' in Object({\"__DISCORD_WEBPACK__\":\"true\"})) options.shardCount = Number(Object({\"__DISCORD_WEBPACK__\":\"true\"}).SHARD_COUNT);\n\n /**\n * The options the client was instantiated with\n * @type {ClientOptions}\n */\n this.options = Util.mergeDefault(Constants.DefaultOptions, options);\n this._validateOptions();\n\n /**\n * The REST manager of the client\n * @type {RESTManager}\n * @private\n */\n this.rest = new RESTManager(this);\n\n /**\n * The data manager of the client\n * @type {ClientDataManager}\n * @private\n */\n this.dataManager = new ClientDataManager(this);\n\n /**\n * The manager of the client\n * @type {ClientManager}\n * @private\n */\n this.manager = new ClientManager(this);\n\n /**\n * The WebSocket manager of the client\n * @type {WebSocketManager}\n * @private\n */\n this.ws = new WebSocketManager(this);\n\n /**\n * The data resolver of the client\n * @type {ClientDataResolver}\n * @private\n */\n this.resolver = new ClientDataResolver(this);\n\n /**\n * The action manager of the client\n * @type {ActionsManager}\n * @private\n */\n this.actions = new ActionsManager(this);\n\n /**\n * The voice manager of the client (`null` in browsers)\n * @type {?ClientVoiceManager}\n * @private\n */\n this.voice = !this.browser ? new ClientVoiceManager(this) : null;\n\n /**\n * The shard helpers for the client\n * (only if the process was spawned as a child, such as from a {@link ShardingManager})\n * @type {?ShardClientUtil}\n */\n this.shard = process.send ? ShardClientUtil.singleton(this) : null;\n\n /**\n * All of the {@link User} objects that have been cached at any point, mapped by their IDs\n * @type {Collection}\n */\n this.users = new Collection();\n\n /**\n * All of the guilds the client is currently handling, mapped by their IDs -\n * as long as sharding isn't being used, this will be *every* guild the bot is a member of\n * @type {Collection}\n */\n this.guilds = new Collection();\n\n /**\n * All of the {@link Channel}s that the client is currently handling, mapped by their IDs -\n * as long as sharding isn't being used, this will be *every* channel in *every* guild, and all DM channels\n * @type {Collection}\n */\n this.channels = new Collection();\n\n /**\n * Presences that have been received for the client user's friends, mapped by user IDs\n * This is only filled when using a user account.\n * @type {Collection}\n * @deprecated\n */\n this.presences = new Collection();\n\n Object.defineProperty(this, 'token', { writable: true });\n if (!this.token && 'CLIENT_TOKEN' in Object({\"__DISCORD_WEBPACK__\":\"true\"})) {\n /**\n * Authorization token for the logged in user/bot\n * This should be kept private at all times.\n * @type {?string}\n */\n this.token = Object({\"__DISCORD_WEBPACK__\":\"true\"}).CLIENT_TOKEN;\n } else {\n this.token = null;\n }\n\n /**\n * User that the client is logged in as\n * @type {?ClientUser}\n */\n this.user = null;\n\n /**\n * Time at which the client was last regarded as being in the `READY` state\n * (each time the client disconnects and successfully reconnects, this will be overwritten)\n * @type {?Date}\n */\n this.readyAt = null;\n\n /**\n * Active voice broadcasts that have been created\n * @type {VoiceBroadcast[]}\n */\n this.broadcasts = [];\n\n /**\n * Previous heartbeat pings of the websocket (most recent first, limited to three elements)\n * @type {number[]}\n */\n this.pings = [];\n\n /**\n * Timeouts set by {@link Client#setTimeout} that are still active\n * @type {Set}\n * @private\n */\n this._timeouts = new Set();\n\n /**\n * Intervals set by {@link Client#setInterval} that are still active\n * @type {Set}\n * @private\n */\n this._intervals = new Set();\n\n if (this.options.messageSweepInterval > 0) {\n this.setInterval(this.sweepMessages.bind(this), this.options.messageSweepInterval * 1000);\n }\n }\n\n /**\n * Timestamp of the latest ping's start time\n * @type {number}\n * @private\n */\n get _pingTimestamp() {\n return this.ws.connection ? this.ws.connection.lastPingTimestamp : 0;\n }\n\n /**\n * Current status of the client's connection to Discord\n * @type {Status}\n * @readonly\n */\n get status() {\n return this.ws.connection ? this.ws.connection.status : Constants.Status.IDLE;\n }\n\n /**\n * How long it has been since the client last entered the `READY` state in milliseconds\n * @type {?number}\n * @readonly\n */\n get uptime() {\n return this.readyAt ? Date.now() - this.readyAt : null;\n }\n\n /**\n * Average heartbeat ping of the websocket, obtained by averaging the {@link Client#pings} property\n * @type {number}\n * @readonly\n */\n get ping() {\n return this.pings.reduce((prev, p) => prev + p, 0) / this.pings.length;\n }\n\n /**\n * All active voice connections that have been established, mapped by guild ID\n * @type {Collection}\n * @readonly\n */\n get voiceConnections() {\n if (this.browser) return new Collection();\n return this.voice.connections;\n }\n\n /**\n * All custom emojis that the client has access to, mapped by their IDs\n * @type {Collection}\n * @readonly\n */\n get emojis() {\n const emojis = new Collection();\n for (const guild of this.guilds.values()) {\n for (const emoji of guild.emojis.values()) emojis.set(emoji.id, emoji);\n }\n return emojis;\n }\n\n /**\n * Timestamp of the time the client was last `READY` at\n * @type {?number}\n * @readonly\n */\n get readyTimestamp() {\n return this.readyAt ? this.readyAt.getTime() : null;\n }\n\n /**\n * Whether the client is in a browser environment\n * @type {boolean}\n * @readonly\n */\n get browser() {\n return typeof window !== 'undefined';\n }\n\n /**\n * Creates a voice broadcast.\n * @returns {VoiceBroadcast}\n */\n createVoiceBroadcast() {\n const broadcast = new VoiceBroadcast(this);\n this.broadcasts.push(broadcast);\n return broadcast;\n }\n\n /**\n * Logs the client in, establishing a websocket connection to Discord.\n * Both bot and regular user accounts are supported, but it is highly recommended to use a bot account whenever\n * possible. User accounts are subject to harsher ratelimits and other restrictions that don't apply to bot accounts.\n * Bot accounts also have access to many features that user accounts cannot utilise. Automating a user account is\n * considered a violation of Discord's ToS.\n * @param {string} token Token of the account to log in with\n * @returns {Promise} Token of the account used\n * @example\n * client.login('my token')\n * .then(console.log)\n * .catch(console.error);\n */\n login(token = this.token) {\n return this.rest.methods.login(token);\n }\n\n /**\n * Logs out, terminates the connection to Discord, and destroys the client.\n * @returns {Promise}\n */\n destroy() {\n for (const t of this._timeouts) clearTimeout(t);\n for (const i of this._intervals) clearInterval(i);\n this._timeouts.clear();\n this._intervals.clear();\n return this.manager.destroy();\n }\n\n /**\n * Requests a sync of guild data with Discord.\n * This can be done automatically every 30 seconds by enabling {@link ClientOptions#sync}.\n * This is only available when using a user account.\n * @param {Guild[]|Collection} [guilds=this.guilds] An array or collection of guilds to sync\n * @deprecated\n */\n syncGuilds(guilds = this.guilds) {\n if (this.user.bot) return;\n this.ws.send({\n op: 12,\n d: guilds instanceof Collection ? guilds.keyArray() : guilds.map(g => g.id),\n });\n }\n\n /**\n * Obtains a user from Discord, or the user cache if it's already available.\n * This is only available when using a bot account.\n * @param {Snowflake} id ID of the user\n * @param {boolean} [cache=true] Whether to cache the new user object if it isn't already\n * @returns {Promise}\n */\n fetchUser(id, cache = true) {\n if (this.users.has(id)) return Promise.resolve(this.users.get(id));\n return this.rest.methods.getUser(id, cache);\n }\n\n /**\n * Obtains an invite from Discord.\n * @param {InviteResolvable} invite Invite code or URL\n * @returns {Promise}\n * @example\n * client.fetchInvite('https://discord.gg/bRCvFy9')\n * .then(invite => console.log(`Obtained invite with code: ${invite.code}`))\n * .catch(console.error);\n */\n fetchInvite(invite) {\n const code = this.resolver.resolveInviteCode(invite);\n return this.rest.methods.getInvite(code);\n }\n\n /**\n * Obtains a webhook from Discord.\n * @param {Snowflake} id ID of the webhook\n * @param {string} [token] Token for the webhook\n * @returns {Promise}\n * @example\n * client.fetchWebhook('id', 'token')\n * .then(webhook => console.log(`Obtained webhook with name: ${webhook.name}`))\n * .catch(console.error);\n */\n fetchWebhook(id, token) {\n return this.rest.methods.getWebhook(id, token);\n }\n\n /**\n * Obtains the available voice regions from Discord.\n * @returns {Promise>}\n * @example\n * client.fetchVoiceRegions()\n * .then(regions => console.log(`Available regions are: ${regions.map(region => region.name).join(', ')}`))\n * .catch(console.error);\n */\n fetchVoiceRegions() {\n return this.rest.methods.fetchVoiceRegions();\n }\n\n /**\n * Sweeps all text-based channels' messages and removes the ones older than the max message lifetime.\n * If the message has been edited, the time of the edit is used rather than the time of the original message.\n * @param {number} [lifetime=this.options.messageCacheLifetime] Messages that are older than this (in seconds)\n * will be removed from the caches. The default is based on {@link ClientOptions#messageCacheLifetime}\n * @returns {number} Amount of messages that were removed from the caches,\n * or -1 if the message cache lifetime is unlimited\n */\n sweepMessages(lifetime = this.options.messageCacheLifetime) {\n if (typeof lifetime !== 'number' || isNaN(lifetime)) throw new TypeError('The lifetime must be a number.');\n if (lifetime <= 0) {\n this.emit('debug', 'Didn\\'t sweep messages - lifetime is unlimited');\n return -1;\n }\n\n const lifetimeMs = lifetime * 1000;\n const now = Date.now();\n let channels = 0;\n let messages = 0;\n\n for (const channel of this.channels.values()) {\n if (!channel.messages) continue;\n channels++;\n\n messages += channel.messages.sweep(\n message => now - (message.editedTimestamp || message.createdTimestamp) > lifetimeMs\n );\n }\n\n this.emit('debug', `Swept ${messages} messages older than ${lifetime} seconds in ${channels} text-based channels`);\n return messages;\n }\n\n /**\n * Obtains the OAuth Application of the bot from Discord.\n * Bots can only fetch their own profile.\n * @param {Snowflake} [id='@me'] ID of application to fetch\n * @returns {Promise}\n * @example\n * client.fetchApplication()\n * .then(application => console.log(`Obtained application with name: ${application.name}`))\n * .catch(console.error);\n */\n fetchApplication(id = '@me') {\n if (id !== '@me') ((any, ...more) => console.warn(any, more))('fetchApplication: use \"@me\" as an argument', 'DeprecationWarning');\n return this.rest.methods.getApplication(id);\n }\n\n /**\n * Generates a link that can be used to invite the bot to a guild.\n * This is only available when using a bot account.\n * @param {PermissionResolvable} [permissions] Permissions to request\n * @returns {Promise}\n * @example\n * client.generateInvite(['SEND_MESSAGES', 'MANAGE_GUILD', 'MENTION_EVERYONE'])\n * .then(link => console.log(`Generated bot invite link: ${link}`))\n * .catch(console.error);\n */\n generateInvite(permissions) {\n permissions = Permissions.resolve(permissions);\n return this.fetchApplication().then(application =>\n `https://discordapp.com/oauth2/authorize?client_id=${application.id}&permissions=${permissions}&scope=bot`\n );\n }\n\n /**\n * Sets a timeout that will be automatically cancelled if the client is destroyed.\n * @param {Function} fn Function to execute\n * @param {number} delay Time to wait before executing (in milliseconds)\n * @param {...*} args Arguments for the function\n * @returns {Timeout}\n */\n setTimeout(fn, delay, ...args) {\n const timeout = setTimeout(() => {\n fn(...args);\n this._timeouts.delete(timeout);\n }, delay);\n this._timeouts.add(timeout);\n return timeout;\n }\n\n /**\n * Clears a timeout.\n * @param {Timeout} timeout Timeout to cancel\n */\n clearTimeout(timeout) {\n clearTimeout(timeout);\n this._timeouts.delete(timeout);\n }\n\n /**\n * Sets an interval that will be automatically cancelled if the client is destroyed.\n * @param {Function} fn Function to execute\n * @param {number} delay Time to wait before executing (in milliseconds)\n * @param {...*} args Arguments for the function\n * @returns {Timeout}\n */\n setInterval(fn, delay, ...args) {\n const interval = setInterval(fn, delay, ...args);\n this._intervals.add(interval);\n return interval;\n }\n\n /**\n * Clears an interval.\n * @param {Timeout} interval Interval to cancel\n */\n clearInterval(interval) {\n clearInterval(interval);\n this._intervals.delete(interval);\n }\n\n /**\n * Adds a ping to {@link Client#pings}.\n * @param {number} startTime Starting time of the ping\n * @private\n */\n _pong(startTime) {\n this.pings.unshift(Date.now() - startTime);\n if (this.pings.length > 3) this.pings.length = 3;\n this.ws.lastHeartbeatAck = true;\n }\n\n /**\n * Adds/updates a friend's presence in {@link Client#presences}.\n * @param {Snowflake} id ID of the user\n * @param {Object} presence Raw presence object from Discord\n * @private\n */\n _setPresence(id, presence) {\n if (this.presences.has(id)) {\n this.presences.get(id).update(presence);\n return;\n }\n this.presences.set(id, new Presence(presence, this));\n }\n\n /**\n * Calls {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/eval} on a script\n * with the client as `this`.\n * @param {string} script Script to eval\n * @returns {*}\n * @private\n */\n _eval(script) {\n return eval(script);\n }\n\n /**\n * Validates the client options.\n * @param {ClientOptions} [options=this.options] Options to validate\n * @private\n */\n _validateOptions(options = this.options) { // eslint-disable-line complexity\n if (typeof options.shardCount !== 'number' || isNaN(options.shardCount)) {\n throw new TypeError('The shardCount option must be a number.');\n }\n if (typeof options.shardId !== 'number' || isNaN(options.shardId)) {\n throw new TypeError('The shardId option must be a number.');\n }\n if (options.shardCount < 0) throw new RangeError('The shardCount option must be at least 0.');\n if (options.shardId < 0) throw new RangeError('The shardId option must be at least 0.');\n if (options.shardId !== 0 && options.shardId >= options.shardCount) {\n throw new RangeError('The shardId option must be less than shardCount.');\n }\n if (typeof options.messageCacheMaxSize !== 'number' || isNaN(options.messageCacheMaxSize)) {\n throw new TypeError('The messageCacheMaxSize option must be a number.');\n }\n if (typeof options.messageCacheLifetime !== 'number' || isNaN(options.messageCacheLifetime)) {\n throw new TypeError('The messageCacheLifetime option must be a number.');\n }\n if (typeof options.messageSweepInterval !== 'number' || isNaN(options.messageSweepInterval)) {\n throw new TypeError('The messageSweepInterval option must be a number.');\n }\n if (typeof options.fetchAllMembers !== 'boolean') {\n throw new TypeError('The fetchAllMembers option must be a boolean.');\n }\n if (typeof options.disableEveryone !== 'boolean') {\n throw new TypeError('The disableEveryone option must be a boolean.');\n }\n if (typeof options.restWsBridgeTimeout !== 'number' || isNaN(options.restWsBridgeTimeout)) {\n throw new TypeError('The restWsBridgeTimeout option must be a number.');\n }\n if (!(options.disabledEvents instanceof Array)) throw new TypeError('The disabledEvents option must be an Array.');\n if (typeof options.retryLimit !== 'number' || isNaN(options.retryLimit)) {\n throw new TypeError('The retryLimit options must be a number.');\n }\n }\n}\n\nmodule.exports = Client;\n\n/**\n * Emitted for general warnings.\n * @event Client#warn\n * @param {string} info The warning\n */\n\n/**\n * Emitted for general debugging information.\n * @event Client#debug\n * @param {string} info The debug information\n */\n\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../node_modules/process/browser.js */ \"./node_modules/process/browser.js\")))\n\n//# sourceURL=webpack:///./src/client/Client.js?"); /***/ }), @@ -401,7 +401,7 @@ eval("const Constants = __webpack_require__(/*! ../util/Constants */ \"./src/uti /*! ModuleConcatenation bailout: Module is not an ECMAScript module */ /***/ (function(module, exports, __webpack_require__) { -eval("/* WEBPACK VAR INJECTION */(function(Buffer) {const path = __webpack_require__(/*! path */ \"./node_modules/path-browserify/index.js\");\nconst fs = __webpack_require__(/*! fs */ \"./node_modules/node-libs-browser/mock/empty.js\");\nconst snekfetch = __webpack_require__(/*! snekfetch */ \"./node_modules/snekfetch/esm.mjs\");\n\nconst Constants = __webpack_require__(/*! ../util/Constants */ \"./src/util/Constants.js\");\nconst convertToBuffer = __webpack_require__(/*! ../util/Util */ \"./src/util/Util.js\").convertToBuffer;\nconst User = __webpack_require__(/*! ../structures/User */ \"./src/structures/User.js\");\nconst Message = __webpack_require__(/*! ../structures/Message */ \"./src/structures/Message.js\");\nconst Guild = __webpack_require__(/*! ../structures/Guild */ \"./src/structures/Guild.js\");\nconst Channel = __webpack_require__(/*! ../structures/Channel */ \"./src/structures/Channel.js\");\nconst GuildMember = __webpack_require__(/*! ../structures/GuildMember */ \"./src/structures/GuildMember.js\");\nconst Emoji = __webpack_require__(/*! ../structures/Emoji */ \"./src/structures/Emoji.js\");\nconst ReactionEmoji = __webpack_require__(/*! ../structures/ReactionEmoji */ \"./src/structures/ReactionEmoji.js\");\nconst Role = __webpack_require__(/*! ../structures/Role */ \"./src/structures/Role.js\");\n\n/**\n * The DataResolver identifies different objects and tries to resolve a specific piece of information from them, e.g.\n * extracting a User from a Message object.\n * @private\n */\nclass ClientDataResolver {\n /**\n * @param {Client} client The client the resolver is for\n */\n constructor(client) {\n this.client = client;\n }\n\n /**\n * Data that resolves to give a User object. This can be:\n * * A User object\n * * A Snowflake\n * * A Message object (resolves to the message author)\n * * A Guild object (owner of the guild)\n * * A GuildMember object\n * @typedef {User|Snowflake|Message|Guild|GuildMember} UserResolvable\n */\n\n /**\n * Resolves a UserResolvable to a User object.\n * @param {UserResolvable} user The UserResolvable to identify\n * @returns {?User}\n */\n resolveUser(user) {\n if (user instanceof User) return user;\n if (typeof user === 'string') return this.client.users.get(user) || null;\n if (user instanceof GuildMember) return user.user;\n if (user instanceof Message) return user.author;\n if (user instanceof Guild) return user.owner;\n return null;\n }\n\n /**\n * Resolves a UserResolvable to a user ID string.\n * @param {UserResolvable} user The UserResolvable to identify\n * @returns {?Snowflake}\n */\n resolveUserID(user) {\n if (user instanceof User || user instanceof GuildMember) return user.id;\n if (typeof user === 'string') return user || null;\n if (user instanceof Message) return user.author.id;\n if (user instanceof Guild) return user.ownerID;\n return null;\n }\n\n /**\n * Data that resolves to give a Guild object. This can be:\n * * A Guild object\n * * A Snowflake\n * @typedef {Guild|Snowflake} GuildResolvable\n */\n\n /**\n * Resolves a GuildResolvable to a Guild object.\n * @param {GuildResolvable} guild The GuildResolvable to identify\n * @returns {?Guild}\n */\n resolveGuild(guild) {\n if (guild instanceof Guild) return guild;\n if (typeof guild === 'string') return this.client.guilds.get(guild) || null;\n return null;\n }\n\n /**\n * Data that resolves to give a GuildMember object. This can be:\n * * A GuildMember object\n * * A User object\n * @typedef {GuildMember|User} GuildMemberResolvable\n */\n\n /**\n * Resolves a GuildMemberResolvable to a GuildMember object.\n * @param {GuildResolvable} guild The guild that the member is part of\n * @param {UserResolvable} user The user that is part of the guild\n * @returns {?GuildMember}\n */\n resolveGuildMember(guild, user) {\n if (user instanceof GuildMember) return user;\n guild = this.resolveGuild(guild);\n user = this.resolveUser(user);\n if (!guild || !user) return null;\n return guild.members.get(user.id) || null;\n }\n\n /**\n * Data that can be resolved to a Role object. This can be:\n * * A Role\n * * A Snowflake\n * @typedef {Role|Snowflake} RoleResolvable\n */\n\n /**\n * Resolves a RoleResolvable to a Role object.\n * @param {GuildResolvable} guild The guild that this role is part of\n * @param {RoleResolvable} role The role resolvable to resolve\n * @returns {?Role}\n */\n resolveRole(guild, role) {\n if (role instanceof Role) return role;\n guild = this.resolveGuild(guild);\n if (!guild) return null;\n if (typeof role === 'string') return guild.roles.get(role);\n return null;\n }\n\n /**\n * Data that can be resolved to give a Channel object. This can be:\n * * A Channel object\n * * A Message object (the channel the message was sent in)\n * * A Guild object (the #general channel)\n * * A Snowflake\n * @typedef {Channel|Guild|Message|Snowflake} ChannelResolvable\n */\n\n /**\n * Resolves a ChannelResolvable to a Channel object.\n * @param {ChannelResolvable} channel The channel resolvable to resolve\n * @returns {?Channel}\n */\n resolveChannel(channel) {\n if (channel instanceof Channel) return channel;\n if (typeof channel === 'string') return this.client.channels.get(channel) || null;\n if (channel instanceof Message) return channel.channel;\n if (channel instanceof Guild) return channel.channels.get(channel.id) || null;\n return null;\n }\n\n /**\n * Resolves a ChannelResolvable to a channel ID.\n * @param {ChannelResolvable} channel The channel resolvable to resolve\n * @returns {?Snowflake}\n */\n resolveChannelID(channel) {\n if (channel instanceof Channel) return channel.id;\n if (typeof channel === 'string') return channel;\n if (channel instanceof Message) return channel.channel.id;\n if (channel instanceof Guild) return channel.defaultChannel.id;\n return null;\n }\n\n /**\n * Data that can be resolved to give an invite code. This can be:\n * * An invite code\n * * An invite URL\n * @typedef {string} InviteResolvable\n */\n\n /**\n * Resolves InviteResolvable to an invite code.\n * @param {InviteResolvable} data The invite resolvable to resolve\n * @returns {string}\n */\n resolveInviteCode(data) {\n const inviteRegex = /discord(?:app\\.com\\/invite|\\.gg(?:\\/invite)?)\\/([\\w-]{2,255})/i;\n const match = inviteRegex.exec(data);\n if (match && match[1]) return match[1];\n return data;\n }\n\n /**\n * Data that can be resolved to give a string. This can be:\n * * A string\n * * An array (joined with a new line delimiter to give a string)\n * * Any value\n * @typedef {string|Array|*} StringResolvable\n */\n\n /**\n * Resolves a StringResolvable to a string.\n * @param {StringResolvable} data The string resolvable to resolve\n * @returns {string}\n */\n resolveString(data) {\n if (typeof data === 'string') return data;\n if (data instanceof Array) return data.join('\\n');\n return String(data);\n }\n\n\n /**\n * Resolves a Base64Resolvable, a string, or a BufferResolvable to a Base 64 image.\n * @param {BufferResolvable|Base64Resolvable} image The image to be resolved\n * @returns {Promise}\n */\n resolveImage(image) {\n if (!image) return Promise.resolve(null);\n if (typeof image === 'string' && image.startsWith('data:')) {\n return Promise.resolve(image);\n }\n return this.resolveFile(image).then(this.resolveBase64);\n }\n\n /**\n * Data that resolves to give a Base64 string, typically for image uploading. This can be:\n * * A Buffer\n * * A base64 string\n * @typedef {Buffer|string} Base64Resolvable\n */\n\n /**\n * Resolves a Base64Resolvable to a Base 64 image.\n * @param {Base64Resolvable} data The base 64 resolvable you want to resolve\n * @returns {?string}\n */\n resolveBase64(data) {\n if (data instanceof Buffer) return `data:image/jpg;base64,${data.toString('base64')}`;\n return data;\n }\n\n /**\n * Data that can be resolved to give a Buffer. This can be:\n * * A Buffer\n * * The path to a local file\n * * A URL\n * * A Stream\n * @typedef {string|Buffer} BufferResolvable\n */\n\n /**\n * @external Stream\n * @see {@link https://nodejs.org/api/stream.html}\n */\n\n /**\n * Resolves a BufferResolvable to a Buffer.\n * @param {BufferResolvable|Stream} resource The buffer or stream resolvable to resolve\n * @returns {Promise}\n */\n resolveFile(resource) {\n if (resource instanceof Buffer) return Promise.resolve(resource);\n if (this.client.browser && resource instanceof ArrayBuffer) return Promise.resolve(convertToBuffer(resource));\n\n if (typeof resource === 'string') {\n if (/^https?:\\/\\//.test(resource)) {\n return snekfetch.get(resource).then(res => res.body instanceof Buffer ? res.body : Buffer.from(res.text));\n }\n return new Promise((resolve, reject) => {\n const file = path.resolve(resource);\n fs.stat(file, (err, stats) => {\n if (err) return reject(err);\n if (!stats || !stats.isFile()) return reject(new Error(`The file could not be found: ${file}`));\n fs.readFile(file, (err2, data) => {\n if (err2) reject(err2);\n else resolve(data);\n });\n return null;\n });\n });\n } else if (resource && resource.pipe && typeof resource.pipe === 'function') {\n return new Promise((resolve, reject) => {\n const buffers = [];\n resource.once('error', reject);\n resource.on('data', data => buffers.push(data));\n resource.once('end', () => resolve(Buffer.concat(buffers)));\n });\n }\n\n return Promise.reject(new TypeError('The resource must be a string or Buffer.'));\n }\n\n /**\n * Data that can be resolved to give an emoji identifier. This can be:\n * * The unicode representation of an emoji\n * * A custom emoji ID\n * * An Emoji object\n * * A ReactionEmoji object\n * @typedef {string|Emoji|ReactionEmoji} EmojiIdentifierResolvable\n */\n\n /**\n * Resolves an EmojiResolvable to an emoji identifier.\n * @param {EmojiIdentifierResolvable} emoji The emoji resolvable to resolve\n * @returns {?string}\n */\n resolveEmojiIdentifier(emoji) {\n if (emoji instanceof Emoji || emoji instanceof ReactionEmoji) return emoji.identifier;\n if (typeof emoji === 'string') {\n if (this.client.emojis.has(emoji)) return this.client.emojis.get(emoji).identifier;\n else if (!emoji.includes('%')) return encodeURIComponent(emoji);\n else return emoji;\n }\n return null;\n }\n\n /**\n * Can be a Hex Literal, Hex String, Number, RGB Array, or one of the following\n * ```\n * [\n * 'DEFAULT',\n * 'WHITE',\n * 'AQUA',\n * 'GREEN',\n * 'BLUE',\n * 'PURPLE',\n * 'LUMINOUS_VIVID_PINK',\n * 'GOLD',\n * 'ORANGE',\n * 'RED',\n * 'GREY',\n * 'DARKER_GREY',\n * 'NAVY',\n * 'DARK_AQUA',\n * 'DARK_GREEN',\n * 'DARK_BLUE',\n * 'DARK_PURPLE',\n * 'DARK_VIVID_PINK',\n * 'DARK_GOLD',\n * 'DARK_ORANGE',\n * 'DARK_RED',\n * 'DARK_GREY',\n * 'LIGHT_GREY',\n * 'DARK_NAVY',\n * 'RANDOM',\n * ]\n * ```\n * or something like\n * ```\n * [255, 0, 255]\n * ```\n * for purple\n * @typedef {string|number|Array} ColorResolvable\n */\n\n /**\n * Resolves a ColorResolvable into a color number.\n * @param {ColorResolvable} color Color to resolve\n * @returns {number} A color\n */\n static resolveColor(color) {\n if (typeof color === 'string') {\n if (color === 'RANDOM') return Math.floor(Math.random() * (0xFFFFFF + 1));\n if (color === 'DEFAULT') return 0;\n color = Constants.Colors[color] || parseInt(color.replace('#', ''), 16);\n } else if (color instanceof Array) {\n color = (color[0] << 16) + (color[1] << 8) + color[2];\n }\n\n if (color < 0 || color > 0xFFFFFF) {\n throw new RangeError('Color must be within the range 0 - 16777215 (0xFFFFFF).');\n } else if (color && isNaN(color)) {\n throw new TypeError('Unable to convert color to a number.');\n }\n\n return color;\n }\n\n /**\n * @param {ColorResolvable} color Color to resolve\n * @returns {number} A color\n */\n resolveColor(color) {\n return this.constructor.resolveColor(color);\n }\n}\n\nmodule.exports = ClientDataResolver;\n\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../node_modules/buffer/index.js */ \"./node_modules/buffer/index.js\").Buffer))\n\n//# sourceURL=webpack:///./src/client/ClientDataResolver.js?"); +eval("/* WEBPACK VAR INJECTION */(function(Buffer) {const path = __webpack_require__(/*! path */ \"./node_modules/path-browserify/index.js\");\nconst fs = __webpack_require__(/*! fs */ \"./node_modules/node-libs-browser/mock/empty.js\");\nconst snekfetch = __webpack_require__(/*! snekfetch */ \"./node_modules/snekfetch/esm.mjs\");\n\nconst Constants = __webpack_require__(/*! ../util/Constants */ \"./src/util/Constants.js\");\nconst convertToBuffer = __webpack_require__(/*! ../util/Util */ \"./src/util/Util.js\").convertToBuffer;\nconst User = __webpack_require__(/*! ../structures/User */ \"./src/structures/User.js\");\nconst Message = __webpack_require__(/*! ../structures/Message */ \"./src/structures/Message.js\");\nconst Guild = __webpack_require__(/*! ../structures/Guild */ \"./src/structures/Guild.js\");\nconst Channel = __webpack_require__(/*! ../structures/Channel */ \"./src/structures/Channel.js\");\nconst GuildMember = __webpack_require__(/*! ../structures/GuildMember */ \"./src/structures/GuildMember.js\");\nconst Emoji = __webpack_require__(/*! ../structures/Emoji */ \"./src/structures/Emoji.js\");\nconst ReactionEmoji = __webpack_require__(/*! ../structures/ReactionEmoji */ \"./src/structures/ReactionEmoji.js\");\nconst Role = __webpack_require__(/*! ../structures/Role */ \"./src/structures/Role.js\");\n\n/**\n * The DataResolver identifies different objects and tries to resolve a specific piece of information from them, e.g.\n * extracting a User from a Message object.\n * @private\n */\nclass ClientDataResolver {\n /**\n * @param {Client} client The client the resolver is for\n */\n constructor(client) {\n this.client = client;\n }\n\n /**\n * Data that resolves to give a User object. This can be:\n * * A User object\n * * A Snowflake\n * * A Message object (resolves to the message author)\n * * A Guild object (owner of the guild)\n * * A GuildMember object\n * @typedef {User|Snowflake|Message|Guild|GuildMember} UserResolvable\n */\n\n /**\n * Resolves a UserResolvable to a User object.\n * @param {UserResolvable} user The UserResolvable to identify\n * @returns {?User}\n */\n resolveUser(user) {\n if (user instanceof User) return user;\n if (typeof user === 'string') return this.client.users.get(user) || null;\n if (user instanceof GuildMember) return user.user;\n if (user instanceof Message) return user.author;\n if (user instanceof Guild) return this.resolveUser(user.ownerID);\n return null;\n }\n\n /**\n * Resolves a UserResolvable to a user ID string.\n * @param {UserResolvable} user The UserResolvable to identify\n * @returns {?Snowflake}\n */\n resolveUserID(user) {\n if (user instanceof User || user instanceof GuildMember) return user.id;\n if (typeof user === 'string') return user || null;\n if (user instanceof Message) return user.author.id;\n if (user instanceof Guild) return user.ownerID;\n return null;\n }\n\n /**\n * Data that resolves to give a Guild object. This can be:\n * * A Guild object\n * * A Snowflake\n * @typedef {Guild|Snowflake} GuildResolvable\n */\n\n /**\n * Resolves a GuildResolvable to a Guild object.\n * @param {GuildResolvable} guild The GuildResolvable to identify\n * @returns {?Guild}\n */\n resolveGuild(guild) {\n if (guild instanceof Guild) return guild;\n if (typeof guild === 'string') return this.client.guilds.get(guild) || null;\n return null;\n }\n\n /**\n * Data that resolves to give a GuildMember object. This can be:\n * * A GuildMember object\n * * A User object\n * @typedef {GuildMember|User} GuildMemberResolvable\n */\n\n /**\n * Resolves a GuildMemberResolvable to a GuildMember object.\n * @param {GuildResolvable} guild The guild that the member is part of\n * @param {UserResolvable} user The user that is part of the guild\n * @returns {?GuildMember}\n */\n resolveGuildMember(guild, user) {\n if (user instanceof GuildMember) return user;\n guild = this.resolveGuild(guild);\n user = this.resolveUser(user);\n if (!guild || !user) return null;\n return guild.members.get(user.id) || null;\n }\n\n /**\n * Data that can be resolved to a Role object. This can be:\n * * A Role\n * * A Snowflake\n * @typedef {Role|Snowflake} RoleResolvable\n */\n\n /**\n * Resolves a RoleResolvable to a Role object.\n * @param {GuildResolvable} guild The guild that this role is part of\n * @param {RoleResolvable} role The role resolvable to resolve\n * @returns {?Role}\n */\n resolveRole(guild, role) {\n if (role instanceof Role) return role;\n guild = this.resolveGuild(guild);\n if (!guild) return null;\n if (typeof role === 'string') return guild.roles.get(role);\n return null;\n }\n\n /**\n * Data that can be resolved to give a Channel object. This can be:\n * * A Channel object\n * * A Message object (the channel the message was sent in)\n * * A Guild object (the #general channel)\n * * A Snowflake\n * @typedef {Channel|Guild|Message|Snowflake} ChannelResolvable\n */\n\n /**\n * Resolves a ChannelResolvable to a Channel object.\n * @param {ChannelResolvable} channel The channel resolvable to resolve\n * @returns {?Channel}\n */\n resolveChannel(channel) {\n if (channel instanceof Channel) return channel;\n if (typeof channel === 'string') return this.client.channels.get(channel) || null;\n if (channel instanceof Message) return channel.channel;\n if (channel instanceof Guild) return channel.channels.get(channel.id) || null;\n return null;\n }\n\n /**\n * Resolves a ChannelResolvable to a channel ID.\n * @param {ChannelResolvable} channel The channel resolvable to resolve\n * @returns {?Snowflake}\n */\n resolveChannelID(channel) {\n if (channel instanceof Channel) return channel.id;\n if (typeof channel === 'string') return channel;\n if (channel instanceof Message) return channel.channel.id;\n if (channel instanceof Guild) return channel.defaultChannel.id;\n return null;\n }\n\n /**\n * Data that can be resolved to give an invite code. This can be:\n * * An invite code\n * * An invite URL\n * @typedef {string} InviteResolvable\n */\n\n /**\n * Resolves InviteResolvable to an invite code.\n * @param {InviteResolvable} data The invite resolvable to resolve\n * @returns {string}\n */\n resolveInviteCode(data) {\n const inviteRegex = /discord(?:app\\.com\\/invite|\\.gg(?:\\/invite)?)\\/([\\w-]{2,255})/i;\n const match = inviteRegex.exec(data);\n if (match && match[1]) return match[1];\n return data;\n }\n\n /**\n * Data that can be resolved to give a string. This can be:\n * * A string\n * * An array (joined with a new line delimiter to give a string)\n * * Any value\n * @typedef {string|Array|*} StringResolvable\n */\n\n /**\n * Resolves a StringResolvable to a string.\n * @param {StringResolvable} data The string resolvable to resolve\n * @returns {string}\n */\n resolveString(data) {\n if (typeof data === 'string') return data;\n if (data instanceof Array) return data.join('\\n');\n return String(data);\n }\n\n\n /**\n * Resolves a Base64Resolvable, a string, or a BufferResolvable to a Base 64 image.\n * @param {BufferResolvable|Base64Resolvable} image The image to be resolved\n * @returns {Promise}\n */\n resolveImage(image) {\n if (!image) return Promise.resolve(null);\n if (typeof image === 'string' && image.startsWith('data:')) {\n return Promise.resolve(image);\n }\n return this.resolveFile(image).then(this.resolveBase64);\n }\n\n /**\n * Data that resolves to give a Base64 string, typically for image uploading. This can be:\n * * A Buffer\n * * A base64 string\n * @typedef {Buffer|string} Base64Resolvable\n */\n\n /**\n * Resolves a Base64Resolvable to a Base 64 image.\n * @param {Base64Resolvable} data The base 64 resolvable you want to resolve\n * @returns {?string}\n */\n resolveBase64(data) {\n if (data instanceof Buffer) return `data:image/jpg;base64,${data.toString('base64')}`;\n return data;\n }\n\n /**\n * Data that can be resolved to give a Buffer. This can be:\n * * A Buffer\n * * The path to a local file\n * * A URL\n * * A Stream\n * @typedef {string|Buffer} BufferResolvable\n */\n\n /**\n * @external Stream\n * @see {@link https://nodejs.org/api/stream.html}\n */\n\n /**\n * Resolves a BufferResolvable to a Buffer.\n * @param {BufferResolvable|Stream} resource The buffer or stream resolvable to resolve\n * @returns {Promise}\n */\n resolveFile(resource) {\n if (resource instanceof Buffer) return Promise.resolve(resource);\n if (this.client.browser && resource instanceof ArrayBuffer) return Promise.resolve(convertToBuffer(resource));\n\n if (typeof resource === 'string') {\n if (/^https?:\\/\\//.test(resource)) {\n return snekfetch.get(resource).then(res => res.body instanceof Buffer ? res.body : Buffer.from(res.text));\n }\n return new Promise((resolve, reject) => {\n const file = path.resolve(resource);\n fs.stat(file, (err, stats) => {\n if (err) return reject(err);\n if (!stats || !stats.isFile()) return reject(new Error(`The file could not be found: ${file}`));\n fs.readFile(file, (err2, data) => {\n if (err2) reject(err2);\n else resolve(data);\n });\n return null;\n });\n });\n } else if (resource && resource.pipe && typeof resource.pipe === 'function') {\n return new Promise((resolve, reject) => {\n const buffers = [];\n resource.once('error', reject);\n resource.on('data', data => buffers.push(data));\n resource.once('end', () => resolve(Buffer.concat(buffers)));\n });\n }\n\n return Promise.reject(new TypeError('The resource must be a string or Buffer.'));\n }\n\n /**\n * Data that can be resolved to give an emoji identifier. This can be:\n * * The unicode representation of an emoji\n * * A custom emoji ID\n * * An Emoji object\n * * A ReactionEmoji object\n * @typedef {string|Emoji|ReactionEmoji} EmojiIdentifierResolvable\n */\n\n /**\n * Resolves an EmojiResolvable to an emoji identifier.\n * @param {EmojiIdentifierResolvable} emoji The emoji resolvable to resolve\n * @returns {?string}\n */\n resolveEmojiIdentifier(emoji) {\n if (emoji instanceof Emoji || emoji instanceof ReactionEmoji) return emoji.identifier;\n if (typeof emoji === 'string') {\n if (this.client.emojis.has(emoji)) return this.client.emojis.get(emoji).identifier;\n else if (!emoji.includes('%')) return encodeURIComponent(emoji);\n else return emoji;\n }\n return null;\n }\n\n /**\n * Can be a Hex Literal, Hex String, Number, RGB Array, or one of the following\n * ```\n * [\n * 'DEFAULT',\n * 'WHITE',\n * 'AQUA',\n * 'GREEN',\n * 'BLUE',\n * 'PURPLE',\n * 'LUMINOUS_VIVID_PINK',\n * 'GOLD',\n * 'ORANGE',\n * 'RED',\n * 'GREY',\n * 'DARKER_GREY',\n * 'NAVY',\n * 'DARK_AQUA',\n * 'DARK_GREEN',\n * 'DARK_BLUE',\n * 'DARK_PURPLE',\n * 'DARK_VIVID_PINK',\n * 'DARK_GOLD',\n * 'DARK_ORANGE',\n * 'DARK_RED',\n * 'DARK_GREY',\n * 'LIGHT_GREY',\n * 'DARK_NAVY',\n * 'RANDOM',\n * ]\n * ```\n * or something like\n * ```\n * [255, 0, 255]\n * ```\n * for purple\n * @typedef {string|number|Array} ColorResolvable\n */\n\n /**\n * Resolves a ColorResolvable into a color number.\n * @param {ColorResolvable} color Color to resolve\n * @returns {number} A color\n */\n static resolveColor(color) {\n if (typeof color === 'string') {\n if (color === 'RANDOM') return Math.floor(Math.random() * (0xFFFFFF + 1));\n if (color === 'DEFAULT') return 0;\n color = Constants.Colors[color] || parseInt(color.replace('#', ''), 16);\n } else if (color instanceof Array) {\n color = (color[0] << 16) + (color[1] << 8) + color[2];\n }\n\n if (color < 0 || color > 0xFFFFFF) {\n throw new RangeError('Color must be within the range 0 - 16777215 (0xFFFFFF).');\n } else if (color && isNaN(color)) {\n throw new TypeError('Unable to convert color to a number.');\n }\n\n return color;\n }\n\n /**\n * @param {ColorResolvable} color Color to resolve\n * @returns {number} A color\n */\n resolveColor(color) {\n return this.constructor.resolveColor(color);\n }\n}\n\nmodule.exports = ClientDataResolver;\n\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../node_modules/buffer/index.js */ \"./node_modules/buffer/index.js\").Buffer))\n\n//# sourceURL=webpack:///./src/client/ClientDataResolver.js?"); /***/ }), @@ -449,7 +449,7 @@ eval("/*\n\nABOUT ACTIONS\n\nActions are similar to WebSocket Packet Handlers, b /*! ModuleConcatenation bailout: Module is not an ECMAScript module */ /***/ (function(module, exports, __webpack_require__) { -eval("class ActionsManager {\n constructor(client) {\n this.client = client;\n\n this.register(__webpack_require__(/*! ./MessageCreate */ \"./src/client/actions/MessageCreate.js\"));\n this.register(__webpack_require__(/*! ./MessageDelete */ \"./src/client/actions/MessageDelete.js\"));\n this.register(__webpack_require__(/*! ./MessageDeleteBulk */ \"./src/client/actions/MessageDeleteBulk.js\"));\n this.register(__webpack_require__(/*! ./MessageUpdate */ \"./src/client/actions/MessageUpdate.js\"));\n this.register(__webpack_require__(/*! ./MessageReactionAdd */ \"./src/client/actions/MessageReactionAdd.js\"));\n this.register(__webpack_require__(/*! ./MessageReactionRemove */ \"./src/client/actions/MessageReactionRemove.js\"));\n this.register(__webpack_require__(/*! ./MessageReactionRemoveAll */ \"./src/client/actions/MessageReactionRemoveAll.js\"));\n this.register(__webpack_require__(/*! ./ChannelCreate */ \"./src/client/actions/ChannelCreate.js\"));\n this.register(__webpack_require__(/*! ./ChannelDelete */ \"./src/client/actions/ChannelDelete.js\"));\n this.register(__webpack_require__(/*! ./ChannelUpdate */ \"./src/client/actions/ChannelUpdate.js\"));\n this.register(__webpack_require__(/*! ./GuildDelete */ \"./src/client/actions/GuildDelete.js\"));\n this.register(__webpack_require__(/*! ./GuildUpdate */ \"./src/client/actions/GuildUpdate.js\"));\n this.register(__webpack_require__(/*! ./GuildMemberGet */ \"./src/client/actions/GuildMemberGet.js\"));\n this.register(__webpack_require__(/*! ./GuildMemberRemove */ \"./src/client/actions/GuildMemberRemove.js\"));\n this.register(__webpack_require__(/*! ./GuildBanRemove */ \"./src/client/actions/GuildBanRemove.js\"));\n this.register(__webpack_require__(/*! ./GuildRoleCreate */ \"./src/client/actions/GuildRoleCreate.js\"));\n this.register(__webpack_require__(/*! ./GuildRoleDelete */ \"./src/client/actions/GuildRoleDelete.js\"));\n this.register(__webpack_require__(/*! ./GuildRoleUpdate */ \"./src/client/actions/GuildRoleUpdate.js\"));\n this.register(__webpack_require__(/*! ./UserGet */ \"./src/client/actions/UserGet.js\"));\n this.register(__webpack_require__(/*! ./UserUpdate */ \"./src/client/actions/UserUpdate.js\"));\n this.register(__webpack_require__(/*! ./UserNoteUpdate */ \"./src/client/actions/UserNoteUpdate.js\"));\n this.register(__webpack_require__(/*! ./GuildSync */ \"./src/client/actions/GuildSync.js\"));\n this.register(__webpack_require__(/*! ./GuildEmojiCreate */ \"./src/client/actions/GuildEmojiCreate.js\"));\n this.register(__webpack_require__(/*! ./GuildEmojiDelete */ \"./src/client/actions/GuildEmojiDelete.js\"));\n this.register(__webpack_require__(/*! ./GuildEmojiUpdate */ \"./src/client/actions/GuildEmojiUpdate.js\"));\n this.register(__webpack_require__(/*! ./GuildEmojisUpdate */ \"./src/client/actions/GuildEmojisUpdate.js\"));\n this.register(__webpack_require__(/*! ./GuildRolesPositionUpdate */ \"./src/client/actions/GuildRolesPositionUpdate.js\"));\n this.register(__webpack_require__(/*! ./GuildChannelsPositionUpdate */ \"./src/client/actions/GuildChannelsPositionUpdate.js\"));\n }\n\n register(Action) {\n this[Action.name.replace(/Action$/, '')] = new Action(this.client);\n }\n}\n\nmodule.exports = ActionsManager;\n\n\n//# sourceURL=webpack:///./src/client/actions/ActionsManager.js?"); +eval("class ActionsManager {\n constructor(client) {\n this.client = client;\n\n this.register(__webpack_require__(/*! ./MessageCreate */ \"./src/client/actions/MessageCreate.js\"));\n this.register(__webpack_require__(/*! ./MessageDelete */ \"./src/client/actions/MessageDelete.js\"));\n this.register(__webpack_require__(/*! ./MessageDeleteBulk */ \"./src/client/actions/MessageDeleteBulk.js\"));\n this.register(__webpack_require__(/*! ./MessageUpdate */ \"./src/client/actions/MessageUpdate.js\"));\n this.register(__webpack_require__(/*! ./MessageReactionAdd */ \"./src/client/actions/MessageReactionAdd.js\"));\n this.register(__webpack_require__(/*! ./MessageReactionRemove */ \"./src/client/actions/MessageReactionRemove.js\"));\n this.register(__webpack_require__(/*! ./MessageReactionRemoveEmoji */ \"./src/client/actions/MessageReactionRemoveEmoji.js\"));\n this.register(__webpack_require__(/*! ./MessageReactionRemoveAll */ \"./src/client/actions/MessageReactionRemoveAll.js\"));\n this.register(__webpack_require__(/*! ./ChannelCreate */ \"./src/client/actions/ChannelCreate.js\"));\n this.register(__webpack_require__(/*! ./ChannelDelete */ \"./src/client/actions/ChannelDelete.js\"));\n this.register(__webpack_require__(/*! ./ChannelUpdate */ \"./src/client/actions/ChannelUpdate.js\"));\n this.register(__webpack_require__(/*! ./GuildDelete */ \"./src/client/actions/GuildDelete.js\"));\n this.register(__webpack_require__(/*! ./GuildUpdate */ \"./src/client/actions/GuildUpdate.js\"));\n this.register(__webpack_require__(/*! ./GuildMemberGet */ \"./src/client/actions/GuildMemberGet.js\"));\n this.register(__webpack_require__(/*! ./GuildMemberRemove */ \"./src/client/actions/GuildMemberRemove.js\"));\n this.register(__webpack_require__(/*! ./GuildBanRemove */ \"./src/client/actions/GuildBanRemove.js\"));\n this.register(__webpack_require__(/*! ./GuildRoleCreate */ \"./src/client/actions/GuildRoleCreate.js\"));\n this.register(__webpack_require__(/*! ./GuildRoleDelete */ \"./src/client/actions/GuildRoleDelete.js\"));\n this.register(__webpack_require__(/*! ./GuildRoleUpdate */ \"./src/client/actions/GuildRoleUpdate.js\"));\n this.register(__webpack_require__(/*! ./InviteCreate */ \"./src/client/actions/InviteCreate.js\"));\n this.register(__webpack_require__(/*! ./InviteDelete */ \"./src/client/actions/InviteDelete.js\"));\n this.register(__webpack_require__(/*! ./UserGet */ \"./src/client/actions/UserGet.js\"));\n this.register(__webpack_require__(/*! ./UserUpdate */ \"./src/client/actions/UserUpdate.js\"));\n this.register(__webpack_require__(/*! ./UserNoteUpdate */ \"./src/client/actions/UserNoteUpdate.js\"));\n this.register(__webpack_require__(/*! ./GuildSync */ \"./src/client/actions/GuildSync.js\"));\n this.register(__webpack_require__(/*! ./GuildEmojiCreate */ \"./src/client/actions/GuildEmojiCreate.js\"));\n this.register(__webpack_require__(/*! ./GuildEmojiDelete */ \"./src/client/actions/GuildEmojiDelete.js\"));\n this.register(__webpack_require__(/*! ./GuildEmojiUpdate */ \"./src/client/actions/GuildEmojiUpdate.js\"));\n this.register(__webpack_require__(/*! ./GuildEmojisUpdate */ \"./src/client/actions/GuildEmojisUpdate.js\"));\n this.register(__webpack_require__(/*! ./GuildRolesPositionUpdate */ \"./src/client/actions/GuildRolesPositionUpdate.js\"));\n this.register(__webpack_require__(/*! ./GuildChannelsPositionUpdate */ \"./src/client/actions/GuildChannelsPositionUpdate.js\"));\n }\n\n register(Action) {\n this[Action.name.replace(/Action$/, '')] = new Action(this.client);\n }\n}\n\nmodule.exports = ActionsManager;\n\n\n//# sourceURL=webpack:///./src/client/actions/ActionsManager.js?"); /***/ }), @@ -473,7 +473,7 @@ eval("const Action = __webpack_require__(/*! ./Action */ \"./src/client/actions/ /*! ModuleConcatenation bailout: Module is not an ECMAScript module */ /***/ (function(module, exports, __webpack_require__) { -eval("const Action = __webpack_require__(/*! ./Action */ \"./src/client/actions/Action.js\");\n\nclass ChannelDeleteAction extends Action {\n constructor(client) {\n super(client);\n this.deleted = new Map();\n }\n\n handle(data) {\n const client = this.client;\n\n let channel = client.channels.get(data.id);\n if (channel) {\n client.dataManager.killChannel(channel);\n this.deleted.set(channel.id, channel);\n this.scheduleForDeletion(channel.id);\n } else {\n channel = this.deleted.get(data.id) || null;\n }\n if (channel) channel.deleted = true;\n\n return { channel };\n }\n\n scheduleForDeletion(id) {\n this.client.setTimeout(() => this.deleted.delete(id), this.client.options.restWsBridgeTimeout);\n }\n}\n\nmodule.exports = ChannelDeleteAction;\n\n\n//# sourceURL=webpack:///./src/client/actions/ChannelDelete.js?"); +eval("const Action = __webpack_require__(/*! ./Action */ \"./src/client/actions/Action.js\");\nconst DMChannel = __webpack_require__(/*! ../../structures/DMChannel */ \"./src/structures/DMChannel.js\");\n\nclass ChannelDeleteAction extends Action {\n constructor(client) {\n super(client);\n this.deleted = new Map();\n }\n\n handle(data) {\n const client = this.client;\n\n let channel = client.channels.get(data.id);\n if (channel) {\n client.dataManager.killChannel(channel);\n this.deleted.set(channel.id, channel);\n this.scheduleForDeletion(channel.id);\n } else {\n channel = this.deleted.get(data.id) || null;\n }\n if (channel) {\n if (channel.messages && !(channel instanceof DMChannel)) {\n for (const message of channel.messages.values()) {\n message.deleted = true;\n }\n }\n channel.deleted = true;\n }\n\n return { channel };\n }\n\n scheduleForDeletion(id) {\n this.client.setTimeout(() => this.deleted.delete(id), this.client.options.restWsBridgeTimeout);\n }\n}\n\nmodule.exports = ChannelDeleteAction;\n\n\n//# sourceURL=webpack:///./src/client/actions/ChannelDelete.js?"); /***/ }), @@ -669,6 +669,31 @@ eval("const Action = __webpack_require__(/*! ./Action */ \"./src/client/actions/ /***/ }), +/***/ "./src/client/actions/InviteCreate.js": +/*!********************************************!*\ + !*** ./src/client/actions/InviteCreate.js ***! + \********************************************/ +/*! no static exports found */ +/*! ModuleConcatenation bailout: Module is not an ECMAScript module */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +eval("\n\nconst Action = __webpack_require__(/*! ./Action */ \"./src/client/actions/Action.js\");\nconst Invite = __webpack_require__(/*! ../../structures/Invite */ \"./src/structures/Invite.js\");\nconst { Events } = __webpack_require__(/*! ../../util/Constants */ \"./src/util/Constants.js\");\n\nclass InviteCreateAction extends Action {\n handle(data) {\n const client = this.client;\n const guild = client.guilds.get(data.guild_id);\n const channel = client.channels.get(data.channel_id);\n if (guild && channel) {\n const inviteData = Object.assign(data, { guild, channel });\n const invite = new Invite(client, inviteData);\n /**\n * Emitted when an invite is created.\n * This event only triggers if the client has `MANAGE_GUILD` permissions for the guild,\n * or `MANAGE_CHANNEL` permissions for the channel.\n * @event Client#inviteCreate\n * @param {Invite} invite The invite that was created\n */\n client.emit(Events.INVITE_CREATE, invite);\n return { invite };\n }\n return { invite: null };\n }\n}\n\nmodule.exports = InviteCreateAction;\n\n\n//# sourceURL=webpack:///./src/client/actions/InviteCreate.js?"); + +/***/ }), + +/***/ "./src/client/actions/InviteDelete.js": +/*!********************************************!*\ + !*** ./src/client/actions/InviteDelete.js ***! + \********************************************/ +/*! no static exports found */ +/*! ModuleConcatenation bailout: Module is not an ECMAScript module */ +/***/ (function(module, exports, __webpack_require__) { + +eval("const Action = __webpack_require__(/*! ./Action */ \"./src/client/actions/Action.js\");\nconst Invite = __webpack_require__(/*! ../../structures/Invite */ \"./src/structures/Invite.js\");\nconst { Events } = __webpack_require__(/*! ../../util/Constants */ \"./src/util/Constants.js\");\n\nclass InviteDeleteAction extends Action {\n handle(data) {\n const client = this.client;\n const guild = client.guilds.get(data.guild_id);\n const channel = client.channels.get(data.channel_id);\n if (guild && channel) {\n const inviteData = Object.assign(data, { guild, channel });\n const invite = new Invite(client, inviteData);\n /**\n * Emitted when an invite is deleted.\n * This event only triggers if the client has `MANAGE_GUILD` permissions for the guild,\n * or `MANAGE_CHANNEL` permissions for the channel.\n * @event Client#inviteDelete\n * @param {Invite} invite The invite that was deleted\n */\n client.emit(Events.INVITE_DELETE, invite);\n }\n }\n}\n\nmodule.exports = InviteDeleteAction;\n\n\n//# sourceURL=webpack:///./src/client/actions/InviteDelete.js?"); + +/***/ }), + /***/ "./src/client/actions/MessageCreate.js": /*!*********************************************!*\ !*** ./src/client/actions/MessageCreate.js ***! @@ -741,6 +766,18 @@ eval("const Action = __webpack_require__(/*! ./Action */ \"./src/client/actions/ /***/ }), +/***/ "./src/client/actions/MessageReactionRemoveEmoji.js": +/*!**********************************************************!*\ + !*** ./src/client/actions/MessageReactionRemoveEmoji.js ***! + \**********************************************************/ +/*! no static exports found */ +/*! ModuleConcatenation bailout: Module is not an ECMAScript module */ +/***/ (function(module, exports, __webpack_require__) { + +eval("const Action = __webpack_require__(/*! ./Action */ \"./src/client/actions/Action.js\");\nconst Constants = __webpack_require__(/*! ../../util/Constants */ \"./src/util/Constants.js\");\n\nclass MessageReactionRemoveEmoji extends Action {\n handle(data) {\n // Verify channel\n const channel = this.client.channels.get(data.channel_id);\n if (!channel || channel.type === 'voice') return false;\n // Verify message\n const message = channel.messages.get(data.message_id);\n if (!message) return false;\n if (!data.emoji) return false;\n // Verify reaction\n const reaction = message._removeReaction(data.emoji);\n if (reaction) this.client.emit(Constants.Events.MESSAGE_REACTION_REMOVE_EMOJI, reaction);\n\n return { message, reaction };\n }\n}\n\n/**\n * Emitted whenever a reaction emoji is removed from a cached message.\n * @event Client#messageReactionRemoveEmoji\n * @param {MessageReaction} messageReaction The reaction object\n */\n\nmodule.exports = MessageReactionRemoveEmoji;\n\n\n//# sourceURL=webpack:///./src/client/actions/MessageReactionRemoveEmoji.js?"); + +/***/ }), + /***/ "./src/client/actions/MessageUpdate.js": /*!*********************************************!*\ !*** ./src/client/actions/MessageUpdate.js ***! @@ -833,7 +870,7 @@ eval("const UserAgentManager = __webpack_require__(/*! ./UserAgentManager */ \". /*! ModuleConcatenation bailout: Module is not an ECMAScript module */ /***/ (function(module, exports, __webpack_require__) { -eval("const querystring = __webpack_require__(/*! querystring */ \"./node_modules/querystring-es3/index.js\");\nconst long = __webpack_require__(/*! long */ \"./node_modules/long/src/long.js\");\nconst Permissions = __webpack_require__(/*! ../../util/Permissions */ \"./src/util/Permissions.js\");\nconst Constants = __webpack_require__(/*! ../../util/Constants */ \"./src/util/Constants.js\");\nconst Endpoints = Constants.Endpoints;\nconst Collection = __webpack_require__(/*! ../../util/Collection */ \"./src/util/Collection.js\");\nconst Util = __webpack_require__(/*! ../../util/Util */ \"./src/util/Util.js\");\nconst resolvePermissions = __webpack_require__(/*! ../../structures/shared/resolvePermissions */ \"./src/structures/shared/resolvePermissions.js\");\n\nconst RichEmbed = __webpack_require__(/*! ../../structures/RichEmbed */ \"./src/structures/RichEmbed.js\");\nconst User = __webpack_require__(/*! ../../structures/User */ \"./src/structures/User.js\");\nconst GuildMember = __webpack_require__(/*! ../../structures/GuildMember */ \"./src/structures/GuildMember.js\");\nconst Message = __webpack_require__(/*! ../../structures/Message */ \"./src/structures/Message.js\");\nconst Role = __webpack_require__(/*! ../../structures/Role */ \"./src/structures/Role.js\");\nconst Invite = __webpack_require__(/*! ../../structures/Invite */ \"./src/structures/Invite.js\");\nconst Webhook = __webpack_require__(/*! ../../structures/Webhook */ \"./src/structures/Webhook.js\");\nconst UserProfile = __webpack_require__(/*! ../../structures/UserProfile */ \"./src/structures/UserProfile.js\");\nconst OAuth2Application = __webpack_require__(/*! ../../structures/OAuth2Application */ \"./src/structures/OAuth2Application.js\");\nconst Channel = __webpack_require__(/*! ../../structures/Channel */ \"./src/structures/Channel.js\");\nconst GroupDMChannel = __webpack_require__(/*! ../../structures/GroupDMChannel */ \"./src/structures/GroupDMChannel.js\");\nconst Guild = __webpack_require__(/*! ../../structures/Guild */ \"./src/structures/Guild.js\");\nconst VoiceRegion = __webpack_require__(/*! ../../structures/VoiceRegion */ \"./src/structures/VoiceRegion.js\");\nconst GuildAuditLogs = __webpack_require__(/*! ../../structures/GuildAuditLogs */ \"./src/structures/GuildAuditLogs.js\");\n\nclass RESTMethods {\n constructor(restManager) {\n this.rest = restManager;\n this.client = restManager.client;\n this._ackToken = null;\n }\n\n login(token = this.client.token) {\n return new Promise((resolve, reject) => {\n if (!token || typeof token !== 'string') throw new Error(Constants.Errors.INVALID_TOKEN);\n token = token.replace(/^Bot\\s*/i, '');\n this.client.manager.connectToWebSocket(token, resolve, reject);\n }).catch(e => {\n this.client.destroy();\n return Promise.reject(e);\n });\n }\n\n logout() {\n return this.rest.makeRequest('post', Endpoints.logout, true, {});\n }\n\n getGateway(bot = false) {\n return this.rest.makeRequest('get', bot ? Endpoints.gateway.bot : Endpoints.gateway, true);\n }\n\n fetchVoiceRegions(guildID) {\n let endpoint;\n if (guildID) endpoint = Endpoints.Guild(guildID).voiceRegions;\n else endpoint = Endpoints.voiceRegions;\n return this.rest.makeRequest('get', endpoint, true).then(res => {\n const regions = new Collection();\n for (const region of res) regions.set(region.id, new VoiceRegion(region));\n return regions;\n });\n }\n\n fetchEmbed(guildID) {\n return this.rest.makeRequest('get', Endpoints.Guild(guildID).embed, true).then(data => ({\n enabled: data.enabled,\n channel: data.channel_id ? this.client.channels.get(data.channel_id) : null,\n }));\n }\n\n sendMessage(channel, content, { tts, nonce, embed, disableEveryone, split, code, reply } = {}, files = null) {\n return new Promise((resolve, reject) => { // eslint-disable-line complexity\n if (typeof content !== 'undefined') content = this.client.resolver.resolveString(content);\n\n // The nonce has to be a uint64 :<\n if (typeof nonce !== 'undefined') {\n nonce = parseInt(nonce);\n if (isNaN(nonce) || nonce < 0) throw new RangeError('Message nonce must fit in an unsigned 64-bit integer.');\n }\n\n if (content) {\n if (split && typeof split !== 'object') split = {};\n\n // Wrap everything in a code block\n if (typeof code !== 'undefined' && (typeof code !== 'boolean' || code === true)) {\n content = Util.escapeMarkdown(this.client.resolver.resolveString(content), true);\n content = `\\`\\`\\`${typeof code !== 'boolean' ? code || '' : ''}\\n${content}\\n\\`\\`\\``;\n if (split) {\n split.prepend = `\\`\\`\\`${typeof code !== 'boolean' ? code || '' : ''}\\n`;\n split.append = '\\n```';\n }\n }\n\n // Add zero-width spaces to @everyone/@here\n if (disableEveryone || (typeof disableEveryone === 'undefined' && this.client.options.disableEveryone)) {\n content = content.replace(/@(everyone|here)/g, '@\\u200b$1');\n }\n\n // Add the reply prefix\n if (reply && !(channel instanceof User || channel instanceof GuildMember) && channel.type !== 'dm') {\n const id = this.client.resolver.resolveUserID(reply);\n const mention = `<@${reply instanceof GuildMember && reply.nickname ? '!' : ''}${id}>`;\n content = `${mention}${content ? `, ${content}` : ''}`;\n if (split) split.prepend = `${mention}, ${split.prepend || ''}`;\n }\n\n // Split the content\n if (split) content = Util.splitMessage(content, split);\n } else if (reply && !(channel instanceof User || channel instanceof GuildMember) && channel.type !== 'dm') {\n const id = this.client.resolver.resolveUserID(reply);\n content = `<@${reply instanceof GuildMember && reply.nickname ? '!' : ''}${id}>`;\n }\n\n const send = chan => {\n if (content instanceof Array) {\n const messages = [];\n (function sendChunk(list, index) {\n const options = index === list.length - 1 ? { tts, embed, files } : { tts };\n chan.send(list[index], options).then(message => {\n messages.push(message);\n if (index >= list.length - 1) return resolve(messages);\n return sendChunk(list, ++index);\n }).catch(reject);\n }(content, 0));\n } else {\n this.rest.makeRequest('post', Endpoints.Channel(chan).messages, true, {\n content, tts, nonce, embed,\n }, files).then(data => resolve(this.client.actions.MessageCreate.handle(data).message), reject);\n }\n };\n\n if (channel instanceof User || channel instanceof GuildMember) this.createDM(channel).then(send, reject);\n else send(channel);\n });\n }\n\n updateMessage(message, content, { embed, code, reply } = {}) {\n if (typeof content !== 'undefined') content = this.client.resolver.resolveString(content);\n\n // Wrap everything in a code block\n if (typeof code !== 'undefined' && (typeof code !== 'boolean' || code === true)) {\n content = Util.escapeMarkdown(this.client.resolver.resolveString(content), true);\n content = `\\`\\`\\`${typeof code !== 'boolean' ? code || '' : ''}\\n${content}\\n\\`\\`\\``;\n }\n\n // Add the reply prefix\n if (reply && message.channel.type !== 'dm') {\n const id = this.client.resolver.resolveUserID(reply);\n const mention = `<@${reply instanceof GuildMember && reply.nickname ? '!' : ''}${id}>`;\n content = `${mention}${content ? `, ${content}` : ''}`;\n }\n\n if (embed instanceof RichEmbed) embed = embed._apiTransform();\n\n return this.rest.makeRequest('patch', Endpoints.Message(message), true, {\n content, embed,\n }).then(data => this.client.actions.MessageUpdate.handle(data).updated);\n }\n\n deleteMessage(message) {\n return this.rest.makeRequest('delete', Endpoints.Message(message), true)\n .then(() =>\n this.client.actions.MessageDelete.handle({\n id: message.id,\n channel_id: message.channel.id,\n }).message\n );\n }\n\n ackMessage(message) {\n return this.rest.makeRequest('post', Endpoints.Message(message).ack, true, { token: this._ackToken }).then(res => {\n if (res.token) this._ackToken = res.token;\n return message;\n });\n }\n\n ackTextChannel(channel) {\n return this.rest.makeRequest('post', Endpoints.Channel(channel).Message(channel.lastMessageID).ack, true, {\n token: this._ackToken,\n }).then(res => {\n if (res.token) this._ackToken = res.token;\n return channel;\n });\n }\n\n ackGuild(guild) {\n return this.rest.makeRequest('post', Endpoints.Guild(guild).ack, true).then(() => guild);\n }\n\n bulkDeleteMessages(channel, messages) {\n return this.rest.makeRequest('post', Endpoints.Channel(channel).messages.bulkDelete, true, {\n messages: messages,\n }).then(() =>\n this.client.actions.MessageDeleteBulk.handle({\n channel_id: channel.id,\n ids: messages,\n }).messages\n );\n }\n\n search(target, options) {\n if (typeof options === 'string') options = { content: options };\n if (options.before) {\n if (!(options.before instanceof Date)) options.before = new Date(options.before);\n options.maxID = long.fromNumber(options.before.getTime() - 14200704e5).shiftLeft(22).toString();\n }\n if (options.after) {\n if (!(options.after instanceof Date)) options.after = new Date(options.after);\n options.minID = long.fromNumber(options.after.getTime() - 14200704e5).shiftLeft(22).toString();\n }\n if (options.during) {\n if (!(options.during instanceof Date)) options.during = new Date(options.during);\n const t = options.during.getTime() - 14200704e5;\n options.minID = long.fromNumber(t).shiftLeft(22).toString();\n options.maxID = long.fromNumber(t + 86400000).shiftLeft(22).toString();\n }\n if (options.channel) options.channel = this.client.resolver.resolveChannelID(options.channel);\n if (options.author) options.author = this.client.resolver.resolveUserID(options.author);\n if (options.mentions) options.mentions = this.client.resolver.resolveUserID(options.options.mentions);\n options = {\n content: options.content,\n max_id: options.maxID,\n min_id: options.minID,\n has: options.has,\n channel_id: options.channel,\n author_id: options.author,\n author_type: options.authorType,\n context_size: options.contextSize,\n sort_by: options.sortBy,\n sort_order: options.sortOrder,\n limit: options.limit,\n offset: options.offset,\n mentions: options.mentions,\n mentions_everyone: options.mentionsEveryone,\n link_hostname: options.linkHostname,\n embed_provider: options.embedProvider,\n embed_type: options.embedType,\n attachment_filename: options.attachmentFilename,\n attachment_extension: options.attachmentExtension,\n include_nsfw: options.nsfw,\n };\n\n for (const key in options) if (options[key] === undefined) delete options[key];\n const queryString = (querystring.stringify(options).match(/[^=&?]+=[^=&?]+/g) || []).join('&');\n\n let endpoint;\n if (target instanceof Channel) {\n endpoint = Endpoints.Channel(target).search;\n } else if (target instanceof Guild) {\n endpoint = Endpoints.Guild(target).search;\n } else {\n throw new TypeError('Target must be a TextChannel, DMChannel, GroupDMChannel, or Guild.');\n }\n return this.rest.makeRequest('get', `${endpoint}?${queryString}`, true).then(body => {\n const messages = body.messages.map(x =>\n x.map(m => new Message(this.client.channels.get(m.channel_id), m, this.client))\n );\n return {\n totalResults: body.total_results,\n messages,\n };\n });\n }\n\n createChannel(guild, name, options) {\n const {\n type,\n topic,\n nsfw,\n bitrate,\n userLimit,\n parent,\n permissionOverwrites,\n position,\n rateLimitPerUser,\n reason,\n } = options;\n return this.rest.makeRequest('post', Endpoints.Guild(guild).channels, true, {\n name,\n topic,\n type: type ? Constants.ChannelTypes[type.toUpperCase()] : 'text',\n nsfw,\n bitrate,\n user_limit: userLimit,\n parent_id: parent instanceof Channel ? parent.id : parent,\n permission_overwrites: resolvePermissions.call(this, permissionOverwrites, guild),\n position,\n rate_limit_per_user: rateLimitPerUser,\n },\n undefined,\n reason).then(data => this.client.actions.ChannelCreate.handle(data).channel);\n }\n\n createDM(recipient) {\n const dmChannel = this.getExistingDM(recipient);\n if (dmChannel) return Promise.resolve(dmChannel);\n return this.rest.makeRequest('post', Endpoints.User(this.client.user).channels, true, {\n recipient_id: recipient.id,\n }).then(data => this.client.actions.ChannelCreate.handle(data).channel);\n }\n\n createGroupDM(options) {\n const data = this.client.user.bot ?\n { access_tokens: options.accessTokens, nicks: options.nicks } :\n { recipients: options.recipients };\n return this.rest.makeRequest('post', Endpoints.User('@me').channels, true, data)\n .then(res => new GroupDMChannel(this.client, res));\n }\n\n addUserToGroupDM(channel, options) {\n const data = this.client.user.bot ?\n { nick: options.nick, access_token: options.accessToken } :\n { recipient: options.id };\n return this.rest.makeRequest('put', Endpoints.Channel(channel).Recipient(options.id), true, data)\n .then(() => channel);\n }\n\n removeUserFromGroupDM(channel, userId) {\n return this.rest.makeRequest('delete', Endpoints.Channel(channel).Recipient(userId), true)\n .then(() => channel);\n }\n\n updateGroupDMChannel(channel, _data) {\n const data = {};\n data.name = _data.name;\n data.icon = _data.icon;\n return this.rest.makeRequest('patch', Endpoints.Channel(channel), true, data).then(() => channel);\n }\n\n getExistingDM(recipient) {\n return this.client.channels.find(channel =>\n channel.recipient && channel.recipient.id === recipient.id\n );\n }\n\n deleteChannel(channel, reason) {\n if (channel instanceof User || channel instanceof GuildMember) channel = this.getExistingDM(channel);\n if (!channel) return Promise.reject(new Error('No channel to delete.'));\n return this.rest.makeRequest('delete', Endpoints.Channel(channel), true, undefined, undefined, reason)\n .then(data => {\n data.id = channel.id;\n return this.client.actions.ChannelDelete.handle(data).channel;\n });\n }\n\n updateChannel(channel, _data, reason) {\n const data = {};\n data.name = (_data.name || channel.name).trim();\n data.topic = typeof _data.topic === 'undefined' ? channel.topic : _data.topic;\n data.nsfw = typeof _data.nsfw === 'undefined' ? channel.nsfw : _data.nsfw;\n data.position = _data.position || channel.position;\n data.bitrate = _data.bitrate || (channel.bitrate ? channel.bitrate * 1000 : undefined);\n data.user_limit = typeof _data.userLimit !== 'undefined' ? _data.userLimit : channel.userLimit;\n data.parent_id = _data.parent instanceof Channel ? _data.parent.id : _data.parent;\n data.permission_overwrites = _data.permissionOverwrites ?\n resolvePermissions.call(this, _data.permissionOverwrites, channel.guild) : undefined;\n data.rate_limit_per_user = typeof _data.rateLimitPerUser !== 'undefined' ?\n _data.rateLimitPerUser : channel.rateLimitPerUser;\n return this.rest.makeRequest('patch', Endpoints.Channel(channel), true, data, undefined, reason).then(newData =>\n this.client.actions.ChannelUpdate.handle(newData).updated\n );\n }\n\n leaveGuild(guild) {\n if (guild.ownerID === this.client.user.id) return Promise.reject(new Error('Guild is owned by the client.'));\n return this.rest.makeRequest('delete', Endpoints.User('@me').Guild(guild.id), true).then(() =>\n this.client.actions.GuildDelete.handle({ id: guild.id }).guild\n );\n }\n\n createGuild(options) {\n options.icon = this.client.resolver.resolveBase64(options.icon) || null;\n options.region = options.region || 'us-central';\n return new Promise((resolve, reject) => {\n this.rest.makeRequest('post', Endpoints.guilds, true, options).then(data => {\n if (this.client.guilds.has(data.id)) return resolve(this.client.guilds.get(data.id));\n\n const handleGuild = guild => {\n if (guild.id === data.id) {\n this.client.removeListener(Constants.Events.GUILD_CREATE, handleGuild);\n this.client.clearTimeout(timeout);\n resolve(guild);\n }\n };\n this.client.on(Constants.Events.GUILD_CREATE, handleGuild);\n\n const timeout = this.client.setTimeout(() => {\n this.client.removeListener(Constants.Events.GUILD_CREATE, handleGuild);\n reject(new Error('Took too long to receive guild data.'));\n }, 10000);\n return undefined;\n }, reject);\n });\n }\n\n // Untested but probably will work\n deleteGuild(guild) {\n return this.rest.makeRequest('delete', Endpoints.Guild(guild), true).then(() =>\n this.client.actions.GuildDelete.handle({ id: guild.id }).guild\n );\n }\n\n getUser(userID, cache) {\n return this.rest.makeRequest('get', Endpoints.User(userID), true).then(data => {\n if (cache) return this.client.actions.UserGet.handle(data).user;\n else return new User(this.client, data);\n });\n }\n\n updateCurrentUser(_data, password) {\n const user = this.client.user;\n const data = {};\n data.username = _data.username || user.username;\n data.avatar = typeof _data.avatar === 'undefined' ? user.avatar : this.client.resolver.resolveBase64(_data.avatar);\n if (!user.bot) {\n data.email = _data.email || user.email;\n data.password = password;\n if (_data.new_password) data.new_password = _data.newPassword;\n }\n return this.rest.makeRequest('patch', Endpoints.User('@me'), true, data).then(newData =>\n this.client.actions.UserUpdate.handle(newData).updated\n );\n }\n\n updateGuild(guild, data, reason) {\n return this.rest.makeRequest('patch', Endpoints.Guild(guild), true, data, undefined, reason).then(newData =>\n this.client.actions.GuildUpdate.handle(newData).updated\n );\n }\n\n kickGuildMember(guild, member, reason) {\n return this.rest.makeRequest(\n 'delete', Endpoints.Guild(guild).Member(member), true,\n undefined, undefined, reason)\n .then(() => member);\n }\n\n createGuildRole(guild, data, reason) {\n if (data.color) data.color = this.client.resolver.resolveColor(data.color);\n if (data.permissions) data.permissions = Permissions.resolve(data.permissions);\n return this.rest.makeRequest('post', Endpoints.Guild(guild).roles, true, data, undefined, reason).then(r => {\n const { role } = this.client.actions.GuildRoleCreate.handle({\n guild_id: guild.id,\n role: r,\n });\n if (data.position) return role.setPosition(data.position, reason);\n return role;\n });\n }\n\n deleteGuildRole(role, reason) {\n return this.rest.makeRequest(\n 'delete', Endpoints.Guild(role.guild).Role(role.id), true,\n undefined, undefined, reason)\n .then(() =>\n this.client.actions.GuildRoleDelete.handle({\n guild_id: role.guild.id,\n role_id: role.id,\n }).role\n );\n }\n\n setChannelOverwrite(channel, payload) {\n return this.rest.makeRequest('put', `${Endpoints.Channel(channel).permissions}/${payload.id}`, true, payload);\n }\n\n deletePermissionOverwrites(overwrite, reason) {\n return this.rest.makeRequest(\n 'delete', `${Endpoints.Channel(overwrite.channel).permissions}/${overwrite.id}`,\n true, undefined, undefined, reason\n ).then(() => overwrite);\n }\n\n getChannelMessages(channel, payload = {}) {\n const params = [];\n if (payload.limit) params.push(`limit=${payload.limit}`);\n if (payload.around) params.push(`around=${payload.around}`);\n else if (payload.before) params.push(`before=${payload.before}`);\n else if (payload.after) params.push(`after=${payload.after}`);\n\n let endpoint = Endpoints.Channel(channel).messages;\n if (params.length > 0) endpoint += `?${params.join('&')}`;\n return this.rest.makeRequest('get', endpoint, true);\n }\n\n getChannelMessage(channel, messageID) {\n const msg = channel.messages.get(messageID);\n if (msg) return Promise.resolve(msg);\n return this.rest.makeRequest('get', Endpoints.Channel(channel).Message(messageID), true);\n }\n\n putGuildMember(guild, userID, options) {\n options.access_token = options.accessToken;\n if (options.roles) {\n const roles = options.roles;\n if (roles instanceof Collection || (roles instanceof Array && roles[0] instanceof Role)) {\n options.roles = roles.map(role => role.id);\n }\n }\n return this.rest.makeRequest('put', Endpoints.Guild(guild).Member(userID), true, options)\n .then(data => this.client.actions.GuildMemberGet.handle(guild, data).member);\n }\n\n getGuildMember(guild, user, cache) {\n return this.rest.makeRequest('get', Endpoints.Guild(guild).Member(user.id), true).then(data => {\n if (cache) return this.client.actions.GuildMemberGet.handle(guild, data).member;\n else return new GuildMember(guild, data);\n });\n }\n\n updateGuildMember(member, data, reason) {\n if (data.channel) {\n const channel = this.client.resolver.resolveChannel(data.channel);\n if (!channel || channel.guild.id !== member.guild.id || channel.type !== 'voice') {\n return Promise.reject(new Error('Could not resolve channel to a guild voice channel.'));\n }\n data.channel_id = channel.id;\n data.channel = undefined;\n } else if (data.channel === null) {\n data.channel_id = null;\n data.channel = undefined;\n }\n if (data.roles) data.roles = data.roles.map(role => role instanceof Role ? role.id : role);\n\n let endpoint = Endpoints.Member(member);\n // Fix your endpoints, discord ;-;\n if (member.id === this.client.user.id) {\n const keys = Object.keys(data);\n if (keys.length === 1 && keys[0] === 'nick') {\n endpoint = Endpoints.Member(member).nickname;\n }\n }\n\n return this.rest.makeRequest('patch', endpoint, true, data, undefined, reason).then(newData =>\n member.guild._updateMember(member, newData).mem\n );\n }\n\n addMemberRole(member, role, reason) {\n return new Promise((resolve, reject) => {\n if (member._roles.includes(role.id)) return resolve(member);\n\n const listener = (oldMember, newMember) => {\n if (newMember.id === member.id && !oldMember._roles.includes(role.id) && newMember._roles.includes(role.id)) {\n this.client.removeListener(Constants.Events.GUILD_MEMBER_UPDATE, listener);\n resolve(newMember);\n }\n };\n\n this.client.on(Constants.Events.GUILD_MEMBER_UPDATE, listener);\n const timeout = this.client.setTimeout(() => {\n this.client.removeListener(Constants.Events.GUILD_MEMBER_UPDATE, listener);\n reject(new Error('Adding the role timed out.'));\n }, 10e3);\n\n return this.rest.makeRequest('put', Endpoints.Member(member).Role(role.id), true, undefined, undefined, reason)\n .catch(err => {\n this.client.removeListener(Constants.Events.GUILD_MEMBER_UPDATE, listener);\n this.client.clearTimeout(timeout);\n reject(err);\n });\n });\n }\n\n removeMemberRole(member, role, reason) {\n return new Promise((resolve, reject) => {\n if (!member._roles.includes(role.id)) return resolve(member);\n\n const listener = (oldMember, newMember) => {\n if (newMember.id === member.id && oldMember._roles.includes(role.id) && !newMember._roles.includes(role.id)) {\n this.client.removeListener(Constants.Events.GUILD_MEMBER_UPDATE, listener);\n resolve(newMember);\n }\n };\n\n this.client.on(Constants.Events.GUILD_MEMBER_UPDATE, listener);\n const timeout = this.client.setTimeout(() => {\n this.client.removeListener(Constants.Events.GUILD_MEMBER_UPDATE, listener);\n reject(new Error('Removing the role timed out.'));\n }, 10e3);\n\n return this.rest.makeRequest('delete', Endpoints.Member(member).Role(role.id), true, undefined, undefined, reason)\n .catch(err => {\n this.client.removeListener(Constants.Events.GUILD_MEMBER_UPDATE, listener);\n this.client.clearTimeout(timeout);\n reject(err);\n });\n });\n }\n\n sendTyping(channelID) {\n return this.rest.makeRequest('post', Endpoints.Channel(channelID).typing, true);\n }\n\n banGuildMember(guild, member, options) {\n const id = this.client.resolver.resolveUserID(member);\n if (!id) return Promise.reject(new Error('Couldn\\'t resolve the user ID to ban.'));\n\n const url = `${Endpoints.Guild(guild).bans}/${id}?${querystring.stringify(options)}`;\n return this.rest.makeRequest('put', url, true).then(() => {\n if (member instanceof GuildMember) return member;\n const user = this.client.resolver.resolveUser(id);\n if (user) {\n member = this.client.resolver.resolveGuildMember(guild, user);\n return member || user;\n }\n return id;\n });\n }\n\n unbanGuildMember(guild, member, reason) {\n return new Promise((resolve, reject) => {\n const id = this.client.resolver.resolveUserID(member);\n if (!id) throw new Error('Couldn\\'t resolve the user ID to unban.');\n\n const listener = (eGuild, eUser) => {\n if (eGuild.id === guild.id && eUser.id === id) {\n this.client.removeListener(Constants.Events.GUILD_BAN_REMOVE, listener);\n this.client.clearTimeout(timeout);\n resolve(eUser);\n }\n };\n this.client.on(Constants.Events.GUILD_BAN_REMOVE, listener);\n\n const timeout = this.client.setTimeout(() => {\n this.client.removeListener(Constants.Events.GUILD_BAN_REMOVE, listener);\n reject(new Error('Took too long to receive the ban remove event.'));\n }, 10000);\n\n this.rest.makeRequest('delete', `${Endpoints.Guild(guild).bans}/${id}`, true, undefined, undefined, reason)\n .catch(err => {\n this.client.removeListener(Constants.Events.GUILD_BAN_REMOVE, listener);\n this.client.clearTimeout(timeout);\n reject(err);\n });\n });\n }\n\n getGuildBan(guild, user) {\n const id = this.client.resolver.resolveUserID(user);\n return this.rest.makeRequest('get', `${Endpoints.Guild(guild).bans}/${id}`, true).then(ban => ({\n reason: ban.reason,\n user: this.client.dataManager.newUser(ban.user),\n }));\n }\n\n getGuildBans(guild) {\n return this.rest.makeRequest('get', Endpoints.Guild(guild).bans, true).then(bans =>\n bans.reduce((collection, ban) => {\n collection.set(ban.user.id, {\n reason: ban.reason,\n user: this.client.dataManager.newUser(ban.user),\n });\n return collection;\n }, new Collection())\n );\n }\n\n updateGuildRole(role, _data, reason) {\n const data = {};\n data.name = _data.name || role.name;\n data.position = typeof _data.position !== 'undefined' ? _data.position : role.position;\n data.color = _data.color === null ? null : this.client.resolver.resolveColor(_data.color || role.color);\n data.hoist = typeof _data.hoist !== 'undefined' ? _data.hoist : role.hoist;\n data.mentionable = typeof _data.mentionable !== 'undefined' ? _data.mentionable : role.mentionable;\n\n if (typeof _data.permissions !== 'undefined') data.permissions = Permissions.resolve(_data.permissions);\n else data.permissions = role.permissions;\n\n return this.rest.makeRequest('patch', Endpoints.Guild(role.guild).Role(role.id), true, data, undefined, reason)\n .then(_role =>\n this.client.actions.GuildRoleUpdate.handle({\n role: _role,\n guild_id: role.guild.id,\n }).updated\n );\n }\n\n pinMessage(message) {\n return this.rest.makeRequest('put', Endpoints.Channel(message.channel).Pin(message.id), true)\n .then(() => message);\n }\n\n unpinMessage(message) {\n return this.rest.makeRequest('delete', Endpoints.Channel(message.channel).Pin(message.id), true)\n .then(() => message);\n }\n\n getChannelPinnedMessages(channel) {\n return this.rest.makeRequest('get', Endpoints.Channel(channel).pins, true);\n }\n\n createChannelInvite(channel, options, reason) {\n const payload = {};\n payload.temporary = options.temporary;\n payload.max_age = options.maxAge;\n payload.max_uses = options.maxUses;\n payload.unique = options.unique;\n return this.rest.makeRequest('post', Endpoints.Channel(channel).invites, true, payload, undefined, reason)\n .then(invite => new Invite(this.client, invite));\n }\n\n deleteInvite(invite, reason) {\n return this.rest.makeRequest('delete', Endpoints.Invite(invite.code), true, undefined, undefined, reason)\n .then(() => invite);\n }\n\n getInvite(code) {\n return this.rest.makeRequest('get', Endpoints.Invite(code), true).then(invite =>\n new Invite(this.client, invite)\n );\n }\n\n getGuildInvites(guild) {\n return this.rest.makeRequest('get', Endpoints.Guild(guild).invites, true).then(inviteItems => {\n const invites = new Collection();\n for (const inviteItem of inviteItems) {\n const invite = new Invite(this.client, inviteItem);\n invites.set(invite.code, invite);\n }\n return invites;\n });\n }\n\n getGuildVanityCode(guild) {\n return this.rest.makeRequest('get', Endpoints.Guild(guild).vanityURL, true)\n .then(res => res.code);\n }\n\n pruneGuildMembers(guild, days, dry, reason) {\n return this.rest.makeRequest(dry ?\n 'get' :\n 'post',\n `${Endpoints.Guild(guild).prune}?days=${days}`, true, undefined, undefined, reason)\n .then(data => data.pruned);\n }\n\n createEmoji(guild, image, name, roles, reason) {\n const data = { image, name };\n if (roles) data.roles = roles.map(r => r.id ? r.id : r);\n return this.rest.makeRequest('post', Endpoints.Guild(guild).emojis, true, data, undefined, reason)\n .then(emoji => this.client.actions.GuildEmojiCreate.handle(guild, emoji).emoji);\n }\n\n updateEmoji(emoji, _data, reason) {\n const data = {};\n if (_data.name) data.name = _data.name;\n if (_data.roles) data.roles = _data.roles.map(r => r.id ? r.id : r);\n return this.rest.makeRequest('patch', Endpoints.Guild(emoji.guild).Emoji(emoji.id), true, data, undefined, reason)\n .then(newEmoji => this.client.actions.GuildEmojiUpdate.handle(emoji, newEmoji).emoji);\n }\n\n deleteEmoji(emoji, reason) {\n return this.rest.makeRequest('delete', Endpoints.Guild(emoji.guild).Emoji(emoji.id), true, undefined, reason)\n .then(() => this.client.actions.GuildEmojiDelete.handle(emoji).data);\n }\n\n getGuildAuditLogs(guild, options = {}) {\n if (options.before && options.before instanceof GuildAuditLogs.Entry) options.before = options.before.id;\n if (options.after && options.after instanceof GuildAuditLogs.Entry) options.after = options.after.id;\n if (typeof options.type === 'string') options.type = GuildAuditLogs.Actions[options.type];\n\n const queryString = (querystring.stringify({\n before: options.before,\n after: options.after,\n limit: options.limit,\n user_id: this.client.resolver.resolveUserID(options.user),\n action_type: options.type,\n }).match(/[^=&?]+=[^=&?]+/g) || []).join('&');\n\n return this.rest.makeRequest('get', `${Endpoints.Guild(guild).auditLogs}?${queryString}`, true)\n .then(data => GuildAuditLogs.build(guild, data));\n }\n\n getWebhook(id, token) {\n return this.rest.makeRequest('get', Endpoints.Webhook(id, token), !token).then(data =>\n new Webhook(this.client, data)\n );\n }\n\n getGuildWebhooks(guild) {\n return this.rest.makeRequest('get', Endpoints.Guild(guild).webhooks, true).then(data => {\n const hooks = new Collection();\n for (const hook of data) hooks.set(hook.id, new Webhook(this.client, hook));\n return hooks;\n });\n }\n\n getChannelWebhooks(channel) {\n return this.rest.makeRequest('get', Endpoints.Channel(channel).webhooks, true).then(data => {\n const hooks = new Collection();\n for (const hook of data) hooks.set(hook.id, new Webhook(this.client, hook));\n return hooks;\n });\n }\n\n createWebhook(channel, name, avatar, reason) {\n return this.rest.makeRequest('post', Endpoints.Channel(channel).webhooks, true, { name, avatar }, undefined, reason)\n .then(data => new Webhook(this.client, data));\n }\n\n editWebhook(webhook, name, avatar) {\n return this.rest.makeRequest('patch', Endpoints.Webhook(webhook.id, webhook.token), false, {\n name,\n avatar,\n }).then(data => {\n webhook.name = data.name;\n webhook.avatar = data.avatar;\n return webhook;\n });\n }\n\n deleteWebhook(webhook, reason) {\n return this.rest.makeRequest(\n 'delete', Endpoints.Webhook(webhook.id, webhook.token),\n false, undefined, undefined, reason);\n }\n\n sendWebhookMessage(webhook, content, { avatarURL, tts, embeds, username } = {}, files = null) {\n return new Promise((resolve, reject) => {\n username = username || webhook.name;\n\n if (content instanceof Array) {\n const messages = [];\n (function sendChunk(list, index) {\n const options = index === list.length - 1 ? { tts, embeds, files } : { tts };\n webhook.send(list[index], options).then(message => {\n messages.push(message);\n if (index >= list.length - 1) return resolve(messages);\n return sendChunk(list, ++index);\n }).catch(reject);\n }(content, 0));\n } else {\n this.rest.makeRequest('post', `${Endpoints.Webhook(webhook.id, webhook.token)}?wait=true`, false, {\n username,\n avatar_url: avatarURL,\n content,\n tts,\n embeds,\n }, files).then(data => {\n if (!this.client.channels) resolve(data);\n else resolve(this.client.actions.MessageCreate.handle(data).message);\n }, reject);\n }\n });\n }\n\n sendSlackWebhookMessage(webhook, body) {\n return this.rest.makeRequest(\n 'post', `${Endpoints.Webhook(webhook.id, webhook.token)}/slack?wait=true`, false, body\n );\n }\n\n fetchUserProfile(user) {\n return this.rest.makeRequest('get', Endpoints.User(user).profile, true).then(data =>\n new UserProfile(user, data)\n );\n }\n\n fetchMentions(options) {\n if (options.guild instanceof Guild) options.guild = options.guild.id;\n Util.mergeDefault({ limit: 25, roles: true, everyone: true, guild: null }, options);\n\n return this.rest.makeRequest(\n 'get', Endpoints.User('@me').Mentions(options.limit, options.roles, options.everyone, options.guild), true\n ).then(data => data.map(m => new Message(this.client.channels.get(m.channel_id), m, this.client)));\n }\n\n addFriend(user) {\n return this.rest.makeRequest('post', Endpoints.User('@me'), true, {\n username: user.username,\n discriminator: user.discriminator,\n }).then(() => user);\n }\n\n removeFriend(user) {\n return this.rest.makeRequest('delete', Endpoints.User('@me').Relationship(user.id), true)\n .then(() => user);\n }\n\n blockUser(user) {\n return this.rest.makeRequest('put', Endpoints.User('@me').Relationship(user.id), true, { type: 2 })\n .then(() => user);\n }\n\n unblockUser(user) {\n return this.rest.makeRequest('delete', Endpoints.User('@me').Relationship(user.id), true)\n .then(() => user);\n }\n\n updateChannelPositions(guildID, channels) {\n const data = new Array(channels.length);\n for (let i = 0; i < channels.length; i++) {\n data[i] = {\n id: this.client.resolver.resolveChannelID(channels[i].channel),\n position: channels[i].position,\n };\n }\n\n return this.rest.makeRequest('patch', Endpoints.Guild(guildID).channels, true, data).then(() =>\n this.client.actions.GuildChannelsPositionUpdate.handle({\n guild_id: guildID,\n channels,\n }).guild\n );\n }\n\n updateEmbed(guildID, embed, reason) {\n return this.rest.makeRequest('patch', Endpoints.Guild(guildID).embed, true, {\n enabled: embed.enabled,\n channel_id: this.client.resolver.resolveChannelID(embed.channel),\n }, undefined, reason);\n }\n\n setRolePositions(guildID, roles) {\n return this.rest.makeRequest('patch', Endpoints.Guild(guildID).roles, true, roles).then(() =>\n this.client.actions.GuildRolesPositionUpdate.handle({\n guild_id: guildID,\n roles,\n }).guild\n );\n }\n\n setChannelPositions(guildID, channels) {\n return this.rest.makeRequest('patch', Endpoints.Guild(guildID).channels, true, channels).then(() =>\n this.client.actions.GuildChannelsPositionUpdate.handle({\n guild_id: guildID,\n channels,\n }).guild\n );\n }\n\n addMessageReaction(message, emoji) {\n return this.rest.makeRequest(\n 'put', Endpoints.Message(message).Reaction(emoji).User('@me'), true\n ).then(() =>\n message._addReaction(Util.parseEmoji(emoji), message.client.user)\n );\n }\n\n removeMessageReaction(message, emoji, userID) {\n const endpoint = Endpoints.Message(message).Reaction(emoji).User(userID === this.client.user.id ? '@me' : userID);\n return this.rest.makeRequest('delete', endpoint, true).then(() =>\n this.client.actions.MessageReactionRemove.handle({\n user_id: userID,\n message_id: message.id,\n emoji: Util.parseEmoji(emoji),\n channel_id: message.channel.id,\n }).reaction\n );\n }\n\n removeMessageReactions(message) {\n return this.rest.makeRequest('delete', Endpoints.Message(message).reactions, true)\n .then(() => message);\n }\n\n getMessageReactionUsers(message, emoji, options) {\n const queryString = (querystring.stringify(options).match(/[^=&?]+=[^=&?]+/g) || []).join('&');\n\n return this.rest.makeRequest('get', `${Endpoints.Message(message).Reaction(emoji)}?${queryString}`, true);\n }\n\n getApplication(id) {\n return this.rest.makeRequest('get', Endpoints.OAUTH2.Application(id), true).then(app =>\n new OAuth2Application(this.client, app)\n );\n }\n\n resetApplication(id) {\n return this.rest.makeRequest('post', Endpoints.OAUTH2.Application(id).resetToken, true)\n .then(() => this.rest.makeRequest('post', Endpoints.OAUTH2.Application(id).resetSecret, true))\n .then(app => new OAuth2Application(this.client, app));\n }\n\n setNote(user, note) {\n return this.rest.makeRequest('put', Endpoints.User(user).note, true, { note }).then(() => user);\n }\n\n acceptInvite(code) {\n if (code.id) code = code.id;\n return new Promise((resolve, reject) =>\n this.rest.makeRequest('post', Endpoints.Invite(code), true).then(res => {\n const handler = guild => {\n if (guild.id === res.id) {\n resolve(guild);\n this.client.removeListener(Constants.Events.GUILD_CREATE, handler);\n }\n };\n this.client.on(Constants.Events.GUILD_CREATE, handler);\n this.client.setTimeout(() => {\n this.client.removeListener(Constants.Events.GUILD_CREATE, handler);\n reject(new Error('Accepting invite timed out'));\n }, 120e3);\n })\n );\n }\n\n patchUserSettings(data) {\n return this.rest.makeRequest('patch', Constants.Endpoints.User('@me').settings, true, data);\n }\n\n patchClientUserGuildSettings(guildID, data) {\n return this.rest.makeRequest('patch', Constants.Endpoints.User('@me').Guild(guildID).settings, true, data);\n }\n}\n\nmodule.exports = RESTMethods;\n\n\n//# sourceURL=webpack:///./src/client/rest/RESTMethods.js?"); +eval("const querystring = __webpack_require__(/*! querystring */ \"./node_modules/querystring-es3/index.js\");\nconst long = __webpack_require__(/*! long */ \"./node_modules/long/src/long.js\");\nconst Permissions = __webpack_require__(/*! ../../util/Permissions */ \"./src/util/Permissions.js\");\nconst Constants = __webpack_require__(/*! ../../util/Constants */ \"./src/util/Constants.js\");\nconst Endpoints = Constants.Endpoints;\nconst Collection = __webpack_require__(/*! ../../util/Collection */ \"./src/util/Collection.js\");\nconst Util = __webpack_require__(/*! ../../util/Util */ \"./src/util/Util.js\");\nconst resolvePermissions = __webpack_require__(/*! ../../structures/shared/resolvePermissions */ \"./src/structures/shared/resolvePermissions.js\");\n\nconst RichEmbed = __webpack_require__(/*! ../../structures/RichEmbed */ \"./src/structures/RichEmbed.js\");\nconst User = __webpack_require__(/*! ../../structures/User */ \"./src/structures/User.js\");\nconst GuildMember = __webpack_require__(/*! ../../structures/GuildMember */ \"./src/structures/GuildMember.js\");\nconst Message = __webpack_require__(/*! ../../structures/Message */ \"./src/structures/Message.js\");\nconst Role = __webpack_require__(/*! ../../structures/Role */ \"./src/structures/Role.js\");\nconst Invite = __webpack_require__(/*! ../../structures/Invite */ \"./src/structures/Invite.js\");\nconst Webhook = __webpack_require__(/*! ../../structures/Webhook */ \"./src/structures/Webhook.js\");\nconst UserProfile = __webpack_require__(/*! ../../structures/UserProfile */ \"./src/structures/UserProfile.js\");\nconst OAuth2Application = __webpack_require__(/*! ../../structures/OAuth2Application */ \"./src/structures/OAuth2Application.js\");\nconst Channel = __webpack_require__(/*! ../../structures/Channel */ \"./src/structures/Channel.js\");\nconst GroupDMChannel = __webpack_require__(/*! ../../structures/GroupDMChannel */ \"./src/structures/GroupDMChannel.js\");\nconst Guild = __webpack_require__(/*! ../../structures/Guild */ \"./src/structures/Guild.js\");\nconst VoiceRegion = __webpack_require__(/*! ../../structures/VoiceRegion */ \"./src/structures/VoiceRegion.js\");\nconst GuildAuditLogs = __webpack_require__(/*! ../../structures/GuildAuditLogs */ \"./src/structures/GuildAuditLogs.js\");\n\nconst MessageFlags = __webpack_require__(/*! ../../util/MessageFlags */ \"./src/util/MessageFlags.js\");\n\nclass RESTMethods {\n constructor(restManager) {\n this.rest = restManager;\n this.client = restManager.client;\n this._ackToken = null;\n }\n\n login(token = this.client.token) {\n return new Promise((resolve, reject) => {\n if (!token || typeof token !== 'string') throw new Error(Constants.Errors.INVALID_TOKEN);\n token = token.replace(/^Bot\\s*/i, '');\n this.client.manager.connectToWebSocket(token, resolve, reject);\n }).catch(e => {\n this.client.destroy();\n return Promise.reject(e);\n });\n }\n\n logout() {\n return this.rest.makeRequest('post', Endpoints.logout, true, {});\n }\n\n getGateway(bot = false) {\n return this.rest.makeRequest('get', bot ? Endpoints.gateway.bot : Endpoints.gateway, true);\n }\n\n fetchVoiceRegions(guildID) {\n let endpoint;\n if (guildID) endpoint = Endpoints.Guild(guildID).voiceRegions;\n else endpoint = Endpoints.voiceRegions;\n return this.rest.makeRequest('get', endpoint, true).then(res => {\n const regions = new Collection();\n for (const region of res) regions.set(region.id, new VoiceRegion(region));\n return regions;\n });\n }\n\n fetchEmbed(guildID) {\n return this.rest.makeRequest('get', Endpoints.Guild(guildID).embed, true).then(data => ({\n enabled: data.enabled,\n channel: data.channel_id ? this.client.channels.get(data.channel_id) : null,\n }));\n }\n\n sendMessage(channel, content, { tts, nonce, embed, disableEveryone, split, code, reply } = {}, files = null) {\n return new Promise((resolve, reject) => { // eslint-disable-line complexity\n if (typeof content !== 'undefined') content = this.client.resolver.resolveString(content);\n\n // The nonce has to be a uint64 :<\n if (typeof nonce !== 'undefined') {\n nonce = parseInt(nonce);\n if (isNaN(nonce) || nonce < 0) throw new RangeError('Message nonce must fit in an unsigned 64-bit integer.');\n }\n\n if (content) {\n if (split && typeof split !== 'object') split = {};\n\n // Wrap everything in a code block\n if (typeof code !== 'undefined' && (typeof code !== 'boolean' || code === true)) {\n content = Util.escapeMarkdown(this.client.resolver.resolveString(content), true);\n content = `\\`\\`\\`${typeof code !== 'boolean' ? code || '' : ''}\\n${content}\\n\\`\\`\\``;\n if (split) {\n split.prepend = `\\`\\`\\`${typeof code !== 'boolean' ? code || '' : ''}\\n`;\n split.append = '\\n```';\n }\n }\n\n // Add zero-width spaces to @everyone/@here\n if (disableEveryone || (typeof disableEveryone === 'undefined' && this.client.options.disableEveryone)) {\n content = content.replace(/@(everyone|here)/g, '@\\u200b$1');\n }\n\n // Add the reply prefix\n if (reply && !(channel instanceof User || channel instanceof GuildMember) && channel.type !== 'dm') {\n const id = this.client.resolver.resolveUserID(reply);\n const mention = `<@${reply instanceof GuildMember && reply.nickname ? '!' : ''}${id}>`;\n content = `${mention}${content ? `, ${content}` : ''}`;\n if (split) split.prepend = `${mention}, ${split.prepend || ''}`;\n }\n\n // Split the content\n if (split) content = Util.splitMessage(content, split);\n } else if (reply && !(channel instanceof User || channel instanceof GuildMember) && channel.type !== 'dm') {\n const id = this.client.resolver.resolveUserID(reply);\n content = `<@${reply instanceof GuildMember && reply.nickname ? '!' : ''}${id}>`;\n }\n\n const send = chan => {\n if (content instanceof Array) {\n const messages = [];\n (function sendChunk(list, index) {\n const options = index === list.length - 1 ? { tts, embed, files } : { tts };\n chan.send(list[index], options).then(message => {\n messages.push(message);\n if (index >= list.length - 1) return resolve(messages);\n return sendChunk(list, ++index);\n }).catch(reject);\n }(content, 0));\n } else {\n this.rest.makeRequest('post', Endpoints.Channel(chan).messages, true, {\n content, tts, nonce, embed,\n }, files).then(data => resolve(this.client.actions.MessageCreate.handle(data).message), reject);\n }\n };\n\n if (channel instanceof User || channel instanceof GuildMember) this.createDM(channel).then(send, reject);\n else send(channel);\n });\n }\n\n updateMessage(message, content, { flags, embed, code, reply } = {}) {\n if (typeof content !== 'undefined') content = this.client.resolver.resolveString(content);\n\n if (typeof flags !== 'undefined') flags = MessageFlags.resolve(flags);\n\n // Wrap everything in a code block\n if (typeof code !== 'undefined' && (typeof code !== 'boolean' || code === true)) {\n content = Util.escapeMarkdown(this.client.resolver.resolveString(content), true);\n content = `\\`\\`\\`${typeof code !== 'boolean' ? code || '' : ''}\\n${content}\\n\\`\\`\\``;\n }\n\n // Add the reply prefix\n if (reply && message.channel.type !== 'dm') {\n const id = this.client.resolver.resolveUserID(reply);\n const mention = `<@${reply instanceof GuildMember && reply.nickname ? '!' : ''}${id}>`;\n content = `${mention}${content ? `, ${content}` : ''}`;\n }\n\n if (embed instanceof RichEmbed) embed = embed.toJSON();\n\n return this.rest.makeRequest('patch', Endpoints.Message(message), true, {\n content, embed, flags,\n }).then(data => this.client.actions.MessageUpdate.handle(data).updated);\n }\n\n deleteMessage(message) {\n return this.rest.makeRequest('delete', Endpoints.Message(message), true)\n .then(() =>\n this.client.actions.MessageDelete.handle({\n id: message.id,\n channel_id: message.channel.id,\n }).message\n );\n }\n\n ackMessage(message) {\n return this.rest.makeRequest('post', Endpoints.Message(message).ack, true, { token: this._ackToken }).then(res => {\n if (res.token) this._ackToken = res.token;\n return message;\n });\n }\n\n ackTextChannel(channel) {\n return this.rest.makeRequest('post', Endpoints.Channel(channel).Message(channel.lastMessageID).ack, true, {\n token: this._ackToken,\n }).then(res => {\n if (res.token) this._ackToken = res.token;\n return channel;\n });\n }\n\n ackGuild(guild) {\n return this.rest.makeRequest('post', Endpoints.Guild(guild).ack, true).then(() => guild);\n }\n\n bulkDeleteMessages(channel, messages) {\n return this.rest.makeRequest('post', Endpoints.Channel(channel).messages.bulkDelete, true, {\n messages: messages,\n }).then(() =>\n this.client.actions.MessageDeleteBulk.handle({\n channel_id: channel.id,\n ids: messages,\n }).messages\n );\n }\n\n search(target, options) {\n if (typeof options === 'string') options = { content: options };\n if (options.before) {\n if (!(options.before instanceof Date)) options.before = new Date(options.before);\n options.maxID = long.fromNumber(options.before.getTime() - 14200704e5).shiftLeft(22).toString();\n }\n if (options.after) {\n if (!(options.after instanceof Date)) options.after = new Date(options.after);\n options.minID = long.fromNumber(options.after.getTime() - 14200704e5).shiftLeft(22).toString();\n }\n if (options.during) {\n if (!(options.during instanceof Date)) options.during = new Date(options.during);\n const t = options.during.getTime() - 14200704e5;\n options.minID = long.fromNumber(t).shiftLeft(22).toString();\n options.maxID = long.fromNumber(t + 86400000).shiftLeft(22).toString();\n }\n if (options.channel) options.channel = this.client.resolver.resolveChannelID(options.channel);\n if (options.author) options.author = this.client.resolver.resolveUserID(options.author);\n if (options.mentions) options.mentions = this.client.resolver.resolveUserID(options.options.mentions);\n options = {\n content: options.content,\n max_id: options.maxID,\n min_id: options.minID,\n has: options.has,\n channel_id: options.channel,\n author_id: options.author,\n author_type: options.authorType,\n context_size: options.contextSize,\n sort_by: options.sortBy,\n sort_order: options.sortOrder,\n limit: options.limit,\n offset: options.offset,\n mentions: options.mentions,\n mentions_everyone: options.mentionsEveryone,\n link_hostname: options.linkHostname,\n embed_provider: options.embedProvider,\n embed_type: options.embedType,\n attachment_filename: options.attachmentFilename,\n attachment_extension: options.attachmentExtension,\n include_nsfw: options.nsfw,\n };\n\n for (const key of Object.keys(options)) if (options[key] === undefined) delete options[key];\n const queryString = (querystring.stringify(options).match(/[^=&?]+=[^=&?]+/g) || []).join('&');\n\n let endpoint;\n if (target instanceof Channel) {\n endpoint = Endpoints.Channel(target).search;\n } else if (target instanceof Guild) {\n endpoint = Endpoints.Guild(target).search;\n } else {\n throw new TypeError('Target must be a TextChannel, DMChannel, GroupDMChannel, or Guild.');\n }\n return this.rest.makeRequest('get', `${endpoint}?${queryString}`, true).then(body => {\n const messages = body.messages.map(x =>\n x.map(m => new Message(this.client.channels.get(m.channel_id), m, this.client))\n );\n return {\n totalResults: body.total_results,\n messages,\n };\n });\n }\n\n createChannel(guild, name, options) {\n const {\n type,\n topic,\n nsfw,\n bitrate,\n userLimit,\n parent,\n permissionOverwrites,\n position,\n rateLimitPerUser,\n reason,\n } = options;\n return this.rest.makeRequest('post', Endpoints.Guild(guild).channels, true, {\n name,\n topic,\n type: type ? Constants.ChannelTypes[type.toUpperCase()] : Constants.ChannelTypes.TEXT,\n nsfw,\n bitrate,\n user_limit: userLimit,\n parent_id: parent instanceof Channel ? parent.id : parent,\n permission_overwrites: resolvePermissions.call(this, permissionOverwrites, guild),\n position,\n rate_limit_per_user: rateLimitPerUser,\n },\n undefined,\n reason).then(data => this.client.actions.ChannelCreate.handle(data).channel);\n }\n\n createDM(recipient) {\n const dmChannel = this.getExistingDM(recipient);\n if (dmChannel) return Promise.resolve(dmChannel);\n return this.rest.makeRequest('post', Endpoints.User(this.client.user).channels, true, {\n recipient_id: recipient.id,\n }).then(data => this.client.actions.ChannelCreate.handle(data).channel);\n }\n\n createGroupDM(options) {\n const data = this.client.user.bot ?\n { access_tokens: options.accessTokens, nicks: options.nicks } :\n { recipients: options.recipients };\n return this.rest.makeRequest('post', Endpoints.User('@me').channels, true, data)\n .then(res => new GroupDMChannel(this.client, res));\n }\n\n addUserToGroupDM(channel, options) {\n const data = this.client.user.bot ?\n { nick: options.nick, access_token: options.accessToken } :\n { recipient: options.id };\n return this.rest.makeRequest('put', Endpoints.Channel(channel).Recipient(options.id), true, data)\n .then(() => channel);\n }\n\n removeUserFromGroupDM(channel, userId) {\n return this.rest.makeRequest('delete', Endpoints.Channel(channel).Recipient(userId), true)\n .then(() => channel);\n }\n\n updateGroupDMChannel(channel, _data) {\n const data = {};\n data.name = _data.name;\n data.icon = _data.icon;\n return this.rest.makeRequest('patch', Endpoints.Channel(channel), true, data).then(() => channel);\n }\n\n getExistingDM(recipient) {\n return this.client.channels.find(channel =>\n channel.recipient && channel.recipient.id === recipient.id\n );\n }\n\n deleteChannel(channel, reason) {\n if (channel instanceof User || channel instanceof GuildMember) channel = this.getExistingDM(channel);\n if (!channel) return Promise.reject(new Error('No channel to delete.'));\n return this.rest.makeRequest('delete', Endpoints.Channel(channel), true, undefined, undefined, reason)\n .then(data => {\n data.id = channel.id;\n return this.client.actions.ChannelDelete.handle(data).channel;\n });\n }\n\n updateChannel(channel, _data, reason) {\n const data = {};\n data.name = (_data.name || channel.name).trim();\n data.topic = typeof _data.topic === 'undefined' ? channel.topic : _data.topic;\n data.nsfw = typeof _data.nsfw === 'undefined' ? channel.nsfw : _data.nsfw;\n data.position = _data.position || channel.position;\n data.bitrate = _data.bitrate || (channel.bitrate ? channel.bitrate * 1000 : undefined);\n data.user_limit = typeof _data.userLimit !== 'undefined' ? _data.userLimit : channel.userLimit;\n data.parent_id = _data.parent instanceof Channel ? _data.parent.id : _data.parent;\n data.permission_overwrites = _data.permissionOverwrites ?\n resolvePermissions.call(this, _data.permissionOverwrites, channel.guild) : undefined;\n data.rate_limit_per_user = typeof _data.rateLimitPerUser !== 'undefined' ?\n _data.rateLimitPerUser : channel.rateLimitPerUser;\n return this.rest.makeRequest('patch', Endpoints.Channel(channel), true, data, undefined, reason).then(newData =>\n this.client.actions.ChannelUpdate.handle(newData).updated\n );\n }\n\n leaveGuild(guild) {\n if (guild.ownerID === this.client.user.id) return Promise.reject(new Error('Guild is owned by the client.'));\n return this.rest.makeRequest('delete', Endpoints.User('@me').Guild(guild.id), true).then(() =>\n this.client.actions.GuildDelete.handle({ id: guild.id }).guild\n );\n }\n\n createGuild(options) {\n options.icon = this.client.resolver.resolveBase64(options.icon) || null;\n options.region = options.region || 'us-central';\n return new Promise((resolve, reject) => {\n this.rest.makeRequest('post', Endpoints.guilds, true, options).then(data => {\n if (this.client.guilds.has(data.id)) return resolve(this.client.guilds.get(data.id));\n\n const handleGuild = guild => {\n if (guild.id === data.id) {\n this.client.removeListener(Constants.Events.GUILD_CREATE, handleGuild);\n this.client.clearTimeout(timeout);\n resolve(guild);\n }\n };\n this.client.on(Constants.Events.GUILD_CREATE, handleGuild);\n\n const timeout = this.client.setTimeout(() => {\n this.client.removeListener(Constants.Events.GUILD_CREATE, handleGuild);\n reject(new Error('Took too long to receive guild data.'));\n }, 10000);\n return undefined;\n }, reject);\n });\n }\n\n // Untested but probably will work\n deleteGuild(guild) {\n return this.rest.makeRequest('delete', Endpoints.Guild(guild), true).then(() =>\n this.client.actions.GuildDelete.handle({ id: guild.id }).guild\n );\n }\n\n getUser(userID, cache) {\n return this.rest.makeRequest('get', Endpoints.User(userID), true).then(data => {\n if (cache) return this.client.actions.UserGet.handle(data).user;\n else return new User(this.client, data);\n });\n }\n\n updateCurrentUser(_data, password) {\n const user = this.client.user;\n const data = {};\n data.username = _data.username || user.username;\n data.avatar = typeof _data.avatar === 'undefined' ? user.avatar : this.client.resolver.resolveBase64(_data.avatar);\n if (!user.bot) {\n data.email = _data.email || user.email;\n data.password = password;\n if (_data.new_password) data.new_password = _data.newPassword;\n }\n return this.rest.makeRequest('patch', Endpoints.User('@me'), true, data).then(newData =>\n this.client.actions.UserUpdate.handle(newData).updated\n );\n }\n\n updateGuild(guild, data, reason) {\n return this.rest.makeRequest('patch', Endpoints.Guild(guild), true, data, undefined, reason).then(newData =>\n this.client.actions.GuildUpdate.handle(newData).updated\n );\n }\n\n kickGuildMember(guild, member, reason) {\n return this.rest.makeRequest(\n 'delete', Endpoints.Guild(guild).Member(member), true,\n undefined, undefined, reason)\n .then(() => member);\n }\n\n createGuildRole(guild, data, reason) {\n if (data.color) data.color = this.client.resolver.resolveColor(data.color);\n if (data.permissions) data.permissions = Permissions.resolve(data.permissions);\n return this.rest.makeRequest('post', Endpoints.Guild(guild).roles, true, data, undefined, reason).then(r => {\n const { role } = this.client.actions.GuildRoleCreate.handle({\n guild_id: guild.id,\n role: r,\n });\n if (data.position) return role.setPosition(data.position, reason);\n return role;\n });\n }\n\n deleteGuildRole(role, reason) {\n return this.rest.makeRequest(\n 'delete', Endpoints.Guild(role.guild).Role(role.id), true,\n undefined, undefined, reason)\n .then(() =>\n this.client.actions.GuildRoleDelete.handle({\n guild_id: role.guild.id,\n role_id: role.id,\n }).role\n );\n }\n\n setChannelOverwrite(channel, payload) {\n return this.rest.makeRequest('put', `${Endpoints.Channel(channel).permissions}/${payload.id}`, true, payload);\n }\n\n deletePermissionOverwrites(overwrite, reason) {\n return this.rest.makeRequest(\n 'delete', `${Endpoints.Channel(overwrite.channel).permissions}/${overwrite.id}`,\n true, undefined, undefined, reason\n ).then(() => overwrite);\n }\n\n getChannelMessages(channel, payload = {}) {\n const params = [];\n if (payload.limit) params.push(`limit=${payload.limit}`);\n if (payload.around) params.push(`around=${payload.around}`);\n else if (payload.before) params.push(`before=${payload.before}`);\n else if (payload.after) params.push(`after=${payload.after}`);\n\n let endpoint = Endpoints.Channel(channel).messages;\n if (params.length > 0) endpoint += `?${params.join('&')}`;\n return this.rest.makeRequest('get', endpoint, true);\n }\n\n getChannelMessage(channel, messageID) {\n const msg = channel.messages.get(messageID);\n if (msg) return Promise.resolve(msg);\n return this.rest.makeRequest('get', Endpoints.Channel(channel).Message(messageID), true);\n }\n\n putGuildMember(guild, userID, options) {\n options.access_token = options.accessToken;\n if (options.roles) {\n const roles = options.roles;\n if (roles instanceof Collection || (roles instanceof Array && roles[0] instanceof Role)) {\n options.roles = roles.map(role => role.id);\n }\n }\n return this.rest.makeRequest('put', Endpoints.Guild(guild).Member(userID), true, options)\n .then(data => this.client.actions.GuildMemberGet.handle(guild, data).member);\n }\n\n getGuild(guild) {\n return this.rest.makeRequest('get', Endpoints.Guild(guild), true);\n }\n\n getGuildMember(guild, userID, cache) {\n return this.rest.makeRequest('get', Endpoints.Guild(guild).Member(userID), true).then(data => {\n if (cache) return this.client.actions.GuildMemberGet.handle(guild, data).member;\n else return new GuildMember(guild, data);\n });\n }\n\n updateGuildMember(member, data, reason) {\n if (data.channel) {\n const channel = this.client.resolver.resolveChannel(data.channel);\n if (!channel || channel.guild.id !== member.guild.id || channel.type !== 'voice') {\n return Promise.reject(new Error('Could not resolve channel to a guild voice channel.'));\n }\n data.channel_id = channel.id;\n data.channel = undefined;\n } else if (data.channel === null) {\n data.channel_id = null;\n data.channel = undefined;\n }\n if (data.roles) data.roles = [...new Set(data.roles.map(role => role instanceof Role ? role.id : role))];\n\n let endpoint = Endpoints.Member(member);\n // Fix your endpoints, discord ;-;\n if (member.id === this.client.user.id) {\n const keys = Object.keys(data);\n if (keys.length === 1 && keys[0] === 'nick') {\n endpoint = Endpoints.Member(member).nickname;\n }\n }\n\n return this.rest.makeRequest('patch', endpoint, true, data, undefined, reason).then(newData =>\n member.guild._updateMember(member, newData).mem\n );\n }\n\n addMemberRole(member, role, reason) {\n return new Promise((resolve, reject) => {\n if (member._roles.includes(role.id)) return resolve(member);\n\n const listener = (oldMember, newMember) => {\n if (newMember.id === member.id && !oldMember._roles.includes(role.id) && newMember._roles.includes(role.id)) {\n this.client.removeListener(Constants.Events.GUILD_MEMBER_UPDATE, listener);\n resolve(newMember);\n }\n };\n\n this.client.on(Constants.Events.GUILD_MEMBER_UPDATE, listener);\n const timeout = this.client.setTimeout(() => {\n this.client.removeListener(Constants.Events.GUILD_MEMBER_UPDATE, listener);\n reject(new Error('Adding the role timed out.'));\n }, 10e3);\n\n return this.rest.makeRequest('put', Endpoints.Member(member).Role(role.id), true, undefined, undefined, reason)\n .catch(err => {\n this.client.removeListener(Constants.Events.GUILD_MEMBER_UPDATE, listener);\n this.client.clearTimeout(timeout);\n reject(err);\n });\n });\n }\n\n removeMemberRole(member, role, reason) {\n return new Promise((resolve, reject) => {\n if (!member._roles.includes(role.id)) return resolve(member);\n\n const listener = (oldMember, newMember) => {\n if (newMember.id === member.id && oldMember._roles.includes(role.id) && !newMember._roles.includes(role.id)) {\n this.client.removeListener(Constants.Events.GUILD_MEMBER_UPDATE, listener);\n resolve(newMember);\n }\n };\n\n this.client.on(Constants.Events.GUILD_MEMBER_UPDATE, listener);\n const timeout = this.client.setTimeout(() => {\n this.client.removeListener(Constants.Events.GUILD_MEMBER_UPDATE, listener);\n reject(new Error('Removing the role timed out.'));\n }, 10e3);\n\n return this.rest.makeRequest('delete', Endpoints.Member(member).Role(role.id), true, undefined, undefined, reason)\n .catch(err => {\n this.client.removeListener(Constants.Events.GUILD_MEMBER_UPDATE, listener);\n this.client.clearTimeout(timeout);\n reject(err);\n });\n });\n }\n\n sendTyping(channelID) {\n return this.rest.makeRequest('post', Endpoints.Channel(channelID).typing, true);\n }\n\n banGuildMember(guild, member, options) {\n const id = this.client.resolver.resolveUserID(member);\n if (!id) return Promise.reject(new Error('Couldn\\'t resolve the user ID to ban.'));\n\n const url = `${Endpoints.Guild(guild).bans}/${id}?${querystring.stringify(options)}`;\n return this.rest.makeRequest('put', url, true).then(() => {\n if (member instanceof GuildMember) return member;\n const user = this.client.resolver.resolveUser(id);\n if (user) {\n member = this.client.resolver.resolveGuildMember(guild, user);\n return member || user;\n }\n return id;\n });\n }\n\n unbanGuildMember(guild, member, reason) {\n return new Promise((resolve, reject) => {\n const id = this.client.resolver.resolveUserID(member);\n if (!id) throw new Error('Couldn\\'t resolve the user ID to unban.');\n\n const listener = (eGuild, eUser) => {\n if (eGuild.id === guild.id && eUser.id === id) {\n this.client.removeListener(Constants.Events.GUILD_BAN_REMOVE, listener);\n this.client.clearTimeout(timeout);\n resolve(eUser);\n }\n };\n this.client.on(Constants.Events.GUILD_BAN_REMOVE, listener);\n\n const timeout = this.client.setTimeout(() => {\n this.client.removeListener(Constants.Events.GUILD_BAN_REMOVE, listener);\n reject(new Error('Took too long to receive the ban remove event.'));\n }, 10000);\n\n this.rest.makeRequest('delete', `${Endpoints.Guild(guild).bans}/${id}`, true, undefined, undefined, reason)\n .catch(err => {\n this.client.removeListener(Constants.Events.GUILD_BAN_REMOVE, listener);\n this.client.clearTimeout(timeout);\n reject(err);\n });\n });\n }\n\n getGuildBan(guild, user) {\n const id = this.client.resolver.resolveUserID(user);\n return this.rest.makeRequest('get', `${Endpoints.Guild(guild).bans}/${id}`, true).then(ban => ({\n reason: ban.reason,\n user: this.client.dataManager.newUser(ban.user),\n }));\n }\n\n getGuildBans(guild) {\n return this.rest.makeRequest('get', Endpoints.Guild(guild).bans, true).then(bans =>\n bans.reduce((collection, ban) => {\n collection.set(ban.user.id, {\n reason: ban.reason,\n user: this.client.dataManager.newUser(ban.user),\n });\n return collection;\n }, new Collection())\n );\n }\n\n updateGuildRole(role, _data, reason) {\n const data = {};\n data.name = _data.name || role.name;\n data.position = typeof _data.position !== 'undefined' ? _data.position : role.position;\n data.color = _data.color === null ? null : this.client.resolver.resolveColor(_data.color || role.color);\n data.hoist = typeof _data.hoist !== 'undefined' ? _data.hoist : role.hoist;\n data.mentionable = typeof _data.mentionable !== 'undefined' ? _data.mentionable : role.mentionable;\n\n if (typeof _data.permissions !== 'undefined') data.permissions = Permissions.resolve(_data.permissions);\n else data.permissions = role.permissions;\n\n return this.rest.makeRequest('patch', Endpoints.Guild(role.guild).Role(role.id), true, data, undefined, reason)\n .then(_role =>\n this.client.actions.GuildRoleUpdate.handle({\n role: _role,\n guild_id: role.guild.id,\n }).updated\n );\n }\n\n pinMessage(message) {\n return this.rest.makeRequest('put', Endpoints.Channel(message.channel).Pin(message.id), true)\n .then(() => message);\n }\n\n unpinMessage(message) {\n return this.rest.makeRequest('delete', Endpoints.Channel(message.channel).Pin(message.id), true)\n .then(() => message);\n }\n\n getChannelPinnedMessages(channel) {\n return this.rest.makeRequest('get', Endpoints.Channel(channel).pins, true);\n }\n\n createChannelInvite(channel, options, reason) {\n const payload = {};\n payload.temporary = options.temporary;\n payload.max_age = options.maxAge;\n payload.max_uses = options.maxUses;\n payload.unique = options.unique;\n return this.rest.makeRequest('post', Endpoints.Channel(channel).invites, true, payload, undefined, reason)\n .then(invite => new Invite(this.client, invite));\n }\n\n deleteInvite(invite, reason) {\n return this.rest.makeRequest('delete', Endpoints.Invite(invite.code), true, undefined, undefined, reason)\n .then(() => invite);\n }\n\n getInvite(code) {\n return this.rest.makeRequest('get', Endpoints.Invite(code), true).then(invite =>\n new Invite(this.client, invite)\n );\n }\n\n getGuildInvites(guild) {\n return this.rest.makeRequest('get', Endpoints.Guild(guild).invites, true).then(inviteItems => {\n const invites = new Collection();\n for (const inviteItem of inviteItems) {\n const invite = new Invite(this.client, inviteItem);\n invites.set(invite.code, invite);\n }\n return invites;\n });\n }\n\n getGuildVanityCode(guild) {\n return this.rest.makeRequest('get', Endpoints.Guild(guild).vanityURL, true)\n .then(res => res.code);\n }\n\n pruneGuildMembers(guild, days, dry, reason) {\n return this.rest.makeRequest(dry ?\n 'get' :\n 'post',\n `${Endpoints.Guild(guild).prune}?days=${days}`, true, undefined, undefined, reason)\n .then(data => data.pruned);\n }\n\n createEmoji(guild, image, name, roles, reason) {\n const data = { image, name };\n if (roles) data.roles = roles.map(r => r.id ? r.id : r);\n return this.rest.makeRequest('post', Endpoints.Guild(guild).emojis, true, data, undefined, reason)\n .then(emoji => this.client.actions.GuildEmojiCreate.handle(guild, emoji).emoji);\n }\n\n updateEmoji(emoji, _data, reason) {\n const data = {};\n if (_data.name) data.name = _data.name;\n if (_data.roles) data.roles = _data.roles.map(r => r.id ? r.id : r);\n return this.rest.makeRequest('patch', Endpoints.Guild(emoji.guild).Emoji(emoji.id), true, data, undefined, reason)\n .then(newEmoji => this.client.actions.GuildEmojiUpdate.handle(emoji, newEmoji).emoji);\n }\n\n deleteEmoji(emoji, reason) {\n return this.rest.makeRequest('delete', Endpoints.Guild(emoji.guild).Emoji(emoji.id), true, undefined, reason)\n .then(() => this.client.actions.GuildEmojiDelete.handle(emoji).emoji);\n }\n\n getGuildAuditLogs(guild, options = {}) {\n if (options.before && options.before instanceof GuildAuditLogs.Entry) options.before = options.before.id;\n if (options.after && options.after instanceof GuildAuditLogs.Entry) options.after = options.after.id;\n if (typeof options.type === 'string') options.type = GuildAuditLogs.Actions[options.type];\n\n const queryString = (querystring.stringify({\n before: options.before,\n after: options.after,\n limit: options.limit,\n user_id: this.client.resolver.resolveUserID(options.user),\n action_type: options.type,\n }).match(/[^=&?]+=[^=&?]+/g) || []).join('&');\n\n return this.rest.makeRequest('get', `${Endpoints.Guild(guild).auditLogs}?${queryString}`, true)\n .then(data => GuildAuditLogs.build(guild, data));\n }\n\n getWebhook(id, token) {\n return this.rest.makeRequest('get', Endpoints.Webhook(id, token), !token).then(data =>\n new Webhook(this.client, data)\n );\n }\n\n getGuildWebhooks(guild) {\n return this.rest.makeRequest('get', Endpoints.Guild(guild).webhooks, true).then(data => {\n const hooks = new Collection();\n for (const hook of data) hooks.set(hook.id, new Webhook(this.client, hook));\n return hooks;\n });\n }\n\n getChannelWebhooks(channel) {\n return this.rest.makeRequest('get', Endpoints.Channel(channel).webhooks, true).then(data => {\n const hooks = new Collection();\n for (const hook of data) hooks.set(hook.id, new Webhook(this.client, hook));\n return hooks;\n });\n }\n\n createWebhook(channel, name, avatar, reason) {\n return this.rest.makeRequest('post', Endpoints.Channel(channel).webhooks, true, { name, avatar }, undefined, reason)\n .then(data => new Webhook(this.client, data));\n }\n\n editWebhook(webhook, options, reason) {\n let endpoint;\n let auth;\n\n // Changing the channel of a webhook or specifying a reason requires a bot token\n if (options.channel_id || reason) {\n endpoint = Endpoints.Webhook(webhook.id);\n auth = true;\n } else {\n endpoint = Endpoints.Webhook(webhook.id, webhook.token);\n auth = false;\n }\n\n return this.rest.makeRequest('patch', endpoint, auth, options, undefined, reason).then(data => {\n webhook.name = data.name;\n webhook.avatar = data.avatar;\n webhook.channelID = data.channel_id;\n return webhook;\n });\n }\n\n deleteWebhook(webhook, reason) {\n return this.rest.makeRequest(\n 'delete', Endpoints.Webhook(webhook.id, webhook.token),\n false, undefined, undefined, reason);\n }\n\n sendWebhookMessage(webhook, content, { avatarURL, tts, embeds, username } = {}, files = null) {\n return new Promise((resolve, reject) => {\n username = username || webhook.name;\n\n if (content instanceof Array) {\n const messages = [];\n (function sendChunk(list, index) {\n const options = index === list.length - 1 ? { tts, embeds, files } : { tts };\n webhook.send(list[index], options).then(message => {\n messages.push(message);\n if (index >= list.length - 1) return resolve(messages);\n return sendChunk(list, ++index);\n }).catch(reject);\n }(content, 0));\n } else {\n this.rest.makeRequest('post', `${Endpoints.Webhook(webhook.id, webhook.token)}?wait=true`, false, {\n username,\n avatar_url: avatarURL,\n content,\n tts,\n embeds,\n }, files).then(data => {\n if (!this.client.channels) resolve(data);\n else resolve(this.client.actions.MessageCreate.handle(data).message);\n }, reject);\n }\n });\n }\n\n sendSlackWebhookMessage(webhook, body) {\n return this.rest.makeRequest(\n 'post', `${Endpoints.Webhook(webhook.id, webhook.token)}/slack?wait=true`, false, body\n );\n }\n\n fetchUserProfile(user) {\n return this.rest.makeRequest('get', Endpoints.User(user).profile, true).then(data =>\n new UserProfile(user, data)\n );\n }\n\n fetchMentions(options) {\n if (options.guild instanceof Guild) options.guild = options.guild.id;\n Util.mergeDefault({ limit: 25, roles: true, everyone: true, guild: null }, options);\n\n return this.rest.makeRequest(\n 'get', Endpoints.User('@me').Mentions(options.limit, options.roles, options.everyone, options.guild), true\n ).then(data => data.map(m => new Message(this.client.channels.get(m.channel_id), m, this.client)));\n }\n\n addFriend(user) {\n return this.rest.makeRequest('post', Endpoints.User('@me'), true, {\n username: user.username,\n discriminator: user.discriminator,\n }).then(() => user);\n }\n\n removeFriend(user) {\n return this.rest.makeRequest('delete', Endpoints.User('@me').Relationship(user.id), true)\n .then(() => user);\n }\n\n blockUser(user) {\n return this.rest.makeRequest('put', Endpoints.User('@me').Relationship(user.id), true, { type: 2 })\n .then(() => user);\n }\n\n unblockUser(user) {\n return this.rest.makeRequest('delete', Endpoints.User('@me').Relationship(user.id), true)\n .then(() => user);\n }\n\n updateEmbed(guildID, embed, reason) {\n return this.rest.makeRequest('patch', Endpoints.Guild(guildID).embed, true, {\n enabled: embed.enabled,\n channel_id: this.client.resolver.resolveChannelID(embed.channel),\n }, undefined, reason);\n }\n\n setRolePositions(guildID, roles) {\n return this.rest.makeRequest('patch', Endpoints.Guild(guildID).roles, true, roles).then(() =>\n this.client.actions.GuildRolesPositionUpdate.handle({\n guild_id: guildID,\n roles,\n }).guild\n );\n }\n\n setChannelPositions(guildID, channels) {\n return this.rest.makeRequest('patch', Endpoints.Guild(guildID).channels, true, channels).then(() =>\n this.client.actions.GuildChannelsPositionUpdate.handle({\n guild_id: guildID,\n channels,\n }).guild\n );\n }\n\n addMessageReaction(message, emoji) {\n return this.rest.makeRequest(\n 'put', Endpoints.Message(message).Reaction(emoji).User('@me'), true\n ).then(() =>\n message._addReaction(Util.parseEmoji(emoji), message.client.user)\n );\n }\n\n removeMessageReaction(message, emoji, userID) {\n const endpoint = Endpoints.Message(message).Reaction(emoji).User(userID === this.client.user.id ? '@me' : userID);\n return this.rest.makeRequest('delete', endpoint, true).then(() =>\n this.client.actions.MessageReactionRemove.handle({\n user_id: userID,\n message_id: message.id,\n emoji: Util.parseEmoji(emoji),\n channel_id: message.channel.id,\n }).reaction\n );\n }\n\n removeMessageReactionEmoji(message, emoji) {\n const endpoint = Endpoints.Message(message).Reaction(emoji);\n return this.rest.makeRequest('delete', endpoint, true).then(() =>\n this.client.actions.MessageReactionRemoveEmoji.handle({\n message_id: message.id,\n emoji: Util.parseEmoji(emoji),\n channel_id: message.channel.id,\n }).reaction\n );\n }\n\n removeMessageReactions(message) {\n return this.rest.makeRequest('delete', Endpoints.Message(message).reactions, true)\n .then(() => message);\n }\n\n getMessageReactionUsers(message, emoji, options) {\n const queryString = (querystring.stringify(options).match(/[^=&?]+=[^=&?]+/g) || []).join('&');\n\n return this.rest.makeRequest('get', `${Endpoints.Message(message).Reaction(emoji)}?${queryString}`, true);\n }\n\n getApplication(id) {\n return this.rest.makeRequest('get', Endpoints.OAUTH2.Application(id), true).then(app =>\n new OAuth2Application(this.client, app)\n );\n }\n\n resetApplication(id) {\n return this.rest.makeRequest('post', Endpoints.OAUTH2.Application(id).resetToken, true)\n .then(() => this.rest.makeRequest('post', Endpoints.OAUTH2.Application(id).resetSecret, true))\n .then(app => new OAuth2Application(this.client, app));\n }\n\n setNote(user, note) {\n return this.rest.makeRequest('put', Endpoints.User(user).note, true, { note }).then(() => user);\n }\n\n acceptInvite(code) {\n if (code.id) code = code.id;\n return new Promise((resolve, reject) =>\n this.rest.makeRequest('post', Endpoints.Invite(code), true).then(res => {\n const handler = guild => {\n if (guild.id === res.id) {\n resolve(guild);\n this.client.removeListener(Constants.Events.GUILD_CREATE, handler);\n }\n };\n this.client.on(Constants.Events.GUILD_CREATE, handler);\n this.client.setTimeout(() => {\n this.client.removeListener(Constants.Events.GUILD_CREATE, handler);\n reject(new Error('Accepting invite timed out'));\n }, 120e3);\n })\n );\n }\n\n patchUserSettings(data) {\n return this.rest.makeRequest('patch', Constants.Endpoints.User('@me').settings, true, data);\n }\n\n patchClientUserGuildSettings(guildID, data) {\n return this.rest.makeRequest('patch', Constants.Endpoints.User('@me').Guild(guildID).settings, true, data);\n }\n\n getIntegrations(guild) {\n return this.rest.makeRequest(\n 'get',\n Constants.Endpoints.Guild(guild.id).integrations,\n true\n );\n }\n\n createIntegration(guild, data, reason) {\n return this.rest.makeRequest(\n 'post',\n Constants.Endpoints.Guild(guild.id).integrations,\n true,\n data,\n undefined,\n reason\n );\n }\n\n syncIntegration(integration) {\n return this.rest.makeRequest(\n 'post',\n Constants.Endpoints.Guild(integration.guild.id).Integration(integration.id),\n true\n );\n }\n\n editIntegration(integration, data, reason) {\n return this.rest.makeRequest(\n 'patch',\n Constants.Endpoints.Guild(integration.guild.id).Integration(integration.id),\n true,\n data,\n undefined,\n reason\n );\n }\n\n deleteIntegration(integration, reason) {\n return this.rest.makeRequest(\n 'delete',\n Constants.Endpoints.Guild(integration.guild.id).Integration(integration.id),\n true,\n undefined,\n undefined,\n reason\n );\n }\n}\n\nmodule.exports = RESTMethods;\n\n\n//# sourceURL=webpack:///./src/client/rest/RESTMethods.js?"); /***/ }), @@ -893,7 +930,7 @@ eval("/* WEBPACK VAR INJECTION */(function(process) {const Constants = __webpack /*! ModuleConcatenation bailout: Module is not an ECMAScript module */ /***/ (function(module, exports, __webpack_require__) { -eval("/* WEBPACK VAR INJECTION */(function(Buffer) {const browser = typeof window !== 'undefined';\nconst EventEmitter = __webpack_require__(/*! events */ \"./node_modules/events/events.js\");\nconst Constants = __webpack_require__(/*! ../../util/Constants */ \"./src/util/Constants.js\");\nconst zlib = __webpack_require__(/*! zlib */ \"./node_modules/node-libs-browser/mock/empty.js\");\nconst PacketManager = __webpack_require__(/*! ./packets/WebSocketPacketManager */ \"./src/client/websocket/packets/WebSocketPacketManager.js\");\nconst erlpack = (function findErlpack() {\n try {\n const e = __webpack_require__(/*! erlpack */ 1);\n if (!e.pack) return null;\n return e;\n } catch (e) {\n return null;\n }\n}());\n\nconst WebSocket = (function findWebSocket() {\n if (browser) return window.WebSocket; // eslint-disable-line no-undef\n try {\n return __webpack_require__(/*! @discordjs/uws */ 2);\n } catch (e) {\n return __webpack_require__(/*! ws */ 3);\n }\n}());\n\n/**\n * Abstracts a WebSocket connection with decoding/encoding for the Discord gateway.\n * @private\n */\nclass WebSocketConnection extends EventEmitter {\n /**\n * @param {WebSocketManager} manager The WebSocket manager\n * @param {string} gateway The WebSocket gateway to connect to\n */\n constructor(manager, gateway) {\n super();\n /**\n * The WebSocket Manager of this connection\n * @type {WebSocketManager}\n */\n this.manager = manager;\n\n /**\n * The client this belongs to\n * @type {Client}\n */\n this.client = manager.client;\n\n /**\n * The WebSocket connection itself\n * @type {WebSocket}\n */\n this.ws = null;\n\n /**\n * The current sequence of the WebSocket\n * @type {number}\n */\n this.sequence = -1;\n\n /**\n * The current status of the client\n * @type {Status}\n */\n this.status = Constants.Status.IDLE;\n\n /**\n * The Packet Manager of the connection\n * @type {WebSocketPacketManager}\n */\n this.packetManager = new PacketManager(this);\n\n /**\n * The last time a ping was sent (a timestamp)\n * @type {number}\n */\n this.lastPingTimestamp = 0;\n\n /**\n * Contains the rate limit queue and metadata\n * @type {Object}\n */\n this.ratelimit = {\n queue: [],\n remaining: 120,\n total: 120,\n time: 60e3,\n resetTimer: null,\n };\n this.connect(gateway);\n\n /**\n * Events that are disabled (will not be processed)\n * @type {Object}\n */\n this.disabledEvents = {};\n\n /**\n * The sequence on WebSocket close\n * @type {number}\n */\n this.closeSequence = 0;\n\n /**\n * Whether or not the WebSocket is expecting to be closed\n * @type {boolean}\n */\n this.expectingClose = false;\n for (const event of this.client.options.disabledEvents) this.disabledEvents[event] = true;\n }\n\n /**\n * Causes the client to be marked as ready and emits the ready event.\n * @returns {void}\n */\n triggerReady() {\n if (this.status === Constants.Status.READY) {\n this.debug('Tried to mark self as ready, but already ready');\n return;\n }\n /**\n * Emitted when the client becomes ready to start working.\n * @event Client#ready\n */\n this.status = Constants.Status.READY;\n this.client.emit(Constants.Events.READY);\n this.packetManager.handleQueue();\n }\n\n /**\n * Checks whether the client is ready to be marked as ready.\n * @returns {void}\n */\n checkIfReady() {\n if (this.status === Constants.Status.READY || this.status === Constants.Status.NEARLY) return false;\n let unavailableGuilds = 0;\n for (const guild of this.client.guilds.values()) {\n if (!guild.available) unavailableGuilds++;\n }\n if (unavailableGuilds === 0) {\n this.status = Constants.Status.NEARLY;\n if (!this.client.options.fetchAllMembers) return this.triggerReady();\n // Fetch all members before marking self as ready\n const promises = this.client.guilds.map(g => g.fetchMembers());\n Promise.all(promises)\n .then(() => this.triggerReady())\n .catch(e => {\n this.debug(`Failed to fetch all members before ready! ${e}`);\n this.triggerReady();\n });\n }\n return true;\n }\n\n // Util\n /**\n * Emits a debug message.\n * @param {string} message Debug message\n * @returns {void}\n */\n debug(message) {\n if (message instanceof Error) message = message.stack;\n return this.manager.debug(`[connection] ${message}`);\n }\n\n /**\n * Attempts to serialise data from the WebSocket.\n * @param {string|Object} data Data to unpack\n * @returns {Object}\n */\n unpack(data) {\n if (data instanceof ArrayBuffer) data = Buffer.from(new Uint8Array(data));\n\n if (erlpack && typeof data !== 'string') return erlpack.unpack(data);\n else if (data instanceof Buffer) data = zlib.inflateSync(data).toString();\n\n return JSON.parse(data);\n }\n\n /**\n * Packs an object ready to be sent.\n * @param {Object} data Data to pack\n * @returns {string|Buffer}\n */\n pack(data) {\n return erlpack ? erlpack.pack(data) : JSON.stringify(data);\n }\n\n /**\n * Processes the current WebSocket queue.\n */\n processQueue() {\n if (this.ratelimit.remaining === 0) return;\n if (this.ratelimit.queue.length === 0) return;\n if (this.ratelimit.remaining === this.ratelimit.total) {\n this.ratelimit.resetTimer = this.client.setTimeout(() => {\n this.ratelimit.remaining = this.ratelimit.total;\n this.processQueue();\n }, this.ratelimit.time);\n }\n while (this.ratelimit.remaining > 0) {\n const item = this.ratelimit.queue.shift();\n if (!item) return;\n this._send(item);\n this.ratelimit.remaining--;\n }\n }\n\n /**\n * Sends data, bypassing the queue.\n * @param {Object} data Packet to send\n * @returns {void}\n */\n _send(data) {\n if (!this.ws || this.ws.readyState !== WebSocket.OPEN) {\n this.debug(`Tried to send packet ${JSON.stringify(data)} but no WebSocket is available!`);\n return;\n }\n this.ws.send(this.pack(data));\n }\n\n /**\n * Adds data to the queue to be sent.\n * @param {Object} data Packet to send\n * @returns {void}\n */\n send(data) {\n if (!this.ws || this.ws.readyState !== WebSocket.OPEN) {\n this.debug(`Tried to send packet ${JSON.stringify(data)} but no WebSocket is available!`);\n return;\n }\n this.ratelimit.queue.push(data);\n this.processQueue();\n }\n\n /**\n * Creates a connection to a gateway.\n * @param {string} gateway The gateway to connect to\n * @param {number} [after=0] How long to wait before connecting\n * @param {boolean} [force=false] Whether or not to force a new connection even if one already exists\n * @returns {boolean}\n */\n connect(gateway = this.gateway, after = 0, force = false) {\n if (after) return this.client.setTimeout(() => this.connect(gateway, 0, force), after); // eslint-disable-line\n if (this.ws && !force) {\n this.debug('WebSocket connection already exists');\n return false;\n } else if (typeof gateway !== 'string') {\n this.debug(`Tried to connect to an invalid gateway: ${gateway}`);\n return false;\n }\n this.expectingClose = false;\n this.gateway = gateway;\n this.debug(`Connecting to ${gateway}`);\n const ws = this.ws = new WebSocket(gateway);\n if (browser) ws.binaryType = 'arraybuffer';\n ws.onmessage = this.onMessage.bind(this);\n ws.onopen = this.onOpen.bind(this);\n ws.onerror = this.onError.bind(this);\n ws.onclose = this.onClose.bind(this);\n this.status = Constants.Status.CONNECTING;\n return true;\n }\n\n /**\n * Destroys the connection.\n * @returns {boolean}\n */\n destroy() {\n const ws = this.ws;\n if (!ws) {\n this.debug('Attempted to destroy WebSocket but no connection exists!');\n return false;\n }\n this.heartbeat(-1);\n this.expectingClose = true;\n ws.close(1000);\n this.packetManager.handleQueue();\n this.ws = null;\n this.status = Constants.Status.DISCONNECTED;\n this.ratelimit.remaining = this.ratelimit.total;\n return true;\n }\n\n /**\n * Called whenever a message is received.\n * @param {Event} event Event received\n * @returns {boolean}\n */\n onMessage(event) {\n let data;\n try {\n data = this.unpack(event.data);\n } catch (err) {\n this.emit('debug', err);\n }\n return this.onPacket(data);\n }\n\n /**\n * Sets the current sequence of the connection.\n * @param {number} s New sequence\n */\n setSequence(s) {\n this.sequence = s > this.sequence ? s : this.sequence;\n }\n\n /**\n * Called whenever a packet is received.\n * @param {Object} packet Received packet\n * @returns {boolean}\n */\n onPacket(packet) {\n if (!packet) {\n this.debug('Received null packet');\n return false;\n }\n this.client.emit('raw', packet);\n switch (packet.op) {\n case Constants.OPCodes.HELLO:\n return this.heartbeat(packet.d.heartbeat_interval);\n case Constants.OPCodes.RECONNECT:\n return this.reconnect();\n case Constants.OPCodes.INVALID_SESSION:\n if (!packet.d) this.sessionID = null;\n this.sequence = -1;\n this.debug('Session invalidated -- will identify with a new session');\n return this.identify(packet.d ? 2500 : 0);\n case Constants.OPCodes.HEARTBEAT_ACK:\n return this.ackHeartbeat();\n case Constants.OPCodes.HEARTBEAT:\n return this.heartbeat();\n default:\n return this.packetManager.handle(packet);\n }\n }\n\n /**\n * Called whenever a connection is opened to the gateway.\n * @param {Event} event Received open event\n */\n onOpen(event) {\n if (event && event.target && event.target.url) this.gateway = event.target.url;\n this.debug(`Connected to gateway ${this.gateway}`);\n this.identify();\n }\n\n /**\n * Causes a reconnection to the gateway.\n */\n reconnect() {\n this.debug('Attemping to reconnect in 5500ms...');\n /**\n * Emitted whenever the client tries to reconnect to the WebSocket.\n * @event Client#reconnecting\n */\n this.client.emit(Constants.Events.RECONNECTING);\n this.connect(this.gateway, 5500, true);\n }\n\n /**\n * Called whenever an error occurs with the WebSocket.\n * @param {Error} error The error that occurred\n */\n onError(error) {\n if (error && error.message === 'uWs client connection error') {\n this.reconnect();\n return;\n }\n /**\n * Emitted whenever the client's WebSocket encounters a connection error.\n * @event Client#error\n * @param {Error} error The encountered error\n */\n this.client.emit(Constants.Events.ERROR, error);\n }\n\n /**\n * @external CloseEvent\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent}\n */\n\n /**\n * Called whenever a connection to the gateway is closed.\n * @param {CloseEvent} event Close event that was received\n */\n onClose(event) {\n this.debug(`${this.expectingClose ? 'Client' : 'Server'} closed the WebSocket connection: ${event.code}`);\n this.closeSequence = this.sequence;\n // Reset the state before trying to fix anything\n this.emit('close', event);\n this.heartbeat(-1);\n // Should we reconnect?\n if (event.code === 1000 ? this.expectingClose : Constants.WSCodes[event.code]) {\n this.expectingClose = false;\n /**\n * Emitted when the client's WebSocket disconnects and will no longer attempt to reconnect.\n * @event Client#disconnect\n * @param {CloseEvent} event The WebSocket close event\n */\n this.client.emit(Constants.Events.DISCONNECT, event);\n this.debug(Constants.WSCodes[event.code]);\n this.destroy();\n return;\n }\n this.expectingClose = false;\n this.reconnect();\n }\n\n // Heartbeat\n /**\n * Acknowledges a heartbeat.\n */\n ackHeartbeat() {\n this.debug(`Heartbeat acknowledged, latency of ${Date.now() - this.lastPingTimestamp}ms`);\n this.client._pong(this.lastPingTimestamp);\n }\n\n /**\n * Sends a heartbeat or sets an interval for sending heartbeats.\n * @param {number} [time] If -1, clears the interval, any other number sets an interval\n * If no value is given, a heartbeat will be sent instantly\n */\n heartbeat(time) {\n if (!isNaN(time)) {\n if (time === -1) {\n this.debug('Clearing heartbeat interval');\n this.client.clearInterval(this.heartbeatInterval);\n this.heartbeatInterval = null;\n } else {\n this.debug(`Setting a heartbeat interval for ${time}ms`);\n this.heartbeatInterval = this.client.setInterval(() => this.heartbeat(), time);\n }\n return;\n }\n this.debug('Sending a heartbeat');\n this.lastPingTimestamp = Date.now();\n this.send({\n op: Constants.OPCodes.HEARTBEAT,\n d: this.sequence,\n });\n }\n\n // Identification\n /**\n * Identifies the client on a connection.\n * @param {number} [after] How long to wait before identifying\n * @returns {void}\n */\n identify(after) {\n if (after) return this.client.setTimeout(this.identify.bind(this), after);\n return this.sessionID ? this.identifyResume() : this.identifyNew();\n }\n\n /**\n * Identifies as a new connection on the gateway.\n * @returns {void}\n */\n identifyNew() {\n if (!this.client.token) {\n this.debug('No token available to identify a new session with');\n return;\n }\n // Clone the generic payload and assign the token\n const d = Object.assign({ token: this.client.token }, this.client.options.ws);\n\n // Sharding stuff\n const { shardId, shardCount } = this.client.options;\n if (shardCount > 0) d.shard = [Number(shardId), Number(shardCount)];\n\n // Send the payload\n this.debug('Identifying as a new session');\n this.send({ op: Constants.OPCodes.IDENTIFY, d });\n }\n\n /**\n * Resumes a session on the gateway.\n * @returns {void}\n */\n identifyResume() {\n if (!this.sessionID) {\n this.debug('Warning: wanted to resume but session ID not available; identifying as a new session instead');\n return this.identifyNew();\n }\n this.debug(`Attempting to resume session ${this.sessionID}`);\n\n const d = {\n token: this.client.token,\n session_id: this.sessionID,\n seq: this.sequence,\n };\n\n return this.send({\n op: Constants.OPCodes.RESUME,\n d,\n });\n }\n}\n\n/**\n * Encoding the WebSocket connections will use.\n * @type {string}\n */\nWebSocketConnection.ENCODING = erlpack ? 'etf' : 'json';\nWebSocketConnection.WebSocket = WebSocket;\n\nmodule.exports = WebSocketConnection;\n\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../node_modules/buffer/index.js */ \"./node_modules/buffer/index.js\").Buffer))\n\n//# sourceURL=webpack:///./src/client/websocket/WebSocketConnection.js?"); +eval("/* WEBPACK VAR INJECTION */(function(Buffer) {const browser = typeof window !== 'undefined';\nconst EventEmitter = __webpack_require__(/*! events */ \"./node_modules/events/events.js\");\nconst Constants = __webpack_require__(/*! ../../util/Constants */ \"./src/util/Constants.js\");\nconst zlib = __webpack_require__(/*! zlib */ \"./node_modules/node-libs-browser/mock/empty.js\");\nconst PacketManager = __webpack_require__(/*! ./packets/WebSocketPacketManager */ \"./src/client/websocket/packets/WebSocketPacketManager.js\");\nconst erlpack = (function findErlpack() {\n try {\n const e = __webpack_require__(/*! erlpack */ 1);\n if (!e.pack) return null;\n return e;\n } catch (e) {\n return null;\n }\n}());\n\nconst WebSocket = (function findWebSocket() {\n if (browser) return window.WebSocket; // eslint-disable-line no-undef\n try {\n const uws = __webpack_require__(/*! @discordjs/uws */ 2);\n ((any, ...more) => console.warn(any, more))('uws support is being removed in the next version of discord.js',\n 'DeprecationWarning', findWebSocket);\n return uws;\n } catch (e) {\n return __webpack_require__(/*! ws */ 3);\n }\n}());\n\n/**\n * Abstracts a WebSocket connection with decoding/encoding for the Discord gateway.\n * @private\n */\nclass WebSocketConnection extends EventEmitter {\n /**\n * @param {WebSocketManager} manager The WebSocket manager\n * @param {string} gateway The WebSocket gateway to connect to\n */\n constructor(manager, gateway) {\n super();\n /**\n * The WebSocket Manager of this connection\n * @type {WebSocketManager}\n */\n this.manager = manager;\n\n /**\n * The client this belongs to\n * @type {Client}\n */\n this.client = manager.client;\n\n /**\n * The WebSocket connection itself\n * @type {WebSocket}\n */\n this.ws = null;\n\n /**\n * The current sequence of the WebSocket\n * @type {number}\n */\n this.sequence = -1;\n\n /**\n * The current status of the client\n * @type {Status}\n */\n this.status = Constants.Status.IDLE;\n\n /**\n * The Packet Manager of the connection\n * @type {WebSocketPacketManager}\n */\n this.packetManager = new PacketManager(this);\n\n /**\n * The last time a ping was sent (a timestamp)\n * @type {number}\n */\n this.lastPingTimestamp = 0;\n\n /**\n * Contains the rate limit queue and metadata\n * @type {Object}\n */\n this.ratelimit = {\n queue: [],\n remaining: 120,\n total: 120,\n time: 60e3,\n resetTimer: null,\n };\n this.connect(gateway);\n\n /**\n * Events that are disabled (will not be processed)\n * @type {Object}\n */\n this.disabledEvents = {};\n\n /**\n * The sequence on WebSocket close\n * @type {number}\n */\n this.closeSequence = 0;\n\n /**\n * Whether or not the WebSocket is expecting to be closed\n * @type {boolean}\n */\n this.expectingClose = false;\n for (const event of this.client.options.disabledEvents) this.disabledEvents[event] = true;\n }\n\n /**\n * Causes the client to be marked as ready and emits the ready event.\n * @returns {void}\n */\n triggerReady() {\n if (this.status === Constants.Status.READY) {\n this.debug('Tried to mark self as ready, but already ready');\n return;\n }\n /**\n * Emitted when the client becomes ready to start working.\n * @event Client#ready\n */\n this.status = Constants.Status.READY;\n this.client.emit(Constants.Events.READY);\n this.packetManager.handleQueue();\n }\n\n /**\n * Checks whether the client is ready to be marked as ready.\n * @returns {void}\n */\n checkIfReady() {\n if (this.status === Constants.Status.READY || this.status === Constants.Status.NEARLY) return false;\n let unavailableGuilds = 0;\n for (const guild of this.client.guilds.values()) {\n if (!guild.available) unavailableGuilds++;\n }\n if (unavailableGuilds === 0) {\n this.status = Constants.Status.NEARLY;\n if (!this.client.options.fetchAllMembers) return this.triggerReady();\n // Fetch all members before marking self as ready\n const promises = this.client.guilds.map(g => g.fetchMembers());\n Promise.all(promises)\n .then(() => this.triggerReady())\n .catch(e => {\n this.debug(`Failed to fetch all members before ready! ${e}`);\n this.triggerReady();\n });\n }\n return true;\n }\n\n // Util\n /**\n * Emits a debug message.\n * @param {string} message Debug message\n * @returns {void}\n */\n debug(message) {\n if (message instanceof Error) message = message.stack;\n return this.manager.debug(`[connection] ${message}`);\n }\n\n /**\n * Attempts to serialise data from the WebSocket.\n * @param {string|Object} data Data to unpack\n * @returns {Object}\n */\n unpack(data) {\n if (data instanceof ArrayBuffer) data = Buffer.from(new Uint8Array(data));\n\n if (erlpack && typeof data !== 'string') return erlpack.unpack(data);\n else if (data instanceof Buffer) data = zlib.inflateSync(data).toString();\n\n return JSON.parse(data);\n }\n\n /**\n * Packs an object ready to be sent.\n * @param {Object} data Data to pack\n * @returns {string|Buffer}\n */\n pack(data) {\n return erlpack ? erlpack.pack(data) : JSON.stringify(data);\n }\n\n /**\n * Processes the current WebSocket queue.\n */\n processQueue() {\n if (this.ratelimit.remaining === 0) return;\n if (this.ratelimit.queue.length === 0) return;\n if (this.ratelimit.remaining === this.ratelimit.total) {\n this.ratelimit.resetTimer = this.client.setTimeout(() => {\n this.ratelimit.remaining = this.ratelimit.total;\n this.processQueue();\n }, this.ratelimit.time);\n }\n while (this.ratelimit.remaining > 0) {\n const item = this.ratelimit.queue.shift();\n if (!item) return;\n this._send(item);\n this.ratelimit.remaining--;\n }\n }\n\n /**\n * Sends data, bypassing the queue.\n * @param {Object} data Packet to send\n * @returns {void}\n */\n _send(data) {\n if (!this.ws || this.ws.readyState !== WebSocket.OPEN) {\n this.debug(`Tried to send packet ${JSON.stringify(data)} but no WebSocket is available!`);\n return;\n }\n this.ws.send(this.pack(data));\n }\n\n /**\n * Adds data to the queue to be sent.\n * @param {Object} data Packet to send\n * @returns {void}\n */\n send(data) {\n if (!this.ws || this.ws.readyState !== WebSocket.OPEN) {\n this.debug(`Tried to send packet ${JSON.stringify(data)} but no WebSocket is available!`);\n return;\n }\n this.ratelimit.queue.push(data);\n this.processQueue();\n }\n\n /**\n * Creates a connection to a gateway.\n * @param {string} gateway The gateway to connect to\n * @param {number} [after=0] How long to wait before connecting\n * @param {boolean} [force=false] Whether or not to force a new connection even if one already exists\n * @returns {boolean}\n */\n connect(gateway = this.gateway, after = 0, force = false) {\n if (after) return this.client.setTimeout(() => this.connect(gateway, 0, force), after); // eslint-disable-line\n if (this.ws && !force) {\n this.debug('WebSocket connection already exists');\n return false;\n } else if (typeof gateway !== 'string') {\n this.debug(`Tried to connect to an invalid gateway: ${gateway}`);\n return false;\n }\n this.expectingClose = false;\n this.gateway = gateway;\n this.debug(`Connecting to ${gateway}`);\n const ws = this.ws = new WebSocket(gateway);\n if (browser) ws.binaryType = 'arraybuffer';\n ws.onmessage = this.onMessage.bind(this);\n ws.onopen = this.onOpen.bind(this);\n ws.onerror = this.onError.bind(this);\n ws.onclose = this.onClose.bind(this);\n this.status = Constants.Status.CONNECTING;\n return true;\n }\n\n /**\n * Destroys the connection.\n * @returns {boolean}\n */\n destroy() {\n const ws = this.ws;\n if (!ws) {\n this.debug('Attempted to destroy WebSocket but no connection exists!');\n return false;\n }\n this.heartbeat(-1);\n this.expectingClose = true;\n ws.close(1000);\n this.packetManager.handleQueue();\n this.ws = null;\n this.status = Constants.Status.DISCONNECTED;\n this.ratelimit.remaining = this.ratelimit.total;\n return true;\n }\n\n /**\n * Called whenever a message is received.\n * @param {Event} event Event received\n * @returns {boolean}\n */\n onMessage(event) {\n let data;\n try {\n data = this.unpack(event.data);\n } catch (err) {\n this.emit('debug', err);\n }\n return this.onPacket(data);\n }\n\n /**\n * Sets the current sequence of the connection.\n * @param {number} s New sequence\n */\n setSequence(s) {\n this.sequence = s > this.sequence ? s : this.sequence;\n }\n\n /**\n * Called whenever a packet is received.\n * @param {Object} packet Received packet\n * @returns {boolean}\n */\n onPacket(packet) {\n if (!packet) {\n this.debug('Received null packet');\n return false;\n }\n this.client.emit('raw', packet);\n switch (packet.op) {\n case Constants.OPCodes.HELLO:\n return this.heartbeat(packet.d.heartbeat_interval);\n case Constants.OPCodes.RECONNECT:\n return this.reconnect();\n case Constants.OPCodes.INVALID_SESSION:\n if (!packet.d) this.sessionID = null;\n this.sequence = -1;\n this.debug('Session invalidated -- will identify with a new session');\n return this.identify(packet.d ? 2500 : 0);\n case Constants.OPCodes.HEARTBEAT_ACK:\n return this.ackHeartbeat();\n case Constants.OPCodes.HEARTBEAT:\n return this.heartbeat();\n default:\n return this.packetManager.handle(packet);\n }\n }\n\n /**\n * Called whenever a connection is opened to the gateway.\n * @param {Event} event Received open event\n */\n onOpen(event) {\n if (event && event.target && event.target.url) this.gateway = event.target.url;\n this.debug(`Connected to gateway ${this.gateway}`);\n this.identify();\n }\n\n /**\n * Causes a reconnection to the gateway.\n */\n reconnect() {\n this.debug('Attemping to reconnect in 5500ms...');\n /**\n * Emitted whenever the client tries to reconnect to the WebSocket.\n * @event Client#reconnecting\n */\n this.client.emit(Constants.Events.RECONNECTING);\n this.connect(this.gateway, 5500, true);\n }\n\n /**\n * Called whenever an error occurs with the WebSocket.\n * @param {Error} error The error that occurred\n */\n onError(error) {\n if (error && error.message === 'uWs client connection error') {\n this.reconnect();\n return;\n }\n /**\n * Emitted whenever the client's WebSocket encounters a connection error.\n * @event Client#error\n * @param {Error} error The encountered error\n */\n this.client.emit(Constants.Events.ERROR, error);\n }\n\n /**\n * @external CloseEvent\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent}\n */\n\n /**\n * Called whenever a connection to the gateway is closed.\n * @param {CloseEvent} event Close event that was received\n */\n onClose(event) {\n this.debug(`${this.expectingClose ? 'Client' : 'Server'} closed the WebSocket connection: ${event.code}`);\n this.closeSequence = this.sequence;\n // Reset the state before trying to fix anything\n this.emit('close', event);\n this.heartbeat(-1);\n // Should we reconnect?\n if (event.code === 1000 ? this.expectingClose : Constants.WSCodes[event.code]) {\n this.expectingClose = false;\n /**\n * Emitted when the client's WebSocket disconnects and will no longer attempt to reconnect.\n * @event Client#disconnect\n * @param {CloseEvent} event The WebSocket close event\n */\n this.client.emit(Constants.Events.DISCONNECT, event);\n this.debug(Constants.WSCodes[event.code]);\n this.destroy();\n return;\n }\n this.expectingClose = false;\n this.reconnect();\n }\n\n // Heartbeat\n /**\n * Acknowledges a heartbeat.\n */\n ackHeartbeat() {\n this.debug(`Heartbeat acknowledged, latency of ${Date.now() - this.lastPingTimestamp}ms`);\n this.client._pong(this.lastPingTimestamp);\n }\n\n /**\n * Sends a heartbeat or sets an interval for sending heartbeats.\n * @param {number} [time] If -1, clears the interval, any other number sets an interval\n * If no value is given, a heartbeat will be sent instantly\n */\n heartbeat(time) {\n if (!isNaN(time)) {\n if (time === -1) {\n this.debug('Clearing heartbeat interval');\n this.client.clearInterval(this.heartbeatInterval);\n this.heartbeatInterval = null;\n } else {\n this.debug(`Setting a heartbeat interval for ${time}ms`);\n this.heartbeatInterval = this.client.setInterval(() => this.heartbeat(), time);\n }\n return;\n }\n this.debug('Sending a heartbeat');\n this.lastPingTimestamp = Date.now();\n this.send({\n op: Constants.OPCodes.HEARTBEAT,\n d: this.sequence,\n });\n }\n\n // Identification\n /**\n * Identifies the client on a connection.\n * @param {number} [after] How long to wait before identifying\n * @returns {void}\n */\n identify(after) {\n if (after) return this.client.setTimeout(this.identify.bind(this), after);\n return this.sessionID ? this.identifyResume() : this.identifyNew();\n }\n\n /**\n * Identifies as a new connection on the gateway.\n * @returns {void}\n */\n identifyNew() {\n if (!this.client.token) {\n this.debug('No token available to identify a new session with');\n return;\n }\n // Clone the generic payload and assign the token\n const d = Object.assign({ token: this.client.token }, this.client.options.ws);\n\n // Sharding stuff\n const { shardId, shardCount } = this.client.options;\n if (shardCount > 0) d.shard = [Number(shardId), Number(shardCount)];\n\n // Send the payload\n this.debug('Identifying as a new session');\n this.send({ op: Constants.OPCodes.IDENTIFY, d });\n }\n\n /**\n * Resumes a session on the gateway.\n * @returns {void}\n */\n identifyResume() {\n if (!this.sessionID) {\n this.debug('Warning: wanted to resume but session ID not available; identifying as a new session instead');\n return this.identifyNew();\n }\n this.debug(`Attempting to resume session ${this.sessionID}`);\n\n const d = {\n token: this.client.token,\n session_id: this.sessionID,\n seq: this.sequence,\n };\n\n return this.send({\n op: Constants.OPCodes.RESUME,\n d,\n });\n }\n}\n\n/**\n * Encoding the WebSocket connections will use.\n * @type {string}\n */\nWebSocketConnection.ENCODING = erlpack ? 'etf' : 'json';\nWebSocketConnection.WebSocket = WebSocket;\n\nmodule.exports = WebSocketConnection;\n\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../node_modules/buffer/index.js */ \"./node_modules/buffer/index.js\").Buffer))\n\n//# sourceURL=webpack:///./src/client/websocket/WebSocketConnection.js?"); /***/ }), @@ -917,7 +954,7 @@ eval("const EventEmitter = __webpack_require__(/*! events */ \"./node_modules/ev /*! ModuleConcatenation bailout: Module is not an ECMAScript module */ /***/ (function(module, exports, __webpack_require__) { -eval("const Constants = __webpack_require__(/*! ../../../util/Constants */ \"./src/util/Constants.js\");\n\nconst BeforeReadyWhitelist = [\n Constants.WSEvents.READY,\n Constants.WSEvents.RESUMED,\n Constants.WSEvents.GUILD_CREATE,\n Constants.WSEvents.GUILD_DELETE,\n Constants.WSEvents.GUILD_MEMBERS_CHUNK,\n Constants.WSEvents.GUILD_MEMBER_ADD,\n Constants.WSEvents.GUILD_MEMBER_REMOVE,\n];\n\nclass WebSocketPacketManager {\n constructor(connection) {\n this.ws = connection;\n this.handlers = {};\n this.queue = [];\n\n this.register(Constants.WSEvents.READY, __webpack_require__(/*! ./handlers/Ready */ \"./src/client/websocket/packets/handlers/Ready.js\"));\n this.register(Constants.WSEvents.RESUMED, __webpack_require__(/*! ./handlers/Resumed */ \"./src/client/websocket/packets/handlers/Resumed.js\"));\n this.register(Constants.WSEvents.GUILD_CREATE, __webpack_require__(/*! ./handlers/GuildCreate */ \"./src/client/websocket/packets/handlers/GuildCreate.js\"));\n this.register(Constants.WSEvents.GUILD_DELETE, __webpack_require__(/*! ./handlers/GuildDelete */ \"./src/client/websocket/packets/handlers/GuildDelete.js\"));\n this.register(Constants.WSEvents.GUILD_UPDATE, __webpack_require__(/*! ./handlers/GuildUpdate */ \"./src/client/websocket/packets/handlers/GuildUpdate.js\"));\n this.register(Constants.WSEvents.GUILD_BAN_ADD, __webpack_require__(/*! ./handlers/GuildBanAdd */ \"./src/client/websocket/packets/handlers/GuildBanAdd.js\"));\n this.register(Constants.WSEvents.GUILD_BAN_REMOVE, __webpack_require__(/*! ./handlers/GuildBanRemove */ \"./src/client/websocket/packets/handlers/GuildBanRemove.js\"));\n this.register(Constants.WSEvents.GUILD_MEMBER_ADD, __webpack_require__(/*! ./handlers/GuildMemberAdd */ \"./src/client/websocket/packets/handlers/GuildMemberAdd.js\"));\n this.register(Constants.WSEvents.GUILD_MEMBER_REMOVE, __webpack_require__(/*! ./handlers/GuildMemberRemove */ \"./src/client/websocket/packets/handlers/GuildMemberRemove.js\"));\n this.register(Constants.WSEvents.GUILD_MEMBER_UPDATE, __webpack_require__(/*! ./handlers/GuildMemberUpdate */ \"./src/client/websocket/packets/handlers/GuildMemberUpdate.js\"));\n this.register(Constants.WSEvents.GUILD_ROLE_CREATE, __webpack_require__(/*! ./handlers/GuildRoleCreate */ \"./src/client/websocket/packets/handlers/GuildRoleCreate.js\"));\n this.register(Constants.WSEvents.GUILD_ROLE_DELETE, __webpack_require__(/*! ./handlers/GuildRoleDelete */ \"./src/client/websocket/packets/handlers/GuildRoleDelete.js\"));\n this.register(Constants.WSEvents.GUILD_ROLE_UPDATE, __webpack_require__(/*! ./handlers/GuildRoleUpdate */ \"./src/client/websocket/packets/handlers/GuildRoleUpdate.js\"));\n this.register(Constants.WSEvents.GUILD_EMOJIS_UPDATE, __webpack_require__(/*! ./handlers/GuildEmojisUpdate */ \"./src/client/websocket/packets/handlers/GuildEmojisUpdate.js\"));\n this.register(Constants.WSEvents.GUILD_MEMBERS_CHUNK, __webpack_require__(/*! ./handlers/GuildMembersChunk */ \"./src/client/websocket/packets/handlers/GuildMembersChunk.js\"));\n this.register(Constants.WSEvents.GUILD_INTEGRATIONS_UPDATE, __webpack_require__(/*! ./handlers/GuildIntegrationsUpdate */ \"./src/client/websocket/packets/handlers/GuildIntegrationsUpdate.js\"));\n this.register(Constants.WSEvents.CHANNEL_CREATE, __webpack_require__(/*! ./handlers/ChannelCreate */ \"./src/client/websocket/packets/handlers/ChannelCreate.js\"));\n this.register(Constants.WSEvents.CHANNEL_DELETE, __webpack_require__(/*! ./handlers/ChannelDelete */ \"./src/client/websocket/packets/handlers/ChannelDelete.js\"));\n this.register(Constants.WSEvents.CHANNEL_UPDATE, __webpack_require__(/*! ./handlers/ChannelUpdate */ \"./src/client/websocket/packets/handlers/ChannelUpdate.js\"));\n this.register(Constants.WSEvents.CHANNEL_PINS_UPDATE, __webpack_require__(/*! ./handlers/ChannelPinsUpdate */ \"./src/client/websocket/packets/handlers/ChannelPinsUpdate.js\"));\n this.register(Constants.WSEvents.PRESENCE_UPDATE, __webpack_require__(/*! ./handlers/PresenceUpdate */ \"./src/client/websocket/packets/handlers/PresenceUpdate.js\"));\n this.register(Constants.WSEvents.USER_UPDATE, __webpack_require__(/*! ./handlers/UserUpdate */ \"./src/client/websocket/packets/handlers/UserUpdate.js\"));\n this.register(Constants.WSEvents.USER_NOTE_UPDATE, __webpack_require__(/*! ./handlers/UserNoteUpdate */ \"./src/client/websocket/packets/handlers/UserNoteUpdate.js\"));\n this.register(Constants.WSEvents.USER_SETTINGS_UPDATE, __webpack_require__(/*! ./handlers/UserSettingsUpdate */ \"./src/client/websocket/packets/handlers/UserSettingsUpdate.js\"));\n this.register(Constants.WSEvents.USER_GUILD_SETTINGS_UPDATE, __webpack_require__(/*! ./handlers/UserGuildSettingsUpdate */ \"./src/client/websocket/packets/handlers/UserGuildSettingsUpdate.js\"));\n this.register(Constants.WSEvents.VOICE_STATE_UPDATE, __webpack_require__(/*! ./handlers/VoiceStateUpdate */ \"./src/client/websocket/packets/handlers/VoiceStateUpdate.js\"));\n this.register(Constants.WSEvents.TYPING_START, __webpack_require__(/*! ./handlers/TypingStart */ \"./src/client/websocket/packets/handlers/TypingStart.js\"));\n this.register(Constants.WSEvents.MESSAGE_CREATE, __webpack_require__(/*! ./handlers/MessageCreate */ \"./src/client/websocket/packets/handlers/MessageCreate.js\"));\n this.register(Constants.WSEvents.MESSAGE_DELETE, __webpack_require__(/*! ./handlers/MessageDelete */ \"./src/client/websocket/packets/handlers/MessageDelete.js\"));\n this.register(Constants.WSEvents.MESSAGE_UPDATE, __webpack_require__(/*! ./handlers/MessageUpdate */ \"./src/client/websocket/packets/handlers/MessageUpdate.js\"));\n this.register(Constants.WSEvents.MESSAGE_DELETE_BULK, __webpack_require__(/*! ./handlers/MessageDeleteBulk */ \"./src/client/websocket/packets/handlers/MessageDeleteBulk.js\"));\n this.register(Constants.WSEvents.VOICE_SERVER_UPDATE, __webpack_require__(/*! ./handlers/VoiceServerUpdate */ \"./src/client/websocket/packets/handlers/VoiceServerUpdate.js\"));\n this.register(Constants.WSEvents.GUILD_SYNC, __webpack_require__(/*! ./handlers/GuildSync */ \"./src/client/websocket/packets/handlers/GuildSync.js\"));\n this.register(Constants.WSEvents.RELATIONSHIP_ADD, __webpack_require__(/*! ./handlers/RelationshipAdd */ \"./src/client/websocket/packets/handlers/RelationshipAdd.js\"));\n this.register(Constants.WSEvents.RELATIONSHIP_REMOVE, __webpack_require__(/*! ./handlers/RelationshipRemove */ \"./src/client/websocket/packets/handlers/RelationshipRemove.js\"));\n this.register(Constants.WSEvents.MESSAGE_REACTION_ADD, __webpack_require__(/*! ./handlers/MessageReactionAdd */ \"./src/client/websocket/packets/handlers/MessageReactionAdd.js\"));\n this.register(Constants.WSEvents.MESSAGE_REACTION_REMOVE, __webpack_require__(/*! ./handlers/MessageReactionRemove */ \"./src/client/websocket/packets/handlers/MessageReactionRemove.js\"));\n this.register(Constants.WSEvents.MESSAGE_REACTION_REMOVE_ALL, __webpack_require__(/*! ./handlers/MessageReactionRemoveAll */ \"./src/client/websocket/packets/handlers/MessageReactionRemoveAll.js\"));\n this.register(Constants.WSEvents.WEBHOOKS_UPDATE, __webpack_require__(/*! ./handlers/WebhooksUpdate */ \"./src/client/websocket/packets/handlers/WebhooksUpdate.js\"));\n }\n\n get client() {\n return this.ws.client;\n }\n\n register(event, Handler) {\n this.handlers[event] = new Handler(this);\n }\n\n handleQueue() {\n this.queue.forEach((element, index) => {\n this.handle(this.queue[index], true);\n this.queue.splice(index, 1);\n });\n }\n\n handle(packet, queue = false) {\n if (packet.op === Constants.OPCodes.HEARTBEAT_ACK) {\n this.ws.client._pong(this.ws.client._pingTimestamp);\n this.ws.lastHeartbeatAck = true;\n this.ws.client.emit('debug', 'Heartbeat acknowledged');\n } else if (packet.op === Constants.OPCodes.HEARTBEAT) {\n this.client.ws.send({\n op: Constants.OPCodes.HEARTBEAT,\n d: this.client.ws.sequence,\n });\n this.ws.client.emit('debug', 'Received gateway heartbeat');\n }\n\n if (this.ws.status === Constants.Status.RECONNECTING) {\n this.ws.reconnecting = false;\n this.ws.checkIfReady();\n }\n\n this.ws.setSequence(packet.s);\n\n if (this.ws.disabledEvents[packet.t] !== undefined) return false;\n\n if (this.ws.status !== Constants.Status.READY) {\n if (BeforeReadyWhitelist.indexOf(packet.t) === -1) {\n this.queue.push(packet);\n return false;\n }\n }\n\n if (!queue && this.queue.length > 0) this.handleQueue();\n if (this.handlers[packet.t]) return this.handlers[packet.t].handle(packet);\n return false;\n }\n}\n\nmodule.exports = WebSocketPacketManager;\n\n\n//# sourceURL=webpack:///./src/client/websocket/packets/WebSocketPacketManager.js?"); +eval("const Constants = __webpack_require__(/*! ../../../util/Constants */ \"./src/util/Constants.js\");\n\nconst BeforeReadyWhitelist = [\n Constants.WSEvents.READY,\n Constants.WSEvents.RESUMED,\n Constants.WSEvents.GUILD_CREATE,\n Constants.WSEvents.GUILD_DELETE,\n Constants.WSEvents.GUILD_MEMBERS_CHUNK,\n Constants.WSEvents.GUILD_MEMBER_ADD,\n Constants.WSEvents.GUILD_MEMBER_REMOVE,\n];\n\nclass WebSocketPacketManager {\n constructor(connection) {\n this.ws = connection;\n this.handlers = {};\n this.queue = [];\n\n this.register(Constants.WSEvents.READY, __webpack_require__(/*! ./handlers/Ready */ \"./src/client/websocket/packets/handlers/Ready.js\"));\n this.register(Constants.WSEvents.RESUMED, __webpack_require__(/*! ./handlers/Resumed */ \"./src/client/websocket/packets/handlers/Resumed.js\"));\n this.register(Constants.WSEvents.GUILD_CREATE, __webpack_require__(/*! ./handlers/GuildCreate */ \"./src/client/websocket/packets/handlers/GuildCreate.js\"));\n this.register(Constants.WSEvents.GUILD_DELETE, __webpack_require__(/*! ./handlers/GuildDelete */ \"./src/client/websocket/packets/handlers/GuildDelete.js\"));\n this.register(Constants.WSEvents.GUILD_UPDATE, __webpack_require__(/*! ./handlers/GuildUpdate */ \"./src/client/websocket/packets/handlers/GuildUpdate.js\"));\n this.register(Constants.WSEvents.GUILD_BAN_ADD, __webpack_require__(/*! ./handlers/GuildBanAdd */ \"./src/client/websocket/packets/handlers/GuildBanAdd.js\"));\n this.register(Constants.WSEvents.GUILD_BAN_REMOVE, __webpack_require__(/*! ./handlers/GuildBanRemove */ \"./src/client/websocket/packets/handlers/GuildBanRemove.js\"));\n this.register(Constants.WSEvents.GUILD_MEMBER_ADD, __webpack_require__(/*! ./handlers/GuildMemberAdd */ \"./src/client/websocket/packets/handlers/GuildMemberAdd.js\"));\n this.register(Constants.WSEvents.GUILD_MEMBER_REMOVE, __webpack_require__(/*! ./handlers/GuildMemberRemove */ \"./src/client/websocket/packets/handlers/GuildMemberRemove.js\"));\n this.register(Constants.WSEvents.GUILD_MEMBER_UPDATE, __webpack_require__(/*! ./handlers/GuildMemberUpdate */ \"./src/client/websocket/packets/handlers/GuildMemberUpdate.js\"));\n this.register(Constants.WSEvents.GUILD_ROLE_CREATE, __webpack_require__(/*! ./handlers/GuildRoleCreate */ \"./src/client/websocket/packets/handlers/GuildRoleCreate.js\"));\n this.register(Constants.WSEvents.GUILD_ROLE_DELETE, __webpack_require__(/*! ./handlers/GuildRoleDelete */ \"./src/client/websocket/packets/handlers/GuildRoleDelete.js\"));\n this.register(Constants.WSEvents.GUILD_ROLE_UPDATE, __webpack_require__(/*! ./handlers/GuildRoleUpdate */ \"./src/client/websocket/packets/handlers/GuildRoleUpdate.js\"));\n this.register(Constants.WSEvents.GUILD_EMOJIS_UPDATE, __webpack_require__(/*! ./handlers/GuildEmojisUpdate */ \"./src/client/websocket/packets/handlers/GuildEmojisUpdate.js\"));\n this.register(Constants.WSEvents.GUILD_MEMBERS_CHUNK, __webpack_require__(/*! ./handlers/GuildMembersChunk */ \"./src/client/websocket/packets/handlers/GuildMembersChunk.js\"));\n this.register(Constants.WSEvents.GUILD_INTEGRATIONS_UPDATE, __webpack_require__(/*! ./handlers/GuildIntegrationsUpdate */ \"./src/client/websocket/packets/handlers/GuildIntegrationsUpdate.js\"));\n this.register(Constants.WSEvents.INVITE_CREATE, __webpack_require__(/*! ./handlers/InviteCreate */ \"./src/client/websocket/packets/handlers/InviteCreate.js\"));\n this.register(Constants.WSEvents.INVITE_DELETE, __webpack_require__(/*! ./handlers/InviteDelete */ \"./src/client/websocket/packets/handlers/InviteDelete.js\"));\n this.register(Constants.WSEvents.CHANNEL_CREATE, __webpack_require__(/*! ./handlers/ChannelCreate */ \"./src/client/websocket/packets/handlers/ChannelCreate.js\"));\n this.register(Constants.WSEvents.CHANNEL_DELETE, __webpack_require__(/*! ./handlers/ChannelDelete */ \"./src/client/websocket/packets/handlers/ChannelDelete.js\"));\n this.register(Constants.WSEvents.CHANNEL_UPDATE, __webpack_require__(/*! ./handlers/ChannelUpdate */ \"./src/client/websocket/packets/handlers/ChannelUpdate.js\"));\n this.register(Constants.WSEvents.CHANNEL_PINS_UPDATE, __webpack_require__(/*! ./handlers/ChannelPinsUpdate */ \"./src/client/websocket/packets/handlers/ChannelPinsUpdate.js\"));\n this.register(Constants.WSEvents.PRESENCE_UPDATE, __webpack_require__(/*! ./handlers/PresenceUpdate */ \"./src/client/websocket/packets/handlers/PresenceUpdate.js\"));\n this.register(Constants.WSEvents.USER_UPDATE, __webpack_require__(/*! ./handlers/UserUpdate */ \"./src/client/websocket/packets/handlers/UserUpdate.js\"));\n this.register(Constants.WSEvents.USER_NOTE_UPDATE, __webpack_require__(/*! ./handlers/UserNoteUpdate */ \"./src/client/websocket/packets/handlers/UserNoteUpdate.js\"));\n this.register(Constants.WSEvents.USER_SETTINGS_UPDATE, __webpack_require__(/*! ./handlers/UserSettingsUpdate */ \"./src/client/websocket/packets/handlers/UserSettingsUpdate.js\"));\n this.register(Constants.WSEvents.USER_GUILD_SETTINGS_UPDATE, __webpack_require__(/*! ./handlers/UserGuildSettingsUpdate */ \"./src/client/websocket/packets/handlers/UserGuildSettingsUpdate.js\"));\n this.register(Constants.WSEvents.VOICE_STATE_UPDATE, __webpack_require__(/*! ./handlers/VoiceStateUpdate */ \"./src/client/websocket/packets/handlers/VoiceStateUpdate.js\"));\n this.register(Constants.WSEvents.TYPING_START, __webpack_require__(/*! ./handlers/TypingStart */ \"./src/client/websocket/packets/handlers/TypingStart.js\"));\n this.register(Constants.WSEvents.MESSAGE_CREATE, __webpack_require__(/*! ./handlers/MessageCreate */ \"./src/client/websocket/packets/handlers/MessageCreate.js\"));\n this.register(Constants.WSEvents.MESSAGE_DELETE, __webpack_require__(/*! ./handlers/MessageDelete */ \"./src/client/websocket/packets/handlers/MessageDelete.js\"));\n this.register(Constants.WSEvents.MESSAGE_UPDATE, __webpack_require__(/*! ./handlers/MessageUpdate */ \"./src/client/websocket/packets/handlers/MessageUpdate.js\"));\n this.register(Constants.WSEvents.MESSAGE_DELETE_BULK, __webpack_require__(/*! ./handlers/MessageDeleteBulk */ \"./src/client/websocket/packets/handlers/MessageDeleteBulk.js\"));\n this.register(Constants.WSEvents.VOICE_SERVER_UPDATE, __webpack_require__(/*! ./handlers/VoiceServerUpdate */ \"./src/client/websocket/packets/handlers/VoiceServerUpdate.js\"));\n this.register(Constants.WSEvents.GUILD_SYNC, __webpack_require__(/*! ./handlers/GuildSync */ \"./src/client/websocket/packets/handlers/GuildSync.js\"));\n this.register(Constants.WSEvents.RELATIONSHIP_ADD, __webpack_require__(/*! ./handlers/RelationshipAdd */ \"./src/client/websocket/packets/handlers/RelationshipAdd.js\"));\n this.register(Constants.WSEvents.RELATIONSHIP_REMOVE, __webpack_require__(/*! ./handlers/RelationshipRemove */ \"./src/client/websocket/packets/handlers/RelationshipRemove.js\"));\n this.register(Constants.WSEvents.MESSAGE_REACTION_ADD, __webpack_require__(/*! ./handlers/MessageReactionAdd */ \"./src/client/websocket/packets/handlers/MessageReactionAdd.js\"));\n this.register(Constants.WSEvents.MESSAGE_REACTION_REMOVE, __webpack_require__(/*! ./handlers/MessageReactionRemove */ \"./src/client/websocket/packets/handlers/MessageReactionRemove.js\"));\n this.register(Constants.WSEvents.MESSAGE_REACTION_REMOVE, __webpack_require__(/*! ./handlers/MessageReactionRemoveEmoji */ \"./src/client/websocket/packets/handlers/MessageReactionRemoveEmoji.js\"));\n this.register(Constants.WSEvents.MESSAGE_REACTION_REMOVE_ALL, __webpack_require__(/*! ./handlers/MessageReactionRemoveAll */ \"./src/client/websocket/packets/handlers/MessageReactionRemoveAll.js\"));\n this.register(Constants.WSEvents.WEBHOOKS_UPDATE, __webpack_require__(/*! ./handlers/WebhooksUpdate */ \"./src/client/websocket/packets/handlers/WebhooksUpdate.js\"));\n }\n\n get client() {\n return this.ws.client;\n }\n\n register(event, Handler) {\n this.handlers[event] = new Handler(this);\n }\n\n handleQueue() {\n this.queue.forEach((element, index) => {\n this.handle(this.queue[index], true);\n this.queue.splice(index, 1);\n });\n }\n\n handle(packet, queue = false) {\n if (packet.op === Constants.OPCodes.HEARTBEAT_ACK) {\n this.ws.client._pong(this.ws.client._pingTimestamp);\n this.ws.lastHeartbeatAck = true;\n this.ws.client.emit('debug', 'Heartbeat acknowledged');\n } else if (packet.op === Constants.OPCodes.HEARTBEAT) {\n this.client.ws.send({\n op: Constants.OPCodes.HEARTBEAT,\n d: this.client.ws.sequence,\n });\n this.ws.client.emit('debug', 'Received gateway heartbeat');\n }\n\n if (this.ws.status === Constants.Status.RECONNECTING) {\n this.ws.reconnecting = false;\n this.ws.checkIfReady();\n }\n\n this.ws.setSequence(packet.s);\n\n if (this.ws.disabledEvents[packet.t] !== undefined) return false;\n\n if (this.ws.status !== Constants.Status.READY) {\n if (BeforeReadyWhitelist.indexOf(packet.t) === -1) {\n this.queue.push(packet);\n return false;\n }\n }\n\n if (!queue && this.queue.length > 0) this.handleQueue();\n if (this.handlers[packet.t]) return this.handlers[packet.t].handle(packet);\n return false;\n }\n}\n\nmodule.exports = WebSocketPacketManager;\n\n\n//# sourceURL=webpack:///./src/client/websocket/packets/WebSocketPacketManager.js?"); /***/ }), @@ -1161,6 +1198,30 @@ eval("const AbstractHandler = __webpack_require__(/*! ./AbstractHandler */ \"./s /***/ }), +/***/ "./src/client/websocket/packets/handlers/InviteCreate.js": +/*!***************************************************************!*\ + !*** ./src/client/websocket/packets/handlers/InviteCreate.js ***! + \***************************************************************/ +/*! no static exports found */ +/*! ModuleConcatenation bailout: Module is not an ECMAScript module */ +/***/ (function(module, exports, __webpack_require__) { + +eval("const AbstractHandler = __webpack_require__(/*! ./AbstractHandler */ \"./src/client/websocket/packets/handlers/AbstractHandler.js\");\n\nclass InviteCreateHandler extends AbstractHandler {\n handle(packet) {\n const client = this.packetManager.client;\n const data = packet.d;\n client.actions.InviteCreate.handle(data);\n }\n}\n\nmodule.exports = InviteCreateHandler;\n\n\n//# sourceURL=webpack:///./src/client/websocket/packets/handlers/InviteCreate.js?"); + +/***/ }), + +/***/ "./src/client/websocket/packets/handlers/InviteDelete.js": +/*!***************************************************************!*\ + !*** ./src/client/websocket/packets/handlers/InviteDelete.js ***! + \***************************************************************/ +/*! no static exports found */ +/*! ModuleConcatenation bailout: Module is not an ECMAScript module */ +/***/ (function(module, exports, __webpack_require__) { + +eval("const AbstractHandler = __webpack_require__(/*! ./AbstractHandler */ \"./src/client/websocket/packets/handlers/AbstractHandler.js\");\n\nclass InviteDeleteHandler extends AbstractHandler {\n handle(packet) {\n const client = this.packetManager.client;\n const data = packet.d;\n client.actions.InviteDelete.handle(data);\n }\n}\n\nmodule.exports = InviteDeleteHandler;\n\n\n//# sourceURL=webpack:///./src/client/websocket/packets/handlers/InviteDelete.js?"); + +/***/ }), + /***/ "./src/client/websocket/packets/handlers/MessageCreate.js": /*!****************************************************************!*\ !*** ./src/client/websocket/packets/handlers/MessageCreate.js ***! @@ -1233,6 +1294,18 @@ eval("const AbstractHandler = __webpack_require__(/*! ./AbstractHandler */ \"./s /***/ }), +/***/ "./src/client/websocket/packets/handlers/MessageReactionRemoveEmoji.js": +/*!*****************************************************************************!*\ + !*** ./src/client/websocket/packets/handlers/MessageReactionRemoveEmoji.js ***! + \*****************************************************************************/ +/*! no static exports found */ +/*! ModuleConcatenation bailout: Module is not an ECMAScript module */ +/***/ (function(module, exports, __webpack_require__) { + +eval("const AbstractHandler = __webpack_require__(/*! ./AbstractHandler */ \"./src/client/websocket/packets/handlers/AbstractHandler.js\");\n\nclass MessageReactionRemoveEmoji extends AbstractHandler {\n handle(packet) {\n const client = this.packetManager.client;\n const data = packet.d;\n client.actions.MessageReactionRemoveEmoji.handle(data);\n }\n}\n\nmodule.exports = MessageReactionRemoveEmoji;\n\n\n//# sourceURL=webpack:///./src/client/websocket/packets/handlers/MessageReactionRemoveEmoji.js?"); + +/***/ }), + /***/ "./src/client/websocket/packets/handlers/MessageUpdate.js": /*!****************************************************************!*\ !*** ./src/client/websocket/packets/handlers/MessageUpdate.js ***! @@ -1265,7 +1338,7 @@ eval("const AbstractHandler = __webpack_require__(/*! ./AbstractHandler */ \"./s /*! ModuleConcatenation bailout: Module is not an ECMAScript module */ /***/ (function(module, exports, __webpack_require__) { -eval("const AbstractHandler = __webpack_require__(/*! ./AbstractHandler */ \"./src/client/websocket/packets/handlers/AbstractHandler.js\");\n\nconst ClientUser = __webpack_require__(/*! ../../../../structures/ClientUser */ \"./src/structures/ClientUser.js\");\n\nclass ReadyHandler extends AbstractHandler {\n handle(packet) {\n const client = this.packetManager.client;\n const data = packet.d;\n\n client.ws.heartbeat();\n\n data.user.user_settings = data.user_settings;\n data.user.user_guild_settings = data.user_guild_settings;\n\n const clientUser = new ClientUser(client, data.user);\n client.user = clientUser;\n client.readyAt = new Date();\n client.users.set(clientUser.id, clientUser);\n\n for (const guild of data.guilds) if (!client.guilds.has(guild.id)) client.dataManager.newGuild(guild);\n for (const privateDM of data.private_channels) client.dataManager.newChannel(privateDM);\n\n for (const relation of data.relationships) {\n const user = client.dataManager.newUser(relation.user);\n if (relation.type === 1) {\n client.user.friends.set(user.id, user);\n } else if (relation.type === 2) {\n client.user.blocked.set(user.id, user);\n }\n }\n\n data.presences = data.presences || [];\n for (const presence of data.presences) {\n client.dataManager.newUser(presence.user);\n client._setPresence(presence.user.id, presence);\n }\n\n if (data.notes) {\n for (const user in data.notes) {\n let note = data.notes[user];\n if (!note.length) note = null;\n\n client.user.notes.set(user, note);\n }\n }\n\n if (!client.user.bot && client.options.sync) client.setInterval(client.syncGuilds.bind(client), 30000);\n\n if (!client.users.has('1')) {\n client.dataManager.newUser({\n id: '1',\n username: 'Clyde',\n discriminator: '0000',\n avatar: 'https://discordapp.com/assets/f78426a064bc9dd24847519259bc42af.png',\n bot: true,\n status: 'online',\n game: null,\n verified: true,\n });\n }\n\n const t = client.setTimeout(() => {\n client.ws.connection.triggerReady();\n }, 1200 * data.guilds.length);\n\n client.setMaxListeners(data.guilds.length + 10);\n\n client.once('ready', () => {\n client.syncGuilds();\n client.setMaxListeners(10);\n client.clearTimeout(t);\n });\n\n const ws = this.packetManager.ws;\n\n ws.sessionID = data.session_id;\n ws._trace = data._trace;\n client.emit('debug', `READY ${ws._trace.join(' -> ')} ${ws.sessionID}`);\n ws.checkIfReady();\n }\n}\n\nmodule.exports = ReadyHandler;\n\n\n//# sourceURL=webpack:///./src/client/websocket/packets/handlers/Ready.js?"); +eval("const AbstractHandler = __webpack_require__(/*! ./AbstractHandler */ \"./src/client/websocket/packets/handlers/AbstractHandler.js\");\n\nconst ClientUser = __webpack_require__(/*! ../../../../structures/ClientUser */ \"./src/structures/ClientUser.js\");\n\nclass ReadyHandler extends AbstractHandler {\n handle(packet) {\n const client = this.packetManager.client;\n const data = packet.d;\n\n client.ws.heartbeat();\n\n data.user.user_settings = data.user_settings;\n data.user.user_guild_settings = data.user_guild_settings;\n\n const clientUser = new ClientUser(client, data.user);\n client.user = clientUser;\n client.readyAt = new Date();\n client.users.set(clientUser.id, clientUser);\n\n for (const guild of data.guilds) if (!client.guilds.has(guild.id)) client.dataManager.newGuild(guild);\n for (const privateDM of data.private_channels) client.dataManager.newChannel(privateDM);\n\n for (const relation of data.relationships) {\n const user = client.dataManager.newUser(relation.user);\n if (relation.type === 1) {\n client.user.friends.set(user.id, user);\n } else if (relation.type === 2) {\n client.user.blocked.set(user.id, user);\n }\n }\n\n data.presences = data.presences || [];\n for (const presence of data.presences) {\n client.dataManager.newUser(presence.user);\n client._setPresence(presence.user.id, presence);\n }\n\n if (data.notes) {\n for (const user of Object.keys(data.notes)) {\n let note = data.notes[user];\n if (!note.length) note = null;\n\n client.user.notes.set(user, note);\n }\n }\n\n if (!client.user.bot && client.options.sync) client.setInterval(client.syncGuilds.bind(client), 30000);\n\n if (!client.users.has('1')) {\n client.dataManager.newUser({\n id: '1',\n username: 'Clyde',\n discriminator: '0000',\n avatar: 'https://discordapp.com/assets/f78426a064bc9dd24847519259bc42af.png',\n bot: true,\n status: 'online',\n game: null,\n verified: true,\n });\n }\n\n const t = client.setTimeout(() => {\n client.ws.connection.triggerReady();\n }, 1200 * data.guilds.length);\n\n const guildCount = data.guilds.length;\n\n if (client.getMaxListeners() !== 0) client.setMaxListeners(client.getMaxListeners() + guildCount);\n\n client.once('ready', () => {\n client.syncGuilds();\n if (client.getMaxListeners() !== 0) client.setMaxListeners(client.getMaxListeners() - guildCount);\n client.clearTimeout(t);\n });\n\n const ws = this.packetManager.ws;\n\n ws.sessionID = data.session_id;\n client.emit('debug', `READY ${ws.sessionID}`);\n ws.checkIfReady();\n }\n}\n\nmodule.exports = ReadyHandler;\n\n\n//# sourceURL=webpack:///./src/client/websocket/packets/handlers/Ready.js?"); /***/ }), @@ -1301,7 +1374,7 @@ eval("const AbstractHandler = __webpack_require__(/*! ./AbstractHandler */ \"./s /*! ModuleConcatenation bailout: Module is not an ECMAScript module */ /***/ (function(module, exports, __webpack_require__) { -eval("const AbstractHandler = __webpack_require__(/*! ./AbstractHandler */ \"./src/client/websocket/packets/handlers/AbstractHandler.js\");\nconst Constants = __webpack_require__(/*! ../../../../util/Constants */ \"./src/util/Constants.js\");\n\nclass ResumedHandler extends AbstractHandler {\n handle(packet) {\n const client = this.packetManager.client;\n const ws = client.ws.connection;\n\n ws._trace = packet.d._trace;\n\n ws.status = Constants.Status.READY;\n this.packetManager.handleQueue();\n\n const replayed = ws.sequence - ws.closeSequence;\n\n ws.debug(`RESUMED ${ws._trace.join(' -> ')} | replayed ${replayed} events.`);\n client.emit(Constants.Events.RESUME, replayed);\n ws.heartbeat();\n }\n}\n\n/**\n * Emitted whenever a WebSocket resumes.\n * @event Client#resume\n * @param {number} replayed The number of events that were replayed\n */\n\nmodule.exports = ResumedHandler;\n\n\n//# sourceURL=webpack:///./src/client/websocket/packets/handlers/Resumed.js?"); +eval("const AbstractHandler = __webpack_require__(/*! ./AbstractHandler */ \"./src/client/websocket/packets/handlers/AbstractHandler.js\");\nconst Constants = __webpack_require__(/*! ../../../../util/Constants */ \"./src/util/Constants.js\");\n\nclass ResumedHandler extends AbstractHandler {\n handle() {\n const client = this.packetManager.client;\n const ws = client.ws.connection;\n\n ws.status = Constants.Status.READY;\n this.packetManager.handleQueue();\n\n const replayed = ws.sequence - ws.closeSequence;\n\n ws.debug(`RESUMED | replayed ${replayed} events.`);\n client.emit(Constants.Events.RESUME, replayed);\n ws.heartbeat();\n }\n}\n\n/**\n * Emitted whenever a WebSocket resumes.\n * @event Client#resume\n * @param {number} replayed The number of events that were replayed\n */\n\nmodule.exports = ResumedHandler;\n\n\n//# sourceURL=webpack:///./src/client/websocket/packets/handlers/Resumed.js?"); /***/ }), @@ -1385,7 +1458,7 @@ eval("const AbstractHandler = __webpack_require__(/*! ./AbstractHandler */ \"./s /*! ModuleConcatenation bailout: Module is not an ECMAScript module */ /***/ (function(module, exports, __webpack_require__) { -eval("const AbstractHandler = __webpack_require__(/*! ./AbstractHandler */ \"./src/client/websocket/packets/handlers/AbstractHandler.js\");\n\nconst Constants = __webpack_require__(/*! ../../../../util/Constants */ \"./src/util/Constants.js\");\nconst Util = __webpack_require__(/*! ../../../../util/Util */ \"./src/util/Util.js\");\n\nclass VoiceStateUpdateHandler extends AbstractHandler {\n handle(packet) {\n const client = this.packetManager.client;\n const data = packet.d;\n\n const guild = client.guilds.get(data.guild_id);\n if (guild) {\n const member = guild.members.get(data.user_id);\n if (member) {\n const oldVoiceChannelMember = Util.cloneObject(member);\n if (member.voiceChannel && member.voiceChannel.id !== data.channel_id) {\n member.voiceChannel.members.delete(oldVoiceChannelMember.id);\n }\n\n // If the member left the voice channel, unset their speaking property\n if (!data.channel_id) member.speaking = null;\n\n if (member.user.id === client.user.id && data.channel_id) {\n client.emit('self.voiceStateUpdate', data);\n }\n\n const newChannel = client.channels.get(data.channel_id);\n if (newChannel) {\n newChannel.members.set(member.id, member);\n member.guild.channels.set(data.channel_id, newChannel);\n }\n\n member.serverMute = data.mute;\n member.serverDeaf = data.deaf;\n member.selfMute = data.self_mute;\n member.selfDeaf = data.self_deaf;\n member.voiceSessionID = data.session_id;\n member.voiceChannelID = data.channel_id;\n client.emit(Constants.Events.VOICE_STATE_UPDATE, oldVoiceChannelMember, member);\n }\n }\n }\n}\n\n/**\n * Emitted whenever a user changes voice state - e.g. joins/leaves a channel, mutes/unmutes.\n * @event Client#voiceStateUpdate\n * @param {GuildMember} oldMember The member before the voice state update\n * @param {GuildMember} newMember The member after the voice state update\n */\n\nmodule.exports = VoiceStateUpdateHandler;\n\n\n//# sourceURL=webpack:///./src/client/websocket/packets/handlers/VoiceStateUpdate.js?"); +eval("const AbstractHandler = __webpack_require__(/*! ./AbstractHandler */ \"./src/client/websocket/packets/handlers/AbstractHandler.js\");\n\nconst Constants = __webpack_require__(/*! ../../../../util/Constants */ \"./src/util/Constants.js\");\nconst Util = __webpack_require__(/*! ../../../../util/Util */ \"./src/util/Util.js\");\n\nclass VoiceStateUpdateHandler extends AbstractHandler {\n handle(packet) {\n const client = this.packetManager.client;\n const data = packet.d;\n\n const guild = client.guilds.get(data.guild_id);\n if (guild) {\n const member = guild.members.get(data.user_id);\n if (member) {\n const oldVoiceChannelMember = Util.cloneObject(member);\n if (member.voiceChannel && member.voiceChannel.id !== data.channel_id) {\n member.voiceChannel.members.delete(oldVoiceChannelMember.id);\n }\n\n // If the member left the voice channel, unset their speaking property\n if (!data.channel_id) member.speaking = null;\n\n if (member.user.id === client.user.id) {\n client.emit('self.voiceStateUpdate', data);\n }\n\n const newChannel = client.channels.get(data.channel_id);\n if (newChannel) {\n newChannel.members.set(member.id, member);\n member.guild.channels.set(data.channel_id, newChannel);\n }\n\n member.serverMute = data.mute;\n member.serverDeaf = data.deaf;\n member.selfMute = data.self_mute;\n member.selfDeaf = data.self_deaf;\n member.selfStream = data.self_stream || false;\n member.voiceSessionID = data.session_id;\n member.voiceChannelID = data.channel_id;\n client.emit(Constants.Events.VOICE_STATE_UPDATE, oldVoiceChannelMember, member);\n }\n }\n }\n}\n\n/**\n * Emitted whenever a user changes voice state - e.g. joins/leaves a channel, mutes/unmutes.\n * @event Client#voiceStateUpdate\n * @param {GuildMember} oldMember The member before the voice state update\n * @param {GuildMember} newMember The member after the voice state update\n */\n\nmodule.exports = VoiceStateUpdateHandler;\n\n\n//# sourceURL=webpack:///./src/client/websocket/packets/handlers/VoiceStateUpdate.js?"); /***/ }), @@ -1409,7 +1482,7 @@ eval("const AbstractHandler = __webpack_require__(/*! ./AbstractHandler */ \"./s /*! ModuleConcatenation bailout: Module is not an ECMAScript module */ /***/ (function(module, exports, __webpack_require__) { -eval("const Util = __webpack_require__(/*! ./util/Util */ \"./src/util/Util.js\");\n\nmodule.exports = {\n // \"Root\" classes (starting points)\n Client: __webpack_require__(/*! ./client/Client */ \"./src/client/Client.js\"),\n Shard: __webpack_require__(/*! ./sharding/Shard */ 7),\n ShardClientUtil: __webpack_require__(/*! ./sharding/ShardClientUtil */ 8),\n ShardingManager: __webpack_require__(/*! ./sharding/ShardingManager */ 9),\n WebhookClient: __webpack_require__(/*! ./client/WebhookClient */ \"./src/client/WebhookClient.js\"),\n\n // Utilities\n Collection: __webpack_require__(/*! ./util/Collection */ \"./src/util/Collection.js\"),\n Constants: __webpack_require__(/*! ./util/Constants */ \"./src/util/Constants.js\"),\n DiscordAPIError: __webpack_require__(/*! ./client/rest/DiscordAPIError */ \"./src/client/rest/DiscordAPIError.js\"),\n EvaluatedPermissions: __webpack_require__(/*! ./util/Permissions */ \"./src/util/Permissions.js\"),\n Permissions: __webpack_require__(/*! ./util/Permissions */ \"./src/util/Permissions.js\"),\n Snowflake: __webpack_require__(/*! ./util/Snowflake */ \"./src/util/Snowflake.js\"),\n SnowflakeUtil: __webpack_require__(/*! ./util/Snowflake */ \"./src/util/Snowflake.js\"),\n Util: Util,\n util: Util,\n version: __webpack_require__(/*! ../package */ \"./package.json\").version,\n\n // Shortcuts to Util methods\n escapeMarkdown: Util.escapeMarkdown,\n fetchRecommendedShards: Util.fetchRecommendedShards,\n splitMessage: Util.splitMessage,\n\n // Structures\n Attachment: __webpack_require__(/*! ./structures/Attachment */ \"./src/structures/Attachment.js\"),\n CategoryChannel: __webpack_require__(/*! ./structures/CategoryChannel */ \"./src/structures/CategoryChannel.js\"),\n Channel: __webpack_require__(/*! ./structures/Channel */ \"./src/structures/Channel.js\"),\n ClientUser: __webpack_require__(/*! ./structures/ClientUser */ \"./src/structures/ClientUser.js\"),\n ClientUserSettings: __webpack_require__(/*! ./structures/ClientUserSettings */ \"./src/structures/ClientUserSettings.js\"),\n Collector: __webpack_require__(/*! ./structures/interfaces/Collector */ \"./src/structures/interfaces/Collector.js\"),\n DMChannel: __webpack_require__(/*! ./structures/DMChannel */ \"./src/structures/DMChannel.js\"),\n Emoji: __webpack_require__(/*! ./structures/Emoji */ \"./src/structures/Emoji.js\"),\n Game: __webpack_require__(/*! ./structures/Presence */ \"./src/structures/Presence.js\").Game,\n GroupDMChannel: __webpack_require__(/*! ./structures/GroupDMChannel */ \"./src/structures/GroupDMChannel.js\"),\n Guild: __webpack_require__(/*! ./structures/Guild */ \"./src/structures/Guild.js\"),\n GuildAuditLogs: __webpack_require__(/*! ./structures/GuildAuditLogs */ \"./src/structures/GuildAuditLogs.js\"),\n GuildChannel: __webpack_require__(/*! ./structures/GuildChannel */ \"./src/structures/GuildChannel.js\"),\n GuildMember: __webpack_require__(/*! ./structures/GuildMember */ \"./src/structures/GuildMember.js\"),\n Invite: __webpack_require__(/*! ./structures/Invite */ \"./src/structures/Invite.js\"),\n Message: __webpack_require__(/*! ./structures/Message */ \"./src/structures/Message.js\"),\n MessageAttachment: __webpack_require__(/*! ./structures/MessageAttachment */ \"./src/structures/MessageAttachment.js\"),\n MessageCollector: __webpack_require__(/*! ./structures/MessageCollector */ \"./src/structures/MessageCollector.js\"),\n MessageEmbed: __webpack_require__(/*! ./structures/MessageEmbed */ \"./src/structures/MessageEmbed.js\"),\n MessageMentions: __webpack_require__(/*! ./structures/MessageMentions */ \"./src/structures/MessageMentions.js\"),\n MessageReaction: __webpack_require__(/*! ./structures/MessageReaction */ \"./src/structures/MessageReaction.js\"),\n NewsChannel: __webpack_require__(/*! ./structures/NewsChannel */ \"./src/structures/NewsChannel.js\"),\n OAuth2Application: __webpack_require__(/*! ./structures/OAuth2Application */ \"./src/structures/OAuth2Application.js\"),\n ClientOAuth2Application: __webpack_require__(/*! ./structures/OAuth2Application */ \"./src/structures/OAuth2Application.js\"),\n PartialGuild: __webpack_require__(/*! ./structures/PartialGuild */ \"./src/structures/PartialGuild.js\"),\n PartialGuildChannel: __webpack_require__(/*! ./structures/PartialGuildChannel */ \"./src/structures/PartialGuildChannel.js\"),\n PermissionOverwrites: __webpack_require__(/*! ./structures/PermissionOverwrites */ \"./src/structures/PermissionOverwrites.js\"),\n Presence: __webpack_require__(/*! ./structures/Presence */ \"./src/structures/Presence.js\").Presence,\n ReactionEmoji: __webpack_require__(/*! ./structures/ReactionEmoji */ \"./src/structures/ReactionEmoji.js\"),\n ReactionCollector: __webpack_require__(/*! ./structures/ReactionCollector */ \"./src/structures/ReactionCollector.js\"),\n RichEmbed: __webpack_require__(/*! ./structures/RichEmbed */ \"./src/structures/RichEmbed.js\"),\n Role: __webpack_require__(/*! ./structures/Role */ \"./src/structures/Role.js\"),\n StoreChannel: __webpack_require__(/*! ./structures/StoreChannel */ \"./src/structures/StoreChannel.js\"),\n TextChannel: __webpack_require__(/*! ./structures/TextChannel */ \"./src/structures/TextChannel.js\"),\n User: __webpack_require__(/*! ./structures/User */ \"./src/structures/User.js\"),\n VoiceChannel: __webpack_require__(/*! ./structures/VoiceChannel */ \"./src/structures/VoiceChannel.js\"),\n Webhook: __webpack_require__(/*! ./structures/Webhook */ \"./src/structures/Webhook.js\"),\n};\n\n\n//# sourceURL=webpack:///./src/index.js?"); +eval("const Util = __webpack_require__(/*! ./util/Util */ \"./src/util/Util.js\");\n\nmodule.exports = {\n // \"Root\" classes (starting points)\n Client: __webpack_require__(/*! ./client/Client */ \"./src/client/Client.js\"),\n Shard: __webpack_require__(/*! ./sharding/Shard */ 7),\n ShardClientUtil: __webpack_require__(/*! ./sharding/ShardClientUtil */ 8),\n ShardingManager: __webpack_require__(/*! ./sharding/ShardingManager */ 9),\n WebhookClient: __webpack_require__(/*! ./client/WebhookClient */ \"./src/client/WebhookClient.js\"),\n\n // Utilities\n BitField: __webpack_require__(/*! ./util/BitField */ \"./src/util/BitField.js\"),\n Collection: __webpack_require__(/*! ./util/Collection */ \"./src/util/Collection.js\"),\n Constants: __webpack_require__(/*! ./util/Constants */ \"./src/util/Constants.js\"),\n DiscordAPIError: __webpack_require__(/*! ./client/rest/DiscordAPIError */ \"./src/client/rest/DiscordAPIError.js\"),\n EvaluatedPermissions: __webpack_require__(/*! ./util/Permissions */ \"./src/util/Permissions.js\"),\n MessageFlags: __webpack_require__(/*! ./util/MessageFlags */ \"./src/util/MessageFlags.js\"),\n Permissions: __webpack_require__(/*! ./util/Permissions */ \"./src/util/Permissions.js\"),\n Snowflake: __webpack_require__(/*! ./util/Snowflake */ \"./src/util/Snowflake.js\"),\n SnowflakeUtil: __webpack_require__(/*! ./util/Snowflake */ \"./src/util/Snowflake.js\"),\n SystemChannelFlags: __webpack_require__(/*! ./util/SystemChannelFlags */ \"./src/util/SystemChannelFlags.js\"),\n Util: Util,\n util: Util,\n version: __webpack_require__(/*! ../package */ \"./package.json\").version,\n\n // Shortcuts to Util methods\n escapeMarkdown: Util.escapeMarkdown,\n fetchRecommendedShards: Util.fetchRecommendedShards,\n resolveString: Util.resolveString,\n splitMessage: Util.splitMessage,\n\n // Structures\n Attachment: __webpack_require__(/*! ./structures/Attachment */ \"./src/structures/Attachment.js\"),\n CategoryChannel: __webpack_require__(/*! ./structures/CategoryChannel */ \"./src/structures/CategoryChannel.js\"),\n Channel: __webpack_require__(/*! ./structures/Channel */ \"./src/structures/Channel.js\"),\n ClientUser: __webpack_require__(/*! ./structures/ClientUser */ \"./src/structures/ClientUser.js\"),\n ClientUserSettings: __webpack_require__(/*! ./structures/ClientUserSettings */ \"./src/structures/ClientUserSettings.js\"),\n Collector: __webpack_require__(/*! ./structures/interfaces/Collector */ \"./src/structures/interfaces/Collector.js\"),\n DMChannel: __webpack_require__(/*! ./structures/DMChannel */ \"./src/structures/DMChannel.js\"),\n Emoji: __webpack_require__(/*! ./structures/Emoji */ \"./src/structures/Emoji.js\"),\n Game: __webpack_require__(/*! ./structures/Presence */ \"./src/structures/Presence.js\").Game,\n GroupDMChannel: __webpack_require__(/*! ./structures/GroupDMChannel */ \"./src/structures/GroupDMChannel.js\"),\n Guild: __webpack_require__(/*! ./structures/Guild */ \"./src/structures/Guild.js\"),\n GuildAuditLogs: __webpack_require__(/*! ./structures/GuildAuditLogs */ \"./src/structures/GuildAuditLogs.js\"),\n GuildChannel: __webpack_require__(/*! ./structures/GuildChannel */ \"./src/structures/GuildChannel.js\"),\n GuildMember: __webpack_require__(/*! ./structures/GuildMember */ \"./src/structures/GuildMember.js\"),\n Integration: __webpack_require__(/*! ./structures/Integration */ \"./src/structures/Integration.js\"),\n Invite: __webpack_require__(/*! ./structures/Invite */ \"./src/structures/Invite.js\"),\n Message: __webpack_require__(/*! ./structures/Message */ \"./src/structures/Message.js\"),\n MessageAttachment: __webpack_require__(/*! ./structures/MessageAttachment */ \"./src/structures/MessageAttachment.js\"),\n MessageCollector: __webpack_require__(/*! ./structures/MessageCollector */ \"./src/structures/MessageCollector.js\"),\n MessageEmbed: __webpack_require__(/*! ./structures/MessageEmbed */ \"./src/structures/MessageEmbed.js\"),\n MessageMentions: __webpack_require__(/*! ./structures/MessageMentions */ \"./src/structures/MessageMentions.js\"),\n MessageReaction: __webpack_require__(/*! ./structures/MessageReaction */ \"./src/structures/MessageReaction.js\"),\n NewsChannel: __webpack_require__(/*! ./structures/NewsChannel */ \"./src/structures/NewsChannel.js\"),\n OAuth2Application: __webpack_require__(/*! ./structures/OAuth2Application */ \"./src/structures/OAuth2Application.js\"),\n ClientOAuth2Application: __webpack_require__(/*! ./structures/OAuth2Application */ \"./src/structures/OAuth2Application.js\"),\n PartialGuild: __webpack_require__(/*! ./structures/PartialGuild */ \"./src/structures/PartialGuild.js\"),\n PartialGuildChannel: __webpack_require__(/*! ./structures/PartialGuildChannel */ \"./src/structures/PartialGuildChannel.js\"),\n PermissionOverwrites: __webpack_require__(/*! ./structures/PermissionOverwrites */ \"./src/structures/PermissionOverwrites.js\"),\n Presence: __webpack_require__(/*! ./structures/Presence */ \"./src/structures/Presence.js\").Presence,\n ReactionEmoji: __webpack_require__(/*! ./structures/ReactionEmoji */ \"./src/structures/ReactionEmoji.js\"),\n ReactionCollector: __webpack_require__(/*! ./structures/ReactionCollector */ \"./src/structures/ReactionCollector.js\"),\n RichEmbed: __webpack_require__(/*! ./structures/RichEmbed */ \"./src/structures/RichEmbed.js\"),\n Role: __webpack_require__(/*! ./structures/Role */ \"./src/structures/Role.js\"),\n StoreChannel: __webpack_require__(/*! ./structures/StoreChannel */ \"./src/structures/StoreChannel.js\"),\n TextChannel: __webpack_require__(/*! ./structures/TextChannel */ \"./src/structures/TextChannel.js\"),\n User: __webpack_require__(/*! ./structures/User */ \"./src/structures/User.js\"),\n VoiceChannel: __webpack_require__(/*! ./structures/VoiceChannel */ \"./src/structures/VoiceChannel.js\"),\n Webhook: __webpack_require__(/*! ./structures/Webhook */ \"./src/structures/Webhook.js\"),\n};\n\n\n//# sourceURL=webpack:///./src/index.js?"); /***/ }), @@ -1517,7 +1590,7 @@ eval("const Channel = __webpack_require__(/*! ./Channel */ \"./src/structures/Ch /*! ModuleConcatenation bailout: Module is not an ECMAScript module */ /***/ (function(module, exports, __webpack_require__) { -eval("const Constants = __webpack_require__(/*! ../util/Constants */ \"./src/util/Constants.js\");\nconst Collection = __webpack_require__(/*! ../util/Collection */ \"./src/util/Collection.js\");\nconst Permissions = __webpack_require__(/*! ../util/Permissions */ \"./src/util/Permissions.js\");\nconst Snowflake = __webpack_require__(/*! ../util/Snowflake */ \"./src/util/Snowflake.js\");\n\n/**\n * Represents a custom emoji.\n */\nclass Emoji {\n constructor(guild, data) {\n /**\n * The client that instantiated this object\n * @name Emoji#client\n * @type {Client}\n * @readonly\n */\n Object.defineProperty(this, 'client', { value: guild.client });\n\n /**\n * The guild this emoji is part of\n * @type {Guild}\n */\n this.guild = guild;\n\n /**\n * Whether this emoji has been deleted\n * @type {boolean}\n */\n this.deleted = false;\n\n this.setup(data);\n }\n\n setup(data) {\n /**\n * The ID of the emoji\n * @type {Snowflake}\n */\n this.id = data.id;\n\n /**\n * The name of the emoji\n * @type {string}\n */\n this.name = data.name;\n\n /**\n * Whether or not this emoji requires colons surrounding it\n * @type {boolean}\n */\n this.requiresColons = data.require_colons;\n\n /**\n * Whether this emoji is managed by an external service\n * @type {boolean}\n */\n this.managed = data.managed;\n\n /**\n * Whether this emoji is animated\n * @type {boolean}\n */\n this.animated = data.animated;\n\n this._roles = data.roles;\n }\n\n /**\n * The timestamp the emoji was created at\n * @type {number}\n * @readonly\n */\n get createdTimestamp() {\n return Snowflake.deconstruct(this.id).timestamp;\n }\n\n /**\n * The time the emoji was created\n * @type {Date}\n * @readonly\n */\n get createdAt() {\n return new Date(this.createdTimestamp);\n }\n\n /**\n * Whether the emoji is deletable by the client user\n * @type {boolean}\n * @readonly\n */\n get deletable() {\n return !this.managed && this.guild.me.hasPermission(Permissions.FLAGS.MANAGE_EMOJIS);\n }\n\n /**\n * A collection of roles this emoji is active for (empty if all), mapped by role ID\n * @type {Collection}\n * @readonly\n */\n get roles() {\n const roles = new Collection();\n for (const role of this._roles) {\n if (this.guild.roles.has(role)) roles.set(role, this.guild.roles.get(role));\n }\n return roles;\n }\n\n /**\n * The URL to the emoji file\n * @type {string}\n * @readonly\n */\n get url() {\n return Constants.Endpoints.CDN(this.client.options.http.cdn).Emoji(this.id, this.animated ? 'gif' : 'png');\n }\n\n /**\n * The identifier of this emoji, used for message reactions\n * @type {string}\n * @readonly\n */\n get identifier() {\n if (this.id) return `${this.name}:${this.id}`;\n return encodeURIComponent(this.name);\n }\n\n /**\n * Data for editing an emoji.\n * @typedef {Object} EmojiEditData\n * @property {string} [name] The name of the emoji\n * @property {Collection|Array} [roles] Roles to restrict emoji to\n */\n\n /**\n * Edits the emoji.\n * @param {EmojiEditData} data The new data for the emoji\n * @param {string} [reason] Reason for editing this emoji\n * @returns {Promise}\n * @example\n * // Edit an emoji\n * emoji.edit({name: 'newemoji'})\n * .then(e => console.log(`Edited emoji ${e}`))\n * .catch(console.error);\n */\n edit(data, reason) {\n return this.client.rest.methods.updateEmoji(this, data, reason);\n }\n\n /**\n * Set the name of the emoji.\n * @param {string} name The new name for the emoji\n * @param {string} [reason] The reason for changing the emoji's name\n * @returns {Promise}\n */\n setName(name, reason) {\n return this.edit({ name }, reason);\n }\n\n /**\n * Fetches the author for this emoji\n * @returns {Promise}\n */\n fetchAuthor() {\n if (this.managed) return Promise.reject(new Error('Emoji is managed and has no Author.'));\n if (!this.guild.me.permissions.has(Permissions.FLAGS.MANAGE_EMOJIS)) {\n return Promise.reject(\n new Error(`Client must have Manage Emoji permission in guild ${this.guild} to see emoji authors.`)\n );\n }\n return this.client.rest.makeRequest('get', Constants.Endpoints.Guild(this.guild).Emoji(this.id), true)\n .then(emoji => this.client.dataManager.newUser(emoji.user));\n }\n\n /**\n * Add a role to the list of roles that can use this emoji.\n * @param {Role} role The role to add\n * @returns {Promise}\n */\n addRestrictedRole(role) {\n return this.addRestrictedRoles([role]);\n }\n\n /**\n * Add multiple roles to the list of roles that can use this emoji.\n * @param {Role[]} roles Roles to add\n * @returns {Promise}\n */\n addRestrictedRoles(roles) {\n const newRoles = new Collection(this.roles);\n for (const role of roles) {\n if (this.guild.roles.has(role.id)) newRoles.set(role.id, role);\n }\n return this.edit({ roles: newRoles });\n }\n\n /**\n * Remove a role from the list of roles that can use this emoji.\n * @param {Role} role The role to remove\n * @returns {Promise}\n */\n removeRestrictedRole(role) {\n return this.removeRestrictedRoles([role]);\n }\n\n /**\n * Remove multiple roles from the list of roles that can use this emoji.\n * @param {Role[]} roles Roles to remove\n * @returns {Promise}\n */\n removeRestrictedRoles(roles) {\n const newRoles = new Collection(this.roles);\n for (const role of roles) {\n if (newRoles.has(role.id)) newRoles.delete(role.id);\n }\n return this.edit({ roles: newRoles });\n }\n\n /**\n * When concatenated with a string, this automatically returns the emoji mention rather than the object.\n * @returns {string}\n * @example\n * // Send an emoji:\n * const emoji = guild.emojis.first();\n * msg.reply(`Hello! ${emoji}`);\n */\n toString() {\n if (!this.id || !this.requiresColons) {\n return this.name;\n }\n\n return `<${this.animated ? 'a' : ''}:${this.name}:${this.id}>`;\n }\n\n /**\n * Whether this emoji is the same as another one.\n * @param {Emoji|Object} other The emoji to compare it to\n * @returns {boolean} Whether the emoji is equal to the given emoji or not\n */\n equals(other) {\n if (other instanceof Emoji) {\n return (\n other.id === this.id &&\n other.name === this.name &&\n other.managed === this.managed &&\n other.requiresColons === this.requiresColons\n );\n } else {\n return (\n other.id === this.id &&\n other.name === this.name\n );\n }\n }\n}\n\nmodule.exports = Emoji;\n\n\n//# sourceURL=webpack:///./src/structures/Emoji.js?"); +eval("const Constants = __webpack_require__(/*! ../util/Constants */ \"./src/util/Constants.js\");\nconst Collection = __webpack_require__(/*! ../util/Collection */ \"./src/util/Collection.js\");\nconst Permissions = __webpack_require__(/*! ../util/Permissions */ \"./src/util/Permissions.js\");\nconst Snowflake = __webpack_require__(/*! ../util/Snowflake */ \"./src/util/Snowflake.js\");\n\n/**\n * Represents a custom emoji.\n */\nclass Emoji {\n constructor(guild, data) {\n /**\n * The client that instantiated this object\n * @name Emoji#client\n * @type {Client}\n * @readonly\n */\n Object.defineProperty(this, 'client', { value: guild.client });\n\n /**\n * The guild this emoji is part of\n * @type {Guild}\n */\n this.guild = guild;\n\n /**\n * Whether this emoji has been deleted\n * @type {boolean}\n */\n this.deleted = false;\n\n this.setup(data);\n }\n\n setup(data) {\n /**\n * The ID of the emoji\n * @type {Snowflake}\n */\n this.id = data.id;\n\n /**\n * The name of the emoji\n * @type {string}\n */\n this.name = data.name;\n\n /**\n * Whether or not this emoji requires colons surrounding it\n * @type {boolean}\n */\n this.requiresColons = data.require_colons;\n\n /**\n * Whether this emoji is managed by an external service\n * @type {boolean}\n */\n this.managed = data.managed;\n\n /**\n * Whether this emoji is animated\n * @type {boolean}\n */\n this.animated = data.animated;\n\n /**\n * Whether this emoji is available\n * @type {boolean}\n * @name Emoji#available\n */\n if (typeof data.available !== 'undefined') this.available = data.available;\n\n this._roles = data.roles;\n }\n\n /**\n * The timestamp the emoji was created at\n * @type {number}\n * @readonly\n */\n get createdTimestamp() {\n return Snowflake.deconstruct(this.id).timestamp;\n }\n\n /**\n * The time the emoji was created\n * @type {Date}\n * @readonly\n */\n get createdAt() {\n return new Date(this.createdTimestamp);\n }\n\n /**\n * Whether the emoji is deletable by the client user\n * @type {boolean}\n * @readonly\n */\n get deletable() {\n return !this.managed && this.guild.me.hasPermission(Permissions.FLAGS.MANAGE_EMOJIS);\n }\n\n /**\n * A collection of roles this emoji is active for (empty if all), mapped by role ID\n * @type {Collection}\n * @readonly\n */\n get roles() {\n const roles = new Collection();\n for (const role of this._roles) {\n if (this.guild.roles.has(role)) roles.set(role, this.guild.roles.get(role));\n }\n return roles;\n }\n\n /**\n * The URL to the emoji file\n * @type {string}\n * @readonly\n */\n get url() {\n return Constants.Endpoints.CDN(this.client.options.http.cdn).Emoji(this.id, this.animated ? 'gif' : 'png');\n }\n\n /**\n * The identifier of this emoji, used for message reactions\n * @type {string}\n * @readonly\n */\n get identifier() {\n if (this.id) return `${this.name}:${this.id}`;\n return encodeURIComponent(this.name);\n }\n\n /**\n * Data for editing an emoji.\n * @typedef {Object} EmojiEditData\n * @property {string} [name] The name of the emoji\n * @property {Collection|Array} [roles] Roles to restrict emoji to\n */\n\n /**\n * Edits the emoji.\n * @param {EmojiEditData} data The new data for the emoji\n * @param {string} [reason] Reason for editing this emoji\n * @returns {Promise}\n * @example\n * // Edit an emoji\n * emoji.edit({name: 'newemoji'})\n * .then(e => console.log(`Edited emoji ${e}`))\n * .catch(console.error);\n */\n edit(data, reason) {\n return this.client.rest.methods.updateEmoji(this, data, reason);\n }\n\n /**\n * Set the name of the emoji.\n * @param {string} name The new name for the emoji\n * @param {string} [reason] The reason for changing the emoji's name\n * @returns {Promise}\n */\n setName(name, reason) {\n return this.edit({ name }, reason);\n }\n\n /**\n * Fetches the author for this emoji\n * @returns {Promise}\n */\n fetchAuthor() {\n if (this.managed) return Promise.reject(new Error('Emoji is managed and has no Author.'));\n if (!this.guild.me.permissions.has(Permissions.FLAGS.MANAGE_EMOJIS)) {\n return Promise.reject(\n new Error(`Client must have Manage Emoji permission in guild ${this.guild} to see emoji authors.`)\n );\n }\n return this.client.rest.makeRequest('get', Constants.Endpoints.Guild(this.guild).Emoji(this.id), true)\n .then(emoji => this.client.dataManager.newUser(emoji.user));\n }\n\n /**\n * Add a role to the list of roles that can use this emoji.\n * @param {Role} role The role to add\n * @returns {Promise}\n */\n addRestrictedRole(role) {\n return this.addRestrictedRoles([role]);\n }\n\n /**\n * Add multiple roles to the list of roles that can use this emoji.\n * @param {Role[]} roles Roles to add\n * @returns {Promise}\n */\n addRestrictedRoles(roles) {\n const newRoles = new Collection(this.roles);\n for (const role of roles) {\n if (this.guild.roles.has(role.id)) newRoles.set(role.id, role);\n }\n return this.edit({ roles: newRoles });\n }\n\n /**\n * Remove a role from the list of roles that can use this emoji.\n * @param {Role} role The role to remove\n * @returns {Promise}\n */\n removeRestrictedRole(role) {\n return this.removeRestrictedRoles([role]);\n }\n\n /**\n * Remove multiple roles from the list of roles that can use this emoji.\n * @param {Role[]} roles Roles to remove\n * @returns {Promise}\n */\n removeRestrictedRoles(roles) {\n const newRoles = new Collection(this.roles);\n for (const role of roles) {\n if (newRoles.has(role.id)) newRoles.delete(role.id);\n }\n return this.edit({ roles: newRoles });\n }\n\n\n /**\n * Deletes the emoji.\n * @param {string} [reason] Reason for deleting the emoji\n * @returns {Promise}\n */\n delete(reason) {\n return this.client.rest.methods.deleteEmoji(this, reason);\n }\n\n /**\n * When concatenated with a string, this automatically returns the emoji mention rather than the object.\n * @returns {string}\n * @example\n * // Send an emoji:\n * const emoji = guild.emojis.first();\n * msg.reply(`Hello! ${emoji}`);\n */\n toString() {\n if (!this.id || !this.requiresColons) {\n return this.name;\n }\n\n return `<${this.animated ? 'a' : ''}:${this.name}:${this.id}>`;\n }\n\n /**\n * Whether this emoji is the same as another one.\n * @param {Emoji|Object} other The emoji to compare it to\n * @returns {boolean} Whether the emoji is equal to the given emoji or not\n */\n equals(other) {\n if (other instanceof Emoji) {\n return (\n other.id === this.id &&\n other.name === this.name &&\n other.managed === this.managed &&\n other.requiresColons === this.requiresColons\n );\n } else {\n return (\n other.id === this.id &&\n other.name === this.name\n );\n }\n }\n}\n\nmodule.exports = Emoji;\n\n\n//# sourceURL=webpack:///./src/structures/Emoji.js?"); /***/ }), @@ -1541,7 +1614,7 @@ eval("const Channel = __webpack_require__(/*! ./Channel */ \"./src/structures/Ch /*! ModuleConcatenation bailout: Module is not an ECMAScript module */ /***/ (function(module, exports, __webpack_require__) { -eval("const util = __webpack_require__(/*! util */ \"./node_modules/util/util.js\");\nconst Long = __webpack_require__(/*! long */ \"./node_modules/long/src/long.js\");\nconst User = __webpack_require__(/*! ./User */ \"./src/structures/User.js\");\nconst Role = __webpack_require__(/*! ./Role */ \"./src/structures/Role.js\");\nconst Emoji = __webpack_require__(/*! ./Emoji */ \"./src/structures/Emoji.js\");\nconst Presence = __webpack_require__(/*! ./Presence */ \"./src/structures/Presence.js\").Presence;\nconst GuildMember = __webpack_require__(/*! ./GuildMember */ \"./src/structures/GuildMember.js\");\nconst Constants = __webpack_require__(/*! ../util/Constants */ \"./src/util/Constants.js\");\nconst Collection = __webpack_require__(/*! ../util/Collection */ \"./src/util/Collection.js\");\nconst Util = __webpack_require__(/*! ../util/Util */ \"./src/util/Util.js\");\nconst Snowflake = __webpack_require__(/*! ../util/Snowflake */ \"./src/util/Snowflake.js\");\n\n/**\n * Represents a guild (or a server) on Discord.\n * It's recommended to see if a guild is available before performing operations or reading data from it. You can\n * check this with `guild.available`.\n */\nclass Guild {\n constructor(client, data) {\n /**\n * The client that created the instance of the guild\n * @name Guild#client\n * @type {Client}\n * @readonly\n */\n Object.defineProperty(this, 'client', { value: client });\n\n /**\n * A collection of members that are in this guild. The key is the member's ID, the value is the member\n * @type {Collection}\n */\n this.members = new Collection();\n\n /**\n * A collection of channels that are in this guild. The key is the channel's ID, the value is the channel\n * @type {Collection}\n */\n this.channels = new Collection();\n\n /**\n * A collection of roles that are in this guild. The key is the role's ID, the value is the role\n * @type {Collection}\n */\n this.roles = new Collection();\n\n /**\n * A collection of presences in this guild\n * @type {Collection}\n */\n this.presences = new Collection();\n\n /**\n * Whether the bot has been removed from the guild\n * @type {boolean}\n */\n this.deleted = false;\n\n if (!data) return;\n if (data.unavailable) {\n /**\n * Whether the guild is available to access. If it is not available, it indicates a server outage\n * @type {boolean}\n */\n this.available = false;\n\n /**\n * The Unique ID of the guild, useful for comparisons\n * @type {Snowflake}\n */\n this.id = data.id;\n } else {\n this.setup(data);\n if (!data.channels) this.available = false;\n }\n }\n\n /* eslint-disable complexity */\n /**\n * Sets up the guild.\n * @param {*} data The raw data of the guild\n * @private\n */\n setup(data) {\n /**\n * The name of the guild\n * @type {string}\n */\n this.name = data.name;\n\n /**\n * The hash of the guild icon\n * @type {?string}\n */\n this.icon = data.icon;\n\n /**\n * The hash of the guild splash image (VIP only)\n * @type {?string}\n */\n this.splash = data.splash;\n\n /**\n * The region the guild is located in\n * @type {string}\n */\n this.region = data.region;\n\n /**\n * The full amount of members in this guild\n * @type {number}\n */\n this.memberCount = data.member_count || this.memberCount;\n\n /**\n * Whether the guild is \"large\" (has more than 250 members)\n * @type {boolean}\n */\n this.large = Boolean('large' in data ? data.large : this.large);\n\n /**\n * An array of guild features\n * @type {Object[]}\n */\n this.features = data.features;\n\n /**\n * The ID of the application that created this guild (if applicable)\n * @type {?Snowflake}\n */\n this.applicationID = data.application_id;\n\n /**\n * The time in seconds before a user is counted as \"away from keyboard\"\n * @type {?number}\n */\n this.afkTimeout = data.afk_timeout;\n\n /**\n * The ID of the voice channel where AFK members are moved\n * @type {?string}\n */\n this.afkChannelID = data.afk_channel_id;\n\n /**\n * The ID of the system channel\n * @type {?Snowflake}\n */\n this.systemChannelID = data.system_channel_id;\n\n /**\n * Whether embedded images are enabled on this guild\n * @type {boolean}\n */\n this.embedEnabled = data.embed_enabled;\n\n /**\n * The verification level of the guild\n * @type {number}\n */\n this.verificationLevel = data.verification_level;\n\n /**\n * The explicit content filter level of the guild\n * @type {number}\n */\n this.explicitContentFilter = data.explicit_content_filter;\n\n /**\n * The required MFA level for the guild\n * @type {number}\n */\n this.mfaLevel = data.mfa_level;\n\n /**\n * The timestamp the client user joined the guild at\n * @type {number}\n */\n this.joinedTimestamp = data.joined_at ? new Date(data.joined_at).getTime() : this.joinedTimestamp;\n\n /**\n * The value set for a guild's default message notifications\n * @type {DefaultMessageNotifications|number}\n */\n this.defaultMessageNotifications = Constants.DefaultMessageNotifications[data.default_message_notifications] ||\n data.default_message_notifications;\n\n this.id = data.id;\n this.available = !data.unavailable;\n this.features = data.features || this.features || [];\n\n if (data.members) {\n this.members.clear();\n for (const guildUser of data.members) this._addMember(guildUser, false);\n }\n\n if (data.owner_id) {\n /**\n * The user ID of this guild's owner\n * @type {Snowflake}\n */\n this.ownerID = data.owner_id;\n }\n\n if (data.channels) {\n this.channels.clear();\n for (const channel of data.channels) this.client.dataManager.newChannel(channel, this);\n }\n\n if (data.roles) {\n this.roles.clear();\n for (const role of data.roles) {\n const newRole = new Role(this, role);\n this.roles.set(newRole.id, newRole);\n }\n }\n\n if (data.presences) {\n for (const presence of data.presences) {\n this._setPresence(presence.user.id, presence);\n }\n }\n\n this._rawVoiceStates = new Collection();\n if (data.voice_states) {\n for (const voiceState of data.voice_states) {\n this._rawVoiceStates.set(voiceState.user_id, voiceState);\n const member = this.members.get(voiceState.user_id);\n const voiceChannel = this.channels.get(voiceState.channel_id);\n if (member && voiceChannel) {\n member.serverMute = voiceState.mute;\n member.serverDeaf = voiceState.deaf;\n member.selfMute = voiceState.self_mute;\n member.selfDeaf = voiceState.self_deaf;\n member.voiceSessionID = voiceState.session_id;\n member.voiceChannelID = voiceState.channel_id;\n voiceChannel.members.set(member.user.id, member);\n }\n }\n }\n\n if (!this.emojis) {\n /**\n * A collection of emojis that are in this guild\n * The key is the emoji's ID, the value is the emoji\n * @type {Collection}\n */\n this.emojis = new Collection();\n for (const emoji of data.emojis) this.emojis.set(emoji.id, new Emoji(this, emoji));\n } else {\n this.client.actions.GuildEmojisUpdate.handle({\n guild_id: this.id,\n emojis: data.emojis,\n });\n }\n }\n\n /**\n * The timestamp the guild was created at\n * @type {number}\n * @readonly\n */\n get createdTimestamp() {\n return Snowflake.deconstruct(this.id).timestamp;\n }\n\n /**\n * The time the guild was created\n * @type {Date}\n * @readonly\n */\n get createdAt() {\n return new Date(this.createdTimestamp);\n }\n\n /**\n * The time the client user joined the guild\n * @type {Date}\n * @readonly\n */\n get joinedAt() {\n return new Date(this.joinedTimestamp);\n }\n\n /**\n * If this guild is verified\n * @type {boolean}\n * @readonly\n */\n get verified() {\n return this.features.includes('VERIFIED');\n }\n\n /**\n * The URL to this guild's icon\n * @type {?string}\n * @readonly\n */\n get iconURL() {\n if (!this.icon) return null;\n return Constants.Endpoints.Guild(this).Icon(this.client.options.http.cdn, this.icon);\n }\n\n /**\n * The acronym that shows up in place of a guild icon.\n * @type {string}\n * @readonly\n */\n get nameAcronym() {\n return this.name.replace(/\\w+/g, name => name[0]).replace(/\\s/g, '');\n }\n\n /**\n * The URL to this guild's splash\n * @type {?string}\n * @readonly\n */\n get splashURL() {\n if (!this.splash) return null;\n return Constants.Endpoints.Guild(this).Splash(this.client.options.http.cdn, this.splash);\n }\n\n /**\n * The owner of the guild\n * @type {?GuildMember}\n * @readonly\n */\n get owner() {\n return this.members.get(this.ownerID);\n }\n\n /**\n * AFK voice channel for this guild\n * @type {?VoiceChannel}\n * @readonly\n */\n get afkChannel() {\n return this.client.channels.get(this.afkChannelID) || null;\n }\n\n /**\n * System channel for this guild\n * @type {?GuildChannel}\n * @readonly\n */\n get systemChannel() {\n return this.client.channels.get(this.systemChannelID) || null;\n }\n\n /**\n * If the client is connected to any voice channel in this guild, this will be the relevant VoiceConnection\n * @type {?VoiceConnection}\n * @readonly\n */\n get voiceConnection() {\n if (this.client.browser) return null;\n return this.client.voice.connections.get(this.id) || null;\n }\n\n /**\n * The position of this guild\n * This is only available when using a user account.\n * @type {?number}\n * @readonly\n * @deprecated\n */\n get position() {\n if (this.client.user.bot) return null;\n if (!this.client.user.settings.guildPositions) return null;\n return this.client.user.settings.guildPositions.indexOf(this.id);\n }\n\n /**\n * Whether the guild is muted\n * This is only available when using a user account.\n * @type {?boolean}\n * @readonly\n * @deprecated\n */\n get muted() {\n if (this.client.user.bot) return null;\n try {\n return this.client.user.guildSettings.get(this.id).muted;\n } catch (err) {\n return false;\n }\n }\n\n /**\n * The type of message that should notify you\n * This is only available when using a user account.\n * @type {?MessageNotificationType}\n * @readonly\n * @deprecated\n */\n get messageNotifications() {\n if (this.client.user.bot) return null;\n try {\n return this.client.user.guildSettings.get(this.id).messageNotifications;\n } catch (err) {\n return null;\n }\n }\n\n /**\n * Whether to receive mobile push notifications\n * This is only available when using a user account.\n * @type {?boolean}\n * @readonly\n * @deprecated\n */\n get mobilePush() {\n if (this.client.user.bot) return null;\n try {\n return this.client.user.guildSettings.get(this.id).mobilePush;\n } catch (err) {\n return false;\n }\n }\n\n /**\n * Whether to suppress everyone messages\n * This is only available when using a user account.\n * @type {?boolean}\n * @readonly\n * @deprecated\n */\n get suppressEveryone() {\n if (this.client.user.bot) return null;\n try {\n return this.client.user.guildSettings.get(this.id).suppressEveryone;\n } catch (err) {\n return null;\n }\n }\n\n /**\n * The `@everyone` role of the guild\n * @type {Role}\n * @readonly\n */\n get defaultRole() {\n return this.roles.get(this.id);\n }\n\n /**\n * The client user as a GuildMember of this guild\n * @type {?GuildMember}\n * @readonly\n */\n get me() {\n return this.members.get(this.client.user.id);\n }\n\n /**\n * Fetches a collection of roles in the current guild sorted by position\n * @type {Collection}\n * @readonly\n * @private\n */\n get _sortedRoles() {\n return this._sortPositionWithID(this.roles);\n }\n\n /**\n * Returns the GuildMember form of a User object, if the user is present in the guild.\n * @param {UserResolvable} user The user that you want to obtain the GuildMember of\n * @returns {?GuildMember}\n * @example\n * // Get the guild member of a user\n * const member = guild.member(message.author);\n */\n member(user) {\n return this.client.resolver.resolveGuildMember(this, user);\n }\n\n /**\n * An object containing information about a guild member's ban.\n * @typedef {Object} BanInfo\n * @property {User} user User that was banned\n * @property {?string} reason Reason the user was banned\n */\n\n /**\n * Fetch a ban for a user.\n * @returns {Promise}\n * @param {UserResolvable} user The user to fetch the ban for\n * @example\n * // Get ban\n * guild.fetchBan(message.author)\n * .then(({ user, reason }) => console.log(`${user.tag} was banned for the reason: ${reason}.`))\n * .catch(console.error);\n */\n fetchBan(user) {\n return this.client.rest.methods.getGuildBan(this, user);\n }\n\n /**\n * Fetch a collection of banned users in this guild.\n * @returns {Promise>}\n * @param {boolean} [withReasons=false] Whether or not to include the ban reason(s)\n * @example\n * // Fetch bans in guild\n * guild.fetchBans()\n * .then(bans => console.log(`This guild has ${bans.size} bans`))\n * .catch(console.error);\n */\n fetchBans(withReasons = false) {\n if (withReasons) return this.client.rest.methods.getGuildBans(this);\n return this.client.rest.methods.getGuildBans(this)\n .then(bans => {\n const users = new Collection();\n for (const ban of bans.values()) users.set(ban.user.id, ban.user);\n return users;\n });\n }\n\n /**\n * Fetch a collection of invites to this guild.\n * Resolves with a collection mapping invites by their codes.\n * @returns {Promise>}\n * @example\n * // Fetch invites\n * guild.fetchInvites()\n * .then(invites => console.log(`Fetched ${invites.size} invites`))\n * .catch(console.error);\n * @example\n * // Fetch invite creator by their id\n * guild.fetchInvites()\n * .then(invites => console.log(invites.find(invite => invite.inviter.id === '84484653687267328')))\n * .catch(console.error);\n */\n fetchInvites() {\n return this.client.rest.methods.getGuildInvites(this);\n }\n\n /**\n * Fetches the vanity url invite code to this guild.\n * Resolves with a string matching the vanity url invite code, not the full url.\n * @returns {Promise}\n * @example\n * // Fetch invites\n * guild.fetchVanityCode()\n * .then(code => {\n * console.log(`Vanity URL: https://discord.gg/${code}`);\n * })\n * .catch(console.error);\n */\n fetchVanityCode() {\n if (!this.features.includes('VANITY_URL')) {\n return Promise.reject(new Error('This guild does not have the VANITY_URL feature enabled.'));\n }\n return this.client.rest.methods.getGuildVanityCode(this);\n }\n\n\n /**\n * Fetch all webhooks for the guild.\n * @returns {Promise>}\n * @example\n * // Fetch webhooks\n * guild.fetchWebhooks()\n * .then(webhooks => console.log(`Fetched ${webhooks.size} webhooks`))\n * .catch(console.error);\n */\n fetchWebhooks() {\n return this.client.rest.methods.getGuildWebhooks(this);\n }\n\n /**\n * Fetch available voice regions.\n * @returns {Promise>}\n * @example\n * // Fetch voice regions\n * guild.fetchVoiceRegions()\n * .then(console.log)\n * .catch(console.error);\n */\n fetchVoiceRegions() {\n return this.client.rest.methods.fetchVoiceRegions(this.id);\n }\n\n /**\n * The Guild Embed object\n * @typedef {Object} GuildEmbedData\n * @property {boolean} enabled Whether the embed is enabled\n * @property {?ChannelResolvable} channel The embed channel\n */\n\n /**\n * Fetches the guild embed.\n * @returns {Promise}\n * @example\n * // Fetches the guild embed\n * guild.fetchEmbed()\n * .then(embed => console.log(`The embed is ${embed.enabled ? 'enabled' : 'disabled'}`))\n * .catch(console.error);\n */\n fetchEmbed() {\n return this.client.rest.methods.fetchEmbed(this.id);\n }\n\n /**\n * Fetch audit logs for this guild.\n * @param {Object} [options={}] Options for fetching audit logs\n * @param {Snowflake|GuildAuditLogsEntry} [options.before] Limit to entries from before specified entry\n * @param {Snowflake|GuildAuditLogsEntry} [options.after] Limit to entries from after specified entry\n * @param {number} [options.limit] Limit number of entries\n * @param {UserResolvable} [options.user] Only show entries involving this user\n * @param {AuditLogAction} [options.type] Only show entries involving this action type\n * @returns {Promise}\n * @example\n * // Output audit log entries\n * guild.fetchAuditLogs()\n * .then(audit => console.log(audit.entries.first()))\n * .catch(console.error);\n */\n fetchAuditLogs(options) {\n return this.client.rest.methods.getGuildAuditLogs(this, options);\n }\n\n /**\n * Adds a user to the guild using OAuth2. Requires the `CREATE_INSTANT_INVITE` permission.\n * @param {UserResolvable} user User to add to the guild\n * @param {Object} options Options for the addition\n * @param {string} options.accessToken An OAuth2 access token for the user with the `guilds.join` scope granted to the\n * bot's application\n * @param {string} [options.nick] Nickname to give the member (requires `MANAGE_NICKNAMES`)\n * @param {Collection|Role[]|Snowflake[]} [options.roles] Roles to add to the member\n * (requires `MANAGE_ROLES`)\n * @param {boolean} [options.mute] Whether the member should be muted (requires `MUTE_MEMBERS`)\n * @param {boolean} [options.deaf] Whether the member should be deafened (requires `DEAFEN_MEMBERS`)\n * @returns {Promise}\n */\n addMember(user, options) {\n user = this.client.resolver.resolveUserID(user);\n if (this.members.has(user)) return Promise.resolve(this.members.get(user));\n return this.client.rest.methods.putGuildMember(this, user, options);\n }\n\n /**\n * Fetch a single guild member from a user.\n * @param {UserResolvable} user The user to fetch the member for\n * @param {boolean} [cache=true] Insert the member into the members cache\n * @returns {Promise}\n * @example\n * // Fetch a guild member\n * guild.fetchMember(message.author)\n * .then(console.log)\n * .catch(console.error);\n */\n fetchMember(user, cache = true) {\n user = this.client.resolver.resolveUser(user);\n if (!user) return Promise.reject(new Error('Invalid or uncached id provided.'));\n const member = this.members.get(user.id);\n if (member && member.joinedTimestamp) return Promise.resolve(member);\n return this.client.rest.methods.getGuildMember(this, user, cache);\n }\n\n /**\n * Fetches all the members in the guild, even if they are offline. If the guild has less than 250 members,\n * this should not be necessary.\n * @param {string} [query=''] Limit fetch to members with similar usernames\n * @param {number} [limit=0] Maximum number of members to request\n * @returns {Promise}\n * @example\n * // Fetch guild members\n * guild.fetchMembers()\n * .then(console.log)\n * .catch(console.error);\n * @example\n * // Fetches a maximum of 1 member with the given query\n * guild.fetchMembers('hydrabolt', 1)\n * .then(console.log)\n * .catch(console.error);\n */\n fetchMembers(query = '', limit = 0) {\n return new Promise((resolve, reject) => {\n if (this.memberCount === this.members.size) {\n resolve(this);\n return;\n }\n this.client.ws.send({\n op: Constants.OPCodes.REQUEST_GUILD_MEMBERS,\n d: {\n guild_id: this.id,\n query,\n limit,\n },\n });\n const handler = (members, guild) => {\n if (guild.id !== this.id) return;\n if (this.memberCount === this.members.size || members.length < 1000) {\n this.client.removeListener(Constants.Events.GUILD_MEMBERS_CHUNK, handler);\n resolve(this);\n }\n };\n this.client.on(Constants.Events.GUILD_MEMBERS_CHUNK, handler);\n this.client.setTimeout(() => reject(new Error('Members didn\\'t arrive in time.')), 120 * 1000);\n });\n }\n\n /**\n * Performs a search within the entire guild.\n * This is only available when using a user account.\n * @param {MessageSearchOptions} [options={}] Options to pass to the search\n * @returns {Promise}\n * @deprecated\n * @example\n * guild.search({\n * content: 'discord.js',\n * before: '2016-11-17'\n * })\n * .then(res => {\n * const hit = res.messages[0].find(m => m.hit).content;\n * console.log(`I found: **${hit}**, total results: ${res.totalResults}`);\n * })\n * .catch(console.error);\n */\n search(options = {}) {\n return this.client.rest.methods.search(this, options);\n }\n\n /**\n * The data for editing a guild.\n * @typedef {Object} GuildEditData\n * @property {string} [name] The name of the guild\n * @property {string} [region] The region of the guild\n * @property {number} [verificationLevel] The verification level of the guild\n * @property {number} [explicitContentFilter] The level of the explicit content filter\n * @property {ChannelResolvable} [afkChannel] The AFK channel of the guild\n * @property {ChannelResolvable} [systemChannel] The system channel of the guild\n * @property {number} [afkTimeout] The AFK timeout of the guild\n * @property {Base64Resolvable} [icon] The icon of the guild\n * @property {GuildMemberResolvable} [owner] The owner of the guild\n * @property {Base64Resolvable} [splash] The splash screen of the guild\n */\n\n /**\n * Updates the guild with new information - e.g. a new name.\n * @param {GuildEditData} data The data to update the guild with\n * @param {string} [reason] Reason for editing the guild\n * @returns {Promise}\n * @example\n * // Set the guild name and region\n * guild.edit({\n * name: 'Discord Guild',\n * region: 'london',\n * })\n * .then(g => console.log(`Changed guild name to ${g} and region to ${g.region}`))\n * .catch(console.error);\n */\n edit(data, reason) {\n const _data = {};\n if (data.name) _data.name = data.name;\n if (data.region) _data.region = data.region;\n if (typeof data.verificationLevel !== 'undefined') _data.verification_level = Number(data.verificationLevel);\n if (typeof data.afkChannel !== 'undefined') {\n _data.afk_channel_id = this.client.resolver.resolveChannelID(data.afkChannel);\n }\n if (typeof data.systemChannel !== 'undefined') {\n _data.system_channel_id = this.client.resolver.resolveChannelID(data.systemChannel);\n }\n if (data.afkTimeout) _data.afk_timeout = Number(data.afkTimeout);\n if (typeof data.icon !== 'undefined') _data.icon = data.icon;\n if (data.owner) _data.owner_id = this.client.resolver.resolveUser(data.owner).id;\n if (typeof data.splash !== 'undefined') _data.splash = data.splash;\n if (typeof data.explicitContentFilter !== 'undefined') {\n _data.explicit_content_filter = Number(data.explicitContentFilter);\n }\n if (typeof data.defaultMessageNotifications !== 'undefined') {\n _data.default_message_notifications = typeof data.defaultMessageNotifications === 'string' ?\n Constants.DefaultMessageNotifications.indexOf(data.defaultMessageNotifications) :\n Number(data.defaultMessageNotifications);\n }\n return this.client.rest.methods.updateGuild(this, _data, reason);\n }\n\n /**\n * Edit the level of the explicit content filter.\n * @param {number} explicitContentFilter The new level of the explicit content filter\n * @param {string} [reason] Reason for changing the level of the guild's explicit content filter\n * @returns {Promise}\n */\n setExplicitContentFilter(explicitContentFilter, reason) {\n return this.edit({ explicitContentFilter }, reason);\n }\n\n /**\n * Edits the setting of the default message notifications of the guild.\n * @param {DefaultMessageNotifications|number} defaultMessageNotifications\n * The new setting for the default message notifications\n * @param {string} [reason] Reason for changing the setting of the default message notifications\n * @returns {Promise}\n */\n setDefaultMessageNotifications(defaultMessageNotifications, reason) {\n return this.edit({ defaultMessageNotifications }, reason);\n }\n\n /**\n * Edit the name of the guild.\n * @param {string} name The new name of the guild\n * @param {string} [reason] Reason for changing the guild's name\n * @returns {Promise}\n * @example\n * // Edit the guild name\n * guild.setName('Discord Guild')\n * .then(g => console.log(`Updated guild name to ${g}`))\n * .catch(console.error);\n */\n setName(name, reason) {\n return this.edit({ name }, reason);\n }\n\n /**\n * Edit the region of the guild.\n * @param {string} region The new region of the guild\n * @param {string} [reason] Reason for changing the guild's region\n * @returns {Promise}\n * @example\n * // Edit the guild region\n * guild.setRegion('london')\n * .then(g => console.log(`Updated guild region to ${g.region}`))\n * .catch(console.error);\n */\n setRegion(region, reason) {\n return this.edit({ region }, reason);\n }\n\n /**\n * Edit the verification level of the guild.\n * @param {number} verificationLevel The new verification level of the guild\n * @param {string} [reason] Reason for changing the guild's verification level\n * @returns {Promise}\n * @example\n * // Edit the guild verification level\n * guild.setVerificationLevel(1)\n * .then(g => console.log(`Updated guild verification level to ${g.verificationLevel}`))\n * .catch(console.error);\n */\n setVerificationLevel(verificationLevel, reason) {\n return this.edit({ verificationLevel }, reason);\n }\n\n /**\n * Edit the AFK channel of the guild.\n * @param {ChannelResolvable} afkChannel The new AFK channel\n * @param {string} [reason] Reason for changing the guild's AFK channel\n * @returns {Promise}\n * @example\n * // Edit the guild AFK channel\n * guild.setAFKChannel(channel)\n * .then(g => console.log(`Updated guild AFK channel to ${g.afkChannel.name}`))\n * .catch(console.error);\n */\n setAFKChannel(afkChannel, reason) {\n return this.edit({ afkChannel }, reason);\n }\n\n /**\n * Edit the system channel of the guild.\n * @param {ChannelResolvable} systemChannel The new system channel\n * @param {string} [reason] Reason for changing the guild's system channel\n * @returns {Promise}\n */\n setSystemChannel(systemChannel, reason) {\n return this.edit({ systemChannel }, reason);\n }\n\n /**\n * Edit the AFK timeout of the guild.\n * @param {number} afkTimeout The time in seconds that a user must be idle to be considered AFK\n * @param {string} [reason] Reason for changing the guild's AFK timeout\n * @returns {Promise}\n * @example\n * // Edit the guild AFK channel\n * guild.setAFKTimeout(60)\n * .then(g => console.log(`Updated guild AFK timeout to ${g.afkTimeout}`))\n * .catch(console.error);\n */\n setAFKTimeout(afkTimeout, reason) {\n return this.edit({ afkTimeout }, reason);\n }\n\n /**\n * Set a new guild icon.\n * @param {Base64Resolvable|BufferResolvable} icon The new icon of the guild\n * @param {string} [reason] Reason for changing the guild's icon\n * @returns {Promise}\n * @example\n * // Edit the guild icon\n * guild.setIcon('./icon.png')\n * .then(console.log)\n * .catch(console.error);\n */\n setIcon(icon, reason) {\n return this.client.resolver.resolveImage(icon).then(data => this.edit({ icon: data, reason }));\n }\n\n /**\n * Sets a new owner of the guild.\n * @param {GuildMemberResolvable} owner The new owner of the guild\n * @param {string} [reason] Reason for setting the new owner\n * @returns {Promise}\n * @example\n * // Edit the guild owner\n * guild.setOwner(guild.members.first())\n * .then(g => console.log(`Updated the guild owner to ${g.owner.displayName}`))\n * .catch(console.error);\n */\n setOwner(owner, reason) {\n return this.edit({ owner }, reason);\n }\n\n /**\n * Set a new guild splash screen.\n * @param {BufferResolvable|Base64Resolvable} splash The new splash screen of the guild\n * @param {string} [reason] Reason for changing the guild's splash screen\n * @returns {Promise}\n * @example\n * // Edit the guild splash\n * guild.setSplash('./splash.png')\n * .then(console.log)\n * .catch(console.error);\n */\n setSplash(splash) {\n return this.client.resolver.resolveImage(splash).then(data => this.edit({ splash: data }));\n }\n\n /**\n * Sets the position of the guild in the guild listing.\n * This is only available when using a user account.\n * @param {number} position Absolute or relative position\n * @param {boolean} [relative=false] Whether to position relatively or absolutely\n * @returns {Promise}\n * @deprecated\n */\n setPosition(position, relative) {\n if (this.client.user.bot) {\n return Promise.reject(new Error('Setting guild position is only available for user accounts'));\n }\n return this.client.user.settings.setGuildPosition(this, position, relative);\n }\n\n /**\n * Marks all messages in this guild as read.\n * This is only available when using a user account.\n * @returns {Promise}\n * @deprecated\n */\n acknowledge() {\n return this.client.rest.methods.ackGuild(this);\n }\n\n /**\n * Allow direct messages from guild members.\n * This is only available when using a user account.\n * @param {boolean} allow Whether to allow direct messages\n * @returns {Promise}\n * @deprecated\n */\n allowDMs(allow) {\n const settings = this.client.user.settings;\n if (allow) return settings.removeRestrictedGuild(this);\n else return settings.addRestrictedGuild(this);\n }\n\n /**\n * Bans a user from the guild.\n * @param {UserResolvable} user The user to ban\n * @param {Object|number|string} [options] Ban options. If a number, the number of days to delete messages for, if a\n * string, the ban reason. Supplying an object allows you to do both.\n * @param {number} [options.days=0] Number of days of messages to delete\n * @param {string} [options.reason] Reason for banning\n * @returns {Promise} Result object will be resolved as specifically as possible.\n * If the GuildMember cannot be resolved, the User will instead be attempted to be resolved. If that also cannot\n * be resolved, the user ID will be the result.\n * @example\n * // Ban a user by ID\n * guild.ban('some user ID')\n * .then(user => console.log(`Banned ${user.username || user.id || user} from ${guild}`))\n * .catch(console.error);\n * @example\n * // Ban a user by object with reason and days\n * guild.ban(user, { days: 7, reason: 'He needed to go' })\n * .then(console.log)\n * .catch(console.error);\n */\n ban(user, options = {}) {\n if (typeof options === 'number') {\n options = { reason: null, 'delete-message-days': options };\n } else if (typeof options === 'string') {\n options = { reason: options, 'delete-message-days': 0 };\n }\n if (options.days) options['delete-message-days'] = options.days;\n return this.client.rest.methods.banGuildMember(this, user, options);\n }\n\n /**\n * Unbans a user from the guild.\n * @param {UserResolvable} user The user to unban\n * @param {string} [reason] Reason for unbanning the user\n * @returns {Promise}\n * @example\n * // Unban a user by ID (or with a user/guild member object)\n * guild.unban('some user ID')\n * .then(user => console.log(`Unbanned ${user.username} from ${guild}`))\n * .catch(console.error);\n */\n unban(user, reason) {\n return this.client.rest.methods.unbanGuildMember(this, user, reason);\n }\n\n /**\n * Prunes members from the guild based on how long they have been inactive.\n * @param {number} days Number of days of inactivity required to kick\n * @param {boolean} [dry=false] If true, will return number of users that will be kicked, without actually doing it\n * @param {string} [reason] Reason for this prune\n * @returns {Promise} The number of members that were/will be kicked\n * @example\n * // See how many members will be pruned\n * guild.pruneMembers(12, true)\n * .then(pruned => console.log(`This will prune ${pruned} people!`))\n * .catch(console.error);\n * @example\n * // Actually prune the members\n * guild.pruneMembers(12)\n * .then(pruned => console.log(`I just pruned ${pruned} people!`))\n * .catch(console.error);\n */\n pruneMembers(days, dry = false, reason) {\n if (typeof days !== 'number') throw new TypeError('Days must be a number.');\n return this.client.rest.methods.pruneGuildMembers(this, days, dry, reason);\n }\n\n /**\n * Syncs this guild (already done automatically every 30 seconds).\n * This is only available when using a user account.\n * @deprecated\n */\n sync() {\n if (!this.client.user.bot) this.client.syncGuilds([this]);\n }\n\n /**\n * Overwrites to use when creating a channel or replacing overwrites\n * @typedef {Object} ChannelCreationOverwrites\n * @property {PermissionResolvable} [allow] The permissions to allow\n * @property {PermissionResolvable} [allowed] The permissions to allow\n * **(deprecated)**\n * @property {PermissionResolvable} [deny] The permissions to deny\n * @property {PermissionResolvable} [denied] The permissions to deny\n * **(deprecated)**\n * @property {GuildMemberResolvable|RoleResolvable} id Member or role this overwrite is for\n */\n\n /**\n * Creates a new channel in the guild.\n * @param {string} name The name of the new channel\n * @param {string|ChannelData} [typeOrOptions='text']\n * The type of the new channel, one of `text`, `voice`, `category`, `news`, or `store`. **(deprecated, use options)**\n * Alternatively options for the new channel, overriding the following parameters.\n * @param {ChannelCreationOverwrites[]|Collection} [permissionOverwrites]\n * Permission overwrites **(deprecated, use options)**\n * @param {string} [reason] Reason for creating this channel **(deprecated, use options)**\n * @returns {Promise}\n * @example\n * // Create a new text channel\n * guild.createChannel('new-general', { type: 'text' })\n * .then(console.log)\n * .catch(console.error);\n * @example\n * // Create a new category channel with permission overwrites\n * guild.createChannel('new-category', {\n * type: 'category',\n * permissionOverwrites: [{\n * id: guild.id,\n * deny: ['MANAGE_MESSAGES'],\n * allow: ['SEND_MESSAGES']\n * }]\n * })\n * .then(console.log)\n * .catch(console.error);\n */\n createChannel(name, typeOrOptions, permissionOverwrites, reason) {\n if (!typeOrOptions || (typeof typeOrOptions === 'string')) {\n if (typeOrOptions) {\n ((any, ...more) => console.warn(any, more))(\n 'Guild#createChannel: Create channels with an options object instead of separate parameters',\n 'DeprecationWarning'\n );\n }\n typeOrOptions = {\n type: typeOrOptions,\n permissionOverwrites,\n reason,\n };\n }\n return this.client.rest.methods.createChannel(this, name, typeOrOptions);\n }\n\n /**\n * The data needed for updating a channel's position.\n * @typedef {Object} ChannelPosition\n * @property {ChannelResolvable} channel Channel to update\n * @property {number} position New position for the channel\n */\n\n /**\n * Batch-updates the guild's channels' positions.\n * @param {ChannelPosition[]} channelPositions Channel positions to update\n * @returns {Promise}\n * @example\n * guild.updateChannels([{ channel: channelID, position: newChannelIndex }])\n * .then(g => console.log(`Updated channel positions for ${g}`))\n * .catch(console.error);\n */\n setChannelPositions(channelPositions) {\n return this.client.rest.methods.updateChannelPositions(this.id, channelPositions);\n }\n\n /**\n * Edits the guild's embed.\n * @param {GuildEmbedData} embed The embed for the guild\n * @param {string} [reason] Reason for changing the guild's embed\n * @returns {Promise}\n */\n setEmbed(embed, reason) {\n return this.client.rest.methods.updateEmbed(this.id, embed, reason)\n .then(() => this);\n }\n\n /**\n * Creates a new role in the guild with given information.\n * @param {RoleData} [data] The data to update the role with\n * @param {string} [reason] Reason for creating this role\n * @returns {Promise}\n * @example\n * // Create a new role\n * guild.createRole()\n * .then(role => console.log(`Created new role with name ${role.name}`))\n * .catch(console.error);\n * @example\n * // Create a new role with data\n * guild.createRole({\n * name: 'Super Cool People',\n * color: 'BLUE',\n * })\n * .then(role => console.log(`Created new role with name ${role.name} and color ${role.color}`))\n * .catch(console.error)\n */\n createRole(data = {}, reason) {\n return this.client.rest.methods.createGuildRole(this, data, reason);\n }\n\n /**\n * Creates a new custom emoji in the guild.\n * @param {BufferResolvable|Base64Resolvable} attachment The image for the emoji\n * @param {string} name The name for the emoji\n * @param {Collection|Role[]} [roles] Roles to limit the emoji to\n * @param {string} [reason] Reason for creating the emoji\n * @returns {Promise} The created emoji\n * @example\n * // Create a new emoji from a url\n * guild.createEmoji('https://i.imgur.com/w3duR07.png', 'rip')\n * .then(emoji => console.log(`Created new emoji with name ${emoji.name}`))\n * .catch(console.error);\n * @example\n * // Create a new emoji from a file on your computer\n * guild.createEmoji('./memes/banana.png', 'banana')\n * .then(emoji => console.log(`Created new emoji with name ${emoji.name}`))\n * .catch(console.error);\n */\n createEmoji(attachment, name, roles, reason) {\n if (typeof attachment === 'string' && attachment.startsWith('data:')) {\n return this.client.rest.methods.createEmoji(this, attachment, name, roles, reason);\n } else {\n return this.client.resolver.resolveImage(attachment).then(data =>\n this.client.rest.methods.createEmoji(this, data, name, roles, reason)\n );\n }\n }\n\n /**\n * Delete an emoji.\n * @param {Emoji|string} emoji The emoji to delete\n * @param {string} [reason] Reason for deleting the emoji\n * @returns {Promise}\n */\n deleteEmoji(emoji, reason) {\n if (typeof emoji === 'string') emoji = this.emojis.get(emoji);\n if (!(emoji instanceof Emoji)) throw new TypeError('Emoji must be either an instance of Emoji or an ID');\n return this.client.rest.methods.deleteEmoji(emoji, reason);\n }\n\n /**\n * Causes the client to leave the guild.\n * @returns {Promise}\n * @example\n * // Leave a guild\n * guild.leave()\n * .then(g => console.log(`Left the guild ${g}`))\n * .catch(console.error);\n */\n leave() {\n return this.client.rest.methods.leaveGuild(this);\n }\n\n /**\n * Causes the client to delete the guild.\n * @returns {Promise}\n * @example\n * // Delete a guild\n * guild.delete()\n * .then(g => console.log(`Deleted the guild ${g}`))\n * .catch(console.error);\n */\n delete() {\n return this.client.rest.methods.deleteGuild(this);\n }\n\n /**\n * Whether this guild equals another guild. It compares all properties, so for most operations\n * it is advisable to just compare `guild.id === guild2.id` as it is much faster and is often\n * what most users need.\n * @param {Guild} guild The guild to compare with\n * @returns {boolean}\n */\n equals(guild) {\n let equal =\n guild &&\n this.id === guild.id &&\n this.available === !guild.unavailable &&\n this.splash === guild.splash &&\n this.region === guild.region &&\n this.name === guild.name &&\n this.memberCount === guild.member_count &&\n this.large === guild.large &&\n this.icon === guild.icon &&\n Util.arraysEqual(this.features, guild.features) &&\n this.ownerID === guild.owner_id &&\n this.verificationLevel === guild.verification_level &&\n this.embedEnabled === guild.embed_enabled;\n\n if (equal) {\n if (this.embedChannel) {\n if (this.embedChannel.id !== guild.embed_channel_id) equal = false;\n } else if (guild.embed_channel_id) {\n equal = false;\n }\n }\n\n return equal;\n }\n\n /**\n * When concatenated with a string, this automatically concatenates the guild's name instead of the guild object.\n * @returns {string}\n * @example\n * // Logs: Hello from My Guild!\n * console.log(`Hello from ${guild}!`);\n * @example\n * // Logs: Hello from My Guild!\n * console.log('Hello from ' + guild + '!');\n */\n toString() {\n return this.name;\n }\n\n _addMember(guildUser, emitEvent = true) {\n const existing = this.members.has(guildUser.user.id);\n if (!(guildUser.user instanceof User)) guildUser.user = this.client.dataManager.newUser(guildUser.user);\n\n guildUser.joined_at = guildUser.joined_at || 0;\n const member = new GuildMember(this, guildUser);\n this.members.set(member.id, member);\n\n if (this._rawVoiceStates && this._rawVoiceStates.has(member.user.id)) {\n const voiceState = this._rawVoiceStates.get(member.user.id);\n member.serverMute = voiceState.mute;\n member.serverDeaf = voiceState.deaf;\n member.selfMute = voiceState.self_mute;\n member.selfDeaf = voiceState.self_deaf;\n member.voiceSessionID = voiceState.session_id;\n member.voiceChannelID = voiceState.channel_id;\n if (this.client.channels.has(voiceState.channel_id)) {\n this.client.channels.get(voiceState.channel_id).members.set(member.user.id, member);\n } else {\n this.client.emit('warn', `Member ${member.id} added in guild ${this.id} with an uncached voice channel`);\n }\n }\n\n /**\n * Emitted whenever a user joins a guild.\n * @event Client#guildMemberAdd\n * @param {GuildMember} member The member that has joined a guild\n */\n if (this.client.ws.connection.status === Constants.Status.READY && emitEvent && !existing) {\n this.client.emit(Constants.Events.GUILD_MEMBER_ADD, member);\n }\n\n return member;\n }\n\n _updateMember(member, data) {\n const oldMember = Util.cloneObject(member);\n\n if (data.roles) member._roles = data.roles;\n if (typeof data.nick !== 'undefined') member.nickname = data.nick;\n\n const notSame = member.nickname !== oldMember.nickname || !Util.arraysEqual(member._roles, oldMember._roles);\n\n if (this.client.ws.connection.status === Constants.Status.READY && notSame) {\n /**\n * Emitted whenever a guild member changes - i.e. new role, removed role, nickname.\n * @event Client#guildMemberUpdate\n * @param {GuildMember} oldMember The member before the update\n * @param {GuildMember} newMember The member after the update\n */\n this.client.emit(Constants.Events.GUILD_MEMBER_UPDATE, oldMember, member);\n }\n\n return {\n old: oldMember,\n mem: member,\n };\n }\n\n _removeMember(guildMember) {\n if (guildMember.voiceChannel) guildMember.voiceChannel.members.delete(guildMember.id);\n this.members.delete(guildMember.id);\n }\n\n _memberSpeakUpdate(user, speaking) {\n const member = this.members.get(user);\n if (member && member.speaking !== speaking) {\n member.speaking = speaking;\n /**\n * Emitted once a guild member starts/stops speaking.\n * @event Client#guildMemberSpeaking\n * @param {GuildMember} member The member that started/stopped speaking\n * @param {boolean} speaking Whether or not the member is speaking\n */\n this.client.emit(Constants.Events.GUILD_MEMBER_SPEAKING, member, speaking);\n }\n }\n\n _setPresence(id, presence) {\n if (this.presences.get(id)) {\n this.presences.get(id).update(presence);\n return;\n }\n this.presences.set(id, new Presence(presence, this.client));\n }\n\n /**\n * Set the position of a role in this guild.\n * @param {string|Role} role The role to edit, can be a role object or a role ID\n * @param {number} position The new position of the role\n * @param {boolean} [relative=false] Position Moves the role relative to its current position\n * @returns {Promise}\n */\n setRolePosition(role, position, relative = false) {\n if (typeof role === 'string') {\n role = this.roles.get(role);\n if (!role) return Promise.reject(new Error('Supplied role is not a role or snowflake.'));\n }\n\n position = Number(position);\n if (isNaN(position)) return Promise.reject(new Error('Supplied position is not a number.'));\n\n let updatedRoles = this._sortedRoles.array();\n\n Util.moveElementInArray(updatedRoles, role, position, relative);\n\n updatedRoles = updatedRoles.map((r, i) => ({ id: r.id, position: i }));\n return this.client.rest.methods.setRolePositions(this.id, updatedRoles);\n }\n\n /**\n * Set the position of a channel in this guild.\n * @param {string|GuildChannel} channel The channel to edit, can be a channel object or a channel ID\n * @param {number} position The new position of the channel\n * @param {boolean} [relative=false] Position Moves the channel relative to its current position\n * @returns {Promise}\n */\n setChannelPosition(channel, position, relative = false) {\n if (typeof channel === 'string') {\n channel = this.channels.get(channel);\n if (!channel) return Promise.reject(new Error('Supplied channel is not a channel or snowflake.'));\n }\n\n position = Number(position);\n if (isNaN(position)) return Promise.reject(new Error('Supplied position is not a number.'));\n\n let updatedChannels = this._sortedChannels(channel.type).array();\n\n Util.moveElementInArray(updatedChannels, channel, position, relative);\n\n updatedChannels = updatedChannels.map((r, i) => ({ id: r.id, position: i }));\n return this.client.rest.methods.setChannelPositions(this.id, updatedChannels);\n }\n\n /**\n * Fetches a collection of channels in the current guild sorted by position.\n * @param {string} type The channel type\n * @returns {Collection}\n * @private\n */\n _sortedChannels(type) {\n return this._sortPositionWithID(this.channels.filter(c => {\n if (type === 'voice' && c.type === 'voice') return true;\n else if (type !== 'voice' && c.type !== 'voice') return true;\n else return type === c.type;\n }));\n }\n\n /**\n * Sorts a collection by object position or ID if the positions are equivalent.\n * Intended to be identical to Discord's sorting method.\n * @param {Collection} collection The collection to sort\n * @returns {Collection}\n * @private\n */\n _sortPositionWithID(collection) {\n return collection.sort((a, b) =>\n a.position !== b.position ?\n a.position - b.position :\n Long.fromString(b.id).sub(Long.fromString(a.id)).toNumber()\n );\n }\n}\n\n/**\n * The `#general` TextChannel of the guild\n * @name Guild#defaultChannel\n * @type {TextChannel}\n * @readonly\n * @deprecated\n */\nObject.defineProperty(Guild.prototype, 'defaultChannel', {\n get: util.deprecate(function defaultChannel() {\n return this.channels.get(this.id);\n }, 'Guild#defaultChannel: This property is obsolete, will be removed in v12.0.0, and may not function as expected.'),\n});\n\nGuild.prototype.allowDMs =\n util.deprecate(Guild.prototype.allowDMs, 'Guild#allowDMs: userbot methods will be removed');\n\nGuild.prototype.acknowledge =\n util.deprecate(Guild.prototype.acknowledge, 'Guild#acknowledge: userbot methods will be removed');\n\nGuild.prototype.setPosition =\n util.deprecate(Guild.prototype.setPosition, 'Guild#setPosition: userbot methods will be removed');\n\nGuild.prototype.search =\n util.deprecate(Guild.prototype.search, 'Guild#search: userbot methods will be removed');\n\nGuild.prototype.sync =\n util.deprecate(Guild.prototype.sync, 'Guild#sync:, userbot methods will be removed');\n\nmodule.exports = Guild;\n\n\n//# sourceURL=webpack:///./src/structures/Guild.js?"); +eval("const util = __webpack_require__(/*! util */ \"./node_modules/util/util.js\");\nconst Long = __webpack_require__(/*! long */ \"./node_modules/long/src/long.js\");\nconst User = __webpack_require__(/*! ./User */ \"./src/structures/User.js\");\nconst Role = __webpack_require__(/*! ./Role */ \"./src/structures/Role.js\");\nconst Emoji = __webpack_require__(/*! ./Emoji */ \"./src/structures/Emoji.js\");\nconst Presence = __webpack_require__(/*! ./Presence */ \"./src/structures/Presence.js\").Presence;\nconst GuildMember = __webpack_require__(/*! ./GuildMember */ \"./src/structures/GuildMember.js\");\nconst Integration = __webpack_require__(/*! ./Integration */ \"./src/structures/Integration.js\");\nconst Constants = __webpack_require__(/*! ../util/Constants */ \"./src/util/Constants.js\");\nconst Collection = __webpack_require__(/*! ../util/Collection */ \"./src/util/Collection.js\");\nconst Util = __webpack_require__(/*! ../util/Util */ \"./src/util/Util.js\");\nconst Snowflake = __webpack_require__(/*! ../util/Snowflake */ \"./src/util/Snowflake.js\");\nconst SystemChannelFlags = __webpack_require__(/*! ../util/SystemChannelFlags */ \"./src/util/SystemChannelFlags.js\");\n\n/**\n * Represents a guild (or a server) on Discord.\n * It's recommended to see if a guild is available before performing operations or reading data from it. You can\n * check this with `guild.available`.\n */\nclass Guild {\n constructor(client, data) {\n /**\n * The client that created the instance of the guild\n * @name Guild#client\n * @type {Client}\n * @readonly\n */\n Object.defineProperty(this, 'client', { value: client });\n\n /**\n * A collection of members that are in this guild. The key is the member's ID, the value is the member\n * @type {Collection}\n */\n this.members = new Collection();\n\n /**\n * A collection of channels that are in this guild. The key is the channel's ID, the value is the channel\n * @type {Collection}\n */\n this.channels = new Collection();\n\n /**\n * A collection of roles that are in this guild. The key is the role's ID, the value is the role\n * @type {Collection}\n */\n this.roles = new Collection();\n\n /**\n * A collection of presences in this guild\n * @type {Collection}\n */\n this.presences = new Collection();\n\n /**\n * Whether the bot has been removed from the guild\n * @type {boolean}\n */\n this.deleted = false;\n\n if (!data) return;\n if (data.unavailable) {\n /**\n * Whether the guild is available to access. If it is not available, it indicates a server outage\n * @type {boolean}\n */\n this.available = false;\n\n /**\n * The Unique ID of the guild, useful for comparisons\n * @type {Snowflake}\n */\n this.id = data.id;\n } else {\n this.setup(data);\n if (!data.channels) this.available = false;\n }\n }\n\n /* eslint-disable complexity */\n /**\n * Sets up the guild.\n * @param {*} data The raw data of the guild\n * @private\n */\n setup(data) {\n /**\n * The name of the guild\n * @type {string}\n */\n this.name = data.name;\n\n /**\n * The hash of the guild icon\n * @type {?string}\n */\n this.icon = data.icon;\n\n /**\n * The hash of the guild splash image (VIP only)\n * @type {?string}\n */\n this.splash = data.splash;\n\n /**\n * The region the guild is located in\n * @type {string}\n */\n this.region = data.region;\n\n /**\n * The full amount of members in this guild\n * @type {number}\n */\n this.memberCount = data.member_count || this.memberCount;\n\n /**\n * Whether the guild is \"large\" (has more than 250 members)\n * @type {boolean}\n */\n this.large = Boolean('large' in data ? data.large : this.large);\n\n /**\n * An array of guild features\n * @type {Object[]}\n */\n this.features = data.features;\n\n /**\n * The ID of the application that created this guild (if applicable)\n * @type {?Snowflake}\n */\n this.applicationID = data.application_id;\n\n /**\n * The time in seconds before a user is counted as \"away from keyboard\"\n * @type {?number}\n */\n this.afkTimeout = data.afk_timeout;\n\n /**\n * The ID of the voice channel where AFK members are moved\n * @type {?string}\n */\n this.afkChannelID = data.afk_channel_id;\n\n /**\n * The ID of the system channel\n * @type {?Snowflake}\n */\n this.systemChannelID = data.system_channel_id;\n\n /**\n * Whether embedded images are enabled on this guild\n * @type {boolean}\n */\n this.embedEnabled = data.embed_enabled;\n\n /**\n * The verification level of the guild\n * @type {number}\n */\n this.verificationLevel = data.verification_level;\n\n /**\n * The explicit content filter level of the guild\n * @type {number}\n */\n this.explicitContentFilter = data.explicit_content_filter;\n\n /**\n * The required MFA level for the guild\n * @type {number}\n */\n this.mfaLevel = data.mfa_level;\n\n /**\n * The timestamp the client user joined the guild at\n * @type {number}\n */\n this.joinedTimestamp = data.joined_at ? new Date(data.joined_at).getTime() : this.joinedTimestamp;\n\n /**\n * The value set for a guild's default message notifications\n * @type {DefaultMessageNotifications|number}\n */\n this.defaultMessageNotifications = Constants.DefaultMessageNotifications[data.default_message_notifications] ||\n data.default_message_notifications;\n\n /**\n * The value for the guild's system channel flags\n * @type {Readonly}\n */\n this.systemChannelFlags = new SystemChannelFlags(data.system_channel_flags).freeze();\n\n /**\n * The type of premium tier:\n * * 0: NONE\n * * 1: TIER_1\n * * 2: TIER_2\n * * 3: TIER_3\n * @typedef {number} PremiumTier\n */\n\n /**\n * The premium tier on this guild\n * @type {PremiumTier}\n */\n this.premiumTier = data.premium_tier;\n\n /**\n * The total number of users currently boosting this server\n * @type {?number}\n * @name Guild#premiumSubscriptionCount\n */\n if (typeof data.premium_subscription_count !== 'undefined') {\n this.premiumSubscriptionCount = data.premium_subscription_count;\n }\n\n /**\n * The hash of the guild banner\n * @type {?string}\n */\n this.banner = data.banner;\n\n /**\n * The description of the guild, if any\n * @type {?string}\n */\n this.description = data.description;\n\n /**\n * The embed channel ID, if enabled\n * @type {?string}\n * @name Guild#embedChannelID\n */\n if (typeof data.embed_channel_id !== 'undefined') this.embedChannelID = data.embed_channel_id;\n\n /**\n * The maximum amount of members the guild can have\n * You will need to fetch the guild using {@link Guild#fetch} if you want to receive this parameter\n * @type {?number}\n * @name Guild#maximumMembers\n */\n if (typeof data.max_members !== 'undefined') this.maximumMembers = data.max_members || 250000;\n\n /**\n * The maximum amount of presences the guild can have\n * You will need to fetch the guild using {@link Guild#fetch} if you want to receive this parameter\n * @type {?number}\n * @name Guild#maximumPresences\n */\n if (typeof data.max_presences !== 'undefined') this.maximumPresences = data.max_presences || 5000;\n\n /**\n * Whether widget images are enabled on this guild\n * @type {?boolean}\n * @name Guild#widgetEnabled\n */\n if (typeof data.widget_enabled !== 'undefined') this.widgetEnabled = data.widget_enabled;\n\n /**\n * The widget channel ID, if enabled\n * @type {?string}\n * @name Guild#widgetChannelID\n */\n if (typeof data.widget_channel_id !== 'undefined') this.widgetChannelID = data.widget_channel_id;\n\n /**\n * The vanity URL code of the guild, if any\n * @type {?string}\n */\n this.vanityURLCode = data.vanity_url_code;\n\n this.id = data.id;\n this.available = !data.unavailable;\n this.features = data.features || this.features || [];\n\n /**\n * The ID of the rules channel for the guild\n * This is only available on guilds with the `PUBLIC` feature\n * @type {?Snowflake}\n */\n this.rulesChannelID = data.rules_channel_id;\n\n /**\n * The ID of the public updates channel for the guild\n * This is only available on guilds with the `PUBLIC` feature\n * @type {?Snowflake}\n */\n this.publicUpdatesChannelID = data.public_updates_channel_id;\n\n if (data.members) {\n this.members.clear();\n for (const guildUser of data.members) this._addMember(guildUser, false);\n }\n\n if (data.owner_id) {\n /**\n * The user ID of this guild's owner\n * @type {Snowflake}\n */\n this.ownerID = data.owner_id;\n }\n\n if (data.channels) {\n this.channels.clear();\n for (const channel of data.channels) this.client.dataManager.newChannel(channel, this);\n }\n\n if (data.roles) {\n this.roles.clear();\n for (const role of data.roles) {\n const newRole = new Role(this, role);\n this.roles.set(newRole.id, newRole);\n }\n }\n\n if (data.presences) {\n for (const presence of data.presences) {\n this._setPresence(presence.user.id, presence);\n }\n }\n\n this._rawVoiceStates = new Collection();\n if (data.voice_states) {\n for (const voiceState of data.voice_states) {\n this._rawVoiceStates.set(voiceState.user_id, voiceState);\n const member = this.members.get(voiceState.user_id);\n const voiceChannel = this.channels.get(voiceState.channel_id);\n if (member && voiceChannel) {\n member.serverMute = voiceState.mute;\n member.serverDeaf = voiceState.deaf;\n member.selfMute = voiceState.self_mute;\n member.selfDeaf = voiceState.self_deaf;\n member.selfStream = voiceState.self_stream || false;\n member.voiceSessionID = voiceState.session_id;\n member.voiceChannelID = voiceState.channel_id;\n voiceChannel.members.set(member.user.id, member);\n }\n }\n }\n\n if (!this.emojis) {\n /**\n * A collection of emojis that are in this guild\n * The key is the emoji's ID, the value is the emoji\n * @type {Collection}\n */\n this.emojis = new Collection();\n for (const emoji of data.emojis) this.emojis.set(emoji.id, new Emoji(this, emoji));\n } else {\n this.client.actions.GuildEmojisUpdate.handle({\n guild_id: this.id,\n emojis: data.emojis,\n });\n }\n }\n\n /**\n * The timestamp the guild was created at\n * @type {number}\n * @readonly\n */\n get createdTimestamp() {\n return Snowflake.deconstruct(this.id).timestamp;\n }\n\n /**\n * The time the guild was created\n * @type {Date}\n * @readonly\n */\n get createdAt() {\n return new Date(this.createdTimestamp);\n }\n\n /**\n * Embed channel for this guild\n * @type {?TextChannel}\n * @readonly\n */\n get embedChannel() {\n return this.channels.get(this.embedChannelID) || null;\n }\n\n /**\n * Widget channel for this guild\n * @type {?TextChannel}\n * @readonly\n */\n get widgetChannel() {\n return this.channels.get(this.widgetChannelID) || null;\n }\n\n /**\n * The time the client user joined the guild\n * @type {Date}\n * @readonly\n */\n get joinedAt() {\n return new Date(this.joinedTimestamp);\n }\n\n /**\n * If this guild is verified\n * @type {boolean}\n * @readonly\n */\n get verified() {\n return this.features.includes('VERIFIED');\n }\n\n /**\n * The URL to this guild's icon\n * @type {?string}\n * @readonly\n */\n get iconURL() {\n if (!this.icon) return null;\n return Constants.Endpoints.Guild(this).Icon(this.client.options.http.cdn, this.icon);\n }\n\n /**\n * The URL to this guild's banner.\n * @type {?string}\n * @readonly\n */\n get bannerURL() {\n if (!this.banner) return null;\n return Constants.Endpoints.Guild(this).Banner(this.client.options.http.cdn, this.banner);\n }\n\n /**\n * The acronym that shows up in place of a guild icon.\n * @type {string}\n * @readonly\n */\n get nameAcronym() {\n return this.name.replace(/\\w+/g, name => name[0]).replace(/\\s/g, '');\n }\n\n /**\n * The URL to this guild's splash\n * @type {?string}\n * @readonly\n */\n get splashURL() {\n if (!this.splash) return null;\n return Constants.Endpoints.Guild(this).Splash(this.client.options.http.cdn, this.splash);\n }\n\n /**\n * The owner of the guild\n * @type {?GuildMember}\n * @readonly\n */\n get owner() {\n return this.members.get(this.ownerID);\n }\n\n /**\n * AFK voice channel for this guild\n * @type {?VoiceChannel}\n * @readonly\n */\n get afkChannel() {\n return this.client.channels.get(this.afkChannelID) || null;\n }\n\n /**\n * System channel for this guild\n * @type {?GuildChannel}\n * @readonly\n */\n get systemChannel() {\n return this.client.channels.get(this.systemChannelID) || null;\n }\n\n /**\n * If the client is connected to any voice channel in this guild, this will be the relevant VoiceConnection\n * @type {?VoiceConnection}\n * @readonly\n */\n get voiceConnection() {\n if (this.client.browser) return null;\n return this.client.voice.connections.get(this.id) || null;\n }\n\n /**\n * The position of this guild\n * This is only available when using a user account.\n * @type {?number}\n * @readonly\n * @deprecated\n */\n get position() {\n if (this.client.user.bot) return null;\n if (!this.client.user.settings.guildPositions) return null;\n return this.client.user.settings.guildPositions.indexOf(this.id);\n }\n\n /**\n * Whether the guild is muted\n * This is only available when using a user account.\n * @type {?boolean}\n * @readonly\n * @deprecated\n */\n get muted() {\n if (this.client.user.bot) return null;\n try {\n return this.client.user.guildSettings.get(this.id).muted;\n } catch (err) {\n return false;\n }\n }\n\n /**\n * The type of message that should notify you\n * This is only available when using a user account.\n * @type {?MessageNotificationType}\n * @readonly\n * @deprecated\n */\n get messageNotifications() {\n if (this.client.user.bot) return null;\n try {\n return this.client.user.guildSettings.get(this.id).messageNotifications;\n } catch (err) {\n return null;\n }\n }\n\n /**\n * Whether to receive mobile push notifications\n * This is only available when using a user account.\n * @type {?boolean}\n * @readonly\n * @deprecated\n */\n get mobilePush() {\n if (this.client.user.bot) return null;\n try {\n return this.client.user.guildSettings.get(this.id).mobilePush;\n } catch (err) {\n return false;\n }\n }\n\n /**\n * Whether to suppress everyone messages\n * This is only available when using a user account.\n * @type {?boolean}\n * @readonly\n * @deprecated\n */\n get suppressEveryone() {\n if (this.client.user.bot) return null;\n try {\n return this.client.user.guildSettings.get(this.id).suppressEveryone;\n } catch (err) {\n return null;\n }\n }\n\n /**\n * The `@everyone` role of the guild\n * @type {Role}\n * @readonly\n */\n get defaultRole() {\n return this.roles.get(this.id);\n }\n\n /**\n * Rules channel for this guild\n * This is only available on guilds with the `PUBLIC` feature\n * @type {?TextChannel}\n * @readonly\n */\n get rulesChannel() {\n return this.client.channels.get(this.rulesChannelID) || null;\n }\n\n /**\n * Public updates channel for this guild\n * This is only available on guilds with the `PUBLIC` feature\n * @type {?TextChannel}\n * @readonly\n */\n get publicUpdatesChannel() {\n return this.client.channels.get(this.publicUpdatesChannelID) || null;\n }\n\n /**\n * The client user as a GuildMember of this guild\n * @type {?GuildMember}\n * @readonly\n */\n get me() {\n return this.members.get(this.client.user.id);\n }\n\n /**\n * Fetches a collection of roles in the current guild sorted by position\n * @type {Collection}\n * @readonly\n * @private\n */\n get _sortedRoles() {\n return this._sortPositionWithID(this.roles);\n }\n\n /**\n * Returns the GuildMember form of a User object, if the user is present in the guild.\n * @param {UserResolvable} user The user that you want to obtain the GuildMember of\n * @returns {?GuildMember}\n * @example\n * // Get the guild member of a user\n * const member = guild.member(message.author);\n */\n member(user) {\n return this.client.resolver.resolveGuildMember(this, user);\n }\n\n /**\n * Fetches this guild.\n * @returns {Promise}\n */\n fetch() {\n return this.client.rest.methods.getGuild(this).then(data => {\n this.setup(data);\n\n return this;\n });\n }\n\n /**\n * An object containing information about a guild member's ban.\n * @typedef {Object} BanInfo\n * @property {User} user User that was banned\n * @property {?string} reason Reason the user was banned\n */\n\n /**\n * Fetch a ban for a user.\n * @returns {Promise}\n * @param {UserResolvable} user The user to fetch the ban for\n * @example\n * // Get ban\n * guild.fetchBan(message.author)\n * .then(({ user, reason }) => console.log(`${user.tag} was banned for the reason: ${reason}.`))\n * .catch(console.error);\n */\n fetchBan(user) {\n return this.client.rest.methods.getGuildBan(this, user);\n }\n\n /**\n * Fetch a collection of banned users in this guild.\n * @returns {Promise>}\n * @param {boolean} [withReasons=false] Whether or not to include the ban reason(s)\n * @example\n * // Fetch bans in guild\n * guild.fetchBans()\n * .then(bans => console.log(`This guild has ${bans.size} bans`))\n * .catch(console.error);\n */\n fetchBans(withReasons = false) {\n if (withReasons) return this.client.rest.methods.getGuildBans(this);\n return this.client.rest.methods.getGuildBans(this)\n .then(bans => {\n const users = new Collection();\n for (const ban of bans.values()) users.set(ban.user.id, ban.user);\n return users;\n });\n }\n\n /**\n * Fetches a collection of integrations to this guild.\n * Resolves with a collection mapping integrations by their ids.\n * @returns {Promise>}\n * @example\n * // Fetch integrations\n * guild.fetchIntegrations()\n * .then(integrations => console.log(`Fetched ${integrations.size} integrations`))\n * .catch(console.error);\n */\n fetchIntegrations() {\n return this.client.rest.methods.getIntegrations(this).then(data =>\n data.reduce((collection, integration) =>\n collection.set(integration.id, new Integration(this.client, integration, this)),\n new Collection())\n );\n }\n\n /**\n * The data for creating an integration.\n * @typedef {Object} IntegrationData\n * @property {string} id The integration id\n * @property {string} type The integration type\n */\n\n /**\n * Creates an integration by attaching an integration object\n * @param {IntegrationData} data The data for thes integration\n * @param {string} reason Reason for creating the integration\n * @returns {Promise}\n */\n createIntegration(data, reason) {\n return this.client.rest.methods.createIntegration(this, data, reason)\n .then(() => this);\n }\n\n /**\n * Fetch a collection of invites to this guild.\n * Resolves with a collection mapping invites by their codes.\n * @returns {Promise>}\n * @example\n * // Fetch invites\n * guild.fetchInvites()\n * .then(invites => console.log(`Fetched ${invites.size} invites`))\n * .catch(console.error);\n * @example\n * // Fetch invite creator by their id\n * guild.fetchInvites()\n * .then(invites => console.log(invites.find(invite => invite.inviter.id === '84484653687267328')))\n * .catch(console.error);\n */\n fetchInvites() {\n return this.client.rest.methods.getGuildInvites(this);\n }\n\n /**\n * Fetches the vanity url invite code to this guild.\n * Resolves with a string matching the vanity url invite code, not the full url.\n * @returns {Promise}\n * @example\n * // Fetch invites\n * guild.fetchVanityCode()\n * .then(code => {\n * console.log(`Vanity URL: https://discord.gg/${code}`);\n * })\n * .catch(console.error);\n */\n fetchVanityCode() {\n if (!this.features.includes('VANITY_URL')) {\n return Promise.reject(new Error('This guild does not have the VANITY_URL feature enabled.'));\n }\n return this.client.rest.methods.getGuildVanityCode(this);\n }\n\n\n /**\n * Fetch all webhooks for the guild.\n * @returns {Promise>}\n * @example\n * // Fetch webhooks\n * guild.fetchWebhooks()\n * .then(webhooks => console.log(`Fetched ${webhooks.size} webhooks`))\n * .catch(console.error);\n */\n fetchWebhooks() {\n return this.client.rest.methods.getGuildWebhooks(this);\n }\n\n /**\n * Fetch available voice regions.\n * @returns {Promise>}\n * @example\n * // Fetch voice regions\n * guild.fetchVoiceRegions()\n * .then(console.log)\n * .catch(console.error);\n */\n fetchVoiceRegions() {\n return this.client.rest.methods.fetchVoiceRegions(this.id);\n }\n\n /**\n * The Guild Embed object\n * @typedef {Object} GuildEmbedData\n * @property {boolean} enabled Whether the embed is enabled\n * @property {?ChannelResolvable} channel The embed channel\n */\n\n /**\n * Fetches the guild embed.\n * @returns {Promise}\n * @example\n * // Fetches the guild embed\n * guild.fetchEmbed()\n * .then(embed => console.log(`The embed is ${embed.enabled ? 'enabled' : 'disabled'}`))\n * .catch(console.error);\n */\n fetchEmbed() {\n return this.client.rest.methods.fetchEmbed(this.id);\n }\n\n /**\n * Fetch audit logs for this guild.\n * @param {Object} [options={}] Options for fetching audit logs\n * @param {Snowflake|GuildAuditLogsEntry} [options.before] Limit to entries from before specified entry\n * @param {Snowflake|GuildAuditLogsEntry} [options.after] Limit to entries from after specified entry\n * @param {number} [options.limit] Limit number of entries\n * @param {UserResolvable} [options.user] Only show entries involving this user\n * @param {AuditLogAction} [options.type] Only show entries involving this action type\n * @returns {Promise}\n * @example\n * // Output audit log entries\n * guild.fetchAuditLogs()\n * .then(audit => console.log(audit.entries.first()))\n * .catch(console.error);\n */\n fetchAuditLogs(options) {\n return this.client.rest.methods.getGuildAuditLogs(this, options);\n }\n\n /**\n * Adds a user to the guild using OAuth2. Requires the `CREATE_INSTANT_INVITE` permission.\n * @param {UserResolvable} user User to add to the guild\n * @param {Object} options Options for the addition\n * @param {string} options.accessToken An OAuth2 access token for the user with the `guilds.join` scope granted to the\n * bot's application\n * @param {string} [options.nick] Nickname to give the member (requires `MANAGE_NICKNAMES`)\n * @param {Collection|Role[]|Snowflake[]} [options.roles] Roles to add to the member\n * (requires `MANAGE_ROLES`)\n * @param {boolean} [options.mute] Whether the member should be muted (requires `MUTE_MEMBERS`)\n * @param {boolean} [options.deaf] Whether the member should be deafened (requires `DEAFEN_MEMBERS`)\n * @returns {Promise}\n */\n addMember(user, options) {\n user = this.client.resolver.resolveUserID(user);\n if (this.members.has(user)) return Promise.resolve(this.members.get(user));\n return this.client.rest.methods.putGuildMember(this, user, options);\n }\n\n /**\n * Fetch a single guild member from a user.\n * @param {UserResolvable} user The user to fetch the member for\n * @param {boolean} [cache=true] Insert the member into the members cache\n * @returns {Promise}\n * @example\n * // Fetch a guild member\n * guild.fetchMember(message.author)\n * .then(console.log)\n * .catch(console.error);\n */\n fetchMember(user, cache = true) {\n const userID = this.client.resolver.resolveUserID(user);\n if (!userID) return Promise.reject(new Error('Invalid id provided.'));\n const member = this.members.get(userID);\n if (member && member.joinedTimestamp) return Promise.resolve(member);\n return this.client.rest.methods.getGuildMember(this, userID, cache);\n }\n\n /**\n * Fetches all the members in the guild, even if they are offline. If the guild has less than 250 members,\n * this should not be necessary.\n * @param {string} [query=''] Limit fetch to members with similar usernames\n * @param {number} [limit=0] Maximum number of members to request\n * @returns {Promise}\n * @example\n * // Fetch guild members\n * guild.fetchMembers()\n * .then(console.log)\n * .catch(console.error);\n * @example\n * // Fetches a maximum of 1 member with the given query\n * guild.fetchMembers('hydrabolt', 1)\n * .then(console.log)\n * .catch(console.error);\n */\n fetchMembers(query = '', limit = 0) {\n return new Promise((resolve, reject) => {\n if (this.memberCount === this.members.size) {\n resolve(this);\n return;\n }\n this.client.ws.send({\n op: Constants.OPCodes.REQUEST_GUILD_MEMBERS,\n d: {\n guild_id: this.id,\n query,\n limit,\n },\n });\n const handler = (members, guild) => {\n if (guild.id !== this.id) return;\n if (this.memberCount === this.members.size || members.length < 1000) {\n this.client.removeListener(Constants.Events.GUILD_MEMBERS_CHUNK, handler);\n resolve(this);\n }\n };\n this.client.on(Constants.Events.GUILD_MEMBERS_CHUNK, handler);\n this.client.setTimeout(() => reject(new Error('Members didn\\'t arrive in time.')), 120 * 1000);\n });\n }\n\n /**\n * Performs a search within the entire guild.\n * This is only available when using a user account.\n * @param {MessageSearchOptions} [options={}] Options to pass to the search\n * @returns {Promise}\n * @deprecated\n * @example\n * guild.search({\n * content: 'discord.js',\n * before: '2016-11-17'\n * })\n * .then(res => {\n * const hit = res.messages[0].find(m => m.hit).content;\n * console.log(`I found: **${hit}**, total results: ${res.totalResults}`);\n * })\n * .catch(console.error);\n */\n search(options = {}) {\n return this.client.rest.methods.search(this, options);\n }\n\n /**\n * The data for editing a guild.\n * @typedef {Object} GuildEditData\n * @property {string} [name] The name of the guild\n * @property {string} [region] The region of the guild\n * @property {number} [verificationLevel] The verification level of the guild\n * @property {number} [explicitContentFilter] The level of the explicit content filter\n * @property {ChannelResolvable} [afkChannel] The AFK channel of the guild\n * @property {ChannelResolvable} [systemChannel] The system channel of the guild\n * @property {number} [afkTimeout] The AFK timeout of the guild\n * @property {Base64Resolvable} [icon] The icon of the guild\n * @property {Base64Resolvable} [banner] The banner of the guild\n * @property {GuildMemberResolvable} [owner] The owner of the guild\n * @property {Base64Resolvable} [splash] The splash screen of the guild\n * @property {SystemChannelFlagsResolvable} [systemChannelFlags] The system channel flags of the guild\n */\n\n /**\n * Updates the guild with new information - e.g. a new name.\n * @param {GuildEditData} data The data to update the guild with\n * @param {string} [reason] Reason for editing the guild\n * @returns {Promise}\n * @example\n * // Set the guild name and region\n * guild.edit({\n * name: 'Discord Guild',\n * region: 'london',\n * })\n * .then(g => console.log(`Changed guild name to ${g} and region to ${g.region}`))\n * .catch(console.error);\n */\n edit(data, reason) {\n const _data = {};\n if (data.name) _data.name = data.name;\n if (data.region) _data.region = data.region;\n if (typeof data.verificationLevel !== 'undefined') _data.verification_level = Number(data.verificationLevel);\n if (typeof data.afkChannel !== 'undefined') {\n _data.afk_channel_id = this.client.resolver.resolveChannelID(data.afkChannel);\n }\n if (typeof data.systemChannel !== 'undefined') {\n _data.system_channel_id = this.client.resolver.resolveChannelID(data.systemChannel);\n }\n if (data.afkTimeout) _data.afk_timeout = Number(data.afkTimeout);\n if (typeof data.icon !== 'undefined') _data.icon = data.icon;\n if (data.owner) _data.owner_id = this.client.resolver.resolveUser(data.owner).id;\n if (typeof data.splash !== 'undefined') _data.splash = data.splash;\n if (typeof data.banner !== 'undefined') _data.banner = data.banner;\n if (typeof data.explicitContentFilter !== 'undefined') {\n _data.explicit_content_filter = Number(data.explicitContentFilter);\n }\n if (typeof data.defaultMessageNotifications !== 'undefined') {\n _data.default_message_notifications = typeof data.defaultMessageNotifications === 'string' ?\n Constants.DefaultMessageNotifications.indexOf(data.defaultMessageNotifications) :\n Number(data.defaultMessageNotifications);\n }\n if (typeof data.systemChannelFlags !== 'undefined') {\n _data.system_channel_flags = SystemChannelFlags.resolve(data.systemChannelFlags);\n }\n return this.client.rest.methods.updateGuild(this, _data, reason);\n }\n\n /**\n * Sets a new guild banner.\n * @param {BufferResolvable|Base64Resolvable} banner The new banner of the guild\n * @param {string} [reason] Reason for changing the guild's banner\n * @returns {Guild}\n */\n setBanner(banner, reason) {\n return this.client.resolver.resolveImage(banner).then(data => this.edit({ banner: data }, reason));\n }\n\n /**\n * Edit the level of the explicit content filter.\n * @param {number} explicitContentFilter The new level of the explicit content filter\n * @param {string} [reason] Reason for changing the level of the guild's explicit content filter\n * @returns {Promise}\n */\n setExplicitContentFilter(explicitContentFilter, reason) {\n return this.edit({ explicitContentFilter }, reason);\n }\n\n /**\n * Edits the setting of the default message notifications of the guild.\n * @param {DefaultMessageNotifications|number} defaultMessageNotifications\n * The new setting for the default message notifications\n * @param {string} [reason] Reason for changing the setting of the default message notifications\n * @returns {Promise}\n */\n setDefaultMessageNotifications(defaultMessageNotifications, reason) {\n return this.edit({ defaultMessageNotifications }, reason);\n }\n\n /**\n * Edits the flags of the default message notifications of the guild.\n * @param {SystemChannelFlagsResolvable} systemChannelFlags The new flags for the default message notifications\n * @param {string} [reason] Reason for changing the flags of the default message notifications\n * @returns {Promise}\n */\n setSystemChannelFlags(systemChannelFlags, reason) {\n return this.edit({ systemChannelFlags }, reason);\n }\n\n /**\n * Edit the name of the guild.\n * @param {string} name The new name of the guild\n * @param {string} [reason] Reason for changing the guild's name\n * @returns {Promise}\n * @example\n * // Edit the guild name\n * guild.setName('Discord Guild')\n * .then(g => console.log(`Updated guild name to ${g}`))\n * .catch(console.error);\n */\n setName(name, reason) {\n return this.edit({ name }, reason);\n }\n\n /**\n * Edit the region of the guild.\n * @param {string} region The new region of the guild\n * @param {string} [reason] Reason for changing the guild's region\n * @returns {Promise}\n * @example\n * // Edit the guild region\n * guild.setRegion('london')\n * .then(g => console.log(`Updated guild region to ${g.region}`))\n * .catch(console.error);\n */\n setRegion(region, reason) {\n return this.edit({ region }, reason);\n }\n\n /**\n * Edit the verification level of the guild.\n * @param {number} verificationLevel The new verification level of the guild\n * @param {string} [reason] Reason for changing the guild's verification level\n * @returns {Promise}\n * @example\n * // Edit the guild verification level\n * guild.setVerificationLevel(1)\n * .then(g => console.log(`Updated guild verification level to ${g.verificationLevel}`))\n * .catch(console.error);\n */\n setVerificationLevel(verificationLevel, reason) {\n return this.edit({ verificationLevel }, reason);\n }\n\n /**\n * Edit the AFK channel of the guild.\n * @param {ChannelResolvable} afkChannel The new AFK channel\n * @param {string} [reason] Reason for changing the guild's AFK channel\n * @returns {Promise}\n * @example\n * // Edit the guild AFK channel\n * guild.setAFKChannel(channel)\n * .then(g => console.log(`Updated guild AFK channel to ${g.afkChannel.name}`))\n * .catch(console.error);\n */\n setAFKChannel(afkChannel, reason) {\n return this.edit({ afkChannel }, reason);\n }\n\n /**\n * Edit the system channel of the guild.\n * @param {ChannelResolvable} systemChannel The new system channel\n * @param {string} [reason] Reason for changing the guild's system channel\n * @returns {Promise}\n */\n setSystemChannel(systemChannel, reason) {\n return this.edit({ systemChannel }, reason);\n }\n\n /**\n * Edit the AFK timeout of the guild.\n * @param {number} afkTimeout The time in seconds that a user must be idle to be considered AFK\n * @param {string} [reason] Reason for changing the guild's AFK timeout\n * @returns {Promise}\n * @example\n * // Edit the guild AFK channel\n * guild.setAFKTimeout(60)\n * .then(g => console.log(`Updated guild AFK timeout to ${g.afkTimeout}`))\n * .catch(console.error);\n */\n setAFKTimeout(afkTimeout, reason) {\n return this.edit({ afkTimeout }, reason);\n }\n\n /**\n * Set a new guild icon.\n * @param {Base64Resolvable|BufferResolvable} icon The new icon of the guild\n * @param {string} [reason] Reason for changing the guild's icon\n * @returns {Promise}\n * @example\n * // Edit the guild icon\n * guild.setIcon('./icon.png')\n * .then(console.log)\n * .catch(console.error);\n */\n setIcon(icon, reason) {\n return this.client.resolver.resolveImage(icon).then(data => this.edit({ icon: data, reason }));\n }\n\n /**\n * Sets a new owner of the guild.\n * @param {GuildMemberResolvable} owner The new owner of the guild\n * @param {string} [reason] Reason for setting the new owner\n * @returns {Promise}\n * @example\n * // Edit the guild owner\n * guild.setOwner(guild.members.first())\n * .then(g => console.log(`Updated the guild owner to ${g.owner.displayName}`))\n * .catch(console.error);\n */\n setOwner(owner, reason) {\n return this.edit({ owner }, reason);\n }\n\n /**\n * Set a new guild splash screen.\n * @param {BufferResolvable|Base64Resolvable} splash The new splash screen of the guild\n * @param {string} [reason] Reason for changing the guild's splash screen\n * @returns {Promise}\n * @example\n * // Edit the guild splash\n * guild.setSplash('./splash.png')\n * .then(console.log)\n * .catch(console.error);\n */\n setSplash(splash) {\n return this.client.resolver.resolveImage(splash).then(data => this.edit({ splash: data }));\n }\n\n /**\n * Sets the position of the guild in the guild listing.\n * This is only available when using a user account.\n * @param {number} position Absolute or relative position\n * @param {boolean} [relative=false] Whether to position relatively or absolutely\n * @returns {Promise}\n * @deprecated\n */\n setPosition(position, relative) {\n if (this.client.user.bot) {\n return Promise.reject(new Error('Setting guild position is only available for user accounts'));\n }\n return this.client.user.settings.setGuildPosition(this, position, relative);\n }\n\n /**\n * Marks all messages in this guild as read.\n * This is only available when using a user account.\n * @returns {Promise}\n * @deprecated\n */\n acknowledge() {\n return this.client.rest.methods.ackGuild(this);\n }\n\n /**\n * Allow direct messages from guild members.\n * This is only available when using a user account.\n * @param {boolean} allow Whether to allow direct messages\n * @returns {Promise}\n * @deprecated\n */\n allowDMs(allow) {\n const settings = this.client.user.settings;\n if (allow) return settings.removeRestrictedGuild(this);\n else return settings.addRestrictedGuild(this);\n }\n\n /**\n * Bans a user from the guild.\n * @param {UserResolvable} user The user to ban\n * @param {Object|number|string} [options] Ban options. If a number, the number of days to delete messages for, if a\n * string, the ban reason. Supplying an object allows you to do both.\n * @param {number} [options.days=0] Number of days of messages to delete\n * @param {string} [options.reason] Reason for banning\n * @returns {Promise} Result object will be resolved as specifically as possible.\n * If the GuildMember cannot be resolved, the User will instead be attempted to be resolved. If that also cannot\n * be resolved, the user ID will be the result.\n * @example\n * // Ban a user by ID\n * guild.ban('some user ID')\n * .then(user => console.log(`Banned ${user.username || user.id || user} from ${guild}`))\n * .catch(console.error);\n * @example\n * // Ban a user by object with reason and days\n * guild.ban(user, { days: 7, reason: 'He needed to go' })\n * .then(console.log)\n * .catch(console.error);\n */\n ban(user, options = {}) {\n if (typeof options === 'number') {\n options = { reason: null, 'delete-message-days': options };\n } else if (typeof options === 'string') {\n options = { reason: options, 'delete-message-days': 0 };\n }\n if (options.days) options['delete-message-days'] = options.days;\n return this.client.rest.methods.banGuildMember(this, user, options);\n }\n\n /**\n * Unbans a user from the guild.\n * @param {UserResolvable} user The user to unban\n * @param {string} [reason] Reason for unbanning the user\n * @returns {Promise}\n * @example\n * // Unban a user by ID (or with a user/guild member object)\n * guild.unban('some user ID')\n * .then(user => console.log(`Unbanned ${user.username} from ${guild}`))\n * .catch(console.error);\n */\n unban(user, reason) {\n return this.client.rest.methods.unbanGuildMember(this, user, reason);\n }\n\n /**\n * Prunes members from the guild based on how long they have been inactive.\n * @param {number} days Number of days of inactivity required to kick\n * @param {boolean} [dry=false] If true, will return number of users that will be kicked, without actually doing it\n * @param {string} [reason] Reason for this prune\n * @returns {Promise} The number of members that were/will be kicked\n * @example\n * // See how many members will be pruned\n * guild.pruneMembers(12, true)\n * .then(pruned => console.log(`This will prune ${pruned} people!`))\n * .catch(console.error);\n * @example\n * // Actually prune the members\n * guild.pruneMembers(12)\n * .then(pruned => console.log(`I just pruned ${pruned} people!`))\n * .catch(console.error);\n */\n pruneMembers(days, dry = false, reason) {\n if (typeof days !== 'number') throw new TypeError('Days must be a number.');\n return this.client.rest.methods.pruneGuildMembers(this, days, dry, reason);\n }\n\n /**\n * Syncs this guild (already done automatically every 30 seconds).\n * This is only available when using a user account.\n * @deprecated\n */\n sync() {\n if (!this.client.user.bot) this.client.syncGuilds([this]);\n }\n\n /**\n * Overwrites to use when creating a channel or replacing overwrites\n * @typedef {Object} ChannelCreationOverwrites\n * @property {PermissionResolvable} [allow] The permissions to allow\n * @property {PermissionResolvable} [allowed] The permissions to allow\n * **(deprecated)**\n * @property {PermissionResolvable} [deny] The permissions to deny\n * @property {PermissionResolvable} [denied] The permissions to deny\n * **(deprecated)**\n * @property {GuildMemberResolvable|RoleResolvable} id Member or role this overwrite is for\n */\n\n /**\n * Creates a new channel in the guild.\n * @param {string} name The name of the new channel\n * @param {string|ChannelData} [typeOrOptions='text']\n * The type of the new channel, one of `text`, `voice`, `category`, `news`, or `store`. **(deprecated, use options)**\n * Alternatively options for the new channel, overriding the following parameters.\n * @param {ChannelCreationOverwrites[]|Collection} [permissionOverwrites]\n * Permission overwrites **(deprecated, use options)**\n * @param {string} [reason] Reason for creating this channel **(deprecated, use options)**\n * @returns {Promise}\n * @example\n * // Create a new text channel\n * guild.createChannel('new-general', { type: 'text' })\n * .then(console.log)\n * .catch(console.error);\n * @example\n * // Create a new category channel with permission overwrites\n * guild.createChannel('new-category', {\n * type: 'category',\n * permissionOverwrites: [{\n * id: guild.id,\n * deny: ['MANAGE_MESSAGES'],\n * allow: ['SEND_MESSAGES']\n * }]\n * })\n * .then(console.log)\n * .catch(console.error);\n */\n createChannel(name, typeOrOptions, permissionOverwrites, reason) {\n if (!typeOrOptions || (typeof typeOrOptions === 'string')) {\n if (typeOrOptions) {\n ((any, ...more) => console.warn(any, more))(\n 'Guild#createChannel: Create channels with an options object instead of separate parameters',\n 'DeprecationWarning'\n );\n }\n typeOrOptions = {\n type: typeOrOptions,\n permissionOverwrites,\n reason,\n };\n }\n return this.client.rest.methods.createChannel(this, name, typeOrOptions);\n }\n\n /**\n * The data needed for updating a channel's position.\n * @typedef {Object} ChannelPosition\n * @property {ChannelResolvable} channel Channel to update\n * @property {number} position New position for the channel\n */\n\n /**\n * Batch-updates the guild's channels' positions.\n * @param {ChannelPosition[]} channelPositions Channel positions to update\n * @returns {Promise}\n * @example\n * guild.updateChannels([{ channel: channelID, position: newChannelIndex }])\n * .then(g => console.log(`Updated channel positions for ${g}`))\n * .catch(console.error);\n */\n setChannelPositions(channelPositions) {\n channelPositions = channelPositions.map(({ channel, position }) => ({ id: channel.id || channel, position }));\n return this.client.rest.methods.setChannelPositions(this.id, channelPositions);\n }\n\n /**\n * The data needed for updating a role's position.\n * @typedef {Object} RolePosition\n * @property {RoleResolvable} role Role to update\n * @property {number} position New position for the role\n */\n\n /**\n * Batch-updates the guild's role's positions.\n * @param {RolePosition[]} rolePositions Role positions to update\n * @returns {Promise}\n */\n setRolePositions(rolePositions) {\n rolePositions = rolePositions.map(({ role, position }) => ({ id: role.id || role, position }));\n return this.client.rest.methods.setRolePositions(this.id, rolePositions);\n }\n\n /**\n * Edits the guild's embed.\n * @param {GuildEmbedData} embed The embed for the guild\n * @param {string} [reason] Reason for changing the guild's embed\n * @returns {Promise}\n */\n setEmbed(embed, reason) {\n return this.client.rest.methods.updateEmbed(this.id, embed, reason)\n .then(() => this);\n }\n\n /**\n * Creates a new role in the guild with given information.\n * @param {RoleData} [data] The data to update the role with\n * @param {string} [reason] Reason for creating this role\n * @returns {Promise}\n * @example\n * // Create a new role\n * guild.createRole()\n * .then(role => console.log(`Created new role with name ${role.name}`))\n * .catch(console.error);\n * @example\n * // Create a new role with data\n * guild.createRole({\n * name: 'Super Cool People',\n * color: 'BLUE',\n * })\n * .then(role => console.log(`Created new role with name ${role.name} and color ${role.color}`))\n * .catch(console.error)\n */\n createRole(data = {}, reason) {\n return this.client.rest.methods.createGuildRole(this, data, reason);\n }\n\n /**\n * Creates a new custom emoji in the guild.\n * @param {BufferResolvable|Base64Resolvable} attachment The image for the emoji\n * @param {string} name The name for the emoji\n * @param {Collection|Role[]} [roles] Roles to limit the emoji to\n * @param {string} [reason] Reason for creating the emoji\n * @returns {Promise} The created emoji\n * @example\n * // Create a new emoji from a url\n * guild.createEmoji('https://i.imgur.com/w3duR07.png', 'rip')\n * .then(emoji => console.log(`Created new emoji with name ${emoji.name}`))\n * .catch(console.error);\n * @example\n * // Create a new emoji from a file on your computer\n * guild.createEmoji('./memes/banana.png', 'banana')\n * .then(emoji => console.log(`Created new emoji with name ${emoji.name}`))\n * .catch(console.error);\n */\n createEmoji(attachment, name, roles, reason) {\n if (typeof attachment === 'string' && attachment.startsWith('data:')) {\n return this.client.rest.methods.createEmoji(this, attachment, name, roles, reason);\n } else {\n return this.client.resolver.resolveImage(attachment).then(data =>\n this.client.rest.methods.createEmoji(this, data, name, roles, reason)\n );\n }\n }\n\n /**\n * Delete an emoji.\n * @param {Emoji|string} emoji The emoji to delete\n * @param {string} [reason] Reason for deleting the emoji\n * @returns {Promise}\n * @deprecated\n */\n deleteEmoji(emoji, reason) {\n if (typeof emoji === 'string') emoji = this.emojis.get(emoji);\n if (!(emoji instanceof Emoji)) throw new TypeError('Emoji must be either an instance of Emoji or an ID');\n return emoji.delete(reason);\n }\n\n /**\n * Causes the client to leave the guild.\n * @returns {Promise}\n * @example\n * // Leave a guild\n * guild.leave()\n * .then(g => console.log(`Left the guild ${g}`))\n * .catch(console.error);\n */\n leave() {\n return this.client.rest.methods.leaveGuild(this);\n }\n\n /**\n * Causes the client to delete the guild.\n * @returns {Promise}\n * @example\n * // Delete a guild\n * guild.delete()\n * .then(g => console.log(`Deleted the guild ${g}`))\n * .catch(console.error);\n */\n delete() {\n return this.client.rest.methods.deleteGuild(this);\n }\n\n /**\n * Whether this guild equals another guild. It compares all properties, so for most operations\n * it is advisable to just compare `guild.id === guild2.id` as it is much faster and is often\n * what most users need.\n * @param {Guild} guild The guild to compare with\n * @returns {boolean}\n */\n equals(guild) {\n let equal =\n guild &&\n this.id === guild.id &&\n this.available === !guild.unavailable &&\n this.splash === guild.splash &&\n this.region === guild.region &&\n this.name === guild.name &&\n this.memberCount === guild.member_count &&\n this.large === guild.large &&\n this.icon === guild.icon &&\n Util.arraysEqual(this.features, guild.features) &&\n this.ownerID === guild.owner_id &&\n this.verificationLevel === guild.verification_level &&\n this.embedEnabled === guild.embed_enabled;\n\n if (equal) {\n if (this.embedChannel) {\n if (this.embedChannel.id !== guild.embed_channel_id) equal = false;\n } else if (guild.embed_channel_id) {\n equal = false;\n }\n }\n\n return equal;\n }\n\n /**\n * When concatenated with a string, this automatically concatenates the guild's name instead of the guild object.\n * @returns {string}\n * @example\n * // Logs: Hello from My Guild!\n * console.log(`Hello from ${guild}!`);\n * @example\n * // Logs: Hello from My Guild!\n * console.log('Hello from ' + guild + '!');\n */\n toString() {\n return this.name;\n }\n\n _addMember(guildUser, emitEvent = true) {\n const existing = this.members.has(guildUser.user.id);\n if (!(guildUser.user instanceof User)) guildUser.user = this.client.dataManager.newUser(guildUser.user);\n\n guildUser.joined_at = guildUser.joined_at || 0;\n const member = new GuildMember(this, guildUser);\n this.members.set(member.id, member);\n\n if (this._rawVoiceStates && this._rawVoiceStates.has(member.user.id)) {\n const voiceState = this._rawVoiceStates.get(member.user.id);\n member.serverMute = voiceState.mute;\n member.serverDeaf = voiceState.deaf;\n member.selfMute = voiceState.self_mute;\n member.selfDeaf = voiceState.self_deaf;\n member.selfStream = voiceState.self_stream || false;\n member.voiceSessionID = voiceState.session_id;\n member.voiceChannelID = voiceState.channel_id;\n if (this.client.channels.has(voiceState.channel_id)) {\n this.client.channels.get(voiceState.channel_id).members.set(member.user.id, member);\n } else {\n this.client.emit('warn', `Member ${member.id} added in guild ${this.id} with an uncached voice channel`);\n }\n }\n\n /**\n * Emitted whenever a user joins a guild.\n * @event Client#guildMemberAdd\n * @param {GuildMember} member The member that has joined a guild\n */\n if (this.client.ws.connection.status === Constants.Status.READY && emitEvent && !existing) {\n this.client.emit(Constants.Events.GUILD_MEMBER_ADD, member);\n }\n\n return member;\n }\n\n _updateMember(member, data) {\n const oldMember = Util.cloneObject(member);\n\n if (data.premium_since) member.premiumSinceTimestamp = new Date(data.premium_since).getTime();\n if (data.roles) member._roles = data.roles;\n if (typeof data.nick !== 'undefined') member.nickname = data.nick;\n\n const notSame = member.nickname !== oldMember.nickname ||\n member.premiumSinceTimestamp !== oldMember.premiumSinceTimestamp ||\n !Util.arraysEqual(member._roles, oldMember._roles);\n\n if (this.client.ws.connection.status === Constants.Status.READY && notSame) {\n /**\n * Emitted whenever a guild member changes - i.e. new role, removed role, nickname.\n * @event Client#guildMemberUpdate\n * @param {GuildMember} oldMember The member before the update\n * @param {GuildMember} newMember The member after the update\n */\n this.client.emit(Constants.Events.GUILD_MEMBER_UPDATE, oldMember, member);\n }\n\n return {\n old: oldMember,\n mem: member,\n };\n }\n\n _removeMember(guildMember) {\n if (guildMember.voiceChannel) guildMember.voiceChannel.members.delete(guildMember.id);\n this.members.delete(guildMember.id);\n }\n\n _memberSpeakUpdate(user, speaking) {\n const member = this.members.get(user);\n if (member && member.speaking !== speaking) {\n member.speaking = speaking;\n /**\n * Emitted once a guild member starts/stops speaking.\n * @event Client#guildMemberSpeaking\n * @param {GuildMember} member The member that started/stopped speaking\n * @param {boolean} speaking Whether or not the member is speaking\n */\n this.client.emit(Constants.Events.GUILD_MEMBER_SPEAKING, member, speaking);\n }\n }\n\n _setPresence(id, presence) {\n if (this.presences.get(id)) {\n this.presences.get(id).update(presence);\n return;\n }\n this.presences.set(id, new Presence(presence, this.client));\n }\n\n /**\n * Set the position of a role in this guild.\n * @param {string|Role} role The role to edit, can be a role object or a role ID\n * @param {number} position The new position of the role\n * @param {boolean} [relative=false] Position Moves the role relative to its current position\n * @returns {Promise}\n */\n setRolePosition(role, position, relative = false) {\n if (typeof role === 'string') {\n role = this.roles.get(role);\n if (!role) return Promise.reject(new Error('Supplied role is not a role or snowflake.'));\n }\n\n position = Number(position);\n if (isNaN(position)) return Promise.reject(new Error('Supplied position is not a number.'));\n\n let updatedRoles = this._sortedRoles.array();\n\n Util.moveElementInArray(updatedRoles, role, position, relative);\n\n updatedRoles = updatedRoles.map((r, i) => ({ id: r.id, position: i }));\n return this.client.rest.methods.setRolePositions(this.id, updatedRoles);\n }\n\n /**\n * Set the position of a channel in this guild.\n * @param {string|GuildChannel} channel The channel to edit, can be a channel object or a channel ID\n * @param {number} position The new position of the channel\n * @param {boolean} [relative=false] Position Moves the channel relative to its current position\n * @returns {Promise}\n */\n setChannelPosition(channel, position, relative = false) {\n if (typeof channel === 'string') {\n channel = this.channels.get(channel);\n if (!channel) return Promise.reject(new Error('Supplied channel is not a channel or snowflake.'));\n }\n\n position = Number(position);\n if (isNaN(position)) return Promise.reject(new Error('Supplied position is not a number.'));\n\n let updatedChannels = this._sortedChannels(channel.type).array();\n\n Util.moveElementInArray(updatedChannels, channel, position, relative);\n\n updatedChannels = updatedChannels.map((c, i) => ({ id: c.id, position: i }));\n return this.client.rest.methods.setChannelPositions(this.id, updatedChannels);\n }\n\n /**\n * Fetches a collection of channels in the current guild sorted by position.\n * @param {string} type The channel type\n * @returns {Collection}\n * @private\n */\n _sortedChannels(type) {\n return this._sortPositionWithID(this.channels.filter(c => {\n if (type === 'voice' && c.type === 'voice') return true;\n else if (type !== 'voice' && c.type !== 'voice') return true;\n else return type === c.type;\n }));\n }\n\n /**\n * Sorts a collection by object position or ID if the positions are equivalent.\n * Intended to be identical to Discord's sorting method.\n * @param {Collection} collection The collection to sort\n * @returns {Collection}\n * @private\n */\n _sortPositionWithID(collection) {\n return collection.sort((a, b) =>\n a.position !== b.position ?\n a.position - b.position :\n Long.fromString(b.id).sub(Long.fromString(a.id)).toNumber()\n );\n }\n}\n\n/**\n * The `#general` TextChannel of the guild\n * @name Guild#defaultChannel\n * @type {TextChannel}\n * @readonly\n * @deprecated\n */\nObject.defineProperty(Guild.prototype, 'defaultChannel', {\n get: util.deprecate(function defaultChannel() {\n return this.channels.get(this.id);\n }, 'Guild#defaultChannel: This property is obsolete, will be removed in v12.0.0, and may not function as expected.'),\n});\n\nGuild.prototype.allowDMs =\n util.deprecate(Guild.prototype.allowDMs, 'Guild#allowDMs: userbot methods will be removed');\n\nGuild.prototype.acknowledge =\n util.deprecate(Guild.prototype.acknowledge, 'Guild#acknowledge: userbot methods will be removed');\n\nGuild.prototype.setPosition =\n util.deprecate(Guild.prototype.setPosition, 'Guild#setPosition: userbot methods will be removed');\n\nGuild.prototype.search =\n util.deprecate(Guild.prototype.search, 'Guild#search: userbot methods will be removed');\n\nGuild.prototype.sync =\n util.deprecate(Guild.prototype.sync, 'Guild#sync:, userbot methods will be removed');\n\nGuild.prototype.deleteEmoji =\n util.deprecate(Guild.prototype.deleteEmoji, 'Guild#deleteEmoji: use Emoji#delete instead');\n\nmodule.exports = Guild;\n\n\n//# sourceURL=webpack:///./src/structures/Guild.js?"); /***/ }), @@ -1553,7 +1626,7 @@ eval("const util = __webpack_require__(/*! util */ \"./node_modules/util/util.js /*! ModuleConcatenation bailout: Module is not an ECMAScript module */ /***/ (function(module, exports, __webpack_require__) { -eval("const Collection = __webpack_require__(/*! ../util/Collection */ \"./src/util/Collection.js\");\nconst Snowflake = __webpack_require__(/*! ../util/Snowflake */ \"./src/util/Snowflake.js\");\nconst Webhook = __webpack_require__(/*! ./Webhook */ \"./src/structures/Webhook.js\");\nconst Invite = __webpack_require__(/*! ./Invite */ \"./src/structures/Invite.js\");\n\n/**\n * The target type of an entry, e.g. `GUILD`. Here are the available types:\n * * GUILD\n * * CHANNEL\n * * USER\n * * ROLE\n * * INVITE\n * * WEBHOOK\n * * EMOJI\n * * MESSAGE\n * @typedef {string} AuditLogTargetType\n */\n\n/**\n * Key mirror of all available audit log targets.\n * @name GuildAuditLogs.Targets\n * @type {AuditLogTargetType}\n */\nconst Targets = {\n ALL: 'ALL',\n GUILD: 'GUILD',\n CHANNEL: 'CHANNEL',\n USER: 'USER',\n ROLE: 'ROLE',\n INVITE: 'INVITE',\n WEBHOOK: 'WEBHOOK',\n EMOJI: 'EMOJI',\n MESSAGE: 'MESSAGE',\n};\n\n/**\n * The action of an entry. Here are the available actions:\n * * ALL: null\n * * GUILD_UPDATE: 1\n * * CHANNEL_CREATE: 10\n * * CHANNEL_UPDATE: 11\n * * CHANNEL_DELETE: 12\n * * CHANNEL_OVERWRITE_CREATE: 13\n * * CHANNEL_OVERWRITE_UPDATE: 14\n * * CHANNEL_OVERWRITE_DELETE: 15\n * * MEMBER_KICK: 20\n * * MEMBER_PRUNE: 21\n * * MEMBER_BAN_ADD: 22\n * * MEMBER_BAN_REMOVE: 23\n * * MEMBER_UPDATE: 24\n * * MEMBER_ROLE_UPDATE: 25\n * * ROLE_CREATE: 30\n * * ROLE_UPDATE: 31\n * * ROLE_DELETE: 32\n * * INVITE_CREATE: 40\n * * INVITE_UPDATE: 41\n * * INVITE_DELETE: 42\n * * WEBHOOK_CREATE: 50\n * * WEBHOOK_UPDATE: 51\n * * WEBHOOK_DELETE: 52\n * * EMOJI_CREATE: 60\n * * EMOJI_UPDATE: 61\n * * EMOJI_DELETE: 62\n * * MESSAGE_DELETE: 72\n * @typedef {?number|string} AuditLogAction\n */\n\n/**\n * All available actions keyed under their names to their numeric values.\n * @name GuildAuditLogs.Actions\n * @type {AuditLogAction}\n */\nconst Actions = {\n ALL: null,\n GUILD_UPDATE: 1,\n CHANNEL_CREATE: 10,\n CHANNEL_UPDATE: 11,\n CHANNEL_DELETE: 12,\n CHANNEL_OVERWRITE_CREATE: 13,\n CHANNEL_OVERWRITE_UPDATE: 14,\n CHANNEL_OVERWRITE_DELETE: 15,\n MEMBER_KICK: 20,\n MEMBER_PRUNE: 21,\n MEMBER_BAN_ADD: 22,\n MEMBER_BAN_REMOVE: 23,\n MEMBER_UPDATE: 24,\n MEMBER_ROLE_UPDATE: 25,\n ROLE_CREATE: 30,\n ROLE_UPDATE: 31,\n ROLE_DELETE: 32,\n INVITE_CREATE: 40,\n INVITE_UPDATE: 41,\n INVITE_DELETE: 42,\n WEBHOOK_CREATE: 50,\n WEBHOOK_UPDATE: 51,\n WEBHOOK_DELETE: 52,\n EMOJI_CREATE: 60,\n EMOJI_UPDATE: 61,\n EMOJI_DELETE: 62,\n MESSAGE_DELETE: 72,\n};\n\n\n/**\n * Audit logs entries are held in this class.\n */\nclass GuildAuditLogs {\n constructor(guild, data) {\n if (data.users) for (const user of data.users) guild.client.dataManager.newUser(user);\n\n /**\n * Cached webhooks\n * @type {Collection}\n * @private\n */\n this.webhooks = new Collection();\n if (data.webhooks) {\n for (const hook of data.webhooks) {\n this.webhooks.set(hook.id, new Webhook(guild.client, hook));\n }\n }\n\n /**\n * The entries for this guild's audit logs\n * @type {Collection}\n */\n this.entries = new Collection();\n for (const item of data.audit_log_entries) {\n const entry = new GuildAuditLogsEntry(this, guild, item);\n this.entries.set(entry.id, entry);\n }\n }\n\n /**\n * Handles possible promises for entry targets.\n * @returns {Promise}\n */\n static build(...args) {\n const logs = new GuildAuditLogs(...args);\n return Promise.all(logs.entries.map(e => e.target)).then(() => logs);\n }\n\n /**\n * The target of an entry. It can be one of:\n * * A guild\n * * A user\n * * A role\n * * An emoji\n * * An invite\n * * A webhook\n * * An object where the keys represent either the new value or the old value\n * @typedef {?Object|Guild|User|Role|Emoji|Invite|Webhook} AuditLogEntryTarget\n */\n\n /**\n * Find target type from entry action.\n * @param {number} target The action target\n * @returns {?string}\n */\n static targetType(target) {\n if (target < 10) return Targets.GUILD;\n if (target < 20) return Targets.CHANNEL;\n if (target < 30) return Targets.USER;\n if (target < 40) return Targets.ROLE;\n if (target < 50) return Targets.INVITE;\n if (target < 60) return Targets.WEBHOOK;\n if (target < 70) return Targets.EMOJI;\n if (target < 80) return Targets.MESSAGE;\n return null;\n }\n\n /**\n * The action type of an entry, e.g. `CREATE`. Here are the available types:\n * * CREATE\n * * DELETE\n * * UPDATE\n * * ALL\n * @typedef {string} AuditLogActionType\n */\n\n\n /**\n * Finds the action type from the entry action.\n * @param {AuditLogAction} action The action target\n * @returns {AuditLogActionType}\n */\n static actionType(action) {\n if ([\n Actions.CHANNEL_CREATE,\n Actions.CHANNEL_OVERWRITE_CREATE,\n Actions.MEMBER_BAN_REMOVE,\n Actions.ROLE_CREATE,\n Actions.INVITE_CREATE,\n Actions.WEBHOOK_CREATE,\n Actions.EMOJI_CREATE,\n ].includes(action)) return 'CREATE';\n\n if ([\n Actions.CHANNEL_DELETE,\n Actions.CHANNEL_OVERWRITE_DELETE,\n Actions.MEMBER_KICK,\n Actions.MEMBER_PRUNE,\n Actions.MEMBER_BAN_ADD,\n Actions.ROLE_DELETE,\n Actions.INVITE_DELETE,\n Actions.WEBHOOK_DELETE,\n Actions.EMOJI_DELETE,\n Actions.MESSAGE_DELETE,\n ].includes(action)) return 'DELETE';\n\n if ([\n Actions.GUILD_UPDATE,\n Actions.CHANNEL_UPDATE,\n Actions.CHANNEL_OVERWRITE_UPDATE,\n Actions.MEMBER_UPDATE,\n Actions.MEMBER_ROLE_UPDATE,\n Actions.ROLE_UPDATE,\n Actions.INVITE_UPDATE,\n Actions.WEBHOOK_UPDATE,\n Actions.EMOJI_UPDATE,\n ].includes(action)) return 'UPDATE';\n\n return 'ALL';\n }\n}\n\n/**\n * Audit logs entry.\n */\nclass GuildAuditLogsEntry {\n constructor(logs, guild, data) {\n const targetType = GuildAuditLogs.targetType(data.action_type);\n /**\n * The target type of this entry\n * @type {AuditLogTargetType}\n */\n this.targetType = targetType;\n\n /**\n * The action type of this entry\n * @type {AuditLogActionType}\n */\n this.actionType = GuildAuditLogs.actionType(data.action_type);\n\n /**\n * Specific action type of this entry in its string representation\n * @type {AuditLogAction}\n */\n this.action = Object.keys(Actions).find(k => Actions[k] === data.action_type);\n\n /**\n * The reason of this entry\n * @type {?string}\n */\n this.reason = data.reason || null;\n\n /**\n * The user that executed this entry\n * @type {User}\n */\n this.executor = guild.client.users.get(data.user_id);\n\n /**\n * An entry in the audit log representing a specific change.\n * @typedef {object} AuditLogChange\n * @property {string} key The property that was changed, e.g. `nick` for nickname changes\n * @property {*} [old] The old value of the change, e.g. for nicknames, the old nickname\n * @property {*} [new] The new value of the change, e.g. for nicknames, the new nickname\n */\n\n /**\n * Specific property changes\n * @type {AuditLogChange[]}\n */\n this.changes = data.changes ? data.changes.map(c => ({ key: c.key, old: c.old_value, new: c.new_value })) : null;\n\n /**\n * The ID of this entry\n * @type {Snowflake}\n */\n this.id = data.id;\n\n /**\n * Any extra data from the entry\n * @type {?Object|Role|GuildMember}\n */\n this.extra = null;\n if (data.options) {\n if (data.action_type === Actions.MEMBER_PRUNE) {\n this.extra = {\n removed: data.options.members_removed,\n days: data.options.delete_member_days,\n };\n } else if (data.action_type === Actions.MESSAGE_DELETE) {\n this.extra = {\n count: data.options.count,\n channel: guild.channels.get(data.options.channel_id),\n };\n } else {\n switch (data.options.type) {\n case 'member':\n this.extra = guild.members.get(data.options.id);\n if (!this.extra) this.extra = { id: data.options.id };\n break;\n case 'role':\n this.extra = guild.roles.get(data.options.id);\n if (!this.extra) this.extra = { id: data.options.id, name: data.options.role_name };\n break;\n default:\n break;\n }\n }\n }\n\n if ([Targets.USER, Targets.GUILD].includes(targetType)) {\n /**\n * The target of this entry\n * @type {AuditLogEntryTarget}\n */\n this.target = guild.client[`${targetType.toLowerCase()}s`].get(data.target_id);\n } else if (targetType === Targets.WEBHOOK) {\n this.target = logs.webhooks.get(data.target_id) ||\n new Webhook(guild.client,\n this.changes.reduce((o, c) => {\n o[c.key] = c.new || c.old;\n return o;\n }, {\n id: data.target_id,\n guild_id: guild.id,\n }));\n } else if (targetType === Targets.INVITE) {\n const changes = this.changes.reduce((o, c) => {\n o[c.key] = c.new || c.old;\n return o;\n }, {\n id: data.target_id,\n guild,\n });\n changes.channel = { id: changes.channel_id };\n this.target = new Invite(guild.client, changes);\n } else if (targetType === Targets.MESSAGE) {\n this.target = guild.client.users.get(data.target_id);\n } else {\n this.target = guild[`${targetType.toLowerCase()}s`].get(data.target_id);\n }\n }\n\n /**\n * The timestamp this entry was created at\n * @type {number}\n * @readonly\n */\n get createdTimestamp() {\n return Snowflake.deconstruct(this.id).timestamp;\n }\n\n /**\n * The time this entry was created\n * @type {Date}\n * @readonly\n */\n get createdAt() {\n return new Date(this.createdTimestamp);\n }\n}\n\nGuildAuditLogs.Actions = Actions;\nGuildAuditLogs.Targets = Targets;\nGuildAuditLogs.Entry = GuildAuditLogsEntry;\n\nmodule.exports = GuildAuditLogs;\n\n\n//# sourceURL=webpack:///./src/structures/GuildAuditLogs.js?"); +eval("const Collection = __webpack_require__(/*! ../util/Collection */ \"./src/util/Collection.js\");\nconst Snowflake = __webpack_require__(/*! ../util/Snowflake */ \"./src/util/Snowflake.js\");\nconst Webhook = __webpack_require__(/*! ./Webhook */ \"./src/structures/Webhook.js\");\nconst Integration = __webpack_require__(/*! ./Integration */ \"./src/structures/Integration.js\");\nconst Invite = __webpack_require__(/*! ./Invite */ \"./src/structures/Invite.js\");\n\n/**\n * The target type of an entry, e.g. `GUILD`. Here are the available types:\n * * GUILD\n * * CHANNEL\n * * USER\n * * ROLE\n * * INVITE\n * * WEBHOOK\n * * EMOJI\n * * MESSAGE\n * * INTEGRATION\n * @typedef {string} AuditLogTargetType\n */\n\n/**\n * Key mirror of all available audit log targets.\n * @name GuildAuditLogs.Targets\n * @type {AuditLogTargetType}\n */\nconst Targets = {\n ALL: 'ALL',\n GUILD: 'GUILD',\n CHANNEL: 'CHANNEL',\n USER: 'USER',\n ROLE: 'ROLE',\n INVITE: 'INVITE',\n WEBHOOK: 'WEBHOOK',\n EMOJI: 'EMOJI',\n MESSAGE: 'MESSAGE',\n INTEGRATION: 'INTEGRATION',\n UNKNOWN: 'UNKNOWN',\n};\n\n/**\n * The action of an entry. Here are the available actions:\n * * ALL: null\n * * GUILD_UPDATE: 1\n * * CHANNEL_CREATE: 10\n * * CHANNEL_UPDATE: 11\n * * CHANNEL_DELETE: 12\n * * CHANNEL_OVERWRITE_CREATE: 13\n * * CHANNEL_OVERWRITE_UPDATE: 14\n * * CHANNEL_OVERWRITE_DELETE: 15\n * * MEMBER_KICK: 20\n * * MEMBER_PRUNE: 21\n * * MEMBER_BAN_ADD: 22\n * * MEMBER_BAN_REMOVE: 23\n * * MEMBER_UPDATE: 24\n * * MEMBER_ROLE_UPDATE: 25\n * * MEMBER_MOVE: 26\n * * MEMBER_DISCONNECT: 27\n * * BOT_ADD: 28,\n * * ROLE_CREATE: 30\n * * ROLE_UPDATE: 31\n * * ROLE_DELETE: 32\n * * INVITE_CREATE: 40\n * * INVITE_UPDATE: 41\n * * INVITE_DELETE: 42\n * * WEBHOOK_CREATE: 50\n * * WEBHOOK_UPDATE: 51\n * * WEBHOOK_DELETE: 52\n * * EMOJI_CREATE: 60\n * * EMOJI_UPDATE: 61\n * * EMOJI_DELETE: 62\n * * MESSAGE_DELETE: 72\n * * MESSAGE_BULK_DELETE: 73\n * * MESSAGE_PIN: 74\n * * MESSAGE_UNPIN: 75\n * * INTEGRATION_CREATE: 80\n * * INTEGRATION_UPDATE: 81\n * * INTEGRATION_DELETE: 82\n * @typedef {?number|string} AuditLogAction\n */\n\n/**\n * All available actions keyed under their names to their numeric values.\n * @name GuildAuditLogs.Actions\n * @type {AuditLogAction}\n */\nconst Actions = {\n ALL: null,\n GUILD_UPDATE: 1,\n CHANNEL_CREATE: 10,\n CHANNEL_UPDATE: 11,\n CHANNEL_DELETE: 12,\n CHANNEL_OVERWRITE_CREATE: 13,\n CHANNEL_OVERWRITE_UPDATE: 14,\n CHANNEL_OVERWRITE_DELETE: 15,\n MEMBER_KICK: 20,\n MEMBER_PRUNE: 21,\n MEMBER_BAN_ADD: 22,\n MEMBER_BAN_REMOVE: 23,\n MEMBER_UPDATE: 24,\n MEMBER_ROLE_UPDATE: 25,\n MEMBER_MOVE: 26,\n MEMBER_DISCONNECT: 27,\n BOT_ADD: 28,\n ROLE_CREATE: 30,\n ROLE_UPDATE: 31,\n ROLE_DELETE: 32,\n INVITE_CREATE: 40,\n INVITE_UPDATE: 41,\n INVITE_DELETE: 42,\n WEBHOOK_CREATE: 50,\n WEBHOOK_UPDATE: 51,\n WEBHOOK_DELETE: 52,\n EMOJI_CREATE: 60,\n EMOJI_UPDATE: 61,\n EMOJI_DELETE: 62,\n MESSAGE_DELETE: 72,\n MESSAGE_BULK_DELETE: 73,\n MESSAGE_PIN: 74,\n MESSAGE_UNPIN: 75,\n INTEGRATION_CREATE: 80,\n INTEGRATION_UPDATE: 81,\n INTEGRATION_DELETE: 82,\n};\n\n\n/**\n * Audit logs entries are held in this class.\n */\nclass GuildAuditLogs {\n constructor(guild, data) {\n if (data.users) for (const user of data.users) guild.client.dataManager.newUser(user);\n\n /**\n * Cached webhooks\n * @type {Collection}\n * @private\n */\n this.webhooks = new Collection();\n if (data.webhooks) {\n for (const hook of data.webhooks) {\n this.webhooks.set(hook.id, new Webhook(guild.client, hook));\n }\n }\n\n /**\n * Cached integrations\n * @type {Collection}\n * @private\n */\n this.integrations = new Collection();\n if (data.integrations) {\n for (const integration of data.integrations) {\n this.integrations.set(integration.id, new Integration(guild.client, integration, guild));\n }\n }\n\n /**\n * The entries for this guild's audit logs\n * @type {Collection}\n */\n this.entries = new Collection();\n for (const item of data.audit_log_entries) {\n const entry = new GuildAuditLogsEntry(this, guild, item);\n this.entries.set(entry.id, entry);\n }\n }\n\n /**\n * Handles possible promises for entry targets.\n * @returns {Promise}\n */\n static build(...args) {\n const logs = new GuildAuditLogs(...args);\n return Promise.all(logs.entries.map(e => e.target)).then(() => logs);\n }\n\n /**\n * The target of an entry. It can be one of:\n * * A guild\n * * A user\n * * A role\n * * An emoji\n * * An invite\n * * A webhook\n * * An integration\n * * An object with an id key if target was deleted\n * * An object where the keys represent either the new value or the old value\n * @typedef {?Object|Guild|User|Role|Emoji|Invite|Webhook|Integration} AuditLogEntryTarget\n */\n\n /**\n * Find target type from entry action.\n * @param {number} target The action target\n * @returns {?string}\n */\n static targetType(target) {\n if (target < 10) return Targets.GUILD;\n if (target < 20) return Targets.CHANNEL;\n if (target < 30) return Targets.USER;\n if (target < 40) return Targets.ROLE;\n if (target < 50) return Targets.INVITE;\n if (target < 60) return Targets.WEBHOOK;\n if (target < 70) return Targets.EMOJI;\n if (target < 80) return Targets.MESSAGE;\n if (target < 90) return Targets.INTEGRATION;\n return null;\n }\n\n /**\n * The action type of an entry, e.g. `CREATE`. Here are the available types:\n * * CREATE\n * * DELETE\n * * UPDATE\n * * ALL\n * @typedef {string} AuditLogActionType\n */\n\n\n /**\n * Finds the action type from the entry action.\n * @param {AuditLogAction} action The action target\n * @returns {AuditLogActionType}\n */\n static actionType(action) {\n if ([\n Actions.CHANNEL_CREATE,\n Actions.CHANNEL_OVERWRITE_CREATE,\n Actions.MEMBER_BAN_REMOVE,\n Actions.BOT_ADD,\n Actions.ROLE_CREATE,\n Actions.INVITE_CREATE,\n Actions.WEBHOOK_CREATE,\n Actions.EMOJI_CREATE,\n Actions.MESSAGE_PIN,\n Actions.INTEGRATION_CREATE,\n ].includes(action)) return 'CREATE';\n\n if ([\n Actions.CHANNEL_DELETE,\n Actions.CHANNEL_OVERWRITE_DELETE,\n Actions.MEMBER_KICK,\n Actions.MEMBER_PRUNE,\n Actions.MEMBER_BAN_ADD,\n Actions.MEMBER_DISCONNECT,\n Actions.ROLE_DELETE,\n Actions.INVITE_DELETE,\n Actions.WEBHOOK_DELETE,\n Actions.EMOJI_DELETE,\n Actions.MESSAGE_DELETE,\n Actions.MESSAGE_BULK_DELETE,\n Actions.MESSAGE_UNPIN,\n Actions.INTEGRATION_DELETE,\n ].includes(action)) return 'DELETE';\n\n if ([\n Actions.GUILD_UPDATE,\n Actions.CHANNEL_UPDATE,\n Actions.CHANNEL_OVERWRITE_UPDATE,\n Actions.MEMBER_UPDATE,\n Actions.MEMBER_ROLE_UPDATE,\n Actions.MEMBER_MOVE,\n Actions.ROLE_UPDATE,\n Actions.INVITE_UPDATE,\n Actions.WEBHOOK_UPDATE,\n Actions.EMOJI_UPDATE,\n Actions.INTEGRATION_UPDATE,\n ].includes(action)) return 'UPDATE';\n\n return 'ALL';\n }\n}\n\n/**\n * Audit logs entry.\n */\nclass GuildAuditLogsEntry {\n // eslint-disable-next-line complexity\n constructor(logs, guild, data) {\n const targetType = GuildAuditLogs.targetType(data.action_type);\n /**\n * The target type of this entry\n * @type {AuditLogTargetType}\n */\n this.targetType = targetType;\n\n /**\n * The action type of this entry\n * @type {AuditLogActionType}\n */\n this.actionType = GuildAuditLogs.actionType(data.action_type);\n\n /**\n * Specific action type of this entry in its string representation\n * @type {AuditLogAction}\n */\n this.action = Object.keys(Actions).find(k => Actions[k] === data.action_type);\n\n /**\n * The reason of this entry\n * @type {?string}\n */\n this.reason = data.reason || null;\n\n /**\n * The user that executed this entry\n * @type {User}\n */\n this.executor = guild.client.users.get(data.user_id);\n\n /**\n * An entry in the audit log representing a specific change.\n * @typedef {object} AuditLogChange\n * @property {string} key The property that was changed, e.g. `nick` for nickname changes\n * @property {*} [old] The old value of the change, e.g. for nicknames, the old nickname\n * @property {*} [new] The new value of the change, e.g. for nicknames, the new nickname\n */\n\n /**\n * Specific property changes\n * @type {AuditLogChange[]}\n */\n this.changes = data.changes ? data.changes.map(c => ({ key: c.key, old: c.old_value, new: c.new_value })) : null;\n\n /**\n * The ID of this entry\n * @type {Snowflake}\n */\n this.id = data.id;\n\n /**\n * Any extra data from the entry\n * @type {?Object|Role|GuildMember}\n */\n this.extra = null;\n switch (data.action_type) {\n case Actions.MEMBER_PRUNE:\n this.extra = {\n removed: Number(data.options.members_removed),\n days: Number(data.options.delete_member_days),\n };\n break;\n\n case Actions.MEMBER_MOVE:\n case Actions.MESSAGE_DELETE:\n case Actions.MESSAGE_BULK_DELETE:\n this.extra = {\n channel: guild.channels.get(data.options.channel_id) || { id: data.options.channel_id },\n count: Number(data.options.count),\n };\n break;\n\n case Actions.MESSAGE_PIN:\n case Actions.MESSAGE_UNPIN:\n this.extra = {\n channel: guild.client.channels.get(data.options.channel_id) || { id: data.options.channel_id },\n messageID: data.options.message_id,\n };\n break;\n\n case Actions.MEMBER_DISCONNECT:\n this.extra = {\n count: Number(data.options.count),\n };\n break;\n\n case Actions.CHANNEL_OVERWRITE_CREATE:\n case Actions.CHANNEL_OVERWRITE_UPDATE:\n case Actions.CHANNEL_OVERWRITE_DELETE:\n switch (data.options.type) {\n case 'member':\n this.extra = guild.members.get(data.options.id) ||\n { id: data.options.id, type: 'member' };\n break;\n case 'role':\n this.extra = guild.roles.get(data.options.id) ||\n { id: data.options.id, name: data.options.role_name, type: 'role' };\n break;\n default:\n break;\n }\n break;\n\n default:\n break;\n }\n\n /**\n * The target of this entry\n * @type {AuditLogEntryTarget}\n */\n this.target = null;\n if (targetType === Targets.UNKNOWN) {\n this.changes.reduce((o, c) => {\n o[c.key] = c.new || c.old;\n return o;\n }, {});\n this.target.id = data.target_id;\n // MEMBER_DISCONNECT and similar types do not provide a target_id.\n } else if (targetType === Targets.USER && data.target_id) {\n this.target = guild.client.users.get(data.target_id);\n } else if (targetType === Targets.GUILD) {\n this.target = guild.client.guilds.get(data.target_id);\n } else if (targetType === Targets.WEBHOOK) {\n this.target = logs.webhooks.get(data.target_id) ||\n new Webhook(guild.client,\n this.changes.reduce((o, c) => {\n o[c.key] = c.new || c.old;\n return o;\n }, {\n id: data.target_id,\n guild_id: guild.id,\n }));\n } else if (targetType === Targets.INVITE) {\n const changes = this.changes.reduce((o, c) => {\n o[c.key] = c.new || c.old;\n return o;\n }, {\n id: data.target_id,\n guild,\n });\n changes.channel = { id: changes.channel_id };\n this.target = new Invite(guild.client, changes);\n } else if (targetType === Targets.MESSAGE) {\n // Discord sends a channel id for the MESSAGE_BULK_DELETE action type.\n this.target = data.action_type === Actions.MESSAGE_BULK_DELETE ?\n guild.channels.get(data.target_id) || { id: data.target_id } :\n guild.client.users.get(data.target_id);\n } else if (targetType === Targets.INTEGRATION) {\n this.target = logs.integrations.get(data.target_id) ||\n new Integration(guild.client, this.changes.reduce((o, c) => {\n o[c.key] = c.new || c.old;\n return o;\n }, { id: data.target_id }), guild);\n } else if (data.target_id) {\n this.target = guild[`${targetType.toLowerCase()}s`].get(data.target_id) || { id: data.target_id };\n }\n }\n\n /**\n * The timestamp this entry was created at\n * @type {number}\n * @readonly\n */\n get createdTimestamp() {\n return Snowflake.deconstruct(this.id).timestamp;\n }\n\n /**\n * The time this entry was created\n * @type {Date}\n * @readonly\n */\n get createdAt() {\n return new Date(this.createdTimestamp);\n }\n}\n\nGuildAuditLogs.Actions = Actions;\nGuildAuditLogs.Targets = Targets;\nGuildAuditLogs.Entry = GuildAuditLogsEntry;\n\nmodule.exports = GuildAuditLogs;\n\n\n//# sourceURL=webpack:///./src/structures/GuildAuditLogs.js?"); /***/ }), @@ -1565,7 +1638,7 @@ eval("const Collection = __webpack_require__(/*! ../util/Collection */ \"./src/u /*! ModuleConcatenation bailout: Module is not an ECMAScript module */ /***/ (function(module, exports, __webpack_require__) { -eval("const Channel = __webpack_require__(/*! ./Channel */ \"./src/structures/Channel.js\");\nconst Role = __webpack_require__(/*! ./Role */ \"./src/structures/Role.js\");\nconst PermissionOverwrites = __webpack_require__(/*! ./PermissionOverwrites */ \"./src/structures/PermissionOverwrites.js\");\nconst Permissions = __webpack_require__(/*! ../util/Permissions */ \"./src/util/Permissions.js\");\nconst Collection = __webpack_require__(/*! ../util/Collection */ \"./src/util/Collection.js\");\nconst Constants = __webpack_require__(/*! ../util/Constants */ \"./src/util/Constants.js\");\nconst Invite = __webpack_require__(/*! ./Invite */ \"./src/structures/Invite.js\");\n\n/**\n * Represents a guild channel (i.e. text channels and voice channels).\n * @extends {Channel}\n */\nclass GuildChannel extends Channel {\n constructor(guild, data) {\n super(guild.client, data);\n\n /**\n * The guild the channel is in\n * @type {Guild}\n */\n this.guild = guild;\n }\n\n setup(data) {\n super.setup(data);\n\n /**\n * The name of the guild channel\n * @type {string}\n */\n this.name = data.name;\n\n /**\n * The position of the channel in the list\n * @type {number}\n */\n this.position = data.position;\n\n /**\n * The ID of the category parent of this channel\n * @type {?Snowflake}\n */\n this.parentID = data.parent_id;\n\n /**\n * A map of permission overwrites in this channel for roles and users\n * @type {Collection}\n */\n this.permissionOverwrites = new Collection();\n if (data.permission_overwrites) {\n for (const overwrite of data.permission_overwrites) {\n this.permissionOverwrites.set(overwrite.id, new PermissionOverwrites(this, overwrite));\n }\n }\n }\n\n /**\n * The position of the channel\n * @type {number}\n * @readonly\n */\n get calculatedPosition() {\n const sorted = this.guild._sortedChannels(this.type);\n return sorted.array().indexOf(sorted.get(this.id));\n }\n\n /**\n * The category parent of this channel\n * @type {?CategoryChannel}\n * @readonly\n */\n get parent() {\n return this.guild.channels.get(this.parentID) || null;\n }\n\n /**\n * Gets the overall set of permissions for a user in this channel, taking into account channel overwrites.\n * @param {GuildMemberResolvable} member The user that you want to obtain the overall permissions for\n * @returns {?Permissions}\n */\n memberPermissions(member) {\n member = this.client.resolver.resolveGuildMember(this.guild, member);\n if (!member) return null;\n\n if (member.id === this.guild.ownerID) return new Permissions(member, Permissions.ALL);\n\n const roles = member.roles;\n const permissions = new Permissions(roles.map(role => role.permissions));\n\n if (permissions.has(Permissions.FLAGS.ADMINISTRATOR)) return new Permissions(Permissions.ALL).freeze();\n\n const overwrites = this.overwritesFor(member, true, roles);\n\n return permissions\n .remove(overwrites.everyone ? overwrites.everyone.deny : 0)\n .add(overwrites.everyone ? overwrites.everyone.allow : 0)\n .remove(overwrites.roles.length > 0 ? overwrites.roles.map(role => role.deny) : 0)\n .add(overwrites.roles.length > 0 ? overwrites.roles.map(role => role.allow) : 0)\n .remove(overwrites.member ? overwrites.member.deny : 0)\n .add(overwrites.member ? overwrites.member.allow : 0)\n .freeze();\n }\n\n /**\n * Gets the overall set of permissions for a role in this channel, taking into account channel overwrites.\n * @param {RoleResolvable} role The role that you want to obtain the overall permissions for\n * @returns {?Permissions}\n */\n rolePermissions(role) {\n if (role.permissions & Permissions.FLAGS.ADMINISTRATOR) return new Permissions(Permissions.ALL).freeze();\n\n const everyoneOverwrites = this.permissionOverwrites.get(this.guild.id);\n const roleOverwrites = this.permissionOverwrites.get(role.id);\n\n return new Permissions(role.permissions)\n .remove(everyoneOverwrites ? everyoneOverwrites.deny : 0)\n .add(everyoneOverwrites ? everyoneOverwrites.allow : 0)\n .remove(roleOverwrites ? roleOverwrites.deny : 0)\n .add(roleOverwrites ? roleOverwrites.allow : 0)\n .freeze();\n }\n\n /**\n * Get the overall set of permissions for a member or role in this channel, taking into account channel overwrites.\n * @param {GuildMemberResolvable|RoleResolvable} memberOrRole The member or role to obtain the overall permissions for\n * @returns {?Permissions}\n */\n permissionsFor(memberOrRole) {\n const member = this.guild.member(memberOrRole);\n if (member) return this.memberPermissions(member);\n const role = this.client.resolver.resolveRole(this.guild, memberOrRole);\n if (role) return this.rolePermissions(role);\n return null;\n }\n\n overwritesFor(member, verified = false, roles = null) {\n if (!verified) member = this.client.resolver.resolveGuildMember(this.guild, member);\n if (!member) return [];\n\n roles = roles || member.roles;\n const roleOverwrites = [];\n let memberOverwrites;\n let everyoneOverwrites;\n\n for (const overwrite of this.permissionOverwrites.values()) {\n if (overwrite.id === this.guild.id) {\n everyoneOverwrites = overwrite;\n } else if (roles.has(overwrite.id)) {\n roleOverwrites.push(overwrite);\n } else if (overwrite.id === member.id) {\n memberOverwrites = overwrite;\n }\n }\n\n return {\n everyone: everyoneOverwrites,\n roles: roleOverwrites,\n member: memberOverwrites,\n };\n }\n\n /**\n * Replaces the permission overwrites for a channel\n * @param {Object} [options] Options\n * @param {ChannelCreationOverwrites[]|Collection} [options.overwrites]\n * Permission overwrites\n * @param {string} [options.reason] Reason for updating the channel overwrites\n * @returns {Promise}\n * @example\n * channel.replacePermissionOverwrites({\n * overwrites: [\n * {\n * id: message.author.id,\n * denied: ['VIEW_CHANNEL'],\n * },\n * ],\n * reason: 'Needed to change permissions'\n * });\n */\n replacePermissionOverwrites({ overwrites, reason } = {}) {\n return this.edit({ permissionOverwrites: overwrites, reason })\n .then(() => this);\n }\n\n /**\n * An object mapping permission flags to `true` (enabled), `null` (unset) or `false` (disabled).\n * ```js\n * {\n * 'SEND_MESSAGES': true,\n * 'EMBED_LINKS': null,\n * 'ATTACH_FILES': false,\n * }\n * ```\n * @typedef {Object} PermissionOverwriteOptions\n */\n\n /**\n * Overwrites the permissions for a user or role in this channel.\n * @param {Role|Snowflake|UserResolvable} userOrRole The user or role to update\n * @param {PermissionOverwriteOptions} options The configuration for the update\n * @param {string} [reason] Reason for creating/editing this overwrite\n * @returns {Promise}\n * @example\n * // Overwrite permissions for a message author\n * message.channel.overwritePermissions(message.author, {\n * SEND_MESSAGES: false\n * })\n * .then(updated => console.log(updated.permissionOverwrites.get(message.author.id)))\n * .catch(console.error);\n * @example\n * // Overwite permissions for a message author and reset some\n * message.channel.overwritePermissions(message.author, {\n * VIEW_CHANNEL: false,\n * SEND_MESSAGES: null\n * })\n * .then(updated => console.log(updated.permissionOverwrites.get(message.author.id)))\n * .catch(console.error);\n */\n overwritePermissions(userOrRole, options, reason) {\n const payload = {\n allow: 0,\n deny: 0,\n };\n\n if (userOrRole instanceof Role) {\n payload.type = 'role';\n } else if (this.guild.roles.has(userOrRole)) {\n userOrRole = this.guild.roles.get(userOrRole);\n payload.type = 'role';\n } else {\n userOrRole = this.client.resolver.resolveUser(userOrRole);\n payload.type = 'member';\n if (!userOrRole) return Promise.reject(new TypeError('Supplied parameter was neither a User nor a Role.'));\n }\n\n payload.id = userOrRole.id;\n\n const prevOverwrite = this.permissionOverwrites.get(userOrRole.id);\n\n if (prevOverwrite) {\n payload.allow = prevOverwrite.allow;\n payload.deny = prevOverwrite.deny;\n }\n\n for (const perm in options) {\n if (options[perm] === true) {\n payload.allow |= Permissions.FLAGS[perm] || 0;\n payload.deny &= ~(Permissions.FLAGS[perm] || 0);\n } else if (options[perm] === false) {\n payload.allow &= ~(Permissions.FLAGS[perm] || 0);\n payload.deny |= Permissions.FLAGS[perm] || 0;\n } else if (options[perm] === null) {\n payload.allow &= ~(Permissions.FLAGS[perm] || 0);\n payload.deny &= ~(Permissions.FLAGS[perm] || 0);\n }\n }\n\n return this.client.rest.methods.setChannelOverwrite(this, payload, reason).then(() => this);\n }\n\n /**\n * Locks in the permission overwrites from the parent channel.\n * @returns {Promise}\n */\n lockPermissions() {\n if (!this.parent) return Promise.reject(new TypeError('Could not find a parent to this guild channel.'));\n const permissionOverwrites = this.parent.permissionOverwrites.map(overwrite => ({\n deny: overwrite.deny,\n allow: overwrite.allow,\n id: overwrite.id,\n type: overwrite.type,\n }));\n return this.edit({ permissionOverwrites });\n }\n\n /**\n * The data for a guild channel.\n * @typedef {Object} ChannelData\n * @property {string} [type] The type of the channel (Only when creating)\n * @property {string} [name] The name of the channel\n * @property {number} [position] The position of the channel\n * @property {string} [topic] The topic of the text channel\n * @property {boolean} [nsfw] Whether the channel is NSFW\n * @property {number} [bitrate] The bitrate of the voice channel\n * @property {number} [userLimit] The user limit of the channel\n * @property {CategoryChannel|Snowflake} [parent] The parent or parent ID of the channel\n * @property {ChannelCreationOverwrites[]|Collection} [permissionOverwrites]\n * Overwrites of the channel\n * @property {number} [rateLimitPerUser] The rate limit per user of the channel in seconds\n */\n\n /**\n * Edits the channel.\n * @param {ChannelData} data The new data for the channel\n * @param {string} [reason] Reason for editing this channel\n * @returns {Promise}\n * @example\n * // Edit a channel\n * channel.edit({ name: 'new-channel' })\n * .then(console.log)\n * .catch(console.error);\n */\n edit(data, reason) {\n return this.client.rest.methods.updateChannel(this, data, reason).then(() => this);\n }\n\n /**\n * Set a new name for the guild channel.\n * @param {string} name The new name for the guild channel\n * @param {string} [reason] Reason for changing the guild channel's name\n * @returns {Promise}\n * @example\n * // Set a new channel name\n * channel.setName('not_general')\n * .then(newChannel => console.log(`Channel's new name is ${newChannel.name}`))\n * .catch(console.error);\n */\n setName(name, reason) {\n return this.edit({ name }, reason);\n }\n\n /**\n * Set a new position for the guild channel.\n * @param {number} position The new position for the guild channel\n * @param {boolean} [relative=false] Move the position relative to its current value\n * @returns {Promise}\n * @example\n * // Set a new channel position\n * channel.setPosition(2)\n * .then(newChannel => console.log(`Channel's new position is ${newChannel.position}`))\n * .catch(console.error);\n */\n setPosition(position, relative) {\n return this.guild.setChannelPosition(this, position, relative);\n }\n\n /**\n * Set a new parent for the guild channel.\n * @param {CategoryChannel|SnowFlake} parent The new parent for the guild channel\n * @param {string} [reason] Reason for changing the guild channel's parent\n * @returns {Promise}\n * @example\n * // Sets the parent of a channel\n * channel.setParent('174674066072928256')\n * .then(updated => console.log(`Set the category of ${updated.name} to ${updated.parent.name}`))\n * .catch(console.error);\n */\n setParent(parent, reason) {\n parent = this.client.resolver.resolveChannelID(parent);\n return this.edit({ parent }, reason);\n }\n\n /**\n * Set a new topic for the guild channel.\n * @param {string} topic The new topic for the guild channel\n * @param {string} [reason] Reason for changing the guild channel's topic\n * @returns {Promise}\n * @example\n * // Set a new channel topic\n * channel.setTopic('Needs more rate limiting')\n * .then(updated => console.log(`Channel's new topic is ${updated.topic}`))\n * .catch(console.error);\n */\n setTopic(topic, reason) {\n return this.edit({ topic }, reason);\n }\n\n /**\n * Create an invite to this guild channel.\n * This is only available when using a bot account.\n * @param {Object} [options={}] Options for the invite\n * @param {boolean} [options.temporary=false] Whether members that joined via the invite should be automatically\n * kicked after 24 hours if they have not yet received a role\n * @param {number} [options.maxAge=86400] How long the invite should last (in seconds, 0 for forever)\n * @param {number} [options.maxUses=0] Maximum number of uses\n * @param {boolean} [options.unique=false] Create a unique invite, or use an existing one with similar settings\n * @param {string} [reason] Reason for creating the invite\n * @returns {Promise}\n * @example\n * // Create an invite to a channel\n * channel.createInvite()\n * .then(invite => console.log(`Created an invite with a code of ${invite.code}`))\n * .catch(console.error);\n */\n createInvite(options = {}, reason) {\n return this.client.rest.methods.createChannelInvite(this, options, reason);\n }\n\n /**\n * Clone this channel.\n * @param {string} [name=this.name] Optional name for the new channel, otherwise it has the name of this channel\n * @param {boolean} [withPermissions=true] Whether to clone the channel with this channel's permission overwrites\n * @param {boolean} [withTopic=true] Whether to clone the channel with this channel's topic\n * @param {string} [reason] Reason for cloning this channel\n * @returns {Promise}\n * @example\n * // Clone a channel\n * channel.clone(undefined, true, false, 'Needed a clone')\n * .then(clone => console.log(`Cloned ${channel.name} to make a channel called ${clone.name}`))\n * .catch(console.error);\n */\n clone(name = this.name, withPermissions = true, withTopic = true, reason) {\n return this.guild.createChannel(name, {\n type: this.type,\n permissionOverwrites: withPermissions ? this.permissionOverwrites : undefined,\n topic: withTopic ? this.topic : undefined,\n reason,\n });\n }\n\n /**\n * Fetches a collection of invites to this guild channel.\n * Resolves with a collection mapping invites by their codes.\n * @returns {Promise>}\n */\n fetchInvites() {\n return this.client.rest.makeRequest('get', Constants.Endpoints.Channel(this.id).invites, true)\n .then(data => {\n const invites = new Collection();\n for (let invite of data) {\n invite = new Invite(this.client, invite);\n invites.set(invite.code, invite);\n }\n\n return invites;\n });\n }\n\n /**\n * Deletes this channel.\n * @param {string} [reason] Reason for deleting this channel\n * @returns {Promise}\n * @example\n * // Delete the channel\n * channel.delete('Making room for new channels')\n * .then(deleted => console.log(`Deleted ${deleted.name} to make room for new channels`))\n * .catch(console.error);\n */\n delete(reason) {\n return this.client.rest.methods.deleteChannel(this, reason);\n }\n\n /**\n * Checks if this channel has the same type, topic, position, name, overwrites and ID as another channel.\n * In most cases, a simple `channel.id === channel2.id` will do, and is much faster too.\n * @param {GuildChannel} channel Channel to compare with\n * @returns {boolean}\n */\n equals(channel) {\n let equal = channel &&\n this.id === channel.id &&\n this.type === channel.type &&\n this.topic === channel.topic &&\n this.position === channel.position &&\n this.name === channel.name;\n\n if (equal) {\n if (this.permissionOverwrites && channel.permissionOverwrites) {\n equal = this.permissionOverwrites.equals(channel.permissionOverwrites);\n } else {\n equal = !this.permissionOverwrites && !channel.permissionOverwrites;\n }\n }\n\n return equal;\n }\n\n /**\n * Whether the channel is deletable by the client user\n * @type {boolean}\n * @readonly\n */\n get deletable() {\n return this.id !== this.guild.id &&\n this.permissionsFor(this.client.user).has(Permissions.FLAGS.MANAGE_CHANNELS);\n }\n\n /**\n * Whether the channel is manageable by the client user\n * @type {boolean}\n * @readonly\n */\n get manageable() {\n if (this.client.user.id === this.guild.ownerID) return true;\n const permissions = this.permissionsFor(this.client.user);\n if (!permissions) return false;\n return permissions.has([Permissions.FLAGS.MANAGE_CHANNELS, Permissions.FLAGS.VIEW_CHANNEL]);\n }\n\n /**\n * Whether the channel is muted\n * This is only available when using a user account.\n * @type {?boolean}\n * @readonly\n * @deprecated\n */\n get muted() {\n if (this.client.user.bot) return null;\n try {\n return this.client.user.guildSettings.get(this.guild.id).channelOverrides.get(this.id).muted;\n } catch (err) {\n return false;\n }\n }\n\n /**\n * The type of message that should notify you\n * This is only available when using a user account.\n * @type {?MessageNotificationType}\n * @readonly\n * @deprecated\n */\n get messageNotifications() {\n if (this.client.user.bot) return null;\n try {\n return this.client.user.guildSettings.get(this.guild.id).channelOverrides.get(this.id).messageNotifications;\n } catch (err) {\n return Constants.MessageNotificationTypes[3];\n }\n }\n\n /**\n * When concatenated with a string, this automatically returns the channel's mention instead of the Channel object.\n * @returns {string}\n * @example\n * // Logs: Hello from <#123456789012345678>\n * console.log(`Hello from ${channel}`);\n * @example\n * // Logs: Hello from <#123456789012345678>\n * console.log('Hello from ' + channel);\n */\n toString() {\n return `<#${this.id}>`;\n }\n}\n\nmodule.exports = GuildChannel;\n\n\n//# sourceURL=webpack:///./src/structures/GuildChannel.js?"); +eval("const Channel = __webpack_require__(/*! ./Channel */ \"./src/structures/Channel.js\");\nconst Role = __webpack_require__(/*! ./Role */ \"./src/structures/Role.js\");\nconst PermissionOverwrites = __webpack_require__(/*! ./PermissionOverwrites */ \"./src/structures/PermissionOverwrites.js\");\nconst Permissions = __webpack_require__(/*! ../util/Permissions */ \"./src/util/Permissions.js\");\nconst Collection = __webpack_require__(/*! ../util/Collection */ \"./src/util/Collection.js\");\nconst Constants = __webpack_require__(/*! ../util/Constants */ \"./src/util/Constants.js\");\nconst Invite = __webpack_require__(/*! ./Invite */ \"./src/structures/Invite.js\");\nconst Util = __webpack_require__(/*! ../util/Util */ \"./src/util/Util.js\");\n\n/**\n * Represents a guild channel (i.e. text channels and voice channels).\n * @extends {Channel}\n */\nclass GuildChannel extends Channel {\n constructor(guild, data) {\n super(guild.client, data);\n\n /**\n * The guild the channel is in\n * @type {Guild}\n */\n this.guild = guild;\n }\n\n setup(data) {\n super.setup(data);\n\n /**\n * The name of the guild channel\n * @type {string}\n */\n this.name = data.name;\n\n /**\n * The position of the channel in the list\n * @type {number}\n */\n this.position = data.position;\n\n /**\n * The ID of the category parent of this channel\n * @type {?Snowflake}\n */\n this.parentID = data.parent_id;\n\n /**\n * A map of permission overwrites in this channel for roles and users\n * @type {Collection}\n */\n this.permissionOverwrites = new Collection();\n if (data.permission_overwrites) {\n for (const overwrite of data.permission_overwrites) {\n this.permissionOverwrites.set(overwrite.id, new PermissionOverwrites(this, overwrite));\n }\n }\n }\n\n /**\n * The position of the channel\n * @type {number}\n * @readonly\n */\n get calculatedPosition() {\n const sorted = this.guild._sortedChannels(this.type);\n return sorted.array().indexOf(sorted.get(this.id));\n }\n\n /**\n * The category parent of this channel\n * @type {?CategoryChannel}\n * @readonly\n */\n get parent() {\n return this.guild.channels.get(this.parentID) || null;\n }\n\n /**\n * If the permissionOverwrites match the parent channel, null if no parent\n * @type {?boolean}\n * @readonly\n */\n get permissionsLocked() {\n if (!this.parent) return null;\n if (this.permissionOverwrites.size !== this.parent.permissionOverwrites.size) return false;\n return this.permissionOverwrites.every((value, key) => {\n const testVal = this.parent.permissionOverwrites.get(key);\n return testVal !== undefined &&\n testVal.deny === value.deny &&\n testVal.allow === value.allow;\n });\n }\n\n /**\n * Gets the overall set of permissions for a user in this channel, taking into account channel overwrites.\n * @param {GuildMemberResolvable} member The user that you want to obtain the overall permissions for\n * @returns {?Permissions}\n */\n memberPermissions(member) {\n member = this.client.resolver.resolveGuildMember(this.guild, member);\n if (!member) return null;\n\n if (member.id === this.guild.ownerID) return new Permissions(member, Permissions.ALL);\n\n const roles = member.roles;\n const permissions = new Permissions(roles.map(role => role.permissions));\n\n if (permissions.has(Permissions.FLAGS.ADMINISTRATOR)) return new Permissions(Permissions.ALL).freeze();\n\n const overwrites = this.overwritesFor(member, true, roles);\n\n return permissions\n .remove(overwrites.everyone ? overwrites.everyone.deny : 0)\n .add(overwrites.everyone ? overwrites.everyone.allow : 0)\n .remove(overwrites.roles.length > 0 ? overwrites.roles.map(role => role.deny) : 0)\n .add(overwrites.roles.length > 0 ? overwrites.roles.map(role => role.allow) : 0)\n .remove(overwrites.member ? overwrites.member.deny : 0)\n .add(overwrites.member ? overwrites.member.allow : 0)\n .freeze();\n }\n\n /**\n * Gets the overall set of permissions for a role in this channel, taking into account channel overwrites.\n * @param {RoleResolvable} role The role that you want to obtain the overall permissions for\n * @returns {?Permissions}\n */\n rolePermissions(role) {\n if (role.permissions & Permissions.FLAGS.ADMINISTRATOR) return new Permissions(Permissions.ALL).freeze();\n\n const everyoneOverwrites = this.permissionOverwrites.get(this.guild.id);\n const roleOverwrites = this.permissionOverwrites.get(role.id);\n\n return new Permissions(role.permissions)\n .remove(everyoneOverwrites ? everyoneOverwrites.deny : 0)\n .add(everyoneOverwrites ? everyoneOverwrites.allow : 0)\n .remove(roleOverwrites ? roleOverwrites.deny : 0)\n .add(roleOverwrites ? roleOverwrites.allow : 0)\n .freeze();\n }\n\n /**\n * Get the overall set of permissions for a member or role in this channel, taking into account channel overwrites.\n * @param {GuildMemberResolvable|RoleResolvable} memberOrRole The member or role to obtain the overall permissions for\n * @returns {?Permissions}\n */\n permissionsFor(memberOrRole) {\n const member = this.guild.member(memberOrRole);\n if (member) return this.memberPermissions(member);\n const role = this.client.resolver.resolveRole(this.guild, memberOrRole);\n if (role) return this.rolePermissions(role);\n return null;\n }\n\n overwritesFor(member, verified = false, roles = null) {\n if (!verified) member = this.client.resolver.resolveGuildMember(this.guild, member);\n if (!member) return [];\n\n roles = roles || member.roles;\n const roleOverwrites = [];\n let memberOverwrites;\n let everyoneOverwrites;\n\n for (const overwrite of this.permissionOverwrites.values()) {\n if (overwrite.id === this.guild.id) {\n everyoneOverwrites = overwrite;\n } else if (roles.has(overwrite.id)) {\n roleOverwrites.push(overwrite);\n } else if (overwrite.id === member.id) {\n memberOverwrites = overwrite;\n }\n }\n\n return {\n everyone: everyoneOverwrites,\n roles: roleOverwrites,\n member: memberOverwrites,\n };\n }\n\n /**\n * Replaces the permission overwrites for a channel\n * @param {Object} [options] Options\n * @param {ChannelCreationOverwrites[]|Collection} [options.overwrites]\n * Permission overwrites\n * @param {string} [options.reason] Reason for updating the channel overwrites\n * @returns {Promise}\n * @example\n * channel.replacePermissionOverwrites({\n * overwrites: [\n * {\n * id: message.author.id,\n * denied: ['VIEW_CHANNEL'],\n * },\n * ],\n * reason: 'Needed to change permissions'\n * });\n */\n replacePermissionOverwrites({ overwrites, reason } = {}) {\n return this.edit({ permissionOverwrites: overwrites, reason })\n .then(() => this);\n }\n\n /**\n * An object mapping permission flags to `true` (enabled), `null` (unset) or `false` (disabled).\n * ```js\n * {\n * 'SEND_MESSAGES': true,\n * 'EMBED_LINKS': null,\n * 'ATTACH_FILES': false,\n * }\n * ```\n * @typedef {Object} PermissionOverwriteOptions\n */\n\n /**\n * Overwrites the permissions for a user or role in this channel.\n * @param {Role|Snowflake|UserResolvable} userOrRole The user or role to update\n * @param {PermissionOverwriteOptions} options The configuration for the update\n * @param {string} [reason] Reason for creating/editing this overwrite\n * @returns {Promise}\n * @example\n * // Overwrite permissions for a message author\n * message.channel.overwritePermissions(message.author, {\n * SEND_MESSAGES: false\n * })\n * .then(updated => console.log(updated.permissionOverwrites.get(message.author.id)))\n * .catch(console.error);\n * @example\n * // Overwite permissions for a message author and reset some\n * message.channel.overwritePermissions(message.author, {\n * VIEW_CHANNEL: false,\n * SEND_MESSAGES: null\n * })\n * .then(updated => console.log(updated.permissionOverwrites.get(message.author.id)))\n * .catch(console.error);\n */\n overwritePermissions(userOrRole, options, reason) {\n const payload = {\n allow: 0,\n deny: 0,\n };\n\n if (userOrRole instanceof Role) {\n payload.type = 'role';\n } else if (this.guild.roles.has(userOrRole)) {\n userOrRole = this.guild.roles.get(userOrRole);\n payload.type = 'role';\n } else {\n userOrRole = this.client.resolver.resolveUser(userOrRole);\n payload.type = 'member';\n if (!userOrRole) return Promise.reject(new TypeError('Supplied parameter was neither a User nor a Role.'));\n }\n\n payload.id = userOrRole.id;\n\n const prevOverwrite = this.permissionOverwrites.get(userOrRole.id);\n\n if (prevOverwrite) {\n payload.allow = prevOverwrite.allow;\n payload.deny = prevOverwrite.deny;\n }\n\n for (const perm of Object.keys(options)) {\n if (options[perm] === true) {\n payload.allow |= Permissions.FLAGS[perm] || 0;\n payload.deny &= ~(Permissions.FLAGS[perm] || 0);\n } else if (options[perm] === false) {\n payload.allow &= ~(Permissions.FLAGS[perm] || 0);\n payload.deny |= Permissions.FLAGS[perm] || 0;\n } else if (options[perm] === null) {\n payload.allow &= ~(Permissions.FLAGS[perm] || 0);\n payload.deny &= ~(Permissions.FLAGS[perm] || 0);\n }\n }\n\n return this.client.rest.methods.setChannelOverwrite(this, payload, reason).then(() => this);\n }\n\n /**\n * Locks in the permission overwrites from the parent channel.\n * @returns {Promise}\n */\n lockPermissions() {\n if (!this.parent) return Promise.reject(new TypeError('Could not find a parent to this guild channel.'));\n const permissionOverwrites = this.parent.permissionOverwrites.map(overwrite => ({\n deny: overwrite.deny,\n allow: overwrite.allow,\n id: overwrite.id,\n type: overwrite.type,\n }));\n return this.edit({ permissionOverwrites });\n }\n\n /**\n * The data for a guild channel.\n * @typedef {Object} ChannelData\n * @property {string} [type] The type of the channel (Only when creating)\n * @property {string} [name] The name of the channel\n * @property {number} [position] The position of the channel\n * @property {string} [topic] The topic of the text channel\n * @property {boolean} [nsfw] Whether the channel is NSFW\n * @property {number} [bitrate] The bitrate of the voice channel\n * @property {number} [userLimit] The user limit of the channel\n * @property {CategoryChannel|Snowflake} [parent] The parent or parent ID of the channel\n * @property {ChannelCreationOverwrites[]|Collection} [permissionOverwrites]\n * Overwrites of the channel\n * @property {number} [rateLimitPerUser] The rate limit per user of the channel in seconds\n * @property {string} [reason] Reason for creating the channel (Only when creating)\n */\n\n /**\n * Edits the channel.\n * @param {ChannelData} data The new data for the channel\n * @param {string} [reason] Reason for editing this channel\n * @returns {Promise}\n * @example\n * // Edit a channel\n * channel.edit({ name: 'new-channel' })\n * .then(console.log)\n * .catch(console.error);\n */\n edit(data, reason) {\n return this.client.rest.methods.updateChannel(this, data, reason).then(() => this);\n }\n\n /**\n * Set a new name for the guild channel.\n * @param {string} name The new name for the guild channel\n * @param {string} [reason] Reason for changing the guild channel's name\n * @returns {Promise}\n * @example\n * // Set a new channel name\n * channel.setName('not_general')\n * .then(newChannel => console.log(`Channel's new name is ${newChannel.name}`))\n * .catch(console.error);\n */\n setName(name, reason) {\n return this.edit({ name }, reason);\n }\n\n /**\n * Set a new position for the guild channel.\n * @param {number} position The new position for the guild channel\n * @param {boolean} [relative=false] Move the position relative to its current value\n * @returns {Promise}\n * @example\n * // Set a new channel position\n * channel.setPosition(2)\n * .then(newChannel => console.log(`Channel's new position is ${newChannel.position}`))\n * .catch(console.error);\n */\n setPosition(position, relative) {\n return this.guild.setChannelPosition(this, position, relative).then(() => this);\n }\n\n /**\n * Set a new parent for the guild channel.\n * @param {CategoryChannel|SnowFlake} parent The new parent for the guild channel\n * @param {string} [reason] Reason for changing the guild channel's parent\n * @returns {Promise}\n * @example\n * // Sets the parent of a channel\n * channel.setParent('174674066072928256')\n * .then(updated => console.log(`Set the category of ${updated.name} to ${updated.parent.name}`))\n * .catch(console.error);\n */\n setParent(parent, reason) {\n parent = this.client.resolver.resolveChannelID(parent);\n return this.edit({ parent }, reason);\n }\n\n /**\n * Set a new topic for the guild channel.\n * @param {string} topic The new topic for the guild channel\n * @param {string} [reason] Reason for changing the guild channel's topic\n * @returns {Promise}\n * @example\n * // Set a new channel topic\n * channel.setTopic('Needs more rate limiting')\n * .then(updated => console.log(`Channel's new topic is ${updated.topic}`))\n * .catch(console.error);\n */\n setTopic(topic, reason) {\n return this.edit({ topic }, reason);\n }\n\n /**\n * Create an invite to this guild channel.\n * This is only available when using a bot account.\n * @param {Object} [options={}] Options for the invite\n * @param {boolean} [options.temporary=false] Whether members that joined via the invite should be automatically\n * kicked after 24 hours if they have not yet received a role\n * @param {number} [options.maxAge=86400] How long the invite should last (in seconds, 0 for forever)\n * @param {number} [options.maxUses=0] Maximum number of uses\n * @param {boolean} [options.unique=false] Create a unique invite, or use an existing one with similar settings\n * @param {string} [reason] Reason for creating the invite\n * @returns {Promise}\n * @example\n * // Create an invite to a channel\n * channel.createInvite()\n * .then(invite => console.log(`Created an invite with a code of ${invite.code}`))\n * .catch(console.error);\n */\n createInvite(options = {}, reason) {\n return this.client.rest.methods.createChannelInvite(this, options, reason);\n }\n\n /* eslint-disable max-len */\n /**\n * Options to clone a guild channel.\n * @typedef {Object} GuildChannelCloneOptions\n * @property {string} [name=this.name] Name of the new channel\n * @property {ChannelCreationOverwrites[]|Collection} [permissionOverwrites=this.permissionOverwrites]\n * Permission overwrites of the new channel\n * @property {string} [type=this.type] Type of the new channel\n * @property {string} [topic=this.topic] Topic of the new channel (only text)\n * @property {boolean} [nsfw=this.nsfw] Whether the new channel is nsfw (only text)\n * @property {number} [bitrate=this.bitrate] Bitrate of the new channel in bits (only voice)\n * @property {number} [userLimit=this.userLimit] Maximum amount of users allowed in the new channel (only voice)\n * @property {number} [rateLimitPerUser=ThisType.rateLimitPerUser] Ratelimit per user for the new channel (only text)\n * @property {ChannelResolvable} [parent=this.parent] Parent of the new channel\n * @property {string} [reason] Reason for cloning this channel\n */\n /* eslint-enable max-len */\n\n /**\n * Clone this channel.\n * @param {string|GuildChannelCloneOptions} [nameOrOptions={}] Name for the new channel.\n * **(deprecated, use options)**\n * Alternatively options for cloning the channel\n * @param {boolean} [withPermissions=true] Whether to clone the channel with this channel's permission overwrites\n * **(deprecated, use options)**\n * @param {boolean} [withTopic=true] Whether to clone the channel with this channel's topic\n * **(deprecated, use options)**\n * @param {string} [reason] Reason for cloning this channel **(deprecated, user options)**\n * @returns {Promise}\n * @example\n * // Clone a channel\n * channel.clone({ topic: null, reason: 'Needed a clone' })\n * .then(clone => console.log(`Cloned ${channel.name} to make a channel called ${clone.name}`))\n * .catch(console.error);\n */\n clone(nameOrOptions = {}, withPermissions = true, withTopic = true, reason) {\n // If more than one parameter was specified or the first is a string,\n // convert them to a compatible options object and issue a warning\n if (arguments.length > 1 || typeof nameOrOptions === 'string') {\n ((any, ...more) => console.warn(any, more))(\n 'GuildChannel#clone: Clone channels using an options object instead of separate parameters.',\n 'Deprecation Warning'\n );\n\n nameOrOptions = {\n name: nameOrOptions,\n permissionOverwrites: withPermissions ? this.permissionOverwrites : null,\n topic: withTopic ? this.topic : null,\n reason: reason || null,\n };\n }\n\n Util.mergeDefault({\n name: this.name,\n permissionOverwrites: this.permissionOverwrites,\n topic: this.topic,\n type: this.type,\n nsfw: this.nsfw,\n parent: this.parent,\n bitrate: this.bitrate,\n userLimit: this.userLimit,\n rateLimitPerUser: this.rateLimitPerUser,\n reason: null,\n }, nameOrOptions);\n\n return this.guild.createChannel(nameOrOptions.name, nameOrOptions);\n }\n\n /**\n * Fetches a collection of invites to this guild channel.\n * Resolves with a collection mapping invites by their codes.\n * @returns {Promise>}\n */\n fetchInvites() {\n return this.client.rest.makeRequest('get', Constants.Endpoints.Channel(this.id).invites, true)\n .then(data => {\n const invites = new Collection();\n for (let invite of data) {\n invite = new Invite(this.client, invite);\n invites.set(invite.code, invite);\n }\n\n return invites;\n });\n }\n\n /**\n * Deletes this channel.\n * @param {string} [reason] Reason for deleting this channel\n * @returns {Promise}\n * @example\n * // Delete the channel\n * channel.delete('Making room for new channels')\n * .then(deleted => console.log(`Deleted ${deleted.name} to make room for new channels`))\n * .catch(console.error);\n */\n delete(reason) {\n return this.client.rest.methods.deleteChannel(this, reason);\n }\n\n /**\n * Checks if this channel has the same type, topic, position, name, overwrites and ID as another channel.\n * In most cases, a simple `channel.id === channel2.id` will do, and is much faster too.\n * @param {GuildChannel} channel Channel to compare with\n * @returns {boolean}\n */\n equals(channel) {\n let equal = channel &&\n this.id === channel.id &&\n this.type === channel.type &&\n this.topic === channel.topic &&\n this.position === channel.position &&\n this.name === channel.name;\n\n if (equal) {\n if (this.permissionOverwrites && channel.permissionOverwrites) {\n equal = this.permissionOverwrites.equals(channel.permissionOverwrites);\n } else {\n equal = !this.permissionOverwrites && !channel.permissionOverwrites;\n }\n }\n\n return equal;\n }\n\n /**\n * Whether the channel is deletable by the client user\n * @type {boolean}\n * @readonly\n */\n get deletable() {\n return this.id !== this.guild.id &&\n this.permissionsFor(this.client.user).has(Permissions.FLAGS.MANAGE_CHANNELS);\n }\n\n /**\n * Whether the channel is manageable by the client user\n * @type {boolean}\n * @readonly\n */\n get manageable() {\n if (this.client.user.id === this.guild.ownerID) return true;\n const permissions = this.permissionsFor(this.client.user);\n if (!permissions) return false;\n return permissions.has([Permissions.FLAGS.MANAGE_CHANNELS, Permissions.FLAGS.VIEW_CHANNEL]);\n }\n\n /**\n * Whether the channel is muted\n * This is only available when using a user account.\n * @type {?boolean}\n * @readonly\n * @deprecated\n */\n get muted() {\n if (this.client.user.bot) return null;\n try {\n return this.client.user.guildSettings.get(this.guild.id).channelOverrides.get(this.id).muted;\n } catch (err) {\n return false;\n }\n }\n\n /**\n * The type of message that should notify you\n * This is only available when using a user account.\n * @type {?MessageNotificationType}\n * @readonly\n * @deprecated\n */\n get messageNotifications() {\n if (this.client.user.bot) return null;\n try {\n return this.client.user.guildSettings.get(this.guild.id).channelOverrides.get(this.id).messageNotifications;\n } catch (err) {\n return Constants.MessageNotificationTypes[3];\n }\n }\n\n /**\n * When concatenated with a string, this automatically returns the channel's mention instead of the Channel object.\n * @returns {string}\n * @example\n * // Logs: Hello from <#123456789012345678>\n * console.log(`Hello from ${channel}`);\n * @example\n * // Logs: Hello from <#123456789012345678>\n * console.log('Hello from ' + channel);\n */\n toString() {\n return `<#${this.id}>`;\n }\n}\n\nmodule.exports = GuildChannel;\n\n\n//# sourceURL=webpack:///./src/structures/GuildChannel.js?"); /***/ }), @@ -1577,7 +1650,19 @@ eval("const Channel = __webpack_require__(/*! ./Channel */ \"./src/structures/Ch /*! ModuleConcatenation bailout: Module is not an ECMAScript module */ /***/ (function(module, exports, __webpack_require__) { -eval("const TextBasedChannel = __webpack_require__(/*! ./interfaces/TextBasedChannel */ \"./src/structures/interfaces/TextBasedChannel.js\");\nconst Role = __webpack_require__(/*! ./Role */ \"./src/structures/Role.js\");\nconst Permissions = __webpack_require__(/*! ../util/Permissions */ \"./src/util/Permissions.js\");\nconst Collection = __webpack_require__(/*! ../util/Collection */ \"./src/util/Collection.js\");\nconst { Presence } = __webpack_require__(/*! ./Presence */ \"./src/structures/Presence.js\");\nconst util = __webpack_require__(/*! util */ \"./node_modules/util/util.js\");\n\n/**\n * Represents a member of a guild on Discord.\n * @implements {TextBasedChannel}\n */\nclass GuildMember {\n constructor(guild, data) {\n /**\n * The client that instantiated this GuildMember\n * @name GuildMember#client\n * @type {Client}\n * @readonly\n */\n Object.defineProperty(this, 'client', { value: guild.client });\n\n /**\n * The guild that this member is part of\n * @type {Guild}\n */\n this.guild = guild;\n\n /**\n * The user that this member instance Represents\n * @type {User}\n */\n this.user = {};\n\n /**\n * The timestamp this member joined the guild at\n * @type {number}\n */\n this.joinedTimestamp = null;\n\n this._roles = [];\n if (data) this.setup(data);\n\n /**\n * The ID of the last message sent by this member in their guild, if one was sent\n * @type {?Snowflake}\n */\n this.lastMessageID = null;\n\n /**\n * The Message object of the last message sent by this member in their guild, if one was sent\n * @type {?Message}\n */\n this.lastMessage = null;\n\n /**\n * Whether the member has been removed from the guild\n * @type {boolean}\n */\n this.deleted = false;\n }\n\n setup(data) {\n /**\n * Whether this member is deafened server-wide\n * @type {boolean}\n */\n this.serverDeaf = data.deaf;\n\n /**\n * Whether this member is muted server-wide\n * @type {boolean}\n */\n this.serverMute = data.mute;\n\n /**\n * Whether this member is self-muted\n * @type {boolean}\n */\n this.selfMute = data.self_mute;\n\n /**\n * Whether this member is self-deafened\n * @type {boolean}\n */\n this.selfDeaf = data.self_deaf;\n\n /**\n * The voice session ID of this member, if any\n * @type {?Snowflake}\n */\n this.voiceSessionID = data.session_id;\n\n /**\n * The voice channel ID of this member, if any\n * @type {?Snowflake}\n */\n this.voiceChannelID = data.channel_id;\n\n /**\n * Whether this member is speaking and the client is in the same channel\n * @type {boolean}\n */\n this.speaking = false;\n\n /**\n * The nickname of this member, if they have one\n * @type {?string}\n */\n this.nickname = data.nick || null;\n\n if (data.joined_at) this.joinedTimestamp = new Date(data.joined_at).getTime();\n\n this.user = data.user;\n this._roles = data.roles;\n }\n\n /**\n * The time this member joined the guild\n * @type {?Date}\n * @readonly\n */\n get joinedAt() {\n return this.joinedTimestamp ? new Date(this.joinedTimestamp) : null;\n }\n\n /**\n * The presence of this member\n * @type {Presence}\n * @readonly\n */\n get presence() {\n return this.frozenPresence || this.guild.presences.get(this.id) || new Presence(undefined, this.client);\n }\n\n /**\n * A list of roles that are applied to this member, mapped by the role ID\n * @type {Collection}\n * @readonly\n */\n get roles() {\n const list = new Collection();\n const everyoneRole = this.guild.roles.get(this.guild.id);\n\n if (everyoneRole) list.set(everyoneRole.id, everyoneRole);\n\n for (const roleID of this._roles) {\n const role = this.guild.roles.get(roleID);\n if (role) list.set(role.id, role);\n }\n\n return list;\n }\n\n /**\n * The role of this member with the highest position\n * @type {Role}\n * @readonly\n */\n get highestRole() {\n return this.roles.reduce((prev, role) => !prev || role.comparePositionTo(prev) > 0 ? role : prev);\n }\n\n /**\n * The role of this member used to set their color\n * @type {?Role}\n * @readonly\n */\n get colorRole() {\n const coloredRoles = this.roles.filter(role => role.color);\n if (!coloredRoles.size) return null;\n return coloredRoles.reduce((prev, role) => !prev || role.comparePositionTo(prev) > 0 ? role : prev);\n }\n\n /**\n * The displayed color of this member in base 10\n * @type {number}\n * @readonly\n */\n get displayColor() {\n const role = this.colorRole;\n return (role && role.color) || 0;\n }\n\n /**\n * The displayed color of this member in hexadecimal\n * @type {string}\n * @readonly\n */\n get displayHexColor() {\n const role = this.colorRole;\n return (role && role.hexColor) || '#000000';\n }\n\n /**\n * The role of this member used to hoist them in a separate category in the users list\n * @type {?Role}\n * @readonly\n */\n get hoistRole() {\n const hoistedRoles = this.roles.filter(role => role.hoist);\n if (!hoistedRoles.size) return null;\n return hoistedRoles.reduce((prev, role) => !prev || role.comparePositionTo(prev) > 0 ? role : prev);\n }\n\n /**\n * Whether this member is muted in any way\n * @type {boolean}\n * @readonly\n */\n get mute() {\n return this.selfMute || this.serverMute;\n }\n\n /**\n * Whether this member is deafened in any way\n * @type {boolean}\n * @readonly\n */\n get deaf() {\n return this.selfDeaf || this.serverDeaf;\n }\n\n /**\n * The voice channel this member is in, if any\n * @type {?VoiceChannel}\n * @readonly\n */\n get voiceChannel() {\n return this.guild.channels.get(this.voiceChannelID);\n }\n\n /**\n * The ID of this user\n * @type {Snowflake}\n * @readonly\n */\n get id() {\n return this.user.id;\n }\n\n /**\n * The nickname of this member, or their username if they don't have one\n * @type {string}\n * @readonly\n */\n get displayName() {\n return this.nickname || this.user.username;\n }\n\n /**\n * The overall set of permissions for this member, taking only roles into account\n * @type {Permissions}\n * @readonly\n */\n get permissions() {\n if (this.user.id === this.guild.ownerID) return new Permissions(this, Permissions.ALL);\n\n let permissions = 0;\n const roles = this.roles;\n for (const role of roles.values()) permissions |= role.permissions;\n\n return new Permissions(this, permissions);\n }\n\n /**\n * Whether this member is manageable in terms of role hierarchy by the client user\n * @type {boolean}\n * @readonly\n */\n get manageable() {\n if (this.user.id === this.guild.ownerID) return false;\n if (this.user.id === this.client.user.id) return false;\n return this.guild.me.highestRole.comparePositionTo(this.highestRole) > 0;\n }\n\n /**\n * Whether this member is kickable by the client user\n * @type {boolean}\n * @readonly\n */\n get kickable() {\n return this.manageable && this.guild.me.permissions.has(Permissions.FLAGS.KICK_MEMBERS);\n }\n\n /**\n * Whether this member is bannable by the client user\n * @type {boolean}\n * @readonly\n */\n get bannable() {\n return this.manageable && this.guild.me.permissions.has(Permissions.FLAGS.BAN_MEMBERS);\n }\n\n /**\n * Returns `channel.permissionsFor(guildMember)`. Returns permissions for this member in a guild channel,\n * taking into account roles and permission overwrites.\n * @param {ChannelResolvable} channel The guild channel to use as context\n * @returns {?Permissions}\n */\n permissionsIn(channel) {\n channel = this.client.resolver.resolveChannel(channel);\n if (!channel || !channel.guild) throw new Error('Could not resolve channel to a guild channel.');\n return channel.permissionsFor(this);\n }\n\n /**\n * Checks if any of this member's roles have a permission.\n * @param {PermissionResolvable} permission Permission(s) to check for\n * @param {boolean} [explicit=false] Whether to require the role to explicitly have the exact permission\n * **(deprecated)**\n * @param {boolean} [checkAdmin] Whether to allow the administrator permission to override\n * (takes priority over `explicit`)\n * @param {boolean} [checkOwner] Whether to allow being the guild's owner to override\n * (takes priority over `explicit`)\n * @returns {boolean}\n */\n hasPermission(permission, explicit = false, checkAdmin, checkOwner) {\n if (typeof checkAdmin === 'undefined') checkAdmin = !explicit;\n if (typeof checkOwner === 'undefined') checkOwner = !explicit;\n if (checkOwner && this.user.id === this.guild.ownerID) return true;\n return this.roles.some(r => r.hasPermission(permission, undefined, checkAdmin));\n }\n\n /**\n * Checks whether the roles of this member allows them to perform specific actions.\n * @param {PermissionResolvable} permissions The permissions to check for\n * @param {boolean} [explicit=false] Whether to require the member to explicitly have the exact permissions\n * @returns {boolean}\n * @deprecated\n */\n hasPermissions(permissions, explicit = false) {\n if (!explicit && this.user.id === this.guild.ownerID) return true;\n return this.hasPermission(permissions, explicit);\n }\n\n /**\n * Checks whether the roles of this member allows them to perform specific actions, and lists any missing permissions.\n * @param {PermissionResolvable} permissions The permissions to check for\n * @param {boolean} [explicit=false] Whether to require the member to explicitly have the exact permissions\n * @returns {PermissionResolvable}\n */\n missingPermissions(permissions, explicit = false) {\n if (!(permissions instanceof Array)) permissions = [permissions];\n return this.permissions.missing(permissions, explicit);\n }\n\n /**\n * The data for editing this member.\n * @typedef {Object} GuildMemberEditData\n * @property {string} [nick] The nickname to set for the member\n * @property {Collection|RoleResolvable[]} [roles] The roles or role IDs to apply\n * @property {boolean} [mute] Whether or not the member should be muted\n * @property {boolean} [deaf] Whether or not the member should be deafened\n * @property {ChannelResolvable|null} [channel] Channel to move member to (if they are connected to voice), or `null`\n * if you want to kick them from voice\n */\n\n /**\n * Edits this member.\n * @param {GuildMemberEditData} data The data to edit the member with\n * @param {string} [reason] Reason for editing this user\n * @returns {Promise}\n * @example\n * // Set a member's nickname and clear their roles\n * message.member.edit({\n * nick: 'Cool Name',\n * roles: []\n * })\n * .then(console.log)\n * .catch(console.error);\n */\n edit(data, reason) {\n return this.client.rest.methods.updateGuildMember(this, data, reason);\n }\n\n /**\n * Mute/unmute this member.\n * @param {boolean} mute Whether or not the member should be muted\n * @param {string} [reason] Reason for muting or unmuting\n * @returns {Promise}\n * @example\n * // Mute a member with a reason\n * message.member.setMute(true, 'It needed to be done')\n * .then(() => console.log(`Muted ${message.member.displayName}`)))\n * .catch(console.error);\n */\n setMute(mute, reason) {\n return this.edit({ mute }, reason);\n }\n\n /**\n * Deafen/undeafen this member.\n * @param {boolean} deaf Whether or not the member should be deafened\n * @param {string} [reason] Reason for deafening or undeafening\n * @returns {Promise}\n * @example\n * // Deafen a member\n * message.member.setDeaf(true)\n * .then(() => console.log(`Deafened ${message.member.displayName}`))\n * .catch(console.error);\n */\n setDeaf(deaf, reason) {\n return this.edit({ deaf }, reason);\n }\n\n /**\n * Moves this member to the given channel.\n * @param {ChannelResolvable|null} channel Channel to move the member to, or `null` if you want to kick them from\n * voice\n * @returns {Promise}\n * @example\n * // Moves a member to a voice channel\n * member.setVoiceChannel('174674066072928256')\n * .then(() => console.log(`Moved ${member.displayName}`))\n * .catch(console.error);\n */\n setVoiceChannel(channel) {\n return this.edit({ channel });\n }\n\n /**\n * Sets the roles applied to this member.\n * @param {Collection|RoleResolvable[]} roles The roles or role IDs to apply\n * @param {string} [reason] Reason for applying the roles\n * @returns {Promise}\n * @example\n * // Set the member's roles to a single role\n * guildMember.setRoles(['391156570408615936'])\n * .then(console.log)\n * .catch(console.error);\n * @example\n * // Remove all of the member's roles\n * guildMember.setRoles([])\n * .then(member => console.log(`${member.displayName} now has ${member.roles.size} roles`))\n * .catch(console.error);\n */\n setRoles(roles, reason) {\n return this.edit({ roles }, reason);\n }\n\n /**\n * Adds a single role to this member.\n * @param {RoleResolvable} role The role or ID of the role to add\n * @param {string} [reason] Reason for adding the role\n * @returns {Promise}\n * @example\n * // Give a role to a member\n * message.member.addRole('193654001089118208')\n * .then(console.log)\n * .catch(console.error);\n */\n addRole(role, reason) {\n if (!(role instanceof Role)) role = this.guild.roles.get(role);\n if (!role) return Promise.reject(new TypeError('Supplied parameter was neither a Role nor a Snowflake.'));\n return this.client.rest.methods.addMemberRole(this, role, reason);\n }\n\n /**\n * Adds multiple roles to this member.\n * @param {Collection|RoleResolvable[]} roles The roles or role IDs to add\n * @param {string} [reason] Reason for adding the roles\n * @returns {Promise}\n * @example\n * // Gives a member a few roles\n * message.member.addRoles(['193654001089118208', '369308579892690945'])\n * .then(console.log)\n * .catch(console.error);\n */\n addRoles(roles, reason) {\n let allRoles;\n if (roles instanceof Collection) {\n allRoles = this._roles.slice();\n for (const role of roles.values()) allRoles.push(role.id);\n } else {\n allRoles = this._roles.concat(roles);\n }\n return this.edit({ roles: allRoles }, reason);\n }\n\n /**\n * Removes a single role from this member.\n * @param {RoleResolvable} role The role or ID of the role to remove\n * @param {string} [reason] Reason for removing the role\n * @returns {Promise}\n * @example\n * // Remove a role from a member\n * message.member.removeRole('193654001089118208')\n * .then(console.log)\n * .catch(console.error);\n */\n removeRole(role, reason) {\n if (!(role instanceof Role)) role = this.guild.roles.get(role);\n if (!role) return Promise.reject(new TypeError('Supplied parameter was neither a Role nor a Snowflake.'));\n return this.client.rest.methods.removeMemberRole(this, role, reason);\n }\n\n /**\n * Removes multiple roles from this member.\n * @param {Collection|RoleResolvable[]} roles The roles or role IDs to remove\n * @param {string} [reason] Reason for removing the roles\n * @returns {Promise}\n * @example\n * // Removes a few roles from the member\n * message.member.removeRoles(['193654001089118208', '369308579892690945'])\n * .then(console.log)\n * .catch(console.error);\n */\n removeRoles(roles, reason) {\n const allRoles = this._roles.slice();\n if (roles instanceof Collection) {\n for (const role of roles.values()) {\n const index = allRoles.indexOf(role.id);\n if (index >= 0) allRoles.splice(index, 1);\n }\n } else {\n for (const role of roles) {\n const index = allRoles.indexOf(role instanceof Role ? role.id : role);\n if (index >= 0) allRoles.splice(index, 1);\n }\n }\n return this.edit({ roles: allRoles }, reason);\n }\n\n /**\n * Set the nickname for this member.\n * @param {string} nick The nickname for the guild member\n * @param {string} [reason] Reason for setting the nickname\n * @returns {Promise}\n * @example\n * // Update the member's nickname\n * message.member.setNickname('Cool Name')\n * .then(console.log)\n * .catch(console.error);\n */\n setNickname(nick, reason) {\n return this.edit({ nick }, reason);\n }\n\n /**\n * Creates a DM channel between the client and this member.\n * @returns {Promise}\n */\n createDM() {\n return this.user.createDM();\n }\n\n /**\n * Deletes any DMs with this guild member.\n * @returns {Promise}\n */\n deleteDM() {\n return this.user.deleteDM();\n }\n\n /**\n * Kick this member from the guild.\n * @param {string} [reason] Reason for kicking user\n * @returns {Promise}\n * @example\n * // Kick a member\n * member.kick()\n * .then(() => console.log(`Kicked ${member.displayName}`))\n * .catch(console.error);\n */\n kick(reason) {\n return this.client.rest.methods.kickGuildMember(this.guild, this, reason);\n }\n\n /**\n * Ban this member.\n * @param {Object|number|string} [options] Ban options. If a number, the number of days to delete messages for, if a\n * string, the ban reason. Supplying an object allows you to do both.\n * @param {number} [options.days=0] Number of days of messages to delete\n * @param {string} [options.reason] Reason for banning\n * @returns {Promise}\n * @example\n * // Ban a guild member\n * member.ban(7)\n * .then(() => console.log(`Banned ${member.displayName}`))\n * .catch(console.error);\n */\n ban(options) {\n return this.guild.ban(this, options);\n }\n\n /**\n * When concatenated with a string, this automatically concatenates the user's mention instead of the Member object.\n * @returns {string}\n * @example\n * // Logs: Hello from <@123456789>!\n * console.log(`Hello from ${member}!`);\n */\n toString() {\n return `<@${this.nickname ? '!' : ''}${this.user.id}>`;\n }\n\n // These are here only for documentation purposes - they are implemented by TextBasedChannel\n /* eslint-disable no-empty-function */\n send() {}\n sendMessage() {}\n sendEmbed() {}\n sendFile() {}\n sendCode() {}\n}\n\nTextBasedChannel.applyToClass(GuildMember);\n\nGuildMember.prototype.hasPermissions = util.deprecate(GuildMember.prototype.hasPermissions,\n 'GuildMember#hasPermissions is deprecated - use GuildMember#hasPermission, it now takes an array');\nGuildMember.prototype.missingPermissions = util.deprecate(GuildMember.prototype.missingPermissions,\n 'GuildMember#missingPermissions is deprecated - use GuildMember#permissions.missing, it now takes an array');\n\nmodule.exports = GuildMember;\n\n\n//# sourceURL=webpack:///./src/structures/GuildMember.js?"); +eval("const TextBasedChannel = __webpack_require__(/*! ./interfaces/TextBasedChannel */ \"./src/structures/interfaces/TextBasedChannel.js\");\nconst Role = __webpack_require__(/*! ./Role */ \"./src/structures/Role.js\");\nconst Permissions = __webpack_require__(/*! ../util/Permissions */ \"./src/util/Permissions.js\");\nconst Collection = __webpack_require__(/*! ../util/Collection */ \"./src/util/Collection.js\");\nconst { Presence } = __webpack_require__(/*! ./Presence */ \"./src/structures/Presence.js\");\nconst util = __webpack_require__(/*! util */ \"./node_modules/util/util.js\");\n\n/**\n * Represents a member of a guild on Discord.\n * @implements {TextBasedChannel}\n */\nclass GuildMember {\n constructor(guild, data) {\n /**\n * The client that instantiated this GuildMember\n * @name GuildMember#client\n * @type {Client}\n * @readonly\n */\n Object.defineProperty(this, 'client', { value: guild.client });\n\n /**\n * The guild that this member is part of\n * @type {Guild}\n */\n this.guild = guild;\n\n /**\n * The user that this member instance Represents\n * @type {User}\n */\n this.user = {};\n\n /**\n * The timestamp this member joined the guild at\n * @type {number}\n */\n this.joinedTimestamp = null;\n\n /**\n * The timestamp of when the member used their Nitro boost on the guild, if it was used\n * @type {?number}\n */\n this.premiumSinceTimestamp = null;\n\n this._roles = [];\n if (data) this.setup(data);\n\n /**\n * The ID of the last message sent by this member in their guild, if one was sent\n * @type {?Snowflake}\n */\n this.lastMessageID = null;\n\n /**\n * The Message object of the last message sent by this member in their guild, if one was sent\n * @type {?Message}\n */\n this.lastMessage = null;\n\n /**\n * Whether the member has been removed from the guild\n * @type {boolean}\n */\n this.deleted = false;\n }\n\n setup(data) {\n /**\n * Whether this member is deafened server-wide\n * @type {boolean}\n */\n this.serverDeaf = data.deaf;\n\n /**\n * Whether this member is muted server-wide\n * @type {boolean}\n */\n this.serverMute = data.mute;\n\n /**\n * Whether this member is self-muted\n * @type {boolean}\n */\n this.selfMute = data.self_mute;\n\n /**\n * Whether this member is self-deafened\n * @type {boolean}\n */\n this.selfDeaf = data.self_deaf;\n\n /**\n * Whether this member is streaming using \"Go Live\"\n * @type {boolean}\n */\n this.selfStream = data.self_stream || false;\n\n /**\n * The voice session ID of this member, if any\n * @type {?Snowflake}\n */\n this.voiceSessionID = data.session_id;\n\n /**\n * The voice channel ID of this member, if any\n * @type {?Snowflake}\n */\n this.voiceChannelID = data.channel_id;\n\n /**\n * Whether this member is speaking and the client is in the same channel\n * @type {boolean}\n */\n this.speaking = false;\n\n /**\n * The nickname of this member, if they have one\n * @type {?string}\n */\n this.nickname = data.nick || null;\n\n if (data.joined_at) this.joinedTimestamp = new Date(data.joined_at).getTime();\n if (data.premium_since) this.premiumSinceTimestamp = new Date(data.premium_since).getTime();\n\n this.user = data.user;\n this._roles = data.roles;\n }\n\n /**\n * The time this member joined the guild\n * @type {?Date}\n * @readonly\n */\n get joinedAt() {\n return this.joinedTimestamp ? new Date(this.joinedTimestamp) : null;\n }\n\n /**\n * The time of when the member used their Nitro boost on the guild, if it was used\n * @type {?Date}\n * @readonly\n */\n get premiumSince() {\n return this.premiumSinceTimestamp ? new Date(this.premiumSinceTimestamp) : null;\n }\n\n /**\n * The presence of this member\n * @type {Presence}\n * @readonly\n */\n get presence() {\n return this.frozenPresence || this.guild.presences.get(this.id) || new Presence(undefined, this.client);\n }\n\n /**\n * A list of roles that are applied to this member, mapped by the role ID\n * @type {Collection}\n * @readonly\n */\n get roles() {\n const list = new Collection();\n const everyoneRole = this.guild.roles.get(this.guild.id);\n\n if (everyoneRole) list.set(everyoneRole.id, everyoneRole);\n\n for (const roleID of this._roles) {\n const role = this.guild.roles.get(roleID);\n if (role) list.set(role.id, role);\n }\n\n return list;\n }\n\n /**\n * The role of this member with the highest position\n * @type {Role}\n * @readonly\n */\n get highestRole() {\n return this.roles.reduce((prev, role) => !prev || role.comparePositionTo(prev) > 0 ? role : prev);\n }\n\n /**\n * The role of this member used to set their color\n * @type {?Role}\n * @readonly\n */\n get colorRole() {\n const coloredRoles = this.roles.filter(role => role.color);\n if (!coloredRoles.size) return null;\n return coloredRoles.reduce((prev, role) => !prev || role.comparePositionTo(prev) > 0 ? role : prev);\n }\n\n /**\n * The displayed color of this member in base 10\n * @type {number}\n * @readonly\n */\n get displayColor() {\n const role = this.colorRole;\n return (role && role.color) || 0;\n }\n\n /**\n * The displayed color of this member in hexadecimal\n * @type {string}\n * @readonly\n */\n get displayHexColor() {\n const role = this.colorRole;\n return (role && role.hexColor) || '#000000';\n }\n\n /**\n * The role of this member used to hoist them in a separate category in the users list\n * @type {?Role}\n * @readonly\n */\n get hoistRole() {\n const hoistedRoles = this.roles.filter(role => role.hoist);\n if (!hoistedRoles.size) return null;\n return hoistedRoles.reduce((prev, role) => !prev || role.comparePositionTo(prev) > 0 ? role : prev);\n }\n\n /**\n * Whether this member is muted in any way\n * @type {boolean}\n * @readonly\n */\n get mute() {\n return this.selfMute || this.serverMute;\n }\n\n /**\n * Whether this member is deafened in any way\n * @type {boolean}\n * @readonly\n */\n get deaf() {\n return this.selfDeaf || this.serverDeaf;\n }\n\n /**\n * The voice channel this member is in, if any\n * @type {?VoiceChannel}\n * @readonly\n */\n get voiceChannel() {\n return this.guild.channels.get(this.voiceChannelID);\n }\n\n /**\n * The ID of this user\n * @type {Snowflake}\n * @readonly\n */\n get id() {\n return this.user.id;\n }\n\n /**\n * The nickname of this member, or their username if they don't have one\n * @type {string}\n * @readonly\n */\n get displayName() {\n return this.nickname || this.user.username;\n }\n\n /**\n * The overall set of permissions for this member, taking only roles into account\n * @type {Permissions}\n * @readonly\n */\n get permissions() {\n if (this.user.id === this.guild.ownerID) return new Permissions(this, Permissions.ALL);\n\n let permissions = 0;\n const roles = this.roles;\n for (const role of roles.values()) permissions |= role.permissions;\n\n return new Permissions(this, permissions);\n }\n\n /**\n * Whether this member is manageable in terms of role hierarchy by the client user\n * @type {boolean}\n * @readonly\n */\n get manageable() {\n if (this.user.id === this.guild.ownerID) return false;\n if (this.user.id === this.client.user.id) return false;\n if (this.client.user.id === this.guild.ownerID) return true;\n return this.guild.me.highestRole.comparePositionTo(this.highestRole) > 0;\n }\n\n /**\n * Whether this member is kickable by the client user\n * @type {boolean}\n * @readonly\n */\n get kickable() {\n return this.manageable && this.guild.me.permissions.has(Permissions.FLAGS.KICK_MEMBERS);\n }\n\n /**\n * Whether this member is bannable by the client user\n * @type {boolean}\n * @readonly\n */\n get bannable() {\n return this.manageable && this.guild.me.permissions.has(Permissions.FLAGS.BAN_MEMBERS);\n }\n\n /**\n * Returns `channel.permissionsFor(guildMember)`. Returns permissions for this member in a guild channel,\n * taking into account roles and permission overwrites.\n * @param {ChannelResolvable} channel The guild channel to use as context\n * @returns {?Permissions}\n */\n permissionsIn(channel) {\n channel = this.client.resolver.resolveChannel(channel);\n if (!channel || !channel.guild) throw new Error('Could not resolve channel to a guild channel.');\n return channel.permissionsFor(this);\n }\n\n /**\n * Checks if any of this member's roles have a permission.\n * @param {PermissionResolvable} permission Permission(s) to check for\n * @param {boolean} [explicit=false] Whether to require the role to explicitly have the exact permission\n * **(deprecated)**\n * @param {boolean} [checkAdmin] Whether to allow the administrator permission to override\n * (takes priority over `explicit`)\n * @param {boolean} [checkOwner] Whether to allow being the guild's owner to override\n * (takes priority over `explicit`)\n * @returns {boolean}\n */\n hasPermission(permission, explicit = false, checkAdmin, checkOwner) {\n if (typeof checkAdmin === 'undefined') checkAdmin = !explicit;\n if (typeof checkOwner === 'undefined') checkOwner = !explicit;\n if (checkOwner && this.user.id === this.guild.ownerID) return true;\n return this.roles.some(r => r.hasPermission(permission, undefined, checkAdmin));\n }\n\n /**\n * Checks whether the roles of this member allows them to perform specific actions.\n * @param {PermissionResolvable} permissions The permissions to check for\n * @param {boolean} [explicit=false] Whether to require the member to explicitly have the exact permissions\n * @returns {boolean}\n * @deprecated\n */\n hasPermissions(permissions, explicit = false) {\n if (!explicit && this.user.id === this.guild.ownerID) return true;\n return this.hasPermission(permissions, explicit);\n }\n\n /**\n * Checks whether the roles of this member allows them to perform specific actions, and lists any missing permissions.\n * @param {PermissionResolvable} permissions The permissions to check for\n * @param {boolean} [explicit=false] Whether to require the member to explicitly have the exact permissions\n * @returns {PermissionResolvable}\n */\n missingPermissions(permissions, explicit = false) {\n if (!(permissions instanceof Array)) permissions = [permissions];\n return this.permissions.missing(permissions, explicit);\n }\n\n /**\n * The data for editing this member.\n * @typedef {Object} GuildMemberEditData\n * @property {string} [nick] The nickname to set for the member\n * @property {Collection|RoleResolvable[]} [roles] The roles or role IDs to apply\n * @property {boolean} [mute] Whether or not the member should be muted\n * @property {boolean} [deaf] Whether or not the member should be deafened\n * @property {ChannelResolvable|null} [channel] Channel to move member to (if they are connected to voice), or `null`\n * if you want to kick them from voice\n */\n\n /**\n * Edits this member.\n * @param {GuildMemberEditData} data The data to edit the member with\n * @param {string} [reason] Reason for editing this user\n * @returns {Promise}\n * @example\n * // Set a member's nickname and clear their roles\n * message.member.edit({\n * nick: 'Cool Name',\n * roles: []\n * })\n * .then(console.log)\n * .catch(console.error);\n */\n edit(data, reason) {\n return this.client.rest.methods.updateGuildMember(this, data, reason);\n }\n\n /**\n * Mute/unmute this member.\n * @param {boolean} mute Whether or not the member should be muted\n * @param {string} [reason] Reason for muting or unmuting\n * @returns {Promise}\n * @example\n * // Mute a member with a reason\n * message.member.setMute(true, 'It needed to be done')\n * .then(() => console.log(`Muted ${message.member.displayName}`)))\n * .catch(console.error);\n */\n setMute(mute, reason) {\n return this.edit({ mute }, reason);\n }\n\n /**\n * Deafen/undeafen this member.\n * @param {boolean} deaf Whether or not the member should be deafened\n * @param {string} [reason] Reason for deafening or undeafening\n * @returns {Promise}\n * @example\n * // Deafen a member\n * message.member.setDeaf(true)\n * .then(() => console.log(`Deafened ${message.member.displayName}`))\n * .catch(console.error);\n */\n setDeaf(deaf, reason) {\n return this.edit({ deaf }, reason);\n }\n\n /**\n * Moves this member to the given channel.\n * @param {ChannelResolvable|null} channel Channel to move the member to, or `null` if you want to kick them from\n * voice\n * @returns {Promise}\n * @example\n * // Moves a member to a voice channel\n * member.setVoiceChannel('174674066072928256')\n * .then(() => console.log(`Moved ${member.displayName}`))\n * .catch(console.error);\n */\n setVoiceChannel(channel) {\n return this.edit({ channel });\n }\n\n /**\n * Sets the roles applied to this member.\n * @param {Collection|RoleResolvable[]} roles The roles or role IDs to apply\n * @param {string} [reason] Reason for applying the roles\n * @returns {Promise}\n * @example\n * // Set the member's roles to a single role\n * guildMember.setRoles(['391156570408615936'])\n * .then(console.log)\n * .catch(console.error);\n * @example\n * // Remove all of the member's roles\n * guildMember.setRoles([])\n * .then(member => console.log(`${member.displayName} now has ${member.roles.size} roles`))\n * .catch(console.error);\n */\n setRoles(roles, reason) {\n return this.edit({ roles }, reason);\n }\n\n /**\n * Adds a single role to this member.\n * @param {RoleResolvable} role The role or ID of the role to add\n * @param {string} [reason] Reason for adding the role\n * @returns {Promise}\n * @example\n * // Give a role to a member\n * message.member.addRole('193654001089118208')\n * .then(console.log)\n * .catch(console.error);\n */\n addRole(role, reason) {\n if (!(role instanceof Role)) role = this.guild.roles.get(role);\n if (!role) return Promise.reject(new TypeError('Supplied parameter was neither a Role nor a Snowflake.'));\n return this.client.rest.methods.addMemberRole(this, role, reason);\n }\n\n /**\n * Adds multiple roles to this member.\n * @param {Collection|RoleResolvable[]} roles The roles or role IDs to add\n * @param {string} [reason] Reason for adding the roles\n * @returns {Promise}\n * @example\n * // Gives a member a few roles\n * message.member.addRoles(['193654001089118208', '369308579892690945'])\n * .then(console.log)\n * .catch(console.error);\n */\n addRoles(roles, reason) {\n let allRoles;\n if (roles instanceof Collection) {\n allRoles = this._roles.slice();\n for (const role of roles.values()) allRoles.push(role.id);\n } else {\n allRoles = this._roles.concat(roles);\n }\n return this.edit({ roles: allRoles }, reason);\n }\n\n /**\n * Removes a single role from this member.\n * @param {RoleResolvable} role The role or ID of the role to remove\n * @param {string} [reason] Reason for removing the role\n * @returns {Promise}\n * @example\n * // Remove a role from a member\n * message.member.removeRole('193654001089118208')\n * .then(console.log)\n * .catch(console.error);\n */\n removeRole(role, reason) {\n if (!(role instanceof Role)) role = this.guild.roles.get(role);\n if (!role) return Promise.reject(new TypeError('Supplied parameter was neither a Role nor a Snowflake.'));\n return this.client.rest.methods.removeMemberRole(this, role, reason);\n }\n\n /**\n * Removes multiple roles from this member.\n * @param {Collection|RoleResolvable[]} roles The roles or role IDs to remove\n * @param {string} [reason] Reason for removing the roles\n * @returns {Promise}\n * @example\n * // Removes a few roles from the member\n * message.member.removeRoles(['193654001089118208', '369308579892690945'])\n * .then(console.log)\n * .catch(console.error);\n */\n removeRoles(roles, reason) {\n const allRoles = this._roles.slice();\n if (roles instanceof Collection) {\n for (const role of roles.values()) {\n const index = allRoles.indexOf(role.id);\n if (index >= 0) allRoles.splice(index, 1);\n }\n } else {\n for (const role of roles) {\n const index = allRoles.indexOf(role instanceof Role ? role.id : role);\n if (index >= 0) allRoles.splice(index, 1);\n }\n }\n return this.edit({ roles: allRoles }, reason);\n }\n\n /**\n * Set the nickname for this member.\n * @param {string} nick The nickname for the guild member\n * @param {string} [reason] Reason for setting the nickname\n * @returns {Promise}\n * @example\n * // Update the member's nickname\n * message.member.setNickname('Cool Name')\n * .then(console.log)\n * .catch(console.error);\n */\n setNickname(nick, reason) {\n return this.edit({ nick }, reason);\n }\n\n /**\n * Creates a DM channel between the client and this member.\n * @returns {Promise}\n */\n createDM() {\n return this.user.createDM();\n }\n\n /**\n * Deletes any DMs with this guild member.\n * @returns {Promise}\n */\n deleteDM() {\n return this.user.deleteDM();\n }\n\n /**\n * Kick this member from the guild.\n * @param {string} [reason] Reason for kicking user\n * @returns {Promise}\n * @example\n * // Kick a member\n * member.kick()\n * .then(() => console.log(`Kicked ${member.displayName}`))\n * .catch(console.error);\n */\n kick(reason) {\n return this.client.rest.methods.kickGuildMember(this.guild, this, reason);\n }\n\n /**\n * Ban this member.\n * @param {Object|number|string} [options] Ban options. If a number, the number of days to delete messages for, if a\n * string, the ban reason. Supplying an object allows you to do both.\n * @param {number} [options.days=0] Number of days of messages to delete\n * @param {string} [options.reason] Reason for banning\n * @returns {Promise}\n * @example\n * // Ban a guild member\n * member.ban(7)\n * .then(() => console.log(`Banned ${member.displayName}`))\n * .catch(console.error);\n */\n ban(options) {\n return this.guild.ban(this, options);\n }\n\n /**\n * When concatenated with a string, this automatically concatenates the user's mention instead of the Member object.\n * @returns {string}\n * @example\n * // Logs: Hello from <@123456789>!\n * console.log(`Hello from ${member}!`);\n */\n toString() {\n return `<@${this.nickname ? '!' : ''}${this.user.id}>`;\n }\n\n // These are here only for documentation purposes - they are implemented by TextBasedChannel\n /* eslint-disable no-empty-function */\n send() {}\n sendMessage() {}\n sendEmbed() {}\n sendFile() {}\n sendCode() {}\n}\n\nTextBasedChannel.applyToClass(GuildMember);\n\nGuildMember.prototype.hasPermissions = util.deprecate(GuildMember.prototype.hasPermissions,\n 'GuildMember#hasPermissions is deprecated - use GuildMember#hasPermission, it now takes an array');\nGuildMember.prototype.missingPermissions = util.deprecate(GuildMember.prototype.missingPermissions,\n 'GuildMember#missingPermissions is deprecated - use GuildMember#permissions.missing, it now takes an array');\n\nmodule.exports = GuildMember;\n\n\n//# sourceURL=webpack:///./src/structures/GuildMember.js?"); + +/***/ }), + +/***/ "./src/structures/Integration.js": +/*!***************************************!*\ + !*** ./src/structures/Integration.js ***! + \***************************************/ +/*! no static exports found */ +/*! ModuleConcatenation bailout: Module is not an ECMAScript module */ +/***/ (function(module, exports) { + +eval("/**\n * The information account for an integration\n * @typedef {Object} IntegrationAccount\n * @property {string} id The id of the account\n * @property {string} name The name of the account\n */\n\n/**\n * Represents a guild integration.\n */\nclass Integration {\n constructor(client, data, guild) {\n /**\n * The client that created this integration\n * @name Integration#client\n * @type {Client}\n * @readonly\n */\n Object.defineProperty(this, 'client', { value: client });\n\n /**\n * The guild this integration belongs to\n * @type {Guild}\n */\n this.guild = guild;\n\n /**\n * The integration id\n * @type {Snowflake}\n */\n this.id = data.id;\n\n /**\n * The integration name\n * @type {string}\n */\n this.name = data.name;\n /**\n * The integration type (twitch, youtube, etc)\n * @type {string}\n */\n this.type = data.type;\n\n /**\n * Whether this integration is enabled\n * @type {boolean}\n */\n this.enabled = data.enabled;\n\n /**\n * Whether this integration is syncing\n * @type {boolean}\n */\n this.syncing = data.syncing;\n\n /**\n * The role that this integration uses for subscribers\n * @type {Role}\n */\n this.role = this.guild.roles.get(data.role_id);\n\n /**\n * The user for this integration\n * @type {User}\n */\n this.user = this.client.dataManager.newUser(data.user);\n\n /**\n * The account integration information\n * @type {IntegrationAccount}\n */\n this.account = data.account;\n\n /**\n * The last time this integration was last synced\n * @type {number}\n */\n this.syncedAt = data.synced_at;\n this._patch(data);\n }\n\n _patch(data) {\n /**\n * The behavior of expiring subscribers\n * @type {number}\n */\n this.expireBehavior = data.expire_behavior;\n\n /**\n * The grace period before expiring subscribers\n * @type {number}\n */\n this.expireGracePeriod = data.expire_grace_period;\n }\n\n /**\n * Syncs this integration\n * @returns {Promise}\n */\n sync() {\n this.syncing = true;\n return this.client.rest.methods.syncIntegration(this)\n .then(() => {\n this.syncing = false;\n this.syncedAt = Date.now();\n return this;\n });\n }\n\n /**\n * The data for editing an integration.\n * @typedef {Object} IntegrationEditData\n * @property {number} [expireBehavior] The new behaviour of expiring subscribers\n * @property {number} [expireGracePeriod] The new grace period before expiring subscribers\n */\n\n /**\n * Edits this integration.\n * @param {IntegrationEditData} data The data to edit this integration with\n * @param {string} reason Reason for editing this integration\n * @returns {Promise}\n */\n edit(data, reason) {\n if ('expireBehavior' in data) {\n data.expire_behavior = data.expireBehavior;\n data.expireBehavior = undefined;\n }\n if ('expireGracePeriod' in data) {\n data.expire_grace_period = data.expireGracePeriod;\n data.expireGracePeriod = undefined;\n }\n // The option enable_emoticons is only available for Twitch at this moment\n return this.client.rest.methods.editIntegration(this, data, reason)\n .then(() => {\n this._patch(data);\n return this;\n });\n }\n\n /**\n * Deletes this integration.\n * @returns {Promise}\n * @param {string} [reason] Reason for deleting this integration\n */\n delete(reason) {\n return this.client.rest.methods.deleteIntegration(this, reason)\n .then(() => this);\n }\n}\n\nmodule.exports = Integration;\n\n\n//# sourceURL=webpack:///./src/structures/Integration.js?"); /***/ }), @@ -1601,7 +1686,7 @@ eval("const PartialGuild = __webpack_require__(/*! ./PartialGuild */ \"./src/str /*! ModuleConcatenation bailout: Module is not an ECMAScript module */ /***/ (function(module, exports, __webpack_require__) { -eval("const Mentions = __webpack_require__(/*! ./MessageMentions */ \"./src/structures/MessageMentions.js\");\nconst Attachment = __webpack_require__(/*! ./MessageAttachment */ \"./src/structures/MessageAttachment.js\");\nconst Embed = __webpack_require__(/*! ./MessageEmbed */ \"./src/structures/MessageEmbed.js\");\nconst RichEmbed = __webpack_require__(/*! ./RichEmbed */ \"./src/structures/RichEmbed.js\");\nconst MessageReaction = __webpack_require__(/*! ./MessageReaction */ \"./src/structures/MessageReaction.js\");\nconst ReactionCollector = __webpack_require__(/*! ./ReactionCollector */ \"./src/structures/ReactionCollector.js\");\nconst Util = __webpack_require__(/*! ../util/Util */ \"./src/util/Util.js\");\nconst Collection = __webpack_require__(/*! ../util/Collection */ \"./src/util/Collection.js\");\nconst Constants = __webpack_require__(/*! ../util/Constants */ \"./src/util/Constants.js\");\nconst Permissions = __webpack_require__(/*! ../util/Permissions */ \"./src/util/Permissions.js\");\nlet GuildMember;\n\n/**\n * Represents a message on Discord.\n */\nclass Message {\n constructor(channel, data, client) {\n /**\n * The client that instantiated the Message\n * @name Message#client\n * @type {Client}\n * @readonly\n */\n Object.defineProperty(this, 'client', { value: client });\n\n /**\n * The channel that the message was sent in\n * @type {TextChannel|DMChannel|GroupDMChannel}\n */\n this.channel = channel;\n\n /**\n * Whether this message has been deleted\n * @type {boolean}\n */\n this.deleted = false;\n\n if (data) this.setup(data);\n }\n\n setup(data) { // eslint-disable-line complexity\n /**\n * The ID of the message\n * @type {Snowflake}\n */\n this.id = data.id;\n\n /**\n * The type of the message\n * @type {MessageType}\n */\n this.type = Constants.MessageTypes[data.type];\n\n /**\n * The content of the message\n * @type {string}\n */\n this.content = data.content;\n\n /**\n * The author of the message\n * @type {User}\n */\n this.author = this.client.dataManager.newUser(data.author, !data.webhook_id);\n\n /**\n * Represents the author of the message as a guild member\n * Only available if the message comes from a guild where the author is still a member\n * @type {?GuildMember}\n */\n this.member = this.guild ? this.guild.member(this.author) || null : null;\n\n /**\n * Whether or not this message is pinned\n * @type {boolean}\n */\n this.pinned = data.pinned;\n\n /**\n * Whether or not the message was Text-To-Speech\n * @type {boolean}\n */\n this.tts = data.tts;\n\n /**\n * A random number or string used for checking message delivery\n * @type {string}\n */\n this.nonce = data.nonce;\n\n /**\n * Whether or not this message was sent by Discord, not actually a user (e.g. pin notifications)\n * @type {boolean}\n */\n this.system = data.type === 6;\n\n /**\n * A list of embeds in the message - e.g. YouTube Player\n * @type {MessageEmbed[]}\n */\n this.embeds = data.embeds.map(e => new Embed(this, e));\n\n /**\n * A collection of attachments in the message - e.g. Pictures - mapped by their ID\n * @type {Collection}\n */\n this.attachments = new Collection();\n for (const attachment of data.attachments) this.attachments.set(attachment.id, new Attachment(this, attachment));\n\n /**\n * The timestamp the message was sent at\n * @type {number}\n */\n this.createdTimestamp = new Date(data.timestamp).getTime();\n\n /**\n * The timestamp the message was last edited at (if applicable)\n * @type {?number}\n */\n this.editedTimestamp = data.edited_timestamp ? new Date(data.edited_timestamp).getTime() : null;\n\n /**\n * A collection of reactions to this message, mapped by the reaction ID\n * @type {Collection}\n */\n this.reactions = new Collection();\n if (data.reactions && data.reactions.length > 0) {\n for (const reaction of data.reactions) {\n const id = reaction.emoji.id ? `${reaction.emoji.name}:${reaction.emoji.id}` : reaction.emoji.name;\n this.reactions.set(id, new MessageReaction(this, reaction.emoji, reaction.count, reaction.me));\n }\n }\n\n /**\n * All valid mentions that the message contains\n * @type {MessageMentions}\n */\n this.mentions = new Mentions(this, data.mentions, data.mention_roles, data.mention_everyone);\n\n /**\n * ID of the webhook that sent the message, if applicable\n * @type {?Snowflake}\n */\n this.webhookID = data.webhook_id || null;\n\n /**\n * Whether this message is a hit in a search\n * @type {?boolean}\n */\n this.hit = typeof data.hit === 'boolean' ? data.hit : null;\n\n /**\n * The previous versions of the message, sorted with the most recent first\n * @type {Message[]}\n * @private\n */\n this._edits = [];\n }\n\n /**\n * Updates the message.\n * @param {Object} data Raw Discord message update data\n * @private\n */\n patch(data) {\n const clone = Util.cloneObject(this);\n this._edits.unshift(clone);\n\n if ('edited_timestamp' in data) this.editedTimestamp = new Date(data.edited_timestamp).getTime();\n if ('content' in data) this.content = data.content;\n if ('pinned' in data) this.pinned = data.pinned;\n if ('tts' in data) this.tts = data.tts;\n if ('embeds' in data) this.embeds = data.embeds.map(e => new Embed(this, e));\n else this.embeds = this.embeds.slice();\n\n if ('attachments' in data) {\n this.attachments = new Collection();\n for (const attachment of data.attachments) this.attachments.set(attachment.id, new Attachment(this, attachment));\n } else {\n this.attachments = new Collection(this.attachments);\n }\n\n this.mentions = new Mentions(\n this,\n 'mentions' in data ? data.mentions : this.mentions.users,\n 'mentions_roles' in data ? data.mentions_roles : this.mentions.roles,\n 'mention_everyone' in data ? data.mention_everyone : this.mentions.everyone\n );\n }\n\n /**\n * The time the message was sent\n * @type {Date}\n * @readonly\n */\n get createdAt() {\n return new Date(this.createdTimestamp);\n }\n\n /**\n * The time the message was last edited at (if applicable)\n * @type {?Date}\n * @readonly\n */\n get editedAt() {\n return this.editedTimestamp ? new Date(this.editedTimestamp) : null;\n }\n\n /**\n * The guild the message was sent in (if in a guild channel)\n * @type {?Guild}\n * @readonly\n */\n get guild() {\n return this.channel.guild || null;\n }\n\n /**\n * The url to jump to the message\n * @type {string}\n * @readonly\n */\n get url() {\n return `https://discordapp.com/channels/${this.guild ? this.guild.id : '@me'}/${this.channel.id}/${this.id}`;\n }\n\n /**\n * The message contents with all mentions replaced by the equivalent text.\n * If mentions cannot be resolved to a name, the relevant mention in the message content will not be converted.\n * @type {string}\n * @readonly\n */\n get cleanContent() {\n return this.content\n .replace(/@(everyone|here)/g, '@\\u200b$1')\n .replace(/<@!?[0-9]+>/g, input => {\n const id = input.replace(/<|!|>|@/g, '');\n if (this.channel.type === 'dm' || this.channel.type === 'group') {\n return this.client.users.has(id) ? `@${this.client.users.get(id).username}` : input;\n }\n\n const member = this.channel.guild.members.get(id);\n if (member) {\n if (member.nickname) return `@${member.nickname}`;\n return `@${member.user.username}`;\n } else {\n const user = this.client.users.get(id);\n if (user) return `@${user.username}`;\n return input;\n }\n })\n .replace(/<#[0-9]+>/g, input => {\n const channel = this.client.channels.get(input.replace(/<|#|>/g, ''));\n if (channel) return `#${channel.name}`;\n return input;\n })\n .replace(/<@&[0-9]+>/g, input => {\n if (this.channel.type === 'dm' || this.channel.type === 'group') return input;\n const role = this.guild.roles.get(input.replace(/<|@|>|&/g, ''));\n if (role) return `@${role.name}`;\n return input;\n });\n }\n\n /**\n * Creates a reaction collector.\n * @param {CollectorFilter} filter The filter to apply\n * @param {ReactionCollectorOptions} [options={}] Options to send to the collector\n * @returns {ReactionCollector}\n * @example\n * // Create a reaction collector\n * const filter = (reaction, user) => reaction.emoji.name === '👌' && user.id === 'someID'\n * const collector = message.createReactionCollector(filter, { time: 15000 });\n * collector.on('collect', r => console.log(`Collected ${r.emoji.name}`));\n * collector.on('end', collected => console.log(`Collected ${collected.size} items`));\n */\n createReactionCollector(filter, options = {}) {\n return new ReactionCollector(this, filter, options);\n }\n\n /**\n * An object containing the same properties as CollectorOptions, but a few more:\n * @typedef {ReactionCollectorOptions} AwaitReactionsOptions\n * @property {string[]} [errors] Stop/end reasons that cause the promise to reject\n */\n\n /**\n * Similar to createMessageCollector but in promise form.\n * Resolves with a collection of reactions that pass the specified filter.\n * @param {CollectorFilter} filter The filter function to use\n * @param {AwaitReactionsOptions} [options={}] Optional options to pass to the internal collector\n * @returns {Promise>}\n * @example\n * // Create a reaction collector\n * const filter = (reaction, user) => reaction.emoji.name === '👌' && user.id === 'someID'\n * message.awaitReactions(filter, { time: 15000 })\n * .then(collected => console.log(`Collected ${collected.size} reactions`))\n * .catch(console.error);\n */\n awaitReactions(filter, options = {}) {\n return new Promise((resolve, reject) => {\n const collector = this.createReactionCollector(filter, options);\n collector.once('end', (reactions, reason) => {\n if (options.errors && options.errors.includes(reason)) reject(reactions);\n else resolve(reactions);\n });\n });\n }\n\n /**\n * An array of cached versions of the message, including the current version\n * Sorted from latest (first) to oldest (last)\n * @type {Message[]}\n * @readonly\n */\n get edits() {\n const copy = this._edits.slice();\n copy.unshift(this);\n return copy;\n }\n\n /**\n * Whether the message is editable by the client user\n * @type {boolean}\n * @readonly\n */\n get editable() {\n return this.author.id === this.client.user.id;\n }\n\n /**\n * Whether the message is deletable by the client user\n * @type {boolean}\n * @readonly\n */\n get deletable() {\n return !this.deleted && (this.author.id === this.client.user.id || (this.guild &&\n this.channel.permissionsFor(this.client.user).has(Permissions.FLAGS.MANAGE_MESSAGES)\n ));\n }\n\n /**\n * Whether the message is pinnable by the client user\n * @type {boolean}\n * @readonly\n */\n get pinnable() {\n return this.type === 'DEFAULT' && (!this.guild ||\n this.channel.permissionsFor(this.client.user).has(Permissions.FLAGS.MANAGE_MESSAGES));\n }\n\n /**\n * Whether or not a user, channel or role is mentioned in this message.\n * @param {GuildChannel|User|Role|string} data Either a guild channel, user or a role object, or a string representing\n * the ID of any of these\n * @returns {boolean}\n */\n isMentioned(data) {\n data = data && data.id ? data.id : data;\n return this.mentions.users.has(data) || this.mentions.channels.has(data) || this.mentions.roles.has(data);\n }\n\n /**\n * Whether or not a guild member is mentioned in this message. Takes into account\n * user mentions, role mentions, and @everyone/@here mentions.\n * @param {GuildMember|User} member The member/user to check for a mention of\n * @returns {boolean}\n */\n isMemberMentioned(member) {\n // Lazy-loading is used here to get around a circular dependency that breaks things\n if (!GuildMember) GuildMember = __webpack_require__(/*! ./GuildMember */ \"./src/structures/GuildMember.js\");\n if (this.mentions.everyone) return true;\n if (this.mentions.users.has(member.id)) return true;\n if (member instanceof GuildMember && member.roles.some(r => this.mentions.roles.has(r.id))) return true;\n return false;\n }\n\n /**\n * Options that can be passed into editMessage.\n * @typedef {Object} MessageEditOptions\n * @property {Object} [embed] An embed to be added/edited\n * @property {string|boolean} [code] Language for optional codeblock formatting to apply\n */\n\n /**\n * Edit the content of the message.\n * @param {StringResolvable} [content] The new content for the message\n * @param {MessageEditOptions|RichEmbed} [options] The options to provide\n * @returns {Promise}\n * @example\n * // Update the content of a message\n * message.edit('This is my new content!')\n * .then(msg => console.log(`New message content: ${msg}`))\n * .catch(console.error);\n */\n edit(content, options) {\n if (!options && typeof content === 'object' && !(content instanceof Array)) {\n options = content;\n content = '';\n } else if (!options) {\n options = {};\n }\n if (options instanceof RichEmbed) options = { embed: options };\n return this.client.rest.methods.updateMessage(this, content, options);\n }\n\n /**\n * Edit the content of the message, with a code block.\n * @param {string} lang The language for the code block\n * @param {StringResolvable} content The new content for the message\n * @returns {Promise}\n * @deprecated\n */\n editCode(lang, content) {\n content = Util.escapeMarkdown(this.client.resolver.resolveString(content), true);\n return this.edit(`\\`\\`\\`${lang || ''}\\n${content}\\n\\`\\`\\``);\n }\n\n /**\n * Pins this message to the channel's pinned messages.\n * @returns {Promise}\n */\n pin() {\n return this.client.rest.methods.pinMessage(this);\n }\n\n /**\n * Unpins this message from the channel's pinned messages.\n * @returns {Promise}\n */\n unpin() {\n return this.client.rest.methods.unpinMessage(this);\n }\n\n /**\n * Add a reaction to the message.\n * @param {string|Emoji|ReactionEmoji} emoji The emoji to react with\n * @returns {Promise}\n * @example\n * // React to a message with a unicode emoji\n * message.react('🤔')\n * .then(console.log)\n * .catch(console.error);\n * @example\n * // React to a message with a custom emoji\n * message.react(message.guild.emojis.get('123456789012345678'))\n * .then(console.log)\n * .catch(console.error);\n */\n react(emoji) {\n emoji = this.client.resolver.resolveEmojiIdentifier(emoji);\n if (!emoji) throw new TypeError('Emoji must be a string or Emoji/ReactionEmoji');\n\n return this.client.rest.methods.addMessageReaction(this, emoji);\n }\n\n /**\n * Remove all reactions from a message.\n * @returns {Promise}\n */\n clearReactions() {\n return this.client.rest.methods.removeMessageReactions(this);\n }\n\n /**\n * Deletes the message.\n * @param {number} [timeout=0] How long to wait to delete the message in milliseconds\n * @returns {Promise}\n * @example\n * // Delete a message\n * message.delete()\n * .then(msg => console.log(`Deleted message from ${msg.author.username}`))\n * .catch(console.error);\n */\n delete(timeout = 0) {\n if (timeout <= 0) {\n return this.client.rest.methods.deleteMessage(this);\n } else {\n return new Promise(resolve => {\n this.client.setTimeout(() => {\n resolve(this.delete());\n }, timeout);\n });\n }\n }\n\n /**\n * Reply to the message.\n * @param {StringResolvable} [content] The content for the message\n * @param {MessageOptions} [options] The options to provide\n * @returns {Promise}\n * @example\n * // Reply to a message\n * message.reply('Hey, I\\'m a reply!')\n * .then(sent => console.log(`Sent a reply to ${sent.author.username}`))\n * .catch(console.error);\n */\n reply(content, options) {\n if (!options && typeof content === 'object' && !(content instanceof Array)) {\n options = content;\n content = '';\n } else if (!options) {\n options = {};\n }\n return this.channel.send(content, Object.assign(options, { reply: this.member || this.author }));\n }\n\n /**\n * Marks the message as read.\n * This is only available when using a user account.\n * @returns {Promise}\n * @deprecated\n */\n acknowledge() {\n return this.client.rest.methods.ackMessage(this);\n }\n\n /**\n * Fetches the webhook used to create this message.\n * @returns {Promise}\n */\n fetchWebhook() {\n if (!this.webhookID) return Promise.reject(new Error('The message was not sent by a webhook.'));\n return this.client.fetchWebhook(this.webhookID);\n }\n\n /**\n * Used mainly internally. Whether two messages are identical in properties. If you want to compare messages\n * without checking all the properties, use `message.id === message2.id`, which is much more efficient. This\n * method allows you to see if there are differences in content, embeds, attachments, nonce and tts properties.\n * @param {Message} message The message to compare it to\n * @param {Object} rawData Raw data passed through the WebSocket about this message\n * @returns {boolean}\n */\n equals(message, rawData) {\n if (!message) return false;\n const embedUpdate = !message.author && !message.attachments;\n if (embedUpdate) return this.id === message.id && this.embeds.length === message.embeds.length;\n\n let equal = this.id === message.id &&\n this.author.id === message.author.id &&\n this.content === message.content &&\n this.tts === message.tts &&\n this.nonce === message.nonce &&\n this.embeds.length === message.embeds.length &&\n this.attachments.length === message.attachments.length;\n\n if (equal && rawData) {\n equal = this.mentions.everyone === message.mentions.everyone &&\n this.createdTimestamp === new Date(rawData.timestamp).getTime() &&\n this.editedTimestamp === new Date(rawData.edited_timestamp).getTime();\n }\n\n return equal;\n }\n\n /**\n * When concatenated with a string, this automatically concatenates the message's content instead of the object.\n * @returns {string}\n * @example\n * // Logs: Message: This is a message!\n * console.log(`Message: ${message}`);\n */\n toString() {\n return this.content;\n }\n\n _addReaction(emoji, user) {\n const emojiID = emoji.id ? `${emoji.name}:${emoji.id}` : emoji.name;\n let reaction;\n if (this.reactions.has(emojiID)) {\n reaction = this.reactions.get(emojiID);\n if (!reaction.me) reaction.me = user.id === this.client.user.id;\n } else {\n reaction = new MessageReaction(this, emoji, 0, user.id === this.client.user.id);\n this.reactions.set(emojiID, reaction);\n }\n if (!reaction.users.has(user.id)) {\n reaction.users.set(user.id, user);\n reaction.count++;\n }\n return reaction;\n }\n\n _removeReaction(emoji, user) {\n const emojiID = emoji.id ? `${emoji.name}:${emoji.id}` : emoji.name;\n if (this.reactions.has(emojiID)) {\n const reaction = this.reactions.get(emojiID);\n if (reaction.users.has(user.id)) {\n reaction.users.delete(user.id);\n reaction.count--;\n if (user.id === this.client.user.id) reaction.me = false;\n if (reaction.count <= 0) this.reactions.delete(emojiID);\n return reaction;\n }\n }\n return null;\n }\n\n _clearReactions() {\n this.reactions.clear();\n }\n}\n\nmodule.exports = Message;\n\n\n//# sourceURL=webpack:///./src/structures/Message.js?"); +eval("const Mentions = __webpack_require__(/*! ./MessageMentions */ \"./src/structures/MessageMentions.js\");\nconst Attachment = __webpack_require__(/*! ./MessageAttachment */ \"./src/structures/MessageAttachment.js\");\nconst Embed = __webpack_require__(/*! ./MessageEmbed */ \"./src/structures/MessageEmbed.js\");\nconst RichEmbed = __webpack_require__(/*! ./RichEmbed */ \"./src/structures/RichEmbed.js\");\nconst MessageReaction = __webpack_require__(/*! ./MessageReaction */ \"./src/structures/MessageReaction.js\");\nconst ReactionCollector = __webpack_require__(/*! ./ReactionCollector */ \"./src/structures/ReactionCollector.js\");\nconst Util = __webpack_require__(/*! ../util/Util */ \"./src/util/Util.js\");\nconst Collection = __webpack_require__(/*! ../util/Collection */ \"./src/util/Collection.js\");\nconst Constants = __webpack_require__(/*! ../util/Constants */ \"./src/util/Constants.js\");\nconst Permissions = __webpack_require__(/*! ../util/Permissions */ \"./src/util/Permissions.js\");\nconst MessageFlags = __webpack_require__(/*! ../util/MessageFlags */ \"./src/util/MessageFlags.js\");\nlet GuildMember;\n\n/**\n * Represents a message on Discord.\n */\nclass Message {\n constructor(channel, data, client) {\n /**\n * The client that instantiated the Message\n * @name Message#client\n * @type {Client}\n * @readonly\n */\n Object.defineProperty(this, 'client', { value: client });\n\n /**\n * The channel that the message was sent in\n * @type {TextChannel|DMChannel|GroupDMChannel}\n */\n this.channel = channel;\n\n /**\n * Whether this message has been deleted\n * @type {boolean}\n */\n this.deleted = false;\n\n if (data) this.setup(data);\n }\n\n setup(data) { // eslint-disable-line complexity\n /**\n * The ID of the message\n * @type {Snowflake}\n */\n this.id = data.id;\n\n /**\n * The type of the message\n * @type {MessageType}\n */\n this.type = Constants.MessageTypes[data.type];\n\n /**\n * The content of the message\n * @type {string}\n */\n this.content = data.content;\n\n /**\n * The author of the message\n * @type {User}\n */\n this.author = this.client.dataManager.newUser(data.author, !data.webhook_id);\n\n /**\n * Whether or not this message is pinned\n * @type {boolean}\n */\n this.pinned = data.pinned;\n\n /**\n * Whether or not the message was Text-To-Speech\n * @type {boolean}\n */\n this.tts = data.tts;\n\n /**\n * A random number or string used for checking message delivery\n * This is only received after the message was sent successfully, and\n * lost if re-fetched\n * @type {?string}\n */\n this.nonce = data.nonce;\n\n /**\n * Whether or not this message was sent by Discord, not actually a user (e.g. pin notifications)\n * @type {boolean}\n */\n this.system = data.type !== 0;\n\n /**\n * A list of embeds in the message - e.g. YouTube Player\n * @type {MessageEmbed[]}\n */\n this.embeds = data.embeds.map(e => new Embed(this, e));\n\n /**\n * A collection of attachments in the message - e.g. Pictures - mapped by their ID\n * @type {Collection}\n */\n this.attachments = new Collection();\n for (const attachment of data.attachments) this.attachments.set(attachment.id, new Attachment(this, attachment));\n\n /**\n * The timestamp the message was sent at\n * @type {number}\n */\n this.createdTimestamp = new Date(data.timestamp).getTime();\n\n /**\n * The timestamp the message was last edited at (if applicable)\n * @type {?number}\n */\n this.editedTimestamp = data.edited_timestamp ? new Date(data.edited_timestamp).getTime() : null;\n\n /**\n * A collection of reactions to this message, mapped by the reaction ID\n * @type {Collection}\n */\n this.reactions = new Collection();\n if (data.reactions && data.reactions.length > 0) {\n for (const reaction of data.reactions) {\n const id = reaction.emoji.id ? `${reaction.emoji.name}:${reaction.emoji.id}` : reaction.emoji.name;\n this.reactions.set(id, new MessageReaction(this, reaction.emoji, reaction.count, reaction.me));\n }\n }\n\n /**\n * All valid mentions that the message contains\n * @type {MessageMentions}\n */\n this.mentions = new Mentions(this, data.mentions, data.mention_roles, data.mention_everyone, data.mention_channels);\n\n /**\n * ID of the webhook that sent the message, if applicable\n * @type {?Snowflake}\n */\n this.webhookID = data.webhook_id || null;\n\n /**\n * Whether this message is a hit in a search\n * @type {?boolean}\n */\n this.hit = typeof data.hit === 'boolean' ? data.hit : null;\n\n /**\n * Flags that are applied to the message\n * @type {Readonly}\n */\n this.flags = new MessageFlags(data.flags).freeze();\n\n /**\n * Reference data sent in a crossposted message.\n * @typedef {Object} MessageReference\n * @property {string} channelID ID of the channel the message was crossposted from\n * @property {?string} guildID ID of the guild the message was crossposted from\n * @property {?string} messageID ID of the message that was crossposted\n */\n\n /**\n * Message reference data\n * @type {?MessageReference}\n */\n this.reference = data.message_reference ? {\n channelID: data.message_reference.channel_id,\n guildID: data.message_reference.guild_id,\n messageID: data.message_reference.message_id,\n } : null;\n\n /**\n * The previous versions of the message, sorted with the most recent first\n * @type {Message[]}\n * @private\n */\n this._edits = [];\n\n if (data.member && this.guild && this.author && !this.guild.members.has(this.author.id)) {\n this.guild._addMember(Object.assign(data.member, { user: this.author }), false);\n }\n\n /**\n * Represents the author of the message as a guild member\n * Only available if the message comes from a guild where the author is still a member\n * @type {?GuildMember}\n */\n this.member = this.guild ? this.guild.member(this.author) || null : null;\n }\n\n /**\n * Updates the message.\n * @param {Object} data Raw Discord message update data\n * @private\n */\n patch(data) {\n const clone = Util.cloneObject(this);\n this._edits.unshift(clone);\n\n if ('edited_timestamp' in data) this.editedTimestamp = new Date(data.edited_timestamp).getTime();\n if ('content' in data) this.content = data.content;\n if ('pinned' in data) this.pinned = data.pinned;\n if ('tts' in data) this.tts = data.tts;\n if ('embeds' in data) this.embeds = data.embeds.map(e => new Embed(this, e));\n else this.embeds = this.embeds.slice();\n\n if ('attachments' in data) {\n this.attachments = new Collection();\n for (const attachment of data.attachments) this.attachments.set(attachment.id, new Attachment(this, attachment));\n } else {\n this.attachments = new Collection(this.attachments);\n }\n\n this.mentions = new Mentions(\n this,\n 'mentions' in data ? data.mentions : this.mentions.users,\n 'mentions_roles' in data ? data.mentions_roles : this.mentions.roles,\n 'mention_everyone' in data ? data.mention_everyone : this.mentions.everyone,\n 'mention_channels' in data ? data.mention_channels : this.mentions.crosspostedChannels\n );\n\n this.flags = new MessageFlags('flags' in data ? data.flags : 0).freeze();\n }\n\n /**\n * The time the message was sent\n * @type {Date}\n * @readonly\n */\n get createdAt() {\n return new Date(this.createdTimestamp);\n }\n\n /**\n * The time the message was last edited at (if applicable)\n * @type {?Date}\n * @readonly\n */\n get editedAt() {\n return this.editedTimestamp ? new Date(this.editedTimestamp) : null;\n }\n\n /**\n * The guild the message was sent in (if in a guild channel)\n * @type {?Guild}\n * @readonly\n */\n get guild() {\n return this.channel.guild || null;\n }\n\n /**\n * The url to jump to the message\n * @type {string}\n * @readonly\n */\n get url() {\n return `https://discordapp.com/channels/${this.guild ? this.guild.id : '@me'}/${this.channel.id}/${this.id}`;\n }\n\n /**\n * The message contents with all mentions replaced by the equivalent text.\n * If mentions cannot be resolved to a name, the relevant mention in the message content will not be converted.\n * @type {string}\n * @readonly\n */\n get cleanContent() {\n return this.content\n .replace(/@(everyone|here)/g, '@\\u200b$1')\n .replace(/<@!?[0-9]+>/g, input => {\n const id = input.replace(/<|!|>|@/g, '');\n if (this.channel.type === 'dm' || this.channel.type === 'group') {\n return this.client.users.has(id) ? `@${this.client.users.get(id).username}` : input;\n }\n\n const member = this.channel.guild.members.get(id);\n if (member) {\n if (member.nickname) return `@${member.nickname}`;\n return `@${member.user.username}`;\n } else {\n const user = this.client.users.get(id);\n if (user) return `@${user.username}`;\n return input;\n }\n })\n .replace(/<#[0-9]+>/g, input => {\n const channel = this.client.channels.get(input.replace(/<|#|>/g, ''));\n if (channel) return `#${channel.name}`;\n return input;\n })\n .replace(/<@&[0-9]+>/g, input => {\n if (this.channel.type === 'dm' || this.channel.type === 'group') return input;\n const role = this.guild.roles.get(input.replace(/<|@|>|&/g, ''));\n if (role) return `@${role.name}`;\n return input;\n });\n }\n\n /**\n * Creates a reaction collector.\n * @param {CollectorFilter} filter The filter to apply\n * @param {ReactionCollectorOptions} [options={}] Options to send to the collector\n * @returns {ReactionCollector}\n * @example\n * // Create a reaction collector\n * const filter = (reaction, user) => reaction.emoji.name === '👌' && user.id === 'someID'\n * const collector = message.createReactionCollector(filter, { time: 15000 });\n * collector.on('collect', r => console.log(`Collected ${r.emoji.name}`));\n * collector.on('end', collected => console.log(`Collected ${collected.size} items`));\n */\n createReactionCollector(filter, options = {}) {\n return new ReactionCollector(this, filter, options);\n }\n\n /**\n * An object containing the same properties as CollectorOptions, but a few more:\n * @typedef {ReactionCollectorOptions} AwaitReactionsOptions\n * @property {string[]} [errors] Stop/end reasons that cause the promise to reject\n */\n\n /**\n * Similar to createMessageCollector but in promise form.\n * Resolves with a collection of reactions that pass the specified filter.\n * @param {CollectorFilter} filter The filter function to use\n * @param {AwaitReactionsOptions} [options={}] Optional options to pass to the internal collector\n * @returns {Promise>}\n * @example\n * // Create a reaction collector\n * const filter = (reaction, user) => reaction.emoji.name === '👌' && user.id === 'someID'\n * message.awaitReactions(filter, { time: 15000 })\n * .then(collected => console.log(`Collected ${collected.size} reactions`))\n * .catch(console.error);\n */\n awaitReactions(filter, options = {}) {\n return new Promise((resolve, reject) => {\n const collector = this.createReactionCollector(filter, options);\n collector.once('end', (reactions, reason) => {\n if (options.errors && options.errors.includes(reason)) reject(reactions);\n else resolve(reactions);\n });\n });\n }\n\n /**\n * An array of cached versions of the message, including the current version\n * Sorted from latest (first) to oldest (last)\n * @type {Message[]}\n * @readonly\n */\n get edits() {\n const copy = this._edits.slice();\n copy.unshift(this);\n return copy;\n }\n\n /**\n * Whether the message is editable by the client user\n * @type {boolean}\n * @readonly\n */\n get editable() {\n return this.author.id === this.client.user.id;\n }\n\n /**\n * Whether the message is deletable by the client user\n * @type {boolean}\n * @readonly\n */\n get deletable() {\n return !this.deleted && (this.author.id === this.client.user.id || (this.guild &&\n this.channel.permissionsFor(this.client.user).has(Permissions.FLAGS.MANAGE_MESSAGES)\n ));\n }\n\n /**\n * Whether the message is pinnable by the client user\n * @type {boolean}\n * @readonly\n */\n get pinnable() {\n return this.type === 'DEFAULT' && (!this.guild ||\n this.channel.permissionsFor(this.client.user).has(Permissions.FLAGS.MANAGE_MESSAGES));\n }\n\n /**\n * Whether or not a user, channel or role is mentioned in this message.\n * @param {GuildChannel|User|Role|string} data Either a guild channel, user or a role object, or a string representing\n * the ID of any of these\n * @returns {boolean}\n */\n isMentioned(data) {\n data = data && data.id ? data.id : data;\n return this.mentions.users.has(data) || this.mentions.channels.has(data) || this.mentions.roles.has(data);\n }\n\n /**\n * Whether or not a guild member is mentioned in this message. Takes into account\n * user mentions, role mentions, and @everyone/@here mentions.\n * @param {GuildMember|User} member The member/user to check for a mention of\n * @returns {boolean}\n */\n isMemberMentioned(member) {\n // Lazy-loading is used here to get around a circular dependency that breaks things\n if (!GuildMember) GuildMember = __webpack_require__(/*! ./GuildMember */ \"./src/structures/GuildMember.js\");\n if (this.mentions.everyone) return true;\n if (this.mentions.users.has(member.id)) return true;\n if (member instanceof GuildMember && member.roles.some(r => this.mentions.roles.has(r.id))) return true;\n return false;\n }\n\n /**\n * Options that can be passed into editMessage.\n * @typedef {Object} MessageEditOptions\n * @property {Object} [embed] An embed to be added/edited\n * @property {string|boolean} [code] Language for optional codeblock formatting to apply\n * @property {MessageFlagsResolvable} [flags] Message flags to apply\n */\n\n /**\n * Edit the content of the message.\n * @param {StringResolvable} [content] The new content for the message\n * @param {MessageEditOptions|RichEmbed} [options] The options to provide\n * @returns {Promise}\n * @example\n * // Update the content of a message\n * message.edit('This is my new content!')\n * .then(msg => console.log(`New message content: ${msg}`))\n * .catch(console.error);\n */\n edit(content, options) {\n if (!options && typeof content === 'object' && !(content instanceof Array)) {\n options = content;\n content = '';\n } else if (!options) {\n options = {};\n }\n if (options instanceof RichEmbed) options = { embed: options };\n return this.client.rest.methods.updateMessage(this, content, options);\n }\n\n /**\n * Edit the content of the message, with a code block.\n * @param {string} lang The language for the code block\n * @param {StringResolvable} content The new content for the message\n * @returns {Promise}\n * @deprecated\n */\n editCode(lang, content) {\n content = Util.escapeMarkdown(this.client.resolver.resolveString(content), true);\n return this.edit(`\\`\\`\\`${lang || ''}\\n${content}\\n\\`\\`\\``);\n }\n\n /**\n * Pins this message to the channel's pinned messages.\n * @returns {Promise}\n */\n pin() {\n return this.client.rest.methods.pinMessage(this);\n }\n\n /**\n * Unpins this message from the channel's pinned messages.\n * @returns {Promise}\n */\n unpin() {\n return this.client.rest.methods.unpinMessage(this);\n }\n\n /**\n * Add a reaction to the message.\n * @param {string|Emoji|ReactionEmoji} emoji The emoji to react with\n * @returns {Promise}\n * @example\n * // React to a message with a unicode emoji\n * message.react('🤔')\n * .then(console.log)\n * .catch(console.error);\n * @example\n * // React to a message with a custom emoji\n * message.react(message.guild.emojis.get('123456789012345678'))\n * .then(console.log)\n * .catch(console.error);\n */\n react(emoji) {\n emoji = this.client.resolver.resolveEmojiIdentifier(emoji);\n if (!emoji) throw new TypeError('Emoji must be a string or Emoji/ReactionEmoji');\n\n return this.client.rest.methods.addMessageReaction(this, emoji);\n }\n\n /**\n * Remove all reactions from a message.\n * @returns {Promise}\n */\n clearReactions() {\n return this.client.rest.methods.removeMessageReactions(this);\n }\n\n /**\n * Deletes the message.\n * @param {number} [timeout=0] How long to wait to delete the message in milliseconds\n * @returns {Promise}\n * @example\n * // Delete a message\n * message.delete()\n * .then(msg => console.log(`Deleted message from ${msg.author.username}`))\n * .catch(console.error);\n */\n delete(timeout = 0) {\n if (timeout <= 0) {\n return this.client.rest.methods.deleteMessage(this);\n } else {\n return new Promise(resolve => {\n this.client.setTimeout(() => {\n resolve(this.delete());\n }, timeout);\n });\n }\n }\n\n /**\n * Reply to the message.\n * @param {StringResolvable} [content] The content for the message\n * @param {MessageOptions} [options] The options to provide\n * @returns {Promise}\n * @example\n * // Reply to a message\n * message.reply('Hey, I\\'m a reply!')\n * .then(sent => console.log(`Sent a reply to ${sent.author.username}`))\n * .catch(console.error);\n */\n reply(content, options) {\n if (!options && typeof content === 'object' && !(content instanceof Array)) {\n options = content;\n content = '';\n } else if (!options) {\n options = {};\n }\n return this.channel.send(content, Object.assign(options, { reply: this.member || this.author }));\n }\n\n /**\n * Marks the message as read.\n * This is only available when using a user account.\n * @returns {Promise}\n * @deprecated\n */\n acknowledge() {\n return this.client.rest.methods.ackMessage(this);\n }\n\n /**\n * Fetches the webhook used to create this message.\n * @returns {Promise}\n */\n fetchWebhook() {\n if (!this.webhookID) return Promise.reject(new Error('The message was not sent by a webhook.'));\n return this.client.fetchWebhook(this.webhookID);\n }\n\n /**\n * Suppresses or unsuppresses embeds on a message\n * @param {boolean} [suppress=true] If the embeds should be suppressed or not\n * @returns {Promise}\n */\n suppressEmbeds(suppress = true) {\n const flags = new MessageFlags(this.flags.bitfield);\n\n if (suppress) {\n flags.add(MessageFlags.FLAGS.SUPPRESS_EMBEDS);\n } else {\n flags.remove(MessageFlags.FLAGS.SUPPRESS_EMBEDS);\n }\n\n return this.edit(undefined, { flags });\n }\n\n /**\n * Used mainly internally. Whether two messages are identical in properties. If you want to compare messages\n * without checking all the properties, use `message.id === message2.id`, which is much more efficient. This\n * method allows you to see if there are differences in content, embeds, attachments, nonce and tts properties.\n * @param {Message} message The message to compare it to\n * @param {Object} rawData Raw data passed through the WebSocket about this message\n * @returns {boolean}\n */\n equals(message, rawData) {\n if (!message) return false;\n const embedUpdate = !message.author && !message.attachments;\n if (embedUpdate) return this.id === message.id && this.embeds.length === message.embeds.length;\n\n let equal = this.id === message.id &&\n this.author.id === message.author.id &&\n this.content === message.content &&\n this.tts === message.tts &&\n this.nonce === message.nonce &&\n this.embeds.length === message.embeds.length &&\n this.attachments.length === message.attachments.length;\n\n if (equal && rawData) {\n equal = this.mentions.everyone === message.mentions.everyone &&\n this.createdTimestamp === new Date(rawData.timestamp).getTime() &&\n this.editedTimestamp === new Date(rawData.edited_timestamp).getTime();\n }\n\n return equal;\n }\n\n /**\n * When concatenated with a string, this automatically concatenates the message's content instead of the object.\n * @returns {string}\n * @example\n * // Logs: Message: This is a message!\n * console.log(`Message: ${message}`);\n */\n toString() {\n return this.content;\n }\n\n _addReaction(emoji, user) {\n const emojiID = emoji.id ? `${emoji.name}:${emoji.id}` : emoji.name;\n let reaction;\n if (this.reactions.has(emojiID)) {\n reaction = this.reactions.get(emojiID);\n if (!reaction.me) reaction.me = user.id === this.client.user.id;\n } else {\n reaction = new MessageReaction(this, emoji, 0, user.id === this.client.user.id);\n this.reactions.set(emojiID, reaction);\n }\n if (!reaction.users.has(user.id)) {\n reaction.users.set(user.id, user);\n reaction.count++;\n }\n return reaction;\n }\n\n _removeReaction(emoji, user) {\n const emojiID = emoji.id ? `${emoji.name}:${emoji.id}` : emoji.name;\n if (this.reactions.has(emojiID)) {\n const reaction = this.reactions.get(emojiID);\n if (!user) {\n this.reactions.delete(emojiID);\n return reaction;\n }\n if (reaction.users.has(user.id)) {\n reaction.users.delete(user.id);\n reaction.count--;\n if (user.id === this.client.user.id) reaction.me = false;\n if (reaction.count <= 0) this.reactions.delete(emojiID);\n return reaction;\n }\n }\n return null;\n }\n\n _clearReactions() {\n this.reactions.clear();\n }\n}\n\nmodule.exports = Message;\n\n\n//# sourceURL=webpack:///./src/structures/Message.js?"); /***/ }), @@ -1611,9 +1696,9 @@ eval("const Mentions = __webpack_require__(/*! ./MessageMentions */ \"./src/stru \*********************************************/ /*! no static exports found */ /*! ModuleConcatenation bailout: Module is not an ECMAScript module */ -/***/ (function(module, exports) { +/***/ (function(module, exports, __webpack_require__) { -eval("/**\n * Represents an attachment in a message.\n */\nclass MessageAttachment {\n constructor(message, data) {\n /**\n * The client that instantiated this MessageAttachment\n * @name MessageAttachment#client\n * @type {Client}\n * @readonly\n */\n Object.defineProperty(this, 'client', { value: message.client });\n\n /**\n * The message this attachment is part of\n * @type {Message}\n */\n this.message = message;\n\n this.setup(data);\n }\n\n setup(data) {\n /**\n * The ID of this attachment\n * @type {Snowflake}\n */\n this.id = data.id;\n\n /**\n * The file name of this attachment\n * @type {string}\n */\n this.filename = data.filename;\n\n /**\n * The size of this attachment in bytes\n * @type {number}\n */\n this.filesize = data.size;\n\n /**\n * The URL to this attachment\n * @type {string}\n */\n this.url = data.url;\n\n /**\n * The Proxy URL to this attachment\n * @type {string}\n */\n this.proxyURL = data.proxy_url;\n\n /**\n * The height of this attachment (if an image)\n * @type {?number}\n */\n this.height = data.height;\n\n /**\n * The width of this attachment (if an image)\n * @type {?number}\n */\n this.width = data.width;\n }\n}\n\nmodule.exports = MessageAttachment;\n\n\n//# sourceURL=webpack:///./src/structures/MessageAttachment.js?"); +eval("const { basename } = __webpack_require__(/*! path */ \"./node_modules/path-browserify/index.js\");\n\n/**\n * Represents an attachment in a message.\n */\nclass MessageAttachment {\n constructor(message, data) {\n /**\n * The client that instantiated this MessageAttachment\n * @name MessageAttachment#client\n * @type {Client}\n * @readonly\n */\n Object.defineProperty(this, 'client', { value: message.client });\n\n /**\n * The message this attachment is part of\n * @type {Message}\n */\n this.message = message;\n\n this.setup(data);\n }\n\n setup(data) {\n /**\n * The ID of this attachment\n * @type {Snowflake}\n */\n this.id = data.id;\n\n /**\n * The file name of this attachment\n * @type {string}\n */\n this.filename = data.filename;\n\n /**\n * The size of this attachment in bytes\n * @type {number}\n */\n this.filesize = data.size;\n\n /**\n * The URL to this attachment\n * @type {string}\n */\n this.url = data.url;\n\n /**\n * The Proxy URL to this attachment\n * @type {string}\n */\n this.proxyURL = data.proxy_url;\n\n /**\n * The height of this attachment (if an image)\n * @type {?number}\n */\n this.height = data.height;\n\n /**\n * The width of this attachment (if an image)\n * @type {?number}\n */\n this.width = data.width;\n }\n\n /**\n * Whether or not this attachment has been marked as a spoiler\n * @type {boolean}\n * @readonly\n */\n get spoiler() {\n return basename(this.url).startsWith('SPOILER_');\n }\n}\n\nmodule.exports = MessageAttachment;\n\n\n//# sourceURL=webpack:///./src/structures/MessageAttachment.js?"); /***/ }), @@ -1625,7 +1710,7 @@ eval("/**\n * Represents an attachment in a message.\n */\nclass MessageAttachme /*! ModuleConcatenation bailout: Module is not an ECMAScript module */ /***/ (function(module, exports, __webpack_require__) { -eval("const Collector = __webpack_require__(/*! ./interfaces/Collector */ \"./src/structures/interfaces/Collector.js\");\nconst util = __webpack_require__(/*! util */ \"./node_modules/util/util.js\");\n\n/**\n * @typedef {CollectorOptions} MessageCollectorOptions\n * @property {number} max The maximum amount of messages to process\n * @property {number} maxMatches The maximum amount of messages to collect\n */\n\n/**\n * Collects messages on a channel.\n * @extends {Collector}\n */\nclass MessageCollector extends Collector {\n /**\n * @param {TextChannel|DMChannel|GroupDMChannel} channel The channel\n * @param {CollectorFilter} filter The filter to be applied to this collector\n * @param {MessageCollectorOptions} options The options to be applied to this collector\n * @emits MessageCollector#message\n */\n constructor(channel, filter, options = {}) {\n super(channel.client, filter, options);\n\n /**\n * The channel\n * @type {TextBasedChannel}\n */\n this.channel = channel;\n\n /**\n * Total number of messages that were received in the channel during message collection\n * @type {number}\n */\n this.received = 0;\n\n this.client.setMaxListeners(this.client.getMaxListeners() + 1);\n this.client.on('message', this.listener);\n\n // For backwards compatibility (remove in v12)\n if (this.options.max) this.options.maxProcessed = this.options.max;\n if (this.options.maxMatches) this.options.max = this.options.maxMatches;\n this._reEmitter = message => {\n /**\n * Emitted when the collector receives a message.\n * @event MessageCollector#message\n * @param {Message} message The message\n * @deprecated\n */\n this.emit('message', message);\n };\n this.on('collect', this._reEmitter);\n }\n\n // Remove in v12\n on(eventName, listener) {\n if (eventName === 'message') {\n listener = util.deprecate(listener, 'MessageCollector will soon no longer emit \"message\", use \"collect\" instead');\n }\n super.on(eventName, listener);\n }\n\n /**\n * Handle an incoming message for possible collection.\n * @param {Message} message The message that could be collected\n * @returns {?{key: Snowflake, value: Message}}\n * @private\n */\n handle(message) {\n if (message.channel.id !== this.channel.id) return null;\n this.received++;\n return {\n key: message.id,\n value: message,\n };\n }\n\n /**\n * Check after collection to see if the collector is done.\n * @returns {?string} Reason to end the collector, if any\n * @private\n */\n postCheck() {\n // Consider changing the end reasons for v12\n if (this.options.maxMatches && this.collected.size >= this.options.max) return 'matchesLimit';\n if (this.options.max && this.received >= this.options.maxProcessed) return 'limit';\n return null;\n }\n\n /**\n * Removes event listeners.\n * @private\n */\n cleanup() {\n this.removeListener('collect', this._reEmitter);\n this.client.removeListener('message', this.listener);\n this.client.setMaxListeners(this.client.getMaxListeners() - 1);\n }\n}\n\nmodule.exports = MessageCollector;\n\n\n//# sourceURL=webpack:///./src/structures/MessageCollector.js?"); +eval("const Collector = __webpack_require__(/*! ./interfaces/Collector */ \"./src/structures/interfaces/Collector.js\");\nconst util = __webpack_require__(/*! util */ \"./node_modules/util/util.js\");\n\n/**\n * @typedef {CollectorOptions} MessageCollectorOptions\n * @property {number} max The maximum amount of messages to process\n * @property {number} maxMatches The maximum amount of messages to collect\n */\n\n/**\n * Collects messages on a channel.\n * @extends {Collector}\n */\nclass MessageCollector extends Collector {\n /**\n * @param {TextChannel|DMChannel|GroupDMChannel} channel The channel\n * @param {CollectorFilter} filter The filter to be applied to this collector\n * @param {MessageCollectorOptions} options The options to be applied to this collector\n * @emits MessageCollector#message\n */\n constructor(channel, filter, options = {}) {\n super(channel.client, filter, options);\n\n /**\n * The channel\n * @type {TextBasedChannel}\n */\n this.channel = channel;\n\n /**\n * Total number of messages that were received in the channel during message collection\n * @type {number}\n */\n this.received = 0;\n\n if (this.client.getMaxListeners() !== 0) this.client.setMaxListeners(this.client.getMaxListeners() + 1);\n this.client.on('message', this.listener);\n\n this._reEmitter = message => {\n /**\n * Emitted when the collector receives a message.\n * @event MessageCollector#message\n * @param {Message} message The message\n * @deprecated\n */\n this.emit('message', message);\n };\n this.on('collect', this._reEmitter);\n }\n\n // Remove in v12\n on(eventName, listener) {\n if (eventName === 'message') {\n listener = util.deprecate(listener, 'MessageCollector will soon no longer emit \"message\", use \"collect\" instead');\n }\n super.on(eventName, listener);\n }\n\n /**\n * Handle an incoming message for possible collection.\n * @param {Message} message The message that could be collected\n * @returns {?{key: Snowflake, value: Message}}\n * @private\n */\n handle(message) {\n if (message.channel.id !== this.channel.id) return null;\n this.received++;\n return {\n key: message.id,\n value: message,\n };\n }\n\n /**\n * Check after collection to see if the collector is done.\n * @returns {?string} Reason to end the collector, if any\n * @private\n */\n postCheck() {\n // Consider changing the end reasons for v12\n if (this.options.maxMatches && this.collected.size >= this.options.maxMatches) return 'matchesLimit';\n if (this.options.max && this.received >= this.options.max) return 'limit';\n return null;\n }\n\n /**\n * Removes event listeners.\n * @private\n */\n cleanup() {\n this.removeListener('collect', this._reEmitter);\n this.client.removeListener('message', this.listener);\n if (this.client.getMaxListeners() !== 0) this.client.setMaxListeners(this.client.getMaxListeners() - 1);\n }\n}\n\nmodule.exports = MessageCollector;\n\n\n//# sourceURL=webpack:///./src/structures/MessageCollector.js?"); /***/ }), @@ -1649,7 +1734,7 @@ eval("/**\n * Represents an embed in a message (image/video preview, rich embed, /*! ModuleConcatenation bailout: Module is not an ECMAScript module */ /***/ (function(module, exports, __webpack_require__) { -eval("const Collection = __webpack_require__(/*! ../util/Collection */ \"./src/util/Collection.js\");\n\n/**\n * Keeps track of mentions in a {@link Message}.\n */\nclass MessageMentions {\n constructor(message, users, roles, everyone) {\n /**\n * Whether `@everyone` or `@here` were mentioned\n * @type {boolean}\n */\n this.everyone = Boolean(everyone);\n\n if (users) {\n if (users instanceof Collection) {\n /**\n * Any users that were mentioned\n * @type {Collection}\n */\n this.users = new Collection(users);\n } else {\n this.users = new Collection();\n for (const mention of users) {\n let user = message.client.users.get(mention.id);\n if (!user) user = message.client.dataManager.newUser(mention);\n this.users.set(user.id, user);\n }\n }\n } else {\n this.users = new Collection();\n }\n\n if (roles) {\n if (roles instanceof Collection) {\n /**\n * Any roles that were mentioned\n * @type {Collection}\n */\n this.roles = new Collection(roles);\n } else {\n this.roles = new Collection();\n for (const mention of roles) {\n const role = message.channel.guild.roles.get(mention);\n if (role) this.roles.set(role.id, role);\n }\n }\n } else {\n this.roles = new Collection();\n }\n\n /**\n * Content of the message\n * @type {Message}\n * @private\n */\n this._content = message.content;\n\n /**\n * The client the message is from\n * @type {Client}\n * @private\n */\n this._client = message.client;\n\n /**\n * The guild the message is in\n * @type {?Guild}\n * @private\n */\n this._guild = message.channel.guild;\n\n /**\n * Cached members for {@MessageMention#members}\n * @type {?Collection}\n * @private\n */\n this._members = null;\n\n /**\n * Cached channels for {@MessageMention#channels}\n * @type {?Collection}\n * @private\n */\n this._channels = null;\n }\n\n /**\n * Any members that were mentioned (only in {@link TextChannel}s)\n * @type {?Collection}\n * @readonly\n */\n get members() {\n if (this._members) return this._members;\n if (!this._guild) return null;\n this._members = new Collection();\n this.users.forEach(user => {\n const member = this._guild.member(user);\n if (member) this._members.set(member.user.id, member);\n });\n return this._members;\n }\n\n /**\n * Any channels that were mentioned\n * @type {Collection}\n * @readonly\n */\n get channels() {\n if (this._channels) return this._channels;\n this._channels = new Collection();\n let matches;\n while ((matches = this.constructor.CHANNELS_PATTERN.exec(this._content)) !== null) {\n const chan = this._client.channels.get(matches[1]);\n if (chan) this._channels.set(chan.id, chan);\n }\n return this._channels;\n }\n}\n\n/**\n * Regular expression that globally matches `@everyone` and `@here`\n * @type {RegExp}\n */\nMessageMentions.EVERYONE_PATTERN = /@(everyone|here)/g;\n\n/**\n * Regular expression that globally matches user mentions like `<@81440962496172032>`\n * @type {RegExp}\n */\nMessageMentions.USERS_PATTERN = /<@!?[0-9]+>/g;\n\n/**\n * Regular expression that globally matches role mentions like `<@&297577916114403338>`\n * @type {RegExp}\n */\nMessageMentions.ROLES_PATTERN = /<@&[0-9]+>/g;\n\n/**\n * Regular expression that globally matches channel mentions like `<#222079895583457280>`\n * @type {RegExp}\n */\nMessageMentions.CHANNELS_PATTERN = /<#([0-9]+)>/g;\n\nmodule.exports = MessageMentions;\n\n\n//# sourceURL=webpack:///./src/structures/MessageMentions.js?"); +eval("const Collection = __webpack_require__(/*! ../util/Collection */ \"./src/util/Collection.js\");\nconst { ChannelTypes } = __webpack_require__(/*! ../util/Constants */ \"./src/util/Constants.js\");\n\n/**\n * Keeps track of mentions in a {@link Message}.\n */\nclass MessageMentions {\n constructor(message, users, roles, everyone, crosspostedChannels) {\n /**\n * Whether `@everyone` or `@here` were mentioned\n * @type {boolean}\n */\n this.everyone = Boolean(everyone);\n\n if (users) {\n if (users instanceof Collection) {\n /**\n * Any users that were mentioned\n * Order as received from the API, not as they appear in the message content\n * @type {Collection}\n */\n this.users = new Collection(users);\n } else {\n this.users = new Collection();\n for (const mention of users) {\n let user = message.client.users.get(mention.id);\n if (!user) user = message.client.dataManager.newUser(mention);\n this.users.set(user.id, user);\n if (mention.member && message.guild && !message.guild.members.has(mention.id)) {\n message.guild._addMember(Object.assign(mention.member, { user }), false);\n }\n }\n }\n } else {\n this.users = new Collection();\n }\n\n if (roles) {\n if (roles instanceof Collection) {\n /**\n * Any roles that were mentioned\n * Order as received from the API, not as they appear in the message content}\n */\n this.roles = new Collection(roles);\n } else {\n this.roles = new Collection();\n for (const mention of roles) {\n const role = message.channel.guild.roles.get(mention);\n if (role) this.roles.set(role.id, role);\n }\n }\n } else {\n this.roles = new Collection();\n }\n\n /**\n * Content of the message\n * @type {Message}\n * @private\n */\n this._content = message.content;\n\n /**\n * The client the message is from\n * @type {Client}\n * @private\n */\n this._client = message.client;\n\n /**\n * The guild the message is in\n * @type {?Guild}\n * @private\n */\n this._guild = message.channel.guild;\n\n /**\n * Cached members for {@MessageMention#members}\n * @type {?Collection}\n * @private\n */\n this._members = null;\n\n /**\n * Cached channels for {@MessageMention#channels}\n * @type {?Collection}\n * @private\n */\n this._channels = null;\n\n /**\n * Crossposted channel data.\n * @typedef {Object} CrosspostedChannel\n * @property {Snowflake} channelID ID of the mentioned channel\n * @property {Snowflake} guildID ID of the guild that has the channel\n * @property {string} type Type of the channel\n * @property {string} name Name of the channel\n */\n\n if (crosspostedChannels) {\n if (crosspostedChannels instanceof Collection) {\n /**\n * A collection of crossposted channels\n * @type {Collection}\n */\n this.crosspostedChannels = new Collection(crosspostedChannels);\n } else {\n this.crosspostedChannels = new Collection();\n const channelTypes = Object.keys(ChannelTypes);\n for (const d of crosspostedChannels) {\n const type = channelTypes[d.type];\n this.crosspostedChannels.set(d.id, {\n channelID: d.id,\n guildID: d.guild_id,\n type: type ? type.toLowerCase() : 'unknown',\n name: d.name,\n });\n }\n }\n } else {\n this.crosspostedChannels = new Collection();\n }\n }\n\n /**\n * Any members that were mentioned (only in {@link TextChannel}s)\n * Order as received from the API, not as they appear in the message content}\n * @readonly\n */\n get members() {\n if (this._members) return this._members;\n if (!this._guild) return null;\n this._members = new Collection();\n this.users.forEach(user => {\n const member = this._guild.member(user);\n if (member) this._members.set(member.user.id, member);\n });\n return this._members;\n }\n\n /**\n * Any channels that were mentioned\n * Order as they appear first in the message content\n * @type {Collection}\n * @readonly\n */\n get channels() {\n if (this._channels) return this._channels;\n this._channels = new Collection();\n let matches;\n while ((matches = this.constructor.CHANNELS_PATTERN.exec(this._content)) !== null) {\n const chan = this._client.channels.get(matches[1]);\n if (chan) this._channels.set(chan.id, chan);\n }\n return this._channels;\n }\n}\n\n/**\n * Regular expression that globally matches `@everyone` and `@here`\n * @type {RegExp}\n */\nMessageMentions.EVERYONE_PATTERN = /@(everyone|here)/g;\n\n/**\n * Regular expression that globally matches user mentions like `<@81440962496172032>`\n * @type {RegExp}\n */\nMessageMentions.USERS_PATTERN = /<@!?[0-9]+>/g;\n\n/**\n * Regular expression that globally matches role mentions like `<@&297577916114403338>`\n * @type {RegExp}\n */\nMessageMentions.ROLES_PATTERN = /<@&[0-9]+>/g;\n\n/**\n * Regular expression that globally matches channel mentions like `<#222079895583457280>`\n * @type {RegExp}\n */\nMessageMentions.CHANNELS_PATTERN = /<#([0-9]+)>/g;\n\nmodule.exports = MessageMentions;\n\n\n//# sourceURL=webpack:///./src/structures/MessageMentions.js?"); /***/ }), @@ -1661,7 +1746,7 @@ eval("const Collection = __webpack_require__(/*! ../util/Collection */ \"./src/u /*! ModuleConcatenation bailout: Module is not an ECMAScript module */ /***/ (function(module, exports, __webpack_require__) { -eval("const Collection = __webpack_require__(/*! ../util/Collection */ \"./src/util/Collection.js\");\nconst Emoji = __webpack_require__(/*! ./Emoji */ \"./src/structures/Emoji.js\");\nconst ReactionEmoji = __webpack_require__(/*! ./ReactionEmoji */ \"./src/structures/ReactionEmoji.js\");\n\n/**\n * Represents a reaction to a message.\n */\nclass MessageReaction {\n constructor(message, emoji, count, me) {\n /**\n * The message that this reaction refers to\n * @type {Message}\n */\n this.message = message;\n\n /**\n * Whether the client has given this reaction\n * @type {boolean}\n */\n this.me = me;\n\n /**\n * The number of people that have given the same reaction\n * @type {number}\n */\n this.count = count || 0;\n\n /**\n * The users that have given this reaction, mapped by their ID\n * @type {Collection}\n */\n this.users = new Collection();\n\n this._emoji = new ReactionEmoji(this, emoji.name, emoji.id);\n }\n\n /**\n * The emoji of this reaction, either an Emoji object for known custom emojis, or a ReactionEmoji\n * object which has fewer properties. Whatever the prototype of the emoji, it will still have\n * `name`, `id`, `identifier` and `toString()`\n * @type {Emoji|ReactionEmoji}\n * @readonly\n */\n get emoji() {\n if (this._emoji instanceof Emoji) return this._emoji;\n // Check to see if the emoji has become known to the client\n if (this._emoji.id) {\n const emojis = this.message.client.emojis;\n if (emojis.has(this._emoji.id)) {\n const emoji = emojis.get(this._emoji.id);\n this._emoji = emoji;\n return emoji;\n }\n }\n return this._emoji;\n }\n\n /**\n * Removes a user from this reaction.\n * @param {UserResolvable} [user=this.message.client.user] The user to remove the reaction of\n * @returns {Promise}\n */\n remove(user = this.message.client.user) {\n const message = this.message;\n const userID = this.message.client.resolver.resolveUserID(user);\n if (!userID) return Promise.reject(new Error('Couldn\\'t resolve the user ID to remove from the reaction.'));\n return message.client.rest.methods.removeMessageReaction(\n message, this.emoji.identifier, userID\n );\n }\n\n /**\n * Fetch all the users that gave this reaction. Resolves with a collection of users, mapped by their IDs.\n * @param {number} [limit=100] The maximum amount of users to fetch, defaults to 100\n * @param {Object} [options] Options to fetch users\n * @param {Snowflake} [options.before] Limit fetching users to those with an id lower than the supplied id\n * @param {Snowflake} [options.after] Limit fetching users to those with an id greater than the supplied id\n * @returns {Promise>}\n */\n fetchUsers(limit = 100, { after, before } = {}) {\n const message = this.message;\n return message.client.rest.methods.getMessageReactionUsers(\n message, this.emoji.identifier, { after, before, limit }\n ).then(data => {\n const users = new Collection();\n for (const rawUser of data) {\n const user = this.message.client.dataManager.newUser(rawUser);\n this.users.set(user.id, user);\n users.set(user.id, user);\n }\n return users;\n });\n }\n}\n\nmodule.exports = MessageReaction;\n\n\n//# sourceURL=webpack:///./src/structures/MessageReaction.js?"); +eval("const Collection = __webpack_require__(/*! ../util/Collection */ \"./src/util/Collection.js\");\nconst Emoji = __webpack_require__(/*! ./Emoji */ \"./src/structures/Emoji.js\");\nconst ReactionEmoji = __webpack_require__(/*! ./ReactionEmoji */ \"./src/structures/ReactionEmoji.js\");\n\n/**\n * Represents a reaction to a message.\n */\nclass MessageReaction {\n constructor(message, emoji, count, me) {\n /**\n * The message that this reaction refers to\n * @type {Message}\n */\n this.message = message;\n\n /**\n * Whether the client has given this reaction\n * @type {boolean}\n */\n this.me = me;\n\n /**\n * The number of people that have given the same reaction\n * @type {number}\n */\n this.count = count || 0;\n\n /**\n * The users that have given this reaction, mapped by their ID\n * @type {Collection}\n */\n this.users = new Collection();\n\n this._emoji = new ReactionEmoji(this, emoji);\n }\n\n /**\n * The emoji of this reaction, either an Emoji object for known custom emojis, or a ReactionEmoji\n * object which has fewer properties. Whatever the prototype of the emoji, it will still have\n * `name`, `id`, `identifier` and `toString()`\n * @type {Emoji|ReactionEmoji}\n * @readonly\n */\n get emoji() {\n if (this._emoji instanceof Emoji) return this._emoji;\n // Check to see if the emoji has become known to the client\n if (this._emoji.id) {\n const emojis = this.message.client.emojis;\n if (emojis.has(this._emoji.id)) {\n const emoji = emojis.get(this._emoji.id);\n this._emoji = emoji;\n return emoji;\n }\n }\n return this._emoji;\n }\n\n /**\n * Removes a user from this reaction.\n * @param {UserResolvable} [user=this.message.client.user] The user to remove the reaction of\n * @returns {Promise}\n */\n remove(user = this.message.client.user) {\n const message = this.message;\n const userID = this.message.client.resolver.resolveUserID(user);\n if (!userID) return Promise.reject(new Error('Couldn\\'t resolve the user ID to remove from the reaction.'));\n return message.client.rest.methods.removeMessageReaction(\n message, this.emoji.identifier, userID\n );\n }\n\n /**\n * Removes this reaction from the message\n * @returns {Promise}\n */\n removeAll() {\n const message = this.message;\n return message.client.rest.methods.removeMessageReactionEmoji(\n message, this.emoji.identifier\n );\n }\n\n /**\n * Fetch all the users that gave this reaction. Resolves with a collection of users, mapped by their IDs.\n * @param {number} [limit=100] The maximum amount of users to fetch, defaults to 100\n * @param {Object} [options] Options to fetch users\n * @param {Snowflake} [options.before] Limit fetching users to those with an id lower than the supplied id\n * @param {Snowflake} [options.after] Limit fetching users to those with an id greater than the supplied id\n * @returns {Promise>}\n */\n fetchUsers(limit = 100, { after, before } = {}) {\n const message = this.message;\n return message.client.rest.methods.getMessageReactionUsers(\n message, this.emoji.identifier, { after, before, limit }\n ).then(data => {\n const users = new Collection();\n for (const rawUser of data) {\n const user = this.message.client.dataManager.newUser(rawUser);\n this.users.set(user.id, user);\n users.set(user.id, user);\n }\n return users;\n });\n }\n}\n\nmodule.exports = MessageReaction;\n\n\n//# sourceURL=webpack:///./src/structures/MessageReaction.js?"); /***/ }), @@ -1685,7 +1770,7 @@ eval("const TextChannel = __webpack_require__(/*! ./TextChannel */ \"./src/struc /*! ModuleConcatenation bailout: Module is not an ECMAScript module */ /***/ (function(module, exports, __webpack_require__) { -eval("const Snowflake = __webpack_require__(/*! ../util/Snowflake */ \"./src/util/Snowflake.js\");\nconst util = __webpack_require__(/*! util */ \"./node_modules/util/util.js\");\n\n/**\n * Represents an OAuth2 Application.\n */\nclass OAuth2Application {\n constructor(client, data) {\n /**\n * The client that instantiated the application\n * @name OAuth2Application#client\n * @type {Client}\n * @readonly\n */\n Object.defineProperty(this, 'client', { value: client });\n\n this.setup(data);\n }\n\n setup(data) {\n /**\n * The ID of the app\n * @type {Snowflake}\n */\n this.id = data.id;\n\n /**\n * The name of the app\n * @type {string}\n */\n this.name = data.name;\n\n /**\n * The app's description\n * @type {string}\n */\n this.description = data.description;\n\n /**\n * The app's icon hash\n * @type {?string}\n */\n this.icon = data.icon;\n\n /**\n * The app's icon URL\n * @type {string}\n */\n this.iconURL = `https://cdn.discordapp.com/app-icons/${this.id}/${this.icon}.jpg`;\n\n /**\n * The app's RPC origins\n * @type {?string[]}\n */\n this.rpcOrigins = data.rpc_origins;\n\n /**\n * The app's redirect URIs\n * @type {string[]}\n */\n this.redirectURIs = data.redirect_uris;\n\n /**\n * If this app's bot requires a code grant when using the OAuth2 flow\n * @type {boolean}\n */\n this.botRequireCodeGrant = data.bot_require_code_grant;\n\n /**\n * If this app's bot is public\n * @type {boolean}\n */\n this.botPublic = data.bot_public;\n\n /**\n * If this app can use rpc\n * @type {boolean}\n */\n this.rpcApplicationState = data.rpc_application_state;\n\n /**\n * Object containing basic info about this app's bot\n * @type {Object}\n */\n this.bot = data.bot;\n\n /**\n * The flags for the app\n * @type {number}\n */\n this.flags = data.flags;\n\n /**\n * OAuth2 secret for the application\n * @type {boolean}\n */\n this.secret = data.secret;\n\n if (data.owner) {\n /**\n * The owner of this OAuth application\n * @type {?User}\n */\n this.owner = this.client.dataManager.newUser(data.owner);\n }\n }\n\n /**\n * The timestamp the app was created at\n * @type {number}\n * @readonly\n */\n get createdTimestamp() {\n return Snowflake.deconstruct(this.id).timestamp;\n }\n\n /**\n * The time the app was created\n * @type {Date}\n * @readonly\n */\n get createdAt() {\n return new Date(this.createdTimestamp);\n }\n\n /**\n * Reset the app's secret and bot token.\n * This is only available when using a user account.\n * @returns {OAuth2Application}\n * @deprecated\n */\n reset() {\n return this.client.rest.methods.resetApplication(this.id);\n }\n\n /**\n * When concatenated with a string, this automatically concatenates the app name rather than the app object.\n * @returns {string}\n */\n toString() {\n return this.name;\n }\n}\n\nOAuth2Application.prototype.reset =\n util.deprecate(OAuth2Application.prototype.reset, 'OAuth2Application#reset: userbot methods will be removed');\n\nmodule.exports = OAuth2Application;\n\n\n//# sourceURL=webpack:///./src/structures/OAuth2Application.js?"); +eval("const Snowflake = __webpack_require__(/*! ../util/Snowflake */ \"./src/util/Snowflake.js\");\nconst Team = __webpack_require__(/*! ./Team */ \"./src/structures/Team.js\");\nconst util = __webpack_require__(/*! util */ \"./node_modules/util/util.js\");\n\n/**\n * Represents an OAuth2 Application.\n */\nclass OAuth2Application {\n constructor(client, data) {\n /**\n * The client that instantiated the application\n * @name OAuth2Application#client\n * @type {Client}\n * @readonly\n */\n Object.defineProperty(this, 'client', { value: client });\n\n this.setup(data);\n }\n\n setup(data) {\n /**\n * The ID of the app\n * @type {Snowflake}\n */\n this.id = data.id;\n\n /**\n * The name of the app\n * @type {string}\n */\n this.name = data.name;\n\n /**\n * The app's description\n * @type {string}\n */\n this.description = data.description;\n\n /**\n * The app's icon hash\n * @type {?string}\n */\n this.icon = data.icon;\n\n /**\n * The app's icon URL\n * @type {string}\n */\n this.iconURL = `https://cdn.discordapp.com/app-icons/${this.id}/${this.icon}.jpg`;\n\n /**\n * The app's RPC origins\n * @type {?string[]}\n */\n this.rpcOrigins = data.rpc_origins;\n\n /**\n * The app's redirect URIs\n * @type {string[]}\n */\n this.redirectURIs = data.redirect_uris;\n\n /**\n * If this app's bot requires a code grant when using the OAuth2 flow\n * @type {boolean}\n */\n this.botRequireCodeGrant = data.bot_require_code_grant;\n\n /**\n * If this app's bot is public\n * @type {boolean}\n */\n this.botPublic = data.bot_public;\n\n /**\n * If this app can use rpc\n * @type {boolean}\n */\n this.rpcApplicationState = data.rpc_application_state;\n\n /**\n * Object containing basic info about this app's bot\n * @type {Object}\n */\n this.bot = data.bot;\n\n /**\n * The flags for the app\n * @type {number}\n */\n this.flags = data.flags;\n\n /**\n * OAuth2 secret for the application\n * @type {boolean}\n */\n this.secret = data.secret;\n\n if (data.owner) {\n /**\n * The owner of this OAuth application\n * @type {?User}\n */\n this.owner = this.client.dataManager.newUser(data.owner);\n }\n\n /**\n * The owning team of this OAuth application\n * In v12.0.0 this property moves to `Team#owner`.\n * @type {?Team}\n * @deprecated\n */\n this.team = data.team ? new Team(this.client, data.team) : null;\n }\n\n /**\n * The timestamp the app was created at\n * @type {number}\n * @readonly\n */\n get createdTimestamp() {\n return Snowflake.deconstruct(this.id).timestamp;\n }\n\n /**\n * The time the app was created\n * @type {Date}\n * @readonly\n */\n get createdAt() {\n return new Date(this.createdTimestamp);\n }\n\n /**\n * Reset the app's secret and bot token.\n * This is only available when using a user account.\n * @returns {OAuth2Application}\n * @deprecated\n */\n reset() {\n return this.client.rest.methods.resetApplication(this.id);\n }\n\n /**\n * When concatenated with a string, this automatically concatenates the app name rather than the app object.\n * @returns {string}\n */\n toString() {\n return this.name;\n }\n}\n\nOAuth2Application.prototype.reset =\n util.deprecate(OAuth2Application.prototype.reset, 'OAuth2Application#reset: userbot methods will be removed');\n\nmodule.exports = OAuth2Application;\n\n\n//# sourceURL=webpack:///./src/structures/OAuth2Application.js?"); /***/ }), @@ -1733,7 +1818,7 @@ eval("const Permissions = __webpack_require__(/*! ../util/Permissions */ \"./src /*! ModuleConcatenation bailout: Module is not an ECMAScript module */ /***/ (function(module, exports, __webpack_require__) { -eval("const { ActivityFlags, Endpoints } = __webpack_require__(/*! ../util/Constants */ \"./src/util/Constants.js\");\n\n/**\n * The status of this presence:\n *\n * * **`online`** - user is online\n * * **`idle`** - user is AFK\n * * **`offline`** - user is offline or invisible\n * * **`dnd`** - user is in Do Not Disturb\n * @typedef {string} PresenceStatus\n */\n\n/**\n * Represents a user's presence.\n */\nclass Presence {\n constructor(data = {}, client) {\n Object.defineProperty(this, 'client', { value: client });\n\n /**\n * The status of this presence:\n * @type {PresenceStatus}\n */\n this.status = data.status || 'offline';\n\n /**\n * The game that the user is playing\n * @type {?Game}\n */\n this.game = data.game ? new Game(data.game, this) : null;\n\n /**\n * The devices this presence is on\n * @type {?object}\n * @property {PresenceStatus} web\n * @property {PresenceStatus} mobile\n * @property {PresenceStatus} desktop\n */\n this.clientStatus = data.client_status || null;\n }\n\n update(data) {\n this.status = data.status || this.status;\n this.game = data.game ? new Game(data.game, this) : null;\n this.clientStatus = data.client_status || null;\n }\n\n /**\n * Whether this presence is equal to another\n * @param {Presence} presence The presence to compare with\n * @returns {boolean}\n */\n equals(presence) {\n return this === presence || (\n presence &&\n this.status === presence.status &&\n (this.game ? this.game.equals(presence.game) : !presence.game) &&\n this.clientStatus.web === presence.clientStatus.web &&\n this.clientStatus.mobile === presence.clientStatus.mobile &&\n this.clientStatus.desktop === presence.clientStatus.desktop\n );\n }\n}\n\n/**\n * Represents a game that is part of a user's presence.\n */\nclass Game {\n constructor(data, presence) {\n Object.defineProperty(this, 'presence', { value: presence });\n\n /**\n * The name of the game being played\n * @type {string}\n */\n this.name = data.name;\n\n /**\n * The type of the game status, its possible values:\n * - 0: Playing\n * - 1: Streaming\n * - 2: Listening\n * - 3: Watching\n * @type {number}\n */\n this.type = data.type;\n\n /**\n * If the game is being streamed, a link to the stream\n * @type {?string}\n */\n this.url = data.url || null;\n\n /**\n * Details about the activity\n * @type {?string}\n */\n this.details = data.details || null;\n\n /**\n * State of the activity\n * @type {?string}\n */\n this.state = data.state || null;\n\n /**\n * Application ID associated with this activity\n * @type {?Snowflake}\n */\n this.applicationID = data.application_id || null;\n\n /**\n * Timestamps for the activity\n * @type {?Object}\n * @prop {?Date} start When the activity started\n * @prop {?Date} end When the activity will end\n */\n this.timestamps = data.timestamps ? {\n start: data.timestamps.start ? new Date(Number(data.timestamps.start)) : null,\n end: data.timestamps.end ? new Date(Number(data.timestamps.end)) : null,\n } : null;\n\n /**\n * Party of the activity\n * @type {?Object}\n * @prop {?string} id ID of the party\n * @prop {number[]} size Size of the party as `[current, max]`\n */\n this.party = data.party || null;\n\n /**\n * Assets for rich presence\n * @type {?RichPresenceAssets}\n */\n this.assets = data.assets ? new RichPresenceAssets(this, data.assets) : null;\n\n this.syncID = data.sync_id;\n this._flags = data.flags;\n }\n\n get flags() {\n const flags = [];\n for (const [name, flag] of Object.entries(ActivityFlags)) {\n if ((this._flags & flag) === flag) flags.push(name);\n }\n return flags;\n }\n\n /**\n * Whether or not the game is being streamed\n * @type {boolean}\n * @readonly\n */\n get streaming() {\n return this.type === 1;\n }\n\n /**\n * When concatenated with a string, this automatically returns the game's name instead of the Game object.\n * @returns {string}\n */\n toString() {\n return this.name;\n }\n\n /**\n * Whether this game is equal to another game\n * @param {Game} game The game to compare with\n * @returns {boolean}\n */\n equals(game) {\n return this === game || (\n game &&\n this.name === game.name &&\n this.type === game.type &&\n this.url === game.url\n );\n }\n}\n\n/**\n * Assets for a rich presence\n */\nclass RichPresenceAssets {\n constructor(game, assets) {\n Object.defineProperty(this, 'game', { value: game });\n\n /**\n * Hover text for the large image\n * @type {?string}\n */\n this.largeText = assets.large_text || null;\n\n /**\n * Hover text for the small image\n * @type {?string}\n */\n this.smallText = assets.small_text || null;\n\n /**\n * ID of the large image asset\n * @type {?Snowflake}\n */\n this.largeImage = assets.large_image || null;\n\n /**\n * ID of the small image asset\n * @type {?Snowflake}\n */\n this.smallImage = assets.small_image || null;\n }\n\n /**\n * The URL of the small image asset\n * @type {?string}\n * @readonly\n */\n get smallImageURL() {\n if (!this.smallImage) return null;\n return Endpoints.CDN(this.game.presence.client.options.http.cdn)\n .AppAsset(this.game.applicationID, this.smallImage);\n }\n\n /**\n * The URL of the large image asset\n * @type {?string}\n * @readonly\n */\n get largeImageURL() {\n if (!this.largeImage) return null;\n if (/^spotify:/.test(this.largeImage)) {\n return `https://i.scdn.co/image/${this.largeImage.slice(8)}`;\n }\n return Endpoints.CDN(this.game.presence.client.options.http.cdn)\n .AppAsset(this.game.applicationID, this.largeImage);\n }\n}\n\nexports.Presence = Presence;\nexports.Game = Game;\nexports.RichPresenceAssets = RichPresenceAssets;\n\n\n//# sourceURL=webpack:///./src/structures/Presence.js?"); +eval("const { ActivityFlags, Endpoints } = __webpack_require__(/*! ../util/Constants */ \"./src/util/Constants.js\");\nconst ReactionEmoji = __webpack_require__(/*! ./ReactionEmoji */ \"./src/structures/ReactionEmoji.js\");\n\n/**\n * The status of this presence:\n * * **`online`** - user is online\n * * **`idle`** - user is AFK\n * * **`offline`** - user is offline or invisible\n * * **`dnd`** - user is in Do Not Disturb\n * @typedef {string} PresenceStatus\n */\n\n/**\n * The status of this presence:\n * * **`online`** - user is online\n * * **`idle`** - user is AFK\n * * **`dnd`** - user is in Do Not Disturb\n * @typedef {string} ClientPresenceStatus\n */\n\n/**\n * Represents a user's presence.\n */\nclass Presence {\n constructor(data = {}, client) {\n /**\n * The client that instantiated this\n * @name Presence#client\n * @type {Client}\n * @readonly\n */\n Object.defineProperty(this, 'client', { value: client });\n\n this.update(data);\n }\n\n update(data) {\n /**\n * The status of this presence:\n * @type {PresenceStatus}\n */\n this.status = data.status || this.status || 'offline';\n\n /**\n * The game that the user is playing\n * @type {?Game}\n * @deprecated\n */\n this.game = data.game ? new Game(data.game, this) : null;\n\n if (data.activities) {\n /**\n * The activities of this presence\n * @type {Game[]}\n */\n this.activities = data.activities.map(activity => new Game(activity, this));\n } else if (data.activity || data.game) {\n this.activities = [new Game(data.activity || data.game, this)];\n } else {\n this.activities = [];\n }\n\n /**\n * The devices this presence is on\n * @type {?Object}\n * @property {?ClientPresenceStatus} web The current presence in the web application\n * @property {?ClientPresenceStatus} mobile The current presence in the mobile application\n * @property {?ClientPresenceStatus} desktop The current presence in the desktop application\n */\n this.clientStatus = data.client_status || null;\n }\n\n /**\n * Whether this presence is equal to another\n * @param {Presence} presence The presence to compare with\n * @returns {boolean}\n */\n equals(presence) {\n return this === presence || (\n presence &&\n this.status === presence.status &&\n this.activities.length === presence.activities.length &&\n this.activities.every((activity, index) => activity.equals(presence.activities[index])) &&\n this.clientStatus.web === presence.clientStatus.web &&\n this.clientStatus.mobile === presence.clientStatus.mobile &&\n this.clientStatus.desktop === presence.clientStatus.desktop\n );\n }\n}\n\n/**\n * Represents a game that is part of a user's presence.\n */\nclass Game {\n constructor(data, presence) {\n Object.defineProperty(this, 'presence', { value: presence });\n\n /**\n * The name of the game being played\n * @type {string}\n */\n this.name = data.name;\n\n /**\n * The type of the game status, its possible values:\n * - 0: Playing\n * - 1: Streaming\n * - 2: Listening\n * - 3: Watching\n * @type {number}\n */\n this.type = data.type;\n\n /**\n * If the game is being streamed, a link to the stream\n * @type {?string}\n */\n this.url = data.url || null;\n\n /**\n * Details about the activity\n * @type {?string}\n */\n this.details = data.details || null;\n\n /**\n * State of the activity\n * @type {?string}\n */\n this.state = data.state || null;\n\n /**\n * Application ID associated with this activity\n * @type {?Snowflake}\n */\n this.applicationID = data.application_id || null;\n\n /**\n * Timestamps for the activity\n * @type {?Object}\n * @prop {?Date} start When the activity started\n * @prop {?Date} end When the activity will end\n */\n this.timestamps = data.timestamps ? {\n start: data.timestamps.start ? new Date(Number(data.timestamps.start)) : null,\n end: data.timestamps.end ? new Date(Number(data.timestamps.end)) : null,\n } : null;\n\n /**\n * Party of the activity\n * @type {?Object}\n * @prop {?string} id ID of the party\n * @prop {number[]} size Size of the party as `[current, max]`\n */\n this.party = data.party || null;\n\n /**\n * Assets for rich presence\n * @type {?RichPresenceAssets}\n */\n this.assets = data.assets ? new RichPresenceAssets(this, data.assets) : null;\n\n if (data.emoji) {\n /**\n * Emoji for a custom activity\n * There is no `reaction` property for this emoji.\n * @type {?ReactionEmoji}\n */\n this.emoji = new ReactionEmoji({ message: { client: this.presence.client } }, data.emoji);\n this.emoji.reaction = null;\n } else {\n this.emoji = null;\n }\n\n\n /**\n * Creation date of the activity\n * @type {number}\n */\n this.createdTimestamp = new Date(data.created_at).getTime();\n\n this.syncID = data.sync_id;\n this._flags = data.flags;\n }\n\n /**\n * The time the activity was created at\n * @type {Date}\n * @readonly\n */\n get createdAt() {\n return new Date(this.createdTimestamp);\n }\n\n /**\n * Flags that describe the activity\n * @type {ActivityFlags[]}\n */\n get flags() {\n const flags = [];\n for (const [name, flag] of Object.entries(ActivityFlags)) {\n if ((this._flags & flag) === flag) flags.push(name);\n }\n return flags;\n }\n\n /**\n * Whether or not the game is being streamed\n * @type {boolean}\n * @readonly\n */\n get streaming() {\n return this.type === 1;\n }\n\n /**\n * When concatenated with a string, this automatically returns the game's name instead of the Game object.\n * @returns {string}\n */\n toString() {\n return this.name;\n }\n\n /**\n * Whether this game is equal to another game\n * @param {Game} game The game to compare with\n * @returns {boolean}\n */\n equals(game) {\n return this === game || (\n game &&\n this.name === game.name &&\n this.type === game.type &&\n this.url === game.url\n );\n }\n}\n\n/**\n * Assets for a rich presence\n */\nclass RichPresenceAssets {\n constructor(game, assets) {\n Object.defineProperty(this, 'game', { value: game });\n\n /**\n * Hover text for the large image\n * @type {?string}\n */\n this.largeText = assets.large_text || null;\n\n /**\n * Hover text for the small image\n * @type {?string}\n */\n this.smallText = assets.small_text || null;\n\n /**\n * ID of the large image asset\n * @type {?Snowflake}\n */\n this.largeImage = assets.large_image || null;\n\n /**\n * ID of the small image asset\n * @type {?Snowflake}\n */\n this.smallImage = assets.small_image || null;\n }\n\n /**\n * The URL of the small image asset\n * @type {?string}\n * @readonly\n */\n get smallImageURL() {\n if (!this.smallImage) return null;\n return Endpoints.CDN(this.game.presence.client.options.http.cdn)\n .AppAsset(this.game.applicationID, this.smallImage);\n }\n\n /**\n * The URL of the large image asset\n * @type {?string}\n * @readonly\n */\n get largeImageURL() {\n if (!this.largeImage) return null;\n if (/^spotify:/.test(this.largeImage)) {\n return `https://i.scdn.co/image/${this.largeImage.slice(8)}`;\n } else if (/^twitch:/.test(this.largeImage)) {\n return `https://static-cdn.jtvnw.net/previews-ttv/live_user_${this.largeImage.slice(7)}.png`;\n }\n return Endpoints.CDN(this.game.presence.client.options.http.cdn)\n .AppAsset(this.game.applicationID, this.largeImage);\n }\n}\n\nexports.Presence = Presence;\nexports.Game = Game;\nexports.RichPresenceAssets = RichPresenceAssets;\n\n\n//# sourceURL=webpack:///./src/structures/Presence.js?"); /***/ }), @@ -1745,7 +1830,7 @@ eval("const { ActivityFlags, Endpoints } = __webpack_require__(/*! ../util/Const /*! ModuleConcatenation bailout: Module is not an ECMAScript module */ /***/ (function(module, exports, __webpack_require__) { -eval("const Collector = __webpack_require__(/*! ./interfaces/Collector */ \"./src/structures/interfaces/Collector.js\");\nconst Collection = __webpack_require__(/*! ../util/Collection */ \"./src/util/Collection.js\");\n\n/**\n * @typedef {CollectorOptions} ReactionCollectorOptions\n * @property {number} max The maximum total amount of reactions to collect\n * @property {number} maxEmojis The maximum number of emojis to collect\n * @property {number} maxUsers The maximum number of users to react\n */\n\n/**\n * Collects reactions on messages.\n * @extends {Collector}\n */\nclass ReactionCollector extends Collector {\n /**\n * @param {Message} message The message upon which to collect reactions\n * @param {CollectorFilter} filter The filter to apply to this collector\n * @param {ReactionCollectorOptions} [options={}] The options to apply to this collector\n */\n constructor(message, filter, options = {}) {\n super(message.client, filter, options);\n\n /**\n * The message\n * @type {Message}\n */\n this.message = message;\n\n /**\n * The users which have reacted\n * @type {Collection}\n */\n this.users = new Collection();\n\n /**\n * The total number of reactions collected\n * @type {number}\n */\n this.total = 0;\n\n this.client.setMaxListeners(this.client.getMaxListeners() + 1);\n this.client.on('messageReactionAdd', this.listener);\n }\n\n /**\n * Handle an incoming reaction for possible collection.\n * @param {MessageReaction} reaction The reaction to possibly collect\n * @returns {?{key: Snowflake, value: MessageReaction}}\n * @private\n */\n handle(reaction) {\n if (reaction.message.id !== this.message.id) return null;\n return {\n key: reaction.emoji.id || reaction.emoji.name,\n value: reaction,\n };\n }\n\n /**\n * Check after collection to see if the collector is done.\n * @param {MessageReaction} reaction The reaction that was collected\n * @param {User} user The user that reacted\n * @returns {?string} Reason to end the collector, if any\n * @private\n */\n postCheck(reaction, user) {\n this.users.set(user.id, user);\n if (this.options.max && ++this.total >= this.options.max) return 'limit';\n if (this.options.maxEmojis && this.collected.size >= this.options.maxEmojis) return 'emojiLimit';\n if (this.options.maxUsers && this.users.size >= this.options.maxUsers) return 'userLimit';\n return null;\n }\n\n /**\n * Remove event listeners.\n * @private\n */\n cleanup() {\n this.client.removeListener('messageReactionAdd', this.listener);\n this.client.setMaxListeners(this.client.getMaxListeners() - 1);\n }\n}\n\nmodule.exports = ReactionCollector;\n\n\n//# sourceURL=webpack:///./src/structures/ReactionCollector.js?"); +eval("const Collector = __webpack_require__(/*! ./interfaces/Collector */ \"./src/structures/interfaces/Collector.js\");\nconst Collection = __webpack_require__(/*! ../util/Collection */ \"./src/util/Collection.js\");\n\n/**\n * @typedef {CollectorOptions} ReactionCollectorOptions\n * @property {number} max The maximum total amount of reactions to collect\n * @property {number} maxEmojis The maximum number of emojis to collect\n * @property {number} maxUsers The maximum number of users to react\n */\n\n/**\n * Collects reactions on messages.\n * @extends {Collector}\n */\nclass ReactionCollector extends Collector {\n /**\n * @param {Message} message The message upon which to collect reactions\n * @param {CollectorFilter} filter The filter to apply to this collector\n * @param {ReactionCollectorOptions} [options={}] The options to apply to this collector\n */\n constructor(message, filter, options = {}) {\n super(message.client, filter, options);\n\n /**\n * The message\n * @type {Message}\n */\n this.message = message;\n\n /**\n * The users which have reacted\n * @type {Collection}\n */\n this.users = new Collection();\n\n /**\n * The total number of reactions collected\n * @type {number}\n */\n this.total = 0;\n\n if (this.client.getMaxListeners() !== 0) this.client.setMaxListeners(this.client.getMaxListeners() + 1);\n this.client.on('messageReactionAdd', this.listener);\n }\n\n /**\n * Handle an incoming reaction for possible collection.\n * @param {MessageReaction} reaction The reaction to possibly collect\n * @returns {?{key: Snowflake, value: MessageReaction}}\n * @private\n */\n handle(reaction) {\n if (reaction.message.id !== this.message.id) return null;\n return {\n key: reaction.emoji.id || reaction.emoji.name,\n value: reaction,\n };\n }\n\n /**\n * Check after collection to see if the collector is done.\n * @param {MessageReaction} reaction The reaction that was collected\n * @param {User} user The user that reacted\n * @returns {?string} Reason to end the collector, if any\n * @private\n */\n postCheck(reaction, user) {\n this.users.set(user.id, user);\n if (this.options.max && ++this.total >= this.options.max) return 'limit';\n if (this.options.maxEmojis && this.collected.size >= this.options.maxEmojis) return 'emojiLimit';\n if (this.options.maxUsers && this.users.size >= this.options.maxUsers) return 'userLimit';\n return null;\n }\n\n /**\n * Remove event listeners.\n * @private\n */\n cleanup() {\n this.client.removeListener('messageReactionAdd', this.listener);\n if (this.client.getMaxListeners() !== 0) this.client.setMaxListeners(this.client.getMaxListeners() - 1);\n }\n}\n\nmodule.exports = ReactionCollector;\n\n\n//# sourceURL=webpack:///./src/structures/ReactionCollector.js?"); /***/ }), @@ -1755,9 +1840,9 @@ eval("const Collector = __webpack_require__(/*! ./interfaces/Collector */ \"./sr \*****************************************/ /*! no static exports found */ /*! ModuleConcatenation bailout: Module is not an ECMAScript module */ -/***/ (function(module, exports) { +/***/ (function(module, exports, __webpack_require__) { -eval("/**\n * Represents a limited emoji set used for both custom and unicode emojis. Custom emojis\n * will use this class opposed to the Emoji class when the client doesn't know enough\n * information about them.\n */\nclass ReactionEmoji {\n constructor(reaction, name, id) {\n /**\n * The message reaction this emoji refers to\n * @type {MessageReaction}\n */\n this.reaction = reaction;\n\n /**\n * The name of this reaction emoji\n * @type {string}\n */\n this.name = name;\n\n /**\n * The ID of this reaction emoji\n * @type {?Snowflake}\n */\n this.id = id;\n }\n\n /**\n * The identifier of this emoji, used for message reactions\n * @type {string}\n * @readonly\n */\n get identifier() {\n if (this.id) return `${this.name}:${this.id}`;\n return encodeURIComponent(this.name);\n }\n\n /**\n * Creates the text required to form a graphical emoji on Discord.\n * @example\n * // Send the emoji used in a reaction to the channel the reaction is part of\n * reaction.message.channel.send(`The emoji used is ${reaction.emoji}`);\n * @returns {string}\n */\n toString() {\n return this.id ? `<:${this.name}:${this.id}>` : this.name;\n }\n}\n\nmodule.exports = ReactionEmoji;\n\n\n//# sourceURL=webpack:///./src/structures/ReactionEmoji.js?"); +eval("const Constants = __webpack_require__(/*! ../util/Constants */ \"./src/util/Constants.js\");\nconst Snowflake = __webpack_require__(/*! ../util/Snowflake */ \"./src/util/Snowflake.js\");\n\n/**\n * Represents a limited emoji set used for both custom and unicode emojis. Custom emojis\n * will use this class opposed to the Emoji class when the client doesn't know enough\n * information about them.\n */\nclass ReactionEmoji {\n constructor(reaction, emoji) {\n /**\n * The client that instantiated this object\n * @name ReactionEmoji#client\n * @type {Client}\n * @readonly\n */\n Object.defineProperty(this, 'client', { value: reaction.message.client });\n\n /**\n * The message reaction this emoji refers to\n * @type {MessageReaction}\n */\n this.reaction = reaction;\n\n /**\n * The name of this reaction emoji\n * @type {string}\n */\n this.name = emoji.name;\n\n /**\n * The ID of this reaction emoji\n * @type {?Snowflake}\n */\n this.id = emoji.id;\n\n /**\n * Whether this reaction emoji is animated\n * @type {boolean}\n */\n this.animated = emoji.animated || false;\n }\n\n /**\n * The timestamp the reaction emoji was created at, or null if unicode\n * @type {?number}\n * @readonly\n */\n get createdTimestamp() {\n if (!this.id) return null;\n return Snowflake.deconstruct(this.id).timestamp;\n }\n\n /**\n * The time the reaction emoji was created, or null if unicode\n * @type {?Date}\n * @readonly\n */\n get createdAt() {\n if (!this.id) return null;\n return new Date(this.createdTimestamp);\n }\n\n /**\n * The URL to the reaction emoji file, or null if unicode\n * @type {string}\n * @readonly\n */\n get url() {\n if (!this.id) return null;\n return Constants.Endpoints.CDN(this.client.options.http.cdn).Emoji(this.id, this.animated ? 'gif' : 'png');\n }\n\n /**\n * The identifier of this emoji, used for message reactions\n * @type {string}\n * @readonly\n */\n get identifier() {\n if (this.id) return `${this.name}:${this.id}`;\n return encodeURIComponent(this.name);\n }\n\n /**\n * Creates the text required to form a graphical emoji on Discord.\n * @example\n * // Send the emoji used in a reaction to the channel the reaction is part of\n * reaction.message.channel.send(`The emoji used is ${reaction.emoji}`);\n * @returns {string}\n */\n toString() {\n if (!this.id) return this.name;\n\n return `<${this.animated ? 'a' : ''}:${this.name}:${this.id}>`;\n }\n}\n\nmodule.exports = ReactionEmoji;\n\n\n//# sourceURL=webpack:///./src/structures/ReactionEmoji.js?"); /***/ }), @@ -1769,7 +1854,7 @@ eval("/**\n * Represents a limited emoji set used for both custom and unicode em /*! ModuleConcatenation bailout: Module is not an ECMAScript module */ /***/ (function(module, exports, __webpack_require__) { -eval("const Attachment = __webpack_require__(/*! ./Attachment */ \"./src/structures/Attachment.js\");\nconst MessageEmbed = __webpack_require__(/*! ./MessageEmbed */ \"./src/structures/MessageEmbed.js\");\nlet ClientDataResolver;\n\n/**\n * A rich embed to be sent with a message with a fluent interface for creation.\n * @param {Object} [data] Data to set in the rich embed\n */\nclass RichEmbed {\n constructor(data = {}) {\n /**\n * Title for this Embed\n * @type {string}\n */\n this.title = data.title;\n\n /**\n * Description for this Embed\n * @type {string}\n */\n this.description = data.description;\n\n /**\n * URL for this Embed\n * @type {string}\n */\n this.url = data.url;\n\n /**\n * Color for this Embed\n * @type {number}\n */\n this.color = data.color;\n\n /**\n * Author for this Embed\n * @type {Object}\n */\n this.author = data.author;\n\n /**\n * Timestamp for this Embed\n * @type {Date}\n */\n this.timestamp = data.timestamp;\n\n /**\n * Fields for this Embed\n * @type {Object[]}\n */\n this.fields = data.fields || [];\n\n /**\n * Thumbnail for this Embed\n * @type {Object}\n */\n this.thumbnail = data.thumbnail;\n\n /**\n * Image for this Embed\n * @type {Object}\n */\n this.image = data.image;\n\n /**\n * Footer for this Embed\n * @type {Object}\n */\n this.footer = data.footer;\n\n /**\n * File to upload alongside this Embed\n * @type {FileOptions|string|Attachment}\n */\n this.file = data.file;\n\n /**\n * The files to upload alongside this Embed\n * @type {Array}\n */\n this.files = [];\n }\n\n /**\n * Sets the title of this embed.\n * @param {StringResolvable} title The title\n * @returns {RichEmbed} This embed\n */\n setTitle(title) {\n title = resolveString(title);\n if (title.length > 256) throw new RangeError('RichEmbed titles may not exceed 256 characters.');\n this.title = title;\n return this;\n }\n\n /**\n * Sets the description of this embed.\n * @param {StringResolvable} description The description\n * @returns {RichEmbed} This embed\n */\n setDescription(description) {\n description = resolveString(description);\n if (description.length > 2048) throw new RangeError('RichEmbed descriptions may not exceed 2048 characters.');\n this.description = description;\n return this;\n }\n\n /**\n * Sets the URL of this embed.\n * @param {string} url The URL\n * @returns {RichEmbed} This embed\n */\n setURL(url) {\n this.url = url;\n return this;\n }\n\n /**\n * Sets the color of this embed.\n * @param {ColorResolvable} color The color of the embed\n * @returns {RichEmbed} This embed\n */\n setColor(color) {\n if (!ClientDataResolver) ClientDataResolver = __webpack_require__(/*! ../client/ClientDataResolver */ \"./src/client/ClientDataResolver.js\");\n this.color = ClientDataResolver.resolveColor(color);\n return this;\n }\n\n /**\n * Sets the author of this embed.\n * @param {StringResolvable} name The name of the author\n * @param {string} [icon] The icon URL of the author\n * @param {string} [url] The URL of the author\n * @returns {RichEmbed} This embed\n */\n setAuthor(name, icon, url) {\n this.author = { name: resolveString(name), icon_url: icon, url };\n return this;\n }\n\n /**\n * Sets the timestamp of this embed.\n * @param {Date|number} [timestamp=Date.now()] The timestamp or date\n * @returns {RichEmbed} This embed\n */\n setTimestamp(timestamp = Date.now()) {\n if (timestamp instanceof Date) timestamp = timestamp.getTime();\n this.timestamp = timestamp;\n return this;\n }\n\n /**\n * Adds a field to the embed (max 25).\n * @param {StringResolvable} name The name of the field\n * @param {StringResolvable} value The value of the field\n * @param {boolean} [inline=false] Set the field to display inline\n * @returns {RichEmbed} This embed\n */\n addField(name, value, inline = false) {\n if (this.fields.length >= 25) throw new RangeError('RichEmbeds may not exceed 25 fields.');\n name = resolveString(name);\n if (name.length > 256) throw new RangeError('RichEmbed field names may not exceed 256 characters.');\n if (!/\\S/.test(name)) throw new RangeError('RichEmbed field names may not be empty.');\n value = resolveString(value);\n if (value.length > 1024) throw new RangeError('RichEmbed field values may not exceed 1024 characters.');\n if (!/\\S/.test(value)) throw new RangeError('RichEmbed field values may not be empty.');\n this.fields.push({ name, value, inline });\n return this;\n }\n\n /**\n * Convenience function for `.addField('\\u200B', '\\u200B', inline)`.\n * @param {boolean} [inline=false] Set the field to display inline\n * @returns {RichEmbed} This embed\n */\n addBlankField(inline = false) {\n return this.addField('\\u200B', '\\u200B', inline);\n }\n\n /**\n * Set the thumbnail of this embed.\n * @param {string} url The URL of the thumbnail\n * @returns {RichEmbed} This embed\n */\n setThumbnail(url) {\n this.thumbnail = { url };\n return this;\n }\n\n /**\n * Set the image of this embed.\n * @param {string} url The URL of the image\n * @returns {RichEmbed} This embed\n */\n setImage(url) {\n this.image = { url };\n return this;\n }\n\n /**\n * Sets the footer of this embed.\n * @param {StringResolvable} text The text of the footer\n * @param {string} [icon] The icon URL of the footer\n * @returns {RichEmbed} This embed\n */\n setFooter(text, icon) {\n text = resolveString(text);\n if (text.length > 2048) throw new RangeError('RichEmbed footer text may not exceed 2048 characters.');\n this.footer = { text, icon_url: icon };\n return this;\n }\n\n /**\n * Sets the file to upload alongside the embed. This file can be accessed via `attachment://fileName.extension` when\n * setting an embed image or author/footer icons. Only one file may be attached.\n * @param {FileOptions|string|Attachment} file Local path or URL to the file to attach,\n * or valid FileOptions for a file to attach\n * @returns {RichEmbed} This embed\n */\n attachFile(file) {\n if (this.file) throw new RangeError('You may not upload more than one file at once.');\n if (file instanceof Attachment) file = file.file;\n this.file = file;\n return this;\n }\n\n /**\n * Sets the files to upload alongside the embed. A file can be accessed via `attachment://fileName.extension` when\n * setting an embed image or author/footer icons. Multiple files can be attached.\n * @param {Array} files Files to attach\n * @returns {RichEmbed}\n */\n attachFiles(files) {\n files = files.map(file => file instanceof Attachment ? file.file : file);\n this.files = this.files.concat(files);\n return this;\n }\n\n /**\n * The accumulated length for the embed title, description, fields, author and footer text\n * @type {number}\n * @readonly\n */\n get length() {\n return (\n (this.title ? this.title.length : 0) +\n (this.description ? this.description.length : 0) +\n (this.fields.length >= 1 ? this.fields.reduce((prev, curr) =>\n prev + curr.name.length + curr.value.length, 0) : 0) +\n (this.footer ? this.footer.text.length : 0) +\n (this.author ? this.author.name.length : 0));\n }\n\n /**\n * Transforms the embed object to be processed.\n * @returns {Object} The raw data of this embed\n * @private\n */\n _apiTransform() {\n return {\n title: this.title,\n type: 'rich',\n description: this.description,\n url: this.url,\n timestamp: this.timestamp ? new Date(this.timestamp) : null,\n color: this.color,\n fields: this.fields ?\n this.fields.map(field => ({ name: field.name, value: field.value, inline: field.inline })) :\n null,\n thumbnail: this.thumbnail ? {\n url: this.thumbnail.url,\n } : null,\n image: this.image ? {\n url: this.image.url,\n } : null,\n author: this.author ? {\n name: this.author.name,\n url: this.author.url,\n icon_url: this.author instanceof MessageEmbed.Author ? this.author.iconURL : this.author.icon_url,\n } : null,\n footer: this.footer ? {\n text: this.footer.text,\n icon_url: this.footer instanceof MessageEmbed.Footer ? this.footer.iconURL : this.footer.icon_url,\n } : null,\n };\n }\n}\n\nmodule.exports = RichEmbed;\n\nfunction resolveString(data) {\n if (typeof data === 'string') return data;\n if (data instanceof Array) return data.join('\\n');\n return String(data);\n}\n\n\n//# sourceURL=webpack:///./src/structures/RichEmbed.js?"); +eval("const Attachment = __webpack_require__(/*! ./Attachment */ \"./src/structures/Attachment.js\");\nconst MessageEmbed = __webpack_require__(/*! ./MessageEmbed */ \"./src/structures/MessageEmbed.js\");\nconst util = __webpack_require__(/*! ../util/Util */ \"./src/util/Util.js\");\nlet ClientDataResolver;\n\n/**\n * A rich embed to be sent with a message with a fluent interface for creation.\n * @param {Object} [data] Data to set in the rich embed\n */\nclass RichEmbed {\n constructor(data = {}) {\n /**\n * Title for this Embed\n * @type {string}\n */\n this.title = data.title;\n\n /**\n * Description for this Embed\n * @type {string}\n */\n this.description = data.description;\n\n /**\n * URL for this Embed\n * @type {string}\n */\n this.url = data.url;\n\n /**\n * Color for this Embed\n * @type {number}\n */\n this.color = data.color;\n\n /**\n * Author for this Embed\n * @type {Object}\n */\n this.author = data.author;\n\n /**\n * Timestamp for this Embed\n * @type {Date}\n */\n this.timestamp = data.timestamp;\n\n /**\n * Fields for this Embed\n * @type {Object[]}\n */\n this.fields = data.fields || [];\n\n /**\n * Thumbnail for this Embed\n * @type {Object}\n */\n this.thumbnail = data.thumbnail;\n\n /**\n * Image for this Embed\n * @type {Object}\n */\n this.image = data.image;\n\n /**\n * Footer for this Embed\n * @type {Object}\n */\n this.footer = data.footer;\n\n /**\n * File to upload alongside this Embed\n * @type {FileOptions|string|Attachment}\n */\n this.file = data.file;\n\n /**\n * The files to upload alongside this Embed\n * @type {Array}\n */\n this.files = [];\n }\n\n /**\n * Sets the title of this embed.\n * @param {StringResolvable} title The title\n * @returns {RichEmbed} This embed\n */\n setTitle(title) {\n title = util.resolveString(title);\n if (title.length > 256) throw new RangeError('RichEmbed titles may not exceed 256 characters.');\n this.title = title;\n return this;\n }\n\n /**\n * Sets the description of this embed.\n * @param {StringResolvable} description The description\n * @returns {RichEmbed} This embed\n */\n setDescription(description) {\n description = util.resolveString(description);\n if (description.length > 2048) throw new RangeError('RichEmbed descriptions may not exceed 2048 characters.');\n this.description = description;\n return this;\n }\n\n /**\n * Sets the URL of this embed.\n * @param {string} url The URL\n * @returns {RichEmbed} This embed\n */\n setURL(url) {\n this.url = url;\n return this;\n }\n\n /**\n * Sets the color of this embed.\n * @param {ColorResolvable} color The color of the embed\n * @returns {RichEmbed} This embed\n */\n setColor(color) {\n if (!ClientDataResolver) ClientDataResolver = __webpack_require__(/*! ../client/ClientDataResolver */ \"./src/client/ClientDataResolver.js\");\n this.color = ClientDataResolver.resolveColor(color);\n return this;\n }\n\n /**\n * Sets the author of this embed.\n * @param {StringResolvable} name The name of the author\n * @param {string} [icon] The icon URL of the author\n * @param {string} [url] The URL of the author\n * @returns {RichEmbed} This embed\n */\n setAuthor(name, icon, url) {\n this.author = { name: util.resolveString(name), icon_url: icon, url };\n return this;\n }\n\n /**\n * Sets the timestamp of this embed.\n * @param {Date|number} [timestamp=Date.now()] The timestamp or date\n * @returns {RichEmbed} This embed\n */\n setTimestamp(timestamp = Date.now()) {\n if (timestamp instanceof Date) timestamp = timestamp.getTime();\n this.timestamp = timestamp;\n return this;\n }\n\n /**\n * Adds a field to the embed (max 25).\n * @param {StringResolvable} name The name of the field\n * @param {StringResolvable} value The value of the field\n * @param {boolean} [inline=false] Set the field to display inline\n * @returns {RichEmbed} This embed\n */\n addField(name, value, inline = false) {\n if (this.fields.length >= 25) throw new RangeError('RichEmbeds may not exceed 25 fields.');\n this.fields.push(this.constructor.normalizeField(name, value, inline));\n return this;\n }\n\n /**\n * Convenience function for `.addField('\\u200B', '\\u200B', inline)`.\n * @param {boolean} [inline=false] Set the field to display inline\n * @returns {RichEmbed} This embed\n */\n addBlankField(inline = false) {\n return this.addField('\\u200B', '\\u200B', inline);\n }\n\n /**\n * @typedef {Object} EmbedField\n * @property {string} name The name of this field\n * @property {string} value The value of this field\n * @property {boolean} inline If this field will be displayed inline\n */\n\n /**\n * @typedef {Object} EmbedFieldData\n * @property {StringResolvable} name The name of this field\n * @property {StringResolvable} value The value of this field\n * @property {boolean} [inline=false] If this field will be displayed inline\n */\n\n /**\n * Removes, replaces, and inserts fields in the embed (max 25).\n * @param {number} index The index to start at\n * @param {number} deleteCount The number of fields to remove\n * @param {...EmbedFieldData} [fields] The replacing field objects\n * @returns {RichEmbed}\n */\n spliceFields(index, deleteCount, ...fields) {\n if (fields) {\n const mapper = ({ name, value, inline }) => this.constructor.normalizeField(name, value, inline);\n this.fields.splice(index, deleteCount, ...fields.map(mapper));\n } else {\n this.fields.splice(index, deleteCount);\n }\n return this;\n }\n\n /**\n * Set the thumbnail of this embed.\n * @param {string} url The URL of the thumbnail\n * @returns {RichEmbed} This embed\n */\n setThumbnail(url) {\n this.thumbnail = { url };\n return this;\n }\n\n /**\n * Set the image of this embed.\n * @param {string} url The URL of the image\n * @returns {RichEmbed} This embed\n */\n setImage(url) {\n this.image = { url };\n return this;\n }\n\n /**\n * Sets the footer of this embed.\n * @param {StringResolvable} text The text of the footer\n * @param {string} [icon] The icon URL of the footer\n * @returns {RichEmbed} This embed\n */\n setFooter(text, icon) {\n text = util.resolveString(text);\n if (text.length > 2048) throw new RangeError('RichEmbed footer text may not exceed 2048 characters.');\n this.footer = { text, icon_url: icon };\n return this;\n }\n\n /**\n * Sets the file to upload alongside the embed. This file can be accessed via `attachment://fileName.extension` when\n * setting an embed image or author/footer icons. Only one file may be attached.\n * @param {FileOptions|string|Attachment} file Local path or URL to the file to attach,\n * or valid FileOptions for a file to attach\n * @returns {RichEmbed} This embed\n */\n attachFile(file) {\n if (this.file) throw new RangeError('You may not upload more than one file at once.');\n if (file instanceof Attachment) file = file.file;\n this.file = file;\n return this;\n }\n\n /**\n * Sets the files to upload alongside the embed. A file can be accessed via `attachment://fileName.extension` when\n * setting an embed image or author/footer icons. Multiple files can be attached.\n * @param {Array} files Files to attach\n * @returns {RichEmbed}\n */\n attachFiles(files) {\n files = files.map(file => file instanceof Attachment ? file.file : file);\n this.files = this.files.concat(files);\n return this;\n }\n\n /**\n * The accumulated length for the embed title, description, fields, author and footer text\n * @type {number}\n * @readonly\n */\n get length() {\n return (\n (this.title ? this.title.length : 0) +\n (this.description ? this.description.length : 0) +\n (this.fields.length >= 1 ? this.fields.reduce((prev, curr) =>\n prev + curr.name.length + curr.value.length, 0) : 0) +\n (this.footer ? this.footer.text.length : 0) +\n (this.author ? this.author.name.length : 0));\n }\n\n /**\n * Transforms the embed to a plain object.\n * @returns {Object} The raw data of this embed\n */\n toJSON() {\n return {\n title: this.title,\n type: 'rich',\n description: this.description,\n url: this.url,\n timestamp: this.timestamp ? new Date(this.timestamp) : null,\n color: this.color,\n fields: this.fields ?\n this.fields.map(field => ({ name: field.name, value: field.value, inline: field.inline })) :\n null,\n thumbnail: this.thumbnail ? {\n url: this.thumbnail.url,\n } : null,\n image: this.image ? {\n url: this.image.url,\n } : null,\n author: this.author ? {\n name: this.author.name,\n url: this.author.url,\n icon_url: this.author instanceof MessageEmbed.Author ? this.author.iconURL : this.author.icon_url,\n } : null,\n footer: this.footer ? {\n text: this.footer.text,\n icon_url: this.footer instanceof MessageEmbed.Footer ? this.footer.iconURL : this.footer.icon_url,\n } : null,\n };\n }\n\n /**\n * Normalizes field input and resolves strings.\n * @param {StringResolvable} name The name of the field\n * @param {StringResolvable} value The value of the field\n * @param {boolean} [inline=false] Set the field to display inline\n * @returns {EmbedField}\n */\n static normalizeField(name, value, inline = false) {\n name = util.resolveString(name);\n if (name.length > 256) throw new RangeError('RichEmbed field names may not exceed 256 characters.');\n if (!/\\S/.test(name)) throw new RangeError('RichEmbed field names may not be empty.');\n value = util.resolveString(value);\n if (value.length > 1024) throw new RangeError('RichEmbed field values may not exceed 1024 characters.');\n if (!/\\S/.test(value)) throw new RangeError('RichEmbed field values may not be empty.');\n return { name, value, inline };\n }\n}\n\nmodule.exports = RichEmbed;\n\n\n//# sourceURL=webpack:///./src/structures/RichEmbed.js?"); /***/ }), @@ -1797,6 +1882,30 @@ eval("const GuildChannel = __webpack_require__(/*! ./GuildChannel */ \"./src/str /***/ }), +/***/ "./src/structures/Team.js": +/*!********************************!*\ + !*** ./src/structures/Team.js ***! + \********************************/ +/*! no static exports found */ +/*! ModuleConcatenation bailout: Module is not an ECMAScript module */ +/***/ (function(module, exports, __webpack_require__) { + +eval("const Snowflake = __webpack_require__(/*! ../util/Snowflake */ \"./src/util/Snowflake.js\");\nconst Collection = __webpack_require__(/*! ../util/Collection */ \"./src/util/Collection.js\");\nconst TeamMember = __webpack_require__(/*! ./TeamMember */ \"./src/structures/TeamMember.js\");\nconst Constants = __webpack_require__(/*! ../util/Constants */ \"./src/util/Constants.js\");\n\n/**\n * Represents a Client OAuth2 Application Team.\n */\nclass Team {\n constructor(client, data) {\n /**\n * The client that instantiated the team\n * @name Team#client\n * @type {Client}\n * @readonly\n */\n Object.defineProperty(this, 'client', { value: client });\n\n this._patch(data);\n }\n\n _patch(data) {\n /**\n * The ID of the Team\n * @type {Snowflake}\n */\n this.id = data.id;\n\n /**\n * The name of the Team\n * @type {string}\n */\n this.name = data.name;\n\n /**\n * The Team's icon hash\n * @type {?string}\n */\n this.icon = data.icon || null;\n\n /**\n * The Team's owner id\n * @type {?string}\n */\n this.ownerID = data.owner_user_id || null;\n\n /**\n * The Team's members\n * @type {Collection}\n */\n this.members = new Collection();\n\n for (const memberData of data.members) {\n const member = new TeamMember(this.client, this, memberData);\n this.members.set(member.id, member);\n }\n }\n\n /**\n * The owner of the team\n * @type {?TeamMember}\n * @readonly\n */\n get owner() {\n return this.members.get(this.ownerID) || null;\n }\n\n /**\n * The timestamp the team was created at\n * @type {number}\n * @readonly\n */\n get createdTimestamp() {\n return Snowflake.deconstruct(this.id).timestamp;\n }\n\n /**\n * The time the team was created at\n * @type {Date}\n * @readonly\n */\n get createdAt() {\n return new Date(this.createdTimestamp);\n }\n\n /**\n * A link to the teams's icon.\n * @type {?string}\n * @readonly\n */\n get iconURL() {\n if (!this.icon) return null;\n return Constants.Endpoints.CDN(this.client.options.http.cdn).TeamIcon(this.id, this.icon);\n }\n\n /**\n * When concatenated with a string, this automatically returns the Team's name instead of the\n * Team object.\n * @returns {string}\n * @example\n * // Logs: Team name: My Team\n * console.log(`Team name: ${team}`);\n */\n toString() {\n return this.name;\n }\n}\n\nmodule.exports = Team;\n\n\n//# sourceURL=webpack:///./src/structures/Team.js?"); + +/***/ }), + +/***/ "./src/structures/TeamMember.js": +/*!**************************************!*\ + !*** ./src/structures/TeamMember.js ***! + \**************************************/ +/*! no static exports found */ +/*! ModuleConcatenation bailout: Module is not an ECMAScript module */ +/***/ (function(module, exports, __webpack_require__) { + +eval("const { MembershipStates } = __webpack_require__(/*! ../util/Constants */ \"./src/util/Constants.js\");\n\n/**\n * Represents a Client OAuth2 Application Team Member.\n */\nclass TeamMember {\n constructor(client, team, data) {\n /**\n * The client that instantiated the Team Member\n * @name TeamMember#client\n * @type {Client}\n * @readonly\n */\n Object.defineProperty(this, 'client', { value: client });\n\n /**\n * The Team this member is part of\n * @type {Team}\n */\n this.team = team;\n\n this._patch(data);\n }\n\n _patch(data) {\n /**\n * The permissions this Team Member has with regard to the team\n * @type {string[]}\n */\n this.permissions = data.permissions;\n\n /**\n * The membership state this Team Member has with regard to the team\n * @type {MembershipStates}\n */\n this.membershipState = MembershipStates[data.membership_state];\n\n /**\n * The user for this Team Member\n * @type {User}\n */\n this.user = this.client.dataManager.newUser(data.user);\n }\n\n /**\n * The ID of the Team Member\n * @type {Snowflake}\n * @readonly\n */\n get id() {\n return this.user.id;\n }\n\n /**\n * When concatenated with a string, this automatically returns the team members's mention instead of the\n * TeamMember object.\n * @returns {string}\n * @example\n * // Logs: Team Member's mention: <@123456789>\n * console.log(`Team Member's mention: ${teamMember}`);\n */\n toString() {\n return this.user.toString();\n }\n}\n\nmodule.exports = TeamMember;\n\n\n//# sourceURL=webpack:///./src/structures/TeamMember.js?"); + +/***/ }), + /***/ "./src/structures/TextChannel.js": /*!***************************************!*\ !*** ./src/structures/TextChannel.js ***! @@ -1817,7 +1926,7 @@ eval("const GuildChannel = __webpack_require__(/*! ./GuildChannel */ \"./src/str /*! ModuleConcatenation bailout: Module is not an ECMAScript module */ /***/ (function(module, exports, __webpack_require__) { -eval("const TextBasedChannel = __webpack_require__(/*! ./interfaces/TextBasedChannel */ \"./src/structures/interfaces/TextBasedChannel.js\");\nconst Constants = __webpack_require__(/*! ../util/Constants */ \"./src/util/Constants.js\");\nconst Presence = __webpack_require__(/*! ./Presence */ \"./src/structures/Presence.js\").Presence;\nconst Snowflake = __webpack_require__(/*! ../util/Snowflake */ \"./src/util/Snowflake.js\");\nconst util = __webpack_require__(/*! util */ \"./node_modules/util/util.js\");\n\n/**\n * Represents a user on Discord.\n * @implements {TextBasedChannel}\n */\nclass User {\n constructor(client, data) {\n /**\n * The client that created the instance of the user\n * @name User#client\n * @type {Client}\n * @readonly\n */\n Object.defineProperty(this, 'client', { value: client });\n\n if (data) this.setup(data);\n }\n\n setup(data) {\n /**\n * The ID of the user\n * @type {Snowflake}\n */\n this.id = data.id;\n\n /**\n * The username of the user\n * @type {string}\n */\n this.username = data.username;\n\n /**\n * A discriminator based on username for the user\n * @type {string}\n */\n this.discriminator = data.discriminator;\n\n /**\n * The ID of the user's avatar\n * @type {string}\n */\n this.avatar = data.avatar;\n\n /**\n * Whether or not the user is a bot\n * @type {boolean}\n */\n this.bot = Boolean(data.bot);\n\n /**\n * The ID of the last message sent by the user, if one was sent\n * @type {?Snowflake}\n */\n this.lastMessageID = null;\n\n /**\n * The Message object of the last message sent by the user, if one was sent\n * @type {?Message}\n */\n this.lastMessage = null;\n }\n\n patch(data) {\n for (const prop of ['id', 'username', 'discriminator', 'avatar', 'bot']) {\n if (typeof data[prop] !== 'undefined') this[prop] = data[prop];\n }\n if (data.token) this.client.token = data.token;\n }\n\n /**\n * The timestamp the user was created at\n * @type {number}\n * @readonly\n */\n get createdTimestamp() {\n return Snowflake.deconstruct(this.id).timestamp;\n }\n\n /**\n * The time the user was created\n * @type {Date}\n * @readonly\n */\n get createdAt() {\n return new Date(this.createdTimestamp);\n }\n\n /**\n * The presence of this user\n * @type {Presence}\n * @readonly\n */\n get presence() {\n if (this.client.presences.has(this.id)) return this.client.presences.get(this.id);\n for (const guild of this.client.guilds.values()) {\n if (guild.presences.has(this.id)) return guild.presences.get(this.id);\n }\n return new Presence(undefined, this.client);\n }\n\n /**\n * A link to the user's avatar\n * @type {?string}\n * @readonly\n */\n get avatarURL() {\n if (!this.avatar) return null;\n return Constants.Endpoints.User(this).Avatar(this.client.options.http.cdn, this.avatar);\n }\n\n /**\n * A link to the user's default avatar\n * @type {string}\n * @readonly\n */\n get defaultAvatarURL() {\n const avatars = Object.keys(Constants.DefaultAvatars);\n const avatar = avatars[this.discriminator % avatars.length];\n return Constants.Endpoints.CDN(this.client.options.http.host).Asset(`${Constants.DefaultAvatars[avatar]}.png`);\n }\n\n /**\n * A link to the user's avatar if they have one. Otherwise a link to their default avatar will be returned\n * @type {string}\n * @readonly\n */\n get displayAvatarURL() {\n return this.avatarURL || this.defaultAvatarURL;\n }\n\n /**\n * The Discord \"tag\" (e.g. `hydrabolt#0001`) for this user\n * @type {string}\n * @readonly\n */\n get tag() {\n return `${this.username}#${this.discriminator}`;\n }\n\n /**\n * The note that is set for the user\n * This is only available when using a user account.\n * @type {?string}\n * @readonly\n * @deprecated\n */\n get note() {\n return this.client.user.notes.get(this.id) || null;\n }\n\n /**\n * Check whether the user is typing in a channel.\n * @param {ChannelResolvable} channel The channel to check in\n * @returns {boolean}\n */\n typingIn(channel) {\n channel = this.client.resolver.resolveChannel(channel);\n return channel._typing.has(this.id);\n }\n\n /**\n * Get the time that the user started typing.\n * @param {ChannelResolvable} channel The channel to get the time in\n * @returns {?Date}\n */\n typingSinceIn(channel) {\n channel = this.client.resolver.resolveChannel(channel);\n return channel._typing.has(this.id) ? new Date(channel._typing.get(this.id).since) : null;\n }\n\n /**\n * Get the amount of time the user has been typing in a channel for (in milliseconds), or -1 if they're not typing.\n * @param {ChannelResolvable} channel The channel to get the time in\n * @returns {number}\n */\n typingDurationIn(channel) {\n channel = this.client.resolver.resolveChannel(channel);\n return channel._typing.has(this.id) ? channel._typing.get(this.id).elapsedTime : -1;\n }\n\n /**\n * The DM between the client's user and this user\n * @type {?DMChannel}\n * @readonly\n */\n get dmChannel() {\n return this.client.channels.find(c => c.type === 'dm' && c.recipient.id === this.id);\n }\n\n /**\n * Creates a DM channel between the client and the user.\n * @returns {Promise}\n */\n createDM() {\n return this.client.rest.methods.createDM(this);\n }\n\n /**\n * Deletes a DM channel (if one exists) between the client and the user. Resolves with the channel if successful.\n * @returns {Promise}\n */\n deleteDM() {\n return this.client.rest.methods.deleteChannel(this);\n }\n\n /**\n * Sends a friend request to the user.\n * This is only available when using a user account.\n * @returns {Promise}\n * @deprecated\n */\n addFriend() {\n return this.client.rest.methods.addFriend(this);\n }\n\n /**\n * Removes the user from your friends.\n * This is only available when using a user account.\n * @returns {Promise}\n * @deprecated\n */\n removeFriend() {\n return this.client.rest.methods.removeFriend(this);\n }\n\n /**\n * Blocks the user.\n * This is only available when using a user account.\n * @returns {Promise}\n * @deprecated\n */\n block() {\n return this.client.rest.methods.blockUser(this);\n }\n\n /**\n * Unblocks the user.\n * This is only available when using a user account.\n * @returns {Promise}\n * @deprecated\n */\n unblock() {\n return this.client.rest.methods.unblockUser(this);\n }\n\n /**\n * Get the profile of the user.\n * This is only available when using a user account.\n * @returns {Promise}\n * @deprecated\n */\n fetchProfile() {\n return this.client.rest.methods.fetchUserProfile(this);\n }\n\n /**\n * Sets a note for the user.\n * This is only available when using a user account.\n * @param {string} note The note to set for the user\n * @returns {Promise}\n * @deprecated\n */\n setNote(note) {\n return this.client.rest.methods.setNote(this, note);\n }\n\n /**\n * Checks if the user is equal to another. It compares ID, username, discriminator, avatar, and bot flags.\n * It is recommended to compare equality by using `user.id === user2.id` unless you want to compare all properties.\n * @param {User} user User to compare with\n * @returns {boolean}\n */\n equals(user) {\n let equal = user &&\n this.id === user.id &&\n this.username === user.username &&\n this.discriminator === user.discriminator &&\n this.avatar === user.avatar &&\n this.bot === Boolean(user.bot);\n\n return equal;\n }\n\n /**\n * When concatenated with a string, this automatically concatenates the user's mention instead of the User object.\n * @returns {string}\n * @example\n * // logs: Hello from <@123456789>!\n * console.log(`Hello from ${user}!`);\n */\n toString() {\n return `<@${this.id}>`;\n }\n\n // These are here only for documentation purposes - they are implemented by TextBasedChannel\n /* eslint-disable no-empty-function */\n send() {}\n sendMessage() {}\n sendEmbed() {}\n sendFile() {}\n sendCode() {}\n}\n\nTextBasedChannel.applyToClass(User);\n\nUser.prototype.block =\n util.deprecate(User.prototype.block, 'User#block: userbot methods will be removed');\n\nUser.prototype.unblock =\n util.deprecate(User.prototype.unblock, 'User#unblock: userbot methods will be removed');\n\nUser.prototype.addFriend =\n util.deprecate(User.prototype.addFriend, 'User#addFriend: userbot methods will be removed');\n\nUser.prototype.removeFriend =\n util.deprecate(User.prototype.removeFriend, 'User#removeFriend: userbot methods will be removed');\n\nUser.prototype.setNote =\n util.deprecate(User.prototype.setNote, 'User#setNote, userbot methods will be removed');\n\nUser.prototype.fetchProfile =\n util.deprecate(User.prototype.fetchProfile, 'User#fetchProfile: userbot methods will be removed');\n\nmodule.exports = User;\n\n\n//# sourceURL=webpack:///./src/structures/User.js?"); +eval("const TextBasedChannel = __webpack_require__(/*! ./interfaces/TextBasedChannel */ \"./src/structures/interfaces/TextBasedChannel.js\");\nconst Constants = __webpack_require__(/*! ../util/Constants */ \"./src/util/Constants.js\");\nconst Presence = __webpack_require__(/*! ./Presence */ \"./src/structures/Presence.js\").Presence;\nconst Snowflake = __webpack_require__(/*! ../util/Snowflake */ \"./src/util/Snowflake.js\");\nconst util = __webpack_require__(/*! util */ \"./node_modules/util/util.js\");\n\n/**\n * Represents a user on Discord.\n * @implements {TextBasedChannel}\n */\nclass User {\n constructor(client, data) {\n /**\n * The client that created the instance of the user\n * @name User#client\n * @type {Client}\n * @readonly\n */\n Object.defineProperty(this, 'client', { value: client });\n\n if (data) this.setup(data);\n }\n\n setup(data) {\n /**\n * The ID of the user\n * @type {Snowflake}\n */\n this.id = data.id;\n\n /**\n * The username of the user\n * @type {string}\n */\n this.username = data.username;\n\n /**\n * A discriminator based on username for the user\n * @type {string}\n */\n this.discriminator = data.discriminator;\n\n /**\n * The ID of the user's avatar\n * @type {string}\n */\n this.avatar = data.avatar;\n\n /**\n * Whether or not the user is a bot\n * @type {boolean}\n */\n this.bot = Boolean(data.bot);\n\n /**\n * Whether this is an Official Discord System user (part of the urgent message system)\n * @type {?boolean}\n * @name User#system\n */\n if (typeof data.system !== 'undefined') this.system = Boolean(data.system);\n\n /**\n * The ID of the last message sent by the user, if one was sent\n * @type {?Snowflake}\n */\n this.lastMessageID = null;\n\n /**\n * The Message object of the last message sent by the user, if one was sent\n * @type {?Message}\n */\n this.lastMessage = null;\n }\n\n patch(data) {\n for (const prop of ['id', 'username', 'discriminator', 'avatar', 'bot']) {\n if (typeof data[prop] !== 'undefined') this[prop] = data[prop];\n }\n if (data.token) this.client.token = data.token;\n }\n\n /**\n * The timestamp the user was created at\n * @type {number}\n * @readonly\n */\n get createdTimestamp() {\n return Snowflake.deconstruct(this.id).timestamp;\n }\n\n /**\n * The time the user was created\n * @type {Date}\n * @readonly\n */\n get createdAt() {\n return new Date(this.createdTimestamp);\n }\n\n /**\n * The presence of this user\n * @type {Presence}\n * @readonly\n */\n get presence() {\n if (this.client.presences.has(this.id)) return this.client.presences.get(this.id);\n for (const guild of this.client.guilds.values()) {\n if (guild.presences.has(this.id)) return guild.presences.get(this.id);\n }\n return new Presence(undefined, this.client);\n }\n\n /**\n * A link to the user's avatar\n * @type {?string}\n * @readonly\n */\n get avatarURL() {\n if (!this.avatar) return null;\n return Constants.Endpoints.User(this).Avatar(this.client.options.http.cdn, this.avatar);\n }\n\n /**\n * A link to the user's default avatar\n * @type {string}\n * @readonly\n */\n get defaultAvatarURL() {\n const avatars = Object.keys(Constants.DefaultAvatars);\n const avatar = avatars[this.discriminator % avatars.length];\n return Constants.Endpoints.CDN(this.client.options.http.host).Asset(`${Constants.DefaultAvatars[avatar]}.png`);\n }\n\n /**\n * A link to the user's avatar if they have one. Otherwise a link to their default avatar will be returned\n * @type {string}\n * @readonly\n */\n get displayAvatarURL() {\n return this.avatarURL || this.defaultAvatarURL;\n }\n\n /**\n * The Discord \"tag\" (e.g. `hydrabolt#0001`) for this user\n * @type {string}\n * @readonly\n */\n get tag() {\n return `${this.username}#${this.discriminator}`;\n }\n\n /**\n * The note that is set for the user\n * This is only available when using a user account.\n * @type {?string}\n * @readonly\n * @deprecated\n */\n get note() {\n return this.client.user.notes.get(this.id) || null;\n }\n\n /**\n * Check whether the user is typing in a channel.\n * @param {ChannelResolvable} channel The channel to check in\n * @returns {boolean}\n */\n typingIn(channel) {\n channel = this.client.resolver.resolveChannel(channel);\n return channel._typing.has(this.id);\n }\n\n /**\n * Get the time that the user started typing.\n * @param {ChannelResolvable} channel The channel to get the time in\n * @returns {?Date}\n */\n typingSinceIn(channel) {\n channel = this.client.resolver.resolveChannel(channel);\n return channel._typing.has(this.id) ? new Date(channel._typing.get(this.id).since) : null;\n }\n\n /**\n * Get the amount of time the user has been typing in a channel for (in milliseconds), or -1 if they're not typing.\n * @param {ChannelResolvable} channel The channel to get the time in\n * @returns {number}\n */\n typingDurationIn(channel) {\n channel = this.client.resolver.resolveChannel(channel);\n return channel._typing.has(this.id) ? channel._typing.get(this.id).elapsedTime : -1;\n }\n\n /**\n * The DM between the client's user and this user\n * @type {?DMChannel}\n * @readonly\n */\n get dmChannel() {\n return this.client.channels.find(c => c.type === 'dm' && c.recipient.id === this.id);\n }\n\n /**\n * Creates a DM channel between the client and the user.\n * @returns {Promise}\n */\n createDM() {\n return this.client.rest.methods.createDM(this);\n }\n\n /**\n * Deletes a DM channel (if one exists) between the client and the user. Resolves with the channel if successful.\n * @returns {Promise}\n */\n deleteDM() {\n return this.client.rest.methods.deleteChannel(this);\n }\n\n /**\n * Sends a friend request to the user.\n * This is only available when using a user account.\n * @returns {Promise}\n * @deprecated\n */\n addFriend() {\n return this.client.rest.methods.addFriend(this);\n }\n\n /**\n * Removes the user from your friends.\n * This is only available when using a user account.\n * @returns {Promise}\n * @deprecated\n */\n removeFriend() {\n return this.client.rest.methods.removeFriend(this);\n }\n\n /**\n * Blocks the user.\n * This is only available when using a user account.\n * @returns {Promise}\n * @deprecated\n */\n block() {\n return this.client.rest.methods.blockUser(this);\n }\n\n /**\n * Unblocks the user.\n * This is only available when using a user account.\n * @returns {Promise}\n * @deprecated\n */\n unblock() {\n return this.client.rest.methods.unblockUser(this);\n }\n\n /**\n * Get the profile of the user.\n * This is only available when using a user account.\n * @returns {Promise}\n * @deprecated\n */\n fetchProfile() {\n return this.client.rest.methods.fetchUserProfile(this);\n }\n\n /**\n * Sets a note for the user.\n * This is only available when using a user account.\n * @param {string} note The note to set for the user\n * @returns {Promise}\n * @deprecated\n */\n setNote(note) {\n return this.client.rest.methods.setNote(this, note);\n }\n\n /**\n * Checks if the user is equal to another. It compares ID, username, discriminator, avatar, and bot flags.\n * It is recommended to compare equality by using `user.id === user2.id` unless you want to compare all properties.\n * @param {User} user User to compare with\n * @returns {boolean}\n */\n equals(user) {\n let equal = user &&\n this.id === user.id &&\n this.username === user.username &&\n this.discriminator === user.discriminator &&\n this.avatar === user.avatar &&\n this.bot === Boolean(user.bot);\n\n return equal;\n }\n\n /**\n * When concatenated with a string, this automatically concatenates the user's mention instead of the User object.\n * @returns {string}\n * @example\n * // logs: Hello from <@123456789>!\n * console.log(`Hello from ${user}!`);\n */\n toString() {\n return `<@${this.id}>`;\n }\n\n // These are here only for documentation purposes - they are implemented by TextBasedChannel\n /* eslint-disable no-empty-function */\n send() {}\n sendMessage() {}\n sendEmbed() {}\n sendFile() {}\n sendCode() {}\n}\n\nTextBasedChannel.applyToClass(User);\n\nUser.prototype.block =\n util.deprecate(User.prototype.block, 'User#block: userbot methods will be removed');\n\nUser.prototype.unblock =\n util.deprecate(User.prototype.unblock, 'User#unblock: userbot methods will be removed');\n\nUser.prototype.addFriend =\n util.deprecate(User.prototype.addFriend, 'User#addFriend: userbot methods will be removed');\n\nUser.prototype.removeFriend =\n util.deprecate(User.prototype.removeFriend, 'User#removeFriend: userbot methods will be removed');\n\nUser.prototype.setNote =\n util.deprecate(User.prototype.setNote, 'User#setNote, userbot methods will be removed');\n\nUser.prototype.fetchProfile =\n util.deprecate(User.prototype.fetchProfile, 'User#fetchProfile: userbot methods will be removed');\n\nmodule.exports = User;\n\n\n//# sourceURL=webpack:///./src/structures/User.js?"); /***/ }), @@ -1877,7 +1986,7 @@ eval("/**\n * Represents a Discord voice region for guilds.\n */\nclass VoiceReg /*! ModuleConcatenation bailout: Module is not an ECMAScript module */ /***/ (function(module, exports, __webpack_require__) { -eval("/* WEBPACK VAR INJECTION */(function(Buffer) {const EventEmitter = __webpack_require__(/*! events */ \"./node_modules/events/events.js\");\nconst path = __webpack_require__(/*! path */ \"./node_modules/path-browserify/index.js\");\nconst Util = __webpack_require__(/*! ../util/Util */ \"./src/util/Util.js\");\nconst Attachment = __webpack_require__(/*! ./Attachment */ \"./src/structures/Attachment.js\");\nconst RichEmbed = __webpack_require__(/*! ./RichEmbed */ \"./src/structures/RichEmbed.js\");\n\n/**\n * Represents a webhook.\n */\nclass Webhook extends EventEmitter {\n constructor(client, dataOrID, token) {\n super();\n if (client) {\n /**\n * The client that instantiated the webhook\n * @name Webhook#client\n * @type {Client}\n * @readonly\n */\n Object.defineProperty(this, 'client', { value: client });\n if (dataOrID) this.setup(dataOrID);\n } else {\n this.id = dataOrID;\n this.token = token;\n Object.defineProperty(this, 'client', { value: this });\n }\n }\n\n setup(data) {\n /**\n * The name of the webhook\n * @type {string}\n */\n this.name = data.name;\n\n /**\n * The token for the webhook\n * @name Webhook#token\n * @type {string}\n */\n Object.defineProperty(this, 'token', { value: data.token, writable: true, configurable: true });\n\n /**\n * The avatar for the webhook\n * @type {?string}\n */\n this.avatar = data.avatar;\n\n /**\n * The ID of the webhook\n * @type {Snowflake}\n */\n this.id = data.id;\n\n /**\n * The guild the webhook belongs to\n * @type {Snowflake}\n */\n this.guildID = data.guild_id;\n\n /**\n * The channel the webhook belongs to\n * @type {Snowflake}\n */\n this.channelID = data.channel_id;\n\n if (data.user) {\n /**\n * The owner of the webhook\n * @type {?User|Object}\n */\n this.owner = this.client.users ? this.client.users.get(data.user.id) : data.user;\n } else {\n this.owner = null;\n }\n }\n\n /**\n * Options that can be passed into send, sendMessage, sendFile, sendEmbed, and sendCode.\n * @typedef {Object} WebhookMessageOptions\n * @property {string} [username=this.name] Username override for the message\n * @property {string} [avatarURL] Avatar URL override for the message\n * @property {boolean} [tts=false] Whether or not the message should be spoken aloud\n * @property {string} [nonce=''] The nonce for the message\n * @property {Array} [embeds] An array of embeds for the message\n * (see [here](https://discordapp.com/developers/docs/resources/channel#embed-object) for more details)\n * @property {boolean} [disableEveryone=this.client.options.disableEveryone] Whether or not @everyone and @here\n * should be replaced with plain-text\n * @property {FileOptions|BufferResolvable|Attachment} [file] A file to send with the message **(deprecated)**\n * @property {FileOptions[]|BufferResolvable[]|Attachment[]} [files] Files to send with the message\n * @property {string|boolean} [code] Language for optional codeblock formatting to apply\n * @property {boolean|SplitOptions} [split=false] Whether or not the message should be split into multiple messages if\n * it exceeds the character limit. If an object is provided, these are the options for splitting the message.\n */\n\n /**\n * Send a message with this webhook.\n * @param {StringResolvable} content The content to send\n * @param {WebhookMessageOptions|Attachment|RichEmbed} [options] The options to provide,\n * can also be just a RichEmbed or Attachment\n * @returns {Promise}\n * @example\n * // Send a basic message\n * webhook.send('hello!')\n * .then(message => console.log(`Sent message: ${message.content}`))\n * .catch(console.error);\n * @example\n * // Send a remote file\n * webhook.send({\n * files: ['https://cdn.discordapp.com/icons/222078108977594368/6e1019b3179d71046e463a75915e7244.png?size=2048']\n * })\n * .then(console.log)\n * .catch(console.error);\n * @example\n * // Send a local file\n * webhook.send({\n * files: [{\n * attachment: 'entire/path/to/file.jpg',\n * name: 'file.jpg'\n * }]\n * })\n * .then(console.log)\n * .catch(console.error);\n * @example\n * // Send an embed with a local image inside\n * webhook.send('This is an embed', {\n * embeds: [{\n * thumbnail: {\n * url: 'attachment://file.jpg'\n * }\n * }],\n * files: [{\n * attachment: 'entire/path/to/file.jpg',\n * name: 'file.jpg'\n * }]\n * })\n * .then(console.log)\n * .catch(console.error);\n */\n send(content, options) { // eslint-disable-line complexity\n if (!options && typeof content === 'object' && !(content instanceof Array)) {\n options = content;\n content = '';\n } else if (!options) {\n options = {};\n }\n\n if (options instanceof Attachment) options = { files: [options] };\n if (options instanceof RichEmbed) options = { embeds: [options] };\n\n if (content) {\n content = this.client.resolver.resolveString(content);\n let { split, code, disableEveryone } = options;\n if (split && typeof split !== 'object') split = {};\n if (typeof code !== 'undefined' && (typeof code !== 'boolean' || code === true)) {\n content = Util.escapeMarkdown(content, true);\n content = `\\`\\`\\`${typeof code !== 'boolean' ? code || '' : ''}\\n${content}\\n\\`\\`\\``;\n if (split) {\n split.prepend = `\\`\\`\\`${typeof code !== 'boolean' ? code || '' : ''}\\n`;\n split.append = '\\n```';\n }\n }\n if (disableEveryone || (typeof disableEveryone === 'undefined' && this.client.options.disableEveryone)) {\n content = content.replace(/@(everyone|here)/g, '@\\u200b$1');\n }\n\n if (split) content = Util.splitMessage(content, split);\n }\n\n if (options.file) {\n if (options.files) options.files.push(options.file);\n else options.files = [options.file];\n }\n\n if (options.embeds) {\n const files = [];\n for (const embed of options.embeds) {\n if (embed.file) files.push(embed.file);\n }\n if (options.files) options.files.push(...files);\n else options.files = files;\n }\n\n if (options.embeds) options.embeds = options.embeds.map(e => new RichEmbed(e)._apiTransform());\n\n if (options.files) {\n for (let i = 0; i < options.files.length; i++) {\n let file = options.files[i];\n if (typeof file === 'string' || Buffer.isBuffer(file)) file = { attachment: file };\n if (!file.name) {\n if (typeof file.attachment === 'string') {\n file.name = path.basename(file.attachment);\n } else if (file.attachment && file.attachment.path) {\n file.name = path.basename(file.attachment.path);\n } else if (file instanceof Attachment) {\n file = { attachment: file.file, name: path.basename(file.file) || 'file.jpg' };\n } else {\n file.name = 'file.jpg';\n }\n } else if (file instanceof Attachment) {\n file = file.file;\n }\n options.files[i] = file;\n }\n\n return Promise.all(options.files.map(file =>\n this.client.resolver.resolveFile(file.attachment).then(resource => {\n file.file = resource;\n return file;\n })\n )).then(files => this.client.rest.methods.sendWebhookMessage(this, content, options, files));\n }\n\n return this.client.rest.methods.sendWebhookMessage(this, content, options);\n }\n\n /**\n * Send a message with this webhook\n * @param {StringResolvable} content The content to send\n * @param {WebhookMessageOptions} [options={}] The options to provide\n * @returns {Promise}\n * @deprecated\n * @example\n * // Send a message\n * webhook.sendMessage('hello!')\n * .then(message => console.log(`Sent message: ${message.content}`))\n * .catch(console.error);\n */\n sendMessage(content, options = {}) {\n return this.send(content, options);\n }\n\n /**\n * Send a file with this webhook.\n * @param {BufferResolvable} attachment The file to send\n * @param {string} [name='file.jpg'] The name and extension of the file\n * @param {StringResolvable} [content] Text message to send with the attachment\n * @param {WebhookMessageOptions} [options] The options to provide\n * @returns {Promise}\n * @deprecated\n */\n sendFile(attachment, name, content, options = {}) {\n return this.send(content, Object.assign(options, { file: { attachment, name } }));\n }\n\n /**\n * Send a code block with this webhook.\n * @param {string} lang Language for the code block\n * @param {StringResolvable} content Content of the code block\n * @param {WebhookMessageOptions} options The options to provide\n * @returns {Promise}\n * @deprecated\n */\n sendCode(lang, content, options = {}) {\n return this.send(content, Object.assign(options, { code: lang }));\n }\n\n /**\n * Send a raw slack message with this webhook.\n * @param {Object} body The raw body to send\n * @returns {Promise}\n * @example\n * // Send a slack message\n * webhook.sendSlackMessage({\n * 'username': 'Wumpus',\n * 'attachments': [{\n * 'pretext': 'this looks pretty cool',\n * 'color': '#F0F',\n * 'footer_icon': 'http://snek.s3.amazonaws.com/topSnek.png',\n * 'footer': 'Powered by sneks',\n * 'ts': Date.now() / 1000\n * }]\n * }).catch(console.error);\n */\n sendSlackMessage(body) {\n return this.client.rest.methods.sendSlackWebhookMessage(this, body);\n }\n\n /**\n * Edit the webhook.\n * @param {string} name The new name for the webhook\n * @param {BufferResolvable} [avatar] The new avatar for the webhook\n * @returns {Promise}\n */\n edit(name = this.name, avatar) {\n if (avatar) {\n return this.client.resolver.resolveImage(avatar).then(data =>\n this.client.rest.methods.editWebhook(this, name, data)\n );\n }\n return this.client.rest.methods.editWebhook(this, name);\n }\n\n /**\n * Delete the webhook.\n * @param {string} [reason] Reason for deleting the webhook\n * @returns {Promise}\n */\n delete(reason) {\n return this.client.rest.methods.deleteWebhook(this, reason);\n }\n}\n\nmodule.exports = Webhook;\n\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../node_modules/buffer/index.js */ \"./node_modules/buffer/index.js\").Buffer))\n\n//# sourceURL=webpack:///./src/structures/Webhook.js?"); +eval("/* WEBPACK VAR INJECTION */(function(Buffer) {const EventEmitter = __webpack_require__(/*! events */ \"./node_modules/events/events.js\");\nconst path = __webpack_require__(/*! path */ \"./node_modules/path-browserify/index.js\");\nconst Util = __webpack_require__(/*! ../util/Util */ \"./src/util/Util.js\");\nconst Attachment = __webpack_require__(/*! ./Attachment */ \"./src/structures/Attachment.js\");\nconst RichEmbed = __webpack_require__(/*! ./RichEmbed */ \"./src/structures/RichEmbed.js\");\nconst Constants = __webpack_require__(/*! ../util/Constants */ \"./src/util/Constants.js\");\nconst Snowflake = __webpack_require__(/*! ../util/Snowflake */ \"./src/util/Snowflake.js\");\n\n/**\n * Represents a webhook.\n */\nclass Webhook extends EventEmitter {\n constructor(client, dataOrID, token) {\n super();\n if (client) {\n /**\n * The client that instantiated the webhook\n * @name Webhook#client\n * @type {Client}\n * @readonly\n */\n Object.defineProperty(this, 'client', { value: client });\n if (dataOrID) this.setup(dataOrID);\n } else {\n this.id = dataOrID;\n this.token = token;\n Object.defineProperty(this, 'client', { value: this });\n }\n }\n\n setup(data) {\n /**\n * The name of the webhook\n * @type {string}\n */\n this.name = data.name;\n\n /**\n * The token for the webhook\n * @name Webhook#token\n * @type {?string}\n */\n Object.defineProperty(this, 'token', { value: data.token || null, writable: true, configurable: true });\n\n /**\n * The avatar for the webhook\n * @type {?string}\n */\n this.avatar = data.avatar;\n\n /**\n * The ID of the webhook\n * @type {Snowflake}\n */\n this.id = data.id;\n\n /**\n * The type of the webhook\n * @type {WebhookTypes}\n */\n this.type = Constants.WebhookTypes[data.type];\n\n /**\n * The guild the webhook belongs to\n * @type {Snowflake}\n */\n this.guildID = data.guild_id;\n\n /**\n * The channel the webhook belongs to\n * @type {Snowflake}\n */\n this.channelID = data.channel_id;\n\n if (data.user) {\n /**\n * The owner of the webhook\n * @type {?User|Object}\n */\n this.owner = this.client.users ? this.client.users.get(data.user.id) : data.user;\n } else {\n this.owner = null;\n }\n }\n\n /**\n * The timestamp the webhook was created at\n * @type {number}\n * @readonly\n */\n get createdTimestamp() {\n return Snowflake.deconstruct(this.id).timestamp;\n }\n\n /**\n * The time the webhook was created at\n * @type {Date}\n * @readonly\n */\n get createdAt() {\n return new Date(this.createdTimestamp);\n }\n\n /**\n * A link to the webhook user's avatar\n * @type {?stirng}\n * @readonly\n */\n get avatarURL() {\n if (!this.avatar) return null;\n return Constants.Endpoints.CDN(this.client.options.http.cdn).Avatar(this.id, this.avatar);\n }\n\n /**\n * The url of this webhook\n * @type {string}\n * @readonly\n */\n get url() {\n const API = `${this.client.options.http.host}/api/v${this.client.options.http.version}`;\n return API + Constants.Endpoints.Webhook(this.id, this.token);\n }\n\n /**\n * Options that can be passed into send, sendMessage, sendFile, sendEmbed, and sendCode.\n * @typedef {Object} WebhookMessageOptions\n * @property {string} [username=this.name] Username override for the message\n * @property {string} [avatarURL] Avatar URL override for the message\n * @property {boolean} [tts=false] Whether or not the message should be spoken aloud\n * @property {string} [nonce=''] The nonce for the message\n * @property {Array} [embeds] An array of embeds for the message\n * (see [here](https://discordapp.com/developers/docs/resources/channel#embed-object) for more details)\n * @property {boolean} [disableEveryone=this.client.options.disableEveryone] Whether or not @everyone and @here\n * should be replaced with plain-text\n * @property {FileOptions|BufferResolvable|Attachment} [file] A file to send with the message **(deprecated)**\n * @property {FileOptions[]|BufferResolvable[]|Attachment[]} [files] Files to send with the message\n * @property {string|boolean} [code] Language for optional codeblock formatting to apply\n * @property {boolean|SplitOptions} [split=false] Whether or not the message should be split into multiple messages if\n * it exceeds the character limit. If an object is provided, these are the options for splitting the message.\n */\n\n /**\n * Send a message with this webhook.\n * @param {StringResolvable} content The content to send\n * @param {WebhookMessageOptions|Attachment|RichEmbed} [options] The options to provide,\n * can also be just a RichEmbed or Attachment\n * @returns {Promise}\n * @example\n * // Send a basic message\n * webhook.send('hello!')\n * .then(message => console.log(`Sent message: ${message.content}`))\n * .catch(console.error);\n * @example\n * // Send a remote file\n * webhook.send({\n * files: ['https://cdn.discordapp.com/icons/222078108977594368/6e1019b3179d71046e463a75915e7244.png?size=2048']\n * })\n * .then(console.log)\n * .catch(console.error);\n * @example\n * // Send a local file\n * webhook.send({\n * files: [{\n * attachment: 'entire/path/to/file.jpg',\n * name: 'file.jpg'\n * }]\n * })\n * .then(console.log)\n * .catch(console.error);\n * @example\n * // Send an embed with a local image inside\n * webhook.send('This is an embed', {\n * embeds: [{\n * thumbnail: {\n * url: 'attachment://file.jpg'\n * }\n * }],\n * files: [{\n * attachment: 'entire/path/to/file.jpg',\n * name: 'file.jpg'\n * }]\n * })\n * .then(console.log)\n * .catch(console.error);\n */\n send(content, options) { // eslint-disable-line complexity\n if (!options && typeof content === 'object' && !(content instanceof Array)) {\n options = content;\n content = '';\n } else if (!options) {\n options = {};\n }\n\n if (options instanceof Attachment) options = { files: [options] };\n if (options instanceof RichEmbed) options = { embeds: [options] };\n\n if (content) {\n content = this.client.resolver.resolveString(content);\n let { split, code, disableEveryone } = options;\n if (split && typeof split !== 'object') split = {};\n if (typeof code !== 'undefined' && (typeof code !== 'boolean' || code === true)) {\n content = Util.escapeMarkdown(content, true);\n content = `\\`\\`\\`${typeof code !== 'boolean' ? code || '' : ''}\\n${content}\\n\\`\\`\\``;\n if (split) {\n split.prepend = `\\`\\`\\`${typeof code !== 'boolean' ? code || '' : ''}\\n`;\n split.append = '\\n```';\n }\n }\n if (disableEveryone || (typeof disableEveryone === 'undefined' && this.client.options.disableEveryone)) {\n content = content.replace(/@(everyone|here)/g, '@\\u200b$1');\n }\n\n if (split) content = Util.splitMessage(content, split);\n }\n\n if (options.file) {\n if (options.files) options.files.push(options.file);\n else options.files = [options.file];\n }\n\n if (options.embeds) {\n const files = [];\n for (const embed of options.embeds) {\n if (embed.file) files.push(embed.file);\n }\n if (options.files) options.files.push(...files);\n else options.files = files;\n }\n\n if (options.embeds) options.embeds = options.embeds.map(e => new RichEmbed(e).toJSON());\n\n if (options.files) {\n for (let i = 0; i < options.files.length; i++) {\n let file = options.files[i];\n if (typeof file === 'string' || Buffer.isBuffer(file)) file = { attachment: file };\n if (!file.name) {\n if (typeof file.attachment === 'string') {\n file.name = path.basename(file.attachment);\n } else if (file.attachment && file.attachment.path) {\n file.name = path.basename(file.attachment.path);\n } else if (file instanceof Attachment) {\n file = { attachment: file.file, name: path.basename(file.file) || 'file.jpg' };\n } else {\n file.name = 'file.jpg';\n }\n } else if (file instanceof Attachment) {\n file = file.file;\n }\n options.files[i] = file;\n }\n\n return Promise.all(options.files.map(file =>\n this.client.resolver.resolveFile(file.attachment).then(resource => {\n file.file = resource;\n return file;\n })\n )).then(files => this.client.rest.methods.sendWebhookMessage(this, content, options, files));\n }\n\n return this.client.rest.methods.sendWebhookMessage(this, content, options);\n }\n\n /**\n * Send a message with this webhook\n * @param {StringResolvable} content The content to send\n * @param {WebhookMessageOptions} [options={}] The options to provide\n * @returns {Promise}\n * @deprecated\n * @example\n * // Send a message\n * webhook.sendMessage('hello!')\n * .then(message => console.log(`Sent message: ${message.content}`))\n * .catch(console.error);\n */\n sendMessage(content, options = {}) {\n return this.send(content, options);\n }\n\n /**\n * Send a file with this webhook.\n * @param {BufferResolvable} attachment The file to send\n * @param {string} [name='file.jpg'] The name and extension of the file\n * @param {StringResolvable} [content] Text message to send with the attachment\n * @param {WebhookMessageOptions} [options] The options to provide\n * @returns {Promise}\n * @deprecated\n */\n sendFile(attachment, name, content, options = {}) {\n return this.send(content, Object.assign(options, { file: { attachment, name } }));\n }\n\n /**\n * Send a code block with this webhook.\n * @param {string} lang Language for the code block\n * @param {StringResolvable} content Content of the code block\n * @param {WebhookMessageOptions} options The options to provide\n * @returns {Promise}\n * @deprecated\n */\n sendCode(lang, content, options = {}) {\n return this.send(content, Object.assign(options, { code: lang }));\n }\n\n /**\n * Send a raw slack message with this webhook.\n * @param {Object} body The raw body to send\n * @returns {Promise}\n * @example\n * // Send a slack message\n * webhook.sendSlackMessage({\n * 'username': 'Wumpus',\n * 'attachments': [{\n * 'pretext': 'this looks pretty cool',\n * 'color': '#F0F',\n * 'footer_icon': 'http://snek.s3.amazonaws.com/topSnek.png',\n * 'footer': 'Powered by sneks',\n * 'ts': Date.now() / 1000\n * }]\n * }).catch(console.error);\n */\n sendSlackMessage(body) {\n return this.client.rest.methods.sendSlackWebhookMessage(this, body);\n }\n\n /**\n * Options provided to edit a webhook.\n * @property {string} [name] The new name for the webhook\n * @property {BufferResolvable} [avatar] The new avatar for the webhook\n * @property {ChannelResolvable} [channel] The new channel for the webhook\n * @typedef {Object} WebhookEditOptions\n */\n\n /**\n * Edit the webhook.\n * @param {string|WebhookEditOptions} nameOrOptions The new name for the webhook **(deprecated, use options)**\n * Alternatively options for the webhook, overriding the avatar parameter.\n * @param {BufferResolvable|string} [avatarOrReason] The new avatar for the webhook **(deprecated, use options)**\n * Alternatively a reason to edit, if using options as first parameter.\n * @returns {Promise}\n */\n edit(nameOrOptions = this.name, avatarOrReason) {\n if (typeof nameOrOptions !== 'object') {\n ((any, ...more) => console.warn(any, more))('Webhook#edit: Use options object instead of separate parameters.');\n nameOrOptions = {\n name: nameOrOptions,\n avatar: avatarOrReason,\n };\n // Parameter was an avatar here; Clear the now reason parameter\n avatarOrReason = undefined;\n }\n\n if (nameOrOptions.channel) {\n nameOrOptions.channel_id = this.client.resolver.resolveChannelID(nameOrOptions.channel);\n nameOrOptions.channel = undefined;\n }\n\n if (nameOrOptions.avatar) {\n return this.client.resolver.resolveImage(nameOrOptions.avatar).then(data => {\n nameOrOptions.avatar = data;\n return this.client.rest.methods.editWebhook(this, nameOrOptions, avatarOrReason);\n });\n }\n\n return this.client.rest.methods.editWebhook(this, nameOrOptions, avatarOrReason);\n }\n\n /**\n * Delete the webhook.\n * @param {string} [reason] Reason for deleting the webhook\n * @returns {Promise}\n */\n delete(reason) {\n return this.client.rest.methods.deleteWebhook(this, reason);\n }\n}\n\nmodule.exports = Webhook;\n\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../node_modules/buffer/index.js */ \"./node_modules/buffer/index.js\").Buffer))\n\n//# sourceURL=webpack:///./src/structures/Webhook.js?"); /***/ }), @@ -1889,7 +1998,7 @@ eval("/* WEBPACK VAR INJECTION */(function(Buffer) {const EventEmitter = __webpa /*! ModuleConcatenation bailout: Module is not an ECMAScript module */ /***/ (function(module, exports, __webpack_require__) { -eval("const Collection = __webpack_require__(/*! ../../util/Collection */ \"./src/util/Collection.js\");\nconst EventEmitter = __webpack_require__(/*! events */ \"./node_modules/events/events.js\").EventEmitter;\n\n/**\n * Filter to be applied to the collector.\n * @typedef {Function} CollectorFilter\n * @param {...*} args Any arguments received by the listener\n * @param {Collection} collection The items collected by this collector\n * @returns {boolean}\n */\n\n/**\n * Options to be applied to the collector.\n * @typedef {Object} CollectorOptions\n * @property {number} [time] How long to run the collector for\n */\n\n/**\n * Abstract class for defining a new Collector.\n * @abstract\n */\nclass Collector extends EventEmitter {\n constructor(client, filter, options = {}) {\n super();\n\n /**\n * The client\n * @name Collector#client\n * @type {Client}\n * @readonly\n */\n Object.defineProperty(this, 'client', { value: client });\n\n /**\n * The filter applied to this collector\n * @type {CollectorFilter}\n */\n this.filter = filter;\n\n /**\n * The options of this collector\n * @type {CollectorOptions}\n */\n this.options = options;\n\n /**\n * The items collected by this collector\n * @type {Collection}\n */\n this.collected = new Collection();\n\n /**\n * Whether this collector has finished collecting\n * @type {boolean}\n */\n this.ended = false;\n\n /**\n * Timeout for cleanup\n * @type {?Timeout}\n * @private\n */\n this._timeout = null;\n\n /**\n * Call this to handle an event as a collectable element\n * Accepts any event data as parameters\n * @type {Function}\n * @private\n */\n this.listener = this._handle.bind(this);\n if (options.time) this._timeout = this.client.setTimeout(() => this.stop('time'), options.time);\n }\n\n /**\n * @param {...*} args The arguments emitted by the listener\n * @emits Collector#collect\n * @private\n */\n _handle(...args) {\n const collect = this.handle(...args);\n if (!collect || !this.filter(...args, this.collected)) return;\n\n this.collected.set(collect.key, collect.value);\n\n /**\n * Emitted whenever an element is collected.\n * @event Collector#collect\n * @param {*} element The element that got collected\n * @param {Collector} collector The collector\n */\n this.emit('collect', collect.value, this);\n\n const post = this.postCheck(...args);\n if (post) this.stop(post);\n }\n\n /**\n * Return a promise that resolves with the next collected element;\n * rejects with collected elements if the collector finishes without receiving a next element\n * @type {Promise}\n * @readonly\n */\n get next() {\n return new Promise((resolve, reject) => {\n if (this.ended) {\n reject(this.collected);\n return;\n }\n\n const cleanup = () => {\n this.removeListener('collect', onCollect);\n this.removeListener('end', onEnd);\n };\n\n const onCollect = item => {\n cleanup();\n resolve(item);\n };\n\n const onEnd = () => {\n cleanup();\n reject(this.collected); // eslint-disable-line prefer-promise-reject-errors\n };\n\n this.on('collect', onCollect);\n this.on('end', onEnd);\n });\n }\n\n /**\n * Stop this collector and emit the `end` event.\n * @param {string} [reason='user'] The reason this collector is ending\n * @emits Collector#end\n */\n stop(reason = 'user') {\n if (this.ended) return;\n\n if (this._timeout) this.client.clearTimeout(this._timeout);\n this.ended = true;\n this.cleanup();\n\n /**\n * Emitted when the collector is finished collecting.\n * @event Collector#end\n * @param {Collection} collected The elements collected by the collector\n * @param {string} reason The reason the collector ended\n */\n this.emit('end', this.collected, reason);\n }\n\n /* eslint-disable no-empty-function, valid-jsdoc */\n /**\n * Handles incoming events from the `listener` function. Returns null if the event should not be collected,\n * or returns an object describing the data that should be stored.\n * @see Collector#listener\n * @param {...*} args Any args the event listener emits\n * @returns {?{key: string, value}} Data to insert into collection, if any\n * @abstract\n */\n handle() {}\n\n /**\n * This method runs after collection to see if the collector should finish.\n * @param {...*} args Any args the event listener emits\n * @returns {?string} Reason to end the collector, if any\n * @abstract\n */\n postCheck() {}\n\n /**\n * Called when the collector is ending.\n * @abstract\n */\n cleanup() {}\n /* eslint-enable no-empty-function, valid-jsdoc */\n}\n\nmodule.exports = Collector;\n\n\n//# sourceURL=webpack:///./src/structures/interfaces/Collector.js?"); +eval("const Collection = __webpack_require__(/*! ../../util/Collection */ \"./src/util/Collection.js\");\nconst EventEmitter = __webpack_require__(/*! events */ \"./node_modules/events/events.js\").EventEmitter;\n\n/**\n * Filter to be applied to the collector.\n * @typedef {Function} CollectorFilter\n * @param {...*} args Any arguments received by the listener\n * @param {Collection} collection The items collected by this collector\n * @returns {boolean}\n */\n\n/**\n * Options to be applied to the collector.\n * @typedef {Object} CollectorOptions\n * @property {number} [time] How long to run the collector for\n * @property {number} [idle] How long to stop the collector after inactivity in milliseconds\n */\n\n/**\n * Abstract class for defining a new Collector.\n * @abstract\n */\nclass Collector extends EventEmitter {\n constructor(client, filter, options = {}) {\n super();\n\n /**\n * The client\n * @name Collector#client\n * @type {Client}\n * @readonly\n */\n Object.defineProperty(this, 'client', { value: client });\n\n /**\n * The filter applied to this collector\n * @type {CollectorFilter}\n */\n this.filter = filter;\n\n /**\n * The options of this collector\n * @type {CollectorOptions}\n */\n this.options = options;\n\n /**\n * The items collected by this collector\n * @type {Collection}\n */\n this.collected = new Collection();\n\n /**\n * Whether this collector has finished collecting\n * @type {boolean}\n */\n this.ended = false;\n\n /**\n * Timeout for cleanup\n * @type {?Timeout}\n * @private\n */\n this._timeout = null;\n\n /**\n * Timeout for cleanup due to inactivity\n * @type {?Timeout}\n * @private\n */\n this._idletimeout = null;\n\n /**\n * Call this to handle an event as a collectable element\n * Accepts any event data as parameters\n * @type {Function}\n * @private\n */\n this.listener = this._handle.bind(this);\n if (options.time) this._timeout = this.client.setTimeout(() => this.stop('time'), options.time);\n if (options.idle) this._idletimeout = this.client.setTimeout(() => this.stop('idle'), options.idle);\n }\n\n /**\n * @param {...*} args The arguments emitted by the listener\n * @emits Collector#collect\n * @private\n */\n _handle(...args) {\n const collect = this.handle(...args);\n if (collect && this.filter(...args, this.collected)) {\n this.collected.set(collect.key, collect.value);\n\n /**\n * Emitted whenever an element is collected.\n * @event Collector#collect\n * @param {*} element The element that got collected\n * @param {Collector} collector The collector\n */\n this.emit('collect', collect.value, this);\n\n if (this._idletimeout) {\n this.client.clearTimeout(this._idletimeout);\n this._idletimeout = this.client.setTimeout(() => this.stop('idle'), this.options.idle);\n }\n }\n\n const post = this.postCheck(...args);\n if (post) this.stop(post);\n }\n\n /**\n * Return a promise that resolves with the next collected element;\n * rejects with collected elements if the collector finishes without receiving a next element\n * @type {Promise}\n * @readonly\n */\n get next() {\n return new Promise((resolve, reject) => {\n if (this.ended) {\n reject(this.collected);\n return;\n }\n\n const cleanup = () => {\n this.removeListener('collect', onCollect);\n this.removeListener('end', onEnd);\n };\n\n const onCollect = item => {\n cleanup();\n resolve(item);\n };\n\n const onEnd = () => {\n cleanup();\n reject(this.collected); // eslint-disable-line prefer-promise-reject-errors\n };\n\n this.on('collect', onCollect);\n this.on('end', onEnd);\n });\n }\n\n /**\n * Stop this collector and emit the `end` event.\n * @param {string} [reason='user'] The reason this collector is ending\n * @emits Collector#end\n */\n stop(reason = 'user') {\n if (this.ended) return;\n\n if (this._timeout) {\n this.client.clearTimeout(this._timeout);\n this._timeout = null;\n }\n if (this._idletimeout) {\n this.client.clearTimeout(this._idletimeout);\n this._idletimeout = null;\n }\n this.ended = true;\n this.cleanup();\n\n /**\n * Emitted when the collector is finished collecting.\n * @event Collector#end\n * @param {Collection} collected The elements collected by the collector\n * @param {string} reason The reason the collector ended\n */\n this.emit('end', this.collected, reason);\n }\n\n /* eslint-disable no-empty-function, valid-jsdoc */\n /**\n * Handles incoming events from the `listener` function. Returns null if the event should not be collected,\n * or returns an object describing the data that should be stored.\n * @see Collector#listener\n * @param {...*} args Any args the event listener emits\n * @returns {?{key: string, value}} Data to insert into collection, if any\n * @abstract\n */\n handle() {}\n\n /**\n * This method runs after collection to see if the collector should finish.\n * @param {...*} args Any args the event listener emits\n * @returns {?string} Reason to end the collector, if any\n * @abstract\n */\n postCheck() {}\n\n /**\n * Called when the collector is ending.\n * @abstract\n */\n cleanup() {}\n /* eslint-enable no-empty-function, valid-jsdoc */\n}\n\nmodule.exports = Collector;\n\n\n//# sourceURL=webpack:///./src/structures/interfaces/Collector.js?"); /***/ }), @@ -1901,7 +2010,7 @@ eval("const Collection = __webpack_require__(/*! ../../util/Collection */ \"./sr /*! ModuleConcatenation bailout: Module is not an ECMAScript module */ /***/ (function(module, exports, __webpack_require__) { -eval("/* WEBPACK VAR INJECTION */(function(Buffer) {const path = __webpack_require__(/*! path */ \"./node_modules/path-browserify/index.js\");\nconst Message = __webpack_require__(/*! ../Message */ \"./src/structures/Message.js\");\nconst MessageCollector = __webpack_require__(/*! ../MessageCollector */ \"./src/structures/MessageCollector.js\");\nconst Collection = __webpack_require__(/*! ../../util/Collection */ \"./src/util/Collection.js\");\nconst Attachment = __webpack_require__(/*! ../../structures/Attachment */ \"./src/structures/Attachment.js\");\nconst RichEmbed = __webpack_require__(/*! ../../structures/RichEmbed */ \"./src/structures/RichEmbed.js\");\nconst Snowflake = __webpack_require__(/*! ../../util/Snowflake */ \"./src/util/Snowflake.js\");\nconst util = __webpack_require__(/*! util */ \"./node_modules/util/util.js\");\n\n/**\n * Interface for classes that have text-channel-like features.\n * @interface\n */\nclass TextBasedChannel {\n constructor() {\n /**\n * A collection containing the messages sent to this channel\n * @type {Collection}\n */\n this.messages = new Collection();\n\n /**\n * The ID of the last message in the channel, if one was sent\n * @type {?Snowflake}\n */\n this.lastMessageID = null;\n\n /**\n * The Message object of the last message in the channel, if one was sent\n * @type {?Message}\n */\n this.lastMessage = null;\n\n /**\n * The timestamp when the last pinned message was pinned, if there was one\n * @type {?number}\n */\n this.lastPinTimestamp = null;\n }\n\n /**\n * Options provided when sending or editing a message.\n * @typedef {Object} MessageOptions\n * @property {boolean} [tts=false] Whether or not the message should be spoken aloud\n * @property {string} [nonce=''] The nonce for the message\n * @property {RichEmbed|Object} [embed] An embed for the message\n * (see [here](https://discordapp.com/developers/docs/resources/channel#embed-object) for more details)\n * @property {boolean} [disableEveryone=this.client.options.disableEveryone] Whether or not @everyone and @here\n * should be replaced with plain-text\n * @property {FileOptions|BufferResolvable|Attachment} [file] A file to send with the message **(deprecated)**\n * @property {FileOptions[]|BufferResolvable[]|Attachment[]} [files] Files to send with the message\n * @property {string|boolean} [code] Language for optional codeblock formatting to apply\n * @property {boolean|SplitOptions} [split=false] Whether or not the message should be split into multiple messages if\n * it exceeds the character limit. If an object is provided, these are the options for splitting the message\n * @property {UserResolvable} [reply] User to reply to (prefixes the message with a mention, except in DMs)\n */\n\n /**\n * @typedef {Object} FileOptions\n * @property {BufferResolvable} attachment File to attach\n * @property {string} [name='file.jpg'] Filename of the attachment\n */\n\n /**\n * Options for splitting a message.\n * @typedef {Object} SplitOptions\n * @property {number} [maxLength=1950] Maximum character length per message piece\n * @property {string} [char='\\n'] Character to split the message with\n * @property {string} [prepend=''] Text to prepend to every piece except the first\n * @property {string} [append=''] Text to append to every piece except the last\n */\n\n /**\n * Send a message to this channel.\n * @param {StringResolvable} [content] Text for the message\n * @param {MessageOptions|Attachment|RichEmbed} [options] Options for the message,\n * can also be just a RichEmbed or Attachment\n * @returns {Promise}\n * @example\n * // Send a basic message\n * channel.send('hello!')\n * .then(message => console.log(`Sent message: ${message.content}`))\n * .catch(console.error);\n * @example\n * // Send a remote file\n * channel.send({\n * files: ['https://cdn.discordapp.com/icons/222078108977594368/6e1019b3179d71046e463a75915e7244.png?size=2048']\n * })\n * .then(console.log)\n * .catch(console.error);\n * @example\n * // Send a local file\n * channel.send({\n * files: [{\n * attachment: 'entire/path/to/file.jpg',\n * name: 'file.jpg'\n * }]\n * })\n * .then(console.log)\n * .catch(console.error);\n * @example\n * // Send an embed with a local image inside\n * channel.send('This is an embed', {\n * embed: {\n * thumbnail: {\n * url: 'attachment://file.jpg'\n * }\n * },\n * files: [{\n * attachment: 'entire/path/to/file.jpg',\n * name: 'file.jpg'\n * }]\n * })\n * .then(console.log)\n * .catch(console.error);\n */\n // eslint-disable-next-line complexity\n send(content, options) {\n if (!options && typeof content === 'object' && !(content instanceof Array)) {\n options = content;\n content = '';\n } else if (!options) {\n options = {};\n }\n\n const { reply } = options;\n if (options instanceof Attachment) options = { files: [options.file] };\n if (options instanceof RichEmbed) {\n if (options.reply) options.reply = undefined;\n options = { embed: options };\n }\n options.reply = reply;\n\n if (options.embed) {\n if (options.embed.file) {\n if (options.files) options.files.push(options.embed.file);\n else options.files = [options.embed.file];\n }\n if (options.embed.files) {\n if (options.files) options.files = options.files.concat(options.embed.files);\n else options.files = options.embed.files;\n }\n }\n\n if (options.file) {\n if (options.files) options.files.push(options.file);\n else options.files = [options.file];\n }\n\n if (options.embed) options.embed = new RichEmbed(options.embed)._apiTransform();\n\n if (options.files) {\n for (let i = 0; i < options.files.length; i++) {\n let file = options.files[i];\n if (!file || typeof file === 'string' || Buffer.isBuffer(file)) file = { attachment: file };\n if (!file.name) {\n if (typeof file.attachment === 'string') {\n file.name = path.basename(file.attachment);\n } else if (file.attachment && file.attachment.path) {\n file.name = path.basename(file.attachment.path);\n } else if (file instanceof Attachment) {\n file = { attachment: file.file, name: path.basename(file.file) || 'file.jpg' };\n } else {\n file.name = 'file.jpg';\n }\n } else if (file instanceof Attachment) {\n file = file.file;\n }\n options.files[i] = file;\n }\n\n return Promise.all(options.files.map(file =>\n this.client.resolver.resolveFile(file.attachment).then(resource => {\n file.file = resource;\n return file;\n })\n )).then(files => this.client.rest.methods.sendMessage(this, content, options, files));\n }\n\n return this.client.rest.methods.sendMessage(this, content, options);\n }\n\n /**\n * Gets a single message from this channel, regardless of it being cached or not.\n * @param {Snowflake} messageID ID of the message to get\n * @returns {Promise}\n * @example\n * // Get message\n * channel.fetchMessage('99539446449315840')\n * .then(message => console.log(message.content))\n * .catch(console.error);\n */\n fetchMessage(messageID) {\n if (!this.client.user.bot) {\n return this.fetchMessages({ limit: 1, around: messageID }).then(messages => {\n const msg = messages.get(messageID);\n if (!msg) throw new Error('Message not found.');\n return msg;\n });\n }\n return this.client.rest.methods.getChannelMessage(this, messageID).then(data => {\n const msg = data instanceof Message ? data : new Message(this, data, this.client);\n this._cacheMessage(msg);\n return msg;\n });\n }\n\n /**\n * The parameters to pass in when requesting previous messages from a channel. `around`, `before` and\n * `after` are mutually exclusive. All the parameters are optional.\n * @typedef {Object} ChannelLogsQueryOptions\n * @property {number} [limit=50] Number of messages to acquire\n * @property {Snowflake} [before] ID of a message to get the messages that were posted before it\n * @property {Snowflake} [after] ID of a message to get the messages that were posted after it\n * @property {Snowflake} [around] ID of a message to get the messages that were posted around it\n */\n\n /**\n * Gets the past messages sent in this channel. Resolves with a collection mapping message ID's to Message objects.\n * The returned Collection does not contain reaction users of the messages if they were not cached.\n * Those need to be fetched separately in such a case.\n * @param {ChannelLogsQueryOptions} [options={}] Query parameters to pass in\n * @returns {Promise>}\n * @example\n * // Get messages\n * channel.fetchMessages({ limit: 10 })\n * .then(messages => console.log(`Received ${messages.size} messages`))\n * .catch(console.error);\n * @example\n * // Get messages and filter by user ID\n * channel.fetchMessages()\n * .then(messages => console.log(`${messages.filter(m => m.author.id === '84484653687267328').size} messages`))\n * .catch(console.error);\n */\n fetchMessages(options = {}) {\n return this.client.rest.methods.getChannelMessages(this, options).then(data => {\n const messages = new Collection();\n for (const message of data) {\n const msg = new Message(this, message, this.client);\n messages.set(message.id, msg);\n this._cacheMessage(msg);\n }\n return messages;\n });\n }\n\n /**\n * Fetches the pinned messages of this channel and returns a collection of them.\n * The returned Collection does not contain any reaction data of the messages.\n * Those need to be fetched separately.\n * @returns {Promise>}\n * @example\n * // Get pinned messages\n * channel.fetchPinnedMessages()\n * .then(messages => console.log(`Received ${messages.size} messages`))\n * .catch(console.error);\n */\n fetchPinnedMessages() {\n return this.client.rest.methods.getChannelPinnedMessages(this).then(data => {\n const messages = new Collection();\n for (const message of data) {\n const msg = new Message(this, message, this.client);\n messages.set(message.id, msg);\n this._cacheMessage(msg);\n }\n return messages;\n });\n }\n\n /**\n * @typedef {Object} MessageSearchOptions\n * @property {string} [content] Message content\n * @property {Snowflake} [maxID] Maximum ID for the filter\n * @property {Snowflake} [minID] Minimum ID for the filter\n * @property {string} [has] One of `link`, `embed`, `file`, `video`, `image`, or `sound`,\n * or add `-` to negate (e.g. `-file`)\n * @property {ChannelResolvable} [channel] Channel to limit search to (only for guild search endpoint)\n * @property {UserResolvable} [author] Author to limit search\n * @property {string} [authorType] One of `user`, `bot`, `webhook`, or add `-` to negate (e.g. `-webhook`)\n * @property {string} [sortBy='recent'] `recent` or `relevant`\n * @property {string} [sortOrder='desc'] `asc` or `desc`\n * @property {number} [contextSize=2] How many messages to get around the matched message (0 to 2)\n * @property {number} [limit=25] Maximum number of results to get (1 to 25)\n * @property {number} [offset=0] Offset the \"pages\" of results (since you can only see 25 at a time)\n * @property {UserResolvable} [mentions] Mentioned user filter\n * @property {boolean} [mentionsEveryone] If everyone is mentioned\n * @property {string} [linkHostname] Filter links by hostname\n * @property {string} [embedProvider] The name of an embed provider\n * @property {string} [embedType] one of `image`, `video`, `url`, `rich`\n * @property {string} [attachmentFilename] The name of an attachment\n * @property {string} [attachmentExtension] The extension of an attachment\n * @property {Date} [before] Date to find messages before\n * @property {Date} [after] Date to find messages before\n * @property {Date} [during] Date to find messages during (range of date to date + 24 hours)\n * @property {boolean} [nsfw=false] Include results from NSFW channels\n */\n\n /**\n * @typedef {Object} MessageSearchResult\n * @property {number} totalResults Total result count\n * @property {Message[][]} messages Array of message results\n * The message which has triggered the result will have the `hit` property set to `true`\n */\n\n /**\n * Performs a search within the channel.\n * This is only available when using a user account.\n * @param {MessageSearchOptions} [options={}] Options to pass to the search\n * @returns {Promise}\n * @deprecated\n * @example\n * channel.search({\n * content: 'discord.js',\n * before: '2016-11-17'\n * }).then(res => {\n * const hit = res.messages[0].find(m => m.hit).content;\n * console.log(`I found: **${hit}**, total results: ${res.totalResults}`);\n * }).catch(console.error);\n */\n search(options = {}) {\n return this.client.rest.methods.search(this, options);\n }\n\n /**\n * Starts a typing indicator in the channel.\n * @param {number} [count] The number of times startTyping should be considered to have been called\n * @example\n * // Start typing in a channel\n * channel.startTyping();\n */\n startTyping(count) {\n if (typeof count !== 'undefined' && count < 1) throw new RangeError('Count must be at least 1.');\n if (this.client.user._typing.has(this.id)) {\n const entry = this.client.user._typing.get(this.id);\n entry.count = count || entry.count + 1;\n return;\n }\n\n const entry = {\n count: count || 1,\n interval: this.client.setInterval(() => {\n this.client.rest.methods.sendTyping(this.id).catch(() => {\n this.client.clearInterval(entry.interval);\n this.client.user._typing.delete(this.id);\n });\n }, 9000),\n };\n this.client.rest.methods.sendTyping(this.id).catch(() => {\n this.client.clearInterval(entry.interval);\n this.client.user._typing.delete(this.id);\n });\n this.client.user._typing.set(this.id, entry);\n }\n\n /**\n * Stops the typing indicator in the channel.\n * The indicator will only stop if this is called as many times as startTyping().\n * It can take a few seconds for the client user to stop typing.\n * @param {boolean} [force=false] Whether or not to reset the call count and force the indicator to stop\n * @example\n * // Reduce the typing count by one and stop typing if it reached 0\n * channel.stopTyping();\n * @example\n * // Force typing to fully stop in a channel\n * channel.stopTyping(true);\n */\n stopTyping(force = false) {\n if (this.client.user._typing.has(this.id)) {\n const entry = this.client.user._typing.get(this.id);\n entry.count--;\n if (entry.count <= 0 || force) {\n this.client.clearInterval(entry.interval);\n this.client.user._typing.delete(this.id);\n }\n }\n }\n\n /**\n * Whether or not the typing indicator is being shown in the channel\n * @type {boolean}\n * @readonly\n */\n get typing() {\n return this.client.user._typing.has(this.id);\n }\n\n /**\n * Number of times `startTyping` has been called\n * @type {number}\n * @readonly\n */\n get typingCount() {\n if (this.client.user._typing.has(this.id)) return this.client.user._typing.get(this.id).count;\n return 0;\n }\n\n /**\n * The Message object of the last message in the channel, if one was sent\n * @type {?Message}\n * @readonly\n */\n get lastMessage() {\n return this.messages.get(this.lastMessageID) || null;\n }\n\n /**\n * The date when the last pinned message was pinned, if there was one\n * @type {?Date}\n * @readonly\n */\n get lastPinAt() {\n return this.lastPinTimestamp ? new Date(this.lastPinTimestamp) : null;\n }\n\n /**\n * Creates a Message Collector\n * @param {CollectorFilter} filter The filter to create the collector with\n * @param {MessageCollectorOptions} [options={}] The options to pass to the collector\n * @returns {MessageCollector}\n * @deprecated\n */\n createCollector(filter, options) {\n return this.createMessageCollector(filter, options);\n }\n\n /**\n * Creates a Message Collector.\n * @param {CollectorFilter} filter The filter to create the collector with\n * @param {MessageCollectorOptions} [options={}] The options to pass to the collector\n * @returns {MessageCollector}\n * @example\n * // Create a message collector\n * const filter = m => m.content.includes('discord');\n * const collector = channel.createMessageCollector(filter, { time: 15000 });\n * collector.on('collect', m => console.log(`Collected ${m.content}`));\n * collector.on('end', collected => console.log(`Collected ${collected.size} items`));\n */\n createMessageCollector(filter, options = {}) {\n return new MessageCollector(this, filter, options);\n }\n\n /**\n * An object containing the same properties as CollectorOptions, but a few more:\n * @typedef {MessageCollectorOptions} AwaitMessagesOptions\n * @property {string[]} [errors] Stop/end reasons that cause the promise to reject\n */\n\n /**\n * Similar to createCollector but in promise form. Resolves with a collection of messages that pass the specified\n * filter.\n * @param {CollectorFilter} filter The filter function to use\n * @param {AwaitMessagesOptions} [options={}] Optional options to pass to the internal collector\n * @returns {Promise>}\n * @example\n * // Await !vote messages\n * const filter = m => m.content.startsWith('!vote');\n * // Errors: ['time'] treats ending because of the time limit as an error\n * channel.awaitMessages(filter, { max: 4, time: 60000, errors: ['time'] })\n * .then(collected => console.log(collected.size))\n * .catch(collected => console.log(`After a minute, only ${collected.size} out of 4 voted.`));\n */\n awaitMessages(filter, options = {}) {\n return new Promise((resolve, reject) => {\n const collector = this.createCollector(filter, options);\n collector.once('end', (collection, reason) => {\n if (options.errors && options.errors.includes(reason)) {\n reject(collection);\n } else {\n resolve(collection);\n }\n });\n });\n }\n\n /**\n * Bulk delete given messages that are newer than two weeks.\n * This is only available when using a bot account.\n * @param {Collection|Message[]|Snowflake[]|number} messages\n * Messages or number of messages to delete\n * @param {boolean} [filterOld=false] Filter messages to remove those which are older than two weeks automatically\n * @returns {Promise>} Deleted messages\n * @example\n * // Bulk delete messages\n * channel.bulkDelete(5)\n * .then(messages => console.log(`Bulk deleted ${messages.size} messages`))\n * .catch(console.error);\n */\n bulkDelete(messages, filterOld = false) {\n if (messages instanceof Array || messages instanceof Collection) {\n let messageIDs = messages instanceof Collection ? messages.keyArray() : messages.map(m => m.id || m);\n if (filterOld) {\n messageIDs = messageIDs.filter(id => Date.now() - Snowflake.deconstruct(id).date.getTime() < 1209600000);\n }\n if (messageIDs.length === 0) return Promise.resolve(new Collection());\n if (messageIDs.length === 1) {\n return this.fetchMessage(messageIDs[0]).then(m => m.delete()).then(m => new Collection([[m.id, m]]));\n }\n return this.client.rest.methods.bulkDeleteMessages(this, messageIDs);\n }\n if (!isNaN(messages)) return this.fetchMessages({ limit: messages }).then(msgs => this.bulkDelete(msgs, filterOld));\n throw new TypeError('The messages must be an Array, Collection, or number.');\n }\n\n /**\n * Marks all messages in this channel as read.\n * This is only available when using a user account.\n * @returns {Promise}\n * @deprecated\n */\n acknowledge() {\n if (!this.lastMessageID) return Promise.resolve(this);\n return this.client.rest.methods.ackTextChannel(this);\n }\n\n _cacheMessage(message) {\n const maxSize = this.client.options.messageCacheMaxSize;\n if (maxSize === 0) return null;\n if (this.messages.size >= maxSize && maxSize > 0) this.messages.delete(this.messages.firstKey());\n this.messages.set(message.id, message);\n return message;\n }\n}\n\n/** @lends TextBasedChannel.prototype */\nconst Deprecated = {\n /**\n * Send a message to this channel.\n * @param {StringResolvable} [content] Text for the message\n * @param {MessageOptions} [options={}] Options for the message\n * @returns {Promise}\n * @deprecated\n * @example\n * // Send a message\n * channel.sendMessage('hello!')\n * .then(message => console.log(`Sent message: ${message.content}`))\n * .catch(console.error);\n */\n sendMessage(content, options) {\n return this.send(content, options);\n },\n\n /**\n * Send an embed to this channel.\n * @param {RichEmbed|Object} embed Embed for the message\n * @param {string} [content] Text for the message\n * @param {MessageOptions} [options] Options for the message\n * @returns {Promise}\n * @deprecated\n */\n sendEmbed(embed, content, options) {\n if (!options && typeof content === 'object' && !(content instanceof Array)) {\n options = content;\n content = '';\n } else if (!options) {\n options = {};\n }\n return this.send(content, Object.assign(options, { embed }));\n },\n\n /**\n * Send files to this channel.\n * @param {FileOptions[]|string[]} files Files to send with the message\n * @param {StringResolvable} [content] Text for the message\n * @param {MessageOptions} [options] Options for the message\n * @returns {Promise}\n * @deprecated\n */\n sendFiles(files, content, options = {}) {\n return this.send(content, Object.assign(options, { files }));\n },\n\n /**\n * Send a file to this channel.\n * @param {BufferResolvable} attachment File to send\n * @param {string} [name='file.jpg'] Name and extension of the file\n * @param {StringResolvable} [content] Text for the message\n * @param {MessageOptions} [options] Options for the message\n * @returns {Promise}\n * @deprecated\n */\n sendFile(attachment, name, content, options = {}) {\n return this.send({ files: [{ attachment, name }], content, options });\n },\n\n /**\n * Send a code block to this channel.\n * @param {string} lang Language for the code block\n * @param {StringResolvable} content Content of the code block\n * @param {MessageOptions} [options] Options for the message\n * @returns {Promise}\n * @deprecated\n */\n sendCode(lang, content, options = {}) {\n return this.send(content, Object.assign(options, { code: lang }));\n },\n};\n\nfor (const key of Object.keys(Deprecated)) {\n TextBasedChannel.prototype[key] = util.deprecate(Deprecated[key], `TextChannel#${key}: use TextChannel#send instead`);\n}\n\nexports.applyToClass = (structure, full = false, ignore = []) => {\n const props = ['send', 'sendMessage', 'sendEmbed', 'sendFile', 'sendFiles', 'sendCode'];\n if (full) {\n props.push(\n '_cacheMessage',\n 'acknowledge',\n 'fetchMessages',\n 'fetchMessage',\n 'search',\n 'lastMessage',\n 'lastPinAt',\n 'bulkDelete',\n 'startTyping',\n 'stopTyping',\n 'typing',\n 'typingCount',\n 'fetchPinnedMessages',\n 'createCollector',\n 'createMessageCollector',\n 'awaitMessages'\n );\n }\n for (const prop of props) {\n if (ignore.includes(prop)) continue;\n Object.defineProperty(structure.prototype, prop, Object.getOwnPropertyDescriptor(TextBasedChannel.prototype, prop));\n }\n};\n\nTextBasedChannel.prototype.acknowledge = util.deprecate(\n TextBasedChannel.prototype.acknowledge, 'TextBasedChannel#acknowledge: userbot methods will be removed'\n);\n\nTextBasedChannel.prototype.search =\n util.deprecate(TextBasedChannel.prototype.search, 'TextBasedChannel#search: userbot methods will be removed');\n\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../node_modules/buffer/index.js */ \"./node_modules/buffer/index.js\").Buffer))\n\n//# sourceURL=webpack:///./src/structures/interfaces/TextBasedChannel.js?"); +eval("/* WEBPACK VAR INJECTION */(function(Buffer) {const path = __webpack_require__(/*! path */ \"./node_modules/path-browserify/index.js\");\nconst Message = __webpack_require__(/*! ../Message */ \"./src/structures/Message.js\");\nconst MessageCollector = __webpack_require__(/*! ../MessageCollector */ \"./src/structures/MessageCollector.js\");\nconst Collection = __webpack_require__(/*! ../../util/Collection */ \"./src/util/Collection.js\");\nconst Attachment = __webpack_require__(/*! ../../structures/Attachment */ \"./src/structures/Attachment.js\");\nconst RichEmbed = __webpack_require__(/*! ../../structures/RichEmbed */ \"./src/structures/RichEmbed.js\");\nconst Snowflake = __webpack_require__(/*! ../../util/Snowflake */ \"./src/util/Snowflake.js\");\nconst util = __webpack_require__(/*! util */ \"./node_modules/util/util.js\");\n\n/**\n * Interface for classes that have text-channel-like features.\n * @interface\n */\nclass TextBasedChannel {\n constructor() {\n /**\n * A collection containing the messages sent to this channel\n * @type {Collection}\n */\n this.messages = new Collection();\n\n /**\n * The ID of the last message in the channel, if one was sent\n * @type {?Snowflake}\n */\n this.lastMessageID = null;\n\n /**\n * The Message object of the last message in the channel, if one was sent\n * @type {?Message}\n */\n this.lastMessage = null;\n\n /**\n * The timestamp when the last pinned message was pinned, if there was one\n * @type {?number}\n */\n this.lastPinTimestamp = null;\n }\n\n /**\n * Options provided when sending or editing a message.\n * @typedef {Object} MessageOptions\n * @property {boolean} [tts=false] Whether or not the message should be spoken aloud\n * @property {string} [nonce=''] The nonce for the message\n * @property {RichEmbed|Object} [embed] An embed for the message\n * (see [here](https://discordapp.com/developers/docs/resources/channel#embed-object) for more details)\n * @property {boolean} [disableEveryone=this.client.options.disableEveryone] Whether or not @everyone and @here\n * should be replaced with plain-text\n * @property {FileOptions|BufferResolvable|Attachment} [file] A file to send with the message **(deprecated)**\n * @property {FileOptions[]|BufferResolvable[]|Attachment[]} [files] Files to send with the message\n * @property {string|boolean} [code] Language for optional codeblock formatting to apply\n * @property {boolean|SplitOptions} [split=false] Whether or not the message should be split into multiple messages if\n * it exceeds the character limit. If an object is provided, these are the options for splitting the message\n * @property {UserResolvable} [reply] User to reply to (prefixes the message with a mention, except in DMs)\n */\n\n /**\n * @typedef {Object} FileOptions\n * @property {BufferResolvable} attachment File to attach\n * @property {string} [name='file.jpg'] Filename of the attachment\n */\n\n /**\n * Options for splitting a message.\n * @typedef {Object} SplitOptions\n * @property {number} [maxLength=1950] Maximum character length per message piece\n * @property {string} [char='\\n'] Character to split the message with\n * @property {string} [prepend=''] Text to prepend to every piece except the first\n * @property {string} [append=''] Text to append to every piece except the last\n */\n\n /**\n * Send a message to this channel.\n * @param {StringResolvable} [content] Text for the message\n * @param {MessageOptions|Attachment|RichEmbed} [options] Options for the message,\n * can also be just a RichEmbed or Attachment\n * @returns {Promise}\n * @example\n * // Send a basic message\n * channel.send('hello!')\n * .then(message => console.log(`Sent message: ${message.content}`))\n * .catch(console.error);\n * @example\n * // Send a remote file\n * channel.send({\n * files: ['https://cdn.discordapp.com/icons/222078108977594368/6e1019b3179d71046e463a75915e7244.png?size=2048']\n * })\n * .then(console.log)\n * .catch(console.error);\n * @example\n * // Send a local file\n * channel.send({\n * files: [{\n * attachment: 'entire/path/to/file.jpg',\n * name: 'file.jpg'\n * }]\n * })\n * .then(console.log)\n * .catch(console.error);\n * @example\n * // Send an embed with a local image inside\n * channel.send('This is an embed', {\n * embed: {\n * thumbnail: {\n * url: 'attachment://file.jpg'\n * }\n * },\n * files: [{\n * attachment: 'entire/path/to/file.jpg',\n * name: 'file.jpg'\n * }]\n * })\n * .then(console.log)\n * .catch(console.error);\n */\n // eslint-disable-next-line complexity\n send(content, options) {\n if (!options && typeof content === 'object' && !(content instanceof Array)) {\n options = content;\n content = '';\n } else if (!options) {\n options = {};\n }\n\n const { reply } = options;\n if (options instanceof Attachment) options = { files: [options.file] };\n if (options instanceof RichEmbed) {\n if (options.reply) options.reply = undefined;\n options = { embed: options };\n }\n options.reply = reply;\n\n if (options.embed) {\n if (options.embed.file) {\n if (options.files) options.files.push(options.embed.file);\n else options.files = [options.embed.file];\n }\n if (options.embed.files) {\n if (options.files) options.files = options.files.concat(options.embed.files);\n else options.files = options.embed.files;\n }\n }\n\n if (options.file) {\n if (options.files) options.files.push(options.file);\n else options.files = [options.file];\n }\n\n if (options.embed) options.embed = new RichEmbed(options.embed).toJSON();\n\n if (options.files) {\n for (let i = 0; i < options.files.length; i++) {\n let file = options.files[i];\n if (!file || typeof file === 'string' || Buffer.isBuffer(file)) file = { attachment: file };\n if (!file.name) {\n if (typeof file.attachment === 'string') {\n file.name = path.basename(file.attachment);\n } else if (file.attachment && file.attachment.path) {\n file.name = path.basename(file.attachment.path);\n } else if (file instanceof Attachment) {\n file = { attachment: file.file, name: path.basename(file.file) || 'file.jpg' };\n } else {\n file.name = 'file.jpg';\n }\n } else if (file instanceof Attachment) {\n file = file.file;\n }\n options.files[i] = file;\n }\n\n return Promise.all(options.files.map(file =>\n this.client.resolver.resolveFile(file.attachment).then(resource => {\n file.file = resource;\n return file;\n })\n )).then(files => this.client.rest.methods.sendMessage(this, content, options, files));\n }\n\n return this.client.rest.methods.sendMessage(this, content, options);\n }\n\n /**\n * Gets a single message from this channel, regardless of it being cached or not.\n * @param {Snowflake} messageID ID of the message to get\n * @returns {Promise}\n * @example\n * // Get message\n * channel.fetchMessage('99539446449315840')\n * .then(message => console.log(message.content))\n * .catch(console.error);\n */\n fetchMessage(messageID) {\n if (!this.client.user.bot) {\n return this.fetchMessages({ limit: 1, around: messageID }).then(messages => {\n const msg = messages.get(messageID);\n if (!msg) throw new Error('Message not found.');\n return msg;\n });\n }\n return this.client.rest.methods.getChannelMessage(this, messageID).then(data => {\n const msg = data instanceof Message ? data : new Message(this, data, this.client);\n this._cacheMessage(msg);\n return msg;\n });\n }\n\n /**\n * The parameters to pass in when requesting previous messages from a channel. `around`, `before` and\n * `after` are mutually exclusive. All the parameters are optional.\n * @typedef {Object} ChannelLogsQueryOptions\n * @property {number} [limit=50] Number of messages to acquire\n * @property {Snowflake} [before] ID of a message to get the messages that were posted before it\n * @property {Snowflake} [after] ID of a message to get the messages that were posted after it\n * @property {Snowflake} [around] ID of a message to get the messages that were posted around it\n */\n\n /**\n * Gets the past messages sent in this channel. Resolves with a collection mapping message ID's to Message objects.\n * The returned Collection does not contain reaction users of the messages if they were not cached.\n * Those need to be fetched separately in such a case.\n * @param {ChannelLogsQueryOptions} [options={}] Query parameters to pass in\n * @returns {Promise>}\n * @example\n * // Get messages\n * channel.fetchMessages({ limit: 10 })\n * .then(messages => console.log(`Received ${messages.size} messages`))\n * .catch(console.error);\n * @example\n * // Get messages and filter by user ID\n * channel.fetchMessages()\n * .then(messages => console.log(`${messages.filter(m => m.author.id === '84484653687267328').size} messages`))\n * .catch(console.error);\n */\n fetchMessages(options = {}) {\n return this.client.rest.methods.getChannelMessages(this, options).then(data => {\n const messages = new Collection();\n for (const message of data) {\n const msg = new Message(this, message, this.client);\n messages.set(message.id, msg);\n this._cacheMessage(msg);\n }\n return messages;\n });\n }\n\n /**\n * Fetches the pinned messages of this channel and returns a collection of them.\n * The returned Collection does not contain any reaction data of the messages.\n * Those need to be fetched separately.\n * @returns {Promise>}\n * @example\n * // Get pinned messages\n * channel.fetchPinnedMessages()\n * .then(messages => console.log(`Received ${messages.size} messages`))\n * .catch(console.error);\n */\n fetchPinnedMessages() {\n return this.client.rest.methods.getChannelPinnedMessages(this).then(data => {\n const messages = new Collection();\n for (const message of data) {\n const msg = new Message(this, message, this.client);\n messages.set(message.id, msg);\n this._cacheMessage(msg);\n }\n return messages;\n });\n }\n\n /**\n * @typedef {Object} MessageSearchOptions\n * @property {string} [content] Message content\n * @property {Snowflake} [maxID] Maximum ID for the filter\n * @property {Snowflake} [minID] Minimum ID for the filter\n * @property {string} [has] One of `link`, `embed`, `file`, `video`, `image`, or `sound`,\n * or add `-` to negate (e.g. `-file`)\n * @property {ChannelResolvable} [channel] Channel to limit search to (only for guild search endpoint)\n * @property {UserResolvable} [author] Author to limit search\n * @property {string} [authorType] One of `user`, `bot`, `webhook`, or add `-` to negate (e.g. `-webhook`)\n * @property {string} [sortBy='recent'] `recent` or `relevant`\n * @property {string} [sortOrder='desc'] `asc` or `desc`\n * @property {number} [contextSize=2] How many messages to get around the matched message (0 to 2)\n * @property {number} [limit=25] Maximum number of results to get (1 to 25)\n * @property {number} [offset=0] Offset the \"pages\" of results (since you can only see 25 at a time)\n * @property {UserResolvable} [mentions] Mentioned user filter\n * @property {boolean} [mentionsEveryone] If everyone is mentioned\n * @property {string} [linkHostname] Filter links by hostname\n * @property {string} [embedProvider] The name of an embed provider\n * @property {string} [embedType] one of `image`, `video`, `url`, `rich`\n * @property {string} [attachmentFilename] The name of an attachment\n * @property {string} [attachmentExtension] The extension of an attachment\n * @property {Date} [before] Date to find messages before\n * @property {Date} [after] Date to find messages before\n * @property {Date} [during] Date to find messages during (range of date to date + 24 hours)\n * @property {boolean} [nsfw=false] Include results from NSFW channels\n */\n\n /**\n * @typedef {Object} MessageSearchResult\n * @property {number} totalResults Total result count\n * @property {Message[][]} messages Array of message results\n * The message which has triggered the result will have the `hit` property set to `true`\n */\n\n /**\n * Performs a search within the channel.\n * This is only available when using a user account.\n * @param {MessageSearchOptions} [options={}] Options to pass to the search\n * @returns {Promise}\n * @deprecated\n * @example\n * channel.search({\n * content: 'discord.js',\n * before: '2016-11-17'\n * }).then(res => {\n * const hit = res.messages[0].find(m => m.hit).content;\n * console.log(`I found: **${hit}**, total results: ${res.totalResults}`);\n * }).catch(console.error);\n */\n search(options = {}) {\n return this.client.rest.methods.search(this, options);\n }\n\n /**\n * Starts a typing indicator in the channel.\n * @param {number} [count] The number of times startTyping should be considered to have been called\n * @example\n * // Start typing in a channel\n * channel.startTyping();\n */\n startTyping(count) {\n if (typeof count !== 'undefined' && count < 1) throw new RangeError('Count must be at least 1.');\n if (this.client.user._typing.has(this.id)) {\n const entry = this.client.user._typing.get(this.id);\n entry.count = count || entry.count + 1;\n return;\n }\n\n const entry = {\n count: count || 1,\n interval: this.client.setInterval(() => {\n this.client.rest.methods.sendTyping(this.id).catch(() => {\n this.client.clearInterval(entry.interval);\n this.client.user._typing.delete(this.id);\n });\n }, 9000),\n };\n this.client.rest.methods.sendTyping(this.id).catch(() => {\n this.client.clearInterval(entry.interval);\n this.client.user._typing.delete(this.id);\n });\n this.client.user._typing.set(this.id, entry);\n }\n\n /**\n * Stops the typing indicator in the channel.\n * The indicator will only stop if this is called as many times as startTyping().\n * It can take a few seconds for the client user to stop typing.\n * @param {boolean} [force=false] Whether or not to reset the call count and force the indicator to stop\n * @example\n * // Reduce the typing count by one and stop typing if it reached 0\n * channel.stopTyping();\n * @example\n * // Force typing to fully stop in a channel\n * channel.stopTyping(true);\n */\n stopTyping(force = false) {\n if (this.client.user._typing.has(this.id)) {\n const entry = this.client.user._typing.get(this.id);\n entry.count--;\n if (entry.count <= 0 || force) {\n this.client.clearInterval(entry.interval);\n this.client.user._typing.delete(this.id);\n }\n }\n }\n\n /**\n * Whether or not the typing indicator is being shown in the channel\n * @type {boolean}\n * @readonly\n */\n get typing() {\n return this.client.user._typing.has(this.id);\n }\n\n /**\n * Number of times `startTyping` has been called\n * @type {number}\n * @readonly\n */\n get typingCount() {\n if (this.client.user._typing.has(this.id)) return this.client.user._typing.get(this.id).count;\n return 0;\n }\n\n /**\n * The Message object of the last message in the channel, if one was sent\n * @type {?Message}\n * @readonly\n */\n get lastMessage() {\n return this.messages.get(this.lastMessageID) || null;\n }\n\n /**\n * The date when the last pinned message was pinned, if there was one\n * @type {?Date}\n * @readonly\n */\n get lastPinAt() {\n return this.lastPinTimestamp ? new Date(this.lastPinTimestamp) : null;\n }\n\n /**\n * Creates a Message Collector\n * @param {CollectorFilter} filter The filter to create the collector with\n * @param {MessageCollectorOptions} [options={}] The options to pass to the collector\n * @returns {MessageCollector}\n * @deprecated\n */\n createCollector(filter, options) {\n return this.createMessageCollector(filter, options);\n }\n\n /**\n * Creates a Message Collector.\n * @param {CollectorFilter} filter The filter to create the collector with\n * @param {MessageCollectorOptions} [options={}] The options to pass to the collector\n * @returns {MessageCollector}\n * @example\n * // Create a message collector\n * const filter = m => m.content.includes('discord');\n * const collector = channel.createMessageCollector(filter, { time: 15000 });\n * collector.on('collect', m => console.log(`Collected ${m.content}`));\n * collector.on('end', collected => console.log(`Collected ${collected.size} items`));\n */\n createMessageCollector(filter, options = {}) {\n return new MessageCollector(this, filter, options);\n }\n\n /**\n * An object containing the same properties as CollectorOptions, but a few more:\n * @typedef {MessageCollectorOptions} AwaitMessagesOptions\n * @property {string[]} [errors] Stop/end reasons that cause the promise to reject\n */\n\n /**\n * Similar to createCollector but in promise form. Resolves with a collection of messages that pass the specified\n * filter.\n * @param {CollectorFilter} filter The filter function to use\n * @param {AwaitMessagesOptions} [options={}] Optional options to pass to the internal collector\n * @returns {Promise>}\n * @example\n * // Await !vote messages\n * const filter = m => m.content.startsWith('!vote');\n * // Errors: ['time'] treats ending because of the time limit as an error\n * channel.awaitMessages(filter, { max: 4, time: 60000, errors: ['time'] })\n * .then(collected => console.log(collected.size))\n * .catch(collected => console.log(`After a minute, only ${collected.size} out of 4 voted.`));\n */\n awaitMessages(filter, options = {}) {\n return new Promise((resolve, reject) => {\n const collector = this.createCollector(filter, options);\n collector.once('end', (collection, reason) => {\n if (options.errors && options.errors.includes(reason)) {\n reject(collection);\n } else {\n resolve(collection);\n }\n });\n });\n }\n\n /**\n * Bulk delete given messages that are newer than two weeks.\n * This is only available when using a bot account.\n * @param {Collection|Message[]|Snowflake[]|number} messages\n * Messages or number of messages to delete\n * @param {boolean} [filterOld=false] Filter messages to remove those which are older than two weeks automatically\n * @returns {Promise>} Deleted messages\n * @example\n * // Bulk delete messages\n * channel.bulkDelete(5)\n * .then(messages => console.log(`Bulk deleted ${messages.size} messages`))\n * .catch(console.error);\n */\n bulkDelete(messages, filterOld = false) {\n if (messages instanceof Array || messages instanceof Collection) {\n let messageIDs = messages instanceof Collection ? messages.keyArray() : messages.map(m => m.id || m);\n if (filterOld) {\n messageIDs = messageIDs.filter(id => Date.now() - Snowflake.deconstruct(id).date.getTime() < 1209600000);\n }\n if (messageIDs.length === 0) return Promise.resolve(new Collection());\n if (messageIDs.length === 1) {\n return this.fetchMessage(messageIDs[0]).then(m => m.delete()).then(m => new Collection([[m.id, m]]));\n }\n return this.client.rest.methods.bulkDeleteMessages(this, messageIDs);\n }\n if (!isNaN(messages)) return this.fetchMessages({ limit: messages }).then(msgs => this.bulkDelete(msgs, filterOld));\n throw new TypeError('The messages must be an Array, Collection, or number.');\n }\n\n /**\n * Marks all messages in this channel as read.\n * This is only available when using a user account.\n * @returns {Promise}\n * @deprecated\n */\n acknowledge() {\n if (!this.lastMessageID) return Promise.resolve(this);\n return this.client.rest.methods.ackTextChannel(this);\n }\n\n _cacheMessage(message) {\n const maxSize = this.client.options.messageCacheMaxSize;\n if (maxSize === 0) return null;\n if (this.messages.size >= maxSize && maxSize > 0) this.messages.delete(this.messages.firstKey());\n this.messages.set(message.id, message);\n return message;\n }\n}\n\n/** @lends TextBasedChannel.prototype */\nconst Deprecated = {\n /**\n * Send a message to this channel.\n * @param {StringResolvable} [content] Text for the message\n * @param {MessageOptions} [options={}] Options for the message\n * @returns {Promise}\n * @deprecated\n * @example\n * // Send a message\n * channel.sendMessage('hello!')\n * .then(message => console.log(`Sent message: ${message.content}`))\n * .catch(console.error);\n */\n sendMessage(content, options) {\n return this.send(content, options);\n },\n\n /**\n * Send an embed to this channel.\n * @param {RichEmbed|Object} embed Embed for the message\n * @param {string} [content] Text for the message\n * @param {MessageOptions} [options] Options for the message\n * @returns {Promise}\n * @deprecated\n */\n sendEmbed(embed, content, options) {\n if (!options && typeof content === 'object' && !(content instanceof Array)) {\n options = content;\n content = '';\n } else if (!options) {\n options = {};\n }\n return this.send(content, Object.assign(options, { embed }));\n },\n\n /**\n * Send files to this channel.\n * @param {FileOptions[]|string[]} files Files to send with the message\n * @param {StringResolvable} [content] Text for the message\n * @param {MessageOptions} [options] Options for the message\n * @returns {Promise}\n * @deprecated\n */\n sendFiles(files, content, options = {}) {\n return this.send(content, Object.assign(options, { files }));\n },\n\n /**\n * Send a file to this channel.\n * @param {BufferResolvable} attachment File to send\n * @param {string} [name='file.jpg'] Name and extension of the file\n * @param {StringResolvable} [content] Text for the message\n * @param {MessageOptions} [options] Options for the message\n * @returns {Promise}\n * @deprecated\n */\n sendFile(attachment, name, content, options = {}) {\n return this.send({ files: [{ attachment, name }], content, options });\n },\n\n /**\n * Send a code block to this channel.\n * @param {string} lang Language for the code block\n * @param {StringResolvable} content Content of the code block\n * @param {MessageOptions} [options] Options for the message\n * @returns {Promise}\n * @deprecated\n */\n sendCode(lang, content, options = {}) {\n return this.send(content, Object.assign(options, { code: lang }));\n },\n};\n\nfor (const key of Object.keys(Deprecated)) {\n TextBasedChannel.prototype[key] = util.deprecate(Deprecated[key], `TextChannel#${key}: use TextChannel#send instead`);\n}\n\nexports.applyToClass = (structure, full = false, ignore = []) => {\n const props = ['send', 'sendMessage', 'sendEmbed', 'sendFile', 'sendFiles', 'sendCode'];\n if (full) {\n props.push(\n '_cacheMessage',\n 'acknowledge',\n 'fetchMessages',\n 'fetchMessage',\n 'search',\n 'lastMessage',\n 'lastPinAt',\n 'bulkDelete',\n 'startTyping',\n 'stopTyping',\n 'typing',\n 'typingCount',\n 'fetchPinnedMessages',\n 'createCollector',\n 'createMessageCollector',\n 'awaitMessages'\n );\n }\n for (const prop of props) {\n if (ignore.includes(prop)) continue;\n Object.defineProperty(structure.prototype, prop, Object.getOwnPropertyDescriptor(TextBasedChannel.prototype, prop));\n }\n};\n\nTextBasedChannel.prototype.acknowledge = util.deprecate(\n TextBasedChannel.prototype.acknowledge, 'TextBasedChannel#acknowledge: userbot methods will be removed'\n);\n\nTextBasedChannel.prototype.search =\n util.deprecate(TextBasedChannel.prototype.search, 'TextBasedChannel#search: userbot methods will be removed');\n\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../node_modules/buffer/index.js */ \"./node_modules/buffer/index.js\").Buffer))\n\n//# sourceURL=webpack:///./src/structures/interfaces/TextBasedChannel.js?"); /***/ }), @@ -1917,6 +2026,18 @@ eval("const Permissions = __webpack_require__(/*! ../../util/Permissions */ \"./ /***/ }), +/***/ "./src/util/BitField.js": +/*!******************************!*\ + !*** ./src/util/BitField.js ***! + \******************************/ +/*! no static exports found */ +/*! ModuleConcatenation bailout: Module is not an ECMAScript module */ +/***/ (function(module, exports) { + +eval("/**\n * Data structure that makes it easy to interact with a bitfield.\n */\nclass BitField {\n /**\n * @param {BitFieldResolvable} [bits=0] Bits(s) to read from\n */\n constructor(bits) {\n /**\n * Bitfield of the packed bits\n * @type {number}\n */\n this.bitfield = this.constructor.resolve(bits);\n }\n\n /**\n * Checks whether the bitfield has a bit, or any of multiple bits.\n * @param {BitFieldResolvable} bit Bit(s) to check for\n * @returns {boolean}\n */\n any(bit) {\n return (this.bitfield & this.constructor.resolve(bit)) !== 0;\n }\n\n /**\n * Checks if this bitfield equals another\n * @param {BitFieldResolvable} bit Bit(s) to check for\n * @returns {boolean}\n */\n equals(bit) {\n return this.bitfield === this.constructor.resolve(bit);\n }\n\n /**\n * Checks whether the bitfield has a bit, or multiple bits.\n * @param {BitFieldResolvable} bit Bit(s) to check for\n * @returns {boolean}\n */\n has(bit) {\n if (Array.isArray(bit)) return bit.every(p => this.has(p));\n bit = this.constructor.resolve(bit);\n return (this.bitfield & bit) === bit;\n }\n\n /**\n * Gets all given bits that are missing from the bitfield.\n * @param {BitFieldResolvable} bits Bits(s) to check for\n * @param {...*} hasParams Additional parameters for the has method, if any\n * @returns {string[]}\n */\n missing(bits, ...hasParams) {\n if (!Array.isArray(bits)) bits = new this.constructor(bits).toArray(false);\n return bits.filter(p => !this.has(p, ...hasParams));\n }\n\n /**\n * Freezes these bits, making them immutable.\n * @returns {Readonly} These bits\n */\n freeze() {\n return Object.freeze(this);\n }\n\n /**\n * Adds bits to these ones.\n * @param {...BitFieldResolvable} [bits] Bits to add\n * @returns {BitField} These bits or new BitField if the instance is frozen.\n */\n add(...bits) {\n let total = 0;\n for (const bit of bits) {\n total |= this.constructor.resolve(bit);\n }\n if (Object.isFrozen(this)) return new this.constructor(this.bitfield | total);\n this.bitfield |= total;\n return this;\n }\n\n /**\n * Removes bits from these.\n * @param {...BitFieldResolvable} [bits] Bits to remove\n * @returns {BitField} These bits or new BitField if the instance is frozen.\n */\n remove(...bits) {\n let total = 0;\n for (const bit of bits) {\n total |= this.constructor.resolve(bit);\n }\n if (Object.isFrozen(this)) return new this.constructor(this.bitfield & ~total);\n this.bitfield &= ~total;\n return this;\n }\n\n /**\n * Gets an object mapping field names to a {@link boolean} indicating whether the\n * bit is available.\n * @param {...*} hasParams Additional parameters for the has method, if any\n * @returns {Object}\n */\n serialize(...hasParams) {\n const serialized = {};\n for (const flag of Object.keys(this.constructor.FLAGS)) {\n serialized[flag] = this.has(this.constructor.FLAGS[flag], ...hasParams);\n }\n return serialized;\n }\n\n /**\n * Gets an {@link Array} of bitfield names based on the bits available.\n * @param {...*} hasParams Additional parameters for the has method, if any\n * @returns {string[]}\n */\n toArray(...hasParams) {\n return Object.keys(this.constructor.FLAGS).filter(bit => this.has(bit, ...hasParams));\n }\n\n toJSON() {\n return this.bitfield;\n }\n\n valueOf() {\n return this.bitfield;\n }\n\n *[Symbol.iterator]() {\n yield* this.toArray();\n }\n\n /**\n * Data that can be resolved to give a bitfield. This can be:\n * * A string (see {@link BitField.FLAGS})\n * * A bit number\n * * An instance of BitField\n * * An Array of BitFieldResolvable\n * @typedef {string|number|BitField|BitFieldResolvable[]} BitFieldResolvable\n */\n\n /**\n * Resolves bitfields to their numeric form.\n * @param {BitFieldResolvable} [bit=0] - bit(s) to resolve\n * @returns {number}\n */\n static resolve(bit = 0) {\n if (typeof bit === 'number' && bit >= 0) return bit;\n if (bit instanceof BitField) return bit.bitfield;\n if (Array.isArray(bit)) return bit.map(p => this.resolve(p)).reduce((prev, p) => prev | p, 0);\n if (typeof bit === 'string' && typeof this.FLAGS[bit] !== 'undefined') return this.FLAGS[bit];\n throw new RangeError('Invalid bitfield flag or number.');\n }\n}\n\n/**\n * Numeric bitfield flags.\n * Defined in extension classes\n * @type {Object}\n * @abstract\n */\nBitField.FLAGS = {};\n\nmodule.exports = BitField;\n\n\n//# sourceURL=webpack:///./src/util/BitField.js?"); + +/***/ }), + /***/ "./src/util/Collection.js": /*!********************************!*\ !*** ./src/util/Collection.js ***! @@ -1937,7 +2058,19 @@ eval("const util = __webpack_require__(/*! util */ \"./node_modules/util/util.js /*! ModuleConcatenation bailout: Module is not an ECMAScript module */ /***/ (function(module, exports, __webpack_require__) { -eval("/* WEBPACK VAR INJECTION */(function(process) {exports.Package = __webpack_require__(/*! ../../package.json */ \"./package.json\");\n\n/**\n * Options for a client.\n * @typedef {Object} ClientOptions\n * @property {string} [apiRequestMethod='sequential'] One of `sequential` or `burst`. The sequential handler executes\n * all requests in the order they are triggered, whereas the burst handler runs multiple in parallel, and doesn't\n * provide the guarantee of any particular order. Burst mode is more likely to hit a 429 ratelimit error by its nature,\n * and is therefore slightly riskier to use.\n * @property {number} [shardId=0] ID of the shard to run\n * @property {number} [shardCount=0] Total number of shards\n * @property {number} [messageCacheMaxSize=200] Maximum number of messages to cache per channel\n * (-1 or Infinity for unlimited - don't do this without message sweeping, otherwise memory usage will climb\n * indefinitely)\n * @property {number} [messageCacheLifetime=0] How long a message should stay in the cache until it is considered\n * sweepable (in seconds, 0 for forever)\n * @property {number} [messageSweepInterval=0] How frequently to remove messages from the cache that are older than\n * the message cache lifetime (in seconds, 0 for never)\n * @property {boolean} [fetchAllMembers=false] Whether to cache all guild members and users upon startup, as well as\n * upon joining a guild (should be avoided whenever possible)\n * @property {boolean} [disableEveryone=false] Default value for {@link MessageOptions#disableEveryone}\n * @property {boolean} [sync=false] Whether to periodically sync guilds (for user accounts)\n * @property {number} [restWsBridgeTimeout=5000] Maximum time permitted between REST responses and their\n * corresponding websocket events\n * @property {number} [restTimeOffset=500] Extra time in millseconds to wait before continuing to make REST\n * requests (higher values will reduce rate-limiting errors on bad connections)\n * @property {number} [retryLimit=Infinity] How many times to retry on 5XX errors\n * (Infinity for indefinite amount of retries)\n * @property {WSEventType[]} [disabledEvents] An array of disabled websocket events. Events in this array will not be\n * processed, potentially resulting in performance improvements for larger bots. Only disable events you are\n * 100% certain you don't need, as many are important, but not obviously so. The safest one to disable with the\n * most impact is typically `TYPING_START`.\n * @property {WebsocketOptions} [ws] Options for the WebSocket\n * @property {HTTPOptions} [http] HTTP options\n */\nexports.DefaultOptions = {\n apiRequestMethod: 'sequential',\n shardId: 0,\n shardCount: 0,\n messageCacheMaxSize: 200,\n messageCacheLifetime: 0,\n messageSweepInterval: 0,\n fetchAllMembers: false,\n disableEveryone: false,\n sync: false,\n restWsBridgeTimeout: 5000,\n retryLimit: Infinity,\n disabledEvents: [],\n restTimeOffset: 500,\n\n /**\n * WebSocket options (these are left as snake_case to match the API)\n * @typedef {Object} WebsocketOptions\n * @property {number} [large_threshold=250] Number of members in a guild to be considered large\n * @property {boolean} [compress=true] Whether to compress data sent on the connection\n * (defaults to `false` for browsers)\n */\n ws: {\n large_threshold: 250,\n compress: __webpack_require__(/*! os */ \"./node_modules/os-browserify/browser.js\").platform() !== 'browser',\n properties: {\n $os: process ? process.platform : 'discord.js',\n $browser: 'discord.js',\n $device: 'discord.js',\n $referrer: '',\n $referring_domain: '',\n },\n version: 6,\n },\n\n /**\n * HTTP options\n * @typedef {Object} HTTPOptions\n * @property {number} [version=7] API version to use\n * @property {string} [api='https://discordapp.com/api'] Base url of the API\n * @property {string} [cdn='https://cdn.discordapp.com'] Base url of the CDN\n * @property {string} [invite='https://discord.gg'] Base url of invites\n */\n http: {\n version: 7,\n host: 'https://discordapp.com',\n cdn: 'https://cdn.discordapp.com',\n },\n};\n\nexports.WSCodes = {\n 1000: 'Connection gracefully closed',\n 4004: 'Tried to identify with an invalid token',\n 4010: 'Sharding data provided was invalid',\n 4011: 'Shard would be on too many guilds if connected',\n};\n\nexports.Errors = {\n NO_TOKEN: 'Request to use token, but token was unavailable to the client.',\n NO_BOT_ACCOUNT: 'Only bot accounts are able to make use of this feature.',\n NO_USER_ACCOUNT: 'Only user accounts are able to make use of this feature.',\n BAD_WS_MESSAGE: 'A bad message was received from the websocket; either bad compression, or not JSON.',\n TOOK_TOO_LONG: 'Something took too long to do.',\n NOT_A_PERMISSION: 'Invalid permission string or number.',\n INVALID_RATE_LIMIT_METHOD: 'Unknown rate limiting method.',\n BAD_LOGIN: 'Incorrect login details were provided.',\n INVALID_SHARD: 'Invalid shard settings were provided.',\n SHARDING_REQUIRED: 'This session would have handled too many guilds - Sharding is required.',\n INVALID_TOKEN: 'An invalid token was provided.',\n};\n\nconst Endpoints = exports.Endpoints = {\n User: userID => {\n if (userID.id) userID = userID.id;\n const base = `/users/${userID}`;\n return {\n toString: () => base,\n channels: `${base}/channels`,\n profile: `${base}/profile`,\n relationships: `${base}/relationships`,\n settings: `${base}/settings`,\n Relationship: uID => `${base}/relationships/${uID}`,\n Guild: guildID => ({\n toString: () => `${base}/guilds/${guildID}`,\n settings: `${base}/guilds/${guildID}/settings`,\n }),\n Note: id => `${base}/notes/${id}`,\n Mentions: (limit, roles, everyone, guildID) =>\n `${base}/mentions?limit=${limit}&roles=${roles}&everyone=${everyone}${guildID ? `&guild_id=${guildID}` : ''}`,\n Avatar: (root, hash) => {\n if (userID === '1') return hash;\n return Endpoints.CDN(root).Avatar(userID, hash);\n },\n };\n },\n guilds: '/guilds',\n Guild: guildID => {\n if (guildID.id) guildID = guildID.id;\n const base = `/guilds/${guildID}`;\n return {\n toString: () => base,\n prune: `${base}/prune`,\n embed: `${base}/embed`,\n bans: `${base}/bans`,\n integrations: `${base}/integrations`,\n members: `${base}/members`,\n channels: `${base}/channels`,\n invites: `${base}/invites`,\n roles: `${base}/roles`,\n emojis: `${base}/emojis`,\n search: `${base}/messages/search`,\n vanityURL: `${base}/vanity-url`,\n voiceRegions: `${base}/regions`,\n webhooks: `${base}/webhooks`,\n ack: `${base}/ack`,\n settings: `${base}/settings`,\n auditLogs: `${base}/audit-logs`,\n Emoji: emojiID => `${base}/emojis/${emojiID}`,\n Icon: (root, hash) => Endpoints.CDN(root).Icon(guildID, hash),\n Splash: (root, hash) => Endpoints.CDN(root).Splash(guildID, hash),\n Role: roleID => `${base}/roles/${roleID}`,\n Member: memberID => {\n if (memberID.id) memberID = memberID.id;\n const mbase = `${base}/members/${memberID}`;\n return {\n toString: () => mbase,\n Role: roleID => `${mbase}/roles/${roleID}`,\n nickname: `${base}/members/@me/nick`,\n };\n },\n };\n },\n channels: '/channels',\n Channel: channelID => {\n if (channelID.id) channelID = channelID.id;\n const base = `/channels/${channelID}`;\n return {\n toString: () => base,\n messages: {\n toString: () => `${base}/messages`,\n bulkDelete: `${base}/messages/bulk-delete`,\n },\n invites: `${base}/invites`,\n typing: `${base}/typing`,\n permissions: `${base}/permissions`,\n webhooks: `${base}/webhooks`,\n search: `${base}/messages/search`,\n pins: `${base}/pins`,\n Icon: (root, hash) => Endpoints.CDN(root).GDMIcon(channelID, hash),\n Pin: messageID => `${base}/pins/${messageID}`,\n Recipient: recipientID => `${base}/recipients/${recipientID}`,\n Message: messageID => {\n if (messageID.id) messageID = messageID.id;\n const mbase = `${base}/messages/${messageID}`;\n return {\n toString: () => mbase,\n reactions: `${mbase}/reactions`,\n ack: `${mbase}/ack`,\n Reaction: emoji => {\n const rbase = `${mbase}/reactions/${emoji}`;\n return {\n toString: () => rbase,\n User: userID => `${rbase}/${userID}`,\n };\n },\n };\n },\n };\n },\n Message: m => exports.Endpoints.Channel(m.channel).Message(m),\n Member: m => exports.Endpoints.Guild(m.guild).Member(m),\n CDN(root) {\n return {\n Emoji: (emojiID, format = 'png') => `${root}/emojis/${emojiID}.${format}`,\n Asset: name => `${root}/assets/${name}`,\n Avatar: (userID, hash) => `${root}/avatars/${userID}/${hash}.${hash.startsWith('a_') ? 'gif' : 'png?size=2048'}`,\n Icon: (guildID, hash) => `${root}/icons/${guildID}/${hash}.jpg`,\n AppIcon: (clientID, hash) => `${root}/app-icons/${clientID}/${hash}.png`,\n AppAsset: (clientID, hash) => `${root}/app-assets/${clientID}/${hash}.png`,\n GDMIcon: (channelID, hash) => `${root}/channel-icons/${channelID}/${hash}.jpg?size=2048`,\n Splash: (guildID, hash) => `${root}/splashes/${guildID}/${hash}.jpg`,\n };\n },\n OAUTH2: {\n Application: appID => {\n const base = `/oauth2/applications/${appID}`;\n return {\n toString: () => base,\n resetSecret: `${base}/reset`,\n resetToken: `${base}/bot/reset`,\n };\n },\n App: appID => `/oauth2/authorize?client_id=${appID}`,\n },\n login: '/auth/login',\n logout: '/auth/logout',\n voiceRegions: '/voice/regions',\n gateway: {\n toString: () => '/gateway',\n bot: '/gateway/bot',\n },\n Invite: inviteID => `/invite/${inviteID}?with_counts=true`,\n inviteLink: id => `https://discord.gg/${id}`,\n Webhook: (webhookID, token) => `/webhooks/${webhookID}${token ? `/${token}` : ''}`,\n};\n\n\n/**\n * The current status of the client. Here are the available statuses:\n * * READY: 0\n * * CONNECTING: 1\n * * RECONNECTING: 2\n * * IDLE: 3\n * * NEARLY: 4\n * * DISCONNECTED: 5\n * @typedef {number} Status\n */\nexports.Status = {\n READY: 0,\n CONNECTING: 1,\n RECONNECTING: 2,\n IDLE: 3,\n NEARLY: 4,\n DISCONNECTED: 5,\n};\n\n/**\n * The current status of a voice connection. Here are the available statuses:\n * * CONNECTED\n * * CONNECTING\n * * AUTHENTICATING\n * * RECONNECTING\n * * DISCONNECTED\n * @typedef {number} VoiceStatus\n */\nexports.VoiceStatus = {\n CONNECTED: 0,\n CONNECTING: 1,\n AUTHENTICATING: 2,\n RECONNECTING: 3,\n DISCONNECTED: 4,\n};\n\nexports.ChannelTypes = {\n TEXT: 0,\n DM: 1,\n VOICE: 2,\n GROUP_DM: 3,\n CATEGORY: 4,\n NEWS: 5,\n STORE: 6,\n};\n\nexports.OPCodes = {\n DISPATCH: 0,\n HEARTBEAT: 1,\n IDENTIFY: 2,\n STATUS_UPDATE: 3,\n VOICE_STATE_UPDATE: 4,\n VOICE_GUILD_PING: 5,\n RESUME: 6,\n RECONNECT: 7,\n REQUEST_GUILD_MEMBERS: 8,\n INVALID_SESSION: 9,\n HELLO: 10,\n HEARTBEAT_ACK: 11,\n};\n\nexports.VoiceOPCodes = {\n IDENTIFY: 0,\n SELECT_PROTOCOL: 1,\n READY: 2,\n HEARTBEAT: 3,\n SESSION_DESCRIPTION: 4,\n SPEAKING: 5,\n};\n\nexports.Events = {\n RATE_LIMIT: 'rateLimit',\n READY: 'ready',\n RESUME: 'resume',\n GUILD_CREATE: 'guildCreate',\n GUILD_DELETE: 'guildDelete',\n GUILD_UPDATE: 'guildUpdate',\n GUILD_UNAVAILABLE: 'guildUnavailable',\n GUILD_AVAILABLE: 'guildAvailable',\n GUILD_MEMBER_ADD: 'guildMemberAdd',\n GUILD_MEMBER_REMOVE: 'guildMemberRemove',\n GUILD_MEMBER_UPDATE: 'guildMemberUpdate',\n GUILD_MEMBER_AVAILABLE: 'guildMemberAvailable',\n GUILD_MEMBER_SPEAKING: 'guildMemberSpeaking',\n GUILD_MEMBERS_CHUNK: 'guildMembersChunk',\n GUILD_INTEGRATIONS_UPDATE: 'guildIntegrationsUpdate',\n GUILD_ROLE_CREATE: 'roleCreate',\n GUILD_ROLE_DELETE: 'roleDelete',\n GUILD_ROLE_UPDATE: 'roleUpdate',\n GUILD_EMOJI_CREATE: 'emojiCreate',\n GUILD_EMOJI_DELETE: 'emojiDelete',\n GUILD_EMOJI_UPDATE: 'emojiUpdate',\n GUILD_BAN_ADD: 'guildBanAdd',\n GUILD_BAN_REMOVE: 'guildBanRemove',\n CHANNEL_CREATE: 'channelCreate',\n CHANNEL_DELETE: 'channelDelete',\n CHANNEL_UPDATE: 'channelUpdate',\n CHANNEL_PINS_UPDATE: 'channelPinsUpdate',\n MESSAGE_CREATE: 'message',\n MESSAGE_DELETE: 'messageDelete',\n MESSAGE_UPDATE: 'messageUpdate',\n MESSAGE_BULK_DELETE: 'messageDeleteBulk',\n MESSAGE_REACTION_ADD: 'messageReactionAdd',\n MESSAGE_REACTION_REMOVE: 'messageReactionRemove',\n MESSAGE_REACTION_REMOVE_ALL: 'messageReactionRemoveAll',\n USER_UPDATE: 'userUpdate',\n USER_NOTE_UPDATE: 'userNoteUpdate',\n USER_SETTINGS_UPDATE: 'clientUserSettingsUpdate',\n USER_GUILD_SETTINGS_UPDATE: 'clientUserGuildSettingsUpdate',\n PRESENCE_UPDATE: 'presenceUpdate',\n VOICE_STATE_UPDATE: 'voiceStateUpdate',\n TYPING_START: 'typingStart',\n TYPING_STOP: 'typingStop',\n WEBHOOKS_UPDATE: 'webhookUpdate',\n DISCONNECT: 'disconnect',\n RECONNECTING: 'reconnecting',\n ERROR: 'error',\n WARN: 'warn',\n DEBUG: 'debug',\n};\n\n/**\n * The type of an activity of a users presence, e.g. `PLAYING`. Here are the available types:\n * * PLAYING\n * * STREAMING\n * * LISTENING\n * * WATCHING\n * @typedef {string} ActivityType\n */\nexports.ActivityTypes = [\n 'PLAYING',\n 'STREAMING',\n 'LISTENING',\n 'WATCHING',\n];\n\nexports.ActivityFlags = {\n INSTANCE: 1 << 0,\n JOIN: 1 << 1,\n SPECTATE: 1 << 2,\n JOIN_REQUEST: 1 << 3,\n SYNC: 1 << 4,\n PLAY: 1 << 5,\n};\n\n/**\n * The type of a websocket message event, e.g. `MESSAGE_CREATE`. Here are the available events:\n * * READY\n * * RESUMED\n * * GUILD_SYNC\n * * GUILD_CREATE\n * * GUILD_DELETE\n * * GUILD_UPDATE\n * * GUILD_MEMBER_ADD\n * * GUILD_MEMBER_REMOVE\n * * GUILD_MEMBER_UPDATE\n * * GUILD_MEMBERS_CHUNK\n * * GUILD_INTEGRATIONS_UPDATE\n * * GUILD_ROLE_CREATE\n * * GUILD_ROLE_DELETE\n * * GUILD_ROLE_UPDATE\n * * GUILD_BAN_ADD\n * * GUILD_BAN_REMOVE\n * * CHANNEL_CREATE\n * * CHANNEL_DELETE\n * * CHANNEL_UPDATE\n * * CHANNEL_PINS_UPDATE\n * * MESSAGE_CREATE\n * * MESSAGE_DELETE\n * * MESSAGE_UPDATE\n * * MESSAGE_DELETE_BULK\n * * MESSAGE_REACTION_ADD\n * * MESSAGE_REACTION_REMOVE\n * * MESSAGE_REACTION_REMOVE_ALL\n * * USER_UPDATE\n * * USER_NOTE_UPDATE\n * * USER_SETTINGS_UPDATE\n * * PRESENCE_UPDATE\n * * VOICE_STATE_UPDATE\n * * TYPING_START\n * * VOICE_SERVER_UPDATE\n * * RELATIONSHIP_ADD\n * * RELATIONSHIP_REMOVE\n * * WEBHOOKS_UPDATE\n * @typedef {string} WSEventType\n */\nexports.WSEvents = {\n READY: 'READY',\n RESUMED: 'RESUMED',\n GUILD_SYNC: 'GUILD_SYNC',\n GUILD_CREATE: 'GUILD_CREATE',\n GUILD_DELETE: 'GUILD_DELETE',\n GUILD_UPDATE: 'GUILD_UPDATE',\n GUILD_MEMBER_ADD: 'GUILD_MEMBER_ADD',\n GUILD_MEMBER_REMOVE: 'GUILD_MEMBER_REMOVE',\n GUILD_MEMBER_UPDATE: 'GUILD_MEMBER_UPDATE',\n GUILD_MEMBERS_CHUNK: 'GUILD_MEMBERS_CHUNK',\n GUILD_INTEGRATIONS_UPDATE: 'GUILD_INTEGRATIONS_UPDATE',\n GUILD_ROLE_CREATE: 'GUILD_ROLE_CREATE',\n GUILD_ROLE_DELETE: 'GUILD_ROLE_DELETE',\n GUILD_ROLE_UPDATE: 'GUILD_ROLE_UPDATE',\n GUILD_BAN_ADD: 'GUILD_BAN_ADD',\n GUILD_BAN_REMOVE: 'GUILD_BAN_REMOVE',\n GUILD_EMOJIS_UPDATE: 'GUILD_EMOJIS_UPDATE',\n CHANNEL_CREATE: 'CHANNEL_CREATE',\n CHANNEL_DELETE: 'CHANNEL_DELETE',\n CHANNEL_UPDATE: 'CHANNEL_UPDATE',\n CHANNEL_PINS_UPDATE: 'CHANNEL_PINS_UPDATE',\n MESSAGE_CREATE: 'MESSAGE_CREATE',\n MESSAGE_DELETE: 'MESSAGE_DELETE',\n MESSAGE_UPDATE: 'MESSAGE_UPDATE',\n MESSAGE_DELETE_BULK: 'MESSAGE_DELETE_BULK',\n MESSAGE_REACTION_ADD: 'MESSAGE_REACTION_ADD',\n MESSAGE_REACTION_REMOVE: 'MESSAGE_REACTION_REMOVE',\n MESSAGE_REACTION_REMOVE_ALL: 'MESSAGE_REACTION_REMOVE_ALL',\n USER_UPDATE: 'USER_UPDATE',\n USER_NOTE_UPDATE: 'USER_NOTE_UPDATE',\n USER_SETTINGS_UPDATE: 'USER_SETTINGS_UPDATE',\n USER_GUILD_SETTINGS_UPDATE: 'USER_GUILD_SETTINGS_UPDATE',\n PRESENCE_UPDATE: 'PRESENCE_UPDATE',\n VOICE_STATE_UPDATE: 'VOICE_STATE_UPDATE',\n TYPING_START: 'TYPING_START',\n VOICE_SERVER_UPDATE: 'VOICE_SERVER_UPDATE',\n RELATIONSHIP_ADD: 'RELATIONSHIP_ADD',\n RELATIONSHIP_REMOVE: 'RELATIONSHIP_REMOVE',\n WEBHOOKS_UPDATE: 'WEBHOOKS_UPDATE',\n};\n\n/**\n * The type of a message, e.g. `DEFAULT`. Here are the available types:\n * * DEFAULT\n * * RECIPIENT_ADD\n * * RECIPIENT_REMOVE\n * * CALL\n * * CHANNEL_NAME_CHANGE\n * * CHANNEL_ICON_CHANGE\n * * PINS_ADD\n * * GUILD_MEMBER_JOIN\n * @typedef {string} MessageType\n */\nexports.MessageTypes = [\n 'DEFAULT',\n 'RECIPIENT_ADD',\n 'RECIPIENT_REMOVE',\n 'CALL',\n 'CHANNEL_NAME_CHANGE',\n 'CHANNEL_ICON_CHANGE',\n 'PINS_ADD',\n 'GUILD_MEMBER_JOIN',\n];\n\n/**\n * The type of a message notification setting. Here are the available types:\n * * EVERYTHING\n * * MENTIONS\n * * NOTHING\n * * INHERIT (only for GuildChannel)\n * @typedef {string} MessageNotificationType\n */\nexports.MessageNotificationTypes = [\n 'EVERYTHING',\n 'MENTIONS',\n 'NOTHING',\n 'INHERIT',\n];\n\nexports.DefaultAvatars = {\n BLURPLE: '6debd47ed13483642cf09e832ed0bc1b',\n GREY: '322c936a8c8be1b803cd94861bdfa868',\n GREEN: 'dd4dbc0016779df1378e7812eabaa04d',\n ORANGE: '0e291f67c9274a1abdddeb3fd919cbaa',\n RED: '1cbd08c76f8af6dddce02c5138971129',\n};\n\nexports.ExplicitContentFilterTypes = [\n 'DISABLED',\n 'NON_FRIENDS',\n 'FRIENDS_AND_NON_FRIENDS',\n];\n\nexports.UserSettingsMap = {\n /**\n * Automatically convert emoticons in your messages to emoji\n * For example, when you type `:-)` Discord will convert it to 😃\n * @name ClientUserSettings#convertEmoticons\n * @type {boolean}\n */\n convert_emoticons: 'convertEmoticons',\n\n /**\n * If new guilds should automatically disable DMs between you and its members\n * @name ClientUserSettings#defaultGuildsRestricted\n * @type {boolean}\n */\n default_guilds_restricted: 'defaultGuildsRestricted',\n\n /**\n * Automatically detect accounts from services like Steam and Blizzard when you open the Discord client\n * @name ClientUserSettings#detectPlatformAccounts\n * @type {boolean}\n */\n detect_platform_accounts: 'detectPlatformAccounts',\n\n /**\n * Developer Mode exposes context menu items helpful for people writing bots using the Discord API\n * @name ClientUserSettings#developerMode\n * @type {boolean}\n */\n developer_mode: 'developerMode',\n\n /**\n * Allow playback and usage of the `/tts` command\n * @name ClientUserSettings#enableTTSCommand\n * @type {boolean}\n */\n enable_tts_command: 'enableTTSCommand',\n\n /**\n * The theme of the client. Either `light` or `dark`\n * @name ClientUserSettings#theme\n * @type {string}\n */\n theme: 'theme',\n\n /**\n * Last status set in the client\n * @name ClientUserSettings#status\n * @type {PresenceStatus}\n */\n status: 'status',\n\n /**\n * Display currently running game as status message\n * @name ClientUserSettings#showCurrentGame\n * @type {boolean}\n */\n show_current_game: 'showCurrentGame',\n\n /**\n * Display images, videos, and lolcats when uploaded directly to Discord\n * @name ClientUserSettings#inlineAttachmentMedia\n * @type {boolean}\n */\n inline_attachment_media: 'inlineAttachmentMedia',\n\n /**\n * Display images, videos, and lolcats when uploaded posted as links in chat\n * @name ClientUserSettings#inlineEmbedMedia\n * @type {boolean}\n */\n inline_embed_media: 'inlineEmbedMedia',\n\n /**\n * Language the Discord client will use, as an RFC 3066 language identifier\n * @name ClientUserSettings#locale\n * @type {string}\n */\n locale: 'locale',\n\n /**\n * Display messages in compact mode\n * @name ClientUserSettings#messageDisplayCompact\n * @type {boolean}\n */\n message_display_compact: 'messageDisplayCompact',\n\n /**\n * Show emoji reactions on messages\n * @name ClientUserSettings#renderReactions\n * @type {boolean}\n */\n render_reactions: 'renderReactions',\n\n /**\n * Array of snowflake IDs for guilds, in the order they appear in the Discord client\n * @name ClientUserSettings#guildPositions\n * @type {Snowflake[]}\n */\n guild_positions: 'guildPositions',\n\n /**\n * Array of snowflake IDs for guilds which you will not recieve DMs from\n * @name ClientUserSettings#restrictedGuilds\n * @type {Snowflake[]}\n */\n restricted_guilds: 'restrictedGuilds',\n\n explicit_content_filter: function explicitContentFilter(type) { // eslint-disable-line func-name-matching\n /**\n * Safe direct messaging; force people's messages with images to be scanned before they are sent to you.\n * One of `DISABLED`, `NON_FRIENDS`, `FRIENDS_AND_NON_FRIENDS`\n * @name ClientUserSettings#explicitContentFilter\n * @type {string}\n */\n return exports.ExplicitContentFilterTypes[type];\n },\n friend_source_flags: function friendSources(flags) { // eslint-disable-line func-name-matching\n /**\n * Who can add you as a friend\n * @name ClientUserSettings#friendSources\n * @type {Object}\n * @property {boolean} all Mutual friends and mutual guilds\n * @property {boolean} mutualGuilds Only mutual guilds\n * @property {boolean} mutualFriends Only mutual friends\n */\n return {\n all: flags.all || false,\n mutualGuilds: flags.all ? true : flags.mutual_guilds || false,\n mutualFriends: flags.all ? true : flags.mutualFriends || false,\n };\n },\n};\n\nexports.UserGuildSettingsMap = {\n message_notifications: function messageNotifications(type) { // eslint-disable-line func-name-matching\n /**\n * The type of message that should notify you\n * @name ClientUserGuildSettings#messageNotifications\n * @type {MessageNotificationType}\n */\n return exports.MessageNotificationTypes[type];\n },\n /**\n * Whether to receive mobile push notifications\n * @name ClientUserGuildSettings#mobilePush\n * @type {boolean}\n */\n mobile_push: 'mobilePush',\n /**\n * Whether the guild is muted\n * @name ClientUserGuildSettings#muted\n * @type {boolean}\n */\n muted: 'muted',\n /**\n * Whether to suppress everyone mention\n * @name ClientUserGuildSettings#suppressEveryone\n * @type {boolean}\n */\n suppress_everyone: 'suppressEveryone',\n /**\n * A collection containing all the channel overrides\n * @name ClientUserGuildSettings#channelOverrides\n * @type {Collection}\n */\n channel_overrides: 'channelOverrides',\n};\n\nexports.UserChannelOverrideMap = {\n message_notifications: function messageNotifications(type) { // eslint-disable-line func-name-matching\n /**\n * The type of message that should notify you\n * @name ClientUserChannelOverride#messageNotifications\n * @type {MessageNotificationType}\n */\n return exports.MessageNotificationTypes[type];\n },\n /**\n * Whether the channel is muted\n * @name ClientUserChannelOverride#muted\n * @type {boolean}\n */\n muted: 'muted',\n};\n\nexports.Colors = {\n DEFAULT: 0x000000,\n WHITE: 0xFFFFFF,\n AQUA: 0x1ABC9C,\n GREEN: 0x2ECC71,\n BLUE: 0x3498DB,\n PURPLE: 0x9B59B6,\n LUMINOUS_VIVID_PINK: 0xE91E63,\n GOLD: 0xF1C40F,\n ORANGE: 0xE67E22,\n RED: 0xE74C3C,\n GREY: 0x95A5A6,\n NAVY: 0x34495E,\n DARK_AQUA: 0x11806A,\n DARK_GREEN: 0x1F8B4C,\n DARK_BLUE: 0x206694,\n DARK_PURPLE: 0x71368A,\n DARK_VIVID_PINK: 0xAD1457,\n DARK_GOLD: 0xC27C0E,\n DARK_ORANGE: 0xA84300,\n DARK_RED: 0x992D22,\n DARK_GREY: 0x979C9F,\n DARKER_GREY: 0x7F8C8D,\n LIGHT_GREY: 0xBCC0C0,\n DARK_NAVY: 0x2C3E50,\n BLURPLE: 0x7289DA,\n GREYPLE: 0x99AAB5,\n DARK_BUT_NOT_BLACK: 0x2C2F33,\n NOT_QUITE_BLACK: 0x23272A,\n};\n\n/**\n * An error encountered while performing an API request. Here are the potential errors:\n * * UNKNOWN_ACCOUNT\n * * UNKNOWN_APPLICATION\n * * UNKNOWN_CHANNEL\n * * UNKNOWN_GUILD\n * * UNKNOWN_INTEGRATION\n * * UNKNOWN_INVITE\n * * UNKNOWN_MEMBER\n * * UNKNOWN_MESSAGE\n * * UNKNOWN_OVERWRITE\n * * UNKNOWN_PROVIDER\n * * UNKNOWN_ROLE\n * * UNKNOWN_TOKEN\n * * UNKNOWN_USER\n * * UNKNOWN_EMOJI\n * * UNKNOWN_WEBHOOK\n * * BOT_PROHIBITED_ENDPOINT\n * * BOT_ONLY_ENDPOINT\n * * MAXIMUM_GUILDS\n * * MAXIMUM_FRIENDS\n * * MAXIMUM_PINS\n * * MAXIMUM_ROLES\n * * MAXIMUM_REACTIONS\n * * UNAUTHORIZED\n * * MISSING_ACCESS\n * * INVALID_ACCOUNT_TYPE\n * * CANNOT_EXECUTE_ON_DM\n * * EMBED_DISABLED\n * * CANNOT_EDIT_MESSAGE_BY_OTHER\n * * CANNOT_SEND_EMPTY_MESSAGE\n * * CANNOT_MESSAGE_USER\n * * CANNOT_SEND_MESSAGES_IN_VOICE_CHANNEL\n * * CHANNEL_VERIFICATION_LEVEL_TOO_HIGH\n * * OAUTH2_APPLICATION_BOT_ABSENT\n * * MAXIMUM_OAUTH2_APPLICATIONS\n * * INVALID_OAUTH_STATE\n * * MISSING_PERMISSIONS\n * * INVALID_AUTHENTICATION_TOKEN\n * * NOTE_TOO_LONG\n * * INVALID_BULK_DELETE_QUANTITY\n * * CANNOT_PIN_MESSAGE_IN_OTHER_CHANNEL\n * * INVALID_OR_TAKEN_INVITE_CODE\n * * CANNOT_EXECUTE_ON_SYSTEM_MESSAGE\n * * BULK_DELETE_MESSAGE_TOO_OLD\n * * INVITE_ACCEPTED_TO_GUILD_NOT_CONTANING_BOT\n * * REACTION_BLOCKED\n * @typedef {string} APIError\n */\nexports.APIErrors = {\n UNKNOWN_ACCOUNT: 10001,\n UNKNOWN_APPLICATION: 10002,\n UNKNOWN_CHANNEL: 10003,\n UNKNOWN_GUILD: 10004,\n UNKNOWN_INTEGRATION: 10005,\n UNKNOWN_INVITE: 10006,\n UNKNOWN_MEMBER: 10007,\n UNKNOWN_MESSAGE: 10008,\n UNKNOWN_OVERWRITE: 10009,\n UNKNOWN_PROVIDER: 10010,\n UNKNOWN_ROLE: 10011,\n UNKNOWN_TOKEN: 10012,\n UNKNOWN_USER: 10013,\n UNKNOWN_EMOJI: 10014,\n UNKNOWN_WEBHOOK: 10015,\n BOT_PROHIBITED_ENDPOINT: 20001,\n BOT_ONLY_ENDPOINT: 20002,\n MAXIMUM_GUILDS: 30001,\n MAXIMUM_FRIENDS: 30002,\n MAXIMUM_PINS: 30003,\n MAXIMUM_ROLES: 30005,\n MAXIMUM_REACTIONS: 30010,\n UNAUTHORIZED: 40001,\n MISSING_ACCESS: 50001,\n INVALID_ACCOUNT_TYPE: 50002,\n CANNOT_EXECUTE_ON_DM: 50003,\n EMBED_DISABLED: 50004,\n CANNOT_EDIT_MESSAGE_BY_OTHER: 50005,\n CANNOT_SEND_EMPTY_MESSAGE: 50006,\n CANNOT_MESSAGE_USER: 50007,\n CANNOT_SEND_MESSAGES_IN_VOICE_CHANNEL: 50008,\n CHANNEL_VERIFICATION_LEVEL_TOO_HIGH: 50009,\n OAUTH2_APPLICATION_BOT_ABSENT: 50010,\n MAXIMUM_OAUTH2_APPLICATIONS: 50011,\n INVALID_OAUTH_STATE: 50012,\n MISSING_PERMISSIONS: 50013,\n INVALID_AUTHENTICATION_TOKEN: 50014,\n NOTE_TOO_LONG: 50015,\n INVALID_BULK_DELETE_QUANTITY: 50016,\n CANNOT_PIN_MESSAGE_IN_OTHER_CHANNEL: 50019,\n INVALID_OR_TAKEN_INVITE_CODE: 50020,\n CANNOT_EXECUTE_ON_SYSTEM_MESSAGE: 50021,\n BULK_DELETE_MESSAGE_TOO_OLD: 50034,\n INVITE_ACCEPTED_TO_GUILD_NOT_CONTANING_BOT: 50036,\n REACTION_BLOCKED: 90001,\n};\n\n/**\n * The value set for a guild's default message notifications, e.g. `ALL`. Here are the available types:\n * * ALL\n * * MENTIONS\n * @typedef {string} DefaultMessageNotifications\n */\nexports.DefaultMessageNotifications = [\n 'ALL',\n 'MENTIONS',\n];\n\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../node_modules/process/browser.js */ \"./node_modules/process/browser.js\")))\n\n//# sourceURL=webpack:///./src/util/Constants.js?"); +eval("/* WEBPACK VAR INJECTION */(function(process) {exports.Package = __webpack_require__(/*! ../../package.json */ \"./package.json\");\n\n/**\n * Options for a client.\n * @typedef {Object} ClientOptions\n * @property {string} [apiRequestMethod='sequential'] One of `sequential` or `burst`. The sequential handler executes\n * all requests in the order they are triggered, whereas the burst handler runs multiple in parallel, and doesn't\n * provide the guarantee of any particular order. Burst mode is more likely to hit a 429 ratelimit error by its nature,\n * and is therefore slightly riskier to use.\n * @property {number} [shardId=0] ID of the shard to run\n * @property {number} [shardCount=0] Total number of shards\n * @property {number} [messageCacheMaxSize=200] Maximum number of messages to cache per channel\n * (-1 or Infinity for unlimited - don't do this without message sweeping, otherwise memory usage will climb\n * indefinitely)\n * @property {number} [messageCacheLifetime=0] How long a message should stay in the cache until it is considered\n * sweepable (in seconds, 0 for forever)\n * @property {number} [messageSweepInterval=0] How frequently to remove messages from the cache that are older than\n * the message cache lifetime (in seconds, 0 for never)\n * @property {boolean} [fetchAllMembers=false] Whether to cache all guild members and users upon startup, as well as\n * upon joining a guild (should be avoided whenever possible)\n * @property {boolean} [disableEveryone=false] Default value for {@link MessageOptions#disableEveryone}\n * @property {boolean} [sync=false] Whether to periodically sync guilds (for user accounts)\n * @property {number} [restWsBridgeTimeout=5000] Maximum time permitted between REST responses and their\n * corresponding websocket events\n * @property {number} [restTimeOffset=500] Extra time in millseconds to wait before continuing to make REST\n * requests (higher values will reduce rate-limiting errors on bad connections)\n * @property {number} [retryLimit=Infinity] How many times to retry on 5XX errors\n * (Infinity for indefinite amount of retries)\n * @property {WSEventType[]} [disabledEvents] An array of disabled websocket events. Events in this array will not be\n * processed, potentially resulting in performance improvements for larger bots. Only disable events you are\n * 100% certain you don't need, as many are important, but not obviously so. The safest one to disable with the\n * most impact is typically `TYPING_START`.\n * @property {WebsocketOptions} [ws] Options for the WebSocket\n * @property {HTTPOptions} [http] HTTP options\n */\nexports.DefaultOptions = {\n apiRequestMethod: 'sequential',\n shardId: 0,\n shardCount: 0,\n messageCacheMaxSize: 200,\n messageCacheLifetime: 0,\n messageSweepInterval: 0,\n fetchAllMembers: false,\n disableEveryone: false,\n sync: false,\n restWsBridgeTimeout: 5000,\n retryLimit: Infinity,\n disabledEvents: [],\n restTimeOffset: 500,\n\n /**\n * WebSocket options (these are left as snake_case to match the API)\n * @typedef {Object} WebsocketOptions\n * @property {number} [large_threshold=250] Number of members in a guild to be considered large\n * @property {boolean} [compress=true] Whether to compress data sent on the connection\n * (defaults to `false` for browsers)\n */\n ws: {\n large_threshold: 250,\n compress: __webpack_require__(/*! os */ \"./node_modules/os-browserify/browser.js\").platform() !== 'browser',\n properties: {\n $os: process ? process.platform : 'discord.js',\n $browser: 'discord.js',\n $device: 'discord.js',\n $referrer: '',\n $referring_domain: '',\n },\n version: 6,\n },\n\n /**\n * HTTP options\n * @typedef {Object} HTTPOptions\n * @property {number} [version=7] API version to use\n * @property {string} [api='https://discordapp.com/api'] Base url of the API\n * @property {string} [cdn='https://cdn.discordapp.com'] Base url of the CDN\n * @property {string} [invite='https://discord.gg'] Base url of invites\n */\n http: {\n version: 7,\n host: 'https://discordapp.com',\n cdn: 'https://cdn.discordapp.com',\n },\n};\n\nexports.WSCodes = {\n 1000: 'Connection gracefully closed',\n 4004: 'Tried to identify with an invalid token',\n 4010: 'Sharding data provided was invalid',\n 4011: 'Shard would be on too many guilds if connected',\n};\n\nexports.Errors = {\n NO_TOKEN: 'Request to use token, but token was unavailable to the client.',\n NO_BOT_ACCOUNT: 'Only bot accounts are able to make use of this feature.',\n NO_USER_ACCOUNT: 'Only user accounts are able to make use of this feature.',\n BAD_WS_MESSAGE: 'A bad message was received from the websocket; either bad compression, or not JSON.',\n TOOK_TOO_LONG: 'Something took too long to do.',\n NOT_A_PERMISSION: 'Invalid permission string or number.',\n INVALID_RATE_LIMIT_METHOD: 'Unknown rate limiting method.',\n BAD_LOGIN: 'Incorrect login details were provided.',\n INVALID_SHARD: 'Invalid shard settings were provided.',\n SHARDING_REQUIRED: 'This session would have handled too many guilds - Sharding is required.',\n INVALID_TOKEN: 'An invalid token was provided.',\n};\n\nconst Endpoints = exports.Endpoints = {\n User: userID => {\n if (userID.id) userID = userID.id;\n const base = `/users/${userID}`;\n return {\n toString: () => base,\n channels: `${base}/channels`,\n profile: `${base}/profile`,\n relationships: `${base}/relationships`,\n settings: `${base}/settings`,\n Relationship: uID => `${base}/relationships/${uID}`,\n Guild: guildID => ({\n toString: () => `${base}/guilds/${guildID}`,\n settings: `${base}/guilds/${guildID}/settings`,\n }),\n Note: id => `${base}/notes/${id}`,\n Mentions: (limit, roles, everyone, guildID) =>\n `${base}/mentions?limit=${limit}&roles=${roles}&everyone=${everyone}${guildID ? `&guild_id=${guildID}` : ''}`,\n Avatar: (root, hash) => {\n if (userID === '1') return hash;\n return Endpoints.CDN(root).Avatar(userID, hash);\n },\n };\n },\n guilds: '/guilds',\n Guild: guildID => {\n if (guildID.id) guildID = guildID.id;\n const base = `/guilds/${guildID}`;\n return {\n toString: () => base,\n prune: `${base}/prune`,\n embed: `${base}/embed`,\n bans: `${base}/bans`,\n integrations: `${base}/integrations`,\n members: `${base}/members`,\n channels: `${base}/channels`,\n invites: `${base}/invites`,\n roles: `${base}/roles`,\n emojis: `${base}/emojis`,\n search: `${base}/messages/search`,\n vanityURL: `${base}/vanity-url`,\n voiceRegions: `${base}/regions`,\n webhooks: `${base}/webhooks`,\n ack: `${base}/ack`,\n settings: `${base}/settings`,\n auditLogs: `${base}/audit-logs`,\n Emoji: emojiID => `${base}/emojis/${emojiID}`,\n Icon: (root, hash) => Endpoints.CDN(root).Icon(guildID, hash),\n Banner: (root, hash) => Endpoints.CDN(root).Banner(guildID, hash),\n Splash: (root, hash) => Endpoints.CDN(root).Splash(guildID, hash),\n Role: roleID => `${base}/roles/${roleID}`,\n Member: memberID => {\n if (memberID.id) memberID = memberID.id;\n const mbase = `${base}/members/${memberID}`;\n return {\n toString: () => mbase,\n Role: roleID => `${mbase}/roles/${roleID}`,\n nickname: `${base}/members/@me/nick`,\n };\n },\n Integration: id => `${base}/integrations/${id}`,\n };\n },\n channels: '/channels',\n Channel: channelID => {\n if (channelID.id) channelID = channelID.id;\n const base = `/channels/${channelID}`;\n return {\n toString: () => base,\n messages: {\n toString: () => `${base}/messages`,\n bulkDelete: `${base}/messages/bulk-delete`,\n },\n invites: `${base}/invites`,\n typing: `${base}/typing`,\n permissions: `${base}/permissions`,\n webhooks: `${base}/webhooks`,\n search: `${base}/messages/search`,\n pins: `${base}/pins`,\n Icon: (root, hash) => Endpoints.CDN(root).GDMIcon(channelID, hash),\n Pin: messageID => `${base}/pins/${messageID}`,\n Recipient: recipientID => `${base}/recipients/${recipientID}`,\n Message: messageID => {\n if (messageID.id) messageID = messageID.id;\n const mbase = `${base}/messages/${messageID}`;\n return {\n toString: () => mbase,\n reactions: `${mbase}/reactions`,\n ack: `${mbase}/ack`,\n Reaction: emoji => {\n const rbase = `${mbase}/reactions/${emoji}`;\n return {\n toString: () => rbase,\n User: userID => `${rbase}/${userID}`,\n };\n },\n };\n },\n };\n },\n Message: m => exports.Endpoints.Channel(m.channel).Message(m),\n Member: m => exports.Endpoints.Guild(m.guild).Member(m),\n CDN(root) {\n return {\n Emoji: (emojiID, format = 'png') => `${root}/emojis/${emojiID}.${format}`,\n Asset: name => `${root}/assets/${name}`,\n Avatar: (userID, hash) => `${root}/avatars/${userID}/${hash}.${hash.startsWith('a_') ? 'gif' : 'png?size=2048'}`,\n Icon: (guildID, hash) => `${root}/icons/${guildID}/${hash}.jpg`,\n Banner: (guildID, hash) => `${root}/banners/${guildID}/${hash}.jpg`,\n AppIcon: (clientID, hash) => `${root}/app-icons/${clientID}/${hash}.png`,\n AppAsset: (clientID, hash) => `${root}/app-assets/${clientID}/${hash}.png`,\n GDMIcon: (channelID, hash) => `${root}/channel-icons/${channelID}/${hash}.jpg?size=2048`,\n Splash: (guildID, hash) => `${root}/splashes/${guildID}/${hash}.jpg`,\n TeamIcon: (teamID, hash) => `${root}/team-icons/${teamID}/${hash}.jpg`,\n };\n },\n OAUTH2: {\n Application: appID => {\n const base = `/oauth2/applications/${appID}`;\n return {\n toString: () => base,\n resetSecret: `${base}/reset`,\n resetToken: `${base}/bot/reset`,\n };\n },\n App: appID => `/oauth2/authorize?client_id=${appID}`,\n },\n login: '/auth/login',\n logout: '/auth/logout',\n voiceRegions: '/voice/regions',\n gateway: {\n toString: () => '/gateway',\n bot: '/gateway/bot',\n },\n Invite: inviteID => `/invite/${inviteID}?with_counts=true`,\n inviteLink: id => `https://discord.gg/${id}`,\n Webhook: (webhookID, token) => `/webhooks/${webhookID}${token ? `/${token}` : ''}`,\n};\n\n\n/**\n * The current status of the client. Here are the available statuses:\n * * READY: 0\n * * CONNECTING: 1\n * * RECONNECTING: 2\n * * IDLE: 3\n * * NEARLY: 4\n * * DISCONNECTED: 5\n * @typedef {number} Status\n */\nexports.Status = {\n READY: 0,\n CONNECTING: 1,\n RECONNECTING: 2,\n IDLE: 3,\n NEARLY: 4,\n DISCONNECTED: 5,\n};\n\n/**\n * The current status of a voice connection. Here are the available statuses:\n * * CONNECTED: 0\n * * CONNECTING: 1\n * * AUTHENTICATING: 2\n * * RECONNECTING: 3\n * * DISCONNECTED: 4\n * @typedef {number} VoiceStatus\n */\nexports.VoiceStatus = {\n CONNECTED: 0,\n CONNECTING: 1,\n AUTHENTICATING: 2,\n RECONNECTING: 3,\n DISCONNECTED: 4,\n};\n\nexports.ChannelTypes = {\n TEXT: 0,\n DM: 1,\n VOICE: 2,\n GROUP_DM: 3,\n CATEGORY: 4,\n NEWS: 5,\n STORE: 6,\n};\n\nexports.OPCodes = {\n DISPATCH: 0,\n HEARTBEAT: 1,\n IDENTIFY: 2,\n STATUS_UPDATE: 3,\n VOICE_STATE_UPDATE: 4,\n VOICE_GUILD_PING: 5,\n RESUME: 6,\n RECONNECT: 7,\n REQUEST_GUILD_MEMBERS: 8,\n INVALID_SESSION: 9,\n HELLO: 10,\n HEARTBEAT_ACK: 11,\n};\n\nexports.VoiceOPCodes = {\n IDENTIFY: 0,\n SELECT_PROTOCOL: 1,\n READY: 2,\n HEARTBEAT: 3,\n SESSION_DESCRIPTION: 4,\n SPEAKING: 5,\n};\n\nexports.Events = {\n RATE_LIMIT: 'rateLimit',\n READY: 'ready',\n RESUME: 'resume',\n GUILD_CREATE: 'guildCreate',\n GUILD_DELETE: 'guildDelete',\n GUILD_UPDATE: 'guildUpdate',\n GUILD_UNAVAILABLE: 'guildUnavailable',\n GUILD_AVAILABLE: 'guildAvailable',\n GUILD_MEMBER_ADD: 'guildMemberAdd',\n GUILD_MEMBER_REMOVE: 'guildMemberRemove',\n GUILD_MEMBER_UPDATE: 'guildMemberUpdate',\n GUILD_MEMBER_AVAILABLE: 'guildMemberAvailable',\n GUILD_MEMBER_SPEAKING: 'guildMemberSpeaking',\n GUILD_MEMBERS_CHUNK: 'guildMembersChunk',\n GUILD_INTEGRATIONS_UPDATE: 'guildIntegrationsUpdate',\n GUILD_ROLE_CREATE: 'roleCreate',\n GUILD_ROLE_DELETE: 'roleDelete',\n GUILD_ROLE_UPDATE: 'roleUpdate',\n GUILD_EMOJI_CREATE: 'emojiCreate',\n GUILD_EMOJI_DELETE: 'emojiDelete',\n GUILD_EMOJI_UPDATE: 'emojiUpdate',\n GUILD_BAN_ADD: 'guildBanAdd',\n GUILD_BAN_REMOVE: 'guildBanRemove',\n INVITE_CREATE: 'inviteCreate',\n INVITE_DELETE: 'inviteDelete',\n CHANNEL_CREATE: 'channelCreate',\n CHANNEL_DELETE: 'channelDelete',\n CHANNEL_UPDATE: 'channelUpdate',\n CHANNEL_PINS_UPDATE: 'channelPinsUpdate',\n MESSAGE_CREATE: 'message',\n MESSAGE_DELETE: 'messageDelete',\n MESSAGE_UPDATE: 'messageUpdate',\n MESSAGE_BULK_DELETE: 'messageDeleteBulk',\n MESSAGE_REACTION_ADD: 'messageReactionAdd',\n MESSAGE_REACTION_REMOVE: 'messageReactionRemove',\n MESSAGE_REACTION_REMOVE_EMOJI: 'messageReactionRemoveEmoji',\n MESSAGE_REACTION_REMOVE_ALL: 'messageReactionRemoveAll',\n USER_UPDATE: 'userUpdate',\n USER_NOTE_UPDATE: 'userNoteUpdate',\n USER_SETTINGS_UPDATE: 'clientUserSettingsUpdate',\n USER_GUILD_SETTINGS_UPDATE: 'clientUserGuildSettingsUpdate',\n PRESENCE_UPDATE: 'presenceUpdate',\n VOICE_STATE_UPDATE: 'voiceStateUpdate',\n TYPING_START: 'typingStart',\n TYPING_STOP: 'typingStop',\n WEBHOOKS_UPDATE: 'webhookUpdate',\n DISCONNECT: 'disconnect',\n RECONNECTING: 'reconnecting',\n ERROR: 'error',\n WARN: 'warn',\n DEBUG: 'debug',\n};\n\n/**\n * Bots cannot set a `CUSTOM_STATUS`, it is only for custom statuses received from users\n * The type of an activity of a users presence, e.g. `PLAYING`. Here are the available types:\n * * PLAYING\n * * STREAMING\n * * LISTENING\n * * WATCHING\n * * CUSTOM_STATUS\n * @typedef {string} ActivityType\n */\nexports.ActivityTypes = [\n 'PLAYING',\n 'STREAMING',\n 'LISTENING',\n 'WATCHING',\n 'CUSTOM_STATUS',\n];\n\n/**\n * Numeric activity flags. All available properties:\n * * `INSTANCE`\n * * `JOIN`\n * * `SPECTATE`\n * * `JOIN_REQUEST`\n * * `SYNC`\n * * `PLAY`\n * @typedef {string} ActivityFlag\n * @see {@link https://discordapp.com/developers/docs/topics/gateway#activity-object-activity-flags}\n */\nexports.ActivityFlags = {\n INSTANCE: 1 << 0,\n JOIN: 1 << 1,\n SPECTATE: 1 << 2,\n JOIN_REQUEST: 1 << 3,\n SYNC: 1 << 4,\n PLAY: 1 << 5,\n};\n\n/**\n * The type of a websocket message event, e.g. `MESSAGE_CREATE`. Here are the available events:\n * * READY\n * * RESUMED\n * * GUILD_SYNC\n * * GUILD_CREATE\n * * GUILD_DELETE\n * * GUILD_UPDATE\n * * GUILD_MEMBER_ADD\n * * GUILD_MEMBER_REMOVE\n * * GUILD_MEMBER_UPDATE\n * * GUILD_MEMBERS_CHUNK\n * * GUILD_INTEGRATIONS_UPDATE\n * * GUILD_ROLE_CREATE\n * * GUILD_ROLE_DELETE\n * * GUILD_ROLE_UPDATE\n * * GUILD_BAN_ADD\n * * GUILD_BAN_REMOVE\n * * CHANNEL_CREATE\n * * CHANNEL_DELETE\n * * CHANNEL_UPDATE\n * * CHANNEL_PINS_UPDATE\n * * MESSAGE_CREATE\n * * MESSAGE_DELETE\n * * MESSAGE_UPDATE\n * * MESSAGE_DELETE_BULK\n * * MESSAGE_REACTION_ADD\n * * MESSAGE_REACTION_REMOVE\n * * MESSAGE_REACTION_REMOVE_EMOJI\n * * MESSAGE_REACTION_REMOVE_ALL\n * * USER_UPDATE\n * * USER_NOTE_UPDATE\n * * USER_SETTINGS_UPDATE\n * * PRESENCE_UPDATE\n * * VOICE_STATE_UPDATE\n * * TYPING_START\n * * VOICE_SERVER_UPDATE\n * * RELATIONSHIP_ADD\n * * RELATIONSHIP_REMOVE\n * * WEBHOOKS_UPDATE\n * @typedef {string} WSEventType\n */\nexports.WSEvents = {\n READY: 'READY',\n RESUMED: 'RESUMED',\n GUILD_SYNC: 'GUILD_SYNC',\n GUILD_CREATE: 'GUILD_CREATE',\n GUILD_DELETE: 'GUILD_DELETE',\n GUILD_UPDATE: 'GUILD_UPDATE',\n GUILD_MEMBER_ADD: 'GUILD_MEMBER_ADD',\n GUILD_MEMBER_REMOVE: 'GUILD_MEMBER_REMOVE',\n GUILD_MEMBER_UPDATE: 'GUILD_MEMBER_UPDATE',\n GUILD_MEMBERS_CHUNK: 'GUILD_MEMBERS_CHUNK',\n GUILD_INTEGRATIONS_UPDATE: 'GUILD_INTEGRATIONS_UPDATE',\n GUILD_ROLE_CREATE: 'GUILD_ROLE_CREATE',\n GUILD_ROLE_DELETE: 'GUILD_ROLE_DELETE',\n GUILD_ROLE_UPDATE: 'GUILD_ROLE_UPDATE',\n GUILD_BAN_ADD: 'GUILD_BAN_ADD',\n GUILD_BAN_REMOVE: 'GUILD_BAN_REMOVE',\n GUILD_EMOJIS_UPDATE: 'GUILD_EMOJIS_UPDATE',\n INVITE_CREATE: 'INVITE_CREATE',\n INVITE_DELETE: 'INVITE_DELETE',\n CHANNEL_CREATE: 'CHANNEL_CREATE',\n CHANNEL_DELETE: 'CHANNEL_DELETE',\n CHANNEL_UPDATE: 'CHANNEL_UPDATE',\n CHANNEL_PINS_UPDATE: 'CHANNEL_PINS_UPDATE',\n MESSAGE_CREATE: 'MESSAGE_CREATE',\n MESSAGE_DELETE: 'MESSAGE_DELETE',\n MESSAGE_UPDATE: 'MESSAGE_UPDATE',\n MESSAGE_DELETE_BULK: 'MESSAGE_DELETE_BULK',\n MESSAGE_REACTION_ADD: 'MESSAGE_REACTION_ADD',\n MESSAGE_REACTION_REMOVE: 'MESSAGE_REACTION_REMOVE',\n MESSAGE_REACTION_RMEOVE_EMOJI: 'MESSAGE_REACTION_REMOVE_EMOJI',\n MESSAGE_REACTION_REMOVE_ALL: 'MESSAGE_REACTION_REMOVE_ALL',\n USER_UPDATE: 'USER_UPDATE',\n USER_NOTE_UPDATE: 'USER_NOTE_UPDATE',\n USER_SETTINGS_UPDATE: 'USER_SETTINGS_UPDATE',\n USER_GUILD_SETTINGS_UPDATE: 'USER_GUILD_SETTINGS_UPDATE',\n PRESENCE_UPDATE: 'PRESENCE_UPDATE',\n VOICE_STATE_UPDATE: 'VOICE_STATE_UPDATE',\n TYPING_START: 'TYPING_START',\n VOICE_SERVER_UPDATE: 'VOICE_SERVER_UPDATE',\n RELATIONSHIP_ADD: 'RELATIONSHIP_ADD',\n RELATIONSHIP_REMOVE: 'RELATIONSHIP_REMOVE',\n WEBHOOKS_UPDATE: 'WEBHOOKS_UPDATE',\n};\n\n/**\n * The type of a message, e.g. `DEFAULT`. Here are the available types:\n * * DEFAULT\n * * RECIPIENT_ADD\n * * RECIPIENT_REMOVE\n * * CALL\n * * CHANNEL_NAME_CHANGE\n * * CHANNEL_ICON_CHANGE\n * * PINS_ADD\n * * GUILD_MEMBER_JOIN\n * * USER_PREMIUM_GUILD_SUBSCRIPTION\n * * USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_1\n * * USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_2\n * * USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_3\n * * CHANNEL_FOLLOW_ADD\n * * GUILD_DISCOVERY_DISQUALIFIED\n * * GUILD_DISCOVERY_REQUALIFIED\n * @typedef {string} MessageType\n */\nexports.MessageTypes = [\n 'DEFAULT',\n 'RECIPIENT_ADD',\n 'RECIPIENT_REMOVE',\n 'CALL',\n 'CHANNEL_NAME_CHANGE',\n 'CHANNEL_ICON_CHANGE',\n 'PINS_ADD',\n 'GUILD_MEMBER_JOIN',\n 'USER_PREMIUM_GUILD_SUBSCRIPTION',\n 'USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_1',\n 'USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_2',\n 'USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_3',\n 'CHANNEL_FOLLOW_ADD',\n // 13 isn't yet documented\n null,\n 'GUILD_DISCOVERY_DISQUALIFIED',\n 'GUILD_DISCOVERY_REQUALIFIED',\n];\n\n/**\n * The type of a message notification setting. Here are the available types:\n * * EVERYTHING\n * * MENTIONS\n * * NOTHING\n * * INHERIT (only for GuildChannel)\n * @typedef {string} MessageNotificationType\n */\nexports.MessageNotificationTypes = [\n 'EVERYTHING',\n 'MENTIONS',\n 'NOTHING',\n 'INHERIT',\n];\n\nexports.DefaultAvatars = {\n BLURPLE: '6debd47ed13483642cf09e832ed0bc1b',\n GREY: '322c936a8c8be1b803cd94861bdfa868',\n GREEN: 'dd4dbc0016779df1378e7812eabaa04d',\n ORANGE: '0e291f67c9274a1abdddeb3fd919cbaa',\n RED: '1cbd08c76f8af6dddce02c5138971129',\n};\n\nexports.ExplicitContentFilterTypes = [\n 'DISABLED',\n 'NON_FRIENDS',\n 'FRIENDS_AND_NON_FRIENDS',\n];\n\nexports.UserSettingsMap = {\n /**\n * Automatically convert emoticons in your messages to emoji\n * For example, when you type `:-)` Discord will convert it to 😃\n * @name ClientUserSettings#convertEmoticons\n * @type {boolean}\n */\n convert_emoticons: 'convertEmoticons',\n\n /**\n * If new guilds should automatically disable DMs between you and its members\n * @name ClientUserSettings#defaultGuildsRestricted\n * @type {boolean}\n */\n default_guilds_restricted: 'defaultGuildsRestricted',\n\n /**\n * Automatically detect accounts from services like Steam and Blizzard when you open the Discord client\n * @name ClientUserSettings#detectPlatformAccounts\n * @type {boolean}\n */\n detect_platform_accounts: 'detectPlatformAccounts',\n\n /**\n * Developer Mode exposes context menu items helpful for people writing bots using the Discord API\n * @name ClientUserSettings#developerMode\n * @type {boolean}\n */\n developer_mode: 'developerMode',\n\n /**\n * Allow playback and usage of the `/tts` command\n * @name ClientUserSettings#enableTTSCommand\n * @type {boolean}\n */\n enable_tts_command: 'enableTTSCommand',\n\n /**\n * The theme of the client. Either `light` or `dark`\n * @name ClientUserSettings#theme\n * @type {string}\n */\n theme: 'theme',\n\n /**\n * Last status set in the client\n * @name ClientUserSettings#status\n * @type {PresenceStatus}\n */\n status: 'status',\n\n /**\n * Display currently running game as status message\n * @name ClientUserSettings#showCurrentGame\n * @type {boolean}\n */\n show_current_game: 'showCurrentGame',\n\n /**\n * Display images, videos, and lolcats when uploaded directly to Discord\n * @name ClientUserSettings#inlineAttachmentMedia\n * @type {boolean}\n */\n inline_attachment_media: 'inlineAttachmentMedia',\n\n /**\n * Display images, videos, and lolcats when uploaded posted as links in chat\n * @name ClientUserSettings#inlineEmbedMedia\n * @type {boolean}\n */\n inline_embed_media: 'inlineEmbedMedia',\n\n /**\n * Language the Discord client will use, as an RFC 3066 language identifier\n * @name ClientUserSettings#locale\n * @type {string}\n */\n locale: 'locale',\n\n /**\n * Display messages in compact mode\n * @name ClientUserSettings#messageDisplayCompact\n * @type {boolean}\n */\n message_display_compact: 'messageDisplayCompact',\n\n /**\n * Show emoji reactions on messages\n * @name ClientUserSettings#renderReactions\n * @type {boolean}\n */\n render_reactions: 'renderReactions',\n\n /**\n * Array of snowflake IDs for guilds, in the order they appear in the Discord client\n * @name ClientUserSettings#guildPositions\n * @type {Snowflake[]}\n */\n guild_positions: 'guildPositions',\n\n /**\n * Array of snowflake IDs for guilds which you will not recieve DMs from\n * @name ClientUserSettings#restrictedGuilds\n * @type {Snowflake[]}\n */\n restricted_guilds: 'restrictedGuilds',\n\n explicit_content_filter: function explicitContentFilter(type) { // eslint-disable-line func-name-matching\n /**\n * Safe direct messaging; force people's messages with images to be scanned before they are sent to you.\n * One of `DISABLED`, `NON_FRIENDS`, `FRIENDS_AND_NON_FRIENDS`\n * @name ClientUserSettings#explicitContentFilter\n * @type {string}\n */\n return exports.ExplicitContentFilterTypes[type];\n },\n friend_source_flags: function friendSources(flags) { // eslint-disable-line func-name-matching\n /**\n * Who can add you as a friend\n * @name ClientUserSettings#friendSources\n * @type {Object}\n * @property {boolean} all Mutual friends and mutual guilds\n * @property {boolean} mutualGuilds Only mutual guilds\n * @property {boolean} mutualFriends Only mutual friends\n */\n return {\n all: flags.all || false,\n mutualGuilds: flags.all ? true : flags.mutual_guilds || false,\n mutualFriends: flags.all ? true : flags.mutualFriends || false,\n };\n },\n};\n\nexports.UserGuildSettingsMap = {\n message_notifications: function messageNotifications(type) { // eslint-disable-line func-name-matching\n /**\n * The type of message that should notify you\n * @name ClientUserGuildSettings#messageNotifications\n * @type {MessageNotificationType}\n */\n return exports.MessageNotificationTypes[type];\n },\n /**\n * Whether to receive mobile push notifications\n * @name ClientUserGuildSettings#mobilePush\n * @type {boolean}\n */\n mobile_push: 'mobilePush',\n /**\n * Whether the guild is muted\n * @name ClientUserGuildSettings#muted\n * @type {boolean}\n */\n muted: 'muted',\n /**\n * Whether to suppress everyone mention\n * @name ClientUserGuildSettings#suppressEveryone\n * @type {boolean}\n */\n suppress_everyone: 'suppressEveryone',\n /**\n * A collection containing all the channel overrides\n * @name ClientUserGuildSettings#channelOverrides\n * @type {Collection}\n */\n channel_overrides: 'channelOverrides',\n};\n\nexports.UserChannelOverrideMap = {\n message_notifications: function messageNotifications(type) { // eslint-disable-line func-name-matching\n /**\n * The type of message that should notify you\n * @name ClientUserChannelOverride#messageNotifications\n * @type {MessageNotificationType}\n */\n return exports.MessageNotificationTypes[type];\n },\n /**\n * Whether the channel is muted\n * @name ClientUserChannelOverride#muted\n * @type {boolean}\n */\n muted: 'muted',\n};\n\nexports.Colors = {\n DEFAULT: 0x000000,\n WHITE: 0xFFFFFF,\n AQUA: 0x1ABC9C,\n GREEN: 0x2ECC71,\n BLUE: 0x3498DB,\n PURPLE: 0x9B59B6,\n LUMINOUS_VIVID_PINK: 0xE91E63,\n GOLD: 0xF1C40F,\n ORANGE: 0xE67E22,\n RED: 0xE74C3C,\n GREY: 0x95A5A6,\n NAVY: 0x34495E,\n DARK_AQUA: 0x11806A,\n DARK_GREEN: 0x1F8B4C,\n DARK_BLUE: 0x206694,\n DARK_PURPLE: 0x71368A,\n DARK_VIVID_PINK: 0xAD1457,\n DARK_GOLD: 0xC27C0E,\n DARK_ORANGE: 0xA84300,\n DARK_RED: 0x992D22,\n DARK_GREY: 0x979C9F,\n DARKER_GREY: 0x7F8C8D,\n LIGHT_GREY: 0xBCC0C0,\n DARK_NAVY: 0x2C3E50,\n BLURPLE: 0x7289DA,\n GREYPLE: 0x99AAB5,\n DARK_BUT_NOT_BLACK: 0x2C2F33,\n NOT_QUITE_BLACK: 0x23272A,\n};\n\n/**\n * The value set for the verification levels for a guild:\n * * None\n * * Low\n * * Medium\n * * (╯°□°)╯︵ ┻━┻\n * * ┻━┻ ミヽ(ಠ益ಠ)ノ彡┻━┻\n * @typedef {string} VerificationLevel\n */\nexports.VerificationLevels = [\n 'None',\n 'Low',\n 'Medium',\n '(╯°□°)╯︵ ┻━┻',\n '┻━┻ ミヽ(ಠ益ಠ)ノ彡┻━┻',\n];\n\n/**\n * An error encountered while performing an API request. Here are the potential errors:\n * * UNKNOWN_ACCOUNT\n * * UNKNOWN_APPLICATION\n * * UNKNOWN_CHANNEL\n * * UNKNOWN_GUILD\n * * UNKNOWN_INTEGRATION\n * * UNKNOWN_INVITE\n * * UNKNOWN_MEMBER\n * * UNKNOWN_MESSAGE\n * * UNKNOWN_OVERWRITE\n * * UNKNOWN_PROVIDER\n * * UNKNOWN_ROLE\n * * UNKNOWN_TOKEN\n * * UNKNOWN_USER\n * * UNKNOWN_EMOJI\n * * UNKNOWN_WEBHOOK\n * * BOT_PROHIBITED_ENDPOINT\n * * BOT_ONLY_ENDPOINT\n * * MAXIMUM_GUILDS\n * * MAXIMUM_FRIENDS\n * * MAXIMUM_PINS\n * * MAXIMUM_ROLES\n * * MAXIMUM_REACTIONS\n * * MAXIMUM_CHANNELS\n * * MAXIMUM_INVITES\n * * UNAUTHORIZED\n * * USER_BANNED\n * * MISSING_ACCESS\n * * INVALID_ACCOUNT_TYPE\n * * CANNOT_EXECUTE_ON_DM\n * * EMBED_DISABLED\n * * CANNOT_EDIT_MESSAGE_BY_OTHER\n * * CANNOT_SEND_EMPTY_MESSAGE\n * * CANNOT_MESSAGE_USER\n * * CANNOT_SEND_MESSAGES_IN_VOICE_CHANNEL\n * * CHANNEL_VERIFICATION_LEVEL_TOO_HIGH\n * * OAUTH2_APPLICATION_BOT_ABSENT\n * * MAXIMUM_OAUTH2_APPLICATIONS\n * * INVALID_OAUTH_STATE\n * * MISSING_PERMISSIONS\n * * INVALID_AUTHENTICATION_TOKEN\n * * NOTE_TOO_LONG\n * * INVALID_BULK_DELETE_QUANTITY\n * * CANNOT_PIN_MESSAGE_IN_OTHER_CHANNEL\n * * INVALID_OR_TAKEN_INVITE_CODE\n * * CANNOT_EXECUTE_ON_SYSTEM_MESSAGE\n * * INVALID_OAUTH_TOKEN\n * * BULK_DELETE_MESSAGE_TOO_OLD\n * * INVALID_FORM_BODY\n * * INVITE_ACCEPTED_TO_GUILD_NOT_CONTAINING_BOT\n * * INVALID_API_VERSION\n * * REACTION_BLOCKED\n * * RESOURCE_OVERLOADED\n * @typedef {string} APIError\n */\nexports.APIErrors = {\n UNKNOWN_ACCOUNT: 10001,\n UNKNOWN_APPLICATION: 10002,\n UNKNOWN_CHANNEL: 10003,\n UNKNOWN_GUILD: 10004,\n UNKNOWN_INTEGRATION: 10005,\n UNKNOWN_INVITE: 10006,\n UNKNOWN_MEMBER: 10007,\n UNKNOWN_MESSAGE: 10008,\n UNKNOWN_OVERWRITE: 10009,\n UNKNOWN_PROVIDER: 10010,\n UNKNOWN_ROLE: 10011,\n UNKNOWN_TOKEN: 10012,\n UNKNOWN_USER: 10013,\n UNKNOWN_EMOJI: 10014,\n UNKNOWN_WEBHOOK: 10015,\n BOT_PROHIBITED_ENDPOINT: 20001,\n BOT_ONLY_ENDPOINT: 20002,\n MAXIMUM_GUILDS: 30001,\n MAXIMUM_FRIENDS: 30002,\n MAXIMUM_PINS: 30003,\n MAXIMUM_ROLES: 30005,\n MAXIMUM_REACTIONS: 30010,\n MAXIMUM_CHANNELS: 30013,\n MAXIMUM_INVITES: 30016,\n UNAUTHORIZED: 40001,\n USER_BANNED: 40007,\n MISSING_ACCESS: 50001,\n INVALID_ACCOUNT_TYPE: 50002,\n CANNOT_EXECUTE_ON_DM: 50003,\n EMBED_DISABLED: 50004,\n CANNOT_EDIT_MESSAGE_BY_OTHER: 50005,\n CANNOT_SEND_EMPTY_MESSAGE: 50006,\n CANNOT_MESSAGE_USER: 50007,\n CANNOT_SEND_MESSAGES_IN_VOICE_CHANNEL: 50008,\n CHANNEL_VERIFICATION_LEVEL_TOO_HIGH: 50009,\n OAUTH2_APPLICATION_BOT_ABSENT: 50010,\n MAXIMUM_OAUTH2_APPLICATIONS: 50011,\n INVALID_OAUTH_STATE: 50012,\n MISSING_PERMISSIONS: 50013,\n INVALID_AUTHENTICATION_TOKEN: 50014,\n NOTE_TOO_LONG: 50015,\n INVALID_BULK_DELETE_QUANTITY: 50016,\n CANNOT_PIN_MESSAGE_IN_OTHER_CHANNEL: 50019,\n INVALID_OR_TAKEN_INVITE_CODE: 50020,\n CANNOT_EXECUTE_ON_SYSTEM_MESSAGE: 50021,\n INVALID_OAUTH_TOKEN: 50025,\n BULK_DELETE_MESSAGE_TOO_OLD: 50034,\n INVALID_FORM_BODY: 50035,\n INVITE_ACCEPTED_TO_GUILD_NOT_CONTAINING_BOT: 50036,\n INVALID_API_VERSION: 50041,\n REACTION_BLOCKED: 90001,\n RESOURCE_OVERLOADED: 130000,\n};\n\n/**\n * The value set for a guild's default message notifications, e.g. `ALL`. Here are the available types:\n * * ALL\n * * MENTIONS\n * @typedef {string} DefaultMessageNotifications\n */\nexports.DefaultMessageNotifications = [\n 'ALL',\n 'MENTIONS',\n];\n\n/**\n * The value set for a team members's membership state:\n * * INVITED\n * * ACCEPTED\n * @typedef {string} MembershipStates\n */\nexports.MembershipStates = [\n // They start at 1\n null,\n 'INVITED',\n 'ACCEPTED',\n];\n\n/**\n * The value set for a webhook's type:\n * * Incoming\n * * Channel Follower\n * @typedef {string} WebhookTypes\n */\nexports.WebhookTypes = [\n // They start at 1\n null,\n 'Incoming',\n 'Channel Follower',\n];\n\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../node_modules/process/browser.js */ \"./node_modules/process/browser.js\")))\n\n//# sourceURL=webpack:///./src/util/Constants.js?"); + +/***/ }), + +/***/ "./src/util/MessageFlags.js": +/*!**********************************!*\ + !*** ./src/util/MessageFlags.js ***! + \**********************************/ +/*! no static exports found */ +/*! ModuleConcatenation bailout: Module is not an ECMAScript module */ +/***/ (function(module, exports, __webpack_require__) { + +eval("const BitField = __webpack_require__(/*! ./BitField */ \"./src/util/BitField.js\");\n\n/**\n * Data structure that makes it easy to interact with an {@link Message#flags} bitfield.\n * @extends {BitField}\n */\nclass MessageFlags extends BitField {}\n\n/**\n * Data that can be resolved to give a permission number. This can be:\n * * A string (see {@link MessageFlags.FLAGS})\n * * A message flag\n * * An instance of MessageFlags\n * * An array of MessageFlagsResolvable\n * @typedef {string|number|MessageFlags|MessageFlagsResolvable[]} MessageFlagsResolvable\n */\n\n/**\n * Numeric message flags. All available properties:\n * * `CROSSPOSTED`\n * * `IS_CROSSPOST`\n * * `SUPPRESS_EMBEDS`\n * * `SOURCE_MESSAGE_DELETED`\n * * `URGENT`\n * @type {Object}\n * @see {@link https://discordapp.com/developers/docs/resources/channel#message-object-message-flags}\n */\nMessageFlags.FLAGS = {\n CROSSPOSTED: 1 << 0,\n IS_CROSSPOST: 1 << 1,\n SUPPRESS_EMBEDS: 1 << 2,\n SOURCE_MESSAGE_DELETED: 1 << 3,\n URGENT: 1 << 4,\n};\n\nmodule.exports = MessageFlags;\n\n\n//# sourceURL=webpack:///./src/util/MessageFlags.js?"); /***/ }), @@ -1949,7 +2082,7 @@ eval("/* WEBPACK VAR INJECTION */(function(process) {exports.Package = __webpack /*! ModuleConcatenation bailout: Module is not an ECMAScript module */ /***/ (function(module, exports, __webpack_require__) { -eval("const Constants = __webpack_require__(/*! ../util/Constants */ \"./src/util/Constants.js\");\nconst util = __webpack_require__(/*! util */ \"./node_modules/util/util.js\");\n\n/**\n * Data structure that makes it easy to interact with a permission bitfield. All {@link GuildMember}s have a set of\n * permissions in their guild, and each channel in the guild may also have {@link PermissionOverwrites} for the member\n * that override their default permissions.\n */\nclass Permissions {\n /**\n * @param {GuildMember} [member] Member the permissions are for **(deprecated)**\n * @param {number|PermissionResolvable} permissions Permissions or bitfield to read from\n */\n constructor(member, permissions) {\n permissions = typeof member === 'object' && !(member instanceof Array) ? permissions : member;\n\n /**\n * Member the permissions are for\n * @type {GuildMember}\n * @deprecated\n */\n this._member = typeof member === 'object' ? member : null;\n\n /**\n * Bitfield of the packed permissions\n * @type {number}\n */\n this.bitfield = typeof permissions === 'number' ? permissions : this.constructor.resolve(permissions);\n }\n\n get member() {\n return this._member;\n }\n\n set member(value) {\n this._member = value;\n }\n\n /**\n * Bitfield of the packed permissions\n * @type {number}\n * @see {@link Permissions#bitfield}\n * @deprecated\n * @readonly\n */\n get raw() {\n return this.bitfield;\n }\n\n set raw(raw) {\n this.bitfield = raw;\n }\n\n /**\n * Checks whether the bitfield has a permission, or multiple permissions.\n * @param {PermissionResolvable} permission Permission(s) to check for\n * @param {boolean} [checkAdmin=true] Whether to allow the administrator permission to override\n * @returns {boolean}\n */\n has(permission, checkAdmin = true) {\n if (permission instanceof Array) return permission.every(p => this.has(p, checkAdmin));\n permission = this.constructor.resolve(permission);\n if (checkAdmin && (this.bitfield & this.constructor.FLAGS.ADMINISTRATOR) > 0) return true;\n return (this.bitfield & permission) === permission;\n }\n\n /**\n * Gets all given permissions that are missing from the bitfield.\n * @param {PermissionResolvable} permissions Permissions to check for\n * @param {boolean} [checkAdmin=true] Whether to allow the administrator permission to override\n * @returns {PermissionResolvable}\n */\n missing(permissions, checkAdmin = true) {\n if (!(permissions instanceof Array)) permissions = [permissions];\n return permissions.filter(p => !this.has(p, checkAdmin));\n }\n\n /**\n * Adds permissions to this one, creating a new instance to represent the new bitfield.\n * @param {...PermissionResolvable} permissions Permissions to add\n * @returns {Permissions}\n */\n add(...permissions) {\n let total = 0;\n for (let p = permissions.length - 1; p >= 0; p--) {\n const perm = this.constructor.resolve(permissions[p]);\n total |= perm;\n }\n if (Object.isFrozen(this)) return new this.constructor(this.bitfield | total);\n this.bitfield |= total;\n return this;\n }\n\n /**\n * Removes permissions to this one, creating a new instance to represent the new bitfield.\n * @param {...PermissionResolvable} permissions Permissions to remove\n * @returns {Permissions}\n */\n remove(...permissions) {\n let total = 0;\n for (let p = permissions.length - 1; p >= 0; p--) {\n const perm = this.constructor.resolve(permissions[p]);\n total |= perm;\n }\n if (Object.isFrozen(this)) return new this.constructor(this.bitfield & ~total);\n this.bitfield &= ~total;\n return this;\n }\n\n /**\n * Gets an object mapping permission name (like `VIEW_CHANNEL`) to a {@link boolean} indicating whether the\n * permission is available.\n * @param {boolean} [checkAdmin=true] Whether to allow the administrator permission to override\n * @returns {Object}\n */\n serialize(checkAdmin = true) {\n const serialized = {};\n for (const perm in this.constructor.FLAGS) serialized[perm] = this.has(perm, checkAdmin);\n return serialized;\n }\n\n /**\n * Checks whether the user has a certain permission, e.g. `READ_MESSAGES`.\n * @param {PermissionResolvable} permission The permission to check for\n * @param {boolean} [explicit=false] Whether to require the user to explicitly have the exact permission\n * @returns {boolean}\n * @see {@link Permissions#has}\n * @deprecated\n */\n hasPermission(permission, explicit = false) {\n return this.has(permission, !explicit);\n }\n\n /**\n * Checks whether the user has all specified permissions.\n * @param {PermissionResolvable} permissions The permissions to check for\n * @param {boolean} [explicit=false] Whether to require the user to explicitly have the exact permissions\n * @returns {boolean}\n * @see {@link Permissions#has}\n * @deprecated\n */\n hasPermissions(permissions, explicit = false) {\n return this.has(permissions, !explicit);\n }\n\n /**\n * Checks whether the user has all specified permissions, and lists any missing permissions.\n * @param {PermissionResolvable} permissions The permissions to check for\n * @param {boolean} [explicit=false] Whether to require the user to explicitly have the exact permissions\n * @returns {PermissionResolvable}\n * @see {@link Permissions#missing}\n * @deprecated\n */\n missingPermissions(permissions, explicit = false) {\n return this.missing(permissions, !explicit);\n }\n\n /**\n * Gets an {@link Array} of permission names (such as `VIEW_CHANNEL`) based on the permissions available.\n * @param {boolean} [checkAdmin=true] Whether to allow the administrator permission to override\n * @returns {string[]}\n */\n toArray(checkAdmin = true) {\n return Object.keys(this.constructor.FLAGS).filter(perm => this.has(perm, checkAdmin));\n }\n\n /**\n * Freezes these permissions, making them immutable.\n * @returns {Permissions} These permissions\n */\n freeze() {\n return Object.freeze(this);\n }\n\n valueOf() {\n return this.bitfield;\n }\n\n /**\n * Data that can be resolved to give a permission number. This can be:\n * * A string (see {@link Permissions.FLAGS})\n * * A permission number\n * @typedef {string|number|Permissions|PermissionResolvable[]} PermissionResolvable\n */\n\n /**\n * Resolves permissions to their numeric form.\n * @param {PermissionResolvable} permission - Permission(s) to resolve\n * @returns {number}\n */\n static resolve(permission) {\n if (permission instanceof Array) return permission.map(p => this.resolve(p)).reduce((prev, p) => prev | p, 0);\n if (permission instanceof Permissions) return permission.bitfield;\n if (typeof permission === 'string') permission = this.FLAGS[permission];\n if (typeof permission !== 'number' || permission < 0) throw new RangeError(Constants.Errors.NOT_A_PERMISSION);\n return permission;\n }\n}\n\n/**\n * Numeric permission flags. All available properties:\n * - `ADMINISTRATOR` (implicitly has *all* permissions, and bypasses all channel overwrites)\n * - `CREATE_INSTANT_INVITE` (create invitations to the guild)\n * - `KICK_MEMBERS`\n * - `BAN_MEMBERS`\n * - `MANAGE_CHANNELS` (edit and reorder channels)\n * - `MANAGE_GUILD` (edit the guild information, region, etc.)\n * - `ADD_REACTIONS` (add new reactions to messages)\n * - `VIEW_AUDIT_LOG`\n * - `PRIORITY_SPEAKER`\n * - `VIEW_CHANNEL`\n * - `READ_MESSAGES` **(deprecated)**\n * - `SEND_MESSAGES`\n * - `SEND_TTS_MESSAGES`\n * - `MANAGE_MESSAGES` (delete messages and reactions)\n * - `EMBED_LINKS` (links posted will have a preview embedded)\n * - `ATTACH_FILES`\n * - `READ_MESSAGE_HISTORY` (view messages that were posted prior to opening Discord)\n * - `MENTION_EVERYONE`\n * - `USE_EXTERNAL_EMOJIS` (use emojis from different guilds)\n * - `EXTERNAL_EMOJIS` **(deprecated)**\n * - `CONNECT` (connect to a voice channel)\n * - `SPEAK` (speak in a voice channel)\n * - `MUTE_MEMBERS` (mute members across all voice channels)\n * - `DEAFEN_MEMBERS` (deafen members across all voice channels)\n * - `MOVE_MEMBERS` (move members between voice channels)\n * - `USE_VAD` (use voice activity detection)\n * - `CHANGE_NICKNAME`\n * - `MANAGE_NICKNAMES` (change other members' nicknames)\n * - `MANAGE_ROLES`\n * - `MANAGE_ROLES_OR_PERMISSIONS` **(deprecated)**\n * - `MANAGE_WEBHOOKS`\n * - `MANAGE_EMOJIS`\n * @type {Object}\n * @see {@link https://discordapp.com/developers/docs/topics/permissions}\n */\nPermissions.FLAGS = {\n CREATE_INSTANT_INVITE: 1 << 0,\n KICK_MEMBERS: 1 << 1,\n BAN_MEMBERS: 1 << 2,\n ADMINISTRATOR: 1 << 3,\n MANAGE_CHANNELS: 1 << 4,\n MANAGE_GUILD: 1 << 5,\n ADD_REACTIONS: 1 << 6,\n VIEW_AUDIT_LOG: 1 << 7,\n PRIORITY_SPEAKER: 1 << 8,\n\n VIEW_CHANNEL: 1 << 10,\n READ_MESSAGES: 1 << 10,\n SEND_MESSAGES: 1 << 11,\n SEND_TTS_MESSAGES: 1 << 12,\n MANAGE_MESSAGES: 1 << 13,\n EMBED_LINKS: 1 << 14,\n ATTACH_FILES: 1 << 15,\n READ_MESSAGE_HISTORY: 1 << 16,\n MENTION_EVERYONE: 1 << 17,\n EXTERNAL_EMOJIS: 1 << 18,\n USE_EXTERNAL_EMOJIS: 1 << 18,\n\n CONNECT: 1 << 20,\n SPEAK: 1 << 21,\n MUTE_MEMBERS: 1 << 22,\n DEAFEN_MEMBERS: 1 << 23,\n MOVE_MEMBERS: 1 << 24,\n USE_VAD: 1 << 25,\n\n CHANGE_NICKNAME: 1 << 26,\n MANAGE_NICKNAMES: 1 << 27,\n MANAGE_ROLES: 1 << 28,\n MANAGE_ROLES_OR_PERMISSIONS: 1 << 28,\n MANAGE_WEBHOOKS: 1 << 29,\n MANAGE_EMOJIS: 1 << 30,\n};\n\n/**\n * Bitfield representing every permission combined\n * @type {number}\n */\nPermissions.ALL = Object.keys(Permissions.FLAGS).reduce((all, p) => all | Permissions.FLAGS[p], 0);\n\n/**\n * Bitfield representing the default permissions for users\n * @type {number}\n */\nPermissions.DEFAULT = 104324097;\n\n/**\n * @class EvaluatedPermissions\n * @classdesc The final evaluated permissions for a member in a channel\n * @see {@link Permissions}\n * @deprecated\n */\n\nPermissions.prototype.hasPermission = util.deprecate(Permissions.prototype.hasPermission,\n 'EvaluatedPermissions#hasPermission is deprecated, use Permissions#has instead');\nPermissions.prototype.hasPermissions = util.deprecate(Permissions.prototype.hasPermissions,\n 'EvaluatedPermissions#hasPermissions is deprecated, use Permissions#has instead');\nPermissions.prototype.missingPermissions = util.deprecate(Permissions.prototype.missingPermissions,\n 'EvaluatedPermissions#missingPermissions is deprecated, use Permissions#missing instead');\nObject.defineProperty(Permissions.prototype, 'member', {\n get: util\n .deprecate(Object.getOwnPropertyDescriptor(Permissions.prototype, 'member').get,\n 'EvaluatedPermissions#member is deprecated'),\n});\n\nmodule.exports = Permissions;\n\n\n//# sourceURL=webpack:///./src/util/Permissions.js?"); +eval("const BitField = __webpack_require__(/*! ./BitField */ \"./src/util/BitField.js\");\nconst util = __webpack_require__(/*! util */ \"./node_modules/util/util.js\");\n\n/**\n * Data structure that makes it easy to interact with a permission bitfield. All {@link GuildMember}s have a set of\n * permissions in their guild, and each channel in the guild may also have {@link PermissionOverwrites} for the member\n * that override their default permissions.\n * @extends {BitField}\n */\nclass Permissions extends BitField {\n /**\n * @param {GuildMember} [member] Member the permissions are for **(deprecated)**\n * @param {number|PermissionResolvable} permissions Permissions or bitfield to read from\n */\n constructor(member, permissions) {\n super(typeof member === 'object' && !(member instanceof Array) ? permissions : member);\n\n Object.defineProperty(this, '_member', {\n writable: true,\n value: typeof member === 'object' && !(member instanceof Array) ? member : null,\n });\n }\n\n /**\n * Member the permissions are for\n * @type {GuildMember}\n * @deprecated\n */\n get member() {\n return this._member;\n }\n\n set member(value) {\n this._member = value;\n }\n\n /**\n * Bitfield of the packed permissions\n * @type {number}\n * @see {@link Permissions#bitfield}\n * @deprecated\n * @readonly\n */\n get raw() {\n return this.bitfield;\n }\n\n set raw(raw) {\n this.bitfield = raw;\n }\n\n /**\n * Checks whether the bitfield has a permission, or any of multiple permissions.\n * @param {PermissionResolvable} permission Permission(s) to check for\n * @param {boolean} [checkAdmin=true] Whether to allow the administrator permission to override\n * @returns {boolean}\n */\n any(permission, checkAdmin = true) {\n return (checkAdmin && super.has(this.constructor.FLAGS.ADMINISTRATOR)) || super.any(permission);\n }\n\n /**\n * Checks whether the bitfield has a permission, or multiple permissions.\n * @param {PermissionResolvable} permission Permission(s) to check for\n * @param {boolean} [checkAdmin=true] Whether to allow the administrator permission to override\n * @returns {boolean}\n */\n has(permission, checkAdmin = true) {\n return (checkAdmin && super.has(this.constructor.FLAGS.ADMINISTRATOR)) || super.has(permission);\n }\n\n /**\n * Checks whether the user has a certain permission, e.g. `READ_MESSAGES`.\n * @param {PermissionResolvable} permission The permission to check for\n * @param {boolean} [explicit=false] Whether to require the user to explicitly have the exact permission\n * @returns {boolean}\n * @see {@link Permissions#has}\n * @deprecated\n */\n hasPermission(permission, explicit = false) {\n return this.has(permission, !explicit);\n }\n\n /**\n * Checks whether the user has all specified permissions.\n * @param {PermissionResolvable} permissions The permissions to check for\n * @param {boolean} [explicit=false] Whether to require the user to explicitly have the exact permissions\n * @returns {boolean}\n * @see {@link Permissions#has}\n * @deprecated\n */\n hasPermissions(permissions, explicit = false) {\n return this.has(permissions, !explicit);\n }\n\n /**\n * Checks whether the user has all specified permissions, and lists any missing permissions.\n * @param {PermissionResolvable} permissions The permissions to check for\n * @param {boolean} [explicit=false] Whether to require the user to explicitly have the exact permissions\n * @returns {PermissionResolvable}\n * @see {@link Permissions#missing}\n * @deprecated\n */\n missingPermissions(permissions, explicit = false) {\n return this.missing(permissions, !explicit);\n }\n}\n\n/**\n * Data that can be resolved to give a permission number. This can be:\n * * A string (see {@link Permissions.FLAGS})\n * * A permission number\n * @typedef {string|number|Permissions|PermissionResolvable[]} PermissionResolvable\n */\n\n/**\n * Numeric permission flags. All available properties:\n * - `ADMINISTRATOR` (implicitly has *all* permissions, and bypasses all channel overwrites)\n * - `CREATE_INSTANT_INVITE` (create invitations to the guild)\n * - `KICK_MEMBERS`\n * - `BAN_MEMBERS`\n * - `MANAGE_CHANNELS` (edit and reorder channels)\n * - `MANAGE_GUILD` (edit the guild information, region, etc.)\n * - `ADD_REACTIONS` (add new reactions to messages)\n * - `VIEW_AUDIT_LOG`\n * - `PRIORITY_SPEAKER`\n * - `STREAM`\n * - `VIEW_CHANNEL`\n * - `READ_MESSAGES` **(deprecated)**\n * - `SEND_MESSAGES`\n * - `SEND_TTS_MESSAGES`\n * - `MANAGE_MESSAGES` (delete messages and reactions)\n * - `EMBED_LINKS` (links posted will have a preview embedded)\n * - `ATTACH_FILES`\n * - `READ_MESSAGE_HISTORY` (view messages that were posted prior to opening Discord)\n * - `MENTION_EVERYONE`\n * - `USE_EXTERNAL_EMOJIS` (use emojis from different guilds)\n * - `EXTERNAL_EMOJIS` **(deprecated)**\n * - `CONNECT` (connect to a voice channel)\n * - `SPEAK` (speak in a voice channel)\n * - `MUTE_MEMBERS` (mute members across all voice channels)\n * - `DEAFEN_MEMBERS` (deafen members across all voice channels)\n * - `MOVE_MEMBERS` (move members between voice channels)\n * - `USE_VAD` (use voice activity detection)\n * - `CHANGE_NICKNAME`\n * - `MANAGE_NICKNAMES` (change other members' nicknames)\n * - `MANAGE_ROLES`\n * - `MANAGE_ROLES_OR_PERMISSIONS` **(deprecated)**\n * - `MANAGE_WEBHOOKS`\n * - `MANAGE_EMOJIS`\n * @type {Object}\n * @see {@link https://discordapp.com/developers/docs/topics/permissions}\n */\nPermissions.FLAGS = {\n CREATE_INSTANT_INVITE: 1 << 0,\n KICK_MEMBERS: 1 << 1,\n BAN_MEMBERS: 1 << 2,\n ADMINISTRATOR: 1 << 3,\n MANAGE_CHANNELS: 1 << 4,\n MANAGE_GUILD: 1 << 5,\n ADD_REACTIONS: 1 << 6,\n VIEW_AUDIT_LOG: 1 << 7,\n PRIORITY_SPEAKER: 1 << 8,\n STREAM: 1 << 9,\n\n VIEW_CHANNEL: 1 << 10,\n READ_MESSAGES: 1 << 10,\n SEND_MESSAGES: 1 << 11,\n SEND_TTS_MESSAGES: 1 << 12,\n MANAGE_MESSAGES: 1 << 13,\n EMBED_LINKS: 1 << 14,\n ATTACH_FILES: 1 << 15,\n READ_MESSAGE_HISTORY: 1 << 16,\n MENTION_EVERYONE: 1 << 17,\n EXTERNAL_EMOJIS: 1 << 18,\n USE_EXTERNAL_EMOJIS: 1 << 18,\n\n CONNECT: 1 << 20,\n SPEAK: 1 << 21,\n MUTE_MEMBERS: 1 << 22,\n DEAFEN_MEMBERS: 1 << 23,\n MOVE_MEMBERS: 1 << 24,\n USE_VAD: 1 << 25,\n\n CHANGE_NICKNAME: 1 << 26,\n MANAGE_NICKNAMES: 1 << 27,\n MANAGE_ROLES: 1 << 28,\n MANAGE_ROLES_OR_PERMISSIONS: 1 << 28,\n MANAGE_WEBHOOKS: 1 << 29,\n MANAGE_EMOJIS: 1 << 30,\n};\n\n/**\n * Bitfield representing every permission combined\n * @type {number}\n */\nPermissions.ALL = Object.keys(Permissions.FLAGS).reduce((all, p) => all | Permissions.FLAGS[p], 0);\n\n/**\n * Bitfield representing the default permissions for users\n * @type {number}\n */\nPermissions.DEFAULT = 104324673;\n\n/**\n * @class EvaluatedPermissions\n * @classdesc The final evaluated permissions for a member in a channel\n * @see {@link Permissions}\n * @deprecated\n */\n\nPermissions.prototype.hasPermission = util.deprecate(Permissions.prototype.hasPermission,\n 'EvaluatedPermissions#hasPermission is deprecated, use Permissions#has instead');\nPermissions.prototype.hasPermissions = util.deprecate(Permissions.prototype.hasPermissions,\n 'EvaluatedPermissions#hasPermissions is deprecated, use Permissions#has instead');\nPermissions.prototype.missingPermissions = util.deprecate(Permissions.prototype.missingPermissions,\n 'EvaluatedPermissions#missingPermissions is deprecated, use Permissions#missing instead');\nObject.defineProperty(Permissions.prototype, 'raw', {\n get: util\n .deprecate(Object.getOwnPropertyDescriptor(Permissions.prototype, 'raw').get,\n 'EvaluatedPermissions#raw is deprecated use Permissions#bitfield instead'),\n set: util.deprecate(Object.getOwnPropertyDescriptor(Permissions.prototype, 'raw').set,\n 'EvaluatedPermissions#raw is deprecated use Permissions#bitfield instead'),\n});\nObject.defineProperty(Permissions.prototype, 'member', {\n get: util\n .deprecate(Object.getOwnPropertyDescriptor(Permissions.prototype, 'member').get,\n 'EvaluatedPermissions#member is deprecated'),\n set: util\n .deprecate(Object.getOwnPropertyDescriptor(Permissions.prototype, 'member').set,\n 'EvaluatedPermissions#member is deprecated'),\n});\n\nmodule.exports = Permissions;\n\n\n//# sourceURL=webpack:///./src/util/Permissions.js?"); /***/ }), @@ -1965,6 +2098,18 @@ eval("const Long = __webpack_require__(/*! long */ \"./node_modules/long/src/lon /***/ }), +/***/ "./src/util/SystemChannelFlags.js": +/*!****************************************!*\ + !*** ./src/util/SystemChannelFlags.js ***! + \****************************************/ +/*! no static exports found */ +/*! ModuleConcatenation bailout: Module is not an ECMAScript module */ +/***/ (function(module, exports, __webpack_require__) { + +eval("const BitField = __webpack_require__(/*! ./BitField */ \"./src/util/BitField.js\");\n\n/**\n * Data structure that makes it easy to interact with a {@link Guild#systemChannelFlags} bitfield.\n * Note that all event message types are enabled by default,\n * and by setting their corresponding flags you are disabling them\n * @extends {BitField}\n */\nclass SystemChannelFlags extends BitField {}\n\n/**\n * Data that can be resolved to give a sytem channel flag bitfield. This can be:\n * * A string (see {@link SystemChannelFlags.FLAGS})\n * * A sytem channel flag\n * * An instance of SystemChannelFlags\n * * An Array of SystemChannelFlagsResolvable\n * @typedef {string|number|SystemChannelFlags|SystemChannelFlagsResolvable[]} SystemChannelFlagsResolvable\n */\n\n/**\n * Numeric system channel flags. All available properties:\n * * `WELCOME_MESSAGE_DISABLED`\n * * `BOOST_MESSAGE_DISABLED`\n * @type {Object}\n */\nSystemChannelFlags.FLAGS = {\n WELCOME_MESSAGE_DISABLED: 1 << 0,\n BOOST_MESSAGE_DISABLED: 1 << 1,\n};\n\nmodule.exports = SystemChannelFlags;\n\n\n//# sourceURL=webpack:///./src/util/SystemChannelFlags.js?"); + +/***/ }), + /***/ "./src/util/Util.js": /*!**************************!*\ !*** ./src/util/Util.js ***! @@ -1973,7 +2118,7 @@ eval("const Long = __webpack_require__(/*! long */ \"./node_modules/long/src/lon /*! ModuleConcatenation bailout: Module is not an ECMAScript module */ /***/ (function(module, exports, __webpack_require__) { -eval("/* WEBPACK VAR INJECTION */(function(Buffer) {const snekfetch = __webpack_require__(/*! snekfetch */ \"./node_modules/snekfetch/esm.mjs\");\nconst Constants = __webpack_require__(/*! ./Constants */ \"./src/util/Constants.js\");\nconst ConstantsHttp = Constants.DefaultOptions.http;\n\n/**\n * Contains various general-purpose utility methods. These functions are also available on the base `Discord` object.\n */\nclass Util {\n constructor() {\n throw new Error(`The ${this.constructor.name} class may not be instantiated.`);\n }\n\n /**\n * Splits a string into multiple chunks at a designated character that do not exceed a specific length.\n * @param {string} text Content to split\n * @param {SplitOptions} [options] Options controlling the behaviour of the split\n * @returns {string|string[]}\n */\n static splitMessage(text, { maxLength = 1950, char = '\\n', prepend = '', append = '' } = {}) {\n if (text.length <= maxLength) return text;\n const splitText = text.split(char);\n if (splitText.some(chunk => chunk.length > maxLength)) {\n throw new Error('Message exceeds the max length and contains no split characters.');\n }\n const messages = [''];\n let msg = 0;\n for (let i = 0; i < splitText.length; i++) {\n if (messages[msg].length + splitText[i].length + 1 > maxLength) {\n messages[msg] += append;\n messages.push(prepend);\n msg++;\n }\n messages[msg] += (messages[msg].length > 0 && messages[msg] !== prepend ? char : '') + splitText[i];\n }\n return messages;\n }\n\n /**\n * Escapes any Discord-flavour markdown in a string.\n * @param {string} text Content to escape\n * @param {boolean} [onlyCodeBlock=false] Whether to only escape codeblocks (takes priority)\n * @param {boolean} [onlyInlineCode=false] Whether to only escape inline code\n * @returns {string}\n */\n static escapeMarkdown(text, onlyCodeBlock = false, onlyInlineCode = false) {\n if (onlyCodeBlock) return text.replace(/```/g, '`\\u200b``');\n if (onlyInlineCode) return text.replace(/\\\\(`|\\\\)/g, '$1').replace(/(`|\\\\)/g, '\\\\$1');\n return text.replace(/\\\\(\\*|_|`|~|\\\\)/g, '$1').replace(/(\\*|_|`|~|\\\\)/g, '\\\\$1');\n }\n\n /**\n * Gets the recommended shard count from Discord.\n * @param {string} token Discord auth token\n * @param {number} [guildsPerShard=1000] Number of guilds per shard\n * @returns {Promise} The recommended number of shards\n */\n static fetchRecommendedShards(token, guildsPerShard = 1000) {\n return new Promise((resolve, reject) => {\n if (!token) throw new Error('A token must be provided.');\n snekfetch.get(`${ConstantsHttp.host}/api/v${ConstantsHttp.version}${Constants.Endpoints.gateway.bot}`)\n .set('Authorization', `Bot ${token.replace(/^Bot\\s*/i, '')}`)\n .end((err, res) => {\n if (err) reject(err);\n resolve(res.body.shards * (1000 / guildsPerShard));\n });\n });\n }\n\n /**\n * Parses emoji info out of a string. The string must be one of:\n * * A UTF-8 emoji (no ID)\n * * A URL-encoded UTF-8 emoji (no ID)\n * * A Discord custom emoji (`<:name:id>` or ``)\n * @param {string} text Emoji string to parse\n * @returns {?Object} Object with `animated`, `name`, and `id` properties\n * @private\n */\n static parseEmoji(text) {\n if (text.includes('%')) text = decodeURIComponent(text);\n if (!text.includes(':')) return { animated: false, name: text, id: null };\n const m = text.match(/?/);\n if (!m) return null;\n return { animated: Boolean(m[1]), name: m[2], id: m[3] };\n }\n\n /**\n * Checks whether the arrays are equal, also removes duplicated entries from b.\n * @param {Array<*>} a Array which will not be modified.\n * @param {Array<*>} b Array to remove duplicated entries from.\n * @returns {boolean} Whether the arrays are equal.\n * @private\n */\n static arraysEqual(a, b) {\n if (a === b) return true;\n if (a.length !== b.length) return false;\n\n for (const item of a) {\n const ind = b.indexOf(item);\n if (ind !== -1) b.splice(ind, 1);\n }\n\n return b.length === 0;\n }\n\n /**\n * Shallow-copies an object with its class/prototype intact.\n * @param {Object} obj Object to clone\n * @returns {Object}\n * @private\n */\n static cloneObject(obj) {\n return Object.assign(Object.create(obj), obj);\n }\n\n /**\n * Sets default properties on an object that aren't already specified.\n * @param {Object} def Default properties\n * @param {Object} given Object to assign defaults to\n * @returns {Object}\n * @private\n */\n static mergeDefault(def, given) {\n if (!given) return def;\n for (const key in def) {\n if (!{}.hasOwnProperty.call(given, key)) {\n given[key] = def[key];\n } else if (given[key] === Object(given[key])) {\n given[key] = this.mergeDefault(def[key], given[key]);\n }\n }\n\n return given;\n }\n\n /**\n * Converts an ArrayBuffer or string to a Buffer.\n * @param {ArrayBuffer|string} ab ArrayBuffer to convert\n * @returns {Buffer}\n * @private\n */\n static convertToBuffer(ab) {\n if (typeof ab === 'string') ab = this.str2ab(ab);\n return Buffer.from(ab);\n }\n\n /**\n * Converts a string to an ArrayBuffer.\n * @param {string} str String to convert\n * @returns {ArrayBuffer}\n * @private\n */\n static str2ab(str) {\n const buffer = new ArrayBuffer(str.length * 2);\n const view = new Uint16Array(buffer);\n for (var i = 0, strLen = str.length; i < strLen; i++) view[i] = str.charCodeAt(i);\n return buffer;\n }\n\n /**\n * Makes an Error from a plain info object.\n * @param {Object} obj Error info\n * @param {string} obj.name Error type\n * @param {string} obj.message Message for the error\n * @param {string} obj.stack Stack for the error\n * @returns {Error}\n * @private\n */\n static makeError(obj) {\n const err = new Error(obj.message);\n err.name = obj.name;\n err.stack = obj.stack;\n return err;\n }\n\n /**\n * Makes a plain error info object from an Error.\n * @param {Error} err Error to get info from\n * @returns {Object}\n * @private\n */\n static makePlainError(err) {\n const obj = {};\n obj.name = err.name;\n obj.message = err.message;\n obj.stack = err.stack;\n return obj;\n }\n\n /**\n * Moves an element in an array *in place*.\n * @param {Array<*>} array Array to modify\n * @param {*} element Element to move\n * @param {number} newIndex Index or offset to move the element to\n * @param {boolean} [offset=false] Move the element by an offset amount rather than to a set index\n * @returns {number}\n * @private\n */\n static moveElementInArray(array, element, newIndex, offset = false) {\n const index = array.indexOf(element);\n newIndex = (offset ? index : 0) + newIndex;\n if (newIndex > -1 && newIndex < array.length) {\n const removedElement = array.splice(index, 1)[0];\n array.splice(newIndex, 0, removedElement);\n }\n return array.indexOf(element);\n }\n\n /**\n * Creates a Promise that resolves after a specified duration.\n * @param {number} ms How long to wait before resolving (in milliseconds)\n * @returns {Promise}\n * @private\n */\n static delayFor(ms) {\n return new Promise(resolve => {\n setTimeout(resolve, ms);\n });\n }\n}\n\nmodule.exports = Util;\n\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../node_modules/buffer/index.js */ \"./node_modules/buffer/index.js\").Buffer))\n\n//# sourceURL=webpack:///./src/util/Util.js?"); +eval("/* WEBPACK VAR INJECTION */(function(Buffer) {const snekfetch = __webpack_require__(/*! snekfetch */ \"./node_modules/snekfetch/esm.mjs\");\nconst Constants = __webpack_require__(/*! ./Constants */ \"./src/util/Constants.js\");\nconst ConstantsHttp = Constants.DefaultOptions.http;\n\n/**\n * Contains various general-purpose utility methods. These functions are also available on the base `Discord` object.\n */\nclass Util {\n constructor() {\n throw new Error(`The ${this.constructor.name} class may not be instantiated.`);\n }\n\n /**\n * Splits a string into multiple chunks at a designated character that do not exceed a specific length.\n * @param {string} text Content to split\n * @param {SplitOptions} [options] Options controlling the behaviour of the split\n * @returns {string|string[]}\n */\n static splitMessage(text, { maxLength = 1950, char = '\\n', prepend = '', append = '' } = {}) {\n if (text.length <= maxLength) return text;\n const splitText = text.split(char);\n if (splitText.some(chunk => chunk.length > maxLength)) {\n throw new Error('Message exceeds the max length and contains no split characters.');\n }\n const messages = [''];\n let msg = 0;\n for (let i = 0; i < splitText.length; i++) {\n if (messages[msg].length + splitText[i].length + 1 > maxLength) {\n messages[msg] += append;\n messages.push(prepend);\n msg++;\n }\n messages[msg] += (messages[msg].length > 0 && messages[msg] !== prepend ? char : '') + splitText[i];\n }\n return messages;\n }\n\n /**\n * Data that can be resolved to give a string. This can be:\n * * A string\n * * An array (joined with a new line delimiter to give a string)\n * * Any value\n * @typedef {string|Array|*} StringResolvable\n */\n\n /**\n * Resolves a StringResolvable to a string.\n * @param {StringResolvable} data The string resolvable to resolve\n * @returns {string}\n */\n static resolveString(data) {\n if (typeof data === 'string') return data;\n if (Array.isArray(data)) return data.join('\\n');\n return String(data);\n }\n\n /**\n * Escapes any Discord-flavour markdown in a string.\n * @param {string} text Content to escape\n * @param {boolean} [onlyCodeBlock=false] Whether to only escape codeblocks (takes priority)\n * @param {boolean} [onlyInlineCode=false] Whether to only escape inline code\n * @returns {string}\n */\n static escapeMarkdown(text, onlyCodeBlock = false, onlyInlineCode = false) {\n if (onlyCodeBlock) return text.replace(/```/g, '`\\u200b``');\n if (onlyInlineCode) return text.replace(/\\\\(`|\\\\)/g, '$1').replace(/(`|\\\\)/g, '\\\\$1');\n return text.replace(/\\\\(\\*|_|`|~|\\\\)/g, '$1').replace(/(\\*|_|`|~|\\\\)/g, '\\\\$1');\n }\n\n /**\n * Gets the recommended shard count from Discord.\n * @param {string} token Discord auth token\n * @param {number} [guildsPerShard=1000] Number of guilds per shard\n * @returns {Promise} The recommended number of shards\n */\n static fetchRecommendedShards(token, guildsPerShard = 1000) {\n return new Promise((resolve, reject) => {\n if (!token) throw new Error('A token must be provided.');\n snekfetch.get(`${ConstantsHttp.host}/api/v${ConstantsHttp.version}${Constants.Endpoints.gateway.bot}`)\n .set('Authorization', `Bot ${token.replace(/^Bot\\s*/i, '')}`)\n .end((err, res) => {\n if (err) reject(err);\n resolve(res.body.shards * (1000 / guildsPerShard));\n });\n });\n }\n\n /**\n * Parses emoji info out of a string. The string must be one of:\n * * A UTF-8 emoji (no ID)\n * * A URL-encoded UTF-8 emoji (no ID)\n * * A Discord custom emoji (`<:name:id>` or ``)\n * @param {string} text Emoji string to parse\n * @returns {?Object} Object with `animated`, `name`, and `id` properties\n * @private\n */\n static parseEmoji(text) {\n if (text.includes('%')) text = decodeURIComponent(text);\n if (!text.includes(':')) return { animated: false, name: text, id: null };\n const m = text.match(/?/);\n if (!m) return null;\n return { animated: Boolean(m[1]), name: m[2], id: m[3] };\n }\n\n /**\n * Checks whether two arrays are equal or have the same elements.\n * @param {Array<*>} a The first array.\n * @param {Array<*>} b The second array.\n * @returns {boolean} Whether the arrays are equal.\n * @private\n */\n static arraysEqual(a, b) {\n if (a === b) return true;\n if (a.length !== b.length) return false;\n\n const setA = new Set(a);\n const setB = new Set(b);\n\n return a.every(e => setB.has(e)) && b.every(e => setA.has(e));\n }\n\n /**\n * Shallow-copies an object with its class/prototype intact.\n * @param {Object} obj Object to clone\n * @returns {Object}\n * @private\n */\n static cloneObject(obj) {\n return Object.assign(Object.create(obj), obj);\n }\n\n /**\n * Sets default properties on an object that aren't already specified.\n * @param {Object} def Default properties\n * @param {Object} given Object to assign defaults to\n * @returns {Object}\n * @private\n */\n static mergeDefault(def, given) {\n if (!given) return def;\n for (const key in def) {\n if (!{}.hasOwnProperty.call(given, key)) {\n given[key] = def[key];\n } else if (given[key] === Object(given[key])) {\n given[key] = this.mergeDefault(def[key], given[key]);\n }\n }\n\n return given;\n }\n\n /**\n * Converts an ArrayBuffer or string to a Buffer.\n * @param {ArrayBuffer|string} ab ArrayBuffer to convert\n * @returns {Buffer}\n * @private\n */\n static convertToBuffer(ab) {\n if (typeof ab === 'string') ab = this.str2ab(ab);\n return Buffer.from(ab);\n }\n\n /**\n * Converts a string to an ArrayBuffer.\n * @param {string} str String to convert\n * @returns {ArrayBuffer}\n * @private\n */\n static str2ab(str) {\n const buffer = new ArrayBuffer(str.length * 2);\n const view = new Uint16Array(buffer);\n for (var i = 0, strLen = str.length; i < strLen; i++) view[i] = str.charCodeAt(i);\n return buffer;\n }\n\n /**\n * Makes an Error from a plain info object.\n * @param {Object} obj Error info\n * @param {string} obj.name Error type\n * @param {string} obj.message Message for the error\n * @param {string} obj.stack Stack for the error\n * @returns {Error}\n * @private\n */\n static makeError(obj) {\n const err = new Error(obj.message);\n err.name = obj.name;\n err.stack = obj.stack;\n return err;\n }\n\n /**\n * Makes a plain error info object from an Error.\n * @param {Error} err Error to get info from\n * @returns {Object}\n * @private\n */\n static makePlainError(err) {\n const obj = {};\n obj.name = err.name;\n obj.message = err.message;\n obj.stack = err.stack;\n return obj;\n }\n\n /**\n * Moves an element in an array *in place*.\n * @param {Array<*>} array Array to modify\n * @param {*} element Element to move\n * @param {number} newIndex Index or offset to move the element to\n * @param {boolean} [offset=false] Move the element by an offset amount rather than to a set index\n * @returns {number}\n * @private\n */\n static moveElementInArray(array, element, newIndex, offset = false) {\n const index = array.indexOf(element);\n newIndex = (offset ? index : 0) + newIndex;\n if (newIndex > -1 && newIndex < array.length) {\n const removedElement = array.splice(index, 1)[0];\n array.splice(newIndex, 0, removedElement);\n }\n return array.indexOf(element);\n }\n\n /**\n * Creates a Promise that resolves after a specified duration.\n * @param {number} ms How long to wait before resolving (in milliseconds)\n * @returns {Promise}\n * @private\n */\n static delayFor(ms) {\n return new Promise(resolve => {\n setTimeout(resolve, ms);\n });\n }\n}\n\nmodule.exports = Util;\n\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../node_modules/buffer/index.js */ \"./node_modules/buffer/index.js\").Buffer))\n\n//# sourceURL=webpack:///./src/util/Util.js?"); /***/ }), diff --git a/discord.stable.min.js b/discord.stable.min.js index c906070f..53319429 100644 --- a/discord.stable.min.js +++ b/discord.stable.min.js @@ -1 +1 @@ -!function(e){var t={};function s(i){if(t[i])return t[i].exports;var n=t[i]={i:i,l:!1,exports:{}};return e[i].call(n.exports,n,n.exports,s),n.l=!0,n.exports}s.m=e,s.c=t,s.d=function(e,t,i){s.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},s.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},s.t=function(e,t){if(1&t&&(e=s(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(s.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)s.d(i,n,function(t){return e[t]}.bind(null,n));return i},s.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return s.d(t,"a",t),t},s.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},s.p="",s(s.s=60)}([function(e,t,s){(function(e){t.Package=s(42),t.DefaultOptions={apiRequestMethod:"sequential",shardId:0,shardCount:0,messageCacheMaxSize:200,messageCacheLifetime:0,messageSweepInterval:0,fetchAllMembers:!1,disableEveryone:!1,sync:!1,restWsBridgeTimeout:5e3,retryLimit:1/0,disabledEvents:[],restTimeOffset:500,ws:{large_threshold:250,compress:"browser"!==s(71).platform(),properties:{$os:e?e.platform:"discord.js",$browser:"discord.js",$device:"discord.js",$referrer:"",$referring_domain:""},version:6},http:{version:7,host:"https://discordapp.com",cdn:"https://cdn.discordapp.com"}},t.WSCodes={1000:"Connection gracefully closed",4004:"Tried to identify with an invalid token",4010:"Sharding data provided was invalid",4011:"Shard would be on too many guilds if connected"},t.Errors={NO_TOKEN:"Request to use token, but token was unavailable to the client.",NO_BOT_ACCOUNT:"Only bot accounts are able to make use of this feature.",NO_USER_ACCOUNT:"Only user accounts are able to make use of this feature.",BAD_WS_MESSAGE:"A bad message was received from the websocket; either bad compression, or not JSON.",TOOK_TOO_LONG:"Something took too long to do.",NOT_A_PERMISSION:"Invalid permission string or number.",INVALID_RATE_LIMIT_METHOD:"Unknown rate limiting method.",BAD_LOGIN:"Incorrect login details were provided.",INVALID_SHARD:"Invalid shard settings were provided.",SHARDING_REQUIRED:"This session would have handled too many guilds - Sharding is required.",INVALID_TOKEN:"An invalid token was provided."};const i=t.Endpoints={User:e=>{e.id&&(e=e.id);const t=`/users/${e}`;return{toString:()=>t,channels:`${t}/channels`,profile:`${t}/profile`,relationships:`${t}/relationships`,settings:`${t}/settings`,Relationship:e=>`${t}/relationships/${e}`,Guild:e=>({toString:()=>`${t}/guilds/${e}`,settings:`${t}/guilds/${e}/settings`}),Note:e=>`${t}/notes/${e}`,Mentions:(e,s,i,n)=>`${t}/mentions?limit=${e}&roles=${s}&everyone=${i}${n?`&guild_id=${n}`:""}`,Avatar:(t,s)=>"1"===e?s:i.CDN(t).Avatar(e,s)}},guilds:"/guilds",Guild:e=>{e.id&&(e=e.id);const t=`/guilds/${e}`;return{toString:()=>t,prune:`${t}/prune`,embed:`${t}/embed`,bans:`${t}/bans`,integrations:`${t}/integrations`,members:`${t}/members`,channels:`${t}/channels`,invites:`${t}/invites`,roles:`${t}/roles`,emojis:`${t}/emojis`,search:`${t}/messages/search`,vanityURL:`${t}/vanity-url`,voiceRegions:`${t}/regions`,webhooks:`${t}/webhooks`,ack:`${t}/ack`,settings:`${t}/settings`,auditLogs:`${t}/audit-logs`,Emoji:e=>`${t}/emojis/${e}`,Icon:(t,s)=>i.CDN(t).Icon(e,s),Splash:(t,s)=>i.CDN(t).Splash(e,s),Role:e=>`${t}/roles/${e}`,Member:e=>{e.id&&(e=e.id);const s=`${t}/members/${e}`;return{toString:()=>s,Role:e=>`${s}/roles/${e}`,nickname:`${t}/members/@me/nick`}}}},channels:"/channels",Channel:e=>{e.id&&(e=e.id);const t=`/channels/${e}`;return{toString:()=>t,messages:{toString:()=>`${t}/messages`,bulkDelete:`${t}/messages/bulk-delete`},invites:`${t}/invites`,typing:`${t}/typing`,permissions:`${t}/permissions`,webhooks:`${t}/webhooks`,search:`${t}/messages/search`,pins:`${t}/pins`,Icon:(t,s)=>i.CDN(t).GDMIcon(e,s),Pin:e=>`${t}/pins/${e}`,Recipient:e=>`${t}/recipients/${e}`,Message:e=>{e.id&&(e=e.id);const s=`${t}/messages/${e}`;return{toString:()=>s,reactions:`${s}/reactions`,ack:`${s}/ack`,Reaction:e=>{const t=`${s}/reactions/${e}`;return{toString:()=>t,User:e=>`${t}/${e}`}}}}}},Message:e=>t.Endpoints.Channel(e.channel).Message(e),Member:e=>t.Endpoints.Guild(e.guild).Member(e),CDN:e=>({Emoji:(t,s="png")=>`${e}/emojis/${t}.${s}`,Asset:t=>`${e}/assets/${t}`,Avatar:(t,s)=>`${e}/avatars/${t}/${s}.${s.startsWith("a_")?"gif":"png?size=2048"}`,Icon:(t,s)=>`${e}/icons/${t}/${s}.jpg`,AppIcon:(t,s)=>`${e}/app-icons/${t}/${s}.png`,AppAsset:(t,s)=>`${e}/app-assets/${t}/${s}.png`,GDMIcon:(t,s)=>`${e}/channel-icons/${t}/${s}.jpg?size=2048`,Splash:(t,s)=>`${e}/splashes/${t}/${s}.jpg`}),OAUTH2:{Application:e=>{const t=`/oauth2/applications/${e}`;return{toString:()=>t,resetSecret:`${t}/reset`,resetToken:`${t}/bot/reset`}},App:e=>`/oauth2/authorize?client_id=${e}`},login:"/auth/login",logout:"/auth/logout",voiceRegions:"/voice/regions",gateway:{toString:()=>"/gateway",bot:"/gateway/bot"},Invite:e=>`/invite/${e}?with_counts=true`,inviteLink:e=>`https://discord.gg/${e}`,Webhook:(e,t)=>`/webhooks/${e}${t?`/${t}`:""}`};t.Status={READY:0,CONNECTING:1,RECONNECTING:2,IDLE:3,NEARLY:4,DISCONNECTED:5},t.VoiceStatus={CONNECTED:0,CONNECTING:1,AUTHENTICATING:2,RECONNECTING:3,DISCONNECTED:4},t.ChannelTypes={TEXT:0,DM:1,VOICE:2,GROUP_DM:3,CATEGORY:4,NEWS:5,STORE:6},t.OPCodes={DISPATCH:0,HEARTBEAT:1,IDENTIFY:2,STATUS_UPDATE:3,VOICE_STATE_UPDATE:4,VOICE_GUILD_PING:5,RESUME:6,RECONNECT:7,REQUEST_GUILD_MEMBERS:8,INVALID_SESSION:9,HELLO:10,HEARTBEAT_ACK:11},t.VoiceOPCodes={IDENTIFY:0,SELECT_PROTOCOL:1,READY:2,HEARTBEAT:3,SESSION_DESCRIPTION:4,SPEAKING:5},t.Events={RATE_LIMIT:"rateLimit",READY:"ready",RESUME:"resume",GUILD_CREATE:"guildCreate",GUILD_DELETE:"guildDelete",GUILD_UPDATE:"guildUpdate",GUILD_UNAVAILABLE:"guildUnavailable",GUILD_AVAILABLE:"guildAvailable",GUILD_MEMBER_ADD:"guildMemberAdd",GUILD_MEMBER_REMOVE:"guildMemberRemove",GUILD_MEMBER_UPDATE:"guildMemberUpdate",GUILD_MEMBER_AVAILABLE:"guildMemberAvailable",GUILD_MEMBER_SPEAKING:"guildMemberSpeaking",GUILD_MEMBERS_CHUNK:"guildMembersChunk",GUILD_INTEGRATIONS_UPDATE:"guildIntegrationsUpdate",GUILD_ROLE_CREATE:"roleCreate",GUILD_ROLE_DELETE:"roleDelete",GUILD_ROLE_UPDATE:"roleUpdate",GUILD_EMOJI_CREATE:"emojiCreate",GUILD_EMOJI_DELETE:"emojiDelete",GUILD_EMOJI_UPDATE:"emojiUpdate",GUILD_BAN_ADD:"guildBanAdd",GUILD_BAN_REMOVE:"guildBanRemove",CHANNEL_CREATE:"channelCreate",CHANNEL_DELETE:"channelDelete",CHANNEL_UPDATE:"channelUpdate",CHANNEL_PINS_UPDATE:"channelPinsUpdate",MESSAGE_CREATE:"message",MESSAGE_DELETE:"messageDelete",MESSAGE_UPDATE:"messageUpdate",MESSAGE_BULK_DELETE:"messageDeleteBulk",MESSAGE_REACTION_ADD:"messageReactionAdd",MESSAGE_REACTION_REMOVE:"messageReactionRemove",MESSAGE_REACTION_REMOVE_ALL:"messageReactionRemoveAll",USER_UPDATE:"userUpdate",USER_NOTE_UPDATE:"userNoteUpdate",USER_SETTINGS_UPDATE:"clientUserSettingsUpdate",USER_GUILD_SETTINGS_UPDATE:"clientUserGuildSettingsUpdate",PRESENCE_UPDATE:"presenceUpdate",VOICE_STATE_UPDATE:"voiceStateUpdate",TYPING_START:"typingStart",TYPING_STOP:"typingStop",WEBHOOKS_UPDATE:"webhookUpdate",DISCONNECT:"disconnect",RECONNECTING:"reconnecting",ERROR:"error",WARN:"warn",DEBUG:"debug"},t.ActivityTypes=["PLAYING","STREAMING","LISTENING","WATCHING"],t.ActivityFlags={INSTANCE:1,JOIN:2,SPECTATE:4,JOIN_REQUEST:8,SYNC:16,PLAY:32},t.WSEvents={READY:"READY",RESUMED:"RESUMED",GUILD_SYNC:"GUILD_SYNC",GUILD_CREATE:"GUILD_CREATE",GUILD_DELETE:"GUILD_DELETE",GUILD_UPDATE:"GUILD_UPDATE",GUILD_MEMBER_ADD:"GUILD_MEMBER_ADD",GUILD_MEMBER_REMOVE:"GUILD_MEMBER_REMOVE",GUILD_MEMBER_UPDATE:"GUILD_MEMBER_UPDATE",GUILD_MEMBERS_CHUNK:"GUILD_MEMBERS_CHUNK",GUILD_INTEGRATIONS_UPDATE:"GUILD_INTEGRATIONS_UPDATE",GUILD_ROLE_CREATE:"GUILD_ROLE_CREATE",GUILD_ROLE_DELETE:"GUILD_ROLE_DELETE",GUILD_ROLE_UPDATE:"GUILD_ROLE_UPDATE",GUILD_BAN_ADD:"GUILD_BAN_ADD",GUILD_BAN_REMOVE:"GUILD_BAN_REMOVE",GUILD_EMOJIS_UPDATE:"GUILD_EMOJIS_UPDATE",CHANNEL_CREATE:"CHANNEL_CREATE",CHANNEL_DELETE:"CHANNEL_DELETE",CHANNEL_UPDATE:"CHANNEL_UPDATE",CHANNEL_PINS_UPDATE:"CHANNEL_PINS_UPDATE",MESSAGE_CREATE:"MESSAGE_CREATE",MESSAGE_DELETE:"MESSAGE_DELETE",MESSAGE_UPDATE:"MESSAGE_UPDATE",MESSAGE_DELETE_BULK:"MESSAGE_DELETE_BULK",MESSAGE_REACTION_ADD:"MESSAGE_REACTION_ADD",MESSAGE_REACTION_REMOVE:"MESSAGE_REACTION_REMOVE",MESSAGE_REACTION_REMOVE_ALL:"MESSAGE_REACTION_REMOVE_ALL",USER_UPDATE:"USER_UPDATE",USER_NOTE_UPDATE:"USER_NOTE_UPDATE",USER_SETTINGS_UPDATE:"USER_SETTINGS_UPDATE",USER_GUILD_SETTINGS_UPDATE:"USER_GUILD_SETTINGS_UPDATE",PRESENCE_UPDATE:"PRESENCE_UPDATE",VOICE_STATE_UPDATE:"VOICE_STATE_UPDATE",TYPING_START:"TYPING_START",VOICE_SERVER_UPDATE:"VOICE_SERVER_UPDATE",RELATIONSHIP_ADD:"RELATIONSHIP_ADD",RELATIONSHIP_REMOVE:"RELATIONSHIP_REMOVE",WEBHOOKS_UPDATE:"WEBHOOKS_UPDATE"},t.MessageTypes=["DEFAULT","RECIPIENT_ADD","RECIPIENT_REMOVE","CALL","CHANNEL_NAME_CHANGE","CHANNEL_ICON_CHANGE","PINS_ADD","GUILD_MEMBER_JOIN"],t.MessageNotificationTypes=["EVERYTHING","MENTIONS","NOTHING","INHERIT"],t.DefaultAvatars={BLURPLE:"6debd47ed13483642cf09e832ed0bc1b",GREY:"322c936a8c8be1b803cd94861bdfa868",GREEN:"dd4dbc0016779df1378e7812eabaa04d",ORANGE:"0e291f67c9274a1abdddeb3fd919cbaa",RED:"1cbd08c76f8af6dddce02c5138971129"},t.ExplicitContentFilterTypes=["DISABLED","NON_FRIENDS","FRIENDS_AND_NON_FRIENDS"],t.UserSettingsMap={convert_emoticons:"convertEmoticons",default_guilds_restricted:"defaultGuildsRestricted",detect_platform_accounts:"detectPlatformAccounts",developer_mode:"developerMode",enable_tts_command:"enableTTSCommand",theme:"theme",status:"status",show_current_game:"showCurrentGame",inline_attachment_media:"inlineAttachmentMedia",inline_embed_media:"inlineEmbedMedia",locale:"locale",message_display_compact:"messageDisplayCompact",render_reactions:"renderReactions",guild_positions:"guildPositions",restricted_guilds:"restrictedGuilds",explicit_content_filter:function(e){return t.ExplicitContentFilterTypes[e]},friend_source_flags:function(e){return{all:e.all||!1,mutualGuilds:!!e.all||(e.mutual_guilds||!1),mutualFriends:!!e.all||(e.mutualFriends||!1)}}},t.UserGuildSettingsMap={message_notifications:function(e){return t.MessageNotificationTypes[e]},mobile_push:"mobilePush",muted:"muted",suppress_everyone:"suppressEveryone",channel_overrides:"channelOverrides"},t.UserChannelOverrideMap={message_notifications:function(e){return t.MessageNotificationTypes[e]},muted:"muted"},t.Colors={DEFAULT:0,WHITE:16777215,AQUA:1752220,GREEN:3066993,BLUE:3447003,PURPLE:10181046,LUMINOUS_VIVID_PINK:15277667,GOLD:15844367,ORANGE:15105570,RED:15158332,GREY:9807270,NAVY:3426654,DARK_AQUA:1146986,DARK_GREEN:2067276,DARK_BLUE:2123412,DARK_PURPLE:7419530,DARK_VIVID_PINK:11342935,DARK_GOLD:12745742,DARK_ORANGE:11027200,DARK_RED:10038562,DARK_GREY:9936031,DARKER_GREY:8359053,LIGHT_GREY:12370112,DARK_NAVY:2899536,BLURPLE:7506394,GREYPLE:10070709,DARK_BUT_NOT_BLACK:2895667,NOT_QUITE_BLACK:2303786},t.APIErrors={UNKNOWN_ACCOUNT:10001,UNKNOWN_APPLICATION:10002,UNKNOWN_CHANNEL:10003,UNKNOWN_GUILD:10004,UNKNOWN_INTEGRATION:10005,UNKNOWN_INVITE:10006,UNKNOWN_MEMBER:10007,UNKNOWN_MESSAGE:10008,UNKNOWN_OVERWRITE:10009,UNKNOWN_PROVIDER:10010,UNKNOWN_ROLE:10011,UNKNOWN_TOKEN:10012,UNKNOWN_USER:10013,UNKNOWN_EMOJI:10014,UNKNOWN_WEBHOOK:10015,BOT_PROHIBITED_ENDPOINT:20001,BOT_ONLY_ENDPOINT:20002,MAXIMUM_GUILDS:30001,MAXIMUM_FRIENDS:30002,MAXIMUM_PINS:30003,MAXIMUM_ROLES:30005,MAXIMUM_REACTIONS:30010,UNAUTHORIZED:40001,MISSING_ACCESS:50001,INVALID_ACCOUNT_TYPE:50002,CANNOT_EXECUTE_ON_DM:50003,EMBED_DISABLED:50004,CANNOT_EDIT_MESSAGE_BY_OTHER:50005,CANNOT_SEND_EMPTY_MESSAGE:50006,CANNOT_MESSAGE_USER:50007,CANNOT_SEND_MESSAGES_IN_VOICE_CHANNEL:50008,CHANNEL_VERIFICATION_LEVEL_TOO_HIGH:50009,OAUTH2_APPLICATION_BOT_ABSENT:50010,MAXIMUM_OAUTH2_APPLICATIONS:50011,INVALID_OAUTH_STATE:50012,MISSING_PERMISSIONS:50013,INVALID_AUTHENTICATION_TOKEN:50014,NOTE_TOO_LONG:50015,INVALID_BULK_DELETE_QUANTITY:50016,CANNOT_PIN_MESSAGE_IN_OTHER_CHANNEL:50019,INVALID_OR_TAKEN_INVITE_CODE:50020,CANNOT_EXECUTE_ON_SYSTEM_MESSAGE:50021,BULK_DELETE_MESSAGE_TOO_OLD:50034,INVITE_ACCEPTED_TO_GUILD_NOT_CONTANING_BOT:50036,REACTION_BLOCKED:90001},t.DefaultMessageNotifications=["ALL","MENTIONS"]}).call(this,s(15))},function(e,t){e.exports=class AbstractHandler{constructor(e){this.packetManager=e}handle(e){return e}}},function(e,t,s){e.exports=s(66)},function(e,t){e.exports=class GenericAction{constructor(e){this.client=e}handle(e){return e}}},function(e,t,s){const i=s(7);class Collection extends Map{constructor(e){super(e),Object.defineProperty(this,"_array",{value:null,writable:!0,configurable:!0}),Object.defineProperty(this,"_keyArray",{value:null,writable:!0,configurable:!0})}set(e,t){return this._array=null,this._keyArray=null,super.set(e,t)}delete(e){return this._array=null,this._keyArray=null,super.delete(e)}array(){return this._array&&this._array.length===this.size||(this._array=[...this.values()]),this._array}keyArray(){return this._keyArray&&this._keyArray.length===this.size||(this._keyArray=[...this.keys()]),this._keyArray}first(e){if(void 0===e)return this.values().next().value;if("number"!=typeof e)throw new TypeError("The count must be a number.");if(!Number.isInteger(e)||e<1)throw new RangeError("The count must be an integer greater than 0.");e=Math.min(this.size,e);const t=new Array(e),s=this.values();for(let i=0;i{const i=e.get(s);return i!==t||void 0===i&&!e.has(s)}))}sort(e=((e,t)=>+(e>t)||+(e===t)-1)){return new Collection([...this.entries()].sort((t,s)=>e(t[1],s[1],t[0],s[0])))}}Collection.prototype.findAll=i.deprecate(Collection.prototype.findAll,"Collection#findAll: use Collection#filter instead"),Collection.prototype.filterArray=i.deprecate(Collection.prototype.filterArray,"Collection#filterArray: use Collection#filter instead"),Collection.prototype.exists=i.deprecate(Collection.prototype.exists,"Collection#exists: use Collection#some instead"),Collection.prototype.find=function(e,t){if("string"==typeof e){if(((e,...t)=>console.warn("Collection#find: pass a function instead",t))(0,"DeprecationWarning"),void 0===t)throw new Error("Value must be specified.");for(const s of this.values())if(s[e]===t)return s;return null}if("function"==typeof e){for(const[t,s]of this)if(e(s,t,this))return s;return null}throw new Error("First argument must be a property string or a function.")},Collection.prototype.findKey=function(e,t){if("string"==typeof e){if(((e,...t)=>console.warn("Collection#findKey: pass a function instead",t))(0,"DeprecationWarning"),void 0===t)throw new Error("Value must be specified.");for(const[s,i]of this)if(i[e]===t)return s;return null}if("function"==typeof e){for(const[t,s]of this)if(e(s,t,this))return t;return null}throw new Error("First argument must be a property string or a function.")},e.exports=Collection},function(e,t,s){(function(t){const i=s(27),n=s(0),r=n.DefaultOptions.http;e.exports=class Util{constructor(){throw new Error(`The ${this.constructor.name} class may not be instantiated.`)}static splitMessage(e,{maxLength:t=1950,char:s="\n",prepend:i="",append:n=""}={}){if(e.length<=t)return e;const r=e.split(s);if(r.some(e=>e.length>t))throw new Error("Message exceeds the max length and contains no split characters.");const o=[""];let a=0;for(let e=0;et&&(o[a]+=n,o.push(i),a++),o[a]+=(o[a].length>0&&o[a]!==i?s:"")+r[e];return o}static escapeMarkdown(e,t=!1,s=!1){return t?e.replace(/```/g,"`​``"):s?e.replace(/\\(`|\\)/g,"$1").replace(/(`|\\)/g,"\\$1"):e.replace(/\\(\*|_|`|~|\\)/g,"$1").replace(/(\*|_|`|~|\\)/g,"\\$1")}static fetchRecommendedShards(e,t=1e3){return new Promise((s,o)=>{if(!e)throw new Error("A token must be provided.");i.get(`${r.host}/api/v${r.version}${n.Endpoints.gateway.bot}`).set("Authorization",`Bot ${e.replace(/^Bot\s*/i,"")}`).end((e,i)=>{e&&o(e),s(i.body.shards*(1e3/t))})})}static parseEmoji(e){if(e.includes("%")&&(e=decodeURIComponent(e)),!e.includes(":"))return{animated:!1,name:e,id:null};const t=e.match(/?/);return t?{animated:Boolean(t[1]),name:t[2],id:t[3]}:null}static arraysEqual(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(const s of e){const e=t.indexOf(s);-1!==e&&t.splice(e,1)}return 0===t.length}static cloneObject(e){return Object.assign(Object.create(e),e)}static mergeDefault(e,t){if(!t)return e;for(const s in e)!{}.hasOwnProperty.call(t,s)?t[s]=e[s]:t[s]===Object(t[s])&&(t[s]=this.mergeDefault(e[s],t[s]));return t}static convertToBuffer(e){return"string"==typeof e&&(e=this.str2ab(e)),t.from(e)}static str2ab(e){const t=new ArrayBuffer(2*e.length),s=new Uint16Array(t);for(var i=0,n=e.length;i-1&&s{setTimeout(t,e)})}}}).call(this,s(14).Buffer)},function(e,t,s){const i=s(0),n=s(7);class Permissions{constructor(e,t){t="object"!=typeof e||e instanceof Array?e:t,this._member="object"==typeof e?e:null,this.bitfield="number"==typeof t?t:this.constructor.resolve(t)}get member(){return this._member}set member(e){this._member=e}get raw(){return this.bitfield}set raw(e){this.bitfield=e}has(e,t=!0){return e instanceof Array?e.every(e=>this.has(e,t)):(e=this.constructor.resolve(e),!!(t&&(this.bitfield&this.constructor.FLAGS.ADMINISTRATOR)>0)||(this.bitfield&e)===e)}missing(e,t=!0){return e instanceof Array||(e=[e]),e.filter(e=>!this.has(e,t))}add(...e){let t=0;for(let s=e.length-1;s>=0;s--){t|=this.constructor.resolve(e[s])}return Object.isFrozen(this)?new this.constructor(this.bitfield|t):(this.bitfield|=t,this)}remove(...e){let t=0;for(let s=e.length-1;s>=0;s--){t|=this.constructor.resolve(e[s])}return Object.isFrozen(this)?new this.constructor(this.bitfield&~t):(this.bitfield&=~t,this)}serialize(e=!0){const t={};for(const s in this.constructor.FLAGS)t[s]=this.has(s,e);return t}hasPermission(e,t=!1){return this.has(e,!t)}hasPermissions(e,t=!1){return this.has(e,!t)}missingPermissions(e,t=!1){return this.missing(e,!t)}toArray(e=!0){return Object.keys(this.constructor.FLAGS).filter(t=>this.has(t,e))}freeze(){return Object.freeze(this)}valueOf(){return this.bitfield}static resolve(e){if(e instanceof Array)return e.map(e=>this.resolve(e)).reduce((e,t)=>e|t,0);if(e instanceof Permissions)return e.bitfield;if("string"==typeof e&&(e=this.FLAGS[e]),"number"!=typeof e||e<0)throw new RangeError(i.Errors.NOT_A_PERMISSION);return e}}Permissions.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,PRIORITY_SPEAKER:256,VIEW_CHANNEL:1024,READ_MESSAGES:1024,SEND_MESSAGES:2048,SEND_TTS_MESSAGES:4096,MANAGE_MESSAGES:8192,EMBED_LINKS:16384,ATTACH_FILES:32768,READ_MESSAGE_HISTORY:65536,MENTION_EVERYONE:1<<17,EXTERNAL_EMOJIS:1<<18,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_ROLES_OR_PERMISSIONS:1<<28,MANAGE_WEBHOOKS:1<<29,MANAGE_EMOJIS:1<<30},Permissions.ALL=Object.keys(Permissions.FLAGS).reduce((e,t)=>e|Permissions.FLAGS[t],0),Permissions.DEFAULT=104324097,Permissions.prototype.hasPermission=n.deprecate(Permissions.prototype.hasPermission,"EvaluatedPermissions#hasPermission is deprecated, use Permissions#has instead"),Permissions.prototype.hasPermissions=n.deprecate(Permissions.prototype.hasPermissions,"EvaluatedPermissions#hasPermissions is deprecated, use Permissions#has instead"),Permissions.prototype.missingPermissions=n.deprecate(Permissions.prototype.missingPermissions,"EvaluatedPermissions#missingPermissions is deprecated, use Permissions#missing instead"),Object.defineProperty(Permissions.prototype,"member",{get:n.deprecate(Object.getOwnPropertyDescriptor(Permissions.prototype,"member").get,"EvaluatedPermissions#member is deprecated")}),e.exports=Permissions},function(e,t,s){(function(e){var i=Object.getOwnPropertyDescriptors||function(e){for(var t=Object.keys(e),s={},i=0;i=r)return e;switch(e){case"%s":return String(i[s++]);case"%d":return Number(i[s++]);case"%j":try{return JSON.stringify(i[s++])}catch(e){return"[Circular]"}default:return e}}),l=i[s];s=3&&(i.depth=arguments[2]),arguments.length>=4&&(i.colors=arguments[3]),p(s)?i.showHidden=s:s&&t._extend(i,s),_(i.showHidden)&&(i.showHidden=!1),_(i.depth)&&(i.depth=2),_(i.colors)&&(i.colors=!1),_(i.customInspect)&&(i.customInspect=!0),i.colors&&(i.stylize=l),c(i,e,i.depth)}function l(e,t){var s=a.styles[t];return s?"["+a.colors[s][0]+"m"+e+"["+a.colors[s][1]+"m":e}function h(e,t){return e}function c(e,s,i){if(e.customInspect&&s&&A(s.inspect)&&s.inspect!==t.inspect&&(!s.constructor||s.constructor.prototype!==s)){var n=s.inspect(i,e);return E(n)||(n=c(e,n,i)),n}var r=function(e,t){if(_(t))return e.stylize("undefined","undefined");if(E(t)){var s="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(s,"string")}if(g(t))return e.stylize(""+t,"number");if(p(t))return e.stylize(""+t,"boolean");if(f(t))return e.stylize("null","null")}(e,s);if(r)return r;var o=Object.keys(s),a=function(e){var t={};return e.forEach(function(e,s){t[e]=!0}),t}(o);if(e.showHidden&&(o=Object.getOwnPropertyNames(s)),w(s)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return u(s);if(0===o.length){if(A(s)){var l=s.name?": "+s.name:"";return e.stylize("[Function"+l+"]","special")}if(v(s))return e.stylize(RegExp.prototype.toString.call(s),"regexp");if(y(s))return e.stylize(Date.prototype.toString.call(s),"date");if(w(s))return u(s)}var h,b="",T=!1,R=["{","}"];(m(s)&&(T=!0,R=["[","]"]),A(s))&&(b=" [Function"+(s.name?": "+s.name:"")+"]");return v(s)&&(b=" "+RegExp.prototype.toString.call(s)),y(s)&&(b=" "+Date.prototype.toUTCString.call(s)),w(s)&&(b=" "+u(s)),0!==o.length||T&&0!=s.length?i<0?v(s)?e.stylize(RegExp.prototype.toString.call(s),"regexp"):e.stylize("[Object]","special"):(e.seen.push(s),h=T?function(e,t,s,i,n){for(var r=[],o=0,a=t.length;o=0&&0,e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0)>60)return s[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+s[1];return s[0]+t+" "+e.join(", ")+" "+s[1]}(h,b,R)):R[0]+b+R[1]}function u(e){return"["+Error.prototype.toString.call(e)+"]"}function d(e,t,s,i,n,r){var o,a,l;if((l=Object.getOwnPropertyDescriptor(t,n)||{value:t[n]}).get?a=l.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):l.set&&(a=e.stylize("[Setter]","special")),D(i,n)||(o="["+n+"]"),a||(e.seen.indexOf(l.value)<0?(a=f(s)?c(e,l.value,null):c(e,l.value,s-1)).indexOf("\n")>-1&&(a=r?a.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+a.split("\n").map(function(e){return" "+e}).join("\n")):a=e.stylize("[Circular]","special")),_(o)){if(r&&n.match(/^\d+$/))return a;(o=JSON.stringify(""+n)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(o=o.substr(1,o.length-2),o=e.stylize(o,"name")):(o=o.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),o=e.stylize(o,"string"))}return o+": "+a}function m(e){return Array.isArray(e)}function p(e){return"boolean"==typeof e}function f(e){return null===e}function g(e){return"number"==typeof e}function E(e){return"string"==typeof e}function _(e){return void 0===e}function v(e){return b(e)&&"[object RegExp]"===T(e)}function b(e){return"object"==typeof e&&null!==e}function y(e){return b(e)&&"[object Date]"===T(e)}function w(e){return b(e)&&("[object Error]"===T(e)||e instanceof Error)}function A(e){return"function"==typeof e}function T(e){return Object.prototype.toString.call(e)}function R(e){return e<10?"0"+e.toString(10):e.toString(10)}t.debuglog=function(s){if(_(r)&&(r=Object({__DISCORD_WEBPACK__:"true"}).NODE_DEBUG||""),s=s.toUpperCase(),!o[s])if(new RegExp("\\b"+s+"\\b","i").test(r)){var i=e.pid;o[s]=function(){var e=t.format.apply(t,arguments);console.error("%s %d: %s",s,i,e)}}else o[s]=function(){};return o[s]},t.inspect=a,a.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},a.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},t.isArray=m,t.isBoolean=p,t.isNull=f,t.isNullOrUndefined=function(e){return null==e},t.isNumber=g,t.isString=E,t.isSymbol=function(e){return"symbol"==typeof e},t.isUndefined=_,t.isRegExp=v,t.isObject=b,t.isDate=y,t.isError=w,t.isFunction=A,t.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},t.isBuffer=s(73);var M=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function D(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.log=function(){var e,s;console.log("%s - %s",(e=new Date,s=[R(e.getHours()),R(e.getMinutes()),R(e.getSeconds())].join(":"),[e.getDate(),M[e.getMonth()],s].join(" ")),t.format.apply(t,arguments))},t.inherits=s(74),t._extend=function(e,t){if(!t||!b(t))return e;for(var s=Object.keys(t),i=s.length;i--;)e[s[i]]=t[s[i]];return e};var C="undefined"!=typeof Symbol?Symbol("util.promisify.custom"):void 0;function S(e,t){if(!e){var s=new Error("Promise was rejected with a falsy value");s.reason=e,e=s}return t(e)}t.promisify=function(e){if("function"!=typeof e)throw new TypeError('The "original" argument must be of type Function');if(C&&e[C]){var t;if("function"!=typeof(t=e[C]))throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(t,C,{value:t,enumerable:!1,writable:!1,configurable:!0}),t}function t(){for(var t,s,i=new Promise(function(e,i){t=e,s=i}),n=[],r=0;r=t?String(e):(String(s).repeat(t)+e).slice(-t)}e.exports=class SnowflakeUtil{constructor(){throw new Error(`The ${this.constructor.name} class may not be instantiated.`)}static generate(e=Date.now()){if(e instanceof Date&&(e=e.getTime()),"number"!=typeof e||isNaN(e))throw new TypeError(`"timestamp" argument must be a number (received ${isNaN(e)?"NaN":typeof e})`);r>=4095&&(r=0);const t=`${o((e-n).toString(2),42)}0000100000${o((r++).toString(2),12)}`;return i.fromString(t,2).toString()}static deconstruct(e){const t=o(i.fromString(e).toString(2),64),s={timestamp:parseInt(t.substring(0,42),2)+n,workerID:parseInt(t.substring(42,47),2),processID:parseInt(t.substring(47,52),2),increment:parseInt(t.substring(52,64),2),binary:t};return Object.defineProperty(s,"date",{get:function(){return new Date(this.timestamp)},enumerable:!0}),s}}},function(e,t,s){const i=s(8),n=s(6),r=s(7);class Role{constructor(e,t){Object.defineProperty(this,"client",{value:e.client}),this.guild=e,this.deleted=!1,t&&this.setup(t)}setup(e){this.id=e.id,this.name=e.name,this.color=e.color,this.hoist=e.hoist,this.position=e.position,this.permissions=e.permissions,this.managed=e.managed,this.mentionable=e.mentionable}get createdTimestamp(){return i.deconstruct(this.id).timestamp}get createdAt(){return new Date(this.createdTimestamp)}get hexColor(){let e=this.color.toString(16);for(;e.length<6;)e=`0${e}`;return`#${e}`}get members(){return this.guild.members.filter(e=>e.roles.has(this.id))}get editable(){if(this.managed)return!1;const e=this.guild.member(this.client.user);return!!e.permissions.has(n.FLAGS.MANAGE_ROLES_OR_PERMISSIONS)&&e.highestRole.comparePositionTo(this)>0}get calculatedPosition(){const e=this.guild._sortedRoles;return e.array().indexOf(e.get(this.id))}serialize(){return new n(this.permissions).serialize()}hasPermission(e,t=!1,s){return new n(this.permissions).has(e,void 0!==s?s:!t)}hasPermissions(e,t=!1){return new n(this.permissions).has(e,!t)}comparePositionTo(e){return this.constructor.comparePositions(this,e)}edit(e,t){return this.client.rest.methods.updateGuildRole(this,e,t)}setName(e,t){return this.edit({name:e},t)}setColor(e,t){return this.edit({color:e},t)}setHoist(e,t){return this.edit({hoist:e},t)}setPosition(e,t){return this.guild.setRolePosition(this,e,t).then(()=>this)}setPermissions(e,t){return this.edit({permissions:e},t)}setMentionable(e,t){return this.edit({mentionable:e},t)}delete(e){return this.client.rest.methods.deleteGuildRole(this,e)}equals(e){return e&&this.id===e.id&&this.name===e.name&&this.color===e.color&&this.hoist===e.hoist&&this.position===e.position&&this.permissions===e.permissions&&this.managed===e.managed}toString(){return this.id===this.guild.id?"@everyone":`<@&${this.id}>`}static comparePositions(e,t){return e.position===t.position?t.id-e.id:e.position-t.position}}Role.prototype.hasPermissions=r.deprecate(Role.prototype.hasPermissions,"Role#hasPermissions is deprecated - use Role#hasPermission instead, it now takes an array"),e.exports=Role},function(e,t,s){const i=s(18),n=s(0),r=s(11).Presence,o=s(8),a=s(7);class User{constructor(e,t){Object.defineProperty(this,"client",{value:e}),t&&this.setup(t)}setup(e){this.id=e.id,this.username=e.username,this.discriminator=e.discriminator,this.avatar=e.avatar,this.bot=Boolean(e.bot),this.lastMessageID=null,this.lastMessage=null}patch(e){for(const t of["id","username","discriminator","avatar","bot"])void 0!==e[t]&&(this[t]=e[t]);e.token&&(this.client.token=e.token)}get createdTimestamp(){return o.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 e of this.client.guilds.values())if(e.presences.has(this.id))return e.presences.get(this.id);return new r(void 0,this.client)}get avatarURL(){return this.avatar?n.Endpoints.User(this).Avatar(this.client.options.http.cdn,this.avatar):null}get defaultAvatarURL(){const e=Object.keys(n.DefaultAvatars),t=e[this.discriminator%e.length];return n.Endpoints.CDN(this.client.options.http.host).Asset(`${n.DefaultAvatars[t]}.png`)}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(e){return(e=this.client.resolver.resolveChannel(e))._typing.has(this.id)}typingSinceIn(e){return(e=this.client.resolver.resolveChannel(e))._typing.has(this.id)?new Date(e._typing.get(this.id).since):null}typingDurationIn(e){return(e=this.client.resolver.resolveChannel(e))._typing.has(this.id)?e._typing.get(this.id).elapsedTime:-1}get dmChannel(){return this.client.channels.find(e=>"dm"===e.type&&e.recipient.id===this.id)}createDM(){return this.client.rest.methods.createDM(this)}deleteDM(){return this.client.rest.methods.deleteChannel(this)}addFriend(){return this.client.rest.methods.addFriend(this)}removeFriend(){return this.client.rest.methods.removeFriend(this)}block(){return this.client.rest.methods.blockUser(this)}unblock(){return this.client.rest.methods.unblockUser(this)}fetchProfile(){return this.client.rest.methods.fetchUserProfile(this)}setNote(e){return this.client.rest.methods.setNote(this,e)}equals(e){return e&&this.id===e.id&&this.username===e.username&&this.discriminator===e.discriminator&&this.avatar===e.avatar&&this.bot===Boolean(e.bot)}toString(){return`<@${this.id}>`}send(){}sendMessage(){}sendEmbed(){}sendFile(){}sendCode(){}}i.applyToClass(User),User.prototype.block=a.deprecate(User.prototype.block,"User#block: userbot methods will be removed"),User.prototype.unblock=a.deprecate(User.prototype.unblock,"User#unblock: userbot methods will be removed"),User.prototype.addFriend=a.deprecate(User.prototype.addFriend,"User#addFriend: userbot methods will be removed"),User.prototype.removeFriend=a.deprecate(User.prototype.removeFriend,"User#removeFriend: userbot methods will be removed"),User.prototype.setNote=a.deprecate(User.prototype.setNote,"User#setNote, userbot methods will be removed"),User.prototype.fetchProfile=a.deprecate(User.prototype.fetchProfile,"User#fetchProfile: userbot methods will be removed"),e.exports=User},function(e,t,s){const{ActivityFlags:i,Endpoints:n}=s(0);class Game{constructor(e,t){Object.defineProperty(this,"presence",{value:t}),this.name=e.name,this.type=e.type,this.url=e.url||null,this.details=e.details||null,this.state=e.state||null,this.applicationID=e.application_id||null,this.timestamps=e.timestamps?{start:e.timestamps.start?new Date(Number(e.timestamps.start)):null,end:e.timestamps.end?new Date(Number(e.timestamps.end)):null}:null,this.party=e.party||null,this.assets=e.assets?new RichPresenceAssets(this,e.assets):null,this.syncID=e.sync_id,this._flags=e.flags}get flags(){const e=[];for(const[t,s]of Object.entries(i))(this._flags&s)===s&&e.push(t);return e}get streaming(){return 1===this.type}toString(){return this.name}equals(e){return this===e||e&&this.name===e.name&&this.type===e.type&&this.url===e.url}}class RichPresenceAssets{constructor(e,t){Object.defineProperty(this,"game",{value:e}),this.largeText=t.large_text||null,this.smallText=t.small_text||null,this.largeImage=t.large_image||null,this.smallImage=t.small_image||null}get smallImageURL(){return this.smallImage?n.CDN(this.game.presence.client.options.http.cdn).AppAsset(this.game.applicationID,this.smallImage):null}get largeImageURL(){return this.largeImage?/^spotify:/.test(this.largeImage)?`https://i.scdn.co/image/${this.largeImage.slice(8)}`:n.CDN(this.game.presence.client.options.http.cdn).AppAsset(this.game.applicationID,this.largeImage):null}}t.Presence=class Presence{constructor(e={},t){Object.defineProperty(this,"client",{value:t}),this.status=e.status||"offline",this.game=e.game?new Game(e.game,this):null,this.clientStatus=e.client_status||null}update(e){this.status=e.status||this.status,this.game=e.game?new Game(e.game,this):null,this.clientStatus=e.client_status||null}equals(e){return this===e||e&&this.status===e.status&&(this.game?this.game.equals(e.game):!e.game)&&this.clientStatus.web===e.clientStatus.web&&this.clientStatus.mobile===e.clientStatus.mobile&&this.clientStatus.desktop===e.clientStatus.desktop}},t.Game=Game,t.RichPresenceAssets=RichPresenceAssets},function(e,t,s){const i=s(8);e.exports=class Channel{constructor(e,t){Object.defineProperty(this,"client",{value:e}),this.type=null,this.deleted=!1,t&&this.setup(t)}setup(e){this.id=e.id}get createdTimestamp(){return i.deconstruct(this.id).timestamp}get createdAt(){return new Date(this.createdTimestamp)}delete(){return this.client.rest.methods.deleteChannel(this)}}},function(e,t,s){const i=s(12),n=s(9),r=s(54),o=s(6),a=s(4),l=s(0),h=s(24);e.exports=class GuildChannel extends i{constructor(e,t){super(e.client,t),this.guild=e}setup(e){if(super.setup(e),this.name=e.name,this.position=e.position,this.parentID=e.parent_id,this.permissionOverwrites=new a,e.permission_overwrites)for(const t of e.permission_overwrites)this.permissionOverwrites.set(t.id,new r(this,t))}get calculatedPosition(){const e=this.guild._sortedChannels(this.type);return e.array().indexOf(e.get(this.id))}get parent(){return this.guild.channels.get(this.parentID)||null}memberPermissions(e){if(!(e=this.client.resolver.resolveGuildMember(this.guild,e)))return null;if(e.id===this.guild.ownerID)return new o(e,o.ALL);const t=e.roles,s=new o(t.map(e=>e.permissions));if(s.has(o.FLAGS.ADMINISTRATOR))return new o(o.ALL).freeze();const i=this.overwritesFor(e,!0,t);return s.remove(i.everyone?i.everyone.deny:0).add(i.everyone?i.everyone.allow:0).remove(i.roles.length>0?i.roles.map(e=>e.deny):0).add(i.roles.length>0?i.roles.map(e=>e.allow):0).remove(i.member?i.member.deny:0).add(i.member?i.member.allow:0).freeze()}rolePermissions(e){if(e.permissions&o.FLAGS.ADMINISTRATOR)return new o(o.ALL).freeze();const t=this.permissionOverwrites.get(this.guild.id),s=this.permissionOverwrites.get(e.id);return new o(e.permissions).remove(t?t.deny:0).add(t?t.allow:0).remove(s?s.deny:0).add(s?s.allow:0).freeze()}permissionsFor(e){const t=this.guild.member(e);if(t)return this.memberPermissions(t);const s=this.client.resolver.resolveRole(this.guild,e);return s?this.rolePermissions(s):null}overwritesFor(e,t=!1,s=null){if(t||(e=this.client.resolver.resolveGuildMember(this.guild,e)),!e)return[];s=s||e.roles;const i=[];let n,r;for(const t of this.permissionOverwrites.values())t.id===this.guild.id?r=t:s.has(t.id)?i.push(t):t.id===e.id&&(n=t);return{everyone:r,roles:i,member:n}}replacePermissionOverwrites({overwrites:e,reason:t}={}){return this.edit({permissionOverwrites:e,reason:t}).then(()=>this)}overwritePermissions(e,t,s){const i={allow:0,deny:0};if(e instanceof n)i.type="role";else if(this.guild.roles.has(e))e=this.guild.roles.get(e),i.type="role";else if(e=this.client.resolver.resolveUser(e),i.type="member",!e)return Promise.reject(new TypeError("Supplied parameter was neither a User nor a Role."));i.id=e.id;const r=this.permissionOverwrites.get(e.id);r&&(i.allow=r.allow,i.deny=r.deny);for(const e in t)!0===t[e]?(i.allow|=o.FLAGS[e]||0,i.deny&=~(o.FLAGS[e]||0)):!1===t[e]?(i.allow&=~(o.FLAGS[e]||0),i.deny|=o.FLAGS[e]||0):null===t[e]&&(i.allow&=~(o.FLAGS[e]||0),i.deny&=~(o.FLAGS[e]||0));return this.client.rest.methods.setChannelOverwrite(this,i,s).then(()=>this)}lockPermissions(){if(!this.parent)return Promise.reject(new TypeError("Could not find a parent to this guild channel."));const e=this.parent.permissionOverwrites.map(e=>({deny:e.deny,allow:e.allow,id:e.id,type:e.type}));return this.edit({permissionOverwrites:e})}edit(e,t){return this.client.rest.methods.updateChannel(this,e,t).then(()=>this)}setName(e,t){return this.edit({name:e},t)}setPosition(e,t){return this.guild.setChannelPosition(this,e,t)}setParent(e,t){return e=this.client.resolver.resolveChannelID(e),this.edit({parent:e},t)}setTopic(e,t){return this.edit({topic:e},t)}createInvite(e={},t){return this.client.rest.methods.createChannelInvite(this,e,t)}clone(e=this.name,t=!0,s=!0,i){return this.guild.createChannel(e,{type:this.type,permissionOverwrites:t?this.permissionOverwrites:void 0,topic:s?this.topic:void 0,reason:i})}fetchInvites(){return this.client.rest.makeRequest("get",l.Endpoints.Channel(this.id).invites,!0).then(e=>{const t=new a;for(let s of e)s=new h(this.client,s),t.set(s.code,s);return t})}delete(e){return this.client.rest.methods.deleteChannel(this,e)}equals(e){let t=e&&this.id===e.id&&this.type===e.type&&this.topic===e.topic&&this.position===e.position&&this.name===e.name;return t&&(t=this.permissionOverwrites&&e.permissionOverwrites?this.permissionOverwrites.equals(e.permissionOverwrites):!this.permissionOverwrites&&!e.permissionOverwrites),t}get deletable(){return this.id!==this.guild.id&&this.permissionsFor(this.client.user).has(o.FLAGS.MANAGE_CHANNELS)}get manageable(){if(this.client.user.id===this.guild.ownerID)return!0;const e=this.permissionsFor(this.client.user);return!!e&&e.has([o.FLAGS.MANAGE_CHANNELS,o.FLAGS.VIEW_CHANNEL])}get muted(){if(this.client.user.bot)return null;try{return this.client.user.guildSettings.get(this.guild.id).channelOverrides.get(this.id).muted}catch(e){return!1}}get messageNotifications(){if(this.client.user.bot)return null;try{return this.client.user.guildSettings.get(this.guild.id).channelOverrides.get(this.id).messageNotifications}catch(e){return l.MessageNotificationTypes[3]}}toString(){return`<#${this.id}>`}}},function(e,t,s){"use strict";(function(e){var i=s(63),n=s(64),r=s(65);function o(){return l.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(e,t){if(o()=o())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o().toString(16)+" bytes");return 0|e}function p(e,t){if(l.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var s=e.length;if(0===s)return 0;for(var i=!1;;)switch(t){case"ascii":case"latin1":case"binary":return s;case"utf8":case"utf-8":case void 0:return B(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*s;case"hex":return s>>>1;case"base64":return $(e).length;default:if(i)return B(e).length;t=(""+t).toLowerCase(),i=!0}}function f(e,t,s){var i=e[t];e[t]=e[s],e[s]=i}function g(e,t,s,i,n){if(0===e.length)return-1;if("string"==typeof s?(i=s,s=0):s>2147483647?s=2147483647:s<-2147483648&&(s=-2147483648),s=+s,isNaN(s)&&(s=n?0:e.length-1),s<0&&(s=e.length+s),s>=e.length){if(n)return-1;s=e.length-1}else if(s<0){if(!n)return-1;s=0}if("string"==typeof t&&(t=l.from(t,i)),l.isBuffer(t))return 0===t.length?-1:E(e,t,s,i,n);if("number"==typeof t)return t&=255,l.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?n?Uint8Array.prototype.indexOf.call(e,t,s):Uint8Array.prototype.lastIndexOf.call(e,t,s):E(e,[t],s,i,n);throw new TypeError("val must be string, number or Buffer")}function E(e,t,s,i,n){var r,o=1,a=e.length,l=t.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(e.length<2||t.length<2)return-1;o=2,a/=2,l/=2,s/=2}function h(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(n){var c=-1;for(r=s;ra&&(s=a-l),r=s;r>=0;r--){for(var u=!0,d=0;dn&&(i=n):i=n;var r=t.length;if(r%2!=0)throw new TypeError("Invalid hex string");i>r/2&&(i=r/2);for(var o=0;o>8,n=s%256,r.push(n),r.push(i);return r}(t,e.length-s),e,s,i)}function T(e,t,s){return 0===t&&s===e.length?i.fromByteArray(e):i.fromByteArray(e.slice(t,s))}function R(e,t,s){s=Math.min(e.length,s);for(var i=[],n=t;n239?4:h>223?3:h>191?2:1;if(n+u<=s)switch(u){case 1:h<128&&(c=h);break;case 2:128==(192&(r=e[n+1]))&&(l=(31&h)<<6|63&r)>127&&(c=l);break;case 3:r=e[n+1],o=e[n+2],128==(192&r)&&128==(192&o)&&(l=(15&h)<<12|(63&r)<<6|63&o)>2047&&(l<55296||l>57343)&&(c=l);break;case 4:r=e[n+1],o=e[n+2],a=e[n+3],128==(192&r)&&128==(192&o)&&128==(192&a)&&(l=(15&h)<<18|(63&r)<<12|(63&o)<<6|63&a)>65535&&l<1114112&&(c=l)}null===c?(c=65533,u=1):c>65535&&(c-=65536,i.push(c>>>10&1023|55296),c=56320|1023&c),i.push(c),n+=u}return function(e){var t=e.length;if(t<=M)return String.fromCharCode.apply(String,e);var s="",i=0;for(;ithis.length)return"";if((void 0===s||s>this.length)&&(s=this.length),s<=0)return"";if((s>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return S(this,t,s);case"utf8":case"utf-8":return R(this,t,s);case"ascii":return D(this,t,s);case"latin1":case"binary":return C(this,t,s);case"base64":return T(this,t,s);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,t,s);default:if(i)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),i=!0}}.apply(this,arguments)},l.prototype.equals=function(e){if(!l.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===l.compare(this,e)},l.prototype.inspect=function(){var e="",s=t.INSPECT_MAX_BYTES;return this.length>0&&(e=this.toString("hex",0,s).match(/.{2}/g).join(" "),this.length>s&&(e+=" ... ")),""},l.prototype.compare=function(e,t,s,i,n){if(!l.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===s&&(s=e?e.length:0),void 0===i&&(i=0),void 0===n&&(n=this.length),t<0||s>e.length||i<0||n>this.length)throw new RangeError("out of range index");if(i>=n&&t>=s)return 0;if(i>=n)return-1;if(t>=s)return 1;if(t>>>=0,s>>>=0,i>>>=0,n>>>=0,this===e)return 0;for(var r=n-i,o=s-t,a=Math.min(r,o),h=this.slice(i,n),c=e.slice(t,s),u=0;un)&&(s=n),e.length>0&&(s<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var r=!1;;)switch(i){case"hex":return _(this,e,t,s);case"utf8":case"utf-8":return v(this,e,t,s);case"ascii":return b(this,e,t,s);case"latin1":case"binary":return y(this,e,t,s);case"base64":return w(this,e,t,s);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,e,t,s);default:if(r)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),r=!0}},l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var M=4096;function D(e,t,s){var i="";s=Math.min(e.length,s);for(var n=t;ni)&&(s=i);for(var n="",r=t;rs)throw new RangeError("Trying to access beyond buffer length")}function N(e,t,s,i,n,r){if(!l.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>n||te.length)throw new RangeError("Index out of range")}function O(e,t,s,i){t<0&&(t=65535+t+1);for(var n=0,r=Math.min(e.length-s,2);n>>8*(i?n:1-n)}function P(e,t,s,i){t<0&&(t=4294967295+t+1);for(var n=0,r=Math.min(e.length-s,4);n>>8*(i?n:3-n)&255}function L(e,t,s,i,n,r){if(s+i>e.length)throw new RangeError("Index out of range");if(s<0)throw new RangeError("Index out of range")}function k(e,t,s,i,r){return r||L(e,0,s,4),n.write(e,t,s,i,23,4),s+4}function G(e,t,s,i,r){return r||L(e,0,s,8),n.write(e,t,s,i,52,8),s+8}l.prototype.slice=function(e,t){var s,i=this.length;if(e=~~e,t=void 0===t?i:~~t,e<0?(e+=i)<0&&(e=0):e>i&&(e=i),t<0?(t+=i)<0&&(t=0):t>i&&(t=i),t0&&(n*=256);)i+=this[e+--t]*n;return i},l.prototype.readUInt8=function(e,t){return t||U(e,1,this.length),this[e]},l.prototype.readUInt16LE=function(e,t){return t||U(e,2,this.length),this[e]|this[e+1]<<8},l.prototype.readUInt16BE=function(e,t){return t||U(e,2,this.length),this[e]<<8|this[e+1]},l.prototype.readUInt32LE=function(e,t){return t||U(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},l.prototype.readUInt32BE=function(e,t){return t||U(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},l.prototype.readIntLE=function(e,t,s){e|=0,t|=0,s||U(e,t,this.length);for(var i=this[e],n=1,r=0;++r=(n*=128)&&(i-=Math.pow(2,8*t)),i},l.prototype.readIntBE=function(e,t,s){e|=0,t|=0,s||U(e,t,this.length);for(var i=t,n=1,r=this[e+--i];i>0&&(n*=256);)r+=this[e+--i]*n;return r>=(n*=128)&&(r-=Math.pow(2,8*t)),r},l.prototype.readInt8=function(e,t){return t||U(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},l.prototype.readInt16LE=function(e,t){t||U(e,2,this.length);var s=this[e]|this[e+1]<<8;return 32768&s?4294901760|s:s},l.prototype.readInt16BE=function(e,t){t||U(e,2,this.length);var s=this[e+1]|this[e]<<8;return 32768&s?4294901760|s:s},l.prototype.readInt32LE=function(e,t){return t||U(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},l.prototype.readInt32BE=function(e,t){return t||U(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},l.prototype.readFloatLE=function(e,t){return t||U(e,4,this.length),n.read(this,e,!0,23,4)},l.prototype.readFloatBE=function(e,t){return t||U(e,4,this.length),n.read(this,e,!1,23,4)},l.prototype.readDoubleLE=function(e,t){return t||U(e,8,this.length),n.read(this,e,!0,52,8)},l.prototype.readDoubleBE=function(e,t){return t||U(e,8,this.length),n.read(this,e,!1,52,8)},l.prototype.writeUIntLE=function(e,t,s,i){(e=+e,t|=0,s|=0,i)||N(this,e,t,s,Math.pow(2,8*s)-1,0);var n=1,r=0;for(this[t]=255&e;++r=0&&(r*=256);)this[t+n]=e/r&255;return t+s},l.prototype.writeUInt8=function(e,t,s){return e=+e,t|=0,s||N(this,e,t,1,255,0),l.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},l.prototype.writeUInt16LE=function(e,t,s){return e=+e,t|=0,s||N(this,e,t,2,65535,0),l.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):O(this,e,t,!0),t+2},l.prototype.writeUInt16BE=function(e,t,s){return e=+e,t|=0,s||N(this,e,t,2,65535,0),l.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):O(this,e,t,!1),t+2},l.prototype.writeUInt32LE=function(e,t,s){return e=+e,t|=0,s||N(this,e,t,4,4294967295,0),l.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):P(this,e,t,!0),t+4},l.prototype.writeUInt32BE=function(e,t,s){return e=+e,t|=0,s||N(this,e,t,4,4294967295,0),l.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):P(this,e,t,!1),t+4},l.prototype.writeIntLE=function(e,t,s,i){if(e=+e,t|=0,!i){var n=Math.pow(2,8*s-1);N(this,e,t,s,n-1,-n)}var r=0,o=1,a=0;for(this[t]=255&e;++r>0)-a&255;return t+s},l.prototype.writeIntBE=function(e,t,s,i){if(e=+e,t|=0,!i){var n=Math.pow(2,8*s-1);N(this,e,t,s,n-1,-n)}var r=s-1,o=1,a=0;for(this[t+r]=255&e;--r>=0&&(o*=256);)e<0&&0===a&&0!==this[t+r+1]&&(a=1),this[t+r]=(e/o>>0)-a&255;return t+s},l.prototype.writeInt8=function(e,t,s){return e=+e,t|=0,s||N(this,e,t,1,127,-128),l.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},l.prototype.writeInt16LE=function(e,t,s){return e=+e,t|=0,s||N(this,e,t,2,32767,-32768),l.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):O(this,e,t,!0),t+2},l.prototype.writeInt16BE=function(e,t,s){return e=+e,t|=0,s||N(this,e,t,2,32767,-32768),l.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):O(this,e,t,!1),t+2},l.prototype.writeInt32LE=function(e,t,s){return e=+e,t|=0,s||N(this,e,t,4,2147483647,-2147483648),l.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):P(this,e,t,!0),t+4},l.prototype.writeInt32BE=function(e,t,s){return e=+e,t|=0,s||N(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),l.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):P(this,e,t,!1),t+4},l.prototype.writeFloatLE=function(e,t,s){return k(this,e,t,!0,s)},l.prototype.writeFloatBE=function(e,t,s){return k(this,e,t,!1,s)},l.prototype.writeDoubleLE=function(e,t,s){return G(this,e,t,!0,s)},l.prototype.writeDoubleBE=function(e,t,s){return G(this,e,t,!1,s)},l.prototype.copy=function(e,t,s,i){if(s||(s=0),i||0===i||(i=this.length),t>=e.length&&(t=e.length),t||(t=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),e.length-t=0;--n)e[n+t]=this[n+s];else if(r<1e3||!l.TYPED_ARRAY_SUPPORT)for(n=0;n>>=0,s=void 0===s?this.length:s>>>0,e||(e=0),"number"==typeof e)for(r=t;r55295&&s<57344){if(!n){if(s>56319){(t-=3)>-1&&r.push(239,191,189);continue}if(o+1===i){(t-=3)>-1&&r.push(239,191,189);continue}n=s;continue}if(s<56320){(t-=3)>-1&&r.push(239,191,189),n=s;continue}s=65536+(n-55296<<10|s-56320)}else n&&(t-=3)>-1&&r.push(239,191,189);if(n=null,s<128){if((t-=1)<0)break;r.push(s)}else if(s<2048){if((t-=2)<0)break;r.push(s>>6|192,63&s|128)}else if(s<65536){if((t-=3)<0)break;r.push(s>>12|224,s>>6&63|128,63&s|128)}else{if(!(s<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;r.push(s>>18|240,s>>12&63|128,s>>6&63|128,63&s|128)}}return r}function $(e){return i.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(x,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function q(e,t,s,i){for(var n=0;n=t.length||n>=e.length);++n)t[n+s]=e[n];return n}}).call(this,s(62))},function(e,t){var s,i,n=e.exports={};function r(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function a(e){if(s===setTimeout)return setTimeout(e,0);if((s===r||!s)&&setTimeout)return s=setTimeout,setTimeout(e,0);try{return s(e,0)}catch(t){try{return s.call(null,e,0)}catch(t){return s.call(this,e,0)}}}!function(){try{s="function"==typeof setTimeout?setTimeout:r}catch(e){s=r}try{i="function"==typeof clearTimeout?clearTimeout:o}catch(e){i=o}}();var l,h=[],c=!1,u=-1;function d(){c&&l&&(c=!1,l.length?h=l.concat(h):u=-1,h.length&&m())}function m(){if(!c){var e=a(d);c=!0;for(var t=h.length;t;){for(l=h,h=[];++u1)for(var s=1;s0&&o.length>n&&!o.warned){o.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=o.length,a=l,console&&console.warn&&console.warn(a)}return e}function u(e,t,s){var i={fired:!1,wrapFn:void 0,target:e,type:t,listener:s},n=function(){for(var e=[],t=0;t0&&(o=t[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var l=n[e];if(void 0===l)return!1;if("function"==typeof l)r(l,this,t);else{var h=l.length,c=p(l,h);for(s=0;s=0;r--)if(s[r]===t||s[r].listener===t){o=s[r].listener,n=r;break}if(n<0)return this;0===n?s.shift():function(e,t){for(;t+1=0;i--)this.removeListener(e,t[i]);return this},a.prototype.listeners=function(e){return d(this,e,!0)},a.prototype.rawListeners=function(e){return d(this,e,!1)},a.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):m.call(e,t)},a.prototype.listenerCount=m,a.prototype.eventNames=function(){return this._eventsCount>0?i(this._events):[]}},function(e,t,s){const i=s(22),n=s(29);let r;function o(e){return"string"==typeof e?e:e instanceof Array?e.join("\n"):String(e)}e.exports=class RichEmbed{constructor(e={}){this.title=e.title,this.description=e.description,this.url=e.url,this.color=e.color,this.author=e.author,this.timestamp=e.timestamp,this.fields=e.fields||[],this.thumbnail=e.thumbnail,this.image=e.image,this.footer=e.footer,this.file=e.file,this.files=[]}setTitle(e){if((e=o(e)).length>256)throw new RangeError("RichEmbed titles may not exceed 256 characters.");return this.title=e,this}setDescription(e){if((e=o(e)).length>2048)throw new RangeError("RichEmbed descriptions may not exceed 2048 characters.");return this.description=e,this}setURL(e){return this.url=e,this}setColor(e){return r||(r=s(30)),this.color=r.resolveColor(e),this}setAuthor(e,t,s){return this.author={name:o(e),icon_url:t,url:s},this}setTimestamp(e=Date.now()){return e instanceof Date&&(e=e.getTime()),this.timestamp=e,this}addField(e,t,s=!1){if(this.fields.length>=25)throw new RangeError("RichEmbeds may not exceed 25 fields.");if((e=o(e)).length>256)throw new RangeError("RichEmbed field names may not exceed 256 characters.");if(!/\S/.test(e))throw new RangeError("RichEmbed field names may not be empty.");if((t=o(t)).length>1024)throw new RangeError("RichEmbed field values may not exceed 1024 characters.");if(!/\S/.test(t))throw new RangeError("RichEmbed field values may not be empty.");return this.fields.push({name:e,value:t,inline:s}),this}addBlankField(e=!1){return this.addField("​","​",e)}setThumbnail(e){return this.thumbnail={url:e},this}setImage(e){return this.image={url:e},this}setFooter(e,t){if((e=o(e)).length>2048)throw new RangeError("RichEmbed footer text may not exceed 2048 characters.");return this.footer={text:e,icon_url:t},this}attachFile(e){if(this.file)throw new RangeError("You may not upload more than one file at once.");return e instanceof i&&(e=e.file),this.file=e,this}attachFiles(e){return e=e.map(e=>e instanceof i?e.file:e),this.files=this.files.concat(e),this}get length(){return(this.title?this.title.length:0)+(this.description?this.description.length:0)+(this.fields.length>=1?this.fields.reduce((e,t)=>e+t.name.length+t.value.length,0):0)+(this.footer?this.footer.text.length:0)+(this.author?this.author.name.length:0)}_apiTransform(){return{title:this.title,type:"rich",description:this.description,url:this.url,timestamp:this.timestamp?new Date(this.timestamp):null,color:this.color,fields:this.fields?this.fields.map(e=>({name:e.name,value:e.value,inline:e.inline})):null,thumbnail:this.thumbnail?{url:this.thumbnail.url}:null,image:this.image?{url:this.image.url}:null,author:this.author?{name:this.author.name,url:this.author.url,icon_url:this.author instanceof n.Author?this.author.iconURL:this.author.icon_url}:null,footer:this.footer?{text:this.footer.text,icon_url:this.footer instanceof n.Footer?this.footer.iconURL:this.footer.icon_url}:null}}}},function(e,t,s){(function(e){const i=s(31),n=s(19),r=s(49),o=s(4),a=s(22),l=s(17),h=s(8),c=s(7);class TextBasedChannel{constructor(){this.messages=new o,this.lastMessageID=null,this.lastMessage=null,this.lastPinTimestamp=null}send(t,s){s||"object"!=typeof t||t instanceof Array?s||(s={}):(s=t,t="");const{reply:n}=s;if(s instanceof a&&(s={files:[s.file]}),s instanceof l&&(s.reply&&(s.reply=void 0),s={embed:s}),s.reply=n,s.embed&&(s.embed.file&&(s.files?s.files.push(s.embed.file):s.files=[s.embed.file]),s.embed.files&&(s.files?s.files=s.files.concat(s.embed.files):s.files=s.embed.files)),s.file&&(s.files?s.files.push(s.file):s.files=[s.file]),s.embed&&(s.embed=new l(s.embed)._apiTransform()),s.files){for(let t=0;tthis.client.resolver.resolveFile(e.attachment).then(t=>(e.file=t,e)))).then(e=>this.client.rest.methods.sendMessage(this,t,s,e))}return this.client.rest.methods.sendMessage(this,t,s)}fetchMessage(e){return this.client.user.bot?this.client.rest.methods.getChannelMessage(this,e).then(e=>{const t=e instanceof n?e:new n(this,e,this.client);return this._cacheMessage(t),t}):this.fetchMessages({limit:1,around:e}).then(t=>{const s=t.get(e);if(!s)throw new Error("Message not found.");return s})}fetchMessages(e={}){return this.client.rest.methods.getChannelMessages(this,e).then(e=>{const t=new o;for(const s of e){const e=new n(this,s,this.client);t.set(s.id,e),this._cacheMessage(e)}return t})}fetchPinnedMessages(){return this.client.rest.methods.getChannelPinnedMessages(this).then(e=>{const t=new o;for(const s of e){const e=new n(this,s,this.client);t.set(s.id,e),this._cacheMessage(e)}return t})}search(e={}){return this.client.rest.methods.search(this,e)}startTyping(e){if(void 0!==e&&e<1)throw new RangeError("Count must be at least 1.");if(this.client.user._typing.has(this.id)){const t=this.client.user._typing.get(this.id);return void(t.count=e||t.count+1)}const t={count:e||1,interval:this.client.setInterval(()=>{this.client.rest.methods.sendTyping(this.id).catch(()=>{this.client.clearInterval(t.interval),this.client.user._typing.delete(this.id)})},9e3)};this.client.rest.methods.sendTyping(this.id).catch(()=>{this.client.clearInterval(t.interval),this.client.user._typing.delete(this.id)}),this.client.user._typing.set(this.id,t)}stopTyping(e=!1){if(this.client.user._typing.has(this.id)){const t=this.client.user._typing.get(this.id);t.count--,(t.count<=0||e)&&(this.client.clearInterval(t.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}get lastMessage(){return this.messages.get(this.lastMessageID)||null}get lastPinAt(){return this.lastPinTimestamp?new Date(this.lastPinTimestamp):null}createCollector(e,t){return this.createMessageCollector(e,t)}createMessageCollector(e,t={}){return new r(this,e,t)}awaitMessages(e,t={}){return new Promise((s,i)=>{this.createCollector(e,t).once("end",(e,n)=>{t.errors&&t.errors.includes(n)?i(e):s(e)})})}bulkDelete(e,t=!1){if(e instanceof Array||e instanceof o){let s=e instanceof o?e.keyArray():e.map(e=>e.id||e);return t&&(s=s.filter(e=>Date.now()-h.deconstruct(e).date.getTime()<12096e5)),0===s.length?Promise.resolve(new o):1===s.length?this.fetchMessage(s[0]).then(e=>e.delete()).then(e=>new o([[e.id,e]])):this.client.rest.methods.bulkDeleteMessages(this,s)}if(!isNaN(e))return this.fetchMessages({limit:e}).then(e=>this.bulkDelete(e,t));throw new TypeError("The messages must be an Array, Collection, or number.")}acknowledge(){return this.lastMessageID?this.client.rest.methods.ackTextChannel(this):Promise.resolve(this)}_cacheMessage(e){const t=this.client.options.messageCacheMaxSize;return 0===t?null:(this.messages.size>=t&&t>0&&this.messages.delete(this.messages.firstKey()),this.messages.set(e.id,e),e)}}const u={sendMessage(e,t){return this.send(e,t)},sendEmbed(e,t,s){return s||"object"!=typeof t||t instanceof Array?s||(s={}):(s=t,t=""),this.send(t,Object.assign(s,{embed:e}))},sendFiles(e,t,s={}){return this.send(t,Object.assign(s,{files:e}))},sendFile(e,t,s,i={}){return this.send({files:[{attachment:e,name:t}],content:s,options:i})},sendCode(e,t,s={}){return this.send(t,Object.assign(s,{code:e}))}};for(const e of Object.keys(u))TextBasedChannel.prototype[e]=c.deprecate(u[e],`TextChannel#${e}: use TextChannel#send instead`);t.applyToClass=((e,t=!1,s=[])=>{const i=["send","sendMessage","sendEmbed","sendFile","sendFiles","sendCode"];t&&i.push("_cacheMessage","acknowledge","fetchMessages","fetchMessage","search","lastMessage","lastPinAt","bulkDelete","startTyping","stopTyping","typing","typingCount","fetchPinnedMessages","createCollector","createMessageCollector","awaitMessages");for(const t of i)s.includes(t)||Object.defineProperty(e.prototype,t,Object.getOwnPropertyDescriptor(TextBasedChannel.prototype,t))}),TextBasedChannel.prototype.acknowledge=c.deprecate(TextBasedChannel.prototype.acknowledge,"TextBasedChannel#acknowledge: userbot methods will be removed"),TextBasedChannel.prototype.search=c.deprecate(TextBasedChannel.prototype.search,"TextBasedChannel#search: userbot methods will be removed")}).call(this,s(14).Buffer)},function(e,t,s){const i=s(45),n=s(46),r=s(29),o=s(17),a=s(47),l=s(48),h=s(5),c=s(4),u=s(0),d=s(6);let m;e.exports=class Message{constructor(e,t,s){Object.defineProperty(this,"client",{value:s}),this.channel=e,this.deleted=!1,t&&this.setup(t)}setup(e){this.id=e.id,this.type=u.MessageTypes[e.type],this.content=e.content,this.author=this.client.dataManager.newUser(e.author,!e.webhook_id),this.member=this.guild&&this.guild.member(this.author)||null,this.pinned=e.pinned,this.tts=e.tts,this.nonce=e.nonce,this.system=6===e.type,this.embeds=e.embeds.map(e=>new r(this,e)),this.attachments=new c;for(const t of e.attachments)this.attachments.set(t.id,new n(this,t));if(this.createdTimestamp=new Date(e.timestamp).getTime(),this.editedTimestamp=e.edited_timestamp?new Date(e.edited_timestamp).getTime():null,this.reactions=new c,e.reactions&&e.reactions.length>0)for(const t of e.reactions){const e=t.emoji.id?`${t.emoji.name}:${t.emoji.id}`:t.emoji.name;this.reactions.set(e,new a(this,t.emoji,t.count,t.me))}this.mentions=new i(this,e.mentions,e.mention_roles,e.mention_everyone),this.webhookID=e.webhook_id||null,this.hit="boolean"==typeof e.hit?e.hit:null,this._edits=[]}patch(e){const t=h.cloneObject(this);if(this._edits.unshift(t),"edited_timestamp"in e&&(this.editedTimestamp=new Date(e.edited_timestamp).getTime()),"content"in e&&(this.content=e.content),"pinned"in e&&(this.pinned=e.pinned),"tts"in e&&(this.tts=e.tts),this.embeds="embeds"in e?e.embeds.map(e=>new r(this,e)):this.embeds.slice(),"attachments"in e){this.attachments=new c;for(const t of e.attachments)this.attachments.set(t.id,new n(this,t))}else this.attachments=new c(this.attachments);this.mentions=new i(this,"mentions"in e?e.mentions:this.mentions.users,"mentions_roles"in e?e.mentions_roles:this.mentions.roles,"mention_everyone"in e?e.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 url(){return`https://discordapp.com/channels/${this.guild?this.guild.id:"@me"}/${this.channel.id}/${this.id}`}get cleanContent(){return this.content.replace(/@(everyone|here)/g,"@​$1").replace(/<@!?[0-9]+>/g,e=>{const t=e.replace(/<|!|>|@/g,"");if("dm"===this.channel.type||"group"===this.channel.type)return this.client.users.has(t)?`@${this.client.users.get(t).username}`:e;const s=this.channel.guild.members.get(t);if(s)return s.nickname?`@${s.nickname}`:`@${s.user.username}`;{const s=this.client.users.get(t);return s?`@${s.username}`:e}}).replace(/<#[0-9]+>/g,e=>{const t=this.client.channels.get(e.replace(/<|#|>/g,""));return t?`#${t.name}`:e}).replace(/<@&[0-9]+>/g,e=>{if("dm"===this.channel.type||"group"===this.channel.type)return e;const t=this.guild.roles.get(e.replace(/<|@|>|&/g,""));return t?`@${t.name}`:e})}createReactionCollector(e,t={}){return new l(this,e,t)}awaitReactions(e,t={}){return new Promise((s,i)=>{this.createReactionCollector(e,t).once("end",(e,n)=>{t.errors&&t.errors.includes(n)?i(e):s(e)})})}get edits(){const e=this._edits.slice();return e.unshift(this),e}get editable(){return this.author.id===this.client.user.id}get deletable(){return!this.deleted&&(this.author.id===this.client.user.id||this.guild&&this.channel.permissionsFor(this.client.user).has(d.FLAGS.MANAGE_MESSAGES))}get pinnable(){return"DEFAULT"===this.type&&(!this.guild||this.channel.permissionsFor(this.client.user).has(d.FLAGS.MANAGE_MESSAGES))}isMentioned(e){return e=e&&e.id?e.id:e,this.mentions.users.has(e)||this.mentions.channels.has(e)||this.mentions.roles.has(e)}isMemberMentioned(e){return m||(m=s(21)),!!this.mentions.everyone||!!this.mentions.users.has(e.id)||!!(e instanceof m&&e.roles.some(e=>this.mentions.roles.has(e.id)))}edit(e,t){return t||"object"!=typeof e||e instanceof Array?t||(t={}):(t=e,e=""),t instanceof o&&(t={embed:t}),this.client.rest.methods.updateMessage(this,e,t)}editCode(e,t){return t=h.escapeMarkdown(this.client.resolver.resolveString(t),!0),this.edit(`\`\`\`${e||""}\n${t}\n\`\`\``)}pin(){return this.client.rest.methods.pinMessage(this)}unpin(){return this.client.rest.methods.unpinMessage(this)}react(e){if(!(e=this.client.resolver.resolveEmojiIdentifier(e)))throw new TypeError("Emoji must be a string or Emoji/ReactionEmoji");return this.client.rest.methods.addMessageReaction(this,e)}clearReactions(){return this.client.rest.methods.removeMessageReactions(this)}delete(e=0){return e<=0?this.client.rest.methods.deleteMessage(this):new Promise(t=>{this.client.setTimeout(()=>{t(this.delete())},e)})}reply(e,t){return t||"object"!=typeof e||e instanceof Array?t||(t={}):(t=e,e=""),this.channel.send(e,Object.assign(t,{reply:this.member||this.author}))}acknowledge(){return this.client.rest.methods.ackMessage(this)}fetchWebhook(){return this.webhookID?this.client.fetchWebhook(this.webhookID):Promise.reject(new Error("The message was not sent by a webhook."))}equals(e,t){if(!e)return!1;if(!e.author&&!e.attachments)return this.id===e.id&&this.embeds.length===e.embeds.length;let s=this.id===e.id&&this.author.id===e.author.id&&this.content===e.content&&this.tts===e.tts&&this.nonce===e.nonce&&this.embeds.length===e.embeds.length&&this.attachments.length===e.attachments.length;return s&&t&&(s=this.mentions.everyone===e.mentions.everyone&&this.createdTimestamp===new Date(t.timestamp).getTime()&&this.editedTimestamp===new Date(t.edited_timestamp).getTime()),s}toString(){return this.content}_addReaction(e,t){const s=e.id?`${e.name}:${e.id}`:e.name;let i;return this.reactions.has(s)?(i=this.reactions.get(s)).me||(i.me=t.id===this.client.user.id):(i=new a(this,e,0,t.id===this.client.user.id),this.reactions.set(s,i)),i.users.has(t.id)||(i.users.set(t.id,t),i.count++),i}_removeReaction(e,t){const s=e.id?`${e.name}:${e.id}`:e.name;if(this.reactions.has(s)){const e=this.reactions.get(s);if(e.users.has(t.id))return e.users.delete(t.id),e.count--,t.id===this.client.user.id&&(e.me=!1),e.count<=0&&this.reactions.delete(s),e}return null}_clearReactions(){this.reactions.clear()}}},function(e,t,s){const i=s(0),n=s(4),r=s(6),o=s(8);class Emoji{constructor(e,t){Object.defineProperty(this,"client",{value:e.client}),this.guild=e,this.deleted=!1,this.setup(t)}setup(e){this.id=e.id,this.name=e.name,this.requiresColons=e.require_colons,this.managed=e.managed,this.animated=e.animated,this._roles=e.roles}get createdTimestamp(){return o.deconstruct(this.id).timestamp}get createdAt(){return new Date(this.createdTimestamp)}get deletable(){return!this.managed&&this.guild.me.hasPermission(r.FLAGS.MANAGE_EMOJIS)}get roles(){const e=new n;for(const t of this._roles)this.guild.roles.has(t)&&e.set(t,this.guild.roles.get(t));return e}get url(){return i.Endpoints.CDN(this.client.options.http.cdn).Emoji(this.id,this.animated?"gif":"png")}get identifier(){return this.id?`${this.name}:${this.id}`:encodeURIComponent(this.name)}edit(e,t){return this.client.rest.methods.updateEmoji(this,e,t)}setName(e,t){return this.edit({name:e},t)}fetchAuthor(){return this.managed?Promise.reject(new Error("Emoji is managed and has no Author.")):this.guild.me.permissions.has(r.FLAGS.MANAGE_EMOJIS)?this.client.rest.makeRequest("get",i.Endpoints.Guild(this.guild).Emoji(this.id),!0).then(e=>this.client.dataManager.newUser(e.user)):Promise.reject(new Error(`Client must have Manage Emoji permission in guild ${this.guild} to see emoji authors.`))}addRestrictedRole(e){return this.addRestrictedRoles([e])}addRestrictedRoles(e){const t=new n(this.roles);for(const s of e)this.guild.roles.has(s.id)&&t.set(s.id,s);return this.edit({roles:t})}removeRestrictedRole(e){return this.removeRestrictedRoles([e])}removeRestrictedRoles(e){const t=new n(this.roles);for(const s of e)t.has(s.id)&&t.delete(s.id);return this.edit({roles:t})}toString(){return this.id&&this.requiresColons?`<${this.animated?"a":""}:${this.name}:${this.id}>`:this.name}equals(e){return e instanceof Emoji?e.id===this.id&&e.name===this.name&&e.managed===this.managed&&e.requiresColons===this.requiresColons:e.id===this.id&&e.name===this.name}}e.exports=Emoji},function(e,t,s){const i=s(18),n=s(9),r=s(6),o=s(4),{Presence:a}=s(11),l=s(7);class GuildMember{constructor(e,t){Object.defineProperty(this,"client",{value:e.client}),this.guild=e,this.user={},this.joinedTimestamp=null,this._roles=[],t&&this.setup(t),this.lastMessageID=null,this.lastMessage=null,this.deleted=!1}setup(e){this.serverDeaf=e.deaf,this.serverMute=e.mute,this.selfMute=e.self_mute,this.selfDeaf=e.self_deaf,this.voiceSessionID=e.session_id,this.voiceChannelID=e.channel_id,this.speaking=!1,this.nickname=e.nick||null,e.joined_at&&(this.joinedTimestamp=new Date(e.joined_at).getTime()),this.user=e.user,this._roles=e.roles}get joinedAt(){return this.joinedTimestamp?new Date(this.joinedTimestamp):null}get presence(){return this.frozenPresence||this.guild.presences.get(this.id)||new a(void 0,this.client)}get roles(){const e=new o,t=this.guild.roles.get(this.guild.id);t&&e.set(t.id,t);for(const t of this._roles){const s=this.guild.roles.get(t);s&&e.set(s.id,s)}return e}get highestRole(){return this.roles.reduce((e,t)=>!e||t.comparePositionTo(e)>0?t:e)}get colorRole(){const e=this.roles.filter(e=>e.color);return e.size?e.reduce((e,t)=>!e||t.comparePositionTo(e)>0?t:e):null}get displayColor(){const e=this.colorRole;return e&&e.color||0}get displayHexColor(){const e=this.colorRole;return e&&e.hexColor||"#000000"}get hoistRole(){const e=this.roles.filter(e=>e.hoist);return e.size?e.reduce((e,t)=>!e||t.comparePositionTo(e)>0?t:e):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(this,r.ALL);let e=0;const t=this.roles;for(const s of t.values())e|=s.permissions;return new r(this,e)}get manageable(){return this.user.id!==this.guild.ownerID&&(this.user.id!==this.client.user.id&&this.guild.me.highestRole.comparePositionTo(this.highestRole)>0)}get kickable(){return this.manageable&&this.guild.me.permissions.has(r.FLAGS.KICK_MEMBERS)}get bannable(){return this.manageable&&this.guild.me.permissions.has(r.FLAGS.BAN_MEMBERS)}permissionsIn(e){if(!(e=this.client.resolver.resolveChannel(e))||!e.guild)throw new Error("Could not resolve channel to a guild channel.");return e.permissionsFor(this)}hasPermission(e,t=!1,s,i){return void 0===s&&(s=!t),void 0===i&&(i=!t),!(!i||this.user.id!==this.guild.ownerID)||this.roles.some(t=>t.hasPermission(e,void 0,s))}hasPermissions(e,t=!1){return!t&&this.user.id===this.guild.ownerID||this.hasPermission(e,t)}missingPermissions(e,t=!1){return e instanceof Array||(e=[e]),this.permissions.missing(e,t)}edit(e,t){return this.client.rest.methods.updateGuildMember(this,e,t)}setMute(e,t){return this.edit({mute:e},t)}setDeaf(e,t){return this.edit({deaf:e},t)}setVoiceChannel(e){return this.edit({channel:e})}setRoles(e,t){return this.edit({roles:e},t)}addRole(e,t){return e instanceof n||(e=this.guild.roles.get(e)),e?this.client.rest.methods.addMemberRole(this,e,t):Promise.reject(new TypeError("Supplied parameter was neither a Role nor a Snowflake."))}addRoles(e,t){let s;if(e instanceof o){s=this._roles.slice();for(const t of e.values())s.push(t.id)}else s=this._roles.concat(e);return this.edit({roles:s},t)}removeRole(e,t){return e instanceof n||(e=this.guild.roles.get(e)),e?this.client.rest.methods.removeMemberRole(this,e,t):Promise.reject(new TypeError("Supplied parameter was neither a Role nor a Snowflake."))}removeRoles(e,t){const s=this._roles.slice();if(e instanceof o)for(const t of e.values()){const e=s.indexOf(t.id);e>=0&&s.splice(e,1)}else for(const t of e){const e=s.indexOf(t instanceof n?t.id:t);e>=0&&s.splice(e,1)}return this.edit({roles:s},t)}setNickname(e,t){return this.edit({nick:e},t)}createDM(){return this.user.createDM()}deleteDM(){return this.user.deleteDM()}kick(e){return this.client.rest.methods.kickGuildMember(this.guild,this,e)}ban(e){return this.guild.ban(this,e)}toString(){return`<@${this.nickname?"!":""}${this.user.id}>`}send(){}sendMessage(){}sendEmbed(){}sendFile(){}sendCode(){}}i.applyToClass(GuildMember),GuildMember.prototype.hasPermissions=l.deprecate(GuildMember.prototype.hasPermissions,"GuildMember#hasPermissions is deprecated - use GuildMember#hasPermission, it now takes an array"),GuildMember.prototype.missingPermissions=l.deprecate(GuildMember.prototype.missingPermissions,"GuildMember#missingPermissions is deprecated - use GuildMember#permissions.missing, it now takes an array"),e.exports=GuildMember},function(e,t){e.exports=class Attachment{constructor(e,t){this.file=null,t?this.setAttachment(e,t):this._attach(e)}get name(){return this.file.name}get attachment(){return this.file.attachment}setAttachment(e,t){return this.file={attachment:e,name:t},this}setFile(e){return this.file={attachment:e},this}setName(e){return this.file.name=e,this}_attach(e,t){"string"==typeof e?this.file=e:this.setAttachment(e,t)}}},function(e,t,s){const i=s(7),n=s(28),r=s(10),o=s(9),a=s(20),l=s(11).Presence,h=s(21),c=s(0),u=s(4),d=s(5),m=s(8);class Guild{constructor(e,t){Object.defineProperty(this,"client",{value:e}),this.members=new u,this.channels=new u,this.roles=new u,this.presences=new u,this.deleted=!1,t&&(t.unavailable?(this.available=!1,this.id=t.id):(this.setup(t),t.channels||(this.available=!1)))}setup(e){if(this.name=e.name,this.icon=e.icon,this.splash=e.splash,this.region=e.region,this.memberCount=e.member_count||this.memberCount,this.large=Boolean("large"in e?e.large:this.large),this.features=e.features,this.applicationID=e.application_id,this.afkTimeout=e.afk_timeout,this.afkChannelID=e.afk_channel_id,this.systemChannelID=e.system_channel_id,this.embedEnabled=e.embed_enabled,this.verificationLevel=e.verification_level,this.explicitContentFilter=e.explicit_content_filter,this.mfaLevel=e.mfa_level,this.joinedTimestamp=e.joined_at?new Date(e.joined_at).getTime():this.joinedTimestamp,this.defaultMessageNotifications=c.DefaultMessageNotifications[e.default_message_notifications]||e.default_message_notifications,this.id=e.id,this.available=!e.unavailable,this.features=e.features||this.features||[],e.members){this.members.clear();for(const t of e.members)this._addMember(t,!1)}if(e.owner_id&&(this.ownerID=e.owner_id),e.channels){this.channels.clear();for(const t of e.channels)this.client.dataManager.newChannel(t,this)}if(e.roles){this.roles.clear();for(const t of e.roles){const e=new o(this,t);this.roles.set(e.id,e)}}if(e.presences)for(const t of e.presences)this._setPresence(t.user.id,t);if(this._rawVoiceStates=new u,e.voice_states)for(const t of e.voice_states){this._rawVoiceStates.set(t.user_id,t);const e=this.members.get(t.user_id),s=this.channels.get(t.channel_id);e&&s&&(e.serverMute=t.mute,e.serverDeaf=t.deaf,e.selfMute=t.self_mute,e.selfDeaf=t.self_deaf,e.voiceSessionID=t.session_id,e.voiceChannelID=t.channel_id,s.members.set(e.user.id,e))}if(this.emojis)this.client.actions.GuildEmojisUpdate.handle({guild_id:this.id,emojis:e.emojis});else{this.emojis=new u;for(const t of e.emojis)this.emojis.set(t.id,new a(this,t))}}get createdTimestamp(){return m.deconstruct(this.id).timestamp}get createdAt(){return new Date(this.createdTimestamp)}get joinedAt(){return new Date(this.joinedTimestamp)}get verified(){return this.features.includes("VERIFIED")}get iconURL(){return this.icon?c.Endpoints.Guild(this).Icon(this.client.options.http.cdn,this.icon):null}get nameAcronym(){return this.name.replace(/\w+/g,e=>e[0]).replace(/\s/g,"")}get splashURL(){return this.splash?c.Endpoints.Guild(this).Splash(this.client.options.http.cdn,this.splash):null}get owner(){return this.members.get(this.ownerID)}get afkChannel(){return this.client.channels.get(this.afkChannelID)||null}get systemChannel(){return this.client.channels.get(this.systemChannelID)||null}get voiceConnection(){return this.client.browser?null:this.client.voice.connections.get(this.id)||null}get position(){return this.client.user.bot?null:this.client.user.settings.guildPositions?this.client.user.settings.guildPositions.indexOf(this.id):null}get muted(){if(this.client.user.bot)return null;try{return this.client.user.guildSettings.get(this.id).muted}catch(e){return!1}}get messageNotifications(){if(this.client.user.bot)return null;try{return this.client.user.guildSettings.get(this.id).messageNotifications}catch(e){return null}}get mobilePush(){if(this.client.user.bot)return null;try{return this.client.user.guildSettings.get(this.id).mobilePush}catch(e){return!1}}get suppressEveryone(){if(this.client.user.bot)return null;try{return this.client.user.guildSettings.get(this.id).suppressEveryone}catch(e){return 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(e){return this.client.resolver.resolveGuildMember(this,e)}fetchBan(e){return this.client.rest.methods.getGuildBan(this,e)}fetchBans(e=!1){return e?this.client.rest.methods.getGuildBans(this):this.client.rest.methods.getGuildBans(this).then(e=>{const t=new u;for(const s of e.values())t.set(s.user.id,s.user);return t})}fetchInvites(){return this.client.rest.methods.getGuildInvites(this)}fetchVanityCode(){return this.features.includes("VANITY_URL")?this.client.rest.methods.getGuildVanityCode(this):Promise.reject(new Error("This guild does not have the VANITY_URL feature enabled."))}fetchWebhooks(){return this.client.rest.methods.getGuildWebhooks(this)}fetchVoiceRegions(){return this.client.rest.methods.fetchVoiceRegions(this.id)}fetchEmbed(){return this.client.rest.methods.fetchEmbed(this.id)}fetchAuditLogs(e){return this.client.rest.methods.getGuildAuditLogs(this,e)}addMember(e,t){return e=this.client.resolver.resolveUserID(e),this.members.has(e)?Promise.resolve(this.members.get(e)):this.client.rest.methods.putGuildMember(this,e,t)}fetchMember(e,t=!0){if(!(e=this.client.resolver.resolveUser(e)))return Promise.reject(new Error("Invalid or uncached id provided."));const s=this.members.get(e.id);return s&&s.joinedTimestamp?Promise.resolve(s):this.client.rest.methods.getGuildMember(this,e,t)}fetchMembers(e="",t=0){return new Promise((s,i)=>{if(this.memberCount===this.members.size)return void s(this);this.client.ws.send({op:c.OPCodes.REQUEST_GUILD_MEMBERS,d:{guild_id:this.id,query:e,limit:t}});const n=(e,t)=>{t.id===this.id&&(this.memberCount===this.members.size||e.length<1e3)&&(this.client.removeListener(c.Events.GUILD_MEMBERS_CHUNK,n),s(this))};this.client.on(c.Events.GUILD_MEMBERS_CHUNK,n),this.client.setTimeout(()=>i(new Error("Members didn't arrive in time.")),12e4)})}search(e={}){return this.client.rest.methods.search(this,e)}edit(e,t){const s={};return e.name&&(s.name=e.name),e.region&&(s.region=e.region),void 0!==e.verificationLevel&&(s.verification_level=Number(e.verificationLevel)),void 0!==e.afkChannel&&(s.afk_channel_id=this.client.resolver.resolveChannelID(e.afkChannel)),void 0!==e.systemChannel&&(s.system_channel_id=this.client.resolver.resolveChannelID(e.systemChannel)),e.afkTimeout&&(s.afk_timeout=Number(e.afkTimeout)),void 0!==e.icon&&(s.icon=e.icon),e.owner&&(s.owner_id=this.client.resolver.resolveUser(e.owner).id),void 0!==e.splash&&(s.splash=e.splash),void 0!==e.explicitContentFilter&&(s.explicit_content_filter=Number(e.explicitContentFilter)),void 0!==e.defaultMessageNotifications&&(s.default_message_notifications="string"==typeof e.defaultMessageNotifications?c.DefaultMessageNotifications.indexOf(e.defaultMessageNotifications):Number(e.defaultMessageNotifications)),this.client.rest.methods.updateGuild(this,s,t)}setExplicitContentFilter(e,t){return this.edit({explicitContentFilter:e},t)}setDefaultMessageNotifications(e,t){return this.edit({defaultMessageNotifications:e},t)}setName(e,t){return this.edit({name:e},t)}setRegion(e,t){return this.edit({region:e},t)}setVerificationLevel(e,t){return this.edit({verificationLevel:e},t)}setAFKChannel(e,t){return this.edit({afkChannel:e},t)}setSystemChannel(e,t){return this.edit({systemChannel:e},t)}setAFKTimeout(e,t){return this.edit({afkTimeout:e},t)}setIcon(e,t){return this.client.resolver.resolveImage(e).then(e=>this.edit({icon:e,reason:t}))}setOwner(e,t){return this.edit({owner:e},t)}setSplash(e){return this.client.resolver.resolveImage(e).then(e=>this.edit({splash:e}))}setPosition(e,t){return this.client.user.bot?Promise.reject(new Error("Setting guild position is only available for user accounts")):this.client.user.settings.setGuildPosition(this,e,t)}acknowledge(){return this.client.rest.methods.ackGuild(this)}allowDMs(e){const t=this.client.user.settings;return e?t.removeRestrictedGuild(this):t.addRestrictedGuild(this)}ban(e,t={}){return"number"==typeof t?t={reason:null,"delete-message-days":t}:"string"==typeof t&&(t={reason:t,"delete-message-days":0}),t.days&&(t["delete-message-days"]=t.days),this.client.rest.methods.banGuildMember(this,e,t)}unban(e,t){return this.client.rest.methods.unbanGuildMember(this,e,t)}pruneMembers(e,t=!1,s){if("number"!=typeof e)throw new TypeError("Days must be a number.");return this.client.rest.methods.pruneGuildMembers(this,e,t,s)}sync(){this.client.user.bot||this.client.syncGuilds([this])}createChannel(e,t,s,i){return t&&"string"!=typeof t||(t&&((e,...t)=>console.warn("Guild#createChannel: Create channels with an options object instead of separate parameters",t))(0,"DeprecationWarning"),t={type:t,permissionOverwrites:s,reason:i}),this.client.rest.methods.createChannel(this,e,t)}setChannelPositions(e){return this.client.rest.methods.updateChannelPositions(this.id,e)}setEmbed(e,t){return this.client.rest.methods.updateEmbed(this.id,e,t).then(()=>this)}createRole(e={},t){return this.client.rest.methods.createGuildRole(this,e,t)}createEmoji(e,t,s,i){return"string"==typeof e&&e.startsWith("data:")?this.client.rest.methods.createEmoji(this,e,t,s,i):this.client.resolver.resolveImage(e).then(e=>this.client.rest.methods.createEmoji(this,e,t,s,i))}deleteEmoji(e,t){if("string"==typeof e&&(e=this.emojis.get(e)),!(e instanceof a))throw new TypeError("Emoji must be either an instance of Emoji or an ID");return this.client.rest.methods.deleteEmoji(e,t)}leave(){return this.client.rest.methods.leaveGuild(this)}delete(){return this.client.rest.methods.deleteGuild(this)}equals(e){let t=e&&this.id===e.id&&this.available===!e.unavailable&&this.splash===e.splash&&this.region===e.region&&this.name===e.name&&this.memberCount===e.member_count&&this.large===e.large&&this.icon===e.icon&&d.arraysEqual(this.features,e.features)&&this.ownerID===e.owner_id&&this.verificationLevel===e.verification_level&&this.embedEnabled===e.embed_enabled;return t&&(this.embedChannel?this.embedChannel.id!==e.embed_channel_id&&(t=!1):e.embed_channel_id&&(t=!1)),t}toString(){return this.name}_addMember(e,t=!0){const s=this.members.has(e.user.id);e.user instanceof r||(e.user=this.client.dataManager.newUser(e.user)),e.joined_at=e.joined_at||0;const i=new h(this,e);if(this.members.set(i.id,i),this._rawVoiceStates&&this._rawVoiceStates.has(i.user.id)){const e=this._rawVoiceStates.get(i.user.id);i.serverMute=e.mute,i.serverDeaf=e.deaf,i.selfMute=e.self_mute,i.selfDeaf=e.self_deaf,i.voiceSessionID=e.session_id,i.voiceChannelID=e.channel_id,this.client.channels.has(e.channel_id)?this.client.channels.get(e.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===c.Status.READY&&t&&!s&&this.client.emit(c.Events.GUILD_MEMBER_ADD,i),i}_updateMember(e,t){const s=d.cloneObject(e);t.roles&&(e._roles=t.roles),void 0!==t.nick&&(e.nickname=t.nick);const i=e.nickname!==s.nickname||!d.arraysEqual(e._roles,s._roles);return this.client.ws.connection.status===c.Status.READY&&i&&this.client.emit(c.Events.GUILD_MEMBER_UPDATE,s,e),{old:s,mem:e}}_removeMember(e){e.voiceChannel&&e.voiceChannel.members.delete(e.id),this.members.delete(e.id)}_memberSpeakUpdate(e,t){const s=this.members.get(e);s&&s.speaking!==t&&(s.speaking=t,this.client.emit(c.Events.GUILD_MEMBER_SPEAKING,s,t))}_setPresence(e,t){this.presences.get(e)?this.presences.get(e).update(t):this.presences.set(e,new l(t,this.client))}setRolePosition(e,t,s=!1){if("string"==typeof e&&!(e=this.roles.get(e)))return Promise.reject(new Error("Supplied role is not a role or snowflake."));if(t=Number(t),isNaN(t))return Promise.reject(new Error("Supplied position is not a number."));let i=this._sortedRoles.array();return d.moveElementInArray(i,e,t,s),i=i.map((e,t)=>({id:e.id,position:t})),this.client.rest.methods.setRolePositions(this.id,i)}setChannelPosition(e,t,s=!1){if("string"==typeof e&&!(e=this.channels.get(e)))return Promise.reject(new Error("Supplied channel is not a channel or snowflake."));if(t=Number(t),isNaN(t))return Promise.reject(new Error("Supplied position is not a number."));let i=this._sortedChannels(e.type).array();return d.moveElementInArray(i,e,t,s),i=i.map((e,t)=>({id:e.id,position:t})),this.client.rest.methods.setChannelPositions(this.id,i)}_sortedChannels(e){return this._sortPositionWithID(this.channels.filter(t=>"voice"===e&&"voice"===t.type||("voice"!==e&&"voice"!==t.type||e===t.type)))}_sortPositionWithID(e){return e.sort((e,t)=>e.position!==t.position?e.position-t.position:n.fromString(t.id).sub(n.fromString(e.id)).toNumber())}}Object.defineProperty(Guild.prototype,"defaultChannel",{get:i.deprecate(function(){return this.channels.get(this.id)},"Guild#defaultChannel: This property is obsolete, will be removed in v12.0.0, and may not function as expected.")}),Guild.prototype.allowDMs=i.deprecate(Guild.prototype.allowDMs,"Guild#allowDMs: userbot methods will be removed"),Guild.prototype.acknowledge=i.deprecate(Guild.prototype.acknowledge,"Guild#acknowledge: userbot methods will be removed"),Guild.prototype.setPosition=i.deprecate(Guild.prototype.setPosition,"Guild#setPosition: userbot methods will be removed"),Guild.prototype.search=i.deprecate(Guild.prototype.search,"Guild#search: userbot methods will be removed"),Guild.prototype.sync=i.deprecate(Guild.prototype.sync,"Guild#sync:, userbot methods will be removed"),e.exports=Guild},function(e,t,s){const i=s(50),n=s(51),r=s(0);e.exports=class Invite{constructor(e,t){Object.defineProperty(this,"client",{value:e}),this.setup(t)}setup(e){this.guild=this.client.guilds.get(e.guild.id)||new i(this.client,e.guild),this.code=e.code,this.presenceCount=e.approximate_presence_count,this.memberCount=e.approximate_member_count,this.textChannelCount=e.guild.text_channel_count,this.voiceChannelCount=e.guild.voice_channel_count,this.temporary=e.temporary,this.maxAge=e.max_age,this.uses=e.uses,this.maxUses=e.max_uses,e.inviter&&(this.inviter=this.client.dataManager.newUser(e.inviter)),this.channel=this.client.channels.get(e.channel.id)||new n(this.client,e.channel),this.createdTimestamp=new Date(e.created_at).getTime()}get createdAt(){return new Date(this.createdTimestamp)}get expiresTimestamp(){return this.createdTimestamp+1e3*this.maxAge}get expiresAt(){return new Date(this.expiresTimestamp)}get url(){return r.Endpoints.inviteLink(this.code)}delete(e){return this.client.rest.methods.deleteInvite(this,e)}toString(){return this.url}}},function(e,t,s){(function(t){const i=s(16),n=s(31),r=s(5),o=s(22),a=s(17);e.exports=class Webhook extends i{constructor(e,t,s){super(),e?(Object.defineProperty(this,"client",{value:e}),t&&this.setup(t)):(this.id=t,this.token=s,Object.defineProperty(this,"client",{value:this}))}setup(e){this.name=e.name,Object.defineProperty(this,"token",{value:e.token,writable:!0,configurable:!0}),this.avatar=e.avatar,this.id=e.id,this.guildID=e.guild_id,this.channelID=e.channel_id,e.user?this.owner=this.client.users?this.client.users.get(e.user.id):e.user:this.owner=null}send(e,s){if(s||"object"!=typeof e||e instanceof Array?s||(s={}):(s=e,e=""),s instanceof o&&(s={files:[s]}),s instanceof a&&(s={embeds:[s]}),e){e=this.client.resolver.resolveString(e);let{split:t,code:i,disableEveryone:n}=s;t&&"object"!=typeof t&&(t={}),void 0===i||"boolean"==typeof i&&!0!==i||(e=r.escapeMarkdown(e,!0),e=`\`\`\`${"boolean"!=typeof i&&i||""}\n${e}\n\`\`\``,t&&(t.prepend=`\`\`\`${"boolean"!=typeof i&&i||""}\n`,t.append="\n```")),(n||void 0===n&&this.client.options.disableEveryone)&&(e=e.replace(/@(everyone|here)/g,"@​$1")),t&&(e=r.splitMessage(e,t))}if(s.file&&(s.files?s.files.push(s.file):s.files=[s.file]),s.embeds){const e=[];for(const t of s.embeds)t.file&&e.push(t.file);s.files?s.files.push(...e):s.files=e}if(s.embeds&&(s.embeds=s.embeds.map(e=>new a(e)._apiTransform())),s.files){for(let e=0;ethis.client.resolver.resolveFile(e.attachment).then(t=>(e.file=t,e)))).then(t=>this.client.rest.methods.sendWebhookMessage(this,e,s,t))}return this.client.rest.methods.sendWebhookMessage(this,e,s)}sendMessage(e,t={}){return this.send(e,t)}sendFile(e,t,s,i={}){return this.send(s,Object.assign(i,{file:{attachment:e,name:t}}))}sendCode(e,t,s={}){return this.send(t,Object.assign(s,{code:e}))}sendSlackMessage(e){return this.client.rest.methods.sendSlackWebhookMessage(this,e)}edit(e=this.name,t){return t?this.client.resolver.resolveImage(t).then(t=>this.client.rest.methods.editWebhook(this,e,t)):this.client.rest.methods.editWebhook(this,e)}delete(e){return this.client.rest.methods.deleteWebhook(this,e)}}}).call(this,s(14).Buffer)},function(e,t,s){const i=s(13),n=s(18),r=s(4);class TextChannel extends i{constructor(e,t){super(e,t),this.type="text",this.messages=new r,this._typing=new Map}setup(e){super.setup(e),this.topic=e.topic,this.nsfw=Boolean(e.nsfw),this.lastMessageID=e.last_message_id,this.lastPinTimestamp=e.last_pin_timestamp?new Date(e.last_pin_timestamp).getTime():null,this.rateLimitPerUser=e.rate_limit_per_user||0}get members(){const e=new r;for(const t of this.guild.members.values())this.permissionsFor(t).has("READ_MESSAGES")&&e.set(t.id,t);return e}fetchWebhooks(){return this.client.rest.methods.getChannelWebhooks(this)}setNSFW(e,t){return this.edit({nsfw:e},t)}createWebhook(e,t,s){return"string"==typeof t&&t.startsWith("data:")?this.client.rest.methods.createWebhook(this,e,t,s):this.client.resolver.resolveImage(t).then(t=>this.client.rest.methods.createWebhook(this,e,t,s))}setRateLimitPerUser(e,t){return this.edit({rateLimitPerUser:e},t)}get lastMessage(){}get lastPinAt(){}send(){}sendMessage(){}sendEmbed(){}sendFile(){}sendFiles(){}sendCode(){}fetchMessage(){}fetchMessages(){}fetchPinnedMessages(){}search(){}startTyping(){}stopTyping(){}get typing(){}get typingCount(){}createCollector(){}createMessageCollector(){}awaitMessages(){}bulkDelete(){}acknowledge(){}_cacheMessage(){}}n.applyToClass(TextChannel,!0),e.exports=TextChannel},function(e,t,s){"use strict";s.r(t),s.d(t,"version",function(){return n}),s.d(t,"METHODS",function(){return r}),s.d(t,"acl",function(){return o}),s.d(t,"bind",function(){return a}),s.d(t,"checkout",function(){return l}),s.d(t,"connect",function(){return h}),s.d(t,"copy",function(){return c}),s.d(t,"delete",function(){return u}),s.d(t,"get",function(){return d}),s.d(t,"head",function(){return m}),s.d(t,"link",function(){return p}),s.d(t,"lock",function(){return f}),s.d(t,"merge",function(){return g}),s.d(t,"mkactivity",function(){return E}),s.d(t,"mkcalendar",function(){return _}),s.d(t,"mkcol",function(){return v}),s.d(t,"move",function(){return b}),s.d(t,"notify",function(){return y}),s.d(t,"options",function(){return w}),s.d(t,"patch",function(){return A}),s.d(t,"post",function(){return T}),s.d(t,"propfind",function(){return R}),s.d(t,"proppatch",function(){return M}),s.d(t,"purge",function(){return D}),s.d(t,"put",function(){return C}),s.d(t,"rebind",function(){return S}),s.d(t,"report",function(){return I}),s.d(t,"search",function(){return U}),s.d(t,"subscribe",function(){return N}),s.d(t,"trace",function(){return O}),s.d(t,"unbind",function(){return P}),s.d(t,"unlink",function(){return L}),s.d(t,"unlock",function(){return k}),s.d(t,"unsubscribe",function(){return G}),s.d(t,"brew",function(){return x});var i=s(2);t.default=i;const n=i.version,r=i.METHODS,o=i.acl,a=i.bind,l=i.checkout,h=i.connect,c=i.copy,u=i.delete,d=i.get,m=i.head,p=i.link,f=i.lock,g=i.merge,E=i.mkactivity,_=i.mkcalendar,v=i.mkcol,b=i.move,y=i.notify,w=i.options,A=i.patch,T=i.post,R=i.propfind,M=i.proppatch,D=i.purge,C=i.put,S=i.rebind,I=i.report,U=i.search,N=i.subscribe,O=i.trace,P=i.unbind,L=i.unlink,k=i.unlock,G=i.unsubscribe,x=i.brew},function(e,t){e.exports=i;var s=null;try{s=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch(e){}function i(e,t,s){this.low=0|e,this.high=0|t,this.unsigned=!!s}function n(e){return!0===(e&&e.__isLong__)}i.prototype.__isLong__,Object.defineProperty(i.prototype,"__isLong__",{value:!0}),i.isLong=n;var r={},o={};function a(e,t){var s,i,n;return t?(n=0<=(e>>>=0)&&e<256)&&(i=o[e])?i:(s=h(e,(0|e)<0?-1:0,!0),n&&(o[e]=s),s):(n=-128<=(e|=0)&&e<128)&&(i=r[e])?i:(s=h(e,e<0?-1:0,!1),n&&(r[e]=s),s)}function l(e,t){if(isNaN(e))return t?_:E;if(t){if(e<0)return _;if(e>=p)return A}else{if(e<=-f)return T;if(e+1>=f)return w}return e<0?l(-e,t).neg():h(e%m|0,e/m|0,t)}function h(e,t,s){return new i(e,t,s)}i.fromInt=a,i.fromNumber=l,i.fromBits=h;var c=Math.pow;function u(e,t,s){if(0===e.length)throw Error("empty string");if("NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return E;if("number"==typeof t?(s=t,t=!1):t=!!t,(s=s||10)<2||360)throw Error("interior hyphen");if(0===i)return u(e.substring(1),t,s).neg();for(var n=l(c(s,8)),r=E,o=0;o>>0:this.low},R.toNumber=function(){return this.unsigned?(this.high>>>0)*m+(this.low>>>0):this.high*m+(this.low>>>0)},R.toString=function(e){if((e=e||10)<2||36>>0).toString(e);if((r=a).isZero())return h+o;for(;h.length<6;)h="0"+h;o=""+h+o}},R.getHighBits=function(){return this.high},R.getHighBitsUnsigned=function(){return this.high>>>0},R.getLowBits=function(){return this.low},R.getLowBitsUnsigned=function(){return this.low>>>0},R.getNumBitsAbs=function(){if(this.isNegative())return this.eq(T)?64:this.neg().getNumBitsAbs();for(var e=0!=this.high?this.high:this.low,t=31;t>0&&0==(e&1<=0},R.isOdd=function(){return 1==(1&this.low)},R.isEven=function(){return 0==(1&this.low)},R.equals=function(e){return n(e)||(e=d(e)),(this.unsigned===e.unsigned||this.high>>>31!=1||e.high>>>31!=1)&&(this.high===e.high&&this.low===e.low)},R.eq=R.equals,R.notEquals=function(e){return!this.eq(e)},R.neq=R.notEquals,R.ne=R.notEquals,R.lessThan=function(e){return this.comp(e)<0},R.lt=R.lessThan,R.lessThanOrEqual=function(e){return this.comp(e)<=0},R.lte=R.lessThanOrEqual,R.le=R.lessThanOrEqual,R.greaterThan=function(e){return this.comp(e)>0},R.gt=R.greaterThan,R.greaterThanOrEqual=function(e){return this.comp(e)>=0},R.gte=R.greaterThanOrEqual,R.ge=R.greaterThanOrEqual,R.compare=function(e){if(n(e)||(e=d(e)),this.eq(e))return 0;var t=this.isNegative(),s=e.isNegative();return t&&!s?-1:!t&&s?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1},R.comp=R.compare,R.negate=function(){return!this.unsigned&&this.eq(T)?T:this.not().add(v)},R.neg=R.negate,R.add=function(e){n(e)||(e=d(e));var t=this.high>>>16,s=65535&this.high,i=this.low>>>16,r=65535&this.low,o=e.high>>>16,a=65535&e.high,l=e.low>>>16,c=0,u=0,m=0,p=0;return m+=(p+=r+(65535&e.low))>>>16,u+=(m+=i+l)>>>16,c+=(u+=s+a)>>>16,c+=t+o,h((m&=65535)<<16|(p&=65535),(c&=65535)<<16|(u&=65535),this.unsigned)},R.subtract=function(e){return n(e)||(e=d(e)),this.add(e.neg())},R.sub=R.subtract,R.multiply=function(e){if(this.isZero())return E;if(n(e)||(e=d(e)),s)return h(s.mul(this.low,this.high,e.low,e.high),s.get_high(),this.unsigned);if(e.isZero())return E;if(this.eq(T))return e.isOdd()?T:E;if(e.eq(T))return this.isOdd()?T:E;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(g)&&e.lt(g))return l(this.toNumber()*e.toNumber(),this.unsigned);var t=this.high>>>16,i=65535&this.high,r=this.low>>>16,o=65535&this.low,a=e.high>>>16,c=65535&e.high,u=e.low>>>16,m=65535&e.low,p=0,f=0,_=0,v=0;return _+=(v+=o*m)>>>16,f+=(_+=r*m)>>>16,_&=65535,f+=(_+=o*u)>>>16,p+=(f+=i*m)>>>16,f&=65535,p+=(f+=r*u)>>>16,f&=65535,p+=(f+=o*c)>>>16,p+=t*m+i*u+r*c+o*a,h((_&=65535)<<16|(v&=65535),(p&=65535)<<16|(f&=65535),this.unsigned)},R.mul=R.multiply,R.divide=function(e){if(n(e)||(e=d(e)),e.isZero())throw Error("division by zero");var t,i,r;if(s)return this.unsigned||-2147483648!==this.high||-1!==e.low||-1!==e.high?h((this.unsigned?s.div_u:s.div_s)(this.low,this.high,e.low,e.high),s.get_high(),this.unsigned):this;if(this.isZero())return this.unsigned?_:E;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return _;if(e.gt(this.shru(1)))return b;r=_}else{if(this.eq(T))return e.eq(v)||e.eq(y)?T:e.eq(T)?v:(t=this.shr(1).div(e).shl(1)).eq(E)?e.isNegative()?v:y:(i=this.sub(e.mul(t)),r=t.add(i.div(e)));else if(e.eq(T))return this.unsigned?_:E;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();r=E}for(i=this;i.gte(e);){t=Math.max(1,Math.floor(i.toNumber()/e.toNumber()));for(var o=Math.ceil(Math.log(t)/Math.LN2),a=o<=48?1:c(2,o-48),u=l(t),m=u.mul(e);m.isNegative()||m.gt(i);)m=(u=l(t-=a,this.unsigned)).mul(e);u.isZero()&&(u=v),r=r.add(u),i=i.sub(m)}return r},R.div=R.divide,R.modulo=function(e){return n(e)||(e=d(e)),s?h((this.unsigned?s.rem_u:s.rem_s)(this.low,this.high,e.low,e.high),s.get_high(),this.unsigned):this.sub(this.div(e).mul(e))},R.mod=R.modulo,R.rem=R.modulo,R.not=function(){return h(~this.low,~this.high,this.unsigned)},R.and=function(e){return n(e)||(e=d(e)),h(this.low&e.low,this.high&e.high,this.unsigned)},R.or=function(e){return n(e)||(e=d(e)),h(this.low|e.low,this.high|e.high,this.unsigned)},R.xor=function(e){return n(e)||(e=d(e)),h(this.low^e.low,this.high^e.high,this.unsigned)},R.shiftLeft=function(e){return n(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?h(this.low<>>32-e,this.unsigned):h(0,this.low<>>e|this.high<<32-e,this.high>>e,this.unsigned):h(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},R.shr=R.shiftRight,R.shiftRightUnsigned=function(e){if(n(e)&&(e=e.toInt()),0===(e&=63))return this;var t=this.high;return e<32?h(this.low>>>e|t<<32-e,t>>>e,this.unsigned):h(32===e?t:t>>>e-32,0,this.unsigned)},R.shru=R.shiftRightUnsigned,R.shr_u=R.shiftRightUnsigned,R.toSigned=function(){return this.unsigned?h(this.low,this.high,!1):this},R.toUnsigned=function(){return this.unsigned?this:h(this.low,this.high,!0)},R.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},R.toBytesLE=function(){var e=this.high,t=this.low;return[255&t,t>>>8&255,t>>>16&255,t>>>24,255&e,e>>>8&255,e>>>16&255,e>>>24]},R.toBytesBE=function(){var e=this.high,t=this.low;return[e>>>24,e>>>16&255,e>>>8&255,255&e,t>>>24,t>>>16&255,t>>>8&255,255&t]},i.fromBytes=function(e,t,s){return s?i.fromBytesLE(e,t):i.fromBytesBE(e,t)},i.fromBytesLE=function(e,t){return new i(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24,t)},i.fromBytesBE=function(e,t){return new i(e[4]<<24|e[5]<<16|e[6]<<8|e[7],e[0]<<24|e[1]<<16|e[2]<<8|e[3],t)}},function(e,t){class MessageEmbed{constructor(e,t){Object.defineProperty(this,"client",{value:e.client}),this.message=e,this.setup(t)}setup(e){if(this.type=e.type,this.title=e.title,this.description=e.description,this.url=e.url,this.color=e.color,this.fields=[],e.fields)for(const t of e.fields)this.fields.push(new MessageEmbedField(this,t));this.timestamp=e.timestamp,this.thumbnail=e.thumbnail?new MessageEmbedThumbnail(this,e.thumbnail):null,this.image=e.image?new MessageEmbedImage(this,e.image):null,this.video=e.video?new MessageEmbedVideo(this,e.video):null,this.author=e.author?new MessageEmbedAuthor(this,e.author):null,this.provider=e.provider?new MessageEmbedProvider(this,e.provider):null,this.footer=e.footer?new MessageEmbedFooter(this,e.footer):null}get createdAt(){return new Date(this.createdTimestamp)}get hexColor(){if(!this.color)return null;let e=this.color.toString(16);for(;e.length<6;)e=`0${e}`;return`#${e}`}}class MessageEmbedThumbnail{constructor(e,t){this.embed=e,this.setup(t)}setup(e){this.url=e.url,this.proxyURL=e.proxy_url,this.height=e.height,this.width=e.width}}class MessageEmbedImage{constructor(e,t){this.embed=e,this.setup(t)}setup(e){this.url=e.url,this.proxyURL=e.proxy_url,this.height=e.height,this.width=e.width}}class MessageEmbedVideo{constructor(e,t){this.embed=e,this.setup(t)}setup(e){this.url=e.url,this.height=e.height,this.width=e.width}}class MessageEmbedProvider{constructor(e,t){this.embed=e,this.setup(t)}setup(e){this.name=e.name,this.url=e.url}}class MessageEmbedAuthor{constructor(e,t){this.embed=e,this.setup(t)}setup(e){this.name=e.name,this.url=e.url,this.iconURL=e.icon_url}}class MessageEmbedField{constructor(e,t){this.embed=e,this.setup(t)}setup(e){this.name=e.name,this.value=e.value,this.inline=e.inline}}class MessageEmbedFooter{constructor(e,t){this.embed=e,this.setup(t)}setup(e){this.text=e.text,this.iconURL=e.icon_url,this.proxyIconUrl=e.proxy_icon_url}}MessageEmbed.Thumbnail=MessageEmbedThumbnail,MessageEmbed.Image=MessageEmbedImage,MessageEmbed.Video=MessageEmbedVideo,MessageEmbed.Provider=MessageEmbedProvider,MessageEmbed.Author=MessageEmbedAuthor,MessageEmbed.Field=MessageEmbedField,MessageEmbed.Footer=MessageEmbedFooter,e.exports=MessageEmbed},function(e,t,s){(function(t){const i=s(31),n=s(44),r=s(27),o=s(0),a=s(5).convertToBuffer,l=s(10),h=s(19),c=s(23),u=s(12),d=s(21),m=s(20),p=s(32),f=s(9);e.exports=class ClientDataResolver{constructor(e){this.client=e}resolveUser(e){return e instanceof l?e:"string"==typeof e?this.client.users.get(e)||null:e instanceof d?e.user:e instanceof h?e.author:e instanceof c?e.owner:null}resolveUserID(e){return e instanceof l||e instanceof d?e.id:"string"==typeof e?e||null:e instanceof h?e.author.id:e instanceof c?e.ownerID:null}resolveGuild(e){return e instanceof c?e:"string"==typeof e&&this.client.guilds.get(e)||null}resolveGuildMember(e,t){return t instanceof d?t:(e=this.resolveGuild(e),t=this.resolveUser(t),e&&t&&e.members.get(t.id)||null)}resolveRole(e,t){return t instanceof f?t:(e=this.resolveGuild(e))&&"string"==typeof t?e.roles.get(t):null}resolveChannel(e){return e instanceof u?e:"string"==typeof e?this.client.channels.get(e)||null:e instanceof h?e.channel:e instanceof c&&e.channels.get(e.id)||null}resolveChannelID(e){return e instanceof u?e.id:"string"==typeof e?e:e instanceof h?e.channel.id:e instanceof c?e.defaultChannel.id:null}resolveInviteCode(e){const t=/discord(?:app\.com\/invite|\.gg(?:\/invite)?)\/([\w-]{2,255})/i.exec(e);return t&&t[1]?t[1]:e}resolveString(e){return"string"==typeof e?e:e instanceof Array?e.join("\n"):String(e)}resolveImage(e){return e?"string"==typeof e&&e.startsWith("data:")?Promise.resolve(e):this.resolveFile(e).then(this.resolveBase64):Promise.resolve(null)}resolveBase64(e){return e instanceof t?`data:image/jpg;base64,${e.toString("base64")}`:e}resolveFile(e){return e instanceof t?Promise.resolve(e):this.client.browser&&e instanceof ArrayBuffer?Promise.resolve(a(e)):"string"==typeof e?/^https?:\/\//.test(e)?r.get(e).then(e=>e.body instanceof t?e.body:t.from(e.text)):new Promise((t,s)=>{const r=i.resolve(e);n.stat(r,(e,i)=>e?s(e):i&&i.isFile()?(n.readFile(r,(e,i)=>{e?s(e):t(i)}),null):s(new Error(`The file could not be found: ${r}`)))}):e&&e.pipe&&"function"==typeof e.pipe?new Promise((s,i)=>{const n=[];e.once("error",i),e.on("data",e=>n.push(e)),e.once("end",()=>s(t.concat(n)))}):Promise.reject(new TypeError("The resource must be a string or Buffer."))}resolveEmojiIdentifier(e){return e instanceof m||e instanceof p?e.identifier:"string"==typeof e?this.client.emojis.has(e)?this.client.emojis.get(e).identifier:e.includes("%")?e:encodeURIComponent(e):null}static resolveColor(e){if("string"==typeof e){if("RANDOM"===e)return Math.floor(16777216*Math.random());if("DEFAULT"===e)return 0;e=o.Colors[e]||parseInt(e.replace("#",""),16)}else e instanceof Array&&(e=(e[0]<<16)+(e[1]<<8)+e[2]);if(e<0||e>16777215)throw new RangeError("Color must be within the range 0 - 16777215 (0xFFFFFF).");if(e&&isNaN(e))throw new TypeError("Unable to convert color to a number.");return e}resolveColor(e){return this.constructor.resolveColor(e)}}}).call(this,s(14).Buffer)},function(e,t,s){(function(e){function s(e,t){for(var s=0,i=e.length-1;i>=0;i--){var n=e[i];"."===n?e.splice(i,1):".."===n?(e.splice(i,1),s++):s&&(e.splice(i,1),s--)}if(t)for(;s--;s)e.unshift("..");return e}var i=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,n=function(e){return i.exec(e).slice(1)};function r(e,t){if(e.filter)return e.filter(t);for(var s=[],i=0;i=-1&&!i;n--){var o=n>=0?arguments[n]:e.cwd();if("string"!=typeof o)throw new TypeError("Arguments to path.resolve must be strings");o&&(t=o+"/"+t,i="/"===o.charAt(0))}return t=s(r(t.split("/"),function(e){return!!e}),!i).join("/"),(i?"/":"")+t||"."},t.normalize=function(e){var i=t.isAbsolute(e),n="/"===o(e,-1);return(e=s(r(e.split("/"),function(e){return!!e}),!i).join("/"))||i||(e="."),e&&n&&(e+="/"),(i?"/":"")+e},t.isAbsolute=function(e){return"/"===e.charAt(0)},t.join=function(){var e=Array.prototype.slice.call(arguments,0);return t.normalize(r(e,function(e,t){if("string"!=typeof e)throw new TypeError("Arguments to path.join must be strings");return e}).join("/"))},t.relative=function(e,s){function i(e){for(var t=0;t=0&&""===e[s];s--);return t>s?[]:e.slice(t,s-t+1)}e=t.resolve(e).substr(1),s=t.resolve(s).substr(1);for(var n=i(e.split("/")),r=i(s.split("/")),o=Math.min(n.length,r.length),a=o,l=0;l`:this.name}}},function(e,t,s){const i=s(4),n=s(16).EventEmitter;e.exports=class Collector extends n{constructor(e,t,s={}){super(),Object.defineProperty(this,"client",{value:e}),this.filter=t,this.options=s,this.collected=new i,this.ended=!1,this._timeout=null,this.listener=this._handle.bind(this),s.time&&(this._timeout=this.client.setTimeout(()=>this.stop("time"),s.time))}_handle(...e){const t=this.handle(...e);if(!t||!this.filter(...e,this.collected))return;this.collected.set(t.key,t.value),this.emit("collect",t.value,this);const s=this.postCheck(...e);s&&this.stop(s)}get next(){return new Promise((e,t)=>{if(this.ended)return void t(this.collected);const s=()=>{this.removeListener("collect",i),this.removeListener("end",n)},i=t=>{s(),e(t)},n=()=>{s(),t(this.collected)};this.on("collect",i),this.on("end",n)})}stop(e="user"){this.ended||(this._timeout&&this.client.clearTimeout(this._timeout),this.ended=!0,this.cleanup(),this.emit("end",this.collected,e))}handle(){}postCheck(){}cleanup(){}}},function(e,t,s){const i=s(8),n=s(7);class OAuth2Application{constructor(e,t){Object.defineProperty(this,"client",{value:e}),this.setup(t)}setup(e){this.id=e.id,this.name=e.name,this.description=e.description,this.icon=e.icon,this.iconURL=`https://cdn.discordapp.com/app-icons/${this.id}/${this.icon}.jpg`,this.rpcOrigins=e.rpc_origins,this.redirectURIs=e.redirect_uris,this.botRequireCodeGrant=e.bot_require_code_grant,this.botPublic=e.bot_public,this.rpcApplicationState=e.rpc_application_state,this.bot=e.bot,this.flags=e.flags,this.secret=e.secret,e.owner&&(this.owner=this.client.dataManager.newUser(e.owner))}get createdTimestamp(){return i.deconstruct(this.id).timestamp}get createdAt(){return new Date(this.createdTimestamp)}reset(){return this.client.rest.methods.resetApplication(this.id)}toString(){return this.name}}OAuth2Application.prototype.reset=n.deprecate(OAuth2Application.prototype.reset,"OAuth2Application#reset: userbot methods will be removed"),e.exports=OAuth2Application},function(e,t,s){const i=s(12),n=s(18),r=s(4),o=s(0);class GroupDMChannel extends i{constructor(e,t){super(e,t),this.type="group",this.messages=new r,this._typing=new Map}setup(e){if(super.setup(e),this.name=e.name,this.icon=e.icon,this.ownerID=e.owner_id,this.managed=e.managed,this.applicationID=e.application_id,e.nicks&&(this.nicks=new r(e.nicks.map(e=>[e.id,e.nick]))),this.recipients||(this.recipients=new r),e.recipients)for(const t of e.recipients){const e=this.client.dataManager.newUser(t);this.recipients.set(e.id,e)}this.lastMessageID=e.last_message_id,this.lastPinTimestamp=e.last_pin_timestamp?new Date(e.last_pin_timestamp).getTime():null}get owner(){return this.client.users.get(this.ownerID)}get iconURL(){return this.icon?o.Endpoints.Channel(this).Icon(this.client.options.http.cdn,this.icon):null}edit(e){const t={};return e.name&&(t.name=e.name),void 0!==e.icon&&(t.icon=e.icon),this.client.rest.methods.updateGroupDMChannel(this,t)}equals(e){const t=e&&this.id===e.id&&this.name===e.name&&this.icon===e.icon&&this.ownerID===e.ownerID;return t?this.recipients.equals(e.recipients):t}addUser(e,t){return this.client.rest.methods.addUserToGroupDM(this,{nick:t,id:this.client.resolver.resolveUserID(e),accessToken:e})}setIcon(e){return this.client.resolver.resolveImage(e).then(e=>this.edit({icon:e}))}setName(e){return this.edit({name:e})}removeUser(e){const t=this.client.resolver.resolveUserID(e);return this.client.rest.methods.removeUserFromGroupDM(this,t)}toString(){return this.name}get lastPinAt(){}send(){}sendMessage(){}sendEmbed(){}sendFile(){}sendFiles(){}sendCode(){}fetchMessage(){}fetchMessages(){}fetchPinnedMessages(){}search(){}startTyping(){}stopTyping(){}get typing(){}get typingCount(){}createCollector(){}createMessageCollector(){}awaitMessages(){}acknowledge(){}_cacheMessage(){}}n.applyToClass(GroupDMChannel,!0,["bulkDelete"]),e.exports=GroupDMChannel},function(e,t){e.exports=class DiscordAPIError extends Error{constructor(e,t,s){super();const i=this.constructor.flattenErrors(t.errors||t).join("\n");this.name="DiscordAPIError",this.message=t.message&&i?`${t.message}\n${i}`:t.message||i,this.path=e,this.code=t.code,this.method=s}static flattenErrors(e,t=""){let s=[];for(const i of Object.keys(e)){if("message"===i)continue;const n=t?isNaN(i)?`${t}.${i}`:`${t}[${i}]`:i;e[i]._errors?s.push(`${n}: ${e[i]._errors.map(e=>e.message).join(" ")}`):e[i].code||e[i].message?s.push(`${e[i].code?`${e[i].code}: `:""}: ${e[i].message}`.trim()):"string"==typeof e[i]?s.push(e[i]):s=s.concat(this.flattenErrors(e[i],n))}return s}}},function(e,t,s){const i=s(13),n=s(4),r=s(6);e.exports=class VoiceChannel extends i{constructor(e,t){super(e,t),this.members=new n,this.type="voice"}setup(e){super.setup(e),this.bitrate=.001*e.bitrate,this.userLimit=e.user_limit}get connection(){const e=this.guild.voiceConnection;return e&&e.channel.id===this.id?e:null}get full(){return this.userLimit>0&&this.members.size>=this.userLimit}get deletable(){return super.deletable&&this.permissionsFor(this.client.user).has(r.FLAGS.CONNECT)}get joinable(){return!(this.client.browser||!this.permissionsFor(this.client.user).has("CONNECT")||this.full&&!this.permissionsFor(this.client.user).has("MOVE_MEMBERS"))}get speakable(){return this.permissionsFor(this.client.user).has("SPEAK")}setBitrate(e,t){return e*=1e3,this.edit({bitrate:e},t)}setUserLimit(e,t){return this.edit({userLimit:e},t)}join(){return this.client.browser?Promise.reject(new Error("Voice connections are not available in browsers.")):this.client.voice.joinChannel(this)}leave(){if(this.client.browser)return;const e=this.client.voice.connections.get(this.guild.id);e&&e.channel.id===this.id&&e.disconnect()}}},function(e,t,s){const i=s(13);e.exports=class CategoryChannel extends i{constructor(e,t){super(e,t),this.type="category"}get children(){return this.guild.channels.filter(e=>e.parentID===this.id)}}},function(e,t,s){const i=s(26);e.exports=class NewsChannel extends i{constructor(e,t){super(e,t),this.type="news"}setup(e){super.setup(e),this.rateLimitPerUser=0}}},function(e,t,s){const i=s(13);e.exports=class StoreChannel extends i{constructor(e,t){super(e,t),this.type="store"}setup(e){super.setup(e),this.nsfw=e.nsfw}}},function(e,t,s){"use strict";t.decode=t.parse=s(67),t.encode=t.stringify=s(68)},function(e){e.exports={name:"discord.js",version:"11.5.1",description:"A powerful library for interacting with the Discord API",main:"./src/index",types:"./typings/index.d.ts",scripts:{test:"npm run lint && npm run docs:test",docs:"docgen --source src --custom docs/index.yml --output docs/docs.json","docs:test":"docgen --source src --custom docs/index.yml",lint:"eslint src","lint:fix":"eslint --fix src","lint:typings":"tslint typings/index.d.ts typings/discord.js-test.ts",webpack:"parallel-webpack"},repository:{type:"git",url:"git+https://github.com/discordjs/discord.js.git"},keywords:["discord","api","bot","client","node","discordapp"],author:"Amish Shah ",license:"Apache-2.0",bugs:{url:"https://github.com/discordjs/discord.js/issues"},homepage:"https://github.com/discordjs/discord.js#readme",runkitExampleFilename:"./docs/examples/ping.js",dependencies:{long:"^4.0.0","prism-media":"^0.0.3",snekfetch:"^3.6.4",tweetnacl:"^1.0.0",ws:"^6.0.0"},peerDependencies:{"@discordjs/uws":"^10.149.0",bufferutil:"^4.0.0",erlpack:"discordapp/erlpack","libsodium-wrappers":"^0.7.3","node-opus":"^0.2.7",opusscript:"^0.0.6",sodium:"^2.0.3"},peerDependenciesMeta:{bufferutil:{optional:!0},erlpack:{optional:!0},"node-opus":{optional:!0},opusscript:{optional:!0},sodium:{optional:!0},"libsodium-wrappers":{optional:!0},uws:{optional:!0}},devDependencies:{"@types/node":"^9.4.6","discord.js-docgen":"discordjs/docgen",eslint:"^5.4.0","parallel-webpack":"^2.3.0",tslint:"^3.15.1","tslint-config-typings":"^0.2.4",typescript:"^3.0.1","uglifyjs-webpack-plugin":"^1.3.0",webpack:"^4.17.0"},engines:{node:">=6.0.0"},browser:{ws:!1,uws:!1,"@discordjs/uws":!1,erlpack:!1,"prism-media":!1,opusscript:!1,"node-opus":!1,tweetnacl:!1,sodium:!1,"src/sharding/Shard.js":!1,"src/sharding/ShardClientUtil.js":!1,"src/sharding/ShardingManager.js":!1,"src/client/voice/dispatcher/StreamDispatcher.js":!1,"src/client/voice/opus/BaseOpusEngine.js":!1,"src/client/voice/opus/NodeOpusEngine.js":!1,"src/client/voice/opus/OpusEngineList.js":!1,"src/client/voice/opus/OpusScriptEngine.js":!1,"src/client/voice/pcm/ConverterEngine.js":!1,"src/client/voice/pcm/ConverterEngineList.js":!1,"src/client/voice/pcm/FfmpegConverterEngine.js":!1,"src/client/voice/player/AudioPlayer.js":!1,"src/client/voice/receiver/VoiceReadable.js":!1,"src/client/voice/receiver/VoiceReceiver.js":!1,"src/client/voice/util/Secretbox.js":!1,"src/client/voice/util/SecretKey.js":!1,"src/client/voice/util/VolumeInterface.js":!1,"src/client/voice/ClientVoiceManager.js":!1,"src/client/voice/VoiceBroadcast.js":!1,"src/client/voice/VoiceConnection.js":!1,"src/client/voice/VoiceUDPClient.js":!1,"src/client/voice/VoiceWebSocket.js":!1}}},function(e,t,s){const i=s(75),n=s(76),r=s(81),o=s(82),a=s(83),l=s(0);e.exports=class RESTManager{constructor(e){this.client=e,this.handlers={},this.userAgentManager=new i(this),this.methods=new n(this),this.rateLimitedEndpoints={},this.globallyRateLimited=!1}destroy(){for(const e of Object.keys(this.handlers)){const t=this.handlers[e];t.destroy&&t.destroy()}}push(e,t){return new Promise((s,i)=>{e.push({request:t,resolve:s,reject:i,retries:0})})}getRequestHandler(){switch(this.client.options.apiRequestMethod){case"sequential":return r;case"burst":return o;default:throw new Error(l.Errors.INVALID_RATE_LIMIT_METHOD)}}makeRequest(e,t,s,i,n,r){const o=new a(this,e,t,s,i,n,r);if(!this.handlers[o.route]){const e=this.getRequestHandler();this.handlers[o.route]=new e(this,o.route)}return this.push(this.handlers[o.route],o)}}},function(e,t){},function(e,t,s){const i=s(4);class MessageMentions{constructor(e,t,s,n){if(this.everyone=Boolean(n),t)if(t instanceof i)this.users=new i(t);else{this.users=new i;for(const s of t){let t=e.client.users.get(s.id);t||(t=e.client.dataManager.newUser(s)),this.users.set(t.id,t)}}else this.users=new i;if(s)if(s instanceof i)this.roles=new i(s);else{this.roles=new i;for(const t of s){const s=e.channel.guild.roles.get(t);s&&this.roles.set(s.id,s)}}else this.roles=new i;this._content=e.content,this._client=e.client,this._guild=e.channel.guild,this._members=null,this._channels=null}get members(){return this._members?this._members:this._guild?(this._members=new i,this.users.forEach(e=>{const t=this._guild.member(e);t&&this._members.set(t.user.id,t)}),this._members):null}get channels(){if(this._channels)return this._channels;let e;for(this._channels=new i;null!==(e=this.constructor.CHANNELS_PATTERN.exec(this._content));){const t=this._client.channels.get(e[1]);t&&this._channels.set(t.id,t)}return this._channels}}MessageMentions.EVERYONE_PATTERN=/@(everyone|here)/g,MessageMentions.USERS_PATTERN=/<@!?[0-9]+>/g,MessageMentions.ROLES_PATTERN=/<@&[0-9]+>/g,MessageMentions.CHANNELS_PATTERN=/<#([0-9]+)>/g,e.exports=MessageMentions},function(e,t){e.exports=class MessageAttachment{constructor(e,t){Object.defineProperty(this,"client",{value:e.client}),this.message=e,this.setup(t)}setup(e){this.id=e.id,this.filename=e.filename,this.filesize=e.size,this.url=e.url,this.proxyURL=e.proxy_url,this.height=e.height,this.width=e.width}}},function(e,t,s){const i=s(4),n=s(20),r=s(32);e.exports=class MessageReaction{constructor(e,t,s,n){this.message=e,this.me=n,this.count=s||0,this.users=new i,this._emoji=new r(this,t.name,t.id)}get emoji(){if(this._emoji instanceof n)return this._emoji;if(this._emoji.id){const e=this.message.client.emojis;if(e.has(this._emoji.id)){const t=e.get(this._emoji.id);return this._emoji=t,t}}return this._emoji}remove(e=this.message.client.user){const t=this.message,s=this.message.client.resolver.resolveUserID(e);return s?t.client.rest.methods.removeMessageReaction(t,this.emoji.identifier,s):Promise.reject(new Error("Couldn't resolve the user ID to remove from the reaction."))}fetchUsers(e=100,{after:t,before:s}={}){const n=this.message;return n.client.rest.methods.getMessageReactionUsers(n,this.emoji.identifier,{after:t,before:s,limit:e}).then(e=>{const t=new i;for(const s of e){const e=this.message.client.dataManager.newUser(s);this.users.set(e.id,e),t.set(e.id,e)}return t})}}},function(e,t,s){const i=s(33),n=s(4);e.exports=class ReactionCollector extends i{constructor(e,t,s={}){super(e.client,t,s),this.message=e,this.users=new n,this.total=0,this.client.setMaxListeners(this.client.getMaxListeners()+1),this.client.on("messageReactionAdd",this.listener)}handle(e){return e.message.id!==this.message.id?null:{key:e.emoji.id||e.emoji.name,value:e}}postCheck(e,t){return this.users.set(t.id,t),this.options.max&&++this.total>=this.options.max?"limit":this.options.maxEmojis&&this.collected.size>=this.options.maxEmojis?"emojiLimit":this.options.maxUsers&&this.users.size>=this.options.maxUsers?"userLimit":null}cleanup(){this.client.removeListener("messageReactionAdd",this.listener),this.client.setMaxListeners(this.client.getMaxListeners()-1)}}},function(e,t,s){const i=s(33),n=s(7);e.exports=class MessageCollector extends i{constructor(e,t,s={}){super(e.client,t,s),this.channel=e,this.received=0,this.client.setMaxListeners(this.client.getMaxListeners()+1),this.client.on("message",this.listener),this.options.max&&(this.options.maxProcessed=this.options.max),this.options.maxMatches&&(this.options.max=this.options.maxMatches),this._reEmitter=(e=>{this.emit("message",e)}),this.on("collect",this._reEmitter)}on(e,t){"message"===e&&(t=n.deprecate(t,'MessageCollector will soon no longer emit "message", use "collect" instead')),super.on(e,t)}handle(e){return e.channel.id!==this.channel.id?null:(this.received++,{key:e.id,value:e})}postCheck(){return this.options.maxMatches&&this.collected.size>=this.options.max?"matchesLimit":this.options.max&&this.received>=this.options.maxProcessed?"limit":null}cleanup(){this.removeListener("collect",this._reEmitter),this.client.removeListener("message",this.listener),this.client.setMaxListeners(this.client.getMaxListeners()-1)}}},function(e,t){e.exports=class PartialGuild{constructor(e,t){Object.defineProperty(this,"client",{value:e}),this.setup(t)}setup(e){this.id=e.id,this.name=e.name,this.icon=e.icon,this.splash=e.splash}}},function(e,t,s){const i=s(0);e.exports=class PartialGuildChannel{constructor(e,t){Object.defineProperty(this,"client",{value:e}),this.setup(t)}setup(e){this.id=e.id,this.name=e.name,this.type=i.ChannelTypes.TEXT===e.type?"text":"voice"}}},function(e,t,s){const i=s(4),n=s(8),r=s(25),o=s(24),a={ALL:"ALL",GUILD:"GUILD",CHANNEL:"CHANNEL",USER:"USER",ROLE:"ROLE",INVITE:"INVITE",WEBHOOK:"WEBHOOK",EMOJI:"EMOJI",MESSAGE:"MESSAGE"},l={ALL:null,GUILD_UPDATE:1,CHANNEL_CREATE:10,CHANNEL_UPDATE:11,CHANNEL_DELETE:12,CHANNEL_OVERWRITE_CREATE:13,CHANNEL_OVERWRITE_UPDATE:14,CHANNEL_OVERWRITE_DELETE:15,MEMBER_KICK:20,MEMBER_PRUNE:21,MEMBER_BAN_ADD:22,MEMBER_BAN_REMOVE:23,MEMBER_UPDATE:24,MEMBER_ROLE_UPDATE:25,ROLE_CREATE:30,ROLE_UPDATE:31,ROLE_DELETE:32,INVITE_CREATE:40,INVITE_UPDATE:41,INVITE_DELETE:42,WEBHOOK_CREATE:50,WEBHOOK_UPDATE:51,WEBHOOK_DELETE:52,EMOJI_CREATE:60,EMOJI_UPDATE:61,EMOJI_DELETE:62,MESSAGE_DELETE:72};class GuildAuditLogs{constructor(e,t){if(t.users)for(const s of t.users)e.client.dataManager.newUser(s);if(this.webhooks=new i,t.webhooks)for(const s of t.webhooks)this.webhooks.set(s.id,new r(e.client,s));this.entries=new i;for(const s of t.audit_log_entries){const t=new GuildAuditLogsEntry(this,e,s);this.entries.set(t.id,t)}}static build(...e){const t=new GuildAuditLogs(...e);return Promise.all(t.entries.map(e=>e.target)).then(()=>t)}static targetType(e){return e<10?a.GUILD:e<20?a.CHANNEL:e<30?a.USER:e<40?a.ROLE:e<50?a.INVITE:e<60?a.WEBHOOK:e<70?a.EMOJI:e<80?a.MESSAGE:null}static actionType(e){return[l.CHANNEL_CREATE,l.CHANNEL_OVERWRITE_CREATE,l.MEMBER_BAN_REMOVE,l.ROLE_CREATE,l.INVITE_CREATE,l.WEBHOOK_CREATE,l.EMOJI_CREATE].includes(e)?"CREATE":[l.CHANNEL_DELETE,l.CHANNEL_OVERWRITE_DELETE,l.MEMBER_KICK,l.MEMBER_PRUNE,l.MEMBER_BAN_ADD,l.ROLE_DELETE,l.INVITE_DELETE,l.WEBHOOK_DELETE,l.EMOJI_DELETE,l.MESSAGE_DELETE].includes(e)?"DELETE":[l.GUILD_UPDATE,l.CHANNEL_UPDATE,l.CHANNEL_OVERWRITE_UPDATE,l.MEMBER_UPDATE,l.MEMBER_ROLE_UPDATE,l.ROLE_UPDATE,l.INVITE_UPDATE,l.WEBHOOK_UPDATE,l.EMOJI_UPDATE].includes(e)?"UPDATE":"ALL"}}class GuildAuditLogsEntry{constructor(e,t,s){const i=GuildAuditLogs.targetType(s.action_type);if(this.targetType=i,this.actionType=GuildAuditLogs.actionType(s.action_type),this.action=Object.keys(l).find(e=>l[e]===s.action_type),this.reason=s.reason||null,this.executor=t.client.users.get(s.user_id),this.changes=s.changes?s.changes.map(e=>({key:e.key,old:e.old_value,new:e.new_value})):null,this.id=s.id,this.extra=null,s.options)if(s.action_type===l.MEMBER_PRUNE)this.extra={removed:s.options.members_removed,days:s.options.delete_member_days};else if(s.action_type===l.MESSAGE_DELETE)this.extra={count:s.options.count,channel:t.channels.get(s.options.channel_id)};else switch(s.options.type){case"member":this.extra=t.members.get(s.options.id),this.extra||(this.extra={id:s.options.id});break;case"role":this.extra=t.roles.get(s.options.id),this.extra||(this.extra={id:s.options.id,name:s.options.role_name})}if([a.USER,a.GUILD].includes(i))this.target=t.client[`${i.toLowerCase()}s`].get(s.target_id);else if(i===a.WEBHOOK)this.target=e.webhooks.get(s.target_id)||new r(t.client,this.changes.reduce((e,t)=>(e[t.key]=t.new||t.old,e),{id:s.target_id,guild_id:t.id}));else if(i===a.INVITE){const e=this.changes.reduce((e,t)=>(e[t.key]=t.new||t.old,e),{id:s.target_id,guild:t});e.channel={id:e.channel_id},this.target=new o(t.client,e)}else i===a.MESSAGE?this.target=t.client.users.get(s.target_id):this.target=t[`${i.toLowerCase()}s`].get(s.target_id)}get createdTimestamp(){return n.deconstruct(this.id).timestamp}get createdAt(){return new Date(this.createdTimestamp)}}GuildAuditLogs.Actions=l,GuildAuditLogs.Targets=a,GuildAuditLogs.Entry=GuildAuditLogsEntry,e.exports=GuildAuditLogs},function(e,t){e.exports=class RequestHandler{constructor(e){this.restManager=e,this.queue=[]}get globalLimit(){return this.restManager.globallyRateLimited}set globalLimit(e){this.restManager.globallyRateLimited=e}push(e){this.queue.push(e)}handle(){}destroy(){this.queue=[]}}},function(e,t,s){const i=s(6);e.exports=class PermissionOverwrites{constructor(e,t){Object.defineProperty(this,"channel",{value:e}),t&&this.setup(t)}setup(e){this.id=e.id,this.type=e.type,this.deny=e.deny,this.allow=e.allow,this.denied=new i(e.deny).freeze(),this.allowed=new i(e.allow).freeze()}delete(e){return this.channel.client.rest.methods.deletePermissionOverwrites(this,e)}}},function(e,t,s){const i=s(12),n=s(18),r=s(4);class DMChannel extends i{constructor(e,t){super(e,t),this.type="dm",this.messages=new r,this._typing=new Map}setup(e){super.setup(e),this.recipient=this.client.dataManager.newUser(e.recipients[0]),this.lastMessageID=e.last_message_id,this.lastPinTimestamp=e.last_pin_timestamp?new Date(e.last_pin_timestamp).getTime():null}toString(){return this.recipient.toString()}get lastPinAt(){}send(){}sendMessage(){}sendEmbed(){}sendFile(){}sendFiles(){}sendCode(){}fetchMessage(){}fetchMessages(){}fetchPinnedMessages(){}search(){}startTyping(){}stopTyping(){}get typing(){}get typingCount(){}createCollector(){}createMessageCollector(){}awaitMessages(){}acknowledge(){}_cacheMessage(){}}n.applyToClass(DMChannel,!0,["bulkDelete"]),e.exports=DMChannel},function(e,t,s){(function(t){const i="undefined"!=typeof window,n=s(16),r=s(0),o=s(44),a=s(86),l=function(){try{const e=s(127);return e.pack?e:null}catch(e){return null}}(),h=function(){if(i)return window.WebSocket;try{return s(128)}catch(e){return s(129)}}();class WebSocketConnection extends n{constructor(e,t){super(),this.manager=e,this.client=e.client,this.ws=null,this.sequence=-1,this.status=r.Status.IDLE,this.packetManager=new a(this),this.lastPingTimestamp=0,this.ratelimit={queue:[],remaining:120,total:120,time:6e4,resetTimer:null},this.connect(t),this.disabledEvents={},this.closeSequence=0,this.expectingClose=!1;for(const e of this.client.options.disabledEvents)this.disabledEvents[e]=!0}triggerReady(){this.status!==r.Status.READY?(this.status=r.Status.READY,this.client.emit(r.Events.READY),this.packetManager.handleQueue()):this.debug("Tried to mark self as ready, but already ready")}checkIfReady(){if(this.status===r.Status.READY||this.status===r.Status.NEARLY)return!1;let e=0;for(const t of this.client.guilds.values())t.available||e++;if(0===e){if(this.status=r.Status.NEARLY,!this.client.options.fetchAllMembers)return this.triggerReady();const e=this.client.guilds.map(e=>e.fetchMembers());Promise.all(e).then(()=>this.triggerReady()).catch(e=>{this.debug(`Failed to fetch all members before ready! ${e}`),this.triggerReady()})}return!0}debug(e){return e instanceof Error&&(e=e.stack),this.manager.debug(`[connection] ${e}`)}unpack(e){return e instanceof ArrayBuffer&&(e=t.from(new Uint8Array(e))),l&&"string"!=typeof e?l.unpack(e):(e instanceof t&&(e=o.inflateSync(e).toString()),JSON.parse(e))}pack(e){return l?l.pack(e):JSON.stringify(e)}processQueue(){if(0!==this.ratelimit.remaining&&0!==this.ratelimit.queue.length)for(this.ratelimit.remaining===this.ratelimit.total&&(this.ratelimit.resetTimer=this.client.setTimeout(()=>{this.ratelimit.remaining=this.ratelimit.total,this.processQueue()},this.ratelimit.time));this.ratelimit.remaining>0;){const e=this.ratelimit.queue.shift();if(!e)return;this._send(e),this.ratelimit.remaining--}}_send(e){this.ws&&this.ws.readyState===h.OPEN?this.ws.send(this.pack(e)):this.debug(`Tried to send packet ${JSON.stringify(e)} but no WebSocket is available!`)}send(e){this.ws&&this.ws.readyState===h.OPEN?(this.ratelimit.queue.push(e),this.processQueue()):this.debug(`Tried to send packet ${JSON.stringify(e)} but no WebSocket is available!`)}connect(e=this.gateway,t=0,s=!1){if(t)return this.client.setTimeout(()=>this.connect(e,0,s),t);if(this.ws&&!s)return this.debug("WebSocket connection already exists"),!1;if("string"!=typeof e)return this.debug(`Tried to connect to an invalid gateway: ${e}`),!1;this.expectingClose=!1,this.gateway=e,this.debug(`Connecting to ${e}`);const n=this.ws=new h(e);return i&&(n.binaryType="arraybuffer"),n.onmessage=this.onMessage.bind(this),n.onopen=this.onOpen.bind(this),n.onerror=this.onError.bind(this),n.onclose=this.onClose.bind(this),this.status=r.Status.CONNECTING,!0}destroy(){const e=this.ws;return e?(this.heartbeat(-1),this.expectingClose=!0,e.close(1e3),this.packetManager.handleQueue(),this.ws=null,this.status=r.Status.DISCONNECTED,this.ratelimit.remaining=this.ratelimit.total,!0):(this.debug("Attempted to destroy WebSocket but no connection exists!"),!1)}onMessage(e){let t;try{t=this.unpack(e.data)}catch(e){this.emit("debug",e)}return this.onPacket(t)}setSequence(e){this.sequence=e>this.sequence?e:this.sequence}onPacket(e){if(!e)return this.debug("Received null packet"),!1;switch(this.client.emit("raw",e),e.op){case r.OPCodes.HELLO:return this.heartbeat(e.d.heartbeat_interval);case r.OPCodes.RECONNECT:return this.reconnect();case r.OPCodes.INVALID_SESSION:return e.d||(this.sessionID=null),this.sequence=-1,this.debug("Session invalidated -- will identify with a new session"),this.identify(e.d?2500:0);case r.OPCodes.HEARTBEAT_ACK:return this.ackHeartbeat();case r.OPCodes.HEARTBEAT:return this.heartbeat();default:return this.packetManager.handle(e)}}onOpen(e){e&&e.target&&e.target.url&&(this.gateway=e.target.url),this.debug(`Connected to gateway ${this.gateway}`),this.identify()}reconnect(){this.debug("Attemping to reconnect in 5500ms..."),this.client.emit(r.Events.RECONNECTING),this.connect(this.gateway,5500,!0)}onError(e){e&&"uWs client connection error"===e.message?this.reconnect():this.client.emit(r.Events.ERROR,e)}onClose(e){if(this.debug(`${this.expectingClose?"Client":"Server"} closed the WebSocket connection: ${e.code}`),this.closeSequence=this.sequence,this.emit("close",e),this.heartbeat(-1),1e3===e.code?this.expectingClose:r.WSCodes[e.code])return this.expectingClose=!1,this.client.emit(r.Events.DISCONNECT,e),this.debug(r.WSCodes[e.code]),void this.destroy();this.expectingClose=!1,this.reconnect()}ackHeartbeat(){this.debug(`Heartbeat acknowledged, latency of ${Date.now()-this.lastPingTimestamp}ms`),this.client._pong(this.lastPingTimestamp)}heartbeat(e){isNaN(e)?(this.debug("Sending a heartbeat"),this.lastPingTimestamp=Date.now(),this.send({op:r.OPCodes.HEARTBEAT,d:this.sequence})):-1===e?(this.debug("Clearing heartbeat interval"),this.client.clearInterval(this.heartbeatInterval),this.heartbeatInterval=null):(this.debug(`Setting a heartbeat interval for ${e}ms`),this.heartbeatInterval=this.client.setInterval(()=>this.heartbeat(),e))}identify(e){return e?this.client.setTimeout(this.identify.bind(this),e):this.sessionID?this.identifyResume():this.identifyNew()}identifyNew(){if(!this.client.token)return void this.debug("No token available to identify a new session with");const e=Object.assign({token:this.client.token},this.client.options.ws),{shardId:t,shardCount:s}=this.client.options;s>0&&(e.shard=[Number(t),Number(s)]),this.debug("Identifying as a new session"),this.send({op:r.OPCodes.IDENTIFY,d:e})}identifyResume(){if(!this.sessionID)return this.debug("Warning: wanted to resume but session ID not available; identifying as a new session instead"),this.identifyNew();this.debug(`Attempting to resume session ${this.sessionID}`);const e={token:this.client.token,session_id:this.sessionID,seq:this.sequence};return this.send({op:r.OPCodes.RESUME,d:e})}}WebSocketConnection.ENCODING=l?"etf":"json",WebSocketConnection.WebSocket=h,e.exports=WebSocketConnection}).call(this,s(14).Buffer)},function(e,t,s){const i=s(10),n=s(4),r=s(58),o=s(59),a=s(0),l=s(7);class ClientUser extends i{setup(e){if(super.setup(e),this.verified=e.verified,this.email=e.email,this.localPresence={},this._typing=new Map,this.friends=new n,this.blocked=new n,this.notes=new n,this.premium="boolean"==typeof e.premium?e.premium:null,this.mfaEnabled=e.mfa_enabled,this.mobile="boolean"==typeof e.mobile?e.mobile:null,this.settings=e.user_settings?new r(this,e.user_settings):null,this.guildSettings=new n,e.user_guild_settings)for(const t of e.user_guild_settings)this.guildSettings.set(t.guild_id,new o(t,this.client))}edit(e){return this.client.rest.methods.updateCurrentUser(e)}setUsername(e,t){return this.client.rest.methods.updateCurrentUser({username:e},t)}setEmail(e,t){return this.client.rest.methods.updateCurrentUser({email:e},t)}setPassword(e,t){return this.client.rest.methods.updateCurrentUser({password:e},t)}setAvatar(e){return this.client.resolver.resolveImage(e).then(e=>this.client.rest.methods.updateCurrentUser({avatar:e}))}setPresence(e){return new Promise(t=>{let s=this.localPresence.status||this.presence.status,i=this.localPresence.game,n=this.localPresence.afk||this.presence.afk;if(!i&&this.presence.game&&(i={name:this.presence.game.name,type:this.presence.game.type,url:this.presence.game.url}),e.status){if("string"!=typeof e.status)throw new TypeError("Status must be a string");this.bot?s=e.status:(this.settings.update(a.UserSettingsMap.status,e.status),s="invisible")}e.game?((i=e.game).type=i.url&&void 0===i.type?1:i.type||0,"string"==typeof i.type&&(i.type=a.ActivityTypes.indexOf(i.type.toUpperCase()))):void 0!==e.game&&(i=null),void 0!==e.afk&&(n=e.afk),n=Boolean(n),this.localPresence={status:s,game:i,afk:n},this.localPresence.since=0,this.localPresence.game=this.localPresence.game||null,this.client.ws.send({op:3,d:this.localPresence}),this.client._setPresence(this.id,this.localPresence),t(this)})}setStatus(e){return this.setPresence({status:e})}setGame(e,t){return e?this.setPresence({game:{name:e,url:t}}):this.setPresence({game:null})}setActivity(e,{url:t,type:s}={}){return e?this.setPresence({game:{name:e,type:s,url:t}}).then(e=>e.presence):this.setPresence({game:null})}setAFK(e){return this.setPresence({afk:e})}fetchMentions(e={}){return this.client.rest.methods.fetchMentions(e)}addFriend(e){return e=this.client.resolver.resolveUser(e),this.client.rest.methods.addFriend(e)}removeFriend(e){return e=this.client.resolver.resolveUser(e),this.client.rest.methods.removeFriend(e)}createGuild(e,t,s=null){return"string"==typeof s&&s.startsWith("data:")?this.client.rest.methods.createGuild({name:e,icon:s,region:t}):this.client.resolver.resolveImage(s).then(s=>this.client.rest.methods.createGuild({name:e,icon:s,region:t}))}createGroupDM(e){return this.client.rest.methods.createGroupDM({recipients:e.map(e=>this.client.resolver.resolveUserID(e.user)),accessTokens:e.map(e=>e.accessToken),nicks:e.reduce((e,t)=>(t.nick&&(e[t.user?t.user.id:t.id]=t.nick),e),{})})}acceptInvite(e){return this.client.rest.methods.acceptInvite(e)}}ClientUser.prototype.acceptInvite=l.deprecate(ClientUser.prototype.acceptInvite,"ClientUser#acceptInvite: userbot methods will be removed"),ClientUser.prototype.setGame=l.deprecate(ClientUser.prototype.setGame,"ClientUser#setGame: use ClientUser#setActivity instead"),ClientUser.prototype.addFriend=l.deprecate(ClientUser.prototype.addFriend,"ClientUser#addFriend: userbot methods will be removed"),ClientUser.prototype.removeFriend=l.deprecate(ClientUser.prototype.removeFriend,"ClientUser#removeFriend: userbot methods will be removed"),ClientUser.prototype.setPassword=l.deprecate(ClientUser.prototype.setPassword,"ClientUser#setPassword: userbot methods will be removed"),ClientUser.prototype.setEmail=l.deprecate(ClientUser.prototype.setEmail,"ClientUser#setEmail: userbot methods will be removed"),ClientUser.prototype.fetchMentions=l.deprecate(ClientUser.prototype.fetchMentions,"ClientUser#fetchMentions: userbot methods will be removed"),e.exports=ClientUser},function(e,t,s){const i=s(0),n=s(5);e.exports=class ClientUserSettings{constructor(e,t){this.user=e,this.patch(t)}patch(e){for(const t of Object.keys(i.UserSettingsMap)){const s=i.UserSettingsMap[t];e.hasOwnProperty(t)&&("function"==typeof s?this[s.name]=s(e[t]):this[s]=e[t])}}update(e,t){return this.user.client.rest.methods.patchUserSettings({[e]:t})}setGuildPosition(e,t,s){const i=Object.assign([],this.guildPositions);return n.moveElementInArray(i,e.id,t,s),this.update("guild_positions",i).then(()=>e)}addRestrictedGuild(e){const t=Object.assign([],this.restrictedGuilds);return t.includes(e.id)?Promise.reject(new Error("Guild is already restricted")):(t.push(e.id),this.update("restricted_guilds",t).then(()=>e))}removeRestrictedGuild(e){const t=Object.assign([],this.restrictedGuilds),s=t.indexOf(e.id);return s<0?Promise.reject(new Error("Guild is not restricted")):(t.splice(s,1),this.update("restricted_guilds",t).then(()=>e))}}},function(e,t,s){const i=s(0),n=s(4),r=s(88);e.exports=class ClientUserGuildSettings{constructor(e,t){Object.defineProperty(this,"client",{value:t}),this.guildID=e.guild_id,this.channelOverrides=new n,this.patch(e)}patch(e){for(const t of Object.keys(i.UserGuildSettingsMap)){const s=i.UserGuildSettingsMap[t];if(e.hasOwnProperty(t))if("channel_overrides"===t)for(const s of e[t])this.channelOverrides.set(s.channel_id,new r(s));else"function"==typeof s?this[s.name]=s(e[t]):this[s]=e[t]}}update(e,t){return this.client.rest.methods.patchClientUserGuildSettings(this.guildID,{[e]:t})}}},function(e,t,s){const i="undefined"!=typeof window,n=s(61);e.exports=n,i?window.Discord=n:i||console.warn("Warning: Attempting to use browser version of Discord.js in a non-browser environment!")},function(e,t,s){const i=s(5);e.exports={Client:s(72),Shard:s(163),ShardClientUtil:s(164),ShardingManager:s(165),WebhookClient:s(166),Collection:s(4),Constants:s(0),DiscordAPIError:s(36),EvaluatedPermissions:s(6),Permissions:s(6),Snowflake:s(8),SnowflakeUtil:s(8),Util:i,util:i,version:s(42).version,escapeMarkdown:i.escapeMarkdown,fetchRecommendedShards:i.fetchRecommendedShards,splitMessage:i.splitMessage,Attachment:s(22),CategoryChannel:s(38),Channel:s(12),ClientUser:s(57),ClientUserSettings:s(58),Collector:s(33),DMChannel:s(55),Emoji:s(20),Game:s(11).Game,GroupDMChannel:s(35),Guild:s(23),GuildAuditLogs:s(52),GuildChannel:s(13),GuildMember:s(21),Invite:s(24),Message:s(19),MessageAttachment:s(46),MessageCollector:s(49),MessageEmbed:s(29),MessageMentions:s(45),MessageReaction:s(47),NewsChannel:s(39),OAuth2Application:s(34),ClientOAuth2Application:s(34),PartialGuild:s(50),PartialGuildChannel:s(51),PermissionOverwrites:s(54),Presence:s(11).Presence,ReactionEmoji:s(32),ReactionCollector:s(48),RichEmbed:s(17),Role:s(9),StoreChannel:s(40),TextChannel:s(26),User:s(10),VoiceChannel:s(37),Webhook:s(25)}},function(e,t){var s;s=function(){return this}();try{s=s||new Function("return this")()}catch(e){"object"==typeof window&&(s=window)}e.exports=s},function(e,t,s){"use strict";t.byteLength=function(e){var t=h(e),s=t[0],i=t[1];return 3*(s+i)/4-i},t.toByteArray=function(e){for(var t,s=h(e),i=s[0],o=s[1],a=new r(function(e,t,s){return 3*(t+s)/4-s}(0,i,o)),l=0,c=o>0?i-4:i,u=0;u>16&255,a[l++]=t>>8&255,a[l++]=255&t;2===o&&(t=n[e.charCodeAt(u)]<<2|n[e.charCodeAt(u+1)]>>4,a[l++]=255&t);1===o&&(t=n[e.charCodeAt(u)]<<10|n[e.charCodeAt(u+1)]<<4|n[e.charCodeAt(u+2)]>>2,a[l++]=t>>8&255,a[l++]=255&t);return a},t.fromByteArray=function(e){for(var t,s=e.length,n=s%3,r=[],o=0,a=s-n;oa?a:o+16383));1===n?(t=e[s-1],r.push(i[t>>2]+i[t<<4&63]+"==")):2===n&&(t=(e[s-2]<<8)+e[s-1],r.push(i[t>>10]+i[t>>4&63]+i[t<<2&63]+"="));return r.join("")};for(var i=[],n=[],r="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,l=o.length;a0)throw new Error("Invalid string. Length must be a multiple of 4");var s=e.indexOf("=");return-1===s&&(s=t),[s,s===t?0:4-s%4]}function c(e,t,s){for(var n,r,o=[],a=t;a>18&63]+i[r>>12&63]+i[r>>6&63]+i[63&r]);return o.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},function(e,t){t.read=function(e,t,s,i,n){var r,o,a=8*n-i-1,l=(1<>1,c=-7,u=s?n-1:0,d=s?-1:1,m=e[t+u];for(u+=d,r=m&(1<<-c)-1,m>>=-c,c+=a;c>0;r=256*r+e[t+u],u+=d,c-=8);for(o=r&(1<<-c)-1,r>>=-c,c+=i;c>0;o=256*o+e[t+u],u+=d,c-=8);if(0===r)r=1-h;else{if(r===l)return o?NaN:1/0*(m?-1:1);o+=Math.pow(2,i),r-=h}return(m?-1:1)*o*Math.pow(2,r-i)},t.write=function(e,t,s,i,n,r){var o,a,l,h=8*r-n-1,c=(1<>1,d=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,m=i?0:r-1,p=i?1:-1,f=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,o=c):(o=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-o))<1&&(o--,l*=2),(t+=o+u>=1?d/l:d*Math.pow(2,1-u))*l>=2&&(o++,l/=2),o+u>=c?(a=0,o=c):o+u>=1?(a=(t*l-1)*Math.pow(2,n),o+=u):(a=t*Math.pow(2,u-1)*Math.pow(2,n),o=0));n>=8;e[s+m]=255&a,m+=p,a/=256,n-=8);for(o=o<0;e[s+m]=255&o,m+=p,o/=256,h-=8);e[s+m-p]|=128*f}},function(e,t){var s={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==s.call(e)}},function(e,t,s){const i="undefined"!=typeof window,n=s(41),r=s(i?69:70);class Snekfetch extends r.Extension{constructor(e,t,s={}){super(),this.options=Object.assign({version:1,qs:n,followRedirects:!0},s),this.request=r.buildRequest.call(this,e,t,s),s.headers&&this.set(s.headers),s.query&&this.query(s.query),s.data&&this.send(s.data)}query(e,t){if(this.request.query||(this.request.query={}),null!==e&&"object"==typeof e)for(const[t,s]of Object.entries(e))this.query(t,s);else this.request.query[e]=t;return this}set(e,t){if(null!==e&&"object"==typeof e)for(const t of Object.keys(e))this.set(t,e[t]);else this.request.setHeader(e,t);return this}attach(...e){const t=this.data instanceof r.FormData?this.data:this.data=new r.FormData;if("object"==typeof e[0])for(const[t,s]of Object.entries(e[0]))this.attach(t,s);else t.append(...e);return this}send(e){if(e instanceof r.FormData||r.shouldSendRaw(e))this.data=e;else if(null!==e&&"object"==typeof e){const t=this.request.getHeader("content-type");let s;t?t.includes("json")?s=JSON.stringify:t.includes("urlencoded")&&(s=this.options.qs.stringify):(this.set("Content-Type","application/json"),s=JSON.stringify),this.data=s(e)}else this.data=e;return this}then(e,t){return this._response?this._response.then(e,t):this._response=r.finalizeRequest.call(this).then(({response:e,raw:t,redirect:s,headers:i})=>{if(s){let t=this.request.method;[301,302].includes(e.statusCode)?("HEAD"!==t&&(t="GET"),this.data=null):303===e.statusCode&&(t="GET");const i=this.request.getHeaders();return delete i.host,new Snekfetch(t,s,{data:this.data,headers:i,version:this.options.version})}const n=e.statusCode||e.status,o=this,a={request:this.request,get body(){delete a.body;const e=this.headers["content-type"];if(e&&e.includes("application/json"))try{a.body=JSON.parse(a.text)}catch(e){a.body=a.text}else e&&e.includes("application/x-www-form-urlencoded")?a.body=o.options.qs.parse(a.text):a.body=t;return a.body},text:t.toString(),ok:n>=200&&n<400,headers:i||e.headers,status:n,statusText:e.statusText||r.STATUS_CODES[e.statusCode]};if(a.ok)return a;{const e=new Error(`${a.status} ${a.statusText}`.trim());return Object.assign(e,a),Promise.reject(e)}}).then(e,t)}catch(e){return this.then(null,e)}end(e){return this.then(t=>e?e(null,t):t,t=>e?e(t,t.status?t:null):Promise.reject(t))}_finalizeRequest(){if(this.request&&("HEAD"!==this.request.method&&this.set("Accept-Encoding","gzip, deflate"),this.data&&this.data.getBoundary&&this.set("Content-Type",`multipart/form-data; boundary=${this.data.getBoundary()}`),this.request.query)){const[e,t]=this.request.path.split("?");this.request.path=`${e}?${this.options.qs.stringify(this.request.query)}${t?`&${t}`:""}`}}}Snekfetch.METHODS=r.METHODS.concat("BREW").filter(e=>"M-SEARCH"!==e);for(const e of Snekfetch.METHODS)Snekfetch[e.toLowerCase()]=function(t,s){return new(this.prototype instanceof Snekfetch?this:Snekfetch)(e,t,s)};e.exports=Snekfetch},function(e,t,s){"use strict";function i(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.exports=function(e,t,s,r){t=t||"&",s=s||"=";var o={};if("string"!=typeof e||0===e.length)return o;var a=/\+/g;e=e.split(t);var l=1e3;r&&"number"==typeof r.maxKeys&&(l=r.maxKeys);var h=e.length;l>0&&h>l&&(h=l);for(var c=0;c=0?(u=f.substr(0,g),d=f.substr(g+1)):(u=f,d=""),m=decodeURIComponent(u),p=decodeURIComponent(d),i(o,m)?n(o[m])?o[m].push(p):o[m]=[o[m],p]:o[m]=p}return o};var n=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},function(e,t,s){"use strict";var i=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};e.exports=function(e,t,s,a){return t=t||"&",s=s||"=",null===e&&(e=void 0),"object"==typeof e?r(o(e),function(o){var a=encodeURIComponent(i(o))+s;return n(e[o])?r(e[o],function(e){return a+encodeURIComponent(i(e))}).join(t):a+encodeURIComponent(i(e[o]))}).join(t):a?encodeURIComponent(i(a))+s+encodeURIComponent(i(e)):""};var n=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};function r(e,t){if(e.map)return e.map(t);for(var s=[],i=0;ie.text().then(t=>{const s={};for(const[t,i]of e.headers.entries())s[t.toLowerCase()]=i;return{response:e,raw:t,headers:s}}))},shouldSendRaw:()=>!1,METHODS:["GET","HEAD","POST","PUT","DELETE","CONNECT","OPTIONS","PATCH"],STATUS_CODES:{},Extension:Object,FormData:window.FormData}},function(e,t){},function(e,t){t.endianness=function(){return"LE"},t.hostname=function(){return"undefined"!=typeof location?location.hostname:""},t.loadavg=function(){return[]},t.uptime=function(){return 0},t.freemem=function(){return Number.MAX_VALUE},t.totalmem=function(){return Number.MAX_VALUE},t.cpus=function(){return[]},t.type=function(){return"Browser"},t.release=function(){return"undefined"!=typeof navigator?navigator.appVersion:""},t.networkInterfaces=t.getNetworkInterfaces=function(){return{}},t.arch=function(){return"javascript"},t.platform=function(){return"browser"},t.tmpdir=t.tmpDir=function(){return"/tmp"},t.EOL="\n",t.homedir=function(){return"/"}},function(module,exports,__webpack_require__){(function(process){const EventEmitter=__webpack_require__(16),Constants=__webpack_require__(0),Permissions=__webpack_require__(6),Util=__webpack_require__(5),RESTManager=__webpack_require__(43),ClientDataManager=__webpack_require__(84),ClientManager=__webpack_require__(85),ClientDataResolver=__webpack_require__(30),ClientVoiceManager=__webpack_require__(130),WebSocketManager=__webpack_require__(131),ActionsManager=__webpack_require__(132),Collection=__webpack_require__(4),Presence=__webpack_require__(11).Presence,ShardClientUtil=__webpack_require__(161),VoiceBroadcast=__webpack_require__(162);class Client extends EventEmitter{constructor(e={}){super(),!e.shardId&&"SHARD_ID"in Object({__DISCORD_WEBPACK__:"true"})&&(e.shardId=Number(Object({__DISCORD_WEBPACK__:"true"}).SHARD_ID)),!e.shardCount&&"SHARD_COUNT"in Object({__DISCORD_WEBPACK__:"true"})&&(e.shardCount=Number(Object({__DISCORD_WEBPACK__:"true"}).SHARD_COUNT)),this.options=Util.mergeDefault(Constants.DefaultOptions,e),this._validateOptions(),this.rest=new RESTManager(this),this.dataManager=new ClientDataManager(this),this.manager=new ClientManager(this),this.ws=new WebSocketManager(this),this.resolver=new ClientDataResolver(this),this.actions=new ActionsManager(this),this.voice=this.browser?null:new ClientVoiceManager(this),this.shard=process.send?ShardClientUtil.singleton(this):null,this.users=new Collection,this.guilds=new Collection,this.channels=new Collection,this.presences=new Collection,Object.defineProperty(this,"token",{writable:!0}),!this.token&&"CLIENT_TOKEN"in Object({__DISCORD_WEBPACK__:"true"})?this.token=Object({__DISCORD_WEBPACK__:"true"}).CLIENT_TOKEN:this.token=null,this.user=null,this.readyAt=null,this.broadcasts=[],this.pings=[],this._timeouts=new Set,this._intervals=new Set,this.options.messageSweepInterval>0&&this.setInterval(this.sweepMessages.bind(this),1e3*this.options.messageSweepInterval)}get _pingTimestamp(){return this.ws.connection?this.ws.connection.lastPingTimestamp:0}get status(){return this.ws.connection?this.ws.connection.status:Constants.Status.IDLE}get uptime(){return this.readyAt?Date.now()-this.readyAt:null}get ping(){return this.pings.reduce((e,t)=>e+t,0)/this.pings.length}get voiceConnections(){return this.browser?new Collection:this.voice.connections}get emojis(){const e=new Collection;for(const t of this.guilds.values())for(const s of t.emojis.values())e.set(s.id,s);return e}get readyTimestamp(){return this.readyAt?this.readyAt.getTime():null}get browser(){return"undefined"!=typeof window}createVoiceBroadcast(){const e=new VoiceBroadcast(this);return this.broadcasts.push(e),e}login(e=this.token){return this.rest.methods.login(e)}destroy(){for(const e of this._timeouts)clearTimeout(e);for(const e of this._intervals)clearInterval(e);return this._timeouts.clear(),this._intervals.clear(),this.manager.destroy()}syncGuilds(e=this.guilds){this.user.bot||this.ws.send({op:12,d:e instanceof Collection?e.keyArray():e.map(e=>e.id)})}fetchUser(e,t=!0){return this.users.has(e)?Promise.resolve(this.users.get(e)):this.rest.methods.getUser(e,t)}fetchInvite(e){const t=this.resolver.resolveInviteCode(e);return this.rest.methods.getInvite(t)}fetchWebhook(e,t){return this.rest.methods.getWebhook(e,t)}fetchVoiceRegions(){return this.rest.methods.fetchVoiceRegions()}sweepMessages(e=this.options.messageCacheLifetime){if("number"!=typeof e||isNaN(e))throw new TypeError("The lifetime must be a number.");if(e<=0)return this.emit("debug","Didn't sweep messages - lifetime is unlimited"),-1;const t=1e3*e,s=Date.now();let i=0,n=0;for(const e of this.channels.values())e.messages&&(i++,n+=e.messages.sweep(e=>s-(e.editedTimestamp||e.createdTimestamp)>t));return this.emit("debug",`Swept ${n} messages older than ${e} seconds in ${i} text-based channels`),n}fetchApplication(e="@me"){return"@me"!==e&&((e,...t)=>console.warn('fetchApplication: use "@me" as an argument',t))(0,"DeprecationWarning"),this.rest.methods.getApplication(e)}generateInvite(e){return e=void 0===e?0:Permissions.resolve(e),this.fetchApplication().then(t=>`https://discordapp.com/oauth2/authorize?client_id=${t.id}&permissions=${e}&scope=bot`)}setTimeout(e,t,...s){const i=setTimeout(()=>{e(...s),this._timeouts.delete(i)},t);return this._timeouts.add(i),i}clearTimeout(e){clearTimeout(e),this._timeouts.delete(e)}setInterval(e,t,...s){const i=setInterval(e,t,...s);return this._intervals.add(i),i}clearInterval(e){clearInterval(e),this._intervals.delete(e)}_pong(e){this.pings.unshift(Date.now()-e),this.pings.length>3&&(this.pings.length=3),this.ws.lastHeartbeatAck=!0}_setPresence(e,t){this.presences.has(e)?this.presences.get(e).update(t):this.presences.set(e,new Presence(t,this))}_eval(script){return eval(script)}_validateOptions(e=this.options){if("number"!=typeof e.shardCount||isNaN(e.shardCount))throw new TypeError("The shardCount option must be a number.");if("number"!=typeof e.shardId||isNaN(e.shardId))throw new TypeError("The shardId option must be a number.");if(e.shardCount<0)throw new RangeError("The shardCount option must be at least 0.");if(e.shardId<0)throw new RangeError("The shardId option must be at least 0.");if(0!==e.shardId&&e.shardId>=e.shardCount)throw new RangeError("The shardId option must be less than shardCount.");if("number"!=typeof e.messageCacheMaxSize||isNaN(e.messageCacheMaxSize))throw new TypeError("The messageCacheMaxSize option must be a number.");if("number"!=typeof e.messageCacheLifetime||isNaN(e.messageCacheLifetime))throw new TypeError("The messageCacheLifetime option must be a number.");if("number"!=typeof e.messageSweepInterval||isNaN(e.messageSweepInterval))throw new TypeError("The messageSweepInterval option must be a number.");if("boolean"!=typeof e.fetchAllMembers)throw new TypeError("The fetchAllMembers option must be a boolean.");if("boolean"!=typeof e.disableEveryone)throw new TypeError("The disableEveryone option must be a boolean.");if("number"!=typeof e.restWsBridgeTimeout||isNaN(e.restWsBridgeTimeout))throw new TypeError("The restWsBridgeTimeout option must be a number.");if(!(e.disabledEvents instanceof Array))throw new TypeError("The disabledEvents option must be an Array.");if("number"!=typeof e.retryLimit||isNaN(e.retryLimit))throw new TypeError("The retryLimit options must be a number.")}}module.exports=Client}).call(this,__webpack_require__(15))},function(e,t){e.exports=function(e){return e&&"object"==typeof e&&"function"==typeof e.copy&&"function"==typeof e.fill&&"function"==typeof e.readUInt8}},function(e,t){"function"==typeof Object.create?e.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(e,t){e.super_=t;var s=function(){};s.prototype=t.prototype,e.prototype=new s,e.prototype.constructor=e}},function(e,t,s){(function(t){const i=s(0);class UserAgentManager{constructor(){this.build(this.constructor.DEFAULT)}set({url:e,version:t}={}){this.build({url:e||this.constructor.DFEAULT.url,version:t||this.constructor.DEFAULT.version})}build(e){this.userAgent=`DiscordBot (${e.url}, ${e.version}) Node.js/${t.version}`}}UserAgentManager.DEFAULT={url:i.Package.homepage.split("#")[0],version:i.Package.version},e.exports=UserAgentManager}).call(this,s(15))},function(e,t,s){const i=s(41),n=s(28),r=s(6),o=s(0),a=o.Endpoints,l=s(4),h=s(5),c=s(77),u=s(17),d=s(10),m=s(21),p=s(19),f=s(9),g=s(24),E=s(25),_=s(78),v=s(34),b=s(12),y=s(35),w=s(23),A=s(80),T=s(52);e.exports=class RESTMethods{constructor(e){this.rest=e,this.client=e.client,this._ackToken=null}login(e=this.client.token){return new Promise((t,s)=>{if(!e||"string"!=typeof e)throw new Error(o.Errors.INVALID_TOKEN);e=e.replace(/^Bot\s*/i,""),this.client.manager.connectToWebSocket(e,t,s)}).catch(e=>(this.client.destroy(),Promise.reject(e)))}logout(){return this.rest.makeRequest("post",a.logout,!0,{})}getGateway(e=!1){return this.rest.makeRequest("get",e?a.gateway.bot:a.gateway,!0)}fetchVoiceRegions(e){let t;return t=e?a.Guild(e).voiceRegions:a.voiceRegions,this.rest.makeRequest("get",t,!0).then(e=>{const t=new l;for(const s of e)t.set(s.id,new A(s));return t})}fetchEmbed(e){return this.rest.makeRequest("get",a.Guild(e).embed,!0).then(e=>({enabled:e.enabled,channel:e.channel_id?this.client.channels.get(e.channel_id):null}))}sendMessage(e,t,{tts:s,nonce:i,embed:n,disableEveryone:r,split:o,code:l,reply:c}={},u=null){return new Promise((p,f)=>{if(void 0!==t&&(t=this.client.resolver.resolveString(t)),void 0!==i&&(i=parseInt(i),isNaN(i)||i<0))throw new RangeError("Message nonce must fit in an unsigned 64-bit integer.");if(t){if(o&&"object"!=typeof o&&(o={}),void 0===l||"boolean"==typeof l&&!0!==l||(t=h.escapeMarkdown(this.client.resolver.resolveString(t),!0),t=`\`\`\`${"boolean"!=typeof l&&l||""}\n${t}\n\`\`\``,o&&(o.prepend=`\`\`\`${"boolean"!=typeof l&&l||""}\n`,o.append="\n```")),(r||void 0===r&&this.client.options.disableEveryone)&&(t=t.replace(/@(everyone|here)/g,"@​$1")),c&&!(e instanceof d||e instanceof m)&&"dm"!==e.type){const e=this.client.resolver.resolveUserID(c),s=`<@${c instanceof m&&c.nickname?"!":""}${e}>`;t=`${s}${t?`, ${t}`:""}`,o&&(o.prepend=`${s}, ${o.prepend||""}`)}o&&(t=h.splitMessage(t,o))}else if(c&&!(e instanceof d||e instanceof m)&&"dm"!==e.type){const e=this.client.resolver.resolveUserID(c);t=`<@${c instanceof m&&c.nickname?"!":""}${e}>`}const g=e=>{if(t instanceof Array){const i=[];!function t(r,o){const a=o===r.length-1?{tts:s,embed:n,files:u}:{tts:s};e.send(r[o],a).then(e=>(i.push(e),o>=r.length-1?p(i):t(r,++o))).catch(f)}(t,0)}else this.rest.makeRequest("post",a.Channel(e).messages,!0,{content:t,tts:s,nonce:i,embed:n},u).then(e=>p(this.client.actions.MessageCreate.handle(e).message),f)};e instanceof d||e instanceof m?this.createDM(e).then(g,f):g(e)})}updateMessage(e,t,{embed:s,code:i,reply:n}={}){if(void 0!==t&&(t=this.client.resolver.resolveString(t)),void 0===i||"boolean"==typeof i&&!0!==i||(t=h.escapeMarkdown(this.client.resolver.resolveString(t),!0),t=`\`\`\`${"boolean"!=typeof i&&i||""}\n${t}\n\`\`\``),n&&"dm"!==e.channel.type){const e=this.client.resolver.resolveUserID(n);t=`${`<@${n instanceof m&&n.nickname?"!":""}${e}>`}${t?`, ${t}`:""}`}return s instanceof u&&(s=s._apiTransform()),this.rest.makeRequest("patch",a.Message(e),!0,{content:t,embed:s}).then(e=>this.client.actions.MessageUpdate.handle(e).updated)}deleteMessage(e){return this.rest.makeRequest("delete",a.Message(e),!0).then(()=>this.client.actions.MessageDelete.handle({id:e.id,channel_id:e.channel.id}).message)}ackMessage(e){return this.rest.makeRequest("post",a.Message(e).ack,!0,{token:this._ackToken}).then(t=>(t.token&&(this._ackToken=t.token),e))}ackTextChannel(e){return this.rest.makeRequest("post",a.Channel(e).Message(e.lastMessageID).ack,!0,{token:this._ackToken}).then(t=>(t.token&&(this._ackToken=t.token),e))}ackGuild(e){return this.rest.makeRequest("post",a.Guild(e).ack,!0).then(()=>e)}bulkDeleteMessages(e,t){return this.rest.makeRequest("post",a.Channel(e).messages.bulkDelete,!0,{messages:t}).then(()=>this.client.actions.MessageDeleteBulk.handle({channel_id:e.id,ids:t}).messages)}search(e,t){if("string"==typeof t&&(t={content:t}),t.before&&(t.before instanceof Date||(t.before=new Date(t.before)),t.maxID=n.fromNumber(t.before.getTime()-14200704e5).shiftLeft(22).toString()),t.after&&(t.after instanceof Date||(t.after=new Date(t.after)),t.minID=n.fromNumber(t.after.getTime()-14200704e5).shiftLeft(22).toString()),t.during){t.during instanceof Date||(t.during=new Date(t.during));const e=t.during.getTime()-14200704e5;t.minID=n.fromNumber(e).shiftLeft(22).toString(),t.maxID=n.fromNumber(e+864e5).shiftLeft(22).toString()}t.channel&&(t.channel=this.client.resolver.resolveChannelID(t.channel)),t.author&&(t.author=this.client.resolver.resolveUserID(t.author)),t.mentions&&(t.mentions=this.client.resolver.resolveUserID(t.options.mentions)),t={content:t.content,max_id:t.maxID,min_id:t.minID,has:t.has,channel_id:t.channel,author_id:t.author,author_type:t.authorType,context_size:t.contextSize,sort_by:t.sortBy,sort_order:t.sortOrder,limit:t.limit,offset:t.offset,mentions:t.mentions,mentions_everyone:t.mentionsEveryone,link_hostname:t.linkHostname,embed_provider:t.embedProvider,embed_type:t.embedType,attachment_filename:t.attachmentFilename,attachment_extension:t.attachmentExtension,include_nsfw:t.nsfw};for(const e in t)void 0===t[e]&&delete t[e];const s=(i.stringify(t).match(/[^=&?]+=[^=&?]+/g)||[]).join("&");let r;if(e instanceof b)r=a.Channel(e).search;else{if(!(e instanceof w))throw new TypeError("Target must be a TextChannel, DMChannel, GroupDMChannel, or Guild.");r=a.Guild(e).search}return this.rest.makeRequest("get",`${r}?${s}`,!0).then(e=>{const t=e.messages.map(e=>e.map(e=>new p(this.client.channels.get(e.channel_id),e,this.client)));return{totalResults:e.total_results,messages:t}})}createChannel(e,t,s){const{type:i,topic:n,nsfw:r,bitrate:l,userLimit:h,parent:u,permissionOverwrites:d,position:m,rateLimitPerUser:p,reason:f}=s;return this.rest.makeRequest("post",a.Guild(e).channels,!0,{name:t,topic:n,type:i?o.ChannelTypes[i.toUpperCase()]:"text",nsfw:r,bitrate:l,user_limit:h,parent_id:u instanceof b?u.id:u,permission_overwrites:c.call(this,d,e),position:m,rate_limit_per_user:p},void 0,f).then(e=>this.client.actions.ChannelCreate.handle(e).channel)}createDM(e){const t=this.getExistingDM(e);return t?Promise.resolve(t):this.rest.makeRequest("post",a.User(this.client.user).channels,!0,{recipient_id:e.id}).then(e=>this.client.actions.ChannelCreate.handle(e).channel)}createGroupDM(e){const t=this.client.user.bot?{access_tokens:e.accessTokens,nicks:e.nicks}:{recipients:e.recipients};return this.rest.makeRequest("post",a.User("@me").channels,!0,t).then(e=>new y(this.client,e))}addUserToGroupDM(e,t){const s=this.client.user.bot?{nick:t.nick,access_token:t.accessToken}:{recipient:t.id};return this.rest.makeRequest("put",a.Channel(e).Recipient(t.id),!0,s).then(()=>e)}removeUserFromGroupDM(e,t){return this.rest.makeRequest("delete",a.Channel(e).Recipient(t),!0).then(()=>e)}updateGroupDMChannel(e,t){const s={};return s.name=t.name,s.icon=t.icon,this.rest.makeRequest("patch",a.Channel(e),!0,s).then(()=>e)}getExistingDM(e){return this.client.channels.find(t=>t.recipient&&t.recipient.id===e.id)}deleteChannel(e,t){return(e instanceof d||e instanceof m)&&(e=this.getExistingDM(e)),e?this.rest.makeRequest("delete",a.Channel(e),!0,void 0,void 0,t).then(t=>(t.id=e.id,this.client.actions.ChannelDelete.handle(t).channel)):Promise.reject(new Error("No channel to delete."))}updateChannel(e,t,s){const i={};return i.name=(t.name||e.name).trim(),i.topic=void 0===t.topic?e.topic:t.topic,i.nsfw=void 0===t.nsfw?e.nsfw:t.nsfw,i.position=t.position||e.position,i.bitrate=t.bitrate||(e.bitrate?1e3*e.bitrate:void 0),i.user_limit=void 0!==t.userLimit?t.userLimit:e.userLimit,i.parent_id=t.parent instanceof b?t.parent.id:t.parent,i.permission_overwrites=t.permissionOverwrites?c.call(this,t.permissionOverwrites,e.guild):void 0,i.rate_limit_per_user=void 0!==t.rateLimitPerUser?t.rateLimitPerUser:e.rateLimitPerUser,this.rest.makeRequest("patch",a.Channel(e),!0,i,void 0,s).then(e=>this.client.actions.ChannelUpdate.handle(e).updated)}leaveGuild(e){return e.ownerID===this.client.user.id?Promise.reject(new Error("Guild is owned by the client.")):this.rest.makeRequest("delete",a.User("@me").Guild(e.id),!0).then(()=>this.client.actions.GuildDelete.handle({id:e.id}).guild)}createGuild(e){return e.icon=this.client.resolver.resolveBase64(e.icon)||null,e.region=e.region||"us-central",new Promise((t,s)=>{this.rest.makeRequest("post",a.guilds,!0,e).then(e=>{if(this.client.guilds.has(e.id))return t(this.client.guilds.get(e.id));const i=s=>{s.id===e.id&&(this.client.removeListener(o.Events.GUILD_CREATE,i),this.client.clearTimeout(n),t(s))};this.client.on(o.Events.GUILD_CREATE,i);const n=this.client.setTimeout(()=>{this.client.removeListener(o.Events.GUILD_CREATE,i),s(new Error("Took too long to receive guild data."))},1e4)},s)})}deleteGuild(e){return this.rest.makeRequest("delete",a.Guild(e),!0).then(()=>this.client.actions.GuildDelete.handle({id:e.id}).guild)}getUser(e,t){return this.rest.makeRequest("get",a.User(e),!0).then(e=>t?this.client.actions.UserGet.handle(e).user:new d(this.client,e))}updateCurrentUser(e,t){const s=this.client.user,i={};return i.username=e.username||s.username,i.avatar=void 0===e.avatar?s.avatar:this.client.resolver.resolveBase64(e.avatar),s.bot||(i.email=e.email||s.email,i.password=t,e.new_password&&(i.new_password=e.newPassword)),this.rest.makeRequest("patch",a.User("@me"),!0,i).then(e=>this.client.actions.UserUpdate.handle(e).updated)}updateGuild(e,t,s){return this.rest.makeRequest("patch",a.Guild(e),!0,t,void 0,s).then(e=>this.client.actions.GuildUpdate.handle(e).updated)}kickGuildMember(e,t,s){return this.rest.makeRequest("delete",a.Guild(e).Member(t),!0,void 0,void 0,s).then(()=>t)}createGuildRole(e,t,s){return t.color&&(t.color=this.client.resolver.resolveColor(t.color)),t.permissions&&(t.permissions=r.resolve(t.permissions)),this.rest.makeRequest("post",a.Guild(e).roles,!0,t,void 0,s).then(i=>{const{role:n}=this.client.actions.GuildRoleCreate.handle({guild_id:e.id,role:i});return t.position?n.setPosition(t.position,s):n})}deleteGuildRole(e,t){return this.rest.makeRequest("delete",a.Guild(e.guild).Role(e.id),!0,void 0,void 0,t).then(()=>this.client.actions.GuildRoleDelete.handle({guild_id:e.guild.id,role_id:e.id}).role)}setChannelOverwrite(e,t){return this.rest.makeRequest("put",`${a.Channel(e).permissions}/${t.id}`,!0,t)}deletePermissionOverwrites(e,t){return this.rest.makeRequest("delete",`${a.Channel(e.channel).permissions}/${e.id}`,!0,void 0,void 0,t).then(()=>e)}getChannelMessages(e,t={}){const s=[];t.limit&&s.push(`limit=${t.limit}`),t.around?s.push(`around=${t.around}`):t.before?s.push(`before=${t.before}`):t.after&&s.push(`after=${t.after}`);let i=a.Channel(e).messages;return s.length>0&&(i+=`?${s.join("&")}`),this.rest.makeRequest("get",i,!0)}getChannelMessage(e,t){const s=e.messages.get(t);return s?Promise.resolve(s):this.rest.makeRequest("get",a.Channel(e).Message(t),!0)}putGuildMember(e,t,s){if(s.access_token=s.accessToken,s.roles){const e=s.roles;(e instanceof l||e instanceof Array&&e[0]instanceof f)&&(s.roles=e.map(e=>e.id))}return this.rest.makeRequest("put",a.Guild(e).Member(t),!0,s).then(t=>this.client.actions.GuildMemberGet.handle(e,t).member)}getGuildMember(e,t,s){return this.rest.makeRequest("get",a.Guild(e).Member(t.id),!0).then(t=>s?this.client.actions.GuildMemberGet.handle(e,t).member:new m(e,t))}updateGuildMember(e,t,s){if(t.channel){const s=this.client.resolver.resolveChannel(t.channel);if(!s||s.guild.id!==e.guild.id||"voice"!==s.type)return Promise.reject(new Error("Could not resolve channel to a guild voice channel."));t.channel_id=s.id,t.channel=void 0}else null===t.channel&&(t.channel_id=null,t.channel=void 0);t.roles&&(t.roles=t.roles.map(e=>e instanceof f?e.id:e));let i=a.Member(e);if(e.id===this.client.user.id){const s=Object.keys(t);1===s.length&&"nick"===s[0]&&(i=a.Member(e).nickname)}return this.rest.makeRequest("patch",i,!0,t,void 0,s).then(t=>e.guild._updateMember(e,t).mem)}addMemberRole(e,t,s){return new Promise((i,n)=>{if(e._roles.includes(t.id))return i(e);const r=(s,n)=>{n.id===e.id&&!s._roles.includes(t.id)&&n._roles.includes(t.id)&&(this.client.removeListener(o.Events.GUILD_MEMBER_UPDATE,r),i(n))};this.client.on(o.Events.GUILD_MEMBER_UPDATE,r);const l=this.client.setTimeout(()=>{this.client.removeListener(o.Events.GUILD_MEMBER_UPDATE,r),n(new Error("Adding the role timed out."))},1e4);return this.rest.makeRequest("put",a.Member(e).Role(t.id),!0,void 0,void 0,s).catch(e=>{this.client.removeListener(o.Events.GUILD_MEMBER_UPDATE,r),this.client.clearTimeout(l),n(e)})})}removeMemberRole(e,t,s){return new Promise((i,n)=>{if(!e._roles.includes(t.id))return i(e);const r=(s,n)=>{n.id===e.id&&s._roles.includes(t.id)&&!n._roles.includes(t.id)&&(this.client.removeListener(o.Events.GUILD_MEMBER_UPDATE,r),i(n))};this.client.on(o.Events.GUILD_MEMBER_UPDATE,r);const l=this.client.setTimeout(()=>{this.client.removeListener(o.Events.GUILD_MEMBER_UPDATE,r),n(new Error("Removing the role timed out."))},1e4);return this.rest.makeRequest("delete",a.Member(e).Role(t.id),!0,void 0,void 0,s).catch(e=>{this.client.removeListener(o.Events.GUILD_MEMBER_UPDATE,r),this.client.clearTimeout(l),n(e)})})}sendTyping(e){return this.rest.makeRequest("post",a.Channel(e).typing,!0)}banGuildMember(e,t,s){const n=this.client.resolver.resolveUserID(t);if(!n)return Promise.reject(new Error("Couldn't resolve the user ID to ban."));const r=`${a.Guild(e).bans}/${n}?${i.stringify(s)}`;return this.rest.makeRequest("put",r,!0).then(()=>{if(t instanceof m)return t;const s=this.client.resolver.resolveUser(n);return s?(t=this.client.resolver.resolveGuildMember(e,s))||s:n})}unbanGuildMember(e,t,s){return new Promise((i,n)=>{const r=this.client.resolver.resolveUserID(t);if(!r)throw new Error("Couldn't resolve the user ID to unban.");const l=(t,s)=>{t.id===e.id&&s.id===r&&(this.client.removeListener(o.Events.GUILD_BAN_REMOVE,l),this.client.clearTimeout(h),i(s))};this.client.on(o.Events.GUILD_BAN_REMOVE,l);const h=this.client.setTimeout(()=>{this.client.removeListener(o.Events.GUILD_BAN_REMOVE,l),n(new Error("Took too long to receive the ban remove event."))},1e4);this.rest.makeRequest("delete",`${a.Guild(e).bans}/${r}`,!0,void 0,void 0,s).catch(e=>{this.client.removeListener(o.Events.GUILD_BAN_REMOVE,l),this.client.clearTimeout(h),n(e)})})}getGuildBan(e,t){const s=this.client.resolver.resolveUserID(t);return this.rest.makeRequest("get",`${a.Guild(e).bans}/${s}`,!0).then(e=>({reason:e.reason,user:this.client.dataManager.newUser(e.user)}))}getGuildBans(e){return this.rest.makeRequest("get",a.Guild(e).bans,!0).then(e=>e.reduce((e,t)=>(e.set(t.user.id,{reason:t.reason,user:this.client.dataManager.newUser(t.user)}),e),new l))}updateGuildRole(e,t,s){const i={};return i.name=t.name||e.name,i.position=void 0!==t.position?t.position:e.position,i.color=null===t.color?null:this.client.resolver.resolveColor(t.color||e.color),i.hoist=void 0!==t.hoist?t.hoist:e.hoist,i.mentionable=void 0!==t.mentionable?t.mentionable:e.mentionable,void 0!==t.permissions?i.permissions=r.resolve(t.permissions):i.permissions=e.permissions,this.rest.makeRequest("patch",a.Guild(e.guild).Role(e.id),!0,i,void 0,s).then(t=>this.client.actions.GuildRoleUpdate.handle({role:t,guild_id:e.guild.id}).updated)}pinMessage(e){return this.rest.makeRequest("put",a.Channel(e.channel).Pin(e.id),!0).then(()=>e)}unpinMessage(e){return this.rest.makeRequest("delete",a.Channel(e.channel).Pin(e.id),!0).then(()=>e)}getChannelPinnedMessages(e){return this.rest.makeRequest("get",a.Channel(e).pins,!0)}createChannelInvite(e,t,s){const i={};return i.temporary=t.temporary,i.max_age=t.maxAge,i.max_uses=t.maxUses,i.unique=t.unique,this.rest.makeRequest("post",a.Channel(e).invites,!0,i,void 0,s).then(e=>new g(this.client,e))}deleteInvite(e,t){return this.rest.makeRequest("delete",a.Invite(e.code),!0,void 0,void 0,t).then(()=>e)}getInvite(e){return this.rest.makeRequest("get",a.Invite(e),!0).then(e=>new g(this.client,e))}getGuildInvites(e){return this.rest.makeRequest("get",a.Guild(e).invites,!0).then(e=>{const t=new l;for(const s of e){const e=new g(this.client,s);t.set(e.code,e)}return t})}getGuildVanityCode(e){return this.rest.makeRequest("get",a.Guild(e).vanityURL,!0).then(e=>e.code)}pruneGuildMembers(e,t,s,i){return this.rest.makeRequest(s?"get":"post",`${a.Guild(e).prune}?days=${t}`,!0,void 0,void 0,i).then(e=>e.pruned)}createEmoji(e,t,s,i,n){const r={image:t,name:s};return i&&(r.roles=i.map(e=>e.id?e.id:e)),this.rest.makeRequest("post",a.Guild(e).emojis,!0,r,void 0,n).then(t=>this.client.actions.GuildEmojiCreate.handle(e,t).emoji)}updateEmoji(e,t,s){const i={};return t.name&&(i.name=t.name),t.roles&&(i.roles=t.roles.map(e=>e.id?e.id:e)),this.rest.makeRequest("patch",a.Guild(e.guild).Emoji(e.id),!0,i,void 0,s).then(t=>this.client.actions.GuildEmojiUpdate.handle(e,t).emoji)}deleteEmoji(e,t){return this.rest.makeRequest("delete",a.Guild(e.guild).Emoji(e.id),!0,void 0,t).then(()=>this.client.actions.GuildEmojiDelete.handle(e).data)}getGuildAuditLogs(e,t={}){t.before&&t.before instanceof T.Entry&&(t.before=t.before.id),t.after&&t.after instanceof T.Entry&&(t.after=t.after.id),"string"==typeof t.type&&(t.type=T.Actions[t.type]);const s=(i.stringify({before:t.before,after:t.after,limit:t.limit,user_id:this.client.resolver.resolveUserID(t.user),action_type:t.type}).match(/[^=&?]+=[^=&?]+/g)||[]).join("&");return this.rest.makeRequest("get",`${a.Guild(e).auditLogs}?${s}`,!0).then(t=>T.build(e,t))}getWebhook(e,t){return this.rest.makeRequest("get",a.Webhook(e,t),!t).then(e=>new E(this.client,e))}getGuildWebhooks(e){return this.rest.makeRequest("get",a.Guild(e).webhooks,!0).then(e=>{const t=new l;for(const s of e)t.set(s.id,new E(this.client,s));return t})}getChannelWebhooks(e){return this.rest.makeRequest("get",a.Channel(e).webhooks,!0).then(e=>{const t=new l;for(const s of e)t.set(s.id,new E(this.client,s));return t})}createWebhook(e,t,s,i){return this.rest.makeRequest("post",a.Channel(e).webhooks,!0,{name:t,avatar:s},void 0,i).then(e=>new E(this.client,e))}editWebhook(e,t,s){return this.rest.makeRequest("patch",a.Webhook(e.id,e.token),!1,{name:t,avatar:s}).then(t=>(e.name=t.name,e.avatar=t.avatar,e))}deleteWebhook(e,t){return this.rest.makeRequest("delete",a.Webhook(e.id,e.token),!1,void 0,void 0,t)}sendWebhookMessage(e,t,{avatarURL:s,tts:i,embeds:n,username:r}={},o=null){return new Promise((l,h)=>{if(r=r||e.name,t instanceof Array){const s=[];!function t(r,a){const c=a===r.length-1?{tts:i,embeds:n,files:o}:{tts:i};e.send(r[a],c).then(e=>(s.push(e),a>=r.length-1?l(s):t(r,++a))).catch(h)}(t,0)}else this.rest.makeRequest("post",`${a.Webhook(e.id,e.token)}?wait=true`,!1,{username:r,avatar_url:s,content:t,tts:i,embeds:n},o).then(e=>{this.client.channels?l(this.client.actions.MessageCreate.handle(e).message):l(e)},h)})}sendSlackWebhookMessage(e,t){return this.rest.makeRequest("post",`${a.Webhook(e.id,e.token)}/slack?wait=true`,!1,t)}fetchUserProfile(e){return this.rest.makeRequest("get",a.User(e).profile,!0).then(t=>new _(e,t))}fetchMentions(e){return e.guild instanceof w&&(e.guild=e.guild.id),h.mergeDefault({limit:25,roles:!0,everyone:!0,guild:null},e),this.rest.makeRequest("get",a.User("@me").Mentions(e.limit,e.roles,e.everyone,e.guild),!0).then(e=>e.map(e=>new p(this.client.channels.get(e.channel_id),e,this.client)))}addFriend(e){return this.rest.makeRequest("post",a.User("@me"),!0,{username:e.username,discriminator:e.discriminator}).then(()=>e)}removeFriend(e){return this.rest.makeRequest("delete",a.User("@me").Relationship(e.id),!0).then(()=>e)}blockUser(e){return this.rest.makeRequest("put",a.User("@me").Relationship(e.id),!0,{type:2}).then(()=>e)}unblockUser(e){return this.rest.makeRequest("delete",a.User("@me").Relationship(e.id),!0).then(()=>e)}updateChannelPositions(e,t){const s=new Array(t.length);for(let e=0;ethis.client.actions.GuildChannelsPositionUpdate.handle({guild_id:e,channels:t}).guild)}updateEmbed(e,t,s){return this.rest.makeRequest("patch",a.Guild(e).embed,!0,{enabled:t.enabled,channel_id:this.client.resolver.resolveChannelID(t.channel)},void 0,s)}setRolePositions(e,t){return this.rest.makeRequest("patch",a.Guild(e).roles,!0,t).then(()=>this.client.actions.GuildRolesPositionUpdate.handle({guild_id:e,roles:t}).guild)}setChannelPositions(e,t){return this.rest.makeRequest("patch",a.Guild(e).channels,!0,t).then(()=>this.client.actions.GuildChannelsPositionUpdate.handle({guild_id:e,channels:t}).guild)}addMessageReaction(e,t){return this.rest.makeRequest("put",a.Message(e).Reaction(t).User("@me"),!0).then(()=>e._addReaction(h.parseEmoji(t),e.client.user))}removeMessageReaction(e,t,s){const i=a.Message(e).Reaction(t).User(s===this.client.user.id?"@me":s);return this.rest.makeRequest("delete",i,!0).then(()=>this.client.actions.MessageReactionRemove.handle({user_id:s,message_id:e.id,emoji:h.parseEmoji(t),channel_id:e.channel.id}).reaction)}removeMessageReactions(e){return this.rest.makeRequest("delete",a.Message(e).reactions,!0).then(()=>e)}getMessageReactionUsers(e,t,s){const n=(i.stringify(s).match(/[^=&?]+=[^=&?]+/g)||[]).join("&");return this.rest.makeRequest("get",`${a.Message(e).Reaction(t)}?${n}`,!0)}getApplication(e){return this.rest.makeRequest("get",a.OAUTH2.Application(e),!0).then(e=>new v(this.client,e))}resetApplication(e){return this.rest.makeRequest("post",a.OAUTH2.Application(e).resetToken,!0).then(()=>this.rest.makeRequest("post",a.OAUTH2.Application(e).resetSecret,!0)).then(e=>new v(this.client,e))}setNote(e,t){return this.rest.makeRequest("put",a.User(e).note,!0,{note:t}).then(()=>e)}acceptInvite(e){return e.id&&(e=e.id),new Promise((t,s)=>this.rest.makeRequest("post",a.Invite(e),!0).then(e=>{const i=s=>{s.id===e.id&&(t(s),this.client.removeListener(o.Events.GUILD_CREATE,i))};this.client.on(o.Events.GUILD_CREATE,i),this.client.setTimeout(()=>{this.client.removeListener(o.Events.GUILD_CREATE,i),s(new Error("Accepting invite timed out"))},12e4)}))}patchUserSettings(e){return this.rest.makeRequest("patch",o.Endpoints.User("@me").settings,!0,e)}patchClientUserGuildSettings(e,t){return this.rest.makeRequest("patch",o.Endpoints.User("@me").Guild(e).settings,!0,t)}}},function(e,t,s){const i=s(6),n=s(4);e.exports=function(e,t){return(e instanceof n||e instanceof Array)&&(e=e.map(e=>{const s=this.client.resolver.resolveRole(t,e.id);return s?(e.id=s.id,e.type="role"):(e.id=this.client.resolver.resolveUserID(e.id),e.type="member"),{allow:i.resolve(e.allow||e.allowed||0),deny:i.resolve(e.deny||e.denied||0),type:e.type,id:e.id}})),e}},function(e,t,s){const i=s(4),n=s(79);e.exports=class UserProfile{constructor(e,t){this.user=e,Object.defineProperty(this,"client",{value:e.client}),this.mutualGuilds=new i,this.connections=new i,this.setup(t)}setup(e){this.premium=e.premium,this.premiumSince=e.premium_since?new Date(e.premium_since):null;for(const t of e.mutual_guilds)this.client.guilds.has(t.id)&&this.mutualGuilds.set(t.id,this.client.guilds.get(t.id));for(const t of e.connected_accounts)this.connections.set(t.id,new n(this.user,t))}}},function(e,t){e.exports=class UserConnection{constructor(e,t){this.user=e,this.setup(t)}setup(e){this.type=e.type,this.name=e.name,this.id=e.id,this.revoked=e.revoked,this.integrations=e.integrations}}},function(e,t){e.exports=class VoiceRegion{constructor(e){this.id=e.id,this.name=e.name,this.vip=e.vip,this.deprecated=e.deprecated,this.optimal=e.optimal,this.custom=e.custom,this.sampleHostname=e.sample_hostname}}},function(e,t,s){const i=s(53),n=s(36),{Events:{RATE_LIMIT:r}}=s(0);e.exports=class SequentialRequestHandler extends i{constructor(e,t){super(e,t),this.client=e.client,this.endpoint=t,this.timeDifference=0,this.busy=!1}push(e){super.push(e),this.handle()}execute(e){return this.busy=!0,new Promise(t=>{e.request.gen().end((s,i)=>{if(i&&i.headers&&(this.requestLimit=Number(i.headers["x-ratelimit-limit"]),this.requestResetTime=1e3*Number(i.headers["x-ratelimit-reset"]),this.requestRemaining=Number(i.headers["x-ratelimit-remaining"]),this.timeDifference=Date.now()-new Date(i.headers.date).getTime()),s)429===s.status?(this.queue.unshift(e),this.client.setTimeout(()=>{this.globalLimit=!1,t()},Number(i.headers["retry-after"])+this.client.options.restTimeOffset),i.headers["x-ratelimit-global"]&&(this.globalLimit=!0)):s.status>=500&&s.status<600?e.retries===this.client.options.retryLimit?(e.reject(s),t()):(e.retries++,this.queue.unshift(e),this.client.setTimeout(t,1e3+this.client.options.restTimeOffset)):(e.reject(s.status>=400&&s.status<500?new n(i.request.path,i.body,i.request.method):s),t(s));else{this.globalLimit=!1;const s=i&&i.body?i.body:{};e.resolve(s),0===this.requestRemaining?(this.client.listenerCount(r)&&this.client.emit(r,{limit:this.requestLimit,timeDifference:this.timeDifference,path:e.request.path,method:e.request.method}),this.client.setTimeout(()=>t(s),this.requestResetTime-Date.now()+this.timeDifference+this.client.options.restTimeOffset)):t(s)}})})}handle(){super.handle(),this.busy||0===this.remaining||0===this.queue.length||this.globalLimit||this.execute(this.queue.shift()).then(()=>{this.busy=!1,this.handle()})}}},function(e,t,s){const i=s(53),n=s(36),{Events:{RATE_LIMIT:r}}=s(0);e.exports=class BurstRequestHandler extends i{constructor(e,t){super(e,t),this.client=e.client,this.limit=1/0,this.resetTime=null,this.remaining=1,this.timeDifference=0,this.resetTimeout=null}push(e){super.push(e),this.handle()}execute(e){e&&e.request.gen().end((t,s)=>{if(s&&s.headers&&(this.limit=Number(s.headers["x-ratelimit-limit"]),this.resetTime=1e3*Number(s.headers["x-ratelimit-reset"]),this.remaining=Number(s.headers["x-ratelimit-remaining"]),this.timeDifference=Date.now()-new Date(s.headers.date).getTime()),t)if(429===t.status){if(this.queue.unshift(e),s.headers["x-ratelimit-global"]&&(this.globalLimit=!0),this.resetTimeout)return;this.resetTimeout=this.client.setTimeout(()=>{this.remaining=this.limit,this.globalLimit=!1,this.handle(),this.resetTimeout=null},Number(s.headers["retry-after"])+this.client.options.restTimeOffset)}else t.status>=500&&t.status<600?e.retries===this.client.options.retryLimit?(e.reject(t),this.handle()):(e.retries++,this.queue.unshift(e),this.resetTimeout=this.client.setTimeout(()=>{this.handle(),this.resetTimeout=null},1e3+this.client.options.restTimeOffset)):(e.reject(t.status>=400&&t.status<500?new n(s.request.path,s.body,s.request.method):t),this.handle());else{0===this.remaining&&this.client.listenerCount(r)&&this.client.emit(r,{limit:this.limit,timeDifference:this.timeDifference,path:e.request.path,method:e.request.method}),this.globalLimit=!1;const t=s&&s.body?s.body:{};e.resolve(t),this.handle()}})}handle(){super.handle(),0!==this.queue.length&&((this.remaining<=0||this.globalLimit)&&Date.now()-this.timeDifference{this.client.emit(i.Events.GUILD_CREATE,s)}):this.client.emit(i.Events.GUILD_CREATE,s)),s}newUser(e,t=!0){if(this.client.users.has(e.id))return this.client.users.get(e.id);const s=new o(this.client,e);return t&&this.client.users.set(s.id,s),s}newChannel(e,t){const s=this.client.channels.has(e.id);let n;if(e.type===i.ChannelTypes.DM)n=new p(this.client,e);else if(e.type===i.ChannelTypes.GROUP_DM)n=new f(this.client,e);else if(t=t||this.client.guilds.get(e.guild_id),s)n=this.client.channels.get(e.id);else if(t){switch(e.type){case i.ChannelTypes.TEXT:n=new h(t,e);break;case i.ChannelTypes.VOICE:n=new c(t,e);break;case i.ChannelTypes.CATEGORY:n=new u(t,e);break;case i.ChannelTypes.NEWS:n=new d(t,e);break;case i.ChannelTypes.STORE:n=new m(t,e)}t.channels.set(n.id,n)}return n&&!s?(this.pastReady&&this.client.emit(i.Events.CHANNEL_CREATE,n),this.client.channels.set(n.id,n),n):s?n:null}newEmoji(e,t){const s=t.emojis.has(e.id);if(e&&!s){let s=new a(t,e);return this.client.emit(i.Events.GUILD_EMOJI_CREATE,s),t.emojis.set(s.id,s),s}return s?t.emojis.get(e.id):null}killEmoji(e){e instanceof a&&e.guild&&(this.client.emit(i.Events.GUILD_EMOJI_DELETE,e),e.guild.emojis.delete(e.id))}killGuild(e){const t=this.client.guilds.has(e.id);this.client.guilds.delete(e.id),t&&this.pastReady&&this.client.emit(i.Events.GUILD_DELETE,e)}killUser(e){this.client.users.delete(e.id)}killChannel(e){this.client.channels.delete(e.id),e instanceof l&&e.guild.channels.delete(e.id)}updateGuild(e,t){const s=n.cloneObject(e);e.setup(t),this.pastReady&&this.client.emit(i.Events.GUILD_UPDATE,s,e)}updateChannel(e,t){e.setup(t)}updateEmoji(e,t){const s=n.cloneObject(e);return e.setup(t),this.client.emit(i.Events.GUILD_EMOJI_UPDATE,s,e),e}}},function(e,t,s){const i=s(0),n=s(56);e.exports=class ClientManager{constructor(e){this.client=e,this.heartbeatInterval=null}get status(){return this.connection?this.connection.status:i.Status.IDLE}connectToWebSocket(e,t,s){this.client.emit(i.Events.DEBUG,`Authenticated using token ${e}`),this.client.token=e;const r=this.client.setTimeout(()=>s(new Error(i.Errors.TOOK_TOO_LONG)),3e5);this.client.rest.methods.getGateway().then(o=>{const a=i.DefaultOptions.ws.version,l=`${o.url}/?v=${a}&encoding=${n.ENCODING}`;this.client.emit(i.Events.DEBUG,`Using gateway ${l}`),this.client.ws.connect(l),this.client.ws.connection.once("error",s),this.client.ws.connection.once("close",e=>{4004===e.code&&s(new Error(i.Errors.BAD_LOGIN)),4010===e.code&&s(new Error(i.Errors.INVALID_SHARD)),4011===e.code&&s(new Error(i.Errors.SHARDING_REQUIRED))}),this.client.once(i.Events.READY,()=>{t(e),this.client.clearTimeout(r)})},s)}destroy(){return this.client.ws.destroy(),this.client.rest.destroy(),this.client.user?this.client.user.bot?(this.client.token=null,Promise.resolve()):this.client.rest.methods.logout().then(()=>{this.client.token=null}):Promise.resolve()}}},function(e,t,s){const i=s(0),n=[i.WSEvents.READY,i.WSEvents.RESUMED,i.WSEvents.GUILD_CREATE,i.WSEvents.GUILD_DELETE,i.WSEvents.GUILD_MEMBERS_CHUNK,i.WSEvents.GUILD_MEMBER_ADD,i.WSEvents.GUILD_MEMBER_REMOVE];e.exports=class WebSocketPacketManager{constructor(e){this.ws=e,this.handlers={},this.queue=[],this.register(i.WSEvents.READY,s(87)),this.register(i.WSEvents.RESUMED,s(89)),this.register(i.WSEvents.GUILD_CREATE,s(90)),this.register(i.WSEvents.GUILD_DELETE,s(91)),this.register(i.WSEvents.GUILD_UPDATE,s(92)),this.register(i.WSEvents.GUILD_BAN_ADD,s(93)),this.register(i.WSEvents.GUILD_BAN_REMOVE,s(94)),this.register(i.WSEvents.GUILD_MEMBER_ADD,s(95)),this.register(i.WSEvents.GUILD_MEMBER_REMOVE,s(96)),this.register(i.WSEvents.GUILD_MEMBER_UPDATE,s(97)),this.register(i.WSEvents.GUILD_ROLE_CREATE,s(98)),this.register(i.WSEvents.GUILD_ROLE_DELETE,s(99)),this.register(i.WSEvents.GUILD_ROLE_UPDATE,s(100)),this.register(i.WSEvents.GUILD_EMOJIS_UPDATE,s(101)),this.register(i.WSEvents.GUILD_MEMBERS_CHUNK,s(102)),this.register(i.WSEvents.GUILD_INTEGRATIONS_UPDATE,s(103)),this.register(i.WSEvents.CHANNEL_CREATE,s(104)),this.register(i.WSEvents.CHANNEL_DELETE,s(105)),this.register(i.WSEvents.CHANNEL_UPDATE,s(106)),this.register(i.WSEvents.CHANNEL_PINS_UPDATE,s(107)),this.register(i.WSEvents.PRESENCE_UPDATE,s(108)),this.register(i.WSEvents.USER_UPDATE,s(109)),this.register(i.WSEvents.USER_NOTE_UPDATE,s(110)),this.register(i.WSEvents.USER_SETTINGS_UPDATE,s(111)),this.register(i.WSEvents.USER_GUILD_SETTINGS_UPDATE,s(112)),this.register(i.WSEvents.VOICE_STATE_UPDATE,s(113)),this.register(i.WSEvents.TYPING_START,s(114)),this.register(i.WSEvents.MESSAGE_CREATE,s(115)),this.register(i.WSEvents.MESSAGE_DELETE,s(116)),this.register(i.WSEvents.MESSAGE_UPDATE,s(117)),this.register(i.WSEvents.MESSAGE_DELETE_BULK,s(118)),this.register(i.WSEvents.VOICE_SERVER_UPDATE,s(119)),this.register(i.WSEvents.GUILD_SYNC,s(120)),this.register(i.WSEvents.RELATIONSHIP_ADD,s(121)),this.register(i.WSEvents.RELATIONSHIP_REMOVE,s(122)),this.register(i.WSEvents.MESSAGE_REACTION_ADD,s(123)),this.register(i.WSEvents.MESSAGE_REACTION_REMOVE,s(124)),this.register(i.WSEvents.MESSAGE_REACTION_REMOVE_ALL,s(125)),this.register(i.WSEvents.WEBHOOKS_UPDATE,s(126))}get client(){return this.ws.client}register(e,t){this.handlers[e]=new t(this)}handleQueue(){this.queue.forEach((e,t)=>{this.handle(this.queue[t],!0),this.queue.splice(t,1)})}handle(e,t=!1){return e.op===i.OPCodes.HEARTBEAT_ACK?(this.ws.client._pong(this.ws.client._pingTimestamp),this.ws.lastHeartbeatAck=!0,this.ws.client.emit("debug","Heartbeat acknowledged")):e.op===i.OPCodes.HEARTBEAT&&(this.client.ws.send({op:i.OPCodes.HEARTBEAT,d:this.client.ws.sequence}),this.ws.client.emit("debug","Received gateway heartbeat")),this.ws.status===i.Status.RECONNECTING&&(this.ws.reconnecting=!1,this.ws.checkIfReady()),this.ws.setSequence(e.s),void 0===this.ws.disabledEvents[e.t]&&(this.ws.status!==i.Status.READY&&-1===n.indexOf(e.t)?(this.queue.push(e),!1):(!t&&this.queue.length>0&&this.handleQueue(),!!this.handlers[e.t]&&this.handlers[e.t].handle(e)))}}},function(e,t,s){const i=s(1),n=s(57);e.exports=class ReadyHandler extends i{handle(e){const t=this.packetManager.client,s=e.d;t.ws.heartbeat(),s.user.user_settings=s.user_settings,s.user.user_guild_settings=s.user_guild_settings;const i=new n(t,s.user);t.user=i,t.readyAt=new Date,t.users.set(i.id,i);for(const e of s.guilds)t.guilds.has(e.id)||t.dataManager.newGuild(e);for(const e of s.private_channels)t.dataManager.newChannel(e);for(const e of s.relationships){const s=t.dataManager.newUser(e.user);1===e.type?t.user.friends.set(s.id,s):2===e.type&&t.user.blocked.set(s.id,s)}s.presences=s.presences||[];for(const e of s.presences)t.dataManager.newUser(e.user),t._setPresence(e.user.id,e);if(s.notes)for(const e in s.notes){let i=s.notes[e];i.length||(i=null),t.user.notes.set(e,i)}!t.user.bot&&t.options.sync&&t.setInterval(t.syncGuilds.bind(t),3e4),t.users.has("1")||t.dataManager.newUser({id:"1",username:"Clyde",discriminator:"0000",avatar:"https://discordapp.com/assets/f78426a064bc9dd24847519259bc42af.png",bot:!0,status:"online",game:null,verified:!0});const r=t.setTimeout(()=>{t.ws.connection.triggerReady()},1200*s.guilds.length);t.setMaxListeners(s.guilds.length+10),t.once("ready",()=>{t.syncGuilds(),t.setMaxListeners(10),t.clearTimeout(r)});const o=this.packetManager.ws;o.sessionID=s.session_id,o._trace=s._trace,t.emit("debug",`READY ${o._trace.join(" -> ")} ${o.sessionID}`),o.checkIfReady()}}},function(e,t,s){const i=s(0);e.exports=class ClientUserChannelOverride{constructor(e){this.patch(e)}patch(e){for(const t of Object.keys(i.UserChannelOverrideMap)){const s=i.UserChannelOverrideMap[t];e.hasOwnProperty(t)&&("function"==typeof s?this[s.name]=s(e[t]):this[s]=e[t])}}}},function(e,t,s){const i=s(1),n=s(0);e.exports=class ResumedHandler extends i{handle(e){const t=this.packetManager.client,s=t.ws.connection;s._trace=e.d._trace,s.status=n.Status.READY,this.packetManager.handleQueue();const i=s.sequence-s.closeSequence;s.debug(`RESUMED ${s._trace.join(" -> ")} | replayed ${i} events.`),t.emit(n.Events.RESUME,i),s.heartbeat()}}},function(e,t,s){const i=s(1);e.exports=class GuildCreateHandler extends i{handle(e){const t=this.packetManager.client,s=e.d,i=t.guilds.get(s.id);i?i.available||s.unavailable||(i.setup(s),this.packetManager.ws.checkIfReady()):t.dataManager.newGuild(s)}}},function(e,t,s){const i=s(1),n=s(0);e.exports=class GuildDeleteHandler extends i{handle(e){const t=this.packetManager.client,s=e.d,i=t.actions.GuildDelete.handle(s);i.guild&&t.emit(n.Events.GUILD_DELETE,i.guild)}}},function(e,t,s){const i=s(1);e.exports=class GuildUpdateHandler extends i{handle(e){const t=this.packetManager.client,s=e.d;t.actions.GuildUpdate.handle(s)}}},function(e,t,s){const i=s(1),n=s(0);e.exports=class GuildBanAddHandler extends i{handle(e){const t=this.packetManager.client,s=e.d,i=t.guilds.get(s.guild_id),r=t.users.get(s.user.id);i&&r&&t.emit(n.Events.GUILD_BAN_ADD,i,r)}}},function(e,t,s){const i=s(1);e.exports=class GuildBanRemoveHandler extends i{handle(e){const t=this.packetManager.client,s=e.d;t.actions.GuildBanRemove.handle(s)}}},function(e,t,s){const i=s(1);e.exports=class GuildMemberAddHandler extends i{handle(e){const t=this.packetManager.client,s=e.d,i=t.guilds.get(s.guild_id);i&&(i.memberCount++,i._addMember(s))}}},function(e,t,s){const i=s(1);e.exports=class GuildMemberRemoveHandler extends i{handle(e){const t=this.packetManager.client,s=e.d;t.actions.GuildMemberRemove.handle(s)}}},function(e,t,s){const i=s(1);e.exports=class GuildMemberUpdateHandler extends i{handle(e){const t=this.packetManager.client,s=e.d,i=t.guilds.get(s.guild_id);if(i){const e=i.members.get(s.user.id);e&&i._updateMember(e,s)}}}},function(e,t,s){const i=s(1);e.exports=class GuildRoleCreateHandler extends i{handle(e){const t=this.packetManager.client,s=e.d;t.actions.GuildRoleCreate.handle(s)}}},function(e,t,s){const i=s(1);e.exports=class GuildRoleDeleteHandler extends i{handle(e){const t=this.packetManager.client,s=e.d;t.actions.GuildRoleDelete.handle(s)}}},function(e,t,s){const i=s(1);e.exports=class GuildRoleUpdateHandler extends i{handle(e){const t=this.packetManager.client,s=e.d;t.actions.GuildRoleUpdate.handle(s)}}},function(e,t,s){const i=s(1);e.exports=class GuildEmojisUpdate extends i{handle(e){const t=this.packetManager.client,s=e.d;t.actions.GuildEmojisUpdate.handle(s)}}},function(e,t,s){const i=s(1),n=s(0);e.exports=class GuildMembersChunkHandler extends i{handle(e){const t=this.packetManager.client,s=e.d,i=t.guilds.get(s.guild_id);if(!i)return;const r=s.members.map(e=>i._addMember(e,!1));t.emit(n.Events.GUILD_MEMBERS_CHUNK,r,i),t.ws.lastHeartbeatAck=!0}}},function(e,t,s){const i=s(1),{Events:n}=s(0);e.exports=class GuildIntegrationsHandler extends i{handle(e){const t=this.packetManager.client,s=e.d,i=t.guilds.get(s.guild_id);i&&t.emit(n.GUILD_INTEGRATIONS_UPDATE,i)}}},function(e,t,s){const i=s(1);e.exports=class ChannelCreateHandler extends i{handle(e){const t=this.packetManager.client,s=e.d;t.actions.ChannelCreate.handle(s)}}},function(e,t,s){const i=s(1),n=s(0);e.exports=class ChannelDeleteHandler extends i{handle(e){const t=this.packetManager.client,s=e.d,i=t.actions.ChannelDelete.handle(s);i.channel&&t.emit(n.Events.CHANNEL_DELETE,i.channel)}}},function(e,t,s){const i=s(1);e.exports=class ChannelUpdateHandler extends i{handle(e){const t=this.packetManager.client,s=e.d;t.actions.ChannelUpdate.handle(s)}}},function(e,t,s){const i=s(1),n=s(0);e.exports=class ChannelPinsUpdate extends i{handle(e){const t=this.packetManager.client,s=e.d,i=t.channels.get(s.channel_id),r=new Date(s.last_pin_timestamp);i&&r&&(i.lastPinTimestamp=r.getTime()||null,t.emit(n.Events.CHANNEL_PINS_UPDATE,i,r))}}},function(e,t,s){const i=s(1),n=s(0),r=s(5);e.exports=class PresenceUpdateHandler extends i{handle(e){const t=this.packetManager.client,s=e.d;let i=t.users.get(s.user.id);const o=t.guilds.get(s.guild_id);if(!i){if(!s.user.username)return;i=t.dataManager.newUser(s.user)}const a=r.cloneObject(i);if(i.patch(s.user),i.equals(a)||t.emit(n.Events.USER_UPDATE,a,i),o){let e=o.members.get(i.id);if(e||"offline"===s.status||(e=o._addMember({user:i,roles:s.roles,deaf:!1,mute:!1},!1),t.emit(n.Events.GUILD_MEMBER_AVAILABLE,e)),e){if(0===t.listenerCount(n.Events.PRESENCE_UPDATE))return void o._setPresence(i.id,s);const a=r.cloneObject(e);e.presence&&(a.frozenPresence=r.cloneObject(e.presence)),o._setPresence(i.id,s),t.emit(n.Events.PRESENCE_UPDATE,a,e)}else o._setPresence(i.id,s)}}}},function(e,t,s){const i=s(1);e.exports=class UserUpdateHandler extends i{handle(e){const t=this.packetManager.client,s=e.d;t.actions.UserUpdate.handle(s)}}},function(e,t,s){const i=s(1);e.exports=class UserNoteUpdateHandler extends i{handle(e){const t=this.packetManager.client,s=e.d;t.actions.UserNoteUpdate.handle(s)}}},function(e,t,s){const i=s(1),n=s(0);e.exports=class UserSettingsUpdateHandler extends i{handle(e){const t=this.packetManager.client;t.user.settings.patch(e.d),t.emit(n.Events.USER_SETTINGS_UPDATE,t.user.settings)}}},function(e,t,s){const i=s(1),n=s(0),r=s(59);e.exports=class UserGuildSettingsUpdateHandler extends i{handle(e){const t=this.packetManager.client,s=t.user.guildSettings.get(e.d.guild_id);s?s.patch(e.d):t.user.guildSettings.set(e.d.guild_id,new r(e.d,t)),t.emit(n.Events.USER_GUILD_SETTINGS_UPDATE,t.user.guildSettings.get(e.d.guild_id))}}},function(e,t,s){const i=s(1),n=s(0),r=s(5);e.exports=class VoiceStateUpdateHandler extends i{handle(e){const t=this.packetManager.client,s=e.d,i=t.guilds.get(s.guild_id);if(i){const e=i.members.get(s.user_id);if(e){const i=r.cloneObject(e);e.voiceChannel&&e.voiceChannel.id!==s.channel_id&&e.voiceChannel.members.delete(i.id),s.channel_id||(e.speaking=null),e.user.id===t.user.id&&s.channel_id&&t.emit("self.voiceStateUpdate",s);const o=t.channels.get(s.channel_id);o&&(o.members.set(e.id,e),e.guild.channels.set(s.channel_id,o)),e.serverMute=s.mute,e.serverDeaf=s.deaf,e.selfMute=s.self_mute,e.selfDeaf=s.self_deaf,e.voiceSessionID=s.session_id,e.voiceChannelID=s.channel_id,t.emit(n.Events.VOICE_STATE_UPDATE,i,e)}}}}},function(e,t,s){const i=s(1),n=s(0);class TypingData{constructor(e,t,s,i){this.client=e,this.since=t,this.lastTimestamp=s,this._timeout=i}resetTimeout(e){this.client.clearTimeout(this._timeout),this._timeout=e}get elapsedTime(){return Date.now()-this.since}}function r(e,t){return e.client.setTimeout(()=>{e.client.emit(n.Events.TYPING_STOP,e,t,e._typing.get(t.id)),e._typing.delete(t.id)},6e3)}e.exports=class TypingStartHandler extends i{handle(e){const t=this.packetManager.client,s=e.d,i=t.channels.get(s.channel_id),o=t.users.get(s.user_id),a=new Date(1e3*s.timestamp);if(i&&o){if("voice"===i.type)return void t.emit(n.Events.WARN,`Discord sent a typing packet to voice channel ${i.id}`);if(i._typing.has(o.id)){const e=i._typing.get(o.id);e.lastTimestamp=a,e.resetTimeout(r(i,o))}else i._typing.set(o.id,new TypingData(t,a,a,r(i,o))),t.emit(n.Events.TYPING_START,i,o)}}}},function(e,t,s){const i=s(1),n=s(0);e.exports=class MessageCreateHandler extends i{handle(e){const t=this.packetManager.client,s=e.d,i=t.actions.MessageCreate.handle(s);i.message&&t.emit(n.Events.MESSAGE_CREATE,i.message)}}},function(e,t,s){const i=s(1),n=s(0);e.exports=class MessageDeleteHandler extends i{handle(e){const t=this.packetManager.client,s=e.d,i=t.actions.MessageDelete.handle(s);i.message&&t.emit(n.Events.MESSAGE_DELETE,i.message)}}},function(e,t,s){const i=s(1);e.exports=class MessageUpdateHandler extends i{handle(e){const t=this.packetManager.client,s=e.d;t.actions.MessageUpdate.handle(s)}}},function(e,t,s){const i=s(1);e.exports=class MessageDeleteBulkHandler extends i{handle(e){const t=this.packetManager.client,s=e.d;t.actions.MessageDeleteBulk.handle(s)}}},function(e,t,s){const i=s(1);e.exports=class VoiceServerUpdate extends i{handle(e){const t=this.packetManager.client,s=e.d;t.emit("self.voiceServer",s)}}},function(e,t,s){const i=s(1);e.exports=class GuildSyncHandler extends i{handle(e){const t=this.packetManager.client,s=e.d;t.actions.GuildSync.handle(s)}}},function(e,t,s){const i=s(1);e.exports=class RelationshipAddHandler extends i{handle(e){const t=this.packetManager.client,s=e.d;1===s.type?t.fetchUser(s.id).then(e=>{t.user.friends.set(e.id,e)}):2===s.type&&t.fetchUser(s.id).then(e=>{t.user.blocked.set(e.id,e)})}}},function(e,t,s){const i=s(1);e.exports=class RelationshipRemoveHandler extends i{handle(e){const t=this.packetManager.client,s=e.d;2===s.type?t.user.blocked.has(s.id)&&t.user.blocked.delete(s.id):1===s.type&&t.user.friends.has(s.id)&&t.user.friends.delete(s.id)}}},function(e,t,s){const i=s(1);e.exports=class MessageReactionAddHandler extends i{handle(e){const t=this.packetManager.client,s=e.d;t.actions.MessageReactionAdd.handle(s)}}},function(e,t,s){const i=s(1);e.exports=class MessageReactionRemove extends i{handle(e){const t=this.packetManager.client,s=e.d;t.actions.MessageReactionRemove.handle(s)}}},function(e,t,s){const i=s(1);e.exports=class MessageReactionRemoveAll extends i{handle(e){const t=this.packetManager.client,s=e.d;t.actions.MessageReactionRemoveAll.handle(s)}}},function(e,t,s){const i=s(1),{Events:n}=s(0);e.exports=class WebhooksUpdate extends i{handle(e){const t=this.packetManager.client,s=e.d,i=t.channels.get(s.channel_id);i&&t.emit(n.WEBHOOKS_UPDATE,i)}}},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t,s){const i=s(16).EventEmitter,n=s(0),r=s(56);e.exports=class WebSocketManager extends i{constructor(e){super(),this.client=e,this.connection=null}heartbeat(){return this.connection?this.connection.heartbeat():this.debug("No connection to heartbeat")}debug(e){return this.client.emit("debug",`[ws] ${e}`)}destroy(){return this.connection?this.connection.destroy():(this.debug("Attempted to destroy WebSocket but no connection exists!"),!1)}send(e){this.connection?this.connection.send(e):this.debug("No connection to websocket")}connect(e){if(!this.connection)return this.connection=new r(this,e),!0;switch(this.connection.status){case n.Status.IDLE:case n.Status.DISCONNECTED:return this.connection.connect(e,5500),!0;default:return this.debug(`Couldn't connect to ${e} as the websocket is at state ${this.connection.status}`),!1}}}},function(e,t,s){e.exports=class ActionsManager{constructor(e){this.client=e,this.register(s(133)),this.register(s(134)),this.register(s(135)),this.register(s(136)),this.register(s(137)),this.register(s(138)),this.register(s(139)),this.register(s(140)),this.register(s(141)),this.register(s(142)),this.register(s(143)),this.register(s(144)),this.register(s(145)),this.register(s(146)),this.register(s(147)),this.register(s(148)),this.register(s(149)),this.register(s(150)),this.register(s(151)),this.register(s(152)),this.register(s(153)),this.register(s(154)),this.register(s(155)),this.register(s(156)),this.register(s(157)),this.register(s(158)),this.register(s(159)),this.register(s(160))}register(e){this[e.name.replace(/Action$/,"")]=new e(this.client)}}},function(e,t,s){const i=s(3),n=s(19);e.exports=class MessageCreateAction extends i{handle(e){const t=this.client,s=t.channels.get((e instanceof Array?e[0]:e).channel_id),i=t.users.get((e instanceof Array?e[0]:e).author.id);if(s){const r=s.guild?s.guild.member(i):null;if(e instanceof Array){const o=new Array(e.length);for(let i=0;ithis.deleted.delete(e+t),this.client.options.restWsBridgeTimeout)}}},function(e,t,s){const i=s(3),n=s(4),r=s(0);e.exports=class MessageDeleteBulkAction extends i{handle(e){const t=new n,s=this.client.channels.get(e.channel_id);if(s)for(const i of e.ids){const e=s.messages.get(i);e&&(e.deleted=!0,t.set(e.id,e),s.messages.delete(i))}return t.size>0&&this.client.emit(r.Events.MESSAGE_BULK_DELETE,t),{messages:t}}}},function(e,t,s){const i=s(3),n=s(0);e.exports=class MessageUpdateAction extends i{handle(e){const t=this.client,s=t.channels.get(e.channel_id);if(s){const i=s.messages.get(e.id);return i?(i.patch(e),t.emit(n.Events.MESSAGE_UPDATE,i._edits[0],i),{old:i._edits[0],updated:i}):{old:i,updated:i}}return{old:null,updated:null}}}},function(e,t,s){const i=s(3),n=s(0);e.exports=class MessageReactionAdd extends i{handle(e){const t=this.client.users.get(e.user_id);if(!t)return!1;const s=this.client.channels.get(e.channel_id);if(!s||"voice"===s.type)return!1;const i=s.messages.get(e.message_id);if(!i)return!1;if(!e.emoji)return!1;const r=i._addReaction(e.emoji,t);return r&&this.client.emit(n.Events.MESSAGE_REACTION_ADD,r,t),{message:i,reaction:r,user:t}}}},function(e,t,s){const i=s(3),n=s(0);e.exports=class MessageReactionRemove extends i{handle(e){const t=this.client.users.get(e.user_id);if(!t)return!1;const s=this.client.channels.get(e.channel_id);if(!s||"voice"===s.type)return!1;const i=s.messages.get(e.message_id);if(!i)return!1;if(!e.emoji)return!1;const r=i._removeReaction(e.emoji,t);return r&&this.client.emit(n.Events.MESSAGE_REACTION_REMOVE,r,t),{message:i,reaction:r,user:t}}}},function(e,t,s){const i=s(3),n=s(0);e.exports=class MessageReactionRemoveAll extends i{handle(e){const t=this.client.channels.get(e.channel_id);if(!t||"voice"===t.type)return!1;const s=t.messages.get(e.message_id);return!!s&&(s._clearReactions(),this.client.emit(n.Events.MESSAGE_REACTION_REMOVE_ALL,s),{message:s})}}},function(e,t,s){const i=s(3);e.exports=class ChannelCreateAction extends i{handle(e){return{channel:this.client.dataManager.newChannel(e)}}}},function(e,t,s){const i=s(3);e.exports=class ChannelDeleteAction extends i{constructor(e){super(e),this.deleted=new Map}handle(e){const t=this.client;let s=t.channels.get(e.id);return s?(t.dataManager.killChannel(s),this.deleted.set(s.id,s),this.scheduleForDeletion(s.id)):s=this.deleted.get(e.id)||null,s&&(s.deleted=!0),{channel:s}}scheduleForDeletion(e){this.client.setTimeout(()=>this.deleted.delete(e),this.client.options.restWsBridgeTimeout)}}},function(e,t,s){const i=s(3),n=s(26),r=s(37),o=s(38),a=s(39),l=s(40),h=s(0),c=h.ChannelTypes,u=s(5);e.exports=class ChannelUpdateAction extends i{handle(e){const t=this.client;let s=t.channels.get(e.id);if(s){const i=u.cloneObject(s);if(c[s.type.toUpperCase()]!==e.type){let t;switch(e.type){case c.TEXT:t=n;break;case c.VOICE:t=r;break;case c.CATEGORY:t=o;break;case c.NEWS:t=a;break;case c.STORE:t=l}const i=new t(s.guild,e);if(s.messages&&i.messages)for(const[e,t]of s.messages)i.messages.set(e,t);s=i,this.client.channels.set(s.id,s)}else s.setup(e);return t.emit(h.Events.CHANNEL_UPDATE,i,s),{old:i,updated:s}}return{old:null,updated:null}}}},function(e,t,s){const i=s(3),n=s(0);e.exports=class GuildDeleteAction extends i{constructor(e){super(e),this.deleted=new Map}handle(e){const t=this.client;let s=t.guilds.get(e.id);if(s){for(const e of s.channels.values())"text"===e.type&&e.stopTyping(!0);if(s.available&&e.unavailable)return s.available=!1,t.emit(n.Events.GUILD_UNAVAILABLE,s),{guild:null};for(const e of s.channels.values())this.client.channels.delete(e.id);s.voiceConnection&&s.voiceConnection.disconnect(),t.guilds.delete(s.id),this.deleted.set(s.id,s),this.scheduleForDeletion(s.id)}else s=this.deleted.get(e.id)||null;return s&&(s.deleted=!0),{guild:s}}scheduleForDeletion(e){this.client.setTimeout(()=>this.deleted.delete(e),this.client.options.restWsBridgeTimeout)}}},function(e,t,s){const i=s(3),n=s(0),r=s(5);e.exports=class GuildUpdateAction extends i{handle(e){const t=this.client,s=t.guilds.get(e.id);if(s){const i=r.cloneObject(s);return s.setup(e),t.emit(n.Events.GUILD_UPDATE,i,s),{old:i,updated:s}}return{old:null,updated:null}}}},function(e,t,s){const i=s(3);e.exports=class GuildMemberGetAction extends i{handle(e,t){return{member:e._addMember(t,!1)}}}},function(e,t,s){const i=s(3),n=s(0);e.exports=class GuildMemberRemoveAction extends i{constructor(e){super(e),this.deleted=new Map}handle(e){const t=this.client,s=t.guilds.get(e.guild_id);let i=null;return s&&(i=s.members.get(e.user.id),s.memberCount--,i?(s._removeMember(i),this.deleted.set(s.id+e.user.id,i),t.status===n.Status.READY&&t.emit(n.Events.GUILD_MEMBER_REMOVE,i),this.scheduleForDeletion(s.id,e.user.id)):i=this.deleted.get(s.id+e.user.id)||null,i&&(i.deleted=!0)),{guild:s,member:i}}scheduleForDeletion(e,t){this.client.setTimeout(()=>this.deleted.delete(e+t),this.client.options.restWsBridgeTimeout)}}},function(e,t,s){const i=s(3),n=s(0);e.exports=class GuildBanRemove extends i{handle(e){const t=this.client,s=t.guilds.get(e.guild_id),i=t.dataManager.newUser(e.user);s&&i&&t.emit(n.Events.GUILD_BAN_REMOVE,s,i)}}},function(e,t,s){const i=s(3),n=s(0),r=s(9);e.exports=class GuildRoleCreate extends i{handle(e){const t=this.client,s=t.guilds.get(e.guild_id);let i;if(s){const o=s.roles.has(e.role.id);i=new r(s,e.role),s.roles.set(i.id,i),o||t.emit(n.Events.GUILD_ROLE_CREATE,i)}return{role:i}}}},function(e,t,s){const i=s(3),n=s(0);e.exports=class GuildRoleDeleteAction extends i{constructor(e){super(e),this.deleted=new Map}handle(e){const t=this.client,s=t.guilds.get(e.guild_id);let i;return s&&((i=s.roles.get(e.role_id))?(s.roles.delete(e.role_id),this.deleted.set(s.id+e.role_id,i),this.scheduleForDeletion(s.id,e.role_id),t.emit(n.Events.GUILD_ROLE_DELETE,i)):i=this.deleted.get(s.id+e.role_id)||null,i&&(i.deleted=!0)),{role:i}}scheduleForDeletion(e,t){this.client.setTimeout(()=>this.deleted.delete(e+t),this.client.options.restWsBridgeTimeout)}}},function(e,t,s){const i=s(3),n=s(0),r=s(5);e.exports=class GuildRoleUpdateAction extends i{handle(e){const t=this.client,s=t.guilds.get(e.guild_id);if(s){const i=e.role;let o=null;const a=s.roles.get(i.id);return a&&(o=r.cloneObject(a),a.setup(e.role),t.emit(n.Events.GUILD_ROLE_UPDATE,o,a)),{old:o,updated:a}}return{old:null,updated:null}}}},function(e,t,s){const i=s(3);e.exports=class UserGetAction extends i{handle(e){return{user:this.client.dataManager.newUser(e)}}}},function(e,t,s){const i=s(3),n=s(0),r=s(5);e.exports=class UserUpdateAction extends i{handle(e){const t=this.client;if(t.user){if(t.user.equals(e))return{old:t.user,updated:t.user};const s=r.cloneObject(t.user);return t.user.patch(e),t.emit(n.Events.USER_UPDATE,s,t.user),{old:s,updated:t.user}}return{old:null,updated:null}}}},function(e,t,s){const i=s(3),n=s(0);e.exports=class UserNoteUpdateAction extends i{handle(e){const t=this.client,s=t.user.notes.get(e.id),i=e.note.length?e.note:null;return t.user.notes.set(e.id,i),t.emit(n.Events.USER_NOTE_UPDATE,e.id,s,i),{old:s,updated:i}}}},function(e,t,s){const i=s(3);e.exports=class GuildSync extends i{handle(e){const t=this.client.guilds.get(e.id);if(t){if(e.presences)for(const s of e.presences)t._setPresence(s.user.id,s);if(e.members)for(const s of e.members){const e=t.members.get(s.user.id);e?t._updateMember(e,s):t._addMember(s,!1)}"large"in e&&(t.large=e.large)}}}},function(e,t,s){const i=s(3);e.exports=class GuildEmojiCreateAction extends i{handle(e,t){return{emoji:this.client.dataManager.newEmoji(t,e)}}}},function(e,t,s){const i=s(3);e.exports=class GuildEmojiDeleteAction extends i{handle(e){return this.client.dataManager.killEmoji(e),e.deleted=!0,{emoji:e}}}},function(e,t,s){const i=s(3);e.exports=class GuildEmojiUpdateAction extends i{handle(e,t){return{emoji:this.client.dataManager.updateEmoji(e,t)}}}},function(e,t,s){const i=s(3);e.exports=class GuildEmojisUpdateAction extends i{handle(e){const t=this.client.guilds.get(e.guild_id);if(!t||!t.emojis)return;const s=function(e){const t=new Map;for(const s of e)t.set(...s);return t}(t.emojis.entries());for(const i of e.emojis){const e=t.emojis.get(i.id);e?(s.delete(i.id),e.equals(i,!0)||this.client.actions.GuildEmojiUpdate.handle(e,i)):this.client.actions.GuildEmojiCreate.handle(t,i)}for(const e of s.values())this.client.actions.GuildEmojiDelete.handle(e)}}},function(e,t,s){const i=s(3);e.exports=class GuildRolesPositionUpdate extends i{handle(e){const t=this.client.guilds.get(e.guild_id);if(t)for(const s of e.roles){const e=t.roles.get(s.id);e&&(e.position=s.position)}return{guild:t}}}},function(e,t,s){const i=s(3);e.exports=class GuildChannelsPositionUpdate extends i{handle(e){const t=this.client.guilds.get(e.guild_id);if(t)for(const s of e.channels){const e=t.channels.get(s.id);e&&(e.position=s.position)}return{guild:t}}}},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t,s){const i=s(25),n=s(43),r=s(30),o=s(0),a=s(5);e.exports=class WebhookClient extends i{constructor(e,t,s){super(null,e,t),this.options=a.mergeDefault(o.DefaultOptions,s),this.rest=new n(this),this.resolver=new r(this),this._timeouts=new Set,this._intervals=new Set}setTimeout(e,t,...s){const i=setTimeout(()=>{e(...s),this._timeouts.delete(i)},t);return this._timeouts.add(i),i}clearTimeout(e){clearTimeout(e),this._timeouts.delete(e)}setInterval(e,t,...s){const i=setInterval(e,t,...s);return this._intervals.add(i),i}clearInterval(e){clearInterval(e),this._intervals.delete(e)}destroy(){for(const e of this._timeouts)clearTimeout(e);for(const e of this._intervals)clearInterval(e);this._timeouts.clear(),this._intervals.clear()}}}]); \ No newline at end of file +!function(e){var t={};function s(i){if(t[i])return t[i].exports;var n=t[i]={i:i,l:!1,exports:{}};return e[i].call(n.exports,n,n.exports,s),n.l=!0,n.exports}s.m=e,s.c=t,s.d=function(e,t,i){s.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},s.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},s.t=function(e,t){if(1&t&&(e=s(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(s.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)s.d(i,n,function(t){return e[t]}.bind(null,n));return i},s.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return s.d(t,"a",t),t},s.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},s.p="",s(s.s=64)}([function(e,t,s){(function(e){t.Package=s(46),t.DefaultOptions={apiRequestMethod:"sequential",shardId:0,shardCount:0,messageCacheMaxSize:200,messageCacheLifetime:0,messageSweepInterval:0,fetchAllMembers:!1,disableEveryone:!1,sync:!1,restWsBridgeTimeout:5e3,retryLimit:1/0,disabledEvents:[],restTimeOffset:500,ws:{large_threshold:250,compress:"browser"!==s(75).platform(),properties:{$os:e?e.platform:"discord.js",$browser:"discord.js",$device:"discord.js",$referrer:"",$referring_domain:""},version:6},http:{version:7,host:"https://discordapp.com",cdn:"https://cdn.discordapp.com"}},t.WSCodes={1000:"Connection gracefully closed",4004:"Tried to identify with an invalid token",4010:"Sharding data provided was invalid",4011:"Shard would be on too many guilds if connected"},t.Errors={NO_TOKEN:"Request to use token, but token was unavailable to the client.",NO_BOT_ACCOUNT:"Only bot accounts are able to make use of this feature.",NO_USER_ACCOUNT:"Only user accounts are able to make use of this feature.",BAD_WS_MESSAGE:"A bad message was received from the websocket; either bad compression, or not JSON.",TOOK_TOO_LONG:"Something took too long to do.",NOT_A_PERMISSION:"Invalid permission string or number.",INVALID_RATE_LIMIT_METHOD:"Unknown rate limiting method.",BAD_LOGIN:"Incorrect login details were provided.",INVALID_SHARD:"Invalid shard settings were provided.",SHARDING_REQUIRED:"This session would have handled too many guilds - Sharding is required.",INVALID_TOKEN:"An invalid token was provided."};const i=t.Endpoints={User:e=>{e.id&&(e=e.id);const t=`/users/${e}`;return{toString:()=>t,channels:`${t}/channels`,profile:`${t}/profile`,relationships:`${t}/relationships`,settings:`${t}/settings`,Relationship:e=>`${t}/relationships/${e}`,Guild:e=>({toString:()=>`${t}/guilds/${e}`,settings:`${t}/guilds/${e}/settings`}),Note:e=>`${t}/notes/${e}`,Mentions:(e,s,i,n)=>`${t}/mentions?limit=${e}&roles=${s}&everyone=${i}${n?`&guild_id=${n}`:""}`,Avatar:(t,s)=>"1"===e?s:i.CDN(t).Avatar(e,s)}},guilds:"/guilds",Guild:e=>{e.id&&(e=e.id);const t=`/guilds/${e}`;return{toString:()=>t,prune:`${t}/prune`,embed:`${t}/embed`,bans:`${t}/bans`,integrations:`${t}/integrations`,members:`${t}/members`,channels:`${t}/channels`,invites:`${t}/invites`,roles:`${t}/roles`,emojis:`${t}/emojis`,search:`${t}/messages/search`,vanityURL:`${t}/vanity-url`,voiceRegions:`${t}/regions`,webhooks:`${t}/webhooks`,ack:`${t}/ack`,settings:`${t}/settings`,auditLogs:`${t}/audit-logs`,Emoji:e=>`${t}/emojis/${e}`,Icon:(t,s)=>i.CDN(t).Icon(e,s),Banner:(t,s)=>i.CDN(t).Banner(e,s),Splash:(t,s)=>i.CDN(t).Splash(e,s),Role:e=>`${t}/roles/${e}`,Member:e=>{e.id&&(e=e.id);const s=`${t}/members/${e}`;return{toString:()=>s,Role:e=>`${s}/roles/${e}`,nickname:`${t}/members/@me/nick`}},Integration:e=>`${t}/integrations/${e}`}},channels:"/channels",Channel:e=>{e.id&&(e=e.id);const t=`/channels/${e}`;return{toString:()=>t,messages:{toString:()=>`${t}/messages`,bulkDelete:`${t}/messages/bulk-delete`},invites:`${t}/invites`,typing:`${t}/typing`,permissions:`${t}/permissions`,webhooks:`${t}/webhooks`,search:`${t}/messages/search`,pins:`${t}/pins`,Icon:(t,s)=>i.CDN(t).GDMIcon(e,s),Pin:e=>`${t}/pins/${e}`,Recipient:e=>`${t}/recipients/${e}`,Message:e=>{e.id&&(e=e.id);const s=`${t}/messages/${e}`;return{toString:()=>s,reactions:`${s}/reactions`,ack:`${s}/ack`,Reaction:e=>{const t=`${s}/reactions/${e}`;return{toString:()=>t,User:e=>`${t}/${e}`}}}}}},Message:e=>t.Endpoints.Channel(e.channel).Message(e),Member:e=>t.Endpoints.Guild(e.guild).Member(e),CDN:e=>({Emoji:(t,s="png")=>`${e}/emojis/${t}.${s}`,Asset:t=>`${e}/assets/${t}`,Avatar:(t,s)=>`${e}/avatars/${t}/${s}.${s.startsWith("a_")?"gif":"png?size=2048"}`,Icon:(t,s)=>`${e}/icons/${t}/${s}.jpg`,Banner:(t,s)=>`${e}/banners/${t}/${s}.jpg`,AppIcon:(t,s)=>`${e}/app-icons/${t}/${s}.png`,AppAsset:(t,s)=>`${e}/app-assets/${t}/${s}.png`,GDMIcon:(t,s)=>`${e}/channel-icons/${t}/${s}.jpg?size=2048`,Splash:(t,s)=>`${e}/splashes/${t}/${s}.jpg`,TeamIcon:(t,s)=>`${e}/team-icons/${t}/${s}.jpg`}),OAUTH2:{Application:e=>{const t=`/oauth2/applications/${e}`;return{toString:()=>t,resetSecret:`${t}/reset`,resetToken:`${t}/bot/reset`}},App:e=>`/oauth2/authorize?client_id=${e}`},login:"/auth/login",logout:"/auth/logout",voiceRegions:"/voice/regions",gateway:{toString:()=>"/gateway",bot:"/gateway/bot"},Invite:e=>`/invite/${e}?with_counts=true`,inviteLink:e=>`https://discord.gg/${e}`,Webhook:(e,t)=>`/webhooks/${e}${t?`/${t}`:""}`};t.Status={READY:0,CONNECTING:1,RECONNECTING:2,IDLE:3,NEARLY:4,DISCONNECTED:5},t.VoiceStatus={CONNECTED:0,CONNECTING:1,AUTHENTICATING:2,RECONNECTING:3,DISCONNECTED:4},t.ChannelTypes={TEXT:0,DM:1,VOICE:2,GROUP_DM:3,CATEGORY:4,NEWS:5,STORE:6},t.OPCodes={DISPATCH:0,HEARTBEAT:1,IDENTIFY:2,STATUS_UPDATE:3,VOICE_STATE_UPDATE:4,VOICE_GUILD_PING:5,RESUME:6,RECONNECT:7,REQUEST_GUILD_MEMBERS:8,INVALID_SESSION:9,HELLO:10,HEARTBEAT_ACK:11},t.VoiceOPCodes={IDENTIFY:0,SELECT_PROTOCOL:1,READY:2,HEARTBEAT:3,SESSION_DESCRIPTION:4,SPEAKING:5},t.Events={RATE_LIMIT:"rateLimit",READY:"ready",RESUME:"resume",GUILD_CREATE:"guildCreate",GUILD_DELETE:"guildDelete",GUILD_UPDATE:"guildUpdate",GUILD_UNAVAILABLE:"guildUnavailable",GUILD_AVAILABLE:"guildAvailable",GUILD_MEMBER_ADD:"guildMemberAdd",GUILD_MEMBER_REMOVE:"guildMemberRemove",GUILD_MEMBER_UPDATE:"guildMemberUpdate",GUILD_MEMBER_AVAILABLE:"guildMemberAvailable",GUILD_MEMBER_SPEAKING:"guildMemberSpeaking",GUILD_MEMBERS_CHUNK:"guildMembersChunk",GUILD_INTEGRATIONS_UPDATE:"guildIntegrationsUpdate",GUILD_ROLE_CREATE:"roleCreate",GUILD_ROLE_DELETE:"roleDelete",GUILD_ROLE_UPDATE:"roleUpdate",GUILD_EMOJI_CREATE:"emojiCreate",GUILD_EMOJI_DELETE:"emojiDelete",GUILD_EMOJI_UPDATE:"emojiUpdate",GUILD_BAN_ADD:"guildBanAdd",GUILD_BAN_REMOVE:"guildBanRemove",INVITE_CREATE:"inviteCreate",INVITE_DELETE:"inviteDelete",CHANNEL_CREATE:"channelCreate",CHANNEL_DELETE:"channelDelete",CHANNEL_UPDATE:"channelUpdate",CHANNEL_PINS_UPDATE:"channelPinsUpdate",MESSAGE_CREATE:"message",MESSAGE_DELETE:"messageDelete",MESSAGE_UPDATE:"messageUpdate",MESSAGE_BULK_DELETE:"messageDeleteBulk",MESSAGE_REACTION_ADD:"messageReactionAdd",MESSAGE_REACTION_REMOVE:"messageReactionRemove",MESSAGE_REACTION_REMOVE_EMOJI:"messageReactionRemoveEmoji",MESSAGE_REACTION_REMOVE_ALL:"messageReactionRemoveAll",USER_UPDATE:"userUpdate",USER_NOTE_UPDATE:"userNoteUpdate",USER_SETTINGS_UPDATE:"clientUserSettingsUpdate",USER_GUILD_SETTINGS_UPDATE:"clientUserGuildSettingsUpdate",PRESENCE_UPDATE:"presenceUpdate",VOICE_STATE_UPDATE:"voiceStateUpdate",TYPING_START:"typingStart",TYPING_STOP:"typingStop",WEBHOOKS_UPDATE:"webhookUpdate",DISCONNECT:"disconnect",RECONNECTING:"reconnecting",ERROR:"error",WARN:"warn",DEBUG:"debug"},t.ActivityTypes=["PLAYING","STREAMING","LISTENING","WATCHING","CUSTOM_STATUS"],t.ActivityFlags={INSTANCE:1,JOIN:2,SPECTATE:4,JOIN_REQUEST:8,SYNC:16,PLAY:32},t.WSEvents={READY:"READY",RESUMED:"RESUMED",GUILD_SYNC:"GUILD_SYNC",GUILD_CREATE:"GUILD_CREATE",GUILD_DELETE:"GUILD_DELETE",GUILD_UPDATE:"GUILD_UPDATE",GUILD_MEMBER_ADD:"GUILD_MEMBER_ADD",GUILD_MEMBER_REMOVE:"GUILD_MEMBER_REMOVE",GUILD_MEMBER_UPDATE:"GUILD_MEMBER_UPDATE",GUILD_MEMBERS_CHUNK:"GUILD_MEMBERS_CHUNK",GUILD_INTEGRATIONS_UPDATE:"GUILD_INTEGRATIONS_UPDATE",GUILD_ROLE_CREATE:"GUILD_ROLE_CREATE",GUILD_ROLE_DELETE:"GUILD_ROLE_DELETE",GUILD_ROLE_UPDATE:"GUILD_ROLE_UPDATE",GUILD_BAN_ADD:"GUILD_BAN_ADD",GUILD_BAN_REMOVE:"GUILD_BAN_REMOVE",GUILD_EMOJIS_UPDATE:"GUILD_EMOJIS_UPDATE",INVITE_CREATE:"INVITE_CREATE",INVITE_DELETE:"INVITE_DELETE",CHANNEL_CREATE:"CHANNEL_CREATE",CHANNEL_DELETE:"CHANNEL_DELETE",CHANNEL_UPDATE:"CHANNEL_UPDATE",CHANNEL_PINS_UPDATE:"CHANNEL_PINS_UPDATE",MESSAGE_CREATE:"MESSAGE_CREATE",MESSAGE_DELETE:"MESSAGE_DELETE",MESSAGE_UPDATE:"MESSAGE_UPDATE",MESSAGE_DELETE_BULK:"MESSAGE_DELETE_BULK",MESSAGE_REACTION_ADD:"MESSAGE_REACTION_ADD",MESSAGE_REACTION_REMOVE:"MESSAGE_REACTION_REMOVE",MESSAGE_REACTION_RMEOVE_EMOJI:"MESSAGE_REACTION_REMOVE_EMOJI",MESSAGE_REACTION_REMOVE_ALL:"MESSAGE_REACTION_REMOVE_ALL",USER_UPDATE:"USER_UPDATE",USER_NOTE_UPDATE:"USER_NOTE_UPDATE",USER_SETTINGS_UPDATE:"USER_SETTINGS_UPDATE",USER_GUILD_SETTINGS_UPDATE:"USER_GUILD_SETTINGS_UPDATE",PRESENCE_UPDATE:"PRESENCE_UPDATE",VOICE_STATE_UPDATE:"VOICE_STATE_UPDATE",TYPING_START:"TYPING_START",VOICE_SERVER_UPDATE:"VOICE_SERVER_UPDATE",RELATIONSHIP_ADD:"RELATIONSHIP_ADD",RELATIONSHIP_REMOVE:"RELATIONSHIP_REMOVE",WEBHOOKS_UPDATE:"WEBHOOKS_UPDATE"},t.MessageTypes=["DEFAULT","RECIPIENT_ADD","RECIPIENT_REMOVE","CALL","CHANNEL_NAME_CHANGE","CHANNEL_ICON_CHANGE","PINS_ADD","GUILD_MEMBER_JOIN","USER_PREMIUM_GUILD_SUBSCRIPTION","USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_1","USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_2","USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_3","CHANNEL_FOLLOW_ADD",null,"GUILD_DISCOVERY_DISQUALIFIED","GUILD_DISCOVERY_REQUALIFIED"],t.MessageNotificationTypes=["EVERYTHING","MENTIONS","NOTHING","INHERIT"],t.DefaultAvatars={BLURPLE:"6debd47ed13483642cf09e832ed0bc1b",GREY:"322c936a8c8be1b803cd94861bdfa868",GREEN:"dd4dbc0016779df1378e7812eabaa04d",ORANGE:"0e291f67c9274a1abdddeb3fd919cbaa",RED:"1cbd08c76f8af6dddce02c5138971129"},t.ExplicitContentFilterTypes=["DISABLED","NON_FRIENDS","FRIENDS_AND_NON_FRIENDS"],t.UserSettingsMap={convert_emoticons:"convertEmoticons",default_guilds_restricted:"defaultGuildsRestricted",detect_platform_accounts:"detectPlatformAccounts",developer_mode:"developerMode",enable_tts_command:"enableTTSCommand",theme:"theme",status:"status",show_current_game:"showCurrentGame",inline_attachment_media:"inlineAttachmentMedia",inline_embed_media:"inlineEmbedMedia",locale:"locale",message_display_compact:"messageDisplayCompact",render_reactions:"renderReactions",guild_positions:"guildPositions",restricted_guilds:"restrictedGuilds",explicit_content_filter:function(e){return t.ExplicitContentFilterTypes[e]},friend_source_flags:function(e){return{all:e.all||!1,mutualGuilds:!!e.all||(e.mutual_guilds||!1),mutualFriends:!!e.all||(e.mutualFriends||!1)}}},t.UserGuildSettingsMap={message_notifications:function(e){return t.MessageNotificationTypes[e]},mobile_push:"mobilePush",muted:"muted",suppress_everyone:"suppressEveryone",channel_overrides:"channelOverrides"},t.UserChannelOverrideMap={message_notifications:function(e){return t.MessageNotificationTypes[e]},muted:"muted"},t.Colors={DEFAULT:0,WHITE:16777215,AQUA:1752220,GREEN:3066993,BLUE:3447003,PURPLE:10181046,LUMINOUS_VIVID_PINK:15277667,GOLD:15844367,ORANGE:15105570,RED:15158332,GREY:9807270,NAVY:3426654,DARK_AQUA:1146986,DARK_GREEN:2067276,DARK_BLUE:2123412,DARK_PURPLE:7419530,DARK_VIVID_PINK:11342935,DARK_GOLD:12745742,DARK_ORANGE:11027200,DARK_RED:10038562,DARK_GREY:9936031,DARKER_GREY:8359053,LIGHT_GREY:12370112,DARK_NAVY:2899536,BLURPLE:7506394,GREYPLE:10070709,DARK_BUT_NOT_BLACK:2895667,NOT_QUITE_BLACK:2303786},t.VerificationLevels=["None","Low","Medium","(╯°□°)╯︵ ┻━┻","┻━┻ ミヽ(ಠ益ಠ)ノ彡┻━┻"],t.APIErrors={UNKNOWN_ACCOUNT:10001,UNKNOWN_APPLICATION:10002,UNKNOWN_CHANNEL:10003,UNKNOWN_GUILD:10004,UNKNOWN_INTEGRATION:10005,UNKNOWN_INVITE:10006,UNKNOWN_MEMBER:10007,UNKNOWN_MESSAGE:10008,UNKNOWN_OVERWRITE:10009,UNKNOWN_PROVIDER:10010,UNKNOWN_ROLE:10011,UNKNOWN_TOKEN:10012,UNKNOWN_USER:10013,UNKNOWN_EMOJI:10014,UNKNOWN_WEBHOOK:10015,BOT_PROHIBITED_ENDPOINT:20001,BOT_ONLY_ENDPOINT:20002,MAXIMUM_GUILDS:30001,MAXIMUM_FRIENDS:30002,MAXIMUM_PINS:30003,MAXIMUM_ROLES:30005,MAXIMUM_REACTIONS:30010,MAXIMUM_CHANNELS:30013,MAXIMUM_INVITES:30016,UNAUTHORIZED:40001,USER_BANNED:40007,MISSING_ACCESS:50001,INVALID_ACCOUNT_TYPE:50002,CANNOT_EXECUTE_ON_DM:50003,EMBED_DISABLED:50004,CANNOT_EDIT_MESSAGE_BY_OTHER:50005,CANNOT_SEND_EMPTY_MESSAGE:50006,CANNOT_MESSAGE_USER:50007,CANNOT_SEND_MESSAGES_IN_VOICE_CHANNEL:50008,CHANNEL_VERIFICATION_LEVEL_TOO_HIGH:50009,OAUTH2_APPLICATION_BOT_ABSENT:50010,MAXIMUM_OAUTH2_APPLICATIONS:50011,INVALID_OAUTH_STATE:50012,MISSING_PERMISSIONS:50013,INVALID_AUTHENTICATION_TOKEN:50014,NOTE_TOO_LONG:50015,INVALID_BULK_DELETE_QUANTITY:50016,CANNOT_PIN_MESSAGE_IN_OTHER_CHANNEL:50019,INVALID_OR_TAKEN_INVITE_CODE:50020,CANNOT_EXECUTE_ON_SYSTEM_MESSAGE:50021,INVALID_OAUTH_TOKEN:50025,BULK_DELETE_MESSAGE_TOO_OLD:50034,INVALID_FORM_BODY:50035,INVITE_ACCEPTED_TO_GUILD_NOT_CONTAINING_BOT:50036,INVALID_API_VERSION:50041,REACTION_BLOCKED:90001,RESOURCE_OVERLOADED:13e4},t.DefaultMessageNotifications=["ALL","MENTIONS"],t.MembershipStates=[null,"INVITED","ACCEPTED"],t.WebhookTypes=[null,"Incoming","Channel Follower"]}).call(this,s(16))},function(e,t){e.exports=class AbstractHandler{constructor(e){this.packetManager=e}handle(e){return e}}},function(e,t,s){e.exports=s(70)},function(e,t){e.exports=class GenericAction{constructor(e){this.client=e}handle(e){return e}}},function(e,t,s){const i=s(8);class Collection extends Map{constructor(e){super(e),Object.defineProperty(this,"_array",{value:null,writable:!0,configurable:!0}),Object.defineProperty(this,"_keyArray",{value:null,writable:!0,configurable:!0})}set(e,t){return this._array=null,this._keyArray=null,super.set(e,t)}delete(e){return this._array=null,this._keyArray=null,super.delete(e)}array(){return this._array&&this._array.length===this.size||(this._array=[...this.values()]),this._array}keyArray(){return this._keyArray&&this._keyArray.length===this.size||(this._keyArray=[...this.keys()]),this._keyArray}first(e){if(void 0===e)return this.values().next().value;if("number"!=typeof e)throw new TypeError("The count must be a number.");if(!Number.isInteger(e)||e<1)throw new RangeError("The count must be an integer greater than 0.");e=Math.min(this.size,e);const t=new Array(e),s=this.values();for(let i=0;i{const i=e.get(s);return i!==t||void 0===i&&!e.has(s)}))}sort(e=((e,t)=>+(e>t)||+(e===t)-1)){return new Collection([...this.entries()].sort((t,s)=>e(t[1],s[1],t[0],s[0])))}}Collection.prototype.findAll=i.deprecate(Collection.prototype.findAll,"Collection#findAll: use Collection#filter instead"),Collection.prototype.filterArray=i.deprecate(Collection.prototype.filterArray,"Collection#filterArray: use Collection#filter instead"),Collection.prototype.exists=i.deprecate(Collection.prototype.exists,"Collection#exists: use Collection#some instead"),Collection.prototype.find=function(e,t){if("string"==typeof e){if(((e,...t)=>console.warn("Collection#find: pass a function instead",t))(0,"DeprecationWarning"),void 0===t)throw new Error("Value must be specified.");for(const s of this.values())if(s[e]===t)return s;return null}if("function"==typeof e){for(const[t,s]of this)if(e(s,t,this))return s;return null}throw new Error("First argument must be a property string or a function.")},Collection.prototype.findKey=function(e,t){if("string"==typeof e){if(((e,...t)=>console.warn("Collection#findKey: pass a function instead",t))(0,"DeprecationWarning"),void 0===t)throw new Error("Value must be specified.");for(const[s,i]of this)if(i[e]===t)return s;return null}if("function"==typeof e){for(const[t,s]of this)if(e(s,t,this))return t;return null}throw new Error("First argument must be a property string or a function.")},e.exports=Collection},function(e,t,s){(function(t){const i=s(30),n=s(0),r=n.DefaultOptions.http;e.exports=class Util{constructor(){throw new Error(`The ${this.constructor.name} class may not be instantiated.`)}static splitMessage(e,{maxLength:t=1950,char:s="\n",prepend:i="",append:n=""}={}){if(e.length<=t)return e;const r=e.split(s);if(r.some(e=>e.length>t))throw new Error("Message exceeds the max length and contains no split characters.");const o=[""];let a=0;for(let e=0;et&&(o[a]+=n,o.push(i),a++),o[a]+=(o[a].length>0&&o[a]!==i?s:"")+r[e];return o}static resolveString(e){return"string"==typeof e?e:Array.isArray(e)?e.join("\n"):String(e)}static escapeMarkdown(e,t=!1,s=!1){return t?e.replace(/```/g,"`​``"):s?e.replace(/\\(`|\\)/g,"$1").replace(/(`|\\)/g,"\\$1"):e.replace(/\\(\*|_|`|~|\\)/g,"$1").replace(/(\*|_|`|~|\\)/g,"\\$1")}static fetchRecommendedShards(e,t=1e3){return new Promise((s,o)=>{if(!e)throw new Error("A token must be provided.");i.get(`${r.host}/api/v${r.version}${n.Endpoints.gateway.bot}`).set("Authorization",`Bot ${e.replace(/^Bot\s*/i,"")}`).end((e,i)=>{e&&o(e),s(i.body.shards*(1e3/t))})})}static parseEmoji(e){if(e.includes("%")&&(e=decodeURIComponent(e)),!e.includes(":"))return{animated:!1,name:e,id:null};const t=e.match(/?/);return t?{animated:Boolean(t[1]),name:t[2],id:t[3]}:null}static arraysEqual(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;const s=new Set(e),i=new Set(t);return e.every(e=>i.has(e))&&t.every(e=>s.has(e))}static cloneObject(e){return Object.assign(Object.create(e),e)}static mergeDefault(e,t){if(!t)return e;for(const s in e)!{}.hasOwnProperty.call(t,s)?t[s]=e[s]:t[s]===Object(t[s])&&(t[s]=this.mergeDefault(e[s],t[s]));return t}static convertToBuffer(e){return"string"==typeof e&&(e=this.str2ab(e)),t.from(e)}static str2ab(e){const t=new ArrayBuffer(2*e.length),s=new Uint16Array(t);for(var i=0,n=e.length;i-1&&s{setTimeout(t,e)})}}}).call(this,s(15).Buffer)},function(e,t,s){const i=s(31),n=14200704e5;let r=0;function o(e,t,s="0"){return String(e).length>=t?String(e):(String(s).repeat(t)+e).slice(-t)}e.exports=class SnowflakeUtil{constructor(){throw new Error(`The ${this.constructor.name} class may not be instantiated.`)}static generate(e=Date.now()){if(e instanceof Date&&(e=e.getTime()),"number"!=typeof e||isNaN(e))throw new TypeError(`"timestamp" argument must be a number (received ${isNaN(e)?"NaN":typeof e})`);r>=4095&&(r=0);const t=`${o((e-n).toString(2),42)}0000100000${o((r++).toString(2),12)}`;return i.fromString(t,2).toString()}static deconstruct(e){const t=o(i.fromString(e).toString(2),64),s={timestamp:parseInt(t.substring(0,42),2)+n,workerID:parseInt(t.substring(42,47),2),processID:parseInt(t.substring(47,52),2),increment:parseInt(t.substring(52,64),2),binary:t};return Object.defineProperty(s,"date",{get:function(){return new Date(this.timestamp)},enumerable:!0}),s}}},function(e,t,s){const i=s(23),n=s(8);class Permissions extends i{constructor(e,t){super("object"!=typeof e||e instanceof Array?e:t),Object.defineProperty(this,"_member",{writable:!0,value:"object"!=typeof e||e instanceof Array?null:e})}get member(){return this._member}set member(e){this._member=e}get raw(){return this.bitfield}set raw(e){this.bitfield=e}any(e,t=!0){return t&&super.has(this.constructor.FLAGS.ADMINISTRATOR)||super.any(e)}has(e,t=!0){return t&&super.has(this.constructor.FLAGS.ADMINISTRATOR)||super.has(e)}hasPermission(e,t=!1){return this.has(e,!t)}hasPermissions(e,t=!1){return this.has(e,!t)}missingPermissions(e,t=!1){return this.missing(e,!t)}}Permissions.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,PRIORITY_SPEAKER:256,STREAM:512,VIEW_CHANNEL:1024,READ_MESSAGES:1024,SEND_MESSAGES:2048,SEND_TTS_MESSAGES:4096,MANAGE_MESSAGES:8192,EMBED_LINKS:16384,ATTACH_FILES:32768,READ_MESSAGE_HISTORY:65536,MENTION_EVERYONE:1<<17,EXTERNAL_EMOJIS:1<<18,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_ROLES_OR_PERMISSIONS:1<<28,MANAGE_WEBHOOKS:1<<29,MANAGE_EMOJIS:1<<30},Permissions.ALL=Object.keys(Permissions.FLAGS).reduce((e,t)=>e|Permissions.FLAGS[t],0),Permissions.DEFAULT=104324673,Permissions.prototype.hasPermission=n.deprecate(Permissions.prototype.hasPermission,"EvaluatedPermissions#hasPermission is deprecated, use Permissions#has instead"),Permissions.prototype.hasPermissions=n.deprecate(Permissions.prototype.hasPermissions,"EvaluatedPermissions#hasPermissions is deprecated, use Permissions#has instead"),Permissions.prototype.missingPermissions=n.deprecate(Permissions.prototype.missingPermissions,"EvaluatedPermissions#missingPermissions is deprecated, use Permissions#missing instead"),Object.defineProperty(Permissions.prototype,"raw",{get:n.deprecate(Object.getOwnPropertyDescriptor(Permissions.prototype,"raw").get,"EvaluatedPermissions#raw is deprecated use Permissions#bitfield instead"),set:n.deprecate(Object.getOwnPropertyDescriptor(Permissions.prototype,"raw").set,"EvaluatedPermissions#raw is deprecated use Permissions#bitfield instead")}),Object.defineProperty(Permissions.prototype,"member",{get:n.deprecate(Object.getOwnPropertyDescriptor(Permissions.prototype,"member").get,"EvaluatedPermissions#member is deprecated"),set:n.deprecate(Object.getOwnPropertyDescriptor(Permissions.prototype,"member").set,"EvaluatedPermissions#member is deprecated")}),e.exports=Permissions},function(e,t,s){(function(e){var i=Object.getOwnPropertyDescriptors||function(e){for(var t=Object.keys(e),s={},i=0;i=r)return e;switch(e){case"%s":return String(i[s++]);case"%d":return Number(i[s++]);case"%j":try{return JSON.stringify(i[s++])}catch(e){return"[Circular]"}default:return e}}),l=i[s];s=3&&(i.depth=arguments[2]),arguments.length>=4&&(i.colors=arguments[3]),p(s)?i.showHidden=s:s&&t._extend(i,s),_(i.showHidden)&&(i.showHidden=!1),_(i.depth)&&(i.depth=2),_(i.colors)&&(i.colors=!1),_(i.customInspect)&&(i.customInspect=!0),i.colors&&(i.stylize=l),c(i,e,i.depth)}function l(e,t){var s=a.styles[t];return s?"["+a.colors[s][0]+"m"+e+"["+a.colors[s][1]+"m":e}function h(e,t){return e}function c(e,s,i){if(e.customInspect&&s&&A(s.inspect)&&s.inspect!==t.inspect&&(!s.constructor||s.constructor.prototype!==s)){var n=s.inspect(i,e);return E(n)||(n=c(e,n,i)),n}var r=function(e,t){if(_(t))return e.stylize("undefined","undefined");if(E(t)){var s="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(s,"string")}if(f(t))return e.stylize(""+t,"number");if(p(t))return e.stylize(""+t,"boolean");if(g(t))return e.stylize("null","null")}(e,s);if(r)return r;var o=Object.keys(s),a=function(e){var t={};return e.forEach(function(e,s){t[e]=!0}),t}(o);if(e.showHidden&&(o=Object.getOwnPropertyNames(s)),w(s)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return u(s);if(0===o.length){if(A(s)){var l=s.name?": "+s.name:"";return e.stylize("[Function"+l+"]","special")}if(v(s))return e.stylize(RegExp.prototype.toString.call(s),"regexp");if(y(s))return e.stylize(Date.prototype.toString.call(s),"date");if(w(s))return u(s)}var h,b="",T=!1,R=["{","}"];(m(s)&&(T=!0,R=["[","]"]),A(s))&&(b=" [Function"+(s.name?": "+s.name:"")+"]");return v(s)&&(b=" "+RegExp.prototype.toString.call(s)),y(s)&&(b=" "+Date.prototype.toUTCString.call(s)),w(s)&&(b=" "+u(s)),0!==o.length||T&&0!=s.length?i<0?v(s)?e.stylize(RegExp.prototype.toString.call(s),"regexp"):e.stylize("[Object]","special"):(e.seen.push(s),h=T?function(e,t,s,i,n){for(var r=[],o=0,a=t.length;o=0&&0,e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0)>60)return s[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+s[1];return s[0]+t+" "+e.join(", ")+" "+s[1]}(h,b,R)):R[0]+b+R[1]}function u(e){return"["+Error.prototype.toString.call(e)+"]"}function d(e,t,s,i,n,r){var o,a,l;if((l=Object.getOwnPropertyDescriptor(t,n)||{value:t[n]}).get?a=l.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):l.set&&(a=e.stylize("[Setter]","special")),D(i,n)||(o="["+n+"]"),a||(e.seen.indexOf(l.value)<0?(a=g(s)?c(e,l.value,null):c(e,l.value,s-1)).indexOf("\n")>-1&&(a=r?a.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+a.split("\n").map(function(e){return" "+e}).join("\n")):a=e.stylize("[Circular]","special")),_(o)){if(r&&n.match(/^\d+$/))return a;(o=JSON.stringify(""+n)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(o=o.substr(1,o.length-2),o=e.stylize(o,"name")):(o=o.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),o=e.stylize(o,"string"))}return o+": "+a}function m(e){return Array.isArray(e)}function p(e){return"boolean"==typeof e}function g(e){return null===e}function f(e){return"number"==typeof e}function E(e){return"string"==typeof e}function _(e){return void 0===e}function v(e){return b(e)&&"[object RegExp]"===T(e)}function b(e){return"object"==typeof e&&null!==e}function y(e){return b(e)&&"[object Date]"===T(e)}function w(e){return b(e)&&("[object Error]"===T(e)||e instanceof Error)}function A(e){return"function"==typeof e}function T(e){return Object.prototype.toString.call(e)}function R(e){return e<10?"0"+e.toString(10):e.toString(10)}t.debuglog=function(s){if(_(r)&&(r=Object({__DISCORD_WEBPACK__:"true"}).NODE_DEBUG||""),s=s.toUpperCase(),!o[s])if(new RegExp("\\b"+s+"\\b","i").test(r)){var i=e.pid;o[s]=function(){var e=t.format.apply(t,arguments);console.error("%s %d: %s",s,i,e)}}else o[s]=function(){};return o[s]},t.inspect=a,a.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},a.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},t.isArray=m,t.isBoolean=p,t.isNull=g,t.isNullOrUndefined=function(e){return null==e},t.isNumber=f,t.isString=E,t.isSymbol=function(e){return"symbol"==typeof e},t.isUndefined=_,t.isRegExp=v,t.isObject=b,t.isDate=y,t.isError=w,t.isFunction=A,t.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},t.isBuffer=s(77);var M=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function D(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.log=function(){var e,s;console.log("%s - %s",(e=new Date,s=[R(e.getHours()),R(e.getMinutes()),R(e.getSeconds())].join(":"),[e.getDate(),M[e.getMonth()],s].join(" ")),t.format.apply(t,arguments))},t.inherits=s(78),t._extend=function(e,t){if(!t||!b(t))return e;for(var s=Object.keys(t),i=s.length;i--;)e[s[i]]=t[s[i]];return e};var S="undefined"!=typeof Symbol?Symbol("util.promisify.custom"):void 0;function I(e,t){if(!e){var s=new Error("Promise was rejected with a falsy value");s.reason=e,e=s}return t(e)}t.promisify=function(e){if("function"!=typeof e)throw new TypeError('The "original" argument must be of type Function');if(S&&e[S]){var t;if("function"!=typeof(t=e[S]))throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(t,S,{value:t,enumerable:!1,writable:!1,configurable:!0}),t}function t(){for(var t,s,i=new Promise(function(e,i){t=e,s=i}),n=[],r=0;re.roles.has(this.id))}get editable(){if(this.managed)return!1;const e=this.guild.member(this.client.user);return!!e.permissions.has(n.FLAGS.MANAGE_ROLES_OR_PERMISSIONS)&&e.highestRole.comparePositionTo(this)>0}get calculatedPosition(){const e=this.guild._sortedRoles;return e.array().indexOf(e.get(this.id))}serialize(){return new n(this.permissions).serialize()}hasPermission(e,t=!1,s){return new n(this.permissions).has(e,void 0!==s?s:!t)}hasPermissions(e,t=!1){return new n(this.permissions).has(e,!t)}comparePositionTo(e){return this.constructor.comparePositions(this,e)}edit(e,t){return this.client.rest.methods.updateGuildRole(this,e,t)}setName(e,t){return this.edit({name:e},t)}setColor(e,t){return this.edit({color:e},t)}setHoist(e,t){return this.edit({hoist:e},t)}setPosition(e,t){return this.guild.setRolePosition(this,e,t).then(()=>this)}setPermissions(e,t){return this.edit({permissions:e},t)}setMentionable(e,t){return this.edit({mentionable:e},t)}delete(e){return this.client.rest.methods.deleteGuildRole(this,e)}equals(e){return e&&this.id===e.id&&this.name===e.name&&this.color===e.color&&this.hoist===e.hoist&&this.position===e.position&&this.permissions===e.permissions&&this.managed===e.managed}toString(){return this.id===this.guild.id?"@everyone":`<@&${this.id}>`}static comparePositions(e,t){return e.position===t.position?t.id-e.id:e.position-t.position}}Role.prototype.hasPermissions=r.deprecate(Role.prototype.hasPermissions,"Role#hasPermissions is deprecated - use Role#hasPermission instead, it now takes an array"),e.exports=Role},function(e,t,s){const i=s(19),n=s(0),r=s(11).Presence,o=s(6),a=s(8);class User{constructor(e,t){Object.defineProperty(this,"client",{value:e}),t&&this.setup(t)}setup(e){this.id=e.id,this.username=e.username,this.discriminator=e.discriminator,this.avatar=e.avatar,this.bot=Boolean(e.bot),void 0!==e.system&&(this.system=Boolean(e.system)),this.lastMessageID=null,this.lastMessage=null}patch(e){for(const t of["id","username","discriminator","avatar","bot"])void 0!==e[t]&&(this[t]=e[t]);e.token&&(this.client.token=e.token)}get createdTimestamp(){return o.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 e of this.client.guilds.values())if(e.presences.has(this.id))return e.presences.get(this.id);return new r(void 0,this.client)}get avatarURL(){return this.avatar?n.Endpoints.User(this).Avatar(this.client.options.http.cdn,this.avatar):null}get defaultAvatarURL(){const e=Object.keys(n.DefaultAvatars),t=e[this.discriminator%e.length];return n.Endpoints.CDN(this.client.options.http.host).Asset(`${n.DefaultAvatars[t]}.png`)}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(e){return(e=this.client.resolver.resolveChannel(e))._typing.has(this.id)}typingSinceIn(e){return(e=this.client.resolver.resolveChannel(e))._typing.has(this.id)?new Date(e._typing.get(this.id).since):null}typingDurationIn(e){return(e=this.client.resolver.resolveChannel(e))._typing.has(this.id)?e._typing.get(this.id).elapsedTime:-1}get dmChannel(){return this.client.channels.find(e=>"dm"===e.type&&e.recipient.id===this.id)}createDM(){return this.client.rest.methods.createDM(this)}deleteDM(){return this.client.rest.methods.deleteChannel(this)}addFriend(){return this.client.rest.methods.addFriend(this)}removeFriend(){return this.client.rest.methods.removeFriend(this)}block(){return this.client.rest.methods.blockUser(this)}unblock(){return this.client.rest.methods.unblockUser(this)}fetchProfile(){return this.client.rest.methods.fetchUserProfile(this)}setNote(e){return this.client.rest.methods.setNote(this,e)}equals(e){return e&&this.id===e.id&&this.username===e.username&&this.discriminator===e.discriminator&&this.avatar===e.avatar&&this.bot===Boolean(e.bot)}toString(){return`<@${this.id}>`}send(){}sendMessage(){}sendEmbed(){}sendFile(){}sendCode(){}}i.applyToClass(User),User.prototype.block=a.deprecate(User.prototype.block,"User#block: userbot methods will be removed"),User.prototype.unblock=a.deprecate(User.prototype.unblock,"User#unblock: userbot methods will be removed"),User.prototype.addFriend=a.deprecate(User.prototype.addFriend,"User#addFriend: userbot methods will be removed"),User.prototype.removeFriend=a.deprecate(User.prototype.removeFriend,"User#removeFriend: userbot methods will be removed"),User.prototype.setNote=a.deprecate(User.prototype.setNote,"User#setNote, userbot methods will be removed"),User.prototype.fetchProfile=a.deprecate(User.prototype.fetchProfile,"User#fetchProfile: userbot methods will be removed"),e.exports=User},function(e,t,s){const{ActivityFlags:i,Endpoints:n}=s(0),r=s(26);class Game{constructor(e,t){Object.defineProperty(this,"presence",{value:t}),this.name=e.name,this.type=e.type,this.url=e.url||null,this.details=e.details||null,this.state=e.state||null,this.applicationID=e.application_id||null,this.timestamps=e.timestamps?{start:e.timestamps.start?new Date(Number(e.timestamps.start)):null,end:e.timestamps.end?new Date(Number(e.timestamps.end)):null}:null,this.party=e.party||null,this.assets=e.assets?new RichPresenceAssets(this,e.assets):null,e.emoji?(this.emoji=new r({message:{client:this.presence.client}},e.emoji),this.emoji.reaction=null):this.emoji=null,this.createdTimestamp=new Date(e.created_at).getTime(),this.syncID=e.sync_id,this._flags=e.flags}get createdAt(){return new Date(this.createdTimestamp)}get flags(){const e=[];for(const[t,s]of Object.entries(i))(this._flags&s)===s&&e.push(t);return e}get streaming(){return 1===this.type}toString(){return this.name}equals(e){return this===e||e&&this.name===e.name&&this.type===e.type&&this.url===e.url}}class RichPresenceAssets{constructor(e,t){Object.defineProperty(this,"game",{value:e}),this.largeText=t.large_text||null,this.smallText=t.small_text||null,this.largeImage=t.large_image||null,this.smallImage=t.small_image||null}get smallImageURL(){return this.smallImage?n.CDN(this.game.presence.client.options.http.cdn).AppAsset(this.game.applicationID,this.smallImage):null}get largeImageURL(){return this.largeImage?/^spotify:/.test(this.largeImage)?`https://i.scdn.co/image/${this.largeImage.slice(8)}`:/^twitch:/.test(this.largeImage)?`https://static-cdn.jtvnw.net/previews-ttv/live_user_${this.largeImage.slice(7)}.png`:n.CDN(this.game.presence.client.options.http.cdn).AppAsset(this.game.applicationID,this.largeImage):null}}t.Presence=class Presence{constructor(e={},t){Object.defineProperty(this,"client",{value:t}),this.update(e)}update(e){this.status=e.status||this.status||"offline",this.game=e.game?new Game(e.game,this):null,e.activities?this.activities=e.activities.map(e=>new Game(e,this)):e.activity||e.game?this.activities=[new Game(e.activity||e.game,this)]:this.activities=[],this.clientStatus=e.client_status||null}equals(e){return this===e||e&&this.status===e.status&&this.activities.length===e.activities.length&&this.activities.every((t,s)=>t.equals(e.activities[s]))&&this.clientStatus.web===e.clientStatus.web&&this.clientStatus.mobile===e.clientStatus.mobile&&this.clientStatus.desktop===e.clientStatus.desktop}},t.Game=Game,t.RichPresenceAssets=RichPresenceAssets},function(e,t,s){const i=s(6);e.exports=class Channel{constructor(e,t){Object.defineProperty(this,"client",{value:e}),this.type=null,this.deleted=!1,t&&this.setup(t)}setup(e){this.id=e.id}get createdTimestamp(){return i.deconstruct(this.id).timestamp}get createdAt(){return new Date(this.createdTimestamp)}delete(){return this.client.rest.methods.deleteChannel(this)}}},function(e,t,s){const i=s(55),n=s(56),r=s(0);e.exports=class Invite{constructor(e,t){Object.defineProperty(this,"client",{value:e}),this.setup(t)}setup(e){this.guild=this.client.guilds.get(e.guild.id)||new i(this.client,e.guild),this.code=e.code,this.presenceCount=e.approximate_presence_count,this.memberCount=e.approximate_member_count,this.textChannelCount=e.guild.text_channel_count,this.voiceChannelCount=e.guild.voice_channel_count,this.temporary=e.temporary,this.maxAge=e.max_age,this.uses=e.uses,this.maxUses=e.max_uses,e.inviter&&(this.inviter=this.client.dataManager.newUser(e.inviter)),this.channel=this.client.channels.get(e.channel.id)||new n(this.client,e.channel),this.createdTimestamp=new Date(e.created_at).getTime()}get createdAt(){return new Date(this.createdTimestamp)}get expiresTimestamp(){return this.createdTimestamp+1e3*this.maxAge}get expiresAt(){return new Date(this.expiresTimestamp)}get url(){return r.Endpoints.inviteLink(this.code)}delete(e){return this.client.rest.methods.deleteInvite(this,e)}toString(){return this.url}}},function(e,t,s){const i=s(12),n=s(9),r=s(59),o=s(7),a=s(4),l=s(0),h=s(13),c=s(5);e.exports=class GuildChannel extends i{constructor(e,t){super(e.client,t),this.guild=e}setup(e){if(super.setup(e),this.name=e.name,this.position=e.position,this.parentID=e.parent_id,this.permissionOverwrites=new a,e.permission_overwrites)for(const t of e.permission_overwrites)this.permissionOverwrites.set(t.id,new r(this,t))}get calculatedPosition(){const e=this.guild._sortedChannels(this.type);return e.array().indexOf(e.get(this.id))}get parent(){return this.guild.channels.get(this.parentID)||null}get permissionsLocked(){return this.parent?this.permissionOverwrites.size===this.parent.permissionOverwrites.size&&this.permissionOverwrites.every((e,t)=>{const s=this.parent.permissionOverwrites.get(t);return void 0!==s&&s.deny===e.deny&&s.allow===e.allow}):null}memberPermissions(e){if(!(e=this.client.resolver.resolveGuildMember(this.guild,e)))return null;if(e.id===this.guild.ownerID)return new o(e,o.ALL);const t=e.roles,s=new o(t.map(e=>e.permissions));if(s.has(o.FLAGS.ADMINISTRATOR))return new o(o.ALL).freeze();const i=this.overwritesFor(e,!0,t);return s.remove(i.everyone?i.everyone.deny:0).add(i.everyone?i.everyone.allow:0).remove(i.roles.length>0?i.roles.map(e=>e.deny):0).add(i.roles.length>0?i.roles.map(e=>e.allow):0).remove(i.member?i.member.deny:0).add(i.member?i.member.allow:0).freeze()}rolePermissions(e){if(e.permissions&o.FLAGS.ADMINISTRATOR)return new o(o.ALL).freeze();const t=this.permissionOverwrites.get(this.guild.id),s=this.permissionOverwrites.get(e.id);return new o(e.permissions).remove(t?t.deny:0).add(t?t.allow:0).remove(s?s.deny:0).add(s?s.allow:0).freeze()}permissionsFor(e){const t=this.guild.member(e);if(t)return this.memberPermissions(t);const s=this.client.resolver.resolveRole(this.guild,e);return s?this.rolePermissions(s):null}overwritesFor(e,t=!1,s=null){if(t||(e=this.client.resolver.resolveGuildMember(this.guild,e)),!e)return[];s=s||e.roles;const i=[];let n,r;for(const t of this.permissionOverwrites.values())t.id===this.guild.id?r=t:s.has(t.id)?i.push(t):t.id===e.id&&(n=t);return{everyone:r,roles:i,member:n}}replacePermissionOverwrites({overwrites:e,reason:t}={}){return this.edit({permissionOverwrites:e,reason:t}).then(()=>this)}overwritePermissions(e,t,s){const i={allow:0,deny:0};if(e instanceof n)i.type="role";else if(this.guild.roles.has(e))e=this.guild.roles.get(e),i.type="role";else if(e=this.client.resolver.resolveUser(e),i.type="member",!e)return Promise.reject(new TypeError("Supplied parameter was neither a User nor a Role."));i.id=e.id;const r=this.permissionOverwrites.get(e.id);r&&(i.allow=r.allow,i.deny=r.deny);for(const e of Object.keys(t))!0===t[e]?(i.allow|=o.FLAGS[e]||0,i.deny&=~(o.FLAGS[e]||0)):!1===t[e]?(i.allow&=~(o.FLAGS[e]||0),i.deny|=o.FLAGS[e]||0):null===t[e]&&(i.allow&=~(o.FLAGS[e]||0),i.deny&=~(o.FLAGS[e]||0));return this.client.rest.methods.setChannelOverwrite(this,i,s).then(()=>this)}lockPermissions(){if(!this.parent)return Promise.reject(new TypeError("Could not find a parent to this guild channel."));const e=this.parent.permissionOverwrites.map(e=>({deny:e.deny,allow:e.allow,id:e.id,type:e.type}));return this.edit({permissionOverwrites:e})}edit(e,t){return this.client.rest.methods.updateChannel(this,e,t).then(()=>this)}setName(e,t){return this.edit({name:e},t)}setPosition(e,t){return this.guild.setChannelPosition(this,e,t).then(()=>this)}setParent(e,t){return e=this.client.resolver.resolveChannelID(e),this.edit({parent:e},t)}setTopic(e,t){return this.edit({topic:e},t)}createInvite(e={},t){return this.client.rest.methods.createChannelInvite(this,e,t)}clone(e={},t=!0,s=!0,i){return(arguments.length>1||"string"==typeof e)&&(((e,...t)=>console.warn("GuildChannel#clone: Clone channels using an options object instead of separate parameters.",t))(0,"Deprecation Warning"),e={name:e,permissionOverwrites:t?this.permissionOverwrites:null,topic:s?this.topic:null,reason:i||null}),c.mergeDefault({name:this.name,permissionOverwrites:this.permissionOverwrites,topic:this.topic,type:this.type,nsfw:this.nsfw,parent:this.parent,bitrate:this.bitrate,userLimit:this.userLimit,rateLimitPerUser:this.rateLimitPerUser,reason:null},e),this.guild.createChannel(e.name,e)}fetchInvites(){return this.client.rest.makeRequest("get",l.Endpoints.Channel(this.id).invites,!0).then(e=>{const t=new a;for(let s of e)s=new h(this.client,s),t.set(s.code,s);return t})}delete(e){return this.client.rest.methods.deleteChannel(this,e)}equals(e){let t=e&&this.id===e.id&&this.type===e.type&&this.topic===e.topic&&this.position===e.position&&this.name===e.name;return t&&(t=this.permissionOverwrites&&e.permissionOverwrites?this.permissionOverwrites.equals(e.permissionOverwrites):!this.permissionOverwrites&&!e.permissionOverwrites),t}get deletable(){return this.id!==this.guild.id&&this.permissionsFor(this.client.user).has(o.FLAGS.MANAGE_CHANNELS)}get manageable(){if(this.client.user.id===this.guild.ownerID)return!0;const e=this.permissionsFor(this.client.user);return!!e&&e.has([o.FLAGS.MANAGE_CHANNELS,o.FLAGS.VIEW_CHANNEL])}get muted(){if(this.client.user.bot)return null;try{return this.client.user.guildSettings.get(this.guild.id).channelOverrides.get(this.id).muted}catch(e){return!1}}get messageNotifications(){if(this.client.user.bot)return null;try{return this.client.user.guildSettings.get(this.guild.id).channelOverrides.get(this.id).messageNotifications}catch(e){return l.MessageNotificationTypes[3]}}toString(){return`<#${this.id}>`}}},function(e,t,s){"use strict";(function(e){var i=s(67),n=s(68),r=s(69);function o(){return l.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(e,t){if(o()=o())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o().toString(16)+" bytes");return 0|e}function p(e,t){if(l.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var s=e.length;if(0===s)return 0;for(var i=!1;;)switch(t){case"ascii":case"latin1":case"binary":return s;case"utf8":case"utf-8":case void 0:return B(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*s;case"hex":return s>>>1;case"base64":return $(e).length;default:if(i)return B(e).length;t=(""+t).toLowerCase(),i=!0}}function g(e,t,s){var i=e[t];e[t]=e[s],e[s]=i}function f(e,t,s,i,n){if(0===e.length)return-1;if("string"==typeof s?(i=s,s=0):s>2147483647?s=2147483647:s<-2147483648&&(s=-2147483648),s=+s,isNaN(s)&&(s=n?0:e.length-1),s<0&&(s=e.length+s),s>=e.length){if(n)return-1;s=e.length-1}else if(s<0){if(!n)return-1;s=0}if("string"==typeof t&&(t=l.from(t,i)),l.isBuffer(t))return 0===t.length?-1:E(e,t,s,i,n);if("number"==typeof t)return t&=255,l.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?n?Uint8Array.prototype.indexOf.call(e,t,s):Uint8Array.prototype.lastIndexOf.call(e,t,s):E(e,[t],s,i,n);throw new TypeError("val must be string, number or Buffer")}function E(e,t,s,i,n){var r,o=1,a=e.length,l=t.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(e.length<2||t.length<2)return-1;o=2,a/=2,l/=2,s/=2}function h(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(n){var c=-1;for(r=s;ra&&(s=a-l),r=s;r>=0;r--){for(var u=!0,d=0;dn&&(i=n):i=n;var r=t.length;if(r%2!=0)throw new TypeError("Invalid hex string");i>r/2&&(i=r/2);for(var o=0;o>8,n=s%256,r.push(n),r.push(i);return r}(t,e.length-s),e,s,i)}function T(e,t,s){return 0===t&&s===e.length?i.fromByteArray(e):i.fromByteArray(e.slice(t,s))}function R(e,t,s){s=Math.min(e.length,s);for(var i=[],n=t;n239?4:h>223?3:h>191?2:1;if(n+u<=s)switch(u){case 1:h<128&&(c=h);break;case 2:128==(192&(r=e[n+1]))&&(l=(31&h)<<6|63&r)>127&&(c=l);break;case 3:r=e[n+1],o=e[n+2],128==(192&r)&&128==(192&o)&&(l=(15&h)<<12|(63&r)<<6|63&o)>2047&&(l<55296||l>57343)&&(c=l);break;case 4:r=e[n+1],o=e[n+2],a=e[n+3],128==(192&r)&&128==(192&o)&&128==(192&a)&&(l=(15&h)<<18|(63&r)<<12|(63&o)<<6|63&a)>65535&&l<1114112&&(c=l)}null===c?(c=65533,u=1):c>65535&&(c-=65536,i.push(c>>>10&1023|55296),c=56320|1023&c),i.push(c),n+=u}return function(e){var t=e.length;if(t<=M)return String.fromCharCode.apply(String,e);var s="",i=0;for(;ithis.length)return"";if((void 0===s||s>this.length)&&(s=this.length),s<=0)return"";if((s>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return I(this,t,s);case"utf8":case"utf-8":return R(this,t,s);case"ascii":return D(this,t,s);case"latin1":case"binary":return S(this,t,s);case"base64":return T(this,t,s);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,t,s);default:if(i)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),i=!0}}.apply(this,arguments)},l.prototype.equals=function(e){if(!l.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===l.compare(this,e)},l.prototype.inspect=function(){var e="",s=t.INSPECT_MAX_BYTES;return this.length>0&&(e=this.toString("hex",0,s).match(/.{2}/g).join(" "),this.length>s&&(e+=" ... ")),""},l.prototype.compare=function(e,t,s,i,n){if(!l.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===s&&(s=e?e.length:0),void 0===i&&(i=0),void 0===n&&(n=this.length),t<0||s>e.length||i<0||n>this.length)throw new RangeError("out of range index");if(i>=n&&t>=s)return 0;if(i>=n)return-1;if(t>=s)return 1;if(t>>>=0,s>>>=0,i>>>=0,n>>>=0,this===e)return 0;for(var r=n-i,o=s-t,a=Math.min(r,o),h=this.slice(i,n),c=e.slice(t,s),u=0;un)&&(s=n),e.length>0&&(s<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var r=!1;;)switch(i){case"hex":return _(this,e,t,s);case"utf8":case"utf-8":return v(this,e,t,s);case"ascii":return b(this,e,t,s);case"latin1":case"binary":return y(this,e,t,s);case"base64":return w(this,e,t,s);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,e,t,s);default:if(r)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),r=!0}},l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var M=4096;function D(e,t,s){var i="";s=Math.min(e.length,s);for(var n=t;ni)&&(s=i);for(var n="",r=t;rs)throw new RangeError("Trying to access beyond buffer length")}function N(e,t,s,i,n,r){if(!l.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>n||te.length)throw new RangeError("Index out of range")}function O(e,t,s,i){t<0&&(t=65535+t+1);for(var n=0,r=Math.min(e.length-s,2);n>>8*(i?n:1-n)}function L(e,t,s,i){t<0&&(t=4294967295+t+1);for(var n=0,r=Math.min(e.length-s,4);n>>8*(i?n:3-n)&255}function P(e,t,s,i,n,r){if(s+i>e.length)throw new RangeError("Index out of range");if(s<0)throw new RangeError("Index out of range")}function k(e,t,s,i,r){return r||P(e,0,s,4),n.write(e,t,s,i,23,4),s+4}function G(e,t,s,i,r){return r||P(e,0,s,8),n.write(e,t,s,i,52,8),s+8}l.prototype.slice=function(e,t){var s,i=this.length;if(e=~~e,t=void 0===t?i:~~t,e<0?(e+=i)<0&&(e=0):e>i&&(e=i),t<0?(t+=i)<0&&(t=0):t>i&&(t=i),t0&&(n*=256);)i+=this[e+--t]*n;return i},l.prototype.readUInt8=function(e,t){return t||U(e,1,this.length),this[e]},l.prototype.readUInt16LE=function(e,t){return t||U(e,2,this.length),this[e]|this[e+1]<<8},l.prototype.readUInt16BE=function(e,t){return t||U(e,2,this.length),this[e]<<8|this[e+1]},l.prototype.readUInt32LE=function(e,t){return t||U(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},l.prototype.readUInt32BE=function(e,t){return t||U(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},l.prototype.readIntLE=function(e,t,s){e|=0,t|=0,s||U(e,t,this.length);for(var i=this[e],n=1,r=0;++r=(n*=128)&&(i-=Math.pow(2,8*t)),i},l.prototype.readIntBE=function(e,t,s){e|=0,t|=0,s||U(e,t,this.length);for(var i=t,n=1,r=this[e+--i];i>0&&(n*=256);)r+=this[e+--i]*n;return r>=(n*=128)&&(r-=Math.pow(2,8*t)),r},l.prototype.readInt8=function(e,t){return t||U(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},l.prototype.readInt16LE=function(e,t){t||U(e,2,this.length);var s=this[e]|this[e+1]<<8;return 32768&s?4294901760|s:s},l.prototype.readInt16BE=function(e,t){t||U(e,2,this.length);var s=this[e+1]|this[e]<<8;return 32768&s?4294901760|s:s},l.prototype.readInt32LE=function(e,t){return t||U(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},l.prototype.readInt32BE=function(e,t){return t||U(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},l.prototype.readFloatLE=function(e,t){return t||U(e,4,this.length),n.read(this,e,!0,23,4)},l.prototype.readFloatBE=function(e,t){return t||U(e,4,this.length),n.read(this,e,!1,23,4)},l.prototype.readDoubleLE=function(e,t){return t||U(e,8,this.length),n.read(this,e,!0,52,8)},l.prototype.readDoubleBE=function(e,t){return t||U(e,8,this.length),n.read(this,e,!1,52,8)},l.prototype.writeUIntLE=function(e,t,s,i){(e=+e,t|=0,s|=0,i)||N(this,e,t,s,Math.pow(2,8*s)-1,0);var n=1,r=0;for(this[t]=255&e;++r=0&&(r*=256);)this[t+n]=e/r&255;return t+s},l.prototype.writeUInt8=function(e,t,s){return e=+e,t|=0,s||N(this,e,t,1,255,0),l.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},l.prototype.writeUInt16LE=function(e,t,s){return e=+e,t|=0,s||N(this,e,t,2,65535,0),l.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):O(this,e,t,!0),t+2},l.prototype.writeUInt16BE=function(e,t,s){return e=+e,t|=0,s||N(this,e,t,2,65535,0),l.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):O(this,e,t,!1),t+2},l.prototype.writeUInt32LE=function(e,t,s){return e=+e,t|=0,s||N(this,e,t,4,4294967295,0),l.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):L(this,e,t,!0),t+4},l.prototype.writeUInt32BE=function(e,t,s){return e=+e,t|=0,s||N(this,e,t,4,4294967295,0),l.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):L(this,e,t,!1),t+4},l.prototype.writeIntLE=function(e,t,s,i){if(e=+e,t|=0,!i){var n=Math.pow(2,8*s-1);N(this,e,t,s,n-1,-n)}var r=0,o=1,a=0;for(this[t]=255&e;++r>0)-a&255;return t+s},l.prototype.writeIntBE=function(e,t,s,i){if(e=+e,t|=0,!i){var n=Math.pow(2,8*s-1);N(this,e,t,s,n-1,-n)}var r=s-1,o=1,a=0;for(this[t+r]=255&e;--r>=0&&(o*=256);)e<0&&0===a&&0!==this[t+r+1]&&(a=1),this[t+r]=(e/o>>0)-a&255;return t+s},l.prototype.writeInt8=function(e,t,s){return e=+e,t|=0,s||N(this,e,t,1,127,-128),l.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},l.prototype.writeInt16LE=function(e,t,s){return e=+e,t|=0,s||N(this,e,t,2,32767,-32768),l.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):O(this,e,t,!0),t+2},l.prototype.writeInt16BE=function(e,t,s){return e=+e,t|=0,s||N(this,e,t,2,32767,-32768),l.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):O(this,e,t,!1),t+2},l.prototype.writeInt32LE=function(e,t,s){return e=+e,t|=0,s||N(this,e,t,4,2147483647,-2147483648),l.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):L(this,e,t,!0),t+4},l.prototype.writeInt32BE=function(e,t,s){return e=+e,t|=0,s||N(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),l.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):L(this,e,t,!1),t+4},l.prototype.writeFloatLE=function(e,t,s){return k(this,e,t,!0,s)},l.prototype.writeFloatBE=function(e,t,s){return k(this,e,t,!1,s)},l.prototype.writeDoubleLE=function(e,t,s){return G(this,e,t,!0,s)},l.prototype.writeDoubleBE=function(e,t,s){return G(this,e,t,!1,s)},l.prototype.copy=function(e,t,s,i){if(s||(s=0),i||0===i||(i=this.length),t>=e.length&&(t=e.length),t||(t=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),e.length-t=0;--n)e[n+t]=this[n+s];else if(r<1e3||!l.TYPED_ARRAY_SUPPORT)for(n=0;n>>=0,s=void 0===s?this.length:s>>>0,e||(e=0),"number"==typeof e)for(r=t;r55295&&s<57344){if(!n){if(s>56319){(t-=3)>-1&&r.push(239,191,189);continue}if(o+1===i){(t-=3)>-1&&r.push(239,191,189);continue}n=s;continue}if(s<56320){(t-=3)>-1&&r.push(239,191,189),n=s;continue}s=65536+(n-55296<<10|s-56320)}else n&&(t-=3)>-1&&r.push(239,191,189);if(n=null,s<128){if((t-=1)<0)break;r.push(s)}else if(s<2048){if((t-=2)<0)break;r.push(s>>6|192,63&s|128)}else if(s<65536){if((t-=3)<0)break;r.push(s>>12|224,s>>6&63|128,63&s|128)}else{if(!(s<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;r.push(s>>18|240,s>>12&63|128,s>>6&63|128,63&s|128)}}return r}function $(e){return i.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(x,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function q(e,t,s,i){for(var n=0;n=t.length||n>=e.length);++n)t[n+s]=e[n];return n}}).call(this,s(66))},function(e,t){var s,i,n=e.exports={};function r(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function a(e){if(s===setTimeout)return setTimeout(e,0);if((s===r||!s)&&setTimeout)return s=setTimeout,setTimeout(e,0);try{return s(e,0)}catch(t){try{return s.call(null,e,0)}catch(t){return s.call(this,e,0)}}}!function(){try{s="function"==typeof setTimeout?setTimeout:r}catch(e){s=r}try{i="function"==typeof clearTimeout?clearTimeout:o}catch(e){i=o}}();var l,h=[],c=!1,u=-1;function d(){c&&l&&(c=!1,l.length?h=l.concat(h):u=-1,h.length&&m())}function m(){if(!c){var e=a(d);c=!0;for(var t=h.length;t;){for(l=h,h=[];++u1)for(var s=1;s0&&o.length>n&&!o.warned){o.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=o.length,a=l,console&&console.warn&&console.warn(a)}return e}function d(e,t,s){var i={fired:!1,wrapFn:void 0,target:e,type:t,listener:s},n=function(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}.bind(i);return n.listener=s,i.wrapFn=n,n}function m(e,t,s){var i=e._events;if(void 0===i)return[];var n=i[t];return void 0===n?[]:"function"==typeof n?s?[n.listener||n]:[n]:s?function(e){for(var t=new Array(e.length),s=0;s0&&(o=t[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var l=n[e];if(void 0===l)return!1;if("function"==typeof l)r(l,this,t);else{var h=l.length,c=g(l,h);for(s=0;s=0;r--)if(s[r]===t||s[r].listener===t){o=s[r].listener,n=r;break}if(n<0)return this;0===n?s.shift():function(e,t){for(;t+1=0;i--)this.removeListener(e,t[i]);return this},a.prototype.listeners=function(e){return m(this,e,!0)},a.prototype.rawListeners=function(e){return m(this,e,!1)},a.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):p.call(e,t)},a.prototype.listenerCount=p,a.prototype.eventNames=function(){return this._eventsCount>0?i(this._events):[]}},function(e,t,s){const i=s(24),n=s(32),r=s(5);let o;e.exports=class RichEmbed{constructor(e={}){this.title=e.title,this.description=e.description,this.url=e.url,this.color=e.color,this.author=e.author,this.timestamp=e.timestamp,this.fields=e.fields||[],this.thumbnail=e.thumbnail,this.image=e.image,this.footer=e.footer,this.file=e.file,this.files=[]}setTitle(e){if((e=r.resolveString(e)).length>256)throw new RangeError("RichEmbed titles may not exceed 256 characters.");return this.title=e,this}setDescription(e){if((e=r.resolveString(e)).length>2048)throw new RangeError("RichEmbed descriptions may not exceed 2048 characters.");return this.description=e,this}setURL(e){return this.url=e,this}setColor(e){return o||(o=s(33)),this.color=o.resolveColor(e),this}setAuthor(e,t,s){return this.author={name:r.resolveString(e),icon_url:t,url:s},this}setTimestamp(e=Date.now()){return e instanceof Date&&(e=e.getTime()),this.timestamp=e,this}addField(e,t,s=!1){if(this.fields.length>=25)throw new RangeError("RichEmbeds may not exceed 25 fields.");return this.fields.push(this.constructor.normalizeField(e,t,s)),this}addBlankField(e=!1){return this.addField("​","​",e)}spliceFields(e,t,...s){if(s){const i=({name:e,value:t,inline:s})=>this.constructor.normalizeField(e,t,s);this.fields.splice(e,t,...s.map(i))}else this.fields.splice(e,t);return this}setThumbnail(e){return this.thumbnail={url:e},this}setImage(e){return this.image={url:e},this}setFooter(e,t){if((e=r.resolveString(e)).length>2048)throw new RangeError("RichEmbed footer text may not exceed 2048 characters.");return this.footer={text:e,icon_url:t},this}attachFile(e){if(this.file)throw new RangeError("You may not upload more than one file at once.");return e instanceof i&&(e=e.file),this.file=e,this}attachFiles(e){return e=e.map(e=>e instanceof i?e.file:e),this.files=this.files.concat(e),this}get length(){return(this.title?this.title.length:0)+(this.description?this.description.length:0)+(this.fields.length>=1?this.fields.reduce((e,t)=>e+t.name.length+t.value.length,0):0)+(this.footer?this.footer.text.length:0)+(this.author?this.author.name.length:0)}toJSON(){return{title:this.title,type:"rich",description:this.description,url:this.url,timestamp:this.timestamp?new Date(this.timestamp):null,color:this.color,fields:this.fields?this.fields.map(e=>({name:e.name,value:e.value,inline:e.inline})):null,thumbnail:this.thumbnail?{url:this.thumbnail.url}:null,image:this.image?{url:this.image.url}:null,author:this.author?{name:this.author.name,url:this.author.url,icon_url:this.author instanceof n.Author?this.author.iconURL:this.author.icon_url}:null,footer:this.footer?{text:this.footer.text,icon_url:this.footer instanceof n.Footer?this.footer.iconURL:this.footer.icon_url}:null}}static normalizeField(e,t,s=!1){if((e=r.resolveString(e)).length>256)throw new RangeError("RichEmbed field names may not exceed 256 characters.");if(!/\S/.test(e))throw new RangeError("RichEmbed field names may not be empty.");if((t=r.resolveString(t)).length>1024)throw new RangeError("RichEmbed field values may not exceed 1024 characters.");if(!/\S/.test(t))throw new RangeError("RichEmbed field values may not be empty.");return{name:e,value:t,inline:s}}}},function(e,t,s){(function(e){const i=s(25),n=s(20),r=s(53),o=s(4),a=s(24),l=s(18),h=s(6),c=s(8);class TextBasedChannel{constructor(){this.messages=new o,this.lastMessageID=null,this.lastMessage=null,this.lastPinTimestamp=null}send(t,s){s||"object"!=typeof t||t instanceof Array?s||(s={}):(s=t,t="");const{reply:n}=s;if(s instanceof a&&(s={files:[s.file]}),s instanceof l&&(s.reply&&(s.reply=void 0),s={embed:s}),s.reply=n,s.embed&&(s.embed.file&&(s.files?s.files.push(s.embed.file):s.files=[s.embed.file]),s.embed.files&&(s.files?s.files=s.files.concat(s.embed.files):s.files=s.embed.files)),s.file&&(s.files?s.files.push(s.file):s.files=[s.file]),s.embed&&(s.embed=new l(s.embed).toJSON()),s.files){for(let t=0;tthis.client.resolver.resolveFile(e.attachment).then(t=>(e.file=t,e)))).then(e=>this.client.rest.methods.sendMessage(this,t,s,e))}return this.client.rest.methods.sendMessage(this,t,s)}fetchMessage(e){return this.client.user.bot?this.client.rest.methods.getChannelMessage(this,e).then(e=>{const t=e instanceof n?e:new n(this,e,this.client);return this._cacheMessage(t),t}):this.fetchMessages({limit:1,around:e}).then(t=>{const s=t.get(e);if(!s)throw new Error("Message not found.");return s})}fetchMessages(e={}){return this.client.rest.methods.getChannelMessages(this,e).then(e=>{const t=new o;for(const s of e){const e=new n(this,s,this.client);t.set(s.id,e),this._cacheMessage(e)}return t})}fetchPinnedMessages(){return this.client.rest.methods.getChannelPinnedMessages(this).then(e=>{const t=new o;for(const s of e){const e=new n(this,s,this.client);t.set(s.id,e),this._cacheMessage(e)}return t})}search(e={}){return this.client.rest.methods.search(this,e)}startTyping(e){if(void 0!==e&&e<1)throw new RangeError("Count must be at least 1.");if(this.client.user._typing.has(this.id)){const t=this.client.user._typing.get(this.id);return void(t.count=e||t.count+1)}const t={count:e||1,interval:this.client.setInterval(()=>{this.client.rest.methods.sendTyping(this.id).catch(()=>{this.client.clearInterval(t.interval),this.client.user._typing.delete(this.id)})},9e3)};this.client.rest.methods.sendTyping(this.id).catch(()=>{this.client.clearInterval(t.interval),this.client.user._typing.delete(this.id)}),this.client.user._typing.set(this.id,t)}stopTyping(e=!1){if(this.client.user._typing.has(this.id)){const t=this.client.user._typing.get(this.id);t.count--,(t.count<=0||e)&&(this.client.clearInterval(t.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}get lastMessage(){return this.messages.get(this.lastMessageID)||null}get lastPinAt(){return this.lastPinTimestamp?new Date(this.lastPinTimestamp):null}createCollector(e,t){return this.createMessageCollector(e,t)}createMessageCollector(e,t={}){return new r(this,e,t)}awaitMessages(e,t={}){return new Promise((s,i)=>{this.createCollector(e,t).once("end",(e,n)=>{t.errors&&t.errors.includes(n)?i(e):s(e)})})}bulkDelete(e,t=!1){if(e instanceof Array||e instanceof o){let s=e instanceof o?e.keyArray():e.map(e=>e.id||e);return t&&(s=s.filter(e=>Date.now()-h.deconstruct(e).date.getTime()<12096e5)),0===s.length?Promise.resolve(new o):1===s.length?this.fetchMessage(s[0]).then(e=>e.delete()).then(e=>new o([[e.id,e]])):this.client.rest.methods.bulkDeleteMessages(this,s)}if(!isNaN(e))return this.fetchMessages({limit:e}).then(e=>this.bulkDelete(e,t));throw new TypeError("The messages must be an Array, Collection, or number.")}acknowledge(){return this.lastMessageID?this.client.rest.methods.ackTextChannel(this):Promise.resolve(this)}_cacheMessage(e){const t=this.client.options.messageCacheMaxSize;return 0===t?null:(this.messages.size>=t&&t>0&&this.messages.delete(this.messages.firstKey()),this.messages.set(e.id,e),e)}}const u={sendMessage(e,t){return this.send(e,t)},sendEmbed(e,t,s){return s||"object"!=typeof t||t instanceof Array?s||(s={}):(s=t,t=""),this.send(t,Object.assign(s,{embed:e}))},sendFiles(e,t,s={}){return this.send(t,Object.assign(s,{files:e}))},sendFile(e,t,s,i={}){return this.send({files:[{attachment:e,name:t}],content:s,options:i})},sendCode(e,t,s={}){return this.send(t,Object.assign(s,{code:e}))}};for(const e of Object.keys(u))TextBasedChannel.prototype[e]=c.deprecate(u[e],`TextChannel#${e}: use TextChannel#send instead`);t.applyToClass=((e,t=!1,s=[])=>{const i=["send","sendMessage","sendEmbed","sendFile","sendFiles","sendCode"];t&&i.push("_cacheMessage","acknowledge","fetchMessages","fetchMessage","search","lastMessage","lastPinAt","bulkDelete","startTyping","stopTyping","typing","typingCount","fetchPinnedMessages","createCollector","createMessageCollector","awaitMessages");for(const t of i)s.includes(t)||Object.defineProperty(e.prototype,t,Object.getOwnPropertyDescriptor(TextBasedChannel.prototype,t))}),TextBasedChannel.prototype.acknowledge=c.deprecate(TextBasedChannel.prototype.acknowledge,"TextBasedChannel#acknowledge: userbot methods will be removed"),TextBasedChannel.prototype.search=c.deprecate(TextBasedChannel.prototype.search,"TextBasedChannel#search: userbot methods will be removed")}).call(this,s(15).Buffer)},function(e,t,s){const i=s(49),n=s(50),r=s(32),o=s(18),a=s(51),l=s(52),h=s(5),c=s(4),u=s(0),d=s(7),m=s(35);let p;e.exports=class Message{constructor(e,t,s){Object.defineProperty(this,"client",{value:s}),this.channel=e,this.deleted=!1,t&&this.setup(t)}setup(e){this.id=e.id,this.type=u.MessageTypes[e.type],this.content=e.content,this.author=this.client.dataManager.newUser(e.author,!e.webhook_id),this.pinned=e.pinned,this.tts=e.tts,this.nonce=e.nonce,this.system=0!==e.type,this.embeds=e.embeds.map(e=>new r(this,e)),this.attachments=new c;for(const t of e.attachments)this.attachments.set(t.id,new n(this,t));if(this.createdTimestamp=new Date(e.timestamp).getTime(),this.editedTimestamp=e.edited_timestamp?new Date(e.edited_timestamp).getTime():null,this.reactions=new c,e.reactions&&e.reactions.length>0)for(const t of e.reactions){const e=t.emoji.id?`${t.emoji.name}:${t.emoji.id}`:t.emoji.name;this.reactions.set(e,new a(this,t.emoji,t.count,t.me))}this.mentions=new i(this,e.mentions,e.mention_roles,e.mention_everyone,e.mention_channels),this.webhookID=e.webhook_id||null,this.hit="boolean"==typeof e.hit?e.hit:null,this.flags=new m(e.flags).freeze(),this.reference=e.message_reference?{channelID:e.message_reference.channel_id,guildID:e.message_reference.guild_id,messageID:e.message_reference.message_id}:null,this._edits=[],e.member&&this.guild&&this.author&&!this.guild.members.has(this.author.id)&&this.guild._addMember(Object.assign(e.member,{user:this.author}),!1),this.member=this.guild&&this.guild.member(this.author)||null}patch(e){const t=h.cloneObject(this);if(this._edits.unshift(t),"edited_timestamp"in e&&(this.editedTimestamp=new Date(e.edited_timestamp).getTime()),"content"in e&&(this.content=e.content),"pinned"in e&&(this.pinned=e.pinned),"tts"in e&&(this.tts=e.tts),this.embeds="embeds"in e?e.embeds.map(e=>new r(this,e)):this.embeds.slice(),"attachments"in e){this.attachments=new c;for(const t of e.attachments)this.attachments.set(t.id,new n(this,t))}else this.attachments=new c(this.attachments);this.mentions=new i(this,"mentions"in e?e.mentions:this.mentions.users,"mentions_roles"in e?e.mentions_roles:this.mentions.roles,"mention_everyone"in e?e.mention_everyone:this.mentions.everyone,"mention_channels"in e?e.mention_channels:this.mentions.crosspostedChannels),this.flags=new m("flags"in e?e.flags:0).freeze()}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 url(){return`https://discordapp.com/channels/${this.guild?this.guild.id:"@me"}/${this.channel.id}/${this.id}`}get cleanContent(){return this.content.replace(/@(everyone|here)/g,"@​$1").replace(/<@!?[0-9]+>/g,e=>{const t=e.replace(/<|!|>|@/g,"");if("dm"===this.channel.type||"group"===this.channel.type)return this.client.users.has(t)?`@${this.client.users.get(t).username}`:e;const s=this.channel.guild.members.get(t);if(s)return s.nickname?`@${s.nickname}`:`@${s.user.username}`;{const s=this.client.users.get(t);return s?`@${s.username}`:e}}).replace(/<#[0-9]+>/g,e=>{const t=this.client.channels.get(e.replace(/<|#|>/g,""));return t?`#${t.name}`:e}).replace(/<@&[0-9]+>/g,e=>{if("dm"===this.channel.type||"group"===this.channel.type)return e;const t=this.guild.roles.get(e.replace(/<|@|>|&/g,""));return t?`@${t.name}`:e})}createReactionCollector(e,t={}){return new l(this,e,t)}awaitReactions(e,t={}){return new Promise((s,i)=>{this.createReactionCollector(e,t).once("end",(e,n)=>{t.errors&&t.errors.includes(n)?i(e):s(e)})})}get edits(){const e=this._edits.slice();return e.unshift(this),e}get editable(){return this.author.id===this.client.user.id}get deletable(){return!this.deleted&&(this.author.id===this.client.user.id||this.guild&&this.channel.permissionsFor(this.client.user).has(d.FLAGS.MANAGE_MESSAGES))}get pinnable(){return"DEFAULT"===this.type&&(!this.guild||this.channel.permissionsFor(this.client.user).has(d.FLAGS.MANAGE_MESSAGES))}isMentioned(e){return e=e&&e.id?e.id:e,this.mentions.users.has(e)||this.mentions.channels.has(e)||this.mentions.roles.has(e)}isMemberMentioned(e){return p||(p=s(22)),!!this.mentions.everyone||!!this.mentions.users.has(e.id)||!!(e instanceof p&&e.roles.some(e=>this.mentions.roles.has(e.id)))}edit(e,t){return t||"object"!=typeof e||e instanceof Array?t||(t={}):(t=e,e=""),t instanceof o&&(t={embed:t}),this.client.rest.methods.updateMessage(this,e,t)}editCode(e,t){return t=h.escapeMarkdown(this.client.resolver.resolveString(t),!0),this.edit(`\`\`\`${e||""}\n${t}\n\`\`\``)}pin(){return this.client.rest.methods.pinMessage(this)}unpin(){return this.client.rest.methods.unpinMessage(this)}react(e){if(!(e=this.client.resolver.resolveEmojiIdentifier(e)))throw new TypeError("Emoji must be a string or Emoji/ReactionEmoji");return this.client.rest.methods.addMessageReaction(this,e)}clearReactions(){return this.client.rest.methods.removeMessageReactions(this)}delete(e=0){return e<=0?this.client.rest.methods.deleteMessage(this):new Promise(t=>{this.client.setTimeout(()=>{t(this.delete())},e)})}reply(e,t){return t||"object"!=typeof e||e instanceof Array?t||(t={}):(t=e,e=""),this.channel.send(e,Object.assign(t,{reply:this.member||this.author}))}acknowledge(){return this.client.rest.methods.ackMessage(this)}fetchWebhook(){return this.webhookID?this.client.fetchWebhook(this.webhookID):Promise.reject(new Error("The message was not sent by a webhook."))}suppressEmbeds(e=!0){const t=new m(this.flags.bitfield);return e?t.add(m.FLAGS.SUPPRESS_EMBEDS):t.remove(m.FLAGS.SUPPRESS_EMBEDS),this.edit(void 0,{flags:t})}equals(e,t){if(!e)return!1;if(!e.author&&!e.attachments)return this.id===e.id&&this.embeds.length===e.embeds.length;let s=this.id===e.id&&this.author.id===e.author.id&&this.content===e.content&&this.tts===e.tts&&this.nonce===e.nonce&&this.embeds.length===e.embeds.length&&this.attachments.length===e.attachments.length;return s&&t&&(s=this.mentions.everyone===e.mentions.everyone&&this.createdTimestamp===new Date(t.timestamp).getTime()&&this.editedTimestamp===new Date(t.edited_timestamp).getTime()),s}toString(){return this.content}_addReaction(e,t){const s=e.id?`${e.name}:${e.id}`:e.name;let i;return this.reactions.has(s)?(i=this.reactions.get(s)).me||(i.me=t.id===this.client.user.id):(i=new a(this,e,0,t.id===this.client.user.id),this.reactions.set(s,i)),i.users.has(t.id)||(i.users.set(t.id,t),i.count++),i}_removeReaction(e,t){const s=e.id?`${e.name}:${e.id}`:e.name;if(this.reactions.has(s)){const e=this.reactions.get(s);if(!t)return this.reactions.delete(s),e;if(e.users.has(t.id))return e.users.delete(t.id),e.count--,t.id===this.client.user.id&&(e.me=!1),e.count<=0&&this.reactions.delete(s),e}return null}_clearReactions(){this.reactions.clear()}}},function(e,t,s){const i=s(0),n=s(4),r=s(7),o=s(6);class Emoji{constructor(e,t){Object.defineProperty(this,"client",{value:e.client}),this.guild=e,this.deleted=!1,this.setup(t)}setup(e){this.id=e.id,this.name=e.name,this.requiresColons=e.require_colons,this.managed=e.managed,this.animated=e.animated,void 0!==e.available&&(this.available=e.available),this._roles=e.roles}get createdTimestamp(){return o.deconstruct(this.id).timestamp}get createdAt(){return new Date(this.createdTimestamp)}get deletable(){return!this.managed&&this.guild.me.hasPermission(r.FLAGS.MANAGE_EMOJIS)}get roles(){const e=new n;for(const t of this._roles)this.guild.roles.has(t)&&e.set(t,this.guild.roles.get(t));return e}get url(){return i.Endpoints.CDN(this.client.options.http.cdn).Emoji(this.id,this.animated?"gif":"png")}get identifier(){return this.id?`${this.name}:${this.id}`:encodeURIComponent(this.name)}edit(e,t){return this.client.rest.methods.updateEmoji(this,e,t)}setName(e,t){return this.edit({name:e},t)}fetchAuthor(){return this.managed?Promise.reject(new Error("Emoji is managed and has no Author.")):this.guild.me.permissions.has(r.FLAGS.MANAGE_EMOJIS)?this.client.rest.makeRequest("get",i.Endpoints.Guild(this.guild).Emoji(this.id),!0).then(e=>this.client.dataManager.newUser(e.user)):Promise.reject(new Error(`Client must have Manage Emoji permission in guild ${this.guild} to see emoji authors.`))}addRestrictedRole(e){return this.addRestrictedRoles([e])}addRestrictedRoles(e){const t=new n(this.roles);for(const s of e)this.guild.roles.has(s.id)&&t.set(s.id,s);return this.edit({roles:t})}removeRestrictedRole(e){return this.removeRestrictedRoles([e])}removeRestrictedRoles(e){const t=new n(this.roles);for(const s of e)t.has(s.id)&&t.delete(s.id);return this.edit({roles:t})}delete(e){return this.client.rest.methods.deleteEmoji(this,e)}toString(){return this.id&&this.requiresColons?`<${this.animated?"a":""}:${this.name}:${this.id}>`:this.name}equals(e){return e instanceof Emoji?e.id===this.id&&e.name===this.name&&e.managed===this.managed&&e.requiresColons===this.requiresColons:e.id===this.id&&e.name===this.name}}e.exports=Emoji},function(e,t,s){const i=s(19),n=s(9),r=s(7),o=s(4),{Presence:a}=s(11),l=s(8);class GuildMember{constructor(e,t){Object.defineProperty(this,"client",{value:e.client}),this.guild=e,this.user={},this.joinedTimestamp=null,this.premiumSinceTimestamp=null,this._roles=[],t&&this.setup(t),this.lastMessageID=null,this.lastMessage=null,this.deleted=!1}setup(e){this.serverDeaf=e.deaf,this.serverMute=e.mute,this.selfMute=e.self_mute,this.selfDeaf=e.self_deaf,this.selfStream=e.self_stream||!1,this.voiceSessionID=e.session_id,this.voiceChannelID=e.channel_id,this.speaking=!1,this.nickname=e.nick||null,e.joined_at&&(this.joinedTimestamp=new Date(e.joined_at).getTime()),e.premium_since&&(this.premiumSinceTimestamp=new Date(e.premium_since).getTime()),this.user=e.user,this._roles=e.roles}get joinedAt(){return this.joinedTimestamp?new Date(this.joinedTimestamp):null}get premiumSince(){return this.premiumSinceTimestamp?new Date(this.premiumSinceTimestamp):null}get presence(){return this.frozenPresence||this.guild.presences.get(this.id)||new a(void 0,this.client)}get roles(){const e=new o,t=this.guild.roles.get(this.guild.id);t&&e.set(t.id,t);for(const t of this._roles){const s=this.guild.roles.get(t);s&&e.set(s.id,s)}return e}get highestRole(){return this.roles.reduce((e,t)=>!e||t.comparePositionTo(e)>0?t:e)}get colorRole(){const e=this.roles.filter(e=>e.color);return e.size?e.reduce((e,t)=>!e||t.comparePositionTo(e)>0?t:e):null}get displayColor(){const e=this.colorRole;return e&&e.color||0}get displayHexColor(){const e=this.colorRole;return e&&e.hexColor||"#000000"}get hoistRole(){const e=this.roles.filter(e=>e.hoist);return e.size?e.reduce((e,t)=>!e||t.comparePositionTo(e)>0?t:e):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(this,r.ALL);let e=0;const t=this.roles;for(const s of t.values())e|=s.permissions;return new r(this,e)}get manageable(){return this.user.id!==this.guild.ownerID&&(this.user.id!==this.client.user.id&&(this.client.user.id===this.guild.ownerID||this.guild.me.highestRole.comparePositionTo(this.highestRole)>0))}get kickable(){return this.manageable&&this.guild.me.permissions.has(r.FLAGS.KICK_MEMBERS)}get bannable(){return this.manageable&&this.guild.me.permissions.has(r.FLAGS.BAN_MEMBERS)}permissionsIn(e){if(!(e=this.client.resolver.resolveChannel(e))||!e.guild)throw new Error("Could not resolve channel to a guild channel.");return e.permissionsFor(this)}hasPermission(e,t=!1,s,i){return void 0===s&&(s=!t),void 0===i&&(i=!t),!(!i||this.user.id!==this.guild.ownerID)||this.roles.some(t=>t.hasPermission(e,void 0,s))}hasPermissions(e,t=!1){return!t&&this.user.id===this.guild.ownerID||this.hasPermission(e,t)}missingPermissions(e,t=!1){return e instanceof Array||(e=[e]),this.permissions.missing(e,t)}edit(e,t){return this.client.rest.methods.updateGuildMember(this,e,t)}setMute(e,t){return this.edit({mute:e},t)}setDeaf(e,t){return this.edit({deaf:e},t)}setVoiceChannel(e){return this.edit({channel:e})}setRoles(e,t){return this.edit({roles:e},t)}addRole(e,t){return e instanceof n||(e=this.guild.roles.get(e)),e?this.client.rest.methods.addMemberRole(this,e,t):Promise.reject(new TypeError("Supplied parameter was neither a Role nor a Snowflake."))}addRoles(e,t){let s;if(e instanceof o){s=this._roles.slice();for(const t of e.values())s.push(t.id)}else s=this._roles.concat(e);return this.edit({roles:s},t)}removeRole(e,t){return e instanceof n||(e=this.guild.roles.get(e)),e?this.client.rest.methods.removeMemberRole(this,e,t):Promise.reject(new TypeError("Supplied parameter was neither a Role nor a Snowflake."))}removeRoles(e,t){const s=this._roles.slice();if(e instanceof o)for(const t of e.values()){const e=s.indexOf(t.id);e>=0&&s.splice(e,1)}else for(const t of e){const e=s.indexOf(t instanceof n?t.id:t);e>=0&&s.splice(e,1)}return this.edit({roles:s},t)}setNickname(e,t){return this.edit({nick:e},t)}createDM(){return this.user.createDM()}deleteDM(){return this.user.deleteDM()}kick(e){return this.client.rest.methods.kickGuildMember(this.guild,this,e)}ban(e){return this.guild.ban(this,e)}toString(){return`<@${this.nickname?"!":""}${this.user.id}>`}send(){}sendMessage(){}sendEmbed(){}sendFile(){}sendCode(){}}i.applyToClass(GuildMember),GuildMember.prototype.hasPermissions=l.deprecate(GuildMember.prototype.hasPermissions,"GuildMember#hasPermissions is deprecated - use GuildMember#hasPermission, it now takes an array"),GuildMember.prototype.missingPermissions=l.deprecate(GuildMember.prototype.missingPermissions,"GuildMember#missingPermissions is deprecated - use GuildMember#permissions.missing, it now takes an array"),e.exports=GuildMember},function(e,t){class BitField{constructor(e){this.bitfield=this.constructor.resolve(e)}any(e){return 0!=(this.bitfield&this.constructor.resolve(e))}equals(e){return this.bitfield===this.constructor.resolve(e)}has(e){return Array.isArray(e)?e.every(e=>this.has(e)):(e=this.constructor.resolve(e),(this.bitfield&e)===e)}missing(e,...t){return Array.isArray(e)||(e=new this.constructor(e).toArray(!1)),e.filter(e=>!this.has(e,...t))}freeze(){return Object.freeze(this)}add(...e){let t=0;for(const s of e)t|=this.constructor.resolve(s);return Object.isFrozen(this)?new this.constructor(this.bitfield|t):(this.bitfield|=t,this)}remove(...e){let t=0;for(const s of e)t|=this.constructor.resolve(s);return Object.isFrozen(this)?new this.constructor(this.bitfield&~t):(this.bitfield&=~t,this)}serialize(...e){const t={};for(const s of Object.keys(this.constructor.FLAGS))t[s]=this.has(this.constructor.FLAGS[s],...e);return t}toArray(...e){return Object.keys(this.constructor.FLAGS).filter(t=>this.has(t,...e))}toJSON(){return this.bitfield}valueOf(){return this.bitfield}*[Symbol.iterator](){yield*this.toArray()}static resolve(e=0){if("number"==typeof e&&e>=0)return e;if(e instanceof BitField)return e.bitfield;if(Array.isArray(e))return e.map(e=>this.resolve(e)).reduce((e,t)=>e|t,0);if("string"==typeof e&&void 0!==this.FLAGS[e])return this.FLAGS[e];throw new RangeError("Invalid bitfield flag or number.")}}BitField.FLAGS={},e.exports=BitField},function(e,t){e.exports=class Attachment{constructor(e,t){this.file=null,t?this.setAttachment(e,t):this._attach(e)}get name(){return this.file.name}get attachment(){return this.file.attachment}setAttachment(e,t){return this.file={attachment:e,name:t},this}setFile(e){return this.file={attachment:e},this}setName(e){return this.file.name=e,this}_attach(e,t){"string"==typeof e?this.file=e:this.setAttachment(e,t)}}},function(e,t,s){(function(e){function s(e,t){for(var s=0,i=e.length-1;i>=0;i--){var n=e[i];"."===n?e.splice(i,1):".."===n?(e.splice(i,1),s++):s&&(e.splice(i,1),s--)}if(t)for(;s--;s)e.unshift("..");return e}function i(e,t){if(e.filter)return e.filter(t);for(var s=[],i=0;i=-1&&!n;r--){var o=r>=0?arguments[r]:e.cwd();if("string"!=typeof o)throw new TypeError("Arguments to path.resolve must be strings");o&&(t=o+"/"+t,n="/"===o.charAt(0))}return t=s(i(t.split("/"),function(e){return!!e}),!n).join("/"),(n?"/":"")+t||"."},t.normalize=function(e){var r=t.isAbsolute(e),o="/"===n(e,-1);return(e=s(i(e.split("/"),function(e){return!!e}),!r).join("/"))||r||(e="."),e&&o&&(e+="/"),(r?"/":"")+e},t.isAbsolute=function(e){return"/"===e.charAt(0)},t.join=function(){var e=Array.prototype.slice.call(arguments,0);return t.normalize(i(e,function(e,t){if("string"!=typeof e)throw new TypeError("Arguments to path.join must be strings");return e}).join("/"))},t.relative=function(e,s){function i(e){for(var t=0;t=0&&""===e[s];s--);return t>s?[]:e.slice(t,s-t+1)}e=t.resolve(e).substr(1),s=t.resolve(s).substr(1);for(var n=i(e.split("/")),r=i(s.split("/")),o=Math.min(n.length,r.length),a=o,l=0;l=1;--r)if(47===(t=e.charCodeAt(r))){if(!n){i=r;break}}else n=!1;return-1===i?s?"/":".":s&&1===i?"/":e.slice(0,i)},t.basename=function(e,t){var s=function(e){"string"!=typeof e&&(e+="");var t,s=0,i=-1,n=!0;for(t=e.length-1;t>=0;--t)if(47===e.charCodeAt(t)){if(!n){s=t+1;break}}else-1===i&&(n=!1,i=t+1);return-1===i?"":e.slice(s,i)}(e);return t&&s.substr(-1*t.length)===t&&(s=s.substr(0,s.length-t.length)),s},t.extname=function(e){"string"!=typeof e&&(e+="");for(var t=-1,s=0,i=-1,n=!0,r=0,o=e.length-1;o>=0;--o){var a=e.charCodeAt(o);if(47!==a)-1===i&&(n=!1,i=o+1),46===a?-1===t?t=o:1!==r&&(r=1):-1!==t&&(r=-1);else if(!n){s=o+1;break}}return-1===t||-1===i||0===r||1===r&&t===i-1&&t===s+1?"":e.slice(t,i)};var n="b"==="ab".substr(-1)?function(e,t,s){return e.substr(t,s)}:function(e,t,s){return t<0&&(t=e.length+t),e.substr(t,s)}}).call(this,s(16))},function(e,t,s){const i=s(0),n=s(6);e.exports=class ReactionEmoji{constructor(e,t){Object.defineProperty(this,"client",{value:e.message.client}),this.reaction=e,this.name=t.name,this.id=t.id,this.animated=t.animated||!1}get createdTimestamp(){return this.id?n.deconstruct(this.id).timestamp:null}get createdAt(){return this.id?new Date(this.createdTimestamp):null}get url(){return this.id?i.Endpoints.CDN(this.client.options.http.cdn).Emoji(this.id,this.animated?"gif":"png"):null}get identifier(){return this.id?`${this.name}:${this.id}`:encodeURIComponent(this.name)}toString(){return this.id?`<${this.animated?"a":""}:${this.name}:${this.id}>`:this.name}}},function(e,t,s){const i=s(8),n=s(31),r=s(10),o=s(9),a=s(21),l=s(11).Presence,h=s(22),c=s(36),u=s(0),d=s(4),m=s(5),p=s(6),g=s(54);class Guild{constructor(e,t){Object.defineProperty(this,"client",{value:e}),this.members=new d,this.channels=new d,this.roles=new d,this.presences=new d,this.deleted=!1,t&&(t.unavailable?(this.available=!1,this.id=t.id):(this.setup(t),t.channels||(this.available=!1)))}setup(e){if(this.name=e.name,this.icon=e.icon,this.splash=e.splash,this.region=e.region,this.memberCount=e.member_count||this.memberCount,this.large=Boolean("large"in e?e.large:this.large),this.features=e.features,this.applicationID=e.application_id,this.afkTimeout=e.afk_timeout,this.afkChannelID=e.afk_channel_id,this.systemChannelID=e.system_channel_id,this.embedEnabled=e.embed_enabled,this.verificationLevel=e.verification_level,this.explicitContentFilter=e.explicit_content_filter,this.mfaLevel=e.mfa_level,this.joinedTimestamp=e.joined_at?new Date(e.joined_at).getTime():this.joinedTimestamp,this.defaultMessageNotifications=u.DefaultMessageNotifications[e.default_message_notifications]||e.default_message_notifications,this.systemChannelFlags=new g(e.system_channel_flags).freeze(),this.premiumTier=e.premium_tier,void 0!==e.premium_subscription_count&&(this.premiumSubscriptionCount=e.premium_subscription_count),this.banner=e.banner,this.description=e.description,void 0!==e.embed_channel_id&&(this.embedChannelID=e.embed_channel_id),void 0!==e.max_members&&(this.maximumMembers=e.max_members||25e4),void 0!==e.max_presences&&(this.maximumPresences=e.max_presences||5e3),void 0!==e.widget_enabled&&(this.widgetEnabled=e.widget_enabled),void 0!==e.widget_channel_id&&(this.widgetChannelID=e.widget_channel_id),this.vanityURLCode=e.vanity_url_code,this.id=e.id,this.available=!e.unavailable,this.features=e.features||this.features||[],this.rulesChannelID=e.rules_channel_id,this.publicUpdatesChannelID=e.public_updates_channel_id,e.members){this.members.clear();for(const t of e.members)this._addMember(t,!1)}if(e.owner_id&&(this.ownerID=e.owner_id),e.channels){this.channels.clear();for(const t of e.channels)this.client.dataManager.newChannel(t,this)}if(e.roles){this.roles.clear();for(const t of e.roles){const e=new o(this,t);this.roles.set(e.id,e)}}if(e.presences)for(const t of e.presences)this._setPresence(t.user.id,t);if(this._rawVoiceStates=new d,e.voice_states)for(const t of e.voice_states){this._rawVoiceStates.set(t.user_id,t);const e=this.members.get(t.user_id),s=this.channels.get(t.channel_id);e&&s&&(e.serverMute=t.mute,e.serverDeaf=t.deaf,e.selfMute=t.self_mute,e.selfDeaf=t.self_deaf,e.selfStream=t.self_stream||!1,e.voiceSessionID=t.session_id,e.voiceChannelID=t.channel_id,s.members.set(e.user.id,e))}if(this.emojis)this.client.actions.GuildEmojisUpdate.handle({guild_id:this.id,emojis:e.emojis});else{this.emojis=new d;for(const t of e.emojis)this.emojis.set(t.id,new a(this,t))}}get createdTimestamp(){return p.deconstruct(this.id).timestamp}get createdAt(){return new Date(this.createdTimestamp)}get embedChannel(){return this.channels.get(this.embedChannelID)||null}get widgetChannel(){return this.channels.get(this.widgetChannelID)||null}get joinedAt(){return new Date(this.joinedTimestamp)}get verified(){return this.features.includes("VERIFIED")}get iconURL(){return this.icon?u.Endpoints.Guild(this).Icon(this.client.options.http.cdn,this.icon):null}get bannerURL(){return this.banner?u.Endpoints.Guild(this).Banner(this.client.options.http.cdn,this.banner):null}get nameAcronym(){return this.name.replace(/\w+/g,e=>e[0]).replace(/\s/g,"")}get splashURL(){return this.splash?u.Endpoints.Guild(this).Splash(this.client.options.http.cdn,this.splash):null}get owner(){return this.members.get(this.ownerID)}get afkChannel(){return this.client.channels.get(this.afkChannelID)||null}get systemChannel(){return this.client.channels.get(this.systemChannelID)||null}get voiceConnection(){return this.client.browser?null:this.client.voice.connections.get(this.id)||null}get position(){return this.client.user.bot?null:this.client.user.settings.guildPositions?this.client.user.settings.guildPositions.indexOf(this.id):null}get muted(){if(this.client.user.bot)return null;try{return this.client.user.guildSettings.get(this.id).muted}catch(e){return!1}}get messageNotifications(){if(this.client.user.bot)return null;try{return this.client.user.guildSettings.get(this.id).messageNotifications}catch(e){return null}}get mobilePush(){if(this.client.user.bot)return null;try{return this.client.user.guildSettings.get(this.id).mobilePush}catch(e){return!1}}get suppressEveryone(){if(this.client.user.bot)return null;try{return this.client.user.guildSettings.get(this.id).suppressEveryone}catch(e){return null}}get defaultRole(){return this.roles.get(this.id)}get rulesChannel(){return this.client.channels.get(this.rulesChannelID)||null}get publicUpdatesChannel(){return this.client.channels.get(this.publicUpdatesChannelID)||null}get me(){return this.members.get(this.client.user.id)}get _sortedRoles(){return this._sortPositionWithID(this.roles)}member(e){return this.client.resolver.resolveGuildMember(this,e)}fetch(){return this.client.rest.methods.getGuild(this).then(e=>(this.setup(e),this))}fetchBan(e){return this.client.rest.methods.getGuildBan(this,e)}fetchBans(e=!1){return e?this.client.rest.methods.getGuildBans(this):this.client.rest.methods.getGuildBans(this).then(e=>{const t=new d;for(const s of e.values())t.set(s.user.id,s.user);return t})}fetchIntegrations(){return this.client.rest.methods.getIntegrations(this).then(e=>e.reduce((e,t)=>e.set(t.id,new c(this.client,t,this)),new d))}createIntegration(e,t){return this.client.rest.methods.createIntegration(this,e,t).then(()=>this)}fetchInvites(){return this.client.rest.methods.getGuildInvites(this)}fetchVanityCode(){return this.features.includes("VANITY_URL")?this.client.rest.methods.getGuildVanityCode(this):Promise.reject(new Error("This guild does not have the VANITY_URL feature enabled."))}fetchWebhooks(){return this.client.rest.methods.getGuildWebhooks(this)}fetchVoiceRegions(){return this.client.rest.methods.fetchVoiceRegions(this.id)}fetchEmbed(){return this.client.rest.methods.fetchEmbed(this.id)}fetchAuditLogs(e){return this.client.rest.methods.getGuildAuditLogs(this,e)}addMember(e,t){return e=this.client.resolver.resolveUserID(e),this.members.has(e)?Promise.resolve(this.members.get(e)):this.client.rest.methods.putGuildMember(this,e,t)}fetchMember(e,t=!0){const s=this.client.resolver.resolveUserID(e);if(!s)return Promise.reject(new Error("Invalid id provided."));const i=this.members.get(s);return i&&i.joinedTimestamp?Promise.resolve(i):this.client.rest.methods.getGuildMember(this,s,t)}fetchMembers(e="",t=0){return new Promise((s,i)=>{if(this.memberCount===this.members.size)return void s(this);this.client.ws.send({op:u.OPCodes.REQUEST_GUILD_MEMBERS,d:{guild_id:this.id,query:e,limit:t}});const n=(e,t)=>{t.id===this.id&&(this.memberCount===this.members.size||e.length<1e3)&&(this.client.removeListener(u.Events.GUILD_MEMBERS_CHUNK,n),s(this))};this.client.on(u.Events.GUILD_MEMBERS_CHUNK,n),this.client.setTimeout(()=>i(new Error("Members didn't arrive in time.")),12e4)})}search(e={}){return this.client.rest.methods.search(this,e)}edit(e,t){const s={};return e.name&&(s.name=e.name),e.region&&(s.region=e.region),void 0!==e.verificationLevel&&(s.verification_level=Number(e.verificationLevel)),void 0!==e.afkChannel&&(s.afk_channel_id=this.client.resolver.resolveChannelID(e.afkChannel)),void 0!==e.systemChannel&&(s.system_channel_id=this.client.resolver.resolveChannelID(e.systemChannel)),e.afkTimeout&&(s.afk_timeout=Number(e.afkTimeout)),void 0!==e.icon&&(s.icon=e.icon),e.owner&&(s.owner_id=this.client.resolver.resolveUser(e.owner).id),void 0!==e.splash&&(s.splash=e.splash),void 0!==e.banner&&(s.banner=e.banner),void 0!==e.explicitContentFilter&&(s.explicit_content_filter=Number(e.explicitContentFilter)),void 0!==e.defaultMessageNotifications&&(s.default_message_notifications="string"==typeof e.defaultMessageNotifications?u.DefaultMessageNotifications.indexOf(e.defaultMessageNotifications):Number(e.defaultMessageNotifications)),void 0!==e.systemChannelFlags&&(s.system_channel_flags=g.resolve(e.systemChannelFlags)),this.client.rest.methods.updateGuild(this,s,t)}setBanner(e,t){return this.client.resolver.resolveImage(e).then(e=>this.edit({banner:e},t))}setExplicitContentFilter(e,t){return this.edit({explicitContentFilter:e},t)}setDefaultMessageNotifications(e,t){return this.edit({defaultMessageNotifications:e},t)}setSystemChannelFlags(e,t){return this.edit({systemChannelFlags:e},t)}setName(e,t){return this.edit({name:e},t)}setRegion(e,t){return this.edit({region:e},t)}setVerificationLevel(e,t){return this.edit({verificationLevel:e},t)}setAFKChannel(e,t){return this.edit({afkChannel:e},t)}setSystemChannel(e,t){return this.edit({systemChannel:e},t)}setAFKTimeout(e,t){return this.edit({afkTimeout:e},t)}setIcon(e,t){return this.client.resolver.resolveImage(e).then(e=>this.edit({icon:e,reason:t}))}setOwner(e,t){return this.edit({owner:e},t)}setSplash(e){return this.client.resolver.resolveImage(e).then(e=>this.edit({splash:e}))}setPosition(e,t){return this.client.user.bot?Promise.reject(new Error("Setting guild position is only available for user accounts")):this.client.user.settings.setGuildPosition(this,e,t)}acknowledge(){return this.client.rest.methods.ackGuild(this)}allowDMs(e){const t=this.client.user.settings;return e?t.removeRestrictedGuild(this):t.addRestrictedGuild(this)}ban(e,t={}){return"number"==typeof t?t={reason:null,"delete-message-days":t}:"string"==typeof t&&(t={reason:t,"delete-message-days":0}),t.days&&(t["delete-message-days"]=t.days),this.client.rest.methods.banGuildMember(this,e,t)}unban(e,t){return this.client.rest.methods.unbanGuildMember(this,e,t)}pruneMembers(e,t=!1,s){if("number"!=typeof e)throw new TypeError("Days must be a number.");return this.client.rest.methods.pruneGuildMembers(this,e,t,s)}sync(){this.client.user.bot||this.client.syncGuilds([this])}createChannel(e,t,s,i){return t&&"string"!=typeof t||(t&&((e,...t)=>console.warn("Guild#createChannel: Create channels with an options object instead of separate parameters",t))(0,"DeprecationWarning"),t={type:t,permissionOverwrites:s,reason:i}),this.client.rest.methods.createChannel(this,e,t)}setChannelPositions(e){return e=e.map(({channel:e,position:t})=>({id:e.id||e,position:t})),this.client.rest.methods.setChannelPositions(this.id,e)}setRolePositions(e){return e=e.map(({role:e,position:t})=>({id:e.id||e,position:t})),this.client.rest.methods.setRolePositions(this.id,e)}setEmbed(e,t){return this.client.rest.methods.updateEmbed(this.id,e,t).then(()=>this)}createRole(e={},t){return this.client.rest.methods.createGuildRole(this,e,t)}createEmoji(e,t,s,i){return"string"==typeof e&&e.startsWith("data:")?this.client.rest.methods.createEmoji(this,e,t,s,i):this.client.resolver.resolveImage(e).then(e=>this.client.rest.methods.createEmoji(this,e,t,s,i))}deleteEmoji(e,t){if("string"==typeof e&&(e=this.emojis.get(e)),!(e instanceof a))throw new TypeError("Emoji must be either an instance of Emoji or an ID");return e.delete(t)}leave(){return this.client.rest.methods.leaveGuild(this)}delete(){return this.client.rest.methods.deleteGuild(this)}equals(e){let t=e&&this.id===e.id&&this.available===!e.unavailable&&this.splash===e.splash&&this.region===e.region&&this.name===e.name&&this.memberCount===e.member_count&&this.large===e.large&&this.icon===e.icon&&m.arraysEqual(this.features,e.features)&&this.ownerID===e.owner_id&&this.verificationLevel===e.verification_level&&this.embedEnabled===e.embed_enabled;return t&&(this.embedChannel?this.embedChannel.id!==e.embed_channel_id&&(t=!1):e.embed_channel_id&&(t=!1)),t}toString(){return this.name}_addMember(e,t=!0){const s=this.members.has(e.user.id);e.user instanceof r||(e.user=this.client.dataManager.newUser(e.user)),e.joined_at=e.joined_at||0;const i=new h(this,e);if(this.members.set(i.id,i),this._rawVoiceStates&&this._rawVoiceStates.has(i.user.id)){const e=this._rawVoiceStates.get(i.user.id);i.serverMute=e.mute,i.serverDeaf=e.deaf,i.selfMute=e.self_mute,i.selfDeaf=e.self_deaf,i.selfStream=e.self_stream||!1,i.voiceSessionID=e.session_id,i.voiceChannelID=e.channel_id,this.client.channels.has(e.channel_id)?this.client.channels.get(e.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===u.Status.READY&&t&&!s&&this.client.emit(u.Events.GUILD_MEMBER_ADD,i),i}_updateMember(e,t){const s=m.cloneObject(e);t.premium_since&&(e.premiumSinceTimestamp=new Date(t.premium_since).getTime()),t.roles&&(e._roles=t.roles),void 0!==t.nick&&(e.nickname=t.nick);const i=e.nickname!==s.nickname||e.premiumSinceTimestamp!==s.premiumSinceTimestamp||!m.arraysEqual(e._roles,s._roles);return this.client.ws.connection.status===u.Status.READY&&i&&this.client.emit(u.Events.GUILD_MEMBER_UPDATE,s,e),{old:s,mem:e}}_removeMember(e){e.voiceChannel&&e.voiceChannel.members.delete(e.id),this.members.delete(e.id)}_memberSpeakUpdate(e,t){const s=this.members.get(e);s&&s.speaking!==t&&(s.speaking=t,this.client.emit(u.Events.GUILD_MEMBER_SPEAKING,s,t))}_setPresence(e,t){this.presences.get(e)?this.presences.get(e).update(t):this.presences.set(e,new l(t,this.client))}setRolePosition(e,t,s=!1){if("string"==typeof e&&!(e=this.roles.get(e)))return Promise.reject(new Error("Supplied role is not a role or snowflake."));if(t=Number(t),isNaN(t))return Promise.reject(new Error("Supplied position is not a number."));let i=this._sortedRoles.array();return m.moveElementInArray(i,e,t,s),i=i.map((e,t)=>({id:e.id,position:t})),this.client.rest.methods.setRolePositions(this.id,i)}setChannelPosition(e,t,s=!1){if("string"==typeof e&&!(e=this.channels.get(e)))return Promise.reject(new Error("Supplied channel is not a channel or snowflake."));if(t=Number(t),isNaN(t))return Promise.reject(new Error("Supplied position is not a number."));let i=this._sortedChannels(e.type).array();return m.moveElementInArray(i,e,t,s),i=i.map((e,t)=>({id:e.id,position:t})),this.client.rest.methods.setChannelPositions(this.id,i)}_sortedChannels(e){return this._sortPositionWithID(this.channels.filter(t=>"voice"===e&&"voice"===t.type||("voice"!==e&&"voice"!==t.type||e===t.type)))}_sortPositionWithID(e){return e.sort((e,t)=>e.position!==t.position?e.position-t.position:n.fromString(t.id).sub(n.fromString(e.id)).toNumber())}}Object.defineProperty(Guild.prototype,"defaultChannel",{get:i.deprecate(function(){return this.channels.get(this.id)},"Guild#defaultChannel: This property is obsolete, will be removed in v12.0.0, and may not function as expected.")}),Guild.prototype.allowDMs=i.deprecate(Guild.prototype.allowDMs,"Guild#allowDMs: userbot methods will be removed"),Guild.prototype.acknowledge=i.deprecate(Guild.prototype.acknowledge,"Guild#acknowledge: userbot methods will be removed"),Guild.prototype.setPosition=i.deprecate(Guild.prototype.setPosition,"Guild#setPosition: userbot methods will be removed"),Guild.prototype.search=i.deprecate(Guild.prototype.search,"Guild#search: userbot methods will be removed"),Guild.prototype.sync=i.deprecate(Guild.prototype.sync,"Guild#sync:, userbot methods will be removed"),Guild.prototype.deleteEmoji=i.deprecate(Guild.prototype.deleteEmoji,"Guild#deleteEmoji: use Emoji#delete instead"),e.exports=Guild},function(e,t,s){(function(t){const i=s(17),n=s(25),r=s(5),o=s(24),a=s(18),l=s(0),h=s(6);e.exports=class Webhook extends i{constructor(e,t,s){super(),e?(Object.defineProperty(this,"client",{value:e}),t&&this.setup(t)):(this.id=t,this.token=s,Object.defineProperty(this,"client",{value:this}))}setup(e){this.name=e.name,Object.defineProperty(this,"token",{value:e.token||null,writable:!0,configurable:!0}),this.avatar=e.avatar,this.id=e.id,this.type=l.WebhookTypes[e.type],this.guildID=e.guild_id,this.channelID=e.channel_id,e.user?this.owner=this.client.users?this.client.users.get(e.user.id):e.user:this.owner=null}get createdTimestamp(){return h.deconstruct(this.id).timestamp}get createdAt(){return new Date(this.createdTimestamp)}get avatarURL(){return this.avatar?l.Endpoints.CDN(this.client.options.http.cdn).Avatar(this.id,this.avatar):null}get url(){return`${this.client.options.http.host}/api/v${this.client.options.http.version}`+l.Endpoints.Webhook(this.id,this.token)}send(e,s){if(s||"object"!=typeof e||e instanceof Array?s||(s={}):(s=e,e=""),s instanceof o&&(s={files:[s]}),s instanceof a&&(s={embeds:[s]}),e){e=this.client.resolver.resolveString(e);let{split:t,code:i,disableEveryone:n}=s;t&&"object"!=typeof t&&(t={}),void 0===i||"boolean"==typeof i&&!0!==i||(e=r.escapeMarkdown(e,!0),e=`\`\`\`${"boolean"!=typeof i&&i||""}\n${e}\n\`\`\``,t&&(t.prepend=`\`\`\`${"boolean"!=typeof i&&i||""}\n`,t.append="\n```")),(n||void 0===n&&this.client.options.disableEveryone)&&(e=e.replace(/@(everyone|here)/g,"@​$1")),t&&(e=r.splitMessage(e,t))}if(s.file&&(s.files?s.files.push(s.file):s.files=[s.file]),s.embeds){const e=[];for(const t of s.embeds)t.file&&e.push(t.file);s.files?s.files.push(...e):s.files=e}if(s.embeds&&(s.embeds=s.embeds.map(e=>new a(e).toJSON())),s.files){for(let e=0;ethis.client.resolver.resolveFile(e.attachment).then(t=>(e.file=t,e)))).then(t=>this.client.rest.methods.sendWebhookMessage(this,e,s,t))}return this.client.rest.methods.sendWebhookMessage(this,e,s)}sendMessage(e,t={}){return this.send(e,t)}sendFile(e,t,s,i={}){return this.send(s,Object.assign(i,{file:{attachment:e,name:t}}))}sendCode(e,t,s={}){return this.send(t,Object.assign(s,{code:e}))}sendSlackMessage(e){return this.client.rest.methods.sendSlackWebhookMessage(this,e)}edit(e=this.name,t){return"object"!=typeof e&&(((e,...t)=>console.warn("Webhook#edit: Use options object instead of separate parameters.",t))(),e={name:e,avatar:t},t=void 0),e.channel&&(e.channel_id=this.client.resolver.resolveChannelID(e.channel),e.channel=void 0),e.avatar?this.client.resolver.resolveImage(e.avatar).then(s=>(e.avatar=s,this.client.rest.methods.editWebhook(this,e,t))):this.client.rest.methods.editWebhook(this,e,t)}delete(e){return this.client.rest.methods.deleteWebhook(this,e)}}}).call(this,s(15).Buffer)},function(e,t,s){const i=s(14),n=s(19),r=s(4);class TextChannel extends i{constructor(e,t){super(e,t),this.type="text",this.messages=new r,this._typing=new Map}setup(e){super.setup(e),this.topic=e.topic,this.nsfw=Boolean(e.nsfw),this.lastMessageID=e.last_message_id,this.lastPinTimestamp=e.last_pin_timestamp?new Date(e.last_pin_timestamp).getTime():null,this.rateLimitPerUser=e.rate_limit_per_user||0}get members(){const e=new r;for(const t of this.guild.members.values())this.permissionsFor(t).has("READ_MESSAGES")&&e.set(t.id,t);return e}fetchWebhooks(){return this.client.rest.methods.getChannelWebhooks(this)}setNSFW(e,t){return this.edit({nsfw:e},t)}createWebhook(e,t,s){return"string"==typeof t&&t.startsWith("data:")?this.client.rest.methods.createWebhook(this,e,t,s):this.client.resolver.resolveImage(t).then(t=>this.client.rest.methods.createWebhook(this,e,t,s))}setRateLimitPerUser(e,t){return this.edit({rateLimitPerUser:e},t)}get lastMessage(){}get lastPinAt(){}send(){}sendMessage(){}sendEmbed(){}sendFile(){}sendFiles(){}sendCode(){}fetchMessage(){}fetchMessages(){}fetchPinnedMessages(){}search(){}startTyping(){}stopTyping(){}get typing(){}get typingCount(){}createCollector(){}createMessageCollector(){}awaitMessages(){}bulkDelete(){}acknowledge(){}_cacheMessage(){}}n.applyToClass(TextChannel,!0),e.exports=TextChannel},function(e,t,s){"use strict";s.r(t),s.d(t,"version",function(){return n}),s.d(t,"METHODS",function(){return r}),s.d(t,"acl",function(){return o}),s.d(t,"bind",function(){return a}),s.d(t,"checkout",function(){return l}),s.d(t,"connect",function(){return h}),s.d(t,"copy",function(){return c}),s.d(t,"delete",function(){return u}),s.d(t,"get",function(){return d}),s.d(t,"head",function(){return m}),s.d(t,"link",function(){return p}),s.d(t,"lock",function(){return g}),s.d(t,"merge",function(){return f}),s.d(t,"mkactivity",function(){return E}),s.d(t,"mkcalendar",function(){return _}),s.d(t,"mkcol",function(){return v}),s.d(t,"move",function(){return b}),s.d(t,"notify",function(){return y}),s.d(t,"options",function(){return w}),s.d(t,"patch",function(){return A}),s.d(t,"post",function(){return T}),s.d(t,"propfind",function(){return R}),s.d(t,"proppatch",function(){return M}),s.d(t,"purge",function(){return D}),s.d(t,"put",function(){return S}),s.d(t,"rebind",function(){return I}),s.d(t,"report",function(){return C}),s.d(t,"search",function(){return U}),s.d(t,"subscribe",function(){return N}),s.d(t,"trace",function(){return O}),s.d(t,"unbind",function(){return L}),s.d(t,"unlink",function(){return P}),s.d(t,"unlock",function(){return k}),s.d(t,"unsubscribe",function(){return G}),s.d(t,"brew",function(){return x});var i=s(2);t.default=i;const n=i.version,r=i.METHODS,o=i.acl,a=i.bind,l=i.checkout,h=i.connect,c=i.copy,u=i.delete,d=i.get,m=i.head,p=i.link,g=i.lock,f=i.merge,E=i.mkactivity,_=i.mkcalendar,v=i.mkcol,b=i.move,y=i.notify,w=i.options,A=i.patch,T=i.post,R=i.propfind,M=i.proppatch,D=i.purge,S=i.put,I=i.rebind,C=i.report,U=i.search,N=i.subscribe,O=i.trace,L=i.unbind,P=i.unlink,k=i.unlock,G=i.unsubscribe,x=i.brew},function(e,t){e.exports=i;var s=null;try{s=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch(e){}function i(e,t,s){this.low=0|e,this.high=0|t,this.unsigned=!!s}function n(e){return!0===(e&&e.__isLong__)}i.prototype.__isLong__,Object.defineProperty(i.prototype,"__isLong__",{value:!0}),i.isLong=n;var r={},o={};function a(e,t){var s,i,n;return t?(n=0<=(e>>>=0)&&e<256)&&(i=o[e])?i:(s=h(e,(0|e)<0?-1:0,!0),n&&(o[e]=s),s):(n=-128<=(e|=0)&&e<128)&&(i=r[e])?i:(s=h(e,e<0?-1:0,!1),n&&(r[e]=s),s)}function l(e,t){if(isNaN(e))return t?_:E;if(t){if(e<0)return _;if(e>=p)return A}else{if(e<=-g)return T;if(e+1>=g)return w}return e<0?l(-e,t).neg():h(e%m|0,e/m|0,t)}function h(e,t,s){return new i(e,t,s)}i.fromInt=a,i.fromNumber=l,i.fromBits=h;var c=Math.pow;function u(e,t,s){if(0===e.length)throw Error("empty string");if("NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return E;if("number"==typeof t?(s=t,t=!1):t=!!t,(s=s||10)<2||360)throw Error("interior hyphen");if(0===i)return u(e.substring(1),t,s).neg();for(var n=l(c(s,8)),r=E,o=0;o>>0:this.low},R.toNumber=function(){return this.unsigned?(this.high>>>0)*m+(this.low>>>0):this.high*m+(this.low>>>0)},R.toString=function(e){if((e=e||10)<2||36>>0).toString(e);if((r=a).isZero())return h+o;for(;h.length<6;)h="0"+h;o=""+h+o}},R.getHighBits=function(){return this.high},R.getHighBitsUnsigned=function(){return this.high>>>0},R.getLowBits=function(){return this.low},R.getLowBitsUnsigned=function(){return this.low>>>0},R.getNumBitsAbs=function(){if(this.isNegative())return this.eq(T)?64:this.neg().getNumBitsAbs();for(var e=0!=this.high?this.high:this.low,t=31;t>0&&0==(e&1<=0},R.isOdd=function(){return 1==(1&this.low)},R.isEven=function(){return 0==(1&this.low)},R.equals=function(e){return n(e)||(e=d(e)),(this.unsigned===e.unsigned||this.high>>>31!=1||e.high>>>31!=1)&&(this.high===e.high&&this.low===e.low)},R.eq=R.equals,R.notEquals=function(e){return!this.eq(e)},R.neq=R.notEquals,R.ne=R.notEquals,R.lessThan=function(e){return this.comp(e)<0},R.lt=R.lessThan,R.lessThanOrEqual=function(e){return this.comp(e)<=0},R.lte=R.lessThanOrEqual,R.le=R.lessThanOrEqual,R.greaterThan=function(e){return this.comp(e)>0},R.gt=R.greaterThan,R.greaterThanOrEqual=function(e){return this.comp(e)>=0},R.gte=R.greaterThanOrEqual,R.ge=R.greaterThanOrEqual,R.compare=function(e){if(n(e)||(e=d(e)),this.eq(e))return 0;var t=this.isNegative(),s=e.isNegative();return t&&!s?-1:!t&&s?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1},R.comp=R.compare,R.negate=function(){return!this.unsigned&&this.eq(T)?T:this.not().add(v)},R.neg=R.negate,R.add=function(e){n(e)||(e=d(e));var t=this.high>>>16,s=65535&this.high,i=this.low>>>16,r=65535&this.low,o=e.high>>>16,a=65535&e.high,l=e.low>>>16,c=0,u=0,m=0,p=0;return m+=(p+=r+(65535&e.low))>>>16,u+=(m+=i+l)>>>16,c+=(u+=s+a)>>>16,c+=t+o,h((m&=65535)<<16|(p&=65535),(c&=65535)<<16|(u&=65535),this.unsigned)},R.subtract=function(e){return n(e)||(e=d(e)),this.add(e.neg())},R.sub=R.subtract,R.multiply=function(e){if(this.isZero())return E;if(n(e)||(e=d(e)),s)return h(s.mul(this.low,this.high,e.low,e.high),s.get_high(),this.unsigned);if(e.isZero())return E;if(this.eq(T))return e.isOdd()?T:E;if(e.eq(T))return this.isOdd()?T:E;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(f)&&e.lt(f))return l(this.toNumber()*e.toNumber(),this.unsigned);var t=this.high>>>16,i=65535&this.high,r=this.low>>>16,o=65535&this.low,a=e.high>>>16,c=65535&e.high,u=e.low>>>16,m=65535&e.low,p=0,g=0,_=0,v=0;return _+=(v+=o*m)>>>16,g+=(_+=r*m)>>>16,_&=65535,g+=(_+=o*u)>>>16,p+=(g+=i*m)>>>16,g&=65535,p+=(g+=r*u)>>>16,g&=65535,p+=(g+=o*c)>>>16,p+=t*m+i*u+r*c+o*a,h((_&=65535)<<16|(v&=65535),(p&=65535)<<16|(g&=65535),this.unsigned)},R.mul=R.multiply,R.divide=function(e){if(n(e)||(e=d(e)),e.isZero())throw Error("division by zero");var t,i,r;if(s)return this.unsigned||-2147483648!==this.high||-1!==e.low||-1!==e.high?h((this.unsigned?s.div_u:s.div_s)(this.low,this.high,e.low,e.high),s.get_high(),this.unsigned):this;if(this.isZero())return this.unsigned?_:E;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return _;if(e.gt(this.shru(1)))return b;r=_}else{if(this.eq(T))return e.eq(v)||e.eq(y)?T:e.eq(T)?v:(t=this.shr(1).div(e).shl(1)).eq(E)?e.isNegative()?v:y:(i=this.sub(e.mul(t)),r=t.add(i.div(e)));else if(e.eq(T))return this.unsigned?_:E;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();r=E}for(i=this;i.gte(e);){t=Math.max(1,Math.floor(i.toNumber()/e.toNumber()));for(var o=Math.ceil(Math.log(t)/Math.LN2),a=o<=48?1:c(2,o-48),u=l(t),m=u.mul(e);m.isNegative()||m.gt(i);)m=(u=l(t-=a,this.unsigned)).mul(e);u.isZero()&&(u=v),r=r.add(u),i=i.sub(m)}return r},R.div=R.divide,R.modulo=function(e){return n(e)||(e=d(e)),s?h((this.unsigned?s.rem_u:s.rem_s)(this.low,this.high,e.low,e.high),s.get_high(),this.unsigned):this.sub(this.div(e).mul(e))},R.mod=R.modulo,R.rem=R.modulo,R.not=function(){return h(~this.low,~this.high,this.unsigned)},R.and=function(e){return n(e)||(e=d(e)),h(this.low&e.low,this.high&e.high,this.unsigned)},R.or=function(e){return n(e)||(e=d(e)),h(this.low|e.low,this.high|e.high,this.unsigned)},R.xor=function(e){return n(e)||(e=d(e)),h(this.low^e.low,this.high^e.high,this.unsigned)},R.shiftLeft=function(e){return n(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?h(this.low<>>32-e,this.unsigned):h(0,this.low<>>e|this.high<<32-e,this.high>>e,this.unsigned):h(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},R.shr=R.shiftRight,R.shiftRightUnsigned=function(e){if(n(e)&&(e=e.toInt()),0===(e&=63))return this;var t=this.high;return e<32?h(this.low>>>e|t<<32-e,t>>>e,this.unsigned):h(32===e?t:t>>>e-32,0,this.unsigned)},R.shru=R.shiftRightUnsigned,R.shr_u=R.shiftRightUnsigned,R.toSigned=function(){return this.unsigned?h(this.low,this.high,!1):this},R.toUnsigned=function(){return this.unsigned?this:h(this.low,this.high,!0)},R.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},R.toBytesLE=function(){var e=this.high,t=this.low;return[255&t,t>>>8&255,t>>>16&255,t>>>24,255&e,e>>>8&255,e>>>16&255,e>>>24]},R.toBytesBE=function(){var e=this.high,t=this.low;return[e>>>24,e>>>16&255,e>>>8&255,255&e,t>>>24,t>>>16&255,t>>>8&255,255&t]},i.fromBytes=function(e,t,s){return s?i.fromBytesLE(e,t):i.fromBytesBE(e,t)},i.fromBytesLE=function(e,t){return new i(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24,t)},i.fromBytesBE=function(e,t){return new i(e[4]<<24|e[5]<<16|e[6]<<8|e[7],e[0]<<24|e[1]<<16|e[2]<<8|e[3],t)}},function(e,t){class MessageEmbed{constructor(e,t){Object.defineProperty(this,"client",{value:e.client}),this.message=e,this.setup(t)}setup(e){if(this.type=e.type,this.title=e.title,this.description=e.description,this.url=e.url,this.color=e.color,this.fields=[],e.fields)for(const t of e.fields)this.fields.push(new MessageEmbedField(this,t));this.timestamp=e.timestamp,this.thumbnail=e.thumbnail?new MessageEmbedThumbnail(this,e.thumbnail):null,this.image=e.image?new MessageEmbedImage(this,e.image):null,this.video=e.video?new MessageEmbedVideo(this,e.video):null,this.author=e.author?new MessageEmbedAuthor(this,e.author):null,this.provider=e.provider?new MessageEmbedProvider(this,e.provider):null,this.footer=e.footer?new MessageEmbedFooter(this,e.footer):null}get createdAt(){return new Date(this.createdTimestamp)}get hexColor(){if(!this.color)return null;let e=this.color.toString(16);for(;e.length<6;)e=`0${e}`;return`#${e}`}}class MessageEmbedThumbnail{constructor(e,t){this.embed=e,this.setup(t)}setup(e){this.url=e.url,this.proxyURL=e.proxy_url,this.height=e.height,this.width=e.width}}class MessageEmbedImage{constructor(e,t){this.embed=e,this.setup(t)}setup(e){this.url=e.url,this.proxyURL=e.proxy_url,this.height=e.height,this.width=e.width}}class MessageEmbedVideo{constructor(e,t){this.embed=e,this.setup(t)}setup(e){this.url=e.url,this.height=e.height,this.width=e.width}}class MessageEmbedProvider{constructor(e,t){this.embed=e,this.setup(t)}setup(e){this.name=e.name,this.url=e.url}}class MessageEmbedAuthor{constructor(e,t){this.embed=e,this.setup(t)}setup(e){this.name=e.name,this.url=e.url,this.iconURL=e.icon_url}}class MessageEmbedField{constructor(e,t){this.embed=e,this.setup(t)}setup(e){this.name=e.name,this.value=e.value,this.inline=e.inline}}class MessageEmbedFooter{constructor(e,t){this.embed=e,this.setup(t)}setup(e){this.text=e.text,this.iconURL=e.icon_url,this.proxyIconUrl=e.proxy_icon_url}}MessageEmbed.Thumbnail=MessageEmbedThumbnail,MessageEmbed.Image=MessageEmbedImage,MessageEmbed.Video=MessageEmbedVideo,MessageEmbed.Provider=MessageEmbedProvider,MessageEmbed.Author=MessageEmbedAuthor,MessageEmbed.Field=MessageEmbedField,MessageEmbed.Footer=MessageEmbedFooter,e.exports=MessageEmbed},function(e,t,s){(function(t){const i=s(25),n=s(48),r=s(30),o=s(0),a=s(5).convertToBuffer,l=s(10),h=s(20),c=s(27),u=s(12),d=s(22),m=s(21),p=s(26),g=s(9);e.exports=class ClientDataResolver{constructor(e){this.client=e}resolveUser(e){return e instanceof l?e:"string"==typeof e?this.client.users.get(e)||null:e instanceof d?e.user:e instanceof h?e.author:e instanceof c?this.resolveUser(e.ownerID):null}resolveUserID(e){return e instanceof l||e instanceof d?e.id:"string"==typeof e?e||null:e instanceof h?e.author.id:e instanceof c?e.ownerID:null}resolveGuild(e){return e instanceof c?e:"string"==typeof e&&this.client.guilds.get(e)||null}resolveGuildMember(e,t){return t instanceof d?t:(e=this.resolveGuild(e),t=this.resolveUser(t),e&&t&&e.members.get(t.id)||null)}resolveRole(e,t){return t instanceof g?t:(e=this.resolveGuild(e))&&"string"==typeof t?e.roles.get(t):null}resolveChannel(e){return e instanceof u?e:"string"==typeof e?this.client.channels.get(e)||null:e instanceof h?e.channel:e instanceof c&&e.channels.get(e.id)||null}resolveChannelID(e){return e instanceof u?e.id:"string"==typeof e?e:e instanceof h?e.channel.id:e instanceof c?e.defaultChannel.id:null}resolveInviteCode(e){const t=/discord(?:app\.com\/invite|\.gg(?:\/invite)?)\/([\w-]{2,255})/i.exec(e);return t&&t[1]?t[1]:e}resolveString(e){return"string"==typeof e?e:e instanceof Array?e.join("\n"):String(e)}resolveImage(e){return e?"string"==typeof e&&e.startsWith("data:")?Promise.resolve(e):this.resolveFile(e).then(this.resolveBase64):Promise.resolve(null)}resolveBase64(e){return e instanceof t?`data:image/jpg;base64,${e.toString("base64")}`:e}resolveFile(e){return e instanceof t?Promise.resolve(e):this.client.browser&&e instanceof ArrayBuffer?Promise.resolve(a(e)):"string"==typeof e?/^https?:\/\//.test(e)?r.get(e).then(e=>e.body instanceof t?e.body:t.from(e.text)):new Promise((t,s)=>{const r=i.resolve(e);n.stat(r,(e,i)=>e?s(e):i&&i.isFile()?(n.readFile(r,(e,i)=>{e?s(e):t(i)}),null):s(new Error(`The file could not be found: ${r}`)))}):e&&e.pipe&&"function"==typeof e.pipe?new Promise((s,i)=>{const n=[];e.once("error",i),e.on("data",e=>n.push(e)),e.once("end",()=>s(t.concat(n)))}):Promise.reject(new TypeError("The resource must be a string or Buffer."))}resolveEmojiIdentifier(e){return e instanceof m||e instanceof p?e.identifier:"string"==typeof e?this.client.emojis.has(e)?this.client.emojis.get(e).identifier:e.includes("%")?e:encodeURIComponent(e):null}static resolveColor(e){if("string"==typeof e){if("RANDOM"===e)return Math.floor(16777216*Math.random());if("DEFAULT"===e)return 0;e=o.Colors[e]||parseInt(e.replace("#",""),16)}else e instanceof Array&&(e=(e[0]<<16)+(e[1]<<8)+e[2]);if(e<0||e>16777215)throw new RangeError("Color must be within the range 0 - 16777215 (0xFFFFFF).");if(e&&isNaN(e))throw new TypeError("Unable to convert color to a number.");return e}resolveColor(e){return this.constructor.resolveColor(e)}}}).call(this,s(15).Buffer)},function(e,t,s){const i=s(4),n=s(17).EventEmitter;e.exports=class Collector extends n{constructor(e,t,s={}){super(),Object.defineProperty(this,"client",{value:e}),this.filter=t,this.options=s,this.collected=new i,this.ended=!1,this._timeout=null,this._idletimeout=null,this.listener=this._handle.bind(this),s.time&&(this._timeout=this.client.setTimeout(()=>this.stop("time"),s.time)),s.idle&&(this._idletimeout=this.client.setTimeout(()=>this.stop("idle"),s.idle))}_handle(...e){const t=this.handle(...e);t&&this.filter(...e,this.collected)&&(this.collected.set(t.key,t.value),this.emit("collect",t.value,this),this._idletimeout&&(this.client.clearTimeout(this._idletimeout),this._idletimeout=this.client.setTimeout(()=>this.stop("idle"),this.options.idle)));const s=this.postCheck(...e);s&&this.stop(s)}get next(){return new Promise((e,t)=>{if(this.ended)return void t(this.collected);const s=()=>{this.removeListener("collect",i),this.removeListener("end",n)},i=t=>{s(),e(t)},n=()=>{s(),t(this.collected)};this.on("collect",i),this.on("end",n)})}stop(e="user"){this.ended||(this._timeout&&(this.client.clearTimeout(this._timeout),this._timeout=null),this._idletimeout&&(this.client.clearTimeout(this._idletimeout),this._idletimeout=null),this.ended=!0,this.cleanup(),this.emit("end",this.collected,e))}handle(){}postCheck(){}cleanup(){}}},function(e,t,s){const i=s(23);class MessageFlags extends i{}MessageFlags.FLAGS={CROSSPOSTED:1,IS_CROSSPOST:2,SUPPRESS_EMBEDS:4,SOURCE_MESSAGE_DELETED:8,URGENT:16},e.exports=MessageFlags},function(e,t){e.exports=class Integration{constructor(e,t,s){Object.defineProperty(this,"client",{value:e}),this.guild=s,this.id=t.id,this.name=t.name,this.type=t.type,this.enabled=t.enabled,this.syncing=t.syncing,this.role=this.guild.roles.get(t.role_id),this.user=this.client.dataManager.newUser(t.user),this.account=t.account,this.syncedAt=t.synced_at,this._patch(t)}_patch(e){this.expireBehavior=e.expire_behavior,this.expireGracePeriod=e.expire_grace_period}sync(){return this.syncing=!0,this.client.rest.methods.syncIntegration(this).then(()=>(this.syncing=!1,this.syncedAt=Date.now(),this))}edit(e,t){return"expireBehavior"in e&&(e.expire_behavior=e.expireBehavior,e.expireBehavior=void 0),"expireGracePeriod"in e&&(e.expire_grace_period=e.expireGracePeriod,e.expireGracePeriod=void 0),this.client.rest.methods.editIntegration(this,e,t).then(()=>(this._patch(e),this))}delete(e){return this.client.rest.methods.deleteIntegration(this,e).then(()=>this)}}},function(e,t,s){const i=s(6),n=s(84),r=s(8);class OAuth2Application{constructor(e,t){Object.defineProperty(this,"client",{value:e}),this.setup(t)}setup(e){this.id=e.id,this.name=e.name,this.description=e.description,this.icon=e.icon,this.iconURL=`https://cdn.discordapp.com/app-icons/${this.id}/${this.icon}.jpg`,this.rpcOrigins=e.rpc_origins,this.redirectURIs=e.redirect_uris,this.botRequireCodeGrant=e.bot_require_code_grant,this.botPublic=e.bot_public,this.rpcApplicationState=e.rpc_application_state,this.bot=e.bot,this.flags=e.flags,this.secret=e.secret,e.owner&&(this.owner=this.client.dataManager.newUser(e.owner)),this.team=e.team?new n(this.client,e.team):null}get createdTimestamp(){return i.deconstruct(this.id).timestamp}get createdAt(){return new Date(this.createdTimestamp)}reset(){return this.client.rest.methods.resetApplication(this.id)}toString(){return this.name}}OAuth2Application.prototype.reset=r.deprecate(OAuth2Application.prototype.reset,"OAuth2Application#reset: userbot methods will be removed"),e.exports=OAuth2Application},function(e,t,s){const i=s(12),n=s(19),r=s(4),o=s(0);class GroupDMChannel extends i{constructor(e,t){super(e,t),this.type="group",this.messages=new r,this._typing=new Map}setup(e){if(super.setup(e),this.name=e.name,this.icon=e.icon,this.ownerID=e.owner_id,this.managed=e.managed,this.applicationID=e.application_id,e.nicks&&(this.nicks=new r(e.nicks.map(e=>[e.id,e.nick]))),this.recipients||(this.recipients=new r),e.recipients)for(const t of e.recipients){const e=this.client.dataManager.newUser(t);this.recipients.set(e.id,e)}this.lastMessageID=e.last_message_id,this.lastPinTimestamp=e.last_pin_timestamp?new Date(e.last_pin_timestamp).getTime():null}get owner(){return this.client.users.get(this.ownerID)}get iconURL(){return this.icon?o.Endpoints.Channel(this).Icon(this.client.options.http.cdn,this.icon):null}edit(e){const t={};return e.name&&(t.name=e.name),void 0!==e.icon&&(t.icon=e.icon),this.client.rest.methods.updateGroupDMChannel(this,t)}equals(e){const t=e&&this.id===e.id&&this.name===e.name&&this.icon===e.icon&&this.ownerID===e.ownerID;return t?this.recipients.equals(e.recipients):t}addUser(e,t){return this.client.rest.methods.addUserToGroupDM(this,{nick:t,id:this.client.resolver.resolveUserID(e),accessToken:e})}setIcon(e){return this.client.resolver.resolveImage(e).then(e=>this.edit({icon:e}))}setName(e){return this.edit({name:e})}removeUser(e){const t=this.client.resolver.resolveUserID(e);return this.client.rest.methods.removeUserFromGroupDM(this,t)}toString(){return this.name}get lastPinAt(){}send(){}sendMessage(){}sendEmbed(){}sendFile(){}sendFiles(){}sendCode(){}fetchMessage(){}fetchMessages(){}fetchPinnedMessages(){}search(){}startTyping(){}stopTyping(){}get typing(){}get typingCount(){}createCollector(){}createMessageCollector(){}awaitMessages(){}acknowledge(){}_cacheMessage(){}}n.applyToClass(GroupDMChannel,!0,["bulkDelete"]),e.exports=GroupDMChannel},function(e,t){e.exports=class DiscordAPIError extends Error{constructor(e,t,s){super();const i=this.constructor.flattenErrors(t.errors||t).join("\n");this.name="DiscordAPIError",this.message=t.message&&i?`${t.message}\n${i}`:t.message||i,this.path=e,this.code=t.code,this.method=s}static flattenErrors(e,t=""){let s=[];for(const i of Object.keys(e)){if("message"===i)continue;const n=t?isNaN(i)?`${t}.${i}`:`${t}[${i}]`:i;e[i]._errors?s.push(`${n}: ${e[i]._errors.map(e=>e.message).join(" ")}`):e[i].code||e[i].message?s.push(`${e[i].code?`${e[i].code}: `:""}: ${e[i].message}`.trim()):"string"==typeof e[i]?s.push(e[i]):s=s.concat(this.flattenErrors(e[i],n))}return s}}},function(e,t,s){const i=s(14),n=s(4),r=s(7);e.exports=class VoiceChannel extends i{constructor(e,t){super(e,t),this.members=new n,this.type="voice"}setup(e){super.setup(e),this.bitrate=.001*e.bitrate,this.userLimit=e.user_limit}get connection(){const e=this.guild.voiceConnection;return e&&e.channel.id===this.id?e:null}get full(){return this.userLimit>0&&this.members.size>=this.userLimit}get deletable(){return super.deletable&&this.permissionsFor(this.client.user).has(r.FLAGS.CONNECT)}get joinable(){return!(this.client.browser||!this.permissionsFor(this.client.user).has("CONNECT")||this.full&&!this.permissionsFor(this.client.user).has("MOVE_MEMBERS"))}get speakable(){return this.permissionsFor(this.client.user).has("SPEAK")}setBitrate(e,t){return e*=1e3,this.edit({bitrate:e},t)}setUserLimit(e,t){return this.edit({userLimit:e},t)}join(){return this.client.browser?Promise.reject(new Error("Voice connections are not available in browsers.")):this.client.voice.joinChannel(this)}leave(){if(this.client.browser)return;const e=this.client.voice.connections.get(this.guild.id);e&&e.channel.id===this.id&&e.disconnect()}}},function(e,t,s){const i=s(14);e.exports=class CategoryChannel extends i{constructor(e,t){super(e,t),this.type="category"}get children(){return this.guild.channels.filter(e=>e.parentID===this.id)}}},function(e,t,s){const i=s(29);e.exports=class NewsChannel extends i{constructor(e,t){super(e,t),this.type="news"}setup(e){super.setup(e),this.rateLimitPerUser=0}}},function(e,t,s){const i=s(14);e.exports=class StoreChannel extends i{constructor(e,t){super(e,t),this.type="store"}setup(e){super.setup(e),this.nsfw=e.nsfw}}},function(e,t,s){const i=s(12),n=s(19),r=s(4);class DMChannel extends i{constructor(e,t){super(e,t),this.type="dm",this.messages=new r,this._typing=new Map}setup(e){super.setup(e),this.recipient=this.client.dataManager.newUser(e.recipients[0]),this.lastMessageID=e.last_message_id,this.lastPinTimestamp=e.last_pin_timestamp?new Date(e.last_pin_timestamp).getTime():null}toString(){return this.recipient.toString()}get lastPinAt(){}send(){}sendMessage(){}sendEmbed(){}sendFile(){}sendFiles(){}sendCode(){}fetchMessage(){}fetchMessages(){}fetchPinnedMessages(){}search(){}startTyping(){}stopTyping(){}get typing(){}get typingCount(){}createCollector(){}createMessageCollector(){}awaitMessages(){}acknowledge(){}_cacheMessage(){}}n.applyToClass(DMChannel,!0,["bulkDelete"]),e.exports=DMChannel},function(e,t,s){"use strict";t.decode=t.parse=s(71),t.encode=t.stringify=s(72)},function(e){e.exports=JSON.parse('{"name":"discord.js","version":"11.6.0","description":"A powerful library for interacting with the Discord API","main":"./src/index","types":"./typings/index.d.ts","scripts":{"test":"npm run lint && npm run docs:test","docs":"docgen --source src --custom docs/index.yml --output docs/docs.json","docs:test":"docgen --source src --custom docs/index.yml","lint":"eslint src","lint:fix":"eslint --fix src","lint:typings":"tslint typings/index.d.ts typings/discord.js-test.ts","webpack":"parallel-webpack"},"repository":{"type":"git","url":"git+https://github.com/discordjs/discord.js.git"},"keywords":["discord","api","bot","client","node","discordapp"],"author":"Amish Shah ","license":"Apache-2.0","bugs":{"url":"https://github.com/discordjs/discord.js/issues"},"homepage":"https://github.com/discordjs/discord.js#readme","runkitExampleFilename":"./docs/examples/ping.js","dependencies":{"long":"^4.0.0","prism-media":"^0.0.4","snekfetch":"^3.6.4","tweetnacl":"^1.0.0","ws":"^6.0.0"},"peerDependencies":{"@discordjs/uws":"^10.149.0","bufferutil":"^4.0.0","erlpack":"discordapp/erlpack","libsodium-wrappers":"^0.7.3","@discordjs/opus":"^0.1.0","node-opus":"^0.2.7","opusscript":"^0.0.6","sodium":"^2.0.3"},"peerDependenciesMeta":{"bufferutil":{"optional":true},"erlpack":{"optional":true},"@discordjs/opus":{"optional":true},"node-opus":{"optional":true},"opusscript":{"optional":true},"sodium":{"optional":true},"libsodium-wrappers":{"optional":true},"uws":{"optional":true}},"devDependencies":{"@types/node":"^9.4.6","discord.js-docgen":"discordjs/docgen","eslint":"^5.4.0","parallel-webpack":"^2.3.0","tslint":"^3.15.1","tslint-config-typings":"^0.2.4","typescript":"^3.0.1","uglifyjs-webpack-plugin":"^1.3.0","webpack":"^4.17.0"},"engines":{"node":">=6.0.0"},"browser":{"ws":false,"uws":false,"@discordjs/uws":false,"erlpack":false,"prism-media":false,"opusscript":false,"node-opus":false,"@discordjs/opus":false,"tweetnacl":false,"sodium":false,"src/sharding/Shard.js":false,"src/sharding/ShardClientUtil.js":false,"src/sharding/ShardingManager.js":false,"src/client/voice/dispatcher/StreamDispatcher.js":false,"src/client/voice/opus/BaseOpusEngine.js":false,"src/client/voice/opus/NodeOpusEngine.js":false,"src/client/voice/opus/DiscordJsOpusEngine.js":false,"src/client/voice/opus/OpusEngineList.js":false,"src/client/voice/opus/OpusScriptEngine.js":false,"src/client/voice/pcm/ConverterEngine.js":false,"src/client/voice/pcm/ConverterEngineList.js":false,"src/client/voice/pcm/FfmpegConverterEngine.js":false,"src/client/voice/player/AudioPlayer.js":false,"src/client/voice/receiver/VoiceReadable.js":false,"src/client/voice/receiver/VoiceReceiver.js":false,"src/client/voice/util/Secretbox.js":false,"src/client/voice/util/SecretKey.js":false,"src/client/voice/util/VolumeInterface.js":false,"src/client/voice/ClientVoiceManager.js":false,"src/client/voice/VoiceBroadcast.js":false,"src/client/voice/VoiceConnection.js":false,"src/client/voice/VoiceUDPClient.js":false,"src/client/voice/VoiceWebSocket.js":false}}')},function(e,t,s){const i=s(79),n=s(80),r=s(87),o=s(88),a=s(89),l=s(0);e.exports=class RESTManager{constructor(e){this.client=e,this.handlers={},this.userAgentManager=new i(this),this.methods=new n(this),this.rateLimitedEndpoints={},this.globallyRateLimited=!1}destroy(){for(const e of Object.keys(this.handlers)){const t=this.handlers[e];t.destroy&&t.destroy()}}push(e,t){return new Promise((s,i)=>{e.push({request:t,resolve:s,reject:i,retries:0})})}getRequestHandler(){switch(this.client.options.apiRequestMethod){case"sequential":return r;case"burst":return o;default:throw new Error(l.Errors.INVALID_RATE_LIMIT_METHOD)}}makeRequest(e,t,s,i,n,r){const o=new a(this,e,t,s,i,n,r);if(!this.handlers[o.route]){const e=this.getRequestHandler();this.handlers[o.route]=new e(this,o.route)}return this.push(this.handlers[o.route],o)}}},function(e,t){},function(e,t,s){const i=s(4),{ChannelTypes:n}=s(0);class MessageMentions{constructor(e,t,s,r,o){if(this.everyone=Boolean(r),t)if(t instanceof i)this.users=new i(t);else{this.users=new i;for(const s of t){let t=e.client.users.get(s.id);t||(t=e.client.dataManager.newUser(s)),this.users.set(t.id,t),s.member&&e.guild&&!e.guild.members.has(s.id)&&e.guild._addMember(Object.assign(s.member,{user:t}),!1)}}else this.users=new i;if(s)if(s instanceof i)this.roles=new i(s);else{this.roles=new i;for(const t of s){const s=e.channel.guild.roles.get(t);s&&this.roles.set(s.id,s)}}else this.roles=new i;if(this._content=e.content,this._client=e.client,this._guild=e.channel.guild,this._members=null,this._channels=null,o)if(o instanceof i)this.crosspostedChannels=new i(o);else{this.crosspostedChannels=new i;const e=Object.keys(n);for(const t of o){const s=e[t.type];this.crosspostedChannels.set(t.id,{channelID:t.id,guildID:t.guild_id,type:s?s.toLowerCase():"unknown",name:t.name})}}else this.crosspostedChannels=new i}get members(){return this._members?this._members:this._guild?(this._members=new i,this.users.forEach(e=>{const t=this._guild.member(e);t&&this._members.set(t.user.id,t)}),this._members):null}get channels(){if(this._channels)return this._channels;let e;for(this._channels=new i;null!==(e=this.constructor.CHANNELS_PATTERN.exec(this._content));){const t=this._client.channels.get(e[1]);t&&this._channels.set(t.id,t)}return this._channels}}MessageMentions.EVERYONE_PATTERN=/@(everyone|here)/g,MessageMentions.USERS_PATTERN=/<@!?[0-9]+>/g,MessageMentions.ROLES_PATTERN=/<@&[0-9]+>/g,MessageMentions.CHANNELS_PATTERN=/<#([0-9]+)>/g,e.exports=MessageMentions},function(e,t,s){const{basename:i}=s(25);e.exports=class MessageAttachment{constructor(e,t){Object.defineProperty(this,"client",{value:e.client}),this.message=e,this.setup(t)}setup(e){this.id=e.id,this.filename=e.filename,this.filesize=e.size,this.url=e.url,this.proxyURL=e.proxy_url,this.height=e.height,this.width=e.width}get spoiler(){return i(this.url).startsWith("SPOILER_")}}},function(e,t,s){const i=s(4),n=s(21),r=s(26);e.exports=class MessageReaction{constructor(e,t,s,n){this.message=e,this.me=n,this.count=s||0,this.users=new i,this._emoji=new r(this,t)}get emoji(){if(this._emoji instanceof n)return this._emoji;if(this._emoji.id){const e=this.message.client.emojis;if(e.has(this._emoji.id)){const t=e.get(this._emoji.id);return this._emoji=t,t}}return this._emoji}remove(e=this.message.client.user){const t=this.message,s=this.message.client.resolver.resolveUserID(e);return s?t.client.rest.methods.removeMessageReaction(t,this.emoji.identifier,s):Promise.reject(new Error("Couldn't resolve the user ID to remove from the reaction."))}removeAll(){const e=this.message;return e.client.rest.methods.removeMessageReactionEmoji(e,this.emoji.identifier)}fetchUsers(e=100,{after:t,before:s}={}){const n=this.message;return n.client.rest.methods.getMessageReactionUsers(n,this.emoji.identifier,{after:t,before:s,limit:e}).then(e=>{const t=new i;for(const s of e){const e=this.message.client.dataManager.newUser(s);this.users.set(e.id,e),t.set(e.id,e)}return t})}}},function(e,t,s){const i=s(34),n=s(4);e.exports=class ReactionCollector extends i{constructor(e,t,s={}){super(e.client,t,s),this.message=e,this.users=new n,this.total=0,0!==this.client.getMaxListeners()&&this.client.setMaxListeners(this.client.getMaxListeners()+1),this.client.on("messageReactionAdd",this.listener)}handle(e){return e.message.id!==this.message.id?null:{key:e.emoji.id||e.emoji.name,value:e}}postCheck(e,t){return this.users.set(t.id,t),this.options.max&&++this.total>=this.options.max?"limit":this.options.maxEmojis&&this.collected.size>=this.options.maxEmojis?"emojiLimit":this.options.maxUsers&&this.users.size>=this.options.maxUsers?"userLimit":null}cleanup(){this.client.removeListener("messageReactionAdd",this.listener),0!==this.client.getMaxListeners()&&this.client.setMaxListeners(this.client.getMaxListeners()-1)}}},function(e,t,s){const i=s(34),n=s(8);e.exports=class MessageCollector extends i{constructor(e,t,s={}){super(e.client,t,s),this.channel=e,this.received=0,0!==this.client.getMaxListeners()&&this.client.setMaxListeners(this.client.getMaxListeners()+1),this.client.on("message",this.listener),this._reEmitter=(e=>{this.emit("message",e)}),this.on("collect",this._reEmitter)}on(e,t){"message"===e&&(t=n.deprecate(t,'MessageCollector will soon no longer emit "message", use "collect" instead')),super.on(e,t)}handle(e){return e.channel.id!==this.channel.id?null:(this.received++,{key:e.id,value:e})}postCheck(){return this.options.maxMatches&&this.collected.size>=this.options.maxMatches?"matchesLimit":this.options.max&&this.received>=this.options.max?"limit":null}cleanup(){this.removeListener("collect",this._reEmitter),this.client.removeListener("message",this.listener),0!==this.client.getMaxListeners()&&this.client.setMaxListeners(this.client.getMaxListeners()-1)}}},function(e,t,s){const i=s(23);class SystemChannelFlags extends i{}SystemChannelFlags.FLAGS={WELCOME_MESSAGE_DISABLED:1,BOOST_MESSAGE_DISABLED:2},e.exports=SystemChannelFlags},function(e,t){e.exports=class PartialGuild{constructor(e,t){Object.defineProperty(this,"client",{value:e}),this.setup(t)}setup(e){this.id=e.id,this.name=e.name,this.icon=e.icon,this.splash=e.splash}}},function(e,t,s){const i=s(0);e.exports=class PartialGuildChannel{constructor(e,t){Object.defineProperty(this,"client",{value:e}),this.setup(t)}setup(e){this.id=e.id,this.name=e.name,this.type=i.ChannelTypes.TEXT===e.type?"text":"voice"}}},function(e,t,s){const i=s(4),n=s(6),r=s(28),o=s(36),a=s(13),l={ALL:"ALL",GUILD:"GUILD",CHANNEL:"CHANNEL",USER:"USER",ROLE:"ROLE",INVITE:"INVITE",WEBHOOK:"WEBHOOK",EMOJI:"EMOJI",MESSAGE:"MESSAGE",INTEGRATION:"INTEGRATION",UNKNOWN:"UNKNOWN"},h={ALL:null,GUILD_UPDATE:1,CHANNEL_CREATE:10,CHANNEL_UPDATE:11,CHANNEL_DELETE:12,CHANNEL_OVERWRITE_CREATE:13,CHANNEL_OVERWRITE_UPDATE:14,CHANNEL_OVERWRITE_DELETE:15,MEMBER_KICK:20,MEMBER_PRUNE:21,MEMBER_BAN_ADD:22,MEMBER_BAN_REMOVE:23,MEMBER_UPDATE:24,MEMBER_ROLE_UPDATE:25,MEMBER_MOVE:26,MEMBER_DISCONNECT:27,BOT_ADD:28,ROLE_CREATE:30,ROLE_UPDATE:31,ROLE_DELETE:32,INVITE_CREATE:40,INVITE_UPDATE:41,INVITE_DELETE:42,WEBHOOK_CREATE:50,WEBHOOK_UPDATE:51,WEBHOOK_DELETE:52,EMOJI_CREATE:60,EMOJI_UPDATE:61,EMOJI_DELETE:62,MESSAGE_DELETE:72,MESSAGE_BULK_DELETE:73,MESSAGE_PIN:74,MESSAGE_UNPIN:75,INTEGRATION_CREATE:80,INTEGRATION_UPDATE:81,INTEGRATION_DELETE:82};class GuildAuditLogs{constructor(e,t){if(t.users)for(const s of t.users)e.client.dataManager.newUser(s);if(this.webhooks=new i,t.webhooks)for(const s of t.webhooks)this.webhooks.set(s.id,new r(e.client,s));if(this.integrations=new i,t.integrations)for(const s of t.integrations)this.integrations.set(s.id,new o(e.client,s,e));this.entries=new i;for(const s of t.audit_log_entries){const t=new GuildAuditLogsEntry(this,e,s);this.entries.set(t.id,t)}}static build(...e){const t=new GuildAuditLogs(...e);return Promise.all(t.entries.map(e=>e.target)).then(()=>t)}static targetType(e){return e<10?l.GUILD:e<20?l.CHANNEL:e<30?l.USER:e<40?l.ROLE:e<50?l.INVITE:e<60?l.WEBHOOK:e<70?l.EMOJI:e<80?l.MESSAGE:e<90?l.INTEGRATION:null}static actionType(e){return[h.CHANNEL_CREATE,h.CHANNEL_OVERWRITE_CREATE,h.MEMBER_BAN_REMOVE,h.BOT_ADD,h.ROLE_CREATE,h.INVITE_CREATE,h.WEBHOOK_CREATE,h.EMOJI_CREATE,h.MESSAGE_PIN,h.INTEGRATION_CREATE].includes(e)?"CREATE":[h.CHANNEL_DELETE,h.CHANNEL_OVERWRITE_DELETE,h.MEMBER_KICK,h.MEMBER_PRUNE,h.MEMBER_BAN_ADD,h.MEMBER_DISCONNECT,h.ROLE_DELETE,h.INVITE_DELETE,h.WEBHOOK_DELETE,h.EMOJI_DELETE,h.MESSAGE_DELETE,h.MESSAGE_BULK_DELETE,h.MESSAGE_UNPIN,h.INTEGRATION_DELETE].includes(e)?"DELETE":[h.GUILD_UPDATE,h.CHANNEL_UPDATE,h.CHANNEL_OVERWRITE_UPDATE,h.MEMBER_UPDATE,h.MEMBER_ROLE_UPDATE,h.MEMBER_MOVE,h.ROLE_UPDATE,h.INVITE_UPDATE,h.WEBHOOK_UPDATE,h.EMOJI_UPDATE,h.INTEGRATION_UPDATE].includes(e)?"UPDATE":"ALL"}}class GuildAuditLogsEntry{constructor(e,t,s){const i=GuildAuditLogs.targetType(s.action_type);switch(this.targetType=i,this.actionType=GuildAuditLogs.actionType(s.action_type),this.action=Object.keys(h).find(e=>h[e]===s.action_type),this.reason=s.reason||null,this.executor=t.client.users.get(s.user_id),this.changes=s.changes?s.changes.map(e=>({key:e.key,old:e.old_value,new:e.new_value})):null,this.id=s.id,this.extra=null,s.action_type){case h.MEMBER_PRUNE:this.extra={removed:Number(s.options.members_removed),days:Number(s.options.delete_member_days)};break;case h.MEMBER_MOVE:case h.MESSAGE_DELETE:case h.MESSAGE_BULK_DELETE:this.extra={channel:t.channels.get(s.options.channel_id)||{id:s.options.channel_id},count:Number(s.options.count)};break;case h.MESSAGE_PIN:case h.MESSAGE_UNPIN:this.extra={channel:t.client.channels.get(s.options.channel_id)||{id:s.options.channel_id},messageID:s.options.message_id};break;case h.MEMBER_DISCONNECT:this.extra={count:Number(s.options.count)};break;case h.CHANNEL_OVERWRITE_CREATE:case h.CHANNEL_OVERWRITE_UPDATE:case h.CHANNEL_OVERWRITE_DELETE:switch(s.options.type){case"member":this.extra=t.members.get(s.options.id)||{id:s.options.id,type:"member"};break;case"role":this.extra=t.roles.get(s.options.id)||{id:s.options.id,name:s.options.role_name,type:"role"}}}if(this.target=null,i===l.UNKNOWN)this.changes.reduce((e,t)=>(e[t.key]=t.new||t.old,e),{}),this.target.id=s.target_id;else if(i===l.USER&&s.target_id)this.target=t.client.users.get(s.target_id);else if(i===l.GUILD)this.target=t.client.guilds.get(s.target_id);else if(i===l.WEBHOOK)this.target=e.webhooks.get(s.target_id)||new r(t.client,this.changes.reduce((e,t)=>(e[t.key]=t.new||t.old,e),{id:s.target_id,guild_id:t.id}));else if(i===l.INVITE){const e=this.changes.reduce((e,t)=>(e[t.key]=t.new||t.old,e),{id:s.target_id,guild:t});e.channel={id:e.channel_id},this.target=new a(t.client,e)}else i===l.MESSAGE?this.target=s.action_type===h.MESSAGE_BULK_DELETE?t.channels.get(s.target_id)||{id:s.target_id}:t.client.users.get(s.target_id):i===l.INTEGRATION?this.target=e.integrations.get(s.target_id)||new o(t.client,this.changes.reduce((e,t)=>(e[t.key]=t.new||t.old,e),{id:s.target_id}),t):s.target_id&&(this.target=t[`${i.toLowerCase()}s`].get(s.target_id)||{id:s.target_id})}get createdTimestamp(){return n.deconstruct(this.id).timestamp}get createdAt(){return new Date(this.createdTimestamp)}}GuildAuditLogs.Actions=h,GuildAuditLogs.Targets=l,GuildAuditLogs.Entry=GuildAuditLogsEntry,e.exports=GuildAuditLogs},function(e,t){e.exports=class RequestHandler{constructor(e){this.restManager=e,this.queue=[]}get globalLimit(){return this.restManager.globallyRateLimited}set globalLimit(e){this.restManager.globallyRateLimited=e}push(e){this.queue.push(e)}handle(){}destroy(){this.queue=[]}}},function(e,t,s){const i=s(7);e.exports=class PermissionOverwrites{constructor(e,t){Object.defineProperty(this,"channel",{value:e}),t&&this.setup(t)}setup(e){this.id=e.id,this.type=e.type,this.deny=e.deny,this.allow=e.allow,this.denied=new i(e.deny).freeze(),this.allowed=new i(e.allow).freeze()}delete(e){return this.channel.client.rest.methods.deletePermissionOverwrites(this,e)}}},function(e,t,s){(function(t){const i="undefined"!=typeof window,n=s(17),r=s(0),o=s(48),a=s(92),l=function(){try{const e=s(136);return e.pack?e:null}catch(e){return null}}(),h=function e(){if(i)return window.WebSocket;try{const t=s(137);return((e,...t)=>console.warn("uws support is being removed in the next version of discord.js",t))(0,"DeprecationWarning",e),t}catch(e){return s(138)}}();class WebSocketConnection extends n{constructor(e,t){super(),this.manager=e,this.client=e.client,this.ws=null,this.sequence=-1,this.status=r.Status.IDLE,this.packetManager=new a(this),this.lastPingTimestamp=0,this.ratelimit={queue:[],remaining:120,total:120,time:6e4,resetTimer:null},this.connect(t),this.disabledEvents={},this.closeSequence=0,this.expectingClose=!1;for(const e of this.client.options.disabledEvents)this.disabledEvents[e]=!0}triggerReady(){this.status!==r.Status.READY?(this.status=r.Status.READY,this.client.emit(r.Events.READY),this.packetManager.handleQueue()):this.debug("Tried to mark self as ready, but already ready")}checkIfReady(){if(this.status===r.Status.READY||this.status===r.Status.NEARLY)return!1;let e=0;for(const t of this.client.guilds.values())t.available||e++;if(0===e){if(this.status=r.Status.NEARLY,!this.client.options.fetchAllMembers)return this.triggerReady();const e=this.client.guilds.map(e=>e.fetchMembers());Promise.all(e).then(()=>this.triggerReady()).catch(e=>{this.debug(`Failed to fetch all members before ready! ${e}`),this.triggerReady()})}return!0}debug(e){return e instanceof Error&&(e=e.stack),this.manager.debug(`[connection] ${e}`)}unpack(e){return e instanceof ArrayBuffer&&(e=t.from(new Uint8Array(e))),l&&"string"!=typeof e?l.unpack(e):(e instanceof t&&(e=o.inflateSync(e).toString()),JSON.parse(e))}pack(e){return l?l.pack(e):JSON.stringify(e)}processQueue(){if(0!==this.ratelimit.remaining&&0!==this.ratelimit.queue.length)for(this.ratelimit.remaining===this.ratelimit.total&&(this.ratelimit.resetTimer=this.client.setTimeout(()=>{this.ratelimit.remaining=this.ratelimit.total,this.processQueue()},this.ratelimit.time));this.ratelimit.remaining>0;){const e=this.ratelimit.queue.shift();if(!e)return;this._send(e),this.ratelimit.remaining--}}_send(e){this.ws&&this.ws.readyState===h.OPEN?this.ws.send(this.pack(e)):this.debug(`Tried to send packet ${JSON.stringify(e)} but no WebSocket is available!`)}send(e){this.ws&&this.ws.readyState===h.OPEN?(this.ratelimit.queue.push(e),this.processQueue()):this.debug(`Tried to send packet ${JSON.stringify(e)} but no WebSocket is available!`)}connect(e=this.gateway,t=0,s=!1){if(t)return this.client.setTimeout(()=>this.connect(e,0,s),t);if(this.ws&&!s)return this.debug("WebSocket connection already exists"),!1;if("string"!=typeof e)return this.debug(`Tried to connect to an invalid gateway: ${e}`),!1;this.expectingClose=!1,this.gateway=e,this.debug(`Connecting to ${e}`);const n=this.ws=new h(e);return i&&(n.binaryType="arraybuffer"),n.onmessage=this.onMessage.bind(this),n.onopen=this.onOpen.bind(this),n.onerror=this.onError.bind(this),n.onclose=this.onClose.bind(this),this.status=r.Status.CONNECTING,!0}destroy(){const e=this.ws;return e?(this.heartbeat(-1),this.expectingClose=!0,e.close(1e3),this.packetManager.handleQueue(),this.ws=null,this.status=r.Status.DISCONNECTED,this.ratelimit.remaining=this.ratelimit.total,!0):(this.debug("Attempted to destroy WebSocket but no connection exists!"),!1)}onMessage(e){let t;try{t=this.unpack(e.data)}catch(e){this.emit("debug",e)}return this.onPacket(t)}setSequence(e){this.sequence=e>this.sequence?e:this.sequence}onPacket(e){if(!e)return this.debug("Received null packet"),!1;switch(this.client.emit("raw",e),e.op){case r.OPCodes.HELLO:return this.heartbeat(e.d.heartbeat_interval);case r.OPCodes.RECONNECT:return this.reconnect();case r.OPCodes.INVALID_SESSION:return e.d||(this.sessionID=null),this.sequence=-1,this.debug("Session invalidated -- will identify with a new session"),this.identify(e.d?2500:0);case r.OPCodes.HEARTBEAT_ACK:return this.ackHeartbeat();case r.OPCodes.HEARTBEAT:return this.heartbeat();default:return this.packetManager.handle(e)}}onOpen(e){e&&e.target&&e.target.url&&(this.gateway=e.target.url),this.debug(`Connected to gateway ${this.gateway}`),this.identify()}reconnect(){this.debug("Attemping to reconnect in 5500ms..."),this.client.emit(r.Events.RECONNECTING),this.connect(this.gateway,5500,!0)}onError(e){e&&"uWs client connection error"===e.message?this.reconnect():this.client.emit(r.Events.ERROR,e)}onClose(e){if(this.debug(`${this.expectingClose?"Client":"Server"} closed the WebSocket connection: ${e.code}`),this.closeSequence=this.sequence,this.emit("close",e),this.heartbeat(-1),1e3===e.code?this.expectingClose:r.WSCodes[e.code])return this.expectingClose=!1,this.client.emit(r.Events.DISCONNECT,e),this.debug(r.WSCodes[e.code]),void this.destroy();this.expectingClose=!1,this.reconnect()}ackHeartbeat(){this.debug(`Heartbeat acknowledged, latency of ${Date.now()-this.lastPingTimestamp}ms`),this.client._pong(this.lastPingTimestamp)}heartbeat(e){isNaN(e)?(this.debug("Sending a heartbeat"),this.lastPingTimestamp=Date.now(),this.send({op:r.OPCodes.HEARTBEAT,d:this.sequence})):-1===e?(this.debug("Clearing heartbeat interval"),this.client.clearInterval(this.heartbeatInterval),this.heartbeatInterval=null):(this.debug(`Setting a heartbeat interval for ${e}ms`),this.heartbeatInterval=this.client.setInterval(()=>this.heartbeat(),e))}identify(e){return e?this.client.setTimeout(this.identify.bind(this),e):this.sessionID?this.identifyResume():this.identifyNew()}identifyNew(){if(!this.client.token)return void this.debug("No token available to identify a new session with");const e=Object.assign({token:this.client.token},this.client.options.ws),{shardId:t,shardCount:s}=this.client.options;s>0&&(e.shard=[Number(t),Number(s)]),this.debug("Identifying as a new session"),this.send({op:r.OPCodes.IDENTIFY,d:e})}identifyResume(){if(!this.sessionID)return this.debug("Warning: wanted to resume but session ID not available; identifying as a new session instead"),this.identifyNew();this.debug(`Attempting to resume session ${this.sessionID}`);const e={token:this.client.token,session_id:this.sessionID,seq:this.sequence};return this.send({op:r.OPCodes.RESUME,d:e})}}WebSocketConnection.ENCODING=l?"etf":"json",WebSocketConnection.WebSocket=h,e.exports=WebSocketConnection}).call(this,s(15).Buffer)},function(e,t,s){const i=s(10),n=s(4),r=s(62),o=s(63),a=s(0),l=s(8);class ClientUser extends i{setup(e){if(super.setup(e),this.verified=e.verified,this.email=e.email,this.localPresence={},this._typing=new Map,this.friends=new n,this.blocked=new n,this.notes=new n,this.premium="boolean"==typeof e.premium?e.premium:null,this.mfaEnabled=e.mfa_enabled,this.mobile="boolean"==typeof e.mobile?e.mobile:null,this.settings=e.user_settings?new r(this,e.user_settings):null,this.guildSettings=new n,e.user_guild_settings)for(const t of e.user_guild_settings)this.guildSettings.set(t.guild_id,new o(t,this.client))}edit(e){return this.client.rest.methods.updateCurrentUser(e)}setUsername(e,t){return this.client.rest.methods.updateCurrentUser({username:e},t)}setEmail(e,t){return this.client.rest.methods.updateCurrentUser({email:e},t)}setPassword(e,t){return this.client.rest.methods.updateCurrentUser({password:e},t)}setAvatar(e){return this.client.resolver.resolveImage(e).then(e=>this.client.rest.methods.updateCurrentUser({avatar:e}))}setPresence(e){return new Promise(t=>{let s=this.localPresence.status||this.presence.status,i=this.localPresence.game,n=this.localPresence.afk||this.presence.afk;if(!i&&this.presence.game&&(i={name:this.presence.game.name,type:this.presence.game.type,url:this.presence.game.url}),e.status){if("string"!=typeof e.status)throw new TypeError("Status must be a string");this.bot?s=e.status:(this.settings.update(a.UserSettingsMap.status,e.status),s="invisible")}e.game?((i=e.game).type=i.url&&void 0===i.type?1:i.type||0,"string"==typeof i.type&&(i.type=a.ActivityTypes.indexOf(i.type.toUpperCase()))):void 0!==e.game&&(i=null),void 0!==e.afk&&(n=e.afk),n=Boolean(n),this.localPresence={status:s,game:i,afk:n},this.localPresence.since=0,this.localPresence.game=this.localPresence.game||null,this.client.ws.send({op:3,d:this.localPresence}),this.client._setPresence(this.id,this.localPresence),t(this)})}setStatus(e){return this.setPresence({status:e})}setGame(e,t){return e?this.setPresence({game:{name:e,url:t}}):this.setPresence({game:null})}setActivity(e,{url:t,type:s}={}){return e?this.setPresence({game:{name:e,type:s,url:t}}).then(e=>e.presence):this.setPresence({game:null})}setAFK(e){return this.setPresence({afk:e})}fetchMentions(e={}){return this.client.rest.methods.fetchMentions(e)}addFriend(e){return e=this.client.resolver.resolveUser(e),this.client.rest.methods.addFriend(e)}removeFriend(e){return e=this.client.resolver.resolveUser(e),this.client.rest.methods.removeFriend(e)}createGuild(e,t,s=null){return"string"==typeof s&&s.startsWith("data:")?this.client.rest.methods.createGuild({name:e,icon:s,region:t}):this.client.resolver.resolveImage(s).then(s=>this.client.rest.methods.createGuild({name:e,icon:s,region:t}))}createGroupDM(e){return this.client.rest.methods.createGroupDM({recipients:e.map(e=>this.client.resolver.resolveUserID(e.user)),accessTokens:e.map(e=>e.accessToken),nicks:e.reduce((e,t)=>(t.nick&&(e[t.user?t.user.id:t.id]=t.nick),e),{})})}acceptInvite(e){return this.client.rest.methods.acceptInvite(e)}}ClientUser.prototype.acceptInvite=l.deprecate(ClientUser.prototype.acceptInvite,"ClientUser#acceptInvite: userbot methods will be removed"),ClientUser.prototype.setGame=l.deprecate(ClientUser.prototype.setGame,"ClientUser#setGame: use ClientUser#setActivity instead"),ClientUser.prototype.addFriend=l.deprecate(ClientUser.prototype.addFriend,"ClientUser#addFriend: userbot methods will be removed"),ClientUser.prototype.removeFriend=l.deprecate(ClientUser.prototype.removeFriend,"ClientUser#removeFriend: userbot methods will be removed"),ClientUser.prototype.setPassword=l.deprecate(ClientUser.prototype.setPassword,"ClientUser#setPassword: userbot methods will be removed"),ClientUser.prototype.setEmail=l.deprecate(ClientUser.prototype.setEmail,"ClientUser#setEmail: userbot methods will be removed"),ClientUser.prototype.fetchMentions=l.deprecate(ClientUser.prototype.fetchMentions,"ClientUser#fetchMentions: userbot methods will be removed"),e.exports=ClientUser},function(e,t,s){const i=s(0),n=s(5);e.exports=class ClientUserSettings{constructor(e,t){this.user=e,this.patch(t)}patch(e){for(const t of Object.keys(i.UserSettingsMap)){const s=i.UserSettingsMap[t];e.hasOwnProperty(t)&&("function"==typeof s?this[s.name]=s(e[t]):this[s]=e[t])}}update(e,t){return this.user.client.rest.methods.patchUserSettings({[e]:t})}setGuildPosition(e,t,s){const i=Object.assign([],this.guildPositions);return n.moveElementInArray(i,e.id,t,s),this.update("guild_positions",i).then(()=>e)}addRestrictedGuild(e){const t=Object.assign([],this.restrictedGuilds);return t.includes(e.id)?Promise.reject(new Error("Guild is already restricted")):(t.push(e.id),this.update("restricted_guilds",t).then(()=>e))}removeRestrictedGuild(e){const t=Object.assign([],this.restrictedGuilds),s=t.indexOf(e.id);return s<0?Promise.reject(new Error("Guild is not restricted")):(t.splice(s,1),this.update("restricted_guilds",t).then(()=>e))}}},function(e,t,s){const i=s(0),n=s(4),r=s(94);e.exports=class ClientUserGuildSettings{constructor(e,t){Object.defineProperty(this,"client",{value:t}),this.guildID=e.guild_id,this.channelOverrides=new n,this.patch(e)}patch(e){for(const t of Object.keys(i.UserGuildSettingsMap)){const s=i.UserGuildSettingsMap[t];if(e.hasOwnProperty(t))if("channel_overrides"===t)for(const s of e[t])this.channelOverrides.set(s.channel_id,new r(s));else"function"==typeof s?this[s.name]=s(e[t]):this[s]=e[t]}}update(e,t){return this.client.rest.methods.patchClientUserGuildSettings(this.guildID,{[e]:t})}}},function(e,t,s){const i="undefined"!=typeof window,n=s(65);e.exports=n,i?window.Discord=n:i||console.warn("Warning: Attempting to use browser version of Discord.js in a non-browser environment!")},function(e,t,s){const i=s(5);e.exports={Client:s(76),Shard:s(175),ShardClientUtil:s(176),ShardingManager:s(177),WebhookClient:s(178),BitField:s(23),Collection:s(4),Constants:s(0),DiscordAPIError:s(39),EvaluatedPermissions:s(7),MessageFlags:s(35),Permissions:s(7),Snowflake:s(6),SnowflakeUtil:s(6),SystemChannelFlags:s(54),Util:i,util:i,version:s(46).version,escapeMarkdown:i.escapeMarkdown,fetchRecommendedShards:i.fetchRecommendedShards,resolveString:i.resolveString,splitMessage:i.splitMessage,Attachment:s(24),CategoryChannel:s(41),Channel:s(12),ClientUser:s(61),ClientUserSettings:s(62),Collector:s(34),DMChannel:s(44),Emoji:s(21),Game:s(11).Game,GroupDMChannel:s(38),Guild:s(27),GuildAuditLogs:s(57),GuildChannel:s(14),GuildMember:s(22),Integration:s(36),Invite:s(13),Message:s(20),MessageAttachment:s(50),MessageCollector:s(53),MessageEmbed:s(32),MessageMentions:s(49),MessageReaction:s(51),NewsChannel:s(42),OAuth2Application:s(37),ClientOAuth2Application:s(37),PartialGuild:s(55),PartialGuildChannel:s(56),PermissionOverwrites:s(59),Presence:s(11).Presence,ReactionEmoji:s(26),ReactionCollector:s(52),RichEmbed:s(18),Role:s(9),StoreChannel:s(43),TextChannel:s(29),User:s(10),VoiceChannel:s(40),Webhook:s(28)}},function(e,t){var s;s=function(){return this}();try{s=s||new Function("return this")()}catch(e){"object"==typeof window&&(s=window)}e.exports=s},function(e,t,s){"use strict";t.byteLength=function(e){var t=h(e),s=t[0],i=t[1];return 3*(s+i)/4-i},t.toByteArray=function(e){var t,s,i=h(e),o=i[0],a=i[1],l=new r(function(e,t,s){return 3*(t+s)/4-s}(0,o,a)),c=0,u=a>0?o-4:o;for(s=0;s>16&255,l[c++]=t>>8&255,l[c++]=255&t;2===a&&(t=n[e.charCodeAt(s)]<<2|n[e.charCodeAt(s+1)]>>4,l[c++]=255&t);1===a&&(t=n[e.charCodeAt(s)]<<10|n[e.charCodeAt(s+1)]<<4|n[e.charCodeAt(s+2)]>>2,l[c++]=t>>8&255,l[c++]=255&t);return l},t.fromByteArray=function(e){for(var t,s=e.length,n=s%3,r=[],o=0,a=s-n;oa?a:o+16383));1===n?(t=e[s-1],r.push(i[t>>2]+i[t<<4&63]+"==")):2===n&&(t=(e[s-2]<<8)+e[s-1],r.push(i[t>>10]+i[t>>4&63]+i[t<<2&63]+"="));return r.join("")};for(var i=[],n=[],r="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,l=o.length;a0)throw new Error("Invalid string. Length must be a multiple of 4");var s=e.indexOf("=");return-1===s&&(s=t),[s,s===t?0:4-s%4]}function c(e,t,s){for(var n,r,o=[],a=t;a>18&63]+i[r>>12&63]+i[r>>6&63]+i[63&r]);return o.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},function(e,t){t.read=function(e,t,s,i,n){var r,o,a=8*n-i-1,l=(1<>1,c=-7,u=s?n-1:0,d=s?-1:1,m=e[t+u];for(u+=d,r=m&(1<<-c)-1,m>>=-c,c+=a;c>0;r=256*r+e[t+u],u+=d,c-=8);for(o=r&(1<<-c)-1,r>>=-c,c+=i;c>0;o=256*o+e[t+u],u+=d,c-=8);if(0===r)r=1-h;else{if(r===l)return o?NaN:1/0*(m?-1:1);o+=Math.pow(2,i),r-=h}return(m?-1:1)*o*Math.pow(2,r-i)},t.write=function(e,t,s,i,n,r){var o,a,l,h=8*r-n-1,c=(1<>1,d=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,m=i?0:r-1,p=i?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,o=c):(o=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-o))<1&&(o--,l*=2),(t+=o+u>=1?d/l:d*Math.pow(2,1-u))*l>=2&&(o++,l/=2),o+u>=c?(a=0,o=c):o+u>=1?(a=(t*l-1)*Math.pow(2,n),o+=u):(a=t*Math.pow(2,u-1)*Math.pow(2,n),o=0));n>=8;e[s+m]=255&a,m+=p,a/=256,n-=8);for(o=o<0;e[s+m]=255&o,m+=p,o/=256,h-=8);e[s+m-p]|=128*g}},function(e,t){var s={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==s.call(e)}},function(e,t,s){const i="undefined"!=typeof window,n=s(45),r=s(i?73:74);class Snekfetch extends r.Extension{constructor(e,t,s={}){super(),this.options=Object.assign({version:1,qs:n,followRedirects:!0},s),this.request=r.buildRequest.call(this,e,t,s),s.headers&&this.set(s.headers),s.query&&this.query(s.query),s.data&&this.send(s.data)}query(e,t){if(this.request.query||(this.request.query={}),null!==e&&"object"==typeof e)for(const[t,s]of Object.entries(e))this.query(t,s);else this.request.query[e]=t;return this}set(e,t){if(null!==e&&"object"==typeof e)for(const t of Object.keys(e))this.set(t,e[t]);else this.request.setHeader(e,t);return this}attach(...e){const t=this.data instanceof r.FormData?this.data:this.data=new r.FormData;if("object"==typeof e[0])for(const[t,s]of Object.entries(e[0]))this.attach(t,s);else t.append(...e);return this}send(e){if(e instanceof r.FormData||r.shouldSendRaw(e))this.data=e;else if(null!==e&&"object"==typeof e){const t=this.request.getHeader("content-type");let s;t?t.includes("json")?s=JSON.stringify:t.includes("urlencoded")&&(s=this.options.qs.stringify):(this.set("Content-Type","application/json"),s=JSON.stringify),this.data=s(e)}else this.data=e;return this}then(e,t){return this._response?this._response.then(e,t):this._response=r.finalizeRequest.call(this).then(({response:e,raw:t,redirect:s,headers:i})=>{if(s){let t=this.request.method;[301,302].includes(e.statusCode)?("HEAD"!==t&&(t="GET"),this.data=null):303===e.statusCode&&(t="GET");const i=this.request.getHeaders();return delete i.host,new Snekfetch(t,s,{data:this.data,headers:i,version:this.options.version})}const n=e.statusCode||e.status,o=this,a={request:this.request,get body(){delete a.body;const e=this.headers["content-type"];if(e&&e.includes("application/json"))try{a.body=JSON.parse(a.text)}catch(e){a.body=a.text}else e&&e.includes("application/x-www-form-urlencoded")?a.body=o.options.qs.parse(a.text):a.body=t;return a.body},text:t.toString(),ok:n>=200&&n<400,headers:i||e.headers,status:n,statusText:e.statusText||r.STATUS_CODES[e.statusCode]};if(a.ok)return a;{const e=new Error(`${a.status} ${a.statusText}`.trim());return Object.assign(e,a),Promise.reject(e)}}).then(e,t)}catch(e){return this.then(null,e)}end(e){return this.then(t=>e?e(null,t):t,t=>e?e(t,t.status?t:null):Promise.reject(t))}_finalizeRequest(){if(this.request&&("HEAD"!==this.request.method&&this.set("Accept-Encoding","gzip, deflate"),this.data&&this.data.getBoundary&&this.set("Content-Type",`multipart/form-data; boundary=${this.data.getBoundary()}`),this.request.query)){const[e,t]=this.request.path.split("?");this.request.path=`${e}?${this.options.qs.stringify(this.request.query)}${t?`&${t}`:""}`}}}Snekfetch.METHODS=r.METHODS.concat("BREW").filter(e=>"M-SEARCH"!==e);for(const e of Snekfetch.METHODS)Snekfetch[e.toLowerCase()]=function(t,s){return new(this.prototype instanceof Snekfetch?this:Snekfetch)(e,t,s)};e.exports=Snekfetch},function(e,t,s){"use strict";function i(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.exports=function(e,t,s,r){t=t||"&",s=s||"=";var o={};if("string"!=typeof e||0===e.length)return o;var a=/\+/g;e=e.split(t);var l=1e3;r&&"number"==typeof r.maxKeys&&(l=r.maxKeys);var h=e.length;l>0&&h>l&&(h=l);for(var c=0;c=0?(u=g.substr(0,f),d=g.substr(f+1)):(u=g,d=""),m=decodeURIComponent(u),p=decodeURIComponent(d),i(o,m)?n(o[m])?o[m].push(p):o[m]=[o[m],p]:o[m]=p}return o};var n=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},function(e,t,s){"use strict";var i=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};e.exports=function(e,t,s,a){return t=t||"&",s=s||"=",null===e&&(e=void 0),"object"==typeof e?r(o(e),function(o){var a=encodeURIComponent(i(o))+s;return n(e[o])?r(e[o],function(e){return a+encodeURIComponent(i(e))}).join(t):a+encodeURIComponent(i(e[o]))}).join(t):a?encodeURIComponent(i(a))+s+encodeURIComponent(i(e)):""};var n=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};function r(e,t){if(e.map)return e.map(t);for(var s=[],i=0;ie.text().then(t=>{const s={};for(const[t,i]of e.headers.entries())s[t.toLowerCase()]=i;return{response:e,raw:t,headers:s}}))},shouldSendRaw:()=>!1,METHODS:["GET","HEAD","POST","PUT","DELETE","CONNECT","OPTIONS","PATCH"],STATUS_CODES:{},Extension:Object,FormData:window.FormData}},function(e,t){},function(e,t){t.endianness=function(){return"LE"},t.hostname=function(){return"undefined"!=typeof location?location.hostname:""},t.loadavg=function(){return[]},t.uptime=function(){return 0},t.freemem=function(){return Number.MAX_VALUE},t.totalmem=function(){return Number.MAX_VALUE},t.cpus=function(){return[]},t.type=function(){return"Browser"},t.release=function(){return"undefined"!=typeof navigator?navigator.appVersion:""},t.networkInterfaces=t.getNetworkInterfaces=function(){return{}},t.arch=function(){return"javascript"},t.platform=function(){return"browser"},t.tmpdir=t.tmpDir=function(){return"/tmp"},t.EOL="\n",t.homedir=function(){return"/"}},function(module,exports,__webpack_require__){(function(process){const EventEmitter=__webpack_require__(17),Constants=__webpack_require__(0),Permissions=__webpack_require__(7),Util=__webpack_require__(5),RESTManager=__webpack_require__(47),ClientDataManager=__webpack_require__(90),ClientManager=__webpack_require__(91),ClientDataResolver=__webpack_require__(33),ClientVoiceManager=__webpack_require__(139),WebSocketManager=__webpack_require__(140),ActionsManager=__webpack_require__(141),Collection=__webpack_require__(4),Presence=__webpack_require__(11).Presence,ShardClientUtil=__webpack_require__(173),VoiceBroadcast=__webpack_require__(174);class Client extends EventEmitter{constructor(e={}){super(),!e.shardId&&"SHARD_ID"in Object({__DISCORD_WEBPACK__:"true"})&&(e.shardId=Number(Object({__DISCORD_WEBPACK__:"true"}).SHARD_ID)),!e.shardCount&&"SHARD_COUNT"in Object({__DISCORD_WEBPACK__:"true"})&&(e.shardCount=Number(Object({__DISCORD_WEBPACK__:"true"}).SHARD_COUNT)),this.options=Util.mergeDefault(Constants.DefaultOptions,e),this._validateOptions(),this.rest=new RESTManager(this),this.dataManager=new ClientDataManager(this),this.manager=new ClientManager(this),this.ws=new WebSocketManager(this),this.resolver=new ClientDataResolver(this),this.actions=new ActionsManager(this),this.voice=this.browser?null:new ClientVoiceManager(this),this.shard=process.send?ShardClientUtil.singleton(this):null,this.users=new Collection,this.guilds=new Collection,this.channels=new Collection,this.presences=new Collection,Object.defineProperty(this,"token",{writable:!0}),!this.token&&"CLIENT_TOKEN"in Object({__DISCORD_WEBPACK__:"true"})?this.token=Object({__DISCORD_WEBPACK__:"true"}).CLIENT_TOKEN:this.token=null,this.user=null,this.readyAt=null,this.broadcasts=[],this.pings=[],this._timeouts=new Set,this._intervals=new Set,this.options.messageSweepInterval>0&&this.setInterval(this.sweepMessages.bind(this),1e3*this.options.messageSweepInterval)}get _pingTimestamp(){return this.ws.connection?this.ws.connection.lastPingTimestamp:0}get status(){return this.ws.connection?this.ws.connection.status:Constants.Status.IDLE}get uptime(){return this.readyAt?Date.now()-this.readyAt:null}get ping(){return this.pings.reduce((e,t)=>e+t,0)/this.pings.length}get voiceConnections(){return this.browser?new Collection:this.voice.connections}get emojis(){const e=new Collection;for(const t of this.guilds.values())for(const s of t.emojis.values())e.set(s.id,s);return e}get readyTimestamp(){return this.readyAt?this.readyAt.getTime():null}get browser(){return"undefined"!=typeof window}createVoiceBroadcast(){const e=new VoiceBroadcast(this);return this.broadcasts.push(e),e}login(e=this.token){return this.rest.methods.login(e)}destroy(){for(const e of this._timeouts)clearTimeout(e);for(const e of this._intervals)clearInterval(e);return this._timeouts.clear(),this._intervals.clear(),this.manager.destroy()}syncGuilds(e=this.guilds){this.user.bot||this.ws.send({op:12,d:e instanceof Collection?e.keyArray():e.map(e=>e.id)})}fetchUser(e,t=!0){return this.users.has(e)?Promise.resolve(this.users.get(e)):this.rest.methods.getUser(e,t)}fetchInvite(e){const t=this.resolver.resolveInviteCode(e);return this.rest.methods.getInvite(t)}fetchWebhook(e,t){return this.rest.methods.getWebhook(e,t)}fetchVoiceRegions(){return this.rest.methods.fetchVoiceRegions()}sweepMessages(e=this.options.messageCacheLifetime){if("number"!=typeof e||isNaN(e))throw new TypeError("The lifetime must be a number.");if(e<=0)return this.emit("debug","Didn't sweep messages - lifetime is unlimited"),-1;const t=1e3*e,s=Date.now();let i=0,n=0;for(const e of this.channels.values())e.messages&&(i++,n+=e.messages.sweep(e=>s-(e.editedTimestamp||e.createdTimestamp)>t));return this.emit("debug",`Swept ${n} messages older than ${e} seconds in ${i} text-based channels`),n}fetchApplication(e="@me"){return"@me"!==e&&((e,...t)=>console.warn('fetchApplication: use "@me" as an argument',t))(0,"DeprecationWarning"),this.rest.methods.getApplication(e)}generateInvite(e){return e=Permissions.resolve(e),this.fetchApplication().then(t=>`https://discordapp.com/oauth2/authorize?client_id=${t.id}&permissions=${e}&scope=bot`)}setTimeout(e,t,...s){const i=setTimeout(()=>{e(...s),this._timeouts.delete(i)},t);return this._timeouts.add(i),i}clearTimeout(e){clearTimeout(e),this._timeouts.delete(e)}setInterval(e,t,...s){const i=setInterval(e,t,...s);return this._intervals.add(i),i}clearInterval(e){clearInterval(e),this._intervals.delete(e)}_pong(e){this.pings.unshift(Date.now()-e),this.pings.length>3&&(this.pings.length=3),this.ws.lastHeartbeatAck=!0}_setPresence(e,t){this.presences.has(e)?this.presences.get(e).update(t):this.presences.set(e,new Presence(t,this))}_eval(script){return eval(script)}_validateOptions(e=this.options){if("number"!=typeof e.shardCount||isNaN(e.shardCount))throw new TypeError("The shardCount option must be a number.");if("number"!=typeof e.shardId||isNaN(e.shardId))throw new TypeError("The shardId option must be a number.");if(e.shardCount<0)throw new RangeError("The shardCount option must be at least 0.");if(e.shardId<0)throw new RangeError("The shardId option must be at least 0.");if(0!==e.shardId&&e.shardId>=e.shardCount)throw new RangeError("The shardId option must be less than shardCount.");if("number"!=typeof e.messageCacheMaxSize||isNaN(e.messageCacheMaxSize))throw new TypeError("The messageCacheMaxSize option must be a number.");if("number"!=typeof e.messageCacheLifetime||isNaN(e.messageCacheLifetime))throw new TypeError("The messageCacheLifetime option must be a number.");if("number"!=typeof e.messageSweepInterval||isNaN(e.messageSweepInterval))throw new TypeError("The messageSweepInterval option must be a number.");if("boolean"!=typeof e.fetchAllMembers)throw new TypeError("The fetchAllMembers option must be a boolean.");if("boolean"!=typeof e.disableEveryone)throw new TypeError("The disableEveryone option must be a boolean.");if("number"!=typeof e.restWsBridgeTimeout||isNaN(e.restWsBridgeTimeout))throw new TypeError("The restWsBridgeTimeout option must be a number.");if(!(e.disabledEvents instanceof Array))throw new TypeError("The disabledEvents option must be an Array.");if("number"!=typeof e.retryLimit||isNaN(e.retryLimit))throw new TypeError("The retryLimit options must be a number.")}}module.exports=Client}).call(this,__webpack_require__(16))},function(e,t){e.exports=function(e){return e&&"object"==typeof e&&"function"==typeof e.copy&&"function"==typeof e.fill&&"function"==typeof e.readUInt8}},function(e,t){"function"==typeof Object.create?e.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(e,t){e.super_=t;var s=function(){};s.prototype=t.prototype,e.prototype=new s,e.prototype.constructor=e}},function(e,t,s){(function(t){const i=s(0);class UserAgentManager{constructor(){this.build(this.constructor.DEFAULT)}set({url:e,version:t}={}){this.build({url:e||this.constructor.DFEAULT.url,version:t||this.constructor.DEFAULT.version})}build(e){this.userAgent=`DiscordBot (${e.url}, ${e.version}) Node.js/${t.version}`}}UserAgentManager.DEFAULT={url:i.Package.homepage.split("#")[0],version:i.Package.version},e.exports=UserAgentManager}).call(this,s(16))},function(e,t,s){const i=s(45),n=s(31),r=s(7),o=s(0),a=o.Endpoints,l=s(4),h=s(5),c=s(81),u=s(18),d=s(10),m=s(22),p=s(20),g=s(9),f=s(13),E=s(28),_=s(82),v=s(37),b=s(12),y=s(38),w=s(27),A=s(86),T=s(57),R=s(35);e.exports=class RESTMethods{constructor(e){this.rest=e,this.client=e.client,this._ackToken=null}login(e=this.client.token){return new Promise((t,s)=>{if(!e||"string"!=typeof e)throw new Error(o.Errors.INVALID_TOKEN);e=e.replace(/^Bot\s*/i,""),this.client.manager.connectToWebSocket(e,t,s)}).catch(e=>(this.client.destroy(),Promise.reject(e)))}logout(){return this.rest.makeRequest("post",a.logout,!0,{})}getGateway(e=!1){return this.rest.makeRequest("get",e?a.gateway.bot:a.gateway,!0)}fetchVoiceRegions(e){let t;return t=e?a.Guild(e).voiceRegions:a.voiceRegions,this.rest.makeRequest("get",t,!0).then(e=>{const t=new l;for(const s of e)t.set(s.id,new A(s));return t})}fetchEmbed(e){return this.rest.makeRequest("get",a.Guild(e).embed,!0).then(e=>({enabled:e.enabled,channel:e.channel_id?this.client.channels.get(e.channel_id):null}))}sendMessage(e,t,{tts:s,nonce:i,embed:n,disableEveryone:r,split:o,code:l,reply:c}={},u=null){return new Promise((p,g)=>{if(void 0!==t&&(t=this.client.resolver.resolveString(t)),void 0!==i&&(i=parseInt(i),isNaN(i)||i<0))throw new RangeError("Message nonce must fit in an unsigned 64-bit integer.");if(t){if(o&&"object"!=typeof o&&(o={}),void 0===l||"boolean"==typeof l&&!0!==l||(t=h.escapeMarkdown(this.client.resolver.resolveString(t),!0),t=`\`\`\`${"boolean"!=typeof l&&l||""}\n${t}\n\`\`\``,o&&(o.prepend=`\`\`\`${"boolean"!=typeof l&&l||""}\n`,o.append="\n```")),(r||void 0===r&&this.client.options.disableEveryone)&&(t=t.replace(/@(everyone|here)/g,"@​$1")),c&&!(e instanceof d||e instanceof m)&&"dm"!==e.type){const e=this.client.resolver.resolveUserID(c),s=`<@${c instanceof m&&c.nickname?"!":""}${e}>`;t=`${s}${t?`, ${t}`:""}`,o&&(o.prepend=`${s}, ${o.prepend||""}`)}o&&(t=h.splitMessage(t,o))}else if(c&&!(e instanceof d||e instanceof m)&&"dm"!==e.type){const e=this.client.resolver.resolveUserID(c);t=`<@${c instanceof m&&c.nickname?"!":""}${e}>`}const f=e=>{if(t instanceof Array){const i=[];!function t(r,o){const a=o===r.length-1?{tts:s,embed:n,files:u}:{tts:s};e.send(r[o],a).then(e=>(i.push(e),o>=r.length-1?p(i):t(r,++o))).catch(g)}(t,0)}else this.rest.makeRequest("post",a.Channel(e).messages,!0,{content:t,tts:s,nonce:i,embed:n},u).then(e=>p(this.client.actions.MessageCreate.handle(e).message),g)};e instanceof d||e instanceof m?this.createDM(e).then(f,g):f(e)})}updateMessage(e,t,{flags:s,embed:i,code:n,reply:r}={}){if(void 0!==t&&(t=this.client.resolver.resolveString(t)),void 0!==s&&(s=R.resolve(s)),void 0===n||"boolean"==typeof n&&!0!==n||(t=h.escapeMarkdown(this.client.resolver.resolveString(t),!0),t=`\`\`\`${"boolean"!=typeof n&&n||""}\n${t}\n\`\`\``),r&&"dm"!==e.channel.type){const e=this.client.resolver.resolveUserID(r);t=`${`<@${r instanceof m&&r.nickname?"!":""}${e}>`}${t?`, ${t}`:""}`}return i instanceof u&&(i=i.toJSON()),this.rest.makeRequest("patch",a.Message(e),!0,{content:t,embed:i,flags:s}).then(e=>this.client.actions.MessageUpdate.handle(e).updated)}deleteMessage(e){return this.rest.makeRequest("delete",a.Message(e),!0).then(()=>this.client.actions.MessageDelete.handle({id:e.id,channel_id:e.channel.id}).message)}ackMessage(e){return this.rest.makeRequest("post",a.Message(e).ack,!0,{token:this._ackToken}).then(t=>(t.token&&(this._ackToken=t.token),e))}ackTextChannel(e){return this.rest.makeRequest("post",a.Channel(e).Message(e.lastMessageID).ack,!0,{token:this._ackToken}).then(t=>(t.token&&(this._ackToken=t.token),e))}ackGuild(e){return this.rest.makeRequest("post",a.Guild(e).ack,!0).then(()=>e)}bulkDeleteMessages(e,t){return this.rest.makeRequest("post",a.Channel(e).messages.bulkDelete,!0,{messages:t}).then(()=>this.client.actions.MessageDeleteBulk.handle({channel_id:e.id,ids:t}).messages)}search(e,t){if("string"==typeof t&&(t={content:t}),t.before&&(t.before instanceof Date||(t.before=new Date(t.before)),t.maxID=n.fromNumber(t.before.getTime()-14200704e5).shiftLeft(22).toString()),t.after&&(t.after instanceof Date||(t.after=new Date(t.after)),t.minID=n.fromNumber(t.after.getTime()-14200704e5).shiftLeft(22).toString()),t.during){t.during instanceof Date||(t.during=new Date(t.during));const e=t.during.getTime()-14200704e5;t.minID=n.fromNumber(e).shiftLeft(22).toString(),t.maxID=n.fromNumber(e+864e5).shiftLeft(22).toString()}t.channel&&(t.channel=this.client.resolver.resolveChannelID(t.channel)),t.author&&(t.author=this.client.resolver.resolveUserID(t.author)),t.mentions&&(t.mentions=this.client.resolver.resolveUserID(t.options.mentions)),t={content:t.content,max_id:t.maxID,min_id:t.minID,has:t.has,channel_id:t.channel,author_id:t.author,author_type:t.authorType,context_size:t.contextSize,sort_by:t.sortBy,sort_order:t.sortOrder,limit:t.limit,offset:t.offset,mentions:t.mentions,mentions_everyone:t.mentionsEveryone,link_hostname:t.linkHostname,embed_provider:t.embedProvider,embed_type:t.embedType,attachment_filename:t.attachmentFilename,attachment_extension:t.attachmentExtension,include_nsfw:t.nsfw};for(const e of Object.keys(t))void 0===t[e]&&delete t[e];const s=(i.stringify(t).match(/[^=&?]+=[^=&?]+/g)||[]).join("&");let r;if(e instanceof b)r=a.Channel(e).search;else{if(!(e instanceof w))throw new TypeError("Target must be a TextChannel, DMChannel, GroupDMChannel, or Guild.");r=a.Guild(e).search}return this.rest.makeRequest("get",`${r}?${s}`,!0).then(e=>{const t=e.messages.map(e=>e.map(e=>new p(this.client.channels.get(e.channel_id),e,this.client)));return{totalResults:e.total_results,messages:t}})}createChannel(e,t,s){const{type:i,topic:n,nsfw:r,bitrate:l,userLimit:h,parent:u,permissionOverwrites:d,position:m,rateLimitPerUser:p,reason:g}=s;return this.rest.makeRequest("post",a.Guild(e).channels,!0,{name:t,topic:n,type:i?o.ChannelTypes[i.toUpperCase()]:o.ChannelTypes.TEXT,nsfw:r,bitrate:l,user_limit:h,parent_id:u instanceof b?u.id:u,permission_overwrites:c.call(this,d,e),position:m,rate_limit_per_user:p},void 0,g).then(e=>this.client.actions.ChannelCreate.handle(e).channel)}createDM(e){const t=this.getExistingDM(e);return t?Promise.resolve(t):this.rest.makeRequest("post",a.User(this.client.user).channels,!0,{recipient_id:e.id}).then(e=>this.client.actions.ChannelCreate.handle(e).channel)}createGroupDM(e){const t=this.client.user.bot?{access_tokens:e.accessTokens,nicks:e.nicks}:{recipients:e.recipients};return this.rest.makeRequest("post",a.User("@me").channels,!0,t).then(e=>new y(this.client,e))}addUserToGroupDM(e,t){const s=this.client.user.bot?{nick:t.nick,access_token:t.accessToken}:{recipient:t.id};return this.rest.makeRequest("put",a.Channel(e).Recipient(t.id),!0,s).then(()=>e)}removeUserFromGroupDM(e,t){return this.rest.makeRequest("delete",a.Channel(e).Recipient(t),!0).then(()=>e)}updateGroupDMChannel(e,t){const s={};return s.name=t.name,s.icon=t.icon,this.rest.makeRequest("patch",a.Channel(e),!0,s).then(()=>e)}getExistingDM(e){return this.client.channels.find(t=>t.recipient&&t.recipient.id===e.id)}deleteChannel(e,t){return(e instanceof d||e instanceof m)&&(e=this.getExistingDM(e)),e?this.rest.makeRequest("delete",a.Channel(e),!0,void 0,void 0,t).then(t=>(t.id=e.id,this.client.actions.ChannelDelete.handle(t).channel)):Promise.reject(new Error("No channel to delete."))}updateChannel(e,t,s){const i={};return i.name=(t.name||e.name).trim(),i.topic=void 0===t.topic?e.topic:t.topic,i.nsfw=void 0===t.nsfw?e.nsfw:t.nsfw,i.position=t.position||e.position,i.bitrate=t.bitrate||(e.bitrate?1e3*e.bitrate:void 0),i.user_limit=void 0!==t.userLimit?t.userLimit:e.userLimit,i.parent_id=t.parent instanceof b?t.parent.id:t.parent,i.permission_overwrites=t.permissionOverwrites?c.call(this,t.permissionOverwrites,e.guild):void 0,i.rate_limit_per_user=void 0!==t.rateLimitPerUser?t.rateLimitPerUser:e.rateLimitPerUser,this.rest.makeRequest("patch",a.Channel(e),!0,i,void 0,s).then(e=>this.client.actions.ChannelUpdate.handle(e).updated)}leaveGuild(e){return e.ownerID===this.client.user.id?Promise.reject(new Error("Guild is owned by the client.")):this.rest.makeRequest("delete",a.User("@me").Guild(e.id),!0).then(()=>this.client.actions.GuildDelete.handle({id:e.id}).guild)}createGuild(e){return e.icon=this.client.resolver.resolveBase64(e.icon)||null,e.region=e.region||"us-central",new Promise((t,s)=>{this.rest.makeRequest("post",a.guilds,!0,e).then(e=>{if(this.client.guilds.has(e.id))return t(this.client.guilds.get(e.id));const i=s=>{s.id===e.id&&(this.client.removeListener(o.Events.GUILD_CREATE,i),this.client.clearTimeout(n),t(s))};this.client.on(o.Events.GUILD_CREATE,i);const n=this.client.setTimeout(()=>{this.client.removeListener(o.Events.GUILD_CREATE,i),s(new Error("Took too long to receive guild data."))},1e4)},s)})}deleteGuild(e){return this.rest.makeRequest("delete",a.Guild(e),!0).then(()=>this.client.actions.GuildDelete.handle({id:e.id}).guild)}getUser(e,t){return this.rest.makeRequest("get",a.User(e),!0).then(e=>t?this.client.actions.UserGet.handle(e).user:new d(this.client,e))}updateCurrentUser(e,t){const s=this.client.user,i={};return i.username=e.username||s.username,i.avatar=void 0===e.avatar?s.avatar:this.client.resolver.resolveBase64(e.avatar),s.bot||(i.email=e.email||s.email,i.password=t,e.new_password&&(i.new_password=e.newPassword)),this.rest.makeRequest("patch",a.User("@me"),!0,i).then(e=>this.client.actions.UserUpdate.handle(e).updated)}updateGuild(e,t,s){return this.rest.makeRequest("patch",a.Guild(e),!0,t,void 0,s).then(e=>this.client.actions.GuildUpdate.handle(e).updated)}kickGuildMember(e,t,s){return this.rest.makeRequest("delete",a.Guild(e).Member(t),!0,void 0,void 0,s).then(()=>t)}createGuildRole(e,t,s){return t.color&&(t.color=this.client.resolver.resolveColor(t.color)),t.permissions&&(t.permissions=r.resolve(t.permissions)),this.rest.makeRequest("post",a.Guild(e).roles,!0,t,void 0,s).then(i=>{const{role:n}=this.client.actions.GuildRoleCreate.handle({guild_id:e.id,role:i});return t.position?n.setPosition(t.position,s):n})}deleteGuildRole(e,t){return this.rest.makeRequest("delete",a.Guild(e.guild).Role(e.id),!0,void 0,void 0,t).then(()=>this.client.actions.GuildRoleDelete.handle({guild_id:e.guild.id,role_id:e.id}).role)}setChannelOverwrite(e,t){return this.rest.makeRequest("put",`${a.Channel(e).permissions}/${t.id}`,!0,t)}deletePermissionOverwrites(e,t){return this.rest.makeRequest("delete",`${a.Channel(e.channel).permissions}/${e.id}`,!0,void 0,void 0,t).then(()=>e)}getChannelMessages(e,t={}){const s=[];t.limit&&s.push(`limit=${t.limit}`),t.around?s.push(`around=${t.around}`):t.before?s.push(`before=${t.before}`):t.after&&s.push(`after=${t.after}`);let i=a.Channel(e).messages;return s.length>0&&(i+=`?${s.join("&")}`),this.rest.makeRequest("get",i,!0)}getChannelMessage(e,t){const s=e.messages.get(t);return s?Promise.resolve(s):this.rest.makeRequest("get",a.Channel(e).Message(t),!0)}putGuildMember(e,t,s){if(s.access_token=s.accessToken,s.roles){const e=s.roles;(e instanceof l||e instanceof Array&&e[0]instanceof g)&&(s.roles=e.map(e=>e.id))}return this.rest.makeRequest("put",a.Guild(e).Member(t),!0,s).then(t=>this.client.actions.GuildMemberGet.handle(e,t).member)}getGuild(e){return this.rest.makeRequest("get",a.Guild(e),!0)}getGuildMember(e,t,s){return this.rest.makeRequest("get",a.Guild(e).Member(t),!0).then(t=>s?this.client.actions.GuildMemberGet.handle(e,t).member:new m(e,t))}updateGuildMember(e,t,s){if(t.channel){const s=this.client.resolver.resolveChannel(t.channel);if(!s||s.guild.id!==e.guild.id||"voice"!==s.type)return Promise.reject(new Error("Could not resolve channel to a guild voice channel."));t.channel_id=s.id,t.channel=void 0}else null===t.channel&&(t.channel_id=null,t.channel=void 0);t.roles&&(t.roles=[...new Set(t.roles.map(e=>e instanceof g?e.id:e))]);let i=a.Member(e);if(e.id===this.client.user.id){const s=Object.keys(t);1===s.length&&"nick"===s[0]&&(i=a.Member(e).nickname)}return this.rest.makeRequest("patch",i,!0,t,void 0,s).then(t=>e.guild._updateMember(e,t).mem)}addMemberRole(e,t,s){return new Promise((i,n)=>{if(e._roles.includes(t.id))return i(e);const r=(s,n)=>{n.id===e.id&&!s._roles.includes(t.id)&&n._roles.includes(t.id)&&(this.client.removeListener(o.Events.GUILD_MEMBER_UPDATE,r),i(n))};this.client.on(o.Events.GUILD_MEMBER_UPDATE,r);const l=this.client.setTimeout(()=>{this.client.removeListener(o.Events.GUILD_MEMBER_UPDATE,r),n(new Error("Adding the role timed out."))},1e4);return this.rest.makeRequest("put",a.Member(e).Role(t.id),!0,void 0,void 0,s).catch(e=>{this.client.removeListener(o.Events.GUILD_MEMBER_UPDATE,r),this.client.clearTimeout(l),n(e)})})}removeMemberRole(e,t,s){return new Promise((i,n)=>{if(!e._roles.includes(t.id))return i(e);const r=(s,n)=>{n.id===e.id&&s._roles.includes(t.id)&&!n._roles.includes(t.id)&&(this.client.removeListener(o.Events.GUILD_MEMBER_UPDATE,r),i(n))};this.client.on(o.Events.GUILD_MEMBER_UPDATE,r);const l=this.client.setTimeout(()=>{this.client.removeListener(o.Events.GUILD_MEMBER_UPDATE,r),n(new Error("Removing the role timed out."))},1e4);return this.rest.makeRequest("delete",a.Member(e).Role(t.id),!0,void 0,void 0,s).catch(e=>{this.client.removeListener(o.Events.GUILD_MEMBER_UPDATE,r),this.client.clearTimeout(l),n(e)})})}sendTyping(e){return this.rest.makeRequest("post",a.Channel(e).typing,!0)}banGuildMember(e,t,s){const n=this.client.resolver.resolveUserID(t);if(!n)return Promise.reject(new Error("Couldn't resolve the user ID to ban."));const r=`${a.Guild(e).bans}/${n}?${i.stringify(s)}`;return this.rest.makeRequest("put",r,!0).then(()=>{if(t instanceof m)return t;const s=this.client.resolver.resolveUser(n);return s?(t=this.client.resolver.resolveGuildMember(e,s))||s:n})}unbanGuildMember(e,t,s){return new Promise((i,n)=>{const r=this.client.resolver.resolveUserID(t);if(!r)throw new Error("Couldn't resolve the user ID to unban.");const l=(t,s)=>{t.id===e.id&&s.id===r&&(this.client.removeListener(o.Events.GUILD_BAN_REMOVE,l),this.client.clearTimeout(h),i(s))};this.client.on(o.Events.GUILD_BAN_REMOVE,l);const h=this.client.setTimeout(()=>{this.client.removeListener(o.Events.GUILD_BAN_REMOVE,l),n(new Error("Took too long to receive the ban remove event."))},1e4);this.rest.makeRequest("delete",`${a.Guild(e).bans}/${r}`,!0,void 0,void 0,s).catch(e=>{this.client.removeListener(o.Events.GUILD_BAN_REMOVE,l),this.client.clearTimeout(h),n(e)})})}getGuildBan(e,t){const s=this.client.resolver.resolveUserID(t);return this.rest.makeRequest("get",`${a.Guild(e).bans}/${s}`,!0).then(e=>({reason:e.reason,user:this.client.dataManager.newUser(e.user)}))}getGuildBans(e){return this.rest.makeRequest("get",a.Guild(e).bans,!0).then(e=>e.reduce((e,t)=>(e.set(t.user.id,{reason:t.reason,user:this.client.dataManager.newUser(t.user)}),e),new l))}updateGuildRole(e,t,s){const i={};return i.name=t.name||e.name,i.position=void 0!==t.position?t.position:e.position,i.color=null===t.color?null:this.client.resolver.resolveColor(t.color||e.color),i.hoist=void 0!==t.hoist?t.hoist:e.hoist,i.mentionable=void 0!==t.mentionable?t.mentionable:e.mentionable,void 0!==t.permissions?i.permissions=r.resolve(t.permissions):i.permissions=e.permissions,this.rest.makeRequest("patch",a.Guild(e.guild).Role(e.id),!0,i,void 0,s).then(t=>this.client.actions.GuildRoleUpdate.handle({role:t,guild_id:e.guild.id}).updated)}pinMessage(e){return this.rest.makeRequest("put",a.Channel(e.channel).Pin(e.id),!0).then(()=>e)}unpinMessage(e){return this.rest.makeRequest("delete",a.Channel(e.channel).Pin(e.id),!0).then(()=>e)}getChannelPinnedMessages(e){return this.rest.makeRequest("get",a.Channel(e).pins,!0)}createChannelInvite(e,t,s){const i={};return i.temporary=t.temporary,i.max_age=t.maxAge,i.max_uses=t.maxUses,i.unique=t.unique,this.rest.makeRequest("post",a.Channel(e).invites,!0,i,void 0,s).then(e=>new f(this.client,e))}deleteInvite(e,t){return this.rest.makeRequest("delete",a.Invite(e.code),!0,void 0,void 0,t).then(()=>e)}getInvite(e){return this.rest.makeRequest("get",a.Invite(e),!0).then(e=>new f(this.client,e))}getGuildInvites(e){return this.rest.makeRequest("get",a.Guild(e).invites,!0).then(e=>{const t=new l;for(const s of e){const e=new f(this.client,s);t.set(e.code,e)}return t})}getGuildVanityCode(e){return this.rest.makeRequest("get",a.Guild(e).vanityURL,!0).then(e=>e.code)}pruneGuildMembers(e,t,s,i){return this.rest.makeRequest(s?"get":"post",`${a.Guild(e).prune}?days=${t}`,!0,void 0,void 0,i).then(e=>e.pruned)}createEmoji(e,t,s,i,n){const r={image:t,name:s};return i&&(r.roles=i.map(e=>e.id?e.id:e)),this.rest.makeRequest("post",a.Guild(e).emojis,!0,r,void 0,n).then(t=>this.client.actions.GuildEmojiCreate.handle(e,t).emoji)}updateEmoji(e,t,s){const i={};return t.name&&(i.name=t.name),t.roles&&(i.roles=t.roles.map(e=>e.id?e.id:e)),this.rest.makeRequest("patch",a.Guild(e.guild).Emoji(e.id),!0,i,void 0,s).then(t=>this.client.actions.GuildEmojiUpdate.handle(e,t).emoji)}deleteEmoji(e,t){return this.rest.makeRequest("delete",a.Guild(e.guild).Emoji(e.id),!0,void 0,t).then(()=>this.client.actions.GuildEmojiDelete.handle(e).emoji)}getGuildAuditLogs(e,t={}){t.before&&t.before instanceof T.Entry&&(t.before=t.before.id),t.after&&t.after instanceof T.Entry&&(t.after=t.after.id),"string"==typeof t.type&&(t.type=T.Actions[t.type]);const s=(i.stringify({before:t.before,after:t.after,limit:t.limit,user_id:this.client.resolver.resolveUserID(t.user),action_type:t.type}).match(/[^=&?]+=[^=&?]+/g)||[]).join("&");return this.rest.makeRequest("get",`${a.Guild(e).auditLogs}?${s}`,!0).then(t=>T.build(e,t))}getWebhook(e,t){return this.rest.makeRequest("get",a.Webhook(e,t),!t).then(e=>new E(this.client,e))}getGuildWebhooks(e){return this.rest.makeRequest("get",a.Guild(e).webhooks,!0).then(e=>{const t=new l;for(const s of e)t.set(s.id,new E(this.client,s));return t})}getChannelWebhooks(e){return this.rest.makeRequest("get",a.Channel(e).webhooks,!0).then(e=>{const t=new l;for(const s of e)t.set(s.id,new E(this.client,s));return t})}createWebhook(e,t,s,i){return this.rest.makeRequest("post",a.Channel(e).webhooks,!0,{name:t,avatar:s},void 0,i).then(e=>new E(this.client,e))}editWebhook(e,t,s){let i,n;return t.channel_id||s?(i=a.Webhook(e.id),n=!0):(i=a.Webhook(e.id,e.token),n=!1),this.rest.makeRequest("patch",i,n,t,void 0,s).then(t=>(e.name=t.name,e.avatar=t.avatar,e.channelID=t.channel_id,e))}deleteWebhook(e,t){return this.rest.makeRequest("delete",a.Webhook(e.id,e.token),!1,void 0,void 0,t)}sendWebhookMessage(e,t,{avatarURL:s,tts:i,embeds:n,username:r}={},o=null){return new Promise((l,h)=>{if(r=r||e.name,t instanceof Array){const s=[];!function t(r,a){const c=a===r.length-1?{tts:i,embeds:n,files:o}:{tts:i};e.send(r[a],c).then(e=>(s.push(e),a>=r.length-1?l(s):t(r,++a))).catch(h)}(t,0)}else this.rest.makeRequest("post",`${a.Webhook(e.id,e.token)}?wait=true`,!1,{username:r,avatar_url:s,content:t,tts:i,embeds:n},o).then(e=>{this.client.channels?l(this.client.actions.MessageCreate.handle(e).message):l(e)},h)})}sendSlackWebhookMessage(e,t){return this.rest.makeRequest("post",`${a.Webhook(e.id,e.token)}/slack?wait=true`,!1,t)}fetchUserProfile(e){return this.rest.makeRequest("get",a.User(e).profile,!0).then(t=>new _(e,t))}fetchMentions(e){return e.guild instanceof w&&(e.guild=e.guild.id),h.mergeDefault({limit:25,roles:!0,everyone:!0,guild:null},e),this.rest.makeRequest("get",a.User("@me").Mentions(e.limit,e.roles,e.everyone,e.guild),!0).then(e=>e.map(e=>new p(this.client.channels.get(e.channel_id),e,this.client)))}addFriend(e){return this.rest.makeRequest("post",a.User("@me"),!0,{username:e.username,discriminator:e.discriminator}).then(()=>e)}removeFriend(e){return this.rest.makeRequest("delete",a.User("@me").Relationship(e.id),!0).then(()=>e)}blockUser(e){return this.rest.makeRequest("put",a.User("@me").Relationship(e.id),!0,{type:2}).then(()=>e)}unblockUser(e){return this.rest.makeRequest("delete",a.User("@me").Relationship(e.id),!0).then(()=>e)}updateEmbed(e,t,s){return this.rest.makeRequest("patch",a.Guild(e).embed,!0,{enabled:t.enabled,channel_id:this.client.resolver.resolveChannelID(t.channel)},void 0,s)}setRolePositions(e,t){return this.rest.makeRequest("patch",a.Guild(e).roles,!0,t).then(()=>this.client.actions.GuildRolesPositionUpdate.handle({guild_id:e,roles:t}).guild)}setChannelPositions(e,t){return this.rest.makeRequest("patch",a.Guild(e).channels,!0,t).then(()=>this.client.actions.GuildChannelsPositionUpdate.handle({guild_id:e,channels:t}).guild)}addMessageReaction(e,t){return this.rest.makeRequest("put",a.Message(e).Reaction(t).User("@me"),!0).then(()=>e._addReaction(h.parseEmoji(t),e.client.user))}removeMessageReaction(e,t,s){const i=a.Message(e).Reaction(t).User(s===this.client.user.id?"@me":s);return this.rest.makeRequest("delete",i,!0).then(()=>this.client.actions.MessageReactionRemove.handle({user_id:s,message_id:e.id,emoji:h.parseEmoji(t),channel_id:e.channel.id}).reaction)}removeMessageReactionEmoji(e,t){const s=a.Message(e).Reaction(t);return this.rest.makeRequest("delete",s,!0).then(()=>this.client.actions.MessageReactionRemoveEmoji.handle({message_id:e.id,emoji:h.parseEmoji(t),channel_id:e.channel.id}).reaction)}removeMessageReactions(e){return this.rest.makeRequest("delete",a.Message(e).reactions,!0).then(()=>e)}getMessageReactionUsers(e,t,s){const n=(i.stringify(s).match(/[^=&?]+=[^=&?]+/g)||[]).join("&");return this.rest.makeRequest("get",`${a.Message(e).Reaction(t)}?${n}`,!0)}getApplication(e){return this.rest.makeRequest("get",a.OAUTH2.Application(e),!0).then(e=>new v(this.client,e))}resetApplication(e){return this.rest.makeRequest("post",a.OAUTH2.Application(e).resetToken,!0).then(()=>this.rest.makeRequest("post",a.OAUTH2.Application(e).resetSecret,!0)).then(e=>new v(this.client,e))}setNote(e,t){return this.rest.makeRequest("put",a.User(e).note,!0,{note:t}).then(()=>e)}acceptInvite(e){return e.id&&(e=e.id),new Promise((t,s)=>this.rest.makeRequest("post",a.Invite(e),!0).then(e=>{const i=s=>{s.id===e.id&&(t(s),this.client.removeListener(o.Events.GUILD_CREATE,i))};this.client.on(o.Events.GUILD_CREATE,i),this.client.setTimeout(()=>{this.client.removeListener(o.Events.GUILD_CREATE,i),s(new Error("Accepting invite timed out"))},12e4)}))}patchUserSettings(e){return this.rest.makeRequest("patch",o.Endpoints.User("@me").settings,!0,e)}patchClientUserGuildSettings(e,t){return this.rest.makeRequest("patch",o.Endpoints.User("@me").Guild(e).settings,!0,t)}getIntegrations(e){return this.rest.makeRequest("get",o.Endpoints.Guild(e.id).integrations,!0)}createIntegration(e,t,s){return this.rest.makeRequest("post",o.Endpoints.Guild(e.id).integrations,!0,t,void 0,s)}syncIntegration(e){return this.rest.makeRequest("post",o.Endpoints.Guild(e.guild.id).Integration(e.id),!0)}editIntegration(e,t,s){return this.rest.makeRequest("patch",o.Endpoints.Guild(e.guild.id).Integration(e.id),!0,t,void 0,s)}deleteIntegration(e,t){return this.rest.makeRequest("delete",o.Endpoints.Guild(e.guild.id).Integration(e.id),!0,void 0,void 0,t)}}},function(e,t,s){const i=s(7),n=s(4);e.exports=function(e,t){return(e instanceof n||e instanceof Array)&&(e=e.map(e=>{const s=this.client.resolver.resolveRole(t,e.id);return s?(e.id=s.id,e.type="role"):(e.id=this.client.resolver.resolveUserID(e.id),e.type="member"),{allow:i.resolve(e.allow||e.allowed||0),deny:i.resolve(e.deny||e.denied||0),type:e.type,id:e.id}})),e}},function(e,t,s){const i=s(4),n=s(83);e.exports=class UserProfile{constructor(e,t){this.user=e,Object.defineProperty(this,"client",{value:e.client}),this.mutualGuilds=new i,this.connections=new i,this.setup(t)}setup(e){this.premium=e.premium,this.premiumSince=e.premium_since?new Date(e.premium_since):null;for(const t of e.mutual_guilds)this.client.guilds.has(t.id)&&this.mutualGuilds.set(t.id,this.client.guilds.get(t.id));for(const t of e.connected_accounts)this.connections.set(t.id,new n(this.user,t))}}},function(e,t){e.exports=class UserConnection{constructor(e,t){this.user=e,this.setup(t)}setup(e){this.type=e.type,this.name=e.name,this.id=e.id,this.revoked=e.revoked,this.integrations=e.integrations}}},function(e,t,s){const i=s(6),n=s(4),r=s(85),o=s(0);e.exports=class Team{constructor(e,t){Object.defineProperty(this,"client",{value:e}),this._patch(t)}_patch(e){this.id=e.id,this.name=e.name,this.icon=e.icon||null,this.ownerID=e.owner_user_id||null,this.members=new n;for(const t of e.members){const e=new r(this.client,this,t);this.members.set(e.id,e)}}get owner(){return this.members.get(this.ownerID)||null}get createdTimestamp(){return i.deconstruct(this.id).timestamp}get createdAt(){return new Date(this.createdTimestamp)}get iconURL(){return this.icon?o.Endpoints.CDN(this.client.options.http.cdn).TeamIcon(this.id,this.icon):null}toString(){return this.name}}},function(e,t,s){const{MembershipStates:i}=s(0);e.exports=class TeamMember{constructor(e,t,s){Object.defineProperty(this,"client",{value:e}),this.team=t,this._patch(s)}_patch(e){this.permissions=e.permissions,this.membershipState=i[e.membership_state],this.user=this.client.dataManager.newUser(e.user)}get id(){return this.user.id}toString(){return this.user.toString()}}},function(e,t){e.exports=class VoiceRegion{constructor(e){this.id=e.id,this.name=e.name,this.vip=e.vip,this.deprecated=e.deprecated,this.optimal=e.optimal,this.custom=e.custom,this.sampleHostname=e.sample_hostname}}},function(e,t,s){const i=s(58),n=s(39),{Events:{RATE_LIMIT:r}}=s(0);e.exports=class SequentialRequestHandler extends i{constructor(e,t){super(e,t),this.client=e.client,this.endpoint=t,this.timeDifference=0,this.busy=!1}push(e){super.push(e),this.handle()}execute(e){return this.busy=!0,new Promise(t=>{e.request.gen().end((s,i)=>{if(i&&i.headers&&(this.requestLimit=Number(i.headers["x-ratelimit-limit"]),this.requestResetTime=1e3*Number(i.headers["x-ratelimit-reset"]),this.requestRemaining=Number(i.headers["x-ratelimit-remaining"]),this.timeDifference=Date.now()-new Date(i.headers.date).getTime()),s)429===s.status?(this.queue.unshift(e),this.client.setTimeout(()=>{this.globalLimit=!1,t()},Number(i.headers["retry-after"])+this.client.options.restTimeOffset),i.headers["x-ratelimit-global"]&&(this.globalLimit=!0)):s.status>=500&&s.status<600?e.retries===this.client.options.retryLimit?(e.reject(s),t()):(e.retries++,this.queue.unshift(e),this.client.setTimeout(t,1e3+this.client.options.restTimeOffset)):(e.reject(s.status>=400&&s.status<500?new n(i.request.path,i.body,i.request.method):s),t(s));else{this.globalLimit=!1;const s=i&&i.body?i.body:{};e.resolve(s),0===this.requestRemaining?(this.client.listenerCount(r)&&this.client.emit(r,{limit:this.requestLimit,timeDifference:this.timeDifference,path:e.request.path,method:e.request.method}),this.client.setTimeout(()=>t(s),this.requestResetTime-Date.now()+this.timeDifference+this.client.options.restTimeOffset)):t(s)}})})}handle(){super.handle(),this.busy||0===this.remaining||0===this.queue.length||this.globalLimit||this.execute(this.queue.shift()).then(()=>{this.busy=!1,this.handle()})}}},function(e,t,s){const i=s(58),n=s(39),{Events:{RATE_LIMIT:r}}=s(0);e.exports=class BurstRequestHandler extends i{constructor(e,t){super(e,t),this.client=e.client,this.limit=1/0,this.resetTime=null,this.remaining=1,this.timeDifference=0,this.resetTimeout=null}push(e){super.push(e),this.handle()}execute(e){e&&e.request.gen().end((t,s)=>{if(s&&s.headers&&(this.limit=Number(s.headers["x-ratelimit-limit"]),this.resetTime=1e3*Number(s.headers["x-ratelimit-reset"]),this.remaining=Number(s.headers["x-ratelimit-remaining"]),this.timeDifference=Date.now()-new Date(s.headers.date).getTime()),t)if(429===t.status){if(this.queue.unshift(e),s.headers["x-ratelimit-global"]&&(this.globalLimit=!0),this.resetTimeout)return;this.resetTimeout=this.client.setTimeout(()=>{this.remaining=this.limit,this.globalLimit=!1,this.handle(),this.resetTimeout=null},Number(s.headers["retry-after"])+this.client.options.restTimeOffset)}else t.status>=500&&t.status<600?e.retries===this.client.options.retryLimit?(e.reject(t),this.handle()):(e.retries++,this.queue.unshift(e),this.resetTimeout=this.client.setTimeout(()=>{this.handle(),this.resetTimeout=null},1e3+this.client.options.restTimeOffset)):(e.reject(t.status>=400&&t.status<500?new n(s.request.path,s.body,s.request.method):t),this.handle());else{0===this.remaining&&this.client.listenerCount(r)&&this.client.emit(r,{limit:this.limit,timeDifference:this.timeDifference,path:e.request.path,method:e.request.method}),this.globalLimit=!1;const t=s&&s.body?s.body:{};e.resolve(t),this.handle()}})}handle(){super.handle(),0!==this.queue.length&&((this.remaining<=0||this.globalLimit)&&Date.now()-this.timeDifference{this.client.emit(i.Events.GUILD_CREATE,s)}):this.client.emit(i.Events.GUILD_CREATE,s)),s}newUser(e,t=!0){if(this.client.users.has(e.id))return this.client.users.get(e.id);const s=new o(this.client,e);return t&&this.client.users.set(s.id,s),s}newChannel(e,t){const s=this.client.channels.has(e.id);let n;if(e.type===i.ChannelTypes.DM)n=new p(this.client,e);else if(e.type===i.ChannelTypes.GROUP_DM)n=new g(this.client,e);else if(t=t||this.client.guilds.get(e.guild_id),s)n=this.client.channels.get(e.id);else if(t){switch(e.type){case i.ChannelTypes.TEXT:n=new h(t,e);break;case i.ChannelTypes.VOICE:n=new c(t,e);break;case i.ChannelTypes.CATEGORY:n=new u(t,e);break;case i.ChannelTypes.NEWS:n=new d(t,e);break;case i.ChannelTypes.STORE:n=new m(t,e)}t.channels.set(n.id,n)}return n&&!s?(this.pastReady&&this.client.emit(i.Events.CHANNEL_CREATE,n),this.client.channels.set(n.id,n),n):s?n:null}newEmoji(e,t){const s=t.emojis.has(e.id);if(e&&!s){let s=new a(t,e);return this.client.emit(i.Events.GUILD_EMOJI_CREATE,s),t.emojis.set(s.id,s),s}return s?t.emojis.get(e.id):null}killEmoji(e){e instanceof a&&e.guild&&(this.client.emit(i.Events.GUILD_EMOJI_DELETE,e),e.guild.emojis.delete(e.id))}killGuild(e){const t=this.client.guilds.has(e.id);this.client.guilds.delete(e.id),t&&this.pastReady&&this.client.emit(i.Events.GUILD_DELETE,e)}killUser(e){this.client.users.delete(e.id)}killChannel(e){this.client.channels.delete(e.id),e instanceof l&&e.guild.channels.delete(e.id)}updateGuild(e,t){const s=n.cloneObject(e);e.setup(t),this.pastReady&&this.client.emit(i.Events.GUILD_UPDATE,s,e)}updateChannel(e,t){e.setup(t)}updateEmoji(e,t){const s=n.cloneObject(e);return e.setup(t),this.client.emit(i.Events.GUILD_EMOJI_UPDATE,s,e),e}}},function(e,t,s){const i=s(0),n=s(60);e.exports=class ClientManager{constructor(e){this.client=e,this.heartbeatInterval=null}get status(){return this.connection?this.connection.status:i.Status.IDLE}connectToWebSocket(e,t,s){this.client.emit(i.Events.DEBUG,`Authenticated using token ${e}`),this.client.token=e;const r=this.client.setTimeout(()=>s(new Error(i.Errors.TOOK_TOO_LONG)),3e5);this.client.rest.methods.getGateway().then(o=>{const a=i.DefaultOptions.ws.version,l=`${o.url}/?v=${a}&encoding=${n.ENCODING}`;this.client.emit(i.Events.DEBUG,`Using gateway ${l}`),this.client.ws.connect(l),this.client.ws.connection.once("error",s),this.client.ws.connection.once("close",e=>{4004===e.code&&s(new Error(i.Errors.BAD_LOGIN)),4010===e.code&&s(new Error(i.Errors.INVALID_SHARD)),4011===e.code&&s(new Error(i.Errors.SHARDING_REQUIRED))}),this.client.once(i.Events.READY,()=>{t(e),this.client.clearTimeout(r)})},s)}destroy(){return this.client.ws.destroy(),this.client.rest.destroy(),this.client.user?this.client.user.bot?(this.client.token=null,Promise.resolve()):this.client.rest.methods.logout().then(()=>{this.client.token=null}):Promise.resolve()}}},function(e,t,s){const i=s(0),n=[i.WSEvents.READY,i.WSEvents.RESUMED,i.WSEvents.GUILD_CREATE,i.WSEvents.GUILD_DELETE,i.WSEvents.GUILD_MEMBERS_CHUNK,i.WSEvents.GUILD_MEMBER_ADD,i.WSEvents.GUILD_MEMBER_REMOVE];e.exports=class WebSocketPacketManager{constructor(e){this.ws=e,this.handlers={},this.queue=[],this.register(i.WSEvents.READY,s(93)),this.register(i.WSEvents.RESUMED,s(95)),this.register(i.WSEvents.GUILD_CREATE,s(96)),this.register(i.WSEvents.GUILD_DELETE,s(97)),this.register(i.WSEvents.GUILD_UPDATE,s(98)),this.register(i.WSEvents.GUILD_BAN_ADD,s(99)),this.register(i.WSEvents.GUILD_BAN_REMOVE,s(100)),this.register(i.WSEvents.GUILD_MEMBER_ADD,s(101)),this.register(i.WSEvents.GUILD_MEMBER_REMOVE,s(102)),this.register(i.WSEvents.GUILD_MEMBER_UPDATE,s(103)),this.register(i.WSEvents.GUILD_ROLE_CREATE,s(104)),this.register(i.WSEvents.GUILD_ROLE_DELETE,s(105)),this.register(i.WSEvents.GUILD_ROLE_UPDATE,s(106)),this.register(i.WSEvents.GUILD_EMOJIS_UPDATE,s(107)),this.register(i.WSEvents.GUILD_MEMBERS_CHUNK,s(108)),this.register(i.WSEvents.GUILD_INTEGRATIONS_UPDATE,s(109)),this.register(i.WSEvents.INVITE_CREATE,s(110)),this.register(i.WSEvents.INVITE_DELETE,s(111)),this.register(i.WSEvents.CHANNEL_CREATE,s(112)),this.register(i.WSEvents.CHANNEL_DELETE,s(113)),this.register(i.WSEvents.CHANNEL_UPDATE,s(114)),this.register(i.WSEvents.CHANNEL_PINS_UPDATE,s(115)),this.register(i.WSEvents.PRESENCE_UPDATE,s(116)),this.register(i.WSEvents.USER_UPDATE,s(117)),this.register(i.WSEvents.USER_NOTE_UPDATE,s(118)),this.register(i.WSEvents.USER_SETTINGS_UPDATE,s(119)),this.register(i.WSEvents.USER_GUILD_SETTINGS_UPDATE,s(120)),this.register(i.WSEvents.VOICE_STATE_UPDATE,s(121)),this.register(i.WSEvents.TYPING_START,s(122)),this.register(i.WSEvents.MESSAGE_CREATE,s(123)),this.register(i.WSEvents.MESSAGE_DELETE,s(124)),this.register(i.WSEvents.MESSAGE_UPDATE,s(125)),this.register(i.WSEvents.MESSAGE_DELETE_BULK,s(126)),this.register(i.WSEvents.VOICE_SERVER_UPDATE,s(127)),this.register(i.WSEvents.GUILD_SYNC,s(128)),this.register(i.WSEvents.RELATIONSHIP_ADD,s(129)),this.register(i.WSEvents.RELATIONSHIP_REMOVE,s(130)),this.register(i.WSEvents.MESSAGE_REACTION_ADD,s(131)),this.register(i.WSEvents.MESSAGE_REACTION_REMOVE,s(132)),this.register(i.WSEvents.MESSAGE_REACTION_REMOVE,s(133)),this.register(i.WSEvents.MESSAGE_REACTION_REMOVE_ALL,s(134)),this.register(i.WSEvents.WEBHOOKS_UPDATE,s(135))}get client(){return this.ws.client}register(e,t){this.handlers[e]=new t(this)}handleQueue(){this.queue.forEach((e,t)=>{this.handle(this.queue[t],!0),this.queue.splice(t,1)})}handle(e,t=!1){return e.op===i.OPCodes.HEARTBEAT_ACK?(this.ws.client._pong(this.ws.client._pingTimestamp),this.ws.lastHeartbeatAck=!0,this.ws.client.emit("debug","Heartbeat acknowledged")):e.op===i.OPCodes.HEARTBEAT&&(this.client.ws.send({op:i.OPCodes.HEARTBEAT,d:this.client.ws.sequence}),this.ws.client.emit("debug","Received gateway heartbeat")),this.ws.status===i.Status.RECONNECTING&&(this.ws.reconnecting=!1,this.ws.checkIfReady()),this.ws.setSequence(e.s),void 0===this.ws.disabledEvents[e.t]&&(this.ws.status!==i.Status.READY&&-1===n.indexOf(e.t)?(this.queue.push(e),!1):(!t&&this.queue.length>0&&this.handleQueue(),!!this.handlers[e.t]&&this.handlers[e.t].handle(e)))}}},function(e,t,s){const i=s(1),n=s(61);e.exports=class ReadyHandler extends i{handle(e){const t=this.packetManager.client,s=e.d;t.ws.heartbeat(),s.user.user_settings=s.user_settings,s.user.user_guild_settings=s.user_guild_settings;const i=new n(t,s.user);t.user=i,t.readyAt=new Date,t.users.set(i.id,i);for(const e of s.guilds)t.guilds.has(e.id)||t.dataManager.newGuild(e);for(const e of s.private_channels)t.dataManager.newChannel(e);for(const e of s.relationships){const s=t.dataManager.newUser(e.user);1===e.type?t.user.friends.set(s.id,s):2===e.type&&t.user.blocked.set(s.id,s)}s.presences=s.presences||[];for(const e of s.presences)t.dataManager.newUser(e.user),t._setPresence(e.user.id,e);if(s.notes)for(const e of Object.keys(s.notes)){let i=s.notes[e];i.length||(i=null),t.user.notes.set(e,i)}!t.user.bot&&t.options.sync&&t.setInterval(t.syncGuilds.bind(t),3e4),t.users.has("1")||t.dataManager.newUser({id:"1",username:"Clyde",discriminator:"0000",avatar:"https://discordapp.com/assets/f78426a064bc9dd24847519259bc42af.png",bot:!0,status:"online",game:null,verified:!0});const r=t.setTimeout(()=>{t.ws.connection.triggerReady()},1200*s.guilds.length),o=s.guilds.length;0!==t.getMaxListeners()&&t.setMaxListeners(t.getMaxListeners()+o),t.once("ready",()=>{t.syncGuilds(),0!==t.getMaxListeners()&&t.setMaxListeners(t.getMaxListeners()-o),t.clearTimeout(r)});const a=this.packetManager.ws;a.sessionID=s.session_id,t.emit("debug",`READY ${a.sessionID}`),a.checkIfReady()}}},function(e,t,s){const i=s(0);e.exports=class ClientUserChannelOverride{constructor(e){this.patch(e)}patch(e){for(const t of Object.keys(i.UserChannelOverrideMap)){const s=i.UserChannelOverrideMap[t];e.hasOwnProperty(t)&&("function"==typeof s?this[s.name]=s(e[t]):this[s]=e[t])}}}},function(e,t,s){const i=s(1),n=s(0);e.exports=class ResumedHandler extends i{handle(){const e=this.packetManager.client,t=e.ws.connection;t.status=n.Status.READY,this.packetManager.handleQueue();const s=t.sequence-t.closeSequence;t.debug(`RESUMED | replayed ${s} events.`),e.emit(n.Events.RESUME,s),t.heartbeat()}}},function(e,t,s){const i=s(1);e.exports=class GuildCreateHandler extends i{handle(e){const t=this.packetManager.client,s=e.d,i=t.guilds.get(s.id);i?i.available||s.unavailable||(i.setup(s),this.packetManager.ws.checkIfReady()):t.dataManager.newGuild(s)}}},function(e,t,s){const i=s(1),n=s(0);e.exports=class GuildDeleteHandler extends i{handle(e){const t=this.packetManager.client,s=e.d,i=t.actions.GuildDelete.handle(s);i.guild&&t.emit(n.Events.GUILD_DELETE,i.guild)}}},function(e,t,s){const i=s(1);e.exports=class GuildUpdateHandler extends i{handle(e){const t=this.packetManager.client,s=e.d;t.actions.GuildUpdate.handle(s)}}},function(e,t,s){const i=s(1),n=s(0);e.exports=class GuildBanAddHandler extends i{handle(e){const t=this.packetManager.client,s=e.d,i=t.guilds.get(s.guild_id),r=t.users.get(s.user.id);i&&r&&t.emit(n.Events.GUILD_BAN_ADD,i,r)}}},function(e,t,s){const i=s(1);e.exports=class GuildBanRemoveHandler extends i{handle(e){const t=this.packetManager.client,s=e.d;t.actions.GuildBanRemove.handle(s)}}},function(e,t,s){const i=s(1);e.exports=class GuildMemberAddHandler extends i{handle(e){const t=this.packetManager.client,s=e.d,i=t.guilds.get(s.guild_id);i&&(i.memberCount++,i._addMember(s))}}},function(e,t,s){const i=s(1);e.exports=class GuildMemberRemoveHandler extends i{handle(e){const t=this.packetManager.client,s=e.d;t.actions.GuildMemberRemove.handle(s)}}},function(e,t,s){const i=s(1);e.exports=class GuildMemberUpdateHandler extends i{handle(e){const t=this.packetManager.client,s=e.d,i=t.guilds.get(s.guild_id);if(i){const e=i.members.get(s.user.id);e&&i._updateMember(e,s)}}}},function(e,t,s){const i=s(1);e.exports=class GuildRoleCreateHandler extends i{handle(e){const t=this.packetManager.client,s=e.d;t.actions.GuildRoleCreate.handle(s)}}},function(e,t,s){const i=s(1);e.exports=class GuildRoleDeleteHandler extends i{handle(e){const t=this.packetManager.client,s=e.d;t.actions.GuildRoleDelete.handle(s)}}},function(e,t,s){const i=s(1);e.exports=class GuildRoleUpdateHandler extends i{handle(e){const t=this.packetManager.client,s=e.d;t.actions.GuildRoleUpdate.handle(s)}}},function(e,t,s){const i=s(1);e.exports=class GuildEmojisUpdate extends i{handle(e){const t=this.packetManager.client,s=e.d;t.actions.GuildEmojisUpdate.handle(s)}}},function(e,t,s){const i=s(1),n=s(0);e.exports=class GuildMembersChunkHandler extends i{handle(e){const t=this.packetManager.client,s=e.d,i=t.guilds.get(s.guild_id);if(!i)return;const r=s.members.map(e=>i._addMember(e,!1));t.emit(n.Events.GUILD_MEMBERS_CHUNK,r,i),t.ws.lastHeartbeatAck=!0}}},function(e,t,s){const i=s(1),{Events:n}=s(0);e.exports=class GuildIntegrationsHandler extends i{handle(e){const t=this.packetManager.client,s=e.d,i=t.guilds.get(s.guild_id);i&&t.emit(n.GUILD_INTEGRATIONS_UPDATE,i)}}},function(e,t,s){const i=s(1);e.exports=class InviteCreateHandler extends i{handle(e){const t=this.packetManager.client,s=e.d;t.actions.InviteCreate.handle(s)}}},function(e,t,s){const i=s(1);e.exports=class InviteDeleteHandler extends i{handle(e){const t=this.packetManager.client,s=e.d;t.actions.InviteDelete.handle(s)}}},function(e,t,s){const i=s(1);e.exports=class ChannelCreateHandler extends i{handle(e){const t=this.packetManager.client,s=e.d;t.actions.ChannelCreate.handle(s)}}},function(e,t,s){const i=s(1),n=s(0);e.exports=class ChannelDeleteHandler extends i{handle(e){const t=this.packetManager.client,s=e.d,i=t.actions.ChannelDelete.handle(s);i.channel&&t.emit(n.Events.CHANNEL_DELETE,i.channel)}}},function(e,t,s){const i=s(1);e.exports=class ChannelUpdateHandler extends i{handle(e){const t=this.packetManager.client,s=e.d;t.actions.ChannelUpdate.handle(s)}}},function(e,t,s){const i=s(1),n=s(0);e.exports=class ChannelPinsUpdate extends i{handle(e){const t=this.packetManager.client,s=e.d,i=t.channels.get(s.channel_id),r=new Date(s.last_pin_timestamp);i&&r&&(i.lastPinTimestamp=r.getTime()||null,t.emit(n.Events.CHANNEL_PINS_UPDATE,i,r))}}},function(e,t,s){const i=s(1),n=s(0),r=s(5);e.exports=class PresenceUpdateHandler extends i{handle(e){const t=this.packetManager.client,s=e.d;let i=t.users.get(s.user.id);const o=t.guilds.get(s.guild_id);if(!i){if(!s.user.username)return;i=t.dataManager.newUser(s.user)}const a=r.cloneObject(i);if(i.patch(s.user),i.equals(a)||t.emit(n.Events.USER_UPDATE,a,i),o){let e=o.members.get(i.id);if(e||"offline"===s.status||(e=o._addMember({user:i,roles:s.roles,deaf:!1,mute:!1},!1),t.emit(n.Events.GUILD_MEMBER_AVAILABLE,e)),e){if(0===t.listenerCount(n.Events.PRESENCE_UPDATE))return void o._setPresence(i.id,s);const a=r.cloneObject(e);e.presence&&(a.frozenPresence=r.cloneObject(e.presence)),o._setPresence(i.id,s),t.emit(n.Events.PRESENCE_UPDATE,a,e)}else o._setPresence(i.id,s)}}}},function(e,t,s){const i=s(1);e.exports=class UserUpdateHandler extends i{handle(e){const t=this.packetManager.client,s=e.d;t.actions.UserUpdate.handle(s)}}},function(e,t,s){const i=s(1);e.exports=class UserNoteUpdateHandler extends i{handle(e){const t=this.packetManager.client,s=e.d;t.actions.UserNoteUpdate.handle(s)}}},function(e,t,s){const i=s(1),n=s(0);e.exports=class UserSettingsUpdateHandler extends i{handle(e){const t=this.packetManager.client;t.user.settings.patch(e.d),t.emit(n.Events.USER_SETTINGS_UPDATE,t.user.settings)}}},function(e,t,s){const i=s(1),n=s(0),r=s(63);e.exports=class UserGuildSettingsUpdateHandler extends i{handle(e){const t=this.packetManager.client,s=t.user.guildSettings.get(e.d.guild_id);s?s.patch(e.d):t.user.guildSettings.set(e.d.guild_id,new r(e.d,t)),t.emit(n.Events.USER_GUILD_SETTINGS_UPDATE,t.user.guildSettings.get(e.d.guild_id))}}},function(e,t,s){const i=s(1),n=s(0),r=s(5);e.exports=class VoiceStateUpdateHandler extends i{handle(e){const t=this.packetManager.client,s=e.d,i=t.guilds.get(s.guild_id);if(i){const e=i.members.get(s.user_id);if(e){const i=r.cloneObject(e);e.voiceChannel&&e.voiceChannel.id!==s.channel_id&&e.voiceChannel.members.delete(i.id),s.channel_id||(e.speaking=null),e.user.id===t.user.id&&t.emit("self.voiceStateUpdate",s);const o=t.channels.get(s.channel_id);o&&(o.members.set(e.id,e),e.guild.channels.set(s.channel_id,o)),e.serverMute=s.mute,e.serverDeaf=s.deaf,e.selfMute=s.self_mute,e.selfDeaf=s.self_deaf,e.selfStream=s.self_stream||!1,e.voiceSessionID=s.session_id,e.voiceChannelID=s.channel_id,t.emit(n.Events.VOICE_STATE_UPDATE,i,e)}}}}},function(e,t,s){const i=s(1),n=s(0);class TypingData{constructor(e,t,s,i){this.client=e,this.since=t,this.lastTimestamp=s,this._timeout=i}resetTimeout(e){this.client.clearTimeout(this._timeout),this._timeout=e}get elapsedTime(){return Date.now()-this.since}}function r(e,t){return e.client.setTimeout(()=>{e.client.emit(n.Events.TYPING_STOP,e,t,e._typing.get(t.id)),e._typing.delete(t.id)},6e3)}e.exports=class TypingStartHandler extends i{handle(e){const t=this.packetManager.client,s=e.d,i=t.channels.get(s.channel_id),o=t.users.get(s.user_id),a=new Date(1e3*s.timestamp);if(i&&o){if("voice"===i.type)return void t.emit(n.Events.WARN,`Discord sent a typing packet to voice channel ${i.id}`);if(i._typing.has(o.id)){const e=i._typing.get(o.id);e.lastTimestamp=a,e.resetTimeout(r(i,o))}else i._typing.set(o.id,new TypingData(t,a,a,r(i,o))),t.emit(n.Events.TYPING_START,i,o)}}}},function(e,t,s){const i=s(1),n=s(0);e.exports=class MessageCreateHandler extends i{handle(e){const t=this.packetManager.client,s=e.d,i=t.actions.MessageCreate.handle(s);i.message&&t.emit(n.Events.MESSAGE_CREATE,i.message)}}},function(e,t,s){const i=s(1),n=s(0);e.exports=class MessageDeleteHandler extends i{handle(e){const t=this.packetManager.client,s=e.d,i=t.actions.MessageDelete.handle(s);i.message&&t.emit(n.Events.MESSAGE_DELETE,i.message)}}},function(e,t,s){const i=s(1);e.exports=class MessageUpdateHandler extends i{handle(e){const t=this.packetManager.client,s=e.d;t.actions.MessageUpdate.handle(s)}}},function(e,t,s){const i=s(1);e.exports=class MessageDeleteBulkHandler extends i{handle(e){const t=this.packetManager.client,s=e.d;t.actions.MessageDeleteBulk.handle(s)}}},function(e,t,s){const i=s(1);e.exports=class VoiceServerUpdate extends i{handle(e){const t=this.packetManager.client,s=e.d;t.emit("self.voiceServer",s)}}},function(e,t,s){const i=s(1);e.exports=class GuildSyncHandler extends i{handle(e){const t=this.packetManager.client,s=e.d;t.actions.GuildSync.handle(s)}}},function(e,t,s){const i=s(1);e.exports=class RelationshipAddHandler extends i{handle(e){const t=this.packetManager.client,s=e.d;1===s.type?t.fetchUser(s.id).then(e=>{t.user.friends.set(e.id,e)}):2===s.type&&t.fetchUser(s.id).then(e=>{t.user.blocked.set(e.id,e)})}}},function(e,t,s){const i=s(1);e.exports=class RelationshipRemoveHandler extends i{handle(e){const t=this.packetManager.client,s=e.d;2===s.type?t.user.blocked.has(s.id)&&t.user.blocked.delete(s.id):1===s.type&&t.user.friends.has(s.id)&&t.user.friends.delete(s.id)}}},function(e,t,s){const i=s(1);e.exports=class MessageReactionAddHandler extends i{handle(e){const t=this.packetManager.client,s=e.d;t.actions.MessageReactionAdd.handle(s)}}},function(e,t,s){const i=s(1);e.exports=class MessageReactionRemove extends i{handle(e){const t=this.packetManager.client,s=e.d;t.actions.MessageReactionRemove.handle(s)}}},function(e,t,s){const i=s(1);e.exports=class MessageReactionRemoveEmoji extends i{handle(e){const t=this.packetManager.client,s=e.d;t.actions.MessageReactionRemoveEmoji.handle(s)}}},function(e,t,s){const i=s(1);e.exports=class MessageReactionRemoveAll extends i{handle(e){const t=this.packetManager.client,s=e.d;t.actions.MessageReactionRemoveAll.handle(s)}}},function(e,t,s){const i=s(1),{Events:n}=s(0);e.exports=class WebhooksUpdate extends i{handle(e){const t=this.packetManager.client,s=e.d,i=t.channels.get(s.channel_id);i&&t.emit(n.WEBHOOKS_UPDATE,i)}}},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t,s){const i=s(17).EventEmitter,n=s(0),r=s(60);e.exports=class WebSocketManager extends i{constructor(e){super(),this.client=e,this.connection=null}heartbeat(){return this.connection?this.connection.heartbeat():this.debug("No connection to heartbeat")}debug(e){return this.client.emit("debug",`[ws] ${e}`)}destroy(){return this.connection?this.connection.destroy():(this.debug("Attempted to destroy WebSocket but no connection exists!"),!1)}send(e){this.connection?this.connection.send(e):this.debug("No connection to websocket")}connect(e){if(!this.connection)return this.connection=new r(this,e),!0;switch(this.connection.status){case n.Status.IDLE:case n.Status.DISCONNECTED:return this.connection.connect(e,5500),!0;default:return this.debug(`Couldn't connect to ${e} as the websocket is at state ${this.connection.status}`),!1}}}},function(e,t,s){e.exports=class ActionsManager{constructor(e){this.client=e,this.register(s(142)),this.register(s(143)),this.register(s(144)),this.register(s(145)),this.register(s(146)),this.register(s(147)),this.register(s(148)),this.register(s(149)),this.register(s(150)),this.register(s(151)),this.register(s(152)),this.register(s(153)),this.register(s(154)),this.register(s(155)),this.register(s(156)),this.register(s(157)),this.register(s(158)),this.register(s(159)),this.register(s(160)),this.register(s(161)),this.register(s(162)),this.register(s(163)),this.register(s(164)),this.register(s(165)),this.register(s(166)),this.register(s(167)),this.register(s(168)),this.register(s(169)),this.register(s(170)),this.register(s(171)),this.register(s(172))}register(e){this[e.name.replace(/Action$/,"")]=new e(this.client)}}},function(e,t,s){const i=s(3),n=s(20);e.exports=class MessageCreateAction extends i{handle(e){const t=this.client,s=t.channels.get((e instanceof Array?e[0]:e).channel_id),i=t.users.get((e instanceof Array?e[0]:e).author.id);if(s){const r=s.guild?s.guild.member(i):null;if(e instanceof Array){const o=new Array(e.length);for(let i=0;ithis.deleted.delete(e+t),this.client.options.restWsBridgeTimeout)}}},function(e,t,s){const i=s(3),n=s(4),r=s(0);e.exports=class MessageDeleteBulkAction extends i{handle(e){const t=new n,s=this.client.channels.get(e.channel_id);if(s)for(const i of e.ids){const e=s.messages.get(i);e&&(e.deleted=!0,t.set(e.id,e),s.messages.delete(i))}return t.size>0&&this.client.emit(r.Events.MESSAGE_BULK_DELETE,t),{messages:t}}}},function(e,t,s){const i=s(3),n=s(0);e.exports=class MessageUpdateAction extends i{handle(e){const t=this.client,s=t.channels.get(e.channel_id);if(s){const i=s.messages.get(e.id);return i?(i.patch(e),t.emit(n.Events.MESSAGE_UPDATE,i._edits[0],i),{old:i._edits[0],updated:i}):{old:i,updated:i}}return{old:null,updated:null}}}},function(e,t,s){const i=s(3),n=s(0);e.exports=class MessageReactionAdd extends i{handle(e){const t=this.client.users.get(e.user_id);if(!t)return!1;const s=this.client.channels.get(e.channel_id);if(!s||"voice"===s.type)return!1;const i=s.messages.get(e.message_id);if(!i)return!1;if(!e.emoji)return!1;const r=i._addReaction(e.emoji,t);return r&&this.client.emit(n.Events.MESSAGE_REACTION_ADD,r,t),{message:i,reaction:r,user:t}}}},function(e,t,s){const i=s(3),n=s(0);e.exports=class MessageReactionRemove extends i{handle(e){const t=this.client.users.get(e.user_id);if(!t)return!1;const s=this.client.channels.get(e.channel_id);if(!s||"voice"===s.type)return!1;const i=s.messages.get(e.message_id);if(!i)return!1;if(!e.emoji)return!1;const r=i._removeReaction(e.emoji,t);return r&&this.client.emit(n.Events.MESSAGE_REACTION_REMOVE,r,t),{message:i,reaction:r,user:t}}}},function(e,t,s){const i=s(3),n=s(0);e.exports=class MessageReactionRemoveEmoji extends i{handle(e){const t=this.client.channels.get(e.channel_id);if(!t||"voice"===t.type)return!1;const s=t.messages.get(e.message_id);if(!s)return!1;if(!e.emoji)return!1;const i=s._removeReaction(e.emoji);return i&&this.client.emit(n.Events.MESSAGE_REACTION_REMOVE_EMOJI,i),{message:s,reaction:i}}}},function(e,t,s){const i=s(3),n=s(0);e.exports=class MessageReactionRemoveAll extends i{handle(e){const t=this.client.channels.get(e.channel_id);if(!t||"voice"===t.type)return!1;const s=t.messages.get(e.message_id);return!!s&&(s._clearReactions(),this.client.emit(n.Events.MESSAGE_REACTION_REMOVE_ALL,s),{message:s})}}},function(e,t,s){const i=s(3);e.exports=class ChannelCreateAction extends i{handle(e){return{channel:this.client.dataManager.newChannel(e)}}}},function(e,t,s){const i=s(3),n=s(44);e.exports=class ChannelDeleteAction extends i{constructor(e){super(e),this.deleted=new Map}handle(e){const t=this.client;let s=t.channels.get(e.id);if(s?(t.dataManager.killChannel(s),this.deleted.set(s.id,s),this.scheduleForDeletion(s.id)):s=this.deleted.get(e.id)||null,s){if(s.messages&&!(s instanceof n))for(const e of s.messages.values())e.deleted=!0;s.deleted=!0}return{channel:s}}scheduleForDeletion(e){this.client.setTimeout(()=>this.deleted.delete(e),this.client.options.restWsBridgeTimeout)}}},function(e,t,s){const i=s(3),n=s(29),r=s(40),o=s(41),a=s(42),l=s(43),h=s(0),c=h.ChannelTypes,u=s(5);e.exports=class ChannelUpdateAction extends i{handle(e){const t=this.client;let s=t.channels.get(e.id);if(s){const i=u.cloneObject(s);if(c[s.type.toUpperCase()]!==e.type){let t;switch(e.type){case c.TEXT:t=n;break;case c.VOICE:t=r;break;case c.CATEGORY:t=o;break;case c.NEWS:t=a;break;case c.STORE:t=l}const i=new t(s.guild,e);if(s.messages&&i.messages)for(const[e,t]of s.messages)i.messages.set(e,t);s=i,this.client.channels.set(s.id,s)}else s.setup(e);return t.emit(h.Events.CHANNEL_UPDATE,i,s),{old:i,updated:s}}return{old:null,updated:null}}}},function(e,t,s){const i=s(3),n=s(0);e.exports=class GuildDeleteAction extends i{constructor(e){super(e),this.deleted=new Map}handle(e){const t=this.client;let s=t.guilds.get(e.id);if(s){for(const e of s.channels.values())"text"===e.type&&e.stopTyping(!0);if(s.available&&e.unavailable)return s.available=!1,t.emit(n.Events.GUILD_UNAVAILABLE,s),{guild:null};for(const e of s.channels.values())this.client.channels.delete(e.id);s.voiceConnection&&s.voiceConnection.disconnect(),t.guilds.delete(s.id),this.deleted.set(s.id,s),this.scheduleForDeletion(s.id)}else s=this.deleted.get(e.id)||null;return s&&(s.deleted=!0),{guild:s}}scheduleForDeletion(e){this.client.setTimeout(()=>this.deleted.delete(e),this.client.options.restWsBridgeTimeout)}}},function(e,t,s){const i=s(3),n=s(0),r=s(5);e.exports=class GuildUpdateAction extends i{handle(e){const t=this.client,s=t.guilds.get(e.id);if(s){const i=r.cloneObject(s);return s.setup(e),t.emit(n.Events.GUILD_UPDATE,i,s),{old:i,updated:s}}return{old:null,updated:null}}}},function(e,t,s){const i=s(3);e.exports=class GuildMemberGetAction extends i{handle(e,t){return{member:e._addMember(t,!1)}}}},function(e,t,s){const i=s(3),n=s(0);e.exports=class GuildMemberRemoveAction extends i{constructor(e){super(e),this.deleted=new Map}handle(e){const t=this.client,s=t.guilds.get(e.guild_id);let i=null;return s&&(i=s.members.get(e.user.id),s.memberCount--,i?(s._removeMember(i),this.deleted.set(s.id+e.user.id,i),t.status===n.Status.READY&&t.emit(n.Events.GUILD_MEMBER_REMOVE,i),this.scheduleForDeletion(s.id,e.user.id)):i=this.deleted.get(s.id+e.user.id)||null,i&&(i.deleted=!0)),{guild:s,member:i}}scheduleForDeletion(e,t){this.client.setTimeout(()=>this.deleted.delete(e+t),this.client.options.restWsBridgeTimeout)}}},function(e,t,s){const i=s(3),n=s(0);e.exports=class GuildBanRemove extends i{handle(e){const t=this.client,s=t.guilds.get(e.guild_id),i=t.dataManager.newUser(e.user);s&&i&&t.emit(n.Events.GUILD_BAN_REMOVE,s,i)}}},function(e,t,s){const i=s(3),n=s(0),r=s(9);e.exports=class GuildRoleCreate extends i{handle(e){const t=this.client,s=t.guilds.get(e.guild_id);let i;if(s){const o=s.roles.has(e.role.id);i=new r(s,e.role),s.roles.set(i.id,i),o||t.emit(n.Events.GUILD_ROLE_CREATE,i)}return{role:i}}}},function(e,t,s){const i=s(3),n=s(0);e.exports=class GuildRoleDeleteAction extends i{constructor(e){super(e),this.deleted=new Map}handle(e){const t=this.client,s=t.guilds.get(e.guild_id);let i;return s&&((i=s.roles.get(e.role_id))?(s.roles.delete(e.role_id),this.deleted.set(s.id+e.role_id,i),this.scheduleForDeletion(s.id,e.role_id),t.emit(n.Events.GUILD_ROLE_DELETE,i)):i=this.deleted.get(s.id+e.role_id)||null,i&&(i.deleted=!0)),{role:i}}scheduleForDeletion(e,t){this.client.setTimeout(()=>this.deleted.delete(e+t),this.client.options.restWsBridgeTimeout)}}},function(e,t,s){const i=s(3),n=s(0),r=s(5);e.exports=class GuildRoleUpdateAction extends i{handle(e){const t=this.client,s=t.guilds.get(e.guild_id);if(s){const i=e.role;let o=null;const a=s.roles.get(i.id);return a&&(o=r.cloneObject(a),a.setup(e.role),t.emit(n.Events.GUILD_ROLE_UPDATE,o,a)),{old:o,updated:a}}return{old:null,updated:null}}}},function(e,t,s){"use strict";const i=s(3),n=s(13),{Events:r}=s(0);e.exports=class InviteCreateAction extends i{handle(e){const t=this.client,s=t.guilds.get(e.guild_id),i=t.channels.get(e.channel_id);if(s&&i){const o=Object.assign(e,{guild:s,channel:i}),a=new n(t,o);return t.emit(r.INVITE_CREATE,a),{invite:a}}return{invite:null}}}},function(e,t,s){const i=s(3),n=s(13),{Events:r}=s(0);e.exports=class InviteDeleteAction extends i{handle(e){const t=this.client,s=t.guilds.get(e.guild_id),i=t.channels.get(e.channel_id);if(s&&i){const o=Object.assign(e,{guild:s,channel:i}),a=new n(t,o);t.emit(r.INVITE_DELETE,a)}}}},function(e,t,s){const i=s(3);e.exports=class UserGetAction extends i{handle(e){return{user:this.client.dataManager.newUser(e)}}}},function(e,t,s){const i=s(3),n=s(0),r=s(5);e.exports=class UserUpdateAction extends i{handle(e){const t=this.client;if(t.user){if(t.user.equals(e))return{old:t.user,updated:t.user};const s=r.cloneObject(t.user);return t.user.patch(e),t.emit(n.Events.USER_UPDATE,s,t.user),{old:s,updated:t.user}}return{old:null,updated:null}}}},function(e,t,s){const i=s(3),n=s(0);e.exports=class UserNoteUpdateAction extends i{handle(e){const t=this.client,s=t.user.notes.get(e.id),i=e.note.length?e.note:null;return t.user.notes.set(e.id,i),t.emit(n.Events.USER_NOTE_UPDATE,e.id,s,i),{old:s,updated:i}}}},function(e,t,s){const i=s(3);e.exports=class GuildSync extends i{handle(e){const t=this.client.guilds.get(e.id);if(t){if(e.presences)for(const s of e.presences)t._setPresence(s.user.id,s);if(e.members)for(const s of e.members){const e=t.members.get(s.user.id);e?t._updateMember(e,s):t._addMember(s,!1)}"large"in e&&(t.large=e.large)}}}},function(e,t,s){const i=s(3);e.exports=class GuildEmojiCreateAction extends i{handle(e,t){return{emoji:this.client.dataManager.newEmoji(t,e)}}}},function(e,t,s){const i=s(3);e.exports=class GuildEmojiDeleteAction extends i{handle(e){return this.client.dataManager.killEmoji(e),e.deleted=!0,{emoji:e}}}},function(e,t,s){const i=s(3);e.exports=class GuildEmojiUpdateAction extends i{handle(e,t){return{emoji:this.client.dataManager.updateEmoji(e,t)}}}},function(e,t,s){const i=s(3);e.exports=class GuildEmojisUpdateAction extends i{handle(e){const t=this.client.guilds.get(e.guild_id);if(!t||!t.emojis)return;const s=function(e){const t=new Map;for(const s of e)t.set(...s);return t}(t.emojis.entries());for(const i of e.emojis){const e=t.emojis.get(i.id);e?(s.delete(i.id),e.equals(i,!0)||this.client.actions.GuildEmojiUpdate.handle(e,i)):this.client.actions.GuildEmojiCreate.handle(t,i)}for(const e of s.values())this.client.actions.GuildEmojiDelete.handle(e)}}},function(e,t,s){const i=s(3);e.exports=class GuildRolesPositionUpdate extends i{handle(e){const t=this.client.guilds.get(e.guild_id);if(t)for(const s of e.roles){const e=t.roles.get(s.id);e&&(e.position=s.position)}return{guild:t}}}},function(e,t,s){const i=s(3);e.exports=class GuildChannelsPositionUpdate extends i{handle(e){const t=this.client.guilds.get(e.guild_id);if(t)for(const s of e.channels){const e=t.channels.get(s.id);e&&(e.position=s.position)}return{guild:t}}}},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t,s){const i=s(28),n=s(47),r=s(33),o=s(0),a=s(5);e.exports=class WebhookClient extends i{constructor(e,t,s){super(null,e,t),this.options=a.mergeDefault(o.DefaultOptions,s),this.rest=new n(this),this.resolver=new r(this),this._timeouts=new Set,this._intervals=new Set}setTimeout(e,t,...s){const i=setTimeout(()=>{e(...s),this._timeouts.delete(i)},t);return this._timeouts.add(i),i}clearTimeout(e){clearTimeout(e),this._timeouts.delete(e)}setInterval(e,t,...s){const i=setInterval(e,t,...s);return this._intervals.add(i),i}clearInterval(e){clearInterval(e),this._intervals.delete(e)}destroy(){for(const e of this._timeouts)clearTimeout(e);for(const e of this._intervals)clearInterval(e);this._timeouts.clear(),this._intervals.clear()}}}]); \ No newline at end of file