Advertisement
Guest User

Untitled

a guest
Jan 7th, 2019
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
TCL 0.81 KB | None | 0 0
  1. //ipinfo script for eggdrop 1.8
  2.  
  3.  
  4. package require http
  5. package require json
  6.  
  7. bind pub - .who who
  8. proc who {nick uhost hand chan text} {
  9.    set lookup [lindex [split $text] 0]
  10.    catch {set http [::http::geturl http://ipinfo.io/$lookup/json -timeout 6000]} error
  11.    set data [::http::data $http]
  12.    set json [::json::json2dict $data]
  13.    ::http::cleanup $http
  14. set keys [dict keys $json]
  15. set expecting {ip hostname city region country loc postal phone org}
  16. foreach ele $expecting {
  17.    if {[lsearch $keys $ele] != -1} {
  18.       set $ele [dict get $json $ele]
  19.    } else {
  20.       set $ele "n/a"
  21.    }
  22. }
  23.    putserv "PRIVMSG $chan :\002(\002Geo\002)\002: IP: $ip - Hostname: $hostname - City: $city - Region: $region - Country: $country - Location: $loc - Zipcode: $postal - Organization: $org"
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement