Bots Home
|
Create an App
Bunny Lover + Tip Menu
Author:
omegazeeapps
Description
Source Code
Launch Bot
Current Users
Created by:
Omegazeeapps
//Based on Daly's Butterfly club (10/10/2014) //BunnyLover- // // CB app settings cb.settings_choices = [ {name: 'bText', label: 'Text to put in front of Bunny Lover messages (Bunny Lover)', type: 'str', minLength: 0, maxLength: 30, required: false, defaultValue:'[Bunny Lover]'}, {name: 'bTextColor', label: 'Bunny Lover text color - HTML colour code without starting \'#\' e.g. (FFFFFF is white)', type: 'str', minLength: 0, maxLength: 6, required: false, defaultValue: '3C936c'}, {name: 'bBGColor', label: 'Bunny Lover background color - HTML colour code without starting \'#\' e.g. (2F1BE0 is blue)', type: 'str', minLength: 0, maxLength: 6, required: false, defaultValue: 'f7d69e'}, {name: 'bMinTip', label: 'Minimum tip to become a Bunny Lover', type: 'int', minValue: 1, defaultValue: 333}, {name: 'bAnnounce', label: 'Text to show when someone tips to become a Bunny Lover, the text MEMBERNAME will be replaced with the username of the new member (Note: graphics don\'t work in this text)', type: 'str', minLength: 0, maxLength: 10240, required: false, defaultValue: 'MEMBERNAME just became a Bunny Lover and won a special prize'}, {name: 'bMemberList', label: 'List of current Bunny Lovers, separated by commas (and they need to be the CB username exactly)', type: 'str', minLength: 0, maxLength: 10240, required: false, defaultValue: ''}, {name: 'bRainText', label: 'Text to use for Bunny Lover rain lines', type: 'str', minLength: 0, maxLength: 80, required: false, defaultValue: 'Bunny Lover!:bunny_crazy_jumping_small'}, {name: 'bRainCount', label: 'Number of lines of Bunny Lover rain', type: 'int', minValue: 1, maxValue: 25, defaultValue: 15}, {name: 'sepchar', type: 'choice', choice1: 'Vertical Bar', choice2: 'Hearts', choice3:'Glitter',choice4:'Flowers',choice5:'Bow',choice6:'Hearts2',choice7:'Smiley',choice8:'Text Heart', choice9:'Text Diamond', choice10:'Text Star', defaultValue: 'Vertical Bar', label: "Separator character"}, {name:'item1', type:'str', label:'Item 1 (eg 10--flash tits)',}, {name:'item2', type:'str', required: false, label:'Item 2',}, {name:'item3', type:'str', required: false, label:'Item 3',}, {name:'item4', type:'str', required: false, label:'Item 4',}, {name:'item5', type:'str', required: false, label:'Item 5',}, {name:'item6', type:'str', required: false, label:'Item 6',}, {name:'item7', type:'str', required: false, label:'Item 7',}, {name:'item8', type:'str', required: false, label:'Item 8',}, {name:'item9', type:'str', required: false, label:'Item 9',}, {name:'item10', type:'str', required: false, label:'Item 10',}, {name:'noticecolor', type:'str', label:'Notice color (html code default red #0000FF)', defaultValue: '#FF0000'}, {name: 'chat_ad', type:'int', minValue: 1, maxValue: 999, defaultValue: 1, label: 'Delay in minutes between notice being displayed (minimum 1)'} ]; var mmMembers = {}; var mgMembers = {}; var bMembers = {}; var dMembers = {}; var mmNotice = "Tip " + cb.settings.bMinTip + " or more to become a Bunny Lover and win a special prize!\nThis bot is made for Hornybunny_"; var HEART = '\u2665'; // ? BDIAMOND = '\u2666'; // ? BSTAR = '\u2605'; // ? var tip_amt = 0; var separator_char = "| "; var msg; var MAXITEMS=10; var tipmenuprice = []; var tipmenuitem= []; var MAXSEP = 9; separators = [ {label:'Hearts',shortcut:':heart2'}, {label:'Glitter',shortcut:':pixelglitter'}, {label:'Flowers',shortcut:':tinyflower2'}, {label:'Bow',shortcut:':bluebow'}, {label:'Hearts2',shortcut:':pixelheart'}, {label:'Smiley',shortcut:':smile'}, {label:'Text Heart',shortcut:HEART}, {label:'Text Diamond',shortcut:BDIAMOND}, {label:'Text Star',shortcut:BSTAR}, ] // For auto-silencing at least some of token_wh*re_c*nts usernames var twcRegex = /t.?k.?n.?wh.?r.?_c.?nt.?/i; function showMMNotice() { cb.chatNotice(mmNotice); cb.setTimeout(showMMNotice, 900000); } cb.onMessage(function (msg) { // vars for ease of use var u = msg['user']; // Don't process commands and hide them if (/^\//.test(msg['m'])) { msg['X-Spam'] = true; return msg; } if (isD(u)) { // msg['background'] = '#' + cb.settings.dBGColor; msg['c'] = '#' + cb.settings.dTextColor; msg['m'] = "[" + cb.settings.dText + "] " + msg['m']; } else if (isB(u)) { // msg['background'] = '#' + cb.settings.bBGColor; msg['c'] = '#' + cb.settings.bTextColor; msg['m'] = " " + cb.settings.bText + " " + msg['m']; } else if (isMG(u)) { // msg['background'] = '#' + cb.settings.mgBGColor; msg['c'] = '#' + cb.settings.mgTextColor; msg['m'] = "[" + cb.settings.mgText + "] " + msg['m']; } else if (isMM(u)) { // msg['background'] = '#' + cb.settings.mmBGColor; msg['c'] = '#' + cb.settings.mmTextColor; msg['m'] = "[" + cb.settings.mmText + "] " + msg['m']; } if (twcRegex.test(u)) { // Auto-silencing at least some of token_wh*re_c*nts usernames msg['X-Spam'] = true; } return msg; }); cb.onTip(function (tip) { var amountTipped = parseInt(tip['amount']); for (var i = 1; i <= MAXITEMS; i++) if (amountTipped == tipmenuprice[i]) { cb.sendNotice(tip['from_user'] + ' tipped for ' + tipmenuitem[i],'','',cb.settings['noticecolor'],'bold'); } if ((amountTipped >= cb.settings.dMinTip || (amountTipped >= (cb.settings.dMinTip - cb.settings.bMinTip) && isB(tip['from_user'])) || (amountTipped >= (cb.settings.dMinTip - cb.settings.mgMinTip) && isMG(tip['from_user']))) && !isD(tip['from_user'])) { // Make Megahero and announce it var announcement = cb.settings.dAnnounce.replace("MEMBERNAME", tip['from_user']); makeD(tip['from_user']); for (var i = 0; i < cb.settings.dRainCount; i++) { cb.chatNotice(cb.settings.dRainText); } cb.chatNotice(announcement); } else if ((amountTipped >= cb.settings.bMinTip || (amountTipped >= (cb.settings.bMinTip - cb.settings.mgMinTip) && isMG(tip['from_user'])) ) && !isB(tip['from_user']) && !isD(tip['from_user'])) { // Make Bunny Lover and announce it var announcement = cb.settings.bAnnounce.replace("MEMBERNAME", tip['from_user']); makeB(tip['from_user']); for (var i = 0; i < cb.settings.bRainCount; i++) { cb.chatNotice(cb.settings.bRainText); } cb.chatNotice(announcement); } else if (amountTipped >= cb.settings.mgMinTip && !isMG(tip['from_user']) && !isB(tip['from_user']) && !isD(tip['from_user'])) { // Make Bunny and announce it var announcement = cb.settings.mgAnnounce.replace("MEMBERNAME", tip['from_user']); makeMG(tip['from_user']); for (var i = 0; i < cb.settings.mgRainCount; i++) { cb.chatNotice(cb.settings.mgRainText); } cb.chatNotice(announcement); } else if (amountTipped >= cb.settings.mmMinTip && !isMM(tip['from_user']) && !isMG(tip['from_user']) && !isB(tip['from_user']) && !isD(tip['from_user'])) { // Make Lover and announce it var announcement = cb.settings.mmAnnounce.replace("MEMBERNAME", tip['from_user']); makeMM(tip['from_user']); for (var i = 0; i < cb.settings.mmRainCount; i++) { cb.chatNotice(cb.settings.mmRainText); } cb.chatNotice(announcement); } }); function isD(username) { return (username in dMembers); } function isB(username) { return (username in bMembers); } function isMG(username) { return (username in mgMembers); } function isMM(username) { return (username in mmMembers); } function makeD(username) { dMembers[username] = {'u': 1}; } function makeB(username) { bMembers[username] = {'u': 1}; } function makeMG(username) { mgMembers[username] = {'u': 1}; } function makeMM(username) { mmMembers[username] = {'u': 1}; } function grabSettings() { cb.log("starting grabbing settings"); // Get legend members if (cb.settings.mmMemberList) { var mmMemberSettings = cb.settings.mmMemberList.split(','); for (var ii = 0; ii < mmMemberSettings.length; ii++) { var clean = mmMemberSettings[ii].toLowerCase().replace(/ /g, ""); mmMembers[clean] = {'u': 1}; } } // Get ace if (cb.settings.mgMemberList) { var mgMemberSettings = cb.settings.mgMemberList.split(','); for (var ii = 0; ii < mgMemberSettings.length; ii++) { var clean = mgMemberSettings[ii].toLowerCase().replace(/ /g, ""); mgMembers[clean] = {'u': 1}; } } // Get Bunny Lover if (cb.settings.bMemberList) { var bMemberSettings = cb.settings.bMemberList.split(','); for (var ii = 0; ii < bMemberSettings.length; ii++) { var clean = bMemberSettings[ii].toLowerCase().replace(/ /g, ""); bMembers[clean] = {'u': 1}; } } // Get Megahero if (cb.settings.dMemberList) { var dMemberSettings = cb.settings.dMemberList.split(','); for (var ii = 0; ii < dMemberSettings.length; ii++) { var clean = dMemberSettings[ii].toLowerCase().replace(/ /g, ""); dMembers[clean] = {'u': 1}; } } cb.log("finished grabbing settings"); } grabSettings(); showMMNotice(); function chatAd() { if (msg!='Tip Menu: ') { cb.sendNotice(msg,'','',cb.settings['noticecolor'],'bold'); } cb.setTimeout(chatAd, (cb.settings.chat_ad * 60000)); } cb.setTimeout(chatAd, (cb.settings.chat_ad * 60000)); function init() { for (i=0;i<=MAXSEP-1;i++) { if (cb.settings['sepchar'] == separators[i].label) { separator_char = separators[i].shortcut + ' '; } } msg = 'Tip Menu: '; for (i=1;i<=MAXITEMS;i++) { var tmp; tmp=cb.settings['item' + i]; if (tmp) { var arr= tmp.split('--'); if (arr[1]===undefined) { cb.sendNotice('Error-You need two dashes to separate the tip amount and menu item for item no '+ i,'','',cb.settings['noticecolor'],'bold'); } else { var amt=parseInt(arr[0]); if (amt>0) { tipmenuprice[i]=amt; tipmenuitem[i]=arr[1]; if (i>=2) { msg += separator_char; } msg += arr[1] + '(' + amt + ') '; } } } } if (msg!= 'Tip Menu: ') { cb.sendNotice(msg,'','',cb.settings['noticecolor'],'bold'); } else { cb.sendNotice('Error-No menu items found','','',cb.settings['noticecolor'],'bold'); } } init();
© Copyright Chaturbate 2011- 2024. All Rights Reserved.