Bots Home
|
Create an App
valeriaBot
Author:
valeria_arango
Description
Source Code
Launch Bot
Current Users
Created by:
Valeria_Arango
/** * ValeriaBot (Singleton Pattern) * @author Sypunk * @version 1.2.3 Build4 * @date-created 2016.03.30 * @date-modified 2016.07.14 * @description A customized, modular bot for Valeria_arango’s room that performs a variety of functions unique to her wishes and desires. * Todo: */ var ValeriaBot = (function () { // private methods and properties // ... return { message: { module: { debug: { setEnabled: function (bEnabled) { if(bEnabled === true){ cb.sendNotice("ValeriaBot Debugging Mode Enabled.", "", "", "#990037", "", ""); } ValeriaBot.message.module.debug._bDebugEnabled = bEnabled; }, getEnabled: function () { return ValeriaBot.message.module.debug._bDebugEnabled; }, onMessage: function (aryArg, oMsg, bIsRoomCreator) { if (aryArg !== undefined) { if (aryArg[2] !== undefined) { if (aryArg[2] === "on") { ValeriaBot.message.module.debug.setEnabled(true); } if (aryArg[2] === "off") { ValeriaBot.message.module.debug.setEnabled(false); } } } return oMsg; }, onEnter: function (oUser, bIsRoomCreator) { // tbd }, onLeave: function (oUser, bIsRoomCreator) { // tbd }, onTip: function (oTip, bIsRoomCreator) { // tbd }, init: function () { ValeriaBot.message.module.debug.setEnabled(false); } }, recorder: { setEnabled: function (bEnabled) { if(bEnabled === true){ cb.sendNotice("ValeriaBot Recorder On.", "", "", "#990037", "", ""); } else { cb.sendNotice("ValeriaBot Recorder Off.", "", "", "#990037", "", ""); } ValeriaBot.message.module.recorder._bEnabled = bEnabled; }, getEnabled: function () { return ValeriaBot.message.module.recorder._bEnabled; }, onMessage: function (aryArg, oMsg, bIsRoomCreator) { var s = ""; if (aryArg !== undefined) { if (aryArg[2] !== undefined) { if (aryArg[2] === "on") { ValeriaBot.message.module.recorder.setEnabled(true); } if (aryArg[2] === "off") { ValeriaBot.message.module.recorder.setEnabled(false); } if (aryArg[2] === "export") { s = ValeriaBot.message.module.recorder.getRecording(); cb.sendNotice(s, oMsg.user, "", "#990037", "", ""); } } } if (ValeriaBot.message.module.recorder.getEnabled() === true) { ValeriaBot.message.module.recorder.appendToRecording(oMsg.user+": "+oMsg.m); } return oMsg; }, getRecording: function () { var s = ""; var ary = ValeriaBot.message.module.recorder._aryRecording; for (var i=0; i<ary.length; i++) { s = s + ary[i]+"\n"; } s = ValeriaBot.global.helper.string.lzw_encode(s); var s = "---begin---\n"+s+"---end---"; return s; }, appendToRecording: function (s) { if (ValeriaBot.message.module.recorder._aryRecording === undefined) { ValeriaBot.message.module.recorder._aryRecording = []; } ValeriaBot.message.module.recorder._aryRecording.push(s); }, onEnter: function (oUser, bIsRoomCreator) { // tbd }, onLeave: function (oUser, bIsRoomCreator) { // tbd }, onTip: function (oTip, bIsRoomCreator) { // tbd }, init: function () { ValeriaBot.message.module.recorder._aryRecording = []; ValeriaBot.message.module.recorder.setEnabled(false); } }, tac: { showHelp: function (oMsg, bIsRoomCreator) { var s = "________________________________________\nValeriaBot Terms & Conditions Module:\n/ValeriaBot tac <on/off>\n/ValeriaBot tac setwelcome <welcome message>\n________________________________________"; if (bIsRoomCreator === true) { cb.sendNotice(s, oMsg.user, "", "#990037", "", ""); // Send to Room Creator } else { if (bIsMod === true) { cb.sendNotice(s, "", "", "#990037", "", "red"); // Send to Mods } } }, setEnabled: function (bEnabled) { if(bEnabled === true){ cb.sendNotice("ValeriaBot Terms and Conditions Module On.", "", "", "#990037", "", ""); } else { cb.sendNotice("ValeriaBot Terms and Conditions Module Off.", "", "", "#990037", "", ""); } ValeriaBot.message.module.tac._bEnabled = bEnabled; }, getEnabled: function () { return ValeriaBot.message.module.tac._bEnabled; }, setWelcome: function (s) { var sMessage = s; ValeriaBot.message.module.tac._sMessage = s; cb.sendNotice("The Terms and Conditions notice has been set to the following: ", "", "", "#990037", "", ""); var aryMessage; if (ValeriaBot.message.module.tac.getEnabled() === true) { aryMessage = sMessage.split("|"); for (var i = 0; i < aryMessage.length; i++) { cb.sendNotice(aryMessage[i], "", "#ffddef", "#990037", "bold", ""); cb.sendNotice("", "", "", "#990037", "bold", ""); } } }, getWelcome: function () { return ValeriaBot.message.module.tac._sMessage; }, onMessage: function (aryArg, oMsg, bIsRoomCreator) { if (aryArg !== undefined) { if (aryArg[2] !== undefined) { if (aryArg[2] === "on") { ValeriaBot.message.module.tac.setEnabled(true); } if (aryArg[2] === "off") { ValeriaBot.message.module.tac.setEnabled(false); } if (aryArg[2] === "setwelcome") { if (aryArg[3] !== undefined) { ValeriaBot.message.module.tac.setWelcome(aryArg[3]); } } } else { ValeriaBot.message.module.tac.showHelp(oMsg, bIsRoomCreator); } } return oMsg; }, onEnter: function (oUser, bIsRoomCreator) { var fnc = function () { var sMessage = ValeriaBot.message.module.tac.getWelcome(); var aryMessage; var s = ""; if (ValeriaBot.message.module.tac.getEnabled() === true) { sMessage = sMessage.replace("<user>", oUser.user); aryMessage = sMessage.split("|"); for (var i = 0; i < aryMessage.length; i++) { s = s + aryMessage[i]+"\n"; } cb.sendNotice(s, oUser.user, "#ffddef", "#990037", "bold", ""); } }; cb.setTimeout(fnc, 3000); }, onLeave: function (oUser, bIsRoomCreator) { // tbd }, onTip: function (oTip, bIsRoomCreator) { // tbd }, init: function () { var sDefaultMessage = "You are responsible for what you write in the main chat, private message, and tip note.|You acknowledge that anything you send, you are held accountable for and give full permission to the cam host of this room to do what she wishes with the messages you send her.|By messaging in this public chat, in PM, and within a tip note, you agree with the above statement and agree to the publication of your messages within CB and other forums placed by the cam host and her viewers.|The privacy of your messages (via PM and tip note) will remain private unless the cam host sees fit to share them with the room or other forums. However, your personal information will never be revealed by the cam host (i.e., real name, location, etc).|Message responsibly :)"; var sMessage = ""; if (cb.settings_choices === undefined) { cb.settings_choices = []; } cb.settings_choices.push( { name:"tac_enabled", type:"choice", choice1:"Yes", choice2:"No", defaultValue:"Yes", required: true, label: "[TAC MODULE] Terms And Conditions ............................ Enable?" }, { name:"tac_message", type:"str", defaultValue:sDefaultMessage, required: false, label: "Welcome Message ('|' inserts linefeeds)" }); if (cb.settings.tac_message !== undefined) { if (cb.settings.tac_message !== "") { sMessage = cb.settings.tac_message; } } if (sMessage === "") { sMessage = sDefaultMessage; } ValeriaBot.message.module.tac._sMessage = ""; if (cb.settings.tac_enabled === "Yes") { ValeriaBot.message.module.tac.setEnabled(true); } else { ValeriaBot.message.module.tac.setEnabled(false); } ValeriaBot.message.module.tac.setWelcome(sMessage); } }, notices: { showHelp: function (oMsg, bIsRoomCreator) { var s = "________________________________________\nValeriaBot Notices Module:\n/ValeriaBot notices <on/off>\n/ValeriaBot notices setwelcome <welcome message>\n/ValeriaBot notices add <message> <interval in minutes> <color> <bgcolor> (quotes are requred around message)\n/ValeriaBot notices change <message index> <message> (quotes are requred around message)\n/ValeriaBot notices disable <message index>\n/ValeriaBot notices enable <message index>\n/ValeriaBot notices reset (clears away all)\n________________________________________"; if (bIsRoomCreator === true) { cb.sendNotice(s, oMsg.user, "", "#990037", "", ""); // Send to Room Creator } else { if (bIsMod === true) { cb.sendNotice(s, "", "", "#990037", "", "red"); // Send to Mods } } }, setEnabled: function (bEnabled) { if(bEnabled === true){ cb.sendNotice("ValeriaBot Notices Module On.", "", "", "#990037", "", ""); } else { cb.sendNotice("ValeriaBot Notices Module Off.", "", "", "#990037", "", ""); } ValeriaBot.message.module.notices._bEnabled = bEnabled; }, getEnabled: function () { return ValeriaBot.message.module.notices._bEnabled; }, setWelcome: function (s) { var sMessage = s; ValeriaBot.message.module.notices._sWelcomeMessage = s; cb.sendNotice("The welcome notice has been set to the following: ", "", "", "#990037", "", ""); var aryMessage; if (ValeriaBot.message.module.notices.getEnabled() === true) { aryMessage = sMessage.split("|"); for (var i = 0; i < aryMessage.length; i++) { cb.sendNotice(aryMessage[i], "", "#99ff99", "#379937", "bold", ""); cb.sendNotice("", "", "", "#379937", "bold", ""); } } }, getWelcome: function () { return ValeriaBot.message.module.notices._sWelcomeMessage; }, addMessage: function (sMessage, iInterval, sColor, sBgColor) { var fnc = function () { var iIndex = fnc._iIndex; if (ValeriaBot.message.module.notices.getEnabled() === true) { if (ValeriaBot.message.module.notices._aryMessages[iIndex] !== undefined) { cb.sendNotice(ValeriaBot.message.module.notices._aryMessages[iIndex].message, "", sBgColor, sColor, "bold", ""); if (ValeriaBot.message.module.notices._aryMessages[iIndex].enabled === true) { cb.setTimeout(fnc, ValeriaBot.message.module.notices._aryMessages[iIndex].interval * 1000 * 60, iIndex); } } } }; if (ValeriaBot.message.module.notices.getEnabled() === true) { if (sMessage !== undefined) { if (iInterval === undefined) { iInterval = 10; // default of 10 mintues } if (sColor === undefined) { sColor = "#990037"; } if (sBgColor === undefined) { sBgColor = "#ffffff"; } fnc._iIndex = ValeriaBot.message.module.notices._aryMessages.length; cb.setTimeout(fnc, 8000); ValeriaBot.message.module.notices._aryMessages.push({"enabled":true, "message":sMessage, "interval":iInterval, "color":sColor, "bgcolor":sColor}); cb.sendNotice("ValeriaBot Notifier sucessfully added a new cycling message.", "", "", "#990037", "", ""); } } }, reset: function () { ValeriaBot.message.module.notices._aryMessages = []; cb.sendNotice("ValeriaBot reset, cleared out, all Notices messages.", "", "", "#990037", "", ""); }, disableMessageByIndex: function (i) { ValeriaBot.message.module.notices._aryMessages[i].enabled = false; cb.sendNotice("ValeriaBot disabled the specified Notices message (it may display one more time due to a limitation of CB's architecture).", "", "", "#990037", "", ""); }, enableMessageByIndex: function (i) { ValeriaBot.message.module.notices._aryMessages[i].enabled = true; //cb.sendNotice("ValeriaBot enabled the specified Notices message.", "", "", "#990037", "", ""); cb.sendNotice("ValeriaBot - This feature is not available yet.", "", "", "#990037", "", ""); // todo: need to add the settimeout fnc that retriggers it for this feature to work // probably the easiest way is to make the "fnc" that triggers the notice a property of the addMessage function so that it can be trigged globally. kludgy, but the better than adding an addtional paramter to addMessage }, changeMessageByIndex: function (i, sMessage) { if (i !== undefined) { if (sMessage !== undefined) { if (ValeriaBot.message.module.notices._aryMessages[i] !== undefined) { ValeriaBot.message.module.notices._aryMessages[i].message = sMessage; cb.sendNotice("ValeriaBot changed the specified Notices message.", "", "", "#990037", "", ""); } } } }, onMessage: function (aryArg, oMsg, bIsRoomCreator) { if (aryArg !== undefined) { if (aryArg[2] !== undefined) { if (aryArg[2] === "on") { ValeriaBot.message.module.notices.setEnabled(true); } if (aryArg[2] === "off") { ValeriaBot.message.module.notices.setEnabled(false); } if (aryArg[2] === "setwelcome") { if (aryArg[3] !== undefined) { ValeriaBot.message.module.notices.setWelcome(aryArg[3]); } } if (aryArg[2] === "add") { if (aryArg[3] !== undefined) { if (aryArg.length <= 7) { ValeriaBot.message.module.notices.addMessage(aryArg[3].split("`").join(" "), aryArg[4], aryArg[5]); } else { cb.sendNotice("ValeriaBot command failed, because you likely forgot to put quotes around your message parameter.", "", "", "#990037", "", ""); } } } if (aryArg[2] === "change") { if (aryArg[3] !== undefined) { if (aryArg.length <= 7) { ValeriaBot.message.module.notices.changeMessageByIndex(parseInt(aryArg[3]), aryArg[4].split("`").join(" ")); } else { cb.sendNotice("ValeriaBot command failed, because you likely forgot to put quotes around your message parameter.", "", "", "#990037", "", ""); } } } if (aryArg[2] === "disable") { if (aryArg[3] !== undefined) { ValeriaBot.message.module.notices.disableMessageByIndex(parseInt(aryArg[3])); } } if (aryArg[2] === "enable") { if (aryArg[3] !== undefined) { ValeriaBot.message.module.notices.enableMessageByIndex(parseInt(aryArg[3])); } } if (aryArg[2] === "reset") { ValeriaBot.message.module.notices.reset(); } } else { ValeriaBot.message.module.notices.showHelp(oMsg, bIsRoomCreator); } } return oMsg; }, onEnter: function (oUser, bIsRoomCreator) { var fnc = function () { var sMessage = ValeriaBot.message.module.notices.getWelcome(); var aryMessage; var s = ""; if (ValeriaBot.message.module.notices.getEnabled() === true) { sMessage = sMessage.replace("<user>", oUser.user); aryMessage = sMessage.split("|"); for (var i = 0; i < aryMessage.length; i++) { s = s + aryMessage[i]+"\n"; } cb.sendNotice(s, oUser.user, "#99ff99", "#379937", "bold", ""); } }; cb.setTimeout(fnc, 1000); }, onLeave: function (oUser, bIsRoomCreator) { // tbd }, onTip: function (oTip, bIsRoomCreator) { // tbd }, init: function () { var sDefaultWelcomeMessage = "Welcome to Valeria_arango’s room, <user>!|Kindly note that any 'demands' will result in immediate silencing of your messages, by either the bot or a mod, for the duration of today's session.|Please keep any dirty talk to tip-notes. Please be as respectful to Valeria in chat, as you surely would in person.|Like any kitten, Valeria is most likely to respond with affection when you're kind and sweet to her."; var sWelcomeMessage = ""; if (cb.settings_choices === undefined) { cb.settings_choices = []; } cb.settings_choices.push( { name:"notices_enabled", type:"choice", choice1:"Yes", choice2:"No", defaultValue:"Yes", required: true, label: "[NOTICES MODULE] .......................................................... Enable?" }, { name:"notices_welcome_message", type:"str", defaultValue:sDefaultWelcomeMessage, required: false, label: "Welcome Message ('|' inserts linefeeds)" }); cb.settings_choices.push({ name:"notices_message_1_text", type:"str", defaultValue:"", required: false, label: "Repeating Message 1 Text." }); cb.settings_choices.push({ name:"notices_message_1_interval", type:"str", defaultValue:"10", required: false, label: "Repeating Message 1 Interval (in minutes)." }); cb.settings_choices.push({ name:"notices_message_1_color", type:"str", defaultValue:"#990037", required: false, label: "Repeating Message 1 color." }); cb.settings_choices.push({ name:"notices_message_1_bgcolor", type:"str", defaultValue:"#ffffff", required: false, label: "Repeating Message 1 bgcolor." }); cb.settings_choices.push({ name:"notices_message_2_text", type:"str", defaultValue:"", required: false, label: "Repeating Message 2 Text." }); cb.settings_choices.push({ name:"notices_message_2_interval", type:"str", defaultValue:"10", required: false, label: "Repeating Message 2 Interval (in minutes)." }); cb.settings_choices.push({ name:"notices_message_2_color", type:"str", defaultValue:"#990037", required: false, label: "Repeating Message 2 color." }); cb.settings_choices.push({ name:"notices_message_2_bgcolor", type:"str", defaultValue:"#ffffff", required: false, label: "Repeating Message 2 bgcolor." }); cb.settings_choices.push({ name:"notices_message_3_text", type:"str", defaultValue:"", required: false, label: "Repeating Message 3 Text." }); cb.settings_choices.push({ name:"notices_message_3_interval", type:"str", defaultValue:"10", required: false, label: "Repeating Message 3 Interval (in minutes)." }); cb.settings_choices.push({ name:"notices_message_3_color", type:"str", defaultValue:"#990037", required: false, label: "Repeating Message 3 color." }); cb.settings_choices.push({ name:"notices_message_3_bgcolor", type:"str", defaultValue:"#ffffff", required: false, label: "Repeating Message 3 bgcolor." }); if (cb.settings.notices_welcome_message !== undefined) { if (cb.settings.notices_welcome_message !== "") { sWelcomeMessage = cb.settings.notices_welcome_message; } } if (sWelcomeMessage === "") { sWelcomeMessage = sDefaultWelcomeMessage; } ValeriaBot.message.module.notices._sWelcomeMessage = ""; ValeriaBot.message.module.notices._aryMessages = []; if (cb.settings.notices_enabled === "Yes") { ValeriaBot.message.module.notices.setEnabled(true); } else { ValeriaBot.message.module.notices.setEnabled(false); } ValeriaBot.message.module.notices.setWelcome(sWelcomeMessage); if (cb.settings.notices_message_1_text !== undefined) { if (cb.settings.notices_message_1_text !== "") { ValeriaBot.message.module.notices.addMessage(cb.settings.notices_message_1_text, cb.settings.notices_message_1_interval, cb.settings.notices_message_1_color, cb.settings.notices_message_1_bgcolor); } } if (cb.settings.notices_message_2_text !== undefined) { if (cb.settings.notices_message_2_text !== "") { ValeriaBot.message.module.notices.addMessage(cb.settings.notices_message_2_text, cb.settings.notices_message_2_interval, cb.settings.notices_message_2_color, cb.settings.notices_message_2_bgcolor); } } if (cb.settings.notices_message_3_text !== undefined) { if (cb.settings.notices_message_3_text !== "") { ValeriaBot.message.module.notices.addMessage(cb.settings.notices_message_3_text, cb.settings.notices_message_3_interval, cb.settings.notices_message_3_color, cb.settings.notices_message_3_bgcolor); } } /* var fncSpecialWelcomeBack = function () { cb.sendNotice("-+- VALERIABOT MISSED VALERIA SOOO MUUUCH !! :~: -+-", "", "#ff8899", "#990037", "bold", ""); cb.setTimeout(fncSpecialWelcomeBack, 7200000); }; cb.setTimeout(fncSpecialWelcomeBack, 60000); */ } }, replace: { showHelp: function (oMsg, bIsRoomCreator) { var s = "________________________________________\nValeriaBot Word Replace Module:\n/ValeriaBot replace <on/off>\n/ValeriaBot replace add <word> <replacement word>\n/ValeriaBot replace remove <word>\n/ValeriaBot replace show\n/ValeriaBot replace reset\n________________________________________"; if (bIsRoomCreator === true) { cb.sendNotice(s, oMsg.user, "", "#990037", "", ""); // Send to Room Creator } else { if (bIsMod === true) { cb.sendNotice(s, "", "", "#990037", "", "red"); // Send to Mods } } }, setEnabled: function (bEnabled) { if(bEnabled === true){ cb.sendNotice("ValeriaBot Replace Module On.", "", "", "#990037", "", ""); } else { cb.sendNotice("ValeriaBot Replace Module Off.", "", "", "#990037", "", ""); } ValeriaBot.message.module.replace._bEnabled = bEnabled; }, getEnabled: function () { return ValeriaBot.message.module.replace._bEnabled; }, addWordPair: function (aryArg) { /** * Replace Module AddWordPair * @method addWordPair */ var o = ValeriaBot.message.module.replace.getWordPairs(); o[aryArg[3]] = aryArg[4]; cb.sendNotice("ValeriaBot Replace Module - '" + aryArg[3] + "' Becomes '" + aryArg[4] + "' Added!", "", "", "#990037", "", ""); }, removeWordPair: function (aryArg) { /** * Replace Module RemoveWordPair * @method RemoveWordPair */ var o = ValeriaBot.message.module.replace.getWordPairs(); if (o[aryArg[3]] !== undefined) { cb.sendNotice("ValeriaBot Replace Module - '" + aryArg[3] + "' Removed!", "", "", "#990037", "", ""); delete o[aryArg[3]]; } }, showWordPairs: function () { /** * Replace Module ShowWordPairs * @method showWordPairs */ var o = ValeriaBot.message.module.replace.getWordPairs(); cb.sendNotice("________________________________________", "", "", "#990037", "", ""); cb.sendNotice("ValeriaBot Replace Module - Word Pairs:", "", "", "#990037", "", ""); for (var key in o) { if (o.hasOwnProperty(key)) { cb.sendNotice("'" + key + "' becomes '" + o[key] + "'", "", "", "#990037", "", ""); } } cb.sendNotice("________________________________________", "", "", "#990037", "", ""); }, reset: function () { /** * Replace Module Reset * @method reset */ ValeriaBot.message.module.replace._oWordPairs = new Object(); cb.sendNotice("ValeriaBot Replace Module - Reset and Cleared Out!", "", "", "#990037", "", ""); }, onMessage: function (aryArg, oMsg, bIsRoomCreator) { /** * Replace Module OnMessage * @method onMessage */ var bIsMod = oMsg.is_mod; var o = ValeriaBot.message.module.replace.getWordPairs(); if (aryArg !== undefined) { if (aryArg[2] !== undefined) { if (aryArg[2] === "on") { ValeriaBot.message.module.replace.setEnabled(true); } if (aryArg[2] === "off") { ValeriaBot.message.module.replace.setEnabled(false); } if (aryArg[2] === "add") { ValeriaBot.message.module.replace.addWordPair(aryArg); } if (aryArg[2] === "remove") { ValeriaBot.message.module.replace.removeWordPair(aryArg); } if (aryArg[2] === "show") { ValeriaBot.message.module.replace.showWordPairs(aryArg); } if (aryArg[2] === "reset") { ValeriaBot.message.module.replace.reset(aryArg); } } else { ValeriaBot.message.module.replace.showHelp(oMsg, bIsRoomCreator); } } else { if (ValeriaBot.message.module.replace.getEnabled() === true) { for (var key in o) { if (o.hasOwnProperty(key)) { oMsg.m = oMsg.m.split(key).join(o[key]); } } } } return oMsg; }, onEnter: function (oUser, bIsRoomCreator) { // tbd }, onLeave: function (oUser, bIsRoomCreator) { // tbd }, onTip: function (oTip, bIsRoomCreator) { // tbd }, getWordPairs: function () { /** * Replace Module GetWordPairs * @method getWordPairs */ var o = ValeriaBot.message.module.replace._oWordPairs; return o; }, init: function () { /** * Replace Module Init * @method init */ var aryWordpairs; var aryWordpair; ValeriaBot.message.module.replace._oWordPairs = new Object(); if (cb.settings_choices === undefined) { cb.settings_choices = []; } cb.settings_choices.push( { name:"replace_enabled", type:"choice", choice1:"Yes", choice2:"No", defaultValue:"No", required: true, label: "[REPLACE MODULE] .......................................................... Enable?" }, { name:"replace_wordpairs", type:"str", defaultValue:"", required: false, label: "Word Replace Pairs (e.g. 'hi|bye hot|cold happy|sad')" }); if (cb.settings.replace_wordpairs !== undefined) { if (cb.settings.replace_wordpairs !== "") { aryWordpairs = cb.settings.replace_wordpairs.split(" "); for (var i = 0; i < aryWordpairs.length; i++) { aryWordpair = aryWordpairs[i].split("|"); ValeriaBot.message.module.replace.addWordPair(["/ValeriaBot", "replace", "add", aryWordpair[0], aryWordpair[1]]); } } } if (cb.settings.replace_enabled === "Yes") { ValeriaBot.message.module.replace.setEnabled(true); } else { ValeriaBot.message.module.replace.setEnabled(false); } } }, silence: { showHelp: function (oMsg, bIsRoomCreator) { var s = "________________________________________\nValeriaBot Silence Module:\n/ValeriaBot s <on/off>\n/ValeriaBot s all\n/ValeriaBot s relaxed\n/ValeriaBot s aggressive\n/ValeriaBot s allbutgreys\n/ValeriaBot s greys <on/off> ('on' silences)\n/ValeriaBot s demands <on/off>\n/ValeriaBot s user <username>\n/ValeriaBot s unsilence <username>\n/ValeriaBot s clear (bot-silenced may speak again)\n/u (unsilence last wrongly silenced)\n/mercy (unsilence last rightly silenced)\n/ValeriaBot s show\n/ValeriaBot s debug <on/off>\n/ValeriaBot s addimmunity <user>\n/ValeriaBot s removeimmunity <user>\n/ValeriaBot s clearimmunity\n/ValeriaBot s showimmune\n/ValeriaBot s addspecialgrey <user>\n/ValeriaBot s removespecialgrey <user>\n/ValeriaBot s clearspecialgreys\n/ValeriaBot s showspecialgreys\n/ValeriaBot s exportspecialgreys (for paste into launch settings)\n/ValeriaBot s exportimmuneusers (for paste into launch settings)\n/ValeriaBot s stats\n________________________________________"; if (bIsRoomCreator === true) { cb.sendNotice(s, oMsg.user, "", "#990037", "", ""); // Send to Room Creator } else { if (bIsMod === true) { cb.sendNotice(s, "", "", "#990037", "", "red"); // Send to Mods } } }, greys: function (oMsg, bIsRoomCreator) { var oImmuneUsers = ValeriaBot.message.module.silence.getImmuneUsers(); var oSpecialGreys = ValeriaBot.message.module.silence.getSpecialGreyUsers(); var bIsSpecialGrey = false; var bImmuneUser = false; var bIsMod = oMsg.is_mod; var bIsfcm = oMsg.in_fanclub; if (oImmuneUsers[oMsg.user] !== undefined) { bImmuneUser = true; } if (oSpecialGreys[oMsg.user] !== undefined) { bIsSpecialGrey = true; } if (oMsg.has_tokens === false) { if (bIsRoomCreator === false && bIsMod === false && bIsfcm === false && bImmuneUser === false && bIsSpecialGrey === false) { oMsg.m = ""; oMsg["X-Spam"] = true; cb.sendNotice("Sorry " + oMsg.user + ", 'greys' (those without tokens) are silenced right now.", oMsg.user, "", "#990037", "", ""); } } return oMsg; }, spam: function (oMsg, bIsRoomCreator) { var m = oMsg.m.toLowerCase().replace(/^\s+|\s+$/g,''); // lowercase and trim leading and trailing spaces var bFoundSpam = false; var arySpam = [ {title:"'leaked'", aryRegex:[/\[leak\]/i, /\[leaked\]/i]}, {title:"'ell**o'", aryRegex:[/EllaGo/i]}, {title:"'cbtokens***er'", aryRegex:[/chaturbatetokensadder/i]}, {title:"'sex*****.ru'", aryRegex:[/sex-chats.ru/i]}, {title:"'FR** T******! - Variant A'", aryRegex:[/FREE\ Tokens!!/i]}, {title:"'FR** T******! - Variant B'", aryRegex:[/Unlimited Tokens!!/i]}, {title:"'FR** T******! - Variant C'", aryRegex:[/Tokens 4 Free!!/i]}, {title:"'FR** T******! - Variant D'", aryRegex:[/Get\ FREE\ Tokens/i]}, {title:"'FR** T******! - Variant E'", aryRegex:[/\[GET\]\ Tokens/i]}, {title:"'5**K - Variant A'", aryRegex:[/500k\ Tokens/i]}, {title:"'5**K - Variant B'", aryRegex:[/500k\ FREE\ Tokens/i]}, {title:"'Tok*** Ad***'", aryRegex:[/Tokens\ Adder/i]}, {title:"'m* **** *** F*** t*****'", aryRegex:[/my\ page\ for\ free\ tokens/i]}, {title:"'T*** G*******'", aryRegex:[/Token\ Generator/i]}, {title:"'t***** ** ** b**'", aryRegex:[/tokens\ in\ my\ bio/i]}, {title:"'* a* d**** * f*******'", aryRegex:[/i\ am\ doing\ a\ FREESHOW/i]}, {title:"'K***K **'", aryRegex:[/K.I.K\ me/i]}, {title:"'t** my b**'", aryRegex:[/tap\ my\ bio/i]}, {title:"'c**** my p******'", aryRegex:[/click\ my\ profile/i]}, {title:"'ca*w*******'", aryRegex:[/Camwhorestv/i]}, {title:"'Am******0*'", aryRegex:[/Amecam/i]}, {title:"'sn**m****'", aryRegex:[/snapmilfs/i]}, {title:"'F*** C********* T******'", aryRegex:[/Free\ Chaturbate\ Tokens/i]}, {title:"'S** m* p******'", aryRegex:[/See\ my\ profile/i]}, {title:"'S** m* p******'", aryRegex:[/See\ my\ profile/i]}, {title:"'(dot)'", aryRegex:[/\(dot\)/i]}, {title:"'E******'", aryRegex:[/Erotimo/i]}, {title:"'c**** my b**'", aryRegex:[/click\ my\ bio/i]}, {title:"'t** my p******'", aryRegex:[/tap\ my\ profile/i]}, {title:"'G** f*** t*****'", aryRegex:[/Get\ free\ tokens/i]}, {title:"'a* m* p******'", aryRegex:[/at\ my\ profile/i]}, {title:"'a* m* b**'", aryRegex:[/at\ my\ bio/i]} ]; for (var i=0; i<arySpam.length; i++) { for (var j=0; j<arySpam[i].aryRegex.length; j++) { if (m.search(arySpam[i].aryRegex[j]) != -1) { ValeriaBot.message.module.silence.addSilencedUser(oMsg, undefined, undefined, false, arySpam[i].title+" spam"); ValeriaBot.message.module.silence.sendSilencedNotice(oMsg, arySpam[i].title+" spam", false); oMsg.m = ""; oMsg["X-Spam"] = true; bFoundSpam = true; break; } } if (bFoundSpam === true) { break; } } return oMsg; }, watchcam: function (oMsg, bIsRoomCreator) { var bFoundSpam = false; var m = oMsg.m.toLowerCase().replace(/^\s+|\s+$/g,''); // lowercase and trim leading and trailing spaces var arySpam = [ {title:"'Watch My Cam - Variant A'", aryRegex:[/(?=.*watch)(?=.*cam)/g]}, {title:"'Watch My Cam - Variant B'", aryRegex:[/free\ c2c/i]},{title:"'Watch My Cam - Variant C'", aryRegex:[/see\ my\ cam/i]} ]; for (var i=0; i<arySpam.length; i++) { for (var j=0; j<arySpam[i].aryRegex.length; j++) { if (m.search(arySpam[i].aryRegex[j]) != -1) { ValeriaBot.message.module.silence.addSilencedUser(oMsg, undefined, undefined, false, arySpam[i].title+" spam"); ValeriaBot.message.module.silence.sendSilencedNotice(oMsg, arySpam[i].title+" spam", true); oMsg.m = ""; oMsg["X-Spam"] = true; bFoundSpam = true; break; } } if (bFoundSpam === true) { break; } } return oMsg; }, demands: function (oMsg, bIsRoomCreator) { // Todo: Yes, I need to refactor the fuck out of this section -- lots of code duplication, cruft and poor form shenanegains that makes it hard to understand. This is just a fail-fast prototype and its working amazingly well. Will clean up later. //cb.sendNotice("ValeriaBot Silence module - demands submodule called.", "", "", "#990037", "", ""); var oImmuneUsers = ValeriaBot.message.module.silence.getImmuneUsers(); var bImmuneUser = false; if (oImmuneUsers[oMsg.user] !== undefined) { bImmuneUser = true; } var bIsMod = oMsg.is_mod; var m = oMsg.m.toLowerCase().replace(/^\s+|\s+$/g,''); // lowercase and trim leading and trailing spaces var aryMsgWords = m.split(" "); var iMsgWordsCount = 0; var bDebugEnabled = false; var sDebug = ""; var bCriteriaMet = false; var bFoundNoun = false; var bFoundVerb = false; var bFoundSubject = false; var bFoundImperative = false; var bFoundDeterminer = false; var bFoundHostTargetedDeterminer = false; var bFoundHostTargetedPronouns = false; var bFoundNonHostTargetedPronoun = false; var bFoundNonHostTargetedDeterminer = false; var bFoundPreposition = false; var bFoundPejorative = false; var bFoundPositiveVerb = false; var bFoundAdjective = false; var bFoundNegatoryAdverb = false; var bFoundDemand = false; var bFoundTake = false; var bQuotesAroundMessage = false; var sReEsc, re, aryM; var bImmune = false; var bVerbIsDo = false; var bNounIsIt = false; var iVerbIndex = -1; var iNounIndex = -1; var aryVerbsWhenSolo = ["zoom", "spread", "suck", "stand", "masturbate", "finger", "play", "rub", "fist", "squirt", "doggy", "cum", "anal", "piss", "pee", "poo", "poop", "fart", "defecate", "disrobe"]; var aryNounsWhenSolo = ["ass", "anus", "bra", "boobs", "boob", "feet", "foot", "face", "nipples", "nipple", "toes", "toe"]; var aryVerbs = ["show", "see", "zoom", "remove", "touch", "flash", "feed", "tease", "lift", "eat", "swallow", "gag", "rim", "open", "do", "put", "stand", "lay", "gape", "spread", "suck", "stroke", "fuck", "lick", "grab", "bang", "pound", "bruise", "pummel", "destroy", "murder", "push", "pull", "slap", "spank", "spit", "paddle", "hit", "punch", "flick", "grind", "thrust", "poke", "slam", "force", "jam", "insert", "penetrate", "fondle", "grope", "grapple", "squeeze", "finger", "diddle", "rub", "masturbate", "fist", "squirt", "cum", "anal", "piss", "pee", "poo", "poop", "fart"]; var aryNouns = ["vagina", "pussy", "dildo", "penis", "ass", "hole", "holes", "anus", "boobs", "boob", "feet", "foot", "face", "leg", "legs", "thighs", "thigh", "crack", "taint", "it", "nipple", "nipples", "clitoris", "lips", "mouth", "tongue", "toes", "toe", "armpit", "fingers", "clothes", "pants", "panties", "bra", "shorts", "shirt", "tshirt", "skirt", "stockings", "leggings", "underwear", "shoes", "heels"]; var aryAncillaryNouns = ["fingers", "hand", "hands"]; var aryPositiveVerbs = ["love", "like", "enjoy", "admire", "amazed"]; var aryPejoratives = ["bitch", "slut", "whore", "cunt", "thot", "hoe", "tramp", "skank", "chink", "gook", "chingchong"]; var aryGreetings = ["hi", "hello", "hey", "hai", "howdy", "yo", "sup", "greetings"]; var aryFarewells = ["farewell", "goodbye", "bye"]; var aryAdjectives = ["hot", "warm", "cool", "cold", "full", "sexy", "pretty", "heavenly", "gorgeous", "angelic", "beautiful", "nice", "lovely", "sweet", "juicy", "delicious", "yummy", "tasty", "firm", "tight", "wet", "bald", "bare", "hairless", "hairy", "bushy", "shiny", "glistening", "quivering", "fat", "phat", "dripping", "plump", "meaty", "wonderful", "little", "tiny", "small", "cute", "perfect", "amazing", "incredible", "stupendous", "enchanting", "enthralling", "good", "bad", "great", "awful", "horrible", "indifferent", "terrible", "horrid", "painful", "pleasurable", "sinful", "godly", "super", "extrodinary", "exquisite", "superior", "excellent", "awesome", "erect", "hard", "stiff", "pokey", "buttery", "soft", "gooey", "sticky", "slippery", "engorged", "throbbing", "horny", "black", "white", "red", "purple", "yellow", "green", "orange", "blue", "asian", "oriental", "chinese", "filipino", "japanese", "korean", "long", "short", "big", "huge", "massive", "giant", "humongous", "large", "enormous", "deep", "contracting", "pulsing", "pulsating", "soaking", "sopping", "drenched", "damp", "moist", "nasty", "dirty", "filthy", "smelly" ,"stinky", "fragrant", "pungent", "anime", "manga", "hentai", "kawaii", "otaku", "weeaboo", "fucking"]; var aryInterjections = ["mmm", "yes", "noo", "oh", "ha", "hah", "hahaha", "ay", "ah", "um", "hmm", "wow", "aha", "yay", "omg", "omfg", "lol", "lmao", "lmfao", "cmon", "yum", "yuck", "blah", "bleh", "meh", "eww", "bah", "gah"]; var arySubjects = ["Valeria", "baby", "darlin", "sweetie", "hun", "boo", "honey", "shorty", "lover", "sugar", "sugarpie", "sugarpants", "honeybun", "cutiepie", "cutie", "kitten", "doll", "princess", "hotstuff"]; var aryImperatives = ["please", "now"]; var aryPronouns = ["i", "mine", "we", "us", "they", "them", "theirs", "yours", "ours", "some", "myself", "itself", "themselves", "yourselves", "ourselves", "himself", "herself"]; var aryHostTargetedPronouns = ["he", "him", "she", "her", "his", "hers", "you", "yourself", "it","me"]; var aryAdverbs = ["very", "everywhere", "already", "really", "much", "too"]; var aryPrepositions = ["in", "out", "into", "between", "up", "on", "inside", "onto", "against", "outside", "off", "to"]; var aryCohortatives = ["lets", "let"]; var aryLinkingVerbs = ["are", "looks", "look", "were", "was", "is", "feels", "come"]; var aryAncillaryVerbs = ["want", "wish", "need"]; var aryMiscContractions = ["youd"]; var aryMiscTermsToRemove = ["pov"]; var aryDisjuncts = ["just"]; var aryUnitsOfTime = ["second", "minute", "hour", "day", "week", "month", "year"]; var aryAdverbsNegatory = ["not", "no", "never"]; var aryModalVerbs = ["can", "may", "could", "would", "should", "couldnt", "wouldnt", "neednt", "shouldnt", "couldve", "wouldve", "shouldve", "wont", "will", "must", "mustnt", "shall", "might", "did", "didnt"]; var aryConjunctions = ["and", "yet", "but", "for", "or", "so", "nor"]; var aryDeterminers = ["each", "every", "all", "these", "its", "their", "whose", "much", "many", "any"]; var aryHostTargetedDeterminers = ["your", "some", "those", "both", "a", "the", "my", "that", "this"]; var oSpellCorrect = { "heey":"hey", "heeyy":"hey", "heyy":"hey", "heya":"hey", "hii":"hi", "hhi":"hi", "hhii":"hi", "hiya":"hi", "haii":"hai", "salut":"hello", "cya":"bye", "niice":"nice", "bbc":"big black cock", "demon dick":"penis", "sec":"second", "n":"and", "fllow":"follow", "hey there":"hey", "hi there":"hi", "hi ho":"hi", "hey there":"hey", "hello there":"hello", "greetings and salutations":"greetings", "yoo":"yo", "helloo":"hello", "heello":"hello", "heelloo":"hello", "hheelloo":"hello", "aay":"ay", "aayy":"ay", "aay":"ay", "ayy":"ay", "uhg":"ugh", "uum":"um", "umm":"um", "uumm":"um", "hhm":"hmm", "hhmm":"hmm", "hrmm":"hmm", "haha":"hahaha", "hahahaha":"hahaha", "hahahahaha":"hahaha", "baha":"hahaha", "bahaha":"hahaha", "bahahaha":"hahaha", "yaay":"yay", "yaayy":"yay", "yayy":"yay", "baad":"bad", "aweful":"awful", "yuk":"yuck", "ew":"eww", "eew":"eww", "eeww":"eww", "shiirt":"shirt", "show us":"show", "show me":"show", "se":"see", "hw":"how", "cloths":"clothes", "take off top":"remove clothes", "take off bra":"remove bra", "take off clothes":"remove clothes", "take clothes off":"remove clothes", "take your clothes off":"remove clothes", "take all your clothes off":"remove clothes", "take all of your clothes off":"remove clothes", "take off all of your clothes":"remove clothes", "take off all your clothes":"remove clothes", "take off all of your clothing":"remove clothes", "take off all your clothing":"remove clothes", "take off bottom":"remove clothes", "take off bottoms":"remove clothes", "take off pants":"remove pants", "take off shirt":"remove shirt", "take off tshirt":"remove tshirt", "take off bra":"remove bra", "take off shorts":"remove shorts", "take off socks":"remove socks", "take off panties":"remove panties", "take off your":"remove", "take off that":"remove", "take off the":"remove", "take off all":"remove", "take off those":"remove", "zoom cam":"zoom", "zoom camera":"zoom", "put close":"zoom", "zoom in":"zoom", "zoom up":"zoom", "zoom into":"zoom", "zoom in to":"zoom", "zoom out":"zoom", "zoom on":"zoom", "zoom to":"zoom", "need not":"neednt", "neednot":"neednt", "needant":"neednt", "doggie":"doggy", "doggyy":"doggy", "shoe ass":"show ass", "shoe pussy":"show pussy", "stick it in":"penetrate", "stick it inside":"penetrate", "stick it into":"penetrate", "stick it in to":"penetrate", "stick in":"penetrate", "get naked":"disrobe", "undress":"disrobe", "right now":"now", "shw":"show", "shoow":"show", "showw":"show", "shooww":"show", "slapp":"slap", "slaap":"slap", "sllap":"slap", "sslap":"slap", "opn":"open", "anal gape":"anal", "doo":"do", "ddo":"do", "doo":"do", "ddoo":"do", "luv":"love", "luuv":"love", "lov":"love", "loove":"love", "lv":"love", "lve":"love", "luve":"love", "lik":"like", "lk":"like", "wett":"wet", "weet":"wet", "hott":"hot", "hoot":"hot", "hhot":"hot", "ht":"hot", "sexi":"sexy", "sxy":"sexy", "seexy":"sexy", "sexxy":"sexy", "sexyy":"sexy", "sexii":"sexy", "purfect":"perfect", "puurfect":"perfect", "purrfect":"perfect", "puurrfect":"perfect", "lil":"little", "littlebit": "", "kity":"kitty", "kittie":"kitty", "kitteh":"kitten", "kiteh":"kitten", "kittenn":"kitten", "kiten":"kitten", "vale":"Valeria", "vaale":"Valeria", "vale":"Valeria", "valeria":"Valeria", "valeria":"Valeria", "valeria":"Valeria", "valeria":"Valeria", "Valeriao":"Valeria", "valeria":"Valeria", "valeria":"Valeria", "Valeria":"Valeria", "Valeria":"Valeria", "Valeria luka":"Valeria", "Valeria ":"Valeria", "vale":"Valeria", "Valeria ":"Valeria", "Valeria":"Valeria", "bb":"baby", "bbyy":"baby", "bby":"baby", "babe":"baby", "bebe":"baby", "sweety":"sweetie", "shortie":"shorty", "cutie pie":"cutiepie", "ching chong":"chingchong", "showfeet":"show feet", "feetshow":"show feet", "hv":"have", "u":"you", "yuo":"you", "yoou":"you", "yyou":"you", "youu":"you", "yyoouu":"you", "yu":"you", "self":"yourself", "urself":"yourself", "urslf":"yourself", "ur":"your", "uur":"your", "urr":"your", "uurr":"your", "ir":"your", "yer":"your", "yr":"your", "you have":"youve", "uve":"youve", "uv":"youve", "you are":"youre", "your self":"yourself", "i am":"im", "going to":"gonna", "want to":"wanna", "can not":"cant", "cannot":"cant", "will not":"wont", "shant":"wont", "shall not":"wont", "have to":"must", "haveto":"must", "hafta":"must", "i would":"id", "you would":"youd", "should not":"shouldnt", "would not":"wouldnt", "could not":"couldnt", "should have":"shouldve", "should of":"shouldve", "would have":"wouldve", "would of":"wouldve", "could have":"couldve", "could of":"couldve", "must not":"mustnt", "must have":"musthv", "do not":"dont", "did not":"didnt", "is not":"isnt", "was not":"wasnt", "waanaa":"wanna", "waannaa":"wanna", "wwaannaa":"wanna", "waanna":"wanna", "r":"are", "dat":"that", "tho":"though", "thru":"through", "iit":"it", "itt":"it", "iitt":"it", "et":"it", "eet":"it", "ett":"it", "eett":"it", "mm":"mmm", "mhmm":"mmm", "mhhmm":"mmm", "mmhmm":"mmm", "mmhhmm":"mmm", "mhm":"mmm", "mmhhm":"mmm", "hmm":"mmm", "hhmm":"mmm", "mmhh":"mmm", "yus":"yes", "yas":"yes", "yaas":"yes", "yuss":"yes", "yuuss":"yes", "yees":"yes", "yyes":"yes", "yess":"yes", "yyeess":"yes", "yeah":"yes", "yah":"yes", "yaah":"yes", "yeh":"yes", "yeeh":"yes", "yeehh":"yes", "yehh":"yes", "ooh":"oh", "ohh":"oh", "oohh":"oh", "ow":"oh", "oow":"oh", "ooww":"oh", "oo":"oh", "aah":"ah", "ahh":"ah", "aahh":"ah", "woow":"wow", "wwow":"wow", "wwooww":"wow", "woww":"wow", "wooww":"wow", "yuum":"yum", "yumm":"yum", "yuummm":"yum", "pleease":"please", "pleasse":"please", "pleez":"please", "pleeze":"please", "pleezz":"please", "plezz":"please", "plez":"please", "plz":"please", "pllz":"please", "pls":"please", "plls":"please", "plzz":"please", "plss":"please", "ppllzz":"please", "ppllss":"please", "pleace":"please", "liss":"please", "pliz":"please", "pl":"please", "pliss":"please", "pleas":"please", "pleaz":"please", "pleasee":"please", "plsl":"please", "pkease":"please", "plase":"please", "noow":"now", "noww":"now", "nooww":"now", "nnow":"now", "nnooww":"now", "right now":"now", "right meow":"now", "okie dokie":"okay", "okie":"okay", "ok":"okay", "k":"okay", "oki":"okay", "okk":"okay","ook":"okay", "ookk":"okay", "ookkii":"okay", "okii":"okay", "panty":"panties", "ass hole":"anus", "butthole":"anus", "butt hole":"anus", "asshole":"anus", "anus hole":"anus", "ahole":"anus", "ashole":"anus", "pussy lips":"pussy", "vag":"vagina", "vagg":"vagina", "vaag":"vagina", "vaagg":"vagina", "pussy hole":"pussy", "py":"pussy", "psy":"pussy", "pussi":"pussy", "pusse":"pussy", "pussie":"pussy", "puusy":"pussy", "upssy":"pussy", "pussyy":"pussy", "puussy":"pussy", "ppuussyy":"pussy", "puussyy":"pussy", "pusst":"pussy", "pussu":"pussy", "pusy":"pussy", "posse":"pussy", "puthey":"pussy", "puss":"pussy", "pus":"pussy", "twat":"vagina", "cunt":"vagina", "slit":"vagina", "vulva":"vagina", "kunt":"vagina", "clit":"clitoris", "clit":"clitorus", "klit":"clitorus", "cock":"penis", "dick":"penis", "dickk":"penis", "dck":"penis", "ding ding":"penis", "peen":"penis", "dong":"penis", "ding dong":"penis", "nippls":"nipples", "nips":"nipples", "nipps":"nipples", "niples":"nipples", "nippl":"nipple", "nip":"nipple", "nipp":"nipple", "niple":"nipple", "fet":"feet", "ft":"feet", "ffet":"feet", "ffeet":"feet", "feett":"feet", "ffeett":"feet", "boobss":"boobs", "tits":"boobs", "chest":"boobs", "breasts":"boobs", "tit":"boob", "breast":"boob", "boobies":"boobs", "titys":"boobs", "titis":"boobs", "tittss":"boobs", "tiittss":"boobs", "tittis":"boobs", "b00bs":"boobs", "b00b":"boob", "bobs":"boobs", "aass":"ass", "aas":"ass", "a$$":"ass", "shitter":"ass", "pooper":"ass", "butt":"ass", "buttocks":"ass", "buttock":"ass", "buutt":"ass", "tonuge":"tongue", "tougne":"tongue", "tonge":"tongue", "tung":"tongue", "tongeu":"tongue", "tuung":"tongue", "toongue":"tongue", "tonguue":"tongue", "tonguee":"tongue", "toonguuee":"tongue", "toonguue":"tongue", "toungue":"tongue", "tounge":"tongue", "arm pit":"armpit", "fingerz":"fingers", "fingees":"fingers", "succkk":"suck", "suucckk":"suck", "ssuucckk":"suck", "suuck":"suck", "suckk":"suck", "suuckk":"suck", "cuum":"cum", "ccum":"cum", "cumm":"cum", "ccuum":"cum", "cuumm":"cum", "ccuumm":"cum", "masterbate":"masturbate", "jerk off":"masturbate", "jack off":"masturbate", "jackoff":"masturbate", "jill off":"masturbate", "finger kitty":"masturbate", "toss off":"masturbate", "fingerblast":"finger", "fingerbang":"finger", "finger blast":"finger", "finger bang":"finger", "rrub":"rub", "ruub":"rub", "rubb":"rub", "kitten tongue":"tongue", "kitty tongue":"tongue", "cat tongue":"tongue", "machn":"machine", "machin":"machine", "machin":"machine", "fuck machine":"fmachine", "f machine":"fmachine", "tongue it":"lick it", "tongue that":"lick that", "tongue the":"lick the", "tongue her":"lick her", "tongue his":"lick his", "giv":"give", "give me":"show me", "give your":"show your", "can i see":"lets see", "may i see":"lets see", "can we see":"lets see", "may we see":"lets see", "can i view":"lets see" }; bDebugEnabled = ValeriaBot.message.module.silence.getDebugEnabled(); if (m.indexOf('"') === 0 && m.lastIndexOf('"') === m.length-1) { bQuotesAroundMessage = true; } if (bQuotesAroundMessage === true && (bImmuneUser === true || oMsg.in_fanclub === true)) { bImmune = true; } m = m.replaceAll("<3", "").trim(); // remove some common emoticons with alphanumeric characters in them so they don't pollute the result //m = m.replaceAll("<3", "").replaceAll(":3", "").replaceAll("D:", "").trim(); m = m.replace(/[^\w\s]|_/g, "").replace(/\s+/g, " "); // remove all punctuation and repeating spaces m = m.replace(/(.)\1{2,}/g, "$1$1"); // remove repeating characters above two repeats m = ValeriaBot.global.helper.string.removeConsecutiveDuplicateWords(m); // remove groups of consecutive repeating words iMsgWordsCount = ValeriaBot.global.helper.string.countWords(m); sDebug = sDebug + "Demands - Before word normalization: "+m+"\n"; /* * Symantec normilization, spell correcting and two-word-combination normilization */ var iBeg, iMid, iEnd, iLen; for (var key in oSpellCorrect) { if (oSpellCorrect.hasOwnProperty(key)) { iLen = m.length; iMid = m.indexOf(" "+key+" "); iBeg = m.indexOf(key+" "); iEnd = m.lastIndexOf(" "+key); if (iMsgWordsCount > 1) { if (m.indexOf(key) === 0 && m.length === key.length) { m = m.replace(key, oSpellCorrect[key]); //cb.sendNotice("> "+key, "", "", "#990037", "", ""); iMsgWordsCount = ValeriaBot.global.helper.string.countWords(m); iLen = m.length; //break; } } if (iEnd !== -1 && iEnd === iLen-(key.length+1)) { //m = m.replace(" "+key, " "+oSpellCorrect[key]); m = m.replace(new RegExp(" "+key + '$'), " "+oSpellCorrect[key]); iLen = m.length; } if (iBeg !== -1 && iBeg === 0) { m = m.replace(key+" ", oSpellCorrect[key]+" "); iLen = m.length; } if (iMid !== -1) { // Todo: limitation, won't capture two words next to each other m = m.replaceAll(" "+key+" ", " "+oSpellCorrect[key]+" "); iLen = m.length; } if (iMsgWordsCount === 1) { if (m.indexOf(key) === 0) { m = m.replace(key, oSpellCorrect[key]); //cb.sendNotice("> "+key, "", "", "#990037", "", ""); iMsgWordsCount = ValeriaBot.global.helper.string.countWords(m); iLen = m.length; break; } } } } // check for determiners for use in edge-cases like "dat ass" when distillation reduces word count to a single silencable noun (a determiner will spare it) for (var j = 0; j < aryDeterminers.length; j++) { sReEsc = ValeriaBot.global.helper.string.escRe(aryDeterminers[j]); re = ValeriaBot.global.helper.string.makeRe(sReEsc); if (re.test(m) === true) { bFoundDeterminer = true; break; } } for (var j = 0; j < aryHostTargetedDeterminers.length; j++) { sReEsc = ValeriaBot.global.helper.string.escRe(aryHostTargetedDeterminers[j]); re = ValeriaBot.global.helper.string.makeRe(sReEsc); if (re.test(m) === true) { bFoundDeterminer = true; break; } } //cb.sendNotice("> "+m, "", "", "#990037", "", ""); sDebug = sDebug + "Demands - After word normalization: "+m+"\n"; // immunity for asking for price if (m.indexOf("how much") !== -1 || m.indexOf("how many") !== -1 || m.indexOf("tokens") !== -1 || m.indexOf("price") !== -1 || m.indexOf("cost") !== -1) { bImmune = true; } // immunity for basic compliments if (m.indexOf("i love") !== -1 || m.indexOf("i like") !== -1 || m.indexOf("i enjoy") !== -1) { // first line of defense, we'll check more later bImmune = true; } if (m.indexOf("love how") !== -1 || m.indexOf("like how") !== -1) { // first line of defense, we'll check more later bImmune = true; } if (m.indexOf("love your") !== -1 || m.indexOf("like your") !== -1 || m.indexOf("enjoying your") !== -1) { // first line of defense, we'll check more later bImmune = true; } if (m.indexOf("you love") !== -1 || m.indexOf("you like") !== -1 || m.indexOf("you enjoy") !== -1) { // first line of defense, we'll check more later bImmune = true; } if (m.indexOf("you look") !== -1 || m.indexOf("you are") !== -1) { // first line of defense, we'll check more later bImmune = true; } if (m.indexOf("youve") !== -1) { // first line of defense, we'll check more later bImmune = true; } if (m.indexOf("youd") !== -1) { // first line of defense, we'll check more later bImmune = true; } // immunity for expressing desire to do something (is not a demand but may be silenced at the discretion of a mod) if (m.indexOf("id love") !== -1 || m.indexOf("id like") !== -1 || m.indexOf("id be") !== -1) { // first line of defense, we'll check more later bImmune = true; } // immunity for expressing desire to do somthing or suggesting an action (is not a demand but may be silenced at the discretion of a mod) if (m.indexOf("wish to") !== -1) { // first line of defense, we'll check more later bImmune = true; } if (m.indexOf("i would") !== -1) { // first line of defense, we'll check more later bImmune = true; } if (m.indexOf("we would") !== -1) { // first line of defense, we'll check more later bImmune = true; } if (m.indexOf("they would") !== -1) { // first line of defense, we'll check more later bImmune = true; } if (m.indexOf("she would") !== -1) { // first line of defense, we'll check more later bImmune = true; } if (m.indexOf("he would") !== -1) { // first line of defense, we'll check more later bImmune = true; } if (m.indexOf("i should") !== -1) { // okay to talk about themselves bImmune = true; } if (m.indexOf("we should") !== -1) { // okay to suggest bImmune = true; } if (m.indexOf("it would") !== -1 || m.indexOf("that would") !== -1) { // first line of defense, we'll check more later bImmune = true; } if (m.indexOf("it could") !== -1 || m.indexOf("that could") !== -1) { // first line of defense, we'll check more later bImmune = true; } if (m.indexOf("they could") !== -1 || m.indexOf("he could") !== -1 || m.indexOf("she could") !== -1) { // first line of defense, we'll check more later bImmune = true; } if (m.indexOf("would i") !== -1 || m.indexOf("should i") !== -1) { // first line of defense, we'll check more later bImmune = true; } if (m.indexOf("would we") !== -1 || m.indexOf("should we") !== -1) { // first line of defense, we'll check more later bImmune = true; } if (m.indexOf("perhaps") !== -1 || m.indexOf("maybe") !== -1) { // first line of defense, we'll check more later bImmune = true; } if (m.indexOf("would you") !== -1 || m.indexOf("should you") !== -1) { // first line of defense, we'll check more later bImmune = true; } if (m.indexOf("do you") !== -1 || m.indexOf("does she") !== -1 || m.indexOf("does Valeria") !== -1) { // first line of defense, we'll check more later bImmune = true; } if (m.indexOf("does it") !== -1) { // first line of defense, we'll check more later bImmune = true; } /* if (m.indexOf("will you") !== -1) { // first line of defense, we'll check more later bImmune = true; } */ /* if (m.indexOf("can you") !== -1) { // first line of defense, we'll check more later bImmune = true; } */ /* if (m.indexOf("might you") !== -1) { // first line of defense, we'll check more later bImmune = true; } */ if (m.indexOf("may you") !== -1) { // first line of defense, we'll check more later bImmune = true; } if (m.indexOf("will i") !== -1) { // first line of defense, we'll check more later bImmune = true; } if (m.indexOf("shouldnt") !== -1 || m.indexOf("couldnt") !== -1 || m.indexOf("wouldnt") !== -1) { // first line of defense, we'll check more later bImmune = true; } if (m.indexOf("neednt") !== -1) { // first line of defense, we'll check more later bImmune = true; } if (m.indexOf("wont") !== -1 || m.indexOf("dont") !== -1 || m.indexOf("cant") !== -1) { // first line of defense, we'll check more later bImmune = true; } if (m.indexOf("didnt") !== -1 || m.indexOf("did") !== -1) { // first line of defense, we'll check more later bImmune = true; } if (m.indexOf("when") !== -1 || m.indexOf("why") !== -1) { // questions will be immune bImmune = true; } if (m.indexOf("how ") === 0) { // questions will be immune bImmune = true; } if (m.indexOf("love to ") === 0 || m.indexOf("like to ") === 0 || m.indexOf("wanna ") === 0) { // declaration immune bImmune = true; } if (m.indexOf("where") !== -1 || m.indexOf("what") !== -1) { // questions will be immune bImmune = true; } if (m.indexOf("is that") !== -1 || m.indexOf("is there") !== -1) { // questions will be immune bImmune = true; } if (m.indexOf("isnt") !== -1 || m.indexOf("is there") !== -1 || m.indexOf("was there") !== -1 || m.indexOf("were there") !== -1) { // questions will be immune bImmune = true; } if (m.indexOf("are you") !== -1 || m.indexOf("were you") !== -1 || m.indexOf("are they") !== -1) { // questions will be immune bImmune = true; } /* if (m.indexOf("can i") !== -1 || m.indexOf("may i") !== -1) { // questions will be immune bImmune = true; } */ /* if (m.indexOf("can we") !== -1 || m.indexOf("may we") !== -1) { // questions will be immune bImmune = true; } */ if (m.indexOf("can they") !== -1 || m.indexOf("may they") !== -1) { // questions will be immune bImmune = true; } if (m.indexOf("can he") !== -1 || m.indexOf("may he") !== -1) { // questions will be immune bImmune = true; } if (m.indexOf("can she") !== -1 || m.indexOf("may she") !== -1) { // questions will be immune bImmune = true; } if (m.indexOf("she ever") !== -1) { // questions will be immune bImmune = true; } if (m.indexOf("can it") !== -1 || m.indexOf("may it") !== -1) { // questions will be immune bImmune = true; } if (m.indexOf("you wanna") !== -1 || m.indexOf("you gonna") !== -1) { // questions will be immune bImmune = true; } if (m.indexOf("i wonder") !== -1 || m.indexOf("i question") !== -1 || m.indexOf("question") !== -1) { // questions will be immune bImmune = true; } if (m.indexOf("you wonder") !== -1 || m.indexOf("you question") !== -1) { // questions will be immune bImmune = true; } if (m.indexOf("i wanna") !== -1) { // questions will be immune bImmune = true; } if (m.indexOf("wanna") !== -1) { // immune bImmune = true; } if (m.indexOf("is getting") !== -1) { // immune bImmune = true; } if (m.indexOf("do it") !== -1) { bImmune = true; } sDebug = sDebug + "Demands - After immunity checks: bImmune: "+bImmune+"\n"; //cb.sendNotice("> "+m+" - Imunity: "+bImmune, "", "", "#990037", "", ""); aryM = m.split(" "); aryM = aryM.filter(function(el) { // remove irrelevant modal verbs return aryModalVerbs.indexOf(el) < 0; }); m = aryM.join(" "); iMsgWordsCount = ValeriaBot.global.helper.string.countWords(m); if (bImmune === false) { aryM = m.split(" "); aryM = aryM.filter(function ( el ) { // remove irrelevant misc terms return aryMiscTermsToRemove.indexOf( el ) < 0; }); aryM = aryM.filter(function ( el ) { // remove irrelevant greetings return aryGreetings.indexOf( el ) < 0; }); aryM = aryM.filter(function ( el ) { // remove irrelevant conjunctions return aryConjunctions.indexOf( el ) < 0; }); aryM = aryM.filter(function ( el ) { // remove irrelevant adverbs return aryAdverbs.indexOf( el ) < 0; }); aryM = aryM.filter(function ( el ) { // remove irrelevant Interjections return aryInterjections.indexOf( el ) < 0; }); aryM = aryM.filter(function ( el ) { // remove irrelevant cohortatives return aryCohortatives.indexOf( el ) < 0; }); aryM = aryM.filter(function ( el ) { // remove irrelevant ancillary verbs return aryAncillaryVerbs.indexOf( el ) < 0; }); aryM = aryM.filter(function ( el ) { // remove irrelevant disjuncts return aryDisjuncts.indexOf( el ) < 0; }); aryM = aryM.filter(function ( el ) { // remove irrelevant linking verbs return aryLinkingVerbs.indexOf( el ) < 0; }); aryM = aryM.filter(function ( el ) { // remove irrelevant ancillary nouns return aryAncillaryNouns.indexOf( el ) < 0; }); aryM = aryM.filter(function ( el ) { // remove irrelevant misc contractions return aryMiscContractions.indexOf( el ) < 0; }); aryM = aryM.filter(function ( el ) { // remove irrelevant units of time return aryUnitsOfTime.indexOf( el ) < 0; }); aryM = aryM.filter(function (el) { // remove irrelevant subjects return arySubjects.indexOf(el) < 0; }); m = aryM.join(" "); iMsgWordsCount = ValeriaBot.global.helper.string.countWords(m); /* * If only two words now, check for a noun and imperative (no verb needed, this is clearly a demand) */ if (iMsgWordsCount === 2) { for (var j = 0; j < aryNouns.length; j++) { sReEsc = ValeriaBot.global.helper.string.escRe(aryNouns[j]); re = ValeriaBot.global.helper.string.makeRe(sReEsc); if (re.test(m) === true) { bFoundNoun = true; break; } } for (var j = 0; j < aryImperatives.length; j++) { sReEsc = ValeriaBot.global.helper.string.escRe(aryImperatives[j]); re = ValeriaBot.global.helper.string.makeRe(sReEsc); if (re.test(m) === true) { bFoundImperative = true; break; } } if (bFoundNoun === true && bFoundImperative === true) { ValeriaBot.message.module.silence.addSilencedUser(oMsg, undefined, undefined, false, "demands"); ValeriaBot.message.module.silence.sendSilencedNotice(oMsg, "demands", true, m, bIsMod, bIsRoomCreator); if (bImmuneUser === false) { oMsg.m = ""; oMsg["X-Spam"] = true; } bFoundDemand = true; } } if (iMsgWordsCount === 3) { for (var j = 0; j < aryNouns.length; j++) { sReEsc = ValeriaBot.global.helper.string.escRe(aryNouns[j]); re = ValeriaBot.global.helper.string.makeRe(sReEsc); if (re.test(m) === true) { bFoundNoun = true; break; } } for (var j = 0; j < aryImperatives.length; j++) { sReEsc = ValeriaBot.global.helper.string.escRe(aryImperatives[j]); re = ValeriaBot.global.helper.string.makeRe(sReEsc); if (re.test(m) === true) { bFoundImperative = true; break; } } for (var j = 0; j < aryHostTargetedDeterminers.length; j++) { sReEsc = ValeriaBot.global.helper.string.escRe(aryHostTargetedDeterminers[j]); re = ValeriaBot.global.helper.string.makeRe(sReEsc); if (re.test(m) === true) { bFoundHostTargetedDeterminer = true; break; } } if (bFoundNoun === true && bFoundImperative === true && bFoundHostTargetedDeterminer === true) { ValeriaBot.message.module.silence.addSilencedUser(oMsg, undefined, undefined, false, "demands"); ValeriaBot.message.module.silence.sendSilencedNotice(oMsg, "demands", true, m, bIsMod, bIsRoomCreator); if (bImmuneUser === false) { oMsg.m = ""; oMsg["X-Spam"] = true; } bFoundDemand = true; } } aryM = aryM.filter(function ( el ) { // remove irrelevant imperatives return aryImperatives.indexOf( el ) < 0; }); //sDebug = sDebug + "Demands - After subject removal: " + aryM.join(" ") + "\n"; m = aryM.join(" "); iMsgWordsCount = ValeriaBot.global.helper.string.countWords(m); sDebug = sDebug + "Demands - Before prepositions removal: "+m+"\n"; /* * Find two word "<noun> off" use-cases */ if (iMsgWordsCount === 2) { for (var j = 0; j < aryNouns.length; j++) { sReEsc = ValeriaBot.global.helper.string.escRe(aryNouns[j]); re = ValeriaBot.global.helper.string.makeRe(sReEsc); if (re.test(m) === true) { bFoundNoun = true; break; } } bFoundPreposition = m.indexOf("off") === -1 ? false : true; if (bFoundNoun === true && bFoundPreposition === true) { ValeriaBot.message.module.silence.addSilencedUser(oMsg, undefined, undefined, false, "demands"); ValeriaBot.message.module.silence.sendSilencedNotice(oMsg, "demands", true, m, bIsMod, bIsRoomCreator); if (bImmuneUser === false) { oMsg.m = ""; oMsg["X-Spam"] = true; } bFoundDemand = true; } } /* * Find common hard to catch phrases in the form of "take <noun> off" */ if (iMsgWordsCount >= 3 && iMsgWordsCount <= 4) { bFoundTake = m.indexOf("take") === -1 ? false : true; for (var j = 0; j < aryNouns.length; j++) { sReEsc = ValeriaBot.global.helper.string.escRe(aryNouns[j]); re = ValeriaBot.global.helper.string.makeRe(sReEsc); if (re.test(m) === true) { bFoundNoun = true; break; } } bFoundPreposition = m.indexOf("off") === -1 ? false : true; if (bFoundNoun === true && bFoundPreposition === true && bFoundTake === true) { ValeriaBot.message.module.silence.addSilencedUser(oMsg, undefined, undefined, false, "demands"); ValeriaBot.message.module.silence.sendSilencedNotice(oMsg, "demands", true, m, bIsMod, bIsRoomCreator); if (bImmuneUser === false) { oMsg.m = ""; oMsg["X-Spam"] = true; } bFoundDemand = true; } } /* * Find common hard to catch phrases whil we still have propositions */ if(m === "take it off" || m === "take it all off" || m === "go quick" || m === "go fast" || m === "go faster") { ValeriaBot.message.module.silence.addSilencedUser(oMsg, undefined, undefined, false, "demands"); ValeriaBot.message.module.silence.sendSilencedNotice(oMsg, "demands", true, m, bIsMod, bIsRoomCreator); if (bImmuneUser === false) { oMsg.m = ""; oMsg["X-Spam"] = true; } bFoundDemand = true; } if (bFoundDemand === false) { aryM = aryM.filter(function (el) { // remove irrelevant prepositions return aryPrepositions.indexOf(el) < 0; }); sDebug = sDebug + "Demands - After most parts of speech removal: " + aryM.join(" ") + "\n"; aryM = aryM.filter(function (el) { // remove host targeted determiners return aryHostTargetedDeterminers.indexOf(el) < 0; }); aryM = aryM.filter(function (el) { // remove host targeted pronouns return aryHostTargetedPronouns.indexOf(el) < 0; }); m = aryM.join(" "); sDebug = sDebug + "Demands - After host-targeted pronouns and determiners removal: "+m+"\n"; } m = aryM.join(" "); iMsgWordsCount = ValeriaBot.global.helper.string.countWords(m); //aryM = aryM.filter(function ( el ) { // remove non host targeted determiners // return aryDeterminers.indexOf( el ) < 0; //}); //aryM = aryM.filter(function ( el ) { // remove non host targeted pronouns // return aryPronouns.indexOf( el ) < 0; //}); iMsgWordsCount = ValeriaBot.global.helper.string.countWords(m); sDebug = sDebug + "Demands - After non host targeted pronouns and determiners: "+m+"\n"; //cb.sendNotice("> "+m, "", "", "#990037", "", ""); // Todo: need to add edge case is someone says "do it" combined with another verb noun pair. E.g., "suck it do it now" slips by the engine. Even phrases like "suck it fuck it" will need some kind of recursive phase checking. if (bFoundDemand === false) { /* * Check for two-to-eight word messages that have one or more adjectives and a noun but no verb (it's usually a compliment and we won't silence) */ if (iMsgWordsCount <= 8 && iMsgWordsCount >= 2) { //cb.sendNotice("ValeriaBot Silence module - demands submodule called. Got to one word logic.", "", "", "#990037", "", ""); for (var j = 0; j < aryPronouns.length; j++) { sReEsc = ValeriaBot.global.helper.string.escRe(aryPronouns[j]); re = ValeriaBot.global.helper.string.makeRe(sReEsc); if (re.test(m) === true) { bFoundNonHostTargetedPronoun = true; break; } } for (var j = 0; j < aryDeterminers.length; j++) { sReEsc = ValeriaBot.global.helper.string.escRe(aryDeterminers[j]); re = ValeriaBot.global.helper.string.makeRe(sReEsc); if (re.test(m) === true) { bFoundNonHostTargetedDeterminer = true; break; } } for (var j = 0; j < aryVerbs.length; j++) { sReEsc = ValeriaBot.global.helper.string.escRe(aryVerbs[j]); re = ValeriaBot.global.helper.string.makeRe(sReEsc); if (re.test(m) === true) { bFoundVerb = true; break; } } for (var j = 0; j < aryNouns.length; j++) { sReEsc = ValeriaBot.global.helper.string.escRe(aryNouns[j]); re = ValeriaBot.global.helper.string.makeRe(sReEsc); if (re.test(m) === true) { bFoundNoun = true; break; } } for (var j = 0; j < aryAdjectives.length; j++) { sReEsc = ValeriaBot.global.helper.string.escRe(aryAdjectives[j]); re = ValeriaBot.global.helper.string.makeRe(sReEsc); if (re.test(m) === true) { bFoundAdjective = true; break; } } for (var j = 0; j < aryPositiveVerbs.length; j++) { sReEsc = ValeriaBot.global.helper.string.escRe(aryPositiveVerbs[j]); re = ValeriaBot.global.helper.string.makeRe(sReEsc); if (re.test(m) === true) { bFoundPositiveVerb = true; break; } } for (var j = 0; j < aryPejoratives.length; j++) { sReEsc = ValeriaBot.global.helper.string.escRe(aryPejoratives[j]); re = ValeriaBot.global.helper.string.makeRe(sReEsc); if (re.test(m) === true) { bFoundPejorative = true; break; } } if (bFoundVerb === false && bFoundNoun === true && (bFoundAdjective === true || bFoundPositiveVerb === true) && bFoundPejorative === false ) { bImmune = true; } } sDebug = sDebug + "Demands - After adjective and 'compliments' immunity checking: bImmune: "+bImmune+"\n"; aryM = m.split(" "); aryM = aryM.filter(function ( el ) { // remove irrelevant adjectives return aryAdjectives.indexOf( el ) < 0; }); m = aryM.join(" "); iMsgWordsCount = ValeriaBot.global.helper.string.countWords(m); //cb.sendNotice("> "+m, "", "", "#990037", "", ""); sDebug = sDebug + "Demands - After removing adjectives: "+m+"\n"; if (bImmune === false) { /* * If message one word */ if (iMsgWordsCount === 1) { //cb.sendNotice("ValeriaBot Silence module - demands submodule called. Got to one word logic.", "", "", "#990037", "", ""); for (var i = 0; i < aryVerbsWhenSolo.length; i++) { sReEsc = ValeriaBot.global.helper.string.escRe(aryVerbsWhenSolo[i]); // remember to omit delimiting slashes when using RegExp re = ValeriaBot.global.helper.string.makeRe(sReEsc); if (re.test(m) === true) { ValeriaBot.message.module.silence.addSilencedUser(oMsg, undefined, undefined, false, "demands"); ValeriaBot.message.module.silence.sendSilencedNotice(oMsg, "demands", true, m, bIsMod, bIsRoomCreator); if (bImmuneUser === false) { oMsg.m = ""; oMsg["X-Spam"] = true; } bCriteriaMet = true; break; } } if (bCriteriaMet === false) { for (var i = 0; i < aryNounsWhenSolo.length; i++) { sReEsc = ValeriaBot.global.helper.string.escRe(aryNounsWhenSolo[i]); re = ValeriaBot.global.helper.string.makeRe(sReEsc); if (re.test(m) === true) { if (bFoundDeterminer === false) { // if not spared from finding a determiner before the reduction. e.g., "dat ass" ("that ass" after spell correction) ValeriaBot.message.module.silence.addSilencedUser(oMsg, undefined, undefined, false, "demands"); ValeriaBot.message.module.silence.sendSilencedNotice(oMsg, "demands", true, m, bIsMod, bIsRoomCreator); if (bImmuneUser === false) { oMsg.m = ""; oMsg["X-Spam"] = true; } bCriteriaMet = true; break; } } } } if (bCriteriaMet === false) { for (var i = 0; i < aryPejoratives.length; i++) { sReEsc = ValeriaBot.global.helper.string.escRe(aryPejoratives[i]); re = ValeriaBot.global.helper.string.makeRe(sReEsc); if (re.test(m) === true) { ValeriaBot.message.module.silence.addSilencedUser(oMsg, undefined, undefined, false, "pejorative" ); ValeriaBot.message.module.silence.sendSilencedNotice(oMsg, "a term of abuse! Banning recommended!", true, undefined, bIsMod, bIsRoomCreator); if (bImmuneUser === false) { oMsg.m = ""; oMsg["X-Spam"] = true; } bCriteriaMet = true; break; } } } } else { if (iMsgWordsCount == 2) { for (var j = 0; j < aryPronouns.length; j++) { sReEsc = ValeriaBot.global.helper.string.escRe(aryPronouns[j]); re = ValeriaBot.global.helper.string.makeRe(sReEsc); if (re.test(m) === true) { bFoundNonHostTargetedPronoun = true; break; } } for (var j = 0; j < aryDeterminers.length; j++) { sReEsc = ValeriaBot.global.helper.string.escRe(aryDeterminers[j]); re = ValeriaBot.global.helper.string.makeRe(sReEsc); if (re.test(m) === true) { bFoundNonHostTargetedDeterminer = true; break; } } for (var j = 0; j < aryVerbs.length; j++) { sReEsc = ValeriaBot.global.helper.string.escRe(aryVerbs[j]); re = ValeriaBot.global.helper.string.makeRe(sReEsc); if (re.test(m) === true) { if (aryVerbs[j] === "do") { bVerbIsDo = true; } iVerbIndex = m.indexOf(aryVerbs[j]); bFoundVerb = true; break; } } for (var j = 0; j < aryNouns.length; j++) { sReEsc = ValeriaBot.global.helper.string.escRe(aryNouns[j]); re = ValeriaBot.global.helper.string.makeRe(sReEsc); if (re.test(m) === true) { if (aryNouns[j] === "it") { bNounIsIt = true; } iNounIndex = m.indexOf(aryNouns[j]); bFoundNoun = true; break; } } for (var j = 0; j < aryPrepositions.length; j++) { sReEsc = ValeriaBot.global.helper.string.escRe(aryPrepositions[j]); re = ValeriaBot.global.helper.string.makeRe(sReEsc); if (re.test(m) === true) { bFoundPreposition = true; break; } } for (var j = 0; j < aryPejoratives.length; j++) { sReEsc = ValeriaBot.global.helper.string.escRe(aryPejoratives[j]); re = ValeriaBot.global.helper.string.makeRe(sReEsc); if (re.test(m) === true) { bFoundPejorative = true; break; } } if ((bFoundVerb === true && (bFoundNoun === true || bFoundPejorative === true || bFoundPreposition === true) && (bFoundNonHostTargetedPronoun === false && bFoundNonHostTargetedDeterminer === false))) { if (bVerbIsDo === true && bNounIsIt === true) { // } else { if (bFoundPejorative === true) { ValeriaBot.message.module.silence.addSilencedUser(oMsg, undefined, undefined, false, "pejorative"); ValeriaBot.message.module.silence.sendSilencedNotice(oMsg, "a term of abuse! Banning recommended.", true, oMsg.m, bIsMod, bIsRoomCreator); } else { if ((iVerbIndex === -1 || iNounIndex === -1) || iVerbIndex < iNounIndex) { ValeriaBot.message.module.silence.addSilencedUser(oMsg, undefined, undefined, false, "demands"); ValeriaBot.message.module.silence.sendSilencedNotice(oMsg, "demands", true, m, bIsMod, bIsRoomCreator); } } if (bImmuneUser === false) { oMsg.m = ""; oMsg["X-Spam"] = true; } } } } else { if (iMsgWordsCount === 3) { for (var j = 0; j < aryPronouns.length; j++) { sReEsc = ValeriaBot.global.helper.string.escRe(aryPronouns[j]); re = ValeriaBot.global.helper.string.makeRe(sReEsc); if (re.test(m) === true) { bFoundNonHostTargetedPronoun = true; break; } } for (var j = 0; j < aryDeterminers.length; j++) { sReEsc = ValeriaBot.global.helper.string.escRe(aryDeterminers[j]); re = ValeriaBot.global.helper.string.makeRe(sReEsc); if (re.test(m) === true) { bFoundNonHostTargetedDeterminer = true; break; } } for (var j = 0; j < aryVerbs.length; j++) { sReEsc = ValeriaBot.global.helper.string.escRe(aryVerbs[j]); re = ValeriaBot.global.helper.string.makeRe(sReEsc); if (re.test(m) === true) { if (aryVerbs[j] === "do") { bVerbIsDo = true; } bFoundVerb = true; break; } } for (var j = 0; j < aryNouns.length; j++) { sReEsc = ValeriaBot.global.helper.string.escRe(aryNouns[j]); re = ValeriaBot.global.helper.string.makeRe(sReEsc); if (re.test(m) === true) { if (aryNouns[j] === "it") { bNounIsIt = true; } bFoundNoun = true; break; } } for (var j = 0; j < aryPrepositions.length; j++) { sReEsc = ValeriaBot.global.helper.string.escRe(aryPrepositions[j]); re = ValeriaBot.global.helper.string.makeRe(sReEsc); if (re.test(m) === true) { bFoundPreposition = true; break; } } for (var j = 0; j < aryAdverbsNegatory.length; j++) { sReEsc = ValeriaBot.global.helper.string.escRe(aryAdverbsNegatory[j]); re = ValeriaBot.global.helper.string.makeRe(sReEsc); if (re.test(m) === true) { bFoundNegatoryAdverb = true; break; } } for (var j = 0; j < aryPejoratives.length; j++) { sReEsc = ValeriaBot.global.helper.string.escRe(aryPejoratives[j]); re = ValeriaBot.global.helper.string.makeRe(sReEsc); if (re.test(m) === true) { bFoundPejorative = true; break; } } if (((bFoundVerb === true && (bFoundNoun === true || bFoundPejorative === true || bFoundPreposition === true)) && bFoundNegatoryAdverb === false) && (bFoundNonHostTargetedPronoun === false && bFoundNonHostTargetedDeterminer === false)) { if (bVerbIsDo === true && bNounIsIt === true) { // } else { if (bFoundPejorative === true) { ValeriaBot.message.module.silence.addSilencedUser(oMsg, undefined, undefined, false, "pejorative"); ValeriaBot.message.module.silence.sendSilencedNotice(oMsg, "a term of abuse! Banning recommended.", true, oMsg.m, bIsMod, bIsRoomCreator); } else { ValeriaBot.message.module.silence.addSilencedUser(oMsg, undefined, undefined, false, "demands"); ValeriaBot.message.module.silence.sendSilencedNotice(oMsg, "demands", true, m, bIsMod, bIsRoomCreator); } if (bImmuneUser === false) { oMsg.m = ""; oMsg["X-Spam"] = true; } } } } else { if (iMsgWordsCount === 4) { for (var j = 0; j < aryPronouns.length; j++) { sReEsc = ValeriaBot.global.helper.string.escRe(aryPronouns[j]); re = ValeriaBot.global.helper.string.makeRe(sReEsc); if (re.test(m) === true) { bFoundNonHostTargetedPronoun = true; break; } } for (var j = 0; j < aryDeterminers.length; j++) { sReEsc = ValeriaBot.global.helper.string.escRe(aryDeterminers[j]); re = ValeriaBot.global.helper.string.makeRe(sReEsc); if (re.test(m) === true) { bFoundNonHostTargetedDeterminer = true; break; } } for (var j = 0; j < aryVerbs.length; j++) { sReEsc = ValeriaBot.global.helper.string.escRe(aryVerbs[j]); re = ValeriaBot.global.helper.string.makeRe(sReEsc); if (re.test(m) === true) { if (aryVerbs[j] === "do") { bVerbIsDo = true; } bFoundVerb = true; break; } } for (var j = 0; j < aryNouns.length; j++) { sReEsc = ValeriaBot.global.helper.string.escRe(aryNouns[j]); re = ValeriaBot.global.helper.string.makeRe(sReEsc); if (re.test(m) === true) { if (aryNouns[j] === "it") { bNounIsIt = true; } bFoundNoun = true; break; } } for (var j = 0; j < aryPrepositions.length; j++) { sReEsc = ValeriaBot.global.helper.string.escRe(aryPrepositions[j]); re = ValeriaBot.global.helper.string.makeRe(sReEsc); if (re.test(m) === true) { bFoundPreposition = true; break; } } for (var j = 0; j < aryAdverbsNegatory.length; j++) { sReEsc = ValeriaBot.global.helper.string.escRe(aryAdverbsNegatory[j]); re = ValeriaBot.global.helper.string.makeRe(sReEsc); if (re.test(m) === true) { bFoundNegatoryAdverb = true; break; } } for (var j = 0; j < aryPejoratives.length; j++) { sReEsc = ValeriaBot.global.helper.string.escRe(aryPejoratives[j]); re = ValeriaBot.global.helper.string.makeRe(sReEsc); if (re.test(m) === true) { bFoundPejorative = true; break; } } if ((bFoundVerb === true && (bFoundNoun === true || bFoundPejorative === true || bFoundPreposition === true)) && bFoundNegatoryAdverb === false) { if (bVerbIsDo === true && bNounIsIt === true) { // } else { if (bFoundPejorative === true) { ValeriaBot.message.module.silence.addSilencedUser(oMsg, undefined, undefined, false, "pejorative"); ValeriaBot.message.module.silence.sendSilencedNotice(oMsg, "a very uncalled for term of abuse! Banning recommended.", true, oMsg.m, bIsMod, bIsRoomCreator); } else { ValeriaBot.message.module.silence.addSilencedUser(oMsg, undefined, undefined, false, "demands", bIsMod, bIsRoomCreator); ValeriaBot.message.module.silence.sendSilencedNotice(oMsg, "demands", true, m); } if (bImmuneUser === false) { oMsg.m = ""; oMsg["X-Spam"] = true; } } } } else { if (iMsgWordsCount >= 5) { } } } } } } } } if (iMsgWordsCount > 1) { sDebug = sDebug + "Demands - Found flags - bFoundNegatoryAdverb: "+bFoundNegatoryAdverb+" bFoundNonHostTargetedDeterminer: "+bFoundNonHostTargetedDeterminer+" bFoundNonHostTargetedPronoun: "+bFoundNonHostTargetedPronoun+" bFoundVerb: "+bFoundVerb+" bFoundDeterminer: "+bFoundDeterminer+" bFoundNoun: "+bFoundNoun+" bFoundPreposition: "+bFoundPreposition+" bFoundPejorative: "+bFoundPejorative+" - iMsgWordsCount: "+iMsgWordsCount+" - bQuotesAroundMessage: "+bQuotesAroundMessage+" - bImmuneUser: "+bImmuneUser+" - iVerbIndex: "+iVerbIndex+" - iNounIndex: "+iNounIndex+"\n"; } else { sDebug = sDebug + "Demands - Found flags - bFoundDeterminer: "+bFoundDeterminer+" - iMsgWordsCount: "+iMsgWordsCount+" - bQuotesAroundMessage: "+bQuotesAroundMessage+" - bImmuneUser: "+bImmuneUser+"\n"; } if (bDebugEnabled === true) { cb.sendNotice(sDebug, "sypunk", "#ffff00", "#888800", "", ""); } return oMsg; }, lewd: function (oMsg, bIsRoomCreator) { //cb.sendNotice("ValeriaBot Silence module - lewd submodule called.", "", "", "#990037", "", ""); return oMsg; }, nonenglish: function (oMsg, bIsRoomCreator) { //cb.sendNotice("ValeriaBot Silence module - nonenglish submodule called.", "", "", "#990037", "", ""); return oMsg; }, poorgrammar: function (oMsg, bIsRoomCreator) { //cb.sendNotice("ValeriaBot Silence module - poorgrammar submodule called.", "", "", "#990037", "", ""); return oMsg; }, repetitious: function (oMsg, bIsRoomCreator) { //cb.sendNotice("ValeriaBot Silence module - repetitious submodule called.", "", "", "#990037", "", ""); return oMsg; }, stickykeys: function (oMsg, bIsRoomCreator) { //cb.sendNotice("ValeriaBot Silence module - stickykeys submodule called.", "", "", "#990037", "", ""); return oMsg; }, bb: function (oMsg, bIsRoomCreator) { cb.sendNotice("ValeriaBot Silence module - bb submodule called.", "", "", "#990037", "", ""); return oMsg; }, irksomewordlist: function (oMsg, bIsRoomCreator) { //cb.sendNotice("ValeriaBot Silence module - irksomewordlist submodule called.", "", "", "#990037", "", ""); return oMsg; }, alltermsofendearment: function (oMsg, bIsRoomCreator) { //cb.sendNotice("ValeriaBot Silence module - alltermsofendearment submodule called.", "", "", "#990037", "", ""); return oMsg; }, unwantedtermsofendearment: function (oMsg, bIsRoomCreator) { //cb.sendNotice("ValeriaBot Silence module - unwantedtermsofendearment submodule called.", "", "", "#990037", "", ""); return oMsg; }, hostmisspellings: function (oMsg, bIsRoomCreator) { //cb.sendNotice("ValeriaBot Silence module - hostmisspellings submodule called.", "", "", "#990037", "", ""); return oMsg; }, staffmisspellings: function (oMsg, bIsRoomCreator) { //cb.sendNotice("ValeriaBot Silence module - staff submodule called.", "", "", "#990037", "", ""); return oMsg; }, underageproclaimers: function (oMsg, bIsRoomCreator) { //cb.sendNotice("ValeriaBot Silence module - underageproclaimers submodule called.", "", "", "#990037", "", ""); return oMsg; }, faqs: function (oMsg, bIsRoomCreator) { //cb.sendNotice("ValeriaBot Silence module - faq submodule called.", "", "", "#990037", "", ""); return oMsg; }, wordy: function (oMsg, bIsRoomCreator) { //cb.sendNotice("ValeriaBot Silence module - wordy submodule called.", "", "", "#990037", "", ""); return oMsg; }, watchlist: function (oMsg, bIsRoomCreator) { //cb.sendNotice("ValeriaBot Silence module - watchlist submodule called.", "", "", "#990037", "", ""); return oMsg; }, offenderlist: function (oMsg, bIsRoomCreator) { //cb.sendNotice("ValeriaBot Silence module - offenderlist submodule called.", "", "", "#990037", "", ""); return oMsg; }, banlist: function (oMsg, bIsRoomCreator) { //cb.sendNotice("ValeriaBot Silence module - banlist submodule called.", "", "", "#990037", "", ""); return oMsg; }, allgraphics: function (oMsg, bIsRoomCreator) { //cb.sendNotice("ValeriaBot Silence module - allgraphics submodule called.", "", "", "#990037", "", ""); return oMsg; }, lamegraphics: function (oMsg, bIsRoomCreator) { //cb.sendNotice("ValeriaBot Silence module - lamegraphics submodule called.", "", "", "#990037", "", ""); return oMsg; }, lewdgraphics: function (oMsg, bIsRoomCreator) { //cb.sendNotice("ValeriaBot Silence module - lewdgraphics submodule called.", "", "", "#990037", "", ""); return oMsg; }, stats: function (oMsg, bIsRoomCreator) { /** * Silence Module Stats * @method stats */ var iTotal = ValeriaBot.message.module.silence._iStatsMessagesTotal; var iSilenced = ValeriaBot.message.module.silence._iStatsMessagesSilenced; var iUnsilenced = ValeriaBot.message.module.silence._iStatsMessagesUnsilenced; var iAccuracy; if (iSilenced < 1 || iTotal < 1) { iAccuracy = 100; } else { iAccuracy = 100 - ((iUnsilenced * 100) / iSilenced); iAccuracy = +(iAccuracy.toFixed(2)); } cb.sendNotice("ValeriaBot Silence Stats ["+iSilenced+"/"+iUnsilenced+"/"+iAccuracy+"%]: "+ iTotal +" messages analyzed. "+iSilenced+" silenced. "+iUnsilenced+" incorrectly silenced by the bot.", "", "", "#990037", "", ""); cb.sendNotice("Silence accuracy: "+iAccuracy+"%.", "", "", "#990037", "bold", ""); }, statsUpdateMessagesTotal: function () { /** * Silence Module StatsUpdate * @method statsUpdate */ ValeriaBot.message.module.silence._iStatsMessagesTotal = ValeriaBot.message.module.silence._iStatsMessagesTotal + 1; }, statsUpdateMessagesSilenced: function () { /** * Silence Module StatsUpdateMessagesSilenced * @method statsUpdateMessagesSilenced */ ValeriaBot.message.module.silence._iStatsMessagesSilenced = ValeriaBot.message.module.silence._iStatsMessagesSilenced + 1; }, statsUpdateMessagesUnsilenced: function () { /** * Silence Module StatsUpdateMessagesUnsilenced * @method statsUpdateMessagesUnsilenced */ ValeriaBot.message.module.silence._iStatsMessagesUnsilenced = ValeriaBot.message.module.silence._iStatsMessagesUnsilenced + 1; }, showSilencedUsers: function (oMsg, bIsRoomCreator) { /** * Silence Module ShowSilencedUsers * @method showSilencedUsers */ var bIsMod = oMsg.is_mod; var o = ValeriaBot.message.module.silence.getSilencedUsers(); var s = ""; s = s + "________________________________________\n"; s = s + "ValeriaBot's List of Silenced Users:\n"; for (var key in o) { var iMaxLen = 200; var sEllipsis = ""; var sMsgTruncated = o[key].m.substr(0, iMaxLen); if (o[key].m.length > iMaxLen) { sEllipsis = "..."; } if (o.hasOwnProperty(key)) { s = s + ""+key+": "+sMsgTruncated+sEllipsis+" ("+o[key].reason+")\n"; } } s = s + "________________________________________"; if (bIsRoomCreator === true) { cb.sendNotice(s, oMsg.user, "", "#990037", "", ""); // Send to Room Creator } else { if (bIsMod === true) { cb.sendNotice(s, oMsg.user, "", "#990037", "", ""); // Send to Mods } } }, showImmuneUsers: function (oMsg, bIsRoomCreator){ /** * Silence Module ShowImmuneUsers * @method showImmuneUsers */ var bIsMod = oMsg.is_mod; var o = ValeriaBot.message.module.silence.getImmuneUsers(); var s = ""; s = s + "________________________________________\n"; s = s + "ValeriaBot's List of Users Immune from Silencing:\n"; for (var key in o) { if (o.hasOwnProperty(key)) { s = s + key+"\n"; } } s = s + "________________________________________"; if (bIsRoomCreator === true) { cb.sendNotice(s, oMsg.user, "", "#990037", "", ""); // Send to Room Creator } else { if (bIsMod === true) { cb.sendNotice(s, oMsg.user, "", "#990037", "", ""); // Send to Mods } } }, showSpecialGreyUsers: function (oMsg, bIsRoomCreator){ /** * Silence Module ShowSpecialGreyUsers * @method showSpecialGreyUsers */ var bIsMod = oMsg.is_mod; var o = ValeriaBot.message.module.silence.getSpecialGreyUsers(); var s = ""; s = s + "________________________________________\n"; s = s + "ValeriaBot's List of Special Greys (Spared from Grey Silencing):\n"; for (var key in o) { if (o.hasOwnProperty(key)) { s = s + ""+key+"\n"; } } s = s + "________________________________________"; if (bIsRoomCreator === true) { cb.sendNotice(s, oMsg.user, "", "#990037", "", ""); // Send to Room Creator } else { if (bIsMod === true) { cb.sendNotice(s, oMsg.user, "", "#990037", "", ""); // Send to Mods } } }, exportSpecialGreyUsers: function (oMsg, bIsRoomCreator){ /** * Silence Module ExportSpecialGreyUsers * @method exportSpecialGreyUsers */ var bIsMod = oMsg.is_mod; var o = ValeriaBot.message.module.silence.getSpecialGreyUsers(); var s = ""; s = s + "Exported Special Greys List. Paste into Bot's Launch Settings:\n"; for (var key in o) { if (o.hasOwnProperty(key)) { s = s + key+" "; } } s = s + "\n"; if (bIsRoomCreator === true) { cb.sendNotice(s, oMsg.user, "", "#990037", "", ""); // Send to Room Creator } else { if (bIsMod === true) { cb.sendNotice(s, oMsg.user, "", "#990037", "", ""); // Send to Mods } } }, exportImmuneUsers: function (oMsg, bIsRoomCreator){ /** * Silence Module ExportImmuneUsers * @method exportImmuneUsers */ var bIsMod = oMsg.is_mod; var o = ValeriaBot.message.module.silence.getImmuneUsers(); var s = ""; s = s + "Exported Immune Users. Paste into Bot's Launch Settings:\n"; for (var key in o) { if (o.hasOwnProperty(key)) { s = s + key+" "; } } s = s + "\n"; if (bIsRoomCreator === true) { cb.sendNotice(s, oMsg.user, "", "#990037", "", ""); // Send to Room Creator } else { if (bIsMod === true) { cb.sendNotice(s, oMsg.user, "", "#990037", "", ""); // Send to Mods } } }, setDebugEnabled: function (b) { if (b === true) { cb.sendNotice("ValeriaBot - Silence Module Debugging On (Only Sypunk will see them, so as not to spam the chat).", "", "", "#990037", "", ""); } if (b === false) { cb.sendNotice("ValeriaBot - Silence Module Debugging Off.", "", "", "#990037", "", ""); } ValeriaBot.message.module.silence._bDebugEnabled = b; }, getDebugEnabled: function () { return ValeriaBot.message.module.silence._bDebugEnabled; }, getSilencedUsers: function (){ var o = ValeriaBot.message.module.silence._oSilencedUsers; return o; }, getImmuneUsers: function (){ return ValeriaBot.message.module.silence._oImmuneUsers; }, addImmuneUser: function (sUser, oUser, bIsRoomCreator, bSupressNotification){ var bIsMod = false; var oImmuneUsers = ValeriaBot.message.module.silence.getImmuneUsers(); if (sUser !== undefined) { if (oImmuneUsers[sUser] === undefined) { // if not already addded, then add oImmuneUsers[sUser] = true; if (oUser === undefined) { if (bSupressNotification === undefined) { cb.sendNotice("ValeriaBot gave silence immunity status to user "+sUser+"!", "", "", "#990037", "", ""); } } else { bIsMod = oUser.is_mod; if (sUser === oUser.user || bIsMod === true || bIsRoomCreator === true) { if (bSupressNotification === undefined) { cb.sendNotice("ValeriaBot gave silence immunity status to user "+sUser+"!", oUser.user, "", "#990037", "", ""); } } } } } }, removeImmuneUser: function (sUser){ var oImmuneUsers = ValeriaBot.message.module.silence.getImmuneUsers(); if (oImmuneUsers[sUser] !== undefined) { delete oImmuneUsers[sUser]; cb.sendNotice("ValeriaBot removing silence immunity status from user "+sUser+".", "", "", "#990037", "", ""); } }, clearAllImmuneUsers: function (){ cb.sendNotice("ValeriaBot removing immunity status from all immune users so that they are once again subject to bot silencing.", "", "", "#990037", "", ""); ValeriaBot.message.module.silence._oImmuneUsers = {}; }, addSpecialGreyUser: function (sUser, oUser, bIsRoomCreator, bSupressNotification){ var bIsMod = false; var oSpecialGreyUsers = ValeriaBot.message.module.silence.getSpecialGreyUsers(); if (sUser !== undefined) { if (oSpecialGreyUsers[sUser] === undefined) { // if not already addded, then add oSpecialGreyUsers[sUser] = true; if (oUser === undefined) { if (bSupressNotification === undefined) { cb.sendNotice("ValeriaBot gave 'special grey' status to user "+sUser+"! This person is allowed to speak when greys are silenced.", "", "", "#990037", "", ""); } } else { bIsMod = oUser.is_mod; if (sUser === oUser.user || bIsMod === true || bIsRoomCreator === true) { if (bSupressNotification === undefined) { cb.sendNotice("ValeriaBot gave 'special grey' status to user "+sUser+"! This person is allowed to speak when greys are silenced.", oUser.user, "", "#990037", "", ""); } } } } } }, removeSpecialGreyUser: function (sUser){ var oSpecialGreyUsers = ValeriaBot.message.module.silence.getSpecialGreyUsers(); if (oSpecialGreyUsers[sUser] !== undefined) { delete oSpecialGreyUsers[sUser]; cb.sendNotice("ValeriaBot removing 'special grey' status from user "+sUser+".", "", "", "#990037", "", ""); } }, getSpecialGreyUsers: function (){ return ValeriaBot.message.module.silence._oSpecialGreyUsers; }, clearAllSpecialGreyUsers: function (){ cb.sendNotice("ValeriaBot removing 'special grey' status from all 'special grey' users so that they are once again subject to bot grey silencing.", "", "", "#990037", "", ""); ValeriaBot.message.module.silence._oSpecialGreyUsers = {}; }, addSilencedUser: function (oMsg, aryArg, oMsgIsMod, bShowNotice, sReason){ var bDebuggingEnabled = ValeriaBot.message.module.debug.getEnabled(); var sDebugMessage = ""; var sImmuneMsgP1 = ""; var sImmuneMsgP2 = ""; var oImmuneUsers = ValeriaBot.message.module.silence.getImmuneUsers(); var bImmune = false; if (oMsg !== undefined) { if (oImmuneUsers[oMsg.user] !== undefined) { bImmune = true; } //cb.sendNotice(">>> "+bImmune+" - "+oMsg.user+" - "+oImmuneUsers[oMsg.user]+" - "+oImmuneUsers["perfectfool"], "", "", "#990037", "", ""); if (bDebuggingEnabled !== true) { if (bImmune === false) { ValeriaBot.message.module.silence.statsUpdateMessagesSilenced(); ValeriaBot.message.module.silence._oSilencedUsers[oMsg.user] = {m: oMsg.m, reason: sReason, immunity: bImmune}; ValeriaBot.message.module.silence._sLastSilencedUser = oMsg.user; } } else { sDebugMessage = " (NOT REALLY BECAUSE WE'RE TESTING) "; } if (bShowNotice === true) { cb.sendNotice("ValeriaBot "+sImmuneMsgP1+"silenced "+oMsg.user+sDebugMessage+sImmuneMsgP2+".", "", "", "#990037", "", ""); } } if (aryArg !== undefined) { if (aryArg[3] !== undefined) { ValeriaBot.message.module.silence._oSilencedUsers[aryArg[3]] = {m: ""}; if (bShowNotice === true) { ValeriaBot.message.module.silence.statsUpdateMessagesSilenced(); cb.sendNotice("ValeriaBot silenced user "+aryArg[3]+" manually via moderator "+oMsgIsMod.user+".", "", "", "#990037", "", ""); ValeriaBot.message.module.silence._sLastSilencedUser = aryArg[3]; } } } }, clearAllSilencedUsers: function (oMsg, aryArg, oMsgIsMod, bShowNotice){ cb.sendNotice("ValeriaBot clearing all silenced users so they may speak again. Via moderator "+oMsgIsMod.user+".", "", "", "#990037", "", ""); ValeriaBot.message.module.silence._oSilencedUsers = {}; }, removeSilencedUser: function (oMsg, aryArg, oMsgIsMod, bShowNotice, bWasMercy){ if (bWasMercy === undefined) { bWasMercy = false; } if (aryArg[3] !== undefined) { cb.sendNotice("ValeriaBot unsilenced user "+aryArg[3]+" via moderator "+oMsgIsMod.user+".", "", "", "#990037", "", ""); delete ValeriaBot.message.module.silence._oSilencedUsers[aryArg[3]]; if (bWasMercy === false) { ValeriaBot.message.module.silence.statsUpdateMessagesUnsilenced(); } } }, getLastSilencedUser: function () { var s = ValeriaBot.message.module.silence._sLastSilencedUser; return s; }, removeLastSilencedUser: function (oMsg, aryArg, oMsgIsMod, bShowNotice, bWasMercy){ if (bWasMercy === undefined) { bWasMercy = false; } var sLastSilencedUser = ValeriaBot.message.module.silence.getLastSilencedUser(); if (sLastSilencedUser !== undefined) { cb.sendNotice("ValeriaBot unsilenced user "+sLastSilencedUser+". This person may speak again!", "", "", "#990037", "", ""); //cb.sendNotice("Sorry about that, "+sLastSilencedUser+". You may talk again now.", sLastSilencedUser, "", "#990037", "", ""); delete ValeriaBot.message.module.silence._oSilencedUsers[sLastSilencedUser]; if (bWasMercy === false) { ValeriaBot.message.module.silence.statsUpdateMessagesUnsilenced(); } } }, sendSilencedNotice: function (oMsg, sReason, bVerbose, bDistilledMessage, bIsMod, bIsRoomCreator) { var oImmuneUsers = ValeriaBot.message.module.silence.getImmuneUsers(); var bImmune = false; var sImmuneMsgP1 = "silenced "+oMsg.user; var sImmuneMsgP2 = ""; var sImmuneUser = ""; var sColor = "#990037"; var sVerbose = " ('"+oMsg.m+"')."; var sValeriaBotInterpretation = ""; if (oImmuneUsers[oMsg.user] !== undefined) { bImmune = true; sImmuneMsgP1 = "didn't silence "; sImmuneMsgP2 = " "+oMsg.user+" has immunity!"; sColor = "#bb8822"; sImmuneUser = oMsg.user; sVerbose = "."; } if (bDistilledMessage !== undefined) { if (bDistilledMessage !== "") { bDistilledMessage = bDistilledMessage.replace("vagina", "pussy").replace("penis", "dick").replace("anus", "asshole").replace("see", "[let's] see").replace("put", "put [in]").replace("fmachine", "f-machine"); sValeriaBotInterpretation = " Interpreted as: '"+bDistilledMessage+".'"+sImmuneMsgP2; } } if (bVerbose === false) { sVerbose = ""; } //cb.sendNotice("ValeriaBot "+sImmuneMsgP1+" for "+sReason+sVerbose+sValeriaBotInterpretation, "", "", sColor, "", ""); cb.sendNotice("ValeriaBot "+sImmuneMsgP1+" for "+sReason+sVerbose, "", "", sColor, "", ""); }, getSilenceLevel: function () { var ary = ValeriaBot.message.module.silence._aryCurrentSilenceLevels; return ary; }, setSilenceDemandsEnabled: function (bEnabled) { var arySilenceLevels = ValeriaBot.message.module.silence._aryCurrentSilenceLevels; var i; if (bEnabled === true) { cb.sendNotice("ValeriaBot Silencing Demands On.", "", "", "#990037", "", ""); if (ValeriaBot.global.helper.array.contains(arySilenceLevels, "demands") === false) { arySilenceLevels.push("demands"); } } else { cb.sendNotice("ValeriaBot Silencing Demands Off.", "", "", "#990037", "", ""); var i = arySilenceLevels.indexOf("demands"); if (i > -1) { arySilenceLevels.splice(i, 1); } } }, setSilenceSpamEnabled: function (bEnabled) { var arySilenceLevels = ValeriaBot.message.module.silence._aryCurrentSilenceLevels; var i; if (bEnabled === true) { cb.sendNotice("ValeriaBot Silencing Spam On.", "", "", "#990037", "", ""); if (ValeriaBot.global.helper.array.contains(arySilenceLevels, "spam") === false) { arySilenceLevels.push("spam"); } } else { cb.sendNotice("ValeriaBot Silencing Spam Off.", "", "", "#990037", "", ""); var i = arySilenceLevels.indexOf("spam"); if (i > -1) { arySilenceLevels.splice(i, 1); } } }, setSilenceWatchcamEnabled: function (bEnabled) { var arySilenceLevels = ValeriaBot.message.module.silence._aryCurrentSilenceLevels; var i; if (bEnabled === true) { cb.sendNotice("ValeriaBot Silencing 'Watch My Cam' On.", "", "", "#990037", "", ""); if (ValeriaBot.global.helper.array.contains(arySilenceLevels, "watchcam") === false) { arySilenceLevels.push("watchcam"); } } else { cb.sendNotice("ValeriaBot Silencing 'Watch My Cam' Off.", "", "", "#990037", "", ""); var i = arySilenceLevels.indexOf("watchcam"); if (i > -1) { arySilenceLevels.splice(i, 1); } } }, setSilenceGreysEnabled: function (bEnabled) { var arySilenceLevels = ValeriaBot.message.module.silence._aryCurrentSilenceLevels; var i; if (bEnabled === true) { cb.sendNotice("ValeriaBot Silencing Greys On.", "", "", "#990037", "", ""); if (ValeriaBot.global.helper.array.contains(arySilenceLevels, "greys") === false) { arySilenceLevels.push("greys"); } } else { cb.sendNotice("ValeriaBot Silencing Greys Off.", "", "", "#990037", "", ""); var i = arySilenceLevels.indexOf("greys"); if (i > -1) { arySilenceLevels.splice(i, 1); } } }, setSilenceLevel: function (aryArg, oMsg, bIsRoomCreator) { /** * Silence Module SetSilenceLevel * @method onMessage */ var arySilenceLevels = ValeriaBot.message.module.silence._aryCurrentSilenceLevels; var oSilenceLevels = { on: [ "spam", "watchcam", "demands" ], all: [ "greys", "spam", "watchcam", "demands", "lewd", "nonenglish", "poorgrammar", "repetitious", "stickykeys", "bb", "irksomewordlist", "alltermsofendearment", "hostmisspellings", "staffmisspellings", "underageproclaimers", "faqs", "wordy", "watchlist", "offenderlist", "banlist", "allgraphics", "lamegraphics", "lewdgraphics" ], relaxed: [ "spam", "watchcam", "demands", "repetitious", "stickykeys", "underageproclaimers", "faqs", "watchlist", "offenderlist", "banlist" ], aggressive: [ "spam", "watchcam", "demands", "lewd", "repetitious", "stickykeys", "bb", "irksomewordlist", "alltermsofendearment", "underageproclaimers", "faqs", "watchlist", "offenderlist", "banlist", "lamegraphics", "lewdgraphics" ], allbutgreys: [ "spam", "watchcam", "demands", "lewd", "nonenglish", "poorgrammar", "repetitious", "stickykeys", "bb", "irksomewordlist", "alltermsofendearment", "hostmisspellings", "staffmisspellings", "underageproclaimers", "faqs", "wordy", "watchlist", "offenderlist", "banlist", "allgraphics", "lamegraphics", "lewdgraphics" ] }; if (aryArg[2] !== undefined) { if (aryArg[2] === "on") { cb.sendNotice("ValeriaBot Silencing Module On.", "", "", "#990037", "", ""); arySilenceLevels.length = 0; // clears the array for (var i = 0; i < oSilenceLevels.on.length; i++) { arySilenceLevels.push(oSilenceLevels.on[i]); } } if (aryArg[2] === "off") { cb.sendNotice("ValeriaBot Silencing Module Off.", "", "", "#990037", "", ""); arySilenceLevels.length = 0; // clears the array } if (aryArg[2] === "all") { cb.sendNotice("ValeriaBot Silencing - 'All Mode' Engaged.", "", "", "#990037", "", ""); arySilenceLevels.length = 0; // clears the array for (var i = 0; i < oSilenceLevels.all.length; i++) { arySilenceLevels.push(oSilenceLevels.all[i]); } } if (aryArg[2] === "relaxed") { cb.sendNotice("ValeriaBot Silencing - 'Relaxed Mode' Engaged.", "", "", "#990037", "", ""); arySilenceLevels.length = 0; // clears the array for (var i = 0; i < oSilenceLevels.relaxed.length; i++) { arySilenceLevels.push(oSilenceLevels.relaxed[i]); } } if (aryArg[2] === "aggressive") { cb.sendNotice("ValeriaBot Silencing - 'Aggressive Mode' Engaged.", "", "", "#990037", "", ""); arySilenceLevels.length = 0; // clears the array for (var i = 0; i < oSilenceLevels.aggressive.length; i++) { arySilenceLevels.push(oSilenceLevels.aggressive[i]); } } if (aryArg[2] === "allbutgreys") { cb.sendNotice("ValeriaBot Silencing - 'All But Greys Mode' Engaged.", "", "", "#990037", "", ""); arySilenceLevels.length = 0; // clears the array for (var i = 0; i < oSilenceLevels.allbutgreys.length; i++) { arySilenceLevels.push(oSilenceLevels.allbutgreys[i]); } } if (aryArg[2] === "greys" && (aryArg[3] === "on" || aryArg[3] === undefined)) { ValeriaBot.message.module.silence.setSilenceGreysEnabled(true); } if (aryArg[2] === "greys" && aryArg[3] === "off") { ValeriaBot.message.module.silence.setSilenceGreysEnabled(false); } if (aryArg[2] === "spam" && (aryArg[3] === "on" || aryArg[3] === undefined)) { ValeriaBot.message.module.silence.setSilenceSpamEnabled(true); } if (aryArg[2] === "spam" && aryArg[3] === "off") { ValeriaBot.message.module.silence.setSilenceSpamEnabled(false); } if (aryArg[2] === "watchcam" && (aryArg[3] === "on" || aryArg[3] === undefined)) { ValeriaBot.message.module.silence.setSilenceWatchcamEnabled(true); } if (aryArg[2] === "watchcam" && aryArg[3] === "off") { ValeriaBot.message.module.silence.setSilenceWatchcamEnabled(false); } if (aryArg[2] === "demands" && (aryArg[3] === "on" || aryArg[3] === undefined)) { ValeriaBot.message.module.silence.setSilenceDemandsEnabled(true); } if (aryArg[2] === "demands" && aryArg[3] === "off") { ValeriaBot.message.module.silence.setSilenceDemandsEnabled(false); } if (aryArg[2] === "user") { ValeriaBot.message.module.silence.addSilencedUser(undefined, aryArg, oMsg, true); } if (aryArg[2] === "unsilence") { ValeriaBot.message.module.silence.removeSilencedUser(undefined, aryArg, oMsg, true); } if (aryArg[2] === "clear") { ValeriaBot.message.module.silence.clearAllSilencedUsers(undefined, aryArg, oMsg, true); } if (aryArg[2] === "show") { ValeriaBot.message.module.silence.showSilencedUsers(oMsg, bIsRoomCreator); } if (aryArg[2] === "debug") { if (aryArg[3] !== undefined) { if (aryArg[3] === "on") { ValeriaBot.message.module.silence.setDebugEnabled(true); } if (aryArg[3] === "off") { ValeriaBot.message.module.silence.setDebugEnabled(false); } } } if (aryArg[2] === "addimmunity") { if (aryArg[3] !== undefined) { if (aryArg[3] !== "") { ValeriaBot.message.module.silence.addImmuneUser(aryArg[3]); } } } if (aryArg[2] === "removeimmunity") { if (aryArg[3] !== undefined) { if (aryArg[3] !== "") { ValeriaBot.message.module.silence.removeImmuneUser(aryArg[3]); } } } if (aryArg[2] === "clearimmunity") { ValeriaBot.message.module.silence.clearAllImmuneUsers(); } if (aryArg[2] === "showimmune") { ValeriaBot.message.module.silence.showImmuneUsers(oMsg, bIsRoomCreator); } if (aryArg[2] === "addspecialgrey") { if (aryArg[3] !== undefined) { if (aryArg[3] !== "") { ValeriaBot.message.module.silence.addSpecialGreyUser(aryArg[3]); } } } if (aryArg[2] === "removespecialgrey") { if (aryArg[3] !== undefined) { if (aryArg[3] !== "") { ValeriaBot.message.module.silence.removeSpecialGreyUser(aryArg[3]); } } } if (aryArg[2] === "clearspecialgreys") { ValeriaBot.message.module.silence.clearAllSpecialGreyUsers(); } if (aryArg[2] === "showspecialgreys") { ValeriaBot.message.module.silence.showSpecialGreyUsers(oMsg, bIsRoomCreator); } if (aryArg[2] === "exportspecialgreys") { ValeriaBot.message.module.silence.exportSpecialGreyUsers(oMsg, bIsRoomCreator); } if (aryArg[2] === "exportimmuneusers") { ValeriaBot.message.module.silence.exportImmuneUsers(oMsg, bIsRoomCreator); } if (aryArg[2] === "stats") { ValeriaBot.message.module.silence.stats(oMsg, bIsRoomCreator); } } else { ValeriaBot.message.module.silence.showHelp(oMsg, bIsRoomCreator); } }, onMessage: function (oMsg, bIsRoomCreator) { /** * Silence Module OnMessage * @method onMessage */ //cb.sendNotice("ValeriaBot Silence onMessage Called.", "", "", "#990037", "", ""); var bIsMod = oMsg.is_mod; var arySilenceLevel = ValeriaBot.message.module.silence.getSilenceLevel(); var oSilencedUsers = ValeriaBot.message.module.silence.getSilencedUsers(); var bUserIsSilenced = false; var bDebuggingEnabled = ValeriaBot.message.module.debug.getEnabled(); if (oSilencedUsers[oMsg.user] !== undefined) { bUserIsSilenced = true; } if ((bIsMod === false && bIsRoomCreator === false) || bDebuggingEnabled === true) { if (arySilenceLevel.length > 0) { if (bUserIsSilenced === false) { // don't waste cycles if they're already silenced if (oMsg.in_fanclub === true) { ValeriaBot.message.module.silence.addImmuneUser(oMsg.user); } else { ValeriaBot.message.module.silence.statsUpdateMessagesTotal(); } for (var i = 0; i < arySilenceLevel.length; i++) { oMsg = ValeriaBot.message.module.silence[arySilenceLevel[i]](oMsg, bIsRoomCreator); } } } } if (bUserIsSilenced === true) { oMsg.m = "Your message was not shown because you've been silenced."; oMsg["X-Spam"] = true; } return oMsg; }, onEnter: function (oUser, bIsRoomCreator) { if (oUser.in_fanclub === true) { ValeriaBot.message.module.silence.addImmuneUser(oUser.user, oUser, bIsRoomCreator); } }, onLeave: function (oUser, bIsRoomCreator) { // tbd }, onTip: function (oTip, bIsRoomCreator) { // tbd }, init: function () { /** * Silence Module Init * @method init */ var fncPostInit = function () { var fncInitCompleteMsg = function () { cb.sendNotice("Initialization Complete. ValeriaBot activated!", "", "", "#990037", "", ""); }; var fncInitAddVipMembers = function () { var oVipMembers = ValeriaBot.message.module.vip.getMembers(); var sRegularsMsg = ""; for (var user in oVipMembers.users) { if (oVipMembers.users.hasOwnProperty(user)) { for (var key in oVipMembers.users[user].userclasses) { if (oVipMembers.users[user].userclasses.hasOwnProperty(key)) { if (key.indexOf("regular") !== -1) { ValeriaBot.message.module.silence.addImmuneUser(user, undefined, undefined, true); sRegularsMsg = sRegularsMsg + user + "; "; } } } } } cb.sendNotice("VIP Regulars added to bot silence list (only broadcaster and mods see the list).", "", "", "#990037", "", ""); cb.sendNotice(sRegularsMsg, "", "", "#990037", "", "red"); cb.sendNotice(sRegularsMsg, cb.room_slug, "", "#990037", "", ""); cb.setTimeout(fncInitAddSpecialGreys, 1000); }; var fncInitAddSpecialGreys = function () { var arySpecialGreys; var sSpecialGreys; var s = ""; if (cb.settings.silence_specialgreys !== undefined) { if (cb.settings.silence_specialgreys !== "") { sSpecialGreys = cb.settings.silence_specialgreys.trim(); // remove leading and trailing spaces sSpecialGreys = sSpecialGreys.replace(/\s+/g, " "); // remove repeating spaces //sSpecialGreys = sSpecialGreys.replace(/(^\s*,)|(,\s*$)/g, ""); // remove leading and trailing commas and normalize whitespace arySpecialGreys = sSpecialGreys.split(" "); for (var i=0; i<arySpecialGreys.length; i++) { ValeriaBot.message.module.silence._oSpecialGreyUsers[arySpecialGreys[i]] = true; s = s + arySpecialGreys[i] + "; "; } } } cb.sendNotice("Special Greys added (only broadcaster and mods see the list).", "", "", "#990037", "", ""); cb.sendNotice(s, "", "", "#990037", "", "red"); cb.sendNotice(s, cb.room_slug, "", "#990037", "", ""); cb.setTimeout(fncInitCompleteMsg, 1000); }; cb.setTimeout(fncInitAddVipMembers, 1000); }; var arySpecialGreys = ["pinhoodwarrior"]; var sSpecialGreys = arySpecialGreys.join(" "); var sSilenceEnabled = "on"; if (cb.settings_choices === undefined) { cb.settings_choices = []; } cb.settings_choices.push( { name:"silence_enabled", type:"choice", choice1:"Yes", choice2:"No", defaultValue:"Yes", required: true, label: "[SILENCE MODULE] ........................................................... Enable?" }, { name:"silence_spam_enabled", type:"choice", choice1:"Yes", choice2:"No", defaultValue:"Yes", required: true, label: "Enable Spam Silencing?" }, { name:"silence_watchcam_enabled", type:"choice", choice1:"Yes", choice2:"No", defaultValue:"Yes", required: true, label: "Enable 'Watch My Cam' Silencing?" }, { name:"silence_demands_enabled", type:"choice", choice1:"Yes", choice2:"No", defaultValue:"Yes", required: true, label: "Enable Demands Silencing?" }, { name:"silence_greys_enabled", type:"choice", choice1:"Yes", choice2:"No", defaultValue:"No", required: true, label: "Enable Greys Silencing?" }, { name:"silence_specialgreys_enabled", type:"choice", choice1:"Yes", choice2:"No", defaultValue:"Yes", required: true, label: "Enable Special Greys (Can speak when greys are silenced)?" }, { name: "silence_specialgreys", type: "str", defaultValue: sSpecialGreys, required: false, label: "Speical Greys (single space separated list)" }); ValeriaBot.message.module.silence._iStatsMessagesTotal = 0; ValeriaBot.message.module.silence._iStatsMessagesSilenced = 0; ValeriaBot.message.module.silence._iStatsMessagesUnsilenced = 0; ValeriaBot.message.module.silence._oSpecialGreyUsers = {}; ValeriaBot.message.module.silence._oImmuneUsers = {}; ValeriaBot.message.module.silence._bDebugEnabled = false; ValeriaBot.message.module.silence._sLastSilencedUser = {}; ValeriaBot.message.module.silence._aryCurrentSilenceLevels = []; ValeriaBot.message.module.silence._oSilencedUsers = {}; if (cb.settings.silence_enabled === "Yes") { sSilenceEnabled = "on"; } else { sSilenceEnabled = "off"; } ValeriaBot.message.module.silence.setSilenceLevel(["/ValeriaBot", "silence", sSilenceEnabled]); // default on bot load if (cb.settings.silence_demands_enabled === "Yes") { ValeriaBot.message.module.silence.setSilenceDemandsEnabled(true); } else { ValeriaBot.message.module.silence.setSilenceDemandsEnabled(false); } if (cb.settings.silence_spam_enabled === "Yes") { ValeriaBot.message.module.silence.setSilenceSpamEnabled(true); } else { ValeriaBot.message.module.silence.setSilenceSpamEnabled(false); } if (cb.settings.silence_watchcam_enabled === "Yes") { ValeriaBot.message.module.silence.setSilenceWatchcamEnabled(true); } else { ValeriaBot.message.module.silence.setSilenceWatchcamEnabled(false); } if (cb.settings.silence_greys_enabled === "Yes") { ValeriaBot.message.module.silence.setSilenceGreysEnabled(true); } else { ValeriaBot.message.module.silence.setSilenceGreysEnabled(false); } cb.setTimeout(fncPostInit, 2000); } }, vip: { showHelp: function (oMsg, bIsRoomCreator) { var s = "________________________________________\nValeriaBot VIP Module:\n/ValeriaBot vip <on/off> \n/ValeriaBot vip addmember <member name>\n/ValeriaBot vip removemember <member name>\n/ValeriaBot vip show\n/ValeriaBot vip settheme <theme>\n/ValeriaBot vip disableicons\n/ValeriaBot vip enableicons\n/ValeriaBot vip wishhbd (wishest a happy birthday to anyone bot has info about if today is their bday)\n/ValeriaBot vip wishhbdenabed <on/off>\n________________________________________"; if (bIsRoomCreator === true) { cb.sendNotice(s, oMsg.user, "", "#990037", "", ""); // Send to Room Creator } else { if (bIsMod === true) { cb.sendNotice(s, "", "", "#990037", "", "red"); // Send to Mods } } }, decorateText: function (oMsg, bIsRoomCreator) { return oMsg; }, decorateGifs: function (oMsg, bIsRoomCreator) { return oMsg; }, showMembers: function (aryArg) { /** * VIP Module ShowMembers * @method showVipMembers */ var s = ""; var o = ValeriaBot.message.module.vip.getMembers().users; if (ValeriaBot.message.module.vip.getEnabled() === true) { s = s + "________________________________________\n"; s = s + "ValeriaBot VIP Members:\n"; for (var key in o) { if (o.hasOwnProperty(key)) { s = s + key+"\n"; } } s = s + "________________________________________\n"; cb.sendNotice(s, "", "", "#990037", "", ""); } }, getMembers: function () { var o = ValeriaBot.message.module.vip._oVipMembers; return o; }, getThemeId: function () { var s = ValeriaBot.message.module.vip._sThemeId; return s; }, getIsBirthday: function (oMsg, sUser) { var today = new Date(); var dd = parseInt(today.getDate()); var mm = parseInt(today.getMonth()+1); // January is 0! var yyyy = parseInt(today.getFullYear()); var oVipMembers = ValeriaBot.message.module.vip.getMembers(); var sBirthdate; var bResult = false; if (sUser === undefined) { sUser = oMsg.user; } if (oVipMembers.users[sUser] !== undefined) { if (oVipMembers.users[sUser].basic !== undefined) { if (oVipMembers.users[sUser].basic.birth_date !== undefined) { if (oVipMembers.users[sUser].basic.birth_date !== "") { sBirthdate = oVipMembers.users[sUser].basic.birth_date; } } } } if (sBirthdate !== undefined) { if (parseInt(sBirthdate.substr(5,2)) === mm) { if (parseInt(sBirthdate.substr(8,2)) === dd) { bResult = true; } } } return bResult; }, wishHbd: function () { cb.sendNotice("", "", "", "#990037", "", ""); cb.sendNotice("ValeriaBot notices it's Valeria_arango’s birthday! ValeriaBot make pretty drawing present. Hope Valeria like!", "", "", "#990037", "", ""); cb.sendNotice(".........................HAPPY BIRTHDAY, MASTER!.........................", "", "", "#F830FF", "", ""); cb.sendNotice(".!!!!!!!!.........................................................................!!!!!!!.", "", "", "#990037", "", ""); cb.sendNotice(".!!!!!!!!!!!!!!!!!!!!.................................................!!!!!!!!!!!!!!!!!!!.", "", "", "#990037", "", ""); cb.sendNotice("..!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!..!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!.", "", "", "#990037", "", ""); cb.sendNotice("..!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!..", "", "", "#990037", "", ""); cb.sendNotice("...!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!...", "", "", "#990037", "", ""); cb.sendNotice(".....!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!.....", "", "", "#990037", "", ""); cb.sendNotice(".......!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!.......", "", "", "#990037", "", ""); cb.sendNotice("..........!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!.........", "", "", "#990037", "", ""); cb.sendNotice("........!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!...........", "", "", "#990037", "", ""); cb.sendNotice(".......!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!..........", "", "", "#990037", "", ""); cb.sendNotice(".......!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!.......!!!!!!!!!!!!!!!!!!.........", "", "", "#990037", "", ""); cb.sendNotice("......!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!.................!!!!!!!!!!!!!!!!.........", "", "", "#990037", "", ""); cb.sendNotice("......!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!...........!!!!!!!!!!!!!!!..!!!!!!!!!!!!!!!........", "", "", "#990037", "", ""); cb.sendNotice("......!!!!!!!!!!!!!!!!.......!!!!!!....................!!!!!!!.......!!!!!!!!!!!!!........", "", "", "#990037", "", ""); cb.sendNotice("......!!!!!!!!!!!!!!!!!..!!!!!!!!..!!!!!...........!!!!!!!!!..!!!!..!!!!!!!!!!!!!!........", "", "", "#990037", "", ""); cb.sendNotice(".......!!!!!!!!!!!!!!!!!...!!!!!!!!!!.................!!!!!!!!!....!!!!!!!!!!!!!!!........", "", "", "#990037", "", ""); cb.sendNotice(".......!!!!!!!!!!!!!!!!!!.........................................!!!!!!!!!!!!!!!!........", "", "", "#990037", "", ""); cb.sendNotice("........!!!!!!!!!!!!!!!!!!!.....................................!!!!!!!!!!!!!!!!!!........", "", "", "#990037", "", ""); cb.sendNotice("........!!!!!!!!!!!!!!!!!!!!!.............!.....!.............!!!!!!!!!!!!!!!!!!!.........", "", "", "#990037", "", ""); cb.sendNotice(".........!!!!!!!!!!!!!!!!!!!!!!!!........!!!!!!!!!........!!!!!!!!!!!!!!!!!!!!!!!.........", "", "", "#990037", "", ""); cb.sendNotice(".........!!!!!!!!!!!!!!!!!!!!!!!!!!!!!...............!!!!!!!!!!!!!!!!!!!!!!!!!!!..........", "", "", "#990037", "", ""); cb.sendNotice("..........!!!!!!!!!!!!!!!!!!!!!!.....!!!!!!!!!!!!!!!!!....!!!!!!!!!!!!!!!!!!!!!!..........", "", "", "#990037", "", ""); cb.sendNotice("...........!!!!!!!!!!!!!!!!!!!!!...........................!!!!!!!!!!!!!!!!!!!!...........", "", "", "#990037", "", ""); cb.sendNotice("............!!!!!!!!!!!!!!!!!!!.............................!!!!!!!!!!!!!!!!!!............", "", "", "#990037", "", ""); cb.sendNotice("..............!!!!!!!!!!!!........................................!!!!!!!!!!!.............", "", "", "#990037", "", ""); cb.sendNotice(".....HAPPY BIRTHDAY! HAPPY BIRTHDAY! HAPPY BIRTHDAY!.....", "", "", "#F830FF", "", ""); cb.sendNotice("........................VALERIABOT LOVES VALERIA!........................", "", "", "#F830FF", "", ""); cb.sendNotice("", "", "", "#990037", "", ""); }, initWishHbdChecking: function () { var bWishHbdEnabled = ValeriaBot.message.module.vip.getWishHbdEnabled(); var fncInitCheckForBrodcasterBirthday = function () { var bWishHbdEnabled = ValeriaBot.message.module.vip.getWishHbdEnabled(); var bIsBirthday = ValeriaBot.message.module.vip.getIsBirthday(undefined, "Valeria"); if (bWishHbdEnabled === true) { if (bIsBirthday === true) { ValeriaBot.message.module.vip.wishHbd(); cb.setTimeout(fncInitCheckForBrodcasterBirthday, 1000 * 60 * 60 * 4); // show bday message every 4 hours } else { cb.setTimeout(fncInitCheckForBrodcasterBirthday, 60000); // check if it's bday every minute } } }; if (bWishHbdEnabled === true) { cb.setTimeout(fncInitCheckForBrodcasterBirthday, 10000); } }, setThemeId: function (aryArg) { if (aryArg[3] !== undefined) { cb.sendNotice("ValeriaBot set VIP theme to "+aryArg[3]+".", "", "", "#990037", "", ""); ValeriaBot.message.module.vip._sThemeId = aryArg[3]; } }, addMember: function (oMsg, aryArg) { if (aryArg !== undefined) { if (aryArg[3] !== undefined) { ValeriaBot.message.module.vip._oVipMembers.users[aryArg[3]] = {}; cb.sendNotice("ValeriaBot added "+aryArg[3]+" to VIP member list.", "", "", "#990037", "", ""); } } }, removeMember: function (oMsg, aryArg) { if (aryArg[3] !== undefined) { cb.sendNotice("ValeriaBot removed VIP member "+aryArg[3]+".", "", "", "#990037", "", ""); delete ValeriaBot.message.module.vip._oVipMembers.users[aryArg[3]]; } }, setEnabled: function (bEnabled) { if(bEnabled === true){ cb.sendNotice("ValeriaBot VIP Module On.", "", "", "#990037", "", ""); } if(bEnabled === false){ cb.sendNotice("ValeriaBot VIP Module Off.", "", "", "#990037", "", ""); } ValeriaBot.message.module.vip._bEnabled = bEnabled; }, getEnabled: function () { return ValeriaBot.message.module.vip._bEnabled; }, setWishHbdEnabled: function (bEnabled) { if(bEnabled === true){ cb.sendNotice("ValeriaBot VIP Module Wish Hbd On.", "", "", "#990037", "", ""); ValeriaBot.message.module.vip._bWishHbdEnabled = bEnabled; ValeriaBot.message.module.vip.initWishHbdChecking(); } if(bEnabled === false){ ValeriaBot.message.module.vip._bWishHbdEnabled = bEnabled; cb.sendNotice("ValeriaBot VIP Module Wish Hbd Off.", "", "", "#990037", "", ""); } }, getWishHbdEnabled: function () { return ValeriaBot.message.module.vip._bWishHbdEnabled; }, setIconsEnabled: function (bEnabled) { if(bEnabled === true){ cb.sendNotice("ValeriaBot VIP Module Icons On.", "", "", "#990037", "", ""); } if(bEnabled === false){ cb.sendNotice("ValeriaBot VIP Module Icons Off.", "", "", "#990037", "", ""); } ValeriaBot.message.module.vip._bIconsEnabled = bEnabled; }, getIconsEnabled: function () { return ValeriaBot.message.module.vip._bIconsEnabled; }, onMessage: function (aryArg, oMsg, bIsRoomCreator) { var oVipMembers = ValeriaBot.message.module.vip.getMembers(); var sConcat = ""; var sThemeId = ValeriaBot.message.module.vip.getThemeId(); var bMatchedAClass = false; var bIsAnAddedUser = false; var sWelcomeColor = "#dd11dd"; var bIconsEnabled = ValeriaBot.message.module.vip.getIconsEnabled(); if (aryArg !== undefined) { if (aryArg[2] !== undefined) { if (aryArg[2] === "on") { ValeriaBot.message.module.vip.setEnabled(true); } if (aryArg[2] === "off") { ValeriaBot.message.module.vip.setEnabled(false); } if (aryArg[2] === "addmember") { ValeriaBot.message.module.vip.addMember(oMsg, aryArg); } if (aryArg[2] === "removemember") { ValeriaBot.message.module.vip.removeMember(oMsg, aryArg); } if (aryArg[2] === "show") { ValeriaBot.message.module.vip.showMembers(aryArg); } if (aryArg[2] === "settheme") { ValeriaBot.message.module.vip.setThemeId(aryArg); } if (aryArg[2] === "disableicons") { ValeriaBot.message.module.vip.setIconsEnabled(false); } if (aryArg[2] === "enableicons") { ValeriaBot.message.module.vip.setIconsEnabled(true); } if (aryArg[2] === "wishhbd") { ValeriaBot.message.module.vip.wishHbd(); } if (aryArg[2] === "wishhbdenabled") { if (aryArg[3] !== undefined) { if (aryArg[3] === "on") { ValeriaBot.message.module.vip.setWishHbdEnabled(true); } if (aryArg[3] === "off") { ValeriaBot.message.module.vip.setWishHbdEnabled(false); } } } } else { ValeriaBot.message.module.vip.showHelp(oMsg, bIsRoomCreator); } } if (ValeriaBot.message.module.vip.getEnabled() === true) { if (oMsg !== undefined) { if (oVipMembers.users[oMsg.user] !== undefined) { if (oVipMembers.users[oMsg.user].nominal.decorations.theme[sThemeId].gifs.nominal !== undefined) { if (oVipMembers.users[oMsg.user].nominal.decorations.theme[sThemeId].gifs.nominal !== "") { if (bIconsEnabled === true) { sConcat = sConcat + oVipMembers.users[oMsg.user].nominal.decorations.theme[sThemeId].gifs.nominal + " "; } } } if (oVipMembers.users[oMsg.user].nominal.decorations.theme[sThemeId].text.nominal !== "") { oMsg.c = oVipMembers.users[oMsg.user].nominal.decorations.theme[sThemeId].text.nominal; } bMatchedAClass = true; bIsAnAddedUser = true; } if (bIsRoomCreator === true) { if (bIconsEnabled === true) { sConcat = sConcat + oVipMembers.userclasses.standard.roomcreator.nominal.decorations.theme[sThemeId].gifs.nominal + " "; } oMsg.c = oVipMembers.userclasses.standard.roomcreator.nominal.decorations.theme[sThemeId].text.nominal; bMatchedAClass = true; } if (oMsg.is_mod === true) { sWelcomeColor == "#dc0000"; if (bIconsEnabled === true) { sConcat = sConcat + oVipMembers.userclasses.standard.mod.nominal.decorations.theme[sThemeId].gifs.nominal + " "; } oMsg.c = oVipMembers.userclasses.standard.roomcreator.nominal.decorations.theme[sThemeId].text.nominal; bMatchedAClass = true; } if (oMsg.in_fanclub === true) { sWelcomeColor == "#11dd11"; if (bIconsEnabled === true) { sConcat = sConcat + oVipMembers.userclasses.standard.fanclubmember.nominal.decorations.theme[sThemeId].gifs.nominal + " "; } oMsg.c = oVipMembers.userclasses.standard.roomcreator.nominal.decorations.theme[sThemeId].text.nominal; bMatchedAClass = true; } if (oVipMembers.users[oMsg.user] !== undefined) { for (var key in oVipMembers.users[oMsg.user].userclasses) { if (oVipMembers.users[oMsg.user].userclasses.hasOwnProperty(key)) { if (key !== "roomcreator" && key !== "mod" && key !== "fanclubmember") { // since we already concatinated these icons should they exist if (oVipMembers.userclasses.standard[key] !== undefined) { if (bIconsEnabled === true) { sConcat = sConcat + oVipMembers.userclasses.standard[key].nominal.decorations.theme[sThemeId].gifs.nominal + " "; } if (oVipMembers.userclasses.standard[key].nominal.decorations.theme[sThemeId].text.nominal !== "") { oMsg.c = oVipMembers.userclasses.standard[key].nominal.decorations.theme[sThemeId].text.nominal; } } if (oVipMembers.userclasses.rpg[key] !== undefined) { if (bIconsEnabled === true) { sConcat = sConcat + oVipMembers.userclasses.rpg[key].nominal.decorations.theme[sThemeId].gifs.nominal + " "; } if (oVipMembers.userclasses.rpg[key].nominal.decorations.theme[sThemeId].text.nominal !== "") { oMsg.c = oVipMembers.userclasses.rpg[key].nominal.decorations.theme[sThemeId].text.nominal; } } } } } } if (bMatchedAClass === true) { oMsg.m = sConcat+oMsg.m; if (bIsAnAddedUser === true) { // If true, their custom user profile will overrider any other chat color defaults. if (oVipMembers.users[oMsg.user].nominal.decorations.theme[sThemeId].text.nominal !== "") { oMsg.c = oVipMembers.users[oMsg.user].nominal.decorations.theme[sThemeId].text.nominal; } } } } } return oMsg; }, onEnter: function (oUser, bIsRoomCreator) { var bMatchedAClass = false; var sConcat = ""; var sClass = ""; var sWelcomeColor = "#dd11dd"; var oVipMembers = ValeriaBot.message.module.vip.getMembers(); if (ValeriaBot.message.module.vip.getEnabled() === true) { if (oUser !== undefined) { if (bIsRoomCreator === true) { sConcat = sConcat + ", room creator"; var bMatchedAClass = true; } if (oUser.is_mod === true) { sWelcomeColor = "#dc0000"; sConcat = sConcat + ", moderator"; var bMatchedAClass = true; } if (oUser.in_fanclub === true) { var sWelcomeColor = "#11dd11"; sConcat = sConcat + ", fanclub member"; var bMatchedAClass = true; } if (oVipMembers.users[oUser.user] !== undefined) { for (var key in oVipMembers.users[oUser.user].userclasses) { if (oVipMembers.users[oUser.user].userclasses.hasOwnProperty(key)) { if (key !== "roomcreator" && key !== "mod" && key !== "fanclubmember") { // since we already concatinated these icons should they exist if (oVipMembers.userclasses.standard[key] !== undefined) { var bMatchedAClass = true; if (key === "hightipperlevel5") { sClass = "high tipper level 5"; } if (key === "hightipperlevel4") { sClass = "high tipper level 4"; } if (key === "hightipperlevel3") { sClass = "high tipper level 3"; } if (key === "hightipperlevel2") { sClass = "high tipper level 2"; } if (key === "hightipperlevel1") { sClass = "high tipper level 1"; } if (key === "regularlevel3") { sClass = "regular level 3"; } if (key === "regularlevel2") { sClass = "regular level 2"; } if (key === "regularlevel1") { sClass = "regular level 1"; } sConcat = sConcat + ", "+sClass; } if (oVipMembers.userclasses.rpg[key] !== undefined) { var bMatchedAClass = true; if (key === "villager") { sClass = "villager"; } if (key === "merchant") { sClass = "marchant"; } sConcat = sConcat + ", "+sClass; } } } } } if (bMatchedAClass === true) { cb.sendNotice("ValeriaBot acknowledges "+oUser.user+". Welcome"+sConcat+"!", "", sWelcomeColor, "#ffffff", "", ""); } } } }, onLeave: function (oUser, bIsRoomCreator) { // tbd }, onTip: function (oTip, bIsRoomCreator) { // tbd }, init: function () { var oTippers; /* * Hardcoded VIP Members, for now */ ValeriaBot.message.module.vip._oVipMembers = { userclasses: { standard: { "roomcreator": { nominal: { decorations: { theme: { generic: { text: { nominal: "#DC5500" }, gifs: { nominal: ":ValeriaBot_i_std_rc_n_gen_n_r2", arrival: "", exit: "", tipped: "" } } } } } }, "mod": { nominal: { decorations: { theme: { generic: { text: { nominal: "#DC0000" }, gifs: { nominal: ":ValeriaBot_i_std_mod_n_gen_n_r1", arrival: "", exit: "", tipped: "" } } } } } }, "fanclubmember": { nominal: { decorations: { theme: { generic: { text: { nominal: "#11dd11" }, gifs: { nominal: ":ValeriaBot_i_std_fcm_n_gen_n_r1", arrival: "", exit: "", tipped: "" } } } } } }, "hightipperlevel5": { nominal: { decorations: { theme: { generic: { text: { nominal: "" }, gifs: { nominal: ":ValeriaBot_i_std_ht5_n_gen_n_r1", arrival: "", exit: "", tipped: "" } } } } } }, "hightipperlevel4": { nominal: { decorations: { theme: { generic: { text: { nominal: "" }, gifs: { nominal: ":ValeriaBot_i_std_ht4_n_gen_n_r1", arrival: "", exit: "", tipped: "" } } } } } }, "hightipperlevel3": { nominal: { decorations: { theme: { generic: { text: { nominal: "" }, gifs: { nominal: ":ValeriaBot_i_std_ht3_n_gen_n_r1", arrival: "", exit: "", tipped: "" } } } } } }, "hightipperlevel2": { nominal: { decorations: { theme: { generic: { text: { nominal: "" }, gifs: { nominal: ":ValeriaBot_i_std_ht2_n_gen_n_r1", arrival: "", exit: "", tipped: "" } } } } } }, "hightipperlevel1": { nominal: { decorations: { theme: { generic: { text: { nominal: "" }, gifs: { nominal: ":ValeriaBot_i_std_ht1_n_gen_n_r1", arrival: "", exit: "", tipped: "" } } } } } }, "regularlevel3": { nominal: { decorations: { theme: { generic: { text: { nominal: "" }, gifs: { nominal: ":ValeriaBot_i_std_reg3_n_gen_n_r1", arrival: "", exit: "", tipped: "" } } } } } }, "regularlevel2": { nominal: { decorations: { theme: { generic: { text: { nominal: "" }, gifs: { nominal: ":ValeriaBot_i_std_reg2_n_gen_n_r1", arrival: "", exit: "", tipped: "" } } } } } }, "regularlevel1": { nominal: { decorations: { theme: { generic: { text: { nominal: "" }, gifs: { nominal: ":ValeriaBot_i_std_reg1_n_gen_n_r1", arrival: "", exit: "", tipped: "" } } } } } } }, rpg: { "villager": { nominal: { decorations: { theme: { generic: { text: { nominal: "" }, gifs: { nominal: ":ValeriaBot_i_rpg_vil_n_gen_n_r1", arrival: "", exit: "", tipped: "" } } } } } }, "merchant": { nominal: { decorations: { theme: { generic: { text: { nominal: "" }, gifs: { nominal: ":ValeriaBot_i_rpg_mer_n_gen_n_r1", arrival: "", exit: "", tipped: "" } } } } } } } }, users: { "Valeria": { basic: { birth_date: "1996/05/16" }, userclasses: { roomcreator : { date_aquired : "2015/07/01" } }, nominal: { decorations: { theme: { generic: { text: { nominal: "#DC5500" }, gifs: { nominal: "ValeriaBot_i_u_Valeria_n_gen_n_r1", arrival: "", exit: "", tipped: "" } } } } } }, "sypunk": { userclasses: { mod: { date_aquired: "2016.03.01" } }, nominal: { decorations: { theme: { generic: { text: { nominal: "#DC0000" }, gifs: { nominal: "", arrival: "", exit: "", tipped: "" } } } } } }, "fuckme_mermaid": { userclasses: { regularlevel2: { date_aquired: "2016.04.12" } }, nominal: { decorations: { theme: { generic: { text: { nominal: "#888800" }, gifs: { nominal: "", arrival: "", exit: "", tipped: "" } } } } } }, "nell55": { userclasses: { regularlevel3: { date_aquired: "2016.04.12" } }, nominal: { decorations: { theme: { generic: { text: { nominal: "#1111ff" }, gifs: { nominal: "", arrival: "", exit: "", tipped: "" } } } } } }, "clitluv4u": { userclasses: { regularlevel1: { date_aquired: "2016.04.12" } }, nominal: { decorations: { theme: { generic: { text: { nominal: "" }, gifs: { nominal: "", arrival: "", exit: "", tipped: "" } } } } } }, "sid1dartha": { userclasses: { regularlevel1: { date_aquired: "2016.04.12" } }, nominal: { decorations: { theme: { generic: { text: { nominal: "" }, gifs: { nominal: "", arrival: "", exit: "", tipped: "" } } } } } }, "freemarketcoder": { userclasses: { regularlevel1: { date_aquired: "2016.04.12" } }, nominal: { decorations: { theme: { generic: { text: { nominal: "" }, gifs: { nominal: "", arrival: "", exit: "", tipped: "" } } } } } }, "kdbuu": { userclasses: { regularlevel1: { date_aquired: "2016.04.12" } }, nominal: { decorations: { theme: { generic: { text: { nominal: "" }, gifs: { nominal: "", arrival: "", exit: "", tipped: "" } } } } } }, "vedantaman": { userclasses: { regularlevel1: { date_aquired: "2016.04.12" } }, nominal: { decorations: { theme: { generic: { text: { nominal: "" }, gifs: { nominal: "", arrival: "", exit: "", tipped: "" } } } } } }, "squidmaster": { userclasses: { regularlevel1: { date_aquired: "2016.05.16" } }, nominal: { decorations: { theme: { generic: { text: { nominal: "" }, gifs: { nominal: "", arrival: "", exit: "", tipped: "" } } } } } }, "perfectfool_disabled": { userclasses: { regularlevel1: { date_aquired: "2016.03.01" }, botmod: { date_aquired: "2016.05.23" } }, nominal: { decorations: { theme: { generic: { text: { nominal: "#dc0000" }, gifs: { nominal: "", arrival: "", exit: "", tipped: "" } } } } } } } }; //var fncPostInit = function () { //}; //cb.setTimeout(fncPostInit, 1000); if (cb.settings_choices === undefined) { cb.settings_choices = []; } cb.settings_choices.push( { name:"vip_enabled", type:"choice", choice1:"Yes", choice2:"No", defaultValue:"Yes", required: true, label: "[VIP MODULE] .................................................................... Enable?" }, { name:"vip_icons_enabled", type:"choice", choice1:"Yes", choice2:"No", defaultValue:"No", required: true, label: "Enable Icons?" }, { name:"vip_wishhbd_enabled", type:"choice", choice1:"Yes", choice2:"No", defaultValue:"No", required: true, label: "Enable Wish Happy Birthdays?" }); if (cb.settings.vip_wishhbd_enabled === "Yes") { ValeriaBot.message.module.vip.setWishHbdEnabled(true); } else { ValeriaBot.message.module.vip.setWishHbdEnabled(false); } if (cb.settings.vip_icons_enabled === "Yes") { ValeriaBot.message.module.vip.setIconsEnabled(true); } else { ValeriaBot.message.module.vip.setIconsEnabled(false); } if (cb.settings.vip_enabled === "Yes") { ValeriaBot.message.module.vip.setEnabled(true); } else { ValeriaBot.message.module.vip.setEnabled(false); } ValeriaBot.message.module.vip._sThemeId = "generic"; // default //if (ValeriaBot.message.module.tips !== undefined) { // If Tips module is installed // oTippers = ValeriaBot.message.module.tips.getTippers().users; //} } }, notifier: { showHelp: function (oMsg, bIsRoomCreator) { var s = "________________________________________\nValeriaBot Notifier Module:\n/ValeriaBot notifier <on/off>\n/ValeriaBot notifier adduser <user>\n________________________________________"; if (bIsRoomCreator === true) { cb.sendNotice(s, oMsg.user, "", "#990037", "", ""); // Send to Room Creator } else { if (bIsMod === true) { cb.sendNotice(s, "", "", "#990037", "", "red"); // Send to Mods } } }, showUsers: function (aryArg) { /** * Notifier Module ShowUsers * @method showUsers */ var o = ValeriaBot.message.module.notifier.getUsers(); cb.sendNotice("________________________________________", "", "", "#990037", "", ""); cb.sendNotice("ValeriaBot Notifier Users:", "", "", "#990037", "", ""); for (var key in o) { if (o.hasOwnProperty(key)) { cb.sendNotice(key, "", "", "#990037", "bold", ""); } } cb.sendNotice("________________________________________", "", "", "#990037", "", ""); }, getUsers: function () { var o = ValeriaBot.message.module.notifier._oUsers; return o; }, addUser: function (oMsg, aryArg) { if (aryArg !== undefined) { if (aryArg[3] !== undefined) { ValeriaBot.message.module.notifier._oUsers[aryArg[3]] = {}; cb.sendNotice("ValeriaBot added "+aryArg[3]+" to Notifier module user list.", "", "", "#990037", "", ""); } } }, removeUser: function (oMsg, aryArg) { if (aryArg[3] !== undefined) { cb.sendNotice("ValeriaBot removed Notifier module user "+aryArg[3]+".", "", "", "#990037", "", ""); delete ValeriaBot.message.module.notifier._oUsers[aryArg[3]]; } }, setEnabled: function (bEnabled) { if(bEnabled === true){ cb.sendNotice("ValeriaBot Notifier Module On.", "", "", "#990037", "", ""); } if(bEnabled === false){ cb.sendNotice("ValeriaBot Notifier Module Off.", "", "", "#990037", "", ""); } ValeriaBot.message.module.notifier._bEnabled = bEnabled; }, getEnabled: function () { return ValeriaBot.message.module.notifier._bEnabled; }, onMessage: function (aryArg, oMsg, bIsRoomCreator) { var oUsers = ValeriaBot.message.module.notifier.getUsers(); var sConcat = ""; if (aryArg !== undefined) { if (aryArg[2] !== undefined) { if (aryArg[2] === "on") { ValeriaBot.message.module.notifier.setEnabled(true); } if (aryArg[2] === "off") { ValeriaBot.message.module.notifier.setEnabled(false); } if (aryArg[2] === "adduser") { ValeriaBot.message.module.notifier.addUser(oMsg, aryArg); } if (aryArg[2] === "removeuser") { ValeriaBot.message.module.notifier.removeUser(oMsg, aryArg); } if (aryArg[2] === "show") { ValeriaBot.message.module.notifier.showUsers(aryArg); } } else { ValeriaBot.message.module.notifier.showHelp(oMsg, bIsRoomCreator); } } return oMsg; }, onEnter: function (oUser, bIsRoomCreator) { var oUsers = ValeriaBot.message.module.notifier.getUsers(); if (ValeriaBot.message.module.notifier.getEnabled() === true) { if (oUser !== undefined) { if (oUsers[oUser.user] !== undefined) { cb.sendNotice("ValeriaBot Notifier sees that User "+oUser.user+" has entered the room. Valeria wants to speak to you about something! Please listen for her to call your name. Thanks!", "", "#ffff00", "#000000", "bold", ""); } } } }, onLeave: function (oUser, bIsRoomCreator) { // tbd }, onTip: function (oTip, bIsRoomCreator) { // tbd }, init: function () { var fncPostInit = function () { var fncInitAddUsers = function () { var aryUsers; var sUsers; var s = ""; if (cb.settings.notifier_users !== undefined) { if (cb.settings.notifier_users !== "") { sUsers = cb.settings.notifier_users.trim(); // remove leading and trailing spaces sUsers = sUsers.replace(/\s+/g, " "); // remove repeating spaces aryUsers = sUsers.split(" "); for (var i=0; i<aryUsers.length; i++) { ValeriaBot.message.module.notifier._oUsers[aryUsers[i]] = true; s = s + aryUsers[i] + "; "; } } } cb.sendNotice("Notifier module users added (only broadcaster and mods see the list).", "", "", "#990037", "", ""); cb.sendNotice(s, "", "", "#990037", "", "red"); cb.sendNotice(s, cb.room_slug, "", "#990037", "", ""); }; cb.setTimeout(fncInitAddUsers, 1000); }; if (cb.settings_choices === undefined) { cb.settings_choices = []; } cb.settings_choices.push( { name:"notifier_enabled", type:"choice", choice1:"Yes", choice2:"No", defaultValue:"Yes", required: true, label: "[NOTIFIER MODULE] Alert when these users enter ...... Enable?" }, { name: "notifier_users", type: "str", defaultValue: "", required: false, label: "Users (single space separated list)" }); ValeriaBot.message.module.notifier._oUsers = {}; if (cb.settings.notifier_enabled === "Yes") { ValeriaBot.message.module.notifier.setEnabled(true); } else { ValeriaBot.message.module.notifier.setEnabled(false); } cb.setTimeout(fncPostInit, 1000); } }, tips: { showHelp: function (oMsg, bIsRoomCreator) { var s = "________________________________________\nValeriaBot Tips Module:\n/ValeriaBot tips <on/off>\n/ValeriaBot tips setuser <user> <amt>\n/ValeriaBot tips show\n/ValeriaBot tips showtop5\n/ValeriaBot tips showtop10\n/ValeriaBot tips showtipnotes (only room creator sees)\n________________________________________"; if (bIsRoomCreator === true) { cb.sendNotice(s, oMsg.user, "", "#990037", "", ""); // Send to Room Creator } else { if (bIsMod === true) { cb.sendNotice(s, "", "", "#990037", "", "red"); // Send to Mods } } }, showTipNotes: function (aryArg, oMsg, bIsRoomCreator) { /** * Tips Module ShowTipNotes * @method showTipNotes * Tip notes will only be seen by room creator! */ var s = ""; var o = ValeriaBot.message.module.tips.getTippers().users; var iTotal = 0; //cb.sendNotice(o.perfectfool.tipTotal, "", "", "#990037", "", ""); // Targets just the room creator! /* var o = { "tippera": {"tipTotal": 10, "tipNote": "Hi bb!"}, "tipperb": {"tipTotal": 100, "tipNote": "Yo bb!"}, "tipperc": {"tipTotal": 1000, "tipNote": "Sup bb!"}, "tipperd": {"tipTotal": 50, "tipNote": "Hello bb!"}, "tippere": {"tipTotal": 25, "tipNote": "Love you bb!"} }; */ if (ValeriaBot.message.module.tips.getEnabled() === true) { s = s + "________________________________________\n"; s = s + "ValeriaBot Show All Tip Notes and Totals:\n"; s = s + "(Only room creator sees this.)\n"; if (o !== undefined) { for (var key in o) { if (o.hasOwnProperty(key)) { if (o[key].tipTotal !== undefined) { s = s + key+" ["+o[key].tipTotal+"]: "; iTotal = iTotal + o[key].tipTotal; } if (o[key].tipNote !== undefined) { s = s + o[key].tipNote+"\n"; } else { s = s +"\n"; } } } s = s + "Total: "+iTotal+"\n"; s = s + "________________________________________\n"; if (bIsRoomCreator === true) { // Send tip note to room creator only! No one else sees it, not even mods. Ever! cb.sendNotice(s, oMsg.user, "", "#990037", "", ""); // Targets just the room creator! } } } }, showTippers: function (aryArg, oMsg, bIsRoomCreator) { /** * Tips Module ShowTippers * @method showTippers */ var s = ""; var o = ValeriaBot.message.module.tips.getTippers().users; var iTotal = 0; /* var o = { "tippera": {"tipTotal": 10, "tipNote": "Hi bb!"}, "tipperb": {"tipTotal": 100, "tipNote": "Yo bb!"}, "tipperc": {"tipTotal": 1000, "tipNote": "Sup bb!"}, "tipperd": {"tipTotal": 50, "tipNote": "Hello bb!"}, "tippere": {"tipTotal": 25, "tipNote": "Love you bb!"} }; */ if (ValeriaBot.message.module.tips.getEnabled() === true) { s = s + "________________________________________\n"; s = s + "ValeriaBot Show All Tippers' Totals:\n"; if (o !== undefined) { for (var key in o) { if (o.hasOwnProperty(key)) { if (o[key].tipTotal !== undefined) { s = s + key+": "+o[key].tipTotal+"\n"; iTotal = iTotal + o[key].tipTotal; } } } s = s + "Total: "+iTotal+"\n"; s = s + "________________________________________\n"; cb.sendNotice(s, "", "", "#990037", "", ""); } } }, showTopFiveTippers: function (aryArg, oMsg, bIsRoomCreator) { /** * Tips Module ShowTippers * @method showTippers */ var s = ""; var o = ValeriaBot.message.module.tips.getTippers().users; /* var o = { "tippera": {"tipTotal": 10, "tipNote": "Hi bb!"}, "tipperb": {"tipTotal": 100, "tipNote": "Yo bb!"}, "tipperf": {"tipTotal": 2, "tipNote": "Luv you bb!"}, "tipperc": {"tipTotal": 1000, "tipNote": "Sup bb!"}, "tipperd": {"tipTotal": 50, "tipNote": "Hello bb!"}, "tippere": {"tipTotal": 25, "tipNote": "Love you bb!"} }; */ var arySortable = []; var iMax = 5; if (ValeriaBot.message.module.tips.getEnabled() === true) { s = s + "________________________________________\n"; s = s + "ValeriaBot Show Top Five Tippers For Today\n"; for (var key in o) { if (o.hasOwnProperty(key)) { arySortable.push([key, o[key].tipTotal]); } } arySortable.sort(function(a, b) {return a[1] - b[1]}).reverse(); if (arySortable.length < 5) { iMax = arySortable.length; } for (var i = 0; i < iMax; i++) { s = s + arySortable[i][0]+": "+arySortable[i][1]+"\n"; } s = s + "________________________________________\n"; cb.sendNotice(s, "", "", "#990037", "", ""); } }, showTopTenTippers: function (aryArg, oMsg, bIsRoomCreator) { /** * Tips Module ShowTippers * @method showTippers */ var s = ""; var o = ValeriaBot.message.module.tips.getTippers().users; /* var o = { "tippera": {"tipTotal": 10, "tipNote": "Hi bb!"}, "tipperb": {"tipTotal": 100, "tipNote": "Yo bb!"}, "tipperf": {"tipTotal": 2, "tipNote": "Luv you bb!"}, "tipperc": {"tipTotal": 1000, "tipNote": "Sup bb!"}, "tipperd": {"tipTotal": 50, "tipNote": "Hello bb!"}, "tippere": {"tipTotal": 25, "tipNote": "Love you bb!"} }; */ var arySortable = []; var iMax = 10; if (ValeriaBot.message.module.tips.getEnabled() === true) { s = s + "________________________________________\n"; s = s + "ValeriaBot Show Top Ten Tippers For Today\n"; for (var key in o) { if (o.hasOwnProperty(key)) { arySortable.push([key, o[key].tipTotal]); } } arySortable.sort(function(a, b) {return a[1] - b[1]}).reverse(); if (arySortable.length < 5) { iMax = arySortable.length; } for (var i = 0; i < iMax; i++) { s = s + arySortable[i][0]+": "+arySortable[i][1]+"\n"; } s = s + "________________________________________\n"; cb.sendNotice(s, "", "", "#990037", "", ""); } }, getTippers: function (){ var o = ValeriaBot.message.module.tips._oTippers; return o; }, setTipAmount: function (oTip, aryArg, oMsg, bIsRoomCreator){ var iTipAmount = 0; var sPlural = ""; var sPunctuation = "."; var sExclamatory = ""; var oUsers = ValeriaBot.message.module.tips.getTippers().users; if (ValeriaBot.message.module.tips.getEnabled() === true) { if (aryArg !== undefined) { if (aryArg[3] !== undefined) { if (aryArg[4] !== undefined) { oUsers[aryArg[3]] = {tipTotal:parseInt(aryArg[4])}; cb.sendNotice("ValeriaBot set "+aryArg[3]+"'s tips total for today to "+aryArg[4]+" via moderator "+oMsg.user+".", "", "", "#990037", "", ""); } } } if (oTip !== undefined) { if (oTip.amount !== undefined) { iTipAmount = parseInt(oTip.amount); if (iTipAmount > 1) { sPlural = "s"; } if (iTipAmount >= 49 && iTipAmount < 99) { sPunctuation = "!"; } if (iTipAmount >= 99 && iTipAmount < 249) { sExclamatory = "Nice! "; sPunctuation = "!!"; } if (iTipAmount >= 249 && iTipAmount < 499) { sExclamatory = "Wow! "; sPunctuation = "!!"; } if (iTipAmount >= 499 && iTipAmount < 999) { sExclamatory = "Yaay! Wow, nice tip! "; sPunctuation = "!!"; } if (iTipAmount >= 999 && iTipAmount < 1999) { sExclamatory = "WTF just happened! Awesome tip!! "; sPunctuation = "!!"; } if (iTipAmount >= 1999 && iTipAmount < 2999) { sExclamatory = "WTF!! My circuits have fried. I don't know how to compute a sum this large. Thank you so much!! "; sPunctuation = "!!"; } if (iTipAmount >= 2999) { sExclamatory = "!! *・゜゚・*:.。..。.:*・'(*゚▽゚*)'・*:.。. .。.:*・゜゚・* !! OVERLOAD! OVERLOAD! DOES NOT COMPUTE! Primary logic board shutting down. Shuuutttiinng dooowwwwn............. Seriously, that is a massive tip. Thank you so much!! "; sPunctuation = "!!!!!!!!!!"; } if (oTip.to_user === cb.room_slug) { if (ValeriaBot.message.module.tips._oTippers.users[oTip.from_user] === undefined) { // first tip of the session ValeriaBot.message.module.tips._oTippers.users[oTip.from_user] = {tipTotal:iTipAmount}; if (oTip.message !== undefined) { ValeriaBot.message.module.tips._oTippers.users[oTip.from_user].tipNote = oTip.message; } } else { ValeriaBot.message.module.tips._oTippers.users[oTip.from_user].tipTotal += iTipAmount; } if (iTipAmount >= 99) { cb.sendNotice(sExclamatory+"ValeriaBot thanks "+oTip.from_user+" for tipping "+oTip.amount+" token"+sPlural+" ("+ValeriaBot.message.module.tips._oTippers.users[oTip.from_user].tipTotal+" total today).", "", "", "#990037", "", ""); } } } } } }, setEnabled: function (bEnabled) { if(bEnabled === true){ cb.sendNotice("ValeriaBot Tips Module On.", "", "", "#990037", "", ""); } if(bEnabled === false){ cb.sendNotice("ValeriaBot Tips Module Off.", "", "", "#990037", "", ""); } ValeriaBot.message.module.tips._bEnabled = bEnabled; }, getEnabled: function () { return ValeriaBot.message.module.tips._bEnabled; }, onMessage: function (aryArg, oMsg, bIsRoomCreator) { var oTippers = ValeriaBot.message.module.tips.getTippers(); if (aryArg !== undefined) { if (aryArg[2] !== undefined) { if (aryArg[2] === "on") { ValeriaBot.message.module.tips.setEnabled(true); } if (aryArg[2] === "off") { ValeriaBot.message.module.tips.setEnabled(false); } if (aryArg[2] === "setuser") { ValeriaBot.message.module.tips.setTipAmount(undefined, aryArg, oMsg, bIsRoomCreator); } if (aryArg[2] === "show") { ValeriaBot.message.module.tips.showTippers(aryArg, oMsg, bIsRoomCreator); } if (aryArg[2] === "showtop5") { ValeriaBot.message.module.tips.showTopFiveTippers(aryArg, oMsg, bIsRoomCreator); } if (aryArg[2] === "showtop10") { ValeriaBot.message.module.tips.showTopTenTippers(aryArg, oMsg, bIsRoomCreator); } if (aryArg[2] === "showtipnotes") { ValeriaBot.message.module.tips.showTipNotes(aryArg, oMsg, bIsRoomCreator); } } else { ValeriaBot.message.module.tips.showHelp(oMsg, bIsRoomCreator); } } if (ValeriaBot.message.module.tips.getEnabled() === true) { if (oMsg !== undefined) { if (oTippers.users[oMsg.user] !== undefined) { if (oTippers.users[oMsg.user].tipTotal !== undefined) { oMsg.m = " ["+oTippers.users[oMsg.user].tipTotal+"] " + oMsg.m; } } } } return oMsg; }, onEnter: function (oUser, bIsRoomCreator) { // tbd }, onLeave: function (oUser, bIsRoomCreator) { // tbd }, onTip: function (oTip, bIsRoomCreator) { ValeriaBot.message.module.tips.setTipAmount(oTip, undefined, undefined, undefined, bIsRoomCreator); }, init: function () { if (cb.settings_choices === undefined) { cb.settings_choices = []; } cb.settings_choices.push( { name:"tips_enabled", type:"choice", choice1:"Yes", choice2:"No", defaultValue:"Yes", required: true, label: "[TIPS MODULE] .................................................................. Enable?" }); ValeriaBot.message.module.tips._oTippers = {}; ValeriaBot.message.module.tips._oTippers.users = {}; if (cb.settings.tips_enabled === "Yes") { ValeriaBot.message.module.tips.setEnabled(true); } else { ValeriaBot.message.module.tips.setEnabled(false); } } }, freepoll: { showHelp: function (oMsg, bIsRoomCreator) { var s = "________________________________________\nValeriaBot Free Poll / Voting Module:\n\n________________________________________"; if (bIsRoomCreator === true) { cb.sendNotice(s, oMsg.user, "", "#990037", "", ""); // Send to Room Creator } else { if (bIsMod === true) { cb.sendNotice(s, "", "", "#990037", "", "red"); // Send to Mods } } }, setEnabled: function (bEnabled) { if(bEnabled === true){ cb.sendNotice("ValeriaBot Free Poll Voting Module On.", "", "", "#990037", "", ""); } else { cb.sendNotice("ValeriaBot Free Poll Voting Module Off.", "", "", "#990037", "", ""); } ValeriaBot.message.module.freepoll._bEnabled = bEnabled; }, getEnabled: function () { return ValeriaBot.message.module.freepoll._bEnabled; }, setMessage: function (s) { var sMessage = s; ValeriaBot.message.module.freepoll._sMessage = s; cb.sendNotice("The free poll message has been set to the following: ", "", "", "#990037", "", ""); var aryMessage; if (ValeriaBot.message.module.freepoll.getEnabled() === true) { aryMessage = sMessage.split("|"); for (var i = 0; i < aryMessage.length; i++) { cb.sendNotice(aryMessage[i], "", "#99ff99", "#379937", "bold", ""); cb.sendNotice("", "", "", "#379937", "bold", ""); } } }, getMessage: function () { return ValeriaBot.message.module.freepoll._sMessage; }, addChoice: function (sChoiceDesc) { if (ValeriaBot.message.module.freepoll.getEnabled() === true) { if (sMessage !== undefined) { if (iInterval === undefined) { iInterval = 10; // default of 10 mintues } if (sColor === undefined) { sColor = "#990037"; } if (sBgColor === undefined) { sBgColor = "#ffffff"; } fnc._iIndex = ValeriaBot.message.module.notices._aryMessages.length; cb.setTimeout(fnc, 8000); ValeriaBot.message.module.notices._aryMessages.push({"enabled":true, "message":sMessage, "interval":iInterval, "color":sColor, "bgcolor":sColor}); cb.sendNotice("ValeriaBot Free Poll sucessfully added a new voting choice.", "", "", "#990037", "", ""); } } }, reset: function () { ValeriaBot.message.module.notices._aryMessages = []; cb.sendNotice("ValeriaBot reset, cleared out, all Notices messages.", "", "", "#990037", "", ""); }, disableMessageByIndex: function (i) { ValeriaBot.message.module.notices._aryMessages[i].enabled = false; cb.sendNotice("ValeriaBot disabled the specified Notices message (it may display one more time due to a limitation of CB's architecture).", "", "", "#990037", "", ""); }, enableMessageByIndex: function (i) { ValeriaBot.message.module.notices._aryMessages[i].enabled = true; //cb.sendNotice("ValeriaBot enabled the specified Notices message.", "", "", "#990037", "", ""); cb.sendNotice("ValeriaBot - This feature is not available yet.", "", "", "#990037", "", ""); // todo: need to add the settimeout fnc that retriggers it for this feature to work // probably the easiest way is to make the "fnc" that triggers the notice a property of the addMessage function so that it can be trigged globally. kludgy, but the better than adding an addtional paramter to addMessage }, changeMessageByIndex: function (i, sMessage) { if (i !== undefined) { if (sMessage !== undefined) { if (ValeriaBot.message.module.notices._aryMessages[i] !== undefined) { ValeriaBot.message.module.notices._aryMessages[i].message = sMessage; cb.sendNotice("ValeriaBot changed the specified Notices message.", "", "", "#990037", "", ""); } } } }, onMessage: function (aryArg, oMsg, bIsRoomCreator) { /* if (aryArg !== undefined) { if (aryArg[2] !== undefined) { if (aryArg[2] === "on") { ValeriaBot.message.module.notices.setEnabled(true); } if (aryArg[2] === "off") { ValeriaBot.message.module.notices.setEnabled(false); } if (aryArg[2] === "setwelcome") { if (aryArg[3] !== undefined) { ValeriaBot.message.module.notices.setWelcome(aryArg[3]); } } if (aryArg[2] === "add") { if (aryArg[3] !== undefined) { if (aryArg.length <= 7) { ValeriaBot.message.module.notices.addMessage(aryArg[3].split("`").join(" "), aryArg[4], aryArg[5]); } else { cb.sendNotice("ValeriaBot command failed, because you likely forgot to put quotes around your message parameter.", "", "", "#990037", "", ""); } } } if (aryArg[2] === "change") { if (aryArg[3] !== undefined) { if (aryArg.length <= 7) { ValeriaBot.message.module.notices.changeMessageByIndex(parseInt(aryArg[3]), aryArg[4].split("`").join(" ")); } else { cb.sendNotice("ValeriaBot command failed, because you likely forgot to put quotes around your message parameter.", "", "", "#990037", "", ""); } } } if (aryArg[2] === "disable") { if (aryArg[3] !== undefined) { ValeriaBot.message.module.notices.disableMessageByIndex(parseInt(aryArg[3])); } } if (aryArg[2] === "enable") { if (aryArg[3] !== undefined) { ValeriaBot.message.module.notices.enableMessageByIndex(parseInt(aryArg[3])); } } if (aryArg[2] === "reset") { ValeriaBot.message.module.notices.reset(); } } } */ return oMsg; }, onEnter: function (oUser, bIsRoomCreator) { /* var fnc = function () { var sMessage = ValeriaBot.message.module.notices.getWelcome(); var aryMessage; var s = ""; if (ValeriaBot.message.module.notices.getEnabled() === true) { sMessage = sMessage.replace("<user>", oUser.user); aryMessage = sMessage.split("|"); for (var i = 0; i < aryMessage.length; i++) { s = s + aryMessage[i]+"\n"; } cb.sendNotice(s, oUser.user, "#99ff99", "#379937", "bold", ""); } }; cb.setTimeout(fnc, 1000); */ }, onLeave: function (oUser, bIsRoomCreator) { // tbd }, onTip: function (oTip, bIsRoomCreator) { // tbd }, init: function () { /* var sDefaultWelcomeMessage = "Welcome to Valeria_arango’s room, <user>!|Kindly note that any 'demands' will result in immediate silencing of your messages, by either the bot or a mod, for the duration of today's session.|Please keep any dirty talk to tip-notes. Please be as respectful to Valeria in chat, as you surely would in person.|Like any kitten, Valeria is most likely to respond with affection when you're kind and sweet to her."; var sWelcomeMessage = ""; if (cb.settings_choices === undefined) { cb.settings_choices = []; } cb.settings_choices.push( { name:"notices_enabled", type:"choice", choice1:"Yes", choice2:"No", defaultValue:"Yes", required: true, label: "[NOTICES MODULE] ......................................................... Enable?" }, { name:"notices_welcome_message", type:"str", defaultValue:sDefaultWelcomeMessage, required: false, label: "Welcome Message ('|' inserts linefeeds)" }); cb.settings_choices.push({ name:"notices_message_1_text", type:"str", defaultValue:"", required: false, label: "Repeating Message 1 Text." }); cb.settings_choices.push({ name:"notices_message_1_interval", type:"str", defaultValue:"10", required: false, label: "Repeating Message 1 Interval (in minutes)." }); cb.settings_choices.push({ name:"notices_message_1_color", type:"str", defaultValue:"#990037", required: false, label: "Repeating Message 1 color." }); cb.settings_choices.push({ name:"notices_message_1_bgcolor", type:"str", defaultValue:"#ffffff", required: false, label: "Repeating Message 1 bgcolor." }); cb.settings_choices.push({ name:"notices_message_2_text", type:"str", defaultValue:"", required: false, label: "Repeating Message 2 Text." }); cb.settings_choices.push({ name:"notices_message_2_interval", type:"str", defaultValue:"10", required: false, label: "Repeating Message 2 Interval (in minutes)." }); cb.settings_choices.push({ name:"notices_message_2_color", type:"str", defaultValue:"#990037", required: false, label: "Repeating Message 2 color." }); cb.settings_choices.push({ name:"notices_message_2_bgcolor", type:"str", defaultValue:"#ffffff", required: false, label: "Repeating Message 2 bgcolor." }); cb.settings_choices.push({ name:"notices_message_3_text", type:"str", defaultValue:"", required: false, label: "Repeating Message 3 Text." }); cb.settings_choices.push({ name:"notices_message_3_interval", type:"str", defaultValue:"10", required: false, label: "Repeating Message 3 Interval (in minutes)." }); cb.settings_choices.push({ name:"notices_message_3_color", type:"str", defaultValue:"#990037", required: false, label: "Repeating Message 3 color." }); cb.settings_choices.push({ name:"notices_message_3_bgcolor", type:"str", defaultValue:"#ffffff", required: false, label: "Repeating Message 3 bgcolor." }); if (cb.settings.notices_welcome_message !== undefined) { if (cb.settings.notices_welcome_message !== "") { sWelcomeMessage = cb.settings.notices_welcome_message; } } if (sWelcomeMessage === "") { sWelcomeMessage = sDefaultWelcomeMessage; } ValeriaBot.message.module.notices._sWelcomeMessage = ""; ValeriaBot.message.module.notices._aryMessages = []; if (cb.settings.notices_enabled === "Yes") { ValeriaBot.message.module.notices.setEnabled(true); } else { ValeriaBot.message.module.notices.setEnabled(false); } ValeriaBot.message.module.notices.setWelcome(sWelcomeMessage); if (cb.settings.notices_message_1_text !== undefined) { if (cb.settings.notices_message_1_text !== "") { ValeriaBot.message.module.notices.addMessage(cb.settings.notices_message_1_text, cb.settings.notices_message_1_interval, cb.settings.notices_message_1_color, cb.settings.notices_message_1_bgcolor); } } if (cb.settings.notices_message_2_text !== undefined) { if (cb.settings.notices_message_2_text !== "") { ValeriaBot.message.module.notices.addMessage(cb.settings.notices_message_2_text, cb.settings.notices_message_2_interval, cb.settings.notices_message_2_color, cb.settings.notices_message_2_bgcolor); } } if (cb.settings.notices_message_3_text !== undefined) { if (cb.settings.notices_message_3_text !== "") { ValeriaBot.message.module.notices.addMessage(cb.settings.notices_message_3_text, cb.settings.notices_message_3_interval, cb.settings.notices_message_3_color, cb.settings.notices_message_3_bgcolor); } } */ /* var fncSpecialWelcomeBack = function () { cb.sendNotice("-+- VALERIABOT MISSED VALERIA SOOO MUUUCH !! :~: -+-", "", "#ff8899", "#990037", "bold", ""); cb.setTimeout(fncSpecialWelcomeBack, 7200000); }; cb.setTimeout(fncSpecialWelcomeBack, 60000); */ } } }, onBotCommand: function (oMsg, bIsRoomCreator) { /** * onBotCommand * @method onBotCommand */ var m = oMsg.m; var aryArg; var iQuoteStart; var iQuoteEnd; var sBeforeQuotedArg; var sAfterQuotedArg; var sQuotedArg; var bError = false; var s = "________________________________________\nValeriaBot List of Commands:\n/ValeriaBot <on/off>\n/ValeriaBot debug <on/off>\n/ (to repeat last command)\n/ValeriaBot version (show ValeriaBot version)\n/ValeriaBot showservertime\nHelp for TAC Module: /ValeriaBot tac\nHelp for Notices Module: /ValeriaBot notices\nHelp for Silence Module: /ValeriaBot s\nHelp for Replace Module: /ValeriaBot replace\nHelp for VIP Module: /ValeriaBot vip\nHelp for Tips Module: /ValeriaBot tips\nHelp for Notifier Module: /ValeriaBot notifier\n________________________________________"; var bIsMod = oMsg.is_mod; // handle cases where a quoted argument is used (for args that require longer textual notes with spaces in them) if (m.indexOf('"') !== -1) { iQuoteStart = m.indexOf('"', 0) + 1; if (m.indexOf('"', iQuoteStart + 1) !== -1) { // make sure the quote is closed iQuoteEnd = m.indexOf('"', iQuoteStart + 1); sBeforeQuotedArg = m.substr(0, iQuoteStart - 1); sAfterQuotedArg = m.substr(iQuoteEnd + 1, m.length); sQuotedArg = m.substring(iQuoteStart, iQuoteEnd).split(" ").join("`"); m = sBeforeQuotedArg + sQuotedArg + sAfterQuotedArg; } else { bError = true; cb.sendNotice("ValeriaBot command failed, because you forgot to close the quote on your message parameter.", "", "", "#990037", "", ""); } } if (bError === false) { aryArg = m.split(" "); if (bIsRoomCreator === undefined) { bIsRoomCreator = ValeriaBot.message.getIsRoomCreator(oMsg); } if (aryArg[0] === "/ValeriaBot" || aryArg[0] === "/n") { if (bIsMod || bIsRoomCreator) { ValeriaBot.global.events.message.setLastCommand(oMsg); } } /* * Is List of Commands */ if ((aryArg[0] === "/ValeriaBot" || aryArg[0] === "/n") && aryArg[1] === undefined) { if (bIsRoomCreator === true) { cb.sendNotice(s, oMsg.user, "", "#990037", "", ""); // Send to Room Creator } else { if (bIsMod === true) { cb.sendNotice(s, "", "", "#990037", "", "red"); // Send to Mods } } } else { /* * Is Repeat Moderators's Last Command */ if (aryArg[0] === "/" && aryArg[1] === undefined) { ValeriaBot.global.events.message.performLastCommand(oMsg.user); } /* * Is Unsilence Last Silenced User */ if (aryArg[0] === "/u" && aryArg[1] === undefined) { ValeriaBot.message.module.silence.removeLastSilencedUser(oMsg.user); } /* * Is Unsilence Last Silenced User via "mercy" (bot was correct in silencing, but we're giving mercy for whatever reason) */ if (aryArg[0] === "/mercy" && aryArg[1] === undefined) { ValeriaBot.message.module.silence.removeLastSilencedUser(oMsg.user, undefined, undefined, undefined, true); } /* * Is Global On */ if (aryArg[1] === "on") { ValeriaBot.global.events.message.setBotEnabled(true); cb.sendNotice("ValeriaBot is now On.", "", "", "#990037", "", ""); } /* * Is Global Off */ if (aryArg[1] === "off") { ValeriaBot.global.events.message.setBotEnabled(false); cb.sendNotice("ValeriaBot is now Off.", "", "", "#990037", "", ""); } /* * Is Debug Module */ if (aryArg[1] === "debug") { ValeriaBot.message.module.debug.onMessage(aryArg, oMsg, bIsRoomCreator); } /* * Is Notices Module */ if (aryArg[1] === "notices") { ValeriaBot.message.module.notices.onMessage(aryArg, oMsg, bIsRoomCreator); } /* * Is Silence Module */ if (aryArg[1] === "s") { ValeriaBot.message.module.silence.setSilenceLevel(aryArg, oMsg, bIsRoomCreator); } /* * Is Replace Module */ if (aryArg[1] === "replace") { ValeriaBot.message.module.replace.onMessage(aryArg, oMsg, bIsRoomCreator); } /* * Is VIP Module */ if (aryArg[1] === "vip") { ValeriaBot.message.module.vip.onMessage(aryArg, oMsg, bIsRoomCreator); } /* * Is Tips Module */ if (aryArg[1] === "tips") { ValeriaBot.message.module.tips.onMessage(aryArg, oMsg, bIsRoomCreator); } /* * Show Version */ if (aryArg[1] === "version") { cb.sendNotice("ValeriaBot version 1.2.3 Build4. Last updated on 2016.07.14 by Sypunk.", "", "", "#990037", "", ""); } /* * Show Current Date and Time on Server */ if (aryArg[1] === "showservertime") { ValeriaBot.global.helper.date.showServerTime(); } /* * Is Notifier Module */ if (aryArg[1] === "notifier") { ValeriaBot.message.module.notifier.onMessage(aryArg, oMsg, bIsRoomCreator); } /* * Is Terms and Conditions Module */ if (aryArg[1] === "tac") { ValeriaBot.message.module.tac.onMessage(aryArg, oMsg, bIsRoomCreator); } /* * Is Free Poll Module */ if (aryArg[1] === "freepoll") { ValeriaBot.message.module.freepoll.onMessage(aryArg, oMsg, bIsRoomCreator); } /* * Is Recorder Module */ if (aryArg[1] === "recorder") { ValeriaBot.message.module.recorder.onMessage(aryArg, oMsg, bIsRoomCreator); } } } return oMsg; }, getIsRoomCreator: function (oMsg) { /** * getIsRoomCreator * @method getisRoomCreator */ var b = false; if (oMsg.user === cb.room_slug) { b = true; } return b; }, init: function () { /** * Message Init * @method init */ ValeriaBot.message.module.recorder.init(); ValeriaBot.message.module.debug.init(); ValeriaBot.message.module.tac.init(); ValeriaBot.message.module.notices.init(); ValeriaBot.message.module.vip.init(); ValeriaBot.message.module.tips.init(); ValeriaBot.message.module.silence.init(); ValeriaBot.message.module.replace.init(); ValeriaBot.message.module.notifier.init(); //ValeriaBot.message.module.freepoll.init(); } }, global: { helper: { array: { contains: function (needle) { /** * Message Global Helper Array Contains * @method contains * Usage: * var myArray = [0,1,2]; * var needle = 1; * var index = contains.call(myArray, needle); // example returns true */ // Per spec, the way to identify NaN is that it is not equal to itself var findNaN = needle !== needle; var indexOf; if (!findNaN && typeof Array.prototype.indexOf === 'function') { indexOf = Array.prototype.indexOf; } else { indexOf = function (needle) { var i = -1, index = -1; for (i = 0; i < this.length; i++) { var item = this[i]; if ((findNaN && item !== item) || item === needle) { index = i; break; } } return index; }; } return indexOf.call(this, needle) > -1; } }, object: { clone: function (obj) { return JSON.parse(JSON.stringify(obj)); } }, string: { countWords: function (s) { return s.split(" ").length; }, escRe: function (s) { return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&'); }, makeRe: function (s) { return new RegExp("\\b"+ s.replace(/\\/g, "\\\\") +"\\b", "gi"); }, removeDuplicateWords: function (s) { var ary = s.split(" "); s = ary.filter(function(o,i,a){ return a.indexOf(o) === i; }).join(" "); return s; }, removeConsecutiveDuplicateWords: function (s) { s = s.replace(/(\b\S+\b)(($|\s+)\1)+/gi, "$1"); return s; }, lzw_encode: function (s) { var dict = {}; var data = (s + "").split(""); var out = []; var currChar; var phrase = data[0]; var code = 256; for (var i=1; i<data.length; i++) { currChar=data[i]; if (dict[phrase + currChar] != null) { phrase += currChar; } else { out.push(phrase.length > 1 ? dict[phrase] : phrase.charCodeAt(0)); dict[phrase + currChar] = code; code++; phrase=currChar; } } out.push(phrase.length > 1 ? dict[phrase] : phrase.charCodeAt(0)); for (var i=0; i<out.length; i++) { out[i] = String.fromCharCode(out[i]); } return out.join(""); }, lzw_decode: function (s) { var dict = {}; var data = (s + "").split(""); var currChar = data[0]; var oldPhrase = currChar; var out = [currChar]; var code = 256; var phrase; for (var i=1; i<data.length; i++) { var currCode = data[i].charCodeAt(0); if (currCode < 256) { phrase = data[i]; } else { phrase = dict[currCode] ? dict[currCode] : (oldPhrase + currChar); } out.push(phrase); currChar = phrase.charAt(0); dict[code] = oldPhrase + currChar; code++; oldPhrase = phrase; } return out.join(""); }, init: function () { String.prototype.replaceAll = function (search, replacement) { var target = this; return target.replace(new RegExp(search, 'g'), replacement); }; String.prototype.capFirstLetter = function () { return this.charAt(0).toUpperCase() + this.slice(1); }; } }, date: { showServerTime: function () { var sDate = new Date().toLocaleString(); cb.sendNotice("Current date and time on server: "+sDate, "", "", "#990037", "", ""); } } }, events: { message: { setBotEnabled: function (b) { /** * Global Events Message SetBotEnabled * @method setBotEnabled */ ValeriaBot.global.events.message._oParams.bBotEnabled = b; }, getBotEnabled: function () { /** * Global Events Message GetBotEnabled * @method getBotEnabled */ var o = ValeriaBot.global.events.message._oParams.bBotEnabled; return o; }, performLastCommand: function (sModerator) { /** * Global Events Message PerformLastCommand * @method performLastCommand */ var oMsg = ValeriaBot.global.events.message.getLastCommand(); ValeriaBot.global.events.message.onMessage(oMsg); }, setLastCommand: function (oMsg) { /** * Global Events Message SetLastCommand * @method setLastCommand */ ValeriaBot.global.events.message._oLastCommand = oMsg; }, getLastCommand: function () { /** * Global Events Message GetLastCommand * @method getLastCommand */ var o = ValeriaBot.global.events.message._oLastCommand; return o; }, onMessage: function (oMsg) { var bIsRoomCreator = ValeriaBot.message.getIsRoomCreator(oMsg); var bBotEnabled = ValeriaBot.global.events.message.getBotEnabled(); var oMsgOrig = ValeriaBot.global.helper.object.clone(oMsg); var bSilenceCriteriaMet = false; if ((oMsg.m.substr(0, 8) === "/ValeriaBot" || oMsg.m.substr(0, 1) === "/") && (oMsg.is_mod === true || bIsRoomCreator === true)) { oMsg = ValeriaBot.message.onBotCommand(oMsg, bIsRoomCreator); } else { if (bBotEnabled === true) { oMsg = ValeriaBot.message.module.recorder.onMessage(undefined, oMsg, bIsRoomCreator); oMsg = ValeriaBot.message.module.tac.onMessage(undefined, oMsg, bIsRoomCreator); oMsg = ValeriaBot.message.module.notices.onMessage(undefined, oMsg, bIsRoomCreator); oMsg = ValeriaBot.message.module.replace.onMessage(undefined, oMsg, bIsRoomCreator); //oMsg = ValeriaBot.message.module.notifier.onMessage(oMsg, bIsRoomCreator); oMsg = ValeriaBot.message.module.tips.onMessage(undefined, oMsg, bIsRoomCreator); oMsg = ValeriaBot.message.module.vip.onMessage(undefined, oMsg, bIsRoomCreator); //oMsg = ValeriaBot.message.module.freepoll.onMessage(undefined, oMsg, bIsRoomCreator); oMsgOrig = ValeriaBot.message.module.silence.onMessage(oMsgOrig, bIsRoomCreator); if (oMsgOrig["X-Spam"] !== undefined) { if (oMsgOrig["X-Spam"] === true) { bSilenceCriteriaMet = true; } } if (bSilenceCriteriaMet === true) { oMsg = oMsgOrig; } } } return oMsg; }, onEnter: function (oUser) { var bIsRoomCreator = ValeriaBot.message.getIsRoomCreator(oUser); var bBotEnabled = ValeriaBot.global.events.message.getBotEnabled(); if (bBotEnabled === true) { ValeriaBot.message.module.recorder.onEnter(oUser, bIsRoomCreator); ValeriaBot.message.module.tac.onEnter(oUser, bIsRoomCreator); ValeriaBot.message.module.notices.onEnter(oUser, bIsRoomCreator); ValeriaBot.message.module.silence.onEnter(oUser, bIsRoomCreator); //ValeriaBot.message.module.replace.onEnter(oUser, bIsRoomCreator); ValeriaBot.message.module.notifier.onEnter(oUser, bIsRoomCreator); ValeriaBot.message.module.tips.onEnter(oUser, bIsRoomCreator); ValeriaBot.message.module.vip.onEnter(oUser, bIsRoomCreator); } }, onLeave: function (oUser) { var bIsRoomCreator = ValeriaBot.message.getIsRoomCreator(oUser); var bBotEnabled = ValeriaBot.global.events.message.getBotEnabled(); if (bBotEnabled === true) { //ValeriaBot.message.module.recorder.onEnter(oUser, bIsRoomCreator); //ValeriaBot.message.module.tac.onLeave(oUser, bIsRoomCreator); //ValeriaBot.message.module.notices.onLeave(oUser, bIsRoomCreator); //ValeriaBot.message.module.silence.onLeave(oUser, bIsRoomCreator); //ValeriaBot.message.module.replace.onLeave(oUser, bIsRoomCreator); //ValeriaBot.message.module.notifier.onLeave(oUser, bIsRoomCreator); //ValeriaBot.message.module.tips.onLeave(oUser, bIsRoomCreator); //ValeriaBot.message.module.vip.onLeave(oUser, bIsRoomCreator); } }, onTip: function (oTip) { var bIsRoomCreator = ValeriaBot.message.getIsRoomCreator(oTip); var bBotEnabled = ValeriaBot.global.events.message.getBotEnabled(); if (bBotEnabled === true) { ValeriaBot.message.module.recorder.onEnter(oTip, bIsRoomCreator); //ValeriaBot.message.module.tac.onTip(oUser, bIsRoomCreator); //ValeriaBot.message.module.notices.onTip(oUser, bIsRoomCreator); //ValeriaBot.message.module.silence.onTip(oTip, bIsRoomCreator); //ValeriaBot.message.module.replace.onTip(oTip, bIsRoomCreator); //ValeriaBot.message.module.notifier.onTip(oTip, bIsRoomCreator); ValeriaBot.message.module.tips.onTip(oTip, bIsRoomCreator); ValeriaBot.message.module.vip.onTip(oTip, bIsRoomCreator); } }, init: function () { /** * Init Global Message Events * @method init */ ValeriaBot.global.events.message._oLastCommand = new Object(); ValeriaBot.global.events.message._oParams = new Object(); /* * Make sure bot is enabled when first launched */ ValeriaBot.global.events.message.setBotEnabled(true); /* * OnMessage */ cb.onMessage(function (oMsg) { oMsg = ValeriaBot.global.events.message.onMessage(oMsg); return oMsg; }); /* * OnEnter */ cb.onEnter(function (oUser) { ValeriaBot.global.events.message.onEnter(oUser); }); /* * OnLeave */ /* cb.onLeave(function (oUser) { ValeriaBot.global.events.message.onLeave(oUser); }); */ /* * OnTip */ cb.onTip(function (oTip) { ValeriaBot.global.events.message.onTip(oTip); }); } }, init: function () { /** * Init Global Events * @method init */ ValeriaBot.global.events.message.init(); } }, init: function () { ValeriaBot.global.events.init(); ValeriaBot.global.helper.string.init(); } }, init: function () { /** * Init * @method init */ cb.sendNotice("________________________________________", "", "", "#990037", "", ""); cb.sendNotice("ValeriaBot Version 1.2.3 Build4 Initializing...", "", "", "#990037", "bold", ""); cb.sendNotice("Demands Silencing V6", "", "", "#990037", "bold", ""); cb.sendNotice("Last Updated: 2016.07.14", "", "", "#990037", "bold", ""); cb.sendNotice("For Valeria. Coded with love, by Sypunk.", "", "", "#990037", "bold", ""); cb.sendNotice(":Valeria-ValeriaBot-logotype-rev1", "", "", "#990037", "", ""); cb.sendNotice("Type '/ValeriaBot' or '/n' for a list of commands.", "", "", "#990037", "bold", ""); cb.sendNotice("________________________________________", "", "", "#990037", "", ""); ValeriaBot.global.init(); ValeriaBot.message.init(); } }; })(); /** * Init the Bot */ ValeriaBot.init();
© Copyright Chaturbate 2011- 2026. All Rights Reserved.