Bots Home
|
Create an App
NoFreeloaders
Author:
everlast_69
Description
Source Code
Launch Bot
Current Users
Created by:
Everlast_69
const botName = 'NoFreeloaders'; // No Freeloaders 4 Hottest_evil or anyone that wants to use it. const botVersion = '2.0.0'; const botAuthor = 'everlast_69'; const botDate = '2018/06/24'; // Original work of Ransyd modified everlast_69 // First and foremost. This bot is not my origional work. It is a copy of NF4HH created by Ransyd. // All development kudos go to him. I made some modifications so it would fit into the requirement // Hottest_evil has. I have kept the origional version history. I will start this as version 2.0.0 // as the name has now changed // NoFreeloaders by Everlast_69 // Written for Hottest Evil amd anyone that wants to use it. // Modified from: NF4HH by Ransyd // // v2.0.0 // Renamed bot to NoFreeloaders // added values 16, 26, 76 to minimum tip to view choices. // Changed tip counting to count all tips, not just during hidden shows. // Added option to keep the allowed viewers list instead of clearing the list // //const botName = 'NF4HH'; // No Freeloaders 4 HH //const botVersion = '1.0.30'; //const botAuthor = 'Ransyd'; //const botDate = '2018/05/19'; // NF4HH by Ransyd https://chaturbate.com/ransyd/ // Written for HiddenHeritage https://chaturbate.com/hiddenheritage/ // // Modified from: // Tip Cam by Scrambler // https://chaturbate.com/thescrambler // // With parts from: // Ticket Show Version: 1.0.3 Author: zingknaat // CrazyTicket Lite by CrazyWare // Bomb Bot Ultra 1.6.3 by adambomb01 // Cam_slutt Timer Bot by cam_slutt // // v1.0.30 // Fixed: // Function added in v1.0.29 was also responding to broadcaster chats // v1.0.29 // Added: // If a non-viewer uses 'much', 'many', or 'join' in chat while Hidden Cam is // running a notice will be sent to chat with tokens required/time remaining. // v1.0.28 // Added: // Indicator of auto-added viewers in list (+). // Fixed: // If //xxx, //x was used after start of Hidden Cam new amount wasn't in effect. // v1.0.27 // Added: // Added developer, can only view lists. // 1000 and 1500 choices to Hidden Cam token drop down. // Changed: // Small chat notice changes. // v1.0.26 // Changed: // Removed token amount required from cam window because of the stupid delay // causing people to tip wrong amount. // v1.0.25 // Fixed: // Auto-add Mods/Fans/List was broken if started by //start // v1.0.24 // Added: // Setting to disable Auto-add Mods/Fans/List when //quick is used, (makes // NF4HH work the same as No Freeloaders bot). Viewers can be added using // //add still. This setting does not affect Hidden session started with // //start // v1.0.23 // Changed: // Some of the colour combinations back to original (blue on yellow) // Added: // //quick [tip] - Starts a Hidden Cam immediately with the given <tip> // required to join (Default 100) and starts a countdown // timer of 10 minutes. // v1.0.22 // Added: // //compare - compares viewer names against 'A' list // //assl - list 'A' list // //assa - add to 'A' list // v1.0.21 // Fixed: // Minor grammatical errors // v1.0.20 // Changed: // 'A' list string length increased to 2048 // v1.0.19 // Added: // An 'A' list - it will notify broadcaster if someone on it tips to join. // v1.0.18 // Fixed: // If another //time command was given it would run another timer, changed // so it now just changes the time remaining if a timer is running. // Changed: // When //xxx is used to change tip required to view it now broadcasts // into public chat rather than just notify broadcaster, (did cause // much fun when using sound activated vibe and the viewers didn't know // the new tip was 1 below a threshold). // v1.0.17 // Fixed: // Cumulative tipping was responding to tips before Hidden Cam was started // Added: // Option to automatically block grey chat during session. // Option to highlight users who tipped to view (or if added, tipped passed // threshold during session). // //ntm & //ntf commands. // v1.0.16 // Changed: // //fin stop - resets entry room notice to display token amount and stops // session finished notice. // Stabilised elapsed time in case of cam refresh (modulus 5), sometimes // caused notifications to show only 1 or 2 minutes apart (eg. 10 min // then 11 or 12 min). // v1.0.15 // Fixed: // Accidentally disabled //list command. // v1.0.14 // Fixed: // If countdown reached 0 and then was reset to a new time, Hidden Cam // session finished notices would still be announced in chat. Now they // are canceled until timer hits 0 again. // v1.0.13 // Removed: // Option to specify a message during countdown, now just a generic // 'Session time remaining:' Wasn't really needed since it's a single // purpose bot. // Some redundant code. // Fixed: // Added check for those that have been added by command/list/auto so // they don't get 'Thank you, xxx more tokens are needed ....' message. // The quiet option of the //fin command was not working. // v1.0.12 // Added: // An enhancement to the Cumulative tipping, it will inform users who // don't tip the full access amount, how much remains before they have // cam access. // For those annoying users that can't be bothered reading chat or the bio // and inevitably ask "How much?", they can be asked to tip 1 token they // will then be told the remaining amount required for access. // v1.0.11 // Added: // Option to allow cumulative tipping to gain access to view list. // An example is where a user misreads an access tip of 450 and only // tips 400, with Cumulative tipping enabled, they only need to tip 50 // more to automatically be added to view list, (as opposed to tipping // 50 and having the broadcaster or moderator add them by command). // Changed: // List command (//list) will now display the total tipped by a user in // addition to whether they tipped to join or not. // The tips are only visible to the broadcaster, moderators can only // see if the user tipped to join or not (*). // Fixed: // Typo in addTipperList routine meant users could be added twice to // cb.limitCam access list. // v1.0.10 // Added: // [ex] option to //help - this will display command examples. // [quiet] option to //fin - this will remove the token amount from the // welcome message on room entry but not broadcast the 'DO NOT tip ...' // message in chat every 30 seconds. Effectively Hidden Cam without any // indication of tip amount to unhide it. // //xxx (//x) command to change the token amount required to view cam. // v1.0.9 // Changed: // Timer now notifies at 3 minute intervals unless time remaining is <10. // Notice when a users enters the room and a session is running is changed, // now shows tokens required, elapsed time, remaining time if timer set, // and //help command. // Finished notice kicks in when a countdown reaches 0. // v1.0.8 // Removed: // No longer says that a Hidden Cam session will be starting soon when user // enters the room, (no point), only if one is running. // Added: // Tip choice of 1 token, mainly for testing but also if you just want to // exclude greys and those light blues who sit around with 1 token. // Fixed: // Auto-adding of Fans, (typo error) // v1.0.7 // Removed: // Auto-add fans ... not working at the moment. // Added: // OhMiBod safe level of 499 tokens :) // Cam window tip message removed since Chaturbate is so slow to update it // users were tipping wrong amount at start. Now just says to read // chat for the notifications. // v1.0.6 // Added: // The current session run length is displayed on entry to the room and the // total length is displayed when the //stop command is given. // Session start time is displayed on the cam window (UTC). // Option to have session time notices in chat every 5 minutes. // Added //warn (//w) command to send instructions to chat/user about Flash // use on mobile devices. // v1.0.5 // Added: // Amount to tip is now a drop down selection list. This amount is also // appended to the cam window message - no need to enter separately. // //fin (//f) command which puts a notice into chat every 30 seconds // saying session is finished. // v1.0.4 // Removed: // Redundant code removal // Added: // Shows number of viewers who tipped to view, (not including mod/host // added viewers). // List displays an asterisk (*) next to viewers who have tipped to join. // Viewers who tipped to view and are removed through the //rem command // have to be added back (//add), tipping will not allow them to view // the cam. This is not a bug. // v1.0.3 // Removed: // Redundant code removal. // v1.0.2 // Added: // Add simple countdown timer that puts notices in the chat indicating // end of session. // v1.0.1 // Added: // Add a list of viewers to be added upon //start command. // v1.0.0 // Removed: // Parts that had nothing to do with the Hidden Cam, (spam, no grey chat, // etc). // Added: // Ability for mods to use //add and //remove, (moderators cannot add // themselves, the broadcaster or another moderator needs to do it). // Auto-add mods/fans - defaults to No. // Optional notification when Moderator adds/removes a viewer. // // ----------------------------------------------------------------------------- // Commands: // --- Broadcaster only --- // //start (start hidden cam session) // //stop (stop hidden cam session) // //quick, //q (start hidden cam session quickly) // //xxx, //x (change tip amount to view cam) // --- Broadcaster or Moderator --- // //time, //t <min>|stop (timer control, input number of mins or stop) // //fin, //f [stop|quiet] (send session is finished notice every 30 seconds) // //add, //a (add user to list of approved hidden cam viewers) // //rem, //r (remove user from list of approved hidden cam viewers) // //ntm (sends a notice to just moderators) // //ntf (sends a notice to just fans) // //warn, //w (sends a notice re. using a Flash browser on mobile devices) // --- Anyone --- // //chk, //c (check for a name in list of approved hidden cam viewers) // //list, //l (show list of approved hidden cam viewers, only mods // and host can see who tipped.) // //help, //h (list commands) // ----------------------------------------------------------------------------- // Setup ----------------------------------------------------------------------- const COLOR_BLACK = '#000000'; // Black const COLOR_GOLD = '#F9E60A'; // Gold const COLOR_DGREY = '#222222'; // Dark grey const COLOR_LGREY = '#DDDDDD'; // Light grey const COLOR_DEVELOPER = '#D9F7F7'; // Very light blue: Highlight colour for developers const COLOR_RED = '#FF1407'; // Bright red: Important notice const COLOR_HIGHLIGHT = '#F5EEF8'; // 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 TimeTextColor = '#00FFFF'; // Cyan: Color for timer notices const TimeBGColor = '#0000BB'; // Dark Blue: Background for timer notices const COLOR_DRED = "#BB2222"; const COLOR_LRED = "#FFCCCC"; const COLOR_YELLOW = "#ffff00"; const COLOR_BLUE = "#0000ff"; const ONLY_BROADCASTER = '* Command is only available to the broadcaster.'; const ONLY_MODERATORS = '* Command is only available to moderators and the broadcaster.'; const enterMsg = '--------\n//help - to show list of commands available\n//help ex - for example commands\n--------'; // Global Variables ------------------------------------------------------------ var tipperList = []; var tipArray = []; var dev = '\x65\x76\x65\x72\x6c\x61\x73\x74\x5f\x36\x39'; var addMods = (cb.settings.add_mods == 'Yes'); var addFans = (cb.settings.add_fans == 'Yes'); var viewArray = new Array; // [i] = user's name, list of users who have been added to the view list var cmdNote = (cb.settings.cmd_notify == 'Yes'); var sessionTimer = (cb.settings.session_timer == 'Yes'); var blockGrey = (cb.settings.block_grey == 'Yes'); var disableAuto = (cb.settings.disableAutoAdd == 'Yes'); var u = []; var user = []; var amount = 0; var quickHC = false; var tipAmount = parseInt(cb.settings.cam_amount); var tipSingle = (cb.settings.tip_single == 'Single'); var userHilite = (cb.settings.user_hilite == 'Yes'); var langTokens = (cb.settings.cam_amount > 1) ? 'tokens' : 'token'; var assholeArray = new Array; // [i] = user's name, list of users classified as assholes and host to be notified on room entry var allowAlist = (cb.settings.block_alist == 'Yes'); var reqTokens = cb.settings.cam_amount; var clearList = (cb.settings.clear_list == 'Yes'); var showStarted = false; var tipReq = 'join,many,much,required,tkn,tokens'; String.prototype.trim = function() { return this.replace(/^\s+|\s+$/g,""); } String.prototype.ltrim = function() { return this.replace(/^\s+/,""); } String.prototype.rtrim = function() { return this.replace(/\s+$,/,""); } // Timer variables ------------------------------------------------------------- var startTime; var timeRemaining; var timerRunning = false; var timerCancel = false; var hiddenFinished = false; var firstRun = false; var hitZero = false; // Warning for mobile device users --------------------------------------------- var mobileMsg = ':alert1 -------------------------------------- :alert1\n'; mobileMsg += 'The Chaturbate Mobile site DOES NOT\n'; mobileMsg += 'support Hidden or Private cams.\n'; mobileMsg += '------------\n'; mobileMsg += 'To view Hidden Cam on mobile/tablet\n'; mobileMsg += 'requires a browser that supports Flash.\n'; mobileMsg += ':photonpuffin\n'; mobileMsg += 'PUFFIN: Go to Settings and enable\n'; mobileMsg += '\'Request desktop site\'.\n'; mobileMsg += 'PHOTON: Click the Lightning icon at\n'; mobileMsg += 'top right (Android) or bottom right\n'; mobileMsg += '(iPhone).\n'; mobileMsg += '** Flash is ONLY supported on MAIN\n'; mobileMsg += 'Chaturbate site NOT the mobile site. **\n'; mobileMsg += ':alert1 -------------------------------------- :alert1'; // CB Settings ----------------------------------------------------------------- cb.settings_choices = [{ name: 'cam_amount', type: 'choice', choice1: '16', choice2: '26', choice3: '76', choice4: '100', choice5: '200', choice6: '300', choice7: '400', choice8: '500', choice9: '600', choice10: '700', choice11: '800', choice12: '900', defaultValue: '26', label: 'Tip required to view your cam', required: true }, { name: 'tip_single', type: 'choice', choice1: 'Single', choice2: 'Cumulative', defaultValue: 'Single', label: 'Single tip to join or Cumulative ', required: true }, { name: 'user_hilite', type: 'choice', choice1: 'No', choice2: 'Yes', defaultValue: 'No', label: 'Hilight users who tipped to view (light purple background)', required: true }, { name: 'cmd_notify', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes', label: 'Be notified when a Moderator adds/removes a user', required: true }, { name: 'add_mods', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'No', label: 'Automatically add moderators', required: true }, { name: 'add_fans', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'No', label: 'Automatically add fan club members', required: true }, { name: 'session_timer', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes', label: 'Notify of elapsed session time every 5 minutes', required: true }, { name: 'viewList', type: 'str', minLength: 1, maxLength: 256, defaultValue: '', label: '[Optional] List of users allowed to view when Hidden Cam starts (SEPARATE NAMES WITH COMMA)', required: false }, { name: 'disableAutoAdd', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes', label: 'Disable Auto-add when doing Quick (//q) Hidden Cam, (Auto-adding of Mods, Fans, and List will be disabled - EVERYONE has to tip unless added by //add) ', required: true }, { name: 'block_grey', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes', label: 'Block grey chat during Hidden Cam session', required: true }, { name: 'assholeList', label: 'Asshole List (Users who are classified as assholes)', type: 'str', minLength: 1, maxLength: 4000, defaultValue: '[Optional - Exact usernames, separated by commas]', required: false }, { name: 'block_alist', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'No', label: 'Block Asshole Listed viewers from viewing (Cannot stop them from tipping to join, will still be notified if they tip to join)', required: true },{ name: 'clear_list', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'No', label: 'Clear Access List When Hidden Show Stops? (Users will have to tip again for next hidden show.)', required: true }] // onEnter --------------------------------------------------------------------- cb.onEnter(function(viewer) { u = viewer['user']; var isHost = (cb.room_slug == u); var isMod = viewer['is_mod']; var isDev = (dev == u); if (isDev) { cb.sendNotice('Developer: ' + u, u, COLOR_HVBACK, COLOR_SUCCESS, 'bold', ''); } var isFan = viewer['in_fanclub']; if (addMods && isMod && !quickHC) { addUser(cb.room_slug, u); cb.sendNotice('Welcome ' + u + ', you have been auto-added to the viewing list.', u, COLOR_HVBACK, COLOR_SUCCESS, 'bold', ''); } if (addFans && isFan && !quickHC) { addUser(cb.room_slug, u); cb.sendNotice('Welcome ' + u + ', you have been auto-added to the viewing list.', u, COLOR_HVBACK, COLOR_SUCCESS, 'bold', ''); } advertise(u, isHost, isMod); }); // onMessage ------------------------------------------------------------------- cb.onMessage(function(msg) { //onMessage Variables var user = msg['user']; user = user.toLowerCase(); var msgString = msg['m']; msgString = msgString.toLowerCase(); var isHost = (cb.room_slug == user); var isDev = (dev == user); if (isDev) { cb.sendNotice('Developer: ' + user, user, COLOR_HVBACK, COLOR_SUCCESS, 'bold', ''); } var isMod = msg['is_mod']; var isFan = msg['in_fanclub']; var isGrey = (!msg['has_tokens'] && !isMod && !isFan && !isHost); var isViewer = !(isHost || isMod || isFan); var isCommand = (msgString.search('//') != -1); if (isCommand) { msg['X-Spam'] = true; //Don't send message to chat msg['background'] = COLOR_HVBACK; msg['c'] = COLOR_SYNTAX; var validCmd = 0; var command; // Double slash + first word is the command var param; // Anything after the command is the parameter var cmd_index; // Position of // command identifier var split_index; // Position of the first space character // Split cmd_index = msgString.indexOf('//'); // Find command identifier split_index = msgString.indexOf(' ', cmd_index); // Find first space after command identifier if (split_index > -1) { // Message might have a parameter (could just be padding) command = msgString.substr(cmd_index, (split_index - cmd_index)); // substr (start index, length) param = msgString.substring(split_index + 1).trim(); // Could be empty } else { // Message is a command only command = msgString; param = null; } //Commands ----------------------------------------------------------------- if (validCmd == 0) { validCmd = 1; switch (command) { case '//start': { if (isHost) { quickHC = false; startHidden(user, tipAmount, false); } else { cb.sendNotice(ONLY_BROADCASTER, user, COLOR_HVBACK, COLOR_HVTEXT, 'bold', ''); } break; } case '//stop': { if (isHost) { stopHidden(user); } else { cb.sendNotice(ONLY_BROADCASTER, user, COLOR_HVBACK, COLOR_HVTEXT, 'bold', ''); } break; } case '//quick': case '//q': { if (isHost) { quickHC = true; if (Number(param) > 0) { startHidden(user, param, true); } else { startHidden(user, 200, true); } } else { cb.sendNotice(ONLY_BROADCASTER, user, COLOR_HVBACK, COLOR_HVTEXT, 'bold', ''); } break; } case '//xxx': case '//x': { if (isHost) { if (Number(param) > 0) { if (!cb.limitCam_isRunning()) { tipAmount = Number(param); } else { reqTokens = Number(param); } cb.sendNotice('New token amount required to view cam: ' + param, '', COLOR_HVBACK, COLOR_SUCCESS, 'bold', ''); } } else { cb.sendNotice(ONLY_BROADCASTER, user, COLOR_HVBACK, COLOR_HVTEXT, 'bold', ''); } break; } case '//help': case '//h': { if (isMod || isHost) { if (param === null) { showHelp(user, isHost, isMod, false); } else { showHelp(user, isHost, isMod, true); } } else { showHelp(user, isHost, isMod, false); } break; } case '//warn': case '//w': { if (isMod || isHost) { if (param != '') { cb.sendNotice(mobileMsg, param, '', COLOR_HVTEXT , 'bolder', ''); } else { cb.sendNotice(mobileMsg, '', '', COLOR_HVTEXT , 'bolder', ''); } } else { cb.sendNotice(ONLY_MODERATORS, user, COLOR_HVBACK, COLOR_HVTEXT, 'bold', ''); } break; } case '//ntm': { if (isMod || isHost) { if (param === null) { cb.sendNotice('You gave no message', user, COLOR_HVBACK, COLOR_HVTEXT , 'bold', ''); } else { param = 'ATTN Mods: ' + param; cb.sendNotice(param, '', COLOR_HVBACK, COLOR_HVTEXT, 'bold', 'red'); } } else { cb.sendNotice(ONLY_MODERATORS, user, COLOR_HVBACK, COLOR_HVTEXT, 'bold', ''); } break; } case '//ntf': { if (isMod || isHost) { if (param === null) { cb.sendNotice('You gave no message', user, COLOR_HVBACK, COLOR_HVTEXT , 'bold', ''); } else { param = 'ATTN Fans: ' + param; cb.sendNotice(param, '', COLOR_HVBACK, COLOR_HVTEXT, 'bold', 'green'); } } else { cb.sendNotice(ONLY_MODERATORS, user, COLOR_HVBACK, COLOR_HVTEXT, 'bold', ''); } break; } case '//list': case '//l': { showGuestList(user, isHost, isMod, isDev); break; } case '//chk': case '//c': { if (cb.limitCam_userHasAccess(param)) { cb.sendNotice(param + ' is on the view list!', user, COLOR_HVBACK, COLOR_SUCCESS, 'bold', ''); } else { cb.sendNotice(param + ' is not on the view list!', user, COLOR_HVBACK, COLOR_ERROR, 'bold', ''); } break; } case '//assl': { if (isMod || isHost || isDev) { assList(user, isHost, isMod); } break; } case '//assa': { if (isMod || isHost) { addAss(user, isHost, isMod, param); } break; } case '//compare': case '//comp': { if (isMod || isHost || isHost) { comparelist(user, isHost, isMod); } break; } case '//add': case '//a': { if (isMod || isHost) { if (user != param) { addUser(user, param); } else { notice = 'You can not add yourself! Please ask the\n'; notice += 'Broadcaster or another Moderator to add you.'; cb.sendNotice(notice, user, COLOR_HVBACK, COLOR_ERROR, 'bold', ''); } } else { cb.sendNotice(ONLY_MODERATORS, user, COLOR_HVBACK, COLOR_HVTEXT, 'bold', ''); } break; } case '//rem': case '//r': { if (isMod || isHost) { remUser(user, param); } else { cb.sendNotice(ONLY_MODERATORS, user, COLOR_HVBACK, COLOR_HVTEXT, 'bold', ''); } break; } case '//time': case '//t': { if (isMod || isHost) { if (isNaN(param)) { if (param == 'stop') { if (timerRunning) { timerCancel = true; timeRemaining = 0; cb.sendNotice('Timer cancelled!', '', TimeBGColor, COLOR_DEVELOPER, 'bold'); } else { cb.sendNotice('Timer not running.', user, COLOR_HVBACK, COLOR_HVTEXT, 'bold', ''); } } } else { if (Number(param) > 0) { timeRemaining = Number(param); if (!timerRunning) { cb.sendNotice('Timer set for ' + param + ' minutes.', user, COLOR_HVBACK, COLOR_SUCCESS, 'bold', ''); timerRunning = true; timerCancel = false; hiddenFinished = false; firstRun = true; countDown(); } else { cb.sendNotice('Timer set for new value of ' + param + ' minutes.', user, COLOR_HVBACK, COLOR_SUCCESS, 'bold', ''); } } } } else { cb.sendNotice(ONLY_MODERATORS, user, COLOR_HVBACK, COLOR_HVTEXT, 'bold', ''); } break; } case '//fin': case '//f': { if (isMod || isHost) { switch (param) { case 'stop': { hiddenFinished = false; hitZero = false; cb.sendNotice('Room entry notice displays token amount and session finished notice stopped.', user, COLOR_HVBACK, COLOR_SUCCESS, 'bold', ''); break; } case 'quiet': { hitZero = true; var notice = 'Token amount removed from room entry notice'; if (hiddenFinished) { notice += ' and session finished notice stopped.'; hiddenFinished = false; } cb.sendNotice(notice, user, COLOR_HVBACK, COLOR_SUCCESS, 'bold', ''); break; } default: { if (!hiddenFinished) { hiddenFinished = true; finTimer(); cb.sendNotice('Token amount removed from room entry notice and session finished notice started.', user, COLOR_HVBACK, COLOR_SUCCESS, 'bold', ''); } break; } } } else { cb.sendNotice(ONLY_MODERATORS, user, COLOR_HVBACK, COLOR_HVTEXT, 'bold', ''); } break; } default: { validCmd = 0; break; } } } } else { if (showStarted && blockGrey && isGrey) { msg['X-Spam'] = true; return msg; } else { if ((tipperList.indexOf(user) > -1) && userHilite) { msg['X-Spam'] = false; msg['background'] = COLOR_HIGHLIGHT; return msg; } if (tipperList.indexOf(user) < 0) { // Test for 'much', 'many', or 'join' and send tip required and time remaining to chat if ((msgString.search('much') != -1) || (msgString.search('many') != -1) || (msgString.search('join') != -1)) { if (!hiddenFinished && !hitZero) { notice = 'Cam access: ' + reqTokens + ' ' + langTokens; } if (timerRunning) { var timeGrammar = (timeRemaining > 0) ? timeRemaining + ' min' + ((timeRemaining > 1) ? 's' : '') : ''; if (timeRemaining > 0) { notice += ' - Time Remaining: ' + timeGrammar; } else { notice = ':alert1 Hidden Cam Finished :alert1'; } } if (!isHost) { cb.sendNotice(notice, '', COLOR_GOLD, COLOR_BLACK, 'bold', ''); } // cb.sendNotice(user + ' notified of amount/time remaining', '', COLOR_HVBACK, COLOR_HVTEXT, 'bold', 'red'); } } } } }); // onTip ----------------------------------------------------------------------- cb.onTip(function(tip) { user = tip['from_user']; amount = tip['amount']; user = user.toLowerCase(); var assholeMsg = ':alert1 \'' + user + '\' is on the Asshole List.\n'; // If the tip meets minimum amount required then user is added to the access list // and tipper list. cb.log('onTip'); // if (showStarted) { cb.log('showstarted'); var userTips = addTip(user, amount); if (tipSingle) { // Single tip if (amount >= reqTokens) { if (cbjs.arrayContains(assholeArray, user)) { if (!allowAlist) { assholeMsg += 'User has been ADDED to access list.\n-------------' addTipperList(user); } else { assholeMsg += 'User has been BLOCKED.\nCan only be added manually with \'//add\'\n-------------' } notifyError(assholeMsg, cb.room_slug); } else { addTipperList(user); } } } else { // Cumulative tip cb.log('cumulative'); if (getUserTotal(user) >= reqTokens) { cb.log('user tipped enough'); if (cbjs.arrayContains(assholeArray, user)) { if (!allowAlist) { assholeMsg += 'User has been ADDED to access list.\n-------------' addTipperList(user); } else { assholeMsg += 'User has been BLOCKED.\nCan only be added manually with \'//add\'\n-------------' } notifyError(assholeMsg, cb.room_slug); } else { addTipperList(user); } } else { if (!cb.limitCam_userHasAccess(user)) { var notice = 'Thank you, ' + (reqTokens - getUserTotal(user)) + ' more tokens are needed to unhide cam.' cb.sendNotice(notice, user, COLOR_HVBACK, COLOR_SUCCESS, 'bold', ''); } } } // } }); // Tip counting routines (from Bomb Bot Ultra) --------------------------------- function addTip(user, amount) { // Add tip to the tipper list, returning the user's updated total. // Using this feature is optional, so nTotal must be updated separately. var i; var index = -1; // See if this user already has an entry for (i = 0; i < tipArray.length; i += 1) { if (tipArray[i].sUser === user) { index = i; break; } } if (index < 0) { // User is not in list so add them tipArray.push({ sUser: user, nTotal: amount }); return amount; } else { // Update the user's tip total tipArray[index].nTotal += amount; return tipArray[index].nTotal; } } function getUserTotal(user) { var i; for (i = 0; i < tipArray.length; i += 1) { if (tipArray[i].sUser === user) { return tipArray[i].nTotal; } } return 0; } // Timer loops ----------------------------------------------------------------- function elapsed() { if (showStarted) { var midTime = Math.round((new Date() - startTime) / 1000 / 60); var notice = 'Elapsed: ' + midTime + ' mins'; if ((midTime % 5) == 0) { // Modulus 5 - elapsed time won't be displayed unless it's a multiple of 5 if (timerRunning) { var timeGrammar = (timeRemaining > 0) ? timeRemaining + ' min' + ((timeRemaining > 1) ? 's' : '') : ''; if (timeRemaining > 0) { notice += ' - Remaining: ' + timeGrammar; } else { notice += ' - Hidden Cam Finishing'; } } if (!hiddenFinished && !hitZero) { notice += ' - Cam access: ' + reqTokens + ' ' + langTokens; } if (midTime > 1) { cb.sendNotice(notice, '', COLOR_LGREY, COLOR_DGREY, 'bold', ''); } cb.setTimeout(elapsed, 300 * 1000); // Five minutes } } } function finTimer() { if (hiddenFinished) { timerRunning = false; cb.sendNotice(':alert1 Hidden Cam FINISHED!! :alert1 \n--> DO NOT tip to join!! <--', '', TimeBGColor, TimeTextColor, 'bold', ''); cb.setTimeout(finTimer, 30 * 1000); // 30 seconds } } function countDown() { if (timeRemaining < 1) { timerRunning = false; firstRun = false; if (!timerCancel) { timerMessage(); hiddenFinished = true; hitZero = true; finTimer(); } else { timerCancel = false; } } if (timerRunning) { cb.setTimeout(countDown, 60 * 1000); if (firstRun) { timerMessage(); firstRun = false; } else { if (timeRemaining > 10) { if ((timeRemaining % 5) == 0) { // If time remaining is greater than 10min and divisible by 5, send notice timerMessage(); } } else { // If less than 10min, send notice every 2 minutes if ((timeRemaining % 2) == 0) { timerMessage(); } } } timeRemaining -= 1 } } function timerMessage() { var notice = 'Session time remaining: ' if (timerRunning) { var timeGrammar = (timeRemaining > 0) ? timeRemaining + ' minute' + ((timeRemaining > 1) ? 's' : '') : ''; cb.sendNotice(notice + timeGrammar, '', TimeBGColor, TimeTextColor, 'bold'); } else { cb.sendNotice('Hidden Cam session is FINISHED!!', '', TimeBGColor, TimeTextColor, 'bold'); } } // Called when user enters room ------------------------------------------------ function advertise(username, h, m) { if (showStarted) { var runTime = Math.round((new Date() - startTime) / 1000 / 60); var notices = 'Hidden Cam has been running: ' + runTime + ' minutes'; if (!cb.limitCam_userHasAccess(username)) { if (hiddenFinished || hitZero) { notices += '\nHidden Cam session has FINISHED!\n'; notices += '>>>> DO NOT TIP TO JOIN <<<<'; } else { if (timerRunning) { var timeGrammar = (timeRemaining > 0) ? timeRemaining + ' minute' + ((timeRemaining > 1) ? 's' : '') : ''; notices += '\nSession ends in: ' + timeGrammar + '\n'; } notices += '\n------------------------------------------'; notices += '\nTip [' + tipAmount + '] ' + langTokens + ' to view cam.'; notices += '\n------------------------------------------'; } } cb.sendNotice(notices, username, COLOR_GOLD, COLOR_BLACK, 'bold'); cb.sendNotice(enterMsg, username, '', '#00BB00', 'bold', ''); } } // Assl Command function assList(u, h, m) { var sortedList = assholeArray.sort(); var msg = '--- \'A\' List ---\n'; for (var i = 0; i < sortedList.length; i++) { msg += sortedList[i] + ','; } msg = msg.slice(0, -1); msg += '\n---------------'; cb.sendNotice(msg, u); } //Assa Command function addAss(u, h, m, name) { if (assholeArray.indexOf(name) == -1) { assholeArray.push(name); cb.sendNotice('\'' + name + '\' has been added to the \'A\' list', u, COLOR_HVBACK, COLOR_SUCCESS, 'bold', ''); if (cmdNote && !(u == cb.room_slug)) { cb.sendNotice('Moderator \'' + u + '\' has added \'' + name + '\' to \'A\' list', cb.room_slug, COLOR_HVBACK, COLOR_NOTICE, 'bold', ''); } } else { cb.sendNotice('\'' + name + '\' already on the \'A\' list', u, COLOR_HVBACK, COLOR_ERROR, 'bold', ''); } } // Compare Command function comparelist(u, h, m) { var guestList = cb.limitCam_allUsersWithAccess(); var sortedList = guestList.sort(); var rowNum = 1; var msg = '--- \'A\' List matches ---'; for (var i = 0; i < sortedList.length; i++) { if (cbjs.arrayContains(assholeArray, sortedList[i])) { msg += '\n' + rowNum + ') ' + sortedList[i]; rowNum++; } } /* cb.log(rowNum); if (rowNum >= 1) { msg += '\n- No matches found -'; } */ msg += '\n---------------------------'; cb.sendNotice(msg, u); } // List Command ---------------------------------------------------------------- function showGuestList(u, h, m, d) { var guestList = cb.limitCam_allUsersWithAccess(); var sortedList = guestList.sort(); var rowNum = 1; var msg = '--- Hidden Cam Viewer List ---\n'; msg += 'Number of viewers: ' + sortedList.length + '\n'; if (h || m || d) { msg += 'Tipped to view: ' + tipperList.length + '\n'; } if (sortedList.length > 0) { msg += '----------------------------------------'; } for (var i = 0; i < sortedList.length; i++) { msg += '\n' + rowNum + ') ' + sortedList[i] + ' '; if (h || m || d) { msg += (tipperList.indexOf(sortedList[i]) == -1) ? '' : '*'; msg += (cbjs.arrayContains(viewArray, sortedList[i])) ? '+' : ''; if (h || d) { msg += ' |' + (getUserTotal(sortedList[i])) + '|'; } } rowNum++; } msg += '\n----------------------------------------' cb.sendNotice(msg, u); } // Add Command ----------------------------------------------------------------- // Only called on Start command if there's any viewers to add and if host/mod // uses //add command. // Viewers added this way are NOT added to the list of viewers who tipped to join // UNLESS they tip the join amount during the Hidden Cam session. function addUser(u, name) { if (cb.limitCam_userHasAccess(name)) { cb.sendNotice(name + ' is already on the list!', u, COLOR_HVBACK, COLOR_ERROR, 'bold', ''); } else { cb.limitCam_addUsers([name]); cb.sendNotice('\'' + name + '\' has been added to the list', u, COLOR_HVBACK, COLOR_SUCCESS, 'bold', ''); cb.sendNotice(u + ' has added you to view list, refresh if unable to view cam.', name, COLOR_HVBACK, COLOR_SUCCESS, 'bold', ''); if (cmdNote && !(u == cb.room_slug)) { cb.sendNotice('Moderator \'' + u + '\' has added \'' + name + '\'', cb.room_slug, COLOR_HVBACK, COLOR_NOTICE, 'bold', ''); } } } // Remove Command -------------------------------------------------------------- // User is not removed from the tipper list because if they tipped to join they cannot // recover tokens during the cam session, so number of viewers who tipped to view // remains the same. function remUser(u, name) { if (!cb.limitCam_userHasAccess(name)) { cb.sendNotice('\'' + name + '\' is not on the list!', u, COLOR_HVBACK, COLOR_ERROR, 'bold', ''); } else { cb.limitCam_removeUsers([name]); cb.sendNotice('\'' + name + '\' has been removed from the list', u, COLOR_HVBACK, COLOR_SUCCESS, 'bold', ''); if (tipperList.indexOf(name) != -1) { cb.sendNotice('WARNING: The only way \'' + name + '\' can join again is through the //add command!!', u, COLOR_GOLD, COLOR_BLACK, 'bold', ''); } if (cmdNote && !(u == cb.room_slug)) { cb.sendNotice('Moderator \'' + u + '\' has removed \'' + name + '\'', cb.room_slug, COLOR_HVBACK, COLOR_NOTICE, 'bold', ''); } } } // addTipperList --------------------------------------------------------------- // Called from the onTip function if a viewer has tipped minimum amount to unhide // cam, also adding them to the tipperList array if not already in it. function addTipperList(u) { //search for user in lists; assign return value var tipped = tipperList.indexOf(u); if (tipped == -1) { tipperList.push(u); if (!cb.limitCam_userHasAccess(u)) { cb.limitCam_addUsers([u]); cb.sendNotice('\'' + u + '\', you now have access to ' + cb.room_slug + '\'s Hidden Cam session', u, COLOR_HVBACK, COLOR_SUCCESS, 'bold', ''); cb.sendNotice('\'' + u + '\' now has access to your Hidden Cam session', cb.room_slug, COLOR_HVBACK, COLOR_SUCCESS, 'bold', ''); } } } // showHelp -------------------------------------------------------------------- function showHelp(u, h, m, x) { if (!x) { var notices = 'Commands available:\n'; if (h) { notices += '------ Broadcaster Commands ------\n'; notices += '//start - Start Hidden Cam session.\n'; notices += '//stop - Stop Hidden Cam session.\n'; notices += '//quick x - Start Hidden Cam session immediately with x tokens, [Default 200].\n'; notices += '//xxx tokens - Change token amount required to view cam.\n'; notices += '//assl - Displays the \'A\' list.\n'; notices += '//assa user - Add user to the \'A\' list.\n'; notices += '//comp - Checks viewers against \'a\' list.\n'; } if (h || m) { notices += '------ Moderator/Broadcaster Commands ------\n'; notices += '//time mins|stop - Start/stop countdown timer.\n'; notices += '//fin [stop|quiet] - Start/stop session finished chat notice.\n'; notices += '//add user - Add user to the viewing list.\n'; notices += '//rem user - Remove user from the viewing list.\n'; notices += '//chk user - Checks if user is on the viewing list.\n'; notices += '//warn [user] - Sends a notice regarding use of Flash\nbrowser on mobile devices.\n'; notices += '//ntm - Sends a notice to moderators only.\n'; notices += '//ntf - Sends a notice to fans only.\n'; } notices += '------ User Commands ------\n'; notices += '//list - List users on the viewing list.\n'; notices += '//help - This notice.\n-----------------------\n'; if (h || m) { notices += 'Commands can be abbreviated to the first character.\n'; notices += 'Exceptions are: //ntm, //ntf'; if (h) { notices += ', //start, //stop'; } notices += '\n//help ex - for command examples.\n-----------------------'; } } else { var notices = 'Command examples:\n-----------------------\n'; if (h) { notices += '//xxx 450 - Change Hidden Cam access to 450 tokens.\n'; notices += '//quick 111 - Start Hidden Cam for 111 tokens, [Default 200].\n'; notices += '//q - Start Hidden Cam for 200 tokens, [Default 200].\n'; notices += '//assl - Display \'A\' list as it would be entered into bot.\n'; notices += '//assa usr_3 - Add \'usr_3\' to the \'A\' list.\n'; notices += '//comp - list viewers who appear on the \'A\' list.\n'; } notices += '//time 20 - will start an 20 minute countdown.\n'; notices += '//t stop - will stop a running countdown.\n'; notices += '//fin - start 30sec loop of Hidden Cam finished msg in chat.\n'; notices += '//f stop - stop Hidden Cam finished msg in chat.\n'; notices += '//f quiet - remove token amount from room entry msg w/ no chat msg.\n'; notices += '//a usr_1 - add \'usr_1\' to viewing list.\n'; notices += '//r usr_5 - remove \'usr_5\' from viewing list.\n'; notices += '//w - send message about mobile devices to everyone.\n'; notices += '//w usr_2 - send message about mobile devices to \'usr_2\'.\n'; notices += '//ntm Time out - send \'Time out\' to all moderators.\n'; notices += '//ntf Free beer- send \'Free beer\' to all fans.\n'; notices += '//l - list users on the viewing list.\n-----------------------'; } cb.sendNotice(notices, u, '', COLOR_INFO, 'bold'); } function notifyError(message, u) { cb.sendNotice(message, u, COLOR_LRED, COLOR_DRED); } // Checks if setting is empty/not set ----------------------------------------- function isBlank(cbsetting) { var s; if (cbsetting) { s = cbsetting.trim(); } if (s == null || s == '' || s.substr(0, 9) == '[Optional') { return true; } else { return false; } } // Start Command --------------------------------------------------------------- function startHidden(u, tokens, quickHCp) { quickDisable = (quickHCp && disableAuto) startTime = new Date(); tipArray = []; reqTokens = tokens; var camMsg = 'READ chat for tip required to view cam\nASK in chat for time remaining.\n---' camMsg += '\nStart time: ' + ('0' + startTime.getUTCHours()).slice(-2) + ':' + ('0' + startTime.getUTCMinutes()).slice(-2) + ' UTC'; var chatMsg = '------------------\nHidden Cam [started]\nTip [' + tokens + '] to view cam\n------------------'; if (!cb.limitCam_isRunning()) { cb.limitCam_start(camMsg); cb.sendNotice(chatMsg, '', COLOR_YELLOW, COLOR_BLUE, 'bold', ''); var notices = cb.room_slug; if (addMods && !quickDisable) { notices += ' has set Hidden Cam to\n'; notices += 'auto-add Moderators, please REFRESH\n'; notices += 'if you can not view cam.' cb.sendNotice(notices, '', '', COLOR_SYNTAX, 'bold', 'red'); } if (addFans && !quickDisable) { notices += ' has set Hidden Cam to\n'; notices += 'auto-add Fans, please REFRESH\n'; notices += 'if you can not view cam.' cb.sendNotice(notices, '', '', COLOR_SYNTAX, 'bold', 'green'); } // Add any names that were in the viewer list when bot was started. if ((viewArray.length > 0) && !quickDisable) { for (i = 0; i < viewArray.length; i++) { addUser(cb.room_slug, viewArray[i]); } } showStarted = true; if (sessionTimer) { elapsed(); } } else { cb.sendNotice('Hidden Cam session already running!', u, COLOR_HVBACK, COLOR_ERROR, 'bold', ''); } } // Stop Command ---------------------------------------------------------------- function stopHidden(u) { if (cb.limitCam_isRunning()) { cb.limitCam_stop(); var totalTime = Math.round((new Date() - startTime) / 1000 / 60); var notice = 'Hidden Cam [stopped]\n' notice += 'Total session time: ' + totalTime + ' minutes' cb.sendNotice(notice, '', COLOR_HVBACK, COLOR_SUCCESS, 'bold', ''); cb.sendNotice('Total number of viewers who tipped to view: ' + tipperList.length, u, COLOR_LGREY, COLOR_DGREY, 'bold', ''); // Clear out the Hidden Cam access list - this does NOT clear out names that were // added to the viewer list when the bot was initially run. Those names will be // added again when the //start command is given. var guestList = cb.limitCam_allUsersWithAccess(); if (guestList.length > 0 && clearlist) cb.limitCam_removeAllUsers(); showStarted = false; startTime = 0; timerCancel = true; timeRemaining = 0; hiddenFinished = false; hitZero = false; if (clearList) { tipperList = []; }; } else { cb.sendNotice('Hidden Cam session is not running.', u, COLOR_HVBACK, COLOR_ERROR, 'bold', ''); } } // Startup --------------------------------------------------------------------- function init() { var guestList = cb.limitCam_allUsersWithAccess(); if (guestList.length > 0) cb.limitCam_removeAllUsers(); showStarted = false; if (!isBlank(cb.settings.viewList)) { var n = cb.settings.viewList.replace(/\s+/g, ''); viewArray = n.replace(/^,+|,+$/g, '').split(','); } cb.sendNotice(botName + ' v' + botVersion + ' [loaded] \nby ' + botAuthor + ' [' + botDate + ']', '', TimeBGColor, COLOR_DEVELOPER, 'bold', ''); var notices = ''; if (!tipSingle) { notices += 'Cumulative tipping: ON'; } else { notices += 'Cumulative tipping: OFF'; } if (!blockGrey) { notices += '\nBlock grey users: OFF'; } else { notices += '\nBlock grey users: ON'; } if (!userHilite) { notices += '\nHilite viewers who tipped: OFF'; } else { notices += '\nHilite viewers who tipped: ON'; } if (!allowAlist) { notices += '\nBlock A list from viewing: OFF'; } else { notices += '\nBlock A list from viewing: ON'; } cb.sendNotice(notices, cb.room_slug, TimeBGColor, COLOR_DEVELOPER, 'bold', ''); cb.sendNotice(enterMsg, cb.room_slug, '', '#00BB00', 'bold', ''); if(!isBlank(cb.settings.assholeList)) { var s = cb.settings.assholeList.replace(/\s+/g, ''); assholeArray = s.replace(/^,+|,+$/g,'').split(','); } } init();
© Copyright Chaturbate 2011- 2024. All Rights Reserved.