Bots Home
|
Create an App
BaF Fan Club
Author:
melezouriou
Description
Source Code
Launch Bot
Current Users
Created by:
Melezouriou
/* Blueasfuck Fanclub Bot Customized by Melezouriou Based on the elegantly coded Custom Crew Bot by drzimp */ cb.settings_choices = [ { name: 'allowModCommands', type: 'choice', label: 'Allow Moderators to issue commands? (If yes, chatmods can add/remove support) ', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes' }, { name: 'crewName', label: 'Name of your Friend list?', type: 'str', minLength: 0, maxLength: 50, required: true, defaultValue: 'Friends' }, { name: 'friendList', label: "List of Friends members, separated by space (exact CB usernames)", 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:'' }, { name: 'useFriendColor', type: 'choice', label: 'Change text color for Friends members?', choice1: 'Yes', choice2: 'No', defaultValue: 'No' }, { name: 'friendColor', label: 'Text color to use for Friends members', type: 'choice', choice1: 'Purple 8B008B', choice2: 'Green 078102', choice3: 'Orange FF4500', choice4: 'Blue 0000CD', choice5: 'Red FF0000', defaultValue: 'Purple 8B008B' }, { name: 'supportList', label: 'List of support, separated by space (CB usernames exactly)', type: 'str', minLength: 0, maxLength: 10240, required: false, defaultValue: '' }, { name: 'supportTitle', label: "Title for Support List members", type: 'str', minLength: 0, maxLength: 50, required: false, defaultValue:'Support' }, { name: 'useSupportColor', type: 'choice', label: 'Change text color for support?', choice1: 'Yes', choice2: 'No', defaultValue: 'No' }, { name: 'supportColor', label: 'Color to use for support', type: 'choice', choice1: 'Green 078102', choice2: 'Purple 8B008B', choice3: 'Orange FF4500', choice4: 'Blue 0000CD', choice5: 'Red FF0000', defaultValue: 'Green 078102' }, { name: 'moderatorList', label: 'List of moderators, separated by space (CB usernames exactly)', type: 'str', minLength: 0, maxLength: 10240, required: false, defaultValue: '' }, { name: 'moderatorTitle', label: "Title for moderator List members", type: 'str', minLength: 0, maxLength: 50, required: false, defaultValue:'Moderators' }, { name: 'useModeratorColor', type: 'choice', label: 'Change text color for moderators?', choice1: 'Yes', choice2: 'No', defaultValue: 'No' }, { name: 'moderatorColor', label: 'Color to use for moderators', type: 'choice', choice1: 'Green 078102', choice2: 'Purple 8B008B', choice3: 'Orange FF4500', choice4: 'Blue 0000CD', choice5: 'Red FF0000', defaultValue: 'Red FF0000' }, { 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 neither' }, { name: 'crewUserName1', label: 'Crew User 1: Username', type: 'str', minLength: 0, maxLength: 10240, 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: 10240, 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: 10240, 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: 10240, 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: 10240, 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: 10240, 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: 10240, 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: 10240, 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: 10240, 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: 10240, 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: 10240, 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: 10240, 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: 10240, 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: 10240, 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: 10240, 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: 10240, 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: 10240, 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: 10240, 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: 10240, 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: 10240, 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:'' }, ]; //variables var drz_cc_ver = '1.6'; var orangered = '#FF4500'; var tipperArray = new Array; 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: 'Friends', /* 'Change text color', 'Change text background color', or 'Neither' */ useCrewColor: 'Change text color', /* If true, changes Friends text color */ useFriendColor: true, /* Default value is purple */ friendColor: '8B008B', friendTitle: '', /* If true, changes Support text color */ useSupportColor: true, /* Default value is green */ supportColor: '078102', supportTitle: '', crewMembers: new Array, friendMembers: new Array, supportMembers: new Array, moderatorMembers: 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); }, /* * Friend Member Functions */ showFriendFriendMembers: function(to_user) { cb.sendNotice('Let me fetch that list for ya, '+to_user, to_user, '', orangered); var maxDivLen = 50; var friendFriendNames = this.friendMembers.join(', '); var divStr = this.makeDiv('_', friendFriendNames.length, maxDivLen); var msgStr = divStr +'\n' + this.crewName + ' Friends\n' + 'Friends Title: ' + this.friendTitle + '\n' + friendFriendNames + '\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(' '); cb.sendNotice(frname + ' has been added to the Friend list.', modname, '', orangered); } }, 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(' '); cb.sendNotice(frname + ' has been removed from the Friend list.', modname, '', orangered); } 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); }, /* * Support Member Functions */ showSupportMembers: function(to_user) { cb.sendNotice('Let me fetch that list for ya, '+to_user, to_user, '', orangered); var maxDivLen = 50; var supportNames = this.supportMembers.join(', '); var divStr = this.makeDiv('_', supportNames.length, maxDivLen); var msgStr = divStr +'\n' + this.crewName + ' Support\n' + 'Support Title: ' + this.supportTitle + '\n' + supportNames + '\n' + divStr; cb.sendNotice(msgStr, to_user); }, addSupport: function(frname, modname) { var tempstr = frname.toLowerCase(); if ( cbjs.arrayContains(this.supportMembers, tempstr) ) { cb.sendNotice(frname + ' is already in the support list.', modname, '', orangered); } else { this.supportMembers.push(tempstr); cb.settings.supportList = this.supportMembers.join(' '); this.notifyMods(modname + ' has added ' + frname + ' to the support list.'); } }, remSupport: function(frname, modname) { var tempstr = frname.toLowerCase(); if ( cbjs.arrayContains(this.supportMembers, tempstr) ) { cbjs.arrayRemove(this.supportMembers, tempstr); cb.settings.supportList = this.supportMembers.join(' '); this.notifyMods(modname + ' has removed ' + frname + ' from the support list.'); } else { cb.sendNotice(frname + ' is not in the support list.', modname, '', orangered); } }, isSupport: function(name) { var tempstr = name.toLowerCase(); var retval = cbjs.arrayContains(this.supportMembers, tempstr); return retval; }, changeSupportTitle: function( titleStr, modname) { this.supportTitle = titleStr; cb.settings.supportTitle = titleStr; this.notifyMods(modname + ' has changed the title for Support List members to: ' + titleStr); }, /* * Moderator Member Functions */ showModeratorMembers: function(to_user) { cb.sendNotice('Let me fetch that list for ya, '+to_user, to_user, '', orangered); var maxDivLen = 50; var moderatorNames = this.moderatorMembers.join(', '); var divStr = this.makeDiv('_', moderatorNames.length, maxDivLen); var msgStr = divStr +'\n' + this.crewName + ' Moderator\n' + 'Moderator Title: ' + this.moderatorTitle + '\n' + moderatorNames + '\n' + divStr; cb.sendNotice(msgStr, to_user); }, addModerator: function(frname, modname) { var tempstr = frname.toLowerCase(); if ( cbjs.arrayContains(this.moderatorMembers, tempstr) ) { cb.sendNotice(frname + ' is already in the moderator list.', modname, '', orangered); } else { this.moderatorMembers.push(tempstr); cb.settings.moderatorList = this.moderatorMembers.join(' '); this.notifyMods(modname + ' has added ' + frname + ' to the moderator list.'); } }, remModerator: function(frname, modname) { var tempstr = frname.toLowerCase(); if ( cbjs.arrayContains(this.moderatorMembers, tempstr) ) { cbjs.arrayRemove(this.moderatorMembers, tempstr); cb.settings.moderatorList = this.moderatorMembers.join(' '); this.notifyMods(modname + ' has removed ' + frname + ' from the moderator list.'); } else { cb.sendNotice(frname + ' is not in the moderator list.', modname, '', orangered); } }, isModerator: function(name) { var tempstr = name.toLowerCase(); var retval = cbjs.arrayContains(this.moderatorMembers, tempstr); return retval; }, changeModeratorTitle: function( titleStr, modname) { this.moderatorTitle = titleStr; cb.settings.moderatorTitle = titleStr; this.notifyMods(modname + ' has changed the title for moderator List members to: ' + titleStr); }, /* * 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 addsupport' ,from); cb.sendNotice('',from,orangered); cb.sendNotice( '/crewlist' + '\n/friendlist' + '\n/addfriend' + '\n/remfriend' + '\n/friendtitle' + '\n/supportlist' + '\n/addsupport' + '\n/remsupport' + '\n/supporttitle' + '\n/moderatorlist' + '\n/addmoderator' + '\n/remmoderator' + '\n/moderatortitle' + '\n/colortest' + '\nabout' ,from ); cb.sendNotice('',from,orangered); 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 'friendlist': this.helpStart(from, '/friendlist'); cb.sendNotice('Syntax: /friendlist' + '\nLists the members of the 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 '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.' + '\nNOTE: This command can only be ran by ' + cb.room_slug ,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.' + '\nNOTE: This command can only be ran by ' + cb.room_slug ,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.' + '\nNote: This command can only be ran by ' + cb.room_slug ,from); this.helpEnd(from); break; case 'supportlist': this.helpStart(from, '/supportlist'); cb.sendNotice('Syntax: /supportlist' + '\nLists the members of the Support List.' + '\nUseful to chatmods for acknowledging good chatters, good tippers and similar.' ,from); this.helpEnd(from); break; case 'addsupport': this.helpStart(from, '/addsupport'); cb.sendNotice('Syntax: /addsupport username' + '\nWhere username is the name of the user you want to add to the Support List.' ,from); this.helpEnd(from); break; case 'remsupport': this.helpStart(from, '/remsupport'); cb.sendNotice('Syntax: /remsupport username' + '\nWhere username is the name of the user you want to remove from the Support List.' ,from); this.helpEnd(from); break; case 'supporttitle': this.helpStart(from, '/supporttitle'); cb.sendNotice('Syntax: /supporttitle New Title' + '\nAllows you to change the title used by all members of the Support List.' ,from); this.helpEnd(from); break; case 'moderatorlist': this.helpStart(from, '/moderatorlist'); cb.sendNotice('Syntax: /moderatorlist' + '\nLists the members of the moderator List.' + '\nUseful to chatmods for acknowledging good chatters, good tippers and similar.' ,from); this.helpEnd(from); break; case 'addmoderator': this.helpStart(from, '/addmoderator'); cb.sendNotice('Syntax: /addmoderator username' + '\nWhere username is the name of the user you want to add to the moderator List.' ,from); this.helpEnd(from); break; case 'remmoderator': this.helpStart(from, '/remmoderator'); cb.sendNotice('Syntax: /remmoderator username' + '\nWhere username is the name of the user you want to remove from the moderator List.' ,from); this.helpEnd(from); break; case 'moderatortitle': this.helpStart(from, '/moderatortitle'); cb.sendNotice('Syntax: /moderatortitle New Title' + '\nAllows you to change the title used by all members of the moderator List.' ,from); this.helpEnd(from); break; } }, /* * Yay for init */ init: function() { this.allowModCommands = (cb.settings.allowModCommands == "Yes") ? true : false; this.useCrewColor = cb.settings.useCrewColor; if ( cb.settings.crewName ) { this.crewName = cb.settings.crewName; } 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.useSupportColor = (cb.settings.useSupportColor == "Yes") ? true : false; if ( this.useSupportColor ) { var temparr = cb.settings.supportColor.split(' '); this.supportColor = temparr[1]; } if ( cb.settings.supportList ) { var tempstr = cb.settings.supportList.toLowerCase(); cb.settings.supportList = tempstr; this.supportMembers = tempstr.split(' '); } if ( cb.settings.supportTitle ) { this.supportTitle = cb.settings.supportTitle; } this.useModeratorColor = (cb.settings.useModeratorColor == "Yes") ? true : false; if ( this.useModeratorColor ) { var temparr = cb.settings.moderatorColor.split(' '); this.moderatorColor = temparr[1]; } if ( cb.settings.moderatorList ) { var tempstr = cb.settings.moderatorList.toLowerCase(); cb.settings.moderatorList = tempstr; this.moderatorMembers = tempstr.split(' '); } if ( cb.settings.moderatorTitle ) { this.moderatorTitle = cb.settings.moderatorTitle; } 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); } } }, /* * Hooks into CB */ 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) { this.noModCommand(name, modelName); } else { this.showCrewMembers(name); } commandProcessed = true; break; case '/addcrew': if ( isModel && !allowMods ) { 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 '/friendlist': message['X-Spam'] = true; if (isMod && !allowMods) { this.noModCommand(name, modelName); } else { this.showFriendFriendMembers(name); } commandProcessed = true; break; case '/addfriend': message['X-Spam'] = true; if ( isModel && !allowMods ) { if ( this.checkParams( msgArray, 1 ) ) { this.addFriend( msgArray[1], name ); } else { this.commandError(name, 'Missing name of person to add. Usage: /addfriend username'); } } else { cb.sendNotice('Nice try ' + name + '! Only ' + modelName + ' can add peeps to the Friend List!',name,'',orangered); cb.sendNotice(name + ' tried adding someone to the Friends list! (but was blocked)',modelName,'',orangered); } commandProcessed = true; break; case '/remfriend': message['X-Spam'] = true; if ( isModel && !allowMods ) { if ( this.checkParams( msgArray, 1 ) ) { this.remFriend( msgArray[1], name ); } else { this.commandError(name, 'Missing name of person to remove. Usage: /remfriend username'); } } else { cb.sendNotice('Nice try ' + name + '! Only ' + modelName + ' can remove peeps from the Friend List!',name,'',orangered); cb.sendNotice(name + ' tried removing someone from the Friends list! (but was blocked)',modelName,'',orangered); } commandProcessed = true; break; case '/friendtitle': message['X-Spam'] = true; if ( isModel && !allowMods ) { 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 Support List members. Usage: /supporttitle the new title'); } } else { cb.sendNotice('Nice try ' + name + '! Only ' + modelName + ' can change the title for Friends!',name,'',orangered); } commandProcessed = true; break; case '/supportlist': message['X-Spam'] = true; if (isMod && !allowMods) { this.noModCommand(name, modelName); } else { this.showSupportMembers(name); } commandProcessed = true; break; case '/addsupport': message['X-Spam'] = true; if (isMod && !allowMods) { this.noModCommand(name, modelName); } else { if ( this.checkParams( msgArray, 1 ) ) { this.addSupport( msgArray[1], name ); } else { this.commandError(name, 'Missing name of person to add. Usage: /addsupport username'); } } commandProcessed = true; break; case '/remsupport': message['X-Spam'] = true; if (isMod && !allowMods) { this.noModCommand(name, modelName); } else { if ( this.checkParams( msgArray, 1 ) ) { this.remSupport( msgArray[1], name ); } else { this.commandError(name, 'Missing name of person to remove. Usage: /remsupport username'); } } commandProcessed = true; break; case '/moderatortitle': 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.changeModeratorTitle( tempstr, name ); } else { this.commandError(name, 'Missing new title to use for moderator List members. Usage: /moderatortitle the new title'); } } commandProcessed = true; break; case '/moderatorlist': message['X-Spam'] = true; if (isMod && !allowMods) { this.noModCommand(name, modelName); } else { this.showModeratorMembers(name); } commandProcessed = true; break; case '/addmoderator': message['X-Spam'] = true; if (isMod && !allowMods) { this.noModCommand(name, modelName); } else { if ( this.checkParams( msgArray, 1 ) ) { this.addModerator( msgArray[1], name ); } else { this.commandError(name, 'Missing name of person to add. Usage: /addmoderator username'); } } commandProcessed = true; break; case '/remmoderator': message['X-Spam'] = true; if (isMod && !allowMods) { this.noModCommand(name, modelName); } else { if ( this.checkParams( msgArray, 1 ) ) { this.remModerator( msgArray[1], name ); } else { this.commandError(name, 'Missing name of person to remove. Usage: /remmoderator username'); } } commandProcessed = true; break; case '/moderatortitle': 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.changeModeratorTitle( tempstr, name ); } else { this.commandError(name, 'Missing new title to use for moderator List members. Usage: /moderatortitle the new title'); } } 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 friend else if ( this.isFriend(name) ) { if ( this.useFriendColor ) { message['c'] = '#' + this.friendColor; } message['m'] = this.friendTitle + " " + message['m']; message['in_fanclub'] = true; } // color foreground if support else if ( this.isSupport(name) ) { if ( this.useSupportColor ) { message['c'] = '#' + this.supportColor; } message['m'] = this.supportTitle + " " + message['m']; } // color foreground if moderator else if ( this.isModerator(name) ) { if ( this.useModeratorColor ) { message['c'] = '#' + this.moderatorColor; } message['m'] = this.moderatorTitle + " " + message['m']; } } return message; } }; cb.onMessage(function(message) { return crewBot.onMessage(message); }); crewBot.init();
© Copyright Chaturbate 2011- 2024. All Rights Reserved.