Apps Home
|
My Uploads
|
Create an App
testapptkkdev
Author:
tkktestdev
Description
Source Code
Launch App
Current Users
Created by:
Tkktestdev
App Images
(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 _Global = require("./Global"); 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 _Global.Global(this.api); this.plugins = []; // Design this.errorBgColor = '#f44336'; this.errorFontColor = '#fff'; this.botBgColor = '#f44336'; this.botFontColor = '#fff'; this.logo = ':xxxxzzzznnnnmmmc'; this.pubSub(); }; exports.App = App; },{"./Commands":3,"./Global":5,"./PubSub":6,"./Settings":7}],2:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.CbUser = 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 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 || null; this.color = null; }; exports.CbUser = CbUser; },{}],3:[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; var message = msg.m.split(' '); var _message = _toArray(message), command = _message[0], params = _message.slice(1); command = command.toLowerCase().substr(1); if (_this.getCommand(command)) { msg['X-Spam'] = true; 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":4}],4:[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("".concat(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("".concat(message), msg.user, bg, _this.txt); }); this.api = api; this.txt = '#ffffff'; }; exports.Error = Error; },{}],5:[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 _CbUser = require("./CbUser"); 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 () { _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) { if (msg.user === _this.api.room_slug) return; var user = _util.util.getUserByName(msg.user, _this.currentUsers); if (user && user.gender === null) { user.updateCbData(msg).setColor(_this.getColor(user)); } }); _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, has_tokens: true }); }); 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 === _this.api.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 _CbUser.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 !== true) { return 'Light Blue'; } return 'Grey'; }); _defineProperty(this, "updateUserOnLeave", function (cbUser) { if (cbUser.user === _this.api.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('newMsg', this.onMessage); _PubSub.pubSub.subscribe('newFollow', this.onFollow); _PubSub.pubSub.subscribe('unFollow', this.onUnfollow); }; exports.Global = Global; },{"./CbUser":2,"./PubSub":6,"./util":8}],6:[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; },{}],7:[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; },{}],8:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.util = void 0; var util = { /** * Return a user object from an array */ getUserByName: function getUserByName(userName, arr) { if (arr.some(function (obj) { return obj.user === userName; })) { return arr.find(function (obj) { return obj.user === userName; }); } return false; }, 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".concat(n); } return n; }, formatName: function formatName(name) { if (name === '') { return '---'; } return name.substring(0, 15); } }; exports.util = util; },{}],9:[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"); var _leaderboard = require("./plugins/leaderboard/leaderboard"); /** * Init App */ var app = new _App.App(cb); /** * Plugins */ exports.app = app; var appSettings = new _appSettings.AppSettings(cb); var tipCounter = new _tipCounter.TipCounter(cb); var tipMenu = new _tipMenu.TipMenu(cb); var rotatingNotices = new _rotatingNotices.RotatingNotices(cb); var enterMsg = new _welcomeMsg.EnterMsg(cb); var newFollower = new _newFollower.NewFollower(cb); var leaderboard = new _leaderboard.LB(cb); app.register(appSettings); app.register(tipCounter); app.register(tipMenu); app.register(rotatingNotices); app.register(enterMsg); app.register(newFollower); app.register(leaderboard); app.run(); },{"./core/App":1,"./plugins/appSettings":10,"./plugins/leaderboard/leaderboard":12,"./plugins/newFollower":13,"./plugins/rotatingNotices":14,"./plugins/tipCounter":15,"./plugins/tipMenu":16,"./plugins/welcomeMsg":17}],10:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.AppSettings = void 0; var _index = require("../index"); var _util = require("../core/util"); var _PubSub = require("../core/PubSub"); function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _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 _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } 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 AppSettings = function AppSettings(api) { var _this = this; _classCallCheck(this, AppSettings); _defineProperty(this, "noticeOnStart", function () { var plugins = _index.app.plugins; var notice = ":xxxxzzzznnnnmmmc Hi \uD835\uDC74\uD835\uDC70\uD835\uDC7A\uD835\uDC7A \uD835\uDC74\uD835\uDCD0\uD835\uDC79\uD835\uDC7A, I am your bot, ready to be of service. \n Type /marsHelp to see all my commands. Only you see my messages.\n Please visit my description page to read more about me. \n\n I have these bots available: \n"; plugins.forEach(function (plugin) { if (plugin.name === 'settings') { _util.util.removeFromArr(plugin, plugins); } }); plugins.forEach(function (plugin) { notice += "\u272E ".concat(plugin.name, " \n"); }); var devMessage = "\nBuilt by Takentheknee. Please contact me if you find bugs or have questions \u2661"; notice += devMessage; _this.api.sendNotice(notice, _this.api.room_slug, _index.app.botBgColor, _index.app.botFontColor); }); _defineProperty(this, "showAllCmds", function (params, msg) { var commands = _index.app.commands.get(); var notice = ":xxxxzzzznnnnmmmc ALL AVAILABLE COMMANDS \n"; Object.entries(commands).forEach(function (_ref) { var _ref2 = _slicedToArray(_ref, 2), cmd = _ref2[0], value = _ref2[1]; // value.params.forEach((param) => this.api.sendNotice(`${param.param}`)); if (value.params && value.paramRequired === true) { value.params.forEach(function (param) { notice += "/".concat(cmd, " ").concat(param.param, " ").concat(_util.util.calcLen("".concat(cmd, " ").concat(param.param), 26), " \u2022 ").concat(param.description, " \n"); }); } else if (value.params && value.paramRequired === false) { notice += "/".concat(cmd, " ").concat(_util.util.calcLen(cmd, 26), " \u2022 ").concat(value.description, " \n"); value.params.forEach(function (param) { notice += "/".concat(cmd, " ").concat(param.param, " ").concat(_util.util.calcLen("".concat(cmd, " ").concat(param.param), 26), " \u2022 ").concat(param.description, " \n"); }); } else { notice += "/".concat(cmd, " ").concat(_util.util.calcLen(cmd, 26), " \u2022 ").concat(value.description, " \n"); } }); notice = notice.substr(0, notice.length - 1); _this.api.sendNotice(notice, msg.user, _index.app.botBgColor, _index.app.botFontColor); }); _defineProperty(this, "addSettings", function () { var settings = [{ name: 'settings_blank_space_1', label: "".concat(_util.util.strRepeat('#', 40)), type: 'choice', required: false }, { name: 'placeholder_chooseApps', label: "CHOOSE FEATURES TO USE ".concat(_util.util.strRepeat('_', 25)), type: 'choice', required: false }, { name: 'settings_blank_space_2', label: "".concat(_util.util.strRepeat('#', 40)), type: 'choice', required: false }, { name: 'mars_tip_menu', label: 'Activate Tip Menu', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes' }, { name: 'rotating_notice', label: 'Activate Rotating Notices?', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes' }, { name: 'welcome_msg', label: 'Activate Welcome Message?', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes' }, { name: 'new_follower_msg', label: 'Activate New Follower Message?', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes' }, { name: 'lb_active', label: 'Activate Leaderboard', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'No' }, { name: 'settings_blank_space_3', label: ' ', type: 'choice', required: false }]; return settings; }); _defineProperty(this, "addCommands", function () { var commands = { marshelp: { func: _this.showAllCmds, permission: 'host', description: 'Show this menu\n', params: [] } }; return commands; }); this.name = "settings"; this.api = api; this.settings = this.addSettings(); this.commands = this.addCommands(); _PubSub.pubSub.subscribe('botStart', this.noticeOnStart); }; exports.AppSettings = AppSettings; },{"../core/PubSub":6,"../core/util":8,"../index":9}],11:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.TipUser = 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 TipUser = function TipUser(userName) { var _this = this; _classCallCheck(this, TipUser); _defineProperty(this, "updateTips", function (tip) { if (tip.is_anon) return; var amount = parseInt(tip.amount); if (_this.total_tips == null) { _this.total_tips = amount; } else { _this.total_tips += amount; } if (_this.highest_tip == null) { _this.highest_tip = amount; } else if (amount > _this.highest_tip) { _this.highest_tip = amount; } return _this; }); this.user = userName; this.total_tips = 0; this.highest_tip = 0; this.anonTips = 0; }; exports.TipUser = TipUser; },{}],12:[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 _TipUser = require("./TipUser"); 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 LB = function LB(api) { var _this = this; _classCallCheck(this, LB); _defineProperty(this, "initLB", function () { if (_this.api.settings.lb_active === 'Yes' && _this.rotateTime > 0) { _this.toggleLB(true); _this.api.setTimeout(_this.spamLB, _this.rotateTime * 60000); } if (_this.api.settings.showTips === 'Yes') { _this.showTips = true; } else { _this.showTips = false; } }); _defineProperty(this, "spamLB", function () { if (_this.lbActive && _this.arr.length > 0) { var leaderboard = _this.getLB(); _this.api.sendNotice(leaderboard, '', _this.bgColor, _this.fontColor); } _this.lbTimeout = _this.api.setTimeout(_this.spamLB, _this.rotateTime * 60000); }); _defineProperty(this, "updateLBonTip", function (tip) { var oldLB = _this.getCurrentLbNames(_this.arr); _this.updateUserOnTip(tip).sortLB(_this.arr); var newLB = _this.getCurrentLbNames(_this.arr); var lbChange = _this.checkLBchange(oldLB, newLB); if (_this.api.settings.showLBonTip === 'Yes') { var leaderboard = _this.getLB(); _this.api.sendNotice(leaderboard, '', _this.bgColor, _this.fontColor); } if (lbChange === true && _this.api.settings.showLBonTip !== 'No') { var _leaderboard = _this.getLB(); _this.api.sendNotice(_leaderboard, '', _this.bgColor, _this.fontColor); } }); _defineProperty(this, "updateUserOnTip", function (tip) { var roomUser = _util.util.getUserByName(tip.from_user, _this.arr); if (roomUser) { roomUser.updateTips(tip); } else { var newUser = new _TipUser.TipUser(tip.from_user); _this.arr.push(newUser); newUser.updateTips(tip); } return _this; }); _defineProperty(this, "getCurrentLbNames", 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; } 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, "getLB", function () { var str = "".concat(_this.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).concat(_util.util.calcLen(user, 20)).concat(_this.arr[i].total_tips, " tk\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).concat(_util.util.calcLen(_user, 20)).concat(_this.arr[_i2].total_tips, " tk\n"); } } } else { for (var _i3 = 0; _i3 < _this.lbLength; _i3++) { var _user2 = _util.util.formatName(_this.arr[_i3].user); str += "".concat(_this.lbNum[_i3]).concat(_user2).concat(_util.util.calcLen(_user2, 20)).concat(_this.arr[_i3].total_tips, " tk\n"); } } str = str.substr(0, str.length - 1); // str = strFormat(str); return str; }); _defineProperty(this, "appendTipsToMsg", function (msg) { if (msg.user === _this.api.room_slug) return; if (_this.showTips) { var user = _util.util.getUserByName(msg.user, _this.arr); if (user && user.total_tips > 0) { msg.m = "|".concat(user.total_tips, "| ").concat(msg.m); return msg; } } }); _defineProperty(this, "toggleLB", function (bool) { _this.lbActive = bool; }); _defineProperty(this, "lbCmd", function (params, msg) { if (!params[0]) { if (msg.user !== _this.api.room_slug && !_this.lbActive) return; var leaderboard = _this.getLB(); if (msg.user === _this.api.room_slug) { _this.api.sendNotice(leaderboard, msg.user, _this.bgColor, _this.fontColor); _this.api.sendNotice("".concat(_index.app.logo, " You are viewing the leaderboard privately"), _this.api.room_slug, _index.app.botBgColor, _index.app.botFontColor); } else { _this.api.sendNotice(leaderboard, msg.user, _this.bgColor, _this.fontColor); } } else if (params[0] === 'send' && msg.user === _this.api.room_slug) { var _leaderboard2 = _this.getLB(); _this.api.sendNotice(_leaderboard2, '', _this.bgColor, _this.fontColor); _this.api.sendNotice("".concat(_index.app.logo, " Leaderboard sent to the room"), _this.api.room_slug, _index.app.botBgColor, _index.app.botFontColor); } else if (params[0] === 'start' && msg.user === _this.api.room_slug) { _this.startLB(); } else if (params[0] === 'stop' && msg.user === _this.api.room_slug) { _this.stopLB(); } else if (params[0] === 'tips' && msg.user === _this.api.room_slug) { if (_this.showTips) { _this.showTips = false; var notice = "".concat(_index.app.logo, " Users tip amounts will not appear beside their name anymore"); _this.api.sendNotice(notice, msg.user, _index.app.botBgColor, _index.app.botFontColor); } else { _this.showTips = true; var _notice = "".concat(_index.app.logo, " Users tip amounts will now appear beside their name"); _this.api.sendNotice(_notice, msg.user, _index.app.botBgColor, _index.app.botFontColor); } } }); _defineProperty(this, "startLB", function () { if (_this.lbActive) { var notice = "".concat(_index.app.logo, " Leaderboard is already active. It won't start rotating while empty. Type: \"/lb send\" to send to room"); _this.api.sendNotice(notice, _this.api.room_slug, _index.app.botBgColor, _index.app.botFontColor); } else { _this.toggleLB(true); _this.spamLB(); var _notice2 = "".concat(_index.app.logo, " The leaderboard will start showing"); _this.api.sendNotice(_notice2, _this.api.room_slug, _index.app.botBgColor, _index.app.botFontColor); } }); _defineProperty(this, "stopLB", function () { if (_this.lbActive === false) { var notice = "".concat(_index.app.logo, " Leaderboard is already stopped"); _this.api.sendNotice(notice, _this.api.room_slug, _index.app.botBgColor, _index.app.botFontColor); } else { _this.toggleLB(false); _this.api.cancelTimeout(_this.lbTimeout); var _notice3 = "".concat(_index.app.logo, " The leaderboard will stop showing"); _this.api.sendNotice(_notice3, _this.api.room_slug, _index.app.botBgColor, _index.app.botFontColor); } }); _defineProperty(this, "addCommands", function () { var commands = { lb: { func: _this.lbCmd, permission: 'user', description: 'View the leaderboard privately', paramRequired: false, params: [{ param: 'send', description: 'Send the leaderboard to the room' }, { param: 'start', description: 'Start showing the leaderboard' }, { param: 'stop', description: 'Stop showing the leaderboard' }, { param: 'tips', description: 'Toggle whether to show users tip amount beside their name' }] } }; return commands; }); _defineProperty(this, "addSettings", function () { var settings = [{ name: 'leaderboard_blank_space_1', label: "".concat(_util.util.strRepeat('#', 40)), type: 'choice', required: false }, { name: 'leaderboard_placeholder', label: "LEADERBOARD ".concat(_util.util.strRepeat('_', 30)), type: 'choice', required: false }, { name: 'leaderboard_blank_space_2', label: "".concat(_util.util.strRepeat('#', 40)), type: 'choice', required: false }, { name: 'lbLength', label: 'How many users to show on leaderboard', type: 'int', minValue: 3, maxValue: 10, defaultValue: 3 }, { name: 'showLBonTip', label: 'Show Leaderboard on tip? ', type: 'choice', choice1: 'Yes', choice2: 'No', choice3: 'If leaderboard changes', defaultValue: 'No' }, { name: 'lb_rotate_time', label: 'How many minutes between posting leaderboard? ', type: 'int', minValue: 1, maxValue: 20, defaultValue: 8 }, { name: 'showTips', label: 'Show tip amount next to users name?', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'No' }]; return settings; }); this.name = 'Tippers Leaderboard'; this.api = api; this.commands = this.addCommands(); this.settings = this.addSettings(); this.arr = []; this.lbLength = parseInt(this.api.settings.lbLength); this.lbNum = [":aaavvvvccccxxx \u2605".concat(_util.util.strRepeat("\u205F\u205F", 3)), ":aaavvvvccccxxx2 \u2605".concat(_util.util.strRepeat("\u205F\u205F", 3)), ":aaavvvvccccxxx3 \u2605".concat(_util.util.strRepeat("\u205F\u205F", 3)), ":aaavvvvccccxxx4 \u2605".concat(_util.util.strRepeat("\u205F\u205F", 3)), ":aaavvvvcccczzz5 \u2605".concat(_util.util.strRepeat("\u205F\u205F", 3)), ":aaavvvvcccczzz6 \u2605".concat(_util.util.strRepeat("\u205F\u205F", 3)), ":aaavvvvccccxxx7 \u2605".concat(_util.util.strRepeat("\u205F\u205F", 3)), ":aaavvvvccccxxx8 \u2605".concat(_util.util.strRepeat("\u205F\u205F", 3)), ":aaavvvvccccxxx9 \u2605".concat(_util.util.strRepeat("\u205F\u205F", 3)), ":aaavvvvccccxxx10 \u2605".concat(_util.util.strRepeat("\u205F\u205F", 3))]; this.rotateTime = parseInt(this.api.settings.lb_rotate_time); this.lbActive = false; this.lbTimeout = null; this.showTips = false; // Design this.title = ':aaabbbbcccxzz'; this.bgColor = ''; this.fontColor = ''; _PubSub.pubSub.subscribe('newTip', this.updateLBonTip); _PubSub.pubSub.subscribe('newMsg', this.appendTipsToMsg); this.initLB(); }; exports.LB = LB; },{"../../core/PubSub":6,"../../core/util":8,"../../index":9,"./TipUser":11}],13:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.NewFollower = void 0; var _util = require("../core/util"); var _index = require("../index"); 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_msg !== '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_msg !== '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, "muteUnfollowers", function (msg) { if (_this.api.settings.mute_unfollowers === 'No') return; var message = msg; if (_this.unFollowArr.includes(message.user)) { message['X-Spam'] = true; message.m = "Hi ".concat(message.user, ", Follow me again to be unmuted"); } return message; }); _defineProperty(this, "showMsg", function (user) { var noticeStart = "\u205F\u205F \u2605 \uD83D\uDF9D"; var noticeEnd = "\uD83D\uDF9D \u2605 \u205F\u205F"; var notice = "".concat(noticeStart, " ").concat(user.user, " is now following \uD835\uDC40\uD835\uDC3C\uD835\uDC46\uD835\uDC46 \uD835\uDC40\uD835\uDC9C\uD835\uDC45\uD835\uDC46 ").concat(noticeEnd); var bgGradient = "linear-gradient(to right, rgb(255,255,255) ".concat(_util.util.calcPer(notice), ", ").concat(_this.bgColor, " ").concat(_util.util.calcPer(notice), ")"); if (!_this.followArr.includes(user.user)) { if (_this.api.settings.showNotice === 'Just Me') { _this.api.sendNotice("".concat(notice), _this.api.room_slug, bgGradient, _this.fontColor, 'bold'); } else { _this.api.sendNotice("".concat(notice), '', bgGradient, _this.fontColor, 'bold'); } } }); _defineProperty(this, "getFollowerData", function () { var numFollowers; _this.api.getRoomOwnerData(function (ownerData) { if (ownerData.success) { numFollowers = ownerData.data.followers; _this.showFollowerData(numFollowers); return; } numFollowers = "Chaturbate couldn't calculate your followers"; _this.showFollowerData(numFollowers); }); }); _defineProperty(this, "showFollowerData", function (followers) { var numFollowers = followers; var newFollowers = _this.trueArr.length; var notice = "".concat(_index.app.logo, " Follower Data:\n Total Followers: ").concat(numFollowers, "\n New Followers this session: ").concat(newFollowers); _this.api.sendNotice("".concat(notice), _this.api.room_slug, _index.app.botBgColor, _index.app.botFontColor); }); _defineProperty(this, "addCommands", function () { var commands = { followers: { func: _this.getFollowerData, permission: 'host', description: 'View your follower data\n', params: [] } }; return commands; }); _defineProperty(this, "addSettings", function () { var settings = [{ name: 'follower_blank_space_1', label: "".concat(_util.util.strRepeat('#', 40)), type: 'choice', required: false }, { name: 'new_follower_placeholder', label: "NEW FOLLOWER ".concat(_util.util.strRepeat('_', 30)), type: 'choice', required: false }, { name: 'follower_blank_space_2', label: "".concat(_util.util.strRepeat('#', 40)), type: 'choice', 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: 'Custom font color (HTML Hex Code)', type: 'str', minLength: 7, maxLength: 9, defaultValue: '', required: false }, { name: 'follower_bg_color', label: 'Custom background color (HTML Hex Code)', type: 'str', minLength: 7, maxLength: 9, defaultValue: '', required: false }, { name: 'follower_blank_space_3', label: ' ', type: 'choice', required: false }]; return settings; }); this.name = 'New Follower Message'; this.api = api; this.settings = this.addSettings(); this.commands = this.addCommands(); this.followArr = []; this.trueArr = []; this.unFollowArr = []; // Colors this.bgColor = this.api.settings.follower_bg_color || '#008000'; this.fontColor = this.api.settings.follower_font_color || '#fff'; _PubSub.pubSub.subscribe('newFollow', this.followerInit); _PubSub.pubSub.subscribe('unFollow', this.unfollowerInit); _PubSub.pubSub.subscribe('newMsg', this.muteUnfollowers); } /** * * Event based functions * */ ; exports.NewFollower = NewFollower; },{"../core/PubSub":6,"../core/util":8,"../index":9}],14:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.RotatingNotices = 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 RotatingNotices = function RotatingNotices(api) { var _this = this; _classCallCheck(this, RotatingNotices); _defineProperty(this, "initSpam", function () { if (_this.api.settings.rotating_notice !== 'Yes') return; if (_this.rotateTime > 0) { _this.getNotices(); _this.api.setTimeout(_this.spamLoop, _this.rotateTime * 60000); _this.noticesActive = true; } }); _defineProperty(this, "startSpam", function () { if (_this.api.settings.rotating_notice !== 'Yes') return; if (_this.rotateTime > 0) { _this.api.setTimeout(_this.spamLoop, _this.rotateTime * 60000); _this.noticesActive = true; } }); _defineProperty(this, "spamLoop", function () { if (_this.activeNotices.length > 0) { // loop through the non empty messages while (_this.activeNotices[_this.i] < _this.activeNotices.length) { _this.i++; } var notice = "".concat(_this.activeNotices[_this.i].msg); _this.sendNotice(notice); _this.timeout = _this.api.setTimeout(_this.spamLoop, _this.rotateTime * 60000); _this.i++; if (_this.i === _this.activeNotices.length) { _this.i = 0; } } else { _this.noticesActive = false; } }); _defineProperty(this, "getNotices", function () { _this.msgArray.forEach(function (msg) { msg.trim(); if (msg.length > 1) { var id = _this.activeNotices.length + 1; _this.activeNotices.push({ id: id, msg: msg }); } }); }); _defineProperty(this, "sendNotice", function (notice) { var style = { bgColor: _this.bgColor, fontColor: _this.fontColor, weight: _this.fontWeight }; if (_this.whoSeesNotices === 'Only Colored Users, not Greys') { _this.noticeToNonGreys(notice, style); } else if (_this.whoSeesNotices === 'Everyone Except Anonymous Users') { _this.noticeToCurrentUsers(notice, style); } else if (_this.whoSeesNotices === 'Everyone Including Anonymous Users') { _this.api.sendNotice("".concat(notice), '', _this.bgColor, _this.fontColor, _this.fontWeight); } }); _defineProperty(this, "noticeToNonGreys", function (notice, style) { var bgColor = style.bgColor, fontColor = style.fontColor, weight = style.weight; _index.app.global.currentUsers.forEach(function (user) { if (user.color !== 'Grey') { _this.api.sendNotice("".concat(notice), user.user, bgColor, fontColor, weight); } }); if (_this.muteBroadcasterNotice === false) { _this.api.sendNotice("".concat(notice), _this.api.room_slug, bgColor, fontColor, weight); } }); _defineProperty(this, "noticeToCurrentUsers", function (notice, style) { var bgColor = style.bgColor, fontColor = style.fontColor, weight = style.weight; _index.app.global.currentUsers.forEach(function (user) { _this.api.sendNotice("".concat(notice), user.user, bgColor, fontColor, weight); }); if (_this.muteBroadcasterNotice === false) { _this.api.sendNotice("".concat(notice), _this.api.room_slug, bgColor, fontColor, weight); } }); _defineProperty(this, "noticesCmd", function (params, msg) { if (_this.api.settings.rotating_notice !== 'Yes') return; if (!params[0]) { _this.listNotices(msg); } else if (params[0] === 'start') { _this.startNotices(msg); } else if (params[0] === 'stop') { _this.stopNotices(msg); } else if (params[0] === 'mute') { if (_this.whoSeesNotices === 'Everyone Including Anonymous Users') { _this.api.sendNotice("".concat(_index.app.logo, " You cannot mute notices when they're showing to Anonymous users. Relaunch bot and change \"Who sees notices?\" if you'd like to mute them"), _this.api.room_slug, _index.app.errorBgColor, _index.app.errorFontColor); return; } _this.muteBroadcasterNotice = true; _this.api.sendNotice("".concat(_index.app.logo, " Notices are now muted for you. They're still broadcasting to ").concat(_this.whoSeesNotices), msg.user, _index.app.botBgColor, _index.app.botFontColor); } else if (params[0] === 'unmute') { if (_this.whoSeesNotices === 'Everyone Including Anonymous Users') { _this.api.sendNotice("".concat(_index.app.logo, " Notices are unmuted and showing to ").concat(_this.whoSeesNotices), msg.user, _index.app.botBgColor, _index.app.botFontColor); return; } _this.muteBroadcasterNotice = false; _this.api.sendNotice("".concat(_index.app.logo, " Notices will now appear for you"), msg.user, _index.app.botBgColor, _index.app.botFontColor); } else if (params[0] === 'time') { _this.changeRotateTime(params, msg); } }); _defineProperty(this, "listNotices", function (msg) { var message = "".concat(_index.app.logo, " 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, _index.app.botBgColor, _index.app.botFontColor); }); _defineProperty(this, "addNotice", function (params, msg) { if (_this.api.settings.rotating_notice !== 'Yes') return; var notice = params.join(' '); if (notice) { var arr = _this.activeNotices; var id; if (arr.length < 1) { id = 1; } else { _this.sortArrByID(arr); id = arr[arr.length - 1].id + 1; } _this.activeNotices.push({ id: id, msg: notice }); _this.api.sendNotice("".concat(_index.app.logo, " Notice added to rotating notices: ").concat(notice), msg.user, _index.app.botBgColor, _index.app.botFontColor); if (_this.noticesActive === false) { _this.api.sendNotice("".concat(_index.app.logo, " Notices are currently off. Type /notices start"), msg.user, _index.app.botBgColor, _index.app.botFontColor); } } else { _this.api.sendNotice("".concat(_index.app.logo, " \uD83D\uDED1 Error: Please include a notice after '/addnotice' command \uD83D\uDED1"), msg.user, _index.app.errorBgColor, _index.app.errorFontColor); } }); _defineProperty(this, "removeNotice", function (params, msg) { if (_this.api.settings.rotating_notice !== 'Yes') return; var id = parseInt(params[0]); if (!id) { _this.api.sendNotice("".concat(_index.app.logo, " \uD83D\uDED1 Error: Please use ID number to remove a notice. eg /rmnotice 5 \uD83D\uDED1"), msg.user, _index.app.errorBgColor, _index.app.errorFontColor); 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 if (noticeObj) { var index = _this.activeNotices.indexOf(noticeObj); _this.activeNotices.splice(index, 1); _this.api.sendNotice("".concat(_index.app.logo, " Removed Notice: ").concat(noticeObj.msg), msg.user, _index.app.botBgColor, _index.app.botFontColor); } else { _this.api.sendNotice("".concat(_index.app.logo, " \uD83D\uDED1 Error: Could not find that item \uD83D\uDED1"), msg.user, _index.app.errorBgColor, _index.app.errorFontColor); } }); _defineProperty(this, "startNotices", function (msg) { if (_this.noticesActive === true) { var _notice = "".concat(_index.app.logo, " Notices are already running. Rotating time is ").concat(_this.rotateTime, " mins."); _this.api.sendNotice("".concat(_notice), msg.user, _index.app.botBgColor, _index.app.botFontColor); return; } if (_this.rotateTime < 1) { _this.rotateTime = 1; var _notice2 = "".concat(_index.app.logo, " The interval time for notices was set to 0 in settings. I've now set it to 1 minute. Type \"/notices time [number]\" to change interval time"); _this.api.sendNotice("".concat(_notice2), msg.user, _index.app.botBgColor, _index.app.botFontColor); } _this.startSpam(); var notice = "".concat(_index.app.logo, " Rotating Notices have started. Interval time is ").concat(_this.rotateTime, " mins. Type: \"/notices stop\" to stop them"); _this.api.sendNotice("".concat(notice), msg.user, _index.app.botBgColor, _index.app.botFontColor); }); _defineProperty(this, "stopNotices", function (msg) { _this.api.cancelTimeout(_this.timeout); var notice = "".concat(_index.app.logo, " Rotating Notices have stopped. Type: \"/notices start\" to start them again"); _this.api.sendNotice("".concat(notice), msg.user, _index.app.botBgColor, _index.app.botFontColor); _this.noticesActive = false; }); _defineProperty(this, "changeRotateTime", function (params, msg) { if (!params[1]) { _this.api.sendNotice("".concat(_index.app.logo, " \uD83D\uDED1 Error: Ensure command is typed like this: \"/notices time 3\" \uD83D\uDED1"), msg.user, _index.app.errorBgColor, _index.app.errorFontColor); } else { var time = parseInt(params[1]); if (!time) { _this.api.sendNotice("".concat(_index.app.logo, " \uD83D\uDED1 Error: Ensure command is typed like this: \"/notices time 3\" \uD83D\uDED1"), msg.user, _index.app.errorBgColor, _index.app.errorFontColor); } else { _this.rotateTime = time; _this.api.sendNotice("".concat(_index.app.logo, " Notices interval is now set to ").concat(time, " mins"), msg.user, _index.app.botBgColor, _index.app.botFontColor); } } }); _defineProperty(this, "sortArrByID", function (arr) { arr.sort(function (a, b) { return a.id - b.id; }); }); _defineProperty(this, "addCommands", function () { var commands = { notices: { func: _this.noticesCmd, permission: 'host', description: 'View a list of rotating notice and ID number', paramRequired: false, params: [{ param: 'mute', description: 'Mute notices for you only. They still broadcast to the room' }, { param: 'unmute', description: 'Unmute notices for you only' }, { param: 'start', description: 'Start rotating notices' }, { param: 'stop', description: 'Stop rotating notices' }, { param: 'time [num]', description: 'Change interval time of notices. eg. /notice time 3' }] }, addnotice: { func: _this.addNotice, permission: 'host', description: '', paramRequired: true, params: [{ param: '[text]', description: 'Add new notice to rotating list' }] }, rmnotice: { func: _this.removeNotice, permission: 'host', description: '', paramRequired: true, params: [{ param: '[ID]', description: 'Remove a notice from rotating list. Get ID using /notices command\n' }] } }; return commands; }); _defineProperty(this, "addSettings", function () { var settings = [{ name: 'notices_blank_space_1', label: "".concat(_util.util.strRepeat('#', 40)), type: 'choice', required: false }, { name: 'placeholder_rotatingNotices', label: "ROTATING NOTICES ".concat(_util.util.strRepeat('_', 30)), type: 'choice', required: false }, { name: 'notices_blank_space_2', label: "".concat(_util.util.strRepeat('#', 40)), type: 'choice', required: false }, { name: 'who_sees_notices', label: 'Who sees notices?', type: 'choice', choice1: 'Only Colored Users, not Greys', choice2: 'Everyone Except Anonymous Users', choice3: 'Everyone Including Anonymous Users', defaultValue: 'Everyone Including Anonymous Users' }, { name: 'notice_time_interval', label: 'Delay between notices being displayed (Time in minutes. 0 is off)', type: 'int', minValue: 0, maxValue: 999, defaultValue: 3 }, { name: 'notice_bg_color', label: 'Custom background Color (HTML hex code)', type: 'str', defaultValue: '', required: false }, { name: 'notice_font_color', label: 'Custom font color (HTML hex code)', type: 'str', defaultValue: '', required: false }, { name: 'notice_font_weight', label: 'Weight of font', type: 'choice', choice1: 'bold', choice2: 'normal', defaultValue: 'bold' }, { name: 'rotating_notice_1', label: 'Notice 1', type: 'str', defaultValue: 'loser tax 3tk', required: false }, { name: 'rotating_notice_2', label: 'Notice 2', type: 'str', defaultValue: 'chastity tax 13tk', required: false }, { name: 'rotating_notice_3', label: 'Notice 3', type: 'str', defaultValue: ':Twitter20 twitter @yesmissmars', required: false }, { name: 'rotating_notice_4', label: 'Notice 4', type: 'str', defaultValue: 'small dick tax 6tk', required: false }, { name: 'rotating_notice_5', label: 'Notice 5', type: 'str', defaultValue: ':onlyfans20 sub to https://onlyfans.com/yesmissmars', required: false }, { name: 'rotating_notice_6', label: 'Notice 6', type: 'str', defaultValue: ':Instagram20 follow me on https://www.instagram.com/yesmissmars/', required: false }, { name: 'rotating_notice_7', label: 'Notice 7', type: 'str', defaultValue: 'pathetic tax 9tk', required: false }, { name: 'rotating_notice_8', label: 'Notice 8', type: 'str', defaultValue: 'BIRTHDAY AUGUST 20TH: wishlistr.com/yesmissmars', required: false }, { name: 'rotating_notice_9', label: 'Notice 9', type: 'str', required: false }, { name: 'rotating_notice_10', label: 'Notice 10', type: 'str', required: false }, { name: 'notices_blank_space_3', label: ' ', type: 'choice', required: false }]; return settings; }); this.name = 'Rotating Notices'; this.api = api; this.settings = this.addSettings(); this.commands = this.addCommands(); // Arrays this.msgArray = [this.api.settings.rotating_notice_1, this.api.settings.rotating_notice_2, this.api.settings.rotating_notice_3, this.api.settings.rotating_notice_4, this.api.settings.rotating_notice_5, this.api.settings.rotating_notice_6, this.api.settings.rotating_notice_7, this.api.settings.rotating_notice_8, this.api.settings.rotating_notice_9, this.api.settings.rotating_notice_10]; this.activeNotices = []; // Variables this.muteBroadcasterNotice = false; this.timeout = null; this.rotateTime = parseInt(this.api.settings.notice_time_interval); this.noticesActive = false; this.whoSeesNotices = this.api.settings.who_sees_notices; this.i = 0; // Design this.bgColor = this.api.settings.notice_bg_color || ''; this.fontColor = this.api.settings.notice_font_color || '#9F000F'; this.fontWeight = this.api.settings.notice_font_weight; this.initSpam(); } /** * * Core Functions * */ ; exports.RotatingNotices = RotatingNotices; },{"../core/util":8,"../index":9}],15:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.TipCounter = void 0; var _util = require("../core/util"); var _index = require("../index"); 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, "renderPanel", function (tip) { var user = tip.from_user; var amount = tip.amount; if (tip.is_anon_tip) { user = 'Anonymous'; } _this.setTotalTipped(amount).setLastTip(user, amount); if (amount > _this.highTipAmount) { _this.setHighTip(user, amount); } if (_this.goalTips >= _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, "initAd", function () { if (_this.api.settings.goal_ad > 0) { var noticeStart = "\u2605 \uD83D\uDF9D"; var noticeEnd = "\uD83D\uDF9D \u2605 \u205F\u205F"; _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), '', _this.noticeBgColor, _this.noticeFontColor, 'bold'); _this.api.setTimeout(_this.initAd, _this.api.settings.goal_ad * 61000); } }); _defineProperty(this, "onReachGoal", function () { var notice = "".concat(_index.app.logo, " Goal \"").concat(_this.goalName, ": ").concat(_this.goal, "\" has been reached. You can start a new goal by typing: /newgoal 1000 name of goal"); _this.api.sendNotice("".concat(notice), _this.api.room_slug, _index.app.botBgColor, _index.app.botFontColor, 'bold'); }); _defineProperty(this, "setTotalTipped", function (amount) { var tipAmount = parseInt(amount); var goalTipsBeforeTip = _this.goalTips; if (tipAmount + _this.goalTips >= _this.goal) { _this.goalTips = _this.goal; _this.totalTipped += tipAmount; } else { _this.goalTips += tipAmount; _this.totalTipped += tipAmount; } var goalTipsAfterTip = _this.goalTips; if (goalTipsBeforeTip < goalTipsAfterTip && _this.goalTips === _this.goal) { // goal has been reached _this.onReachGoal(); } return _this; }); _defineProperty(this, "setHighTip", function (name, amount) { _this.highTipName = name; _this.highTipAmount = amount; return _this; }); _defineProperty(this, "setLastTip", function (name, amount) { _this.lastTipName = name; _this.lastTipAmount = amount; return _this; }); _defineProperty(this, "thankYouPanel", function () { // const thankYouImage = 'f09e5f39-f8ca-4df3-ba49-a0f447c15383'; // !!! REMOVE - TEST BED ONLY!!! var thankYouImage = 'c53ba21f-0895-41af-86a9-cf53faee3a94'; return { template: 'image_template', layers: [{ type: 'image', fileID: thankYouImage }] }; }); _defineProperty(this, "goalReachedPanel", function () { // const goalReachedImage = '1cbc0daa-a36e-45c6-9f51-b11e913f77a3'; // !!! REMOVE - TEST BED ONLY !!! var goalReachedImage = '9c81876d-9de9-4d15-b8d2-660d4a85d6f1'; return { template: 'image_template', layers: [{ type: 'image', fileID: goalReachedImage }, { type: 'text', text: "".concat(_this.totalTipped, " tk"), top: 52, left: 108, 'font-size': 10, color: '#b3b3b3cc', 'font-weight': 'bold', 'font-style': 'italic' }] }; }); _defineProperty(this, "mainPanel", function () { var bgImage = _this.bgImageChoice(); if (_this.api.settings.bgImage === 'Standard Panel') { return { template: '3_rows_of_labels', row1_label: _this.row1Label, row1_value: _this.goalTips, row2_label: _this.row2Label, row2_value: "".concat(_this.formatUsername(_this.highTipName), " (").concat(_this.highTipAmount, ")"), row3_label: _this.row3Label, row3_value: "".concat(_this.formatUsername(_this.lastTipName), " (").concat(_this.lastTipAmount, ")") }; } return { template: 'image_template', layers: [{ type: 'image', fileID: bgImage }, { type: 'text', text: _this.row1Label, top: 5, left: 8, 'font-size': _this.fontSize, color: _this.panelFontColor, 'font-weight': 'bold' }, { type: 'text', text: _this.row2Label, top: 29, left: 8, 'font-size': _this.fontSize, color: _this.panelFontColor, 'font-weight': 'bold' }, { type: 'text', text: _this.row3Label, top: 52, left: 8, 'font-size': _this.fontSize, color: _this.panelFontColor, 'font-weight': 'bold' }, { type: 'text', text: "".concat(_this.goalTips, "/").concat(_this.goal), top: 5, left: 108, 'font-size': _this.fontSize, color: _this.panelFontColor, 'font-weight': 'bold' }, { type: 'text', text: "".concat(_this.formatUsername(_this.highTipName), " (").concat(_this.highTipAmount, ")"), top: 29, left: 108, 'font-size': _this.fontSize, color: _this.panelFontColor, 'font-weight': 'normal' }, { type: 'text', text: "".concat(_this.formatUsername(_this.lastTipName), " (").concat(_this.lastTipAmount, ")"), top: 51, left: 108, 'font-size': _this.fontSize, color: _this.panelFontColor, 'font-weight': 'normal' }] }; }); _defineProperty(this, "anonPanel", function () { return { template: '3_rows_11_21_31', row1_value: _this.api.settings.anonLine1, row2_value: _this.api.settings.anonLine2, row3_value: _this.api.settings.anonLine3 }; }); _defineProperty(this, "bgImageChoice", function () { if (_this.api.settings.bgImage === 'Miss Mars') { return '4b1c6ca6-9db0-465b-9e92-eee7bd0377c2'; } if (_this.api.settings.bgImage === 'Custom Image') { return _this.api.settings.customBg; } }); _defineProperty(this, "formatUsername", function (val) { if (val === '') { return '-----'; } return val.substring(0, 12); }); _defineProperty(this, "resetGoal", function (params, msg) { if (msg.user !== _this.api.room_slug) return; var noticeStart = "\u2605 \uD83D\uDF9D"; var noticeEnd = "\uD83D\uDF9D \u2605 \u205F\u205F"; 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.goalTips = 0; _this.highTipName = '-----'; _this.highTipAmount = 0; _this.lastTipName = '-----'; _this.lastTipAmount = 0; _this.api.sendNotice("".concat(noticeStart, " \uD835\uDC40\uD835\uDC3C\uD835\uDC46\uD835\uDC46 \uD835\uDC40\uD835\uDC9C\uD835\uDC45\uD835\uDC46 has set a new goal of \"").concat(_this.goalName, "\" ").concat(_this.goal, " tokens ").concat(noticeEnd), '', _this.noticeBgColor, _this.noticeFontColor, 'bold'); _this.drawMainPanel(); }); _defineProperty(this, "addSettings", function () { var settings = [{ name: 'counter_blank_space_1', label: "".concat(_util.util.strRepeat('#', 40)), type: 'choice', required: false }, { name: 'placeholder1', label: "SETUP GOAL ".concat(_util.util.strRepeat('_', 30)), type: 'choice', required: false }, { name: 'counter_blank_space_2', label: "".concat(_util.util.strRepeat('#', 40)), type: 'choice', required: false }, { name: 'goalAmount', label: 'Goal Amount', type: 'int', minValue: 1, defaultValue: 100 }, { name: 'goalName', label: 'Name of the goal', type: 'str' }, { name: 'goal_ad', label: 'Show advertisement every ? minutes (0 is off)', type: 'int', minValue: 0, defaultValue: '6' }, // { // name: 'placeholder2', // label: // `GOAL PANEL DESIGN ${util.strRepeat('_', 30)}`, // type: 'choice', // 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: 'panel_font_color', // label: // 'Custom font color in the panel (HTML Hex Code)', // type: 'str', // defaultValue: '', // required: false, // }, // { // name: 'counter_blank_space_3', // label: ' ', // type: 'choice', // required: false, // }, ]; return settings; }); _defineProperty(this, "addCommands", function () { var commands = { newgoal: { func: _this.resetGoal, permission: 'host', description: 'Start a new goal, same amount and name as last goal', paramRequired: false, params: [{ param: '[num]', description: 'Start new goal with new amount, same name. eg. /newgoal 1000' }, { param: '[num] [name]', description: 'Start new goal with new amount, new name. eg /newgoal 1000 Drain Yourself\n' }] } }; return commands; }); this.name = 'Miss Mars Goal App'; this.api = api; this.settings = this.addSettings(); this.commands = this.addCommands(); this.fontSize = 11; this.totalTipped = 0; this.goalTips = 0; this.highTipName = ''; this.highTipAmount = 0; this.lastTipName = ''; this.lastTipAmount = 0; this.goal = parseInt(this.api.settings.goalAmount); this.goalName = this.api.settings.goalName; this.goalReached = false; // Design this.noticeFontColor = '#9F000F'; this.noticeBgColor = ''; this.panelFont = ''; this.panelFontColor = this.api.settings.panel_font_color || '#FCD0A1B3'; this.row1Label = this.api.settings.tips || 'Received / Goal'; this.row2Label = this.api.settings.highestTip || 'Highest Tip'; this.row3Label = this.api.settings.latestTip || 'Latest Tip'; _PubSub.pubSub.subscribe('botStart', this.drawMainPanel); _PubSub.pubSub.subscribe('newTip', this.renderPanel); this.initAd(); } /** * * Event based funtions * */ ; exports.TipCounter = TipCounter; },{"../core/PubSub":6,"../core/util":8,"../index":9}],16:[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"); 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; } /** * COMMANDS: * /menu * /menu mute * /menu unmute * /addmenu [num] [new item] * /rmmenu [id] * /menuid */ var TipMenu = function TipMenu(api) { var _this = this; _classCallCheck(this, TipMenu); _defineProperty(this, "initMenu", function () { if (_this.api.settings.mars_tip_menu !== 'Yes') return; _this.getActiveItems(); if (_this.api.settings.sort_menu_by_price === 'Yes') { _this.sortArrByPrice(_this.activeMenu); } // if (this.api.settings.mute_broadcaster_notice === 'Hide For Me') { // this.muteBroadcasterNotice = true; // } else { // this.muteBroadcasterNotice = false; // } _this.api.setTimeout(_this.rotatingMenuNotice, 20000); _this.api.setTimeout(_this.rotateRandomNotice, 70000); }); _defineProperty(this, "onTip", function (tip) { if (_this.api.settings.mars_tip_menu !== 'Yes') return; var amount = parseInt(tip.amount); var tipper = tip.from_user.toUpperCase(); if (tip.is_anon_tip) { tipper = 'Anonymous'; } var itemsTippedFor = _this.activeMenu.filter(function (menuItem) { return menuItem.price === amount; }); // const itemTippedFor = this.activeMenu.find((menuItem) => menuItem.price === amount); itemsTippedFor.forEach(function (itemTippedFor) { if (itemTippedFor) { var notice = "".concat(_this.itemSeparator, " ").concat(tipper, " tipped ").concat(amount, " tokens for \"").concat(itemTippedFor.item.toUpperCase(), "\" ").concat(_this.itemSeparator); var style = { bgColor: _this.menuBgColor, fontColor: _this.menuFontColor, weight: 'bold' }; if (_this.whoSeesMenu === 'Only Colored Users, not Greys') { _this.noticeToNonGreys(notice, style); } else if (_this.whoSeesMenu === 'Everyone Except Anonymous Users') { _this.noticeToCurrentUsers(notice, style); } else if (_this.whoSeesMenu === 'Everyone Including Anonymous Users') { _this.api.sendNotice("".concat(notice), '', _this.menuBgColor, _this.menuFontColor, 'bold'); } // this.api.sendNotice(`${notice}`, this.api.room_slug, this.menuBgColor, this.menuFontColor, 'bold'); if (itemTippedFor.secretMessage) { _this.api.sendNotice("".concat(itemTippedFor.secretMessage), tip.from_user, _this.menuBgColor, _this.menuFontColor, 'bold'); _this.api.sendNotice("Sent ".concat(tip.from_user, ": ").concat(itemTippedFor.secretMessage), _this.api.room_slug, _this.menuBgColor, _this.menuFontColor, 'bold'); } } }); }); _defineProperty(this, "onEnter", function (user) { if (_this.api.settings.mars_tip_menu !== 'Yes') return; if (user.has_tokens && _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), user.user, _this.randomItemBg, _this.randomItemFont); } }); _defineProperty(this, "rotatingMenuNotice", function () { if (_this.menuRotateTime > 0) { _this.sendMenu(); _this.menuTimeout = _this.api.setTimeout(_this.rotatingMenuNotice, _this.menuRotateTime * 64000); } }); _defineProperty(this, "rotateRandomNotice", function () { if (_this.api.settings.rotate_random_item !== 'Yes') return; if (_this.menuRotateTime > 0 && _this.activeMenu.length > 0) { var randomNum = _this.randomRange(0, _this.activeMenu.length - 1); var randomItem = _this.activeMenu[randomNum]; var randomItemStr = "\"".concat(randomItem.item.toUpperCase(), "\": ").concat(randomItem.price, " TOKENS."); var notice = "\uD835\uDC74\uD835\uDC70\uD835\uDC7A\uD835\uDC7A \uD835\uDC74\uD835\uDCD0\uD835\uDC79\uD835\uDC7A' Tip Menu is active! ".concat(randomItemStr, " Type /menu to see full menu"); var style = { bgColor: _this.randomItemBg, fontColor: _this.randomItemFont, weight: '' }; if (_this.whoSeesMenu === 'Only Colored Users, not Greys') { _this.noticeToNonGreys(notice, style); } else if (_this.whoSeesMenu === 'Everyone Except Anonymous Users') { _this.noticeToCurrentUsers(notice, style); } else if (_this.whoSeesMenu === 'Everyone Including Anonymous Users') { _this.api.sendNotice("".concat(notice), '', _this.randomItemBg, _this.randomItemFont); } _this.randomItemTimeout = _this.api.setTimeout(_this.rotateRandomNotice, 5 * 60000); } }); _defineProperty(this, "noticeToNonGreys", function (notice, style) { var bgColor = style.bgColor, fontColor = style.fontColor, weight = style.weight; _index.app.global.currentUsers.forEach(function (user) { if (user.color !== 'Grey') { _this.api.sendNotice("".concat(notice), user.user, bgColor, fontColor, weight); } }); if (_this.muteBroadcasterNotice === false) { _this.api.sendNotice("".concat(notice), _this.api.room_slug, bgColor, fontColor, weight); } }); _defineProperty(this, "noticeToCurrentUsers", function (notice, style) { var bgColor = style.bgColor, fontColor = style.fontColor, weight = style.weight; _index.app.global.currentUsers.forEach(function (user) { _this.api.sendNotice("".concat(notice), user.user, bgColor, fontColor, weight); }); if (_this.muteBroadcasterNotice === false) { _this.api.sendNotice("".concat(notice), _this.api.room_slug, bgColor, fontColor, weight); } }); _defineProperty(this, "getMenu", function () { if (_this.api.settings.mars_tip_menu !== 'Yes') return; var menu = ''; if (_this.api.settings.menu_view === 'Single Line') { // Get Menu Title or Graphic if (_this.menuTitle.length > 2) { 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 if (_this.menuTitle.length > 2) { menu += "".concat(_this.menuTitle, "\n"); } // 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 \n"); }); } // remove last new line menu = menu.substr(0, menu.length - 1); } return menu; }); _defineProperty(this, "sendMenu", function () { var menu = _this.getMenu(); var style = { bgColor: _this.menuBgColor, fontColor: _this.menuFontColor, weight: 'bold' }; if (_this.whoSeesMenu === 'Only Colored Users, not Greys') { _this.noticeToNonGreys(menu, style); } else if (_this.whoSeesMenu === 'Everyone Except Anonymous Users') { _this.noticeToCurrentUsers(menu, style); } else if (_this.whoSeesMenu === 'Everyone Including Anonymous Users') { _this.api.sendNotice("".concat(menu), '', _this.menuBgColor, _this.menuFontColor, 'bold'); } }); _defineProperty(this, "getActiveItems", function () { _this.menu.forEach(function (obj) { obj.item.trim(); if (obj.item.length > 2) { _this.activeMenu.push(obj); } }); }); _defineProperty(this, "getMenuTitle", function () { var menuTitle = ''; var marsTitle = _this.api.settings.menu_title; if (marsTitle === 'Miss Mars Menu Red') { // menuTitle = ':aaaaaabbbbbcccc14'; menuTitle = ':aaaaaabbbbbcccc16'; } else if (marsTitle === 'Miss Mars Menu White') { // menuTitle = ':aaaaaabbbbbcccc15'; menuTitle = ':aaaaaaasssssscccccccccv'; } else if (marsTitle === 'Miss Mars Menu Tile') { menuTitle = ':aaaaaabbbccccvvvzz'; } else if (marsTitle === 'Custom Title') { var broadcaster = _this.api.room_slug; menuTitle = "".concat(_this.api.settings.custom_tip_menu_title.replace(/\[host\]/g, broadcaster)); } 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, "menuCmd", function (params, msg) { if (_this.api.settings.mars_tip_menu !== 'Yes') return; if (params[0]) { _this.menuCmdParams(params, msg); } else { var menu = _this.getMenu(); if (msg.user === _this.api.room_slug) { _this.api.sendNotice("".concat(menu), _this.api.room_slug, _this.menuBgColor, _this.menuFontColor, 'bold'); } else if (msg.user !== _this.api.room_slug && _this.whoSeesMenu === 'Only Colored Users, not Greys') { var user = _util.util.getUserByName(msg.user, _index.app.global.currentUsers); if (user.color !== 'Grey' || user.in_fanclub === true || user.is_mod === true) { _this.api.sendNotice("".concat(menu), msg.user, _this.menuBgColor, _this.menuFontColor, 'bold'); } else { var message = "".concat(_index.app.logo, " Only colored usernames have permission to see my menu"); _this.api.sendNotice(message, msg.user, _this.menuBgColor, _this.menuFontColor, 'bold'); } } else { _this.api.sendNotice("".concat(menu), msg.user, _this.menuBgColor, _this.menuFontColor, 'bold'); } } }); _defineProperty(this, "menuCmdParams", function (params, msg) { if (msg.user !== _this.api.room_slug) return; if (params[0] === 'mute') { if (_this.whoSeesMenu === 'Everyone Including Anonymous Users') { _this.api.sendNotice("".concat(_index.app.logo, " \uD83D\uDED1 You cannot mute the menu when it's showing to Anonymous users. Type: \"/marsHelp\" to see how to change access to menu"), _this.api.room_slug, _index.app.errorBgColor, _index.app.errorFontColor); return; } _this.setBroadcasterMute(true); _this.api.sendNotice("".concat(_index.app.logo, " The Tip Menu is now muted for you. It's still broadcasting to ").concat(_this.whoSeesMenu), _this.api.room_slug, _index.app.botBgColor, _index.app.botFontColor); } if (params[0] === 'unmute') { if (_this.whoSeesMenu === 'Everyone Including Anonymous Users') { _this.api.sendNotice("".concat(_index.app.logo, " Menu is unmuted and showing to ").concat(_this.whoSeesMenu), _this.api.room_slug, _index.app.botBgColor, _index.app.botFontColor); return; } _this.setBroadcasterMute(false); _this.api.sendNotice("".concat(_index.app.logo, " The Tip Menu will now show for you"), _this.api.room_slug, _index.app.botBgColor, _index.app.botFontColor); } if (params[0] === 'send') { _this.sendMenu(); _this.api.sendNotice("".concat(_index.app.logo, " Menu sent to ").concat(_this.whoSeesMenu), _this.api.room_slug, _index.app.botBgColor, _index.app.botFontColor); if (_this.muteBroadcasterNotice === true) { var menu = _this.getMenu(); _this.api.sendNotice("".concat(menu), _this.api.room_slug, _this.menuBgColor, _this.menuFontColor, 'bold'); } } if (params[0] === 'all') { _this.setWhoSeesMenu('Everyone Including Anonymous Users', msg); } if (params[0] === 'grey') { _this.setWhoSeesMenu('Everyone Except Anonymous Users', msg); } if (params[0] === 'color') { _this.setWhoSeesMenu('Only Colored Users, not Greys', msg); } }); _defineProperty(this, "addMenuItem", function (params, msg) { if (_this.api.settings.mars_tip_menu !== 'Yes') return; var amount = parseInt(params[0]); if (amount && params[1]) { var menuItem = params.slice(1).join(' '); var arr = _this.activeMenu; _this.sortArrByID(arr); var id = arr[arr.length - 1].id + 1; var menuObj = { id: id, item: menuItem, price: amount }; _this.activeMenu.push(menuObj); if (_this.api.settings.sort_menu_by_price === 'Yes') { _this.sortArrByPrice(_this.activeMenu); } _this.api.sendNotice("".concat(_index.app.logo, " Added Item: ").concat(menuObj.item, ": ").concat(menuObj.price, " tk"), msg.user, _index.app.botBgColor, _index.app.botFontColor); } else { _this.api.sendNotice("".concat(_index.app.logo, " \uD83D\uDED1 Error: Something is wrong. Make sure your command looks like this: \"/addmenu 1000 Because Miss Mars Is Amazing\" \uD83D\uDED1"), msg.user, _index.app.errorBgColor, _index.app.errorFontColor); } }); _defineProperty(this, "removeMenuItem", function (params, msg) { if (_this.api.settings.mars_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("".concat(_index.app.logo, " \uD83D\uDED1 Error: Please use ID number to remove a menu Item. eg /rmmenu 5 \uD83D\uDED1"), msg.user, _index.app.errorBgColor, _index.app.errorFontColor); return; } var index = _this.activeMenu.indexOf(menuObj); _this.activeMenu.splice(index, 1); _this.api.sendNotice("".concat(_index.app.logo, " Removed Item: ").concat(menuObj.item, ": ").concat(menuObj.price, " tk"), msg.user, _index.app.botBgColor, _index.app.botFontColor); }); _defineProperty(this, "viewMenuId", function (params, msg) { if (_this.api.settings.mars_tip_menu !== 'Yes') return; var message = "".concat(_index.app.logo, " 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, _index.app.botBgColor, _index.app.botFontColor); }); _defineProperty(this, "setBroadcasterMute", function (bool) { _this.muteBroadcasterNotice = bool; }); _defineProperty(this, "setWhoSeesMenu", function (str, msg) { _this.whoSeesMenu = str; var notice = "".concat(_index.app.logo, " ").concat(str, " can now see the Tip Menu"); _this.api.sendNotice("".concat(notice), msg.user, _index.app.botBgColor, _index.app.botFontColor); }); _defineProperty(this, "sortArrByPrice", function (arr) { arr.sort(function (a, b) { return a.price - b.price; }); }); _defineProperty(this, "sortArrByID", function (arr) { arr.sort(function (a, b) { return a.id - b.id; }); }); _defineProperty(this, "randomRange", function (min, max) { var rNum = Math.random(); rNum = Math.floor(rNum * (max - min + 1) + min); return rNum; }); _defineProperty(this, "addSettings", function () { var settings = [{ name: 'menu_blank_space_1', label: "".concat(_util.util.strRepeat('#', 40)), type: 'choice', required: false }, { name: 'tip_menu_placeholder', label: "TIP MENU ".concat(_util.util.strRepeat('_', 30)), type: 'choice', required: false }, { name: 'menu_blank_space_2', label: "".concat(_util.util.strRepeat('#', 40)), type: 'choice', 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', required: false }, { name: 'menu_item13_price', label: 'Item 13 Price', type: 'int', minValue: 1, required: false }, { name: 'menu_item14', label: 'Item 14', type: 'str', required: false }, { name: 'menu_item14_price', label: 'Item 14 Price', type: 'int', minValue: 1, required: false }, { name: 'menu_item15', label: 'Item 15', type: 'str', required: false }, { name: 'menu_item15_price', label: 'Item 15 Price', type: 'int', minValue: 1, required: false }, { name: 'menu_item16', label: 'Item 16', type: 'str', required: false }, { name: 'menu_item16_price', label: 'Item 16 Price', type: 'int', minValue: 1, required: false }, { name: 'menu_item17', label: 'Item 17', type: 'str', required: false }, { name: 'menu_item17_price', label: 'Item 17 Price', type: 'int', minValue: 1, required: false }, { name: 'menu_item18', label: 'Item 18', type: 'str', required: false }, { name: 'menu_item18_price', label: 'Item 18 Price', type: 'int', minValue: 1, required: false }, { name: 'menu_item19', label: 'Item 19', type: 'str', required: false }, { name: 'menu_item19_price', label: 'Item 19 Price', type: 'int', minValue: 1, required: false }, { name: 'menu_item20', label: 'Item 20', type: 'str', required: false }, { name: 'menu_item20_price', label: 'Item 20 Price', type: 'int', minValue: 1, required: false }, { name: 'menu_item21', label: 'Item 21', type: 'str', required: false }, { name: 'menu_item21_price', label: 'Item 21 Price', type: 'int', minValue: 1, required: false }, { name: 'menu_item21_secret_message', label: 'Secret message to tipper for item 21. Leave blank to use as normal menu item', type: 'str', minLength: 2, required: false }, { name: 'menu_item22', label: 'Item 22', type: 'str', required: false }, { name: 'menu_item22_price', label: 'Item 22 Price', type: 'int', minValue: 1, required: false }, { name: 'menu_item22_secret_message', label: 'Secret message to tipper for item 22. Leave blank to use as normal menu item', type: 'str', minLength: 2, required: false }, { name: 'menu_item23', label: 'Item 23', type: 'str', required: false }, { name: 'menu_item23_price', label: 'Item 23 Price', type: 'int', minValue: 1, required: false }, { name: 'menu_item23_secret_message', label: 'Secret message to tipper for item 23. Leave blank to use as normal menu item', type: 'str', minLength: 2, required: false }, { name: 'menu_title', label: 'Title For Menu', type: 'choice', choice1: 'Miss Mars Menu Red', choice2: 'Miss Mars Menu White', choice3: 'Miss Mars Menu Tile', // choice4: 'Custom Title', defaultValue: 'Miss Mars Menu Red', required: false }, // { // name: 'custom_tip_menu_title', // label: 'Custom title for menu, if custom selected above. "[host]" is your room name', // type: 'str', // minLength: 2, // defaultValue: `[host]'s Tip Menu`, // 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: 'Background color', type: 'choice', choice1: 'None', defaultValue: 'None' }, { name: 'menu_font_color', label: '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: 'who_sees_menu', label: 'Who should be able to see your tip menu?', type: 'choice', choice1: 'Only Colored Users, not Greys', choice2: 'Everyone Except Anonymous Users', choice3: 'Everyone Including Anonymous Users', defaultValue: 'Everyone Except Anonymous Users' }, { name: 'menu_blank_space_3', label: ' ', type: 'choice', required: false }]; return settings; }); _defineProperty(this, "addCommands", function () { var commands = { menu: { func: _this.menuCmd, permission: 'user', description: 'View the menu privately', paramRequired: false, params: [{ param: 'send', description: "Send the menu to whoever you allow view it. Change in launch settings." }, { param: 'mute', description: "Mute the menu for you. Still broadcasts to the room" }, { param: 'unmute', description: "Unmute the menu for you" }, { param: 'all', description: 'Allow "Everyone Including Anonymous Users" to view the Tip Menu' }, { param: 'grey', description: 'Allow "Everyone Except Anonymous Users" to view the Tip Menu' }, { param: 'color', description: 'Allow "Only Colored Users, not Greys" to view the Tip Menu' }] }, addmenu: { func: _this.addMenuItem, permission: 'host', description: '', paramRequired: true, params: [{ param: '[price] [item]', description: 'Add an item to the menu. eg. /addmenu 100 Coz I\'m Sexy' }] }, rmmenu: { func: _this.removeMenuItem, permission: 'host', description: '', paramRequired: true, params: [{ param: '[ID]', description: 'Remove an item from the menu. Type /menuID to find the item ID' }] }, menuid: { func: _this.viewMenuId, permission: 'host', description: 'List of menu items and ID number needed to remove an item\n', paramRequired: false, params: [] } }; return commands; }); this.name = "Miss Mars Menu"; 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) }, { id: 21, item: this.api.settings.menu_item21, price: parseInt(this.api.settings.menu_item21_price), secretMessage: this.api.settings.menu_item21_secret_message }, { id: 22, item: this.api.settings.menu_item22, price: parseInt(this.api.settings.menu_item22_price), secretMessage: this.api.settings.menu_item22_secret_message }, { id: 23, item: this.api.settings.menu_item23, price: parseInt(this.api.settings.menu_item23_price), secretMessage: this.api.settings.menu_item23_secret_message }]; this.muteBroadcasterNotice = false; this.whoSeesMenu = this.api.settings.who_sees_menu; this.menuRotateTime = parseInt(this.api.settings.menu_rotate_time); this.menuTimeout = null; this.randomItemTimeout = null; // Styling this.itemSeparator = this.api.settings.item_separator; this.menuTitle = this.getMenuTitle(); this.menuBgColor = this.getMenuBackgroundColor(); this.menuFontColor = this.getMenuFontColor(); this.randomItemBg = ''; this.randomItemFont = '#9F000F'; _PubSub.pubSub.subscribe('userEnter', this.onEnter); _PubSub.pubSub.subscribe('newTip', this.onTip); this.initMenu(); } /** * * Event Functions * */ ; exports.TipMenu = TipMenu; },{"../core/PubSub":6,"../core/util":8,"../index":9}],17:[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"); 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 per session. */ var EnterMsg = function EnterMsg(api) { var _this = this; _classCallCheck(this, EnterMsg); _defineProperty(this, "handleEnter", function (cbUser) { if (_this.api.settings.welcome_msg !== 'Yes') return; if (_this.users.includes(cbUser.user)) return; _this.users.push(cbUser.user); if (!cbUser.has_tokens && !cbUser.tipped_recently) { _this.greyMsg(cbUser); } else { _this.nonGreyMsg(cbUser); } }); _defineProperty(this, "nonGreyMsg", function (cbUser) { var welcomeMessage = _this.api.settings.welcome_msg_non_grey_text.trim(); var userName = cbUser.user.trim().toLowerCase(); if (welcomeMessage.length > 2) { var msg = "".concat(welcomeMessage.replace(/\[user\]/g, userName)); _this.api.sendNotice("".concat(msg), cbUser.user, _this.bgColor, _this.fontColor, 'bold'); } }); _defineProperty(this, "greyMsg", function (cbUser) { var welcomeMessage = _this.api.settings.welcome_msg_grey_text.trim(); var userName = cbUser.user.trim().toLowerCase(); if (welcomeMessage.length > 2) { var msg = "".concat(welcomeMessage.replace(/\[user\]/g, userName)); _this.api.sendNotice("".concat(msg), cbUser.user, _this.bgColor, _this.fontColor, 'bold'); } }); _defineProperty(this, "addSettings", function () { var settings = [{ name: 'welcome_blank_space_1', label: "".concat(_util.util.strRepeat('#', 40)), type: 'choice', required: false }, { name: 'welcome_msg_placeholder', label: "MESSAGE ON ENTER ".concat(_util.util.strRepeat('_', 30)), type: 'choice', required: false }, { name: 'welcome_blank_space_2', label: "".concat(_util.util.strRepeat('#', 40)), type: 'choice', required: false }, { name: 'welcome_msg_non_grey_text', label: 'Welcome message for users with tokens', type: 'str', minLength: 2, maxLength: 255, defaultValue: "Hi [user]. Welcome to the room." }, { name: 'welcome_msg_grey_text', label: 'Welcome message for grey users', type: 'str', minLength: 2, maxLength: 255, defaultValue: "Hi [user]. Please buy some tokens and lets have fun" }, { name: 'welcome_msg_font_color', label: 'Custom font color (HTML Hex Code)', type: 'str', minLength: 7, maxLength: 9, defaultValue: '', required: false }, { name: 'welcome_msg_bg_color', label: 'Custom background color (HTML Hex Code)', type: 'str', minLength: 7, maxLength: 9, defaultValue: '', required: false }, { name: 'welcome_blank_space_3', label: ' ', type: 'choice', required: false }]; return settings; }); this.name = 'Color/Grey Welcome Message'; this.api = api; this.settings = this.addSettings(); this.users = []; // Colors this.fontColor = this.api.settings.welcome_msg_font_color || '#9F000F'; this.bgColor = this.api.settings.welcome_msg_bg_color; _PubSub.pubSub.subscribe('userEnter', this.handleEnter); }; exports.EnterMsg = EnterMsg; },{"../core/PubSub":6,"../core/util":8}]},{},[9]);
© Copyright Chaturbate 2011- 2024. All Rights Reserved.