Bots Home
|
Create an App
pokjhgfvbnm
Author:
i_love_asian_women
Description
Source Code
Launch Bot
Current Users
Created by:
I_Love_Asian_Women
cb.settings_choices = [{ name: 'min_start_tokens', type: 'int', minValue: 1, maxValue: 1000, defaultValue: 100, label: "Cost to Join Before Show Starts" }, { name: 'min_join_tokens', type: 'int', minValue: 0, maxValue: 1000, defaultValue: 100, label: "Cost to Join After Show Starts." }, { name: 'hide_message', label: 'Cam Message', type: 'str', minLength: 1, maxLength: 256, defaultValue: "Cam is now hidden! Tip 100 tokens to join the fun!" }, { name: 'discreet', label: 'Keep app notices to the model and mods', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes' }, { name: 'always_in', label: 'Always get to see your show (comma to separate)', type: 'str', minLength: 0, maxLength: 30000, required: false, defaultValue: "" }, { name: 'always_out', label: 'Never get to see your show (comma to separate)', type: 'str', minLength: 0, maxLength: 30000, required: false, defaultValue: "" }, { name: 'fan_clubs_in', label: 'Fan club members watch for free?', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes' }, { name: 'moderators_in', label: 'Moderators watch for free?', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes' }, { name: 'moderators_op', label: 'Can your moderators control the bot?', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes' }, ]; var allwaysIn = []; var allwaysOut= []; function fillAlwaysIn() { var aistr = cb.settings.always_in; if (aistr && aistr.length) { var re = /\s*,\s*/; allwaysIn = aistr.split(re); addMultipleUsers(allwaysIn); } } function fillAlwaysOut() { var aostr = cb.settings.always_out; if (aostr && aostr.length) { var re = /\s*,\s*/; allwaysOut = aostr.split(re); } } cb.onTip(function(tip) { if (!cbjs.arrayContains(cb.limitCam_allUsersWithAccess(), tip['from_user'])) { if (!cb.limitCam_isRunning() && parseInt(tip['amount']) >= cb.settings.min_start_tokens) { addSingleUser(tip['from_user']); } if (cb.limitCam_isRunning() && parseInt(tip['amount']) >= cb.settings.min_join_tokens && cb.settings.min_join_tokens > 0) { addSingleUser(tip['from_user']); } } }); function addSingleUser(user) { if (!cb.limitCam_userHasAccess(user)) { if (user in allwaysOut) { discreetOutput('User ' + user + ' not added to the show - on ban list'); } else { directOutput('Added ' + user + ' to secret show!', user); cb.limitCam_addUsers([user]); } } } function addMultipleUsers(users) { var i = 0; while (i < users.length) { addSingleUser(users[i]); i = i + 1; } } function directOutput(message, user) { if (checkBoolSetting(cb.settings.discreet)) { cb.sendNotice(message, user); cb.sendNotice(message, cb.room_slug); } else { cb.sendNotice(message); } } function discreetOutput(message) { if (checkBoolSetting(cb.settings.discreet)) { cb.sendNotice(message, cb.room_slug); } else { cb.sendNotice(message); } } function output(message) { cb.sendNotice(message); } function checkBoolSetting(str) { return (str == 'Yes'); } function is_moder(user) { if (checkBoolSetting(cb.settings.moderators_op)) { return user['is_mod'] || (user['user'] == cb.room_slug); } else { return user['user'] == cb.room_slug; } } function processEvent(user) { if (checkBoolSetting(cb.settings.moderators_in) && user['is_mod']) { addSingleUser(user['user']); } if (checkBoolSetting(cb.settings.fan_clubs_in) && user['in_fanclub']) { addSingleUser(user['user']); } if (user['user'] in allwaysIn) { addSingleUser(user['user']); } } cb.onEnter(function(user) { processEvent(user); }); cb.onMessage(function(msg) { var message = msg['m']; var user = msg['user']; var username = ""; processEvent(msg); if (is_moder(msg) && message == '/start' && !cb.limitCam_isRunning()) { output(user + ' has started the show!'); cb.limitCam_start(cb.settings.hide_message); } if (is_moder(msg) && message == '/stop' && cb.limitCam_isRunning()) { output(user + ' has stopped the show!'); cb.limitCam_stop(); } if (is_moder(msg) && message.substring(0, 7) == '/remove' && cb.limitCam_allUsersWithAccess().length > 0) { username = message.substring(8, message.length); if (cbjs.arrayContains(cb.limitCam_allUsersWithAccess(), username)) { cb.limitCam_removeUsers([username]); directOutput(user + ' has removed ' + username + ' from the show!', username); } } if (is_moder(msg) && message.substring(0, 6) == '/check') { username = message.substring(7, message.length); if (cb.limitCam_userHasAccess(username)) { discreetOutput(username + " is in the show!"); } else { discreetOutput(username + " is not in the show!"); } } if (is_moder(msg) && message === '/list') { var userlist = cb.limitCam_allUsersWithAccess(); if (userlist.length > 0) { discreetOutput("" + userlist.length + (userlist.length > 1 ? " users" : " user") + " in show: " + cbjs.arrayJoin(userlist, ", ")); } else { discreetOutput("No users in show."); } } if (is_moder(msg) && message.substring(0, 4) == '/add') { username = message.substring(5, message.length); addSingleUser(username); } if (is_moder(msg) && message.substring(0, 6) == '/clear' && cb.limitCam_allUsersWithAccess().length > 0) { discreetOutput("Cleared all users") cb.limitCam_removeUsers(cb.limitCam_allUsersWithAccess()); } if (message[0] == '/') { msg['X-Spam'] = true; } return msg; }); fillAlwaysOut(); fillAlwaysIn();
© Copyright Chaturbate 2011- 2024. All Rights Reserved.