Bots Home
|
Create an App
Metal Militia
Author:
londonrayne
Description
Source Code
Launch Bot
Current Users
Created by:
Londonrayne
// Mandy's Metal Militia bot // CB app settings cb.settings_choices = [ {name: 'doColoring', type: 'choice', label: 'Change text and background coloring for members and gods (choose colours below)?', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes'}, {name: 'doText', type: 'choice', label: 'Add text labels in front of members and gods messages (choose text below)?', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes'}, {name: 'mmText', label: 'Text to put in front of Metal Militia members messages (e.g. MM), the text will be put inside square brackets []', type: 'str', minLength: 0, maxLength: 10, required: false, defaultValue: 'MM'}, {name: 'mmTextColor', label: 'Metal Militia members text color - HTML colour code without starting \'#\' e.g. (FFFFFF is white)', type: 'str', minLength: 0, maxLength: 6, required: false, defaultValue: 'FFFFFF'}, {name: 'mmBGColor', label: 'Metal Militia members background color - HTML colour code without starting \'#\' e.g. (000000 is black)', type: 'str', minLength: 0, maxLength: 6, required: false, defaultValue: '000000'}, {name: 'mmMinTip', label: 'Minimum tip to become Metal Militia member', type: 'int', minValue: 1, defaultValue: 666}, {name: 'mmAnnounce', label: 'Text to show when someone tips to become a Metal Militia member, the text MEMBERNAME will be replaced with the username of the new (Note: graphics don\'t work in this text)', type: 'str', minLength: 0, maxLength: 10240, required: false, defaultValue: 'MEMBERNAME just joined Mandy\'s Metal Militia'}, {name: 'mmMemberList', label: 'List of current Metal Militia members, separated by commas (and they need to be the CB username exactly)', type: 'str', minLength: 0, maxLength: 10240, required: false, defaultValue: 'Josho1121,penguinmaine,punchthedonkey,lostinorthcarolina,chritenen,Gabbz6669,wickedxrebel,silverback316,sarantis,zotin,the_nypho_bbw,desterock,pleiadian,Kujaiden,justacountryboy,xAgent69x,Velk,seniorazuldawg,devildog99,scorpioten,link9456,lpool91,Pr0dzilla,swiftee,estrussolution,neodragon39,zero194194,Geeoki,llggpp,pattyryan,demetrius7634,Tolgade,faka71,pitou1310,vcmarucio,cheepson,geeos,tonyandjess,Lionheart003,Optifreak,wood84,rock246,ttime,Jalkai,I_love_squirt,crisp2006,boddington,Keevabomb,bigram98,bigmac,whodat1234,darwin88,slappy87,laxer327,drexsil,johnny84,onlytoplz,rooks,alittlepuppy'}, {name: 'mmRainText', label: 'Text to use for Metal Militia rain lines', type: 'str', minLength: 0, maxLength: 80, required: false, defaultValue: 'METAL MILITIA METAL MILITIA METAL MILITIA METAL MILITIA'}, {name: 'mmRainCount', label: 'Number of lines of Metal Militia rain', type: 'int', minValue: 1, maxValue: 15, defaultValue: 15}, {name: 'mgText', label: 'Text to put in front of Metal Gods messages (e.g. MG)', type: 'str', minLength: 0, maxLength: 10, required: false, defaultValue: 'MG'}, {name: 'mgTextColor', label: 'Metal Gods text color - HTML colour code without starting \'#\' e.g. (000000 is black)', type: 'str', minLength: 0, maxLength: 6, required: false, defaultValue: '000000'}, {name: 'mgBGColor', label: 'Metal Gods background color - HTML colour code without starting \'#\' e.g. (F5B608 is orangey/gold)', type: 'str', minLength: 0, maxLength: 6, required: false, defaultValue: 'F5B608'}, {name: 'mgMinTip', label: 'Minimum tip to become Metal God', type: 'int', minValue: 1, defaultValue: 1666}, {name: 'mgAnnounce', label: 'Text to show when someone tips to become a Metal God, 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 METAL GOD'}, {name: 'mgMemberList', label: 'List of current Metal Gods, separated by commas (and they need to be the CB username exactly)', type: 'str', minLength: 0, maxLength: 10240, required: false, defaultValue: 'VELK'}, {name: 'mgRainText', label: 'Text to use for Metal God rain lines', type: 'str', minLength: 0, maxLength: 80, required: false, defaultValue: 'METAL GOD METAL GOD METAL GOD METAL GOD METAL GOD'}, {name: 'mgRainCount', label: 'Number of lines of Metal God rain', type: 'int', minValue: 1, maxValue: 15, defaultValue: 15} ]; var mmMembers = {}; var mgMembers = {}; // For auto-silencing at least some of token_wh*re_c*nts usernames var twcRegex = /t.?k.?n.?wh.?r.?_c.?nt.?/i; cb.onMessage(function (msg) { // vars for ease of use var u = msg['user']; if (isMG(u)) { msg['background'] = '#' + cb.settings.mgBGColor; msg['c'] = '#' + cb.settings.mgTextColor; msg['m'] = "[" + cb.settings.mgText + "] " + msg['m']; } else if (isMM(u)) { msg['background'] = '#' + cb.settings.mmBGColor; msg['c'] = '#' + cb.settings.mmTextColor; msg['m'] = "[" + cb.settings.mmText + "] " + 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.mgMinTip && !isMG(tip['from_user'])) { // Make Metal God and announce it var announcement = cb.settings.mgAnnounce.replace("MEMBERNAME", tip['from_user']); makeMG(tip['from_user']); for (var i = 0; i < cb.settings.mgRainCount; i++) { cb.chatNotice(cb.settings.mgRainText); } cb.chatNotice(announcement); } else if (amountTipped >= cb.settings.mmMinTip && !isMM(tip['from_user'])) { // Make Metal Militia and announce it var announcement = cb.settings.mmAnnounce.replace("MEMBERNAME", tip['from_user']); makeMM(tip['from_user']); for (var i = 0; i < cb.settings.mmRainCount; i++) { cb.chatNotice(cb.settings.mmRainText); } cb.chatNotice(announcement); } }); function isMG(username) { return (username in mgMembers); } function isMM(username) { return (username in mmMembers); } function makeMG(username) { mgMembers[username] = {'u': 1}; } function makeMM(username) { mmMembers[username] = {'u': 1}; } function grabSettings() { cb.log("starting grabbing settings"); // Get militia members if (cb.settings.mmMemberList) { var mmMemberSettings = cb.settings.mmMemberList.split(','); for (var ii = 0; ii < mmMemberSettings.length; ii++) { var clean = mmMemberSettings[ii].toLowerCase().replace(/ /g,""); mmMembers[clean] = {'u': 1}; } } // Get metal gods if (cb.settings.mgMemberList) { var mgMemberSettings = cb.settings.mgMemberList.split(','); for (var ii = 0; ii < mgMemberSettings.length; ii++) { var clean = mgMemberSettings[ii].toLowerCase().replace(/ /g,""); mgMembers[clean] = {'u': 1}; } } cb.log("finished grabbing settings"); } grabSettings();
© Copyright Chaturbate 2011- 2026. All Rights Reserved.