Updated arg system & made websocked somehow work???

This commit is contained in:
2025-02-08 15:50:33 +01:00
parent e2869fb8a2
commit 1c7170bb81
10 changed files with 77 additions and 52 deletions
+4 -3
View File
@@ -1,5 +1,6 @@
import websockets
from macros import py_print
import bot as botPy
ws_global = None
@@ -9,11 +10,11 @@ async def send_message(message: str):
await ws_global.send(message)
async def websocket_client():
async def websocket_client(bot: botPy.Bot):
global ws_global
async with websockets.connect("ws://127.0.0.1:9001") as ws:
async with websockets.connect(f"ws://127.0.0.1:{bot.args["port"]}") as ws:
ws_global = ws
py_print("Connected webSocket server on ws://127.0.0.1:9001")
py_print(f"Connected webSocket server on ws://127.0.0.1:{bot.args["port"]}")
while True:
response = await ws.recv()