Apps Home
|
Create an App
testappjim
Author:
jimdev
Description
Source Code
Launch App
Current Users
Created by:
Jimdev
(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.App = void 0; var _Commands = require("./Commands"); var _PubSub = require("./PubSub"); var _Settings = require("./Settings"); var _globals = require("./globals"); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } var App = function App(api) { var _this = this; _classCallCheck(this, App); _defineProperty(this, "run", function () { _this.api.settings_choices = _this.settings.get(); }); _defineProperty(this, "register", function (plugin) { _this.commands.register(plugin); _this.settings.register(plugin); _this.plugins.push(plugin); return _this; }); _defineProperty(this, "pubSub", function () { _this.api.onStart(function (user) { _PubSub.pubSub.publish('botStart', user); }); _this.api.onTip(function (tip) { _PubSub.pubSub.publish('newTip', tip); }); _this.api.onEnter(function (user) { _PubSub.pubSub.publish('userEnter', user); }); _this.api.onLeave(function (user) { _PubSub.pubSub.publish('userLeave', user); }); _this.api.onMessage(function (msg) { _this.commands.handleMsg(msg); _PubSub.pubSub.publish('newMsg', msg); }); _this.api.onFollow(function (user) { _PubSub.pubSub.publish('newFollow', user); }); _this.api.onUnFollow(function (user) { _PubSub.pubSub.publish('unFollow', user); }); }); this.api = api; this.settings = new _Settings.SettingsHandler(this.api); this.commands = new _Commands.Commands(this.api); this.global = new _globals.Global(this.api); this.plugins = []; this.pubSub(); }; exports.App = App; },{"./Commands":2,"./PubSub":4,"./Settings":5,"./globals":8}],2:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Commands = void 0; var _Error = require("./Error"); function _toArray(arr) { return _arrayWithHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableRest(); } function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); } function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } var Commands = function Commands(api) { var _this = this; _classCallCheck(this, Commands); _defineProperty(this, "register", function (obj) { if (!obj.commands) { return _this; } for (var command in obj.commands) { _this.commands[command] = obj.commands[command]; } return _this; }); _defineProperty(this, "get", function () { return _this.commands; }); _defineProperty(this, "getRole", function (msg) { if (msg.user === _this.api.room_slug) { return 'host'; } if (msg.is_mod) { return 'mod'; } return 'user'; }); _defineProperty(this, "handleMsg", function (msg) { if (msg.m.charAt(0) !== '/') return msg; msg['X-Spam'] = true; var message = msg.m.split(' '); var _message = _toArray(message), command = _message[0], params = _message.slice(1); command = command.toLowerCase().substr(1); // params = (params = []) => { // if (params) params.map((param) => param.toLowerCase()); // }; var role = _this.getRole(msg); _this.execute({ command: command, params: params, role: role, msg: msg }); return msg; }); _defineProperty(this, "getCommand", function (command) { if (_this.commands.hasOwnProperty(command)) { return _this.commands[command]; } }); _defineProperty(this, "execute", function (_ref) { var command = _ref.command, _ref$params = _ref.params, params = _ref$params === void 0 ? [] : _ref$params, role = _ref.role, msg = _ref.msg; if (!_this.getCommand(command)) return; var cmd = _this.getCommand(command); if (cmd.permission === 'host' && role !== 'host') { _this.error.permission(msg); return; } if (cmd.permission === 'mod' && (role !== 'mod' || role !== 'host')) { _this.error.permission(msg); return; } // if params match those in cmd.params cmd.func(params, msg); }); this.api = api; this.error = new _Error.Error(api); this.commands = {}; }; exports.Commands = Commands; },{"./Error":3}],3:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Error = void 0; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } var Error = function Error(api) { var _this = this; _classCallCheck(this, Error); _defineProperty(this, "permission", function (msg) { var bg = "#f44336"; var message = "\uD83D\uDED1 You do not have permission to run that command \uD83D\uDED1"; _this.api.sendNotice(message, msg.user, bg, _this.txt); }); _defineProperty(this, "invalid", function (msg) { var bg = "#f44336"; var message = "\uD83D\uDED1 That is an invalid command \uD83D\uDED1"; _this.api.sendNotice(message, msg.user, bg, _this.txt); }); this.api = api; this.txt = '#ffffff'; }; exports.Error = Error; },{}],4:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.pubSub = void 0; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } var PubSub = function PubSub() { var _this = this; _classCallCheck(this, PubSub); _defineProperty(this, "subscribe", function (evName, fn) { _this.events[evName] = _this.events[evName] || []; _this.events[evName].push(fn); }); _defineProperty(this, "unsubscribe", function (evName, fn) { if (_this.events[evName]) { _this.events[evName] = _this.events[evName].filter(function (func) { return func !== fn; }); } }); _defineProperty(this, "publish", function (evName, data) { if (_this.events[evName]) { _this.events[evName].forEach(function (func) { return func(data); }); } }); this.events = {}; }; var pubSub = new PubSub(); exports.pubSub = pubSub; },{}],5:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.SettingsHandler = void 0; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } /** * In each plugin call App.settings.register? */ var SettingsHandler = function SettingsHandler(api) { var _this = this; _classCallCheck(this, SettingsHandler); _defineProperty(this, "register", function (obj) { var settings = obj.settings; if (!settings || settings.constructor !== Array) { return _this; } settings.forEach(function (setting) { _this.settings.push(setting); }); return _this; }); _defineProperty(this, "get", function () { return _this.settings; }); this.api = api; this.settings = []; }; exports.SettingsHandler = SettingsHandler; },{}],6:[function(require,module,exports){ "use strict"; function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } Object.defineProperty(exports, "__esModule", { value: true }); exports.TipUser = exports.User = exports.CbUser = void 0; function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } var CbUser = function CbUser(user) { var _this = this; var _options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; _classCallCheck(this, CbUser); _defineProperty(this, "updateCbData", function () { var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; _this.in_fanclub = options.in_fanclub || _this.in_fanclub; _this.has_tokens = options.has_tokens || _this.has_tokens; _this.is_mod = options.is_mod || _this.is_mod; _this.tipped_recently = options.tipped_recently || _this.tipped_recently; _this.tipped_alot_recently = options.tipped_alot_recently || _this.tipped_alot_recently; _this.tipped_tons_recently = options.tipped_tons_recently || _this.tipped_tons_recently; _this.gender = options.gender || _this.gender; return _this; }); _defineProperty(this, "setColor", function (color) { _this.color = color; return _this; }); this.user = user; this.in_fanclub = _options.in_fanclub; this.has_tokens = _options.has_tokens; this.is_mod = _options.is_mod; this.tipped_recently = _options.tipped_recently; this.tipped_alot_recently = _options.tipped_alot_recently; this.tipped_tons_recently = _options.tipped_tons_recently; this.gender = _options.gender; this.color = null; }; exports.CbUser = CbUser; var User = /*#__PURE__*/function (_CbUser) { _inherits(User, _CbUser); var _super = _createSuper(User); function User(user, options) { var _this2; _classCallCheck(this, User); _this2 = _super.call(this, user, options); _defineProperty(_assertThisInitialized(_this2), "updateTips", function (cbTip) { _this2.numTips += 1; var amount = parseInt(cbTip.amount); if (_this2.total_tips == null) { _this2.total_tips = amount; } else { _this2.total_tips += amount; } if (_this2.highest_tip == null) { _this2.highest_tip = amount; } else { if (amount > _this2.highest_tip) { _this2.highest_tip = amount; } } return _assertThisInitialized(_this2); }); _defineProperty(_assertThisInitialized(_this2), "setEnterData", function () { if (!_this2.timeEnter) { _this2.timeEnter = new Date(); _this2.enterTimestamp = Date.now(); } _this2.lastTimeEnter = new Date(); _this2.lastEnterTimestamp = Date.now(); _this2.inRoom = true; return _assertThisInitialized(_this2); }); _defineProperty(_assertThisInitialized(_this2), "setLeaveData", function () { _this2.timeLeave = new Date(); _this2._timeInRoom += Date.now() - _this2.lastEnterTimestamp; _this2.inRoom = false; return _assertThisInitialized(_this2); }); _defineProperty(_assertThisInitialized(_this2), "getTimeInRoom", function () { if (_this2.inRoom === false) { var tir = Math.floor(_this2._timeInRoom / 60000); return tir; } else { var _tir = _this2._timeInRoom + (Date.now() - _this2.lastEnterTimestamp); _tir = Math.floor(_tir / 60000); return _tir; } }); _defineProperty(_assertThisInitialized(_this2), "getTimeSinceTip", function () { var str = "No tips"; if (_this2.lastTipTime !== null) { var now = Date.now(); var result = Math.floor((now - _this2.lastTipTime) / 60000); str = "".concat(result, " min ago"); } return str; }); _this2.total_tips = 0; _this2.highest_tip = 0; _this2.numTips = 0; _this2.lastTipTime = null; _this2.timeEnter = null; _this2.enterTimestamp = null; _this2.lastTimeEnter = null; _this2.lastEnterTimestamp = null; _this2.timeLeave = null; _this2.inRoom = false; _this2._timeInRoom = 0; // do not access directly return _this2; } return User; }(CbUser); exports.User = User; var TipUser = function TipUser(userName) { var _this3 = this; _classCallCheck(this, TipUser); _defineProperty(this, "updateTips", function (cbTip) { if (cbTip.is_anon) return; var amount = parseInt(cbTip.amount); if (_this3.total_tips == null) { _this3.total_tips = amount; } else { _this3.total_tips += amount; } if (_this3.highest_tip == null) { _this3.highest_tip = amount; } else { if (amount > _this3.highest_tip) { _this3.highest_tip = amount; } } return _this3; }); this.user = userName; this.total_tips = 0; this.highest_tip = 0; this.anonTips = 0; }; exports.TipUser = TipUser; },{}],7:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.design = exports.lbStyle = exports.ch = exports.strFormat = void 0; var strFormat = function strFormat(str) { str = str.split(''); for (var i = 0; i < str.length; i++) { if (font2.hasOwnProperty(str[i])) { str[i] = font2[str[i]]; } } str = str.join(''); return str; }; exports.strFormat = strFormat; var ch = { s: "\u205F", sp: "\u205F" + "\u205F", star: "\u22C6", audrey1: "\u2727", audrey2: "\u27E1", tiny: "\uD83D\uDF9D" }; exports.ch = ch; var lbStyle = { head1: "\u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 \u22C6\u22C5\u2726\u22C5\u22C6 \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510", foot1: "\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 \u22C6\u22C5\u2726\u22C5\u22C6 \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518", head2: "\u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 \u22C6 \u22C5\u265B\u22C5 \u22C6 \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510", foot2: "\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 \u22C6 \u22C5\u265B\u22C5 \u22C6 \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518" }; exports.lbStyle = lbStyle; var design = { head1: "\u2550\u2550\u2550\u2550\u2550\u2550 \u2218\u25E6\u2740\u25E6\u2218 \u2550\u2550\u2550\u2550\u2550\u2550", head2: "\u2661\u2501\u2501\u2501\u2501\u2501\u2501 \u25E6 \u2724 \u25E6 \u2501\u2501\u2501\u2501\u2501\u2501\u2661", head3: "\u2727\u2500\u2500\u2500 \uFF65 \uFF61\uFF9F\u2605: *.\u2726 .* :\u2605. \u2500\u2500\u2500\u2727", head4: "\u2501\u2501\u2501\u2501\u2501\u2501\u2661\u2665\u2661\u2501\u2501\u2501\u2501\u2501\u2501", head5: "\u2606\u2550\u2550\u2550\u2550 \u22C6\u2605\u22C6 \u2550\u2550\u2550\u2550\u2606", head6: "\u02DA*\uFF0A\u273F\u2740\u0F13\u2740\u273F\uFF0A*\u02DA", head7: "\u2501\u25E6\u25CB\u25E6\u2501\u25E6\u25CB\u25E6\u2501\u25E6\u25CB\u25E6\u2501\u25E6\u25CB\u25E6\u2501\u25E6\u25CB\u25E6\u2501\u25E6\u25CB\u25E6\u2501", head8: "\u2550\u2550\u2550\u2550\u2550\u2550\u272E\u2741\u2022\xB0\u265B\xB0\u2022\u2741\u272E \u2550\u2550\u2550\u2550\u2550\u2550" }; // Monospaced // 𝚊𝚋𝚌𝚍𝚎𝚏𝚐𝚑𝚒𝚓𝚔𝚕𝚖𝚗𝚘𝚙𝚚𝚛𝚜𝚝𝚞𝚟𝚠𝚡𝚢𝚣 // 𝙰𝙱𝙲𝙳𝙴𝙵𝙶𝙷𝙸𝙹𝙺𝙻𝙼𝙽𝙾𝙿𝚀𝚁𝚂𝚃𝚄𝚅𝚆𝚇𝚈𝚉 // 𝟷𝟸𝟹𝟺𝟻𝟼𝟽𝟾𝟿𝟶 exports.design = design; var monospace = { A: "\uD835\uDE70", B: "\uD835\uDE71", C: "\uD835\uDE72", D: "\uD835\uDE73", E: "\uD835\uDE74", F: "\uD835\uDE75", G: "\uD835\uDE76", H: "\uD835\uDE77", I: "\uD835\uDE78", J: "\uD835\uDE79", K: "\uD835\uDE7A", L: "\uD835\uDE7B", M: "\uD835\uDE7C", N: "\uD835\uDE7D", O: "\uD835\uDE7E", P: "\uD835\uDE7F", Q: "\uD835\uDE80", R: "\uD835\uDE81", S: "\uD835\uDE82", T: "\uD835\uDE83", U: "\uD835\uDE84", V: "\uD835\uDE85", W: "\uD835\uDE86", X: "\uD835\uDE87", Y: "\uD835\uDE88", Z: "\uD835\uDE89", a: "\uD835\uDE8A", b: "\uD835\uDE8B", c: "\uD835\uDE8C", d: "\uD835\uDE8D", e: "\uD835\uDE8E", f: "\uD835\uDE8F", g: "\uD835\uDE90", h: "\uD835\uDE91", i: "\uD835\uDE92", j: "\uD835\uDE93", k: "\uD835\uDE94", l: "\uD835\uDE95", m: "\uD835\uDE96", n: "\uD835\uDE97", o: "\uD835\uDE98", p: "\uD835\uDE99", q: "\uD835\uDE9A", r: "\uD835\uDE9B", s: "\uD835\uDE9C", t: "\uD835\uDE9D", u: "\uD835\uDE9E", v: "\uD835\uDE9F", w: "\uD835\uDEA0", x: "\uD835\uDEA1", y: "\uD835\uDEA2", z: "\uD835\uDEA3", 1: "\uD835\uDFF7", 2: "\uD835\uDFF8", 3: "\uD835\uDFF9", 4: "\uD835\uDFFA", 5: "\uD835\uDFFB", 6: "\uD835\uDFFC", 7: "\uD835\uDFFD", 8: "\uD835\uDFFE", 9: "\uD835\uDFFF", 0: "\uD835\uDFF6" }; // Bold Sans Serif // 𝗔𝗕𝗖𝗗𝗘𝗙𝗚𝗛𝗜𝗝𝗞𝗟𝗠𝗡𝗢𝗣𝗤𝗥𝗦𝗧𝗨𝗩𝗪𝗫𝗬𝗭 // 𝗮𝗯𝗰𝗱𝗲𝗳𝗴𝗵𝗶𝗷𝗸𝗹𝗺𝗻𝗼𝗽𝗾𝗿𝘀𝘁𝘂𝘃𝘄𝘅𝘆𝘇 // 𝟭𝟮𝟯𝟰𝟱𝟲𝟳𝟴𝟵𝟬 var font2 = { A: "\uD835\uDDD4", B: "\uD835\uDDD5", C: "\uD835\uDDD6", D: "\uD835\uDDD7", E: "\uD835\uDDD8", F: "\uD835\uDDD9", G: "\uD835\uDDDA", H: "\uD835\uDDDB", I: "\uD835\uDDDC", J: "\uD835\uDDDD", K: "\uD835\uDDDE", L: "\uD835\uDDDF", M: "\uD835\uDDE0", N: "\uD835\uDDE1", O: "\uD835\uDDE2", P: "\uD835\uDDE3", Q: "\uD835\uDDE4", R: "\uD835\uDDE5", S: "\uD835\uDDE6", T: "\uD835\uDDE7", U: "\uD835\uDDE8", V: "\uD835\uDDE9", W: "\uD835\uDDEA", X: "\uD835\uDDEB", Y: "\uD835\uDDEC", Z: "\uD835\uDDED", a: "\uD835\uDDEE", b: "\uD835\uDDEF", c: "\uD835\uDDF0", d: "\uD835\uDDF1", e: "\uD835\uDDF2", f: "\uD835\uDDF3", g: "\uD835\uDDF4", h: "\uD835\uDDF5", i: "\uD835\uDDF6", j: "\uD835\uDDF7", k: "\uD835\uDDF8", l: "\uD835\uDDF9", m: "\uD835\uDDFA", n: "\uD835\uDDFB", o: "\uD835\uDDFC", p: "\uD835\uDDFD", q: "\uD835\uDDFE", r: "\uD835\uDDFF", s: "\uD835\uDE00", t: "\uD835\uDE01", u: "\uD835\uDE02", v: "\uD835\uDE03", w: "\uD835\uDE04", x: "\uD835\uDE05", y: "\uD835\uDE06", z: "\uD835\uDE07", 1: "\uD835\uDFED", 2: "\uD835\uDFEE", 3: "\uD835\uDFEF", 4: "\uD835\uDFF0", 5: "\uD835\uDFF1", 6: "\uD835\uDFF2", 7: "\uD835\uDFF3", 8: "\uD835\uDFF4", 9: "\uD835\uDFF5", 0: "\uD835\uDFEC" }; // 🅰🅱🅲🅳🅴🅵🅶🅷🅸🅹🅺🅻🅼🅽🅾🅿🆀🆁🆂🆃🆄🆅🆆🆇🆈🆉 // 🅐🅑🅒🅓🅔🅕🅖🅗🅘🅙🅚🅛🅜🅝🅞🅟🅠🅡🅢🅣🅤🅥🅦🅧🅨🅩 // Full Width // ABCDEFGHIJKLMNOPQRSTUVWXYZ // abcdefghijklmnopqrstuvwxyz // 1234567890 // Sans Serif // 𝖠𝖡𝖢𝖣𝖤𝖥𝖦𝖧𝖨𝖩𝖪𝖫𝖬𝖭𝖮𝖯𝖰𝖱𝖲𝖳𝖴𝖵𝖶𝖷𝖸𝖹 // 𝖺𝖻𝖼𝖽𝖾𝖿𝗀𝗁𝗂𝗃𝗄𝗅𝗆𝗇𝗈𝗉𝗊𝗋𝗌𝗍𝗎𝗏𝗐𝗑𝗒𝗓 // 𝟣𝟤𝟥𝟦𝟧𝟨𝟩𝟪𝟫𝟢 },{}],8:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Global = void 0; var _PubSub = require("./PubSub"); var _util = require("./util"); var _User = require("./User"); function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } var Global = function Global(api) { var _this = this; _classCallCheck(this, Global); _defineProperty(this, "onStart", function (user) { _this.api.setTimeout(_this.createUserOnStart, 5000); }); _defineProperty(this, "onEnter", function (user) { _this.updateUserOnEnter(user); }); _defineProperty(this, "onLeave", function (user) { _this.updateUserOnLeave(user); }); _defineProperty(this, "onMessage", function (msg) {}); _defineProperty(this, "onFollow", function (user) { _this.newFollower(user); }); _defineProperty(this, "onUnfollow", function (user) { _this.newUnfollower(user); }); _defineProperty(this, "newFollower", function (user) { if (!_this.newFollows.includes(user.user)) { _this.newFollows.push(user.user); } if (_this.unFollows.includes(user.user)) { _util.util.removeFromArr(user.user, _this.unFollows); } }); _defineProperty(this, "newUnfollower", function (user) { if (_this.newFollows.includes(user.user)) { _util.util.removeFromArr(user.user, _this.newFollows); } _this.unFollows.push(user.user); }); _defineProperty(this, "createUserOnStart", function () { _this.api.getRoomUsersData(function (usersData) { if (usersData.success) { usersData.data.dark_purple.forEach(function (name) { _this.updateUserOnEnter({ user: name, tipped_tons_recently: true }); }); usersData.data.light_purple.forEach(function (name) { _this.updateUserOnEnter({ user: name, tipped_alot_recently: true }); }); usersData.data.dark_blue.forEach(function (name) { _this.updateUserOnEnter({ user: name, tipped_recently: true }); }); usersData.data.light_blue.forEach(function (name) { _this.updateUserOnEnter({ user: name, tipped_recently: false }); }); usersData.data.grey.forEach(function (name) { _this.updateUserOnEnter({ user: name, tipped_recently: false }); }); usersData.data.fanclub.forEach(function (name) { _this.updateUserOnEnter({ user: name, in_fanclub: true, tipped_recently: true }); }); usersData.data.moderator.forEach(function (name) { _this.updateUserOnEnter({ user: name, is_mod: true }); }); } }); }); _defineProperty(this, "updateUserOnEnter", function (cbUser) { if (cbUser.user === cb.room_slug) return; var user = cbUser.user, rest = _objectWithoutProperties(cbUser, ["user"]); var roomUser = _util.util.getUserByName(user, _this.currentUsers); if (roomUser) { roomUser.updateCbData(rest).setColor(_this.getColor(roomUser)); _this.currentUsers.push(roomUser); } else { var newUser = new _User.CbUser(user, rest); newUser.setColor(_this.getColor(newUser)); _this.currentUsers.push(newUser); } }); _defineProperty(this, "getColor", function (roomUser) { if (roomUser.tipped_tons_recently) { return 'Dark Purple'; } else if (roomUser.tipped_alot_recently) { return 'Purple'; } else if (roomUser.tipped_recently) { return 'Dark Blue'; } else if (roomUser.has_tokens && roomUser.tipped_recently == false) { return 'Light Blue'; } else { return 'Grey'; } }); _defineProperty(this, "updateUserOnLeave", function (cbUser) { if (cbUser.user === cb.room_slug) return; var roomUser = _util.util.getUserByName(cbUser.user, _this.currentUsers); _util.util.removeFromArr(roomUser, _this.currentUsers); }); this.api = api; this.currentUsers = []; this.newFollows = []; this.unFollows = []; this.mods = []; this.fans = []; this.nice = []; // this.onStart(); _PubSub.pubSub.subscribe('botStart', this.onStart); _PubSub.pubSub.subscribe('userEnter', this.onEnter); _PubSub.pubSub.subscribe('userLeave', this.onLeave); _PubSub.pubSub.subscribe('newMessage', this.onMessage); _PubSub.pubSub.subscribe('newFollow', this.onFollow); _PubSub.pubSub.subscribe('unFollow', this.onUnfollow); }; exports.Global = Global; },{"./PubSub":4,"./User":6,"./util":9}],9:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.bot = exports.util = void 0; var util = { getUserByName: function getUserByName(userName, arr) { if (arr.some(function (obj) { return obj.user === userName; })) { return arr.find(function (obj) { return obj.user === userName; }); } else return false; }, // createUserOnStart() { // cb.getRoomUsersData((usersData) => { // if (usersData.success) { // usersData.data.dark_purple.forEach((name) => { // this.updateUserOnEnter({ user: name, tipped_tons_recently: true }); // }); // usersData.data.light_purple.forEach((name) => { // this.updateUserOnEnter({ user: name, tipped_alot_recently: true }); // }); // usersData.data.dark_blue.forEach((name) => { // this.updateUserOnEnter({ user: name, tipped_recently: true }); // }); // usersData.data.light_blue.forEach((name) => { // this.updateUserOnEnter({ user: name, tipped_recently: false }); // }); // usersData.data.grey.forEach((name) => { // this.updateUserOnEnter({ user: name, tipped_recently: false }); // }); // usersData.data.fanclub.forEach((name) => { // this.updateUserOnEnter({ user: name, in_fanclub: true, tipped_recently: true }); // }); // usersData.data.moderator.forEach((name) => { // this.updateUserOnEnter({ user: name, is_mod: true }); // }); // } // }); // }, removeFromArr: function removeFromArr(roomUser, arr) { var index = arr.indexOf(roomUser); arr.splice(index, 1); }, strRepeat: function strRepeat(str, times) { return times > 0 ? str.repeat(times) : ''; }, //calulate line length to put spaces calcSpace: function calcSpace(str, line) { var strlen = str.length; var res = line - strlen; // res = res / 2; return res; }, // merge two above calcLen: function calcLen(str, len) { var sp = "\u205F" + "\u205F"; return this.strRepeat(sp, this.calcSpace(str, len)); }, //calculate the length of string to remove the word "notice from notices" calcPer: function calcPer(str) { var len = str.length; var notice = 7; var percent = notice / len * 100; return "".concat(percent, "%"); }, /** * Time related functions */ formatTime: function formatTime(date) { var hours = date.getHours(); var mins = date.getMinutes(); hours = util.addLeadingZeros(hours); mins = util.addLeadingZeros(mins); return "".concat(hours, ":").concat(mins); }, addLeadingZeros: function addLeadingZeros(n) { if (n <= 9) { return '0' + n; } return n; }, formatName: function formatName(name) { if (name === '') { return '---'; } else { return name.substring(0, 15); } } }; exports.util = util; var bot = { name: "Bot 3000", version: "0.0.1" }; exports.bot = bot; },{}],10:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.app = void 0; var _App = require("./core/App"); var _Commands = require("./core/Commands"); var _Error = require("./core/Error"); var _Settings = require("./core/Settings"); var _PubSub = require("./core/PubSub"); var _fonts = require("./core/fonts"); var _StatsPlugin = require("./plugins/Data/StatsPlugin"); var _Leaderboard = require("./plugins/Leaderboard"); var _RotatingNotices = require("./plugins/RotatingNotices"); var _Follower = require("./plugins/Follower"); var _EnterMsg = require("./plugins/EnterMsg"); var _PrivateNotice = require("./plugins/PrivateNotice"); var _util = require("./core/util"); // Core Modules // Plugins // Utilities // App initialize var app = new _App.App(cb); exports.app = app; app.register(new _StatsPlugin.Stats(cb)); app.register(new _Leaderboard.LB(cb)); app.register(new _RotatingNotices.RotatingNotices(cb)); app.register(new _Follower.NewFollower(cb)); app.register(new _EnterMsg.EnterMsg(cb)); app.register(new _PrivateNotice.PrivateNotices(cb)); app.run(); },{"./core/App":1,"./core/Commands":2,"./core/Error":3,"./core/PubSub":4,"./core/Settings":5,"./core/fonts":7,"./core/util":9,"./plugins/Data/StatsPlugin":13,"./plugins/EnterMsg":16,"./plugins/Follower":17,"./plugins/Leaderboard":18,"./plugins/PrivateNotice":19,"./plugins/RotatingNotices":20}],11:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.NonTippers = void 0; var _util = require("../../core/util"); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } var NonTippers = function NonTippers(api, parent) { var _this = this; _classCallCheck(this, NonTippers); _defineProperty(this, "initNonTippers", function () { if (cb.settings.turnNoTipOn === 'Yes') { _this.updateNonTipArr(); cb.setTimeout(_this.initNonTippers, 60000); } }); _defineProperty(this, "updateNonTipArr", function () { if (_this.parent.userData.currentUsers.length < 1) return; if (_this.nonTipArr.length > 0) { _this.nonTipArr.forEach(function (user) { if (user.total_tips > 0 || user.inRoom == false) _util.util.removeFromArr(user, _this.nonTipArr); }); } _this.parent.userData.currentUsers.forEach(function (user) { if (user.total_tips < 1 && user.has_tokens === true && user.getTimeInRoom() >= cb.settings.noTipTime) { if (cb.settings.turnNoTipOn === 'Yes' && !_this.nonTipArr.includes(user)) _this.sendNoticeToHost(user); if (cb.settings.notifyNonTipper === 'Yes' && cb.settings.nonTipMsg.length > 1 && !_this.nonTipArr.includes(user)) { _this.sendNoticeToUser(user); } if (!_this.nonTipArr.includes(user)) _this.nonTipArr.push(user); } }); }); _defineProperty(this, "sendNoticeToHost", function (user) { var str = "\u2022 Hi ".concat(cb.room_slug, ". ").concat(user.user, " has tokens and has been watching for over ").concat(cb.settings.noTipTime, " mins without tipping."); cb.sendNotice(str, cb.room_slug); }); _defineProperty(this, "sendNoticeToUser", function (user) { var str = "\u2022 Private notice from ".concat(cb.room_slug, ": ").concat(cb.settings.nonTipMsg); cb.sendNotice(str, user.user); }); _defineProperty(this, "sendList", function () { var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; var msg = arguments.length > 1 ? arguments[1] : undefined; var str = "\u2022 These users have tokens and have not tipped\n"; if (_this.nonTipArr.length < 1) { str += "\u2022 No non tippers to list\n"; } else { _this.nonTipArr.forEach(function (user) { str += "\u2022 ".concat(user.user, " \u2022 Time Viewing: ").concat(user.getTimeInRoom(), " min\n"); }); } str = str.substr(0, str.length - 1); _this.api.sendNotice(str, cb.room_slug); }); _defineProperty(this, "rotateList", function () { if (_this.api.settings.listNonTippers === 'Yes') { _this.sendList(); _this.api.setTimeout(_this.rotateList, _this.api.settings.nonTipRotate * 60000); } }); _defineProperty(this, "addCommands", function () { var commands = { notip: { func: _this.sendList, permission: 'host', description: 'View the list people who have not tipped in your set amount of time', params: [] } }; return commands; }); _defineProperty(this, "addSettings", function () { var settings = [{ name: 'statBot', label: _util.util.strRepeat("-", 110) + " STATS AND NOTIFICATIONS " + _util.util.strRepeat("-", 139), type: 'choice', choice1: 'N/A', defaultValue: 'N/A' }, { name: 'turnNoTipOn', label: "Would you like a notice if users have tokens but have not tipped?", type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes' }, { name: 'noTipTime', label: "After how many minutes do you want to be notified if a user has not tipped?\n This is based on the users actual viewing time.", type: 'int', minValue: 1, maxValue: 120, defaultValue: 20 }, { name: 'notifyNonTipper', label: "Would you like to send a private notice to the non tipper?", type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'No' }, { name: 'nonTipMsg', label: 'Message to send to non tippers', type: 'str', required: false }, { name: 'listNonTippers', label: 'Would you like a regular notice of users who have not tipped in your set time?', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes' }, { name: 'nonTipRotate', label: 'How often would you like this notice?', type: 'int', minValue: 1, maxValue: 120, defaultValue: 20 }]; // settings.forEach((setting) => { // cb.settings_choices.push(setting); // }); return settings; }); this.api = api; this.parent = parent; this.nonTipArr = []; this.settings = this.addSettings(); this.commands = this.addCommands(); this.initNonTippers(); this.api.setTimeout(this.rotateList, this.api.settings.nonTipRotate * 60000); }; exports.NonTippers = NonTippers; },{"../../core/util":9}],12:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.RoomStats = void 0; var _Tips = require("./Tips"); var _PubSub = require("../../core/PubSub"); function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); } function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } var RoomStats = function RoomStats(api, parent) { var _this = this; _classCallCheck(this, RoomStats); _defineProperty(this, "updateOnStart", function () { _this.getTotalFollowers(); _this.startTime = new Date(); _this.startTimestamp = Date.now(); }); _defineProperty(this, "updateOnEnter", function (user) { _this.calcPeakViewers(); }); _defineProperty(this, "updateOnFollow", function (user) { _this.getTotalFollowers(); }); _defineProperty(this, "updateOnUnFollow", function (user) { _this.getTotalFollowers(); }); _defineProperty(this, "updateOnTip", function (tip) { _this.tips.updateOnTip(tip); }); _defineProperty(this, "calcPeakViewers", function () { var currentNum = _this.parent.userData.currentUsers.length; if (currentNum > _this.peakViewers) { _this.peakViewers = currentNum; } }); _defineProperty(this, "calcTipsPerUser", function () { if (_this.tips.tips.length < 1) return 0; var arr = _this.parent.userData.totalUsers.map(function (user) { return user.color !== 'Grey'; }); var tipsPerViewer = Math.floor(_this.tips.total_tips / arr.length); return tipsPerViewer; }); _defineProperty(this, "calcNumTippers", function () { var tipNames = _this.tips.tips.map(function (user) { return user.user; }); var numTippers = _toConsumableArray(new Set(tipNames)); return numTippers.length; }); _defineProperty(this, "calcAvgTip", function () { if (_this.tips.tips.length < 1) return 0; return Math.floor(_this.tips.total_tips / _this.tips.tips.length); }); _defineProperty(this, "calcTipsPerHour", function () { if (_this.tips.tips.length < 1) return 0; var hour = 60000 * 60; var timeInShow = (Date.now() - _this.startTimestamp) / hour; if (timeInShow < 1) return _this.tips.total_tips;else { var tipsPerHour = Math.floor(_this.tips.total_tips / timeInShow); return tipsPerHour; } }); _defineProperty(this, "getTotalFollowers", function () { cb.getRoomOwnerData(function (ownerData) { if (ownerData.success) { _this.totalFollowers = ownerData.data.followers; } }); }); this.api = api; this.parent = parent; this.settings = []; this.commands = []; this.startTime = null; this.startTimestamp = null; this.tips = new _Tips.RoomTips(); this.totalFollowers = null; this.peakViewers = 0; _PubSub.pubSub.subscribe('botStart', this.updateOnStart); _PubSub.pubSub.subscribe('userEnter', this.calcPeakViewers); _PubSub.pubSub.subscribe('newFollow', this.updateOnFollow); _PubSub.pubSub.subscribe('unFollow', this.updateOnUnFollow); _PubSub.pubSub.subscribe('newTip', this.updateOnTip); }; // const roomStats = new RoomStats(); exports.RoomStats = RoomStats; },{"../../core/PubSub":4,"./Tips":14}],13:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Stats = void 0; var _UserData = require("./UserData"); var _RoomStats = require("./RoomStats"); var _NonTippers = require("./NonTippers"); var _util = require("../../core/util"); var _fonts = require("../../core/fonts"); function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } var Stats = function Stats(api) { var _this = this; _classCallCheck(this, Stats); _defineProperty(this, "userInfo", function (params, msg) { var user = _util.util.getUserByName(params[0], _this.userData.totalUsers); if (!user) { _this.api.sendNotice("oops, I don't have any info on that user", cb.room_slug); return; } var totalTips = user.total_tips; var highTip = user.highest_tip; var lastTip = user.getTimeSinceTip(); var enter = _util.util.formatTime(user.timeEnter); var left = _util.util.formatTime(user.timeLeave); var timeIn = "".concat(user.getTimeInRoom(), " min"); var inRoom = function inRoom() { if (user.inRoom) { return 'Yes'; } else return 'No'; }; var hasTokens = function hasTokens() { if (user.has_tokens) return 'Yes'; if (!user.has_tokens && user.total_tips > 0) return "You've drained ".concat(user.user);else return 'No'; }; var sp = "\u205F" + "\u205F" + "\u205F"; // standard space from util var s = "\u205F" + "\u205F"; // small space var str = "".concat(sp, "\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550").concat(sp, " \uD83D\uDEC8 ").concat(sp, " \uFF35\uFF33\uFF25\uFF32 \xB7 \uFF29\uFF2E\uFF26\uFF2F ").concat(sp, " \uD83D\uDEC8 ").concat(sp, "\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550").concat(sp, "\n"); // prettier-ignore str += "\u2022 Name: ".concat(user.user) + _util.util.calcLen("".concat(user.user), 20) + "\u2022 Colour: ".concat(user.color) + _util.util.calcLen("".concat(user.color), 19) + "".concat(s, "\u2022 Has tokens: ").concat(hasTokens(), "\n"); // prettier-ignore str += "\u2022 Total Tips: ".concat(totalTips) + _util.util.calcLen("".concat(totalTips), 17) + "\u2022 Highest Tip: ".concat(highTip) + _util.util.calcLen("".concat(highTip), 15) + "\u2022 Last Tip: ".concat(lastTip, "\n"); // prettier-ignore str += "\u2022 Time viewing: ".concat(timeIn) + _util.util.calcLen("".concat(timeIn), 12) + "\u2022 First Time Entered: ".concat(enter) + _util.util.calcLen("".concat(enter), 8) + "\u2022 No. Times Entered: \n"; // prettier-ignore str += "\u2022 Currently in room: ".concat(inRoom()) + _util.util.calcLen("".concat(inRoom()), 8) + "\u2022 Left room at: ".concat(left); str = (0, _fonts.strFormat)(str); _this.api.sendNotice(str, cb.room_slug, 'linear-gradient(to right, rgb(255,255,255) 8%, rgb(62, 60, 65) 8%)', 'rgba(255,255,255,0.7)'); }); _defineProperty(this, "roomData", function (params, msg) { var startTime = _util.util.formatTime(_this.roomStats.startTime); var timeNow = _util.util.formatTime(new Date()); var totalTips = _this.roomStats.tips.total_tips; var numTippers = _this.roomStats.calcNumTippers(); var numTips = _this.roomStats.tips.tips.length; var avgTip = _this.roomStats.calcAvgTip(); var tipsPerUser = _this.roomStats.calcTipsPerUser(); var tipsPerHour = _this.roomStats.calcTipsPerHour(); var peakViewers = _this.roomStats.peakViewers; var totalFollowers = _this.roomStats.totalFollowers || '0'; var totalViewers = _this.userData.totalUsers.length; var currentViewers = _this.userData.currentUsers.length; var sp = "\u205F" + "\u205F" + "\u205F"; // standard space from util var s = "\u205F" + "\u205F"; // small space // prettier-ignore var str = "".concat(sp, "\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550").concat(sp, " \uD83D\uDEC8 ").concat(sp, " \uFF33\uFF25\uFF33\uFF33\uFF29\uFF2F\uFF2E \xB7 \uFF32\uFF25\uFF30\uFF2F\uFF32\uFF34 ").concat(sp, " \uD83D\uDEC8 ").concat(sp, "\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550").concat(sp, "\n"); // prettier-ignore str += "\u2022 Model: ".concat(_this.api.room_slug) + _util.util.calcLen("".concat(_this.api.room_slug), 13) + "".concat(s, "\u2022 Start: ").concat(startTime) + _util.util.calcLen("".concat(startTime), 17) + "\u2022 Time: ".concat(timeNow, "\n"); // prettier-ignore str += "\u2022 Total Tips: ".concat(totalTips) + _util.util.calcLen("".concat(totalTips), 11) + "\u2022 No. Tippers: ".concat(numTippers) + _util.util.calcLen("".concat(numTippers), 11) + "\u2022 No. Tips: ".concat(numTips, "\n"); //prettier-ignore str += "\u2022 Avg. Tip: ".concat(avgTip) + _util.util.calcLen("".concat(avgTip), 12) + "\u2022 Tips/Non-Grey: ".concat(tipsPerUser) + _util.util.calcLen("".concat(tipsPerUser), 9) + "\u2022 Tips/hour: ".concat(tipsPerHour, "\n"); // prettier-ignore str += "\u2022 Followers: ".concat(totalFollowers) + _util.util.calcLen("".concat(totalFollowers), 11) + "\u2022 New Follows: " + _util.util.calcLen("".concat(currentViewers), 11) + "\u2022 Non grey follows:\n"; // prettier-ignore str += "\u2022 Viewers Total: ".concat(totalViewers) + _util.util.calcLen("".concat(totalViewers), 8) + "\u2022 Current: ".concat(currentViewers) + _util.util.calcLen("".concat(currentViewers), 14) + "\u2022 Peak: ".concat(peakViewers); str = (0, _fonts.strFormat)(str); _this.api.sendNotice(str, cb.room_slug, "linear-gradient(to right, rgb(255,255,255) 8%, rgb(62, 60, 65) 8%)", 'rgba(255,255,255,0.7)'); }); _defineProperty(this, "addCommands", function () { var commands = { report: { func: _this.roomData, permission: 'host', description: 'View the report of room activity', params: [] }, info: { func: _this.userInfo, permission: 'host', description: 'View all info on a user', params: [] } }; var allCommands = _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, commands), _this.nonTippers.commands), _this.roomStats.commands), _this.userData.commands); return allCommands; }); this.api = api; this.roomStats = new _RoomStats.RoomStats(this.api, this); this.userData = new _UserData.UserData(this.api, this); this.nonTippers = new _NonTippers.NonTippers(this.api, this); this.settings = this.nonTippers.settings.concat(this.userData.settings).concat(this.roomStats.settings); this.commands = this.addCommands(); }; exports.Stats = Stats; },{"../../core/fonts":7,"../../core/util":9,"./NonTippers":11,"./RoomStats":12,"./UserData":15}],14:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.RoomTips = void 0; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } var RoomTips = function RoomTips() { var _this = this; _classCallCheck(this, RoomTips); _defineProperty(this, "updateOnTip", function (tip) { var newTip = new Tip(tip); _this.total_tips += newTip.amount; _this.tips.push(newTip); }); this.total_tips = 0; this.tips = []; }; exports.RoomTips = RoomTips; var Tip = function Tip(_tip) { _classCallCheck(this, Tip); _defineProperty(this, "getColor", function (tip) { if (tip.from_user_tipped_tons_recently) { return 'Dark Purple'; } if (tip.from_user_tipped_alot_recently) { return 'Purple'; } if (tip.from_user_tipped_recently) { return 'Dark Blue'; } if (!tip.from_user_tipped_recently) { return 'Light Blue'; } }); this.user = _tip.from_user; this.anon = _tip.is_anon_tip; this.amount = parseInt(_tip.amount); this.color = this.getColor(_tip); this.in_fanclub = _tip.from_user_in_fanclub; this.time = new Date(); this.timeStamp = Date.now(); }; },{}],15:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.UserData = void 0; var _PubSub = require("../../core/PubSub"); var _User = require("../../core/User"); function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } var UserData = function UserData(api, parent) { var _this = this; _classCallCheck(this, UserData); _defineProperty(this, "createUserOnStart", function () { _this.api.getRoomUsersData(function (usersData) { if (usersData.success) { usersData.data.dark_purple.forEach(function (name) { _this.updateUserOnEnter({ user: name, tipped_tons_recently: true }); }); usersData.data.light_purple.forEach(function (name) { _this.updateUserOnEnter({ user: name, tipped_alot_recently: true }); }); usersData.data.dark_blue.forEach(function (name) { _this.updateUserOnEnter({ user: name, tipped_recently: true }); }); usersData.data.light_blue.forEach(function (name) { _this.updateUserOnEnter({ user: name, tipped_recently: false }); }); usersData.data.grey.forEach(function (name) { _this.updateUserOnEnter({ user: name, tipped_recently: false }); }); usersData.data.fanclub.forEach(function (name) { _this.updateUserOnEnter({ user: name, in_fanclub: true, tipped_recently: true }); }); usersData.data.moderator.forEach(function (name) { _this.updateUserOnEnter({ user: name, is_mod: true }); }); } }); }); _defineProperty(this, "updateUserOnEnter", function (cbUser) { if (cbUser.user === cb.room_slug) return; var user = cbUser.user, rest = _objectWithoutProperties(cbUser, ["user"]); var roomUser = _this.getUserByName(user); if (roomUser) { roomUser.updateCbData(rest).setColor(_this.getColor(roomUser)).setEnterData(); _this.currentUsers.push(roomUser); // let str = JSON.stringify(roomUser); // cb.sendNotice(str); } else { var newUser = new _User.User(user, rest); newUser.setColor(_this.getColor(newUser)).setEnterData(); _this.totalUsers.push(newUser); _this.currentUsers.push(newUser); // let str = JSON.stringify(newUser); // cb.sendNotice(str); } }); _defineProperty(this, "getColor", function (roomUser) { if (roomUser.tipped_tons_recently) { return 'Dark Purple'; } else if (roomUser.tipped_alot_recently) { return 'Purple'; } else if (roomUser.tipped_recently) { return 'Dark Blue'; } else if (roomUser.has_tokens && roomUser.tipped_recently == false) { return 'Light Blue'; } else { return 'Grey'; } }); _defineProperty(this, "updateUserOnMsg", function (cbMsg) { if (cbMsg.user === cb.room_slug) return; var newProps = { in_fanclub: cbMsg.in_fanclub, has_tokens: cbMsg.has_tokens, is_mod: cbMsg.is_mod, tipped_recently: cbMsg.tipped_recently }; var roomUser = _this.getUserByName(cbMsg.user); roomUser.updateCbData(newProps).setColor(_this.getColor(roomUser)); // let str = JSON.stringify(roomUser); // cb.sendNotice(str); return cbMsg; }); _defineProperty(this, "updateUserOnTip", function (cbTip) { var newProps = { in_fanclub: cbTip.from_user_in_fanclub, has_tokens: cbTip.from_user_has_tokens, is_mod: cbTip.from_user_is_mod, tipped_recently: cbTip.from_user_tipped_recently, tipped_alot_recently: cbTip.from_user_tipped_alot_recently, tipped_tons_recently: cbTip.from_user_tipped_tons_recently, gender: cbTip.from_user_gender }; var roomUser = _this.getUserByName(cbTip.from_user); roomUser.updateCbData(newProps).setColor(_this.getColor(roomUser)).updateTips(cbTip); }); _defineProperty(this, "updateUserOnLeave", function (cbUser) { if (cbUser.user === cb.room_slug) return; var roomUser = _this.getUserByName(cbUser.user); roomUser.setLeaveData(); _this.removeFromArr(roomUser, _this.currentUsers); }); _defineProperty(this, "removeFromArr", function (roomUser, arr) { var index = arr.indexOf(roomUser); arr.splice(index, 1); }); _defineProperty(this, "getUserByName", function (userName) { if (_this.totalUsers.some(function (obj) { return obj.user === userName; })) { return _this.totalUsers.find(function (obj) { return obj.user === userName; }); } else return false; }); this.api = api; this.parent = parent; this.settings = []; this.commands = []; this.totalUsers = []; this.currentUsers = []; _PubSub.pubSub.subscribe('botStart', this.createUserOnStart); _PubSub.pubSub.subscribe('userEnter', this.updateUserOnEnter); _PubSub.pubSub.subscribe('newMsg', this.updateUserOnMsg); _PubSub.pubSub.subscribe('newTip', this.updateUserOnTip); _PubSub.pubSub.subscribe('userLeave', this.updateUserOnLeave); }; exports.UserData = UserData; },{"../../core/PubSub":4,"../../core/User":6}],16:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.EnterMsg = void 0; var _PubSub = require("../core/PubSub"); var _util = require("../core/util"); var _fonts = require("../core/fonts"); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } /** * Message will only be shown to a user once pers session. */ var EnterMsg = function EnterMsg(api) { var _this = this; _classCallCheck(this, EnterMsg); _defineProperty(this, "handleEnter", function (cbUser) { if (cb.settings.notifierEnter === 'Yes') { if (_this.users.includes(cbUser.user)) return; _this.users.push(cbUser.user); _this.showMsg(cbUser); } }); _defineProperty(this, "showMsg", function (cbUser) { var msg = "".concat(_fonts.ch.sp, " ").concat(_fonts.ch.audrey1, " \uD83D\uDF9D Hi ").concat(cbUser.user, ". ").concat(cb.settings.enterMessage, " \uD83D\uDF9D ").concat(_fonts.ch.audrey1, " ").concat(_fonts.ch.sp); var head = _util.util.strRepeat("".concat(_fonts.ch.sp), _util.util.calcSpace(_fonts.design.head1, msg.length) / 2) + "".concat(_fonts.design.head1); var foot = _util.util.strRepeat("".concat(_fonts.ch.sp), _util.util.calcSpace(_fonts.design.head1, msg.length) / 2) + _util.util.strRepeat(_fonts.ch.sp, 5) + "\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"; var bgGradient = "linear-gradient(to right, rgb(255,255,255) ".concat(_util.util.calcPer(msg), ", rgb(62,60,65) ").concat(_util.util.calcPer(msg), ")"); cb.sendNotice("".concat(head, "\n ").concat(msg, "\n ").concat(foot), cbUser.user, bgGradient, '#ffffff'); }); _defineProperty(this, "addSettings", function () { var settings = [{ name: 'enterBreak', label: _util.util.strRepeat("-", 110) + " MESSAGE ON ENTER " + _util.util.strRepeat("-", 149), type: 'choice', choice1: 'N/A', defaultValue: 'N/A' }, { name: 'notifierEnter', label: 'Display a message to users when they enter?', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes' }, { name: 'enterMessage', label: 'Enter message to show', type: 'str', minLength: 1, maxLength: 50, defaultValue: 'Welcome to the room' }]; return settings; }); this.api = api; this.settings = this.addSettings(); this.users = []; _PubSub.pubSub.subscribe('userEnter', this.handleEnter); }; exports.EnterMsg = EnterMsg; },{"../core/PubSub":4,"../core/fonts":7,"../core/util":9}],17:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.NewFollower = void 0; var _fonts = require("../core/fonts"); var _util = require("../core/util"); var _PubSub = require("../core/PubSub"); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } var NewFollower = function NewFollower(api) { var _this = this; _classCallCheck(this, NewFollower); _defineProperty(this, "followerInit", function (user) { _this.showMsg(user); if (!_this.followArr.includes(user.user)) { _this.followArr.push(user.user); } if (!_this.trueArr.includes(user.user)) { _this.trueArr.push(user.user); } if (_this.unFollowArr.includes(user.user)) { _util.util.removeFromArr(user.user, _this.unFollowArr); } }); _defineProperty(this, "unfollowerInit", function (user) { if (_this.trueArr.includes(user.user)) { _util.util.removeFromArr(user.user, _this.trueArr); } _this.unFollowArr.push(user.user); }); _defineProperty(this, "showMsg", function (user) { var txt = "".concat(_fonts.ch.sp, " ").concat(_fonts.ch.audrey1, " \uD83D\uDF9D ").concat(user.user, " is now following me \uD83D\uDF9D ").concat(_fonts.ch.audrey1).concat(_fonts.ch.sp); var bgGradient = "linear-gradient(to right, rgb(255,255,255) ".concat(_util.util.calcPer(txt), ", rgb(151, 186, 188) ").concat(_util.util.calcPer(txt), ")"); if (_this.api.settings.showFollowerMessage === 'Yes' && !_this.followArr.includes(user.user)) { if (_this.api.settings.showNotice === 'Just Me') { _this.api.sendNotice("".concat(txt), cb.room_slug, bgGradient, '#ffffff'); } else { _this.api.sendNotice("".concat(txt), '', bgGradient, '#ffffff'); } } }); _defineProperty(this, "listFollowers", function (params, msg) { if (_this.trueArr.length < 1) { _this.api.sendNotice("".concat(_fonts.ch.sp, "You have no new followers in this session"), msg.user); return; } var str = "".concat(_fonts.ch.sp).concat(_this.trueArr.length, " New Followers in this session:\n"); _this.trueArr.forEach(function (userName) { str += "".concat(_fonts.ch.sp, "Name: ").concat(userName, "\n"); }); str = str.substr(0, str.length - 1); _this.api.sendNotice(str, msg.user); }); _defineProperty(this, "addCommands", function () { var commands = { newfollowers: { func: _this.listFollowers, permission: 'host', description: 'View a list of new followers in this session', params: [] } }; return commands; }); _defineProperty(this, "addSettings", function () { var settings = [{ name: 'followerBreak', label: _util.util.strRepeat("-", 110) + " NEW FOLLOWER " + _util.util.strRepeat("-", 154), type: 'choice', choice1: 'N/A', defaultValue: 'N/A' }, { name: 'showFollowerMessage', label: 'Display a message when someone follows you? ', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes' }, { name: 'showNotice', label: 'Who do you want to see the follower notice?', type: 'choice', choice1: 'Just Me', choice2: 'Everyone', defaultValue: 'Just Me' }]; return settings; }); this.api = api; this.settings = this.addSettings(); this.commands = this.addCommands(); this.followArr = []; this.trueArr = []; this.unFollowArr = []; _PubSub.pubSub.subscribe('newFollow', this.followerInit); _PubSub.pubSub.subscribe('unFollow', this.unfollowerInit); }; exports.NewFollower = NewFollower; },{"../core/PubSub":4,"../core/fonts":7,"../core/util":9}],18:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.LB = void 0; var _PubSub = require("../core/PubSub"); var _util = require("../core/util"); var _User = require("../core/User"); var _fonts = require("../core/fonts"); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } var LB = function LB(api) { var _this = this; _classCallCheck(this, LB); _defineProperty(this, "updateLBonTip", function (cbTip) { var oldLB = _this.getLB(_this.arr); _this.updateUserOnTip(cbTip).sortLB(_this.arr); var newLB = _this.getLB(_this.arr); var lbChange = _this.checkLBchange(oldLB, newLB); if (cb.settings.showLBonTip === 'Yes') { _this.render(); } if (lbChange === true && cb.settings.showLBonTip !== 'No') { _this.render(); } }); _defineProperty(this, "updateUserOnTip", function (cbTip) { var roomUser = _util.util.getUserByName(cbTip.from_user, _this.arr); if (roomUser) { roomUser.updateTips(cbTip); } else { var newUser = new _User.TipUser(cbTip.from_user); _this.arr.push(newUser); newUser.updateTips(cbTip); } return _this; }); _defineProperty(this, "getLB", function (arr) { var lbNames = []; if (arr.length > _this.lbLength) { for (var i = 0; i <= _this.lbLength; i++) { lbNames.push(arr[i].user); } } else { for (var _i = 0; _i < arr.length; _i++) { lbNames.push(arr[_i].user); } } return lbNames; }); _defineProperty(this, "checkLBchange", function (oldLB, newLB) { var lbChanged = false; if (oldLB.length > newLB.length) { lbChanged = true; return lbChanged; } else { for (var i = 0; i <= _this.lbLength; i++) { if (oldLB[i] !== newLB[i]) { lbChanged = true; break; } } } return lbChanged; }); _defineProperty(this, "sortLB", function (arr) { arr.sort(function (a, b) { return b.total_tips - a.total_tips; }); }); _defineProperty(this, "render", function () { var _this$getStyle = _this.getStyle(), header = _this$getStyle.header, footer = _this$getStyle.footer; var title = cb.settings.lbTitle; var str = ""; if (header) str += header + '\n'; str += "".concat(title, "\n"); if (_this.arr.length < _this.lbLength) { for (var i = 0; i < 3; i++) { if (_this.arr[i] == null) { str += "".concat(_this.lbNum[i], "---\n"); } else { var user = _util.util.formatName(_this.arr[i].user); str += "".concat(_this.lbNum[i]).concat(user) + _util.util.calcLen(user, 24) + "".concat(_this.arr[i].total_tips, " tokens\n"); } } for (var _i2 = 3; _i2 < _this.arr.length; _i2++) { if (_this.arr[_i2]) { var _user = _util.util.formatName(_this.arr[_i2].user); str += "".concat(_this.lbNum[_i2]).concat(_user) + _util.util.calcLen(_user, 24) + "".concat(_this.arr[_i2].total_tips, " tokens\n"); } } } if (_this.arr.length >= _this.lbLength) { for (var _i3 = 0; _i3 < _this.lbLength; _i3++) { var _user2 = _util.util.formatName(_this.arr[_i3].user); str += "".concat(_this.lbNum[_i3]).concat(_user2) + _util.util.calcLen(_user2, 24) + "".concat(_this.arr[_i3].total_tips, " tokens\n"); } } if (!footer) str = str.substr(0, str.length - 1); if (footer) str += footer; str = (0, _fonts.strFormat)(str); return str; }); _defineProperty(this, "showLB", function () { var msg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; var _this$getBG = _this.getBG(), bg = _this$getBG.bg, txt = _this$getBG.txt; var _LB = _this.render(); if (msg && msg.user !== cb.room_slug) { _this.api.sendNotice(_LB, msg.user, bg, txt); } else { _this.api.sendNotice(_LB, '', bg, txt); } }); _defineProperty(this, "getBG", function () { var bg = ''; var txt = ''; if (_this.api.settings.lbColor === 'White') { return { bg: bg, txt: txt }; } if (_this.api.settings.lbColor === 'V.Dark Grey') { bg = "linear-gradient(to right, rgb(255,255,255) 15%, rgb(62, 60, 65) 15%)"; txt = "rgba(255,255,255, 0.7)"; return { bg: bg, txt: txt }; } }); _defineProperty(this, "getStyle", function () { if (_this.api.settings.lbStyle === 'Plain') return; var header; var footer; if (_this.api.settings.lbStyle === 'Stars') { header = _fonts.lbStyle.head1; footer = _fonts.lbStyle.foot1; return { header: header, footer: footer }; } if (_this.api.settings.lbStyle === 'King') { header = _fonts.lbStyle.head2; footer = _fonts.lbStyle.foot2; return { header: header, footer: footer }; } }); _defineProperty(this, "spamLB", function () { if (_this.api.settings.turnOnLB === 'Yes' && _this.api.settings.spamLB > 0) { _this.showLB(); } _this.api.setTimeout(_this.spamLB, _this.api.settings.spamLB * 60000); }); _defineProperty(this, "appendTipsToMsg", function (msg) { if (msg.user === cb.room_slug) return; var user = _util.util.getUserByName(msg.user, _this.arr); var message = msg.m; if (cb.settings.showTips === 'Yes') { if (user && user.total_tips > 0) { message = "|".concat(user.tipTotal, "| ").concat(message); } } msg.m = message; return msg; }); _defineProperty(this, "addUserToLB", function (params, msg) { if (params.length < 2) { _this.api.sendNotice('Please enter a user name and amount', msg.user); } var amount; var from_user; if (Number.isInteger(parseInt(params[0]))) { amount = params[0]; from_user = params[1]; _this.updateLBonTip({ from_user: from_user, amount: amount }); } else if (Number.isInteger(parseInt(params[1]))) { amount = params[1]; from_user = params[0]; _this.updateLBonTip({ from_user: from_user, amount: amount }); } }); _defineProperty(this, "addCommands", function () { var commands = { lb: { func: _this.showLB, permission: 'user', description: 'Show the leaderboard', params: [] }, lbadd: { func: _this.addUserToLB, permission: 'host', description: 'Add a user to the leaderboard', params: [] } }; return commands; }); _defineProperty(this, "addSettings", function () { var settings = [{ name: 'leaderboard', label: _util.util.strRepeat("-", 110) + " LEADERBOARD SETTINGS " + _util.util.strRepeat("-", 141), type: 'choice', choice1: 'N/A', defaultValue: 'N/A' }, { name: 'turnOnLB', label: 'Turn On Leaderboard', defaultValue: 'Yes', type: 'choice', choice1: 'Yes', choice2: 'No' }, { name: 'lbTitle', label: 'Title of Leaderboard', type: 'str', defaultValue: 'Tip Leaderboard', maxLength: 45 }, { name: 'lbLength', label: 'How many users to show on leaderboard', type: 'int', minValue: 3, maxValue: 10, defaultValue: 3 }, { name: 'lbColor', label: 'What Color is the leaderboard Background?', type: 'choice', choice1: 'V.Dark Grey', choice2: 'White', defaultValue: 'V.Dark Grey' }, { name: 'lbStyle', label: 'What style of header and footer would you like on the leaderboard?', type: 'choice', choice1: 'Stars', choice2: 'King', choice3: 'Plain', defaultValue: 'Stars' }, { name: 'showLBonTip', label: 'Show Leaderboard on tip? ', type: 'choice', choice1: 'Yes', choice2: 'No', choice3: 'If leaderboard changes', defaultValue: 'If leaderboard changes' }, { name: 'spamLB', label: 'How many minutes between posting leaderboard? ', type: 'int', minValue: 0, maxValue: 20, defaultValue: 2 }, { name: 'showTips', label: 'Show tips amount next to users name?', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes' }]; return settings; }); this.api = api; this.commands = this.addCommands(); this.settings = this.addSettings(); this.arr = []; this.lbLength = this.api.settings.lbLength; this.lbNum = ["".concat(_fonts.ch.sp, "\u2160") + _util.util.strRepeat("".concat(_fonts.ch.sp), 3) + "".concat(_fonts.ch.star) + _util.util.strRepeat("".concat(_fonts.ch.sp), 3), "".concat(_fonts.ch.sp, "\u2161") + _util.util.strRepeat("".concat(_fonts.ch.sp), 2) + "".concat(_fonts.ch.star) + _util.util.strRepeat("".concat(_fonts.ch.sp), 3), "".concat(_fonts.ch.sp, "\u2162") + _util.util.strRepeat("".concat(_fonts.ch.sp), 1) + "".concat(_fonts.ch.star) + _util.util.strRepeat("".concat(_fonts.ch.sp), 3), "".concat(_fonts.ch.sp, "\u2163") + _util.util.strRepeat("".concat(_fonts.ch.sp), 1) + "".concat(_fonts.ch.star) + _util.util.strRepeat("".concat(_fonts.ch.sp), 3), "".concat(_fonts.ch.sp, "\u2164") + _util.util.strRepeat("".concat(_fonts.ch.sp), 1) + "".concat(_fonts.ch.star) + _util.util.strRepeat("".concat(_fonts.ch.sp), 3), "".concat(_fonts.ch.sp, "\u2165") + _util.util.strRepeat("".concat(_fonts.ch.sp), 1) + "".concat(_fonts.ch.star) + _util.util.strRepeat("".concat(_fonts.ch.sp), 3), "".concat(_fonts.ch.sp, "\u2166") + _util.util.strRepeat("".concat(_fonts.ch.sp), 1) + "".concat(_fonts.ch.star) + _util.util.strRepeat("".concat(_fonts.ch.sp), 3), "".concat(_fonts.ch.sp, "\u2167") + _util.util.strRepeat("".concat(_fonts.ch.sp), 1) + "".concat(_fonts.ch.star) + _util.util.strRepeat("".concat(_fonts.ch.sp), 3), "".concat(_fonts.ch.sp, "\u2168") + _util.util.strRepeat("".concat(_fonts.ch.sp), 1) + "".concat(_fonts.ch.star) + _util.util.strRepeat("".concat(_fonts.ch.sp), 3), "".concat(_fonts.ch.sp, "\u2169") + _util.util.strRepeat("".concat(_fonts.ch.sp), 1) + "".concat(_fonts.ch.star) + _util.util.strRepeat("".concat(_fonts.ch.sp), 3)]; _PubSub.pubSub.subscribe('newTip', this.updateLBonTip); this.api.setTimeout(this.spamLB, this.api.settings.spamLB * 60000); } /** * functions for updating users and leaderboard */ ; exports.LB = LB; },{"../core/PubSub":4,"../core/User":6,"../core/fonts":7,"../core/util":9}],19:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.PrivateNotices = void 0; var _util = require("../core/util"); var _index = require("../index"); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } var PrivateNotices = function PrivateNotices(api) { var _this = this; _classCallCheck(this, PrivateNotices); _defineProperty(this, "buildPm", function (params, msg) { var receiver; if (params[0] === cb.room_slug) { receiver = { user: cb.room_slug }; } else { receiver = _util.util.getUserByName(params[0], _index.app.global.currentUsers); } if (!receiver) { _this.api.sendNotice("• oops, I can't find that user", msg.user, '', ''); return; } var sender = msg.user; var message = params.slice(1).join(' '); var pm = new PM(message, sender, receiver.user); return pm; }); _defineProperty(this, "sendPm", function (params, msg) { if (_this.hasPermission(msg)) { var pm = _this.buildPm(params, msg); if (!pm) return; _this.pmArr.unshift(pm); _this.api.sendNotice("\u2022 PM from ".concat(pm.sender, ": ").concat(pm.message, " "), pm.receiver, '', ''); _this.api.sendNotice("\u2022 PM to ".concat(pm.receiver, ": ").concat(pm.message, " "), pm.sender, '', ''); } else { _this.api.sendNotice("• You do not have permission to send PM's", msg.user); } }); _defineProperty(this, "hasPermission", function (msg) { if (msg.user === cb.room_slug) return true; if (_this.api.settings.pmPermission === 'Just Model') { if (!_this.allowPm.includes(msg.user)) { return false; } } if (_this.api.settings.pmPermission === 'Model and Mods' && msg.is_mod === true) { return true; } if (_this.api.settings.pmPermission === 'Model, Mods and Fans') { if (msg.is_mod === true || msg.in_fanclub === true) { return true; } } if (_this.allowPm.includes(msg.user)) { return true; } }); _defineProperty(this, "replyPM", function (params, msg) { var lastPm = _this.pmArr.find(function (pm) { return pm.receiver === msg.user; }); if (lastPm && _this.hasPermission(msg)) { params.unshift(lastPm.sender); var str = JSON.stringify(params); cb.sendNotice(str); _this.sendPm(params, msg); // let message = params.join(' '); // this.api.sendNotice(`PM from ${msg.user}: ${message}`, lastPm.sender, '', ''); } }); _defineProperty(this, "givePermission", function (params, msg) { var userName = params[0]; _this.allowPm.push(userName); var str = JSON.stringify(_this.allowPm); cb.sendNotice(str); _this.api.sendNotice("".concat(userName, " has been given permission to pm"), msg.user); _this.api.sendNotice("".concat(msg.user, " has given you permission to pm"), userName); }); _defineProperty(this, "addCommands", function () { var commands = { pm: { func: _this.sendPm, permission: 'user', description: '', params: [] }, reply: { func: _this.replyPM, permission: 'user', description: '', params: [] }, addpm: { func: _this.givePermission, permission: 'host', description: '', params: [] }, removepm: {}, pmlist: {} }; return commands; }); _defineProperty(this, "addSettings", function () { var settings = [{ name: 'pmPermission', label: 'Who has permission to send private notices? You can add users with /addpm [user]', type: 'choice', choice1: 'Just Model', choice2: 'Model and Mods', choice3: 'Model, Mods and Fans' }]; return settings; }); this.api = api; this.settings = this.addSettings(); this.commands = this.addCommands(); this.allowPm = []; this.pmArr = []; }; exports.PrivateNotices = PrivateNotices; var PM = function PM(message, from, to) { _classCallCheck(this, PM); this.message = message; this.sender = from; this.receiver = to; }; /** * @todo setting: if you pm someone, auto add to pmlist * @todo setting: default allowable pm list. fans/mods/purples? * @todo send notice if user who was pm'd can't pm back */ },{"../core/util":9,"../index":10}],20:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.RotatingNotices = void 0; var _util = require("../core/util"); var _fonts = require("../core/fonts"); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } var RotatingNotices = function RotatingNotices(api) { var _this = this; _classCallCheck(this, RotatingNotices); _defineProperty(this, "spamLoop", function () { if (_this.msgArray.length < 1) return; var spamLoop = []; var noticeStart = "".concat(_fonts.ch.sp, " ").concat(_fonts.ch.audrey1, " ").concat(_fonts.ch.tiny); var noticeEnd = "".concat(_fonts.ch.tiny, " ").concat(_fonts.ch.audrey1, " ").concat(_fonts.ch.sp); _this.msgArray.forEach(function (msg) { msg.trim(); if (msg != '') { spamLoop.push(msg); } }); if (spamLoop.length > 0) { //loop through the non empty messages while (spamLoop[_this.i] < spamLoop.length) { _this.i++; } _this.api.sendNotice("".concat(noticeStart, " ").concat(spamLoop[_this.i], " ").concat(noticeEnd), '', _this.api.settings.messageColor, '', 'bold'); _this.api.setTimeout(_this.spamLoop, _this.api.settings.noticeTimeInterval * 60000); _this.i++; if (_this.i === spamLoop.length) { _this.i = 0; } } }); _defineProperty(this, "initSpam", function () { if (_this.api.settings.noticeTimeInterval > 0 && _this.msgArray.length > 0) { _this.api.setTimeout(_this.spamLoop, _this.api.settings.noticeTimeInterval * 30000); } }); _defineProperty(this, "addCommands", function () {}); _defineProperty(this, "addSettings", function () { var settings = [{ name: 'rotatingNotices', label: _util.util.strRepeat("-", 110) + " ROTATING NOTICES " + _util.util.strRepeat("-", 149), type: 'choice', choice1: 'N/A', defaultValue: 'N/A' }, { name: 'noticeTimeInterval', label: "Delay between notices being displayed (Time in minutes. 0 is off)", type: 'int', minValue: 0, maxValue: 999, defaultValue: 2 }, { name: 'messageColor', label: 'Message Background Color (html hex code)', type: 'str', defaultValue: '#ffffff' }, { name: 'msg1', label: 'Message 1', type: 'str', required: false }, { name: 'msg2', label: 'Message 2', type: 'str', required: false }, { name: 'msg3', label: 'Message 3', type: 'str', required: false }, { name: 'msg4', label: 'Message 4', type: 'str', required: false }, { name: 'msg5', label: 'Message 5', type: 'str', required: false }, { name: 'msg6', label: 'Message 6', type: 'str', required: false }, { name: 'msg7', label: 'Message 7', type: 'str', required: false }, { name: 'msg8', label: 'Message 8', type: 'str', required: false }, { name: 'msg9', label: 'Message 9', type: 'str', required: false }, { name: 'msg10', label: 'Message 10', type: 'str', required: false }]; return settings; }); this.api = api; this.settings = this.addSettings(); this.commands = this.addCommands(); this.msgArray = [this.api.settings.msg1, this.api.settings.msg2, this.api.settings.msg3, this.api.settings.msg4, this.api.settings.msg5, this.api.settings.msg6, this.api.settings.msg7, this.api.settings.msg8, this.api.settings.msg9, this.api.settings.msg10]; this.i = 0; this.initSpam(); }; exports.RotatingNotices = RotatingNotices; },{"../core/fonts":7,"../core/util":9}]},{},[10]);
© Copyright Chaturbate 2011- 2024. All Rights Reserved.