Apps Home
|
Create an App
goal X 1
Author:
loulouw
Description
Source Code
Launch App
Current Users
Created by:
Loulouw
cb.settings_choices = [ {name: 'admins', label: 'Users who can use app commands', type: 'str', required: false, defaultValue: cb.room_slug + ', codeanon'}, {name: 'goals', label: 'Goals', type: 'str', required: false, defaultValue: '1200: shirt off, 2400: topless, 3600: naked'}, {name: 'ignore', label: 'Ignore these tip amounts when calculating goals', type: 'str', required: false}, {name: 'subj', label: 'Room hashtags', type: 'str', required: false, defaultValue: ''}, {name: 'interval', label: 'Show goals to room every ___ seconds (0 = off)', type: 'int', minValue: 0, defaultValue: 180}, {name: 'color', label: 'Text color', type: 'str', required: false, defaultValue: '#DC0000'} ]; var cbs = JSON.parse(JSON.stringify(cb.settings)); var capFirst = (str) => str.charAt(0).toUpperCase() + str.slice(1); var say = (message, user, color, wt) => cb.sendNotice(newLines(message), user, '', color || cbs.color || '#DC0000', wt || cbs.weight || 'bold'); var newLines = (input) => '|\u2007 ' + input.replace(/\n/g, '\n|\u2007 '); var admins = cbs.admins ? cbs.admins.split(/\s*,\s*/) : [cb.room_slug] var goals = []; var mvp = {user: '---', amount: 0}; var tipAmount = 0 ; var tipCount = 0; var tipCount2 = 0 ; var tipLedger = {}; var ignore = cbs.ignore ? cbs.ignore.split(/\s*,\s*/).map((elm) => Number(elm)) : []; /*************************************************** ** GLOBAL VAR ****************************************************/ //var hasPutOptionOnFlashTongueBoobies = ''; //var noticeFlashModel = ''; //var noticePatroler = ''; var goalBotVersion = 2 ; var goalReachedArray = [] ; // lou add var goalReachedPriceArray = [] ; // lou add var goalReachedDurationArray = [] ; // lou add var timerGoalEpoch = 0 ; // lou add var timerGoalInProgress = false ; // lou add var resulta = 0; // lou add var acceptArray = [2]; // lou add var msgPublic = ""; // lou add var msgModel = ""; // lou add var msgPublicGoal = ""; var bigUnderL = '|------------[[' ; // lou add var bigUnderR = ']]------------|' ; // lou add var smallUnderL = '|--[' ; // lou add var smallUnderR = ']--|' ; // lou add var bigUnder = '|--------------------------------------------|' ; // lou add var bigUnderGM = '|--------------------------------------------|' ; // lou add var bigUnderGR = '|------------------------------------------------|' ; // lou add if (cbs.goals) { cbs.goals.split(/\s*,\s*/).forEach(function (item) { var goal = item.split(/\s*:\s*/); var num = Number(goal[0]); // token goal var tim = goal[1]; // time of goal var val = goal[2] ? goal[2].trim() : ''; // name of goal if (val && num && tim) goals.push({num: num, val: val, tim: tim}); }); goals.sort((a,b) => a.num - b.num); } cb.onTip((tip) => doTip(tip)); //cb.onMessage((msg) => doMessage(msg)); cb.onDrawPanel(function () { /** return { // ori 'template': '3_rows_12_21_31', 'row1_label': '[TIP GOAL X] -->', 'row1_value': tipCount + ' tks received', 'row2_value': goalText(), 'row3_value': 'Last tip : ' + mvp.user + ' (' + mvp.amount + ')' }; **/ return { // in test 'template': '3_rows_11_21_31', 'row1_value': row1(), 'row2_value': goalText(), 'row3_value': row3() }; }); function doTip(tip) { var modelTimerGoal = (timerGoalEpoch > 0) ; //if ( !ignore.includes(tip.amount) ) { if (!ignore.includes(tip.amount) || acceptArray.includes(tip.amount)) { tipAmount = tip.amount; tipCount += tip.amount; tipCount2 += tip.amount; addTip(tip.amount, tip.from_user); if (goalBotVersion == 1) updateSubject(calcGoal1()); if (goalBotVersion == 2) updateSubject(calcGoal2()); cb.drawPanel(); //var modelTimerGoal = (timerGoalEpoch > 0) ; }// je prefere l'accolade ici switch(tip.amount) { case 2: //msgModel = '-----> tipcount2 : '+tipCount2+'\n' ; var showName = goalReachedArray[0] ; var ty = 'Thank you !' ; hrs = 'hrs' ; mins = 'mins' ; secs = 'secs' ; resultaText = ''; unit = 'st'; if (timerGoalInProgress) { if (resulta != 5) { //if (isPatroler) { if (!modelTimerGoal) { /*if (tipNote == 'timer') {*/ timerGoalEpoch = (new Date).getTime() + (60 * 1000) + 7000 ; cb.sendNotice(tip.from_user+' tipped to # start '+showName+' '+goalReachedDurationArray[0]+' minute # '+timerGoalEpoch+' Thank you', '', '#173093' , '#FFFFFF', 'bolder', ''); //cb.setTimeout(timer, 30 * 1000); /*} else { cb.sendNotice(mvp.user + ' tipped to # YEAHHHHHHHHHHHHHHHH #. Thank you', '', '#173093' , '#FFFFFF', 'bolder', ''); }*/ } else { timerGoalEpoch += (60 * 1000); var tmpTimerGoalTime = timerGoalTimeRemaining(timerGoalEpoch); resulta += 1 ; if (resulta == 4 || 5 ) unit = 'th' ; if (resulta == 2) unit = 'nd'; if (resulta == 3) unit = 'rd'; if (resulta == 5) resultaText = 'LAST TIME !' ; if (tmpTimerGoalTime.getUTCHours() < 2) hrs = 'hr'; if (tmpTimerGoalTime.getUTCMinutes() < 2) mins = 'min'; if (tmpTimerGoalTime.getUTCSeconds() < 2) secs = 'sec'; //cb.sendNotice(tip.from_user+ ' tipped to Increase GOAL ## ' +showName+ ' ## '+resulta+'/5. Thank you', '', '#173093', '#FFFFFF', 'bolder', ''); cb.sendNotice(tip.from_user+ ' tipped to Increase GOAL ## ' +showName+ ' ## '+resulta+''+unit+' /5. Thank you', '', '#173093', '#FFFFFF', 'bolder', ''); if ( tmpTimerGoalTime.getUTCHours() > 0 ) { // i do not need this one here cb.sendNotice('GOAL REMAINING TIME is now ## '+tmpTimerGoalTime.getUTCHours()+' '+hrs+' '+tmpTimerGoalTime.getUTCMinutes()+' '+mins+' '+tmpTimerGoalTime.getUTCSeconds()+' '+secs+'. ##' , '', '#173093', '#FFFFFF', 'bolder', ''); } else if ( tmpTimerGoalTime.getUTCHours() == 0 && tmpTimerGoalTime.getUTCMinutes() > 0) { cb.sendNotice('GOAL REMAINING TIME is now ## '+tmpTimerGoalTime.getUTCMinutes()+' '+mins+' '+tmpTimerGoalTime.getUTCSeconds()+' '+secs+'. ## \n' + resulta +unit+' /5 AND '+resultaText, '', '#173093', '#FFFFFF', 'bolder', ''); } else { cb.sendNotice('GOAL REMAINING TIME is now ## '+tmpTimerGoalTime.getUTCSeconds()+' '+secs+'. ##' , '', '#173093', '#FFFFFF', 'bolder', ''); } } //} // end is patroler } else { // NEW !! acceptArray.splice(0, 1, tip.amount) ; // NEW !! cb.sendNotice('NEWW acceptArray is now '+acceptArray+'.') ; } } else { cb.sendNotice('acceptArray before is '+acceptArray+'.', ''); acceptArray.splice(0, 1, tip.amount) ; cb.sendNotice('acceptArray now contain '+acceptArray+'.', ''); } break ; default: //msgModel = '*******> tipcount2 : '+tipCount2+'\n' ; break; } //} // if (msgModel.length > 0) { cb.sendNotice(msgModel, cb.room_slug, '#00000', '', 'bold'); msgModel = ""; } } function timer() { cb.chatNotice( '# TEST # is over.'); //flashTongueEpoch = 0 ; //flashTongueInProgress = false ; // on vérifie la "flash tongue pending list" //if (flashTonguePendingEpoch > 0) { //cb.chatNotice(showName+' Flash tongue pending list : '+flashTonguePendingEpoch+' secs.'); //} } function addTip(amount, user) { tipLedger[user] = tipLedger[user] || 0; tipLedger[user] += amount; if (mvp.user === user) { mvp.amount += amount; } else if (tipLedger[user] > mvp.amount && user !== 'The Force') { mvp = {user: user, amount: tipLedger[user]}; } } function doMessage(msg) { if (doCommand(msg)) return msg; } function remaining () { if (goalBotVersion == 1) { if (goals[0]) return goals[0].num - tipCount; // ori return ''; } else if (goalBotVersion == 2){ if (goals[0]) return goals[0].num - tipCount2; return ''; } } /** function doCommand (msg) { msg.m = msg.m.trim(); if (msg.m.charAt(0) != '/') return false; //if (msg.m.substring(0, 1) != "/") return false; msg['X-Spam'] = true; //if (!admins.includes(msg.user) && msg.user !== cb.room_slug) return false; var data = msg.m.slice(1).split(/\s+/); var cmd = data[0].toLowerCase(); var params = data.slice(1); switch(cmd) { // LOU ADD // case 'startgoal': timerGoalEpoch = (new Date).getTime() + (1 * 60000) + 5000 ; msgModel = ' GOAL '+goalReachedArray+' has started for 1 min. \n '; break; // FIN LOU ADD // case 'count': var n = Number(params[0]); if (!n) break; tipCount = n; break; case 'addgoal': if (params.length < 2) break; var num = Number(params[0]); var val = params.slice(1).join(' ').trim(); if (num && val.length) { var ind = goals.findIndex((elm) => elm.num === num); if (ind > -1) { goals[ind].val = val; } else if (num > tipCount) { goals.push({num: num, val: val}); goals.sort((a,b) => a.num - b.num); } say('Goals modified.', msg.user); updateSubject(); } break; case 'remgoal': var num = Number(params[0]); if (!num) break; var ind = goals.findIndex((elm) => elm.num === num); if (ind > -1) { goals.splice(ind, 1); say('Goals modified.', msg.user); updateSubject(); } break; case 'subj': if (!params.length) break; updateSubject(true, params.join(' ')); break; case 'force': var n = Number(params[0]); if (!n) break; doTip({from_user: 'The Force', amount: n}); break; case '#': evaluate(params.join(' '), msg.user); break; case 'h': case 'help': var sep = '\n\u2007\u2007'; say(['\u25CF ----- [COMMANDS] ----- \u25CF', '/h or /help ' + sep + ' Show the help menu.', '/addGoal [X (number)] [G (text)] ' + sep + ' Adds goal G at X tokens received.', '/remGoal [X (number)] ' + sep + ' Removes goal at X tokens, if it exists.', '/subj [H (text)] ' + sep + ' Changes the room hashtags to H.', '/count [X (number)] ' + sep + ' Sets the number of tokens received to X.', '/# [JavaScript] ' + sep + ' Execute JavaScript. Only use in emergencies.', ].join('\n'), user); break; default: msg['X-Spam'] = true; msgModel = 'You must provide a command. Type botTrigger help\n ...to get a list of options.'; break; } cb.drawPanel(); // LOU ADD // if (msgModel.length > 0) { cb.sendNotice(msgModel, cb.room_slug, '', '', 'bold'); msgModel = ""; } // FIN LOU ADD // } **/ /** LOU ADD **/ cb.onMessage(function(message) { var msg = message['m']; switch (msg) { case "!h": case "/h": message['X-Spam'] = true; //divStr = makeDiv('_',50,50); //msgModel = tipMenu + '\n' + divStr; msgPublic = 'ceci est un test.'; break; case '/goala': message['X-Spam'] = true; msgModel = 'goal in my Reachedarray : '+goalReachedArray.length+' = > '+goalReachedArray+'\n' ; msgModel += 'goal in my ReachedDurationarray : '+goalReachedDurationArray.length+' => '+goalReachedDurationArray+'\n'; msgModel += 'push in ReachedPriceArray : '+goalReachedPriceArray.length+' => '+goalReachedPriceArray+'\n' ; msgModel += 'goals : '+goals.length+' => '+goals ; break; case '/startgoal': case '/sg': message['X-Spam'] = true; if (goalReachedArray[0] != null && goalReachedDurationArray[0] > 0) { timerGoalEpoch = (new Date).getTime() + (goalReachedDurationArray[0] * 60000) + 5000 ; acceptArray.splice(0, 1, 0) ; timerGoalInProgress = true ; cb.chatNotice(cb.room_slug+' has start TIMER GOAL : '+goalReachedArray[0]+' '+goalReachedDurationArray[0]+' minute.\nTip 50 to increase 1 minute.', '', '#0355c6', '#FFFFFF', 'bold' ) ; //msgPublic = cb.room_slug+' has start TIMER GOAL : '+goalReachedArray[0]+' '+goalReachedDurationArray[0]+' minute. '+timerGoalEpoch+'.' ; //msgPublic += '\nTip 50 to increase 1 minute.' ; } else if (goalReachedArray[0] != null) { //acceptArray.splice(0, 1, 0) ; //goalInProgress = true ; cb.chatNotice(cb.room_slug+' has start GOAL : '+goalReachedArray[0]+' '+goalReachedDurationArray[0]+'. '+timerGoalEpoch+'.', '', '#0355c6', '#FFFFFF', 'bold' ) ; //msgPublicGoal = cb.room_slug+' has start GOAL "'+goalReachedArray+'". '+timerGoalEpoch+'. Tip 50 to increase 1 minute.' ; //msgPublic = cb.room_slug+' has start GOAL : '+goalReachedArray[0]+' '+goalReachedDurationArray[0]+'. '+timerGoalEpoch+'.' ; //msgPublic += '\nTip 50 to increase 1 minute.' ; goalReachedArray.shift() ; goalReachedDurationArray.shift() ; } else { msgModel = 'goal in my Reachedarray : '+goalReachedArray.length+' = > '+goalReachedArray+'\n' ; msgModel += 'goal in my ReachedDurationarray : '+goalReachedDurationArray.length+' => '+goalReachedDurationArray+'.' ; } break; default: msg['X-Spam'] = true; msgModel = 'You must provide a command. Type botTrigger help\n ...to get a list of options.'; break; } if (msgModel.length > 0) { cb.sendNotice(msgModel, cb.room_slug, '#c6b202', '', 'bold'); msgModel = ""; } }); // fin "doCommand(msg)" function releaseTimeouts() { // set current epoch time currentEpoch = (new Date).getTime(); if (timerGoalEpoch > 0) { if (timerGoalEpoch < currentEpoch) { timerGoalEpoch = 0; // remet epoch à zero resulta = 0; // remet resulta à 0 goalReachedArray.shift(); // delete element[0] from Array goalReachedDurationArray.shift(); // delete element[0] from Array acceptArray.splice(0, 1, 2) ; timerGoalInProgress = false ; cb.sendNotice('[Timer Goal has expired]', '', '#921616', '#FFFFFF' ,'bolder'); } else { var tmpTimerGoalTime = timerGoalTimeRemaining(timerGoalEpoch); if ( tmpTimerGoalTime.getUTCMinutes() > 0 && ( tmpTimerGoalTime.getUTCSeconds() == 0 ) ) { // show more than 1 min cb.sendNotice('[Goal in progress : '+goalReachedArray[0]+' ] Remaining Time : ' +tmpTimerGoalTime.getUTCMinutes()+ ' mn ' +tmpTimerGoalTime.getUTCSeconds()+ ' sec.', '', '', '#0355c6', 'bolder', ''); //if (timer180FootRequested.length == 1) { // cb.sendNotice('[Timer Foot MENU] avalable while : ' +tmpTimerGoalTime.getUTCMinutes()+ ' mn ' +tmpTimerGoalTime.getUTCSeconds()+ ' sec. tip below :', '', '', '#0355c6', 'bolder', ''); //} } else if ( tmpTimerGoalTime.getUTCMinutes() == 0 && ( tmpTimerGoalTime.getUTCSeconds() == 25 || tmpTimerGoalTime.getUTCSeconds() == 10) ) { // show less than 1 min : cb.sendNotice('[Goal in progress : '+goalReachedArray[0]+' ] Remaining Time : ' +tmpTimerGoalTime.getUTCSeconds()+ ' sec.', '', '', '#0355c6' , 'bolder', ''); } //if ( tmpTimerGoalTime.getUTCSeconds() == 59 || tmpTimerGoalTime.getUTCSeconds() == 15 || tmpTimerGoalTime.getUTCSeconds() == 30 || tmpTimerGoalTime.getUTCSeconds() == 45 ) { // msgPublic += "TimerGoal WARNING !! : "; //} } } // setup next check call cb.setTimeout(releaseTimeouts, 1 * 1000); // 1000 pour rafraichir chaque seconde } function getSum(total, num) { return total +num ; } function timerGoalTimeRemaining(timerGoalEpoch) { var timeObj = new Date(0); currentEpoch = (new Date).getTime(); //or currentTime timeObj.setUTCMilliseconds(timerGoalEpoch - currentEpoch); return timeObj; } /** FIN LOU ADD **/ function evaluate(str, user) { try { var result = eval(str); var notice = 'TYPE: ' + typeof result + '\nVALUE: '; result === void 0 ? notice += 'undefined' : notice += JSON.stringify(result, null, '\u2007\u2007\u2007\u2007'); cb.setTimeout(() => {cb.sendNotice(newLines(notice), user, '', '#00CC00', '', '')}, 100); } catch (e) { cb.setTimeout(() => {cb.sendNotice(newLines(e.name + ': ' + e.message), user, '', '#FF0000', '', '')}, 100); } cb.drawPanel(); } function calcGoal1 () { // n'est pas operationel !!!!! if (!goals[0]) return false; //limit = goals[0].num + goalReachedPriceArray.reduce(getSum) ; while (goals[0] && tipCount >= goals[0].num) { // ORI //while ( goals[0] && tipCount >= (goals[0].num && limit) ) { // ne fonctionne pas //while (goals[0] && tipCount >= goals[0].num && tipCount >= limit) { // ne fonctionne pas //while (goals[0] && tipCount >= goals[0].num && tipCount >= goalReachedPriceArray.reduce(getSum)) { limit = goalReachedPriceArray.reduce(getSum,0) ; if (goals[0].tim != null && goals[0].tim > 0 && tipCount >= limit) { goalReachedArray.push(goals[0].val) ; // lou add // voir si c'est a la bonne place goalReachedPriceArray.push(goals[0].num) ; // lou add // voir si c'est a la bonne place goalReachedDurationArray.push(goals[0].tim) ; // lou add // voir si c'est a la bonne place tipCount2 = tipCount2 - goals[0].num ; // NEW cb.chatNotice ('| '+bigUnderL+' GOAL REACHED ('+tipCount2+')-('+limit+')- '+bigUnderR+'\n | \u{2B50} '+goals[0].val+' \u{2B50} '+goals[0].tim+' minute.\n| '+bigUnderGR , '', '#cdd5f7', '#173093', 'bold'); //msgModel = '| '+smallUnderL+' Lancer le GOAL TIMER !'; cb.chatNotice ('| '+smallUnderL+' Lancer le GOAL TIMER '+smallUnderR ,cb.room_slug, '#7984b5', '', 'bold' ); goals.shift(); } else if (goals[0].tim != null && tipCount >= limit) { // (goals[0].tim == 0 || goals[0].tim == 'unknow') goalReachedArray.push(goals[0].val) ; // lou add // voir si c'est a la bonne place goalReachedPriceArray.push(goals[0].num) ; // lou add // voir si c'est a la bonne place goalReachedDurationArray.push(goals[0].tim) ; // lou add // voir si c'est a la bonne place tipCount2 = tipCount2 - goals[0].num ; // NEW cb.chatNotice ('| '+bigUnderL+' GOAL REACHED ('+tipCount2+')-('+limit+')- '+bigUnderR+'\n | \u{2B50} '+goals[0].val+' \u{2B50} \n| '+bigUnderGR , '', '#cdd5f7', '#173093', 'bold'); //msgModel = '| '+smallUnderL+' Lancer UNIQUEMENT le GOAL !'; cb.chatNotice ('| '+smallUnderL+' Lancer UNIQUEMENT le GOAL '+smallUnderR ,cb.room_slug, '#7984b5', '', 'bold' ); goals.shift(); } //if (!goals[0]) { else if (!goals[0] && tipCount <= limit) { //return false; cb.chatNotice ('| '+bigUnderL+' NOOOOOOO !!!('+tipCount2+')-('+limit+')- '+bigUnderR+'\n | \u{2B50} ALL GOALS REACHED !.\n| '+bigUnderGR , '', '#cdd5f7', '#173093', 'bold'); } //if (goalBotVersion != 1) { tipCount2 = 0; } /** goalReachedArray.push(goals[0].val) ; // lou add // voir si c'est a la bonne place goalReachedPriceArray.push(goals[0].num) ; // lou add // voir si c'est a la bonne place goalReachedDurationArray.push(goals[0].tim) ; // lou add // voir si c'est a la bonne place goals.shift(); **/ } return true; } function calcGoal2 () { if (!goals[0]) return false; //limit = goals[0].num + goalReachedPriceArray.reduce(getSum) ; while (goals[0] && tipCount2 >= goals[0].num) { // ORI limit = goalReachedPriceArray.reduce(getSum,0) ; if (goals[0].tim != null && goals[0].tim > 0 && tipCount2 >= limit) { goalReachedArray.push(goals[0].val) ; // lou add goalReachedPriceArray.push(goals[0].num) ; // lou add goalReachedDurationArray.push(goals[0].tim) ; // lou add tipCount2 = tipCount2 - goals[0].num ; // NEW // voir si c'est a la bonne place cb.chatNotice ('| '+bigUnderL+' GOAL REACHED ('+tipCount2+')-('+limit+')- '+bigUnderR+'\n | \u{2B50} '+goals[0].val+' \u{2B50} '+goals[0].tim+' minute.\n| '+bigUnderGR , '', '#cdd5f7', '#173093', 'bold'); cb.chatNotice ('| '+smallUnderL+' Lancer le GOAL TIMER '+smallUnderR ,cb.room_slug, '#7984b5', '', 'bold' ); //msgPublic = '| '+bigUnderL+' GOAL REACHED ('+tipCount2+')-('+limit+')- '+bigUnderR+'\n | \u{2B50} '+goals[0].val+' \u{2B50} '+goals[0].tim+' minute.\n| '+bigUnderGR ; //msgModel = '| '+smallUnderL+' Lancer le GOAL TIMER '+smallUnderR; goals.shift(); } else if (goals[0].tim != null && tipCount2 >= limit) { // (goals[0].tim == 0 || goals[0].tim == 'unknow') goalReachedArray.push(goals[0].val) ; // lou add // goalReachedPriceArray.push(goals[0].num) ; // lou add goalReachedDurationArray.push(goals[0].tim) ; // lou add tipCount2 = tipCount2 - goals[0].num ; // NEW // voir si c'est a la bonne place cb.chatNotice ('| '+bigUnderL+' GOAL REACHED ('+tipCount2+')-('+limit+')- '+bigUnderR+'\n | \u{2B50} '+goals[0].val+' \u{2B50} \n| '+bigUnderGR , '', '#cdd5f7', '#173093', 'bold'); cb.chatNotice ('| '+smallUnderL+' Lancer UNIQUEMENT le GOAL '+smallUnderR ,cb.room_slug, '#7984b5', '', 'bold' ); //msgPublic = '| '+bigUnderL+' GOAL REACHED ('+tipCount2+')-('+limit+')- '+bigUnderR+'\n | \u{2B50} '+goals[0].val+' \u{2B50} \n| '+bigUnderGR ; //msgModel = '| '+smallUnderL+' Lancer UNIQUEMENT le GOAL '+smallUnderR; goals.shift(); } //if (!goals[0]) { else if (!goals[0] && tipCount2 <= limit) { //return false; cb.chatNotice ('| '+bigUnderL+' NOOOOOOO !!!('+tipCount2+')-('+limit+')- '+bigUnderR+'\n | \u{2B50} ALL GOALS REACHED !.\n| '+bigUnderGR , '', '#cdd5f7', '#173093', 'bold'); } //if (goalBotVersion != 1) { tipCount2 = 0; } /** goalReachedArray.push(goals[0].val) ; // lou add // voir si c'est a la bonne place goalReachedPriceArray.push(goals[0].num) ; // lou add // voir si c'est a la bonne place goalReachedDurationArray.push(goals[0].tim) ; // lou add // voir si c'est a la bonne place goals.shift(); **/ /** if (msgPublic.length > 0) { cb.sendNotice(msgPublic, '', '#cdd5f7', '#173093', 'bold'); //msgPublic = ""; } if (msgModel.length > 0) { cb.sendNotice(msgModel, cb.room_slug, '#7984b5', '', 'bold'); //msgModel = ""; } **/ } return true; } function goalText () { if (goals[0]) return goals[0].val + ' in ' + remaining() + ' tks'; return 'All goals reached!' /** text = goals[0].val ; //if (goals[0]) return text.substring(0, 100) + '...'; // v.1 if (goals[0]) return text.substring(0, 100); // v.1.1 return 'All goals reached!' **/ } function updateSubject(force, text) { cbs.subj = text || cbs.subj || ''; if (goals[0] || force) cb.changeRoomSubject('[' + goalText() + '] ' + cbs.subj); } function row1() { if (goalBotVersion == 1) { expectingTip = goals[1].num - goals[0].num ; if (tipCount > 0) tipIn = tipCount - expectingTip; tipIn = tipCount ; if (goals[0]) return '[ TKS \u2007\u25CFGoal : '+tipCount+' / '+goals[0].num+' \u2007\u25CFRemaining : '+remaining()+' ]'; //if (goals[0]) return '[ TKS \u2007\u25CFGoal : '+tipIn+' / '+expectingTip+' \u2007\u25CFRemaining : '+remaining()+' ]'; return '\u2665 THANK YOU ALL \u2665' } else if (goalBotVersion == 2) { // don't change it ! if (goals[0]) return '[ TKS \u2007\u25CFGoal : '+tipCount2+' / '+goals[0].num+' \u2007\u25CFRemaining : '+remaining()+' ]'; return '\u2665 THANK YOU ALL \u2665' } } function row3() { if (goals[0]) return '[TIP] \u2007\u25CFMvp : '+mvp.user+' ['+mvp.amount+'] \u2007\u25CFTotal : ['+tipCount+']'; return '\u2007\u25CFTotal : '+tipCount+'\u2007\u25CF' } function showGoals (user) { if (goals.length) { /*if (goal.tim > 0) return ' @ '+goal.num+' tks\u2007\u25CF '+goal.val+' tks\u2007\u25CF '+goal.tim+' minute.'; return ' @ '+goal.num+' tks\u2007\u25CF '+goal.val+'.'*/ //if (goal.tim == 0) return goal.tim = 'undi' ; var output = [bigUnderL+' GOAL MENU '+bigUnderR]; //goals.forEach((goal) => output.push(' @ '+goal.num+' tks\u2007\u25CF '+goal.val+' .')); // ORI goals.forEach((goal) => output.push(' @ '+goal.num+' tks\u2007\u25CF '+goal.val+'\u2007\u25CF '+goal.tim+' minute.')); //goals.forEach((goal) => output.push(' @ '+goal.num+' tks\u2007\u25CF '+goal.val)); output.push( bigUnderGM ); say(output.join('\n'), user); } } function rotateGoals() { showGoals(); if (cbs.interval) cb.setTimeout(rotateGoals, cbs.interval * 1000); } /////////// updateSubject(); rotateGoals(); /** LOU ADD **/ // start timeout release event cb.setTimeout(releaseTimeouts, 60 * 1000); // chaque minute /** FIN LOU ADD **/
© Copyright Chaturbate 2011- 2025. All Rights Reserved.