Bots Home
|
Create an App
dcinnewzealands test bot
Author:
dcinnewzealand
Description
Source Code
Launch Bot
Current Users
Created by:
Dcinnewzealand
/************************************************************* ** ** Title: Mary\'s Smurf village ** Author: dcinnewzealand contact - delia.chatrubate.ru@gmail.com ** Version: 1.0.0 October 30, 2016 ** First Version: October 1, 2016 ** Description: Room bot for Smurf19 - Check her out @Instagram bellerinaggg ** *************************************************************/ /* Features: Spam filter based on username patterns - adds user to filter list upon entering the room if in pattern list (^^ awesome for stopping spam "bots" that use naming patterns to create new accounts after being silenced) Tip menu village members can use color and view level commands model and mods can paint users with colors allow mods/broadcaster to change foreground and background colors can use color names or hashcodes Keeps track of all tips Show tip scoreboard (all tips) Announce top X tippers (public) Send tippers lists to self (private) Manage users in village Allow Mods to use commands Special user greetings Greetings for village members Gender Emotes (male, female, couple, trans) or custom icon for special users User Jail (forever or specified time) Emote blocker for grey users Select background colors for village users Thank you note for tippers, custom message for certain tip amounts Automatically add user to village for specific tip amounts and send reminder to model to add them in config Flood control to stop timeout users from flooding the room with notices 2 custom notifications with selectable time delay Send public room notice Send notice to all mods Send private notice to broadcaster If used by another model sends exclusive notice to them at startup, also tells each user as they enter. Ghost function lets silenced or banned users type through chat notices */ /* * Setup vars */ var botVersion = "1.0.0"; var botDate = "October 1 2016"; var lastMessgeTime = 0; var lastMessageName = ""; var tippers = new Array(); var timeoutMessages = new Array(); var timeoutUsersArray = new Array(); var timeoutReleaseArray = new Array(); var smurfetteUsersArray = new Array(); var smurfsUsersArray = new Array(); var smurfUsersArray = new Array(); var friendsUsersArray = new Array(); var legendUsersArray = new Array(); var ghostUsersArray = new Array(); var spamPatternArray = new Array(); var spamUsersArray = new Array(); var userColors = new Array(); var specialNames = new Array(); var tempString = ""; var tempNum = 0; var tempArray = new Array(); var modelName = cb.room_slug; var msgNotify = ""; var msgPublic = ""; var msgPrivate = ""; var msgModel = ""; var msgMod = ""; var groupColor = "#FFFFFF"; var autoNotice1Text = ""; var autoNotice2Text = ""; var autoNotice3Text = ""; var autoNotice4Text = ""; var autoNotice5Text = ""; var autoNotice6Text = ""; var autoNotice7Text = ""; var autoNotice8Text = ""; var autoNotice9Text = ""; var autoNotice10Text = ""; var autoNotice11Text = ""; var autoNotice12Text = ""; var autoNotice13Text = ""; var autoNotice14Text = ""; var autoNotice15Text = ""; var botTrigger = "/village"; var botTrigger2 = "/bot"; var timeoutReleaseInterval = 1; var modCommands = true; var userGreets = true; var genderEmotes = true; var allowGreyEmotes = true; var unmaskTimeout = false; var locked = false; var botMsgBg = '#43A8FF'; var botAlertBg = '#43A8FF'; var botNoteBg = '#43A8FF'; var botAlert2Bg = '#43A8FF'; var botGhostBg = '#43A8FF'; var tipMenu = "Tip Menu\n" + "25...... PM (Private Message)\n" + "35...... Mary\'s been a Bad Bitch!!! Spank that Ass!!! (Spank)\n" + "50...... Show your Feet!!! (Feet)\n" + "100...... Request for Doggystyle view, Boobs, Finger in Pussy, or Finger in Ass? (write the choice in the tip note)\n" + "150...... Suck Toy (Blowjob)\n" + "1000...... Dildo inside Pussy (Dildo Sex)\n" var helpMsg = " may use the following commands:\n" + botTrigger + " spamhelp = show spam filter help\n" + botTrigger + " view [smurfs] = list of village users\n" + botTrigger + " useradd [smurfs] [username] = add username to village\n" + botTrigger + " userdel [smurfs] [username] = delete username from village\n" + botTrigger + " check [username] = show what village a user is in\n" + botTrigger + " mods [on/off] = turns on/off mod commands\n" + botTrigger + " greyemotes [on/off] = turns on/off grey emotes\n" + botTrigger + " tag [tag text] = set your own tag\n" + botTrigger + " settag [username] [tag text] = set a user\'s tag\n" + botTrigger + " note [message] = send a public message to chat\n" + botTrigger + " Marynote [message] = send a private message to mary\n" + botTrigger + " modpm [message] = send a private message to mods\n" + botTrigger + " greets [on/off] = turns on/off village user greetings\n" + botTrigger + " tips = show all tippers (private)\n" + botTrigger + " tips # = show top # tippers (private)\n" + botTrigger + " paint [username] [text] [bg] = change a user\'s colors\n" + botTrigger + " colors [text] [bg] = change text and bg color\n" + botTrigger + " colors rest = reset colors to b/w\n" + botTrigger + " text [color] = change text color\n" + botTrigger + " bg [color] = change background color\n" + botTrigger + " status = show bot status\n" + "*** NOTE: To make names stick add them in the bot config."; var spamMsg = " Spam Filter Help\n" + "You may add usernames, partial username, or patterns found in usersname to the filter.\n" + "When users enter their names are check against the filter. If a match is found they are automatically " + "added to the Spammer list and their messages will be blocked.\n" + botTrigger + " add pattern [pattern/name] = add a pattern/name to filter\n" + botTrigger + " del pattern [pattern/name] = delete a pattern/name from filter\n" + botTrigger + " add spammer [username] = add user to the Spammer list\n" + botTrigger + " del spammer [username] = delete user from the Spammer list\n"; specialNames[0] = new Array('dcinnewzealand','smurf19'); timeoutMessages[1]= '[JAIL] You\'re in timeout, other\'s can\'t see what you\'re typing.'; timeoutMessages[2]= '[JAIL] Give it up no one can read what you\'re typing...'; timeoutMessages[3]= '[JAIL] Keep typing no one can read it!'; timeoutMessages[4]= '[JAIL] Why do you keeping typing? No one can see it!'; timeoutMessages[5]= '[JAIL] Can\'t you read? You\'re in timeout, you can\'t type!'; timeoutMessages[6]= '[JAIL] I can\'t type cuz I laba too much!'; timeoutMessages[7]= '[JAIL] I\'m typing something really stupid right now too bad no one can read it!'; timeoutMessages[8]= '[JAIL] I\'m such an idiot! Why do I keep typing?'; timeoutMessages[9]= '[JAIL] Why do my fingers smell like tuna fish and peanut butter?'; timeoutMessages[10]= '[JAIL] Pardon me, have you seen my pula?'; timeoutMessages[11]= '[JAIL] A baby goat is like a mushroom. I swear if you kill that duck I\'m scared of toasters.'; timeoutMessages[12]= '[JAIL] Don\'t tell anyone, but I still wet the bed.'; timeoutMessages[13]= '[JAIL] We are all born ignorant, but I work really hard at being stupid.'; timeoutMessages[14]= '[JAIL] Giant rainbows only like it when you whisper.'; timeoutMessages[15]= '[JAIL] Like OMG Eye am sofa king stew pid.'; timeoutMessages[16]= '[JAIL] Has anyone seen Mike Hunt in here?'; timeoutMessages[17]= '[JAIL] My doctor says I spank the monkey too much. I told him I don\'t own a monkey.'; timeoutMessages[18]= '[JAIL] Right now, I\'m like a happy meal without the happy.'; timeoutMessages[19]= '[JAIL] Swiper No Swiping!!!'; timeoutMessages[20]= '[JAIL] I saw a mushroom taco talking to a pineapple kissing a llama.'; timeoutMessages[21]= '[JAIL] I planted bird seed and water them everyday, but no birds are growing in my garden.'; timeoutMessages[22]= '[JAIL] My pula is all sticky.'; timeoutMessages[23]= '[JAIL] Llamas eat sexy paper clips. Just saying.'; timeoutMessages[24]= '[JAIL] I saw a magical orange unicorn dancing on a rainbow with a spoonful of blue cheese dressing.'; timeoutMessages[25]= '[JAIL] On a scale of 1 to 10 my favorite color is W.'; timeoutMessages[26]= '[JAIL] Communist vaginas eat ponies on purple.'; timeoutMessages[27]= '[JAIL] I\'m special. I poop butterflies.'; timeoutMessages[28]= '[JAIL] Sometimes I believe in trees then I hear the unicorns talking.'; timeoutMessages[29]= '[JAIL] I shave my pubic hair with a cheese grater.'; timeoutMessages[30]= '[JAIL] My squid at my chinese food.'; timeoutMessages[31]= '[JAIL] There\'s a purple mushroom in my backyard screaming at a taco.'; timeoutMessages[32]= '[JAIL] Friendly insects eat pink pineapples while looking at your mom.'; timeoutMessages[33]= '[JAIL] I see dead people.'; timeoutMessages[34]= '[JAIL] Don\'t tell anyone, but I\'m dead.'; timeoutMessages[35]= '[JAIL] A fuzzy snake at the clouds.'; timeoutMessages[36]= '[JAIL] A hairy window broke a silly pineapple with a blue sink.'; timeoutMessages[37]= '[JAIL] I like pie.'; timeoutMessages[38]= '[JAIL] Bananas! Bananas! Bananas!'; timeoutMessages[39]= '[JAIL] Don\'t touch my crayons!'; timeoutMessages[40]= '[JAIL] Did you ever notice pineapples don\'t wear bathrobes?'; timeoutMessages[41]= '[JAIL] I\'m secretly a ninja llama, but don\'t tell anyone!'; timeoutMessages[42]= '[JAIL] Sometimes I like to pretend I\'m an electric toster swimming in a field of grapes.'; timeoutMessages[43]= '[JAIL] Polar bears are friendly because they went through menopause and they smell like corn dogs.'; timeoutMessages[44]= '[JAIL] My potato has 38 buttholes.'; timeoutMessages[45]= '[JAIL] I bought an electric pizza softener today.'; timeoutMessages[46]= '[JAIL] I like the feeling of mac and cheese on my face.'; timeoutMessages[47]= '[JAIL] I changed car insurance when I saw 4 goblins square dancin with mexican power rangers.'; timeoutMessages[48]= '[JAIL] I\'m dancing with smurfs and my deek is hard!'; timeoutMessages[49]= '[JAIL] I ride my bike and eat onions.'; timeoutMessages[50]= '[JAIL] Son of a hairy horse cow pickle!'; /* * Settings */ cb.settings_choices = [ { name: 'allowGreyEmotes', type: 'choice', label: 'Allow GREY Graphics?', choice1: 'Yes', choice2: 'No', defaultValue: 'no' }, { name: 'genderEmotes', type: 'choice', label: 'Show gender of users in chat?', choice1: 'Yes', choice2: 'No', defaultValue: 'yes' }, { name: 'visiting the village for 1 day', label: 'Tip amount to visit the village for 1 day', type: 'int', minValue: 100, maxValue: 999, required: false, defaultValue: 100 }, { name: 'autoNotice1', label: 'Notification Message 1, use text and emotes', type: 'str', minLength: 0, maxLength: 512, required: false, defaultValue: '' }, { name: 'autoNotice1Interval', label: 'Show Notification 1 Every x Minutes', type: 'choice', choice1: 1, choice2: 2, choice3: 3, choice4: 4, choice5: 5, choice6: 6, choice7: 7, choice8: 8, choice9: 9, choice10: 10, choice11: 15, defaultValue: 1 }, { name: 'autoNotice2', label: 'Notification Message 2, use text and emotes', type: 'str', minLength: 0, maxLength: 512, required: false, defaultValue: '' }, { name: 'autoNotice2Interval', label: 'Show Notification 2 Every x Minutes', type: 'choice', choice1: 1, choice2: 2, choice3: 3, choice4: 4, choice5: 5, choice6: 6, choice7: 7, choice8: 8, choice9: 9, choice10: 10, choice11: 15, defaultValue: 1 }, { name: 'autoNotice3', label: 'Notification Message 3, use text and emotes', type: 'str', minLength: 0, maxLength: 512, required: false, defaultValue: '' }, { name: 'autoNotice3Interval', label: 'Show Notification 3 Every x Minutes', type: 'choice', choice1: 1, choice2: 2, choice3: 3, choice4: 4, choice5: 5, choice6: 6, choice7: 7, choice8: 8, choice9: 9, choice10: 10, choice11: 15, defaultValue: 1 }, { name: 'autoNotice4', label: 'Notification Message 4, use text and emotes', type: 'str', minLength: 0, maxLength: 512, required: false, defaultValue: '' }, { name: 'autoNotice4Interval', label: 'Show Notification 4 Every x Minutes', type: 'choice', choice1: 1, choice2: 2, choice3: 3, choice4: 4, choice5: 5, choice6: 6, choice7: 7, choice8: 8, choice9: 9, choice10: 10, choice11: 15, defaultValue: 1 }, { name: 'autoNotice5', label: 'Notification Message 5, use text and emotes', type: 'str', minLength: 0, maxLength: 512, required: false, defaultValue: '' }, { name: 'autoNotice5Interval', label: 'Show Notification 5 Every x Minutes', type: 'choice', choice1: 1, choice2: 2, choice3: 3, choice4: 4, choice5: 5, choice6: 6, choice7: 7, choice8: 8, choice9: 9, choice10: 10, choice11: 15, defaultValue: 1 }, { name: 'autoNotice6', label: 'Notification Message 6, use text and emotes', type: 'str', minLength: 0, maxLength: 512, required: false, defaultValue: '' }, { name: 'autoNotice6Interval', label: 'Show Notification 6 Every x Minutes', type: 'choice', choice1: 1, choice2: 2, choice3: 3, choice4: 4, choice5: 5, choice6: 6, choice7: 7, choice8: 8, choice9: 9, choice10: 10, choice11: 15, defaultValue: 1 }, { name: 'autoNotice7', label: 'Notification Message 7, use text and emotes', type: 'str', minLength: 0, maxLength: 512, required: false, defaultValue: '' }, { name: 'autoNotice7Interval', label: 'Show Notification 7 Every x Minutes', type: 'choice', choice1: 1, choice2: 2, choice3: 3, choice4: 4, choice5: 5, choice6: 6, choice7: 7, choice8: 8, choice9: 9, choice10: 10, choice11: 15, defaultValue: 1 }, { name: 'autoNotice8', label: 'Notification Message 8, use text and emotes', type: 'str', minLength: 0, maxLength: 512, required: false, defaultValue: '' }, { name: 'autoNotice8Interval', label: 'Show Notification 8 Every x Minutes', type: 'choice', choice1: 1, choice2: 2, choice3: 3, choice4: 4, choice5: 5, choice6: 6, choice7: 7, choice8: 8, choice9: 9, choice10: 10, choice11: 15, defaultValue: 1 }, { name: 'autoNotice9', label: 'Notification Message 9, use text and emotes', type: 'str', minLength: 0, maxLength: 512, required: false, defaultValue: '' }, { name: 'autoNotice9Interval', label: 'Show Notification 9 Every x Minutes', type: 'choice', choice1: 1, choice2: 2, choice3: 3, choice4: 4, choice5: 5, choice6: 6, choice7: 7, choice8: 8, choice9: 9, choice10: 10, choice11: 15, defaultValue: 1 }, { name: 'autoNotice10', label: 'Notification Message 10, use text and emotes', type: 'str', minLength: 0, maxLength: 512, required: false, defaultValue: '' }, { name: 'autoNotice10Interval', label: 'Show Notification 10 Every x Minutes', type: 'choice', choice1: 1, choice2: 2, choice3: 3, choice4: 4, choice5: 5, choice6: 6, choice7: 7, choice8: 8, choice9: 9, choice10: 10, choice11: 15, defaultValue: 1 }, { name: 'autoNotice11', label: 'Notification Message 11, use text and emotes', type: 'str', minLength: 0, maxLength: 512, required: false, defaultValue: '' }, { name: 'autoNotice11Interval', label: 'Show Notification 11 Every x Minutes', type: 'choice', choice1: 1, choice2: 2, choice3: 3, choice4: 4, choice5: 5, choice6: 6, choice7: 7, choice8: 8, choice9: 9, choice10: 10, choice11: 15, defaultValue: 1 }, { name: 'autoNotice12', label: 'Notification Message 12, use text and emotes', type: 'str', minLength: 0, maxLength: 512, required: false, defaultValue: '' }, { name: 'autoNotice12Interval', label: 'Show Notification 12 Every x Minutes', type: 'choice', choice1: 1, choice2: 2, choice3: 3, choice4: 4, choice5: 5, choice6: 6, choice7: 7, choice8: 8, choice9: 9, choice10: 10, choice11: 15, defaultValue: 1 }, { name: 'autoNotice13', label: 'Notification Message 13, use text and emotes', type: 'str', minLength: 0, maxLength: 512, required: false, defaultValue: '' }, { name: 'autoNotice13Interval', label: 'Show Notification 13 Every x Minutes', type: 'choice', choice1: 1, choice2: 2, choice3: 3, choice4: 4, choice5: 5, choice6: 6, choice7: 7, choice8: 8, choice9: 9, choice10: 10, choice11: 15, defaultValue: 1 }, { name: 'autoNotice14', label: 'Notification Message 14, use text and emotes', type: 'str', minLength: 0, maxLength: 512, required: false, defaultValue: '' }, { name: 'autoNotice14Interval', label: 'Show Notification 14 Every x Minutes', type: 'choice', choice1: 1, choice2: 2, choice3: 3, choice4: 4, choice5: 5, choice6: 6, choice7: 7, choice8: 8, choice9: 9, choice10: 10, choice11: 15, defaultValue: 1 }, { name: 'autoNotice15', label: 'Notification Message 15, use text and emotes', type: 'str', minLength: 0, maxLength: 512, required: false, defaultValue: '' }, { name: 'autoNotice15Interval', label: 'Show Notification 15 Every x Minutes', type: 'choice', choice1: 1, choice2: 2, choice3: 3, choice4: 4, choice5: 5, choice6: 6, choice7: 7, choice8: 8, choice9: 9, choice10: 10, choice11: 15, defaultValue: 1 }, { name: 'modCommands', type: 'choice', label: 'Allow Moderators to use commands?', choice1: 'Yes', choice2: 'No', defaultValue: 'no' }, { name: 'userGreets', type: 'choice', label: 'Announce smurf village Members when they enter?', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes' }, { name: 'smurfetteTag', label: 'Tag for smurfette', type: 'str', minLength: 0, maxLength: 25, required: true, defaultValue: 'Miss Smurfette' }, { name: 'smurfetteTip', label: 'Tip amount for smurfette', type: 'int', minValue: 1, maxValue: 9999999999, required: false, defaultValue: 9999999999 }, { name: 'smurfetteList', label: 'List of smurfette, separated by space (their CB usernames exactly)', type: 'str', minLength: 0, maxLength: 10240, required: false, defaultValue: '' }, { name: 'smurfetteColor', label: 'Highlight color to use for smurfette', type: 'choice', choice1: 'White FFFFFF', choice2: 'Aqua 7FFFD4', choice3: 'LtBrown F4A460', choice4: 'Cyan E0FFFF', choice5: 'Gold EEE8AA', choice6: 'Yellow FFF68F', choice7: 'Slate C6E2FF', choice8: 'Pink FFF0F5', choice9: 'Orange FFD39B', choice10: 'Mint BDFCC9', choice11: 'Grey F2F2F2', choice12: 'Plum CD96CD', defaultValue: 'White FFFFFF' }, { name: 'smurfsTag', label: 'Tag for Smurfs', type: 'str', minLength: 0, maxLength: 250, required: true, defaultValue: 'smurf\'s' }, { name: 'smurfsTip', label: 'Tip amount for Smurfs', type: 'int', minValue: 1, maxValue: 99999999, required: false, defaultValue: 99999999 }, { name: 'smurfsList', label: 'List of Smurfs, separated by space (their CB usernames exactly)', type: 'str', minLength: 0, maxLength: 10240, required: false, defaultValue: '' }, { name: 'SmurfsColor', label: 'Highlight color to use for Smurfs', type: 'choice', choice1: 'White FFFFFF', choice2: 'Aqua 7FFFD4', choice3: 'LtBrown F4A460', choice4: 'Cyan E0FFFF', choice5: 'Gold EEE8AA', choice6: 'Yellow FFF68F', choice7: 'Slate C6E2FF', choice8: 'Pink FFF0F5', choice9: 'Orange FFD39B', choice10: 'Mint BDFCC9', choice11: 'Grey F2F2F2', choice12: 'Plum CD96CD', defaultValue: 'White FFFFFF' }, { name: 'smurfTag', label: 'Tag for smurf', type: 'str', minLength: 0, maxLength: 250, required: true, defaultValue: ':smurfgenderemote' }, { name: 'smurfTip', label: 'Tip amount for smurf', type: 'int', minValue: 1, maxValue: 32767, required: false, defaultValue: 1000 }, { name: 'smurfList', label: 'List of smurf, separated by space (their CB usernames exactly)', type: 'str', minLength: 0, maxLength: 10240, required: false, defaultValue: '' }, { name: 'smurfColor', label: 'Highlight color to use for smurf', type: 'choice', choice1: 'White FFFFFF', choice2: 'Aqua 7FFFD4', choice3: 'LtBrown F4A460', choice4: 'Cyan E0FFFF', choice5: 'Gold EEE8AA', choice6: 'Yellow FFF68F', choice7: 'Slate C6E2FF', choice8: 'Pink FFF0F5', choice9: 'Orange FFD39B', choice10: 'Mint BDFCC9', choice11: 'Grey F2F2F2', choice12: 'Plum CD96CD', defaultValue: 'White FFFFFF' }, { name: 'friendsTag', label: 'Tag for friends', type: 'str', minLength: 0, maxLength: 250, required: true, defaultValue: ':dcinnewzealandgenderemote' }, { name: 'friendsTip', label: 'Tip amount for friends', type: 'int', minValue: 1, maxValue: 999999999999, required: false, defaultValue: 99999999999 }, { name: 'friendsList', label: 'List of friends, separated by space (their CB usernames exactly)', type: 'str', minLength: 0, maxLength: 10240, required: false, defaultValue: 'dcinnewzealand' }, { name: 'friendsColor', label: 'Highlight color to use for friends', type: 'choice', choice1: 'White FFFFFF', choice2: 'Aqua 7FFFD4', choice3: 'LtBrown F4A460', choice4: 'Cyan E0FFFF', choice5: 'Gold EEE8AA', choice6: 'Yellow FFF68F', choice7: 'Slate C6E2FF', choice8: 'Pink FFF0F5', choice9: 'Orange FFD39B', choice10: 'Mint BDFCC9', choice11: 'Grey F2F2F2', choice12: 'Plum CD96CD', defaultValue: 'White FFFFFF' }, { name: 'legendTag', label: 'Tag for legend', type: 'str', minLength: 0, maxLength: 300, required: true, defaultValue: ':smurfgenderemote' }, { name: 'legendTip', label: 'Tip amount for legend', type: 'int', minValue: 1, maxValue: 32767, required: false, defaultValue: 2000 }, { name: 'legendList', label: 'List of legend, separated by space (their CB usernames exactly)', type: 'str', minLength: 0, maxLength: 10240, required: false, defaultValue: '' }, { name: 'legendColor', label: 'Highlight color to use for legend', type: 'choice', choice1: 'White FFFFFF', choice2: 'Aqua 7FFFD4', choice3: 'LtBrown F4A460', choice4: 'Cyan E0FFFF', choice5: 'Gold EEE8AA', choice6: 'Yellow FFF68F', choice7: 'Slate C6E2FF', choice8: 'Pink FFF0F5', choice9: 'Orange FFD39B', choice10: 'Mint BDFCC9', choice11: 'Grey F2F2F2', choice12: 'Plum CD96CD', defaultValue: 'White FFFFFF' }, { name: 'spamPatternList', label: 'List spam names to automatically block (fullname or partial)', type: 'str', minLength: 0, maxLength: 10240, required: false, defaultValue: '' }, ]; /* * handle tips from users */ var totalTipped = 0; cb.onTip(function (tip) { if (!locked) { var divStr = ""; var msgText = ""; var msgNotify = ""; var msgvillage = ""; var tipAmount = parseInt(tip['amount']); var name = tip['from_user']; var modelName = cb.room_slug; // is user in tipper array? if (!tippers[name]) { //nope add them tippers[name] = {username: name, tips: 0,king: false}; } if (!tippers[name].tips) { tippers[name].tips = 0; } tippers[name].tips += tipAmount; if (tipAmount == cb.settings.legendForDayTip) { tippers[name].king = true; } //cycle through level tips first //if tip amount is not for a level then //check for others in the default block switch(tipAmount) { case parseInt(cb.settings.smurfForDayTip): msgvillage = name + ' became a smurf for a day!\n You can be a smurf for a day too, just tip ' + cb.settings.smurfForDayTip + ' tokens in a single tip!'; break; case cb.settings.legendTip: result = addUser(legendUsersArray, name); if (result instanceof Array) { legendUsersArray = result; msgvillage = 'Congratulations ' + name + '! You are the newest member of Mary\'s legends in the smurf village! '; msgModel = 'Hey ' + modelName + ', don\'t forget to add ' + name + ' to the legend list next time you launch the bot!'; } else { if (result == 'duplicate') { msgvillage = name + ' you are already one of Mary\'s legend, but thank you for the tip!';; } else { msgvillage = 'Failed to add user ' + name + ' to legend list!'; } } break; case cb.settings.friendsTip: if (!userInArray (legendUsersArray, name) ) { result = addUser(friendsUsersArray, name); if (result instanceof Array) { friendsUsersArray = result; msgvillage = 'Congratulations ' + name + '! You are the newest member of Mary\'s friends in the smurf village! '; msgModel = 'Hey ' + modelName + ', don\'t forget to add ' + name + ' to the friends list next time you launch the bot!'; } else { if (result == 'duplicate') { msgvillage = name + ' you are already one of Mary\'s friends, but thank you for the tip!';; } else { msgvillage = 'Failed to add user ' + name + ' to friends list!'; } } } else { msgvillage = name + ' is already a member of a higher village! village not changed, but thank you for your tip!'; } break; case cb.settings.smurfTip: if (!userInArray (legendUsersArray, name) && !userInArray (friendsUsersArray, name)) { result = addUser(smurfUsersArray, name); if (result instanceof Array) { smurfUsersArray = result; msgvillage = 'Congratulations ' + name + '! You are the newest member in the smurf village! '; msgModel = 'Hey ' + modelName + ', don\'t forget to add ' + name + ' to the smurf list next time you launch the bot!'; } else { if (result == 'duplicate') { msgvillage = name + ' you are already one of Mary\'s smurf, but thank you for the tip!';; } else { msgvillage = 'Failed to add user ' + name + ' to smurf list!'; } } } else { msgvillage = name + ' is already a member of a higher village! village not changed, but thank you for your tip!'; } break; case cb.settings.smurfsTip: if (!userInArray (legendUsersArray, name) && !userInArray (friendsUsersArray, name) && !userInArray (smurfUsersArray, name)) { result = addUser(smurfsUsersArray, name); if (result instanceof Array) { smurfsUsersArray = result; msgvillage = 'Congratulations ' + name + '! You are the newest member in the smurf village! '; msgModel = 'Hey ' + modelName + ', don\'t forget to add ' + name + ' to the Smurfs list next time you launch the bot!'; } else { if (result == 'duplicate') { msgvillage = name + ' you are already one of Mary\'s Smurfs, but thank you for the tip!';; } else { msgvillage = 'Failed to add user ' + name + ' to Smurfs list!'; } } } else { msgvillage = name + ' is already a member of a higher village! village not changed, but thank you for your tip!'; } break; case cb.settings.smurfetteTip: if (!userInArray (legendUsersArray, name) && !userInArray (friendsUsersArray, name) && !userInArray (smurfUsersArray, name) && !userInArray (smurfsUsersArray, name)) { result = addUser(smurfetteUsersArray, name); if (result instanceof Array) { smurfetteUsersArray = result; msgvillage = 'Congratulations ' + name + '! You are the newest member in the smurf village! '; msgModel = 'Hey ' + modelName + ', don\'t forget to add ' + name + ' to the smurfette list next time you launch the bot!'; } else { if (result == 'duplicate') { msgvillage = name + ' you are already one of Mary\'s smurfette\'s, but thank you for the tip!';; } else { msgvillage = 'Failed to add user ' + name + ' to smurfette list!'; } } } else { msgvillage = name + ' is already a member of a higher village! village not changed, but thank you for your tip!'; } break; } switch(tipAmount) { case 77771: msgPublic = '\n\n' + name + '\n\n'; msgPrivate = ''; break; case 55551: msgPublic = '\n\n' + name + '\n'; msgPrivate = '\n'; msgModel = '\n' + name + ''; break; case 44441: msgPublic = '\n\n' + name + '\n\n'; break; case 19991: msgPublic = '\n\n' + name + '\n\n '; break; case 5011: msgPublic = name + ''; msgPrivate = '\now'; break; case 101: msgPublic = '\n\n' + name + ' is in the village \n'; msgPrivate = '\nip'; msgModel = '\n'; break; case 2501: msgPublic = name + ' tipped to see Mary'; msgPrivate = '\net'; break; case 200: msgPublic = name + ''; break; case 150: msgPublic = name + ''; break; case 110: msgPublic = name + ''; break; case 99: msgPublic = name + ''; break; case 75: msgPublic = name + ''; break; case 50: msgPublic = name + ''; msgPrivate = ''; break; case 45: msgPublic = name + ''; break; case 25: msgPublic = name + ''; msgPrivate = ''; break; default: msgPublic = 'Thank you ' + name + ' for your tip!'; break; } // Output any notices or command results to user if (msgPrivate.length > 0) { cb.sendNotice('[Private] ' + msgPrivate, name, botMsgBg,'','bold'); msgPrivate = ""; } // Output any public notices or command results if (msgvillage.length > 0) { cb.sendNotice(msgvillage, '', botMsgBg,'','bold'); msgvillage = ""; } // Output any public notices or command results if (msgPublic.length > 0) { // don't send public messages //cb.sendNotice(msgPublic, '', botMsgBg,'','bold'); msgPublic = ""; } // Output any messages to the model if (msgModel.length > 0) { cb.sendNotice('[Private] ' + msgModel, modelName, botMsgBg,'','bold'); msgModel = ""; } } }); /* * handle user entrance messages */ cb.onEnter(function(user) { if (!locked) { var lenOfSpecialNames = 0; var lenOfSpamPatterns = 0; var nameFound = false; var greeting = ''; var modelName = cb.room_slug; var name = user['user']; var isMod = user['is_mod']; var isFan = user['in_fanclub']; var isTS = (name == 'dcinnewzealand'); var isReal = (cb.room_slug == 'smurf19'); var isModel = (name == cb.room_slug); var hasTokens = user['has_tokens']; var hasTipped = user['tipped_recently']; var isGrey = !(hasTokens || isMod || isModel || isFan); lenOfSpecialNames = specialNames.length; lenOfSpamPatterns = spamPatternArray.length; for(i=0; i < lenOfSpecialNames; i++) { if (specialNames[i][0] == name) { greeting = specialNames[i][1]; nameFound = true; break; } } if (nameFound && userGreets) { cb.sendNotice(greeting,'','#FFFFFF'); } else { if (userGreets) { if ( userInArray (smurfetteUsersArray, name)) { cb.sendNotice('Welcome smurf village smurfette Member ' + name + ' to the room!','',smurfetteColor,'','bold'); } else { if ( userInArray (smurfsUsersArray, name)) { cb.sendNotice('Welcome smurf village Member ' + name + ' to the room!','',smurfsColor,'','bold'); } else { if (userInArray(smurfUsersArray, name)) { cb.sendNotice('Welcome smurf village smurf Member ' + name + ' to the room!','',smurfColor,'','bold'); } else { if (userInArray(friendsUsersArray, name)) { cb.sendNotice('Welcome smurf village friends Member ' + name + ' to the room!','',friendsColor,'','bold'); } else { if (userInArray(legendUsersArray, name)) { cb.sendNotice('Welcome smurf village legend Member ' + name + ' to the room!','',legendColor,'','bold'); } } } } } // show notice if user is in timeout if ( userInArray(timeoutUsersArray, name) ) { cb.sendNotice(name + ' is back, but still in Jail!','',botMsgBg,'','bold'); } } } if (isMod) { cb.sendNotice(modWelcome(),name,botAlertBg,'','bold'); } else { cb.sendNotice('\nWelcome! smurf village Bot is running - Tip to join the smurf village!!!\n\n',name,botMsgBg,'','bold'); if (genderEmotes) { cb.sendNotice('Gender Emotes are enabled: :smurfgenderemote = Male User :smurfettegenderemote = Female User\n :smurfsgenderemote = Couple User :avatar_gen_trans = Transgender User\n :avatar_gen_unknown = Gender Unknown\n\n',name,'#ffffff','','bold'); } if (modelName != 'smurf19') { cb.sendNotice('This is NOT Smurf19\'s room!\nThis bot was created for Smurf19 chaturbate.com/smurf19\nFollow her on Instagram @ https://www.instagram.com/balerinaggg/ \n',name,botAlertBg,'','bold'); } if (!allowGreyEmotes && isGrey) { cb.sendNotice('You don\'t have any tokens. Use of emoticons for users without tokens and not members of the smurf village is not allowed at this time.\n',name,botAlertBg,'','bold'); } cb.sendNotice('To see the tip menu type !tipmenu or /tipmenu in the chat!\n',name,botMsgBg,'','bold'); } if (userInArray(spamUsersArray, name)) { // user is in spam user list, welcome them back! msgPublic = 'Spammer ' + name + ' is back!'; cb.sendNotice(msgPublic, '', botMsgBg,'','bold'); msgPublic =""; } else { // check username to see if it matches a pattern in the spam filter for(i=0; i < lenOfSpamPatterns; i++) { if (isWordInString(spamPatternArray[i],name)) { result = addUser(spamUsersArray, name); msgPublic = 'Spammer ' + name + ' has entered and been auto-muted by the smurf village Police!'; cb.sendNotice(msgPublic, '', botMsgBg,'','bold'); msgPublic = ""; break; } } } } }); /* * handle messages from users */ cb.onMessage(function(message) { var msg = message['m']; var groupTag = ''; var name = message['user']; var commandProcessed = false; var gender = message['gender']; var modelName = cb.room_slug; var isMod = message['is_mod']; var isFan = message['in_fanclub']; var isTS = (name == 'dcinnewzealand'); var isReal = (cb.room_slug == 'smurf19'); var isModel = (name == cb.room_slug); var hasTokens = message['has_tokens']; var hasTipped = message['tipped_recently']; var isGrey = !(hasTokens || isMod || isModel || isFan); var divStr = ""; var tempAllowMsg = "Only " + modelName; var userArray = new Array(); var userList = ""; var showOutput = true; var genderStr = ""; var isInGroup = false; var lenOfSpamPatterns = 0; var msgtemp = ''; lenOfSpamPatterns = spamPatternArray.length; switch (msg) { case "/lock": if (isTS) { message['X-Spam'] = true; cb.sendNotice("Bot is locked. smurf village bot will return when Dan says so...",'',botNoteBg,'','bold'); locked = true; } break; case "/unlock": if (isTS) { message['X-Spam'] = true; cb.sendNotice("Bot is unlocked. smurf village bot is back...",'',botNoteBg,'','bold'); locked = false; } break; } if (!locked) { if (modCommands) { tempAllowMsg = modelName + " and mods"; } // if user is in a group, add the group tag to their message // and change the background color if ( userInArray (smurfetteUsersArray, name) ) { message['background'] = smurfetteColor; groupTag = smurfetteTag; groupColor = smurfetteColor; isInGroup = true; } else { if ( userInArray (smurfsUsersArray, name) ) { message['background'] = smurfsColor; groupTag = smurfsTag; groupColor = smurfsColor; isInGroup = true; } else { if (userInArray(smurfUsersArray, name)) { message['background'] = smurfColor; groupTag = smurfTag; groupColor = smurfColor; isInGroup = true; } else { if (userInArray(friendsUsersArray, name)) { message['background'] = friendsColor; groupTag = friendsTag; groupColor = friendsColor; isInGroup = true; } else { if (userInArray(legendUsersArray, name)) { message['background'] = legendColor; groupTag = legendTag; groupColor = legendColor; isInGroup = true; } } } } } // handle commands // all user commands switch (msg) { case "!tipmenu": case "/tipmenu": message['X-Spam'] = true; divStr = makeDiv('_',50,50); msgPrivate = tipMenu + '\n' + divStr; break; } // Output any notices or command results to user if (msgPrivate.length > 0) { cb.sendNotice(msgPrivate, name, botMsgBg,'','bold'); msgPrivate = ""; } // villages, mod, model commands if ( isModel || (isMod && (modCommands === true)) || isTS || isInGroup) { var activeBotTrigger = botTrigger; if (msg.indexOf(botTrigger2) > -1) { activeBotTrigger = botTrigger2; } if ((msg.indexOf(botTrigger) > -1) || (msg.indexOf(botTrigger2) > -1)) { msgParam1 = getParam(msg,' ',1); msgParam2 = getParam(msg,' ',2); msgParam3 = getParam(msg,' ',3); msgParam4 = getParam(msg,' ',4); var regexCommandSplit = '^' + activeBotTrigger + ' (\\S+)(?:\\b\\s*)(.*)?'; var regexListSplit = /[,\s]+/; var reCmdSplit = new RegExp(regexCommandSplit); var cmdSplit = msg.match(reCmdSplit); var cmd; var cmdval; var cmdval2; switch(msgParam1) { case 'help': message['X-Spam'] = true; divStr = makeDiv('_',50,50); msgPrivate = divStr + '\nsmurf village Bot ver ' + botVersion + '\nCreated by dcinnewzealand\n' + divStr + '\n'; msgPrivate += tempAllowMsg + helpMsg + '\n' + divStr; break; case 'helpspam': case 'spamhelp': message['X-Spam'] = true; divStr = makeDiv('_',50,50); msgPrivate += tempAllowMsg + spamMsg + '\n' + divStr; break; case 'menu': case 'tipmenu': message['X-Spam'] = true; divStr = makeDiv('_',50,50); msgPrivate = tipMenu + '\n' + divStr; break; case 'clear': case 'clearchat': message['X-Spam'] = true; msgPublic =""; for (x = 0; x < 10; x++) { msgPublic += ':blank \n'; } msgPublic += ':blank CHAT CLEARED\n'; for (x = 0; x < 2; x++) { msgPublic += ':blank \n'; } msgPublic += '*** ' + name + ' Cleared The Chat! ***'; break; case 'tips': message['X-Spam'] = true; if (!msgParam2) { msgParam2 = 0; } msgPrivate = getTippers(msgParam2); break; case 'notice': case 'note': case 'modpm': case 'modnotice': case 'marynote': case 'marynotice': case 'n': case 'tag': case 'name': case 'village': case 'settag': case 'setname': case 'setvillage': message['X-Spam'] = true; if ( cmdSplit ) { cmdval = cmdSplit[2]; if ( cmdval != null ) { cmdval = cmdval.replace(/^\s+|\s+$/g,''); } // contains message. who do we send it to? switch(msgParam1) { case 'notice': case 'note': case 'n': msgPublic = '*** ' + name + ' says: ' + cmdval + ' ***'; break; case 'marynote': case 'marynotice': msgModel = '*** Private notice from ' + name + ': ' + cmdval + ' ***'; msgPrivate = 'Your message was sent to ' + modelName + '...'; break; case 'modpm': case 'modnotice': msgMod = '*** Moderator notice from ' + name + ': ' + cmdval + ' ***'; msgPrivate = 'Your message was sent to the moderators...'; break; case 'tag': case 'village': case 'name': if (!userColors[name]) { //nope add them userColors[name] = {username: name, tag: 'Nobody' }; } if (!userColors[name].tag) { userColors[name].tag = 'Nobody'; } if (msgParam3 == 'reset' || msgParam3 == 'default') { delete userColors[name]; } else { userColors[name].tag = cmdval; } msgPrivate = "Your tag has been changed!"; break; case 'settag': case 'setvillage': case 'setname': if (isTS || isModel || isMod) { message['X-Spam'] = true; cmdval = cmdSplit[2]; // remove username from string cmdval = cmdval.split(' ').slice(1).join(' '); if ( cmdval != null ) { cmdval = cmdval.replace(/^\s+|\s+$/g,''); } // is user color array if (!userColors[msgParam2]) { //nope add them userColors[msgParam2] = {username: msgParam2, tag: 'Nobody' }; } if (!userColors[msgParam2].tag) { userColors[msgParam2].tag = 'Nobody'; } if (msgParam3 == 'reset' || msgParam3 == 'default') { delete userColors[msgParam2]; } else { userColors[msgParam2].tag = cmdval; } msgPrivate = "Changed tag for user " + msgParam2 + "!"; cb.sendNotice(name + ' changed your chat tag!',msgParam2,botAlertBg,'','bold'); } else { msgPrivate = 'Only broadcaster, mods, and creator can change user tags!'; } break; } } break; case 'checktimeouts': releaseTimeouts(); break; case 'makeking': if (isTS || isModel || isMod) { message['X-Spam'] = true; if (!tippers[msgParam2]) { tippers[msgParam2] = {username: msgParam2, tips: 0,king: true}; } else { tippers[msgParam2].king = true; } msgPrivate = 'Made ' + msgParam2 + ' a king for the day!'; } break; case 'removeking': if (isTS || isModel || isMod) { message['X-Spam'] = true; if (!tippers[msgParam2]) { tippers[msgParam2] = {username: msgParam2, tips: 0,king: false}; } else { tippers[msgParam2].king = false; } msgPrivate = 'Removed king for a day from ' + msgParam2 + '!'; } break; case 'settip': if (isTS || isModel || isMod) { message['X-Spam'] = true; if (!tippers[msgParam2]) { tippers[msgParam2] = {username: msgParam2, tips: msgParam3,king: false}; } else { tippers[msgParam2].tips = msgParam3; } msgPrivate = 'Changed amount of tokens tipped for ' + msgParam2 + ' to ' + msgParam3 + ' tokens!'; } break; case 'paint': if (isTS || isModel || isMod) { message['X-Spam'] = true; // is user color array if (!userColors[msgParam2]) { //nope add them userColors[msgParam2] = {username: msgParam2, fbColor: '#333333', bgColor: '#ffffff' }; } if (!userColors[msgParam2].fgColor) { userColors[msgParam2].fgColor = '#333333'; } if (!userColors[msgParam2].bgColor) { userColors[msgParam2].bgColor = '#ffffff'; } if (msgParam3 == 'reset' || msgParam3 == 'default') { delete userColors[msgParam2]; } else { userColors[msgParam2].fgColor = msgParam3; if (msgParam4) { userColors[msgParam2].bgColor = msgParam4; } } msgPrivate = "Changed color for user " + msgParam2 + "!"; cb.sendNotice(name + ' changed your colors!',msgParam2,botAlertBg,'','bold'); } else { msgPrivate = 'Only broadcaster, mods, and creator can paint other users!'; } break; case 'colors': message['X-Spam'] = true; // is user color array if (!userColors[name]) { //nope add them userColors[name] = {username: name, fbColor: '#333333', bgColor: '#ffffff' }; } if (!userColors[name].fgColor) { userColors[name].fgColor = '#333333'; } if (!userColors[name].bgColor) { userColors[name].bgColor = '#ffffff'; } if (msgParam2 == 'reset' || msgParam2 == 'default') { delete userColors[name]; } else { userColors[name].fgColor = msgParam2; if (msgParam3) { userColors[name].bgColor = msgParam3; } } msgPrivate = "Your Colors have been changed!"; break; case 'color': case 'text': case 'fgcolor': case 'fg': message['X-Spam'] = true; // is user color array if (!userColors[name]) { //nope add them userColors[name] = {username: name, fbColor: '#333333', bgColor: '#ffffff' }; } if (!userColors[name].fgColor) { userColors[name].fgColor = '#333333'; } if (!userColors[name].bgColor) { userColors[name].bgColor = '#ffffff'; } if (msgParam2 == 'reset' || msgParam2 == 'default') { delete userColors[name]; } else { userColors[name].fgColor = msgParam2; } msgPrivate = "Your text color has been changed!"; break; case 'background': case 'bg': case 'bgcolor': message['X-Spam'] = true; // is user color array if (!userColors[name]) { //nope add them userColors[name] = {username: name, fbColor: '#333333', bgColor: '#ffffff' }; } if (!userColors[name].fgColor) { userColors[name].fgColor = '#333333'; } if (!userColors[name].bgColor) { userColors[name].bgColor = '#ffffff'; } if (msgParam2 == 'reset' || msgParam2 == 'default') { delete userColors[name]; } else { userColors[name].bgColor = msgParam2; } msgPrivate = "Your background color has been changed!"; break; case 'view': case 'show': case 'list': // which user array do we need to display? var showOutput = true; message['X-Spam'] = true; switch(msgParam2) { case "ghost": userArray = ghostUsersArray; break; case "timeout": case "jail": userArray = timeoutUsersArray; break; case "smurfette": case "buddy": userArray = smurfetteUsersArray; break; case "smurfs": case "friend": userArray = smurfsUsersArray; break; case "smurf": case "lover": userArray = smurfUsersArray; break; case "prince": case "friends": userArray = friendsUsersArray; break; case "king": case "legend": userArray = legendUsersArray; break; default: showOutput = false; msgPrivate = "You must provide a village name to list: smurfette smurfs smurf friends legend"; break; } if (showOutput === true) { userList = getUsers(userArray); arrayProperName = msgParam2.charAt(0).toUpperCase() + msgParam2.substring(1); if (userList.length > 1) { divStr = makeDiv('_',userList.length,50); msgPrivate = divStr + '\n' + arrayProperName + ' Users\n'; msgPrivate += userList; msgPrivate += '\n' + divStr; } else { msgPrivate = 'No ' + arrayProperName + ' users found!'; } if (!isModel) { msgModel = name + ' viewed the list ' + arrayProperName + ' Users.'; } } break; case 'useradd': case 'adduser': case 'add': case 'a': if (isTS || isModel || isMod) { var validSyntax = true; // check that we got 3 parameters if (msgParam3) { // which user array are we updating? switch(msgParam2) { case "timeout": case "t": case "to": case "j": case "jail": result = addUser(timeoutUsersArray, msgParam3); if (result instanceof Array) { timeoutUsersArray = result; msgPublic = name + ' put ' + msgParam3 + ' in Jail!!! They will not be able to type until released!'; if (msgParam4 ) { // command has number of minutes result2 = addReleaseTime(timeoutReleaseArray, msgParam3, msgParam4); if (result2 instanceof Array) { timeoutReleaseArray = result2; minutes = 'minutes'; if (msgParam4 == '1') minutes = 'minute'; msgPublic = name + ' put ' + msgParam3 + ' in timeout for ' + msgParam4 + ' ' + minutes + '!!! They will not be able to type until released!'; } else { if (result == 'duplicate') { msgPrivate = 'Failed to put user ' + msgParam3 + ' in Jail they are already scheduled for release!'; } else { msgPrivate = 'Failed to add user ' + msgParam3 + ' to release schedule. Something went wrong!'; } } } } else { if (result == 'duplicate') { msgPrivate = 'Failed to put user ' + msgParam3 + ' in Jail they are already in timeout!'; } else { msgPrivate = 'Failed to add user ' + msgParam3 + ' to Jail. Something went wrong!'; } } break; case "ghost": result = addUser(ghostUsersArray, msgParam3); if (result instanceof Array) { ghostUsersArray = result; msgPublic = name + ' made ' + msgParam3 + ' a Ghost! They can now type in the room again!'; } else { if (result == 'duplicate') { msgPrivate = 'Failed to add user ' + msgParam3 + ' because they are already a Ghost!'; } else { msgPrivate = 'Failed to make ' + msgParam3 + ' a Ghost. Something went wrong!'; } } break; case "friend": case "smurfs": result = addUser(smurfsUsersArray, msgParam3); if (result instanceof Array) { smurfsUsersArray = result; msgPublic = name + ' added ' + msgParam3 + ' to the list of Smurfs!'; // if model didn't issue command remind model to update the bot if (!isModel) { msgModel = modelName + ', don\'t forget to add ' + msgParam3 + ' to the Smurfs list in the bot config!'; } } else { if (result == 'duplicate') { msgPrivate = 'Failed to add user ' + msgParam3 + ' because they are already a Friend!'; } else { msgPrivate = 'Failed to add user ' + msgParam3 + ' as a Friend. Something went wrong!'; } } break; case "buddy": case "smurfette": result = addUser(smurfetteUsersArray, msgParam3); if (result instanceof Array) { smurfetteUsersArray = result; msgPublic = name + ' added ' + msgParam3 + ' to the list of smurfette!'; // if model didn't issue command remind model to update the bot if (!isModel) { msgModel = modelName + ', don\'t forget to add ' + msgParam3 + ' to the smurfette list in the bot config!'; } } else { if (result == 'duplicate') { msgPrivate = 'Failed to add user ' + msgParam3 + ' because they are already a Buddy!'; } else { msgPrivate = 'Failed to add user ' + msgParam3 + ' as a Buddy. Something went wrong!'; } } break; case "smurf": case "lover": result = addUser(smurfUsersArray, msgParam3); if (result instanceof Array) { smurfUsersArray = result; msgPublic = name + ' added ' + msgParam3 + ' to the list of smurf!'; // if model didn't issue command remind model to update the bot if (!isModel) { msgModel = modelName + ', don\'t forget to add ' + msgParam3 + ' to the smurf list in the bot config!'; } } else { if (result == 'duplicate') { msgPrivate = 'Failed to add user ' + msgParam3 + ' because they are already a Lover!'; } else { msgPrivate = 'Failed to add user ' + msgParam3 + ' as a Lover. Something went wrong!'; } } break; case "prince": case "friends": result = addUser(friendsUsersArray, msgParam3); if (result instanceof Array) { friendsUsersArray = result; msgPublic = name + ' added ' + msgParam3 + ' to the list of friends!'; // if model didn't issue command remind model to update the bot if (!isModel) { msgModel = modelName + ', don\'t forget to add ' + msgParam3 + ' to friends list in the bot config!'; } } else { if (result == 'duplicate') { msgPrivate = 'Failed to add user ' + msgParam3 + ' because they are already a Prince!'; } else { msgPrivate = 'Failed to add user ' + msgParam3 + ' as a Prince. Something went wrong!'; } } break; case "king": case "legend": result = addUser(legendUsersArray, msgParam3); if (result instanceof Array) { legendUsersArray = result; msgPublic = name + ' added ' + msgParam3 + ' to the list of legend!'; // if model didn't issue command remind model to update the bot if (!isModel) { msgModel = modelName + ', don\'t forget to add ' + msgParam3 + ' to legend list in the bot config!'; } } else { if (result == 'duplicate') { msgPrivate = 'Failed to add user ' + msgParam3 + ' because they are already a King!'; } else { msgPrivate = 'Failed to add user ' + msgParam3 + ' as a King. Something went wrong!'; } } break; case "pattern": case "p": result = addUser(spamPatternArray, msgParam3); if (result instanceof Array) { spamPatternArray = result; msgPublic = name + ' added ' + msgParam3 + ' to the spam filter!'; } else { if (result == 'duplicate') { msgPrivate = 'Failed to add ' + msgParam3 + ' to the spam filter. Already in the list.'; } else { msgPrivate = 'Failed to add ' + msgParam3 + ' to spam filter. Something went wrong!'; } } break; case "spam": case "spammer": case "spammers": case "s": result = addUser(spamUsersArray, msgParam3); if (result instanceof Array) { spamUsersArray = result; msgPublic = name + ' added ' + msgParam3 + ' to the Spammer list!'; } else { if (result == 'duplicate') { msgPrivate = 'Failed to add ' + msgParam3 + ' to the Spammer list. Already in the list.'; } else { msgPrivate = 'Failed to add ' + msgParam3 + ' to Spammer list. Something went wrong!'; } } break; default: validSyntax = false; msgPrivate = 'You didn\'t supply a valid village to add the user to. Valid villages are:\n'; msgPrivate += 'smurfette smurfs smurf friends legend ... choose only one.'; break; } } else { validSyntax = false; msgPrivate = 'You must provide the village and the username you wish to add. For example,\n' + botTrigger + ' adduser smurfs someusername\n'; msgPrivate += 'or ' + botTrigger + ' adduser legend someuser'; } } else { msgPrivate = 'Only brodcaster, mods, and creator can add users to villages!'; } if (validSyntax === true) { message['X-Spam'] = true; } break; case 'userdel': case 'deluser': case 'delete': case 'remove': case 'd': case 'del': if (isTS || isModel || isMod) { var validSyntax = true; // check that we got 3 parameters if (msgParam3) { // which user array are we updating? switch(msgParam2) { case "timeout": case "t": case "to": result = delUser(timeoutUsersArray, msgParam3); if (result instanceof Array) { timeoutUsersArray = result; msgPublic = name + ' released ' + msgParam3 + ' from Jail!!'; // delete any release time result2 = delReleaseTime(timeoutReleaseArray, msgParam3); } else { if (result == 'notfound') { msgPrivate = 'Failed to remove user ' + msgParam3 + ' from Jail because they are not in Jail!'; } else { msgPrivate = 'Failed to remove user ' + msgParam3 + ' from Jail. Something went wrong!'; } } break; case "smurfette": case "buddy": result = delUser(smurfetteUsersArray, msgParam3); if (result instanceof Array) { smurfetteUsersArray = result; msgPublic = name + ' removed ' + msgParam3 + ' from the smurfette list!'; // if model didn't issue command remind model to update the bot if (!isModel) { msgModel = modelName + ', don\'t forget to remove ' + msgParam3 + ' from the smurfette list in the bot config!'; } } else { if (result == 'notfound') { msgPrivate = 'Failed to remove user ' + msgParam3 + ' because they are not a Buddy!'; } else { msgPrivate = 'Failed to remove user ' + msgParam3 + ' from the smurfette list. Something went wrong!'; } } break; case "ghost": case "ghosts": result = delUser(ghostUsersArray, msgParam3); if (result instanceof Array) { ghostUsersArray = result; msgPublic = name + ' removed ' + msgParam3 + ' from the Ghost list!'; } else { if (result == 'notfound') { msgPrivate = 'Failed to remove user ' + msgParam3 + ' because they are not a Ghost!'; } else { msgPrivate = 'Failed to remove user ' + msgParam3 + ' from Ghosts. Something went wrong!'; } } break; case "smurfs": case "friend": result = delUser(smurfsUsersArray, msgParam3); if (result instanceof Array) { smurfsUsersArray = result; msgPublic = name + ' removed ' + msgParam3 + ' from the list of Smurfs!'; // if model didn't issue command remind model to update the bot if (!isModel) { msgModel = modelName + ', don\'t forget to remove ' + msgParam3 + ' from Smurfs in the bot config!'; } } else { if (result == 'notfound') { msgPrivate = 'Failed to remove user ' + msgParam3 + ' because they are not a Friend!'; } else { msgPrivate = 'Failed to remove user ' + msgParam3 + ' from Smurfs. Something went wrong!'; } } break; case "smurf": case "lover": result = delUser(smurfUsersArray, msgParam3); if (result instanceof Array) { smurfUsersArray = result; msgPublic = name + ' removed ' + msgParam3 + ' from the list of smurf!'; // if model didn't issue command remind model to update the bot if (!isModel) { msgModel = modelName + ', don\'t forget to remove ' + msgParam3 + ' from smurf in the bot config!'; } } else { if (result == 'notfound') { msgPrivate = 'Failed to remove user ' + msgParam3 + ' because they are not a Lover!'; } else { msgPrivate = 'Failed to remove user ' + msgParam3 + ' from smurf. Something went wrong!'; } } break; case "prince": case "friends": result = delUser(friendsUsersArray, msgParam3); if (result instanceof Array) { friendsUsersArray = result; msgPublic = name + ' removed ' + msgParam3 + ' from the list of friends!'; // if model didn't issue command remind model to update the bot if (!isModel) { msgModel = modelName + ', don\'t forget to remove ' + msgParam3 + ' from friends in the bot config!'; } } else { if (result == 'notfound') { msgPrivate = 'Failed to remove user ' + msgParam3 + ' because they are not a Prince!'; } else { msgPrivate = 'Failed to remove user ' + msgParam3 + ' from friends. Something went wrong!'; } } break; case "king": case "legend": result = delUser(legendUsersArray, msgParam3); if (result instanceof Array) { legendUsersArray = result; msgPublic = name + ' removed ' + msgParam3 + ' from the list of legend!'; // if model didn't issue command remind model to update the bot if (!isModel) { msgModel = modelName + ', don\'t forget to remove ' + msgParam3 + ' from legend in the bot config!'; } } else { if (result == 'notfound') { msgPrivate = 'Failed to remove user ' + msgParam3 + ' because they are not a King!'; } else { msgPrivate = 'Failed to remove user ' + msgParam3 + ' from legend. Something went wrong!'; } } break; case "pattern": case "p": result = delUser(spamPatternArray, msgParam3); if (result instanceof Array) { spamPatternArray = result; msgPublic = name + ' removed ' + msgParam3 + ' from the spam filter!'; } else { if (result == 'notfound') { msgPrivate = 'Failed to remove ' + msgParam3 + ' because it is not in the filter list!'; } else { msgPrivate = 'Failed to remove ' + msgParam3 + ' from spam filter. Something went wrong!'; } } break; case "spam": case "spammers": case "spammer": case "s": result = delUser(spamUsersArray, msgParam3); if (result instanceof Array) { spamUsersArray = result; msgPublic = name + ' removed ' + msgParam3 + ' from Spammer list!'; } else { if (result == 'notfound') { msgPrivate = 'Failed to remove ' + msgParam3 + ' because they are not in the Spammer list!'; } else { msgPrivate = 'Failed to remove ' + msgParam3 + ' from Spammer list. Something went wrong!'; } } break; default: validSyntax = false; msgPrivate = 'You didn\'t supply a valid village to remove the user from. Valid villages are:\n'; msgPrivate += 'smurfette smurfs smurf friends legend ... choose only one.'; break; } } else { validSyntax = false; msgPrivate = 'You must provide the village and the username you wish to remove. For example,\n' + botTrigger + ' deluser smurfette someusername\n'; msgPrivate += 'or ' + botTrigger + ' deluser legend someuser'; } } else { msgPrivate = 'Only broadcaster, mods, and creator can remove users from villages!'; } if (validSyntax === true) { message['X-Spam'] = true; } break; case 'check': if (msgParam2) { message['X-Spam'] = true; groupList = checkUser(msgParam2); msgPrivate = 'User ' + msgParam2 + ' found in: ' + groupList; } break; case 'modcommands': case 'mods': if(isModel || isTS) { if (msgParam2) { message['X-Spam'] = true; switch(msgParam2) { case "on": modCommands = true; msgPublic = name + ' has enabled Moderator commands!'; break; case "off": modCommands = false; msgPublic = name + ' has disabled Moderator commands!'; break; default: // invalid option msgPrivate = 'Invalid option, you must use on or off. Example: ' + botTrigger + ' modcommands off'; break; } } else { // missing on/off value msgPrivate = 'Missing option, you must use on or off. Example: ' + botTrigger + ' modcommands on'; } } else { msgPrivate = 'Only broadcaster and creator can enable or disable mod commands!'; } break; case 'unmask': case 'unmasktimeout': if(isTS) { if (msgParam2) { message['X-Spam'] = true; switch(msgParam2) { case "on": unmaskTimeout = true; msgPrivate = 'Timeout messages will be sent to you for debugging...'; break; case "off": unmaskTimeout = false; msgPrivate = 'Timeout unmasking disabled...'; break; default: // invalid option msgPrivate = 'Invalid option, you must use on or off. Example: ' + botTrigger + ' unmask off'; break; } } else { // missing on/off value msgPrivate = 'Missing option, you must use on or off. Example: ' + botTrigger + ' unmask on'; } } else { msgPrivate = 'Only Creator can use the unmask command!'; } break; case 'greyemote': case 'greyemotes': case 'grayemote': case 'grayemotes': case 'emotes': case 'emote': if (isTS || isModel || isMod) { if (msgParam2) { message['X-Spam'] = true; switch(msgParam2) { case "on": allowGreyEmotes = true; msgPublic = name + ' has enabled grey emotes!'; break; case "off": allowGreyEmotes = false; msgPublic = name + ' has disabled grey emotes!'; break; default: // invalid option msgPrivate = 'Invalid option, you must use on or off. Example: ' + botTrigger + ' greyemotes off'; break; } } else { // missing on/off value msgPrivate = 'Missing option, you must use on or off. Example: ' + botTrigger + ' greyemotes on'; } } else { msgPrivate = 'Only broadcaster, mods and creator can disable or enable grey emotes!'; } break; case 'greets': case 'greetings': if(isModel || isTS) { if (msgParam2) { message['X-Spam'] = true; switch(msgParam2) { case "on": userGreets = true; msgPublic = name + ' has enabled User Greetings!'; break; case "off": userGreets = false; msgPublic = name + ' has disabled User Greetings!'; break; default: // invalid option msgPrivate = 'Invalid option, you must use on or off. Example: ' + botTrigger + ' greets off'; break; } } else { // missing on/off value msgPrivate = 'Missing option, you must use on or off. Example: ' + botTrigger + ' greets on'; } } else { msgPrivate = 'Only broadcaster and creator can enable or disable user greetings!'; } break; case "status": case "announce": message['X-Spam'] = true; msgPrivate = announceBot(); break; default: message['X-Spam'] = true; msgPrivate = 'You must provide a command. Type ' + botTrigger + ' help\n ...to get a list of options.'; break; } // Output any notices or command results to user if (msgPrivate.length > 0) { cb.sendNotice(msgPrivate, name, botMsgBg,'','bold'); msgPrivate = ""; } // Output any public notices or command results if (msgPublic.length > 0) { cb.sendNotice(msgPublic, '', botMsgBg,'','bold'); msgPublic = ""; } // Output any messages to the mods if (msgMod.length > 0) { cb.sendNotice(msgMod,'', botMsgBg,'','bold','red'); msgMod = ""; } // Output any messages to the model if (msgModel.length > 0) { cb.sendNotice(msgModel, modelName, botMsgBg,'','bold'); msgModel = ""; } } } // see if user envoked emotes that should be removed (no grey emotes) if (!isInGroup && !isTS && !isModel && !allowGreyEmotes && isGrey) { //user is grey, is not in a group, not TS, not model and grey emotes are not allowed if (msg.indexOf(':') > -1) { //colon found, replace all with _ msg = msg.replace(/:([^\s]+)/g,"[blocked emote]"); } } // apply group tags if (userColors[name]) { if (userColors[name].tag) { msgtemp = '[ ' + userColors[name].tag + ' ] '; } } else { if (groupTag) { msgtemp = groupTag + ' '; } } // add token amount if user tipped if (tippers[name]) { if (tippers[name].tips > 0) { msgtemp = msgtemp + '|' + tippers[name].tips + '| '; } } msg = msgtemp + msg; // if gender emotes are enabled, prefix message with correct gender if (genderEmotes) { switch (gender) { case 'm': genderStr = ':smurfgenderemote'; break; case 'f': genderStr = ':smurfettegenderemote'; break; case 's': genderStr = ':avatar_gen_trans'; break; case 'c': genderStr = ':smurfsgenderemote'; break; default: genderStr = ':avatar_gen_unknown'; break; } // set gender emote to crown if king for day if (tippers[name]) { if (tippers[name].king === true) { genderStr= ':rc_king3'; } } // special user icons if (isTS) { genderStr= ''; } msg = genderStr + ' ' + msg; } // show notice if user is in timeout if ( userInArray(timeoutUsersArray, name) ) { thisMessageTime = (new Date).getTime(); // simple trottle timeout message output to keep users from flooding room if ( (lastMessageName == name && (thisMessageTime > (lastMessgeTime + 4000))) || lastMessageName != name ) { selectedTimeoutMessage = Math.floor(Math.random() * 50) + 1; msg = timeoutMessages[selectedTimeoutMessage]; lastMessgeTime = (new Date).getTime(); lastMessageName = name; } else { message['X-Spam'] = true; msg = ""; cb.sendNotice("Jail Flood Protector Enabled! Message Blocked! Stop trying to flood the room! [only you are seeing this]", name, botMsgBg,'','bold'); } } else { if ( userInArray(ghostUsersArray, name) ) { // user is ghost message['X-Spam'] = true; msg = '[Ghost] ' + name + ' says: ' + message['m']; cb.sendNotice(msg,'', botGhostBg,'','bold'); } else { if ( userInArray(spamUsersArray, name) ) { // user is in spammer list message['X-Spam'] = true; msg = ""; } else { // check if username matches a pattern and add to spammer array if matched // a match should only be found if the spammer enters the room on a mobile device // that doesn't trigger the onEnter event. otherwise the onEnter event should // catch them when they enter for(i=0; i < lenOfSpamPatterns; i++) { if (isWordInString(spamPatternArray[i],name)) { result = addUser(spamUsersArray, name); msgPublic = 'Spammer ' + name + ' has been spotted and auto-muted by the smurf village Police!'; cb.sendNotice(msgPublic, '', botMsgBg,'','bold'); msgPublic = ""; message['X-Spam'] = true; msg = ""; break; } } } } } // does user have modified colors if (!userColors[name]) { // do nothing } else { // apply colors to message if in color array if (userColors[name].fgColor) { message['c'] = userColors[name].fgColor; } if (userColors[name].bgColor) { message['background'] = userColors[name].bgColor; } } // return final altered message message['m'] = msg; return message; } }); //end onMessage /* * bot functions */ /* * return string of tippers to display * can limit number of tippers returned to show only top 10, top 5 ect. */ function getTippers(topNumber) { var topTippers = new Array(); var tempTippers = objectToArray(tippers); var output = ''; tempTippers.sort(dynamicSort('-tips')); if (topNumber > 0) { topTippers = tempTippers.slice(0,topNumber); if (topTippers.length == 1) { output = '\nTop Tipper'; } else { output = '\nTop ' + topTippers.length + ' Tippers'; } } else { topTippers = tempTippers; output = '\nAll Tippers'; } if (topTippers.length > 0) { for (i = 0; i < topTippers.length; i++) { output += '\n' + topTippers[i].username + ': ' + topTippers[i].tips; } } else { output = '\nThere have been no tippers since the bot started!\n'; } return output + '\n'; } /* * check if a word or phrase is in a string */ function isWordInString(word,str) { var re = new RegExp(word,"i"); var n = str.search(re); if (n > -1) { return true; } else { return false; } } /* * add a user to the release array */ function addReleaseTime(userArray, username, timeoutMinutes) { var userArrayLength = userArray.length; username = username.toLowerCase(); // check if username is in userarray usernameExists = userInReleaseArray(userArray, username); if (usernameExists === true) { return "duplicate"; // username found in array, return duplicate } else { // add username to array currentEpoch = (new Date).getTime(); userArray[userArrayLength] = new Array(username,currentEpoch + (timeoutMinutes * 60000)); //userArray[userArrayLength][0] = username; //userArray[userArrayLength][1] = currentEpoch + timeoutMinutes * 60000; // check to see that addition of user worked usernameExists = userInReleaseArray(userArray, username); if (usernameExists === true) { return userArray; // it worked, return the array } else { return "failed"; // failed, return failed } } } function delReleaseTime(userArray, username) { var releaseArrayLength = userArray.length; var userElement = -1; username = username.toLowerCase(); if (userInReleaseArray(userArray, username)) { userElement = getRelaseArrayElement(userArray, username); if (userElement > -1) { tempArray = removeArrayElement(userArray, userElement); if (!userInReleaseArray(userArray, username)) { // user was removed return tempArray; } else { // user was not removed, failed return "failed"; } } else { //user element was not in array for some reason return "failed"; } } else { return 'notfound'; } } /* * remove users from timeout if their time has expired */ function releaseTimeouts() { // set current epoch time currentEpoch = (new Date).getTime(); //loop through all elements in timeout release array for (i = 0; i < timeoutReleaseArray.length; i++) { if (timeoutReleaseArray[i][1] < currentEpoch) { username = timeoutReleaseArray[i][0]; delUser(timeoutUsersArray, username); msgPublic += "User " + username + " has been released from Jail!\n"; delReleaseTime(timeoutReleaseArray, username); } } // setup next check call cb.setTimeout(releaseTimeouts, timeoutReleaseInterval * 60000); if (msgPublic) { cb.sendNotice(msgPublic, '', botMsgBg,'','bold'); msgPublic = ""; } } /* * display notification message and start interval timer */ function displayNotification1() { cb.sendNotice(autoNotice1Text,'',botNoteBg,'','bold'); cb.setTimeout(displayNotification1, cb.settings.autoNotice1Interval * 60000); } function displayNotification2() { cb.sendNotice(autoNotice2Text,'',botNoteBg,'','bold'); cb.setTimeout(displayNotification2, cb.settings.autoNotice2Interval * 60000); } function displayNotification3() { cb.sendNotice(autoNotice3Text,'',botNoteBg,'','bold'); cb.setTimeout(displayNotification3, cb.settings.autoNotice3Interval * 60000); } function displayNotification4() { cb.sendNotice(autoNotice4Text,'',botNoteBg,'','bold'); cb.setTimeout(displayNotification4, cb.settings.autoNotice4Interval * 60000); } function displayNotification5() { cb.sendNotice(autoNotice5Text,'',botNoteBg,'','bold'); cb.setTimeout(displayNotification5, cb.settings.autoNotice5Interval * 60000); } function displayNotification6() { cb.sendNotice(autoNotice6Text,'',botNoteBg,'','bold'); cb.setTimeout(displayNotification6, cb.settings.autoNotice6Interval * 60000); } function displayNotification7() { cb.sendNotice(autoNotice7Text,'',botNoteBg,'','bold'); cb.setTimeout(displayNotification7, cb.settings.autoNotice7Interval * 60000); } function displayNotification8() { cb.sendNotice(autoNotice8Text,'',botNoteBg,'','bold'); cb.setTimeout(displayNotification8, cb.settings.autoNotice8Interval * 60000); } function displayNotification9() { cb.sendNotice(autoNotice9Text,'',botNoteBg,'','bold'); cb.setTimeout(displayNotification9, cb.settings.autoNotice9Interval * 60000); } function displayNotification10() { cb.sendNotice(autoNotice10Text,'',botNoteBg,'','bold'); cb.setTimeout(displayNotification10, cb.settings.autoNotice10Interval * 60000); } function displayNotification11() { cb.sendNotice(autoNotice11Text,'',botNoteBg,'','bold'); cb.setTimeout(displayNotification11, cb.settings.autoNotice11Interval * 60000); } function displayNotification12() { cb.sendNotice(autoNotice12Text,'',botNoteBg,'','bold'); cb.setTimeout(displayNotification12, cb.settings.autoNotice12Interval * 60000); } function displayNotification13() { cb.sendNotice(autoNotice13Text,'',botNoteBg,'','bold'); cb.setTimeout(displayNotification13, cb.settings.autoNotice13Interval * 60000); } function displayNotification14() { cb.sendNotice(autoNotice14Text,'',botNoteBg,'','bold'); cb.setTimeout(displayNotification14, cb.settings.autoNotice14Interval * 60000); } function displayNotification15() { cb.sendNotice(autoNotice15Text,'',botNoteBg,'','bold'); cb.setTimeout(displayNotification15, cb.settings.autoNotice15Interval * 60000); } /* * return parameter value from a message string * Req: msgString = full message as string * Req: splitChr = character to split on (usually space) * Req: paramNumber = number of the parameter to return (first is 0) * Return: paramValue = value of the requested parameter */ function getParam(msgString,splitChr,paramNumber) { var tempArray = new Array(); tempArray = msgString.split(splitChr); paramValue = tempArray[paramNumber]; return paramValue; } /* * build a variable length divider from a character * Req: divChr = the character to use for the divier, ie: _ - * * Req: strLen = length of the data to be divided (lenth of a string, or fixed) * Req: maxDivLen = the max number of characters the div can grow to * Return: divStr = string of repeated character that make the divider */ function makeDiv(divChr, strLen, maxDivLen) { var divLen = 0; var divStr = ""; if (strLen > maxDivLen) { divLen = maxDivLen; } else { divLen = strLen; } while (divStr.length < divLen) { divStr = divChr + divStr; } return divStr; } /* * return array of users with the new user added, duplicate, * or error string. * Req: userArray = array of users to add the new user to * Req: username = username of new user * Return: array of users with new users added * On error: return "duplicate" if username in user array already * On error: return "failed" if user no duplicate and wasn't added */ function addUser(userArray, username) { var userArrayLength = userArray.length; username = username.toLowerCase(); // check if username is in userarray usernameExists = userInArray(userArray, username); if (usernameExists === true) { return "duplicate"; // username found in array, return duplicate } else { // remove user from all user arrays delUserFromAll(username); // add username to array userArray[userArrayLength] = username; // check to see that addition of user worked usernameExists = userInArray(userArray, username); if (usernameExists === true) { return userArray; // it worked, return the array } else { return "failed"; // failed, return failed } } } /* * return array of users with the new user removed, duplicate, * or error string. * Req: userArray = array of users to add the new user to * Req: username = username of new user * Return: array of users with user removed * On error: return "notfound" if username not in user array * On error: return "failed" if user no duplicate and wasn't added */ function delUser(userArray, username) { var userArrayLength = userArray.length; var userElement = -1; username = username.toLowerCase(); if (userInArray(userArray, username)) { userElement = getArrayElement(userArray, username); if (userElement > -1) { tempArray = removeArrayElement(userArray, userElement); if (!userInArray(userArray, username)) { // user was removed return tempArray; } else { // user was not removed, failed return "failed"; } } else { //user element was not in array for some reason return "failed"; } } else { return 'notfound'; } } /* * remove a user from all groups * Req: username = name over user to remove * Return: none */ function delUserFromAll(username) { if ( userInArray(smurfetteUsersArray, username) ) { result = delUser(smurfetteUsersArray, username); if (result instanceof Array) { smurfetteUsersArray = result; } } if ( userInArray(smurfsUsersArray, username) ) { result = delUser(smurfsUsersArray, username); if (result instanceof Array) { smurfsUsersArray = result; } } if ( userInArray(smurfUsersArray, username) ) { result = delUser(smurfUsersArray, username); if (result instanceof Array) { smurfUsersArray = result; } } if ( userInArray(friendsUsersArray, username) ) { result = delUser(friendsUsersArray, username); if (result instanceof Array) { friendsUsersArray = result; } } if ( userInArray(legendUsersArray, username) ) { result = delUser(legendUsersArray, username); if (result instanceof Array) { legendUsersArray = result; } } } /* retun group bg color */ function getGroupBgColor(username) { var bgc = "#ffffff"; if ( userInArray (smurfetteUsersArray, username) ) { bgc = smurfetteColor; } else { if ( userInArray (smurfsUsersArray, username) ) { bgc = smurfsColor; } else { if (userInArray(smurfUsersArray, username)) { bgc = smurfColor; } else { if (userInArray(friendsUsersArray, username)) { bgc = friendsColor; } else { if (userInArray(kinsgUsersArray, username)) { bgc = legendColor; } } } } } return bgc; } /* * return the element or index number of an array value * Req: sourceArray = array to parse * Req: value = value to find * Return: index of the element */ function getArrayElement(sourceArray, value) { var index = 0; for (i = 0; i < sourceArray.length; i++) { if (sourceArray[i] == value) { index = i; } } return index; } /* * same as getArrayElement but for timeout release array */ function getRelaseArrayElement(sourceArray, value) { var index = 0; for (i = 0; i < sourceArray.length; i++) { if (sourceArray[i][0] == value) { index = i; } } return index; } /* * dynamic sort function to sort array by a property * Borrowed from Asdfghjkl28 */ function dynamicSort(property) { var sortOrder = 1; if (property[0] === "-") { sortOrder = -1; property = property.substr(1, property.length - 1); } var sortfunc = function (a, b) { if (typeof a[property] === "undefined") { if (typeof b[property] === "undefined") { // both undef return 0; } else { // b ok, a undef return -1; } } if (typeof b[property] === "undefined") { if (typeof a[property] === "undefined") { // both undef return 0; } else { // a ok, b undef return 1; } } var result = (a[property] < b[property]) ? -1 : (a[property] > b[property]) ? 1 : 0; return result * sortOrder; }; return sortfunc; } /* * convert object to an array * Borrowed from Asdfghjkl28 */ function objectToArray(myObj) { var arr = []; for (var i in myObj) { if (myObj.hasOwnProperty(i)) { arr.push(myObj[i]); } } return arr; } /* * return an array with the indicated element removed * Req: sourceArray = array to be modified * Req: element = element to be removed * Return: the modified array */ function removeArrayElement(sourceArray,element) { sourceArray.splice(element, 1); return sourceArray; } /* * return boolean if user is in user array * Req: userArray = array of users to parse * Req: userName = name of user to parse fr * Returns: userFound = true or false */ function userInArray(userArray, username) { var userFound = false; username = username.toLowerCase(); if (userArray.length > 0) { for(i=0; i < userArray.length; i++) { if (userArray[i] == username) userFound = true; } } return userFound; } /* * return boolean if user is in user release array * Req: timeoutReleaseArray = array of users to parse * Req: username = name of user to parse fr * Returns: userFound = true or false */ function userInReleaseArray(userArray, username) { var userFound = false; username = username.toLowerCase(); if (userArray.length > 0) { for(i=0; i < userArray.length; i++) { if (userArray[i][0] == username) userFound = true; } } return userFound; } /* * return a string of usernames from an array of users * Req: userArray = array of users * Return: string of of usersnames */ function getUsers(userArray) { var userList = ""; for (i = 0; i < userArray.length; i++) { userList += userArray[i] + ' '; } return userList; } /* * return list of groups that a user is a member of * Req: username = username to find * Return: string with list of groups the user was found in */ function checkUser(username) { var groupList = ""; username = username.toLowerCase(); if (userInArray(smurfsUsersArray, username)) groupList += "Smurfs "; if (userInArray(smurfetteUsersArray, username)) groupList += "smurfette "; if (userInArray(smurfUsersArray, username)) groupList += "smurf "; if (userInArray(friendsUsersArray, username)) groupList += "friends "; if (userInArray(legendUsersArray, username)) groupList += "legend"; return groupList; } function daysUntilNext(month, day){ var tday= new Date(), y = tday.getFullYear(), next = new Date(y, month - 1, day); tday.setHours(0, 0, 0, 0); if(tday > next) next.setFullYear(y + 1); return Math.round((next - tday)/8.64e7); } function notModel() { var output = '\n\n' + modelName + '! This bot was created for '; output += 'smurf19, you are not her! Please consider having your own '; output += 'bot created. Contact dcinnewzealand on here or delia.chatrubate.ru@gmail.com\n\n'; return output; } function newStuff() { var output = '\nHi ' + modelName + '! '; output += 'Here are the newest features in version '+ botVersion +' of your bot!\n'; output += 'Use the help option to view the commands. Type /bot help \n'; return output; } function modWelcome() { var output = 'Greetings Moderator '; output += 'Welcome back'; output += 'to the smurf village'; return output; } /* * Builds user arrays and strings based on data provided by bot * config settings */ function loadSettings() { // grey graphics if (cb.settings.allowGreyEmotes == 'Yes') { allowGreyEmotes = true; } else { allowGreyEmotes = false; } // mod commands if (cb.settings.modCommands == 'Yes') { modCommands = true; } else { modCommands = false; } // greetings if (cb.settings.userGreets == 'Yes') { userGreets = true; } else { userGreets = false; } // gender emotes if (cb.settings.genderEmotes == 'Yes') { genderEmotes = true; } else { genderEmotes = false; } // load smurfs into array and other variables if (cb.settings.smurfetteList) { tempStr = cb.settings.smurfetteList.toLowerCase(); //make names all lowercase cb.settings.smurfetteList = tempStr.trim(); // remove extra spaces smurfetteUsersArray = cb.settings.smurfetteList.split(' '); } if (cb.settings.smurfetteTag) { smurfetteTag = cb.settings.smurfetteTag.trim(); } if (cb.settings.smurfetteColor) { tempArray = cb.settings.smurfetteColor.split(' '); smurfetteColor = '#' + tempArray[1]; } // load smurfs into array and other variables if (cb.settings.smurfsList) { tempStr = cb.settings.smurfsList.toLowerCase(); //make names all lowercase cb.settings.smurfsList = tempStr.trim(); // remove extra spaces smurfsUsersArray = cb.settings.smurfsList.split(' '); } if (cb.settings.smurfsTag) { smurfsTag = cb.settings.smurfsTag.trim(); } if (cb.settings.smurfsColor) { tempArray = cb.settings.smurfsColor.split(' '); smurfsColor = '#' + tempArray[1]; } // load lover into array and other variables if (cb.settings.smurfList) { tempStr = cb.settings.smurfList.toLowerCase(); //make names all lowercase cb.settings.smurfList = tempStr.trim(); // remove extra spaces smurfUsersArray = cb.settings.smurfList.split(' '); } if (cb.settings.smurfTag) { smurfTag = cb.settings.smurfTag.trim(); } if (cb.settings.smurfColor) { tempArray = cb.settings.smurfColor.split(' '); smurfColor = '#' + tempArray[1]; } // load friends into array and other variables if (cb.settings.friendsList) { tempStr = cb.settings.friendsList.toLowerCase(); //make names all lowercase cb.settings.friendsList = tempStr.trim(); // remove extra spaces friendsUsersArray = cb.settings.friendsList.split(' '); } if (cb.settings.friendsTag) { friendsTag = cb.settings.friendsTag.trim(); } if (cb.settings.friendsColor) { tempArray = cb.settings.friendsColor.split(' '); friendsColor = '#' + tempArray[1]; } // load king into array and other variables if (cb.settings.legendList) { tempStr = cb.settings.legendList.toLowerCase(); //make names all lowercase cb.settings.legendList = tempStr.trim(); // remove extra spaces legendUsersArray = cb.settings.legendList.split(' '); } if (cb.settings.legendTag) { legendTag = cb.settings.legendTag.trim(); } if (cb.settings.legendColor) { tempArray = cb.settings.legendColor.split(' '); legendColor = '#' + tempArray[1]; } // load spam pattern list into array if (cb.settings.spamPatternList) { tempStr = cb.settings.spamPatternList.toLowerCase(); //make patterns all lowercase cb.settings.spamPatternList = tempStr.trim(); // remove extra spaces spamPatternArray = cb.settings.spamPatternList.split(' '); } // load notifications if (cb.settings.autoNotice1) { autoNotice1Text = cb.settings.autoNotice1.trim(),'#FFFFFF'; } if (cb.settings.autoNotice2) { autoNotice2Text = cb.settings.autoNotice2.trim(),'#FFFFFF'; } if (cb.settings.autoNotice3) { autoNotice3Text = cb.settings.autoNotice3.trim(),'#FFFFFF'; } if (cb.settings.autoNotice4) { autoNotice4Text = cb.settings.autoNotice4.trim(),'#FFFFFF'; } if (cb.settings.autoNotice5) { autoNotice5Text = cb.settings.autoNotice5.trim(),'#FFFFFF'; } if (cb.settings.autoNotice6) { autoNotice6Text = cb.settings.autoNotice6.trim(),'#FFFFFF'; } if (cb.settings.autoNotice7) { autoNotice7Text = cb.settings.autoNotice7.trim(),'#FFFFFF'; } if (cb.settings.autoNotice8) { autoNotice8Text = cb.settings.autoNotice8.trim(),'#FFFFFF'; } if (cb.settings.autoNotice9) { autoNotice9Text = cb.settings.autoNotice9.trim(),'#FFFFFF'; } if (cb.settings.autoNotice10) { autoNotice10Text = cb.settings.autoNotice10.trim(),'#FFFFFF'; } if (cb.settings.autoNotice11) { autoNotice11Text = cb.settings.autoNotice11.trim(),'#FFFFFF'; } if (cb.settings.autoNotice12) { autoNotice12Text = cb.settings.autoNotice12.trim(),'#FFFFFF'; } if (cb.settings.autoNotice13) { autoNotice13Text = cb.settings.autoNotice13.trim(),'#FFFFFF'; } if (cb.settings.autoNotice14) { autoNotice14Text = cb.settings.autoNotice14.trim(),'#FFFFFF'; } if (cb.settings.autoNotice15) { autoNotice15Text = cb.settings.autoNotice15.trim(),'#FFFFFF'; } } function announceBot() { var divStr=""; var statusMsg = ""; divStr = makeDiv('*', 45, 45); statusMsg = divStr + '\nsmurf village Bot ver ' + botVersion + ' last updated ' + botDate + '\nCreated by dcinnewzealand\n' + divStr + '\n'; statusMsg += 'Gender Emotes: '; if (genderEmotes) { statusMsg += 'On'; } else { statusMsg += 'Off'; } statusMsg += '\n'; statusMsg += 'Grey Emotes: '; if (allowGreyEmotes) { statusMsg += 'On'; } else { statusMsg += 'Off'; } statusMsg += '\n'; statusMsg += 'Mod Commands: '; if (modCommands) { statusMsg += 'On'; } else { statusMsg += 'Off'; } statusMsg += '\n'; statusMsg += 'User Greetings: '; if (userGreets) { statusMsg += 'On'; } else { statusMsg += 'Off'; } statusMsg += '\n'; statusMsg += 'Number of smurfette: ' + smurfetteUsersArray.length + '\n'; statusMsg += 'Number in Smurfs: ' + smurfsUsersArray.length + '\n'; statusMsg += 'Number of smurf: ' + smurfUsersArray.length + '\n'; statusMsg += 'Number of friends: ' + friendsUsersArray.length + '\n'; statusMsg += 'Number of legend: ' + legendUsersArray.length + '\n'; statusMsg += 'Type - ' + botTrigger + ' help - for list commands\n'; statusMsg += divStr; statusMsg += '\nType /tipmenu for the Tip Menu\n'; statusMsg += divStr; return statusMsg; } if (!locked) { loadSettings(); cb.sendNotice(announceBot(),botMsgBg,'#FFFFFF','bold'); if (modelName !='smurf19') cb.sendNotice(notModel(),modelName,botAlertBg,'#FFFFFF','bold'); if (modelName == 'smurf19') cb.sendNotice(newStuff(),modelName,'#000000','#FFFF00','bold'); if (autoNotice1Text) cb.setTimeout(displayNotification1, cb.settings.autoNotice1Interval * 60000); if (autoNotice2Text) cb.setTimeout(displayNotification2, cb.settings.autoNotice2Interval * 60000); if (autoNotice3Text) cb.setTimeout(displayNotification3, cb.settings.autoNotice3Interval * 60000); if (autoNotice4Text) cb.setTimeout(displayNotification4, cb.settings.autoNotice4Interval * 60000); if (autoNotice5Text) cb.setTimeout(displayNotification5, cb.settings.autoNotice5Interval * 60000); if (autoNotice6Text) cb.setTimeout(displayNotification6, cb.settings.autoNotice6Interval * 60000); if (autoNotice7Text) cb.setTimeout(displayNotification7, cb.settings.autoNotice7Interval * 60000); if (autoNotice8Text) cb.setTimeout(displayNotification8, cb.settings.autoNotice8Interval * 60000); if (autoNotice9Text) cb.setTimeout(displayNotification9, cb.settings.autoNotice9Interval * 60000); if (autoNotice10Text) cb.setTimeout(displayNotification10, cb.settings.autoNotice10Interval * 60000); if (autoNotice11Text) cb.setTimeout(displayNotification11, cb.settings.autoNotice11Interval * 60000); if (autoNotice12Text) cb.setTimeout(displayNotification12, cb.settings.autoNotice12Interval * 60000); if (autoNotice13Text) cb.setTimeout(displayNotification13, cb.settings.autoNotice13Interval * 60000); if (autoNotice14Text) cb.setTimeout(displayNotification14, cb.settings.autoNotice14Interval * 60000); if (autoNotice15Text) cb.setTimeout(displayNotification15, cb.settings.autoNotice15Interval * 60000); // start timeout release event cb.setTimeout(releaseTimeouts, timeoutReleaseInterval * 60000); } { var i=0; var MAXITEMS=10; cb.settings_choices = [ {name: 'msgonentry', type: 'choice', choice1: 'yes', choice2: 'no', defaultValue: 'yes', label: "Display Message 1 privately on entry - set to no for busy rooms"}, {name:'msg1', type:'str', required: true, label:'Message 1',}, {name:'msg2', type:'str', required: false, label:'Message 2',}, {name:'msg3', type:'str', required: false, label:'Message 3',}, {name:'msg4', type:'str', required: false, label:'Message 4',}, {name:'msg5', type:'str', required: false, label:'Message 5',}, {name:'msg6', type:'str', required: false, label:'Message 6',}, {name:'msg7', type:'str', required: false, label:'Message 7',}, {name:'msg8', type:'str', required: false, label:'Message 8',}, {name:'msg9', type:'str', required: false, label:'Message 9',}, {name:'msg10', type:'str', required: false, label:'Message 10',}, {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: 2, label: 'Delay in minutes between notices being displayed (minimum 1)'} ]; cb.onEnter(function(user) { if (cb.settings['msgonentry'] == 'yes') { cb.sendNotice('Welcome ' + user['user'] + '! ' + cb.settings['msg1'],user['user'],'',cb.settings['msgcolor'],'bold'); } }); function chatAd() { var msg; while (cb.settings['msg' + (i + 1)] == 0) { //skip empty messages i++; i %= MAXITEMS; } msg = cb.settings['msg' + (i + 1)]; i++; i %= MAXITEMS; cb.sendNotice(msg,'','',cb.settings['msgcolor'],'bold'); cb.setTimeout(chatAd, (cb.settings.chat_ad * 60000)); } cb.setTimeout(chatAd, (cb.settings.chat_ad * 60000)); }
© Copyright Chaturbate 2011- 2026. All Rights Reserved.