diff --git a/discord.11.5.1.js b/discord.11.5.1.js new file mode 100644 index 00000000..339b776b --- /dev/null +++ b/discord.11.5.1.js @@ -0,0 +1,2100 @@ +/******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); +/******/ } +/******/ }; +/******/ +/******/ // define __esModule on exports +/******/ __webpack_require__.r = function(exports) { +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ } +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ +/******/ // create a fake namespace object +/******/ // mode & 1: value is a module id, require it +/******/ // mode & 2: merge all properties of value into the ns +/******/ // mode & 4: return value when already ns object +/******/ // mode & 8|1: behave like require +/******/ __webpack_require__.t = function(value, mode) { +/******/ if(mode & 1) value = __webpack_require__(value); +/******/ if(mode & 8) return value; +/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; +/******/ var ns = Object.create(null); +/******/ __webpack_require__.r(ns); +/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); +/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); +/******/ return ns; +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; +/******/ +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = "./browser.js"); +/******/ }) +/************************************************************************/ +/******/ ({ + +/***/ "./browser.js": +/*!********************!*\ + !*** ./browser.js ***! + \********************/ +/*! no static exports found */ +/*! ModuleConcatenation bailout: Module is not an ECMAScript module */ +/***/ (function(module, exports, __webpack_require__) { + +eval("const browser = typeof window !== 'undefined';\nconst webpack = !!\"true\";\n\nconst Discord = __webpack_require__(/*! ./ */ \"./src/index.js\");\n\nmodule.exports = Discord;\nif (browser && webpack) window.Discord = Discord; // eslint-disable-line no-undef\n// eslint-disable-next-line no-console\nelse if (!browser) console.warn('Warning: Attempting to use browser version of Discord.js in a non-browser environment!');\n\n\n//# sourceURL=webpack:///./browser.js?"); + +/***/ }), + +/***/ "./node_modules/base64-js/index.js": +/*!*****************************************!*\ + !*** ./node_modules/base64-js/index.js ***! + \*****************************************/ +/*! no static exports found */ +/*! ModuleConcatenation bailout: Module is not an ECMAScript module */ +/***/ (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?"); + +/***/ }), + +/***/ "./node_modules/buffer/index.js": +/*!**************************************!*\ + !*** ./node_modules/buffer/index.js ***! + \**************************************/ +/*! no static exports found */ +/*! ModuleConcatenation bailout: Module is not an ECMAScript module */ +/***/ (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?"); + +/***/ }), + +/***/ "./node_modules/events/events.js": +/*!***************************************!*\ + !*** ./node_modules/events/events.js ***! + \***************************************/ +/*! no static exports found */ +/*! ModuleConcatenation bailout: Module is not an ECMAScript module */ +/***/ (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?"); + +/***/ }), + +/***/ "./node_modules/ieee754/index.js": +/*!***************************************!*\ + !*** ./node_modules/ieee754/index.js ***! + \***************************************/ +/*! no static exports found */ +/*! ModuleConcatenation bailout: Module is not an ECMAScript module */ +/***/ (function(module, exports) { + +eval("exports.read = function (buffer, offset, isLE, mLen, nBytes) {\n var e, m\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var nBits = -7\n var i = isLE ? (nBytes - 1) : 0\n var d = isLE ? -1 : 1\n var s = buffer[offset + i]\n\n i += d\n\n e = s & ((1 << (-nBits)) - 1)\n s >>= (-nBits)\n nBits += eLen\n for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n m = e & ((1 << (-nBits)) - 1)\n e >>= (-nBits)\n nBits += mLen\n for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n if (e === 0) {\n e = 1 - eBias\n } else if (e === eMax) {\n return m ? NaN : ((s ? -1 : 1) * Infinity)\n } else {\n m = m + Math.pow(2, mLen)\n e = e - eBias\n }\n return (s ? -1 : 1) * m * Math.pow(2, e - mLen)\n}\n\nexports.write = function (buffer, value, offset, isLE, mLen, nBytes) {\n var e, m, c\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)\n var i = isLE ? 0 : (nBytes - 1)\n var d = isLE ? 1 : -1\n var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0\n\n value = Math.abs(value)\n\n if (isNaN(value) || value === Infinity) {\n m = isNaN(value) ? 1 : 0\n e = eMax\n } else {\n e = Math.floor(Math.log(value) / Math.LN2)\n if (value * (c = Math.pow(2, -e)) < 1) {\n e--\n c *= 2\n }\n if (e + eBias >= 1) {\n value += rt / c\n } else {\n value += rt * Math.pow(2, 1 - eBias)\n }\n if (value * c >= 2) {\n e++\n c /= 2\n }\n\n if (e + eBias >= eMax) {\n m = 0\n e = eMax\n } else if (e + eBias >= 1) {\n m = ((value * c) - 1) * Math.pow(2, mLen)\n e = e + eBias\n } else {\n m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)\n e = 0\n }\n }\n\n for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}\n\n e = (e << mLen) | m\n eLen += mLen\n for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}\n\n buffer[offset + i - d] |= s * 128\n}\n\n\n//# sourceURL=webpack:///./node_modules/ieee754/index.js?"); + +/***/ }), + +/***/ "./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 ***! + \***************************************/ +/*! no static exports found */ +/*! ModuleConcatenation bailout: Module is not an ECMAScript module */ +/***/ (function(module, exports) { + +eval("var toString = {}.toString;\n\nmodule.exports = Array.isArray || function (arr) {\n return toString.call(arr) == '[object Array]';\n};\n\n\n//# sourceURL=webpack:///./node_modules/isarray/index.js?"); + +/***/ }), + +/***/ "./node_modules/long/src/long.js": +/*!***************************************!*\ + !*** ./node_modules/long/src/long.js ***! + \***************************************/ +/*! no static exports found */ +/*! ModuleConcatenation bailout: Module is not an ECMAScript module */ +/***/ (function(module, exports) { + +eval("module.exports = Long;\r\n\r\n/**\r\n * wasm optimizations, to do native i64 multiplication and divide\r\n */\r\nvar wasm = null;\r\n\r\ntry {\r\n wasm = new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([\r\n 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\r\n ])), {}).exports;\r\n} catch (e) {\r\n // no wasm support :(\r\n}\r\n\r\n/**\r\n * Constructs a 64 bit two's-complement integer, given its low and high 32 bit values as *signed* integers.\r\n * See the from* functions below for more convenient ways of constructing Longs.\r\n * @exports Long\r\n * @class A Long class for representing a 64 bit two's-complement integer value.\r\n * @param {number} low The low (signed) 32 bits of the long\r\n * @param {number} high The high (signed) 32 bits of the long\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @constructor\r\n */\r\nfunction Long(low, high, unsigned) {\r\n\r\n /**\r\n * The low 32 bits as a signed value.\r\n * @type {number}\r\n */\r\n this.low = low | 0;\r\n\r\n /**\r\n * The high 32 bits as a signed value.\r\n * @type {number}\r\n */\r\n this.high = high | 0;\r\n\r\n /**\r\n * Whether unsigned or not.\r\n * @type {boolean}\r\n */\r\n this.unsigned = !!unsigned;\r\n}\r\n\r\n// The internal representation of a long is the two given signed, 32-bit values.\r\n// We use 32-bit pieces because these are the size of integers on which\r\n// Javascript performs bit-operations. For operations like addition and\r\n// multiplication, we split each number into 16 bit pieces, which can easily be\r\n// multiplied within Javascript's floating-point representation without overflow\r\n// or change in sign.\r\n//\r\n// In the algorithms below, we frequently reduce the negative case to the\r\n// positive case by negating the input(s) and then post-processing the result.\r\n// Note that we must ALWAYS check specially whether those values are MIN_VALUE\r\n// (-2^63) because -MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented as\r\n// a positive number, it overflows back into a negative). Not handling this\r\n// case would often result in infinite recursion.\r\n//\r\n// Common constant values ZERO, ONE, NEG_ONE, etc. are defined below the from*\r\n// methods on which they depend.\r\n\r\n/**\r\n * An indicator used to reliably determine if an object is a Long or not.\r\n * @type {boolean}\r\n * @const\r\n * @private\r\n */\r\nLong.prototype.__isLong__;\r\n\r\nObject.defineProperty(Long.prototype, \"__isLong__\", { value: true });\r\n\r\n/**\r\n * @function\r\n * @param {*} obj Object\r\n * @returns {boolean}\r\n * @inner\r\n */\r\nfunction isLong(obj) {\r\n return (obj && obj[\"__isLong__\"]) === true;\r\n}\r\n\r\n/**\r\n * Tests if the specified object is a Long.\r\n * @function\r\n * @param {*} obj Object\r\n * @returns {boolean}\r\n */\r\nLong.isLong = isLong;\r\n\r\n/**\r\n * A cache of the Long representations of small integer values.\r\n * @type {!Object}\r\n * @inner\r\n */\r\nvar INT_CACHE = {};\r\n\r\n/**\r\n * A cache of the Long representations of small unsigned integer values.\r\n * @type {!Object}\r\n * @inner\r\n */\r\nvar UINT_CACHE = {};\r\n\r\n/**\r\n * @param {number} value\r\n * @param {boolean=} unsigned\r\n * @returns {!Long}\r\n * @inner\r\n */\r\nfunction fromInt(value, unsigned) {\r\n var obj, cachedObj, cache;\r\n if (unsigned) {\r\n value >>>= 0;\r\n if (cache = (0 <= value && value < 256)) {\r\n cachedObj = UINT_CACHE[value];\r\n if (cachedObj)\r\n return cachedObj;\r\n }\r\n obj = fromBits(value, (value | 0) < 0 ? -1 : 0, true);\r\n if (cache)\r\n UINT_CACHE[value] = obj;\r\n return obj;\r\n } else {\r\n value |= 0;\r\n if (cache = (-128 <= value && value < 128)) {\r\n cachedObj = INT_CACHE[value];\r\n if (cachedObj)\r\n return cachedObj;\r\n }\r\n obj = fromBits(value, value < 0 ? -1 : 0, false);\r\n if (cache)\r\n INT_CACHE[value] = obj;\r\n return obj;\r\n }\r\n}\r\n\r\n/**\r\n * Returns a Long representing the given 32 bit integer value.\r\n * @function\r\n * @param {number} value The 32 bit integer in question\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @returns {!Long} The corresponding Long value\r\n */\r\nLong.fromInt = fromInt;\r\n\r\n/**\r\n * @param {number} value\r\n * @param {boolean=} unsigned\r\n * @returns {!Long}\r\n * @inner\r\n */\r\nfunction fromNumber(value, unsigned) {\r\n if (isNaN(value))\r\n return unsigned ? UZERO : ZERO;\r\n if (unsigned) {\r\n if (value < 0)\r\n return UZERO;\r\n if (value >= TWO_PWR_64_DBL)\r\n return MAX_UNSIGNED_VALUE;\r\n } else {\r\n if (value <= -TWO_PWR_63_DBL)\r\n return MIN_VALUE;\r\n if (value + 1 >= TWO_PWR_63_DBL)\r\n return MAX_VALUE;\r\n }\r\n if (value < 0)\r\n return fromNumber(-value, unsigned).neg();\r\n return fromBits((value % TWO_PWR_32_DBL) | 0, (value / TWO_PWR_32_DBL) | 0, unsigned);\r\n}\r\n\r\n/**\r\n * Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned.\r\n * @function\r\n * @param {number} value The number in question\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @returns {!Long} The corresponding Long value\r\n */\r\nLong.fromNumber = fromNumber;\r\n\r\n/**\r\n * @param {number} lowBits\r\n * @param {number} highBits\r\n * @param {boolean=} unsigned\r\n * @returns {!Long}\r\n * @inner\r\n */\r\nfunction fromBits(lowBits, highBits, unsigned) {\r\n return new Long(lowBits, highBits, unsigned);\r\n}\r\n\r\n/**\r\n * Returns a Long representing the 64 bit integer that comes by concatenating the given low and high bits. Each is\r\n * assumed to use 32 bits.\r\n * @function\r\n * @param {number} lowBits The low 32 bits\r\n * @param {number} highBits The high 32 bits\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @returns {!Long} The corresponding Long value\r\n */\r\nLong.fromBits = fromBits;\r\n\r\n/**\r\n * @function\r\n * @param {number} base\r\n * @param {number} exponent\r\n * @returns {number}\r\n * @inner\r\n */\r\nvar pow_dbl = Math.pow; // Used 4 times (4*8 to 15+4)\r\n\r\n/**\r\n * @param {string} str\r\n * @param {(boolean|number)=} unsigned\r\n * @param {number=} radix\r\n * @returns {!Long}\r\n * @inner\r\n */\r\nfunction fromString(str, unsigned, radix) {\r\n if (str.length === 0)\r\n throw Error('empty string');\r\n if (str === \"NaN\" || str === \"Infinity\" || str === \"+Infinity\" || str === \"-Infinity\")\r\n return ZERO;\r\n if (typeof unsigned === 'number') {\r\n // For goog.math.long compatibility\r\n radix = unsigned,\r\n unsigned = false;\r\n } else {\r\n unsigned = !! unsigned;\r\n }\r\n radix = radix || 10;\r\n if (radix < 2 || 36 < radix)\r\n throw RangeError('radix');\r\n\r\n var p;\r\n if ((p = str.indexOf('-')) > 0)\r\n throw Error('interior hyphen');\r\n else if (p === 0) {\r\n return fromString(str.substring(1), unsigned, radix).neg();\r\n }\r\n\r\n // Do several (8) digits each time through the loop, so as to\r\n // minimize the calls to the very expensive emulated div.\r\n var radixToPower = fromNumber(pow_dbl(radix, 8));\r\n\r\n var result = ZERO;\r\n for (var i = 0; i < str.length; i += 8) {\r\n var size = Math.min(8, str.length - i),\r\n value = parseInt(str.substring(i, i + size), radix);\r\n if (size < 8) {\r\n var power = fromNumber(pow_dbl(radix, size));\r\n result = result.mul(power).add(fromNumber(value));\r\n } else {\r\n result = result.mul(radixToPower);\r\n result = result.add(fromNumber(value));\r\n }\r\n }\r\n result.unsigned = unsigned;\r\n return result;\r\n}\r\n\r\n/**\r\n * Returns a Long representation of the given string, written using the specified radix.\r\n * @function\r\n * @param {string} str The textual representation of the Long\r\n * @param {(boolean|number)=} unsigned Whether unsigned or not, defaults to signed\r\n * @param {number=} radix The radix in which the text is written (2-36), defaults to 10\r\n * @returns {!Long} The corresponding Long value\r\n */\r\nLong.fromString = fromString;\r\n\r\n/**\r\n * @function\r\n * @param {!Long|number|string|!{low: number, high: number, unsigned: boolean}} val\r\n * @param {boolean=} unsigned\r\n * @returns {!Long}\r\n * @inner\r\n */\r\nfunction fromValue(val, unsigned) {\r\n if (typeof val === 'number')\r\n return fromNumber(val, unsigned);\r\n if (typeof val === 'string')\r\n return fromString(val, unsigned);\r\n // Throws for non-objects, converts non-instanceof Long:\r\n return fromBits(val.low, val.high, typeof unsigned === 'boolean' ? unsigned : val.unsigned);\r\n}\r\n\r\n/**\r\n * Converts the specified value to a Long using the appropriate from* function for its type.\r\n * @function\r\n * @param {!Long|number|string|!{low: number, high: number, unsigned: boolean}} val Value\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @returns {!Long}\r\n */\r\nLong.fromValue = fromValue;\r\n\r\n// NOTE: the compiler should inline these constant values below and then remove these variables, so there should be\r\n// no runtime penalty for these.\r\n\r\n/**\r\n * @type {number}\r\n * @const\r\n * @inner\r\n */\r\nvar TWO_PWR_16_DBL = 1 << 16;\r\n\r\n/**\r\n * @type {number}\r\n * @const\r\n * @inner\r\n */\r\nvar TWO_PWR_24_DBL = 1 << 24;\r\n\r\n/**\r\n * @type {number}\r\n * @const\r\n * @inner\r\n */\r\nvar TWO_PWR_32_DBL = TWO_PWR_16_DBL * TWO_PWR_16_DBL;\r\n\r\n/**\r\n * @type {number}\r\n * @const\r\n * @inner\r\n */\r\nvar TWO_PWR_64_DBL = TWO_PWR_32_DBL * TWO_PWR_32_DBL;\r\n\r\n/**\r\n * @type {number}\r\n * @const\r\n * @inner\r\n */\r\nvar TWO_PWR_63_DBL = TWO_PWR_64_DBL / 2;\r\n\r\n/**\r\n * @type {!Long}\r\n * @const\r\n * @inner\r\n */\r\nvar TWO_PWR_24 = fromInt(TWO_PWR_24_DBL);\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar ZERO = fromInt(0);\r\n\r\n/**\r\n * Signed zero.\r\n * @type {!Long}\r\n */\r\nLong.ZERO = ZERO;\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar UZERO = fromInt(0, true);\r\n\r\n/**\r\n * Unsigned zero.\r\n * @type {!Long}\r\n */\r\nLong.UZERO = UZERO;\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar ONE = fromInt(1);\r\n\r\n/**\r\n * Signed one.\r\n * @type {!Long}\r\n */\r\nLong.ONE = ONE;\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar UONE = fromInt(1, true);\r\n\r\n/**\r\n * Unsigned one.\r\n * @type {!Long}\r\n */\r\nLong.UONE = UONE;\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar NEG_ONE = fromInt(-1);\r\n\r\n/**\r\n * Signed negative one.\r\n * @type {!Long}\r\n */\r\nLong.NEG_ONE = NEG_ONE;\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar MAX_VALUE = fromBits(0xFFFFFFFF|0, 0x7FFFFFFF|0, false);\r\n\r\n/**\r\n * Maximum signed value.\r\n * @type {!Long}\r\n */\r\nLong.MAX_VALUE = MAX_VALUE;\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar MAX_UNSIGNED_VALUE = fromBits(0xFFFFFFFF|0, 0xFFFFFFFF|0, true);\r\n\r\n/**\r\n * Maximum unsigned value.\r\n * @type {!Long}\r\n */\r\nLong.MAX_UNSIGNED_VALUE = MAX_UNSIGNED_VALUE;\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar MIN_VALUE = fromBits(0, 0x80000000|0, false);\r\n\r\n/**\r\n * Minimum signed value.\r\n * @type {!Long}\r\n */\r\nLong.MIN_VALUE = MIN_VALUE;\r\n\r\n/**\r\n * @alias Long.prototype\r\n * @inner\r\n */\r\nvar LongPrototype = Long.prototype;\r\n\r\n/**\r\n * Converts the Long to a 32 bit integer, assuming it is a 32 bit integer.\r\n * @returns {number}\r\n */\r\nLongPrototype.toInt = function toInt() {\r\n return this.unsigned ? this.low >>> 0 : this.low;\r\n};\r\n\r\n/**\r\n * Converts the Long to a the nearest floating-point representation of this value (double, 53 bit mantissa).\r\n * @returns {number}\r\n */\r\nLongPrototype.toNumber = function toNumber() {\r\n if (this.unsigned)\r\n return ((this.high >>> 0) * TWO_PWR_32_DBL) + (this.low >>> 0);\r\n return this.high * TWO_PWR_32_DBL + (this.low >>> 0);\r\n};\r\n\r\n/**\r\n * Converts the Long to a string written in the specified radix.\r\n * @param {number=} radix Radix (2-36), defaults to 10\r\n * @returns {string}\r\n * @override\r\n * @throws {RangeError} If `radix` is out of range\r\n */\r\nLongPrototype.toString = function toString(radix) {\r\n radix = radix || 10;\r\n if (radix < 2 || 36 < radix)\r\n throw RangeError('radix');\r\n if (this.isZero())\r\n return '0';\r\n if (this.isNegative()) { // Unsigned Longs are never negative\r\n if (this.eq(MIN_VALUE)) {\r\n // We need to change the Long value before it can be negated, so we remove\r\n // the bottom-most digit in this base and then recurse to do the rest.\r\n var radixLong = fromNumber(radix),\r\n div = this.div(radixLong),\r\n rem1 = div.mul(radixLong).sub(this);\r\n return div.toString(radix) + rem1.toInt().toString(radix);\r\n } else\r\n return '-' + this.neg().toString(radix);\r\n }\r\n\r\n // Do several (6) digits each time through the loop, so as to\r\n // minimize the calls to the very expensive emulated div.\r\n var radixToPower = fromNumber(pow_dbl(radix, 6), this.unsigned),\r\n rem = this;\r\n var result = '';\r\n while (true) {\r\n var remDiv = rem.div(radixToPower),\r\n intval = rem.sub(remDiv.mul(radixToPower)).toInt() >>> 0,\r\n digits = intval.toString(radix);\r\n rem = remDiv;\r\n if (rem.isZero())\r\n return digits + result;\r\n else {\r\n while (digits.length < 6)\r\n digits = '0' + digits;\r\n result = '' + digits + result;\r\n }\r\n }\r\n};\r\n\r\n/**\r\n * Gets the high 32 bits as a signed integer.\r\n * @returns {number} Signed high bits\r\n */\r\nLongPrototype.getHighBits = function getHighBits() {\r\n return this.high;\r\n};\r\n\r\n/**\r\n * Gets the high 32 bits as an unsigned integer.\r\n * @returns {number} Unsigned high bits\r\n */\r\nLongPrototype.getHighBitsUnsigned = function getHighBitsUnsigned() {\r\n return this.high >>> 0;\r\n};\r\n\r\n/**\r\n * Gets the low 32 bits as a signed integer.\r\n * @returns {number} Signed low bits\r\n */\r\nLongPrototype.getLowBits = function getLowBits() {\r\n return this.low;\r\n};\r\n\r\n/**\r\n * Gets the low 32 bits as an unsigned integer.\r\n * @returns {number} Unsigned low bits\r\n */\r\nLongPrototype.getLowBitsUnsigned = function getLowBitsUnsigned() {\r\n return this.low >>> 0;\r\n};\r\n\r\n/**\r\n * Gets the number of bits needed to represent the absolute value of this Long.\r\n * @returns {number}\r\n */\r\nLongPrototype.getNumBitsAbs = function getNumBitsAbs() {\r\n if (this.isNegative()) // Unsigned Longs are never negative\r\n return this.eq(MIN_VALUE) ? 64 : this.neg().getNumBitsAbs();\r\n var val = this.high != 0 ? this.high : this.low;\r\n for (var bit = 31; bit > 0; bit--)\r\n if ((val & (1 << bit)) != 0)\r\n break;\r\n return this.high != 0 ? bit + 33 : bit + 1;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value equals zero.\r\n * @returns {boolean}\r\n */\r\nLongPrototype.isZero = function isZero() {\r\n return this.high === 0 && this.low === 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value equals zero. This is an alias of {@link Long#isZero}.\r\n * @returns {boolean}\r\n */\r\nLongPrototype.eqz = LongPrototype.isZero;\r\n\r\n/**\r\n * Tests if this Long's value is negative.\r\n * @returns {boolean}\r\n */\r\nLongPrototype.isNegative = function isNegative() {\r\n return !this.unsigned && this.high < 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value is positive.\r\n * @returns {boolean}\r\n */\r\nLongPrototype.isPositive = function isPositive() {\r\n return this.unsigned || this.high >= 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value is odd.\r\n * @returns {boolean}\r\n */\r\nLongPrototype.isOdd = function isOdd() {\r\n return (this.low & 1) === 1;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value is even.\r\n * @returns {boolean}\r\n */\r\nLongPrototype.isEven = function isEven() {\r\n return (this.low & 1) === 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value equals the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.equals = function equals(other) {\r\n if (!isLong(other))\r\n other = fromValue(other);\r\n if (this.unsigned !== other.unsigned && (this.high >>> 31) === 1 && (other.high >>> 31) === 1)\r\n return false;\r\n return this.high === other.high && this.low === other.low;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value equals the specified's. This is an alias of {@link Long#equals}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.eq = LongPrototype.equals;\r\n\r\n/**\r\n * Tests if this Long's value differs from the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.notEquals = function notEquals(other) {\r\n return !this.eq(/* validates */ other);\r\n};\r\n\r\n/**\r\n * Tests if this Long's value differs from the specified's. This is an alias of {@link Long#notEquals}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.neq = LongPrototype.notEquals;\r\n\r\n/**\r\n * Tests if this Long's value differs from the specified's. This is an alias of {@link Long#notEquals}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.ne = LongPrototype.notEquals;\r\n\r\n/**\r\n * Tests if this Long's value is less than the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.lessThan = function lessThan(other) {\r\n return this.comp(/* validates */ other) < 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value is less than the specified's. This is an alias of {@link Long#lessThan}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.lt = LongPrototype.lessThan;\r\n\r\n/**\r\n * Tests if this Long's value is less than or equal the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.lessThanOrEqual = function lessThanOrEqual(other) {\r\n return this.comp(/* validates */ other) <= 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value is less than or equal the specified's. This is an alias of {@link Long#lessThanOrEqual}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.lte = LongPrototype.lessThanOrEqual;\r\n\r\n/**\r\n * Tests if this Long's value is less than or equal the specified's. This is an alias of {@link Long#lessThanOrEqual}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.le = LongPrototype.lessThanOrEqual;\r\n\r\n/**\r\n * Tests if this Long's value is greater than the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.greaterThan = function greaterThan(other) {\r\n return this.comp(/* validates */ other) > 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value is greater than the specified's. This is an alias of {@link Long#greaterThan}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.gt = LongPrototype.greaterThan;\r\n\r\n/**\r\n * Tests if this Long's value is greater than or equal the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.greaterThanOrEqual = function greaterThanOrEqual(other) {\r\n return this.comp(/* validates */ other) >= 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value is greater than or equal the specified's. This is an alias of {@link Long#greaterThanOrEqual}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.gte = LongPrototype.greaterThanOrEqual;\r\n\r\n/**\r\n * Tests if this Long's value is greater than or equal the specified's. This is an alias of {@link Long#greaterThanOrEqual}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.ge = LongPrototype.greaterThanOrEqual;\r\n\r\n/**\r\n * Compares this Long's value with the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {number} 0 if they are the same, 1 if the this is greater and -1\r\n * if the given one is greater\r\n */\r\nLongPrototype.compare = function compare(other) {\r\n if (!isLong(other))\r\n other = fromValue(other);\r\n if (this.eq(other))\r\n return 0;\r\n var thisNeg = this.isNegative(),\r\n otherNeg = other.isNegative();\r\n if (thisNeg && !otherNeg)\r\n return -1;\r\n if (!thisNeg && otherNeg)\r\n return 1;\r\n // At this point the sign bits are the same\r\n if (!this.unsigned)\r\n return this.sub(other).isNegative() ? -1 : 1;\r\n // Both are positive if at least one is unsigned\r\n return (other.high >>> 0) > (this.high >>> 0) || (other.high === this.high && (other.low >>> 0) > (this.low >>> 0)) ? -1 : 1;\r\n};\r\n\r\n/**\r\n * Compares this Long's value with the specified's. This is an alias of {@link Long#compare}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {number} 0 if they are the same, 1 if the this is greater and -1\r\n * if the given one is greater\r\n */\r\nLongPrototype.comp = LongPrototype.compare;\r\n\r\n/**\r\n * Negates this Long's value.\r\n * @returns {!Long} Negated Long\r\n */\r\nLongPrototype.negate = function negate() {\r\n if (!this.unsigned && this.eq(MIN_VALUE))\r\n return MIN_VALUE;\r\n return this.not().add(ONE);\r\n};\r\n\r\n/**\r\n * Negates this Long's value. This is an alias of {@link Long#negate}.\r\n * @function\r\n * @returns {!Long} Negated Long\r\n */\r\nLongPrototype.neg = LongPrototype.negate;\r\n\r\n/**\r\n * Returns the sum of this and the specified Long.\r\n * @param {!Long|number|string} addend Addend\r\n * @returns {!Long} Sum\r\n */\r\nLongPrototype.add = function add(addend) {\r\n if (!isLong(addend))\r\n addend = fromValue(addend);\r\n\r\n // Divide each number into 4 chunks of 16 bits, and then sum the chunks.\r\n\r\n var a48 = this.high >>> 16;\r\n var a32 = this.high & 0xFFFF;\r\n var a16 = this.low >>> 16;\r\n var a00 = this.low & 0xFFFF;\r\n\r\n var b48 = addend.high >>> 16;\r\n var b32 = addend.high & 0xFFFF;\r\n var b16 = addend.low >>> 16;\r\n var b00 = addend.low & 0xFFFF;\r\n\r\n var c48 = 0, c32 = 0, c16 = 0, c00 = 0;\r\n c00 += a00 + b00;\r\n c16 += c00 >>> 16;\r\n c00 &= 0xFFFF;\r\n c16 += a16 + b16;\r\n c32 += c16 >>> 16;\r\n c16 &= 0xFFFF;\r\n c32 += a32 + b32;\r\n c48 += c32 >>> 16;\r\n c32 &= 0xFFFF;\r\n c48 += a48 + b48;\r\n c48 &= 0xFFFF;\r\n return fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns the difference of this and the specified Long.\r\n * @param {!Long|number|string} subtrahend Subtrahend\r\n * @returns {!Long} Difference\r\n */\r\nLongPrototype.subtract = function subtract(subtrahend) {\r\n if (!isLong(subtrahend))\r\n subtrahend = fromValue(subtrahend);\r\n return this.add(subtrahend.neg());\r\n};\r\n\r\n/**\r\n * Returns the difference of this and the specified Long. This is an alias of {@link Long#subtract}.\r\n * @function\r\n * @param {!Long|number|string} subtrahend Subtrahend\r\n * @returns {!Long} Difference\r\n */\r\nLongPrototype.sub = LongPrototype.subtract;\r\n\r\n/**\r\n * Returns the product of this and the specified Long.\r\n * @param {!Long|number|string} multiplier Multiplier\r\n * @returns {!Long} Product\r\n */\r\nLongPrototype.multiply = function multiply(multiplier) {\r\n if (this.isZero())\r\n return ZERO;\r\n if (!isLong(multiplier))\r\n multiplier = fromValue(multiplier);\r\n\r\n // use wasm support if present\r\n if (wasm) {\r\n var low = wasm.mul(this.low,\r\n this.high,\r\n multiplier.low,\r\n multiplier.high);\r\n return fromBits(low, wasm.get_high(), this.unsigned);\r\n }\r\n\r\n if (multiplier.isZero())\r\n return ZERO;\r\n if (this.eq(MIN_VALUE))\r\n return multiplier.isOdd() ? MIN_VALUE : ZERO;\r\n if (multiplier.eq(MIN_VALUE))\r\n return this.isOdd() ? MIN_VALUE : ZERO;\r\n\r\n if (this.isNegative()) {\r\n if (multiplier.isNegative())\r\n return this.neg().mul(multiplier.neg());\r\n else\r\n return this.neg().mul(multiplier).neg();\r\n } else if (multiplier.isNegative())\r\n return this.mul(multiplier.neg()).neg();\r\n\r\n // If both longs are small, use float multiplication\r\n if (this.lt(TWO_PWR_24) && multiplier.lt(TWO_PWR_24))\r\n return fromNumber(this.toNumber() * multiplier.toNumber(), this.unsigned);\r\n\r\n // Divide each long into 4 chunks of 16 bits, and then add up 4x4 products.\r\n // We can skip products that would overflow.\r\n\r\n var a48 = this.high >>> 16;\r\n var a32 = this.high & 0xFFFF;\r\n var a16 = this.low >>> 16;\r\n var a00 = this.low & 0xFFFF;\r\n\r\n var b48 = multiplier.high >>> 16;\r\n var b32 = multiplier.high & 0xFFFF;\r\n var b16 = multiplier.low >>> 16;\r\n var b00 = multiplier.low & 0xFFFF;\r\n\r\n var c48 = 0, c32 = 0, c16 = 0, c00 = 0;\r\n c00 += a00 * b00;\r\n c16 += c00 >>> 16;\r\n c00 &= 0xFFFF;\r\n c16 += a16 * b00;\r\n c32 += c16 >>> 16;\r\n c16 &= 0xFFFF;\r\n c16 += a00 * b16;\r\n c32 += c16 >>> 16;\r\n c16 &= 0xFFFF;\r\n c32 += a32 * b00;\r\n c48 += c32 >>> 16;\r\n c32 &= 0xFFFF;\r\n c32 += a16 * b16;\r\n c48 += c32 >>> 16;\r\n c32 &= 0xFFFF;\r\n c32 += a00 * b32;\r\n c48 += c32 >>> 16;\r\n c32 &= 0xFFFF;\r\n c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48;\r\n c48 &= 0xFFFF;\r\n return fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns the product of this and the specified Long. This is an alias of {@link Long#multiply}.\r\n * @function\r\n * @param {!Long|number|string} multiplier Multiplier\r\n * @returns {!Long} Product\r\n */\r\nLongPrototype.mul = LongPrototype.multiply;\r\n\r\n/**\r\n * Returns this Long divided by the specified. The result is signed if this Long is signed or\r\n * unsigned if this Long is unsigned.\r\n * @param {!Long|number|string} divisor Divisor\r\n * @returns {!Long} Quotient\r\n */\r\nLongPrototype.divide = function divide(divisor) {\r\n if (!isLong(divisor))\r\n divisor = fromValue(divisor);\r\n if (divisor.isZero())\r\n throw Error('division by zero');\r\n\r\n // use wasm support if present\r\n if (wasm) {\r\n // guard against signed division overflow: the largest\r\n // negative number / -1 would be 1 larger than the largest\r\n // positive number, due to two's complement.\r\n if (!this.unsigned &&\r\n this.high === -0x80000000 &&\r\n divisor.low === -1 && divisor.high === -1) {\r\n // be consistent with non-wasm code path\r\n return this;\r\n }\r\n var low = (this.unsigned ? wasm.div_u : wasm.div_s)(\r\n this.low,\r\n this.high,\r\n divisor.low,\r\n divisor.high\r\n );\r\n return fromBits(low, wasm.get_high(), this.unsigned);\r\n }\r\n\r\n if (this.isZero())\r\n return this.unsigned ? UZERO : ZERO;\r\n var approx, rem, res;\r\n if (!this.unsigned) {\r\n // This section is only relevant for signed longs and is derived from the\r\n // closure library as a whole.\r\n if (this.eq(MIN_VALUE)) {\r\n if (divisor.eq(ONE) || divisor.eq(NEG_ONE))\r\n return MIN_VALUE; // recall that -MIN_VALUE == MIN_VALUE\r\n else if (divisor.eq(MIN_VALUE))\r\n return ONE;\r\n else {\r\n // At this point, we have |other| >= 2, so |this/other| < |MIN_VALUE|.\r\n var halfThis = this.shr(1);\r\n approx = halfThis.div(divisor).shl(1);\r\n if (approx.eq(ZERO)) {\r\n return divisor.isNegative() ? ONE : NEG_ONE;\r\n } else {\r\n rem = this.sub(divisor.mul(approx));\r\n res = approx.add(rem.div(divisor));\r\n return res;\r\n }\r\n }\r\n } else if (divisor.eq(MIN_VALUE))\r\n return this.unsigned ? UZERO : ZERO;\r\n if (this.isNegative()) {\r\n if (divisor.isNegative())\r\n return this.neg().div(divisor.neg());\r\n return this.neg().div(divisor).neg();\r\n } else if (divisor.isNegative())\r\n return this.div(divisor.neg()).neg();\r\n res = ZERO;\r\n } else {\r\n // The algorithm below has not been made for unsigned longs. It's therefore\r\n // required to take special care of the MSB prior to running it.\r\n if (!divisor.unsigned)\r\n divisor = divisor.toUnsigned();\r\n if (divisor.gt(this))\r\n return UZERO;\r\n if (divisor.gt(this.shru(1))) // 15 >>> 1 = 7 ; with divisor = 8 ; true\r\n return UONE;\r\n res = UZERO;\r\n }\r\n\r\n // Repeat the following until the remainder is less than other: find a\r\n // floating-point that approximates remainder / other *from below*, add this\r\n // into the result, and subtract it from the remainder. It is critical that\r\n // the approximate value is less than or equal to the real value so that the\r\n // remainder never becomes negative.\r\n rem = this;\r\n while (rem.gte(divisor)) {\r\n // Approximate the result of division. This may be a little greater or\r\n // smaller than the actual value.\r\n approx = Math.max(1, Math.floor(rem.toNumber() / divisor.toNumber()));\r\n\r\n // We will tweak the approximate result by changing it in the 48-th digit or\r\n // the smallest non-fractional digit, whichever is larger.\r\n var log2 = Math.ceil(Math.log(approx) / Math.LN2),\r\n delta = (log2 <= 48) ? 1 : pow_dbl(2, log2 - 48),\r\n\r\n // Decrease the approximation until it is smaller than the remainder. Note\r\n // that if it is too large, the product overflows and is negative.\r\n approxRes = fromNumber(approx),\r\n approxRem = approxRes.mul(divisor);\r\n while (approxRem.isNegative() || approxRem.gt(rem)) {\r\n approx -= delta;\r\n approxRes = fromNumber(approx, this.unsigned);\r\n approxRem = approxRes.mul(divisor);\r\n }\r\n\r\n // We know the answer can't be zero... and actually, zero would cause\r\n // infinite recursion since we would make no progress.\r\n if (approxRes.isZero())\r\n approxRes = ONE;\r\n\r\n res = res.add(approxRes);\r\n rem = rem.sub(approxRem);\r\n }\r\n return res;\r\n};\r\n\r\n/**\r\n * Returns this Long divided by the specified. This is an alias of {@link Long#divide}.\r\n * @function\r\n * @param {!Long|number|string} divisor Divisor\r\n * @returns {!Long} Quotient\r\n */\r\nLongPrototype.div = LongPrototype.divide;\r\n\r\n/**\r\n * Returns this Long modulo the specified.\r\n * @param {!Long|number|string} divisor Divisor\r\n * @returns {!Long} Remainder\r\n */\r\nLongPrototype.modulo = function modulo(divisor) {\r\n if (!isLong(divisor))\r\n divisor = fromValue(divisor);\r\n\r\n // use wasm support if present\r\n if (wasm) {\r\n var low = (this.unsigned ? wasm.rem_u : wasm.rem_s)(\r\n this.low,\r\n this.high,\r\n divisor.low,\r\n divisor.high\r\n );\r\n return fromBits(low, wasm.get_high(), this.unsigned);\r\n }\r\n\r\n return this.sub(this.div(divisor).mul(divisor));\r\n};\r\n\r\n/**\r\n * Returns this Long modulo the specified. This is an alias of {@link Long#modulo}.\r\n * @function\r\n * @param {!Long|number|string} divisor Divisor\r\n * @returns {!Long} Remainder\r\n */\r\nLongPrototype.mod = LongPrototype.modulo;\r\n\r\n/**\r\n * Returns this Long modulo the specified. This is an alias of {@link Long#modulo}.\r\n * @function\r\n * @param {!Long|number|string} divisor Divisor\r\n * @returns {!Long} Remainder\r\n */\r\nLongPrototype.rem = LongPrototype.modulo;\r\n\r\n/**\r\n * Returns the bitwise NOT of this Long.\r\n * @returns {!Long}\r\n */\r\nLongPrototype.not = function not() {\r\n return fromBits(~this.low, ~this.high, this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns the bitwise AND of this Long and the specified.\r\n * @param {!Long|number|string} other Other Long\r\n * @returns {!Long}\r\n */\r\nLongPrototype.and = function and(other) {\r\n if (!isLong(other))\r\n other = fromValue(other);\r\n return fromBits(this.low & other.low, this.high & other.high, this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns the bitwise OR of this Long and the specified.\r\n * @param {!Long|number|string} other Other Long\r\n * @returns {!Long}\r\n */\r\nLongPrototype.or = function or(other) {\r\n if (!isLong(other))\r\n other = fromValue(other);\r\n return fromBits(this.low | other.low, this.high | other.high, this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns the bitwise XOR of this Long and the given one.\r\n * @param {!Long|number|string} other Other Long\r\n * @returns {!Long}\r\n */\r\nLongPrototype.xor = function xor(other) {\r\n if (!isLong(other))\r\n other = fromValue(other);\r\n return fromBits(this.low ^ other.low, this.high ^ other.high, this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns this Long with bits shifted to the left by the given amount.\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\nLongPrototype.shiftLeft = function shiftLeft(numBits) {\r\n if (isLong(numBits))\r\n numBits = numBits.toInt();\r\n if ((numBits &= 63) === 0)\r\n return this;\r\n else if (numBits < 32)\r\n return fromBits(this.low << numBits, (this.high << numBits) | (this.low >>> (32 - numBits)), this.unsigned);\r\n else\r\n return fromBits(0, this.low << (numBits - 32), this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns this Long with bits shifted to the left by the given amount. This is an alias of {@link Long#shiftLeft}.\r\n * @function\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\nLongPrototype.shl = LongPrototype.shiftLeft;\r\n\r\n/**\r\n * Returns this Long with bits arithmetically shifted to the right by the given amount.\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\nLongPrototype.shiftRight = function shiftRight(numBits) {\r\n if (isLong(numBits))\r\n numBits = numBits.toInt();\r\n if ((numBits &= 63) === 0)\r\n return this;\r\n else if (numBits < 32)\r\n return fromBits((this.low >>> numBits) | (this.high << (32 - numBits)), this.high >> numBits, this.unsigned);\r\n else\r\n return fromBits(this.high >> (numBits - 32), this.high >= 0 ? 0 : -1, this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns this Long with bits arithmetically shifted to the right by the given amount. This is an alias of {@link Long#shiftRight}.\r\n * @function\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\nLongPrototype.shr = LongPrototype.shiftRight;\r\n\r\n/**\r\n * Returns this Long with bits logically shifted to the right by the given amount.\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\nLongPrototype.shiftRightUnsigned = function shiftRightUnsigned(numBits) {\r\n if (isLong(numBits))\r\n numBits = numBits.toInt();\r\n numBits &= 63;\r\n if (numBits === 0)\r\n return this;\r\n else {\r\n var high = this.high;\r\n if (numBits < 32) {\r\n var low = this.low;\r\n return fromBits((low >>> numBits) | (high << (32 - numBits)), high >>> numBits, this.unsigned);\r\n } else if (numBits === 32)\r\n return fromBits(high, 0, this.unsigned);\r\n else\r\n return fromBits(high >>> (numBits - 32), 0, this.unsigned);\r\n }\r\n};\r\n\r\n/**\r\n * Returns this Long with bits logically shifted to the right by the given amount. This is an alias of {@link Long#shiftRightUnsigned}.\r\n * @function\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\nLongPrototype.shru = LongPrototype.shiftRightUnsigned;\r\n\r\n/**\r\n * Returns this Long with bits logically shifted to the right by the given amount. This is an alias of {@link Long#shiftRightUnsigned}.\r\n * @function\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\nLongPrototype.shr_u = LongPrototype.shiftRightUnsigned;\r\n\r\n/**\r\n * Converts this Long to signed.\r\n * @returns {!Long} Signed long\r\n */\r\nLongPrototype.toSigned = function toSigned() {\r\n if (!this.unsigned)\r\n return this;\r\n return fromBits(this.low, this.high, false);\r\n};\r\n\r\n/**\r\n * Converts this Long to unsigned.\r\n * @returns {!Long} Unsigned long\r\n */\r\nLongPrototype.toUnsigned = function toUnsigned() {\r\n if (this.unsigned)\r\n return this;\r\n return fromBits(this.low, this.high, true);\r\n};\r\n\r\n/**\r\n * Converts this Long to its byte representation.\r\n * @param {boolean=} le Whether little or big endian, defaults to big endian\r\n * @returns {!Array.} Byte representation\r\n */\r\nLongPrototype.toBytes = function toBytes(le) {\r\n return le ? this.toBytesLE() : this.toBytesBE();\r\n};\r\n\r\n/**\r\n * Converts this Long to its little endian byte representation.\r\n * @returns {!Array.} Little endian byte representation\r\n */\r\nLongPrototype.toBytesLE = function toBytesLE() {\r\n var hi = this.high,\r\n lo = this.low;\r\n return [\r\n lo & 0xff,\r\n lo >>> 8 & 0xff,\r\n lo >>> 16 & 0xff,\r\n lo >>> 24 ,\r\n hi & 0xff,\r\n hi >>> 8 & 0xff,\r\n hi >>> 16 & 0xff,\r\n hi >>> 24\r\n ];\r\n};\r\n\r\n/**\r\n * Converts this Long to its big endian byte representation.\r\n * @returns {!Array.} Big endian byte representation\r\n */\r\nLongPrototype.toBytesBE = function toBytesBE() {\r\n var hi = this.high,\r\n lo = this.low;\r\n return [\r\n hi >>> 24 ,\r\n hi >>> 16 & 0xff,\r\n hi >>> 8 & 0xff,\r\n hi & 0xff,\r\n lo >>> 24 ,\r\n lo >>> 16 & 0xff,\r\n lo >>> 8 & 0xff,\r\n lo & 0xff\r\n ];\r\n};\r\n\r\n/**\r\n * Creates a Long from its byte representation.\r\n * @param {!Array.} bytes Byte representation\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @param {boolean=} le Whether little or big endian, defaults to big endian\r\n * @returns {Long} The corresponding Long value\r\n */\r\nLong.fromBytes = function fromBytes(bytes, unsigned, le) {\r\n return le ? Long.fromBytesLE(bytes, unsigned) : Long.fromBytesBE(bytes, unsigned);\r\n};\r\n\r\n/**\r\n * Creates a Long from its little endian byte representation.\r\n * @param {!Array.} bytes Little endian byte representation\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @returns {Long} The corresponding Long value\r\n */\r\nLong.fromBytesLE = function fromBytesLE(bytes, unsigned) {\r\n return new Long(\r\n bytes[0] |\r\n bytes[1] << 8 |\r\n bytes[2] << 16 |\r\n bytes[3] << 24,\r\n bytes[4] |\r\n bytes[5] << 8 |\r\n bytes[6] << 16 |\r\n bytes[7] << 24,\r\n unsigned\r\n );\r\n};\r\n\r\n/**\r\n * Creates a Long from its big endian byte representation.\r\n * @param {!Array.} bytes Big endian byte representation\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @returns {Long} The corresponding Long value\r\n */\r\nLong.fromBytesBE = function fromBytesBE(bytes, unsigned) {\r\n return new Long(\r\n bytes[4] << 24 |\r\n bytes[5] << 16 |\r\n bytes[6] << 8 |\r\n bytes[7],\r\n bytes[0] << 24 |\r\n bytes[1] << 16 |\r\n bytes[2] << 8 |\r\n bytes[3],\r\n unsigned\r\n );\r\n};\r\n\n\n//# sourceURL=webpack:///./node_modules/long/src/long.js?"); + +/***/ }), + +/***/ "./node_modules/node-libs-browser/mock/empty.js": +/*!******************************************************!*\ + !*** ./node_modules/node-libs-browser/mock/empty.js ***! + \******************************************************/ +/*! no static exports found */ +/*! ModuleConcatenation bailout: Module is not an ECMAScript module */ +/***/ (function(module, exports) { + +eval("\n\n//# sourceURL=webpack:///./node_modules/node-libs-browser/mock/empty.js?"); + +/***/ }), + +/***/ "./node_modules/os-browserify/browser.js": +/*!***********************************************!*\ + !*** ./node_modules/os-browserify/browser.js ***! + \***********************************************/ +/*! no static exports found */ +/*! ModuleConcatenation bailout: Module is not an ECMAScript module */ +/***/ (function(module, exports) { + +eval("exports.endianness = function () { return 'LE' };\n\nexports.hostname = function () {\n if (typeof location !== 'undefined') {\n return location.hostname\n }\n else return '';\n};\n\nexports.loadavg = function () { return [] };\n\nexports.uptime = function () { return 0 };\n\nexports.freemem = function () {\n return Number.MAX_VALUE;\n};\n\nexports.totalmem = function () {\n return Number.MAX_VALUE;\n};\n\nexports.cpus = function () { return [] };\n\nexports.type = function () { return 'Browser' };\n\nexports.release = function () {\n if (typeof navigator !== 'undefined') {\n return navigator.appVersion;\n }\n return '';\n};\n\nexports.networkInterfaces\n= exports.getNetworkInterfaces\n= function () { return {} };\n\nexports.arch = function () { return 'javascript' };\n\nexports.platform = function () { return 'browser' };\n\nexports.tmpdir = exports.tmpDir = function () {\n return '/tmp';\n};\n\nexports.EOL = '\\n';\n\nexports.homedir = function () {\n\treturn '/'\n};\n\n\n//# sourceURL=webpack:///./node_modules/os-browserify/browser.js?"); + +/***/ }), + +/***/ "./node_modules/path-browserify/index.js": +/*!***********************************************!*\ + !*** ./node_modules/path-browserify/index.js ***! + \***********************************************/ +/*! no static exports found */ +/*! 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?"); + +/***/ }), + +/***/ "./node_modules/process/browser.js": +/*!*****************************************!*\ + !*** ./node_modules/process/browser.js ***! + \*****************************************/ +/*! no static exports found */ +/*! ModuleConcatenation bailout: Module is not an ECMAScript module */ +/***/ (function(module, exports) { + +eval("// shim for using process in browser\nvar process = module.exports = {};\n\n// cached from whatever global is present so that test runners that stub it\n// don't break things. But we need to wrap it in a try catch in case it is\n// wrapped in strict mode code which doesn't define any globals. It's inside a\n// function because try/catches deoptimize in certain engines.\n\nvar cachedSetTimeout;\nvar cachedClearTimeout;\n\nfunction defaultSetTimout() {\n throw new Error('setTimeout has not been defined');\n}\nfunction defaultClearTimeout () {\n throw new Error('clearTimeout has not been defined');\n}\n(function () {\n try {\n if (typeof setTimeout === 'function') {\n cachedSetTimeout = setTimeout;\n } else {\n cachedSetTimeout = defaultSetTimout;\n }\n } catch (e) {\n cachedSetTimeout = defaultSetTimout;\n }\n try {\n if (typeof clearTimeout === 'function') {\n cachedClearTimeout = clearTimeout;\n } else {\n cachedClearTimeout = defaultClearTimeout;\n }\n } catch (e) {\n cachedClearTimeout = defaultClearTimeout;\n }\n} ())\nfunction runTimeout(fun) {\n if (cachedSetTimeout === setTimeout) {\n //normal enviroments in sane situations\n return setTimeout(fun, 0);\n }\n // if setTimeout wasn't available but was latter defined\n if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {\n cachedSetTimeout = setTimeout;\n return setTimeout(fun, 0);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedSetTimeout(fun, 0);\n } catch(e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedSetTimeout.call(null, fun, 0);\n } catch(e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error\n return cachedSetTimeout.call(this, fun, 0);\n }\n }\n\n\n}\nfunction runClearTimeout(marker) {\n if (cachedClearTimeout === clearTimeout) {\n //normal enviroments in sane situations\n return clearTimeout(marker);\n }\n // if clearTimeout wasn't available but was latter defined\n if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {\n cachedClearTimeout = clearTimeout;\n return clearTimeout(marker);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedClearTimeout(marker);\n } catch (e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedClearTimeout.call(null, marker);\n } catch (e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.\n // Some versions of I.E. have different rules for clearTimeout vs setTimeout\n return cachedClearTimeout.call(this, marker);\n }\n }\n\n\n\n}\nvar queue = [];\nvar draining = false;\nvar currentQueue;\nvar queueIndex = -1;\n\nfunction cleanUpNextTick() {\n if (!draining || !currentQueue) {\n return;\n }\n draining = false;\n if (currentQueue.length) {\n queue = currentQueue.concat(queue);\n } else {\n queueIndex = -1;\n }\n if (queue.length) {\n drainQueue();\n }\n}\n\nfunction drainQueue() {\n if (draining) {\n return;\n }\n var timeout = runTimeout(cleanUpNextTick);\n draining = true;\n\n var len = queue.length;\n while(len) {\n currentQueue = queue;\n queue = [];\n while (++queueIndex < len) {\n if (currentQueue) {\n currentQueue[queueIndex].run();\n }\n }\n queueIndex = -1;\n len = queue.length;\n }\n currentQueue = null;\n draining = false;\n runClearTimeout(timeout);\n}\n\nprocess.nextTick = function (fun) {\n var args = new Array(arguments.length - 1);\n if (arguments.length > 1) {\n for (var i = 1; i < arguments.length; i++) {\n args[i - 1] = arguments[i];\n }\n }\n queue.push(new Item(fun, args));\n if (queue.length === 1 && !draining) {\n runTimeout(drainQueue);\n }\n};\n\n// v8 likes predictible objects\nfunction Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}\nItem.prototype.run = function () {\n this.fun.apply(null, this.array);\n};\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\nprocess.version = ''; // empty string to avoid regexp issues\nprocess.versions = {};\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\nprocess.prependListener = noop;\nprocess.prependOnceListener = noop;\n\nprocess.listeners = function (name) { return [] }\n\nprocess.binding = function (name) {\n throw new Error('process.binding is not supported');\n};\n\nprocess.cwd = function () { return '/' };\nprocess.chdir = function (dir) {\n throw new Error('process.chdir is not supported');\n};\nprocess.umask = function() { return 0; };\n\n\n//# sourceURL=webpack:///./node_modules/process/browser.js?"); + +/***/ }), + +/***/ "./node_modules/querystring-es3/decode.js": +/*!************************************************!*\ + !*** ./node_modules/querystring-es3/decode.js ***! + \************************************************/ +/*! no static exports found */ +/*! ModuleConcatenation bailout: Module is not an ECMAScript module */ +/***/ (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\n// If obj.hasOwnProperty has been overridden, then calling\n// obj.hasOwnProperty(prop) will break.\n// See: https://github.com/joyent/node/issues/1707\nfunction hasOwnProperty(obj, prop) {\n return Object.prototype.hasOwnProperty.call(obj, prop);\n}\n\nmodule.exports = function(qs, sep, eq, options) {\n sep = sep || '&';\n eq = eq || '=';\n var obj = {};\n\n if (typeof qs !== 'string' || qs.length === 0) {\n return obj;\n }\n\n var regexp = /\\+/g;\n qs = qs.split(sep);\n\n var maxKeys = 1000;\n if (options && typeof options.maxKeys === 'number') {\n maxKeys = options.maxKeys;\n }\n\n var len = qs.length;\n // maxKeys <= 0 means that we should not limit keys count\n if (maxKeys > 0 && len > maxKeys) {\n len = maxKeys;\n }\n\n for (var i = 0; i < len; ++i) {\n var x = qs[i].replace(regexp, '%20'),\n idx = x.indexOf(eq),\n kstr, vstr, k, v;\n\n if (idx >= 0) {\n kstr = x.substr(0, idx);\n vstr = x.substr(idx + 1);\n } else {\n kstr = x;\n vstr = '';\n }\n\n k = decodeURIComponent(kstr);\n v = decodeURIComponent(vstr);\n\n if (!hasOwnProperty(obj, k)) {\n obj[k] = v;\n } else if (isArray(obj[k])) {\n obj[k].push(v);\n } else {\n obj[k] = [obj[k], v];\n }\n }\n\n return obj;\n};\n\nvar isArray = Array.isArray || function (xs) {\n return Object.prototype.toString.call(xs) === '[object Array]';\n};\n\n\n//# sourceURL=webpack:///./node_modules/querystring-es3/decode.js?"); + +/***/ }), + +/***/ "./node_modules/querystring-es3/encode.js": +/*!************************************************!*\ + !*** ./node_modules/querystring-es3/encode.js ***! + \************************************************/ +/*! no static exports found */ +/*! ModuleConcatenation bailout: Module is not an ECMAScript module */ +/***/ (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 stringifyPrimitive = function(v) {\n switch (typeof v) {\n case 'string':\n return v;\n\n case 'boolean':\n return v ? 'true' : 'false';\n\n case 'number':\n return isFinite(v) ? v : '';\n\n default:\n return '';\n }\n};\n\nmodule.exports = function(obj, sep, eq, name) {\n sep = sep || '&';\n eq = eq || '=';\n if (obj === null) {\n obj = undefined;\n }\n\n if (typeof obj === 'object') {\n return map(objectKeys(obj), function(k) {\n var ks = encodeURIComponent(stringifyPrimitive(k)) + eq;\n if (isArray(obj[k])) {\n return map(obj[k], function(v) {\n return ks + encodeURIComponent(stringifyPrimitive(v));\n }).join(sep);\n } else {\n return ks + encodeURIComponent(stringifyPrimitive(obj[k]));\n }\n }).join(sep);\n\n }\n\n if (!name) return '';\n return encodeURIComponent(stringifyPrimitive(name)) + eq +\n encodeURIComponent(stringifyPrimitive(obj));\n};\n\nvar isArray = Array.isArray || function (xs) {\n return Object.prototype.toString.call(xs) === '[object Array]';\n};\n\nfunction map (xs, f) {\n if (xs.map) return xs.map(f);\n var res = [];\n for (var i = 0; i < xs.length; i++) {\n res.push(f(xs[i], i));\n }\n return res;\n}\n\nvar objectKeys = Object.keys || function (obj) {\n var res = [];\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) res.push(key);\n }\n return res;\n};\n\n\n//# sourceURL=webpack:///./node_modules/querystring-es3/encode.js?"); + +/***/ }), + +/***/ "./node_modules/querystring-es3/index.js": +/*!***********************************************!*\ + !*** ./node_modules/querystring-es3/index.js ***! + \***********************************************/ +/*! no static exports found */ +/*! ModuleConcatenation bailout: Module is not an ECMAScript module */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +eval("\n\nexports.decode = exports.parse = __webpack_require__(/*! ./decode */ \"./node_modules/querystring-es3/decode.js\");\nexports.encode = exports.stringify = __webpack_require__(/*! ./encode */ \"./node_modules/querystring-es3/encode.js\");\n\n\n//# sourceURL=webpack:///./node_modules/querystring-es3/index.js?"); + +/***/ }), + +/***/ "./node_modules/snekfetch/esm.mjs": +/*!****************************************!*\ + !*** ./node_modules/snekfetch/esm.mjs ***! + \****************************************/ +/*! exports provided: default, version, METHODS, acl, bind, checkout, connect, copy, delete, get, head, link, lock, merge, mkactivity, mkcalendar, mkcol, move, notify, options, patch, post, propfind, proppatch, purge, put, rebind, report, search, subscribe, trace, unbind, unlink, unlock, unsubscribe, brew */ +/*! ModuleConcatenation bailout: Module is referenced from these modules with unsupported syntax: ./src/client/ClientDataResolver.js (referenced with cjs require), ./src/client/rest/APIRequest.js (referenced with cjs require), ./src/util/Util.js (referenced with cjs require) */ +/***/ (function(__webpack_module__, __webpack_exports__, __webpack_require__) { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"version\", function() { return version; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"METHODS\", function() { return METHODS; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"acl\", function() { return acl; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"bind\", function() { return bind; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"checkout\", function() { return checkout; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"connect\", function() { return connect; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"copy\", function() { return copy; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"delete\", function() { return _delete; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"get\", function() { return get; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"head\", function() { return head; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"link\", function() { return link; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"lock\", function() { return lock; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"merge\", function() { return merge; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"mkactivity\", function() { return mkactivity; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"mkcalendar\", function() { return mkcalendar; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"mkcol\", function() { return mkcol; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"move\", function() { return move; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"notify\", function() { return notify; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"options\", function() { return options; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"patch\", function() { return patch; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"post\", function() { return post; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"propfind\", function() { return propfind; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"proppatch\", function() { return proppatch; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"purge\", function() { return purge; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"put\", function() { return put; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"rebind\", function() { return rebind; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"report\", function() { return report; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"search\", function() { return search; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"subscribe\", function() { return subscribe; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"trace\", function() { return trace; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"unbind\", function() { return unbind; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"unlink\", function() { return unlink; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"unlock\", function() { return unlock; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"unsubscribe\", function() { return unsubscribe; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"brew\", function() { return brew; });\n/* harmony import */ var _index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./index.js */ \"./node_modules/snekfetch/index.js\");\n\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (_index_js__WEBPACK_IMPORTED_MODULE_0__);\n\nconst version = _index_js__WEBPACK_IMPORTED_MODULE_0__.version;\nconst METHODS = _index_js__WEBPACK_IMPORTED_MODULE_0__.METHODS;\n\nconst acl = _index_js__WEBPACK_IMPORTED_MODULE_0__.acl;\nconst bind = _index_js__WEBPACK_IMPORTED_MODULE_0__.bind;\nconst checkout = _index_js__WEBPACK_IMPORTED_MODULE_0__.checkout;\nconst connect = _index_js__WEBPACK_IMPORTED_MODULE_0__.connect;\nconst copy = _index_js__WEBPACK_IMPORTED_MODULE_0__.copy;\nconst _delete = _index_js__WEBPACK_IMPORTED_MODULE_0__.delete;\n\nconst get = _index_js__WEBPACK_IMPORTED_MODULE_0__.get;\nconst head = _index_js__WEBPACK_IMPORTED_MODULE_0__.head;\nconst link = _index_js__WEBPACK_IMPORTED_MODULE_0__.link;\nconst lock = _index_js__WEBPACK_IMPORTED_MODULE_0__.lock;\nconst merge = _index_js__WEBPACK_IMPORTED_MODULE_0__.merge;\nconst mkactivity = _index_js__WEBPACK_IMPORTED_MODULE_0__.mkactivity;\nconst mkcalendar = _index_js__WEBPACK_IMPORTED_MODULE_0__.mkcalendar;\nconst mkcol = _index_js__WEBPACK_IMPORTED_MODULE_0__.mkcol;\nconst move = _index_js__WEBPACK_IMPORTED_MODULE_0__.move;\nconst notify = _index_js__WEBPACK_IMPORTED_MODULE_0__.notify;\nconst options = _index_js__WEBPACK_IMPORTED_MODULE_0__.options;\nconst patch = _index_js__WEBPACK_IMPORTED_MODULE_0__.patch;\nconst post = _index_js__WEBPACK_IMPORTED_MODULE_0__.post;\nconst propfind = _index_js__WEBPACK_IMPORTED_MODULE_0__.propfind;\nconst proppatch = _index_js__WEBPACK_IMPORTED_MODULE_0__.proppatch;\nconst purge = _index_js__WEBPACK_IMPORTED_MODULE_0__.purge;\nconst put = _index_js__WEBPACK_IMPORTED_MODULE_0__.put;\nconst rebind = _index_js__WEBPACK_IMPORTED_MODULE_0__.rebind;\nconst report = _index_js__WEBPACK_IMPORTED_MODULE_0__.report;\nconst search = _index_js__WEBPACK_IMPORTED_MODULE_0__.search;\nconst subscribe = _index_js__WEBPACK_IMPORTED_MODULE_0__.subscribe;\nconst trace = _index_js__WEBPACK_IMPORTED_MODULE_0__.trace;\nconst unbind = _index_js__WEBPACK_IMPORTED_MODULE_0__.unbind;\nconst unlink = _index_js__WEBPACK_IMPORTED_MODULE_0__.unlink;\nconst unlock = _index_js__WEBPACK_IMPORTED_MODULE_0__.unlock;\nconst unsubscribe = _index_js__WEBPACK_IMPORTED_MODULE_0__.unsubscribe;\nconst brew = _index_js__WEBPACK_IMPORTED_MODULE_0__.brew;\n\n\n//# sourceURL=webpack:///./node_modules/snekfetch/esm.mjs?"); + +/***/ }), + +/***/ "./node_modules/snekfetch/index.js": +/*!*****************************************!*\ + !*** ./node_modules/snekfetch/index.js ***! + \*****************************************/ +/*! no static exports found */ +/*! ModuleConcatenation bailout: Module is not an ECMAScript module */ +/***/ (function(module, exports, __webpack_require__) { + +eval("module.exports = __webpack_require__(/*! ./src */ \"./node_modules/snekfetch/src/index.js\");\n\n\n//# sourceURL=webpack:///./node_modules/snekfetch/index.js?"); + +/***/ }), + +/***/ "./node_modules/snekfetch/src/browser.js": +/*!***********************************************!*\ + !*** ./node_modules/snekfetch/src/browser.js ***! + \***********************************************/ +/*! no static exports found */ +/*! ModuleConcatenation bailout: Module is not an ECMAScript module */ +/***/ (function(module, exports) { + +eval("function buildRequest(method, url) {\n return {\n method,\n path: url,\n redirect: this.options.followRedirects ? 'follow' : 'manual',\n headers: {},\n setHeader(name, value) {\n this.headers[name.toLowerCase()] = value;\n },\n getHeader(name) {\n return this.headers[name.toLowerCase()];\n },\n };\n}\n\nfunction finalizeRequest() {\n this._finalizeRequest();\n if (this.data)\n this.request.body = this.data;\n return window.fetch(this.request.path, this.request)\n .then((r) => r.text().then((t) => {\n const headers = {};\n for (const [k, v] of r.headers.entries())\n headers[k.toLowerCase()] = v;\n return { response: r, raw: t, headers };\n }));\n}\n\nmodule.exports = {\n buildRequest, finalizeRequest,\n shouldSendRaw: () => false,\n METHODS: ['GET', 'HEAD', 'POST', 'PUT', 'DELETE', 'CONNECT', 'OPTIONS', 'PATCH'],\n STATUS_CODES: {},\n Extension: Object,\n FormData: window.FormData,\n};\n\n\n//# sourceURL=webpack:///./node_modules/snekfetch/src/browser.js?"); + +/***/ }), + +/***/ "./node_modules/snekfetch/src/index.js": +/*!*********************************************!*\ + !*** ./node_modules/snekfetch/src/index.js ***! + \*********************************************/ +/*! no static exports found */ +/*! ModuleConcatenation bailout: Module is not an ECMAScript module */ +/***/ (function(module, exports, __webpack_require__) { + +eval("const browser = typeof window !== 'undefined';\nconst querystring = __webpack_require__(/*! querystring */ \"./node_modules/querystring-es3/index.js\");\nconst transport = browser ? __webpack_require__(/*! ./browser */ \"./node_modules/snekfetch/src/browser.js\") : __webpack_require__(/*! ./node */ 0);\n\n/**\n * Snekfetch\n * @extends Stream.Readable\n * @extends Promise\n */\nclass Snekfetch extends transport.Extension {\n /**\n * Options to pass to the Snekfetch constructor\n * @typedef {object} SnekfetchOptions\n * @memberof Snekfetch\n * @property {object} [headers] Headers to initialize the request with\n * @property {object|string|Buffer} [data] Data to initialize the request with\n * @property {string|Object} [query] Query to intialize the request with\n * @property {boolean} [followRedirects=true] If the request should follow redirects\n * @property {object} [qs=querystring] Querystring module to use, any object providing\n * `stringify` and `parse` for querystrings\n * @property {number} [version = 1] The http version to use [1 or 2]\n * @property {external:Agent} [agent] Whether to use an http agent\n */\n\n /**\n * Create a request.\n * Usually you'll want to do `Snekfetch#method(url [, options])` instead of\n * `new Snekfetch(method, url [, options])`\n * @param {string} method HTTP method\n * @param {string} url URL\n * @param {SnekfetchOptions} [opts] Options\n */\n constructor(method, url, opts = {}) {\n super();\n this.options = Object.assign({ version: 1, qs: querystring, followRedirects: true }, opts);\n this.request = transport.buildRequest.call(this, method, url, opts);\n if (opts.headers)\n this.set(opts.headers);\n if (opts.query)\n this.query(opts.query);\n if (opts.data)\n this.send(opts.data);\n }\n\n /**\n * Add a query param to the request\n * @param {string|Object} name Name of query param or object to add to query\n * @param {string} [value] If name is a string value, this will be the value of the query param\n * @returns {Snekfetch} This request\n */\n query(name, value) {\n if (!this.request.query)\n this.request.query = {};\n if (name !== null && typeof name === 'object') {\n for (const [k, v] of Object.entries(name))\n this.query(k, v);\n } else {\n this.request.query[name] = value;\n }\n\n return this;\n }\n\n /**\n * Add a header to the request\n * @param {string|Object} name Name of query param or object to add to headers\n * @param {string} [value] If name is a string value, this will be the value of the header\n * @returns {Snekfetch} This request\n */\n set(name, value) {\n if (name !== null && typeof name === 'object') {\n for (const key of Object.keys(name))\n this.set(key, name[key]);\n } else {\n this.request.setHeader(name, value);\n }\n\n return this;\n }\n\n /**\n * Attach a form data object\n * @param {string} name Name of the form attachment\n * @param {string|Object|Buffer} data Data for the attachment\n * @param {string} [filename] Optional filename if form attachment name needs to be overridden\n * @returns {Snekfetch} This request\n */\n attach(...args) {\n const form = this.data instanceof transport.FormData ? this.data : this.data = new transport.FormData();\n if (typeof args[0] === 'object') {\n for (const [k, v] of Object.entries(args[0]))\n this.attach(k, v);\n } else {\n form.append(...args);\n }\n\n return this;\n }\n\n /**\n * Send data with the request\n * @param {string|Buffer|Object} data Data to send\n * @returns {Snekfetch} This request\n */\n send(data) {\n if (data instanceof transport.FormData || transport.shouldSendRaw(data)) {\n this.data = data;\n } else if (data !== null && typeof data === 'object') {\n const header = this.request.getHeader('content-type');\n let serialize;\n if (header) {\n if (header.includes('json'))\n serialize = JSON.stringify;\n else if (header.includes('urlencoded'))\n serialize = this.options.qs.stringify;\n } else {\n this.set('Content-Type', 'application/json');\n serialize = JSON.stringify;\n }\n this.data = serialize(data);\n } else {\n this.data = data;\n }\n return this;\n }\n\n then(resolver, rejector) {\n if (this._response)\n return this._response.then(resolver, rejector);\n // eslint-disable-next-line no-return-assign\n return this._response = transport.finalizeRequest.call(this)\n .then(({ response, raw, redirect, headers }) => {\n if (redirect) {\n let method = this.request.method;\n if ([301, 302].includes(response.statusCode)) {\n if (method !== 'HEAD')\n method = 'GET';\n this.data = null;\n } else if (response.statusCode === 303) {\n method = 'GET';\n }\n\n const redirectHeaders = this.request.getHeaders();\n delete redirectHeaders.host;\n return new Snekfetch(method, redirect, {\n data: this.data,\n headers: redirectHeaders,\n version: this.options.version,\n });\n }\n\n const statusCode = response.statusCode || response.status;\n // forgive me :(\n const self = this; // eslint-disable-line consistent-this\n /**\n * Response from Snekfetch\n * @typedef {Object} SnekfetchResponse\n * @memberof Snekfetch\n * @prop {HTTP.Request} request\n * @prop {?string|object|Buffer} body Processed response body\n * @prop {string} text Raw response body\n * @prop {boolean} ok If the response code is >= 200 and < 300\n * @prop {number} status HTTP status code\n * @prop {string} statusText Human readable HTTP status\n */\n const res = {\n request: this.request,\n get body() {\n delete res.body;\n const type = this.headers['content-type'];\n if (type && type.includes('application/json')) {\n try {\n res.body = JSON.parse(res.text);\n } catch (err) {\n res.body = res.text;\n }\n } else if (type && type.includes('application/x-www-form-urlencoded')) {\n res.body = self.options.qs.parse(res.text);\n } else {\n res.body = raw;\n }\n\n return res.body;\n },\n text: raw.toString(),\n ok: statusCode >= 200 && statusCode < 400,\n headers: headers || response.headers,\n status: statusCode,\n statusText: response.statusText || transport.STATUS_CODES[response.statusCode],\n };\n\n if (res.ok) {\n return res;\n } else {\n const err = new Error(`${res.status} ${res.statusText}`.trim());\n Object.assign(err, res);\n return Promise.reject(err);\n }\n })\n .then(resolver, rejector);\n }\n\n catch(rejector) {\n return this.then(null, rejector);\n }\n\n /**\n * End the request\n * @param {Function} [cb] Optional callback to handle the response\n * @returns {Promise} This request\n */\n end(cb) {\n return this.then(\n (res) => cb ? cb(null, res) : res,\n (err) => cb ? cb(err, err.status ? err : null) : Promise.reject(err)\n );\n }\n\n _finalizeRequest() {\n if (!this.request)\n return;\n\n if (this.request.method !== 'HEAD')\n this.set('Accept-Encoding', 'gzip, deflate');\n if (this.data && this.data.getBoundary)\n this.set('Content-Type', `multipart/form-data; boundary=${this.data.getBoundary()}`);\n\n if (this.request.query) {\n const [path, query] = this.request.path.split('?');\n this.request.path = `${path}?${this.options.qs.stringify(this.request.query)}${query ? `&${query}` : ''}`;\n }\n }\n}\n\n/**\n * Create a ((THIS)) request\n * @dynamic this.METHODS\n * @method Snekfetch.((THIS)lowerCase)\n * @param {string} url The url to request\n * @param {Snekfetch.snekfetchOptions} [opts] Options\n * @returns {Snekfetch}\n */\nSnekfetch.METHODS = transport.METHODS.concat('BREW').filter((m) => m !== 'M-SEARCH');\nfor (const method of Snekfetch.METHODS) {\n Snekfetch[method.toLowerCase()] = function runMethod(url, opts) {\n const Constructor = this.prototype instanceof Snekfetch ? this : Snekfetch;\n return new Constructor(method, url, opts);\n };\n}\n\nmodule.exports = Snekfetch;\n\n/**\n * @external Agent\n * @see {@link https://nodejs.org/api/http.html#http_class_http_agent}\n */\n\n\n//# sourceURL=webpack:///./node_modules/snekfetch/src/index.js?"); + +/***/ }), + +/***/ "./node_modules/util/support/isBufferBrowser.js": +/*!******************************************************!*\ + !*** ./node_modules/util/support/isBufferBrowser.js ***! + \******************************************************/ +/*! no static exports found */ +/*! ModuleConcatenation bailout: Module is not an ECMAScript module */ +/***/ (function(module, exports) { + +eval("module.exports = function isBuffer(arg) {\n return arg && typeof arg === 'object'\n && typeof arg.copy === 'function'\n && typeof arg.fill === 'function'\n && typeof arg.readUInt8 === 'function';\n}\n\n//# sourceURL=webpack:///./node_modules/util/support/isBufferBrowser.js?"); + +/***/ }), + +/***/ "./node_modules/util/util.js": +/*!***********************************!*\ + !*** ./node_modules/util/util.js ***! + \***********************************/ +/*! no static exports found */ +/*! 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?"); + +/***/ }), + +/***/ "./node_modules/webpack/buildin/global.js": +/*!***********************************!*\ + !*** (webpack)/buildin/global.js ***! + \***********************************/ +/*! no static exports found */ +/*! ModuleConcatenation bailout: Module is not an ECMAScript module */ +/***/ (function(module, exports) { + +eval("var g;\n\n// This works in non-strict mode\ng = (function() {\n\treturn this;\n})();\n\ntry {\n\t// This works if eval is allowed (see CSP)\n\tg = g || new Function(\"return this\")();\n} catch (e) {\n\t// This works if the window reference is available\n\tif (typeof window === \"object\") g = window;\n}\n\n// g can still be undefined, but nothing to do about it...\n// We return undefined, instead of nothing here, so it's\n// easier to handle this case. if(!global) { ...}\n\nmodule.exports = g;\n\n\n//# sourceURL=webpack:///(webpack)/buildin/global.js?"); + +/***/ }), + +/***/ "./package.json": +/*!**********************!*\ + !*** ./package.json ***! + \**********************/ +/*! exports provided: name, version, description, main, types, scripts, repository, keywords, author, license, bugs, homepage, runkitExampleFilename, dependencies, peerDependencies, peerDependenciesMeta, devDependencies, engines, browser, default */ +/*! 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?"); + +/***/ }), + +/***/ "./src/client/Client.js": +/*!******************************!*\ + !*** ./src/client/Client.js ***! + \******************************/ +/*! no static exports found */ +/*! 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?"); + +/***/ }), + +/***/ "./src/client/ClientDataManager.js": +/*!*****************************************!*\ + !*** ./src/client/ClientDataManager.js ***! + \*****************************************/ +/*! no static exports found */ +/*! 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/Util */ \"./src/util/Util.js\");\nconst Guild = __webpack_require__(/*! ../structures/Guild */ \"./src/structures/Guild.js\");\nconst User = __webpack_require__(/*! ../structures/User */ \"./src/structures/User.js\");\nconst Emoji = __webpack_require__(/*! ../structures/Emoji */ \"./src/structures/Emoji.js\");\nconst GuildChannel = __webpack_require__(/*! ../structures/GuildChannel */ \"./src/structures/GuildChannel.js\");\nconst TextChannel = __webpack_require__(/*! ../structures/TextChannel */ \"./src/structures/TextChannel.js\");\nconst VoiceChannel = __webpack_require__(/*! ../structures/VoiceChannel */ \"./src/structures/VoiceChannel.js\");\nconst CategoryChannel = __webpack_require__(/*! ../structures/CategoryChannel */ \"./src/structures/CategoryChannel.js\");\nconst NewsChannel = __webpack_require__(/*! ../structures/NewsChannel */ \"./src/structures/NewsChannel.js\");\nconst StoreChannel = __webpack_require__(/*! ../structures/StoreChannel */ \"./src/structures/StoreChannel.js\");\nconst DMChannel = __webpack_require__(/*! ../structures/DMChannel */ \"./src/structures/DMChannel.js\");\nconst GroupDMChannel = __webpack_require__(/*! ../structures/GroupDMChannel */ \"./src/structures/GroupDMChannel.js\");\n\nclass ClientDataManager {\n constructor(client) {\n this.client = client;\n }\n\n get pastReady() {\n return this.client.ws.connection.status === Constants.Status.READY;\n }\n\n newGuild(data) {\n const already = this.client.guilds.has(data.id);\n const guild = new Guild(this.client, data);\n this.client.guilds.set(guild.id, guild);\n if (this.pastReady && !already) {\n /**\n * Emitted whenever the client joins a guild.\n * @event Client#guildCreate\n * @param {Guild} guild The created guild\n */\n if (this.client.options.fetchAllMembers) {\n guild.fetchMembers().then(() => { this.client.emit(Constants.Events.GUILD_CREATE, guild); });\n } else {\n this.client.emit(Constants.Events.GUILD_CREATE, guild);\n }\n }\n\n return guild;\n }\n\n newUser(data, cache = true) {\n if (this.client.users.has(data.id)) return this.client.users.get(data.id);\n const user = new User(this.client, data);\n if (cache) this.client.users.set(user.id, user);\n return user;\n }\n\n newChannel(data, guild) {\n const already = this.client.channels.has(data.id);\n let channel;\n if (data.type === Constants.ChannelTypes.DM) {\n channel = new DMChannel(this.client, data);\n } else if (data.type === Constants.ChannelTypes.GROUP_DM) {\n channel = new GroupDMChannel(this.client, data);\n } else {\n guild = guild || this.client.guilds.get(data.guild_id);\n if (already) {\n channel = this.client.channels.get(data.id);\n } else if (guild) {\n switch (data.type) {\n case Constants.ChannelTypes.TEXT:\n channel = new TextChannel(guild, data);\n break;\n case Constants.ChannelTypes.VOICE:\n channel = new VoiceChannel(guild, data);\n break;\n case Constants.ChannelTypes.CATEGORY:\n channel = new CategoryChannel(guild, data);\n break;\n case Constants.ChannelTypes.NEWS:\n channel = new NewsChannel(guild, data);\n break;\n case Constants.ChannelTypes.STORE:\n channel = new StoreChannel(guild, data);\n break;\n }\n\n guild.channels.set(channel.id, channel);\n }\n }\n\n if (channel && !already) {\n if (this.pastReady) this.client.emit(Constants.Events.CHANNEL_CREATE, channel);\n this.client.channels.set(channel.id, channel);\n return channel;\n } else if (already) {\n return channel;\n }\n\n return null;\n }\n\n newEmoji(data, guild) {\n const already = guild.emojis.has(data.id);\n if (data && !already) {\n let emoji = new Emoji(guild, data);\n this.client.emit(Constants.Events.GUILD_EMOJI_CREATE, emoji);\n guild.emojis.set(emoji.id, emoji);\n return emoji;\n } else if (already) {\n return guild.emojis.get(data.id);\n }\n\n return null;\n }\n\n killEmoji(emoji) {\n if (!(emoji instanceof Emoji && emoji.guild)) return;\n this.client.emit(Constants.Events.GUILD_EMOJI_DELETE, emoji);\n emoji.guild.emojis.delete(emoji.id);\n }\n\n killGuild(guild) {\n const already = this.client.guilds.has(guild.id);\n this.client.guilds.delete(guild.id);\n if (already && this.pastReady) this.client.emit(Constants.Events.GUILD_DELETE, guild);\n }\n\n killUser(user) {\n this.client.users.delete(user.id);\n }\n\n killChannel(channel) {\n this.client.channels.delete(channel.id);\n if (channel instanceof GuildChannel) channel.guild.channels.delete(channel.id);\n }\n\n updateGuild(currentGuild, newData) {\n const oldGuild = Util.cloneObject(currentGuild);\n currentGuild.setup(newData);\n if (this.pastReady) this.client.emit(Constants.Events.GUILD_UPDATE, oldGuild, currentGuild);\n }\n\n updateChannel(currentChannel, newData) {\n currentChannel.setup(newData);\n }\n\n updateEmoji(currentEmoji, newData) {\n const oldEmoji = Util.cloneObject(currentEmoji);\n currentEmoji.setup(newData);\n this.client.emit(Constants.Events.GUILD_EMOJI_UPDATE, oldEmoji, currentEmoji);\n return currentEmoji;\n }\n}\n\nmodule.exports = ClientDataManager;\n\n\n//# sourceURL=webpack:///./src/client/ClientDataManager.js?"); + +/***/ }), + +/***/ "./src/client/ClientDataResolver.js": +/*!******************************************!*\ + !*** ./src/client/ClientDataResolver.js ***! + \******************************************/ +/*! no static exports found */ +/*! 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?"); + +/***/ }), + +/***/ "./src/client/ClientManager.js": +/*!*************************************!*\ + !*** ./src/client/ClientManager.js ***! + \*************************************/ +/*! no static exports found */ +/*! 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 WebSocketConnection = __webpack_require__(/*! ./websocket/WebSocketConnection */ \"./src/client/websocket/WebSocketConnection.js\");\n\n/**\n * Manages the state and background tasks of the client.\n * @private\n */\nclass ClientManager {\n constructor(client) {\n /**\n * The client that instantiated this Manager\n * @type {Client}\n */\n this.client = client;\n\n /**\n * The heartbeat interval\n * @type {?number}\n */\n this.heartbeatInterval = null;\n }\n\n /**\n * The status of the client\n * @type {number}\n */\n get status() {\n return this.connection ? this.connection.status : Constants.Status.IDLE;\n }\n\n /**\n * Connects the client to the WebSocket.\n * @param {string} token The authorization token\n * @param {Function} resolve Function to run when connection is successful\n * @param {Function} reject Function to run when connection fails\n */\n connectToWebSocket(token, resolve, reject) {\n this.client.emit(Constants.Events.DEBUG, `Authenticated using token ${token}`);\n this.client.token = token;\n const timeout = this.client.setTimeout(() => reject(new Error(Constants.Errors.TOOK_TOO_LONG)), 1000 * 300);\n this.client.rest.methods.getGateway().then(res => {\n const protocolVersion = Constants.DefaultOptions.ws.version;\n const gateway = `${res.url}/?v=${protocolVersion}&encoding=${WebSocketConnection.ENCODING}`;\n this.client.emit(Constants.Events.DEBUG, `Using gateway ${gateway}`);\n this.client.ws.connect(gateway);\n this.client.ws.connection.once('error', reject);\n this.client.ws.connection.once('close', event => {\n if (event.code === 4004) reject(new Error(Constants.Errors.BAD_LOGIN));\n if (event.code === 4010) reject(new Error(Constants.Errors.INVALID_SHARD));\n if (event.code === 4011) reject(new Error(Constants.Errors.SHARDING_REQUIRED));\n });\n this.client.once(Constants.Events.READY, () => {\n resolve(token);\n this.client.clearTimeout(timeout);\n });\n }, reject);\n }\n\n destroy() {\n this.client.ws.destroy();\n this.client.rest.destroy();\n if (!this.client.user) return Promise.resolve();\n if (this.client.user.bot) {\n this.client.token = null;\n return Promise.resolve();\n } else {\n return this.client.rest.methods.logout().then(() => {\n this.client.token = null;\n });\n }\n }\n}\n\nmodule.exports = ClientManager;\n\n\n//# sourceURL=webpack:///./src/client/ClientManager.js?"); + +/***/ }), + +/***/ "./src/client/WebhookClient.js": +/*!*************************************!*\ + !*** ./src/client/WebhookClient.js ***! + \*************************************/ +/*! no static exports found */ +/*! ModuleConcatenation bailout: Module is not an ECMAScript module */ +/***/ (function(module, exports, __webpack_require__) { + +eval("const Webhook = __webpack_require__(/*! ../structures/Webhook */ \"./src/structures/Webhook.js\");\nconst RESTManager = __webpack_require__(/*! ./rest/RESTManager */ \"./src/client/rest/RESTManager.js\");\nconst ClientDataResolver = __webpack_require__(/*! ./ClientDataResolver */ \"./src/client/ClientDataResolver.js\");\nconst Constants = __webpack_require__(/*! ../util/Constants */ \"./src/util/Constants.js\");\nconst Util = __webpack_require__(/*! ../util/Util */ \"./src/util/Util.js\");\n\n/**\n * The webhook client.\n * @extends {Webhook}\n */\nclass WebhookClient extends Webhook {\n /**\n * @param {Snowflake} id ID of the webhook\n * @param {string} token Token of the webhook\n * @param {ClientOptions} [options] Options for the client\n * @example\n * // Create a new webhook and send a message\n * const hook = new Discord.WebhookClient('1234', 'abcdef');\n * hook.sendMessage('This will send a message').catch(console.error);\n */\n constructor(id, token, options) {\n super(null, id, token);\n\n /**\n * The options the client was instantiated with\n * @type {ClientOptions}\n */\n this.options = Util.mergeDefault(Constants.DefaultOptions, options);\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 resolver of the client\n * @type {ClientDataResolver}\n * @private\n */\n this.resolver = new ClientDataResolver(this);\n\n /**\n * Timeouts set by {@link WebhookClient#setTimeout} that are still active\n * @type {Set}\n * @private\n */\n this._timeouts = new Set();\n\n /**\n * Intervals set by {@link WebhookClient#setInterval} that are still active\n * @type {Set}\n * @private\n */\n this._intervals = new Set();\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 /**\n * Destroys the client.\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 }\n}\n\nmodule.exports = WebhookClient;\n\n\n//# sourceURL=webpack:///./src/client/WebhookClient.js?"); + +/***/ }), + +/***/ "./src/client/actions/Action.js": +/*!**************************************!*\ + !*** ./src/client/actions/Action.js ***! + \**************************************/ +/*! no static exports found */ +/*! ModuleConcatenation bailout: Module is not an ECMAScript module */ +/***/ (function(module, exports) { + +eval("/*\n\nABOUT ACTIONS\n\nActions are similar to WebSocket Packet Handlers, but since introducing\nthe REST API methods, in order to prevent rewriting code to handle data,\n\"actions\" have been introduced. They're basically what Packet Handlers\nused to be but they're strictly for manipulating data and making sure\nthat WebSocket events don't clash with REST methods.\n\n*/\n\nclass GenericAction {\n constructor(client) {\n this.client = client;\n }\n\n handle(data) {\n return data;\n }\n}\n\nmodule.exports = GenericAction;\n\n\n//# sourceURL=webpack:///./src/client/actions/Action.js?"); + +/***/ }), + +/***/ "./src/client/actions/ActionsManager.js": +/*!**********************************************!*\ + !*** ./src/client/actions/ActionsManager.js ***! + \**********************************************/ +/*! no static exports found */ +/*! 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?"); + +/***/ }), + +/***/ "./src/client/actions/ChannelCreate.js": +/*!*********************************************!*\ + !*** ./src/client/actions/ChannelCreate.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\");\n\nclass ChannelCreateAction extends Action {\n handle(data) {\n const client = this.client;\n const channel = client.dataManager.newChannel(data);\n return { channel };\n }\n}\n\nmodule.exports = ChannelCreateAction;\n\n\n//# sourceURL=webpack:///./src/client/actions/ChannelCreate.js?"); + +/***/ }), + +/***/ "./src/client/actions/ChannelDelete.js": +/*!*********************************************!*\ + !*** ./src/client/actions/ChannelDelete.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\");\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?"); + +/***/ }), + +/***/ "./src/client/actions/ChannelUpdate.js": +/*!*********************************************!*\ + !*** ./src/client/actions/ChannelUpdate.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 TextChannel = __webpack_require__(/*! ../../structures/TextChannel */ \"./src/structures/TextChannel.js\");\nconst VoiceChannel = __webpack_require__(/*! ../../structures/VoiceChannel */ \"./src/structures/VoiceChannel.js\");\nconst CategoryChannel = __webpack_require__(/*! ../../structures/CategoryChannel */ \"./src/structures/CategoryChannel.js\");\nconst NewsChannel = __webpack_require__(/*! ../../structures/NewsChannel */ \"./src/structures/NewsChannel.js\");\nconst StoreChannel = __webpack_require__(/*! ../../structures/StoreChannel */ \"./src/structures/StoreChannel.js\");\nconst Constants = __webpack_require__(/*! ../../util/Constants */ \"./src/util/Constants.js\");\nconst ChannelTypes = Constants.ChannelTypes;\nconst Util = __webpack_require__(/*! ../../util/Util */ \"./src/util/Util.js\");\n\nclass ChannelUpdateAction extends Action {\n handle(data) {\n const client = this.client;\n\n let channel = client.channels.get(data.id);\n if (channel) {\n const oldChannel = Util.cloneObject(channel);\n\n // If the channel is changing types, we need to follow a different process\n if (ChannelTypes[channel.type.toUpperCase()] !== data.type) {\n // Determine which channel class we're changing to\n let channelClass;\n switch (data.type) {\n case ChannelTypes.TEXT:\n channelClass = TextChannel;\n break;\n case ChannelTypes.VOICE:\n channelClass = VoiceChannel;\n break;\n case ChannelTypes.CATEGORY:\n channelClass = CategoryChannel;\n break;\n case ChannelTypes.NEWS:\n channelClass = NewsChannel;\n break;\n case ChannelTypes.STORE:\n channelClass = StoreChannel;\n break;\n }\n\n // Create the new channel instance and copy over cached data\n const newChannel = new channelClass(channel.guild, data);\n if (channel.messages && newChannel.messages) {\n for (const [id, message] of channel.messages) newChannel.messages.set(id, message);\n }\n\n channel = newChannel;\n this.client.channels.set(channel.id, channel);\n } else {\n channel.setup(data);\n }\n\n client.emit(Constants.Events.CHANNEL_UPDATE, oldChannel, channel);\n return {\n old: oldChannel,\n updated: channel,\n };\n }\n\n return {\n old: null,\n updated: null,\n };\n }\n}\n\n/**\n * Emitted whenever a channel is updated - e.g. name change, topic change.\n * @event Client#channelUpdate\n * @param {Channel} oldChannel The channel before the update\n * @param {Channel} newChannel The channel after the update\n */\n\nmodule.exports = ChannelUpdateAction;\n\n\n//# sourceURL=webpack:///./src/client/actions/ChannelUpdate.js?"); + +/***/ }), + +/***/ "./src/client/actions/GuildBanRemove.js": +/*!**********************************************!*\ + !*** ./src/client/actions/GuildBanRemove.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 GuildBanRemove extends Action {\n handle(data) {\n const client = this.client;\n const guild = client.guilds.get(data.guild_id);\n const user = client.dataManager.newUser(data.user);\n if (guild && user) client.emit(Constants.Events.GUILD_BAN_REMOVE, guild, user);\n }\n}\n\nmodule.exports = GuildBanRemove;\n\n\n//# sourceURL=webpack:///./src/client/actions/GuildBanRemove.js?"); + +/***/ }), + +/***/ "./src/client/actions/GuildChannelsPositionUpdate.js": +/*!***********************************************************!*\ + !*** ./src/client/actions/GuildChannelsPositionUpdate.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\");\n\nclass GuildChannelsPositionUpdate extends Action {\n handle(data) {\n const client = this.client;\n\n const guild = client.guilds.get(data.guild_id);\n if (guild) {\n for (const partialChannel of data.channels) {\n const channel = guild.channels.get(partialChannel.id);\n if (channel) channel.position = partialChannel.position;\n }\n }\n\n return { guild };\n }\n}\n\nmodule.exports = GuildChannelsPositionUpdate;\n\n\n//# sourceURL=webpack:///./src/client/actions/GuildChannelsPositionUpdate.js?"); + +/***/ }), + +/***/ "./src/client/actions/GuildDelete.js": +/*!*******************************************!*\ + !*** ./src/client/actions/GuildDelete.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 GuildDeleteAction 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 guild = client.guilds.get(data.id);\n if (guild) {\n for (const channel of guild.channels.values()) {\n if (channel.type === 'text') channel.stopTyping(true);\n }\n\n if (guild.available && data.unavailable) {\n // Guild is unavailable\n guild.available = false;\n client.emit(Constants.Events.GUILD_UNAVAILABLE, guild);\n\n // Stops the GuildDelete packet thinking a guild was actually deleted,\n // handles emitting of event itself\n return {\n guild: null,\n };\n }\n\n for (const channel of guild.channels.values()) this.client.channels.delete(channel.id);\n if (guild.voiceConnection) guild.voiceConnection.disconnect();\n\n // Delete guild\n client.guilds.delete(guild.id);\n this.deleted.set(guild.id, guild);\n this.scheduleForDeletion(guild.id);\n } else {\n guild = this.deleted.get(data.id) || null;\n }\n if (guild) guild.deleted = true;\n\n return { guild };\n }\n\n scheduleForDeletion(id) {\n this.client.setTimeout(() => this.deleted.delete(id), this.client.options.restWsBridgeTimeout);\n }\n}\n\n/**\n * Emitted whenever a guild becomes unavailable, likely due to a server outage.\n * @event Client#guildUnavailable\n * @param {Guild} guild The guild that has become unavailable\n */\n\nmodule.exports = GuildDeleteAction;\n\n\n//# sourceURL=webpack:///./src/client/actions/GuildDelete.js?"); + +/***/ }), + +/***/ "./src/client/actions/GuildEmojiCreate.js": +/*!************************************************!*\ + !*** ./src/client/actions/GuildEmojiCreate.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\");\n\nclass GuildEmojiCreateAction extends Action {\n handle(guild, createdEmoji) {\n const client = this.client;\n const emoji = client.dataManager.newEmoji(createdEmoji, guild);\n return { emoji };\n }\n}\n\n/**\n * Emitted whenever a custom emoji is created in a guild.\n * @event Client#emojiCreate\n * @param {Emoji} emoji The emoji that was created\n */\n\nmodule.exports = GuildEmojiCreateAction;\n\n\n//# sourceURL=webpack:///./src/client/actions/GuildEmojiCreate.js?"); + +/***/ }), + +/***/ "./src/client/actions/GuildEmojiDelete.js": +/*!************************************************!*\ + !*** ./src/client/actions/GuildEmojiDelete.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\");\n\nclass GuildEmojiDeleteAction extends Action {\n handle(emoji) {\n const client = this.client;\n client.dataManager.killEmoji(emoji);\n emoji.deleted = true;\n return { emoji };\n }\n}\n\n/**\n * Emitted whenever a custom guild emoji is deleted.\n * @event Client#emojiDelete\n * @param {Emoji} emoji The emoji that was deleted\n */\n\nmodule.exports = GuildEmojiDeleteAction;\n\n\n//# sourceURL=webpack:///./src/client/actions/GuildEmojiDelete.js?"); + +/***/ }), + +/***/ "./src/client/actions/GuildEmojiUpdate.js": +/*!************************************************!*\ + !*** ./src/client/actions/GuildEmojiUpdate.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\");\n\nclass GuildEmojiUpdateAction extends Action {\n handle(oldEmoji, newEmoji) {\n const emoji = this.client.dataManager.updateEmoji(oldEmoji, newEmoji);\n return { emoji };\n }\n}\n\n/**\n * Emitted whenever a custom guild emoji is updated.\n * @event Client#emojiUpdate\n * @param {Emoji} oldEmoji The old emoji\n * @param {Emoji} newEmoji The new emoji\n */\n\nmodule.exports = GuildEmojiUpdateAction;\n\n\n//# sourceURL=webpack:///./src/client/actions/GuildEmojiUpdate.js?"); + +/***/ }), + +/***/ "./src/client/actions/GuildEmojisUpdate.js": +/*!*************************************************!*\ + !*** ./src/client/actions/GuildEmojisUpdate.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\");\n\nfunction mappify(iterable) {\n const map = new Map();\n for (const x of iterable) map.set(...x);\n return map;\n}\n\nclass GuildEmojisUpdateAction extends Action {\n handle(data) {\n const guild = this.client.guilds.get(data.guild_id);\n if (!guild || !guild.emojis) return;\n\n const deletions = mappify(guild.emojis.entries());\n\n for (const emoji of data.emojis) {\n // Determine type of emoji event\n const cachedEmoji = guild.emojis.get(emoji.id);\n if (cachedEmoji) {\n deletions.delete(emoji.id);\n if (!cachedEmoji.equals(emoji, true)) {\n // Emoji updated\n this.client.actions.GuildEmojiUpdate.handle(cachedEmoji, emoji);\n }\n } else {\n // Emoji added\n this.client.actions.GuildEmojiCreate.handle(guild, emoji);\n }\n }\n\n for (const emoji of deletions.values()) {\n // Emoji deleted\n this.client.actions.GuildEmojiDelete.handle(emoji);\n }\n }\n}\n\nmodule.exports = GuildEmojisUpdateAction;\n\n\n//# sourceURL=webpack:///./src/client/actions/GuildEmojisUpdate.js?"); + +/***/ }), + +/***/ "./src/client/actions/GuildMemberGet.js": +/*!**********************************************!*\ + !*** ./src/client/actions/GuildMemberGet.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\");\n\nclass GuildMemberGetAction extends Action {\n handle(guild, data) {\n const member = guild._addMember(data, false);\n return { member };\n }\n}\n\nmodule.exports = GuildMemberGetAction;\n\n\n//# sourceURL=webpack:///./src/client/actions/GuildMemberGet.js?"); + +/***/ }), + +/***/ "./src/client/actions/GuildMemberRemove.js": +/*!*************************************************!*\ + !*** ./src/client/actions/GuildMemberRemove.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 GuildMemberRemoveAction extends Action {\n constructor(client) {\n super(client);\n this.deleted = new Map();\n }\n\n handle(data) {\n const client = this.client;\n const guild = client.guilds.get(data.guild_id);\n let member = null;\n if (guild) {\n member = guild.members.get(data.user.id);\n guild.memberCount--;\n if (member) {\n guild._removeMember(member);\n this.deleted.set(guild.id + data.user.id, member);\n if (client.status === Constants.Status.READY) client.emit(Constants.Events.GUILD_MEMBER_REMOVE, member);\n this.scheduleForDeletion(guild.id, data.user.id);\n } else {\n member = this.deleted.get(guild.id + data.user.id) || null;\n }\n if (member) member.deleted = true;\n }\n return { guild, member };\n }\n\n scheduleForDeletion(guildID, userID) {\n this.client.setTimeout(() => this.deleted.delete(guildID + userID), this.client.options.restWsBridgeTimeout);\n }\n}\n\n/**\n * Emitted whenever a member leaves a guild, or is kicked.\n * @event Client#guildMemberRemove\n * @param {GuildMember} member The member that has left/been kicked from the guild\n */\n\nmodule.exports = GuildMemberRemoveAction;\n\n\n//# sourceURL=webpack:///./src/client/actions/GuildMemberRemove.js?"); + +/***/ }), + +/***/ "./src/client/actions/GuildRoleCreate.js": +/*!***********************************************!*\ + !*** ./src/client/actions/GuildRoleCreate.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\");\nconst Role = __webpack_require__(/*! ../../structures/Role */ \"./src/structures/Role.js\");\n\nclass GuildRoleCreate extends Action {\n handle(data) {\n const client = this.client;\n const guild = client.guilds.get(data.guild_id);\n let role;\n if (guild) {\n const already = guild.roles.has(data.role.id);\n role = new Role(guild, data.role);\n guild.roles.set(role.id, role);\n if (!already) client.emit(Constants.Events.GUILD_ROLE_CREATE, role);\n }\n return { role };\n }\n}\n\n/**\n * Emitted whenever a role is created.\n * @event Client#roleCreate\n * @param {Role} role The role that was created\n */\n\nmodule.exports = GuildRoleCreate;\n\n\n//# sourceURL=webpack:///./src/client/actions/GuildRoleCreate.js?"); + +/***/ }), + +/***/ "./src/client/actions/GuildRoleDelete.js": +/*!***********************************************!*\ + !*** ./src/client/actions/GuildRoleDelete.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 GuildRoleDeleteAction extends Action {\n constructor(client) {\n super(client);\n this.deleted = new Map();\n }\n\n handle(data) {\n const client = this.client;\n const guild = client.guilds.get(data.guild_id);\n let role;\n\n if (guild) {\n role = guild.roles.get(data.role_id);\n if (role) {\n guild.roles.delete(data.role_id);\n this.deleted.set(guild.id + data.role_id, role);\n this.scheduleForDeletion(guild.id, data.role_id);\n client.emit(Constants.Events.GUILD_ROLE_DELETE, role);\n } else {\n role = this.deleted.get(guild.id + data.role_id) || null;\n }\n if (role) role.deleted = true;\n }\n\n return { role };\n }\n\n scheduleForDeletion(guildID, roleID) {\n this.client.setTimeout(() => this.deleted.delete(guildID + roleID), this.client.options.restWsBridgeTimeout);\n }\n}\n\n/**\n * Emitted whenever a guild role is deleted.\n * @event Client#roleDelete\n * @param {Role} role The role that was deleted\n */\n\nmodule.exports = GuildRoleDeleteAction;\n\n\n//# sourceURL=webpack:///./src/client/actions/GuildRoleDelete.js?"); + +/***/ }), + +/***/ "./src/client/actions/GuildRoleUpdate.js": +/*!***********************************************!*\ + !*** ./src/client/actions/GuildRoleUpdate.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\");\nconst Util = __webpack_require__(/*! ../../util/Util */ \"./src/util/Util.js\");\n\nclass GuildRoleUpdateAction extends Action {\n handle(data) {\n const client = this.client;\n const guild = client.guilds.get(data.guild_id);\n\n if (guild) {\n const roleData = data.role;\n let oldRole = null;\n\n const role = guild.roles.get(roleData.id);\n if (role) {\n oldRole = Util.cloneObject(role);\n role.setup(data.role);\n client.emit(Constants.Events.GUILD_ROLE_UPDATE, oldRole, role);\n }\n\n return {\n old: oldRole,\n updated: role,\n };\n }\n\n return {\n old: null,\n updated: null,\n };\n }\n}\n\n/**\n * Emitted whenever a guild role is updated.\n * @event Client#roleUpdate\n * @param {Role} oldRole The role before the update\n * @param {Role} newRole The role after the update\n */\n\nmodule.exports = GuildRoleUpdateAction;\n\n\n//# sourceURL=webpack:///./src/client/actions/GuildRoleUpdate.js?"); + +/***/ }), + +/***/ "./src/client/actions/GuildRolesPositionUpdate.js": +/*!********************************************************!*\ + !*** ./src/client/actions/GuildRolesPositionUpdate.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\");\n\nclass GuildRolesPositionUpdate extends Action {\n handle(data) {\n const client = this.client;\n\n const guild = client.guilds.get(data.guild_id);\n if (guild) {\n for (const partialRole of data.roles) {\n const role = guild.roles.get(partialRole.id);\n if (role) role.position = partialRole.position;\n }\n }\n\n return { guild };\n }\n}\n\nmodule.exports = GuildRolesPositionUpdate;\n\n\n//# sourceURL=webpack:///./src/client/actions/GuildRolesPositionUpdate.js?"); + +/***/ }), + +/***/ "./src/client/actions/GuildSync.js": +/*!*****************************************!*\ + !*** ./src/client/actions/GuildSync.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\");\n\nclass GuildSync extends Action {\n handle(data) {\n const client = this.client;\n\n const guild = client.guilds.get(data.id);\n if (guild) {\n if (data.presences) {\n for (const presence of data.presences) guild._setPresence(presence.user.id, presence);\n }\n\n if (data.members) {\n for (const syncMember of data.members) {\n const member = guild.members.get(syncMember.user.id);\n if (member) {\n guild._updateMember(member, syncMember);\n } else {\n guild._addMember(syncMember, false);\n }\n }\n }\n\n if ('large' in data) guild.large = data.large;\n }\n }\n}\n\nmodule.exports = GuildSync;\n\n\n//# sourceURL=webpack:///./src/client/actions/GuildSync.js?"); + +/***/ }), + +/***/ "./src/client/actions/GuildUpdate.js": +/*!*******************************************!*\ + !*** ./src/client/actions/GuildUpdate.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\");\nconst Util = __webpack_require__(/*! ../../util/Util */ \"./src/util/Util.js\");\n\nclass GuildUpdateAction extends Action {\n handle(data) {\n const client = this.client;\n\n const guild = client.guilds.get(data.id);\n if (guild) {\n const oldGuild = Util.cloneObject(guild);\n guild.setup(data);\n client.emit(Constants.Events.GUILD_UPDATE, oldGuild, guild);\n return {\n old: oldGuild,\n updated: guild,\n };\n }\n\n return {\n old: null,\n updated: null,\n };\n }\n}\n\n/**\n * Emitted whenever a guild is updated - e.g. name change.\n * @event Client#guildUpdate\n * @param {Guild} oldGuild The guild before the update\n * @param {Guild} newGuild The guild after the update\n */\n\nmodule.exports = GuildUpdateAction;\n\n\n//# sourceURL=webpack:///./src/client/actions/GuildUpdate.js?"); + +/***/ }), + +/***/ "./src/client/actions/MessageCreate.js": +/*!*********************************************!*\ + !*** ./src/client/actions/MessageCreate.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 Message = __webpack_require__(/*! ../../structures/Message */ \"./src/structures/Message.js\");\n\nclass MessageCreateAction extends Action {\n handle(data) {\n const client = this.client;\n\n const channel = client.channels.get((data instanceof Array ? data[0] : data).channel_id);\n const user = client.users.get((data instanceof Array ? data[0] : data).author.id);\n if (channel) {\n const member = channel.guild ? channel.guild.member(user) : null;\n if (data instanceof Array) {\n const messages = new Array(data.length);\n for (let i = 0; i < data.length; i++) {\n messages[i] = channel._cacheMessage(new Message(channel, data[i], client));\n }\n const lastMessage = messages[messages.length - 1];\n channel.lastMessageID = lastMessage.id;\n if (user) {\n user.lastMessageID = lastMessage.id;\n user.lastMessage = lastMessage;\n }\n if (member) {\n member.lastMessageID = lastMessage.id;\n member.lastMessage = lastMessage;\n }\n return {\n messages,\n };\n } else {\n const message = channel._cacheMessage(new Message(channel, data, client));\n channel.lastMessageID = data.id;\n if (user) {\n user.lastMessageID = data.id;\n user.lastMessage = message;\n }\n if (member) {\n member.lastMessageID = data.id;\n member.lastMessage = message;\n }\n return {\n message,\n };\n }\n }\n\n return {\n message: null,\n };\n }\n}\n\nmodule.exports = MessageCreateAction;\n\n\n//# sourceURL=webpack:///./src/client/actions/MessageCreate.js?"); + +/***/ }), + +/***/ "./src/client/actions/MessageDelete.js": +/*!*********************************************!*\ + !*** ./src/client/actions/MessageDelete.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\");\n\nclass MessageDeleteAction extends Action {\n constructor(client) {\n super(client);\n this.deleted = new Map();\n }\n\n handle(data) {\n const client = this.client;\n const channel = client.channels.get(data.channel_id);\n let message;\n\n if (channel) {\n message = channel.messages.get(data.id);\n if (message) {\n channel.messages.delete(message.id);\n this.deleted.set(channel.id + message.id, message);\n this.scheduleForDeletion(channel.id, message.id);\n } else {\n message = this.deleted.get(channel.id + data.id) || null;\n }\n if (message) message.deleted = true;\n }\n\n return { message };\n }\n\n scheduleForDeletion(channelID, messageID) {\n this.client.setTimeout(() => this.deleted.delete(channelID + messageID),\n this.client.options.restWsBridgeTimeout);\n }\n}\n\nmodule.exports = MessageDeleteAction;\n\n\n//# sourceURL=webpack:///./src/client/actions/MessageDelete.js?"); + +/***/ }), + +/***/ "./src/client/actions/MessageDeleteBulk.js": +/*!*************************************************!*\ + !*** ./src/client/actions/MessageDeleteBulk.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 Collection = __webpack_require__(/*! ../../util/Collection */ \"./src/util/Collection.js\");\nconst Constants = __webpack_require__(/*! ../../util/Constants */ \"./src/util/Constants.js\");\n\nclass MessageDeleteBulkAction extends Action {\n handle(data) {\n const messages = new Collection();\n const channel = this.client.channels.get(data.channel_id);\n\n if (channel) {\n for (const id of data.ids) {\n const message = channel.messages.get(id);\n if (message) {\n message.deleted = true;\n messages.set(message.id, message);\n channel.messages.delete(id);\n }\n }\n }\n\n if (messages.size > 0) this.client.emit(Constants.Events.MESSAGE_BULK_DELETE, messages);\n return { messages };\n }\n}\n\nmodule.exports = MessageDeleteBulkAction;\n\n\n//# sourceURL=webpack:///./src/client/actions/MessageDeleteBulk.js?"); + +/***/ }), + +/***/ "./src/client/actions/MessageReactionAdd.js": +/*!**************************************************!*\ + !*** ./src/client/actions/MessageReactionAdd.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\n/*\n{ user_id: 'id',\n message_id: 'id',\n emoji: { name: '�', id: null },\n channel_id: 'id' } }\n*/\n\nclass MessageReactionAdd extends Action {\n handle(data) {\n const user = this.client.users.get(data.user_id);\n if (!user) return false;\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._addReaction(data.emoji, user);\n if (reaction) this.client.emit(Constants.Events.MESSAGE_REACTION_ADD, reaction, user);\n\n return { message, reaction, user };\n }\n}\n\n/**\n * Emitted whenever a reaction is added to a cached message.\n * @event Client#messageReactionAdd\n * @param {MessageReaction} messageReaction The reaction object\n * @param {User} user The user that applied the emoji or reaction emoji\n */\n\nmodule.exports = MessageReactionAdd;\n\n\n//# sourceURL=webpack:///./src/client/actions/MessageReactionAdd.js?"); + +/***/ }), + +/***/ "./src/client/actions/MessageReactionRemove.js": +/*!*****************************************************!*\ + !*** ./src/client/actions/MessageReactionRemove.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\n/*\n{ user_id: 'id',\n message_id: 'id',\n emoji: { name: '�', id: null },\n channel_id: 'id' } }\n*/\n\nclass MessageReactionRemove extends Action {\n handle(data) {\n const user = this.client.users.get(data.user_id);\n if (!user) return false;\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, user);\n if (reaction) this.client.emit(Constants.Events.MESSAGE_REACTION_REMOVE, reaction, user);\n\n return { message, reaction, user };\n }\n}\n\n/**\n * Emitted whenever a reaction is removed from a cached message.\n * @event Client#messageReactionRemove\n * @param {MessageReaction} messageReaction The reaction object\n * @param {User} user The user whose emoji or reaction emoji was removed\n */\n\nmodule.exports = MessageReactionRemove;\n\n\n//# sourceURL=webpack:///./src/client/actions/MessageReactionRemove.js?"); + +/***/ }), + +/***/ "./src/client/actions/MessageReactionRemoveAll.js": +/*!********************************************************!*\ + !*** ./src/client/actions/MessageReactionRemoveAll.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 MessageReactionRemoveAll extends Action {\n handle(data) {\n const channel = this.client.channels.get(data.channel_id);\n if (!channel || channel.type === 'voice') return false;\n\n const message = channel.messages.get(data.message_id);\n if (!message) return false;\n\n message._clearReactions();\n this.client.emit(Constants.Events.MESSAGE_REACTION_REMOVE_ALL, message);\n\n return { message };\n }\n}\n\n/**\n * Emitted whenever all reactions are removed from a cached message.\n * @event Client#messageReactionRemoveAll\n * @param {Message} message The message the reactions were removed from\n */\n\nmodule.exports = MessageReactionRemoveAll;\n\n\n//# sourceURL=webpack:///./src/client/actions/MessageReactionRemoveAll.js?"); + +/***/ }), + +/***/ "./src/client/actions/MessageUpdate.js": +/*!*********************************************!*\ + !*** ./src/client/actions/MessageUpdate.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 MessageUpdateAction extends Action {\n handle(data) {\n const client = this.client;\n\n const channel = client.channels.get(data.channel_id);\n if (channel) {\n const message = channel.messages.get(data.id);\n if (message) {\n message.patch(data);\n client.emit(Constants.Events.MESSAGE_UPDATE, message._edits[0], message);\n return {\n old: message._edits[0],\n updated: message,\n };\n }\n\n return {\n old: message,\n updated: message,\n };\n }\n\n return {\n old: null,\n updated: null,\n };\n }\n}\n\n/**\n * Emitted whenever a message is updated - e.g. embed or content change.\n * @event Client#messageUpdate\n * @param {Message} oldMessage The message before the update\n * @param {Message} newMessage The message after the update\n */\n\nmodule.exports = MessageUpdateAction;\n\n\n//# sourceURL=webpack:///./src/client/actions/MessageUpdate.js?"); + +/***/ }), + +/***/ "./src/client/actions/UserGet.js": +/*!***************************************!*\ + !*** ./src/client/actions/UserGet.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\");\n\nclass UserGetAction extends Action {\n handle(data) {\n const client = this.client;\n const user = client.dataManager.newUser(data);\n return { user };\n }\n}\n\nmodule.exports = UserGetAction;\n\n\n//# sourceURL=webpack:///./src/client/actions/UserGet.js?"); + +/***/ }), + +/***/ "./src/client/actions/UserNoteUpdate.js": +/*!**********************************************!*\ + !*** ./src/client/actions/UserNoteUpdate.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 UserNoteUpdateAction extends Action {\n handle(data) {\n const client = this.client;\n\n const oldNote = client.user.notes.get(data.id);\n const note = data.note.length ? data.note : null;\n\n client.user.notes.set(data.id, note);\n\n client.emit(Constants.Events.USER_NOTE_UPDATE, data.id, oldNote, note);\n\n return {\n old: oldNote,\n updated: note,\n };\n }\n}\n\n/**\n * Emitted whenever a note is updated.\n * @event Client#userNoteUpdate\n * @param {User} user The user the note belongs to\n * @param {string} oldNote The note content before the update\n * @param {string} newNote The note content after the update\n */\n\nmodule.exports = UserNoteUpdateAction;\n\n\n//# sourceURL=webpack:///./src/client/actions/UserNoteUpdate.js?"); + +/***/ }), + +/***/ "./src/client/actions/UserUpdate.js": +/*!******************************************!*\ + !*** ./src/client/actions/UserUpdate.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\");\nconst Util = __webpack_require__(/*! ../../util/Util */ \"./src/util/Util.js\");\n\nclass UserUpdateAction extends Action {\n handle(data) {\n const client = this.client;\n\n if (client.user) {\n if (client.user.equals(data)) {\n return {\n old: client.user,\n updated: client.user,\n };\n }\n\n const oldUser = Util.cloneObject(client.user);\n client.user.patch(data);\n client.emit(Constants.Events.USER_UPDATE, oldUser, client.user);\n return {\n old: oldUser,\n updated: client.user,\n };\n }\n\n return {\n old: null,\n updated: null,\n };\n }\n}\n\nmodule.exports = UserUpdateAction;\n\n\n//# sourceURL=webpack:///./src/client/actions/UserUpdate.js?"); + +/***/ }), + +/***/ "./src/client/rest/APIRequest.js": +/*!***************************************!*\ + !*** ./src/client/rest/APIRequest.js ***! + \***************************************/ +/*! no static exports found */ +/*! ModuleConcatenation bailout: Module is not an ECMAScript module */ +/***/ (function(module, exports, __webpack_require__) { + +eval("const snekfetch = __webpack_require__(/*! snekfetch */ \"./node_modules/snekfetch/esm.mjs\");\nconst Constants = __webpack_require__(/*! ../../util/Constants */ \"./src/util/Constants.js\");\n\nclass APIRequest {\n constructor(rest, method, path, auth, data, files, reason) {\n this.rest = rest;\n this.client = rest.client;\n this.method = method;\n this.path = path.toString();\n this.auth = auth;\n this.data = data;\n this.files = files;\n this.route = this.getRoute(this.path);\n this.reason = reason;\n }\n\n getRoute(url) {\n let route = url.split('?')[0];\n if (route.includes('/channels/') || route.includes('/guilds/')) {\n const startInd = route.includes('/channels/') ? route.indexOf('/channels/') : route.indexOf('/guilds/');\n const majorID = route.substring(startInd).split('/')[2];\n route = route.replace(/(\\d{8,})/g, ':id').replace(':id', majorID);\n }\n return route;\n }\n\n getAuth() {\n if (this.client.token && this.client.user && this.client.user.bot) {\n return `Bot ${this.client.token}`;\n } else if (this.client.token) {\n return this.client.token;\n }\n throw new Error(Constants.Errors.NO_TOKEN);\n }\n\n gen() {\n const API = `${this.client.options.http.host}/api/v${this.client.options.http.version}`;\n const request = snekfetch[this.method](`${API}${this.path}`);\n if (this.auth) request.set('Authorization', this.getAuth());\n if (this.reason) request.set('X-Audit-Log-Reason', encodeURIComponent(this.reason));\n if (!this.rest.client.browser) request.set('User-Agent', this.rest.userAgentManager.userAgent);\n if (this.files) {\n for (const file of this.files) if (file && file.file) request.attach(file.name, file.file, file.name);\n if (typeof this.data !== 'undefined') request.attach('payload_json', JSON.stringify(this.data));\n } else if (this.data) {\n request.send(this.data);\n }\n return request;\n }\n}\n\nmodule.exports = APIRequest;\n\n\n//# sourceURL=webpack:///./src/client/rest/APIRequest.js?"); + +/***/ }), + +/***/ "./src/client/rest/DiscordAPIError.js": +/*!********************************************!*\ + !*** ./src/client/rest/DiscordAPIError.js ***! + \********************************************/ +/*! no static exports found */ +/*! ModuleConcatenation bailout: Module is not an ECMAScript module */ +/***/ (function(module, exports) { + +eval("/**\n * Represents an error from the Discord API.\n * @extends Error\n */\nclass DiscordAPIError extends Error {\n constructor(path, error, method) {\n super();\n const flattened = this.constructor.flattenErrors(error.errors || error).join('\\n');\n this.name = 'DiscordAPIError';\n this.message = error.message && flattened ? `${error.message}\\n${flattened}` : error.message || flattened;\n\n /**\n * The path of the request relative to the HTTP endpoint\n * @type {string}\n */\n this.path = path;\n\n /**\n * HTTP error code returned by Discord\n * @type {number}\n */\n this.code = error.code;\n\n /**\n * The HTTP method used for the request\n * @type {string}\n */\n this.method = method;\n }\n\n /**\n * Flattens an errors object returned from the API into an array.\n * @param {Object} obj Discord errors object\n * @param {string} [key] Used internally to determine key names of nested fields\n * @returns {string[]}\n * @private\n */\n static flattenErrors(obj, key = '') {\n let messages = [];\n\n for (const k of Object.keys(obj)) {\n if (k === 'message') continue;\n const newKey = key ? isNaN(k) ? `${key}.${k}` : `${key}[${k}]` : k;\n\n if (obj[k]._errors) {\n messages.push(`${newKey}: ${obj[k]._errors.map(e => e.message).join(' ')}`);\n } else if (obj[k].code || obj[k].message) {\n messages.push(`${obj[k].code ? `${obj[k].code}: ` : ''}: ${obj[k].message}`.trim());\n } else if (typeof obj[k] === 'string') {\n messages.push(obj[k]);\n } else {\n messages = messages.concat(this.flattenErrors(obj[k], newKey));\n }\n }\n\n return messages;\n }\n}\n\nmodule.exports = DiscordAPIError;\n\n\n//# sourceURL=webpack:///./src/client/rest/DiscordAPIError.js?"); + +/***/ }), + +/***/ "./src/client/rest/RESTManager.js": +/*!****************************************!*\ + !*** ./src/client/rest/RESTManager.js ***! + \****************************************/ +/*! no static exports found */ +/*! ModuleConcatenation bailout: Module is not an ECMAScript module */ +/***/ (function(module, exports, __webpack_require__) { + +eval("const UserAgentManager = __webpack_require__(/*! ./UserAgentManager */ \"./src/client/rest/UserAgentManager.js\");\nconst RESTMethods = __webpack_require__(/*! ./RESTMethods */ \"./src/client/rest/RESTMethods.js\");\nconst SequentialRequestHandler = __webpack_require__(/*! ./RequestHandlers/Sequential */ \"./src/client/rest/RequestHandlers/Sequential.js\");\nconst BurstRequestHandler = __webpack_require__(/*! ./RequestHandlers/Burst */ \"./src/client/rest/RequestHandlers/Burst.js\");\nconst APIRequest = __webpack_require__(/*! ./APIRequest */ \"./src/client/rest/APIRequest.js\");\nconst Constants = __webpack_require__(/*! ../../util/Constants */ \"./src/util/Constants.js\");\n\nclass RESTManager {\n constructor(client) {\n this.client = client;\n this.handlers = {};\n this.userAgentManager = new UserAgentManager(this);\n this.methods = new RESTMethods(this);\n this.rateLimitedEndpoints = {};\n this.globallyRateLimited = false;\n }\n\n destroy() {\n for (const handlerKey of Object.keys(this.handlers)) {\n const handler = this.handlers[handlerKey];\n if (handler.destroy) handler.destroy();\n }\n }\n\n push(handler, apiRequest) {\n return new Promise((resolve, reject) => {\n handler.push({\n request: apiRequest,\n resolve,\n reject,\n retries: 0,\n });\n });\n }\n\n getRequestHandler() {\n switch (this.client.options.apiRequestMethod) {\n case 'sequential':\n return SequentialRequestHandler;\n case 'burst':\n return BurstRequestHandler;\n default:\n throw new Error(Constants.Errors.INVALID_RATE_LIMIT_METHOD);\n }\n }\n\n makeRequest(method, url, auth, data, file, reason) {\n const apiRequest = new APIRequest(this, method, url, auth, data, file, reason);\n if (!this.handlers[apiRequest.route]) {\n const RequestHandlerType = this.getRequestHandler();\n this.handlers[apiRequest.route] = new RequestHandlerType(this, apiRequest.route);\n }\n\n return this.push(this.handlers[apiRequest.route], apiRequest);\n }\n}\n\nmodule.exports = RESTManager;\n\n\n//# sourceURL=webpack:///./src/client/rest/RESTManager.js?"); + +/***/ }), + +/***/ "./src/client/rest/RESTMethods.js": +/*!****************************************!*\ + !*** ./src/client/rest/RESTMethods.js ***! + \****************************************/ +/*! no static exports found */ +/*! 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?"); + +/***/ }), + +/***/ "./src/client/rest/RequestHandlers/Burst.js": +/*!**************************************************!*\ + !*** ./src/client/rest/RequestHandlers/Burst.js ***! + \**************************************************/ +/*! no static exports found */ +/*! ModuleConcatenation bailout: Module is not an ECMAScript module */ +/***/ (function(module, exports, __webpack_require__) { + +eval("const RequestHandler = __webpack_require__(/*! ./RequestHandler */ \"./src/client/rest/RequestHandlers/RequestHandler.js\");\nconst DiscordAPIError = __webpack_require__(/*! ../DiscordAPIError */ \"./src/client/rest/DiscordAPIError.js\");\nconst { Events: { RATE_LIMIT } } = __webpack_require__(/*! ../../../util/Constants */ \"./src/util/Constants.js\");\n\nclass BurstRequestHandler extends RequestHandler {\n constructor(restManager, endpoint) {\n super(restManager, endpoint);\n\n this.client = restManager.client;\n\n this.limit = Infinity;\n this.resetTime = null;\n this.remaining = 1;\n this.timeDifference = 0;\n\n this.resetTimeout = null;\n }\n\n push(request) {\n super.push(request);\n this.handle();\n }\n\n execute(item) {\n if (!item) return;\n item.request.gen().end((err, res) => {\n if (res && res.headers) {\n this.limit = Number(res.headers['x-ratelimit-limit']);\n this.resetTime = Number(res.headers['x-ratelimit-reset']) * 1000;\n this.remaining = Number(res.headers['x-ratelimit-remaining']);\n this.timeDifference = Date.now() - new Date(res.headers.date).getTime();\n }\n if (err) {\n if (err.status === 429) {\n this.queue.unshift(item);\n if (res.headers['x-ratelimit-global']) this.globalLimit = true;\n if (this.resetTimeout) return;\n this.resetTimeout = this.client.setTimeout(() => {\n this.remaining = this.limit;\n this.globalLimit = false;\n this.handle();\n this.resetTimeout = null;\n }, Number(res.headers['retry-after']) + this.client.options.restTimeOffset);\n } else if (err.status >= 500 && err.status < 600) {\n if (item.retries === this.client.options.retryLimit) {\n item.reject(err);\n this.handle();\n } else {\n item.retries++;\n this.queue.unshift(item);\n this.resetTimeout = this.client.setTimeout(() => {\n this.handle();\n this.resetTimeout = null;\n }, 1e3 + this.client.options.restTimeOffset);\n }\n } else {\n item.reject(err.status >= 400 && err.status < 500 ?\n new DiscordAPIError(res.request.path, res.body, res.request.method) : err);\n this.handle();\n }\n } else {\n if (this.remaining === 0) {\n if (this.client.listenerCount(RATE_LIMIT)) {\n this.client.emit(RATE_LIMIT, {\n limit: this.limit,\n timeDifference: this.timeDifference,\n path: item.request.path,\n method: item.request.method,\n });\n }\n }\n this.globalLimit = false;\n const data = res && res.body ? res.body : {};\n item.resolve(data);\n this.handle();\n }\n });\n }\n\n handle() {\n super.handle();\n if (this.queue.length === 0) return;\n if ((this.remaining <= 0 || this.globalLimit) && Date.now() - this.timeDifference < this.resetTime) return;\n this.execute(this.queue.shift());\n this.remaining--;\n this.handle();\n }\n}\n\nmodule.exports = BurstRequestHandler;\n\n\n//# sourceURL=webpack:///./src/client/rest/RequestHandlers/Burst.js?"); + +/***/ }), + +/***/ "./src/client/rest/RequestHandlers/RequestHandler.js": +/*!***********************************************************!*\ + !*** ./src/client/rest/RequestHandlers/RequestHandler.js ***! + \***********************************************************/ +/*! no static exports found */ +/*! ModuleConcatenation bailout: Module is not an ECMAScript module */ +/***/ (function(module, exports) { + +eval("/**\n * A base class for different types of rate limiting handlers for the REST API.\n * @private\n */\nclass RequestHandler {\n /**\n * @param {RESTManager} restManager The REST manager to use\n */\n constructor(restManager) {\n /**\n * The RESTManager that instantiated this RequestHandler\n * @type {RESTManager}\n */\n this.restManager = restManager;\n\n /**\n * A list of requests that have yet to be processed\n * @type {APIRequest[]}\n */\n this.queue = [];\n }\n\n /**\n * Whether or not the client is being rate limited on every endpoint\n * @type {boolean}\n * @readonly\n */\n get globalLimit() {\n return this.restManager.globallyRateLimited;\n }\n\n set globalLimit(value) {\n this.restManager.globallyRateLimited = value;\n }\n\n /**\n * Push a new API request into this bucket.\n * @param {APIRequest} request The new request to push into the queue\n */\n push(request) {\n this.queue.push(request);\n }\n\n /**\n * Attempts to get this RequestHandler to process its current queue.\n */\n handle() {} // eslint-disable-line no-empty-function\n\n destroy() {\n this.queue = [];\n }\n}\n\nmodule.exports = RequestHandler;\n\n\n//# sourceURL=webpack:///./src/client/rest/RequestHandlers/RequestHandler.js?"); + +/***/ }), + +/***/ "./src/client/rest/RequestHandlers/Sequential.js": +/*!*******************************************************!*\ + !*** ./src/client/rest/RequestHandlers/Sequential.js ***! + \*******************************************************/ +/*! no static exports found */ +/*! ModuleConcatenation bailout: Module is not an ECMAScript module */ +/***/ (function(module, exports, __webpack_require__) { + +eval("const RequestHandler = __webpack_require__(/*! ./RequestHandler */ \"./src/client/rest/RequestHandlers/RequestHandler.js\");\nconst DiscordAPIError = __webpack_require__(/*! ../DiscordAPIError */ \"./src/client/rest/DiscordAPIError.js\");\nconst { Events: { RATE_LIMIT } } = __webpack_require__(/*! ../../../util/Constants */ \"./src/util/Constants.js\");\n\n/**\n * Handles API Requests sequentially, i.e. we wait until the current request is finished before moving onto\n * the next. This plays a _lot_ nicer in terms of avoiding 429's when there is more than one session of the account,\n * but it can be slower.\n * @extends {RequestHandler}\n * @private\n */\nclass SequentialRequestHandler extends RequestHandler {\n /**\n * @param {RESTManager} restManager The REST manager to use\n * @param {string} endpoint The endpoint to handle\n */\n constructor(restManager, endpoint) {\n super(restManager, endpoint);\n\n /**\n * The client that instantiated this handler\n * @type {Client}\n */\n this.client = restManager.client;\n\n /**\n * The endpoint that this handler is handling\n * @type {string}\n */\n this.endpoint = endpoint;\n\n /**\n * The time difference between Discord's Dates and the local computer's Dates. A positive number means the local\n * computer's time is ahead of Discord's\n * @type {number}\n */\n this.timeDifference = 0;\n\n /**\n * Whether the queue is being processed or not\n * @type {boolean}\n */\n this.busy = false;\n }\n\n push(request) {\n super.push(request);\n this.handle();\n }\n\n /**\n * Performs a request then resolves a promise to indicate its readiness for a new request.\n * @param {APIRequest} item The item to execute\n * @returns {Promise}\n */\n execute(item) {\n this.busy = true;\n return new Promise(resolve => {\n item.request.gen().end((err, res) => {\n if (res && res.headers) {\n this.requestLimit = Number(res.headers['x-ratelimit-limit']);\n this.requestResetTime = Number(res.headers['x-ratelimit-reset']) * 1000;\n this.requestRemaining = Number(res.headers['x-ratelimit-remaining']);\n this.timeDifference = Date.now() - new Date(res.headers.date).getTime();\n }\n if (err) {\n if (err.status === 429) {\n this.queue.unshift(item);\n this.client.setTimeout(() => {\n this.globalLimit = false;\n resolve();\n }, Number(res.headers['retry-after']) + this.client.options.restTimeOffset);\n if (res.headers['x-ratelimit-global']) this.globalLimit = true;\n } else if (err.status >= 500 && err.status < 600) {\n if (item.retries === this.client.options.retryLimit) {\n item.reject(err);\n resolve();\n } else {\n item.retries++;\n this.queue.unshift(item);\n this.client.setTimeout(resolve, 1e3 + this.client.options.restTimeOffset);\n }\n } else {\n item.reject(err.status >= 400 && err.status < 500 ?\n new DiscordAPIError(res.request.path, res.body, res.request.method) : err);\n resolve(err);\n }\n } else {\n this.globalLimit = false;\n const data = res && res.body ? res.body : {};\n item.resolve(data);\n if (this.requestRemaining === 0) {\n if (this.client.listenerCount(RATE_LIMIT)) {\n /**\n * Emitted when the client hits a rate limit while making a request\n * @event Client#rateLimit\n * @param {Object} rateLimitInfo Object containing the rate limit info\n * @param {number} rateLimitInfo.limit Number of requests that can be made to this endpoint\n * @param {number} rateLimitInfo.timeDifference Delta-T in ms between your system and Discord servers\n * @param {string} rateLimitInfo.path Path used for request that triggered this event\n * @param {string} rateLimitInfo.method HTTP method used for request that triggered this event\n */\n this.client.emit(RATE_LIMIT, {\n limit: this.requestLimit,\n timeDifference: this.timeDifference,\n path: item.request.path,\n method: item.request.method,\n });\n }\n this.client.setTimeout(\n () => resolve(data),\n this.requestResetTime - Date.now() + this.timeDifference + this.client.options.restTimeOffset\n );\n } else {\n resolve(data);\n }\n }\n });\n });\n }\n\n handle() {\n super.handle();\n if (this.busy || this.remaining === 0 || this.queue.length === 0 || this.globalLimit) return;\n this.execute(this.queue.shift()).then(() => {\n this.busy = false;\n this.handle();\n });\n }\n}\n\nmodule.exports = SequentialRequestHandler;\n\n\n//# sourceURL=webpack:///./src/client/rest/RequestHandlers/Sequential.js?"); + +/***/ }), + +/***/ "./src/client/rest/UserAgentManager.js": +/*!*********************************************!*\ + !*** ./src/client/rest/UserAgentManager.js ***! + \*********************************************/ +/*! no static exports found */ +/*! ModuleConcatenation bailout: Module is not an ECMAScript module */ +/***/ (function(module, exports, __webpack_require__) { + +eval("/* WEBPACK VAR INJECTION */(function(process) {const Constants = __webpack_require__(/*! ../../util/Constants */ \"./src/util/Constants.js\");\n\nclass UserAgentManager {\n constructor() {\n this.build(this.constructor.DEFAULT);\n }\n\n set({ url, version } = {}) {\n this.build({\n url: url || this.constructor.DFEAULT.url,\n version: version || this.constructor.DEFAULT.version,\n });\n }\n\n build(ua) {\n this.userAgent = `DiscordBot (${ua.url}, ${ua.version}) Node.js/${process.version}`;\n }\n}\n\nUserAgentManager.DEFAULT = {\n url: Constants.Package.homepage.split('#')[0],\n version: Constants.Package.version,\n};\n\nmodule.exports = UserAgentManager;\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/rest/UserAgentManager.js?"); + +/***/ }), + +/***/ "./src/client/websocket/WebSocketConnection.js": +/*!*****************************************************!*\ + !*** ./src/client/websocket/WebSocketConnection.js ***! + \*****************************************************/ +/*! no static exports found */ +/*! 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?"); + +/***/ }), + +/***/ "./src/client/websocket/WebSocketManager.js": +/*!**************************************************!*\ + !*** ./src/client/websocket/WebSocketManager.js ***! + \**************************************************/ +/*! no static exports found */ +/*! ModuleConcatenation bailout: Module is not an ECMAScript module */ +/***/ (function(module, exports, __webpack_require__) { + +eval("const EventEmitter = __webpack_require__(/*! events */ \"./node_modules/events/events.js\").EventEmitter;\nconst Constants = __webpack_require__(/*! ../../util/Constants */ \"./src/util/Constants.js\");\nconst WebSocketConnection = __webpack_require__(/*! ./WebSocketConnection */ \"./src/client/websocket/WebSocketConnection.js\");\n\n/**\n * WebSocket Manager of the client.\n * @private\n */\nclass WebSocketManager extends EventEmitter {\n constructor(client) {\n super();\n /**\n * The client that instantiated this WebSocketManager\n * @type {Client}\n */\n this.client = client;\n\n /**\n * The WebSocket connection of this manager\n * @type {?WebSocketConnection}\n */\n this.connection = null;\n }\n\n /**\n * Sends a heartbeat on the available connection.\n * @returns {void}\n */\n heartbeat() {\n if (!this.connection) return this.debug('No connection to heartbeat');\n return this.connection.heartbeat();\n }\n\n /**\n * Emits a debug event.\n * @param {string} message Debug message\n * @returns {void}\n */\n debug(message) {\n return this.client.emit('debug', `[ws] ${message}`);\n }\n\n /**\n * Destroy the client.\n * @returns {void} Whether or not destruction was successful\n */\n destroy() {\n if (!this.connection) {\n this.debug('Attempted to destroy WebSocket but no connection exists!');\n return false;\n }\n return this.connection.destroy();\n }\n\n /**\n * Send a packet on the available WebSocket.\n * @param {Object} packet Packet to send\n * @returns {void}\n */\n send(packet) {\n if (!this.connection) {\n this.debug('No connection to websocket');\n return;\n }\n this.connection.send(packet);\n }\n\n /**\n * Connects the client to a gateway.\n * @param {string} gateway The gateway to connect to\n * @returns {boolean}\n */\n connect(gateway) {\n if (!this.connection) {\n this.connection = new WebSocketConnection(this, gateway);\n return true;\n }\n switch (this.connection.status) {\n case Constants.Status.IDLE:\n case Constants.Status.DISCONNECTED:\n this.connection.connect(gateway, 5500);\n return true;\n default:\n this.debug(`Couldn't connect to ${gateway} as the websocket is at state ${this.connection.status}`);\n return false;\n }\n }\n}\n\nmodule.exports = WebSocketManager;\n\n\n//# sourceURL=webpack:///./src/client/websocket/WebSocketManager.js?"); + +/***/ }), + +/***/ "./src/client/websocket/packets/WebSocketPacketManager.js": +/*!****************************************************************!*\ + !*** ./src/client/websocket/packets/WebSocketPacketManager.js ***! + \****************************************************************/ +/*! no static exports found */ +/*! 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?"); + +/***/ }), + +/***/ "./src/client/websocket/packets/handlers/AbstractHandler.js": +/*!******************************************************************!*\ + !*** ./src/client/websocket/packets/handlers/AbstractHandler.js ***! + \******************************************************************/ +/*! no static exports found */ +/*! ModuleConcatenation bailout: Module is not an ECMAScript module */ +/***/ (function(module, exports) { + +eval("class AbstractHandler {\n constructor(packetManager) {\n this.packetManager = packetManager;\n }\n\n handle(packet) {\n return packet;\n }\n}\n\nmodule.exports = AbstractHandler;\n\n\n//# sourceURL=webpack:///./src/client/websocket/packets/handlers/AbstractHandler.js?"); + +/***/ }), + +/***/ "./src/client/websocket/packets/handlers/ChannelCreate.js": +/*!****************************************************************!*\ + !*** ./src/client/websocket/packets/handlers/ChannelCreate.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 ChannelCreateHandler extends AbstractHandler {\n handle(packet) {\n const client = this.packetManager.client;\n const data = packet.d;\n client.actions.ChannelCreate.handle(data);\n }\n}\n\n/**\n * Emitted whenever a channel is created.\n * @event Client#channelCreate\n * @param {Channel} channel The channel that was created\n */\n\nmodule.exports = ChannelCreateHandler;\n\n\n//# sourceURL=webpack:///./src/client/websocket/packets/handlers/ChannelCreate.js?"); + +/***/ }), + +/***/ "./src/client/websocket/packets/handlers/ChannelDelete.js": +/*!****************************************************************!*\ + !*** ./src/client/websocket/packets/handlers/ChannelDelete.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\nconst Constants = __webpack_require__(/*! ../../../../util/Constants */ \"./src/util/Constants.js\");\n\nclass ChannelDeleteHandler extends AbstractHandler {\n handle(packet) {\n const client = this.packetManager.client;\n const data = packet.d;\n const response = client.actions.ChannelDelete.handle(data);\n if (response.channel) client.emit(Constants.Events.CHANNEL_DELETE, response.channel);\n }\n}\n\n/**\n * Emitted whenever a channel is deleted.\n * @event Client#channelDelete\n * @param {Channel} channel The channel that was deleted\n */\n\nmodule.exports = ChannelDeleteHandler;\n\n\n//# sourceURL=webpack:///./src/client/websocket/packets/handlers/ChannelDelete.js?"); + +/***/ }), + +/***/ "./src/client/websocket/packets/handlers/ChannelPinsUpdate.js": +/*!********************************************************************!*\ + !*** ./src/client/websocket/packets/handlers/ChannelPinsUpdate.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\");\nconst Constants = __webpack_require__(/*! ../../../../util/Constants */ \"./src/util/Constants.js\");\n\n/*\n{ t: 'CHANNEL_PINS_UPDATE',\n s: 666,\n op: 0,\n d:\n { last_pin_timestamp: '2016-08-28T17:37:13.171774+00:00',\n channel_id: '314866471639044027' } }\n*/\n\nclass ChannelPinsUpdate extends AbstractHandler {\n handle(packet) {\n const client = this.packetManager.client;\n const data = packet.d;\n const channel = client.channels.get(data.channel_id);\n const time = new Date(data.last_pin_timestamp);\n if (channel && time) {\n // Discord sends null for last_pin_timestamp if the last pinned message was removed\n channel.lastPinTimestamp = time.getTime() || null;\n\n client.emit(Constants.Events.CHANNEL_PINS_UPDATE, channel, time);\n }\n }\n}\n\n/**\n * Emitted whenever the pins of a channel are updated. Due to the nature of the WebSocket event, not much information\n * can be provided easily here - you need to manually check the pins yourself.\n * The `time` parameter will be a Unix Epoch Date object when there are no pins left.\n * @event Client#channelPinsUpdate\n * @param {Channel} channel The channel that the pins update occured in\n * @param {Date} time The time when the last pinned message was pinned\n */\n\nmodule.exports = ChannelPinsUpdate;\n\n\n//# sourceURL=webpack:///./src/client/websocket/packets/handlers/ChannelPinsUpdate.js?"); + +/***/ }), + +/***/ "./src/client/websocket/packets/handlers/ChannelUpdate.js": +/*!****************************************************************!*\ + !*** ./src/client/websocket/packets/handlers/ChannelUpdate.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 ChannelUpdateHandler extends AbstractHandler {\n handle(packet) {\n const client = this.packetManager.client;\n const data = packet.d;\n client.actions.ChannelUpdate.handle(data);\n }\n}\n\nmodule.exports = ChannelUpdateHandler;\n\n\n//# sourceURL=webpack:///./src/client/websocket/packets/handlers/ChannelUpdate.js?"); + +/***/ }), + +/***/ "./src/client/websocket/packets/handlers/GuildBanAdd.js": +/*!**************************************************************!*\ + !*** ./src/client/websocket/packets/handlers/GuildBanAdd.js ***! + \**************************************************************/ +/*! no static exports found */ +/*! ModuleConcatenation bailout: Module is not an ECMAScript module */ +/***/ (function(module, exports, __webpack_require__) { + +eval("// ##untested handler##\n\nconst AbstractHandler = __webpack_require__(/*! ./AbstractHandler */ \"./src/client/websocket/packets/handlers/AbstractHandler.js\");\nconst Constants = __webpack_require__(/*! ../../../../util/Constants */ \"./src/util/Constants.js\");\n\nclass GuildBanAddHandler extends AbstractHandler {\n handle(packet) {\n const client = this.packetManager.client;\n const data = packet.d;\n const guild = client.guilds.get(data.guild_id);\n const user = client.users.get(data.user.id);\n if (guild && user) client.emit(Constants.Events.GUILD_BAN_ADD, guild, user);\n }\n}\n\n/**\n * Emitted whenever a member is banned from a guild.\n * @event Client#guildBanAdd\n * @param {Guild} guild The guild that the ban occurred in\n * @param {User} user The user that was banned\n */\n\nmodule.exports = GuildBanAddHandler;\n\n\n//# sourceURL=webpack:///./src/client/websocket/packets/handlers/GuildBanAdd.js?"); + +/***/ }), + +/***/ "./src/client/websocket/packets/handlers/GuildBanRemove.js": +/*!*****************************************************************!*\ + !*** ./src/client/websocket/packets/handlers/GuildBanRemove.js ***! + \*****************************************************************/ +/*! no static exports found */ +/*! ModuleConcatenation bailout: Module is not an ECMAScript module */ +/***/ (function(module, exports, __webpack_require__) { + +eval("// ##untested handler##\n\nconst AbstractHandler = __webpack_require__(/*! ./AbstractHandler */ \"./src/client/websocket/packets/handlers/AbstractHandler.js\");\n\nclass GuildBanRemoveHandler extends AbstractHandler {\n handle(packet) {\n const client = this.packetManager.client;\n const data = packet.d;\n client.actions.GuildBanRemove.handle(data);\n }\n}\n\n/**\n * Emitted whenever a member is unbanned from a guild.\n * @event Client#guildBanRemove\n * @param {Guild} guild The guild that the unban occurred in\n * @param {User} user The user that was unbanned\n */\n\nmodule.exports = GuildBanRemoveHandler;\n\n\n//# sourceURL=webpack:///./src/client/websocket/packets/handlers/GuildBanRemove.js?"); + +/***/ }), + +/***/ "./src/client/websocket/packets/handlers/GuildCreate.js": +/*!**************************************************************!*\ + !*** ./src/client/websocket/packets/handlers/GuildCreate.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 GuildCreateHandler extends AbstractHandler {\n handle(packet) {\n const client = this.packetManager.client;\n const data = packet.d;\n\n const guild = client.guilds.get(data.id);\n if (guild) {\n if (!guild.available && !data.unavailable) {\n // A newly available guild\n guild.setup(data);\n this.packetManager.ws.checkIfReady();\n }\n } else {\n // A new guild\n client.dataManager.newGuild(data);\n }\n }\n}\n\nmodule.exports = GuildCreateHandler;\n\n\n//# sourceURL=webpack:///./src/client/websocket/packets/handlers/GuildCreate.js?"); + +/***/ }), + +/***/ "./src/client/websocket/packets/handlers/GuildDelete.js": +/*!**************************************************************!*\ + !*** ./src/client/websocket/packets/handlers/GuildDelete.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\");\nconst Constants = __webpack_require__(/*! ../../../../util/Constants */ \"./src/util/Constants.js\");\n\nclass GuildDeleteHandler extends AbstractHandler {\n handle(packet) {\n const client = this.packetManager.client;\n const data = packet.d;\n const response = client.actions.GuildDelete.handle(data);\n if (response.guild) client.emit(Constants.Events.GUILD_DELETE, response.guild);\n }\n}\n\n/**\n * Emitted whenever a guild is deleted/left.\n * @event Client#guildDelete\n * @param {Guild} guild The guild that was deleted\n */\n\nmodule.exports = GuildDeleteHandler;\n\n\n//# sourceURL=webpack:///./src/client/websocket/packets/handlers/GuildDelete.js?"); + +/***/ }), + +/***/ "./src/client/websocket/packets/handlers/GuildEmojisUpdate.js": +/*!********************************************************************!*\ + !*** ./src/client/websocket/packets/handlers/GuildEmojisUpdate.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 GuildEmojisUpdate extends AbstractHandler {\n handle(packet) {\n const client = this.packetManager.client;\n const data = packet.d;\n client.actions.GuildEmojisUpdate.handle(data);\n }\n}\n\nmodule.exports = GuildEmojisUpdate;\n\n\n//# sourceURL=webpack:///./src/client/websocket/packets/handlers/GuildEmojisUpdate.js?"); + +/***/ }), + +/***/ "./src/client/websocket/packets/handlers/GuildIntegrationsUpdate.js": +/*!**************************************************************************!*\ + !*** ./src/client/websocket/packets/handlers/GuildIntegrationsUpdate.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\");\nconst { Events } = __webpack_require__(/*! ../../../../util/Constants */ \"./src/util/Constants.js\");\n\nclass GuildIntegrationsHandler extends AbstractHandler {\n handle(packet) {\n const client = this.packetManager.client;\n const data = packet.d;\n const guild = client.guilds.get(data.guild_id);\n if (guild) client.emit(Events.GUILD_INTEGRATIONS_UPDATE, guild);\n }\n}\n\nmodule.exports = GuildIntegrationsHandler;\n\n/**\n * Emitted whenever a guild integration is updated\n * @event Client#guildIntegrationsUpdate\n * @param {Guild} guild The guild whose integrations were updated\n */\n\n\n//# sourceURL=webpack:///./src/client/websocket/packets/handlers/GuildIntegrationsUpdate.js?"); + +/***/ }), + +/***/ "./src/client/websocket/packets/handlers/GuildMemberAdd.js": +/*!*****************************************************************!*\ + !*** ./src/client/websocket/packets/handlers/GuildMemberAdd.js ***! + \*****************************************************************/ +/*! no static exports found */ +/*! ModuleConcatenation bailout: Module is not an ECMAScript module */ +/***/ (function(module, exports, __webpack_require__) { + +eval("// ##untested handler##\n\nconst AbstractHandler = __webpack_require__(/*! ./AbstractHandler */ \"./src/client/websocket/packets/handlers/AbstractHandler.js\");\n\nclass GuildMemberAddHandler extends AbstractHandler {\n handle(packet) {\n const client = this.packetManager.client;\n const data = packet.d;\n const guild = client.guilds.get(data.guild_id);\n if (guild) {\n guild.memberCount++;\n guild._addMember(data);\n }\n }\n}\n\nmodule.exports = GuildMemberAddHandler;\n\n\n//# sourceURL=webpack:///./src/client/websocket/packets/handlers/GuildMemberAdd.js?"); + +/***/ }), + +/***/ "./src/client/websocket/packets/handlers/GuildMemberRemove.js": +/*!********************************************************************!*\ + !*** ./src/client/websocket/packets/handlers/GuildMemberRemove.js ***! + \********************************************************************/ +/*! no static exports found */ +/*! ModuleConcatenation bailout: Module is not an ECMAScript module */ +/***/ (function(module, exports, __webpack_require__) { + +eval("// ##untested handler##\n\nconst AbstractHandler = __webpack_require__(/*! ./AbstractHandler */ \"./src/client/websocket/packets/handlers/AbstractHandler.js\");\n\nclass GuildMemberRemoveHandler extends AbstractHandler {\n handle(packet) {\n const client = this.packetManager.client;\n const data = packet.d;\n client.actions.GuildMemberRemove.handle(data);\n }\n}\n\nmodule.exports = GuildMemberRemoveHandler;\n\n\n//# sourceURL=webpack:///./src/client/websocket/packets/handlers/GuildMemberRemove.js?"); + +/***/ }), + +/***/ "./src/client/websocket/packets/handlers/GuildMemberUpdate.js": +/*!********************************************************************!*\ + !*** ./src/client/websocket/packets/handlers/GuildMemberUpdate.js ***! + \********************************************************************/ +/*! no static exports found */ +/*! ModuleConcatenation bailout: Module is not an ECMAScript module */ +/***/ (function(module, exports, __webpack_require__) { + +eval("// ##untested handler##\n\nconst AbstractHandler = __webpack_require__(/*! ./AbstractHandler */ \"./src/client/websocket/packets/handlers/AbstractHandler.js\");\n\nclass GuildMemberUpdateHandler 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) guild._updateMember(member, data);\n }\n }\n}\n\nmodule.exports = GuildMemberUpdateHandler;\n\n\n//# sourceURL=webpack:///./src/client/websocket/packets/handlers/GuildMemberUpdate.js?"); + +/***/ }), + +/***/ "./src/client/websocket/packets/handlers/GuildMembersChunk.js": +/*!********************************************************************!*\ + !*** ./src/client/websocket/packets/handlers/GuildMembersChunk.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\");\nconst Constants = __webpack_require__(/*! ../../../../util/Constants */ \"./src/util/Constants.js\");\n// Uncomment in v12\n// const Collection = require('../../../../util/Collection');\n\nclass GuildMembersChunkHandler extends AbstractHandler {\n handle(packet) {\n const client = this.packetManager.client;\n const data = packet.d;\n const guild = client.guilds.get(data.guild_id);\n if (!guild) return;\n\n // Uncomment in v12\n // const members = new Collection();\n //\n // for (const member of data.members) members.set(member.id, guild._addMember(member, false));\n\n const members = data.members.map(member => guild._addMember(member, false));\n\n client.emit(Constants.Events.GUILD_MEMBERS_CHUNK, members, guild);\n\n client.ws.lastHeartbeatAck = true;\n }\n}\n\n/**\n * Emitted whenever a chunk of guild members is received (all members come from the same guild).\n * @event Client#guildMembersChunk\n * @param {GuildMember[]} members The members in the chunk\n * @param {Guild} guild The guild related to the member chunk\n */\n\nmodule.exports = GuildMembersChunkHandler;\n\n\n//# sourceURL=webpack:///./src/client/websocket/packets/handlers/GuildMembersChunk.js?"); + +/***/ }), + +/***/ "./src/client/websocket/packets/handlers/GuildRoleCreate.js": +/*!******************************************************************!*\ + !*** ./src/client/websocket/packets/handlers/GuildRoleCreate.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 GuildRoleCreateHandler extends AbstractHandler {\n handle(packet) {\n const client = this.packetManager.client;\n const data = packet.d;\n client.actions.GuildRoleCreate.handle(data);\n }\n}\n\nmodule.exports = GuildRoleCreateHandler;\n\n\n//# sourceURL=webpack:///./src/client/websocket/packets/handlers/GuildRoleCreate.js?"); + +/***/ }), + +/***/ "./src/client/websocket/packets/handlers/GuildRoleDelete.js": +/*!******************************************************************!*\ + !*** ./src/client/websocket/packets/handlers/GuildRoleDelete.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 GuildRoleDeleteHandler extends AbstractHandler {\n handle(packet) {\n const client = this.packetManager.client;\n const data = packet.d;\n client.actions.GuildRoleDelete.handle(data);\n }\n}\n\nmodule.exports = GuildRoleDeleteHandler;\n\n\n//# sourceURL=webpack:///./src/client/websocket/packets/handlers/GuildRoleDelete.js?"); + +/***/ }), + +/***/ "./src/client/websocket/packets/handlers/GuildRoleUpdate.js": +/*!******************************************************************!*\ + !*** ./src/client/websocket/packets/handlers/GuildRoleUpdate.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 GuildRoleUpdateHandler extends AbstractHandler {\n handle(packet) {\n const client = this.packetManager.client;\n const data = packet.d;\n client.actions.GuildRoleUpdate.handle(data);\n }\n}\n\nmodule.exports = GuildRoleUpdateHandler;\n\n\n//# sourceURL=webpack:///./src/client/websocket/packets/handlers/GuildRoleUpdate.js?"); + +/***/ }), + +/***/ "./src/client/websocket/packets/handlers/GuildSync.js": +/*!************************************************************!*\ + !*** ./src/client/websocket/packets/handlers/GuildSync.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 GuildSyncHandler extends AbstractHandler {\n handle(packet) {\n const client = this.packetManager.client;\n const data = packet.d;\n client.actions.GuildSync.handle(data);\n }\n}\n\nmodule.exports = GuildSyncHandler;\n\n\n//# sourceURL=webpack:///./src/client/websocket/packets/handlers/GuildSync.js?"); + +/***/ }), + +/***/ "./src/client/websocket/packets/handlers/GuildUpdate.js": +/*!**************************************************************!*\ + !*** ./src/client/websocket/packets/handlers/GuildUpdate.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 GuildUpdateHandler extends AbstractHandler {\n handle(packet) {\n const client = this.packetManager.client;\n const data = packet.d;\n client.actions.GuildUpdate.handle(data);\n }\n}\n\nmodule.exports = GuildUpdateHandler;\n\n\n//# sourceURL=webpack:///./src/client/websocket/packets/handlers/GuildUpdate.js?"); + +/***/ }), + +/***/ "./src/client/websocket/packets/handlers/MessageCreate.js": +/*!****************************************************************!*\ + !*** ./src/client/websocket/packets/handlers/MessageCreate.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\");\nconst Constants = __webpack_require__(/*! ../../../../util/Constants */ \"./src/util/Constants.js\");\n\nclass MessageCreateHandler extends AbstractHandler {\n handle(packet) {\n const client = this.packetManager.client;\n const data = packet.d;\n const response = client.actions.MessageCreate.handle(data);\n if (response.message) client.emit(Constants.Events.MESSAGE_CREATE, response.message);\n }\n}\n\n/**\n * Emitted whenever a message is created.\n * @event Client#message\n * @param {Message} message The created message\n */\n\nmodule.exports = MessageCreateHandler;\n\n\n//# sourceURL=webpack:///./src/client/websocket/packets/handlers/MessageCreate.js?"); + +/***/ }), + +/***/ "./src/client/websocket/packets/handlers/MessageDelete.js": +/*!****************************************************************!*\ + !*** ./src/client/websocket/packets/handlers/MessageDelete.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\");\nconst Constants = __webpack_require__(/*! ../../../../util/Constants */ \"./src/util/Constants.js\");\n\nclass MessageDeleteHandler extends AbstractHandler {\n handle(packet) {\n const client = this.packetManager.client;\n const data = packet.d;\n const response = client.actions.MessageDelete.handle(data);\n if (response.message) client.emit(Constants.Events.MESSAGE_DELETE, response.message);\n }\n}\n\n/**\n * Emitted whenever a message is deleted.\n * @event Client#messageDelete\n * @param {Message} message The deleted message\n */\n\nmodule.exports = MessageDeleteHandler;\n\n\n//# sourceURL=webpack:///./src/client/websocket/packets/handlers/MessageDelete.js?"); + +/***/ }), + +/***/ "./src/client/websocket/packets/handlers/MessageDeleteBulk.js": +/*!********************************************************************!*\ + !*** ./src/client/websocket/packets/handlers/MessageDeleteBulk.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 MessageDeleteBulkHandler extends AbstractHandler {\n handle(packet) {\n const client = this.packetManager.client;\n const data = packet.d;\n client.actions.MessageDeleteBulk.handle(data);\n }\n}\n\n/**\n * Emitted whenever messages are deleted in bulk.\n * @event Client#messageDeleteBulk\n * @param {Collection} messages The deleted messages, mapped by their ID\n */\n\nmodule.exports = MessageDeleteBulkHandler;\n\n\n//# sourceURL=webpack:///./src/client/websocket/packets/handlers/MessageDeleteBulk.js?"); + +/***/ }), + +/***/ "./src/client/websocket/packets/handlers/MessageReactionAdd.js": +/*!*********************************************************************!*\ + !*** ./src/client/websocket/packets/handlers/MessageReactionAdd.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 MessageReactionAddHandler extends AbstractHandler {\n handle(packet) {\n const client = this.packetManager.client;\n const data = packet.d;\n client.actions.MessageReactionAdd.handle(data);\n }\n}\n\nmodule.exports = MessageReactionAddHandler;\n\n\n//# sourceURL=webpack:///./src/client/websocket/packets/handlers/MessageReactionAdd.js?"); + +/***/ }), + +/***/ "./src/client/websocket/packets/handlers/MessageReactionRemove.js": +/*!************************************************************************!*\ + !*** ./src/client/websocket/packets/handlers/MessageReactionRemove.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 MessageReactionRemove extends AbstractHandler {\n handle(packet) {\n const client = this.packetManager.client;\n const data = packet.d;\n client.actions.MessageReactionRemove.handle(data);\n }\n}\n\nmodule.exports = MessageReactionRemove;\n\n\n//# sourceURL=webpack:///./src/client/websocket/packets/handlers/MessageReactionRemove.js?"); + +/***/ }), + +/***/ "./src/client/websocket/packets/handlers/MessageReactionRemoveAll.js": +/*!***************************************************************************!*\ + !*** ./src/client/websocket/packets/handlers/MessageReactionRemoveAll.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 MessageReactionRemoveAll extends AbstractHandler {\n handle(packet) {\n const client = this.packetManager.client;\n const data = packet.d;\n client.actions.MessageReactionRemoveAll.handle(data);\n }\n}\n\nmodule.exports = MessageReactionRemoveAll;\n\n\n//# sourceURL=webpack:///./src/client/websocket/packets/handlers/MessageReactionRemoveAll.js?"); + +/***/ }), + +/***/ "./src/client/websocket/packets/handlers/MessageUpdate.js": +/*!****************************************************************!*\ + !*** ./src/client/websocket/packets/handlers/MessageUpdate.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 MessageUpdateHandler extends AbstractHandler {\n handle(packet) {\n const client = this.packetManager.client;\n const data = packet.d;\n client.actions.MessageUpdate.handle(data);\n }\n}\n\nmodule.exports = MessageUpdateHandler;\n\n\n//# sourceURL=webpack:///./src/client/websocket/packets/handlers/MessageUpdate.js?"); + +/***/ }), + +/***/ "./src/client/websocket/packets/handlers/PresenceUpdate.js": +/*!*****************************************************************!*\ + !*** ./src/client/websocket/packets/handlers/PresenceUpdate.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\");\nconst Constants = __webpack_require__(/*! ../../../../util/Constants */ \"./src/util/Constants.js\");\nconst Util = __webpack_require__(/*! ../../../../util/Util */ \"./src/util/Util.js\");\n\nclass PresenceUpdateHandler extends AbstractHandler {\n handle(packet) {\n const client = this.packetManager.client;\n const data = packet.d;\n let user = client.users.get(data.user.id);\n const guild = client.guilds.get(data.guild_id);\n\n // Step 1\n if (!user) {\n if (data.user.username) {\n user = client.dataManager.newUser(data.user);\n } else {\n return;\n }\n }\n\n const oldUser = Util.cloneObject(user);\n user.patch(data.user);\n if (!user.equals(oldUser)) {\n client.emit(Constants.Events.USER_UPDATE, oldUser, user);\n }\n\n if (guild) {\n let member = guild.members.get(user.id);\n if (!member && data.status !== 'offline') {\n member = guild._addMember({\n user,\n roles: data.roles,\n deaf: false,\n mute: false,\n }, false);\n client.emit(Constants.Events.GUILD_MEMBER_AVAILABLE, member);\n }\n if (member) {\n if (client.listenerCount(Constants.Events.PRESENCE_UPDATE) === 0) {\n guild._setPresence(user.id, data);\n return;\n }\n const oldMember = Util.cloneObject(member);\n if (member.presence) {\n oldMember.frozenPresence = Util.cloneObject(member.presence);\n }\n guild._setPresence(user.id, data);\n client.emit(Constants.Events.PRESENCE_UPDATE, oldMember, member);\n } else {\n guild._setPresence(user.id, data);\n }\n }\n }\n}\n\n/**\n * Emitted whenever a guild member's presence changes, or they change one of their details.\n * @event Client#presenceUpdate\n * @param {GuildMember} oldMember The member before the presence update\n * @param {GuildMember} newMember The member after the presence update\n */\n\n/**\n * Emitted whenever a user's details (e.g. username) are changed.\n * @event Client#userUpdate\n * @param {User} oldUser The user before the update\n * @param {User} newUser The user after the update\n */\n\n/**\n * Emitted whenever a member becomes available in a large guild.\n * @event Client#guildMemberAvailable\n * @param {GuildMember} member The member that became available\n */\n\nmodule.exports = PresenceUpdateHandler;\n\n\n//# sourceURL=webpack:///./src/client/websocket/packets/handlers/PresenceUpdate.js?"); + +/***/ }), + +/***/ "./src/client/websocket/packets/handlers/Ready.js": +/*!********************************************************!*\ + !*** ./src/client/websocket/packets/handlers/Ready.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\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?"); + +/***/ }), + +/***/ "./src/client/websocket/packets/handlers/RelationshipAdd.js": +/*!******************************************************************!*\ + !*** ./src/client/websocket/packets/handlers/RelationshipAdd.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 RelationshipAddHandler extends AbstractHandler {\n handle(packet) {\n const client = this.packetManager.client;\n const data = packet.d;\n if (data.type === 1) {\n client.fetchUser(data.id).then(user => {\n client.user.friends.set(user.id, user);\n });\n } else if (data.type === 2) {\n client.fetchUser(data.id).then(user => {\n client.user.blocked.set(user.id, user);\n });\n }\n }\n}\n\nmodule.exports = RelationshipAddHandler;\n\n\n//# sourceURL=webpack:///./src/client/websocket/packets/handlers/RelationshipAdd.js?"); + +/***/ }), + +/***/ "./src/client/websocket/packets/handlers/RelationshipRemove.js": +/*!*********************************************************************!*\ + !*** ./src/client/websocket/packets/handlers/RelationshipRemove.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 RelationshipRemoveHandler extends AbstractHandler {\n handle(packet) {\n const client = this.packetManager.client;\n const data = packet.d;\n if (data.type === 2) {\n if (client.user.blocked.has(data.id)) {\n client.user.blocked.delete(data.id);\n }\n } else if (data.type === 1) {\n if (client.user.friends.has(data.id)) {\n client.user.friends.delete(data.id);\n }\n }\n }\n}\n\nmodule.exports = RelationshipRemoveHandler;\n\n\n//# sourceURL=webpack:///./src/client/websocket/packets/handlers/RelationshipRemove.js?"); + +/***/ }), + +/***/ "./src/client/websocket/packets/handlers/Resumed.js": +/*!**********************************************************!*\ + !*** ./src/client/websocket/packets/handlers/Resumed.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\");\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?"); + +/***/ }), + +/***/ "./src/client/websocket/packets/handlers/TypingStart.js": +/*!**************************************************************!*\ + !*** ./src/client/websocket/packets/handlers/TypingStart.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\");\nconst Constants = __webpack_require__(/*! ../../../../util/Constants */ \"./src/util/Constants.js\");\n\nclass TypingStartHandler extends AbstractHandler {\n handle(packet) {\n const client = this.packetManager.client;\n const data = packet.d;\n const channel = client.channels.get(data.channel_id);\n const user = client.users.get(data.user_id);\n const timestamp = new Date(data.timestamp * 1000);\n\n if (channel && user) {\n if (channel.type === 'voice') {\n client.emit(Constants.Events.WARN, `Discord sent a typing packet to voice channel ${channel.id}`);\n return;\n }\n if (channel._typing.has(user.id)) {\n const typing = channel._typing.get(user.id);\n typing.lastTimestamp = timestamp;\n typing.resetTimeout(tooLate(channel, user));\n } else {\n channel._typing.set(user.id, new TypingData(client, timestamp, timestamp, tooLate(channel, user)));\n client.emit(Constants.Events.TYPING_START, channel, user);\n }\n }\n }\n}\n\nclass TypingData {\n constructor(client, since, lastTimestamp, _timeout) {\n this.client = client;\n this.since = since;\n this.lastTimestamp = lastTimestamp;\n this._timeout = _timeout;\n }\n\n resetTimeout(_timeout) {\n this.client.clearTimeout(this._timeout);\n this._timeout = _timeout;\n }\n\n get elapsedTime() {\n return Date.now() - this.since;\n }\n}\n\nfunction tooLate(channel, user) {\n return channel.client.setTimeout(() => {\n channel.client.emit(Constants.Events.TYPING_STOP, channel, user, channel._typing.get(user.id));\n channel._typing.delete(user.id);\n }, 6000);\n}\n\n/**\n * Emitted whenever a user starts typing in a channel.\n * @event Client#typingStart\n * @param {Channel} channel The channel the user started typing in\n * @param {User} user The user that started typing\n */\n\n/**\n * Emitted whenever a user stops typing in a channel.\n * @event Client#typingStop\n * @param {Channel} channel The channel the user stopped typing in\n * @param {User} user The user that stopped typing\n */\n\nmodule.exports = TypingStartHandler;\n\n\n//# sourceURL=webpack:///./src/client/websocket/packets/handlers/TypingStart.js?"); + +/***/ }), + +/***/ "./src/client/websocket/packets/handlers/UserGuildSettingsUpdate.js": +/*!**************************************************************************!*\ + !*** ./src/client/websocket/packets/handlers/UserGuildSettingsUpdate.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\");\nconst Constants = __webpack_require__(/*! ../../../../util/Constants */ \"./src/util/Constants.js\");\nconst ClientUserGuildSettings = __webpack_require__(/*! ../../../../structures/ClientUserGuildSettings */ \"./src/structures/ClientUserGuildSettings.js\");\n\nclass UserGuildSettingsUpdateHandler extends AbstractHandler {\n handle(packet) {\n const client = this.packetManager.client;\n const settings = client.user.guildSettings.get(packet.d.guild_id);\n if (settings) settings.patch(packet.d);\n else client.user.guildSettings.set(packet.d.guild_id, new ClientUserGuildSettings(packet.d, client));\n client.emit(Constants.Events.USER_GUILD_SETTINGS_UPDATE, client.user.guildSettings.get(packet.d.guild_id));\n }\n}\n\n/**\n * Emitted whenever the client user's settings update.\n * @event Client#clientUserGuildSettingsUpdate\n * @param {ClientUserGuildSettings} clientUserGuildSettings The new client user guild settings\n */\n\nmodule.exports = UserGuildSettingsUpdateHandler;\n\n\n//# sourceURL=webpack:///./src/client/websocket/packets/handlers/UserGuildSettingsUpdate.js?"); + +/***/ }), + +/***/ "./src/client/websocket/packets/handlers/UserNoteUpdate.js": +/*!*****************************************************************!*\ + !*** ./src/client/websocket/packets/handlers/UserNoteUpdate.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 UserNoteUpdateHandler extends AbstractHandler {\n handle(packet) {\n const client = this.packetManager.client;\n const data = packet.d;\n\n client.actions.UserNoteUpdate.handle(data);\n }\n}\n\nmodule.exports = UserNoteUpdateHandler;\n\n\n//# sourceURL=webpack:///./src/client/websocket/packets/handlers/UserNoteUpdate.js?"); + +/***/ }), + +/***/ "./src/client/websocket/packets/handlers/UserSettingsUpdate.js": +/*!*********************************************************************!*\ + !*** ./src/client/websocket/packets/handlers/UserSettingsUpdate.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\");\nconst Constants = __webpack_require__(/*! ../../../../util/Constants */ \"./src/util/Constants.js\");\n\nclass UserSettingsUpdateHandler extends AbstractHandler {\n handle(packet) {\n const client = this.packetManager.client;\n client.user.settings.patch(packet.d);\n client.emit(Constants.Events.USER_SETTINGS_UPDATE, client.user.settings);\n }\n}\n\n/**\n * Emitted when the client user's settings update.\n * @event Client#clientUserSettingsUpdate\n * @param {ClientUserSettings} clientUserSettings The new client user settings\n */\n\nmodule.exports = UserSettingsUpdateHandler;\n\n\n//# sourceURL=webpack:///./src/client/websocket/packets/handlers/UserSettingsUpdate.js?"); + +/***/ }), + +/***/ "./src/client/websocket/packets/handlers/UserUpdate.js": +/*!*************************************************************!*\ + !*** ./src/client/websocket/packets/handlers/UserUpdate.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 UserUpdateHandler extends AbstractHandler {\n handle(packet) {\n const client = this.packetManager.client;\n const data = packet.d;\n client.actions.UserUpdate.handle(data);\n }\n}\n\nmodule.exports = UserUpdateHandler;\n\n\n//# sourceURL=webpack:///./src/client/websocket/packets/handlers/UserUpdate.js?"); + +/***/ }), + +/***/ "./src/client/websocket/packets/handlers/VoiceServerUpdate.js": +/*!********************************************************************!*\ + !*** ./src/client/websocket/packets/handlers/VoiceServerUpdate.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\n/*\n{\n \"token\": \"my_token\",\n \"guild_id\": \"41771983423143937\",\n \"endpoint\": \"smart.loyal.discord.gg\"\n}\n*/\n\nclass VoiceServerUpdate extends AbstractHandler {\n handle(packet) {\n const client = this.packetManager.client;\n const data = packet.d;\n client.emit('self.voiceServer', data);\n }\n}\n\nmodule.exports = VoiceServerUpdate;\n\n\n//# sourceURL=webpack:///./src/client/websocket/packets/handlers/VoiceServerUpdate.js?"); + +/***/ }), + +/***/ "./src/client/websocket/packets/handlers/VoiceStateUpdate.js": +/*!*******************************************************************!*\ + !*** ./src/client/websocket/packets/handlers/VoiceStateUpdate.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\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?"); + +/***/ }), + +/***/ "./src/client/websocket/packets/handlers/WebhooksUpdate.js": +/*!*****************************************************************!*\ + !*** ./src/client/websocket/packets/handlers/WebhooksUpdate.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\");\nconst { Events } = __webpack_require__(/*! ../../../../util/Constants */ \"./src/util/Constants.js\");\n\nclass WebhooksUpdate extends AbstractHandler {\n handle(packet) {\n const client = this.packetManager.client;\n const data = packet.d;\n const channel = client.channels.get(data.channel_id);\n if (channel) client.emit(Events.WEBHOOKS_UPDATE, channel);\n }\n}\n\n/**\n * Emitted whenever a guild text channel has its webhooks changed.\n * @event Client#webhookUpdate\n * @param {TextChannel} channel The channel that had a webhook update\n */\n\nmodule.exports = WebhooksUpdate;\n\n\n//# sourceURL=webpack:///./src/client/websocket/packets/handlers/WebhooksUpdate.js?"); + +/***/ }), + +/***/ "./src/index.js": +/*!**********************!*\ + !*** ./src/index.js ***! + \**********************/ +/*! no static exports found */ +/*! 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?"); + +/***/ }), + +/***/ "./src/structures/Attachment.js": +/*!**************************************!*\ + !*** ./src/structures/Attachment.js ***! + \**************************************/ +/*! no static exports found */ +/*! ModuleConcatenation bailout: Module is not an ECMAScript module */ +/***/ (function(module, exports) { + +eval("/**\n * Represents an attachment in a message.\n * @param {BufferResolvable|Stream} file The file\n * @param {string} [name] The name of the file, if any\n */\nclass Attachment {\n constructor(file, name) {\n this.file = null;\n if (name) this.setAttachment(file, name);\n else this._attach(file);\n }\n\n /**\n * The name of the file\n * @type {?string}\n * @readonly\n */\n get name() {\n return this.file.name;\n }\n\n /**\n * The file\n * @type {?BufferResolvable|Stream}\n * @readonly\n */\n get attachment() {\n return this.file.attachment;\n }\n\n /**\n * Set the file of this attachment.\n * @param {BufferResolvable|Stream} file The file\n * @param {string} name The name of the file\n * @returns {Attachment} This attachment\n */\n setAttachment(file, name) {\n this.file = { attachment: file, name };\n return this;\n }\n\n /**\n * Set the file of this attachment.\n * @param {BufferResolvable|Stream} attachment The file\n * @returns {Attachment} This attachment\n */\n setFile(attachment) {\n this.file = { attachment };\n return this;\n }\n\n /**\n * Set the name of this attachment.\n * @param {string} name The name of the image\n * @returns {Attachment} This attachment\n */\n setName(name) {\n this.file.name = name;\n return this;\n }\n\n /**\n * Set the file of this attachment.\n * @param {BufferResolvable|Stream} file The file\n * @param {string} name The name of the file\n * @returns {void}\n * @private\n */\n _attach(file, name) {\n if (typeof file === 'string') this.file = file;\n else this.setAttachment(file, name);\n }\n}\n\nmodule.exports = Attachment;\n\n\n//# sourceURL=webpack:///./src/structures/Attachment.js?"); + +/***/ }), + +/***/ "./src/structures/CategoryChannel.js": +/*!*******************************************!*\ + !*** ./src/structures/CategoryChannel.js ***! + \*******************************************/ +/*! no static exports found */ +/*! ModuleConcatenation bailout: Module is not an ECMAScript module */ +/***/ (function(module, exports, __webpack_require__) { + +eval("const GuildChannel = __webpack_require__(/*! ./GuildChannel */ \"./src/structures/GuildChannel.js\");\n\n/**\n * Represents a guild category channel on Discord.\n * @extends {GuildChannel}\n */\nclass CategoryChannel extends GuildChannel {\n constructor(guild, data) {\n super(guild, data);\n this.type = 'category';\n }\n /**\n * The channels that are part of this category\n * @type {?Collection}\n * @readonly\n */\n get children() {\n return this.guild.channels.filter(c => c.parentID === this.id);\n }\n}\n\nmodule.exports = CategoryChannel;\n\n\n//# sourceURL=webpack:///./src/structures/CategoryChannel.js?"); + +/***/ }), + +/***/ "./src/structures/Channel.js": +/*!***********************************!*\ + !*** ./src/structures/Channel.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\");\n\n/**\n * Represents any channel on Discord.\n */\nclass Channel {\n constructor(client, data) {\n /**\n * The client that instantiated the Channel\n * @name Channel#client\n * @type {Client}\n * @readonly\n */\n Object.defineProperty(this, 'client', { value: client });\n\n /**\n * The type of the channel, either:\n * * `dm` - a DM channel\n * * `group` - a Group DM channel\n * * `text` - a guild text channel\n * * `voice` - a guild voice channel\n * * `category` - a guild category channel\n * * `news` - a guild news channel\n * * `store` - a guild store channel\n * @type {string}\n */\n this.type = null;\n\n /**\n * Whether the channel has been deleted\n * @type {boolean}\n */\n this.deleted = false;\n\n if (data) this.setup(data);\n }\n\n setup(data) {\n /**\n * The unique ID of the channel\n * @type {Snowflake}\n */\n this.id = data.id;\n }\n\n /**\n * The timestamp the channel 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 channel was created\n * @type {Date}\n * @readonly\n */\n get createdAt() {\n return new Date(this.createdTimestamp);\n }\n\n /**\n * Deletes the channel.\n * @returns {Promise}\n * @example\n * // Delete the channel\n * channel.delete()\n * .then(console.log)\n * .catch(console.error);\n */\n delete() {\n return this.client.rest.methods.deleteChannel(this);\n }\n}\n\nmodule.exports = Channel;\n\n\n//# sourceURL=webpack:///./src/structures/Channel.js?"); + +/***/ }), + +/***/ "./src/structures/ClientUser.js": +/*!**************************************!*\ + !*** ./src/structures/ClientUser.js ***! + \**************************************/ +/*! no static exports found */ +/*! ModuleConcatenation bailout: Module is not an ECMAScript module */ +/***/ (function(module, exports, __webpack_require__) { + +eval("const User = __webpack_require__(/*! ./User */ \"./src/structures/User.js\");\nconst Collection = __webpack_require__(/*! ../util/Collection */ \"./src/util/Collection.js\");\nconst ClientUserSettings = __webpack_require__(/*! ./ClientUserSettings */ \"./src/structures/ClientUserSettings.js\");\nconst ClientUserGuildSettings = __webpack_require__(/*! ./ClientUserGuildSettings */ \"./src/structures/ClientUserGuildSettings.js\");\nconst Constants = __webpack_require__(/*! ../util/Constants */ \"./src/util/Constants.js\");\nconst util = __webpack_require__(/*! util */ \"./node_modules/util/util.js\");\n\n/**\n * Represents the logged in client's Discord user.\n * @extends {User}\n */\nclass ClientUser extends User {\n setup(data) {\n super.setup(data);\n\n /**\n * Whether or not this account has been verified\n * @type {boolean}\n */\n this.verified = data.verified;\n\n /**\n * The email of this account\n * This is only filled when using a user account.\n * @type {?string}\n * @deprecated\n */\n this.email = data.email;\n this.localPresence = {};\n this._typing = new Map();\n\n /**\n * A Collection of friends for the logged in user\n * This is only filled when using a user account.\n * @type {Collection}\n * @deprecated\n */\n this.friends = new Collection();\n\n /**\n * A Collection of blocked users for the logged in user\n * This is only filled when using a user account.\n * @type {Collection}\n * @deprecated\n */\n this.blocked = new Collection();\n\n /**\n * A Collection of notes for the logged in user\n * This is only filled when using a user account.\n * @type {Collection}\n * @deprecated\n */\n this.notes = new Collection();\n\n /**\n * If the user has Discord premium (nitro)\n * This is only filled when using a user account.\n * @type {?boolean}\n * @deprecated\n */\n this.premium = typeof data.premium === 'boolean' ? data.premium : null;\n\n /**\n * If the user has MFA enabled on their account\n * @type {boolean}\n */\n this.mfaEnabled = data.mfa_enabled;\n\n /**\n * If the user has ever used a mobile device on Discord\n * This is only filled when using a user account.\n * @type {?boolean}\n * @deprecated\n */\n this.mobile = typeof data.mobile === 'boolean' ? data.mobile : null;\n\n /**\n * Various settings for this user\n * This is only filled when using a user account.\n * @type {?ClientUserSettings}\n * @deprecated\n */\n this.settings = data.user_settings ? new ClientUserSettings(this, data.user_settings) : null;\n\n /**\n * All of the user's guild settings\n * This is only filled when using a user account\n * @type {Collection}\n * @deprecated\n */\n this.guildSettings = new Collection();\n if (data.user_guild_settings) {\n for (const settings of data.user_guild_settings) {\n this.guildSettings.set(settings.guild_id, new ClientUserGuildSettings(settings, this.client));\n }\n }\n }\n\n edit(data) {\n return this.client.rest.methods.updateCurrentUser(data);\n }\n\n /**\n * Set the username of the logged in client.\n * Changing usernames in Discord is heavily rate limited, with only 2 requests\n * every hour. Use this sparingly!\n * @param {string} username The new username\n * @param {string} [password] Current password (only for user accounts)\n * @returns {Promise}\n * @example\n * // Set username\n * client.user.setUsername('discordjs')\n * .then(user => console.log(`My new username is ${user.username}`))\n * .catch(console.error);\n */\n setUsername(username, password) {\n return this.client.rest.methods.updateCurrentUser({ username }, password);\n }\n\n /**\n * Changes the email for the client user's account.\n * This is only available when using a user account.\n * @param {string} email New email to change to\n * @param {string} password Current password\n * @returns {Promise}\n * @deprecated\n * @example\n * // Set email\n * client.user.setEmail('bob@gmail.com', 'some amazing password 123')\n * .then(user => console.log(`My new email is ${user.email}`))\n * .catch(console.error);\n */\n setEmail(email, password) {\n return this.client.rest.methods.updateCurrentUser({ email }, password);\n }\n\n /**\n * Changes the password for the client user's account.\n * This is only available when using a user account.\n * @param {string} newPassword New password to change to\n * @param {string} oldPassword Current password\n * @returns {Promise}\n * @deprecated\n * @example\n * // Set password\n * client.user.setPassword('some new amazing password 456', 'some amazing password 123')\n * .then(user => console.log('New password set!'))\n * .catch(console.error);\n */\n setPassword(newPassword, oldPassword) {\n return this.client.rest.methods.updateCurrentUser({ password: newPassword }, oldPassword);\n }\n\n /**\n * Set the avatar of the logged in client.\n * @param {BufferResolvable|Base64Resolvable} avatar The new avatar\n * @returns {Promise}\n * @example\n * // Set avatar\n * client.user.setAvatar('./avatar.png')\n * .then(user => console.log(`New avatar set!`))\n * .catch(console.error);\n */\n setAvatar(avatar) {\n return this.client.resolver.resolveImage(avatar).then(data =>\n this.client.rest.methods.updateCurrentUser({ avatar: data })\n );\n }\n\n /**\n * Data resembling a raw Discord presence.\n * @typedef {Object} PresenceData\n * @property {PresenceStatus} [status] Status of the user\n * @property {boolean} [afk] Whether the user is AFK\n * @property {Object} [game] Game the user is playing\n * @property {string} [game.name] Name of the game\n * @property {string} [game.url] Twitch stream URL\n * @property {?ActivityType|number} [game.type] Type of the activity\n */\n\n /**\n * Sets the full presence of the client user.\n * @param {PresenceData} data Data for the presence\n * @returns {Promise}\n * @example\n * // Set the client user's presence\n * client.user.setPresence({ game: { name: 'with discord.js' }, status: 'idle' })\n * .then(console.log)\n * .catch(console.error);\n */\n setPresence(data) {\n // {\"op\":3,\"d\":{\"status\":\"dnd\",\"since\":0,\"game\":null,\"afk\":false}}\n return new Promise(resolve => {\n let status = this.localPresence.status || this.presence.status;\n let game = this.localPresence.game;\n let afk = this.localPresence.afk || this.presence.afk;\n\n if (!game && this.presence.game) {\n game = {\n name: this.presence.game.name,\n type: this.presence.game.type,\n url: this.presence.game.url,\n };\n }\n\n if (data.status) {\n if (typeof data.status !== 'string') throw new TypeError('Status must be a string');\n if (this.bot) {\n status = data.status;\n } else {\n this.settings.update(Constants.UserSettingsMap.status, data.status);\n status = 'invisible';\n }\n }\n\n if (data.game) {\n game = data.game;\n game.type = game.url && typeof game.type === 'undefined' ? 1 : game.type || 0;\n if (typeof game.type === 'string') {\n game.type = Constants.ActivityTypes.indexOf(game.type.toUpperCase());\n }\n } else if (typeof data.game !== 'undefined') {\n game = null;\n }\n\n if (typeof data.afk !== 'undefined') afk = data.afk;\n afk = Boolean(afk);\n\n this.localPresence = { status, game, afk };\n this.localPresence.since = 0;\n this.localPresence.game = this.localPresence.game || null;\n\n this.client.ws.send({\n op: 3,\n d: this.localPresence,\n });\n\n this.client._setPresence(this.id, this.localPresence);\n\n resolve(this);\n });\n }\n\n /**\n * A user's status. Must be one of:\n * * `online`\n * * `idle`\n * * `invisible`\n * * `dnd` (do not disturb)\n * @typedef {string} PresenceStatus\n */\n\n /**\n * Sets the status of the client user.\n * @param {PresenceStatus} status Status to change to\n * @returns {Promise}\n * @example\n * // Set the client user's status\n * client.user.setStatus('idle')\n * .then(console.log)\n * .catch(console.error);\n */\n setStatus(status) {\n return this.setPresence({ status });\n }\n\n /**\n * Sets the game the client user is playing.\n * @param {?string} game Game being played\n * @param {?string} [streamingURL] Twitch stream URL\n * @returns {Promise}\n * @deprecated\n */\n setGame(game, streamingURL) {\n if (!game) return this.setPresence({ game: null });\n return this.setPresence({\n game: {\n name: game,\n url: streamingURL,\n },\n });\n }\n\n /**\n * Sets the activity the client user is playing.\n * @param {?string} name Activity being played\n * @param {Object} [options] Options for setting the activity\n * @param {string} [options.url] Twitch stream URL\n * @param {ActivityType|number} [options.type] Type of the activity\n * @returns {Promise}\n * @example\n * client.user.setActivity('YouTube', { type: 'WATCHING' })\n * .then(presence => console.log(`Activity set to ${presence.game ? presence.game.name : 'none'}`))\n * .catch(console.error);\n */\n setActivity(name, { url, type } = {}) {\n if (!name) return this.setPresence({ game: null });\n return this.setPresence({\n game: { name, type, url },\n }).then(clientUser => clientUser.presence);\n }\n\n /**\n * Sets/removes the AFK flag for the client user.\n * @param {boolean} afk Whether or not the user is AFK\n * @returns {Promise}\n */\n setAFK(afk) {\n return this.setPresence({ afk });\n }\n\n /**\n * Fetches messages that mentioned the client's user.\n * This is only available when using a user account.\n * @param {Object} [options] Options for the fetch\n * @param {number} [options.limit=25] Maximum number of mentions to retrieve\n * @param {boolean} [options.roles=true] Whether to include role mentions\n * @param {boolean} [options.everyone=true] Whether to include everyone/here mentions\n * @param {GuildResolvable} [options.guild] Limit the search to a specific guild\n * @returns {Promise}\n * @deprecated\n * @example\n * // Fetch mentions\n * client.user.fetchMentions()\n * .then(console.log)\n * .catch(console.error);\n * @example\n * // Fetch mentions from a guild\n * client.user.fetchMentions({ guild: '222078108977594368' })\n * .then(console.log)\n * .catch(console.error);\n */\n fetchMentions(options = {}) {\n return this.client.rest.methods.fetchMentions(options);\n }\n\n /**\n * Send a friend request.\n * This is only available when using a user account.\n * @param {UserResolvable} user The user to send the friend request to\n * @returns {Promise} The user the friend request was sent to\n * @deprecated\n */\n addFriend(user) {\n user = this.client.resolver.resolveUser(user);\n return this.client.rest.methods.addFriend(user);\n }\n\n /**\n * Remove a friend.\n * This is only available when using a user account.\n * @param {UserResolvable} user The user to remove from your friends\n * @returns {Promise} The user that was removed\n * @deprecated\n */\n removeFriend(user) {\n user = this.client.resolver.resolveUser(user);\n return this.client.rest.methods.removeFriend(user);\n }\n\n /**\n * Creates a guild.\n * This is only available to bots in less than 10 guilds and user accounts.\n * @param {string} name The name of the guild\n * @param {string} [region] The region for the server\n * @param {BufferResolvable|Base64Resolvable} [icon=null] The icon for the guild\n * @returns {Promise} The guild that was created\n */\n createGuild(name, region, icon = null) {\n if (typeof icon === 'string' && icon.startsWith('data:')) {\n return this.client.rest.methods.createGuild({ name, icon, region });\n } else {\n return this.client.resolver.resolveImage(icon).then(data =>\n this.client.rest.methods.createGuild({ name, icon: data, region })\n );\n }\n }\n\n /**\n * An object containing either a user or access token, and an optional nickname.\n * @typedef {Object} GroupDMRecipientOptions\n * @property {UserResolvable|Snowflake} [user] User to add to the Group DM\n * (only available if a user is creating the DM)\n * @property {string} [accessToken] Access token to use to add a user to the Group DM\n * (only available if a bot is creating the DM)\n * @property {string} [nick] Permanent nickname (only available if a bot is creating the DM)\n */\n\n /**\n * Creates a Group DM.\n * @param {GroupDMRecipientOptions[]} recipients The recipients\n * @returns {Promise}\n * @example\n * // Create a Group DM with a token provided from OAuth\n * client.user.createGroupDM([{\n * user: '66564597481480192',\n * accessToken: token\n * }])\n * .then(console.log)\n * .catch(console.error);\n */\n createGroupDM(recipients) {\n return this.client.rest.methods.createGroupDM({\n recipients: recipients.map(u => this.client.resolver.resolveUserID(u.user)),\n accessTokens: recipients.map(u => u.accessToken),\n nicks: recipients.reduce((o, r) => {\n if (r.nick) o[r.user ? r.user.id : r.id] = r.nick;\n return o;\n }, {}),\n });\n }\n\n /**\n * Accepts an invite to join a guild.\n * This is only available when using a user account.\n * @param {Invite|string} invite Invite or code to accept\n * @returns {Promise} Joined guild\n * @deprecated\n */\n acceptInvite(invite) {\n return this.client.rest.methods.acceptInvite(invite);\n }\n}\n\nClientUser.prototype.acceptInvite =\n util.deprecate(ClientUser.prototype.acceptInvite, 'ClientUser#acceptInvite: userbot methods will be removed');\n\nClientUser.prototype.setGame =\n util.deprecate(ClientUser.prototype.setGame, 'ClientUser#setGame: use ClientUser#setActivity instead');\n\nClientUser.prototype.addFriend =\n util.deprecate(ClientUser.prototype.addFriend, 'ClientUser#addFriend: userbot methods will be removed');\n\nClientUser.prototype.removeFriend =\n util.deprecate(ClientUser.prototype.removeFriend, 'ClientUser#removeFriend: userbot methods will be removed');\n\nClientUser.prototype.setPassword =\n util.deprecate(ClientUser.prototype.setPassword, 'ClientUser#setPassword: userbot methods will be removed');\n\nClientUser.prototype.setEmail =\n util.deprecate(ClientUser.prototype.setEmail, 'ClientUser#setEmail: userbot methods will be removed');\n\nClientUser.prototype.fetchMentions =\n util.deprecate(ClientUser.prototype.fetchMentions, 'ClientUser#fetchMentions: userbot methods will be removed');\n\nmodule.exports = ClientUser;\n\n\n//# sourceURL=webpack:///./src/structures/ClientUser.js?"); + +/***/ }), + +/***/ "./src/structures/ClientUserChannelOverride.js": +/*!*****************************************************!*\ + !*** ./src/structures/ClientUserChannelOverride.js ***! + \*****************************************************/ +/*! no static exports found */ +/*! 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\n/**\n * A wrapper around the ClientUser's channel overrides.\n */\nclass ClientUserChannelOverride {\n constructor(data) {\n this.patch(data);\n }\n\n /**\n * Patch the data contained in this class with new partial data.\n * @param {Object} data Data to patch this with\n * @returns {void}\n * @private\n */\n patch(data) {\n for (const key of Object.keys(Constants.UserChannelOverrideMap)) {\n const value = Constants.UserChannelOverrideMap[key];\n if (!data.hasOwnProperty(key)) continue;\n if (typeof value === 'function') {\n this[value.name] = value(data[key]);\n } else {\n this[value] = data[key];\n }\n }\n }\n}\n\nmodule.exports = ClientUserChannelOverride;\n\n\n//# sourceURL=webpack:///./src/structures/ClientUserChannelOverride.js?"); + +/***/ }), + +/***/ "./src/structures/ClientUserGuildSettings.js": +/*!***************************************************!*\ + !*** ./src/structures/ClientUserGuildSettings.js ***! + \***************************************************/ +/*! no static exports found */ +/*! 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 ClientUserChannelOverride = __webpack_require__(/*! ./ClientUserChannelOverride */ \"./src/structures/ClientUserChannelOverride.js\");\n\n/**\n * A wrapper around the ClientUser's guild settings.\n */\nclass ClientUserGuildSettings {\n constructor(data, client) {\n /**\n * The client that created the instance of the ClientUserGuildSettings\n * @name ClientUserGuildSettings#client\n * @type {Client}\n * @readonly\n */\n Object.defineProperty(this, 'client', { value: client });\n /**\n * The ID of the guild this settings are for\n * @type {Snowflake}\n */\n this.guildID = data.guild_id;\n this.channelOverrides = new Collection();\n this.patch(data);\n }\n\n /**\n * Patch the data contained in this class with new partial data.\n * @param {Object} data Data to patch this with\n * @returns {void}\n * @private\n */\n patch(data) {\n for (const key of Object.keys(Constants.UserGuildSettingsMap)) {\n const value = Constants.UserGuildSettingsMap[key];\n if (!data.hasOwnProperty(key)) continue;\n if (key === 'channel_overrides') {\n for (const channel of data[key]) {\n this.channelOverrides.set(channel.channel_id,\n new ClientUserChannelOverride(channel));\n }\n } else if (typeof value === 'function') {\n this[value.name] = value(data[key]);\n } else {\n this[value] = data[key];\n }\n }\n }\n\n /**\n * Update a specific property of the guild settings.\n * @param {string} name Name of property\n * @param {value} value Value to patch\n * @returns {Promise}\n */\n update(name, value) {\n return this.client.rest.methods.patchClientUserGuildSettings(this.guildID, { [name]: value });\n }\n}\n\nmodule.exports = ClientUserGuildSettings;\n\n\n//# sourceURL=webpack:///./src/structures/ClientUserGuildSettings.js?"); + +/***/ }), + +/***/ "./src/structures/ClientUserSettings.js": +/*!**********************************************!*\ + !*** ./src/structures/ClientUserSettings.js ***! + \**********************************************/ +/*! no static exports found */ +/*! 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/Util */ \"./src/util/Util.js\");\n\n/**\n * A wrapper around the ClientUser's settings.\n */\nclass ClientUserSettings {\n constructor(user, data) {\n this.user = user;\n this.patch(data);\n }\n\n /**\n * Patch the data contained in this class with new partial data.\n * @param {Object} data Data to patch this with\n * @returns {void}\n * @private\n */\n patch(data) {\n for (const key of Object.keys(Constants.UserSettingsMap)) {\n const value = Constants.UserSettingsMap[key];\n if (!data.hasOwnProperty(key)) continue;\n if (typeof value === 'function') {\n this[value.name] = value(data[key]);\n } else {\n this[value] = data[key];\n }\n }\n }\n\n /**\n * Update a specific property of of user settings.\n * @param {string} name Name of property\n * @param {*} value Value to patch\n * @returns {Promise}\n */\n update(name, value) {\n return this.user.client.rest.methods.patchUserSettings({ [name]: value });\n }\n\n /**\n * Sets the position at which this guild will appear in the Discord client.\n * @param {Guild} guild The guild to move\n * @param {number} position Absolute or relative position\n * @param {boolean} [relative=false] Whether to position relatively or absolutely\n * @returns {Promise}\n */\n setGuildPosition(guild, position, relative) {\n const temp = Object.assign([], this.guildPositions);\n Util.moveElementInArray(temp, guild.id, position, relative);\n return this.update('guild_positions', temp).then(() => guild);\n }\n\n /**\n * Add a guild to the list of restricted guilds.\n * @param {Guild} guild The guild to add\n * @returns {Promise}\n */\n addRestrictedGuild(guild) {\n const temp = Object.assign([], this.restrictedGuilds);\n if (temp.includes(guild.id)) return Promise.reject(new Error('Guild is already restricted'));\n temp.push(guild.id);\n return this.update('restricted_guilds', temp).then(() => guild);\n }\n\n /**\n * Remove a guild from the list of restricted guilds.\n * @param {Guild} guild The guild to remove\n * @returns {Promise}\n */\n removeRestrictedGuild(guild) {\n const temp = Object.assign([], this.restrictedGuilds);\n const index = temp.indexOf(guild.id);\n if (index < 0) return Promise.reject(new Error('Guild is not restricted'));\n temp.splice(index, 1);\n return this.update('restricted_guilds', temp).then(() => guild);\n }\n}\n\nmodule.exports = ClientUserSettings;\n\n\n//# sourceURL=webpack:///./src/structures/ClientUserSettings.js?"); + +/***/ }), + +/***/ "./src/structures/DMChannel.js": +/*!*************************************!*\ + !*** ./src/structures/DMChannel.js ***! + \*************************************/ +/*! no static exports found */ +/*! ModuleConcatenation bailout: Module is not an ECMAScript module */ +/***/ (function(module, exports, __webpack_require__) { + +eval("const Channel = __webpack_require__(/*! ./Channel */ \"./src/structures/Channel.js\");\nconst TextBasedChannel = __webpack_require__(/*! ./interfaces/TextBasedChannel */ \"./src/structures/interfaces/TextBasedChannel.js\");\nconst Collection = __webpack_require__(/*! ../util/Collection */ \"./src/util/Collection.js\");\n\n/**\n * Represents a direct message channel between two users.\n * @extends {Channel}\n * @implements {TextBasedChannel}\n */\nclass DMChannel extends Channel {\n constructor(client, data) {\n super(client, data);\n this.type = 'dm';\n this.messages = new Collection();\n this._typing = new Map();\n }\n\n setup(data) {\n super.setup(data);\n\n /**\n * The recipient on the other end of the DM\n * @type {User}\n */\n this.recipient = this.client.dataManager.newUser(data.recipients[0]);\n\n /**\n * The ID of the last message in the channel, if one was sent\n * @type {?Snowflake}\n */\n this.lastMessageID = data.last_message_id;\n\n /**\n * The timestamp when the last pinned message was pinned, if there was one\n * @type {?number}\n */\n this.lastPinTimestamp = data.last_pin_timestamp ? new Date(data.last_pin_timestamp).getTime() : null;\n }\n\n /**\n * When concatenated with a string, this automatically concatenates the recipient's mention instead of the\n * DM channel object.\n * @returns {string}\n */\n toString() {\n return this.recipient.toString();\n }\n\n // These are here only for documentation purposes - they are implemented by TextBasedChannel\n /* eslint-disable no-empty-function */\n get lastPinAt() {}\n send() {}\n sendMessage() {}\n sendEmbed() {}\n sendFile() {}\n sendFiles() {}\n sendCode() {}\n fetchMessage() {}\n fetchMessages() {}\n fetchPinnedMessages() {}\n search() {}\n startTyping() {}\n stopTyping() {}\n get typing() {}\n get typingCount() {}\n createCollector() {}\n createMessageCollector() {}\n awaitMessages() {}\n // Doesn't work on DM channels; bulkDelete() {}\n acknowledge() {}\n _cacheMessage() {}\n}\n\nTextBasedChannel.applyToClass(DMChannel, true, ['bulkDelete']);\n\nmodule.exports = DMChannel;\n\n\n//# sourceURL=webpack:///./src/structures/DMChannel.js?"); + +/***/ }), + +/***/ "./src/structures/Emoji.js": +/*!*********************************!*\ + !*** ./src/structures/Emoji.js ***! + \*********************************/ +/*! no static exports found */ +/*! 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?"); + +/***/ }), + +/***/ "./src/structures/GroupDMChannel.js": +/*!******************************************!*\ + !*** ./src/structures/GroupDMChannel.js ***! + \******************************************/ +/*! no static exports found */ +/*! ModuleConcatenation bailout: Module is not an ECMAScript module */ +/***/ (function(module, exports, __webpack_require__) { + +eval("const Channel = __webpack_require__(/*! ./Channel */ \"./src/structures/Channel.js\");\nconst TextBasedChannel = __webpack_require__(/*! ./interfaces/TextBasedChannel */ \"./src/structures/interfaces/TextBasedChannel.js\");\nconst Collection = __webpack_require__(/*! ../util/Collection */ \"./src/util/Collection.js\");\nconst Constants = __webpack_require__(/*! ../util/Constants */ \"./src/util/Constants.js\");\n\n/*\n{ type: 3,\n recipients:\n [ { username: 'Charlie',\n id: '123',\n discriminator: '6631',\n avatar: '123' },\n { username: 'Ben',\n id: '123',\n discriminator: '2055',\n avatar: '123' },\n { username: 'Adam',\n id: '123',\n discriminator: '2406',\n avatar: '123' } ],\n owner_id: '123',\n name: null,\n last_message_id: '123',\n id: '123',\n icon: null }\n*/\n\n/**\n * Represents a Group DM on Discord.\n * @extends {Channel}\n * @implements {TextBasedChannel}\n */\nclass GroupDMChannel extends Channel {\n constructor(client, data) {\n super(client, data);\n this.type = 'group';\n this.messages = new Collection();\n this._typing = new Map();\n }\n\n setup(data) {\n super.setup(data);\n\n /**\n * The name of this Group DM, can be null if one isn't set\n * @type {string}\n */\n this.name = data.name;\n\n /**\n * A hash of this Group DM icon\n * @type {?string}\n */\n this.icon = data.icon;\n\n /**\n * The user ID of this Group DM's owner\n * @type {string}\n */\n this.ownerID = data.owner_id;\n\n /**\n * If the DM is managed by an application\n * @type {boolean}\n */\n this.managed = data.managed;\n\n /**\n * Application ID of the application that made this Group DM, if applicable\n * @type {?string}\n */\n this.applicationID = data.application_id;\n\n if (data.nicks) {\n /**\n * Nicknames for group members\n * @type {?Collection}\n */\n this.nicks = new Collection(data.nicks.map(n => [n.id, n.nick]));\n }\n\n if (!this.recipients) {\n /**\n * A collection of the recipients of this DM, mapped by their ID\n * @type {Collection}\n */\n this.recipients = new Collection();\n }\n\n if (data.recipients) {\n for (const recipient of data.recipients) {\n const user = this.client.dataManager.newUser(recipient);\n this.recipients.set(user.id, user);\n }\n }\n\n /**\n * The ID of the last message in the channel, if one was sent\n * @type {?Snowflake}\n */\n this.lastMessageID = data.last_message_id;\n\n /**\n * The timestamp when the last pinned message was pinned, if there was one\n * @type {?number}\n */\n this.lastPinTimestamp = data.last_pin_timestamp ? new Date(data.last_pin_timestamp).getTime() : null;\n }\n\n /**\n * The owner of this Group DM\n * @type {User}\n * @readonly\n */\n get owner() {\n return this.client.users.get(this.ownerID);\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.Channel(this).Icon(this.client.options.http.cdn, this.icon);\n }\n\n edit(data) {\n const _data = {};\n if (data.name) _data.name = data.name;\n if (typeof data.icon !== 'undefined') _data.icon = data.icon;\n return this.client.rest.methods.updateGroupDMChannel(this, _data);\n }\n\n /**\n * Whether this channel equals another channel. It compares all properties, so for most operations\n * it is advisable to just compare `channel.id === channel2.id` as it is much faster and is often\n * what most users need.\n * @param {GroupDMChannel} channel Channel to compare with\n * @returns {boolean}\n */\n equals(channel) {\n const equal = channel &&\n this.id === channel.id &&\n this.name === channel.name &&\n this.icon === channel.icon &&\n this.ownerID === channel.ownerID;\n\n if (equal) {\n return this.recipients.equals(channel.recipients);\n }\n\n return equal;\n }\n\n /**\n * Add a user to the DM\n * @param {UserResolvable|string} accessTokenOrID Access token or user resolvable\n * @param {string} [nick] Permanent nickname to give the user (only available if a bot is creating the DM)\n * @returns {Promise}\n */\n\n addUser(accessTokenOrID, nick) {\n return this.client.rest.methods.addUserToGroupDM(this, {\n nick,\n id: this.client.resolver.resolveUserID(accessTokenOrID),\n accessToken: accessTokenOrID,\n });\n }\n\n /**\n * Set a new GroupDMChannel icon.\n * @param {Base64Resolvable|BufferResolvable} icon The new icon of the group dm\n * @returns {Promise}\n * @example\n * // Edit the group dm icon\n * channel.setIcon('./icon.png')\n * .then(updated => console.log('Updated the channel icon'))\n * .catch(console.error);\n */\n setIcon(icon) {\n return this.client.resolver.resolveImage(icon).then(data => this.edit({ icon: data }));\n }\n\n /**\n * Sets a new name for this Group DM.\n * @param {string} name New name for this Group DM\n * @returns {Promise}\n */\n setName(name) {\n return this.edit({ name });\n }\n\n /**\n * Removes a user from this Group DM.\n * @param {UserResolvable} user User to remove\n * @returns {Promise}\n */\n removeUser(user) {\n const id = this.client.resolver.resolveUserID(user);\n return this.client.rest.methods.removeUserFromGroupDM(this, id);\n }\n\n /**\n * When concatenated with a string, this automatically concatenates the channel's name instead of the Channel object.\n * @returns {string}\n * @example\n * // Logs: Hello from My Group DM!\n * console.log(`Hello from ${channel}!`);\n * @example\n * // Logs: Hello from My Group DM!\n * console.log(`Hello from ' + channel + '!');\n */\n toString() {\n return this.name;\n }\n\n // These are here only for documentation purposes - they are implemented by TextBasedChannel\n /* eslint-disable no-empty-function */\n get lastPinAt() {}\n send() {}\n sendMessage() {}\n sendEmbed() {}\n sendFile() {}\n sendFiles() {}\n sendCode() {}\n fetchMessage() {}\n fetchMessages() {}\n fetchPinnedMessages() {}\n search() {}\n startTyping() {}\n stopTyping() {}\n get typing() {}\n get typingCount() {}\n createCollector() {}\n createMessageCollector() {}\n awaitMessages() {}\n // Doesn't work on Group DMs; bulkDelete() {}\n acknowledge() {}\n _cacheMessage() {}\n}\n\nTextBasedChannel.applyToClass(GroupDMChannel, true, ['bulkDelete']);\n\nmodule.exports = GroupDMChannel;\n\n\n//# sourceURL=webpack:///./src/structures/GroupDMChannel.js?"); + +/***/ }), + +/***/ "./src/structures/Guild.js": +/*!*********************************!*\ + !*** ./src/structures/Guild.js ***! + \*********************************/ +/*! no static exports found */ +/*! 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?"); + +/***/ }), + +/***/ "./src/structures/GuildAuditLogs.js": +/*!******************************************!*\ + !*** ./src/structures/GuildAuditLogs.js ***! + \******************************************/ +/*! no static exports found */ +/*! 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?"); + +/***/ }), + +/***/ "./src/structures/GuildChannel.js": +/*!****************************************!*\ + !*** ./src/structures/GuildChannel.js ***! + \****************************************/ +/*! no static exports found */ +/*! 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?"); + +/***/ }), + +/***/ "./src/structures/GuildMember.js": +/*!***************************************!*\ + !*** ./src/structures/GuildMember.js ***! + \***************************************/ +/*! no static exports found */ +/*! 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?"); + +/***/ }), + +/***/ "./src/structures/Invite.js": +/*!**********************************!*\ + !*** ./src/structures/Invite.js ***! + \**********************************/ +/*! no static exports found */ +/*! ModuleConcatenation bailout: Module is not an ECMAScript module */ +/***/ (function(module, exports, __webpack_require__) { + +eval("const PartialGuild = __webpack_require__(/*! ./PartialGuild */ \"./src/structures/PartialGuild.js\");\nconst PartialGuildChannel = __webpack_require__(/*! ./PartialGuildChannel */ \"./src/structures/PartialGuildChannel.js\");\nconst Constants = __webpack_require__(/*! ../util/Constants */ \"./src/util/Constants.js\");\n\n/**\n * Represents an invitation to a guild channel.\n * The only guaranteed properties are `code`, `url`, `guild`, and `channel`.\n * Other properties can be missing.\n */\nclass Invite {\n constructor(client, data) {\n /**\n * The client that instantiated the invite\n * @name Invite#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 guild the invite is for. If this guild is already known, this will be a guild object. If the guild is\n * unknown, this will be a PartialGuild object\n * @type {Guild|PartialGuild}\n */\n this.guild = this.client.guilds.get(data.guild.id) || new PartialGuild(this.client, data.guild);\n\n /**\n * The code for this invite\n * @type {string}\n */\n this.code = data.code;\n\n /**\n * The approximate number of online members of the guild this invite is for\n * @type {number}\n */\n this.presenceCount = data.approximate_presence_count;\n\n /**\n * The approximate total number of members of the guild this invite is for\n * @type {number}\n */\n this.memberCount = data.approximate_member_count;\n\n /**\n * The number of text channels the guild this invite goes to has\n * @type {number}\n */\n this.textChannelCount = data.guild.text_channel_count;\n\n /**\n * The number of voice channels the guild this invite goes to has\n * @type {number}\n */\n this.voiceChannelCount = data.guild.voice_channel_count;\n\n /**\n * Whether or not this invite is temporary\n * @type {boolean}\n */\n this.temporary = data.temporary;\n\n /**\n * The maximum age of the invite, in seconds\n * @type {?number}\n */\n this.maxAge = data.max_age;\n\n /**\n * How many times this invite has been used\n * @type {number}\n */\n this.uses = data.uses;\n\n /**\n * The maximum uses of this invite\n * @type {number}\n */\n this.maxUses = data.max_uses;\n\n if (data.inviter) {\n /**\n * The user who created this invite\n * @type {?User}\n */\n this.inviter = this.client.dataManager.newUser(data.inviter);\n }\n\n /**\n * The channel the invite is for. If this channel is already known, this will be a GuildChannel object.\n * If the channel is unknown, this will be a PartialGuildChannel object.\n * @type {GuildChannel|PartialGuildChannel}\n */\n this.channel = this.client.channels.get(data.channel.id) || new PartialGuildChannel(this.client, data.channel);\n\n /**\n * The timestamp the invite was created at\n * @type {number}\n */\n this.createdTimestamp = new Date(data.created_at).getTime();\n }\n\n /**\n * The time the invite was created\n * @type {Date}\n * @readonly\n */\n get createdAt() {\n return new Date(this.createdTimestamp);\n }\n\n /**\n * The timestamp the invite will expire at\n * @type {number}\n * @readonly\n */\n get expiresTimestamp() {\n return this.createdTimestamp + (this.maxAge * 1000);\n }\n\n /**\n * The time the invite will expire\n * @type {Date}\n * @readonly\n */\n get expiresAt() {\n return new Date(this.expiresTimestamp);\n }\n\n /**\n * The URL to the invite\n * @type {string}\n * @readonly\n */\n get url() {\n return Constants.Endpoints.inviteLink(this.code);\n }\n\n /**\n * Deletes this invite.\n * @param {string} [reason] Reason for deleting this invite\n * @returns {Promise}\n */\n delete(reason) {\n return this.client.rest.methods.deleteInvite(this, reason);\n }\n\n /**\n * When concatenated with a string, this automatically concatenates the invite's URL instead of the object.\n * @returns {string}\n * @example\n * // Logs: Invite: https://discord.gg/A1b2C3\n * console.log(`Invite: ${invite}`);\n */\n toString() {\n return this.url;\n }\n}\n\nmodule.exports = Invite;\n\n\n//# sourceURL=webpack:///./src/structures/Invite.js?"); + +/***/ }), + +/***/ "./src/structures/Message.js": +/*!***********************************!*\ + !*** ./src/structures/Message.js ***! + \***********************************/ +/*! no static exports found */ +/*! 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?"); + +/***/ }), + +/***/ "./src/structures/MessageAttachment.js": +/*!*********************************************!*\ + !*** ./src/structures/MessageAttachment.js ***! + \*********************************************/ +/*! no static exports found */ +/*! ModuleConcatenation bailout: Module is not an ECMAScript module */ +/***/ (function(module, exports) { + +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?"); + +/***/ }), + +/***/ "./src/structures/MessageCollector.js": +/*!********************************************!*\ + !*** ./src/structures/MessageCollector.js ***! + \********************************************/ +/*! no static exports found */ +/*! 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?"); + +/***/ }), + +/***/ "./src/structures/MessageEmbed.js": +/*!****************************************!*\ + !*** ./src/structures/MessageEmbed.js ***! + \****************************************/ +/*! no static exports found */ +/*! ModuleConcatenation bailout: Module is not an ECMAScript module */ +/***/ (function(module, exports) { + +eval("/**\n * Represents an embed in a message (image/video preview, rich embed, etc.)\n * This class is only used for *received* embeds. If you wish to send one, use the {@link RichEmbed} class.\n */\nclass MessageEmbed {\n constructor(message, data) {\n /**\n * The client that instantiated this embed\n * @name MessageEmbed#client\n * @type {Client}\n * @readonly\n */\n Object.defineProperty(this, 'client', { value: message.client });\n\n /**\n * The message this embed is part of\n * @type {Message}\n */\n this.message = message;\n\n this.setup(data);\n }\n\n setup(data) {\n /**\n * The type of this embed\n * @type {string}\n */\n this.type = data.type;\n\n /**\n * The title of this embed\n * @type {?string}\n */\n this.title = data.title;\n\n /**\n * The description of this embed\n * @type {?string}\n */\n this.description = data.description;\n\n /**\n * The URL of this embed\n * @type {string}\n */\n this.url = data.url;\n\n /**\n * The color of the embed\n * @type {number}\n */\n this.color = data.color;\n\n /**\n * The fields of this embed\n * @type {MessageEmbedField[]}\n */\n this.fields = [];\n if (data.fields) for (const field of data.fields) this.fields.push(new MessageEmbedField(this, field));\n\n /**\n * The timestamp of this embed\n * @type {number}\n */\n this.timestamp = data.timestamp;\n\n /**\n * The thumbnail of this embed\n * @type {?MessageEmbedThumbnail}\n */\n this.thumbnail = data.thumbnail ? new MessageEmbedThumbnail(this, data.thumbnail) : null;\n\n /**\n * The image of this embed\n * @type {?MessageEmbedImage}\n */\n this.image = data.image ? new MessageEmbedImage(this, data.image) : null;\n\n /**\n * The video of this embed\n * @type {?MessageEmbedVideo}\n */\n this.video = data.video ? new MessageEmbedVideo(this, data.video) : null;\n\n /**\n * The author of this embed\n * @type {?MessageEmbedAuthor}\n */\n this.author = data.author ? new MessageEmbedAuthor(this, data.author) : null;\n\n /**\n * The provider of this embed\n * @type {?MessageEmbedProvider}\n */\n this.provider = data.provider ? new MessageEmbedProvider(this, data.provider) : null;\n\n /**\n * The footer of this embed\n * @type {?MessageEmbedFooter}\n */\n this.footer = data.footer ? new MessageEmbedFooter(this, data.footer) : null;\n }\n\n /**\n * The date this embed was created\n * @type {Date}\n * @readonly\n */\n get createdAt() {\n return new Date(this.createdTimestamp);\n }\n\n /**\n * The hexadecimal version of the embed color, with a leading hash\n * @type {?string}\n * @readonly\n */\n get hexColor() {\n if (!this.color) return null;\n let col = this.color.toString(16);\n while (col.length < 6) col = `0${col}`;\n return `#${col}`;\n }\n}\n\n/**\n * Represents a thumbnail for a message embed.\n */\nclass MessageEmbedThumbnail {\n constructor(embed, data) {\n /**\n * The embed this thumbnail is part of\n * @type {MessageEmbed}\n */\n this.embed = embed;\n\n this.setup(data);\n }\n\n setup(data) {\n /**\n * The URL for this thumbnail\n * @type {string}\n */\n this.url = data.url;\n\n /**\n * The Proxy URL for this thumbnail\n * @type {string}\n */\n this.proxyURL = data.proxy_url;\n\n /**\n * The height of the thumbnail\n * @type {number}\n */\n this.height = data.height;\n\n /**\n * The width of the thumbnail\n * @type {number}\n */\n this.width = data.width;\n }\n}\n\n/**\n * Represents an image for a message embed.\n */\nclass MessageEmbedImage {\n constructor(embed, data) {\n /**\n * The embed this image is part of\n * @type {MessageEmbed}\n */\n this.embed = embed;\n\n this.setup(data);\n }\n\n setup(data) {\n /**\n * The URL for this image\n * @type {string}\n */\n this.url = data.url;\n\n /**\n * The Proxy URL for this image\n * @type {string}\n */\n this.proxyURL = data.proxy_url;\n\n /**\n * The height of the image\n * @type {number}\n */\n this.height = data.height;\n\n /**\n * The width of the image\n * @type {number}\n */\n this.width = data.width;\n }\n}\n\n/**\n * Represents a video for a message embed.\n */\nclass MessageEmbedVideo {\n constructor(embed, data) {\n /**\n * The embed this video is part of\n * @type {MessageEmbed}\n */\n this.embed = embed;\n\n this.setup(data);\n }\n\n setup(data) {\n /**\n * The source URL for this video\n * @type {string}\n */\n this.url = data.url;\n\n /**\n * The height of the video\n * @type {number}\n */\n this.height = data.height;\n\n /**\n * The width of the video\n * @type {number}\n */\n this.width = data.width;\n }\n}\n\n/**\n * Represents a provider for a message embed.\n */\nclass MessageEmbedProvider {\n constructor(embed, data) {\n /**\n * The embed this provider is part of\n * @type {MessageEmbed}\n */\n this.embed = embed;\n\n this.setup(data);\n }\n\n setup(data) {\n /**\n * The name of this provider\n * @type {string}\n */\n this.name = data.name;\n\n /**\n * The URL of this provider\n * @type {string}\n */\n this.url = data.url;\n }\n}\n\n/**\n * Represents an author for a message embed.\n */\nclass MessageEmbedAuthor {\n constructor(embed, data) {\n /**\n * The embed this author is part of\n * @type {MessageEmbed}\n */\n this.embed = embed;\n\n this.setup(data);\n }\n\n setup(data) {\n /**\n * The name of this author\n * @type {string}\n */\n this.name = data.name;\n\n /**\n * The URL of this author\n * @type {string}\n */\n this.url = data.url;\n\n /**\n * The icon URL of this author\n * @type {string}\n */\n this.iconURL = data.icon_url;\n }\n}\n\n/**\n * Represents a field for a message embed.\n */\nclass MessageEmbedField {\n constructor(embed, data) {\n /**\n * The embed this footer is part of\n * @type {MessageEmbed}\n */\n this.embed = embed;\n\n this.setup(data);\n }\n\n setup(data) {\n /**\n * The name of this field\n * @type {string}\n */\n this.name = data.name;\n\n /**\n * The value of this field\n * @type {string}\n */\n this.value = data.value;\n\n /**\n * If this field is displayed inline\n * @type {boolean}\n */\n this.inline = data.inline;\n }\n}\n\n/**\n * Represents the footer of a message embed.\n */\nclass MessageEmbedFooter {\n constructor(embed, data) {\n /**\n * The embed this footer is part of\n * @type {MessageEmbed}\n */\n this.embed = embed;\n\n this.setup(data);\n }\n\n setup(data) {\n /**\n * The text in this footer\n * @type {string}\n */\n this.text = data.text;\n\n /**\n * The icon URL of this footer\n * @type {string}\n */\n this.iconURL = data.icon_url;\n\n /**\n * The proxy icon URL of this footer\n * @type {string}\n */\n this.proxyIconUrl = data.proxy_icon_url;\n }\n}\n\nMessageEmbed.Thumbnail = MessageEmbedThumbnail;\nMessageEmbed.Image = MessageEmbedImage;\nMessageEmbed.Video = MessageEmbedVideo;\nMessageEmbed.Provider = MessageEmbedProvider;\nMessageEmbed.Author = MessageEmbedAuthor;\nMessageEmbed.Field = MessageEmbedField;\nMessageEmbed.Footer = MessageEmbedFooter;\n\nmodule.exports = MessageEmbed;\n\n\n//# sourceURL=webpack:///./src/structures/MessageEmbed.js?"); + +/***/ }), + +/***/ "./src/structures/MessageMentions.js": +/*!*******************************************!*\ + !*** ./src/structures/MessageMentions.js ***! + \*******************************************/ +/*! no static exports found */ +/*! 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?"); + +/***/ }), + +/***/ "./src/structures/MessageReaction.js": +/*!*******************************************!*\ + !*** ./src/structures/MessageReaction.js ***! + \*******************************************/ +/*! no static exports found */ +/*! 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?"); + +/***/ }), + +/***/ "./src/structures/NewsChannel.js": +/*!***************************************!*\ + !*** ./src/structures/NewsChannel.js ***! + \***************************************/ +/*! no static exports found */ +/*! ModuleConcatenation bailout: Module is not an ECMAScript module */ +/***/ (function(module, exports, __webpack_require__) { + +eval("const TextChannel = __webpack_require__(/*! ./TextChannel */ \"./src/structures/TextChannel.js\");\n\n/**\n * Represents a guild news channel on Discord.\n * @extends {TextChannel}\n */\nclass NewsChannel extends TextChannel {\n constructor(guild, data) {\n super(guild, data);\n this.type = 'news';\n }\n\n setup(data) {\n super.setup(data);\n\n /**\n * The ratelimit per user for this channel (always 0)\n * @type {number}\n */\n this.rateLimitPerUser = 0;\n }\n}\n\nmodule.exports = NewsChannel;\n\n\n//# sourceURL=webpack:///./src/structures/NewsChannel.js?"); + +/***/ }), + +/***/ "./src/structures/OAuth2Application.js": +/*!*********************************************!*\ + !*** ./src/structures/OAuth2Application.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 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?"); + +/***/ }), + +/***/ "./src/structures/PartialGuild.js": +/*!****************************************!*\ + !*** ./src/structures/PartialGuild.js ***! + \****************************************/ +/*! no static exports found */ +/*! ModuleConcatenation bailout: Module is not an ECMAScript module */ +/***/ (function(module, exports) { + +eval("/*\n{ splash: null,\n id: '123123123',\n icon: '123123123',\n name: 'name' }\n*/\n\n/**\n * Represents a guild that the client only has limited information for - e.g. from invites.\n */\nclass PartialGuild {\n constructor(client, data) {\n /**\n * The client that instantiated this PartialGuild\n * @name PartialGuild#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 this guild\n * @type {Snowflake}\n */\n this.id = data.id;\n\n /**\n * The name of this guild\n * @type {string}\n */\n this.name = data.name;\n\n /**\n * The hash of this guild's 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\nmodule.exports = PartialGuild;\n\n\n//# sourceURL=webpack:///./src/structures/PartialGuild.js?"); + +/***/ }), + +/***/ "./src/structures/PartialGuildChannel.js": +/*!***********************************************!*\ + !*** ./src/structures/PartialGuildChannel.js ***! + \***********************************************/ +/*! no static exports found */ +/*! 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\n/*\n{ type: 0, id: '123123', name: 'heavy-testing' } }\n*/\n\n/**\n * Represents a guild channel that the client only has limited information for - e.g. from invites.\n */\nclass PartialGuildChannel {\n constructor(client, data) {\n /**\n * The client that instantiated this PartialGuildChannel\n * @name PartialGuildChannel#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 this guild channel\n * @type {Snowflake}\n */\n this.id = data.id;\n\n /**\n * The name of this guild channel\n * @type {string}\n */\n this.name = data.name;\n\n /**\n * The type of this guild channel - `text` or `voice`\n * @type {string}\n */\n this.type = Constants.ChannelTypes.TEXT === data.type ? 'text' : 'voice';\n }\n}\n\nmodule.exports = PartialGuildChannel;\n\n\n//# sourceURL=webpack:///./src/structures/PartialGuildChannel.js?"); + +/***/ }), + +/***/ "./src/structures/PermissionOverwrites.js": +/*!************************************************!*\ + !*** ./src/structures/PermissionOverwrites.js ***! + \************************************************/ +/*! no static exports found */ +/*! ModuleConcatenation bailout: Module is not an ECMAScript module */ +/***/ (function(module, exports, __webpack_require__) { + +eval("const Permissions = __webpack_require__(/*! ../util/Permissions */ \"./src/util/Permissions.js\");\n\n/**\n * Represents a permission overwrite for a role or member in a guild channel.\n */\nclass PermissionOverwrites {\n constructor(guildChannel, data) {\n /**\n * The GuildChannel this overwrite is for\n * @name PermissionOverwrites#channel\n * @type {GuildChannel}\n * @readonly\n */\n Object.defineProperty(this, 'channel', { value: guildChannel });\n\n if (data) this.setup(data);\n }\n\n setup(data) {\n /**\n * The ID of this overwrite, either a user ID or a role ID\n * @type {Snowflake}\n */\n this.id = data.id;\n\n /**\n * The type of this overwrite\n * @type {string}\n */\n this.type = data.type;\n\n /**\n * The permissions that are denied for the user or role as a bitfield.\n * @type {number}\n */\n this.deny = data.deny;\n\n /**\n * The permissions that are allowed for the user or role as a bitfield.\n * @type {number}\n */\n this.allow = data.allow;\n\n /**\n * The permissions that are denied for the user or role.\n * @type {Permissions}\n * @deprecated\n */\n this.denied = new Permissions(data.deny).freeze();\n\n /**\n * The permissions that are allowed for the user or role.\n * @type {Permissions}\n * @deprecated\n */\n this.allowed = new Permissions(data.allow).freeze();\n }\n\n /**\n * Delete this Permission Overwrite.\n * @param {string} [reason] Reason for deleting this overwrite\n * @returns {Promise}\n */\n delete(reason) {\n return this.channel.client.rest.methods.deletePermissionOverwrites(this, reason);\n }\n}\n\nmodule.exports = PermissionOverwrites;\n\n\n//# sourceURL=webpack:///./src/structures/PermissionOverwrites.js?"); + +/***/ }), + +/***/ "./src/structures/Presence.js": +/*!************************************!*\ + !*** ./src/structures/Presence.js ***! + \************************************/ +/*! no static exports found */ +/*! 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?"); + +/***/ }), + +/***/ "./src/structures/ReactionCollector.js": +/*!*********************************************!*\ + !*** ./src/structures/ReactionCollector.js ***! + \*********************************************/ +/*! no static exports found */ +/*! 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?"); + +/***/ }), + +/***/ "./src/structures/ReactionEmoji.js": +/*!*****************************************!*\ + !*** ./src/structures/ReactionEmoji.js ***! + \*****************************************/ +/*! no static exports found */ +/*! ModuleConcatenation bailout: Module is not an ECMAScript module */ +/***/ (function(module, exports) { + +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?"); + +/***/ }), + +/***/ "./src/structures/RichEmbed.js": +/*!*************************************!*\ + !*** ./src/structures/RichEmbed.js ***! + \*************************************/ +/*! no static exports found */ +/*! 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?"); + +/***/ }), + +/***/ "./src/structures/Role.js": +/*!********************************!*\ + !*** ./src/structures/Role.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 Permissions = __webpack_require__(/*! ../util/Permissions */ \"./src/util/Permissions.js\");\nconst util = __webpack_require__(/*! util */ \"./node_modules/util/util.js\");\n\n/**\n * Represents a role on Discord.\n */\nclass Role {\n constructor(guild, data) {\n /**\n * The client that instantiated the role\n * @name Role#client\n * @type {Client}\n * @readonly\n */\n Object.defineProperty(this, 'client', { value: guild.client });\n\n /**\n * The guild that the role belongs to\n * @type {Guild}\n */\n this.guild = guild;\n\n /**\n * Whether the role has been deleted\n * @type {boolean}\n */\n this.deleted = false;\n\n if (data) this.setup(data);\n }\n\n setup(data) {\n /**\n * The ID of the role (unique to the guild it is part of)\n * @type {Snowflake}\n */\n this.id = data.id;\n\n /**\n * The name of the role\n * @type {string}\n */\n this.name = data.name;\n\n /**\n * The base 10 color of the role\n * @type {number}\n */\n this.color = data.color;\n\n /**\n * If true, users that are part of this role will appear in a separate category in the users list\n * @type {boolean}\n */\n this.hoist = data.hoist;\n\n /**\n * The position of the role from the API\n * @type {number}\n */\n this.position = data.position;\n\n /**\n * The permissions bitfield of the role\n * @type {number}\n */\n this.permissions = data.permissions;\n\n /**\n * Whether or not the role is managed by an external service\n * @type {boolean}\n */\n this.managed = data.managed;\n\n /**\n * Whether or not the role can be mentioned by anyone\n * @type {boolean}\n */\n this.mentionable = data.mentionable;\n }\n\n /**\n * The timestamp the role 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 role was created\n * @type {Date}\n * @readonly\n */\n get createdAt() {\n return new Date(this.createdTimestamp);\n }\n\n /**\n * The hexadecimal version of the role color, with a leading hashtag\n * @type {string}\n * @readonly\n */\n get hexColor() {\n let col = this.color.toString(16);\n while (col.length < 6) col = `0${col}`;\n return `#${col}`;\n }\n\n /**\n * The cached guild members that have this role\n * @type {Collection}\n * @readonly\n */\n get members() {\n return this.guild.members.filter(m => m.roles.has(this.id));\n }\n\n /**\n * Whether the role is editable by the client user\n * @type {boolean}\n * @readonly\n */\n get editable() {\n if (this.managed) return false;\n const clientMember = this.guild.member(this.client.user);\n if (!clientMember.permissions.has(Permissions.FLAGS.MANAGE_ROLES_OR_PERMISSIONS)) return false;\n return clientMember.highestRole.comparePositionTo(this) > 0;\n }\n\n /**\n * The position of the role in the role manager\n * @type {number}\n * @readonly\n */\n get calculatedPosition() {\n const sorted = this.guild._sortedRoles;\n return sorted.array().indexOf(sorted.get(this.id));\n }\n\n /**\n * Get an object mapping permission names to whether or not the role enables that permission.\n * @returns {Object}\n * @example\n * // Print the serialized role permissions\n * console.log(role.serialize());\n */\n serialize() {\n return new Permissions(this.permissions).serialize();\n }\n\n /**\n * Checks if the role has 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 * @returns {boolean}\n * @example\n * // See if a role can ban a member\n * if (role.hasPermission('BAN_MEMBERS')) {\n * console.log('This role can ban members');\n * } else {\n * console.log('This role can\\'t ban members');\n * }\n */\n hasPermission(permission, explicit = false, checkAdmin) {\n return new Permissions(this.permissions).has(\n permission, typeof checkAdmin !== 'undefined' ? checkAdmin : !explicit\n );\n }\n\n /**\n * Checks if the role has all specified permissions.\n * @param {PermissionResolvable} permissions The permissions to check for\n * @param {boolean} [explicit=false] Whether to require the role to explicitly have the exact permissions\n * @returns {boolean}\n * @deprecated\n */\n hasPermissions(permissions, explicit = false) {\n return new Permissions(this.permissions).has(permissions, !explicit);\n }\n\n /**\n * Compares this role's position to another role's.\n * @param {Role} role Role to compare to this one\n * @returns {number} Negative number if this role's position is lower (other role's is higher),\n * positive number if this one is higher (other's is lower), 0 if equal\n */\n comparePositionTo(role) {\n return this.constructor.comparePositions(this, role);\n }\n\n /**\n * The data for a role.\n * @typedef {Object} RoleData\n * @property {string} [name] The name of the role\n * @property {ColorResolvable} [color] The color of the role, either a hex string or a base 10 number\n * @property {boolean} [hoist] Whether or not the role should be hoisted\n * @property {number} [position] The position of the role\n * @property {PermissionResolvable|number} [permissions] The permissions of the role\n * @property {boolean} [mentionable] Whether or not the role should be mentionable\n */\n\n /**\n * Edits the role.\n * @param {RoleData} data The new data for the role\n * @param {string} [reason] The reason for editing this role\n * @returns {Promise}\n * @example\n * // Edit name of a role\n * role.edit({ name: 'New Name' })\n * .then(updated => console.log(`Edited role name from ${role.name} to ${updated.name}`))\n * .catch(console.error);\n */\n edit(data, reason) {\n return this.client.rest.methods.updateGuildRole(this, data, reason);\n }\n\n /**\n * Set a new name for the role.\n * @param {string} name The new name of the role\n * @param {string} [reason] Reason for changing the role's name\n * @returns {Promise}\n * @example\n * // Set the name of the role\n * role.setName('New Name')\n * .then(updated => console.log(`Edited role name from ${role.name} to ${updated.name}`))\n * .catch(console.error);\n */\n setName(name, reason) {\n return this.edit({ name }, reason);\n }\n\n /**\n * Set a new color for the role.\n * @param {ColorResolvable} color The color of the role\n * @param {string} [reason] Reason for changing the role's color\n * @returns {Promise}\n * @example\n * // Set the color of a role\n * role.setColor('#FF0000')\n * .then(updated => console.log(`Set color of role to ${role.color}`))\n * .catch(console.error);\n */\n setColor(color, reason) {\n return this.edit({ color }, reason);\n }\n\n /**\n * Set whether or not the role should be hoisted.\n * @param {boolean} hoist Whether or not to hoist the role\n * @param {string} [reason] Reason for setting whether or not the role should be hoisted\n * @returns {Promise}\n * @example\n * // Set the hoist of the role\n * role.setHoist(true)\n * .then(updated => console.log(`Role hoisted: ${updated.hoist}`))\n * .catch(console.error);\n */\n setHoist(hoist, reason) {\n return this.edit({ hoist }, reason);\n }\n\n /**\n * Set the position of the role.\n * @param {number} position The position of the role\n * @param {boolean} [relative=false] Move the position relative to its current value\n * @returns {Promise}\n * @example\n * // Set the position of the role\n * role.setPosition(1)\n * .then(updated => console.log(`Role position: ${updated.position}`))\n * .catch(console.error);\n */\n setPosition(position, relative) {\n return this.guild.setRolePosition(this, position, relative).then(() => this);\n }\n\n /**\n * Set the permissions of the role.\n * @param {PermissionResolvable} permissions The permissions of the role\n * @param {string} [reason] Reason for changing the role's permissions\n * @returns {Promise}\n * @example\n * // Set the permissions of the role\n * role.setPermissions(['KICK_MEMBERS', 'BAN_MEMBERS'])\n * .then(updated => console.log(`Updated permissions to ${updated.permissions.bitfield}`))\n * .catch(console.error);\n * @example\n * // Remove all permissions from a role\n * role.setPermissions(0)\n * .then(updated => console.log(`Updated permissions to ${updated.permissions.bitfield}`))\n * .catch(console.error);\n */\n setPermissions(permissions, reason) {\n return this.edit({ permissions }, reason);\n }\n\n /**\n * Set whether this role is mentionable.\n * @param {boolean} mentionable Whether this role should be mentionable\n * @param {string} [reason] Reason for setting whether or not this role should be mentionable\n * @returns {Promise}\n * @example\n * // Make the role mentionable\n * role.setMentionable(true, 'Role needs to be pinged')\n * .then(updated => console.log(`Role mentionable: ${updated.mentionable}`))\n * .catch(console.error);\n */\n setMentionable(mentionable, reason) {\n return this.edit({ mentionable }, reason);\n }\n\n /**\n * Deletes the role.\n * @param {string} [reason] Reason for deleting the role\n * @returns {Promise}\n * @example\n * // Delete a role\n * role.delete('The role needed to go')\n * .then(deleted => console.log(`Deleted role ${deleted.name}`))\n * .catch(console.error);\n */\n delete(reason) {\n return this.client.rest.methods.deleteGuildRole(this, reason);\n }\n\n /**\n * Whether this role equals another role. It compares all properties, so for most operations\n * it is advisable to just compare `role.id === role2.id` as it is much faster and is often\n * what most users need.\n * @param {Role} role Role to compare with\n * @returns {boolean}\n */\n equals(role) {\n return role &&\n this.id === role.id &&\n this.name === role.name &&\n this.color === role.color &&\n this.hoist === role.hoist &&\n this.position === role.position &&\n this.permissions === role.permissions &&\n this.managed === role.managed;\n }\n\n /**\n * When concatenated with a string, this automatically concatenates the role mention rather than the Role object.\n * @returns {string}\n */\n toString() {\n if (this.id === this.guild.id) return '@everyone';\n return `<@&${this.id}>`;\n }\n\n /**\n * Compares the positions of two roles.\n * @param {Role} role1 First role to compare\n * @param {Role} role2 Second role to compare\n * @returns {number} Negative number if the first role's position is lower (second role's is higher),\n * positive number if the first's is higher (second's is lower), 0 if equal\n */\n static comparePositions(role1, role2) {\n if (role1.position === role2.position) return role2.id - role1.id;\n return role1.position - role2.position;\n }\n}\n\nRole.prototype.hasPermissions = util\n .deprecate(Role.prototype.hasPermissions,\n 'Role#hasPermissions is deprecated - use Role#hasPermission instead, it now takes an array');\n\nmodule.exports = Role;\n\n\n//# sourceURL=webpack:///./src/structures/Role.js?"); + +/***/ }), + +/***/ "./src/structures/StoreChannel.js": +/*!****************************************!*\ + !*** ./src/structures/StoreChannel.js ***! + \****************************************/ +/*! no static exports found */ +/*! ModuleConcatenation bailout: Module is not an ECMAScript module */ +/***/ (function(module, exports, __webpack_require__) { + +eval("const GuildChannel = __webpack_require__(/*! ./GuildChannel */ \"./src/structures/GuildChannel.js\");\n\n/**\n * Represents a guild store channel on Discord.\n * @extends {GuildChannel}\n */\nclass StoreChannel extends GuildChannel {\n constructor(guild, data) {\n super(guild, data);\n this.type = 'store';\n }\n\n setup(data) {\n super.setup(data);\n\n /**\n * If the guild considers this channel NSFW\n * @type {boolean}\n * @readonly\n */\n this.nsfw = data.nsfw;\n }\n}\n\nmodule.exports = StoreChannel;\n\n\n//# sourceURL=webpack:///./src/structures/StoreChannel.js?"); + +/***/ }), + +/***/ "./src/structures/TextChannel.js": +/*!***************************************!*\ + !*** ./src/structures/TextChannel.js ***! + \***************************************/ +/*! no static exports found */ +/*! ModuleConcatenation bailout: Module is not an ECMAScript module */ +/***/ (function(module, exports, __webpack_require__) { + +eval("const GuildChannel = __webpack_require__(/*! ./GuildChannel */ \"./src/structures/GuildChannel.js\");\nconst TextBasedChannel = __webpack_require__(/*! ./interfaces/TextBasedChannel */ \"./src/structures/interfaces/TextBasedChannel.js\");\nconst Collection = __webpack_require__(/*! ../util/Collection */ \"./src/util/Collection.js\");\n\n/**\n * Represents a guild text channel on Discord.\n * @extends {GuildChannel}\n * @implements {TextBasedChannel}\n */\nclass TextChannel extends GuildChannel {\n constructor(guild, data) {\n super(guild, data);\n this.type = 'text';\n /**\n * A collection containing the messages sent to this channel\n * @type {Collection}\n */\n this.messages = new Collection();\n this._typing = new Map();\n }\n\n setup(data) {\n super.setup(data);\n\n /**\n * The topic of the text channel\n * @type {?string}\n */\n this.topic = data.topic;\n\n /**\n * If the Discord considers this channel NSFW\n * @type {boolean}\n * @readonly\n */\n this.nsfw = Boolean(data.nsfw);\n\n /**\n * The ID of the last message sent in this channel, if one was sent\n * @type {?Snowflake}\n */\n this.lastMessageID = data.last_message_id;\n\n /**\n * The timestamp when the last pinned message was pinned, if there was one\n * @type {?number}\n */\n this.lastPinTimestamp = data.last_pin_timestamp ? new Date(data.last_pin_timestamp).getTime() : null;\n\n /**\n * The ratelimit per user for this channel in seconds\n * @type {number}\n */\n this.rateLimitPerUser = data.rate_limit_per_user || 0;\n }\n\n /**\n * A collection of members that can see this channel, mapped by their ID\n * @type {Collection}\n * @readonly\n */\n get members() {\n const members = new Collection();\n for (const member of this.guild.members.values()) {\n if (this.permissionsFor(member).has('READ_MESSAGES')) {\n members.set(member.id, member);\n }\n }\n return members;\n }\n\n /**\n * Fetch all webhooks for the channel.\n * @returns {Promise>}\n * @example\n * // Fetch webhooks\n * channel.fetchWebhooks()\n * .then(hooks => console.log(`This channel has ${hooks.size} hooks`))\n * .catch(console.error);\n */\n fetchWebhooks() {\n return this.client.rest.methods.getChannelWebhooks(this);\n }\n\n /**\n * Sets whether this channel is flagged as NSFW.\n * @param {boolean} nsfw Whether the channel should be considered NSFW\n * @param {string} [reason] Reason for changing the channel's NSFW flag\n * @returns {Promise}\n */\n setNSFW(nsfw, reason) {\n return this.edit({ nsfw }, reason);\n }\n\n /**\n * Create a webhook for the channel.\n * @param {string} name The name of the webhook\n * @param {BufferResolvable|Base64Resolvable} [avatar] The avatar for the webhook\n * @param {string} [reason] Reason for creating this webhook\n * @returns {Promise} webhook The created webhook\n * @example\n * channel.createWebhook('Snek', 'https://i.imgur.com/mI8XcpG.jpg')\n * .then(webhook => console.log(`Created webhook ${webhook}`))\n * .catch(console.error)\n */\n createWebhook(name, avatar, reason) {\n if (typeof avatar === 'string' && avatar.startsWith('data:')) {\n return this.client.rest.methods.createWebhook(this, name, avatar, reason);\n } else {\n return this.client.resolver.resolveImage(avatar).then(data =>\n this.client.rest.methods.createWebhook(this, name, data, reason)\n );\n }\n }\n\n /**\n * Sets the rate limit per user for this channel.\n * @param {number} rateLimitPerUser The new ratelimit in seconds\n * @param {string} [reason] Reason for changing the channel's ratelimits\n * @returns {Promise}\n */\n setRateLimitPerUser(rateLimitPerUser, reason) {\n return this.edit({ rateLimitPerUser }, reason);\n }\n\n // These are here only for documentation purposes - they are implemented by TextBasedChannel\n /* eslint-disable no-empty-function */\n get lastMessage() {}\n get lastPinAt() {}\n send() { }\n sendMessage() { }\n sendEmbed() { }\n sendFile() { }\n sendFiles() { }\n sendCode() { }\n fetchMessage() { }\n fetchMessages() { }\n fetchPinnedMessages() { }\n search() { }\n startTyping() { }\n stopTyping() { }\n get typing() { }\n get typingCount() { }\n createCollector() { }\n createMessageCollector() { }\n awaitMessages() { }\n bulkDelete() { }\n acknowledge() { }\n _cacheMessage() { }\n}\n\nTextBasedChannel.applyToClass(TextChannel, true);\n\nmodule.exports = TextChannel;\n\n\n//# sourceURL=webpack:///./src/structures/TextChannel.js?"); + +/***/ }), + +/***/ "./src/structures/User.js": +/*!********************************!*\ + !*** ./src/structures/User.js ***! + \********************************/ +/*! no static exports found */ +/*! 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?"); + +/***/ }), + +/***/ "./src/structures/UserConnection.js": +/*!******************************************!*\ + !*** ./src/structures/UserConnection.js ***! + \******************************************/ +/*! no static exports found */ +/*! ModuleConcatenation bailout: Module is not an ECMAScript module */ +/***/ (function(module, exports) { + +eval("/**\n * Represents a user connection (or \"platform identity\").\n */\nclass UserConnection {\n constructor(user, data) {\n /**\n * The user that owns the connection\n * @type {User}\n */\n this.user = user;\n\n this.setup(data);\n }\n\n setup(data) {\n /**\n * The type of the connection\n * @type {string}\n */\n this.type = data.type;\n\n /**\n * The username of the connection account\n * @type {string}\n */\n this.name = data.name;\n\n /**\n * The id of the connection account\n * @type {string}\n */\n this.id = data.id;\n\n /**\n * Whether the connection is revoked\n * @type {boolean}\n */\n this.revoked = data.revoked;\n\n /**\n * Partial server integrations (not yet implemented)\n * @type {Object[]}\n */\n this.integrations = data.integrations;\n }\n}\n\nmodule.exports = UserConnection;\n\n\n//# sourceURL=webpack:///./src/structures/UserConnection.js?"); + +/***/ }), + +/***/ "./src/structures/UserProfile.js": +/*!***************************************!*\ + !*** ./src/structures/UserProfile.js ***! + \***************************************/ +/*! no static exports found */ +/*! 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 UserConnection = __webpack_require__(/*! ./UserConnection */ \"./src/structures/UserConnection.js\");\n\n/**\n * Represents a user's profile on Discord.\n */\nclass UserProfile {\n constructor(user, data) {\n /**\n * The owner of the profile\n * @type {User}\n */\n this.user = user;\n\n /**\n * The client that created the instance of the UserProfile\n * @name UserProfile#client\n * @type {Client}\n * @readonly\n */\n Object.defineProperty(this, 'client', { value: user.client });\n\n /**\n * The guilds that the client user and the user share\n * @type {Collection}\n */\n this.mutualGuilds = new Collection();\n\n /**\n * The user's connections\n * @type {Collection}\n */\n this.connections = new Collection();\n\n this.setup(data);\n }\n\n setup(data) {\n /**\n * If the user has Discord Premium\n * @type {boolean}\n */\n this.premium = data.premium;\n\n /**\n * The date since which the user has had Discord Premium\n * @type {?Date}\n */\n this.premiumSince = data.premium_since ? new Date(data.premium_since) : null;\n\n for (const guild of data.mutual_guilds) {\n if (this.client.guilds.has(guild.id)) {\n this.mutualGuilds.set(guild.id, this.client.guilds.get(guild.id));\n }\n }\n for (const connection of data.connected_accounts) {\n this.connections.set(connection.id, new UserConnection(this.user, connection));\n }\n }\n}\n\nmodule.exports = UserProfile;\n\n\n//# sourceURL=webpack:///./src/structures/UserProfile.js?"); + +/***/ }), + +/***/ "./src/structures/VoiceChannel.js": +/*!****************************************!*\ + !*** ./src/structures/VoiceChannel.js ***! + \****************************************/ +/*! no static exports found */ +/*! ModuleConcatenation bailout: Module is not an ECMAScript module */ +/***/ (function(module, exports, __webpack_require__) { + +eval("const GuildChannel = __webpack_require__(/*! ./GuildChannel */ \"./src/structures/GuildChannel.js\");\nconst Collection = __webpack_require__(/*! ../util/Collection */ \"./src/util/Collection.js\");\nconst Permissions = __webpack_require__(/*! ../util/Permissions */ \"./src/util/Permissions.js\");\n\n/**\n * Represents a guild voice channel on Discord.\n * @extends {GuildChannel}\n */\nclass VoiceChannel extends GuildChannel {\n constructor(guild, data) {\n super(guild, data);\n\n /**\n * The members in this voice channel\n * @type {Collection}\n */\n this.members = new Collection();\n\n this.type = 'voice';\n }\n\n setup(data) {\n super.setup(data);\n\n /**\n * The bitrate of this voice channel\n * @type {number}\n */\n this.bitrate = data.bitrate * 0.001;\n\n /**\n * The maximum amount of users allowed in this channel - 0 means unlimited.\n * @type {number}\n */\n this.userLimit = data.user_limit;\n }\n\n /**\n * The voice connection for this voice channel, if the client is connected\n * @type {?VoiceConnection}\n * @readonly\n */\n get connection() {\n const connection = this.guild.voiceConnection;\n if (connection && connection.channel.id === this.id) return connection;\n return null;\n }\n\n /**\n * Checks if the voice channel is full\n * @type {boolean}\n * @readonly\n */\n get full() {\n return this.userLimit > 0 && this.members.size >= this.userLimit;\n }\n\n /**\n * Whether the channel is deletable by the client user\n * @type {boolean}\n * @readonly\n */\n get deletable() {\n return super.deletable && this.permissionsFor(this.client.user).has(Permissions.FLAGS.CONNECT);\n }\n\n /**\n * Checks if the client has permission join the voice channel\n * @type {boolean}\n * @readonly\n */\n get joinable() {\n if (this.client.browser) return false;\n if (!this.permissionsFor(this.client.user).has('CONNECT')) return false;\n if (this.full && !this.permissionsFor(this.client.user).has('MOVE_MEMBERS')) return false;\n return true;\n }\n\n /**\n * Checks if the client has permission to send audio to the voice channel\n * @type {boolean}\n * @readonly\n */\n get speakable() {\n return this.permissionsFor(this.client.user).has('SPEAK');\n }\n\n /**\n * Sets the bitrate of the channel (in kbps).\n * @param {number} bitrate The new bitrate\n * @param {string} [reason] Reason for changing the channel's bitrate\n * @returns {Promise}\n * @example\n * // Set the bitrate of a voice channel\n * voiceChannel.setBitrate(48)\n * .then(vc => console.log(`Set bitrate to ${vc.bitrate}kbps for ${vc.name}`))\n * .catch(console.error);\n */\n setBitrate(bitrate, reason) {\n bitrate *= 1000;\n return this.edit({ bitrate }, reason);\n }\n\n /**\n * Sets the user limit of the channel.\n * @param {number} userLimit The new user limit\n * @param {string} [reason] Reason for changing the user limit\n * @returns {Promise}\n * @example\n * // Set the user limit of a voice channel\n * voiceChannel.setUserLimit(42)\n * .then(vc => console.log(`Set user limit to ${vc.userLimit} for ${vc.name}`))\n * .catch(console.error);\n */\n setUserLimit(userLimit, reason) {\n return this.edit({ userLimit }, reason);\n }\n\n /**\n * Attempts to join this voice channel.\n * @returns {Promise}\n * @example\n * // Join a voice channel\n * voiceChannel.join()\n * .then(connection => console.log('Connected!'))\n * .catch(console.error);\n */\n join() {\n if (this.client.browser) return Promise.reject(new Error('Voice connections are not available in browsers.'));\n return this.client.voice.joinChannel(this);\n }\n\n /**\n * Leaves this voice channel.\n * @example\n * // Leave a voice channel\n * voiceChannel.leave();\n */\n leave() {\n if (this.client.browser) return;\n const connection = this.client.voice.connections.get(this.guild.id);\n if (connection && connection.channel.id === this.id) connection.disconnect();\n }\n}\n\nmodule.exports = VoiceChannel;\n\n\n//# sourceURL=webpack:///./src/structures/VoiceChannel.js?"); + +/***/ }), + +/***/ "./src/structures/VoiceRegion.js": +/*!***************************************!*\ + !*** ./src/structures/VoiceRegion.js ***! + \***************************************/ +/*! no static exports found */ +/*! ModuleConcatenation bailout: Module is not an ECMAScript module */ +/***/ (function(module, exports) { + +eval("/**\n * Represents a Discord voice region for guilds.\n */\nclass VoiceRegion {\n constructor(data) {\n /**\n * The ID of the region\n * @type {string}\n */\n this.id = data.id;\n\n /**\n * Name of the region\n * @type {string}\n */\n this.name = data.name;\n\n /**\n * Whether the region is VIP-only\n * @type {boolean}\n */\n this.vip = data.vip;\n\n /**\n * Whether the region is deprecated\n * @type {boolean}\n */\n this.deprecated = data.deprecated;\n\n /**\n * Whether the region is optimal\n * @type {boolean}\n */\n this.optimal = data.optimal;\n\n /**\n * Whether the region is custom\n * @type {boolean}\n */\n this.custom = data.custom;\n\n /**\n * A sample hostname for what a connection might look like\n * @type {string}\n */\n this.sampleHostname = data.sample_hostname;\n }\n}\n\nmodule.exports = VoiceRegion;\n\n\n//# sourceURL=webpack:///./src/structures/VoiceRegion.js?"); + +/***/ }), + +/***/ "./src/structures/Webhook.js": +/*!***********************************!*\ + !*** ./src/structures/Webhook.js ***! + \***********************************/ +/*! no static exports found */ +/*! 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?"); + +/***/ }), + +/***/ "./src/structures/interfaces/Collector.js": +/*!************************************************!*\ + !*** ./src/structures/interfaces/Collector.js ***! + \************************************************/ +/*! no static exports found */ +/*! 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?"); + +/***/ }), + +/***/ "./src/structures/interfaces/TextBasedChannel.js": +/*!*******************************************************!*\ + !*** ./src/structures/interfaces/TextBasedChannel.js ***! + \*******************************************************/ +/*! no static exports found */ +/*! 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?"); + +/***/ }), + +/***/ "./src/structures/shared/resolvePermissions.js": +/*!*****************************************************!*\ + !*** ./src/structures/shared/resolvePermissions.js ***! + \*****************************************************/ +/*! no static exports found */ +/*! ModuleConcatenation bailout: Module is not an ECMAScript module */ +/***/ (function(module, exports, __webpack_require__) { + +eval("const Permissions = __webpack_require__(/*! ../../util/Permissions */ \"./src/util/Permissions.js\");\nconst Collection = __webpack_require__(/*! ../../util/Collection */ \"./src/util/Collection.js\");\n\nmodule.exports = function resolvePermissions(overwrites, guild) {\n if (overwrites instanceof Collection || overwrites instanceof Array) {\n overwrites = overwrites.map(overwrite => {\n const role = this.client.resolver.resolveRole(guild, overwrite.id);\n if (role) {\n overwrite.id = role.id;\n overwrite.type = 'role';\n } else {\n overwrite.id = this.client.resolver.resolveUserID(overwrite.id);\n overwrite.type = 'member';\n }\n\n return {\n allow: Permissions.resolve(overwrite.allow || overwrite.allowed || 0),\n deny: Permissions.resolve(overwrite.deny || overwrite.denied || 0),\n type: overwrite.type,\n id: overwrite.id,\n };\n });\n }\n\n return overwrites;\n};\n\n\n//# sourceURL=webpack:///./src/structures/shared/resolvePermissions.js?"); + +/***/ }), + +/***/ "./src/util/Collection.js": +/*!********************************!*\ + !*** ./src/util/Collection.js ***! + \********************************/ +/*! no static exports found */ +/*! ModuleConcatenation bailout: Module is not an ECMAScript module */ +/***/ (function(module, exports, __webpack_require__) { + +eval("const util = __webpack_require__(/*! util */ \"./node_modules/util/util.js\");\n\n/**\n * A Map with additional utility methods. This is used throughout discord.js rather than Arrays for anything that has\n * an ID, for significantly improved performance and ease-of-use.\n * @extends {Map}\n */\nclass Collection extends Map {\n constructor(iterable) {\n super(iterable);\n\n /**\n * Cached array for the `array()` method - will be reset to `null` whenever `set()` or `delete()` are called\n * @name Collection#_array\n * @type {?Array}\n * @private\n */\n Object.defineProperty(this, '_array', { value: null, writable: true, configurable: true });\n\n /**\n * Cached array for the `keyArray()` method - will be reset to `null` whenever `set()` or `delete()` are called\n * @name Collection#_keyArray\n * @type {?Array}\n * @private\n */\n Object.defineProperty(this, '_keyArray', { value: null, writable: true, configurable: true });\n }\n\n set(key, val) {\n this._array = null;\n this._keyArray = null;\n return super.set(key, val);\n }\n\n delete(key) {\n this._array = null;\n this._keyArray = null;\n return super.delete(key);\n }\n\n /**\n * Creates an ordered array of the values of this collection, and caches it internally. The array will only be\n * reconstructed if an item is added to or removed from the collection, or if you change the length of the array\n * itself. If you don't want this caching behavior, use `[...collection.values()]` or\n * `Array.from(collection.values())` instead.\n * @returns {Array}\n */\n array() {\n if (!this._array || this._array.length !== this.size) this._array = [...this.values()];\n return this._array;\n }\n\n /**\n * Creates an ordered array of the keys of this collection, and caches it internally. The array will only be\n * reconstructed if an item is added to or removed from the collection, or if you change the length of the array\n * itself. If you don't want this caching behavior, use `[...collection.keys()]` or\n * `Array.from(collection.keys())` instead.\n * @returns {Array}\n */\n keyArray() {\n if (!this._keyArray || this._keyArray.length !== this.size) this._keyArray = [...this.keys()];\n return this._keyArray;\n }\n\n /**\n * Obtains the first value(s) in this collection.\n * @param {number} [count] Number of values to obtain from the beginning\n * @returns {*|Array<*>} The single value if `count` is undefined, or an array of values of `count` length\n */\n first(count) {\n if (count === undefined) return this.values().next().value;\n if (typeof count !== 'number') throw new TypeError('The count must be a number.');\n if (!Number.isInteger(count) || count < 1) throw new RangeError('The count must be an integer greater than 0.');\n count = Math.min(this.size, count);\n const arr = new Array(count);\n const iter = this.values();\n for (let i = 0; i < count; i++) arr[i] = iter.next().value;\n return arr;\n }\n\n /**\n * Obtains the first key(s) in this collection.\n * @param {number} [count] Number of keys to obtain from the beginning\n * @returns {*|Array<*>} The single key if `count` is undefined, or an array of keys of `count` length\n */\n firstKey(count) {\n if (count === undefined) return this.keys().next().value;\n if (typeof count !== 'number') throw new TypeError('The count must be a number.');\n if (!Number.isInteger(count) || count < 1) throw new RangeError('The count must be an integer greater than 0.');\n count = Math.min(this.size, count);\n const arr = new Array(count);\n const iter = this.keys();\n for (let i = 0; i < count; i++) arr[i] = iter.next().value;\n return arr;\n }\n\n /**\n * Obtains the last value(s) in this collection. This relies on {@link Collection#array}, and thus the caching\n * mechanism applies here as well.\n * @param {number} [count] Number of values to obtain from the end\n * @returns {*|Array<*>} The single value if `count` is undefined, or an array of values of `count` length\n */\n last(count) {\n const arr = this.array();\n if (count === undefined) return arr[arr.length - 1];\n if (typeof count !== 'number') throw new TypeError('The count must be a number.');\n if (!Number.isInteger(count) || count < 1) throw new RangeError('The count must be an integer greater than 0.');\n return arr.slice(-count);\n }\n\n /**\n * Obtains the last key(s) in this collection. This relies on {@link Collection#keyArray}, and thus the caching\n * mechanism applies here as well.\n * @param {number} [count] Number of keys to obtain from the end\n * @returns {*|Array<*>} The single key if `count` is undefined, or an array of keys of `count` length\n */\n lastKey(count) {\n const arr = this.keyArray();\n if (count === undefined) return arr[arr.length - 1];\n if (typeof count !== 'number') throw new TypeError('The count must be a number.');\n if (!Number.isInteger(count) || count < 1) throw new RangeError('The count must be an integer greater than 0.');\n return arr.slice(-count);\n }\n\n /**\n * Obtains random value(s) from this collection. This relies on {@link Collection#array}, and thus the caching\n * mechanism applies here as well.\n * @param {number} [count] Number of values to obtain randomly\n * @returns {*|Array<*>} The single value if `count` is undefined, or an array of values of `count` length\n */\n random(count) {\n let arr = this.array();\n if (count === undefined) return arr[Math.floor(Math.random() * arr.length)];\n if (typeof count !== 'number') throw new TypeError('The count must be a number.');\n if (!Number.isInteger(count) || count < 1) throw new RangeError('The count must be an integer greater than 0.');\n if (arr.length === 0) return [];\n const rand = new Array(count);\n arr = arr.slice();\n for (let i = 0; i < count; i++) rand[i] = arr.splice(Math.floor(Math.random() * arr.length), 1)[0];\n return rand;\n }\n\n /**\n * Obtains random key(s) from this collection. This relies on {@link Collection#keyArray}, and thus the caching\n * mechanism applies here as well.\n * @param {number} [count] Number of keys to obtain randomly\n * @returns {*|Array<*>} The single key if `count` is undefined, or an array of keys of `count` length\n */\n randomKey(count) {\n let arr = this.keyArray();\n if (count === undefined) return arr[Math.floor(Math.random() * arr.length)];\n if (typeof count !== 'number') throw new TypeError('The count must be a number.');\n if (!Number.isInteger(count) || count < 1) throw new RangeError('The count must be an integer greater than 0.');\n if (arr.length === 0) return [];\n const rand = new Array(count);\n arr = arr.slice();\n for (let i = 0; i < count; i++) rand[i] = arr.splice(Math.floor(Math.random() * arr.length), 1)[0];\n return rand;\n }\n\n /**\n * Searches for all items where their specified property's value is identical to the given value\n * (`item[prop] === value`).\n * @param {string} prop The property to test against\n * @param {*} value The expected value\n * @returns {Array}\n * @deprecated\n * @example\n * collection.findAll('username', 'Bob');\n */\n findAll(prop, value) {\n if (typeof prop !== 'string') throw new TypeError('Key must be a string.');\n if (typeof value === 'undefined') throw new Error('Value must be specified.');\n const results = [];\n for (const item of this.values()) {\n if (item[prop] === value) results.push(item);\n }\n return results;\n }\n\n /**\n * Searches for a single item where its specified property's value is identical to the given value\n * (`item[prop] === value`), or the given function returns a truthy value. In the latter case, this is identical to\n * [Array.find()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find).\n * All collections used in Discord.js are mapped using their `id` property, and if you want to find by id you\n * should use the `get` method. See\n * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/get) for details.\n * @param {string|Function} propOrFn The property to test against, or the function to test with\n * @param {*} [value] The expected value - only applicable and required if using a property for the first argument\n * @returns {*}\n * @example\n * collection.find('username', 'Bob');\n * @example\n * collection.find(val => val.username === 'Bob');\n */\n find(propOrFn, value) {\n if (typeof propOrFn === 'string') {\n if (typeof value === 'undefined') throw new Error('Value must be specified.');\n for (const item of this.values()) {\n if (item[propOrFn] === value) return item;\n }\n return null;\n } else if (typeof propOrFn === 'function') {\n for (const [key, val] of this) {\n if (propOrFn(val, key, this)) return val;\n }\n return null;\n } else {\n throw new Error('First argument must be a property string or a function.');\n }\n }\n\n /* eslint-disable max-len */\n /**\n * Searches for the key of a single item where its specified property's value is identical to the given value\n * (`item[prop] === value`), or the given function returns a truthy value. In the latter case, this is identical to\n * [Array.findIndex()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/findIndex).\n * @param {string|Function} propOrFn The property to test against, or the function to test with\n * @param {*} [value] The expected value - only applicable and required if using a property for the first argument\n * @returns {*}\n * @example\n * collection.findKey('username', 'Bob');\n * @example\n * collection.findKey(val => val.username === 'Bob');\n */\n findKey(propOrFn, value) {\n /* eslint-enable max-len */\n if (typeof propOrFn === 'string') {\n if (typeof value === 'undefined') throw new Error('Value must be specified.');\n for (const [key, val] of this) {\n if (val[propOrFn] === value) return key;\n }\n return null;\n } else if (typeof propOrFn === 'function') {\n for (const [key, val] of this) {\n if (propOrFn(val, key, this)) return key;\n }\n return null;\n } else {\n throw new Error('First argument must be a property string or a function.');\n }\n }\n\n /**\n * Searches for the existence of a single item where its specified property's value is identical to the given value\n * (`item[prop] === value`).\n * Do not use this to check for an item by its ID. Instead, use `collection.has(id)`. See\n * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/has) for details.\n * @param {string} prop The property to test against\n * @param {*} value The expected value\n * @returns {boolean}\n * @deprecated\n * @example\n * if (collection.exists('username', 'Bob')) {\n * console.log('user here!');\n * }\n */\n exists(prop, value) {\n return Boolean(this.find(prop, value));\n }\n\n /**\n * Removes entries that satisfy the provided filter function.\n * @param {Function} fn Function used to test (should return a boolean)\n * @param {Object} [thisArg] Value to use as `this` when executing function\n * @returns {number} The number of removed entries\n */\n sweep(fn, thisArg) {\n if (thisArg) fn = fn.bind(thisArg);\n const previousSize = this.size;\n for (const [key, val] of this) {\n if (fn(val, key, this)) this.delete(key);\n }\n return previousSize - this.size;\n }\n\n /**\n * Identical to\n * [Array.filter()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter),\n * but returns a Collection instead of an Array.\n * @param {Function} fn Function used to test (should return a boolean)\n * @param {Object} [thisArg] Value to use as `this` when executing function\n * @returns {Collection}\n */\n filter(fn, thisArg) {\n if (thisArg) fn = fn.bind(thisArg);\n const results = new Collection();\n for (const [key, val] of this) {\n if (fn(val, key, this)) results.set(key, val);\n }\n return results;\n }\n\n /**\n * Identical to\n * [Array.filter()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter).\n * @param {Function} fn Function used to test (should return a boolean)\n * @param {Object} [thisArg] Value to use as `this` when executing function\n * @returns {Array}\n * @deprecated\n */\n filterArray(fn, thisArg) {\n if (thisArg) fn = fn.bind(thisArg);\n const results = [];\n for (const [key, val] of this) {\n if (fn(val, key, this)) results.push(val);\n }\n return results;\n }\n\n /**\n * Partitions the collection into two collections where the first collection\n * contains the items that passed and the second contains the items that failed.\n * @param {Function} fn Function used to test (should return a boolean)\n * @param {*} [thisArg] Value to use as `this` when executing function\n * @returns {Collection[]}\n * @example const [big, small] = collection.partition(guild => guild.memberCount > 250);\n */\n partition(fn, thisArg) {\n if (typeof thisArg !== 'undefined') fn = fn.bind(thisArg);\n const results = [new Collection(), new Collection()];\n for (const [key, val] of this) {\n if (fn(val, key, this)) {\n results[0].set(key, val);\n } else {\n results[1].set(key, val);\n }\n }\n return results;\n }\n\n /**\n * Identical to\n * [Array.map()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map).\n * @param {Function} fn Function that produces an element of the new array, taking three arguments\n * @param {*} [thisArg] Value to use as `this` when executing function\n * @returns {Array}\n */\n map(fn, thisArg) {\n if (thisArg) fn = fn.bind(thisArg);\n const arr = new Array(this.size);\n let i = 0;\n for (const [key, val] of this) arr[i++] = fn(val, key, this);\n return arr;\n }\n\n /**\n * Identical to\n * [Array.some()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some).\n * @param {Function} fn Function used to test (should return a boolean)\n * @param {Object} [thisArg] Value to use as `this` when executing function\n * @returns {boolean}\n */\n some(fn, thisArg) {\n if (thisArg) fn = fn.bind(thisArg);\n for (const [key, val] of this) {\n if (fn(val, key, this)) return true;\n }\n return false;\n }\n\n /**\n * Identical to\n * [Array.every()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/every).\n * @param {Function} fn Function used to test (should return a boolean)\n * @param {Object} [thisArg] Value to use as `this` when executing function\n * @returns {boolean}\n */\n every(fn, thisArg) {\n if (thisArg) fn = fn.bind(thisArg);\n for (const [key, val] of this) {\n if (!fn(val, key, this)) return false;\n }\n return true;\n }\n\n /**\n * Identical to\n * [Array.reduce()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce).\n * @param {Function} fn Function used to reduce, taking four arguments; `accumulator`, `currentValue`, `currentKey`,\n * and `collection`\n * @param {*} [initialValue] Starting value for the accumulator\n * @returns {*}\n */\n reduce(fn, initialValue) {\n let accumulator;\n if (typeof initialValue !== 'undefined') {\n accumulator = initialValue;\n for (const [key, val] of this) accumulator = fn(accumulator, val, key, this);\n } else {\n let first = true;\n for (const [key, val] of this) {\n if (first) {\n accumulator = val;\n first = false;\n continue;\n }\n accumulator = fn(accumulator, val, key, this);\n }\n }\n return accumulator;\n }\n\n /**\n * Identical to\n * [Map.forEach()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/forEach),\n * but returns the collection instead of undefined.\n * @param {Function} fn Function to execute for each element\n * @param {*} [thisArg] Value to use as `this` when executing function\n * @returns {Collection}\n * @example\n * collection\n * .tap(user => console.log(user.username))\n * .filter(user => user.bot)\n * .tap(user => console.log(user.username));\n */\n tap(fn, thisArg) {\n this.forEach(fn, thisArg);\n return this;\n }\n\n /**\n * Creates an identical shallow copy of this collection.\n * @returns {Collection}\n * @example const newColl = someColl.clone();\n */\n clone() {\n return new this.constructor(this);\n }\n\n /**\n * Combines this collection with others into a new collection. None of the source collections are modified.\n * @param {...Collection} collections Collections to merge\n * @returns {Collection}\n * @example const newColl = someColl.concat(someOtherColl, anotherColl, ohBoyAColl);\n */\n concat(...collections) {\n const newColl = this.clone();\n for (const coll of collections) {\n for (const [key, val] of coll) newColl.set(key, val);\n }\n return newColl;\n }\n\n /**\n * Calls the `delete()` method on all items that have it.\n * @returns {Promise[]}\n */\n deleteAll() {\n const returns = [];\n for (const item of this.values()) {\n if (item.delete) returns.push(item.delete());\n }\n return returns;\n }\n\n /**\n * Checks if this collection shares identical key-value pairings with another.\n * This is different to checking for equality using equal-signs, because\n * the collections may be different objects, but contain the same data.\n * @param {Collection} collection Collection to compare with\n * @returns {boolean} Whether the collections have identical contents\n */\n equals(collection) {\n if (!collection) return false;\n if (this === collection) return true;\n if (this.size !== collection.size) return false;\n return !this.find((value, key) => {\n const testVal = collection.get(key);\n return testVal !== value || (testVal === undefined && !collection.has(key));\n });\n }\n\n /**\n * The sort() method sorts the elements of a collection in place and returns the collection.\n * The sort is not necessarily stable. The default sort order is according to string Unicode code points.\n * @param {Function} [compareFunction] Specifies a function that defines the sort order.\n * if omitted, the collection is sorted according to each character's Unicode code point value,\n * according to the string conversion of each element.\n * @returns {Collection}\n */\n sort(compareFunction = (x, y) => +(x > y) || +(x === y) - 1) {\n return new Collection([...this.entries()].sort((a, b) => compareFunction(a[1], b[1], a[0], b[0])));\n }\n}\n\nCollection.prototype.findAll =\n util.deprecate(Collection.prototype.findAll, 'Collection#findAll: use Collection#filter instead');\n\nCollection.prototype.filterArray =\n util.deprecate(Collection.prototype.filterArray, 'Collection#filterArray: use Collection#filter instead');\n\nCollection.prototype.exists =\n util.deprecate(Collection.prototype.exists, 'Collection#exists: use Collection#some instead');\n\nCollection.prototype.find = function find(propOrFn, value) {\n if (typeof propOrFn === 'string') {\n ((any, ...more) => console.warn(any, more))('Collection#find: pass a function instead', 'DeprecationWarning');\n if (typeof value === 'undefined') throw new Error('Value must be specified.');\n for (const item of this.values()) {\n if (item[propOrFn] === value) return item;\n }\n return null;\n } else if (typeof propOrFn === 'function') {\n for (const [key, val] of this) {\n if (propOrFn(val, key, this)) return val;\n }\n return null;\n } else {\n throw new Error('First argument must be a property string or a function.');\n }\n};\n\nCollection.prototype.findKey = function findKey(propOrFn, value) {\n if (typeof propOrFn === 'string') {\n ((any, ...more) => console.warn(any, more))('Collection#findKey: pass a function instead', 'DeprecationWarning');\n if (typeof value === 'undefined') throw new Error('Value must be specified.');\n for (const [key, val] of this) {\n if (val[propOrFn] === value) return key;\n }\n return null;\n } else if (typeof propOrFn === 'function') {\n for (const [key, val] of this) {\n if (propOrFn(val, key, this)) return key;\n }\n return null;\n } else {\n throw new Error('First argument must be a property string or a function.');\n }\n};\n\nmodule.exports = Collection;\n\n\n//# sourceURL=webpack:///./src/util/Collection.js?"); + +/***/ }), + +/***/ "./src/util/Constants.js": +/*!*******************************!*\ + !*** ./src/util/Constants.js ***! + \*******************************/ +/*! no static exports found */ +/*! 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?"); + +/***/ }), + +/***/ "./src/util/Permissions.js": +/*!*********************************!*\ + !*** ./src/util/Permissions.js ***! + \*********************************/ +/*! no static exports found */ +/*! 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?"); + +/***/ }), + +/***/ "./src/util/Snowflake.js": +/*!*******************************!*\ + !*** ./src/util/Snowflake.js ***! + \*******************************/ +/*! no static exports found */ +/*! ModuleConcatenation bailout: Module is not an ECMAScript module */ +/***/ (function(module, exports, __webpack_require__) { + +eval("const Long = __webpack_require__(/*! long */ \"./node_modules/long/src/long.js\");\n\n// Discord epoch (2015-01-01T00:00:00.000Z)\nconst EPOCH = 1420070400000;\nlet INCREMENT = 0;\n\n/**\n * A container for useful snowflake-related methods.\n */\nclass SnowflakeUtil {\n constructor() {\n throw new Error(`The ${this.constructor.name} class may not be instantiated.`);\n }\n\n /**\n * A Twitter snowflake, except the epoch is 2015-01-01T00:00:00.000Z\n * ```\n * If we have a snowflake '266241948824764416' we can represent it as binary:\n *\n * 64 22 17 12 0\n * 000000111011000111100001101001000101000000 00001 00000 000000000000\n * number of ms since Discord epoch worker pid increment\n * ```\n * @typedef {string} Snowflake\n */\n\n /**\n * Generates a Discord snowflake.\n * This hardcodes the worker ID as 1 and the process ID as 0.\n * @param {number|Date} [timestamp=Date.now()] Timestamp or date of the snowflake to generate\n * @returns {Snowflake} The generated snowflake\n */\n static generate(timestamp = Date.now()) {\n if (timestamp instanceof Date) timestamp = timestamp.getTime();\n if (typeof timestamp !== 'number' || isNaN(timestamp)) {\n throw new TypeError(\n `\"timestamp\" argument must be a number (received ${isNaN(timestamp) ? 'NaN' : typeof timestamp})`\n );\n }\n if (INCREMENT >= 4095) INCREMENT = 0;\n const BINARY = `${pad((timestamp - EPOCH).toString(2), 42)}0000100000${pad((INCREMENT++).toString(2), 12)}`;\n return Long.fromString(BINARY, 2).toString();\n }\n\n /**\n * A deconstructed snowflake.\n * @typedef {Object} DeconstructedSnowflake\n * @property {number} timestamp Timestamp the snowflake was created\n * @property {Date} date Date the snowflake was created\n * @property {number} workerID Worker ID in the snowflake\n * @property {number} processID Process ID in the snowflake\n * @property {number} increment Increment in the snowflake\n * @property {string} binary Binary representation of the snowflake\n */\n\n /**\n * Deconstructs a Discord snowflake.\n * @param {Snowflake} snowflake Snowflake to deconstruct\n * @returns {DeconstructedSnowflake} Deconstructed snowflake\n */\n static deconstruct(snowflake) {\n const BINARY = pad(Long.fromString(snowflake).toString(2), 64);\n const res = {\n timestamp: parseInt(BINARY.substring(0, 42), 2) + EPOCH,\n workerID: parseInt(BINARY.substring(42, 47), 2),\n processID: parseInt(BINARY.substring(47, 52), 2),\n increment: parseInt(BINARY.substring(52, 64), 2),\n binary: BINARY,\n };\n Object.defineProperty(res, 'date', {\n get: function get() { return new Date(this.timestamp); },\n enumerable: true,\n });\n return res;\n }\n}\n\nfunction pad(v, n, c = '0') {\n return String(v).length >= n ? String(v) : (String(c).repeat(n) + v).slice(-n);\n}\n\nmodule.exports = SnowflakeUtil;\n\n\n//# sourceURL=webpack:///./src/util/Snowflake.js?"); + +/***/ }), + +/***/ "./src/util/Util.js": +/*!**************************!*\ + !*** ./src/util/Util.js ***! + \**************************/ +/*! no static exports found */ +/*! 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?"); + +/***/ }), + +/***/ 0: +/*!************************!*\ + !*** ./node (ignored) ***! + \************************/ +/*! no static exports found */ +/*! ModuleConcatenation bailout: Module is not an ECMAScript module */ +/***/ (function(module, exports) { + +eval("/* (ignored) */\n\n//# sourceURL=webpack:///./node_(ignored)?"); + +/***/ }), + +/***/ 1: +/*!*************************!*\ + !*** erlpack (ignored) ***! + \*************************/ +/*! no static exports found */ +/*! ModuleConcatenation bailout: Module is not an ECMAScript module */ +/***/ (function(module, exports) { + +eval("/* (ignored) */\n\n//# sourceURL=webpack:///erlpack_(ignored)?"); + +/***/ }), + +/***/ 2: +/*!********************************!*\ + !*** @discordjs/uws (ignored) ***! + \********************************/ +/*! no static exports found */ +/*! ModuleConcatenation bailout: Module is not an ECMAScript module */ +/***/ (function(module, exports) { + +eval("/* (ignored) */\n\n//# sourceURL=webpack:///@discordjs/uws_(ignored)?"); + +/***/ }), + +/***/ 3: +/*!********************!*\ + !*** ws (ignored) ***! + \********************/ +/*! no static exports found */ +/*! ModuleConcatenation bailout: Module is not an ECMAScript module */ +/***/ (function(module, exports) { + +eval("/* (ignored) */\n\n//# sourceURL=webpack:///ws_(ignored)?"); + +/***/ }), + +/***/ 4: +/*!********************************************!*\ + !*** ./voice/ClientVoiceManager (ignored) ***! + \********************************************/ +/*! no static exports found */ +/*! ModuleConcatenation bailout: Module is not an ECMAScript module */ +/***/ (function(module, exports) { + +eval("/* (ignored) */\n\n//# sourceURL=webpack:///./voice/ClientVoiceManager_(ignored)?"); + +/***/ }), + +/***/ 5: +/*!*********************************************!*\ + !*** ../sharding/ShardClientUtil (ignored) ***! + \*********************************************/ +/*! no static exports found */ +/*! ModuleConcatenation bailout: Module is not an ECMAScript module */ +/***/ (function(module, exports) { + +eval("/* (ignored) */\n\n//# sourceURL=webpack:///../sharding/ShardClientUtil_(ignored)?"); + +/***/ }), + +/***/ 6: +/*!****************************************!*\ + !*** ./voice/VoiceBroadcast (ignored) ***! + \****************************************/ +/*! no static exports found */ +/*! ModuleConcatenation bailout: Module is not an ECMAScript module */ +/***/ (function(module, exports) { + +eval("/* (ignored) */\n\n//# sourceURL=webpack:///./voice/VoiceBroadcast_(ignored)?"); + +/***/ }), + +/***/ 7: +/*!**********************************!*\ + !*** ./sharding/Shard (ignored) ***! + \**********************************/ +/*! no static exports found */ +/*! ModuleConcatenation bailout: Module is not an ECMAScript module */ +/***/ (function(module, exports) { + +eval("/* (ignored) */\n\n//# sourceURL=webpack:///./sharding/Shard_(ignored)?"); + +/***/ }), + +/***/ 8: +/*!********************************************!*\ + !*** ./sharding/ShardClientUtil (ignored) ***! + \********************************************/ +/*! no static exports found */ +/*! ModuleConcatenation bailout: Module is not an ECMAScript module */ +/***/ (function(module, exports) { + +eval("/* (ignored) */\n\n//# sourceURL=webpack:///./sharding/ShardClientUtil_(ignored)?"); + +/***/ }), + +/***/ 9: +/*!********************************************!*\ + !*** ./sharding/ShardingManager (ignored) ***! + \********************************************/ +/*! no static exports found */ +/*! ModuleConcatenation bailout: Module is not an ECMAScript module */ +/***/ (function(module, exports) { + +eval("/* (ignored) */\n\n//# sourceURL=webpack:///./sharding/ShardingManager_(ignored)?"); + +/***/ }) + +/******/ }); \ No newline at end of file diff --git a/discord.11.5.1.min.js b/discord.11.5.1.min.js new file mode 100644 index 00000000..c906070f --- /dev/null +++ b/discord.11.5.1.min.js @@ -0,0 +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