Bots Home
|
Create an App
testti
Author:
staringatstars
Description
Source Code
Launch Bot
Current Users
Created by:
Staringatstars
/* Piracy Disrupter for all hard-working cammers */ cb.settings_choices = [ {name: 'pdMsg',type: 'str', defaultValue: 'This is a Private Show for Tippers and Qualified Guests. You must have Adobe Flash enabled to view without interruption', minLength: 1, maxLength: 4096, required: true,label: 'What blocked users see during Private Session'}, {name: 'pdBlockList', type: 'str',minlength: 0 ,maxLength: 32000, required: false, defaultValue: "cbm,mfc", label: 'Permanently Blocked Users'}, {name: 'pdPublic', type: 'int', minValue: 1, defaultValue: 30, required: true, label: 'Disrupter Mode - Public seconds per cycle'}, {name: 'pdPrivate', type: 'int', minValue: 1, defaultValue: 5, required: true, label: 'Disrupter Mode - Private seconds per cycle'}, {name: 'pdOptOnTip', type: 'choice', choice1: "Yes", choice2: "No", defaultValue: "Yes", label: 'Optimize for Tippers'}, {name: 'pdOptOnFan', type: 'choice', choice1: "Yes", choice2: "No", defaultValue: "Yes", label: 'Optimize for Fan Club upon Entry'}, {name: 'pdOptOnPurple',type: 'choice', choice1: "Yes", choice2: "No", defaultValue: "Yes", label: 'Optimize for Purple upon Entry'}, {name: 'pdOptOnDBlue', type: 'choice', choice1: "Yes", choice2: "No", defaultValue: "Yes", label: 'Optimize for Dark Blue upon Entry'}, {name: 'pdOptOnLBlue', type: 'choice', choice1: "Yes", choice2: "No", defaultValue: "Yes", label: 'Optimize for Light Blue upon Entry'}, {name: 'pdOptMinTip', type: 'int', minValue: 0, defaultValue: 1, required: true, label: 'Optimize for this Minimum Tip'}, {name: 'pdOptTime', type: 'int', minValue: 1, defaultValue: 5, required: true, label: 'Optimize for this Amount of Minutes'}, {name: 'pdMinXOuts', type: 'int', minValue: 1, defaultValue: 2, required: true, label: 'Disruption test for Adobe Flash enabled'}, ]; var fgUser = { user: "" ,in_fanclub: false ,has_tokens: false ,is_mod: false ,tipped_recently: false ,tipped_alot_recently: false ,tipped_tons_recently: false ,gender: "" } var broadCaster = cb.room_slug; var pdMsg = cb.settings.pdMsg; var pdBlockList = (cb.settings.pdBlockList + ' ').replace(/\s/g,"").split(','); var pdPublic = cb.settings.pdPublic * 1000 - 1; var pdPrivate = cb.settings.pdPrivate * 1000 - 1; var pdOptOnTip = cb.settings.pdOptOnTip == "Yes"; var pdOptOnFan = cb.settings.pdOptOnFan == "Yes"; var pdOptOnPurple = cb.settings.pdOptOnPurple == "Yes"; var pdOptOnDBlue = cb.settings.pdOptOnDBlue == "Yes"; var pdOptOnLBlue = cb.settings.pdOptOnLBlue == "Yes"; var pdOptTime = cb.settings.pdOptTime * 60000 - 1; var pdOptMinTip = cb.settings.pdOptMinTip; var pdMinXOuts = cb.settings.pdMinXOuts; var pdControl = "Optimize"; var pdMode = "Disrupter"; var pdSubMode = "Public"; var pdSubStart = new Date(); var guestList = []; var guestDefaults = { name: "", tipTot: 0, msgCt: 0, isColor: "", xOuts: 0, enterTime: 0, leaveTime: 0, gender: "", lastMinTip: 0}; cb.setTimeout(pdTimerCheck,5000); function pdTimerCheck() { cb.setTimeout(pdTimerCheck,5000); var cTime = new Date(); var lastMinTip = 0; var lastQualEntry = 0; var qualGuestCount = 0; var pl = []; var i = -1; if (pdControl == "Steadystream") { pdStartPrivate(); return; } if (pdControl == "Disrupter") { if (pdSubMode == "Public" && cTime - pdSubStart >= pdPublic) {pdStartPrivate();} if (pdSubMode == "Private" && cTime - pdSubStart >= pdPrivate) {pdStartPublic();} return; } if (pdControl == "Optimize" && pdMode == "Steadystream") { for (i=0; i < guestList.length; i++) { if (qualifiedGuest(i)) { qualGuestCount += 1; guestList[i].xOuts = 50000; if (cTime - guestList[i].lastMinTip < pdOptTime) {lastMinTip = 1;} if (cTime - guestList[i].enterTime < pdOptTime) {lastQualEntry = 1;} } } if (qualGuestCount > 0 && (lastMinTip || lastQualEntry)) { pdSubStart = new Date(); } else { //cb.sendNotice("switching to Disrupter"); pdMode = "Disrupter"; pdStartPublic(); } return; } if (pdControl == "Optimize" && pdMode == "Disrupter") { if (pdSubMode == "Public" && cTime - pdSubStart >= pdPublic) { pdStartPrivate(); } if (pdSubMode == "Private" && cTime - pdSubStart >= pdPrivate) { var xct = 0; for (i=0; i < guestList.length; i++) { if (guestList[i].enterTime > guestList[i].leaveTime) { guestList[i].xOuts += 1; if (guestList[i].xOuts == 2 && qualifiedGuest(i)) { xct = 1; } } } if (xct) { //cb.sendNotice("switching to Steadystream (XOuts)"); pdMode = "Steadystream"; pdStartPrivate(); return; } pdStartPublic(); } } } function pdStartPrivate() { var pl = [broadCaster]; var ll = []; var i = -1; for (i=0; i < guestList.length; i++) { if (qualifiedGuest(i)) { pl[pl.length] = guestList[i].name; } } ll = cb.limitCam_allUsersWithAccess(); for (i=0; i < ll.length; i++) { if (pl.indexOf(ll[i]) == -1) { cb.limitCam_removeUsers([ll[i]]); } } for (i=0; i < pl.length; i++) { if (ll.indexOf(pl[i]) == -1) { cb.limitCam_addUsers([pl[i]]); } } ll = cb.limitCam_allUsersWithAccess(); pdSubMode = "Private"; pdSubStart = new Date(); if (!cb.limitCam_isRunning()) { cb.limitCam_start(pdMsg); } } function pdStartPublic() { pdSubMode = "Public"; pdSubStart = new Date(); if (cb.limitCam_isRunning()) { cb.limitCam_stop(); } } function qualifiedGuest(i) { if (guestList[i].enterTime > guestList[i].leaveTime && ( (pdOptOnFan && guestList[i].isColor == "Fan" ) || (pdOptOnPurple && guestList[i].isColor == "DPurple" ) || (pdOptOnPurple && guestList[i].isColor == "LPurple" ) || (pdOptOnDBlue && guestList[i].isColor == "DBlue" ) || (pdOptOnLBlue && guestList[i].isColor == "LBlue" ) || (pdOptOnTip && guestList[i].tipTot > 0))) { return true; } return false; } function findGuest (fgUser) { var i = -1; var g = {}; for (i=0; i < guestList.length; i++) { if (guestList[i].name == fgUser.user) { return i; } } if (pdBlockList.indexOf(fgUser.user) > -1) { return -1; } g = Object.assign({},guestDefaults); g.name = fgUser.user; if (fgUser.has_tokens) { g.isColor = "LBlue";} if (fgUser.tipped_recently) { g.isColor = "DBlue";} if (fgUser.tipped_alot_recently) { g.isColor = "LPurple";} if (fgUser.tipped_tons_recently) { g.isColor = "DPurple";} if (fgUser.in_fanclub) { g.isColor = "Fan";} g.enterTime = new Date(); g.gender = fgUser.gender; i = guestList.length; guestList[i] = Object.assign({},g); return i; } cb.onEnter(function(user) { var i = findGuest(user); if (i == -1) { cb.sendNotice(user.user + " is on the blocked list",broadCaster); return; } guestList[i].enterTime = new Date(); if (guestList[i].leaveTime == 0) { guestList[i].leaveTime = guestList[i].enterTime - 60; } if (cb.limitCam_isRunning() && !cb.limitCam_userHasAccess(user.user) && qualifiedGuest(i)) { cb.limitCam_addUsers([user.user]); } if (pdControl == "Optimize" && pdMode != "Steadystream" && guestList[i].xOuts >= pdMinXOuts && guestList[i].enterTime - guestList[i].leaveTime > 5000) { //cb.sendNotice("switching to Steadystream (enter)"); pdMode = "Steadystream"; pdStartPrivate(); } }); cb.onLeave(function(user) { var i = findGuest(user); if (i > -1) { guestList[i].leaveTime = new Date(); } }); cb.onTip(function(tip) { var i = findGuest( { user: tip.from_user ,in_fanclub: tip.from_user_in_fanclub ,has_tokens: tip.from_user_has_tokens ,is_mod: tip.from_user_is_mod ,tipped_recently: tip.from_user_tipped_recently ,tipped_alot_recently: tip.from_user_tipped_alot_recently ,tipped_tons_recently: tip.from_user_tipped_tons_recently ,gender: tip.from_user_gender }); if (i == -1) { cb.sendNotice(tip.from_user + " is on the blocked list",broadCaster); return; } if (cb.limitCam_isRunning() && !cb.limitCam_userHasAccess(tip.from_user) && qualifiedGuest(i)) { cb.limitCam_addUsers([tip.from_user]); } guestList[i].tipTot += tip.amount; if (tip.amount >= pdOptMinTip) { guestList[i].lastMinTip = new Date(); if (pdControl == "Optimize" && pdMode != "Steadystream") { //cb.sendNotice("switching to Steadystream (tip)"); pdMode = "Steadystream"; pdStartPrivate(); } } }); cb.onMessage(function(msg) { var message = {}; if (pdBlockList.indexOf(msg.user) > -1) { //cb.sendNotice(msg.user + " is on the blocked list",broadCaster); return msg; } if (msg.user == broadCaster || true) { message = slashCmds(msg); if (message['X-Spam'] != msg['X-Spam']) { return msg; } } var i = findGuest( { user: msg.user ,in_fanclub: msg.in_fanclub ,has_tokens: msg.has_tokens ,is_mod: msg.is_mod ,tipped_recently: msg.tipped_recently ,tipped_alot_recently: msg.tipped_alot_recently ,tipped_tons_recently: msg.tipped_tons_recently ,gender: msg.gender }); if (cb.limitCam_isRunning() && !cb.limitCam_userHasAccess(msg.user) && qualifiedGuest(i)) { cb.limitCam_addUsers([msg.user]); } }); function slashCmds(msg) { var m = msg.m.trim().toLowerCase(); if (m == "/steadystream") { msg['X-Spam'] = true; pdControl = "Steadystream"; pdSubStart = 0; cb.sendNotice("starting Steadystream control",msg.user); return msg; } if (m == "/disrupter") { msg['X-Spam'] = true; pdControl = "Disrupter"; pdSubStart = 0; cb.sendNotice("starting Disrupter control",msg.user); return msg; } if (m == "/optimize") { msg['X-Spam'] = true; pdControl = "Optimize"; pdSubStart = 0; cb.sendNotice("starting Optimize control",msg.user); return msg; } if (m == "/help") { msg['X-Spam'] = true; var h = "'/steadystream' = continuous Steadystream (private) control" + "\n'/disrupter' = continuous Disrupter control" + "\n'/optimize' = bot will optimize between Steadystream and Disrupter modes" ; cb.sendNotice(h,msg.user); return msg; } return msg; } /* by pbchnd */
© Copyright Chaturbate 2011- 2024. All Rights Reserved.