Author Topic: Getting !getbanlist in other window than main  (Read 1585 times)

0 Members and 1 Guest are viewing this topic.

Offline TecMaster

  • Fulll Member
  • ****
  • Posts: 74
  • Karma: +1/-0
Getting !getbanlist in other window than main
« on: 24 May, 2004, 14:47:52 »
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





PtokaX forum

Getting !getbanlist in other window than main
« on: 24 May, 2004, 14:47:52 »

Offline Corayzon

  • Lord
  • ***
  • Posts: 464
  • Karma: +1/-0
(No subject)
« Reply #1 on: 24 May, 2004, 16:07:30 »
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 =]

Code: [Select]
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
« Last Edit: 24 May, 2004, 16:11:40 by Corayzon »

Offline TecMaster

  • Fulll Member
  • ****
  • Posts: 74
  • Karma: +1/-0
(No subject)
« Reply #2 on: 25 May, 2004, 08:58:00 »
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?

Offline Corayzon

  • Lord
  • ***
  • Posts: 464
  • Karma: +1/-0
(No subject)
« Reply #3 on: 25 May, 2004, 12:38:32 »
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 =]

PtokaX forum

(No subject)
« Reply #3 on: 25 May, 2004, 12:38:32 »