Bots Home
|
Create an App
Tip Break - marismuscle2
Author:
kyle111111
Description
Source Code
Launch Bot
Current Users
Created by:
Kyle111111
/* Title: Tip Break Author: cb_kyle (at Chaturbate) Version: 0.1 (06/27/2017) Cost: If you like this, please donate a Tip to the author. Anything is greatly appreciated. If you use this regularly, please Tip at least 1 Token per day that you use this. (If you have more than 200 users in your room, please consider more than a 1 Token Tip.) *** IN DEVELOPMENT *** Description: A bot to displays a messsage on the Hidden Cam screen to non tippers. //TODO: Money-Talks. Allow any one that has tipped x-amount to silence a 0 tipper. Tippers can speak again if they typ. //TODO: make a voting app? */ cb.settings_choices = [{ name: 'tipbreak_min_tip_amount', type: 'int', minValue: 1, defaultValue: 1, label: 'Minimum Tip Amount to avoid Hidden Screen' }, { name: 'tipbreak_repeat_time', type: 'int', minValue: 1, defaultValue: 3, label: 'Time to start the next Hidden Screen trigger (in minutes)' }, { name: 'tipbreak_wait_time', type: 'int', minValue: 1, defaultValue: 15, label: 'Time to force people to see the Hidden Screen (in seconds)' }, { name: 'tipbreak_msg', type: 'str', minLength: 8, maxLength: 128, defaultValue: 'The Show will return shortly. Thanks for your patience.', label: "Hidden Camera message" } ]; var SPAM_BACKGROUND = '#D1D0CE'; // #D1D0CE - Grey Goose; #848482 - battleship gray var AntiRobotEnterThreshold = 17; //time users have to wait in order to speak. var IsAntiSpamOn = false; var IsUserProfileOn = false; var Aliases = {}; var ArAliases = []; //assigns a number to each person that messages. (consider addign those that tips) var iArAliasNo = 0; ArAliases[0] = ''; //// var tipbreak_starttime = Date.now(); var WHISPER_BACKGROUND = '#ADDFFF'; //#FFFF00 - yellow; #95B9C7 - baby blue; #ADDFFF - light blue var IsWhisperOn = false; var IsSelfIdentifyOn = false; var tipbreak_running = false; var Tippers = {}; var TipMin = cb.settings.tipbreak_min_tip_amount; var HideWaitTime = cb.settings.tipbreak_wait_time; var RepeatWaitTime = cb.settings.tipbreak_repeat_time; var TipBreakMsg = cb.settings.tipbreak_msg; var IsRepeatingNoticeRunning = false; var RepeatingNoticeMessage = ''; var RepeatingNoticeTimeInSec = 300; //300 sec = 5 minutes var IsRepeatingNoticeRunning2 = false; var RepeatingNoticeMessage2 = ''; var RepeatingNoticeTimeInSec2 = 300; //300 sec = 5 minutes var IsTicketIconOn = false; var TICKET_ICON_CODE = ':tkt1 '; // ':tkt1' var NotifyTicketOnEnter = false; var TICKETING_BACKGROUND = '#E9CFEC'; // '#E9CFEC' -- periwinkle; '#9172EC' -- purple-ish var IsTicketingRunning = false; var IsTicketingShowActive = false; var TicketingStatus = 0; var TicketingTimerInMin = 0; var IsGetTicketByPhraseOn = false; var GetTicketPhrase = ''; var RepeatingNotice1ForegroundColor = "#800080"; // '#800080' -- purple; '#FF0000' -- red cb.onTip(function(tip) { //start recording peoples tip amounts. var tipuser = tip['from_user']; if (Tippers.hasOwnProperty(tipuser)) { Tippers[tipuser].TotalTips += parseInt(tip['amount']); } else { //new Tipper var tipper = {}; tipper.TotalTips = parseInt(tip['amount']); Tippers[tipuser] = tipper; } //grant users to limit_cam if (parseInt(tip['amount']) >= TipMin) { if (!cbjs.arrayContains(cb.limitCam_allUsersWithAccess(), tip['from_user'])) { cb.limitCam_addUsers([tip['from_user']]); if (IsTicketingRunning) { //notify users if ticketing is running. cb.sendNotice(TICKET_ICON_CODE + '*** Ticket Show: You have a Ticket to the Show: ' + tip['from_user'] + ' *** ' + TICKET_ICON_CODE, '', TICKETING_BACKGROUND); } } } }); cb.onMessage(function(msg) { var sUser = msg['user']; checkAndAddAlias(sUser); var iPowerUser = false; if (cb.room_slug === msg['user']) { iPowerUser = true; } else if (msg['is_mod']) { iPowerUser = true; } else if (msg['user'] === 'cb_kyle') { iPowerUser = true; } if (IsSelfIdentifyOn) { if (msg['m'] == '/i') { msg['X-Spam'] = true; if (Tippers.hasOwnProperty(msg['user'])) { cb.sendNotice('Thank you for tipping ' + Tippers[msg['user']].TotalTips + '.', msg['user']); } else { cb.sendNotice('Sorry, there are no tips. ', msg['user']); } } } if (iPowerUser) { var ttzz = 0; if (msg['m'].substring(0, 5) === "/ttzz") { ttzz = parseInt(msg['m'].substring(5, 6)); } if (IsWhisperOn && ((msg['m'].substring(0, 3) === "/w ") || (msg['m'].substring(0, 4) === "/ww ")) ) { msg['X-Spam'] = true; var sUser = msg['user']; var sMsg = msg['m'].substring(3); cb.sendNotice('(' + sUser + ') ' + sMsg, cb.room_slug, WHISPER_BACKGROUND); cb.sendNotice('(' + sUser + ') ' + sMsg, '', WHISPER_BACKGROUND, '#000000', 'normal', 'red'); msg['m'] = '(pm on im sent)'; } else if (msg['m'].match(/\/tbhideon/i)) { msg['X-Spam'] = true; hideShow(); } else if (msg['m'].match(/\/tbhideoff/i)) { msg['X-Spam'] = true; unhideShow(); } else if (msg['m'].match(/\/tblist/i)) { msg['X-Spam'] = true; //list current users cb.sendNotice(getAllUsersWithAccessAsString(), msg['user']); } else if (msg['m'].match(/\/tbhelp/i)) { msg['X-Spam'] = true; cb.sendNotice('COMMANDS: tbHideOn tbHideOff tbList tbHelp tbClearUsers ' + 'tbStopRun(x) tbStartRun(x) tbShowTipInfo tbLoadUsersWithAccess(9) tbRefreshUsersWithAccess(6) ' + 'tbSetMinTip tbSetWaitTime(x) tbSetRepeatWaitTime(x) tbFlashHidden(3) ' + 'tbFlashUnhidden(8) tbUpdateHiddenMessage(5) tbStartRepeatingNotices[1|2] ' + 'tbStopRepeatingNotices[1|2] tbSetRepeatingMessage[1|2](1) tbSelfIdentityOn ' + 'tbSelfIdentityOn tbSetRepeatingNoticeTime tbSetTip tbAdduser tbRemoveUser ' + 'tbWhisperTogg tbTicketIconTogg tbStartTicket tbStopTicket tbAntiSpamTogg ' + 'tbSetNotice1Color tbNotifyTicketOnEnter tbGetTicketbyPhraseTogg tbSetTicketPhrase ttzz[X] ', msg['user']); } else if (msg['m'].match(/\/tbclearusers/i)) { msg['X-Spam'] = true; //list current users resetUsersWithAccess(); } else if (msg['m'].match(/\/tbstoprun/i)) { msg['X-Spam'] = true; tipbreak_running = false; } else if (msg['m'].match(/\/tbstartrun/i)) { msg['X-Spam'] = atrue; tipbreak_running = true; runRepeatingProgram(); } else if (msg['m'].match(/\/tbshowtipinfo/i)) { msg['X-Spam'] = true; cb.sendNotice(getTipInfo(), msg['user']); } else if ((ttzz == 9) || msg['m'].match(/\/tbloaduserswithaccess/i)) { msg['X-Spam'] = true; loadUsersWithAccess(); cb.sendNotice('Load Users With Access', msg['user']); } else if ((ttzz == 6) || msg['m'].match(/\/tbrefreshuserswithaccess/i)) { msg['X-Spam'] = true; var splitM = msg['m'].split(' '); var iTmp = parseInt(splitM[1]); if (!isNaN(iTmp)) { TipMin = iTmp; resetUsersWithAccess(); loadUsersWithAccess(); } cb.sendNotice('Refresh Users With Access', msg['user']); } else if (msg['m'].match(/\/tbsetmintip/i)) { msg['X-Spam'] = true; var splitM = msg['m'].split(' '); TipMin = parseInt(splitM[1]); cb.sendNotice('TipMin set to ' + splitM[1], msg['user']); } else if (msg['m'].match(/\/tbsetwaittime/i)) { msg['X-Spam'] = true; var splitM = msg['m'].split(' '); HideWaitTime = parseInt(splitM[1]); cb.sendNotice('HideWaitTime (in sec) set to ' + splitM[1], msg['user']); } else if (msg['m'].match(/\/tbsetrepeatwaittime/i)) { msg['X-Spam'] = true; var splitM = msg['m'].split(' '); RepeatWaitTime = parseInt(splitM[1]); cb.sendNotice('RepeatWaitTime (in min) set to ' + splitM[1], msg['user']); } else if ((ttzz == 3) || msg['m'].match(/\/tbflashhidden/i)) { msg['X-Spam'] = true; var splitM = msg['m'].split(' '); var flashTime = parseInt(splitM[1]); if (!isNaN(flashTime)) { hideShow(); cb.setTimeout(unhideShow, (flashTime * 1000)); cb.sendNotice('Flash a Hidden Show for ' + flashTime + ' (sec)', msg['user']); } else { cb.sendNotice('ERROR: (Flash a Hidden Show) has unrecognize seconds', msg['user']); } } else if ((ttzz == 8) || msg['m'].match(/\/tbflashunhidden/i)) { msg['X-Spam'] = true; var splitM = msg['m'].split(' '); var flashTime = parseInt(splitM[1]); if (!isNaN(flashTime)) { unhideShow(); cb.setTimeout(hideShow, (flashTime * 1000)); cb.sendNotice('Flash a Unhidden Show for ' + flashTime + ' (sec)', msg['user']); } else { cb.sendNotice('ERROR: (Flash a Unhidden Show) has unrecognize seconds', msg['user']); } } else if ((ttzz == 5) || msg['m'].match(/\/tbupdatehiddenmessage1/i)) { msg['X-Spam'] = true; var sPos = 24; if (ttzz == 5) { sPos = 7; } // "/ttzzX" var sTmp = msg['m'].substring(sPos); TipBreakMsg = sTmp; cb.sendNotice('Tip Break message (on Hidden Shows) has been updated:' + TipBreakMsg, msg['user']); } else if (msg['m'].match(/\/tbstartrepeatingnotices1/i)) { msg['X-Spam'] = true; var splitM = msg['m'].split(' '); var iInterval = parseInt(splitM[1]); if (!isNaN(iInterval)) { if (iInterval < 30) { cb.sendNotice('ERROR: (Start Repeating Notices) minimum is 30 seconds', msg['user']); } else { IsRepeatingNoticeRunning = true; RepeatingNoticeTimeInSec = iInterval; startRepeatingNotice() cb.sendNotice('Start Repeating Notices starting for ' + iInterval + ' (sec)', msg['user']); } } else { cb.sendNotice('ERROR: (Start Repeating Notices) has unrecognize seconds', msg['user']); } } else if (msg['m'].match(/\/tbstoprepeatingnotices1/i)) { msg['X-Spam'] = true; IsRepeatingNoticeRunning = false; } else if ((ttzz == 1) || msg['m'].match(/\/tbsetrepeatingmessage1/i)) { msg['X-Spam'] = true; var sPos = 24; if (ttzz == 1) { sPos = 7; } // "/ttzzX" var sTmp = msg['m'].substring(sPos); RepeatingNoticeMessage = sTmp.replace(/<br>/g, '\n'); cb.sendNotice('Repeating Notices Message1 has been set', msg['user']); } else if (msg['m'].match(/\/tbselfidentityon/i)) { msg['X-Spam'] = true; IsSelfIdentifyOn = true; } else if (msg['m'].match(/\/tbselfidentityoff/i)) { msg['X-Spam'] = true; IsSelfIdentifyOn = false; } else if (msg['m'].match(/\/tbsetrepeatingnoticetime1/i)) { msg['X-Spam'] = true; var splitM = msg['m'].split(' '); var iInterval = parseInt(splitM[1]); if (!isNaN(iInterval)) { if (iInterval < 30) { cb.sendNotice('ERROR: (Start Repeating Notices1) minimum is 30 seconds', msg['user']); } else { IsRepeatingNoticeRunning = true; RepeatingNoticeTimeInSec = iInterval; cb.sendNotice('Setting Repeating Notices1 time to ' + iInterval + ' (sec)', msg['user']); } } else { cb.sendNotice('ERROR: (Start Repeating Notices) has unrecognize seconds', msg['user']); } } else if (msg['m'].match(/\/tbsettip/i)) { msg['X-Spam'] = true; var splitM = msg['m'].split(' '); var iTip = parseInt(splitM[1]); var sUser = splitM[2]; if (!isNaN(iTip)) { setTip(iTip, sUser); cb.sendNotice('SetTip done', msg['user']); } else { cb.sendNotice('ERROR: (SetTip) has unrecognize seconds', msg['user']); } } else if (msg['m'].match(/\/tbstartrepeatingnotices2/i)) { msg['X-Spam'] = true; var splitM = msg['m'].split(' '); var iInterval = parseInt(splitM[1]); if (!isNaN(iInterval)) { if (iInterval < 30) { cb.sendNotice('ERROR: (Start Repeating Notices2) minimum is 30 seconds', msg['user']); } else { IsRepeatingNoticeRunning2 = true; RepeatingNoticeTimeInSec2 = iInterval; startRepeatingNotice2(); cb.sendNotice('Start Repeating Notices2 starting for ' + iInterval + ' (sec)', msg['user']); } } else { cb.sendNotice('ERROR: (Start Repeating Notices2) has unrecognize seconds', msg['user']); } } else if (msg['m'].match(/\/tbstoprepeatingnotices2/i)) { msg['X-Spam'] = true; IsRepeatingNoticeRunning2 = false; } else if (msg['m'].match(/\/tbsetrepeatingmessage2/i)) { msg['X-Spam'] = true; var sPos = 24; //if (ttzz == 1) { sPos = 7; } // "/ttzzX" var sTmp = msg['m'].substring(sPos); RepeatingNoticeMessage2 = sTmp.replace(/<br>/g, '\n'); cb.sendNotice('Repeating Notices Message2 has been set', msg['user']); } else if (msg['m'].match(/\/tbsetrepeatingnoticetime/i)) { //this may not be used anymore. msg['X-Spam'] = true; var splitM = msg['m'].split(' '); var iInterval = parseInt(splitM[1]); if (!isNaN(iInterval)) { if (iInterval < 30) { cb.sendNotice('ERROR: (Start Repeating Notices) minimum is 30 seconds', msg['user']); } else { IsRepeatingNoticeRunning = true; RepeatingNoticeTimeInSec = iInterval; cb.sendNotice('Setting Repeating Notices time to ' + iInterval + ' (sec)', msg['user']); } } else { cb.sendNotice('ERROR: (Start Repeating Notices) has unrecognize seconds', msg['user']); } } else if (msg['m'].match(/\/tbadduser/i)) { msg['X-Spam'] = true; var splitM = msg['m'].split(' '); var sUser = splitM[1]; //need to do the add action if (!cbjs.arrayContains(cb.limitCam_allUsersWithAccess(), sUser)) { cb.limitCam_addUsers([sUser]); } cb.sendNotice('add user to hidden show ' + sUser, msg['user']); } else if (msg['m'].match(/\/tbremoveuser/i)) { msg['X-Spam'] = true; var splitM = msg['m'].split(' '); var sUser = splitM[1]; //need to do the add action if (cbjs.arrayContains(cb.limitCam_allUsersWithAccess(), sUser)) { cb.limitCam_removeUsers([sUser]); } cb.sendNotice('remove user from hidden show ' + sUser, msg['user']); } else if (msg['m'].match(/\/tbwhispertogg/i)) { msg['X-Spam'] = true; IsWhisperOn = !IsWhisperOn; cb.sendNotice('Whisper is now ' + (IsWhisperOn ? 'On' : 'Off'), msg['user']); } else if (msg['m'].match(/\/tbticketicontogg/i)) { msg['X-Spam'] = true; IsTicketIconOn = !IsTicketIconOn; cb.sendNotice('Ticket Icon is now ' + (IsTicketIconOn ? 'On' : 'Off'), msg['user']); } else if (msg['m'].match(/\/tbstartticket/i)) { msg['X-Spam'] = true; TicketingTimerInMin = 4; startTicketing(); cb.sendNotice('Start Ticket chosen.', msg['user']); } else if (msg['m'].match(/\/tbstopticket/i)) { msg['X-Spam'] = true; var IsTicketingRunning = false; var IsTicketingShowActive = false; var TicketingStatus = 0; var TicketingTimerInMin = 0; cb.sendNotice('Stop Ticket chosen.', msg['user']); } else if (msg['m'].match(/\/tbantispamtogg/i)) { msg['X-Spam'] = true; IsAntiSpamOn = !IsAntiSpamOn; cb.sendNotice('Anti Spam is now ' + (IsAntiSpamOn ? 'On' : 'Off'), msg['user']); } else if (msg['m'].match(/\/tbsetnotice1color/i)) { msg['X-Spam'] = true; var sPos = 19; var sTmp = msg['m'].substring(sPos); RepeatingNotice1ForegroundColor = sTmp; cb.sendNotice('Set Notice1 Foreground Color has been set.', msg['user']); } else if (msg['m'].match(/\/tbnotifyticketonenter/i)) { msg['X-Spam'] = true; NotifyTicketOnEnter = !NotifyTicketOnEnter; cb.sendNotice('NotifyTicketOnEnter is now ' + (NotifyTicketOnEnter ? 'On' : 'Off'), msg['user']); } else if (msg['m'].match(/\/tbgetticketbyphrasetogg/i)) { msg['X-Spam'] = true; IsGetTicketByPhraseOn = !IsGetTicketByPhraseOn; cb.sendNotice('Get Ticket By Phrase is now ' + (IsGetTicketByPhraseOn ? 'On' : 'Off'), msg['user']); } else if (msg['m'].match(/\/tbsetticketphrase/i)) { msg['X-Spam'] = true; var sTmp = msg['m'].substring(19); GetTicketPhrase = sTmp; cb.sendNotice('Get Ticket by Phrase has been set to: ' + GetTicketPhrase, msg['user']); } } //if (iPowerUser) { //TODO: hidden cam message updateable manually //TODO: (optional) turn on/off display tippers total...."TurnOnTheShine" or query // TICKET_ICON_CODE if (IsTicketIconOn) { var sMsg = msg['m']; var sUser = msg['user']; if (cbjs.arrayContains(cb.limitCam_allUsersWithAccess(), sUser)) { msg['m'] = TICKET_ICON_CODE + sMsg; } } if (IsAntiSpamOn) { //AntiSpam and Advertiser feature if (!Aliases[sUser].TimeWaitSkip) { var iThreshhold = (Date.now() - Aliases[sUser].TimeEntered) ; var sMsg2 = msg['m']; var iMaxThreshold = AntiRobotEnterThreshold * 1000; if (iThreshhold < iMaxThreshold) { //you are trying to speak within 22 s of entering a room. You must be a robot, right? var sUser = msg['user']; cb.sendNotice('(' + sUser + ') ' + sMsg2, cb.room_slug, SPAM_BACKGROUND); cb.sendNotice('(' + sUser + ') ' + sMsg2, '', SPAM_BACKGROUND, '#000000', 'normal', 'red'); msg['m'] = '... ... ...' } else { Aliases[sUser].TimeWaitSkip = true; } } // if (!Aliases[sUser].TimeWaitSkip) { } if (IsGetTicketByPhraseOn) { //grants users that enters a passphrase if (msg['m'].match(regEx(GetTicketPhrase))) { msg['X-Spam'] = true; var sUser = msg['user']; //need to do the add action if (!cbjs.arrayContains(cb.limitCam_allUsersWithAccess(), sUser)) { cb.limitCam_addUsers([sUser]); } cb.sendNotice('add user to hidden show ' + sUser, msg['user']); } } return msg; }); cb.onEnter(function(user) { var sUser = user['user']; checkAndAddAlias(sUser); if (Aliases[sUser].TimeEntered == 0) { Aliases[sUser].TimeEntered = Date.now(); Aliases[sUser].TimeWaitSkip = false; } Aliases[sUser].has_tokens = user['has_tokens']; if (IsAntiSpamOn) { //AntiSpam and Advertiser feature cb.sendNotice('Welcome ' + user['user'] + '!. (Please wait ' + AntiRobotEnterThreshold + 's before making your first post.)', sUser); } if (NotifyTicketOnEnter) { if (cb.limitCam_userHasAccess(sUser)) { cb.sendNotice(TICKET_ICON_CODE + '*** Ticket Show: You have a Ticket to the Show: ' + sUser + ' *** ' + TICKET_ICON_CODE, sUser, TICKETING_BACKGROUND); cb.sendNotice(TICKET_ICON_CODE + '(on Enter) *** Ticket Show: You have a Ticket to the Show: ' + sUser + ' *** ' + TICKET_ICON_CODE, 'cb_kyle', TICKETING_BACKGROUND); } } }); function checkAndAddAlias(psUser) { if (!Aliases.hasOwnProperty(psUser)) { //new alias var user = {}; user.Message = true; user.TimeEntered = 0; user.TimeWaitSkip = false; user.has_tokens = false; user.ProfileDetail = ''; iArAliasNo++; user.AliasNo = iArAliasNo; Aliases[psUser] = user; ArAliases[iArAliasNo] = psUser; } } function addTip(piTip, psUser) { //start recording peoples tip amounts. var tipuser = psUser; if (Tippers.hasOwnProperty(tipuser)) { Tippers[tipuser].TotalTips += piTip; } else { //new Tipper var tipper = {}; tipper.TotalTips = parseInt(piTip); Tippers[tipuser] = tipper; //manually added ones do not have object. } } function setTip(piTip, psUser) { //start recording peoples tip amounts. var tipuser = psUser; if (Tippers.hasOwnProperty(tipuser)) { Tippers[tipuser].TotalTips = piTip; } else { //new Tipper var tipper = {}; tipper.TotalTips = parseInt(piTip); Tippers[tipuser] = tipper; //manually added ones do not have object. } } function hideShow() { //start Hidden show if (!cb.limitCam_isRunning()) { cb.limitCam_start(TipBreakMsg); } // cb.sendNotice('*** hide triggered. '); //ksh test. } function unhideShow() { //end show if (cb.limitCam_isRunning()) { cb.limitCam_stop(); } // cb.sendNotice('*** unhide triggered. '); //ksh test. } function getAllUsersWithAccessAsString() { var sReturn = ''; var userList = cb.limitCam_allUsersWithAccess(); sReturn = '' + userList.length + ' USER(S) WITH ACCESS:'; for (var i = 0; i < userList.length; i++) { sReturn += '\n' + '(#' + i + ') ' + userList[i]; } return sReturn; } function runSubProgram() { //this program lets users see the screeen after the timeout period. //// cb.sendNotice('lights on...'); //// cb.sendNotice((Date.now() - tipbreak_starttime) / 1000); unhideShow(); } function runRepeatingProgram() { if (!tipbreak_running) { cb.sendNotice('...repeating stopped running...'); return; } cb.setTimeout(runRepeatingProgram, (RepeatWaitTime * 60 * 1000)); cb.setTimeout(runSubProgram, (HideWaitTime * 1000)); //// cb.sendNotice('blip (lights out)...'); //// cb.sendNotice((Date.now() - tipbreak_starttime) / 1000); //// cb.sendNotice(getAllUsersWithAccessAsString()); //// cb.sendNotice('... blip'); hideShow(); } function resetUsersWithAccess() { var userList = cb.limitCam_allUsersWithAccess(); //reset Lists if (userList.length > 0) { cb.limitCam_removeAllUsers(); } } function loadUsersWithAccess() { var minTipAmount = TipMin; for (var prop in Tippers) { if (Tippers[prop].TotalTips >= minTipAmount) { if (!cbjs.arrayContains(cb.limitCam_allUsersWithAccess(), prop)) { cb.limitCam_addUsers([prop]); } } } } function getTipInfo() { var sReturn = ''; var runningTotal = 0; for (var prop in Tippers) { runningTotal += Tippers[prop].TotalTips; sReturn += '\n' + prop + ', ' + Tippers[prop].TotalTips; } sReturn = 'TIPPERS (TOTAL ' + runningTotal + ')' + sReturn; return sReturn; } function runRepeatingNotice() { if (IsRepeatingNoticeRunning) { cb.sendNotice(RepeatingNoticeMessage, '', '', RepeatingNotice1ForegroundColor); cb.setTimeout(runRepeatingNotice, RepeatingNoticeTimeInSec * 1000); } } function startRepeatingNotice() { IsRepeatingNoticeRunning = true; cb.setTimeout(runRepeatingNotice, 1000); } function runRepeatingNotice2() { if (IsRepeatingNoticeRunning2) { cb.sendNotice(RepeatingNoticeMessage2); cb.setTimeout(runRepeatingNotice2, RepeatingNoticeTimeInSec2 * 1000); } } function startRepeatingNotice2() { IsRepeatingNoticeRunning2 = true; cb.setTimeout(runRepeatingNotice2, RepeatingNoticeTimeInSec2 * 1000); } /* function addTip(_iTip, _sUser) { var tipuser = _sUser; if (Tippers.hasOwnProperty(tipuser)) { Tippers[tipuser].TotalTips += _iTip); } else { //new Tipper var tipper = {}; tipper.TotalTips =_iTip; //Tippers[tipuser] = tipper; //tipper object not passed when added. } } */ function runTicketing() { //use this routine that checks to run every 1 min as a suggestion. // IsTicketingRunning = true; // TicketingStatus = 0; // need test code for people to test theire screent // update subject with correct # if (TicketingStatus == 1) { //Status 1. Notify users. //todo: notify coupons? notifyTicketHolders(); TicketingStatus++; } else if (TicketingStatus == 2) { //Status 2. Countdown timer. //TODO: update control panel. Cannot do from BOT. Implement in APP //todo: start animations if (TicketingTimerInMin > 1) { //TODO: timer counter cb.sendNotice(TICKET_ICON_CODE + '*** Ticket Show: Show starts in ' + TicketingTimerInMin + ' minutes. *** ' + TICKET_ICON_CODE, '', TICKETING_BACKGROUND); TicketingTimerInMin--; } else { TicketingStatus++; } } else if (TicketingStatus == 3) { //Status 3. Last Test of the HIdden Scrren //todo: update subject to have crazyticket tage start of show 0 tkns, etc. //todo: set the message for the ticket window. hideShow(); cb.sendNotice(TICKET_ICON_CODE + '*** Ticket Show: Hidden Screen is ON. Show starts in 1 minute. ' + 'If you do not have a ticket, you will get the Hidden Screen. *** ' + TICKET_ICON_CODE, '', TICKETING_BACKGROUND); TicketingStatus++; } else if (TicketingStatus == 4) { //Status 4. Show Start //TODO: timer UP counter //TODO: tip x amount is avilable. //TODO: silence all except ticket holders //only allow ticket holders to speak? allow mods to speak freely, grey-whisper everything else? // cb.sendNotice('*** Ticketing Show: SHOW STARTING. Chat available only to ticket holders, moderators can see non-ticketholder chats. *** '); IsTicketingShowActive = true; cb.sendNotice(TICKET_ICON_CODE + '*** Ticket Show: SHOW IS STARTING. *** ' + TICKET_ICON_CODE, '', TICKETING_BACKGROUND, '#000000', 'bold'); TicketingStatus++; } else { //exit runTicketting loop //need to wait for signal to stop // IsTicketingShowActive = false; // IsTicketingRunning = false; return null; } cb.setTimeout(runTicketing, 60000); } function startTicketing() { //TODO: check if already running. IsTicketingRunning = true; TicketingStatus = 1; IsTicketIconOn = true; // turn on ticket icon cb.setTimeout(runTicketing, 1000); } function notifyTicketHolders() { var userList = cb.limitCam_allUsersWithAccess(); for (var i = 0; i < userList.length; i++) { cb.sendNotice(TICKET_ICON_CODE + '*** Ticket Show: You have a Ticket to the Show: ' + userList[i] + ' *** ' + TICKET_ICON_CODE, userList[i], TICKETING_BACKGROUND); } } function regEx(ps1) { var s1 = ps1.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&'); return new RegExp(s1, 'i'); } function init() { // resetUsersWithAccess(); //hide this to avoid manipulating any exiting Ticket bots, at this point in time. // tipbreak_running = true; // runRepeatingProgram(); } init();
© Copyright Chaturbate 2011- 2026. All Rights Reserved.