mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-11 01:54:53 +00:00
Implemented features from the latest Bot API 3.6.
This commit is contained in:
parent
483c1b295d
commit
819a212b55
4 changed files with 28 additions and 9 deletions
|
|
@ -20,8 +20,8 @@ else:
|
|||
|
||||
asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())
|
||||
|
||||
VERSION = Version(1, 1, 0, stage=Stage.FINAL, build=0)
|
||||
API_VERSION = Version(3, 5)
|
||||
VERSION = Version(1, 1, 1, stage=Stage.DEV, build=0)
|
||||
API_VERSION = Version(3, 6)
|
||||
|
||||
__version__ = VERSION.version
|
||||
__api_version__ = API_VERSION.version
|
||||
|
|
|
|||
|
|
@ -356,6 +356,7 @@ class Bot(BaseBot):
|
|||
width: typing.Union[base.Integer, None] = None,
|
||||
height: typing.Union[base.Integer, None] = None,
|
||||
caption: typing.Union[base.String, None] = None,
|
||||
supports_streaming: typing.Union[base.Boolean, None] = None,
|
||||
disable_notification: typing.Union[base.Boolean, None] = None,
|
||||
reply_to_message_id: typing.Union[base.Integer, None] = None,
|
||||
reply_markup: typing.Union[types.InlineKeyboardMarkup,
|
||||
|
|
@ -363,8 +364,8 @@ class Bot(BaseBot):
|
|||
types.ReplyKeyboardRemove,
|
||||
types.ForceReply, None] = None) -> types.Message:
|
||||
"""
|
||||
Use this method to send video files, Telegram clients support mp4 videos
|
||||
(other formats may be sent as Document).
|
||||
Use this method to send video files, Telegram clients support mp4 videos
|
||||
(other formats may be sent as Document).
|
||||
|
||||
Source: https://core.telegram.org/bots/api#sendvideo
|
||||
|
||||
|
|
@ -380,12 +381,14 @@ class Bot(BaseBot):
|
|||
:type height: :obj:`typing.Union[base.Integer, None]`
|
||||
:param caption: Video caption (may also be used when resending videos by file_id), 0-200 characters
|
||||
:type caption: :obj:`typing.Union[base.String, None]`
|
||||
:param supports_streaming: Pass True, if the uploaded video is suitable for streaming
|
||||
:type supports_streaming: :obj:`typing.Union[base.Boolean, None]`
|
||||
:param disable_notification: Sends the message silently. Users will receive a notification with no sound.
|
||||
:type disable_notification: :obj:`typing.Union[base.Boolean, None]`
|
||||
:param reply_to_message_id: If the message is a reply, ID of the original message
|
||||
:type reply_to_message_id: :obj:`typing.Union[base.Integer, None]`
|
||||
:param reply_markup: Additional interface options.
|
||||
:type reply_markup: :obj:`typing.Union[types.InlineKeyboardMarkup,
|
||||
:type reply_markup: :obj:`typing.Union[types.InlineKeyboardMarkup,
|
||||
types.ReplyKeyboardMarkup, types.ReplyKeyboardRemove, types.ForceReply, None]`
|
||||
:return: On success, the sent Message is returned.
|
||||
:rtype: :obj:`types.Message`
|
||||
|
|
|
|||
|
|
@ -22,6 +22,15 @@ class InputMedia(base.TelegramObject):
|
|||
type: base.String = fields.Field(default='photo')
|
||||
media: base.String = fields.Field()
|
||||
caption: base.String = fields.Field()
|
||||
parse_mode: base.Boolean = fields.Field()
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(InputMedia, self).__init__(*args, **kwargs)
|
||||
try:
|
||||
if self.parse_mode is None and self.bot.parse_mode:
|
||||
self.parse_mode = self.bot.parse_mode
|
||||
except RuntimeError:
|
||||
pass
|
||||
|
||||
@property
|
||||
def file(self):
|
||||
|
|
@ -49,8 +58,9 @@ class InputMediaPhoto(InputMedia):
|
|||
https://core.telegram.org/bots/api#inputmediaphoto
|
||||
"""
|
||||
|
||||
def __init__(self, media: base.InputFile, caption: base.String = None, **kwargs):
|
||||
super(InputMediaPhoto, self).__init__(type='photo', media=media, caption=caption, conf=kwargs)
|
||||
def __init__(self, media: base.InputFile, caption: base.String = None, parse_mode: base.Boolean = None, **kwargs):
|
||||
super(InputMediaPhoto, self).__init__(type='photo', media=media, caption=caption, parse_mode=parse_mode,
|
||||
conf=kwargs)
|
||||
|
||||
if isinstance(media, (io.IOBase, InputFile)):
|
||||
self.file = media
|
||||
|
|
@ -65,11 +75,16 @@ class InputMediaVideo(InputMedia):
|
|||
width: base.Integer = fields.Field()
|
||||
height: base.Integer = fields.Field()
|
||||
duration: base.Integer = fields.Field()
|
||||
supports_streaming: base.Boolean = fields.Field()
|
||||
|
||||
def __init__(self, media: base.InputFile, caption: base.String = None,
|
||||
width: base.Integer = None, height: base.Integer = None, duration: base.Integer = None, **kwargs):
|
||||
width: base.Integer = None, height: base.Integer = None, duration: base.Integer = None,
|
||||
parse_mode: base.Boolean = None,
|
||||
supports_streaming: base.Boolean = None, **kwargs):
|
||||
super(InputMediaVideo, self).__init__(type='video', media=media, caption=caption,
|
||||
width=width, height=height, duration=duration, conf=kwargs)
|
||||
width=width, height=height, duration=duration,
|
||||
parse_mode=parse_mode,
|
||||
supports_streaming=supports_streaming, conf=kwargs)
|
||||
|
||||
if isinstance(media, (io.IOBase, InputFile)):
|
||||
self.file = media
|
||||
|
|
|
|||
|
|
@ -70,6 +70,7 @@ class Message(base.TelegramObject):
|
|||
pinned_message: 'Message' = fields.Field(base='Message')
|
||||
invoice: Invoice = fields.Field(base=Invoice)
|
||||
successful_payment: SuccessfulPayment = fields.Field(base=SuccessfulPayment)
|
||||
connected_website: base.String = fields.Field()
|
||||
|
||||
@property
|
||||
@functools.lru_cache()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue