This commit is contained in:
retoor 2025-02-18 19:09:51 +01:00
parent 9d93dadae0
commit 7c688c1c9b
2 changed files with 6 additions and 6 deletions

View File

@ -36,15 +36,17 @@ class Bot:
async def run(self, reconnect=True):
while True:
try:
await self.run_once()
except Exception as ex:
print(ex)
await asyncio.sleep(1)
if not reconnect:
break
await asyncio.sleep(1)
def has_joined(self, channel_uid):
return channel_uid in self.joined
@ -103,6 +105,7 @@ class Bot:
await self.on_message(data.username, data.user_nick, data.channel_uid, data.message)
except AttributeError as ex:
logger.exception(ex)
raise
except Exception as ex:
raise ex

View File

@ -61,10 +61,7 @@ class RPC:
async def method(*args, **kwargs):
self.current_call_id = str(uuid.uuid4())
payload = dict(method=name, args=args, kwargs=kwargs, callId=self.current_call_id)
try:
await self.ws.send_json(payload)
except Exception as ex:
logger.exception(ex)
await self.ws.send_json(payload)
async def returner():
while True: