PtokaX forum

Archive => Archived 4.0 boards => Request for Lua 4 scripts => Topic started by: WaRPiG on 09 November, 2003, 01:49:31

Title: REQUESTS BOT
Post by: WaRPiG on 09 November, 2003, 01:49:31
a script where you can add your name and the name of the file your looking for

maybe in this format

NAME       FILE(S)               DATE


with an option to be able to delete the request if you have managed to get them
Title:
Post by: lazyj189 on 09 November, 2003, 01:57:04
--//Request Board Bot
--//(Mr420)
--//A Simple Request Board For The Hub
--//Version 3.0

botname = "Request_Board"
bot_email = ""
bot_speed = "SoL"-- "Speed of Light" :)"
bot_descr = "Type !help In PM To Me."
bot_share_size = 420.01 * 1024 *1024
my_info_string = "$MyINFO $ALL "..botname.." "..bot_descr.."$".. "$"..bot_speed..strchar( 1 ).."$"..bot_email
TimeSpanInMinutes = 600 --//You May Change This

function Main()
frmHub:RegBot(botname)
my_info_string = "$MyINFO $ALL "..botname.." "..bot_descr.."$".."$"..bot_speed..strchar( 1 ).."$"..bot_email..
"$"..bot_share_size.."$"
SetTimer(TimeSpanInMinutes*33000)
StartTimer()
end

function NewUserConnected(curUser)
curUser:SendData( my_info_string )
end

function OpConnected(curUser)
curUser:SendData( my_info_string )
end

function OnTimer()

--//Note that a "|" denotes a break in the line

SendToAll("-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-")
SendToAll(" HI THERE!!!!, I'm The Request_Board.")
SendToAll(" Do You Need A Specific File???")
SendToAll(" REQUEST IT!!!")
SendToAll("-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-")
SendToAll(" To Request A File, Simply Send !help As A Private Message")
SendToAll(" To Request_Board. Please Be As Specific As You Can.")
SendToAll(" Remember To Check Back To See If Someone Has Obtained Your File.")
SendToAll("-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-")

end

function tokenize (inString,token)
_WORDS = {}
local matcher = "([^?"..token.."]+)"
gsub(inString, matcher, function (w) tinsert(_WORDS,w) end)
return _WORDS
end

function GetArgs(data)
s,e,whoTo,from,cmd,arg,arg2 = strfind(data,"$To:%s+(%S+)%s+From:%s+(%S+)%s+$%b<>%s+(%S+)%s+(.*)")
return arg,arg2
end

function DataArrival(user, data)
if(strsub(data, 1, 4) == "$To:") then
data=strsub(data,1,strlen(data)-1)
s,e,whoTo = strfind(data,"$To:%s+(%S+)")
if (whoTo == botname) then
s,e,whoTo,from,cmd = strfind(data,"$To:%s+(%S+)%s+From:%s+(%S+)%s+$%b<>%s+(%S+)")

if (cmd=="!help") then
user:SendPM(botname,"-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-")
user:SendPM(botname," This is the Request_Board!")
user:SendPM(botname,"-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-")
user:SendPM(botname," Type !help To View This Help Menu.")
user:SendPM(botname," Type !request To Request A File.")
user:SendPM(botname," Type !view To View The Posted Requests/Updates.")
user:SendPM(botname,"-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-")
user:SendPM(botname," Please Be As Specific As You Can.")
user:SendPM(botname,"-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-")
end

if (cmd=="!request") then
SendToAll("***New Request Added***")
arg= GetArgs(data)
local handle=openfile("request.dat","a")
write(handle,"("..user.sName..") requested :"..arg.."?")
user:SendPM(botname,"Request entry saved ....")
closefile(handle)
end
end
if (cmd=="!view") then
handle2=openfile("request.dat","r")
if (handle2==nil) then
else
line = read(handle2,"*a")
line=strsub(line,1,strlen(line)-1)
linearray=tokenize(line,"?")
for i=1,linearray.n do
user:SendPM(botname,linearray)
end
closefile(handle2)
end

