PtokaX forum

Archive => Archived 4.0 boards => Finished Lua 4 scripts => Topic started by: Pacman on 28 December, 2003, 02:21:26

Title: Drackbot
Post by: Pacman on 28 December, 2003, 02:21:26
hi there,

i have finished up on modding and adding to a script, and have started to change alot of things and after a bit of thinking i decided to share the release with you all, here is the >> link << (http://members.lycos.co.uk/garfvader/Drackobot.zip)  to download it.

any feedback you give me would be great as this is my first go at modding a script and adding new extensions for a bot.

// Pacman
Title:
Post by: pHaTTy on 28 December, 2003, 02:25:04
well those were the days.... :))

i was not much of a scripter, i had alot of bad and good features in that engine, and tab was not a big priority to me, so i feel ashamed i even let the source go on that bot lol so i decided to refresh my stregth and refix a few on my old engine, i hope you do a good job, it will be nice seing G-Engine go in 2 differ directions alo i have wrote 5 differ engines for the gekko series lol

here you go ;)


--// [Drackobot]
--// [Based on phatty's Gekko v2.03 bot engine]
--// [Modded/addition by Pacman]
--// [Cleaned up engine by Phatty]

--// [Start of Hub-Setup] \\--

Bot = "[DrackO-Bot]" -- Botname
OPchat = "[Op-Chat]" -- Op-chat name
Hubowner = "Pacman" -- Hubowner
HubtagPrefix = "[AG/SA]" -- Tag prefix for regged users
ScriptVersion = "1.0" -- Current script version
commandprefix = "#" -- Prefix for commands
Allownotags=yes -- yes or no
Redirect = "127.0.0.1" -- redirect adress for no tags

--// [Start of Hub-Commands] \\--

hubinfo = "hubinfo"
opshelp = "opshelp"
faq = "faq"
help = "help"
website = "website"
network = "network"
rules = "rules"
network = "network"
rules = "rules"
myip = "myip"
pmbot = "##"
hubdetails = "hubdet"
unhidebot = "unhide"
hidebot = "hide"
sethubname = "sethubname"
nameban = "nban"
kickban = "kickban"
kick = "kick"
me = "me"
bottrigson = "trigon"
bottrigsoff = "trigoff"
afkcmd = "afk"
backcmd = "re"
selfregcmd = "regme"
cleartempban = "clrtemp"
whiteout = "whiteout"
scriptversioncmd = "version"
timecmd = "time"



goneArr={}

aMsgs = {
          BadSyntax  = "Use "..commandprefix..""..selfregcmd.." .",
          RequireTag = "You need to have "..HubtagPrefix.." in front of your nick in order to register!",
          ReConnect  = "Registration complete, please relogin.",
          UserExists = "nick is already registered user stupid -.-",
        }


forbiddenWords = {
"_koala",
"mldonkey",
"mldc",
"_om",
"XKing",
"repika",
"pepek",
"0.233B",
"0.233A",
"0.181fr",
"0.241A",
"0.24A",
"[FC",
"[FC-HQ]",
"(FC)",
"(FC-HQ)"
}

valid = {
"anime-gate.no-ip.org",
"Animegold.myftp.biz",
"www.Hubs-inc.com",
"http://Hubs-inc.com"
}

tabAdvert = {}

badShare = {
"10000000000","5368709120","10737418240","13630010000","16106127360",
"21474836480","26843545600","27000000000","32212254720","7970010000",
"37580963840","37970010000","6599201000000","65992010000000","36772010000000",
"3677201000000","42949672960","48318382080","214266156265","53687091200",
"59055800320","1747201000000","16772010000000","147720100000000","10240000000000",
"64424509440","65719010000","69793218560","75161927680","80530636800","85899345920",
"91268055040","96636764160","102005473280","102400000000","107374182400","118648471552",
"128849018880","140301549174","161061273600","174720100000","183287729356","214748364800",
"268435456000","322122547200","375809638400","397760100000","429496729600","536870912000",
"657190100000","1024000000000","183287729357","102392020337","13625783747","174719269601",
"65712999629","26993869455","140295106724","199715979264"
}

