whois scripts
 

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

whois scripts

Started by Ubikk, 21 December, 2004, 10:51:46

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Ubikk

Is there anyone out there who can provide me with a "whois " script?
The function is the same as in mIRC

For example when I type !whois , I get:

has been idle for 23 minutes, 12 seconds

idle = hasnt sent any msg to mainchat or PM

is it possible to do that?

BoJlk

in RoboCop script is command
!info    - Show all info about a user

for Example
	==========================
	                 ? Info ?
	==========================
	 ? Name: nick
	 ? Profile: User
	 ? IP: ***.***.***.***
	 ? Client: DC++
	 ? Version: 0.401
	 ? iVersion: 1,0091
	 ? Descr: <++ V:0.401,M:A,H:6/0/0,S:5>
	 ? Mode: Active
	 ? Conn: Cable
	 ? E-Mail: 
	 ? Upload limit: Unlimited
	 ? Share: 56.37 GB

	 ? Kicked: 1
	 ? bWho: *****
	 ? Reason: Connection timeout 10 times
	 ? Warned: No warnings
	 ? bWho: None
	 ? Reason: None
	 ? Away Mess: No message
	 ? Connected at: N/A
	 ? Total Time: 32
	 ? Session Time: 32 Minutes

	 ? Hub(s) as Operator: 0
	 ? Hub(s) as Registered user: 0
	 ? Hub(s) as Regular user: 6
	 ? Open Slots: 5

There's another user info script by lallo82
just copy past into notepad and save as *.lua file

-- user info script by lallo82 
-- functions by plop (great work) 

Bot = "[BOT]UserInfo?" 

function Main() 
   frmHub:RegBot(Bot) 
end 

function DataArrival(user, data) 
   if( strsub(data, 1, 1) == "<" ) then 
      -- remove end pipe 
      data=strsub(data,1,strlen(data)-1) 
      -- parse the command 
      s,e,cmd = strfind( data, "%b<>%s+(%S+)" ) 
      if (user.bOperator) then 
         if (cmd=="+userinfo" or cmd=="+whois" ) then 
            UserInfo(user, data) 
            return 1 
         end 
      end
   end 
end 

function GetArgML(data) 
   s,e,cmd,arg = strfind(data, "%b<>%s+(%S+)%s+(%S+)%s*") 
   return arg 
end 

function UserInfo(user, data) 
   who=GetArgML(data) 
   local usr = GetItemByName(who) 
   user:SendPM(Bot, "here is the info from: "..who.." |") 
   -- now whe know the user lets extract the info 
   -- ip of the user 
   user:SendPM(Bot, "ip: "..usr.sIP.." |") 
   -- client type and version 
   if (strfind(usr.sMyInfoString," 4 then 
            limiter = limiter / 1024 
         end 
      end 
      user:SendPM(Bot, "upload limited: "..limiter.." Kb/s |") 
   end 
   -- bandwidth download limiter 
   _,b, dlimiter = strfind(usr.sMyInfoString,"D:(%x+)") 
   if dlimiter ~= nil then 
      user:SendPM(Bot, "download limited: "..dlimiter.." Kb/s |") 
   end 
end

and another one by NightLitch
-------------------------------------------------
-- iNFO-Bot Written by NightLitch
-------------------------------------------------
-- Usage:
--
-- [USER] = username, [IP] = ip, [HUB] = hubname, [CLIENT] = client, [VERSION] = client version,
--
-- [MODE] = client mode, [HUBS] = hubs, [SLOTS] = slots, [BANDWIDTH] = bandwidth,
--
-- [SHARE] = share (in GB), [SPEED] = speed
--
-------------------------------------------------
--// Set your filename here
MODT_FILE = "Text-Info.txt"
-------------------------------------------------
--// Don't edit below unless you do now what you're doing...
-------------------------------------------------
function NewUserConnected(sUser)
-- Code part here
end
OpConnected = NewUserConnected
function NewUserConnected(sUser)
	local MyI,Speed,Share = ParseMyInfo(sUser.sMyInfoString)
	local MODT_LINE = TextFile(MODT_FILE)
	MODT_LINE = gsub(MODT_LINE, "%b[USER]", sUser.sName)
	MODT_LINE = gsub(MODT_LINE, "%b[IP]", sUser.sIP)
	MODT_LINE = gsub(MODT_LINE, "%b[HUB]", frmHub:GetHubName())
	MODT_LINE = gsub(MODT_LINE, "%b[CLIENT]", MyI["C"])
	MODT_LINE = gsub(MODT_LINE, "%b[VERSION]", MyI["V"])
	MODT_LINE = gsub(MODT_LINE, "%b[MODE]", MyI["M"])
	MODT_LINE = gsub(MODT_LINE, "%b[HUBS]", MyI["H"])
	MODT_LINE = gsub(MODT_LINE, "%b[SLOTS]", MyI["S"])
	MODT_LINE = gsub(MODT_LINE, "%b[BANDWIDTH]", MyI["B"])
	MODT_LINE = gsub(MODT_LINE, "%b[SHARE]", format("%.2f",Share/1024/1024/1024))
	MODT_LINE = gsub(MODT_LINE, "%b[SPEED]", Speed)

	SendToNick(sUser.sName,MODT_LINE)
end

function TextFile(file)
	readfrom(file, "r")
	local message = ""
	while 1 do
		local line = read()
		if line == nil then break
		else
			message = message..line.."\n"
		end
	end
	readfrom()
	return message
end

function ParseMyInfo(MyInfo)
	Hubs = 0
	local s,e,Speed,Share = strfind(MyInfo, "^%$MyINFO %$ALL [^ ]+ [^$]*%$ $([^$]+)[^$]%$[^$]*%$%s*(%d+)%$" )
	local s,e,Mode,tHubs,Slots = strfind(MyInfo, "M:([5AP]),H:([%d%/]+),S:(%d+)")
	if tonumber(tHubs) == nil then gsub(tHubs, "(%d+)", function (num) Hubs = Hubs +tonumber(num) end) else Hubs = tonumber(tHubs) end
	local s,e,Bandwidth = strfind(MyInfo, "[BLUF]:([%.%d]+)")
	local Client,Check,MinVer, Version = "Unknown",nil,nil,0
	for c,t in CLIENTS do
		if strfind(MyInfo, c) then
			Client = t[2]
			s,e,Version = strfind(MyInfo, t[1])
		end
	end
	if Client=="DCGUI" and tonumber(Bandwidth) then Bandwidth = Bandwidth * Slots end
	if Bandwidth==nil then Bandwidth = "Unlimited" end
	if strfind(MyInfo, "L:") then 
		if not Client=="Strong DC++" then Client = "CZDC++" end
	elseif strfind(MyInfo, "B:") then 
		if not Client=="Phantom DC++" then Client = "Bear Claw DC++" end
	end
	MyI = {["C"] = Client, ["V"] = Version, ["M"] = MODE[tostring(Mode)], ["H"] = tonumber(Hubs), ["S"] = tonumber(Slots), ["B"] = Bandwidth}
	return MyI,Speed,tonumber(Share)
end

CLIENTS = {
	["<++"] = {"V:([%d%.]+)", "DC++"},
	["oDC"] = {"V:([%d%.]+)", "oDC"},
	["", "oDC"},
	["", "iDC++"},
	["zDC++"] = {"V:([%d%.]+)", "zDC++"},
	["", "DC++ CDM"},
	["<.P"] = {"V:([%d%.]+)", "Phantom DC++"},
}
MODE = {["5"] = "Socket5", ["A"] = "Active", ["P"] = "Passive"}

Ubikk

lol :)

I dont care about the user info. I already have a scripts for that.
All I want to know is if there is possible to make a scripts wich shows you the idle time of a user ;)

