add asengine client id

This commit is contained in:
CakeCN
2025-09-13 13:43:03 +08:00
parent b75f002cf7
commit 173d7960d4

View File

@@ -154,7 +154,7 @@ class ASEngineClient:
self.sid = None self.sid = None
print("Disconnected from server") print("Disconnected from server")
def send_text(self, route: str, text: str, id:str) -> bool: def send_text(self, route: str, text: str, id:str="") -> bool:
""" """
发送文本消息 发送文本消息
:param route: 目标路由 :param route: 目标路由
@@ -164,7 +164,8 @@ class ASEngineClient:
if not self.connected: if not self.connected:
print("Not connected to server") print("Not connected to server")
return False return False
if id == "":
id = self.id
try: try:
self.sio.emit(route, {'type': 'text', 'data': text, 'id': id}, namespace=self.namespace) self.sio.emit(route, {'type': 'text', 'data': text, 'id': id}, namespace=self.namespace)