Bots Home
|
Create an App
Karlaowliam Owl Users
Author:
thesavvy1
Description
Source Code
Launch Bot
Current Users
Created by:
Thesavvy1
/** * Author: thesavvy1 * Version: 1.3.0 */ function getSettings(){var b,a=[];for(b=GROUP_MIN;b<=GROUP_MAX;b++)a=a.concat([{name:"group_"+b+"_name",type:"str",label:"Group #"+b+" Name",required:1===b},{name:"group_"+b+"_price",type:"int",label:"Group #"+b+" Price",required:1===b},{name:"group_"+b+"_icon",type:"str",label:"Group #"+b+" Icon (optional)",required:!1}]);return a=a.concat([{name:"show_group_names",type:"choice",label:"Show Group Names",choice1:"true",choice2:"false",defaultValue:"true"},{name:"allow_moderators",type:"choice",label:"Allow Moderators To Manage Groups",choice1:"true",choice2:"false",defaultValue:"true"},{name:"notify_room_owner",type:"choice",label:"Notify Me of All Changes",choice1:"true",choice2:"false",defaultValue:"true"},{name:"notification_message",type:"str",label:"Notification Message",defaultValue:"Type {trigger} to see a list of possible groups."},{name:"list_trigger",type:"str",label:"List Trigger",defaultValue:"groups"},{name:"notification_time",type:"int",label:"Notification Time Interval (in minutes)",defaultValue:15},{name:"notification_foreground",type:"str",label:"Notification Foreground Color (hex code)",defaultValue:"#AB001C"},{name:"notification_background",type:"str",label:"Notification Background Color (hex code)",required:!1}])}function isAdmin(a,b){var c="true"===cb.settings.allow_moderators;return a===cb.room_slug||c&&!!b}function getUserGroup(a){var b,c;for(b=GROUP_MIN;b<=GROUP_MAX;b++){var d=groups[b];if(cbjs.arrayContains(d,a)){c=getGroup(b);break}}return c}function populateGroups(){var a,b;for(a=GROUP_MIN;a<=GROUP_MAX;a++){var c=cb.settings["group_"+a+"_users"]||"",d=c.split(",")||[];for(b=0;b<d.length;b++)setGroup(a,d[b].trim())}}function getGroupIcon(a){var b=cb.settings["group_"+a+"_icon"];return b&&":"!==b.charAt(0)&&(b=":"+b),b}function setGroup(a,b,c){var e,d="true"===cb.settings.show_group_names;for(e=GROUP_MIN;e<=GROUP_MAX;e++){var f=groups[e];e!==a||cbjs.arrayContains(f,b)?f=cbjs.arrayRemove(f,b):f.push(b),groups[e]=f}if(c){var g="";if(a){var f=getUserGroup(b);f&&f.name&&(g="You have been added to group",d&&(g+=" "+f.name),f.icon?g+=" "+f.icon+" .":g=".")}else g="You have been removed from all groups.";cb.sendNotice(g,b,HELP_BACKGROUND,HELP_FOREGROUND,HELP_STYLE)}}function getGroup(a){var b=cb.settings["group_"+a+"_name"],c=getGroupIcon(a),d=parseInt(cb.settings["group_"+a+"_price"]);return c&&":"!==c.charAt(0)&&(c=":"+c),{name:b,icon:c,price:d}}function findGroup(a){var b,c;for(a=parseInt(a),b=1;b<=5;b++){var d=parseInt(cb.settings["group_"+b+"_price"]);a===d&&(c=b)}return c}function findGroupByName(a){var b,c;for(b=1;b<=5;b++){var d=cb.settings["group_"+b+"_name"];a&&d&&a.toString().toLowerCase()===d.toString().toLowerCase()&&(c=b)}return c}function showUserGroup(a,b,c){var d=getUserGroup(a),e="User, "+a+",",f="true"===cb.settings.show_group_names,g="true"===cb.settings.notify_room_owner;d&&d.name?(e+=" is part of ",f&&(e+=d.name+" "),e+=d.icon?d.icon+" .":"."):e+=" is not part of a group.",cb.sendNotice(e,b,HELP_BACKGROUND,HELP_FOREGROUND,HELP_STYLE),c&&g&&b!==cb.room_slug&&cb.sendNotice(e+" Change made by "+b,cb.room_slug,HELP_BACKGROUND,HELP_FOREGROUND,HELP_STYLE)}function showHelp(a){var b="*** Custom Groups Help ***\nTo add a user to a group, type: !groupadd {username};{group name}\nTo remove a user from a group, type: !groupremove {username}\nTo find a user's group, type: !groupfind {username}";cb.sendNotice(b,a,HELP_BACKGROUND,HELP_FOREGROUND,HELP_STYLE)}function showGroups(a){var d,b="true"===cb.settings.show_group_names,c="*** Tip To Select Your Choice ***";for(d=1;d<=5;d++){var e=getGroup(d);e.name&&e.price>0&&(c+="\nTip "+e.price+" for",b&&(c+=" "+e.name),e.icon&&(c+=" "+e.icon))}cb.sendNotice(c,a,HELP_BACKGROUND,HELP_FOREGROUND,HELP_STYLE)}function getTrigger(){var a=cb.settings.list_trigger;return a&&"/"!==a.charAt(0)&&(a="/"+a),a}function getColor(a){return a&&"#"!==a.charAt(0)&&(a="#"+a),a}function notifyRoom(a){var b=cb.settings.notification_message,c=getTrigger(),d=cb.settings.notification_time,e=getColor(cb.settings.notification_foreground),f=getColor(cb.settings.notification_background);b&&(b=b.replace("{trigger}",c),b&&cb.sendNotice(b,a,f,e),(!d||d<TIME_MIN)&&(d=1),a||cb.setTimeout(notifyRoom,6e4*d))}function init(){populateGroups(),notifyRoom()}var groups={1:[],2:[],3:[],4:[],5:[]},GROUP_MIN=1,GROUP_MAX=5,TIME_MIN=1,HELP_BACKGROUND="#FCFCD7",HELP_FOREGROUND="",HELP_STYLE="bold",HELP_TRIGGER="!grouphelp",ADD_TRIGGER="!groupadd",REMOVE_TRIGGER="!groupremove",FIND_TRIGGER="!groupfind";cb.settings_choices=getSettings(),cb.onTip(function(a){var b=a.amount,c=a.from_user,d=findGroup(b),e="true"===cb.settings.show_group_names;if(d){var f=cb.settings["group_"+d+"_name"],g=cb.settings["group_"+d+"_price"],h=getGroupIcon(d),i=c+" just joined ";i+=e?f:groupicon,i+=". Tip "+g+" to join too!",h&&e&&(i=h+" "+i),setGroup(d,c),cb.sendNotice(i,"","#ABFFFB","#000000","bold")}}),cb.onMessage(function(a){var b=getTrigger(),c=a.m,d=a.user,e=getUserGroup(d),f=a.is_mod,g="true"===cb.settings.notify_room_owner,h="true"===cb.settings.show_group_names;if(b&&c===b)a["X-Spam"]=!0,showGroups(d);else if(isAdmin(d,f))if(c===HELP_TRIGGER)a["X-Spam"]=!0,showHelp(d);else if(0===c.indexOf(ADD_TRIGGER)){a["X-Spam"]=!0;var i=c.substring(c.indexOf(ADD_TRIGGER)+ADD_TRIGGER.length).trim().split(";"),j=i[0],k=i[1],l=findGroupByName(k);if(d===j||j!==cb.room_slug)if(l)setGroup(l,j,d!==j),showUserGroup(j,d,!0);else{var m=k?"Could not find a group called "+k+".":"You must enter in the group name you want to add the user to.";cb.sendNotice(m,d,HELP_BACKGROUND,HELP_FOREGROUND,HELP_STYLE)}else cb.sendNotice("You cannot add the room owner to a group.",d,HELP_BACKGROUND,HELP_FOREGROUND,HELP_STYLE)}else if(0===c.indexOf(REMOVE_TRIGGER)){a["X-Spam"]=!0;var n=c.substring(c.indexOf(REMOVE_TRIGGER)+REMOVE_TRIGGER.length).trim();if(d===n||n!==cb.room_slug){setGroup(null,n,d!==n);var m="User, "+n+", has been removed from all groups.";cb.sendNotice(m,d,HELP_BACKGROUND,HELP_FOREGROUND,HELP_STYLE),g&&d!==cb.room_slug&&cb.sendNotice(m+" Change made by "+d,cb.room_slug,HELP_BACKGROUND,HELP_FOREGROUND,HELP_STYLE)}else cb.sendNotice("You cannot remove the room owner from a group.",d,HELP_BACKGROUND,HELP_FOREGROUND,HELP_STYLE)}else if(0===c.indexOf(FIND_TRIGGER)){a["X-Spam"]=!0;var o=c.substring(c.indexOf(FIND_TRIGGER)+FIND_TRIGGER.length).trim();o&&showUserGroup(o,d)}return e&&(e.icon?a.m=e.icon+" "+c:h&&(a.m=e.name+" : "+c)),a}),cb.onEnter(function(a){var b=a.user,c=a.is_mod;isAdmin(b,c)?showHelp():notifyRoom(b)}),init();
© Copyright Chaturbate 2011- 2024. All Rights Reserved.