Bots Home
|
Create an App
testantispam
Author:
tok124
Description
Source Code
Launch Bot
Current Users
Created by:
Tok124
var MAXITEMS = 30; // Change this value to add more/less items to the menu var items = []; var prices = []; var myvar = []; var msg; cb.settings_choices = [ { name: 'discount', type: 'int', minValue:1, maxValue:99, label: 'Discount Percentage', defaultValue: 30 }, { name: 'reqtok', type: 'int', minValue:1, label: 'Required token amount before user get discount', defaultValue: 100, required:true }, { name: 'delay', type: 'int', minValue:1, label: 'delay in minutes to send tipmenu in chat', defaultValue: 1, required:true }, { name: 'noticeclr', type: 'str', label: 'hecolor for text in notifications from this bot (Example: #ff66cc)', defaultValue: '#ff66cc' }, { name: 'noticebgclr', type: 'str', label: 'hecolor for background in notifications from this bot (Example: #ffccff)', defaultValue: '#ffccff' }, { name: 'item1', type: 'str', label: '(Format: price--item, Example: 50--Flash Boobs) Item1', defaultValue: '' } ]; for(var i = 2; i <= MAXITEMS; i++) { cb.settings_choices.push({name:'item'+i, type:'str', label:'item '+i, required:false}); } cb.onTip(function(tip){ var personName = {name: tip.from_user, amount: tip.amount, sendmsg:0, sendmsg2:0}; var userExist = false; for (let i=0; i < myvar.length; i++) { if (myvar[i].name == tip.from_user){ myvar[i].amount += tip.amount; userExist = true; break; } } if (!userExist) { myvar.push(personName); } for(let i = 0; i < myvar.length; i++) { if(tip.from_user == myvar[i].name && myvar[i].amount >= 25 && myvar[i].sendmsg == 0) { if(myvar[i].sendmsg == 0) { cb.sendNotice('You have tipped more than 25 tokens. Please do not forget to rate thumbs up for me if you like me', tip.from_user, '#000000', '#FFFFFF','bold'); } myvar[i].sendmsg = 1; } } for(let i = 0; i < myvar.length; i++) { if(tip.from_user == myvar[i].name && myvar[i].amount >= cb.settings.reqtok && myvar[i].sendmsg2 == 0) { if(myvar[i].sendmsg2 == 0) { cb.sendNotice('Congratulations user '+tip.from_user+'!!! You have recieved the discount ! Enjoy a cheaper menu','', '#000000', '#FFFFFF','bold'); } myvar[i].sendmsg2 = 1; } } for(let i = 0; i < myvar.length; i++) { if(tip.from_user == myvar[i].name) { var usertipamount = parseInt(tip.amount); for (let j = 1; j <= MAXITEMS; j++) { if(myvar[i].amount >= cb.settings.reqtok && usertipamount == discount(prices[j], cb.settings.discount)) { cb.sendNotice(tip.from_user+' tipped for '+items[j]+'. Thank you very much !', '', cb.settings.noticebgclr, cb.settings.noticeclr, 'bold'); }else{ if(myvar[i].amount < cb.settings.reqtok && usertipamount == prices[j]) { cb.sendNotice(tip.from_user+' tipped for '+items[j]+'. Thank you very much !', '', cb.settings.noticebgclr, cb.settings.noticeclr, 'bold'); } } } } } //sendtoplist(); }); function discount(price, discount) { return Math.round(price - (price * discount/100)); } function notifier() { if(msg != '~~### '+cb.room_slug.toUpperCase()+'\'S TIPMENU ###~~ ') { cb.sendNotice(msg,'',cb.settings.noticebgclr, cb.settings.noticeclr, 'bold'); } cb.setTimeout(notifier, cb.settings.delay*60000); } cb.setTimeout(notifier, cb.settings.delay*60000); function init() { msg = '~~### '+cb.room_slug.toUpperCase()+'\'S TIPMENU ###~~\n'; msg += 'Tip a total amount of atleast '+cb.settings.reqtok+' tokens to get a '+cb.settings.discount+'% bonus on tipmenu\n'; for (var i = 1; i <= MAXITEMS; i++) { var item; item = cb.settings['item'+i]; if(item) { var menuarray = item.split('--'); if (menuarray[1]===undefined) { cb.sendNotice('Unreocognized Format. Make sure to add x2 dashes to separate price from item. EXAMPLE: 50--Flash Boobs',cb.room_slug,cb.settings.noticebgclr, cb.settings.noticeclr,'bold') }else{ var tipamount = parseInt(menuarray[0]); if(tipamount > 0) { prices[i] = tipamount; items[i] = menuarray[1]; msg += menuarray[1]+'('+tipamount+') | Discount ('+discount(tipamount,cb.settings.discount)+')\n'; } } } } if(msg != '~~### '+cb.room_slug.toUpperCase()+'\'S TIPMENU ###~~ ') { cb.sendNotice(msg,'',cb.settings.noticebgclr, cb.settings.noticeclr, 'bold'); }else{ cb.sendNotice('Error-No menu items found','',cb.settings.noticebgclr, cb.settings.noticeclr, 'bold'); } } init();
© Copyright Chaturbate 2011- 2024. All Rights Reserved.