mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-12 18:19:34 +00:00
Fixed attachment of media from dict. (InputMedia<Photo/Video>, MediaGroup)
This commit is contained in:
parent
ee87cb5e07
commit
51b84cd78e
1 changed files with 5 additions and 5 deletions
|
|
@ -46,8 +46,8 @@ class InputMediaPhoto(InputMedia):
|
||||||
https://core.telegram.org/bots/api#inputmediaphoto
|
https://core.telegram.org/bots/api#inputmediaphoto
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, media: base.InputFile, caption: base.String = None):
|
def __init__(self, media: base.InputFile, caption: base.String = None, **kwargs):
|
||||||
super(InputMediaPhoto, self).__init__(type='photo', media=media, caption=caption)
|
super(InputMediaPhoto, self).__init__(type='photo', media=media, caption=caption, conf=kwargs)
|
||||||
|
|
||||||
if isinstance(media, (io.IOBase, InputFile)):
|
if isinstance(media, (io.IOBase, InputFile)):
|
||||||
self.file = media
|
self.file = media
|
||||||
|
|
@ -64,9 +64,9 @@ class InputMediaVideo(InputMedia):
|
||||||
duration: base.Integer = fields.Field()
|
duration: base.Integer = fields.Field()
|
||||||
|
|
||||||
def __init__(self, media: base.InputFile, caption: base.String = None,
|
def __init__(self, media: base.InputFile, caption: base.String = None,
|
||||||
width: base.Integer = None, height: base.Integer = None, duration: base.Integer = None):
|
width: base.Integer = None, height: base.Integer = None, duration: base.Integer = None, **kwargs):
|
||||||
super(InputMediaVideo, self).__init__(type='video', media=media, caption=caption,
|
super(InputMediaVideo, self).__init__(type='video', media=media, caption=caption,
|
||||||
width=width, height=height, duration=duration)
|
width=width, height=height, duration=duration, conf=kwargs)
|
||||||
|
|
||||||
if isinstance(media, (io.IOBase, InputFile)):
|
if isinstance(media, (io.IOBase, InputFile)):
|
||||||
self.file = media
|
self.file = media
|
||||||
|
|
@ -82,7 +82,7 @@ class MediaGroup(base.TelegramObject):
|
||||||
self.media = []
|
self.media = []
|
||||||
|
|
||||||
if medias:
|
if medias:
|
||||||
self.attach_many(medias)
|
self.attach_many(*medias)
|
||||||
|
|
||||||
def attach_many(self, *medias: typing.Union[InputMedia, typing.Dict]):
|
def attach_many(self, *medias: typing.Union[InputMedia, typing.Dict]):
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue