mirror of
https://github.com/TeamPGM/pyrogram.git
synced 2024-11-24 15:59:18 +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
|
location = None
|
||||||
contact = None
|
contact = None
|
||||||
audio = None
|
audio = None
|
||||||
|
voice = None
|
||||||
video = None
|
video = None
|
||||||
video_note = None
|
video_note = None
|
||||||
|
|
||||||
@ -207,6 +208,22 @@ def parse_message(message: types.Message, users: dict, chats: dict):
|
|||||||
if types.DocumentAttributeAudio in attributes:
|
if types.DocumentAttributeAudio in attributes:
|
||||||
audio_attributes = attributes[types.DocumentAttributeAudio]
|
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(
|
audio = pyrogram.Audio(
|
||||||
file_id=encode(
|
file_id=encode(
|
||||||
pack(
|
pack(
|
||||||
@ -281,6 +298,7 @@ def parse_message(message: types.Message, users: dict, chats: dict):
|
|||||||
location=location,
|
location=location,
|
||||||
contact=contact,
|
contact=contact,
|
||||||
audio=audio,
|
audio=audio,
|
||||||
|
voice=voice,
|
||||||
video=video,
|
video=video,
|
||||||
video_note=video_note
|
video_note=video_note
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user