Bots Home
|
Create an App
TESTMDB1
Author:
lili_sweet89
Description
Source Code
Launch Bot
Current Users
Created by:
Lili_Sweet89
//ENCOURS LINE // display notification /************************************ API ************************************/ cb.settings_choices = [ {name: 'mods', label: 'Mods who can access bot commands', type: 'str', defaultValue: 'codeanon,candehman' }, {name: 'roomfgcolor', label: '[GENERAL] -------------------------------- Room notice font color', type: 'str', defaultValue: '#000000' }, {name: 'roombgcolor', label: 'Room notice background color', type: 'str', defaultValue: '#FFFFFF' }, /////////////////// {name: 'Titles', label: 'Titles (Name:emote(wt:):TotalTipMin:TotalTipMax:Background Color:Foreground Color)', type: 'str', required: true, defaultValue: 'Little sub:LITTLE:0:499:#ffffaa:#990000,Good sub:GOOD:500:999:#ffffaa:#990000,Obedient sub:OBEDIENT:1000:3999:#ffffaa:#990000,Loyal sub:LOYAL:4000:9999:#ffffaa:#990000,Dedicated sub:DEDICATED:10000:19999:#ffffaa:#990000,Devoted sub:DEVOTED:20000:39999:#ffffaa:#990000,Consecrated sub:COSECRATED:40000:99999:#ffffaa:#990000,Beloved sub:BELOVED:100000:999999:#ffffaa:#990000' }, /////////////////// {name: 'tipMenuA_rot', label: '[TIP MENU] notice interval (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: 2 }, {name: 'tipMenuA_obj', label: 'Menu 1 (price:tag,price:tag)', type: 'str', required: false, defaultValue: '21:SHY,22:LIKER,23:HATER,24:HEELSFET,26:FOOTFET,27:NYLONFET,28:SISSY,29:SmallDick,31:SLUT,32:SMOKFET,33:CUCKOLD,34:CHEATER,36:MONEYSLAVE' }, {name: 'tipMenuA_text', label: 'Short menu name for config', type: 'str', required: false, defaultValue: 'tag' }, /////////////////// {name: 'tipMenuB_rot', label: '[TIP MENU] notice interval (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: 3 }, {name: 'tipMenuB_obj', label: 'Menu 2 (price:tag,price:tag)', type: 'str', defaultValue: '66:CORD,266:NYLON,466:SATIN,666:LACE,1066:SILK,1666:EMERALD', // defaultValue: '66:CORD,266:NYLON,466:SATIN,666:LACE,1066:SILK,1666:EMERALD,6666:AMETHYST,46666:DIAMOND', required: false, }, {name: 'tipMenuB_text', label: 'Name Menu (graphic or text)', type: 'str', defaultValue: 'collar', required: false, }, /////////////////// {name: 'tipMenuC_rot', label: '[TIP MENU] notice interval (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: 4 }, {name: 'tipMenuC_obj', label: 'Menu 3 (price:tag,price:tag)', type: 'str', defaultValue: '38:Shoes Showroom,38:Sextoys Showroom,41:Face Close-up,101:Light me a cigarette,102:Medical Gloves Tease', required: false, }, {name: 'tipMenuC_text', label: 'Name Menu (graphic or text)', type: 'tease', required: false, }, /////////////////// {name: 'tipMenuD_rot', label: '[TIP MENU] notice interval (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: 5 }, {name: 'tipMenuD_obj', label: 'Menu 4 (price:tag,price:tag)', type: 'str', defaultValue: '401:Hand Job Instructions,402:Insert. Instructions,403:Spanking Instructions', required: false, }, {name: 'tipMenuD_text', label: 'Name Menu (graphic or text)', type: 'action', required: false, }, /////////////////// {name: 'tipMenuE_rot', label: '[TIP MENU] notice interval (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: 6 }, {name: 'tipMenuE_obj', label: 'Menu 5 (price:tag,price:tag)', type: 'str', defaultValue: '802:Strap-on Instructions Show,803:Real Eggs Show,804:Toy Trampling Show', required: false, }, {name: 'tipMenuE_text', label: 'Name Menu (graphic or text)', type: 'show', required: false, }, /////////////////// {name: 'blocked', label: '[WORD BLOCKING] ---------------------- Words', type: 'str', required: false, defaultValue: 'bb,baby,babe,slut,whore', }, {name: 'block_type', label: 'Type', type: 'choice', choice1: 'Censor word', choice2: 'Hide entire message', defaultValue: 'Censor word', }, {name: 'block_for', label: 'Applies to', type: 'choice', required: false, choice1: 'Everyone', choice2: 'Greys', choice3: 'Nobody', defaultValue: 'Greys', }, /////////////////// {name: 'prevtips', label: 'Previous / Tippers + Total Tips + HT --> lola:100:50,lisa:500:100 <--', type: 'str', required: false, defaultValue: 'lola:100:50,lisa:500:100,loulou:7500:500', }, {name: 'prevtags', label: 'Previous / Tippers + Tags --> lola:SHY,lisa:CUCKOLD <--', type: 'str', required: false, defaultValue: 'lola:SHY,lisa:CUCKOLD,loulou:NYLONFET', }, {name: 'prevcollars', label: 'Previous / Tippers + Collars + date purchase --> lola:CORD:27/05/2016,lisa:NYLON:02/02/2016 <--', type: 'str', required: false, defaultValue: 'lola:CORD:27/05/2016,lisa:NYLON:02/02/2016', }, ////////////////////////////// { name: 'autoNotice1', label: 'Notification Message 1, use text and emotes', type: 'str', minLength: 0, maxLength: 512, required: false, defaultValue: 'test notice 1 auto rot' }, { 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: 4 }, { name: 'autoNotice2', label: 'Notification Message 2, use text and emotes', type: 'str', minLength: 0, maxLength: 512, required: false, defaultValue: 'test notice 2 auto rot' }, { 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: 5 }, { name: 'autoNotice3', label: 'Notification Message 3, use text and emotes', type: 'str', minLength: 0, maxLength: 512, required: false, defaultValue: 'test notice 3 auto rot' }, { name: 'autoNotice3Interval', 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: 7 }, ]; /********************************* Constants *********************************/ /****************************** End of Constants *****************************/ /********************************* Variables *********************************/ // Variables Tags, collar, levels var uTags = []; // list of user/buyer + tags (flush everyday) var uCollars = []; // list of user/buyer + collars + date (flush depends date and timeout collar, cumulated sessions by injection - Json string) var levelsAttribs = []; // list of Attributes -> Levels (name long, name short or emote, rangemin, rangemax, color text, color bg) // Variables MENUS var tipMenuA = []; // list of tags & price var tipMenuB = []; // list of collars & price var tipMenuC = []; // list of Tease var tipMenuD = []; // list of Instructions var tipMenuE = []; // list of Shows var tipMenuA_text = cb.settings.tipMenuA_text; var tipMenuB_text = cb.settings.tipMenuB_text; var tipMenuC_text = cb.settings.tipMenuC_text; var tipMenuD_text = cb.settings.tipMenuD_text; var tipMenuE_text = cb.settings.tipMenuE_text; var tipMenuA_rot = cb.settings.tipMenuA_rot; var tipMenuB_rot = cb.settings.tipMenuB_rot; var tipMenuC_rot = cb.settings.tipMenuC_rot; var tipMenuD_rot = cb.settings.tipMenuD_rot; var tipMenuE_rot = cb.settings.tipMenuE_rot; // Variables CENSOR var blocked = []; // Blocked words var blockType = cb.settings.block_type; // Type of censor (full, partial...) var block_for = cb.settings.block_for; // User Category to be censored // Variables MODS var modList = []; // List of moderateurs // Variables TIPS var TotaluTips = []; // List Tippers + Total Tips + HT (cumulated sessions by injection - Json string) var TodayuTips = []; // List Tippers + Total Tips + HT of the day (flush everyday) /****************************** End of Variables *****************************/ /*-------------------------------*/ /*---------INITIALIZATION--------*/ /*-------------------------------*/ //run initialization functions and populate arrays from config form function init() { MenusTips(); parseBlocked(cb.settings.blocked); uTags = populateArr(cb.settings.prevtags,2); uCollars = populateArr(cb.settings.prevcollars,3); TotaluTips = populateArr(cb.settings.prevtips,3); levelsAttribs = populateArr(cb.settings.Titles,6); modList = populateArr(cb.settings.mods,1); // start menu rotation if active menuRotator1(); menuRotator2(); menuRotator3(); menuRotator4(); menuRotator5(); //noticesRotator(); } ////////////////// INIT Menus function MenusTips() { tipMenuA=populateArr(cb.settings.tipMenuA_obj,2); tipMenuB=populateArr(cb.settings.tipMenuB_obj,2); tipMenuC=populateArr(cb.settings.tipMenuC_obj,2); tipMenuD=populateArr(cb.settings.tipMenuD_obj,2); tipMenuE=populateArr(cb.settings.tipMenuE_obj,2); } ////////////////// INIT BLOCKED WORDS //parse the blocked words function parseBlocked(input) { if (input) { var s = input.replace(/\s/g, ''); blocked = s.split(','); } //// debug //var printList = JSON.stringify(blocked); //cb.sendNotice(printList,'', '', '', '', '') } ////////////////// INIT rotating tip menu function menuRotator1() { displayMenu(tipMenuA, 1); cb.setTimeout(menuRotator1, tipMenuA_rot * 60000); } function menuRotator2() { displayMenu(tipMenuB, 2); cb.setTimeout(menuRotator2, tipMenuB_rot * 60000); } function menuRotator3() { displayMenu(tipMenuC, 3); cb.setTimeout(menuRotator3, tipMenuC_rot * 60000); } function menuRotator4() { displayMenu(tipMenuD, 4); cb.setTimeout(menuRotator4, tipMenuD_rot * 60000); } function menuRotator5() { displayMenu(tipMenuE, 5); cb.setTimeout(menuRotator5, tipMenuE_rot * 60000); } function displayMenu(menuArr, menuType) { var output =''; if(menuType == 1){ output +='*************** TAGS MENU ************************\n'; output +='*************** Expose yourself for the day \n'; }else if (menuType == 2) { output +='*************** COLLARS MENU *********************\n'; output +='*************** Get your PM access & Bonus \n'; }else if (menuType == 3) { output +='*************** TEASE MENU ***********************\n'; output +='*************** Look at Me and admire Me \n'; }else if (menuType == 4) { output +='*************** ACTION MENU **********************\n'; output +='*************** Follow My Instructions \n'; }else if (menuType == 5) { output +='*************** SHOW MENU ************************\n'; output +='*************** Enjoy a fetish public Show \n'; } for(var i=0; i < menuArr.length; i++) { output += ' -> ' + menuArr[i][0] + ' toks ....... [ ' + menuArr[i][1] + ' ]\n'; } output +='**************************************************\n'; tellRoom2(output); } /*--------------------------------*/ /*----------EVENT HANDLERS--------*/ /*--------------------------------*/ //when a new tip comes in, increment everything and grant titles appropriately cb.onTip(function (tip) { var clientTip = tip['amount']; var client = tip['from_user']; // increment total tips of the user (today and Total) addTotTips(TotaluTips,client, clientTip); addDayTips(TodayuTips,client, clientTip); // check for what they tipped checkTips(client, clientTip); //// debug // var printList = JSON.stringify(TotaluTips); //cb.sendNotice(printList,'', '', '', '', '') // var printList = JSON.stringify(TodayuTips); //cb.sendNotice(printList,'', '', '', '', '') }); /*---------------------------------*/ /*----------TIPS PROCESSING--------*/ /*---------------------------------*/ // process add/remove tags and collars + display a message if a user has tipped for something on one of the menus function checkTips(userName, userTip) { var tippedItem=''; var note=''; if (uInArray(tipMenuA, userTip) === true) { adduTags(userName, getArrayItem(tipMenuA, userTip, 1)); noticeRoomtippedItem (tipMenuA, userName, userTip, 'tag') }else if (uInArray(tipMenuB, userTip) === true){ adduCollars(userName, getArrayItem(tipMenuB, userTip, 1)); noticeRoomtippedItem (tipMenuB, userName, userTip, 'collar') }else if (uInArray(tipMenuC, userTip) === true){ noticeRoomtippedItem (tipMenuC, userName, userTip, 'tease') }else if (uInArray(tipMenuD, userTip) === true){ noticeRoomtippedItem (tipMenuD, userName, userTip, 'action') }else if (uInArray(tipMenuE, userTip) === true){ noticeRoomtippedItem (tipMenuE, userName, userTip, 'show') }else{ //switch tips not in menu note = 'Thank you ' + userName + ', all tributes are nice!'; tellRoom(note); } } // public notice tipped Item function noticeRoomtippedItem (menuArray, userName, userTip, tipCase) { var note = ''; tippedItem = getArrayItem(menuArray, userTip, 1); switch(tipCase) { case 'tag': note = 'Thank you ' + userName + ', you tributed ' + userTip + ' tks for a new [TAG] and expose yourself as [' + tippedItem + ']'; break; case 'collar': note = 'Thank you ' + userName + ', you tributed ' + userTip + ' tks for a new [COLLAR] and got new privileges with your [' + tippedItem + '] COLLAR'; break; case 'tease': note = 'Thank you ' + userName + ', you tributed ' + userTip + ' tks for some Public Teasing and selected [ ' + tippedItem + ' ] in the menu'; break; case 'action': note = 'Thank you ' + userName + ', you tributed ' + userTip + ' tks for some Public Instructions and selected [ ' + tippedItem + ' ] in the menu'; break; case 'show': note = 'Thank you ' + userName + ', you tributed ' + userTip + ' tks for a Public Show and selected [ ' + tippedItem + ' ] in the menu'; break; default: note = 'Thank you ' + userName + ', you tributed ' + userTip + ' tks for [ ' + tippedItem + ' ] (see the menu)'; break; } tellRoom(note); } //increment the user's entry tips for today function addDayTips(userArray, userName, userTip) { if (uInArray(userArray, userName) === true) { for(var i=0; i < userArray.length; i++) { if (userArray[i][0] == userName) { // add new tips to total userArray[i][1] = parseInt(userArray[i][1]) + parseInt(userTip); // update Best Tip if (userArray[i][2] < userTip) userArray[i][2] = userTip; }}}else {userArray.push([userName,userTip,userTip]);} //// debug // var printList = JSON.stringify(userArray); // cb.sendNotice(printList,'', '', '', '', '') } //increment the user's entry tips for total sessions and check level change + HT function addTotTips(userArray, userName, userTip) { var note = ''; var ind = 0; var actualTotal = 0; var actualLevel = 0; var newTotal = 0; var newLevel = 0; // if user alreday exist (previous tips) if (uInArray(userArray, userName) === true) { ind = parseInt(getArrayIndex(userArray, userName)); //check levels/titles of actual total actualLevel = getLevelIndex (levelsAttribs, parseInt(userArray[ind][1])); // add new tips to total userArray[ind][1] = parseInt(userArray[ind][1]) + parseInt(userTip); //check levels/titles of new total newLevel = getLevelIndex (levelsAttribs, parseInt(userArray[ind][1])); //check if changed of levels/titles if (newLevel != actualLevel) { note = 'Level Change from ' + actualLevel + ' to ' + newLevel; tellBoth(note); tellUser(note, userName) ; } // update Best Tip from start if (userArray[ind][2] < userTip) { userArray[ind][2] = userTip; note = 'New Best Tip (Personal Record) for ' + userName; tellBoth(note); tellUser(note, userName); } }else { userArray.push([userName,userTip,userTip]); //check levels/titles of this total actualLevel = getLevelIndex (levelsAttribs, userTip); note = 'New level of ' + userName + ' is ' + actualLevel ; tellBoth(note); tellUser(note, userName); } //// debug // var printList = JSON.stringify(userArray); // cb.sendNotice(printList,'', '', '', '', '') } // Record User in uTag Array with is new Tag he paid for function adduTags(uName, userTag) { var note = ''; var ind = 0; if (uInArray(uTags, uName) === true) { ind = getArrayIndex(uTags, uName); uTags[ind][1] = userTag; note = 'New confession from ' + uName + ' , tag has been changed to [' + userTag + ']'; tellBoth(note); tellUser(note,uName); }else {uTags.push([uName,userTag]); note = uName + ' confessed and got his Tag for today --> [' + userTag + ']'; tellBoth(note); tellUser(note,uName); } //// debug //var printList = JSON.stringify(uTags); //cb.sendNotice(printList,'', '', '', '', '') } // Record User in uCollar Array with is new Collar he paid for function adduCollars(uName, userCollar) { var note = ''; var ind = 0; var dd = new Date(); var y = dd.getFullYear(); var m = dd.getMonth()+1; var d = dd.getDate(); var cDate = d+'/'+m+'/'+y; if (uInArray(uCollars, uName) === true) { ind = getArrayIndex(uCollars, uName); uCollars[ind][1] = userCollar; uCollars[ind][2] = cDate; note = 'More devotion from ' + uName + ' , Collar has been changed to [' + userCollar + ']'; tellBoth(note); tellUser(note,uName); }else {uCollars.push([uName,userCollar,cDate]); note = uName + ' showed devotion and got a Collar --> [' + userCollar + ']'; tellBoth(note); tellUser(note,uName); } //// debug //var printList = JSON.stringify(uCollars); //cb.sendNotice(printList,'', '', '', '', '') } /*-------------------------------*/ /*------------TOOLS ------------*/ /*-------------------------------*/ function getLevelIndex (AttribArray, uTotalTips) { var index = 0; for(var i=0; i < AttribArray.length; i++) { if ((uTotalTips >= AttribArray[i][2]) && (uTotalTips <= AttribArray[i][3])) { var index = i; } } return index; } function getArrayItem(uArray, factor, subInd) { var arrItem; if (uArray.length > 0) {for(i=0; i < uArray.length; i++) {if (uArray[i][0] == factor) arrItem = uArray[i][subInd];}} return arrItem; } function getArrayIndex(uArray, factor) { var index = 0; if (uArray.length > 0) {for(i=0; i < uArray.length; i++) {if (uArray[i][0] == factor) index = i;}} return index; } function uInArray(uArray, factor) { var uFound = false; if (uArray.length > 0) {for(i=0; i < uArray.length; i++) {if (uArray[i][0] == factor) uFound = true;}} return uFound; } function populateArr(myList,numItems) { var tempArr = []; var returnArr = []; tempArr = String(myList).split(','); tempArr.forEach(function (entry) { if(numItems >=2){ var itemArray = String(entry).split(':'); if(numItems == 2){ returnArr.push([itemArray[0], itemArray[1]]); }else if (numItems == 3) { returnArr.push([itemArray[0], itemArray[1], itemArray[2]]); }else if (numItems == 4) { returnArr.push([itemArray[0], itemArray[1], itemArray[2], itemArray[3]]); }else if (numItems == 5) { returnArr.push([itemArray[0], itemArray[1], itemArray[2], itemArray[3], itemArray[4]]); }else if (numItems == 6) { returnArr.push([itemArray[0], itemArray[1], itemArray[2], itemArray[3], itemArray[4], itemArray[5]]); } }else { returnArr.push([entry]); } }); // var printList = JSON.stringify(returnArr); // cb.sendNotice(printList,'', '', '', '', ''); return returnArr; } /*-------------------------------*/ /*----------COMMUNICATION--------*/ /*-------------------------------*/ /* * display notification message and start interval timer */ function displayNotification1() { cb.sendNotice(cb.settings.autoNotice1,'',botNoteBg,'','bold'); cb.setTimeout(cb.settings.displayNotification1, cb.settings.autoNotice1Interval * 60000); } function displayNotification2() { cb.sendNotice(cb.settings.autoNotice2,'',botNoteBg,'','bold'); cb.setTimeout(displayNotification2, cb.settings.autoNotice2Interval * 60000); } //add to all newline characters in a string for readability function newLines(input) { return input.replace(new RegExp('\n', 'g'), '\n\u25A0 '); } //send a message to the room function tellRoom(msg) { cb.sendNotice('\u25A0\u25A0\u25A0 ' + newLines(msg), '', cb.settings.roombgcolor, cb.settings.roomfgcolor, 'bold', ''); } //send a message to the room (for menus that have how template) function tellRoom2(msg) { cb.sendNotice('\u25A0 ' + newLines(msg), '', cb.settings.roombgcolor, cb.settings.roomfgcolor, 'bold', ''); } //send a message to the user with special formatting function specialUserNotice(msg, username) { if (msg && username) cb.sendNotice('\u25A0 Private \u25A0 ' + newLines(msg), username, '#000000', '#FFFFFF', 'bold', ''); } //send a message to the user function tellUser(msg, user) { cb.sendNotice('\u25A0 Private \u25A0 ' + newLines(msg), user, cb.settings.roombgcolor, cb.settings.roomfgcolor, 'bold', ''); } //send a message to the broadcaster function tellMe(msg) { cb.sendNotice('\u25A0 ADMIN \u25A0 ' + newLines(msg), cb.room_slug, cb.settings.roombgcolor, cb.settings.roomfgcolor, 'bold', ''); } //send a message to mods function tellMods(msg) { cb.sendNotice('\u25A0 MODS \u25A0 ' + newLines(msg), '', cb.settings.roombgcolor, cb.settings.roomfgcolor, 'bold', 'red'); } //send a message to broadcaster and mods function tellBoth(msg) { tellMe(msg); tellMods(msg); } /*-------------------------------*/ /*------------EXECUTE INIT-------*/ /*-------------------------------*/ init();
© Copyright Chaturbate 2011- 2026. All Rights Reserved.