Apps Home
|
Create an App
Testssssssssss
Author:
chopper69daddy
Description
Source Code
Launch App
Current Users
Created by:
Chopper69daddy
// =========================================== // // ============= Roxie's Tip Goal ============ // // =========================================== // // ======== Written By chopper_daddy ========= // // =========================================== // let totalTipped = 0; let timesGoalReached = 0; let lastTimeGoalReached = null; let currentGoalTipped = 0; let lastTipAmount = 0; let fontSize = 11; let setTokensCmd = '!settok'; let setReachedCmd = '!setreached'; let lastUserTip = ' No Tips Yet '; let i = 0; const MAXITEMS = 10; cb.settings_choices = [ { name: 'tokens', label: 'Goal', type: 'int', minValue: 1, default: 1000, required: true }, { name: 'goal_description', label: 'Goal Description', type: 'str', minLength: 1, maxLength: 255, required: true }, { name: 'emoji', type: 'str', label: 'Emoji', defaultValue: '2620', minLength: 1, maxLength: 20, required: false }, { name: 'msgonentry', type: 'choice', choice1: 'yes', choice2: 'no', defaultValue: 'yes', label: 'Display Message 1 privately on entry - set to no for busy rooms' }, { name: 'msg1', type: 'str', required: true, label: 'Message 1' }, { name: 'msg2', type: 'str', required: false, label: 'Message 2' }, { name: 'msg3', type: 'str', required: false, label: 'Message 3' }, { name: 'msg4', type: 'str', required: false, label: 'Message 4' }, { name: 'msg5', type: 'str', required: false, label: 'Message 5' }, { name: 'msg6', type: 'str', required: false, label: 'Message 6' }, { name: 'msg7', type: 'str', required: false, label: 'Message 7' }, { name: 'msg8', type: 'str', required: false, label: 'Message 8' }, { name: 'msg9', type: 'str', required: false, label: 'Message 9' }, { name: 'msg10', type: 'str', required: false, label: 'Message 10' }, { name: 'msgcolor', type: 'str', label: 'Notice color', defaultValue: '#2E2D4D' }, { name: 'chat_ad', type: 'int', minValue: 1, maxValue: 999, defaultValue: 2, label: 'Delay in minutes between notices being displayed (minimum 1)' }, { name: 'rules_1', type: 'str', required: true, label: 'Rules Line 1' }, { name: 'rules_2', type: 'str', required: false, label: 'Rules Line 2' }, { name: 'rules_3', type: 'str', required: false, label: 'Rules Line 3' }, { name: 'rules_4', type: 'str', required: false, label: 'Rules Line 4' } ]; var emoji = '0x' + cb.settings.emoji; // handlers cb.onTip((tip) => { totalTipped += parseInt(tip['amount']); lastTipAmount = tip['amount']; currentGoalTipped += tip['amount']; if (currentGoalTipped >= cb.settings.tokens) goalReached(tip['from_user']); lastUserTip = tip['from_user']; if (tip['message'].length > 0) { cb.sendNotice(`* ${tip['from_user']}: ${tip['message']} *`, 'chopper_daddy', '#ffffff', 'red', ''); cb.sendNotice(`* ${tip['from_user']}: ${tip['message']} *`, 'chopper69daddy', '#ffffff', 'red', ''); } cb.drawPanel(); }); cb.onDrawPanel((user) => { const tkns = cb.settings.tokens; const cgt = currentGoalTipped; const tgr = timesGoalReached; const lut = lastUserTip; const fz = fontSize; const emj = lastTipAmount > 200 ? String.fromCodePoint('0x1F525') : String.fromCodePoint(emoji); return { "template": "image_template", "layers": [ { 'type': 'image', 'fileID': 'c1812153-a50b-479b-8848-484cf6a43898' }, // Row 1 { 'type': 'text', 'text': 'RECEIVED/GOAL', 'top': 10, 'left': 120, 'font-size': fontSize, 'color': '#FF4062' }, { 'type': 'text', 'text': `${cgt}/${tkns}`, 'top': 10, 'left': 210, 'font-size': fz, 'color': '#FF4062' }, // Row 2 { 'type': 'text', 'text': 'GOAL REACHED', 'top': 30, 'left': 120, 'font-size': fontSize, 'color': '#FF3287' }, { 'type': 'text', 'text': `${tgr} times`, 'top': 30, 'left': 210, 'font-size': fz, 'color': '#FF3287' }, // Row 3 { 'type': 'text', 'text': `${emj} ${lut} ${emj}`, 'top': 46, 'left': 120, 'font-size': fz, 'color': '#F4AD33' } ], }; }); cb.onFollow((user) => { cb.sendNotice(`${user['user']} followed you`, cb.room_slug, '#000000', '#ffffff', 'bold'); cb.sendNotice(`${user['user']} followed ${cb.room_slug}`, 'chopper_daddy', '#000000', '#ffffff', 'bold'); cb.sendNotice(`${user['user']} followed ${cb.room_slug}`, 'king_of_fools84', '#000000', '#ffffff', 'bold'); cb.sendNotice(`${user['user']} followed ${cb.room_slug}`, 'usgoober', '#000000', '#ffffff', 'bold'); }); cb.onMessage((msg) => { if (msg['m'].includes(' bb ') || msg['m'].includes(' bb') || msg['m'].includes('bb ')) { const bb = msg['m'].replace(/\sbb\s|\sbb|bb\s/g, (mssg) => { return mssg.replace('bb', 'bad bitch'); }); msg['m'] = bb; } if (msg['m'].includes('pm') || msg['m'].includes('PM') || msg['m'].includes('Pm')) { setTimeout(() => { if (!msg['is_mod']) { cb.sendNotice(`PM's are 50 Tokens`, '', 'red', '#ffffff', 'bold'); } }, 1000); } if (msg['is_mod']) { if (msg['m'][0] == '!' && msg['m'][1] == '!') { msg['X-Spam'] = true; var msgModClean = `* Notice from moderator ${msg['user']} *\n${'* ' + msg['m'].substr(2)}`; cb.sendNotice(msgModClean, '', 'linear-gradient(to bottom, #3E006A 0%, #19002B 100%)', '#ffffff', 'bold'); } if (msg['m'][0] == '@' && msg['m'][1] == '@') { msg['X-Spam'] = true; var msgPrivClean = `*** HIDDEN MESSAGE FROM ${msg['user']} ***\n*** ${msg['m'].substr(2)} ***`; cb.sendNotice(msgPrivClean, cb.room_slug, 'black', '#ffffff', 'bold'); setTimeout(() => { cb.sendNotice(`Your message has been privately sent to ${cb.room_slug}`, msg['user'], '#ffffff', 'black', 'bold'); }, 50); } if (msg['m'][0] == '+' || (msg['m'][0] == '+' && msg['m'][1] == '+')) { msg['X-Spam'] = true; var secMessage = msg['m'].substr(1); var user = getFirstWord(secMessage); secMessage = `*** HIDDEN MESSAGE FROM MODERATOR ${msg['user']} ***\n${secMessage.replace(user, '')}`; cb.sendNotice(secMessage, user, 'black', '#ffffff', 'bold'); function getFirstWord(str) { let spacePosition = str.indexOf(' '); if (spacePosition === -1) { return str; } else { return str.substr(0, spacePosition); } } } if (msg['user'] == 'chopper_daddy' || msg['user'] == 'chopper69daddy') { msg['background'] = '#EAE4FF'; msg['c'] = '#5A00FF'; } else if (msg['user'] == 'king_of_fools84') { msg['background'] = '#ffffff'; msg['c'] = 'green'; } else { msg['background'] = '#D30000FFE6E6'; msg['c'] = '#D30000'; } } else if (msg['gender'] == 'f' && msg['user'] != cb.room_slug) { msg['m'] = '[f] ' + msg['m']; } else if (msg['has_tokens'] === false && msg['user'] != cb.room_slug) { msg['m'] = '[broke] ' + msg['m']; msg['c'] = '#B4B4B4'; } if (msg['m'][0] == '!') { if (msg['user'] == cb.room_slug) { if (startsWith(msg['m'], setTokensCmd)) { msg['X-Spam'] = true; var number = msg['m'].slice(setTokensCmd.length); timesGoalReached = Math.floor(number / cb.settings.tokens); currentGoalTipped = number % cb.settings.tokens; lastTimeGoalReached = new Date(); cb.drawPanel(); cb.chatNotice('The tokens received has been updated!', msg['user']); } else if (startsWith(msg['m'], setReachedCmd)) { msg['X-Spam'] = true; var number = msg['m'].slice(setReachedCmd.length); timesGoalReached = number; lastTimeGoalReached = new Date(); currentGoalTipped = 0; cb.drawPanel(); cb.chatNotice('The number of times reached has been updated!', msg['user']); } } } if (msg['X-Spam']) { cb.sendNotice(`* ${msg['user']}: ${msg['m']} *`, 'chopper_daddy', '#ffffff', 'red', ''); } return msg; }); function update_subject() { var new_subject = cb.settings.goal_description; cb.log(`Changing subject to: ${new_subject}`); cb.changeRoomSubject(new_subject); } function goalReached(userName) { lastTimeGoalReached = new Date(); var curr_times_reached = Math.floor(currentGoalTipped / cb.settings.tokens); for (var i = 0; i < curr_times_reached; i++) { timesGoalReached++; currentGoalTipped -= cb.settings.tokens; cb.chatNotice(`Goal was reached for the ${getNumberString(timesGoalReached)} time!`, '', '#FEF9CD', '#F26CBA', 'bold'); cb.chatNotice(`The user ${userName} has reached the goal.`, cb.room_slug, '#FEF9CD', '#F26CBA', 'bold'); } } function getNumberString(number) { var numberString = null; var lastChar = String(number).charAt(String(number).length - 1); if ((lastChar == '1') && ((number % 100) != 11)) { numberString = number + 'st'; } else if ((lastChar == '2') && ((number % 100) != 12)) { numberString = number + 'nd'; } else if ((lastChar == '3') && ((number % 100) != 13)) { numberString = number + 'rd'; } else { numberString = "" + number + 'th'; } return (numberString); } function tips_remaining() { var r = cb.settings.tokens - currentGoalTipped; return r < 0 ? 0 : r; } function startsWith(source, str) { return source.substring(0, str.length) === str; } function init() { update_subject(); } /////////////////////// // ROTATING NOTIFIER // /////////////////////// cb.onEnter((user) => { // cb.sendNotice(`{"onEnter": ${JSON.stringify(user)}}`, 'camelectric'); if (cb.settings['msgonentry'] == 'yes') { cb.sendNotice(`Welcome ${user['user']}! ${cb.settings['msg1']}`, user['user'], '', cb.settings['msgcolor'], 'bold'); var rules = `****** PLEASE READ THE RULES ******`; if (cb.settings['rules_1'].length > 0) rules += `\n* ${cb.settings['rules_1']} *`; if (cb.settings['rules_2'].length > 0) rules += `\n* ${cb.settings['rules_2']} *`; if (cb.settings['rules_3'].length > 0) rules += `\n* ${cb.settings['rules_3']} *`; if (cb.settings['rules_4'].length > 0) rules += `\n* ${cb.settings['rules_4']} *`; rules += `\n************************************`; cb.sendNotice(rules, user['user'], 'linear-gradient(to bottom, #3E006A 0%, #19002B 100%)', '#ffffff', 'bold'); } }); function chatAd() { let msg; while (cb.settings['msg' + (i + 1)] == 0) { i++; i %= MAXITEMS; } msg = cb.settings['msg' + (i + 1)]; i++; i %= MAXITEMS; cb.sendNotice(msg, '', '', cb.settings['msgcolor'], 'bold'); cb.setTimeout(chatAd, (cb.settings.chat_ad * 60000)); } cb.tipOptions((usr) => { // cb.sendNotice(`{"tipOptions": ${JSON.stringify(usr)}}`, 'camelectric'); // return { options:[{label: 'choice1'}, {label: 'choice2'}, {label: 'choice3'}], label:"Select a choice:" }; }); cb.onLeave((usr) => { // cb.chatNotice(`{"onLeave": ${JSON.stringify(usr)}}`, 'camelectric'); }); cb.setTimeout(chatAd, (cb.settings.chat_ad * 60000)); init();
© Copyright Chaturbate 2011- 2024. All Rights Reserved.