Bots Home
|
Create an App
NicksBot
Author:
cbrocks101
Description
Source Code
Launch Bot
Current Users
Created by:
Cbrocks101
/* ################################################################################################################# # Custom bot for Nick12272 # # Modules included are: spamKill,Notices,tipGoal,userInfo,Help # # Author: alanstuart_ # Version: 20210104.0056 ################################################################################################################# */ /* ####################################### # Module: Main (version 20210103.2127) ####################################### /* /* ##################################################### # Declare Global variables and initalization function ##################################################### */ var botname='NicksBot'; //var modules=[],modnames=[]; var modules={},modnames; modules.names=[]; modules.onInit=[];modules.onMessage=[];modules.onCommand=[];modules.onEnter=[];modules.onLeave=[];modules.onFollow=[];modules.onTip=[]; var model=cb.room_slug var debug=0; cb.settings_choices=[]; function init() { modnames=modules.names.join(); sendNotice(`:blankx Running ${botname} with the following functions enabled: ${modnames}\n:blankx Type /help for more info\n:blankx ${botname} was created by alanstuart_`,"","#900000"); // for (let i=0;i<modules.length;i++) {modules[i]("init");} // Object.keys(modules).forEach(m=>{modules[m].modfn("init")}); for (let i=0;i<modules.onInit.length;i++) {modules.onInit[i]("onInit");} botInit(); } /* ############################# # Process Messages ############################# */ cb.onMessage(function (msg) { let c=parseMsg(msg); if (debug) {sendNotice("Debug: user="+c.user+",iscmd="+c.iscmd+",ismod="+c.ismod+",ismodel="+c.ismodel+",isgrey="+c.isgrey+",isfan="+c.isfan+",model="+model+",msg="+c.msg.m,c.user,"#ffffff","#000090","bold");} /* ####################################### # Process chat messages (non-commands) ####################################### */ if (!c.iscmd) { // for (const m in modules) { // if (modules[m].modfn("onMessage",c)) {return msg;} // } // for (i=0;i<modules.length;i++) { // if (modules[i]("onMessage",c)) {return msg;} // } for (i=0;i<modules.onMessage.length;i++) { if (modules.onMessage[i]("onMessage",c)) {return msg;} } return msg; } /* ####################################### # Process command messages ####################################### */ if (c.iscmd) { if (debug) {sendNotice("Debug: cmd="+c.cmd+",cpct="+c.cmdparmct+",c0="+c.cmd0+",c1="+c.cmd1+",c2="+c.cmd2+",cp1="+c.cmdparms[1],c.user,"#ffffff","#000090","bold");} // for (i=0;i<modules.length;i++) { // if (modules[i]("command",c)) {msg['X-Spam']=true;return msg;} // } // for (const m in modules) { // if (modules[m].modfn("command",c)) {msg['X-Spam']=true;return msg;} // } for (i=0;i<modules.onCommand.length;i++) { if (modules.onCommand[i]("onCommand",c)) {msg['X-Spam']=true;return msg;} } } // If it was a recognized command but not processed above, it must be syntax or permission error, // Otherwise pass through the command message unaltered (it may be used by another bot) if (c.cmd in c.cmds) {return badCommand('Syntax or Authorization error in command, type "/help" for more info',c);} else {return msg;} }); /* ############################# # Process User Entering Room ############################# */ cb.onEnter(function(user) { if (debug) {sendNotice("Debug: user "+user.user+" entered room","","#ffffff","#000090","bold");} // for (i=0;i<modules.length;i++) {modules[i]("onEnter",user);} // Object.keys(modules).forEach(m=>{modules[m].modfn("onEnter",user)}); for (i=0;i<modules.onEnter.length;i++) {modules.onEnter[i]("onEnter",user);} }); /* ############################# # Process User Leaving Room ############################# */ cb.onLeave(function(user) { if (debug) {sendNotice("Debug: user "+user.user+" left room","","#ffffff","#000090","bold");} // for (i=0;i<modules.length;i++) {modules[i]("onEnter",user);} // Object.keys(modules).forEach(m=>{modules[m].modfn("onEnter",user)}); for (i=0;i<modules.onLeave.length;i++) {modules.onLeave[i]("onLeave",user);} }); /* ############## # Process Tip ############## */ cb.onTip(function(tip) { if (debug) {sendNotice(`Debug: amt=${tip.smount},msg=${tip.message},from=${tip.from_user}`,"","#ffffff","#000090","bold");} // for (i=0;i<modules.length;i++) {modules[i]("onTip",tip);} // Object.keys(modules).forEach(m=>{modules[m].modfn("onTip",tip)}); for (i=0;i<modules.onTip.length;i++) {modules.onTip[i]("onTip",tip);} }); /* ################## # CORE FUNCTIONS # ################## */ /* ####################################################################### # Parse command paraeters and user info into variables ####################################################################### */ function parseMsg(msg) { let c=[]; c.msg=msg; c.origmsg=msg.m; c.user=msg.user; if (msg.is_mod) {c.ismod=1;} else {c.ismod=0;} if (msg.has_tokens) {c.isgrey=0;} else {c.isgrey=1;} if (msg.in_fanclub) {c.isfan=1;} else {c.isfan=0;} if (c.user==model) {c.ismodel=1; c.ismod=1;} else {c.ismodel=0;} if (msg.m.substr(0,1)!=='/') {c.iscmd=0; return c;} else {c.iscmd=1} c.cmdparms=[]; c.cmdparms = notBlank(msg.m.substr(1).split(" ")); c.cmd = c.cmdparms[0]; c.cmdparmct = c.cmdparms.length-1; c.cmd0=c.cmd1=c.cmd2=c.cmd1p=c.cms2p=""; if (c.cmdparmct==0) {c.cmd0=c.cmd;} if (c.cmdparmct==1) {c.cmd1=c.cmd; c.cmd1p=c.cmd+" "+c.cmdparms[1];} if (c.cmdparmct==2) {c.cmd2=c.cmd; c.cmd2p=c.cmd+" "+c.cmdparms[1]+" "+c.cmdparms[2];} c.cmds=[]; return c; } /* ########################################################################### # Sends an error message notice in response to an invalid command message ########################################################################### */ function badCommand(badmsg,c) { cb.sendNotice('Error in command "'+c.msg.m+'"'+"\n"+badmsg,c.user,"#900000","#ffffff"); c.msg['X-Spam'] = true; return c.msg; } /* ########################################################################### # Function to facilitate splitting command message parms ########################################################################### */ function notBlank(array) { return array.filter(function(item){ return item != ""; }); } /* ##################################################################################### # Notice management # (if your bot uses this function, add "checkNotices()" into the init section) ##################################################################################### */ var notices={},notice={};notice.timer=0; // function checkNotices() { const now=new Date().getTime(); if (notice.timer==0) {notice.last=now;} Object.keys(notices).forEach(n=>{ if (notices[n].interval>0) { notices[n].timeleft-=now-notice.last; if (notices[n].timeleft<=0) { showNotice(n); notices[n].timeleft+=notices[n].interval; } } }); notice.last=now; notice.timer=cb.setTimeout(checkNotices,1000); } // function addNotice(n,msg,interval,delay=0,fgcolor="#000090",bgcolor="#ffffff",weight="bold") { if (n in notices) {delete notices[n];} if (delay==-1) {delay=Math.floor(Math.random()*interval);} notices[n]={"message":msg,"interval":interval*1000,"fgcolor":fgcolor,"bgcolor":bgcolor,"weight":weight,"timeleft":delay*1000}; showNotice(n); } // function delNotice(n) {if (n in notices) {notices[n].interval=0;}} // function listNotices(user) { if (Object.keys(notices).length==0) {sendNotice("There are currently no Notices",user); return;} sendNotice("# List of notices",user); Object.keys(notices).forEach(n=>{ sendNotice("# name="+n+", interval="+notices[n].interval/1000+" sec, nextnotice="+notices[n].timeleft/1000+"sec, message= "+notices[n].message,user); }); } /**/ function showNotice(n) {sendNotice(notices[n].message,undefined,notices[n].fgcolor,notices[n].bgcolor,notices[n].weight);} /* ##################################################################################### # Call sendNotice with a delay (so messages are displayed in order) ##################################################################################### */ var lastsend=0; function sendNotice(notice,touser="",fgcolor="#000090",bgcolor="#ffffff",weight="bold",togroup="") { var now = new Date().getTime(); var wait = Math.max(lastsend+200-now,0); setTimeout(function(){cb.sendNotice(notice,touser,bgcolor,fgcolor,weight,togroup);},wait); lastsend=now+wait; } /* ##################################################################################### # Override cb.setting_choices parameters setup in modules ##################################################################################### */ function deleteSC(scn) { cb.settings_choices.forEach((sc,i)=>{ if (sc.name==scn) {cb.settings_choices.splice(i,1); return;} }); } /* ######################################################################################### # Stub function to be run on bot initialization -- to be overridden with custom bot code ######################################################################################### */ function botInit() {} /* #################### # MODULES #################### */ /* ##################################################################################### # Module: spamKill (version 20210103.1856) ##################################################################################### */ var verify=[],skstat="enabled"; function spamKill(mode,c) { if (mode=="onMessage") { if (skstat=="enabled") { if (!c.isgrey) {return 0;} if (c.isfan) {return 0;} if (c.ismod) {return 0;} else if (!verify[c.user]) { verify[c.user]=[]; verify[c.user]["1stmsg"]=c.msg.m; } else if (verify[c.user]["status"]=="confirmed") {return 0;} else if (verify[c.user]["status"]=="asked") { if (c.msg.m==verify[c.user]["number"]) { verify[c.user]["status"]="confirmed"; sendNotice(`You have been verified, thanks for helping us battle spam!`,c.user,"#008800"); c.msg.m=verify[c.user]["1stmsg"]+"\n"; return 0; } else {sendNotice(`Incorrect response`,c.user,"#ff0000");} } verify[c.user]["number"]= Math.floor(Math.random()*100); c.msg.m=`Please enter the number "${verify[c.user]["number"]}" to send your message. You will only need to do this once.`; c.msg.c="#0000ff"; c.msg['X-Spam'] = true; verify[c.user]["status"]="asked"; return 1; } } else if (mode=="onCommand") { if (c.cmd=="spamkill") { c.cmds["spamkill"]=1; if (c.ismod||c.ismodel) { if (c.cmdparmct==0) {sendNotice(`SpamKill is ${skstat}`,c.user);return 1;} else if (c.cmdparmct==1&&(c.cmdparms[1]=="on"||c.cmdparms[1]=="off")) { if (c.cmdparms[1]=="on") {skstat="enabled";} else {skstat="disabled";} sendNotice(`SpamKill has been ${skstat}`,c.user); return 1; } } else {badCommand("You are not authorized to run spamKill commands",c); return 1;} } } return 0; } modules.names.push("spamKill"); modules.onMessage.push(spamKill); modules.onCommand.push(spamKill); modules["spamKill"] = {summary: "user-friendly module for blocking spambots", desc: "The goal of spamKill is to block spam while still being friendly to legitimate users.\n"+ "It does not use word filters that cause unnecessary blocks, and does not require users to solve\n"+ "capcha problems or retype messages that were intercepted. While this bot will not prevent all spam\n"+ "spam, it will block the most common spam messages generated by chatroom bots. It works as follows:\n"+ "When a grey user types a message in chat for the first time, they are greeted with the following message:\n"+ "> Please enter the number \"NN\" to send your message. You only need to do this once, thanks for helping battle spam!\n"+ "If the user enters the requested number, their message is sent, and they will the be able to chat freely without\n"+ "future prompts. If the requested number is not entered (and most bots will not), the message will not be sent and\n"+ "the user will continue to be prompted each time they enter an new message", commands: {'/spamkill': "Display spamKill status (enabled or disabled)", '/spamkill on': 'Enable spamKill (spamKill is enabled by default at startup)', '/spamkill off': 'Disable spamKill' } }; /* ##################################################################################### # Module: Notices (version 20210103.1852) ##################################################################################### */ cb.settings_choices.push( {name:'n1name',type:'str',defaultValue:'',label:'Notice #1 name',required:false,maxLength:16}, {name:'n1msg',type:'str',defaultValue:'Message to be displayed for notice #1',label:'Notice #1 message',required:false,maxLength:255}, {name:'n1timer',type:'int',defaultValue:0,minValue:0,label:"How often to repeat Notice #1 (in seconds).\nEnter 0 to only show Notice #1 when /n command is used",required:false}, {name:'n2name',type:'str',defaultValue:'',label:'Notice #2 name',required:false,maxLength:16}, {name:'n2msg',type:'str',defaultValue:'Message to be displayed for notice #2',label:'Notice #2 message',required:false,maxLength:255}, {name:'n2timer',type:'int',defaultValue:0,minValue:0,label:"How often to repeat Notice #2 (in seconds).\nEnter 0 to only show Notice #2 when /n command is used",required:false}, {name:'n3name',type:'str',defaultValue:'',label:'Notice #3 name',required:false,maxLength:16}, {name:'n3msg',type:'str',defaultValue:'Message to be displayed for notice #3',label:'Notice #3 message',required:false,maxLength:255}, {name:'n3timer',type:'int',defaultValue:0,minValue:0,label:"How often to repeat Notice #3 (in seconds).\nEnter 0 to only show Notice #3 when /n command is used",required:false}, {name:'n4name',type:'str',defaultValue:'',label:'Notice #4 name',required:false,maxLength:16}, {name:'n4msg',type:'str',defaultValue:'Message to be displayed for notice #4',label:'Notice #4 message',required:false,maxLength:255}, {name:'n4timer',type:'int',defaultValue:0,minValue:0,label:"How often to repeat Notice #4 (in seconds).\nEnter 0 to only show Notice #4 when /n command is used",required:false}, {name:'n5name',type:'str',defaultValue:'',label:'Notice #5 name',required:false,maxLength:16}, {name:'n5msg',type:'str',defaultValue:'Message to be displayed for notice #5',label:'Notice #5 message',required:false,maxLength:255}, {name:'n5timer',type:'int',defaultValue:0,minValue:0,label:"How often to repeat Notice #5 (in seconds).\nEnter 0 to only show Notice #5 when /n command is used",required:false}, {name:'nmods',type:'choice',choice1:"No",choice2:"Yes",defaultValue:'No',label:'Allow Mods to run Notice commands?',required:true}, {name:'nprivu',type:'str',defaultValue:'alanstuart_',label:'ID of Privileged user that can run Notice commands',required:false,maxLength:32} ); function Notices(mode,c) { if (mode=="onCommand") { if (c.cmd=="n") { c.cmds["n"]=1; if (!c.ismodel && !(c.ismod&&cb.settings.nmods=="Yes") && !(c.user==cb.settings.nprivu)) { badCommand("You are not authorized to run the /n command",c); return 1; } if (c.cmdparmct==0) { listNotices(); return 1; } else if (c.cmdparmct==1) { if (c.cmdparms[1] in notices) {showNotice(c.cmdparms[1]); return 1;} else {badCommand("A notice named '"+c.cmdparms[1]+"' was not found",c); return 1;} } else if (c.cmdparmct==2) { if (c.cmdparms[1]=="off") { if (c.cmdparms[2] in notices) { delNotice(c.cmdparms[2]); sendNotice("Notice "+c.cmdparms[2]+" has been turned off"); return 1; } else {badCommand("A notice named "+c.cmdparms[2]+" was not found",c); return 1;} } } else { if (c.cmdparms[1]=="add") { const timer=Number(c.cmdparms[3]); if (!Number.isInteger(timer)) {badCommand("The timer value ("+c.cmdparms[3]+") is not an integer",c); return 1;} let msgwords=c.cmdparms.slice(4); let msg=msgwords.join(" "); if (msg=="") {badCommand("A message must be specified for the new notice",c); return 1;} addNotice(c.cmdparms[2],msg,timer); sendNotice("Notice "+c.cmdparms[2]+" has been added"); return 1; } } } return 0; } else if (mode=="onInit") { loadParmNotice(cb.settings.n1name,cb.settings.n1msg,cb.settings.n1timer); loadParmNotice(cb.settings.n2name,cb.settings.n2msg,cb.settings.n2timer); loadParmNotice(cb.settings.n3name,cb.settings.n3msg,cb.settings.n3timer); loadParmNotice(cb.settings.n4name,cb.settings.n4msg,cb.settings.n4timer); loadParmNotice(cb.settings.n5name,cb.settings.n5msg,cb.settings.n5timer); checkNotices(); } return 0; } function loadParmNotice(n,m,t) { if (!n) return; const tmr = Number(t); if (!Number.isInteger(tmr)) {sendNotice("For notice "+n+" in launchparms, the timer value ("+t+") is not an integer. Notice not created",model,"#ff0000"); return;} if (m=="") {sendNotice("For notice "+n+" in launchparms, the message value is blank, Notice not created".model,"#ff0000"); return;} addNotice(n,m,t); } modules.names.push("Notices"); modules.onInit.push(Notices); modules.onCommand.push(Notices); modules["Notices"] = {summary: "create and manage recurring room notices", desc: "Allows recurring room notices to be setup and managed. Notices can be setup when the bot starts or via commands.\n"+ "For each notice you must specify the name, a message (i.e. the notice text that will be displayed), and the \n"+ "time interval (in seconds) at which it will repeat (use time interval \"0\" to display message manually only\n"+ "After a notice is setup, it can be turned off, or displayed one time manually using the \"/n\" command", commands: {'/n': "List all of the Notices that have been setup", '/n add [name] [timer] [msg]': 'Create a new notice named [name], with message [msg], that will be displayed every [timer] seconds', '/n [name]': "Manually display notice [name] immediately (this will not effect the regularly scheduled display of the notice)", '/n off': "Turn off the recurring notice named [name] -- it can still be displayed manually" } }; /* ##################################################################################### # Module: tipGoal (version 20210103.1851) ##################################################################################### */ var goal={}; var tgfgcol="#ffffff",tgbgcol="#880000"; modules["tipGoal"]={};modules["tipGoal"].modfn=tipGoal; cb.settings_choices.push( {name:'goalamt',type:'int',defaultValue:0,minValue:0,label:"Tip Goal Amount (enter 0 for no tip goal)",required:false}, {name:'goaldesc',type:'str',defaultValue:'',label:'Tip Goal Description',required:false,maxLength:128}, {name:'goalstart',type:'int',defaultValue:0,minValue:0,label:"Amount to start the Amount Collected So Far at",required:false}, {name:'goaltimer',type:'int',defaultValue:180,minValue:0,label:"How often to Display the Goal Counter in the room (seconds)",required:false}, {name:'gmods',type:'choice',choice1:"No",choice2:"Yes",defaultValue:'No',label:'Allow Mods to run tipGoal commands?',required:true}, {name:'gprivu',type:'str',defaultValue:'alanstuart_',label:'ID of Privileged user that can run tipGoal commands',required:false,maxLength:32} ); function tipGoal(mode,c) { if (mode=="onCommand") { if (c.cmd=="g") { c.cmds["g"]=1; if (c.cmdparmct==0) { let gstat="Inactive"; if (goal.active) {gstat="Active";} if (!c.ismodel && !(c.ismod&&cb.settings.gmods=="Yes") && !(c.user==cb.settings.gprivu)) { sendNotice(tipProgress(),c.user,tgfgcol,tgbgcol); return 1; } else {sendNotice(`Tip Goal: ${gstat},amount=${goal.curramt}\/${goal.amt},timer=${goal.timer},description= ${goal.desc}`,c.user);} return 1; } else if (!c.ismodel && !(c.ismod&&cb.settings.gmods=="Yes") && !(c.user==cb.settings.gprivu)) { badCommand("You are not authorized to run this command (try \"/g\")",c); return 1; return 1; } else if (c.cmdparmct==1) { if (c.cmdparms[1]=="show") {sendNotice(tipProgress(),"",tgfgcol,tgbgcol); return 1;} else if (c.cmdparms[1]=="stop") { if (!goal.active) {badCommand("Tip goal is not active, it cannot be stoped",c); return 1;} delNotice("tipGoal"); goal.active=0; sendNotice("Tip goal turned off",c.user); return 1; } else if (c.cmdparms[1]=="restart") { if (goal.desc==""||goal.timer==0||goal.amt==0) {badCommand("The tip goal description, timer, or amount is not set, cannot restart goal",c); return 1;} sendNotice("Tip Goal restarted",c.user); goal.active=1; goal.curramt=0; addNotice('tipGoal',tipProgress(),goal.timer,-1,tgfgcol,tgbgcol); return 1; } else { if (!Number.isInteger(Number(c.cmdparms[1]))) {badCommand("The goal amount specified ("+c.cmdparms[1]+") is not an integer",c); return 1;} if (Number(c.cmdparms[1])<=0) {badCommand("The goal amount specified ("+c.cmdparms[1]+") must be greater than zero",c); return 1;} if (goal.desc==""||goal.timer==0) {badCommand("The goal description or timer is not set, cannot change the amount",c); return 1;} goal.amt=Number(c.cmdparms[1]); sendNotice("Tip Goal target changed to "+goal.amt+" tokens"); processGoalChange(0,goal.curramt); return 1; } } else if (c.cmdparmct==2) { if (c.cmdparms[1]=="sofar") { if (!Number.isInteger(Number(c.cmdparms[2]))) {badCommand("The amount collected specified ("+c.cmdparms[2]+") is not an integer",c); return 1;} if (Number(c.cmdparms[2])<=0) {badCommand("The amount collected specified ("+c.cmdparms[2]+") must be greater than zero",c); return 1;} goal.curramt=Number(c.cmdparms[2]); sendNotice("Tip Goal current amount collected changed to "+goal.curramt+" tokens",c.user); processGoalChange(0,goal.curramt); return 1; } } else { if (!Number.isInteger(Number(c.cmdparms[1]))) {badCommand("The goal amount specified ("+c.cmdparms[1]+") is not an integer",c); return 1;} if (Number(c.cmdparms[1])<=0) {badCommand("The goal amount specified ("+c.cmdparms[1]+") must be greater than zero",c); return 1;} if (!Number.isInteger(Number(c.cmdparms[2]))) {badCommand("The goal noticication timer specified ("+c.cmdparms[2]+") is not an integer",c); return 1;} if (Number(c.cmdparms[2])<=0) {badCommand("The goal notification timer specified ("+c.cmdparms[2]+") must be greater than zero",c); return 1;} goal.amt=Number(c.cmdparms[1]); goal.timer=Number(c.cmdparms[2]); let descwords=c.cmdparms.slice(3); goal.desc=descwords.join(" "); goal.curramt=0; goal.active=1; addNotice('tipGoal',tipProgress(),goal.timer,-1,tgfgcol,tgbgcol); return 1; } } return 0; } else if (mode=="onTip") { let t=c; if (goal.active) { goal.curramt+=t.amount; processGoalChange(goal.curramt-t.amount,goal.curramt); } } else if (mode=="onInit") { sendNotice("Module tipGoal is running, Type /g to view Current Goal","",tgbgcol); loadParmsTG(cb.settings.goalamt,cb.settings.goaldesc,cb.settings.goalstart,cb.settings.goaltimer); if (goal.active) {addNotice('tipGoal',tipProgress(),goal.timer,-1,tgfgcol,tgbgcol);} checkNotices(); } return 0; } function loadParmsTG(a,d,s,t) { goal.active=0;goal.desc="";goal.amt=0;goal.curramt=0;goal.timer=0; if (a==0) {sendNotice("Goal amount is 0 in launchparms, tipGoal not activated",model,"#900000"); return;} if (s>=a) {sendNotice("Goal amount is less than starting amount in launchparms, tipGoal not activated",model,"#900000"); return;} if (!d) {sendNotice("Goal description is blank in launchparms, tipGoal not activated".model,"#900000"); return;} if (t==0) {sendNotice("Goal timer is 0 in launchparms, tipGoal not activated",model,"#900000"); return;} goal.amt=Number(a); goal.desc=d; goal.timer=t; goal.curramt=Number(s);goal.active=1; } function tipProgress() { if (!goal.active) {return `Tip Goal is not active`;} if (goal.curramt<goal.amt) {return `:blankx ##### TIP GOAL (${goal.amt}tk) #####\n`+ `:blankx ${goal.desc}\n:blankx :danteyellowdot ONLY ${goal.amt-goal.curramt} TOKENS TO GO! :danteyellowdot`;} else {return `Tip Goal of ${goal.amt} tokens Reached! ${goal.desc}`;} } function processGoalChange(pa,ca) { if (goal.active) { if ((pa<goal.amt)&&(ca>=goal.amt)) { sendNotice(":goalreached666"); sendNotice("### NOTICE - GOAL HAS BEEN REACHED ###\n"+ "### NOTICE - GOAL HAS BEEN REACHED ###\n"+ "### NOTICE - GOAL HAS BEEN REACHED ###\n"+ "### NOTICE - GOAL HAS BEEN REACHED ###\n"+ "### NOTICE - GOAL HAS BEEN REACHED ###\n"+ "### NOTICE - GOAL HAS BEEN REACHED ###", model,"#ffffff","#ff0000"); goal.active=0; delNotice("tipGoal"); } else {addNotice('tipGoal',tipProgress(),goal.timer,-1,tgfgcol,tgbgcol);} } } modules.names.push("tipGoal"); modules.onInit.push(tipGoal); modules.onCommand.push(tipGoal); modules.onTip.push(tipGoal); modules["tipGoal"] = {summary: "set and manage Tip Goals", desc: "Establishes a tip goal, tracks how much has been collected against the goal and displays it\n"+ "as a room notice, and notifies you when the goal is met. Commands allow you to check the goal status,\n"+ "stop/restart the goal, replace the goal, and change the goal target or amount collected.", commands: {'/g': 'Show the goal, amount collected, and notice timer (displayed to the user typing the command only)', '/g [amt] [timer] [desc]': 'Set the goal to [amt] with description [desc], with notice displayed timer [timer] minutes', '/g [amt]': 'Change the goal target amount to [amt], keeping the same description, timer, and amount collected', '/g stop': 'Disable the tip goal.', '/g restart': 'Restart the the tip goal, using previously set amount, description, and timer, Amount collected gets reset to 0', '/g sofar [amt]': 'Change the amount collected against the goal to [amt]', '/g show': 'Display the goal and its status as a room notice now' } }; /* ##################################################################################### # Module: userInfo (version 20210104.0055) ##################################################################################### */ function userInfo(mode,c) { if (mode=="onMessage") { let col="",g=""; if (c.ismodel) {return 0;} else if (c.ismod) {col="#cc0000";} else if (c.isfan) {col="#009900";} else if (c.msg.tipped_tons_recently) {col="#7a00cc";} else if (c.msg.tipped_alot_recently) {col="#d699ff";} else if (c.msg.tipped_recently) {col="#0000cc";} else if (!c.isgrey) {col="#009999";} else {col="#808080";} if (c.msg.gender=="f") {g=" (female)";} else if (c.msg.gender=="s") {g=" (trans)";} else if (c.msg.gender=="c") {g=" (couple)";} cb.sendNotice(`${c.user}${g} said:`,model,"#ffffff",col,"bold"); } return 0; } modules.names.push("userInfo"); modules.onMessage.push(userInfo); modules.onCommand.push(userInfo); uinfofg=uinfobg=""; modules["userInfo"] = {summary: "Displays user info to performer when a user chats", desc: "Whenever a user types a chat message, a notice is displayed to the performer\n"+ "showing the user's name, color, and gender" }; /* ##################################################################################### # Module: Help (version 20210103.1916) ##################################################################################### */ hfgcol="#000000";hbgcol="#00ee00"; function Help(mode,c) { if (mode=="onCommand") { if ((c.cmd=="help")||(c.cmd=="h")||(c.cmd=="?")) { c.cmds[c.cmd]=1; if (c.cmdparmct==0) { let h=`:blankx Help for Bot ${botname}`; if (typeof(bothelp)=="string") {bothelp.split("\n").forEach(l=>{h+=`\n :blankx ${l}`})}; if (modules.names.length>0) { h+="\n :blankx This Bot includes the following functions: \n"; for (let i=0;i<modules.names.length;i++) { let m=modules.names[i]; h+=` :blankx > "${m}"`; if (modules[m].summary) {h+=` - ${modules[m].summary}`;} h+=` \n`; } h+=" :blankx For help on one of these functions, type \"/help [function]\""; } sendNotice(h,c.user,hfgcol,hbgcol,"normal"); return 1; } else if (c.cmdparmct==1) { let m = c.cmdparms[1]; if (m!=='*') { let mfound=0; for (let i=0;i<modules.names.length;i++) {if ((modules.names[i]==m)||(modules.names[i].toLowerCase()==m)) {mfound=1;m=modules.names[i];}} if (!mfound) {badCommand(`Function "${m}" not found. Type "/help" for the list of functions in this Bot`,c); return 1;} let h1=` :blankx Help for function "${m}"`; if (modules[m].summary) {h1+=` (${modules[m].summary})`;} let h2=""; if (modules[m].desc) {modules[m].desc.split("\n").forEach(l=>{h2+=` :blankx ${l}\n`});} if (modules[m].commands && Object.keys(modules[m].commands).length) { h2+=" :blankx Commands: \n"; Object.keys(modules[m].commands).forEach(c=>{h2+=` :blankx > "${c}" - ${modules[m].commands[c]}\n`}); } if (h2=="") {sendNotice("No help found for function "+m,c.user,hfgcol,hbgcol,"normal");} else {sendNotice(`${h1}\n${h2}`,c.user,hfgcol,hbgcol,"normal");} return 1; } else { let h=`Custom bot for <a href="https://chaturbate.com/${roomname}" style="color:#8888ff;text-decoration:underline;">`+ `${roomname}</a>'s room. Current modules included are: ${modnames}<br>`; for (let i=0;i<modules.names.length;i++) { let m=modules.names[i]; let mdesc=""; if (modules[m].summary) {mdesc=" - "+modules[m].summary;} h+=`<br><span style="font-style:italic;font-weight:bold;text-decoration:underline;color:#0000ff;">${m}</span><b>${mdesc}</b><br>`; if (modules[m].desc) {modules[m].desc.split("\n").forEach(l=>{h+=`${l}<br>`});} if (modules[m].commands && Object.keys(modules[m].commands).length) { h+=`<span style="text-decoration:underline;font-style:italic;font-weight:bold;color:#000000;">Commands</span><br>`; Object.keys(modules[m].commands).forEach(c=>{ h+=` > <span style="font-style:italic;color:#000000;font-weight:bold;">${c}</span>`+ ` ${modules[m].commands[c]}<br>`; }); } } sendNotice(`Copy this code to the bot description: ${h}`,c.user,"","","normal"); } } } } return 0; } modules.names.push("Help"); modules.onCommand.push(Help); modules["Help"] = {summary: "get help on Bot functions and commands", desc: "Get help by typing /help, /h, or /?", commands: {'/h': "Get help on the Bot, and a list of all functions in the bot", '/h [function]': 'Get help on one of the functions in the bot, including it\'s commands', '/h *': "Display an auto-genertaed html description of the bot, that can be cut and paste into the Bot's description screen" } }; /* ############ # BOT CODE ############ */ deleteSC("n1name");deleteSC("n1msg");deleteSC("n1timer"); deleteSC("n2name");deleteSC("n2msg");deleteSC("n2timer"); deleteSC("n3name");deleteSC("n3msg");deleteSC("n3timer"); deleteSC("n4name");deleteSC("n4msg");deleteSC("n4timer"); deleteSC("n5name");deleteSC("n5msg");deleteSC("n5timer"); deleteSC("nmods");deleteSC("nprivu"); deleteSC("goaldesc");deleteSC("goaltimer");deleteSC("n5timer"); deleteSC("gmods");deleteSC("gprivu"); deleteSC("debug"); function botInit() { // addNotice("tipifyou",":tipifyou",240,0); // addNotice("showlove",":showlove_ch",240,120); addNotice("tipmenu1"," :blankx :showlove_ch\n"+ " :blankx ######### TIP MENU #########\n"+ " :blankx :reddotblink2 SHOW ASS 30tk :reddotblink2 \n"+ " :blankx :reddotblink2 SPREAD MY ASS 50tk :reddotblink2\n"+ " :blankx :reddotblink2 JERK OFF WITH FINGER IN ASS 60tk :reddotblink2\n"+ " :blankx :reddotblink2 FINGER MY ASS 80tk :reddotblink2\n"+ " :blankx :reddotblink2 PUT FINGER IN ASS AND SNIFF IT 25tk :reddotblink2\n" + " :blankx ##########################" ,240,0,"#ffffff","#000090"); addNotice("tipmenu2"," :blankx :tipifyou\n"+ " :blankx ######### TIP MENU #########\n"+ " :blankx :reddotblink2 SHOW ASS 30tk :reddotblink2 \n"+ " :blankx :reddotblink2 SPREAD MY ASS 50tk :reddotblink2\n"+ " :blankx :reddotblink2 JERK OFF WITH FINGER IN ASS 60tk :reddotblink2\n"+ " :blankx :reddotblink2 FINGER MY ASS 80tk :reddotblink2\n"+ " :blankx :reddotblink2 PUT FINGER IN ASS AND SNIFF IT 25tk :reddotblink2\n" + " :blankx ##########################" ,240,120,"#ffffff","#000090"); addNotice("follow",":blankx :blankx :followclick",300,-1,"#ffffff","#ffffff"); addNotice("smedia",":blankx ##### Follow Nick on Social Media #####\n"+ ":blankx :twitterlogo-birdbluetransp_vvsml Twitter @CNick12272\n"+ ":blankx :PornHubSQ20 Pornhub NickEMusic\n"+ ":blankx ##############################\n" ,240,-1,"#ffffff","#008800"); loadParmsTG(cb.settings.goalamt,":4rightarrows Make me Cum :4leftarrows",cb.settings.goalstart,90); // loadParmsTG(cb.settings.goalamt,":4rightarrows Make me Cum :starsjulieth",cb.settings.goalstart,90); if (goal.active) {addNotice('tipGoal',tipProgress(),goal.timer,-1,tgfgcol,tgbgcol);} } //debug=1; bothelp="NicksBot Rules!!\nNicksbot was created by alanstuart_"; roomname="Nick12272"; /* ################################################ # AFTER MODULES HAVE BEEN PRODCESSED, RUN INIT # ################################################ */ init(); /* ################################################ # Copy the text below to the bot description # ################################################ Custom bot for <a href="https://chaturbate.com/Nick12272" style="color:#8888ff;text-decoration: underline;">Nick12272</a> room. Current modules included are:spamKill,Notices,tipGoal,userInfo,Help */
© Copyright Chaturbate 2011- 2024. All Rights Reserved.