Bots Home
|
Create an App
SpamBlocker
Author:
masta_shake
Description
Source Code
Launch Bot
Current Users
Created by:
Masta_Shake
cb.settings_choices = [{name:"timer", type:"int", label:"Number of seconds greys are prevented from chatting", defaultValue:10, minValue:1}]; var timeBlocked = cb.settings.timer, room = {inRoom:function(a) { return a in room.users; }, addUser:function(a) { room.users[a] = {msgs:[], timeEntered:Date.now()}; }, checkSpam:function(a) { for (var b in room.users) { room.users.hasOwnProperty(b) && room.users[b].msgs.forEach(function(c) { cb.sendNotice(b + ":" + c, a); }); } }, getCmd:function(a) { return a.split(" ")[0].substring(1); }, getArgs:function(a) { a = a.match(/[#a-z0-9]+/gi); room.arrayRemove(a, a[0]); return a; }, arrayRemove:function(a, b) { for (var c = a.indexOf(b); -1 < c;) { a.splice(c, 1), c = a.indexOf(b); } }, changeTimer:function(a) { a = a.match(/\d+/g); return null !== a ? parseInt(a.toString().replace(/,*/g, "")) : !1; }, users:{}}; cb.onEnter(function(a) { var b = a.user, c = b == cb.room_slug, d = a.is_mod, e = a.in_fanclub; a.has_tokens || e || d || c || room.inRoom(b) || room.addUser(b); }); cb.onMessage(function(a) { var b = a.user, c = b == cb.room_slug, d = a.is_mod, e = a.in_fanclub, f = !a.has_tokens && !e && !d && !c, h = "i0_ol" == b; e = a.m.replace(/\s+/g, " ").trim().toLowerCase(); var g = !1; f && (room.inRoom(b) || room.addUser(b), f = (Date.now() - room.users[b].timeEntered) / 1000, f = timeBlocked - f, 0 < f && (a["X-Spam"] = !0, room.users[b].msgs.unshift(a.m), cb.sendNotice("To prevent spam, your messages are blocked for " + Math.round(f) + " more seconds", b))); if (c || d || h) { "/" === e.charAt(0) && (g = !0, a["X-Spam"] = !0), g && (c = room.getCmd(e), d = room.getArgs(e)[0], "spam" === c && room.checkSpam(b), "timeout" === c && (d && /\d+/.test(d) ? (timeBlocked = room.changeTimer(d), cb.sendNotice("AntiBot timeout set to " + timeBlocked + " seconds", b)) : cb.sendNotice("Current timeout is set to " + timeBlocked + " seconds", b))); } return a; });
© Copyright Chaturbate 2011- 2024. All Rights Reserved.