Bots Home
|
Create an App
glbugbot
Author:
goldenlord
Description
Source Code
Launch Bot
Current Users
Created by:
Goldenlord
/* Title: JuneBug Bot Author: geemcgee Based of and heavily modified "No Grey Demands,Graphics,Stickykeys,Caps bot" (Author: badbadbubba) This bot allows to customize what to mute and its automated response */ var MAX_ELEMENTS = 10; var greyFilterList = []; var greyFilterCombList = []; var specialList = []; var tempSpamList = []; var tempSpamUsernameList = []; // var dlyNotice = []; var dlyNoticeList = []; var notificationColor1 = "#970f2c"; var notificationColor2 = "#970f2c"; var storeMsg = []; var whiteList = []; var blackList = []; var ignoreList = []; var club1 = []; var club2 = []; var sp = []; var users = []; var lastMutedUser = ""; var bluser = ""; var bl = false; var repMuList = []; var silenceGreys = false; var silentGlobalSilence = false; var allow = "_"; var isGreyControl = true; var isBlacklistOn = true; var tippingUsers = []; var tipTracker = false; var crownImg = ""; var highestTipper = "-"; var honoraryUsers = []; var honoraryCrownImg = ""; var allTimeHighestTipper = ""; var allTimeHighestTipperCrown = ""; var fanclubCrown = ""; var patrons = []; var directors = []; //notifications var useNotifier = false; var notificationTimer = 0; var notifications = []; var notificationIndex = 0; //raffle var raffleTracker = false; var raffleNumbers = []; var raffleTippers = []; //timer var timerSteps = 0; var isFilteringEmojis = false; var emojiLines = []; var ems = ["0x1F355", "0x1F353", "0x1F338", "0x1F380"] // pizza strawberry flower ribbon regexps = [ {regexp: /:\b/, notice: 'graphics', index: 1}, {regexp: /(?!\.|w|h|s|o|\?|!{3,}|\d)(.)\1{2}/, notice: 'sticky keys', index: 2}, {regexp: /((?=.*pm))/i, notice: 'PM requests', index: 3}, {regexp: /((?=.*private)|(?=.*pvt)|(?=.*prvt))/i, notice: 'Private requests', index: 4}, {regexp: /((?=.*recordingwebcam)|(?=.*Open my room! and)|(?=.*Chaturbate private shows record)|(?=.*Open my cam! I wanna)|(?=.*She was recorded)|(?=.*check my bio)|(?=.*Click on my)|(?=.*tap my bio)|(?=.*Open my cam and find))/i, notice: 'Spam', index: 5}, ] cb.settings_choices = [ {name: 'comb0', label: '(1) Mute any word combination of', type: 'str', minLength: 0, maxLength: 1000, required: false, defaultValue: 'open,show,lick,suck,zoom,finger,spread'}, {name: 'comb1', label: 'and', type: 'str', minLength: 0, maxLength: 1000, required: false, defaultValue: 'boobs,bobs,tits,ass,asshole,pussy,cunt,vag,vagina'}, {name: 'combmu0', label: '(1) Message to user', type: 'str', minLength: 0, maxLength: 1000, required: false, defaultValue: 'No demands from greys!'}, {name: 'combhide0', type: 'choice', choice1: 'everyone', choice2: 'chat only', choice3: 'no', defaultValue: 'chat only', label: "(1) Hide from chat?"}, {name: 'combmc0', type: 'choice', choice1: 'yes', choice2: 'no', defaultValue: 'no', label: "(1) Part of automatic muting system?"}, {name: 're0', label: '(2) Mute (words and sentences work)', type: 'str', minLength: 0, maxLength: 1000, required: false, defaultValue: 'bb,baby,babe'}, {name: 'mu0', label: '(2) Message to user', type: 'str', minLength: 0, maxLength: 1000, required: false, defaultValue: 'Can\'t spell her name.'}, {name: 'hide0', type: 'choice', choice1: 'everyone', choice2: 'chat only', choice3: 'no', defaultValue: 'everyone', label: "(2) Hide from chat?"}, {name: 'strict0', type: 'choice', choice1: 'normal', choice2: 'very', defaultValue: 'normal', label: "(2) Strictness (Very strict means spaces, periods etc. will be ignored. False positives on very short words, so only use very strict if really needed.)"}, {name: 'mc0', type: 'choice', choice1: 'yes', choice2: 'no', defaultValue: 'no', label: "(2) Part of automatic muting system?"}, {name: 're1', label: '(3) Mute', type: 'str', minLength: 0, maxLength: 1000, required: false}, {name: 'mu1', label: '(3) Message to user', type: 'str', minLength: 0, maxLength: 1000, required: false}, {name: 'hide1', type: 'choice', choice1: 'everyone', choice2: 'chat only', choice3: 'no', defaultValue: 'everyone', label: "(3) Hide from chat?"}, {name: 'strict1', type: 'choice', choice1: 'normal', choice2: 'very', defaultValue: 'normal', label: "(3) Strictness"}, {name: 'mc1', type: 'choice', choice1: 'yes', choice2: 'no', defaultValue: 'no', label: "(3) Part of automatic muting system?"}, {name: 're2', label: '(4) Mute', type: 'str', minLength: 0, maxLength: 1000, required: false}, {name: 'mu2', label: '(4) Message to user', type: 'str', minLength: 0, maxLength: 1000, required: false}, {name: 'hide2', type: 'choice', choice1: 'everyone', choice2: 'chat only', choice3: 'no', defaultValue: 'everyone', label: "(4) Hide from chat?"}, {name: 'strict2', type: 'choice', choice1: 'normal', choice2: 'very', defaultValue: 'normal', label: "(4) Strictness"}, {name: 'mc2', type: 'choice', choice1: 'yes', choice2: 'no', defaultValue: 'no', label: "(4) Part of automatic muting system?"}, {name: 're3', label: '(5) Mute', type: 'str', minLength: 0, maxLength: 1000, required: false}, {name: 'mu3', label: '(5) Message to user', type: 'str', minLength: 0, maxLength: 1000, required: false}, {name: 'hide3', type: 'choice', choice1: 'everyone', choice2: 'chat only', choice3: 'no', defaultValue: 'everyone', label: "(5) Hide from chat?"}, {name: 'strict3', type: 'choice', choice1: 'normal', choice2: 'very', defaultValue: 'normal', label: "(5) Strictness"}, {name: 'mc3', type: 'choice', choice1: 'yes', choice2: 'no', defaultValue: 'no', label: "(5) Part of automatic muting system?"}, {name: 're4', label: '(6) Mute', type: 'str', minLength: 0, maxLength: 1000, required: false}, {name: 'mu4', label: '(6) Message to user', type: 'str', minLength: 0, maxLength: 1000, required: false}, {name: 'hide4', type: 'choice', choice1: 'everyone', choice2: 'chat only', choice3: 'no', defaultValue: 'everyone', label: "(6) Hide from chat?"}, {name: 'strict4', type: 'choice', choice1: 'normal', choice2: 'very', defaultValue: 'normal', label: "(6) Strictness"}, {name: 'mc4', type: 'choice', choice1: 'yes', choice2: 'no', defaultValue: 'no', label: "(6) Part of automatic muting system?"}, {name: 're5', label: '(7) Mute', type: 'str', minLength: 0, maxLength: 1000, required: false}, {name: 'mu5', label: '(7) Message to user', type: 'str', minLength: 0, maxLength: 1000, required: false}, {name: 'hide5', type: 'choice', choice1: 'everyone', choice2: 'chat only', choice3: 'no', defaultValue: 'everyone', label: "(7) Hide from chat?"}, {name: 'strict5', type: 'choice', choice1: 'normal', choice2: 'very', defaultValue: 'normal', label: "(7) Strictness"}, {name: 'mc5', type: 'choice', choice1: 'yes', choice2: 'no', defaultValue: 'no', label: "(7) Part of automatic muting system?"}, {name: 'al1', label: '(1) Allow', type: 'str', minLength: 0, maxLength: 1000, required: false}, {name: 'sp8', label: 'Special strictness Mute', type: 'str', minLength: 0, maxLength: 1000, required: false}, {name: 'smu8', label: 'Message to user', type: 'str', minLength: 0, maxLength: 1000, required: false}, {name: 'hide8', type: 'choice', choice1: 'everyone', choice2: 'chat only', choice3: 'no', defaultValue: 'chat only', label: "(8) Hide from chat?"}, {name: 'sp9', label: 'Primitive Mute (needs to match their whole message)', type: 'str', minLength: 0, maxLength: 1000, required: false}, {name: 'smu9', label: 'Message to user', type: 'str', minLength: 0, maxLength: 1000, required: false}, {name: 'hide9', type: 'choice', choice1: 'everyone', choice2: 'chat only', choice3: 'no', defaultValue: 'chat only', label: "(9) Hide from chat?"}, {name: 'spmc9', type: 'choice', choice1: 'yes', choice2: 'no', defaultValue: 'no', label: "Part of automatic muting system?"}, // {name: 'privateMuteMessage', type: 'choice', choice1: 'private', choice2: 'public', defaultValue: 'private', label: "Private or public mute message. Overrides single hide settings"}, {name: 'repWord', label: 'Replace these word(s)', type: 'str', minLength: 0, maxLength: 1000, required: false}, {name: 'repWordMu', label: '... with one of these', type: 'str', minLength: 0, maxLength: 1000, required: false}, {name: 'mutestickykeys', type: 'choice', choice1: 'yes', choice2: 'no', defaultValue: 'yes', label: "Mute sticky keys?"}, {name: 'muSticky', label: 'Message to user', type: 'str', minLength: 0, maxLength: 1000, required: false}, {name: 'hideSticky', type: 'choice', choice1: 'everyone', choice2: 'chat only', choice3: 'no', defaultValue: 'chat only', label: "Hide from chat?"}, {name: 'muteNumber', label: 'Mute user after x amount of mutings', type: 'str', defaultValue: '2', minLength: 0, maxLength: 1000, required: false}, {name: 'publicMute', type: 'choice', choice1: 'yes', choice2: 'no', defaultValue: 'yes', label: "Let room know that the user got muted."}, {name: 'pmNotice', type: 'choice', choice1: 'yes', choice2: 'no', defaultValue: 'yes', label: "Send \"PM\" Notice?"}, {name: 'pmNoticeType', type: 'choice', choice1: 'private', choice2: 'public', defaultValue: 'private', label: "PM notice"}, {name: 'pmNoticeMessage', label: 'Message to user', type: 'str', minLength: 0, maxLength: 1000, required: false}, {name: 'privateNotice', type: 'choice', choice1: 'yes', choice2: 'no', defaultValue: 'yes', label: "Send \"Private\" Notice?"}, {name: 'privateNoticeType', type: 'choice', choice1: 'private', choice2: 'public', defaultValue: 'private', label: "Private notice"}, {name: 'privateNoticeMessage', label: 'Message to user', type: 'str', minLength: 0, maxLength: 1000, required: false}, {name: 'whiteList', label: 'Whitelist (allow these greys to speak. Separate by "," and no spaces!)', type: 'str', minLength: 0, maxLength: 1000, required: false}, {name: 'blackList', label: 'Blacklist (Prevents these any colored people from speaking. Separate by "," and no spaces!)', type: 'str', minLength: 0, maxLength: 1000, required: false}, // {name: 'useClub', type: 'choice', choice1: 'yes', choice2: 'no', defaultValue: 'no', label: "Use clubs?"}, // {name: 'club1', label: 'club1', type: 'str', minLength: 0, maxLength: 1000, required: false}, // {name: 'club2', label: 'club2', type: 'str', minLength: 0, maxLength: 1000, required: false}, // {name: 'club1Price', label: 'club1Price', type: 'str', minLength: 0, maxLength: 1000, required: false}, // {name: 'club2Price', label: 'club2Price', type: 'str', minLength: 0, maxLength: 1000, required: false}, {name: 'tipTracker', label: 'Keep track of how much each user tipped and display it next to their names.', type: 'choice', choice1: 'on', choice2: 'off', defaultValue: "off"}, {name: 'crownImg', label: 'Image to be displayed next to the highest tipper\'s name (aka. king). E.g. "crown03".', type: 'str', minLength: 0, maxLength: 1000, defaultValue: "crown03"}, {name: 'honoraryUsers', label: '(Honorary users) List of users deserving of a crown for past support.', type: 'str', minLength: 0, maxLength: 1000, defaultValue: "", required: false}, {name: 'honoraryCrownImg', label: '(Honorary crown) Image to be displayed next to the honorary users', type: 'str', minLength: 0, maxLength: 1000, defaultValue: "", required: false}, {name: 'allTimeHighestTipper', label: 'All time highest tipper.', type: 'str', minLength: 0, maxLength: 1000, defaultValue: "", required: false}, {name: 'allTimeHighestTipperCrown', label: 'Image to be displayed next to the all time highest tipper', type: 'str', minLength: 0, maxLength: 1000, defaultValue: "", required: false}, {name: 'fanclubCrown', label: 'Image to be displayed next to fan club members', type: 'str', minLength: 0, maxLength: 1000, defaultValue: "", required: false}, {name: 'patrons', label: 'List of Patrons.', type: 'str', minLength: 0, maxLength: 1000, defaultValue: "", required: false}, {name: 'patronsImg', label: 'Image to be displayed next to Patrons', type: 'str', minLength: 0, maxLength: 1000, defaultValue: "", required: false}, {name: 'directors', label: 'List of Director.', type: 'str', minLength: 0, maxLength: 1000, defaultValue: "", required: false}, {name: 'directorsImg', label: 'Image to be displayed next to Directors', type: 'str', minLength: 0, maxLength: 1000, defaultValue: "", required: false}, {name: 'allTimeHighestTipperOnEnterMsg', label: 'Notice to be displayed when the all time highest tipper enters the room', type: 'str', minLength: 0, maxLength: 1000, defaultValue: "", required: false}, {name: 'honoraryUserOnEnterMsg', label: 'Notice to be displayed when a honorary user enters the room', type: 'str', minLength: 0, maxLength: 1000, defaultValue: "", required: false}, {name: 'fanclubOnEnterMsg', label: 'Notice to be displayed when a fan club member enters the room', type: 'str', minLength: 0, maxLength: 1000, defaultValue: "", required: false}, {name: 'patronUserOnEnterMsg', label: 'Notice to be displayed when a Patron enters the room', type: 'str', minLength: 0, maxLength: 1000, defaultValue: "", required: false}, {name: 'directorUserOnEnterMsg', label: 'Notice to be displayed when a Director enters the room', type: 'str', minLength: 0, maxLength: 1000, defaultValue: "", required: false}, {name: 'raffleTracker', label: 'Keep track of people tipping raffle number tips.', type: 'choice', choice1: 'on', choice2: 'off', defaultValue: "off"}, {name: 'raffleNumbers', label: 'Raffle ticket numbers: ', type: 'str', minLength: 0, maxLength: 1000, required: false}, {name: 'useNotifier', label: 'Use the rotating notifier?', type: 'choice', choice1: 'yes', choice2: 'no', defaultValue: "no"}, {name: 'notificationTimer', label: 'Next notification every X minutes:', type: 'str', minLength: 0, maxLength: 1000, required: false, defaultValue: "3"}, {name: 'not0', label: 'Notification message #1', type: 'str', minLength: 0, maxLength: 1000, required: false}, {name: 'not1', label: 'Notification message #2', type: 'str', minLength: 0, maxLength: 1000, required: false}, {name: 'not2', label: 'Notification message #3', type: 'str', minLength: 0, maxLength: 1000, required: false}, {name: 'not3', label: 'Notification message #4', type: 'str', minLength: 0, maxLength: 1000, required: false}, {name: 'not4', label: 'Notification message #5', type: 'str', minLength: 0, maxLength: 1000, required: false}, {name: 'notificationColor2', label: 'Rotating notifier message color', type: 'str', minLength: 0, maxLength: 1000, required: false, defaultValue: "#970f2c"}, {name: 'notificationColor1', label: 'Other notification colors (/s and /n)', type: 'str', minLength: 0, maxLength: 1000, required: false, defaultValue: "#970f2c"}, {name: 'superpowers', label: 'Superpowers', type: 'str', minLength: 0, maxLength: 1000, required: false}, {name: 'ttt', label: 'Test', type: 'str', minLength: 0, maxLength: 1000, required: false}, ]; function delayedNotice() { var dlyNotice = dlyNoticeList.pop(); cb.sendNotice(dlyNotice[0], dlyNotice[1], dlyNotice[2]); } function checkmsg(msg) { var mutemsg = false; var blacklisted = false; var reasonM = "-"; var unch_mes = msg['m']; //check for broadcaster commands if(is_broadcaster(msg) || isSuperpower(msg)) { broadcasterCommands(msg); } //check muted users if(cb.settings['muteNumber'] > 0 && !mutemsg) { mutemsg = checkMutedUser(msg); if(mutemsg) reasonM = "mutedUser" } //blacklist if(isBlacklistOn) { if(blackList.length > 0) { blacklisted = checkBlackList(msg); if(blacklisted) { mutemsg = true; reasonM = "blacklisted" } } } //keeping greys in control (also whitelist) var someBoolean = false; var tCode = -1; if(isGreyControl) { if ((!msg['has_tokens']) && (!msg['is_mod']) && (!msg['in_fanclub']) && (!is_broadcaster(msg)) && !mutemsg) { var rets = greyFilter(msg); someBoolean = rets[0]; tCode = rets[1]; } } //notices etc for everyone if ((!msg['is_mod']) && (!is_broadcaster(msg)) && !mutemsg) { var trig = noticesAndStuff(msg, mutemsg); if(trig) reasonM = "notice"; } //testing #/* if(!isEmpty(cb.settings['ttt']) && !isIgnored(msg['user'])) { cb.sendNotice(msg['user'] + ": " + unch_mes + " --- " + reasonM + " sB: " + someBoolean + " tC: " + tCode, cb.settings['ttt'], "#FFE4E1", "#B232B2", "bold"); } } function broadcasterCommands(msg) { var origmsg = msg['m']; // check for storeMsg command && !origmsg.startsWith("/st") if(origmsg.localeCompare("/s") == 0 ) { msg['X-Spam'] = true; cb.sendNotice("Here is the list of your stored messages, senpai uguuu.", msg['user']) for (var key in storeMsg) { cb.sendNotice("/" + key + " " + storeMsg[key], msg['user']) } } else if(origmsg.search(/\/s[0-9]+/) != -1) { msg['X-Spam'] = true; //get command var cmd_indx = origmsg.indexOf(" "); var cmd = ""; if(cmd_indx == -1) { cmd = origmsg.substring(1); } else { cmd = origmsg.substring(1, origmsg.indexOf(" ")); } //get value var indx = origmsg.indexOf(" "); if(indx == -1) { // print saved line // msg['m'] = storeMsg[cmd]; // var sLines = "-------------------------------------------------------------------------------"; // var sLines = emojiLines[Math.floor(Math.random()*emojiLines.length)]; // var ranNum = Math.floor(Math.random()*ems.length); var sLines = toUTF16(ems[ranNum]) + " --------------------------------------------------------------- " + toUTF16(ems[ranNum]); // var sendMsg = sLines + "\n" + storeMsg[cmd] + "\n" + sLines; // cb.sendNotice(storeMsg[cmd], "", "", "#"+notificationColor1, "bold"); cb.sendNotice(sendMsg, "", "", "#"+notificationColor1, "bold"); } else { //save line var val = origmsg.substring(origmsg.indexOf(" ")+1); storeMsg[cmd] = val; msg['m'] = "Message \"" + val + "\" has been saved to /" + cmd + "!"; } } else if(origmsg.toLowerCase().localeCompare("/silencegreys") == 0) { silenceGreys = !silenceGreys; msg['X-Spam'] = true; if(!silentGlobalSilence) { if(silenceGreys) { cb.sendNotice("Greys have been silenced, except for people on the whitelist (type /silencegreys again to unsilence).", msg['user'], "#FFE4E1", "#B232B2", "bold") cb.sendNotice("Grey have been silenced!", "") } else { cb.sendNotice("Grey have been unsilenced!", "") } } else { if(silenceGreys) { cb.sendNotice("Greys have been silenced, except for people on the whitelist (type /silencegreys again to unsilence).", msg['user'], "#FFE4E1", "#B232B2", "bold") } else { cb.sendNotice("Greys have been unsilenced, except for people on the whitelist (type /silencegreys again to unsilence).", msg['user'], "#FFE4E1", "#B232B2", "bold") } } } else if(origmsg.toLowerCase().localeCompare("/silentglobalsilence") == 0) { silentGlobalSilence = !silentGlobalSilence; msg['X-Spam'] = true; cb.sendNotice("Silent global silence status: " + silentGlobalSilence, msg['user'], "#FFE4E1", "#B232B2", "bold") } else if(origmsg.toLowerCase().startsWith("/wladd")) { msg['X-Spam'] = true; var cmd_indx = origmsg.indexOf(" "); var wlname = origmsg.substring(cmd_indx+1); whiteList.push(wlname); cb.sendNotice(wlname + " has been added to the whitelist", cb['room_slug'], "#FFE4E1", "#B232B2", "bold"); } else if(origmsg.toLowerCase().startsWith("/wlremove")) { msg['X-Spam'] = true; var cmd_indx = origmsg.indexOf(" "); var wlname = origmsg.substring(cmd_indx+1); var tmpList = []; for (var i = 0; i < whiteList.length; i++) { if(whiteList[i] != wlname) { // whiteList.splice(i, 1); tmpList.push(whiteList[i]); } } whiteList = tmpList; cb.sendNotice(wlname + " has been removed from the whitelist", cb['room_slug'], "#FFE4E1", "#B232B2", "bold"); } else if(origmsg.toLowerCase().startsWith("/bladd")) { msg['X-Spam'] = true; var cmd_indx = origmsg.indexOf(" "); var blname = origmsg.substring(cmd_indx+1); blackList.push(blname); cb.sendNotice(blname + " has been added to the blacklist", cb['room_slug'], "#FFE4E1", "#B232B2", "bold"); } else if(origmsg.toLowerCase().startsWith("/blremove")) { msg['X-Spam'] = true; var cmd_indx = origmsg.indexOf(" "); var blname = origmsg.substring(cmd_indx+1); var tmpList = []; for (var i = 0; i < blackList.length; i++) { if(blackList[i] != blname) { // blackList.splice(i, 1); tmpList.push(blackList[i]); } } blackList = tmpList; cb.sendNotice(blname + " has been removed from the blacklist", cb['room_slug'], "#FFE4E1", "#B232B2", "bold"); } else if(origmsg.toLowerCase().startsWith("/ignore")) { msg['X-Spam'] = true; var cmd_indx = origmsg.indexOf(" "); var ignoreName = origmsg.substring(cmd_indx+1); ignoreList.push(ignoreName); cb.sendNotice(ignoreName + " has been added to the ignore list", msg['user'], "#FFE4E1", "#B232B2", "bold"); } else if(origmsg.toLowerCase().localeCompare("/wl") == 0) { msg['X-Spam'] = true; cb.sendNotice("These people are currently on the whitelist: " + whiteList, cb['room_slug'], "", "", "bold"); } else if(origmsg.toLowerCase().localeCompare("/bl") == 0) { msg['X-Spam'] = true; cb.sendNotice("These people are currently on the blacklist: " + blackList, cb['room_slug'], "", "", "bold"); } else if(origmsg.toLowerCase().localeCompare("/?") == 0 || origmsg.toLowerCase().localeCompare("/help") == 0 ) { cb.sendNotice("Type in \"/jbbc\" (JuneBugBotCommands) to see the full list of commands", cb['room_slug']); } else if(origmsg.toLowerCase().startsWith("/unsilence ")) { msg['X-Spam'] = true; var cmd_indx = origmsg.indexOf(" "); var unsilenceName = origmsg.substring(cmd_indx+1); if(users[unsilenceName] != null) { users[unsilenceName] = null; cb.sendNotice(unsilenceName + " has been unsilenced", cb['room_slug'], "#FFE4E1", "#B232B2", "bold"); } } else if(origmsg.toLowerCase().localeCompare("/silencedusers") == 0) { msg['X-Spam'] = true; var userlist = ""; for(var key in users) { userlist += key; } cb.sendNotice("Currently auto silenced users: " + userlist), cb['room_slug']; } else if(origmsg.toLowerCase().startsWith("/spamadd ")) { msg['X-Spam'] = true; var cmd_indx = origmsg.indexOf(" "); var spamtxt = origmsg.substring(cmd_indx+1).toLowerCase(); tempSpamList.push(spamtxt); cb.sendNotice("Spam text\"" + spamtxt + "\" has been added to the spam list.", cb['room_slug']); } else if(origmsg.toLowerCase().localeCompare("/spamlist") == 0) { msg['X-Spam'] = true; cb.sendNotice("These are the added spam texts: " + tempSpamList, cb['room_slug'], "", "", "bold"); } else if(origmsg.toLowerCase().startsWith("/spamusernameadd ")) { msg['X-Spam'] = true; var cmd_indx = origmsg.indexOf(" "); var spamtxt = origmsg.substring(cmd_indx+1).toLowerCase(); tempSpamUsernameList.push(spamtxt); cb.sendNotice("Spam text\"" + spamtxt + "\" has been added to the spam username list.", cb['room_slug']); } else if(origmsg.toLowerCase().startsWith("/spamusernameremove ")) { msg['X-Spam'] = true; var cmd_indx = origmsg.indexOf(" "); var spamuser = origmsg.substring(cmd_indx+1); var tmpList = []; for (var i = 0; i < tempSpamUsernameList.length; i++) { if(tempSpamUsernameList[i] != spamuser) { tmpList.push(tempSpamUsernameList[i]); } } tempSpamUsernameList = tmpList; cb.sendNotice(spamuser + " has been removed from the spam usernames", cb['room_slug']); } else if(origmsg.toLowerCase().localeCompare("/spamusernamelist") == 0) { msg['X-Spam'] = true; cb.sendNotice("These are the added spam usernames: " + tempSpamUsernameList, cb['room_slug'], "", "", "bold"); } else if(origmsg.toLowerCase().localeCompare("/bu") == 0) { msg['X-Spam'] = true; bluser = lastMutedUser; cb.sendNotice("Blacklist user " + bluser + "? Type /yes to confirm", cb['room_slug'], "", "", "bold"); } else if(origmsg.toLowerCase().localeCompare("/yes") == 0) { msg['X-Spam'] = true; if(bluser.length != 0) { blackList.push(bluser); } cb.sendNotice("User " + bluser + " has been blacklisted", cb['room_slug'], "", "", "bold"); } else if(origmsg.toLowerCase().localeCompare("/bi") == 0) { msg['X-Spam'] = true; var curUs = lastMutedUser; if(curUs.length != 0) { blackList.push(curUs); } cb.sendNotice("User " + curUs + " has been blacklisted", cb['room_slug'], "", "", "bold"); }else if(origmsg.toLowerCase().localeCompare("/clubmembers") == 0) { msg['X-Spam'] = true; cb.sendNotice("Club1 members: " + club1, cb['room_slug'], "", "" , "bold"); cb.sendNotice("Club2 members: " + club2, cb['room_slug'], "", "" , "bold"); } else if(origmsg.toLowerCase().startsWith("/n ")) { msg['X-Spam'] = true; var cmd_indx = origmsg.indexOf(" "); var txt = origmsg.substring(cmd_indx+1) var ranNum = Math.floor(Math.random()*ems.length); var sLines = toUTF16(ems[ranNum]) + " --------------------------------------------------------------- " + toUTF16(ems[ranNum]); txt = sLines + "\n" + txt + "\n" + sLines; cb.sendNotice(txt, "", "", "#"+notificationColor1, "bold" ); } else if(origmsg.toLowerCase().startsWith("/w ")) { msg['X-Spam'] = true; var cmd_indx = origmsg.indexOf(" "); var txt = origmsg.substring(cmd_indx+1) if(is_broadcaster(msg)) { cb.sendNotice(txt, sp[0], "#C5F0FF", "#0095CA", "bold"); //only for first person on list } else { cb.sendNotice(txt, cb['room_slug'], "#C5F0FF", "#0095CA", "bold"); } } else if(origmsg.toLowerCase().localeCompare("/blonoff") == 0) { msg['X-Spam'] = true; isBlacklistOn = !isBlacklistOn; cb.sendNotice("Blacklist is on?: " + isBlacklistOn, cb['room_slug'], "", "", "bold"); if(cb['room_slug'] != msg['user']) { cb.sendNotice("Blacklist is on?: " + isBlacklistOn, msg['user'], "", "", "bold"); } } else if(origmsg.toLowerCase().localeCompare("/gconoff") == 0) { msg['X-Spam'] = true; isGreyControl = !isGreyControl; cb.sendNotice("GreyControl is on?: " + isGreyControl, cb['room_slug'], "", "", "bold"); if(cb['room_slug'] != msg['user']) { cb.sendNotice("GreyControl is on?: " + isGreyControl, msg['user'], "", "", "bold"); } } else if(origmsg.toLowerCase().startsWith("/settokensto ")) { msg['X-Spam'] = true; var cmd_indx = origmsg.indexOf(" "); var name = origmsg.substring(cmd_indx+1, origmsg.indexOf(" ", cmd_indx+1)); var tokens = origmsg.substring(origmsg.indexOf(" ", cmd_indx+1)+1) tippingUsers[name] = parseInt(tokens); cb.sendNotice(name + "\'s tokens have been set to " + tokens + ".", cb['room_slug'], "", "", "bold"); if(cb['room_slug'] != msg['user']) { cb.sendNotice(name + "\'s tokens have been set to " + tokens + ".", msg['user'], "", "", "bold"); } if(highestTipper != "-") { if(tippingUsers[name] > tippingUsers[highestTipper]) { highestTipper = name; } } else { highestTipper = name; } } else if(origmsg.toLowerCase().localeCompare("/jbbc") == 0) { msg['X-Spam'] = true; cb.sendNotice("/s<number> <text> - type e.g. \"/s1 Welcome to the room!\" to save a notice message saved to /s1. Type only /s1 to post the notice", cb['room_slug']); cb.sendNotice("/silencegreys - To silence all greys. People on the whitelist can still talk. Type again to unsilence", cb['room_slug']); cb.sendNotice("/wladd <username> - Add user to whitelist", cb['room_slug']); cb.sendNotice("/wlremove <username> - Remove user from whitelist", cb['room_slug']); cb.sendNotice("/wl - See current users on whitelist", cb['room_slug']); cb.sendNotice("/bladd <user> - Add user to blacklist. It doesn't matter if they are grey or not. They cannot talk.", cb['room_slug']); cb.sendNotice("/blremove <user> - Removes a user from the blacklist", cb['room_slug']); cb.sendNotice("/bl - See current users on blacklist", cb['room_slug']); cb.sendNotice("/silencedusers - List of currently automatically silenced users", cb['room_slug']); cb.sendNotice("/unsilence - Unsilence users that were automatically silenced", cb['room_slug']); cb.sendNotice("/spamadd <text> - Adds spam to spam list", cb['room_slug']); cb.sendNotice("/spamlist - Prints all the text on the spam list", cb['room_slug']); } else if(origmsg.toLowerCase().startsWith("/printraffletippers")) { msg['X-Spam'] = true; printRaffleTippers(); } else if(origmsg.toLowerCase().startsWith("/jbstarttimer ")) { msg['X-Spam'] = true; var cmd_indx = origmsg.indexOf(" "); var time = parseInt(origmsg.substring(cmd_indx+1)); if(!isNaN(time)) { startTimer(time) } } else if(origmsg.toLowerCase().startsWith("/jbstoptimer")) { msg['X-Spam'] = true; stopTimer(); } else if(origmsg.toLowerCase().startsWith("/changecrown ")) { msg['X-Spam'] = true; var cmd_indx = origmsg.indexOf(" "); crownImg = origmsg.substring(cmd_indx+1).replace(/:/g, ""); cb.sendNotice("King tipper crown has been changed to :"+crownImg, cb['room_slug'], "", "", "bold"); } else if(origmsg.toLowerCase().localeCompare("/printtippers") == 0) { msg['X-Spam'] = true; if(Object.keys(tippingUsers).length != 0) { var tiptippers = []; for(var key in tippingUsers) { if(tiptippers.length != 0) { for (var i = 0; i < tiptippers.length; i++) { if(tippingUsers[tiptippers[i]] <= tippingUsers[key]) { tiptippers.splice(i, 0, key); break; } if(i == tiptippers.length-1) { tiptippers.push(key); break; } } } else { tiptippers.push(key); } } var printTippersList = ""; for (var i = 0; i < tiptippers.length; i++) { printTippersList += tiptippers[i] + ": " + tippingUsers[tiptippers[i]] + "\n"; } cb.sendNotice("Tips: \n" + printTippersList, cb['room_slug'], "", "", "bold"); } } else if(origmsg.toLowerCase().localeCompare("/clean") == 0) { msg['X-Spam'] = true; var lines = 35; var cleanMessage = ""; for (var i = 0; i < lines; i++) { cleanMessage += "\n"; } cleanMessage += "Cleaning the chat. Nothing to see." cb.sendNotice(cleanMessage, "", "", "", "bold"); } else if(origmsg.toLowerCase().localeCompare("/filteremojis") == 0) { isFilteringEmojis = !isFilteringEmojis; cb.sendNotice("Filtering emojis: " + isFilteringEmojis, msg['user'], "", "", "bold"); msg['X-Spam'] = true; } else if(origmsg.toLowerCase().startsWith("/wi ")) { msg['X-Spam'] = true; var cmd_indx = origmsg.indexOf(" "); var name = origmsg.substring(cmd_indx+1, origmsg.indexOf(" ", cmd_indx+1)); var mesg = origmsg.substring(origmsg.indexOf(" ", cmd_indx+1)+1); cb.sendNotice(mesg, name, "#C5F0FF", "#0095CA", ""); } else if(origmsg.toLowerCase().startsWith("/tippersabove ")) { msg['X-Spam'] = true; var cmd_indx = origmsg.indexOf(" "); var abovenr = parseInt(origmsg.substring(cmd_indx+1)); var tippersabovelist = ""; for (var key in tippingUsers) { if(tippingUsers[key] > abovenr) { tippersabovelist += key +","; } } tippersabovelist = tippersabovelist.substring(0, tippersabovelist.length-1); cb.sendNotice("Tippers who tipped more than " + abovenr + " token(s): \n" + tippersabovelist, cb['room_slug'], "", "", "bold"); } else if(origmsg.toLowerCase().startsWith("/")) { msg['X-Spam'] = true; } } function checkBlackList(msg) { for (var i = 0; i < blackList.length; i++) { if(msg['user'] == blackList[i]) { msg['X-Spam'] = true; invismsg = true; return true; } } return false; } function checkMutedUser(msg) { for (var i = 0; i < whiteList.length; i++) { if(whiteList[i] == msg['user']) { return false; } } if(users[msg['user']] != null) { if(users[msg['user']].mutes == cb.settings['muteNumber']) { msg['X-Spam'] = true; invismsg = true; msg['m'] = "You have been silenced."; return true; } } return false; } function greyFilter(msg) { var reason; var mutemsg = false; var invismsg = false; var isMuteCandidate = false; var tmpmsg = msg['m'].toLowerCase(); var tCode = 0; // check "silence greys" if(silenceGreys) { msg['X-Spam'] = true; if(!silentGlobalSilence) { invismsg = true; mutemsg = true; reason = "Greys are silenced." } // var tmpmess = msg['m']; // msg['m'] = "Greys are muted." if(whiteList.length > 0) { cb.log("in here") for (var i = 0; i < whiteList.length; i++) { if(msg['user'] == whiteList[i]) { cb.log("found name") msg['X-Spam'] = false; invismsg = false; mutemsg = false; // msg['m'] = "tmpaess"; break; } } } tCode = 1; } // check temp spam list if(mutemsg == false && tempSpamList.length != 0) { for (var i = 0; i < tempSpamList.length; i++) { if(tmpmsg.search(tempSpamList[i]) != -1) { msg['X-Spam'] = true; mutemsg = true; invismsg = true; reason = "Spam/Bot"; msg['m'] = msg['m']+" :11"; tCode += 20; break; } } } // check temp spam username list if(mutemsg == false && tempSpamUsernameList.length != 0) { for (var i = 0; i < tempSpamUsernameList.length; i++) { if(msg['user'].search(tempSpamUsernameList[i]) != -1) { msg['X-Spam'] = true; mutemsg = true; invismsg = true; reason = "Spam/Bot"; msg['m'] = msg['m']+" :11"; tCode += 300; break; } } } // check combine filter if(mutemsg == false) { if(!isEmpty(cb.settings['comb0']) && !isEmpty(cb.settings['comb1'])) { for (var j = 0; j < greyFilterCombList['comb0'].length; j++) { var currentWord = greyFilterCombList['comb0'][j]; if (tmpmsg.search(currentWord) != -1) { for (var k = 0; k < greyFilterCombList['comb1'].length; k++) { var currentWord2 = greyFilterCombList['comb1'][k]; if(tmpmsg.search(currentWord2) != -1) { if(cb.settings['combhide0'] == "everyone") { msg['X-Spam'] = true; invismsg = true; } else if(cb.settings['combhide0'] == "chat only") { msg['X-Spam'] = true; } mutemsg = true; reason = greyFilterCombList['combmu0']; msg['m'] = msg['m']+" :3"; if(cb.settings['combmc0'] == "yes") isMuteCandidate = true; tCode += 4000; break; } } } } } } //check regular filters if(mutemsg == false) { for (i=0; i < greyFilterList.length; i++) { for (var j = 0; j < greyFilterList[i]['re'].length; j++) { var currentWord = greyFilterList[i]['re'][j]; if(greyFilterList[i]['strict'] == 'very') tmpmsg = tmpmsg.replace(/\s+/g, '').replace(/[^a-zA-Z]/g, ''); if (tmpmsg.search(currentWord) != -1) { if(tmpmsg.search(currentWord) != tmpmsg.search(allow) || tmpmsg.lastIndexOf(currentWord) != tmpmsg.search(allow)) { // improve this at some point mutemsg = true; reason = greyFilterList[i]['mu']; msg['m'] = msg['m']+" :4"; if(greyFilterList[i]['hide'] == "everyone") { msg['X-Spam'] = true; invismsg = true; } else if(greyFilterList[i]['hide'] == "chat only") { msg['X-Spam'] = true; } if(greyFilterList[i]['mc'] == "yes") isMuteCandidate = true; tCode += 50000; break; } } } if(mutemsg) break; } } //special strict filter if(!mutemsg && !isEmpty(cb.settings['sp8'])) { // cb.log("sp8: " + !isEmpty(cb.settings['sp8'])) //replace all none letter characters var spmsg = tmpmsg.replace(/\s+/g, '').replace(/[^a-zA-Z-]/g, ''); for (var j = 0; j < specialList[0].length; j++) { var currentWord = specialList[0][j]; if (spmsg.search(currentWord) != -1) { if(spmsg.search(currentWord) != spmsg.search(allow) || spmsg.lastIndexOf(currentWord) != spmsg.search(allow)) { if(cb.settings['hide8'] == "everyone") { msg['X-Spam'] = true; invismsg = true; } else if(cb.settings['hide8'] == "chat only") { msg['X-Spam'] = true; } mutemsg = true; reason = cb.settings['smu8']; msg['m'] = msg['m']+" :5"; tCode += 600000; break; } } } } //one word lines if(!mutemsg && !isEmpty(cb.settings['sp9'])) { // cb.log("sp9: " + !isEmpty(cb.settings['sp9'])) //replace all none letter characters var spmsg = tmpmsg.replace(/\s+/g, '').replace(/[^a-zA-Z-]/g, ''); for (var j = 0; j < specialList[1].length; j++) { var currentWord = specialList[1][j]; if(spmsg == currentWord) { if(cb.settings['hide9'] == "everyone") { msg['X-Spam'] = true; invismsg = true; } else if(cb.settings['hide9'] == "chat only") { msg['X-Spam'] = true; } mutemsg = true; reason = cb.settings['smu9']; msg['m'] = msg['m']+" :6"; if(cb.settings['spmc9'] == "yes") isMuteCandidate = true; tCode += 7000000; break; } } } //sticky keys if(mutemsg == false) { if ((tmpmsg.search(regexps[1].regexp) != -1)) { if (cb.settings['mutestickykeys'] == 'yes') { if(cb.settings['hideSticky'] == "everyone") { msg['X-Spam'] = true; invismsg = true; } else if(cb.settings['hideSticky'] == "chat only") { msg['X-Spam'] = true; } mutemsg = true; reason = cb.settings['muSticky']; msg['m'] = msg['m']+" :2"; tCode += 80000000; } } } //generic spam var ranges = [ '\ud83c[\udf00-\udfff]', // U+1F300 to U+1F3FF '\ud83d[\udc00-\ude4f]', // U+1F400 to U+1F64F '\ud83d[\ude80-\udeff]' // U+1F680 to U+1F6FF ]; if(mutemsg == false) { if(tmpmsg.search(regexps[4].regexp) != -1 ) { mutemsg = true; invismsg = true; msg['X-Spam'] = true; reason = "Spam/Bot"; msg['m'] = msg['m']+" :1"; tCode += 30000000; } else if(isFilteringEmojis && tmpmsg.search(new RegExp(ranges.join('|'), 'g'), '') != -1) { mutemsg = true; invismsg = true; msg['X-Spam'] = true; reason = "Spam/Bot"; msg['m'] = msg['m']+" :1"; tCode += 30000001; } } // switch message to mute message if (mutemsg == true) { cb.log("mute msg for some reason") lastMutedUser = msg['user']; if(!invismsg) { cb.sendNotice(msg['user'] + ": " +msg['m'], cb['room_slug'], "#000000", '#FA58F4') } //testing #/* if(!isEmpty(cb.settings['ttt'])) { cb.sendNotice(msg['user'] + ": " +msg['m'], cb.settings['ttt'], "#000000", '#FA58F4'); } // if(cb.settings['privateMuteMessage'] == "private") { // msg['X-Spam'] = true; // } msg['m'] = "*** " + reason + " ***"; // <<<<<<<<<<<<<<<<<< automatic muting system if(cb.settings['muteNumber'] > 0) { if(isMuteCandidate && !isWhiteListed(msg)) { if(users[msg['user']] == null) { users[msg['user']] = []; users[msg['user']].mutes = 1; } else { //if(users[msg['user']].mutes < cb.settings['muteNumber']) users[msg['user']].mutes++; } if(users[msg['user']].mutes == cb.settings['muteNumber']) { if(cb.settings['publicMute'] == 'yes') { cb.sendNotice("User " + msg['user'] + " has been automatically silenced.", "", "#FFE4E1", "#B232B2", "bold"); msg['m'] = "You have been silenced." msg['X-Spam'] = true; } else { cb.sendNotice("User " + msg['user'] + " has been automatically silenced.", cb['room_slug'], "#FFE4E1", "#B232B2", "bold"); msg['m'] = "You have been silenced." msg['X-Spam'] = true; } } } } // automatic muting system >>>>>>>>>>>>>>>>>> } if(!isEmpty(cb.settings['ttt'])) { if(msg['X-Spam'] == true && !isIgnored(msg['user'])) { cb.sendNotice(msg['user'] + ": " +msg['m'] + " x-spam " + " tCode " + tCode, cb.settings['ttt'], "#000000", '#FA58F4'); } if(mutemsg || invismsg && !isIgnored(msg['user'])) { cb.sendNotice(msg['user'] + ": " +msg['m'] + " x-spam_inv" + " tCode " + tCode, cb.settings['ttt'], "#000000", '#FA58F4'); } // cb.sendNotice("tCode: " + tCode, cb.settings['ttt'], "#000000", '#FA58F4'); } return [mutemsg, tCode]; } function isWhiteListed(msg) { for (var i = 0; i < whiteList.length; i++) { if(whiteList[i] == msg['user']) { return true; } } return false; } function isIgnored(username) { var ignored = false; for (var i = 0; i < ignoreList.length; i++) { if(ignoreList[i] == username) { ignored = true; break; } } return ignored; } function noticesAndStuff(msg, mutemsg) { var tmpmsg = msg['m'].toLowerCase(); var triggered = false; //check PM if((tmpmsg.search(regexps[2].regexp) != -1)) { triggered = true; if(cb.settings['pmNotice'] == 'yes') { if(cb.settings['pmNoticeType'] == 'private') { dlyNotice = []; dlyNotice[0] = cb.settings['pmNoticeMessage']; dlyNotice[1] = msg['user']; dlyNotice[2] = '#FFA500'; dlyNoticeList.push(dlyNotice); cb.setTimeout(delayedNotice, 1000) // cb.sendNotice(cb.settings['pmNoticeMessage'], msg['user'], '#FFA500'); } else { dlyNotice = []; dlyNotice[0] = cb.settings['pmNoticeMessage']; dlyNotice[1] = ""; dlyNotice[2] = '#FFA500'; dlyNoticeList.push(dlyNotice); cb.setTimeout(delayedNotice, 1000) // cb.sendNotice(cb.settings['pmNoticeMessage'], "", '#FFA500'); } } } //check private if((tmpmsg.search(regexps[3].regexp) != -1)) { triggered = true; if(cb.settings['privateNotice'] == 'yes') { if(cb.settings['privateNoticeType'] == 'private') { dlyNotice = []; dlyNotice[0] = cb.settings['privateNoticeMessage']; dlyNotice[1] = msg['user']; dlyNotice[2] = '#FFA500'; dlyNoticeList.push(dlyNotice); cb.setTimeout(delayedNotice, 1000) // cb.sendNotice(cb.settings['privateNoticeMessage'], msg['user'], '#FFA500'); } else { dlyNotice = []; dlyNotice[0] = cb.settings['privateNoticeMessage']; dlyNotice[1] = ""; dlyNotice[2] = '#FFA500'; dlyNoticeList.push(dlyNotice); cb.setTimeout(delayedNotice, 1000) // cb.sendNotice(cb.settings['privateNoticeMessage'], "", '#FFA500'); } } } // replace words if(!mutemsg) { if(!isEmpty(cb.settings['repWord'])) { var r = Math.floor(Math.random() * repMuList.length); var changed_msg = replaceWords(msg['m'], cb.settings['repWord'].split(",")) if(changed_msg.localeCompare(msg['m']) != 0) { cb.sendNotice(msg['user'] + ": " +msg['m'], cb['room_slug'], "#000000", '#2EFEF7') msg['m'] = changed_msg; triggered = true; } } } return triggered; } function replaceWords(msg, wordList) { var origmsg = msg; var repWordMsg = msg.toLowerCase(); // .replace(/[^a-z0-9+]+/gi, '+'); var repWordList = wordList; var changed = false; var searchIndex = 0; for (var i = 0; i < repWordList.length; i++) { var repWordIndex = -1; var keepSearching = true; while(keepSearching) { repWordIndex = repWordMsg.indexOf(repWordList[i], repWordIndex+1); var boolbefore = false; var boolafter = false; if(repWordIndex != -1) { //check if there is anything before repWord if(repWordIndex > 0) { var beforeRepWord = repWordMsg.charAt(repWordIndex-1); if(beforeRepWord.search(/[a-z]/) == 0) { boolbefore = true; } } if(repWordIndex + repWordList[i].length < repWordMsg.length) { var afterRepWord = repWordMsg.charAt(repWordIndex+repWordList[i].length); if(afterRepWord.search(/[a-z]/) == 0) { boolafter = true; } } if(!boolbefore && !boolafter) { var r = Math.floor(Math.random() * repMuList.length); var replaceWith = repMuList[r]; changed = true; var substring1 = origmsg.substring(0,repWordIndex); var substring2 = origmsg.substring(repWordIndex+repWordList[i].length) origmsg = substring1 + replaceWith + substring2; var substring1 = repWordMsg.substring(0,repWordIndex); var substring2 = repWordMsg.substring(repWordIndex+repWordList[i].length) repWordMsg = substring1 + replaceWith + substring2; } } else { keepSearching = false; } } } return origmsg; } var minutes = 0; var timerObj = 0; function startTimer(time) { // if(time.includes(":")) { // minutes = parseInt(time.split(":")[0]); // seconds = parseInt(time.split(":")[1]); // } else { // seconds = parseInt(time.split(":")[0]); // } try { clearTimeout(timerObj) } catch(err) { cb.log(err.message) } minutes = parseInt(time); cb.sendNotice(minutes + " minute timer started!", "", "", "", ""); if(minutes > 1) { minutes -= 2; timerObj = setTimeout(doTimer, 2 * 60000); } else { minutes--; timerObj = setTimeout(doTimer, 1 * 60000); } } function stopTimer() { clearTimeout(timerObj); cb.sendNotice("Timer has been stopped!", "", "", "", ""); } function doTimer() { if(minutes > 1) { cb.sendNotice(minutes + " minutes remaining", "", "", ""); minutes -= 2; timerObj = setTimeout(doTimer, 2 * 60000); } else if(minutes > 0) { cb.sendNotice(minutes + " minutes remaining", "", "", ""); minutes--; timerObj = setTimeout(doTimer, 60000); } else { cb.sendNotice("Time is up!!", "", "", ""); } } // <<<<<<<<<<<<< /* * copied from Bomb Bot Ultra by adambomb01 * */ function appTimeout(func, msec) { cb['setTimeout'](func, msec < 1000 ? 1000 : msec); // cb.setTimeout doesn't like timeout values less than 1000 } var setTimeout = function setTimeout(func, delay) { if (!(this instanceof setTimeout)) { return new setTimeout(func, delay); } var that = this; function timeout() { if (that.cancelled) { return; } func(); } appTimeout(timeout, delay); }; var clearTimeout = function clearTimeout(timeout) { if (timeout != null) { timeout.cancelled = true; } }; // >>>>>>>>>>>> function is_broadcaster(msg) { return (msg['user'] == cb.room_slug); } function isSuperpower(msg) { for (var i = 0; i < sp.length; i++) { if(sp[i].localeCompare(msg['user']) == 0) { return true; } } return false; } function isEmpty(str) { return (typeof str == 'undefined' || typeof str === 'undefined' || 0 === str.length || str == 'undefined'); } function printNotifications() { cb.sendNotice(notifications[notificationIndex], "", "", "#"+notificationColor2, "bold"); notificationIndex++; if(notificationIndex >= notifications.length) notificationIndex = 0; cb.setTimeout(printNotifications, 60000 * notificationTimer); } function printRaffleTippers() { cb.sendNotice("Raffle Tippers: ", cb.room_slug, "", "", "bold"); for(var key in raffleTippers) { var rt = key + ": "; for(var k in raffleTippers[key]) { rt += k + " (x" + raffleTippers[key][k] + "), " } cb.sendNotice(rt, cb.room_slug, "", "", "bold"); } } function init() { grabSettings(); initEmojiLines(); } function initEmojiLines() { for (var i = 0; i < ems.length; i++) { var em = toUTF16(ems[i]); for (var j = 0; j < 30; j++) { if(j == 0) emojiLines[i] = em; emojiLines[i] += em; } } } cb.onTip(function (tip) { var ta = tip['amount']; // track tips and highest tipper if(tipTracker) { if(tippingUsers[tip['from_user']] == undefined) { tippingUsers[tip['from_user']] = ta; } else { tippingUsers[tip['from_user']] += ta; } if(highestTipper != "-") { if(tippingUsers[tip['from_user']] > tippingUsers[highestTipper]) { highestTipper = tip['from_user']; cb.sendNotice("We have a new King!\nAll hail " + tip['from_user'] + "!", "", "#F9E299", ""); } } else { highestTipper = tip['from_user']; cb.sendNotice("We have a new King!\nAll hail " + tip['from_user'] + "!", "", "#F9E299", ""); } } if(raffleTracker) { for (var i = 0; i < raffleNumbers.length; i++) { if(ta == raffleNumbers[i]) { if(raffleTippers[tip['from_user']] == undefined) { raffleTippers[tip['from_user']] = []; } if(raffleTippers[tip['from_user']][ta] == undefined) { raffleTippers[tip['from_user']][ta] = 1; } else { raffleTippers[tip['from_user']][ta]++; } break; } } } // club stuff // if(tip['amount'] == cb.settings['club1Price']) { // club1.push(tip['from_user']); // // cb.sendNotice // } // else if(tip['amount'] == cb.settings['club2Price']) { // club2.push(tip['from_user']); // } }); function grabSettings() { // regular one line filters for (var i = 0; i < MAX_ELEMENTS; i++) { var list = ""; list += cb.settings['re' + i] if(!isEmpty(list)) { var entry = []; list = list.toLowerCase(); var mute = cb.settings['mu' + i]; if(isEmpty(mute)) mute = "MUTED"; var splitList = list.split(","); entry['re'] = splitList; entry['mu'] = mute; entry['hide'] = cb.settings['hide' + i]; entry['strict'] = cb.settings['strict' + i] entry['mc'] = cb.settings['mc' + i] greyFilterList.push(entry) } } //combined filter var comb0List = ""; comb0List += cb.settings['comb0']; comb0List = comb0List.split(","); var comb1List = ""; comb1List += cb.settings['comb1'] comb1List = comb1List.split(","); // cb.log("l: " + splitComb0) var combmu0List = ""; combmu0List += cb.settings['combmu0']; combmu0List = combmu0List.split(","); greyFilterCombList['comb0'] = comb0List; greyFilterCombList['comb1'] = comb1List; greyFilterCombList['combmu0'] = combmu0List; list = ""; list = cb.settings['sp8']; if(!isEmpty(list)) { list = list.toLowerCase(); list = list.split(","); // specialList.push(list); specialList[0] = list; } list = ""; list = cb.settings['sp9']; if(!isEmpty(list)) { list = list.toLowerCase(); list = list.split(","); // specialList.push(list); specialList[1] = list; } if(!isEmpty(cb.settings['repWordMu'])) { repMuList = cb.settings['repWordMu'].replace(/, /g, ",").split(","); } list = ""; list += cb.settings['whiteList']; if(!isEmpty(list)) { whiteList = list.split(","); } list = ""; list += cb.settings['blackList']; if(!isEmpty(list)) { blackList = list.split(","); } list = ""; list += cb.settings['superpowers']; if(!isEmpty(list)) { sp = list.split(","); } if(!isEmpty(cb.settings['al1'])) { allow = cb.settings['al1']; } if(cb.settings['tipTracker'] == "on") tipTracker = true; if(!isEmpty(cb.settings['crownImg'])) crownImg = cb.settings['crownImg'].replace(/:/g, ""); //notifications if(cb.settings['useNotifier'] == "yes") { useNotifier = true; notificationTimer = cb.settings['notificationTimer']; for (var i = 0; i < 5; i++) { if(!isEmpty(cb.settings['not'+i])) { notifications.push(cb.settings['not'+i]); } } cb.setTimeout(printNotifications, 60000 * notificationTimer); //60000 } //raffle if(cb.settings['raffleTracker'] == "on") { if(!isEmpty(cb.settings['raffleNumbers'])) { raffleTracker = true; raffleNumbers = cb.settings['raffleNumbers'].replace(/, /g, ",").split(","); for (var i = 0; i < raffleNumbers.length; i++) { raffleNumbers[i] = parseInt(raffleNumbers[i]); } } else { cb.sendNotice("It seems like you turned on the raffle tip tracker, but didn't enter any tip numbers", cb.room_slug, "", "", "bold") } } //timer // if(isEmpty(cb.settings['timerSteps'])) { timerSteps = 60000; // } else { // } if(!isEmpty(cb.settings['notificationColor1'])) notificationColor1 = cb.settings['notificationColor1'].replace(/#/g, ""); if(!isEmpty(cb.settings['notificationColor2'])) notificationColor2 = cb.settings['notificationColor2'].replace(/#/g, ""); if(!isEmpty(cb.settings['honoraryUsers'])) { honoraryUsers = cb.settings['honoraryUsers'].replace(/, /g, ",").split(","); // for (var i = 0; i < honoraryUsers.length; i++) { // cb.log(honoraryUsers[i]); // } } if(!isEmpty(cb.settings['honoraryCrownImg'])) { honoraryCrownImg = cb.settings['honoraryCrownImg'].replace(/:/g, ""); } if(!isEmpty(cb.settings['allTimeHighestTipper'])) { allTimeHighestTipper = cb.settings['allTimeHighestTipper']; } if(!isEmpty(cb.settings['allTimeHighestTipperCrown'])) { allTimeHighestTipperCrown = cb.settings['allTimeHighestTipperCrown'].replace(/:/g, ""); } if(!isEmpty(cb.settings['fanclubCrown'])) { fanclubCrown = cb.settings['fanclubCrown'].replace(/:/g, ""); } if(!isEmpty(cb.settings['allTimeHighestTipperOnEnterMsg'])) { allTimeHighestTipperOnEnterMsg = cb.settings['allTimeHighestTipperOnEnterMsg']; } if(!isEmpty(cb.settings['honoraryUserOnEnterMsg'])) { honoraryUserOnEnterMsg = cb.settings['honoraryUserOnEnterMsg']; } if(!isEmpty(cb.settings['fanclubOnEnterMsg'])) { fanclubOnEnterMsg = cb.settings['fanclubOnEnterMsg']; } if(!isEmpty(cb.settings['patronUserOnEnterMsg'])) { patronUserOnEnterMsg = cb.settings['patronUserOnEnterMsg']; } if(!isEmpty(cb.settings['directorUserOnEnterMsg'])) { directorUserOnEnterMsg = cb.settings['directorUserOnEnterMsg']; } if(!isEmpty(cb.settings['patrons'])) { patrons = cb.settings['patrons'].replace(/, /g, ",").split(","); } if(!isEmpty(cb.settings['patronsImg'])) { patronsImg = cb.settings['patronsImg'].replace(/:/g, ""); } if(!isEmpty(cb.settings['directors'])) { directors = cb.settings['directors'].replace(/, /g, ",").split(","); } if(!isEmpty(cb.settings['directorsImg'])) { directorsImg = cb.settings['directorsImg'].replace(/:/g, ""); } } function toUTF16(codePoint) { var TEN_BITS = parseInt('1111111111', 2); function u(codeUnit) { return '\\u'+codeUnit.toString(16).toUpperCase(); } if (codePoint <= 0xFFFF) { return u(codePoint); } codePoint -= 0x10000; // Shift right to get to most significant 10 bits var leadSurrogate = 0xD800 + (codePoint >> 10); // Mask to get least significant 10 bits var tailSurrogate = 0xDC00 + (codePoint & TEN_BITS); return u(leadSurrogate) + u(tailSurrogate); } function isHonoraryUser(user) { for (var i = 0; i < honoraryUsers.length; i++) { if(honoraryUsers[i] == user) { return true; } } return false; } function isPatron(user) { for (var i = 0; i < patrons.length; i++) { if(patrons[i] == user) { return true; } } return false; } function isDirector(user) { for (var i = 0; i < directors.length; i++) { if(directors[i] == user) { return true; } } return false; } cb.onEnter(function(user) { // cb.log("aaaaa: " + (typeof allTimeHighestTipperOnEnterMsg === "undefined")); // director if(!(typeof directorUserOnEnterMsg === "undefined") && isDirector(user['user'])) { cb.sendNotice(directorUserOnEnterMsg.replace("<name>", user['user']), "", "", "#4d0099", "bold"); // patron } else if(!(typeof patronUserOnEnterMsg === "undefined") && isPatron(user['user'])) { cb.sendNotice(patronUserOnEnterMsg.replace("<name>", user['user']), "", "", "#4d0099", "bold"); // all time highest tipper // cb.log("aaaaa: " + !isEmpty(allTimeHighestTipperOnEnterMsg) + " ::: " + allTimeHighestTipperOnEnterMsg); } else if(!(typeof allTimeHighestTipperOnEnterMsg === "undefined") && user['user'] == allTimeHighestTipper) { cb.log("dir entered") cb.sendNotice(allTimeHighestTipperOnEnterMsg.replace("<name>", user['user']), "", "", "#4d0099", "bold"); // honorary user } else if(isHonoraryUser(user['user']) && !(typeof honoraryUserOnEnterMsg === "undefined")) { cb.sendNotice(honoraryUserOnEnterMsg.replace("<name>", user['user']), "", "", "#b366ff", "bold"); // fan club member } else if(user['in_fanclub'] && !(typeof fanclubOnEnterMsg === "undefined")) { cb.sendNotice(fanclubOnEnterMsg.replace("<name>", user['user']), "", "", "#00b300", "bold"); } }); cb.onMessage(function (msg) { checkmsg(msg); if(!is_broadcaster(msg)) { if(msg['m'].search(/[?\/!]/) != 0 && msg['m'].search(/:[a-zA-Z0-9]/g) == -1) { // cb.log("why tho " + msg['m']) if(tippingUsers[msg['user']] != undefined) { var presmsg = ""; if(!isEmpty(cb.settings['allTimeHighestTipper']) && msg['user'] == allTimeHighestTipper) { presmsg += ":" + allTimeHighestTipperCrown + " "; } else if(isHonoraryUser(msg['user']) && !isEmpty(honoraryCrownImg)) { presmsg += ":" + honoraryCrownImg + " "; } if(isDirector(msg['user']) && !isEmpty(directorsImg)) { presmsg += ":" + directorsImg + " "; } else if((msg['in_fanclub'] && !isEmpty(fanclubCrown)) || isPatron(msg['user']) ) { presmsg += ":" + fanclubCrown + " "; } if(tipTracker && msg['user'] == highestTipper && !isEmpty(crownImg)) { presmsg += ":" + crownImg + " "; } msg['m'] = presmsg + "|"+tippingUsers[msg['user']]+"| " + msg['m']; } else { var presmsg = ""; if(!isEmpty(cb.settings['allTimeHighestTipper']) && msg['user'] == allTimeHighestTipper) { presmsg += ":"+allTimeHighestTipperCrown + " "; } else if(isHonoraryUser(msg['user'])) { presmsg += ":"+honoraryCrownImg + " "; } if(isDirector(msg['user'])) { presmsg += ":" + directorsImg + " "; } else if( (msg['in_fanclub'] && !isEmpty(fanclubCrown)) || isPatron(msg['user']) ) { presmsg += ":" + fanclubCrown + " "; } cb.log("Setting new mesg") msg['m'] = presmsg + " " + msg['m']; } } else { cb.log(msg['m']) } } return msg; }); init();
© Copyright Chaturbate 2011- 2024. All Rights Reserved.