Files = {
--["F?T?0?7?preteen"]="Please don't share preteen porn in here!",
--["F?T?0?6?preteen"]="Please don't share preteen porn in here!",
--["F?T?0?7?incest"]="Please don't share incest porn in here!",
--["F?T?0?7?-moi$lolita"]="Please don't share lolita porn in here!",
--["F?T?0?6?-moi$lolita"]="Please don't share lolita porn in here!",
--["F?F?0?1?MyList.bz2"]="Do not share unzipped DC folder here!",
--["F?F?0?1?.tmp"]="Do not share temporaly files here!",
--["F?F?0?1?__incomplete__"]="Do not share incompleted files here!",
--["F?F?0?1?taskman.exe"]="Do not share Windows directory here!",
--["F?F?0?1?msoobe.exe"]="Do not share Program Files directory here!",
--["F?F?0?1?hmmapi.dll"]="Do not share Program Files directory here!",
--["F?F?0?1?MyList.DcLst"]="Do not share unzipped DC folder here!",
--["F?F?0?1?msimn.exe"]="Do not share Program Files directory here!",
--["F?F?0?1?windowsshell.manifest"]="Do not share Windows directory here!",
--["F?F?0?1?explorer.scf"]="Do not share Windows directory here!",
}

trigall=1
RepFile="files/trigs.txt"

function Main()
frmHub:RegBot(Bot)
frmHub:RegBot(OPchat)
SendToAll(" [Scripts Restarted] ")
trigs = parseINI(RepFile)
SetTimer(60000)
StartTimer()
end

function parseINI(fName)
readfrom(fName)
local line = read()
local table = {}
while line do
local s, e, sec = strfind(line, "^%[(.*)%]$")
if s then
section = sec
table[section] = {}
else
assert(section, "parseINI: format problem with "..fName)
tinsert(table[section], line)
end
line = read()
end
readfrom()
return table
end


function hbns(data)
if( strsub(data, 1, 1) == "<" ) then
data=strsub(data,1,strlen(data)-1)
s,e,cmd = strfind( data, "%b<>%s+(%S+)" )
s,e,cmd,us = strfind( data, "%b<>%s+(%S+)%s+(%S+)%s*")
return us
end
end


function checkFake(user)
local s, e, shared = strfind(user.sMyInfoString, "$ALL %S+ .-$ $.+.$.-$(%d+)")
return foreachi(badShare, function(id, value) if value == %shared then return id end end)
end

function NewUserConnected(user)
if (user.iProfile == 2) then
SendToAll("VIP bot", ""..user.sName.." has entered the hub.")
end
if (user.iProfile == 3) then
SendToAll("Reg bot", ""..user.sName.." has entered the hub.")
end
if (user.iProfile == -1) then
SendToAll("Guest bot", ""..user.sName.." has entered the hub.")
end
user:SendPM("Bot","Hello and Welcome.")
user:SendPM("Bot","The HubMaster is not responsible for what you share, share at own risk.")  
if checkFake(user) then user:SendData("*** You seem to be using a fakeshare client")
user:Disconnect()
end
end

function UserDisconnected(curUser)
if (curUser.iProfile == 2) then
SendToAll("VIP bot", ""..curUser.sName.." is offline.")
end
end

function OpConnected(user)
if (user.iProfile == -0) then
SendToAll("Master bot", ""..user.sName.." has entered the hub.")
end
if (user.iProfile == 1) then
SendToAll("OP bot", ""..user.sName.." has entered the hub.")
end
if checkFake(user) then user:SendData("*** You seem to be using a fakeshare client")
user:Disconnect()
end
end

function OpDisconnected(curUser)
if (curUser.iProfile == -0) then
SendToAll("Master bot", ""..curUser.sName.." is offline.")
end
if (curUser.iProfile == 1) then
SendToAll("OP bot", ""..curUser.sName.." is offline.")
end
end

function OnTimer()
SendToAll( Bot, answer ) -- send bot's answer
StopTimer()
end


continued on next post
Title:
Post by: pHaTTy on 28 December, 2003, 02:26:17

