Apps Home
|
Create an App
testhope
Author:
hope
Description
Source Code
Launch App
Current Users
Created by:
Hope
(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.onDrawPanel(function (user) { _PubSub.pubSub.publish('onDrawPanel', 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" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) 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; var cmd = _this.getCommand(command); if (!cmd) return; 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", goldStar: "\u2B50" }; 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"); var _excluded = ["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, _excluded); 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'; } if (roomUser.tipped_alot_recently) { return 'Purple'; } if (roomUser.tipped_recently) { return 'Dark Blue'; } if (roomUser.has_tokens && roomUser.tipped_recently == false) { return 'Light Blue'; } 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 = []; _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 = 8; 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 _appSettings = require("./plugins/appSettings"); var _tipCounter = require("./plugins/tipCounter"); var _rotatingNotices = require("./plugins/rotatingNotices"); var _welcomeMsg = require("./plugins/welcomeMsg"); var _newFollower = require("./plugins/newFollower"); var _tipMenu = require("./plugins/tipMenu"); // import { Global } from './core/globals'; /** * Init App */ var app = new _App.App(cb); // const globals = new Global(cb); // export { globals }; /** * Plugins */ exports.app = app; var appSettings = new _appSettings.AppSettings(cb); var tipCounter = new _tipCounter.TipCounter(cb); var rotatingNotices = new _rotatingNotices.RotatingNotices(cb); var enterMsg = new _welcomeMsg.EnterMsg(cb); var newFollower = new _newFollower.NewFollower(cb); var tipMenu = new _tipMenu.TipMenu(cb); app.register(appSettings); app.register(tipCounter); app.register(enterMsg); app.register(newFollower); app.register(rotatingNotices); app.register(tipMenu); app.run(); },{"./core/App":1,"./plugins/appSettings":11,"./plugins/newFollower":12,"./plugins/rotatingNotices":13,"./plugins/tipCounter":14,"./plugins/tipMenu":15,"./plugins/welcomeMsg":16}],11:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.AppSettings = 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 AppSettings = function AppSettings(api) { _classCallCheck(this, AppSettings); _defineProperty(this, "addSettings", function () { var settings = [{ name: 'placeholder_chooseApps', label: _util.util.strRepeat("-", 98) + "CHOOSE FEATURES TO USE " + _util.util.strRepeat("-", 154), type: 'str', required: false }, { name: 'welcome_message', label: 'Activate Welcome Message?', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'No' }, { name: 'new_follower_message', label: 'Activate New Follower Message?', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'No' }, { name: 'rotating_notices', label: 'Activate Rotating Notices?', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'No' }, { name: 'tip_menu', label: 'Activate Tip Menu', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'No' }]; return settings; }); _defineProperty(this, "addCommands", function () {}); this.api = api; this.settings = this.addSettings(); this.commands = this.addCommands(); }; exports.AppSettings = AppSettings; },{"../core/util":9}],12:[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) { if (_this.api.settings.new_follower_message !== 'Yes') return; _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.api.settings.new_follower_message !== 'Yes') return; if (_this.trueArr.includes(user.user)) { _util.util.removeFromArr(user.user, _this.trueArr); } _this.unFollowArr.push(user.user); if (_this.api.settings.mute_unfollowers === "Yes") { _this.api.sendNotice("You've been muted, please follow again to be unmuted", user.user, '', '', 'bold'); } }); _defineProperty(this, "showMsg", function (user) { var bgColor = _this.api.settings.follower_bg_color; var fontColor = _this.api.settings.follower_font_color; var noticeStart = "".concat(_fonts.ch.sp, " \u2605 ").concat(_fonts.ch.tiny); var noticeEnd = "".concat(_fonts.ch.tiny, " \u2605 ").concat(_fonts.ch.sp); var msg = "".concat(user.user, " is now following \uD835\uDC40\uD835\uDC3C\uD835\uDC46\uD835\uDC46 \uD835\uDC40\uD835\uDC9C\uD835\uDC45\uD835\uDC46"); var finalMsg = "".concat(noticeStart, " ").concat(msg, " ").concat(noticeEnd); var bgGradient = "linear-gradient(to right, rgb(255,255,255) ".concat(_util.util.calcPer(finalMsg), ", ").concat(bgColor, " ").concat(_util.util.calcPer(finalMsg), ")"); if (!_this.followArr.includes(user.user)) { if (_this.api.settings.showNotice === "Just Me") { _this.api.sendNotice("".concat(finalMsg), cb.room_slug, bgGradient, fontColor, 'bold'); } else { _this.api.sendNotice("".concat(finalMsg), "", bgGradient, fontColor, 'bold'); } } }); _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, "muteUnfollowers", function (msg) { if (_this.api.settings.mute_unfollowers === 'No') return; if (_this.unFollowArr.includes(msg.user)) { msg['X-Spam'] = true; msg.m = ''; _this.api.sendNotice("Hi ".concat(msg.user, ", Follow me again to be unmuted"), msg.user, '', '', 'bold'); } }); _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("-", 98) + " NEW FOLLOWER " + _util.util.strRepeat("-", 170), type: "str", required: false }, { name: "showNotice", label: "Who do you want to see the follower notice?", type: "choice", choice1: "Just Me", choice2: "Everyone", defaultValue: "Everyone" }, { name: 'mute_unfollowers', label: 'Mute messages from people who unfollow you?', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'No' }, { name: 'follower_font_color', label: 'Font Color (HTML Hex Code)', type: 'str', minLength: 7, maxLength: 9, defaultValue: '#ffffff' }, { name: 'follower_bg_color', label: 'Background color (HTML Hex Code)', type: 'str', minLength: 7, maxLength: 9, defaultValue: '#008000' }]; 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); _PubSub.pubSub.subscribe("newMsg", this.muteUnfollowers); }; exports.NewFollower = NewFollower; },{"../core/PubSub":4,"../core/fonts":7,"../core/util":9}],13:[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, "initSpam", function () { if (_this.api.settings.rotating_notices !== 'Yes') return; if (_this.api.settings.noticeTimeInterval > 0 && _this.msgArray.length > 0) { _this.getNotices(); _this.api.setTimeout(_this.spamLoop, _this.api.settings.noticeTimeInterval * 5000); } }); _defineProperty(this, "spamLoop", function () { var noticeStart = "".concat(_fonts.ch.sp, " \u2605 ").concat(_fonts.ch.tiny); var noticeEnd = "".concat(_fonts.ch.tiny, " \u2605 ").concat(_fonts.ch.sp); if (_this.activeNotices.length > 0) { // loop through the non empty messages while (_this.activeNotices[_this.i] < _this.activeNotices.length) { _this.i++; } _this.api.sendNotice("".concat(noticeStart, " ").concat(_this.activeNotices[_this.i].msg, " ").concat(noticeEnd), '', _this.api.settings.noticeBgColor, _this.api.settings.noticeFontColor, 'bold'); _this.api.setTimeout(_this.spamLoop, _this.api.settings.noticeTimeInterval * 60000); _this.i++; if (_this.i === _this.activeNotices.length) { _this.i = 0; } } }); _defineProperty(this, "getNotices", function () { _this.msgArray.forEach(function (msg) { msg.trim(); if (msg != '') { var id = _this.activeNotices.length + 1; _this.activeNotices.push({ id: id, msg: msg }); } }); }); _defineProperty(this, "listNotices", function (params, msg) { if (_this.api.settings.rotating_notices !== 'Yes') return; var message = 'Active Rotating Notices\n'; _this.activeNotices.forEach(function (notice) { message += "ID: ".concat(notice.id, " --- ").concat(notice.msg, "\n"); }); message = message.substr(0, message.length - 1); _this.api.sendNotice("".concat(message), msg.user, '#f44336', '#fff'); }); _defineProperty(this, "addNotice", function (params, msg) { if (_this.api.settings.rotating_notices !== 'Yes') return; var notice = params.join(' '); if (notice) { var id = _this.activeNotices[_this.activeNotices.length - 1].id + 1; _this.activeNotices.push({ id: id, msg: notice }); _this.api.sendNotice("Notice added to rotating notices: ".concat(notice), msg.user, '#f44336', '#fff'); } else { _this.api.sendNotice('🛑 Error: Please include a notice after \'/addnotice\' command 🛑', msg.user, '#f44336', '#fff'); } }); _defineProperty(this, "removeNotice", function (params, msg) { if (_this.api.settings.rotating_notices !== 'Yes') return; var id = parseInt(params[0]); if (!id) { _this.api.sendNotice('🛑 Error: Please use ID number to remove a notice. eg /rmnotice 5 🛑', msg.user, '#f44336', '#fff'); return; } // find notice object in array by id var noticeObj = _this.activeNotices.find(function (obj) { return obj.id === id; }); // remove notice object from activeNotices array var index = _this.activeNotices.indexOf(noticeObj); _this.activeNotices.splice(index, 1); _this.api.sendNotice("Removed Notice: ".concat(noticeObj.msg), msg.user, '#f44336', '#fff'); }); _defineProperty(this, "addCommands", function () { var commands = { notices: { func: _this.listNotices, permission: 'host', description: '', params: [] }, addnotice: { func: _this.addNotice, permission: 'host', description: '', params: [] }, rmnotice: { func: _this.removeNotice, permission: 'host', description: '', params: [] } }; return commands; }); _defineProperty(this, "addSettings", function () { var settings = [{ name: 'placeholder_rotatingNotices', label: "".concat(_util.util.strRepeat('-', 98), " ROTATING NOTICES ").concat(_util.util.strRepeat('-', 165)), type: 'str', required: false }, { name: 'noticeTimeInterval', label: 'Delay between notices being displayed (Time in minutes. 0 is off)', type: 'int', minValue: 0, maxValue: 999, defaultValue: 2 }, { name: 'noticeFontColor', label: 'Font Color (HTML hex code)', type: 'str', defaultValue: '#9F000F' }, { name: 'noticeBgColor', label: 'Background Color (HTML hex code)', type: 'str', defaultValue: '', required: false }, { name: 'msg1', label: 'Message 1', type: 'str', defaultValue: 'loser tax 3tk', required: false }, { name: 'msg2', label: 'Message 2', type: 'str', defaultValue: 'chastity tax 13tk', required: false }, { name: 'msg3', label: 'Message 3', type: 'str', defaultValue: 'twitter @yesmissmars', required: false }, { name: 'msg4', label: 'Message 4', type: 'str', defaultValue: 'small dick tax 6tk', required: false }, { name: 'msg5', label: 'Message 5', type: 'str', defaultValue: 'sub to https://onlyfans.com/yesmissmars', required: false }, { name: 'msg6', label: 'Message 6', type: 'str', defaultValue: 'follow me on https://www.instagram.com/yesmissmars/', required: false }, { name: 'msg7', label: 'Message 7', type: 'str', defaultValue: 'pathetic tax 9tk', required: false }, { name: 'msg8', label: 'Message 8', type: 'str', defaultValue: 'BIRTHDAY AUGUST 20TH: wishlistr.com/yesmissmars', 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.activeNotices = []; this.i = 0; this.initSpam(); } /** * Logic * * @need if (app is turned off) don't do anything */ ; exports.RotatingNotices = RotatingNotices; },{"../core/fonts":7,"../core/util":9}],14:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.TipCounter = void 0; var _util = require("../core/util"); var _fonts = require("../core/fonts"); 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; } /** * ############################################################### * TIP COUNTER Panel APP * ############################################################### */ var TipCounter = function TipCounter(api) { var _this = this; _classCallCheck(this, TipCounter); _defineProperty(this, "setTotalTipped", function (amount) { var tipAmount = parseInt(amount); if (tipAmount + _this.totalTipped >= _this.goal) { _this.totalTipped = _this.goal; } else { _this.totalTipped += tipAmount; } }); _defineProperty(this, "resetGoal", function (params, msg) { if (msg.user !== _this.api.room_slug) return; var noticeStart = "".concat(_fonts.ch.sp, " \u2605 ").concat(_fonts.ch.tiny); var noticeEnd = "".concat(_fonts.ch.tiny, " \u2605 ").concat(_fonts.ch.sp); if (params[0]) { var newAmount = parseInt(params[0]); if (newAmount) { _this.goal = newAmount; if (params[1]) { var newGoalName = params.slice(1); newGoalName = newGoalName.join(' '); _this.goalName = newGoalName; } } else { var _newGoalName = params; _newGoalName = _newGoalName.join(' '); _this.goalName = _newGoalName; } } _this.totalTipped = 0; _this.highTipName = '-----'; _this.highTipAmount = 0; _this.lastTipName = '-----'; _this.lastTipAmount = 0; _this.api.sendNotice("".concat(noticeStart, " ").concat(_this.api.room_slug, " has set a new goal of \"").concat(_this.goalName, "\" ").concat(_this.goal, " tokens ").concat(noticeEnd), '', '', '#CC6680', 'Bolder'); _this.api.drawPanel(); }); _defineProperty(this, "setHighTip", function (name, amount) { _this.highTipName = name; _this.highTipAmount = amount; }); _defineProperty(this, "setLastTip", function (name, amount) { _this.lastTipName = name; _this.lastTipAmount = amount; }); _defineProperty(this, "showAd", function () { var noticeStart = "".concat(_fonts.ch.sp, " \u2605 ").concat(_fonts.ch.tiny); var noticeEnd = "".concat(_fonts.ch.tiny, " \u2605 ").concat(_fonts.ch.sp); _this.api.sendNotice("".concat(noticeStart, " \uD835\uDC40\uD835\uDC3C\uD835\uDC46\uD835\uDC46 \uD835\uDC40\uD835\uDC9C\uD835\uDC45\uD835\uDC46' Goal is \"").concat(_this.goalName, "\" ").concat(_this.goal, " tokens ").concat(noticeEnd), '', '', '#CC6680', 'Bolder'); _this.api.setTimeout(_this.showAd, _this.api.settings.goalAd * 60000); }); _defineProperty(this, "initAd", function () { if (_this.api.settings.goalAd > 0) { _this.showAd(); } }); _defineProperty(this, "renderPanel", function (tip) { var user = tip.from_user; var amount = tip.amount; // testing purposed!!! DELETE!!! // let user = 'takentheknee'; // let amount = '55'; _this.setTotalTipped(amount); _this.setLastTip(user, amount); if (amount > _this.highTipAmount) { _this.setHighTip(user, amount); } if (_this.totalTipped >= _this.goal) { _this.drawThankYouPanel(); setTimeout(_this.drawGoalReachedPanel, 800); } else { _this.drawThankYouPanel(); setTimeout(_this.drawMainPanel, 800); } }); _defineProperty(this, "drawMainPanel", function () { _this.api.onDrawPanel(function (user) { var panel = _this.mainPanel(user); return panel; }); _this.api.drawPanel(); }); _defineProperty(this, "drawThankYouPanel", function () { _this.api.onDrawPanel(function (user) { var tipPanel = _this.thankYouPanel(user); return tipPanel; }); _this.api.drawPanel(); }); _defineProperty(this, "drawGoalReachedPanel", function () { _this.api.onDrawPanel(function (user) { var tipPanel = _this.goalReachedPanel(user); return tipPanel; }); _this.api.drawPanel(); }); _defineProperty(this, "thankYouPanel", function (user) { var thankYouImage = 'f09e5f39-f8ca-4df3-ba49-a0f447c15383'; return { template: 'image_template', layers: [{ type: 'image', fileID: thankYouImage }] }; }); _defineProperty(this, "goalReachedPanel", function (user) { var goalReachedImage = '1cbc0daa-a36e-45c6-9f51-b11e913f77a3'; return { template: 'image_template', layers: [{ type: 'image', fileID: goalReachedImage }] }; }); _defineProperty(this, "mainPanel", function (user) { var bgImage = _this.bgImageChoice(); if (cb.settings.bgImage === 'Standard Panel') { return { template: '3_rows_of_labels', row1_label: cb.settings.tips, row1_value: _this.totalTipped, row2_label: cb.settings.highestTip, row2_value: "".concat(_this.format_username(_this.highTipName), " (").concat(_this.highTipAmount, ")"), row3_label: cb.settings.latestTip, row3_value: "".concat(_this.format_username(_this.lastTipName), " (").concat(_this.lastTipAmount, ")") }; } return { template: 'image_template', layers: [{ type: 'image', fileID: bgImage }, { type: 'text', text: cb.settings.tips, top: 5, left: 8, 'font-size': _this.fontSize, color: _this.fontColor, 'font-weight': 'bold' }, { type: 'text', text: cb.settings.highestTip, top: 29, left: 8, 'font-size': _this.fontSize, color: _this.fontColor, 'font-weight': 'bold' }, { type: 'text', text: cb.settings.latestTip, top: 52, left: 8, 'font-size': _this.fontSize, color: _this.fontColor, 'font-weight': 'bold' }, { type: 'text', text: "".concat(_this.totalTipped, "/").concat(_this.goal), top: 5, left: 108, 'font-size': _this.fontSize, color: _this.fontColor, 'font-weight': 'bold' }, { type: 'text', text: "".concat(_this.format_username(_this.highTipName), " (").concat(_this.highTipAmount, ")"), top: 29, left: 108, 'font-size': _this.fontSize, color: _this.fontColor, 'font-weight': 'normal' }, { type: 'text', text: "".concat(_this.format_username(_this.lastTipName), " (").concat(_this.lastTipAmount, ")"), top: 51, left: 108, 'font-size': _this.fontSize, color: _this.fontColor, 'font-weight': 'normal' }] }; }); _defineProperty(this, "anonPanel", function (user) { return { template: '3_rows_11_21_31', row1_value: cb.settings.anonLine1, row2_value: cb.settings.anonLine2, row3_value: cb.settings.anonLine3 }; }); _defineProperty(this, "bgImageChoice", function () { if (cb.settings.bgImage === 'Miss Mars') { return '4b1c6ca6-9db0-465b-9e92-eee7bd0377c2'; } if (_this.api.settings.bgImage === 'Custom Image') { return _this.api.settings.customBg; } }); _defineProperty(this, "format_username", function (val) { if (val === '') { return '-----'; } return val.substring(0, 12); }); _defineProperty(this, "addSettings", function () { var settings = [{ name: 'placeholder1', label: "".concat(_util.util.strRepeat('-', 98), "SETUP GOAL ").concat(_util.util.strRepeat('-', 176)), type: 'str', required: false }, { name: 'goalAmount', label: 'Goal Amount', type: 'int', minValue: 1, defaultValue: 100 }, { name: 'goalName', label: 'Name of the goal', type: 'str' }, { name: 'goalAd', label: 'Show advertisement every ? minutes (0 is off)', type: 'int', minValue: 0, defaultValue: '10' }, { name: 'placeholder2', label: "".concat(_util.util.strRepeat('-', 98), "GOAL PANEL DESIGN ").concat(_util.util.strRepeat('-', 163)), type: 'str', required: false }, { name: 'tips', label: 'Name for "Total Tips" row', type: 'str', minLength: 3, maxLength: 20, defaultValue: 'Received / Goal' }, { name: 'highestTip', label: 'Name for "Highest Tips" row', type: 'str', minLength: 3, maxLength: 20, defaultValue: 'Highest Tip' }, { name: 'latestTip', label: 'Name for "Latest Tips" row', type: 'str', minLength: 3, maxLength: 20, defaultValue: 'Latest Tip' }, { name: 'bgImage', label: 'Background image for Tip App Panel', type: 'choice', choice1: 'Miss Mars', choice2: 'Standard Panel', choice3: 'Custom Image', defaultValue: 'Miss Mars' }, { name: 'customBg', label: 'If you selected Custom Image above, please paste code here. Image must be 270px wide and 69px high', type: 'str', minLength: 1, required: false }, { name: 'fontColor', label: 'Font color in the panel (HTML Hex Code)', type: 'str', defaultValue: '#FCD0A1B3' }]; return settings; }); _defineProperty(this, "addCommands", function () { var commands = { newgoal: { func: _this.resetGoal, permission: 'host', description: 'Start a new goal', params: [] } }; return commands; }); this.api = api; this.settings = this.addSettings(); this.commands = this.addCommands(); this.fontsize = 8; this.fontColor = this.api.settings.fontColor; this.totalTipped = 0; this.highTipName = ''; this.highTipAmount = 0; this.lastTipName = ''; this.lastTipAmount = 0; this.goal = parseInt(this.api.settings.goalAmount); this.goalName = this.api.settings.goalName; _PubSub.pubSub.subscribe('botStart', this.drawMainPanel); _PubSub.pubSub.subscribe('newTip', this.renderPanel); // testing purposes!!! DELETE!!! // pubSub.subscribe('newMsg', this.renderPanel); this.initAd(); } /** * Logic Functions */ ; exports.TipCounter = TipCounter; },{"../core/PubSub":4,"../core/fonts":7,"../core/util":9}],15:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.TipMenu = void 0; 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 TipMenu = function TipMenu(api) { var _this = this; _classCallCheck(this, TipMenu); _defineProperty(this, "initMenu", function () { if (_this.api.settings.tip_menu !== 'Yes') return; _this.getActiveItems(); if (_this.api.settings.sort_menu_by_price === 'Yes') { _this.sortActiveMenu(_this.activeMenu); } // init rotating menu and notices setTimeout(_this.rotatingMenuNotice, 60000); setTimeout(_this.rotateRandomNotice, 30000); }); _defineProperty(this, "onTip", function (tip) { if (_this.api.settings.tip_menu !== 'Yes') return; var amount = parseInt(tip.amount); var tipper = tip.from_user.toUpperCase(); // DELETE --- TESTING PURPOSES // let amount = tip.m.split(' '); // amount = parseInt(amount[0]); // const tipper = tip.user.toUpperCase(); // use filter here to find multiple items with same price var itemTippedFor = _this.activeMenu.find(function (menuItem) { return menuItem.price === amount; }); if (itemTippedFor) { _this.api.sendNotice("".concat(_this.itemSeparator, " ").concat(tipper, " tipped ").concat(amount, " tokens for \"").concat(itemTippedFor.item.toUpperCase(), "\" ").concat(_this.itemSeparator), '', _this.bgColor, _this.fontColor, 'bold'); } }); _defineProperty(this, "onEnter", function (user) { if (_this.api.settings.tip_menu !== 'Yes') return; if (user.has_tokens) { var menu = _this.getMenu(); _this.api.sendNotice("".concat(menu), user.user, _this.bgColor, _this.fontColor, 'bold'); } }); _defineProperty(this, "getMenu", function () { var menu = ''; if (_this.api.settings.tip_menu !== 'Yes') return; if (_this.api.settings.menu_view === 'Single Line') { // Get Menu Title or Graphic if (_this.menuTitle != '') { menu += "".concat(_this.menuTitle, " "); } // Put active menu items into string if (_this.activeMenu.length > 0) { _this.activeMenu.forEach(function (menuItem) { menu += "".concat(_this.itemSeparator, " ").concat(menuItem.item, " (").concat(menuItem.price, " tk) "); }); } } else if (_this.api.settings.menu_view === 'List') { // Get Menu Title or Graphic menu += "".concat(_this.menuTitle, "\n"); // Put active menu items into string _this.activeMenu.forEach(function (menuItem) { menu += "".concat(_this.itemSeparator, " ").concat(menuItem.item, ": ").concat(menuItem.price, " tk \n"); }); // remove last new line menu = menu.substr(0, menu.length - 1); } return menu; }); _defineProperty(this, "rotatingMenuNotice", function () { var menu = _this.getMenu(); var setting = parseInt(_this.api.settings.menu_rotate_time); if (setting > 0) { _this.api.sendNotice("".concat(menu), '', _this.bgColor, _this.fontColor, 'bold', 'lightblue'); } // else if (this.muteForBroadcaster === 'Hide For Me' && setting > 0) { // this.api.sendNotice(`${menu}`, '', this.bgColor, this.fontColor, 'bold', 'lightblue'); // users.forEach((user) => { // }); // } _this.api.setTimeout(_this.rotatingMenuNotice, setting * 64000); }); _defineProperty(this, "rotateRandomNotice", function () { if (_this.api.settings.rotate_random_item !== 'Yes') return; var setting = _this.api.settings.menu_rotate_time; if (setting > 0 && _this.activeMenu.length > 0) { var randomNum = _this.randomRange(0, _this.activeMenu.length - 1); var randomItem = _this.activeMenu[randomNum]; var message = "\"".concat(randomItem.item.toUpperCase(), "\": ").concat(randomItem.price, " TOKENS. Type /menu to see full menu"); _this.api.sendNotice("\uD835\uDC74\uD835\uDC70\uD835\uDC7A\uD835\uDC7A \uD835\uDC74\uD835\uDCD0\uD835\uDC79\uD835\uDC7A' Tip Menu is active! ".concat(message), '', '', '', 'lightblue'); _this.api.setTimeout(_this.rotateRandomNotice, 3 * 60000); } }); _defineProperty(this, "getActiveItems", function () { _this.menu.forEach(function (obj) { obj.item.trim(); if (obj.item != '') { _this.activeMenu.push(obj); } }); }); _defineProperty(this, "sortActiveMenu", function (arr) { arr.sort(function (a, b) { return a.price - b.price; }); }); _defineProperty(this, "sortActiveMenuByID", function (arr) { arr.sort(function (a, b) { return a.id - b.id; }); }); _defineProperty(this, "getMenuTitle", function () { var menuTitle = ''; var marsTitle = _this.api.settings.menu_title; if (marsTitle === 'Miss Mars Menu Red') { menuTitle = ':marsmenu_red'; } else if (marsTitle === 'Miss Mars Menu White') { menuTitle = ':marsmenu1'; } else if (marsTitle === 'Custom Title') { menuTitle = _this.api.settings.custom_title; } return menuTitle; }); _defineProperty(this, "getMenuBackgroundColor", function () { var setting = _this.api.settings.menu_bg_color; var background = ''; if (setting === 'None') { background = ''; } return background; }); _defineProperty(this, "getMenuFontColor", function () { var setting = _this.api.settings.menu_font_color; var color = ''; if (setting === 'Medium Violet Red') { color = '#c71585'; } return color; }); _defineProperty(this, "randomRange", function (min, max) { var rNum = Math.random(); rNum = Math.floor(rNum * (max - min + 1) + min); return rNum; }); _defineProperty(this, "menuCmd", function (params, msg) { if (_this.api.settings.tip_menu !== 'Yes') return; var menu = _this.getMenu(); if (msg.user === _this.api.room_slug) { _this.api.sendNotice("".concat(menu), '', _this.bgColor, _this.fontColor, 'bold', 'lightblue'); } else { _this.api.sendNotice("".concat(menu), msg.user, _this.bgColor, _this.fontColor, 'bold'); } }); _defineProperty(this, "addMenuItem", function (params, msg) { if (_this.api.settings.tip_menu !== 'Yes') return; var amount = parseInt(params[0]); if (amount && params[1]) { var menuItem = params.slice(1).join(' '); _this.sortActiveMenuByID(_this.activeMenu); var id = _this.activeMenu[_this.activeMenu.length - 1].id + 1; var menuObj = { id: id, item: menuItem, price: amount }; _this.activeMenu.push(menuObj); _this.sortActiveMenu(_this.activeMenu); } else { _this.api.sendNotice('🛑 Error: Something is wrong. Make sure your command looks like this: "/addmenu 1000 Because Miss Mars is Amazing 🛑"', msg.user, '#f44336', '#fff'); } }); _defineProperty(this, "removeMenuItem", function (params, msg) { if (_this.api.settings.tip_menu !== 'Yes') return; var id = parseInt(params[0]); var menuObj = _this.activeMenu.find(function (obj) { return obj.id === id; }); if (!id || !menuObj) { _this.api.sendNotice('🛑 Error: Please use ID number to remove a menu Item. eg /rmmenu 5 🛑', msg.user, '#f44336', '#fff'); return; } var index = _this.activeMenu.indexOf(menuObj); _this.activeMenu.splice(index, 1); _this.api.sendNotice("Removed Item: ".concat(menuObj.item, ": ").concat(menuObj.price, " tk"), msg.user, '#f44336', '#fff'); }); _defineProperty(this, "viewMenuId", function (params, msg) { if (_this.api.settings.tip_menu !== 'Yes') return; var message = 'Menu Item IDs \n'; _this.activeMenu.forEach(function (menuObj) { message += "ID: ".concat(menuObj.id, " --- ").concat(menuObj.item, " --- ").concat(menuObj.price, " tk \n"); }); message = message.substr(0, message.length - 1); _this.api.sendNotice("".concat(message), msg.user, '#f44336', '#fff'); }); _defineProperty(this, "addSettings", function () { var settings = [{ name: 'tip_menu_placeholder', label: "".concat(_util.util.strRepeat('-', 98), "TIP MENU ").concat(_util.util.strRepeat('-', 176)), type: 'str', required: false }, { name: 'menu_item1', label: 'Item 1', type: 'str', defaultValue: 'show your devotion', required: false }, { name: 'menu_item1_price', label: 'Item 1 Price', type: 'int', defaultValue: 5, minValue: 1, required: false }, { name: 'menu_item2', label: 'Item 2', type: 'str', defaultValue: 'for nothing', required: false }, { name: 'menu_item2_price', label: 'Item 2 Price', type: 'int', defaultValue: 10, minValue: 1, required: false }, { name: 'menu_item3', label: 'Item 3', type: 'str', defaultValue: 'private message', required: false }, { name: 'menu_item3_price', label: 'Item 3 Price', type: 'int', defaultValue: 15, minValue: 1, required: false }, { name: 'menu_item4', label: 'Item 4', type: 'str', defaultValue: 'permission to edge', required: false }, { name: 'menu_item4_price', label: 'Item 4 Price', type: 'int', defaultValue: 20, minValue: 1, required: false }, { name: 'menu_item5', label: 'Item 5', type: 'str', defaultValue: 'stroke then send', required: false }, { name: 'menu_item5_price', label: 'Item 5 Price', type: 'int', defaultValue: 25, minValue: 1, required: false }, { name: 'menu_item6', label: 'Item 6', type: 'str', defaultValue: 'special request', required: false }, { name: 'menu_item6_price', label: 'Item 6 Price', type: 'int', defaultValue: 30, minValue: 1, required: false }, { name: 'menu_item7', label: 'Item 7', type: 'str', defaultValue: 'permission to cum', required: false }, { name: 'menu_item7_price', label: 'Item 7 Price', type: 'int', defaultValue: 100, minValue: 1, required: false }, { name: 'menu_item8', label: 'Item 8', type: 'str', defaultValue: 'eye contact', required: false }, { name: 'menu_item8_price', label: 'Item 8 Price', type: 'int', defaultValue: 150, minValue: 1, required: false }, { name: 'menu_item9', label: 'Item 9', type: 'str', defaultValue: 'foot worship', required: false }, { name: 'menu_item9_price', label: 'Item 9 Price', type: 'int', defaultValue: 200, minValue: 1, required: false }, { name: 'menu_item10', label: 'Item 10', type: 'str', defaultValue: 'look at your profile', required: false }, { name: 'menu_item10_price', label: 'Item 10 Price', type: 'int', defaultValue: 250, minValue: 1, required: false }, { name: 'menu_item11', label: 'Item 11', type: 'str', defaultValue: 'turn on your cam', required: false }, { name: 'menu_item11_price', label: 'Item 11 Price', type: 'int', defaultValue: 300, minValue: 1, required: false }, { name: 'menu_item12', label: 'Item 12', type: 'str', defaultValue: 'drain yourself', required: false }, { name: 'menu_item12_price', label: 'Item 12 Price', type: 'int', defaultValue: 500, minValue: 1, required: false }, { name: 'menu_item13', label: 'Item 13', type: 'str', // defaultValue: '', required: false }, { name: 'menu_item13_price', label: 'Item 13 Price', type: 'int', // defaultValue: , minValue: 1, required: false }, { name: 'menu_item14', label: 'Item 14', type: 'str', // defaultValue: '', required: false }, { name: 'menu_item14_price', label: 'Item 14 Price', type: 'int', // defaultValue: , minValue: 1, required: false }, { name: 'menu_item15', label: 'Item 15', type: 'str', // defaultValue: '', required: false }, { name: 'menu_item15_price', label: 'Item 15 Price', type: 'int', // defaultValue: , minValue: 1, required: false }, { name: 'menu_item16', label: 'Item 16', type: 'str', // defaultValue: '', required: false }, { name: 'menu_item16_price', label: 'Item 16 Price', type: 'int', // defaultValue: , minValue: 1, required: false }, { name: 'menu_item17', label: 'Item 17', type: 'str', // defaultValue: '', required: false }, { name: 'menu_item17_price', label: 'Item 17 Price', type: 'int', // defaultValue: , minValue: 1, required: false }, { name: 'menu_item18', label: 'Item 18', type: 'str', // defaultValue: '', required: false }, { name: 'menu_item18_price', label: 'Item 18 Price', type: 'int', // defaultValue: , minValue: 1, required: false }, { name: 'menu_item19', label: 'Item 19', type: 'str', // defaultValue: '', required: false }, { name: 'menu_item19_price', label: 'Item 19 Price', type: 'int', // defaultValue: , minValue: 1, required: false }, { name: 'menu_item20', label: 'Item 20', type: 'str', // defaultValue: '', required: false }, { name: 'menu_item20_price', label: 'Item 20 Price', type: 'int', // defaultValue: , minValue: 1, required: false }, { name: 'menu_title', label: 'Title For Menu', type: 'choice', choice1: 'Miss Mars Menu Red', choice2: 'Miss Mars Menu White', choice3: 'Custom Title', defaultValue: 'Miss Mars Menu Red', required: false }, { name: 'custom_title', label: 'Custom title for menu, if custom selected above', type: 'str', required: false }, { name: 'menu_view', label: 'Tip Menu view style', type: 'choice', choice1: 'List', choice2: 'Single Line', defaultValue: 'List' }, { name: 'item_separator', label: 'Tip Menu Item Separator', type: 'str', defaultValue: ':pinkheart69', required: false }, { name: 'menu_bg_color', label: 'Menu Background Color', type: 'choice', choice1: 'None', defaultValue: 'None' }, { name: 'menu_font_color', label: 'Menu Font Color', type: 'choice', choice1: 'Medium Violet Red', defaultValue: 'Medium Violet Red' }, { name: 'menu_rotate_time', label: 'How often to send menu to the room? in minutes (0 is off)', type: 'int', minValue: 0, maxValue: 60, defaultValue: 5 }, { name: 'rotate_random_item', label: 'Periodically display an info menu bar and a random menu item with its price?', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes' }, { name: 'sort_menu_by_price', label: 'Sort menu order by price', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes' } // { // name: 'menu_mute_for_broadcaster', // label: 'As broadcaster, you can choose not to see the rotating menu. Would you like to hide it or see it?', // type: 'choice', // choice1: 'See It', // choice2: 'Hide For Me', // defaultValue: 'See it', // }, ]; return settings; }); _defineProperty(this, "addCommands", function () { var commands = { menu: { func: _this.menuCmd, permission: 'user', description: '', params: [] }, addmenu: { func: _this.addMenuItem, permission: 'host', description: '', params: [] }, rmmenu: { func: _this.removeMenuItem, permission: 'host', description: '', params: [] }, menuid: { func: _this.viewMenuId, permission: 'host', description: '', params: [] } }; return commands; }); this.api = api; this.settings = this.addSettings(); this.commands = this.addCommands(); this.activeMenu = []; this.menu = [{ id: 1, item: this.api.settings.menu_item1, price: parseInt(this.api.settings.menu_item1_price) }, { id: 2, item: this.api.settings.menu_item2, price: parseInt(this.api.settings.menu_item2_price) }, { id: 3, item: this.api.settings.menu_item3, price: parseInt(this.api.settings.menu_item3_price) }, { id: 4, item: this.api.settings.menu_item4, price: parseInt(this.api.settings.menu_item4_price) }, { id: 5, item: this.api.settings.menu_item5, price: parseInt(this.api.settings.menu_item5_price) }, { id: 6, item: this.api.settings.menu_item6, price: parseInt(this.api.settings.menu_item6_price) }, { id: 7, item: this.api.settings.menu_item7, price: parseInt(this.api.settings.menu_item7_price) }, { id: 8, item: this.api.settings.menu_item8, price: parseInt(this.api.settings.menu_item8_price) }, { id: 9, item: this.api.settings.menu_item9, price: parseInt(this.api.settings.menu_item9_price) }, { id: 10, item: this.api.settings.menu_item10, price: parseInt(this.api.settings.menu_item10_price) }, { id: 11, item: this.api.settings.menu_item11, price: parseInt(this.api.settings.menu_item11_price) }, { id: 12, item: this.api.settings.menu_item12, price: parseInt(this.api.settings.menu_item12_price) }, { id: 13, item: this.api.settings.menu_item13, price: parseInt(this.api.settings.menu_item13_price) }, { id: 14, item: this.api.settings.menu_item14, price: parseInt(this.api.settings.menu_item14_price) }, { id: 15, item: this.api.settings.menu_item15, price: parseInt(this.api.settings.menu_item15_price) }, { id: 16, item: this.api.settings.menu_item16, price: parseInt(this.api.settings.menu_item16_price) }, { id: 17, item: this.api.settings.menu_item17, price: parseInt(this.api.settings.menu_item17_price) }, { id: 18, item: this.api.settings.menu_item18, price: parseInt(this.api.settings.menu_item18_price) }, { id: 19, item: this.api.settings.menu_item19, price: parseInt(this.api.settings.menu_item19_price) }, { id: 20, item: this.api.settings.menu_item20, price: parseInt(this.api.settings.menu_item20_price) }]; this.itemSeparator = this.api.settings.item_separator; this.menuTitle = this.getMenuTitle(); this.bgColor = this.getMenuBackgroundColor(); this.fontColor = this.getMenuFontColor(); this.muteForBroadcaster = this.api.settings.menu_mute_for_broadcaster; _PubSub.pubSub.subscribe('botStart', this.initMenu); _PubSub.pubSub.subscribe('userEnter', this.onEnter); _PubSub.pubSub.subscribe('newTip', this.onTip); // DELETE --- TESTING PURPOSES // pubSub.subscribe('newMsg', this.onTip); }; exports.TipMenu = TipMenu; },{"../core/PubSub":4,"../core/util":9}],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 (_this.api.settings.welcome_message !== 'Yes') return; if (_this.users.includes(cbUser.user)) return; _this.users.push(cbUser.user); _this.theMsg(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 = "".concat(_util.util.strRepeat("".concat(_fonts.ch.sp), _util.util.calcSpace(_fonts.design.head1, msg.length) / 2)).concat(_fonts.design.head1); var foot = "".concat(_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, "theMsg", function (cbUser) { var noticeStart = "".concat(_fonts.ch.sp, " \u2605 ").concat(_fonts.ch.tiny); var noticeEnd = "".concat(_fonts.ch.tiny, " \u2605 ").concat(_fonts.ch.sp); var userName = cbUser.user.trim().toLowerCase(); var msg = "".concat(cb.settings.enterMessage.replace(/\[user\]/g, userName)); var finalMsg = "".concat(noticeStart, " ").concat(msg, " ").concat(noticeEnd); // const bgGradient = `linear-gradient(to right, rgb(255,255,255) ${util.calcPer(finalMsg)}, rgb(62,60,65) ${util.calcPer(finalMsg)})`; var fontColor = _this.api.settings.enterMessageColor; var bgColor = _this.api.settings.enterMessagrBgColor; _this.api.sendNotice("".concat(finalMsg), userName, bgColor, fontColor, 'bold'); }); _defineProperty(this, "addSettings", function () { var settings = [{ name: 'enterPlaceholder', label: "".concat(_util.util.strRepeat('-', 98), "MESSAGE ON ENTER ").concat(_util.util.strRepeat('-', 164)), type: 'str', required: false }, { name: 'enterMessage', label: 'Welcome message to show', type: 'str', minLength: 1, maxLength: 255, defaultValue: 'Hi [user]. Welcome to the room. Type /menu to see the Tip Menu' }, { name: 'enterMessageColor', label: 'Font Color (HTML Hex Code)', type: 'str', minLength: 7, maxLength: 9, defaultValue: '#9F000F', required: false }, { name: 'enterMessageBgColor', label: 'Background Color (HTML Hex Code)', type: 'str', minLength: 7, maxLength: 9, defaultValue: '', required: false }]; 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}]},{},[10]);
© Copyright Chaturbate 2011- 2024. All Rights Reserved.