--Security Admin Bot v 0.1 made by SRJbb99 for the [Ѐ] network(©[Ѐ] Network Solutions 2003) --INSPIRED BY ALL SCRIPTS OUT NOW INCLUDING SOME OF MY OWN(MAIN FUNCTIONS ARE FROM OPBOT BY NATHANOS AND GLORIA SECURITAZ) --ALL OF THE COMMANDS WILL BE SENT VIA A PM TO YOU WHEN YOU ENTER THE HUB -- For further information please read scripts/SecurityAdmin/readme.txt -- You do not need to edit this source file -- All configuration changes should be made from scripts/SecurityAdmin/config.lua -- Code is below this point ------------- -- Parse config file assert(dofile("config.lua")) -- Global Variables SuperOpsTotal = 0 SuperOpsList = {} VIPsTotal = 0 VIPsList = {} SnoopArray = {} SnoopTotal = 0 SnoopList = {} ------------- forbiddenWords = { "mldonkey", "[REPLiKA]" } --these are the words in which the bot kicks for(in the users description that is) ------------- --these are the anti advertising words in which a user will be kicked for although Operators aren't kicked trigs = {["dns2go"]=1,["myftpsite"]=2,["servebeer"]=3,["mine.nu"]=4,["ip.com"]=5,["dynip"]=6,["staticip"]=7,["serveftp"]=8,["ipactive"]=9,["ip.org"]=10,["no-ip"]=11,["servegame"]=12,["ath.cx"]=13,["dyndns"]=14,["68.67.18.75"]=15,["clanpimp"]=16,["idlegames"]=17,["sytes"]=18,["24.184.64.48"]=19,["uni.cc"]=20,["151.198.149.60"]=21,["homeunix"]=22,["24.209.232.97"]=23,["deftonzs.com"]=24,["24.187.50.121"]=25,["flamenap"]=26,["xs4all"]=27,["no-ip"]=28,["serveftp"]=29,["myftp"]=30,["d2g"]=31,["151.198.149.60"]=32,["24.184.64.48"]=33,["orgdns"]=34} ------------- function OpConnected(curUser) SendToAll(Bot, "Welcomes Operator "..curUser.sName.." here at "..frmHub:GetHubName()) curUser:SendPM(Bot, "Hello "..curUser.sName.." and welcome to "..frmHub:GetHubName()) curUser:SendPM(Bot, "There are currently "..frmHub:GetUsersCount().. " users in the hub") curUser:SendPM(Bot, "..........Type +help in main chat for further commands..........") end function NewUserConnected(curUser) curUser:SendPM(Bot, "Hello and welcome to "..frmHub:GetHubName().."") curUser:SendPM(Bot, "+faq - shows the hubs frequently asked questions(send in main chat)" ) curUser:SendPM(Bot, "+founder - Shows the founder of this hub(send in main chat)" ) curUser:SendPM(Bot, "+help - Displays this help page(send in main chat)" ) curUser:SendPM(Bot, "+network - Shows info about the [Ѐ] network(send in main chat)" ) curUser:SendPM(Bot, "+owner - Shows the owner of this hub(send in main chat)" ) curUser:SendPM(Bot, "+rules - Shows the hubs rules(send in main chat)" ) curUser:SendPM(Bot, "+showhubdesc - Shows the hub's current description(send in main chat)" ) curUser:SendPM(Bot, "+showhubname - Shows the hub's current name(send in main chat)" ) curUser:SendPM(Bot, "+showmaxusers = Shows the hub's maximum number of connections(send in PM to bot)" ) curUser:SendPM(Bot, "+showops - Shows all existing operators(send in main chat)" ) curUser:SendPM(Bot, "+showsuperops - Shows all existing super operators(send in main chat)") curUser:SendPM(Bot, "+showvips - Shows all existing VIPs(send in main chat)" ) curUser:SendPM(Bot, "+website - Shows the hubs website(send in main chat)" ) curUser:SendPM(Bot, "## - Opens a PM dialouge with the bot(send in main chat)" ) data=curUser.sMyInfoString data=curUser.sMyInfoString s,e,cmd = strfind( data, "[$]+[^$]+[$]+[^$]+[$]+[^$]+[$]+([^$]+)" ) if (strfind(cmd,"28.8K")) then curUser:SendPM(Bot,"no 28.8k modem allowed in here ...") curUser:Disconnect() end if (strfind(cmd,"33.6K")) then curUser:SendPM(Bot,"no 33.6k modem allowed in here ...") curUser:Disconnect() end for key,checkWord in forbiddenWords do if strfind(curUser.sMyInfoString, checkWord, 1, 1) then SendToNick(curUser.sName, "<" ..Bot .."> You are using unauthorized client software, please read the Rules section, Thankyou!") SendToNick(curUser.sName, "<" ..Bot .."> Disconnecting...") curUser:Disconnect() end end end function ReadSuperOps() readfrom("superops.lst") while 1 do local line = read() if line == nil then break else SuperOpsTotal = SuperOpsTotal + 1 rawset(SuperOpsList,SuperOpsTotal,line) end end readfrom() end function WriteSuperOps() writeto("superops.lst") for i=1,SuperOpsTotal,1 do write(rawget(SuperOpsList,i).."\n") end writeto() end function DeleteSuperOp(opNick) errlvl = 1 for i=1,SuperOpsTotal,1 do if rawget(SuperOpsList,i) == opNick then if i ~= SuperOpsTotal then rawset(SuperOpsList,i,rawget(SuperOpsList,SuperOpsTotal)) end SuperOpsTotal = SuperOpsTotal - 1 SortSuperOps() WriteSuperOps() errlvl = 0 break end end -- returns 1 if SuperOp could not be found return errlvl end function AddSuperOp(opNick) errlvl = IsSuperOp(opNick) if errlvl == 0 then SuperOpsTotal = SuperOpsTotal + 1 rawset(SuperOpsList,SuperOpsTotal,opNick) SortSuperOps() WriteSuperOps() end -- returns 1 if SuperOp already exists return errlvl end function SortSuperOps() for passNum=1,SuperOpsTotal-1,1 do for i=1,SuperOpsTotal-passNum,1 do if rawget(SuperOpsList,i) > rawget(SuperOpsList,i+1) then tempNick = rawget(SuperOpsList,i) rawset(SuperOpsList,i,rawget(SuperOpsList,i+1)) rawset(SuperOpsList,i+1,tempNick) end end end end function IsSuperOp(opNick) errlvl = 0 for i=1,SuperOpsTotal,1 do if rawget(SuperOpsList,i) == opNick then errlvl = 1 break end end -- returns 1 if user specified is a SuperOp return errlvl end function ShowSuperOps(user) if VSHOWSUPEROPS ~= 0 then if VSHOWSUPEROPS <= CheckUserLevel(user) then user:SendPM(Bot, " Current SuperOps are listed as:") for i=1,SuperOpsTotal,1 do user:SendPM(Bot, " "..rawget(SuperOpsList,i)) end else user:SendPM(Bot, " You do not have sufficient rights to run that command! |") end else user:SendPM(Bot, " That command is disabled. |") end end function ReadVIPs() readfrom("vips.lst") while 1 do local line = read() if line == nil then break else VIPsTotal = VIPsTotal + 1 rawset(VIPsList,VIPsTotal,line) end end readfrom() end function WriteVIPs() writeto("vips.lst") for i=1,VIPsTotal,1 do write(rawget(VIPsList,i).."\n") end writeto() end function DeleteVIP(opNick) errlvl = 1 for i=1,VIPsTotal,1 do if rawget(VIPsList,i) == opNick then if i ~= VIPsTotal then rawset(VIPsList,i,rawget(VIPsList,VIPsTotal)) end VIPsTotal = VIPsTotal - 1 SortVIPs() WriteVIPs() errlvl = 0 break end end -- returns 1 if VIP could not be found return errlvl end function AddVIP(opNick) errlvl = IsVIP(opNick) if errlvl == 0 then VIPsTotal = VIPsTotal + 1 rawset(VIPsList,VIPsTotal,opNick) SortVIPs() WriteVIPs() end -- returns 1 if VIP already exists return errlvl end function SortVIPs() for passNum=1,VIPsTotal-1,1 do for i=1,VIPsTotal-passNum,1 do if rawget(VIPsList,i) > rawget(VIPsList,i+1) then tempNick = rawget(VIPsList,i) rawset(VIPsList,i,rawget(VIPsList,i+1)) rawset(VIPsList,i+1,tempNick) end end end end function IsVIP(opNick) errlvl = 0 for i=1,VIPsTotal,1 do if rawget(VIPsList,i) == opNick then errlvl = 1 break end end -- returns 1 if user specified is a VIP return errlvl end function ShowVIPs(user) if VSHOWVIPS ~= 0 then if VSHOWVIPS <= CheckUserLevel(user) then user:SendPM(Bot, " Current VIPs are listed as: |") for i=1,VIPsTotal,1 do user:SendPM(Bot, " "..rawget(VIPsList,i).." |") end else user:SendPM(Bot, " You do not have sufficient rights to run that command! |") end else user:SendPM(Bot, " That command is disabled. |") end end function GetArg(data) s,e,whoTo,from,cmd,arg = strfind(data,"$To:%s+(%S+)%s+From:%s+(%S+)%s+$%b<>%s+(%S+)%s+(%S+)%s*") return arg end function Get2Args(data) s,e,whoTo,from,cmd,arg,arg2 = strfind(data,"$To:%s+(%S+)%s+From:%s+(%S+)%s+$%b<>%s+(%S+)%s+(%S+)%s+(%S+)%s*") return arg,arg2 end function GetArgRemnants(user, data, cmdlength) cmd = strsub(data,18+strlen(Bot)+strlen(user.sName)*2+cmdlength) return cmd end function SetHubName(user, data, cmdlength) if VSETHUBNAME ~= 0 then if VSETHUBNAME <= CheckUserLevel(user) then arg = GetArgRemnants(user,data,cmdlength) frmHub:SetHubName(arg) SendToOps(Bot, user.sName.." changed the hub name to: "..arg.." |") else user:SendPM(Bot, " You do not have sufficient rights to run that command! |") end else user:SendPM(Bot, " That command is disabled. |") end end function SetHubDesc(user, data, cmdlength) if VSETHUBDESC ~= 0 then if VSETHUBDESC <= CheckUserLevel(user) then arg = GetArgRemnants(user,data,cmdlength) frmHub:SetHubDescr(arg) SendToOps(Bot, user.sName.." changed the hub description to: "..arg.." |") else user:SendPM(Bot, " You do not have sufficient rights to run that command! |") end else user:SendPM(Bot, " That command is disabled. |") end end function SetMaxUsers(user, data) if VSETMAXUSERS ~= 0 then if VSETHUBDESC <= CheckUserLevel(user) then arg = GetArg(data) frmHub:SetMaxUsers(arg) SendToOps(Bot, user.sName.." changed the maximum number of user connections to: "..arg.." |") else user:SendPM(Bot, " You do not have sufficient rights to run that command! |") end else user:SendPM(Bot, " That command is disabled. |") end end function AddUser(user, data) if VADDUSER ~= 0 then if VADDUSER <= CheckUserLevel(user) then arg,arg2 = Get2Args(data) frmHub:AddRegUser(arg, arg2, 0) SendToOps(Bot, user.sName.." added new registered user: "..arg.." |") else user:SendPM(Bot, " You do not have sufficient rights to run that command! |") end else user:SendPM(Bot, " That command is disabled. |") end end function ChPasswd(user, data) if VCHPASSWD ~= 0 then if VCHPASSWD <= CheckUserLevel(user) then arg = GetArg(data) if user.bOperator ~= nil then frmHub:DelRegUser(user.sName) frmHub:AddRegUser(user.sName, arg, 1) else frmHub:DelRegUser(user.sName) frmHub:AddRegUser(user.sName, arg, 0) end user:SendPM(Bot, " Your password has been changed to: "..arg.." |") else user:SendPM(Bot, " You do not have sufficient rights to run that command! |") end else user:SendPM(Bot, " That command is disabled. |") end end function RedirectAllNow(user) if VREDIRECTALLNOW ~= 0 then if VREDIRECTALLNOW <= CheckUserLevel(user) then SendToOps(Bot, user.sName.." is redirecting all users to: "..frmHubGetRedirectAddress().." |") SendToAll("RedirectBot", "Redirecting... |$ForceMove "..frmHub:GetRedirectAddress().."|") else user:SendPM(Bot, " You do not have sufficient rights to run that command! |") end else user:SendPM(Bot, " That command is disabled. |") end end function ChRed(user, data) if VCHRED ~= 0 then if VCHRED <= CheckUserLevel(user) then arg = GetArg(data) frmHub:SetRedirectAddress(arg) SendToOps(Bot, user.sName.." changed the hub redirect address to: "..arg.." |") else user:SendPM(Bot, " You do not have sufficient rights to run that command! |") end else user:SendPM(Bot, " That command is disabled. |") end end function SetRedirectAll(user, data) if VSETREDIRECTALL ~= 0 then if VSETREDIRECTALL <= CheckUserLevel(user) then arg = GetArg(data) if (arg=="on") then frmHub:SetRedirectFull(0) frmHub:SetRedirectAll(1) SendToOps(Bot, user.sName.." changed the redirect all new connections to: "..arg.." |") elseif (arg=="off") then frmHub:SetRedirectAll(0) SendToOps(Bot, user.sName.." changed the redirect all new connections to: "..arg.." |") else user:SendPM(Bot, " The value can only be: on or off. It cannot be "..arg.." |") end else user:SendPM(Bot, " You do not have sufficient rights to run that command! |") end else user:SendPM(Bot, " That command is disabled. |") end end function SetRedirectFull(user, data) if VSETREDIRECTFULL ~= 0 then if VSETREDIRECTFULL <= CheckUserLevel(user) then arg = GetArg(data) if (arg=="on") then frmHub:SetRedirectAll(0) frmHub:SetRedirectFull(1) SendToOps(Bot, user.sName.." changed the redirect all new connections when maximum connections reached to: "..arg.." |") elseif (arg=="off") then frmHub:SetRedirectFull(0) SendToOps(Bot, user.sName.." changed the redirect all new connections when maximum connections reached to: "..arg.." |") else user:SendPM(Bot, " The value can only be: on or off. It cannot be "..arg.." |") end else user:SendPM(Bot, " You do not have sufficient rights to run that command! |") end else user:SendPM(Bot, " That command is disabled. |") end end function AddOp(user, data) if VADDOP ~= 0 then if VADDOP <= CheckUserLevel(user) then arg,arg2 = Get2Args(data) frmHub:AddRegUser(arg, arg2, 1) SendToOps(Bot, user.sName.." added new operator: "..arg.." |") else user:SendPM(Bot, " You do not have sufficient rights to run that command! |") end else user:SendPM(Bot, " That command is disabled. |") end end function DeleteUser(user, data) if VDELETEUSER ~= 0 then if VDELETEUSER <= CheckUserLevel(user) then arg = GetArg(data) frmHub:DelRegUser(arg) SendToOps(Bot, user.sName.." deleted registered user/operator: "..arg.." |") else user:SendPM(Bot, " You do not have sufficient rights to run that command! |") end else user:SendPM(Bot, " That command is disabled. |") end end function DoAddSuperOp(user, data) if VADDSUPEROP ~= 0 then if VADDSUPEROP <= CheckUserLevel(user) then arg = GetArg(data) if AddSuperOp(arg) == 1 then user:SendPM(Bot, " User "..arg.." is already a SuperOp! |") else SendToOps(Bot, user.sName.." just made "..arg.." a SuperOp! |") end else user:SendPM(Bot, " You do not have sufficient rights to run that command! |") end else user:SendPM(Bot, " That command is disabled. |") end end function DoDeleteSuperOp(user, data) if VDELETESUPEROP ~= 0 then if VDELETESUPEROP <= CheckUserLevel(user) then arg = GetArg(data) if DeleteSuperOp(arg) == 1 then user:SendPM(Bot, " User "..arg.." was not found in the current SuperOp list! |") else SendToOps(Bot, user.sName.." just revoked SuperOp status from: "..arg.." |") end else user:SendPM(Bot, " You do not have sufficient rights to run that command! |") end else user:SendPM(Bot, " That command is disabled. |") end end function DoAddVIP(user, data) if VADDVIP ~= 0 then if VADDVIP <= CheckUserLevel(user) then arg = GetArg(data) if AddVIP(arg) == 1 then user:SendPM(Bot, " User "..arg.." is already a VIP! |") else SendToOps(Bot, user.sName.." just made "..arg.." a VIP! |") SendToNick(arg, Bot, " "..user.sName.." just made you a VIP! |") end else user:SendPM(Bot, " You do not have sufficient rights to run that command! |") end else user:SendPM(Bot, " That command is disabled. |") end end function DoDeleteVIP(user, data) if VDELETEVIP ~= 0 then if VDELETEVIP <= CheckUserLevel(user) then arg = GetArg(data) if DeleteVIP(arg) == 1 then user:SendPM(Bot, " User "..arg.." was not found in the current VIP list! |") else SendToOps(Bot, user.sName.." just revoked VIP status from: "..arg.." |") SendToNick(arg, Bot, " "..user.sName.." just revoked your VIP status. |") end else user:SendPM(Bot, " You do not have sufficient rights to run that command! |") end else user:SendPM(Bot, " That command is disabled. |") end end function CheckUserLevel(user) if IsSuperOp(user.sName) == 1 then return 5 elseif user.bOperator then return 4 elseif IsVIP(user.sName) == 1 then return 3 else return 2 end end function BannerToAll(user, data, cmdlength) if VBANNER ~= 0 then if VBANNER <= CheckUserLevel(user) then tmpMsg = "" arg = GetArgRemnants(user,data,cmdlength) for i=1,strlen(arg)+4,1 do tmpMsg = tmpMsg.."*" end SendToAll(tmpMsg) SendToAll(arg) SendToAll(tmpMsg) else user:SendPM(Bot, " You do not have sufficient rights to run that command! |") end else user:SendPM(Bot, " That command is disabled. |") end end function ShowRed(user) if VSHOWRED ~= 0 then if VSHOWRED <= CheckUserLevel(user) then user:SendPM(Bot, " Current redirect address is set to: "..frmHub:GetRedirectAddress().." |") else user:SendPM(Bot, " You do not have sufficient rights to run that command! |") end else user:SendPM(Bot, " That command is disabled. |") end end function ShowHubName(user) if VSHOWHUBNAME ~= 0 then if VSHOWHUBNAME <= CheckUserLevel(user) then user:SendPM(Bot, " Current hub name is set to: "..frmHub:GetHubName().." |") else user:SendPM(Bot, " You do not have sufficient rights to run that command! |") end else user:SendPM(Bot, " That command is disabled. |") end end function ShowHubDesc(user) if VSHOWHUBDESC ~= 0 then if VSHOWHUBDESC <= CheckUserLevel(user) then user:SendPM(Bot, " Current hub description is set to: "..frmHub:GetHubDescr().." |") else user:SendPM(Bot, " You do not have sufficient rights to run that command! |") end else user:SendPM(Bot, " That command is disabled. |") end end function ShowHelp(user) if VHELP ~= 0 then userLevel = CheckUserLevel(user) if VHELP <= userLevel then user:SendPM(Bot," Commands available to you are: |") user:SendPM(Bot,"") for i=1,FunctionTotal,1 do if (FunctionLevels[i] <= userLevel and FunctionLevels[i] ~= 0) then user:SendPM(Bot," "..FunctionHelp[i].." |") end end end else user:SendPM(Bot, " Help has been disabled! Speak to an operator. |") end end function ShowOps(user) if VSHOWOPS ~= 0 then if VSHOWOPS <= CheckUserLevel(user) then user:SendPM(Bot, " Currently it is not possible to tell who are operators by built in hub methods. |") user:SendPM(Bot, " Displaying Super Operator list instead. |") user:SendPM(Bot, " |") ShowSuperOps(user,userLevel) else user:SendPM(Bot, " You do not have sufficient rights to run that command! |") end else user:SendPM(Bot, " That command is disabled. |") end end function Snoop(user, data) if VSNOOP ~= 0 then if VSNOOP <= CheckUserLevel(user) then arg = GetArg(data) if IsUserSnooped(arg) == 0 then rawset(SnoopArray,arg,user.sName) if UpdateSnoopList(arg,1) ~= 0 then user:SendPM(Bot, " Something stuffed up with the updating of a user to the snoop list! |") end user:SendPM(Bot, " You are now snooping user: "..arg.." |") else if rawget(SnoopArray,arg) == user.sName then user:SendPM(Bot, " You are already snooping user: "..arg.." |") else user:SendPM(Bot, " Only one person can snoop each user. |") user:SendPM(Bot, " Currently "..arg.." is being snooped by: "..rawget(SnoopArray,arg).." |") user:SendPM(Bot, " If you want to snoop "..arg..", ask "..rawget(SnoopArray,arg).." to unsnoop them. |") end end else user:SendPM(Bot, " You do not have sufficient rights to run that command! |") end else user:SendPM(Bot, " That command is disabled. |") end end function UnSnoop(user, data) if VUNSNOOP ~= 0 then if VUNSNOOP <= CheckUserLevel(user) then arg = GetArg(data) if IsUserSnooped(arg) == 1 then if rawget(SnoopArray,arg) == user.sName then rawset(SnoopArray,arg,nil) if UpdateSnoopList(arg,0) ~= 0 then user:SendPM(Bot, " Something stuffed up with the updating of a user to the snoop list! |") end user:SendPM(Bot, " You are no longer snooping user: "..arg.." |") else user:SendPM(Bot, " You are not snooping user: "..arg.." |") user:SendPM(Bot, " Currently "..arg.." is being snooped by: "..rawget(SnoopArray,arg).." |") user:SendPM(Bot, " If you want to snoop "..arg..", ask "..rawget(SnoopArray,arg).." to unsnoop them. |") end else user:SendPM(Bot, " You are not currently snooping user: "..arg.." |") end else user:SendPM(Bot, " You do not have sufficient rights to run that command! |") end else user:SendPM(Bot, " That command is disabled. |") end end function CheckSnoop(user, data) if VCHECKSNOOP ~= 0 then if VCHECKSNOOP <= CheckUserLevel(user) then arg = GetArg(data) if IsUserSnooped(arg) == 1 then if rawget(SnoopArray,arg) == user.sName then user:SendPM(Bot, " You are snooping user: "..arg.." |") else user:SendPM(Bot, " Currently "..arg.." is being snooped by: "..rawget(SnoopArray,arg).." |") end else user:SendPM(Bot, " No one is currently snooping user: "..arg.." |") end else user:SendPM(Bot, " You do not have sufficient rights to run that command! |") end else user:SendPM(Bot, " That command is disabled. |") end end function UpdateSnoopList(nick, status) -- if status == 1 then we are adding a snoopee exitstatus = 0 if status == 1 then if SnoopTotal == 0 then SnoopTotal = 1 rawset(SnoopList,1,nick) else SnoopTotal = SnoopTotal + 1 rawset(SnoopList,SnoopTotal,nick) SortSnoopList() end -- if status == 0 then we are removing a snoopee elseif status == 0 then for i=1,SnoopTotal,1 do if rawget(SnoopList,i) == nick then if i ~= SnoopTotal then rawset(SnoopList,i,rawget(SnoopList,SnoopTotal)) end rawset(SnoopList,SnoopTotal,nil) SnoopTotal = SnoopTotal - 1 SortSnoopList() break end end else exitstatus = 1 end return exitstatus end function SortSnoopList() for passNum=1,SnoopTotal-1,1 do for i=1,SnoopTotal-passNum,1 do if rawget(SnoopList,i) > rawget(SnoopList,i+1) then tempNick = rawget(SnoopList,i) rawset(SnoopList,i,rawget(SnoopList,i+1)) rawset(SnoopList,i+1,tempNick) end end end end function FormattingTool(size) temp = "" for i=1,size,1 do temp = temp.." " end return temp end function ShowSnoopList(user) if VSHOWSNOOPLIST ~= 0 then if VSHOWSNOOPLIST <= CheckUserLevel(user) then if SnoopTotal ~= 0 then user:SendPM(Bot, " Users Currently being snooped: |") user:SendPM(Bot, " |") for i=1,SnoopTotal,1 do user:SendPM(Bot, " User: "..SnoopList[i]..FormattingTool(20-strlen(SnoopList[i])).."Snooper: "..SnoopArray[SnoopList[i]].." |") end user:SendPM(Bot, " |") else user:SendPM(Bot, " No users are currently being snooped. |") end else user:SendPM(Bot, " You do not have sufficient rights to run that command! |") end else user:SendPM(Bot, " That command is disabled. |") end end function ForceDisconnectSnoop(user) if VUNSNOOP ~= 0 then if VUNSNOOP <= CheckUserLevel(user) then if SnoopTotal ~= 0 then tempArray = {} tempCount = 0 for i=1,SnoopTotal,1 do if rawget(SnoopArray,rawget(SnoopList,i)) == user.sName then rawset(SnoopArray,rawget(SnoopList,i),nil) tempCount = tempCount + 1 tempArray[tempCount] = rawget(SnoopList,i) end end for i=1,tempCount,1 do if UpdateSnoopList(tempArray[i],0) ~= 0 then user:SendPM(Bot, " Something stuffed up with the updating of a user to the snoop list! |") end end end end end end function ShowMaxUsers(user) if VSHOWMAXUSERS ~= 0 then if VSHOWMAXUSERS <= CheckUserLevel(user) then user:SendPM(Bot, "Current maximum number of simultaneous user connections is set to: "..frmHub:GetMaxUsers().."") else user:SendPM(Bot, "You do not have sufficient rights to run that command! ") end else user:SendPM(Bot, " That command is disabled. |") end end function IsUserSnooped(nick) exitstatus = 0 if SnoopTotal ~= 0 then for i=1,SnoopTotal,1 do if rawget(SnoopList,i) == nick then exitstatus = 1 break end end end -- returns 1 if user is snooped, else returns 0 return exitstatus end ------------- function Main() if ENABLESUPEROPS == 1 then ReadSuperOps() end if ENABLEVIPS == 1 then ReadVIPs() end frmHub:RegBot(Bot) end ------------- function DataArrival(user, data) if (not user.bOperator) then if (( strsub(data, 1, 1) == "<" ) or ( strsub(data, 1, 4) == "$To:" )) then for key,a in trigs do if( strfind( strlower(data), key) ) then SendToAll( " "..user.sName.." has been kicked for advertising." ) user:Disconnect() end end end end if IsUserSnooped(user.sName) == 1 then SendToNick(rawget(SnoopArray,user.sName), " "..user.sName.." ::: "..data) end ----------------all of these commands can be sent in the main chat if( strsub(data, 1, 1) == "<" ) then -- remove end pipe data=strsub(data,1,strlen(data)-1) -- parse the command s,e,cmd = strfind( data, "%b<>%s+(%S+)" ) if (cmd=="+kickban") and (user.bOperator) then s,e,cmd,userName,reason = strfind( data, "%b<>%s+(%S+)%s+(%S+)%s+(.+)" ) local kickUser = GetItemByName(userName) SendPmToNick(userName, Bot, "You are being banned because: "..reason) kickUser:Ban() kickUser:NickBan() kickUser:Disconnect() SendToAll(userName.." has been kicked and banned forever because "..reason) elseif (cmd=="+help" or cmd=="+ophelp" or cmd=="+showhelp" or cmd=="-help") then ShowHelp(user) elseif (cmd=="+showsuperops") then ShowSuperOps(user) elseif (cmd=="+redirectallnow") then RedirectAllNow(user) elseif (cmd=="+showvips") then ShowVIPs(user) elseif(user.bOperator and strsub(data, 1, strlen(user.sName)+8) == "<"..user.sName.."> mass ") then SendPmToAll("Hub Mass Message from "..user.sName, strsub(data, strlen(user.sName)+9)) elseif (cmd=="+banner") then BannerToAll(user,data,strlen(cmd)+1) elseif (cmd=="+showred") then ShowRed(user) elseif (cmd=="+showhubname") then ShowHubName(user) elseif (cmd=="+showhubdesc") then ShowHubDesc(user) elseif (cmd=="+showops") then ShowOps(user) elseif (cmd=="+website") then SendToAll(Bot, "Please visit our website for more information www.unitednetwork.pwp.blueyonder.co.uk thanks to ~)¤ 666 ¤(~ and ~)¤ Lucifer ¤(~") elseif (cmd== "##") then SendPmToNick(user.sName, Bot, "You rang? What may I ask is your command?") elseif (cmd== "+owner") then SendPmToNick(user.sName, Bot, "The owner of this hub is ~)¤ Lucifer ¤(~") elseif (cmd== "+founder") then SendPmToNick(user.sName, Bot, "The founder of this hub is ~)¤ 666 ¤(~") elseif (cmd=="+network") then -- Read a complete Rules.txt file line for line and print them as a private message local network ="" readfrom("network.txt") while 1 do local line = read() if (line == nil) then break else network = network..line.."\r\n" end end SendPmToNick(user.sName, Bot, network) readfrom() -- call readfrom() at the end to close the file elseif (cmd=="+rules") then -- Read a complete Rules.txt file line for line and print them as a private message local rules ="" readfrom("Rules.txt") while 1 do local line = read() if (line == nil) then break else rules = rules..line.."\r\n" end end SendPmToNick(user.sName, Bot, rules) readfrom() -- call readfrom() at the end to close the file elseif (cmd=="+faq") then -- Read a complete faq.txt file line for line and print them as a private message local faq ="" readfrom("faq.txt") while 1 do local line = read() if (line == nil) then break else faq = faq..line.."\r\n" end end SendPmToNick(user.sName, Bot, faq) readfrom() -- call readfrom() at the end to close the file end end -------all of these commands must be sent in a PM to the bot and are essentially OP commands if(strsub(data, 1, 4) == "$To:") then -- remove end pipe data=strsub(data,1,strlen(data)-1) -- is this meant for our bot? s,e,whoTo = strfind(data,"$To:%s+(%S+)") if (whoTo == Bot) then s,e,whoTo,from,cmd = strfind(data,"$To:%s+(%S+)%s+From:%s+(%S+)%s+$%b<>%s+(%S+)") if (cmd=="+debug") then DebugAll(user,data) elseif (cmd=="+sethubname") then SetHubName(user,data,strlen(cmd)+1) elseif (cmd=="+sethubdesc") then SetHubDesc(user,data,strlen(cmd)+1) elseif (cmd=="+setmaxusers") then SetMaxUsers(user,data) elseif (cmd=="+adduser") then AddUser(user,data) elseif (cmd=="+chpasswd" or cmd=="+chmypasswd" or cmd=="+passwd") then ChPasswd(user,data) elseif (cmd=="+chred") then ChRed(user,data) elseif (cmd=="+setredirectall") then SetRedirectAll(user,data) elseif (cmd=="+setredirectfull") then SetRedirectFull(user,data) elseif (cmd=="+addop") then AddOp(user,data) elseif (cmd=="+deleteuser" or cmd=="+deleteop") then DeleteUser(user,data) elseif (cmd=="+addsuperop") then DoAddSuperOp(user,data) elseif (cmd=="+deletesuperop") then DoDeleteSuperOp(user,data) elseif (cmd=="+addvip") then DoAddVIP(user,data) elseif (cmd=="+deletevip") then DoDeleteVIP(user,data) elseif (cmd=="+snoop") then Snoop(user,data) elseif (cmd=="+unsnoop") then UnSnoop(user,data) elseif (cmd=="+showsnooplist") then ShowSnoopList(user) elseif (cmd=="+checksnoop") then CheckSnoop(user,data) elseif (cmd=="+showmaxusers") then user:SendPM(Bot, "Current maximum number of simultaneous user connections is set to: "..frmHub:GetMaxUsers().."") else user:SendPM(Bot, "That is not a recognized PM to the bot command. Try it in the main chat or +help in the main chat for more info") end end end end function OpDisconnected(user) ForceDisconnectSnoop(user) end