Bots Home
|
Create an App
Kiradivine's King tipper
Author:
d_style
Description
Source Code
Launch Bot
Current Users
Created by:
D_Style
// Title: "KiraDivine's" King tipper bot // Author: d_style // May 11th 2017 // Filter grey comments // Added King Tipper, leaderboard and tiptitles (Used some code from britney_and_justin's Ultra bot) // Added a simplified Lover of the day //variables var tipperArray = new Array; var numTippers = 0; var currentKing = 'No one'; var kingTip = 0; var purple = "#C287C2";//original color: #B369B3 var leaderArray = [['',0],['',0],['',0]]; var showkingSpam = 0; var showleaderSpam = 0; var showloverSpam = 0; var showtipTitles = 0; //Lover of the day variables var tipMode = 0; var messColor = ''; var loverList = {}; var loverNb = 0; var tipperList = {}; var tipperNb=0; var botNotice = ""; var graphicBtg = " :v__btgHeart "; var graphicLov = " :beatingheart "; var graphicStt = " :v__sttHeart "; var graphicShy = " :v__lvrhearts "; //End Lover of the day variables //command variables var COMMAND_HELP = '/kirahelp'; //Displays help for the commands var COMMAND_STOP = '/stop'; //Usage like: /stop king, /stop leader, /stop titles, /stop lover or /stop all var COMMAND_START = '/start'; //Usage like: /start king, /start leader, /start titles, /start lover or /start all mutereasons = [ {regexp: /(?=.*\b(f?ck|finger|my|suck|show|visit|check|click|smell|zoom|flash|blow|down|open|where|fuck|see|touch|spread|lick)\b)(?=.*\b(bio|room|profile|site|cam|titties|body|from|live|panties|you|ass|butt?|booty|clit|pussy|boobies|boobs?|bobs?|tits?|vagina|legs|nipples?|breasts?|asshole|dick|cock|penis|vagina|face)\b)/i, notice: 'demands', index: 0}, {regexp: /:\b/, notice: 'graphics', index: 1}, {regexp: /(.)\1{2}/, notice: 'sticky keys', index: 2}, {regexp: /((?=.*pm)|(?=.*c2c)|(?=.*private)|(?=.*pvt)|(?=.*prvt?)|(?=.*message))/i, notice: 'PM requests', index: 3}, {regexp: /((?=.*1.?f cam)|(?=.*leaked)|(?=.*lanus)|(?=.*sky)|(?=.*www)|(?=.*streamingnaked)|(?=.*1.?female)|(?=.*pornhub)|(?=.*pornmeds)|(?=.*snapmilfs)|(?=.*viagra)|(?=.*cialis)|(?=.*online)|(?=.*erotimo)|(?=.*freecam)|(?=.*freecambook)|(?=.*amecam)|(?=.*1.? f)|(?=.*bestwork)|(?=.*p.*r.*e.*m.*i.*u.*m.*c.*h.*e.*a.*t)|(?=.*patched)|(?=.*ellagocam)|(?=.*visit this)|(?=.*dot)|(?=.*com)|(?=.*fucktubate)|(?=.*cbprivates)|(?=.*tokens)|(?=.*swipegirls)|(?=.*generator)|(?=.*c0m))/i, notice: 'spam', index: 4}, {regexp: /\b[A-Z]{2,}\b/, notice: 'all caps', index: 5}, {regexp: /((?=.*bb)|(?=.*baby)|(?=.*babby)|(?=.*daddy)|(?=.*babe)|(?=.*hun))/i, notice: 'bb or baby', index: 6}, {regexp: /((?=.*f.?e.?e.?t)|(?=.*f33t?)|(?=.*foot)|(?=.*soles?)|(?=.*toes?))/i, notice: 'feet', index: 7}, {regexp: /[^\x00-\x7F]+/, notice: 'non-english', index: 8}, {regexp: /((?=.*bitch)|(?=.*slut)| (?=.*milf)|(?=.*whore)|(?=.*putt?a)|(?=.*ugly)|(?=.*fat)|(?=.*pee)|(?=.*poo)|(?=.*peeing)|(?=.*fart)|(?=.*cunt)|(?=.*filthy)|(?=.*fuckable)|(?=.*fuck)|(?=.*mom))/i, notice: 'rudeness', index: 9}, {regexp: /((?=.*please?)|(?=.*plzz?)|(?=.*behind?)|(?=.*pls)|(?=.*pleaze?)|(?=.*pleez)|(?=.*plee?se)|(?=.*instagram)|(?=.*twitter)|(?=.*sky?pe?)|(?=.*milk)|(?=.*tips?))/i, notice: 'demands', index: 10}, {regexp: /((?=.*mast.?rbate)|(?=.*squirt)|(?=.*fist)|(?=.*kiss)|(?=.*strip)|(?=.*cum)|(?=.*twerk)|(?=.*ass)|(?=.*boobs?)|(?=.*pussy)|(?=.*doggy)|(?=.*doggie)|(?=.*anal)|(?=.*zoom)|(?=.*show)|(?=.*tits)|(?=.*titties)|(?=.*stand up)|(?=.*face)|(?=.*watch my cam)|(?=.*blowjob)|(?=.*watch me)|(?=.*deepthroat))/i, notice: 'demands', index: 11}, ] cb.settings_choices = [ {name: 'entry_msg_onoff', label: 'Show a unique personal emoticon for members when they enter', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes'}, {name: 'tip_titles', label: 'Do you want to display the user\'s tip totals as titles?', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'No'}, {name: 'king_tipper', label: 'Do you want to use the "King Tipper" feature?', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes'}, {name: 'king_min', label: 'Enter the minimum tip total to become the first King.', type: 'int', minValue: 1, maxValue: 1000000, defaultValue: 25}, {name: 'king_timer', label: 'The interval time in minutes for the become a King to be shown.', type: 'int', minValue: 1, maxValue: 60, defaultValue: 5}, {name: 'leader_board', label: 'Would you like to use the top three Leader Board feature?', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'No'}, {name: 'leader_timer', label: 'The interval time in minutes for the leaderboard to be shown.', type: 'int', minValue: 1, maxValue: 60, defaultValue: 5}, {name: 'notifier_tip', label: 'Would you like to display a message when a user tips a certain minimum amount?', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'No'}, {name: 'tip_message', label: 'Enter the message you would like to display.', type: 'str', minLength: 1, maxLength: 1000, defaultValue: 'Thank you!'}, {name: 'tip_message_min', label: 'Enter the minimum tip amount that you would like to show the message.', type: 'int', minValue: 1, maxValue: 1000000, defaultValue: 10}, {name: 'loverOnOff', label: 'Turn Lover Of The Day on?', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'No'}, {name: 'loverTip', label: 'Minimum tips to become a Lover Of The Day.', type: 'int', minValue: 1, defaultValue: 101}, {name: 'tipMode', label: 'Mode SINGLE - The user must tip the minimum in one single tip. Mode MULTI - All the tips of the user count, like a goal', type: 'choice', choice1: 'SINGLE', choice2: 'MULTI', defaultValue: 'SINGLE'}, {name: 'noticeTime', label: 'Minute(s) between Lover Of The Day Notifications ', type: 'int', minValue: 1, maxValue: 10, defaultValue: 4}, {name: 'messColor', label: 'Lover Of The Day notices Color', type: 'choice', choice1: 'Orange', choice2: 'Blue', choice3: 'Pink', choice4: 'Brown', defaultValue: 'Orange'} ]; cb.onEnter(function(user) { if (cb.settings.entry_msg_onoff == 'Yes' && cb.room_slug == 'kiradivine' && user['in_fanclub']) { cb.sendNotice(':kira' + user['user']); }else if (user['has_tokens'] && (!is_broadcaster(user))) { cb.sendNotice(welcome_tokenholders(user),user['user'],'','#0018ff','bold','' ); }else if (!is_broadcaster(user)) { cb.sendNotice(welcome_greys(user),user['user'],'','#0018ff','bold','' ); } if(cb.settings.loverOnOff == 'Yes' && (!is_broadcaster(user))){ var usr = user['user']; var w = isLover(usr) ? "Welcome back my Lover " + graphicLov : botNotice ; cb.sendNotice(w, usr ,'',messColor, 'bolder'); } }); cb.onMessage(function (msg) { var graphic = ''; var usr = msg['user']; if(cb.settings.loverOnOff == 'Yes' && isLover(usr)){ graphic = graphicLov; } if (msg.m.indexOf('/') == 0 && msg.user == cb.room_slug) { checkCommand(msg); msg['X-Spam'] = true; }else { var tmpmsg = msg['m']; //if (!is_broadcaster(msg)) { if ((!msg['has_tokens']) && (!msg['is_mod']) && (!msg['in_fanclub']) && (!is_broadcaster(msg))) { checkmsg(msg); }else if (isLover(usr)){ msg['m'] = graphic + tmpmsg; } if(showtipTitles == 1 && parseInt(tipperArray[findTipper(msg['user'])][1]) > 0) { msg['m'] = setTipTitles(msg['user'],msg['m']); } else if (showkingSpam == 1 && msg['user'] == currentKing){ msg['m'] = ':king ' + tmpmsg; } } }); cb.onTip(function (tip) { tipperArray[findTipper(tip['from_user'])][1] += parseInt(tip['amount']); if(tip['from_user'] != currentKing && parseInt(tipperArray[findTipper(tip['from_user'])][1]) > kingTip && parseInt(tipperArray[findTipper(tip['from_user'])][1]) >= parseInt(cb.settings.king_min)) { if(currentKing != 'No one') { if(showkingSpam == 1) {cb.sendNotice('You have been dethroned by ' + tip['from_user'] + ', but revenge is sweet...', currentKing, purple,'','bold');} } if(showkingSpam == 1) {cb.sendNotice('We have a new King!\nAll hail ' + tip['from_user'] + '!','',purple,'','bold');} currentKing = tip['from_user']; kingTip = parseInt(tipperArray[findTipper(tip['from_user'])][1]); } else if(tip['from_user'] == currentKing) { kingTip = parseInt(tipperArray[findTipper(tip['from_user'])][1]); } //create an array of the names var nameArray = new Array; for(var i = 0; i < leaderArray.length; i++) { nameArray[i] = leaderArray[i][0]; } //the user is not currently in the top 3 if(!cbjs.arrayContains(nameArray,tip['from_user'])) { if(tipperArray[findTipper(tip['from_user'])][1] > leaderArray[0][1]) { leaderArray[2][0] = leaderArray[1][0]; leaderArray[2][1] = leaderArray[1][1]; leaderArray[1][0] = leaderArray[0][0]; leaderArray[1][1] = leaderArray[0][1]; leaderArray[0][0] = tip['from_user']; leaderArray[0][1] = tipperArray[findTipper(tip['from_user'])][1]; } else if(tipperArray[findTipper(tip['from_user'])][1] < leaderArray[0][1] && tipperArray[findTipper(tip['from_user'])][1] > leaderArray[1][1] || tipperArray[findTipper(tip['from_user'])][1] == leaderArray[0][1]) { leaderArray[2][0] = leaderArray[1][0]; leaderArray[2][1] = leaderArray[1][1]; leaderArray[1][0] = tip['from_user']; leaderArray[1][1] = tipperArray[findTipper(tip['from_user'])][1]; } else if(tipperArray[findTipper(tip['from_user'])][1] < leaderArray[1][1] && tipperArray[findTipper(tip['from_user'])][1] > leaderArray[2][1] || tipperArray[findTipper(tip['from_user'])][1] == leaderArray[1][1]) { leaderArray[2][0] = tip['from_user']; leaderArray[2][1] = tipperArray[findTipper(tip['from_user'])][1]; } } //the user is currently in the top 3 else { //the user is already #1 if(leaderArray[0][0] == tip['from_user']) { leaderArray[0][1] = tipperArray[findTipper(tip['from_user'])][1]; } //the user is #2 and is moving to #1 if(leaderArray[1][0] == tip['from_user'] && tipperArray[findTipper(tip['from_user'])][1] > parseInt(leaderArray[0][1])) { leaderArray[1][0] = leaderArray[0][0]; leaderArray[1][1] = leaderArray[0][1]; leaderArray[0][0] = tip['from_user']; leaderArray[0][1] = parseInt(tipperArray[findTipper(tip['from_user'])][1]); } //the user is #2 and is not moving to #1 else if(leaderArray[1][0] == tip['from_user'] && tipperArray[findTipper(tip['from_user'])][1] <= parseInt(leaderArray[0][1])) { leaderArray[1][1] = parseInt(tipperArray[findTipper(tip['from_user'])][1]); } //the user is #3 and is moving to #1 else if(leaderArray[2][0] == tip['from_user'] && tipperArray[findTipper(tip['from_user'])][1] > parseInt(leaderArray[0][1])) { leaderArray[2][0] = leaderArray[1][0]; leaderArray[2][1] = leaderArray[1][1]; leaderArray[1][0] = leaderArray[0][0]; leaderArray[1][1] = leaderArray[0][1]; leaderArray[0][0] = tip['from_user']; leaderArray[0][1] = parseInt(tipperArray[findTipper(tip['from_user'])][1]); } //the user is #3 and is moving to #2 else if(leaderArray[2][0] == tip['from_user'] && tipperArray[findTipper(tip['from_user'])][1] > parseInt(leaderArray[1][1])) { leaderArray[2][0] = leaderArray[1][0]; leaderArray[2][1] = leaderArray[1][1]; leaderArray[1][0] = tip['from_user']; leaderArray[1][1] = parseInt(tipperArray[findTipper(tip['from_user'])][1]); } //the user is #3 and is not moving else if(leaderArray[2][0] == tip['from_user'] && tipperArray[findTipper(tip['from_user'])][1] <= parseInt(leaderArray[1][1])) { leaderArray[2][1] = tipperArray[findTipper(tip['from_user'])][1]; } if(leaderArray[2][0] == leaderArray[1][0] || leaderArray[2][0] == leaderArray[0][0]) { leaderArray[2][0] = ''; leaderArray[2][1] = 0; } if(leaderArray[1][0] == leaderArray[0][0]) { leaderArray[1][0] = ''; leaderArray[1][1] = 0; } } if(cb.settings.notifier_tip == 'Yes' && parseInt(tip['amount']) >= cb.settings.tip_message_min) { cb.sendNotice(cb.settings.tip_message,tip['from_user'],purple); } var usr = tip['from_user']; var newTip = parseInt(tip['amount']); var valueTip = (tipMode == 2 ? manageTipperList(usr, newTip) : newTip); if(cb.settings.loverOnOff == 'Yes' && !isLover(usr) && valueTip >= cb.settings.loverTip){ makeLover(usr); cb.sendNotice("Thank you so much " + usr + ". Your heart now beats for me" + graphicShy ,'','', messColor ,'bolder'); } }); function checkCommand(msg) { //turn the message into an array var message = msg['m'].split(' '); switch(message[0]) { case '/kirahelp': cb.sendNotice(showHelp(),msg['user'],'','#3366ff','bold','' ); break; case '/stop': var stopfeature = message[1].trim(); if (stopfeature == 'king'){ if (showkingSpam == 1){ showkingSpam = 0; cb.sendNotice('Kira has turned the King tipper feature off.','','','#3366ff','bold','' ); }else { cb.sendNotice('King tipper feature already turned off.',cb.room_slug,'','#FF0000','bold','' ); } }else if (stopfeature == 'leader') { if (showleaderSpam == 1){ showleaderSpam = 0; cb.sendNotice('Kira has turned the Leaderboard feature off.','','','#3366ff','bold','' ); }else { cb.sendNotice('Leaderboard feature already turned off.',cb.room_slug,'','#FF0000','bold','' ); } }else if (stopfeature == 'titles') { if (showtipTitles == 1){ showtipTitles = 0; cb.sendNotice('Kira has turned the Tiptitles feature off.','','','#3366ff','bold','' ); }else { cb.sendNotice('Tiptitles feature already turned off.',cb.room_slug,'','#FF0000','bold','' ); } }else if (stopfeature == 'lover') { if (showloverSpam == 1){ showloverSpam = 0; cb.settings.loverOnOff = 'No'; cb.sendNotice('Kira has turned the Lover of the day feature off.','','','#3366ff','bold','' ); }else { cb.sendNotice('Lover of the day feature already turned off.',cb.room_slug,'','#FF0000','bold','' ); } }else if (stopfeature == 'all') { showkingSpam = 0; showleaderSpam = 0; showtipTitles = 0; showloverSpam = 0; cb.sendNotice('Kira has turned all features off.','','','#3366ff','bold','' ); }else { cb.sendNotice('No such option, put king, leader, titles or all after the /stop command.',cb.room_slug,'','#FF0000','bold','' ); } break; case '/start': var startfeature = message[1].trim(); if (startfeature == 'king'){ if (showkingSpam == 0){ showkingSpam = 1; cb.sendNotice('Kira has turned the King tipper feature on.','','','#3366ff','bold','' ); }else { cb.sendNotice('King tipper feature already turned on.',cb.room_slug,'','#FF0000','bold','' ); } }else if (startfeature == 'leader') { if (showleaderSpam == 0){ showleaderSpam = 1; cb.sendNotice('Kira has turned the Leaderboard feature on.','','','#3366ff','bold','' ); }else { cb.sendNotice('Leaderboard feature already turned on.',cb.room_slug,'','#FF0000','bold','' ); } }else if (startfeature == 'titles') { if (showtipTitles == 0){ showtipTitles = 1; cb.sendNotice('Kira has turned the Tiptitles feature on.','','','#3366ff','bold','' ); }else { cb.sendNotice('Tiptitles feature already turned on.',cb.room_slug,'','#FF0000','bold','' ); } }else if (startfeature == 'lover') { if (showloverSpam == 0){ showloverSpam = 1; cb.settings.loverOnOff = 'Yes'; timeBotNotice(); cb.sendNotice('Kira has turned the Lover of the day feature on.','','','#3366ff','bold','' ); }else { cb.sendNotice('Lover of the day feature already turned on.',cb.room_slug,'','#FF0000','bold','' ); } }else if (startfeature == 'all') { showkingSpam = 1; showleaderSpam = 1; showtipTitles = 1; showloverSpam = 1; timeBotNotice(); cb.sendNotice('King tipper, Leaderboard and tiptitle features are turned on.','','','#3366ff','bold','' ); }else { cb.sendNotice('No such option, put king, leader, titles or all after the /start command.',cb.room_slug,'','#FF0000','bold','' ); } break; } } function checkmsg(msg) { var i, tmpmsg; tmpmsg = msg['m']; for (i=0; i<= 11; i++) { if (tmpmsg.search(mutereasons[i].regexp) != -1){ msg['X-Spam'] = true; break; } } } function tipperArrayPopulate(user) { tipperArray[numTippers] = new Array; tipperArray[numTippers][0] = user; tipperArray[numTippers][1] = 0; numTippers++; } function findTipper(user) { //find the index of the user for(var i = 0; i < tipperArray.length; i++) { if(tipperArray[i][0] == user) { break; } } //the user is not in the array. add him and call findTipper if(i == tipperArray.length) { tipperArrayPopulate(user); findTipper(user); } return i; } function setTipTitles(user, message) { if(showkingSpam == 1 && user == currentKing) { var m = '|' + tipperArray[findTipper(user)][1] + '| :king ' + message; } else { var m = '|' + tipperArray[findTipper(user)][1] + '| ' + message; } return m; } function kingSpam() { cb.setTimeout(kingSpamTimer,cb.settings.king_timer*60000); } function kingSpamTimer() { if(kingTip < parseInt(cb.settings.king_min)) { var supplant = cb.settings.king_min; } else { var supplant = kingTip + 1; } if(showkingSpam == 1) { cb.sendNotice(currentKing + ' is the king, tip a total of ' + supplant + ' to become my King!','',purple,'','bold'); } kingSpam(); } function leaderSpam() { cb.setTimeout(leaderSpamTimer,cb.settings.leader_timer*60000); } function leaderSpamTimer() { if(showleaderSpam == 1 && kingTip >= parseInt(cb.settings.king_min)) { cb.sendNotice('Leaderboard!','',purple,'','bold'); cb.sendNotice(':crown01 ' + leaderArray[0][0] + ' : ' + leaderArray[0][1] + '\n' + ':crown02 ' + leaderArray[1][0] + ' : ' + leaderArray[1][1] + '\n' + ':crown03 ' + leaderArray[2][0] + ' : ' + leaderArray[2][1] + '\n'); } leaderSpam(); } function is_broadcaster(testforslug) { return (testforslug['user'] == cb.room_slug); } function showHelp() { return '\nThe following commands are available:\n' + COMMAND_HELP + ' -- Display this help overview.\n' + COMMAND_STOP + ' -- Stop the King tipper, Leaderboard or tiptitles. Usage: /stop king, /stop leader, /stop titles, /stop lover or /stop all.\n' + COMMAND_START + ' -- Stop the King tipper, Leaderboard or tiptitles. Usage: /start king, /start leader, /start titles, /start lover or /start all.\n' + '\n Stopping a feature still keeps track of the tips per user (except for Lover of the day), so if started again it will use the actual data.\n'; } function welcome_tokenholders(user) { return '\n*** Hi ' + user['user'] +', welcome to my room.' + '\n*** Please say \'Hi\' to me when you enter my room, I like polite men.' + '\n*** If this is your first visit then check out my bio for some info about me and my room.' + '\n*** I hope you enjoy your stay.'; } function welcome_greys(user) { return '\n*** Hi ' + user['user'] +', welcome to my room.' + '\n*** Please say \'Hi\' to me when you enter my room, I like polite men.' + '\n*** As a grey you are often allowed to talk, so feel free, but keep it nice and don\'t demand, thank you.' + '\n*** But why not buy a few tokens and go blue, all tips are welcome.' + '\n*** I hope you enjoy your stay.\n' + '\n*** And remember, only English in my room, non-English will get you silenced by my mods.'; } function init() { if(cb.settings.king_tipper == 'Yes') { showkingSpam = 1; } if(cb.settings.leader_board == 'Yes') { showleaderSpam = 1; } if(cb.settings.tip_titles == 'Yes') { showtipTitles = 1; } kingSpamTimer(); leaderSpamTimer(); cb.sendNotice(showHelp(),cb.room_slug,'','#3366ff','bold','' ); if(cb.settings.loverOnOff == 'Yes'){ showloverSpam = 1; } switch (cb.settings.messColor) { case 'Orange' : messColor = "#DC5500"; break; case 'Blue' : messColor = "#9A2EFE"; break; case 'Pink' : messColor = "#F5A9A9"; break; case 'Brown' : messColor = "#8A4B08"; break; } tipMode = cb.settings.tipMode == "SINGLE" ? 1 : 2 ; var inTotal = tipMode == 1 ? '' : " (in total) "; botNotice = "Tip " + cb.settings.loverTip + inTotal + " to become my Lover Of The Day, and make your heart " + graphicBtg + " beat for me."; timeBotNotice(); } // ************************** // Lover of the day functions // ************************** function manageTipperList(usr, newTip) { for (var i=0 ; i<tipperNb; i++) { if (tipperList[i][0]==usr) { var sum = parseInt(tipperList[i][1]) + newTip ; tipperList[i][1] = sum ; return (sum) ; } } tipperList[tipperNb] = new Array ; tipperList[tipperNb][0] = usr; tipperList[tipperNb][1] = newTip; tipperNb+=1; return(newTip); } // makeLover : Add the user to the list of Lovers // isLover : User is in the list of Lovers ? function makeLover(username){ loverList[loverNb] = new Array; loverList[loverNb][0] = username; loverList[loverNb][1] = 0 ; loverNb+=1; } function isLover(username){ for (var i = 0; i < loverNb; i++) { if (loverList[i][0] == username) { return (1); } } return(0); } // //Send Lover of the day notices // function timeBotNotice(){ if(showloverSpam == 1){ cb.sendNotice(botNotice,'','', messColor ,'bolder'); cb.setTimeout(timeBotNotice, cb.settings.noticeTime * 60000) ; } } init();
© Copyright Chaturbate 2011- 2026. All Rights Reserved.