function DataArrival(user, data)
local nick = user.sName;
local _, _, cmd, Password = strfind(strsub(data, 1, strlen(data)-1), "%b<>%s+(%S+)%s*([^%|]*)$");
if (not cmd) then
return 0
end
cmd = strlower(cmd)
if (cmd == ""..commandprefix..""..selfregcmd.."") then
user:SendData(data)
if (strlen(Password) > 0) then
if (strfind(nick, HubtagPrefix, 1, 1)) then
if (user.iProfile == -1) then
AddRegUser(nick, Password,  GetProfileIdx("Reg"));
user:SendData(Bot, aMsgs.ReConnect);
user:Disconnect();
else
user:SendData(Bot, aMsgs.UserExists);
end
else
user:SendData(Bot, aMsgs.RequireTag);
end
else
SendToNick(nick, nick, "test");
user:SendData(Bot, aMsgs.BadSyntax);
end
return 1;
end

if( strsub(data, 1, 1) == "<" ) then
data=strsub(data,1,strlen(data)-1)
s,e,cmd,arg = strfind( data, "%b<>%s+(%S+)%s+([%w%s]+)" )
if (arg==nil) then
s,e,cmd = strfind( data, "%b<>%s+(%S+)%s*" )  
end
if (cmd==""..commandprefix..""..afkcmd.."" or cmd=="afk") then
SendToAll(Bot,date("User "..user.sName.." told us at %T that he is away, because ")..arg.." ;)")
goneArr[user.sName]=arg
end
if (cmd==""..commandprefix..""..backcmd.."" or cmd=="re") then
SendToAll(Bot,date("User "..user.sName.." returned at %T ."))
goneArr[user.sName]=nil
end
end
if(strsub(data, 1, 4) == "$To:") then
data=strsub(data,1,strlen(data)-1)
s,e,whoTo = strfind(data,"$To:%s+(%S+)")
if (goneArr[whoTo] == nil) then
--user is here
else
user:SendPM(whoTo,"I am currently away, because of: "..goneArr[whoTo])
end
end
status=strsub(data,1,strlen(data)-1)
s,e,cmd = strfind( status, "%b<>%s+(%S+)" )
if (cmd==""..commandprefix..""..bottrigsoff.."") then
trigall=0
SendToAll(Bot, " Hmf, Okidoki I will be quiet :(( ")
return 1
elseif (cmd==""..commandprefix..""..bottrigson.."") then
trigall=1
SendToAll(Bot, " Okay, I will talk to you again :-)")
return 1
end

if( strsub(data, 1, 1) == "<" ) then
s,e,msg = strfind(data, "%b<>([%a ]+)")                                        
                if trigall==1 then
for key, value in trigs do
                for key2, value2 in value do
if( strfind( strlower(msg), key) ) then
else
break  
end
if Allownotags==yes then
if strfind(curUser.sMyInfoString,"<++") then
else
curUser:SendData("$ForceMove "..Redirect.."|")
end
end
if( strfind( strlower(msg), ""..commandprefix..""..me.."") ) then
t="**"..user.sName
data=gsub (msg, ""..commandprefix..""..me.."", t, 1 )
end
SendToAll(data)
SetTimer(1800)
StartTimer()
answer, x = gsub(value[random(1,getn(value))], "%b[]", user.sName)
return 1
end
end  
end
end

if (user.bOperator) then
if (cmd==""..commandprefix..""..kick.."") then
s,e,cmd,userName,reason = strfind( data, "%b<>%s+(%S+)%s+(%S+)%s+(.+)" )
local kickUser = GetItemByName(userName)
if (user.bOperator) then
SendToAll(Bot, "Either you spelled the name wrong or were stupid and tried to kick an OP")
if (not user.bOperator) then
SendPmToNick(userName, Bot, "You are being kicked because: "..reason)
kickUser:Kick(reason)
SendToAll(userName.." has been kicked because "..reason)
end
end
end
if (user.bOperator) then
if (cmd==""..commandprefix..""..kickban.."") then
s,e,cmd,userName,reason = strfind( data, "%b<>%s+(%S+)%s+(%S+)%s+(.+)" )
local kickUser = GetItemByName(userName)
if (user.bOperator) then
SendToAll(Bot, "Either you spelled the name wrong or were stupid and tried to kickban an OP")
elseif (not user.bOperator) then
SendPmToNick(userName, Bot, "You are being kicked because: "..reason)
kickUser:Ban()
kickUser:NickBan()
kickUser:Disconnect()
SendToAll(userName.." has been kicked because "..reason)
end
end
end
if (user.bOperator) then
if (cmd==""..commandprefix..""..nameban.."") then
s,e,cmd,userName,reason = strfind( data, "%b<>%s+(%S+)%s+(%S+)%s+(.+)" )
local kickUser = GetItemByName(userName)
if (user.bOperator) then
SendToAll(Bot, "Either you spelled the name wrong or were stupid and tried to kickban an OP")
elseif (not user.bOperator) then
SendPmToNick(userName, Bot, "You are being kicked because: "..reason)
kickUser:NickBan()
kickUser:Disconnect()
SendToAll(userName.." has been kicked because "..reason)
end
end
end
end
if( strsub(data, 1, 1) == "<" ) then
if (user.bOperator) then
if( strfind( strlower(data), strlower(""..commandprefix..""..sethubname.."")) ) then
us = hbns(data)
frmHub:SetHubName(us)
answer= "The Hub name is now: "..us..""
user:SendPM(Bot, answer)
end
end
end
if (user.bOperator) then
if( strfind( strlower(data), strlower(""..commandprefix..""..hidebot.."")) ) then
frmHub:UnregBot(Bot)
end
end
if (user.bOperator) then
if( strfind( strlower(data), strlower(""..commandprefix..""..unhidebot.."")) ) then
frmHub:RegBot(Bot)
end
end
if( strsub(data, 1, 1) == "<" ) then
if( strfind( strlower(data), strlower(""..commandprefix..""..hubdetails.."")) ) then
answer= "____________________________Hub-Details______________________________________"
user:SendPM(Bot, answer)
answer= "The Hub name is "..frmHub:GetHubName()..""
user:SendPM(Bot, answer)
answer= "The user limit: "..frmHub:GetMaxUsers()..""
user:SendPM(Bot, answer)
answer= "Users online right now is:  "..frmHub:GetUsersCount()..""
user:SendPM(Bot, answer)
answer= "The Minimum share is set to:  "..frmHub:GetMinShare().."bytes"
user:SendPM(Bot, answer)
answer= "The current share in hub is:  "..frmHub:GetCurrentShareAmount().."bytes"
user:SendPM(Bot, answer)
answer= "The HubBot's name is set to: "..frmHub:GetHubBotName()..""
                  user:SendPM(Bot, answer)
answer= "The OpChat's name is set to: "..frmHub:GetOpChatName()..""
               user:SendPM(Bot, answer)
answer= "The hub description is: "..frmHub:GetHubDescr()..""
               user:SendPM(Bot, answer)
answer= "Hub redirect address is: "..frmHub:GetRedirectAddress()..""
               user:SendPM(Bot, answer)
answer= "The register address server is set to: "..frmHub:GetRegServer()..""
               user:SendPM(Bot, answer)
answer= "The Hub Owner is "..Hubowner..""
               user:SendPM(Bot, answer)
answer= "_____________________________________________________________________________"
user:SendPM(Bot, answer)
end
end
if( strfind( strlower(data), strlower(""..commandprefix..""..myip.."")) ) then
answer= "Your IP-No is: "..user.sIP..""
user:SendPM(Bot, answer )
end
if( strsub(data, 1, 1) == "<" ) then
if( strfind( strlower(data), strlower(""..commandprefix..""..rules.."")) ) then
readfrom("files/rules.txt")
while 1 do
line = read()
if line == nil then break end
user:SendPM(Bot,line)
end
readfrom()
end
end

if( strsub(data, 1, 1) == "<" ) then
if( strfind( strlower(data), strlower(""..commandprefix..""..network.."")) ) then
readfrom("files/network.txt")
while 1 do
line = read()
if line == nil then break end
user:SendPM(Bot,line)
end
readfrom()
end
end

