Removed reading of incoming events bc why not

This commit is contained in:
Casey 2024-07-04 16:00:43 +03:00
parent ebe6fab9c6
commit 72b8c6274b
Signed by: hkc
GPG Key ID: F0F6CFE11CDB0960
1 changed files with 3 additions and 10 deletions

View File

@ -37,7 +37,6 @@ class AsyncBotManager:
if a:
self.difference[x + ox + (y + oy) * 1000] = l > 0
async def listener(self):
async with ClientSession() as http:
async with http.get(f"{self.base}/api/initial-state") as req:
@ -75,16 +74,10 @@ class AsyncBotManager:
async with AsyncSimpleClient(http_session=http) as sio:
await sio.connect(f"{self.base}/socket.io")
while not self._shutdown:
try:
event, data = await sio.receive(0.1)
if event not in ("full_state", "batched_bit_toggles"):
print(bot_index, "!!!", event, data)
except Exception:
pass
index, target = choice(list(self.difference.items()))
index, expected = choice(list(self.difference.items()))
y, x = divmod(index, 1000)
curr = self.canvas.getpixel((x, y)) > 0 # type: ignore
if curr != target:
current = self.canvas.getpixel((x, y)) > 0 # type: ignore
if current != expected:
print(bot_index, "swap", x, y)
await sio.emit("toggle_bit", {
"index": index