Some fixes in onChatReceive

This commit is contained in:
Maxim Khomutov 2023-07-18 22:33:49 +03:00
parent 31d8cf7842
commit 69348e9339

View File

@ -453,12 +453,7 @@ class Client:
message = ev_data["message"] message = ev_data["message"]
to_all = ev_data.get("to_all") to_all = ev_data.get("to_all")
if to_all is None: if to_all is None:
if need_send:
need_send = False
to_all = True to_all = True
if to_all:
if need_send:
need_send = False
to_self = ev_data.get("to_self") to_self = ev_data.get("to_self")
if to_self is None: if to_self is None:
to_self = True to_self = True
@ -467,6 +462,7 @@ class Client:
if to_client: if to_client:
writer = to_client._writer writer = to_client._writer
await self._send(f"C:{message}", to_all=to_all, to_self=to_self, writer=writer) await self._send(f"C:{message}", to_all=to_all, to_self=to_self, writer=writer)
need_send = False
except KeyError | AttributeError: except KeyError | AttributeError:
self.log.error(f"Returns invalid data: {ev_data}") self.log.error(f"Returns invalid data: {ev_data}")
if need_send: if need_send: