Bots Home
|
Create an App
tester 1
Author:
testytester
Description
Source Code
Launch Bot
Current Users
Created by:
Testytester
// CB app settings cb.settings_choices = [ {name: 'cText', label: 'Text to put in front of Cat messages (e.g. JBF)', type: 'str', minLength: 0, maxLength: 30, required: false, defaultValue:':catkisscat'}, {name: 'cTextColor', label: 'Cat text color - HTML colour code without starting \'#\' e.g. (FFFFFF is white)', type: 'str', minLength: 0, maxLength: 6, required: false, defaultValue: '000000'}, {name: 'cMinTip', label: 'Minimum tip to become Cat', type: 'int', minValue: 1, defaultValue: 100}, {name: 'cAnnounce', label: 'Text to show when someone tips to become a Cat, the text MEMBERNAME will be replaced with the username of the new member (Note: graphics don\'t work in this text)', type: 'str', minLength: 0, maxLength: 10240, required: false, defaultValue: 'MEMBERNAME just became a Cat'}, {name: 'cMemberList', label: 'List of current Cats, separated by commas (and they need to be the CB username exactly)', type: 'str', minLength: 0, maxLength: 10240, required: false, defaultValue: 'lipto,chuckbass3,wizzytoy,nydaveh,pronkta,blu_sky'}, {name: 'cAlertText', label: 'Text to use for Cat alert lines', type: 'str', minLength: 0, maxLength: 80, required: false, defaultValue: 'Miaow!'}, {name: 'cAlertCount', label: 'Number of lines of Cat alert', type: 'int', minValue: 1, maxValue: 15, defaultValue: 1}, ]; var catMembers = {}; var mmNotice = "Tip " + cb.settings.cMinTip + " to become a Cat!"; // For auto-silencing at least some of token_wh*re_c*nts usernames var twcRegex = /t.?k.?n.?wh.?r.?_c.?nt.?/i; function showMMNotice() { cb.chatNotice(mmNotice); cb.setTimeout(showMMNotice, 900000); } cb.onMessage(function (msg) { // vars for ease of use var u = msg['user']; // Don't process commands and hide them if (/^\//.test(msg['m'])) { msg['X-Spam'] = true; return msg; } if (isCat(u)) { msg['c'] = '#' + cb.settings.cTextColor; msg['m'] = " " + cb.settings.cText + " " + msg['m']; } if (twcRegex.test(u)) { // Auto-silencing at least some of token_wh*re_c*nts usernames msg['X-Spam'] = true; } return msg; }); cb.onTip(function (tip) { var amountTipped = parseInt(tip['amount']); if (amountTipped >= cb.settings.cMinTip && !isCat(tip['from_user'])) { // Make Cat and announce it var announcement = cb.settings.cAnnounce.replace("MEMBERNAME", tip['from_user']); makeB(tip['from_user']); for (var i = 0; i < cb.settings.cAlertCount; i++) { cb.chatNotice(cb.settings.cAlertText); } cb.chatNotice(announcement); } }); function isCat(username) { return (username in catMembers); } function makeB(username) { catMembers[username] = {'u': 1}; } function grabSettings() { cb.log("starting grabbing settings"); // Get legend members // Get Cat if (cb.settings.cMemberList) { var catMembersettings = cb.settings.cMemberList.split(','); for (var ii = 0; ii < catMembersettings.length; ii++) { var clean = catMembersettings[ii].toLowerCase().replace(/ /g, ""); catMembers[clean] = {'u': 1}; } } cb.log("finished grabbing settings"); } grabSettings(); showMMNotice();
© Copyright Chaturbate 2011- 2024. All Rights Reserved.