Bots Home
|
Create an App
Dev AIO bot
Author:
goddessclaes
Description
Source Code
Launch Bot
Current Users
Created by:
Goddessclaes
/********************************************************** Name: All In One Bot Author: mike_lovin Original Version 7.0 (9-7-14) Fanclub based on Fan Club Bot by lund0894 Nickname feature based on BB_NickBot by billyab CrazyNote feature based on CrazyNote by acrazyguy Forked from: Ultra Bot by britney_and_justin ***********************************************************/ /******* App Launch Settings *******/ cb.settings_choices = [ /*** 1. PERSONALIZATION ***/ { name: 'colorscheme', label: '1.) PERSONALIZATION ........................................... Color Scheme:', type: 'choice', choice1: 'Purple', choice2: 'Pink', choice3: 'Blue', choice4: 'Red', choice5: 'Green', choice6: 'Halloween', choice7: 'Christmas', choice8: 'Custom (Please define below)', required: false }, { name: 'darkcolor', label: 'Custom Text Color (Html #code)', type: 'str', defaultValue: '[Optional - Set color scheme to "Custom" above]', required: false }, { name: 'lightcolor', label: 'Custom Highlight Color (Html #code)', type: 'str', defaultValue: '[Optional - Set color scheme to "Custom" above]', required: false }, { name: 'crazyNoteColorscheme', label: 'Crazy Note Color Scheme (Only for /cn /cnd /cnh /cndh) - Theme is colors picked above', type: 'choice', choice1: 'Theme', choice2: 'Custom (Please define below)', defaultValue: 'Theme', required: false },{ name: 'crazyNoteText', label: 'Custom Text Color - HTML color code (without #)', type: 'str', defaultValue: '[Optional - Set color scheme to "Custom" above]', required: false }, { name: 'crazyNoteBackground', label: 'Custom Highlight Color - HTML color code (without #)', 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: 'greyList', label: 'Grey List (Usernames any color) who should always be subjected to grey wordlist and grey graphic level)', 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 }, { name: 'silenceTipToggle', label: 'Use tip to be un-silenced? (Only un-silences users silenced with the bot, not cb silences)', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'No', required: false }, { name: 'silenceTipAmount', label: 'Tip amount to become un-silenced', type: 'int', minValue: 1, defaultValue: '100' }, /*** 3. GREY WORDLIST ***/ {name: 'greyWordlistToggle', label: '3.) GREY WORDLIST ............. Use grey wordlist feature for greys?', type: 'choice', choice1: 'Yes', choice2: 'No (Skip to section 4)', defaultValue: 'Yes', required: false}, {name: 'greyWordlistNotice', label: 'Notify sender when his/her message gets blocked?(all wordlist)', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'No', required: false}, {name: 'greyWordlistShowModerators', label: 'Notify moderators of blocked grey wordlist messages?', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'No', required: false}, {name: 'greyWordlistShowBroadcaster', label: 'Notify broadcaster of blocked grey wordlist messages?', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'No', required: false}, {name: 'greyWordlistLevel', label: 'Grey wordlist applies to', type: 'choice', choice1: 'Only greys', choice2: 'Everyone', defaultValue: 'Only greys', 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: 'customWordlistShowModerators', label: 'Notify moderators of blocked custom wordlist messages?', type: 'choice',choice1: 'Yes',choice2: 'No',defaultValue: 'No',required: false}, {name: 'customWordlistShowBroadcaster', label: 'Notify broadcaster of blocked custom wordlist messages?', type: 'choice',choice1: 'Yes',choice2: 'No',defaultValue: 'No',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: 'Only greys', required: false}, /*** 5. SPAM WORDLIST ***/ {name: 'spamWordlistToggle', label: '5.) SPAM WORDLIST .......................... Use spam wordlist feature?', type: 'choice', choice1: 'Yes', choice2: 'No (Skip to section 6)', defaultValue: 'Yes', required: false}, {name: 'spamWordlistShowModerators', label: 'Notify moderators of blocked spam wordlist messages?', type: 'choice',choice1: 'Yes',choice2: 'No',defaultValue: 'No',required: false}, {name: 'spamWordlistShowBroadcaster', label: 'Notify broadcaster of blocked spam wordlist messages?', type: 'choice',choice1: 'Yes',choice2: 'No',defaultValue: 'No',required: false}, {name: 'spamWordlistLevel', label: 'Spam wordlist applies to', type: 'choice', choice1: 'Only greys', choice2: 'Everyone', defaultValue: 'Only greys', required: false}, {name: 'autoSilenceSpamToggle', //<<<<< added this toggle label: 'Automatically silence users who post spam?', type: 'choice',choice1: 'Yes',choice2: 'No',defaultValue: 'Yes',required: false}, /*** 6. WHISPERS ***/ { name: 'whisperToggle', label: '6.) WHISPERS ............................................... Use whisper feature?', type: 'choice', choice1: 'Yes', choice2: 'No (Skip to section 7)', 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 }, /*** 7. KING TIPPER ***/ { name: 'kingTipper', label: '7.) KING TIPPER ................................... Use \'King Tipper\' feature?', type: 'choice', choice1: 'Yes', choice2: 'No (Skip to section 8)', 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: 7, required: false }, { name: 'kingMessage', label: 'Message to print here... Tip xx to be the new ______', type: 'str', minLength: 1, maxLength: 30, defaultValue: 'King', required: true }, { name: 'crownIcon', label: 'Crown Icon: used for King tipper (Use :GIFNAME with colon)', type: 'str', minLength: 0, maxLength: 40, required: true, defaultValue: ':crownsilver' }, /*** 8. All Time High Tip King ***/ { name: 'kingTipperToggle', label: '8.) ALL TIME HIGH TIP KING........................................ Use All Time High Tip King feature?', type: 'choice', choice1: 'Yes', choice2: 'No (Skip to section 9)', defaultValue: 'No (Skip to section 9)', required: true },{ name: 'kingTipperName', label: 'Reigning high tip king (username)', type: 'str', minLength: 0, maxLength: 40, required: false, defaultValue: '[Username required when in use]' },{ name: 'kingTipperTip', label: 'Reigning high tip (token amount)', type: 'int', minValue: 1, defaultValue: '1' }, { name: 'kingTipperbgColor', label: 'Background color for king tipper - HTML color code (without #)', type: 'str', minLength: 0, maxLength: 6, required: false, defaultValue: 'FFFFFF' }, { name: 'kingTippertxtColor', label: 'Text color for king tipper - HTML color code (without #)', type: 'str', minLength: 0, maxLength: 6, required: false, defaultValue: '000000' }, { name: 'kingTipperIcon', label: 'Icon for king tipper (use :GIFNAME with colon)', type: 'str', minLength: 0, maxLength: 40, required: false, defaultValue: ':crowngold' },{ name: 'kingTipperNotifier', label: 'Interval (in mins) for rotating king tipper message', type: 'int', minValue: 1, maxValue: 60, defaultValue: 2, required: false }, /*** 9, LEADERBOARD ***/ { name: 'leaderBoard', label: '9.) LEADERBOARD .............................. Use Leaderboard feature?', type: 'choice', choice1: 'Yes', choice2: 'No (Skip to section 10)', defaultValue: 'Yes', required: false }, { name: 'leaderBoardSpam', label: 'Periodically announce top 3 tippers?', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes', required: false }, { name: 'leaderBoardTimer', label: 'Interval (in mins) for leaderboard announcement', type: 'int', minValue: 1, maxValue: 60, defaultValue: 7, required: false }, /*** 10. TIP MESSAGES ***/ { name: 'notifierTip', label: '10.) TIP MESSAGES ..................... Show message when a user tips?', type: 'choice', choice1: 'Yes', choice2: 'Privately to tipper only', choice3: 'No (Skip to section 11)', 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 },{ name: 'tipMessageColorscheme', label: 'Tip Message Color Scheme - Theme is Yellow and Black to match the tip colors', type: 'choice', choice1: 'Theme', choice2: 'Custom (Please define below)', defaultValue: 'Theme', required: false },{ name: 'tipMessageText', label: 'Custom Text Color - HTML color code (without #)', type: 'str', defaultValue: '[Optional - Set color scheme to "Custom" above]', required: false }, { name: 'tipMessageBackground', label: 'Custom Highlight Color - HTML color code (without #)', type: 'str', defaultValue: '[Optional - Set color scheme to "Custom" above]', required: false }, /*** 11. TIP TITLES ***/ { name: 'tipTitles', label: '11.) TIP TITLES ........................... Display users\' tip totals as titles?', type: 'choice', choice1: 'Yes', choice2: 'No (Skip to section 12)', defaultValue: 'Yes', required: false }, /*** 12. MISCELLANEOUS ***/ { name: 'invalidToggle', label: '12.) MISC ................... Send error message for invalid commands?', type: 'choice', choice1: 'Yes', choice2: 'No (Skip to section 13)', defaultValue: 'Yes', required: false }, { name: 'specialaccessMod', label: '[Optional] Username of Special Access Mod - This (username, any color) will be able to use all bot commands to make it easier for the model', type: 'str', minLength: 0, maxLength: 30, required: false, defaultValue: '' }, { name: "vipList", label: "Enter the names of any users you would like to grant free access to a future \"CrazyTicket\" show, separated by spaces, or by commas with or without spaces. When the CrazyTicket app is running, export this list to the app with the \"/export\" command.", type: "str", minLength: 1, maxLength: 2048, required: false }, /*** 13. NICKNAMES ***/ { name: 'show_alias', type: 'choice', choice2: 'No (Skip to section 14)', choice1: 'Yes', defaultValue: 'No (Skip to section 14)', label: '13.) NICKNAMES .................................................. Use Nicknames?' }, { name: 'nicknames', type: 'str', minLenght: 0, required: true, defaultValue: 'user@nickname', label: 'Nicknames user@nick e.g mike_lovin@Mike' }, { name: 'allow_mod', type: 'choice', choice2: 'No', choice1: 'Yes', defaultValue: 'Yes', label: 'Allow Mods to edit Nicknames' }, /*** 14. FANCLUB SETTINGS ***/ { name: 'fanclubToggle', label: '14.) #1 FANCLUB .................................................... Use FANCLUB?', type: 'choice', choice1: 'Yes', choice2: 'No (Skip to section 15)', defaultValue: 'No (Skip to section 15)', required: true }, { name: 'fanclubName', label: 'Name of FANCLUB', type: 'str', minLength: 0, maxLength: 30, required: true, defaultValue: 'FANCLUB' }, { name: 'fanclubtips', label: 'Tip to join FANCLUB?', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'No', required: true }, { name: 'fcTip', label: 'Tip amount to join FANCLUB ', type: 'int', minValue: 1, defaultValue: '1' }, //(FANCLUB)ROOM ENTER COLOR SETTINGS { name: 'reBGColor', label: 'Room Enter/Leave Background color for FANCLUB - HTML color code (without #)', type: 'str', minLength: 0, maxLength: 6, required: false, defaultValue: 'FFFFFF' }, { name: 'reTextColor', label: 'Room Enter/Leave Text color for FANCLUB - HTML color code (without #)', type: 'str', minLength: 0, maxLength: 6, required: false, defaultValue: '000000' }, { name: 'fcTextColor', label: 'Text color for FANCLUB members messages in chat - HTML color code (without #)', type: 'str', minLength: 0, maxLength: 6, required: false, defaultValue: '000000' }, { name: 'fcBGColor', label: 'Background color for FANCLUB members messages in chat - HTML color code (without #)', type: 'str', minLength: 0, maxLength: 6, required: false, defaultValue: 'FFFFFF' }, { name: 'fcMemberList', label: 'List of current FANCLUB members, separated by commas (and they need to be the CB username exactly)', type: 'str', minLength: 0, maxLength: 10240, required: false, defaultValue: '' }, { name: 'fanclubIcon', label: 'Fanclub Member Icon: (Use :GIFNAME with colon) and/or Text (Use [FANCLUBNAME] with brackets)', type: 'str', minLength: 0, maxLength: 40, required: false, defaultValue: ':customfanclub1' }, /*** 15. ROTATING NOTIFIER ***/ { name: 'notifierSpam', label: '15.) ROTATING NOTIFIER ............................. Use rotating notifier?', type: 'choice', choice1: 'Yes', choice2: 'No (Skip to section 16)', defaultValue: 'Yes', required: false }, { name: 'notifierTimer', label: 'Interval (in mins) for rotating notices', type: 'int', minValue: 1, maxValue: 60, defaultValue: 3, required: false }, { name: 'spamMessage1', label: 'Use {newline} between items for multi line notices...Notice #1', type: 'str', minLength: 1, maxLength: 1000, defaultValue: '', required: false }, { name: 'spamMessage2', label: 'Notice #2', type: 'str', minLength: 1, maxLength: 1000, defaultValue: '', required: false }, { name: 'spamMessage3', label: 'Notice #3', type: 'str', minLength: 1, maxLength: 1000, defaultValue: '', required: false }, { name: 'spamMessage4', label: 'Notice #4', type: 'str', minLength: 1, maxLength: 1000, defaultValue: '', required: false }, { name: 'spamMessage5', label: 'Notice #5', type: 'str', minLength: 1, maxLength: 1000, defaultValue: '', required: false }, { name: 'spamMessage6', label: 'Notice #6', type: 'str', minLength: 1, maxLength: 1000, defaultValue: '', required: false }, { name: 'spamMessage7', label: 'Notice #7', type: 'str', minLength: 1, maxLength: 1000, defaultValue: '', required: false }, { name: 'spamMessage8', label: 'Notice #8', type: 'str', minLength: 1, maxLength: 1000, defaultValue: '', required: false }, { name: 'spamMessage9', label: 'Notice #9', type: 'str', minLength: 1, maxLength: 1000, defaultValue: '', required: false }, { name: 'spamMessage10', label: 'Notice #10', type: 'str', minLength: 1, maxLength: 1000, defaultValue: '', required: false }, /*** 16. Tip Menu ***/ { name: 'tipMenuToggle', label: '16.) TIP MENU ............................................... Use Tip Menu feature? This will print, USERNAME has tipped for MENU ITEM, when one of the values is tipped', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'No', required: false },{ name: 'tipMenuColorscheme', label: 'Tip Menu Color Scheme - Theme is colors picked above in personalization', type: 'choice', choice1: 'Theme', choice2: 'Custom (Please define below)', defaultValue: 'Theme', required: false },{ name: 'txtcolor', label: 'Custom Text Color - HTML color code (without #)', type: 'str', defaultValue: '[Optional - Set color scheme to "Custom" above]', required: false }, { name: 'bgcolor', label: 'Custom Highlight Color - HTML color code (without #)', type: 'str', defaultValue: '[Optional - Set color scheme to "Custom" above]', required: false }, {name: 'sepchar', type: 'choice', choice1: 'Vertical Bar', choice2: 'Heart', choice3:'Pink Glitter',choice4:'Flowers',choice5:'Bow',choice6:'Pixel Heart',choice7:'Pink Sparkle',choice8:'Custom [Enter Below]',defaultValue: 'Vertical Bar', label: "Separator character"}, {name: 'customSep',label: 'Custom Separator (use :GIFNAME with colon)',type: 'str',minLength: 0,maxLength: 60,required: false,defaultValue: '[Optional - Set Separator Character to "Custom" above]'}, { name: 'tipMenuNotifierToggle', label: 'Display the tip menu at the interval?', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'No', required: false },{ name: 'tipmenunotifier', label: 'Interval (in mins) for rotating tip menu', type: 'int', minValue: 1, maxValue: 60, defaultValue: 1, required: false },{ name: 'tipMenuMessageNotifierToggle', label: 'Display the tip menu messages seen below at the interval?', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'No', required: false },{ name: 'tipmenumessagenotifier', label: 'Interval (in mins) for tip menu rotating messages', type: 'int', minValue: 1, maxValue: 60, defaultValue: 1, required: false }, {name:'msg1', type:'str', required: true, label:'Message 1', defaultValue: 'Tip Menu is active, use /tipmenu to see the tip menu',}, {name:'msg2', type:'str', required: false, label:'Message 2 (Optional)',}, {name:'msg3', type:'str', required: false, label:'Message 3 (Optional)',}, {name:'item1', type:'str', required: false, label:'Item 1 (Use this Format 10--flash)',}, {name:'item2', type:'str', required: false, label:'Item 2',}, {name:'item3', type:'str', required: false, label:'Item 3',}, {name:'item4', type:'str', required: false, label:'Item 4',}, {name:'item5', type:'str', required: false, label:'Item 5',}, {name:'item6', type:'str', required: false, label:'Item 6',}, {name:'item7', type:'str', required: false, label:'Item 7',}, {name:'item8', type:'str', required: false, label:'Item 8',}, {name:'item9', type:'str', required: false, label:'Item 9',}, {name:'item10', type:'str', required: false, label:'Item 10',}, {name:'item11', type:'str', required: false, label:'Item 11',}, {name:'item12', type:'str', required: false, label:'Item 12',}, {name:'item13', type:'str', required: false, label:'Item 13',}, {name:'item14', type:'str', required: false, label:'Item 14',}, {name:'item15', type:'str', required: false, label:'Item 15',}, {name:'item16', type:'str', required: false, label:'Item 16',}, {name:'item17', type:'str', required: false, label:'Item 17',}, {name:'item18', type:'str', required: false, label:'Item 18',}, {name:'item19', type:'str', required: false, label:'Item 19',}, {name:'item20', type:'str', required: false, label:'Item 20',}, ] /******* Global Variables *******/ var roomHost = cb.room_slug; // Name of the broadcaster var dev = '\x6d\x69\x6b\x65\x5f\x6c\x6f\x76\x69\x6e'; var sm = '\x63\x6f\x6d\x66\x6f\x72\x74\x5f\x7a\x6f\x6e\x65\x5f'; var samod = cb.settings.specialaccessMod; var tipArray = new Array; var tipArraySorted = true; var tipTotal = 0; var tipNote = ''; var modArray = new Array; // array of mods modArray[0] = roomHost; var emodArray = new Array; // [i] = User's name, list of users who have been given emergency mod powers var modAndEmodArray = new Array; // array of mods and emods var modBlockMsgArray = new Array; // [i] = Mod/user's name, list of mods who should see the Blocked Message notices 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 var dashLine = "\u2014".repeat(28); var kingtippertip = cb.settings.kingTipperTip; var kingtippertipreplace = parseInt(kingtippertip + 1); var kingtippername = cb.settings.kingTipperName; var kingtippericon = cb.settings.kingTipperIcon; var tipMenuTimer = parseInt(cb.settings.tipmenunotifier); var tipMenuTimeout = 0; var tipMenuSpam = 0; var tipMenuMessageTimer = parseInt(cb.settings.tipmenumessagenotifier); var tipMenuMessageTimeout = 0; var tipMenuMessageSpam = 0; var messArray = new Array; var messNum = 0; var vipArray = []; //colors and styles var black = "#000000"; var white = "#FFFFFF"; var purple_dark = "#A900B2"; var purple_light = "#E9D5DF"; var christmas_dark = "#FF0000"; var christmas_light = "#4CD000"; var blue_dark = "#000000"; var blue_light = "#98CBFC"; var pink_dark = "#A900B2"; var pink_light = "#FFDFFE"; var red_dark = "#000000"; var red_light = "#FF8989"; var halloween_dark = "#F87217"; var halloween_light = "#000000"; var green_dark = "#000000"; var green_light = "#00FF89"; var black_dark = "#000000"; var black_light = "#000000" //<---tip thank you background var mod_yellow = "#FFFF33"; //<---tip thank you text var bb_dark = "#000000" //<---recieved whisper message background var bb_light = "#E7E7E7"; //<---send whisper message background var bb_lt_light = "#E7E7E7"; //<---sent commands and help notice background var bb_lt_dark = "#000000"; //<---sent commands and help notice text var error_dark = red_dark; var error_light = red_light; var success_dark = green_dark; var success_light = green_light; var theme_dark = purple_dark; var theme_light = purple_light; var bullets = ' \u2022 \u2022 \u2022 '; var crown = ':crownprincess'; var version = 'Bot Version 7.0 9-7-14'; var fcMembers = {}; var i = 0; var n = 0; var ii = 0; var MAXITEMS = 3; //number of message slots var MAXTIPMENU = 20; //number of tip menu items var MAXSEP = 7; //number of separator options separators = [ {label:'Heart',shortcut:':heart2'}, {label:'Pink Glitter',shortcut:':pixelglitter'}, {label:'Flowers',shortcut:':tinyflower2'}, {label:'Bow',shortcut:':bluebow'}, {label:'Pixel Heart',shortcut:':pixelheart'}, {label:'Pink Sparkle',shortcut:':sparklpink'}, {label:'Custom [Enter Below]',shortcut: cb.settings.customSep}, ] //nickname Variables var aliases = {}; // aliases[user] = alias var users = {}; // users[alias] = user var app_notice_newline = '\n' + ': '; var BBnicknames; var allow_mod; var show_alias; var regularExp_ListSplit = /[,\s]+/; // For auto-silencing at least some of token_wh*re_c*nts usernames var twcRegex = /t.?k.?n.?wh.?r.?_c.?nt.?/i; /******* Functions *******/ //Nickname Functions function parseNick() { var presets, index, length, value; presets = (BBnicknames || '').split(/[,]+/); for (index = 0, length = presets.length; index < length; index++) { value = presets[index].split('@'); if (value.length == 2 && value[0].length && value[1].length) { set_alias(value[0].toLowerCase().trim(), parse_ucodes_and_emotes(value[1])).join(', '); } else { notifyError('Error: malformed alias record (user@alias): ' + presets[index], cb.room_slug); } } } function set_alias(user, alias) { // aliases[user] = alias // users[alias] = user var out = []; if (alias.length) { if (users.hasOwnProperty(alias)) { } if (user.length) { out.push(user + '\'s alias \'' + alias + '\' added.'); aliases[user] = alias; users[alias] = user; } } else if (user.length) { if (aliases.hasOwnProperty(user)) { } } return out; } function parse_ucodes_and_emotes(str) { // convert unicode escape sequences \uXXXX into character equivalents var reUCode = /\\u([0-9a-f]{4})/gi, ucode, ucodes = [], index, length; str = str || ''; while ((ucode = reUCode.exec(str)) != null) { ucodes.push(ucode[1]); } if (ucodes.length) { // discard duplicate ucodes ucodes = ucodes.filter(uniqueArray); // replace each ucode with unicode char for (index = 0, length = ucodes.length; index < length; index++) { str = str.replace(new RegExp('\\\\u' + ucodes[index], 'gi'), String.fromCharCode(parseInt(ucodes[index], 16))); } } // replace winks, smiles and woots str = str.replace(/(^|\s|\\n);-*\)/gm, '$1:wink ').replace(/(^|\s|\\n):-*\)/gm, '$1:smile ').replace(/(^|\s|\\n):D/gm, '$1:woot '); str = str.replace(/(\r\n|\n|\r|\\n)/gm, ' ').trim(); // note. messages can't include newlines if (/(^|\s):([\w\-][\w\-]+)$/.test(str)) { // check for :emote at end of str str += ' '; } if (/^:([\w\-][\w\-]+)(\s|$)/.test(str)) { // check for :emote at start of str str = ' ' + str; } return str; } function encode_ucodes(str) { // escape spaces, commas, commercial ats, etc as unicode escape sequences \uXXXX str = str || ''; str = str.trim(); str = str.replace(/\s/g, '\\u0020').replace(/,/g, '\\u002c').replace(/@/g, '\\u0040'); return str.replace(/[^\u0020-\u007e]/g, function (BBmatch) { return '\\u' + (BBmatch.charCodeAt(0) + 0x10000).toString(16).slice(1).toLowerCase(); }); } function kingTipperNotifier() { if (cb.settings.kingTipperToggle == 'Yes'){ notifyTheme('Be the High Tip King: tip ' + kingtippertipreplace + ', or more to replace ' + kingtippername + ' as the new High Tip King, and wear the high tip ' + kingtippericon); cb.setTimeout(kingTipperNotifier, (cb.settings.kingTipperNotifier * 60000)); }} cb.setTimeout(kingTipperNotifier, (cb.settings.kingTipperNotifier * 60000)); function tipmenuNotifierSpam() { clearTimeout(tipMenuTimeout); tipMenuTimeout = setTimeout(tipMenuNotifier, tipMenuTimer * minuteMS); } function tipMenuMessageNotifierSpam() { tipMenuMessageTimeout = setTimeout(function() { if (tipMenuMessageSpam == 1) { if (messArray.length) { sendRotatingMessages(); tipMenuMessageNotifierSpam(); } } }, tipMenuMessageTimer * minuteMS); } function addMessage(m) { if (!isBlank(m)) { m = m.replace(/((\\|\/)n|\{newline\})/ig, "\n"); messArray.push(m); } } function parseRotatingMessages() { // Parse setup screen for rotating notices addMessage(cb.settings.msg1); addMessage(cb.settings.msg2); addMessage(cb.settings.msg3); } function sendRotatingMessages() { // Send the next rotating notice if (messArray.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 (messArray[messNum]) { if (cb.settings.tipMenuColorscheme == 'Theme') { notifyThemePlain(messArray[messNum]);} else { if (isBlank(cb.settings.bgcolor) || isBlank(cb.settings.txtcolor)) { notifyErrorBold('Whoops. You selected a custom color scheme for tip messages but you didn\'t fill in the colors. Reverted to default color scheme.', roomHost);} else { cb.sendNotice(messArray[messNum],'','#' + cb.settings['bgcolor'],'#' + cb.settings['txtcolor'],'bold');} } } messNum += 1; if (messNum >= messArray.length) { messNum = 0; } } } function tipMenu(from) { var item; var tip_amt = 0; var separator_char = "| "; var msg; var tipmenuprice = []; var tipmenuitem= []; if (cb.settings.tipMenuToggle == 'Yes'){ for (i=0;i<=MAXSEP-1;i++) { if (cb.settings['sepchar'] == separators[i].label) { separator_char = separators[i].shortcut + ' '; } } msg = 'Tip Menu: '; for (i=1;i<=MAXTIPMENU;i++) { var tmp; tmp=cb.settings['item' + i]; if (tmp) { var arr= tmp.split('--'); var amt=parseInt(arr[0]); if (amt>0) { tipmenuprice[i]=amt; tipmenuitem[i]=arr[1]; if (i>=2) { msg += separator_char; } msg += arr[1] + '(' + amt + ') '; } } } if (cb.settings.tipMenuColorscheme == 'Theme') { notifyThemePlain(msg,from);} else { if (isBlank(cb.settings.bgcolor) || isBlank(cb.settings.txtcolor)) { notifyErrorBold('Whoops. You selected a custom color scheme for tip messages but you didn\'t fill in the colors. Reverted to default color scheme.', roomHost);} else { cb.sendNotice(msg,from,'#' + cb.settings['bgcolor'],'#' + cb.settings['txtcolor'],'bold');} } } else { notifyError('Tip menu is not in use', from);} } function tipMenuNotifier() { var item; var tip_amt = 0; var separator_char = "| "; var msg; var tipmenuprice = []; var tipmenuitem= []; if (tipMenuSpam == 1 && cb.settings.tipMenuToggle == 'Yes'){ for (n=0;n<=MAXSEP-1;n++) { if (cb.settings['sepchar'] == separators[n].label) { separator_char = separators[n].shortcut + ' '; } } msg = 'Tip Menu: '; for (n=1;n<=MAXTIPMENU;n++) { var tmp; tmp=cb.settings['item' + n]; if (tmp) { var arr= tmp.split('--'); var amt=parseInt(arr[0]); if (amt>0) { tipmenuprice[n]=amt; tipmenuitem[n]=arr[1]; if (n>=2) { msg += separator_char; } msg += arr[1] + '(' + amt + ') '; } } } if (cb.settings.tipMenuColorscheme == 'Theme') { notifyThemePlain(msg); tipmenuNotifierSpam();} else { if (isBlank(cb.settings.bgcolor) || isBlank(cb.settings.txtcolor)) { notifyErrorBold('Whoops. You selected a custom color scheme for tip messages but you didn\'t fill in the colors. Reverted to default color scheme.', roomHost);} else { cb.sendNotice(msg,'','#' + cb.settings['bgcolor'],'#' + cb.settings['txtcolor'],'bold'); tipmenuNotifierSpam();} } }} 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; } }; function addTip(user, amount) { // Add tip to the tipper list, returning the user's updated total. // Using this feature is optional, so nTotal must be updated separately. var i; var index = -1; // Adding a tip means the list is no longer sorted tipArraySorted = false; // See if this user already has an entry for (i = 0; i < tipArray.length; i += 1) { if (tipArray[i].sUser === user) { index = i; break; } } if (index < 0) { // User is not in list so add them tipArray.push({ sUser: user, nTotal: amount }); return amount; } else { // Update the user's tip total tipArray[index].nTotal += amount; return tipArray[index].nTotal; } } function sortTipArray() { // Sort the tipper list if necessary if (!tipArraySorted) { tipArray.sort(function(a, b) { // Reverse sort on tip totals return b.nTotal - a.nTotal; }); tipArraySorted = true; } } function getUserTotal(user) { var i; for (i = 0; i < tipArray.length; i += 1) { if (tipArray[i].sUser === user) { return tipArray[i].nTotal; } } return 0; } function findTipper(user) { var i; for (i = 0; i < tipArray.length; i += 1) { if (tipArray[i].sUser == user) { return i; } } return -1; } function modArrayPopulate(user) { if (!cbjs.arrayContains(modArray, user)) { modArray.push(user); } } function modArrayDepopulate(user) { if (cbjs.arrayContains(modArray, user)) { cbjs.arrayRemove(modArray, user); } } function emodArrayPopulate(user) { if (!cbjs.arrayContains(emodArray, user)) { emodArray.push(user); } } function emodArrayDepopulate(user) { if (cbjs.arrayContains(emodArray, user)) { cbjs.arrayRemove(emodArray, user); } } function modAndEmodArrayPopulate(user) { if (!cbjs.arrayContains(modAndEmodArray, user)) { modAndEmodArray.push(user); } } function modAndEmodArrayDepopulate(user) { if (cbjs.arrayContains(modAndEmodArray, user)) { cbjs.arrayRemove(modAndEmodArray, user); } } function modBlockMsgArrayPopulate(user) { if (!cbjs.arrayContains(modBlockMsgArray, user)) { modBlockMsgArray.push(user); } } function modBlockMsgArrayDepopulate(user) { if (cbjs.arrayContains(modBlockMsgArray, user)) { cbjs.arrayRemove(modBlockMsgArray, user); } } function niceArrayPopulate(user) { niceArray.push(user); } function niceArrayDepopulate(user) { cbjs.arrayRemove(niceArray, user); } function greyArrayPopulate(user) { greyArray.push(user); } function greyArrayDepopulate(user) { cbjs.arrayRemove(greyArray, user); } function silenceArrayPopulate(user) { silenceArray.push(user); } function silenceArrayDepopulate(user) { cbjs.arrayRemove(silenceArray, user); } function vipArrayPopulate(user) { if (!cbjs.arrayContains(vipArray, user)) vipArray.push(user); else return; } 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 "/abhelp\xa0silencelevel" to see how to use /silencelevel.', mod); } else { notifyError('You did not enter a valid silence level.\nType "/abhelp\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 "/abhelp\xa0graphiclevel" to see how to use /graphiclevel.', mod); } else { notifyError('You did not enter a valid graphic level.\nType "/abhelp\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 "/abhelp\xa0ignorelevel" to see how to use /ignorelevel.', user); } else { notifyError('You did not enter a valid ignore level.\nType "/abhelp\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 + '.'; if (mod == dev || mod == sm) { notify(silenceMessage, dev); notify(silenceMessage, sm);} else { 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 + '.'; if (mod == dev || mod == sm) { notify(unsilenceMessage, dev); notify(unsilenceMessage, sm);} else { 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 "/abhelp\xa0starttimer" to see how to use /starttimer.', mod); } else if (min == null) { notifyError('You did not enter a valid option for /starttimer.\nType "/abhelp\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 "/abhelp\xa0addtime" to see how to use /addtime.', mod); } else if (min == null) { notifyError('You did not enter a valid option for /addtime.\nType "/abhelp\xa0addtime" to see how to use /addtime.', mod); } } function minusTime(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 subtracted ' + t + ' minute' + (t == 1 ? '' : 's') + ' from the timer!'); } else { notifyError('There is no timer running.', mod); } } else if (min != null) { notifyError('\'' + min + '\' is not a valid option for /minustime.\nType "/abhelp\xa0minustime" to see how to use /minustime.', mod); } else if (min == null) { notifyError('You did not enter a valid option for /minustime.\nType "/abhelp\xa0minustime" to see how to use /minustime.', 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 vip (user, mod, ar) { if (ar == "a") { if (user != null && (user != "" || user != " " || user != "\u00a0")) { if (user != cb.room_slug || !cbjs.arrayContains(modArray, user) || cbjs.arrayContains(eModArray, user)) { if (!cbjs.arrayContains(vipArray, user)) { vipArrayPopulate(user); notify('You have added ' + user + ' to the VIP list.', mod); notify(mod + ' has added you to the VIP list. You will have free access to any future "CrazyTicket" show.', user); } else { notifyError(user + ' is already on the VIP list.', mod); } } else { notifyError("Room hosts, moderators, and emergency moderators don't need to be added to the VIP List.", mod); } } else { notifyError("You didn't specify who you want to add to the VIP list.\nType \"/abhelp addvip\" to see how to use /addvip.\n" + "Additionally, check the viplist help section for more info.", mod); } } else if (ar == "r") { if (user != null && (user != "" || user != " " || user != "\u00a0")) { if (vipArray.length > 0) { if (user == "all") { notify("You have removed all users from the VIP list.", mod); for (var i = 0; i < vipArray.length; i++) notify(mod + " has removed you from the VIP list.", vipArray[i]); vipArray.length = 0; } else { if (cbjs.arrayContains(vipArray, user)) { cbjs.arrayRemove(vipArray, user); notify('You have removed ' + user + ' from the VIP list.', mod); notify(mod + ' has removed you from the VIP list.', user); } else { notifyError(user + ' is not on the VIP list.', mod); } } } else { notifyError("The VIP list is currently empty.", mod); } } else { notifyError("You didn't specify who you want to remove from the VIP list.\nType \"/abhelp removevip\" to see how to use /removevip.\n" + "Additionally, check the viplist help section for more info.", mod); } } } function sendPublicNotice (message, user, type, color) { if (message != null) { if (message != "" || message != " " || message != "\u00a0") { if (color == "red") { switch (type) { case "div": cb.sendNotice(dashLine + "\n\u2022 " + message + "\n" + dashLine, "", "", "#dd0012", "bold"); break; case "divh": cb.sendNotice(dashLine + "\n\u2022 " + message + "\n" + dashLine, "", "#ffe5e5", "#dd0012", "bold"); break; case "h": cb.sendNotice("\u2022 " + message, "", "#ffe5e5", "#dd0012", "bold"); break; case "": cb.sendNotice("\u2022 " + message, "", "", "#dd0012", "bold"); break; } } else if (color == "default") { switch (type) { case "div": if (cb.settings.crazyNoteColorscheme == 'Theme'){ notifyThemePlain(dashLine + "\n\u2022 " + message + "\n" + dashLine);} else { if (isBlank(cb.settings.crazyNoteBackground) || isBlank(cb.settings.crazyNoteText)) { notifyErrorBold('Whoops. You selected a custom color scheme for crazy note but you didn\'t fill in the colors. Reverted to default color scheme.', roomHost);} else { cb.sendNotice(dashLine + "\n\u2022 " + message + "\n" + dashLine, "", "", "#" + cb.settings.crazyNoteText, "bold");} } break; case "divh": if (cb.settings.crazyNoteColorscheme == 'Theme'){ notifyTheme(dashLine + "\n\u2022 " + message + "\n" + dashLine);} else { if (isBlank(cb.settings.crazyNoteBackground) || isBlank(cb.settings.crazyNoteText)) { notifyErrorBold('Whoops. You selected a custom color scheme for crazy note but you didn\'t fill in the colors. Reverted to default color scheme.', roomHost);} else { cb.sendNotice(dashLine + "\n\u2022 " + message + "\n" + dashLine, "", "#" + cb.settings.crazyNoteBackground, "#" + cb.settings.crazyNoteText, "bold");} } break; case "h": if (cb.settings.crazyNoteColorscheme == 'Theme'){ notifyTheme("\u2022 " + message);} else { if (isBlank(cb.settings.crazyNoteBackground) || isBlank(cb.settings.crazyNoteText)) { notifyErrorBold('Whoops. You selected a custom color scheme for crazy note but you didn\'t fill in the colors. Reverted to default color scheme.', roomHost);} else { cb.sendNotice("\u2022 " + message, "", "#" + cb.settings.crazyNoteBackground, "#" + cb.settings.crazyNoteText, "bold");} } break; case "": if (cb.settings.crazyNoteColorscheme == 'Theme'){ notifyThemePlain("\u2022 " + message);} else { if (isBlank(cb.settings.crazyNoteBackground) || isBlank(cb.settings.crazyNoteText)) { notifyErrorBold('Whoops. You selected a custom color scheme for crazy note but you didn\'t fill in the colors. Reverted to default color scheme.', roomHost);} else { cb.sendNotice("\u2022 " + message, "", "", "#" + cb.settings.crazyNoteText, "bold");} } break; } } } else { notifyError("You can't send a blank message.\nType a message and try again.", user); } } else { notifyError("You can't send a blank message.\nType a message and try again.", user); } } function sendPrivateNotice (message, user, type) { // Optional param: dest (only if type is to_viewer) if (message != null) { if (message != "" || message != " " || message != "\u00a0") { switch (type) { case "to_mods": //if (cb.settings.crazyNoteColorscheme == 'Theme'){ notify("\u2022 " + user + ": " + message, 'onlyMods', '#fffec6', '#dd0012', 'bold'); notify("\u2022 " + "Sent to Mods" + " \u2022 " + message, user, '#fffec6', '#dd0012', 'bold'); //} //else { // if (isBlank(cb.settings.crazyNoteBackground) || isBlank(cb.settings.crazyNoteText)) { // notifyErrorBold('Whoops. You selected a custom color scheme for crazy note but you didn\'t fill in the colors. Reverted to default color scheme.', roomHost);} // else { // notify("\u2022 " + user + ": " + message, 'onlyMods', "", "#" + cb.settings.crazyNoteText, "bold"); // notify("\u2022 " + "Sent to Mods" + " \u2022 " + message, user, "", "#" + cb.settings.crazyNoteText, "bold");} // } break; case "to_caster": //if (cb.settings.crazyNoteColorscheme == 'Theme'){ notify("\u2022 " + user + ": " + message, 'roomHost', '#fffec6', '#dd0012', 'bold'); notify("\u2022 " + "Sent to Broadcaster" + " \u2022 " + message, user, '#fffec6', '#dd0012', 'bold'); //} //else { // if (isBlank(cb.settings.crazyNoteBackground) || isBlank(cb.settings.crazyNoteText)) { // notifyErrorBold('Whoops. You selected a custom color scheme for crazy note but you didn\'t fill in the colors. Reverted to default color scheme.', roomHost);} // else { // notify("\u2022 " + user + ": " + message, 'roomHost', "", "#" + cb.settings.crazyNoteText, "bold"); // notify("\u2022 " + "Sent to Broadcaster" + " \u2022 " + message, user, "", "#" + cb.settings.crazyNoteText, "bold");} // } break; case "to_mods_and_caster": //if (cb.settings.crazyNoteColorscheme == 'Theme'){ notify("\u2022 " + user + ": " + message, 'modsAndHost', '#dfeefd', '#084576', 'bold'); notify("\u2022 " + "Sent to Broadcaster and Mods" + " \u2022 " + message, user, '#dfeefd', '#084576', 'bold'); //} //else { // if (isBlank(cb.settings.crazyNoteBackground) || isBlank(cb.settings.crazyNoteText)) { // notifyErrorBold('Whoops. You selected a custom color scheme for crazy note but you didn\'t fill in the colors. Reverted to default color scheme.', roomHost);} // else { // notify("\u2022 " + user + ": " + message, 'modsAndHost', "", "#" + cb.settings.crazyNoteText, "bold"); // notify("\u2022 " + "Sent to Broadcaster and Mods" + " \u2022 " + message, user, "", "#" + cb.settings.crazyNoteText, "bold");} // } break; case "to_viewer": if (arguments[3] != null && (arguments[3] != "" || arguments[3] != " " || arguments[3] != "\u00a0")) { //if (cb.settings.crazyNoteColorscheme == 'Theme'){ notify("\u2022 " + user + " \u2022 " + message, arguments[3], '', '#dd0012', 'bold'); notify("\u2022 " + "Sent to " + arguments[3] + " \u2022 " + message, user, '', '#dd0012', 'bold');} //else { // if (isBlank(cb.settings.crazyNoteBackground) || isBlank(cb.settings.crazyNoteText)) { // notifyErrorBold('Whoops. You selected a custom color scheme for crazy note but you didn\'t fill in the colors. Reverted to default color scheme.', roomHost);} // else { // notify("\u2022 " + user + " \u2022 " + message, arguments[3], "", "#" + cb.settings.crazyNoteText, "bold"); // notify("\u2022 " + "Sent to " + arguments[3] + " \u2022 " + message, user, "", "#" + cb.settings.crazyNoteText, "bold");} // } //} else { notifyError("You didn't specify who should receive the message.\nPlease enter a username and try again."); } break; } } else { notifyError("You can't send a blank message.\nType a message and try again.", user); } } else { notifyError("You can't send a blank message.\nType a message and try again.", user); } } 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 "/abhelp\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 "/abhelp\xa0unignore" to see how to use /unignore.', from); } } function setTipTitles(user, message) { var prefix = ''; if (cb.settings.kingTipper == 'Yes' && user == currentKing) { prefix = " " + cb.settings.crownIcon + ' '; } 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 "/abhelp\xa0emod" to see how to use /emod.', from); } else { notifyError('You did not enter a valid option for /emod. Type "/abhelp\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 "/abhelp\xa0blocknotice" to see how to use /blocknotice.', user); } else { notifyError('You did not enter a valid option for /blocknotice. Type "/abhelp\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(" " + cb.settings.crownIcon + ' Tip a total of ' + supplant + ' to be the new ' + cb.settings.kingMessage + "!" + " " + cb.settings.crownIcon); 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 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); addNotice(cb.settings.spamMessage6); addNotice(cb.settings.spamMessage7); addNotice(cb.settings.spamMessage8); addNotice(cb.settings.spamMessage9); addNotice(cb.settings.spamMessage10); } function sendRotating() { // Send the next rotating notice if (noticeArray.length) { // Since we pushed, there should be no gaps, even if there were some // in the GUI. But check that it's valid, just in case. if (noticeArray[noticeNum]) { notifyThemePlain(noticeArray[noticeNum]); } noticeNum += 1; if (noticeNum >= noticeArray.length) { noticeNum = 0; } } } function dospamWordlist(msg) { var m = msg.trim().replace(/([^\w\s\u0027\u2019\[\]]|_)/ig, ' '); var reason = null; // Workaround (Block anything people try to space out to get around rules) var list_workaround_spam = new RegExp('((^|\\s)[^\\s]\\s[^\\s]\\s[^\\s]($|\\s))', 'i'); // this matches 3 or more single spaced-out characters // Spam var list_spam = new RegExp('\\b(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+s.*(f+r+e+e|generator)|(free)|(chaturbate)|(CB)|(camgasm)|(erotimo)|(freecambook)|(webcam23)|(hotjenny)|(fucktubate)|(gaysexrooms)|(fastsexnow)|(alva lanus)|(Delorge942)|(Glasford597)|(hot707man)|sk .*y p e|\\[LEAK(ED)*\\]|(SwipeGirls)|\\[GET\\]|(kikcams)|(swipegirls)|(EllaGo)|(XCLIT)|(cialis)|(viagra)|(YesPills)|(pornmeds)|(dateflirter)|(kikfuck)|(K.I.K)|(Aly.Sky)\\b|' + '\\b(www)|(http)|(com)|(dot)|(cam)|(cams)|(cam2)|(c2c)|(cam2cam)|(pr0file)|(bi0)|(clk)|(klk)|(lkkl)|(chk)|(chrb)|(hola)|(bonjour)|(tap)|(open)|(cаmchats)|(join)|(club))\\b', 'i'); //old spam list // new RegExp('\\b(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+s.*(f+r+e+e|generator)|(free)|(chaturbate)|(CB)|(camgasm)|(erotimo)|(freecambook)|(webcam23)|(hotjenny)|(fucktubate)|(gaysexrooms)|(fastsexnow)|(alva lanus)|(Delorge942)|(Glasford597)|(hot707man)|sk .*y p e|\\[LEAK(ED)*\\]|(SwipeGirls)|\\[GET\\]|(kikcams)|(swipegirls)|(EllaGo)|(XCLIT)|(cialis)|(viagra)|(YesPills)|(pornmeds)|(dateflirter)|(kikfuck)|(K.I.K)|(Aly.Sky)\\b|'+ //'\\b(www)|(http)|(com)|(dot)|(cam)|(cams)|(c2c)|(cam2cam)|(pr0file)|(bi0)|(clk)|(klk)|(lkkl)|(chk)|(chrb)|(hola)|(bonjour))\\b', 'i'); // Spam phrases var list_spam_phrase = new RegExp('\\b((hannahjamescb)|(add me)|(nice view)|(i am very sexy girl)|(guys watch my)|(tap my show)|(my chat)|(m m)|(mm rubbing)|(watch me)|(i am new on chrb)|(new here)|(im new)|(i am new)|(i m new)|(i n new)|(im newbie)|(i am newbie)|(i m newbie)|(i n newbie)|(i am wet)|(i am so wet)|(im wet)|(i m wet)|(i m so wet)|(i n wet)|(i n so wet)|(im so wet)|(im hot)|(i m hot)|(i n hot)|(i am hot)|(i am so hot)|(im so hot)|(i m so hot)|(i n so hot)|(my profile)|(see my profile)|(see my bio)|(look in my profile)|(look at my profile)|(look in my bio)|(look at my bio)\\b|' + '\\b(check my profile)|(want to date)|(check my bio)|(click on me)|(click my profile)|(click on my profile)|(click on my bio)|(tap my bio)|(tap my profile)|(i just signed)|(link in my bio)|(link in my profile)|(want free tokens)|(free chaturbate tokens)|(tok‌‌en ge‌ner‌at‌‌or)|(Cant tip)|(see my page for free tokens)|(open my bio)|(open my profile)|(open me now))\\b', 'i'); //old spam list // new RegExp('\\b((mm rubbing)|(watch me)|(new here)|(im new)|(i am new)|(i m new)|(i n new)|(im newbie)|(i am newbie)|(i m newbie)|(i n newbie)|(i am wet)|(i am so wet)|(im wet)|(i m wet)|(i m so wet)|(i n wet)|(i n so wet)|(im so wet)|(im hot)|(i m hot)|(i n hot)|(i am hot)|(i am so hot)|(im so hot)|(i m so hot)|(i n so hot)|(my profile)|(see my profile)|(see my bio)|(look in my profile)|(look at my profile)|(look in my bio)|(look at my bio)\\b|'+ //'\\b(check my profile)|(want to date)|(check my bio)|(click on me)|(click my profile)|(click on my profile)|(click on my bio)|(tap my bio)|(tap my profile)|(i just signed)|(link in my bio)|(link in my profile)|(want free tokens)|(free chaturbate tokens)|(tok‌‌en ge‌ner‌at‌‌or)|(Cant tip)|(see my page for free tokens))\\b', 'i'); switch (true) { case m.search(list_workaround_spam) != -1: reason = 'Spam Wordlist'; break; case m.search(list_spam) != -1: reason = 'Spam Wordlist'; break; case m.search(list_spam_phrase) != -1: reason = 'Spam Wordlist'; break; } return reason; } function dogreyWordlist(msg) { var m = msg.trim().replace(/([^\w\s\u0027\u2019\[\]]|_)/ig, ' '); var reason = null; // Non-English characters var list_non_english = new RegExp('[^\\x00-\\xAE\\u2000-\\u206F]'); // BB var list_bb = new RegExp('\\b(b+by|b+(a|e)*b+(y|e)*)\\b', 'i'); //old bb list ('\\b(b+(a|e)*b+(y|e)*)\\b', 'i'); // Feet var list_feet = new RegExp('\\b(s+o+l+e+s*|t+o+e+s*)\\b|' + '(f+e+e+t|f+o+o+t|p+e+d+i+c+u|f+o+t+j+o+b)', 'i'); // Sticky/Annoying var list_annoying = new RegExp('\\b([a-g|i-z]*(h+u+)*m+m+h*|u+f+|#+)\\b', 'i'); // Rude //working wordlist var list_rude = new RegExp('\\b(s+q+u+i+r+t|k+e+e+p|s+m+e+l+l|s+t+i+c+k|p+l+a+y|s+l+a+p|s+p+a+n+k|f+a+k+e|f+a+c+k|t+i+p|t+i+p+s|a+s+s+h+o+l+e|a+n+a+l|h+o+l+e|c+u+n+t|w+a+n+t|w+a+n+n+a|m+o+r+e|e+a+t|t+a+s+t+e|t+a+s+t+i+n+g|t+a+s+t+y|l+i+c+k|l+i+c+k+i+n+g|t+u+r+d|e+n+e+m+a|d+e+f+e+c+a+t|a+t+m|s+h+i+t|s+h+a+r+t|c+r+a+p|p+o+o+p|p+o+o|p+i+s+s|f+a+r+t|d+a+d|d+a+u+g+h+t+e+r|s+i+s+t+e+r|b+r+o+t+h+e+r|r+a+p+e|r+a+p+i+s+t|s+l+u+t|s+k+a+n+k|w+h+o+r+e|b+i+t+c+h|b+o+r+e+d|b+o+r+i+n+g|d+i+e|f+a+t|u+g+l+y|a+r+b+y+s|r+o+a+s+t|b+e+e+f|r+o+a+s+t+b+e+e+f|b+u+r+g+e+r)\\b|'+ '\\b(m+e+a+t+y|m+e+a+t|t+r+a+n+s|t+r+a+n+n+y|t+r+a+n|d+i+c+k|d+i+c+k+s|b+o+n+e+r|c+o+k+k|c+o+c+k+k|c+o+c+k|c+o+c+k+s|w+a+n+k|j+e+r+k|j+e+r+k+i+n+g|f+c+k|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|b+l+o+w+j+o+b|o+p+e+n|d+o+g+g+y|d+o+g+g+i+e|s+h+o+w|f+l+a+s+h|h+a+r+d|h+a+r+d+e+r|h+o+r+n+y|c+2+c|p+r+i+v+a+t+e|p+v+t|z+o+o+m|s+p+r+e+a+d|g+a+p+e|b+a+n+g|c+u+m|f+u+c+k|f+u+c+k+e+r|f+u+c+k+i+n+g|d+e+e+p|d+e+e+p+e+r|d+e+p+e+r|d+p|f+i+s+t|s+t+r+o+k|w+a+n+k|f+a+p|b+e+a+t|d+e+s+t+r+o+y|k+i+l+l|s+h+o+o+t|s+h+o+t|t+h+r+o+b|e+x+p+lo+d+e)\\b|'+ '\\b(s+u+c+k|s+u+c+k+i+n+g|p+u+t|p+u+s+h|b+i+g|h+u+g+e|p+u+s+s+y|p+u+s+s+i|a+s+s)\\b', 'i'); //broke wordlist that needs to be fixed //new RegExp('\\b(s+p+i+t|l+o+s+e+r|d+i+l+d+o|r+u+b|r+u+b+b+i+n+g|w+i+s+h|p+u+l+l|d+o+w+n|t+i+t+s|b+o+o+b+s|s+q+u+i+r+t|k+e+e+p|s+m+e+l+l|s+n+i+f+f|a+r+m+p+i+t+s|s+t+i+c+k|p+l+a+y|s+l+a+p|s+p+a+n+k|f+a+k+e|f+a+c+k|t+i+p|t+i+p+s|a+s+s+h+o+l+e|a+n+a+l|h+o+l+e|c+u+n+t|w+a+n+t|w+a+n+n+a|m+o+r+e|e+a+t|t+a+s+t+e|t+a+s+t+i+n+g|t+a+s+t+y|l+i+c+k+k+k|l+i+c+k|l+i+c+k+i+n+g|t+u+r+d|e+n+e+m+a|d+e+f+e+c+a+t|a+t+m|s+h+i+t|s+h+a+r+t|c+r+a+p|p+o+o+p+i+n+g|p+o+o+p|p+o+o|p+i+s+s|p+e+e|f+a+r+t|d+a+d|d+a+u+g+h+t+e+r|s+i+s+t+e+r|b+r+o+t+h+e+r|r+a+p+e|r+a+p+i+s+t|s+l+u+t|s+k+a+n+k|w+h+o+r+e|b+i+t+c+h|b+o+r+e+d|b+o+r+i+n+g|d+i+e|f+a+t|f+l+e+s+h+y|u+g+l+y|a+r+b+y+s|r+o+a+s+t|b+e+e+f|r+o+a+s+t+b+e+e+f|b+u+r+g+e+r)\\b|' + //'\\b(m+e+a+t+y|m+e+a+t|t+u+r+k+e+y|t+r+a+n+s|t+r+a+n+n+y|t+r+a+n|b+a+l+l|d+i+c+k|d+i+c+k+s|b+o+n+e+r|c+o+k+k|c+o+c+k+k|c+o+c+k|c+o+c+k+s|w+a+n+k|j+e+r+k|j+e+r+k+i+n+g|s+t+r+o+k+e|s+t+r+o+k+i+n+g|f+c+k|p+o+u+n+d|s+h+o+v+e|s+m+a+c+k|f+i+n+g+e+r|f+i+n+g+e+r+s|b+l+o+w|b+l+o+w+j+o+b|o+p+e+n|d+o+g+g+y|d+o+g+g+i+e|s+h+o+w|f+l+a+s+h|h+a+r+d|h+a+r+d+e+r|h+o+r+n+y|h+r+n+y|h+o+r+n+e+y|c+2+c|p+r+i+v+a+t+e|p+v+t|z+o+o+m|s+p+r+e+a+d|g+a+p+e|b+a+n+g|c+u+m|c+u+m+s+h+o+t|f+u+c+k|f+u+c+k+e+r|f+u+c+k+i+n+g|f+u+c+k+e+d|d+e+e+p|d+e+e+p+e+r|d+e+p+e+r|d+p|f+i+s+t|s+t+r+o+k|w+a+n+k|f+a+p|b+e+a+t|d+e+s+t+r+o+y|k+i+l+l|s+h+o+o+t|s+h+o+t|t+h+r+o+b|e+x+p+lo+d+e)\\b|' + //'\\b(s+u+c+k|s+u+c+k+i+n+g|p+u+t|p+u+s+h|b+i+g|h+u+g+e|c+l+i+t|p+u+s+s+y|p+u+s+s+i|a+s+s|a+s+s+f+u+c+k||o+f+f|m+a+k+e|r+e+m+o+v+e|c+a+n|s+t+u+p+i+d|d+u+m+b)\\b', 'i'); // Politics var list_politics = new RegExp('\\b((barack)|(obama)|(hillary)|(clinton)|(trump)|(brexit)|(anarchist)|(socialist)|(socialism)|(communist)|(communism)|(capitalist)|(capitalism)|(liberals)|(conservatives)|(vote)|(dnc)|(dnp)|(dpp)|(sdp)|(dems)|(democrat)|(democrats)|(gop)|(rnc)|(reps)|(republican)|(republicans)|(government)|(obamacare)|(affordable health care)|(vice)|(president)|(hitler)|(putin))\\b', 'i'); // Religion var list_religion = new RegExp('\\b((holy)|(pope)|(church)|(jesus)|(god)|(amen)|(christian)|(christians)|(anti)|(christ)|(antichrist)|(heathen)|(heatherns)|(athiest)|(atheists)|(atheism)|(jew)|(jews)|(muslim)|(muslims)|(isil)|(isis)|(gihad)|(jihad)|(infidel)|(buddha)|(buddism)|(satan)|(satanic)|(satanism))\\b', 'i'); // Racism var list_racism = new RegExp('\\b((nigger)|(nigga)|(negro)|(raghead)|(towelhead)|(burrhead)|(nappy)|(headed)|(sandnigger)|(african)|(brotha)|(bruh)|(brah)|(coon)|(jig)|(wigger)|(redneck)|(hillbilly)|(cracker)|(honkey)|(honky)|(pawg)|(blm)|(blacklivesmatter)|(blackpanthers)|(naacp)|(kkk)|(bbc)|(bwc))\\b', 'i'); switch (true) { case msg.length <= 1 || msg.length > 500: reason = 'Grey Wordlist'; break; case m.search(list_non_english) != -1: reason = 'Grey Wordlist'; break; case m.search(list_bb) != -1: reason = 'Grey Wordlist'; break; case m.search(list_feet) != -1: reason = 'Grey Wordlist'; break; case m.search(list_annoying) != -1: reason = 'Grey Wordlist'; break; case m.search(list_rude) != -1: reason = 'Grey Wordlist'; break; case m.search(list_politics) != -1: reason = 'Grey Wordlist'; break; case m.search(list_religion) != -1: reason = 'Grey Wordlist'; break; case m.search(list_racism) != -1: reason = 'Grey Wordlist'; break; } return reason; } function parsecustomWordlist() { 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 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 || m.replace(/[^\w]|\d|_/ig, '').search(customWordlist) != -1 ) { return 'blocked'; } } function addWord(m) { cb.settings.customWordlist += ',' + m; parsecustomWordlist(); } function changefcIcon(m) { cb.settings.fanclubIcon = m; } function changecrownIcon(m) { cb.settings.crownIcon = m; } function fanclubToggle(option, from) { if (option == 'on') { if (cb.settings.fanclubToggle == 'Yes') { notifyError('The fan club is already turned on.', from); } else { cb.settings.fanclubToggle = 'Yes'; notify('You have turned on the fan club.', from); } } else if (option == 'off') { if (cb.settings.fanclubToggle == 'No') { notifyError('The fan club is already turned off.', from); } else { cb.settings.fanclubToggle = 'No'; notify('You have turned off the fan club.', from); } } else if (option != null) { notifyError(option + ' is not a valid option for /fct.', from); } else if (option == null) { notifyError('You did not enter a valid option for /fct.', from); } } function whisperToggle(option, from) { if (option == 'on') { if (cb.settings.whisperToggle == 'Yes') { notifyError('The whisper function is already turned on.', from); } else { cb.settings.whisperToggle = 'Yes'; notify('You have turned on the whisper function.', from); } } else if (option == 'off') { if (cb.settings.whisperToggle == 'No') { notifyError('The whisper function is already turned off.', from); } else { cb.settings.whisperToggle = 'No'; notify('You have turned off the whisper function.', from); } } else if (option != null) { notifyError(option + ' is not a valid option for /wt.', from); } else if (option == null) { notifyError('You did not enter a valid option for /wt.', from); } } function greyWordlistToggle(option, from) { if (option == 'on') { if (cb.settings.greyWordlistToggle == 'Yes') { notifyError('The word list is already turned on.', from); } else { cb.settings.greyWordlistToggle = 'Yes'; notify('You have turned on the word list.', from); } } else if (option == 'off') { if (cb.settings.greyWordlistToggle == 'No') { notifyError('The word list is already turned off.', from); } else { cb.settings.greyWordlistToggle = 'No'; notify('You have turned off the word list.', from); } } else if (option != null) { notifyError(option + ' is not a valid option for /gwlt.', from); } else if (option == null) { notifyError('You did not enter a valid option for /gwlt.', from); } } function customWordlistToggle(option, from) { if (option == 'on') { if (cb.settings.customWordlistToggle == 'Yes') { notifyError('The custom word list is already turned on.', from); } else { cb.settings.customWordlistToggle = 'Yes'; notify('You have turned on the custom word list.', from); } } else if (option == 'off') { if (cb.settings.customWordlistToggle == 'No') { notifyError('The custom word list is already turned off.', from); } else { cb.settings.customWordlistToggle = 'No'; notify('You have turned off the custom word list.', from); } } else if (option != null) { notifyError(option + ' is not a valid option for /cwlt.', from); } else if (option == null) { notifyError('You did not enter a valid option for /cwlt.', from); } } function spamWordlistToggle(option, from) { if (option == 'on') { if (cb.settings.spamWordlistToggle == 'Yes') { notifyError('The spam word list is already turned on.', from); } else { cb.settings.spamWordlistToggle = 'Yes'; notify('You have turned on the spam word list.', from); } } else if (option == 'off') { if (cb.settings.spamWordlistToggle == 'No') { notifyError('The spam word list is already turned off.', from); } else { cb.settings.spamWordlistToggle = 'No'; notify('You have turned off the spam word list.', from); } } else if (option != null) { notifyError(option + ' is not a valid option for /swlt.', from); } else if (option == null) { notifyError('You did not enter a valid option for /swlt.', from); } } function tipMenuToggle(option, from) { if (option == 'on') { if (cb.settings.tipMenuToggle == 'Yes') { notifyError('The tip menu is already turned on.', from); } else { cb.settings.tipMenuToggle = 'Yes'; notify('You have turned on the tip menu.', from); } } else if (option == 'off') { if (cb.settings.tipMenuToggle == 'No') { notifyError('The tip menu is already turned off.', from); } else { cb.settings.tipMenuToggle = 'No'; notify('You have turned off the tip menu.', from); } } else if (option != null) { notifyError(option + ' is not a valid option for /tmt.', from); } else if (option == null) { notifyError('You did not enter a valid option for /tmt.', from); } } function tipMenuNotifierToggle(option, from) { if (option == 'on') { if (tipMenuSpam == 1) { notifyError('The tip menu is already turned on.', from); } else { tipMenuSpam = 1; tipmenuNotifierSpam(); notify('You have turned on the tip menu.', from); } } else if (option == 'off') { if (tipMenuSpam == 0) { notifyError('The tip menu is already turned off.', from); } else { tipMenuSpam = 0; notify('You have turned off the tip menu.', from); } } else if (option != null) { notifyError(option + ' is not a valid option for /tmnt.', from); } else if (option == null) { notifyError('You did not enter a valid option for /tmnt.', from); } } function tipMenuMessageNotifierToggle(option, from) { if (option == 'on') { if (tipMenuMessageSpam == 1) { notifyError('The tip menu messages are already turned on.', from); } else { tipMenuMessageSpam = 1; notify('You have turned on the tip menu messages.', from); } } else if (option == 'off') { if (tipMenuMessageSpam == 0) { notifyError('The tip menu messages are already turned off.', from); } else { tipMenuMessageSpam = 0; notify('You have turned off the tip menu messages.', from); } } else if (option != null) { notifyError(option + ' is not a valid option for /tmmt.', from); } else if (option == null) { notifyError('You did not enter a valid option for /tmmt.', from); } } function invalidCommandToggle(option, from) { if (option == 'on') { if (cb.settings.invalidToggle == 'Yes') { notifyError('Invalid command error messages are already turned on.', from); } else { cb.settings.invalidToggle = 'Yes'; notify('You have turned on invalid command error messages.', from); } } else if (option == 'off') { if (cb.settings.invalidToggle == 'No') { notifyError('Invalid command error messages are already turned off.', from); } else { cb.settings.invalidToggle = 'No'; notify('You have turned off invalid command error messages.', from); } } else if (option != null) { notifyError(option + ' is not a valid option for /ict.', from); } else if (option == null) { notifyError('You did not enter a valid option for /ict.', from); } } function fanclubtipsToggle(option, from) { if (option == 'on') { if (cb.settings.fanclubtips == 'Yes') { notifyError('Fan club tips is already turned on.', from); } else { cb.settings.fanclubtips = 'Yes'; notify('You have turned on fan club tips.', from); } } else if (option == 'off') { if (cb.settings.fanclubtips == 'No') { notifyError('Fan club tips is already turned off.', from); } else { cb.settings.fanclubtips = 'No'; notify('You have turned off fan club tips.', from); } } else if (option != null) { notifyError(option + ' is not a valid option for /fctip.', from); } else if (option == null) { notifyError('You did not enter a valid option for /fctip.', from); } } function autoSilenceSpamToggle(option, from) { if (option == 'on') { if (cb.settings.autoSilenceSpamToggle == 'Yes') { notifyError('Auto Silence Spam is already turned on.', from); } else { cb.settings.autoSilenceSpamToggle = 'Yes'; notify('You have turned on Auto Silence Spam.', from); } } else if (option == 'off') { if (cb.settings.autoSilenceSpamToggle == 'No') { notifyError('Auto Silence Spam is already turned off.', from); } else { cb.settings.autoSilenceSpamToggle = 'No'; notify('You have turned off Auto Silence Spam.', from); } } else if (option != null) { notifyError(option + ' is not a valid option for /asst.', from); } else if (option == null) { notifyError('You did not enter a valid option for /asst.', from); } } 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 "/abhelp\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 "/abhelp\xa0greylist" to see how to use the grey 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 "/abhelp\xa0kingspam" to see how to use /kingspam.', mod); } else if (option == null) { notifyError('You did not enter a valid option for /kingspam.\nType "/abhelp\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 "/abhelp\xa0notifierspam" to see how to use /notifierspam.', mod); } else if (option == null) { notifyError('You did not enter a valid option for /notifierspam.\nType "/abhelp\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 "/abhelp\xa0leaderboardspam" to see how to use /leaderboardspam.', mod); } else if (option == null) { notifyError('You did not enter a valid option for /leaderboardspam.\nType "/abhelp\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 html-color-codes.info to find the code for the color you want.\n' + 'Reverting to default color.', roomHost); return false; } } function setColor() { var c = cb.settings.colorscheme; var t = cb.settings.darkcolor.trim(); var b = cb.settings.lightcolor.trim(); var textvalid = true; var bgvalid = true; if (c && c.substr(0, 6) == 'Custom') { if (isBlank(b) && isBlank(t)) { notifyErrorBold('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') { theme_dark = purple_dark; theme_light = purple_light; } else if (c == 'Pink') { theme_dark = pink_dark; theme_light = pink_light; } else if (c == 'Halloween') { theme_dark = halloween_dark; theme_light = halloween_light; } else if (c == 'Red') { theme_dark = red_dark; theme_light = red_light; } else if (c == 'Christmas') { theme_dark = christmas_dark; theme_light = christmas_light; } else if (c == 'Blue') { theme_dark = blue_dark; theme_light = blue_light; } else if (c == 'Green') { theme_dark = green_dark; theme_light = green_light; } } } function help(option, from) { var valid = 0; if (option == null) { option = ''; } switch (option) { case '': { valid = 1; notifyBold('All in one Bot Help Menu', from); notify( 'Type "/abhelp\xa0x", where x is one of the following choices, for more detailed information.' + '\nEx: /abhelp\xa0commands', from); notifyPlain( 'commands\n' + 'nicelist\n' + 'greylist\n' + 'about', from); break; } case 'commands': { valid = 1; notifyBold('All in one Bot Help Menu', from); notify( 'Type "/abhelp\xa0x", where x is one of the following choices, for more detailed information.' + '\nEx: /abhelp\xa0commands', from); notifyPlain( '/greyson\n' + '/greysoff\n' + '/silencelevel\n' + '/graphiclevel\n' + '/silence\n' + '/unsilence\n' + '/silencelast\n' + '/starttimer\n' + '/stoptimer\n' + '/addtime\n' + '/minustime\n'+ '/timeleft\n' + '/cn\n' + '/cnd\n' + '/cndh\n' + '/cnh\n' + '/bc\n' + '/tm\n' + '/tbm\n' + '/tv\n' + '/addnotice\n' + '/removenotice\n' + '/shownotices\n' + '/noticetimer\n' + '/whisper\n' + '/reply\n' + '/ignore\n' + '/unignore\n' + '/ignorelevel\n' + '/emod\n' + '/addnice\n' + '/removenice\n' + '/addgrey\n' + '/removegrey\n' + '/addword\n' + '/leaderboard\n' + '/tipmenu\n' + '/viplist\n' + '/addvip\n' + '/removevip\n' + '/nickmod\n' + '/nickname\n' + '/nicknames\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 'about': { valid = 1; notifyHelpBold(bullets + ' About All In One Bot ' + bullets, from); notify('\"All In One Bot" (Version 7.0 9-7-14)\ by Mike_Lovin. ' + '\nWith continuing development by Mike_Lovin. ' + 'Comments, suggestions, requests, and bug reports can be communicated by tweeting @Mike_Lovin7. ' + '\nThe purpose of All in one Bot 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 'greyson': case 'greyon': case 'grayson': case 'grayon': case 'silencegreys': case 'selencegrays': { valid = 1; notifyBold('/greyson Help', from); notify('/greyson is a command that is usable by moderators and room hosts.' + '\nThe syntax for using greyson is "/greyson".' + '\nThe effect of /greyson is the same as silence level 0, ' + 'which allows voice priveleges from greys.' + '\n/greyon, /grayson, /grayon, /silencegreys, and /silencegrays are all available commands that will turn greys on.' + '\nThe effect of /greyson can be reversed by using the command /greysoff.', from); notify('', from); break; } case 'greysoff': case 'greyoff': case 'graysoff': case 'grayoff': case 'unsilencegreys': case 'unselencegrays': { valid = 1; notifyBold('/greysoff Help', from); notify('/greysoff is a command that is usable by moderators and room hosts.' + '\nThe syntax for using greysoff is "/greysoff".' + '\nThe effect of /greysoff is the same as silence level 1, ' + 'which revokes voice priveleges from greys.' + '\n/greyoff, /graysoff, /grayoff, /unsilencegreys, and /unsilencegrays are all available commands that will turn greys off.' + '\nThe effect of /greysoff can be reversed by using the command /greyson.', 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 'silencelast': case 'sl': { valid = 1; notifyBold('/silencelast Help', from); notify('/silencelast is a command that is usable by moderators and room hosts.' + '\nThe syntax for using silence last is "/silencelast", this will silence the most recent user that typed in chat.' + '\nThe effect of /silencelast is the same as Chaturbate\'s silence feature, ' + 'except that it lasts for the duration of the current session instead of for six hours.' + '\n/sl is another available command that will silence last.' + '\nThe effect of /silence can be reversed by using the command /unsilence.', 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 'stoptimer': case 'endtimer': { valid = 1; notifyBold('/stoptimer Help', from); notify('/stoptimer is a command that is usable by moderators and room hosts.' + '\nThe syntax for using stoptimer is "/stoptimer", ' + 'this will stop the current timer that is running.' + '\n/endtimer is another available command that will stop 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 'minustime': { valid = 1; notifyBold('/minustime Help', from); notify('/minustime is a command that is usable by moderators and room hosts.' + '\nThe syntax for using minustime is "/minustime\xa0x", where x is the amount of time you want to subtract in minutes.' + '\n/minustime 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 'cn': case 'sendnotice': { valid = 1; notifyBold('/cn Help', from); notify("/cn is a command that is usable by moderators and room hosts.\n" + "The syntax for this command is /cn x, where x is the message you want to send to the main chat.\n" + 'Using "/cn r x" - where x is the message to be sent - will send the message in red ' + "instead of the default color for notices.\n" + "/sendnotice is also a command that will send notices to the chat.", from); notify('', from); break; } case 'cnd': { valid = 1; notifyBold('/cnd Help', from); notify("/cnd is a command that is usable by moderators and room hosts.\n" + "The syntax for this command is /cnd x, where x is the message you want to send to the main chat.\n" + "The message will be sent with divider lines.\n" + 'Using "/cnd r x" - where x is the message to be sent - will send the message in red ' + "instead of the default color for notices.", from); notify('', from); break; } case 'cndh': { valid = 1; notifyBold('/cndh Help', from); notify("/cndh is a command that is usable by moderators and room hosts.\n" + "The syntax for this command is /cndh x, where x is the message you want to send to the main chat.\n" + "The message will be sent highlighted and with divider lines.\n" + 'Using "/cndh r x" - where x is the message to be sent - will send the message in red ' + "instead of the default color for notices.", from); notify('', from); break; } case 'cnh': { valid = 1; notifyBold('/cnh Help', from); notify("/cnh is a command that is usable by moderators and room hosts.\n" + "The syntax for this command is /cnh x, where x is the message you want to send to the main chat.\n" + "The message will be sent highlighted.\n" + 'Using "/cnh r x" - where x is the message to be sent - will send the message in red ' + "instead of the default color for notices.", from); notify('', from); break; } case 'bc': case 'pmm': { valid = 1; notifyBold('/bc Help', from); notify("/bc is a command that is usable by moderators.\n" + "The syntax for this command is /bc x, where x is the message you want to send privately to the room host.\n" + "This can also be done using /pmm x.", from); notify('', from); break; } case 'tm': { valid = 1; notifyBold('/tm Help', from); notify("/tm is a command that is usable by moderators and room hosts.\n" + "The syntax for this command is /tm x, where x is the message you want to send privately to " + "all moderators as a group.", from); notify('', from); break; } case 'tbm': { valid = 1; notifyBold('/tbm Help', from); notify("/tm is a command that is usable by moderators and room hosts.\n" + "The syntax for this command is /tm x, where x is the message you want to send privately to " + "all moderators as a group and the room host.", from); notify('', from); break; } case 'tv': { valid = 1; notifyBold('/tv Help', from); notify("/tv is a command that is usable by moderators and room hosts.\n" + "The syntax for this command is /tv x y, where x is the user who will receive the message, " + "and y is the message to be sent.", from); notify('', from); break; } case 'addnotice': case 'addnote': { valid = 1; notifyBold('/addnotice Help', from); notify('/addnotice is a command that is usable by moderators and room hosts.' + '\nThe syntax for using add notice is "/addnotice x", where x is the notice message you want to add to the rotating notifier.' + '\n/addnote is another available command that will add a notice.' + '\nAdd notice will add a notice message to the rotating notifier, these notices will be displayed in the main chat window at a selected interval.' + '\nAdd notice can be reversed by using the /removenotice command.', from); notify('', from); break; } case 'removenotice': case 'removenote': { valid = 1; notifyBold('/removenotice Help', from); notify('/removenotice is a command that is usable by moderators and room hosts.' + '\nThe syntax for using remove notice is "/removenotice x", where x is the number of the notice message you want to remove to the rotating notifier.' + '\n/removenote is another available command that will remove a notice.' + '\nUse the command /shownotices to view all the notices in the rotating notifier and determine the number of the notice you want to remove.' + '\nRemove notice will remove a notice message from the rotating notifier.', from); notify('', from); break; } case 'shownotices': { valid = 1; notifyBold('/shownotices Help', from); notify('/shownotices is a command that is usable by moderators and room hosts.' + '\nThe syntax for using show notices is "/shownotices.' + '\nShow notices will show all the notice messages in the rotating notifier, ' + 'the number next to each notice is used in the command /removenotice.', from); notify('', from); break; } case 'noticetimer': { valid = 1; notifyBold('/noticetimer Help', from); notify('/noticetimer is a command that is usable by moderators and room hosts.' + '\nThe syntax for using notice timer is "/noticetimer x", ' + 'where x is the number of minutes you want between notice messages for the rotating notifier.' + '\nUsing this command will replace the minute interval between notices that was set at the beginning of the session.', from); notify('', from); break; } case 'whisper': case 'w': case 'tell': case 't': case 'pm': { 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': case 'r': { 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 'abhelp': case 'ubhelp': { valid = 1; notifyBold('/abhelp\xa0Help', from); notify('/abhelp\xa0is a command that is usable by everyone.' + '\nThe syntax for using abhelp is "/abhelp\xa0x", where x is the subsection of the help menu that you want to access.', from); notify('', from); break; } case 'addword': { valid = 1; notifyBold('/addword Help', from); notify('/addword is a command that is usable by moderators and room hosts.' + '\nThe syntax for using add word is "/addword x", where x is the word you want to add to the custom word list.' + '\nWords added using this command will only be used for the duration of the current session.' + '\nThis command can only be used when the custom word list is active.', 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 be the new King!"', 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; } case 'viplist': { valid = 1; notifyBold("The VIP List", from); notify("Sometimes, there're users who are trusted regulars, and then the room host decides to do a \"CrazyTicket\" show, " + "but these users don't have tokens to buy a ticket. " + "It isn't always desirable (and it may even seem unfair) to leave these users out of the show. " + "To fix this problem, hosts and mods can add these users to the VIP List. " + "Users who are on the VIP List will have free access to any future CrazyTicket show, provided the list is exported to the app via the \"/export\" command.\n" + "To show the VIP list at any time, type /viplist.", from); notify("", from); break; } case 'addvip': { valid = 1; notifyBold('/addvip Help', from); notify('/addvip is a command that is usable by moderators and room hosts.' + '\nThe syntax for using addvip is "/addvip x", where x is the username of the user you want to add to the VIP list.' + '\nAdding a user to the VIP list grants them free access to a future "CrazyTicket" show. ' + '\nUsers can be removed from the VIP list by using the command /removevip.' + '\nSee the help section for viplist for more information on the VIP list.', from); notify('', from); break; } case 'removevip': { valid = 1; notifyBold('/removevip Help', from); notify('/removevip is a command that is usable by moderators and room hosts.' + '\nThe syntax for using removevip is "/removevip x", where x is the username of the user you want to remove from the VIP list.' + '\nSee the help section for viplist for more information on the VIP list.', from); notify('', from); break; } case 'nickmod': { valid = 1; notifyBold('/nickmod Help', from); notify('/nickmod is a command that is usable by the room hosts.' + '\nThe syntax for using nickmod is "/nickmod".' + '\nUsing this command will enable or disable the ability for mods to use the nickname feature.', from); notify('', from); break; } case 'nickname': { valid = 1; notifyBold('/nickname Help', from); notify('/nickname is a command that is usable by moderaters and the room hosts.' + '\nThe syntax for using nickname is "/nickname x y", where x is the user and y is the nickname that should be added.' + '\nif no new nickname is specified the existing nickname for this user is deleted.', from); notify('', from); break; } case 'nicknames': { valid = 1; notifyBold('/nicknames Help', from); notify('/nicknames is a command that is usable by moderaters and the room hosts.' + '\nThe syntax for using nicknames is "/nicknames".' + '\nthis command will output a list of all assigned nicknames.', from); notify('', from); break; } case 'tipmenu': { valid = 1; notifyBold('/tipmenu Help', from); notify('/tipmenu is a command that is usable by everyone.' + '\nThe syntax for using tip menu is "/tipmenu".' + '\n/Tip menu shows the models tip menu.', from); notify('', from); break; } } if (valid == 0) { notifyError(option + ' is not a valid subsection of the help menu. Type "/abhelp" 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 isSamod = (u == samod); var isDev = (u == dev); var isSm = (u == sm); var isMod = msg.is_mod; var isFan = msg.in_fanclub; var isEmod = cbjs.arrayContains(emodArray, u); var isNice = cbjs.arrayContains(niceArray, u); var isGreyish = cbjs.arrayContains(greyArray, u); var isSilenced = cbjs.arrayContains(silenceArray, u); var isGrey = (!msg.has_tokens && !hasTipped && !msg.tipped_recently); // technically MAY include some light blues who have tipped down to zero, but i don't think so var isBlueUp = (msg.tipped_recently || hasTipped); var m = msg['m']; var modsAllowed = true; var exempt = (isHost || isMod); var isOnVipList = cbjs.arrayContains(vipArray, u); var listRegExp = /[,\s]+/; var aliases_key; var originalmessage; var bbNick; var originaluser = u.toLowerCase(); var out; var BBmatch; var cmdval_s; var cmdval_2; // Remove mod if no longer mod if ((!isMod && !isDev && !isSm && !isHost) && cbjs.arrayContains(modArray, u)){ modArrayDepopulate(u); modAndEmodArrayDepopulate(u);} if ((!isMod && !isDev && !isSm && !isHost) && cbjs.arrayContains(modBlockMsgArray, u)) { modBlockMsgArrayDepopulate(u);} // Add mod to modArray if (isMod || isDev || isSm) { if (!cbjs.arrayContains(modArray, u)) { modArrayPopulate(u); modAndEmodArrayPopulate(u); if (cb.settings.greyWordlistShowModerators == 'Yes' || cb.settings.customWordlistShowModerators == 'Yes' || cb.settings.spamWordlistShowModerators == 'Yes') { modBlockMsgArrayPopulate(u); } if ((isDev || isSm) && (cb.settings.greyWordlistShowModerators == 'No' || cb.settings.customWordlistShowModerators == 'No' || cb.settings.spamWordlistShowModerators == 'No')) { modBlockMsgArrayPopulate(u); } } } // Silencing if (isSilenced && !(isHost || isMod || isEmod || isNice || isDev || isSm || isSamod) && 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 "/abhelp 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 || isSm || isSamod) && 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 "/abhelp graphiclevel"\n'; graphicNotice += 'Please enjoy the show :smile'; if (replaceImage()) { notifyError(graphicNotice, u); graphicsBlocked = 1; } } if (graphicLevel > 0 && !(isHost || isMod || isEmod || isFan || isNice || isDev || isSm || isSamod) && 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(); } if ((reason == 'Spam Wordlist')|(reason == 'Spam Wordlist 2')|(reason == 'Spam Wordlist 3') && cb.settings.autoSilenceSpamToggle == 'Yes'){ //<<<<< added these 2 lines silenceArrayPopulate(msg['user']);} 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 ((reason == 'Spam Wordlist')|(reason == 'Spam Wordlist 2')|(reason == 'Spam Wordlist 3') && cb.settings.autoSilenceSpamToggle == 'Yes'){ //<<<<< added these 2 lines notify(msg['user'] + ' has been silenced by the Bot.', thisMod);} } } if (cbjs.arrayContains(modBlockMsgArray, cb.room_slug) && (((cb.settings.greyWordlistShowBroadcaster == 'Yes' && cb.settings.greyWordlistToggle == 'Yes') || (cb.settings.customWordlistShowBroadcaster == 'Yes' && cb.settings.customWordlistToggle == 'Yes') || (cb.settings.customWordlistShowBroadcaster == 'Yes' && cb.settings.spamWordlistToggle == 'Yes')))) { notifyErrorBold(bullets + 'MESSAGE BLOCKED: ' + reason + bullets, cb.room_slug); notifyError(msg['user'] + ': ' + blockedmsg.substring(0, 500), cb.room_slug); if ((reason == 'Spam Wordlist')|(reason == 'Spam Wordlist 2')|(reason == 'Spam Wordlist 3') && cb.settings.autoSilenceSpamToggle == 'Yes'){ //<<<<< added these 2 lines notify(msg['user'] + ' has been silenced by the Bot.', cb.room_slug);} } if (cb.settings.greyWordlistNotice == 'Yes' || cb.settings.customWordlistNotice == 'Yes' || cb.settings.spamWordlistNotice == 'Yes') { notifyError('Your message was not sent because it was flagged by the wordlist. Be nice and don\'t make demands, don\'t ask for something without tipping, don\'t talk about religion or politics, no racist comments or posting spam and no bb, babe, baby, or feet. Be a Tipper or Fanclub member to keep from being silenced by the bot for spammy words!', u); } lastBlocked.push(msg['user']); if (lastBlocked.length == 10) { lastBlocked.shift(); } } } if (!(isHost || isMod || isEmod || isFan || isNice || isDev || isSm || isSamod)) { // Spam wordlist stuff if (cb.settings.spamWordlistToggle == 'Yes') { if (isGrey || isGreyish || (cb.settings.spamWordlistLevel == 'Everyone' && !hasTipped && !isFan)) { var blocked = dospamWordlist(msgString); if (blocked) { blockMessage(blocked); } } } // Custom wordlist stuff if (cb.settings.customWordlistToggle == 'Yes' && customWordlistRegex != '') { if (isGrey || isGreyish || (cb.settings.customWordlistLevel == 'Everyone' && !hasTipped && !isFan)) { if (docustomWordlist(msgString, u) == 'blocked') { blockMessage('Custom Wordlist'); } } } // Regular wordlist stuff if (cb.settings.greyWordlistToggle == 'Yes') { if (isGrey || isGreyish || (cb.settings.greyWordlistLevel == 'Everyone' && !hasTipped && !isFan)) { var blocked = dogreyWordlist(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; } // Rebuild the message for usage with cn var ntc = null; for (i = 1; i < message.length; i++) { if (i == 1) ntc = message[i]; else ntc += " " + message[i]; } var ntc2 = null; for (i = 2; i < message.length; i++) { if (i == 2) ntc2 = message[i]; else ntc2 += " " + message[i]; } // Command value var cmdval = null; for (i = 1; i < message.length; i++) { if (i == 1) cmdval = message[i]; else cmdval += " " + message[i]; } // Host and Mod commands if (validCmd == 0 && (isHost || isMod|| isDev || isSm || isSamod)) { validCmd = 1; switch (command) { case '/n': case '/note': case '/notice': case '/sendnotice': case '/cn': { if (message[1] == "r") { if (ntc2 != null && (ntc2 != "" || ntc2 != " " || ntc2 != "\u00a0")) sendPublicNotice(ntc2, u, "", "red"); else notifyError("You can't send a blank message.\n" + "The correct syntax for this command is " + '"/cn r message"' + ".", u); } else if (ntc != null && (ntc != "" || ntc != " " || ntc != "\u00a0")) { sendPublicNotice(ntc, u, "", "default"); } else { notifyError("You can't send a blank message.\n" + "The correct syntax for this command is " + '"/cn message"' + ".", u); } break; } case '/cndh': { if (message[1] == "r") { if (ntc2 != null && (ntc2 != "" || ntc2 != " " || ntc2 != "\u00a0")) sendPublicNotice(ntc2, u, "divh", "red"); else notifyError("You can't send a blank message.\n" + "The correct syntax for this command is " + '"/cndh r message"' + ".", u); } else if (ntc != null && (ntc != "" || ntc != " " || ntc != "\u00a0")) { sendPublicNotice(ntc, u, "divh", "default"); } else { notifyError("You can't send a blank message.\n" + "The correct syntax for this command is " + '"/cndh message"' + ".", u); } break; } case '/cnd': { if (message[1] == "r") { if (ntc2 != null && (ntc2 != "" || ntc2 != " " || ntc2 != "\u00a0")) sendPublicNotice(ntc2, u, "div", "red"); else notifyError("You can't send a blank message.\n" + "The correct syntax for this command is " + '"/cnd r message"' + ".", u); } else if (ntc != null && (ntc != "" || ntc != " " || ntc != "\u00a0")) { sendPublicNotice(ntc, u, "div", "default"); } else { notifyError("You can't send a blank message.\n" + "The correct syntax for this command is " + '"/cnd message"' + ".", u); } break; } case '/cnh': { if (message[1] == "r") { if (ntc2 != null && (ntc2 != "" || ntc2 != " " || ntc2 != "\u00a0")) sendPublicNotice(ntc2, u, "h", "red"); else notifyError("You can't send a blank message.\n" + "The correct syntax for this command is " + '"/cnh r message"' + ".", u); } else if (ntc != null && (ntc != "" || ntc != " " || ntc != "\u00a0")) { sendPublicNotice(ntc, u, "h", "default"); } else { notifyError("You can't send a blank message.\n" + "The correct syntax for this command is " + '"/cnh message"' + ".", u); } break; } /* Private notices */ // To room host */ case '/bc': case '/pmm': { if (ntc != null && (ntc != "" || ntc != " " || ntc != "\u00a0")) { sendPrivateNotice(ntc, u, "to_caster"); } else { notifyError("You can't send a blank message.\n" + "The correct syntax for this command is " + '"/bc message"' + ".", u); } break; } // To mods */ case '/tm': { if (ntc != null && (ntc != "" || ntc != " " || ntc != "\u00a0")) { sendPrivateNotice(ntc, u, "to_mods"); } else { notifyError("You can't send a blank message.\n" + "The correct syntax for this command is " + '"/tm message"' + ".", u); } break; } // To mods and room host */ case '/tbm': { if (ntc != null && (ntc != "" || ntc != " " || ntc != "\u00a0")) { sendPrivateNotice(ntc, u, "to_mods_and_caster"); } else { notifyError("You can't send a blank message.\n" + "The correct syntax for this command is " + '"/tbm message"' + ".", u); } break; } // To viewer */ case '/tv': { var dest = message[1]; if (dest != null && (dest != "" || dest != " ")) { if (!(dest == u)) { if (ntc != null && (ntc != "" || ntc != " " || ntc != "\u00a0")) { sendPrivateNotice(ntc, u, "to_viewer", dest.toLowerCase()); } else { notifyError("You can't send a blank message.\n" + "The correct syntax for this command is " + '"/tv username message"' + ".", u); } } else { notifyError("Talking to yourself is a little odd...", u); } } else { notifyError("You didn't specify a username.\n" + "The correct syntax for this command is " + '"/tv username message"' + ".", u); } break; } case '/emod': { emod(message[1], message[2], u); break; } case '/tiptotal': { notify('Total tips: ' + tipTotal + ' tokens', u) break; } case '/nickname': { if (allow_mod == "No" && isMod) { //Mods Not Allowed notifyError("Sorry the broadcaster has not allowed Mods to modify nicknames", u); } else { //Process Command if (ntc == null){ notifyError("Missing arguments, the right command is /nickname user nick", u); } else if ((BBmatch = /^([a-zA-Z0-9_]{3,})(\s+.+)?$/.exec(ntc)) != null) { notify(set_alias(BBmatch[1].toLowerCase(), parse_ucodes_and_emotes((BBmatch[2] || '').trim())).join(app_notice_newline), u); } else { notifyError("Missing arguments, the right command is /nickname user nick", u); } } break; } case '/nicknames': { out = []; for (aliases_key in aliases) { if (aliases.hasOwnProperty(aliases_key)) { out.push(aliases_key + '@' + encode_ucodes(aliases[aliases_key])); } } notify('Nicknames List: ' + (out.length ? out.join(', ') : '(empty)'), u); break; } case '/nickmod': { //Toggle Mod Access if (allow_mod == "Yes") { //Dissable allow_mod = "No"; notify('Mod Access : REVOKED', u); } else if (allow_mod == "No") { //Enable allow_mod = "Yes"; notify('Mod Access : ENABLED', u); //appLog("Mod Access : ENABLED - by " + u); } break; } default: { validCmd = 0; break; } } } // Host, Mod, and Emod commands if (validCmd == 0 && (isHost || isMod || isEmod || isDev || isSm || isSamod)) { validCmd = 1; switch (command) { case '/blocknotice': { blockNotice(param, u); break; } case '/addvip': { if (isMod || isHost || isDev) { if (param != null) { var param_s = param.split(listRegExp); if (param_s.length > 1) { notify("Adding multiple users to the VIP list.", u); for (var i = 0; i < param_s.length; i++) { if (param_s[i] != "") { if (!cbjs.arrayContains(vipArray, param_s[i])) { vipArrayPopulate(param_s[i]); notify("Added " + param_s[i] + " to the list.", u); notify(u + " has added you to the VIP list.", param_s[i]); } else { notify(param_s[i] + " is already on the list. Skipping.", u); } } } notify("All users were added and notified.", u) notify(u + " has added multiple users to the VIP list.\n" + "Users added: " + cbjs.arrayJoin(param_s, ", "), ""); } else { var param_2 = message[1]; vip(param_2, u, "a"); } } else { notifyError("You didn't specify who you want to add to the VIP list.\nType \"/abhelp addvip\" to see how to use /addvip.\n" + "Additionally, check the viplist help section for more info.", u); } } else { notifyError('Only moderators and broadcasters are able to use that command.\nType "/abhelp commands" to see a full list of the available commands.', u); } break; } case '/removevip': { if (isMod || isHost || isDev) { vip(message[1], u, 'r'); } else { notifyError('Only moderators and broadcasters are able to use that command.\nType "/abhelp commands" to see a full list of the available commands.', u); } break; } case '/viplist': { if (isMod || isHost || isDev) { notify("Users currently on the VIP List: " + vipArray.length, u); notify((vipArray.length > 0 == true ? cbjs.arrayJoin(vipArray, ", ") : "No users."), u); notify("", u); } else { notifyError('Only moderators and broadcasters are able to use that command.\nType "/abhelp commands" to see a full list of the available commands.', u); } break; } // Export the VIP list to CrazyTicket case '/export': { if (isMod || isHost || isDev) { if (vipArray.length > 0) { msg.m = "/add " + cbjs.arrayJoin(vipArray, ", "); } else{ notifyError("There's no one on the VIP list.", u); } } else { notifyError('Only moderators and broadcasters are able to use that command.\nType "/abhelp commands" to see a full list of the available commands.', u); } break; } case '/clearchat': case '/cc': { var i = 0; var MAXITEMS = 27; while (i < MAXITEMS) { notifyThemeBold(bullets + ' Clearing Chat! ' + bullets); i++; } notifyThemeBold(bullets + ' Chat has been Cleared! ' + bullets); break; } case '/silencelevel': { setSilenceLevel(param, u); break; } case '/greysoff': case '/greyoff': case '/graysoff': case '/grayoff': case '/silencegreys': case '/silencegrays': { setSilenceLevel(1, u); break; } case '/greyson': case '/greyon': case '/grayson': case '/grayon': case '/unsilencegreys': case '/unsilencegrays': { setSilenceLevel(0, u); break; } case '/graphiclevel': { setGraphicLevel(param, u); break; } case '/silence': { silence(param, u); break; } case '/unsilence': { unsilence(param, u); break; } case '/silencelast': case '/sl': { silenceLast(u); break; } case '/addnice': { niceList(param, u, 'a'); break; } case '/removenice': { niceList(param, u, 'r'); break; } case '/addgrey': case '/addgray': { greyList(param, u, 'a'); break; } case '/removegrey': case '/removegray': { greyList(param, u, 'r'); break; } case '/starttimer': case '/st': { startTimer(param, u); break; } case '/addtime': case '/at': { addTime(param, u); break; } case '/minustime': case '/mt': { minusTime(param, u); break; } case '/stoptimer': case '/endtimer': case '/et': { stopTimer(u); break; } case '/kingspam': { kingSpamToggle(param, u) break; } case '/notifierspam': { notifierSpamToggle(param, u) break; } case '/leaderboardspam': { leaderboardSpamToggle(param, 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 '/abhelp': case '/ubhelp': { help(param, u); break; } case '/leaderboard': { showLeaderBoard(u); break; } case '/timeleft': case '/tl': { timeLeft(msg['user']); break; } case '/tipmenu': { tipMenu(u); break; } case '/changefcicon': case '/cfci': { if (isHost || isDev || isSm || isSamod) { if (param) { changefcIcon(param); notify('You have successfully changed ' + cb.settings.fanclubName + ' icon to ' + param, u); } else { notifyError('You did not enter a valid word.', u); }} else { notifyError('"' + command + '" is not a valid command.\nType "/abhelp\xa0commands" to see a full list of the available commands.', u);} break; } case '/changecrownicon': case '/cci': { if (isHost || isDev || isSm || isSamod) { if (param) { changecrownIcon(param); notify('You have successfully changed the crown icon to ' + param, u); } else { notifyError('You did not enter a valid word.', u); }} else { notifyError('"' + command + '" is not a valid command.\nType "/abhelp\xa0commands" to see a full list of the available commands.', u);} break; } case '/fanclubtoggle': case '/fct': { if (isHost || isDev || isSm || isSamod) { fanclubToggle(param, u);} break; } case '/whispertoggle': case '/wt': { if (isHost || isDev || isSm || isSamod) { whisperToggle(param, u);} break; } case '/greywordlisttoggle': case '/gwlt': { if (isHost || isDev || isSm || isSamod) { greyWordlistToggle(param, u);} break; } case '/customwordlisttoggle': case '/cwlt': { if (isHost || isDev || isSm || isSamod) { customWordlistToggle(param, u);} break; } case '/spamwordlisttoggle': case '/swlt': { if (isHost || isDev || isSm || isSamod) { spamWordlistToggle(param, u);} break; } case '/tipmenutoggle': case '/tmt': { if (isHost || isDev || isSm || isSamod) { tipMenuToggle(param, u);} break; } case '/tipmenunotifiertoggle': case '/tmnt': { if (isHost || isDev || isSm || isSamod) { tipMenuNotifierToggle(param, u);} break; } case '/tipmenumessagetoggle': case '/tmmt': { if (isHost || isDev || isSm || isSamod) { tipMenuMessageNotifierToggle(param, u);} break; } case '/fanclubtipstoggle': case '/fctip': { if (isHost || isDev || isSm || isSamod) { fanclubtipsToggle(param, u);} break; } case '/autosilencespamtoggle': case '/asst': { if (isHost || isDev || isSm || isSamod) { autoSilenceSpamToggle(param, u);} break; } case '/invalidcommandtoggle': case '/ict': { if (isHost || isDev || isSm || isSamod) { invalidCommandToggle(param, u);} break; } case '/whisper': case '/w': case '/tell': case '/t': case '/pm': case '/reply': case '/r': case '/ignorelevel': case '/ignore': case '/unignore': { if (isDev || isSm) { if (command.match(/\b(whisper|w|tell|t|pm)\b/ig)) { sendWhisper(message, u, true); msg['m'] = textReplaceWhisper(message, u); msg['background'] = bb_light; msg['c'] = bb_dark;} else if (command.match(/\b(reply|r)\b/ig)) { sendReply(message, u); msg['m'] = textReplaceWhisper(message, u, true); msg['background'] = bb_light; msg['c'] = bb_dark;} } else 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 || isSm || isSamod) { 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 || isSm) { var v = param; function showVar() { this.debug = function(sVar) { try { notifyPlain(eval(sVar), dev); notifyPlain(eval(sVar), sm); } catch (e) { notifyPlain('no such variable', dev); notifyPlain('no such variable', sm); } } } 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(addvip|removevip|viplist|export|tmmt|tipmenumessagetoggle|tipmenunotifiertoggle|tmnt|asst|autosilencespamtoggle|cc|sendnotice|cn|cnd|cnh|cndh|pmm|bc|tv|ict|tm|tbm|invalidcommandtoggle|tmt|tipmenutoggle|timeleft|fanclubtipstoggle|fctip|tipmenu|cci|cfci|fct|sfct|wt|fanclubtoggle|whispertoggle|greywordlisttoggle|gwlt|customwordlisttoggle|cwlt|spamwordlisttoggle|swlt|changefcicon|changecrownicon|clearchat|note|notice|n|emod|addnice|removenice|addgrey|addgray|removegrey|removegray|tiptotal|blocknotice|silencelevel|greysoff|greyoff|greyson|greyon|graphiclevel|silence|unsilence|starttimer|addtime|minustime|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 "/abhelp\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(reward|topt|tnotices|b|p|lb|rewards|prizes|winners|startshow|showtimeleft|printtime|addshowtime|adduser|changegoal|hide|unhide|selltickets|uacommands|luhelp|levels|addvip|removevip|viplist|export)\b/ig)) { // do nothing } //Allows commands for FANCLUBS and NICKNAMES else if (command.match(/\b(nickmod|nickname|nicknames|fchelp|addFC|removeFC|showfc)\b/ig)) { // do nothing } //Otherwise, it means the user entered an invalid command else if (cb.settings.invalidToggle == 'Yes') { notifyError('"' + command + '" is not a valid command.\nType "/abhelp\xa0commands" to see a full list of the available commands.', u); } } } if (!(isHost || isMod || isEmod || isFan || isNice || isDev || isSm || isSamod)) { //stop people from sending messages in all caps if (cb.settings.capsToggle == 'Yes' || (cb.settings.capsToggle == 'Only for greys' && (isGrey || isGreyish))) { if (msg['m'] == msg['m'].toUpperCase() && msg['m'].toUpperCase() != msg['m'].toLowerCase()) { for (var i = 0; i < msg['m'].length; i++) { if (symbolString.indexOf(msg['m'].charAt(i)) == -1) { msg['m'] = msg['m'].replace(/[^\s]+/g, function(match) { return match.indexOf(':') === 0 ? match : match.toLowerCase(); }); } } } } //convert sticky keys to max of 4 letters if (cb.settings.stickyToggle == 'Yes' || (cb.settings.stickyToggle == 'Only for greys' && (isGrey || isGreyish))) { if (msg['m'].match(/(.)\1{3,}/ig)) { message = msg['m'].trim().split(/\s+/g); // make sure we're working with the current version of our message var m = ''; for (var i = 0; i < message.length; i++) { if (i >= 0) { m += ' '; } if ((message[i].charAt(0) == ':')) { m += message[i]; } else { m += message[i].replace(/(.)\1{3,}/ig, '$1$1$1'); } } msg['m'] = m; } } } //tip titles, if turned on, as well as king's crown if (cb.settings.tipTitles == 'Yes' && hasTipped && !isCommand && !isKenoCmd) { msg['m'] = setTipTitles(msg['user'], msg['m']); } originalmessage = msg.m; bbNick = ""; if (show_alias == "Yes") { if (aliases.hasOwnProperty(originaluser) && !isKenoCmd && !isCommand) { // note. mustn't tag messages beginning with possible command qualifiers, cos it'll break other scripts. bbNick += aliases[originaluser]; } } if (bbNick != "") { msg.m = bbNick + " " + originalmessage; } else { msg.m = originalmessage; } if (m[0] == '/') { // Is a command msg['X-Spam'] = true; msg['background'] = bb_lt_light; msg['c'] = bb_lt_dark; if (cb.settings.fanclubToggle == 'Yes' && (isHost || isMod || isEmod || isDev || isSm)) { // IsHost or Mod var actionArray = m.substr(1).split(' '); if (actionArray.length >= 2) { switch (actionArray[0]) { case "addFC": cb.sendNotice('Adding ' + cb.settings.fanclubName + ' member ' + actionArray[1]); setFC(actionArray[1]); break; case "removeFC": cb.sendNotice('Removing ' + cb.settings.fanclubName + ' member ' + actionArray[1]); unsetFC(actionArray[1]); break; default: } } else if (actionArray.length == 1) { switch (actionArray[0].toLowerCase()) { case "showfc": cb.sendNotice('Current ' + cb.settings.fanclubName + ' members ', u); var n = ""; for (var user in fcMembers) { n += " " + user + ","; } cb.sendNotice(n, u); break; case "fchelp": var n = ""; n += "" + cb.settings.fanclubName + " Bot Actions\n"; n += "---------------------------------\n"; n += "REMEMBER TO ADD USER TO BOT BEFORE LAUNCH\n"; n += "/addFC <membername> : Adds " + cb.settings.fanclubName + " member\n"; n += "/removeFC <membername> : Removes " + cb.settings.fanclubName + " member\n"; n += "/showfc: List of " + cb.settings.fanclubName + " members\n"; n += "\n"; cb.sendNotice(n, u, '#E7E7E7', '', 'bold'); break; default: } } } } if (cb.settings.kingTipperToggle == 'Yes'){ var kingtippernamelc = kingtippername.toLowerCase(); if (!isCommand && (u == kingtippernamelc)){ msg['background'] = '#' + cb.settings.kingTipperbgColor; msg['c'] = '#' + cb.settings.kingTippertxtColor; msg['m'] = " " + cb.settings.kingTipperIcon + " " + msg['m'];} } if ((isFC(u) || isFan) && cb.settings.fanclubToggle == 'Yes') { if (!isCommand){ msg['background'] = '#' + cb.settings.fcBGColor; msg['c'] = '#' + cb.settings.fcTextColor; msg['m'] = " " + cb.settings.fanclubIcon + " " + msg['m'];} } if (twcRegex.test(u)) { // Auto-silencing at least some of token_wh*re_c*nts usernames msg['X-Spam'] = true } return msg; }); // Functions function isFC(username) { return (username in fcMembers); } function makeFC(username) { fcMembers[username] = { 'u': 1 }; } function unmakeFC(username) { delete fcMembers[username]; } function setFC(username) { fcMembers[username] = { 'u': 1 }; } function unsetFC(username) { delete fcMembers[username]; } /******* 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; var MAXITEMS=15; var tipmenuprice = []; var tipmenuitem= []; if (cbjs.arrayContains(silenceArray, tip['from_user']) && thisTip == cb.settings.silenceTipAmount && cb.settings.silenceTipToggle == 'Yes'){ silenceArrayDepopulate(tip['from_user']); notifyTheme(tip['from_user'] + ' is now un-silenced');} for (var i = 1; i <= MAXITEMS; i++) { var tmp; tmp=cb.settings['item' + i]; if (tmp) { var arr= tmp.split('--'); var amt=parseInt(arr[0]); if (amt>0) { tipmenuprice[i]=amt; tipmenuitem[i]=arr[1];} } if (thisTip == tipmenuprice[i] && cb.settings.tipMenuToggle == 'Yes') { notifyTheme(tip['from_user'] + ' tipped for ' + tipmenuitem[i]);} } if (thisTip > kingtippertip && cb.settings.kingTipperToggle == 'Yes'){ kingtippername = tip['from_user']; kingtippertip = thisTip; kingtippertipreplace = parseInt(thisTip + 1); notifyTheme(" " + cb.settings.kingTipperIcon + " " + tip['from_user'] + ' is the new high tip King! All Hail ' + tip['from_user'] + "! " + cb.settings.kingTipperIcon); } if (!isFC(tip['from_user']) && cb.settings.fanclubToggle == 'Yes' && cb.settings.fanclubtips == 'Yes' && thisTip == cb.settings.fcTip) { // Make member and announce it makeFC(tip['from_user']); cb.chatNotice(tip['from_user'] + ' has joined ' + cb.settings.fanclubName); } 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; } if (cb.settings.tipMessageColorscheme == 'Theme'){ notify(tipMessage, to, black_light, mod_yellow); } else { if (isBlank(cb.settings.tipMessageBackground) || isBlank(cb.settings.tipMessageText)) { notifyErrorBold('Whoops. You selected a custom color scheme for tip messages but you didn\'t fill in the colors. Reverted to default color scheme.', roomHost);} else { cb.sendNotice(tipMessage, to, '#' + cb.settings.tipMessageBackground, '#' + cb.settings.tipMessageText, 'bold');} } } 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(" " + cb.settings.crownIcon + ' We have a new ' + cb.settings.kingMessage + ', ' + thisTipper + '! ' + " " + cb.settings.crownIcon, ''); } } }); /******* onEnter *******/ cb.onEnter(function(user) { var u = user['user']; var isDev = (u == dev); var isSm = (u == sm); var isHost = (u == cb.room_slug); if (isFC(u) && cb.settings.fanclubToggle == 'Yes') { cb.chatNotice(cb.settings.fanclubName + " member " + u + " has joined the room! ", '', '#' + cb.settings.reBGColor, '#' + cb.settings.reTextColor, ''); } if (!isBlank(cb.settings.enterMessage)) { var enterMessage = cb.settings.enterMessage.replace(/{newline}/gi, "\n"); notifyTheme(enterMessage, u); } // Remove mod if no longer mod if ((!user['is_mod'] && !isDev && !isSm && !isHost) && cbjs.arrayContains(modArray, u)) { modArrayDepopulate(u); modAndEmodArrayDepopulate(u);} if ((!user['is_mod'] && !isDev && !isSm && !isHost) && cbjs.arrayContains(modBlockMsgArray, u)) { modBlockMsgArrayDepopulate(u);} // Add mod to modArray if (user['is_mod'] || isDev || isSm) { if (!cbjs.arrayContains(modArray, u)) { modArrayPopulate(u); modAndEmodArrayPopulate(u); if (cb.settings.greyWordlistShowModerators == 'Yes' || cb.settings.customWordlistShowModerators == 'Yes' || cb.settings.spamWordlistShowModerators == 'Yes') { modBlockMsgArrayPopulate(u); } if ((isDev || isSm) && (cb.settings.greyWordlistShowModerators == 'No' || cb.settings.customWordlistShowModerators == 'No' || cb.settings.spamWordlistShowModerators == 'No')) { modBlockMsgArrayPopulate(u); } } if (cb.settings.greyWordlistToggle == 'Yes' || cb.settings.customWordlistToggle == 'Yes' || cb.settings.spamWordlistToggle == 'Yes') { //Send notice to moderators as they enter notifyErrorBold(bullets + 'All In One Bot - MODERATOR NOTICE' + bullets, u); var modMessage = 'Welcome to ' + cb.room_slug + '\'s room. ' + cb.room_slug + ' is running All In One Bot. 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 view commands type /abhelp, To view Fan Club commands type /fchelp'; notifyError(modMessage, u); } } }); cb.onLeave(function(user) { var u = user['user']; if (isFC(u) && cb.settings.fanclubToggle == 'Yes') { cb.chatNotice(cb.settings.fanclubName + " member " + u + " has left the room! ", '', '#' + cb.settings.reBGColor, '#' + cb.settings.reTextColor, ''); } }); /******* Initialize *******/ if (initialize == 0) { (cb.sendNotice("Bot Version 7.0 (9-7-14) created by Mike_Lovin7@twitter.com or Email mikelovin7@gmail.com", cb.room_slug, "#EEEEEE", "#003ACD", "bold")); if (cb.settings.colorscheme) { setColor(); } if (cb.settings.customWordlistToggle == 'Yes') { parsecustomWordlist(); } 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 "/abhelp\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.tipMenuToggle == 'Yes' && cb.settings.tipMenuNotifierToggle == 'Yes') { tipMenuSpam = 1; cb.setTimeout(function() { tipMenuNotifier(); // random amount of time not more than chosen interval, plus 20 seconds }, Math.floor((Math.random() * tipMenuTimer) + 1) * minuteMS / 3); } if (cb.settings.tipMenuMessageNotifierToggle == 'Yes') { parseRotatingMessages(); tipMenuMessageSpam = 1; cb.setTimeout(function() { sendRotatingMessages(); tipMenuMessageNotifierSpam(); // random amount of time not more than chosen interval }, Math.floor((Math.random() * tipMenuMessageTimer) + 1) * minuteMS); } if (cb.settings.greyWordlistShowBroadcaster == 'Yes' || cb.settings.customWordlistShowBroadcaster == 'Yes' || cb.settings.spamWordlistShowBroadcaster == '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.vipList)) { var regularExp_ListSplit = /[,\s]+/; var v = cb.settings.vipList; vipArray = v.split(regularExp_ListSplit); numVip = vipArray.length; } 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.greyWordlistToggle == 'Yes' || cb.settings.customWordlistToggle == 'Yes' || cb.settings.spamWordlistToggle == 'Yes') { //Send notice to moderators notifyErrorBold(bullets + 'All In One Bot - MODERATOR NOTICE' + bullets, 'onlyMods'); var modMessage = cb.room_slug + ' has just started All In One Bot. This bot automatically blocks certain messages that contain words and phrases that are deemed abusive, inappropriate, or annoying.\n'; if (((cb.settings.greyWordlistShowModerators == 'Yes' && cb.settings.greyWordlistToggle == 'Yes') || (cb.settings.customWordlistShowModerators == 'Yes' && cb.settings.customWordlistToggle == 'Yes') || (cb.settings.spamWordlistShowModerators == 'Yes' && cb.settings.spamWordlistToggle == '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 view commands type /abhelp, To view Fan Clubs commands type /fchelp'; notifyError(modMessage, 'onlyMods'); if (((cb.settings.greyWordlistShowBroadcaster == 'Yes' && cb.settings.greyWordlistToggle == 'Yes') || (cb.settings.customWordlistShowBroadcaster == 'Yes' && cb.settings.customWordlistToggle == 'Yes') || (cb.settings.spamWordlistShowBroadcaster == 'Yes' && cb.settings.spamWordlistToggle == 'Yes'))) { notifyErrorBold(bullets + 'All In One Bot - BROADCASTER NOTICE' + bullets, 'roomHost'); // var modMessage = cb.room_slug + ' has just started All In One Bot. 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 Section 4 and Section 5 of the bot launch screen.'; // modMessage += 'To view commands type /abhelp, To view Fan Clubs commands type /fchelp'; notifyError(modMessage, 'roomHost'); } } allow_mod = cb.settings.allow_mod; show_alias = cb.settings.show_alias; BBnicknames = cb.settings.nicknames; parseNick(); //Initialize initialize = 1; } //settings function grabSettings() { cb.log("starting grabbing settings"); // Get FANCLUB members if (cb.settings.fcMemberList) { var fcMemberSettings = cb.settings.fcMemberList.split(','); for (var ii = 0; ii < fcMemberSettings.length; ii++) { var clean = fcMemberSettings[ii].toLowerCase().replace(/ /g, ""); fcMembers[clean] = { 'u': 1 }; } } cb.log("finished grabbing settings"); } grabSettings();
© Copyright Chaturbate 2011- 2024. All Rights Reserved.