Bots Home
|
Create an App
Miara's Minions
Author:
miarariley
Description
Source Code
Launch Bot
Current Users
Created by:
Miarariley
// Miaras Minions bot // CB app settings cb.settings_choices = [ { name: 'doColoring', type: 'choice', label: 'Change text and background coloring for members and minions (choose colours below)?', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes' }, { name: 'doText', type: 'choice', label: 'Add text labels in front of members and minions messages (choose text below)?', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes' }, { name: 'mmText', label: 'Text to put in front of Minions members messages (e.g. Minion), the text will be put inside square brackets []', type: 'str', minLength: 0, maxLength: 10, required: false, defaultValue: 'Minion' }, {name: 'mmTextColor', label: 'Minions 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: 'Minions members background color - HTML colour code without starting \'#\' e.g. (000000 is black)', type: 'str', minLength: 0, maxLength: 6, required: false, defaultValue: '000000'}, {name: 'bothTextColor', label: 'Minions members text color - HTML colour code without starting \'#\' e.g. (FFFFFF is white)', type: 'str', minLength: 0, maxLength: 6, required: false, defaultValue: '000000'}, {name: 'bothBGColor', label: 'Minions members background color - HTML colour code without starting \'#\' e.g. (000000 is black)', type: 'str', minLength: 0, maxLength: 6, required: false, defaultValue: 'FFFFFF'}, {name: 'mmMinTip', label: 'Minimum tip to become Minions', type: 'int', minValue: 1, defaultValue: 888}, {name: 'mmAnnounce', label: 'Text to show when someone tips to become a Minions 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 Miara\'s Minions'}, {name: 'mmMemberList', label: 'List of current Minions, separated by commas (and they need to be the CB username exactly)', type: 'str', minLength: 0, maxLength: 10240, required: false, defaultValue: ''}, {name: 'mmRainText', label: 'Text to use for Minions rain lines', type: 'str', minLength: 0, maxLength: 80, required: false, defaultValue: 'Muahahaha'}, {name: 'mmRainCount', label: 'Number of lines of Minions rain', type: 'int', minValue: 1, maxValue: 15, defaultValue: 5}, {name: 'mgText', label: 'Text to put in front of Sweet Minion messages (e.g. EN)', type: 'str', minLength: 0, maxLength: 10, required: false, defaultValue: 'Sweet Minions'}, {name: 'mgTextColor', label: 'Sweet Minion text color - HTML colour code without starting \'#\' e.g. (000000 is black)', type: 'str', minLength: 0, maxLength: 6, required: false, defaultValue: 'FFFFFF'}, {name: 'mgBGColor', label: 'Sweet Minion background color - HTML colour code without starting \'#\' e.g. (F5B608 is orangey/gold)', type: 'str', minLength: 0, maxLength: 6, required: false, defaultValue: '000000'}, {name: 'mgMinTip', label: 'Minimum tip to become Sweet Minion', type: 'int', minValue: 1, defaultValue: 1001}, {name: 'mgAnnounce', label: 'Text to show when someone tips to become a Sweet Minion, 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 joined the Sweet Minions'}, {name: 'mgMemberList', label: 'List of current Sweet Minions, separated by commas (and they need to be the CB username exactly)', type: 'str', minLength: 0, maxLength: 10240, required: false, defaultValue: ''}, {name: 'mgRainText', label: 'Text to use for Sweet Minions rain lines', type: 'str', minLength: 0, maxLength: 80, required: false, defaultValue: 'Om nom nom nom'}, {name: 'mgRainCount', label: 'Number of lines of Sweet Minion 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) && isMM(u) ) { msg['background'] = '#' + cb.settings.bothBGColor; msg['c'] = '#' + cb.settings.bothTextColor; msg['m'] = "[" +cb.settings.mmText+" / "+ cb.settings.mgText + "] " + msg['m']; } else 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 Minion 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); } if (amountTipped == cb.settings.mmMinTip) { // Make Sweet Minions 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 minions 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 Sweet Minions 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();// JavaScript Document
© Copyright Chaturbate 2011- 2026. All Rights Reserved.