Bots Home
|
Create an App
vov-3
Author:
_vov_
Description
Source Code
Launch Bot
Current Users
Created by:
_Vov_
{cb.settings_choices = [ {name: 'enableToyMenu', label: '1. Enable the Toy Tip Menu "/toymenu on" and "/toymenu off" =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes'}, {name: 'whichToy', label: '2. Which toy is being used? ', type: 'choice', choice1: 'Lush', choice2: 'Nora', choice3: 'Domi', choice4: 'Hush', choice5: 'Osci', choice6: 'Diamo', choice7: 'Edge', defaultValue: 'Diamo'}, {name: 'displayResponse', label: '3. Display a response message for each tip ', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'No'}, {name: 'enableEntryMessage', label: '4. Display a welcome message to users with tokens when they enter the room ', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes'}, {name: 'toyMenuInterval', label: '5. Toy Tip Menu display ',type: 'str',required: false,defaultValue: 2.7}, {name: 'toyMenuTxtColor', label: '6. text color ',type: 'choice',choice1: 'White/No Color',choice2: 'Black',choice3: 'Dark Grey',choice4: 'Dark Red',choice5: 'Dark Orange',choice6: 'Dark Green',choice7: 'Dark Aqua',choice8: 'Dark Blue',choice9: 'Dark Purple',choice10: 'Dark Pink',choice11: 'Custom',defaultValue: 'Dark Pink'}, {name: 'toyMenuCustTxtColor', label: '7. "Custom" text color ',type: 'str',minLength: 1,maxLength: 7,required: false}, {name: 'toyMenuBgColor', label: '8. background color ',type: 'choice', choice1: 'White/No Color',choice2: 'Light Yellow',choice3: 'Light Blue',choice4: 'Light Pink',choice5: 'Light Red',choice6: 'Light Green',choice7: 'Light Purple',choice8: 'Light Orange',choice9: 'Light Grey',choice10: 'Light Aqua',choice11: 'Custom',defaultValue: 'Light Pink'}, {name: 'toyMenuCustBgColor', label: '9. "Custom" background color',type: 'str',minLength: 1,maxLength: 7,required: false}, {name: 'dummy2', label: 'Toy Tip Menu Levels =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--', type: 'choice',required: false}, {name: 'Amount1', label: 'Level 1',type: 'int',minValue: -99999,maxValue: 99999,defaultValue: 1}, {name: 'Description1', type: 'str',label: 'Level 1 Description',defaultValue: '⇨ 3 sec (Low)'}, {name: 'Amount2', label: 'Level 2',type: 'int',minValue: -99999,maxValue: 99999,defaultValue: 5}, {name: 'Description2', type: 'str',label: 'Level 2 Description',defaultValue: '⇨ 6 sec (Medium)'}, {name: 'Amount3', label: 'Level 3',type: 'int',required: false,minValue: -99999,maxValue: 99999,defaultValue: 10}, {name: 'Description3', type: 'str',label: 'Level 3 Description',required: false,defaultValue: '⇨ 9 sec ( High)'}, {name: 'Amount4', label: 'Level 4',type: 'int',required: false,minValue: -99999,maxValue: 99999,defaultValue: 30}, {name: 'Description4', type: 'str',label: 'Level 4 Description',required: false,defaultValue: '⇨ 12 sec (Ultra High)'}, {name: 'Amount5', label: 'Level 5',type: 'int',required: false,minValue: -99999,maxValue: 99999,defaultValue: 100}, {name: 'Description5', type: 'str',label: 'Level 5 Description',required: false,defaultValue: '⇨ 30 sec (Ultra High)'}, {name: 'Amount6', label: 'Level 6',type: 'int',required: false,minValue: -99999,maxValue: 99999,defaultValue: 200}, {name: 'Description6', type: 'str',label: 'Level 6 Description',required: false,defaultValue: '⇨ 60 sec (Ultra High)'}, {name: 'Amount7', label: 'Level 7',type: 'int',required: false,minValue: -99999,maxValue: 99999}, {name: 'Description7', type: 'str',label: 'Level 7 Description',required: false}, {name: 'Amount8', label: 'Level 8',type: 'int',required: false,minValue: -99999,maxValue: 99999}, {name: 'Description8', type: 'str',label: 'Level 8 Description',required: false}, {name: 'Amount9', label: 'Level 9',type: 'int',required: false,minValue: -99999,maxValue: 99999}, {name: 'Description9', type: 'str',label: 'Level 9 Description',required: false}, {name: 'Amount10', label: 'Level 10',type: 'int',required: false,minValue: -99999,maxValue: 99999}, {name: 'Description10', type: 'str',label: 'Level 10 Description',required: false}, {name: 'dummy3', label: 'Special Tip Amounts =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--.', type: 'choice',required: false}, {name: 'SpecAmount1', label: 'Special 1',type: 'int',required: false,minValue: -99999,maxValue: 99999,defaultValue: 25}, {name: 'SpecDescription1', type: 'str',label: 'Special/Pattern 1 Description',required: false,defaultValue: '⇨ Level 2-4 (Random)'}, {name: 'SpecAmount2', label: 'Special 2',type: 'int',required: false,minValue: -99999,maxValue: 99999,defaultValue: 50}, {name: 'SpecDescription2', type: 'str',label: 'Special/Pattern 2 Description',required: false,defaultValue: '⇨ 30 sec (Wave)'}, {name: 'SpecAmount3', label: 'Special Tip 3',type: 'int',required: false,minValue: -99999,maxValue: 99999,defaultValue: 51}, {name: 'SpecDescription3', type: 'str',label: 'Special/Pattern 3 Description',required: false,defaultValue: '⇨ 31 sec (Pulse)'}, {name: 'SpecAmount4', label: 'Special Tip 4',type: 'int',required: false,minValue: -99999,maxValue: 99999,defaultValue: 52}, {name: 'SpecDescription4', type: 'str',label: 'Special/Pattern 4 Description',required: false,defaultValue: '⇨ 32 sec (Earthquake)'}, {name: 'SpecAmount5', label: 'Special Tip 5',type: 'int',required: false,minValue: -99999,maxValue: 99999,defaultValue: 53}, {name: 'SpecDescription5', type: 'str',label: 'Special/Pattern 5 Description',required: false,defaultValue: '⇨ 33 sec (Fireworks)'} ]; } { // *********************************** Variables and Arrays ************************************** var initialize = 0; var BC = cb.room_slug; var appNoticeColor = '#FFE6EA'; // Used for general messaging from bot (pink) var appWarningColor = '#f4d599'; // Used for warning messaging from bot (yellow) var red = '#f4c1bc'; // Used for urgent messaging from bot (red) var dashLine60 = new Array(60).join('-'); var dashLine70 = new Array(70).join('-'); var dashLine80 = new Array(80).join('-'); var dashLine90 = new Array(90).join('-'); var toyIcon = ''; var whichToy = ''; var toyMenuToggle = 0; var toyMenu = ''; var textColor = ''; var backgroundColor = ''; var toyMenuDspIntTime = 0; var amountArray = []; var descriptionArray = []; var responseArray = []; var specAmountArray = []; var specDescriptionArray = []; var specResponseArray = []; var tempAmountArray = []; var tempDescriptionArray = []; var tempSpecAmountArray = []; var tempSpecDescriptionArray = []; } { // *********************************** Functions ************************************** { function checkTextColor(color) { switch (color) { case 'White/No Color': return '#FFFFFF'; case 'Black': return '#000000'; case 'Dark Blue': return '#0629AC'; case 'Dark Pink': return '#FF6680'; case 'Dark Green': return '#006600'; case 'Dark Red': return '#cc0000'; case 'Dark Purple': return '#3d003d'; case 'Dark Grey': return '#737373'; case 'Dark Orange': return '#e77400'; case 'Dark Aqua': return '#006767'; default: if (/^#[0-9A-F]{6}$/i.test(color)) { return color; } else if (/^[0-9A-F]{6}$/i.test(color)) { return ('#' + color); } else { return ('default'); } } } function checkBgColor(color) { switch (color) { case 'White/No Color': return '#FFFFFF'; case 'Light Aqua': return '#adeaea'; case 'Light Pink': return '#FFE6EA'; case 'Light Green': return '#94e594'; case 'Light Red': return '#ff9a9a'; case 'Light Purple': return '#f2cdff'; case 'Light Orange': return '#ffd9b3'; case 'Light Grey': return '#e6e6e6'; case 'Light Blue': return '#d1eaee'; case 'Light Yellow': return '#ffff94' case 'Cream': return '#f9f6ed' default: if (/^#[0-9A-F]{6}$/i.test(color)) { return color; } else if (/^[0-9A-F]{6}$/i.test(color)) { return ('#' + color); } else { return ('default'); } } } // *************************** Toy Menu Functions ************************ function setToyMenuToggle(option, mod) { if(option == 'on') { if (toyMenuToggle == 1) { cb.sendNotice('The ' + whichToy + ' menu is already enabled.',mod,appNoticeColor); } else { toyMenuToggle = 1; initToyMenu(); cb.sendNotice(' ' + whichToy + ' Toy is active, Use the tip ranges on the menu to make the toy vibrate! ', '', backgroundColor, textColor, 'bold'); } } else if(option == 'off') { if(toyMenuToggle == 0) { cb.sendNotice('The ' + whichToy + ' menu is already disabled.',mod,appNoticeColor); } else { toyMenuToggle = 0; cb.sendNotice(' ' + mod + ' has disabled the ' + whichToy + ' menu.', '', backgroundColor, textColor, 'bold'); } } else if(option != null) { cb.sendNotice(option + ' is not a valid option for /uselushmenu.',mod,appNoticeColor); } else if(option == null) { cb.sendNotice('You did not enter a valid option for /uselushmenu.',mod,appNoticeColor); } } function initToyMenu() { if (cb.settings.toyMenuTxtColor === 'Custom') { textColor = checkTextColor(cb.settings.toyMenuCustTxtColor); if (textColor === 'default') { cb.sendNotice('Error while setting the text color. It must be in a HEX format. Using default value.', cb.room_slug, '#FFFFFF', '#FF0000', 'bold'); textColor = '#FFFFFF'; } } else { textColor = checkTextColor(cb.settings.toyMenuTxtColor); } if (cb.settings.toyMenuBgColor === 'Custom') { backgroundColor = checkBgColor(cb.settings.toyMenuCustBgColor); if (backgroundColor === 'default') { cb.sendNotice('Error while setting the background color. It must be in a HEX format. Using default value.', cb.room_slug, '#FFFFFF', '#FF0000', 'bold'); backgroundColor = '#0629AC'; } } else { backgroundColor = checkBgColor(cb.settings.toyMenuBgColor); } setToyMenuTimer(); } function setToyMenuTimer() { if (isNaN(parseFloat(cb.settings.toyMenuInterval))) { cb.sendNotice('Lush Bot: Toy Menu notice interval is not set with a valid number so the notice is not enabled.', cb.room_slug, appWarningColor); lushtimer = 0; } else { lushtimer = parseFloat(cb.settings.toyMenuInterval); } if (lushtimer != 0) { if (lushtimer < 1) { cb.sendNotice('Lush Bot: Toy Menu notice interval is less than 1 minute. Using default value of 3.2 minutes.', cb.room_slug, '#FFFFFF', '#FF0000', 'bold'); lushtimer = 3.2; } lushtimer = parseInt(lushtimer * 60000); toyMenuDspIntTime = lushtimer; displayToyMenu(); } } function displayToyMenu() { if (toyMenuToggle == 1) { toyMenu = ''; switch (whichToy) { case 'Lush': { toyMenu = ' :Vovdot :lovense130 :Vovdot\n'; } break; case 'Domi': { toyMenu = ' :Vovdot :lovense130 :Vovdot\n'; } break; case 'Nora': { toyMenu = ' :Vovdot :lovense130 :Vovdot\n'; } break; case 'Edge': { toyMenu = ' :Vovdot :lovense130 :Vovdot\n'; } break; case 'Diamo': { toyMenu = ' :Vovdot :lovense130 :Vovdot\n'; } break; case 'Hush': { toyMenu = ' :Vovdot :lovense130 :Vovdot\n'; } break; case 'Osci': { toyMenu = ' :Vovdot :lovense130 :Vovdot\n'; } break; } toyMenu += toyMenuLevel.join('\n'); if (toyMenuSpecLevel.length > 0) { toyMenu = toyMenu + '\n' + toyMenuSpecLevel.join('\n'); } cb.sendNotice(toyMenu, '', backgroundColor, textColor, 'bold'); cb.setTimeout(displayToyMenu, toyMenuDspIntTime); } } // *********************************** Help Function ************************************** function helpMenu(option,from) { cb.sendNotice('Dorothy\'s Lush Bot command menu for Broadcasters and Moderators', from, appNoticeColor); cb.sendNotice( '/toymenu: Display the Toy Menu in chat. Available to any user, only shown to the user that requests it.' + '\n/chgtoymenu "newtoy": Changes the name of the toy currently being used, where "newtoy" is one of the toys "Lush", "Nora","Diamo","Edge", "Domi", "Hush", or "Osci" (no quotes). The new name will then be displayed in all chat messaging.' + '\n/usetoymenu "on" or "off": Toggle the setting for whether the Toy Menu is "on" or "off" (no quotes), and displays at the defined interval. Overrides the initial setting to turn the Toy Menu on or off during the show.' ,from); cb.sendNotice('',from,appNoticeColor); } } } // ******************************* Upon user entry of a Message ************************************** { cb.onMessage(function (msg) { var message = msg['m'].split(' '); var cmd = 0; var listRegExp = /[,\s]+/; var listRegExpSpc = /[,]+/; var msgUser = msg.user; var isMod = msg.is_mod; var isBC = (msgUser === cb.room_slug); var BC = cb.room_slug; var command = message[0] if (message[0].charAt(0) == '/') { msg['X-Spam'] = true; switch(command) { case '/toymenu': { cmd = 1; if (toyMenuToggle == 1) { sendtotext = ''; if (isMod || isBC) { sendto = ''; sendtotext += ''; } else { sendto = msgUser; sendtotext += ''; } cb.sendNotice(sendtotext + toyMenu, sendto, backgroundColor, textColor, 'bold'); } else { cb.sendNotice('Cannot display the menu as it is not enabled.', msgUser, appNoticeColor); } break; } case '/usetoymenu': { cmd = 1; if (isMod || isBC) { if (message[1]) { usetoyparm = message[1].toLowerCase(); if (usetoyparm != 'on' && usetoyparm != 'off' ) { cb.sendNotice('Invalid parameter, valid parameters are "on" or "off".', msgUser, appNoticeColor); } else { setToyMenuToggle(usetoyparm, msgUser) } } else { cb.sendNotice('No parameter specified for the /usetoymenu command, a parameter of "on" or "off" is required.', msgUser, appNoticeColor); } } else { cb.sendNotice('Only moderators and broadcasters are able to use that command.', msgUser, appNoticeColor); } break; } case '/chgtoymenu': { cmd = 1; if (isMod || isBC) { if (message[1]) { usetoyparm = message[1].toLowerCase(); if (usetoyparm == whichToy) { cb.sendNotice('The toy type is already set to "' + whichToy + '", please enter a new toy type.', msgUser, appNoticeColor); } else if (usetoyparm == 'Lush') { whichToy = 'Lush'; toyIcon = ':lushsm'; cb.sendNotice('You have updated the toy to the "Lush".', msgUser, appNoticeColor); } else if (usetoyparm == 'Domi') { whichToy = 'Domi'; toyIcon = ':domism'; cb.sendNotice('You have updated the toy to the "Domi".', msgUser, appNoticeColor); } else if (usetoyparm == 'Nora') { whichToy = 'Nora'; toyIcon = ':norasm'; cb.sendNotice('You have updated the toy to the "Nora".', msgUser, appNoticeColor); } else if (usetoyparm == 'Edge') { whichToy = 'Edge'; toyIcon = ':edgesm'; cb.sendNotice('You have updated the toy to the "Edge".', msgUser, appNoticeColor); } else if (usetoyparm == 'diamo') { whichToy = 'Diamo'; toyIcon = ':diamosm'; cb.sendNotice('You have updated the toy to the "Diamo".', msgUser, appNoticeColor); } else if (usetoyparm == 'Hush') { whichToy = 'Hush'; toyIcon = ':hushsm'; cb.sendNotice('You have updated the toy to the "Hush".', msgUser, appNoticeColor); } else if (usetoyparm == 'Osci') { whichToy = 'Osci'; toyIcon = ':oscism'; cb.sendNotice('You have updated the toy to the "Osci".', msgUser, appNoticeColor); } else { cb.sendNotice('Invalid toy name, valid names are "Lush", "Nora", "Diamo","Edge", "Domi", "Hush", and "Osci". Therefore, syntax for command is /chgtoymenu lush, please try again.',u,appNoticeColor); } } else { cb.sendNotice('No parameter specified for the /chgtoymenu command, a parameter of "Lush", "Nora", "Diamo","Edge", "Domi", "Hush", or "Osci" is required.', msgUser, appNoticeColor); } } else { cb.sendNotice('Only moderators and broadcasters are able to use that command.', msgUser, appNoticeColor); } break; } case '/toyhelp': { cmd = 1; if (isMod || isBC) { helpMenu(message[1],msgUser); } else { cb.sendNotice('Only moderators and broadcasters are able to use that command.', msgUser, appNoticeColor); } break; } //********* End of Expected commands } } return msg; }); } // *********************************** Actions on user entering ************************************** { cb.onEnter(function(user) { var enterUser = user.user; // **** General Entry Message if (toyMenuToggle == 1) { if (toyMenuToggle == 1 && cb.settings.enableEntryMessage == 'Yes' && user.has_tokens) { cb.sendNotice(' \u21E8 "' + whichToy + ' Toy is active" Type /toymenu to see the menu.', enterUser, backgroundColor, textColor, 'bold'); } } }); } // *********************************** Actions upon leaving ************************************** { cb.onLeave(function(user) { }); } // *********************************** Actions upon tipping ************************************** { cb.onTip(function (tip) { var tipAmount = Number.parseInt(tip.amount, 10); var tipUser = tip.from_user; var realTipper = tip.from_user; var isAnon = tip.is_anon_tip; if (isAnon) { tipUser = 'An anonymous user'; } if (toyMenuToggle == 1 && cb.settings.displayResponse == 'Yes') { exactfound = false; if (specAmountArray.length > 0) { for (let i = 0; i < specAmountArray.length; i++) { if (tipAmount == specAmountArray[i]) { exactfound = true; cb.sendNotice(' @' + tipUser + ' tipped for ' + specDescriptionArray[i] + ' ' + toyIcon, '', backgroundColor, textColor, 'bold'); break; } } } if (!exactfound) { for (let i = 0; i < amountArray.length; i++) { if (amountArray[i+1] > 0) { if (tipAmount >= amountArray[i] && tipAmount < amountArray[i+1]) { cb.sendNotice(' @' + tipUser + ' tipped for ' + descriptionArray[i] + ' ' + toyIcon, '', backgroundColor, textColor, 'bold'); break; } } else { if (tipAmount >= amountArray[i]) { cb.sendNotice(' @' + tipUser + ' tipped for ' + descriptionArray[i] + ' ' + toyIcon, '', backgroundColor, textColor, 'bold'); break; } } } } } }); } // *********************************** Initialize ************************************** { if (initialize == 0) { whichToy = cb.settings.whichToy; validationFail = false; if (!cb.settings.Description1 || cb.settings.Amount1 <= 0 || !cb.settings.Description2 || cb.settings.Amount2 <= 0) { cb.sendNotice('Unable to start the Toy Tip Menu, Levels 1 and 2 must be defined with both amounts and descriptions. Toy Menu and Response messages are disabled. Please restart the bot and fix Level 1 and 2 setup.', cb.room_slug, red, '' , 'bold'); validationFail = true; } else { toyMenuLevel = []; toyMenuSpecLevel = []; toyMenu = ''; for (let j = 1; j < 16; j++) { if (cb.settings['Description' + j] !== '' && cb.settings['Amount' + j] > 0) { if (j > 1 && (cb.settings['Amount' + j] <= cb.settings['Amount' + (j-1)])) { cb.sendNotice('Unable to start the Toy Tip Menu, Level ' + j + ' amount is less or equal to Level ' + (j-1) + ' amount. Toy Menu and Response messages are disabled. Please restart the bot and fix amounts so that they increase with each level.', cb.room_slug, red, '' , 'bold'); validationFail = true; break; } tempAmountArray.push(cb.settings['Amount' + j]); tempDescriptionArray.push(cb.settings['Description' + j]); } } for (let j = 1; j < 9; j++) { if (cb.settings['SpecDescription' + j] !== '' && cb.settings['SpecAmount' + j] > 0) { tempSpecAmountArray.push(cb.settings['SpecAmount' + j]); tempSpecDescriptionArray.push(cb.settings['SpecDescription' + j]); } } for (let j = 0; j < tempAmountArray.length; j++) { amountArray.push(tempAmountArray[j]); descriptionArray.push(tempDescriptionArray[j]); if (j == (tempAmountArray.length - 1)) { toyMenuLevel.push(' :llvlc' + (j+1) + ' Tip [' + tempAmountArray[j] + ' ++] ⇨' + tempDescriptionArray[j]); } else { toyMenuLevel.push(' :llvlc' + (j+1) + ' Tip [' + tempAmountArray[j] + '-' + (tempAmountArray[j+1] - 1) + '] ⇨ ' + tempDescriptionArray[j]); } } for (let j = 0; j < tempSpecAmountArray.length; j++) { specAmountArray.push(tempSpecAmountArray[j]); specDescriptionArray.push(tempSpecDescriptionArray[j]); toyMenuSpecLevel.push(' :lslvl' + (j+1) + ' Tip [' + tempSpecAmountArray[j] + '] ⇨' + tempSpecDescriptionArray[j]); } switch (whichToy) { case 'Lush': { toyIcon = ':buzz'; } break; case 'Domi': { toyIcon = ':buzz'; } break; case 'Nora': { toyIcon = ':buzz'; } break; case 'Edge': { toyIcon = ':buzz'; } break; case 'Diamo': { toyIcon = ':buzz'; } break; case 'Hush': { toyIcon = ':buzz'; } break; case 'Osci': { toyIcon = ':buzz'; } break; } } if (cb.settings.enableToyMenu == 'Yes' && !validationFail) { setToyMenuToggle('on',cb.room_slug); } initialize = 1; } }
© Copyright Chaturbate 2011- 2024. All Rights Reserved.