This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Editing connect script to !whois

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
User avatar
ComputerTech
Master
Posts: 399
Joined: Sat Feb 22, 2020 10:29 am
Contact:

Editing connect script to !whois

Post by ComputerTech »

So found this piece of code on this forum.
http://forum.egghelp.org/viewtopic.php?t=20844 << this page

Code: Select all

package require http 
package require json 

set ExpChan "#opers" 

bind raw - NOTICE Client_Connect 

proc Client_Connect {from key arg} { 
   if {[string match *!*@* $from] || ![string match -nocase "*client connecting*" $arg]} { return } 
   if {[scan $arg %\[^\:\]\:%\[^(\](%\[^@\]@%\[^\)\] _ nick ident host] == "4"} { 
      set token [http::geturl http://ip-api.com/json/$host?fields=status,city,isp,country,query,regionName,countryCode] 
      set data [json::json2dict [http::data $token]] 
      ::http::cleanup $token 
      if {[dict get $data status] eq "success"} { 
         puthelp "PRIVMSG $::ExpChan :\002Nick\002: $nick - \002IP\002: [dict get $data query] - \002Country\002: [dict get $data country] -\ 
            \002City\002: [dict get $data city] - \002ISP\002: [dict get $data isp] [dict get $data countryCode]" 
      } else { 
         putcmdlog "Error! it fails to get data for this $host" 
      } 
   } 
   return 0 
}
Possible to make this code show normal whois info on !whois And show the location of,
The ip.

Would be super appreciated if someone could edit this to do so, Thanks in advanced :D
ComputerTech
Post Reply