mirror of
https://github.com/TeamPGM/pyrogram.git
synced 2024-11-24 07:51:44 +00:00
Handle Voice type
This commit is contained in:
parent
70fa667ef9
commit
c1e6f9c2ca
@ -139,6 +139,7 @@ def parse_message(message: types.Message, users: dict, chats: dict):
|
||||
location = None
|
||||
contact = None
|
||||
audio = None
|
||||
voice = None
|
||||
video = None
|
||||
video_note = None
|
||||
|
||||
@ -207,6 +208,22 @@ def parse_message(message: types.Message, users: dict, chats: dict):
|
||||
if types.DocumentAttributeAudio in attributes:
|
||||
audio_attributes = attributes[types.DocumentAttributeAudio]
|
||||
|
||||
if audio_attributes.voice:
|
||||
voice = pyrogram.Voice(
|
||||
file_id=encode(
|
||||
pack(
|
||||
"<iiqq",
|
||||
3,
|
||||
doc.dc_id,
|
||||
doc.id,
|
||||
doc.access_hash
|
||||
)
|
||||
),
|
||||
duration=audio_attributes.duration,
|
||||
mime_type=doc.mime_type,
|
||||
file_size=doc.size
|
||||
)
|
||||
else:
|
||||
audio = pyrogram.Audio(
|
||||
file_id=encode(
|
||||
pack(
|
||||
@ -281,6 +298,7 @@ def parse_message(message: types.Message, users: dict, chats: dict):
|
||||
location=location,
|
||||
contact=contact,
|
||||
audio=audio,
|
||||
voice=voice,
|
||||
video=video,
|
||||
video_note=video_note
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user