Apps Home
|
Create an App
Tip goal
Author:
mustbebig
Description
Source Code
Launch App
Current Users
Created by:
Mustbebig
// vars var total_tipped = 0; var high_tip_username = null; var high_tip_amount = 0; var last_tip_username = null; var last_tip_amount = 0; var subject_is_set_with_0 = false; var goal_description = null; var default_goal_description = 'Custom goal description'; var tokens_goal = 0; cb.settings_choices = [ {name: 'tokens', type: 'int', minValue: 1, maxValue: 10000, default: 100}, {name: 'pre_goal_description', label: 'Predefined Goal Descriptions', type: 'choice', choice1: default_goal_description, choice2: 'Play Pussy', choice3: 'Oil Show', choice4: 'Fuck my pussy with dildo', choice5: 'Finger Ass', choice6: 'Anal', choice7: 'Naked'}, {name: 'custom_goal_description', type: 'str', minLength: 1, maxLength: 255, required: false, label: default_goal_description }, {name: 'hashtag', type: 'str', minLength: 1, maxLength: 255,required: false, label: 'Hashtags (добавляется после гола и счета токенов):', default: '#anal #bigboos #squirt #dildo #new'} ]; // handlers cb.onTip(function(tip) { total_tipped += tip['amount'] if (total_tipped > tokens_goal) { total_tipped = tokens_goal; } update_subject(); last_tip_amount = tip['amount'] last_tip_username = tip['from_user'] if (tip['amount'] > high_tip_amount) { high_tip_amount = tip['amount'] high_tip_username = tip['from_user'] } cb.drawPanel(); }); cb.onDrawPanel(function(user) { return { 'template': '3_rows_of_labels', 'row1_label': 'Tip Received / Goal :', 'row1_value': '' + total_tipped + ' / ' + tokens_goal, 'row2_label': 'Highest Tip:', 'row2_value': format_username(high_tip_username) + ' (' + high_tip_amount + ')', 'row3_label': 'Latest Tip Received:', 'row3_value': format_username(last_tip_username) + ' (' + last_tip_amount + ')' }; }); // helper functions function update_subject() { if (tips_remaining() == 0) { if (subject_is_set_with_0) { return; } subject_is_set_with_0 = true; } else { subject_is_set_with_0 = false; } var new_subject = goal_description + " [" + tips_remaining() + " tokens remaining] " + cb.settings.hashtag; cb.log("Changing subject to: " + new_subject); cb.changeRoomSubject(new_subject); } function tips_remaining() { var r = tokens_goal - total_tipped; if (r < 0) { return 0; } else { return r; } } function format_username(val) { if (val === null) { return "--"; } else { return val.substring(0, 12); } } cb.onMessage(function (msg) { if (msg['has_tokens'] == false) { var str = msg['m'].toLowerCase(); if (str.includes('c2c')){ msg['X-Spam'] = true; } if (str.includes('boyz')){ msg['X-Spam'] = true; } if (str.includes('mmm')){ msg['X-Spam'] = true; } if (str.includes('boys')){ msg['X-Spam'] = true; } if (str.includes('show')){ msg['X-Spam'] = true; } if (str.startsWith('lick')){ msg['X-Spam'] = true; } if (str.startsWith('finger')){ msg['X-Spam'] = true; } if (str.includes('fake')){ msg['X-Spam'] = true; } if (str.includes('watch me')){ msg['X-Spam'] = true; } } if((msg['is_mod']) || (msg['user'] == cb.room_slug)){ if(msg['m'].startsWith("/new")){ total_tipped = 0; tokens_goal=parseInt(msg['m'].substring(5,msg['m'].indexOf(' ',5))); goal_description = msg['m'].substring(msg['m'].indexOf(' ',5),msg['m'].length);; update_subject(); cb.drawPanel(); msg['X-Spam'] = true; } if(msg['m'].startsWith("/goal")){ var str=msg['m']; goal_description = str.substring(6,str.length); update_subject(); msg['X-Spam'] = true; } if(msg['m'].startsWith("/reset")){ total_tipped = 0; update_subject(); cb.drawPanel(); msg['X-Spam'] = true; } } return msg; }); function init() { if ( cb.settings.pre_goal_description == default_goal_description ){ goal_description = cb.settings.custom_goal_description; } else { goal_description = cb.settings.pre_goal_description; } tokens_goal=cb.settings.tokens; if( goal_description == 'undefined'){ goal_description = ' '} update_subject(); } init();
© Copyright Chaturbate 2011- 2024. All Rights Reserved.