This commit is contained in:
retoor 2025-02-18 16:34:57 +01:00
parent 11d47c3ebe
commit 9d93dadae0

View File

@ -34,15 +34,18 @@ class Bot:
self.joined = set()
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
@ -71,6 +74,9 @@ class Bot:
pass
data = await rpc.receive()
if data is None:
break
try:
message = data.message.strip()
@ -98,5 +104,5 @@ class Bot:
except AttributeError as ex:
logger.exception(ex)
except Exception as ex:
logger.exception(ex)
raise ex