Apps Home
|
Create an App
Dorothy's Easy Ticket Show
Author:
dorothy
Description
Source Code
Launch App
Current Users
Created by:
Dorothy
/** Name: Dorothy's Ticket Show Author: chelsea2950 Created 08/3/2019 **/ // prototype functions { String.prototype.capitalize = function() { return this.charAt(0).toUpperCase() + this.slice(1); } String.prototype.repeat = function (number) { return new Array(number + 1).join(this); } String.prototype.equals = function (str) { var m = new RegExp(str); return this.match(m) != null; } String.prototype.equalsIgnoreCase = function (str) { var m = new RegExp(str, 'i'); return this.match(m) != null; } } { var dummycounter = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19' ]; var backgroundArray = { menu: ['Cube Wave', 'Hearts', 'Snow', 'Aquarium', 'Snakeskin', 'Pastels', 'Clouds', 'Lava Lamp', 'Light Blue', 'Moon', 'Valentines 2 Hearts', 'Green and Blue Bars', 'Pink and Blue Bars', 'Green and Green Bars', 'Green and Yellow Bars', 'Purple and Pink Bars', 'Aqua and Pink Bars', 'Pink and Pink Bars', 'Yellow and Yellow Bars' ], command: ['cubewave', 'hearts', 'snow', 'aquarium', 'snakeskin', 'pastels', 'clouds', 'lavalamp', 'lightblue', 'moon', 'valentines2', 'greenblue', 'pinkblue', 'greengreen', 'greenyellow', 'purplepink', 'aquapink', 'pinkpink', 'yellowyellow' ], devfile: ['add', 'add', 'add', 'add', 'add', 'add', 'add', 'add', 'add', 'add', 'add', 'add', 'add', 'add', 'add', 'add', 'add', 'add', 'add' ], livefile: ['9b65a933-170a-4b00-ad6a-39ea7c9312ad','a2db591d-2a17-4e70-be89-ae69f05f621c', 'a5d426b9-b802-4b08-9024-fabadf58853b', '1ff58042-f10e-45db-99fd-b718c3aaaa06', 'a9113f2c-82de-4d03-a61d-292eb10874b7', '522799ae-03c9-43a0-8de8-106f987d5854', '165548a4-4368-482b-8cbc-0d6a085dd8c7', '8c1b737d-43f8-4d70-a701-acb76d9def5d', '75717679-dc67-400e-a631-1d4b0bc78f70', 'f90aef6a-57b2-423c-8faa-f31a402e8dea', 'b0e2626c-216c-4f46-90e7-461d43dfa810', 'fc009d6d-aa2c-401e-b750-71f9d02d9aae', 'b4f251a7-0272-46c7-b2f5-485246d1c446', 'e2d242d5-534a-42f8-b5c0-1e9f6e1b6d73', 'f146c203-d4e5-46ad-8e32-8b5fb83c3902', '5112db0f-91df-496d-8a07-70dce62a0aa5', '0690f718-789c-4868-aa49-5cd304812301', '246b811e-2d68-49d9-ab42-51720e2fb262', 'c2e76741-20d1-4ec4-b43a-e739a3483922' ] }; var fontSize = 12; var customPanel = false; } {cb.settings_choices = [ {name: 'intro', label: '********************** INTRODUCTION ************************ Latest Updt: 08/3/2019 (version 1.0) See Change Log ********************************************************* Welcome to Dorothy\'s Easy Ticket Show App. The App is a duplicate of Dorothy\'s Ticket Show, with most of the configurable settings replaced with the most common defaults to make the App very quick to set up. You can see a listing of all of the default settings on the App description page. Note that moderators are given significant privileges by this App, so please make sure you assign moderators you can trust. You can see the full list of commands for the App by typing "/tickethelp" in the chat (no quotes). Please enjoy using the App and feel free to DM me on twitter @thechelsea2950 if you have questions. Thank you! - chelsea', type: 'choice',required: false}, {name: 'ticketShowPrice', label: 'Ticket Show Price? -- The Hidden Show feature cannot be enabled without a price defined. Discounted price for Fan Club is defined later below', type: 'int',minValue: 1,maxValue: 99999,defaultValue: 69}, {name: 'ticketRoomSubjectSfx', label: 'Title? -- Description of the show to appear as part of the room title (optional). You can include hashtags for keywords you want to be searchable', type:'str', minLength: 1,maxLength: 200, required: false, defaultValue: 'Hidden Sex Show! Token Poll for cumshot!'}, {name: 'panelBackground', label: 'Which background panel type would you like to display? Note you cannot use the personalized background unless they are for your room, it will use the default if they are selected', type: 'choice', choice1: 'default - no image', choice2: backgroundArray.menu[0], choice3: backgroundArray.menu[1], choice4: backgroundArray.menu[2], choice5: backgroundArray.menu[3], choice6: backgroundArray.menu[4], choice7: backgroundArray.menu[5], choice8: backgroundArray.menu[6], choice9: backgroundArray.menu[7], choice10: backgroundArray.menu[8], choice11: backgroundArray.menu[9], choice12: backgroundArray.menu[10], choice13: backgroundArray.menu[11], choice14: backgroundArray.menu[12], choice15: backgroundArray.menu[13], choice16: backgroundArray.menu[14], choice17: backgroundArray.menu[15], choice18: backgroundArray.menu[16], choice19: backgroundArray.menu[17], choice20: backgroundArray.menu[18], defaultValue: 'default - no image'}, {name: 'panelTextColor',label: 'Text color for the panel text',type: 'choice',choice1: 'White/No Color',choice2: 'Black',choice3: 'Dark Grey',choice4: 'Dark Red',choice5: 'Dark Orange',choice6: 'Dark Green',choice7: 'Dark Aqua',choice8: 'Dark Blue',choice9: 'Dark Purple',choice10: 'Dark Pink',choice11: 'Dark Gold',choice12: 'Dark Teal',choice13: 'Dark Brown',choice14: 'Dark Bronze',choice15: 'Dark Periwinkle',choice16: 'Dark Fuschia',choice17: 'Dark Lime',choice18: 'Dark Plum',defaultValue: 'Dark Blue'} ]; } { // *********************************** Variables and Arrays ************************************** var initialize = 0; var BC = cb.room_slug; var ticketSubjectText = cb.settings.ticketRoomSubjectSfx; var ticketShowAfterNotice = 'After Show - Thank you!! Please Follow!'; var ticketPrice = cb.settings.ticketShowPrice; var ticketShowCumulative = 'Yes'; var ticketShowStartMode = 'Start Show Anytime'; var ticketShowStartAuto = 'Start from Command'; var ticketShowGoal = 0; var ticketShowStartTimer = 15; var ticketShowFanAppreciation = 'No'; var ticketShowFreeFC = 'Yes'; var ticketShowFreeMods = 'Yes'; var ticketShowFreeEFC = 'Yes'; var ticketShowFreeVIP = 'Yes'; var ticketShowPriceFC = 0; var ticketShowPriceEFC = 0; var ticketShowPriceVIP = 0; var extFanList = ''; var VIPList = ''; var botModList = ''; var allowModsAuthority = 'Yes'; var ticketShowModsAdd = 'Yes'; var ticketShowModsChgPrice = 'Yes'; var ticketShowReducePriceWarn = 0; var ticketShowEnableOT = 'No'; var ticketShowOTList = ''; var ticketShowAllowGift = 'No'; var freePreviewLengthText = 'No Preview'; var ticketShowPreviewGrays = 'No'; var ticketNoticeInterval = 1.2; var ticketShowTextColor = 'Dark Blue'; var ticketShowCustomTextColor = ''; var ticketShowBgColor = 'Light Aqua'; var ticketShowCustomBgColor = ''; var panelBackground = cb.settings.panelBackground; var panelTextColor = cb.settings.panelTextColor; var panelCustomTextColor = ''; var showTotals = 'Yes'; var fembotRunning = 'No'; var currentAppTotalTicket = 0; var ticketStartMode = ''; var ticketModeAuto = ''; var ticketShowTotalTips = 0; var ticketShowTotalTickets = 0; var ticketStartTime = 0; var ticketStopTime = 0; var ticketTimeAdded = 0; var ticketMinsRemain = 0; var ticketSecsRemain = 0; var ticketShowOtToggle = 0; var newTicketMode = ''; var countTickets = 0; var countTicketsFromPreview = 0; var ticketShowEnded = false; var appNoticeColor = '#f4d599'; // Used for general app messaging and clock countdown var red = '#f4c1bc'; // Used for last 2 minutes of clock countdown var ticketHolderBgColor = 'linear-gradient(to right, #fff 20%, #cdf2ff, #4dd2ff 100%)' var dashLine80 = new Array(80).join('-'); var dashLine60 = new Array(60).join('-'); var dashLine70 = new Array(70).join('-'); var dashLine90 = new Array(90).join('-'); var backgroundImage = ''; var textColor = 'black'; var leftjust1 = 20; var leftjust2 = 20; var leftjust3 = 20; var topjust1 = 4; var topjust2 = 26; var topjust3 = 49; // Arrays */ var fanClubList = []; var VIPListArray = []; var VIPsInShow = []; var extFanListArray = []; var extFansInShow = []; var botModListArray = []; var modsInShow = []; var ticketShowViewerList = []; var ticketShowPreViewerList = []; var freePreviewUserArray = []; var freePreviewTimeArray = [0]; var ticketHolderList = []; var moderatorList = {name: [], type: []}; var ticketCumulative = {name: [], amount: []}; var outstandingTicketArray = []; var otChangesArray = {name: [], type: []}; var ticketShowExtraTickets = {name: [], count: []}; var drawpanel = {panel: {}}; } { // *********************************** Functions ************************************** { // Generic functions to set the color or separator characters function checkTextColor(color) { switch (color) { case 'White/No color': return '#FFFFFF'; case 'Black': return '#000000'; case 'Dark Blue': return '#0629AC'; case 'Dark Pink': return '#FF6680'; case 'Dark Green': return '#006600'; case 'Dark Red': return '#cc0000'; case 'Dark Purple': return '#3d003d'; case 'Dark Grey': return '#737373'; case 'Dark Orange': return '#e77400'; case 'Dark Aqua': return '#006767'; case 'Dark Gold': return '#998100'; case 'Dark Teal': return '#003f1f'; case 'Dark Brown': return '#582c00'; case 'Dark Bronze': return '#a56728'; case 'Dark Periwinkle': return '#155bd7'; case 'Dark Fuschia': return '#d6155c'; case 'Dark Lime': return '#6b790c'; case 'Dark Plum': return '#7f13bf'; default: if (/^#[0-9A-F]{6}$/i.test(color)) { return color; } else if (/^[0-9A-F]{6}$/i.test(color)) { return ('#' + color); } else { return ('default'); } } } function checkBgColor(color) { switch (color) { case 'White/No color': return '#FFFFFF'; case 'Light Aqua': return '#adeaea'; case 'Light Pink': return '#FFE6EA'; case 'Light Green': return '#94e594'; case 'Light Red': return '#ff9a9a'; case 'Light Purple': return '#f2cdff'; case 'Light Orange': return '#ffd9b3'; case 'Light Grey': return '#e6e6e6'; case 'Light Blue': return '#d1eaee'; case 'Light Yellow': return '#ffff94' case 'Cream': return '#f9f6ed' case 'Light Bronze': return '#ebccad'; case 'Light Periwinkle': return '#d7e4fb'; case 'Light Teal': return '#d7fbee'; case 'Light Fuschia': return '#fbd7e4'; case 'Light Lime': return '#ecf6a7'; case 'Light Plum': return '#e3c0f9'; default: if (/^#[0-9A-F]{6}$/i.test(color)) { return color; } else if (/^[0-9A-F]{6}$/i.test(color)) { return ('#' + color); } else { return ('default'); } } } function leftJustify(textstring,line) { textStringLength = textstring.length; if (fontSize == 11) { if (line == 1) { if (textStringLength < 4) { return 114; } else if (textStringLength < 6) { return 109; } else if (textStringLength < 8) { return 104; } else if (textStringLength < 10) { return 100; } else if (textStringLength < 12) { return 95; } else if (textStringLength < 14) { return 90; } else if (textStringLength < 16) { return 86; } else if (textStringLength < 18) { return 82; } else if (textStringLength < 20) { return 77; } else if (textStringLength < 22) { return 72; } else if (textStringLength < 24) { return 67; } else if (textStringLength < 26) { return 62; } else if (textStringLength < 28) { return 58; } else if (textStringLength < 30) { return 53; } else if (textStringLength < 32) { return 49; } else if (textStringLength < 34) { return 44; } else if (textStringLength < 37) { return 39; } else if (textStringLength < 40) { return 34; } else if (textStringLength < 42) { return 30; } else if (textStringLength < 44) { return 26; } else if (textStringLength < 47) { return 21; } else if (textStringLength < 49) { return 16; } else if (textStringLength < 51) { return 11; } else { return 7; } } else { if (textStringLength < 4) { return 114; } else if (textStringLength < 6) { return 110; } else if (textStringLength < 8) { return 105; } else if (textStringLength < 10) { return 100; } else if (textStringLength < 12) { return 97; } else if (textStringLength < 14) { return 93; } else if (textStringLength < 16) { return 88; } else if (textStringLength < 18) { return 83; } else if (textStringLength < 20) { return 79; } else if (textStringLength < 22) { return 74; } else if (textStringLength < 24) { return 71; } else if (textStringLength < 26) { return 66; } else if (textStringLength < 28) { return 61; } else if (textStringLength < 30) { return 57; } else if (textStringLength < 32) { return 53; } else if (textStringLength < 34) { return 48; } else if (textStringLength < 37) { return 44; } else if (textStringLength < 39) { return 39; } else if (textStringLength < 42) { return 34; } else if (textStringLength < 44) { return 29; } else if (textStringLength < 47) { return 24; } else if (textStringLength < 49) { return 19; } else if (textStringLength < 52) { return 14; } else { return 7; } } } else { if (line == 1) { if (textStringLength < 4) { return 113; } else if (textStringLength < 6) { return 108; } else if (textStringLength < 8) { return 103; } else if (textStringLength < 10) { return 99; } else if (textStringLength < 12) { return 94; } else if (textStringLength < 14) { return 89; } else if (textStringLength < 16) { return 84; } else if (textStringLength < 18) { return 80; } else if (textStringLength < 20) { return 75; } else if (textStringLength < 22) { return 70; } else if (textStringLength < 24) { return 65; } else if (textStringLength < 26) { return 60; } else if (textStringLength < 28) { return 55; } else if (textStringLength < 30) { return 50; } else if (textStringLength < 32) { return 46; } else if (textStringLength < 34) { return 41; } else if (textStringLength < 37) { return 36; } else if (textStringLength < 40) { return 31; } else if (textStringLength < 42) { return 26; } else if (textStringLength < 44) { return 22; } else if (textStringLength < 47) { return 17; } else if (textStringLength < 49) { return 12; } else if (textStringLength < 51) { return 7; } else { return 3; } } else { if (textStringLength < 4) { return 113; } else if (textStringLength < 6) { return 109; } else if (textStringLength < 8) { return 104; } else if (textStringLength < 10) { return 99; } else if (textStringLength < 12) { return 95; } else if (textStringLength < 14) { return 91; } else if (textStringLength < 16) { return 86; } else if (textStringLength < 18) { return 81; } else if (textStringLength < 20) { return 77; } else if (textStringLength < 22) { return 72; } else if (textStringLength < 24) { return 68; } else if (textStringLength < 26) { return 63; } else if (textStringLength < 28) { return 58; } else if (textStringLength < 30) { return 54; } else if (textStringLength < 32) { return 50; } else if (textStringLength < 34) { return 45; } else if (textStringLength < 37) { return 40; } else if (textStringLength < 39) { return 35; } else if (textStringLength < 42) { return 30; } else if (textStringLength < 44) { return 25; } else if (textStringLength < 47) { return 20; } else if (textStringLength < 49) { return 15; } else if (textStringLength < 52) { return 10; } else { return 3; } } } } //********** Build Moderator Array ************** function populateModeratorArray(user,type,mode) { if (mode == 'a') { if (!cbjs.arrayContains(moderatorList.name,user)) { moderatorList.name.push(user); moderatorList.type.push(type); } else { return; } } else if (mode == 'r') { if (cbjs.arrayContains(moderatorList.name,user)) { nameIndex = moderatorList.name.indexOf(user); moderatorList.name.splice(nameIndex,1); moderatorList.type.splice(nameIndex,1); } else { return; } } else { return; } } function addRmvModsInShow(user, mode) { if (mode == 'a') { if (cbjs.arrayContains(modsInShow,user)) { return; } else { modsInShow.push(user); } } else if (mode == 'r') { if (cbjs.arrayContains(modsInShow,user)) { cbjs.arrayRemove(modsInShow,user); } else { return; } } } function populateFanClubArray(user) { if (!cbjs.arrayContains(fanClubList,user)) { fanClubList.push(user); } else { return; } } function addRmvVIP(user, mode) { if (mode == 'a') { if (cbjs.arrayContains(VIPListArray,user)) { return; } else { VIPListArray.push(user); } } else if (mode == 'r') { if (cbjs.arrayContains(VIPListArray,user)) { cbjs.arrayRemove(VIPListArray,user); } else { return; } } } function addRmvVIPInShow(user, mode) { if (mode == 'a') { if (cbjs.arrayContains(VIPsInShow,user)) { return; } else { VIPsInShow.push(user); } } else if (mode == 'r') { if (cbjs.arrayContains(VIPsInShow,user)) { cbjs.arrayRemove(VIPsInShow,user); } else { return; } } } function addRmvExtFan(user, mode) { if (mode == 'a') { if (cbjs.arrayContains(extFanListArray,user)) { return; } else { extFanListArray.push(user); } } else if (mode == 'r') { if (cbjs.arrayContains(extFanListArray,user)) { cbjs.arrayRemove(extFanListArray,user); } else { return; } } } function addRmvExtFanInShow(user, mode) { if (mode == 'a') { if (cbjs.arrayContains(extFansInShow,user)) { return; } else { extFansInShow.push(user); } } else if (mode == 'r') { if (cbjs.arrayContains(extFansInShow,user)) { cbjs.arrayRemove(extFansInShow,user); } else { return; } } } //********** Goal Bar ************** function goalBar(current,total) { if (current > 0 && total > 0) { percent = Math.round(100*(current/total)); } else { percent = 0; } bar = ''; full = '\u25C6'; half = '\u25C8'; empty = '\u25C7'; a = (percent - (percent % 10)) / 10; b = (percent % 10) > 0 ? 1 : 0; c = 10 - (a + b); bar += charRepeat(full, a); (b === 1 ? bar += half : bar += ''); bar += charRepeat(empty, c) return bar; } function charRepeat(d, e) { var string = ''; for (var index = 1; index <= e; index++) { string += d } return string; } // *********************************** Ultra App Ticket Show Functions ************************************** function initTicketShow() { ticketShowColors(); countTickets = 0; countTicketsFromPreview = 0; showStage = 'ticketsales'; changeRoomSubject(); ticketSkipMin = false; ticketSkipSec = false; ticketModeMessage = ''; setTicketMode('init',BC); ticketShowEnded = false; ticketSalesEnded = false; loadFreeTickets(); if (ticketShowEnableOT == 'Yes' && ticketShowFanAppreciation != 'Yes') { setTicketShowOtToggle('on',BC) } if (ticketShowFanAppreciation == 'Yes') { cb.sendNotice(dashLine80 + '\nToday\'s Ticket Show is a Fan Club Appreciation Show!\nOnly Fan Club Members and VIPs will be admitted to the show!\nPlease consider joining the Fan Club!\n' + dashLine80, '', ticketBgColor, ticketTxtColor, 'bold'); } else { cb.sendNotice(dashLine90 + '\n* The Broadcaster has started selling tickets for the show.\n* Tickets are ' + ticketPrice + ' tokens.\n' + ticketModeMessage + '\n' + dashLine90, '', ticketBgColor, ticketTxtColor, 'bold'); cb.sendNotice('***Warning Regarding the Ticket Show***: Do not deactivate or restart the Ticket Show App once users have bought tickets without first saving the ticket show list or you will lose the list of ticket holders.\n* If it is necessary to restart, please save the ticket list first (use /tickets to view and then copy) and then add those users back to the show once restarted (/add).\n* If you are using Dorothy\'s Ultra Fembot alongside this app, it can save a backup ticket list for you if configured to do so.', BC, appNoticeColor); if (ticketShowAllowGift == 'Yes') { cb.sendNotice(dashLine90 + '\n* The Broadcaster has enabled the the gifting of tickets. \n* You can buy extra tickets and gift them to others.\n* See help text for info using the "/tickethelp" command. \n' + dashLine90, '', ticketBgColor, ticketTxtColor, 'bold'); } } initTicketNoticeTimer(); cb.drawPanel(); } function ticketShowColors() { ticketNoticesTxtColor = checkTextColor('Dark Red'); ticketNoticesBgColor = checkBgColor('Cream'); ticketTxtColorFan = checkTextColor('Black'); ticketBgColorFan = checkBgColor('Light Green'); ticketTxtColorVIP = checkTextColor('Black'); ticketBgColorVIP = checkBgColor('Light Purple'); ticketTxtColorMod = checkTextColor('Black'); ticketBgColorMod = checkBgColor('Light Red'); if (ticketShowTextColor == 'Custom') { ticketTxtColor = checkTextColor(ticketShowCustomTextColor); if (ticketTxtColor == 'default') { cb.sendNotice('Ticket Show - Error while setting the text color. It has to be in a HEX format. Using default value.', cb.room_slug, appNoticeColor, '', 'bold'); ticketTxtColor = '#FFFFFF'; } } else { ticketTxtColor = checkTextColor(ticketShowTextColor); } if (ticketShowBgColor == 'Custom') { ticketBgColor = checkBgColor(ticketShowCustomBgColor); if (ticketBgColor == 'default') { cb.sendNotice('Ticket Show - Error while setting the background color. It has to be in a HEX format. Using default value.', cb.room_slug, appNoticeColor, '', 'bold'); ticketBgColor = '#FFFFFF'; } } else { ticketBgColor = checkBgColor(ticketShowBgColor); } } function initTicketNoticeTimer() { if (ticketNoticeInterval == '' || ticketNoticeInterval == null) { cb.sendNotice('Ticket Show Chat Notice Interval is not set. Using default value of 1.8 minutes.', cb.room_slug, appNoticeColor); ticketNoticeInt = 1.2; } else { ticketNoticeInt = parseFloat(ticketNoticeInterval); } if (ticketNoticeInt < 1) { cb.sendNotice('Ticket Show Chat Notice Interval is too short, must be at least 1 minute. Using default value of 2.6 minutes.', cb.room_slug, appNoticeColor); ticketNoticeInt = 1.2; } ticketNoticeInt *= 60000; ticketNoticeInt = parseInt(ticketNoticeInt); cb.setTimeout(ticketNoticeTimer, ticketNoticeInt); } function ticketNoticeTimer() { if (showStage == 'ticketsales' || showStage == 'ticketshow' || showStage == 'showwarn') { ticketNotice(); } cb.setTimeout(ticketNoticeTimer, ticketNoticeInt); } function ticketNotice() { if (ticketShowFanAppreciation == 'Yes') { msg = '**** Today\'s Ticket Show is a Fan Club Appreciation Show! ****\nOnly Fan Club Members and VIPs will be admitted to the show, please consider joining the Fan Club!'; } else { msg = ':uaticketsmall The general admission ticket price is ' + ticketPrice + ' token' + (ticketPrice > 1 ? 's.' : '.'); if (ticketShowPriceFC > 1 && ticketShowFreeFC != 'Yes') { msg += '\nChaturbate :fanclub-lana2 members can buy a ticket to the show for ' + ticketShowPriceFC + ' token' + (ticketShowPriceFC > 1 ? 's.' : '.'); } if (ticketShowPriceEFC > 1 && ticketShowFreeEFC != 'Yes') { msg += '\nExternal :fanclub-lana2 members can buy a ticket to the show for ' + ticketShowPriceEFC + ' token' + (ticketShowPriceEFC > 1 ? 's.' : '.'); } if (ticketShowPriceVIP > 1 && ticketShowFreeVIP != 'Yes') { msg += '\n:VIPCookie List members can buy a ticket to the show for ' + ticketShowPriceVIP + ' token' + (ticketShowPriceVIP > 1 ? 's.' : '.'); } } cb.sendNotice(msg, '', ticketBgColor, ticketTxtColor, 'bold'); } function setTicketShowOtToggle(option, sendto) { if(option == 'on') { if(ticketShowOtToggle == 1) { cb.sendNotice('The Outstanding Ticket feature is already enabled.',sendto,appNoticeColor); } else { ticketShowOtToggle = 1; cb.sendNotice(dashLine90 + '\n* ' + sendto + ' has started the Outstanding Ticket (OT) feature.\n* You can save your ticket if you have to leave before the show starts.\n* Use the command "/saveticket" to save it, but note that by\n* saving your ticket you will be REMOVED from the current show\'s list.\n* You can view the OT List with the command "/otlist".\n* You can redeem an outstanding ticket with the command "/useticket".\n' + dashLine90, '', ticketBgColor, ticketTxtColor, 'bold'); cb.sendNotice('***Notice Regarding Outstanding Tickets***: The Outstanding tickets added and removed during the show must be made permanent by updating the list on the App Launch page.\n* The list can be viewed using the command "/otlist".\n* The changes for the current session can be seen using "/otchanges".\n* It is recommended to save the list externally and update the OT list before the next show.\n* Changes made during the show are not saved beyond the current session.',cb.room_slug,appNoticeColor); } } else if(option == 'off') { if(ticketShowOtToggle == 0) { cb.sendNotice('The Outstanding Ticket feature is already disabled.',sendto,appNoticeColor); } else { ticketShowOtToggle = 0; cb.sendNotice('You have disabled the Outstanding Ticket (OT) feature.\n* The outstanding ticket list is still intact, but no more tickets will be sold.\n* The list can be viewed using the command "/otlist".\n* The changes for the current session can be seen using "/otchanges" \n* Be sure to update these entries into the OT List on the App Launch Page, they cannot be saved automatically.',sendto,appNoticeColor); } } } function setTicketPrice(amount,announce) { ticketPrice = parseInt(amount); if (announce == 'yes') { ticketPriceChangeNotice(ticketPrice); } } function ticketPriceChangeNotice(price) { cb.sendNotice(':ticket_red_small \u2749 \u2749 \u2749 :ticket_red_small \u2749 \u2749 \u2749 :ticket_red_small \n' + '\u21D2 . . . . Ticket Show Price Updated!!!. . . . . \u21D0 \n' + '\u21D2 . . . . Tickets are now ' + ticketPrice + ' tokens!!! . . . . . \u21D0 \n' + ':ticket_red_small \u2749 \u2749 \u2749 :ticket_red_small \u2749 \u2749 \u2749 :ticket_red_small' , '', ticketNoticesBgColor, ticketNoticesTxtColor, 'bold'); changeRoomSubject(); cb.drawPanel(); } function loadFreeTickets() { if (ticketShowFreeMods == 'Yes') { for (let i = 0; i < modsInShow.length; i++) { if (!cb.limitCam_userHasAccess(modsInShow[i])) { addRmvTicket('add',modsInShow[i],'mod'); } } } if (ticketShowFreeFC == 'Yes') { for (let i = 0; i < fanClubList.length; i++) { if (!cb.limitCam_userHasAccess(fanClubList[i])) { addRmvTicket('add',fanClubList[i],'fan'); } } } if (ticketShowFreeEFC == 'Yes') { for (let i = 0; i < extFansInShow.length; i++) { if (!cb.limitCam_userHasAccess(extFansInShow[i])) { addRmvTicket('add',extFansInShow[i],'fan'); } } } if (ticketShowFreeVIP == 'Yes') { for (let i = 0; i < VIPsInShow.length; i++) { if (!cb.limitCam_userHasAccess(VIPsInShow[i])) { addRmvTicket('add',VIPsInShow[i],'vip'); } } } } function checkFreeTickets(user,isMod,isFan,isExtFan,isVIP) { if (!cb.limitCam_userHasAccess(user) && showStage != 'aftershow') { if (isMod) { if (ticketShowFreeMods == 'Yes') { addRmvTicket('add',user,'mod'); cb.sendNotice(dashLine80 + '\nYou\'ve been added to the show because you\'re a moderator! \n' + dashLine80, user, ticketBgColor, ticketTxtColor, 'bold'); } cb.sendNotice(dashLine80 + '\n* Moderators: The Ticket Show feature is enabled. \n' + dashLine80, user, ticketBgColor, ticketTxtColor, 'bold'); } else if (isFan) { if (ticketShowFreeFC == 'Yes') { addRmvTicket('add',user,'fan'); cb.sendNotice(dashLine80 + '\nYou\'ve automatically been added to the show because you\'re a fan! \n' + dashLine80, user, ticketBgColor, ticketTxtColor, 'bold'); } else if (ticketShowPriceFC > 1) { cb.sendNotice(dashLine80 + '\n* As a fan club member, you can buy a ticket to the show for ' + ticketShowPriceFC + ' tokens. \n' + dashLine80, user, ticketBgColor, ticketTxtColor, 'bold'); } } else if (isExtFan) { if (ticketShowFreeEFC == 'Yes') { addRmvTicket('add',user,'fan'); cb.sendNotice(dashLine80 + '\nYou\'ve automatically been added to the show because you\'re a fan! \n' + dashLine80, user, ticketBgColor, ticketTxtColor, 'bold'); } else if (ticketShowPriceEFC > 1) { cb.sendNotice(dashLine80 + '\n* As a fan club member, you can buy a ticket to the show for ' + ticketShowPriceEFC + ' tokens. \n' + dashLine80, user, ticketBgColor, ticketTxtColor, 'bold'); } } else if (isVIP) { if (ticketShowFreeVIP == 'Yes') { addRmvTicket('add',user,'vip'); cb.sendNotice(dashLine80 + '\nYou\'ve automatically been added to the show because you\'re a VIP! \n' + dashLine80, user, ticketBgColor, ticketTxtColor, 'bold'); } else if (ticketShowPriceVIP > 1) { cb.sendNotice(dashLine80 + '\n* As a VIP List member, you can buy a ticket to the show for ' + ticketShowPriceVIP + ' tokens. \n' + dashLine80, user, ticketBgColor, ticketTxtColor, 'bold'); } } } } function setTicketMode(startmode,sendto) { if (startmode == 'init') { if (ticketShowStartMode == 'Start Show Anytime') { newTicketMode = 'manual'; } else if (ticketShowStartMode == 'Start Show after Timer') { newTicketMode = 'timer'; } else if (ticketShowStartMode == 'Start Show after Ticket Goal') { newTicketMode = 'ticketgoal'; } else if (ticketShowStartMode == 'Start Show after Token Goal') { newTicketMode = 'tokengoal'; } if (ticketShowStartAuto == 'Start from Command') { newTicketAuto = 'bc'; } else if (ticketShowStartAuto == 'Automated Start') { newTicketAuto = 'auto'; } } else { newTicketAuto = ticketModeAuto; if (startmode != '' && startmode != null) { newTicketMode = startmode; } else { newTicketMode = ticketStartMode; } } if (ticketStartMode == 'timer' && newTicketMode != 'timer') { if (ticketMinsRemain > 0 || ticketSecsRemain > 0) { stopTicketTimer(sendto); } } if (newTicketMode == 'manual') { ticketStartMode = 'manual'; ticketModeAuto = 'bc'; updtTicketModeMessage(); } else if (newTicketMode == 'timer') { if (ticketShowStartTimer >= 1) { ticketStartMode = 'timer'; ticketTimeAmt = ticketShowStartTimer; if (newTicketAuto == 'auto') { ticketAutoTimer(ticketTimeAmt); ticketModeAuto = 'auto'; updtTicketModeMessage(); } else { ticketAutoTimer(ticketTimeAmt); ticketModeAuto = 'bc'; updtTicketModeMessage(); } } else { ticketStartMode = 'manual'; ticketModeAuto = 'bc'; updtTicketModeMessage(); cb.sendNotice('Ticket Show start is set to manual mode. Mode was requested for automatic timer, but the timer was not set on the start page. You can restart the bot and update the missing time, or continue and start the show manually at the end of a timer or at a time of your choosing.', sendto, appNoticeColor); } } else if (newTicketMode == 'tokengoal') { if (ticketShowGoal >= 1) { ticketStartMode = 'tokengoal'; ticketShowGoalTokens = ticketShowGoal; if (newTicketAuto == 'auto') { ticketModeAuto = 'auto'; updtTicketModeMessage(); } else { ticketModeAuto = 'bc'; updtTicketModeMessage(); } } else { ticketStartMode = 'manual'; ticketModeAuto = 'bc'; updtTicketModeMessage(); cb.sendNotice('Ticket Show start is set to manual mode. Mode was requested for automatic goal start, but the goal was not set on the start page. You can restart the bot and update the missing goal, update the goal using the command "/chgticketgoal [amt]" and then change the mode using "/chgticketmode goal", or continue and start the show manually at the end of a timer or at a time of your choosing.', sendto, appNoticeColor); } } else if (newTicketMode == 'ticketgoal') { if (ticketShowGoal >= 1) { ticketStartMode = 'ticketgoal'; ticketShowGoalTickets = ticketShowGoal; if (newTicketAuto == 'auto') { ticketModeAuto = 'auto'; updtTicketModeMessage(); } else { ticketModeAuto = 'bc'; updtTicketModeMessage(); } } else { ticketStartMode = 'manual'; ticketModeAuto = 'bc'; updtTicketModeMessage(); cb.sendNotice('Ticket Show start is set to manual mode. Mode was requested for automatic goal start, but the goal was not set on the start page. You can restart the bot and update the missing goal, update the goal using the command "/chgticketgoal [amt]" and then change the mode using "/chgticketmode goal", or continue and start the show manually at the end of a timer or at a time of your choosing.', sendto, appNoticeColor); } } } function setTicketAuto(automode) { if (automode == 'bc') { ticketModeAuto = 'bc'; updtTicketModeMessage(); } else if (automode == 'auto') { ticketModeAuto = 'auto'; updtTicketModeMessage(); } } function updtTicketModeMessage() { if (ticketStartMode == 'manual') { ticketModeMessage = '* Ticket Show start mode is set to "Manual"\n* The show will be started by the broadcaster or moderator.'; } else if (ticketStartMode == 'timer') { if (ticketModeAuto == 'auto') { ticketModeMessage = '* Ticket Show start mode is set to "Automatic timer" with a duration of ' + ticketTimeAmt + ' minutes.\n* The Ticket Show will start automatically when the timer runs out.'; } else if (ticketModeAuto == 'bc') { ticketModeMessage = '* Ticket Show start mode is set to "Broadcaster managed timer". \n* The broadcaster will set a timer and start the show when the timer runs out.'; } } else if (ticketStartMode == 'tokengoal') { if (ticketModeAuto == 'auto') { ticketModeMessage = '* Ticket Show start mode is set to "Automatic at token goal." \n* There will be a short 2 minute countdown started once the goal is met for total tip amount (' + ticketShowGoalTokens + ' tokens), and then the show will start automatically.'; } else if (ticketModeAuto == 'bc') { ticketModeMessage = '* Ticket Show start mode is set to "Broadcaster managed token goal". \n* The broadcaster will start the show once the goal is met for the total tips (' + ticketShowGoalTokens + ' tokens).'; } } else if (ticketStartMode == 'ticketgoal') { if (ticketModeAuto == 'auto') { ticketModeMessage = '* Ticket Show start mode is set to "Automatic at ticket goal." \n* There will be a short 2 minute countdown started once the goal is met for tickets sold (' + ticketShowGoalTickets + ' tickets), and then the show will start automatically.'; } else if (ticketModeAuto == 'bc') { ticketModeMessage = '* Ticket Show start mode is set to "Broadcaster managed ticket goal". \n* The broadcaster will start the show once the goal is met for tickets sold (' + ticketShowGoalTickets + ' tickets).'; } } } function startTicketShowTimer(numtimer) { ticketMinsRemain = numtimer; ticketStartMode = 'timer'; ticketAutoTimer(ticketMinsRemain); cb.drawPanel(); } function ticketAutoTimer(addtime) { if (ticketModeAuto == 'auto') { if (ticketShowFanAppreciation == 'Yes') { cb.sendNotice('An automatic timer was started for the countdown to the Fan Appreciation show.', '', ticketBgColor, ticketTxtColor, 'bold'); } else { cb.sendNotice('An automatic timer was started, ticket show price will be ' + ticketPrice + ' tokens.', '', ticketBgColor, ticketTxtColor, 'bold'); } } else if (ticketModeAuto == 'bc') { cb.sendNotice('A timer was started to provide an countdown to approximate showtime. \n The broadcaster will start the show after the timer runs out.', '', ticketBgColor, ticketTxtColor, 'bold'); } ticketMinsRemain = addtime; ticketSecsRemain = 0; ticketStartTime = new Date(); ticketStopTime = new Date(ticketStartTime.getTime() + ticketMinsRemain * 60000); ticketTimerStopping = false; ticketTimerMin(); } function ticketTimerMin() { if (!ticketTimerStopping && ticketStartMode == 'timer') { switch (ticketMinsRemain) { case 60: case 45: case 30: case 25: case 20: case 15: case 10: case 9: case 8: case 7: case 6: case 5: case 4: case 3: case 2: if (ticketShowFanAppreciation == 'Yes') { cb.sendNotice('\u23f1 \u23f1 \u23f1 There are ' + ticketMinsRemain + ' minutes left until the Fan Appreciation Show! \u23f1 \u23f1 \u23f1', '', appNoticeColor, '', 'bold'); } else { cb.sendNotice('\u23f1 \u23f1 \u23f1 There are ' + ticketMinsRemain + ' minutes left to buy a ticket for ' + ticketPrice + ' tokens before the show starts! \u23f1 \u23f1 \u23f1', '', appNoticeColor, '', 'bold'); } break; case 1: if (ticketShowFanAppreciation == 'Yes') { cb.sendNotice('\u23f1 \u23f1 \u23f1 There is 1 minute left until the Fan Appreciation Show! \u23f1 \u23f1 \u23f1', '', appNoticeColor, '', 'bold'); } else { cb.sendNotice('\u23f1 \u23f1 \u23f1 There is 1 minute left to buy a ticket for ' + ticketPrice + ' tokens before the show starts! \u23f1 \u23f1 \u23f1', '', appNoticeColor, '', 'bold'); } break; } cb.drawPanel(); ticketMinsRemain--; if (ticketMinsRemain > 0) { ticketDisplaySeconds = false; } else { ticketDisplaySeconds = true; } ticketSecsRemain = 60; ticketTimerSec(); } } function ticketTimerSec() { if (!ticketTimerStopping && ticketStartMode == 'timer') { if (ticketDisplaySeconds) { switch (ticketSecsRemain) { case 30: case 10: case 5: case 4: case 3: case 2: cb.sendNotice('\u23f1 \u23f1 \u23f1 There are ' + ticketSecsRemain + ' seconds left! \u23f1 \u23f1 \u23f1', '', red, '', 'bold'); break; case 1: cb.sendNotice('\u23f1 \u23f1 \u23f1 There is 1 second left! \u23f1 \u23f1 \u23f1', '', red, '', 'bold'); break; } cb.drawPanel(); } if (ticketSecsRemain < 1) { if (ticketMinsRemain >= 1) { ticketTimerMin(); } else { if (ticketStartMode = 'timer' && ticketModeAuto == 'auto') { cb.sendNotice('\u23f0 \u23f0 \u23f0 Time is up! Ticket Show is starting! \u23f0 \u23f0 \u23f0', '', ticketNoticesBgColor, ticketNoticesTxtColor, 'bold'); startTicketShow(cb.room_slug); } else { cb.sendNotice('\u23f0 \u23f0 \u23f0 Time is up! Broadcaster will be starting the show! \u23f0 \u23f0 \u23f0', '', ticketNoticesBgColor, ticketNoticesTxtColor, 'bold'); } } } else { ticketSecsRemain--; cb.setTimeout(ticketTimerSec, 1000); } } } function ticketAddTime(tickettimetoadd, user) { ticketStopTime = new Date(ticketStopTime.getTime() + tickettimetoadd * 60000); timetoaddabs = Math.abs(tickettimetoadd); if (tickettimetoadd > 0) { cb.sendNotice(user + ' has added ' + tickettimetoadd + ' minute' + (tickettimetoadd === 1 || tickettimetoadd === -1 ? '' : 's') + ' to the timer.',cb.room_slug,'','', 'bold'); cb.sendNotice(tickettimetoadd + ' minute' + (tickettimetoadd === 1 || tickettimetoadd === -1 ? ' has' : 's have') + ' been added to the timer. Now ' + ticketTimeLeft(),'',appNoticeColor,'', 'bold'); } else { cb.sendNotice(user + ' has subtracted ' + timetoaddabs + ' minute' + (timetoaddabs === 1 || timetoaddabs === -1 ? '' : 's') + ' from the timer.',cb.room_slug,'','', 'bold'); cb.sendNotice(timetoaddabs + ' minute' + (timetoaddabs === 1 || timetoaddabs === -1 ? ' has' : 's have') + ' been subtracted from the timer. Now ' + ticketTimeLeft(),'',appNoticeColor,'', 'bold'); } ticketMinsRemain = ticketMinsRemain + tickettimetoadd; if (ticketMinsRemain > 0) { ticketDisplaySeconds = false; } else { ticketDisplaySeconds = true; } cb.drawPanel(); return; } function ticketTimeCal() { ticketStartTime = new Date(); return ticketStopTime - ticketStartTime.getTime(); } function stopTicketTimer(mod) { ticketStopTime = new Date(); ticketTimerStopping = true; ticketMinsRemain = 0; ticketSecsRemain = 0; if(mod != null && mod != '') { cb.sendNotice(mod + ' has stopped the ticket show timer.','',appNoticeColor,'', 'bold'); } cb.drawPanel(); } function ticketTimeLeft(user) { var ticketTimeLeft = ticketTimeCal(); var ticketMS = ticketTimeLeft % 1000; var ticketSeconds = ((ticketTimeLeft - ticketMS) % 60000); var ticketMinutes = ((ticketTimeLeft - ticketSeconds - ticketMS) % 3600000); var ticketHours = (ticketTimeLeft - ticketMinutes - ticketSeconds - ticketMS); ticketSeconds = ticketSeconds / 1000; ticketMinutes = ticketMinutes / 60000; ticketHours = ticketHours / 3600000; if (ticketHours > 0) { return ticketHours + ' hour' + (ticketHours > 1 ? 's' : '') + ' and ' + ticketMinutes + ' minute' + (ticketMinutes > 1 ? 's' : '') + ' remaining on the ticket show timer.'; } else if (ticketMinutes > 0 && ticketSeconds === 0) { return ticketMinutes + ' minute' + (ticketMinutes > 1 ? 's' : '') + ' remaining on the ticket show timer.'; } else if (ticketMinutes > 0) { return ticketMinutes + ' minute' + (ticketMinutes > 1 ? 's' : '') + ' and ' + ticketSeconds + ' second' + (ticketSeconds > 1 ? 's' : '') + ' remaining on the ticket show timer.'; } else { return ticketSeconds + ' second' + (ticketSeconds > 1 ? 's' : '') + ' remaining on the ticket show timer.'; } } function ticketTimeLeftPanel() { var ticketTimeLeft = ticketTimeCal(); var ticketMS = ticketTimeLeft % 1000; var ticketSeconds = ((ticketTimeLeft - ticketMS) % 60000); var ticketMinutes = ((ticketTimeLeft - ticketSeconds - ticketMS) % 3600000); var ticketHours = (ticketTimeLeft - ticketMinutes - ticketSeconds - ticketMS); ticketSeconds = ticketSeconds / 1000; ticketMinutes = ticketMinutes / 60000; if (ticketMinutes > 0) { return 'Less than ' + (ticketMinutes+1) + ' min rem'; } else { return (ticketSeconds) + ' sec rem'; } } function addRmvTicket(mode,user,usertype,tipamt) { switch (mode) { case 'add': { if (cbjs.arrayContains(freePreviewUserArray,user)) { addindex = freePreviewUserArray.indexOf(user); freePreviewUserArray.splice(addindex,1); freePreviewTimeArray.splice(addindex,1); removePreViewer(user); } cb.limitCam_addUsers([user]); addViewer(user); addTicketHolder(user); if (usertype == 'fan') { cb.sendNotice('Fan Club member ' + user + ' has been added to the ticket show list.', '', ticketBgColorFan, ticketTxtColorFan, 'bold'); } else if (usertype == 'vip') { cb.sendNotice('VIP List member ' + user + ' has been added to the ticket show list.', '', ticketBgColorVIP, ticketTxtColorVIP, 'bold'); } else if (usertype == 'mod') { cb.sendNotice('Moderator ' + user + ' has been added to the ticket show list.', '', ticketBgColorMod, ticketTxtColorMod, 'bold'); } else { cb.sendNotice(user + ' has been added to the ticket show list.', '', ticketBgColor, ticketTxtColor, 'bold'); } cb.drawPanel(); break; } case 'rmv': { cb.limitCam_removeUsers([user]); removeTicketHolder(user); removeViewer(user); cb.sendNotice(user + ' has been removed from the ticket show list.', '', ticketBgColor, ticketTxtColor, 'bold'); cb.drawPanel(); break; } case 'addtip': { if (cbjs.arrayContains(freePreviewUserArray,user)) { addtipindex = freePreviewUserArray.indexOf(user); freePreviewUserArray.splice(addtipindex,1); freePreviewTimeArray.splice(addtipindex,1); countTicketsFromPreview ++; removePreViewer(user); } cb.limitCam_addUsers([user]); addViewer(user); addTicketHolder(user); if (usertype == 'fan') { cb.sendNotice(':uaticketsmall Welcome Fan Club member ' + user + ', you have bought a ticket to the show!', '', ticketBgColorFan, ticketTxtColorFan, 'bold'); } else if (usertype == 'vip') { cb.sendNotice(':uaticketsmall Welcome VIP List member ' + user + ', you have bought a ticket to the show!', '', ticketBgColorVIP, ticketTxtColorVIP, 'bold'); } else if (usertype == 'mod') { cb.sendNotice(':uaticketsmall Welcome ' + user + ', you have bought a ticket to the show!', '', ticketBgColorMod, ticketTxtColorMod, 'bold'); } else { cb.sendNotice(':uaticketsmall Welcome ' + user + ', you have bought a ticket to the show!', '', ticketBgColor, ticketTxtColor, 'bold'); } if (ticketShowAllowGift == 'Yes' && tipamt >= (2*ticketPrice)) { addRmvTicket('addextra', user, 'common', (tipamt - ticketPrice)); } break; } case 'addextra': { var numtickets = Math.floor(parseInt(tipamt / ticketPrice)); if (numtickets > 0) { if (!cbjs.arrayContains(ticketShowExtraTickets.name,user)) { ticketShowExtraTickets.name.push(user); ticketShowExtraTickets.count.push(numtickets); } else { addextraindex = ticketShowExtraTickets.name.indexOf(user); ticketShowExtraTickets.count[addextraindex] = ticketShowExtraTickets.count[addextraindex] + numtickets; } cb.sendNotice(user + ', you have purchased ' + numtickets + ' extra tickets to the show. You can gift these to other users with the command "/giftticket user". Each time you use the command uses up one of your extra tickets. Please make sure to spell the user name right, gifted tickets cannot be recovered if they are gifted incorrectly.', user, ticketBgColor, ticketTxtColor, 'bold'); } cb.drawPanel(); break; } } } function addViewer(user) { if (!cbjs.arrayContains(ticketShowViewerList,user)) { ticketShowViewerList.push(user); } } function removeViewer(user) { if (cbjs.arrayContains(ticketShowViewerList,user)) { rmvvindex = ticketShowViewerList.indexOf(user); ticketShowViewerList.splice(rmvvindex,1); } } function addTicketHolder(user) { if (!cbjs.arrayContains(ticketHolderList,user)) { ticketHolderList.push(user); countTickets ++; } } function removeTicketHolder(user) { if (cbjs.arrayContains(ticketHolderList,user)) { rmvvindex = ticketHolderList.indexOf(user); ticketHolderList.splice(rmvvindex,1); if (countTickets > 0) { countTickets --; } } } function addPreViewer(user) { if (!cbjs.arrayContains(ticketShowPreViewerList,user)) { ticketShowPreViewerList.push(user); } } function removePreViewer(user) { if (cbjs.arrayContains(ticketShowPreViewerList,user)) { rmvpindex = ticketShowPreViewerList.indexOf(user); ticketShowPreViewerList.splice(rmvpindex,1); } } function addRmvPreview(mode,user) { switch (mode) { case 'add': { cb.limitCam_addUsers([user]); addViewer(user); addPreViewer(user); endtime = Date.now() + (freePreviewLength * 1000); freePreviewUserArray.push(user); index = freePreviewUserArray.indexOf(user); freePreviewTimeArray[index] = endtime; break; } case 'rmv': { cb.limitCam_removeUsers([user]); removeViewer(user); removePreViewer(user); break; } } } function previewMonitorTimer() { cb.setTimeout(previewMonitor, 5000); } function previewMonitor() { if (showStage == 'ticketshow' || showStage == 'showwarn' || showStage == 'showfinale') { previewCheckViewers(); previewMonitorTimer(); } cb.drawPanel(); } function previewCheckViewers() { nowtime = Date.now(); for (var chk = 0; chk < freePreviewUserArray.length; chk++) { user = freePreviewUserArray[chk]; if (cb.limitCam_userHasAccess(user)) { if (freePreviewTimeArray[chk] < nowtime) { addRmvPreview('rmv',user); cb.sendNotice(dashLine80 + '\n Your free preview period has ended. \nPlease buy a ticket for ' + ticketPrice + ' tokens to see the rest of the show.\n' + dashLine80, user, ticketBgColor, ticketTxtColor, 'bold'); } } } } function giftTicket(fromuser,touser) { cb.limitCam_addUsers([touser]); addViewer(touser); addTicketHolder(touser); cb.sendNotice('Welcome ' + touser + ', ' + fromuser + ' has gifted you a ticket to the show!', '', ticketBgColor, ticketTxtColor, 'bold'); cb.drawPanel(); } function giveAwayTicket(fromuser,touser) { cb.limitCam_addUsers([touser]); addViewer(touser); addTicketHolder(touser); cb.limitCam_removeUsers([fromuser]); removeViewer(fromuser); removeTicketHolder(fromuser); cb.sendNotice('Welcome ' + touser + ', ' + fromuser + ' has gifted you a ticket to the show!', '', ticketBgColor, ticketTxtColor, 'bold'); cb.drawPanel(); } function addRmvOutstandingTicket(mode,user) { switch (mode) { case 'add': { if (!cbjs.arrayContains(outstandingTicketArray,user)) { outstandingTicketArray.push(user); } populateOtChangesArray(user,'add'); break; } case 'rmv': { if (cbjs.arrayContains(outstandingTicketArray,user)) { cbjs.arrayRemove(outstandingTicketArray,user); } populateOtChangesArray(user,'rmv'); break; } } } function populateOtChangesArray(user,type) { if (cbjs.arrayContains(otChangesArray.name,user)) { index = otChangesArray.name.indexOf(user); if (otChangesArray.type[index] != type) { otChangesArray.name.push(user); otChangesArray.type.push(type); } else { return; } } else { otChangesArray.name.push(user); otChangesArray.type.push(type); } } function ticketShowGoalProgress(tipAmount) { ticketShowTotalTips = ticketShowTotalTips + tipAmount; ticketShowTotalTickets++; if (ticketStartMode === 'tokengoal' && ticketShowTotalTips >= ticketShowGoalTokens) { cb.sendNotice(dashLine80 + '\n :siren1 \u25B7 \u25B7 \u25B7 The ticket show Tip goal has been met!! u25C1 \u25C1 \u25C1 :siren1 \n \u25B7 \u25B7 \u25B7 Starting a 2 minute timer for automatic start of show! u25C1 \u25C1 \u25C1 \n' + dashLine80, '', ticketNoticesBgColor, ticketNoticesTxtColor, 'bold'); ticketStartMode = 'timer'; ticketAutoTimer(2); } else if (ticketStartMode === 'ticketgoal' && ticketShowTotalTickets >= ticketShowGoalTickets) { cb.sendNotice(dashLine80 + '\n :siren1 \u25B7 \u25B7 The ticket show Ticket goal has been met!! u25C1 \u25C1 :siren1 \n \u25B7 \u25B7 \u25B7 Starting a 2 minute timer for automatic start of show! u25C1 \u25C1 \u25C1 \n' + dashLine80, '', ticketNoticesBgColor, ticketNoticesTxtColor, 'bold'); ticketStartMode = 'timer'; ticketAutoTimer(2); } } function startTicketShow(startedby) { cb.sendNotice(dashLine60 + '\n :siren1 :siren1 :siren1 ' + startedby + ' has started the show! :siren1 :siren1 :siren1 \n' + dashLine60,'',ticketBgColor, ticketNoticesTxtColor, 'bold'); if (ticketShowFanAppreciation == 'Yes') { cb.limitCam_start('Hidden Show\n\nFan Club Appreciation Show. Join the Fanclub to unlock the screen!'); } else { cb.limitCam_start('Ticket Show\n\nHidden Cam show in progress. \nCheck room notices for ticket price'); } showStage = 'ticketshow'; changeRoomSubject(); if (ticketMinsRemain > 0 || ticketSecsRemain > 0) { stopTicketTimer(); } hiddenTime = Date.now(); if (freePreviewLength > 0) { previewMonitorTimer(); } cb.drawPanel(); } function restartTicketShow(startedby) { cb.sendNotice(dashLine80 + '\n :siren1 \u25C8 \u25C8 \u25C8 ' + startedby + ' has restarted the ticket show! \u25C8 \u25C8 \u25C8 :siren1 \n \u25C8 \u25C8 \u25C8 All current ticket holders still have access. \u25C8 \u25C8 \u25C8 \n \u25C8 \u25C8 \u25C8 Ticket sales are open, price is ' + ticketPrice + ' tokens. \u25C8 \u25C8 \u25C8 \n' + dashLine80,'',ticketBgColor, ticketNoticesTxtColor, 'bold'); if (ticketShowFanAppreciation == 'Yes') { cb.limitCam_start('Hidden Show\n\nFan Club Appreciation Show. Join the Fanclub to unlock the screen!'); } else { cb.limitCam_start('Ticket Show\n\nHidden Cam show in progress. \nCheck room notices for ticket price'); } if (showStage == 'aftershow') { ticketSubjectText = savedTicketSubjectText; } showStage = 'ticketshow'; changeRoomSubject(); ticketShowEnded = false; ticketSalesEnded = false; if (ticketMinsRemain > 0 || ticketSecsRemain > 0) { stopTicketTimer(); } hiddenTime = Date.now(); if (freePreviewLength > 0) { previewMonitorTimer(); } cb.drawPanel(); } function restartTicketSales(startedby) { if (showStage == 'aftershow') { cb.sendNotice(dashLine80 + '\n :siren1 ' + startedby + ' has restarted ticket sales! :siren1 \n * All current ticket holders still have access. \n * Ticket price is ' + ticketPrice + ' tokens. \n' + dashLine80,'',ticketBgColor, ticketNoticesTxtColor, 'bold'); showStage = 'ticketsales'; ticketSubjectText = savedTicketSubjectText; ticketShowEnded = false; } else if (showStage == 'showfinale') { cb.sendNotice(dashLine80 + '\n :siren1 ' + startedby + ' has restarted ticket sales! :siren1 \n * Ticket price is ' + ticketPrice + ' tokens. \n' + dashLine80,'',ticketBgColor, ticketNoticesTxtColor, 'bold'); showStage = 'ticketshow'; } ticketSalesEnded = false; changeRoomSubject(); cb.drawPanel(); } function warnShowEnding(by) { showStage = 'showwarn'; if (ticketShowFanAppreciation == 'Yes') { cb.sendNotice(dashLine90 + '\n :siren1 ' + by + ' has indicated the Fan Appreciation Show is nearly finished. :siren1 \n' + dashLine90,'',ticketBgColor,ticketNoticesTxtColor,'bold'); } else { if (ticketShowReducePriceWarn > 0) { ticketPrice = ticketPrice - ticketShowReducePriceWarn; cb.sendNotice(dashLine90 + '\n :siren1 \u25C8 \u25C8 \u25C8 ' + by + ' has indicated the show is nearly finished. \u25C8 \u25C8 \u25C8 :siren1 \n \u25C8 \u25C8 It is not recommended to buy a ticket, but sales are still open. \u25C8 \u25C8 \n \u25B7 \u25B7 \u25B7 \u25B7 \u25B7 The Ticket Price has been reduced to ' + ticketPrice + ' tokens! \u25C1 \u25C1 \u25C1 \u25C1 \u25C1 \n' + dashLine90,'',ticketBgColor,ticketNoticesTxtColor,'bold'); } else { cb.sendNotice(dashLine90 + '\n :siren1 \u25C8 \u25C8 \u25C8 ' + by + ' has indicated the show is nearly finished. \u25C8 \u25C8 \u25C8 :siren1 \n \u25C8 \u25C8 It is not recommended to buy a ticket, but sales are still open. \u25C8 \u25C8 \n' + dashLine90,'',ticketBgColor,ticketNoticesTxtColor,'bold'); } } changeRoomSubject(); cb.drawPanel(); } function stopTicketSales(stoppedby) { if (ticketShowFanAppreciation == 'Yes') { cb.sendNotice(dashLine90 + '\n :siren1 ' + stoppedby + ' has indicated the Fan Appreciation Show is nearly finished :siren1 \n' + dashLine90,'',ticketBgColor,ticketNoticesTxtColor,'bold'); } else { cb.sendNotice(dashLine70 + '\n :siren1 :siren1 :siren1 \u25B7 \u25B7 ' + stoppedby + ' has ended ticket sales. \u25C1 \u25C1 :siren1 :siren1 :siren1 \n' + dashLine70,'',ticketBgColor,ticketNoticesTxtColor,'bold'); } showStage = 'showfinale'; changeRoomSubject(); ticketSalesEnded = true; cb.drawPanel(); afterNoticeInt = 90000; setAfterNoticeTimeout(); } function stopTicketShow(stoppedby) { cb.sendNotice(dashLine60 + '\n :alert1 \u25C8 \u25C8 \u25C8 ' + stoppedby + ' has ended the show \u25C8 \u25C8 \u25C8 :alert1 \n \u25C8 \u25C8 \u25C8 \u25C8 Ticket Show length ' + ((Date.now() - hiddenTime)/60000).toFixed(2) + ' minutes. \u25C8 \u25C8 \u25C8 \u25C8 \n' + dashLine60,'',ticketBgColor,ticketNoticesTxtColor,'bold'); cb.limitCam_stop(); cb.sendNotice(dashLine70 + '\n :siren1 :siren1 :siren1 The broadcast is returning to Public Chat. :siren1 :siren1 :siren1 \n' + dashLine70, '',ticketBgColor,ticketNoticesTxtColor,'bold'); hiddenTime = 0; ticketShowEnded = true; ticketSalesEnded = true; showStage = 'aftershow'; savedTicketSubjectText = ticketSubjectText; ticketSubjectText = ticketShowAfterNotice; changeRoomSubject(); cb.drawPanel(); if (ticketShowOtToggle == 1) { if (otChangesArray.name.length > 0) { outString = ''; for (var i = 0; i < otChangesArray.name.length; i++) { if (otChangesArray.name[i] == null) { break } else { outString += (i > 0 ? ',' : '') + otChangesArray.name[i] + '(' + otChangesArray.type[i] + ')'; } } cb.sendNotice('Listing of Changes to the Outstanding Ticket List from this show : \n' + outString + '\nEnd of List', cb.room_slug, appNoticeColor); cb.sendNotice('Listing of Changes to the Outstanding Ticket List from this show : \n' + outString + '\nEnd of List', '', appNoticeColor, '', '', 'red'); } else { cb.sendNotice('No entries have been added to the Outstanding Ticket Changes list from this show.', cb.room_slug, appNoticeColor); } } if (countTicketsFromPreview > 0) { cb.sendNotice('Good news! ' + countTicketsFromPreview + ' viewers bought tickets from watching the free preview period.', cb.room_slug, appNoticeColor); } } function setAfterNoticeTimeout() { cb.setTimeout(afterNoticeTimer, afterNoticeInt); } function afterNoticeTimer() { if (showStage == 'showfinale') { cb.sendNotice(' :siren1 Ticket Sales Ended! Do not buy a ticket! :siren1 ','',ticketBgColor,ticketNoticesTxtColor,'bold'); setAfterNoticeTimeout(); } } function useTicket(user) { addRmvOutstandingTicket('rmv',user); cb.limitCam_addUsers([user]); addViewer(user); addTicketHolder(user); cb.sendNotice('Welcome ' + user + ', your Outstanding Ticket has been redeemed and you have been added to the show!', '', ticketBgColor, ticketTxtColor, 'bold'); cb.drawPanel(); } function saveTicket(user) { addRmvOutstandingTicket('add',user); cb.limitCam_removeUsers([user]); removeTicketHolder(user); removeViewer(user); cb.drawPanel(); } function sendPublicNotice (message, user, type) { if (message != null) { if (message != '' || message != ' ' || message != '\u00a0') { switch (type) { case 'div': cb.sendNotice(dashLine80 + '\n\u25ba ' + message.capitalize() + '\n' + dashLine80, '', '', ticketNoticesTxtColor, 'bold'); break; case 'divh': cb.sendNotice(dashLine80 + '\n\u25ba ' + message.capitalize() + '\n' + dashLine80, '', ticketBgColor,ticketNoticesTxtColor, 'bold'); break; case 'h': cb.sendNotice('\u25ba ' + message.capitalize(), '', ticketBgColor,ticketNoticesTxtColor, 'bold'); break; case '': cb.sendNotice('\u25ba ' + message.capitalize(), '', '', ticketNoticesTxtColor, 'bold'); break; } } else { cb.sendNotice('You cannot send a blank message. Type a message and try again.', user, appNoticeColor); } } else { cb.sendNotice('You cannot send a blank message. Type a message and try again.', user, appNoticeColor); } } function recordTip(tipAmount,tipBy,isFan,isExtFan,isVIP) { currentAppTotalTicket += tipAmount; if (ticketShowFanAppreciation != 'Yes') { if (!ticketShowEnded && !ticketSalesEnded && (!cb.limitCam_userHasAccess(tipBy) || cbjs.arrayContains(ticketShowPreViewerList,tipBy))) { if (isFan) { if (tipAmount >= ticketShowPriceFC) { addRmvTicket('addtip', tipBy, 'fan', tipAmount); } else { checkCumulative(tipBy,tipAmount,ticketShowPriceFC,'fan'); } } else if (isExtFan) { if (tipAmount >= ticketShowPriceEFC) { addRmvTicket('addtip', tipBy, 'fan', tipAmount); } else { checkCumulative(tipBy,tipAmount,ticketShowPriceEFC,'fan'); } } else if (isVIP) { if (tipAmount >= ticketShowPriceVIP) { addRmvTicket('addtip', tipBy, 'vip', tipAmount); } else { checkCumulative(tipBy,tipAmount,ticketShowPriceVIP,'vip'); } } else { if (tipAmount >= ticketPrice) { addRmvTicket('addtip', tipBy, 'common', tipAmount); } else { checkCumulative(tipBy,tipAmount,ticketPrice,'common'); } } } else if (!ticketShowEnded && !ticketSalesEnded && cb.limitCam_userHasAccess(tipBy) && ticketShowAllowGift == 'Yes') { if (tipAmount >= ticketPrice) { addRmvTicket('addextra', tipBy, 'common', tipAmount); } } ticketShowGoalProgress(tipAmount); } cb.drawPanel(); } function checkCumulative(tipBy,tipAmount,cumTktPrice,usertype){ if (ticketShowCumulative == 'Yes') { if (!cbjs.arrayContains(ticketCumulative.name, tipBy)) { ticketCumulative.name.push(tipBy); ticketCumulative.amount.push(tipAmount); } else { index = ticketCumulative.name.indexOf(tipBy); if (ticketCumulative.amount[index] + tipAmount >= cumTktPrice) { addRmvTicket('addtip', tipBy, usertype, tipAmount); ticketCumulative.amount[index] = 0; } else { ticketCumulative.amount[index] += tipAmount; } } } } function changeRoomSubject() { if (ticketShowFanAppreciation == 'Yes') { if (showStage == 'ticketsales') { newsubject = 'FANCLUB APPRECIATION SHOW STARTING SOON! JOIN FANCLUB TO SEE! ' + ticketSubjectText; } else if (showStage == 'ticketshow' || showStage == 'showwarn' || showStage == 'showfinale') { newsubject = 'FANCLUB APPRECIATION SHOW IN PROGRESS! JOIN FANCLUB TO SEE! ' + ticketSubjectText; } else if (showStage == 'aftershow') { newsubject = 'FANCLUB APPRECIATION SHOW HAS ENDED. THANK YOU FANS! ' + ticketSubjectText; } else { newsubject = 'FANCLUB APPRECIATION SHOW'; } } else { if (showStage == 'ticketsales') { newsubject = 'TICKET SHOW SALES [' + ticketPrice + ' tokens]: ' + ticketSubjectText; } else if (showStage == 'ticketshow') { newsubject = 'TICKET SHOW IN PROGRESS [' + ticketPrice + ' tokens]: ' + ticketSubjectText; } else if (showStage == 'showwarn') { newsubject = 'TICKET SHOW ENDING SOON [' + ticketPrice + ' tokens]: ' + ticketSubjectText; } else if (showStage == 'showfinale') { newsubject = 'TICKET SHOW SALES ENDED -- DO NOT BUY A TICKET!: ' + ticketSubjectText; } else if (showStage == 'aftershow') { newsubject = 'TICKET SHOW HAS ENDED: ' + ticketSubjectText; } else { newsubject = 'TICKET SHOW'; } } cb.changeRoomSubject(newsubject); } function customizePanelText(newcolor,sendto) { if (!newcolor && panelTextColor == 'Custom') { textcolorchk = checkTextColor(panelCustomTextColor); if (textcolorchk == 'default') { cb.sendNotice('Draw Panel Text Color - Error while setting the text color. It has to be in a HEX format.', sendto, appNoticeColor, ''); } else { textColor = textcolorchk; cb.drawPanel(); } } else if (newcolor) { textcolorchk = checkTextColor(newcolor); if (textcolorchk == 'default') { cb.sendNotice('Draw Panel Text Color - Error while setting the text color. It has to be in a HEX format.', sendto, appNoticeColor, ''); } else { textColor = textcolorchk; cb.drawPanel(); } } else { textColor = checkTextColor(panelTextColor); cb.drawPanel(); } } function customizePanelBackground(newbackground,sendto) { customPanel = false; if (cbjs.arrayContains(backgroundArray.command,newbackground)) { index = backgroundArray.command.indexOf(newbackground); if (cb.room_slug == 'dorothy') { backgroundImage = backgroundArray.devfile[index]; customPanel = true; currentPanel = newbackground; cb.drawPanel(); } else { menuname = backgroundArray.menu[index]; if (menuname.substring(0,12) == 'personalized') { if (newbackground == cb.room_slug) { backgroundImage = backgroundArray.livefile[index]; customPanel = true; currentPanel = newbackground; cb.drawPanel(); } else { cb.sendNotice('You have requested a personalized background, but you are not the room owner for that background, please choose again.', sendto, appNoticeColor, ''); } } else { backgroundImage = backgroundArray.livefile[index]; customPanel = true; currentPanel = newbackground; cb.drawPanel(); } } } else { cb.sendNotice('Invalid background name. The valid names are: \n' + cbjs.arrayJoin(backgroundArray.command, ', '), sendto, appNoticeColor, ''); } } // *********************************** Help Function ************************************** function helpCommon(option,from) { if(option == null){option = '';} cb.sendNotice('Dorothys Ticket Show App Help Menu - All Users', from, appNoticeColor); cb.sendNotice('',from,appNoticeColor); cb.sendNotice( 'Ticket Show Commands:' + '\n/tickets : Display the list of users that have bought a ticket. If the parameter of "alpha" is added, the list is displayed alphabetically. Note that viewers can be added back to the show using the "/add" command and pasting the list that is shown from the "/tickets" command. ' + '\n/previewers : Display the list of users that are currently viewing a free preview. If the parameter of "alpha" is added, the list is displayed alphabetically. ' + '\n/otlist : Display the list of outstanding ticket holders, can be used by anyone if the Outstanding Ticket feature is enabled.' + '\n/saveticket: If the broadcaster has enabled Outstanding Tickets (and is tracking them) - If you have bought a ticket and will not be able to stay for the show, you can save it for a future show. You will no longer be able to see the current show. IMPORTANT: If in the same session, the ticket will be available automatically. However for future shows or if the broadcaster restarts the bot, the broadcaster must add the saved tickets to the outstanding ticket list to be able to use them with /useticket. ' + '\n/useticket: If the broadcaster has enabled Outstanding Tickets (and is tracking them) - Redeem an outstanding ticket and use it for access to this show. You can use the command "/otlist" to view the list of outstanding ticket holders if the broadcaster has enabled this feature.' + '\n/tickettimeleft: Display the time left on the ticket show countdown for either automatic or manual starting mode.' + '\n/showtime: Display a message showing how long the current show has been hidden.' + '\n/givemyticketto [username]: (all ticket buyers) If you cannot stay for a show, and outstanding ticket feature is no used to allow saving your ticket, you can give your ticket to another user. This can only be done before the show starts, and you will be removed from the ticket show list!' + '\n/giftticket [username]: If the "gifting" feature is enabled, when you tip enough to buy extra tickets, you can gift those tickets to other users using this command. Each time you gift, it removes one of your "extra" tickets. You can only gift extra tickets with this command, to give away your own ticket, you can use /givemyticketto as noted below. Be sure to type the user name correctly for the person you are gifting to, extra tickets cannot be recovered once they are gifted. This can be done before and during the show.' ,from); cb.sendNotice('',from,appNoticeColor); } function helpModBC(option,from) { var valid = 0; if(option == null) {option = '';} switch(option) { case '': { valid = 1; cb.sendNotice('Dorothys Ticket Show App Help Menu - Moderators and Broadcasters', from, appNoticeColor); cb.sendNotice('',from,appNoticeColor); cb.sendNotice( 'Ticket Show Commands:' + '\n/tickets : (all users) Display the list of users that have bought a ticket. If the parameter of "alpha" is added, the list is displayed alphabetically. Note that viewers can be added back to the show using the /add command and pasting the list that is shown from the /tickets command. ' + '\n/previewers : (all users) Display the list of users that are currently viewing in their free preview period.' + '\n/useot [on/off]: (mods/bc only) Toggle the setting for whether the Outstanding Ticket feature of the Ticket Show is "on" or "off". Overrides the initial setting, and allows you to turn the Outstanding Ticket usage feature on or off during the show. .' + '\n/otlist : (all users) Display the list of outstanding ticket holders, can be used by anyone if the Outstanding Ticket feature is enabled.' + '\n/otchanges : (mods/bc only) ** IMPORTANT when using the OT feature ** Displays a list of tickets that have been saved or used during the current session so the permanent list can be updated.' + '\n/saveticket: (all ticket buyers) If the broadcaster has enabled Outstanding Tickets (and is tracking them) - If you have bought a ticket and will not be able to stay for the show, you can save it for a future show. You will no longer be able to see the current show. IMPORTANT: If in the same session, the ticket will be available automatically. However for future shows or if the broadcaster restarts the bot, the broadcaster must add the saved tickets to the outstanding ticket list to be able to use them with /useticket. ' + '\n/useticket: (all users with an outstanding ticket) If the broadcaster has enabled Outstanding Tickets (and is tracking them) - Redeem an outstanding ticket and use it for access to this show. You can use the command /otlist to view the list of outstanding ticket holders if the broadcaster has enabled this feature.' + '\n/addot : (mods, bc if granted privileges) If the outstanding ticket feature is in use, the broadcaster can manually give a user an outstanding ticket. Moderators can also add if they have authority. The addition still must be made permanent by updating the launch page outstanding ticket list.' + '\n/rmvot : (mods/bc only) Remove a user from the outstanding ticket list within the current show. The removal still must be made permanent by updating the launch page outstanding ticket list.' + '\n/add or (/addticket) [user]: (bc only, moderator when granted privileges) Manually add a user to the ticket show list. Can be a specific user or a list of users separated by a comma.' + '\n/rmv (or /rmvticket or /del or /delticket) [user]: (mods/bc only) Manually remove a specific user from the ticket show list, only used for one user at a time. ' + '\n/startshow: (mods/bc only) Start the ticket show when not set to automatic start. Once started, the show will only be visible to ticket holders. Hint: start the show when you are in a good position for the preview pic to be frozen that will attract more ticket buyers.' + '\n/showwarn (or /showover): (mods/bc only) Display a warning that the show will be ending soon and ticket purchases are allowed but not recommended. If configured, this can also end the positions menu, and reduce the ticket price. ' + '\n/showend (or /stopsales): (mods/bc only) Suspend ticket sales, no more automatic ticket purchases can be made. Recommended to always do this once you are less than a few minutes from the end of the show so people do not buy at the last second and are disappointed by getting a short show. If configured, this can also end the positions menu, and reduce the ticket price.' + '\n/stopshow: (mods/bc only) End the hidden show and return to a public broadcast.' + '\n/newticketshow: (mods/bc only) Completely refresh the ticket show to start a brand new show. This will remove all the ticket holders from the list, and re-initialize all settings using the configuration from the launch page.' + '\n/restartshow: (mods/bc only) Go back into hidden cam mode if the show was accidentally ended too soon, or the broadcaster wanted to go back to public to sell more tickets. The ticket holder list and all settings are kept intact.' + '\n/restartsales: (mods/bc only) Restart ticket sales either during the show (after /showend was used), or after you\'ve ended the show to go back to the ticket sales stage. The ticket holder list, ticket price and show description are kept intact.' + '\n/ticketprice (or /ctprice, or /chgticketprice) [newprice]: (mods/bc only) Update the ticket price to the [newprice].' + '\n/starttimer (or /ticketstarttimer, or /starttickettimer) [time]: (mods/bc only) Start a [time] minute timer for the raffle drawing when in "timer" mode with the drawing to be triggered by the /raffledrawing command. The timer will count down but not automatically perform the drawing (unless set to automatic mode but the auto-timer was ended, and this is a restart of that timer)' + '\n/addtime (or /ticketaddtime, or /addtickettime) [time]: (mods/bc only) Add [time] minutes to the timer for either automatic or manual drawing mode. The [time] value can be a negative number to subtract time, but cannot be greater than the remaining time.' + '\n/stoptimer (or /ticketstoptimer, or /stoptickettimer): (mods/bc only) Stop the raffle timer for either automatic or manual drawing mode.' + '\n/tickettimeleft : (mods/bc only) Display the time left on the ticket show countdown for either automatic or manual starting mode.' + '\n/showtime : (all users) Display a message showing how long the current show has been hidden.' + '\n/chgticketmode [manual/timer/ticketgoal/tokengoal]: (mods/bc only) Switch between the modes being used to determine when to start the ticket show. If switching from a timer show to a non-timer show, the timer will be ended. Ticket count and Tip Count are being tracked regardless of mode, so switching to a "goal" mode should not require starting progress at 0.' + '\n/chgticketmodeauto [auto/bc]: (mods/bc only) Switch between the modes being used to define if the show starts automatically when a goal is reached or timer expires, or if the broadcaster or mods still control the start of the show. ' + '\n/giftticket [user]: (all users, once you have extra tickets) If the "gifting" feature is enabled, when you tip enough to buy extra tickets, you can gift those tickets to other users using this command. Each time you gift, it removes one of your "extra" tickets. You can only gift extra tickets with this command, to give away your own ticket, you can use /givemyticketto as noted below. Be sure to type the user name correctly for the person you are gifting to, extra tickets cannot be recovered once they are gifted. This can be done before and during the show.' + '\n/givemyticketto [user]: (all ticket buyers) If you cannot stay for a show, and outstanding ticket feature is no used to allow saving your ticket, you can give your ticket to another user. This can only be done before the show starts, and you will be removed from the ticket show list!' + '\n/ticketsubject (or /ctsubject) [newsubject]: (mods/bc only) Change the room description/subject/title to a new value. This keeps the standard ticket show formatting and only changes the configurable part of the subject.' + '\n/addlbtop [X]: (bc/mods - Fembot command) Add the top [X] number of tippers for the current session to the ticket show. Moderators may only use this if allowed per configuration. Note this command is actually being executed in the Fembot, so the Ultra Fembot must be running to make use of it. The /add command is executed, which will add them to the show if the user executing them has authority to the /add command' + '\n/addlbamt [X]: (bc/mods - Fembot command) Add tippers who have tipped at least [X] number of tokens for the current session to the ticket show. Moderators may only use this if allowed per configuration. Note this command is actually being executed in the Fembot, so the Ultra Fembot must be running to make use of it. The /add command is executed, which will add them to the show if the user executing them has authority to the /add command' + '\n/ctn: (bc/mods) Post a one-time notice in the chat. The syntax for using this type of notice is "/cn [X]", where [X] is the message you want to send. This is the plain notification without any separators or highlighting.' + '\n/ctnd: (bc/mods) Post a one-time notice in the chat. The syntax for using this type of notice is "/cnd [X]", where [X] is the message you want to send. This notification includes a dash separator before and after the message, but no highlighting.' + '\n/ctnh: (bc/mods) Post a one-time notice in the chat. The syntax for using this type of notice is "/cnh [X]", where [X] is the message you want to send. This notification includes highlighting, but no separators.' + '\n/ctndh: (bc/mods) Post a one-time notice in the chat. The syntax for using this type of notice is "/cndh [X]", where [X] is the message you want to send. This notification includes both separators and highlighting.' + '\n/chgpanelbg [imagename]: Change the background of the drawpanel to one of the valid images. Images are updated regularly, so you can see the current list by entering this command with no parameter and the error message will show the current valid choices. Note that you can also see the images by going to the "Source Code" tab for the app and clicking the link for "App Images".' + '\n/chgpaneltext [newcolor]: Change the color of the text in the drawpanel to either a hex code (#0000ff) or the exact text of one of the color choices from the menu ("Dark Green", "Dark Red", etc). You can lookup hex codes for any color on a site such as Color-hexa: https://www.colorhexa.com/' + '\n/addfan [user]: (bc only) Adds a user to the External Fan Club list where [user] is the person you want to add.' + '\n/rmvfan [user]: (bc only) Removes a user from the External Fan Club List where [user] is the person you want to remove.' + '\n/fanlist: (mods/bc only) Displays the list of users currently in the External Fan Club list.' + '\n/addvip [user]: (bc only) Adds a user to the VIP list where [user] is the person you want to add.' + '\n/rmvvip [user]: (bc only) Removes a user from the VIP List where [user] is the person you want to remove.' + '\n/viplist: (mods/bc only) Displays the list of users currently in the VIP list.' + '\n/addmod [username]: (bc only) Add users to the "Bot Mod" Moderator List.' + '\n/rmvmod [username]: (bc only) Remove users from the "Bot Mod" Moderator List.' + '\n/modlist: (mods/bc only) Displays the list of users currently in the Moderator list (list will include bot mods, broadcaster and CB mods).' ,from); cb.sendNotice('',from,appNoticeColor); break; } } } } } // ******************************* Upon user entry of a Message ************************************** { cb.onMessage(function (msg) { var message = msg['m'].split(' '); var cmd = 0; var symbolString = '~`!@#$%^&*()_-+={[}]|\\:;"\'<,>.?/'; var listRegExp = /[,\s]+/; var listRegExpSpc = /[,]+/; var m = msg.m; var u = msg.user; var isMod = msg.is_mod; var isFan = msg.in_fanclub; var isExtFan = cbjs.arrayContains(extFanListArray,u); var isVIP = cbjs.arrayContains(VIPListArray,u); var isBC = (u === cb.room_slug); var BC = cb.room_slug; var command = message[0] var commandVar1 = parseInt(message[1]); var commandVar2 = parseInt(message[2]); var commandVar3 = parseInt(message[3]); isBotMod = false; if (isMod) { populateModeratorArray(u,'cbmod','a'); } else { if (cbjs.arrayContains(moderatorList.name,u)) { nameIndex = moderatorList.name.indexOf(u); if (moderatorList.type[nameIndex] == 'botmod') { isBotMod = true; isMod = true; } } } if (isMod) { addRmvModsInShow(u,'a'); } if (isFan) { populateFanClubArray(u); } if (isVIP) { addRmvVIPInShow(u,'a'); } if (isExtFan) { addRmvExtFanInShow(u,'a'); } if (isMod || isFan || isExtFan || isVIP) { checkFreeTickets(u,isMod,isFan,isExtFan,isVIP); } if(message[0].charAt(0) == '/') { msg['X-Spam'] = true; var ntc = null; for (var i = 1; i < message.length; i++) { if (i == 1) ntc = message[i]; else ntc += ' ' + message[i]; } var ntc2 = null; for (var i = 2; i < message.length; i++) { if (i == 2) ntc2 = message[i]; else ntc2 += ' ' + message[i]; } var cmdval = null; for (var i = 1; i < message.length; i++) { if (i == 1) cmdval = message[i]; else cmdval += ' ' + message[i]; } switch(command) { //********* General App Commands case '/chgpanelbg': { cmd = 1; if (isBC || (isMod && allowModsAuthority == 'Yes')) { if (message[1]) { newBg = message[1].toLowerCase(); customizePanelBackground(newBg,u); cb.drawPanel(); } else { cb.sendNotice('The /chgpanelbg command requires the entry of a parameter following the command, such as "/chgpanelbg lavalamp". The valid formats are: \n' + cbjs.arrayJoin(backgroundArray.command, ', '), u, appNoticeColor); } } else { cb.sendNotice('Only broadcasters and moderators with sufficient authority are able to use that command.', u, appNoticeColor); } break; } case '/chgpaneltext': { cmd = 1; if (isBC || (isMod && allowModsAuthority == 'Yes')) { newcolor = msg['m'].substring(14).trim(); if (newcolor) { customizePanelText(newcolor,u); cb.drawPanel(); } else { cb.sendNotice('The /chgpaneltext command requires the entry of a parameter following the command, which represents either the color name or the color hex code, such as "/chgpaneltext blue" or "/chgpaneltext #0000ff".' , u, appNoticeColor); } } else { cb.sendNotice('Only broadcasters and moderators with sufficient authority are able to use that command.', u, appNoticeColor); } break; } case '/stats': { cmd = 1; if (isBC || (isMod && allowModsAuthority == 'Yes')) { cb.sendNotice('Current Session Stats:' + '\n \u21D2 Total Tips..................... ' + currentAppTotalTicket + ' tokens ($' + Number(currentAppTotalTicket*.05).toFixed(2) + ' @ 5 cents per token)' + '\n \u21D2 Total Tickets Sold................ ' + countTickets + ' tickets' + '\n \u21D2 Tickets Sold From Preview.. ' + countTicketsFromPreview + ' tickets', u, appNoticeColor, '', 'bold'); } else { cb.sendNotice('Only broadcasters and moderators with sufficient authority are able to use that command.', u, appNoticeColor); } break; } //********* Hidden Ticket Show Commands case '/tickets': { cmd = 1; if (ticketHolderList.length > 0) { if (message[1] == 'a' || message[1] == 'A' || message[1] == 'alpha') { var sortedticketlist = ticketHolderList.slice(); sortedticketlist.sort(); cb.sendNotice('Alphabetic listing of users currently with access to the Hidden Ticket Show (' + countTickets + ' ticket holders) :\n' + cbjs.arrayJoin(sortedticketlist, ', ') + '\nEnd of List', u, appNoticeColor); } else { cb.sendNotice('Users currently with access to the Hidden Ticket Show, in order of when added (' + countTickets + ' ticket holders). Use the "alpha" parameter for a sorted list : \n' + cbjs.arrayJoin(ticketHolderList, ', ') + '\nEnd of List', u, appNoticeColor); } } else { cb.sendNotice('No ticket holders yet.', u, appNoticeColor); } break; } case '/previewers': { cmd = 1; if (freePreviewLength > 0) { if (ticketShowPreViewerList.length > 0) { if (message[1] == 'a' || message[1] == 'A' || message[1] == 'alpha') { var sortedpvlist = ticketShowPreViewerList.slice(); sortedpvlist.sort(); cb.sendNotice('Alphabetic listing of users currently seeing a free preview of the Ticket Show (' + sortedpvlist.length + ' previewers) : \n' + cbjs.arrayJoin(sortedpvlist, ', ') + '\nEnd of List', u, appNoticeColor); } else { cb.sendNotice('Users currently seeing a free preview of the Ticket Show, in order of when added (' + ticketShowPreViewerList.length + ' previewers). Use the "alpha" parameter for a sorted list : \n' + cbjs.arrayJoin(ticketShowPreViewerList, ', ') + '\nEnd of List', u, appNoticeColor); } } else { cb.sendNotice('No free preview viewers at this time.', u, appNoticeColor); } } else { cb.sendNotice('The Free Preview is disabled.', u, appNoticeColor); } break; } case '/useot': { cmd = 1; if (isBC || (isMod && allowModsAuthority == 'Yes')) { if(message[1] != null && message[1] != 'on' && message[1] != 'off') { cb.sendNotice('The value ' + message[1] + ' is not a valid option for /useot, please try again.', u, appNoticeColor); } else if(message[1] == null) { cb.sendNotice('You did not enter a valid option for /useot, please try again.', u, appNoticeColor); } else { setTicketShowOtToggle(message[1], u); } } else { cb.sendNotice('Only broadcasters and moderators with sufficient authority are able to use that command.', u, appNoticeColor); } break; } case '/otlist': { cmd = 1; if (ticketShowOtToggle == 1) { cb.sendNotice('Users currently on the Outstanding Ticket List: ' + outstandingTicketArray.length, u, appNoticeColor); cb.sendNotice((outstandingTicketArray.length > 0 == true ? cbjs.arrayJoin(outstandingTicketArray, ', ') : 'No outstanding ticket holders.'), u); cb.sendNotice('End of List', u, appNoticeColor); } else { cb.sendNotice('The Ticket Show Outstanding Ticket feature is disabled.', u, appNoticeColor); } break; } case '/otchanges': { cmd = 1; if (isBC || (isMod && allowModsAuthority == 'Yes')) { if (otChangesArray.name.length > 0) { cb.sendNotice('Listing of Changes to the Outstanding Ticket List : ', u, appNoticeColor); outString = ''; for (var i = 0; i < otChangesArray.name.length; i++) { if (otChangesArray.name[i] == null) { break } else { outString += (i > 0 ? ',' : '') + otChangesArray.name[i] + '(' + otChangesArray.type[i] + ')'; } } cb.sendNotice(outString, u); cb.sendNotice('End of List', u, appNoticeColor); } else { cb.sendNotice('No entries have been added to the Outstanding Ticket Change list.', u, appNoticeColor); } } else { cb.sendNotice('Only broadcasters and moderators are able to use that command.', u, appNoticeColor); } break; } case '/ctprice': case '/chgticketprice': case '/ticketprice': { cmd = 1; if (isBC || (isMod && ticketShowModsChgPrice == 'Yes')) { if (message[1]) { numprice = parseInt(message[1]) if (isNaN(numprice)) { cb.sendNotice('The value entered for the ticket price is not numeric, please try again.', u, appNoticeColor); break; } else if (numprice < 1 || numprice > 99999) { cb.sendNotice('The value entered for the ticket price is outside allowable values from 1 to 99999, please try again.', u, appNoticeColor); } else { setTicketPrice(numprice,'yes'); cb.sendNotice('The Hidden Ticket Show price has been updated to ' + numprice + ' tokens, all tips of at least this amount will add a user to the Ticket Show List. You can view the ticket list with the command "/tickets".', u, appNoticeColor); } } else { cb.sendNotice('No parameter was specified for the new ticket price.', u, appNoticeColor); } } else { cb.sendNotice('Only broadcasters and moderators with sufficient authority are able to use that command.', u, appNoticeColor); } break; } case '/starttickettimer': case '/ticketstarttimer': case '/starttimer': { cmd = 1; if (isBC || (isMod && allowModsAuthority == 'Yes')) { if (message[1]) { numtimer = parseInt(message[1]) if(isNaN(numtimer)) { cb.sendNotice('The value entered for the minutes to use for the timer is not numeric, please try again.', u, appNoticeColor); break; } else if(numtimer < 1 || numtimer > 60) { cb.sendNotice('The value entered for the minutes to use for the ticket show timer is outside allowable values from 1 to 60 minutes, please try again.', u, appNoticeColor); } else { startTicketShowTimer(numtimer); } } else { cb.sendNotice('No parameter was specified for the number of minutes to use for the timer.', u, appNoticeColor); } } else { cb.sendNotice('Only broadcasters and moderators with sufficient authority are able to use that command.', u, appNoticeColor); } break; } case '/addtickettime': case '/ticketaddtime': case '/addtime': { cmd = 1; if (isBC || (isMod && allowModsAuthority == 'Yes')) { if (ticketMinsRemain > 0 || ticketSecsRemain > 0) { if (message[1]) { numtimer = parseInt(message[1]) if (isNaN(numtimer)) { cb.sendNotice('The value entered for the minutes to add to the ticket show start timer is not numeric, please try again.', u, appNoticeColor); } else if (numtimer < -60 || numtimer > 60) { cb.sendNotice('The value entered for the minutes to add to the ticket show start timer is outside allowable values from -60 to 60, please try again. Negative numbers can be used to subtract time.', u, appNoticeColor); } else if (numtimer == 0) { cb.sendNotice('Cannot add zero time.', u, appNoticeColor); } else if (numtimer < 0 && Math.abs(numtimer) > ticketMinsRemain) { cb.sendNotice('The value entered for the minutes to subtract is greater than the remaining time on the timer, please try again. Negative numbers can be used to subtract time.', u, appNoticeColor); } else if (numtimer > 0 && (Math.abs(numtimer) + ticketMinsRemain) > 60) { cb.sendNotice('The value entered for the minutes to add would exceed the maximum countdown time of 60 minutes when added to the current time left.', u, appNoticeColor); } else { ticketAddTime(numtimer, u); } } else { cb.sendNotice('No parameter was specified for the number of minutes to add to the timer.', u, appNoticeColor); } } else { cb.sendNotice('A timer has not been started yet for the ticket show countdown.', u, appNoticeColor); } } else { cb.sendNotice('Only broadcasters and moderators with sufficient authority are able to use that command.', u, appNoticeColor); } break; } case '/ticketstoptime': case '/ticketstoptimer': case '/stoptimer': { cmd = 1; if (isBC || (isMod && allowModsAuthority == 'Yes')) { if (ticketMinsRemain > 0 || ticketSecsRemain > 0) { stopTicketTimer(u); } else { cb.sendNotice('A ticket timer is not currently running.', u, appNoticeColor); } } else { cb.sendNotice('Only broadcasters and moderators are able to use that command.', u, appNoticeColor); } break; } case '/add': case '/addticket': { cmd = 1; if (isBC || (isMod && ticketShowModsAdd == 'Yes')) { if (cmdval != null) { var cmdvalsplit = cmdval.split(listRegExp); if (cmdvalsplit.length > 1) { cb.sendNotice('Adding multiple users to the ticket show list.', u, appNoticeColor); for (var i = 0; i < cmdvalsplit.length; i++) { if (cmdvalsplit[i]) { nametoadd = cmdvalsplit[i].toLowerCase(); if (!cb.limitCam_userHasAccess(nametoadd)) { addRmvTicket('add',nametoadd); cb.sendNotice('Added ' + nametoadd + ' to the ticket show list.', u); cb.sendNotice(u + ' has added you to the ticket show list.', nametoadd, appNoticeColor); } else { cb.sendNotice(nametoadd + ' is already on the ticket show list. Skipping.', u); } } else { cb.sendNotice('Skipping null entry.', u); } } cb.sendNotice('All users were added and notified.', u, appNoticeColor) cb.sendNotice(u + ' has added multiple users to the ticket show list.\n' + 'Users added: ' + cbjs.arrayJoin(cmdvalsplit, ', '), '', appNoticeColor, '', 'normal', 'red'); } else { nametoadd = message[1].toLowerCase(); if (!cb.limitCam_userHasAccess(nametoadd)) { addRmvTicket('add',nametoadd); } else { cb.sendNotice('Note: User ' + nametoadd + ' is already in the Ticket Show List.', u, appNoticeColor); } } } else { if (!cb.limitCam_userHasAccess(u)) { addRmvTicket('add', u); } else { cb.sendNotice('Note: User ' + u + ' is already in the Ticket Show List.', u, appNoticeColor); } } } else { cb.sendNotice('You do not have authority to use the /add command.', u, appNoticeColor); } break; } case '/rmv': case '/del': case '/delticket': case '/rmvticket': { cmd = 1; if (isBC || (isMod && ticketShowModsAdd == 'Yes')) { if (message[1]) { nametormv = message[1].toLowerCase(); if (cb.limitCam_userHasAccess(nametormv)) { addRmvTicket('rmv',nametormv); } else { cb.sendNotice('Note: User is not in the Ticket Show List.', u, appNoticeColor); } } else { cb.sendNotice('No user was specified for the /rmv command.', u, appNoticeColor); } } else { cb.sendNotice('You do not have authority to use the /rmv command.', u, appNoticeColor); } break; } case '/giftticket': { cmd = 1; if (ticketShowFanAppreciation != 'Yes') { if (ticketShowAllowGift == 'Yes') { if (cbjs.arrayContains(ticketShowExtraTickets.name,u)) { index = ticketShowExtraTickets.name.indexOf(u); if (ticketShowExtraTickets.count[index] > 0) { giftTicket(u,message[1]); ticketShowExtraTickets.count[index]--; cb.sendNotice('You have gifted a ticket to ' + message[1] + '. Thank you for your generosity.', u, appNoticeColor, '', 'bold'); cb.sendNotice('Moderators: ' + u + ' has gifted a ticket to ' + message[1] + '.', '', appNoticeColor, '', '', 'red'); cb.sendNotice('Broadcaster: ' + u + ' has gifted a ticket to ' + message[1] + '.', BC, appNoticeColor); } else { cb.sendNotice('Sorry, you do not have any extra tickets remaining.', u, appNoticeColor); } } else { cb.sendNotice('Sorry, you have not purchased any extra tickets.', u, appNoticeColor); } } else { cb.sendNotice('Sorry, the broadcaster has not enabled the use of gifting tickets for this show.', u, appNoticeColor); } } else { cb.sendNotice('Tickets cannot be gifted for a Fan Appreciation show.', u, appNoticeColor); } break; } case '/giftmyticketto': case '/givemyticketto': { cmd = 1; if (ticketShowFanAppreciation != 'Yes') { if (ticketShowAllowGift == 'Yes') { if (cb.limitCam_userHasAccess(u) && showStage == 'ticketsales') { giveAwayTicket(u,message[1]); cb.sendNotice('You have gifted your ticket to ' + message[1] + '. You will now be removed from the show. Thank you for your generosity.',u,appNoticeColor,'','bold'); cb.sendNotice('Mods: ' + u + ' has gifted their own ticket to ' + message[1] + '.', '', appNoticeColor, '', '', 'red'); cb.sendNotice('Broadcaster: ' + u + ' has gifted their own ticket to ' + message[1] + '.', BC, appNoticeColor); } else { cb.sendNotice('Sorry, you do not have a ticket purchased or the show has already started.', u, appNoticeColor); } } else { cb.sendNotice('Sorry, the broadcaster has not enabled the gifting of tickets for this show.', u, appNoticeColor); } } else { cb.sendNotice('Tickets cannot be gifted for a Fan Appreciation show.', u, appNoticeColor); } break; } case '/chgtktmode': case '/chgticketmode': { cmd = 1; if (isBC || (isMod && allowModsAuthority == 'Yes')) { if (message[1]) { newTicketMode = message[1].toLowerCase(); if (newTicketMode != 'manual' && newTicketMode != 'timer' && newTicketMode != 'ticketgoal' && newTicketMode != 'tokengoal') { cb.sendNotice('The value entered for the new mode is not valid, please try again using a value of "manual", "timer", "ticketgoal", or "tokengoal".', u, appNoticeColor); } else { if (newTicketMode == ticketStartMode) { cb.sendNotice('The value entered for the new mode is the same as the existing mode, command ignored.', u, appNoticeColor); } else { setTicketMode(newTicketMode,u); cb.sendNotice(ticketModeMessage, '', ticketBgColor, ticketTxtColor, 'bold'); cb.drawPanel(); } } } else { cb.sendNotice('No parameter was specified for the new ticket show start mode. Valid values are "manual", "timer", "ticketgoal", or "tokengoal".', u, appNoticeColor); } } else { cb.sendNotice('Only broadcasters and moderators with sufficient authority are able to use that command.', u, appNoticeColor); } break; } case '/chgtktauto': case '/chgticketauto': { cmd = 1; if (isBC || (isMod && allowModsAuthority == 'Yes')) { if (message[1]) { newTicketAuto = message[1].toLowerCase(); if (newTicketAuto != 'bc' && newTicketAuto != 'auto') { cb.sendNotice('The value entered for the new mode is not valid, please try again using a value of "bc" or "auto" (broadcaster command or automatic start).', u, appNoticeColor); } else if (newTicketAuto == 'auto' && ticketStartMode == 'manual') { cb.sendNotice('The mode cannot be changed to "auto" unless there is a goal or timer being used to define when the show will start. Show is currently to be started at broadcaster discretion.', u, appNoticeColor); } else if (newTicketAuto == ticketModeAuto) { cb.sendNotice('The value entered for the new mode is the same as the existing mode, command ignored.', u, appNoticeColor); } else { setTicketAuto(newTicketAuto); cb.sendNotice(ticketModeMessage, '', ticketBgColor, ticketTxtColor, 'bold'); cb.drawPanel(); } } else { cb.sendNotice('No parameter was specified for the new autostart mode. Valid values are "bc" or "auto" (broadcaster command or automatic start).', u, appNoticeColor); } } else { cb.sendNotice('Only broadcasters and moderators with sufficient authority are able to use that command.', u, appNoticeColor); } break; } case '/tickettimeleft': { cmd = 1; if (ticketMinsRemain >= 1 || ticketSecsRemain >= 1) { cb.sendNotice(ticketTimeLeft(), '', appNoticeColor, '', 'bold'); } else { cb.sendNotice('A Hidden Ticket Show timer is not running.', u, appNoticeColor); } break; } case '/showtime': { cmd = 1; if (cb.limitCam_isRunning()) { cb.sendNotice(' \u25B7 \u25B7 \u25B7 Hidden Ticket Show in progress for ' + ((Date.now() - hiddenTime)/60000).toFixed(1) + ' minutes. \u25C1 \u25C1 \u25C1 ', u, ticketBgColor,ticketTxtColor,'bold'); } else { cb.sendNotice('The ticket show is not running, it has not yet started or already finished.', u, appNoticeColor); } break; } case '/useticket': { cmd = 1; if (ticketShowFanAppreciation != 'Yes') { if (ticketShowOtToggle == 1) { if (cb.limitCam_userHasAccess(u)) { cb.sendNotice('You already have a ticket to the show.', u, appNoticeColor); } else { if (cbjs.arrayContains(outstandingTicketArray,u)) { useTicket(u); cb.sendNotice('Broadcaster: ' + u + ' has used their Outstanding Ticket to join this show. They should be removed from the permanent OT list on the bot start page.', BC, appNoticeColor); cb.sendNotice('Mods: ' + u + ' has used their Outstanding Ticket. The broadcaster has been notified to remove them from the permanent OT list on the bot start page.', '', appNoticeColor, '', '', 'red'); } else { cb.sendNotice('Sorry, you do not have an outstanding ticket available.', u, appNoticeColor); } } } else { cb.sendNotice('Sorry, the broadcaster has not enabled the use of outstanding tickets for this show.', u, appNoticeColor); } } else { cb.sendNotice('Outstanding Ticket features are not enabled for a Fan Appreciation Show.', u, appNoticeColor); } break; } case '/saveticket': { cmd = 1; if (ticketShowFanAppreciation != 'Yes') { if (ticketShowOtToggle == 1) { if (cb.limitCam_userHasAccess(u) && showStage === 'ticketsales') { saveTicket(u); cb.sendNotice('Your ticket from this show has been saved and you have been removed from the ticket list for this show.', u, appNoticeColor, '', 'bold'); cb.sendNotice('Broadcaster: ' + u + ' has saved their ticket from this show to the Outstanding Ticket list. They should be added to the permanent OT list on the bot start page upon next restart.', BC, appNoticeColor); cb.sendNotice('Mods: ' + u + ' has saved their ticket from this show to the Outstanding Ticket list. The broadcaster has been notified to add them to the permanent OT list on the bot start page.', '', appNoticeColor, '', '', 'red'); } else { cb.sendNotice('Sorry, you have no ticket purchase to save, or the show has already started.', u, appNoticeColor); } } else { cb.sendNotice('Sorry, the broadcaster has not enabled the ability to save an outstanding tickets for this show.', u, appNoticeColor); } } else { cb.sendNotice('Outstanding Ticket features are not enabled for a Fan Appreciation Show.', u, appNoticeColor); } break; } case '/addot': { cmd = 1; if (ticketShowOtToggle == 1) { if (isBC || (isMod && ticketShowModsAdd == 'Yes')) { if(message[1] != '' && message[1] != null) { if (!cbjs.arrayContains(outstandingTicketArray,message[1])) { addRmvOutstandingTicket('add', message[1]); cb.sendNotice('User ' + message[1] + ' has been added to the Outstanding Ticket List.', u, appNoticeColor); } else { cb.sendNotice('Cannot add, user is already in the Outstanding Ticket List.', u, appNoticeColor); } } } } else { cb.sendNotice('Sorry, the Outstanding Ticket list feature is disabled. It can be enabled with the command "/useot on".', u, appNoticeColor); } break; } case '/rmvot': { cmd = 1; if (ticketShowOtToggle == 1) { if (isBC || (isMod && ticketShowModsAdd === 'Yes')) { if(message[1] != '' && message[1] != null) { if (cbjs.arrayContains(outstandingTicketArray,message[1])) { addRmvOutstandingTicket('rmv', message[1]); cb.sendNotice('User ' + message[1] + ' has been removed from the Outstanding Ticket List.', u, appNoticeColor); } else { cb.sendNotice('Cannot remove, user is not in the Outstanding Ticket List.', u, appNoticeColor); } } } } else { cb.sendNotice('Sorry, the Outstanding Ticket list feature is disabled. It can be enabled with the command "/useot on".', u, appNoticeColor); } break; } case '/startshow': { cmd = 1; if (isBC || (isMod && allowModsAuthority == 'Yes')) { if (!cb.limitCam_isRunning() && ticketShowEnded === false) { startTicketShow(u); } else if (!cb.limitCam_isRunning() && ticketShowEnded === true) { cb.sendNotice('The Hidden Cam show was already started and stopped, please use the command "/restartshow" to resume the hidden show.', u, appNoticeColor); } else { cb.sendNotice('The Hidden Cam show is already underway.', u, appNoticeColor); } } else { cb.sendNotice('Only broadcasters and moderators with sufficient authority are able to use that command.', u, appNoticeColor); } break; } case '/showover': case '/showwarn': { cmd = 1; if (isBC || (isMod && allowModsAuthority == 'Yes')) { if (cb.limitCam_isRunning()) { if (showStage === 'ticketshow') { warnShowEnding(u); } else { cb.sendNotice('The /showwarn or /showover command is used for a first warning. The show has already progressed past the point this command should be used. To end the show and return to a public broadcast, use the /stopshow command.', u, appNoticeColor); } } else { cb.sendNotice('The Hidden Cam show has not been started or has already ended.', u, appNoticeColor); } } else { cb.sendNotice('Only broadcasters and moderators with sufficient authority are able to use that command.', u, appNoticeColor); } break; } case '/showend': case '/stopsales': { cmd = 1; if (isBC || (isMod && allowModsAuthority == 'Yes')) { if (cb.limitCam_isRunning()) { stopTicketSales(u); } else { cb.sendNotice('The Hidden Cam show has not been started or has already ended.', u, appNoticeColor); } } else { cb.sendNotice('Only broadcasters and moderators with sufficient authority are able to use that command.', u, appNoticeColor); } break; } case '/stopshow': { cmd = 1; if (isBC || (isMod && allowModsAuthority == 'Yes')) { if (cb.limitCam_isRunning()) { stopTicketShow(u); } else { cb.sendNotice('The Hidden Cam show has not been started or has already ended.', u, appNoticeColor); } } else { cb.sendNotice('Only broadcasters and moderators with sufficient authority are able to use that command.', u, appNoticeColor); } break; } case '/ticketsubject': { cmd = 1; if (isBC || (isMod && allowModsAuthority == 'Yes')) { ticketSubjectText = msg['m'].substring(15).trim(); if (ticketSubjectText != '' && ticketSubjectText != null) { changeRoomSubject(); } else { cb.sendNotice('No value was specified for the new room subject suffix.', u, appNoticeColor); } } else { cb.sendNotice('Only broadcasters and moderators with sufficient authority are able to use that command.', u, appNoticeColor); } break; } case '/ctsubject': { cmd = 1; if (isBC || (isMod && allowModsAuthority == 'Yes')) { ticketSubjectText = msg['m'].substring(11).trim(); if (ticketSubjectText != '' && ticketSubjectText != null) { changeRoomSubject(); } else { cb.sendNotice('No value was specified for the new room subject suffix.', u, appNoticeColor); } } else { cb.sendNotice('Only broadcasters and moderators with sufficient authority are able to use that command.', u, appNoticeColor); } break; } case '/newticketshow': { cmd = 1; if (isBC || (isMod && allowModsAuthority == 'Yes')) { if (!cb.limitCam_isRunning()) { ticketlist = cb.limitCam_allUsersWithAccess(); if (ticketlist.length > 0) { cb.sendNotice('In case the ticket show was reset by mistake, the previous ticket list is displayed below so they can be added back to the show using the /add command : ', cb.room_slug, appNoticeColor); cb.sendNotice(cbjs.arrayJoin(ticketlist, ', '), cb.room_slug); cb.sendNotice('End of List', cb.room_slug, appNoticeColor); if (isMod) { cb.sendNotice('In case the ticket show was reset by mistake, the previous ticket list is displayed below so they can be added back to the show using the /add command : ', u, appNoticeColor); cb.sendNotice(cbjs.arrayJoin(ticketlist, ', '), u); cb.sendNotice('End of List', u, appNoticeColor); } } else { cb.sendNotice('No ticket buyers in the previous ticket list.', u, appNoticeColor); } initTicketShow(u,ticketPrice); cb.limitCam_removeAllUsers(); while (ticketShowViewerList.length > 0) viewerList.pop(); } else { cb.sendNotice('A Hidden Cam show is still running. The /newticketshow command can be used to start a brand new ticket show. The ticket list is cleared but the outstanding ticket list and changes list remains intact.', u, appNoticeColor); } } else { cb.sendNotice('Only broadcasters and moderators with sufficient authority are able to use that command.', u, appNoticeColor); } break; } case '/restartshow': { cmd = 1; if (isBC || (isMod && allowModsAuthority == 'Yes')) { if (!cb.limitCam_isRunning()) { restartTicketShow(u); } else { cb.sendNotice('A Hidden Cam show is already running. The /restartshow command can be used to resume a hidden show that was ended prematurely or accidentally. All settings remain the same and the ticket list stays intact.', u, appNoticeColor); } } else { cb.sendNotice('Only broadcasters and moderators with sufficient authority are able to use that command.', u, appNoticeColor); } break; } case '/restartsales': { cmd = 1; if (isBC || (isMod && allowModsAuthority == 'Yes')) { if (ticketSalesEnded == true) { restartTicketSales(u); } else { cb.sendNotice('Ticket Sales are already enabled.', u, appNoticeColor); } } else { cb.sendNotice('Only broadcasters and moderators with sufficient authority are able to use that command.', u, appNoticeColor); } break; } case '/ctn': { cmd = 1; if (isMod || isBC) { if (ntc != null && (ntc != '' || ntc != ' ' || ntc != '\u00a0')) { sendPublicNotice(ntc, u, ''); } else { cb.sendNotice('You cannot send a blank message. The correct syntax for this command is "/ctn [message]".', u, appNoticeColor); } } else { cb.sendNotice('Only moderators and broadcasters are able to use that command.', u, appNoticeColor); } break; } case '/ctnh': { cmd = 1; if (isMod || isBC) { if (ntc != null && (ntc != '' || ntc != ' ' || ntc != '\u00a0')) { sendPublicNotice(ntc, u, 'h'); } else { cb.sendNotice('You cannot send a blank message. The correct syntax for this command is "/ctnh [message]".', u, appNoticeColor); } } else { cb.sendNotice('Only moderators and broadcasters are able to use that command.', u, appNoticeColor); } break; } case '/ctnd': { cmd = 1; if (isMod || isBC) { if (ntc != null && (ntc != '' || ntc != ' ' || ntc != '\u00a0')) { sendPublicNotice(ntc, u, 'div'); } else { cb.sendNotice('You cannot send a blank message. The correct syntax for this command is "/ctnd [message]".', u, appNoticeColor); } } else { cb.sendNotice('Only moderators and broadcasters are able to use that command.', u, appNoticeColor); } break; } case '/ctndh': { cmd = 1; if (isMod || isBC) { if (ntc != null && (ntc != '' || ntc != ' ' || ntc != '\u00a0')) { sendPublicNotice(ntc, u, 'divh'); } else { cb.sendNotice('You cannot send a blank message. The correct syntax for this command is "/ctndh [message]".', u, appNoticeColor); } } else { cb.sendNotice('Only moderators and broadcasters are able to use that command.', u, appNoticeColor); } break; } //******** VIP Commands *********** case '/addvip': { cmd = 1; if (isBC) { if (cmdval != null) { var cmdvalsplit = cmdval.split(listRegExp); if (cmdvalsplit.length > 1) { addnotice = 'Adding multiple users to the Ticket Show VIP list.'; addnotice += '\nNote this is only applied during this session, permanent VIP list changes must be made to the list defined when starting the Ticket Show App. This list should also be saved to a separate document.'; for (var vipi = 0; vipi < cmdvalsplit.length; vipi++) { if (cmdvalsplit[vipi] != '') { nametoadd = cmdvalsplit[vipi].toLowerCase(); if (!cbjs.arrayContains(VIPListArray, nametoadd)) { addRmvVIP(nametoadd,'a'); addnotice += '\nAdded ' + nametoadd + ' to the Ticket Show VIP list.'; cb.sendNotice(u + ' has added you to the Ticket Show VIP list.', nametoadd, appNoticeColor); } else { addnotice += '\n' + nametoadd + ' is already on the Ticket Show VIP list. Skipping.'; } } } addnotice += '\nAll users were added and notified.'; cb.sendNotice(addnotice, u, appNoticeColor); cb.sendNotice(u + ' has added multiple users to the Ticket Show VIP list.\n' + 'Users added: ' + cbjs.arrayJoin(cmdvalsplit, ', '), '', appNoticeColor, '', 'normal', 'red'); } else { nametoadd = message[1].toLowerCase(); if (cbjs.arrayContains(VIPListArray,nametoadd)) { cb.sendNotice('Ticket Show: ' + nametoadd + ' is already on the VIP list.', u, appNoticeColor); } else { addRmvVIP(nametoadd,'a'); cb.sendNotice('Ticket Show: You have added ' + nametoadd + ' to the VIP list.\nNote this is only applied during this session, permanent VIP list changes must be made to the list defined when starting the Ticket Show App. This list should also be saved to a separate document.', u, appNoticeColor); cb.sendNotice('Ticket Show: Congratulations! You have been added to the VIP list!', nametoadd, appNoticeColor); } } } else { cb.sendNotice('Ticket Show: You did not specify the username you want to add to the Ticket Show VIP list.', u, appNoticeColor); } } else { cb.sendNotice('Ticket Show: Only broadcasters are able to use that command.', u, appNoticeColor); } break; } case '/rmvvip': { cmd = 1; if (isBC) { if (message[1]) { nametormv = message[1].toLowerCase(); if (cbjs.arrayContains(VIPListArray,nametormv)) { addRmvVIP(nametormv,'r'); cb.sendNotice('Ticket Show: You have removed ' + nametormv + ' from the VIP list.\nNote this is only applied during this session, permanent VIP list changes must be made to the list defined when starting the Ticket Show App. This list should also be saved to a separate document.', u, appNoticeColor); } else { cb.sendNotice('Ticket Show: ' + nametormv + ' is not on the VIP list.', u, appNoticeColor); } } else { cb.sendNotice('Ticket Show: You did not specify the username you want to remove from the VIP list.', u, appNoticeColor); } } else { cb.sendNotice('Ticket Show: Only broadcasters are able to use that command.', u, appNoticeColor); } break; } case '/viplist': { cmd = 1; if (isBC || (isMod && allowModsAuthority == 'Yes')) { cb.sendNotice('Users currently on the Ticket Show VIP List: ' + VIPListArray.length + '\n' + (VIPListArray.length > 0 == true ? cbjs.arrayJoin(VIPListArray, ', ') : 'No users.') + '\nEnd of List', u, appNoticeColor); } else { cb.sendNotice('Only broadcasters and moderators with sufficient authority are able to use that command.', u, appNoticeColor); } break; } //******** External Fan Club Commands *********** case '/addfan': { cmd = 1; if (isBC) { if (cmdval != null) { var cmdvalsplit = cmdval.split(listRegExp); if (cmdvalsplit.length > 1) { addnotice = 'Adding multiple users to the Ticket Show External Fan Club list.'; addnotice += '\nNote this is only applied during this session, permanent External Fan Club list changes must be made to the list defined when starting the Ticket Show App. This list should also be saved to a separate document.'; for (var efci = 0; efci < cmdvalsplit.length; efci++) { if (cmdvalsplit[efci] != '') { nametoadd = cmdvalsplit[efci].toLowerCase(); if (!cbjs.arrayContains(extFanListArray, nametoadd)) { addRmvExtFan(nametoadd,'a'); addnotice += '\nAdded ' + nametoadd + ' to the Ticket Show External Fan Club list.'; cb.sendNotice(u + ' has added you to the Ticket Show External Fan Club list.', nametoadd, appNoticeColor); } else { addnotice += '\n' + nametoadd + ' is already on the Ticket Show External Fan Club list. Skipping.'; } } } addnotice += '\nAll users were added and notified.'; cb.sendNotice(addnotice, u, appNoticeColor); cb.sendNotice(u + ' has added multiple users to the Ticket Show External Fan Club list.\n' + 'Users added: ' + cbjs.arrayJoin(cmdvalsplit, ', '), '', appNoticeColor, '', 'normal', 'red'); } else { nametoadd = message[1].toLowerCase(); if (cbjs.arrayContains(extFanListArray,nametoadd)) { cb.sendNotice('Ticket Show: ' + nametoadd + ' is already on the External Fan Club list.', u, appNoticeColor); } else { addRmvExtFan(nametoadd,'a'); cb.sendNotice('Ticket Show: You have added ' + nametoadd + ' to the External Fan Club list.\nNote this is only applied during this session, permanent VIP list changes must be made to the list defined when starting the Ticket Show App. This list should also be saved to a separate document.', u, appNoticeColor); cb.sendNotice('Ticket Show: Congratulations! You have been added to the External Fan Club list!', nametoadd, appNoticeColor); } } } else { cb.sendNotice('You did not specify the username you want to add to the Ticket Show External Fan Club list.', u, appNoticeColor); } } else { cb.sendNotice('Only broadcasters are able to use that command.', u, appNoticeColor); } break; } case '/rmvfan': { cmd = 1; if (isBC) { if (message[1]) { nametormv = message[1].toLowerCase(); if (cbjs.arrayContains(extFanListArray,nametormv)) { addRmvExtFan(nametormv,'r'); cb.sendNotice('Ticket Show: You have removed ' + nametormv + ' from the External Fan Club list.\nNote this is only applied during this session, permanent VIP list changes must be made to the list defined when starting the Ticket Show App. This list should also be saved to a separate document.', u, appNoticeColor); } else { cb.sendNotice('Ticket Show: ' + nametormv + ' is not on the External Fan Club list.', u, appNoticeColor); } } else { cb.sendNotice('You did not specify the username you want to remove from the Ticket Show External Fan Club list.', u, appNoticeColor); } } else { cb.sendNotice('Only broadcasters are able to use that command.', u, appNoticeColor); } break; } case '/fanlist': { cmd = 1; if (isBC || (isMod && allowModsAuthority == 'Yes')) { cb.sendNotice('Users currently in the Ticket Show External Fan Club List: ' + extFanListArray.length + '\n' + (extFanListArray.length > 0 == true ? cbjs.arrayJoin(extFanListArray, ', ') : 'No users.') + '\nEnd of List', u, appNoticeColor); } else { cb.sendNotice('Only broadcasters and moderators with sufficient authority are able to use that command.', u, appNoticeColor); } break; } //******** Moderator List Commands *********** case '/addmod': { cmd = 1; if (isBC) { if (cmdval != null) { var cmdvalsplit = cmdval.split(listRegExp); if (cmdvalsplit.length > 1) { addnotice = 'Adding multiple users to the Ticket Show Moderator list.'; addnotice += '\nNote this is only applied during this session, permanent Moderator list changes must be made to the list defined when starting the Ticket Show App. This list should also be saved to a separate document.'; for (var modi = 0; modi < cmdvalsplit.length; modi++) { if (cmdvalsplit[modi] != '') { nametoadd = cmdvalsplit[modi].toLowerCase(); if (!cbjs.arrayContains(moderatorList.name, nametoadd)) { populateModeratorArray(nametoadd,'botmod','a'); addnotice += '\nAdded ' + nametoadd + ' to the Ticket Show Moderator list.'; cb.sendNotice(u + ' has added you to the Ticket Show Moderator list. You now have all moderator privileges, you can view the full command list with the "/tickethelp" command.', nametoadd, appNoticeColor); } else { addnotice += '\n' + nametoadd + ' is already on the Ticket Show Moderator list. Skipping.'; } } } addnotice += '\nAll users were added and notified.'; cb.sendNotice(addnotice, u, appNoticeColor); cb.sendNotice(u + ' has added multiple users to the Ticket Show Moderator list.\n' + 'Users added: ' + cbjs.arrayJoin(cmdvalsplit, ', '), '', appNoticeColor, '', 'normal', 'red'); } else { nametoadd = message[1].toLowerCase(); if (!cbjs.arrayContains(moderatorList.name,nametoadd)) { populateModeratorArray(nametoadd,'botmod','a'); cb.sendNotice('You have added ' + nametoadd + ' to the Ticket Show moderator list.', u, appNoticeColor); cb.sendNotice('Note this is only applied during this session, permanent VIP list changes must be made to the list defined when starting the Ticket Show App. This list should also be saved to a separate document.', u, appNoticeColor); cb.sendNotice(u + ' has added you to the Ticket Show moderator list. You now have all moderator privileges, you can view the full command list with the "/tickethelp" command.', nametoadd, appNoticeColor); } else { cb.sendNotice(nametoadd + ' is already on the Ticket Show moderator list.', u, appNoticeColor); } } } else { cb.sendNotice('You did not specify the username you want to add to the Ticket Show moderator list.', u, appNoticeColor); } } else { cb.sendNotice('Only broadcasters are able to use that command.', u, appNoticeColor); } break; } case '/rmvmod': { cmd = 1; if (isBC) { if (message[1]) { nametormv = message[1].toLowerCase(); if (cbjs.arrayContains(moderatorList.name,nametormv)) { populateModeratorArray(nametormv,'botmod','r'); cb.sendNotice('You have removed ' + nametormv + ' from the Ticket Show Moderator list.', u, appNoticeColor); } else { cb.sendNotice(nametormv + ' is not in the Ticket Show Moderator list.', u, appNoticeColor); } } else { cb.sendNotice('Ticket Show: A parameter is required for this command to specify the user to remove from the Ticket Show Moderator list, such as "/rmvmod username".', u, appNoticeColor); } } else { cb.sendNotice('Ticket Show: Only broadcasters are able to use that command.', u, appNoticeColor); } break; } case '/modlist': { cmd = 1; if (isBC || (isMod && allowModsAuthority == 'Yes')) { message = ''; message += 'Users currently on the Ticket Show Moderator List: '; if (moderatorList.name.length > 0) { for (var modli = 0; modli < moderatorList.name.length; modli++) { message += '\n' + (modli+1) + '. ' + moderatorList.name[modli] + ' (' + moderatorList.type[modli] + ')'; } } else { message += '\nNo moderators currently assigned.'; } message += '\nEnd of List'; cb.sendNotice(message, u, appNoticeColor); } else { cb.sendNotice('Only broadcasters and moderators with sufficient authority are able to use that command.', u, appNoticeColor); } break; } //********* Help Menu case '/tickethelp': { cmd = 1; if (isMod || isBC) { helpModBC(message[1],u); } else { helpCommon(message[1],u); } break; } //********* End of Expected commands } if (message[0] == '/chscoreboard' || message[0] == '/chs' || message[0] == '/chfixscore' || message[0] == '/chlength' || message[0] == '/chclearlist' || message[0] == '/chskip' || message[0] == '/chwin' || message[0] == '/chend' || message[0] == '/chstoptimer' || message[0] == '/chfree' || message[0] == '/chword' || message[0] == '/chprice' || message[0] == '/chplay' || message[0] == '/chh' || message[0] == '/chq' || message[0] == '/chlist' || message[0] == '/chi' || message[0] == '/charades' || message[0] == '/randomfree' || message[0] == '/random' || message[0] == '/ri' || message[0] == '/rw' || message[0] == '/badfree' || message[0] == '/badlibs' || message[0] == '/bli' || message[0] == '/blc' || message[0] == '/badprice' || message[0] == '/blw' || message[0] == '/addwho' || message[0] == '/addwhat' || message[0] == '/addwhere' || message[0] == '/addhowlong' || message[0] == '/uapresale' || message[0] == '/uapresales' || message[0] == '/backup' || message[0] == '/ki' || message[0] == '/gbhelp' || message[0] == '/whs' || message[0] == '/rri' || message[0] == '/whi' || message[0] == '/di' || message[0] == '/setusercolor' || message[0] == '/setusernn' || message[0] == '/setusericon' || message[0] == '/pt' || message[0] == '/gbstats' || message[0] == '/wi' || message[0] == '/wf' || message[0] == '/warfree' || message[0] == '/pi' || message[0] == '/pf' || message[0] == '/pressfree' || message[0] == '/pw' || message[0] == '/presswinners' || message[0] == '/ww' || message[0] == '/warwinners' || message[0] == '/cpd' || message[0] == '/chgprizedesc' || message[0] == '/addprize' || message[0] == '/cpp' || message[0] == '/changeprizeprice' || message[0] == '/mpl' || message[0] == '/masterprizelist' || message[0] == '/ap' || message[0] == '/pl' || message[0] == '/presslist' || message[0] == '/stoppress' || message[0] == '/press' || message[0] == '/pp' || message[0] == '/pressprizes' || message[0] == '/war' || message[0] == '/waragain' || message[0] == '/stopwar' || message[0] == '/warprizes' || message[0] == '/wl' || message[0] == '/warlist' || message[0] == '/wd' || message[0] == '/wardraw' || message[0] == '/wp' || message[0] == '/kb' || message[0] == '/freekeno' || message[0] == '/wargame' || message[0] == '/keno' || message[0] == '/kp' || message[0] == '/kpbc' || message[0] == '/rrprice' || message[0] == '/chambers' || message[0] == '/rrp' || message[0] == '/rr' || message[0] == '/rrs' || message[0] == '/shooters' || message[0] == '/wheelspins' || message[0] == '/wheelprice' || message[0] == '/freespin' || message[0] == '/freeroll' || message[0] == '/wheel' || message[0] == '/wheelprizes' || message[0] == '/dice' || message[0] == '/diceprizes' || message[0] == '/diceprice' || message[0] == '/usegraylock' || message[0] == '/chggraytime' || message[0] == '/fbhelp' || message[0] == '/expps' || message[0] == '/pslist' || message[0] == '/subject' || message[0] == '/check' || message[0] == '/pass' || message[0] == '/plist' || message[0] == '/plistw' || message[0] == '/email' || message[0] == '/newshow' || message[0] == '/useraffle' || message[0] == '/uselushmenu' || message[0] == '/usemedia' || message[0] == '/pm' || message[0] == '/reply' || message[0] == '/bc' || message[0] == '/tm' || message[0] == '/tbm' || message[0] == '/silencelevel' || message[0] == '/graphiclevel' || message[0] == '/ninja' || message[0] == '/unninja' || message[0] == '/ninjalist' || message[0] == '/silence' || message[0] == '/unsilence' || message[0] == '/silencelist' || message[0] == '/tipmenu' || message[0] == '/tipmenurequests' || message[0] == '/tipmenuadd' || message[0] == '/tipmenurmv' || message[0] == '/usemenu' || message[0] == '/posmenu' || message[0] == '/posmenurequests' || message[0] == '/posmenuadd' || message[0] == '/posmenurmv' || message[0] == '/useposmenu' || message[0] == '/startclock' || message[0] == '/addtoclock' || message[0] == '/timeleft' || message[0] == '/stopclock' || message[0] == '/cn' || message[0] == '/cnh' || message[0] == '/cnd' || message[0] == '/cndh' || message[0] == '/usenotifier' || message[0] == '/chgmsg1' || message[0] == '/chgmsg2' || message[0] == '/chgmsg3' || message[0] == '/chgmsg4' || message[0] == '/chgmsg5' || message[0] == '/dspmsg' || message[0] == '/leaders' || message[0] == '/useleaderboard' || message[0] == '/usetipcount' || message[0] == '/tippers' || message[0] == '/poll' || message[0] == '/usepoll' || message[0] == '/endpoll' || message[0] == '/restartpoll' || message[0] == '/addvote' || message[0] == '/polloptadd' || message[0] == '/polloptrmv' || message[0] == '/pollstarttimer' || message[0] == '/polladdtime' || message[0] == '/pollstoptimer' || message[0] == '/pollleader' || message[0] == '/addnice' || message[0] == '/rmvnice' || message[0] == '/nicelist' || message[0] == '/addvip' || message[0] == '/rmvvip' || message[0] == '/viplist' || message[0] == '/exportvip' || message[0] == '/addfan' || message[0] == '/rmvfan' || message[0] == '/fanlist' || message[0] == '/exportfans' || message[0] == '/addword' || message[0] == '/rmvword' || message[0] == '/wordlist' || message[0] == '/newsubject' || message[0] == '/dumpsettings' || message[0] == '/checkcolor' || message[0] == '/prepticket' || message[0] == '/dsptlist' || message[0] == '/usetlist' || message[0] == '/exptlist' || message[0] == '/addlbtop' || message[0] == '/addlbamt' || message[0] == '/useticketshow' || message[0] == '/exppresale' || message[0] == '/addpresale' || message[0] == '/rmvpresale' || message[0] == '/chgpresalemode' || message[0] == '/lushmenu' || message[0] == '/uselushmenu' || message[0] == '/chgtoy' || message[0] == '/uselush' || message[0] == '/usedomi' || message[0] == '/usenora' || message[0] == '/media' || message[0] == '/usemedia' || message[0] == '/prizes' || message[0] == '/usedice' || message[0] == '/chgdiceprice' || message[0] == '/dicerolls' || message[0] == '/usealltime' || message[0] == '/top10' || message[0] == '/alltime' || message[0] == '/startprivate' || message[0] == '/stopprivate' || message[0] == '/useraffle' || message[0] == '/entries' || message[0] == '/raffletickets' || message[0] == '/raffleentries' || message[0] == '/previousentries' || message[0] == '/resetraffle' || message[0] == '/clearraffle' || message[0] == '/addraffletkt' || message[0] == '/rmvraffletkt' || message[0] == '/addraffleprize' || message[0] == '/rmvraffleprize' || message[0] == '/raffleprizes' || message[0] == '/setraffleprice' || message[0] == '/raffledrawing' || message[0] == '/rafflestarttimer' || message[0] == '/startraffletimer' || message[0] == '/raffleaddtime' || message[0] == '/addraffletime' || message[0] == '/rafflestoptimer' || message[0] == '/stopraffletimer' || message[0] == '/raffletimeleft' || message[0] == '/chgrafflemode') { cmd = 1; } if (fembotRunning != 'Yes') { if (cmd == 0) { cb.sendNotice(message[0] + ' is not a recognized Ticket Show App command (although it may just be a command for another app or bot).\nType "/tickethelp" to see a full list of the available Ticket Show commands.', u, appNoticeColor); } } } // Highlight background for Ticket show users if (cb.limitCam_userHasAccess(u)) { msg['background'] = ticketHolderBgColor; } return msg; }); } // *********************************** Actions on user entering ************************************** { cb.onEnter(function(user) { // Variables var u = user.user; var isMod = user.is_mod; var isBC = (u === cb.room_slug); var isFan = user.in_fanclub; var isExtFan = cbjs.arrayContains(extFanListArray,u); var isVIP = cbjs.arrayContains(VIPListArray,u); var isNotGray = user.has_tokens; isBotMod = false; if (isMod) { populateModeratorArray(u,'cbmod','a'); } else { if (cbjs.arrayContains(moderatorList.name,u)) { nameIndex = moderatorList.name.indexOf(u); if (moderatorList.type[nameIndex] == 'botmod') { isBotMod = true; isMod = true; } } } if (isMod) { addRmvModsInShow(u,'a'); } if (isFan) { populateFanClubArray(u); } if (isVIP) { addRmvVIPInShow(u,'a'); } if (isExtFan) { addRmvExtFanInShow(u,'a'); } if (cb.limitCam_userHasAccess(u)) { addViewer(u); if (cbjs.arrayContains(freePreviewUserArray,u)) { addPreViewer(u); } cb.drawPanel(); } // **** Ticket Show functions and message if (!isBC) { if (isMod || isFan || isExtFan || isVIP) { checkFreeTickets(u,isMod,isFan,isExtFan,isVIP); } if (cb.limitCam_isRunning()) { if (!cb.limitCam_userHasAccess(u)) { if (ticketShowFanAppreciation == 'Yes') { cb.sendNotice(dashLine80 + '\nToday\'s Ticket Show is a Fan Club Appreciation Show!\nOnly Fan Club Members and VIPs will be admitted to the show!\nPlease consider joining the Fan Club!\n' + dashLine80, u, ticketBgColor, ticketTxtColor, 'bold'); } else { if (freePreviewLength > 0 && (showStage == 'ticketshow' || showStage == 'showwarn')) { if (!cbjs.arrayContains(freePreviewUserArray,u)) { if ((ticketShowPreviewGrays == 'No' && isNotGray) || ticketShowPreviewGrays == 'Yes') { addRmvPreview('add',u); cb.sendNotice(dashLine80 + '\nThe Broadcaster has enabled a Free Preview of the Ticket Show.\n You will be able to see the show for ' + freePreviewLengthText + '. \n After that you must buy a ticket to continue.\n' + dashLine80, u, ticketBgColor,ticketTxtColor,'bold'); } } } if (showStage == 'ticketshow') { cb.sendNotice(dashLine80 + '\n \u25B7 Hidden Ticket Show in progress for ' + ((Date.now() - hiddenTime)/60000).toFixed(1) + ' minutes. \u25C1 \nThe ticket price is ' + ticketPrice + ' tokens.\n' + dashLine80, u, ticketBgColor,ticketTxtColor,'bold'); if (ticketShowOtToggle == 1) { cb.sendNotice(dashLine80 + '\n* The Broadcaster has enabled the Outstanding Ticket Feature. \n* You can use the command "/otlist" to see if you have an outstanding ticket. \n* You can use a saved outstanding ticket with the command "/useticket". \n* You can also save your ticket for a future show using the command "/saveticket" if the show has not staretd yet.\n' + dashLine80, u, ticketBgColor, ticketTxtColor, 'bold'); } } else if (showStage == 'showwarn') { cb.sendNotice(dashLine90 + '\n \u25B7 Hidden Ticket Show in progress for ' + ((Date.now() - hiddenTime)/60000).toFixed(1) + ' minutes. \u25C1 \n The broadcaster has indicated show is nearly over. \nBuying a ticket is not recommended, but you may still buy one for ' + ticketPrice + ' tokens.\n' + dashLine90, u, ticketBgColor,ticketTxtColor,'bold'); } else if (showStage == 'showfinale') { cb.sendNotice(dashLine90 + '\n \u25B7 Hidden Ticket Show in progress for ' + ((Date.now() - hiddenTime)/60000).toFixed(1) + ' minutes. \u25C1 \n The broadcaster has indicated show is nearly over. \nTicket Sales have been suspended, you can no longer buy a ticket. \nBroadcaster may be returning to public chat shortly.\n' + dashLine90, u, ticketBgColor,ticketTxtColor,'bold'); } } } else { if (cbjs.arrayContains(ticketShowPreViewerList,u)) { cb.sendNotice(dashLine80 + '\nYou are currently in your free preview period. \n Once it ends, you must buy a ticket to continue watching the show.\n' + dashLine80, u, ticketBgColor,ticketTxtColor,'bold'); } } } else { if (showStage == 'ticketsales') { if (ticketShowFanAppreciation == 'Yes') { if (cb.limitCam_userHasAccess(u)) { cb.sendNotice(dashLine80 + '\nWelcome! You have a ticket to the Fan Appreciation show and the show has not yet started.\n' + dashLine80, u, ticketBgColor, ticketTxtColor, 'bold'); } else { cb.sendNotice(dashLine80 + '\nToday\'s Ticket Show is a Fan Club Appreciation Show!\nOnly Fan Club Members and VIPs will be admitted to the show!\nPlease consider joining the Fan Club!\n' + dashLine80, u, ticketBgColor, ticketTxtColor, 'bold'); } } else { if (cb.limitCam_userHasAccess(u)) { cb.sendNotice(dashLine80 + '\nWelcome! You have a ticket to the show and the show has not yet started.\n' + dashLine80, u, ticketBgColor, ticketTxtColor, 'bold'); } else { cb.sendNotice(dashLine80 + '\nTicket Show sales are active and show has not yet started. \nThe ticket price is ' + ticketPrice + ' tokens.\n' + dashLine80, u, ticketBgColor, ticketTxtColor, 'bold'); } if (ticketShowAllowGift == 'Yes') { cb.sendNotice(dashLine80 + '\n* The Broadcaster has enabled the the gifting of tickets. \n* If you purchase extra tickets, you can gift them to others.\n' + dashLine80, u, ticketBgColor, ticketTxtColor, 'bold'); } if (ticketShowOtToggle == 1) { cb.sendNotice(dashLine80 + '\n* The Broadcaster has enabled the Outstanding Ticket Feature. \n* You can use the command "/otlist" to see if you have an outstanding ticket. \n* You can use a saved outstanding ticket with the command "/useticket". \n* You can also save your ticket for a future show using the command "/saveticket" if the show has not started yet.\n' + dashLine80, u, ticketBgColor, ticketTxtColor, 'bold'); } } } else if (showStage == 'aftershow' || ticketShowEnded === true) { cb.sendNotice(dashLine60 + '\nThe Ticket Show is over.\n' + dashLine60, u, ticketBgColor, ticketTxtColor, 'bold'); } } } }); } // *********************************** Actions upon leaving ************************************** { cb.onLeave(function(user) { var u = user.user; removeViewer(u); removePreViewer(u); }); } // *********************************** Actions upon Draw Panel ************************************** cb.onDrawPanel(function (user) { var panel = {}; if (customPanel) { panel.template = 'image_template'; panel.row1_label = 'row1_label'; panel.row1_value = 'row1_value'; panel.row2_label = 'row2_label'; panel.row2_value = 'row2_value'; panel.row3_label = 'row3_label'; panel.row3_value = 'row3_value'; } else { panel.template = '3_rows_11_21_31'; } if (ticketShowFanAppreciation == 'Yes') { panel.row1_value = 'Fan Appreciation Ticket Show'; leftjust1 = leftJustify(panel.row1_value,1); panel.row2_value = 'Only Fan Club and VIPs Admitted'; leftjust2 = leftJustify(panel.row2_value,2); panel.row3_value = 'Join the Fanclub Today to See the Show!'; leftjust3 = leftJustify(panel.row3_value,3); } else if (showStage === 'ticketsales') { if (ticketStartMode == 'ticketgoal') { panel.row1_value = 'Start Mode: Ticket Goal \u25FE ' + ticketShowTotalTickets + ' / ' + ticketShowGoalTickets + ' tickets'; leftjust1 = leftJustify(panel.row1_value+'..',1); panel.row2_value = 'Ticket Holders: ' + countTickets + ' \u25FE Viewers: ' + ticketShowViewerList.length; leftjust2 = leftJustify(panel.row2_value,2); panel.row3_value = 'Ticket Price: ' + ticketPrice + ' tokens ' + (showTotals == 'Yes' ? (' \u25FE Total Tips: ' + currentAppTotalTicket) : ''); leftjust3 = leftJustify(panel.row3_value,3); } else if (ticketStartMode == 'tokengoal') { panel.row1_value = 'Start Mode: Token Goal \u25FE ' + ticketShowTotalTips + ' / ' + ticketShowGoalTokens + ' tokens'; leftjust1 = leftJustify(panel.row1_value+'...',1); panel.row2_value = 'Ticket Holders: ' + countTickets + ' \u25FE Viewers: ' + ticketShowViewerList.length; leftjust2 = leftJustify(panel.row2_value,2); panel.row3_value = 'Ticket Price: ' + ticketPrice + ' tokens ' + (showTotals == 'Yes' ? (' \u25FE Total Tips: ' + currentAppTotalTicket) : ''); leftjust3 = leftJustify(panel.row3_value,3); } else if (ticketStartMode == 'timer') { panel.row1_value = 'Start Mode: Timer (' + ((ticketSecsRemain > 0 || ticketMinsRemain > 0) ? ticketTimeLeftPanel() : 'Timer not yet started') + ')'; leftjust1 = leftJustify(panel.row1_value,1); panel.row2_value = 'Ticket Holders: ' + countTickets + ' \u25FE Viewers: ' + ticketShowViewerList.length; leftjust2 = leftJustify(panel.row2_value,2); panel.row3_value = 'Ticket Price: ' + ticketPrice + ' tokens ' + (showTotals == 'Yes' ? (' \u25FE Total Tips: ' + currentAppTotalTicket) : ''); leftjust3 = leftJustify(panel.row3_value,3); } else { panel.row1_value = 'Start Mode: Manual'; leftjust1 = leftJustify(panel.row1_value,1); panel.row2_value = 'Ticket Holders: ' + countTickets; leftjust2 = leftJustify(panel.row2_value,2); panel.row3_value = 'Ticket Price: ' + ticketPrice + ' tokens ' + (showTotals == 'Yes' ? (' \u25FE Total Tips: ' + currentAppTotalTicket) : ''); leftjust3 = leftJustify(panel.row3_value,3); } } else if (showStage == 'showfinale') { panel.row1_value = 'Ticket Holders: ' + countTickets; leftjust1 = leftJustify(panel.row1_value,1); if (freePreviewLength > 0 && ticketShowPreViewerList.length > 0) { panel.row2_value = 'Viewers: ' + ticketShowViewerList.length + ' (' + ticketShowPreViewerList.length + ' previewer' + (ticketShowPreViewerList.length == 1 ? '' : 's') + ' included)'; } else { panel.row2_value = 'Viewers: ' + ticketShowViewerList.length; } leftjust2 = leftJustify(panel.row2_value,2); panel.row3_value = 'Show ending soon, no more ticket sales!'; leftjust3 = leftJustify(panel.row3_value,3); } else if (showStage == 'aftershow') { panel.row1_value = 'Ticket Show is Over!'; leftjust1 = leftJustify(panel.row1_value,1); panel.row2_value = 'Thank you so much everyone for joining!'; leftjust2 = leftJustify(panel.row2_value,2); panel.row3_value = ''; leftjust3 = 100; } else { panel.row1_value = 'Ticket Holders: ' + countTickets; leftjust1 = leftJustify(panel.row1_value,1); if (freePreviewLength > 0 && ticketShowPreViewerList.length > 0) { panel.row2_value = 'Viewers: ' + ticketShowViewerList.length + ' (' + ticketShowPreViewerList.length + ' previewer' + (ticketShowPreViewerList.length == 1 ? '' : 's') + ' included)'; } else { panel.row2_value = 'Viewers: ' + ticketShowViewerList.length; } leftjust2 = leftJustify(panel.row2_value,2); panel.row3_value = 'Ticket Price: ' + ticketPrice + ' tokens ' + (showTotals == 'Yes' ? (' \u25FE Total Tips: ' + currentAppTotalTicket) : ''); leftjust3 = leftJustify(panel.row3_value,3); } panel.layers = [ {'type': 'image', 'fileID': backgroundImage}, { 'type': 'text', 'text': panel.row1_value, 'top': topjust1, 'left': leftjust1, 'font-size': fontSize, 'font-weight': 'bold', 'color': textColor, }, { 'type': 'text', 'text': panel.row2_value, 'top': topjust2, 'left': leftjust2, 'font-size': fontSize, 'color': textColor, }, { 'type': 'text', 'text': panel.row3_value, 'top': topjust3, 'left': leftjust3, 'font-size': fontSize, 'color': textColor, }, ] return panel; }); // *********************************** Actions upon tipping ************************************** { cb.onTip (function (tip) { var tipAmount = Number.parseInt(tip.amount, 10); var u = tip.from_user var isFan = tip.from_user_in_fanclub; var isExtFan = cbjs.arrayContains(extFanListArray,u); var isVIP = cbjs.arrayContains(VIPListArray,u); // ***** Record tip for goal progress and track total stats recordTip(tipAmount,u,isFan,isExtFan,isVIP); }); } // *********************************** Initialize ************************************** { if (initialize == 0) { var BC = cb.room_slug; cb.sendNotice('Dorothy\'s Easy Ticket Show v1.0 '); cb.sendNotice('** Version 1.0 (Initial Version - new App!) of Dorothy\'s Easy Ticket Show was released on 8/3/2019, please see the change log at the bottom of the app description page for a list of added features in the current release.', cb.room_slug, appNoticeColor); // *** Init Free Preview Length switch (freePreviewLengthText) { case 'No Preview': { freePreviewLength = 0; break; } case '10 seconds': { freePreviewLength = 10; break; } case '20 seconds': { freePreviewLength = 20; break; } case '30 seconds': { freePreviewLength = 30; break; } case '1 minute': { freePreviewLength = 60; break; } case '2 minutes': { freePreviewLength = 120; break; } case '3 minutes': { freePreviewLength = 180; break; } case '4 minutes': { freePreviewLength = 240; break; } case '5 minutes': { freePreviewLength = 300; break; } } //*** Init OT List for Ticket Show if (cb.settings.ticketShowOTList != '' && cb.settings.ticketShowOTList != null) { var n = cb.settings.ticketShowOTList; outstandingTicketArray = n.split(','); } //*** Init External Fan Club List if (cb.settings.extFanList != '' && cb.settings.extFanList != null) { var n = cb.settings.extFanList; extFanListArray = n.split(','); } //*** Init VIP List for Ticket Show if (cb.settings.VIPList != '' && cb.settings.VIPList != null) { var n = cb.settings.VIPList; VIPListArray = n.split(','); } //*** Init App Mod List if (cb.settings.botModList != '' && cb.settings.botModList != null) { var n = cb.settings.botModList; botModListArray = n.split(','); for (var i = 0; i < botModListArray.length; i++) { populateModeratorArray(botModListArray[i].toLowerCase(), 'botmod', 'a'); } } //*** Initialize Panel if (panelBackground != 'default - no image') { if (cbjs.arrayContains(backgroundArray.menu,panelBackground)) { newbackground = backgroundArray.command[backgroundArray.menu.indexOf(panelBackground)]; customizePanelBackground(newbackground,BC); customizePanelText('',BC); } else { customPanel = false; cb.sendNotice('A custom panel background was chosen but it does not exist, using the default panel background.', BC, appNoticeColor); } } else { customPanel = false; } initTicketShow(); populateModeratorArray(BC,'broadcaster','a'); initialize = 1; } }
© Copyright Chaturbate 2011- 2024. All Rights Reserved.