Getting !getbanlist in other window than main
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

Getting !getbanlist in other window than main

Started by TecMaster, 24 May, 2004, 14:47:52

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

TecMaster

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





Corayzon

#1
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

TecMaster

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?

Corayzon

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 =]

SMF spam blocked by CleanTalk