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): async def run(self, reconnect=True):
while True: while True:
try: try:
await self.run_once() await self.run_once()
except Exception as ex: except Exception as ex:
print(ex) print(ex)
await asyncio.sleep(1)
if not reconnect: if not reconnect:
break break
await asyncio.sleep(1)
def has_joined(self, channel_uid): def has_joined(self, channel_uid):
return channel_uid in self.joined 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) await self.on_message(data.username, data.user_nick, data.channel_uid, data.message)
except AttributeError as ex: except AttributeError as ex:
logger.exception(ex) logger.exception(ex)
raise
except Exception as ex: except Exception as ex:
raise ex raise ex

View File

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