Bots Home
|
Create an App
Sasha's MultiBot
Author:
gaius
Description
Source Code
Launch Bot
Current Users
Created by:
Gaius
/************************************************** * Name: Sasha's Multi Bot * Author: Gaius * Version: 1.0.0 * Based on: Bomb Bot Ultra by adambomb01 (ver 1.6.3) /************************************************** /************************************************** App Launch Settings **************************************************/ cb.settings_choices = [ /**** 1. Personalisation ****/ {name: 'colorscheme', label: '1.) Personalisation ........................................... Colour Scheme:', type: 'choice', choice1: 'Purple', choice2: 'Pink', choice3: 'Orange', choice4: 'Red', choice5: 'Green', choice6: 'Teal', choice7: 'Grey', choice8: 'Custom (Please define below)', required: false}, {name: 'darkcolor', label: 'Custom Dark Color (Hex #)', type: 'str', defaultValue: '[Optional - Set Colour Scheme to "Custom" above]', required: false}, {name: 'lightcolor', label: 'Custom Light Colour (Hex #)', type: 'str', defaultValue: '[Optional - Set Colour Scheme to "Custom" above]', required: false}, {name: 'enterMessage', label: 'Welcome Message', type: 'str', minLength: 1, maxLength: 1000, defaultValue: '', required: false}, /**** 2. Room Control ****/ {name: 'capsToggle', label: '2.) Room Control ................ Convert ALL CAPS to lowercase?', type: 'choice', choice1: 'Yes', choice2: 'No', choice3: 'Only for grey Users', defaultValue: 'Yes', required: false}, {name: 'stickyToggle', label: 'Prevent Sticky Keyyyyyyyyyyyyys?', type: 'choice', choice1: 'Yes', choice2: 'No', choice3: 'Only for grey Users', defaultValue: 'Yes', required: false}, {name: 'defaultGraphicLevel', label: 'Default Graphic Level (Who can use Graphics?)', type: 'choice', choice1: '0 - (Everyone)', choice2: '1 - (Colour Users only)', choice3: '2 - (Dark Blue and higher Users)', choice4: '3 - (Users who have tipped at least 25)', choice5: '4 - (Only Mods and Fans)', defaultValue: '3 - (Users who have tipped at least 25)', required: false}, {name: 'defaultSilenceLevel', label: 'Default Silence Level (Who can talk in Chat?)', type: 'choice', choice1: '0 - (Everyone)', choice2: '1 - (Colour Users only)', choice3: '2 - (Dark Blue and higher Users)', choice4: '3 - (Users who have tipped at least 10)', choice5: '4 - (Only Mods and Fans)', defaultValue: '0 - (Everyone)', required: false}, {name: 'niceList', label: 'Nice List (Users who can always chat / use Graphics)', type: 'str', minLength: 1, maxLength: 1000, defaultValue: 'gaius,guardian__angel,milamber78,titus__pullo', required: false}, {name: 'silenceList', label: 'Silence List (Users who are permanently silenced)', type: 'str', minLength: 1, maxLength: 1000, defaultValue: 'hellokikitty,danysboy,buffon42,sugardadyin808,hornym834,nicolas_uy12,alejandrooromin,serbian1,sir523,lovenakedpeople,yukiees,jimehat23,santiandres96,alexhuber12345,adidas1992,mranonn1989,dwmoze,david_rockefeller8,daaraak,rafacanelas,jesu_148,fuckumotherfuker,unexpecteddude,cypresshill88,andres123_201,cummeater,pingachica51,militar84,bluelhyj,eprham,pooldevil198,jeffking805,philip669,loveyoubaby45637,aliciaaa97,hotsiavaash,mystery_174,nataliahot2,dragoo1,tomek1982,juan580,caravan,adelle_rosa,bennyarnold,downtoskype,longpimp,calcal145', required: false}, /**** 3. Restricted Words List ****/ {name: 'wordlistToggle', label: '3.) Blocked Words List .............. Use Blocked Words List feature?', type: 'choice', choice1: 'Yes', choice2: 'No (Skip to Section 4)', defaultValue: 'Yes', required: false}, {name: 'wordlistNotice', label: 'Notify User when his/her message gets blocked?', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes', required: false}, {name: 'wordlistShowModerators', label: 'Notify Moderators of Blocked Messages?', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes', required: false}, {name: 'wordlistShowBroadcaster', label: 'Notify Broadcaster of Blocked Messages?', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'No', required: false}, {name: 'wordlistLevel', label: 'Blocked Words List applies to', type: 'choice', choice1: 'Only grey Users', choice2: 'Everyone', defaultValue: 'Only grey Users', required: false}, // {name: 'greyList', // label: 'Grey List (Users who should always incur Word List)', // type: 'str', minLength: 1, maxLength: 1000, defaultValue: '[Optional - Exact Usernames, separated by commas]', required: false}, /**** 4. Custom Wordlist ****/ {name: 'customWordlistToggle', label: '4.) Custom Wordlist ................ Use Custom Wordlist feature?', type: 'choice', choice1: 'Yes', choice2: 'No (Skip to Section 5)', defaultValue: 'Yes', required: false}, {name: 'customWordlist', label: 'Custom Wordlist', type: 'str', minLength: 1, maxLength: 1000, defaultValue: 'bitch,cock,cum,cunt,dick,puta,ramera,slut,whore,zorra', required: false}, {name: 'customWordlistLevel', label: 'Custom Wordlist applies to', type: 'choice', choice1: 'Only grey Users', choice2: 'Everyone', defaultValue: 'Everyone', required: false}, /**** 5. Whispers ****/ {name: 'whisperToggle', label: '5.) Whispers ............................................... Use Whisper feature?', type: 'choice', choice1: 'Yes', choice2: 'No (Skip to Section 6)', defaultValue: 'Yes', required: false}, {name: 'roomWhisperLevel', label: 'Default Whisper Level (Who can send Whispers?)', type: 'choice', choice1: '0 - (Everyone)', choice2: '1 - (Colour Users only)', choice3: '2 - (Dark blue and higher Users)', choice4: '3 - (Users who have tipped)', choice5: '4 - (Only Mods and eMods)', defaultValue: '4 - (Only Mods and eMods)', required: false}, {name: 'hostWhisperLevel', label: 'Broadcaster whisper level (Who can send YOU Whispers?)', type: 'choice', choice1: '0 - (Everyone)', choice2: '1 - (Colour Users only)', choice3: '2 - (Dark blue and higher Users)', choice4: '3 - (Users who have tipped at least 200)', choice5: '4 - (Only Mods and eMods)', defaultValue: '4 - (Only Mods and eMods)', required: false}, /**** 6. King Tipper ****/ {name: 'kingTipper', label: '6.) King Tipper ................................... Use \'King Tipper\' feature?', type: 'choice', choice1: 'Yes', choice2: 'No (Skip to Section 7)', defaultValue: 'Yes', required: false}, {name: 'kingMin', label: 'Minimum Tip Amount to become King:', type: 'int', minValue: 1, maxValue: 1000, defaultValue: 100, required: false}, {name: 'kingTipperSpam', label: 'Periodically announce tip required to become King?', type: 'choice', choice1: 'Yes', choice2: 'No (Skip to Section 7)', defaultValue: 'Yes', required: false}, {name: 'kingTipperTimer', label: 'Interval (in mins) for King Announcement', type: 'int', minValue: 1, maxValue: 60, defaultValue: 15, required: false}, /**** 7. Leaderboard ****/ {name: 'leaderBoard', label: '7.) Leaderboard .............................. Use Leaderboard feature?', type: 'choice', choice1: 'Yes', choice2: 'No (Skip to Section 8)', defaultValue: 'No (Skip to Section 8)', required: false}, {name: 'leaderBoardSpam', label: 'Periodically announce top 3 Tippers?', type: 'choice', choice1: 'Yes', choice2: 'No (Skip to Section 8)', defaultValue: 'No (Skip to Section 8)', required: false}, {name: 'leaderBoardTimer', label: 'Interval (in mins) for Leaderboard Announcement', type: 'int', minValue: 1, maxValue: 60, defaultValue: 16, required: false}, /**** 8. Tip Messages ****/ {name: 'notifierTip', label: '8.) Tip Messages ..................... Show Message when a User tips?', type: 'choice', choice1: 'Yes', choice2: 'Privately to Tipper only', choice3: 'No (Skip to Section 9)', defaultValue: 'Privately to Tipper only', required: false}, {name: 'tipMessage', label: 'Message to display', type: 'str', minLength: 1, maxLength: 1000, defaultValue: 'Thank you for tipping, {username}!', required: false}, {name: 'tipMessageMin', label: 'Minimum tip to trigger message', type: 'int', minValue: 1, maxValue: 1000000, defaultValue: 50, required: false}, /**** 9. Rotating Notifier ****/ {name: 'notifierSpam', label: '9.) Rotating Notifier ............................. Use Rotating Notifier?', type: 'choice', choice1: 'Yes', choice2: 'No (Skip to Section 10)', defaultValue: 'Yes', required: false}, {name: 'notifierTimer', label: 'Interval (in mins) for Rotating Notices', type: 'int', minValue: 1, maxValue: 60, defaultValue: 12, required: false}, {name: 'spamMessage1', label: 'Notice #1', type: 'str', minLength: 1, maxLength: 1000, defaultValue: '', required: false}, {name: 'spamMessage2', label: 'Notice #2', type: 'str', minLength: 1, maxLength: 1000, defaultValue: '', required: false}, {name: 'spamMessage3', label: 'Notice #3', type: 'str', minLength: 1, maxLength: 1000, defaultValue: '', required: false}, {name: 'spamMessage4', label: 'Notice #4', type: 'str', minLength: 1, maxLength: 1000, defaultValue: '', required: false}, {name: 'spamMessage5', label: 'Notice #5', type: 'str', minLength: 1, maxLength: 1000, defaultValue: '', required: false}, /**** 10. Tip Titles ****/ {name: 'tipTitles', label: '10.) Tip Titles ........................... Display Users\' Tip Totals as Titles?', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes', required: false}, /**** 11. Miscellaneous ****/ {name: 'invalidToggle', label: '11.) Miscellaneous ................... Send Error Message for invalid Commands?', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes', required: false}, ] /************************************************** Global Variables **************************************************/ var roomHost = cb.room_slug; // Name of the Broadcaster var dev = '\x61\x64\x61\x6D\x62\x6F\x6D\x62\x30\x31'; var tipArray = new Array; var tipArraySorted = true; var tipTotal = 0; var tipNote = ''; var modArray = new Array; // array of Mods modArray[0] = roomHost; var emodArray = new Array; // [i] = User's name, list of users who have been given Bot Mod Powers emodArray[0] = dev; var modAndEmodArray = new Array; // array of mods and emods modAndEmodArray[0] = dev; var modBlockMsgArray = new Array; // [i] = Mod/User's name, list of Mods who should see the Blocked Message notices modBlockMsgArray[0] = dev; var lastBlocked = new Array; // username of user that was last blocked by the app var niceArray = new Array; // [i] = user's name, list of users who have been added to the nice list var greyArray = new Array; // [i] = user's name, list of users who have been added to the grey list var silenceArray = new Array; // [i] = User's name, list of users who have been silenced var lastToUseSL = null; // name of mod who used the /silencelast cmmand within the last 5 seconds var lastToGetSLed = null; // name of the person silenced with the /silencelast command within the last 5 seconds var ignoreArray = new Array; // [i][0] = user's name, [i][1] = user's ignore level, [i][j>1] = person on the user's ignore list var numIgnorers = 0; // number of users who have added people to their ignore lists var whisArray = new Array; // [i][0] = user's name, [i][1] = user who most recently whispered user [i][0] var numWhis = 0; // number of users stored in whisArray var whis = ''; // most recent whisper var silenceLevel = 0; var graphicLevel = 1; var startTime = 0; // the time the timer was started. it is used to calculate time left var timerDuration = 0; // length of the timer in minutes var timerTimeout = 0; var oneTimeout = 0; var fiveTimeout = 0; var timeRemaining = 0; var currentKing = ''; // holds the user name of the current king var kingTip = 0; // holds the value of the king tipper's tip total var kingMin = parseInt(cb.settings.kingMin); // minimum amount for king tipper to register var kingTimer = parseInt(cb.settings.kingTipperTimer); // user defined interval for king spam var kingTimeout = 0; // setTimeOut that will be used later for king spam var ldrArray = [['',0],['',0],['',0]]; // array that holds the top 3 tippers' names and tip totals var ldrTimer = parseInt(cb.settings.leaderBoardTimer); // user defined interval for leader spam var ldrTimeout = 0; // setTimeOut that will be used later for leaderboard spam var initialize = 0; // runs init() once only var kingTipperSpam = 0; // facilitates command to toggle king tipper spam var notifierSpamTGL = 0; // facilitates command to toggle notifier spam var leaderboardSpam = 0; // facilitates command to toggle leaderboard spam var noticeArray = []; // Array of rotating notices var noticeNum = 0; // Index into rotating notices var notifierTimer = parseInt(cb.settings.notifierTimer); // user defined interval for leader spam var notifierTimeout = 0; var customWordlistRegex = ''; // Regular expression for custom wordlist var minuteMS = parseInt(60000); // one minute in milliseconds // var minuteMS = parseInt(1000); // make it quicker for debug //colors and styles var black = "#000033"; // CB default black -- Not true black var white = "#FFFFFF"; var purple_dark = "#5A0674"; var purple_light = "#DDBBCC"; var green_dark = "#007700"; var green_light = "#CCEEAA"; var teal_dark = "#009999"; var teal_light = "#BBEEEE"; var pink_dark = "#EE4499"; var pink_light = "#FFCCEE"; var red_dark = "#BB2222"; var red_light = "#FFCCCC"; var orange_dark = "#FF8833"; var orange_light = "#FFDDCC"; var grey_dark = "#666666"; var grey_light = "#DDDDDD"; var yellow_dark = "#EEAA00"; var yellow_light = "#FFFF55"; var mod_orange = "#DC5500"; var bb_dark = "#2A6F91" var bb_light = "#C2DCEB"; var bb_lt_light = "#EEF5FA"; var bb_lt_dark = "#8BB2C6"; var error_dark = red_dark; var error_light = red_light; var success_dark = green_dark; var success_light = green_light; var theme_dark = purple_dark; var theme_light = purple_light; var bullets = ' \u2022 \u2022 \u2022 '; var crown = ':smallCrown'; /************************************************** Functions **************************************************/ // FUNCTION ==> PURPOSE // findTipper ==> finds and returns the index of a user // emodArrayPopulate ==> adds users to the emodArray // niceArrayPopulate ==> adds users to the niceArray // greyArrayPopulate ==> adds users to the greyArray // notify ==> shorthand for sending notices to the mods and broadcaster // setSilenceLevel ==> called when /silencelevel is used. sets silenceLevel // setGraphicLevel ==> called when /graphiclevel is used. sets graphiclevel // silence ==> called when /silence is used. adds a user to the silenceArray // unsilence ==> called when /unsilence is used. removes a user from the silenceArray // startTimer ==> called when /starttimer is used. starts a timer for t minutes // timer ==> called from startTimer. it's the actual timer // fiveMinuteWarning ==> called from startTimer. if t > 5, sounds a warning at 5 minutes remaining // oneMinuteWarning ==> called from startTimer. if t > 2, sounds a warning at 1 minute remaining // timeLeft ==> called when /timeleft is used. sends the user a notice with the time remaining // addTime ==> called when /addtime is used. adds t minutes to the timer, if one is running // sendNote ==> called when /note is used. sends a notification to the room // sendWhisper ==> called when /whisper or an alias of /whisper is used. sends a private message to a user in chat // ignoreUser ==> called when /ignore is used. adds a member to the user's ignore list // unignoreUser ==> called when /unignore is used. removes a member from the user's ignore list // setIgnoreLevel ==> called when /ignorelevel is used. sets ignoreLevel for the user // setTipTitles ==> called from onMessage. appends the user's tips to the beginning of the message // emod ==> called when /emod is used. adds or removes a user from the emodArray // kingSpam ==> spams "tip x to be king" every 5 minutes if the user setting allows it // kingSpamTimer ==> the actual timer for kingSpam // theLeaderBoard ==> creates the elements for the leaderboard // ldrSpam ==> spams the leaderboard every 5 minutes // ldrSpamTimer ==> the actual timer for ldrSpam // showLeaderBoard ==> called when /leaderboard is used. shows the leaderboard // notifierSpam ==> called from init, starts the timer for notifer spam // notiferSpamTimer ==> the actual timer for notifierSpam // nice ==> called from /addnice and /removenice. adds and removes users from the niceArray // grey ==> called from /addgrey and /removegrey. adds and removes users from the greyArray // kingSpamToggle ==> called when /kingspam is used. toggles the spam // notifierSpamToggle ==> called when /notifierspam is used. toggles the spam // colorChecker ==> verifies the color code is valid function appTimeout(func, msec) { cb['setTimeout'](func, msec < 1000 ? 1000 : msec); // cb.setTimeout doesn't like timeout values less than 1000 } var setTimeout = function setTimeout(func, delay) { if (!(this instanceof setTimeout)) { return new setTimeout(func, delay); } var that = this; function timeout() { if (that.cancelled) { return; } func(); } appTimeout(timeout, delay); }; var clearTimeout = function clearTimeout(timeout) { if (timeout != null) { timeout.cancelled = true; } }; // var setInterval = function setInterval(func, delay) { // if (!(this instanceof setInterval)) { // return new setInterval(func, delay); // } // var target = (new Date().valueOf()) + delay; // var that = this; // function tick() { // if (that.stopped) { // return; // } // target += delay; // func(); // appTimeout(tick, target - (new Date().valueOf())); // } // appTimeout(tick, delay); // }; // var clearInterval = function clearInterval(interval) { // if (interval != null) { // interval.stopped = true; // } // }; function addTip(user, amount) { // Add tip to the tipper list, returning the user's updated total. // Using this feature is optional, so nTotal must be updated separately. var i; var index = -1; // Adding a tip means the list is no longer sorted tipArraySorted = false; // See if this user already has an entry for (i = 0; i < tipArray.length; i += 1) { if (tipArray[i].sUser === user) { index = i; break; } } if (index < 0) { // User is not in list so add them tipArray.push({sUser: user, nTotal: amount}); return amount; } else { // Update the user's tip total tipArray[index].nTotal += amount; return tipArray[index].nTotal; } } function sortTipArray() { // Sort the tipper list if necessary if (!tipArraySorted) { tipArray.sort(function(a, b) { // Reverse sort on tip totals return b.nTotal - a.nTotal; }); tipArraySorted = true; } } function getUserTotal(user) { var i; for (i = 0; i < tipArray.length; i += 1) { if (tipArray[i].sUser === user) { return tipArray[i].nTotal; } } return 0; } function findTipper(user) { var i; for (i = 0; i < tipArray.length; i += 1) { if (tipArray[i].sUser == user) { return i; } } return -1; } function modArrayPopulate(user) { if(!cbjs.arrayContains(modArray,user)) { modArray.push(user); } } function modArrayDepopulate(user) { if(cbjs.arrayContains(modArray,user)) { cbjs.arrayRemove(modArray,user); } } function emodArrayPopulate(user) { if(!cbjs.arrayContains(emodArray,user)) { emodArray.push(user); } } function emodArrayDepopulate(user) { if(cbjs.arrayContains(emodArray,user)) { cbjs.arrayRemove(emodArray,user); } } function modAndEmodArrayPopulate(user) { if(!cbjs.arrayContains(modAndEmodArray,user)) { modAndEmodArray.push(user); } } function modAndEmodArrayDepopulate(user) { if(cbjs.arrayContains(modAndEmodArray,user)) { cbjs.arrayRemove(modAndEmodArray,user); } } function modBlockMsgArrayPopulate(user) { if(!cbjs.arrayContains(modBlockMsgArray,user)) { modBlockMsgArray.push(user); } } function modBlockMsgArrayDepopulate(user) { if(cbjs.arrayContains(modBlockMsgArray,user)) { cbjs.arrayRemove(modBlockMsgArray,user); } } function niceArrayPopulate(user) { niceArray.push(user); } function niceArrayDepopulate(user) { cbjs.arrayRemove(niceArray,user); } function greyArrayPopulate(user) { greyArray.push(user); } function greyArrayDepopulate(user) { cbjs.arrayRemove(greyArray,user); } function silenceArrayPopulate(user) { silenceArray.push(user); } function greyArrayDepopulate(user) { cbjs.arrayRemove(silenceArray,user); } function ignoreArrayPopulate(user) { ignoreArray[numIgnorers] = new Array; ignoreArray[numIgnorers][0] = user; if (cb.settings.roomWhisperLevel) { ignoreArray[numIgnorers][1] = parseInt(cb.settings.roomWhisperLevel.charAt(0)); } else { ignoreArray[numIgnorers][1] = 0; } numIgnorers++; } function findIgnorer(user) { for(i = 0; i < ignoreArray.length; i++) { if(ignoreArray[i][0] == user) { break; } } if(i == ignoreArray.length) { ignoreArrayPopulate(user); findIgnorer(user); } return i; } function whisArrayPopulate(user) { whisArray[numWhis] = new Array; whisArray[numWhis][0] = user; whisArray[numWhis][1] = ''; numWhis++; } function findWhisper(user) { //find the index of the user for(var i = 0; i < whisArray.length; i++) { if(whisArray[i][0] == user) { break; } } //the user is not in the array. add him and call findWhisper if(i == whisArray.length) { whisArrayPopulate(user); findWhisper(user); } return i; } function notify(message, u, bg, c, w) { if (bg == null) { bg = bb_light; } if (c == null) { c = bb_dark; } if (w == null) { w = 'bold'; // leave at '' for normal } if (u == 'onlyMods') { cb.sendNotice(message,'',bg,c,w,'red'); } else if (u == 'modsAndEmods') { for (mod = 0; mod < modAndEmodArray.length; mod++) { thisMod = modAndEmodArray[mod]; cb.sendNotice(message,thisMod,bg,c,w); } } else if (u == 'roomHost') { cb.sendNotice(message,roomHost,bg,c,w); } else if (u == 'modsAndHost') { cb.sendNotice(message,'',bg,c,w,'red'); cb.sendNotice(message,roomHost,bg,c,w); } else if (u == null) { cb.sendNotice(message,'',bg,c,w); } else { cb.sendNotice(message,u,bg,c,w); } } function notifyBold(message, u, bg, c) { if (bg == null) { bg = bb_dark; } if (c == null) { c = white; } notify(message, u, bg, c, 'bold'); } function notifyPlain(message, u, c) { bg = white; if (c == null) { c = bb_dark; } notify(message, u, bg, c); } function notifyTheme(message, u, bg, c) { if (bg == null) { bg = theme_light; } if (c == null) { c = theme_dark; } notify(message, u, bg, c, 'bold'); } function notifyThemeBold(message, u, bg, c) { if (bg == null) { bg = theme_dark; } if (c == null) { c = white; } notify(message, u, bg, c, 'bold'); } function notifyThemePlain(message, u, c) { bg = white; if (c == null) { c = theme_dark; } notify(message, u, bg, c); } function notifyError(message, u) { notify(message, u, error_light, error_dark); } function notifyErrorBold(message, u) { notify(message, u, error_dark, white); } function levelConditions(l) { //I think I can do this with an array variable instead. var condition; switch(parseInt(l)) { case 0: condition = 'All members'; break; case 1: condition = 'Only \"color\" names'; break; case 2: condition = 'Only \"dark blue\" names and higher'; break; case 3: condition = 'Only members who have tipped in the room'; break; case 4: condition = 'No one'; break; } return condition; } function setSilenceLevel(l, mod) { if(parseInt(l) >= 0 && parseInt(l) <= 4) { silenceLevel = parseInt(l); var silenceLevelMessage = 'The Silence Level has been set to ' + l + '.\n'; silenceLevelMessage += levelConditions(l) + ' can talk in Chat.'; notify(silenceLevelMessage, 'modsAndHost'); } else if(l) { notifyError('"' + l + '" is not a valid Silence Level.\nType "/mbhelp\xa0silencelevel" to see how to use /silencelevel.', mod); } else { notifyError('You did not enter a valid Silence Level.\nType "/mbhelp\xa0silencelevel" to see how to use /silencelevel.', mod); } } function setGraphicLevel(l, mod) { if(parseInt(l) >= 0 && parseInt(l) <= 4) { graphicLevel = parseInt(l); var graphicLevelMessage = 'The Graphics Level has been set to ' + l + '.\n'; graphicLevelMessage += levelConditions(l) + ' can use Graphics in Chat.'; notify(graphicLevelMessage, 'modsAndHost'); } else if(l) { notifyError('"' + l + '" is not a valid Graphics Level.\nType "/mbhelp\xa0graphiclevel" to see how to use /graphiclevel.', mod); } else { notifyError('You did not enter a valid Graphics Level.\nType "/mbhelp\xa0graphiclevel" to see how to use /graphiclevel.', mod); } } function setIgnoreLevel(l, user) { if(parseInt(l) >= 0 && parseInt(l) <= 4) { ignoreArray[findIgnorer(user)][1] = l; var ignoreMessage = 'You have set your Whisper Ignore Level to ' + l + '.\n'; ignoreMessage += levelConditions(l) + ' can send you Whispers.\n'; ignoreMessage += 'The Broadcaster and Moderators will always be able to whisper you.'; notify(ignoreMessage, user); } else if(l) { notifyError('"' + l + '" is not a valid Ignore Level.\nType "/mbhelp\xa0ignorelevel" to see how to use /ignorelevel.', user); } else { notifyError('You did not enter a valid Ignore Level.\nType "/mbhelp\xa0ignorelevel" to see how to use /ignorelevel.', user); } } function silence(user, mod) { if (user == mod) { notifyError('You cannot silence yourself.', mod); } else if (user == roomHost) { notifyError('You cannot silence the Broadcaster.', mod); } else if (cbjs.arrayContains(modArray, user)) { notifyError('Broadcaster must revoke ' + user + '\'s Moderator Status before silencing.', mod); } else if (cbjs.arrayContains(emodArray, user)) { notifyError('You must revoke ' + user +'\'s Emergency Moderator Status before silencing. (Type "/emod remove ' + user + '")', mod); } else if (cbjs.arrayContains(niceArray, user)) { notifyError('You must remove ' + user +' from the Nice List before silencing. (Type "/removenice ' + user + '")', mod); } else { if(user) { user = user.toLowerCase(); } if(user == null) { notify('You must specify a user to silence.', mod); } else if(!cbjs.arrayContains(silenceArray,user)) { silenceArrayPopulate(user); var silenceMessage = mod + ' has silenced ' + user + '.'; notify(silenceMessage, 'modsAndEmods'); notify('You have been silenced. Your messages are visible to yourself only, noone else in the room can see them.', user); } else { notifyError(user + ' has already been silenced.', mod); } } } function unsilence(user, mod) { if(user) { user = user.toLowerCase(); } if(user == null) { notify('You must specify a user to unsilence.', mod); } else if(cbjs.arrayContains(silenceArray,user)) { cbjs.arrayRemove(silenceArray,user); var unsilenceMessage = mod + ' has unsilenced ' + user + '.'; notify(unsilenceMessage, 'modsAndEmods'); notify('You have been unsilenced. Your messages are visible in the room again.', user); } else { notifyError(user + ' does not need to be unsilenced.', mod); } } function silenceLast(mod) { if (lastBlocked.length) { if (lastToUseSL == null || lastToUseSL == mod) { //if the person is using it for the first time in at least 5 seconds, or it's the same person again u = lastBlocked.pop(); lastToUseSL = mod; lastToGetSLed = u; silence(u,mod); cb.setTimeout(function() { lastToUseSL = null; lastToGetSLed = null; }, 5000); } else { notifyError(lastToUseSL + ' has just silenced ' + lastToGetSLed + ' using the /silencelast command. Please wait at least 5 seconds before using this command again.', mod); } } else { notifyError('The Bot has not automatically silenced anyone yet, or they have all been silenced already.', mod); } } function setTimer(sec) { clearTimeout(fiveTimeout); clearTimeout(oneTimeout); clearTimeout(timerTimeout); if (sec == 0) { startTime = 0; return; } // 5 minute warning if (sec > 300) { fiveTimeout = setTimeout(function() { notifyThemeBold('Five minutes remaining.'); }, (sec-300)*1000); } // 1 minute warning if (sec > 60) { oneTimeout = setTimeout(function() { notifyThemeBold('One minute remaining.'); }, (sec-60)*1000); } timerTimeout = setTimeout(function() { notifyThemeBold(bullets + ' Time is up! ' + bullets); startTime = 0; }, sec*1000); } function startTimer(min, mod) { var t = parseInt(min); var sec = t*60; if (startTime == 0) { if(t > 0 && t.toString().indexOf('.') == -1) { timeRemaining = sec; timerDuration = sec; startTime = new Date(); setTimer(sec); if(mod != null) { notifyThemeBold(mod + ' has set a Timer for ' + t + ' minutes.'); } } else if(min != null) { notifyError('\'' + min + '\' is not a valid option for /starttimer.\nType "/mbhelp\xa0starttimer" to see how to use /starttimer.',mod); } else if(min == null) { notifyError('You did not enter a valid option for /starttimer.\nType "/mbhelp\xa0starttimer" to see how to use /starttimer.',mod); } } else { if(mod != null) { notifyError('There is a Timer running already.',mod); } } } function addTime(min, mod) { t = parseInt(min); var sec = t*60; if(t > 0 && t.toString().indexOf('.') == -1) { if (startTime != 0) { startTime.setSeconds(startTime.getSeconds() + sec); var currentTime = new Date(); timeRemaining = startTime.getHours()*3600 + startTime.getMinutes()*60 + startTime.getSeconds() + timerDuration - currentTime.getHours()*3600 - currentTime.getMinutes()*60 - currentTime.getSeconds(); setTimer(timeRemaining); notifyThemeBold(mod + ' has has added ' + t + ' minute' + (t == 1 ? '' : 's') + ' to the Timer.'); } else { notifyError('There is no Timer running.',mod); } } else if(min != null) { notifyError('\'' + min + '\' is not a valid option for /addtime.\nType "/mbhelp\xa0addtime" to see how to use /addtime.',mod); } else if(min == null) { notifyError('You did not enter a valid option for /addtime.\nType "/mbhelp\xa0addtime" to see how to use /addtime.',mod); } } function stopTimer(mod) { if (startTime != 0) { setTimer(0); notifyThemeBold(mod + ' has has cancelled the Timer.'); } else { notifyError('There is no Timer running.',mod); } } function doubleDigit(num) { return ("0" + num).slice(-2); } function timeLeft(user) { if(startTime != 0) { var currentTime = new Date(); timeRemaining = startTime.getHours()*3600 + startTime.getMinutes()*60 + startTime.getSeconds() + timerDuration - currentTime.getHours()*3600 - currentTime.getMinutes()*60 - currentTime.getSeconds(); var hours = doubleDigit(Math.floor(timeRemaining/3600)); var minutes = doubleDigit(Math.floor((timeRemaining-hours*3600)/60)); var seconds = doubleDigit(timeRemaining-hours*3600-minutes*60); notify('Time Remaining: ' + hours + ':' + minutes + ':' + seconds, user); } else { notifyError('There is no Timer running.',user); } } function sendNote(message,from) { message = message.split(/\s+/g); //turn the message into an array var m = ''; //build the message for(var i = 0; i < message.length; i++) { if(message[i].match(/^((\\|\/)n(ote)*|\{newline\})$/ig)) { m += '\n'; } else { m += ' ' + message[i]; } } notifyThemePlain(m); } function doWhisper(message, recipient, from, reply) { whis = '[Whisper from ' + from + ']: \xa0'; var w = null; var p; //position where message starts (2 in a whisper, 1 in a reply) if (reply == true) { p = 1; } else { p = 2; } cb.log(p); //build the message for(var i = p; i < message.length; i++) { if(i == p) { w = message[i]; } else { w += ' ' + message[i]; } } whisArray[findWhisper(recipient)][1] = from; if(recipient) { if (w) { notifyBold((whis + w).trim(),recipient); } else { notifyError('You did not specify a Message.', from); } } } function textReplaceWhisper(message, from, reply) { var recipient = null; var m = null; //message var p; //position where message starts (2 in a whisper, 1 in a reply) if (reply == true) { recipient = whisArray[findWhisper(from)][1]; p = 1; } else { recipient = message[1]; p = 2; } if (recipient) { //build the message for(var i = p; i < message.length; i++) { if(i == p) { m = message[i]; } else { m += ' ' + message[i]; } } if (m) { m = '[Whisper to ' + recipient.toLowerCase() + ']: \xa0' + m; } } if (!recipient || !m) { if (reply == true) { m = 'Reply not sent.'; } else { m = 'Whisper not sent.'; } } return m; } function sendWhisper(message, from, mod, whisperLevel) { var recipient; if (message[1]) { recipient = message[1].toLowerCase(); } else { notifyError('You did not enter a Recipient for the Whisper.',from); } if(recipient != from) { if(cbjs.arrayContains(silenceArray,from)) { notifyError('You do not have Whispering Privileges. Your message was not sent.',from) } else if(!cbjs.arrayContains(ignoreArray[findIgnorer(recipient)],from) || mod) { switch(parseInt(ignoreArray[findIgnorer(recipient)][1])) { case 0: doWhisper(message, recipient, from); break; case 1: if(whisperLevel > 1 || mod) { doWhisper(message, recipient, from); } else { notifyError(recipient + ' is ignoring Whispers from grey Users.',from); } break; case 2: if(whisperLevel > 2 || mod) { doWhisper(message, recipient, from); } else { notifyError(recipient + ' is ignoring Whispers from grey and light blue Users who haven\'t tipped at least 200 tokens in the room.',from); } break; case 3: if(whisperLevel > 3 || mod) { doWhisper(message, recipient, from); } else { notifyError(recipient + ' is ignoring Whispers from all Users who haven\'t tipped at least 200 tokens in the room.',from); } break; case 4: if(mod) { doWhisper(message, recipient, from); } else { notifyError(recipient + ' is ignoring Whispers.',from); } break; } } else { notifyError(recipient + ' is ignoring Whispers from you. Your message was not sent.',from) } } else { notifyError('Talking to yourself is a little odd.',from); } } function sendReply(message, from) { var recipient = whisArray[findWhisper(from)][1]; if(cbjs.arrayContains(silenceArray,from)) { notifyError('You do not have Whispering Privileges. Your message was not sent.',from) } if(!cbjs.arrayContains(ignoreArray[findIgnorer(recipient)],from)) { if(recipient != '') { doWhisper(message, recipient, from, true); } else { notifyError('Noone has whispered you.',from); } } else { notifyError(recipient + ' is ignoring Whispers from you. Your message was not sent.',from) } } function ignoreUser(user, from) { if(cbjs.arrayContains(ignoreArray[findIgnorer(from)],user)) { if(user == from) { notifyError('You can\'t ignore yourself.',from); } else { notifyError('You are already ignoring that user\'s Whispers.',from); } } else if(user) { ignoreArray[findIgnorer(from)][ignoreArray[findIgnorer(from)].length] = user; notify('You are now ignoring Whispers from ' + user + '.',from); notify('The Broadcaster and Moderators will always be able to whisper you.',user); } else { notifyError('You did not specify a user to ignore. Type "/mbhelp\xa0ignore" to see how to use /ignore.',from); } } function unignoreUser(user,from) { if(user == from) { notifyError('My, you are an odd one, aren\'t you?', from); } else if(cbjs.arrayContains(ignoreArray[findIgnorer(from)],user)) { cbjs.arrayRemove(ignoreArray[findIgnorer(from)],user); notify('You are no longer ignoring Whispers from ' + user, from); } else if(user) { notifyError(user + ' is not being ignored. There is no need to unignore ' + user, from); } else { notifyError('You did not specify a user to unignore. Type "/mbhelp\xa0unignore" to see how to use /unignore.',from); } } function setTipTitles(user, message) { var prefix = ''; if(cb.settings.kingTipper == 'Yes' && user == currentKing) { prefix = crown + ' '; } var m = prefix + '|' + getUserTotal(user) + '| ' + message; return m; } function emod(ar,user,from) { if(user) { user = user.toLowerCase(); } if(ar == 'add') { if(!cbjs.arrayContains(emodArray,user)) { emodArrayPopulate(user); modAndEmodArrayPopulate(user); modBlockMsgArrayPopulate(user); notify('Bot Moderator Powers have been granted to ' + user,from); notify('You have been granted Bot Moderator Powers',user); } else { notifyError(user + ' has already been granted Bot Moderator Powers.',from); } } else if(ar == 'remove') { if(cbjs.arrayContains(emodArray,user)) { emodArrayDepopulate(user); // modAndEmodArrayDepopulate(user); // modBlockMsgArrayDepopulate(user); notify('Bot Moderator Powers have been removed from ' + user,from); notify('Your Bot Moderator Powers have been removed',user); } else { notifyError(user + ' has not been granted Bot Moderator Powers.',from); } } else if(ar) { notifyError(ar + ' is not a valid option for /emod. Type "/mbhelp\xa0emod" to see how to use /emod.',from); } else { notifyError('You did not enter a valid option for /emod. Type "/mbhelp\xa0emod" to see how to use /emod.',from); } } function blockNotice(ar,user) { if(ar == 'on') { if(!cbjs.arrayContains(modBlockMsgArray,user)) { modBlockMsgArrayPopulate(user); notify('You have turned ON Blocked Message Notices. To turn them back off again, type: /blocknotice\xa0off',user); } else { notifyError('Your Blocked Message Notices are already turned ON',user); } } else if(ar == 'off') { if(cbjs.arrayContains(modBlockMsgArray,user)) { modBlockMsgArrayDepopulate(user); notify('You have turned OFF Blocked Message Notices. To turn them back on again, type: /blocknotice\xa0on',user); } else { notifyError('Your Blocked Message Notices are already turned OFF',user); } } else if(ar) { notifyError(ar + ' is not a valid option for /blocknotice. Type "/mbhelp\xa0blocknotice" to see how to use /blocknotice.',user); } else { notifyError('You did not enter a valid option for /blocknotice. Type "/mbhelp\xa0blocknotice" to see how to use /blocknotice.',user); } } function kingSpam() { clearTimeout(kingTimeout); kingTimeout = setTimeout(kingSpamTimer,kingTimer*minuteMS); } function kingSpamTimer() { if(kingTip < kingMin) { var supplant = kingMin; } else { var supplant = kingTip + 1; } if(kingTipperSpam == 1) { notifyTheme(crown + ' Tip a total of ' + supplant + ' tokens to become the new King! ' + crown); kingSpam(); } } function showLeaders(places, to) { var i; var theLeaders = ''; if (!tipArray.length) { notifyError('No Tips yet', to); return; } sortTipArray(); for (i = 0; i < places && i < tipArray.length; i += 1) { theLeaders += (i ? '\n' : '') + (i + 1) + '.\xa0\xa0' + tipArray[i].sUser + '\xa0\xa0(' + tipArray[i].nTotal + ' tokens)'; } cb.setTimeout(function() { notifyThemeBold(bullets + 'Leader Board' + bullets, to); }, 500); // make sure this happens AFTER command is sent cb.setTimeout(function() { notifyTheme(theLeaders + '\n', to); }, 1500); // wait a second to hopefully make this show up in the proper order } function ldrSpam() { clearTimeout(ldrTimeout); ldrTimeout = setTimeout(ldrSpamTimer,ldrTimer*minuteMS); } function ldrSpamTimer() { if(cb.settings.leaderBoard == 'Yes' && leaderboardSpam == 1) { if (tipArray.length) { showLeaders(3, ''); } ldrSpam(); } } function showLeaderBoard(from) { if(cb.settings.leaderBoard == 'Yes') { showLeaders(10, from); } else { notifyError('The Leaderboard feature is currently not available.',from); } } function notifierSpam() { notifierTimeout = setTimeout(function() { if(notifierSpamTGL == 1) { if (noticeArray.length) { sendRotating(); notifierSpam(); } } }, notifierTimer*minuteMS); } // function notifierSpamTimer() { // if(notifierSpamTGL == 1) { // if (!isBlank(notifierMessage)) { // notify(notifierMessage); // notifierSpam(); // } // } // } function addNotice(m) { if (!isBlank(m)) { m = m.replace(/((\\|\/)n|\{newline\})/ig, "\n"); noticeArray.push(m); } } function parseRotating() { // Parse setup screen for rotating notices addNotice(cb.settings.spamMessage1); addNotice(cb.settings.spamMessage2); addNotice(cb.settings.spamMessage3); addNotice(cb.settings.spamMessage4); addNotice(cb.settings.spamMessage5); } function sendRotating() { // Send the next rotating notice if (noticeArray.length) { // Since we pushed, there should be no gaps, even if there were some // in the GUI. But check that it's valid, just in case. if (noticeArray[noticeNum]) { notifyThemePlain(noticeArray[noticeNum]); } noticeNum += 1; if (noticeNum >= noticeArray.length) { noticeNum = 0; } } } function parseWordlist() { if (!isBlank(cb.settings.customWordlist)) { customWordlistRegex = cb.settings.customWordlist.replace(/^(\s|,|\|)+|(\s|,|\|)+$/gm, ''); //trim leading/trailing spaces, commas, or pipes from string customWordlistRegex = customWordlistRegex.replace(/\s*(,|\|)\s*/gm, '|'); // replace commas or pipes surrounded by spaces with pipes customWordlistRegex = customWordlistRegex.replace(/[^\w|\s]/gm, ' '); // replace anything that's not a letter or a pipe with a space customWordlistRegex = customWordlistRegex.replace(/(\w)/gm, '$1+' ); //add a + between each letter customWordlistRegex = customWordlistRegex.replace(/\s+/gm, '\\s*' ); // replace spaces with \s* } } function doWordlist(msg) { var m = msg.trim().replace(/([^\w\s\u0027\u2019\[\]]|_)/ig, ' '); // Reusable RegEx //split demandverbs into sex demandverbs and "wanna" demand verbs? var demandverbs = '\\b(w+a+n|g+o+i*n|n+e+e+d|(c+a+n+|m+a+y+)\\s(i+|w+e+|[^\\s]*u+)|l+e+t*s*\\s*m+e+(\\s*(s+e+e+|c+))*|g+i+(m+|v+e+)\\s*m+e|p+l+a+y\\w*\\s*w|p+u+t|e+a+t|s+h+o+w|m+o+r+e|f+l+a+s+h|f+e+e+l|r+i+d+e|s+l+i+d|t+a+k+e+\so+u+t|o+p+e+n|c+u+m|s+h+a+k|d+o+g+(y|i)|s+p+(a|u)+n+k|s+q+u*e*z|p+o+u+n+d|s+h+o+v+e|s+m+a+c+k|f+i+n+g+e+r|b+l+o+w|(f|s)+u+c*k|f+c+k|l+i+c+k|m+a+s+t\\w*b+a+t|w+a+n+k|j+e+r+k|(j+|w+h*)a+c+k)\\w*\\b'; var girlyparts = '\\b(p+u+s|v+a+(g|j)|t+w+a+t|k+i+t+t|(c|s)+l+i+t|l+i+p|b+o+b|n+i+p|t+i+t|[^w\\s]*h+o+e|c+u+n+t|f+i+n+g+e+r|m+o+u+t+h|t+o+n+g+u|t+o*u+n+g|a+r+m+\\s*p+i+t)\\w*\\b' + '|'; girlyparts += '\\b(a+s+s|b+u+t+t|c+u+l+o|c+u+l+i+t+o|t+i+t|t+e+t+a|c+o+n+o|g+a+t+i+t+a|c+h+o+c+h+a|b+o+o+b|m+u+f+f|p+u+s+s|b+o+o+t+(y|i)|a+n+u+s|l+e+g+s*)\\b'; var guyparts = '\\b(d+i+c+k|b+o+n+e+r|c+o+c*(c|k)|p+e+n+i+s|m+e+a+t|bbc)\\w*\\b'; var toys = '\\b(d+i+l+d+o|t+o+y|b+u+t+t+\s*p+l+u+g|v+i+b|h*i*t+a+c+h+i)\\w*\\b' var naked = '\\b(n+a*k+e*d+|n+u+d+e+|b+a+r+e+)\\b'; var clothing = '(c+l+o+t+h|b+r+a+|(p+a+n+t+(i|y)*|s+(h|k)+i+r+t|d+r+e+s|s+t*o+(c+k|x)|s+h+o+e)\\w*\\b)'; var removeit = '(r+e+m+o+v+e+|t+a+k+e\\s*o+f+f+)'; var tmi_iam = '\\b(i+.{0,1}a*m+|i+|a+m+|i+s+|s+o+)\\b'; var tmi_adj = '\\b(h+a*r+d|w+e+t|h+o+r+n|t+h+i+c+k)\\w*\\b'; var tmi_intent = '\\b((l+o+v+e|l+u+v|g+o+i+n)\\w*\\s*(2+|t+o+)|l+e+(t|m)+\\s*m+e+|m+a+y+|c+a+n+)\\b' + '|'; tmi_intent += '\\b(g+o+t+|w+a+n|g+o+n|w+i+s+h)\\w*\\b'; var tmi_verb = '\\b(m+a+s+t\\w*b+a+t|w+a+n+k|m+a+s+t+u+r+b+a+r+t+e|m+a+s+t+u+r+b+a+r+m+e|j+e+r+k|(j+|w+h*)a+c+k|t+a+s+t|e+a+t|c+u+m|i+n+s+i+d+e|s+m+e+l+l|s+n+i+f+f|l+i+c+k|(f|s)+u+c*k|f+c+k)\\w*\\b'; var tmi_cum = '\\b(c+u+m|l+e+c+h+e|s+e+m+e+n|l+o+a+d|s+p+e+r+m|b+u+s+t.*n+u+t)\\w*\\b'; // Workaround (Block anything people try to space out to get around rules) var list_workaround = new RegExp('((^|\\s)[^\\s]\\s[^\\s]\\s[^\\s]($|\\s))', 'i'); // this matches 3 or more single spaced-out characters // No sexual words in a REALLY short message var list_directness = new RegExp('\\b(' + girlyparts + '|' + guyparts + '|' + demandverbs + '|' + naked + '|' + tmi_verb + '|' + tmi_cum + '|p+l+e*a*i*(s|z)+e*)\\b', 'i'); // BB var list_bb = new RegExp('\\b(a+m+o+r|h+u+n|b+e+b|h+o+n+e+y|m+a+m+i|m+a+m+a+s+i+t+a|m+a+m+a+c+i+t+a|b+(a|e)*b+(y|e)*)\\b', 'i'); // Rude var list_rude = new RegExp('\\b(h+o+e+s*)\\b|'+ '(c+u+n+t|s+l+u+t|p+u+t+a|s+k+a+n+k|p+u+t+i+t+a|w+h+o+r+e|b+i+t+c+h|n+i+g+g+e+r|t+r+a+n+n+(y|i))' , 'i'); // Sticky/Annoying var list_annoying = new RegExp('\\b([a-g|i-z]*(h+u+)*m+m+h*|u+f+)\\b', 'i'); // Spam var list_spam = new RegExp('(s+k+(y|i)*p+e|s+k+y*p|(f+r+e+e|unlimited).*t+o+k+e+n|t+o+k+e+n.*(f+r+e+e|generator)|erotimo|freecambook|webcam23|hotjenny|fucktubate|gaysexrooms|fastsexnow|alva lanus|Delorge942|Glasford597|sk .*y p e|\\[LEAK(ED)*\\]|SwipeGirls|pornmeds)', 'i'); // Demands var list_demands = new RegExp('\\b('+ 'p+l+e*a*i*(s|z)+|a+n+a+l+|(m+a+s+t\\w*b|s+q\\w*r+t|f+i+s+t|q+u*e+a*f+)\\w*|' + '(' + demandverbs + '|p+l+e*a*i*(s|z)+e*)\\s*(i+t+|(t+h+|d+)a+t+|.*(y*o*u+r*|(f+o*r+|4+)*\\s*m+(y|e|i)+|' + girlyparts + '|' + guyparts + '|' + toys + ')|p+l+e*a*i*(s|z)+e*)|'+ '(' + girlyparts + '|' + guyparts + '|' + toys + '|' + naked + '|g+e+t+|m+(y|e|i)+|p+l+e*a*i*(s|z)+e*).*(' + demandverbs + '|' + naked + '|p+l+e*a*i*(s|z)+e*)' + ')\\b|' + '(' + removeit + '.*' + clothing + ')|(' + clothing + '.*' + removeit + ')|(t+a+k+e.*' + clothing + '.*o+f+f)|' + '(z+o+o+m|s+p+r+e+a+d|f+a+r+t|c+2+c|(w+a+t+c+h|l+o+o+k|o+p+e+n|v+i+e+w|c+l+i+c+k).*(c+a+m|p+r+o+f|r+o+o+m)\\w*)' , 'i'); // TMI var list_tmi = new RegExp('\\b('+ '\\d\\s*(i+n|c+m)\\w*|'+ '(' + demandverbs + ').*(' + tmi_cum +')|' + '(' + tmi_iam + ').*(' + tmi_adj +')|' + '(' + tmi_adj +').*f+o*r+\\s*y*o*u+r*|' + '(' + tmi_iam + '|' + tmi_intent + '|m+(y|e|i)+).*(' + tmi_verb + '|' + tmi_cum + '|' + guyparts +'|\\bs+i+s\\w*)' + ')\\b|' + '(s+t+r+o+k|t+h+r+o+b|c+i+r+c+u+m)' , 'i'); // Feet var list_feet = new RegExp('\\b(s+h+o+e+s*|t+o+e+s*)\\b|' + '(f+e+e+t|p+e+d+i+c+u|f+o+o+t+j+o+b)' , 'i'); // Creepy var list_creepy = new RegExp('(d+a+d+d+y|(s+t+e+p+)*d+a+u+g+h+t+e+r)' , 'i'); // Poo/Pee var list_poopee = new RegExp('\\b(p+o+o+p*\\w*|p+e+e+(i+n+g)*)\\b|' + '(t+u+r+d|p+e+e|e+n+e+m+a|d+e+f+e+c+a+t|(s+h+i+t|c+r+a+p|p+i+s+s+)\\w*\\s*(o|i)+n)' , 'i'); var reason = null; //convert to .match instead? can possibly use more regular-looking regex // .indexOf might be fastest switch(true) { case msg.length <= 1 || msg.length > 500 : reason = 'Length'; break; case m.search(list_workaround) != -1 : reason = 'Workaround'; break; case m.search(list_directness) != -1 && (msg.match(/\s+/gi)||[]).length < 3 : reason = 'Directness'; break; case m.search(list_bb) != -1 : reason = 'BB'; break; case m.search(list_rude) != -1 : reason = 'Rudeness'; break; case m.search(list_annoying) != -1 : reason = 'Annoying'; break; case m.search(list_spam) != -1 : reason = 'Spam'; break; case m.search(list_demands) != -1 : reason = 'Demands'; break; case m.search(list_tmi) != -1 : reason = 'TMI'; break; case m.search(list_feet) != -1 : reason = 'Feet'; break; case m.search(list_creepy) != -1 : reason = 'Creepy'; break; case m.search(list_poopee) != -1 : reason = 'Poo/Pee'; break; } return reason; } function doCustomWordlist(m, u) { // Remove everything but alphanumeric characters to evaluate it var m = m.replace(/[^\w]|_/ig, ''); // Custom Wordlist var customwordlist = new RegExp('(' + customWordlistRegex + ')', 'i'); if ( m.search(customwordlist) != -1 || u.replace(/[^\w]|\d|_/ig, '').search(customwordlist) != -1 ) { return 'blocked'; } } function addWord(m) { cb.settings.customWordlist += ','+m; parseWordlist(); } function niceList(user,mod,ar) { if(user) { user = user.toLowerCase(); if(ar == 'a') { if(!cbjs.arrayContains(niceArray,user)) { niceArrayPopulate(user); notify('You have added ' + user + ' to the Nice List.', mod); notify('You have been added to the Nice List. You will be able to chat and use Graphics, regardless of the Global Room Settings. Thank you for being nice.', user); } else { notifyError(user + ' is already on the Nice List.', mod); } } else if(ar == 'r') { if(cbjs.arrayContains(niceArray,user)) { niceArrayDepopulate(user); notify('You have removed ' + user + ' from the Nice List.', mod); notify('You have been removed from the Nice List. Global Room Settings are now being applied to you again.', user); } else { notifyError(user + ' is not on the Nice List.', mod); } } } else { notifyError('You didn\'t specify a user.\nType "/mbhelp\xa0nicelist" to see how to use the Nice List.',mod); } } function greyList(user,mod,ar) { if(user) { user = user.toLowerCase(); if(ar == 'a') { if(!cbjs.arrayContains(greyArray,user)) { greyArrayPopulate(user); notify('You have added ' + user + ' to the Grey List.', mod); } else { notifyError(user + ' is already on the Grey List.', mod); } } else if(ar == 'r') { if(cbjs.arrayContains(greyArray,user)) { greyArrayDepopulate(user); notify('You have removed ' + user + ' from the Grey List.', mod); } else { notifyError(user + ' is not on the Grey List.', mod); } } } else { notifyError('You didn\'t specify a user.\nType "/mbhelp\xa0greylist" to see how to use the Grey List.',mod); } } function kingSpamToggle(option, mod) { if(cb.settings.kingTipper != 'Yes') { notifyError('The King Tipper feature is currently not available.',mod); } else if(option == 'on') { if(kingTipperSpam == 1) { notifyError('The King Tipper spam is already turned on.',mod); } else { kingTipperSpam = 1; kingSpam(); notify('You have turned on King Tipper spam.',mod); } } else if(option == 'off') { if(kingTipperSpam == 0) { notifyError('The King Tipper spam is already turned off.',mod); } else { kingTipperSpam = 0; notify('You have turned off the King Tipper spam.',mod); } } else if(option != null) { notifyError(option + ' is not a valid option for /kingspam.\nType "/mbhelp\xa0kingspam" to see how to use /kingspam.',mod); } else if(option == null) { notifyError('You did not enter a valid option for /kingspam.\nType "/mbhelp\xa0kingspam" to see how to use /kingspam.',mod); } } function notifierSpamToggle(option, mod) { if(option == 'on') { if(notifierSpamTGL == 1) { notifyError('The Notifier spam is already turned on.',mod); } else { notifierSpamTGL = 1; notify('You have turned on the Notifier spam.',mod); } } else if(option == 'off') { if(notifierSpamTGL == 0) { notifyError('The Notifier spam is already turned off.',mod); } else { notifierSpamTGL = 0; notify('You have turned off the Notifier spam.',mod); } } else if(option != null) { notifyError(option + ' is not a valid option for /notifierspam.\nType "/mbhelp\xa0notifierspam" to see how to use /notifierspam.',mod); } else if(option == null) { notifyError('You did not enter a valid option for /notifierspam.\nType "/mbhelp\xa0notifierspam" to see how to use /notifierspam.',mod); } } function leaderboardSpamToggle(option, mod) { if(option == 'on') { if(leaderboardSpam == 1) { notifyError('The Leaderboard spam is already turned on.',mod); } else { leaderboardSpam = 1; ldrSpam(); notify('You have turned on the Leaderboard spam.',mod); } } else if(option == 'off') { if(leaderboardSpam == 0) { notifyError('The Leaderboard spam is already turned off.',mod); } else { leaderboardSpam = 0; notify('You have turned off the Leaderboard spam.',mod); } } else if(option != null) { notifyError(option + ' is not a valid option for /leaderboardspam.\nType "/mbhelp\xa0leaderboardspam" to see how to use /leaderboardspam.',mod); } else if(option == null) { notifyError('You did not enter a valid option for /leaderboardspam.\nType "/mbhelp\xa0leaderboardspam" to see how to use /leaderboardspam.',mod); } } function isBlank(cbsetting) { var s; if(cbsetting) { s = cbsetting.trim(); } if(s == null || s == '' || s.substr(0,9) == '[Optional') { return true; } else { return false; } } function isValidColor(color) { var c = color; var cString = '0123456789abcdefABCDEF'; var valid = true; if (c.charAt(0) == '#') { c = c.substr(1); } if (c && c.length == 6) { for(var i = 0; i < 6; i++) { if(cString.indexOf(c.charAt(i)) == -1) { valid = false; } else { } } } else { valid = false; } if(valid) { return true; } else { notifyErrorBold('"' + color + '" is not a valid Colour Option.', roomHost); notifyError( 'Use color-hex.com to find the code for the colour you want.\n' + 'Reverting to default colour.', roomHost); return false; } } function setColor() { var c = cb.settings.colorscheme; var t = cb.settings.darkcolor.trim(); var b = cb.settings.lightcolor.trim(); var textvalid = true; var bgvalid = true; if (c && c.substr(0,6) == 'Custom') { if(isBlank(b) && isBlank(t)) { notifyErrorBold('You selected a custom Colour Scheme but you didn\'t fill in the colours. Reverted to default Colour Scheme.', roomHost); } else if (isBlank(t)) { notifyErrorBold('You selected a custom Colour Scheme but you didn\'t select a text colour. Reverted to default Colour Scheme.', roomHost); } else if (isBlank(b) && !isBlank(t)) { if (t && t.charAt(0) != '#') { t = '#' + t; } if (isValidColor(t)) { theme_dark = t; theme_light = white; } } else if (!isBlank(b) && !isBlank(t) ) { if (t && t.charAt(0) != '#') { t = '#' + t; } if (b && b.charAt(0) != '#') { b = '#' + b; } if (isValidColor(t) && isValidColor(b)) { theme_dark = t; theme_light = b; } } } else { if (!isBlank(t) || !isBlank(b)) { notifyErrorBold('You defined custom colours, but your Colour Scheme is set to "' + c +'". In order to use your custom colours, please set your Colour Scheme to "Custom"', roomHost); } if (c == 'Purple') { theme_dark = purple_dark; theme_light = purple_light; } else if (c == 'Pink') { theme_dark = pink_dark; theme_light = pink_light; } else if (c == 'Orange') { theme_dark = orange_dark; theme_light = orange_light; } else if (c == 'Red') { theme_dark = red_dark; theme_light = red_light; } else if (c == 'Green') { theme_dark = green_dark; theme_light = green_light; } else if (c == 'Teal') { theme_dark = teal_dark; theme_light = teal_light; } else if (c == 'Grey') { theme_dark = grey_dark; theme_light = grey_light; } } } function help(option,from) { var valid = 0; if(option == null){ option = ''; } switch(option) { case '': { valid = 1; notifyBold('Sasha\'s Multi Bot Help Menu',from); notify( 'Type "/mbhelp\xa0x", where x is one of the following choices, for more detailed information.' + '\nEx: /mbhelp\xa0commands' ,from); notifyPlain( 'commands\n' + 'nicelist\n' + 'greylist\n' + 'about' ,from); break; } case 'commands': { valid = 1; notifyBold('Sasha\'s Multi Bot Command List',from); notify( 'Type "/mbhelp\xa0x", where x is one of the following commands, for more detailed information.' + '\nEx: /mbhelp\xa0silencelevel' ,from); notifyPlain( '/silencelevel\n' + '/graphiclevel\n' + '/silence\n' + '/unsilence\n' + '/starttimer\n' + '/addtime\n' + '/timeleft\n' + '/note\n' + '/whisper\n' + '/reply\n' + '/addnice\n' + '/removenice\n' + '/addgrey\n' + '/removegrey\n' + '/blocknotice\n' + '/addword\n' // + '\n/notifierspam' ,from); break; } case 'nicelist': { notifyBold('The Nice List',from); notify('Sometimes, there are Users whose comments are desirable, but they either do not have tokens or do not tip frequently. ' + 'When rooms get rowdy, the Broadcaster and Mods are forced to do things like silence users without tokens, or those who have not tipped; these groups often include users whose comments the Broadcaster would like to see. ' + 'To fix this problem, the Broadcaster and Mods can add users to the Nice List. ' + 'Users who are on the Nice List can send messages regardless of the Global Silence Setting.',from); valid = 1; break; } case 'greylist': { valid = 1; notifyBold('The Grey List',from); notify('Sometimes, there are Users whose comments are annoying, although they have tokens, and might even tip. ' + 'It isn\'t always desirable to silence these Users entirely, especially if they\'ve been tipping, but it can be useful to apply the same Word List Restrictions that apply to grey Users, so that the more annoying messages don\'t get through to the room. ' + 'To fix this problem, the Broadcaster and Mods can add Users to the Grey List. ' + 'Users who are on the Grey List will have their messages subjected to the Word List Restrictions that apply to grey Users.',from); notify('',from); break; } case 'about': { valid = 1; notifyBold('About Sasha\'s Multi Bot',from); notify('Sasha\'s Multi Bot is a continuing development of Bomb Bot Ultra by adambomb01.' + '\nThe original Ultra Bot, upon which Bomb Bot Ultra is based, was written by Justin of the Chaturbate couple britney_and_justin.' + '\nComments, suggestions, requests, and bug reports can be communicated by either emailing gaius@live.de, ' + 'or by posting comments on Sasha\'s Multi Bot\'s page at chaturbate.com/bots.' + '\nThe purpose of Sasha\'s Multi Bot is to make the life of Sasha and her Moderators as easy as possible. ' + 'It adds popular features such as King Tipper, Leaderboard, and Notifier, as well as pre-silencing abusive messages, ' + 'and allows Private Messages to be sent as Whispers in the main chat window.',from); notify('',from); break; } case 'silencelevel': { valid = 1; notifyBold('/silencelevel Help',from); notify('/silencelevel is a command that is usable by the Broadcaster and by Moderators.' + '\nThe syntax for using silencelevel is "/silencelevel\xa0x", where x is a number between 0 and 4.' + '\nSetting the Silence Level to 0 will grant Chat Privileges to all Users, ' + 'setting it to 1 will revoke Chat Privileges from grey Users, ' + 'setting it to 2 will revoke Chat Privileges from grey and light blue Users, ' + 'setting it to 3 will revoke Chat Privileges from Users who have not tipped at least 10 tokens, ' + 'and setting it to 4 will revoke Chat Privileges from everyone other than Mods and Fans.' + '\nThe default setting for /silencelevel is 0.' + '\nThe Broadcaster, Moderators, and Fan Club Members are unaffected by the Silence Level.',from); notify('',from); break; } case 'graphiclevel': { valid = 1; notifyBold('/graphiclevel Help',from); notify('/graphiclevel is a command that is usable by the Broadcaster and by Moderators.' + '\nThe syntax for using graphiclevel is "/graphiclevel\xa0x", where x is a number between 0 and 4.' + '\nSetting the Graphic Level to 0 will grant Graphics Privileges to all Users, ' + 'setting it to 1 will revoke Graphics Privileges from grey Users, ' + 'setting it to 2 will revoke Graphics Privileges from grey and light blue Users, ' + 'setting it to 3 will revoke Graphics Privileges from Users who have not tipped at least 25 tokens, ' + 'and setting it to 4 will revoke Graphic Privileges from everyone other than Mods and Fans.' + '\nThe default setting for /graphiclevel is 1.' + '\nThe Broadcaster, Moderators, and Fan Club Members are unaffected by the Graphic Level.',from); notify('',from); break; } case 'silence': { valid = 1; notifyBold('/silence Help',from); notify('/silence is a command that is usable by the Broadcaster and by Moderators.' + '\nThe syntax for using silence is "/silence x", where x is the username of the user you want to silence.' + '\nThe effect of /silence is the same as Chaturbate\'s silence feature, ' + 'except that it lasts for the duration of this Bot being active instead of for six hours.' + '\nThe effect of /silence can be reversed by using the command /unsilence.',from); notify('',from); break; } case 'unsilence': { valid = 1; notifyBold('/unsilence Help',from); notify('/unsilence is a command that is usable by the Broadcaster and by Moderators.' + '\nThe syntax for using unsilence is "/unsilence x", where x is the username of the User you want to unsilence.' + '\nunsilence restores Chat Privileges to a User who was previously silenced.' + '\nNOTE: /unsilence will NOT undo the effect of Chaturbate\'s silence feature!' + '\n/unsilence will ONLY reverse the effect of /silence!',from); notify('',from); break; } case 'starttimer': { valid = 1; notifyBold('/starttimer Help',from); notify('/starttimer is a command that is usable by the Broadcaster and by Moderators.' + '\nThe syntax for using starttimer is "/starttimer x", where x is the desired duration of the timer in minutes.' + '\n/starttimer will accept whole numbers only.' + '\nThe Timer will make announcements at five minutes remaining and at one minute remaining.' + '\n/addtime can be used to add time to a currently running Timer.' + '\n/timeleft can be used to display the amount of time remaining on the Timer.',from); notify('',from); break; } case 'addtime': { valid = 1; notifyBold('/addtime Help',from); notify('/addtime is a command that is usable by the Broadcaster and by Moderators.' + '\nThe syntax for using addtime is "/addtime\xa0x", where x is the amount of time (in minutes) you want to add.' + '\n/addtime will accept whole numbers only.' + '\nSee the Help Section for "/starttimer" for more information on Timers.',from); notify('',from); break; } case 'timeleft': { valid = 1; notifyBold('/timeleft Help',from); notify('/timeleft is a command that is usable by everyone.' + '\nThe syntax for using timeleft is /timeleft' + '\n/timeleft will display the amount of time left on the Timer in the format 00:00:00' + '\nSee the Help Section for "/starttimer" for more information on Timers.',from); notify('',from); break; } case 'note': { valid = 1; notifyBold('/note Help',from); notify('/note is a command that is usable by the Broadcaster and by Moderators.' + '\nThe syntax for using note is "/note\xa0x", where x is the message you want to send.' + '\n/note, /notice, and /n are valid commands that will send a notice.' + '\nA Notice is a Public Notification that will be sent to everyone in the main chat window.',from); notify('',from); break; } case 'whisper': { valid = 1; notifyBold('/whisper Help',from); notify('/whisper is a command that is usable by everyone.' + '\nThe syntax for using whisper is "/whisper\xa0x\xa0y", where x is the username of the User you want to send a Whisper and y is the message you want to send.' + '\n/whisper, /w, /tell, /t, and /pm are valid commands that will send a Whisper.' + '\nA Whisper is a Private Message that will be sent in the main chat window.' + '\nOther related commands are /reply, /ignore, /unignore, and /ignorelevel.',from); notify('',from); break; } case 'reply': { valid = 1; notifyBold('/reply Help',from); notify('/reply is a command that is usable by everyone.' + '\nThe syntax for using reply is "/reply\xa0x", where x is message that you want to whisper to the User who most recently sent a Whisper to you.' + '\n/reply and /r are valid commands that will send a Whisper in reply.' + '\nSee the Help Section for "/whisper" for more information on Whispers.' + '\nOther related commands are /whisper, /ignore, /unignore, and /ignorelevel.',from); notify('',from); break; } case 'ignore': { valid = 1; notifyBold('/ignore Help',from); notify('/ignore is a command that is usable by everyone.' + '\nThe syntax for using ignore is "/ignore\xa0x", where x is the User from whom you wish to ignore Whispers.' + '\nignoring a User will prevent him from sending you Whispers, but it will not prevent him from talking normally in chat.' + '\n/unignore will reverse the effect of /ignore.' + '\nSee the Help Section for "/whisper" for more information on Whispers.' + '\nOther related commands are /whisper, /reply, /unignore, and /ignorelevel.',from); notify('',from); break; } case 'unignore': { valid = 1; notifyBold('/unignore Help',from); notify('/unignore is a command that is usable by everyone.' + '\nThe syntax for using unignore is "/unignore\xa0x", where x is the User you wish to remove from your Ignore List.' + '\nSee the Help Section for "/ignore" for more information on Ignoring Users.' + '\nSee the Help Section for "/whisper" for more information on Whispers.' + '\nOther related commands are /whisper, /reply, /ignore, and /ignorelevel.',from); notify('',from); break; } case 'ignorelevel': { valid = 1; notifyBold('/ignorelevel Help',from); notify('/ignorelevel is a command that determines which Users you accept Whispers from. It is usable by everyone.' + '\nThe syntax for using ignorelevel is "/ignorelevel\xa0x", where x is a number between 0 and 4.' + '\nSetting it to 0 will allow all Users to send you Whispers.' + '\nSetting it to 1 will prevent grey Users from sending you Whispers.' + '\nSetting it to 2 will prevent grey and light blue Users from sending you Whispers.' + '\nSetting it to 3 will prevent Users who have not tipped at least 200 tokens from sending you Whispers.' + '\nSetting it to 4 will prevent all Users from sending you Whispers.' + '\nThe Broadcaster and Moderators can send Whispers regardless of the Whisper Level.' + '\nThe default setting for /ignorelevel is 4 for the Broadcaster, and 0 for everyone else. (The Broadcaster\'s level is set higher by default, to prevent abuse of this feature.)' + '\nSee the Help Section for "/whisper" for more information on Whispers' + '\nOther related commands are /whisper, /reply, /ignore, and /unignore.',from); notify('',from); break; } case 'emod': { valid = 1; notifyBold('/emod Help',from); notify('/emod is a command that is usable by the Broadcaster and by Moderators.' + '\nThe syntax for using emod is "/emod\xa0x\xa0y", where x is either "add" or "remove" and y is the username of the User you want to either grant or revoke Bot Moderator Powers.' + '\n/emod allows Moderators to quickly grant other users access to moderator-only commands in the event that he is having difficulty controlling the room by himself.' + '\nBot Moderators have access to all moderator-only commands with the exceptions of /emod, /addnice, and /removenice.',from); notify('',from); break; } case 'blocknotice': { valid = 1; notifyBold('/blocknotice Help',from); notify('/blocknotice is a command that is usable by the Broadcaster and by Moderators.' + '\nThe syntax for using blocknotice is "/blocknotice\xa0x", where x is either "on" or "off".' + '\n/blocknotice toggles the Blocked Message Notices that appear by default for Moderators when the Word List is being used' + '\nThe Blocked Message Notifications are toggled on a per-User basis. (Toggling it for yourself does not toggle it for everyone.)',from); notify('',from); break; } case 'addnice': { valid = 1; notifyBold('/addnice Help',from); notify('/addnice is a command that is usable by the Broadcaster and by Moderators.' + '\nThe syntax for using addnice is "/addnice x", where x is the username of the User you want to add to the Nice List.' + '\nAdding a User to the Nice List guarantees that User Chat and Graphics Privileges, regardless of the Silence, Graphics, and Ignore Level Settings. ' + 'Using /silence or /ignore will still silence or ignore a User on the Nice List.' + '\nUsers can be removed from the Nice List by using the command /removenice.' + '\nSee the Help Sections for "/silencelevel", "/graphiclevel", and "/ignorelevel" for more information on the Global Settings, or the Help Section for "/nicelist" for more information on the Nice List.',from); notify('',from); break; } case 'removenice': { valid = 1; notifyBold('/removenice Help',from); notify('/removenice is a command that is usable by the Broadcaster and by Moderators.' + '\nThe syntax for using removenice is "/removenice x", where x is the username of the User you want to remove from the Nice List.' + '\nSee the Help Section for "/nicelist" for more information on the Nice List.',from); notify('',from); break; } case 'addgrey': case 'addgray': { valid = 1; notifyBold('/addgrey Help',from); notify('/addgrey is a command that is usable by the Broadcaster and by Moderators.' + '\nThe syntax for using addgrey is "/addgrey x", where x is the username of the User you want to add to the Grey List.' + '\nAdding a User to the Grey List subjects them to the same Word List Restrictions that apply to grey Users. ' + '\nUsers can be removed from the Grey List by using the command /removegrey.' + '\nSee the Help Section for "/greylist" for more information on the Grey List.',from); notify('',from); break; } case 'removegrey': case 'removegray': { valid = 1; notifyBold('/removegrey Help',from); notify('/removegrey is a command that is usable by the Broadcaster and by Moderators.' + '\nThe syntax for using removegrey is "/removegrey x", where x is the username of the User you want to remove from the Grey List.' + '\nSee the Help Section for "/greylist" for more information on the Grey List.',from); notify('',from); break; } case 'mbhelp': { valid = 1; notifyBold('/mbhelp\xa0Help',from); notify('/mbhelp\xa0is a command that is usable by everyone.' + '\nThe syntax for using mbhelp is "/mbhelp\xa0x", where x is the subsection of the help menu that you want to access.',from); notify('',from); break; } case 'leaderboard': { valid = 1; notifyBold('/leaderboard Help',from); notify('/leaderboard is a command that is usable by everyone.' + '\nThe syntax for using Leaderboard is "/leaderboard".' + '\n/leaderboard shows the Top Three Tippers of the current session.',from); notify('',from); break; } case 'kingspam': { valid = 1; notifyBold('/kingspam Help',from); notify('/kingspam is a command that is usable by the Broadcaster and by Moderators.' + '\nThe syntax for using kingspam is /kingspam x, where x is either on or off. ' + 'Using this command toggles the spamming of the message "Tip XXX tokens to become the new King!"',from); notify('',from); break; } // case 'notifierspam': { // valid = 1; // notifyBold('/notifierspam Help',from); // notify('/notifierspam is a command that is usable by the Broadcaster and by Moderators.' + // '\nThe syntax for using notifierspam is /notifierspam x, where x is either on or off. ' + // 'Using this command toggles the spamming of the Periodic Messages defined by the Broadcaster.',from); // notify('',from); // break; // } case 'leaderboardspam': { valid = 1; notifyBold('/leaderboardspam Help',from); notify('/leaderboardspam is a command that is usable by the Broadcaster and by Moderators.' + '\nThe syntax for using leaderboardspam is /leaderboardspam x, where x is either on or off. ' + 'Using this command toggles the spamming of the Top Three Tippers.',from); notify('',from); break; } } if(valid == 0) { notifyError(option + ' is not a valid subsection of the help menu. Type "/mbhelp" to access the main help menu.',from); } } /************************************************** onMessage **************************************************/ cb.onMessage(function (msg) { var silenced = 0; //1 = user is already silenced var messageBlocked = 0; // used to determine whether a message gets blocked based on wordlist var graphicsBlocked = 0; // used to determine whether a user can use graphics var imageReplaced = 0; var symbolString = '~`!@#$%^&*()_-+={[}]|\\:;"\'<,>.?/'; // Message vars var msgString = msg['m'].trim(); var isCommand = (msgString.charAt(0) == '/'); var isKenoCmd = (msgString.charAt(0) == '!'); var message = msgString.split(/\s+/g); //turn the message into an array // User vars var u = msg.user; var hasTipped = findTipper(u) > -1 && Number.parseInt(tipArray[findTipper(u)].nTotal) > 0; var hasTipped10 = findTipper(u) > -1 && Number.parseInt(tipArray[findTipper(u)].nTotal) > 9; var hasTipped25 = findTipper(u) > -1 && Number.parseInt(tipArray[findTipper(u)].nTotal) > 24; var hasTipped200 = findTipper(u) > -1 && Number.parseInt(tipArray[findTipper(u)].nTotal) > 199; var isHost = (u == cb.room_slug); var isDev = (u == dev); var isMod = msg.is_mod; var isFan = msg.in_fanclub; var isEmod = cbjs.arrayContains(emodArray, u); var isNice = cbjs.arrayContains(niceArray, u); var isGreyish = cbjs.arrayContains(greyArray, u); var isSilenced = cbjs.arrayContains(silenceArray, u); var isGrey = (!msg.has_tokens && !hasTipped && !msg.tipped_recently); // technically MAY include some light blues who have tipped down to zero, but i don't think so var isBlueUp = (msg.tipped_recently || hasTipped); // Add mod to modArray if(isMod) { if (!cbjs.arrayContains(modArray,u)) { modArrayPopulate(u); modAndEmodArrayPopulate(u); if(cb.settings.wordlistShowModerators == 'Yes') { modBlockMsgArrayPopulate(u); } } } // Silencing if(isSilenced && !(isHost || isMod || isEmod || isNice) && silenced == 0) { msg['X-Spam'] = true; silenced = 1; notifyError('Your message was not sent because you have been silenced. Be nice and adhere to the Room Rules.',u); } // Silence Levels function doSilenceLevel(level) { var silenceNotice = 'The Silence Level has been set to ' + level + '. Your message was not sent.\n'; silenceNotice += 'For more information about Silence Levels, type "/mbhelp silencelevel"\n'; silenceNotice += 'Please enjoy the show :smile'; msg['X-Spam'] = true; silenced = 1; notifyError(silenceNotice,u); } if(silenceLevel > 0 && !(isHost || isMod || isEmod || isFan || isNice) && silenced == 0) { switch(silenceLevel) { case 1: if(isGrey) { doSilenceLevel(silenceLevel); } break; case 2: if(!isBlueUp) { doSilenceLevel(silenceLevel); } break; case 3: if(!hasTipped10) { doSilenceLevel(silenceLevel); } break; case 4: doSilenceLevel(silenceLevel); break; } } function replaceImage() { for(var i = 0; i < message.length; i++) { if(message[i].charAt(0) == ':') { if(!message[i].match(/^(:(-?|o?)(\)|\(|}|{|P|D|3|b|O|0|S|X|\$|\/|\\|\||\*))$/ig)) { // common emoticons that begin with a ":" character //replace images msg['m'] = msg['m'].replace(/:[^\s]+/g, function (match) { return '[IMG: ' + match.slice(1) + ']'; }); msg['X-Spam'] = true; return true; imageReplaced = 1; } else { return false; } } } } // Graphic Levels function doGraphicLevel(level) { var graphicNotice = 'The Graphics Level has been set to ' + level + '. Your image was not sent.\n'; graphicNotice += 'For more information about Graphics Levels, type "/mbhelp graphiclevel"\n'; graphicNotice += 'Please enjoy the show :smile'; if (replaceImage()) { notifyError(graphicNotice,u); graphicsBlocked = 1; } } if(graphicLevel > 0 && !(isHost || isMod || isEmod || isFan || isNice) && silenced == 0) { switch(graphicLevel) { case 1: if(isGrey || isGreyish) { doGraphicLevel(graphicLevel); } break; case 2: if(!isBlueUp || isGreyish) { doGraphicLevel(graphicLevel); } break; case 3: if(!hasTipped25 || isGreyish) { doGraphicLevel(graphicLevel); } break; case 4: doGraphicLevel(graphicLevel); break; } } // Blocked Wordlists function blockMessage(reason) { msg['X-Spam'] = true; messageBlocked = 1; if(!isCommand && !isSilenced && silenced == 0) { silenced = 1; // //replace images -- we may not want to see the images they unsuccessfully try to use if (imageReplaced == 0) { replaceImage(); } var blockedmsg = msg['m']; for (mod = 0; mod < modAndEmodArray.length; mod++) { thisMod = modAndEmodArray[mod]; if(cbjs.arrayContains(modBlockMsgArray,thisMod)) { notifyErrorBold(bullets + 'MESSAGE BLOCKED: ' + reason + bullets, thisMod); notifyError(msg['user']+': '+blockedmsg.substring(0, 500), thisMod); } } if(cb.settings.wordlistNotice == 'Yes') { notifyError('Your message was not sent because it was flagged by the Word List. No dirtytalk or requests in the public chat, only in Tip Notes or PMs, please. Be nice and don\'t request without tipping.',u); } lastBlocked.push(msg['user']); if (lastBlocked.length == 10) { lastBlocked.shift(); } } } if(!(isHost || isMod || isEmod || isNice)) { // Custom wordlist stuff if (cb.settings.customWordlistToggle == 'Yes' && customWordlistRegex != '') { if (isGrey || isGreyish || cb.settings.customWordlistLevel == 'Everyone') { if (doCustomWordlist(msgString, u) == 'blocked') { blockMessage('Wordlist'); } } } // Regular wordlist stuff if(cb.settings.wordlistToggle == 'Yes') { if (isGrey || isGreyish || cb.settings.wordlistLevel == 'Everyone') { var blocked = doWordlist(msgString); if (blocked) { blockMessage(blocked); } } } } // Commands if(isCommand) { msg['X-Spam'] = true; //Don't send message to chat msg['background'] = bb_lt_light; msg['c'] = bb_lt_dark; var validCmd = 0; var command; // Slash + first word is the command var param; // Anything after the first word is the parameter var split_index; // Postion of the first space character // Split split_index = msgString.indexOf(' '); // Find first space character if (split_index > -1) { // Message might have a parameter (could just be padding) command = msgString.substr(0, split_index).toLowerCase(); // substr (start index, length) param = msgString.substring(split_index + 1).trim(); // Could be empty } else { // Message is a command only command = msgString.toLowerCase(); param = null; } // Host and Mod commands if(validCmd == 0 && (isHost || isMod || isEmod)) { validCmd = 1; switch(command) { case '/note': case '/notice': case '/n': { if (param) { sendNote(param, u); msg['m'] = bullets + 'NOTICE SENT' + bullets; msg['c'] = theme_dark; } else { notifyError('You didn\'t write a Notice',u); } break; } case '/emod': { emod(message[1],message[2],u); break; } case '/tiptotal': { notify('Total tips: ' + tipTotal + ' tokens',u) break; } default: { validCmd = 0; break; } } } // Host, Mod, and Emod commands if(validCmd == 0 && (isHost || isMod || isEmod)) { validCmd = 1; switch(command) { case '/blocknotice': { blockNotice(param,u); break; } case '/silencelevel': { setSilenceLevel(param,u); break; } case '/greysoff': case '/greyoff': case '/graysoff': case '/grayoff': case '/silencegreys': case '/silencegrays': { setSilenceLevel(1,u); break; } case '/greyson': case '/greyon': case '/grayson': case '/grayon': case '/unsilencegreys': case '/unsilencegrays': { setSilenceLevel(0,u); break; } case '/graphiclevel': { setGraphicLevel(param,u); break; } case '/silence': { silence(param,u); break; } case '/unsilence': { unsilence(param,u); break; } case '/silencelast': case '/sl': { silenceLast(u); break; } case '/addnice': { niceList(param,u,'a'); break; } case '/removenice': { niceList(param,u,'r'); break; } case '/addgrey': case '/addgray': { greyList(param,u,'a'); break; } case '/removegrey': case '/removegray': { greyList(param,u,'r'); break; } case '/starttimer': { startTimer(param,u); break; } case '/addtime': { addTime(param,u); break; } case '/stoptimer': case '/endtimer': { stopTimer(u); break; } case '/kingspam': { kingSpamToggle(param,u) break; } case '/notifierspam': { notifierSpamToggle(param,u) break; } case '/leaderboardspam': { leaderboardSpamToggle(param,u) break; } // case '/notifiermessage': { // if(message[1] == '' || message[1] == null) { // notifyError('You must enter a new message for the Notifier feature. If you want to disable the Notifications, enter /notifierspam off.',u); // } // else { // notifierMessage = msg['m'].substring(16).trim(); // notify('You have set the Notifier spam message to: ' + notifierMessage,u); // } // break; // } case '/shownotices': { var noticeString = ''; if (noticeArray.length) { for (var i = 0; i < noticeArray.length; i++) { if (i > 0) { noticeString += '\n-------------------------\n'; } noticeString += '\u2022 Rotating Notice #' + (i + 1) + ': \n'; noticeString += noticeArray[i]; } notifyPlain(noticeString,u); } else { notifyPlain('There are no Rotating Notices set.',u); } break; } case '/removenotice': case '/removenote': { var n = parseInt(param); if (n > 0 && n <= (noticeArray.length)) { noticeArray.splice((n-1), 1); notify('You have removed Notice #' + n,u); } else if(param) { notifyError('\'' + param + '\' is not a valid Notice.',u); } else { notifyError('You did not enter a valid Notice.',u); } break; } case '/addnotice': case '/addnote': { var noticeArrayLength = noticeArray.length; if(param) { addNotice(param); if (!noticeArrayLength) { sendRotating(); notifierSpam(); } notify('You have successfully added a new Notice.',u); } else { notifyError('You did not enter a valid Notice.',u); } break; } case '/addword': { if(param) { addWord(param); notify('You have successfully added \'' + param + '\' to the Custom Word List.',u); } else { notifyError('You did not enter a valid word.',u); } break; } case '/noticetimer': { var n = parseInt(param); if (n > 0) { notifierTimer = n; // clearTimeout(notifierTimeout); // notifierSpam(); notify('Rotating Notices will now display every ' + n + ' minutes.',u); } else if (param) { notifyError('\'' + param + '\' is not a valid value for /noticetimer.',u); } else { notifyError('You did not enter a valid value for /noticetimer.',u); } break; } default: { validCmd = 0; break; } } } // Everybody else commands if (validCmd == 0) { validCmd = 1; switch(command) { case '/mbhelp': case '/ubhelp': { help(param,u); break; } case '/leaderboard': { showLeaderBoard(u); break; } case '/timeleft': { timeLeft(msg['user']); break; } case '/whisper': case '/w': case '/tell': case '/t': case '/pm': case '/reply': case '/r': case '/ignorelevel': case '/ignore': case '/unignore': { if(cb.settings.whisperToggle.substr(0,2) == 'No') { notifyError('The Whisper feature has not been enabled.',u); } else if (command.match(/\b(whisper|w|tell|t|pm)\b/ig)) { var whisperLevel; if(isGrey && silenced == 0) { whisperLevel = 1; } else if(!isBlueUp && silenced == 0) { whisperLevel = 2; } else if(!hasTipped200 && silenced == 0) { whisperLevel = 3; } else { whisperLevel = 4; } if(isHost || isMod || isEmod || isNice) { sendWhisper(message,u,true,whisperLevel); msg['m'] = textReplaceWhisper(message,u); msg['background'] = bb_light; msg['c'] = bb_dark; } else if (messageBlocked == 0 && graphicsBlocked == 0) { sendWhisper(message,u,false,whisperLevel); msg['m'] = textReplaceWhisper(message,u); msg['background'] = bb_light; msg['c'] = bb_dark; } else { msg['m'] = 'Whisper not sent.'; msg['background'] = '#EEE'; msg['c'] = '#AAA'; } } else if (command.match(/\b(reply|r)\b/ig)) { if (messageBlocked == 0 && graphicsBlocked == 0) { sendReply(message,u); msg['m'] = textReplaceWhisper(message,u,true); msg['background'] = bb_light; msg['c'] = bb_dark; } else { msg['m'] = 'Reply not sent.'; msg['background'] = '#EEE'; msg['c'] = '#AAA'; } } else if (command == ('/ignorelevel')) { setIgnoreLevel(param,u); } else if (command == ('/ignore')) { ignoreUser(param,u); } else if (command == ('/unignore')) { unignoreUser(param,u); } break; } //debugging command to show variables case '/showvar': { if(isDev) { var v = param; function showVar(){ this.debug = function(sVar){ try { notifyPlain(eval(sVar), dev); } catch (e) { notifyPlain('no such variable', dev); } } } var displayVar = new showVar(); displayVar.debug(v); } else { validCmd = 0; } break; } default: { validCmd = 0; break; } } } if (validCmd == 0) { msg['background'] = '#EEE'; msg['c'] = '#AAA'; //Give Permission notice if (command.match(/\b(note|notice|n|emod|addnice|removenice|addgrey|addgray|removegrey|removegray|tiptotal|blocknotice|silencelevel|greysoff|greyoff|greyson|greyon|graphiclevel|silence|unsilence|starttimer|addtime|stoptimer|endtimer|kingspam|notifierspam|leaderboardspam|shownotices|removenotice|removenote|addnotice|addnote|noticetimer)\b/ig)) { notifyError('Only the Broadcaster and Moderators may use the "' + command + '" command.\nType "/mbhelp\xa0commands" to see a full list of available commands.',u); } //Make sure it doesn't call errors for common commands used by other apps/bots else if (command.match(/\b(b|p|lb|rewards|prizes|winners|startshow|showtimeleft|printtime|addshowtime|adduser|changegoal|hide|unhide|selltickets|uacommands|luhelp|levels)\b/ig)) { // do nothing } //Otherwise, it means the user entered an invalid command else if(cb.settings.invalidToggle == 'Yes') { notifyError('"' + command + '" is not a valid command.\nType "/mbhelp\xa0commands" to see a full list of the available commands.',u); } } } if(!(isHost || isMod || isEmod || isNice)) { //stop people from sending messages in all caps if (cb.settings.capsToggle == 'Yes' || (cb.settings.capsToggle == 'Only for greys' && (isGrey || isGreyish))) { if(msg['m'] == msg['m'].toUpperCase() && msg['m'].toUpperCase() != msg['m'].toLowerCase()) { for(var i = 0; i < msg['m'].length; i++) { if(symbolString.indexOf(msg['m'].charAt(i)) == -1) { msg['m'] = msg['m'].replace(/[^\s]+/g, function (match) { return match.indexOf(':') === 0 ? match : match.toLowerCase(); }); } } } } //convert sticky keys to max of 4 letters if (cb.settings.stickyToggle == 'Yes' || (cb.settings.stickyToggle == 'Only for greys' && (isGrey || isGreyish))) { if(msg['m'].match(/(.)\1{3,}/ig)) { message = msg['m'].trim().split(/\s+/g); // make sure we're working with the current version of our message var m = ''; for(var i = 0; i < message.length; i++) { if(i >= 0) { m += ' '; } if ((message[i].charAt(0) == ':')) { m += message[i]; } else { m += message[i].replace(/(.)\1{3,}/ig, '$1$1$1'); } } msg['m'] = m; } } } //tip titles, if turned on, as well as king's crown if(cb.settings.tipTitles == 'Yes' && hasTipped && !isCommand && !isKenoCmd) { msg['m'] = setTipTitles(msg['user'],msg['m']); } return msg; }); /************************************************** onTip **************************************************/ cb.onTip(function (tip) { var thisTip = parseInt(tip['amount']); var thisTipper = tip['from_user']; var userTotal = addTip(thisTipper, thisTip); tipNote = tip['message']; tipTotal += thisTip; if(cb.settings.notifierTip.substr(0,2) != 'No' && thisTip >= cb.settings.tipMessageMin) { var to = ''; tipMessage = cb.settings.tipMessage.replace('{username}', thisTipper); if(cb.settings.notifierTip == 'Privately to Tipper only') { to = thisTipper; } notify(tipMessage,to,yellow_light,mod_orange); } if(cb.settings.kingTipper == 'Yes') { if (thisTipper == currentKing) { kingTip = userTotal; // current king, new total } else if (userTotal > kingTip && userTotal >= kingMin) { // New king currentKing = thisTipper; kingTip = userTotal; notifyTheme(crown + ' We have a new ' + (tip['from_user_gender'] === 'f' ? 'Queen' : 'King') + '! All hail ' + thisTipper + '! ' + crown, ''); } } }); /************************************************** onEnter **************************************************/ cb.onEnter(function(user) { var u = user['user']; if (!isBlank(cb.settings.enterMessage)) { var enterMessage = cb.settings.enterMessage.replace(/{newline}/gi, "\n"); notifyTheme(enterMessage,u); } // Add mod to modArray if(user['is_mod']) { if (!cbjs.arrayContains(modArray,u)) { modArrayPopulate(u); modAndEmodArrayPopulate(u); if(cb.settings.wordlistShowModerators == 'Yes') { modBlockMsgArrayPopulate(u); } } if(cb.settings.wordlistToggle == 'Yes') { //Send notice to moderators as they enter notifyErrorBold(bullets + 'Sasha\'s Multi Bot - MODERATOR NOTICE' + bullets,u); var modMessage = 'Welcome to ' + cb.room_slug + '\'s room. ' + cb.room_slug + ' is running Sasha\'s Multi Bot. This Bot automatically blocks certain messages that contain words and phrases which are deemed abusive, inappropriate, or annoying.\n'; if (cbjs.arrayContains(modBlockMsgArray,u)) { modMessage += 'Your Blocked Message Notices are currently ON. To stop seeing them, type: /blocknotice\xa0off.\n'; } else { modMessage += 'Your Blocked Message Notices are currently OFF. To see them again, type: /blocknotice\xa0on.\n'; } modMessage += 'To silence an abusive user using the Bot, type: /silence\xa0[username]'; notifyError(modMessage,u); } } }); /************************************************** Initialize **************************************************/ if(initialize == 0) { if(cb.settings.colorscheme) { setColor(); } if(cb.settings.wordlistToggle == 'Yes') { parseWordlist(); } if(cb.settings.defaultSilenceLevel) { silenceLevel = parseInt(cb.settings.defaultSilenceLevel.charAt(0)); if(silenceLevel == 4) { notifyErrorBold('Noone will be able to chat, except for your Moderators and Fan Club Members. Did you mean to do this?\nFor more information, type "/mbhelp\xa0silencelevel" ', cb.room_slug); } } if(cb.settings.defaultGraphicLevel) { graphicLevel = parseInt(cb.settings.defaultGraphicLevel.charAt(0)); } if(cb.settings.notifierSpam == 'Yes') { parseRotating(); notifierSpamTGL = 1; cb.setTimeout(function() { sendRotating(); notifierSpam(); // random amount of time not more than chosen interval }, Math.floor((Math.random() * notifierTimer) + 1)*minuteMS); } if(cb.settings.kingTipper == 'Yes' && cb.settings.kingTipperSpam == 'Yes') { kingTipperSpam = 1; cb.setTimeout(function() { kingSpamTimer(); // random amount of time not more than chosen interval, plus 20 seconds }, Math.floor((Math.random() * kingTimer) + 1)*minuteMS/3); } if(cb.settings.leaderBoard == 'Yes' && cb.settings.leaderBoardSpam == 'Yes') { leaderboardSpam = 1; cb.setTimeout(function() { ldrSpamTimer(); // random amount of time not more than chosen interval, plus 40 seconds }, Math.floor((Math.random() * ldrTimer) + 1)*minuteMS*2/3); } if(cb.settings.wordlistShowBroadcaster == 'Yes') { modBlockMsgArrayPopulate(cb.room_slug); } if(!isBlank(cb.settings.silenceList)) { var s = cb.settings.silenceList.replace(/\s+/g, ''); silenceArray = s.replace(/^,+|,+$/g,'').split(','); } if(!isBlank(cb.settings.niceList)) { var n = cb.settings.niceList.replace(/\s+/g, ''); niceArray = n.replace(/^,+|,+$/g,'').split(','); } if(!isBlank(cb.settings.greyList)) { var g = cb.settings.greyList.replace(/\s+/g, ''); greyArray = g.replace(/^,+|,+$/g,'').split(','); } if(!isBlank(cb.settings.hostWhisperLevel)) { ignoreArray[findIgnorer(cb.room_slug)][1] = parseInt(cb.settings.hostWhisperLevel.charAt(0)); // setting whisper ignore level for broadcaster } if(cb.settings.wordlistToggle == 'Yes') { //Send notice to moderators notifyErrorBold(bullets + 'Sasha\'s Multi Bot - MODERATOR NOTICE' + bullets,'onlyMods'); var modMessage = cb.room_slug + ' has just started Sasha\'s Multi Bot. This Bot automatically blocks certain messages that contain words and phrases which are deemed abusive, inappropriate, or annoying.\n'; if(cb.settings.wordlistShowModerators == 'Yes') { modMessage += 'Your Blocked Message Notices are currently ON. To stop seeing them, type: /blocknotice\xa0off.\n'; } else { modMessage += 'Your Blocked Message Notices are currently OFF. To see them again, type: /blocknotice\xa0on.\n'; } modMessage += 'To silence an abusive user using the bot, type: /silence\xa0[username]'; notifyError(modMessage,'onlyMods'); if(cb.settings.wordlistShowBroadcaster == 'Yes') { notifyErrorBold(bullets + 'Sasha\'s Multi Bot - BROADCASTER NOTICE' + bullets,'roomHost'); // var modMessage = cb.room_slug + ' has just started Sasha\'s Multi Bot. This Bot automatically blocks certain messages that contain words and phrases which are deemed abusive, inappropriate, or annoying.\n'; var modMessage = 'You have chosen to see Blocked Message Notices. This has the potential to be distracting. It is recommended that let your Moderators handle these blocked messages instead.\n'; modMessage += 'To stop seeing them, type "/blocknotice\xa0off"\n'; modMessage += 'Or set "Notify Broadcaster" to "No" under Section 3 of the Bot Launch Screen.'; // modMessage += 'To silence an abusive user using the bot, type: /silence\xa0[username]'; notifyError(modMessage,'roomHost'); } } //Initialize initialize = 1; }
© Copyright Freesexcam 2011- 2024. All Rights Reserved.