Add more details

This commit is contained in:
Nexus 2023-02-23 14:42:03 +00:00
parent 8023627513
commit f7622a9f92
Signed by: nex
GPG key ID: 0FA334385D0B689F
2 changed files with 19 additions and 3 deletions

View file

@ -198,14 +198,30 @@ class Events(commands.Cog):
)
else:
ip = student.ip_info
is_proxy = ip.get("proxy")
if is_proxy is None:
is_proxy = "?"
else:
is_proxy = "\N{WHITE HEAVY CHECK MARK}" if is_proxy else "\N{CROSS MARK}"
is_hosting = ip.get("hosting")
if is_hosting is None:
is_hosting = "?"
else:
is_hosting = "\N{WHITE HEAVY CHECK MARK}" if is_hosting else "\N{CROSS MARK}"
return await message.reply(
"Nice argument, however,\n"
"IP: {0[query]}\n"
"ISP: {0[isp]}\n"
"Longitude: {0[lon]}\n"
"Latitude: {0[lat]}\n"
"Longitude: {0[lon]}\n"
"Proxy server: {1}\n"
"VPS (or other hosting) provider: {2}"
"\N{smiling face with sunglasses}".format(
ip
ip,
is_proxy,
is_hosting
),
delete_after=30
)

View file

@ -121,7 +121,7 @@ async def authenticate(req: Request, code: str = None, state: str = None):
# Now send a request to https://ip-api.com/json/{ip}?fields=status,city,zip,lat,lon,isp,query
if req.client.host not in ("127.0.0.1", "localhost", "::1"):
response = app.state.http.get(
f"http://ip-api.com/json/{req.client.host}?fields=status,city,zip,lat,lon,isp,query"
f"http://ip-api.com/json/{req.client.host}?fields=status,city,zip,lat,lon,isp,query,proxy,hosting"
)
if response.status_code != 200:
raise HTTPException(