Bots Home
|
Create an App
JC Test
Author:
johnclark846
Description
Source Code
Launch Bot
Current Users
Created by:
Johnclark846
/* Name: Custom Crew Bot Author: drzimp Version: 1.6 (2015-10-10) This bot gives the broadcaster the most flexibility for having a custom crew, fan "groups", or even acknowleding specific users! The Friends List - Can set a unique "title" that each list member would get in chat - Can set a specific text color for these members in chat - Can be configured at bot launch, and can also be modified by the chatmods by bot commands - Useful to chatmods for acknowleding good chatters The "Royal" Friends List - Can set a unique "title" that each list member would get in chat - Can set a specific text color for these members in chat - Only the Model can modify this list, at bot launch or through bot commands - Example usage: Fan club members, other broadcasters, etc Ghost Users - List of banned/silenced users that you actually want to hear from, but without clearing your ban list - Messages from Ghost Users are converted to chat notices - Can change the text color of notices from Ghost Users Custom Crew Members - Currently allows for up to 20 different users (or user groups) - For each one, can set a unique "title" - For each one, can set a unique text color for chat - Can specify either a single CB user's username, or a list of usernames to create whole new groups - Example usage: If 1 CB username per crew member, could easily be the Model's "Pirate Crew", "Ninja Crew" or similar - Example usage: If using multiple names, the model could ask for tips in specific amounts to be a part of "this" group, or a part of "that" group Version 1: Originally modelled after tablesalt's MyCrewBot, juliered asked if I could make some mods. This lead into a rewrite so I could accommodate the requested changes. Version 1.4: - Added friendsTitle (for the Friends List) - Added the "Royal List". Similar to "Friends", but only the model can set them. Ver 1.5: - Added seperate text colors for Royal Friends and regular Friends - Modified Crew user names to allow for a space delimited list, which in turn creates custom "user groups" - Added /colortest Ver 1.6: - Added parameter checking to the various bot commands - Fixed a bug with the /add and /rem commands and cbjs.arrayContains being case sensitive - Added the bot help - Added /royaltitle and /friendtitle */ cb.settings_choices = [ { name: 'allowModCommands', type: 'choice', label: 'Allow Moderators to issue commands? (If yes, chatmods can add/remove friends and ghosts) ', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes' }, { name: 'crewName', label: 'Name of your Crew?', type: 'str', minLength: 0, maxLength: 50, required: true, defaultValue: 'My Awesome Crew' }, { name: 'royalList', label: "List of the Royal friends, separated by space (CB usernames exactly)", type: 'str', minLength: 0, maxLength: 10240, required: false, defaultValue: '' }, { name: 'royalTitle', label: "Title for Royal Friends List members", type: 'str', minLength: 0, maxLength: 50, required: false, defaultValue:'[ :crown01 Royal]' }, { name: 'useRoyalColor', type: 'choice', label: 'Change text color for Royal Friends?', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes' }, { name: 'royalColor', label: 'Text color to use for Royal Friends', type: 'choice', choice1: 'Purple 8B008B', choice2: 'Green 078102', choice3: 'Orange FF4500', choice4: 'Blue 0000CD', choice5: 'Red FF0000', defaultValue: 'Purple 8B008B' }, { name: 'friendList', label: 'List of friends, separated by space (CB usernames exactly)', type: 'str', minLength: 0, maxLength: 10240, required: false, defaultValue: '' }, { name: 'friendTitle', label: "Title for Friends List members", type: 'str', minLength: 0, maxLength: 50, required: false, defaultValue:'[Awesomesaucers]' }, { name: 'useFriendColor', type: 'choice', label: 'Change text color for friends?', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes' }, { name: 'friendColor', label: 'Color to use for friends', type: 'choice', choice1: 'Green 078102', choice2: 'Purple 8B008B', choice3: 'Orange FF4500', choice4: 'Blue 0000CD', choice5: 'Red FF0000', defaultValue: 'Green 078102' }, { name: 'ghostList', label: 'List of banned people you want to speak as ghosts, separated by space.', type: 'str', minLength: 0, maxLength: 10240, required: false, defaultValue: '' }, { name: 'useGhostColor', type: 'choice', label: 'Change highlight color for ghosts?', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes' }, { name: 'ghostColor', label: 'Highlight color to use for Ghosts', type: 'choice', choice1: 'Grey C0C0C0', choice2: 'IcyBlue 40E0D0', choice3: 'Yellow FFD700', defaultValue: 'Grey C0C0C0' }, { name: 'useCrewColor', type: 'choice', label: 'Change text color for crew members?', choice1: 'Change text color', choice2: 'Change text background color', choice3: 'Change neither', defaultValue: 'Change text color' }, { name: 'crewUserName1', label: 'Crew User 1: Username', type: 'str', minLength: 0, maxLength: 50, required: false, defaultValue:'' }, { name: 'crewUserTitle1', label: 'Crew User 1: Title', type: 'str', minLength: 0, maxLength: 50, required: false, defaultValue:'' }, { name: 'crewUserColor1', label: 'Crew User 1: Text Color', type: 'str', minLength: 0, maxLength: 6, required: false, defaultValue:'' }, { name: 'crewUserName2', label: 'Crew User 2: Username', type: 'str', minLength: 0, maxLength: 50, required: false, defaultValue:'' }, { name: 'crewUserTitle2', label: 'Crew User 2: Title', type: 'str', minLength: 0, maxLength: 50, required: false, defaultValue:'' }, { name: 'crewUserColor2', label: 'Crew User 2: Text Color', type: 'str', minLength: 0, maxLength: 6, required: false, defaultValue:'' }, { name: 'crewUserName3', label: 'Crew User 3: Username', type: 'str', minLength: 0, maxLength: 50, required: false, defaultValue:'' }, { name: 'crewUserTitle3', label: 'Crew User 3: Title', type: 'str', minLength: 0, maxLength: 50, required: false, defaultValue:'' }, { name: 'crewUserColor3', label: 'Crew User 3: Text Color', type: 'str', minLength: 0, maxLength: 6, required: false, defaultValue:'' }, { name: 'crewUserName4', label: 'Crew User 4: Username', type: 'str', minLength: 0, maxLength: 50, required: false, defaultValue:'' }, { name: 'crewUserTitle4', label: 'Crew User 4: Title', type: 'str', minLength: 0, maxLength: 50, required: false, defaultValue:'' }, { name: 'crewUserColor4', label: 'Crew User 4: Text Color', type: 'str', minLength: 0, maxLength: 6, required: false, defaultValue:'' }, { name: 'crewUserName5', label: 'Crew User 5: Username', type: 'str', minLength: 0, maxLength: 50, required: false, defaultValue:'' }, { name: 'crewUserTitle5', label: 'Crew User 5: Title', type: 'str', minLength: 0, maxLength: 50, required: false, defaultValue:'' }, { name: 'crewUserColor5', label: 'Crew User 5: Text Color', type: 'str', minLength: 0, maxLength: 6, required: false, defaultValue:'' }, { name: 'crewUserName6', label: 'Crew User 6: Username', type: 'str', minLength: 0, maxLength: 50, required: false, defaultValue:'' }, { name: 'crewUserTitle6', label: 'Crew User 6: Title', type: 'str', minLength: 0, maxLength: 50, required: false, defaultValue:'' }, { name: 'crewUserColor6', label: 'Crew User 6: Text Color', type: 'str', minLength: 0, maxLength: 6, required: false, defaultValue:'' }, { name: 'crewUserName7', label: 'Crew User 7: Username', type: 'str', minLength: 0, maxLength: 50, required: false, defaultValue:'' }, { name: 'crewUserTitle7', label: 'Crew User 7: Title', type: 'str', minLength: 0, maxLength: 50, required: false, defaultValue:'' }, { name: 'crewUserColor7', label: 'Crew User 7: Text Color', type: 'str', minLength: 0, maxLength: 6, required: false, defaultValue:'' }, { name: 'crewUserName8', label: 'Crew User 8: Username', type: 'str', minLength: 0, maxLength: 50, required: false, defaultValue:'' }, { name: 'crewUserTitle8', label: 'Crew User 8: Title', type: 'str', minLength: 0, maxLength: 50, required: false, defaultValue:'' }, { name: 'crewUserColor8', label: 'Crew User 8: Text Color', type: 'str', minLength: 0, maxLength: 6, required: false, defaultValue:'' }, { name: 'crewUserName9', label: 'Crew User 9: Username', type: 'str', minLength: 0, maxLength: 50, required: false, defaultValue:'' }, { name: 'crewUserTitle9', label: 'Crew User 9: Title', type: 'str', minLength: 0, maxLength: 50, required: false, defaultValue:'' }, { name: 'crewUserColor9', label: 'Crew User 9: Text Color', type: 'str', minLength: 0, maxLength: 6, required: false, defaultValue:'' }, { name: 'crewUserName10', label: 'Crew User 10: Username', type: 'str', minLength: 0, maxLength: 50, required: false, defaultValue:'' }, { name: 'crewUserTitle10', label: 'Crew User 10: Title', type: 'str', minLength: 0, maxLength: 50, required: false, defaultValue:'' }, { name: 'crewUserColor10', label: 'Crew User 10: Text Color', type: 'str', minLength: 0, maxLength: 6, required: false, defaultValue:'' }, { name: 'crewUserName11', label: 'Crew User 11: Username', type: 'str', minLength: 0, maxLength: 50, required: false, defaultValue:'' }, { name: 'crewUserTitle11', label: 'Crew User 11: Title', type: 'str', minLength: 0, maxLength: 50, required: false, defaultValue:'' }, { name: 'crewUserColor11', label: 'Crew User 11: Text Color', type: 'str', minLength: 0, maxLength: 6, required: false, defaultValue:'' }, { name: 'crewUserName12', label: 'Crew User 12: Username', type: 'str', minLength: 0, maxLength: 50, required: false, defaultValue:'' }, { name: 'crewUserTitle12', label: 'Crew User 12: Title', type: 'str', minLength: 0, maxLength: 50, required: false, defaultValue:'' }, { name: 'crewUserColor12', label: 'Crew User 12: Text Color', type: 'str', minLength: 0, maxLength: 6, required: false, defaultValue:'' }, { name: 'crewUserName13', label: 'Crew User 13: Username', type: 'str', minLength: 0, maxLength: 50, required: false, defaultValue:'' }, { name: 'crewUserTitle13', label: 'Crew User 13: Title', type: 'str', minLength: 0, maxLength: 50, required: false, defaultValue:'' }, { name: 'crewUserColor13', label: 'Crew User 13: Text Color', type: 'str', minLength: 0, maxLength: 6, required: false, defaultValue:'' }, { name: 'crewUserName14', label: 'Crew User 14: Username', type: 'str', minLength: 0, maxLength: 50, required: false, defaultValue:'' }, { name: 'crewUserTitle14', label: 'Crew User 14: Title', type: 'str', minLength: 0, maxLength: 50, required: false, defaultValue:'' }, { name: 'crewUserColor14', label: 'Crew User 14: Text Color', type: 'str', minLength: 0, maxLength: 6, required: false, defaultValue:'' }, { name: 'crewUserName15', label: 'Crew User 15: Username', type: 'str', minLength: 0, maxLength: 50, required: false, defaultValue:'' }, { name: 'crewUserTitle15', label: 'Crew User 15: Title', type: 'str', minLength: 0, maxLength: 50, required: false, defaultValue:'' }, { name: 'crewUserColor15', label: 'Crew User 15: Text Color', type: 'str', minLength: 0, maxLength: 6, required: false, defaultValue:'' }, { name: 'crewUserName16', label: 'Crew User 16: Username', type: 'str', minLength: 0, maxLength: 50, required: false, defaultValue:'' }, { name: 'crewUserTitle16', label: 'Crew User 16: Title', type: 'str', minLength: 0, maxLength: 50, required: false, defaultValue:'' }, { name: 'crewUserColor16', label: 'Crew User 16: Text Color', type: 'str', minLength: 0, maxLength: 6, required: false, defaultValue:'' }, { name: 'crewUserName17', label: 'Crew User 17: Username', type: 'str', minLength: 0, maxLength: 50, required: false, defaultValue:'' }, { name: 'crewUserTitle17', label: 'Crew User 17: Title', type: 'str', minLength: 0, maxLength: 50, required: false, defaultValue:'' }, { name: 'crewUserColor17', label: 'Crew User 17: Text Color', type: 'str', minLength: 0, maxLength: 6, required: false, defaultValue:'' }, { name: 'crewUserName18', label: 'Crew User 18: Username', type: 'str', minLength: 0, maxLength: 50, required: false, defaultValue:'' }, { name: 'crewUserTitle18', label: 'Crew User 18: Title', type: 'str', minLength: 0, maxLength: 50, required: false, defaultValue:'' }, { name: 'crewUserColor18', label: 'Crew User 18: Text Color', type: 'str', minLength: 0, maxLength: 6, required: false, defaultValue:'' }, { name: 'crewUserName19', label: 'Crew User 19: Username', type: 'str', minLength: 0, maxLength: 50, required: false, defaultValue:'' }, { name: 'crewUserTitle19', label: 'Crew User 19: Title', type: 'str', minLength: 0, maxLength: 50, required: false, defaultValue:'' }, { name: 'crewUserColor19', label: 'Crew User 19: Text Color', type: 'str', minLength: 0, maxLength: 6, required: false, defaultValue:'' }, { name: 'crewUserName20', label: 'Crew User 20: Username', type: 'str', minLength: 0, maxLength: 50, required: false, defaultValue:'' }, { name: 'crewUserTitle20', label: 'Crew User 20: Title', type: 'str', minLength: 0, maxLength: 50, required: false, defaultValue:'' }, { name: 'crewUserColor20', label: 'Crew User 20: Text Color', type: 'str', minLength: 0, maxLength: 6, required: false, defaultValue:'' }, ]; var drz_cc_ver = '1.6'; var orangered = '#FF4500'; var crewBot = { /* Only used internally. Should match the max number of possibly configured crew members */ possibleCrewMembers: 20, /* Allow mods to use the bot commands? */ allowModCommands: true, /* Name of your crew, as it appears in chat */ crewName: 'My Awesome Crew', /* 'Change text color', 'Change text background color', or 'Neither' */ useCrewColor: 'Change text color', /* If true, changes Royal Friends text color */ useRoyalColor: true, /* Default value is purple */ royalColor: '8B008B', royalTitle: '', /* If true, changes Friends text color */ useFriendColor: true, /* Default value is green */ friendColor: '078102', friendTitle: '', /* If true, changes highlight color for Ghosts */ useGhostColor: true, /* Default value is grey*/ ghostColor: 'C0C0C0', crewMembers: new Array, royalMembers: new Array, friendMembers: new Array, ghostMembers: new Array, crewMemberNames: new Array, /* * Crew Member Functions */ isCrewMember: function(name) { //find the index of the user var cmId = -1; for (var i = 0; i < this.crewMembers.length; i++) { if (this.crewMembers[i].name == name) { cmId = i; break; } } return cmId; }, addCrewMember: function(uName, uTitle, uColor) { var alreadyAdded = cbjs.arrayContains(this.crewMemberNames, uName); if ( ! alreadyAdded ) { this.crewMembers.push({ name: uName, title: uTitle, color: uColor }); this.crewMemberNames.push(uName); } }, addCrew: function(msg) { }, showCrewMembers: function(to_user) { cb.sendNotice('Let me fetch that list for ya, '+to_user, to_user, '', orangered); var maxDivLen = 50; var crewNames = this.crewMemberNames.join(', '); var divStr = this.makeDiv('_', crewNames.length, maxDivLen); var msgStr = divStr +'\n' + this.crewName + ' Members\n' + crewNames + '\n' + divStr; cb.sendNotice(msgStr, to_user); }, /* * Royal Friend Member Functions */ showRoyalFriendMembers: function(to_user) { cb.sendNotice('Let me fetch that list for ya, '+to_user, to_user, '', orangered); var maxDivLen = 50; var royalFriendNames = this.royalMembers.join(', '); var divStr = this.makeDiv('_', royalFriendNames.length, maxDivLen); var msgStr = divStr +'\n' + this.crewName + ' Royal Friends\n' + 'Royal Friends Title: ' + this.royalTitle + '\n' + royalFriendNames + '\n' + divStr; cb.sendNotice(msgStr, to_user); }, addRoyal: function(frname, modname) { var tempstr = frname.toLowerCase(); if ( cbjs.arrayContains(this.royalMembers, tempstr) ) { cb.sendNotice(frname + ' is already in the Royal Friend list.', modname, '', orangered); } else { this.royalMembers.push(tempstr); cb.settings.royalList = this.royalMembers.join(' '); cb.sendNotice(frname + ' has been added to the Royal Friend list.', modname, '', orangered); } }, remRoyal: function(frname, modname) { var tempstr = frname.toLowerCase(); if ( cbjs.arrayContains(this.royalMembers, tempstr) ) { cbjs.arrayRemove(this.royalMembers, tempstr); cb.settings.royalList = this.royalMembers.join(' '); cb.sendNotice(frname + ' has been removed from the Royal Friend list.', modname, '', orangered); } else { cb.sendNotice(frname + ' is not in the Royal Friend list.', modname, '', orangered); } }, isRoyal: function(name) { var tempstr = name.toLowerCase(); var retval = cbjs.arrayContains(this.royalMembers, tempstr); return retval; }, changeRoyalTitle: function( titleStr, modname) { this.royalTitle = titleStr; cb.settings.royalTitle = titleStr; this.notifyMods(modname + ' has changed the title for Royal Friends List members to: ' + titleStr); }, /* * Friend Member Functions */ showFriendMembers: function(to_user) { cb.sendNotice('Let me fetch that list for ya, '+to_user, to_user, '', orangered); var maxDivLen = 50; var friendNames = this.friendMembers.join(', '); var divStr = this.makeDiv('_', friendNames.length, maxDivLen); var msgStr = divStr +'\n' + this.crewName + ' Friends\n' + 'Friends Title: ' + this.friendTitle + '\n' + friendNames + '\n' + divStr; cb.sendNotice(msgStr, to_user); }, addFriend: function(frname, modname) { var tempstr = frname.toLowerCase(); if ( cbjs.arrayContains(this.friendMembers, tempstr) ) { cb.sendNotice(frname + ' is already in the friend list.', modname, '', orangered); } else { this.friendMembers.push(tempstr); cb.settings.friendList = this.friendMembers.join(' '); this.notifyMods(modname + ' has added ' + frname + ' to the friend list.'); } }, remFriend: function(frname, modname) { var tempstr = frname.toLowerCase(); if ( cbjs.arrayContains(this.friendMembers, tempstr) ) { cbjs.arrayRemove(this.friendMembers, tempstr); cb.settings.friendList = this.friendMembers.join(' '); this.notifyMods(modname + ' has removed ' + frname + ' from the friend list.'); } else { cb.sendNotice(frname + ' is not in the friend list.', modname, '', orangered); } }, isFriend: function(name) { var tempstr = name.toLowerCase(); var retval = cbjs.arrayContains(this.friendMembers, tempstr); return retval; }, changeFriendTitle: function( titleStr, modname) { this.friendTitle = titleStr; cb.settings.friendTitle = titleStr; this.notifyMods(modname + ' has changed the title for Friends List members to: ' + titleStr); }, /* * Ghost Member Functions */ showGhostMembers: function(to_user) { cb.sendNotice('Let me fetch that list for ya, '+to_user, to_user, '', orangered); var maxDivLen = 50; var ghostNames = this.ghostMembers.join(', '); var divStr = this.makeDiv('_', ghostNames.length, maxDivLen); var msgStr = divStr +'\n' + this.crewName + ' Ghosts\n' + ghostNames + '\n' + divStr; cb.sendNotice(msgStr, to_user); }, addGhost: function(ghname, modname) { var tempstr = ghname.toLowerCase(); if ( cbjs.arrayContains(this.ghostMembers, tempstr) ) { cb.sendNotice(ghname + ' is already in the ghost list.', modname, '', orangered); } else { this.ghostMembers.push(tempstr); cb.settings.ghostList = this.ghostMembers.join(' '); this.notifyMods(modname + ' has added ' + ghname + ' to the ghost list.'); } }, remGhost: function(ghname, modname) { var tempstr = ghname.toLowerCase(); if ( cbjs.arrayContains(this.ghostMembers, tempstr) ) { cbjs.arrayRemove(this.ghostMembers, tempstr); cb.settings.ghostList = this.ghostMembers.join(' '); this.notifyMods(modname + ' has removed ' + ghname + ' from the ghost list.'); } else { cb.sendNotice(ghname + ' is not in the ghost list.', modname, '', orangered); } }, isGhost: function(name) { var tempstr = name.toLowerCase(); var retval = cbjs.arrayContains(this.ghostMembers, tempstr); return retval; }, /* * Util functions */ notifyMods: function(msg) { /* msg, to_user, background, foreground, fontweight, to_group */ cb.sendNotice(msg, '', '', orangered, 'bold', 'red'); }, noModCommand: function(name, modelName) { var msgStr = 'Sorry ' + name + ', ' + modelName + ' has mod commands disabled!'; cb.sendNotice(msgStr, name, '', orangered); }, makeDiv: function(divChr, strLen, maxDivLen) { var divLen = 0; var divStr = ""; if (strLen > maxDivLen) { divLen = maxDivLen; } else { divLen = strLen; } while (divStr.length < divLen) { divStr = divChr + divStr; } return divStr; }, checkParams: function( mArr, idx ) { if ( mArr.length < idx ) { return false; } var retval = mArr[idx] || ''; if ( retval.length == 0 ) { return false; } return true; }, commandError: function( name, msg ) { cb.sendNotice( 'Command error: ' + msg, name, '', orangered); }, /* * Bot Help */ helpStart: function( from, command ) { var bgColor = orangered; var fgColor = '#FFFFFF'; cb.sendNotice( command + ' Help', from, bgColor, fgColor, 'bold'); }, helpEnd: function( from ) { var bgColor = orangered; var fgColor = '#FFFFFF'; cb.sendNotice('', from, bgColor, fgColor, 'bold'); }, botHelp: function( from, option ) { if(option == null){option = '';} switch (option) { case '': this.helpStart(from, 'Custom Crew Bot ' + drz_cc_ver); cb.sendNotice( 'Type /crewhelp x, where x is one of the following choices, for more detailed information.' + '\nEx: /crewhelp addfriend' ,from); cb.sendNotice('',from,orangered); cb.sendNotice( '/crewlist' + '\n/royallist' + '\n/addroyal' + '\n/remroyal' + '\n/royaltitle' + '\n/friendlist' + '\n/addfriend' + '\n/remfriend' + '\n/friendtitle' + '\n/ghostlist' + '\n/addghost' + '\n/remghost' + '\n/colortest' + '\nabout' ,from ); cb.sendNotice('',from,orangered); break; case 'about': cb.sendNotice('About Custom Crew Bot ' + drz_cc_ver + ' by drzimp', from, orangered, '#ffffff', 'bold'); cb.sendNotice( 'Custom Crew Bot was originally meant to be just a few mods to tablesalt90\'s MyCrewBot, however,' + '\nI ended up creating my own version to accomodate requests and suggestions (such as unique titles and colors for each crew member).' + '\nComments, suggestions, requests, and bug reports can be communicated by either tweeting @drzimp, ' + '\nor by posting comments on the bot\'s page at chaturbate.com/bots.' ,from); cb.sendNotice('', from, orangered, '#ffffff', 'bold'); break; case 'colortest': this.helpStart(from, '/colortest'); cb.sendNotice('Syntax: /colortest fgColor bgColor fontweight' + '\nWhere fgColor and bgColor are HTML color codes without the # symbol, and fontweight is either normal, bold, or bolder.' + '\nEx: /colortest FFFFFF FF4500 bolder' + '\nUseful for testing how the various colors would look.' ,from); this.helpEnd(from); break; case 'crewlist': this.helpStart(from, '/crewlist'); cb.sendNotice('Syntax: /crewlist' + '\nLists the members of your Crew.' ,from); this.helpEnd(from); break; case 'royallist': this.helpStart(from, '/royallist'); cb.sendNotice('Syntax: /royallist' + '\nLists the members of the Royal Friends List. The users that ' + cb.room_slug + ' wishes to acknowledge.' + '\nExample usage: Fan club members, other broadcasters, etc.' + '\nNote: This command can be ran by the broadcaster and chatmods, but the list can only be modified by ' + cb.room_slug ,from); this.helpEnd(from); break; case 'addroyal': this.helpStart(from, '/addroyal'); cb.sendNotice('Syntax: /addroyal username' + '\nWhere username is the name of the user you want to add to the Royal Friends List.' + '\nNOTE: This command can only be ran by ' + cb.room_slug ,from); this.helpEnd(from); break; case 'remroyal': this.helpStart(from, '/remroyal'); cb.sendNotice('Syntax: /remroyal username' + '\nWhere username is the name of the user you want to remove from the Royal Friends List.' + '\nNOTE: This command can only be ran by ' + cb.room_slug ,from); this.helpEnd(from); break; case 'royaltitle': this.helpStart(from, '/royaltitle'); cb.sendNotice('Syntax: /royaltitle New Title' + '\nAllows you to change the title used by all members of the Royal Friends List.' + '\nNote: This command can only be ran by ' + cb.room_slug ,from); this.helpEnd(from); break; case 'friendlist': this.helpStart(from, '/friendlist'); cb.sendNotice('Syntax: /friendlist' + '\nLists the members of the Friends List.' + '\nUseful to chatmods for acknowledging good chatters, good tippers and similar.' ,from); this.helpEnd(from); break; case 'addfriend': this.helpStart(from, '/addfriend'); cb.sendNotice('Syntax: /addfriend username' + '\nWhere username is the name of the user you want to add to the Friends List.' ,from); this.helpEnd(from); break; case 'remfriend': this.helpStart(from, '/remfriend'); cb.sendNotice('Syntax: /remfriend username' + '\nWhere username is the name of the user you want to remove from the Friends List.' ,from); this.helpEnd(from); break; case 'friendtitle': this.helpStart(from, '/friendtitle'); cb.sendNotice('Syntax: /friendtitle New Title' + '\nAllows you to change the title used by all members of the Friends List.' ,from); this.helpEnd(from); break; case 'ghostlist': this.helpStart(from, '/ghostlist'); cb.sendNotice('Syntax: /ghostlist' + '\nLists the members of the Ghost Users List.' + '\nGhost Users are banned/silenced users that you actually want to hear from, but without clearing your ban list.' + '\nMessages from Ghost Users are converted to chat notices.' ,from); this.helpEnd(from); break; case 'addghost': this.helpStart(from, '/addghost'); cb.sendNotice('Syntax: /addghost username' + '\nWhere username is the name of the user you want to add to the Ghost Users List.' ,from); this.helpEnd(from); break; case 'remghost': this.helpStart(from, '/remghost'); cb.sendNotice('Syntax: /remghost username' + '\nWhere username is the name of the user you want to remove from the Ghost Users List.' ,from); this.helpEnd(from); break; } }, /* * Yay for init */ init: function() { cb.log("Custom Crew Bot "+drz_cc_ver+" by drzimp: Loading config"); this.allowModCommands = (cb.settings.allowModCommands == "Yes") ? true : false; this.useCrewColor = cb.settings.useCrewColor; if ( cb.settings.crewName ) { this.crewName = cb.settings.crewName; } this.useRoyalColor = (cb.settings.useRoyalColor == "Yes") ? true : false; if ( this.useRoyalColor ) { var temparr = cb.settings.royalColor.split(' '); this.royalColor = temparr[1]; } if ( cb.settings.royalList ) { var tempstr = cb.settings.royalList.toLowerCase(); cb.settings.royalList = tempstr; this.royalMembers = tempstr.split(' '); } if ( cb.settings.royalTitle ) { this.royalTitle = cb.settings.royalTitle; } this.useFriendColor = (cb.settings.useFriendColor == "Yes") ? true : false; if ( this.useFriendColor ) { var temparr = cb.settings.friendColor.split(' '); this.friendColor = temparr[1]; } if ( cb.settings.friendList ) { var tempstr = cb.settings.friendList.toLowerCase(); cb.settings.friendList = tempstr; this.friendMembers = tempstr.split(' '); } if ( cb.settings.friendTitle ) { this.friendTitle = cb.settings.friendTitle; } this.useGhostColor = (cb.settings.useGhostColor == "Yes") ? true : false; if ( this.useGhostColor ) { var temparr = cb.settings.ghostColor.split(' '); this.ghostColor = temparr[1]; } if ( cb.settings.ghostList ) { var tempstr = cb.settings.ghostList.toLowerCase(); cb.settings.ghostList = tempstr; this.ghostMembers = tempstr.split(' '); } this.addCrewMember('drzimp', '[Creator]', 'ff0000'); cb.log("Custom Crew Bot "+drz_cc_ver+" by drzimp: Loading custom crew members"); for (var i=1; i <= this.possibleCrewMembers; i++) { if ( cb.settings['crewUserName'+i] ) { var uName = cb.settings['crewUserName'+i]; var uTitle = 'Crew Member'; if ( cb.settings['crewUserTitle'+i] ) { uTitle = cb.settings['crewUserTitle'+i]; } var uColor = 'FF4500'; if ( cb.settings['crewUserColor'+i] ) { uColor = cb.settings['crewUserColor'+i]; } this.addCrewMember(uName, uTitle, uColor); } } cb.sendNotice("Custom Crew Bot "+drz_cc_ver+" by drzimp loaded."); }, /* * Hooks into CB */ onEnter: function(user) { var name = user['user']; var cmId = this.isCrewMember(name); if (cmId > -1) { var msgStr = this.crewName + ' Member ' + name + ' just entered the room!'; cb.sendNotice(msgStr, '', '#' + this.crewMembers[cmId].color); } }, onLeave: function(user) { var name = user['user']; var cmId = this.isCrewMember(name); if (cmId > -1) { var msgStr = name + ' of ' + this.crewName + ' just left the room!'; cb.sendNotice(msgStr, '', '#' + this.crewMembers[cmId].color); } }, onMessage: function(message) { var msgArray = message['m'].split(' '); //turn the message into an array var name = message['user']; var modelName = cb.room_slug; var isMod = message['is_mod']; var isFan = message['in_fanclub']; var isModel = (name == cb.room_slug); var hasTokens = message['has_tokens']; var hasTipped = message['tipped_recently']; var isGrey = !(hasTokens || isMod || isModel || isFan); var commandProcessed = false; var allowMods = this.allowModCommands; if ( isModel || isMod ) { if (msgArray[0].charAt(0) == '/') { switch (msgArray[0] ) { case '/colortest': message['X-Spam'] = true; var fg = '000000'; var bg = 'ffffff'; var fontweight = 'normal'; if ( msgArray.length > 3 ) { fontweight = msgArray[3]; } if ( msgArray.length > 2 ) { bg = msgArray[2]; } if ( msgArray.length > 1 ) { fg = msgArray[1]; } var tempstr = 'Color test - Foreground: ' + fg + ' .. Background: '+bg+' .. fontweight: '+fontweight; /* msg, to_user, background, foreground, fontweight, to_group */ cb.sendNotice(tempstr, name, '#'+bg, '#'+fg, fontweight); commandProcessed = true; break; case '/crewlist': message['X-Spam'] = true; if (isMod && !allowMods) { this.noModCommand(name, modelName); } else { this.showCrewMembers(name); } commandProcessed = true; break; case '/addcrew': if ( isModel ) { message['X-Spam'] = true; var newCrew = this.addCrew(msg); message['background'] = '#FF4500'; message['c'] = '#000000'; message['m'] = name + " just added " + newCrew + " to " + crewName +"!"; } else { cb.sendNotice('Nice try ' + name + '! Only ' + modelName + ' can add peeps to the crew!',name,'','#FF0000'); cb.sendNotice(name + ' tried adding someone to the crew list! (but was blocked)',modelName,'','#FF0000'); } commandProcessed = true; break; case '/royallist': message['X-Spam'] = true; if (isMod && !allowMods) { this.noModCommand(name, modelName); } else { this.showRoyalFriendMembers(name); } commandProcessed = true; break; case '/addroyal': message['X-Spam'] = true; if ( isModel ) { if ( this.checkParams( msgArray, 1 ) ) { this.addRoyal( msgArray[1], name ); } else { this.commandError(name, 'Missing name of person to add. Usage: /addroyal username'); } } else { cb.sendNotice('Nice try ' + name + '! Only ' + modelName + ' can add peeps to the Royal List!',name,'',orangered); cb.sendNotice(name + ' tried adding someone to the Royal Friends list! (but was blocked)',modelName,'',orangered); } commandProcessed = true; break; case '/remroyal': message['X-Spam'] = true; if ( isModel ) { if ( this.checkParams( msgArray, 1 ) ) { this.remRoyal( msgArray[1], name ); } else { this.commandError(name, 'Missing name of person to remove. Usage: /remroyal username'); } } else { cb.sendNotice('Nice try ' + name + '! Only ' + modelName + ' can remove peeps from the Royal List!',name,'',orangered); cb.sendNotice(name + ' tried removing someone from the Royal Friends list! (but was blocked)',modelName,'',orangered); } commandProcessed = true; break; case '/royaltitle': message['X-Spam'] = true; if ( isModel ) { if ( this.checkParams( msgArray, 1 ) ) { var tempstr = message['m'].substring(12).trim(); this.changeRoyalTitle( tempstr, name ); } else { this.commandError(name, 'Missing new title to use for Friends List members. Usage: /friendtitle the new title'); } } else { cb.sendNotice('Nice try ' + name + '! Only ' + modelName + ' can change the title for Royal Friends!',name,'',orangered); } commandProcessed = true; break; case '/friendlist': message['X-Spam'] = true; if (isMod && !allowMods) { this.noModCommand(name, modelName); } else { this.showFriendMembers(name); } commandProcessed = true; break; case '/addfriend': message['X-Spam'] = true; if (isMod && !allowMods) { this.noModCommand(name, modelName); } else { if ( this.checkParams( msgArray, 1 ) ) { this.addFriend( msgArray[1], name ); } else { this.commandError(name, 'Missing name of person to add. Usage: /addfriend username'); } } commandProcessed = true; break; case '/remfriend': message['X-Spam'] = true; if (isMod && !allowMods) { this.noModCommand(name, modelName); } else { if ( this.checkParams( msgArray, 1 ) ) { this.remFriend( msgArray[1], name ); } else { this.commandError(name, 'Missing name of person to remove. Usage: /remfriend username'); } } commandProcessed = true; break; case '/friendtitle': message['X-Spam'] = true; if (isMod && !allowMods) { this.noModCommand(name, modelName); } else { if ( this.checkParams( msgArray, 1 ) ) { var tempstr = message['m'].substring(12).trim(); this.changeFriendTitle( tempstr, name ); } else { this.commandError(name, 'Missing new title to use for Friends List members. Usage: /friendtitle the new title'); } } commandProcessed = true; break; case '/ghostlist': message['X-Spam'] = true; if (isMod && !allowMods) { this.noModCommand(name, modelName); } else { this.showGhostMembers(name); } commandProcessed = true; break; case '/addghost': message['X-Spam'] = true; if (isMod && !allowMods) { this.noModCommand(name, modelName); } else { if ( this.checkParams( msgArray, 1 ) ) { this.addGhost( msgArray[1], name ); } else { this.commandError(name, 'Missing name of person to add. Usage: /addghost username'); } } commandProcessed = true; break; case '/remghost': message['X-Spam'] = true; if (isMod && !allowMods) { this.noModCommand(name, modelName); } else { if ( this.checkParams( msgArray, 1 ) ) { this.remGhost( msgArray[1], name ); } else { this.commandError(name, 'Missing name of person to remove. Usage: /remghost username'); } } commandProcessed = true; break; case '/crewhelp': message['X-Spam'] = true; this.botHelp( name, msgArray[1] ); commandProcessed = true; break; } } } if (!commandProcessed) { // color background/foreground and tag if crew member var cmId = this.isCrewMember(name); if (cmId > -1) { if ( this.useCrewColor == 'Change text color' ) { message['c'] = '#' + this.crewMembers[cmId].color; } else if ( this.useCrewColor == 'Change text background color') { message['background'] = '#' + this.crewMembers[cmId].color; message['c'] = '#000000'; } message['m'] = this.crewMembers[cmId].title + " " + message['m']; } // color foreground if royal friend else if ( this.isRoyal(name) ) { if ( this.useRoyalColor ) { message['c'] = '#' + this.royalColor; } message['m'] = this.royalTitle + " " + message['m']; message['in_fanclub'] = true; } // color foreground if friend else if ( this.isFriend(name) ) { if ( this.useFriendColor ) { message['c'] = '#' + this.friendColor; } message['m'] = this.friendTitle + " " + message['m']; } // give voice to ghosts else if ( this.isGhost(name) ) { if ( this.useGhostColor ) { cb.sendNotice('Ghost user ' + name + " said: " + message['m'],'','','#' + this.ghostColor); } else { cb.sendNotice('Ghost user ' + name + " said: " + message['m']); } } } return message; } }; cb.onEnter(function(user) { crewBot.onEnter(user); }); cb.onLeave(function(user) { crewBot.onLeave(user); }); cb.onMessage(function(message) { return crewBot.onMessage(message); }); crewBot.init();
© Copyright Chaturbate 2011- 2024. All Rights Reserved.