Bots Home
|
Create an App
Claes' Room Rules
Author:
goddessclaes
Description
Source Code
Launch Bot
Current Users
Created by:
Goddessclaes
/** * Bot: Room Rules * Version: 2.0 * Author: zingknaat * Date: 05.22.14 */ var users_agreed = []; cb.settings_choices = [ {name:'rule1', type:'str', minLength:1, maxLength:255, label:'Rule #1'}, {name:'rule2', type:'str', minLength:1, maxLength:255, label:'Rule #2 (optional)', required:false}, {name:'rule3', type:'str', minLength:1, maxLength:255, label:'Rule #3 (optional)', required:false}, {name:'rule4', type:'str', minLength:1, maxLength:255, label:'Rule #4 (optional)', required:false}, {name:'rule5', type:'str', minLength:1, maxLength:255, label:'Rule #5 (optional)', required:false}, {name:'rule6', type:'str', minLength:1, maxLength:255, label:'Rule #6 (optional)', required:false}, {name:'rule7', type:'str', minLength:1, maxLength:255, label:'Rule #7 (optional)', required:false}, {name:'rule8', type:'str', minLength:1, maxLength:255, label:'Rule #8 (optional)', required:false}, {name:'rule9', type:'str', minLength:1, maxLength:255, label:'Rule #9 (optional)', required:false}, {name:'rule10', type:'str', minLength:1, maxLength:255, label:'Rule #10 (optional)', required:false}, {name:'rule11', type:'str', minLength:1, maxLength:255, label:'Rule #11 (optional)', required:false}, {name:'rule12', type:'str', minLength:1, maxLength:255, label:'Rule #12 (optional)', required:false}, {name:'rule13', type:'str', minLength:1, maxLength:255, label:'Rule #13 (optional)', required:false}, {name:'rule14', type:'str', minLength:1, maxLength:255, label:'Rule #14 (optional)', required:false}, {name:'rule15', type:'str', minLength:1, maxLength:255, label:'Rule #15 (optional)', required:false}, {name:'rule16', type:'str', minLength:1, maxLength:255, label:'Rule #16 (optional)', required:false}, {name:'rule17', type:'str', minLength:1, maxLength:255, label:'Rule #17 (optional)', required:false}, {name:'rule18', type:'str', minLength:1, maxLength:255, label:'Rule #18 (optional)', required:false}, {name:'rule19', type:'str', minLength:1, maxLength:255, label:'Rule #19 (optional)', required:false}, {name:'rule20', type:'str', minLength:1, maxLength:255, label:'Rule #20 (optional)', required:false}, {name:'advertisement_wait_time', type:'choice', label:'Notification Time (in minutes)', choice1:5, choice2:10, choice3:15, choice4:20, choice5:25, choice6:30, choice7:45, choice8:60, defaultValue:15} ]; cb.onEnter(function(user) { cb.sendNotice('Welcome to my room, ' + user['user'] + '. Please take a moment to read my room rules before chatting. Thank you!', user['user'], '#CCF5EB', '', 'bold'); displayRules(user['user']); }); cb.onMessage(function(msg) { if(msg['m'].match(/\/rules/i)) { msg['X-Spam'] = true; displayRules(msg['user']); } if(msg['m'].match(/\/agreed/i)) { msg['X-Spam'] = true; if (!cbjs.arrayContains(cb.limitCam_allUsersWithAccess(), msg['user'])) { cb.limitCam_addUsers([msg['user']]); users_agreed[msg['user']] = true; cb.sendNotice('Thanks for agreeing to my rules. You may now view my cam.', msg['user']); } } if(msg['m'].match(/\/nolimitcam/i) && msg['user'] == cb.room_slug) { msg['X-Spam'] = true; if (cb.limitCam_isRunning()) { cb.limitCam_stop(); cb.limitCam_removeAllUsers(); cb.sendNotice('Everyone can now view my cam.'); } users_agreed = []; } if(msg['m'].match(/\/limitcam/i) && msg['user'] == cb.room_slug) { msg['X-Spam'] = true; if (!cb.limitCam_isRunning()) { cb.limitCam_removeAllUsers(); cb.limitCam_start("You must agree to the room rules in order to view my cam."); } else { cb.limitCam_removeAllUsers(); } cb.sendNotice('Please agree to the room rules to view my cam. \nType /rules to see the room rules.', '', '', '', 'bold'); displayMsgForBroadcaster(); } return msg; }); function displayRules(username) { var notices = '## Follow The Room Rules ##'; for(var i=1; i<=20;i++) { if(cb.settings['rule' + i]) notices += '\nRule #'+ i +': ' + cb.settings['rule'+i]; } if ((username != cb.room_slug) && (users_agreed[username] == undefined)) { notices += '\n\nYOU MUST AGREE TO THE RULES IN ORDER TO VIEW THE CAM'; notices += '\n*** Type /agreed to view my cam ***' } cb.sendNotice(notices, username, '', '#FF0000', 'bold'); } function displayRulesInfinitely() { displayRules(); cb.setTimeout(displayRulesInfinitely, cb.settings.advertisement_wait_time * 60000); } function displayMsgForBroadcaster() { var broadcaster_notices = ''; broadcaster_notices += 'BROADCASTER: You must type /nolimitcam to (BEFORE DEACTIVATING THIS BOT) allow everyone to view your cam again. \nTo enforce room rules again without re-activating the bot, type /limitcam.'; cb.sendNotice(broadcaster_notices, cb.room_slug, '', '#0000CC', 'bold'); } function init() { if(!cb.limitCam_isRunning()) { cb.limitCam_removeAllUsers(); cb.limitCam_start("You must agree to the room rules in order to view my cam."); } displayRulesInfinitely(); displayMsgForBroadcaster(); } init();
© Copyright Chaturbate 2011- 2024. All Rights Reserved.