2024-03-14 16:26:31 -04:00
|
|
|
import aiohttp
|
|
|
|
|
|
|
|
|
2024-05-03 19:42:32 -04:00
|
|
|
async def get_status(host: str, port: int = 25565) -> tuple[bool, dict]:
|
2024-03-14 16:26:31 -04:00
|
|
|
async with aiohttp.ClientSession() as session:
|
2025-01-26 13:09:15 +00:00
|
|
|
async with session.get(f"https://api.mcsrvstat.us/2/{host}:{port}") as response:
|
|
|
|
response = await response.json() # noqa: PLW2901
|
|
|
|
if response["online"]:
|
2024-03-14 16:26:31 -04:00
|
|
|
return (True, response)
|
|
|
|
return (False, response)
|