Bots Home
|
Create an App
Skye's Bot
Author:
keeeeper
Description
Source Code
Launch Bot
Current Users
Created by:
Keeeeper
/****************************************************** ******************************************************* * Name: Skye's Bot * Author: keeeeper * Version: 1.0.0 * * Based on: * Bomb Bot Ultra by adambomb01 ******************************************************* ************************************************** ***** CHANGES TO EXISTING BOMB BOT FEATURES ***** ************************************************** - Fan club tag - Different color scheme for rotating notifier ****************************************************** *****************************************************/ /************************************************************************************************************************************ ***** App Launch Settings *********************************************************************************************************** ************************************************************************************************************************************/ cb.settings_choices = [ /**** 1. PERSONALIZATION ****/ {name: 'colorscheme', label: '1.) PERSONALIZATION ........................................... Color 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 color scheme to "Custom" above]', required: false}, {name: 'lightcolor', label: 'Custom Light Color (Hex #)', type: 'str', defaultValue: '[Optional - Set color scheme to "Custom" above]', required: false}, {name: 'enterMessage', label: 'Welcome Message', type: 'str', minLength: 1, maxLength: 1000, defaultValue: '[Optional - Leave blank in busy rooms, as it can cause CB bots to crash]', 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 greys', defaultValue: 'Only for greys', required: false}, {name: 'stickyToggle', label: 'Prevent sticky keyyyyyyyyyyyyys?', type: 'choice', choice1: 'Yes', choice2: 'No', choice3: 'Only for greys', defaultValue: 'Only for greys', required: false}, {name: 'defaultGraphicLevel', label: 'Default Graphic Level (Who can use graphics?)', type: 'choice', choice1: '0 - (Everyone)', choice2: '1 - (Color names only)', choice3: '2 - (Dark blue names and higher)', choice4: '3 - (Users who have tipped)', choice5: '4 - (Only mods and fans)', defaultValue: '1 - (Color names only)', required: false}, {name: 'defaultSilenceLevel', label: 'Default Silence Level (Who can talk in chat?)', type: 'choice', choice1: '0 - (Everyone)', choice2: '1 - (Color names only)', choice3: '2 - (Dark blue names and higher)', choice4: '3 - (Users who have tipped)', choice5: '4 - (Only mods and fans)', defaultValue: '0 - (Everyone)', required: false}, {name: 'niceList', label: 'Nice List (Users who can always talk/use graphics)', type: 'str', minLength: 1, maxLength: 1000, defaultValue: '[Optional - Exact usernames, separated by commas]', required: false}, {name: 'silenceList', label: 'Silence List (Users who are permanently silenced)', type: 'str', minLength: 1, maxLength: 1000, defaultValue: '[Optional - Exact usernames, separated by commas]', required: false}, /**** 3. GREY WORDLIST ****/ {name: 'wordlistToggle', label: '3.) BLOCKED WORDLIST .............. Use blocked wordlist feature?', type: 'choice', choice1: 'Yes', choice2: 'No (Skip to section 4)', defaultValue: 'Yes', required: false}, {name: 'wordlistNotice', label: 'Notify sender when his/her message gets blocked?', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'No', 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 wordlist applies to', type: 'choice', choice1: 'Only greys', choice2: 'Everyone', defaultValue: 'Only greys', required: false}, // {name: 'greyList', // label: 'Grey List (Users who should always incur wordlist)', // 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: '[Optional - Exact words or phrases, separated by commas]', required: false}, {name: 'customWordlistLevel', label: 'Custom wordlist applies to', type: 'choice', choice1: 'Only greys', 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 - (Color names only)', choice3: '2 - (Dark blue names and higher)', choice4: '3 - (Users who have tipped)', choice5: '4 - (Only mods and fans)', defaultValue: '0 - (Everyone)', required: false}, {name: 'hostWhisperLevel', label: 'Broadcaster whisper level (Who can send YOU whispers?)', type: 'choice', choice1: '0 - (Everyone)', choice2: '1 - (Color names only)', choice3: '2 - (Dark blue names and higher)', choice4: '3 - (Users who have tipped)', choice5: '4 - (Only mods and fans)', defaultValue: '4 - (Only mods and fans)', 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: 25, 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: 10, required: false}, /**** 7, LEADERBOARD ****/ {name: 'leaderBoard', label: '7.) LEADERBOARD .............................. Use Leaderboard feature?', type: 'choice', choice1: 'Yes', choice2: 'No (Skip to section 8)', defaultValue: 'Yes', required: false}, {name: 'leaderBoardSpam', label: 'Periodically announce top 3 tippers?', type: 'choice', choice1: 'Yes', choice2: 'No (Skip to section 8)', defaultValue: 'Yes', required: false}, {name: 'leaderBoardTimer', label: 'Interval (in mins) for leaderboard announcement', type: 'int', minValue: 1, maxValue: 60, defaultValue: 10, 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: 'Yes', 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: 15, 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: 4, required: false}, {name: 'spamMessage1', label: 'Notice #1', type: 'str', minLength: 1, maxLength: 1000, defaultValue: '[Optional - use {newline} for line break]', required: false}, {name: 'spamMessage2', label: 'Notice #2', type: 'str', minLength: 1, maxLength: 1000, defaultValue: '[Optional - use {newline} for line break]', required: false}, {name: 'spamMessage3', label: 'Notice #3', type: 'str', minLength: 1, maxLength: 1000, defaultValue: '[Optional - use {newline} for line break]', required: false}, {name: 'spamMessage4', label: 'Notice #4', type: 'str', minLength: 1, maxLength: 1000, defaultValue: '[Optional - use {newline} for line break]', required: false}, {name: 'spamMessage5', label: 'Notice #5', type: 'str', minLength: 1, maxLength: 1000, defaultValue: '[Optional - use {newline} for line break]', required: false}, {name: 'notifier_colorscheme', label: 'Color 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: 'notifier_darkcolor', label: 'Custom Dark Color (Hex #)', type: 'str', defaultValue: '[Optional - Set color scheme to "Custom" above]', required: false}, {name: 'notifier_lightcolor', label: 'Custom Light Color (Hex #)', type: 'str', defaultValue: '[Optional - Set color scheme to "Custom" above]', 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: 'fanClubTag', label: '11.) FAN CLUB the Tag or emoji for your fan club members', type: 'str', required: false}, {name: 'fanClubUsers', label: 'additional users to be prefixed with fanclub tag separated by comma', type: 'str', required: false}, /**** 12. MISCELLANEOUS ****/ {name: 'invalidToggle', label: '12.) MISC ................... 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 fanClubArray = new Array; var emodArray = new Array; // [i] = User's name, list of users who have been given emergency 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 = "#993377"; 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 notifier_dark = purple_dark; var notifier_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 fanArrayPopulate(user) { fanclubArray.push(user); } function fanArrayDepopulate(user) { cbjs.arrayRemove(fanclubArray,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 "/bombhelp\xa0silencelevel" to see how to use /silencelevel.', mod); } else { notifyError('You did not enter a valid silence level.\nType "/bombhelp\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 graphic 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 graphic level.\nType "/bombhelp\xa0graphiclevel" to see how to use /graphiclevel.', mod); } else { notifyError('You did not enter a valid graphic level.\nType "/bombhelp\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 += 'Remember, the room host, moderators, and fan club members will always be able to whisper you!'; notify(ignoreMessage, user); } else if(l) { notifyError('"' + l + '" is not a valid ignore level.\nType "/bombhelp\xa0ignorelevel" to see how to use /ignorelevel.', user); } else { notifyError('You did not enter a valid ignore level.\nType "/bombhelp\xa0ignorelevel" to see how to use /ignorelevel.', user); } } function silence(user, mod) { if (user == mod) { notifyError('You can not silence yourself.', mod); } else if (user == roomHost) { notifyError('You can not 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(mod + ' has silenced you.', 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(mod + ' has unsilenced you.', 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 + ' Timer 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 "/bombhelp\xa0starttimer" to see how to use /starttimer.',mod); } else if(min == null) { notifyError('You did not enter a valid option for /starttimer.\nType "/bombhelp\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 "/bombhelp\xa0addtime" to see how to use /addtime.',mod); } else if(min == null) { notifyError('You did not enter a valid option for /addtime.\nType "/bombhelp\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 = ':bb-lightbubble [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 = ':bb-darkbubble [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 whisper recipient.',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 greys.',from); } break; case 2: if(whisperLevel > 2 || mod) { doWhisper(message, recipient, from); } else { notifyError(recipient + ' is ignoring whispers from greys and light blues who haven\'t tipped in the room.',from); } break; case 3: if(whisperLevel > 3 || mod) { doWhisper(message, recipient, from); } else { notifyError(recipient + ' is ignoring whispers from all members who haven\'t tipped 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('No one 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. You may want to consult a therapist.',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('Remember, the room host, moderators, and fan club members will always be able to whisper you!',user); } else { notifyError('You did not specify a user to ignore. Type "/bombhelp\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 "/bombhelp\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('Emergency moderator powers have been granted to ' + user,from); notify('You have been granted emergency moderator powers by ' + from,user); } else { notifyError(user + ' has already been granted emergency moderator powers.',from); } } else if(ar == 'remove') { if(cbjs.arrayContains(emodArray,user)) { emodArrayDepopulate(user); // modAndEmodArrayDepopulate(user); // modBlockMsgArrayDepopulate(user); notify('Emergency moderator powers have been removed from ' + user,from); notify('Your emergency moderator powers have been removed by ' + from,user); } else { notifyError(user + ' has not been granted emergency moderator powers.',from); } } else if(ar) { notifyError(ar + ' is not a valid option for /emod. Type "/bombhelp\xa0emod" to see how to use /emod.',from); } else { notifyError('You did not enter a valid option for /emod. Type "/bombhelp\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 "/bombhelp\xa0blocknotice" to see how to use /blocknotice.',user); } else { notifyError('You did not enter a valid option for /blocknotice. Type "/bombhelp\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 + ' 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 room host has decided not to use the Leaderboard feature.',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]) { notify(noticeArray[noticeNum], null, notifier_light, notifier_dark) } 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+l+o+s|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|k+i+s+s|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+l+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|m+u+f+f|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|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|s+e+m+e+n|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'); // Non-English characters var non_english = new RegExp('[^\\x00-\\xAE\\u2000-\\u206F]'); // BB var list_bb = new RegExp('\\b(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|s+k+a+n+k|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+\\s*m+|p+v+t|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+o+l+e+s*|t+o+e+s*)\\b|' + '(f+e+e+t|p+e+d+i+c+u|f+o+t+j+o+b)' , 'i'); // Creepy var list_creepy = new RegExp('(d+a+d|(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|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(non_english) != -1 : reason = 'Non-English'; 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(mod + ' has added you to the nice list. You will be able to chat and use graphics regardless of the global room settings. Thank you for being nice!',user); } 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(mod + ' has removed you from the nice list.', user); } else { notifyError(user + ' is not on the nice list.', mod); } } } else { notifyError('Uh oh. You didn\'t specify a user.\nType "/bombhelp\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('Uh oh. You didn\'t specify a user.\nType "/bombhelp\xa0greylist" to see how to use the grey list.',mod); } } function fanList(user,mod,ar) { if(user) { user = user.toLowerCase(); if(ar == 'a') { if(!cbjs.arrayContains(fanclubArray,user)) { fanArrayPopulate(user); notify('You have added ' + user + ' to the fan club list.', mod); } else { notifyError(user + ' is already on the fan club list.', mod); } } else if(ar == 'r') { if(cbjs.arrayContains(fanclubArray,user)) { fanArrayDepopulate(user); notify('You have removed ' + user + ' from the fan club list.', mod); } else { notifyError(user + ' is not on the fan club list.', mod); } } } else { notifyError('Uh oh. You didn\'t specify a user.\nType "/bombhelp\xa0fanlist" to see how to use the fan club list.',mod); } } function kingSpamToggle(option, mod) { if(cb.settings.kingTipper != 'Yes') { notifyError('The room host has decided not to use the King Tipper feature',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 "/bombhelp\xa0kingspam" to see how to use /kingspam.',mod); } else if(option == null) { notifyError('You did not enter a valid option for /kingspam.\nType "/bombhelp\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 "/bombhelp\xa0notifierspam" to see how to use /notifierspam.',mod); } else if(option == null) { notifyError('You did not enter a valid option for /notifierspam.\nType "/bombhelp\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 "/bombhelp\xa0leaderboardspam" to see how to use /leaderboardspam.',mod); } else if(option == null) { notifyError('You did not enter a valid option for /leaderboardspam.\nType "/bombhelp\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 color option.', roomHost); notifyError( 'Use color-hex.com to find the code for the color you want.\n' + 'Reverting to default color.', roomHost); return false; } } function parseColor(c, t, b) { var textvalid = true; var bgvalid = true; var dark, light; if (c && c.substr(0,6) == 'Custom') { if(isBlank(b) && isBlank(t)) { notifyErrorBold('Whoops. You selected a custom color scheme but you didn\'t fill in the colors. Reverted to default color scheme.', roomHost); } else if (isBlank(t)) { notifyErrorBold('Whoops. You selected a custom color scheme but you didn\'t select a text color. Reverted to default color 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 colors, but your color scheme is set to "' + c +'". In order to use your custom colors, please set your color scheme to "Custom"', roomHost); } if (c == 'Purple') { dark = purple_dark; light = purple_light; } else if (c == 'Pink') { dark = pink_dark; light = pink_light; } else if (c == 'Orange') { dark = orange_dark; light = orange_light; } else if (c == 'Red') { dark = red_dark; light = red_light; } else if (c == 'Green') { dark = green_dark; light = green_light; } else if (c == 'Teal') { dark = teal_dark; light = teal_light; } else if (c == 'Grey') { dark = grey_dark; light = grey_light; } } return {dark : dark, light: light} } function setColor() { var theme = parseColor(cb.settings.colorscheme, cb.settings.darkcolor.trim(), cb.settings.lightcolor.trim()) theme_dark = theme.dark; theme_light = theme.light; var notifier = parseColor(cb.settings.notifier_colorscheme, cb.settings.notifier_darkcolor.trim(), cb.settings.notifier_lightcolor.trim()) notifier_dark = notifier.dark; notifier_light = notifier.light; } function help(option,from) { var valid = 0; if(option == null){ option = ''; } switch(option) { case '': { valid = 1; notifyBold('Bomb Bot Ultra Help Menu',from); notify( 'Type "/bombhelp\xa0x", where x is one of the following choices, for more detailed information.' + '\nEx: /bombhelp\xa0commands' ,from); notifyPlain( 'commands\n' + 'nicelist\n' + 'greylist\n' + 'fanlist\n' + 'about' ,from); break; } case 'commands': { valid = 1; notifyBold('Bomb Bot Ultra Command List',from); notify( 'Type "/bombhelp\xa0x", where x is one of the following commands, for more detailed information.' + '\nEx: /bombhelp\xa0silencelevel' ,from); notifyPlain( '/silencelevel\n' + '/graphiclevel\n' + '/silence\n' + '/unsilence\n' + '/starttimer\n' + '/addtime\n' + '/timeleft\n' + '/note\n' + '/whisper\n' + '/reply\n' + '/ignore\n' + '/unignore\n' + '/ignorelevel\n' + '/emod\n' + '/addnice\n' + '/removenice\n' + '/addgrey\n' + '/removegrey\n' + '/leaderboard\n' + '/kingspam' // + '\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, hosts and mods are forced to do things like silence users without tokens or who have not tipped and those groups often includes the users whose comments hosts would like to see. ' + 'To fix this problem, hosts and mods can add users to the Nice List. ' + 'Users who are on the nice list can send messages regardless of the global silence setting.',from); valid = 1; break; } case 'greylist': { valid = 1; notifyBold('The "Grey" List',from); notify('Sometimes, there are users whose comments are annoying, in spite of the fact that they may have tokens or even tip. ' + 'It isn\'t always desireable to silence these people entirely, especially if they\'ve been tipping, but it can be useful to apply the same word list restrictions that apply to greys, so that the more annoying messages don\'t get through to the room. ' + 'To fix this problem, hosts and mods can add users to the "Grey" List. ' + 'Users who are on the grey list will have their messages subjected to the wordlists that apply to greys.',from); notify('',from); break; } case 'fanlist': { valid = 1; notifyBold('The Fan Club List',from); notify("Additinal fan club members list, this users will be prefixed by fan club tag even if they don't have active fun club subscription",from); notify('',from); break; } case 'about': { valid = 1; notifyBold('About Bomb Bot Ultra',from); notify('Bomb Bot Ultra is a fork of Ultra Bot, with continuing development by Adambomb01.' + '\nUltra Bot was written by Justin of the Chaturbate couple britney_and_justin.' + '\nComments, suggestions, requests, and bug reports can be communicated by either tweeting @adambomb01, ' + 'or by posting comments on Bomb Bot Ultra\'s page at chaturbate.com/bots.' + '\nThe purpose of Bomb Bot Ultra is to make the lives of hosts and mods as easy as possible. ' + 'It adds popular features such as King Tipper, Leaderboard, and Notifier, pre-silences abusive messages, ' + 'grants quite a bit of power to moderators, and allows private messages to be sent 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 moderators and room hosts.' + '\nThe syntax for using silencelevel is "/silencelevel\xa0x", where x is a number between 0 and 3.' + '\nSetting the Silence Level to 0 will grant voice privileges to all users, ' + 'setting it to 1 will revoke voice privileges from greys, ' + 'setting it to 2 will revoke voice privileges from greys and light blues, ' + 'setting it to 3 will revoke voice privileges from users who have not tipped,' + 'and setting it to 4 will revoke voice privileges from everyone other than mods and fans.' + '\nThe default setting for /silencelevel is 0.' + '\nRoom hosts, 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 moderators and room hosts.' + '\nThe syntax for using graphiclevel is "/graphiclevel\xa0x", where x is a number between 0 and 3.' + '\nSetting the Graphic Level to 0 will grant graphic privileges to all users, ' + 'setting it to 1 will revoke graphic privileges from greys, ' + 'setting it to 2 will revoke graphic privileges from greys and light blues, ' + 'setting it to 3 will revoke graphic privileges from users who have not tipped,' + 'and setting it to 4 will revoke graphic privileges from everyone other than mods and fans.' + '\nThe default setting for /graphiclevel is 1.' + '\nRoom hosts, 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 moderators and room hosts.' + '\nThe syntax for using silence is "/silence x", where x is the username of the user you want to silence.' + '\nThe effect of /silence is the same as Chaturbate\'s silence feature, ' + 'except that it lasts for the duration of the current session instead of for six hours.' + '\nThe effect of /silence can be reversed by using the command /unsilence.',from); notify('',from); break; } case 'unsilence': { valid = 1; notifyBold('/unsilence Help',from); notify('/unsilence is a command that is usable by moderators and room hosts.' + '\nThe syntax for using unsilence is "/unsilence x", where x is the username of the user you want to unsilence.' + '\nunsilence simply grants voice privileges back to a user who was previously silenced.' + '\nNOTE: /unsilence WILL NOT undo the effect of Chaturbate\'s silence feature!' + '\n/unsilence WILL ONLY reverse the effect of /silence!',from); notify('',from); break; } case 'starttimer': { valid = 1; notifyBold('/starttimer Help',from); notify('/starttimer is a command that is usable by moderators and room hosts.' + '\nThe syntax for using starttimer is "/starttimer x", where x is the desired duration of the timer in minutes.' + '\n/starttimer will accept whole numbers only.' + '\nThe timer will make announcements at five minutes remaining and at one minute remaining.' + '\n/addtime can be used to add time to a currently running timer.' + '\n/timeleft can be used to display the amount of time remaining on the timer.',from); notify('',from); break; } case 'addtime': { valid = 1; notifyBold('/addtime Help',from); notify('/addtime is a command that is usable by moderators and room hosts.' + '\nThe syntax for using addtime is "/addtime\xa0x", where x is the amount of time you want to add in minutes.' + '\n/addtime will accept whole numbers only.' + '\nSee the help section for starttimer for more information on timers.',from); 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 moderators and room hosts.' + '\nThe syntax for using note is "/note\xa0x", where x is the message you want to send.' + '\n/note, /notice, and /n are all available commands that will send a notice.' + '\nA note 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 all available 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 whisper 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 available 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 greys from sending you whispers.' + '\nSetting it to 2 will prevent greys and light blues from sending you whispers.' + '\nSetting it to 3 will prevent users who have not tipped in the room from sending you whispers.' + '\nSetting it to 4 will prevent all users from sending you whispers.' + '\nModerators and fan club members can send whispers regardless of whisper level.' + '\nThe default setting for /ignorelevel is 4 for the broadcaster, and 0 for everyone else. (This 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 moderators and room hosts.' + '\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 emergency moderator powers.' + '\n/emod allows moderators to quickly grant other users access to moderator-only commands in the event that he is having difficulty controlling the room by himself.' + '\nEmergency moderators have access to all moderator-only commands with the exceptions of /emod, /addnice, and /removenice.',from); notify('',from); break; } case 'blocknotice': { valid = 1; notifyBold('/blocknotice Help',from); notify('/blocknotice is a command that is usable by moderators and room hosts.' + '\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 wordlist 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 moderators and room hosts.' + '\nThe syntax for using addnice is "/addnice x", where x is the username of the user you want to add to the nice list.' + '\nAdding a user to the nice list guarantees that user voice and graphic usage privileges regardless of the silence, graphic, and ignore level settings. ' + 'Using /silence or /ignore will still silence or ignore a user on the nice list.' + '\nUsers can be removed from the nice list by using the command /removenice.' + '\nSee the help sections for silencelevel, graphiclevel, and ignorelevel for more information on the global settings or the help section for nicelist for more information on the nice list.',from); notify('',from); break; } case 'removenice': { valid = 1; notifyBold('/removenice Help',from); notify('/removenice is a command that is usable by moderators and room hosts.' + '\nThe syntax for using removenice is "/removenice x", where x is the username of the user you want to remove from the nice list.' + '\nSee the help section for nicelist for more information on the nice list.',from); notify('',from); break; } case 'addgrey': case 'addgray': { valid = 1; notifyBold('/addgrey Help',from); notify('/addgrey is a command that is usable by moderators and room hosts.' + '\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 wordlists that apply to greys. ' + '\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 moderators and room hosts.' + '\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 'addfan': { valid = 1; notifyBold('/addfan Help',from); notify('/addfan is a command that is usable by room hosts.' + '\nThe syntax for using addfan is "/addfan x", where x is the username of the user you want to add to the fan club list.' + '\nUsers can be removed from the fan club list by using the command /removefan.',from); notify('',from); break; } case 'removefan': { valid = 1; notifyBold('/removefan Help',from); notify('/removefan is a command that is usable by room hosts.' + '\nThe syntax for using removefan is "/removefan x", where x is the username of the user you want to remove from the fan club list.',from); notify('',from); break; } case 'bombhelp': case 'ubhelp': { valid = 1; notifyBold('/bombhelp\xa0Help',from); notify('/bombhelp\xa0is a command that is usable by everyone.' + '\nThe syntax for using bombhelp is "/bombhelp\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 3 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 moderators and room hosts.' + '\nThe syntax for using kingspam is /kingspam x, where x is either on or off. ' + 'Using this command toggles the spamming of the message "Tip x to become the new King!"',from); notify('',from); break; } // case 'notifierspam': { // valid = 1; // notifyBold('/notifierspam Help',from); // notify('/notifierspam is a command that is usable by moderators and room hosts.' + // '\nThe syntax for using notifierspam is /notifierspam x, where x is either on or off. ' + // 'Using this command toggles the spamming of the periodic message defined by the host.',from); // notify('',from); // break; // } case 'leaderboardspam': { valid = 1; notifyBold('/leaderboardspam Help',from); notify('/leaderboardspam is a command that is usable by moderators and room hosts.' + '\nThe syntax for using leaderboardspam is /leaderboardspam x, where x is either on or off. ' + 'Using this command toggles the spamming of the top three tippers.',from); notify('',from); break; } } if(valid == 0) { notifyError(option + ' is not a valid subsection of the help menu. Type "/bombhelp" 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 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 isAdditionalFan = cbjs.arrayContains(fanclubArray, 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 || isDev) && silenced == 0) { msg['X-Spam'] = true; silenced = 1; // notifyError('Your message was not sent because you have been silenced. Be nice and don\'t make demands.',u); } // Silence Levels function doSilenceLevel(level) { var silenceNotice = 'I\'m sorry, but the silence level has been set to ' + level + '. Your message was not sent.\n'; silenceNotice += 'For more information about silence levels, type "/bombhelp 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 || isDev) && silenced == 0) { switch(silenceLevel) { case 1: if(isGrey) { doSilenceLevel(silenceLevel); } break; case 2: if(!isBlueUp) { doSilenceLevel(silenceLevel); } break; case 3: if(!hasTipped) { 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 = 'I\'m sorry, but the graphic level has been set to ' + level + '. Your message was not sent.\n'; graphicNotice += 'For more information about graphic levels, type "/bombhelp graphiclevel"\n'; graphicNotice += 'Please enjoy the show :smile'; if (replaceImage()) { notifyError(graphicNotice,u); graphicsBlocked = 1; } } if(graphicLevel > 0 && !(isHost || isMod || isEmod || isFan || isNice || isDev) && silenced == 0) { switch(graphicLevel) { case 1: if(isGrey || isGreyish) { doGraphicLevel(graphicLevel); } break; case 2: if(!isBlueUp || isGreyish) { doGraphicLevel(graphicLevel); } break; case 3: if(!hasTipped || 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 wordlist. Be nice and don\'t make demands.',u); } lastBlocked.push(msg['user']); if (lastBlocked.length == 10) { lastBlocked.shift(); } } } if(!(isHost || isMod || isEmod || isFan || 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 || isDev)) { 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('Uh oh! You didn\'t write a note',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 || isDev)) { 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 '/addfan': { if(isHost) { fanList(param,u,'a'); } break; } case '/removefan': { if(isHost) { fanList(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 wordlist!',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 '/bombhelp': 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 broadcaster has disabled the "whisper" feature',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(!hasTipped && silenced == 0) { whisperLevel = 3; } else { whisperLevel = 4; } if(isHost || isMod || isEmod || isFan || isNice || isDev) { 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 moderators and broadcasters are able to use the "' + command + '" command.\nType "/bombhelp\xa0commands" to see a full list of the 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 nothinga } //Otherwise, it means the user entered an invalid command else if(cb.settings.invalidToggle == 'Yes') { notifyError('"' + command + '" is not a valid command.\nType "/bombhelp\xa0commands" to see a full list of the available commands.',u); } } } if(!(isHost || isMod || isEmod || isFan || isNice || isDev)) { //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; } } } if((isFan || isAdditionalFan) && cb.settings.fanClubTag && cb.settings.fanClubTag.trim().length) { msg['m'] = cb.settings.fanClubTag.trim() + ' ' + msg['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 + 'Bomb Bot Ultra - MODERATOR NOTICE' + bullets,u); var modMessage = 'Welcome to ' + cb.room_slug + '\'s room. ' + cb.room_slug + ' is running Bomb Bot Ultra. This bot automatically blocks certain messages that contain words and phrases that 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('No one will be able to chat except for your mods and fan club members. Did you mean to do this?\nFor more information, type "/bombhelp\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.fanClubUsers)) { var g = cb.settings.fanClubUsers.replace(/\s+/g, ''); fanclubArray = 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 + 'Bomb Bot Ultra - MODERATOR NOTICE' + bullets,'onlyMods'); var modMessage = cb.room_slug + ' has just started Bomb Bot Ultra. This bot automatically blocks certain messages that contain words and phrases that 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 + 'Bomb Bot Ultra - BROADCASTER NOTICE' + bullets,'roomHost'); // var modMessage = cb.room_slug + ' has just started Bomb Bot Ultra. This bot automatically blocks certain messages that contain words and phrases that 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 Chaturbate 2011- 2024. All Rights Reserved.