Apps Home
|
Create an App
FleshTicket1
Author:
hexting
Description
Source Code
Launch App
Current Users
Created by:
Hexting
/******************************************************* * Title: CrazyTicket App * * Author: 'acrazyguy' and 'phatkatmeow'. * Thumbsup: Concept and inspiration: 'birdylovesit'. * * Version: 1.5 (August 2014) * Build: .062 *******************************************************/ /** * Script: Main developers: 'acrazyguy' and 'phatkatmeow'. with contributions from 'robx7' and suggestions from CB mods. Originally developed for 'birdylovesit' and has since taken on a life of it's own. Based on a script called 'Ticket to the Show' by 'calvin06', and a script called 'Password Room' by 'TheKnight2000'. Added lots of new features and options, and applied bug and feature fixes. * Summary: Sell tickets for a Password Show or Hidden Cam show. Room-management commands for broadcaster and moderators available. Options for a goal and goal timer available. Catches non-ticket holders (room crashers) when they enter a passworded room. * PDF Document 'Using CrazyTicket' available at: https://www.dropbox.com/s/2uquvkcvs69cks2/Using%20CrazyTicket.pdf * Description: When a viewer buys a ticket, a password is sent automatically if Password show is chosen. Moderators have the ability to add users manually to cover special circumstances. Ticket holders will have highlighted text in the chat (can be toggled off) Broadcaster can change the password at any time and the new password is sent automatically to all ticket holders. * IMPORTANT: The broadcaster should NOT deactivate the App immediately after entering the passworded room so that if required, a '/changepw' command can be issued if room crashers are detected. If deactivated, the ticket holder list will be lost to the App. The ticket holder list CAN be restored however if the output from the '/tickets' command is saved along the way. * Awards: - Jan 2014 : 500 tokens awarded to developers (acrazyguy and phatkatmeow) by moderator - Feb 2014 : Featured-app listing. - Feb 2014 : Winner 3rd place 'Limit Cam' app Contest (2500 tokens awarded to acrazyguy) **/ /** * As seen on TV: CrazyTicket, CrazyNote, CrazyGoal, CrazyLotto **/ /********** Constants **********/ const appName = "'CrazyTicket'"; // Script name const appType = 'App'; // Script type: bot|app const SCRIPT_VERSION = '1.5'; // Internal: Script version number const SCRIPT_BUILD = '.062'; // Internal: Script build number const cr = 'acrazyguy'; // main developer const ph = 'phatkatmeow'; // main developer const te = 'phatterkat'; // testbed.cb account (phat) const pe = 'perd'; // testbed.cb account (crazy) const sf = 'sartfack'; // testbed.cb account (crazy) const bli = 'birdylovesit'; // The inspiration const CD = 'dump'; // debug: quick overview const nl = "--------------------------------------------"; // header generic const n2 = "--------------- COMMAND LIST ---------------"; // header for /cmds const n3 = "-------------- TICKET HOLDERS --------------"; // header for tickets const n4 = "---------------------------------------------------"; // compensate visually const n5 = "-------------- PASSWORD ---------------------"; // header for block of pass const n6 = "--------------------"; // header for alternatives const dashLine = "------------------------------------------------------"; // Temp only const COLOR_DEVELOPER = '#D9F7F7'; // Very light blue: Highlight colour for developers const COLOR_RED = '#FF1407'; // Bright red: Password, timer notice const COLOR_HIGHLIGHT = '#EEE5FF'; // Pastel purple: Highlight colour for ticket holders const COLOR_SUCCESS = '#468847'; // Green: Everything is fine const COLOR_ERROR = '#B94A48'; // Red: Everything fails const COLOR_INFO = '#144D8C'; // Blue-grey: Help and misc info const COLOR_NOTICE = '#6900CC'; // Bluish purple: General chat notice const COLOR_DPURPLE = '#663399'; // Dark purple const COLOR_LPURPLE = '#8041BF'; // Lighter purple const COLOR_MOD = '#DC0000'; // Moderator red const COLOR_FAN = '#009900'; // Fan green const COLOR_SYNTAX = '#995B00'; // Brownish: Usage notice colour and messages // to broadcaster on mod-action const COLOR_HVTEXT = '#D80A00'; // Redish: Text colour for Hi-Vis notices const COLOR_HVBACK = '#FFFFBF'; // Light yellow: Highlight colour for Hi-Vis notices const ONLY_BROADCASTER = "* Command is only available to the broadcaster."; const ONLY_MODERATORS = "* Command is only available to moderators and the broadcaster."; const newTeaser = "-------- WHAT'S NEW ---------- 2014.08.04 ---------\n* To see what's new in " +appName+ ", type: /new\n" +dashLine+ "------"; const whatsNew = "---------- WHAT'S NEW ----------\n* New Command: /alist - Displays a list of viewers that have been manually added to the ticket holder list.\n* New Command: /viewers - Toggles the display of Ticket Holders actually in the room ON/OFF.\n* Info display panel now shows the number of ticket holders and how many of them are actually in the room. Can be disabled during App setup or with the /viewers command (see above).\n* New Command: /showend - Makes it clear to all viewers that even though the cam is still hidden, the show has ended and ticket sales are suspended.\n* Updated /cmds list.\n* New Command: /ctreset - Empties the ticket holder lists and prepares for a new show without having to restart the App.\n* Viewers are now Notified when they are added to the ticket list manually.\n* Command Change: /newshow replaces /showprice - Use this command to restart ticket sales after a show is ended.\n* Ticket sales are now suspended when a show is ended.\n* New Command: /email - Tells 'CrazyTicket' to check for email address in tip note when a ticket is sold.\n* Command errors are now trapped and not echoed to the chat.\n* Added several conditional startup messages for moderators and fans.\n* New Commands: /subject /ctsubject . Allows mods to change the room subject.\n* Broadcasters can now run a Sub Goal while 'CrazyTicket' is running by using the /subgoal command. Ticket sales will continue as usual.\n"; const commandPrefix = '/'; // User Commands: const COMMAND_CMDS = 'cmds'; // List of these commands const COMMAND_TICKETS = 'tickets'; // Lists users who paid for a ticket const COMMAND_PASSWORD = 'pass'; // Sends pass or Notice to ticket holder const COMMAND_TIMELEFT = 'timeleft'; // Check time remaining on goal timer const COMMAND_SHOWTIME = 'showtime'; // Displays current hidden cam show length // const COMMAND_TIPPED = 'tipped'; // TRACKTIPPERS constant /tipped command // Moderator Commands, IF broadcaster set include-mods to 'Yes': const COMMAND_ADD = 'add'; // Add one or more viewers to ticket list const COMMAND_AU = 'au'; // Add user(s) alias const COMMAND_DEL = 'del'; // Delete a user const COMMAND_DU = 'du'; // Del user alias // Moderator Commands: const COMMAND_SENDPW = 'sendpw'; // Send pass to all or to a user const COMMAND_ADDP = 'addp'; // Add viewer to array paidList const COMMAND_DELP = 'delp'; // Delete viewer from array paidList const COMMAND_HILITE = 'hilite'; // Text highlighting toggler const COMMAND_HL = 'hl'; // Highlight user alias const COMMAND_STARTSHOW = 'startshow'; // Start the feed limited show const COMMAND_STOPSHOW = 'stopshow'; // Stops the feed limited show const COMMAND_SHOWOVER = 'showover'; // Notifies entering viewers the show is ending. const COMMAND_SHOWEND = 'showend'; // Notifies viewers the show has ended. const COMMAND_NEWSHOW = 'newshow'; // Resets for a new show after show is over. const COMMAND_VIEWERS = 'viewers'; // Toggles display of ticket holders in room ON/OFF const COMMAND_SUBJECT = 'subject'; // Change room subject - plain const COMMAND_CTSUBJECT = 'ctsubject'; // Change room subject - 'CT says:' const COMMAND_LOCK = 'lock'; // Toggler to tell script we're in PWed room const COMMAND_CHECK = 'check'; // Is the user a party crasher? (now supports // multiple users) const COMMAND_FAQ = 'faq'; // FAQ about the script, for the staff const COMMAND_NOTICE = 'notice'; // *Deprecated* const COMMAND_CTN = 'ctn'; // Sends a notice to the chat. const COMMAND_CTB = 'ctb'; // Sends a notice to the broadcaster. const COMMAND_CTM = 'ctm'; // Sends a notice to the mods as a group. const COMMAND_CTT = 'ctt'; // Sends a notice to the ticket holders. const COMMAND_SCHAT = 'schat'; // Suppresses public chat during 'hidden cam'. const COMMAND_SPASS = 'spass'; // Suppresses password send during ticket sales // for a 'hidden cam' show. const COMMAND_TIPSOFF = 'tipsoff'; // Suppresses tip total info. // const COMMAND_TIPPERS = 'tippers'; // TRACKTIPPERS constant /tippers list command const COMMAND_STARTTIMER = 'starttimer';// Start an x minute timer const COMMAND_PLIST = 'plist'; // List only paid ticket holders list format const COMMAND_PLISTW = 'plistw'; // List only paid ticket holders wide format const COMMAND_VLIST = 'vlist'; // List only viewers watching the show const COMMAND_ALIST = 'alist'; // List only manually added viewers. const COMMAND_NEW = 'new'; // Display 'What's New' text. const COMMAND_EMAIL = 'email'; // Detect email in tip note const COMMAND_SIL = 'sil'; const COMMAND_UNSIL = 'unsil'; const COMMAND_SLIST = 'slist'; // Broadcaster Commands: const COMMAND_CHANGEPW = 'changepw'; // Change the password const COMMAND_CTPRICE = 'ctprice'; // Change the ticket price const COMMAND_SUBGOAL = 'subgoal'; // Start a sub-goal during show const COMMAND_SUPPORT = 'support'; // Enables live developer support const COMMAND_CTRESET = 'ctreset'; // Resets CT for a new show const typeCmds = " Type " +commandPrefix+COMMAND_CMDS+ " to see all commands."; /********** Variables **********/ var theBC = cb.room_slug; var userTipCnt = []; // TRACKTIPPERS array var total_tipped = 0; var timerMinutes = 60; var hiddTime = 0; var timerStarted = false; var firstTimeInit = true; var password_override = null; var rePassword; var rePasswordOverride; var subGoal = 0; // Amount of sub goal. var subGoalTot = 0; // Current sub goal total. var subGoalReason = ''; // Current reason for sub goal total. var debugFlag = false; // internal debug state: false (off by default) var devFlag = false; // internal dev hl state: false (off by default) var hliteFlag = true; // on (true) by default for COLOR_HIGHLIGHT. var lockFlag = false; // off (false) by default for passed room toggler. var sgoalFlag = false; // off (false) by default; sub goal is nonactive/active var mgoalFlag = false; var schatFlag = false; // Used by '/schat' command to suppress public chat. var spassFlag = false; // Used by '/spass' command to suppress password send. var toffFlag = false; // Used by '/tipsoff' to suppress the tip total info // from being written to the info panel. var hcamFlag = false; // Indicates 'hidden cam' show is on or off. var soverFlag = false; // Sell no tickets. var endFlag = false; // End of show. var emailFlag = false; // Turns on/off email detection in tip note. var paidList = new Array(); var viewerList = new Array(); var addList = new Array(); var silList = new Array(); var userTipTotals = {}; var startTime = new Date(); /************* API *************/ cb.settings_choices = [{ name: 'goal', type: 'int', minValue: 0, label: "Token Goal (optional)", required: false },{ name: 'show_description', type: 'str', minLength: 1, maxLength: 255, defaultValue: "", label: "Show Description (optional)", required: false },{ name: 'buyin', type: 'int', minValue: 1, defaultValue: 25, label: "Ticket Price" },{ name: 'hidetips', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'No', label: "Hide tip total from viewers?" },{ name: 'showviewers', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes', label: "*NEW* Show the no. of ticket holders in the room?" },{ name: 'showtype', type: 'choice', choice1: 'Hidden Cam', choice2: 'Password', defaultValue: 'Hidden Cam', label: "Type of show?" },{ name: 'password', type: 'str', minLength: 1, maxLength: 255, defaultValue: "", label: "Enter password (no spaces) - NOT required for Hidden Cam", required: false },{ name: 'include_mods', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes', label: "Moderators can add/del users (and themselves) to list?" },{ name: 'autoadd_mods', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'No', label: "Automatically give Mods a ticket when they enter the room?" },{ name: 'autoadd_fans', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'No', label: "Automatically give Fanclub Members a ticket when they enter?" }]; /***** cb.settings_choices end *****/ if (cb.settings.showtype === 'Hidden Cam') spassFlag = true; if (cb.settings.hidetips === 'Yes') toffFlag = true; if (cb.settings.goal > 0) toffFlag = false; cb.onTip(function(tip) { var ticketFlag = false; var tipAmount = parseInt(tip['amount']); var tUser = tip['from_user']; var tMsg = tip['message']; // TRACKTIPPERS // if ( (cb.settings.cum_tips === 'Yes') && (!cb.limitCam_userHasAccess(tUser)) ) { // cumulativeTips(tUser,tipAmount); // } // track total tips total_tipped += tipAmount; if ((total_tipped >= cb.settings.goal) && !mgoalFlag) { cb.sendNotice(appName + " says: GOAL ACHIEVED! Thanks to all tippers.",'','',COLOR_RED,'bold'); cb.settings.goal = 0; mgoalFlag = true; } if (sgoalFlag) { subGoalTot += tipAmount; if ( subGoalTot >= subGoal ) { cb.sendNotice(appName + " says: SUB GOAL ACHIEVED! Thanks to all tippers.",'','',COLOR_RED,'bold'); sgoalFlag = false; cb.drawPanel(); defaultSubject(); } } // track viewers for ticketed show if ((tipAmount >= cb.settings.buyin) && !endFlag) { if (!cb.limitCam_userHasAccess(tUser)) { cb.sendNotice("* Ticket sold to '" + tUser + "'",'','',COLOR_NOTICE,'bold'); user('add',tUser,true); paidList.push(tUser); ticketFlag = true; if (spassFlag) { cb.sendNotice(dashLine+"\n* You will be able to view the 'Hidden Cam' show.\n"+dashLine,tUser,COLOR_HIGHLIGHT,COLOR_NOTICE,'bold'); } if (emailFlag) { if (tMsg.indexOf("@") < 0 || tMsg.indexOf(".") < 0) { cb.sendNotice("* You may have forgotten your email address in the tip note.",tUser,'',COLOR_RED,'bold'); cb.sendNotice("* Viewer '" +tUser+ "' may have forgotten to put email address in the tip note.",theBC,COLOR_HVBACK,COLOR_HVTEXT,'bold'); cb.sendNotice("* Viewer '" +tUser+ "' may have forgotten to put email address in the tip note.",'','',COLOR_MOD,'bold','red'); } } } } cb.drawPanel(); }); cb.onDrawPanel(function(user) { var row1label = ""; var row1val = ""; if (cb.settings.goal) { row1label = "Total Tips / Goal"; row1val = "" + total_tipped + " / " + cb.settings.goal; } else { row1label = "Tips Received:"; row1val = "" + total_tipped; } if (sgoalFlag) { if (cb.settings.showviewers === 'Yes') return { 'template': '3_rows_of_labels', 'row1_label': "Tickets/Viewing:", 'row1_value': cb.limitCam_allUsersWithAccess().length + " / " + viewerList.length, 'row2_label': "Ticket price:", 'row2_value': cb.settings.buyin, 'row3_label': "Sub Goal: Tips / Goal", 'row3_value': subGoalTot + " / " + subGoal } else return { 'template': '3_rows_of_labels', 'row1_label': "Tickets Holders:", 'row1_value': cb.limitCam_allUsersWithAccess().length, 'row2_label': "Ticket price:", 'row2_value': cb.settings.buyin, 'row3_label': "Sub Goal: Tips / Goal", 'row3_value': subGoalTot + " / " + subGoal } } else if (soverFlag && !endFlag) { if (cb.settings.showviewers === 'Yes') return { 'template': '3_rows_of_labels', 'row1_label': "Tickets/Viewing:", 'row1_value': cb.limitCam_allUsersWithAccess().length + " / " + viewerList.length, 'row2_label': "", 'row2_value': "", 'row3_label': "", 'row3_value': "" } else return { 'template': '3_rows_of_labels', 'row1_label': "Tickets Holders:", 'row1_value': cb.limitCam_allUsersWithAccess().length, 'row2_label': "", 'row2_value': "", 'row3_label': "", 'row3_value': "" } } else if (endFlag) { return { 'template': '3_rows_11_21_31', 'row1_value': "The show is over.", 'row2_value': "Ticket sales have", 'row3_value': "been suspended.", } } else if (toffFlag) { if (cb.settings.showviewers === 'Yes') return { 'template': '3_rows_of_labels', 'row1_label': "Tickets/Viewing:", 'row1_value': cb.limitCam_allUsersWithAccess().length + " / " + viewerList.length, 'row2_label': "Ticket price:", 'row2_value': cb.settings.buyin, 'row3_label': "", 'row3_value': "" } else return { 'template': '3_rows_of_labels', 'row1_label': "Tickets Holders:", 'row1_value': cb.limitCam_allUsersWithAccess().length, 'row2_label': "Ticket price:", 'row2_value': cb.settings.buyin, 'row3_label': "", 'row3_value': "" } } else { if (cb.settings.showviewers === 'Yes') return { 'template': '3_rows_of_labels', 'row1_label': row1label, 'row1_value': row1val, 'row2_label': "Tickets/Viewing:", 'row2_value': cb.limitCam_allUsersWithAccess().length + " / " + viewerList.length, 'row3_label': "Ticket price:", 'row3_value': cb.settings.buyin } else return { 'template': '3_rows_of_labels', 'row1_label': row1label, 'row1_value': row1val, 'row2_label': "Tickets Holders:", 'row2_value': cb.limitCam_allUsersWithAccess().length, 'row3_label': "Ticket price:", 'row3_value': cb.settings.buyin } } }); // Viewer entry cb.onEnter(function(viewer) { // Variables var u = viewer['user']; var isMod = viewer['is_mod']; var isFan = viewer['in_fanclub']; // Is the room password locked? if (lockFlag === true && !cb.limitCam_isRunning()) { // if this is a password show .. // The script assumes the room is passworded, // Check if the user has NOT paid for a ticket if (!user('check',u) && u != theBC) { // Inform the passworded room we have a party crasher cb.sendNotice("Room Crasher! '" + u + "' does NOT have a ticket!",u,'',COLOR_RED,'bold'); } } if (user('check',u)) { viewerList.push(u); cb.drawPanel(); } // Show entering viewer how long the show has been in progress. if (hcamFlag) { getShowTime(u); } if (soverFlag && !endFlag) { cb.sendNotice(dashLine + "\n* THE SHOW IS ABOUT TO END OR IS OVER. BUYING A TICKET NOW IS NOT RECOMMENDED.\n" + dashLine,u,'',COLOR_RED,'bold'); } // Automatically add Moderator to the ticket list if (isMod) { if (cb.settings.autoadd_mods === 'Yes') { if (!user('check',u)) { user('add',u,true); cb.drawPanel(); cb.sendNotice(dashLine+"\n* You've automatically been added to the ticket list because you are a moderator. :woohoo\n"+dashLine,u,COLOR_HIGHLIGHT,COLOR_NOTICE,'bold'); } } cb.sendNotice(newTeaser,u,COLOR_HIGHLIGHT,COLOR_NOTICE,'bold'); } // Automatically add Fanclub Member to the ticket list if ( (cb.settings.autoadd_fans === 'Yes') && (isFan === true) ) { if (!user('check',u)) { user('add',u,true); cb.drawPanel(); cb.sendNotice(dashLine+"\n* You've automatically been added to the ticket list because you're in the fan club. :woohoo\n" +dashLine,u,COLOR_HIGHLIGHT,COLOR_NOTICE,'bold'); } } }); cb.onLeave(function(viewer) { var u = viewer['user']; if (cbjs.arrayContains(viewerList,u)) { cbjs.arrayRemove(viewerList,u); cb.drawPanel(); } }); cb.onMessage(function (msg) { // Don't change these to constants .. (phat) var regexCommandSplit = '^' + commandPrefix + '(\\S+)(?:\\b\\s*)(.*)?'; var regexListSplit = /[,\s]+/; // split the chat message into a command, "cmd" and its parameters "cmdval" // further splits cmdval into array "cmdValArray" var reCmdSplit = new RegExp(regexCommandSplit); var cmdSplit = msg['m'].match(reCmdSplit); var cmd; var cmdval; var cmdValArray; if ( cmdSplit ) { cmd = cmdSplit[1]; cmdval = cmdSplit[2]; if ( cmdval != null ) { cmdval = cmdval.replace(/^\s+|\s+$/g,''); } if ( cmdval != null ) { cmdValArray = cmdval.split(regexListSplit); } else { cmdValArray = ''; } } // for convenience var m = msg['m']; var u = msg['user']; var isMod = msg['is_mod']; var isBC = (u == theBC); var isCR = (u == cr); if (m[0] == "?" || m[0] == "!") { msg['X-Spam'] = true; return cb.sendNotice("* " +appName+ ": Incorrect command prefix.",u,'',COLOR_MOD,'bold'); } if (cb.limitCam_isRunning() && !cb.limitCam_userHasAccess(u) && !isBC && !isMod && (u!=cr) && schatFlag) { msg['m'] = ":huh"; msg['X-Spam'] = true; cb.sendNotice("* A hidden cam show is in progress and public chat messages are suppressed.",u,'',COLOR_NOTICE,'bold'); } if (cmdval && (cmdval[0] === "<")) { msg['X-Spam'] = true; return cb.sendNotice(dashLine+"\n* The < and > are not required. Please re-enter.\n"+dashLine,u,'',COLOR_RED,'bold'); } if (cbjs.arrayContains(silList,u)) { msg['X-Spam'] = true; return; } /***** Ok, let's start processing commands *****/ switch (cmd) { /******************* * Viewer Commands * *******************/ /***** Command List ***** /cmds *****/ case COMMAND_CMDS: cb.sendNotice(getCommandList(u,isMod),u,'',COLOR_INFO,'bold'); break; /***** Ticket List ***** /tickets *****/ case COMMAND_TICKETS: if (debugFlag) cb.sendNotice(debug(msg,true),u,'',COLOR_INFO,'bold'); if (debugFlag) cb.sendNotice(debug(u,false),u,'',COLOR_INFO,'bold'); cb.sendNotice(n3 + "\n" + (cb.limitCam_allUsersWithAccess().length < 1 == true ? "* No tickets sold!" : cbjs.arrayJoin(cb.limitCam_allUsersWithAccess(),", ")) + "\n\n* Ticket holders: " + cb.limitCam_allUsersWithAccess().length + "\n" + n4,u,'',COLOR_NOTICE,'bold'); break; /***** Get Password ***** /pass *****/ case COMMAND_PASSWORD: if (user('check',msg['user']) || isBC) { if (spassFlag) { cb.sendNotice("* You are on the ticket list and will see the show when it starts.",u,'',COLOR_NOTICE,'bold'); } else { sendPasswordToUser(msg['user']); } } else { // Paid = no, tell the viewer to pay first cb.sendNotice("* You must buy a ticket to get access to the show.",msg['user'],'',COLOR_NOTICE,'bold'); } break; /***** Get Time Left ***** /timeleft *****/ case COMMAND_TIMELEFT: if (timerStarted) cb.sendNotice("* Less than " + timerMinutes + " minutes remaining to buy a ticket for " +cb.settings.buyin+ " before the show starts!",u,'',COLOR_RED,'bold'); else cb.sendNotice("* No goal timer is running.",u,'',COLOR_NOTICE,'bold'); break; case COMMAND_SHOWTIME: if (hcamFlag) getShowTime(u); else cb.sendNotice("* No Hidden Cam show is currently in progress.",u,'',COLOR_NOTICE,'bold'); break; /************************************** * Moderator and Broadcaster Commands * **************************************/ /***** Send Password ***** /sendpw *****/ case COMMAND_SENDPW: if (isMod || isBC) { if (cmdval === "?") { var sendpwHelp = "\n"; sendpwHelp += "Usage: "+commandPrefix+COMMAND_SENDPW+" <user>\n"; sendpwHelp += "Use '"+commandPrefix+COMMAND_SENDPW+"' to resend the password to all ticket holders. If the optional <user> argument is supplied, the password is sent ONLY to that viewer. The password CANNOT be sent to any non-ticket holders.\n"; msg['X-Spam'] = true; return cb.sendNotice(sendpwHelp,u,'',COLOR_INFO,'bold'); } if (cmdval) { // is cmdval a ticketed user? if so, we can send the pass, else complain if (user('check',cmdval)) { sendPasswordToUser(cmdval); cb.sendNotice("* Password sent to '" + cmdval + "'.",u,'',COLOR_NOTICE,'bold'); } else { cb.sendNotice("* User '" + cmdval + "' does NOT have a ticket.",u,'',COLOR_NOTICE,'bold'); } } else { // Only send password if there's at least 1 ticket holder if (cb.limitCam_allUsersWithAccess().length > 0) { sendPasswordToUsers(); cb.sendNotice("* Password sent to all ticket holders",'','',COLOR_NOTICE,'bold'); } else { cb.sendNotice("* Password not sent, no tickets have been sold",'','',COLOR_NOTICE,'bold'); } } } else { // if it is a viewer, and a ticket holder, re-send the password if (user('check',msg['user'])) { // has paid for a ticket, send viewer the pass sendPasswordToUser(msg['user']); } else { // has not paid for a ticket, tell the user to pay first cb.sendNotice("* You must buy a ticket to get the password",u,'',COLOR_ERROR,'bold'); } } break; /***** Add user(s) ***** /add *****/ case COMMAND_ADD: case COMMAND_AU: // is the user a mod, or the broadcaster, or a viewer? if ((isMod && cb.settings.include_mods == 'Yes') || isBC) { // if an argument was given,.. if (cmdval === "?") { var addHelp = "\n"; addHelp += "Usage: "+commandPrefix+COMMAND_ADD+" <user1 user2 user3 etc>\n"; addHelp += "Use '"+commandPrefix+COMMAND_ADD+"' and its alias to manually add a viewer or viewers to the ticket holder list. If no <user> is specified, the command issuer is added if the broadcaster allows.\n"; addHelp += "The output from the '"+commandPrefix+COMMAND_TICKETS+"' command can be copied and saved periodically in case the App crashes. Once the App is restarted, the '"+commandPrefix+COMMAND_ADD+"' command can be issued and the saved list pasted in after the command to restore the ticket holder list.\n"; addHelp += "Alias: "+commandPrefix+COMMAND_AU+ " = [a]dd [u]ser.\n"; msg['X-Spam'] = true; return cb.sendNotice(addHelp,u,'',COLOR_INFO,'bold'); } if (cmdval) { if (cmdValArray.length > 1) { // We are adding multiple viewers at once // for each user in array, add the user to the ticket list cb.sendNotice("* Mass adding users to the ticket list",u,'',COLOR_NOTICE,'bold'); for (var i=0; i<cmdValArray.length; i++) { if ( !user('check',cmdValArray[i]) ) { // User is not yet on the list user('add',cmdValArray[i],false); // And add the user (without sending the pass) if (!cbjs.arrayContains(addList,cmdValArray[i])) addList.push(cmdValArray[i]); cb.sendNotice("* Added: '" + cmdValArray[i] + "'.",u,'',COLOR_SUCCESS,''); // say who. cb.sendNotice("* '"+cmdValArray[i]+"' you have been added to the ticket holders list.",cmdValArray[i],'',COLOR_NOTICE,'bold'); } else { // Safe to assume we don't have to add this user? cb.sendNotice("* Skipped: '" + cmdValArray[i] + "' is already on the list.",u,'',COLOR_SYNTAX); } } // end for cb.sendNotice("* Mass adding completed - Viewers Notified.",u,'',COLOR_NOTICE,'bold'); // Kinda nice to know we're done cb.sendNotice("* Type " + commandPrefix + COMMAND_TICKETS + " to confirm, or " + commandPrefix + COMMAND_SENDPW + " to give the ticket holders the password",u,'',COLOR_NOTICE,'bold'); cb.sendNotice("* Mod '" + u + "' mass-added viewers: " + cbjs.arrayJoin(cmdValArray,", ") + " to the ticket holders list.",theBC,'',COLOR_SYNTAX,''); // inform broadcaster } else { if ( user('check',cmdval) ) { cb.sendNotice("* Skipped: '" + cmdval + "' is already on the list.",u,'',COLOR_NOTICE,'bold'); } else { // We are just adding one viewer user('add',cmdval,true); if (!cbjs.arrayContains(addList,cmdval)) addList.push(cmdval); // Inform viewer cb.sendNotice("* '" + cmdval + "' you have been added to the ticket holders list.",cmdval,'',COLOR_NOTICE,'bold'); // Inform adder cb.sendNotice("* Viewer '" + cmdval + "' added to the ticket list.",u,'',COLOR_NOTICE,'bold'); // Inform broadcaster cb.sendNotice("* Viewer '" + cmdval + "' added to the ticket list by '" + u + "'.",theBC,'',COLOR_SYNTAX,''); } } // end if +cmdValArray.length } else { // No user(s) provided, the mod is adding him/herself to the list: // Before we add, check if the user is already on the list. // Make sure we send the password if ( !user('check',msg['user']) ) { user('add',msg['user'],true); // inform broadcaster that a mod took a free ticket cb.sendNotice("* Mod '" + msg['user'] + "' added themself to ticket list.",theBC,'',COLOR_SYNTAX,''); } else { // the user is already on the list, skip cb.sendNotice("* Oops, '" + msg['user'] + "', it seems you are already on the ticket list.",msg['user'],'',COLOR_SYNTAX,''); } } // end if cmdval } else { if (isMod) { cb.sendNotice("* The broadcaster has disabled this command for moderators.",u,'',COLOR_NOTICE,'bold'); } else { cb.sendNotice(ONLY_MODERATORS,u,'',COLOR_NOTICE,'bold'); } } // end if isMod/bcaster/viewer cb.drawPanel(); // Update the panel below the broadcaster window break; /***** Add to paidList ***** /addp *****/ case COMMAND_ADDP: if (isMod || isBC) { if (cmdval) { paidList.push(cmdval); } } break; /***** Delete User ***** /del *****/ case COMMAND_DEL: case COMMAND_DU: if ((isMod && cb.settings.include_mods === 'Yes') || isBC) { if (cmdval === "?") { var delHelp = "\n"; delHelp += "Usage: "+commandPrefix+COMMAND_DEL+" <user>\n"; delHelp += "Use '"+commandPrefix+COMMAND_DEL+"' and its alias to manually delete a viewer from the ticket holder list.\n"; delHelp += "Alias: "+commandPrefix+COMMAND_DU+ " = [d]elete [u]ser.\n"; msg['X-Spam'] = true; return cb.sendNotice(delHelp,u,'',COLOR_INFO,'bold'); } if (cmdval) { // Is the requested user really a ticket holder? if (user('check',cmdval)) { // Yes user('del',cmdval); cbjs.arrayRemove(addList,cmdval); cb.sendNotice("* Viewer '" + cmdval + "' removed from the ticket list.",u,'',COLOR_NOTICE,'bold'); cb.sendNotice("* Viewer '" + cmdval + "' removed from the ticket list by '" + u + "'.",theBC,'',COLOR_SYNTAX,''); // inform broadcaster } else { // No cb.sendNotice("* Viewer '" + cmdval + "' is not on the ticket list.",u,'',COLOR_ERROR,'bold'); } } else { cb.sendNotice('* Syntax: '+commandPrefix+COMMAND_DEL+' <user>',u,'',COLOR_SYNTAX,'bold'); } } else { if (isMod) { cb.sendNotice("* The broadcaster has disabled this command for moderators.",u,'',COLOR_NOTICE,'bold'); } else { cb.sendNotice(ONLY_MODERATORS,u,'',COLOR_NOTICE,'bold'); } } cb.drawPanel(); break; /***** Delete from paidList ***** /delp *****/ case COMMAND_DELP: if (isMod || isBC) { if (cmdval) { cbjs.arrayRemove(paidList,cmdval); } } break; /***** Highlight Text Toggle ***** /hl *****/ case COMMAND_HILITE: case COMMAND_HL: if (isMod || isBC) { if (cmdval === "?") { var hlHelp = "\n"; hlHelp += "Usage: "+commandPrefix+COMMAND_HILITE+" <on>\n"; hlHelp += "The '"+commandPrefix+COMMAND_HILITE+"' command and its alias toggles the state of the text highlighting for ticket holders ON and OFF depending on the current state. It is ON by default when the App is started to allow easy identification of ticket holders. The optional <on> argument forces the highlight state ON, no matter what state it is currently in.\n"; hlHelp += "Alias: "+commandPrefix+COMMAND_HL + " = [h]i[l]ite.\n"; msg['X-Spam'] = true; return cb.sendNotice(hlHelp,u,'',COLOR_INFO,'bold'); } if (!cmdval) { // toggle if (hliteFlag == true) { // hl setHighlight(false); } else { // hl setHighlight(true); } } else { // forced toggle if (cmdval == 'on') { // hl on setHighlight(true); } else { // hl off setHighlight(false); } } if (!isBC) { cb.sendNotice("* Highlighting of ticket holders is now " + (hliteFlag == true ? "ON." : "OFF."),u,'',COLOR_NOTICE,'bold'); } cb.sendNotice("* Highlighting of ticket holders is now " + (hliteFlag == true ? "ON." : "OFF."),theBC,COLOR_HVBACK,COLOR_HVTEXT,'bold'); } else { cb.sendNotice(ONLY_MODERATORS,u,'',COLOR_NOTICE,'bold'); } break; /***** Suppress Public Chat ***** /schat *****/ case COMMAND_SCHAT: if (isMod || isBC) { if (cmdval === "?") { var schatHelp = "\n"; schatHelp += "Usage: "+commandPrefix+COMMAND_SCHAT+" <on>\n"; schatHelp += "The '"+commandPrefix+COMMAND_SCHAT+"' command toggles the suppression of the public chat ON and OFF when in 'hidden cam' mode. It is OFF by default when the App is started. The optional <on> argument forces the chat suppression ON, no matter what state it is currently in.\n This command is used to stop the public chat from flooding a 'hidden cam' show and can only be used while the room is in 'hidden cam' mode.\n"; msg['X-Spam'] = true; return cb.sendNotice(schatHelp,u,'',COLOR_INFO,'bold'); } if (cb.limitCam_isRunning()) { if (!cmdval) { if (schatFlag == false) { schatFlag = true; } else { schatFlag = false; } } else { // forced toggle if (cmdval == 'on') { schatFlag = true; } else { schatFlag = false; } } if (!isBC) { cb.sendNotice("* Suppression of public chat is now " + (schatFlag == true ? "ON." : "OFF."),u,'',COLOR_NOTICE,'bold'); } cb.sendNotice("* Suppression of the public chat is now " + (schatFlag == true ? "ON." : "OFF."),theBC,COLOR_HVBACK,COLOR_HVTEXT,'bold'); } else { cb.sendNotice("* 'Hidden Cam' must be active for this command to be used",u,'',COLOR_NOTICE,'bold'); } } else { cb.sendNotice(ONLY_MODERATORS,u,'',COLOR_NOTICE,'bold'); } break; /***** Suppress Password Send ***** /spass *****/ case COMMAND_SPASS: if (isMod || isBC) { if (cmdval === "?") { var spassHelp = "\n"; spassHelp += "Usage: "+commandPrefix+COMMAND_SPASS+" <on>\n"; spassHelp += "The '"+commandPrefix+COMMAND_SPASS+"' command toggles the suppression of the password send when selling tickets for a 'hidden cam' show ON and OFF. It is OFF by default when the App is started. The optional <on> argument forces the password send suppression ON, no matter what state it is currently in.\n This command is used to suppress the sending of passwords when selling tickets for a 'hidden cam' show.\n Does NOT affect password sends via '/pass' or '/sendpw'.\n"; msg['X-Spam'] = true; return cb.sendNotice(spassHelp,u,'',COLOR_INFO,'bold'); } if (!cmdval) { if (spassFlag == false) { spassFlag = true; } else { spassFlag = false; } } else { if (cmdval == 'on') { // Force 'ON' spassFlag = true; } else { spassFlag = false; } } if (!isBC) { cb.sendNotice("* Suppression of password send is now " + (spassFlag == true ? "ON." : "OFF."),u,'',COLOR_NOTICE,'bold'); } cb.sendNotice("* Suppression of password send is now " + (spassFlag == true ? "ON." : "OFF."),theBC,COLOR_HVBACK,COLOR_HVTEXT,'bold'); } else { cb.sendNotice(ONLY_MODERATORS,u,'',COLOR_NOTICE,'bold'); } break; /***** Suppress Tip Total in Panel ***** /tipsoff *****/ case COMMAND_TIPSOFF: if (isMod || isBC) { if (cmdval === "?") { var tipsoffHelp = "\n"; tipsoffHelp += "Usage: "+commandPrefix+COMMAND_TIPSOFF+" <on>\n"; tipsoffHelp += "The '"+commandPrefix+COMMAND_TIPSOFF+"' command toggles the suppression of the total tips display in the info panel ON and OFF. It is OFF by default when the App is started. The optional <on> argument forces the suppression ON, no matter what state it is currently in.\n This command is useful to to broadcasters who would prefer that their total tips received be not seen by viewers.\n"; msg['X-Spam'] = true; return cb.sendNotice(tipsoffHelp,u,'',COLOR_INFO,'bold'); } if (!cmdval) { if (toffFlag == false) { toffFlag = true; } else { toffFlag = false; } } else { if (cmdval == 'on') { // Force 'ON' toffFlag = true; } else { toffFlag = false; } } cb.drawPanel(); if (!isBC) { cb.sendNotice("* Suppression of 'tip total' is now " + (toffFlag == true ? "ON." : "OFF."),u,'',COLOR_NOTICE,'bold'); } cb.sendNotice("* Suppression of 'tip total' is now " + (toffFlag == true ? "ON." : "OFF."),theBC,COLOR_HVBACK,COLOR_HVTEXT,'bold'); } else { cb.sendNotice(ONLY_MODERATORS,u,'',COLOR_NOTICE,'bold'); } break; /***** Lock Room ***** /lock *****/ case COMMAND_LOCK: // Is the user doing /lock the broadcaster or a moderator? if (isMod || isBC) { // Is the room public? if (cmdval === "?") { var lockHelp = "\n"; lockHelp += "Usage: "+commandPrefix+COMMAND_LOCK+" <on>\n"; lockHelp += "Use '"+commandPrefix+COMMAND_LOCK+"' after passwording a room to enable detection of the entry of non-ticket holders i.e 'room crashers'.\n"; lockHelp += "The '"+commandPrefix+COMMAND_LOCK+"' command toggles the lock state ON or OFF depending on the current state. It is OFF by default when the App is started. The optional <on> argument forces the lock state ON, no matter what state it is currently in.\n"; msg['X-Spam'] = true; return cb.sendNotice(lockHelp,u,'',COLOR_INFO,'bold'); } if (!cb.limitCam_isRunning()) { if (!cmdval) { if (lockFlag == false) { setLock(true); // Set to: Assume we are in a passworded room cb.changeRoomSubject(appName + " says: Enjoy the show everybody, and please tip if you do! " + typeCmds); } else { setLock(false); // Set to: Assume we are in a public room } } else { if (cmdval == 'on') { setLock(true); // Set to: Assume we are in a passworded room } else { setLock(false); // Set to: Assume we are in a public room } } if (!isBC) { cb.sendNotice("* " + appName + " will now assume the room is "+(lockFlag == true ? "passworded." : "public."),u,'',COLOR_NOTICE,'bold'); } cb.sendNotice("* " + appName + " will now assume the room is " +(lockFlag == true ? "passworded." : "public."),theBC,COLOR_HVBACK,COLOR_HVTEXT,'bold'); } else { cb.sendNotice("* The '"+commandPrefix+COMMAND_LOCK+"' command cannot be used during a 'Hidden Cam' show.",u,'',COLOR_NOTICE,'bold'); } } else { // If the user is not the broadcaster or a moderator, inform the viewer // that this command is for the broadcaster only. cb.sendNotice(ONLY_MODERATORS,u,'',COLOR_NOTICE,'bold'); } break; /***** Verify Viewer ***** /check *****/ case COMMAND_CHECK: // is the user a mod, or the broadcaster, or a viewer? if (isMod || isBC) { // if an argument was given,.. if (cmdval === "?") { var checkHelp = "\n"; checkHelp += "Usage: "+commandPrefix+COMMAND_CHECK+" <user1 user2 user3 etc>\n"; checkHelp += "Use '"+commandPrefix+COMMAND_CHECK+"' to manually check if a viewer or viewers are valid ticket holders.\n"; msg['X-Spam'] = true; return cb.sendNotice(checkHelp,u,'',COLOR_INFO,'bold'); } if (cmdval) { if (cmdValArray.length > 1) { // We are checking a list, not just one viewer // for each user in array, check the user against the ticket list cb.sendNotice("* Checking a list of users against the ticket list: "+cmdValArray.toString(),u,'',COLOR_NOTICE,'bold'); for (var i=0; i<cmdValArray.length; i++) { if (!user('check',cmdValArray[i])) { cb.sendNotice("* Checked: User ''" + cmdValArray[i] + "' does NOT have a ticket.",u,'',COLOR_ERROR,'bold'); } else { cb.sendNotice("* Checked: User '" + cmdValArray[i] + "' has a ticket.",u,'',COLOR_SUCCESS,''); } } cb.sendNotice("* Checking completed.",u,'',COLOR_NOTICE,'bold'); } else { // We are checking just one viewer // check if cmdval has paid for a ticket or is a party crasher if (user('check',cmdval)) { // true (party boy) cb.sendNotice("* Checked: User '" + cmdval + "' has a ticket.",u,'',COLOR_SUCCESS,'bold'); } else { // false (party crasher) cb.sendNotice("* Checked: User '" + cmdval + "' does NOT have a ticket.",u,'',COLOR_ERROR,'bold'); } // end if isTicketed(cmdval) } // end if +cmdValArray.length } else { cb.sendNotice("* Syntax: " + commandPrefix + COMMAND_CHECK + " <user1,user2,user3> ",u,'',COLOR_SYNTAX,'bold'); } // end if cmdval } else { cb.sendNotice(ONLY_MODERATORS,u,'',COLOR_NOTICE,'bold'); } // end if isMod/bcaster/viewer break; /***** Display FAQ ***** /faq *****/ case COMMAND_FAQ: if (isMod || isBC) { cb.sendNotice("Can I turn off the ticket holders highlighting?",u,'',COLOR_INFO,'bold'); cb.sendNotice("Yes, by typing: " + commandPrefix + COMMAND_HL,u,'',COLOR_INFO,''); blankLine(u); cb.sendNotice("Can I manually add a user to the ticket list?",u,'',COLOR_INFO,'bold'); cb.sendNotice("Yes, you can by typing: " + commandPrefix + COMMAND_ADD + " <user>",u,'',COLOR_INFO,''); blankLine(u); cb.sendNotice("Can I manually add a group of users to the ticket list?",u,'',COLOR_INFO,'bold'); cb.sendNotice("Yes, you can by typing: " + commandPrefix + COMMAND_ADD + " <user1 user2 user3>",u,'',COLOR_INFO,''); blankLine(u); cb.sendNotice("How can I catch 'room crashers'?",u,'',COLOR_INFO,'bold'); cb.sendNotice("When your room is in password mode only, type " + commandPrefix +COMMAND_LOCK + " and they will be announced as they enter.",u,'',COLOR_INFO,''); cb.sendNotice("Optionally you can type: " + commandPrefix + COMMAND_CHECK + " <user>.",u,'',COLOR_INFO,''); blankLine(u); cb.sendNotice("What other commands are available?",u,'',COLOR_INFO,'bold'); cb.sendNotice("You can by type: " + commandPrefix + COMMAND_CMDS + " for all the available commands.",u,'',COLOR_INFO,''); blankLine(u); } else { cb.sendNotice(ONLY_MODERATORS,u,'',COLOR_NOTICE,'bold'); } break; /***** Send Public Notice ***** /ctn *****/ case COMMAND_CTN: case 'n': if (isMod || isBC || (isCR && devFlag)) { if (cmdval) { cb.sendNotice("* " + cmdval,'','',COLOR_NOTICE,'bold'); } else { cb.sendNotice("* Syntax: " + commandPrefix + COMMAND_CTN + " <some text here>",u,'',COLOR_SYNTAX,'bold'); } } else { cb.sendNotice(ONLY_MODERATORS,u,'',COLOR_NOTICE,'bold'); } break; /***** Message to Broadcaster *****/ case COMMAND_CTB: if (isMod || (isCR && devFlag)) { if (cmdval) { cb.sendNotice("* "+ (isMod ? u.toUpperCase() + ": " : "--- CrazyTicket App Support --- *\n* ") + cmdval,theBC,COLOR_HVBACK,COLOR_HVTEXT,'bold'); cb.sendNotice("* "+ (isMod ? u.toUpperCase() + ": " : "--- CrazyTicket App Support --- *\n* ") + cmdval,u,COLOR_HVBACK,COLOR_HVTEXT,'bold'); } else { cb.sendNotice("* Syntax: " + commandPrefix + COMMAND_CTB + " <some text here>",u,'',COLOR_SYNTAX,'bold'); } } else { cb.sendNotice(ONLY_MODERATORS,u,'',COLOR_NOTICE,'bold'); } break; /***** Message to Ticketholders *****/ case COMMAND_CTT: if (isMod || isBC || (isCR && devFlag)) { if (cmdval) { if (cb.limitCam_allUsersWithAccess().length > 1) { var tempArray = cb.limitCam_allUsersWithAccess(); for (var i=0; i<cb.limitCam_allUsersWithAccess().length; i++) { cb.sendNotice("* "+cmdval,tempArray[i],'',COLOR_NOTICE,'bold'); } cb.sendNotice("* Message sent to all ticket holders",u,'',COLOR_NOTICE,'bold'); } else { cb.sendNotice("* Message not sent, no tickets have been sold",u,'',COLOR_NOTICE,'bold'); } } else { cb.sendNotice("* Syntax: " + commandPrefix + COMMAND_CTT + " <some text here>",u,'',COLOR_SYNTAX,'bold'); } } break; /***** Message to Mods *****/ case COMMAND_CTM: if (isMod || (isCR && devFlag)) { if (cmdval) { cb.sendNotice("* "+ (isMod ? u.toUpperCase() + ": " : "--- CrazyTicket App Support --- *\n* ") + cmdval,'',COLOR_HVBACK,COLOR_HVTEXT,'bold','red'); cb.sendNotice("* "+ (isMod ? u.toUpperCase() + ": " : "--- CrazyTicket App Support --- *\n* ") + cmdval,u,COLOR_HVBACK,COLOR_HVTEXT,'bold'); } else { cb.sendNotice("* Syntax: " + commandPrefix + COMMAND_CTM + " <some text here>",u,'',COLOR_SYNTAX,'bold'); } } else { cb.sendNotice(ONLY_MODERATORS,u,'',COLOR_NOTICE,'bold'); } break; /***** Start Goal Timer ***** /starttimer *****/ case COMMAND_STARTTIMER: if (isMod || isBC) { if (timerStarted) { cb.sendNotice("* Timer already running.",u,'',COLOR_NOTICE,'bold'); } else { if (cmdval) startTimer(cmdval); else cb.sendNotice("* Please provide countdown time in minutes.",u,'',COLOR_NOTICE,'bold'); } } else { cb.sendNotice(ONLY_MODERATORS,u,'',COLOR_NOTICE,'bold'); } break; /***** Start Hidden Cam Show ***** /startshow *****/ case COMMAND_STARTSHOW: if ((isBC || isMod) && (!cb.limitCam_isRunning())) { var nowTime = new Date(); cb.sendNotice("* '" + theBC + "' has started the show!",'','',COLOR_NOTICE,'bold'); cb.sendNotice("* Please do not deactivate " + appName + " until after you end your show with the '" +commandPrefix+COMMAND_STOPSHOW+ "' command.\n\n* Also, it is NOT a good idea to password the room as viewers can still buy a ticket for a short while after the password is applied but will NOT receive the password.",theBC,COLOR_HVBACK,COLOR_HVTEXT,'bold'); cb.limitCam_start(appName + " says:\n\n'Hidden Cam' show in progress."); cb.changeRoomSubject(appName + " says: Hidden Cam show in progress. Tip " + cb.settings.buyin + " tokens to see the show. " + typeCmds); setLock(false); hcamFlag = true; soverFlag = false; endFlag = false; cb.drawPanel(); hiddTime = Date.now(); // msg['X-Spam'] = true; } else { cb.sendNotice(ONLY_MODERATORS,u,'',COLOR_NOTICE,'bold'); } break; /***** Stop Hidden Cam Show ***** /stopshow *****/ case COMMAND_STOPSHOW: if (isBC || isMod) { if (cb.limitCam_isRunning()) { cb.sendNotice("* '" + theBC + "' has ended the show after " + ((Date.now() - hiddTime)/60000).toFixed(2) + " minutes.",'','',COLOR_NOTICE,'bold'); cb.limitCam_stop(); cb.changeRoomSubject(appName + " says: Hidden Cam show has ended. " + typeCmds); cb.sendNotice("* The show has been ended and ticket sales suspended.\* To continue selling tickets use the /newshow command.",theBC,COLOR_HVBACK,COLOR_HVTEXT,'bold'); hcamFlag = false; endFlag = true; soverFlag = true; cb.drawPanel(); hiddTime = 0; } else { cb.sendNotice("* No Hidden Cam show is currently in progress.",u,'',COLOR_NOTICE,'bold'); } } else { cb.sendNotice(ONLY_MODERATORS,u,'',COLOR_NOTICE,'bold'); } break; /***** Recommend not buying a ticket ***** /showover *****/ case COMMAND_SHOWOVER: if (isBC || isMod) { if (cmdval === "?") { var notickHelp = "\n"; notickHelp += "Usage: "+commandPrefix+COMMAND_SHOWOVER+"\n"; notickHelp += "Use '"+commandPrefix+COMMAND_SHOWOVER+"' when nearing the end of a Hidden Cam show. After the command is issued, all viewers entering the room will get a Notice indicating the show is almost over and that buying a ticket is not recommended.\n"; notickHelp += "The '"+commandPrefix+COMMAND_SHOWOVER+"' command toggles the sending of the message ON or OFF depending on the current state. It is OFF by default when the App is started.\n"; msg['X-Spam'] = true; return cb.sendNotice(notickHelp,u,'',COLOR_INFO,'bold'); } if (cb.limitCam_isRunning()) { if (!soverFlag) { soverFlag = true; cb.drawPanel(); cb.sendNotice("* The show is about to end. Buying a ticket now is not recommended.",u,'',COLOR_RED,'bold'); cb.changeRoomSubject(appName + " says: The show is about to end. Buying a ticket now is not recommended." + typeCmds); } else { soverFlag = false; } if (!isBC) { cb.sendNotice("* A 'nearing end of show' message will " +(soverFlag == true ? "be sent " : "NOT be sent ") + "to viewers entering the room.",u,'',COLOR_NOTICE,'bold'); } cb.sendNotice("* A 'nearing end of show' message will " +(soverFlag == true ? "be sent " : "NOT be sent ") + "to viewers entering the room.",theBC,COLOR_HVBACK,COLOR_HVTEXT,'bold'); } else { cb.sendNotice("* This command can only be used during a Hidden Cam show.",u,'',COLOR_NOTICE,'bold'); } } else { cb.sendNotice(ONLY_MODERATORS,u,'',COLOR_NOTICE,'bold'); } break; case COMMAND_SHOWEND: if (isBC || isMod) { if (cb.limitCam_isRunning()) { if (!endFlag) { endFlag = true; cb.drawPanel(); // cb.sendNotice("\n* The show has ended. Ticket sales are suspended.\n",u,'',COLOR_RED,'bold'); cb.changeRoomSubject(appName + " says: The show has ended. Ticket sales are suspended." + typeCmds); } else { endFlag = false; cb.drawPanel(); } } else { cb.sendNotice("* This command can only be used during a Hidden Cam show.",u,'',COLOR_NOTICE,'bold'); } } else { cb.sendNotice(ONLY_MODERATORS,u,'',COLOR_NOTICE,'bold'); } break; /***** Turn price display ON/OFF ***** /newshow *****/ case COMMAND_NEWSHOW: if (isBC || isMod) { if (soverFlag) { soverFlag = false; endFlag = false; cb.sendNotice("* Ticket sales are turned ON.",u,'',COLOR_NOTICE,'bold'); cb.sendNotice("* Ticket sales are turned ON.",theBC,COLOR_HVBACK,COLOR_HVTEXT,'bold'); defaultSubject(); } else { soverFlag = true; endFlag = true; cb.sendNotice("* Ticket sales are suspended.",u,'',COLOR_NOTICE,'bold'); cb.sendNotice("* Ticket sales are suspended.",theBC,COLOR_HVBACK,COLOR_HVTEXT,'bold'); } cb.drawPanel(); } else { cb.sendNotice(ONLY_MODERATORS,u,'',COLOR_NOTICE,'bold'); } break; /***** Display ticket holders in room ***** /viewers *****/ case COMMAND_VIEWERS: if (isBC || isMod) { if (cb.settings.showviewers === 'Yes') { cb.settings.showviewers = 'No'; cb.sendNotice("* Display of Ticket Holders in room is OFF.",u,'',COLOR_NOTICE,'bold'); cb.sendNotice("* Display of Ticket Holders in room is OFF.",theBC,COLOR_HVBACK,COLOR_HVTEXT,'bold'); } else { cb.settings.showviewers = 'Yes'; cb.sendNotice("* Display of Ticket Holders in room is ON.",u,'',COLOR_NOTICE,'bold'); cb.sendNotice("* Display of Ticket Holders in room is ON.",theBC,COLOR_HVBACK,COLOR_HVTEXT,'bold'); } cb.drawPanel(); } else { cb.sendNotice(ONLY_MODERATORS,u,'',COLOR_NOTICE,'bold'); } break; /***** Change room subject ***** /subject ****/ case COMMAND_SUBJECT: if (isMod) { if (cmdval) { cb.changeRoomSubject(cmdval+ ". "); } else { cb.sendNotice("* Syntax: " + commandPrefix + COMMAND_SUBJECT + " <some text here>",u,'',COLOR_SYNTAX,'bold'); } } else { cb.sendNotice(ONLY_MODERATORS,u,'',COLOR_NOTICE,'bold'); } break; /***** Change room subject with leader and trailer ***** /ctsubject *****/ case COMMAND_CTSUBJECT: if (isMod) { if (cmdval) { cb.changeRoomSubject(appName+ " says: " +cmdval+ ". " +typeCmds); } else { cb.sendNotice("* Syntax: " + commandPrefix + COMMAND_CTSUBJECT + " <some text here>",u,'',COLOR_SYNTAX,'bold'); } } else { cb.sendNotice(ONLY_MODERATORS,u,'',COLOR_NOTICE,'bold'); } break; /***** Show paid ticket list ***** /plist *****/ case COMMAND_PLIST: cb.sendNotice(dashLine+"\n* Paid ticket holders: " + paidList.length + "\n"+dashLine+"\n"+ (paidList.length < 1 == true ? "* No tickets sold!" : cbjs.arrayJoin(paidList,"\n "))+"\n"+dashLine,u,'',COLOR_NOTICE,'bold'); break; /***** Show paid ticket list ***** /plistw *****/ case COMMAND_PLISTW: cb.sendNotice(dashLine+"\n* Paid ticket holders: " + paidList.length + "\n"+dashLine+"\n"+ (paidList.length < 1 == true ? "* No tickets sold!" : cbjs.arrayJoin(paidList,", "))+"\n"+dashLine,u,'',COLOR_NOTICE,'bold'); break; /***** Show viewers list ***** /vlist *****/ case COMMAND_VLIST: cb.sendNotice(dashLine+"\n* Ticket holders currently viewing: " + viewerList.length + "\n"+dashLine+"\n"+cbjs.arrayJoin(viewerList,", ")+"\n"+dashLine,u,'',COLOR_NOTICE,'bold'); break; /***** Show added list ***** /alist *****/ case COMMAND_ALIST: cb.sendNotice(dashLine+"\n* Manually added ticket holders: " + addList.length + "\n"+dashLine+"\n"+cbjs.arrayJoin(addList,", ")+"\n"+dashLine,u,'',COLOR_NOTICE,'bold'); break; case COMMAND_NEW: if (isBC || isMod) { cb.sendNotice(whatsNew,u,'',COLOR_NOTICE,'bold'); } else { cb.sendNotice(ONLY_MODERATORS,u,'',COLOR_NOTICE,'bold'); } break; case COMMAND_EMAIL: if (isMod || isBC) { if (emailFlag) emailFlag = false; else emailFlag = true; cb.sendNotice("* Detection of email in tip note is now " + (emailFlag == true ? "ON." : "OFF."),'','',COLOR_NOTICE,'bold','red'); cb.sendNotice("* Detection of email in tip note is now " + (emailFlag == true ? "ON." : "OFF."),theBC,COLOR_HVBACK,COLOR_HVTEXT,'bold'); } else { cb.sendNotice(ONLY_MODERATORS,u,'',COLOR_NOTICE,'bold'); } break; case COMMAND_SIL: if (isMod || isBC) { if (cmdval) { if (!cbjs.arrayContains(silList,cmdval)) { silList.push(cmdval); } } } break; case COMMAND_UNSIL: if (isMod || isBC) { if (cmdval) { cbjs.arrayRemove(silList,cmdval); } } break; case COMMAND_SLIST: if (isMod || isBC) { cb.sendNotice(dashLine+"\n* "+appName+" Silenced: "+silList.length+"\n"+dashLine+"\n"+ (silList.length < 1 == true ? "* Empty." : cbjs.arrayJoin(silList,", "))+"\n"+dashLine,u,'',COLOR_NOTICE,'bold'); } break; /***************************** * Broadcaster-only Commands * *****************************/ /***** Change Password ***** /changepw *****/ case COMMAND_CHANGEPW: if (isBC) { if (cmdval === "?") { var changepwHelp = "\n"; changepwHelp += "Usage: " + commandPrefix + COMMAND_CHANGEPW + " newpass\n"; changepwHelp += "Use '" + commandPrefix + COMMAND_CHANGEPW + "' to change the password in the event of a security breach i.e. 'room crashers'. The 'newpass' is then sent automatically to all ticket holders."; msg['X-Spam'] = true; return cb.sendNotice(changepwHelp,u,'',COLOR_INFO,'bold'); } if (cmdval) { // temporary fix to not spam broadcaster with just changed pass //user('del',theBC); // handle old pass if (password_override == null) { var old_pass = cb.settings.password; } else { var old_pass = password_override; } // handle new pass setPassword(cmdval); // inform broadcaster cb.sendNotice("* Password changed from '" + cb.settings.password + "' to '" + cmdval + "'. Let's inform the chat room.",u,COLOR_HVBACK,COLOR_HVTEXT,'bold'); // inform the chat room cb.sendNotice("* [NEW PASSWORD SET] --> Sending new password to all ticket holders (DON'T FORGET TO COPY IT YOURSELF!!).",theBC,COLOR_HVBACK,COLOR_HVTEXT,'bold'); sendPasswordToUsers(); // temporary fix to not spam broadcaster with just changed pass //user('add',theBC,false); } else { // no newpass was provided, inform the broadcaster how to use the command cb.sendNotice("* Syntax: " + commandPrefix + COMMAND_CHANGEPW + " <newpass>.",theBC,'',COLOR_SYNTAX,'bold'); } } else { cb.sendNotice(ONLY_BROADCASTER,u,'',COLOR_NOTICE,'bold'); } break; /***** Change ticket price ***** /ctprice *****/ case COMMAND_CTPRICE: if (isBC) { if (cmdval) { cb.settings.buyin = cmdval; cb.drawPanel(); cb.sendNotice(dashLine+ "\n* The ticket price has been changed to " +cmdval+ " tokens.\n" +dashLine,'','',COLOR_RED,'bold'); if (cb.limitCam_isRunning()) { cb.changeRoomSubject(appName + " says: Hidden Cam show in progress. Tip " + cb.settings.buyin + " tokens to see the show. " + typeCmds); } else { defaultSubject(); } } else { cb.sendNotice("* After /ctprice please enter a space then a number representing the new ticket price.",theBC,COLOR_HVBACK,COLOR_HVTEXT,'bold'); } } else { cb.sendNotice(ONLY_BROADCASTER,u,'',COLOR_NOTICE,'bold'); } break; /***** Set Token Goal ***** /subgoal *****/ case COMMAND_SUBGOAL: if (isBC) { // Only do this if the user is the broadcaster if (cmdval === "?") { var setgoalHelp = "\n"; setgoalHelp += "Usage: " + commandPrefix + COMMAND_SUBGOAL + " <tokens> <description>\n"; setgoalHelp += "The '" + commandPrefix + COMMAND_SUBGOAL + "' command allows a separate sub goal for the number of <tokens> specified to run without having to stop " +appName+ ". An optional <description> can be supplied to explain the purpose of the goal. If <tokens> is not specified, any existing goal is cleared and normal mode will resume.\n"; msg['X-Spam'] = true; return cb.sendNotice(setgoalHelp,u,'',COLOR_INFO,'bold'); } subGoal = 0; subGoalTot = 0; var subGoalAmount = cmdValArray[0]; // if first argument to /setgoal is bigger or equal to integer 10 if (subGoalAmount >= 1) { // if there is a tokenamount .. (and the room lock is on) sgoalFlag = true; // toggle sgoalFlag to on (true) subGoal = subGoalAmount; // 1st argument: number (check int?) if (cmdValArray.length > 1) { subGoalReason = ""; for (var i=1; i<cmdValArray.length; i++) { subGoalReason += cmdValArray[i] + ' '; // space included to split words } cb.changeRoomSubject(appName + " says: Sub Goal: " + subGoal + " tokens for " + subGoalReason + ". " + typeCmds); } else { cb.changeRoomSubject(appName + " says: Sub Goal: " + subGoal + " tokens. " + typeCmds); } cb.sendNotice("A sub goal can be ended typing: " + commandPrefix + COMMAND_SUBGOAL + " (without any arguments).",theBC,COLOR_HVBACK,COLOR_HVTEXT,'bold'); cb.sendNotice("A sub goal will end automatically if the goal amount is reached via tips.",theBC,COLOR_HVBACK,COLOR_HVTEXT,'bold'); cb.drawPanel(); // update draw panel } // We type just: /setgoal (no arguments) // there is no tokenamount .. and we're still in passworded show if (!subGoalAmount) { // if there is no subGoal running and broadcaster does /setgoal // then spit out Syntax: cmd args if (sgoalFlag == false) { cb.sendNotice("* Syntax: " + commandPrefix + COMMAND_SUBGOAL + " <tokenamount> <description>.",theBC,'',COLOR_SYNTAX,'bold'); cb.sendNotice("* Example1: " + commandPrefix + COMMAND_SUBGOAL + " 500 (starts a new sub goal of 500 tokens) .",theBC,'',COLOR_SYNTAX,'bold'); cb.sendNotice("* Example2: " + commandPrefix + COMMAND_SUBGOAL + " 500 boobs and ass (starts a new sub goal of 500 tokens to show boobs and ass) .",theBC,'',COLOR_SYNTAX,'bold'); } else { sgoalFlag = false; // toggle to off (false) subGoal = 0; // reset to 0 subGoalTot = 0; // reset to 0 cb.sendNotice(appName + " says: Sub Goal has been stopped.",'','',COLOR_RED,'bold'); cb.drawPanel(); // update draw panel defaultSubject(); } } } else { // user isn't the broadcaster, complain cb.sendNotice(ONLY_BROADCASTER,u,'',COLOR_NOTICE,'bold'); } break; /***** Live support ***** /support *****/ case COMMAND_SUPPORT: if (isBC) { if (theBC == cb.room_slug) { theBC = cr; cb.sendNotice(dashLine+"\n* Developer room control is now in effect.\n"+dashLine,cb.room_slug,COLOR_HVBACK,COLOR_HVTEXT,'bold'); cb.sendNotice(dashLine+"\n* Developer room control is now in effect.\n"+dashLine,theBC,COLOR_HIGHLIGHT,COLOR_NOTICE,'bold'); } else { theBC = cb.room_slug; cb.sendNotice(dashLine+"\n* Developer room control is no longer in effect.\n* You now have control once again.\n"+dashLine,theBC,COLOR_HVBACK,COLOR_HVTEXT,'bold'); cb.sendNotice(dashLine+"\n* Developer room control is no longer in effect.\n"+dashLine,cr,COLOR_HIGHLIGHT,COLOR_NOTICE,'bold'); } } else { cb.sendNotice(ONLY_BROADCASTER,u,'',COLOR_NOTICE,'bold'); } break; /***** Start from scratch ***** /ctreset *****/ case COMMAND_CTRESET: if (isBC) { soverFlag = false; endFlag = false; total_tipped = 0; cb.limitCam_removeAllUsers(); while (paidList.length > 0) paidList.pop(); while (viewerList.length > 0) viewerList.pop(); while (addList.length > 0) addList.pop(); cb.sendNotice(dashLine+"\n* "+appName+" has been reset and is ready for a new show.\n"+dashLine,theBC,COLOR_HVBACK,COLOR_HVTEXT,'bold'); cb.drawPanel(); } else { cb.sendNotice(ONLY_BROADCASTER,u,'',COLOR_NOTICE,'bold'); } break; } /*** switch ***/ /* // TRACKTIPPERS if (cmd==COMMAND_TIPPERS) { if (isBC) { if (debugFlag) { cb.sendNotice(debug(userTipCnt,true),u,'',COLOR_INFO,'bold'); } // cb.sendNotice(n3 + '\n' + (userTipCnt.length < 1 == true ? "No tippers yet!" : cbjs.arrayJoin(userTipCnt.,", ")) + "\n" + n4,u,'',COLOR_NOTICE,'bold'); cb.sendNotice(nl + '\nTipper List:\n' + nl,u); if (userTipCnt.length === 0) { cb.sendNotice('** No tippers yet \n' + nl,u); } else { userTipCnt.sort(function(a,b){ return a[1] - b[1]; }); } for (var i = 0; i<userTipCnt.length; i++) { cb.sendNotice(userTipCnt[i].name + '\t\t- ' + userTipCnt[i].value + '\n',u); } } } // end if msg alltiper list */ /******************************* * Censorship and Highlighting * *******************************/ /* Censorship */ // Catch and surpress the password when ANY viewer tries to spit it out in the channel if ((password_override && m.search(rePasswordOverride) != -1) || m.search(rePassword) != -1 ) { if (cb.settings.password) { // fix for: don't censor broadcaster who's changing the password if ( (!isBC) && (cmd != COMMAND_CHANGEPW) ) { cb.sendNotice("* " + appName + " says: Apparently viewer '" + u + "' tried to say the password in chat. The message was blocked and did not show in the chat.",theBC,COLOR_HVBACK,COLOR_HVTEXT,'bold' ); // inform broadcaster cb.sendNotice("* " + appName + " says: The original message was '" + msg['m'] + "'.",theBC,COLOR_HVBACK, COLOR_HVTEXT,'bold' ); // inform broadcaster msg['m'] = 'derp'; // supress msg visually } if ( (isBC) && (cmd != COMMAND_CHANGEPW) ) { cb.sendNotice("* " + appName + " says: Warning '" + u + "'! you just said the password in chat. " + appName + " caught it, the message was blocked and did not show in the chat.",theBC,COLOR_HVBACK,COLOR_HVTEXT,'bold' ); cb.sendNotice("* " + appName + " says: '" + u + "', if you wish to send the password to all ticket holders, try: " +commandPrefix+COMMAND_SENDPW,theBC,COLOR_HVBACK,COLOR_HVTEXT,'bold' ); } msg['X-Spam'] = true; return msg; } } /* Highlighting */ // Ticket Holder Highlight if (user('check',msg['user'])) { if (hliteFlag) msg['background'] = COLOR_HIGHLIGHT; } // Developer Highlight if ( (u===cr||u===ph||u===te||u===pe) && (devFlag) ) { msg['background'] = COLOR_DEVELOPER; // Message-background-colour if (debugFlag) cb.sendNotice(debug(msg,true),u,'',COLOR_INFO,'bold'); } if (u===bli) msg['background'] = '#DDFFCC'; /* Dev Dump */ // Internal command for debugging purposes if (cmd==CD) { if (u===cr||u===ph||u===te||u===pe) { var date = new Date(); switch(cmdval){case 'dev':if(devFlag)devFlag=false;else devFlag=true;break;case 'debug':if(debugFlag)debugFlag=false;else debugFlag=true;break;default: cb.sendNotice("* App info: (Name: "+appName+"), (Type: "+appType+"), (Version: "+SCRIPT_VERSION+", Build: "+SCRIPT_BUILD+"), (debug: "+debugFlag+")\n(Time started: "+startTime+")\n(Time now: "+date+")\n* Room info: (Broadcaster: "+theBC+"), (Show type: "+(cb.settings.showtype=="Hidden Cam"?"hidden":"password")+"), (limit cam running?: "+cb.limitCam_isRunning()+"), (hilite: "+(hliteFlag==true?"on":"off")+"), (Total tipped: " +total_tipped+ ")\n* Settings: (Goal: " +cb.settings.goal+ "), (goal descr: " +cb.settings.show_description+ "), (Buy-in: " +cb.settings.buyin+ "), (Password?: "+(cb.settings.password==""?"no":"yes")+"),\n* (Include_mods: "+cb.settings.include_mods+"), Auto-add: (mods: "+cb.settings.autoadd_mods+") (fans: "+cb.settings.autoadd_fans+"), (Sub goal running?: " +(sgoalFlag==true?"yes":"no")+ "), (amount: "+subGoalTot+ "/" +subGoal+"), (reason: '" +subGoalReason+ "')\n* Flags: (hliteFlag: "+hliteFlag+"), (lockFlag: "+lockFlag+"), (sgoalFlag: "+sgoalFlag+"), (schatFlag: "+schatFlag+"), (spassFlag: "+spassFlag+"), (toffFlag: "+toffFlag+"), (soverFlag: "+soverFlag+"), (endFlag: "+endFlag+"), (emailFlag: "+emailFlag+")",u,'',COLOR_INFO,''); } } // end if u||u||u } // end if cmd=cd if (m[0] == commandPrefix) msg['X-Spam'] = true; //suppress all command echoing in chat return msg; // we are done with everything, tada }); // End of cb.onMessage(function (msg) ------------------ /********** Functions **********/ function getCommandList(u,isMod) { var cmdlist = n2; // line above list // Viewers Commands cmdlist += "\n" + commandPrefix + COMMAND_TICKETS + " - Shows a list of ticket holders."; cmdlist += "\n"; cmdlist += "\n" + commandPrefix + COMMAND_PASSWORD + " - Notifies the ticket holder if they have show access."; cmdlist += "\n"; cmdlist += "\n" + commandPrefix + COMMAND_TIMELEFT + " - Displays the remaining time on the goal timer."; cmdlist += "\n"; cmdlist += "\n" + commandPrefix + COMMAND_SHOWTIME + " - Displays the length of time a Hidden Cam show has been in progress."; // Moderator, or Broadcaster only Commands if (isMod || u == theBC) { cmdlist += "\n"; cmdlist += "\n" + commandPrefix + COMMAND_SENDPW + " <user> - If no <user> is specified, the password is resent to all ticket holders."; cmdlist += "\n"; // Only show these commands to the moderators // If the broadcaster selected to include mods .. // Always show to the broadcaster if ( (cb.settings.include_mods === 'Yes') || u == theBC ) { cmdlist += "\n" + commandPrefix + COMMAND_ADD + " <user> or <user1 user2 etc> - Manually adds one or more viewers to ticket holder list. Type '/add ?' for expanded help."; cmdlist += "\n"; cmdlist += "\n" + commandPrefix + COMMAND_DEL + " <user> - Manually removes <user> from the ticket holder list. Type '/del ?' for expanded help."; } // end if cb.settings.include_mods cmdlist += "\n"; cmdlist += "\n" + commandPrefix + COMMAND_CHECK + " <user> or <user1 user2 etc> - Checks if the <user> is a ticket holder. Type '/check ?' for expanded help."; cmdlist += "\n"; cmdlist += "\n" + commandPrefix + COMMAND_PLIST + " - Displays a list of only the paid ticket holders in a list format." cmdlist += "\n"; cmdlist += "\n" + commandPrefix + COMMAND_PLISTW + " - Displays a list of only the paid ticket holders in a wide format." cmdlist += "\n"; cmdlist += "\n" + commandPrefix + COMMAND_EMAIL + " - Tells "+appName+" to check for an email address in the tip note. Alerts the viewer, mods and broadcaster if email is missing"; cmdlist += "\n"; cmdlist += "\n" + commandPrefix + COMMAND_HILITE + " - Toggles the text highighting for ticket holders on/off. Type '/hl ?' for expanded help."; cmdlist += "\n"; cmdlist += "\n" + commandPrefix + COMMAND_LOCK + " - An on/off toggle that tells the script the room has been password locked. Type '/lock ?' for expanded help."; cmdlist += "\n"; cmdlist += "\n" + commandPrefix + COMMAND_SCHAT + " <on> - Suppresses public chat during a 'hidden cam' show. Type '/schat ?' for expanded help."; cmdlist += "\n"; cmdlist += "\n" + commandPrefix + COMMAND_SPASS + " <on> - Suppresses the sending of the password when a ticket is purchased. Type '/spass ?' for expanded help."; cmdlist += "\n"; cmdlist += "\n" + commandPrefix + COMMAND_TIPSOFF + " <on> - Suppresses the total tips display in the info panel. Type '/tipsoff ?' for expanded help."; cmdlist += "\n"; cmdlist += "\n" + commandPrefix + COMMAND_STARTTIMER+ " <minutes> - Starts a goal countdown timer for the number of <minutes> specified."; cmdlist += "\n"; cmdlist += "\n" + commandPrefix + COMMAND_STARTSHOW + " - Starts a hidden cam show, letting only ticket holders see the cam feed. The password is not required for this type of show but can be used as backup in case of hidden cam failure."; cmdlist += "\n"; cmdlist += "\n" + commandPrefix + COMMAND_STOPSHOW + " - Stops any hidden cam show in progress, suspends ticket sales and returns to normal public mode."; cmdlist += "\n"; cmdlist += "\n" + commandPrefix + COMMAND_SHOWOVER + " - Sends a 'nearing end of show' message to viewers entering the room during a Hidden Cam show. Type '/showover ?' for expanded help."; cmdlist += "\n"; cmdlist += "\n" + commandPrefix + COMMAND_SHOWEND + " - Clearly indicates to viewers that even though the room cam is still hidden, the show has ended and ticket sales have been suspended."; cmdlist += "\n"; cmdlist += "\n" + commandPrefix + COMMAND_NEWSHOW + " - Restarts ticket sales after a show has been ended."; cmdlist += "\n"; cmdlist += "\n" + commandPrefix + COMMAND_SUBJECT + " <text> - Allows mods to change the room subject. New subject is displayed verbatim."; cmdlist += "\n"; cmdlist += "\n" + commandPrefix + COMMAND_CTSUBJECT + " <text> - Allows mods to change the room subject. New subject is displayed with 'CrazyTicket says:' leader and 'Type /cmds' trailer."; cmdlist += "\n"; cmdlist += "\n" + commandPrefix + COMMAND_CTN + " <text> - Sends a one time notice to the chat."; cmdlist += "\n"; cmdlist += "\n" + commandPrefix + COMMAND_CTM + " <text> - Sends a private notice to the mods as a group."; cmdlist += "\n"; cmdlist += "\n" + commandPrefix + COMMAND_CTB + " <text> - Sends a private notice to the broadcaster."; cmdlist += "\n"; cmdlist += "\n" + commandPrefix + COMMAND_CTT + " <text> - Sends a private notice to all ticket holders."; cmdlist += "\n"; cmdlist += "\n" + commandPrefix + COMMAND_FAQ + " - FAQ for the staff and starter information about the App."; cmdlist += "\n"; cmdlist += "\n" + commandPrefix + COMMAND_NEW + " - Lists any new features in " +appName+ "."; } // end if moderator+broadcaster // Broadcaster-only Commands if (u == theBC) { cmdlist += "\n"; cmdlist += "\n" + commandPrefix + COMMAND_CHANGEPW + " <newpass> - Changes the password to <newpass> and sends it to all ticket holders. Type '/changepw ?' for expanded help."; cmdlist += "\n"; cmdlist += "\n" + commandPrefix + COMMAND_CTPRICE + " <newprice> - Changes the ticket price to <newprice>."; cmdlist += "\n"; cmdlist += "\n" + commandPrefix + COMMAND_SUBGOAL + " <tokens> - Starts a separate sub goal for the number of <tokens> specified while " +appName+ " is running. Type '/subgoal ?' for expanded help"; cmdlist += "\n"; cmdlist += "\n" + commandPrefix + COMMAND_CTRESET + " - Clears all ticker holder lists and prepares"+appName+" for ticket sales for a new show."; } // end if broadcaster cmdlist += "\n" + n4; // line below list return cmdlist; } // Default room subject function defaultSubject() { if (cb.settings.show_description) { cb.changeRoomSubject(appName + " says: " + cb.settings.show_description + typeCmds); } else { cb.changeRoomSubject(appName + " says: Tip " + cb.settings.buyin + " tokens to buy a show ticket." + typeCmds); } } // Blank line function blankLine(u) { cb.sendNotice("",u,'','#fff',''); } // Get current HC show length function getShowTime(u) { cb.sendNotice(dashLine+"\n* Hidden Cam show in progress for " + ((Date.now() - hiddTime)/60000).toFixed(2) + " minutes.\n"+dashLine,u,COLOR_HIGHLIGHT,COLOR_NOTICE,'bold'); } // Print content of Object function printObject(o) { var out=''; for (var p in o) { out += '('+p+': '+o[p]+'), '; } return out; } /** * How to use debug() * Example: if (debugFlag) { cb.sendNotice(debug(msg,true),u,'',COLOR_INFO,'bold'); } * debug(something,true|false) * true=array|false=var/const/string * To turn on debug: /dump debug (gives no visual output, but toggles debugFlag from false to true) **/ function debug(check,type) { var result = "Debug: "; if (type===true) { result += printObject(check); } else { result += check; } return result; } /** * User Handling **/ function user(command,user,sendpass) { if ( (command == 'add') && (!cb.limitCam_userHasAccess(user)) ) { cb.limitCam_addUsers([user]); // API array if (!cbjs.arrayContains(viewerList,user)) viewerList.push(user); // Viewer array if (sendpass == true && !spassFlag) { sendPasswordToUser(user); } // end if sendpass } // end if add if ( (command == 'del') && (cb.limitCam_userHasAccess(user)) ) { cb.limitCam_removeUsers([user]); // the other array if (cbjs.arrayContains(viewerList,user)) cbjs.arrayRemove(viewerList,user); } // end if del if (command == 'check') { return (cb.limitCam_userHasAccess(user) == true ? true : false); } // end if check } // end function user // Password Group of Functions -------------------------------- // Send the password to everybody function sendPasswordToUsers() { var tempArray = cb.limitCam_allUsersWithAccess(); for (var i=0; i<cb.limitCam_allUsersWithAccess().length; i++) { cb.sendNotice(getPasswordMessageHeader(),tempArray[i],'',COLOR_NOTICE,'bold'); // header cb.sendNotice(getPasswordMessage(),tempArray[i],'',COLOR_RED,'bold'); // pass in color cb.sendNotice(getPasswordMessageFooter(),tempArray[i],'',COLOR_NOTICE,'bold'); // footer } } // Send the password to just one user function sendPasswordToUser(u) { cb.sendNotice(getPasswordMessageHeader(),u,'',COLOR_NOTICE,'bold'); // header cb.sendNotice(getPasswordMessage(),u,'',COLOR_RED,'bold'); // password in color cb.sendNotice(getPasswordMessageFooter(),u,'',COLOR_NOTICE,'bold'); // footer } // FIRST MSG (header) function getPasswordMessageHeader() { var msg1 = n5; // line above everything msg1 += "\n * You will be allowed to join the password show!"; return msg1; } // SECOND MSG (has password in color) function getPasswordMessage() { var msg2 = " :woohoo The PASSWORD ----> " + getPassword(); return msg2; } // THIRD MSG (footer) function getPasswordMessageFooter() { var msg3 = " :thumbdown DO NOT share the password please. \n"; msg3 += n4; // line below everything return msg3; } //------------------------------------------------------------- // Used all over the place hehe function getCommandValue(cmd) { var value = null; try { if (cmd.indexOf(' ') > -1) { var cmda = cmd.split(" ",2); value = cmda[1]; } } catch (err) { cb.log("Issue getting command value for " + msg['m']); } return value; } // this stuff doesn't work yet. ignore it for now but dont delete it yet function cumulativeTips(user,tip) { userTipCntZero = []; for (var i = 0; i < userTipCnt.length; i++) { userTipCntZero.push(" " + userTipCnt[i]); } // end for // return userTipCntZero.toString(); cb.sendNotice("debug: "+userTipCntZero.toString()); //cb.sendNotice("Debug(1): userTipCnt.indexOf(user): "+userTipCnt.indexOf(user)); /* explanations: userTipCnt.length === 0 (the array has 0 entries, no user tipped) */ // Is the tipper on the tipper-list already? /* if (userTipCnt.indexOf(user) > -1) { cb.sendNotice("The user seems to be in the array"); // Do not add user to the array again, but update his tip total } else { cb.sendNotice("The user does NOT seem to be in the array"); // Add the user to the array userTipCnt.push({name: user, value: tip}); } cb.sendNotice("Debug(2): userTipCnt.indexOf(user): "+userTipCnt.indexOf(user)); // debug if (userTipCnt.indexOf(user) > -1) { cb.sendNotice("The user is still in the array, all is fine?"); // just checking } else { cb.sendNotice("The user STILL does not seem to be in the array, push went wrong"); } */ /* if (userTipCnt.length === 0) { userTipCnt.push({name: user, value: tip}); } else { var userFound = false; for (var i = 0; i<userTipCnt.length; i++) { if (userTipCnt[i].name == user) { cb.sendNotice("Debug(2): userTipCnt[i].name: "+userTipCnt[i].name); userFound = true; userTipCnt[i].value += tip; cb.sendNotice("Debug(3): userTipCnt[i].value: "+userTipCnt[i].value); break; } } if (userFound == false) { userTipCnt.push({name: user, value: tip}); } } */ // below code not needed? /* if (user in userTipTotals) { userTipTotals[user] = userTipTotals[user] + tip; } else { userTipTotals[user] = tip; } var usertips = userTipTotals[user]; */ } // end function cumulativeTips() // Used by /changepw function setPassword(pw) { password_override = pw; rePasswordOverride = new RegExp(pw, "i"); } // Used by /pass, /sendpass function getPassword() { if (password_override) { return password_override; } else { return cb.settings.password; } } // Used by /hilite toggler function setHighlight(pw) { hliteFlag = pw; } // Used by /lock toggler function setLock(lockState) { lockFlag = lockState; } // Used by /starttimer command function startTimer(mins) { // try { if (parseInt(mins) < 61 && mins > 0) { timerMinutes = mins; timerStarted = true; if (lockFlag === false) { var goalStr = appName + " says: Goal timer started! "; if (cb.settings.show_description) { goalStr += cb.settings.show_description + ". "; } goalStr += "Type " +commandPrefix+COMMAND_TIMELEFT+ " to see the time remaining to buy a ticket for " +cb.settings.buyin+ " tokens! " + typeCmds; cb.changeRoomSubject(goalStr); cb.sendNotice("* " + timerMinutes + " minutes remaining to buy a ticket for " +cb.settings.buyin+ " tokens before the show starts!",'','',COLOR_RED,'bold'); } if (mins <= 10) { cb.setTimeout(timerAdvert, (1 * 60000)); } else { cb.setTimeout(timerAdvert, (2 * 60000)); } } // } catch (err) { // cb.log(err.message); // } } function timerAdvert() { if (timerMinutes <= 10) { timerMinutes--; } else { timerMinutes = timerMinutes - 2; } if (timerMinutes === 0) { timerStarted = false; if (!lockFlag) { cb.sendNotice(dashLine+"\n* "+appName + " says: TIME IS UP!\n"+dashLine,'','',COLOR_RED,'bold'); defaultSubject(); } } else { if (!lockFlag) { //cb.changeRoomSubject(appName + " says: Only " + timerMinutes + " minutes left to tip at least " + cb.settings.buyin + " tokens for a ticket!"); cb.sendNotice("* Less than " + timerMinutes + (timerMinutes > 1 == true ? " minutes" : " minute") + " remaining to buy a ticket for " +cb.settings.buyin+ " tokens before the show starts!",'','',COLOR_RED,'bold'); } if (timerMinutes <= 10) { cb.setTimeout(timerAdvert, (1 * 60000)); // remind every minute when close } else { cb.setTimeout(timerAdvert, (2 * 60000)); // remind every 2 minutes } } } // Used by function init function startAppFAQ() { var info = ""; // start empty info += dashLine+"\n* "+appName + " Version: "+SCRIPT_VERSION+SCRIPT_BUILD+" has started.\n* For basic info, type: " +commandPrefix+COMMAND_FAQ+ ".\n* For all commands type: " +commandPrefix+COMMAND_CMDS+ " \n"+dashLine; blankLine(theBC); cb.sendNotice(info,theBC,'',COLOR_INFO,'bold'); } // Used by function init function showMode() { if (spassFlag) { var hcMode = dashLine+"\n* " + appName + " has started in 'Hidden Cam' mode."; if (cb.settings.password != "") { hcMode += "\n* The password entered will not be sent automatically."; } hcMode += "\n* To change to 'Password' mode, type /spass."; if (cb.settings.password == "") { hcMode += "\n* Then add a password with /changepw."; } hcMode += "\n"+dashLine; cb.sendNotice(hcMode,theBC,COLOR_HVBACK,COLOR_HVTEXT,'bold'); } else { var pwMode = dashLine+"\n* " + appName + " has started in 'Password' mode."; if (cb.settings.password == "") { pwMode += "\n* However you did NOT enter a password.\n* Add a password with /changepw now."; } pwMode += "\n* The password will be automatcally sent.\n* To change to 'Hidden Cam' mode, simply use\n* the /startshow command to start the show."; pwMode += "\n"+dashLine; cb.sendNotice(pwMode,theBC,COLOR_HVBACK,COLOR_HVTEXT,'bold'); } } function init() { rePassword = new RegExp(cb.settings.password, "i"); //user('add',theBC,false); // add broadcaster to the ticketlist startAppFAQ(); // show FAQ to broadcaster only blankLine(theBC); showMode(); //blankLine(); cb.sendNotice("\n* TO THE VIEWER: If you are using an iOS or an Android device, please take note that devices of this type are generally not compatible with Chaturbate Password and Hidden Cam shows UNLESS you have a flash-enabled browser. Please switch to a desktop or laptop computer if you are considering buying a ticket, or you may not be able to view the show.\n",'','',COLOR_NOTICE,'bold'); blankLine(theBC); cb.sendNotice(newTeaser,theBC,COLOR_HVBACK,COLOR_HVTEXT,'bold'); cb.sendNotice(newTeaser,'',COLOR_HIGHLIGHT,COLOR_NOTICE,'bold','red'); if (cb.settings.autoadd_mods === 'Yes') { cb.sendNotice(dashLine+ "\n* The broadcaster has configured " +appName+ " to automatically give moderators a show ticket.\n* You must refresh the page to claim your ticket.\n" +dashLine,'','',COLOR_MOD,'bold','red'); } if (cb.settings.autoadd_fans === 'Yes') { cb.sendNotice(dashLine+ "\n* The broadcaster has configured " +appName+ " to automatically give fans a show ticket.\n* You must refresh the page to claim your ticket.\n" +dashLine,'','',COLOR_FAN,'bold','green'); } defaultSubject(); } /*** Ok, let's kick this thing off ***/ init(); /** ..gspp.. .d$$S$$S$$Sb. dS$$S$$S$PS$$Sb :$$S$S^^'";TSS$$; ; SSP' : T$$SS/; $$ \ `^^'/ :$ `-ggd: :.=-. .-=.:SSS ; <@>` <@> $$$$ : SS$$ ' -. $$S; ' .--. s$$S _ `. `--' .$$S$; .-"" "-._.-'`.__.' $$$S; : :S$$S ; :l "-. '^S$$b /`-. ;: " .--""""""^-. :"-. "" : /) ; ;`- : /: : :`- `. \ / '-.t `+.__ `. ;/ .-' -.; ; "-. "-. : .-" --: ; ;. "^:" .-""-.`.; : -^"`. "-.+' \/ ; `. "- ; : .^. / \ .-" "-. .' `._.-" "-._.-": ; : ; : : : ; \ ; ; : ; ; : ; : : / ; : \ ; ; : : ; ; : : : ; ; ; ; c : : : : ; /""--..__ ; : : ""--..__ ; ; "-. --..__ ""--..__: :`-._ "-._ "" _; ; "-._ """---...---""" : **/
© Copyright Freesexcam 2011- 2024. All Rights Reserved.