Skip to content

Commit e08e285

Browse files
committed
Add thumb, date and file_name to Audio type
1 parent d5f3684 commit e08e285

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

compiler/api/source/pyrogram.tl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ pyrogram.chat#b0700002 flags:# id:int type:string title:flags.0?string username:
88
pyrogram.message#b0700003 flags:# message_id:int from_user:flags.0?User date:int chat:Chat forward_from:flags.1?User forward_from_chat:flags.2?Chat forward_from_message_id:flags.3?int forward_signature:flags.4?string forward_date:flags.5?int reply_to_message:flags.6?Message edit_date:flags.7?int media_group_id:flags.8?string author_signature:flags.9?string text:flags.10?string entities:flags.11?Vector<MessageEntity> caption_entities:flags.12?Vector<MessageEntity> audio:flags.13?Audio document:flags.14?Document game:flags.15?Game photo:flags.16?Vector<PhotoSize> sticker:flags.17?Sticker video:flags.18?Video voice:flags.19?Voice video_note:flags.20?VideoNote caption:flags.21?string contact:flags.22?Contact location:flags.23?Location venue:flags.24?Venue new_chat_members:flags.25?Vector<User> left_chat_member:flags.26?User new_chat_title:flags.27?string new_chat_photo:flags.28?Vector<PhotoSize> delete_chat_photo:flags.29?true group_chat_created:flags.30?true supergroup_chat_created:flags.31?true channel_chat_created:flags.32?true migrate_to_chat_id:flags.33?int migrate_from_chat_id:flags.34?int pinned_message:flags.35?Message invoice:flags.36?Invoice successful_payment:flags.37?SuccessfulPayment connected_website:flags.38?string views:flags.39?int via_bot:flags.40?User = pyrogram.Message;
99
pyrogram.messageEntity#b0700004 flags:# type:string offset:int length:int url:flags.0?string user:flags.1?User = pyrogram.MessageEntity;
1010
pyrogram.photoSize#b0700005 flags:# file_id:string width:int height:int file_size:flags.0?int date:flags.1?int = pyrogram.PhotoSize;
11-
pyrogram.audio#b0700006 flags:# file_id:string duration:int performer:flags.0?string title:flags.1?string mime_type:flags.2?string file_size:flags.3?int = pyrogram.Audio;
11+
pyrogram.audio#b0700006 flags:# file_id:string thumb:flags.0?PhotoSize file_name:flags.1?string mime_type:flags.2?string file_size:flags.3?int date:flags.4?int duration:int performer:flags.5?string title:flags.6?string = pyrogram.Audio;
1212
pyrogram.document#b0700007 flags:# file_id:string thumb:flags.0?PhotoSize file_name:flags.1?string mime_type:flags.2?string file_size:flags.3?int = pyrogram.Document;
1313
pyrogram.video#b0700008 flags:# file_id:string width:int height:int duration:int thumb:flags.0?PhotoSize mime_type:flags.1?string file_size:flags.2?int = pyrogram.Video;
1414
pyrogram.voice#b0700009 flags:# file_id:string duration:int mime_type:flags.0?string file_size:flags.1?int = pyrogram.Voice;

pyrogram/client/message_parser.py

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,12 @@ def parse_message(
285285
if isinstance(doc, types.Document):
286286
attributes = {type(i): i for i in doc.attributes}
287287

288+
file_name = getattr(
289+
attributes.get(
290+
types.DocumentAttributeFilename, None
291+
), "file_name", None
292+
)
293+
288294
if types.DocumentAttributeAudio in attributes:
289295
audio_attributes = attributes[types.DocumentAttributeAudio]
290296

@@ -318,7 +324,10 @@ def parse_message(
318324
performer=audio_attributes.performer,
319325
title=audio_attributes.title,
320326
mime_type=doc.mime_type,
321-
file_size=doc.size
327+
file_size=doc.size,
328+
thumb=parse_thumb(doc.thumb),
329+
file_name=file_name,
330+
date=doc.date
322331
)
323332
elif types.DocumentAttributeAnimated in attributes:
324333
document = pyrogram.Document(
@@ -332,11 +341,7 @@ def parse_message(
332341
)
333342
),
334343
thumb=parse_thumb(doc.thumb),
335-
file_name=getattr(
336-
attributes.get(
337-
types.DocumentAttributeFilename, None
338-
), "file_name", None
339-
),
344+
file_name=file_name,
340345
mime_type=doc.mime_type,
341346
file_size=doc.size
342347
)
@@ -408,11 +413,7 @@ def parse_message(
408413
)
409414
),
410415
thumb=parse_thumb(doc.thumb),
411-
file_name=getattr(
412-
attributes.get(
413-
types.DocumentAttributeFilename, None
414-
), "file_name", None
415-
),
416+
file_name=file_name,
416417
mime_type=doc.mime_type,
417418
file_size=doc.size
418419
)

0 commit comments

Comments
 (0)