-- IPLogBot by Cane -- Small edit by Loop botName="iplog" onoff = 1 txt = ("iplog.txt") function Main() --frmHub:RegBot(botName) end function NewUserConnected(curUser) if onoff then appendto(txt) if curUser.iProfile == -1 then profile = "User" else profile = GetProfileName(curUser.iProfile) end write("At "..date("%d").."/"..date("%m").."-"..date("%Y").." "..date("%T").." "..profile.." "..curUser.sName.." enters the Hub with IP: "..curUser.sIP..".\r\n") writeto() end end function OpConnected(curUser) if onoff then appendto(txt) write("At "..date("%d").."/"..date("%m").."-"..date("%Y").." "..date("%T").." "..GetProfileName(curUser.iProfile).." "..curUser.sName.." enters the Hub with IP: "..curUser.sIP..".\r\n") writeto() end end function DataArrival(user,data) if strsub(data, 1, 1) ~= "$" and strfind(data, "%> %#") then cmd = strsub(data, strfind(data, "%> %#")+2, -2) if user.bOperator then if (cmd=="#showiplog") then doiplog(user,data) return 1 elseif (cmd=="#deliplog") then dodeliplog(user) return 1 elseif (cmd=="#logon") then onoff = 1 user:SendData(botName,"Iplog is set to on") return 1 elseif (cmd=="#logoff") then onoff = nil user:SendData(botName,"Iplog is set to off") return 1 --helpfile in pm elseif (cmd=="#iphelp") then SendPmToNick(user.sName,botName," Ip log help!") SendPmToNick(user.sName,botName,"") SendPmToNick(user.sName,botName,"#showiplog - shows the ip log in pm") SendPmToNick(user.sName,botName,"#deliplog - deletes the ip log") SendPmToNick(user.sName,botName,"#logon - command to set the log on") SendPmToNick(user.sName,botName,"#logoff - command to set the log off") SendPmToNick(user.sName,botName,"#iphelp - this help-file in pm") SendPmToNick(user.sName,botName,"") SendPmToNick(user.sName,botName," end!") return 1 end end end end function doiplog(user,data) readfrom(txt) local message = "" while 1 do local line = read() if line == nil then break else message = message..line.."\r\n" end end user:SendPM(botName,message) end function dodeliplog(user) writeto(txt) write("") writeto() user:SendData(botName,"Log is del!.") end