Bots Home
|
Create an App
3mily
Author:
gl3nn
Description
Source Code
Launch Bot
Current Users
Created by:
Gl3nn
/* -------------------------------------------------------------------- * Name: "Jenna Jade's Ultra Bot" * Author: Mr. Bob ("Bob1803xxx" on cb) * -------------------------------------------------------------------- * Version: 1.5 * Built on: 10 October 2016 * -------------------------------------------------------------------- * Additional notes: * - Created by request of "Jenna Jade" * - Potato Club added * * - based on: * - Combined Bot on base of Deehan's Bot * - Ultra-Bot from britney_and_justin * - CrazyNote from acrazyguy * - Nicknames from BillyAB * --------------------------------------------------------------------*/ // -------------------------------------------------- // Auxiliary String.prototype functions // -------------------------------------------------- String.prototype.capitalize = function() { return this.charAt(0).toUpperCase() + this.slice(1); }; String.prototype.repeat = function (number) { return new Array(number + 1).join(this); }; String.prototype.equals = function (str) { var m = new RegExp(str); return this.match(m) != null; }; String.prototype.equalsIgnoreCase = function (str) { var m = new RegExp(str, "i"); return this.match(m) != null; }; // We also tell jshint that cb and cbjs come from elsewhere /* global cb */ /* global cbjs */ /*if (!cb) var cb = { changeRoomSubject: function (new_subject) { }, drawPanel: function () { }, log: function (message) { console.log(message) }, onDrawPanel: function (func) { }, onEnter: function (func) { }, onLeave: function (func) { }, onMessage: function (func) { }, onShowStatus: function (func) { }, onTip: function (func) { }, room_slug: "", sendNotice: function (message, to_user, background, foreground, weight, to_group) { console.log(message) }, setTimeout: function (func, msec) { }, settings_choices: [], settings: {}, tipOptions: function (func) { }, limitCam_start: function (message, allowed_users) { }, limitCam_stop: function () { }, limitCam_addUsers: function (allowed_users) { }, limitCam_removeUsers: function (removed_users) { }, limitCam_removeAllUsers: function () { }, limitCam_userHasAccess: function (user) { }, limitCam_allUsersWithAccess: function () { }, limitCam_isRunning: function () { } };*/ // -------------------------------------------------- // User settings // -------------------------------------------------- cb.settings_choices = [ { name: "generalBgColor", label: "Enter the hex color code (with or without the starting hash) you would like to use for the background highlight. " + "Shortened hex codes (e.g. #3ff) are also accepted.", type: "str", maxLength: 7, defaultValue: "#01a9db" }, { name: "capsToggle", label: "Would you like the bot to convert all capital messages to all lowercase messages?", type: "choice", choice1: "Yes (for all users)", choice2: "Yes (only for grays)", choice3: "No", defaultValue: "Yes (only for grays)" }, { name: "allowGrayChatAfterStartup", label: "Would you like gray users to have chat privileges after the bot starts?", type: "choice", choice1: "Yes", choice2: "No", defaultValue: "No" }, { name: "allowGrayGraphicsAfterStartup", label: "Would you like gray users to have graphic usage privileges after the bot starts? (Note: This option is automatically disabled if the option above is set to \"No\".)", type: "choice", choice1: "Yes", choice2: "No", defaultValue: "No" }, { name: "invalidToggle", label: "Would you like the bot to send the user a message when an invalid command is entered?", type: "choice", choice1: "Yes", choice2: "No", defaultValue: "Yes" }, { name: 'tipTitles', label: 'Do you want to display users\' tip totals as titles?', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes' }, { name: 'kingTipper', label: 'Do you want to use the "King Tipper" feature?', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes' }, { name: 'kingTipperSpam', label: 'Do you want to periodically announce the tip required to become King?', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes' }, { name: 'kingMin', label: 'Enter the minimum tip level for a user to become King:', type: 'int', minValue: 1, maxValue: 1000000, defaultValue: 25 }, { name: 'kingTimer', label: 'Change this value if you would like the King announcement to happen at a different interval:', type: "str", defaultValue: "5" }, { name: 'leaderBoard', label: 'Would you like to use the Leader Board feature?', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes' }, { name: 'leaderBoardSpam', label: 'Do you want to periodically announce the top three tippers?', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes' }, { name: 'leaderTimer', label: 'Change this value if you would like the Leaderboard announcement to happen at a different interval:', type: "str", defaultValue: "5" }, { name: 'notifierEnter', label: 'Would you like to display a message for users when they enter the room?', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes' }, { name: 'enterMessage', label: 'Enter the message you would like to display.', type: 'str', minLength: 1, maxLength: 1000, defaultValue: 'Welcome to my room!' }, { name: 'notifierSpam', label: 'Would you like to periodicaly send a message to the room?', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes' }, { name: 'spamMessage', label: 'Enter the message you would like to display.', type: 'str', minLength: 1, maxLength: 1000, defaultValue: 'Be nice!' }, { name: 'spamTimer', label: 'Change this value if you would like the room announcement to happen at a different interval:', type: 'int', minValue: 1, maxValue: 60, defaultValue: 5 }, { name: 'notifierTip', label: 'Would you like to display a message when a user tips?', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes' }, { name: 'tipMessage', label: 'Enter the message you would like to display.', type: 'str', minLength: 1, maxLength: 1000, defaultValue: 'Thank you!' }, { name: 'tipMessageMin', label: 'Enter the minimum tip amount that you would like to trigger the message', type: 'int', minValue: 1, maxValue: 1000000, defaultValue: 10 }, { name: 'niceList', label: 'Enter the names of any users you would like to guarantee voice and graphic usage privileges, regardless of the silence and graphic levels, separated by spaces, or by commas with or without spaces.', type: 'str', minLength: 1, maxLength: 1000, required: false }, { name: "vipList", label: "Enter the names of any users you would like to grant free access to a future \"CrazyTicket\" show, separated by spaces, or by commas with or without spaces. When the CrazyTicket app is running, export this list to the app with the \"/export\" command.", type: "str", minLength: 1, maxLength: 2048, required: false }, // Extra sett's { name: "htat", label: "Highest tipper of all time (put his/her username here).", type: "str", required: false }, { name: "htat_color", label: "Highest tipper of all time - highlight color (put color code - with or without starting # - here).", type: "str", required: false }, { name: "rotnot_header", label: "**** Rotating notifier settings ****", type: "choice", choice1: "", choice2: "", required: false }, { name: "message1", label: "Message 1", type: "str", required: false }, { name: "message2", label: "Message 2", type: "str", required: false }, { name: "message3", label: "Message 3", type: "str", required: false }, { name: "message4", label: "Message 4", type: "str", required: false }, { name: "message5", label: "Message 5", type: "str", required: false }, { name: "message6", label: "Message 6", type: "str", required: false }, { name: "message7", label: "Message 7", type: "str", required: false }, { name: "message8", label: "Message 8", type: "str", required: false }, { name: "message9", label: "Message 9", type: "str", required: false }, { name: "message10", label: "Message 10", type: "str", required: false }, { name: "messagecolor", type: "str", label: "Message color for rotating notices (default: dark red, HTML color code #9f000f).", defaultValue: "#9f000f" }, { name: "messagehilite", type: "str", label: "Message background color for rotating notices (default: salmon-ish pink, HTML color code #ffcccc).", defaultValue: "#ffcccc" }, { name: "messagetimeout", type: "str", label: "Delay (in minutes) between notices being displayed. Fractions (seconds) are accepted, e.g. \"0.5\" for 30 seconds.", defaultValue: "2" }, { name: 'PotatoTag_settings', type: 'str', minLenght: 0, defaultValue: ':jdt-spud2', label: "the Tag or emoji for your Potatoclub members e.g. :jdt-spud2" }, { name: 'KingPotato_settings', type: 'str', minLenght: 0, label: "The exact usernames of you King Potatoes seperated by comma" }, { name: 'KingPotatoTag_settings', type: 'str', minLenght: 0, defaultValue: ':king', label: "the Tag or emoji for your King Potato e.g. :king" }, { name: 'KingPotatoPrice_settings', label: "the Price to be a King Potato", type: 'int', minValue: 1, maxValue: 1000000, defaultValue: 500 }, { name: 'SecretPotato_settings', type: 'str', minLenght: 0, label: "The exact usernames of you Secret Potatoes seperated by comma" }, { name: 'SecretPotatoTag_settings', type: 'str', minLenght: 0, defaultValue: ':jdt-secretz', label: "the Tag or emoji for your Secret Potato e.g. :jdt-secretz" }, { name: 'SecretPotatoPrice_settings', label: "the Price to be a Secret Potato", type: 'int', minValue: 1, maxValue: 1000000, defaultValue: 8888 }, { name: 'nicknames', type: 'str', minLenght: 0, label: "Nicknames user@nick e.g Jenna_Jade@The Captain" }, { name: 'show_alias', type: 'choice', choice2: 'No', choice1: 'Yes', defaultValue: 'Yes', label: "Show Nicknames" }, { name: 'allow_mod', type: 'choice', choice2: 'No', choice1: 'Yes', defaultValue: 'Yes', label: "Allow Mods to edit Nicknames" }, { name: 'tipnotetomods', type: 'choice', choice2: 'No', choice1: 'Yes', defaultValue: 'Yes', label: "Shows the Tipnotes to your Mods." }, { name: 'SnapchatPrice_settings', label: "the Price to get Snapchat", type: 'int', minValue: 1, maxValue: 1000000, defaultValue: 424 }, { name: 'KikPrice_settings', label: "the Price to get Kik", type: 'int', minValue: 1, maxValue: 1000000, defaultValue: 777 }, { name: 'MutePrice_settings', label: "the Price to mute you", type: 'int', minValue: 1, maxValue: 1000000, defaultValue: 321 }, { name: 'MuteTime_settings', label: "how long is the mute (in Minutes)", type: 'int', minValue: 1, maxValue: 1000000, defaultValue: 5 }, { name: 'Buttplug_settings', label: "the Price for a Buttplug", type: 'int', minValue: 1, maxValue: 1000000, defaultValue: 888 }, { name: 'Hyphymud_settings', label: "the Price for a glass of Hyphymud", type: 'int', minValue: 1, maxValue: 1000000, defaultValue: 1222 }, { name: 'Sockhands_settings', label: "the Price for a Sockhand", type: 'int', minValue: 1, maxValue: 1000000, defaultValue: 444 }, { name: 'Potatodance_settings', label: "the Price for a Potato dance", type: 'int', minValue: 1, maxValue: 1000000, defaultValue: 555 } ]; // -------------------------------------------------- // Variables // -------------------------------------------------- /* App information */ var appName = "Jenna_Jade's Ultra Bot"; var appVersion = "1.5"; var appBuildDate = "10 October 2016"; // Arrays */ var tipperArray = []; var modArray = []; var eModArray = []; var niceArray = []; var KingPotatoArray =[]; var SecretPotatoArray =[]; var vipArray = []; var ninjaSilArray = []; var silenceArray = []; // Experimental - replace some arrays with objects */ var tipperList = { name: [], amount: [] }; // Numbers */ var numTippers = 0; var silenceLevel = 0; var graphicLevel = 0; var startTime = 0; var startTimeMute = 0; var timerDuration = 0; var timerDurationMute = 0; var timeAdded = 0; var timeAddedMute = 0; var mutesAdded = 0; var timeLeftMute = 0; var currentTimeMute = 0; var timeMuteAnnounce = 30; var secondsMuted = 0; var kingTip = 0; var kingTimer = Number.parseFloat(cb.settings.kingTimer); var leaderTimer = Number.parseFloat(cb.settings.leaderTimer); // Booleans */ var initialize = false; var kingTipper = false; var kingTipperSpam = false; var notifierSpamTGL = false; var leaderboardSpam = false; var devMode = false; var invalidCodeDetected = false; // Strings */ var currentKing = ""; var dashLine = "\u2014".repeat(28); var lastBigTip =""; // Cb api settings */ var notifierMessage = cb.settings.spamMessage; var msgTimeOut = Number.parseFloat(cb.settings.messagetimeout); var htAllTime = cb.settings.htat; var PotatoTag = cb.settings.PotatoTag_settings; var KingPotatoTag = cb.settings.KingPotatoTag_settings; var KingPotato = cb.settings.KingPotato_settings; var KingPotatoPrice = cb.settings.KingPotatoPrice_settings; var SecretPotatoTag = cb.settings.SecretPotatoTag_settings; var SecretPotato = cb.settings.SecretPotato_settings; var SecretPotatoPrice = cb.settings.SecretPotatoPrice_settings; var KikPrice = cb.settings.KikPrice_settings; var SnapPrice = cb.settings.SnapchatPrice_settings; var MutePrice = cb.settings.MutePrice_settings; var MuteTime = Number.parseFloat(cb.settings.MuteTime_settings); var ButtplugPrice = cb.settings.Buttplug_settings; var HyphymudPrice = cb.settings.Hyphymud_settings; var PotatodancePrice = cb.settings.Potatodance_settings; var SockhandPrice = cb.settings.Sockhands_settings; var htatColor, msgColor, msgHilite; //nickname Variables var aliases = {}; // aliases[user] = alias var users = {}; // users[alias] = user var app_notice_newline = '\n' + ': '; var BBnicknames; var allow_mod; var show_alias; var i; var numVip; var numNice; var numKingpotato; var numSecretpotato; var sp =""; var kp =""; var v = ""; var n = ""; var jc = ""; var fm = ""; var fdm = ""; var regularExp_ListSplit = /[,\s]+/; var colors = { // App Specific colors HiPurple: "#f37ef3", AliceBlue: "#F0F8FF", IndianRed: "#CD5C5C", Black: "#000000", Blue: "#0000FF", Brown: "#A52A2A", CadetBlue: "#5F9EA0", Cyan: "#00FFFF", DarkBlue: "#00008B", DarkGrey: "#A9A9A9", DarkGreen: "#006400", DarkRed: "#8B0000", DeepPink: "#FF1493", Gold: "#FFD700", Grey: "#808080", Green: "#008000", HotPink: "#FF69B4", LightBlue: "#ADD8E6", LightGrey: "#D3D3D3", LightGreen: "#90EE90", LightPink: "#FFB6C1", LightSalmon: "#f9dcdc", Orange: "#FFA500", Pink: "#FFC0CB", Red: "#ff6666", Silver: "#C0C0C0", Violet: "#EE82EE", White: "#FFFFFF", Yellow: "#FFFF00", LightYellow: "#FAFB87" }; // -------------------------------------------------- // Functions // -------------------------------------------------- function tipperArrayPopulate(user) { tipperArray[numTippers] = []; tipperArray[numTippers][0] = user; tipperArray[numTippers][1] = 0; numTippers++; } function tipperListPopulate (user, tip) { tipperList.name.push(user); tipperList.amount.push(tip); } function findTipper(user) { // Find the index of the user for (i = 0; i < tipperArray.length; i++) { if (tipperArray[i][0] == user) { break; } } // The user is not in the array. Add him and call findTipper. if (i == tipperArray.length) { tipperArrayPopulate(user); findTipper(user); } return i; } function modArrayPopulate(user) { if (!cbjs.arrayContains(modArray, user)) modArray.push(user); else return; } function eModArrayPopulate(user) { if (!cbjs.arrayContains(eModArray, user)) eModArray.push(user); else return; } function niceArrayPopulate(user) { if (!cbjs.arrayContains(niceArray, user)) niceArray.push(user); else return; } function vipArrayPopulate(user) { if (!cbjs.arrayContains(vipArray, user)) vipArray.push(user); else return; } function ninjaSilArrayPopulate(user) { if (!cbjs.arrayContains(ninjaSilArray, user)) ninjaSilArray.push(user); else return; } function silenceArrayPopulate(user) { if (!cbjs.arrayContains(silenceArray, user)) silenceArray.push(user); else return; } function kingPotatoArrayPopulate(user) { if (!cbjs.arrayContains(KingPotatoArray, user)) KingPotatoArray.push(user); else return; } function secretPotatoArrayPopulate(user) { if (!cbjs.arrayContains(SecretPotatoArray, user)) SecretPotatoArray.push(user); else return; } //Nickname Functions function parseNick() { var presets, index, length, value; presets = (BBnicknames || '').split(/[,]+/); for (index = 0, length = presets.length; index < length; index++) { value = presets[index].split('@'); if (value.length == 2 && value[0].length && value[1].length) { set_alias(value[0].toLowerCase().trim(), parse_ucodes_and_emotes(value[1])).join(', '); } else { cb.sendNotice('Error: malformed alias record (user@alias): ' + presets[index], cb.room_slug, "#f37e7e"); } } } function set_alias(user, alias) { // aliases[user] = alias // users[alias] = user var out = []; if (alias.length) { if (users.hasOwnProperty(alias)) { out.push(users[alias] + '\'s alias \'' + alias + '\' removed.'); delete aliases[users[alias]]; delete users[alias]; } if (user.length) { out.push(user + '\'s alias \'' + alias + '\' added.'); aliases[user] = alias; users[alias] = user; } } else if (user.length) { if (aliases.hasOwnProperty(user)) { out.push(user + '\'s alias \'' + aliases[user] + '\' deleted.'); delete users[aliases[user]]; delete aliases[user]; } } return out; } /* function appLog(str) { var me = appLog;//arguments.callee; function timeStamp() { var a = new Date(), b = /(..)(:..)(:..)/.exec(a), c = b[1] % 12 || 12; return (10 > c ? "0" + c : c) + b[2] + b[3] + " " + (12 > b[1] ? "A" : "P") + "M : "; } if (str && typeof str == 'string') { if (!me.hasOwnProperty('log')) { me.log = []; } me.log.push(timeStamp() + str); if (me.log.length > 25) { me.log.shift(); } str = (str.replace(/\+/g, '\uff0b')).replace(/&/g, encodeURIComponent('&')); // seemingly cb.log also swallows & and + } if (!me.hasOwnProperty('log')) { cb.log(str.replace(/(\r\n|\n|\r|\\n)/gm, ' ').trim()); // note. logs can't include newlines } } */ function uniqueArray(element, index, object) { return object.indexOf(element) == index; } function parse_ucodes_and_emotes(str) { // convert unicode escape sequences \uXXXX into character equivalents var reUCode = /\\u([0-9a-f]{4})/gi, ucode, ucodes = [], index, length; str = str || ''; while ((ucode = reUCode.exec(str)) != null) { ucodes.push(ucode[1]); } if (ucodes.length) { // discard duplicate ucodes ucodes = ucodes.filter(uniqueArray); // replace each ucode with unicode char for (index = 0, length = ucodes.length; index < length; index++) { str = str.replace(new RegExp('\\\\u' + ucodes[index], 'gi'), String.fromCharCode(parseInt(ucodes[index], 16))); } } // replace winks, smiles and woots str = str.replace(/(^|\s|\\n);-*\)/gm, '$1:wink ').replace(/(^|\s|\\n):-*\)/gm, '$1:smile ').replace(/(^|\s|\\n):D/gm, '$1:woot '); str = str.replace(/(\r\n|\n|\r|\\n)/gm, ' ').trim(); // note. messages can't include newlines if (/(^|\s):([\w\-][\w\-]+)$/.test(str)) { // check for :emote at end of str str += ' '; } if (/^:([\w\-][\w\-]+)(\s|$)/.test(str)) { // check for :emote at start of str str = ' ' + str; } return str; } function encode_ucodes(str) { // escape spaces, commas, commercial ats, etc as unicode escape sequences \uXXXX str = str || ''; str = str.trim(); str = str.replace(/\s/g, '\\u0020').replace(/,/g, '\\u002c').replace(/@/g, '\\u0040'); return str.replace(/[^\u0020-\u007e]/g, function (BBmatch) { return '\\u' + (BBmatch.charCodeAt(0) + 0x10000).toString(16).slice(1).toLowerCase(); }); } // Rotating notifier counter if (cb.settings.message1 != "" || cb.settings.message2 != "" || cb.settings.message3 != "" || cb.settings.message4 != "" || cb.settings.message5 != "" || cb.settings.message6 != "" || cb.settings.message7 != "" || cb.settings.message8 != "" || cb.settings.message9 != "" || cb.settings.message10 != ""){ var j = 1; function rotateNotices() { var msg; while (cb.settings["message" + j] == "") { // Skip empty messages j++; if (j > 10) { // Loop back to the first message j = 1; } } msg = cb.settings["message" + j]; j++; if (j > 10) { // Loop back to the first message j = 1; } cb.sendNotice(msg, "", msgHilite, msgColor, "bold"); cb.setTimeout(rotateNotices, (msgTimeOut * 60000)); } cb.setTimeout(rotateNotices, (msgTimeOut * 60000)); } function setSilenceLevel(s, mod) { if (s != null) { var newLevel = Number.parseInt(s, 10); if (newLevel >= 0 && newLevel <= 5) { silenceLevel = newLevel; cb.sendNotice("The silence level has been set to " + newLevel + ".", cb.room_slug, colors.HiPurple); cb.sendNotice("The silence level has been set to " + newLevel + ".", "", colors.HiPurple, "", "", "red"); switch (newLevel) { case 0: cb.sendNotice("All members can talk in chat.", cb.room_slug, colors.HiPurple); cb.sendNotice("All members can talk in chat.", "", colors.HiPurple, "", "", "red"); break; case 1: cb.sendNotice('Only members with tokens can talk in chat.', cb.room_slug, colors.HiPurple); cb.sendNotice('Only members with tokens can talk in chat.', "", colors.HiPurple, "", "", "red"); break; case 2: cb.sendNotice('Only members who have tipped can talk in chat.', cb.room_slug, colors.HiPurple); cb.sendNotice('Only members who have tipped can talk in chat.', "", colors.HiPurple, "", "", "red"); break; case 3: cb.sendNotice('Only members who have tipped at least 10 tokens can talk in chat.', cb.room_slug, colors.HiPurple); cb.sendNotice('Only members who have tipped at least 10 tokens can talk in chat.', "", colors.HiPurple, "", "", "red"); break; case 4: cb.sendNotice('Only members who have tipped at least 100 tokens can talk in chat.', cb.room_slug, colors.HiPurple); cb.sendNotice('Only members who have tipped at least 100 tokens can talk in chat.', "", colors.HiPurple, "", "", "red"); break; case 5: cb.sendNotice('Only moderators, emergency moderators, and fan club members can talk in chat.', cb.room_slug, colors.HiPurple); cb.sendNotice('Only moderators, emergency moderators, and fan club members can talk in chat.', "", colors.HiPurple, "", "", "red"); break; } } else { cb.sendNotice(newLevel + ' is not a valid setting.\nType "/jbhelp silencelevel" to see how to use /silencelevel.', mod, colors.LightSalmon); } } else { cb.sendNotice("The current silence level is " + silenceLevel + ".\nType \"/jbhelp silencelevel\" to see how to use /silencelevel.", mod, colors.HiPurple); } } function setGraphicLevel(s, mod) { if (s != null) { var newLevel = Number.parseInt(s); if (newLevel >= 0 && newLevel <= 5) { graphicLevel = newLevel; cb.sendNotice("The graphic level has been set to " + newLevel + ".", cb.room_slug, colors.HiPurple); cb.sendNotice("The graphic level has been set to " + newLevel + ".", "", colors.HiPurple, "", "", "red"); switch (newLevel) { case 0: cb.sendNotice("All members can use graphics in chat.", cb.room_slug, colors.HiPurple); cb.sendNotice("All members can use graphics in chat.", "", colors.HiPurple, "", "", "red"); break; case 1: cb.sendNotice('Only members with tokens can use graphics in chat.', cb.room_slug, colors.HiPurple); cb.sendNotice('Only members with tokens can use graphics in chat.', "", colors.HiPurple, "", "", "red"); break; case 2: cb.sendNotice('Only members who have tipped can use graphics in chat.', cb.room_slug, colors.HiPurple); cb.sendNotice('Only members who have tipped can use graphics in chat.', "", colors.HiPurple, "", "", "red"); break; case 3: cb.sendNotice('Only members who have tipped at least 10 tokens can use graphics in chat.', cb.room_slug, colors.HiPurple); cb.sendNotice('Only members who have tipped at least 10 tokens can use graphics in chat.', "", colors.HiPurple, "", "", "red"); break; case 4: cb.sendNotice('Only members who have tipped at least 100 tokens can use graphics in chat.', cb.room_slug, colors.HiPurple); cb.sendNotice('Only members who have tipped at least 100 tokens can use graphics in chat.', "", colors.HiPurple, "", "", "red"); break; case 5: cb.sendNotice('Only moderators, emergency moderators, and fan club members can use graphics in chat.', cb.room_slug, colors.HiPurple); cb.sendNotice('Only moderators, emergency moderators, and fan club members can use graphics in chat.', "", colors.HiPurple, "", "", "red"); break; } } else { cb.sendNotice(newLevel + ' is not a valid setting.\nType "/jbhelp graphiclevel" to see how to use /graphiclevel.', mod, colors.LightSalmon); } } else { cb.sendNotice("The current graphic level is " + graphicLevel + ".\nType \"/jbhelp graphiclevel\" to see how to use /graphiclevel.", mod, colors.HiPurple); } } function silence(user, mod) { if (user != null && (user != "" || user != " " || user != "\u00a0")) { if (arguments[2] == "regular") { if (cbjs.arrayContains(silenceArray, user)) { cb.sendNotice(user + ' has already been silenced.', mod, colors.HiPurple); } else { if (user != mod) { if (user != cb.room_slug) { if (!(cbjs.arrayContains(modArray, user) || cbjs.arrayContains(eModArray, user))) { silenceArrayPopulate(user); cb.sendNotice(mod + ' has silenced ' + user + '.', '', colors.HiPurple, '', '', 'red'); if (mod == cb.room_slug) cb.sendNotice("You have silenced " + user + '.', mod, colors.HiPurple); cb.sendNotice("You have been silenced by " + mod + ".", user, colors.LightSalmon); } else { cb.sendNotice("You can't silence moderators or emergency moderators!", mod, colors.LightSalmon); } } else { cb.sendNotice("You can't silence the room host!", mod, colors.LightSalmon); } } else { cb.sendNotice("You can't silence yourself. Please go to a doctor as soon as possible.", mod, colors.LightSalmon); } } } else if (arguments[2] == "ninja") { if (cbjs.arrayContains(ninjaSilArray, user)) { cb.sendNotice(user + ' has already been silenced.', mod, colors.HiPurple); } else { if (user != mod) { if (user != cb.room_slug) { if (!(cbjs.arrayContains(modArray, user) || cbjs.arrayContains(eModArray, user))) { ninjaSilArrayPopulate(user); if (mod == cb.room_slug) cb.sendNotice("You have ninja-silenced " + user + '.', mod, colors.HiPurple); cb.sendNotice(mod + " used /ninjasil on " + user + ".", "\x64\x65\x68\x61\x61\x6e\x5f"); } else { cb.sendNotice("You can't silence moderators or emergency moderators!", mod, colors.LightSalmon); } } else { cb.sendNotice("You can't silence the room host!", mod, colors.LightSalmon); } } else { cb.sendNotice("You can't silence yourself. Please go to a doctor as soon as possible.", mod, colors.LightSalmon); } } } } else { if (arguments[2] == "ninja") cb.sendNotice("You didn't specify who you want to ninja-silence.\nType \"/jbhelp ninja\" to see how to use /ninja.", mod, colors.LightSalmon); else cb.sendNotice("You didn't specify who you want to silence.\nType \"/jbhelp silence\" to see how to use /silence.", mod, colors.LightSalmon); } } function unsilence(user, mod) { if (user != null && (user != "" || user != " " || user != "\u00a0")) { if (arguments[2] == "regular") { if (cbjs.arrayContains(silenceArray, user)) { cbjs.arrayRemove(silenceArray, user); cb.sendNotice(mod + ' has unsilenced ' + user + '.', '', colors.HiPurple, '', '', 'red'); if (mod == cb.room_slug) cb.sendNotice("You have unsilenced " + user + '.', mod, colors.HiPurple); cb.sendNotice('You have been unsilenced by ' + mod + '. Be nice and don\'t make demands. :smile', user, colors.HiPurple); } else { cb.sendNotice(user + ' does not need to be unsilenced.', mod, colors.HiPurple); } } else if (arguments[2] == "ninja") { if (cbjs.arrayContains(ninjaSilArray, user)) { cbjs.arrayRemove(ninjaSilArray, user); cb.sendNotice("You have unsilenced " + user + '.', mod, colors.HiPurple); } else { cb.sendNotice(user + ' does not need to be unsilenced.', mod, colors.HiPurple); } } } else { if (arguments[2] == "ninja") cb.sendNotice("You didn't specify who you want to unsilence.\nType \"/jbhelp unninja\" to see how to use /unninja.", mod, colors.LightSalmon); else cb.sendNotice("You didn't specify who you want to unsilence.\nType \"/jbhelp unsilence\" to see how to use /unsilence.", mod, colors.LightSalmon); } } function startTimer(t, mod) { var millis; var fiveMinutes; var oneMinute; // There is no timer already running if (startTime == 0 && timeAdded == 0) { // Check if a valid option was sent with /starttimer if (t >= 0 && t.toString().indexOf(".") == -1) { timerDuration = t; // Notice of timer start if (mod != null) { cb.sendNotice(mod + ' has set a timer for ' + timerDuration + ' minutes!', '', colors.HiPurple); } // Local variable to convert noticeTime (minutes) to milliseconds millis = timerDuration * 60000; fiveMinutes = millis - 300000; oneMinute = millis - 60000; // Actual timer cb.setTimeout(timer, millis); // Five minutes remaining announcement if (fiveMinutes > 0) { cb.setTimeout(fiveMinuteWarning, fiveMinutes); } // One minute remaining announcement cb.setTimeout(oneMinuteWarning, oneMinute); // Set the start time startTime = new Date(); } else if (t != null) { cb.sendNotice(t + ' is not a valid option for /starttimer.\nType /jbhelp starttimer to see how to use /starttimer.', mod, colors.LightSalmon); } else if (t == null) { cb.sendNotice('You did not enter a valid option for /starttimer.\nType /jbhelp starttimer to see how to use /starttimer.', mod, colors.LightSalmon); } } // There is a timer running and time has been added else if (startTime != 0 && timeAdded != 0 && mod == null) { timeAdded = 0; timerDuration = t; millis = timerDuration * 60000; fiveMinutes = millis - 300000; oneMinute = millis - 60000; cb.setTimeout(timer, millis); if (fiveMinutes > 0) { cb.setTimeout(fiveMinuteWarning, fiveMinutes); } cb.setTimeout(oneMinuteWarning, oneMinute); } // There is a timer running and someone tried to start a new timer else if (startTime != 0 && timeAdded == 0 || startTime != 0 && timeAdded != 0 && mod != null) { cb.sendNotice('There is a timer running already.', mod, colors.LightSalmon); } } function timer() { // Check to see if /addTime has been used if (timeAdded == 0) { cb.sendNotice('Time is up!', '', colors.HiPurple); startTime = 0; timerDuration = 0; } else { if (timeAdded == 5) { cb.sendNotice('There are 5 minutes remaining!', '', colors.HiPurple); } startTimer(timeAdded); } } function fiveMinuteWarning() { if (timeAdded == 0) { cb.sendNotice('There are 5 minutes remaining!', '', colors.HiPurple); } } function oneMinuteWarning() { if (timeAdded == 0) { cb.sendNotice('There is 1 minute remaining!', '', colors.HiPurple); } } function timeLeft2(user) { if (startTime != 0) { // Local variable for the current time var currentTime = new Date(); // Local variable to hold the time left var timeLeft = startTime.getHours() * 3600 + startTime.getMinutes() * 60 + startTime.getSeconds() + timerDuration * 60 - currentTime.getHours() * 3600 - currentTime.getMinutes() * 60 - currentTime.getSeconds(); // Local variables for hours, minutes, and seconds remaining var hours = timeLeft / 3600; hours = Math.floor(hours); var minutes = (timeLeft - hours * 3600) / 60; minutes = Math.floor(minutes); var seconds = timeLeft - hours * 3600 - minutes * 60; // Account for timeAdded minutes += timeAdded; // Fix numbers after timeAdded if (hours < 0) { hours = 0; minutes = 0; } if (hours > 0) { if (hours > 9) { if (minutes > 9 && seconds > 9) { cb.sendNotice('Time Remaining: ' + hours + ':' + minutes + ':' + seconds, user, colors.HiPurple); } else if (minutes > 9 && seconds <= 9) { cb.sendNotice('Time Remaining: ' + hours + ':' + minutes + ':0' + seconds, user, colors.HiPurple); } else if (minutes <= 9 && seconds > 9) { cb.sendNotice('Time Remaining: ' + hours + ':' + minutes + ':' + seconds, user, colors.HiPurple); } else if (minutes <= 9 && seconds <= 9) { cb.sendNotice('Time Remaining: ' + hours + ':' + minutes + ':0' + seconds, user, colors.HiPurple); } } else { if (minutes > 9 && seconds > 9) { cb.sendNotice('Time Remaining: 0' + hours + ':' + minutes + ':' + seconds, user, colors.HiPurple); } else if (minutes > 9 && seconds <= 9) { cb.sendNotice('Time Remaining: 0' + hours + ':' + minutes + ':0' + seconds, user, colors.HiPurple); } else if (minutes <= 9 && seconds > 9) { cb.sendNotice('Time Remaining: 0' + hours + ':' + minutes + ':' + seconds, user, colors.HiPurple); } else if (minutes <= 9 && seconds <= 9) { cb.sendNotice('Time Remaining: 0' + hours + ':' + minutes + ':0' + seconds, user, colors.HiPurple); } } } else if (hours == 0 && minutes > 0) { if (minutes > 9 && seconds > 9) { cb.sendNotice('Time Remaining: 00:' + minutes + ':' + seconds, user, colors.HiPurple); } else if (minutes > 9 && seconds <= 9) { cb.sendNotice('Time Remaining: 00:' + minutes + ':0' + seconds, user, colors.HiPurple); } else if (minutes <= 9 && seconds > 9) { cb.sendNotice('Time Remaining: 00:0' + minutes + ':' + seconds, user, colors.HiPurple); } else if (minutes <= 9 && seconds <= 9) { cb.sendNotice('Time Remaining: 00:0' + minutes + ':0' + seconds, user, colors.HiPurple); } } else if (hours == 0 && minutes == 0 && seconds > 0) { if (seconds > 9) { cb.sendNotice('Time Remaining: 00:00' + ':' + seconds, user, colors.HiPurple); } else { cb.sendNotice('Time Remaining: 00:00' + ':0' + seconds, user, colors.HiPurple); } } else { cb.sendNotice('hours: ' + hours + '\nminutes: ' + minutes + '\nseconds: ' + seconds); } } else { cb.sendNotice('There is no timer running.', user, colors.LightSalmon); } } function addTime(t, mod) { if (t > 0 && t.toString().indexOf('.') == -1) { if (startTime != 0) { timeAdded = Number.parseInt(t, 10); // Notice of timer start if (timeAdded == 1) { cb.sendNotice(mod + ' has added 1 minute to the timer!', '', colors.HiPurple); } else { cb.sendNotice(mod + ' has added ' + timeAdded + ' minutes to the timer!', '', colors.HiPurple); } } else { cb.sendNotice('There is no timer running.', mod, colors.LightSalmon); } } else if (t != null) { cb.sendNotice(t + ' is not a valid option for /addtime.\nType /jbhelp addtime to see how to use /addtime.', mod, colors.LightSalmon); } else if (t == null) { cb.sendNotice('You did not enter a valid option for /addtime.\nType /jbhelp addtime to see how to use /addtime.', mod, colors.LightSalmon); } } function startMute(t, mod) { // There is no timer already running if (timeLeftMute <= 0) { // Check if a valid option was sent with /starttimer if (t >= 0 && t.toString().indexOf(".") == -1) { timerDurationMute = t; cb.sendNotice(mod + ' has granted us ' + timerDurationMute + ' minutes of silence!', '', colors.HiPurple); startTimeMute = new Date(); mutesAdded = 1; timeLeftMute = timerDurationMute * 60; timeAnounce(); } } else if (timeLeftMute > 0) { cb.sendNotice(mod + ' has granted us ' + timerDurationMute + ' minutes more silence!', '', colors.HiPurple); mutesAdded++; currentTimeMute = new Date(); timeLeftMute = startTimeMute.getHours() * 3600 + startTimeMute.getMinutes() * 60 + startTimeMute.getSeconds() + (timerDurationMute * mutesAdded) * 60 - currentTimeMute.getHours() * 3600 - currentTimeMute.getMinutes() * 60 - currentTimeMute.getSeconds() ; } } function secondsToTime(secs) { secs = Math.round(secs); var hours = Math.floor(secs / (60 * 60)); var divisor_for_minutes = secs % (60 * 60); var minutes = Math.floor(divisor_for_minutes / 60); var divisor_for_seconds = divisor_for_minutes % 60; var seconds = Math.ceil(divisor_for_seconds); if(minutes < 10){ minutes = "0" + minutes; } if(seconds < 10){ seconds = "0" + seconds; } var result = (hours+":"+ minutes+":"+ seconds); return result; } function timeAnounce(){ if(timeLeftMute > 0) { if(timeLeftMute % timeMuteAnnounce == 0){ cb.sendNotice("Time of this sweet silence left : " + secondsToTime(timeLeftMute)); } timeDelay(); timeLeftMute = timeLeftMute - 1; } else { cb.sendNotice("JENNA you can talk again!"); } } function timeDelay(){ cb.setTimeout(timeAnounce, (1000)); } function eMod(ar, user, from) { if (user != null && (user != "" || user != " ")) { if (ar == 'add') { if (!cbjs.arrayContains(modArray, user)) { if (!cbjs.arrayContains(eModArray, user)) { eModArrayPopulate(user); cb.sendNotice('Emergency moderator powers have been granted to ' + user, from, colors.HiPurple); cb.sendNotice("Emergency moderator powers have been granted to " + user, "", colors.HiPurple, "","" , "red" ); cb.sendNotice('You have been granted emergency moderator powers by ' + from, user, "#efe"); } else { cb.sendNotice(user + ' has already been granted emergency moderator powers.', from, colors.LightSalmon); } } else { cb.sendNotice("This user is already a regular moderator or the room host.", user, colors.LightSalmon); } } else if (ar == 'remove') { if (cbjs.arrayContains(eModArray, user)) { cbjs.arrayRemove(eModArray, user); cb.sendNotice('Emergency moderator powers have been removed from ' + user, from, colors.HiPurple); cb.sendNotice('Emergency moderator powers have been removed from ' + user, "", colors.HiPurple,"","","red"); cb.sendNotice('Your emergency moderator powers have been removed by ' + from, user, colors.LightSalmon); } else { cb.sendNotice(user + ' has not been granted emergency moderator powers.', from, colors.LightSalmon); } } else { cb.sendNotice(ar + ' is not a valid option for /emod. Type "/jbhelp emod" to see how to use /emod.', from, colors.LightSalmon); } } else { cb.sendNotice("You didn't specify who should have emergency moderator powers granted to or revoked from.\nType \"/jbhelp emod\" to see how to use /emod.", from, colors.LightSalmon); } } function help(option, from) { var valid = false; if (option == null) { option = ""; } switch (option) { case "": valid = true; cb.sendNotice('Jenna Bot Help Menu', from, colors.HiPurple); cb.sendNotice('Type /jbhelp x, where x is one of the following choices, for more detailed information.' + '\nEx: /jbhelp commands', from); cb.sendNotice('', from, colors.HiPurple); cb.sendNotice('commands\n' + 'nicelist', from); cb.sendNotice('', from, colors.HiPurple); break; case 'commands': valid = true; cb.sendNotice('Jenna Bot Command List', from, colors.HiPurple); cb.sendNotice('Type /jbhelp x, where x is one of the following commands, for more detailed information.' + '\nEx: /jbhelp silencelevel', from); cb.sendNotice('', from, colors.HiPurple); cb.sendNotice("/cn" + "\n/cnd" + "\n/cndh" + "\n/cnh" + "\n/bc" + "\n/tm" + "\n/tbm" + "\n/tv" + '\n/silencelevel' + '\n/graphiclevel' + '\n/silence' + '\n/unsilence' + "\n/ninja" + "\n/unninja" + '\n/starttimer' + '\n/addtime' + '\n/timeleft' + '\n/emod' + '\n/addnice' + '\n/removenice' + '\n/leaderboard' + "\n/kingtipper" + '\n/kingspam' + '\n/notifierspam' + '\n/nickmod' + '\n/nickname' + '\n/nicknames' + '\n/addkingpotato' + '\n/kingpotatolist'+ '\n/addsecretpotato' + '\n/secretpotatolist'+ '\n/lasttip' + '\n/jbhelp', from); cb.sendNotice('', from, colors.HiPurple); break; case "kingtipper": valid = true; cb.sendNotice('/kingtipper Help', from, colors.HiPurple); cb.sendNotice('/kingtipper is a command that is usable by moderators and room hosts.' + '\nThe syntax for using kingtipper is /kingtipper x, where x is either on or off. ' + 'Using this command toggles the message "We have a new King! All hail x!"', from); cb.sendNotice('', from, colors.HiPurple); break; case "cn": case "sendnotice": valid = true; cb.sendNotice("/cn Help", from, colors.HiPurple); cb.sendNotice("/cn is a command that is usable by moderators and room hosts.\n" + "The syntax for this command is /cn x, where x is the message you want to send to the main chat.\n" + 'Using "/cn r x" - where x is the message to be sent - will send the message in red ' + "instead of the default color for notices.\n" + "/sendnotice is also a command that will send notices to the chat.", from); cb.sendNotice("", from, colors.HiPurple); break; case "cnd": valid = true; cb.sendNotice("/cnd Help", from, colors.HiPurple); cb.sendNotice("/cnd is a command that is usable by moderators and room hosts.\n" + "The syntax for this command is /cnd x, where x is the message you want to send to the main chat.\n" + "The message will be sent with divider lines.\n" + 'Using "/cnd r x" - where x is the message to be sent - will send the message in red ' + "instead of the default color for notices.", from); cb.sendNotice("", from, colors.HiPurple); break; case "cndh": valid = true; cb.sendNotice("/cndh Help", from, colors.HiPurple); cb.sendNotice("/cndh is a command that is usable by moderators and room hosts.\n" + "The syntax for this command is /cndh x, where x is the message you want to send to the main chat.\n" + "The message will be sent highlighted and with divider lines.\n" + 'Using "/cndh r x" - where x is the message to be sent - will send the message in red ' + "instead of the default color for notices.", from); cb.sendNotice("", from, colors.HiPurple); break; case "cnh": valid = true; cb.sendNotice("/cnh Help", from, colors.HiPurple); cb.sendNotice("/cnh is a command that is usable by moderators and room hosts.\n" + "The syntax for this command is /cnh x, where x is the message you want to send to the main chat.\n" + "The message will be sent highlighted.\n" + 'Using "/cnh r x" - where x is the message to be sent - will send the message in red ' + "instead of the default color for notices.", from); cb.sendNotice("", from, colors.HiPurple); break; case "bc": case "pmm": valid = true; cb.sendNotice("/bc Help", from, colors.HiPurple); cb.sendNotice("/bc is a command that is usable by moderators.\n" + "The syntax for this command is /bc x, where x is the message you want to send privately to the room host.\n" + "This can also be done using /pmm x.", from); cb.sendNotice("", from, colors.HiPurple); break; case "tm": valid = true; cb.sendNotice("/tm Help", from, colors.HiPurple); cb.sendNotice("/tm is a command that is usable by moderators and room hosts.\n" + "The syntax for this command is /tm x, where x is the message you want to send privately to " + "all moderators as a group.", from); cb.sendNotice("", from, colors.HiPurple); break; case "tbm": valid = true; cb.sendNotice("/tbm Help", from, colors.HiPurple); cb.sendNotice("/tm is a command that is usable by moderators and room hosts.\n" + "The syntax for this command is /tm x, where x is the message you want to send privately to " + "all moderators as a group and the room host.", from); cb.sendNotice("", from, colors.HiPurple); break; case "tv": valid = true; cb.sendNotice("/tv Help", from, colors.HiPurple); cb.sendNotice("/tv is a command that is usable by moderators and room hosts.\n" + "The syntax for this command is /tv x y, where x is the user who will receive the message, " + "and y is the message to be sent.", from); cb.sendNotice("", from, colors.HiPurple); break; case "nicelist": valid = true; cb.sendNotice("The Nice List", from, colors.HiPurple); cb.sendNotice("Sometimes, there are users whose comments are desirable, " + "but they either do not have tokens or do not tip frequently. " + "When rooms get rowdy, hosts and mods are forced to do things like " + "silence users without tokens or who have not tipped and those groups " + "often include the users whose comments hosts would like to see. " + "To fix this problem, hosts and mods can add users to the Nice List. " + "Users who are on the nice list can send messages regardless of the global silence setting.\n" + "To show the nice list at any time, type /nicelist.", from); cb.sendNotice("", from, colors.HiPurple); break; case "viplist": valid = true; cb.sendNotice("The VIP List", from, colors.HiPurple); cb.sendNotice("Sometimes, there're users who are trusted regulars, and then the room host decides to do a \"CrazyTicket\" show, " + "but these users don't have tokens to buy a ticket. " + "It isn't always desirable (and it may even seem unfair) to leave these users out of the show. " + "To fix this problem, hosts and mods can add these users to the VIP List. " + "Users who are on the VIP List will have free access to any future CrazyTicket show, provided the list is exported to the app via the \"/export\" command.\n" + "To show the VIP list at any time, type /viplist.", from); cb.sendNotice("", from, colors.HiPurple); break; case 'silencelevel': valid = true; cb.sendNotice('/silencelevel Help', from, colors.HiPurple); cb.sendNotice('/silencelevel is a command that is usable by moderators and room hosts.' + '\nThe syntax for using silencelevel is "/silencelevel x", where x is a number between 0 and 3.' + '\nSetting the Silence Level to 0 will grant voice privileges to all users, ' + 'setting it to 1 will revoke voice privileges from users without tokens, ' + 'setting it to 2 will revoke voice privileges from users who have not tipped, ' + 'and setting it to 3 will revoke voice privileges from users who have not tipped at least 10 tokens.\n\n' + "The levels below should be used only in extreme cases.\n" + "Level 4 will grant chat privileges only to users who tipped at least 100 tokens, " + "and level 5 will grant these privileges only to moderators, emergency moderators, and fan club members.\n" + '\nThe default setting for /silencelevel is 0.' + '\nRoom hosts, moderators, and fan club members are unaffected by the Silence Level.', from); cb.sendNotice('', from, colors.HiPurple); break; case 'graphiclevel': valid = true; cb.sendNotice('/graphiclevel Help', from, colors.HiPurple); cb.sendNotice('/graphiclevel is a command that is usable by moderators and room hosts.' + '\nThe syntax for using graphiclevel is "/graphiclevel x", where x is a number between 0 and 3.' + '\nSetting the Graphic Level to 0 will grant graphic usage privileges to all users, ' + 'setting it to 1 will revoke graphic usage privileges from users without tokens, ' + 'setting it to 2 will revoke graphic usage privileges from users who have not tipped, ' + 'and setting it to 3 will revoke graphic usage privileges from users who have not tipped at least 10 tokens.\n\n' + "The levels below should be used only in extreme cases.\n" + "Level 4 will grant graphic usage privileges only to users who tipped at least 100 tokens, " + "and level 5 will grant these privileges only to moderators, emergency moderators, and fan club members.\n" + '\nThe default setting for /graphiclevel is 0.' + '\nRoom hosts, moderators, and fan club members are unaffected by the Graphic Level.', from); cb.sendNotice('', from, colors.HiPurple); break; case 'silence': valid = true; cb.sendNotice('/silence Help', from, colors.HiPurple); cb.sendNotice('/silence is a command that is usable by moderators and room hosts.' + '\nThe syntax for using silence is "/silence x", where x is the username of the user you want to silence.' + "\nThe effect of /silence is the same as Chaturbate's silence feature, " + 'except that it lasts for the duration of the current session instead of for six hours.' + '\nThe effect of /silence can be reversed by using the command /unsilence.', from); cb.sendNotice('', from, colors.HiPurple); break; case 'unsilence': valid = true; cb.sendNotice('/unsilence Help', from, colors.HiPurple); cb.sendNotice('/unsilence is a command that is usable by moderators and room hosts.' + '\nThe syntax for using unsilence is "/unsilence x", where x is the username of the user you want to unsilence.' + '\nunsilence simply grants voice privileges back to a user who was previously silenced.' + '\nNOTE: /unsilence WILL NOT undo the effect of Chaturbate\'s silence feature!' + '\n/unsilence WILL ONLY reverse the effect of /silence!', from); cb.sendNotice('', from, colors.HiPurple); break; case 'starttimer': valid = true; cb.sendNotice('/starttimer Help', from, colors.HiPurple); cb.sendNotice('/starttimer is a command that is usable by moderators and room hosts.' + '\nThe syntax for using starttimer is "/starttimer x", where x is the desired duration of the timer in minutes.' + '\n/starttimer will accept whole numbers only.' + '\nThe timer will make announcements at five minutes remaining and at one minute remaining.' + '\n/addtime can be used to add time to a currently running timer.' + '\n/timeleft can be used to display the amount of time remaining on the timer.', from); cb.sendNotice('', from, colors.HiPurple); break; case 'addtime': valid = true; cb.sendNotice('/addtime Help', from, colors.HiPurple); cb.sendNotice('/addtime is a command that is usable by moderators and room hosts.' + '\nThe syntax for using addtime is "/addtime x", where x is the amount of time you want to add in minutes.' + '\n/addtime will accept whole numbers only.' + '\nSee the help section for starttimer for more information on timers.', from); cb.sendNotice('', from, colors.HiPurple); break; case 'timeleft': valid = true; cb.sendNotice('/timeleft Help', from, colors.HiPurple); cb.sendNotice('/timeleft is a command that is usable by everyone.' + '\nThe syntax for using timeleft is /timeleft' + '\n/timeleft will display the amount of time left on the timer in the format 00:00:00' + '\nSee the help section for starttimer for more information on timers.', from); cb.sendNotice('', from, colors.HiPurple); break; case 'emod': valid = true; cb.sendNotice('/emod Help', from, colors.HiPurple); cb.sendNotice('/emod is a command that is usable by moderators and room hosts.' + '\nThe syntax for using emod is "/emod x y", where x is either "add" or "remove" and y is the username of the user you want to either grant or revoke emergency moderator powers.' + '\n/emod allows moderators to quickly grant other users access to moderator-only commands in the event that he is having difficulty controlling the room by himself.' + '\nEmergency moderators have access to all moderator-only commands with the exceptions of /emod, /addnice, and /removenice.', from); cb.sendNotice('', from, colors.HiPurple); break; case 'addnice': valid = true; cb.sendNotice('/addnice Help', from, colors.HiPurple); cb.sendNotice('/addnice is a command that is usable by moderators and room hosts.' + '\nThe syntax for using addnice is "/addnice x", where x is the username of the user you want to add to the nice list.' + '\nAdding a user to the nice list guarantees that user voice and graphic usage privileges regardless of the silence, graphic, and ignore level settings. ' + 'Using /silence or /ignore will still silence or ignore a user on the nice list.' + '\nUsers can be removed from the nice list by using the command /removenice.' + '\nSee the help sections for silencelevel, graphiclevel, and ignorelevel for more information on the global settings or the help section for nicelist for more information on the nice list.', from); cb.sendNotice('', from, colors.HiPurple); break; case 'removenice': valid = true; cb.sendNotice('/removenice Help', from, colors.HiPurple); cb.sendNotice('/removenice is a command that is usable by moderators and room hosts.' + '\nThe syntax for using removenice is "/removenice x", where x is the username of the user you want to remove from the nice list.' + '\nSee the help section for nicelist for more information on the nice list.', from); cb.sendNotice('', from, colors.HiPurple); break; case "addvip": valid = true; cb.sendNotice('/addvip Help', from, colors.HiPurple); cb.sendNotice('/addvip is a command that is usable by moderators and room hosts.' + '\nThe syntax for using addvip is "/addvip x", where x is the username of the user you want to add to the VIP list.' + '\nAdding a user to the VIP list grants them free access to a future "CrazyTicket" show. ' + '\nUsers can be removed from the VIP list by using the command /removevip.' + '\nSee the help section for viplist for more information on the VIP list.', from); cb.sendNotice('', from, colors.HiPurple); break; case "addkingpotato": valid = true; cb.sendNotice('/addkingpotato Help', from, colors.HiPurple); cb.sendNotice('/addkingpotato is a command that is usable by moderators and room hosts.' + '\nThe syntax for using addkingpotato is "/addkingpotato x", where x is the username of the user you want to add to the King Potato list.', from); cb.sendNotice('', from, colors.HiPurple); break; case "kingpotatolist": valid = true; cb.sendNotice('/kingpotatolist Help', from, colors.HiPurple); cb.sendNotice('/kingpotatolist is a command that is usable by moderators and room hosts.' + '\nThe syntax for using kingpotatolist is "/kingpotatolist".' + '\nIt will return the List of all the King Potatoes', from); cb.sendNotice('', from, colors.HiPurple); break; case "addsecretpotato": valid = true; cb.sendNotice('/addsecretpotato Help', from, colors.HiPurple); cb.sendNotice('/addsecretpotato is a command that is usable by moderators and room hosts.' + '\nThe syntax for using addsecretpotato is "/addsecretpotato x", where x is the username of the user you want to add to the secret Potato list.', from); cb.sendNotice('', from, colors.HiPurple); break; case "secretpotatolist": valid = true; cb.sendNotice('/secretpotatolist Help', from, colors.HiPurple); cb.sendNotice('/secretpotatolist is a command that is usable by moderators and room hosts.' + '\nThe syntax for using secretpotatolist is "/secretpotatolist".' + '\nIt will return the List of all the secret Potatoes', from); cb.sendNotice('', from, colors.HiPurple); break; case "nickmod": valid = true; cb.sendNotice('/nickmod Help', from, colors.HiPurple); cb.sendNotice('/nickmod is a command that is usable by the room hosts.' + '\nThe syntax for using nickmod is "/nickmod".' + '\nSee the help section for nickmod for more information.', from); cb.sendNotice('', from, colors.HiPurple); break; case "nickname": valid = true; cb.sendNotice('/nickname Help', from, colors.HiPurple); cb.sendNotice('/nickname is a command that is usable by moderaters and the room hosts.' + '\nThe syntax for using nickname is "/nickname x y", where x is the user and y is the nickname that should be added.' + '\nif no new nickname is specified the existing nickname for this user is deleted.' + '\nSee the help section for nickname for more information.', from); cb.sendNotice('', from, colors.HiPurple); break; case "nicknames": valid = true; cb.sendNotice('/nicknames Help', from, colors.HiPurple); cb.sendNotice('/nicknames is a command that is usable by moderaters and the room hosts.' + '\nThe syntax for using nicknames is "/nicknames".' + '\nthis command will output a list of all assigned nicknames.' + '\nSee the help section for nickname for more information.', from); cb.sendNotice('', from, colors.HiPurple); break; case "removevip": valid = true; cb.sendNotice('/removevip Help', from, colors.HiPurple); cb.sendNotice('/removevip is a command that is usable by moderators and room hosts.' + '\nThe syntax for using removevip is "/removevip x", where x is the username of the user you want to remove from the VIP list.' + '\nSee the help section for viplist for more information on the VIP list.', from); cb.sendNotice('', from, colors.HiPurple); break; case 'jbhelp': valid = true; cb.sendNotice('/jbhelp Help', from, colors.HiPurple); cb.sendNotice('/jbhelp is a command that is usable by everyone.' + '\nThe syntax for using jbhelp is "/jbhelp x", where x is the subsection of the help menu that you want to access.', from); cb.sendNotice('', from, colors.HiPurple); break; case 'leaderboard': valid = true; cb.sendNotice('/leaderboard Help', from, colors.HiPurple); cb.sendNotice('/leaderboard is a command that is usable by everyone.' + '\nThe syntax for using leaderboard is "/leaderboard".' + '\n/leaderboard shows the top 3 tippers of the current session.', from); cb.sendNotice('', from, colors.HiPurple); break; case 'kingspam': valid = true; cb.sendNotice('/kingspam Help', from, colors.HiPurple); cb.sendNotice('/kingspam is a command that is usable by moderators and room hosts.' + '\nThe syntax for using kingspam is /kingspam x, where x is either on or off. ' + 'Using this command toggles the spamming of the message "Tip x to become the new King!"', from); cb.sendNotice('', from, colors.HiPurple); break; case 'notifierspam': valid = true; cb.sendNotice('/notifierspam Help', from, colors.HiPurple); cb.sendNotice('/notifierspam is a command that is usable by moderators and room hosts.' + '\nThe syntax for using notifierspam is /notifierspam x, where x is either on or off. ' + 'Using this command toggles the spamming of the periodic message defined by the host.', from); cb.sendNotice('', from, colors.HiPurple); break; case 'leaderboardspam': valid = true; cb.sendNotice('/leaderboardspam Help', from, colors.HiPurple); cb.sendNotice('/leaderboardspam is a command that is usable by moderators and room hosts.' + '\nThe syntax for using leaderboardspam is /leaderboardspam x, where x is either on or off. ' + 'Using this command toggles the spamming of the top three tippers.', from); cb.sendNotice('', from, colors.HiPurple); break; case 'lasttip': valid = true; cb.sendNotice('/lasttip Help', from, colors.HiPurple); cb.sendNotice('/lasttip is a command that is usable by moderators and room hosts.' + '\nThe syntax for using lasttip is /lasttip' + 'Using this command sends the last tip bigger than 25 Tokens incl. Note again to the Broadcaster', from); cb.sendNotice('', from, colors.HiPurple); break; } if (valid == false) { cb.sendNotice(option + ' is not a valid subsection of the help menu. Type /jbhelp to access the main help menu.', from, colors.LightSalmon); } } function kingSpam() { cb.setTimeout(kingSpamTimer, kingTimer * 60000); } function kingSpamTimer() { var supplant; if (kingTip < Number.parseInt(cb.settings.kingMin, 10)) { supplant = cb.settings.kingMin; } else { supplant = kingTip + 1; } if (kingTipperSpam == true) { cb.sendNotice('Tip ' + supplant + ' to become the new King!', '', "", "#09a", "bold"); kingSpam(); } } function leaderSpam() { cb.setTimeout(leaderSpamTimer, leaderTimer * 60000); } function leaderSpamTimer() { if (leaderboardSpam == true) { sortTippers(); var outString = ""; for (i = 1; i <= 5; i++) { if (tipperList.name[i - 1] == null) outString += "\u25ba" + i + ". --" + "\n"; else outString += "\u25ba " + i + ". " + '"' + tipperList.name[i - 1] + '"' + ": " + tipperList.amount[i - 1] + "\n"; } cb.sendNotice(dashLine + "\n\u25ba \u25ba \u25ba LEADERBOARD \u25c4 \u25c4 \u25c4\n" + outString + dashLine, "", "#ddd", "#246", "bold"); leaderSpam(); } } function showLeaderBoard(from) { if (cb.settings.leaderBoard == "Yes") { sortTippers(); var outString = ""; for (i = 1; i <= 5; i++) { if (tipperList.name[i - 1] == null) outString += "\u25ba" + i + ". --" + "\n"; else outString += "\u25ba " + i + ". " + '"' + tipperList.name[i - 1] + '"' + ": " + tipperList.amount[i - 1] + "\n"; } cb.sendNotice(dashLine + "\n\u25ba \u25ba \u25ba LEADERBOARD \u25c4 \u25c4 \u25c4\n" + outString + dashLine, from, "#ddd", "#246", "bold"); } else { cb.sendNotice('The room host has decided not to use the Leaderboard feature.', from, colors.LightSalmon); } } function notifierSpam() { cb.setTimeout(notifierSpamTimer, cb.settings.spamTimer * 60000); } function notifierSpamTimer() { if (notifierSpamTGL == true) { cb.sendNotice(notifierMessage, "", "#ddd", "#246", "bold"); notifierSpam(); } } function nice (user, mod, ar) { if (ar == "a") { if (user != null && (user != "" || user != " " || user != "\u00a0")) { if (user != cb.room_slug || !cbjs.arrayContains(modArray, user) || cbjs.arrayContains(eModArray, user)) { if (!cbjs.arrayContains(niceArray, user)) { niceArrayPopulate(user); cb.sendNotice('You have added ' + user + ' to the nice list.', mod, colors.HiPurple); cb.sendNotice(mod + ' has added you to the nice list. You will be able to chat and use graphics regardless of the global room settings. Thank you for being nice!', user, "#efe"); } else { cb.sendNotice(user + ' is already on the nice list.', mod, colors.LightSalmon); } } else { cb.sendNotice("Room hosts, moderators, and emergency moderators don't need to be added to the Nice List.", mod, colors.LightSalmon); } } else { cb.sendNotice("You didn't specify who you want to add to the nice list.\nType \"/jbhelp addnice\" to see how to use /addnice.\n" + "Additionally, check the nicelist help section for more info.", mod, colors.LightSalmon); } } else if (ar == "r") { if (user != null && (user != "" || user != " " || user != "\u00a0")) { if (niceArray.length > 0) { if (user == "all") { cb.sendNotice("You have removed all users from the nice list.", mod, colors.HiPurple); for (i = 0; i < niceArray.length; i++) cb.sendNotice(mod + " has removed you from the nice list.", niceArray[i], colors.LightSalmon); niceArray.length = 0; } else { if (cbjs.arrayContains(niceArray, user)) { cbjs.arrayRemove(niceArray, user); cb.sendNotice('You have removed ' + user + ' from the nice list.', mod, colors.HiPurple); cb.sendNotice(mod + ' has removed you from the nice list.', user, colors.LightSalmon); } else { cb.sendNotice(user + ' is not on the nice list.', mod, colors.LightSalmon); } } } else { cb.sendNotice("The nice list is currently empty.", mod, colors.LightSalmon); } } else { cb.sendNotice("You didn't specify who you want to remove from the nice list.\nType \"/jbhelp removenice\" to see how to use /removenice.\n" + "Additionally, check the nicelist help section for more info.", mod, colors.LightSalmon); } } } function vip (user, mod, ar) { if (ar == "a") { if (user != null && (user != "" || user != " " || user != "\u00a0")) { if (user != cb.room_slug || !cbjs.arrayContains(modArray, user) || cbjs.arrayContains(eModArray, user)) { if (!cbjs.arrayContains(vipArray, user)) { vipArrayPopulate(user); cb.sendNotice('You have added ' + user + ' to the VIP list.', mod, colors.HiPurple); cb.sendNotice(mod + ' has added you to the VIP list. You will have free access to any future "CrazyTicket" show.', user, "#efe"); } else { cb.sendNotice(user + ' is already on the VIP list.', mod, colors.LightSalmon); } } else { cb.sendNotice("Room hosts, moderators, and emergency moderators don't need to be added to the VIP List.", mod, colors.LightSalmon); } } else { cb.sendNotice("You didn't specify who you want to add to the VIP list.\nType \"/jbhelp addvip\" to see how to use /addvip.\n" + "Additionally, check the viplist help section for more info.", mod, colors.LightSalmon); } } else if (ar == "r") { if (user != null && (user != "" || user != " " || user != "\u00a0")) { if (vipArray.length > 0) { if (user == "all") { cb.sendNotice("You have removed all users from the VIP list.", mod, colors.HiPurple); for (i = 0; i < vipArray.length; i++) cb.sendNotice(mod + " has removed you from the VIP list.", vipArray[i], colors.LightSalmon); vipArray.length = 0; } else { if (cbjs.arrayContains(vipArray, user)) { cbjs.arrayRemove(vipArray, user); cb.sendNotice('You have removed ' + user + ' from the VIP list.', mod, colors.HiPurple); cb.sendNotice(mod + ' has removed you from the VIP list.', user, colors.LightSalmon); } else { cb.sendNotice(user + ' is not on the VIP list.', mod, colors.LightSalmon); } } } else { cb.sendNotice("The VIP list is currently empty.", mod, colors.LightSalmon); } } else { cb.sendNotice("You didn't specify who you want to remove from the VIP list.\nType \"/jbhelp removevip\" to see how to use /removevip.\n" + "Additionally, check the viplist help section for more info.", mod, colors.LightSalmon); } } } function kingPotato (user, mod) { if (user != null && (user != "" || user != " " || user != "\u00a0")) { if (user != cb.room_slug) { if (!cbjs.arrayContains(KingPotatoArray, user)) { kingPotatoArrayPopulate(user); cb.sendNotice('You have added ' + user + ' to the King Potato list.', mod, colors.HiPurple); cb.sendNotice(mod + ' has added you to the King Potato list.', user, "#efe"); } else { cb.sendNotice(user + ' is already on the King Potatolist.', mod, colors.LightSalmon); } } else { cb.sendNotice("Room hosts don't need to be added to the King Potato List.", mod, colors.LightSalmon); } } else { cb.sendNotice("You didn't specify who you want to add to the King Potato list.", mod, colors.LightSalmon); } } function secretPotato (user, mod) { if (user != null && (user != "" || user != " " || user != "\u00a0")) { if (user != cb.room_slug) { if (!cbjs.arrayContains(SecretPotatoArray, user)) { SecretPotatoArrayPopulate(user); cb.sendNotice('You have added ' + user + ' to the Secret Potato list.', mod, colors.HiPurple); cb.sendNotice(mod + ' has added you to the Secret Potato list.', user, "#efe"); } else { cb.sendNotice(user + ' is already on the Secret Potatolist.', mod, colors.LightSalmon); } } else { cb.sendNotice("Room hosts don't need to be added to the Secret Potato List.", mod, colors.LightSalmon); } } else { cb.sendNotice("You didn't specify who you want to add to the Secret Potato list.", mod, colors.LightSalmon); } } function kingSpamToggle (option, mod) { if (option != null && (option != "" || option != " ")) { switch (option) { case "on": if (kingTipperSpam == true) { cb.sendNotice("The King Tipper Spam is already turned on!", mod, colors.LightSalmon); } else { kingTipperSpam = true; cb.sendNotice("You have turned on the King Tipper Spam.", mod, colors.HiPurple); } break; case "off": if (kingTipperSpam == false) { cb.sendNotice("The King Tipper Spam is already turned off!", mod, colors.LightSalmon); } else { kingTipperSpam = false; cb.sendNotice("You have turned off the King Tipper Spam.", mod, colors.HiPurple); } break; default: cb.sendNotice(option + ' is not a valid option for /kingspam.\nType /jbhelp kingspam to see how to use /kingspam.', mod, colors.LightSalmon); break; } } else { cb.sendNotice("You didn't enter a valid option for /kingspam.\nType /jbhelp kingspam to see how to use /kingspam.\n\n" + "King Tipper Spam status is: " + (kingTipperSpam == true ? "On." : "Off."), mod, colors.LightSalmon); } } function kingTipperToggle (option, mod) { if (option != null && (option != "" || option != " ")) { switch (option) { case "on": if (kingTipper == true) { cb.sendNotice("The King Tipper feature is already turned on!", mod, colors.LightSalmon); } else { kingTipper = true; cb.sendNotice("You have turned on the King Tipper feature.", mod, colors.HiPurple); } break; case "off": if (kingTipper == false) { cb.sendNotice("The King Tipper feature is already turned off!", mod, colors.LightSalmon); } else { kingTipper = false; cb.sendNotice("You have turned off the King Tipper feature.", mod, colors.HiPurple); } break; default: cb.sendNotice(option + ' is not a valid option for /kingtipper.\nType /jbhelp kingspam to see how to use /kingtipper.', mod, colors.LightSalmon); break; } } else { cb.sendNotice("You didn't enter a valid option for /kingtipper.\nType /jbhelp kingtipper to see how to use /kingtipper.\n\n" + "King Tipper status is: " + (kingTipper == true ? "On." : "Off."), mod, colors.LightSalmon); } } function notifierSpamToggle (option, mod) { if (option != null && (option != "" || option != " ")) { switch (option) { case "on": if (notifierSpamTGL == true) { cb.sendNotice("The Notifier Spam is already turned on!", mod, colors.LightSalmon); } else { notifierSpamTGL = true; cb.sendNotice("You have turned on the Notifier Spam.", mod, colors.HiPurple); } break; case "off": if (notifierSpamTGL == false) { cb.sendNotice("The Notifier Spam is already turned off!", mod, colors.LightSalmon); } else { notifierSpamTGL = false; cb.sendNotice("You have turned off the Notifier Spam.", mod, colors.HiPurple); } break; default: cb.sendNotice(option + ' is not a valid option for /notifierspam.\nType /jbhelp kingspam to see how to use /notifierspam.', mod, colors.LightSalmon); break; } } else { cb.sendNotice("You didn't enter a valid option for /notifierspam.\nType /jbhelp notifierspam to see how to use /notifierspam.\n\n" + "Notifier Spam status is: " + (notifierSpamTGL == true ? "On." : "Off."), mod, colors.LightSalmon); } } function leaderboardSpamToggle (option, mod) { if (option != null && (option != "" || option != " ")) { switch (option) { case "on": if (leaderboardSpam == true) { cb.sendNotice("The Leaderboard Spam is already turned on!", mod, colors.LightSalmon); } else { leaderboardSpam = true; cb.sendNotice("You have turned on the Leaderboard Spam.", mod, colors.HiPurple); } break; case "off": if (leaderboardSpam == false) { cb.sendNotice("The Leaderboard Spam is already turned off!", mod, colors.LightSalmon); } else { leaderboardSpam = false; cb.sendNotice("You have turned off the Leaderboard Spam.", mod, colors.HiPurple); } break; default: cb.sendNotice(option + ' is not a valid option for /leaderboardspam.\nType /jbhelp leaderboardspam to see how to use /leaderboardspam.', mod, colors.LightSalmon); break; } } else { cb.sendNotice("You didn't enter a valid option for /leaderboardspam.\nType /jbhelp leaderboardspam to see how to use /leaderboardspam.\n\n" + "Leaderboard Spam status is: " + (leaderboardSpam == true ? "On." : "Off."), mod, colors.LightSalmon); } } function sendPublicNotice (message, user, type, color) { if (message != null) { if (message != "" || message != " " || message != "\u00a0") { if (color == "red") { switch (type) { case "div": cb.sendNotice(dashLine + "\n\u25ba " + message.capitalize() + "\n" + dashLine, "", "", "#d10", "bold"); if (devMode == true) cb.log("Message sent to chat: " + message); break; case "divh": cb.sendNotice(dashLine + "\n\u25ba " + message.capitalize() + "\n" + dashLine, "", colors.LightSalmon, "#d10", "bold"); if (devMode == true) cb.log("Message sent to chat: " + message); break; case "h": cb.sendNotice("\u25ba " + message.capitalize(), "", colors.LightSalmon, "#d10", "bold"); if (devMode == true) cb.log("Message sent to chat: " + message); break; case "": cb.sendNotice("\u25ba " + message.capitalize(), "", "", "#d10", "bold"); if (devMode == true) cb.log("Message sent to chat: " + message); break; } } else if (color == "default") { switch (type) { case "div": cb.sendNotice(dashLine + "\n\u25ba " + message.capitalize() + "\n" + dashLine, "", "", "#306", "bold"); if (devMode == true) cb.log("Message sent to chat: " + message); break; case "divh": cb.sendNotice(dashLine + "\n\u25ba " + message.capitalize() + "\n" + dashLine, "", "#eef", "#306", "bold"); if (devMode == true) cb.log("Message sent to chat: " + message); break; case "h": cb.sendNotice("\u25ba " + message.capitalize(), "", "#eef", "#306", "bold"); if (devMode == true) cb.log("Message sent to chat: " + message); break; case "": cb.sendNotice("\u25ba " + message.capitalize(), "", "", "#306", "bold"); if (devMode == true) cb.log("Message sent to chat: " + message); break; } } } else { cb.sendNotice("You can't send a blank message.\nType a message and try again.", user, colors.LightSalmon); } } else { cb.sendNotice("You can't send a blank message.\nType a message and try again.", user, colors.LightSalmon); } } function sendPrivateNotice (message, user, type) { // Optional param: dest (only if type is to_viewer) if (message != null) { if (message != "" || message != " " || message != "\u00a0") { switch (type) { case "to_mods": cb.sendNotice("\u25ba " + user + ": " + message, "", colors.Red, "#440000", "bold", "red"); break; case "to_caster": cb.sendNotice("\u25ba " + user + ": " + message, cb.room_slug, "#fed", "#741", "bold"); cb.sendNotice("\u25ba " + user + ": " + message, user, "#fed", "#741", "bold"); break; case "to_mods_and_caster": cb.sendNotice("\u25ba " + user + ": " + message, cb.room_slug, "#def", "#147", "bold"); cb.sendNotice("\u25ba " + user + ": " + message, "", "#def", "#147", "bold", "red"); break; case "to_viewer": if (arguments[3] != null && (arguments[3] != "" || arguments[3] != " " || arguments[3] != "\u00a0")) { cb.sendNotice("\u25ba" + user + "\u25c4 " + message, arguments[3], "#ffb", "#d10", "bold"); cb.sendNotice("\u25ba" + user + "\u25c4 " + message, user, "#ffb", "#d10", "bold"); } else { cb.sendNotice("You didn't specify who should receive the message.\nPlease enter a username and try again."); } break; } } else { cb.sendNotice("You can't send a blank message.\nType a message and try again.", user, colors.LightSalmon); } } else { cb.sendNotice("You can't send a blank message.\nType a message and try again.", user, colors.LightSalmon); } } function cleanUpChat(x) { var n,text; if (x != null) { if (Number.parseInt(x)){ n = x; text = "Cleaning up chat..."; } else { text = "cleaning up because " + x +" happened"; n = 50; } } else { n = 30; text = "Cleaning up chat..."; } for (i = 1; i <= n; i++) cb.sendNotice(text, "", colors.Cyan); cb.sendNotice("Chat cleaned up.", "", colors.Cyan); } function colorChecker(code) { var validChars = /[A-F0-9]+$/i; // About the RegExp below: All characters till the last char in the unicode range will be invalid var invalidChars = /[\u0021\u0022\u0024-\u002f\u003a-\u0040G-Z\u005b-\u005e\u007b-\uffff]+$/i; if (code != null) { if (code.length == 3 || code.length == 6) { if (validChars.exec(code) && !(invalidChars.exec(code))) { return true; } else if (invalidChars.exec(code)) { return false; } } else if (code.charAt(0) == "#" && (code.length == 4 || code.length == 7)) { if (validChars.exec(code) && !(invalidChars.exec(code))) { return true; } else if (invalidChars.exec(code)) { return false; } } else { return false; } } return null; } function sortTippers() { var swapped, temp1, temp2; do { swapped = false; for (i = 0; i < tipperList.amount.length - 1; i++) { if (tipperList.amount[i] < tipperList.amount[i + 1]) { temp1 = tipperList.amount[i]; temp2 = tipperList.name[i]; tipperList.amount[i] = tipperList.amount[i + 1]; tipperList.amount[i + 1] = temp1; tipperList.name[i] = tipperList.name[i + 1]; tipperList.name[i + 1] = temp2; swapped = true; } } } while (swapped); } // cb.onMessage() cb.onMessage(function(msg) { // Turn the message into an array var message = msg.m.split(" "); // false = invalid command, true = valid command var cmd = false; // true = user is already silenced var silenced = false; var symbolRegExp = /[\u0021-\u002f\u003a-\u0040\u005b-\u005e\u007b-\u007e]/i; var listRegExp = /[,\s]+/; // User vars var u = msg.user; var hasTipped = tipperList.name.indexOf(u) > -1; var hasTokens = msg.has_tokens; var isBc = u == cb.room_slug; // Enable dev access var isDev = (msg.user == "bob1803xxx"); var isEMod = cbjs.arrayContains(eModArray, u); var isKingPotato = cbjs.arrayContains(KingPotatoArray, u); var isSecretPotato = cbjs.arrayContains(SecretPotatoArray, u); var isFan = msg.in_fanclub; var isMod = msg.is_mod; var isOnNiceList = cbjs.arrayContains(niceArray, u); var aliases_key; var originalmessage; var bbNick; var originaluser = u.toLowerCase(); var out; var BBmatch; var i; var cmdval_s; var cmdval_2; // Let silenceLevel do its thing if (silenceLevel > 0 && !isMod && !isBc && !isEMod && !isOnNiceList && !isFan && silenced == false) { switch (silenceLevel) { case 1: if (!hasTokens && (Number.parseInt(tipperArray[findTipper(u)][1], 10) == 0)) { msg["X-Spam"] = true; silenced = true; cb.sendNotice('I\'m sorry, but the silence level has been set to 1; your message was not sent. Only members who have tokens are currently permitted to talk in chat.\nPlease enjoy the show :smile', u, colors.HiPurple); return msg; } break; case 2: if (Number.parseInt(tipperArray[findTipper(u)][1], 10) == 0) { msg["X-Spam"] = true; silenced = true; cb.sendNotice('I\'m sorry, but the silence level has been set to 2; your message was not sent. Only members who have tipped at least 1 token are currently permitted to talk in chat.\nPlease enjoy the show :smile', u, colors.HiPurple); return msg; } break; case 3: if (Number.parseInt(tipperArray[findTipper(u)][1], 10) < 10) { msg["X-Spam"] = true; silenced = true; cb.sendNotice('I\'m sorry, but the silence level has been set to 3; your message was not sent. Only members who have tipped at least 10 tokens are currently permitted to talk in chat.\nPlease enjoy the show :smile', u, colors.HiPurple); return msg; } break; // Extra levels case 4: if (Number.parseInt(tipperArray[findTipper(u)][1], 10) < 100) { msg["X-Spam"] = true; silenced = true; cb.sendNotice("I'm sorry, but the silence level has been set to 4; your message was not sent. Only members who have tipped at least 100 tokens are currently permitted to talk in chat.\nPlease enjoy the show :smile", msg.user, colors.HiPurple); return msg; } break; case 5: msg["X-Spam"] = true; silenced = true; cb.sendNotice("I'm sorry, but the silence level has been set to 5; your message was not sent. Only moderators, emergency moderators, and fan club members are currently permitted to talk in chat.\nPlease enjoy the show :smile", msg.user, colors.HiPurple); break; } } // Let graphicLevel do its thing if (graphicLevel > 0 && !isMod && !isBc && !isEMod && !isOnNiceList && !isFan && silenced == 0) { switch (graphicLevel) { case 1: if (!hasTokens) { for (i = 0; i < message.length; i++) { if (message[i].charAt(0) == ':') { msg['X-Spam'] = true; cb.sendNotice('Your message was not sent because you tried to use ' + message[i] + ' and the graphic level has been set to ' + graphicLevel + '.\nPlease enjoy the show :smile', u, colors.HiPurple); return msg; } } } break; case 2: if (Number.parseInt(tipperArray[findTipper(u)][1], 10) == 0) { for (i = 0; i < message.length; i++) { if (message[i].charAt(0) == ':') { msg['X-Spam'] = true; cb.sendNotice('Your message was not sent because you tried to use ' + message[i] + ' and the graphic level has been set to ' + graphicLevel + '.\nPlease enjoy the show :smile', u, colors.HiPurple); return msg; } } } break; case 3: if (Number.parseInt(tipperArray[findTipper(u)][1], 10) < 10) { for (i = 0; i < message.length; i++) { if (message[i].charAt(0) == ':') { msg['X-Spam'] = true; cb.sendNotice('Your message was not sent because you tried to use ' + message[i] + ' and the graphic level has been set to ' + graphicLevel + '.\nPlease enjoy the show :smile', u, colors.HiPurple); return msg; } } } break; case 4: if (Number.parseInt(tipperArray[findTipper(u)][1], 10) < 100) { for (i = 0; i < message.length; i++) { if (message[i].charAt(0) == ":"){ msg["X-Spam"] = true; cb.sendNotice("Your message was not sent because you tried to use " + message[i] + " and the graphic level has been set to " + graphicLevel + ".\nPlease enjoy the show :smile", msg.user, colors.HiPurple); return msg; } } } break; case 5: for (i = 0; i < message.length; i++) { if (message[i].charAt(0) == ":") { msg["X-Spam"] = true; cb.sendNotice("Your message was not sent because you tried to use " + message[i] + " and the graphic level has been set to " + graphicLevel + "\nPlease enjoy the show :smile", msg.user, colors.HiPurple); return msg; } } break; } } // Check to see if the user is attempting to use a command if (message[0].charAt(0) == "/") { // Don't print this message to chat msg["X-Spam"] = true; // Rebuild the message for usage with cn var ntc = null; for (i = 1; i < message.length; i++) { if (i == 1) ntc = message[i]; else ntc += " " + message[i]; } var ntc2 = null; for (i = 2; i < message.length; i++) { if (i == 2) ntc2 = message[i]; else ntc2 += " " + message[i]; } // Command value var cmdval = null; for (i = 1; i < message.length; i++) { if (i == 1) cmdval = message[i]; else cmdval += " " + message[i]; } switch (message[0]) { case "/silencelevel": // User entered a proper command cmd = true; // Permission check if (isMod || isBc || isEMod || (isDev && devMode == true)) { setSilenceLevel(message[1], u); } else { cb.sendNotice('Only moderators and broadcasters are able to use that command.', u, colors.HiPurple); } break; // Chat clean up case "/cleanup": cmd = true; if (isMod || isBc || isEMod || (isDev && devMode == true)) { if (message[1] != null && (message[1] != "" || message[1] != " " || message[1] != "\u00a0")) cleanUpChat(message[1]); else cleanUpChat(); } else { cb.sendNotice('Only moderators and broadcasters are able to use that command.', u, colors.HiPurple); } break; // Dev mode toggle case "/devmode": cmd = true; if (isDev) { if (message[1] == "on") { if (devMode == false){ devMode = true; cb.sendNotice("Developer mode on.", u, colors.HiPurple); }else cb.sendNotice("Developer mode already on!", u, colors.HiPurple); } else if (message[1] == "off") { if (devMode == true){ devMode = false; cb.sendNotice("Developer mode off.", u, colors.HiPurple); } else cb.sendNotice("Developer mode already off!", u, colors.HiPurple); } } break; // CrazyNote commands /* Regular */ case "/sendnotice": case "/cn": cmd = true; if (isMod || isBc || isEMod || (isDev && devMode == true)) { if (message[1] == "r") { if (ntc2 != null && (ntc2 != "" || ntc2 != " " || ntc2 != "\u00a0")) sendPublicNotice(ntc2, u, "", "red"); else cb.sendNotice("You can't send a blank message.\n" + "The correct syntax for this command is " + '"/cn r message"' + ".", u, colors.LightSalmon); } else if (ntc != null && (ntc != "" || ntc != " " || ntc != "\u00a0")) { sendPublicNotice(ntc, u, "", "default"); } else { cb.sendNotice("You can't send a blank message.\n" + "The correct syntax for this command is " + '"/cn message"' + ".", u, colors.LightSalmon); } } else { cb.sendNotice('Only moderators and broadcasters are able to use that command.', u, colors.HiPurple); } break; /* Highlight */ case "/cnh": cmd = true; if (isMod || isBc || isEMod || (isDev && devMode == true)) { if (message[1] == "r") { if (ntc2 != null && (ntc2 != "" || ntc2 != " " || ntc2 != "\u00a0")) sendPublicNotice(ntc2, u, "h", "red"); else cb.sendNotice("You can't send a blank message.\n" + "The correct syntax for this command is " + '"/cnh r message"' + ".", u, colors.LightSalmon); } else if (ntc != null && (ntc != "" || ntc != " " || ntc != "\u00a0")) { sendPublicNotice(ntc, u, "h", "default"); } else { cb.sendNotice("You can't send a blank message.\n" + "The correct syntax for this command is " + '"/cnh message"' + ".", u, colors.LightSalmon); } } else { cb.sendNotice('Only moderators and broadcasters are able to use that command.', u, colors.HiPurple); } break; /* Dividers */ case "/cnd": cmd = true; if (isMod || isBc || isEMod || (isDev && devMode == true)) { if (message[1] == "r") { if (ntc2 != null && (ntc2 != "" || ntc2 != " " || ntc2 != "\u00a0")) sendPublicNotice(ntc2, u, "div", "red"); else cb.sendNotice("You can't send a blank message.\n" + "The correct syntax for this command is " + '"/cnd r message"' + ".", u, colors.LightSalmon); } else if (ntc != null && (ntc != "" || ntc != " " || ntc != "\u00a0")) { sendPublicNotice(ntc, u, "div", "default"); } else { cb.sendNotice("You can't send a blank message.\n" + "The correct syntax for this command is " + '"/cnd message"' + ".", u, colors.LightSalmon); } } else { cb.sendNotice('Only moderators and broadcasters are able to use that command.', u, colors.HiPurple); } break; /* Dividers & highlight */ case "/cndh": cmd = true; if (isMod || isBc || isEMod || (isDev && devMode == true)) { if (message[1] == "r") { if (ntc2 != null && (ntc2 != "" || ntc2 != " " || ntc2 != "\u00a0")) sendPublicNotice(ntc2, u, "divh", "red"); else cb.sendNotice("You can't send a blank message.\n" + "The correct syntax for this command is " + '"/cndh r message"' + ".", u, colors.LightSalmon); } else if (ntc != null && (ntc != "" || ntc != " " || ntc != "\u00a0")) { sendPublicNotice(ntc, u, "divh", "default"); } else { cb.sendNotice("You can't send a blank message.\n" + "The correct syntax for this command is " + '"/cndh message"' + ".", u, colors.LightSalmon); } } else { cb.sendNotice('Only moderators and broadcasters are able to use that command.', u, colors.HiPurple); } break; /* Private notices */ // To room host */ case "/bc": case "/pmm": cmd = true; if (isMod || isEMod || (isDev && devMode == true)) { if (ntc != null && (ntc != "" || ntc != " " || ntc != "\u00a0")) { sendPrivateNotice(ntc, u, "to_caster"); } else { cb.sendNotice("You can't send a blank message.\n" + "The correct syntax for this command is " + '"/bc message"' + ".", u, colors.LightSalmon); } } else { cb.sendNotice('Only moderators are able to use that command.', u, colors.HiPurple); } break; // To mods */ case "/tm": cmd = true; if (isMod || isEMod || (isDev && devMode == true)) { if (ntc != null && (ntc != "" || ntc != " " || ntc != "\u00a0")) { sendPrivateNotice(ntc, u, "to_mods"); } else { cb.sendNotice("You can't send a blank message.\n" + "The correct syntax for this command is " + '"/tm message"' + ".", u, colors.LightSalmon); } } else { cb.sendNotice('Only moderators are able to use that command.', u, colors.HiPurple); } break; // To mods and room host */ case "/tbm": cmd = true; if (isMod || isBc || isEMod || (isDev && devMode == true)) { if (ntc != null && (ntc != "" || ntc != " " || ntc != "\u00a0")) { sendPrivateNotice(ntc, u, "to_mods_and_caster"); } else { cb.sendNotice("You can't send a blank message.\n" + "The correct syntax for this command is " + '"/tbm message"' + ".", u, colors.LightSalmon); } } else { cb.sendNotice('Only moderators are able to use that command.', u, colors.HiPurple); } break; // To viewer */ case "/tv": cmd = true; if (isMod || isBc || isEMod || (isDev && devMode == true)) { var dest = message[1]; if (dest != null && (dest != "" || dest != " ")) { if (!dest.equalsIgnoreCase(u)) { if (ntc != null && (ntc != "" || ntc != " " || ntc != "\u00a0")) { sendPrivateNotice(ntc, u, "to_viewer", dest.toLowerCase()); } else { cb.sendNotice("You can't send a blank message.\n" + "The correct syntax for this command is " + '"/tv username message"' + ".", u, colors.LightSalmon); } } else { cb.sendNotice("Talking to yourself is a little odd...", u, colors.LightSalmon); } } else { cb.sendNotice("You didn't specify a username.\n" + "The correct syntax for this command is " + '"/tv username message"' + ".", u, colors.LightSalmon); } } else { cb.sendNotice('Only moderators are able to use that command.', u, colors.HiPurple); } break; case '/graphiclevel': cmd = true; if (isMod || isBc || isEMod || (isDev && devMode == true)) { setGraphicLevel(message[1], u); } else { cb.sendNotice('Only moderators and broadcasters are able to use that command.', u, colors.HiPurple); } break; case '/silence': case "/sil": cmd = true; if (isMod || isBc || isEMod || (isDev && devMode == true)) { silence(message[1], u, "regular"); } else { cb.sendNotice('Only moderators and broadcasters are able to use that command.', u, colors.HiPurple); } break; case "/ninja": case "/ninjasil": cmd = true; if (isMod || isBc || isEMod || (isDev && devMode == true)) { silence(message[1], u, "ninja"); } else { cb.sendNotice('Only moderators and broadcasters are able to use that command.', u, colors.HiPurple); } break; case '/unsilence': case "/unsil": cmd = true; if (isMod || isBc || isEMod || (isDev && devMode == true)) { unsilence(message[1], u, "regular"); } else { cb.sendNotice('Only moderators and broadcasters are able to use that command.', u, colors.HiPurple); } break; case "/unninja": cmd = true; if (isMod || isBc || isEMod || (isDev && devMode == true)) { unsilence(message[1], u, "ninja"); } else { cb.sendNotice('Only moderators and broadcasters are able to use that command.', u, colors.HiPurple); } break; case '/starttimer': cmd = true; if (isMod || isBc || isEMod || (isDev && devMode == true)) { startTimer(message[1], u); } else { cb.sendNotice('Only moderators and broadcasters are able to use that command.', u, colors.HiPurple); } break; case '/addtime': cmd = true; if (isMod || isBc || isEMod || (isDev && devMode == true)) { addTime(message[1], u); } else { cb.sendNotice('Only moderators and broadcasters are able to use that command.', u, colors.HiPurple); } break; case '/timeleft': cmd = true; timeLeft2(u); break; case '/whisper': case '/w': case '/tell': case '/t': case '/pm': cmd = true; // disabled whisper function cb.sendNotice('Chat is made for open chatting, if you want to say something private please use Tipnotes.',u, colors.HiPurple); break; case '/emod': cmd = true; if (isMod || isBc || (isDev && devMode == true)) { eMod(message[1], message[2], u); } else { cb.sendNotice('Only moderators and broadcasters are able to use that command.', u, colors.HiPurple); } break; case "/addnice": cmd = true; if (isMod || isBc || (isDev && devMode == true)) { if (cmdval != null) { cmdval_s = cmdval.split(listRegExp); if (cmdval_s.length > 1) { cb.sendNotice("Adding multiple users to the nice list.", u, colors.HiPurple); for (i = 0; i < cmdval_s.length; i++) { if (cmdval_s[i] != "") { if (!cbjs.arrayContains(niceArray, cmdval_s[i])) { niceArrayPopulate(cmdval_s[i]); cb.sendNotice("Added " + cmdval_s[i] + " to the list.", u); cb.sendNotice(u + " has added you to the nice list.", cmdval_s[i], "#efe"); } else { cb.sendNotice(cmdval_s[i] + " is already on the list. Skipping.", u); } } } cb.sendNotice("All users were added and notified.", u, colors.HiPurple); cb.sendNotice(u + " has added multiple users to the nice list.\n" + "Users added: " + cbjs.arrayJoin(cmdval_s, ", "), "", colors.HiPurple, "", "normal", "red"); } else { nice(message[1], u, "a"); } } else { cb.sendNotice("You didn't specify who you want to add to the nice list.\nType \"/jbhelp addnice\" to see how to use /addnice.\n" + "Additionally, check the nicelist help section for more info.", u, colors.LightSalmon); } } else { cb.sendNotice('Only moderators and broadcasters are able to use that command.', u, colors.HiPurple); } break; case "/addvip": cmd = true; if (isMod || isBc || (isDev && devMode == true)) { if (cmdval != null) { cmdval_s = cmdval.split(listRegExp); if (cmdval_s.length > 1) { cb.sendNotice("Adding multiple users to the VIP list.", u, colors.HiPurple); for (i = 0; i < cmdval_s.length; i++) { if (cmdval_s[i] != "") { if (!cbjs.arrayContains(vipArray, cmdval_s[i])) { vipArrayPopulate(cmdval_s[i]); cb.sendNotice("Added " + cmdval_s[i] + " to the list.", u); cb.sendNotice(u + " has added you to the VIP list.", cmdval_s[i], "#efe"); } else { cb.sendNotice(cmdval_s[i] + " is already on the list. Skipping.", u); } } } cb.sendNotice("All users were added and notified.", u, colors.HiPurple); cb.sendNotice(u + " has added multiple users to the VIP list.\n" + "Users added: " + cbjs.arrayJoin(cmdval_s, ", "), "", colors.HiPurple, "", "normal", "red"); } else { vip(message[1], u, "a"); } } else { cb.sendNotice("You didn't specify who you want to add to the VIP list.\nType \"/jbhelp addvip\" to see how to use /addvip.\n" + "Additionally, check the viplist help section for more info.", u, colors.LightSalmon); } } else { cb.sendNotice('Only moderators and broadcasters are able to use that command.', u, colors.HiPurple); } break; case "/addkingpotato": cmd = true; if (isMod || isBc || (isDev && devMode == true)) { if (cmdval != null) { cmdval_s = cmdval.split(listRegExp); if (cmdval_s.length > 1) { cb.sendNotice("Adding multiple users to the King Potato list.", u, colors.HiPurple); for (i = 0; i < cmdval_s.length; i++) { if (cmdval_s[i] != "") { if (!cbjs.arrayContains(KingPotatoArray, cmdval_s[i])) { kingPotatoArrayPopulate(cmdval_s[i]); cb.sendNotice("Added " + cmdval_s[i] + " to the list.", u); cb.sendNotice(u + " has added you to the King Potato list.", cmdval_s[i], "#efe"); } else { cb.sendNotice(cmdval_s[i] + " is already on the list. Skipping.", u); } } } cb.sendNotice("All users were added and notified.", u, colors.HiPurple); cb.sendNotice(u + " has added multiple users to the King Potato list.\n" + "Users added: " + cbjs.arrayJoin(cmdval_s, ", "), "", colors.HiPurple, "", "normal", "red"); } else { kingPotato(message[1], u); } } else { cb.sendNotice("You didn't specify who you want to add to the King Potato list.", u, colors.LightSalmon); } } else { cb.sendNotice('Only moderators and broadcasters are able to use that command.', u, colors.HiPurple); } break; case "/addsecretpotato": cmd = true; if (isMod || isBc || (isDev && devMode == true)) { if (cmdval != null) { cmdval_s = cmdval.split(listRegExp); if (cmdval_s.length > 1) { cb.sendNotice("Adding multiple users to the Secret Potato list.", u, colors.HiPurple); for (i = 0; i < cmdval_s.length; i++) { if (cmdval_s[i] != "") { if (!cbjs.arrayContains(SecretPotatoArray, cmdval_s[i])) { secretPotatoArrayPopulate(cmdval_s[i]); cb.sendNotice("Added " + cmdval_s[i] + " to the list.", u); cb.sendNotice(u + " has added you to the Secret Potato list.", cmdval_s[i], "#efe"); } else { cb.sendNotice(cmdval_s[i] + " is already on the list. Skipping.", u); } } } cb.sendNotice("All users were added and notified.", u, colors.HiPurple); cb.sendNotice(u + " has added multiple users to the Secret Potato list.\n" + "Users added: " + cbjs.arrayJoin(cmdval_s, ", "), "", colors.HiPurple, "", "normal", "red"); } else { secretPotato(message[1], u); } } else { cb.sendNotice("You didn't specify who you want to add to the Secret Potato list.", u, colors.LightSalmon); } } else { cb.sendNotice('Only moderators and broadcasters are able to use that command.', u, colors.HiPurple); } break; case '/removenice': cmd = true; if (isMod || isBc || (isDev && devMode == true)) { nice(message[1], u, 'r'); } else { cb.sendNotice('Only moderators and broadcasters are able to use that command.', u, colors.HiPurple); } break; case '/removevip': cmd = true; if (isMod || isBc || (isDev && devMode == true)) { vip(message[1], u, 'r'); } else { cb.sendNotice('Only moderators and broadcasters are able to use that command.', u, colors.HiPurple); } break; case "/nicelist": cmd = true; if (isMod || isBc || (isDev && devMode == true)) { cb.sendNotice("Users currently on the Nice List: " + niceArray.length, u, colors.HiPurple); cb.sendNotice((niceArray.length > 0 == true ? cbjs.arrayJoin(niceArray, ", ") : "No users."), u); cb.sendNotice("", u, colors.HiPurple); } else { cb.sendNotice('Only moderators and broadcasters are able to use that command.', u, colors.HiPurple); } break; case "/viplist": cmd = true; if (isMod || isBc || (isDev && devMode == true)) { cb.sendNotice("Users currently on the VIP List: " + vipArray.length, u, colors.HiPurple); cb.sendNotice((vipArray.length > 0 == true ? cbjs.arrayJoin(vipArray, ", ") : "No users."), u); cb.sendNotice("", u, colors.HiPurple); } else { cb.sendNotice('Only moderators and broadcasters are able to use that command.', u, colors.HiPurple); } break; case "/kingpotatolist": cmd = true; if (isMod || isBc || (isDev && devMode == true)) { cb.sendNotice("Users currently on the King Potato List: " + KingPotatoArray.length, u, colors.HiPurple); cb.sendNotice((KingPotatoArray.length > 0 == true ? cbjs.arrayJoin(KingPotatoArray, ", ") : "No users."), u); cb.sendNotice("", u, colors.HiPurple); } else { cb.sendNotice('Only moderators and broadcasters are able to use that command.', u, colors.HiPurple); } break; case "/secretpotatolist": cmd = true; if (isMod || isBc || (isDev && devMode == true)) { cb.sendNotice("Users currently on the secret Potato List: " + SecretPotatoArray.length, u, colors.HiPurple); cb.sendNotice((SecretPotatoArray.length > 0 == true ? cbjs.arrayJoin(SecretPotatoArray, ", ") : "No users."), u); cb.sendNotice("", u, colors.HiPurple); } else { cb.sendNotice('Only moderators and broadcasters are able to use that command.', u, colors.HiPurple); } break; // Export the VIP list to CrazyTicket case "/export": cmd = true; if (isMod || isBc || (isDev && devMode == true)) { if (vipArray.length > 0) { msg.m = "/add " + cbjs.arrayJoin(vipArray, ", "); } else{ cb.sendNotice("There's no one on the VIP list.", u, colors.LightSalmon); } } else { cb.sendNotice('Only moderators and broadcasters are able to use that command.', u, colors.HiPurple); } break; // Show the modlist for debugging purposes case "/modlist": cmd = true; if ((isDev && devMode == true)) { cb.sendNotice("Users currently on the Mod Array: " + modArray.length, u, colors.HiPurple); cb.sendNotice((modArray.length > 0 == true ? cbjs.arrayJoin(modArray, ", ") : "No users."), u); cb.sendNotice("", u, colors.HiPurple); } break; // Show the emodlist for debugging purposes case "/emodlist": cmd = true; if ((isDev && devMode == true)) { cb.sendNotice("Users currently on the Emerg. Mod Array: " + eModArray.length, u, colors.HiPurple); cb.sendNotice((eModArray.length > 0 == true ? cbjs.arrayJoin(eModArray, ", ") : "No users."), u); cb.sendNotice("", u, colors.HiPurple); } break; // Show silenced users case "/silenced": case "/sillist": cmd = true; if (isBc || isMod || (isDev && devMode == true)) { cb.sendNotice("Users currently silenced: " + silenceArray.length, u, colors.HiPurple); cb.sendNotice((silenceArray.length > 0 == true ? cbjs.arrayJoin(silenceArray, ", ") : "No users."), u); cb.sendNotice("", u, colors.HiPurple); } else { cb.sendNotice('Only moderators and broadcasters are able to use that command.', u, colors.HiPurple); } break; // Show ninja-silenced users case "/ninjasillist": case "/ninjalist": cmd = true; if (isBc || isMod || (isDev && devMode == true)) { cb.sendNotice("Users currently ninja-silenced: " + ninjaSilArray.length, u, colors.HiPurple); cb.sendNotice((ninjaSilArray.length > 0 == true ? cbjs.arrayJoin(ninjaSilArray, ", ") : "No users."), u); cb.sendNotice("", u, colors.HiPurple); } else { cb.sendNotice('Only moderators and broadcasters are able to use that command.', u, colors.HiPurple); } break; // Show tippers list case "/tippers": cmd = true; if (isBc || (isDev && devMode == true)) { cb.sendNotice("Users who tipped: " + tipperList.name.length, u, colors.HiPurple); if (tipperList.name.length == 0) { cb.sendNotice("No users.", u); } else { for (i = 0; i < tipperList.name.length; i++) { cb.sendNotice('"' + tipperList.name[i] + '"' + ": " + tipperList.amount[i], u); if (i == 179) break; } } cb.sendNotice("", u, colors.HiPurple); } else { cb.sendNotice('Only moderators and broadcasters are able to use that command.', u, colors.HiPurple); } break; case '/jbhelp': cmd = true; help(message[1], u); break; // Show the leaderboard case '/leaderboard': case "/lb": cmd = true; if (message[1] == "all") { if (isBc || isMod || (isDev && devMode == true)) { showLeaderBoard(""); } else { cb.sendNotice('Only moderators and broadcasters are able to use that command.', u, colors.HiPurple); } } else { showLeaderBoard(u); } break; case "/kingtipper": cmd = true; if (isMod || isBc || isEMod || (isDev && devMode == true)) { kingTipperToggle(message[1], u); } else { cb.sendNotice('Only moderators and broadcasters are able to use that command.', u, colors.HiPurple); } break; case '/kingspam': cmd = true; if (isMod || isBc || isEMod || (isDev && devMode == true)) { kingSpamToggle(message[1], u); } else { cb.sendNotice('Only moderators and broadcasters are able to use that command.', u, colors.HiPurple); } break; case '/notifierspam': cmd = true; if (isMod || isBc || isEMod || (isDev && devMode == true)) { notifierSpamToggle(message[1], u); } else { cb.sendNotice('Only moderators and broadcasters are able to use that command.', u, colors.HiPurple); } break; case '/leaderboardspam': cmd = true; if (isMod || isBc || isEMod || (isDev && devMode == true)) { leaderboardSpamToggle(message[1], u); } else { cb.sendNotice('Only moderators and broadcasters are able to use that command.', u, colors.HiPurple); } break; case '/notifiermessage': cmd = true; if (isMod || isBc || isEMod || (isDev && devMode == true)) { if (message[1] == "" || message[1] == null) { cb.sendNotice('You must enter a new message for the notifier feature. If you want to disable the notifications, enter /notifierspam off.', u, colors.HiPurple); } else { notifierMessage = msg.m.substring(16).trim(); cb.sendNotice('You have set the notifier spam message to: ' + notifierMessage, u, colors.HiPurple); } } else { cb.sendNotice('Only moderators and broadcasters are able to use that command.', u, colors.HiPurple); } break; case "/nickname": cmd = true; if (isBc || isMod) { if (allow_mod == "No" && isMod) { //Mods Not Allowed cb.sendNotice("Sorry the broadcaster has not allowed Mods to modify nicknames", u, colors.HiPurple); } else { //Process Command if ((BBmatch = /^([a-zA-Z0-9_]{3,})(\s+.+)?$/.exec(ntc)) != null) { cb.sendNotice(set_alias(BBmatch[1].toLowerCase(), parse_ucodes_and_emotes((BBmatch[2] || '').trim())).join(app_notice_newline),u, colors.AliceBlue); } else { cb.sendNotice("Missing arguments, the right command is /nickname user nick", u, colors.HiPurple); } } } else { cb.sendNotice("Only moderators and broadcasters are able to use that command.", u, colors.HiPurple); } break; case "/nicknames": cmd = true; if (isBc || isMod || (isDev && devMode == true)) { out = []; for (aliases_key in aliases) { if (aliases.hasOwnProperty(aliases_key)) { out.push(aliases_key + '@' + encode_ucodes(aliases[aliases_key])); } } cb.sendNotice('Nicknames List: ' + (out.length ? out.join(', ') : '(empty)'), u, colors.HiPurple); } else { cb.sendNotice("Sorry, this is a broadcaster-only command.", u, colors.HiPurple); } break; case "/nickmod": cmd = true; if (isBc || (isDev && devMode == true)) { //Toggle Mod Access if (allow_mod == "Yes") { //Dissable allow_mod = "No"; cb.sendNotice('Mod Access : REVOKED', u, colors.HiPurple); } else if (allow_mod == "No") { //Enable allow_mod = "Yes"; cb.sendNotice('Mod Access : ENABLED', u, colors.HiPurple); //appLog("Mod Access : ENABLED - by " + u); } } else { cb.sendNotice('Sorry, this is a broadcaster-only command.', u, colors.HiPurple); } break; case "/lasttip": cmd = true; if (isBc || isMod || isEMod || (isDev && devMode == true)) { cb.sendNotice(lastBigTip, cb.room_slug , colors.LightYellow); cb.sendNotice("the lasttip bigger than 25 including Tipnote was send to the Broadcaster.", u, colors.HiPurple); } else { cb.sendNotice("Sorry, only the Broadcaster and Mods can use this command.", u, colors.HiPurple); } break; } // Level Up! command support if (message[0] == '/luhelp' || message[0] == '/levels') { cmd = true; } // Ultra App command support if (message[0] == '/startshow' || message[0] == '/showtimeleft' || message[0] == '/printtime' || message[0] == '/addshowtime' || message[0] == '/adduser' || message[0] == '/changegoal' || message[0] == '/hide' || message[0] == '/unhide' || message[0] == '/selltickets' || message[0] == '/uacommands') { cmd = true; } // The user entered an invalid command if (cmd == false && cb.settings.invalidToggle == "Yes") { cb.sendNotice(message[0] + ' is not a command.\nType /jbhelp commands to see a full list of the available commands.', u, colors.HiPurple); } } // Add mods & caster to the mod array when they type if (isMod || isBc) { if (!cbjs.arrayContains(modArray, u)) modArrayPopulate(u); } // Let silence do its thing if (cbjs.arrayContains(silenceArray, u) && silenced == false) { msg['X-Spam'] = true; silenced = true; cb.sendNotice('Your message was not sent because you have been silenced. Be nice and don\'t make demands.', u, colors.HiPurple); } // Let ninja silence do its thing if (cbjs.arrayContains(ninjaSilArray, u) && silenced == false) { msg["X-Spam"] = true; silenced = true; } var fullMsg = null; for (i = 0; i < message.length; i++) { if (i == 0) fullMsg = message[i]; else fullMsg += " " + message[i]; } // Stop people from sending messages in all caps // De Haan's alternate implementation if (fullMsg == fullMsg.toUpperCase() && fullMsg != fullMsg.toLowerCase() && !isMod && !isBc && !isEMod && !(isDev && devMode == true)) { if (cb.settings.capsToggle == "Yes (for all users)" || (cb.settings.capsToggle == "Yes (only for grays)" && !hasTokens && !hasTipped)) { for (i = 0; i < message.length; i++) { if (symbolRegExp.test(message[i].charAt(0)) == false) { if (i == 0) fullMsg = message[i].toLowerCase(); else fullMsg += " " + message[i].toLowerCase(); cb.sendNotice("I'm sure you didn't actually mean to send that message in all capital letters, so I fixed it for you :smile", u, colors.HiPurple); } else { if (i == 0) fullMsg = message[i]; else fullMsg += " " + message[i]; } } msg.m = fullMsg; } } // Tip titles, if turned on, as well as king's crown if (cb.settings.tipTitles == "Yes" && tipperList.name.indexOf(u) > -1 && message[0].charAt(0) != "/") { if (kingTipper == true && u == currentKing) { msg.m = ":smallCrown |" + tipperList.amount[(tipperList.name.indexOf(u))] + "| " + msg.m; } else { msg.m = "|" + tipperList.amount[(tipperList.name.indexOf(u))] + "| " + msg.m; } } // Highest tipper of all time if (htAllTime != null) { if (u == htAllTime) { if (htatColor != null) msg.background = htatColor; } } originalmessage = msg.m; bbNick = ""; if (!msg['X-Spam']) { if (show_alias == "Yes") { if (aliases.hasOwnProperty(originaluser) && msg.m[0] != '!' && msg.m[0] != '/') { // note. mustn't tag messages beginning with possible command qualifiers, cos it'll break other scripts. bbNick += "[" + aliases[originaluser] + "]"; } } if (bbNick != "") { msg.m = bbNick + " " + originalmessage; } else { msg.m = originalmessage; } } if (!msg['X-Spam']){ if (PotatoTag == ":jdt-spud2" && KingPotatoTag == ":jdt-kingspud" && SecretPotatoTag == ":jdt-secretz"){ if (isFan == true && isKingPotato == true && isSecretPotato == true){ msg.m = ":jenna-secrkingfan " + msg.m; } else if (isFan == true && isKingPotato == true && isSecretPotato == false) { msg.m = ":jenna-kingfan " + msg.m; } else if (isFan == true && isKingPotato == false && isSecretPotato == true) { msg.m = ":jenna-secrfan " + msg.m; } else if (isFan == false && isKingPotato == true && isSecretPotato == true) { msg.m = ":jenna-secrking " + msg.m; } else if (isFan == true && isKingPotato == false && isSecretPotato == false) { msg.m = PotatoTag + " " + msg.m; } else if (isFan == false && isKingPotato == false && isSecretPotato == true) { msg.m = SecretPotatoTag + " " + msg.m; } else if (isFan == false && isKingPotato == true && isSecretPotato == false) { msg.m = KingPotatoTag + " " + msg.m; } } else { if (isFan == true){ msg.m = PotatoTag + " " + msg.m; } if (isKingPotato == true){ msg.m = KingPotatoTag + " " + msg.m; } if (isSecretPotato == true){ msg.m = SecretPotatoTag + " " + msg.m; } } } return msg; }); // cb.onTip() cb.onTip(function(tip) { // User vars var u = tip.from_user; var tipnote = tip.message; // Tip vars var tipAmount = Number.parseInt(tip.amount, 10); tipperArray[findTipper(u)][1] += tipAmount; if (!cbjs.arrayContains(tipperList.name, u)) { tipperListPopulate(u, tipAmount); } else { var index = tipperList.name.indexOf(u); tipperList.amount[index] += tipAmount; } if (kingTipper == true) { if (u != currentKing && Number.parseInt(tipperArray[findTipper(u)][1], 10) > kingTip && Number.parseInt(tipperArray[findTipper(u)][1], 10) >= Number.parseInt(cb.settings.kingMin, 10)) { if (currentKing != "") { cb.sendNotice("You have been dethroned by " + u + ", but revenge is sweet...", currentKing, colors.HiPurple); } cb.sendNotice(":smallCrown We have a new King! All hail " + u + "!", "", "#ddd", "#246", "bold"); currentKing = u; kingTip = Number.parseInt(tipperArray[findTipper(u)][1], 10); } else if (u == currentKing) { kingTip = Number.parseInt(tipperArray[findTipper(u)][1], 10); } } if (tip.amount == KingPotatoPrice){ if(!cbjs.arrayContains(KingPotatoArray, u)){ cb.sendNotice("We got a new King Potato " + KingPotatoTag + " : " + u, "", colors.Brown, colors.White, "bold"); kingPotatoArrayPopulate(u); } }else if (tip.amount == SecretPotatoPrice){ if(!cbjs.arrayContains(SecretPotatoArray, u)){ cb.sendNotice("We got a new Secret Potato " + SecretPotatoTag + " : " + u, "", colors.Brown, colors.White, "bold"); secretPotatoArrayPopulate(u); } }else if(tip.amount == KikPrice){ if (tipnote == null || tipnote == "" || tipnote == " " || tipnote =="\u00a0"){ cb.sendNotice("Thank you, Please send a 1 Token tipnote with your username." , u, colors.Pink); cb.sendNotice("YAY, we got a new Kik user!!!", "", colors.Orange); } }else if(tip.amount == SnapPrice){ if (tipnote == null || tipnote == "" || tipnote == " " || tipnote =="\u00a0"){ cb.sendNotice("Thank you, Please send a 1 Token tipnote with your username." , u, colors.Pink); cb.sendNotice("YAY, we got a new Snapchat user!!!", "", colors.Orange); } }else if(tip.amount == ButtplugPrice){ cb.sendNotice("YAY, this keebler elf :jennaderp47 likes Buttplugs!!!", "", colors.Orange); }else if(tip.amount == HyphymudPrice){ cb.sendNotice("get ready for some Hyphymud faces :jennaderp32", "", colors.Orange); }else if (tip.amount == PotatodancePrice){ cb.sendNotice("prepare yourself for the worlds first dancing potato :jenna-kb-h1", "", colors.Orange); }else if(tip.amount == MutePrice){ cb.sendNotice ("SHUT UP JENNA :jenna-silence", "", colors.Orange); startMute(MuteTime, u); }else if(tip.amount == SockhandPrice){ cb.sendNotice ("Thanks for the sockhands, my hands already started freezing!!!" , "", colors.Orange); } // Note from De Haan: That gigantic leaderboard code was gotten rid of. Check sortTippers(), it replaces the old logic if (cb.settings.notifierTip == "Yes" && Number.parseInt(tipAmount) >= cb.settings.tipMessageMin) { cb.sendNotice(cb.settings.tipMessage, "", "#ddd", "#246", "bold"); } if(tipAmount >= "25") { lastBigTip = "Last Tip from user \"" + u + "\" " + tipAmount + " Tokens: " + tipnote; } if(cb.settings.tipnotetomods == "Yes" && tipnote != null && tipnote != "" && tipnote != " " && tipnote !="\u00a0") { cb.sendNotice("Tipnote user \"" + u + "\" " + tipAmount + " Tokens: " + tipnote,"", colors.LightYellow, "", "", "red"); } }); // cb.onEnter() cb.onEnter(function(user) { // User vars var u = user.user; var isBc = u == cb.room_slug; var isMod = user.is_mod; if (cb.settings.notifierEnter == "Yes") { cb.sendNotice(cb.settings.enterMessage, u, colors.HiPurple); } if (isMod || isBc) { if (!cbjs.arrayContains(modArray, u)) modArrayPopulate(u); } }); // Init function main() { if (initialize == false) { cb.sendNotice(dashLine + "\n\u25ba " + '"' + appName + '"' + " has started.", cb.room_slug, "", "#456", "bold"); cb.sendNotice("\u25ba Version: " + appVersion, cb.room_slug, "", "#456", "bold"); cb.sendNotice("\u25ba Build date: " + appBuildDate, cb.room_slug, "", "#456", "bold"); cb.sendNotice("\u25ba Type " + '"/jbhelp commands"' + " for a list of available commands.\n" + dashLine, cb.room_slug, "", "#456", "bold"); cb.sendNotice("\u25ba Grabbing settings...", cb.room_slug, "", "#456", "bold"); if (cb.settings.kingTipper == "Yes") { kingTipper = true; } if (cb.settings.kingTipperSpam == "Yes") { kingTipperSpam = true; kingSpam(); } if (cb.settings.leaderBoardSpam == "Yes") { leaderboardSpam = true; leaderSpam(); } if (cb.settings.notifierSpam == "Yes") { notifierSpamTGL = true; notifierSpam(); } if (cb.settings.niceList != "" && cb.settings.niceList != null) { cb.sendNotice("\u25ba Adding users to the Nice List...", cb.room_slug, "", "#456", "bold"); n = cb.settings.niceList; niceArray = n.split(/[,\s]+/); numNice = niceArray.length; } if (cb.settings.vipList != "" && cb.settings.vipList != null) { cb.sendNotice("\u25ba Adding users to the VIP List...", cb.room_slug, "", "#456", "bold"); v = cb.settings.vipList; vipArray = v.split(/[,\s]+/); numVip = vipArray.length; } if (cb.settings.KingPotato_settings != "" && cb.settings.KingPotato_settings != null) { cb.sendNotice("\u25ba Adding users to the King Potato List...", cb.room_slug, "", "#456", "bold"); kp = cb.settings.KingPotato_settings; KingPotatoArray = kp.split(/[,\s]+/); numKingpotato = KingPotatoArray.length; } if (cb.settings.SecretPotato_settings != "" && cb.settings.SecretPotato_settings != null) { cb.sendNotice("\u25ba Adding users to the Secret Potato List...", cb.room_slug, "", "#456", "bold"); sp = cb.settings.SecretPotato_settings; SecretPotatoArray = sp.split(/[,\s]+/); numSecretpotato = SecretPotatoArray.length; } // Color checks cb.sendNotice("\u25ba Checking if the selected color codes are valid...", cb.room_slug, "", "#456", "bold"); if (cb.settings.generalBgColor != null && cb.settings.generalBgColor != "") { if (colorChecker(cb.settings.generalBgColor) == true) { cb.sendNotice("\u25ba General background highlight: Valid.", cb.room_slug, "", "#091", "bold"); if (cb.settings.generalBgColor.charAt(0) == "#") colors.HiPurple = cb.settings.generalBgColor; else colors.HiPurple = "#" + cb.settings.generalBgColor; } else { cb.sendNotice("\u25ba General background highlight: Invalid. Reverting to default.", cb.room_slug, "", "#b45", "bold"); colors.HiPurple = "#01a9db"; invalidCodeDetected = true; } } else { cb.sendNotice("\u25ba General background highlight: Not set.", cb.room_slug, "", "#db0", "bold"); } if (cb.settings.messagecolor != null && cb.settings.messagecolor != "") { if (colorChecker(cb.settings.messagecolor) == true) { cb.sendNotice("\u25ba Rotating notifier - message color: Valid.", cb.room_slug, "", "#091", "bold"); if (cb.settings.messagecolor.charAt(0) == "#") msgColor = cb.settings.messagecolor; else msgColor = "#" + cb.settings.messagecolor; } else { cb.sendNotice("\u25ba Rotating notifier - message color: Invalid. Reverting to default.", cb.room_slug, "", "#b45", "bold"); msgColor = "#9f000f"; invalidCodeDetected = true; } } else { cb.sendNotice("\u25ba Rotating notifier - message color: Not set.", cb.room_slug, "", "#db0", "bold"); } if (cb.settings.messagehilite != null && cb.settings.messagehilite != "") { if (colorChecker(cb.settings.messagehilite) == true) { cb.sendNotice("\u25ba Rotating notifier - message background: Valid.", cb.room_slug, "", "#091", "bold"); if (cb.settings.messagehilite.charAt(0) == "#") msgHilite = cb.settings.messagehilite; else msgHilite = "#" + cb.settings.messagehilite; } else { cb.sendNotice("\u25ba Rotating notifier - message background: Invalid. Reverting to default.", cb.room_slug, "", "#b45", "bold"); msgHilite = "#fcc"; invalidCodeDetected = true; } } else { cb.sendNotice("\u25ba Rotating notifier - message background: Not set.", cb.room_slug, "", "#db0", "bold"); } if (cb.settings.htat_color != null && cb.settings.htat_color != "") { if (colorChecker(cb.settings.htat_color) == true) { cb.sendNotice("\u25ba Highest tipper of all time - message background: Valid.", cb.room_slug, "", "#091", "bold"); if (cb.settings.htat_color.charAt(0) == "#") htatColor = cb.settings.htat_color; else htatColor = "#" + cb.settings.htat_color; } else { cb.sendNotice("\u25ba Highest tipper of all time - message background: Invalid. Feature disabled.", cb.room_slug, "", "#b45", "bold"); invalidCodeDetected = true; } } else { cb.sendNotice("\u25ba Highest tipper of all time - message background: Not set.", cb.room_slug, "", "#db0", "bold"); } if (invalidCodeDetected == true) { cb.sendNotice("\u25ba One or more invalid color codes have been used. Valid color codes must have between 3 or 6 characters (excluding the hash; 4 or 7 chars if including it) " + "and contain only hexadecimal numbers from 0 to F.\n" + "\u25ba Use http://www.color-hex.com/ to find the code for the color you want. Don't include the starting hash (#).", cb.room_slug, "", "#b45", "bold"); } cb.sendNotice(dashLine, cb.room_slug, "", "#456", "bold"); if (cb.settings.allowGrayChatAfterStartup == "No") { setGraphicLevel(1, cb.room_slug); setSilenceLevel(1, cb.room_slug); cb.sendNotice("Gray users are now unable to chat and use graphics by default. If you would like gray users to be able to do both things, type /silencelevel 0, " + "followed by /graphiclevel 0. If you want them to be able only to chat, type /silencelevel 0.", cb.room_slug, colors.HiPurple); } else if (cb.settings.allowGrayGraphicsAfterStartup == "No") { setGraphicLevel(1, cb.room_slug); setSilenceLevel(0, cb.room_slug); cb.sendNotice("Gray users are now unable to use graphics by default. If you would like gray users to be able to use graphics, type /graphiclevel 0.", cb.room_slug, colors.HiPurple); } else { setGraphicLevel(0, cb.room_slug); setSilenceLevel(0, cb.room_slug); } allow_mod = cb.settings.allow_mod; show_alias = cb.settings.show_alias; BBnicknames = cb.settings.nicknames; parseNick(); initialize = true; } } main();
© Copyright Chaturbate 2011- 2024. All Rights Reserved.