Bots Home
|
Create an App
EstestvoTipMenu
Author:
estestvo86
Description
Source Code
Launch Bot
Current Users
Created by:
Estestvo86
/* Title: "Estestvo Tip Menu" bot Version: 1.0.0 */ var tip_amt = 0; var separator_char = " | "; var msg; var ItemsCount; var MAXMENUS=3; var tipmenuprice = []; var tipmenuitem= []; cb.settings_choices = [ {name:'menu1', type:'str', label:'First tip menu (eg flash tits:10, pussy:20)',}, {name:'menu2', type:'str', required: false, label:'Second tip menu',}, {name:'menu3', type:'str', required: false, label:'Third tip menu',}, {name:'noticecolor', type:'str', label:'Notice color (html code default red #FF0000)', defaultValue: '#FF0000'}, {name:'noticecolortip', type:'str', label:'Notice tip color (html code default green #00FF00)', defaultValue: '#00FF00'}, {name: 'chat_ad', type:'int', minValue: 1, maxValue: 999, defaultValue: 1, label: 'Delay in minutes between notice being displayed (minimum 1)'} ]; cb.onMessage(function (message) { var cmd=message['m']; if (message['user']==cb.room_slug) { if (cmd.substr(0,1)==':') { cmd=cmd.substr(cmd.indexOf(' ')+1,cmd.length); }; if (cmd.substr(0,5)=='/menu') { message['m']='And now another tip menu!'; var tmp; msg = 'Tip Menu: '; var menuindex=cmd.substr(5,1); tmp=cb.settings['menu'+menuindex]; if (tmp) { var tipmenu= tmp.split(','); ItemsCount=tipmenu.length; for (var i = 0; i < ItemsCount; i++) { if (tipmenu[i]) { var arr = tipmenu[i].split(':'); var amt=parseInt(arr[1]); if (amt>0) { tipmenuprice[i]=amt; tipmenuitem[i]=arr[0].trim(); if (i>0) { msg += separator_char; } msg += arr[0] + ' (' + amt + ')'; } } } } if (msg!= 'Tip Menu: ') { cb.sendNotice(msg,'','',cb.settings['noticecolor'],'bold'); } else { cb.sendNotice('Error-No menu items found','','',cb.settings['noticecolor'],'bold'); } } }; }); cb.onEnter(function(user) { cb.sendNotice(msg,'','',cb.settings['noticecolor'],'bold'); }); cb.onTip(function (tip) { tip_amt=parseInt(tip['amount']); for (var i = 0; i < ItemsCount; i++) { if (tip_amt == tipmenuprice[i]) { cb.sendNotice(tip['from_user'] + ' tipped for ' + tipmenuitem[i],'','',cb.settings['noticecolortip'],'bold'); } } }); 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() { msg = 'Tip Menu: '; var tmp; tmp=cb.settings['menu1']; if (tmp) { var tipmenu= tmp.split(','); ItemsCount=tipmenu.length; for (var i = 0; i < ItemsCount; i++) { if (tipmenu[i]) { var arr = tipmenu[i].split(':'); var amt=parseInt(arr[1]); if (amt>0) { tipmenuprice[i]=amt; tipmenuitem[i]=arr[0].trim(); if (i>0) { msg += separator_char; } msg += arr[0] + ' (' + 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.