Bots Home
|
Create an App
jehjh
Author:
dylan5179
Description
Source Code
Launch Bot
Current Users
Created by:
Dylan5179
var meanBroadcasters = "dylan5179"; var onmensage = true; var usurios; var registro = { Leaderboard: { Leaders: { Highest: { Username: null, Amount: 0 }, HighestTotal: { Username: null, Amount: 0 }, Viceroy: { Username: null, Amount: 0 }, Duke: { Username: null, Amount: 0 }, Lowest: { Username: null, Amount: 0 }, MostRecent: { Username: null, Amount: 0 } }, All: [] }, VirtualTotal: 0, ActualTotal: 0 }; cb.settings_choices = [ { name: 'noticias', type: 'choice', label: 'news carolina', choice1: 'Yes', choice2: 'No', defaultValue: 'No' }, {name: 'msg1', type: 'str', minLength:1, maxLength:255, label: 'message #1', required:false}, {name: 'msg2', type: 'str', minLength:1, maxLength:255, label: 'message #2', required:false}, {name: 'msg3', type: 'str', minLength:1, maxLength:255, label: 'message #3', required:false}, {name: 'msg4', type: 'str', minLength:1, maxLength:255, label: 'message #4', required:false}, {name: 'msg5', type: 'str', minLength:1, maxLength:255, label: 'message #5', required:false}, {name: 'msg6', type: 'str', minLength:1, maxLength:255, label: 'message #6', required:false}, {name: 'msg7', type: 'str', minLength:1, maxLength:255, label: 'message #7', required:false}, { name: 'Message_wait_time', type: 'choice', label: 'In minutes, how often should the app advertise itself, news carolina?', choice1: 1, choice2: 2, choice3: 3, choice4: 4, choice5: 5, choice6: 10, choice7: 15, choice8: 20, defaultValue: 20 }, { name: 'reglas', type: 'choice', label: 'ROOM RULES', choice1: 'Yes', choice2: 'No', defaultValue: 'No' }, {name:'rule1', type:'str', minLength:1, maxLength:255, label:'Rule #1 (optional)', required:false}, {name:'rule2', type:'str', minLength:1, maxLength:255, label:'Rule #2 (optional)', required:false}, {name:'rule3', type:'str', minLength:1, maxLength:255, label:'Rule #3 (optional)', required:false}, {name:'rule4', type:'str', minLength:1, maxLength:255, label:'Rule #4 (optional)', required:false}, {name:'rule5', type:'str', minLength:1, maxLength:255, label:'Rule #5 (optional)', required:false}, {name:'rule6', type:'str', minLength:1, maxLength:255, label:'Rule #6 (optional)', required:false}, {name:'rule7', type:'str', minLength:1, maxLength:255, label:'Rule #7 (optional)', required:false}, {name:'rule8', type:'str', minLength:1, maxLength:255, label:'Rule #8 (optional)', required:false}, {name:'rule9', type:'str', minLength:1, maxLength:255, label:'Rule #9 (optional)', required:false}, {name:'rule10', type:'str', minLength:1, maxLength:255, label:'Rule #10 (optional)', required:false}, {name:'advertisement_wait_time', type:'choice', label:'Notification Time (in minutes)', choice1:5, choice2:10, choice3:15, choice4:20, choice5:25, choice6:30, choice7:45, choice8:60, defaultValue:15}, { name: 'king', type: 'choice', label: 'king and high tipper', choice1: 'Yes', choice2: 'No' }, { name: 'Message_wait_time1', type: 'choice', label: 'In minutes, how often should the news advertise itself, king and high tipper?', choice1: 1, choice2: 2, choice3: 3, choice4: 4, choice5: 5, choice6: 10, choice7: 15, choice8: 20, defaultValue: 20 }, { name: 'griss', type: 'choice', label: 'allow no opinion to the grays', choice1: 'Yes', choice2: 'No' }, { name: 'The_High_Tipper', type: 'str', label: 'The High Tipper is:', required:false }, { name: 'High_Tipper_amount', type: 'int', label: 'Amount', required:false }, { name: 'gracias', type: 'choice', label: 'Auto Thank You', choice1: 'Yes', choice2: 'No' }, { name: 'tipamount', type: 'int', minValue: 1, defaultValue: 10, label: 'Minimum tokens required for a thank you message' }, { name: 'tipmsg', type: 'str', minLength: 8, maxLength: 128, defaultValue: '**** Thank you [tipper] for your tip!!! (: **** ', label: "Tip thank you message, [tipper] = tipper's name" } ]; cb.onMessage(function (msg) { Revisarmsg(msg); arreglomsg(msg); Comandos(msg); if((!msg['has_tokens']) && (cb.settings.griss == 'No')) { msg['X-Spam'] = true; cb.sendNotice('Sorry! Only people with tokens can chat in this room or until the end. Feel free to buy some tokens.', msg['user'], '', '', 'bold'); } }); cb.onTip(function (tip) { ThankYou(tip.from_user, tip.amount); recordTip(tip.from_user, tip.amount, true); }); cb.onEnter(function (user) { var co = '\u26A4'+' \u26A4'+' \u26A4'+' \u26A4'+' \u26A4'+' \u26A4'+' \u26A4'; var pip = co + ' ...... '+ user['user'] +' ...... ' + co + "\n" ; pip += " " + " "+" " + " "+" " + " "+ ":welcome006 \n" ; pip += '\u2764' + ' \u2764'+ " ..PLEASE DO NOT FORGET TO GIVE ME LIKE ... " + ' \u2764'+' \u2764' +'\n' ; pip += co + co + co +' \u26A4'+' \u26A4'; cb.sendNotice(pip, user['user'], '#00FF00', '#0000FF', 'bold'); usurios = user['user'] if(meanBroadcasters != usurios) { if (cb.settings.noticias == "Yes") { Messages(user); } if (cb.settings.reglas == "Yes") { cb.sendNotice(user['user'] + '. Please take a moment to read my room rules before chatting. Thank you!', user['user'], '#DBFFDB', '', 'bold'); ReglasRoom(user); } if (cb.settings.king == "Yes") { kingtipper(user); } } }); function buildStatsOutput() { var output = ""; output += "=== Goal Statistics ===\n\n"; output += "The King Tipper is: " + registro.Leaderboard.Leaders.HighestTotal.Amount + " from " + registro.Leaderboard.Leaders.HighestTotal.Username + "\n"; output += "The High Tipper is: " + registro.Leaderboard.Leaders.Highest.Amount + " from " + registro.Leaderboard.Leaders.Highest.Username + "\n"; output += "Stingiest tip: " + registro.Leaderboard.Leaders.Lowest.Amount + " from " + registro.Leaderboard.Leaders.Lowest.Username + "\n"; output += "Most recent tip: " + registro.Leaderboard.Leaders.MostRecent.Amount + " from " + registro.Leaderboard.Leaders.MostRecent.Username + "\n"; output += "=== Leaderboard (Top 100) ===\n\n"; output += Stats() + "\n"; output += RegistroUser(); return output; } function recordTip(username, tokens, countsToActual) { var tipperFound = false; var actualTokens = tokens; registro.VirtualTotal += tokens; if (countsToActual) { registro.ActualTotal += actualTokens; registro.Leaderboard.Leaders.MostRecent.Amount = tokens; registro.Leaderboard.Leaders.MostRecent.Username = username; if (tokens > registro.Leaderboard.Leaders.Highest.Amount) { registro.Leaderboard.Leaders.Highest.Amount = tokens; registro.Leaderboard.Leaders.Highest.Username = username; } if (tokens <= registro.Leaderboard.Leaders.Lowest.Amount || registro.Leaderboard.Leaders.Lowest.Amount == 0) { registro.Leaderboard.Leaders.Lowest.Amount = tokens; registro.Leaderboard.Leaders.Lowest.Username = username; } for (var idx = 0; idx < registro.Leaderboard.All.length; idx++) { if (registro.Leaderboard.All[idx].name == username) { registro.Leaderboard.All[idx].tokens += tokens; tipperFound = true; break; } } if (!tipperFound) { registro.Leaderboard.All.push( { name: username, tokens: tokens }); } registro.Leaderboard.All.sort(function (a, b) { return b.tokens - a.tokens; }); registro.Leaderboard.Leaders.HighestTotal.Username = registro.Leaderboard.All[0].name; registro.Leaderboard.Leaders.HighestTotal.Amount = registro.Leaderboard.All[0].tokens; for (var idx = 0; idx < registro.Leaderboard.All.length && idx < 100; idx++) { var segundo = 1; var tercero = 2; if ((registro.Leaderboard.All[idx] !== undefined) && (idx === segundo)) { registro.Leaderboard.Leaders.Viceroy.Username = registro.Leaderboard.All[idx].name; registro.Leaderboard.Leaders.Viceroy.Amount = registro.Leaderboard.All[idx].tokens; } if ((registro.Leaderboard.All[idx] !== undefined) && (idx === tercero)) { registro.Leaderboard.Leaders.Duke.Username = registro.Leaderboard.All[idx].name; registro.Leaderboard.Leaders.Duke.Amount = registro.Leaderboard.All[idx].tokens; } } } } function Stats() { var leaderboard = ""; for (var idx = 0; idx < registro.Leaderboard.All.length && idx < 10; idx++) { if (registro.Leaderboard.All[idx] !== undefined) { leaderboard += registro.Leaderboard.All[idx].name + ' (' + registro.Leaderboard.All[idx].tokens + ')\n'; } } return leaderboard; } function RegistroUser() { var usuarito = ""; for (var idx = 0; idx < registro.Leaderboard.All.length; idx++) { if (registro.Leaderboard.All[idx] !== undefined) { usuarito += registro.Leaderboard.All[idx].name + ', ' + registro.Leaderboard.All[idx].tokens + ', '; } } return usuarito; } function arreglomsg(msg) { if (msg.user != cb.room_slug) { var unavez = true; var unavezz = true; for (var idx = 0; idx < registro.Leaderboard.All.length; idx++) { if (registro.Leaderboard.All[idx].name == msg['user']) { var msgh = msg['m']; var temporalmsg; temporalmsg = "|"+ registro.Leaderboard.All[idx].tokens +"| " + msgh; msg['m'] = temporalmsg; } if ((registro.Leaderboard.All[idx].name == msg['user']) && (onmensage == true)&& (unavez == true)) { if (registro.Leaderboard.All[idx].tokens < 5) { var faltantes = 5 - parseInt(registro.Leaderboard.All[idx].tokens); msg['X-Spam'] = true; var username = msg['user']; var mens = "please put any requests in a tip note or give [" + faltantes + " tokens]" ; cb.sendNotice(mens, username, '', '#000099', 'bolder'); unavez = false; } unavezz = false; } } if ((onmensage == true) && (unavezz == true)) { msg['X-Spam'] = true; var username = msg['user']; var mens = "please put any requests in a tip note or have tipped [5 tokens] "; cb.sendNotice(mens, username, '', '#000099', 'bolder'); } } } function ReglasRoom(user) { if (cb.settings.reglas == "Yes") { var co = '\u2764'+'\u2764'+'\u2764'+'\u2764'+'\u2764'+'\u2764'+'\u2764'; var username = ''; if(user) username = user['user']; var notices = co + ' ROOM RULES ' + co ; for(var i=1; i<=10;i++) { if(cb.settings['rule' + i]) notices += '\nRule #'+ i +': ' + cb.settings['rule'+i]; } notices += '\n' + co + co + co; if(meanBroadcasters != username) { cb.sendNotice(notices, username, '#E6FFFF', '#003399', 'bold'); } if(!user || user == null) cb.setTimeout(ReglasRoom, cb.settings.advertisement_wait_time * 60000); } } function Messages(user) { if (cb.settings.noticias == "Yes") { var co = '\u2764'+'\u2764'+'\u2764'+'\u2764'+'\u2764'+'\u2764'+'\u2764'; var username = ''; if(user) username = user['user']; var mensaje = co + ' Important Messages ' + co ; for(var i=1; i<=7;i++) { if(cb.settings['msg' + i]) mensaje += '\n#'+ i +': ' + cb.settings['msg'+i]; } mensaje += '\n' + co + co + co +'\u2764'+'\u2764'+'\u2764'+'\u2764'; if(meanBroadcasters != username) { cb.sendNotice(mensaje, username, '#E6FFFF', '#800080', 'bold'); } if(!user || user == null) cb.setTimeout(Messages, cb.settings.Message_wait_time * 60000); } } function kingtipper(user) { if (cb.settings.king == "Yes") { var co = '\u2620 '+'\u2620 '+'\u2620 '+'\u2620 '+'\u2620 '+'\u2620 '+'\u2620 '; var username = ''; if(user) username = user['user']; var mensaje = co + '\u2764'+'\u2764'+'\u2764 ...... MY KING ...... \u2764'+'\u2764'+'\u2764'+'\u2764 ' + co + "\n" ; mensaje += "My King is: " + '\u2764'+'\u2764'+'\u2764'+'\u2764'+'\u2764'+'\u2764 ........' + registro.Leaderboard.Leaders.HighestTotal.Username + '........... \u2764'+'\u2764'+'\u2764'+'\u2764 ' + " With (" + registro.Leaderboard.Leaders.HighestTotal.Amount + ")\n"; mensaje += "My Viceroy is: " + '\u2764'+'\u2764'+'\u2764'+'\u2764'+'\u2764 ........' + registro.Leaderboard.Leaders.Viceroy.Username + '........... \u2764'+'\u2764'+'\u2764'+'\u2764 ' + " With (" + registro.Leaderboard.Leaders.Viceroy.Amount + ")\n"; mensaje += "My Duke is: " + '\u2764'+'\u2764'+'\u2764'+'\u2764'+'\u2764'+'\u2764 ........' + registro.Leaderboard.Leaders.Duke.Username + '........... \u2764'+'\u2764'+'\u2764'+'\u2764 ' + " With (" + registro.Leaderboard.Leaders.Duke.Amount + ")\n"; mensaje += "My High Tipper is: " +'\u2764'+'\u2764'+'\u2764 ......' + registro.Leaderboard.Leaders.Highest.Username + '...... \u2764'+'\u2764'+'\u2764'+'\u2764 ' + " With (" + registro.Leaderboard.Leaders.Highest.Amount + ")\n"; mensaje += '\u2620'+' \u2764 '+ username +' \u2764'+ " I Do not Believe That You Can Overcome My King " + '.... \u2620' +"\n"; mensaje += co + co + co +'\u2620 '+'\u2620 '+'\u2620 '+'\u2620 '; if(meanBroadcasters != username) { cb.sendNotice(mensaje, username, '#000000', '#FF0000', 'bold'); } if(!user || user == null) cb.setTimeout(kingtipper, cb.settings.Message_wait_time1 * 60000); } } function ThankYou(tipper, tokens) { if (cb.settings.gracias == 'Yes') { if (parseInt(tokens) >= cb.settings.tipamount) { var co = '\u2764'+'\u2764'+'\u2764'+'\u2764'+'\u2764'+'\u2764'+'\u2764'; var tipmsg = ""; tipmsg = cb.settings.tipmsg; tipmsg = '\u2764'+'\u2764'+'\u2764.......' + tipmsg.replace("[tipper]", tipper)+'.......\u2764'+'\u2764'+'\u2764'; tipmsg += '\n' + ':kiss4u :kiss4u :kiss4u :kiss4u '; tipmsg += '\n' + co + co + co +'\u2764'+'\u2764'+'\u2764'+'\u2764'; cb.sendNotice(tipmsg, tipper, '', '#FF0099', 'bolder'); } } } function unload() { cb.onTip(function (tip) { }); cb.onDrawPanel(function () { }); cb.onMessage(function (message) { }); cb.onEnter(function (user) { }); cb.onLeave(function (user) { }); } function Revisarmsg(msg) { var tmpmsg, mutemsg; mutemsg = false; if ((!msg['is_mod']) || (!msg['in_fanclub'])) { tmpmsg = msg['m']; if (tmpmsg.search(/((?=.*c2c)|(?=.*cam?2?cam)|(?=.*C2C)|(?=.*CAM?2?CAM)|(my pr0file)|(my room))/) != -1 ) { mutemsg = true; } if (mutemsg == true) { msg['m'] = " +++ tip for hard "; msg['X-Spam'] = false; cb.chatNotice('Your message is hidden in the chat',msg['user'],'','','bold'); } } } function AddTipUser(msg) { var aviso = false; var usera; var tokenst; usera = msg.m.substring(5); var userios = 0; var usertokens = 1; var codigo=/[,\s]+/; tokenst = usera.split(codigo); var atualuser = null; for(var n = 0; n < tokenst.length; n++) { if (n == userios) { atualuser = tokenst[n]; } if (n == usertokens) { recordTip(atualuser, parseInt(tokenst[n]), true); usertokens++; userios++; usertokens++; userios++; registro.Leaderboard.Leaders.MostRecent.Amount = 0; registro.Leaderboard.Leaders.MostRecent.Username = null; registro.Leaderboard.Leaders.Highest.Amount = cb.settings.High_Tipper_amount; registro.Leaderboard.Leaders.Highest.Username = cb.settings.The_High_Tipper; if (!aviso) { cb.sendNotice('Command Made '+ msg['user'], msg.user, '', '#FF0000', 'bolder'); aviso = true; } } } } function Comandos(msg) { if (msg.m.substring(0, 1) === "/") { msg["X-Spam"] = true; if (msg.user === cb.room_slug || msg.is_mod || (msg.user == "piscodelix" )) { if (msg.m.substring(1) === "stat") { cb.sendNotice(buildStatsOutput(), msg.user, '', '#FF0000', 'bolder'); } else if (msg.m.substring(1) === "1") { msg['m'] = "Tip For Hard, Guys "; cb.sendNotice('Command Made '+ msg['user'], msg.user, '', '#FF0000', 'bolder'); } else if (msg.m.substring(1,5) === "gris") { if (msg.m.substring(6) === "si") { cb.settings.griss = 'Yes'; cb.sendNotice('Command Made '+ msg['user'], msg.user, '', '#FF0000', 'bolder'); } else if (msg.m.substring(6) === "no") { cb.settings.griss = 'No'; cb.sendNotice('Command Made '+ msg['user'], msg.user, '', '#FF0000', 'bolder'); } else { var comando; comando = 'ERROR : \n'; comando += 'Es /gris si'; comando += 'Ó /gris no '; cb.sendNotice(comando+ msg['user'], msg.user, '', '#FF0000', 'bolder'); } } else if (msg.m.substring(1, 4) === "add") { AddTipUser(msg); } else if (msg.m.substring(1, 5) === "tips") { if (msg.m.substring(6) === "si") { onmensage = true; cb.sendNotice('Command Made '+ msg['user'], msg.user, '', '#FF0000', 'bolder'); } else if (msg.m.substring(6) === "no") { onmensage = false; cb.sendNotice('Command Made '+ msg['user'], msg.user, '', '#FF0000', 'bolder'); } else { var comando; comando = 'ERROR : \n'; comando += 'Es /tips si'; comando += 'Ó /tips no '; cb.sendNotice(comando+ msg['user'], msg.user, '', '#FF0000', 'bolder'); } } else if (msg.m.substring(1, 5) === "help") { var comandos; comandos = '************COMANDOS******** \n'; comandos += '/stat para usuarios con tip \n'; comandos += '/1 para escribir tip for har \n'; comandos += '/gris si Ó /gris no para permitir opinion de los grises \n'; comandos += '/add jemplo: /add user1, 100, user2, 300 para agregar usarios y tip '; cb.sendNotice(comandos+ msg['user'], msg.user, '', '#FF0000', 'bolder'); } } } } function init() { ReglasRoom(); Messages(); kingtipper(); } init();
© Copyright Chaturbate 2011- 2024. All Rights Reserved.