mirror of
https://github.com/Mayuri-Chan/pyrofork.git
synced 2026-01-06 15:14:52 +00:00
Pyrofork: Fix NoneType error when sending video as media group
Signed-off-by: wulan17 <wulan17@nusantararom.org>
This commit is contained in:
parent
ec19f4f6bb
commit
3049e6e63b
1 changed files with 12 additions and 10 deletions
|
|
@ -217,6 +217,17 @@ class SendMediaGroup:
|
||||||
else:
|
else:
|
||||||
if not any([track.track_type == 'Audio' for track in videoInfo.tracks]):
|
if not any([track.track_type == 'Audio' for track in videoInfo.tracks]):
|
||||||
is_animation = True
|
is_animation = True
|
||||||
|
attributes = [
|
||||||
|
raw.types.DocumentAttributeVideo(
|
||||||
|
supports_streaming=True if is_animation else (i.supports_streaming or None),
|
||||||
|
duration=i.duration,
|
||||||
|
w=i.width,
|
||||||
|
h=i.height
|
||||||
|
),
|
||||||
|
raw.types.DocumentAttributeFilename(file_name=os.path.basename(i.media))
|
||||||
|
]
|
||||||
|
if is_animation:
|
||||||
|
attributes.append(raw.types.DocumentAttributeAnimated())
|
||||||
media = await self.invoke(
|
media = await self.invoke(
|
||||||
raw.functions.messages.UploadMedia(
|
raw.functions.messages.UploadMedia(
|
||||||
peer=await self.resolve_peer(chat_id),
|
peer=await self.resolve_peer(chat_id),
|
||||||
|
|
@ -226,16 +237,7 @@ class SendMediaGroup:
|
||||||
spoiler=i.has_spoiler,
|
spoiler=i.has_spoiler,
|
||||||
mime_type=self.guess_mime_type(i.media) or "video/mp4",
|
mime_type=self.guess_mime_type(i.media) or "video/mp4",
|
||||||
nosound_video=is_animation,
|
nosound_video=is_animation,
|
||||||
attributes=[
|
attributes=attributes
|
||||||
raw.types.DocumentAttributeVideo(
|
|
||||||
supports_streaming=True if is_animation else (i.supports_streaming or None),
|
|
||||||
duration=i.duration,
|
|
||||||
w=i.width,
|
|
||||||
h=i.height
|
|
||||||
),
|
|
||||||
raw.types.DocumentAttributeFilename(file_name=os.path.basename(i.media)),
|
|
||||||
raw.types.DocumentAttributeAnimated() if is_animation else None
|
|
||||||
]
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue