mirror of
https://github.com/pyrogram/pyrogram
synced 2025-08-28 21:07:59 +00:00
Handle Video and VideoNote type
This commit is contained in:
parent
c49c8c0ce6
commit
70fa667ef9
@ -139,6 +139,8 @@ def parse_message(message: types.Message, users: dict, chats: dict):
|
|||||||
location = None
|
location = None
|
||||||
contact = None
|
contact = None
|
||||||
audio = None
|
audio = None
|
||||||
|
video = None
|
||||||
|
video_note = None
|
||||||
|
|
||||||
media = message.media
|
media = message.media
|
||||||
|
|
||||||
@ -221,6 +223,43 @@ def parse_message(message: types.Message, users: dict, chats: dict):
|
|||||||
mime_type=doc.mime_type,
|
mime_type=doc.mime_type,
|
||||||
file_size=doc.size
|
file_size=doc.size
|
||||||
)
|
)
|
||||||
|
elif types.DocumentAttributeVideo in attributes:
|
||||||
|
video_attributes = attributes[types.DocumentAttributeVideo]
|
||||||
|
|
||||||
|
if video_attributes.round_message:
|
||||||
|
video_note = pyrogram.VideoNote(
|
||||||
|
file_id=encode(
|
||||||
|
pack(
|
||||||
|
"<iiqq",
|
||||||
|
13,
|
||||||
|
doc.dc_id,
|
||||||
|
doc.id,
|
||||||
|
doc.access_hash
|
||||||
|
)
|
||||||
|
),
|
||||||
|
length=video_attributes.w,
|
||||||
|
duration=video_attributes.duration,
|
||||||
|
thumb=parse_thumb(doc.thumb),
|
||||||
|
file_size=doc.size
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
video = pyrogram.Video(
|
||||||
|
file_id=encode(
|
||||||
|
pack(
|
||||||
|
"<iiqq",
|
||||||
|
4,
|
||||||
|
doc.dc_id,
|
||||||
|
doc.id,
|
||||||
|
doc.access_hash
|
||||||
|
)
|
||||||
|
),
|
||||||
|
width=video_attributes.w,
|
||||||
|
height=video_attributes.h,
|
||||||
|
duration=video_attributes.duration,
|
||||||
|
thumb=parse_thumb(doc.thumb),
|
||||||
|
mime_type=doc.mime_type,
|
||||||
|
file_size=doc.size
|
||||||
|
)
|
||||||
|
|
||||||
return pyrogram.Message(
|
return pyrogram.Message(
|
||||||
message_id=message.id,
|
message_id=message.id,
|
||||||
@ -242,6 +281,8 @@ def parse_message(message: types.Message, users: dict, chats: dict):
|
|||||||
location=location,
|
location=location,
|
||||||
contact=contact,
|
contact=contact,
|
||||||
audio=audio,
|
audio=audio,
|
||||||
|
video=video,
|
||||||
|
video_note=video_note
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user