Hi all
i've been looking 4 a simple rls bot
requirments:
support of the following commands:
+rls (shows last 30 rls)
+addrls
+delrls
+rlsfull (shows all rls)
+rlsfind
output (list) should be a txt file
containing a table with the col's:
*date added
*added by
*type
*rls
thx a lot
Why not use Freshstuff 3.5 ??
That script rocks :]
Bumbi
QuoteOriginally posted by Bumbi
Why not use Freshstuff 3.5 ??
That script rocks :]
Bumbi
Thanks for ad :)
BTW the script does exactly what you want.
this one i use..........
----------------------------------------------------------
-- Tiny Release v2.04 --
-- Made by Optimus 02/03/05 --
-- Add/Delete releases --
-- Top 10 new releases on connect --
-- Usercommand added by Timetraveller --
----------------------------------------------------------
tRelease = {}
tCommands = {}
tFunctions = {}
-- Your botname
sBot = "?????L-Releases"
-- File where releases are put
ReleaseFile = "releases.tbl"
-- Amount of releases on connect
TopRelease = 10
-- Max number of stored releases in database, don't set it to high.
MaxReleases = 1000
-- Enable top releases on connect 1=on/0=off
EnableTopRelease = 1
-- Where to send top releases on connect, set to main/pm
TopReleaseConnect = "pm"
-- Where to send Show releases, set to main/pm
ShowRelease = "pm"
-- Send usercommands on connect 1=on/0=off
UserCommands = 1
-- Usercommands menu name
zMenu = "----?releases"
-- Your command prefixes here
CmdPrefix = { ["!"] = 1, ["?"] = 1, ["+"] = 1}
-- Sets who can use release script
Allowed = {
[0] = 1, -- Master
[1] = 1, -- Operator
[2] = 1, -- VIPs
[3] = 1, -- Regs
[4] = 1, -- Moderator
[5] = 1, -- Netfounder
}
Main = function()
frmHub:RegBot(sBot)
dofile(ReleaseFile)
NewReleases = tFunctions.GetReleases(table.getn(tRelease), table.getn(tRelease)-TopRelease)
end
ChatArrival = function(user, data)
user.SendMessage = user.SendData return tFunctions.GetCommands(user, data)
end
ToArrival = function(user, data)
local s,e,to = string.find(data, "$To: (%S+%s?%S*)%sFrom:")
if to == sBot then
user.SendMessage = user.SendPM return tFunctions.GetCommands(user, data)
end
end
NewUserConnected = function(user)
if Allowed[user.iProfile] == 3 then
if EnableTopRelease == 3 then
local disp = "\r\n\t\t\t?? ?? ?? ??? ??????? ?? ?? ??? ?? Last "..TopRelease.." Releases Added ?? ?? ?? ??? ??????? ?? ?? ??? ?? \r\n\r\n"..NewReleases
disp = disp.."\r\n\t\t\t?? ?? ?? ??? ??????? ?? ?? ??? ?? Last "..TopRelease.." Releases Added ?? ?? ?? ??? ??????? ?? ?? ??? ?? "
disp = disp.."\r\n\t\t\t"
tFunctions.ShowWhere(user, TopReleaseConnect, disp)
end tFunctions.SendCommands(user)
end
end
OpConnected = NewUserConnected
--// Commands ----------------------------------------------------------------------------------------------------------
tCommands["addrel"] = function(user, data)
if Allowed[user.iProfile] == 3 then
local s,e,item,descr = string.find(data, "%b<>%s+%S+%s+(.+)%-(.*)")
if s then
if table.getn(tRelease) < MaxReleases then
table.insert(tRelease,{user.sName,item,descr,os.date("%d-%m-%Y")})
tFunctions.SaveReleases()
NewReleases = tFunctions.GetReleases(table.getn(tRelease), table.getn(tRelease)-TopRelease)
SendToAll(sBot, user.sName.. "? Added A New Release To DataBase ** "..item.." - "..descr.." ** Check It Out!!? ;)")
else
user:SendMessage(sBot, "*** Database is full, maxium number of releases are: "..MaxReleases)
end
else
user:SendMessage(sBot, "*** Usage: !addrel item-descr")
end
end return 1
end
tCommands["delrel"] = function(user, data)
if user.bOperator then
local s,e,nr = string.find(data, "%b<>%s+%S+%s+(%d+)")
if s then
if tRelease[tonumber(nr)] then
table.remove(tRelease,nr)
tFunctions.SaveReleases()
NewReleases = tFunctions.GetReleases(table.getn(tRelease), table.getn(tRelease)-TopRelease)
user:SendMessage(sBot, "Release nr."..nr.." is deleted from database!")
else
user:SendMessage(sBot, "*** Release nr."..nr.." is not in database!")
end
else
user:SendMessage(sBot, "*** Usage: !delrel nr")
end
end return 1
end
tCommands["showrel"] = function(user, data)
if Allowed[user.iProfile] == 3 then
local disp = "\r\n\t\t\t?? ?? ?? ??? ??????? ?? ?? ??? ?? Top "..table.getn(tRelease).." Releases ?? ?? ?? ??? ??????? ?? ?? ??? ??\r\n\r\n"
disp = disp..tFunctions.GetReleases(table.getn(tRelease), 1)
tFunctions.ShowWhere(user, ShowRelease, disp.."\r\n\t\t\t?? ?? ?? ??? ??????? ?? ?? ??? ?? Top "..table.getn(tRelease).." Releases ?? ?? ?? ??? ??????? ?? ?? ??? ??")
end return 1
end
tCommands["cleanup"] = function(user, data)
if user.bOperator then
local howmuch = table.getn(tRelease)
if howmuch >= MaxReleases then
for i = 1, howmuch/2 do table.remove(tRelease,i) end
tFunctions.SaveReleases()
user:SendMessage(sBot, "The database is cleaned!")
else
user:SendMessage(sBot, "The database doesn't need tobe cleaned!")
end
end return 1
end
--// Functions ---------------------------------------------------------------------------------------------------------
tFunctions.GetCommands = function(user, data)
data=string.sub(data,1,string.len(data)-1)
local s,e,prefix,cmd=string.find(data, "%b<>%s*(%S)(%S+)")
if prefix and CmdPrefix[prefix] and tCommands[cmd] then
return tCommands[cmd](user, data)
end
end
tFunctions.ShowWhere = function(user, where, msg)
if where == "main" then user:SendData(sBot, msg) elseif where == "pm" then user:SendPM(sBot, msg) end
end
tFunctions.GetReleases = function(startpos, endpos)
local text = ""
for i = startpos, endpos, -1 do
if tRelease[i] then
text = text.."\t ["..i.."]? "..tRelease[i][4].." ? "..tRelease[i][1].." ? Added:? "..tRelease[i][2].." - "..tRelease[i][3].."\r\n"
end
end return text
end
tFunctions.SaveReleases = function()
local iCount = 0
local file = io.open(ReleaseFile, "w")
if file then
file:write("tRelease =? {\n")
for i = 1, table.getn(tRelease) do
if tRelease[i] then
iCount = iCount + 1
file:write(string.format("[%d]",i).." = { "..string.format("%q",tRelease[i][1])..", "..string.format("%q",tRelease[i][2])..", "..string.format("%q",tRelease[i][3])..", "..string.format("%q",tRelease[i][4]).." },\n")
end
end
file:write(string.format("[%q]","n").." = "..iCount..",\n}")
file:close()
end
end
tFunctions.SendCommands = function(user)
if UserCommands == 1 then
if user.bUserCommand then -- Is new function to check if client has UserCommand support.
user:SendData("$UserCommand 0 3")
user:SendData("$UserCommand 1 3 "..zMenu.."\\----?Show New Releases$<%[mynick]> !showrel|")
user:SendData("$UserCommand 1 3 "..zMenu.."\\----?Add New Releases$<%[mynick]> !addrel %[line:Release-Descr]|")
user:SendData("$UserCommand 1 3 "..zMenu.."\\----?Delete Releases (Ops Only)$<%[mynick]> !delrel %[line:Number]|")
user:SendData("$UserCommand 1 3 "..zMenu.."\\----?Clean DataBase (Ops Only)$<%[mynick]> !cleanup|")
end
end
end
The best are FreshStuff and Release Request of jiten :)
You can also give Entry Bot a try.
There are two versions of it:
- Version 1.2 that only supports main categories;
- Version 2 that supports main and sub-categories.