Apps Home
|
Create an App
test birthday app
Author:
testty
Description
Source Code
Launch App
Current Users
Created by:
Testty
/** Name: Yesonee's Birthday Spank Counter Author: ty8633 Created: 12/06/2020 Written for Yesonee's room to keep a running total of spank tips during a show. Commands: /help - Shows spank commands for mods /showspanks - Shows current spank totals /setspanks XX - resets the total to XX /resetspanks - resets the total to 0 **/ // settings cb.settings_choices = [ { name: 'tip_price', type: 'int', minValue: 1, label: 'Tip amount for spanks', defaultValue: 30, required: true }, { name: 'interval', type: 'int', minValue: 0, label: 'Interval to show count (in minutes - Enter 0 to disable)', defaultValue: 4, required: true } ]; // vars var tip_amt = cb.settings.tip_price; var spank_count = 0; var msg_counter = 0; var msg_timer = cb.settings.interval * 60000; // functions cb.onTip(function(tip) { if (parseInt(tip['amount']) === tip_amt) { spank_count += 1; msg_counter += 1; if (msg_counter >= 10) { msg_counter = 0; cb.sendNotice('Spank Count: ' + spank_count,'','',"#FF0000",'bold'); } }; }); cb.onEnter(function(user) { var u = user.user; var isMod = user.is_mod; var isBC = (u === cb.room_slug); var msg; if (isMod || isBC) {show_spank_commands(u)}; }); cb.onMessage(function(m) { var msg_u = m.user; var msg = m.m.split(" "); var isMod = (cb.room_slug === msg_u || m.is_mod); if(msg[0].charAt(0) == '/') { m['X-Spam'] = true; if (isMod) { switch (msg[0].toLowerCase()) { case "/help": { show_spank_commands(msg_u); break; }; case "/spanks": case "/showspanks": { show_count(); break; }; case "/setspanks": { if (Number.isInteger(parseInt(msg[1]))){ spank_count = +msg[1]; }; show_count(); break; }; case "/resetspanks": { spank_count = +0; show_count(); break; }; case "/setspanktip": { if (Number.isInteger(parseInt(msg[1]))){ tip_amt = +msg[1]; }; cb.sendNotice('Tip Amount changed to '+msg[1]+' by '+msg_u+'.','','','#DD0000','bold','red'); cb.sendNotice('Tip Amount changed to '+msg[1]+' by '+msg_u+'.',cb.room_slug,'','#DD0000','bold'); break; }; case "/showspanktip": { cb.sendNotice('Current spank price is '+tip_amt+'.',msg_u,'','#DD0000','bold'); break; }; }; }; return m; }; }); function show_spank_commands(u) { var msg; msg = "Spank commands:\n"; msg += "/help - Shows spank commands for mods\n"; msg += "/showspanks - Shows current spank totals\n"; msg += "/setspanks XX - Sets the total to XX\n"; msg += "/resetspanks - Resets the total to 0\n"; //msg += "/setspanktip - Changes spank tip price for this session\n"; //msg += "/showspanktip - Shows the current spank tip price for this session\n"; cb.sendNotice(msg,u,"#DDFFDD","#448844",'bold'); }; function show_count() { var msg; var d = new Date(); msg = 'Total Spanks: ' + spank_count; cb.sendNotice(msg,'','#FFCCCC',"#AA0000",'bold'); }; function show_spanks_time() { show_count(); cb.setTimeout(show_spanks_time,msg_timer); }; function init() { var msg; msg = "Yesonee's Spanks\n"; msg += "Tip "+tip_amt+" to add to the count."; cb.sendNotice(msg,'',"#FFCCCC","#AA0000",'bold'); show_count(); cb.setTimeout(show_spanks_time,msg_timer); msg = "Spank commands:\n"; msg += "/help - Shows spank commands for mods\n"; msg += "/showspanks - Shows current spank totals\n"; msg += "/setspanks XX - Sets the total to XX\n"; msg += "/resetspanks - Resets the total to 0\n"; //msg += "/setspanktip - Changes spank tip price for this session\n"; //msg += "/showspanktip - Shows the current spank tip price for this session\n"; cb.sendNotice(msg,cb.room_slug,"#DDFFDD","#448844",'bold'); cb.sendNotice(msg,'',"#DDFFDD","#448844",'bold','red'); }; init();
© Copyright Chaturbate 2011- 2024. All Rights Reserved.