Skip to content

Commit

Permalink
Use only emoji as sticker body if unicodedata doesn't find name. Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
tulir committed Dec 19, 2018
1 parent 85dc424 commit 082ef79
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion mautrix_telegram/portal.py
Original file line number Diff line number Diff line change
Expand Up @@ -1307,7 +1307,10 @@ def _parse_telegram_document_meta(evt: Message, file: DBTelegramFile, attrs: Dic
if attrs["is_sticker"]:
alt = attrs["sticker_alt"]
if len(alt) > 0:
name = f"{alt} ({unicodedata.name(alt[0]).lower()})"
try:
name = f"{alt} ({unicodedata.name(alt[0]).lower()})"
except ValueError:
name = alt

mime_type = document.mime_type or file.mime_type
info = {
Expand Down

0 comments on commit 082ef79

Please sign in to comment.