From 9dff99cf3640f8b37436b93c727c7002f7a315a2 Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Tue, 17 Apr 2018 15:17:40 +0200 Subject: [PATCH] Add set_name and emoji to Stickers --- pyrogram/client/message_parser.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/pyrogram/client/message_parser.py b/pyrogram/client/message_parser.py index da12fae7..51eba3ae 100644 --- a/pyrogram/client/message_parser.py +++ b/pyrogram/client/message_parser.py @@ -19,7 +19,7 @@ from struct import pack import pyrogram -from pyrogram.api import types +from pyrogram.api import types, functions from .utils import encode # TODO: Organize the code better? @@ -393,6 +393,14 @@ def parse_message( ) elif types.DocumentAttributeSticker in attributes: image_size_attributes = attributes[types.DocumentAttributeImageSize] + sticker_attribute = attributes[types.DocumentAttributeSticker] + + if isinstance(sticker_attribute.stickerset, types.InputStickerSetID): + set_name = client.send( + functions.messages.GetStickerSet(sticker_attribute.stickerset) + ).set.short_name + else: + set_name = None sticker = pyrogram.Sticker( file_id=encode( @@ -407,7 +415,9 @@ def parse_message( width=image_size_attributes.w, height=image_size_attributes.h, thumb=parse_thumb(doc.thumb), - # TODO: Emoji, set_name and mask_position + # TODO: mask_position + set_name=set_name, + emoji=sticker_attribute.alt, file_size=doc.size, mime_type=doc.mime_type, file_name=file_name,