Another refactor pass

This commit is contained in:
oitsjustjose 2025-06-14 15:30:19 -05:00
commit bbbb592cb7
2 changed files with 2 additions and 3 deletions

View file

@ -4,7 +4,7 @@ import socket
import struct import struct
class Server: class ServerPingResponse:
def __init__(self, data): def __init__(self, data):
self.description = data.get("description") self.description = data.get("description")
if isinstance(self.description, dict): if isinstance(self.description, dict):
@ -82,7 +82,7 @@ def ping(ip, port=25565):
data += chunk data += chunk
try: try:
return Server(json.loads(data)) return ServerPingResponse(json.loads(data))
except json.decoder.JSONDecodeError: except json.decoder.JSONDecodeError:
return None return None
finally: finally:

View file

@ -1,5 +1,4 @@
import base64 import base64
import json
import re import re
from dataclasses import dataclass from dataclasses import dataclass
from typing import List, Union from typing import List, Union