Bots Home
|
Create an App
xbtest2
Author:
xeno_test4
Description
Source Code
Launch Bot
Current Users
Created by:
Xeno_Test4
cb.settings_choices = [ { name:'remove', type:'choice', choice1:'yes', choice2:'no', defaultValue:'yes', label: 'Remove spam messages' }, { name:'notify_me', type:'choice', choice1:'yes', choice2:'no', defaultValue:'yes', label: 'Tell me what was removed' }, { name:'notify_sender', type:'choice', choice1:'yes', choice2:'no', defaultValue:'yes', label: 'Tell sender his message was removed' }, ]; var filters = [ [ true, "^.?c2c$", "^.?boys$" ], [ true, "^.?checkoutmy$", ".?^(pics?|bio)$" ], [ true, "^.?lookat$", "^.?me$" ], [ true, "^.?sexwith$", "^.?meguys$" ], [ true, "^.?watch$", "^.?meguys$" ], [ true, "^.?watchmy$", "^.?(pics?|bio)$" ], [ false, '--> sextop\\.pw$', null ], [ false, '--> sexgirls\\.pw$', null ], ]; var users = {}; var firstOffenders = {}; function filterLine0(str) { for (var i = 0; i < filters.length; i++) { var rec = filters[i]; var compact = rec[0]; var re = new RegExp(rec[1], "u"); var ss = (compact ? str.toLowerCase().replace(/ /g, '') : str); if (re.test(ss)) { return rec; } } return null; } function filterLine1(str, rec) { if (!rec || !rec[2]) return false; var compact = rec[0]; var re = new RegExp(rec[2], "u"); var ss = (compact ? str.toLowerCase().replace(/ /g, '') : str); return re.test(ss); } cb.onMessage(function (msg) { //if (msg["has_tokens"]) // return msg; var text = msg["m"]; var user = msg["user"]; var userPost = users[user]; if (!userPost) userPost = 0; users[user] = userPost + 1; if (userPost >= 2) return msg; if (userPost == 0) { var rec = filterLine0(text); if (!rec) return msg; firstOffenders[user] = rec; } if (userPost == 1) { var rec = firstOffenders[user]; if (!filterLine1(text, rec)) return msg; } var warning = "Spam: " + user + ": " + text; if (cb.settings.notify_me != 'no') cb.sendNotice(warning, cb.room_slug, "#FFFFFF", "#FF8080", "bold", null); if (cb.settings.notify_sender == 'yes') cb.sendNotice("Sorry, your message was removed by spam filter. " + "Please say something else or buy tokens.", user, "#FFFFFF", "#FF8080", "bold", null); if (cb.settings.remove == 'yes') msg['X-Spam'] = true; return msg; });
© Copyright Chaturbate 2011- 2024. All Rights Reserved.