Bots Home
|
Create an App
Barangandan
Author:
estevaltest
Description
Source Code
Launch Bot
Current Users
Created by:
Estevaltest
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 During Show. Set to 0 to Disable Joining During Show."}, {name: 'enter_message', label: 'Welcome Message', type: 'str', minLength: 1, maxLength: 256, defaultValue: 'Welcome to my room !' }, {name:'msg1', type:'str', required: true, label:'Message 1',}, {name:'msg2', type:'str', required: false, label:'Message 2',}, {name:'msg3', type:'str', required: false, label:'Message 3',}, {name:'msg4', type:'str', required: false, label:'Message 4',}, {name:'msg5', type:'str', required: false, label:'Message 5',}, {name:'msgcolor', type:'str', label:'Notice color (html code default dark red #9F000F)', defaultValue: '#9F000F'}, {name: 'chat_ad', type:'int', minValue: 1, maxValue: 999, defaultValue: 2,label: 'Delay in minutes between notices being displayed (minimum 1)'}, {name: 'customWordlist',label: 'Custom block wordlist',type: 'str', minLength: 1, maxLength: 1000, defaultValue: 'vagina,boobs,poo,pee', required: false} ]; var i=0; var MAXITEMS=5; var hideCamMsg='Exclusive Show\n' + cb.settings.min_join_tokens + ' tokens buy in\n(' + cb.settings.min_start_tokens + ' tokens when cam is open)'; function parseWordlist(messageTest) { var stBlocked = false; if (!cb.settings.customWordlist.length == 0) { customWordlistRegex = cb.settings.customWordlist.replace(/^(\s|,|\|)+|(\s|,|\|)+$/gm, ''); //trim leading/trailing spaces, commas, or pipes from string customWordlistRegex = customWordlistRegex.replace(/\s*(,|\|)\s*/gm, '|'); // replace commas or pipes surrounded by spaces with pipes customWordlistRegex = customWordlistRegex.replace(/[^\w|\s]/gm, ' '); // replace anything that's not a letter or a pipe with a space customWordlistRegex = customWordlistRegex.replace(/(\w)/gm, '$1+' ); //add a + between each letter customWordlistRegex = customWordlistRegex.replace(/\s+/gm, '\\s*' ); // replace spaces with \s* } messageTest = messageTest.replace(/[^\w]|_/ig, ''); var customwordlist = new RegExp('(' + customWordlistRegex + ')', 'i'); if (messageTest.search(customwordlist) != -1) { var stBlocked = true; } return stBlocked; } function chatAd() { var ntAd; while (cb.settings['msg' + (i + 1)] == 0) { i++; i %= MAXITEMS; } ntAd = cb.settings['msg' + (i + 1)]; i++; i %= MAXITEMS; cb.sendNotice(ntAd,'','',cb.settings['msgcolor'],'bold'); cb.setTimeout(chatAd, (cb.settings.chat_ad * 60000)); } cb.setTimeout(chatAd, (cb.settings.chat_ad * 60000)); cb.onEnter(function(user) { cb.sendNotice(cb.settings.enter_message, user['user']); if(cb.limitCam_isRunning()) { cb.sendNotice(hideCamMsg, user['user']); } }); 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) { output('Added '+ tip['from_user'] + ' to secret show!'); cb.limitCam_addUsers([tip['from_user']]); } if(cb.limitCam_isRunning() && parseInt(tip['amount']) >= cb.settings.min_join_tokens && cb.settings.min_join_tokens > 0) { output('Added '+ tip['from_user'] + ' to secret show!'); cb.limitCam_addUsers([tip['from_user']]); } } }); cb.onMessage(function (msg) { var message = msg['m']; var user = msg['user']; var username = ""; var aryMsg = msg['m'].split(' '); if(aryMsg[0].charAt(0) == '/') { msg['X-Spam'] = true; switch(aryMsg[0]) { case '/whisper': case '/w': case '/tell': case '/t': case '/pm': { msg['X-Spam'] = true; cb.sendNotice('This private message was not sent because I was told to not allow it by the master.',msg['user']); break; } case '/reply': case '/r': { msg['X-Spam'] = true; cb.sendNotice('This reply was not sent because I was told to not allow it by the master.',msg['user']); break; } } } if(!msg['is_mod'] && msg['user'] != cb.room_slug && !msg['in_fanclub']) { for(var i = 0; i < aryMsg.length; i++) { if(aryMsg[i].charAt(0) == ':') { msg['X-Spam'] = true; cb.sendNotice('Your message was not sent because you tried to use ' + aryMsg[i] + ' and you have not the right of using it in this room.\n',msg['user']); } } } if(parseWordlist(msg['m']) && !msg['is_mod'] && msg['user'] != cb.room_slug && !msg['in_fanclub']) { msg['X-Spam'] = true; cb.sendNotice('This message was not sent because master forbids the use a word it contains.',msg['user']); } if(msg['m'] == msg['m'].toUpperCase() && !msg['is_mod'] && msg['user'] != cb.room_slug && !msg['in_fanclub']) { msg['X-Spam'] = true; cb.sendNotice('This message was not sent because either you used all caps, or have no message writen at all.',msg['user']); } if (cb.room_slug === user && message == '/start' && !cb.limitCam_isRunning()) { output(cb.room_slug + ' has started the show!'); cb.limitCam_start(hideCamMsg); } if (cb.room_slug === user && message == '/stop' && cb.limitCam_isRunning()) { output(cb.room_slug + ' has stopped the show!'); cb.limitCam_stop(); } if (cb.room_slug === user && 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]); output(cb.room_slug + ' has removed ' + username + ' from the show!'); } } if (cb.room_slug === user && message.substring(0, 4) == '/add') { username = message.substring(5, message.length); cb.limitCam_addUsers([username]); output(cb.room_slug + ' has added ' + username + ' to the show!'); } if (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 (cb.room_slug === user && message === '/list') { 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[0] == '/') { msg['X-Spam'] = true; } return msg; }); function output(message) { cb.chatNotice(message,cb.room_slug); }
© Copyright Chaturbate 2011- 2024. All Rights Reserved.