Bots Home
|
Create an App
dsadsax
Author:
stillstanding
Description
Source Code
Launch Bot
Current Users
Created by:
Stillstanding
//Written by Viper // Title: No Grey Viewers // Description: Blocks users from viewing your show unless they have tokens! // Author: JCW2001 (Twitter: @ShamusJanus) // Thanks to justin for earlier code examples // Version: 1.0 (01/11/2014) function output(e){cb.sendNotice(e)} function outputPrivate(e){cb.sendNotice(e,cb.room_slug)} function outputImportant(e){cb.sendNotice(e,"","","#ff0000","bold")} function help(){var e=["NO GREY VIEWERS - Command list...","","/NGVstop - To stop this bot","/NGVstart - To start this bot","/NGVadd [username] - Manually let any user see your cam","/NGVblock [username] - Block any user you wish from seeing your cam","/NGVcheck [username] - Check to see if a user can see you cam","/NGVlist - List everyone who can see your cam","/NGVhelp - See this list again","","Contact me at @ShamusJanus on Twitter if something doesn't work! Thanks!"];cb.sendNotice(e.join("\n"),cb.room_slug,"","","bold");if(ngv.running===true){outputImportant("Currently running: Viewers without tokens are currently blocked.")}else{outputImportant("Not running: Viewers without tokens are not blocked.")}}function start(){cb.sendNotice("NO GREY VIEWERS by @ShamusJanus - Please type '/NGVhelp' for instructions. Use '/NGVstop' to stop bot.",cb.room_slug,"","","bold");cb.sendNotice("IMPORTANT: You must type /NGVstart to start blocking viewers. Nobody is blocked at present.",cb.room_slug,"","#ff0000","bold")}var ngv={running:false};var tipperList=[];cb.settings_choices=[{name:"hide_message",label:"Tokens Required Message",type:"str",minLength:1,maxLength:256,defaultValue:"You must have tokens to view this show. Get some tokens now!"}];cb.onEnter(function(e){var t=e["user"];if(ngv.running===true){cb.sendNotice("Only viewers with tokens can view the show. If you have tokens and cannot see anything, try refreshing your page!",t,"","#ff0000","bold");if(e["has_tokens"]){cb.limitCam_addUsers([t]);if(tipperList.indexOf(t)>-1){cb.sendNotice("Welcome back, "+t+"!",t)}}else if(tipperList.indexOf(t)>-1){cb.sendNotice("Welcome back, "+t+"!",t);cb.limitCam_addUsers([t])}}});cb.onLeave(function(e){var t=e["user"];if(ngv.running===true&&tipperList.indexOf(t)<0){cb.limitCam_removeUsers([t])}});cb.onTip(function(e){var t=e["from_user"];if(tipperList.indexOf(t)<0){tipperList.push(t)}if(ngv.running===true){cb.limitCam_addUsers([t])}});cb.onMessage(function(e){var t=e["m"];var n=e["user"];var r="";t=t.replace(/\s+$/,"");if(ngv.running===true&&!e["has_tokens"]&&cb.room_slug!==n&&tipperList.indexOf(userName)<0){cb.sendNotice(n+", only those with tokens can view the cam. Get some tokens now.",n,"","","bold");e["X-Spam"]=true}if(cb.room_slug===n&&(t=="/NGVhelp"||t=="/ngvhelp")){help()}if(cb.room_slug===n&&(t=="/NGVstart"||t=="/ngvstart")&&!cb.limitCam_isRunning()){outputImportant("Only viewers with tokens can view the show. If you have tokens and cannot see anything, REFRESH your page!");cb.limitCam_start(cb.settings.hide_message);ngv.running=true}if(cb.room_slug===n&&(t=="/NGVstop"||t=="/ngvstop")&&cb.limitCam_isRunning()){output("All users can now view the show!");cb.limitCam_stop();ngv.running=false}if(cb.room_slug===n&&(t.substring(0,9)=="/NGVblock"||t.substring(0,9)=="/ngvblock")&&cb.limitCam_allUsersWithAccess().length>0&&cb.limitCam_isRunning()){r=t.substring(10,t.length);if(cbjs.arrayContains(cb.limitCam_allUsersWithAccess(),r)){cb.limitCam_removeUsers([r]);output(cb.room_slug+" has blocked "+r+" from the show!")}}if(cb.room_slug===n&&(t.substring(0,7)=="/NGVadd"||t.substring(0,7)=="/ngvadd")&&cb.limitCam_isRunning()){r=t.substring(8,t.length);if(!cbjs.arrayContains(cb.limitCam_allUsersWithAccess(),r)){cb.limitCam_addUsers([r]);outputPrivate(r+" can now see the show!")}}if(cb.room_slug===n&&(t.substring(0,9)=="/NGVcheck"||t.substring(0,9)=="/ngvcheck")&&cb.limitCam_isRunning()){r=t.substring(10,t.length);if(cb.limitCam_userHasAccess(r)){outputPrivate(r+" can view!")}else{outputPrivate(r+" cannot view!")}}if(cb.room_slug===n&&(t==="/NGVlist"||t=="/ngvlist")&&cb.limitCam_isRunning()){var i=cb.limitCam_allUsersWithAccess();if(i.length>0){outputPrivate(""+i.length+(i.length>1?" users":" user")+" in show: "+cbjs.arrayJoin(i,", "))}else{outputPrivate("Nobody can view.")}}if(t[0]=="/"){e["X-Spam"]=true}return e});start() cb.onEnter(function(user) { if (!cbjs.arrayContains(cb.limitCam_allUsersWithAccess(), user['user'])) { cb.limitCam_addUsers([user['user']]); cb.chatNotice("Hello, " +user['user']+ ". As a registered user you can view " +cb.room_slug+"'s cam.", user['user'], '#fcb2bf', '#000000', 'bold'); } if (cbjs.arrayContains(cb.limitCam_allUsersWithAccess(), user['user'])) { cb.chatNotice("Welcome back, " +user['user']+ ". As a registered user you can view " +cb.room_slug+"'s cam.", user['user'], '#fcb2bf', '#000000', 'bold'); } }); cb.onMessage(function(msg) { if (!cbjs.arrayContains(cb.limitCam_allUsersWithAccess(), msg['user'])) { cb.limitCam_addUsers([msg['user']]); cb.chatNotice("Hello, " +msg['user']+ ". As a registered user you can view " +cb.room_slug+"'s cam.", msg['user'], '#fcb2bf', '#000000', 'bold'); } return msg; }); function init() { cb.limitCam_start("Now blocking anonymous viewers. If you are a registered user please type a message in the chat or refresh!"); cb.chatNotice("Now blocking anonymous viewers!", '', '#fcb2bf', '#000000', 'bold'); cb.chatNotice("If you are signed in and can't see " +cb.room_slug+"'s cam, refresh the page or type in the chat.", '', '#fcb2bf', '#000000', 'bold'); } init();
© Copyright Chaturbate 2011- 2024. All Rights Reserved.