if( strsub(data, 1, 1) == "<" ) then
if( strfind( strlower(data), strlower(""..commandprefix..""..whiteout.."")) ) then
readfrom("files/whiteout.txt")
while 1 do
line = read()
if line == nil then break end
user:SendPM(Bot,line)
end
readfrom()
end
end
if( strsub(data, 1, 1) == "<" ) then
if( strfind( strlower(data), strlower(""..commandprefix..""..website.."")) ) then
readfrom("files/webaddy.txt")
while 1 do
line = read()
if line == nil then break end
user:SendPM(Bot,line)
end
readfrom()
end
end
if( strsub(data, 1, 1) == "<" ) then
if( strfind( strlower(data), strlower(""..commandprefix..""..help.."")) ) then
readfrom("files/help.txt")
while 1 do
line = read()
if line == nil then break end
user:SendPM(Bot,line)
end
readfrom()
end
end
    if( strsub(data, 1, 1) == "<" ) then
if( strfind( strlower(data), strlower(""..commandprefix..""..faq.."")) ) then
readfrom("files/faq.txt")
while 1 do
line = read()
if line == nil then break end
user:SendPM(Bot,line)
end
readfrom()
end
end
if( strsub(data, 1, 1) == "<" ) then
if (user.bOperator) then
if( strfind( strlower(data), strlower(""..commandprefix..""..cleartempban.."")) ) then
      ClearTempBan()
user:SendData(Bot, "Temp ban list cleared. ")
                       end
end
end
 
if( strsub(data, 1, 1) == "<" ) then
if (strfind(data, ""..commandprefix..""..scriptversioncmd.."")) then
user:SendPM(Bot,"This hub Runs Dracko bot by Pacman.")
user:SendPM(Bot,"Based on gekko bot by (uk-kingdom)phatty.")
user:SendPM(Bot,"Script version: "..ScriptVersion..".")
elseif (strfind(data, ""..commandprefix..""..timecmd.."")) then
H = date("%H")
M = date("%M")
D = date("%d")
MM = date("%m")
Y = date("%y")
Time = ("It's now "..D.."."..MM.."."..Y.." - "..H.." : "..M.."")
SendToAll(Bot,Time)
end
end
if user.bOperator then
if( strsub(data, 1, 1) == "<" ) then
if( strfind( strlower(data), strlower(""..commandprefix..""..opshelp.."")) ) then
readfrom("files/opshelp.txt")
while 1 do
line = read()
if line == nil then break end
user:SendPM(Bot,line)
end
readfrom()
end
if( strsub(data, 1, 1) == "<" ) then
if( strfind( strlower(data), strlower(""..pmbot.."")) ) then
user:SendPM(Bot, "Hello.  How can I help you ?")
user:SendPM(Bot, "Use "..commandprefix..""..help.." in main to get your commands.")
end
end
if user.bOperator then
if( strsub(data, 1, 1) == "<" ) then
if( strfind( strlower(data), strlower(""..commandprefix..""..hubinfo.."")) ) then
readfrom("files/hubinfo.txt")
while 1 do
line = read()
if line == nil then break end
SendToAll(line)
end
readfrom()
end
end
end
end
end
end


i have not fixed everything tho, but i will help you fix this engine up so you can use it to mod to death ;)

l8rr,,

-phatty
Title:
Post by: pHaTTy on 28 December, 2003, 02:27:36
ok i have a few more fixes, that i will show you, like i promised i will teach you some of my knowledge ;)
Title:
Post by: pHaTTy on 28 December, 2003, 02:30:02
ok next is the if, and ends, no elseif's hmm need to add them ;)


function NewUserConnected(user)
if (user.iProfile == 2) then
SendToAll("VIP bot", ""..user.sName.." has entered the hub.")
end
if (user.iProfile == 3) then
SendToAll("Reg bot", ""..user.sName.." has entered the hub.")
end
if (user.iProfile == -1) then
SendToAll("Guest bot", ""..user.sName.." has entered the hub.")
end
user:SendPM("Bot","Hello and Welcome.")
user:SendPM("Bot","The HubMaster is not responsible for what you share, share at own risk.")  
if checkFake(user) then user:SendData("*** You seem to be using a fakeshare client")
user:Disconnect()
end
end

