Bots Home
|
Create an App
BouncerBot
Author:
entomy
Description
Source Code
Launch Bot
Current Users
Created by:
Entomy
/** * Provides "the dozer"; chat cleanup */ var dozer; /** * Provides "the dozer"; chat cleanup */ (function (dozer) { "use strict"; /** * Prints the help for dozer * @param message Requesting message */ function help(message) { if (permissions.isAtLeastModerator(message)) { notice.add("/doze,dozer --Clear the chat"); notice.post(message.user); message['X-Spam'] = true; } } dozer.help = help; /** * Try to parse a dozer command, returning true if a valid command is found * @param message Requesting message */ function tryParse(message) { if (permissions.isAtLeastModerator(message)) { var m = message.m.split(" "); if (m.length === 0) return false; var command = m.shift().toLowerCase(); switch (command) { case "/doze": case "/dozer": doze(); return true; default: return false; } } return false; } dozer.tryParse = tryParse; /** * Run the dozer */ function doze() { notice.adds("\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n"); notice.post("", "#FFFFFF"); } })(dozer || (dozer = {})); /** * Provides aliases for emblem emotes */ var emblems; /** * Provides aliases for emblem emotes */ (function (emblems) { "use strict"; emblems.arrow = " :arrow16 "; emblems.ballot = " :ballot16 "; emblems.bb8 = " :miniBB-8 "; emblems.blank = " :blank16 "; emblems.bronzemedal = " :bronzemedal16c "; emblems.coppermedal = " :coppermedal16 "; emblems.crown = " :crown16 "; emblems.gavel = " :gavel16 "; emblems.goldmedal = " :goldmedal16 "; emblems.hitachi = " :hitachi16 "; emblems.notice = " :notice16 "; emblems.silvermedal = " :silvermedal16 "; emblems.song = " :song16 "; emblems.timer = " :timer16 "; emblems.tinmedal = " :tinmedal16 "; emblems.tipmenu = " :tipmenu16 "; emblems.token = " :token12 "; emblems.trusted = " :trusted16 "; emblems.whisper = " :whisper16 "; emblems.whispermod = " :whispermod16 "; })(emblems || (emblems = {})); /** * Manages notices, especially buffering notices */ var notice; /** * Manages notices, especially buffering notices */ (function (notice_1) { "use strict"; /** * Color to use in notices, if none specified */ notice_1.color = "#000000"; /** * Buffer of notices that haven't been posted */ var buffer = []; /** * Add the notice to the buffer * @param notice Notice to add */ function add(notice) { buffer[buffer.length] = notice; } notice_1.add = add; /** * Add the notices to the buffer * @param notices Notices to add */ function adds() { var notices = []; for (var _i = 0; _i < arguments.length; _i++) { notices[_i] = arguments[_i]; } for (var _a = 0, notices_1 = notices; _a < notices_1.length; _a++) { var notice_2 = notices_1[_a]; add(notice_2); } } notice_1.adds = adds; /** * Apply the emblem to each notice in the buffer * @param emblem Emblem to apply */ function apply(emblem) { for (var _i = 0, buffer_1 = buffer; _i < buffer_1.length; _i++) { var notice_3 = buffer_1[_i]; notice_3 = emblem + notice_3; } } notice_1.apply = apply; /** * Clear the buffer */ function clear() { buffer = []; } notice_1.clear = clear; /** * Print the help menu for notices * @param message Requesting message */ function help(message) { if (permissions.isAtLeastModerator(message)) { add("/note,notice <Message> --Send a notice to chat"); post(message.user); } } notice_1.help = help; /** * Post all notices in the buffer * @param to User to send to * @param textcolor Color of the text * @param weight Weight of the font * @param autoclear Clear the buffer automatically */ function post(to, textcolor, weight, autoclear) { if (to === void 0) { to = ""; } if (textcolor === void 0) { textcolor = notice_1.color; } if (weight === void 0) { weight = "bold"; } if (autoclear === void 0) { autoclear = true; } var message = buffer.join("\n"); cb.sendNotice(message, to, "#FFFFFF", textcolor, weight); if (autoclear) clear(); } notice_1.post = post; /** * Post all notices in the buffer * @param to Group to send to * @param textcolor Color of the text * @param weight Weight of the font */ function postGroup(to, textcolor, weight, autoclear) { if (textcolor === void 0) { textcolor = notice_1.color; } if (weight === void 0) { weight = "bold"; } if (autoclear === void 0) { autoclear = true; } var message = buffer.join("\n"); cb.sendNotice(message, "", "#FFFFFF", textcolor, weight, to); if (autoclear) clear(); } notice_1.postGroup = postGroup; /** * Send a notice * @param message Message to send * @param to User to send to * @param textcolor Color of the text * @param weight Weight of the font */ function send(message, to, textcolor, weight) { if (to === void 0) { to = ""; } if (textcolor === void 0) { textcolor = notice_1.color; } if (weight === void 0) { weight = "bold"; } cb.sendNotice(message, to, "#FFFFFF", textcolor, weight); } notice_1.send = send; /** * Send a notice * @param message Message to send * @param to Group to send to * @param textcolor Color of the text * @param weight Weight of the font */ function sendGroup(message, to, textcolor, weight) { if (textcolor === void 0) { textcolor = notice_1.color; } if (weight === void 0) { weight = "bold"; } cb.sendNotice(message, "", "#FFFFFF", textcolor, weight, to); } notice_1.sendGroup = sendGroup; /** * Try to parse a valid notice command, returning true if a valid command is found * @param message Requesting message */ function tryParse(message) { if (permissions.isAtLeastModerator(message)) { var m = message.m.split(" "); if (m.length === 0) return false; var command = m.shift().toLowerCase(); switch (command) { case "/note": case "/notice": send(emblems.notice + m.join(" ")); return true; default: return false; } } return false; } notice_1.tryParse = tryParse; })(notice || (notice = {})); /** * Provides permissions checking * A lot of these are provided by the object anyways, are are implemented for the sake of orthogonality * This is solely for permissions purposes, the levels are: * broadcaster > trusted user > moderator > fanclub > tipped tons > tipped alot > tipped > has tokens > gray */ var permissions; /** * Provides permissions checking * A lot of these are provided by the object anyways, are are implemented for the sake of orthogonality * This is solely for permissions purposes, the levels are: * broadcaster > trusted user > moderator > fanclub > tipped tons > tipped alot > tipped > has tokens > gray */ (function (permissions) { "use strict"; /** * List of trusted users; users with elevated permissions */ var trusted = []; /** * Trust the users * @param users Users to trust */ function entrust() { var users = []; for (var _i = 0; _i < arguments.length; _i++) { users[_i] = arguments[_i]; } for (var _a = 0, users_1 = users; _a < users_1.length; _a++) { var user_1 = users_1[_a]; trusted[trusted.length] = user_1; } } permissions.entrust = entrust; /** * Remove trust of the users * @param users Users to detrust */ function detrust() { var users = []; for (var _i = 0; _i < arguments.length; _i++) { users[_i] = arguments[_i]; } for (var _a = 0, users_2 = users; _a < users_2.length; _a++) { var user_2 = users_2[_a]; trusted = cbjs.arrayRemove(trusted, user_2); } } permissions.detrust = detrust; /** * Is the user the broadcaster? * @param user User to check */ function isBroadcaster(user) { return user.user === cb.room_slug; } permissions.isBroadcaster = isBroadcaster; /** * Is the user a trusted user? * @param user User to check */ function isTrusted(user) { return cbjs.arrayContains(trusted, user.user); } permissions.isTrusted = isTrusted; /** * Is the user at least a trusted user? * @param user User to check */ function isAtLeastTrusted(user) { return isBroadcaster(user) || isTrusted(user); } permissions.isAtLeastTrusted = isAtLeastTrusted; /** * Is the user a moderator? * @param user User to check */ function isModerator(user) { return user.is_mod; } permissions.isModerator = isModerator; /** * Is the user at least a moderator? * @param user User to check */ function isAtLeastModerator(user) { return isAtLeastTrusted(user) || isModerator(user); } permissions.isAtLeastModerator = isAtLeastModerator; /** * Is the user in the fanclub? * @param user User to check */ function isInFanclub(user) { return user.in_fanclub; } permissions.isInFanclub = isInFanclub; /** * Is the user at least in the fanclub? * @param user User to check */ function isAtLeastInFanclub(user) { return isAtLeastModerator(user) || isInFanclub(user); } permissions.isAtLeastInFanclub = isAtLeastInFanclub; /** * Has the user tipped tons recently? * @param user User to check */ function hasTippedTons(user) { return user.tipped_tons_recently; } permissions.hasTippedTons = hasTippedTons; /** * Has the user at least tipped tons recently? * @param user User to check */ function hasAtLeastTippedTons(user) { return isAtLeastInFanclub(user) || hasTippedTons(user); } permissions.hasAtLeastTippedTons = hasAtLeastTippedTons; /** * Has the user tipped alot recently? * @param user User to check */ function hasTippedAlot(user) { return user.tipped_alot_recently; } permissions.hasTippedAlot = hasTippedAlot; /** * Has the user at least tipped alot recently? * @param user User to check */ function hasAtLeastTippedAlot(user) { return hasAtLeastTippedTons(user) || hasTippedAlot(user); } permissions.hasAtLeastTippedAlot = hasAtLeastTippedAlot; /** * Has the user tipped recently? * @param user User to check */ function hasTipped(user) { return user.tipped_recently; } permissions.hasTipped = hasTipped; /** * Has the user at least tipped recently? * @param user User to check */ function hasAtLeastTipped(user) { return hasAtLeastTippedAlot(user) || hasTipped(user); } permissions.hasAtLeastTipped = hasAtLeastTipped; /** * Does the user have tokens? * @param user User to check */ function hasTokens(user) { return user.has_tokens; } permissions.hasTokens = hasTokens; /** * Does the user at least have tokens? * @param user User to check */ function hasAtLeastTokens(user) { return hasAtLeastTipped(user) || hasTokens(user); } permissions.hasAtLeastTokens = hasAtLeastTokens; /** * Prints the help for permissions * @param message Requesting message */ function help(message) { if (permissions.isAtLeastTrusted(message)) { notice.add("/trust,trusted"); } if (permissions.isBroadcaster(message)) { notice.add(emblems.blank + "add <User>+ --Entrust the users"); notice.add(emblems.blank + "del,delete,rem,remove <User>+ --Detrust the users"); } if (permissions.isAtLeastTrusted(message)) { notice.add(emblems.blank + "list --List all trusted users"); notice.post(message.user); } } permissions.help = help; /** * Try to parse a permissions command, returning true if a valid command is found * @param message Requesting message */ function tryParse(message) { if (permissions.isBroadcaster(message)) { var m = message.m.split(" "); if (m.length === 0) return false; var command = m.shift().toLowerCase(); switch (command) { case "/detrust": for (var _i = 0, m_1 = m; _i < m_1.length; _i++) { var user_3 = m_1[_i]; detrust(user_3); } return true; case "/entrust": for (var _a = 0, m_2 = m; _a < m_2.length; _a++) { var user_4 = m_2[_a]; entrust(user_4); } return true; case "/trust": case "/trusted": if (m.length === 0) return false; var operation = m.shift().toLowerCase(); switch (operation) { case "add": for (var _b = 0, m_3 = m; _b < m_3.length; _b++) { var user_5 = m_3[_b]; entrust(user_5); } return true; case "del": case "delete": case "rem": case "remove": for (var _c = 0, m_4 = m; _c < m_4.length; _c++) { var user_6 = m_4[_c]; detrust(user_6); } return true; case "help": help(message); return true; case "list": notice.send(trusted.join(", "), message.user); return true; default: return false; } } } return false; } permissions.tryParse = tryParse; })(permissions || (permissions = {})); var filter; (function (filter) { /** * Manages the advertisement filter */ var advertisements; (function (advertisements) { var profileVerbs = ["open", "look", "see", "peek", "tap", "check", "click", "visit"]; var profileNouns = ["profile", "bio", "page", "account"]; var camVerbs = ["open", "look", "see", "peek", "watch", "checl", "join", "lets", "let's", "want", "wants", "do"]; var camNouns = ["cam", "cam2", "2cam", "c2c", "c2", "2c"]; /** * Check a message for possible profile advertisements * @param message Message to check */ function checkProfile(message) { if (message.user === cb.room_slug) return; if (cb.settings.modexception == "on" && message.is_mod) return; if (cb.settings.fcexception == "on" && message.in_fanclub) return; var m = message.m.split(" "); var v = false; var n = false; for (var _i = 0, m_5 = m; _i < m_5.length; _i++) { var candidate = m_5[_i]; for (var _a = 0, profileVerbs_1 = profileVerbs; _a < profileVerbs_1.length; _a++) { var verb = profileVerbs_1[_a]; if (candidate.toLowerCase() === verb) { v = true; break; } } for (var _b = 0, profileNouns_1 = profileNouns; _b < profileNouns_1.length; _b++) { var noun = profileNouns_1[_b]; if (candidate.toLowerCase() === noun) { n = true; break; } } } if (v && n) { message['X-Spam'] = true; if (cb.settings.bcdetails == "on") { notice.send(emblems.gavel + message.user + ": '" + message.m + "' has been filtered for likely profile advertising", cb.room_slug); } else { notice.send(emblems.gavel + message.user + " has been filtered for likely profile advertising", cb.room_slug); } if (cb.settings.moddetails == "on") { notice.sendGroup(emblems.gavel + message.user + ": '" + message.m + "' has been filtered for likely profile advertising", "red"); } else { notice.sendGroup(emblems.gavel + message.user + " has been filtered for likely profile advertising", "red"); } } } advertisements.checkProfile = checkProfile; /** * Check a message for possible profile advertisements * @param message Message to check */ function checkCam(message) { if (message.user === cb.room_slug) return; if (cb.settings.modexception == "on" && message.is_mod) return; if (cb.settings.fcexception == "on" && message.in_fanclub) return; var m = message.m.split(" "); var v = false; var n = false; for (var _i = 0, m_6 = m; _i < m_6.length; _i++) { var candidate = m_6[_i]; for (var _a = 0, camVerbs_1 = camVerbs; _a < camVerbs_1.length; _a++) { var verb = camVerbs_1[_a]; if (candidate.toLowerCase() === verb) { v = true; break; } } for (var _b = 0, camNouns_1 = camNouns; _b < camNouns_1.length; _b++) { var noun = camNouns_1[_b]; if (candidate.toLowerCase() === noun) { n = true; break; } } } if (v && n) { message['X-Spam'] = true; if (cb.settings.bcdetails == "on") { notice.send(emblems.gavel + message.user + ": '" + message.m + "' has been filtered for likely cam advertising", cb.room_slug); } else { notice.send(emblems.gavel + message.user + " has been filtered for likely cam advertising", cb.room_slug); } if (cb.settings.moddetails == "on") { notice.sendGroup(emblems.gavel + message.user + ": '" + message.m + "' has been filtered for likely cam advertising", "red"); } else { notice.sendGroup(emblems.gavel + message.user + " has been filtered for likely cam advertising", "red"); } } } advertisements.checkCam = checkCam; })(advertisements = filter.advertisements || (filter.advertisements = {})); })(filter || (filter = {})); var bouncer; (function (bouncer) { function help(message) { dozer.help(message); notice.help(message); permissions.help(message); silences.help(message); } /** * Try to parse a bouncer command, returning true if a valid command is found * @param message Message to try to parse */ function tryParse(message) { var m = message.m.split(" "); if (m.length === 0) return false; var command = m.shift().toLowerCase(); switch (command) { case "/bouncer": if (m.length === 0) return false; var command_1 = m.shift().toLowerCase(); switch (command_1) { case "help": break; default: return false; } // This deliberately falls through case "/bouncerhelp": help(message); return true; default: return false; } } bouncer.tryParse = tryParse; })(bouncer || (bouncer = {})); var filter; (function (filter) { var level; (function (level) { level[level["grey"] = 0] = "grey"; level[level["lightblue"] = 1] = "lightblue"; level[level["darkblue"] = 2] = "darkblue"; level[level["lightpurple"] = 3] = "lightpurple"; level[level["darkpurple"] = 4] = "darkpurple"; level[level["green"] = 5] = "green"; level[level["red"] = 6] = "red"; level[level["orange"] = 7] = "orange"; })(level = filter.level || (filter.level = {})); ; })(filter || (filter = {})); var filter; (function (filter) { /** * Manages the graphic-level * For users not allowed to use graphics, the filter removes the emote from the message */ var graphiclevel; (function (graphiclevel) { /** * The set level of the filter */ graphiclevel.state = filter.level.grey; /** * Check a message against the set graphic level * @param message Message to check */ function check(message) { switch (graphiclevel.state) { case filter.level.grey: break; case filter.level.lightblue: if (!permissions.hasAtLeastTokens(message)) message.m = removeGraphics(message); break; case filter.level.darkblue: if (!permissions.hasAtLeastTipped(message)) message.m = removeGraphics(message); break; case filter.level.lightpurple: if (!permissions.hasAtLeastTippedAlot(message)) message.m = removeGraphics(message); break; case filter.level.darkpurple: if (!permissions.hasAtLeastTippedTons(message)) message.m = removeGraphics(message); break; case filter.level.green: if (!permissions.isAtLeastInFanclub(message)) message.m = removeGraphics(message); break; case filter.level.red: if (!permissions.isAtLeastModerator(message)) message.m = removeGraphics(message); break; case filter.level.orange: if (!permissions.isBroadcaster(message)) message.m = removeGraphics(message); break; } } graphiclevel.check = check; function removeGraphics(message) { var m = message.m.split(" "); var r = []; for (var _i = 0, m_7 = m; _i < m_7.length; _i++) { var word = m_7[_i]; if (word.charAt(0) != ":") { r[r.length] = word; } } return r.join(" "); } /** * Try to parse a valid graphiclevel command, returning true if a valid comand is found * @param message Requesting message */ function tryParse(message) { var m = message.m.split(" "); if (m.length === 0) return false; var command = m.shift().toLowerCase(); switch (command) { case "/graphic": if (m.length === 0) return false; var command_2 = m.shift().toLowerCase(); switch (command_2) { case "level": break; default: return false; } // This deliberately falls through case "/graphiclevel": if (m.length === 0) { notice.send(emblems.gavel + "Graphic Level: " + graphiclevel.state, message.user); return true; } if (!permissions.isAtLeastModerator(message)) return false; var set = m.join(" ").toLowerCase(); switch (set) { case "g": case "grey": case "gray": graphiclevel.state = filter.level.grey; notice.add("Graphic Level has been set"); notice.add("Only 'grey' and above may use graphics"); notice.apply(emblems.gavel); notice.post(); return true; case "lb": case "lightblue": case "light-blue": case "light blue": graphiclevel.state = filter.level.lightblue; notice.add("Graphic Level has been set"); notice.add("Only 'light blue' and above may use graphics"); notice.apply(emblems.gavel); notice.post(); return true; case "db": case "darkblue": case "dark-blue": case "dark blue": graphiclevel.state = filter.level.darkblue; notice.add("Graphic Level has been set"); notice.add("Only 'dark blue' and above may use graphics"); notice.apply(emblems.gavel); notice.post(); return true; case "lp": case "lightpurple": case "light-purple": case "light purple": graphiclevel.state = filter.level.lightpurple; notice.add("Graphic Level has been set"); notice.add("Only 'light purple' and above may use graphics"); notice.apply(emblems.gavel); notice.post(); return true; case "dp": case "darkpurple": case "dark-purple": case "dark purple": graphiclevel.state = filter.level.darkpurple; notice.add("Graphic Level has been set"); notice.add("Only 'dark purple' and above may use graphics"); notice.apply(emblems.gavel); notice.post(); return true; case "green": case "fan": case "fans": case "fanclub": case "fan club": graphiclevel.state = filter.level.green; notice.add("Graphic Level has been set"); notice.add("Only 'green' and above may use graphics"); notice.apply(emblems.gavel); notice.post(); return true; case "red": case "mod": case "mods": case "moderator": case "moderators": graphiclevel.state = filter.level.red; notice.add("Graphic Level has been set"); notice.add("Only 'red' and above may use graphics"); notice.apply(emblems.gavel); notice.post(); return true; case "orange": case "broadcaster": case "model": graphiclevel.state = filter.level.orange; notice.add("Graphic Level has been set"); notice.add("Only 'orange' and above may use graphics"); notice.apply(emblems.gavel); notice.post(); return true; default: return false; } default: return false; } } graphiclevel.tryParse = tryParse; })(graphiclevel = filter.graphiclevel || (filter.graphiclevel = {})); })(filter || (filter = {})); /** * Manages silences */ var silences; /** * Manages silences */ (function (silences) { /** * Users who have been silenced */ var silenced = []; /** * Users who have been unsilenced */ var unsilenced = []; function help(message) { if (permissions.isAtLeastModerator(message)) { notice.add("/silence <users>+ --Silence the specified users"); notice.add("/unsilence <users>+ --Unsilence the specified users"); notice.post(message.user); message['X-Spam'] = true; } } silences.help = help; /** * Is the user silenced? * @param user */ function isSilenced(user) { return cbjs.arrayContains(silenced, user); } silences.isSilenced = isSilenced; /** * Is the user unsilenced? * @param user */ function isUnsilenced(user) { return cbjs.arrayContains(unsilenced, user); } silences.isUnsilenced = isUnsilenced; /** * Silence the user * @param user Username of the user */ function silence(user) { if (cbjs.arrayContains(unsilenced, user)) { unsilenced = cbjs.arrayRemove(unsilenced, user); } silenced[silenced.length] = user; } silences.silence = silence; /** * Unsilence the user * @param user Username of the user */ function unsilence(user) { if (cbjs.arrayContains(silenced, user)) { silenced = cbjs.arrayRemove(silenced, user); } unsilenced[unsilenced.length] = user; } silences.unsilence = unsilence; /** * Try to parse a valid silence command, returning true if a valid command is found * @param message Requesting message */ function tryParse(message) { if (!permissions.isAtLeastModerator(message)) return false; var m = message.m.split(" "); if (m.length === 0) return false; var command = m.shift().toLowerCase(); switch (command) { case "/silence": if (m.length === 0) return false; for (var _i = 0, m_8 = m; _i < m_8.length; _i++) { var user_7 = m_8[_i]; silence(user_7); } notice.sendGroup(emblems.gavel + "Silenced users: " + m, "red"); notice.send(emblems.gavel + "Silenced users: " + m, cb.room_slug); return true; case "/unsilence": if (m.length === 0) return false; for (var _a = 0, m_9 = m; _a < m_9.length; _a++) { var user_8 = m_9[_a]; unsilence(user_8); } notice.sendGroup(emblems.gavel + "Unsilenced users: " + m, "red"); notice.send(emblems.gavel + "Unsilenced users: " + m, cb.room_slug); return true; default: return false; } } silences.tryParse = tryParse; })(silences || (silences = {})); var filter; (function (filter) { /** * Manages the dirty talk filter */ var dirtytalk; (function (dirtytalk) { var verbs = ["have", "got", "get", "see", "so", "make", "makes", "cumming", "nice", "sweet"]; var nouns = ["boner", "hardon", "hard", "dick", "load", "cum", "pussy", "cunt", "vagina"]; /** * Check the message for possible dirty talk * @param message Message to check */ function check(message) { if (message.user === cb.room_slug) return; if (cb.settings.modexception == "on" && message.is_mod) return; if (cb.settings.fcexception == "on" && message.in_fanclub) return; var m = message.m.split(" "); var v = false; var n = false; for (var _i = 0, m_10 = m; _i < m_10.length; _i++) { var candidate = m_10[_i]; for (var _a = 0, verbs_1 = verbs; _a < verbs_1.length; _a++) { var verb = verbs_1[_a]; if (candidate.toLowerCase() === verb) { v = true; break; } } for (var _b = 0, nouns_1 = nouns; _b < nouns_1.length; _b++) { var noun = nouns_1[_b]; if (candidate.toLowerCase() === noun) { n = true; break; } } } if (v && n) { if (cb.settings.bcdetails == "on") { notice.send(emblems.gavel + message.user + ": '" + message.m + "' has been filtered for likely dirty talk", cb.room_slug); } else { notice.send(emblems.gavel + message.user + " has been filtered for likely dirty talk", cb.room_slug); } if (cb.settings.moddetails == "on") { notice.sendGroup(emblems.gavel + message.user + ": '" + message.m + "' has been filtered for likely dirty talk", "red"); } else { notice.sendGroup(emblems.gavel + message.user + " has been filtered for likely dirty talk", "red"); } } } dirtytalk.check = check; })(dirtytalk = filter.dirtytalk || (filter.dirtytalk = {})); })(filter || (filter = {})); var filter; (function (filter) { /** * Manages the demand filter */ var demands; (function (demands) { var verbs = ["open", "spread", "show", "finger", "fist", "touch", "zoom", "want", "have"]; var nouns = ["pussy", "cunt", "vagina", "bob", "boob", "tit", "ass", "bum", "butt", "arse", "feet", "foot", "hole", "sex"]; /** * Check the message for possible demands * @param message Message to check */ function check(message) { if (message.user === cb.room_slug) return; if (cb.settings.modexception == "on" && message.is_mod) return; if (cb.settings.fcexception == "on" && message.in_fanclub) return; var m = message.m.split(" "); var v = false; var n = false; for (var _i = 0, m_11 = m; _i < m_11.length; _i++) { var candidate = m_11[_i]; for (var _a = 0, verbs_2 = verbs; _a < verbs_2.length; _a++) { var verb = verbs_2[_a]; if (candidate.toLowerCase() === verb) { v = true; break; } } for (var _b = 0, nouns_2 = nouns; _b < nouns_2.length; _b++) { var noun = nouns_2[_b]; if (candidate.toLowerCase() === noun) { n = true; break; } } } if (v && n) { message['X-Spam'] = true; if (cb.settings.bcdetails == "on") { notice.send(emblems.gavel + message.user + ": '" + message.m + "' has been filtered for likely demanding", cb.room_slug); } else { notice.send(emblems.gavel + message.user + " has been filtered for likely demanding", cb.room_slug); } if (cb.settings.moddetails == "on") { notice.sendGroup(emblems.gavel + message.user + ": '" + message.m + "' has been filtered for likely demanding", "red"); } else { notice.sendGroup(emblems.gavel + message.user + " has been filtered for likely demanding", "red"); } } } demands.check = check; })(demands = filter.demands || (filter.demands = {})); })(filter || (filter = {})); var filter; (function (filter) { /** * Manages the silence-level * For users not allowed to post messages, the filter marks them as spam */ var silencelevel; (function (silencelevel) { /** * The set level of the filter */ silencelevel.state = filter.level.grey; /** * Check a message against the set silence level * @param message Message to check */ function check(message) { switch (silencelevel.state) { case filter.level.grey: break; case filter.level.lightblue: if (!permissions.hasAtLeastTokens(message)) { message['X-Spam'] = true; } break; case filter.level.darkblue: if (!permissions.hasAtLeastTipped(message)) { message['X-Spam'] = true; } break; case filter.level.lightpurple: if (!permissions.hasAtLeastTippedAlot(message)) { message['X-Spam'] = true; } break; case filter.level.darkpurple: if (!permissions.hasAtLeastTippedTons(message)) { message['X-Spam'] = true; } break; case filter.level.green: if (!permissions.isAtLeastInFanclub(message)) { message['X-Spam'] = true; } break; case filter.level.red: if (!permissions.isAtLeastModerator(message)) { message['X-Spam'] = true; } break; case filter.level.orange: if (!permissions.isBroadcaster(message)) { message['X-Spam'] = true; } break; } } silencelevel.check = check; /** * Try to parse a valid graphiclevel command, returning true if a valid comand is found * @param message Requesting message */ function tryParse(message) { var m = message.m.split(" "); if (m.length === 0) return false; var command = m.shift().toLowerCase(); switch (command) { case "/silence": if (m.length === 0) return false; var command_3 = m.shift().toLowerCase(); switch (command_3) { case "level": break; default: return false; } // This deliberately falls through case "/silencelevel": if (m.length === 0) { notice.send(emblems.gavel + "Silence Level: " + silencelevel.state, message.user); return true; } if (!permissions.isAtLeastModerator(message)) return false; var set = m.join(" ").toLowerCase(); switch (set) { case "g": case "grey": case "gray": silencelevel.state = filter.level.grey; notice.add("Silence Level has been set"); notice.add("Only 'grey' and above may post messages"); notice.apply(emblems.gavel); notice.post(); return true; case "lb": case "lightblue": case "light-blue": case "light blue": silencelevel.state = filter.level.lightblue; notice.add("Silence Level has been set"); notice.add("Only 'light blue' and above may post messages"); notice.apply(emblems.gavel); notice.post(); return true; case "db": case "darkblue": case "dark-blue": case "dark blue": silencelevel.state = filter.level.darkblue; notice.add("Silence Level has been set"); notice.add("Only 'dark blue' and above may post messages"); notice.apply(emblems.gavel); notice.post(); return true; case "lp": case "lightpurple": case "light-purple": case "light purple": silencelevel.state = filter.level.lightpurple; notice.add("Silence Level has been set"); notice.add("Only 'light purple' and above may post messages"); notice.apply(emblems.gavel); notice.post(); return true; case "dp": case "darkpurple": case "dark-purple": case "dark purple": silencelevel.state = filter.level.darkpurple; notice.add("Silence Level has been set"); notice.add("Only 'dark purple' and above may post messages"); notice.apply(emblems.gavel); notice.post(); return true; case "green": case "fan": case "fans": case "fanclub": case "fan club": silencelevel.state = filter.level.green; notice.add("Silence Level has been set"); notice.add("Only 'green' and above may post messages"); notice.apply(emblems.gavel); notice.post(); return true; case "red": case "mod": case "mods": case "moderator": case "moderators": silencelevel.state = filter.level.red; notice.add("Silence Level has been set"); notice.add("Only 'red' and above may post messages"); notice.apply(emblems.gavel); notice.post(); return true; case "orange": case "broadcaster": case "model": silencelevel.state = filter.level.orange; notice.add("Silence Level has been set"); notice.add("Only 'orange' and above may post messages"); notice.apply(emblems.gavel); notice.post(); return true; default: return false; } default: return false; } } silencelevel.tryParse = tryParse; })(silencelevel = filter.silencelevel || (filter.silencelevel = {})); })(filter || (filter = {})); var filter; (function (filter) { /** * Manages the website filter */ var website; (function (website) { /** * Check a message for possible websites * @param message Message to check */ function check(message) { if (message.user === cb.room_slug) return; if (cb.settings.modexception == "on" && message.is_mod) return; if (cb.settings.fcexception == "on" && message.in_fanclub) return; var m = message.m.split(" "); for (var _i = 0, m_12 = m; _i < m_12.length; _i++) { var candidate = m_12[_i]; if (candidate.match(/\w+\.\w+\.\w+/)) { message['X-Spam'] = true; break; } } if (message['X-Spam']) { if (cb.settings.bcdetails == "on") { notice.send(emblems.gavel + message.user + ": '" + message.m + "' has been filtered for likely website links", cb.room_slug); } else { notice.send(emblems.gavel + message.user + " has been filtered for likely website links", cb.room_slug); } if (cb.settings.moddetails == "on") { notice.sendGroup(emblems.gavel + message.user + ": '" + message.m + "' has been filtered for likely website links", "red"); } else { notice.sendGroup(emblems.gavel + message.user + " has been filtered for likely website links", "red"); } } } website.check = check; })(website = filter.website || (filter.website = {})); })(filter || (filter = {})); var filter; (function (filter) { /** * Manages the bot filter * This implementation will change to coincide with whatever easily caught bots are currently plaguing CB. More sophisticated bots should be caught with the same heuristics for general chat; improve those instead. */ var bot; (function (bot) { /** * Check a message for chatbot language * @param message Message to check */ function check(message) { if (message.user === cb.room_slug) return; if (cb.settings.modexception == "on" && message.is_mod) return; if (cb.settings.fcexception == "on" && message.in_fanclub) return; var m = message.m.split(" "); for (var _i = 0, m_13 = m; _i < m_13.length; _i++) { var candidate = m_13[_i]; if (candidate.match(/m(.|\s)*a(.|\s)*y(.|\s)*b(.|\s)*e(.|\s)*s(.|\s)*e(.|\s)*x/i)) { message['X-Spam'] = true; break; } if (candidate.match(/m(.|\s)*a(.|\s)*y(.|\s)*b(.|\s)*e(.|\s)*p(.|\s)*r(.|\s)*i(.|\s)*v(.|\s)*a(.|\s)*t(.|\s)*e/i)) { message['X-Spam'] = true; break; } } if (message['X-Spam']) { if (cb.settings.bcdetails == "on") { notice.send(emblems.gavel + message.user + ": '" + message.m + "' has been filtered for likely being a bot", cb.room_slug); } else { notice.send(emblems.gavel + message.user + " has been filtered for likely being a bot", cb.room_slug); } if (cb.settings.moddetails == "on") { notice.sendGroup(emblems.gavel + message.user + ": '" + message.m + "' has been filtered for likely being a bot", "red"); } else { notice.sendGroup(emblems.gavel + message.user + " has been filtered for likely being a bot", "red"); } } } bot.check = check; })(bot = filter.bot || (filter.bot = {})); })(filter || (filter = {})); var filter; (function (filter) { /** * Manages the character filter */ var char; (function (char) { /** * Check a message for disallowed characters * @param message Message to check */ function check(message) { if (message.user === cb.room_slug) return; if (cb.settings.modexception == "on" && message.is_mod) return; if (cb.settings.fcexception == "on" && message.in_fanclub) return; for (var _i = 0, _a = message.m; _i < _a.length; _i++) { var candidate = _a[_i]; if (candidate.match(/\w/)) { continue; } else if (candidate.match(/\d/)) { continue; } else if (candidate.match(/\s/)) { continue; } else if (candidate.match(/[!@#$%^&*-=_+`~[]{}\|;':",.<>]/)) { continue; } else { message['X-Spam'] = false; } } if (message['X-Spam']) { if (cb.settings.bcdetails == "on") { notice.send(emblems.gavel + message.user + ": '" + message.m + "' has been filtered for character use that is often used by bots", cb.room_slug); } else { notice.send(emblems.gavel + message.user + " has been filtered for character use that is often used by bots", cb.room_slug); } if (cb.settings.moddetails == "on") { notice.sendGroup(emblems.gavel + message.user + ": '" + message.m + "' has been filtered for character use that is often used by bots", "red"); } else { notice.sendGroup(emblems.gavel + message.user + " has been filtered for character use that is often used by bots", "red"); } } } char.check = check; })(char = filter.char || (filter.char = {})); })(filter || (filter = {})); var cb; (function (cb) { cb.settings_choices = [ { name: "silencelevel", label: "Silence Level", type: "choice", choice1: "grey", choice2: "lightblue", choice3: "darkblue", choice4: "lightpurple", choice5: "darkpurple", choice6: "green", choice7: "red", choice8: "orange", required: true, }, { name: "graphiclevel", label: "Graphic Level", type: "choice", choice1: "grey", choice2: "lightblue", choice3: "darkblue", choice4: "lightpurple", choice5: "darkpurple", choice6: "green", choice7: "red", choice8: "orange", required: true, }, { name: "adfilter", label: "Advertisement Filter", type: "choice", choice1: "on", choice2: "off", defaultValue: "on", required: true, }, { name: "botfilter", label: "Bot Filter", type: "choice", choice1: "on", choice2: "off", defaultValue: "on", required: true, }, { name: "charfilter", label: "Character Filter", type: "choice", choice1: "on", choice2: "off", defaultValue: "off", required: true, }, { name: "demandfilter", label: "Demand Filter", type: "choice", choice1: "on", choice2: "off", defaultValue: "on", required: true, }, { name: "dirtytalkfilter", label: "Dirty Talk Filter", type: "choice", choice1: "on", choice2: "off", defaultValue: "on", required: true, }, { name: "websitefilter", label: "Website Filter", type: "choice", choice1: "on", choice2: "off", defaultValue: "on", required: true, }, { name: "bcdetails", label: "Filter Details: Broadcaster", type: "choice", choice1: "on", choice2: "off", defaultValue: "on", required: true, }, { name: "moddetails", label: "Filter Details: Moderator", type: "choice", choice1: "on", choice2: "off", defaultValue: "on", required: true, }, { name: "modexception", label: "Filter Exception: Moderators", type: "choice", choice1: "on", choice2: "off", defaultValue: "on", required: true, }, { name: "fcexception", label: "Filter Exception: Fanclub", type: "choice", choice1: "on", choice2: "off", defaultValue: "on", required: true, } ]; })(cb || (cb = {})); cb.onEnter(function (user) { notice.send("This room is protected by BouncerBot", user.user); }); cb.onMessage(function (message) { // Mark message as spam if a foreslash is found at the begining if (message.m.trim().charAt(0) === "/") message['X-Spam'] = true; /** Whether a valid command has been found while parsing */ var validCommand = false; // Attempt to parse a command // This is goal-directed parsing, essentially, JavaScript just doesn't have any good syntax for it // While a command has not been found, keep trying to parse commands // When a command has been found, mark it as spam, which in turn avoids further attempts at parsing if (!validCommand) { validCommand = bouncer.tryParse(message); } if (!validCommand) { validCommand = dozer.tryParse(message); } if (!validCommand) { validCommand = filter.graphiclevel.tryParse(message); } if (!validCommand) { validCommand = filter.silencelevel.tryParse(message); } if (!validCommand) { validCommand = permissions.tryParse(message); } if (!validCommand) { validCommand = silences.tryParse(message); } if (message['X-Spam'] || validCommand) return message; // Run the filters on the message filter.silencelevel.check(message); filter.graphiclevel.check(message); if (silences.isSilenced(message.user)) { message['X-Spam'] = true; } if (silences.isUnsilenced(message.user)) { message['X-Spam'] = false; } if (!message['X-Spam'] && cb.settings.botfilter == "on") filter.bot.check(message); if (!message['X-Spam'] && cb.settings.charfilter == "on") filter.char.check(message); if (!message['X-Spam'] && cb.settings.adfilter == "on") filter.advertisements.checkCam(message); if (!message['X-Spam'] && cb.settings.adfilter == "on") filter.advertisements.checkProfile(message); if (!message['X-Spam'] && cb.settings.demandfilter == "on") filter.demands.check(message); if (!message['X-Spam'] && cb.settings.dirtytalkfilter == "on") filter.dirtytalk.check(message); if (!message['X-Spam'] && cb.settings.websitefilter == "on") filter.website.check(message); return message; }); /** * Initialization Code */ { notice.color = "#802020"; switch (cb.settings.graphiclevel) { case "grey": filter.graphiclevel.state = filter.level.grey; break; case "lightblue": filter.graphiclevel.state = filter.level.lightblue; break; case "darkblue": filter.graphiclevel.state = filter.level.darkblue; break; case "lightpurple": filter.graphiclevel.state = filter.level.lightpurple; break; case "darkpurple": filter.graphiclevel.state = filter.level.darkpurple; break; case "green": filter.graphiclevel.state = filter.level.green; break; case "red": filter.graphiclevel.state = filter.level.red; break; case "orange": filter.graphiclevel.state = filter.level.orange; break; } switch (cb.settings.silencelevel) { case "grey": filter.silencelevel.state = filter.level.grey; break; case "lightblue": filter.silencelevel.state = filter.level.lightblue; break; case "darkblue": filter.silencelevel.state = filter.level.darkblue; break; case "lightpurple": filter.silencelevel.state = filter.level.lightpurple; break; case "darkpurple": filter.silencelevel.state = filter.level.darkpurple; break; case "green": filter.silencelevel.state = filter.level.green; break; case "red": filter.silencelevel.state = filter.level.red; break; case "orange": filter.silencelevel.state = filter.level.orange; break; } }
© Copyright Chaturbate 2011- 2024. All Rights Reserved.