Add _data param

This commit is contained in:
trueold89 2024-07-07 21:21:17 +03:00
parent be81204cd9
commit 4d9b2586bb
Signed by: trueold89
GPG Key ID: C122E85DD49E6B30
1 changed files with 8 additions and 3 deletions

View File

@ -66,6 +66,13 @@ class AIOMCServer(IMCServer):
_max: int _max: int
_count: int _count: int
_motd: str _motd: str
_data: bytes
def __init__(self, host: str, port: int) -> None:
super().__init__(host, port)
self._data = self._pack_data(
b"\x00\x00" + self._pack_data(self.host.encode('utf8')) + self.
_pack_port(self.port) + b"\x01")
@staticmethod @staticmethod
async def _unpack_varint(s): async def _unpack_varint(s):
@ -100,9 +107,7 @@ class AIOMCServer(IMCServer):
async def _get_data(self) -> dict: async def _get_data(self) -> dict:
async with AIOConnection(self.host, self.port) as socket: async with AIOConnection(self.host, self.port) as socket:
await socket.send(self._pack_data( await socket.send(self._data)
b"\x00\x00" + self._pack_data(self.host.encode('utf8')) + self.
_pack_port(self.port) + b"\x01"))
await socket.send(self._pack_data("\x00")) await socket.send(self._pack_data("\x00"))
await self._unpack_varint(socket) await self._unpack_varint(socket)
await self._unpack_varint(socket) await self._unpack_varint(socket)