Bots Home
|
Create an App
Extended Tips and Notifications
Author:
jesusweptdev
Description
Source Code
Launch Bot
Current Users
Created by:
Jesusweptdev
/* Title: Extended Notification and Tip Menu Bot Author: JesusWept Version: 1.1 (03/07/2015) An extended Notification and Tip Menu Bot in a single script. Extends the number of tip items to 30 and notifications to 20. All credit goes to BadBadBubba */ var HEART = '\u2665'; // ♥ BDIAMOND = '\u2666'; // ♦ BSTAR = '\u2605'; // ★ var arrTipMenuPrice = []; var arrTipMenuItem= []; var iCurrNotification = 0; var iMaxNotifications = 20; var iMaxSeperators = 9; var iMaxTipItems = 30; var iTipAmount = 0; var separator_char = "| "; var notificationMsg; var tipMsg; 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}, ] cb.settings_choices = [ {name:'itemSeperator', 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:'tipItem1', type:'str', label:'Tip Item #1 (e.g. 10--flash tits)',}, {name:'tipItem2', type:'str', required: false, label:'Tip Item #2',}, {name:'tipItem3', type:'str', required: false, label:'Tip Item #3',}, {name:'tipItem4', type:'str', required: false, label:'Tip Item #4',}, {name:'tipItem5', type:'str', required: false, label:'Tip Item #5',}, {name:'tipItem6', type:'str', required: false, label:'Tip Item #6',}, {name:'tipItem7', type:'str', required: false, label:'Tip Item #7',}, {name:'tipItem8', type:'str', required: false, label:'Tip Item #8',}, {name:'tipItem9', type:'str', required: false, label:'Tip Item #9',}, {name:'tipItem10', type:'str', required: false, label:'Tip Item #10',}, {name:'tipItem11', type:'str', required: false, label:'Tip Item #11',}, {name:'tipItem12', type:'str', required: false, label:'Tip Item #12',}, {name:'tipItem13', type:'str', required: false, label:'Tip Item #13',}, {name:'tipItem14', type:'str', required: false, label:'Tip Item #14',}, {name:'tipItem15', type:'str', required: false, label:'Tip Item #15',}, {name:'tipItem16', type:'str', required: false, label:'Tip Item #16',}, {name:'tipItem17', type:'str', required: false, label:'Tip Item #17',}, {name:'tipItem18', type:'str', required: false, label:'Tip Item #18',}, {name:'tipItem19', type:'str', required: false, label:'Tip Item #19',}, {name:'tipItem20', type:'str', required: false, label:'Tip Item #20',}, {name:'tipItem21', type:'str', required: false, label:'Tip Item #21',}, {name:'tipItem22', type:'str', required: false, label:'Tip Item #22',}, {name:'tipItem23', type:'str', required: false, label:'Tip Item #23',}, {name:'tipItem24', type:'str', required: false, label:'Tip Item #24',}, {name:'tipItem25', type:'str', required: false, label:'Tip Item #25',}, {name:'tipItem26', type:'str', required: false, label:'Tip Item #26',}, {name:'tipItem27', type:'str', required: false, label:'Tip Item #27',}, {name:'tipItem28', type:'str', required: false, label:'Tip Item #28',}, {name:'tipItem29', type:'str', required: false, label:'Tip Item #29',}, {name:'tipItem30', type:'str', required: false, label:'Tip Item #30',}, {name:'tipColor', type:'str', label:'Tip Color (html code default red #FF0000)', defaultValue: '#FF0000'}, {name:'tipInterval', type:'int', minValue: 1, maxValue: 999, defaultValue: 1, label: 'How Often Should the Tip Menu Be Displayed? (Minimum 1 min)'}, {name:'msgOnEntry', type: 'choice', choice1: 'yes', choice2: 'no', defaultValue: 'yes', label: "Display first Notification privately on entry? (Set to no for busy rooms)"}, {name:'notificationMsg1', type:'str', required: true, label:'Notification #1',}, {name:'notificationMsg2', type:'str', required: false, label:'Notification #2',}, {name:'notificationMsg3', type:'str', required: false, label:'Notification #3',}, {name:'notificationMsg4', type:'str', required: false, label:'Notification #4',}, {name:'notificationMsg5', type:'str', required: false, label:'Notification #5',}, {name:'notificationMsg6', type:'str', required: false, label:'Notification #6',}, {name:'notificationMsg7', type:'str', required: false, label:'Notification #7',}, {name:'notificationMsg8', type:'str', required: false, label:'Notification #8',}, {name:'notificationMsg9', type:'str', required: false, label:'Notification #9',}, {name:'notificationMsg10', type:'str', required: false, label:'Notification #10',}, {name:'notificationMsg11', type:'str', required: true, label:'Notification #11',}, {name:'notificationMsg12', type:'str', required: false, label:'Notification #12',}, {name:'notificationMsg13', type:'str', required: false, label:'Notification #13',}, {name:'notificationMsg14', type:'str', required: false, label:'Notification #14',}, {name:'notificationMsg15', type:'str', required: false, label:'Notification #15',}, {name:'notificationMsg16', type:'str', required: false, label:'Notification #16',}, {name:'notificationMsg17', type:'str', required: false, label:'Notification #17',}, {name:'notificationMsg18', type:'str', required: false, label:'Notification #18',}, {name:'notificationMsg19', type:'str', required: false, label:'Notification #19',}, {name:'notificationMsg20', type:'str', required: false, label:'Notification #20',}, {name:'notificationColor', type:'str', label:'Notification Color (html code default dark red #9F000F)', defaultValue: '#9F000F'}, {name:'notificationInterval', type:'int', minValue: 1, maxValue: 999, defaultValue: 2, label: 'How Often Should Notifications Be Displayed? (Minimum 1 min)'} ]; cb.onEnter(function(user) { if (cb.settings['msgOnEntry'] == 'yes') { cb.sendNotice('Welcome ' + user['user'] + '! ' + cb.settings['notificationMsg1'],user['user'],'',cb.settings['notificationColor'],'bold'); } }); cb.onTip(function (tip) { iTipAmount=parseInt(tip['amount']); for (var i = 1; i <= iMaxTipItems; i++) { if (iTipAmount == arrTipMenuPrice[i]) { cb.sendNotice(tip['from_user'] + ' tipped for ' + arrTipMenuItem[i],'','',cb.settings['tipColor'],'bold'); } } }); function displayNotification() { while (cb.settings['notificationMsg' + (iCurrNotification + 1)] == 0) { iCurrNotification++; iCurrNotification %= iMaxNotifications; } notificationMsg = cb.settings['notificationMsg' + (iCurrNotification + 1)]; iCurrNotification++; iCurrNotification %= iMaxNotifications; cb.sendNotice(notificationMsg,'','',cb.settings['notificationColor'],'bold'); cb.setTimeout(displayNotification, (cb.settings.notificationInterval * 60000)); } function displayTipMenu() { if (tipMsg != 'Tip Menu: ') { cb.sendNotice(tipMsg,'','',cb.settings['tipColor'],'bold'); } cb.setTimeout(displayTipMenu, (cb.settings.tipInterval * 60000)); } cb.setTimeout(displayNotification, (cb.settings.notificationInterval * 60000)); cb.setTimeout(displayTipMenu, (cb.settings.tipInterval * 60000)); function init() { for (i=0;i<=iMaxSeperators-1;i++) { if (cb.settings['itemSeperator'] == separators[i].label) { separator_char = separators[i].shortcut + ' '; } } tipMsg = 'Tip Menu: '; for (i=1;i<=iMaxTipItems;i++) { var tmp; tmp=cb.settings['tipItem' + 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) { arrTipMenuPrice[i] = amt; arrTipMenuItem[i] = arr[1]; if (i >= 2) { tipMsg += separator_char; } tipMsg += arr[1] + ' (' + amt + ') '; } } } } if (tipMsg != 'Tip Menu: ') { cb.sendNotice(tipMsg,'','',cb.settings['tipColor'],'bold'); } else { cb.sendNotice('Error-No menu items found','','',cb.settings['tipColor'],'bold'); } } init();
© Copyright Chaturbate 2011- 2024. All Rights Reserved.