Bots Home
|
Create an App
ScottBot
Author:
scottp13
Description
Source Code
Launch Bot
Current Users
Created by:
Scottp13
/** * ScottBot * A basic room control bot * Written by scottp13 2015.06.24 * Current version: 2015.09.24 * * Derived from UltraBot 1.06 by britney_and_justin * Notifier feature inspired by Rotating Notifier 1.0.3 by badbadbubba * Notice commands compatible with CrazyNote 1.6 by CrazyWare * Concepts and general inspiration from naughtyalicex_ * Special thanks to rkph0t, kaylawynn, orwhen, and hottminx @preserve **/ function SbVip(e){this.sName=e,this.sUser=[],this.nInitCount=0,this.nTip=0}function help(e,s,t){var n;switch(e||(e='commands'),e){case'commands':sbOut.sendUb('ScottBot Commands Available To You',s),n="/ubhelp - Display this help\n/leaderboard - Display the leaderboard\n/time - Display elapsed time and current server time",t>=3&&(n+="\n/greysoff - Disable chat from grey users\n/greyson - Enable chat from grey users\n/silencelevel - Turn grey chat on/off. Type \"/ubhelp silencelevel\" for more info\n/graphiclevel - Turn grey graphics on/off. Type \"/ubhelp graphiclevel\" for more info\n/pmm - Private message to model. Type \"/ubhelp pmm\" for more info\n/ubhelp silence - Display info about silence & unsilence of users\n/ubhelp timer - Display info about countdown timer commands\n/ubhelp banner - Display info about banner commands\n/ubhelp vip - Display info about VIP commands", bCrazyMode&&(n+='\n/ubhelp notice - Display info about notice commands'),t>=4&&(n+='\n/ubhelp admin - Display info about Admin commands')),cb.sendNotice(n,s);break;case'silencelevel':case'greysoff':case'greyson':cb.sendNotice("'/silencelevel 1' or '/greysoff' will silence Greys.\n'/silencelevel 0' or '/greyson' will allow Greys to chat.\nModel, Mods, Fan Club Members, and VIPs are not affected by silencelevel.",s);break;case'graphiclevel':cb.sendNotice("'/graphiclevel 1' will prevent Greys from using graphics (default).\n'/graphiclevel 0' will allow Greys to use graphics.\nModel, Mods, Fan Club Members, and VIPs are not affected by graphiclevel.",s);break;case'silence':cb.sendNotice("Commands for silencing & unsilencing users for the current session\nAll commands send notification to the Model and all Mods\nMods can NOT be silenced (names are added to the list, but it has no effect)\n/warn user - Sends a warning to the user, but does not silence them\n/silence user - User is notified and silenced\n/ninja user - User is silenced but given no notice (silenced silently)\n/timeout user - User is notified and silenced for a few minutes\n/unsilence user - Undoes any of the silencing methods",s); break;case'pmm':case'bc':cb.sendNotice("(Private Message to Model) Send a 'whisper message' to the Model through chat.\nThe message will appear as a notice from you that is visible ONLY to the Model.\nThe Model can disable this feature in the bot settings.\nExample:\n/pmm Do you want me to turn off greys?",s),cb.sendNotice('Private from username: Do you want me to turn off greys?',s,'#fbfcb6','#dc0000','bold');break;case'banner':case'banners':n='',n?cb.sendNotice(n,s):cb.sendNotice('There are no banner commands enabled',s);break;case'notice':case'notices':case'cn':n=bCrazyMode?"/bc - Send private notice to the Model\n/cn - Send general notice to the public\n/tm - Send private notice to all Mods as a group\n/tbm - Send private notice to all Mods and the Model":'The Model has not enabled this feature', cb.sendNotice(n,s);break;case'timer':cb.sendNotice("/starttimer n - Starts the countdown timer for n minutes\n/addtime n - Adds n minutes to the countdown timer, starting it if needed\n/timeleft - Displays approximate time remaining on the countdown\n/stoptimer - Stops and resets the countdown timer (takes up to 1 minute)\n Stop is only needed if you want to restart for a different duration",s);break;case'vip':cb.sendNotice("For managing the VIP list\n/viplist - Display list of VIP users in a useful format\n/vipadd user - For Model only: Add user to the VIP users",s);break;case'admin':t>=4?(n="/bye - Display end of show stats\n//version - Display version number\n//crazy n - Turn CrazyMode on or off\n//filter n - Turn advanced filtering on or off",cb.sendNotice(n,s)):sbOut.sendUb('Not a valid option. Type /ubhelp for help.',s); break;default:sbOut.sendUb('Not a valid option. Type /ubhelp for help.',s)}}function showEnd(){var e;sbOut.sendBold('Show duration: '+sbTime.botDuration()+'\nThank you for watching!',''),e=sbTip.getStats()+sbVip.getNew(),sbOut.sendBold(e,cb.room_slug)}function parseCommand(e,s,t){var n,i,o,a;if(0===t)return!0;switch(a=e.indexOf(' '),a>-1?(i=e.substr(0,a),o=e.substring(a+1).trim()):(i=e,o=''),n=!0,i){case'/ubhelp':help(o,s,t);break;case'/leaderboard':bLeaderboard?sbTip.showLeaders(10,s):sbOut.sendUb('The leaderboard is disabled',s);break;case'/time':sbOut.sendBold('Show Duration = '+sbTime.botDuration()+' '+sbTime.getWorldTime(),t>=3?'':s);break;case'/timeleft':sbTime.showCountdown(s,t>=3);break;case'/whisper':case'/pm':case'/w':case'/tell':case'/t':sbOut.sendUb('Chat is for chatting. Please use PMs for private messages.',s); break;case'/ignore':case'/reply':case'/ignorelevel':break;default:n=!1}if(!n&&t>=3)switch(n=!0,i){case'/greysoff':case'/greyoff':sbSilence.setLevel(!0,'1',s,t);break;case'/greyson':case'/greyon':sbSilence.setLevel(!0,'0',s,t);break;case'/silencelevel':sbSilence.setLevel(!0,o,s,t);break;case'/graphiclevel':case'/graphicslevel':sbSilence.setLevel(!1,o,s,t);break;case'/warn':sbSilence.warnUser(o,s,!1);break;case'/silence':sbSilence.silUser({sUser:o,sMod:s});break;case'/ninja':sbSilence.silUser({sUser:o,sMod:s,bNinja:!0});break;case'/timeout':sbSilence.silUser({sUser:o,sMod:s,nTime:Date.now()+15e4});break;case'/unsilence':sbSilence.unUser(o,s);break;case'/pmm':sbOut.sendPmm(o,s);break;case'/bc':bCrazyMode?sbOut.sendPmm(o,s):n=!1;break;case'/cn':case'/cnh':case'/cnd':case'/cndh':bCrazyMode?sbOut.sendPublic(o,s,i):n=!1; break;case'/tm':bCrazyMode?sbOut.sendModChat(o,s,!1):n=!1;break;case'/tbm':bCrazyMode?sbOut.sendModChat(o,s,!0):n=!1;break;case'/starttimer':case'/settimer':sbTime.setCountdown(o,s,!1);break;case'/addtime':sbTime.setCountdown(o,s,!0);break;case'/stoptimer':case'/endtimer':case'/cleartimer':sbTime.clearCountdown(s);break;case'/viplist':sbVip.showList(s);break;case'/vipadd':t>=4?sbVip.addUser(o):(cb.sendNotice('Only '+cb.room_slug+' is allowed to do that',s),n=!1);break;default:n=!1}if(!n&&t>=4)switch(n=!0,i){case'//graphic':sbSilence.silUser({sUser:o,sMod:s,bGrOnly:!0});break;case'//tippers':sbTip.showDebug(s);break;case'//filter':bFilter=parseInt(o),sbOut.sendBold('Advanced filtering '+(bFilter?'ON':'OFF'),s);break;case'//crazy':bCrazyMode=parseInt(o),sbOut.sendBold('CrazyMode '+(bCrazyMode?'ON':'OFF'),s); break;case'//version':sbOut.sendSplash(s);break;case'//clear':cb.sendNotice('\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n');break;case'/bye':showEnd();break;default:'/'!==i.charAt(1)&&(n=!1)}return n}function init(){bTipTitles='Yes'===cb.settings.sTipTitles,bLeaderboard='Yes'===cb.settings.sLeaderboard,bWhisper='Yes'===cb.settings.sWhisperOn,bCrazyMode='Yes'===cb.settings.sCrazyOn,sbOut.parseInit(),sbTip.nKingMin=cb.settings.nKingMin,sbTip.nMsgMin=cb.settings.nTipMessageMin,bVipLogo='Yes'===cb.settings.sVipLogo,sbVip.setTip(cb.settings.nVipTip),sbVip.parseInit(cb.settings.sVipUsers),cb.setTimeout(sbTime.doIntervalCB.bind(sbTime),6e4),sbTime.tBotStart=Date.now(),sbOut.sendSplash('',!1),cb.sendNotice('Grey users can\'t use graphics by default. To allow, type /graphiclevel 0',cb.room_slug); }cb.settings_choices=[{name:'sNotice1',label:'Periodic notice 1 (or blank)',type:'str',defaultValue:'',required:!1},{name:'sNotice2',label:'Periodic notice 2 (or blank)',type:'str',defaultValue:'',required:!1},{name:'sNotice3',label:'Periodic notice 3 (or blank)',type:'str',defaultValue:'',required:!1},{name:'sNotice4',label:'Periodic notice 4 (or blank)',type:'str',defaultValue:'',required:!1},{name:'sNotice5',label:'Periodic notice 5 (or blank)',type:'str',defaultValue:'',required:!1},{name:'sVipLogo',label:'Display graphic for Fan Club / VIP messages?',type:'choice',choice1:'Yes',choice2:'No',defaultValue:'No'},{name:'sVipUsers',label:'VIP users (exact names separated by spaces)',type:'str',defaultValue:'',required:!1},{name:'nVipTip',label:'Tip amount to become a VIP (0 to disable)',type:'int', minValue:0,maxValue:1e4,defaultValue:0},{name:'sTipTitles',label:'Display users\' tip totals and crown?',type:'choice',choice1:'Yes',choice2:'No',defaultValue:'Yes'},{name:'nKingMin',label:'Minimum tip total for a user to become King',type:'int',minValue:1,maxValue:1e3,defaultValue:50},{name:'sLeaderboard',label:'Use the Leaderboard feature?',type:'choice',choice1:'Yes',choice2:'No',defaultValue:'Yes'},{name:'sEntryMessage',label:'Message to user entering room (blank to disable)',type:'str',minLength:1,maxLength:1e3,defaultValue:'Welcome to my room!',required:!1},{name:'sTipMessage',label:'Message to thank tipper (blank to disable)',type:'str',minLength:1,maxLength:1e3,defaultValue:'Thank you!',required:!1},{name:'nTipMessageMin',label:'Minimum tip to trigger thanks message',type:'int',minValue:1, maxValue:1e4,defaultValue:25},{name:'sWhisperOn',label:'Allow Mods to send you whisper messages?',type:'choice',choice1:'Yes',choice2:'No',defaultValue:'Yes'},{name:'sCrazyOn',label:'Allow Mods to send notices? (Pick \'No\' if using CrazyNote)',type:'choice',choice1:'Yes',choice2:'No',defaultValue:'No'}];var bTipTitles=!1,bLeaderboard=!1,bWhisper=!1,bFilter=!1,bCrazyMode=!1,bVipLogo=!1,sbAdmin={isAdmin:function(e){return e===cb.room_slug}},sbOut={sNotice:[],nNotice:0,sendUb:function(e,s){cb.sendNotice(e,s,'#e4abed','#000000')},sendBold:function(e,s){cb.sendNotice(e,s,'','','bold')},sendModelMod:function(e){e='(To Mods & Model) '+e,cb.sendNotice(e,'','','','','red'),cb.sendNotice(e,cb.room_slug)},sendPmm:function(e,s){bWhisper?e&&(cb.sendNotice('(Private from '+s+') '+e,cb.room_slug,'#fbfcb6','#dc0000','bold'), this.sendBold('Your message was sent to '+cb.room_slug,s)):this.sendBold('The Model has disabled this feature',s)},sendPublic:function(e,s,t){if(e){switch(t){case'/cnh':cb.sendNotice('\u2600 '+e,'','#eafcfc','#ab0722','bold');break;case'/cnd':cb.sendNotice('\u2606 '+e,'','','#dc0000','bold');break;case'/cndh':cb.sendNotice('\u2764 '+e,'','','#dc0000','bold');break;default:cb.sendNotice('\u2724 '+e,'','','#4a96d0','bold')}this.sendBold('Public notice was sent by '+s,cb.room_slug)}},sendModChat:function(e,s,t){var n;e&&(n='(To Mods '+(t?'& Model ':'')+'from '+s+') '+e,cb.sendNotice(n,'','#fbfcb6','#dc0000','bold','red'),t?cb.sendNotice(n,cb.room_slug,'#fbfcb6','#dc0000','bold'):s===cb.room_slug&&this.sendBold('Your message was sent to all Mods',s))},sendSplash:function(e,s){var t="ScottBot 2015.09.24 by scottp13\nScottBot is a room control bot that uses UltraBot commands. For more information, type /ubhelp"; s&&(bWhisper&&(t+="\nScottBot /pmm lets Mods send whisper messages to the model. For more info, type /ubhelp pmm"),bCrazyMode&&(t+="\nScottBot notices are enabled. CrazyNote commands may be used to send notices.")),this.sendBold(t,e)},sendRotating:function(){this.sNotice.length&&(this.sNotice[this.nNotice]&&cb.sendNotice(this.sNotice[this.nNotice],'','','#154ada','bold'),this.nNotice+=1,this.nNotice>=this.sNotice.length&&(this.nNotice=0))},parseInit:function(){cb.settings.sNotice1&&this.sNotice.push(cb.settings.sNotice1),cb.settings.sNotice2&&this.sNotice.push(cb.settings.sNotice2),cb.settings.sNotice3&&this.sNotice.push(cb.settings.sNotice3),cb.settings.sNotice4&&this.sNotice.push(cb.settings.sNotice4),cb.settings.sNotice5&&this.sNotice.push(cb.settings.sNotice5)}},sbTip={oList:[],bSorted:!0, sKing:'',nKing:0,nKingMin:50,nMsgMin:25,nTotal:0,nCount:0,sLarge:'',nLarge:0,addTip:function(e,s){this.nTotal+=s,this.nCount+=1,s>this.nLarge&&(this.sLarge=e,this.nLarge=s)},userTotal:function(e){var s;for(s=0;s<this.oList.length;s+=1)if(this.oList[s].sUser===e)return this.oList[s].nTotal;return 0},addUser:function(e,s){var t,n=-1;for(this.bSorted=!1,t=0;t<this.oList.length;t+=1)if(this.oList[t].sUser===e){n=t;break}return 0>n?(this.oList.push({sUser:e,nTotal:s}),s):(this.oList[n].nTotal+=s,this.oList[n].nTotal)},sortList:function(){this.bSorted||(this.oList.sort(function(e,s){return s.nTotal-e.nTotal}),this.bSorted=!0)},showDebug:function(e){sbOut.sendBold('length='+this.oList.length+' nTotal='+this.nTotal+' nCount='+this.nCount+' nLarge='+this.nLarge,e)},showLeaders:function(e,s){var t,n=''; if(!this.oList.length)return void sbOut.sendUb('No tips yet',s);for(this.sortList(),t=0;e>t&&t<this.oList.length;t+=1)n+=(t?'\n ':' ')+(t+1)+'. '+this.oList[t].sUser+': '+this.oList[t].nTotal;sbOut.sendUb('Leaderboard',s),cb.sendNotice(n,s)},getStats:function(){var e='Stats (shown only to you): ';return this.oList.length&&(e+=this.oList.length+' tippers \u25cf '),e+=this.nCount+' individual tips \u25cf '+this.nTotal+' total tokens ($'+(.05*this.nTotal).toFixed(2)+')\n',this.sKing&&this.nTotal&&(e+='High tipper: '+this.sKing+' = '+this.nKing+' tokens ('+100*(this.nKing/this.nTotal).toFixed(2)+'% of total) \u25cf '),this.sLarge&&this.nLarge&&(e+='Largest tip: '+this.sLarge+' = '+this.nLarge+' tokens\n'),e}};SbVip.prototype.isVip=function(e){return this.sUser.indexOf(e)>-1},SbVip.prototype.showList=function(e){ var s,t;if(this.sUser.length)for(t='This list can be used with CrazyTicket /add if desired:\n',s=0;s<this.sUser.length;s+=1)t+=this.sUser[s]+' ';else t='There are no VIPs yet';sbOut.sendBold(t,e)},SbVip.prototype.addUser=function(e){this.isVip(e)||(this.sUser.push(e),cb.sendNotice('We have a new VIP!\nWelcome '+e+'!','','','#00a000','bold'))},SbVip.prototype.getNew=function(){var e,s='';if(this.sUser.length>this.nInitCount)for(s+='Please add these new '+this.sName+' to your list:\n',e=this.nInitCount;e<this.sUser.length;e+=1)s+=this.sUser[e]+' ';return s},SbVip.prototype.parseInit=function(e){var s,t,n=[];if(e){for(n=e.split(/[ ,]+/),t=0;t<n.length;t+=1)s=n[t].trim().toLowerCase(),s&&this.sUser.push(s);this.nInitCount=this.sUser.length}},SbVip.prototype.checkTip=function(e,s){this.nTip&&s===this.nTip&&this.addUser(e); },SbVip.prototype.setTip=function(e){this.nTip=e};var sbVip=new SbVip('VIP users'),sbTime={tBotStart:0,nMinute:0,nCountdown:0,bCancel:!1,sDay:['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],pad:function(e,s){var t='0000'+e;return t.substr(t.length-s)},duration:function(e){var s=(Date.now()-e)/6e4,t=this.pad(Math.floor(s/60),2),n=this.pad(Math.floor(s%60),2);return t+'h '+n+'m'},botDuration:function(){return this.duration(this.tBotStart)},getUTCTod:function(e){return'undefined'==typeof e&&(e=new Date),this.pad(e.getUTCHours(),2)+':'+this.pad(e.getUTCMinutes(),2)+' UTC'},getTod:function(e){var s,t;return'undefined'==typeof e&&(e=new Date),s=e.getHours(),t=s>11?' PM':' AM',s>12?s-=12:0===s&&(s=12),s+':'+this.pad(e.getMinutes(),2)+t},getWorldTime:function(){var e,s=new Date; return e='\u2217 '+this.getUTCTod(s)+' \u2217 US West = '+this.sDay[s.getDay()]+' '+this.getTod(s)+' \u2217 US East = ',s.setTime(s.getTime()+108e5),e+=this.sDay[s.getDay()]+' '+this.getTod(s)},doIntervalCB:function(){this.nMinute+=1,this.nMinute%5===0&&bLeaderboard&&sbTip.oList.length&&sbTip.showLeaders(3,''),this.nMinute%2===0&&sbOut.sendRotating(),cb.setTimeout(this.doIntervalCB.bind(this),6e4)},doCountdownCB:function(){return this.bCancel?(sbOut.sendUb('Countdown timer has stopped',''),this.nCountdown=0,void(this.bCancel=!1)):(this.nCountdown-=1,this.nCountdown<1?(sbOut.sendUb('****************************************\nTime is up! Countdown has finished!',''),void(this.nCountdown=0)):(30===this.nCountdown||10===this.nCountdown||5===this.nCountdown||2===this.nCountdown?sbOut.sendUb('Countdown has '+sbTime.nCountdown+' minutes left',''):1===this.nCountdown&&sbOut.sendUb('Countdown has 1 minute left',''), void cb.setTimeout(this.doCountdownCB.bind(this),6e4)))},setCountdown:function(e,s,t){var n,i;return this.nCountdown&&!t?void sbOut.sendBold('Countdown timer is already running',s):this.bCancel?void sbOut.sendBold('Wait until the timer has stopped (up to 1 minute)',s):(n=parseInt(e),isNaN(n)||1>n||n>180?void sbOut.sendBold('Not a valid number of minutes',s):(this.nCountdown+=n,i=n+' minute'+(n>1?'s':''),this.nCountdown>n?i=s+' has added '+i+' to the countdown':(i=s+' has set a countdown timer for '+i,cb.setTimeout(this.doCountdownCB.bind(this),6e4)),void sbOut.sendUb(i,'')))},clearCountdown:function(e){this.nCountdown<1?sbOut.sendBold('Countdown timer is not running',e):(this.bCancel=!0,this.nCountdown=0,sbOut.sendUb(e+' has asked the countdown timer to stop',''))},showCountdown:function(e,s){ this.nCountdown<1?sbOut.sendBold('Countdown timer is not running',e):sbOut.sendUb('Countdown has less than '+this.nCountdown+' minute'+(this.nCountdown>1?'s':'')+' left',s?'':e)}},sbSilence={oList:[],nSilenceLevel:0,nGraphicLevel:1,sRecent:[],nRecent:0,setLevel:function(e,s,t,n){var i,o=n>=4?4:1;return s.length?(i=parseInt(s),void((e?this.nSilenceLevel:this.nGraphicLevel)<=o&&i>=0&&o>=i?(e?this.nSilenceLevel=i:this.nGraphicLevel=i,sbOut.sendUb('The '+(e?'silence':'graphic')+' level has been set to '+s+': Greys '+(i?'OFF':'ON'),'')):sbOut.sendUb('You are not allowed to set that level',t))):void(e?sbOut.sendUb('The silence level is currently '+this.nSilenceLevel+': Greys '+(this.nSilenceLevel?'OFF':'ON'),t):sbOut.sendUb('The graphic level is currently '+this.nGraphicLevel+': Greys '+(this.nGraphicLevel?'OFF':'ON'),t)); },findUser:function(e){var s;for(s=0;s<this.oList.length;s+=1)if(this.oList[s].sUser===e)return s;return-1},isSilenced:function(e){var s;return s=this.findUser(e),s>-1&&!this.oList[s].bGrOnly&&!this.oList[s].nTime?!0:!1},checkList:function(e){var s;return s=this.findUser(e),s>-1?this.oList[s].nTime&&Date.now()>this.oList[s].nTime?(this.oList.splice(s,1),{sil:!1,gr:0}):this.oList[s].bGrOnly?{sil:!1,gr:this.oList[s].bNinja?3:2}:(this.oList[s].bNinja||sbOut.sendUb('Your message wasn\'t sent because you are '+(this.oList[s].nTime?'temporarily silenced':'silenced'),e),{sil:!0,gr:0}):{sil:!1,gr:0}},showList:function(e){var s,t='';if(this.oList.length){for(sbOut.sendUb('Silence List:',e),s=0;s<this.oList.length;s+=1)t+=(s?'\n':'')+this.oList[s].sUser+(this.oList[s].bGrOnly?' (Graphics Only)':'')+(this.oList[s].bNinja?' (Ninja)':'')+(this.oList[s].nTime?' (Timeout)':'')+' by '+this.oList[s].sMod; cb.sendNotice(t,e)}else sbOut.sendUb('Silence List is empty',e)},unUser:function(e,s){var t;e&&(t=this.matchList(e),t>-1?(this.oList[t].bNinja||sbOut.sendUb('You have been unsilenced. Please be nice.',this.oList[t].sUser),sbOut.sendModelMod(this.oList[t].sUser+' has been unsilenced by '+s),this.oList.splice(t,1),this.addRecent(s)):cb.sendNotice(e+' does not need to be unsilenced',s))},silUser:function(e){var s,t='';return e.sUser?e.sUser===cb.room_slug?void sbOut.sendUb('You can\'t do that',e.sMod):(e.sUser=this.matchRecent(e.sUser),s=this.findUser(e.sUser),s>-1&&!this.oList[s].nTimeout&&!this.oList[s].bGrOnly?void cb.sendNotice(e.sUser+' is already silenced',e.sMod):('undefined'==typeof e.bGrOnly&&(e.bGrOnly=!1),'undefined'==typeof e.bNinja&&(e.bNinja=!1),'undefined'==typeof e.nTime&&(e.nTime=0), s>-1?(this.oList[s].bGrOnly=e.bGrOnly,this.oList[s].bNinja=e.bNinja,this.oList[s].nTime=e.nTime):this.oList.push(e),e.bNinja||(e.nTime?sbOut.sendUb('You have been given a timeout. You will not be able to '+(e.bGrOnly?'use graphics':'chat')+' for a few minutes.',e.sUser):sbOut.sendUb('You have been '+(e.bGrOnly?'blocked from using graphics':'silenced'),e.sUser)),e.bGrOnly&&(t+='graphic '),e.bNinja&&(t+='ninja '),t+=e.nTime?'timeout ':'bot ',sbOut.sendModelMod(e.sUser+' has been '+t+'silenced by '+e.sMod),void this.addRecent(e.sMod))):void this.showList(e.sMod)},warnUser:function(e,s,t){var n,i,o,a;if(e){if(o=e.indexOf(' '),o>-1?(n=e.substr(0,o),i=e.substring(o+1)):(n=e,i=''),n=this.matchRecent(n),this.isSilenced(n))return void cb.sendNotice(n+' is already silenced',s);if(i&&i.search(/(?:^|\s):\w/)>-1)return void cb.sendNotice('Graphics aren\'t allowed in warnings',s); if(a='\u2622 '+n+', ',t){if(!i)return void cb.sendNotice('Quote warnings need a reason',s)}else i&&(i=' for '+i),a+='please show respect & follow the rules or you will be silenced';a+=i,cb.sendNotice(a,n,'','#dc0000','bold'),sbOut.sendModelMod(n+' has been warned by '+s+(t?': ':'')+i),this.addRecent(s)}},addRecent:function(e){this.sRecent.indexOf(e)<0&&(this.sRecent[this.nRecent]=e,this.nRecent+=1,this.nRecent>11&&(this.nRecent=0))},matchRecent:function(e){var s,t,n=0;for(s=0;s<this.sRecent.length;s+=1){if(e===this.sRecent[s])return e;0===this.sRecent[s].indexOf(e)&&(t=s,n+=1)}return 1===n?this.sRecent[t]:e},matchList:function(e){var s,t=-1;for(s=0;s<this.oList.length;s+=1)if(0===this.oList[s].sUser.indexOf(e)){if(this.oList[s].sUser.length===e.length)return s;if(!(0>t))return-1;t=s}return t; }};cb.onMessage(function(e){var s,t,n=!1,i=0,o='',a=0;return sbAdmin.isAdmin(e.user)?i=4:e.is_mod?i=3:e.in_fanclub||sbVip.isVip(e.user)?i=2:e.has_tokens&&(i=1),i<sbSilence.nGraphicLevel&&(a=1),e['X-Spam']&&4>i&&(n=!0),!n&&i<sbSilence.nSilenceLevel&&(n=!0,sbOut.sendUb('Your user level is not currently allowed to chat',e.user)),!n&&3>i&&(t=sbSilence.checkList(e.user),n=t.sil,a||(a=t.gr)),!n&&a&&e.m.search(/(?:^|\s):\w/)>-1&&(n=!0,1===a?sbOut.sendUb('Your user level is not currently allowed to use graphics',e.user):3!==a&&sbOut.sendUb('You are not currently allowed to use graphics',e.user)),n||'/'===e.m.charAt(0)&&(n=parseCommand(e.m,e.user,i)),n||sbSilence.addRecent(e.user),n?e['X-Spam']=!0:'/'!==e.m.charAt(0)&&'!'!==e.m.charAt(0)&&(o=bVipLogo&&(e.in_fanclub||sbVip.isVip(e.user))?e.user===sbTip.sKing?':crownheart ':':heart2 ':e.user===sbTip.sKing?':smallCrown ':'', bTipTitles&&(s=sbTip.userTotal(e.user),s>0&&(o=o+'|'+s+'| ')),e.m=o+e.m),e}),cb.onTip(function(e){var s,t=parseInt(e.amount);sbTip.addTip(e.from_user,t),sbVip.checkTip(e.from_user,t),t>=3e3?sbOut.sendUb(':fireworks3k\nThank you, '+e.from_user+'!',''):t>=1e3&&sbOut.sendUb(':fireworks1k\nThank you, '+e.from_user+'!',''),cb.settings.sTipMessage&&t>=sbTip.nMsgMin&&sbOut.sendUb(cb.settings.sTipMessage,''),(bTipTitles||bLeaderboard)&&(s=sbTip.addUser(e.from_user,t),bTipTitles&&(e.from_user===sbTip.sKing?sbTip.nKing=s:s>sbTip.nKing&&s>=sbTip.nKingMin&&(sbTip.sKing=e.from_user,sbTip.nKing=s,sbOut.sendBold(':smallCrown We have a new '+('f'===e.from_user_gender?'Queen':'King')+'! All hail '+e.from_user+'! :smallCrown',''))))}),cb.onEnter(function(e){cb.settings.sEntryMessage&&sbOut.sendUb(cb.settings.sEntryMessage,e.user), (e.is_mod||sbAdmin.isAdmin(e.user))&&sbOut.sendSplash(e.user,!0)}); init();
© Copyright Chaturbate 2011- 2026. All Rights Reserved.