PtokaX forum

Archive => Archived 4.0 boards => Finished Lua 4 scripts => Topic started by: ((UKSN))shad_dow on 25 June, 2004, 21:04:34

Title: view any txt file in any folder bot
Post by: ((UKSN))shad_dow on 25 June, 2004, 21:04:34

--//
--// Therapy-X?  stand alone HelpBot- v0.01
--//
--// Simple help bot which reads any text file from any   folder

--// example, txt/Rules.txt > type in main !read txt rules
--//
--// Written by shad_dow?    may 2004
--//
--//  
--//
--// THANKS:
--//  all scripters @ [URL]http://board.univ-angers.fr/[/URL]  :)

function Main()
frmHub:RegBot(Bot)


end





function DataArrival(user, data)


if (strsub(data,1,1)=="<") or (strsub(data,1,5+strlen(Bot))=="$To: "..Bot) then
data=strsub(data,1,strlen(data)-1)
s,e,cmd = strfind(data,"%b<>%s+(%S+)")




if (cmd == "!read")then
_,_,cmd,txtname,filename =  strfind( data, "%b<>%s+(%S+)%s+(%S+)%s+(.+)" )
if  ( txtname == nil) then
user:SendData(Bot, "Syntax error, !read ")
return 1
else
readfrom(txtname.."/"..filename..".txt")
local message = ""
while 1 do
local line = read()
if line == nil then break
else
message = message..line.."\r\n"
end
end
user:SendPM(Bot,message)
return 1
end
end
end
end

might be buggy code cos its taken out my bot .. ;)
Title:
Post by: ((UKSN))shad_dow on 26 June, 2004, 10:21:22
Nice script Mutor