Bots Home
|
Create an App
patreon club members bot
Author:
et365
Description
Source Code
Launch Bot
Current Users
Created by:
Et365
//Patreon club members //this sets up all the configurable choices in the settings of the App cb.settings_choices = [ {name: 'clubName', label: 'Name of the Club: ', type: 'str', minLength: 0, maxLength: 50, required: false, defaultValue: 'Patrons'}, {name: 'nameDecoration', label: 'Any gifs or prefix before the username add them here: ', type: 'str', minLength: 0, maxLength: 50, required: false, defaultValue: '[:staremoji][Patron]'}, {name: 'memberList', label: 'List of Current Club members MUST BE SEPARATED BY COMMA , (Paste the usernames of people who tipped previously into here before starting the Bot): ', type: 'str', minLength: 0, maxLength: 10240, required: false, defaultValue: ''}, {name: 'textColor', label: 'text colour of Club Members – its in HTML colour code so google it if you\'re not sure which colour you want and add it without the \'# \': ', type: 'str', minLength: 0, maxLength: 6, required: false, defaultValue: '000000'}, {name: 'bGColor', label: 'Background colour of text written by Club members', type: 'str', minLength: 0, maxLength: 6, required: false, defaultValue: '287aff'}, ]; //setting up array variables to hold all the different club members var memberSettings = [], clubMembers = [], timeOnEnter = {}; //this code is run when the user who has joined the room sends a message cb.onMessage(function(msg){ var u = msg.user; //gets the username of whoever typed the message and places it in u variable //if the user types /currentmembers into the chat, then hide that message from other users, and display the usernames to the one requesting if(msg.m.indexOf('/currentmembers') >= 0){ msg['X-Spam'] = true; msg.background = '#E6E6FA'; msg.c = '#000000'; sendNames(u) } //if the user is part of a club, then decorate his message with pre-determined gif etc. else if(isClubMember(u)){ msg.m = cb.settings.nameDecoration+' '+msg.m msg.c = '#'+cb.settings.textColor; msg.background = '#'+cb.settings.bGColor; } return msg; //must return msg object at the end of the function always }); //if on enter a club member joins the room, then display an announcement cb.onEnter(function(user){ var u = user.user, b = cb.room_slug; if(isClubMember(u)){ cb.chatNotice(b+'\'s '+cb.settings.clubName+' member '+u+' just entered the room!','','#'+cb.settings.bGColor,'#'+cb.settings.textColor) timeOnEnter.u = new Date().getTime() } }); //if a club member has left the room then display an announcement that they have left the room cb.onLeave(function(user){ var u = user.user, b = cb.room_slug, time = new Date().getTime(); if(isClubMember(u) && time-timeOnEnter.u>60000){cb.chatNotice(b+'\'s '+cb.settings.clubName+' member '+u+' just left the room!','','#'+cb.settings.bGColor,'#'+cb.settings.textColor)} }); function isClubMember(username){return(clubMembers.includes(username))} function sendNames(username){ //displays club members, plus adds a newline at the end of the clubnames and displays the next club members cb.chatNotice(cb.settings.clubName+' Members: '+clubMembers.toString().replace(/,/g,', ')+'\n', username); } //splits usernames with a comma and gets rid of the spaces between them, if there are any occurences of that if(cb.settings.memberList){ memberSettings = cb.settings.memberList.split(','); for(i=0; i<memberSettings.length; i++){clubMembers[i] = memberSettings[i].toLowerCase().replace(/ /g,"");} }
© Copyright Chaturbate 2011- 2026. All Rights Reserved.