Changed join on invite logic and added debug print. Fixes #5 (hopefully).

This commit is contained in:
Ville Ranki 2019-12-29 17:26:47 +02:00
parent f93069fc4b
commit 73084a15f9
1 changed files with 11 additions and 11 deletions

22
bot.py
View File

@ -117,17 +117,17 @@ class Bot:
traceback.print_exc(file=sys.stderr) traceback.print_exc(file=sys.stderr)
async def invite_cb(self, room, event): async def invite_cb(self, room, event):
if not self.join_on_invite or self.is_owner(event): if self.join_on_invite or self.is_owner(event):
return for attempt in range(3):
result = await self.client.join(room.room_id)
for attempt in range(3): if type(result) == JoinError:
result = await self.client.join(room.room_id) print(f"Error joining room {room.room_id} (attempt %d): %s",
if type(result) == JoinError: attempt, result.message,
print(f"Error joining room {room.room_id} (attempt %d): %s", )
attempt, result.message, else:
) break
else: else:
break print('Received invite event, but not joining as sender is not owner or bot not configured to join on invte.')
def load_module(self, modulename): def load_module(self, modulename):
try: try: