Bots Home
|
Create an App
Notices & No Greys
Author:
thats0brandon
Description
Source Code
Launch Bot
Current Users
Created by:
Thats0brandon
/******************************************************* * Title: CrazyNote Bot * * Author: 'acrazyguy' and 'phatkatmeow'. * Thumbsup: Concept and inspiration: 'birdylovesit'. * * Version: 1.0 (March 2014) * Build: .004 *******************************************************/ /** * As seen on TV: CrazyTicket, CrazyNote, CrazyGoal, CrazyLotto **/ /********** Constants **********/ const appName = "'CrazyNote'"; // Script name const appType = 'Bot'; // Script type: bot|app const SCRIPT_VERSION = '1.0'; // Internal: Script version number const SCRIPT_BUILD = '.004'; // Internal: Script build number const DEVELOPER_ONE = 'acrazyguy'; // main developer const DEVELOPER_TWO = 'phatkatmeow'; // main developer const COLOR_NOTICE = '#6900CC'; // Chat notice colour - Purple const COLOR_HIGHLIGHT = '#EEE5FF'; const COLOR_SYNTAX = '#995B00'; // Usage notice colour - Brownish const COLOR_AMBER = '#E56B00'; // Amber const COLOR_MODCAST = '#D80A00'; // Text colour for the '/bc' '/tm' commands - Red const COLOR_HILITE = '#FFFFBF'; // Background colour for the '/bc' and '/tm' // commands - Yellow const COLOR_HELP = '#144D8C'; // Text colour for help - Blue-grey const COLOR_INFO = '#144D8C'; // neutral notice - Blue-grey const ONLY_MODERATORS = "* Command is only available to moderators."; const broadcaster = cb.room_slug; const commandPrefix = '/'; const COMMAND_CN = 'cn'; // Send general notice to the public const COMMAND_BC = 'bc'; // Send private notice to the broadcaster (mods only) const COMMAND_TM = 'tm'; // Send private notice to mods as a group const COMMAND_CNHELP = 'cnhelp'; // Send command list to mod/broadcaster const COMMAND_TPRICE = 'tprice'; const COMMAND_ADD = 'add'; // Add one or more viewers to ticket list const COMMAND_ADDUSER = 'adduser'; // Add user(s) alias const COMMAND_AU = 'au'; // Add user(s) alias const COMMAND_ADDLIST = 'addlist'; // Add user(s) alias const COMMAND_DEL = 'del'; // Delete a user const COMMAND_DELUSER = 'deluser'; // Del user alias const COMMAND_REMOVE = 'remove'; // Del user alias const COMMAND_REVOKE = 'revoke'; // Del user alias const COMMAND_TLIST = 'tlist'; // Lists users who paid for a ticket const dashLine = "------------------------------------------------------"; /********** Variables **********/ var userList = new Array(); var ticketList = {}; // Temp for raffle only var ticketsSold = 0; var ticketPrice = 0; var priceFlag = false; /************* API *************/ cb.onTip(function(tip) { var tUser = tip['from_user']; var tipAmount = parseInt(tip['amount']); if (tipAmount >= ticketPrice && priceFlag) { if (!cbjs.arrayContains(userList,tUser)) { user('add',tUser,false); } } }); cb.onMessage(function (msg) { var regexCommandSplit = '^' + commandPrefix + '(\\S+)(?:\\b\\s*)(.*)?'; var regexListSplit = /[,\s]+/; var reCmdSplit = new RegExp(regexCommandSplit); var cmdSplit = msg['m'].match(reCmdSplit); var cmd; var cmdval; var cmdValArray; if ( cmdSplit ) { cmd = cmdSplit[1]; cmdval = cmdSplit[2]; if ( cmdval != null ) { cmdval = cmdval.replace(/^\s+|\s+$/g,''); } if ( cmdval != null ) { cmdValArray = cmdval.split(regexListSplit); } else { cmdValArray = ''; } } // for convenience var m = msg['m']; var u = msg['user']; var isMod = msg['is_mod']; switch (cmd) { /***** Public Notice *****/ case COMMAND_CN: if (isMod || u == broadcaster) { if (cmdval) { cb.sendNotice('* ' + cmdval,'','',COLOR_NOTICE,'bold'); } else { cb.sendNotice('* Syntax: /cn <message>',u,'',COLOR_SYNTAX,'bold'); } } else { cb.sendNotice(ONLY_MODERATORS,u,'',COLOR_NOTICE,'bold'); } msg['X-Spam'] = true; // Suppress command break; /***** Message to Broadcaster *****/ case COMMAND_BC: if (isMod) { if (cmdval) { cb.sendNotice("* "+ u.toUpperCase() + ": " + cmdval,broadcaster,COLOR_HILITE,COLOR_MODCAST,'bold'); cb.sendNotice("* "+ u.toUpperCase() + ": " + cmdval,u,COLOR_HILITE,COLOR_MODCAST,'bold'); } else { cb.sendNotice("* Syntax: /bc <message>",u,'',COLOR_SYNTAX,'bold'); } } else { cb.sendNotice(ONLY_MODERATORS,u,'',COLOR_NOTICE,'bold'); } msg['X-Spam'] = true; // Suppress command break; /***** Message to Mods *****/ case COMMAND_TM: if (isMod || u === broadcaster) { if (cmdval) { cb.sendNotice("* "+ u.toUpperCase() + ": " + cmdval,'',COLOR_HILITE,COLOR_MODCAST,'bold','red'); } else { cb.sendNotice("* Syntax: /tm <message>",u,'',COLOR_SYNTAX,'bold'); } } else { cb.sendNotice(ONLY_MODERATORS,u,'',COLOR_NOTICE,'bold'); } msg['X-Spam'] = true; // Suppress command break; /***** Ticket Price *****/ case COMMAND_TPRICE: if (isMod || u == broadcaster) { if(cmdval) { if (parseInt(cmdval)) { ticketPrice = cmdval; cb.sendNotice("* Ticket price set at " + cmdval + " tokens.",u,'',COLOR_NOTICE,'bold'); priceFlag = true; } else { cb.sendNotice("* '" + cmdval + "' not a valid argument.",u,'',COLOR_NOTICE,'bold'); } } else { cb.sendNotice("* Syntax: " + commandPrefix + COMMAND_TPRICE + " <price>",u,'',COLOR_SYNTAX,'bold'); } } else { cb.sendNotice(ONLY_MODERATORS,u,'',COLOR_NOTICE,'bold'); } msg['X-Spam'] = true; break; /***** Help *****/ case COMMAND_CNHELP: if (isMod || u === broadcaster) { cb.sendNotice(getCommandList(),u,'',COLOR_HELP,'bold'); } else { cb.sendNotice(ONLY_MODERATORS,u,'',COLOR_NOTICE,'bold'); } msg['X-Spam'] = true; // Suppress command break; /***** Add user(s) *****/ case COMMAND_AU: case COMMAND_ADD: case COMMAND_ADDUSER: case COMMAND_ADDLIST: if (isMod || u == broadcaster) { if (cmdval) { if (cmdValArray.length > 1) { for (var i=0; i<cmdValArray.length; i++) { if ( !user('check',cmdValArray[i]) ) { user('add',cmdValArray[i],false); } } // end for } else { user('add',cmdval,false); } // end if cmdValArray.length } else { if ( !user('check',msg['user']) ) { user('add',msg['user'],false); } } // end if cmdval } msg['X-Spam'] = true; break; /***** Delete user *****/ case COMMAND_DEL: case COMMAND_DELUSER: case COMMAND_REMOVE: case COMMAND_REVOKE: if (isMod || u === broadcaster) { if (cmdval) { if (user('check',cmdval)) { user('del',cmdval); } } } msg['X-Spam'] = true; break; /***** Show ticket list *****/ case COMMAND_TLIST: cb.sendNotice("\nTicket holders: " + userList.length + "\n\n" + (userList.length < 1 == true ? "No tickets sold!" : cbjs.arrayJoin(userList,", ")) + "\n",u,'',COLOR_NOTICE,'bold'); msg['X-Spam'] = true; break; } // switch }); // onMessage() cb.onEnter(function(viewer) { if (viewer['is_mod']) { cb.sendNotice("\nBroadcaster '" + broadcaster.toUpperCase()+ "' is running CrazyNote.\n\nType /cnhelp for a list of available commands.\n",viewer['user'],'',COLOR_NOTICE,'bold'); } }); /********** Functions **********/ function getCommandList() { var cmdlist = "\n----- CRAZYNOTE COMMANDS -----\n\n"; cmdlist += commandPrefix+COMMAND_CN + " <message> - Sends a one time public notice\n\n"; cmdlist += commandPrefix+COMMAND_BC + " <message> - Sends a private message to the broadcaster\n\n"; cmdlist += commandPrefix+COMMAND_TM + " <message> - Sends a private message to the moderators as a group\n\n"; cmdlist += commandPrefix+COMMAND_TLIST + " - Sends a list of ticket holders to the chat\n\n"; cmdlist += commandPrefix+COMMAND_TPRICE + " <price> - Tells CrazyNote the ticket price that CrazyTicket will be using\n"; return cmdlist; } function user(command,user,sendpass) { if ((command == 'add') && (!cbjs.arrayContains(userList,user))) { userList.push(user); } // end if add if ((command == 'del') && (cbjs.arrayContains(userList,user))) { cbjs.arrayRemove(userList,user); } // end if del if (command == 'check') { if (cbjs.arrayContains(userList,user)) { return true; } else { return false; } } // end if check } // end function user function printObject(o) { var out=""; for (var p in o) { out += "* "+p+": "+o[p]+"\n"; } return out; } function init() { user('add',broadcaster,false); var startNote = dashLine+"\n* "+appName+" Version: "+SCRIPT_VERSION+SCRIPT_BUILD+" has started.\n"; startNote += "* Type /cnhelp for a list of available commands.\n"+dashLine; cb.sendNotice(startNote,broadcaster,'',COLOR_INFO,'bold'); cb.sendNotice("\n *Broadcaster '" + broadcaster + "' is running "+appName+".\n\nType /cnhelp for a list of available commands.\n",'','',COLOR_NOTICE,'bold','red'); } /*** Ok, let's kick this off ***/ init(); /** ..gspp.. .d$$S$$S$$Sb. dS$$S$$S$PS$$Sb :$$S$S^^'";TSS$$; ; SSP' : T$$SS/; $$ \ `^^'/ :$ `-ggd: :.=-. .-=.:SSS ; <@>` <@> $$$$ : SS$$ ' -. $$S; ' .--. s$$S _ `. `--' .$$S$; .-"" "-._.-'`.__.' $$$S; : :S$$S ; :l "-. '^S$$b /`-. ;: " .--""""""^-. :"-. "" : /) ; ;`- : /: : :`- `. \ / '-.t `+.__ `. ;/ .-' -.; ; "-. "-. : .-" --: ; ;. "^:" .-""-.`.; : -^"`. "-.+' \/ ; `. "- ; : .^. / \ .-" "-. .' `._.-" "-._.-": ; : ; : : : ; \ ; ; : ; ; : ; : : / ; : \ ; ; : : ; ; : : : ; ; ; ; c : : : : ; /""--..__ ; : : ""--..__ ; ; "-. --..__ ""--..__: :`-._ "-._ "" _; ; "-._ """---...---""" : **/ var f=function(){var p,w,r,x;function e(a){var d=e;if(a&&"string"===typeof a){d.hasOwnProperty("log")||(d.log=[]);var g=/(..)(:..)(:..)/.exec(new Date),s=g[1]%12||12;d.log.push((10>s?"0"+s:s)+g[2]+g[3]+" "+(12>g[1]?"A":"P")+"M : "+a);25<d.log.length&&d.log.shift();a=("No Grey Graphics: "+a).replace(/\+/g,"\uff0b").replace(/&/g,encodeURIComponent("&"))}d.hasOwnProperty("log")||cb.log(a.replace(/(\r\n|\n|\r|\\n)/gm," ").trim())}function z(a){var d=Array.prototype.slice.call(arguments),g,e=0,h;a&&"string"=== typeof a&&("Enable"===cb.settings.multi_line_safe&&(g=a.split(/ *\n */),e=g.length,a=g[0]),d[0]=("No Grey Graphics: "+a.replace(/\+/g,"\uff0b")).replace(/&/g,encodeURIComponent("&")));cb.chatNotice.apply(cb,d);for(h=1;h<e;h++)d[0]=g[h].replace(/\+/g,"\uff0b").replace(/&/g,encodeURIComponent("&")),cb.chatNotice.apply(cb,d)}function y(a,d){var e=Array.prototype.slice.call(arguments);d&&"string"===typeof d&&d.length&&(e[0]=""+a,z.apply(A,e))}function B(a){return a}function G(a,d,e){return e.indexOf(a)=== d}var h={f:"None",d:"Standard",b:"Standard+Custom",e:"All"},t="angel blush bounce bow confused cool crazy cry curse drool gangsta hearts hello help huh innocent kissy lmao mellow ohmy oo rofl roll smile smoke thumbdown thumbsup thumbup upset what wink woot yawn yes".split(" "),l=["ktb_crown","ttlb_bronze","ttlb_gold","ttlb_silver"];p=[/[^\u0000-\u0080\u00ad\u2654\u2655\u265a\u265b]/];w=[];r="dlnws chnskv cht4fr wgwgwg bst4cms lv4prty lvtrffn nd4strp prfllsn bnjknntt nsxyjngs pssy4shw vcmsssns wlchstdt 100kstnls chnnmnwhr cmsssnscm grls4prty rgclsngsn sndtdrtch tmrqrllh1 tpgmscrck glsmtrprtl mnhndynmmr schnmnprfl schtglbntr snddrtchlv knntjmlgckn lslsnndmldn stdchlngwlg wtchmcmgrls chbnnjngsgls dtschmtrprtl fndfrtknshck hrgldtschkrl pyplrwstrnnn schfdsmwgdch wsnddglnpmml wstrnnnrpypl jckjxshrngnds kstnlsndhnrsk llrdngsnchthr mncmstjtztchn wndmrmnfrrlds dknnmnglbwchsn mprdndstrngtrk n1gnhmpgstfrtg stdnglchnnmnwhr wnnjrktwthmfrfr dsthtdstwchmmrsnd hbknfnnzllnntrssn nrnchbzckmtdntpps schfcktrffnndcmsx fdrstdnglchnnmnwhr llnfssthnmprflvnmr nynwnnjrktwthmfrfr vrllmsndfstnrdtsch glbdgbtsgrnchtmhrdr snddwskstnlsndglrst wsnddnnnndglndtschn chtrbtknnmndchvrgssn ftzstmgglndbrchtshrt mchvrdrcmllswshrwllt nynhrdrmstfckldrmlfs mchnchtlngwrtnndkmmzmr wrbckhtknnmchdjmlbschn kstnlsdtngprtlndtschlnd ntrssntbrmchfndstdnmnmprfl wnnjschtnmnprflndkntktrtmchdrt hbthrgntlchdhlfschlgschffthrvlldtn thsmnstrlysnfbtchsllngthmtfhsgrlfrnd dspmmrsndnfchzdmmvnjdmmdwrdnsgbnntndnsnstnflltdchknrfsnbldsnngwrbngrn".split(" "); x="dance69 exbf gay gay6 gayfuck2 gross kena wag".split(" ");var A=this,C=null,D,m=[],H,q=!0;return{a:h,h:function(a){function d(a){return a===h.f?"not use":"use "+a}function g(a){return a.replace(":",":\u00ad")}function s(){var a=k.replace(/[\W_]/g,"").toLowerCase(),d=a.replace(/[aeiou]/g,""),b,c,g=!1;b=0;for(c=r.length;!g&&b<c&&!(d.length<r[b].length);b++)!0===(g=-1!==d.indexOf(r[b]))&&e("SpamBlockerAd: simple match ("+b+"): "+r[b]);b=0;for(c=p.length;!g&&b<c;b++)!0===(g=p[b].test(k))&&e("SpamBlockerAd: text match ("+ b+"): "+p[b].source);b=0;for(c=w.length;!g&&b<c;b++)!0===(g=w[b].test(a))&&e("SpamBlockerAd: plain match ("+b+"): "+w[b].source);b=0;for(c=x.length;!g&&b<c;b++)!0===(g=RegExp("(?:^|\\s):"+x[b]+"(?=\\s|$)","").test(k))&&e("SpamBlockerAd: blacklist emoticons match ("+b+"): "+x[b]);g&&(y(["Message from the author:\n\u00a0\u00a0Thanks for using my "+(D?"app":"bot")+" :)\n\u00a0\u00a0By the way, visitor "+u+" has just spammed your chat!\n\u00a0\u00a0To stop them doing it again, launch my spam blocker, No\u00a0Grey\u00a0Spammers.\n\u00a0\u00a0See this "+ (D?"app":"bot")+"'s Description for a link ;)","End of Message"].join("\nNo Grey Graphics: "),cb.room_slug,"#f37e7e"),q=!1)}function z(){for(var c=/(?:^|\s):([\w\-][\w\-]+)(?=\s|$)/g,d,b=[];null!==(d=c.exec(k));)b.push(d[1]);if(b.length){b=b.filter(G);b=b.filter(function(a){return n===h.b?0>l.indexOf(a)&&0>t.indexOf(a)&&0>m.indexOf(a):n===h.d?0>l.indexOf(a)&&0>t.indexOf(a):0>l.indexOf(a)});e(JSON.stringify(b));c=0;for(d=b.length;c<d;c++)k=k.replace(RegExp(":"+b[c]+"(\\s|$)","g"),g);d&&y("Sorry, you don't have the broadcaster's permission to use the following emoticon"+ (1===d?"":"s")+" : "+b.sort().join(", "),u,"#d5ebf8");a.m=k}}function A(a){a.length&&0>l.indexOf(a)&&(l.push(a),e("OnMessage: whitelisted: "+a))}var B=(new Date).valueOf(),k=a.m,u=a.user,K="rubzombie"===u,E=u===cb.room_slug,I=a.in_fanclub,F=a.is_mod,J=a.hasOwnProperty("is_pm")&&a.is_pm,L=/\/(ngg|nogreygraphics|#[0-3])?(help|\?)(?:\s|\/|$)/ig,v,c,n=I?cb.settings.fans:F?cb.settings.mods:a.has_tokens?cb.settings.blus:cb.settings.grys;a["X-Spam"]&&e("processing x-spam msg");a.hasOwnProperty("ngg_whitelisted")&& "string"===typeof a.ngg_whitelisted&&a.ngg_whitelisted.replace(/[:\s]+/g," ").trim().split(" ").forEach(A);if(q)if(E||F){if(/\/(sh|sphammer|#[0-3])?(english|enonly|sphammered)/i.test(k)||/\/(sh|sphammer)(help|spam)/i.test(k))q=!1,e("SpamBlockerAd: SpHammer detected");/\/(ngs|nogreyspammers)(help|spam|\?)/i.test(k)&&(q=!1,e("SpamBlockerAd: No Grey Spammers detected"))}else/<<<( has been SPAM HAMMERED| spHammer hit#)/.test(k)&&"#595959"===a.background&&"#999999"===a.c&&(q=!1,e("SpamBlockerAd: SpHammer detected")); if(!a["X-Spam"]&&"/"===k.trim()[0])for(;null!==(v=L.exec(k));)if(c=(v[1]||"ngg").toLowerCase(),"ngg"===c||"nogreygraphics"===c||c===C)switch(c="",a["X-Spam"]=!0,v=v[2].toLowerCase(),v){case "?":case "help":K&&(c+="version: 1.26.30\nControl who uses emote graphics in chat...\nNo Grey Graphics: ");if(E)c+="Standard emoticons:\n\u00a0\u00a0"+t.sort().join(", ")+"\nNo Grey Graphics: Custom emoticons:\n\u00a0\u00a0"+(m.length?m.sort().join(", "):"(empty)")+"\nNo Grey Graphics: Current Permissions:\n\u00a0\u00a0Fans may "+ d(cb.settings.fans)+" emoticons,\n\u00a0\u00a0Moderators may "+d(cb.settings.mods)+" emoticons,\n\u00a0\u00a0Members with Tokens may "+d(cb.settings.blus)+" emoticons, and\n\u00a0\u00a0Everyone else may "+d(cb.settings.grys)+" emoticons.\nNo Grey Graphics: Apply Public Chat graphics restrictions to Private Messages:\n\u00a0\u00a0"+(a.hasOwnProperty("is_pm")?cb.settings.filter_private_messages:"(auto) Yes")+"\nNo Grey Graphics: In-chat commands:\n\u00a0\u00a0/?\n\u00a0\u00a0/help - show this message\nTo adjust settings and custom selection, deactivate & re-launch bot."; else{c+="Current ("+(I?"Fan":F?"Mod":a.has_tokens?"Blue":"Grey")+") Permission:\n\u00a0\u00a0You may "+d(n)+" emoticons.\nNo Grey Graphics: ";if(n===h.d||n===h.b)c+="Standard emoticons:\n\u00a0\u00a0"+t.sort().join(", ")+"\nNo Grey Graphics: ";n===h.b&&(c+="Custom emoticons:\n\u00a0\u00a0"+(m.length?m.sort().join(", "):"(none set by broadcaster)")+"\nNo Grey Graphics: ");c+="Apply Public Chat graphics restrictions to Private Messages:\n\u00a0\u00a0"+(a.hasOwnProperty("is_pm")?cb.settings.filter_private_messages: "(auto) Yes")+"\nNo Grey Graphics: ";c+="In-chat commands:\n\u00a0\u00a0/?\n\u00a0\u00a0/help - show this message"}y(c,u,"#f2f9fd")}E||a["X-Spam"]||(!J&&q&&s(),a["X-Spam"]||J&&!H||n===h.e||z());e("onMessage: "+((new Date).valueOf()-B)+"ms");return a},g:function(){function a(a,e){var h;for(h=0;h<e;h++)l.push((a+(h+1)).slice(1))}cb.settings.hasOwnProperty("slot")&&(C="#"+cb.settings.slot);D="#0"===C;e("standard_emoticons: "+JSON.stringify(t));cb.settings.custom=cb.settings.custom||"";m=cb.settings.custom.replace(/[\s:]/g, ",").split(",").filter(B).filter(G);e("custom_emoticons: "+(m.length?JSON.stringify(m):"(none)"));a(":avatar_female_",10);a(":avatar_male_",10);a(":avatar_halloween_",10);a(":avatar_hero_",10);a(":avatar_alien_",9);a(":avatar_mask_",4);l.push("smallCrown");e("whitelist_emoticons: "+JSON.stringify(l));e("filter_private_messages: "+cb.settings.filter_private_messages);(H="Yes"===cb.settings.filter_private_messages)||y("Please note:\n\u00a0\u00a0Option 'Apply Public Chat settings to Private Messages: No'\n\u00a0\u00a0requires a Chaturbate feature that may not be available, yet :(\n\u00a0\u00a0Please see the bot Description for more details.\nNo Grey Graphics: End of Note", cb.room_slug,"#f3be5e")}}}(); cb.settings_choices=[{choice1:f.a.e,choice2:f.a.b,choice3:f.a.d,choice4:f.a.f,defaultValue:f.a.e,label:"Fan Club Members may use",name:"fans",required:!0,type:"choice"},{choice1:f.a.e,choice2:f.a.b,choice3:f.a.d,choice4:f.a.f,defaultValue:f.a.b,label:"Moderators may use",name:"mods",required:!0,type:"choice"},{choice1:f.a.e,choice2:f.a.b,choice3:f.a.d,choice4:f.a.f,defaultValue:f.a.d,label:"Members with Tokens may use",name:"blus",required:!0,type:"choice"},{choice1:f.a.e,choice2:f.a.b,choice3:f.a.d, choice4:f.a.f,defaultValue:f.a.f,label:"Everyone Else (mostly Greys) may use",name:"grys",required:!0,type:"choice"},{label:"Custom Emoticon selection (e.g. buytokens, follo, followme, nd, no4, nocaps, readbio, sendtip, tip, tips, tipbeg, tipher3, tytippers, wowtip)",name:"custom",required:!1,type:"str"},{choice1:"Yes",choice2:"No",defaultValue:"Yes",label:"Apply Public Chat settings to Private Messages (future feature)",name:"filter_private_messages",required:!1,type:"choice"},{choice1:"Enable", choice2:"Disable",defaultValue:"Disable",label:"(Multi-line Safe Mode)",name:"multi_line_safe",type:"choice"}];cb.onMessage(function(p){return f.h(p)});f.g();
© Copyright Chaturbate 2011- 2026. All Rights Reserved.