diff --git a/client/dist/betterdiscord.client.js b/client/dist/betterdiscord.client.js index f9830575..f733e3af 100644 --- a/client/dist/betterdiscord.client.js +++ b/client/dist/betterdiscord.client.js @@ -60,7 +60,7 @@ /******/ __webpack_require__.p = ""; /******/ /******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = 124); +/******/ return __webpack_require__(__webpack_require__.s = 125); /******/ }) /************************************************************************/ /******/ ([ @@ -4701,6 +4701,65 @@ module.exports = { Events }; /* 3 */ /***/ (function(module, exports, __webpack_require__) { +/** + * BetterDiscord Client Utils Module + * Copyright (c) 2015-present JsSucks - https://github.com/JsSucks + * All rights reserved. + * https://github.com/JsSucks - https://betterdiscord.net + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. +*/ + +const { Module } = __webpack_require__(1); +const moment = __webpack_require__(0); + +const logs = []; + +class Logger { + + static log(module, message, level = 'log') { + level = this.parseLevel(level); + console[level]('[%cBetter%cDiscord:%s] %s', 'color: #3E82E5', '', `${module}${level === 'debug' ? '|DBG' : ''}`, message); + logs.push(`[${moment().format('DD/MM/YY hh:mm:ss')}|${module}|${level}] ${message}`); + window.bdlogs = logs; + } + + static get levels() { + return { + 'log': 'log', + 'warn': 'warn', + 'err': 'error', + 'error': 'error', + 'debug': 'debug', + 'dbg': 'debug', + 'info': 'info' + }; + } + + static parseLevel(level) { + return this.levels.hasOwnProperty(level) ? this.levels[level] : 'log'; + } +} + +class Utils { + + static overload(fn, cb) { + const orig = fn; + return function (...args) { + orig(...args); + cb(...args); + }; + } + +} + +module.exports = { Logger, Utils }; + +/***/ }), +/* 4 */ +/***/ (function(module, exports, __webpack_require__) { + //! moment.js locale configuration //! locale : Afrikaans [af] //! author : Werner Mollentze : https://github.com/wernerm @@ -4777,7 +4836,7 @@ return af; /***/ }), -/* 4 */ +/* 5 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -4925,7 +4984,7 @@ return ar; /***/ }), -/* 5 */ +/* 6 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -4990,7 +5049,7 @@ return arDz; /***/ }), -/* 6 */ +/* 7 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -5055,7 +5114,7 @@ return arKw; /***/ }), -/* 7 */ +/* 8 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -5187,7 +5246,7 @@ return arLy; /***/ }), -/* 8 */ +/* 9 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -5253,7 +5312,7 @@ return arMa; /***/ }), -/* 9 */ +/* 10 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -5364,7 +5423,7 @@ return arSa; /***/ }), -/* 10 */ +/* 11 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -5429,7 +5488,7 @@ return arTn; /***/ }), -/* 11 */ +/* 12 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -5540,7 +5599,7 @@ return az; /***/ }), -/* 12 */ +/* 13 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -5680,7 +5739,7 @@ return be; /***/ }), -/* 13 */ +/* 14 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -5776,7 +5835,7 @@ return bg; /***/ }), -/* 14 */ +/* 15 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -5841,7 +5900,7 @@ return bm; /***/ }), -/* 15 */ +/* 16 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -5966,7 +6025,7 @@ return bn; /***/ }), -/* 16 */ +/* 17 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -6091,7 +6150,7 @@ return bo; /***/ }), -/* 17 */ +/* 18 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -6205,7 +6264,7 @@ return br; /***/ }), -/* 18 */ +/* 19 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -6363,7 +6422,7 @@ return bs; /***/ }), -/* 19 */ +/* 20 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -6457,7 +6516,7 @@ return ca; /***/ }), -/* 20 */ +/* 21 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -6642,7 +6701,7 @@ return cs; /***/ }), -/* 21 */ +/* 22 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -6711,7 +6770,7 @@ return cv; /***/ }), -/* 22 */ +/* 23 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -6798,7 +6857,7 @@ return cy; /***/ }), -/* 23 */ +/* 24 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -6864,7 +6923,7 @@ return da; /***/ }), -/* 24 */ +/* 25 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -6948,7 +7007,7 @@ return de; /***/ }), -/* 25 */ +/* 26 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -7033,7 +7092,7 @@ return deAt; /***/ }), -/* 26 */ +/* 27 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -7117,7 +7176,7 @@ return deCh; /***/ }), -/* 27 */ +/* 28 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -7223,7 +7282,7 @@ return dv; /***/ }), -/* 28 */ +/* 29 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -7329,7 +7388,7 @@ return el; /***/ }), -/* 29 */ +/* 30 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -7402,7 +7461,7 @@ return enAu; /***/ }), -/* 30 */ +/* 31 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -7471,7 +7530,7 @@ return enCa; /***/ }), -/* 31 */ +/* 32 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -7544,7 +7603,7 @@ return enGb; /***/ }), -/* 32 */ +/* 33 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -7617,7 +7676,7 @@ return enIe; /***/ }), -/* 33 */ +/* 34 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -7690,7 +7749,7 @@ return enNz; /***/ }), -/* 34 */ +/* 35 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -7769,7 +7828,7 @@ return eo; /***/ }), -/* 35 */ +/* 36 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -7867,7 +7926,7 @@ return es; /***/ }), -/* 36 */ +/* 37 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -7964,7 +8023,7 @@ return esDo; /***/ }), -/* 37 */ +/* 38 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -8053,7 +8112,7 @@ return esUs; /***/ }), -/* 38 */ +/* 39 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -8140,7 +8199,7 @@ return et; /***/ }), -/* 39 */ +/* 40 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -8212,7 +8271,7 @@ return eu; /***/ }), -/* 40 */ +/* 41 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -8325,7 +8384,7 @@ return fa; /***/ }), -/* 41 */ +/* 42 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -8440,7 +8499,7 @@ return fi; /***/ }), -/* 42 */ +/* 43 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -8506,7 +8565,7 @@ return fo; /***/ }), -/* 43 */ +/* 44 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -8595,7 +8654,7 @@ return fr; /***/ }), -/* 44 */ +/* 45 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -8675,7 +8734,7 @@ return frCa; /***/ }), -/* 45 */ +/* 46 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -8759,7 +8818,7 @@ return frCh; /***/ }), -/* 46 */ +/* 47 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -8840,7 +8899,7 @@ return fy; /***/ }), -/* 47 */ +/* 48 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -8922,7 +8981,7 @@ return gd; /***/ }), -/* 48 */ +/* 49 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -9005,7 +9064,7 @@ return gl; /***/ }), -/* 49 */ +/* 50 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -9134,7 +9193,7 @@ return gomLatn; /***/ }), -/* 50 */ +/* 51 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -9264,7 +9323,7 @@ return gu; /***/ }), -/* 51 */ +/* 52 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -9369,7 +9428,7 @@ return he; /***/ }), -/* 52 */ +/* 53 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -9499,7 +9558,7 @@ return hi; /***/ }), -/* 53 */ +/* 54 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -9659,7 +9718,7 @@ return hr; /***/ }), -/* 54 */ +/* 55 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -9775,7 +9834,7 @@ return hu; /***/ }), -/* 55 */ +/* 56 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -9876,7 +9935,7 @@ return hyAm; /***/ }), -/* 56 */ +/* 57 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -9965,7 +10024,7 @@ return id; /***/ }), -/* 57 */ +/* 58 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -10103,7 +10162,7 @@ return is; /***/ }), -/* 58 */ +/* 59 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -10179,7 +10238,7 @@ return it; /***/ }), -/* 59 */ +/* 60 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -10265,7 +10324,7 @@ return ja; /***/ }), -/* 60 */ +/* 61 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -10354,7 +10413,7 @@ return jv; /***/ }), -/* 61 */ +/* 62 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -10449,7 +10508,7 @@ return ka; /***/ }), -/* 62 */ +/* 63 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -10542,7 +10601,7 @@ return kk; /***/ }), -/* 63 */ +/* 64 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -10606,7 +10665,7 @@ return km; /***/ }), -/* 64 */ +/* 65 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -10738,7 +10797,7 @@ return kn; /***/ }), -/* 65 */ +/* 66 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -10826,7 +10885,7 @@ return ko; /***/ }), -/* 66 */ +/* 67 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -10920,7 +10979,7 @@ return ky; /***/ }), -/* 67 */ +/* 68 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -11063,7 +11122,7 @@ return lb; /***/ }), -/* 68 */ +/* 69 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -11139,7 +11198,7 @@ return lo; /***/ }), -/* 69 */ +/* 70 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -11263,7 +11322,7 @@ return lt; /***/ }), -/* 70 */ +/* 71 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -11367,7 +11426,7 @@ return lv; /***/ }), -/* 71 */ +/* 72 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -11485,7 +11544,7 @@ return me; /***/ }), -/* 72 */ +/* 73 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -11555,7 +11614,7 @@ return mi; /***/ }), -/* 73 */ +/* 74 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -11651,7 +11710,7 @@ return mk; /***/ }), -/* 74 */ +/* 75 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -11738,7 +11797,7 @@ return ml; /***/ }), -/* 75 */ +/* 76 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -11905,7 +11964,7 @@ return mr; /***/ }), -/* 76 */ +/* 77 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -11993,7 +12052,7 @@ return ms; /***/ }), -/* 77 */ +/* 78 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -12082,7 +12141,7 @@ return msMy; /***/ }), -/* 78 */ +/* 79 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -12148,7 +12207,7 @@ return mt; /***/ }), -/* 79 */ +/* 80 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -12250,7 +12309,7 @@ return my; /***/ }), -/* 80 */ +/* 81 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -12319,7 +12378,7 @@ return nb; /***/ }), -/* 81 */ +/* 82 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -12448,7 +12507,7 @@ return ne; /***/ }), -/* 82 */ +/* 83 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -12542,7 +12601,7 @@ return nl; /***/ }), -/* 83 */ +/* 84 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -12636,7 +12695,7 @@ return nlBe; /***/ }), -/* 84 */ +/* 85 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -12702,7 +12761,7 @@ return nn; /***/ }), -/* 85 */ +/* 86 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -12832,7 +12891,7 @@ return paIn; /***/ }), -/* 86 */ +/* 87 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -12964,7 +13023,7 @@ return pl; /***/ }), -/* 87 */ +/* 88 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -13035,7 +13094,7 @@ return pt; /***/ }), -/* 88 */ +/* 89 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -13102,7 +13161,7 @@ return ptBr; /***/ }), -/* 89 */ +/* 90 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -13184,7 +13243,7 @@ return ro; /***/ }), -/* 90 */ +/* 91 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -13374,7 +13433,7 @@ return ru; /***/ }), -/* 91 */ +/* 92 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -13478,7 +13537,7 @@ return sd; /***/ }), -/* 92 */ +/* 93 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -13545,7 +13604,7 @@ return se; /***/ }), -/* 93 */ +/* 94 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -13622,7 +13681,7 @@ return si; /***/ }), -/* 94 */ +/* 95 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -13785,7 +13844,7 @@ return sk; /***/ }), -/* 95 */ +/* 96 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -13964,7 +14023,7 @@ return sl; /***/ }), -/* 96 */ +/* 97 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -14040,7 +14099,7 @@ return sq; /***/ }), -/* 97 */ +/* 98 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -14157,7 +14216,7 @@ return sr; /***/ }), -/* 98 */ +/* 99 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -14274,7 +14333,7 @@ return srCyrl; /***/ }), -/* 99 */ +/* 100 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -14369,7 +14428,7 @@ return ss; /***/ }), -/* 100 */ +/* 101 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -14444,7 +14503,7 @@ return sv; /***/ }), -/* 101 */ +/* 102 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -14509,7 +14568,7 @@ return sw; /***/ }), -/* 102 */ +/* 103 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -14645,7 +14704,7 @@ return ta; /***/ }), -/* 103 */ +/* 104 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -14740,7 +14799,7 @@ return te; /***/ }), -/* 104 */ +/* 105 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -14814,7 +14873,7 @@ return tet; /***/ }), -/* 105 */ +/* 106 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -14887,7 +14946,7 @@ return th; /***/ }), -/* 106 */ +/* 107 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -14955,7 +15014,7 @@ return tlPh; /***/ }), -/* 107 */ +/* 108 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -15083,7 +15142,7 @@ return tlh; /***/ }), -/* 108 */ +/* 109 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -15179,7 +15238,7 @@ return tr; /***/ }), -/* 109 */ +/* 110 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -15277,7 +15336,7 @@ return tzl; /***/ }), -/* 110 */ +/* 111 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -15341,7 +15400,7 @@ return tzm; /***/ }), -/* 111 */ +/* 112 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -15405,7 +15464,7 @@ return tzmLatn; /***/ }), -/* 112 */ +/* 113 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -15563,7 +15622,7 @@ return uk; /***/ }), -/* 113 */ +/* 114 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -15668,7 +15727,7 @@ return ur; /***/ }), -/* 114 */ +/* 115 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -15732,7 +15791,7 @@ return uz; /***/ }), -/* 115 */ +/* 116 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -15796,7 +15855,7 @@ return uzLatn; /***/ }), -/* 116 */ +/* 117 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -15881,7 +15940,7 @@ return vi; /***/ }), -/* 117 */ +/* 118 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -15955,7 +16014,7 @@ return xPseudo; /***/ }), -/* 118 */ +/* 119 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -16021,7 +16080,7 @@ return yo; /***/ }), -/* 119 */ +/* 120 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -16138,7 +16197,7 @@ return zhCn; /***/ }), -/* 120 */ +/* 121 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -16249,7 +16308,7 @@ return zhHk; /***/ }), -/* 121 */ +/* 122 */ /***/ (function(module, exports, __webpack_require__) { //! moment.js locale configuration @@ -16359,7 +16418,7 @@ return zhTw; /***/ }), -/* 122 */ +/* 123 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -16410,7 +16469,7 @@ const _instance = new Global(); module.exports = { 'Global': _instance }; /***/ }), -/* 123 */ +/* 124 */ /***/ (function(module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! @@ -26670,7 +26729,7 @@ return jQuery; /***/ }), -/* 124 */ +/* 125 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -26686,7 +26745,7 @@ return jQuery; -const { Logger, Utils, PluginManager, BDIpc, WebpackModules, SocketProxy, Global } = __webpack_require__(125); +const { Logger, Utils, PluginManager, BDIpc, WebpackModules, SocketProxy, Global } = __webpack_require__(126); class BetterDiscord { @@ -26703,20 +26762,20 @@ if (window.BetterDiscord) { let bdInstance = new BetterDiscord(); window.BetterDiscord = { 'vendor': { - jQuery: __webpack_require__(123), - $: __webpack_require__(123), + jQuery: __webpack_require__(124), + $: __webpack_require__(124), moment: __webpack_require__(0) } }; } /***/ }), -/* 125 */ +/* 126 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__utils__ = __webpack_require__(126); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__utils__ = __webpack_require__(3); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__utils___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__utils__); /* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0__utils__, "Logger")) __webpack_require__.d(__webpack_exports__, "Logger", function() { return __WEBPACK_IMPORTED_MODULE_0__utils__["Logger"]; }); /* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_0__utils__, "Utils")) __webpack_require__.d(__webpack_exports__, "Utils", function() { return __WEBPACK_IMPORTED_MODULE_0__utils__["Utils"]; }); @@ -26732,7 +26791,7 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__webpackmodules__ = __webpack_require__(133); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__webpackmodules___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4__webpackmodules__); /* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_4__webpackmodules__, "WebpackModules")) __webpack_require__.d(__webpack_exports__, "WebpackModules", function() { return __WEBPACK_IMPORTED_MODULE_4__webpackmodules__["WebpackModules"]; }); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__global__ = __webpack_require__(122); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__global__ = __webpack_require__(123); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__global___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5__global__); /* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_5__global__, "Global")) __webpack_require__.d(__webpack_exports__, "Global", function() { return __WEBPACK_IMPORTED_MODULE_5__global__["Global"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__events__ = __webpack_require__(2); @@ -26750,65 +26809,6 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); -/***/ }), -/* 126 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * BetterDiscord Client Utils Module - * Copyright (c) 2015-present JsSucks - https://github.com/JsSucks - * All rights reserved. - * https://github.com/JsSucks - https://betterdiscord.net - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. -*/ - -const { Module } = __webpack_require__(1); -const moment = __webpack_require__(0); - -const logs = []; - -class Logger { - - static log(module, message, level = 'log') { - level = this.parseLevel(level); - console[level]('[%cBetter%cDiscord:%s] %s', 'color: #3E82E5', '', `${module}${level === 'debug' ? '|DBG' : ''}`, message); - logs.push(`[${moment().format('DD/MM/YY hh:mm:ss')}|${module}|${level}] ${message}`); - window.bdlogs = logs; - } - - static get levels() { - return { - 'log': 'log', - 'warn': 'warn', - 'err': 'error', - 'error': 'error', - 'debug': 'debug', - 'dbg': 'debug', - 'info': 'info' - }; - } - - static parseLevel(level) { - return this.levels.hasOwnProperty(level) ? this.levels[level] : 'log'; - } -} - -class Utils { - - static overload(fn, cb) { - const orig = fn; - return function (...args) { - orig(...args); - cb(...args); - }; - } - -} - -module.exports = { Logger, Utils }; - /***/ }), /* 127 */ /***/ (function(module, exports) { @@ -26842,244 +26842,244 @@ module.exports = function(module) { /***/ (function(module, exports, __webpack_require__) { var map = { - "./af": 3, - "./af.js": 3, - "./ar": 4, - "./ar-dz": 5, - "./ar-dz.js": 5, - "./ar-kw": 6, - "./ar-kw.js": 6, - "./ar-ly": 7, - "./ar-ly.js": 7, - "./ar-ma": 8, - "./ar-ma.js": 8, - "./ar-sa": 9, - "./ar-sa.js": 9, - "./ar-tn": 10, - "./ar-tn.js": 10, - "./ar.js": 4, - "./az": 11, - "./az.js": 11, - "./be": 12, - "./be.js": 12, - "./bg": 13, - "./bg.js": 13, - "./bm": 14, - "./bm.js": 14, - "./bn": 15, - "./bn.js": 15, - "./bo": 16, - "./bo.js": 16, - "./br": 17, - "./br.js": 17, - "./bs": 18, - "./bs.js": 18, - "./ca": 19, - "./ca.js": 19, - "./cs": 20, - "./cs.js": 20, - "./cv": 21, - "./cv.js": 21, - "./cy": 22, - "./cy.js": 22, - "./da": 23, - "./da.js": 23, - "./de": 24, - "./de-at": 25, - "./de-at.js": 25, - "./de-ch": 26, - "./de-ch.js": 26, - "./de.js": 24, - "./dv": 27, - "./dv.js": 27, - "./el": 28, - "./el.js": 28, - "./en-au": 29, - "./en-au.js": 29, - "./en-ca": 30, - "./en-ca.js": 30, - "./en-gb": 31, - "./en-gb.js": 31, - "./en-ie": 32, - "./en-ie.js": 32, - "./en-nz": 33, - "./en-nz.js": 33, - "./eo": 34, - "./eo.js": 34, - "./es": 35, - "./es-do": 36, - "./es-do.js": 36, - "./es-us": 37, - "./es-us.js": 37, - "./es.js": 35, - "./et": 38, - "./et.js": 38, - "./eu": 39, - "./eu.js": 39, - "./fa": 40, - "./fa.js": 40, - "./fi": 41, - "./fi.js": 41, - "./fo": 42, - "./fo.js": 42, - "./fr": 43, - "./fr-ca": 44, - "./fr-ca.js": 44, - "./fr-ch": 45, - "./fr-ch.js": 45, - "./fr.js": 43, - "./fy": 46, - "./fy.js": 46, - "./gd": 47, - "./gd.js": 47, - "./gl": 48, - "./gl.js": 48, - "./gom-latn": 49, - "./gom-latn.js": 49, - "./gu": 50, - "./gu.js": 50, - "./he": 51, - "./he.js": 51, - "./hi": 52, - "./hi.js": 52, - "./hr": 53, - "./hr.js": 53, - "./hu": 54, - "./hu.js": 54, - "./hy-am": 55, - "./hy-am.js": 55, - "./id": 56, - "./id.js": 56, - "./is": 57, - "./is.js": 57, - "./it": 58, - "./it.js": 58, - "./ja": 59, - "./ja.js": 59, - "./jv": 60, - "./jv.js": 60, - "./ka": 61, - "./ka.js": 61, - "./kk": 62, - "./kk.js": 62, - "./km": 63, - "./km.js": 63, - "./kn": 64, - "./kn.js": 64, - "./ko": 65, - "./ko.js": 65, - "./ky": 66, - "./ky.js": 66, - "./lb": 67, - "./lb.js": 67, - "./lo": 68, - "./lo.js": 68, - "./lt": 69, - "./lt.js": 69, - "./lv": 70, - "./lv.js": 70, - "./me": 71, - "./me.js": 71, - "./mi": 72, - "./mi.js": 72, - "./mk": 73, - "./mk.js": 73, - "./ml": 74, - "./ml.js": 74, - "./mr": 75, - "./mr.js": 75, - "./ms": 76, - "./ms-my": 77, - "./ms-my.js": 77, - "./ms.js": 76, - "./mt": 78, - "./mt.js": 78, - "./my": 79, - "./my.js": 79, - "./nb": 80, - "./nb.js": 80, - "./ne": 81, - "./ne.js": 81, - "./nl": 82, - "./nl-be": 83, - "./nl-be.js": 83, - "./nl.js": 82, - "./nn": 84, - "./nn.js": 84, - "./pa-in": 85, - "./pa-in.js": 85, - "./pl": 86, - "./pl.js": 86, - "./pt": 87, - "./pt-br": 88, - "./pt-br.js": 88, - "./pt.js": 87, - "./ro": 89, - "./ro.js": 89, - "./ru": 90, - "./ru.js": 90, - "./sd": 91, - "./sd.js": 91, - "./se": 92, - "./se.js": 92, - "./si": 93, - "./si.js": 93, - "./sk": 94, - "./sk.js": 94, - "./sl": 95, - "./sl.js": 95, - "./sq": 96, - "./sq.js": 96, - "./sr": 97, - "./sr-cyrl": 98, - "./sr-cyrl.js": 98, - "./sr.js": 97, - "./ss": 99, - "./ss.js": 99, - "./sv": 100, - "./sv.js": 100, - "./sw": 101, - "./sw.js": 101, - "./ta": 102, - "./ta.js": 102, - "./te": 103, - "./te.js": 103, - "./tet": 104, - "./tet.js": 104, - "./th": 105, - "./th.js": 105, - "./tl-ph": 106, - "./tl-ph.js": 106, - "./tlh": 107, - "./tlh.js": 107, - "./tr": 108, - "./tr.js": 108, - "./tzl": 109, - "./tzl.js": 109, - "./tzm": 110, - "./tzm-latn": 111, - "./tzm-latn.js": 111, - "./tzm.js": 110, - "./uk": 112, - "./uk.js": 112, - "./ur": 113, - "./ur.js": 113, - "./uz": 114, - "./uz-latn": 115, - "./uz-latn.js": 115, - "./uz.js": 114, - "./vi": 116, - "./vi.js": 116, - "./x-pseudo": 117, - "./x-pseudo.js": 117, - "./yo": 118, - "./yo.js": 118, - "./zh-cn": 119, - "./zh-cn.js": 119, - "./zh-hk": 120, - "./zh-hk.js": 120, - "./zh-tw": 121, - "./zh-tw.js": 121 + "./af": 4, + "./af.js": 4, + "./ar": 5, + "./ar-dz": 6, + "./ar-dz.js": 6, + "./ar-kw": 7, + "./ar-kw.js": 7, + "./ar-ly": 8, + "./ar-ly.js": 8, + "./ar-ma": 9, + "./ar-ma.js": 9, + "./ar-sa": 10, + "./ar-sa.js": 10, + "./ar-tn": 11, + "./ar-tn.js": 11, + "./ar.js": 5, + "./az": 12, + "./az.js": 12, + "./be": 13, + "./be.js": 13, + "./bg": 14, + "./bg.js": 14, + "./bm": 15, + "./bm.js": 15, + "./bn": 16, + "./bn.js": 16, + "./bo": 17, + "./bo.js": 17, + "./br": 18, + "./br.js": 18, + "./bs": 19, + "./bs.js": 19, + "./ca": 20, + "./ca.js": 20, + "./cs": 21, + "./cs.js": 21, + "./cv": 22, + "./cv.js": 22, + "./cy": 23, + "./cy.js": 23, + "./da": 24, + "./da.js": 24, + "./de": 25, + "./de-at": 26, + "./de-at.js": 26, + "./de-ch": 27, + "./de-ch.js": 27, + "./de.js": 25, + "./dv": 28, + "./dv.js": 28, + "./el": 29, + "./el.js": 29, + "./en-au": 30, + "./en-au.js": 30, + "./en-ca": 31, + "./en-ca.js": 31, + "./en-gb": 32, + "./en-gb.js": 32, + "./en-ie": 33, + "./en-ie.js": 33, + "./en-nz": 34, + "./en-nz.js": 34, + "./eo": 35, + "./eo.js": 35, + "./es": 36, + "./es-do": 37, + "./es-do.js": 37, + "./es-us": 38, + "./es-us.js": 38, + "./es.js": 36, + "./et": 39, + "./et.js": 39, + "./eu": 40, + "./eu.js": 40, + "./fa": 41, + "./fa.js": 41, + "./fi": 42, + "./fi.js": 42, + "./fo": 43, + "./fo.js": 43, + "./fr": 44, + "./fr-ca": 45, + "./fr-ca.js": 45, + "./fr-ch": 46, + "./fr-ch.js": 46, + "./fr.js": 44, + "./fy": 47, + "./fy.js": 47, + "./gd": 48, + "./gd.js": 48, + "./gl": 49, + "./gl.js": 49, + "./gom-latn": 50, + "./gom-latn.js": 50, + "./gu": 51, + "./gu.js": 51, + "./he": 52, + "./he.js": 52, + "./hi": 53, + "./hi.js": 53, + "./hr": 54, + "./hr.js": 54, + "./hu": 55, + "./hu.js": 55, + "./hy-am": 56, + "./hy-am.js": 56, + "./id": 57, + "./id.js": 57, + "./is": 58, + "./is.js": 58, + "./it": 59, + "./it.js": 59, + "./ja": 60, + "./ja.js": 60, + "./jv": 61, + "./jv.js": 61, + "./ka": 62, + "./ka.js": 62, + "./kk": 63, + "./kk.js": 63, + "./km": 64, + "./km.js": 64, + "./kn": 65, + "./kn.js": 65, + "./ko": 66, + "./ko.js": 66, + "./ky": 67, + "./ky.js": 67, + "./lb": 68, + "./lb.js": 68, + "./lo": 69, + "./lo.js": 69, + "./lt": 70, + "./lt.js": 70, + "./lv": 71, + "./lv.js": 71, + "./me": 72, + "./me.js": 72, + "./mi": 73, + "./mi.js": 73, + "./mk": 74, + "./mk.js": 74, + "./ml": 75, + "./ml.js": 75, + "./mr": 76, + "./mr.js": 76, + "./ms": 77, + "./ms-my": 78, + "./ms-my.js": 78, + "./ms.js": 77, + "./mt": 79, + "./mt.js": 79, + "./my": 80, + "./my.js": 80, + "./nb": 81, + "./nb.js": 81, + "./ne": 82, + "./ne.js": 82, + "./nl": 83, + "./nl-be": 84, + "./nl-be.js": 84, + "./nl.js": 83, + "./nn": 85, + "./nn.js": 85, + "./pa-in": 86, + "./pa-in.js": 86, + "./pl": 87, + "./pl.js": 87, + "./pt": 88, + "./pt-br": 89, + "./pt-br.js": 89, + "./pt.js": 88, + "./ro": 90, + "./ro.js": 90, + "./ru": 91, + "./ru.js": 91, + "./sd": 92, + "./sd.js": 92, + "./se": 93, + "./se.js": 93, + "./si": 94, + "./si.js": 94, + "./sk": 95, + "./sk.js": 95, + "./sl": 96, + "./sl.js": 96, + "./sq": 97, + "./sq.js": 97, + "./sr": 98, + "./sr-cyrl": 99, + "./sr-cyrl.js": 99, + "./sr.js": 98, + "./ss": 100, + "./ss.js": 100, + "./sv": 101, + "./sv.js": 101, + "./sw": 102, + "./sw.js": 102, + "./ta": 103, + "./ta.js": 103, + "./te": 104, + "./te.js": 104, + "./tet": 105, + "./tet.js": 105, + "./th": 106, + "./th.js": 106, + "./tl-ph": 107, + "./tl-ph.js": 107, + "./tlh": 108, + "./tlh.js": 108, + "./tr": 109, + "./tr.js": 109, + "./tzl": 110, + "./tzl.js": 110, + "./tzm": 111, + "./tzm-latn": 112, + "./tzm-latn.js": 112, + "./tzm.js": 111, + "./uk": 113, + "./uk.js": 113, + "./ur": 114, + "./ur.js": 114, + "./uz": 115, + "./uz-latn": 116, + "./uz-latn.js": 116, + "./uz.js": 115, + "./vi": 117, + "./vi.js": 117, + "./x-pseudo": 118, + "./x-pseudo.js": 118, + "./yo": 119, + "./yo.js": 119, + "./zh-cn": 120, + "./zh-cn.js": 120, + "./zh-hk": 121, + "./zh-hk.js": 121, + "./zh-tw": 122, + "./zh-tw.js": 122 }; function webpackContext(req) { return __webpack_require__(webpackContextResolve(req)); @@ -27606,7 +27606,8 @@ function isUndefined(arg) { const { Events } = __webpack_require__(2); const { Module } = __webpack_require__(1); -const { Global } = __webpack_require__(122); +const { Global } = __webpack_require__(123); +const { Utils } = __webpack_require__(3); class SocketProxy extends Module { @@ -27616,12 +27617,29 @@ class SocketProxy extends Module { bindings() { this.socketCreated = this.socketCreated.bind(this); - window.test = this; + this.onmessage = this.onmessage.bind(this); } socketCreated() { - console.log('SOCKET CREATED!'); - console.log(Global.getObject('wsHook')); + const wsHook = Global.getObject('wsHook'); + + //TODO make this better and bind other events + const onMessageHook = setInterval(() => { + if (wsHook.onmessage !== null) { + clearInterval(onMessageHook); + //Discord sets onmessage twice so a timeout for now + setTimeout(() => { + wsHook.onmessage = Utils.overload(wsHook.onmessage, this.onmessage); + }, 2000); + } + }, 100); + } + + onmessage(e) { + console.log(e); + //TODO fix unpacking + const unpacked = this.erlpack.unpack(e.data); + console.log(unpacked); } get erlpack() { diff --git a/client/src/index.js b/client/src/index.js index 094025ce..bea87d48 100644 --- a/client/src/index.js +++ b/client/src/index.js @@ -16,6 +16,7 @@ class BetterDiscord { constructor() { Global.first(); + window.bdUtils = Utils; } } diff --git a/client/src/modules/discordsocket.js b/client/src/modules/discordsocket.js index b4bbc683..ea32fc47 100644 --- a/client/src/modules/discordsocket.js +++ b/client/src/modules/discordsocket.js @@ -11,6 +11,7 @@ const { Events } = require('./events'); const { Module } = require('./modulebase'); const { Global } = require('./global'); +const { Utils } = require('./utils'); class SocketProxy extends Module { @@ -20,12 +21,29 @@ class SocketProxy extends Module { bindings() { this.socketCreated = this.socketCreated.bind(this); - window.test = this; + this.onmessage = this.onmessage.bind(this); } socketCreated() { - console.log('SOCKET CREATED!'); - console.log(Global.getObject('wsHook')); + const wsHook = Global.getObject('wsHook'); + + //TODO make this better and bind other events + const onMessageHook = setInterval(() => { + if (wsHook.onmessage !== null) { + clearInterval(onMessageHook); + //Discord sets onmessage twice so a timeout for now + setTimeout(() => { + wsHook.onmessage = Utils.overload(wsHook.onmessage, this.onmessage); + }, 2000); + } + }, 100); + } + + onmessage(e) { + console.log(e); + //TODO fix unpacking + const unpacked = this.erlpack.unpack(e.data); + console.log(unpacked); } get erlpack() {