Bots Home
|
Create an App
Logged in Users Only
Author:
sexii_lanara
Description
Source Code
Launch Bot
Current Users
Created by:
Sexii_Lanara
// No anonymous viewers bot // Author: Severino var noAnon = { // Commands the room owner and moderators can use startShowCommand: '/startshow', stopShowCommand: '/stopshow', // Commands that everyone can use helpCommand: '/help', // Useful globals wordBoundary: "(\\s|\\b)", showStarted: false, showmessage: 'Anonymous viewers blocked, log in to view cam.' } ; // CB app settings cb.settings_choices = [ {name: 'showmessage', label: 'Message for blocked users', type: 'str', minLength: 1, maxLength: 99, required: true, defaultValue: 'Anonymous viewers blocked, log in to view cam.'} ]; noAnon.usage = function (msg) { var u = msg['user']; cb.chatNotice('Available commands:', u); if (this.canControlBot(msg)) { cb.chatNotice(this.startShowCommand + ' start blocking anonymous users', u); cb.chatNotice(this.stopShowCommand + ' stop the bot', u); } cb.chatNotice(this.helpCommand + ' - show this help message', u); }; cb.onMessage(function (msg) { return noAnon.onMessage(msg); }); cb.onEnter(function (user) { return noAnon.onEnter(user); }); cb.onTip(function (tip) { noAnon.onTip(tip); }); noAnon.isPatron = function (username) { return cb.limitCam_userHasAccess(username); }; noAnon.addPatron = function (username) { if (this.isPatron(username)) { return false; } else { cb.limitCam_addUsers([username]); return true; } }; noAnon.onTip = function (tip) { var amountTipped = parseInt(tip['amount']); var tippingUser = tip['from_user']; noAnon.addPatron(tippingUser); }; noAnon.getPatronList = function () { var userlist = cb.limitCam_allUsersWithAccess(); if (userlist.length > 0) { return "" + userlist.length + (userlist.length > 1 ? " users" : " user") + " in show: " + cbjs.arrayJoin(userlist, ", "); } else { return "No users in show."; } } // Main on message callback function noAnon.onMessage = function (msg) { // vars for ease of use var m = msg['m']; var u = msg['user']; // check for action if (m[0] === '/') { // don't print commands msg['X-Spam'] = true; // Remove trailing spaces m = m.replace(/\s+$/, ''); // Find command parameters var commandParts = m.split(/\s+/); var commandName = commandParts[0]; cb.log(u + ' issued command: ' + commandName); // check if controller if (!this.canControlBot(msg)) { // Not owner noAnon.addPatron(u); } else { // Owner if (commandParts[0] === this.helpCommand) // help { this.usage(msg); } else if (commandParts[0] === this.startShowCommand) { cb.limitCam_start(noAnon.showmessage); noAnon.showStarted = true; } else if (commandParts[0] === this.stopShowCommand) { cb.limitCam_stop(); noAnon.showStarted = false; cb.chatNotice("Anonymous viewers unblocked"); } } } msg['m'] = m; return msg; } ; noAnon.onEnter = function (user) { noAnon.addPatron(user.user); } noAnon.canControlBot = function (msg) { return (msg['user'] === cb.room_slug); }; noAnon.wrapText = function (item, pre, suf) { return pre + item + suf; }; noAnon.init = function () { cb.chatNotice('CookieCake Trap Prevents Anonymous Lurking. If you are logged in and cannot see the cam, please refresh the page'); cb.chatNotice('If you are not logged in you will have to log in to see the cam.'); if (cb.settings.showmessage) { noAnon.showmessage = cb.settings.showmessage; } cb.limitCam_start(noAnon.showmessage); noAnon.showStarted = true; }; noAnon.init();
© Copyright Chaturbate 2011- 2026. All Rights Reserved.