Stringify sticker pack IDs and include sticker ID

This commit is contained in:
Tulir Asokan
2023-09-14 17:15:17 -04:00
parent 55ebaef6e3
commit 6d208b37a5
@@ -736,7 +736,7 @@ class TelegramMessageConverter:
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
@@ -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}
@@ -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,
}