-- Modified Lucifer Script for Hubs with regged Users
-- Here its features:
-- Script blocks this types of advertisement: A) example.no-ip.com
-- B) e x a m p l e . n o - i p . c o m
-- C)example.
-- no-
-- ip.
-- com
-- D)e
-- x
-- a
-- m
-- p
-- l
-- e
-- .
-- n
-- o
-- -
-- i
-- p
-- .
-- c
-- o
-- m
--
-- 1)added a "smart" list of addresses (be careful when adding URLs or IPs, if you put "http" in validstrings it will allow ALL URLs same if you add an empty string "",
-- so if you have to add something there use a very specific word of the URL like "imdb" if you want to allow the Internet Movie Database)
-- 2)Profiles Regged and above can post without restrictions
-- 3)When advertising: OPs get message in Mainchat from Bot showing the Ad
-- For Op's eyes only! Nick is advertising this in MainChat: Advertisement
-- For Op's eyes only! Nick is advertising this in PM: Advertisement
-- 4)Prevented very splitted addresses (with more tabAdvert lines)
--
--
BotName = "YourBotName"
advtrigs = {"dns2go.","mine.nu","no-ip.","dynip.","staticip.","gotdns.","dyndns.","d2g.","myip.","mine.org",
"kick-ass.","homeip.","bounceme.","http://","www.","ftp://","irc."}
validtrigs = {"imdb","-----", "------"}
tabAdvert = {}
function Main()
frmHub:RegBot(BotName)
end
function DataArrival(user, data)
if not user.bOperator then
if strsub(data, 1, 1) == "<" then
local _, _, msg = strfind(data, "^%b<>%s+(.*)|")
if Verify(user.sName, msg) then
if user.iProfile == 3 or user.iProfile == 2 then
return msg
else
SendToOps(BotName,"For Op's eyes only! "..user.sName.." is advertising this in MainChat: "..msg)
return 1
end
end
spam=0
if( strfind( strlower(data), "no",1,1) ) and ( strfind( strlower(data), "ip.",1,1) ) then
if ( strfind( strlower(data), "com",1,1) ) or ( strfind( strlower(data), "org",1,1) ) or ( strfind( strlower(data), "info",1,1) ) then
spam=spam+1; end; end;
if( strfind( strlower(data), "dns",1,1) ) and ( strfind( strlower(data), "2",1,1) ) and ( strfind( strlower(data), "go",1,1) ) then
spam=spam+1; end
if( strfind( strlower(data), "dy",1,1) ) and ( strfind( strlower(data), "nu",1,1) ) then
if( strfind( strlower(data), ".net",1,1) ) or ( strfind( strlower(data), ".com",1,1) ) then
spam=spam+1;end; end
if( strfind( strlower(data), "d n s a",1,1) ) or ( strfind( strlower(data), "d n s .",1,1) ) or ( strfind( strlower(data), "d n s 2",1,1) ) or ( strfind( strlower(data), "o d s .",1,1) ) or ( strfind( strlower(data), "d y n",1,1) ) then
spam=spam+1;end
if spam>0 then
SendToOps(BotName,"For Op's eyes only! "..user.sName.." is advertising this in MainChat: "..msg)
end
elseif strsub(data, 1, 4) == "$To:" then
local _, _, to, from, msg = strfind(data, "^%$To:%s+(%S+)%s+From:%s+(%S+)%s-%$%b<>%s+(.*)|")
local nick = GetItemByName(to)
if not nick.bOperator then
local userdata = to.." "..from
if Verify(userdata, msg) then
if user.iProfile == 3 or user.iProfile == 2 then
return msg
else
SendToOps(BotName,"For Op's eyes only! "..user.sName.." is advertising this in PM: "..msg)
return 1
end
end
spam=0
if( strfind( strlower(data), "no",1,1) ) and ( strfind( strlower(data), "ip.",1,1) ) then
if ( strfind( strlower(data), "com",1,1) ) or ( strfind( strlower(data), "org",1,1) ) or ( strfind( strlower(data), "info",1,1) ) then
spam=spam+1; end; end;
if( strfind( strlower(data), "dns",1,1) ) and ( strfind( strlower(data), "2",1,1) ) and ( strfind( strlower(data), "go",1,1) ) then
spam=spam+1; end
if( strfind( strlower(data), "dy",1,1) ) and ( strfind( strlower(data), "nu",1,1) ) then
if( strfind( strlower(data), ".net",1,1) ) or ( strfind( strlower(data), ".com",1,1) ) then
spam=spam+1;end; end
if( strfind( strlower(data), "d n s a",1,1) ) or ( strfind( strlower(data), "d n s .",1,1) ) or ( strfind( strlower(data), "d n s 2",1,1) ) or ( strfind( strlower(data), "o d s .",1,1) ) or ( strfind( strlower(data), "d y n",1,1) ) then
spam=spam+1;end
if spam>0 then
SendToOps(BotName,"For Op's eyes only! "..user.sName.." is advertising this in PM: "..msg)
end
end
end
end
end
function Verify(userdata, msg)
if not msg then return end
tmp =""
gsub(strlower(msg), "([a-z0-9.:%-])", function(x) tmp = tmp..x end)
if not tabAdvert[userdata] then
tabAdvert[userdata] = { iClock = clock(), l1 = "", l2 = "", l3 = "", l4= "", l5= "",l6= "",l7= "",l8= "",l9 = tmp}
else
tabAdvert[userdata].iClock = clock()
tabAdvert[userdata].l1 = tabAdvert[userdata].l2
tabAdvert[userdata].l2 = tabAdvert[userdata].l3
tabAdvert[userdata].l3 = tabAdvert[userdata].l4
tabAdvert[userdata].l4 = tabAdvert[userdata].l5
tabAdvert[userdata].l5 = tabAdvert[userdata].l6
tabAdvert[userdata].l6 = tabAdvert[userdata].l7
tabAdvert[userdata].l7 = tabAdvert[userdata].l8
tabAdvert[userdata].l8 = tabAdvert[userdata].l9
tabAdvert[userdata].l9 = tmp
end
local Lines = tabAdvert[userdata].l1..tabAdvert[userdata].l2..tabAdvert[userdata].l3..tabAdvert[userdata].l4..tabAdvert[userdata].l5..tabAdvert[userdata].l6..tabAdvert[userdata].l7..tabAdvert[userdata].l8..tabAdvert[userdata].l9
for key, value in advtrigs do
if (strfind(Lines, strlower(value), 1, 1)) then
for key2, value2 in validtrigs do
if (strfind(Lines, strlower(value2), 1, 1)) then
return nil
end
end
return 1
end
end
end
hi,
wanna test asap
i have this error:
Syntax error: attempt to index local `nick' (a nil value)
stack traceback:
1: function `DataArrival' at line 88 [file `C:..\scripts\Lucifer.lua']
well i tested it i didnt get any errors but it let me send the addy in pm but it blocked it in the main
works for me when you change "http://" --> "http"
in the advtrigs list.
oh. and when you send it in PM...it looks for the sender like he sent the PM. if the bot sends a message to mainchat that there was a PM advertizement then it was blocked. and all users who have a reg profile can send what they want.