Apps Home
|
Create an App
test limitcam
Author:
strangestalien
Description
Source Code
Launch App
Current Users
Created by:
Strangestalien
/* Title: WebPass Author: webguy234 Summary: limitCam feature with option for you to allow mods to help control the pass list. Description: limitCam feature with option for you to allow mods to help control the pass list. Only you can start and stop the show no matter what. You can manage the list at any point while the app is running. Add or Remove multiple users at a time manually. There are quite a few commands for use. Version: 1.0 (1/14/14) Any feedback is welcome! // TODO: // clean up the code! */ var allModsControl = false; cb.settings_choices = [ {name: 'min_start_tokens', type: 'int', minValue: 1, maxValue: 1000, defaultValue: 100, label: "Cost to Join Show"}, {name: 'hide_message', label: 'Cam Message', type: 'str', minLength: 1, maxLength: 256, defaultValue: 'Secret Show in progress! Tip to join in on the fun!' } ]; cb.onTip(function(tip) { if (!cbjs.arrayContains(cb.limitCam_allUsersWithAccess(), tip['from_user'])) { if(parseInt(tip['amount']) >= cb.settings.min_start_tokens) { output('Added '+ tip['from_user'] + ' to secret show!'); cb.limitCam_addUsers([tip['from_user']]); } } cb.drawPanel(); }); cb.onMessage(function (msg) { var message = msg['m']; var user = msg['user']; var username = ""; if (cb.room_slug == user && message == '/start' && !cb.limitCam_isRunning()) { output(cb.room_slug + ' has started the show!'); cb.limitCam_start(cb.settings.hide_message); } if (cb.room_slug == user && message == '/stop' && cb.limitCam_isRunning()) { output(cb.room_slug + ' has stopped the show!'); cb.limitCam_stop(); } if (((allModsControl && msg['is_mod']) || cb.room_slug == user) && message.substring(0, 7) == '/remove' && cb.limitCam_allUsersWithAccess().length > 0) { usernameList = message.substring(8, message.length); var usernames = usernameList.split(","); for (var i=0; i<usernames.length; i++) { usernames[i] = usernames[i].trim(); if (cbjs.arrayContains(cb.limitCam_allUsersWithAccess(), usernames[i])) { var user = new Array(); user.push(usernames[i]); cb.limitCam_removeUsers(user); output(usernames[i] + ' has been removed from the show!'); } } cb.drawPanel(); } if (((allModsControl && msg['is_mod']) || cb.room_slug == user) && message.substring(0, 10) == '/removeall' && cb.limitCam_allUsersWithAccess().length > 0) { cb.limitCam_removeAllUsers(); output('All users have been removed from the show!'); cb.drawPanel(); } if (((allModsControl && msg['is_mod']) || cb.room_slug == user) && message.substring(0, 4) == '/add') { usernameList = message.substring(5, message.length); var usernames = usernameList.split(","); for (var i=0; i<usernames.length; i++) { usernames[i] = usernames[i].trim(); if (!cbjs.arrayContains(cb.limitCam_allUsersWithAccess(), usernames[i])) { var user = new Array(); user.push(usernames[i]); cb.limitCam_addUsers(user); output(usernames[i] + ' has been added to the show!'); } } cb.drawPanel(); } if (((allModsControl && msg['is_mod']) || cb.room_slug == user) && message.substring(0, 6) == '/check') { username = message.substring(7, message.length); if (cb.limitCam_userHasAccess(username)) { output(username + " is in the show!"); } else { output(username + " is not in the show!"); } } if (((allModsControl && msg['is_mod']) || cb.room_slug == user) && message == '/passlist') { var userlist = cb.limitCam_allUsersWithAccess(); if (userlist.length > 0) { output("" + userlist.length + (userlist.length > 1 ? " users" : " user") + " in show: " + cbjs.arrayJoin(userlist, ", ")); } else { output("No users in show."); } } if (message == '/passcommands') { var commands = "/start (only broadcaster, starts the limited cam)\n" + "/stop (only broadcaster, stops the limited cam)\n" + "/modyes (only broadcaster, allows mods to manage list by adding, removing, and checking users)\n" + "/modno (only broadcaster, disallows mods to manage list)\n" + "/remove <users> (remove user(s) from the list, comma separated list)\n" + "/removeall (remove all users from the list)\n" + "/add <users> (add user(s) to the list, comma separated list)\n" + "/check <users> (check if a user is on the list)\n" + "/passlist (view all users on pass list)\n" + "/passcommands (see this list)" cb.sendNotice(commands,user); } if (cb.room_slug === user && message == '/modyes') { allModsControl = true; output(cb.room_slug + ' has allowed mods to control the pass list!'); cb.drawPanel(); } if (cb.room_slug === user && message == '/modno') { allModsControl = false; output(cb.room_slug + ' has disallowed mods to control the pass list!'); cb.drawPanel(); } if (message[0] == '/') { msg['X-Spam'] = true; } return msg; }); function output(message) { cb.chatNotice(message); } cb.onDrawPanel(function(user) { var userlist = cb.limitCam_allUsersWithAccess(); var row1val = 'No'; if (allModsControl){ row1val = 'Yes'; } return { 'template': '3_rows_of_labels', 'row1_label': 'Mods help manage?', 'row1_value': row1val, 'row2_label': 'Pass holders', 'row2_value': userlist.length, 'row3_label': 'Pass cost', 'row3_value': cb.settings.min_start_tokens }; }); function updateSubject() { cb.changeRoomSubject('WebPass running! Tip ' + cb.settings.min_start_tokens + ' to buy a pass. Type /passcommands to see all commands.'); cb.drawPanel(); } function init() { updateSubject(); } init();
© Copyright Freesexcam 2011- 2024. All Rights Reserved.