Hi!
I would like to get the output from the command !getbanlist (and other build in commands) in another window then main. Is it possible to do it and I dont want to open permban.dat and parse the result.
I also want to use + as a prefix and not !.
How do I get !getpermban and other build in commands by using + instead of ! as a prefix?
Thanks
you have to open the permbans.dat file to get access to the ban list, or you could load the bans on startup and loop trough a table instead. This would involve adding the bans from the !ban command to the table aswell, and its not the best idea to hold this memory:- simply because its not accesed that often
neways, heres what you asked for, kinda =]
sBot = "Name to hubbot name"
function Main()
frmHub:RegBot(sBot) end
end
function DataArrival(user, data)
data = strsub(data, 1, strlen(data) -1)
local _,_, cmd = strfind(data, "%b<>%s+(%S+)")
if cmd == "+getbanlist" then
readfrom("../PermBan.dat")
local sOut = "\r\n\r\n\tB a n L i s t\r\n\t\n"
while 1 do
local sLine = read()
if sLine == nil or sLine == "" then
readfrom()
user:SendPM(sBot, sOut)
return 1
else
local _,_, sUsername, sReason = strfind(sLine, "(%S+)|(.*)")
if sUsername ~= nil and sReason ~= nil then
sOut = sOut .. sUsername .. " : : " .. sReason
end
end
end
end
end
Thank you, it works fine.
But the "sUsername, sReason" shold be "ipAddress, sUsername". The reason is never saved in the PermBan.dat file, or is it?
nopes...
the permbans.txt files is built up like so...
|
banned expression can be either a username or a ip address and the note is as follows...
using ptokax functions to ban will save one of, lastnick on ipban, and last ip and nickban, where using the raw data command:-$kick, will save the extra reason to the note field =]