Bots Home
|
Create an App
PBP Mothership
Author:
dorothy
Description
Source Code
Launch Bot
Current Users
Created by:
Dorothy
/** Name: PBP Mothership Author: chelsea2950 for perfectbrownpussy Current version 1.1 Created 03/02/2019 Last Updated 03/28/2019 (see description for change log) This is a fanclub bot with the following features: - Enter the fanclub list using a comma separated string - Also able to join the club within a show by tipping the defined amount - Members get font and highlight color choices - 50 slots for personalized icons **/ { if (cb.room_slug == 'perfectbrownpussy') { cb.settings_choices = [ {name: 'dummy0', label: '**************************************************************** Welcome back perfectbrownpussy! ****************************************************************', type: 'choice',required: false}, {name: 'tipToJoin',label: 'Allow tipping to join the Fan Club?', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes'}, {name: 'tipAmountToJoin',label: 'Tip Amount to join fanclub during the show', type: 'int', minValue: 1,maxValue: 10000,defaultValue: 500}, {name: 'fanclubList', label: 'Enter the names of existing Mothership Fan Club members. Should be the CB usernames, separated by a comma with no spaces',type: 'str',minLength: 1,maxLength: 1000, defaultValue: '',required: false}, {name: 'fanclubDefaultIcon',label: 'Choose the default icon to be displayed for the fanclub users, if they do not have a personalized one defined below',type: 'str',required: false,minLength: 1,maxLength: 50}, {name: 'textColor',label: 'Text color for fanclub user messages',type: 'choice',choice1: 'White/No Color',choice2: 'Black',choice3: 'Dark Grey',choice4: 'Dark Red',choice5: 'Dark Orange',choice6: 'Dark Green',choice7: 'Dark Aqua',choice8: 'Dark Blue',choice9: 'Dark Purple',choice10: 'Dark Pink',choice11: 'Dark Gold',choice12: 'Dark Teal',choice13: 'Dark Brown',choice14: 'Dark Bronze',choice15: 'Dark Periwinkle',choice16: 'Dark Fuschia',choice17: 'Dark Lime',choice18: 'Dark Plum',choice19: 'Custom',defaultValue: 'Dark Green'}, {name: 'textCustomColor', label: 'If you picked "Custom" as the text color in the previous setting, enter the hex color (6 character hex color codes including the # prefix, such as #FFFFFF):', type: 'str', minLength: 1,maxLength: 7,required: false}, {name: 'highlightColor',label: 'Background/Highlight color for fanclub user messages', type: 'choice', choice1: 'White/No Color',choice2: 'Light Yellow',choice3: 'Light Blue',choice4: 'Light Pink',choice5: 'Light Red',choice6: 'Light Green',choice7: 'Light Purple',choice8: 'Light Orange',choice9: 'Light Grey',choice10: 'Light Aqua',choice11: 'Light Teal',choice12: 'Cream',choice13: 'Light Bronze',choice14: 'Light Periwinkle',choice15: 'Light Fuschia',choice16: 'Light Lime',choice17: 'Light Plum',choice18: 'Custom',defaultValue: 'Light Green'}, {name: 'highlightCustomColor', label: 'If you picked "Custom" as the highlight color in the previous setting, enter the hex color (6 character hex color codes including the # prefix, such as #FFFFFF):',type: 'str',minLength: 1,maxLength: 7,required: false}, {name: 'heading', label: 'Define the users below that will get a personalized icon next to their name in the chat, plus the icon you would like to use. Fanclub members who are not in the below list will get the default icon is one defined above', type: 'choice',required: false}, {name: 'fanclubIconUser1',label: 'User 1',type: 'str',required: false,minLength: 1, maxLength: 50}, {name: 'fanclubIcon1',label: 'Icon for User 1',type: 'str',required: false,minLength: 1, maxLength: 50}, {name: 'fanclubIconUser2',label: 'User 2',type: 'str',required: false,minLength: 1, maxLength: 50}, {name: 'fanclubIcon2',label: 'Icon for User 2',type: 'str',required: false,minLength: 1, maxLength: 50}, {name: 'fanclubIconUser3',label: 'User 3',type: 'str',required: false,minLength: 1, maxLength: 50}, {name: 'fanclubIcon3',label: 'Icon for User 3',type: 'str',required: false,minLength: 1, maxLength: 50}, {name: 'fanclubIconUser4',label: 'User 4',type: 'str',required: false,minLength: 1, maxLength: 50}, {name: 'fanclubIcon4',label: 'Icon for User 4',type: 'str',required: false,minLength: 1, maxLength: 50}, {name: 'fanclubIconUser5',label: 'User 5',type: 'str',required: false,minLength: 1, maxLength: 50}, {name: 'fanclubIcon5',label: 'Icon for User 5',type: 'str',required: false,minLength: 1, maxLength: 50}, {name: 'fanclubIconUser6',label: 'User 6',type: 'str',required: false,minLength: 1, maxLength: 50}, {name: 'fanclubIcon6',label: 'Icon for User 6',type: 'str',required: false,minLength: 1, maxLength: 50}, {name: 'fanclubIconUser7',label: 'User 7',type: 'str',required: false,minLength: 1, maxLength: 50}, {name: 'fanclubIcon7',label: 'Icon for User 7',type: 'str',required: false,minLength: 1, maxLength: 50}, {name: 'fanclubIconUser8',label: 'User 8',type: 'str',required: false,minLength: 1, maxLength: 50}, {name: 'fanclubIcon8',label: 'Icon for User 8',type: 'str',required: false,minLength: 1, maxLength: 50}, {name: 'fanclubIconUser9',label: 'User 9',type: 'str',required: false,minLength: 1, maxLength: 50}, {name: 'fanclubIcon9',label: 'Icon for User 9',type: 'str',required: false,minLength: 1, maxLength: 50}, {name: 'fanclubIconUser10',label: 'User 10',type: 'str',required: false,minLength: 1, maxLength: 50}, {name: 'fanclubIcon10',label: 'Icon for User 10',type: 'str',required: false,minLength: 1, maxLength: 50}, {name: 'fanclubIconUser11',label: 'User 11',type: 'str',required: false,minLength: 1, maxLength: 50}, {name: 'fanclubIcon11',label: 'Icon for User 11',type: 'str',required: false,minLength: 1, maxLength: 50}, {name: 'fanclubIconUser12',label: 'User 12',type: 'str',required: false,minLength: 1, maxLength: 50}, {name: 'fanclubIcon12',label: 'Icon for User 12',type: 'str',required: false,minLength: 1, maxLength: 50}, {name: 'fanclubIconUser13',label: 'User 13',type: 'str',required: false,minLength: 1, maxLength: 50}, {name: 'fanclubIcon13',label: 'Icon for User 13',type: 'str',required: false,minLength: 1, maxLength: 50}, {name: 'fanclubIconUser14',label: 'User 14',type: 'str',required: false,minLength: 1, maxLength: 50}, {name: 'fanclubIcon14',label: 'Icon for User 14',type: 'str',required: false,minLength: 1, maxLength: 50}, {name: 'fanclubIconUser15',label: 'User 15',type: 'str',required: false,minLength: 1, maxLength: 50}, {name: 'fanclubIcon15',label: 'Icon for User 15',type: 'str',required: false,minLength: 1, maxLength: 50}, {name: 'fanclubIconUser16',label: 'User 16',type: 'str',required: false,minLength: 1, maxLength: 50}, {name: 'fanclubIcon16',label: 'Icon for User 16',type: 'str',required: false,minLength: 1, maxLength: 50}, {name: 'fanclubIconUser17',label: 'User 17',type: 'str',required: false,minLength: 1, maxLength: 50}, {name: 'fanclubIcon17',label: 'Icon for User 17',type: 'str',required: false,minLength: 1, maxLength: 50}, {name: 'fanclubIconUser18',label: 'User 18',type: 'str',required: false,minLength: 1, maxLength: 50}, {name: 'fanclubIcon18',label: 'Icon for User 18',type: 'str',required: false,minLength: 1, maxLength: 50}, {name: 'fanclubIconUser19',label: 'User 19',type: 'str',required: false,minLength: 1, maxLength: 50}, {name: 'fanclubIcon19',label: 'Icon for User 19',type: 'str',required: false,minLength: 1, maxLength: 50}, {name: 'fanclubIconUser20',label: 'User 20',type: 'str',required: false,minLength: 1, maxLength: 50}, {name: 'fanclubIcon20',label: 'Icon for User 20',type: 'str',required: false,minLength: 1, maxLength: 50}, {name: 'fanclubIconUser21',label: 'User 21',type: 'str',required: false,minLength: 1, maxLength: 50}, {name: 'fanclubIcon21',label: 'Icon for User 21',type: 'str',required: false,minLength: 1, maxLength: 50}, {name: 'fanclubIconUser22',label: 'User 22',type: 'str',required: false,minLength: 1, maxLength: 50}, {name: 'fanclubIcon22',label: 'Icon for User 22',type: 'str',required: false,minLength: 1, maxLength: 50}, {name: 'fanclubIconUser23',label: 'User 23',type: 'str',required: false,minLength: 1, maxLength: 50}, {name: 'fanclubIcon23',label: 'Icon for User 23',type: 'str',required: false,minLength: 1, maxLength: 50}, {name: 'fanclubIconUser24',label: 'User 24',type: 'str',required: false,minLength: 1, maxLength: 50}, {name: 'fanclubIcon24',label: 'Icon for User 24',type: 'str',required: false,minLength: 1, maxLength: 50}, {name: 'fanclubIconUser25',label: 'User 25',type: 'str',required: false,minLength: 1, maxLength: 50}, {name: 'fanclubIcon25',label: 'Icon for User 25',type: 'str',required: false,minLength: 1, maxLength: 50}, {name: 'fanclubIconUser26',label: 'User 26',type: 'str',required: false,minLength: 1, maxLength: 50}, {name: 'fanclubIcon26',label: 'Icon for User 26',type: 'str',required: false,minLength: 1, maxLength: 50}, {name: 'fanclubIconUser27',label: 'User 27',type: 'str',required: false,minLength: 1, maxLength: 50}, {name: 'fanclubIcon27',label: 'Icon for User 27',type: 'str',required: false,minLength: 1, maxLength: 50}, {name: 'fanclubIconUser28',label: 'User 28',type: 'str',required: false,minLength: 1, maxLength: 50}, {name: 'fanclubIcon28',label: 'Icon for User 28',type: 'str',required: false,minLength: 1, maxLength: 50}, {name: 'fanclubIconUser29',label: 'User 29',type: 'str',required: false,minLength: 1, maxLength: 50}, {name: 'fanclubIcon29',label: 'Icon for User 29',type: 'str',required: false,minLength: 1, maxLength: 50}, {name: 'fanclubIconUser30',label: 'User 30',type: 'str',required: false,minLength: 1, maxLength: 50}, {name: 'fanclubIcon30',label: 'Icon for User 30',type: 'str',required: false,minLength: 1, maxLength: 50}, {name: 'fanclubIconUser31',label: 'User 31',type: 'str',required: false,minLength: 1, maxLength: 50}, {name: 'fanclubIcon31',label: 'Icon for User 31',type: 'str',required: false,minLength: 1, maxLength: 50}, {name: 'fanclubIconUser32',label: 'User 32',type: 'str',required: false,minLength: 1, maxLength: 50}, {name: 'fanclubIcon32',label: 'Icon for User 32',type: 'str',required: false,minLength: 1, maxLength: 50}, {name: 'fanclubIconUser33',label: 'User 33',type: 'str',required: false,minLength: 1, maxLength: 50}, {name: 'fanclubIcon33',label: 'Icon for User 33',type: 'str',required: false,minLength: 1, maxLength: 50}, {name: 'fanclubIconUser34',label: 'User 34',type: 'str',required: false,minLength: 1, maxLength: 50}, {name: 'fanclubIcon34',label: 'Icon for User 34',type: 'str',required: false,minLength: 1, maxLength: 50}, {name: 'fanclubIconUser35',label: 'User 35',type: 'str',required: false,minLength: 1, maxLength: 50}, {name: 'fanclubIcon35',label: 'Icon for User 35',type: 'str',required: false,minLength: 1, maxLength: 50}, {name: 'fanclubIconUser36',label: 'User 36',type: 'str',required: false,minLength: 1, maxLength: 50}, {name: 'fanclubIcon36',label: 'Icon for User 36',type: 'str',required: false,minLength: 1, maxLength: 50}, {name: 'fanclubIconUser37',label: 'User 37',type: 'str',required: false,minLength: 1, maxLength: 50}, {name: 'fanclubIcon37',label: 'Icon for User 37',type: 'str',required: false,minLength: 1, maxLength: 50}, {name: 'fanclubIconUser38',label: 'User 38',type: 'str',required: false,minLength: 1, maxLength: 50}, {name: 'fanclubIcon38',label: 'Icon for User 38',type: 'str',required: false,minLength: 1, maxLength: 50}, {name: 'fanclubIconUser39',label: 'User 39',type: 'str',required: false,minLength: 1, maxLength: 50}, {name: 'fanclubIcon39',label: 'Icon for User 39',type: 'str',required: false,minLength: 1, maxLength: 50}, {name: 'fanclubIconUser40',label: 'User 40',type: 'str',required: false,minLength: 1, maxLength: 50}, {name: 'fanclubIcon40',label: 'Icon for User 40',type: 'str',required: false,minLength: 1, maxLength: 50}, {name: 'fanclubIconUser41',label: 'User 41',type: 'str',required: false,minLength: 1, maxLength: 50}, {name: 'fanclubIcon41',label: 'Icon for User 41',type: 'str',required: false,minLength: 1, maxLength: 50}, {name: 'fanclubIconUser42',label: 'User 42',type: 'str',required: false,minLength: 1, maxLength: 50}, {name: 'fanclubIcon42',label: 'Icon for User 42',type: 'str',required: false,minLength: 1, maxLength: 50}, {name: 'fanclubIconUser43',label: 'User 43',type: 'str',required: false,minLength: 1, maxLength: 50}, {name: 'fanclubIcon43',label: 'Icon for User 43',type: 'str',required: false,minLength: 1, maxLength: 50}, {name: 'fanclubIconUser44',label: 'User 44',type: 'str',required: false,minLength: 1, maxLength: 50}, {name: 'fanclubIcon44',label: 'Icon for User 44',type: 'str',required: false,minLength: 1, maxLength: 50}, {name: 'fanclubIconUser45',label: 'User 45',type: 'str',required: false,minLength: 1, maxLength: 50}, {name: 'fanclubIcon45',label: 'Icon for User 45',type: 'str',required: false,minLength: 1, maxLength: 50}, {name: 'fanclubIconUser46',label: 'User 46',type: 'str',required: false,minLength: 1, maxLength: 50}, {name: 'fanclubIcon46',label: 'Icon for User 46',type: 'str',required: false,minLength: 1, maxLength: 50}, {name: 'fanclubIconUser47',label: 'User 47',type: 'str',required: false,minLength: 1, maxLength: 50}, {name: 'fanclubIcon47',label: 'Icon for User 47',type: 'str',required: false,minLength: 1, maxLength: 50}, {name: 'fanclubIconUser48',label: 'User 48',type: 'str',required: false,minLength: 1, maxLength: 50}, {name: 'fanclubIcon48',label: 'Icon for User 48',type: 'str',required: false,minLength: 1, maxLength: 50}, {name: 'fanclubIconUser49',label: 'User 49',type: 'str',required: false,minLength: 1, maxLength: 50}, {name: 'fanclubIcon49',label: 'Icon for User 49',type: 'str',required: false,minLength: 1, maxLength: 50}, {name: 'fanclubIconUser50',label: 'User 50',type: 'str',required: false,minLength: 1, maxLength: 50}, {name: 'fanclubIcon50',label: 'Icon for User 50',type: 'str',required: false,minLength: 1, maxLength: 50} ]; } else { cb.settings_choices = [ {name: 'warning', label: 'Sorry, this bot is only usable for broadcaster perfectbrownpussy', type: 'choice',required: false}, ]; } } { // *********************************** Variables and Arrays ************************************** var initialize = 0; /* Used to run initialization once */ var BC = cb.room_slug; var green = "#a2dfac"; // Used for general messaging from fembot var defaultIcon = cb.settings.fanclubDefaultIcon; var User1 = cb.settings.fanclubIconUser1; var User2 = cb.settings.fanclubIconUser2; var User3 = cb.settings.fanclubIconUser3; var User4 = cb.settings.fanclubIconUser4; var User5 = cb.settings.fanclubIconUser5; var User6 = cb.settings.fanclubIconUser6; var User7 = cb.settings.fanclubIconUser7; var User8 = cb.settings.fanclubIconUser8; var User9 = cb.settings.fanclubIconUser9; var User10 = cb.settings.fanclubIconUser10; var User11 = cb.settings.fanclubIconUser11; var User12 = cb.settings.fanclubIconUser12; var User13 = cb.settings.fanclubIconUser13; var User14 = cb.settings.fanclubIconUser14; var User15 = cb.settings.fanclubIconUser15; var User16 = cb.settings.fanclubIconUser16; var User17 = cb.settings.fanclubIconUser17; var User18 = cb.settings.fanclubIconUser18; var User19 = cb.settings.fanclubIconUser19; var User20 = cb.settings.fanclubIconUser20; var User21 = cb.settings.fanclubIconUser21; var User22 = cb.settings.fanclubIconUser22; var User23 = cb.settings.fanclubIconUser23; var User24 = cb.settings.fanclubIconUser24; var User25 = cb.settings.fanclubIconUser25; var User26 = cb.settings.fanclubIconUser26; var User27 = cb.settings.fanclubIconUser27; var User28 = cb.settings.fanclubIconUser28; var User29 = cb.settings.fanclubIconUser29; var User30 = cb.settings.fanclubIconUser30; var User31 = cb.settings.fanclubIconUser31; var User32 = cb.settings.fanclubIconUser32; var User33 = cb.settings.fanclubIconUser33; var User34 = cb.settings.fanclubIconUser34; var User35 = cb.settings.fanclubIconUser35; var User36 = cb.settings.fanclubIconUser36; var User37 = cb.settings.fanclubIconUser37; var User38 = cb.settings.fanclubIconUser38; var User39 = cb.settings.fanclubIconUser39; var User40 = cb.settings.fanclubIconUser40; var User41 = cb.settings.fanclubIconUser41; var User42 = cb.settings.fanclubIconUser42; var User43 = cb.settings.fanclubIconUser43; var User44 = cb.settings.fanclubIconUser44; var User45 = cb.settings.fanclubIconUser45; var User46 = cb.settings.fanclubIconUser46; var User47 = cb.settings.fanclubIconUser47; var User48 = cb.settings.fanclubIconUser48; var User49 = cb.settings.fanclubIconUser49; var User50 = cb.settings.fanclubIconUser50; var Icon1 = cb.settings.fanclubIcon1; var Icon2 = cb.settings.fanclubIcon2; var Icon3 = cb.settings.fanclubIcon3; var Icon4 = cb.settings.fanclubIcon4; var Icon5 = cb.settings.fanclubIcon5; var Icon6 = cb.settings.fanclubIcon6; var Icon7 = cb.settings.fanclubIcon7; var Icon8 = cb.settings.fanclubIcon8; var Icon9 = cb.settings.fanclubIcon9; var Icon10 = cb.settings.fanclubIcon10; var Icon11 = cb.settings.fanclubIcon11; var Icon12 = cb.settings.fanclubIcon12; var Icon13 = cb.settings.fanclubIcon13; var Icon14 = cb.settings.fanclubIcon14; var Icon15 = cb.settings.fanclubIcon15; var Icon16 = cb.settings.fanclubIcon16; var Icon17 = cb.settings.fanclubIcon17; var Icon18 = cb.settings.fanclubIcon18; var Icon19 = cb.settings.fanclubIcon19; var Icon20 = cb.settings.fanclubIcon20; var Icon21 = cb.settings.fanclubIcon21; var Icon22 = cb.settings.fanclubIcon22; var Icon23 = cb.settings.fanclubIcon23; var Icon24 = cb.settings.fanclubIcon24; var Icon25 = cb.settings.fanclubIcon25; var Icon26 = cb.settings.fanclubIcon26; var Icon27 = cb.settings.fanclubIcon27; var Icon28 = cb.settings.fanclubIcon28; var Icon29 = cb.settings.fanclubIcon29; var Icon30 = cb.settings.fanclubIcon30; var Icon31 = cb.settings.fanclubIcon31; var Icon32 = cb.settings.fanclubIcon32; var Icon33 = cb.settings.fanclubIcon33; var Icon34 = cb.settings.fanclubIcon34; var Icon35 = cb.settings.fanclubIcon35; var Icon36 = cb.settings.fanclubIcon36; var Icon37 = cb.settings.fanclubIcon37; var Icon38 = cb.settings.fanclubIcon38; var Icon39 = cb.settings.fanclubIcon39; var Icon40 = cb.settings.fanclubIcon40; var Icon41 = cb.settings.fanclubIcon41; var Icon42 = cb.settings.fanclubIcon42; var Icon43 = cb.settings.fanclubIcon43; var Icon44 = cb.settings.fanclubIcon44; var Icon45 = cb.settings.fanclubIcon45; var Icon46 = cb.settings.fanclubIcon46; var Icon47 = cb.settings.fanclubIcon47; var Icon48 = cb.settings.fanclubIcon48; var Icon49 = cb.settings.fanclubIcon49; var Icon50 = cb.settings.fanclubIcon50; // *** Arrays ***/ var fanListArray = []; var iconArray = {user: [], icon: []}; } { // *********************************** Functions ************************************** { function checkTextColor(color) { switch (color) { case "White/No color": return "#FFFFFF"; case "Black": return "#000000"; case "Dark Blue": return "#0629AC"; case "Dark Pink": return "#FF6680"; case "Dark Green": return "#006600"; case "Dark Red": return "#cc0000"; case "Dark Purple": return "#3d003d"; case "Dark Grey": return "#737373"; case "Dark Orange": return "#e77400"; case "Dark Aqua": return "#006767"; case "Dark Gold": return "#998100"; case "Dark Teal": return "#003f1f"; case "Dark Brown": return "#582c00"; case "Dark Bronze": return "#a56728"; case "Dark Periwinkle": return "#155bd7"; case "Dark Fuschia": return "#d6155c"; case "Dark Lime": return "#6b790c"; case "Dark Plum": return "#7f13bf"; default: if (/^#[0-9A-F]{6}$/i.test(color)) { return color; } else if (/^[0-9A-F]{6}$/i.test(color)) { return ('#' + color); } else { return ("default"); } } } function checkBgColor(color) { switch (color) { case "White/No color": return "#FFFFFF"; case "Light Aqua": return "#adeaea"; case "Light Pink": return "#FFE6EA"; case "Light Green": return "#94e594"; case "Light Red": return "#ff9a9a"; case "Light Purple": return "#f2cdff"; case "Light Orange": return "#ffd9b3"; case "Light Grey": return "#e6e6e6"; case "Light Blue": return "#d1eaee"; case "Light Yellow": return "#ffff94" case "Cream": return "#f9f6ed" case "Light Bronze": return "#ebccad"; case "Light Periwinkle": return "#d7e4fb"; case "Light Teal": return "#d7fbee"; case "Light Fuschia": return "#fbd7e4"; case "Light Lime": return "#ecf6a7"; case "Light Plum": return "#e3c0f9"; default: if (/^#[0-9A-F]{6}$/i.test(color)) { return color; } else if (/^[0-9A-F]{6}$/i.test(color)) { return ('#' + color); } else { return ("default"); } } } function addRmvFan(user, chgby, mode) { if (mode == 'a') { if (cbjs.arrayContains(fanListArray,user)) { cb.sendNotice(user + ' is already on the Mothership Fan Club list.', chgby, green); } else { fanListArray.push(user); cb.sendNotice('You have added ' + user + ' to the Mothership Fan Club list. Note this is only applied during this session, permanent Mothership Fan Club list changes must be made to the list defined when starting the bot. This list should also be saved to a separate document.', chgby, green); cb.sendNotice('Congratulations! You have been added to the Mothership Fan Club list!', user, msBgColor, msTextColor, 'bold'); } } else if (mode == 'r') { if (cbjs.arrayContains(fanListArray,user)) { cbjs.arrayRemove(fanListArray,user); cb.sendNotice('You have removed ' + user + ' from the Mothership Fan Club list. Note this is only applied during this session, permanent Fan Club list changes must be made to the list defined when starting the bot. This list should also be saved to a separate document.', chgby, green); } else { cb.sendNotice(user + ' is not on the Mothership Fan Club list.', chgby, green); } } } function addByTipping(user) { if (!cbjs.arrayContains(fanListArray,user)) { fanListArray.push(user); cb.sendNotice(user + ' has joined Mothership Fan Club!', '', msBgColor, msTextColor, 'bold'); cb.sendNotice(user + ' has been added to the Fan Club List. Note this is only applied during this session - permanent Mothership Fan Club list changes must be made to the list defined when starting the bot. This list should also be saved to a separate document.', cb.room_slug, green); } } function updateDefaultIcon(newicon, chgby) { defaultIcon = newicon; cb.sendNotice('You have updated the default Mothership Fan Club icon to "' + newicon + '". Note this change is only applied during this session, permanent changes must be made to the settings on the bot launch page when next started/restarted.', chgby, green); } function updateUserIcon(user, newicon, chgby) { if (cbjs.arrayContains(fanListArray,user)) { if (cbjs.arrayContains(iconArray.user,user)) { userindex = iconArray.user.indexOf(user); iconArray.icon[userindex] = newicon; cb.sendNotice('You have updated the icon for Mothership Fan Club member ' + user + ' to "' + newicon + '". Note this change is only applied during this session, permanent changes must be made to the settings on the bot launch page when next started/restarted.', chgby, green); } else { iconArray.user.push(user); iconArray.icon.push(newicon); cb.sendNotice('You have added the icon for Mothership Fan Club member ' + user + ' as "' + newicon + '". Note this change is only applied during this session, permanent changes must be made to the settings on the bot launch page when next started/restarted.', chgby, green); } } else { cb.sendNotice('User name "' + user + '" is not in the fanclub list.', chgby, green); } } function helpBC(from) { cb.sendNotice('Mothership Fan Club Help Menu' + '\n/msaddfan [user]: Add [user] to the fanclub list.' + '\n/msrmvfan [user]: Remove [user] from the fanclub list.' + '\n/msfanlist: display the list of people on the fanclub list.' + '\n/mschgdft [icon]: Update the default Fan Club icon to the new value of [icon].' + '\n/mschguser [user] [icon]: Update the Fan Club icon for [user] to the new value of [icon].' ,from); } } } // ******************************* Upon user entry of a Message ************************************** { cb.onMessage(function (msg) { if (cb.room_slug == 'perfectbrownpussy') { var message = msg['m'].split(' '); var m = msg.m; var u = msg.user; var isFanClub = cbjs.arrayContains(fanListArray,u); var isBC = (u === cb.room_slug); var BC = cb.room_slug; var command = message[0] if(message[0].charAt(0) == '/') { msg['X-Spam'] = true; switch(command) { case '/msaddfan': { if (isBC) { if (message[1]) { addRmvFan(message[1], u, 'a'); } else { cb.sendNotice('You didn\'t specify the user you want to add to the Mothership Fan Club.', u, green); } } else { cb.sendNotice('Only broadcasters are able to use that command.', u, green); } break; } case '/msrmvfan': { if (isBC) { if (message[1]) { addRmvFan(message[1], u, 'r'); } else { cb.sendNotice('You didn\'t specify the user you want to remove from the Mothership Fan Club.', u, green); } } else { cb.sendNotice('Only broadcasters are able to use that command.', u, green); } break; } case '/msfanlist': { if (isBC) { cb.sendNotice('Users currently in the Mothership Fan Club: (' + fanListArray.length + ' members)\n' + (fanListArray.length > 0 == true ? cbjs.arrayJoin(fanListArray, ',') : 'No users.'), u); } else { cb.sendNotice('Only moderators and broadcasters are able to use that command.\nType "/fbhelp commands" to see a full list of the available commands.', u, green); } break; } case '/mschgdft': { if (isBC) { if (message[1]) { updateDefaultIcon(message[1], u); } else { cb.sendNotice('You didn\'t specify the new default icon/gif for the Mothership Fan Club. You can either use a gif (such as ":hearts") or a unicode character (such as "\u2661").', u, green); } } else { cb.sendNotice('Only broadcasters are able to use that command.', u, green); } break; } case '/mschguser': { if (isBC) { if (message[1]) { if (message[2]) { updateUserIcon(message[1], message[2], u); } else { cb.sendNotice('The second parameter for this command is the new icon value and no value was given. Please use the syntax of "/mschguser [username] [newicon]". For the new icon, you can either use a gif (such as ":hearts") or a unicode character (such as "\u2661").', u, green); } } else { cb.sendNotice('The first parameter for this command is the user name and no user name was given. Please use the syntax of "/mschguser [username] [newicon]".', u, green); } } else { cb.sendNotice('Only broadcasters are able to use that command.', u, green); } break; } case '/mshelp': { if (isBC) { helpBC(u); } else { cb.sendNotice('Only broadcasters are able to use that command.', u, green); } break; } } } // ********** Add colors and icon for fans or users if (isFanClub) { if (msBgColor) { msg['background'] = msBgColor; } if (msTextColor) { msg['c'] = msTextColor; } if (message[0].charAt(0) != "/" && message[0].charAt(0) != "!") { if (cbjs.arrayContains(iconArray.user,u)) { userindex = iconArray.user.indexOf(u); pfxicon = iconArray.icon[userindex]; } else if (defaultIcon) { pfxicon = defaultIcon; } else { pfxicon = ''; } if (pfxicon != '') { msg.m = pfxicon + ' ' + msg.m; } } } return msg; } }); } // *********************************** Actions on user entering ************************************** { cb.onEnter(function(user) { }); } // *********************************** Actions upon leaving ************************************** { cb.onLeave(function(user) { }); } // *********************************** Actions upon tipping ************************************** { cb.onTip(function (tip) { if (cb.room_slug == 'perfectbrownpussy') { var tipAmount = Number.parseInt(tip.amount, 10); var u = tip.from_user // ***** Check for Fan Club Join if (cb.settings.tipToJoin == 'Yes' && tipAmount >= cb.settings.tipAmountToJoin) { addByTipping(u,tipAmount); } } }); } // *********************************** Initialize ************************************** { if(initialize == 0) { if (cb.room_slug == 'perfectbrownpussy') { if (cb.settings.textColor == 'Custom') { msTextColor = checkTextColor(cb.settings.textCustomColor); if (msTextColor == 'default') { cb.sendNotice('Error while setting the Mothership Fan Club text color. It has to be in a HEX format. Using default value.', cb.room_slug, green, '', 'bold'); msTextColor = '#000000'; } } else { msTextColor = checkTextColor(cb.settings.textColor); } if (cb.settings.highlightColor == 'Custom') { msBgColor = checkBgColor(cb.settings.highlightCustomColor); if (msBgColor == 'default') { cb.sendNotice('Error while setting the Mothership Fan Club highlight color. It has to be in a HEX format. Using default value.', cb.room_slug, green, '', 'bold'); msBgColor = '#ffffff'; } } else { msBgColor = checkBgColor(cb.settings.highlightColor); } // *** Load Array for Fan Club List if(cb.settings.fanclubList) { var n = cb.settings.fanclubList; fanListArray = n.split(','); } // *** Load Array for User Icons for (let i = 1; i <= 50; i++) { iconuser = this["User"+i]; icon = this["Icon"+i]; if(iconuser && icon) { iconArray.user.push(iconuser); iconArray.icon.push(icon); } } initialize = 1; } } }
© Copyright Chaturbate 2011- 2024. All Rights Reserved.