Bots Home
|
Create an App
Ricks WoodShop
Author:
testbedaccount1
Description
Source Code
Launch Bot
Current Users
Created by:
Testbedaccount1
// // Ricks WoodShop bot // // be sure to check Lana out at: https://chaturbate.com/unicornspit11/ // // edits and new features: unicornspit11 (05-April-2019) v1.99.33 // // (3/20/2014) Includes Leaderboard v1.4.1 by hard8in // (3/21/2014) Includes Emote-safe NO CAPS by asdfghjkl28 // (3/24/2014) Added cb.onEntry() messages for club members // (4/30/2014) Added timer functions from Ultra Bot by britney_and_justin (plus mine) // (9/15/2017) Added Tip Menu Plus v1.0.4 by badbadbubba // (1/13/2018) Added Peanut's fan club, 3 more Notice lines // (1/20/2018) Added /ln command to manually send a notice (only dev or broadcaster) // (2/24/2018) Enabled timer functions for dev // (3/28/2018) Various code cleanup, new emojiis // (4/1/2018) Added /listcharms, /listcats commands // (4/3/2018) Added support for multiple fanclub counts (2x,3x, etc), added stealth room entry // (5/5/2018) Every club tip will display club spam // (6/23/2018) Fixed rotating notice 4-6 timers, new /lnn notice command separated by ------, new LanaQuotes function // (7/15/2018) New color (purple on black) for charmers over 100, or black on red for 50+ // (7/17/2018) MUCH better randomization for LanaQuotes; will shufle the list, then just display them one by one, and re-randomize after the full list has been displayed // (8/2/2018) Cool cats club goes live // (8/7/2018) New crown for all-time high tipper // (8/9/2018) New color for 200+ re-charms // (8/11/2018) New color for 300+ re-charms // (8/14/2018) New /tipmenu command, to user only // (8/14/2018) New /tipmenur command, to room (broadcaster or dev) // (8/17/2018) Added secondary 10-item tip menu, with alternating display // (8/19/2018) Fix for secondary menu over-writing primary for tip checking // (9/2/2018) Fix for /tipmenur breaking tip menu notices // (9/11/2018) New /tipmenu notice on entry // (10/5/2018) New color gradient for MMB // (11/4/2018) New color for Lana (orange) // (11/7/2018) New searchable LanaQuotes: enter your search term/phrase (OR decimal # for exact quote) in the tip note // (11/16/2018) New color for 400+ re-charms (lt. green) // (12/24/2018) Christmas gradient for MMB :p // (12/29/2018) New Year's gradient for MMB :p (old text color 1f55ad) // (3/5/2019) New graphic image for King Tipper (Mike37174) for all charms plus king tipper crown // (3/6/2019) FIX for new image above! (EVERYONE got the crown) // (3/20/2019) Added /bc command to send private message to broadcaster (mods & dev) // (4/5/2019) First attempt to run in sandbox after deleting unneccesary coding // // 1000 = woodshop (array(mm)) // 500 = saw mill (array(mg)) var version = '1.99.33 [MMB]'; var vdate = '20-March-2019'; cb.settings_choices = [ {name: 'mmBGColor', label: 'Wood Shop members background color - HTML colour code without starting \'#\'', type: 'str', minLength: 0, maxLength: 6, required: false, defaultValue: 'cceeff'}, {name: 'mmMinTip', label: 'Minimum tip to join wood shop', type: 'int', minValue: 1, defaultValue: 1000}, {name: 'mmAnnounce', label: 'Text to show when someone tips to become a Wood Shop member, \'MEMBERNAME\' will be replaced with the username of the new member (Note: graphics don\'t work in this text)', type: 'str', minLength: 0, maxLength: 10240, required: false, defaultValue: 'MEMBERNAME - welcome to the woodshop'}, {name: 'mmMemberList', label: 'List of current woodshop members, separated by commas (exact CB usernames)', type: 'str', minLength: 0, maxLength: 10240, required: false, defaultValue: ''}, {name: 'mmRainText', label: 'Text to use for Saw Mill rain lines', type: 'str', minLength: 0, maxLength: 80, required: false, defaultValue: 'Cool Cats!'}, {name: 'mmRainCount', label: 'Number of lines of Cool Cats rain', type: 'int', minValue: 1, maxValue: 15, defaultValue: 5}, {name: 'mgcolordelta', label: 'Over-ride users\' text color', type: 'choice', choice1: 'no', choice2: 'yes', defaultValue: 'no'}, {name: 'mgTextColor', label: 'Wood Shop text color (if over-riding) - HTML color code without starting \'#\'', type: 'str', minLength: 0, maxLength: 6, required: false, defaultValue: '000000'}, {name: 'mgBGColor', label: 'Wood Shop background color - HTML color code without starting \'#\'', type: 'str', minLength: 0, maxLength: 6, required: false, defaultValue: 'e6ccff'}, {name: 'mgMinTip', label: 'Minimum tip to become a Wood Shop Member', type: 'int', minValue: 1, defaultValue: 777}, {name: 'mgAnnounce', label: 'Text to show when someone tips to become a Lucky Charm, \'MEMBERNAME\' will be replaced with the username of the new member (Note: graphics don\'t work in this text)', type: 'str', minLength: 0, maxLength: 10240, required: false, defaultValue: 'MEMBERNAME just got Lucky!'}, {name: 'mgMemberList', label: 'List of current woodshoppers, separated by commas (exact CB usernames)', type: 'str', minLength: 0, maxLength: 20480, required: false, defaultValue: ''}, {name: 'mgRainText', label: 'Text to use for wood shop rain lines', type: 'str', minLength: 0, maxLength: 80, required: false, defaultValue: 'Lucky Charms!'}, {name: 'mgRainCount', label: 'Number of lines of wood shop rain', type: 'int', minValue: 1, maxValue: 15, defaultValue: 7}, {name: 'sneakyList', label: 'Users to bypass entry messages (exact CB usernames)', type: 'str', minLength: 0, maxLength: 10240, required: false, defaultValue: ''}, {name: 'modList', label: 'Who\'s your Mods? (exact CB username)', type: 'str', minLength: 0, maxLength: 10240, required: false, defaultValue: 'schoolboy0721'}, {name: 'modColor', label: 'Monkey\'s text color, without starting \'#\'', type: 'str', minLength: 0, maxLength: 6, required: false, defaultValue: '202020'}, {name: 'modBGColor', label: 'Monkey\'s background color, without starting \'#\'', type: 'str', minLength: 0, maxLength: 6, required: false, defaultValue: 'ffe0b3'}, {name: 'Notice2', label: 'Notice line #1', type: 'str', minLength: 0, maxLength: 1024, required: false, defaultValue: 'Notice line 1'}, {name: 'Notice3', label: 'Notice line #2', type: 'str', minLength: 0, maxLength: 1024, required: false, defaultValue: 'Notice line 2'}, {name: 'Notice4', label: 'Notice line #3 (leave blank to skip)', type: 'str', minLength: 0, maxLength: 1024, required: false, defaultValue: ''}, {name: 'Notice5', label: 'Notice line #4 (leave blank to skip)', type: 'str', minLength: 0, maxLength: 1024, required: false, defaultValue: 'test notice (4)'}, {name: 'Notice6', label: 'Notice line #5 (leave blank to skip)', type: 'str', minLength: 0, maxLength: 1024, required: false, defaultValue: ''}, {name: 'mins', label: 'Repeat notices every how many minutes? (minimum 2, maximum 99)', type: 'int', minValue: 2, maxValue: 99, defaultValue: 10}, {name: 'print_on_tip',label: "[Leaderboard] Print top 3 after tips", type: 'choice', choice1: 'always',choice2: 'only if the top 3 changed', choice3: 'never', defaultValue: 'only if the top 3 changed'}, {name: 'print_interval', label: "[LB] Print top 3 at least once every minutes (0 to disable)", type: 'int', minValue: 0, defaultValue: 0, required: true }, {name: 'highlight', label: "[LB] Highlight tip leader in chat", type: 'choice', choice1: 'yes', choice2: 'no', defaultValue: 'yes'}, {name: 'sepchar', type: 'choice', choice1: 'Vertical Bar', choice2: 'Hearts', choice3:'Glitter',choice4:'Flowers',choice5:'Bow',choice6:'Hearts2',choice7:'Smiley',choice8:'Text Heart', choice9:'Text Diamond', choice10:'Text Star', defaultValue: 'Glitter', label: "Tip Menu Separator character"}, {name:'item1', type:'str', required: false, label:'Tip Menu Item 1 (eg 10--flash tits)',}, {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',}, {name:'sitem1', type:'str', required: false, label:'Secondary Tip Menu Item 21',}, {name:'sitem2', type:'str', required: false, label:'Item 2',}, {name:'sitem3', type:'str', required: false, label:'Item 3',}, {name:'sitem4', type:'str', required: false, label:'Item 4',}, {name:'sitem5', type:'str', required: false, label:'Item 5',}, {name:'sitem6', type:'str', required: false, label:'Item 6',}, {name:'sitem7', type:'str', required: false, label:'Item 7',}, {name:'sitem8', type:'str', required: false, label:'Item 8',}, {name:'sitem9', type:'str', required: false, label:'Item 9',}, {name:'sitem10', type:'str', required: false, label:'Item 10',}, {name:'Sitem11', type:'str', required: false, label:'Item 11',}, {name:'Sitem12', type:'str', required: false, label:'Item 12',}, {name:'Sitem13', type:'str', required: false, label:'Item 13',}, {name:'Sitem14', type:'str', required: false, label:'Item 14',}, {name:'Sitem15', type:'str', required: false, label:'Item 15',}, {name:'Sitem16', type:'str', required: false, label:'Item 16',}, {name:'Sitem17', type:'str', required: false, label:'Item 17',}, {name:'Sitem18', type:'str', required: false, label:'Item 18',}, {name:'Sitem19', type:'str', required: false, label:'Item 19',}, {name:'Sitem20', type:'str', required: false, label:'Item 20',}, {name:'noticecolor', type:'str', label:'Tip Menu Notice color (html code default red #FC0000)', defaultValue: '#FC0000'}, {name: 'chat_ad', type:'int', minValue: 1, maxValue: 99, defaultValue: 10, label: 'Delay in minutes between Tip Menu being displayed (minimum 2, maximum 99)'}, {name: 'kingTipper', label: 'Who is your all-time HIGH TIPPER? (exact CB username)', type: 'str', minLength: 0, maxLength: 10240, required: false, defaultValue: 'CTJohnny'} ]; var vdev = 'unicornspit11'; var emojii = ':ldb-luckycharms1'; var emojii2 = ':ldb-coolcats1'; var emojiiBC = ':ldb-bothclubs1'; var emojiiMF = ':mmb-monkeyface1'; var emojiiMMB = ':mmb-allclubs1'; var mike3emojii = ':ldb-MVPbothclubs'; var crowngif = ':crowngif282'; var mmMembers = {}; // Wood Shop var mgMembers = {}; // Saw Mill var modMembers = {}; // Mods (ME) :-) var sneakers = {}; // stealth room entry var Notice1 = "Tip " + cb.settings.mmMinTip + " to become a member of the wood shop.. Tip " + cb.settings.mgMinTip + " to become a saw miller!\nAll of your messages will be highlighted in chat and more. Read the bio for more info. "; var titleMessage = 'Rick\'s Wood Shop bot (v'+version+') is now active. By unicornspit11 - originally lanas lucky charm bot by MainMonkeyBusiness. Type /ldbhelp for more info. '; var dbhelp = 'Tip '+ cb.settings.mmMinTip +' to get into the wood shop. Tip '+ cb.settings.mgMinTip +' to get into the saw mill club. Read the bio for more info. '; var timerhelp = 'Timer commands:\n /timer # -- set timer to # minutes \n /addtime # -- add # minutes to timer \n /timeleft -or- /tl -- display remaining countdown time \n /killtimer -- stop the timer'; var dbversion = 'Rick\'s Wood Shop Bot: version '+version+' ('+vdate+')\nBy unicornspit11 :cool '; /** var fancytext = "background-image: -webkit-gradient( linear, left top, right top, color-stop(0, #f22), color-stop(0.15, #f2f), color-stop(0.3, #22f), color-stop(0.45, #2ff), color-stop(0.6, #2f2),color-stop(0.75, #2f2), color-stop(0.9, #ff2), color-stop(1, #f22) ); background-image: gradient( linear, left top, right top, color-stop(0, #f22), color-stop(0.15, #f2f), color-stop(0.3, #22f), color-stop(0.45, #2ff), color-stop(0.6, #2f2),color-stop(0.75, #2f2), color-stop(0.9, #ff2), color-stop(1, #f22) ); color:transparent; -webkit-background-clip: text; background-clip: text;"; **/ function inArray(elem,array) { var len = array.length; for(var i = 0 ; i < len;i++) { if(array[i] == elem){return i;} } return -1; } function isNumber(num) { return (typeof num == 'string' || typeof num == 'number') && !isNaN(num - 0) && num !== ''; }; var str1 = ''; var str2 = ''; var str3 = ''; var str4 = ''; var str5 = ''; var npos; var multi; var noticeDelta = 0; // for dual tip menus, start with menu 1 var all; // for /tipmenu cmd to skip noticedelta if set to 'all' // For auto-silencing at least some of token_wh*re_c*nts usernames var twcRegex = /t.?k.?n.?wh.?r.?_c.?nt.?/i; // timer vars var startTime = 0; var timerDuration = 0; var timeAdded = 0; var killtimer = 0; var purple = '#FFE0CC'; // Leaderboard vars var VERSION = '1.4.1', COMMAND_SHOW_LEADERBOARD = '!lb', CONFIG_COLOR_LEADER = '#9f9', INTERVAL_MULTIPLIER = 60000, UPDATE_TIME = 5000, NL = '\n', user_total_tips = {}, user_last_tip_time = {}, last_top3 = '', leader_username, update_counter = 0, interval_counter = 0, silent_room = true; // tip menu vars var HEART = '\u2665'; // ♥ BDIAMOND = '\u2666'; // ♦ BSTAR = '\u2605'; // ★ var tip_amt = 0; var separator_char = "| "; var msg; var Smsg; var MAXITEMS=10; var tipmenuprice = []; var tipmenuitem = []; var tipmenuprice2 = []; var tipmenuitem2 = []; var MAXSEP = 9; separators = [ {label:'Hearts',shortcut:':heart2'}, {label:'Glitter',shortcut:':pixelglitter'}, {label:'Flowers',shortcut:':tinyflower2'}, {label:'Bow',shortcut:':bluebow'}, {label:'Hearts2',shortcut:':pixelheart'}, {label:'Smiley',shortcut:':smile'}, {label:'Text Heart',shortcut:HEART}, {label:'Text Diamond',shortcut:BDIAMOND}, {label:'Text Star',shortcut:BSTAR}, ] var emotePattern = /^:/; var capitalised = /^[A-Z][^A-Z]*$/; var mm = cb.settings.mins; var Delay1 = (mm * 60) * 1000; // convert to milliseconds var Delay2 = ((mm + .75) * 60) * 1000; // offset message2 by 45 secs, keeps the spam down a bit var Delay3 = ((mm + .25) * 60) * 1000; var Delay4 = ((mm + .50) * 60) * 1000; var Delay5 = ((mm + 1.0) * 60) * 1000; var Delay6 = ((mm + .66) * 60) * 1000; function showNotice1() { cb.chatNotice(Notice1,'','','#800080','bold'); cb.setTimeout(showNotice1, Delay1); // 600000 = 10 mins, 720000 = 12 mins, 900000 = 15 mins } var str1 = cb.settings.Notice2; function showNotice2() { cb.chatNotice(str1,'','','#000080','bold'); cb.setTimeout(showNotice2, Delay2); } var str2 = cb.settings.Notice3; function showNotice3() { cb.chatNotice(str2,'','','#DC5500','bold'); cb.setTimeout(showNotice3, Delay3); } var str3 = cb.settings.Notice4; function showNotice4() { if (str3) { cb.chatNotice(str3,'','','#000080','bold'); cb.setTimeout(showNotice4, Delay4); } } var str4 = cb.settings.Notice5; function showNotice5() { if (str4) { cb.chatNotice(str4,'','','#DC5500','bold'); cb.setTimeout(showNotice5, Delay5); } } var str5 = cb.settings.Notice6; function showNotice6() { if (str5) { cb.chatNotice(str5,'','','#229922','bold'); cb.setTimeout(showNotice6, Delay6); } } function showTitle() { cb.chatNotice(titleMessage,'','#FFE0CC','#B00032','bold'); } ///////////////////////////////////////// handle entry messages cb.onEnter(function(user) { var u = user['user']; var message = ''; var color = '6600dd'; // skip stealth logins if (isSneaky(u)) { return; } // low to high if (isMM(u)) { // 444 message= "Wood Shop member "+ u; // color = cb.settings.mmBGColor; color = '880033'; // dark red } else if (isMG(u)) { // 777 message= "Saw Mill member "+ u; // color = cb.settings.mgBGColor; color = '6600dd'; // bright purple } if ( isMM(u) && isMG(u) ) { // both message= "Wood Shop & Saw Mill member "+ u; // color = cb.settings.mgBGColor; color = '3333cc'; // dark royal purple } if (message) { // #6600dd cb.sendNotice(message + ' has entered the room.','','','#'+color,'bold'); // return; } // not a club member, print generic message (only to user) [Lana is using Kris' bot for this] // cb.sendNotice('Welcome to my room, ' + user['user'] + '. Please take a moment to read the Room Topic and my Profile below before chatting. Thank you!', user['user'], '#FAC7FF', '', 'bold'); cb.sendNotice('Type /tipmenu to see what you can tip for. Check out the bio for the full menu. Thank You. :)', user['user'], '#FAC7FF', '', 'normal'); }); ///////////////////////////////////////// cb.onMessage() ////////////////////////////////////////////////////////// cb.onMessage(function(msg) { // vars for ease of use var u = msg['user']; var m = msg['m']; var message = msg['m'].split(' '); //turn the message into an array /// LB handle user commands if ((msg.m.indexOf(COMMAND_SHOW_LEADERBOARD) == 0) && !msg['X-Spam']) { sendLeaderboard(true, msg.user); msg['X-Spam'] = true; } // highlight leader if ((cb.settings.highlight == 'yes') && (msg.user == leader_username)) { msg.background = CONFIG_COLOR_LEADER; } // schedule interval if (update_counter == 0){ scheduleInterval(); } if (!msg['X-Spam']){ silent_room = false; } /// var killtimer = 0; // needs to be reset every iteration //check to see if the user is attempting to use a timer command if(message[0].charAt(0) == '/') { //don't print this message to chat msg['X-Spam'] = true; var msgString = msg['m'].trim(); var split_index; var note; 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) note = msgString.substring(split_index + 1).trim(); // Could be empty } switch(message[0]) { case '/timer': { if(msg['is_mod'] || msg['user'] == cb.room_slug || msg['user'] == vdev) { startTimer(message[1], msg['user']); } else { cb.sendNotice('Only moderators and broadcasters can use that command.',msg['user'],purple); } break; } case '/addtime': { if(msg['is_mod'] || msg['user'] == cb.room_slug || msg['user'] == vdev) { addTime(message[1], msg['user']); } else { cb.sendNotice('Only moderators and broadcasters can use that command.',msg['user'],purple); } break; } case '/tl': case '/timeleft': { timeLeft(msg['user']); break; } case '/killtimer': { if(msg['is_mod'] || msg['user'] == cb.room_slug || msg['user'] == vdev) { killtimer=1; startTime = 0; timeAdded = 0; timerDuration = 0; mod=0; var id3 = cb.setTimeout(fiveMinuteWarning) var id2 = cb.setTimeout(oneMinuteWarning) var id1 = cb.setTimeout(timer) cb.cancelTimeout(id1); cb.cancelTimeout(id2); cb.cancelTimeout(id3); // neither way seems to work :/ cb.setTimeout(timer,0); cb.setTimeout(fiveMinuteWarning,0); cb.setTimeout(oneMinuteWarning,0); cb.sendNotice('The timer was killed[?]',msg['user'],purple); } else { cb.sendNotice('Only moderators and broadcasters can use that command.',msg['user'],purple); } break; } //// random Lana quote (command) case '/ln': { if ( u == vdev || u == cb.room_slug ) { if (note) { cb.sendNotice(note,'','','#663399','bold'); } else { cb.sendNotice('You need to include a note.',u,'','#fc0000'); } } msg['X-Spam'] = true; return msg; break; } case '/lnn': { if ( u == vdev || u == cb.room_slug ) { if (note) { cb.sendNotice("---------------------------------------------------------",'','','#603090'); cb.sendNotice(note,'','','#663399','bold'); cb.sendNotice("---------------------------------------------------------",'','','#603090'); } else { cb.sendNotice('You need to include a note.',u,'','#fc0000'); } } msg['X-Spam'] = true; return msg; break; } case "/listcharms": { if ( u == vdev || u == cb.room_slug ) { cb.sendNotice('Current Charms Members', u); var n = ""; for (var user in mgMembers) { n += "* "+user+"\n"; } cb.sendNotice(n,u); break; } } case "/listcats": { if ( u == vdev || u == cb.room_slug ) { cb.sendNotice('Current Cool Cats Members', u); var n = ""; for (var user in mmMembers) { n += "* "+user+"\n"; } cb.sendNotice(n,u); break; } } case "/tipmenu": { //display the tip menu to user //var output = '***** TIP MENU *****'; //for (var key in tipMenu) { // output += '\n' + tipMenu[key] + ' [' + key + ' tokens]'; //} //output += '\n********************'; //cb.sendNotice(newLines(output), '', '', cb.settings.tip_menu_color, 'bold', ''); chatAd(u,'all'); // cheat? chatAd2(u,'all'); break; } case "/tipmenur": { if ( u == vdev || u == cb.room_slug ) { chatAd('lightblue','all'); // to room chatAd2('lightblue','all'); break; } } case "/bc": { if( msg['is_mod'] || u == vdev || u == cb.room_slug ) { if (null == note || "" == note && (" " == note && "\u00a0" == note)) { cb.sendNotice("You can\u0027t send a blank message.\nThe correct syntax for this command is \u0022/bc message\u0022.", u); } else { cb.sendNotice("\u25b6 Private message from Drew! :: " + note, cb.room_slug, "#fffec6", "#980098", "bold"); } break; } } } //End switch() } // Process commands, hide invalid ones -- cb.chatNotice(message, [to_user], [background], [foreground], [weight]) if (/^\//.test(m)) { if (m == '/ldbhelp' || m == '/timerhelp'){ cb.chatNotice(dbhelp,u,'','#900090','bold'); if (msg['is_mod'] || msg['user'] == cb.room_slug || msg['user'] == vdev ) { cb.chatNotice('[mod] '+timerhelp,u,'','#700070',''); } } if (m == '/ldbinfo'){ cb.chatNotice('1. ♚ \u265A',u,'','','normal'); cb.chatNotice(escape('2. ♚ \u265A'),u,'','','normal'); } if (m == '/ldbversion'){ cb.chatNotice(dbversion,u,'','#2966B8','bold'); } msg['X-Spam'] = true; return msg; } ///// (high to low) -- lower club code outputs first (last in, first out) var wcm = u.toLowerCase(); //// test-app workaround! x = ''; x0 = ''; x1 = ''; if (isMM(u)) { x0 = JSON.parse(mmMembers[msg['user']].u); // get cats count if (x0 == 1) { x0=''; } // blank out 1 } if (isMG(u)) { x1 = JSON.parse(mgMembers[msg['user']].u); // get charms count if (x1 == 1) { x1=''; } } if (x0) { x='CC:'+x0+'x'; } if (x1) { x='LC:'+x1+'x'; } if (x0 && x1) { x='CC:'+x0+'x, LC:'+x1+'x'; } if (x) { x='('+x+')'; } if ( !isMod(wcm) ) { // NORMAL USERS OR BROADCASTER if (isMG(u) && !isMM(u) ) { // 777 msg['background'] = '#' + cb.settings.mgBGColor; if (cb.settings.mgcolordelta =='yes') { msg['c'] = '#' + cb.settings.mgTextColor; // change text color if option is set to YES } msg['m'] = x+" " + emojii + " " + msg['m']; // just emojii } if (isMM(u) && !isMG(u)) { // 444 msg['background'] = '#' + cb.settings.mmBGColor; if (cb.settings.mgcolordelta =='yes') { msg['c'] = '#' + cb.settings.mmTextColor; } msg['m'] = x+ " " + emojii2 + " " + msg['m']; } finalemojii = emojiiBC; if ( isMG(u) && isMM(u) ) { // both clubs msg['background'] = '#' + cb.settings.mgBGColor; // lucky charmers BG color if (cb.settings.mgcolordelta =='yes') { msg['c'] = '#' + cb.settings.mgTextColor; // lucky charms text color } if (u == cb.settings.kingTipper) { finalemojii = mike3emojii; } msg['m'] = x+" " + finalemojii + " " + msg['m']; // both emojiis (and possibly crown for KT) } } ////// // MOD (i.e. MMB) text/colors (This will PRE-PEND the mod tag to any other category, i.e. [mod] [high roller], I just want the colors really) // var wcm = u.toLowerCase(); //// test-app workaround! if ( isMod(wcm) ) { // do MMB text and background colors and new monkey emote msg['background'] = '#' + cb.settings.modBGColor; // msg['background'] = 'linear-gradient(135deg, #ffe0b3 40%, #F4B970 100%)'; // works! // msg['background'] = 'linear-gradient(135deg, #efddba 30%, #f4b970 100%)'; // (10/25/2018) // msg['background'] = 'linear-gradient(315deg, #ff7878 0%, #80d680 74%)'; // (12/24/2018) xmas colors :p msg['background'] = 'linear-gradient(315deg, #bdd4e7 0%, #8693ab 74%)'; // (12/24/2018) new year's colors :p msg['background'] = 'linear-gradient(315deg, #9e8fb2 0%, #a7acd9 74%)'; // (12/24/2018) new year's colors :p more purple msg['c'] = '#' + cb.settings.modColor; // msg['c'] = fancytext; msg['m'] = x+" " + emojiiMMB + " " + msg['m']; } ////// // special colors for 50+ charmers if (x1 > 49 || x0 > 49) { msg['background'] = '#ff9999'; // salmon msg['c'] = '#000000'; // black } // special colors for 100+ charmers if (x1 > 99 || x0 > 99) { msg['background'] = '#202020'; // light black msg['c'] = '#b278e2'; // purple (#9265B8) } // special colors for 200+ charmers if (x1 > 199 || x0 > 199) { msg['background'] = '#202020'; // light black msg['c'] = '#4992ff'; // light blue } // special colors for 300+ charmers! if (x1 > 299 || x0 > 299) { msg['background'] = '#202020'; // light black msg['c'] = '#f4d142'; // light yellow } // special colors for 400+ charmers! if (x1 > 399 || x0 > 399) { msg['background'] = '#202020'; // light black msg['c'] = '#baffce'; // light green } // special colors for 999+ charmers! (Lana) if (x1 > 999 || x0 > 999) { msg['background'] = '#202020'; // light black msg['c'] = ' #FF9900'; // orange } ////// // MVP text for all-time king tipper (KT gets diff gif as above) if ( u == cb.settings.kingTipper ) { // msg['m'] = "MVP " + crowngif + " " + msg['m']; msg['m'] = "MVP " + msg['m']; } ///// if (twcRegex.test(u)) { // Auto-silencing at least some of token_wh*re_c*nts usernames msg['X-Spam'] = true; } //code by asdfghjkl28, 3 uppercase words or more will be converted to lowercase (emote-safe) skips broadcater, mods, fanclub if ( (m.countWords() > 2) && (isUpperCase(m)) && !msg['is_mod'] && !msg['in_fanclub'] && msg['user'] != cb.room_slug && msg['user'] != vdev ) { var parts = msg['m'].split(" "); var cleaned = []; for (var kk = 0; kk < parts.length; kk++) { var word = parts[kk]; if (emotePattern.test(word) || capitalised.test(word)) { cleaned.push(word); } else { cleaned.push(word.toLowerCase()); } } msg['m'] = cleaned.join(' '); } return msg; }); function isUpperCase(myString) { return (myString == myString.toUpperCase()); } ///////////////////////////////////////// cb.onTip() //////////////////////////////////////////// cb.onTip(function (tip) { var amountTipped = parseInt(tip['amount']); var usr = tip['from_user']; var tipnote = tip['message']; // grab the tipe note for LanaQuote parsing /// LB stuff handleTip(tip.amount, tip.from_user); scheduleUpdate(); sortLeaderboard(); // should auto-highlight NON-fanclub member automatically instead of needing to do a "!lb" silent_room = false; /// // Make Lucky Charm (777) and announce it // if ( amountTipped == cb.settings.mgMinTip && !isMG(usr) ) { if ( amountTipped == cb.settings.mgMinTip ) { if ( !isMG(usr) ) { makeMG(usr); } doRain(cb.settings.mgRainText, cb.settings.mgRainCount); doAnnounce(cb.settings.mgAnnounce, cb.settings.mgMinTip, usr,cb.settings.mgBGColor); // } else if ( amountTipped == cb.settings.mmMinTip && !isMM(usr) ) { } else if ( amountTipped == cb.settings.mmMinTip ) { // Make Cool Cats (444) and announce it if ( !isMM(usr) ) { makeMM(usr); } doRain(cb.settings.mmRainText, cb.settings.mmRainCount); doAnnounce(cb.settings.mmAnnounce, cb.settings.mmMinTip, usr,cb.settings.mmBGColor); } //// random Lana quote (tips) if ( amountTipped == cb.settings.quoteTip ) { // https://stackoverflow.com/questions/6625551/math-random-number-without-repeating-a-previous-number var results; var rl; var prefix = ''; if ( (tipnote) && (isNumber(tipnote)) ) { drn = tipnote; qmsg = quotes[drn-1]; cb.sendNotice(usr + ' tipped for a LanaQuote\u2122: [#' + drn + '/' + quotemax + '] ' + qmsg,'','','#124ba8','bold'); return; } if (tipnote) { var results = quotes.filter(function(value) { return value.toLowerCase().indexOf(tipnote.toLowerCase()) >= 0; }); } if (results) { var rl = results.length; } if (rl > 0) { if ( rl > 1) { // more than 1 result found, so pick random one (there will be dupes..) jk = Math.floor(Math.random() * rl); results = results[jk]; } var ia = inArray(results,quotes) qmsg = "('"+tipnote+"': "+rl+" found) "+results; wm = ia; drn = wm + 1; } else { if (wi == quotemax-1) { qinit(); // re-shuffle quote index (or if CB cant handle it, just do i=-1 here) } wi++; wm = nums[wi]; qmsg = quotes[wm]; drn = wm + 1; if (rl == 0) { prefix = "(Displaying random quote): "; } } cb.sendNotice(usr + ' tipped for a LanaQuote\u2122: [#' + drn + '/' + quotemax + '] ' + prefix + qmsg,'','','#124ba8','bold'); } //// // tip menu handling for (var i = 1; i <= MAXITEMS; i++) { if (amountTipped == tipmenuprice[i]) { cb.sendNotice(usr + ' tipped for "' + tipmenuitem[i].trim() + '"','','',cb.settings['noticecolor'],'bold'); break; } if (amountTipped == tipmenuprice2[i]) { cb.sendNotice(usr + ' tipped for "' + tipmenuitem2[i].trim() + '"','','',cb.settings['noticecolor'],'bold'); break; } } }); function doRain(text,times) { // text += '!'; var star=''; if (times > 4) star='* '; if (times > 6) star='** '; // for (var i = 0; i < times; i++) { // cb.chatNotice(star+text); // } // rainbow colors (yellow fade to purple) if (times == cb.settings.mgRainCount) { // 777 cb.chatNotice(star+text,'','#000000','#FEDA7E','bold'); cb.chatNotice(star+text,'','#000000','#FC9063','bold'); cb.chatNotice(star+text,'','#000000','#DA5653','bold'); cb.chatNotice(star+text,'','#000000','#70102f','bold'); cb.chatNotice(star+text,'','#000000','#9265B8','bold'); cb.chatNotice(star+text,'','#000000','#553983','bold'); cb.chatNotice(star+text,'','#000000','#462aa2','bold'); } else { // 444 (blue fade) cb.chatNotice(star+text,'','#333344','#d2eafd','bold'); cb.chatNotice(star+text,'','#333344','#a6d4fa','bold'); cb.chatNotice(star+text,'','#333344','#79bff8','bold'); cb.chatNotice(star+text,'','#333344','#4daaf6','bold'); cb.chatNotice(star+text,'','#333344','#2196f3','bold'); } } // end function function doAnnounce(text,tokens,user,color) { var announcement = text.replace("MEMBERNAME", user); cb.chatNotice('** '+announcement+' ('+tokens+' tokens) **','','#191919','#'+color,'bold'); } // un-working for now (might be a test-app error?) function doText(bgc,fgc,txtm) { // I don't think msg[] is in the global scope? msg['background'] = '#' + bgc; msg['c'] = '#' + fgc; msg['m'] = "[" + txtm + "] " + msg['m']; //cb.log(msg['m']); } String.prototype.countWords = function(){ return this.split(/\s+/).length; } /////////////////////////////// array functions /////////////////////////////// function isMM(username) { return (username in mmMembers); // Cool cats } function isMG(username) { return (username in mgMembers); // Lucky charmers } function isSneaky(username) { return (username in sneakers); // stealth users } function makeMG(username) { mgMembers[username] = {'u': 1}; } function makeMM(username) { mmMembers[username] = {'u': 1}; } /////// //mods function isMod(username) { return (username in modMembers); } /// LB functions function handleTip(amount, user) { user_total_tips[user] = (user_total_tips[user] || 0) + amount; user_last_tip_time[user] = new Date().valueOf(); } function sortLeaderboard(){ var lb = []; for (var user in user_total_tips) { if (user_total_tips.hasOwnProperty(user)){ lb.push([user_total_tips[user], -user_last_tip_time[user], user]); } } if (lb.length > 0){ lb.sort(function(a, b){ var r,i; for (i=0; i < a.length; i++){ if (a[i] < b[i]){ return 1; } if (a[i] > b[i]){ return -1; } } return 0; }); leader_username = lb[0][2]; } return lb; } function formatRanking(leaderboard, rank){ if (rank < leaderboard.length) { var p = leaderboard[rank]; return p[2] + ' (' + p[0] + ' token' + (p[0]!=1 ? 's' : '') + ')'; } else { return '--'; } } function getTop3(leaderboard){ var rank, result=''; for (rank=0; rank<3; rank++){ if (rank>0){ result += '|'; } if (rank < leaderboard.length){ result += leaderboard[rank][2]; } } return result; } function sendLeaderboard(force, to_user) { var lb = sortLeaderboard(), l = to_user ? lb.length : 3, out = '### Tippers Leaderboard ###'; if (!force) { var top3 = getTop3(lb); if (top3 == last_top3){ return; } last_top3 = top3; } if (l<3) { l=3; } if (l < lb.length) { out += ' Top 3 (Type !lb to see the full leaderboard)'; } if (to_user){ // out += ' [v' + VERSION+']'; // mute version display } for (var rank=0; rank<l; rank++) { out += NL + '' + (rank+1) + '. ' + formatRanking(lb, rank); } cb.chatNotice(out, to_user,'#E9D5CE','#707','bold'); if (!to_user){ scheduleInterval(); } } function scheduleUpdate(){ var print_on_tip = cb.settings.print_on_tip; if (print_on_tip != 'never') { var counter = ++update_counter; cb.setTimeout(function(){ if (update_counter == counter){ sendLeaderboard(print_on_tip == 'always'); } }, UPDATE_TIME); } } function scheduleInterval(){ var interval = cb.settings.print_interval; if (interval > 0) { var counter = ++interval_counter; cb.setTimeout(function(){ if (interval_counter == counter){ sendLeaderboard(!silent_room); } }, interval*INTERVAL_MULTIPLIER); silent_room = true; } } /// //// new timer functions from Ultra Bot by britney_and_justin (need way to kill timer!) function startTimer(t, mod) { //there is no timer already running if(startTime == 0 && timeAdded == 0) { //verify a valid option was sent with /starttimer if(t >= 0 && t.toString().indexOf('.') == -1) { timerDuration = t; //notice of timer start if(mod != null) { cb.sendNotice(mod + ' has set a timer for ' + timerDuration + ' minutes!','',purple); } //local variable to convert noticeTime (minutes) to milliseconds var millis = timerDuration * 60000; var fiveMinutes = millis - 300000; var oneMinute = millis - 60000; //actual timer cb.setTimeout(timer,millis); //five minutes remaining announcement if(fiveMinutes > 0) { cb.setTimeout(fiveMinuteWarning,fiveMinutes); } //one minute remaining announcement cb.setTimeout(oneMinuteWarning,oneMinute); //set the start time startTime = new Date(); } else if(t != null) { cb.sendNotice('[mod] ' + t + ' is not a valid option for /timer. Check for typos.',mod,purple); } else if(t == null) { cb.sendNotice('[mod] You did not enter a valid option for /timer. Enter a number after the command. Ex.: /timer 5',mod,purple); } } //there is a timer running and time has been added else if(startTime != 0 && timeAdded != 0 && mod == null) { timeAdded = 0; timerDuration = t; //local variable to convert noticeTime (minutes) to milliseconds var millis = timerDuration * 60000; var fiveMinutes = millis - 300000; var oneMinute = millis - 60000; //actual timer cb.setTimeout(timer,millis); //five minutes remaining announcement if(fiveMinutes > 0) { cb.setTimeout(fiveMinuteWarning,fiveMinutes); } //one minute remaining announcement cb.setTimeout(oneMinuteWarning,oneMinute); } //there is a timer running and someone tried to start a new timer else if(startTime != 0 && timeAdded == 0 || startTime != 0 && timeAdded != 0 && mod != null) { cb.sendNotice('[mod] There is a timer running already.',mod,purple); } } function timer() { //check to see if /addTime has been used if(timeAdded == 0 && !killtimer) { cb.sendNotice('**** TIME IS UP!! ****','','#202020','#f0f000','bold'); startTime = 0; timerDuration = 0; } else { if(timeAdded == 5 && !killtimer) { cb.sendNotice('There are 5 minutes remaining!','',purple); } if (!killtimer) { startTimer(timeAdded); } } } function fiveMinuteWarning() { if(timeAdded == 0 && !killtimer) { cb.sendNotice('There are 5 minutes remaining!','',purple); } } function oneMinuteWarning() { if(timeAdded == 0 && !killtimer) { cb.sendNotice('There is 1 minute remaining!','',purple,'#000','bold'); } } function timeLeft(user) { if(startTime != 0) { //local variable for the current time var currentTime = new Date(); //local variable to hold the time left var timeLeft = startTime.getHours()*3600 + startTime.getMinutes()*60 + startTime.getSeconds() + timerDuration*60 - currentTime.getHours()*3600 - currentTime.getMinutes()*60 - currentTime.getSeconds(); //local variables for hours, minutes, and seconds remaining var hours = timeLeft/3600; hours = Math.floor(hours); var minutes = (timeLeft-hours*3600)/60; minutes = Math.floor(minutes); var seconds = timeLeft-hours*3600-minutes*60; //account for timeAdded minutes += timeAdded; //fix numbers after timeAdded if(hours < 0) { hours = 0; minutes = 0; } if(hours > 0) { if(hours > 9) { if(minutes > 9 && seconds > 9) { cb.sendNotice('Time Remaining: ' + hours + ':' + minutes + ':' + seconds,user,purple); } else if(minutes > 9 && seconds <= 9) { cb.sendNotice('Time Remaining: ' + hours + ':' + minutes + ':0' + seconds,user,purple); } else if(minutes <= 9 && seconds > 9) { cb.sendNotice('Time Remaining: ' + hours + ':' + minutes + ':' + seconds,user,purple); } else if(minutes <= 9 && seconds <= 9) { cb.sendNotice('Time Remaining: ' + hours + ':' + minutes + ':0' + seconds,user,purple); } } else { if(minutes > 9 && seconds > 9) { cb.sendNotice('Time Remaining: 0' + hours + ':' + minutes + ':' + seconds,user,purple); } else if(minutes > 9 && seconds <= 9) { cb.sendNotice('Time Remaining: 0' + hours + ':' + minutes + ':0' + seconds,user,purple); } else if(minutes <= 9 && seconds > 9) { cb.sendNotice('Time Remaining: 0' + hours + ':' + minutes + ':' + seconds,user,purple); } else if(minutes <= 9 && seconds <= 9) { cb.sendNotice('Time Remaining: 0' + hours + ':' + minutes + ':0' + seconds,user,purple); } } } else if(hours == 0 && minutes > 0) { if(minutes > 9 && seconds > 9) { cb.sendNotice('Time Remaining: 00:' + minutes + ':' + seconds,user,purple); } else if(minutes > 9 && seconds <= 9) { cb.sendNotice('Time Remaining: 00:' + minutes + ':0' + seconds,user,purple); } else if(minutes <= 9 && seconds > 9) { cb.sendNotice('Time Remaining: 00:0' + minutes + ':' + seconds,user,purple); } else if(minutes <= 9 && seconds <= 9) { cb.sendNotice('Time Remaining: 00:0' + minutes + ':0' + seconds,user,purple); } } else if(hours == 0 && minutes == 0 && seconds > 0) { if(seconds > 9) { cb.sendNotice('Time Remaining: 00:00' + ':' + seconds,user,purple); } else { cb.sendNotice('Time Remaining: 00:00' + ':0' + seconds,user,purple); } } else { cb.sendNotice('hours: ' + hours + '\nminutes: ' + minutes + '\nseconds: ' + seconds); } } else { cb.sendNotice('There is no timer running.',user,purple); } } function addTime(t, mod) { if(t > 0 && t.toString().indexOf('.') == -1) { if(startTime != 0) { timeAdded = parseInt(t); //notice of timer start if(timeAdded == 1) { cb.sendNotice(mod + ' has has added 1 minute to the timer!','',purple); } else { cb.sendNotice(mod + ' has has added ' + timeAdded + ' minutes to the timer!','',purple); } } else { cb.sendNotice('[mod] There is no timer running.',mod,purple); } } else if(t != null) { cb.sendNotice('[mod]' + t + ' is not a valid option for /addtime. Check for typos.',mod,purple); } else if(t == null) { cb.sendNotice('[mod] You did not enter a valid option for /addtime. Enter a number after the command. Ex.: /addtime 5',mod,purple); } } //// ////////////////////////////////////////////////////////////////////////////////// function grabSettings() { // Get Cool Cats members 444 if (cb.settings.mmMemberList) { var mmMemberSettings = cb.settings.mmMemberList.split(','); for (var ii = 0; ii < mmMemberSettings.length; ii++) { npos = 0; multi = 0; clean = mmMemberSettings[ii].toLowerCase().replace(/ /g, ""); npos = clean.indexOf("*"); //username*3 - get pos of * if (npos > 0) { multi = clean.substring(npos+1); // get number temp = clean.substring(0,npos); // get username mmMembers[temp] = {'u': multi}; // // need to make new array with username:multi (?) } else { mmMembers[clean] = {'u': 1}; } } //end for() } // Get Lucky Charm 777 if (cb.settings.mgMemberList) { var mgMemberSettings = cb.settings.mgMemberList.split(','); for (var ii = 0; ii < mgMemberSettings.length; ii++) { npos = 0; multi = 0; var clean = mgMemberSettings[ii].toLowerCase().replace(/ /g, ""); npos = clean.indexOf("*"); //username*3 - get pos of * if (npos > 0) { multi = clean.substring(npos+1); // get number temp = clean.substring(0,npos); // get username mgMembers[temp] = {'u': multi}; // // need to make new array with username:multi (?) } else { mgMembers[clean] = {'u': 1}; } } //end for() } // Get stealth logins if (cb.settings.sneakyList) { var ssMemberSettings = cb.settings.sneakyList.split(','); for (var ii = 0; ii < ssMemberSettings.length; ii++) { var clean = ssMemberSettings[ii].toLowerCase().replace(/ /g, ""); sneakers[clean] = {'u': 1}; } } // Get mods if (cb.settings.modList) { var modMemberSettings = cb.settings.modList.split(','); for (var ii = 0; ii < modMemberSettings.length; ii++) { var clean = modMemberSettings[ii].toLowerCase().replace(/ /g, ""); modMembers[clean] = {'u': 1}; } } cb.log('Finished grabbing settings, fire the script!'); } //////// Tip Menu Plus stuff function chatAd(option,all) { if (all == 'all') { // dont check/increment noticeDelta, just print the tipmenu } else { noticeDelta++; if (noticeDelta % 2 == 0) { // check for even iteration chatAd2(option); return; } } toUser = ''; group = ''; if (option !== 'lightblue') { toUser = option; } if (option == 'lightblue') { group = option; } if (msg!='Tip Menu: ') { cb.sendNotice(msg,toUser,'',cb.settings['noticecolor'],'bold',group); } if (!option) cb.setTimeout(chatAd, (cb.settings.chat_ad * 60000)); } cb.setTimeout(chatAd, (cb.settings.chat_ad * 60000)); function chatAd2(option,all) { toUser = ''; group = ''; if (option !== 'lightblue') { toUser = option; } if (option == 'lightblue') { group = option; } if (msg!='Tip Menu: ') { cb.sendNotice('Tip Menu: '+Smsg,toUser,'',cb.settings['noticecolor'],'bold',group); } if (!option) cb.setTimeout(chatAd, (cb.settings.chat_ad * 60000)); // re-run timer } // cb.setTimeout(chatAd2, ((cb.settings.chat_ad *1.3) * 60000)); // (8/17/2018) logic done in chatAd() now // init Tip Menu Plus function init() { for (i=0;i<=MAXSEP-1;i++) { if (cb.settings['sepchar'] == separators[i].label) { separator_char = separators[i].shortcut + ' '; } } msg = 'Tip Menu: '; Smsg = ' '+ separator_char + ' '; for (i=1;i<=MAXITEMS;i++) { var tmp; tmp=cb.settings['item' + i]; if (tmp) { var arr = tmp.split('--'); if (arr[1]===undefined) { cb.sendNotice('Error-You need two dashes to separate the tip amount and menu item for item no '+ i,'','',cb.settings['noticecolor'],'bold'); } else { 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 + ') '; } } } } // secondary tip menu (hard-coded vars) for (i=1;i<=MAXITEMS;i++) { var tmp; tmp=cb.settings['Sitem' + i]; if (tmp) { var arr = tmp.split('--'); if (arr[1]===undefined) { cb.sendNotice('Error-You need two dashes to separate the tip amount and menu item for item no '+ i,'','',cb.settings['noticecolor'],'bold'); } else { var amt=parseInt(arr[0]); if (amt>0) { tipmenuprice2[i]=amt; tipmenuitem2[i]=arr[1]; if (i>=2) { Smsg += separator_char; } Smsg += arr[1] + '(' + amt + ') '; } } } } if (msg!= 'Tip Menu: ') { cb.sendNotice(msg + " " +Smsg,'','',cb.settings['noticecolor'],'bold'); } else { cb.sendNotice('Error-No tip menu items found','','',cb.settings['noticecolor'],'bold'); } } //// End of routines, fire the script! grabSettings(); showNotice1(); showNotice2(); showNotice3(); showNotice4(); showNotice5(); showNotice6(); showTitle(); init();
© Copyright Chaturbate 2011- 2024. All Rights Reserved.