Bots Home
|
Create an App
pbtest2
Author:
pbchnd
Description
Source Code
Launch Bot
Current Users
Created by:
Pbchnd
var ardMsg = 'Anti-Recording Device running, please tip or chat for uninterupted viewing. Tip 25 tokens total and never be blacked out.'; var ardUser = []; /* all user list */ var ardExpire = []; /* when user grace period expires */ var ardTips = []; /* user tip accumulation */ var ardDark = 30* 1000; /* seconds of blackout */ var ardCycle = 60 * 1000; /* minutes per cycle */ var ardGrace = 1 * 61000; /* grace period after chat/tip */ var ardHour = 5*60000; ardCycleStart(); function ardUserUpdate(u,t) { if (u == cb.room_slug) { return; } var i = ardUser.indexOf(u); if (i == -1) { i = ardUser.length; ardTips[i] = 0; } ardUser[i] = u; var now = new Date(); ardExpire[i] = now.getTime() + ardGrace; ardTips[i] += t; if (cb.limitCam_isRunning() && !cb.limitCam_userHasAccess(u)) { cb.limitCam_addUsers([u]); } } cb.onEnter(function(user) { var u = user['user']; var i = ardUser.indexOf(u); if (i == -1) { i = ardUser.length; ardUser[i] = u; ardTips[i] = 0; var now = new Date(); ardExpire[i] = now.getTime() + ardCycle; if (cb.limitCam_isRunning() && !cb.limitCam_userHasAccess(u)) { cb.limitCam_addUsers([u]); } } }); cb.onLeave(function(user) { var u = user['user']; if (u == cb.room_slug && cb.limitCam_isRunning()) { cb.limitCam_stop(); } }); cb.onTip(function(tip) { ardUserUpdate(tip['from_user'],tip['amount']); }); cb.onMessage(function(msg) { ardUserUpdate(msg['user'],0); }); function ardCycleStart () { if (cb.limitCam_isRunning()) { cb.limitCam_addUsers(ardUser); cb.limitCam_stop(); cb.sendNotice('blackout stopped: ' + new Date(),cb.room_slug); return; } cb.setTimeout(ardCycleStart, ardCycle); cb.setTimeout(ardDarkStart, ardCycle-ardDark); cb.sendNotice('cycle started: ' + new Date(),cb.room_slug); } function ardDarkStart () { var now = new Date(); ardTime = now.getTime(); var g = [], hUser = [], hExpire = [], hTips = []; g[0] = cb.room_slug; for (i = 0; i < ardUser.length; i++) { if (ardTime < ardExpire[i] + ardHour || ardTips[i]) { j = hUser.length; hUser[j] = ardUser[i]; hExpire[j] = ardExpire[i]; hTips[j] = ardTips[i]; } if (ardTime < ardExpire[i] || ardTips[i] >= 25) { g[g.length] = ardUser[i]; cb.sendNotice(ardUser[i] + ' is not blanked',cb.room_slug); } else { cb.sendNotice(ardUser[i] + ' is blanked: ' ,cb.room_slug); } } ardUser = hUser.slice(0); ardExpire = hExpire.slice(0); ardTips = hTips.slice(0); cb.setTimeout(ardCycleStart, 15000); cb.sendNotice('blackout started: ' + new Date(),cb.room_slug); cb.limitCam_start('Msg1',g); cb.limitCam_start('Msg2',g); }
© Copyright Chaturbate 2011- 2024. All Rights Reserved.