Bots Home
|
Create an App
KimberleysWorldTest
Author:
jesusweptdev
Description
Source Code
Launch Bot
Current Users
Created by:
Jesusweptdev
var members = []; cb.settings_choices = [ {name:"blockMembers", label:"List of Blocked Users", type:'str', required: false}, {name:"group1Members", label:"List of Group1 Members", type:'str', required: false}, {name:"group2Members", label:"List of Group2 Members", type:'str', required: false}, {name:"group3Members", label:"List of Group3 Members", type:'str', required: false}, {name:"group4Members", label:"List of Group4 Members", type:'str', required: false}, {name:"group5Members", label:"List of Group5 Members", type:'str', required: false}, {name:"group6Members", label:"List of Group6 Members", type:'str', required: false}, {name:"group7Members", label:"List of Group7 Members", type:'str', required: false}, {name:"group8Members", label:"List of Group8 Members", type:'str', required: false}, {name:"group9Members", label:"List of Group9 Members", type:'str', required: false}, {name:"group10Members", label:"List of Group10 Members", type:'str', required: false}, {name:"group11Members", label:"List of Group11 Members", type:'str', required: false}, {name:"group12Members", label:"List of Group12 Members", type:'str', required: false}, {name:"group13Members", label:"List of Group13 Members", type:'str', required: false}, {name:"group14Members", label:"List of Group14 Members", type:'str', required: false}, {name:"group15Members", label:"List of Group15 Members", type:'str', required: false}, ]; function buildMembers() { var j = 0; var memberList = []; var cleanUsername; if (cb.settings.group1Members) { memberList = cb.settings.group1Members.split(","); for (j=0; j < memberList.length; j++) { cleanUsername = memberList[j].toLowerCase().replace(/ /g,""); userAddToGroup(cleanUsername, "group1"); } } if (cb.settings.group2Members) { memberList = cb.settings.group2Members.split(","); for (j=0; j < memberList.length; j++) { cleanUsername = memberList[j].toLowerCase().replace(/ /g,""); userAddToGroup(cleanUsername, "group2"); } } if (cb.settings.group3Members) { memberList = cb.settings.group3Members.split(","); for (j=0; j < memberList.length; j++) { cleanUsername = memberList[j].toLowerCase().replace(/ /g,""); userAddToGroup(cleanUsername, "group3"); } } if (cb.settings.group4Members) { memberList = cb.settings.group4Members.split(","); for (j=0; j < memberList.length; j++) { cleanUsername = memberList[j].toLowerCase().replace(/ /g,""); userAddToGroup(cleanUsername, "group4"); } } if (cb.settings.group5Members) { memberList = cb.settings.group5Members.split(","); for (j=0; j < memberList.length; j++) { cleanUsername = memberList[j].toLowerCase().replace(/ /g,""); userAddToGroup(cleanUsername, "group5"); } } if (cb.settings.group6Members) { memberList = cb.settings.group6Members.split(","); for (j=0; j < memberList.length; j++) { cleanUsername = memberList[j].toLowerCase().replace(/ /g,""); userAddToGroup(cleanUsername, "group6"); } } if (cb.settings.group7Members) { memberList = cb.settings.group7Members.split(","); for (j=0; j < memberList.length; j++) { cleanUsername = memberList[j].toLowerCase().replace(/ /g,""); userAddToGroup(cleanUsername, "group7"); } } if (cb.settings.group8Members) { memberList = cb.settings.group8Members.split(","); for (j=0; j < memberList.length; j++) { cleanUsername = memberList[j].toLowerCase().replace(/ /g,""); userAddToGroup(cleanUsername, "group8"); } } if (cb.settings.group9Members) { memberList = cb.settings.group9Members.split(","); for (j=0; j < memberList.length; j++) { cleanUsername = memberList[j].toLowerCase().replace(/ /g,""); userAddToGroup(cleanUsername, "group9"); } } if (cb.settings.group10Members) { memberList = cb.settings.group10Members.split(","); for (j=0; j < memberList.length; j++) { cleanUsername = memberList[j].toLowerCase().replace(/ /g,""); userAddToGroup(cleanUsername, "group10"); } } if (cb.settings.group11Members) { memberList = cb.settings.group11Members.split(","); for (j=0; j < memberList.length; j++) { cleanUsername = memberList[j].toLowerCase().replace(/ /g,""); userAddToGroup(cleanUsername, "group11"); } } if (cb.settings.group12Members) { memberList = cb.settings.group12Members.split(","); for (j=0; j < memberList.length; j++) { cleanUsername = memberList[j].toLowerCase().replace(/ /g,""); userAddToGroup(cleanUsername, "group12"); } } if (cb.settings.group13Members) { memberList = cb.settings.group13Members.split(","); for (j=0; j < memberList.length; j++) { cleanUsername = memberList[j].toLowerCase().replace(/ /g,""); userAddToGroup(cleanUsername, "group13"); } } if (cb.settings.group14Members) { memberList = cb.settings.group14Members.split(","); for (j=0; j < memberList.length; j++) { cleanUsername = memberList[j].toLowerCase().replace(/ /g,""); userAddToGroup(cleanUsername, "group14"); } } if (cb.settings.group15Members) { memberList = cb.settings.group15Members.split(","); for (j=0; j < memberList.length; j++) { cleanUsername = memberList[j].toLowerCase().replace(/ /g,""); userAddToGroup(cleanUsername, "group15"); } } if (cb.settings.blockMembers) { memberList = cb.settings.blockMembers.split(","); for (j=0; j < blockMembers.length; j++) { cleanUsername = blockmemberList[j].toLowerCase().replace(/ /g, ""); userAddToGroup(cleanUsername, "blocked"); } } } function userListByGroup(groupToList) { var output = "Group To List: " + groupToList + "\n"; for (var i=0; i < members.length; i++) { if (members[i].groupname == groupToList) { output += members[i].username + "\n"; } } cb.sendNotice(output); } function userAddToGroup(userToAdd, newGroup) { members[members.length] = {groupname: newGroup, username: userToAdd} } function userRemoveFromGroup(userToRemove) { for (var i=0; i < members.length; i++) { if (members[i].username == userToRemove) { console.log("Found User, removing them from the list"); members.splice(i,1); break; } } } function userGetGroupName(userToFind) { var result = "unknown"; for (var i=0; i < members.length; i++) { if (members[i].username == userToFind) { result = members[i].groupname; break; } } return result; } cb.onMessage(function (msg){ var u = msg.user; var m = msg.m; var output = ""; var isModel = (u == cb.room_slug); if(m[0] == "/") { msg["X-Spam"] = true; if(isModel) { var actionArray = m.substr(1).split(" "); var action = actionArray[0]; switch (action) { case "addUser": userAddToGroup(actionArray[1], actionArray[2]); cb.sendNotice(actionArray[1] + " has been added to group: " + actionArray[2]); break; case "removeUser": userRemoveFromGroup(actionArray[1]); cb.sendNotice(actionArray[1] + " has been removed from all group lists"); break; case "blockUser": userAddToGroup(actionArray[1], "blocked"); cb.sendNotice(actionArray[1] + " has been blocked"); break; case "unblockUser": userRemoveFromGroup(actionArray[1]); cb.sendNotice(actionArray[i] + " has been unblocked"); break; case "listUsers": userListByGroup(actionArray[1]); break; case "kwhelp": output += "######################################\n"; output += "Kimberleys World\n"; output += "######################################\n"; output += "/addUser <username> <groupname> : Adds a user to a specific group\n"; output += "/removeUser <username> : Removes a user from all groups\n"; output += "/blockUser <username> : Adds user to a block list\n"; output += "/unblockUser <username> : Unblocks a user from the block list\n"; output += "/listUsers <groupName> : List all users belonging to a group\n"; output += "\n"; output += "######################################"; cb.sendNotice(output,u,"#D8DEFF","","bold"); break; default: cb.sendNotice("Unknown request - type /kwhelp for more actions"); break; } } } return msg; }); function init() { buildMembers(); } init();
© Copyright Chaturbate 2011- 2024. All Rights Reserved.