Skip to content

Commit

Permalink
Stringify sticker pack IDs and include sticker ID
Browse files Browse the repository at this point in the history
  • Loading branch information
tulir committed Sep 14, 2023
1 parent 55ebaef commit 6d208b3
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions mautrix_telegram/portal_util/message_convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,7 @@ async def _convert_invoice(
def _parse_document_attributes(attributes: list[TypeDocumentAttribute]) -> DocAttrs:
name, mime_type, is_sticker, sticker_alt, width, height = None, None, False, None, 0, 0
is_gif, is_audio, is_voice, duration, waveform = False, False, False, 0, bytes()
sticker_pack_ref = {}
sticker_pack_ref = None
for attr in attributes:
if isinstance(attr, DocumentAttributeFilename):
name = name or attr.file_name
Expand All @@ -746,8 +746,8 @@ def _parse_document_attributes(attributes: list[TypeDocumentAttribute]) -> DocAt
sticker_alt = attr.alt
if isinstance(attr.stickerset, InputStickerSetID):
sticker_pack_ref = {
"id": attr.stickerset.id,
"access_hash": attr.stickerset.access_hash,
"id": str(attr.stickerset.id),
"access_hash": str(attr.stickerset.access_hash),
}
elif isinstance(attr.stickerset, InputStickerSetShortName):
sticker_pack_ref = {"short_name": attr.stickerset.short_name}
Expand Down Expand Up @@ -804,6 +804,7 @@ def _parse_document_meta(
if attrs.is_sticker:
info["fi.mau.telegram.sticker"] = {
"alt": attrs.sticker_alt,
"id": str(document.id),
"pack": attrs.sticker_pack_ref,
}

Expand Down

0 comments on commit 6d208b3

Please sign in to comment.