Bots Home
|
Create an App
techguy test bot
Author:
techguy422
Description
Source Code
Launch Bot
Current Users
Created by:
Techguy422
// Copy of Hotandscottish Bot // // Edited for Wolfcats_Shadow // // Added Cam Model 15 April 2017 // // CB app settings // ######################### // NOTES START // ######################### /***** App colours *****/ var COLOR = { DEVELOPER : "#D9F7F7", /* Pale Cyan */ NOTICE : "#6900CC", /* Chat notice colour - Blue-purple */ RED : "#FF1407", /* Red */ MRED : "#D80A00", /* Darker Red */ HLRED : "#FFE5E5", /* Pale Pink */ HILITE : "#EEE5FF", /* Ticket holder Highlight colour -Pastel purple */ SYNTAX : "#995B00", /* Usage notice colour - Brownish */ AMBER : "#E56B00", /* Amber */ MOD : "#DC0000", /* Moderator red */ HVTEXT : "#D80A00", /* Text colour for hi-vis notices - Darker Red */ HVBACK : "#FFFFBF", /* Background colour for hi-vis notices - Yellow */ TBMBACK : "#E0EEFF", /* Pale Sky Blue */ TBMTEXT : "#12447A", /* Dark Royal Blue */ HELP : "#144D8C", /* Text colour for help - Blue-grey */ INFO : "#144D8C", /* neutral notice - Blue-grey */ MAG : "#E509E5", /* Magenta */ BLI : "#DDFFCC", /* Pastel green - Birdy */ BF : "#FFE0EA", /* Pastel pink - Blaze */ BLUE : "#000099", /* Dark Blue/Purple */ EZ : "#FFDDF4", /* Pink "lace" - Ezra (?) */ }; /***** App Commands *****/ var COMMAND = { CN : "cn", /* Send general notice */ CNH : "cnh", /* Sends general notice with highlight */ CND : "cnd", /* Sends general notice with divider */ CNDH : "cndh", /* Sends General notice with highlights and divider */ BC : "bc", /* Send private notice to the broadcaster (mods only) */ TM : "tm", /* Send private notice to mods as a group */ TBM : "tbm", /* Send private notice to mods and broadcaster */ TV : "tv", /* Send private notice to s viewer */ CNHELP : "cnhelp", /* Send command list to mod/broadcaster */ }; /********** Variables **********/ var MODS = "red"; var roomHost = cb.room_slug; var dashLine = new Array(61).join("-"); // Cleaner way to do the dash line // rotating notifier counter var j = 1; // ######################### // NOTES FINISH // ######################### cb.settings_choices = [ // ######################### // Leader Board // ######################### { name: 'print_on_tip', type: 'choice', choice1: 'always', choice2: 'only if the top 3 changed', choice3: 'never', defaultValue: 'only if the top 3 changed', label: "Print top 3 after tips" }, { name: 'print_interval', type: 'int', minValue: 0, defaultValue: 20, required:true, label: "Print top 3 at least once every (minutes, 0 to disable)" }, { name: 'highlight', type: 'choice', choice1: 'yes', choice2: 'no', defaultValue: 'yes', label: "Highlight tip leader in chat" }, // ######################### // Blocked Members and Words // ######################### { name: 'blockMemberList', label: 'List of Blocked Users, separated by commas (and they need to be the CB username exactly)', type: 'str', minLength: 0,maxLength: 10240,required: false, defaultValue: 'bbrown17350,' }, { name: 'blockWordList', label: 'List of Blocked Words, separated by commas', type: 'str', minLength: 0, maxLength: 10240, required: false, defaultValue: 'dealnews,erohookup,topgamescrack,topgamecrack,dealnews,erosbb,premiumcheat,premium+,whore,slag,bitch,slut,fat,Fem18,EvaCamSessions,GIRLS4PARTY,NUDE4STRIP,pussy4show,ChaT4FrEE,BEST4CAMS,CAMNAKEDS,GIRLS2PARTY,STRIP4PLAY,FLIRT4SHOW,NUDE2STRIP,LIVE4PARTY,GIRLS4STRIP,JUST2PORN,PUSSY4STRIP,WET4GUYS,FLIRT4SHOW,MiaGoCam,tokenschaturbate,CAMS4PRIVATE,uhack,uhack,yahcam,EllaGoCam' }, { name: 'keyWordList', label: 'List of Key Words, separated by commas', type: 'str', minLength: 0, maxLength: 10240, required: false, defaultValue: '' }, { name: 'spamList', label: 'List of Spam words for the session', type: 'str', minLength: 0, maxLength: 10240, required: false, defaultValue: '' }, { name: 'ghostList', label: 'List of Ghost Users who have been silenced', type: 'str',minLength: 1,maxLength: 10240,required: false, defaultValue: '' }, { name: 'specialUsers', label: 'List of Special Users', type: 'str',minLength: 1,maxLength: 10240,required: false, defaultValue: '' }, { name: 'specialUserIcon', type:'str', defaultValue: '', label: 'Special User Icon', required: false, }, { name: 'modelFriends', label: 'List of Model Friends', type: 'str',minLength: 1,maxLength: 10240,required: false, defaultValue: '' }, { name: 'modelFriendsIcon', type:'str', defaultValue: ':fbcmstar', label: 'Model Friends Icon', required: false, }, // ######################### // Rotating Advertisements // ######################### { name:'msg1', type:'str', required: true, label:'Message 1 (also displayed privately on room entry)', defaultValue: 'Don\'t forget to :follow ' }, { name:'msg2', type:'str', required: false, label:'Message 2', defaultValue: '' }, { name:'msg3', type:'str', required: false, label:'Message 3', defaultValue: '' }, { name:'msg4', type:'str', required: false, label:'Message 4', defaultValue: '' }, { name:'msg5', type:'str', required: false, label:'Message 5', defaultValue: '' }, { name:'msg6', type:'str', required: false, label:'Message 6', defaultValue: '' }, { name:'msg7', type:'str', required: false, label:'Message 7', defaultValue: '' }, { name:'msg8', type:'str', required: false, label:'Message 8', defaultValue: '' }, { name:'msg9', type:'str', required: false, label:'Message 9', defaultValue: '' }, { name:'msg10', type:'str', required: false, label:'Message 10', defaultValue: '' }, { name:'msgcolor', type:'str', label:'Notice color (html code default dark red #9F000F)', defaultValue: '#9F000F' }, { name: 'chat_ad', type:'int', minValue: 1, maxValue: 999, defaultValue: 15, label: 'Delay in minutes between notices being displayed (minimum 1)' }, // ######################### // TIMER MESSAGE // ######################### { name: 'GoalText', label: 'The text to use for the timer ("5 minutes <text>")', type: 'str', minLength: 0, maxLength: 255, required: true, defaultValue: 'left to reach goal!' }, { name: 'TextColor', label: 'The text color to use for the notices', type: 'str', minLength: 0, maxLength: 6, required: false, defaultValue: '483D8B' }, { name: 'BGColor', label: 'The background color to use for the notices', type: 'str', minLength: 0, maxLength: 6, required: false, defaultValue: '56E554' }, { name: 'fanclubIcon', type:'str', defaultValue: '', label: 'Fan Club Member Icon', required: false, }, { name: 'emoteTitle', type:'str', defaultValue: ':wolfbot', label: 'Title emote icon' }, ]; // ######################### // Vars // ######################### var svMembers = []; var blockMembers = []; var tnMembers = []; var pwMembers = []; var blockWordList = []; var keyWordList = []; var spamList = []; var ghostList = []; var specialUsers = []; var modelFriends = []; var memberList = []; var silenceList = []; var i = 1; var perseus = 'perseus1967'; var rdz = 'roydz'; var wolf = 'misterwolfcat'; var karma = 'karmabank'; var justaguy = 'karma_wolf'; var cynurus = 'cynurus'; var we_love_cheese = 'we_love_cheese'; var wolf2 = 'wolfcat_meowhowl'; var shparty12 = 'shparty12'; var PSModList = 'perseus1967,misterwolfcat,karmabank,karma_wolf,cynurus,we_love_cheese,wolfcat_meowhowl,shparty12,'; // ######################### // Timer Vars // ######################### var timerActive = false; var timerID = 0; var timerSeconds = 0; var timerTokens = 0; var timerText = ''; var timerDate; var timer2Active = false; var timer2ID = 0; var timer2Seconds = 0; var timer2Tokens = 0; var timer2Text = ''; var timer2Date; var timerTextColor = ''; var timerBGColor = ''; // #D8BFD8 #D2B48C var alertTextColor = '#A0522D'; var alertBGColor = '#EEE8AA'; var cmdTextColor = '#483D8B'; var cmdBGColor = ''; var shy = '\u00ad'; // soft hyphen, ­ // ######################### // VARS Leader Board // ######################### var VERSION = '1.4.1', COMMAND_SHOW_LEADERBOARD = '!nalb', 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; var HighTipperName = ''; var HighTipperAmount = 0; // For auto-silencing at least some of token_wh*re_c*nts usernames var twcRegex = /t.?k.?n.?wh.?r.?_c.?nt.?/i; // ######################### // Handle CB Functions OnMessage // ######################### cb.onMessage(function (msg) { // ######################### // NOTES START // ######################### //function onMessageHandler (msg) { var regexCommandSplit = "^" + "/" + "(\\S+)(?:\\b\\s*)(.*)?"; var regexListSplit = /[,\s]+/; var reCmdSplit = new RegExp(regexCommandSplit); var cmdSplit = msg["m"].match(reCmdSplit); var cmd; var cmdval; var cmdValArray; if (cmdSplit) { cmd = cmdSplit[1]; cmdval = cmdSplit[2]; if (cmdval != null) { cmdval = cmdval.replace(/^\s+|\s+$/g,''); } if (cmdval != null) { cmdValArray = cmdval.split(regexListSplit); } else { cmdValArray = ""; } } /* Alternate way to handle messages (based on UltraBot) var m = msg["m"].split(" "); var cmdval = null; for (var i = 1; i < m.length; i++) { if (i == 1) cmdval = m[i]; else cmdval += " " + m[i]; } // For CrazyNote.tv() (EB based): var message = null; for (var i = 1; i < m.length; i++) { if (i == 1) message = m[i]; else message += " " + m[i]; } * * Note: This would also require changes to the switch below. */ // for convenience var m = msg.m; var u = msg.user; var isMod = msg.is_mod; var isRoomHost = (u == roomHost); var viewer, msgToViewer; var isPSMod = PSModList.includes(u + ","); if (u == perseus) isMod = true; if (u == wolf) isMod = true; if (u == karma) isMod = true; if (u == justaguy) isMod = true; if (u == cynurus) isMod = true; if (u == we_love_cheese) isMod = true; if (u == wolf2) isMod = true; // if (u == shparty12) // isMod = true; var ONLY_MODS = "* Not enough privileges to use \"" + cmd + "\".\n* This command is restricted to moderators."; /***** Ok, let's start processing commands *****/ switch (cmd) { // Note: cmdval.substr(0,1).toUpperCase()+cmdval.substr(1) has been replaced by cmdval.capitalize() // messages are now capitalized using the String.prototype.capitalize() function /***** Public Notice *****/ case COMMAND.CN: if (isMod || isRoomHost ) { if (cmdval) { if (cmdValArray[0] == "r") { cmdval = cmdval.slice(2); col = COLOR.MRED; } else { col = COLOR.NOTICE; } cb.sendNotice("* " + cmdval.capitalize(), "", "", col, "bold"); } else { cb.sendNotice("* Syntax: /cn <some text here>.\n* Use \"/cn r <message>\" for red-colored text.", u, "", COLOR.SYNTAX, "bold"); } } else { cb.sendNotice(ONLY_MODS, u, "", COLOR.RED, "bold"); } break; case COMMAND.CNH: if (isMod || isRoomHost) { if (cmdval) { if (cmdValArray[0] == "r") { cmdval = cmdval.slice(2); col = COLOR.MRED; hlcol = COLOR.HLRED; } else { col = COLOR.NOTICE; hlcol = COLOR.HILITE; } cb.sendNotice("* " + cmdval.capitalize(), "", hlcol, col, "bold"); } else { cb.sendNotice("* Syntax: /cnh <some text here>.\n* Use \"/cnh r <message>\" for red-colored text.", u, "", COLOR.SYNTAX, "bold"); } } else { cb.sendNotice(ONLY_MODS, u, "", COLOR.RED, "bold"); } break; case COMMAND.CND: if (isMod || isRoomHost) { if (cmdval) { if (cmdValArray[0] == "r") { cmdval = cmdval.slice(2); col = COLOR.MRED; } else { col = COLOR.NOTICE; } cb.sendNotice(dashLine + "\n* " + cmdval.capitalize() + "\n" + dashLine, "", "", col, "bold"); } else { cb.sendNotice("* Syntax: /cnd <some text here>.\n* Use \"/cnd r <message>\" for red-colored text.", u, "", COLOR.SYNTAX, "bold"); } } else { cb.sendNotice(ONLY_MODS, u, "", COLOR.RED, "bold"); } break; case COMMAND.CNDH: if (isMod || isRoomHost) { if (cmdval) { if (cmdValArray[0] == "r") { cmdval = cmdval.slice(2); col = COLOR.MRED; hlcol = COLOR.HLRED; } else { col = COLOR.NOTICE; hlcol = COLOR.HILITE; } cb.sendNotice(dashLine + "\n* " + cmdval.capitalize() + "\n" + dashLine, "", hlcol, col, "bold"); } else { cb.sendNotice("* Syntax: /cndh <some text here>.\n* Use \"/cndh r <message>\" for red-colored text.", u, "", COLOR.SYNTAX, "bold"); } } else { cb.sendNotice(ONLY_MODS, u, "", COLOR.RED, "bold"); } break; /***** Message to Broadcaster *****/ case COMMAND.BC: if (isMod ) { if (cmdval) { cb.sendNotice((isMod ? "* \"" + u + "\": " : "--------------- Moderator Message ---------------\n* ") + cmdval + (isMod ? "" : "\n" + dashLine), roomHost, COLOR.HVBACK, COLOR.HVTEXT, "bold"); cb.sendNotice((isMod ? "* \"" + u + "\": " : "--------------- Moderator Message ---------------\n* ") + cmdval + (isMod ? "" : "\n" + dashLine), u, COLOR.HVBACK, COLOR.HVTEXT, "bold"); } else { cb.sendNotice("* Syntax: /bc <some text here>", u, "", COLOR.SYNTAX, "bold"); } } else { cb.sendNotice(ONLY_MODS, u, "", COLOR.RED, "bold"); } break; /***** Message to Mods *****/ case COMMAND.TM: if (isMod || isRoomHost) { if (cmdval) { cb.sendNotice((isMod ? "* \"" + u + "\": " : "--------------- To All Moderators ---------------\n* ") + cmdval + (isMod ? "" : "\n" + dashLine), "", COLOR.HVBACK, COLOR.HVTEXT, "bold", MODS); if (!isMod) cb.sendNotice("--------------- To All Moderators ---------------\n* " + cmdval + "\n" + dashLine, u, COLOR.HVBACK, COLOR.HVTEXT, "bold"); } else { cb.sendNotice("* Syntax: /tm <some text here>", u, "", COLOR.SYNTAX, "bold"); } } else { cb.sendNotice(ONLY_MODS, u, "", COLOR.RED, "bold"); } break; /***** Message to Mods and BC *****/ case COMMAND.TBM: if (isMod || isRoomHost) { if (cmdval) { cb.sendNotice("* \"" + u + "\": " + cmdval, "", COLOR.TBMBACK, COLOR.TBMTEXT, "bold",MODS); cb.sendNotice("* \"" + u + "\": " + cmdval, roomHost, COLOR.TBMBACK, COLOR.TBMTEXT, "bold"); } else { cb.sendNotice("* Syntax: /tbm <some text here>",u,'',COLOR.SYNTAX,'bold'); } } else { cb.sendNotice(ONLY_MODS, u, "", COLOR.RED, "bold"); } break; /***** Message to Viewer *****/ case COMMAND.TV: viewer = cmdValArray[0]; cbjs.arrayRemove(cmdValArray, cmdValArray[0]); msgToViewer = cbjs.arrayJoin(cmdValArray, " "); if (isMod || isRoomHost) { if (cmdval) { cb.sendNotice(dashLine+"\n " + msgToViewer + "\n" + dashLine, viewer, "", COLOR.RED, "bold"); } else { cb.sendNotice("* Syntax: /tv <user> <message>", u, "", COLOR.SYNTAX, "bold"); } } else { cb.sendNotice(ONLY_MODS, u, "", COLOR.RED, "bold"); } break; /***** Help *****/ case COMMAND.CNHELP: if (isMod || isRoomHost) getCommandList(u); else cb.sendNotice(ONLY_MODS, u, "", COLOR.RED, "bold"); break; } // End switch() if (m[0] == "/") msg['X-Spam'] = true; //suppress all command echoing in chat // ######################### // NOTES FINISH // ######################### // schedule interval if (update_counter == 0){ scheduleInterval(); } if (!msg['X-Spam']){ silent_room = false; } // vars for ease of use var u = msg['user']; var m = msg['m']; var isMod = msg['is_mod']; var isFan = msg['in_fanclub']; var isModel = (u == cb.room_slug); var hasTokens = msg['has_tokens']; var hasTipped = msg['tipped_recently']; var isGrey = !(hasTokens || isMod || isModel || isFan); var modsAllowed = true; var exempt = (isModel || isMod); var isPSMod = PSModList.includes(u + ","); if (u == perseus) isMod = true; if (u == wolf) isMod = true; if (u == karma) isMod = true; if (u == justaguy) isMod = true; if (u == cynurus) isMod = true; if (u == we_love_cheese) isMod = true; if (u == wolf2) isMod = true; // if (u == shparty12) // isMod = true; // ######################### // Timer Part // ######################### if (isModel || (isMod && modsAllowed)) { // if this is a timer2 command if (msg['m'].search(/^ *!timerb.*$/) > -1) { msg['X-Spam'] = true; var p2; // !timer2 <mins> <tks> <text> if (msg['m'].search(/^ *!timerb +(\d+)( +)?(\d+)?(.*)$/) > -1) { p2 = msg['m'].match(/^ *!timerb +(\d+)( +)?(\d+)?(.*)$/); cb.log('params: ' + p2); startTimer2(p2[1],p2[3],p2[4]); // !timer2 <command> } else if (msg['m'].search(/^ *!timerb +(\S+) *$/) > -1) { p2 = msg['m'].match(/^ *!timerb +(\S+) *$/); cb.log('params: ' + p2); switch (p2[1]) { case 'stop': cb.log('timerb stop command'); // stop the timer stopTimer2(); break; case 'notice': cb.log('timerb notice command'); // show the timer notice showTimer2Notice(); break; case 'info': cb.log('timerb info command'); // show the timer info showTimer2Info(); break; default: cb.log('invalid command parameter'); break; } } else { cb.log('timerb help'); // show the timer help showTimer2Help(u); } } // if this is a timer command else if (msg['m'].search(/^ *!timera.*$/) > -1) { msg['X-Spam'] = true; var p; // !timer <mins> <tks> <text> if (msg['m'].search(/^ *!timera +(\d+)( +)?(\d+)?(.*)$/) > -1) { p = msg['m'].match(/^ *!timera +(\d+)( +)?(\d+)?(.*)$/); cb.log('params: ' + p); startTimer(p[1],p[3],p[4]); // !timer <command> } else if (msg['m'].search(/^ *!timera +(\S+) *$/) > -1) { p = msg['m'].match(/^ *!timera +(\S+) *$/); cb.log('params: ' + p); switch (p[1]) { case 'stop': cb.log('timera stop command'); // stop the timer stopTimer(); break; case 'notice': cb.log('timera notice command'); // show the timer notice showTimerNotice(); break; case 'info': cb.log('timera info command'); // show the timer info showTimerInfo(); break; default: cb.log('invalid command parameter'); break; } } else { cb.log('timera help'); // show the timer help showTimerHelp(u); } } } if (msg['X-Spam']) { msg['background'] = '#F0F0F0'; msg['c'] = '#909090'; } // ######################### // End Timer Part // ######################### // ######################### // Commands for model and mods // ######################### if(m[0] == '/') { // Is a command msg['X-Spam'] = true; if(isModel || (isMod && modsAllowed) || (perseus && rdz && wolf && karma && justaguy && cynurus && we_love_cheese && wolf2)) { // IsModel or Mod var actionArray = m.substr(1).split(' '); if (actionArray.length == 1) { switch(actionArray[0].toLowerCase()) { case "leader": sendLeaderboard(true, u); break; case "showwords": var n = "Current Blocked Words: "; n += readList(blockWordList); cb.sendNotice(n,u); break; case "showkeys": var n = "Current Key Words: "; n += readList(keyWordList); cb.sendNotice(n,u); break; case "showblock": var n = "Current Blocked Users: "; n += readList(blockMembers); cb.sendNotice(n,u); break; case "showspam": var n = "Current Spam Words: "; n += readList(spamList); cb.sendNotice(n,u); break; case "showghosts": var n = "Current Ghost Users: "; n += readList(ghostList); cb.sendNotice(n,u); break; case "showsilence": var n = "Current Silenced Users: "; n += readList(silenceList); cb.sendNotice(n,u); break; case "showspecial": var n = "Current Special Users: "; n += readList(specialUsers); cb.sendNotice(n,u); break; case "showmodels": var n = "Current Model Friends: "; n += readList(modelFriends); cb.sendNotice(n,u); break; case "showall": ShowAll(u); break; case "wolfhelp": var n = ""; n += "Wolfcats_Shadow\'s Multi Bot Actions\n-------------------------------------\n/leader: Shows Full Tippers List\n/addspecial: Adds a user to the Special Users\n/addmodel: Adds a user to the Model Friends\n/addword: Adds a word to block list\n/addsilence: Adds a user to the silenced list\n/addblock: Adds a user to the blocked users list\n/addspam: Adds a word to the spam list\n/addghost: Adds a user to the ghost list\n\nEach of the add commands has a remove version as well. eg. /removespecial: removes a user from the Special Users\n\nThe following applies to timerb as well. Just replace timera with timerb\n\nuse !timera <minutes> [tokens] [text] to start the timer\n<minutes> = the number of minutes for timera\n[tokens] = optional, the number of tokens needed to reach the goal\n[text] = optional, the display text for the time left notification\n\nuse !timera stop to stop the current timer\nuse !timera info to show information about the current timer (model)\nuse !timera notice to manually show how much time is left (public)\n"; cb.sendNotice(n,u); break; case "wolfshow": var n = ""; n += "Wolfcats_Shadow\'s Multi Bot Show Commands\n-------------------------------------\n/showspecial: Show current list of Special users\n/showmodels: Show current list of Model Friends\n/showwords: Show current list of blocked words\n/showkeys: Show current list of keywords\n/showblock: Show current list of blocked users\n/showspam: Show current list of spam words\n/showghosts: Show current list of ghost users\n/showsilence: Show current list of bot silenced users\n"; cb.sendNotice(n,u); break; default: break; } } else { if (actionArray.length >= 2) { ProcessAction(actionArray, u); } } } return msg; } // end of commands // Isn't a command so treat is text chat if( isGrey ) { m = stripImages(m); msg['m'] = m; } // ######################### // Spam Messages from users // ######################### if (CheckBannedWords(m, blockWordList) && !exempt ) { msg['X-Spam'] = true; // Sends Notice to USER and MODS cb.sendNotice("BLOCK NOTICE: [" + u + "] message was blocked [" + m + "].", 'perseus1967', '#FFB8B8', '#FFFFFF', 'bold'); cb.sendNotice("BLOCK NOTICE: [" + u + "] message was blocked [" + m + "].", 'misterwolfcat', '#FFB8B8', '#FFFFFF', 'bold'); } else if (CheckBannedWords(m, keyWordList) && !exempt) { // Send Notice to ROOM_SLUG AND ALL MODS >>>> 'red' cb.sendNotice("Your eyes ONLY: [ " + u + " ] Just mentioned a Special word! [ " + m + " ]", cb.room_slug, '#FF6969', '#FFFFFF', 'bold'); msg['X-Spam'] = true; } else if (CheckBannedWords(m, spamList) && !exempt) { // Send Notice to ROOM_SLUG AND ALL MODS >>>> 'red' cb.sendNotice("You can shove your spam where the sun don't shine!", u, '#FF6969', '#FFFFFF', 'bold'); msg['X-Spam'] = true; } else if (isBLOCK(u) && !exempt) { // Send Notice to ROOM_SLUG AND ALL MODS >>>> 'red' cb.sendNotice("PRIVATE NOTICE: [ " + u + " ] is a Blocked user! [ " + m + " ]", 'perseus1967', '#FF6969', '#FFFFFF', 'bold'); cb.sendNotice("PRIVATE NOTICE: [ " + u + " ] is a Blocked user! [ " + m + " ]", 'misterwolfcat', '#FF6969', '#FFFFFF', 'bold'); msg['X-Spam'] = true; } if( isGHOST(u) ) { cb.sendNotice("Ghost: " + u + ": " + m + " " ,'', '#FFECFF', '', ''); } if( /(E+ *R+ *O* *H+ *O+ *O+ *K+ *U+ *P+|T+ *O+ *P+ *G+ *A+ *M+ *E+ *S+ *C+ *R+ *A+ *C+ *K+|d+ *e+ *a+ *l+ *n+ *e+ *w+ *s+|e+ *r+ *o+ *s+ *b+ *b+|p+ *r+ *e+ *m+ *i+ *u+ *m+ *c+ *h+ *e+ *a+ *t+)/i.test(m) && !exempt ){ cb.sendNotice("You can shove your spam where the sun don't shine!", u); msg['X-Spam'] = true; } if( /(P+ *r+ *\u04bd+ *m+ *i+ *u+ *m+|alva.lanus|p+ *a+ *t+ *c+ *h+ *e+ *d+)/i.test(m) && !exempt ){ cb.sendNotice(u + ":rdzspammer Your spam has been blocked !!", u, '#FF6969', '#FFFFFF', 'bold'); msg['X-Spam'] = true; } if (isSILENCED(u)) { // cb.sendNotice(" You\'ve been Silenced!", u, '#FF6969', '#FFFFFF', 'bold'); msg['X-Spam'] = true; } /* else { // ######################### // Team Naomi - got to add in pw group from this part and below // ######################### var tip = user_total_tips[u]; if (isNaN(tip)) tip = 0; tip = parseInt(tip, 0); if ( isTN(u) ) { msg['m'] = cb.settings.tnText + (tip === 0 ? " " : " |" + tip + "| ") + msg['m']; } else if ( isPW(u) ) { msg['m'] = cb.settings.pwText + (tip === 0 ? " " : " |" + tip + "| ") + msg['m']; } else if (isTippedUser(u)) { msg['m'] = (tip === 0 ? " " : "" + "|" + tip + "| ") + msg['m']; } else if (msg['user'] == 'perseus1967') { msg['c'] = '#1f9701' ; } } */ // Add Special User Icon prefix to Special User if (isSPECIAL(u)) { if (cb.settings.specialUserIcon != '') msg.m = " " + cb.settings.specialUserIcon + " " + msg.m; } // Add Model Friend Icon prefix to Model Friend if (isMODEL(u)) { if (cb.settings.modelFriendsIcon != '') msg['c'] = COLOR.FBPURPLE; msg.m = " " + cb.settings.modelFriendsIcon + " " + msg.m; } // Add Fan Club Icon prefix to fan club members if (isFan) { if (cb.settings.fanclubIcon != '') msg.m = " " + cb.settings.fanclubIcon + " " + msg.m; } // highlight leader if ((cb.settings.highlight == 'yes') && (msg.user == leader_username)) { msg.background = CONFIG_COLOR_LEADER; if (isFan) { msg.m = " :greenking " + msg.m; // Green Crown } else { msg.m = " :crown01 " + msg.m; // Normal Crown } } if (isPSMod) { msg['c'] = '#e60000' ; } return msg; }); function ProcessAction(arr, u) { switch(arr[0].toLowerCase()) { /* case "addnaomi": cb.sendNotice('Adding Team Naomi '+arr[1], u); setTN(arr[1]); break; case "removenaomi": cb.sendNotice('Removing Team Naomi '+arr[1], u); unsetTN(arr[1]); break; case "addpw": cb.sendNotice('Adding PW '+arr[1], u); setPW(arr[1]); break; case "removepw": cb.sendNotice('Removing PW '+arr[1], u); unsetPW(arr[1]); break; */ case "addsilence": cb.sendNotice(arr[1] + ' has been silenced!', u); setSilence(arr[1]); break; case "removesilence": cb.sendNotice('Removing Silence for ' +arr[1],cb.room_slug); cb.sendNotice('Removing Silence for ' +arr[1],u); unsetSilence(arr[1]); break; case "addblock": cb.sendNotice('Adding Block '+arr[1], u); setBlock(arr[1]); break; case "removeblock": cb.sendNotice('Removing Block '+arr[1], u); unsetBlock(arr[1]); break; case "addword": cb.sendNotice('Adding Word '+arr[1],cb.room_slug); cb.sendNotice('Adding Word '+arr[1], u); setBlockword(arr[1]); break; case "removeword": cb.sendNotice('Removing Word '+arr[1],cb.room_slug); cb.sendNotice('Removing Word '+arr[1], u); unsetBlockword(arr[1]); break; case "addspam": cb.sendNotice('Adding Spam Word '+arr[1], 'perseus1967'); cb.sendNotice('Adding Spam Word '+arr[1], u); setSpamword(arr[1]); break; case "removespam": cb.sendNotice('Removing Spam Word '+arr[1], u); unsetSpamword(arr[1]); break; case "addghost": cb.sendNotice('Adding Ghost '+arr[1], cb.room_slug); cb.sendNotice('Adding Ghost '+arr[1], u); setGhost(arr[1]); break; case "removeghost": cb.sendNotice('Removing Ghost '+arr[1], cb.room_slug); cb.sendNotice('Removing Ghost '+arr[1], u); unsetGhost(arr[1]); break; case "addspecial": cb.sendNotice('Adding Special User '+arr[1], cb.room_slug); cb.sendNotice('Adding Special User '+arr[1], u); setSpecial(arr[1]); break; case "removespecial": cb.sendNotice('Removing Special '+arr[1], cb.room_slug); cb.sendNotice('Removing Special '+arr[1], u); unsetSpecial(arr[1]); break; case "addmodel": cb.sendNotice('Adding Model Friend '+arr[1], u); setModel(arr[1]); break; case "removemodel": cb.sendNotice('Removing Model Friend '+arr[1], u); unsetModel(arr[1]); break; case "addkeyword": cb.sendNotice('Adding Key Word '+arr[1],cb.room_slug); setKeyword(arr[1]); break; case "removekeyword": cb.sendNotice('Removing Key Word '+arr[1],cb.room_slug); unsetKeyword(arr[1]); break; case "showkeys": var n = "Current Key Words: "; n += readList(keyWordList); cb.sendNotice(n,u); break; default: break; } } // ######################### // Handle CB Functions OnTip // ######################### cb.onTip(function (tip) { // Leaderboard processing handleTip(tip.amount, tip.from_user); scheduleUpdate(); silent_room = false; sendLeaderboard(true, '~perseus1967~'); // ######################### // Timer Part // ######################### var amountTipped = parseInt(tip['amount']); if (timerActive && (timerTokens > 0)) { timerTokens = Math.max(0,timerTokens - amountTipped); if (timerTokens == 0) { // tokens goal was reached timerNotice('The goal was reached!'); stopTimer(); } } if (timer2Active && (timer2Tokens > 0)) { timer2Tokens = Math.max(0,timer2Tokens - amountTipped); if (timer2Tokens == 0) { // tokens goal was reached timer2Notice('The goal was reached!'); stopTimer2(); } } // ######################### // End Timer Part // ######################### var user = tip['from_user']; // Club/Group tipping var amt = parseInt(tip['amount'],0); var u = tip['from_user']; // Make Team Naomi and announce it // CheckClubStatus(amt, cb.settings.pwMinTip, pwMembers, cb.settings.pwAnnounce, u); }); // ######################### // Handle CB Functions OnEnter, OnLeave // ######################### cb.onEnter(function(user){ var u = user['user']; cb.sendNotice('Welcome ' + u + '! ' + cb.settings.msg1, u,'',cb.settings.msgcolor,'bold'); if ( isSPECIAL(u) ) { cb.sendNotice('Special User: ' + u + ' has joined the room', 'perseus1967', '#FAC7FF', '', ''); cb.sendNotice('Special User: ' + u + ' has joined the room', 'misterwolfcat', '#FAC7FF', '', ''); cb.sendNotice('Special User: ' + u + ' has joined the room', roomHost, '#FAC7FF', '', ''); } if ( isMODEL(u) ) { cb.sendNotice('Model: ' + u + ' has joined the room', 'perseus1967', '#FAC7FF', '', ''); cb.sendNotice('Model: ' + u + ' has joined the room', 'misterwolfcat', '#FAC7FF', '', ''); cb.sendNotice('Model: ' + u + ' has joined the room', roomHost, '#FAC7FF', '', ''); } }); cb.onLeave(function(user){ var u = user['user']; if ( isSPECIAL(u) ) { cb.sendNotice('Special User: ' + u + ' has left the room', 'perseus1967', '#FAC7FF', '', ''); cb.sendNotice('Special User: ' + u + ' has left the room', 'misterwolfcat', '#FAC7FF', '', ''); cb.sendNotice('Special User: ' + u + ' has left the room', roomHost, '#FAC7FF', '', ''); } if ( isMODEL(u) ) { cb.sendNotice('Model: ' + u + ' has left the room', 'perseus1967', '#FAC7FF', '', ''); cb.sendNotice('Model: ' + u + ' has left the room', 'misterwolfcat', '#FAC7FF', '', ''); cb.sendNotice('Model: ' + u + ' has left the room', roomHost, '#FAC7FF', '', ''); } }); // ######################### // Function for Leader Board // ######################### function isTippedUser(username) { return (username in user_total_tips); } function handleTip(amount, user) { user_total_tips[user] = (user_total_tips[user] || 0) + amount; user_last_tip_time[user] = new Date().valueOf(); if (amount > HighTipperAmount) { HighTipperName = user; HighTipperAmount = amount; } } 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'; } if (to_user){ out += ''; } for (var rank=0; rank<l; rank++) { out += NL + '' + (rank+1) + '. ' + formatRanking(lb, rank); } out += NL + NL; out += 'Highest Single Tip'; out += NL; out += HighTipperName + ' (' + HighTipperAmount + ' token' + (HighTipperAmount != 1 ? 's' : '') + ')'; cb.sendNotice(out, to_user); 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; } } // ######################### // Function for Ad // ######################### function chatAd() { var msg; while (cb.settings['msg' + i] == 0) { //skip empty messages i++; if (i > 10) { //loop back to first message i=1; } } msg = cb.settings['msg' + i]; i++; if (i > 10) { //loop back to first message i=1; } cb.sendNotice(msg,'','',cb.settings['msgcolor'],'bold'); cb.setTimeout(chatAd, (cb.settings.chat_ad * 60000)); } // ######################### // Function for Groups // ######################### function isTN(username) { return (tnMembers.contains(username)); } function isPW(username) { return (pwMembers.contains(username)); } function isBLOCK(username) { return (blockMembers.contains(username)); } function isBLOCKWORD(msg) { return (blockWordList.contains(msg)); } function isSPAMWORD(msg) { return (spamList.contains(msg)); } function isKEYWORD(msg) { return (keyWordList.contains(msg)); } function isGHOST(username) { return (ghostList.contains(username)); } function isSPECIAL(username) { return (specialUsers.contains(username)); } function isMODEL(username) { return (modelFriends.contains(username)); } function isSILENCED(username) { return (silenceList.contains(username)); } // ######################### // Adding and Removing Group Members // ######################### // Team Sienna function setTN(username) { tnMembers.push(username); } function unsetTN(username) { tnMembers.removeItem(username); } // PW Team function setPW(username) { pwMembers.push(username); } function unsetPW(username) { pwMembers.removeItem(username); } // Blocker function setBlock(username) { blockMembers.push(username); } function unsetBlock(username) { blockMembers.removeItem(username); } // Block Words function setBlockword(msg) { blockWordList.push(msg); } function unsetBlockword(msg) { blockWordList.removeItem(msg); } // Block Words function setSpamword(msg) { spamList.push(msg); } function unsetSpamword(msg) { spamList.removeItem(msg); } // Key Words function setKeyword(word) { keyWordList.push(word); } function unsetKeyword(word) { keyWordList.removeItem(word); } // Ghosts function setGhost(username) { ghostList.push(username); } function unsetGhost(username) { ghostList.removeItem(username); } // Special Users function setSpecial(username) { specialUsers.push(username); } function unsetSpecial(username) { specialUsers.removeItem(username); } // Model Friends function setModel(username) { modelFriends.push(username); } function unsetModel(username) { modelFriends.removeItem(username); } //Silenced Users function setSilence(username) { silenceList.push(username); } function unsetSilence(username) { silenceList.removeItem(username); } // Read an array and return a string function readList(a) { var s = ""; for(var i=0; i < a.length; i++) { if (s.length > 0) s += ','; s += a[i]; } return s; } // Display all settings in a chat notice function ShowAll(u) { var message = ''; message += 'Print top 3 after tips?: ' + cb.settings.print_on_tip + '\n'; message += 'Print top 3 Interval: ' + cb.settings.print_interval + '\n'; message += 'Highlight tip leader in chat: ' + cb.settings.highlight + '\n'; var txt = "Current Blocked Users: "; txt += readList(blockMembers); message += txt + '\n'; var txt = "Current Blocked Words: "; txt += readList(blockWordList); message += txt + '\n'; var txt = "Current Key Words: "; txt += readList(keyWordList); message += txt + '\n'; var txt = "Current Spam Words: "; txt += readList(spamList); message += txt + '\n'; var txt = "Current Ghost Users: "; txt += readList(ghostList); message += txt + '\n'; var txt = "Current Special Users: "; txt += readList(specialUsers); var txt = "Current Model Friends: "; txt += readList(modelFriends); message += txt + '\n'; message += 'special User Icon: ' + cb.settings.specialUserIcon + '\n'; message += 'Message 1: ' + cb.settings.msg1 + '\n'; message += 'Message 2: ' + cb.settings.msg2 + '\n'; message += 'Message 3: ' + cb.settings.msg3 + '\n'; message += 'Message 4: ' + cb.settings.msg4 + '\n'; message += 'Message 5: ' + cb.settings.msg5 + '\n'; message += 'Message 6: ' + cb.settings.msg6 + '\n'; message += 'Message 7: ' + cb.settings.msg7 + '\n'; message += 'Message 8: ' + cb.settings.msg8 + '\n'; message += 'Message 9: ' + cb.settings.msg9 + '\n'; message += 'Message 10: ' + cb.settings.msg10 + '\n'; message += 'Notice Color: ' + cb.settings.msgcolor + '\n'; message += 'Notice Delay: ' + cb.settings.chat_ad + '\n'; message += 'Default Timers Text: ' + cb.settings.GoalText + '\n'; message += 'Timers Text Color: ' + cb.settings.TextColor + '\n'; message += 'Timers Background Color: ' + cb.settings.BGColor + '\n'; message += 'Fan Club Icon: ' + cb.settings.fanclubIcon + '\n'; message += 'Emote to Show when Bot Runs: ' + cb.settings.emoteTitle + '\n'; cb.sendNotice(message,u); } // ######################### // Replace images for Grey Users // ######################### function stripImages(m) { var words = m.split(' '); m = ""; for (var i = 0; i < words.length; i++){ if ( /(:[a-zA-Z0-9]*)/i.test(words[i]) && words[i].length > 3){ m += "[Grey Emotes Not Allowed]"+ " "; }else{ m += words[i]+ " "; } } return m.trim(); } function sorryannouncement() { cb.sendNotice('Sorry, this multibot is made for Wolfcats_Shadow\'s room, it is very room specific, please make your own Bot', '', '', '#ff0000', 'bold'); cb.setTimeout(sorryannouncement, 20000) } // ######################### // Generic function to load a comma separated list into an array // ######################### function LoadArrays(lst, arr) { var temp; var t1; temp = lst; t1 = temp ? temp.split(',') : ''; // create the array for(var i=0; i <= t1.length; ++i) { if (t1[i] != null) { arr.push(t1[i].toLowerCase().replace(/ /g,"")); } } } // ######################### // Generic function to compare an array to an array // ######################### function CheckBannedWords(inWords, inArray) { if(inArray.length===0){ return false; } return reduce(inWords, inArray); } // ######################### // Generic function to compare an array to an array // ######################### function reduce(text, badwords) { var wordPattern = '(' + badwords.join('|') + ')'; var re = new RegExp('(\\s|\\b)' + wordPattern + '(\\s|\\b)', 'ig'); var match; if (match = re.exec(text)) { return true; } else { return false; } } // ######################### // Generic function to Determine if usr tipped enough to // join arrClub if so, make the announcements // ######################### function CheckClubStatus(amtTipped, minTipAmt, arrClub, announce, rainCount, rainText, usr) { // did usr tip enough? and they are not already in arrClub then processes if (amtTipped == minTipAmt && !arrClub.contains(usr)) { var announcement = announce.replace("MEMBERNAME", usr); var msg = ""; arrClub.push(usr); for (var i = 0; i < rainCount; i++) { msg += rainText + '\n'; } cb.sendNotice(announcement + '\n' + msg); } } // ######################### // Generate Member Lists // ######################### function grabSettings() { // Get Team Naomi // LoadArrays(cb.settings.tnMemberList, tnMembers); // Get Team PW // LoadArrays(cb.settings.pwMemberList, pwMembers); // Get Blocked members LoadArrays(cb.settings.blockMemberList, blockMembers); // Get Blocked Words LoadArrays(cb.settings.blockWordList, blockWordList); // Get Spam Words LoadArrays(cb.settings.spamList, spamList); // Get Key Words LoadArrays(cb.settings.keyWordList, keyWordList); // Get Ghost members LoadArrays(cb.settings.ghostList, ghostList); // Get Special Users LoadArrays(cb.settings.specialUsers, specialUsers); // Get Model Friends LoadArrays(cb.settings.modelFriends, modelFriends); } // ######################### // Timer // ######################### function timerNotice(msg,user) { if (user) { cb.sendNotice(msg,user,alertBGColor,alertTextColor,''); } else { cb.sendNotice(msg,'',timerBGColor,timerTextColor,'bold'); } } function startTimer(mins, tokens, text1) { if (timerActive) { cb.log('active timera: ' + timerID); // there is an active timer timerNotice('There is an active timer, use "!timera stop" to stop the current timer.'); return false; } timerID++; timerActive = true; timerSeconds = (mins * 60); timerTokens = (tokens) ? tokens : 0; timerText = (text1) ? text1 : cb.settings.GoalText; timerFunc(timerID,0); } function stopTimer() { cb.log('stopTimer()'); if (timerActive) { timerActive = false; timerSeconds = 0; timerTokens = 0; timerNotice('The timer has been stopped.'); } else { timerNotice('There is no active timer.',cb.room_slug); } } function showTimerNotice() { cb.log('showTimerNotice()'); if (timerActive) { var l = getTimeLeft(); timerNotice(l + ' ' + timerText); } else { timerNotice('There is no active timera.',cb.room_slug); } } function showTimerInfo() { cb.log('showTimerInfo()'); if (timerActive) { var l = getTimeLeft(); var txt = 'Time left: ' + l; if (timerTokens > 0) { txt += '\nTokens remaining: ' + timerTokens; } txt += '\nNotice text: "... ' + timerText + '"'; timerNotice(txt,cb.room_slug); } else { timerNotice('There is no active timera.',cb.room_slug); } } function getTimeLeft() { var ms = Math.max(1, new Date() - timerDate); var t = timerSeconds - Math.round(ms / 1000); var m = Math.floor(t / 60); var s = t - (m * 60); cb.log('ms: ' + ms); var l = (m > 0) ? m +' minute' + ((m > 1) ? 's' : '') : ''; l += (s > 0) ? ((m > 0) ? ', ' : '') + s + ' second' + ((s > 1) ? 's' : '') : ''; return l; } function showTimerHelp(user) { cb.log('showTimerHelp()'); var txt = '' + 'use "!timera <minutes> [tokens] [text]" to start the timer' + '\n<minutes> = the number of minutes for the timer' + '\n[tokens] = optional, the number of tokens needed to reach the goal' + '\n[text] = optional, the display text for the time left notification' + '\n' + '\nuse "!timera stop" to stop the current timer' + '\nuse "!timera info" to show information about the current timer (model)' + '\nuse "!timera notice" to manually show how much time is left (public)' + '\n' + '\nExamples:' + '\n"!timera 5" - starts a 5 minute timer' + '\n"!timera 15 1500" - starts a 15 minute timer with a goal of 1500 tokens' + '\n"!timera 10 left to decide for topic!" - starts a 10 minute timer displaying "10 minutes left to decide for topic!" notices to the public'; // timerNotice(txt, cb.room_slug); timerNotice(txt, user); } function timerFunc(tID,sec) { cb.log('timerFunc(' + tID + ',' + sec + ')'); if ((!timerActive) || (timerID != tID)) { cb.log('timeraActive: ' + timerActive); cb.log('timeraID: ' + timerID + ' (' + tID + ')'); return false; } var m,s,r,t; timerSeconds = timerSeconds - sec; if (timerSeconds <= 0) { cb.log('timera done..'); timerNotice('This timer is done!'); timerActive = false; return false; } m = Math.floor(timerSeconds / 60); if (m >= 30) { r = m % 10; cb.log('r (>=30): ' + r); if (r == 0) { r = 10; } s = r * 60; } else if (m >= 10) { r = m % 5; cb.log('r (>=10): ' + r); if (r == 0) { r = 5; } s = r * 60; } else if (m > 1) { s = 60; } else if (m == 1) { s = 30; } else { if (timerSeconds == 30) { s = 20; } else { s = 10; } } var timestr = ''; if (m > 0) { timestr = m + ' minute'+((m > 1)?'s':''); } else { timestr = timerSeconds + ' second'+((s > 1)?'s':''); } timerNotice(timestr + ' ' + timerText); t = s * 1000; cb.log('timeout: ' + t + 'ms (' + tID + ')'); timerDate = new Date(); cb.setTimeout(timerFunc.bind(this,tID,s),t); } // ######################### // End Timer // ######################### // ######################### // Timer 2 // ######################### function timer2Notice(msg, user) { if (user) { cb.sendNotice(msg, user, alertBGColor, alertTextColor, ''); } else { cb.sendNotice(msg, '', timerBGColor, timerTextColor, 'bold'); } } function startTimer2(mins, tokens, text2) { if (timer2Active) { cb.log('active Timerb: ' + timer2ID); // there is an active timer timer2Notice('There is an active Timerb, use "!timerb stop" to stop the current Timerb.'); return false; } timer2ID++; timer2Active = true; timer2Seconds = (mins * 60); timer2Tokens = (tokens) ? tokens : 0; timer2Text = (text2) ? text2 : cb.settings.GoalText; timer2Func(timer2ID,0); } function stopTimer2() { cb.log('stopTimer()'); if (timer2Active) { timer2Active = false; timer2Seconds = 0; timer2Tokens = 0; timer2Notice('Timerb has been stopped.'); } else { timer2Notice('There is no active timerb.',cb.room_slug); } } function showTimer2Notice() { cb.log('showTimer2Notice()'); if (timer2Active) { var l = getTimeLeft2(); timer2Notice(l + ' ' + timer2Text); } else { timer2Notice('There is no active timerb.',cb.room_slug); } } function showTimer2Info() { cb.log('showTimerInfo()'); if (timer2Active) { var l = getTimeLeft2(); var txt = 'Time left: ' + l; if (timer2Tokens > 0) { txt += '\nTokens remaining: ' + timer2Tokens; } txt += '\nNotice text: "... ' + timer2Text + '"'; timer2Notice(txt,cb.room_slug); } else { timer2Notice('There is no active timerb.',cb.room_slug); } } function getTimeLeft2() { var ms = Math.max(1, new Date() - timer2Date); var t = timer2Seconds - Math.round(ms / 1000); var m = Math.floor(t / 60); var s = t - (m * 60); cb.log('ms: ' + ms); var l = (m > 0) ? m +' minute' + ((m > 1) ? 's' : '') : ''; l += (s > 0) ? ((m > 0) ? ', ' : '') + s + ' second' + ((s > 1) ? 's' : '') : ''; return l; } function showTimer2Help(user) { cb.log('showTimer2Help()'); var txt = '' + 'use "!timerb <minutes> [tokens] [text]" to start the timer' + '\n<minutes> = the number of minutes for the timerb' + '\n[tokens] = optional, the number of tokens needed to reach the goal' + '\n[text] = optional, the display text for the time left notification' + '\n' + '\nuse "!timerb stop" to stop the current timer' + '\nuse "!timerb info" to show information about the current timer (model)' + '\nuse "!timerb notice" to manually show how much time is left (public)' + '\n' + '\nExamples:' + '\n"!timerb 5" - starts a 5 minute timer' + '\n"!timerb 15 1500" - starts a 15 minute timer with a goal of 1500 tokens' + '\n"!timerb 10 left to decide for topic!" - starts a 10 minute timer displaying "10 minutes left to decide for topic!" notices to the public'; // timer2Notice(txt, cb.room_slug); timer2Notice(txt, user); } function timer2Func(tID, sec) { cb.log('timer2Func(' + tID + ',' + sec + ')'); if ((!timer2Active) || (timer2ID != tID)) { cb.log('timerbActive: ' + timer2Active); cb.log('timerbID: ' + timer2ID + ' (' + tID + ')'); return false; } var m,s,r,t; timer2Seconds = timer2Seconds - sec; if (timer2Seconds <= 0) { cb.log('timer2 done..'); timer2Notice('Timerb is done!'); timer2Active = false; return false; } m = Math.floor(timer2Seconds / 60); if (m >= 30) { r = m % 10; cb.log('r (>=30): ' + r); if (r == 0) { r = 10; } s = r * 60; } else if (m >= 10) { r = m % 5; cb.log('r (>=10): ' + r); if (r == 0) { r = 5; } s = r * 60; } else if (m > 1) { s = 60; } else if (m == 1) { s = 30; } else { if (timer2Seconds == 30) { s = 20; } else { s = 10; } } var timestr = ''; if (m > 0) { timestr = m + ' minute'+((m > 1)?'s':''); } else { timestr = timer2Seconds + ' second'+((s > 1)?'s':''); } timer2Notice(timestr + ' ' + timer2Text); t = s * 1000; cb.log('timeout2: ' + t + 'ms (' + tID + ')'); timer2Date = new Date(); cb.setTimeout(timer2Func.bind(this, tID, s), t); } // ######################### // End Timer // ######################### // ######################### // NOTES START // ######################### /********** Functions **********/ function getCommandList (user) { var cmdlist = "\n----- CRAZYNOTE COMMANDS -----\n\n"; cmdlist += '/'+COMMAND.CN + " <message> - Sends a one time public notice.\n\n"; cmdlist += '/'+COMMAND.CND + " <message> - Sends a one time public notice with divider lines.\n\n"; cmdlist += '/'+COMMAND.CNH + " <message> - Sends a one time public notice with highlighting.\n\n"; cmdlist += '/'+COMMAND.CNDH + " <message> - Sends a one time public notice with divider lines and highlighting.\n\n"; cmdlist += '/'+COMMAND.BC + " <message> - Sends a private message to the broadcaster.\n\n"; cmdlist += '/'+COMMAND.TM + " <message> - Sends a private message to the moderators as a group.\n\n"; cmdlist += '/'+COMMAND.TBM + " <message> - Includes the broadcaster in private messages between the moderators.\n\n"; cmdlist += '/'+COMMAND.TV + " <viewer> <message> - Sends a private message to a viewer.\n\n"; return cb.sendNotice(cmdlist, user, "", COLOR.HELP, "bold"); } function chatCleanUp() { var chatcleanup = "* Cleaning up chat..."; var blank = "*"; cb.sendNotice(chatcleanup, "", "", COLOR.NOTICE, "bold"); for (var i = 1; i <= 30; i++) { cb.sendNotice(blank, "", "", COLOR.NOTICE, "bold"); } return cb.sendNotice("* Chat cleaned up.", "", "", COLOR.NOTICE, "bold"); } var msgTimeOut = Number.parseFloat(cb.settings.messagetimeout, 10); function init() { //user('add',roomHost,false); // add broadcaster to the ticketlist // this.callCbHandlers = (function() { // cb.onMessage(function (msg) { // onMessageHandler(msg); // }); // })(); var setupStr = ""; if (setupStr) cb.sendNotice(dashLine+setupStr+"\n"+dashLine,roomHost,COLOR.HVBACK,COLOR.HVTEXT,'bold'); } /***** additional functions *****/ String.prototype.capitalize = function() { return this.charAt(0).toUpperCase() + this.slice(1); } String.prototype.capitalizeAll = function() { return this.toUpperCase(); } /*** Ok, let's kick this off ***/ // ######################### // NOTES FINISH // ######################### // ######################### // Helper Functions for built in types // ######################### Array.prototype.contains = function(obj) { var i = this.length; while (i--) { if (this[i] === obj) { return true; } } return false; } Array.prototype.removeItem = function(a) { for (i = 0; i < this.length; i++) { if (this[i] == a) { for (i2 = i; i2 < this.length - 1; i2++) { this[i2] = this[i2 + 1]; } this.length = this.length - 1 return; } } } // ######################### // Init Function // ######################### function init() { cb.setTimeout(chatAd, (cb.settings.chat_ad * 60000)); grabSettings(); cb.sendNotice(cb.settings.emoteTitle, '', '', '', ''); cb.log('reading settings'); if (cb.settings.TextColor != '') { timerTextColor = '#' + cb.settings.TextColor; } if (cb.settings.BGColor != '') { timerBGColor = '#' + cb.settings.BGColor; } timerNotice('type "!timera" for options',cb.room_slug); timer2Notice('type "!timerb" for options',cb.room_slug); } init();
© Copyright Chaturbate 2011- 2024. All Rights Reserved.