function UserDisconnected(curUser)
if (curUser.iProfile == 2) then
SendToAll("VIP bot", ""..curUser.sName.." is offline.")
end
end

function OpConnected(user)
if (user.iProfile == -0) then
SendToAll("Master bot", ""..user.sName.." has entered the hub.")
end
if (user.iProfile == 1) then
SendToAll("OP bot", ""..user.sName.." has entered the hub.")
end
if checkFake(user) then user:SendData("*** You seem to be using a fakeshare client")
user:Disconnect()
end
end

function OpDisconnected(curUser)
if (curUser.iProfile == -0) then
SendToAll("Master bot", ""..curUser.sName.." is offline.")
end
if (curUser.iProfile == 1) then
SendToAll("OP bot", ""..curUser.sName.." is offline.")
end
end


this was some of my nasty scripting, slowing G-E down, so here a fix


function NewUserConnected(user)
if (user.iProfile == 2) then
SendToAll("VIP bot", ""..user.sName.." has entered the hub.")
elseif (user.iProfile == 3) then
SendToAll("Reg bot", ""..user.sName.." has entered the hub.")
elseif (user.iProfile == -1) then
SendToAll("Guest bot", ""..user.sName.." has entered the hub.")
end
user:SendPM("Bot","Hello and Welcome.")
user:SendPM("Bot","The HubMaster is not responsible for what you share, share at own risk.")  
if checkFake(user) then user:SendData("*** You seem to be using a fakeshare client")
user:Disconnect()
end
end

function UserDisconnected(curUser)
if (curUser.iProfile == 2) then
SendToAll("VIP bot", ""..curUser.sName.." is offline.")
end
end

function OpConnected(user)
if (user.iProfile == -0) then
SendToAll("Master bot", ""..user.sName.." has entered the hub.")
elseif (user.iProfile == 1) then
SendToAll("OP bot", ""..user.sName.." has entered the hub.")
end
if checkFake(user) then user:SendData("*** You seem to be using a fakeshare client")
user:Disconnect()
end
end

function OpDisconnected(curUser)
if (curUser.iProfile == -0) then
SendToAll("Master bot", ""..curUser.sName.." is offline.")
elseif (curUser.iProfile == 1) then
SendToAll("OP bot", ""..curUser.sName.." is offline.")
end
end


;)
Title:
Post by: pHaTTy on 28 December, 2003, 02:35:57
another is here


if( strsub(data, 1, 1) == "<" ) then
if( strfind( strlower(data), strlower(""..commandprefix..""..hubdetails.."")) ) then
answer= "____________________________Hub-Details______________________________________"
user:SendPM(Bot, answer)
answer= "The Hub name is "..frmHub:GetHubName()..""
user:SendPM(Bot, answer)
answer= "The user limit: "..frmHub:GetMaxUsers()..""
user:SendPM(Bot, answer)
answer= "Users online right now is:  "..frmHub:GetUsersCount()..""
user:SendPM(Bot, answer)
answer= "The Minimum share is set to:  "..frmHub:GetMinShare().."bytes"
user:SendPM(Bot, answer)
answer= "The current share in hub is:  "..frmHub:GetCurrentShareAmount().."bytes"
user:SendPM(Bot, answer)
answer= "The HubBot's name is set to: "..frmHub:GetHubBotName()..""
                  user:SendPM(Bot, answer)
answer= "The OpChat's name is set to: "..frmHub:GetOpChatName()..""
               user:SendPM(Bot, answer)
answer= "The hub description is: "..frmHub:GetHubDescr()..""
               user:SendPM(Bot, answer)
answer= "Hub redirect address is: "..frmHub:GetRedirectAddress()..""
               user:SendPM(Bot, answer)
answer= "The register address server is set to: "..frmHub:GetRegServer()..""
               user:SendPM(Bot, answer)
answer= "The Hub Owner is "..Hubowner..""
               user:SendPM(Bot, answer)
answer= "_____________________________________________________________________________"
user:SendPM(Bot, answer)
end
end


u see the & quote; change that too " the stupid forum got a bug keep changing it :/