Bots Home
|
Create an App
Kori's Friends
Author:
theredpirate
Description
Source Code
Launch Bot
Current Users
Created by:
Theredpirate
/************************************************************* ** ** Title: Korri's Friends ** Author: modified by theredpirate ** Version: 1.0.0 ** Description: Chat bot for use by Korii - chaturbate.com/ ** *************************************************************/ /* * Setup vars */ var CaptainRedbeardUsersArray = new Array(); var LoverUsersArray = new Array(); var PrinceUsersArray = new Array(); var KingUsersArray = new Array(); var AngelUsersArray = new Array(); var PervUsersArray = new Array(); var NaughtyUsersArray = new Array(); var specialNames = new Array(); var tempString = ""; var tempArray = new Array(); var botVersion = "1.2.5"; var modelName = cb.room_slug; var msgNotify = ""; var msgPublic = ""; var msgPrivate = ""; var msgModel = ""; var autoNotice1Text = ""; var autoNotice2Text = ""; var botTrigger = "/alibot"; var modCommands = true; var userGreets = true; var genderEmotes = true; var botMsgBg = '#BDDEDC'; var botAlertBg = '#D32B2B'; var botNoteBg = '#99FF66'; specialNames[0] = new Array('ime','tekst'); specialNames[1] = new Array('ime','tekst'); specialNames[2] = new Array('ime','tekst'); specialNames[3] = new Array('ime','tekst'); specialNames[4] = new Array('ime','tekst'); /* * Settings */ cb.settings_choices = [ { name: 'genderEmotes', type: 'choice', label: '**NEW FEATURE** Show gender of users in chat?', choice1: 'Yes', choice2: 'No', defaultValue: 'No' }, { name: 'autoNotice1', label: '**NEW FEATURE** 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: 2, choice2: 5, choice3: 8, choice4: 10, choice5: 12, choice6: 15, choice7: 20, choice8: 25, choice9: 30, choice10: 45, choice11: 60, defaultValue: 8 }, { 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: 2, choice2: 5, choice3: 8, choice4: 10, choice5: 12, choice6: 15, choice7: 20, choice8: 25, choice9: 30, choice10: 45, choice11: 60, defaultValue: 8 }, { name: 'modCommands', type: 'choice', label: 'Allow Moderators to use commands?', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes' }, { name: 'userGreets', type: 'choice', label: 'Make special user announcements when they enter?', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes' }, { name: 'captainredbeardTag', label: '*** captainredbeards *** *** *** Tag for captainredbeard users', type: 'str', minLength: 0, maxLength: 25, required: true, defaultValue: '[captainredbeard]' }, { name: 'captainredbeardList', label: 'List of captainredbeard users, separated by space (their CB usernames exactly)', type: 'str', minLength: 0, maxLength: 10240, required: false, defaultValue: 'brandizal micky88' }, { name: 'captainredbeardColor', label: 'Highlight color to use for captainredbeard users', type: 'choice', choice1: 'Blue 008CC0', choice2: 'Black 00000', choice3: 'Purple CD73EB', choice4: 'Cyan 73EBEB', choice5: 'Blue 73B5EB', choice6: 'Yellow FCED79', choice7: 'Red FF4A4A', choice8: 'Pink FF99F8', choice9: 'Orange FFC517', defaultValue: 'Blue 008CC0' }, { name: 'LoverTag', label: '*** Lovers *** *** *** Tag for Lover users', type: 'str', minLength: 0, maxLength: 25, required: true, defaultValue: '[Lover]' }, { name: 'LoverList', label: 'List of Lover users, separated by space (their CB usernames exactly)', type: 'str', minLength: 0, maxLength: 10240, required: false, defaultValue: 'mulder723 20051004' }, { name: 'LoverColor', label: 'Highlight color to use for Lover users', type: 'choice', choice1: 'Brown A37100', choice2: 'Green 004413', choice3: 'Purple CD73EB', choice4: 'Cyan 73EBEB', choice5: 'Blue 73B5EB', choice6: 'Yellow FCED79', choice7: 'Red FF4A4A', choice8: 'Pink FF99F8', choice9: 'Orange FFC517', defaultValue: 'Brown A37100' }, { name: 'PrinceTag', label: '*** Princes *** *** *** Tag for Prince users', type: 'str', minLength: 0, maxLength: 25, required: true, defaultValue: '[Prince]' }, { name: 'PrinceList', label: 'List of Princes users, separated by space (their CB usernames exactly)', type: 'str', minLength: 0, maxLength: 10240, required: false, defaultValue: '' }, { name: 'PrinceColor', label: 'Highlight color to use for Prince users', type: 'choice', choice1: 'OliveGreen 749300', choice2: 'Brown A37100', choice3: 'Purple CD73EB', choice4: 'Cyan 73EBEB', choice5: 'Blue 73B5EB', choice6: 'Yellow FCED79', choice7: 'Red FF4A4A', choice8: 'Pink FF99F8', choice9: 'Orange FFC517', defaultValue: 'OliveGreen 749300' }, { name: 'KingTag', label: '*** Kings *** *** *** Tag for King users', type: 'str', minLength: 0, maxLength: 25, required: true, defaultValue: '[King]' }, { name: 'KingList', label: 'List of King users, separated by space (their CB usernames exactly)', type: 'str', minLength: 0, maxLength: 10240, required: false, defaultValue: 'dragonblags' }, { name: 'KingColor', label: 'Highlight color to use for King users', type: 'choice', choice1: 'Purple B300DB', choice2: 'Purple B300DB', choice3: 'Purple CD73EB', choice4: 'Cyan 73EBEB', choice5: 'Green 91EB73', choice6: 'Yellow FCED79', choice7: 'Red FF4A4A', choice8: 'Pink FF99F8', choice9: 'Orange FFC517', defaultValue: 'Purple B300DB' }, { name: 'AngelTag', label: '*** Angels *** *** *** Tag for Angel users', type: 'str', minLength: 0, maxLength: 25, required: true, defaultValue: '[Angel]' }, { name: 'AngelList', label: 'List of Angel users, separated by space (their CB usernames exactly)', type: 'str', minLength: 0, maxLength: 10240, required: false, defaultValue: '' }, { name: 'AngelColor', label: 'Highlight color to use for Angel users', type: 'choice', choice1: 'DarkRed af006e', choice2: 'Blue 5098ff', choice3: 'Green 91EB73', choice4: 'Cyan 73EBEB', choice5: 'Blue 73B5EB', choice6: 'Yellow FCED79', choice7: 'Red FF4A4A', choice8: 'Pink FF99F8', choice9: 'Orange FFC517', defaultValue: 'DarkRed af006e' }, { name: 'PervTag', label: '*** Perv *** *** *** Tag for Pervs users', type: 'str', minLength: 0, maxLength: 25, required: true, defaultValue: '[Perv]' }, { name: 'PervList', label: 'List of Perv users, separated by space (their CB usernames exactly)', type: 'str', minLength: 0, maxLength: 10240, required: false, defaultValue: 'theredpirate' }, { name: 'PervColor', label: 'Highlight color to use for Perv users', type: 'choice', choice1: 'MyGreen 008B83', choice2: 'Green 91EB73', choice3: 'Purple CD73EB', choice4: 'Cyan 73EBEB', choice5: 'Blue 73B5EB', choice6: 'Yellow FCED79', choice7: 'Red FF4A4A', choice8: 'Pink FF99F8', choice9: 'Orange FFC517', defaultValue: 'MyGreen 008B83' }, { name: 'NaughtyTag', label: '*** Naughty *** *** *** Tag for Naughty users', type: 'str', minLength: 0, maxLength: 25, required: true, defaultValue: '[Naughty]' }, { name: 'NaughtyList', label: 'List of Naughty users, separated by space (their CB usernames exactly)', type: 'str', minLength: 0, maxLength: 10240, required: false, defaultValue: 'Koriandrr' }, { name: 'NaughtyColor', label: 'Highlight color to use for Naughty users', type: 'choice', choice1: 'Red ff0000', choice2: 'Green 008b83', choice3: 'Purple CD73EB', choice4: 'Cyan 73EBEB', choice5: 'Blue 73B5EB', choice6: 'Yellow FCED79', choice7: 'Red FF4A4A', choice8: 'Pink FF99F8', choice9: 'Orange FFC517', defaultValue: 'Red ff0000' }, ]; /* * handle tips from users */ var totalTipped = 0; cb.onTip(function (tip) { var divStr = ""; var msgText = ""; var msgNotify = ""; var tipAmount = parseInt(tip['amount']); var name = tip['from_user']; var modelName = cb.room_slug; switch(tipAmount) { case 200000: result = addUser(NaughtyUsersArray, name); if (result instanceof Array) { NaughtyUsersArray = result; msgPublic = name + ' is now ' + modelName + '\'s Naughty !!! Thank you for your tip! :hat12 '; msgModel = modelName + ', don\'t forget to add ' + name + ' to Naughty in the bot config!'; } else { if (result == 'duplicate') { msgPublic = name + ' is already ' + modelName + '\'s Naughty !!! Thank you for your tip :hat12 !';; } else { msgPublic = 'Failed to add user ' + name + ' to Naughty. Something went wrong!'; } } break; case 100000: result = addUser(PervUsersArray, name); if (result instanceof Array) { PervUsersArray = result; msgPublic = name + ' is now ' + modelName + '\'s Perv !!! Thank you for your tip! :hat12 '; msgModel = modelName + ', don\'t forget to add ' + name + ' to Pervs in the bot config!'; } else { if (result == 'duplicate') { msgPublic = name + ' is already ' + modelName + '\'s Perv !!! Thank you for your tip :hat12 !';; } else { msgPublic = 'Failed to add user ' + name + ' to Perv. Something went wrong!'; } } break; case 1111: result = addUser(AngelUsersArray, name); if (result instanceof Array) { AngelUsersArray = result; msgPublic = name + ' is now ' + modelName + '\'s Angel !!! Thank you for your tip! :hat12 '; msgModel = modelName + ', don\'t forget to add ' + name + ' to Angels in the bot config!'; } else { if (result == 'duplicate') { msgPublic = name + ' is already ' + modelName + '\'s Angel !!! Thank you for your tip :hat12 !';; } else { msgPublic = 'Failed to add user ' + name + ' to Angels. Something went wrong!'; } } break; case 250: if (!userInArray (AngelUsersArray, name) ) { result = addUser(KingUsersArray, name); if (result instanceof Array) { KingUsersArray = result; msgPublic = name + ' is now ' + modelName + '\'s King!!! Thank you for your tip :hat12 !'; msgModel = modelName + ', don\'t forget to add ' + name + ' to Kings in the bot config!'; } else { if (result == 'duplicate') { msgPublic = name + ' is already ' + modelName + '\'s King !!! Thank you for your tip :hat12 !';; } else { msgPublic = 'Failed to add user ' + name + ' to Kings. Something went wrong!'; } } } else { msgPublic = name + ' is already has a higher status than King ! Status not changed. Thank you for your tip!'; } break; case 150: if (!userInArray (AngelUsersArray, name) && !userInArray (KingUsersArray, name)) { result = addUser(PrinceUsersArray, name); if (result instanceof Array) { PrinceUsersArray = result; msgPublic = name + ' is now ' + modelName + '\'s Prince!!! Thank you for your tip :hat12 !'; msgModel = modelName + ', don\'t forget to add ' + name + ' to Princes in the bot config!'; } else { if (result == 'duplicate') { msgPublic = name + ' is already ' + modelName + '\'s Prince !!! Thank you for your tip :hat12 !';; } else { msgPublic = 'Failed to add user ' + name + ' to Princes. Something went wrong!'; } } } else { msgPublic = name + ' already has a higher status than Prince ! Status not changed. Thank you for your tip!'; } break; case 50: if (!userInArray (AngelUsersArray, name) && !userInArray (KingUsersArray, name) && !userInArray (PrinceUsersArray, name)) { result = addUser(LoverUsersArray, name); if (result instanceof Array) { LoverUsersArray = result; msgPublic = name + ' is now in ' + modelName + '\'s Lover!!! Thank you for your tip :hat12 !'; msgModel = modelName + ', don\'t forget to add ' + name + ' to Lovers in the bot config!'; } else { if (result == 'duplicate') { msgPublic = name + ' is already in ' + modelName + '\'s Lover !!! Thank you for your tip :hat12 !';; } else { msgPublic = 'Failed to add user ' + name + ' to Lover. Something went wrong!'; } } } else { msgPublic = name + ' already has a higher status than Lover ! Status not changed. Thank you for your tip!'; } break; case 0: if (!userInArray (AngelUsersArray, name) && !userInArray (KingUsersArray, name) && !userInArray (PrinceUsersArray, name) && !userInArray (LoverUsersArray, name)) { result = addUser(captainredbeardUsersArray, name); if (result instanceof Array) { captainredbeardUsersArray = result; msgPublic = name + ' is now in ' + modelName + '\'s captainredbeard!!! Thank you for your tip!'; msgModel = modelName + ', don\'t forget to add ' + name + ' to captainredbeards in the bot config!'; } else { if (result == 'duplicate') { msgPublic = name + ' is already in ' + modelName + '\'s captainredbeard !!! Thank you for your tip!';; } else { msgPublic = 'Failed to add user ' + name + ' to captainredbeard. Something went wrong!'; } } } else { msgPublic = name + ' already has a higher status than captainredbeard ! Status not changed. Thank you for your tip!'; } break; default: msgPublic = 'Thank you ' + name + ' for your tip of ' + tipAmount; if (tipAmount == 1) { msgPublic += ' token!'; } else { msgPublic += ' tokens!'; } break; } // Output any notices or command results to user if (msgPrivate.length > 0) { cb.chatNotice(msgNotify, name, botMsgBg,'','bold'); msgPrivate = ""; } // Output any public notices or command results if (msgPublic.length > 0) { cb.chatNotice(msgPublic, '', botMsgBg,'','bold'); msgPublic = ""; } // Output any messages to the model if (msgModel.length > 0) { cb.chatNotice(msgModel, modelName, botMsgBg,'','bold'); msgModel = ""; } }); /* * handle user entrance messages */ cb.onEnter(function(user) { var lenOfSpecialNames = 0; var nameFound = false; var greeting = ''; var modelName = cb.room_slug; name = user['user']; lenOfSpecialNames = specialNames.length; for(i=0; i < lenOfSpecialNames; i++) { if (specialNames[i][0] == name) { greeting = specialNames[i][1]; nameFound = true; break; } } if (nameFound && userGreets) { cb.chatNotice(greeting,'','#FFFFFF'); } else { if (userGreets) { if ( userInArray (captainredbeardUsersArray, user['user']) ) { cb.chatNotice('Welcome captainredbeard ' + user['user'] + ' to the room!','',captainredbeardColor,'','bold'); } else { if ( userInArray (LoverUsersArray, user['user']) ) { cb.chatNotice('Welcome Lover ' + user['user'] + ' to the room!','',LoverColor,'','bold'); } else { if (userInArray(PrinceUsersArray, user['user'])) { cb.chatNotice('Welcome Prince ' + user['user'] + ' to the room!','',PrinceColor,'','bold'); } else { if (userInArray(KingUsersArray, user['user'])) { cb.chatNotice('Welcome King ' + user['user'] + ' to the room!','',KingColor,'','bold'); } else { if (userInArray(AngelUsersArray, user['user'])) { cb.chatNotice('Welcome Angel ' + user['user'] + ' to the room!','',AngelColor,'','bold'); } else { if (userInArray(PervUsersArray, user['user'])) { cb.chatNotice('Welcome Perv ' + user['user'] + ' to the room!','',PervColor,'','bold'); } else { if (userInArray(NaughtyUsersArray, user['user'])) { cb.chatNotice('Welcome Naughty ' + user['user'] + ' to the room!','',NaughtyColor,'','bold'); } } } } } } } } } if (genderEmotes) { cb.chatNotice('Gender Emotes are enabled: :avatar_gen_male = Male User :avatar_gen_female = Female User\n :avatar_gen_couple = Couple User :avatar_gen_trans = Transgender User\n :avatar_gen_unknown = Gender Unknown\n\n',user['user'],'#ffffff','','bold'); } if (modelName != 'Koriandrr') { cb.chatNotice('\nThis is NOT Korri\'s room!\nThis bot was created for Korri chaturbate.com/Koriandrr\nFollow her and visit her room on CB!\n\n\n',user['user'],botAlertBg,'','bold'); } }); /* * handle messages from users */ cb.onMessage(function(message) { var msg = message['m']; var colour = message['c']; 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 == 'theredpirate'); var isReal = (cb.room_slug == 'Koriandrr'); 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 = tempAllowMsg = "Only " + modelName; var userArray = new Array(); var userList = ""; var showOutput = true; var genderStr = ""; if (modCommands) { tempAllowMsg = modelName + " and mods"; } helpMsg = tempAllowMsg + " may use the following commands:\n" + botTrigger + " view [Princes] = list of level users\n" + botTrigger + " useradd [Princes] [username] = add username to level\n" + botTrigger + " userdel [Princes] [username] = delete username from level\n" + botTrigger + " check [username] = show what level a user is in\n" + botTrigger + " mods [on/off] = turns on/off mod commands\n" + botTrigger + " greets [on/off] = turns on/off level user greetings\n" + botTrigger + " status = show bot status\n" + "*** NOTE: To make names stick add them in the bot config."; // handle commands if ( isModel || (isMod && (modCommands === true)) || isTS ) { if (msg.indexOf(botTrigger) > -1) { msgParam1 = getParam(msg,' ',1); msgParam2 = getParam(msg,' ',2); msgParam3 = getParam(msg,' ',3); msgParam4 = getParam(msg,' ',4); switch(msgParam1) { case 'help': message['X-Spam'] = true; divStr = makeDiv('_',50,50); msgPrivate = divStr + '\Korris Friends ver ' + botVersion + '\nmodified by theredpirate\n' + divStr + '\n'; msgPrivate += helpMsg + '\n' + divStr; 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 "captainredbeard": case "captainredbeards": userArray = captainredbeardUsersArray; break; case "Lover": case "Lovers": userArray = LoverUsersArray; break; case "Prince": case "Princes": userArray = PrinceUsersArray; break; case "King": case "Kings": userArray = KingUsersArray; break; case "Angel": case "Angels": userArray = AngelUsersArray; break; case "Perv": case "Pervs": userArray = PervUsersArray; break; case "Naughty": case "Naughtys": userArray = NaughtyUsersArray; break; default: showOutput = false; msgPrivate = "You must provide a group name to list: captainredbeard Lover Prince King Angel Perv"; 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': var validSyntax = true; // check that we got 3 parameters if (msgParam3) { // which user array are we updating? switch(msgParam2) { case "captainredbeard": case "captainredbeards": result = addUser(captainredbeardUsersArray, msgParam3); if (result instanceof Array) { captainredbeardUsersArray = result; msgPublic = name + ' added ' + msgParam3 + ' to the list of captainredbeards!'; // if model didn't issue command remind model to update the bot if (!isModel) { msgModel = modelName + ', don\'t forget to add ' + msgParam3 + ' to the captainredbeards list in the bot config!'; } } else { if (result == 'duplicate') { msgPrivate = 'Failed to add user ' + msgParam3 + ' because they are already in captainredbeard!'; } else { msgPrivate = 'Failed to add user ' + msgParam3 + ' to captainredbeard. Something went wrong!'; } } break; case "Lover": case "Lovers": result = addUser(LoverUsersArray, msgParam3); if (result instanceof Array) { LoverUsersArray = result; msgPublic = name + ' added ' + msgParam3 + ' to the list of Lovers!'; // if model didn't issue command remind model to update the bot if (!isModel) { msgModel = modelName + ', don\'t forget to add ' + msgParam3 + ' to Lovers in the bot config!'; } } else { if (result == 'duplicate') { msgPrivate = 'Failed to add user ' + msgParam3 + ' because they are already in Lovers!'; } else { msgPrivate = 'Failed to add user ' + msgParam3 + ' to Lovers. Something went wrong!'; } } break; case "Prince": case "Princes": result = addUser(PrinceUsersArray, msgParam3); if (result instanceof Array) { PrinceUsersArray = result; msgPublic = name + ' added ' + msgParam3 + ' to the list of Princes!'; // if model didn't issue command remind model to update the bot if (!isModel) { msgModel = modelName + ', don\'t forget to add ' + msgParam3 + ' to Princes in the bot config!'; } } else { if (result == 'duplicate') { msgPrivate = 'Failed to add user ' + msgParam3 + ' because they are already in Princes!'; } else { msgPrivate = 'Failed to add user ' + msgParam3 + ' to Princes. Something went wrong!'; } } break; case "King": case "Kings": result = addUser(KingUsersArray, msgParam3); if (result instanceof Array) { KingUsersArray = result; msgPublic = name + ' added ' + msgParam3 + ' to the list of Kings!'; // if model didn't issue command remind model to update the bot if (!isModel) { msgModel = modelName + ', don\'t forget to add ' + msgParam3 + ' to Kings in the bot config!'; } } else { if (result == 'duplicate') { msgPrivate = 'Failed to add user ' + msgParam3 + ' because they are already in Kings!'; } else { msgPrivate = 'Failed to add user ' + msgParam3 + ' to Kings. Something went wrong!'; } } break; case "Angel": case "Angels": result = addUser(AngelUsersArray, msgParam3); if (result instanceof Array) { AngelUsersArray = result; msgPublic = name + ' added ' + msgParam3 + ' to the list of Angels!'; // if model didn't issue command remind model to update the bot if (!isModel) { msgModel = modelName + ', don\'t forget to add ' + msgParam3 + ' to Angels in the bot config!'; } } else { if (result == 'duplicate') { msgPrivate = 'Failed to add user ' + msgParam3 + ' because they are already in Angels!'; } else { msgPrivate = 'Failed to add user ' + msgParam3 + ' to Angels. Something went wrong!'; } } break; case "Perv": case "Pervs": result = addUser(PervUsersArray, msgParam3); if (result instanceof Array) { PervUsersArray = result; msgPublic = name + ' added ' + msgParam3 + ' to the list of Perv!'; // if model didn't issue command remind model to update the bot if (!isModel) { msgModel = modelName + ', don\'t forget to add ' + msgParam3 + ' to Perv in the bot config!'; } } else { if (result == 'duplicate') { msgPrivate = 'Failed to add user ' + msgParam3 + ' because they are already in Perv!'; } else { msgPrivate = 'Failed to add user ' + msgParam3 + ' to Perv. Something went wrong!'; } } break; case "Naughty": case "Naughtys": result = addUser(NaughtyUsersArray, msgParam3); if (result instanceof Array) { NaughtyUsersArray = result; msgPublic = name + ' added ' + msgParam3 + ' to the list of Naughtys!'; // if model didn't issue command remind model to update the bot if (!isModel) { msgModel = modelName + ', don\'t forget to add ' + msgParam3 + ' to Naughtys in the bot config!'; } } else { if (result == 'duplicate') { msgPrivate = 'Failed to add user ' + msgParam3 + ' because they are already in Naughtys!'; } else { msgPrivate = 'Failed to add user ' + msgParam3 + ' to Naughtys. Something went wrong!'; } } break; default: validSyntax = false; msgPrivate = 'You didn\'t supply a valid group to add the user to. Valid groups are:\n'; msgPrivate += 'captainredbeard Lover Prince King Angel Perv ... choose only one.'; break; } } else { validSyntax = false; msgPrivate = 'You must provide the group and the username you wish to add. For example,\n' + botTrigger + ' adduser Prince someusername\n'; msgPrivate += 'or ' + botTrigger + ' adduser King someuser'; } if (validSyntax === true) { message['X-Spam'] = true; } break; case 'userdel': case 'deluser': case 'delete': case 'remove': var validSyntax = true; // check that we got 3 parameters if (msgParam3) { // which user array are we updating? switch(msgParam2) { case "captainredbeard": case "captainredbeards": result = delUser(captainredbeardUsersArray, msgParam3); if (result instanceof Array) { captainredbeardUsersArray = result; msgPublic = name + ' removed ' + msgParam3 + ' from the list of captainredbeards!'; // if model didn't issue command remind model to update the bot if (!isModel) { msgModel = modelName + ', don\'t forget to remove ' + msgParam3 + ' from the captainredbeard list in the bot config!'; } } else { if (result == 'notfound') { msgPrivate = 'Failed to remove user ' + msgParam3 + ' because they are not in captainredbeard!'; } else { msgPrivate = 'Failed to remove user ' + msgParam3 + ' from captainredbeard. Something went wrong!'; } } break; case "Lover": case "Lovers": result = delUser(LoverUsersArray, msgParam3); if (result instanceof Array) { LoverUsersArray = result; msgPublic = name + ' removed ' + msgParam3 + ' from the list of Lovers!'; // if model didn't issue command remind model to update the bot if (!isModel) { msgModel = modelName + ', don\'t forget to remove ' + msgParam3 + ' from Lovers in the bot config!'; } } else { if (result == 'notfound') { msgPrivate = 'Failed to remove user ' + msgParam3 + ' because they are not in Lovers!'; } else { msgPrivate = 'Failed to remove user ' + msgParam3 + ' from Lovers. Something went wrong!'; } } break; case "Prince": case "Princes": result = delUser(PrinceUsersArray, msgParam3); if (result instanceof Array) { PrinceUsersArray = result; msgPublic = name + ' removed ' + msgParam3 + ' from the list of Princes!'; // if model didn't issue command remind model to update the bot if (!isModel) { msgModel = modelName + ', don\'t forget to remove ' + msgParam3 + ' from Princes in the bot config!'; } } else { if (result == 'notfound') { msgPrivate = 'Failed to remove user ' + msgParam3 + ' because they are not in Princes!'; } else { msgPrivate = 'Failed to remove user ' + msgParam3 + ' from Princes. Something went wrong!'; } } break; case "King": case "Kings": result = delUser(KingUsersArray, msgParam3); if (result instanceof Array) { KingUsersArray = result; msgPublic = name + ' removed ' + msgParam3 + ' from the list of Kings!'; // if model didn't issue command remind model to update the bot if (!isModel) { msgModel = modelName + ', don\'t forget to remove ' + msgParam3 + ' from Kings in the bot config!'; } } else { if (result == 'notfound') { msgPrivate = 'Failed to remove user ' + msgParam3 + ' because they are not in Kings!'; } else { msgPrivate = 'Failed to remove user ' + msgParam3 + ' to Kings. Something went wrong!'; } } break; case "Angel": case "Angels": result = delUser(AngelUsersArray, msgParam3); if (result instanceof Array) { AngelUsersArray = result; msgPublic = name + ' removed ' + msgParam3 + ' to the list of Angels!'; // if model didn't issue command remind model to update the bot if (!isModel) { msgModel = modelName + ', don\'t forget to remove ' + msgParam3 + ' from Angels in the bot config!'; } } else { if (result == 'notfound') { msgPrivate = 'Failed to remove user ' + msgParam3 + ' because they are not in Angels!'; } else { msgPrivate = 'Failed to remove user ' + msgParam3 + ' to Angels. Something went wrong!'; } } break; case "Perv": case "Perv": result = delUser(PervUsersArray, msgParam3); if (result instanceof Array) { PervUsersArray = result; msgPublic = name + ' removed ' + msgParam3 + ' from the list of Perv!'; // if model didn't issue command remind model to update the bot if (!isModel) { msgModel = modelName + ', don\'t forget to remove ' + msgParam3 + ' from Perv in the bot config!'; } } else { if (result == 'notfound') { msgPrivate = 'Failed to remove user ' + msgParam3 + ' because they are not in Perv!'; } else { msgPrivate = 'Failed to remove user ' + msgParam3 + ' to Perv. Something went wrong!'; } } break; case "Naughty": case "Naughtys": result = delUser(NaughtyUsersArray, msgParam3); if (result instanceof Array) { NaughtyUsersArray = result; msgPublic = name + ' removed ' + msgParam3 + ' from the list of Naughtys!'; // if model didn't issue command remind model to update the bot if (!isModel) { msgModel = modelName + ', don\'t forget to remove ' + msgParam3 + ' from Naughtys in the bot config!'; } } else { if (result == 'notfound') { msgPrivate = 'Failed to remove user ' + msgParam3 + ' because they are not in Naughtys!'; } else { msgPrivate = 'Failed to remove user ' + msgParam3 + ' to Naughtys. Something went wrong!'; } } break; default: validSyntax = false; msgPrivate = 'You didn\'t supply a valid group to remove the user from. Valid groups are:\n'; msgPrivate += 'captainredbeard Lover Prince King Angel Perv ... choose only one.'; break; } } else { validSyntax = false; msgPrivate = 'You must provide the group and the username you wish to remove. For example,\n' + botTrigger + ' deluser Prince someusername\n'; msgPrivate += 'or ' + botTrigger + ' deluser King someuser'; } 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'; } } 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'; } } 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.chatNotice(msgPrivate, name, botMsgBg,'','bold'); msgPrivate = ""; } // Output any public notices or command results if (msgPublic.length > 0) { cb.chatNotice(msgPublic, '', botMsgBg,'','bold'); msgPublic = ""; } // Output any messages to the model if (msgModel.length > 0) { cb.chatNotice(msgModel, modelName, botMsgBg,'','bold'); msgModel = ""; } } } // if user is in a group, add the group tag to their message // and change the text color if ( userInArray (captainredbeardUsersArray, name) ) { message['c'] = captainredbeardColor; message['m'] = captainredbeardTag + ' ' + message['m']; } else { if ( userInArray (LoverUsersArray, name) ) { message['c'] = LoverColor; message['m'] = LoverTag + ' ' + message['m']; } else { if (userInArray(PrinceUsersArray, name)) { message['c'] = PrinceColor; message['m'] = PrinceTag + ' ' + message['m']; } else { if (userInArray(KingUsersArray, name)) { message['c'] = KingColor; message['m'] = KingTag + ' ' + message['m']; } else { if (userInArray(AngelUsersArray, name)) { message['c'] = AngelColor; message['m'] = AngelTag + ' ' + message['m']; } else { if (userInArray(PervUsersArray, name)) { message['c'] = PervColor; message['m'] = PervTag + ' ' + message['m']; } else { if (userInArray(NaughtyUsersArray, name)) { message['c'] = NaughtyColor; message['m'] = NaughtyTag + ' ' + message['m']; } } } } } } } // if gender emotes are enabled, prefix message with correct gender if (genderEmotes) { switch (gender) { case 'm': genderStr = ':avatar_gen_male'; break; case 'f': genderStr = ':avatar_gen_female'; break; case 's': genderStr = ':avatar_gen_trans'; break; case 'c': genderStr = ':avatar_gen_couple'; break; default: genderStr = ':avatar_gen_unknown'; break; } message['m'] = genderStr + ' ' + message['m']; } }); //end onMessage /* * bot functions */ /* * display notification message and start interval timer */ function displayNotification1() { cb.chatNotice(autoNotice1Text,'',botNoteBg,'','bold'); cb.setTimeout(displayNotification1, cb.settings.autoNotice1Interval * 60000); } function displayNotification2() { cb.chatNotice(autoNotice2Text,'',botNoteBg,'','bold'); cb.setTimeout(displayNotification2, cb.settings.autoNotice2Interval * 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(captainredbeardUsersArray, username) ) { result = delUser(captainredbeardUsersArray, username); if (result instanceof Array) { captainredbeardUsersArray = result; } } if ( userInArray(LoverUsersArray, username) ) { result = delUser(LoverUsersArray, username); if (result instanceof Array) { LoverUsersArray = result; } } if ( userInArray(PrinceUsersArray, username) ) { result = delUser(PrinceUsersArray, username); if (result instanceof Array) { PrinceUsersArray = result; } } if ( userInArray(KingUsersArray, username) ) { result = delUser(KingUsersArray, username); if (result instanceof Array) { KingUsersArray = result; } } if ( userInArray(AngelUsersArray, username) ) { result = delUser(AngelUsersArray, username); if (result instanceof Array) { AngelUsersArray = result; } if ( userInArray(PervUsersArray, username) ) { result = delUser(Perv_DeviUsersArray, username); if (result instanceof Array) { Perv_DeviUsersArray = result; } if ( userInArray(NaughtyUsersArray, username) ) { result = delUser(NaughtyUsersArray, username); if (result instanceof Array) { NaughtyUsersArray = result; } } } } } /* * 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; } /* * 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 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(captainredbeardUsersArray, username)) groupList += "captainredbeard "; if (userInArray(LoverUsersArray, username)) groupList += "Lover "; if (userInArray(PrinceUsersArray, username)) groupList += "Prince "; if (userInArray(KingUsersArray, username)) groupList += "King "; if (userInArray(AngelUsersArray, username)) groupList += "Angel "; if (userInArray(PervUsersArray, username)) groupList += "Perv "; if (userInArray(NaughtyUsersArray, username)) groupList += "Naughty "; return groupList; } function notModel() { var notModelMsg = '\n\n' + modelName + '! This bot was created for '; notModelMsg += 'Korri, you are not her! Please consider having your own '; notModelMsg += 'bot created. Contact theredpirate\n\n'; return notModelMsg; } /* * Builds user arrays and strings based on data provided by bot * config settings */ function loadSettings() { // 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 captainredbeard into array and other variables if (cb.settings.captainredbeardList) { tempStr = cb.settings.captainredbeardList.toLowerCase(); //make names all lowercase cb.settings.captainredbeardList = tempStr.trim(); // remove extra spaces captainredbeardUsersArray = cb.settings.captainredbeardList.split(' '); } if (cb.settings.captainredbeardTag) { captainredbeardTag = cb.settings.captainredbeardTag.trim(); } if (cb.settings.captainredbeardColor) { tempArray = cb.settings.captainredbeardColor.split(' '); captainredbeardColor = '#' + tempArray[1]; } // load Lover into array and other variables if (cb.settings.LoverList) { tempStr = cb.settings.LoverList.toLowerCase(); //make names all lowercase cb.settings.LoverList = tempStr.trim(); // remove extra spaces LoverUsersArray = cb.settings.LoverList.split(' '); } if (cb.settings.LoverTag) { LoverTag = cb.settings.LoverTag.trim(); } if (cb.settings.LoverColor) { tempArray = cb.settings.LoverColor.split(' '); LoverColor = '#' + tempArray[1]; } // load Prince into array and other variables if (cb.settings.PrinceList) { tempStr = cb.settings.PrinceList.toLowerCase(); //make names all lowercase cb.settings.PrinceList = tempStr.trim(); // remove extra spaces PrinceUsersArray = cb.settings.PrinceList.split(' '); } if (cb.settings.PrinceTag) { PrinceTag = cb.settings.PrinceTag.trim(); } if (cb.settings.PrinceColor) { tempArray = cb.settings.PrinceColor.split(' '); PrinceColor = '#' + tempArray[1]; } // load King into array and other variables if (cb.settings.KingList) { tempStr = cb.settings.KingList.toLowerCase(); //make names all lowercase cb.settings.KingList = tempStr.trim(); // remove extra spaces KingUsersArray = cb.settings.KingList.split(' '); } if (cb.settings.KingTag) { KingTag = cb.settings.KingTag.trim(); } if (cb.settings.KingColor) { tempArray = cb.settings.KingColor.split(' '); KingColor = '#' + tempArray[1]; } // load Angel into array and other variables if (cb.settings.AngelList) { tempStr = cb.settings.AngelList.toLowerCase(); //make names all lowercase cb.settings.AngelList = tempStr.trim(); // remove extra spaces AngelUsersArray = cb.settings.AngelList.split(' '); } if (cb.settings.AngelTag) { AngelTag = cb.settings.AngelTag.trim(); } if (cb.settings.AngelColor) { tempArray = cb.settings.AngelColor.split(' '); AngelColor = '#' + tempArray[1]; } // load Perv into array and other variables if (cb.settings.PervList) { tempStr = cb.settings.PervList.toLowerCase(); //make names all lowercase cb.settings.PervList = tempStr.trim(); // remove extra spaces PervUsersArray = cb.settings.PervList.split(' '); } if (cb.settings.PervTag) { PervTag = cb.settings.PervTag.trim(); } if (cb.settings.PervColor) { tempArray = cb.settings.PervColor.split(' '); PervColor = '#' + tempArray[1]; } // load Naughty into array and other variables if (cb.settings.NaughtyList) { tempStr = cb.settings.NaughtyList.toLowerCase(); //make names all lowercase cb.settings.NaughtyList = tempStr.trim(); // remove extra spaces NaughtyUsersArray = cb.settings.NaughtyList.split(' '); } if (cb.settings.NaughtyTag) { NaughtyTag = cb.settings.NaughtyTag.trim(); } if (cb.settings.NaughtyColor) { tempArray = cb.settings.NaughtyColor.split(' '); NaughtyColor = '#' + tempArray[1]; } // load notifications if (cb.settings.autoNotice1) { autoNotice1Text = cb.settings.autoNotice1.trim(); } if (cb.settings.autoNotice2) { autoNotice2Text = cb.settings.autoNotice2.trim(); } } function announceBot() { var divStr=""; var statusMsg = ""; divStr = makeDiv('*', 45, 45); statusMsg = divStr + '\Korris Friends ver ' + botVersion + '\nModified by theredpirate\n' + divStr + '\n'; statusMsg += 'Gender Emotes: '; if (genderEmotes) { 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 in Lovers: ' + LoverUsersArray.length + ' (tip 50)\n'; statusMsg += 'Number of Princes: ' + PrinceUsersArray.length + ' (tip 150)\n'; statusMsg += 'Number of Kings: ' + KingUsersArray.length + ' (tip 250)\n'; statusMsg += 'Type - ' + botTrigger + ' help - for list commands\n'; statusMsg += divStr; return statusMsg; } loadSettings(); cb.chatNotice(announceBot(),'', botMsgBg,'','bold'); if (modelName !='Koriandrr') cb.chatNotice(notModel(),modelName,botAlertBg,'','bold'); if (autoNotice1Text) cb.setTimeout(displayNotification1, cb.settings.autoNotice1Interval * 60000); if (autoNotice2Text) cb.setTimeout(displayNotification2, cb.settings.autoNotice2Interval * 60000);// JavaScript Document
© Copyright Chaturbate 2011- 2026. All Rights Reserved.