Skip to content

Commit

Permalink
Catch errors updating initial profile. Fixes #860
Browse files Browse the repository at this point in the history
  • Loading branch information
tulir committed Feb 21, 2023
1 parent 4e5305c commit f63c679
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions mautrix_telegram/portal.py
Original file line number Diff line number Diff line change
Expand Up @@ -3361,12 +3361,17 @@ async def _handle_telegram_message(
f"Telegram user {sender.tgid} sent a message, but doesn't have a displayname,"
" updating info..."
)
entity = await source.client.get_entity(sender.peer)
await sender.update_info(source, entity)
if not sender.displayname:
self.log.debug(
f"Telegram user {sender.tgid} doesn't have a displayname even after"
f" updating with data {entity!s}"
try:
entity = await source.client.get_entity(sender.peer)
await sender.update_info(source, entity)
if not sender.displayname:
self.log.debug(
f"Telegram user {sender.tgid} doesn't have a displayname even after"
f" updating with data {entity!s}"
)
except ValueError as e:
self.log.warning(
f"Couldn't find entity to update profile of {sender.tgid}", exc_info=True
)

if sender:
Expand Down

0 comments on commit f63c679

Please sign in to comment.