Bots Home
|
Create an App
just4Shalina
Author:
sweet_shalina
Description
Source Code
Launch Bot
Current Users
Created by:
Sweet_Shalina
var times_goal_reached = 0; var last_time_goal_reached = null; var current_goal_tipped = 0; var current_description = null; var current_free_tips = 0; var timeint_just4u_notice = 0; var just4u_color = '#E0C5E4'; var set_tokens_command = '!settok'; var set_reached_command = '!setreached'; var new_subject_command = '!status'; var help_command = '!help'; var just4u_command = '!j4etimer'; var autoreset_command = '!autoreset'; cb.settings_choices = [{ name: 'goal_description', type: 'str', defaultValue: 'Shalina\'s room', minLength: 1, maxLength: 255, label: 'Room status' }, { name: 'just4V_activation', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes', label: 'Activate Just4Shalina?' }, { name: 'Just4V_notice_timer', type: 'int', minValue: 0, default: 300, label: 'Just4Shalina notice after how many seconds (0 = never) 5 minute default' }, { name: 'autoreset_activation', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes', label: 'Activate auto-reset tip goal' }, { name: 'tokens', type: 'int', minValue: 1, default: 100, label: 'Tokens for each tip goal' }, { name: 'received_tokens', type: 'int', minValue: 0, default: 0, label: 'Current number of tokens if you want to count them' }]; if (cb.settings.just4u_activation == 'Yes') { timeint_just4u_notice = cb.settings.Just4V_notice_timer * 1000; if (timeint_just4u_notice > 0) { cb.setTimeout(notice_just4u, parseInt(timeint_just4u_notice)) } } if (cb.settings.wheel_activation == 'Yes') { timeint_wheel_notice = cb.settings.wheel_notice_timer * 1000; if (timeint_wheel_notice > 0) { cb.setTimeout(notice_wheel, parseInt(timeint_wheel_notice)) } } function refresh() { cb.log("Refresh called"); cb.setTimeout(refresh, 20000); cb.drawPanel() } function update_subject() { var a = current_description; if (cb.settings.autoreset_activation == 'Yes') { a += " [" + tips_remaining() + " tokens remaining]" } cb.log("Changing subject to: " + a); cb.changeRoomSubject(a) } function goalReached(a) { last_time_goal_reached = new Date(); var b = Math.floor(current_goal_tipped / cb.settings.tokens); for (var i = 0; i < b; i++) { times_goal_reached++; current_goal_tipped -= cb.settings.tokens; if (a != '') { cb.sendNotice("Goal was reached for the " + getNumberString(times_goal_reached) + " time!"); cb.sendNotice('' + a + ' has reached the goal.', cb.room_slug, "#FEF9CD", "#1A1AD7", "bold") } } } function getNumberString(a) { var b = null; var c = String(a).charAt(String(a).length - 1); if ((c == '1') && (a != 11)) { b = a + "st" } else if ((c == '2') && (a != 12)) { b = a + "nd" } else if ((c == '3') && (a != 13)) { b = a + "rd" } else { b = "" + a + "th" } return (b) } function tips_remaining() { var r = cb.settings.tokens - current_goal_tipped; if (r < 0) { return 0 } else { return r } } function notice_just4u() { if ((cb.settings.just4u_activation == 'Yes') && (timeint_just4u_notice > 0)) { cb.sendNotice('Type just4Shalina at the start of your tip note and the tokens will not count towards the goal', '', just4u_color, '#000000', 'bolder'); cb.setTimeout(notice_just4u, parseInt(timeint_just4u_notice)) } } function init() { if (cb.settings.just4u_activation == 'Yes') { cb.sendNotice('Type just4Shalina at the start of your tip note and the tokens will not count towards the goal', '', just4u_color, '#000000', 'bold') } if (cb.settings.wheel_activation == 'Yes') { cb.sendNotice(cb.room_slug + '\'s Wheel of Fortune [for V].\nTip ' + cb.settings.wheel_tokens + ' to spin the Wheel of Fortune. Type !reward to display the rewards.', '', wheel_color, '#000000', 'bold') } current_description = cb.settings.goal_description; current_goal_tipped = cb.settings.received_tokens; if (current_goal_tipped >= cb.settings.tokens) { goalReached('') } cb.drawPanel(); update_subject() } cb.onTip(function(a) { if ((cb.settings.just4u_activation == 'Yes') && (startsWith(a['message'], 'just4Shalina'))) { current_free_tips += a['amount']; if ((cb.settings.autoreset_activation == 'Yes') && (cb.settings.wheel_activation == 'Yes')) { cb.sendNotice('Thank you ' + a['from_user'] + '. This tip doesn\'t count towards the goal', '', just4u_color, '#000000', 'bold') } else if (cb.settings.autoreset_activation == 'Yes') { cb.sendNotice('Thank you ' + a['from_user'] + '. This tip doesn\'t count towards the goal', '', just4u_color, '#000000', 'bold') } else if (cb.settings.wheel_activation == 'Yes') { cb.sendNotice('Thank you ' + a['from_user'] + '. This tip doesn\'t count towards the goal', '', just4u_color, '#000000', 'bold') } } else { if ((cb.settings.wheel_activation == 'Yes') && (a['amount'] == cb.settings.wheel_tokens)) { spinWheel(a['from_user']) } current_goal_tipped += a['amount']; if (current_goal_tipped >= cb.settings.tokens) { goalReached(a['from_user']) } } update_subject(); cb.drawPanel() }); cb.onMessage(function(a) { var b = ''; if (a['m'][0] == '!') { if (a['user'] == cb.room_slug) { if (startsWith(a['m'], set_tokens_command)) { a['X-Spam'] = true; var c = a['m'].slice(set_tokens_command.length); times_goal_reached = Math.floor(c / cb.settings.tokens); current_goal_tipped = cb.settings.tokens; last_time_goal_reached = new Date(); cb.drawPanel(); cb.sendNotice('The tokens received have been updated', a['user']) } else if (startsWith(a['m'], set_reached_command)) { a['X-Spam'] = true; var c = a['m'].slice(set_reached_command.length); times_goal_reached = c; last_time_goal_reached = new Date(); current_goal_tipped = 0; cb.drawPanel(); cb.sendNotice('The number of times reached has been updated', a['user']) } else if (startsWith(a['m'], new_subject_command)) { a['X-Spam'] = true; var d = a['m'].slice(new_subject_command.length + 1); current_description = d; update_subject(); cb.drawPanel() } else if (startsWith(a['m'], just4u_command)) { a['X-Spam'] = true; var e = timeint_just4u_notice; timeint_just4u_notice = parseInt(a['m'].slice(just4u_command.length + 1)) * 1000; if (e == 0) { notice_just4u() } } } else { if (cb.settings.just4u_activation == 'Yes') { if (startsWith(a['m'], help_command)) { a['X-Spam'] = true; cb.sendNotice('Type just4elly at the start of your tip note and the tokens will not count towards the goal', '', just4u_color, '#000000', 'bolder'); cb.sendNotice('Command !j4etimer [Number of seconds]: allow you to define the time interval to display the "just4u" notice. Red and green can use it.', '', just4u_color, '', 'bolder', 'red'); cb.sendNotice('Command !j4etimer [Number of seconds]: allow you to define the time interval to display the "just4u" notice. Red and green can use it.', '', just4u_color, '', 'bolder', 'green') } else if (startsWith(a['m'], just4u_command)) { if ((a['is_mod'] == true) || (a['in_fanclub'] == true)) { a['X-Spam'] = true; var f = timeint_just4u_notice; timeint_just4u_notice = parseInt(a['m'].slice(just4u_command.length + 1)) * 1000; if (f == 0) { notice_just4u() } } } } } if (startsWith(a['m'], wheel_reward_command)) { a['X-Spam'] = true; if (cb.settings.wheel_activation == 'Yes') { cb.sendNotice(cb.room_slug + '\'s Wheel of Fortune. The rewards.', '', wheel_color, '#000000', 'bold'); for (var i = 0; i < rewards.length; i++) { b += (i + 1) + '. ' + rewards[i] + '\n' } cb.sendNotice(b, '', wheel_color, '#000000', '') } } } }); cb.onDrawPanel(function(a) { if (cb.settings.autoreset_activation == 'Yes') { if (cb.settings.just4u_activation == 'Yes') { if (times_goal_reached == 0) { return { 'template': '3_rows_of_labels', 'row1_label': 'Received / Goal (Total):', 'row1_value': '' + current_goal_tipped + ' / ' + cb.settings.tokens + ' (' + ((times_goal_reached * cb.settings.tokens) + current_goal_tipped) + ')', 'row2_label': 'Tokens "just4u":', 'row2_value': '' + current_free_tips, 'row3_label': 'Hit Goal / Last Time:', 'row3_value': '' + times_goal_reached + ' time / Never' } } else { return { 'template': '3_rows_of_labels', 'row1_label': 'Received / Goal (Total):', 'row1_value': '' + current_goal_tipped + ' / ' + cb.settings.tokens + ' (' + ((times_goal_reached * cb.settings.tokens) + current_goal_tipped) + ')', 'row2_label': 'Tokens "just4u":', 'row2_value': '' + current_free_tips, 'row3_label': 'Hit Goal / Last Time:', 'row3_value': '' + times_goal_reached + ' time(s) / ' + Math.floor(((new Date()).getTime() - last_time_goal_reached.getTime()) / 60000) + ' min ago' } } } else { if (times_goal_reached == 0) { return { 'template': '3_rows_of_labels', 'row1_label': 'Received / Goal (Total):', 'row1_value': '' + current_goal_tipped + ' / ' + cb.settings.tokens + ' (' + ((times_goal_reached * cb.settings.tokens) + current_goal_tipped) + ')', 'row2_label': 'Hit Goal For:', 'row2_value': '' + times_goal_reached + ' times', 'row3_label': 'Last Reached:', 'row3_value': 'Never' } } else { return { 'template': '3_rows_of_labels', 'row1_label': 'Received / Goal (Total):', 'row1_value': '' + current_goal_tipped + ' / ' + cb.settings.tokens + ' (' + ((times_goal_reached * cb.settings.tokens) + current_goal_tipped) + ')', 'row2_label': 'Hit Goal For:', 'row2_value': '' + times_goal_reached + ' times', 'row3_label': 'Last Reached:', 'row3_value': '' + Math.floor(((new Date()).getTime() - last_time_goal_reached.getTime()) / 60000) + ' minutes ago' } } } } else { if (cb.settings.just4u_activation == 'Yes') { return { 'template': '3_rows_of_labels', 'row1_label': '', 'row1_value': '', 'row2_label': 'Tokens "just4u":', 'row2_value': '' + current_free_tips, 'row3_label': '', 'row3_value': '' } } } }); init(); cb.setTimeout(refresh, 20000);
© Copyright Chaturbate 2011- 2026. All Rights Reserved.