Ubikk

hey... can't anyone help me ?! :( Is it that difficult?

blackwings

#4
QuoteOriginally posted by Ubikk
hey... can't anyone help me ?! :( Is it that difficult?
lol, a WhoIs is totally different from what you're asking for. Probably the elite programmers ignore the thread because either a WhoIs cannot be done or they ignore it because it would consume allot of time making one.

A more proper name for the command would be=
!tidletime (tidletime is short for "total idle time")

So create and new thread with a better topic and rewrite your question, then you might get some attention from the elite ones.


NightLitch

#5
Mery Christmas Ubikk...

*code updated*

--###############################################--
-- Idle - Users -- By NightLitch 2004-12-23 --
--###############################################--
BotName = "InfoBot"
TableCommand = "!whois"
--###############################################--
IdleTimers = {}
--###############################################--
function DataArrival(sUser,sData)
	if strsub(sData, 1,1) == "<" then
		local _,_,Cmd,Arg = strfind(sData, "%b<>%s+(%S+)%s*(.*)%|")
		if Command[Cmd] and sUser.bOperator then
			return Command[Cmd](sUser,Arg)
		end
		IdleTimers[sUser.sName] = clock()
	elseif strsub(sData,1,4) == "$To:" then
		local s,e,WhoTo,From,Msg = strfind(sData,"%$To:%s+(%S+)%s+From:%s+(%S+)%s+%$%b<>%s+(.*)%|")
		IdleTimers[From] = clock()
	end

end--###############################################--
Command = {}
Command[TableCommand] = function(sUser,sArg)
	local _,_,Nickname = strfind(sArg, "(%S+)")
	if Nickname == nil then sUser:SendData(BotName, "Syntax: !table  ") return 1 end
	local tUser = GetItemByName(Nickname)
	if tUser == nil then sUser:SendData(BotName, "User "..Nickname.." is not online or wrong username.") return 1 end
	if IdleTimers[tUser.sName] then
		iTime = clock() - IdleTimers[tUser.sName]
		sUser:SendData(BotName, "User "..tUser.sName.." has been idle for "..TimeUnits(iTime))
	else
		sUser:SendData(BotName, "User "..tUser.sName.." haven't typed anything at all...")		
	end
	return 1
end
--###############################################--
TimeUnits = function(time)
	local time = time*1000
	local msg = ""
	local tO = {
		[1] = { 86400000, 0, "days"},
		[2] = { 3600000, 0, "hours"},
		[3] = { 60000, 0, "minutes"},
		[4] = { 1000, 0, "seconds"},
		};
	for i , v in (tO) do
		if time >= tO[i][1] then
			repeat 
				tO[i][2] = tO[i][2] + 1
				time = time - tO[i][1]
			until time < tO[i][1]
		end
	end
	for i,v in tO do 
		if tO[i][2] ~= 0 then
			msg = msg.." "..tO[i][2].." "..tO[i][3]
		end
	end
	if msg == "" then msg = "0 minutes" end
	return msg
end
--###############################################--
--// NightLitch 2004-12-23

Mery Christmas // NightLitch
//NL

kepp

Will give errors night :)
Guarding    

NightLitch

//NL

Ubikk

Your script is great NightLich, but can you make it work for PM also? :) Atm, it only works for mainchat ;)

NightLitch

above code updated...
//NL

SMF spam blocked by CleanTalk