end
end
end
Title:
Post by: lazyj189 on 09 November, 2003, 02:07:08
Sorry, this one will make it look like this when you type to view the requests.

you'll need someone else to help add the ability to delete a request once it has been made.

On 11/08/03 at 17:05: TestUser requested: happiness


--//Request Board Bot
--//(Mr420)
--//A Simple Request Board For The Hub
--//Version 3.0

botname = "Request_Board"
bot_email = ""
bot_speed = "SoL"-- "Speed of Light" :)"
bot_descr = "Type !help In PM To Me."
bot_share_size = 420.01 * 1024 *1024
my_info_string = "$MyINFO $ALL "..botname.." "..bot_descr.."$".. "$"..bot_speed..strchar( 1 ).."$"..bot_email
TimeSpanInMinutes = 600 --//You May Change This

function Main()
frmHub:RegBot(botname)
my_info_string = "$MyINFO $ALL "..botname.." "..bot_descr.."$".."$"..bot_speed..strchar( 1 ).."$"..bot_email..
"$"..bot_share_size.."$"
SetTimer(TimeSpanInMinutes*33000)
StartTimer()
end

function NewUserConnected(curUser)
curUser:SendData( my_info_string )
end

function OpConnected(curUser)
curUser:SendData( my_info_string )
end

function OnTimer()

--//Note that a "|" denotes a break in the line

SendToAll("-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-")
SendToAll(" HI THERE!!!!, I'm The Request_Board.")
SendToAll(" Do You Need A Specific File???")
SendToAll(" REQUEST IT!!!")
SendToAll("-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-")
SendToAll(" To Request A File, Simply Send !help As A Private Message")
SendToAll(" To Request_Board. Please Be As Specific As You Can.")
SendToAll(" Remember To Check Back To See If Someone Has Obtained Your File.")
SendToAll("-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-")

end

function tokenize (inString,token)
_WORDS = {}
local matcher = "([^?"..token.."]+)"
gsub(inString, matcher, function (w) tinsert(_WORDS,w) end)
return _WORDS
end

function GetArgs(data)
s,e,whoTo,from,cmd,arg,arg2 = strfind(data,"$To:%s+(%S+)%s+From:%s+(%S+)%s+$%b<>%s+(%S+)%s+(.*)")
return arg,arg2
end

function DataArrival(user, data)
if(strsub(data, 1, 4) == "$To:") then
data=strsub(data,1,strlen(data)-1)
s,e,whoTo = strfind(data,"$To:%s+(%S+)")
if (whoTo == botname) then
s,e,whoTo,from,cmd = strfind(data,"$To:%s+(%S+)%s+From:%s+(%S+)%s+$%b<>%s+(%S+)")

if (cmd=="!help") then
user:SendPM(botname,"-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-")
user:SendPM(botname," This is the Request_Board!")
user:SendPM(botname,"-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-")
user:SendPM(botname," Type !help To View This Help Menu.")
user:SendPM(botname," Type !request To Request A File.")
user:SendPM(botname," Type !view To View The Posted Requests/Updates.")
user:SendPM(botname,"-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-")
user:SendPM(botname," Please Be As Specific As You Can.")
user:SendPM(botname,"-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-")
end

if (cmd=="!request") then
SendToAll("***New Request Added***")
arg= GetArgs(data)
local handle=openfile("request.dat","a")
write(handle,"On "..date("%m/%d/%y").." at "..date("%H:%M").." "..user.sName.." requested: "..arg.."?")
user:SendPM(botname,"Request entry saved ....")
closefile(handle)
end
end
if (cmd=="!view") then
handle2=openfile("request.dat","r")
if (handle2==nil) then
else
line = read(handle2,"*a")
line=strsub(line,1,strlen(line)-1)
linearray=tokenize(line,"?")
for i=1,linearray.n do
user:SendPM(botname,linearray)
end
closefile(handle2)
end

end
end
end
Title:
Post by: WaRPiG on 09 November, 2003, 12:25:44
thanx loads m8