Bots Home
|
Create an App
aaana
Author:
snow_test
Description
Source Code
Launch Bot
Current Users
Created by:
Snow_Test
cb.settings_choices = [ { name: 'item1', type: 'str', minLength: 1, maxLength: 30, label: "Menu Item 1 (required)" }, { name: 'price1', type: 'int', minValue: 0, defaultValue: 10, label: "Item 1 Price (required)" }, { name: 'item2', type: 'str', minLength: 1, maxLength: 50, label: "Menu Item 2 (required)" }, { name: 'price2', type: 'int', minValue: 0, defaultValue: 20, label: "Item 2 Price (required)" }, { name: 'item3', type: 'str', minLength: 1, maxLength: 50, label: "Menu Item 3", required: false }, { name: 'price3', type: 'int', minValue: 0, label: "Item 3 Price", required: false }, { name: 'item4', type: 'str', minLength: 1, maxLength: 50, label: "Menu Item 4", required: false }, { name: 'price4', type: 'int', minValue: 0, label: "Item 4 Price", required: false }, { name: 'item5', type: 'str', minLength: 1, maxLength: 50, label: "Menu Item 5", required: false }, { name: 'price5', type: 'int', minValue: 0, label: "Item 5 Price", required: false }, { name: 'item6', type: 'str', minLength: 1, maxLength: 50, label: "Menu Item 6", required: false }, { name: 'price6', type: 'int', minValue: 0, label: "Item 6 Price", required: false }, { name: 'item7', type: 'str', minLength: 1, maxLength: 50, label: "Menu Item 7", required: false }, { name: 'price7', type: 'int', minValue: 0, label: "Item 7 Price", required: false }, { name: 'item8', type: 'str', minLength: 1, maxLength: 50, label: "Menu Item 8", required: false }, { name: 'price8', type: 'int', minValue: 0, label: "Item 8 Price", required: false }, { name: 'item9', type: 'str', minLength: 1, maxLength: 50, label: "Menu Item 9", required: false }, { name: 'price9', type: 'int', minValue: 0, label: "Item 9 Price", required: false }, { name: 'item10', type: 'str', minLength: 1, maxLength: 50, label: "Menu Item 10", required: false }, { name: 'price10', type: 'int', minValue: 0, label: "Item 10 Price", required: false } ]; // Build menu var my_menu = []; var listMenu = []; function addMenuRow(item, price) { if (item != '' && price != '') { listMenu.push('' + item + ' (' + price + ') ' + String.fromCodePoint(0x1F496)); var my_menu_item = [item, price]; my_menu.push(my_menu_item); } } addMenuRow(cb.settings.item1, cb.settings.price1); addMenuRow(cb.settings.item2, cb.settings.price2); addMenuRow(cb.settings.item3, cb.settings.price3); addMenuRow(cb.settings.item4, cb.settings.price4); addMenuRow(cb.settings.item5, cb.settings.price5); addMenuRow(cb.settings.item6, cb.settings.price6); addMenuRow(cb.settings.item7, cb.settings.price7); addMenuRow(cb.settings.item8, cb.settings.price8); addMenuRow(cb.settings.item9, cb.settings.price9); addMenuRow(cb.settings.item10, cb.settings.price10); // Functions function showMenu(user) { msg = {'background': '#CCFF99 ', 'weight': 'bold'}; cb.sendNotice('-----' + cb.room_slug + 's Tip Menu -----', user, msg['background'], '', msg['weight']); for (var i = 0; i < listMenu.length; i++) { cb.sendNotice(listMenu[i], user, msg['background'], '', msg['weight']); } }; //Chaturbate events cb.onMessage(function(msg) { // Chat Commands if (msg['m'] == '/menu' || msg['m'] == '/tipmenu') { if (msg['user'] == cb.room_slug) { // if model issues command, send to all showMenu('') } else { // send menu to user requesting it showMenu(msg['user']); msg['X-Spam'] = true; } } return msg; }); cb.onTip(function (tip) { // Processing Tips msg = {'background': '#CCFF99 ', 'weight': 'bold'}; var amount_tipped = parseInt(tip['amount']) my_menu.map ( function(item) { if (item[1] == amount_tipped) { var tiptext = tip['from_user'] + " tipped for " + item[0] cb.sendNotice(tiptext, '', msg['background'],'', msg['weight']); } }); }); cb.onEnter(function(user) { // New User Enters the room cb.sendNotice('Welcome ' + user['user'] + ' !', user['user']); showMenu(user['user']); }); // initialization possibility (unused at the moment) function init() { }; init();
© Copyright Chaturbate 2011- 2025. All Rights Reserved.