pony

how to make this on join event

Apr 19th, 2020
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.94 KB | None | 0 0
  1. #ipx on
  2. on *:text:*:#:{ if (?ipinfo iswm $1 && $2 && $left($1,1) isin .@!) { getip $2 # } }
  3. on *:input:#:{ if (?ipinfo iswm $1 && $server && /* !iswm $1 && $2 && $left($1,1) isin .@!) { getip $2 # } }
  4. #ipx end
  5.  
  6.  
  7. alias echoip { if (?ipinfo iswm $1 && $2 && $left($1,1) isin .@!) { getip $2 # } }
  8. alias -l getip {
  9. sockclose xip
  10. sockopen -46 xip ipinfo.io 80
  11. sockmark xip $1
  12. %xchan = $2
  13. %xline = ""
  14. }
  15. on *:sockopen:xip:{
  16. if ($sockerr) { echo -a %xchan [IPinfo] $c Open Error! | unset %xchan %xline | return }
  17. sockwrite -n $sockname GET $+(http://ipinfo.io/,$sock($sockname).mark,/geo) HTTP/1.1
  18. sockwrite -n $sockname Host: ipinfo.io
  19. sockwrite -n $sockname User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:62.0) Gecko/20100101 Firefox/62.0
  20. sockwrite -n $sockname Accept-Language: en-US
  21. sockwrite -n $sockname Content-Type: application/json; charset=utf-8
  22. sockwrite -n $sockname $str($crlf,2)
  23. }
  24. on *:sockread:xip:{
  25. if ($sockerr) { echo -a %xchan [IPinfo] $c Read Error! | unset %xchan %xline | return }
  26. var %x, %2
  27. sockread -f %x
  28. tokenize 32 %x
  29. if ("*": * iswm $1-) {
  30. var %2 = $remove($2-,",$chr(44))
  31. if ($1 == "ip":) { %xline = [IPinfo] $c IP: %2 | set %get.IP <( %2 )> }
  32. if ($1 == "city":) { %xline = %xline $c City: %2 | set %ip.city <( %2 )> }
  33. if ($1 == "region":) { %xline = %xline $c Region: %2 | set %get.Region <( %2 )> }
  34. if ($1 == "country":) { %xline = %xline $c Country: %2 | set %get.Country <( %2 )> }
  35. if ($1 == "loc":) { %xline = %xline $c Location: $replace(%2,-,$+($chr(44),-)) | set "%get.Country <( %2 )> }
  36. if ($1 == "timezone":) { %xline = %xline $c Timezone: %2 | endxit | sockclose $sockname | set %get.time <( %2 )> }
  37. }
  38. if ($chr(125) isin $1) { endxit | sockclose $sockname }
  39. }
  40. alias -l endxit {
  41. if (%xline) { echo -a %xchan %xline }
  42. else { echo -a %xchan [IPinfo] $c Nothing found! }
  43. unset %xline %xchan
  44. }
  45. alias -l c { return $chr(9679) }
Advertisement
Add Comment
Please, Sign In to add comment