mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Merge pull request #1148 from Latand/dev-2.x-api-6.6
Renamed the parameter thumb in the methods sendAnimation, sendAudio, …
This commit is contained in:
commit
ec24d70911
10 changed files with 390 additions and 78 deletions
|
|
@ -8,7 +8,7 @@ import warnings
|
||||||
from .base import BaseBot, api
|
from .base import BaseBot, api
|
||||||
from .. import types
|
from .. import types
|
||||||
from ..types import base
|
from ..types import base
|
||||||
from ..utils.deprecated import deprecated
|
from ..utils.deprecated import deprecated, renamed_argument
|
||||||
from ..utils.exceptions import ValidationError
|
from ..utils.exceptions import ValidationError
|
||||||
from ..utils.mixins import DataMixin, ContextInstanceMixin
|
from ..utils.mixins import DataMixin, ContextInstanceMixin
|
||||||
from ..utils.payload import generate_payload, prepare_arg, prepare_attachment, prepare_file
|
from ..utils.payload import generate_payload, prepare_arg, prepare_attachment, prepare_file
|
||||||
|
|
@ -565,6 +565,7 @@ class Bot(BaseBot, DataMixin, ContextInstanceMixin):
|
||||||
result = await self.request(api.Methods.SEND_PHOTO, payload, files)
|
result = await self.request(api.Methods.SEND_PHOTO, payload, files)
|
||||||
return types.Message(**result)
|
return types.Message(**result)
|
||||||
|
|
||||||
|
@renamed_argument('thumb', 'thumbnail', '3.0')
|
||||||
async def send_audio(self,
|
async def send_audio(self,
|
||||||
chat_id: typing.Union[base.Integer, base.String],
|
chat_id: typing.Union[base.Integer, base.String],
|
||||||
audio: typing.Union[base.InputFile, base.String],
|
audio: typing.Union[base.InputFile, base.String],
|
||||||
|
|
@ -574,7 +575,7 @@ class Bot(BaseBot, DataMixin, ContextInstanceMixin):
|
||||||
duration: typing.Optional[base.Integer] = None,
|
duration: typing.Optional[base.Integer] = None,
|
||||||
performer: typing.Optional[base.String] = None,
|
performer: typing.Optional[base.String] = None,
|
||||||
title: typing.Optional[base.String] = None,
|
title: typing.Optional[base.String] = None,
|
||||||
thumb: typing.Union[base.InputFile, base.String, None] = None,
|
thumbnail: typing.Union[base.InputFile, base.String, None] = None,
|
||||||
message_thread_id: typing.Optional[base.Integer] = None,
|
message_thread_id: typing.Optional[base.Integer] = None,
|
||||||
disable_notification: typing.Optional[base.Boolean] = None,
|
disable_notification: typing.Optional[base.Boolean] = None,
|
||||||
protect_content: typing.Optional[base.Boolean] = None,
|
protect_content: typing.Optional[base.Boolean] = None,
|
||||||
|
|
@ -584,6 +585,7 @@ class Bot(BaseBot, DataMixin, ContextInstanceMixin):
|
||||||
types.ReplyKeyboardMarkup,
|
types.ReplyKeyboardMarkup,
|
||||||
types.ReplyKeyboardRemove,
|
types.ReplyKeyboardRemove,
|
||||||
types.ForceReply, None] = None,
|
types.ForceReply, None] = None,
|
||||||
|
thumb: typing.Union[base.InputFile, base.String, None] = None,
|
||||||
) -> types.Message:
|
) -> types.Message:
|
||||||
"""
|
"""
|
||||||
Use this method to send audio files, if you want Telegram clients to display them in the music player.
|
Use this method to send audio files, if you want Telegram clients to display them in the music player.
|
||||||
|
|
@ -623,9 +625,13 @@ class Bot(BaseBot, DataMixin, ContextInstanceMixin):
|
||||||
:param title: Track name
|
:param title: Track name
|
||||||
:type title: :obj:`typing.Optional[base.String]`
|
:type title: :obj:`typing.Optional[base.String]`
|
||||||
|
|
||||||
:param thumb: Thumbnail of the file sent
|
|
||||||
|
:param thumb: deprecated in API 6.6. Use thumbnail instead
|
||||||
:type thumb: :obj:`typing.Union[base.InputFile, base.String, None]`
|
:type thumb: :obj:`typing.Union[base.InputFile, base.String, None]`
|
||||||
|
|
||||||
|
:param thumbnail: Thumbnail of the file sent
|
||||||
|
:type thumbnail: :obj:`typing.Union[base.InputFile, base.String, None]`
|
||||||
|
|
||||||
:param disable_notification: Sends the message silently. Users will receive a notification with no sound
|
:param disable_notification: Sends the message silently. Users will receive a notification with no sound
|
||||||
:type disable_notification: :obj:`typing.Optional[base.Boolean]`
|
:type disable_notification: :obj:`typing.Optional[base.Boolean]`
|
||||||
|
|
||||||
|
|
@ -650,7 +656,7 @@ class Bot(BaseBot, DataMixin, ContextInstanceMixin):
|
||||||
"""
|
"""
|
||||||
reply_markup = prepare_arg(reply_markup)
|
reply_markup = prepare_arg(reply_markup)
|
||||||
caption_entities = prepare_arg(caption_entities)
|
caption_entities = prepare_arg(caption_entities)
|
||||||
payload = generate_payload(**locals(), exclude=['audio', 'thumb'])
|
payload = generate_payload(**locals(), exclude=['audio', 'thumb', 'thumbnail'])
|
||||||
if self.parse_mode and caption_entities is None:
|
if self.parse_mode and caption_entities is None:
|
||||||
payload.setdefault('parse_mode', self.parse_mode)
|
payload.setdefault('parse_mode', self.parse_mode)
|
||||||
if self.protect_content is not None:
|
if self.protect_content is not None:
|
||||||
|
|
@ -658,15 +664,16 @@ class Bot(BaseBot, DataMixin, ContextInstanceMixin):
|
||||||
|
|
||||||
files = {}
|
files = {}
|
||||||
prepare_file(payload, files, 'audio', audio)
|
prepare_file(payload, files, 'audio', audio)
|
||||||
prepare_attachment(payload, files, 'thumb', thumb)
|
prepare_attachment(payload, files, 'thumbnail', thumbnail or thumb)
|
||||||
|
|
||||||
result = await self.request(api.Methods.SEND_AUDIO, payload, files)
|
result = await self.request(api.Methods.SEND_AUDIO, payload, files)
|
||||||
return types.Message(**result)
|
return types.Message(**result)
|
||||||
|
|
||||||
|
@renamed_argument('thumb', 'thumbnail', '3.0')
|
||||||
async def send_document(self,
|
async def send_document(self,
|
||||||
chat_id: typing.Union[base.Integer, base.String],
|
chat_id: typing.Union[base.Integer, base.String],
|
||||||
document: typing.Union[base.InputFile, base.String],
|
document: typing.Union[base.InputFile, base.String],
|
||||||
thumb: typing.Union[base.InputFile, base.String, None] = None,
|
thumbnail: typing.Union[base.InputFile, base.String, None] = None,
|
||||||
caption: typing.Optional[base.String] = None,
|
caption: typing.Optional[base.String] = None,
|
||||||
parse_mode: typing.Optional[base.String] = None,
|
parse_mode: typing.Optional[base.String] = None,
|
||||||
caption_entities: typing.Optional[typing.List[types.MessageEntity]] = None,
|
caption_entities: typing.Optional[typing.List[types.MessageEntity]] = None,
|
||||||
|
|
@ -681,6 +688,7 @@ class Bot(BaseBot, DataMixin, ContextInstanceMixin):
|
||||||
types.ReplyKeyboardRemove,
|
types.ReplyKeyboardRemove,
|
||||||
types.ForceReply,
|
types.ForceReply,
|
||||||
None] = None,
|
None] = None,
|
||||||
|
thumb: typing.Union[base.InputFile, base.String, None] = None,
|
||||||
) -> types.Message:
|
) -> types.Message:
|
||||||
"""
|
"""
|
||||||
Use this method to send general files. On success, the sent Message is
|
Use this method to send general files. On success, the sent Message is
|
||||||
|
|
@ -701,7 +709,10 @@ class Bot(BaseBot, DataMixin, ContextInstanceMixin):
|
||||||
:param document: File to send
|
:param document: File to send
|
||||||
:type document: :obj:`typing.Union[base.InputFile, base.String]`
|
:type document: :obj:`typing.Union[base.InputFile, base.String]`
|
||||||
|
|
||||||
:param thumb: Thumbnail of the file sent
|
:param thumbnail: Thumbnail of the file sent
|
||||||
|
:type thumbnail: :obj:`typing.Union[base.InputFile, base.String, None]`
|
||||||
|
|
||||||
|
:param thumb: deprecated in API 6.6. Use thumbnail instead
|
||||||
:type thumb: :obj:`typing.Union[base.InputFile, base.String, None]`
|
:type thumb: :obj:`typing.Union[base.InputFile, base.String, None]`
|
||||||
|
|
||||||
:param caption: Document caption (may also be used when resending documents
|
:param caption: Document caption (may also be used when resending documents
|
||||||
|
|
@ -748,7 +759,7 @@ class Bot(BaseBot, DataMixin, ContextInstanceMixin):
|
||||||
"""
|
"""
|
||||||
reply_markup = prepare_arg(reply_markup)
|
reply_markup = prepare_arg(reply_markup)
|
||||||
caption_entities = prepare_arg(caption_entities)
|
caption_entities = prepare_arg(caption_entities)
|
||||||
payload = generate_payload(**locals(), exclude=['document'])
|
payload = generate_payload(**locals(), exclude=['document', 'thumb', 'thumbnail'])
|
||||||
if self.parse_mode and caption_entities is None:
|
if self.parse_mode and caption_entities is None:
|
||||||
payload.setdefault('parse_mode', self.parse_mode)
|
payload.setdefault('parse_mode', self.parse_mode)
|
||||||
if self.protect_content is not None:
|
if self.protect_content is not None:
|
||||||
|
|
@ -756,17 +767,18 @@ class Bot(BaseBot, DataMixin, ContextInstanceMixin):
|
||||||
|
|
||||||
files = {}
|
files = {}
|
||||||
prepare_file(payload, files, 'document', document)
|
prepare_file(payload, files, 'document', document)
|
||||||
prepare_attachment(payload, files, 'thumb', thumb)
|
prepare_attachment(payload, files, 'thumbnail', thumbnail or thumb)
|
||||||
|
|
||||||
result = await self.request(api.Methods.SEND_DOCUMENT, payload, files)
|
result = await self.request(api.Methods.SEND_DOCUMENT, payload, files)
|
||||||
return types.Message(**result)
|
return types.Message(**result)
|
||||||
|
|
||||||
|
@renamed_argument('thumb', 'thumbnail', '6.6')
|
||||||
async def send_video(self, chat_id: typing.Union[base.Integer, base.String],
|
async def send_video(self, chat_id: typing.Union[base.Integer, base.String],
|
||||||
video: typing.Union[base.InputFile, base.String],
|
video: typing.Union[base.InputFile, base.String],
|
||||||
duration: typing.Optional[base.Integer] = None,
|
duration: typing.Optional[base.Integer] = None,
|
||||||
width: typing.Optional[base.Integer] = None,
|
width: typing.Optional[base.Integer] = None,
|
||||||
height: typing.Optional[base.Integer] = None,
|
height: typing.Optional[base.Integer] = None,
|
||||||
thumb: typing.Union[base.InputFile, base.String, None] = None,
|
thumbnail: typing.Union[base.InputFile, base.String, None] = None,
|
||||||
caption: typing.Optional[base.String] = None,
|
caption: typing.Optional[base.String] = None,
|
||||||
parse_mode: typing.Optional[base.String] = None,
|
parse_mode: typing.Optional[base.String] = None,
|
||||||
caption_entities: typing.Optional[typing.List[types.MessageEntity]] = None,
|
caption_entities: typing.Optional[typing.List[types.MessageEntity]] = None,
|
||||||
|
|
@ -781,6 +793,7 @@ class Bot(BaseBot, DataMixin, ContextInstanceMixin):
|
||||||
types.ReplyKeyboardRemove,
|
types.ReplyKeyboardRemove,
|
||||||
types.ForceReply, None] = None,
|
types.ForceReply, None] = None,
|
||||||
has_spoiler: typing.Optional[base.Boolean] = None,
|
has_spoiler: typing.Optional[base.Boolean] = None,
|
||||||
|
thumb: typing.Union[base.InputFile, base.String, None] = None,
|
||||||
) -> types.Message:
|
) -> types.Message:
|
||||||
"""
|
"""
|
||||||
Use this method to send video files, Telegram clients support mp4 videos
|
Use this method to send video files, Telegram clients support mp4 videos
|
||||||
|
|
@ -807,7 +820,10 @@ class Bot(BaseBot, DataMixin, ContextInstanceMixin):
|
||||||
:param height: Video height
|
:param height: Video height
|
||||||
:type height: :obj:`typing.Optional[base.Integer]`
|
:type height: :obj:`typing.Optional[base.Integer]`
|
||||||
|
|
||||||
:param thumb: Thumbnail of the file sent
|
:param thumbnail: Thumbnail of the file sent
|
||||||
|
:type thumbnail: :obj:`typing.Union[base.InputFile, base.String, None]`
|
||||||
|
|
||||||
|
:param thumb: deprecated in API 6.6, Use thumbnail instead
|
||||||
:type thumb: :obj:`typing.Union[base.InputFile, base.String, None]`
|
:type thumb: :obj:`typing.Union[base.InputFile, base.String, None]`
|
||||||
|
|
||||||
:param caption: Video caption (may also be used when resending videos by file_id), 0-1024 characters
|
:param caption: Video caption (may also be used when resending videos by file_id), 0-1024 characters
|
||||||
|
|
@ -851,7 +867,7 @@ class Bot(BaseBot, DataMixin, ContextInstanceMixin):
|
||||||
"""
|
"""
|
||||||
reply_markup = prepare_arg(reply_markup)
|
reply_markup = prepare_arg(reply_markup)
|
||||||
caption_entities = prepare_arg(caption_entities)
|
caption_entities = prepare_arg(caption_entities)
|
||||||
payload = generate_payload(**locals(), exclude=['video', 'thumb'])
|
payload = generate_payload(**locals(), exclude=['video', 'thumb', 'thumbnail'])
|
||||||
if self.parse_mode and caption_entities is None:
|
if self.parse_mode and caption_entities is None:
|
||||||
payload.setdefault('parse_mode', self.parse_mode)
|
payload.setdefault('parse_mode', self.parse_mode)
|
||||||
if self.protect_content is not None:
|
if self.protect_content is not None:
|
||||||
|
|
@ -859,18 +875,19 @@ class Bot(BaseBot, DataMixin, ContextInstanceMixin):
|
||||||
|
|
||||||
files = {}
|
files = {}
|
||||||
prepare_file(payload, files, 'video', video)
|
prepare_file(payload, files, 'video', video)
|
||||||
prepare_attachment(payload, files, 'thumb', thumb)
|
prepare_attachment(payload, files, 'thumbnail', thumbnail or thumb)
|
||||||
|
|
||||||
result = await self.request(api.Methods.SEND_VIDEO, payload, files)
|
result = await self.request(api.Methods.SEND_VIDEO, payload, files)
|
||||||
return types.Message(**result)
|
return types.Message(**result)
|
||||||
|
|
||||||
|
@renamed_argument('thumb', 'thumbnail', '3.0')
|
||||||
async def send_animation(self,
|
async def send_animation(self,
|
||||||
chat_id: typing.Union[base.Integer, base.String],
|
chat_id: typing.Union[base.Integer, base.String],
|
||||||
animation: typing.Union[base.InputFile, base.String],
|
animation: typing.Union[base.InputFile, base.String],
|
||||||
duration: typing.Optional[base.Integer] = None,
|
duration: typing.Optional[base.Integer] = None,
|
||||||
width: typing.Optional[base.Integer] = None,
|
width: typing.Optional[base.Integer] = None,
|
||||||
height: typing.Optional[base.Integer] = None,
|
height: typing.Optional[base.Integer] = None,
|
||||||
thumb: typing.Union[typing.Union[base.InputFile, base.String], None] = None,
|
thumbnail: typing.Union[typing.Union[base.InputFile, base.String], None] = None,
|
||||||
caption: typing.Optional[base.String] = None,
|
caption: typing.Optional[base.String] = None,
|
||||||
parse_mode: typing.Optional[base.String] = None,
|
parse_mode: typing.Optional[base.String] = None,
|
||||||
caption_entities: typing.Optional[typing.List[types.MessageEntity]] = None,
|
caption_entities: typing.Optional[typing.List[types.MessageEntity]] = None,
|
||||||
|
|
@ -884,6 +901,7 @@ class Bot(BaseBot, DataMixin, ContextInstanceMixin):
|
||||||
types.ReplyKeyboardRemove,
|
types.ReplyKeyboardRemove,
|
||||||
types.ForceReply], None] = None,
|
types.ForceReply], None] = None,
|
||||||
has_spoiler: typing.Optional[base.Boolean] = None,
|
has_spoiler: typing.Optional[base.Boolean] = None,
|
||||||
|
thumb: typing.Union[typing.Union[base.InputFile, base.String], None] = None,
|
||||||
) -> types.Message:
|
) -> types.Message:
|
||||||
"""
|
"""
|
||||||
Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without sound).
|
Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without sound).
|
||||||
|
|
@ -915,8 +933,11 @@ class Bot(BaseBot, DataMixin, ContextInstanceMixin):
|
||||||
:param height: Animation height
|
:param height: Animation height
|
||||||
:type height: :obj:`typing.Optional[base.Integer]`
|
:type height: :obj:`typing.Optional[base.Integer]`
|
||||||
|
|
||||||
:param thumb: Thumbnail of the file sent. The thumbnail should be in JPEG format and less than 200 kB in size.
|
:param thumbnail: Thumbnail of the file sent. The thumbnail should be in JPEG format and less than 200 kB in size.
|
||||||
A thumbnail‘s width and height should not exceed 320.
|
A thumbnail‘s width and height should not exceed 320.
|
||||||
|
:type thumbnail: :obj:`typing.Union[typing.Union[base.InputFile, base.String], None]`
|
||||||
|
|
||||||
|
:param thumb: deprecated in API 6.6. Use thumbnail instead
|
||||||
:type thumb: :obj:`typing.Union[typing.Union[base.InputFile, base.String], None]`
|
:type thumb: :obj:`typing.Union[typing.Union[base.InputFile, base.String], None]`
|
||||||
|
|
||||||
:param caption: Animation caption (may also be used when resending animation by file_id), 0-1024 characters
|
:param caption: Animation caption (may also be used when resending animation by file_id), 0-1024 characters
|
||||||
|
|
@ -957,7 +978,7 @@ class Bot(BaseBot, DataMixin, ContextInstanceMixin):
|
||||||
"""
|
"""
|
||||||
reply_markup = prepare_arg(reply_markup)
|
reply_markup = prepare_arg(reply_markup)
|
||||||
caption_entities = prepare_arg(caption_entities)
|
caption_entities = prepare_arg(caption_entities)
|
||||||
payload = generate_payload(**locals(), exclude=["animation", "thumb"])
|
payload = generate_payload(**locals(), exclude=["animation", "thumbnail", "thumb"])
|
||||||
if self.parse_mode and caption_entities is None:
|
if self.parse_mode and caption_entities is None:
|
||||||
payload.setdefault('parse_mode', self.parse_mode)
|
payload.setdefault('parse_mode', self.parse_mode)
|
||||||
if self.protect_content is not None:
|
if self.protect_content is not None:
|
||||||
|
|
@ -965,7 +986,7 @@ class Bot(BaseBot, DataMixin, ContextInstanceMixin):
|
||||||
|
|
||||||
files = {}
|
files = {}
|
||||||
prepare_file(payload, files, 'animation', animation)
|
prepare_file(payload, files, 'animation', animation)
|
||||||
prepare_attachment(payload, files, 'thumb', thumb)
|
prepare_attachment(payload, files, 'thumbnail', thumbnail or thumb)
|
||||||
|
|
||||||
result = await self.request(api.Methods.SEND_ANIMATION, payload, files)
|
result = await self.request(api.Methods.SEND_ANIMATION, payload, files)
|
||||||
return types.Message(**result)
|
return types.Message(**result)
|
||||||
|
|
@ -1056,11 +1077,12 @@ class Bot(BaseBot, DataMixin, ContextInstanceMixin):
|
||||||
result = await self.request(api.Methods.SEND_VOICE, payload, files)
|
result = await self.request(api.Methods.SEND_VOICE, payload, files)
|
||||||
return types.Message(**result)
|
return types.Message(**result)
|
||||||
|
|
||||||
|
@renamed_argument('thumb', 'thumbnail', '3.0')
|
||||||
async def send_video_note(self, chat_id: typing.Union[base.Integer, base.String],
|
async def send_video_note(self, chat_id: typing.Union[base.Integer, base.String],
|
||||||
video_note: typing.Union[base.InputFile, base.String],
|
video_note: typing.Union[base.InputFile, base.String],
|
||||||
duration: typing.Optional[base.Integer] = None,
|
duration: typing.Optional[base.Integer] = None,
|
||||||
length: typing.Optional[base.Integer] = None,
|
length: typing.Optional[base.Integer] = None,
|
||||||
thumb: typing.Union[base.InputFile, base.String, None] = None,
|
thumbnail: typing.Union[base.InputFile, base.String, None] = None,
|
||||||
message_thread_id: typing.Optional[base.Integer] = None,
|
message_thread_id: typing.Optional[base.Integer] = None,
|
||||||
disable_notification: typing.Optional[base.Boolean] = None,
|
disable_notification: typing.Optional[base.Boolean] = None,
|
||||||
protect_content: typing.Optional[base.Boolean] = None,
|
protect_content: typing.Optional[base.Boolean] = None,
|
||||||
|
|
@ -1070,6 +1092,7 @@ class Bot(BaseBot, DataMixin, ContextInstanceMixin):
|
||||||
types.ReplyKeyboardMarkup,
|
types.ReplyKeyboardMarkup,
|
||||||
types.ReplyKeyboardRemove,
|
types.ReplyKeyboardRemove,
|
||||||
types.ForceReply, None] = None,
|
types.ForceReply, None] = None,
|
||||||
|
thumb: typing.Union[base.InputFile, base.String, None] = None,
|
||||||
) -> types.Message:
|
) -> types.Message:
|
||||||
"""
|
"""
|
||||||
As of v.4.0, Telegram clients support rounded square mp4 videos of up to 1 minute long.
|
As of v.4.0, Telegram clients support rounded square mp4 videos of up to 1 minute long.
|
||||||
|
|
@ -1093,7 +1116,10 @@ class Bot(BaseBot, DataMixin, ContextInstanceMixin):
|
||||||
:param length: Video width and height
|
:param length: Video width and height
|
||||||
:type length: :obj:`typing.Optional[base.Integer]`
|
:type length: :obj:`typing.Optional[base.Integer]`
|
||||||
|
|
||||||
:param thumb: Thumbnail of the file sent
|
:param thumbnail: Thumbnail of the file sent
|
||||||
|
:type thumbnail: :obj:`typing.Union[base.InputFile, base.String, None]`
|
||||||
|
|
||||||
|
:param thumb: deprecated in API 6.6. Use thumbnail instead
|
||||||
:type thumb: :obj:`typing.Union[base.InputFile, base.String, None]`
|
:type thumb: :obj:`typing.Union[base.InputFile, base.String, None]`
|
||||||
|
|
||||||
:param disable_notification: Sends the message silently. Users will receive a notification with no sound
|
:param disable_notification: Sends the message silently. Users will receive a notification with no sound
|
||||||
|
|
@ -1119,12 +1145,13 @@ class Bot(BaseBot, DataMixin, ContextInstanceMixin):
|
||||||
:rtype: :obj:`types.Message`
|
:rtype: :obj:`types.Message`
|
||||||
"""
|
"""
|
||||||
reply_markup = prepare_arg(reply_markup)
|
reply_markup = prepare_arg(reply_markup)
|
||||||
payload = generate_payload(**locals(), exclude=['video_note'])
|
payload = generate_payload(**locals(), exclude=['video_note', 'thumb', 'thumbnail'])
|
||||||
if self.protect_content is not None:
|
if self.protect_content is not None:
|
||||||
payload.setdefault('protect_content', self.protect_content)
|
payload.setdefault('protect_content', self.protect_content)
|
||||||
|
|
||||||
files = {}
|
files = {}
|
||||||
prepare_file(payload, files, 'video_note', video_note)
|
prepare_file(payload, files, 'video_note', video_note)
|
||||||
|
prepare_file(payload, files, 'thumbnail', thumbnail)
|
||||||
|
|
||||||
result = await self.request(api.Methods.SEND_VIDEO_NOTE, payload, files)
|
result = await self.request(api.Methods.SEND_VIDEO_NOTE, payload, files)
|
||||||
return types.Message(**result)
|
return types.Message(**result)
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ from . import base
|
||||||
from . import fields
|
from . import fields
|
||||||
from . import mixins
|
from . import mixins
|
||||||
from .photo_size import PhotoSize
|
from .photo_size import PhotoSize
|
||||||
|
from ..utils.deprecated import warn_deprecated
|
||||||
|
|
||||||
|
|
||||||
class Animation(base.TelegramObject, mixins.Downloadable):
|
class Animation(base.TelegramObject, mixins.Downloadable):
|
||||||
|
|
@ -18,7 +19,14 @@ class Animation(base.TelegramObject, mixins.Downloadable):
|
||||||
width: base.Integer = fields.Field()
|
width: base.Integer = fields.Field()
|
||||||
height: base.Integer = fields.Field()
|
height: base.Integer = fields.Field()
|
||||||
duration: base.Integer = fields.Field()
|
duration: base.Integer = fields.Field()
|
||||||
thumb: PhotoSize = fields.Field(base=PhotoSize)
|
thumbnail: PhotoSize = fields.Field(base=PhotoSize)
|
||||||
file_name: base.String = fields.Field()
|
file_name: base.String = fields.Field()
|
||||||
mime_type: base.String = fields.Field()
|
mime_type: base.String = fields.Field()
|
||||||
file_size: base.Integer = fields.Field()
|
file_size: base.Integer = fields.Field()
|
||||||
|
|
||||||
|
@property
|
||||||
|
def thumb(self):
|
||||||
|
warn_deprecated(
|
||||||
|
"thumb is deprecated. Use thumbnail instead",
|
||||||
|
)
|
||||||
|
return self.thumbnail
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ from . import base
|
||||||
from . import fields
|
from . import fields
|
||||||
from . import mixins
|
from . import mixins
|
||||||
from .photo_size import PhotoSize
|
from .photo_size import PhotoSize
|
||||||
|
from ..utils.deprecated import warn_deprecated
|
||||||
|
|
||||||
|
|
||||||
class Audio(base.TelegramObject, mixins.Downloadable):
|
class Audio(base.TelegramObject, mixins.Downloadable):
|
||||||
|
|
@ -18,4 +19,11 @@ class Audio(base.TelegramObject, mixins.Downloadable):
|
||||||
file_name: base.String = fields.Field()
|
file_name: base.String = fields.Field()
|
||||||
mime_type: base.String = fields.Field()
|
mime_type: base.String = fields.Field()
|
||||||
file_size: base.Integer = fields.Field()
|
file_size: base.Integer = fields.Field()
|
||||||
thumb: PhotoSize = fields.Field(base=PhotoSize)
|
thumbnail: PhotoSize = fields.Field(base=PhotoSize)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def thumb(self):
|
||||||
|
warn_deprecated(
|
||||||
|
"thumb is deprecated. Use thumbnail instead",
|
||||||
|
)
|
||||||
|
return self.thumbnail
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,11 @@
|
||||||
|
import typing
|
||||||
|
|
||||||
from . import base
|
from . import base
|
||||||
from . import fields
|
from . import fields
|
||||||
from . import mixins
|
from . import mixins
|
||||||
from .photo_size import PhotoSize
|
from .photo_size import PhotoSize
|
||||||
from ..utils import helper
|
from ..utils import helper
|
||||||
|
from ..utils.deprecated import warn_deprecated
|
||||||
|
|
||||||
|
|
||||||
class Document(base.TelegramObject, mixins.Downloadable):
|
class Document(base.TelegramObject, mixins.Downloadable):
|
||||||
|
|
@ -13,11 +16,16 @@ class Document(base.TelegramObject, mixins.Downloadable):
|
||||||
"""
|
"""
|
||||||
file_id: base.String = fields.Field()
|
file_id: base.String = fields.Field()
|
||||||
file_unique_id: base.String = fields.Field()
|
file_unique_id: base.String = fields.Field()
|
||||||
thumb: PhotoSize = fields.Field(base=PhotoSize)
|
thumbnail: PhotoSize = fields.Field(base=PhotoSize)
|
||||||
file_name: base.String = fields.Field()
|
file_name: base.String = fields.Field()
|
||||||
mime_type: base.String = fields.Field()
|
mime_type: base.String = fields.Field()
|
||||||
file_size: base.Integer = fields.Field()
|
file_size: base.Integer = fields.Field()
|
||||||
|
|
||||||
|
@property
|
||||||
|
def thumb(self):
|
||||||
|
warn_deprecated('thumb is deprecated, use thumbnail instead')
|
||||||
|
return self.thumbnail
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def mime_base(self) -> str:
|
def mime_base(self) -> str:
|
||||||
base_type, _, _ = self.mime_type.partition('/')
|
base_type, _, _ = self.mime_type.partition('/')
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ from . import fields
|
||||||
from .inline_keyboard import InlineKeyboardMarkup
|
from .inline_keyboard import InlineKeyboardMarkup
|
||||||
from .input_message_content import InputMessageContent
|
from .input_message_content import InputMessageContent
|
||||||
from .message_entity import MessageEntity
|
from .message_entity import MessageEntity
|
||||||
|
from ..utils.deprecated import warn_deprecated
|
||||||
|
|
||||||
|
|
||||||
class InlineQueryResult(base.TelegramObject):
|
class InlineQueryResult(base.TelegramObject):
|
||||||
|
|
@ -42,9 +43,14 @@ class InlineQueryResultArticle(InlineQueryResult):
|
||||||
url: base.String = fields.Field()
|
url: base.String = fields.Field()
|
||||||
hide_url: base.Boolean = fields.Field()
|
hide_url: base.Boolean = fields.Field()
|
||||||
description: base.String = fields.Field()
|
description: base.String = fields.Field()
|
||||||
thumb_url: base.String = fields.Field()
|
# Deprecated fields
|
||||||
thumb_width: base.Integer = fields.Field()
|
thumb_url: base.String = fields.Field() # Deprecated, use thumbnail_url instead
|
||||||
thumb_height: base.Integer = fields.Field()
|
thumb_width: base.Integer = fields.Field() # Deprecated, use thumbnail_width instead
|
||||||
|
thumb_height: base.Integer = fields.Field() # Deprecated, use thumbnail_height instead
|
||||||
|
# New fields
|
||||||
|
thumbnail_url: base.String = fields.Field()
|
||||||
|
thumbnail_width: base.Integer = fields.Field()
|
||||||
|
thumbnail_height: base.Integer = fields.Field()
|
||||||
|
|
||||||
def __init__(self, *,
|
def __init__(self, *,
|
||||||
id: base.String,
|
id: base.String,
|
||||||
|
|
@ -54,14 +60,37 @@ class InlineQueryResultArticle(InlineQueryResult):
|
||||||
url: typing.Optional[base.String] = None,
|
url: typing.Optional[base.String] = None,
|
||||||
hide_url: typing.Optional[base.Boolean] = None,
|
hide_url: typing.Optional[base.Boolean] = None,
|
||||||
description: typing.Optional[base.String] = None,
|
description: typing.Optional[base.String] = None,
|
||||||
thumb_url: typing.Optional[base.String] = None,
|
thumb_url: typing.Optional[base.String] = None, # Deprecated
|
||||||
thumb_width: typing.Optional[base.Integer] = None,
|
thumb_width: typing.Optional[base.Integer] = None, # Deprecated
|
||||||
thumb_height: typing.Optional[base.Integer] = None):
|
thumb_height: typing.Optional[base.Integer] = None, # Deprecated
|
||||||
super(InlineQueryResultArticle, self).__init__(id=id, title=title,
|
thumbnail_url: typing.Optional[base.String] = None,
|
||||||
input_message_content=input_message_content,
|
thumbnail_width: typing.Optional[base.Integer] = None,
|
||||||
reply_markup=reply_markup, url=url, hide_url=hide_url,
|
thumbnail_height: typing.Optional[base.Integer] = None):
|
||||||
description=description, thumb_url=thumb_url,
|
|
||||||
thumb_width=thumb_width, thumb_height=thumb_height)
|
if thumb_url and not thumbnail_url:
|
||||||
|
thumbnail_url = thumb_url
|
||||||
|
warn_deprecated(
|
||||||
|
"thumb_url parameter is deprecated, please use thumbnail_url."
|
||||||
|
)
|
||||||
|
if thumb_width and not thumbnail_width:
|
||||||
|
thumbnail_width = thumb_width
|
||||||
|
warn_deprecated(
|
||||||
|
"thumb_width parameter is deprecated, please use thumbnail_width."
|
||||||
|
)
|
||||||
|
if thumb_height and not thumbnail_height:
|
||||||
|
warn_deprecated(
|
||||||
|
"thumb_height parameter is deprecated, please use thumbnail_height."
|
||||||
|
)
|
||||||
|
thumbnail_height = thumb_height
|
||||||
|
|
||||||
|
super().__init__(id=id, title=title,
|
||||||
|
input_message_content=input_message_content,
|
||||||
|
reply_markup=reply_markup, url=url, hide_url=hide_url,
|
||||||
|
description=description, thumb_url=thumb_url,
|
||||||
|
thumb_width=thumb_width, thumb_height=thumb_height,
|
||||||
|
thumbnail_url=thumbnail_url,
|
||||||
|
thumbnail_width=thumbnail_width,
|
||||||
|
thumbnail_height=thumbnail_height)
|
||||||
|
|
||||||
|
|
||||||
class InlineQueryResultPhoto(InlineQueryResult):
|
class InlineQueryResultPhoto(InlineQueryResult):
|
||||||
|
|
@ -76,7 +105,10 @@ class InlineQueryResultPhoto(InlineQueryResult):
|
||||||
"""
|
"""
|
||||||
type: base.String = fields.Field(alias='type', default='photo')
|
type: base.String = fields.Field(alias='type', default='photo')
|
||||||
photo_url: base.String = fields.Field()
|
photo_url: base.String = fields.Field()
|
||||||
|
# Deprecated field
|
||||||
thumb_url: base.String = fields.Field()
|
thumb_url: base.String = fields.Field()
|
||||||
|
# New field
|
||||||
|
thumbnail_url: base.String = fields.Field()
|
||||||
photo_width: base.Integer = fields.Field()
|
photo_width: base.Integer = fields.Field()
|
||||||
photo_height: base.Integer = fields.Field()
|
photo_height: base.Integer = fields.Field()
|
||||||
title: base.String = fields.Field()
|
title: base.String = fields.Field()
|
||||||
|
|
@ -89,7 +121,8 @@ class InlineQueryResultPhoto(InlineQueryResult):
|
||||||
*,
|
*,
|
||||||
id: base.String,
|
id: base.String,
|
||||||
photo_url: base.String,
|
photo_url: base.String,
|
||||||
thumb_url: base.String,
|
thumb_url: typing.Optional[base.String] = None, # Deprecated
|
||||||
|
thumbnail_url: typing.Optional[base.String] = None,
|
||||||
photo_width: typing.Optional[base.Integer] = None,
|
photo_width: typing.Optional[base.Integer] = None,
|
||||||
photo_height: typing.Optional[base.Integer] = None,
|
photo_height: typing.Optional[base.Integer] = None,
|
||||||
title: typing.Optional[base.String] = None,
|
title: typing.Optional[base.String] = None,
|
||||||
|
|
@ -100,8 +133,17 @@ class InlineQueryResultPhoto(InlineQueryResult):
|
||||||
reply_markup: typing.Optional[InlineKeyboardMarkup] = None,
|
reply_markup: typing.Optional[InlineKeyboardMarkup] = None,
|
||||||
input_message_content: typing.Optional[InputMessageContent] = None,
|
input_message_content: typing.Optional[InputMessageContent] = None,
|
||||||
):
|
):
|
||||||
|
if not thumbnail_url:
|
||||||
|
if thumb_url:
|
||||||
|
warn_deprecated(
|
||||||
|
"thumb_url parameter is deprecated, please use thumbnail_url."
|
||||||
|
)
|
||||||
|
thumbnail_url = thumb_url
|
||||||
|
else:
|
||||||
|
raise ValueError("thumbnail_url argument is required")
|
||||||
|
|
||||||
super().__init__(
|
super().__init__(
|
||||||
id=id, photo_url=photo_url, thumb_url=thumb_url,
|
id=id, photo_url=photo_url, thumbnail_url=thumbnail_url,
|
||||||
photo_width=photo_width, photo_height=photo_height, title=title,
|
photo_width=photo_width, photo_height=photo_height, title=title,
|
||||||
description=description, caption=caption,
|
description=description, caption=caption,
|
||||||
parse_mode=parse_mode, caption_entities=caption_entities,
|
parse_mode=parse_mode, caption_entities=caption_entities,
|
||||||
|
|
@ -124,8 +166,12 @@ class InlineQueryResultGif(InlineQueryResult):
|
||||||
gif_width: base.Integer = fields.Field()
|
gif_width: base.Integer = fields.Field()
|
||||||
gif_height: base.Integer = fields.Field()
|
gif_height: base.Integer = fields.Field()
|
||||||
gif_duration: base.Integer = fields.Field()
|
gif_duration: base.Integer = fields.Field()
|
||||||
|
# Deprecated fields
|
||||||
thumb_url: base.String = fields.Field()
|
thumb_url: base.String = fields.Field()
|
||||||
thumb_mime_type: base.String = fields.Field()
|
thumb_mime_type: base.String = fields.Field()
|
||||||
|
# New fields
|
||||||
|
thumbnail_url: base.String = fields.Field()
|
||||||
|
thumbnail_mime_type: base.String = fields.Field()
|
||||||
title: base.String = fields.Field()
|
title: base.String = fields.Field()
|
||||||
caption: base.String = fields.Field()
|
caption: base.String = fields.Field()
|
||||||
input_message_content: InputMessageContent = fields.Field(base=InputMessageContent)
|
input_message_content: InputMessageContent = fields.Field(base=InputMessageContent)
|
||||||
|
|
@ -138,7 +184,10 @@ class InlineQueryResultGif(InlineQueryResult):
|
||||||
gif_width: typing.Optional[base.Integer] = None,
|
gif_width: typing.Optional[base.Integer] = None,
|
||||||
gif_height: typing.Optional[base.Integer] = None,
|
gif_height: typing.Optional[base.Integer] = None,
|
||||||
gif_duration: typing.Optional[base.Integer] = None,
|
gif_duration: typing.Optional[base.Integer] = None,
|
||||||
thumb_url: typing.Optional[base.String] = None,
|
thumb_url: typing.Optional[base.String] = None, # Deprecated
|
||||||
|
thumb_mime_type: typing.Optional[base.String] = None, # Deprecated
|
||||||
|
thumbnail_url: typing.Optional[base.String] = None,
|
||||||
|
thumbnail_mime_type: typing.Optional[base.String] = None,
|
||||||
title: typing.Optional[base.String] = None,
|
title: typing.Optional[base.String] = None,
|
||||||
caption: typing.Optional[base.String] = None,
|
caption: typing.Optional[base.String] = None,
|
||||||
parse_mode: typing.Optional[base.String] = None,
|
parse_mode: typing.Optional[base.String] = None,
|
||||||
|
|
@ -146,9 +195,22 @@ class InlineQueryResultGif(InlineQueryResult):
|
||||||
caption_entities: typing.Optional[typing.List[MessageEntity]] = None,
|
caption_entities: typing.Optional[typing.List[MessageEntity]] = None,
|
||||||
input_message_content: typing.Optional[InputMessageContent] = None,
|
input_message_content: typing.Optional[InputMessageContent] = None,
|
||||||
):
|
):
|
||||||
|
if not thumbnail_url and thumb_url:
|
||||||
|
warn_deprecated(
|
||||||
|
"thumb_url parameter is deprecated, please use thumbnail_url."
|
||||||
|
)
|
||||||
|
thumbnail_url = thumb_url
|
||||||
|
if not thumbnail_mime_type and thumb_mime_type:
|
||||||
|
warn_deprecated(
|
||||||
|
"thumb_mime_type parameter is deprecated, please use thumbnail_mime_type."
|
||||||
|
)
|
||||||
|
thumbnail_mime_type = thumb_mime_type
|
||||||
|
|
||||||
super().__init__(
|
super().__init__(
|
||||||
id=id, gif_url=gif_url, gif_width=gif_width, gif_height=gif_height,
|
id=id, gif_url=gif_url, gif_width=gif_width, gif_height=gif_height,
|
||||||
gif_duration=gif_duration, thumb_url=thumb_url, title=title,
|
gif_duration=gif_duration,
|
||||||
|
thumbnail_url=thumbnail_url, thumbnail_mime_type=thumbnail_mime_type,
|
||||||
|
title=title,
|
||||||
caption=caption, parse_mode=parse_mode, reply_markup=reply_markup,
|
caption=caption, parse_mode=parse_mode, reply_markup=reply_markup,
|
||||||
caption_entities=caption_entities,
|
caption_entities=caption_entities,
|
||||||
input_message_content=input_message_content,
|
input_message_content=input_message_content,
|
||||||
|
|
@ -170,8 +232,12 @@ class InlineQueryResultMpeg4Gif(InlineQueryResult):
|
||||||
mpeg4_width: base.Integer = fields.Field()
|
mpeg4_width: base.Integer = fields.Field()
|
||||||
mpeg4_height: base.Integer = fields.Field()
|
mpeg4_height: base.Integer = fields.Field()
|
||||||
mpeg4_duration: base.Integer = fields.Field()
|
mpeg4_duration: base.Integer = fields.Field()
|
||||||
|
# Deprecated fields
|
||||||
thumb_url: base.String = fields.Field()
|
thumb_url: base.String = fields.Field()
|
||||||
thumb_mime_type: base.String = fields.Field()
|
thumb_mime_type: base.String = fields.Field()
|
||||||
|
# New fields
|
||||||
|
thumbnail_url: base.String = fields.Field()
|
||||||
|
thumbnail_mime_type: base.String = fields.Field()
|
||||||
title: base.String = fields.Field()
|
title: base.String = fields.Field()
|
||||||
caption: base.String = fields.Field()
|
caption: base.String = fields.Field()
|
||||||
input_message_content: InputMessageContent = fields.Field(base=InputMessageContent)
|
input_message_content: InputMessageContent = fields.Field(base=InputMessageContent)
|
||||||
|
|
@ -181,7 +247,10 @@ class InlineQueryResultMpeg4Gif(InlineQueryResult):
|
||||||
*,
|
*,
|
||||||
id: base.String,
|
id: base.String,
|
||||||
mpeg4_url: base.String,
|
mpeg4_url: base.String,
|
||||||
thumb_url: base.String,
|
thumb_url: typing.Optional[base.String] = None, # Deprecated
|
||||||
|
thumb_mime_type: typing.Optional[base.String] = None, # Deprecated
|
||||||
|
thumbnail_url: typing.Optional[base.String] = None,
|
||||||
|
thumbnail_mime_type: typing.Optional[base.String] = None,
|
||||||
mpeg4_width: typing.Optional[base.Integer] = None,
|
mpeg4_width: typing.Optional[base.Integer] = None,
|
||||||
mpeg4_height: typing.Optional[base.Integer] = None,
|
mpeg4_height: typing.Optional[base.Integer] = None,
|
||||||
mpeg4_duration: typing.Optional[base.Integer] = None,
|
mpeg4_duration: typing.Optional[base.Integer] = None,
|
||||||
|
|
@ -192,10 +261,26 @@ class InlineQueryResultMpeg4Gif(InlineQueryResult):
|
||||||
caption_entities: typing.Optional[typing.List[MessageEntity]] = None,
|
caption_entities: typing.Optional[typing.List[MessageEntity]] = None,
|
||||||
input_message_content: typing.Optional[InputMessageContent] = None,
|
input_message_content: typing.Optional[InputMessageContent] = None,
|
||||||
):
|
):
|
||||||
|
if not thumbnail_url:
|
||||||
|
if thumb_url:
|
||||||
|
warn_deprecated(
|
||||||
|
"thumb_url parameter is deprecated, please use thumbnail_url."
|
||||||
|
)
|
||||||
|
thumbnail_url = thumb_url
|
||||||
|
else:
|
||||||
|
raise ValueError("thumbnail_url is required")
|
||||||
|
if not thumbnail_mime_type and thumb_mime_type:
|
||||||
|
warn_deprecated(
|
||||||
|
"thumb_mime_type parameter is deprecated, please use thumbnail_mime_type."
|
||||||
|
)
|
||||||
|
thumbnail_mime_type = thumb_mime_type
|
||||||
|
|
||||||
|
|
||||||
super().__init__(
|
super().__init__(
|
||||||
id=id, mpeg4_url=mpeg4_url, mpeg4_width=mpeg4_width,
|
id=id, mpeg4_url=mpeg4_url, mpeg4_width=mpeg4_width,
|
||||||
mpeg4_height=mpeg4_height, mpeg4_duration=mpeg4_duration,
|
mpeg4_height=mpeg4_height, mpeg4_duration=mpeg4_duration,
|
||||||
thumb_url=thumb_url, title=title, caption=caption,
|
thumbnail_url=thumbnail_url, thumbnail_mime_type=thumbnail_mime_type,
|
||||||
|
title=title, caption=caption,
|
||||||
parse_mode=parse_mode, reply_markup=reply_markup,
|
parse_mode=parse_mode, reply_markup=reply_markup,
|
||||||
caption_entities=caption_entities,
|
caption_entities=caption_entities,
|
||||||
input_message_content=input_message_content,
|
input_message_content=input_message_content,
|
||||||
|
|
@ -218,7 +303,10 @@ class InlineQueryResultVideo(InlineQueryResult):
|
||||||
type: base.String = fields.Field(alias='type', default='video')
|
type: base.String = fields.Field(alias='type', default='video')
|
||||||
video_url: base.String = fields.Field()
|
video_url: base.String = fields.Field()
|
||||||
mime_type: base.String = fields.Field()
|
mime_type: base.String = fields.Field()
|
||||||
|
# Deprecated fields
|
||||||
thumb_url: base.String = fields.Field()
|
thumb_url: base.String = fields.Field()
|
||||||
|
# New fields
|
||||||
|
thumbnail_url: base.String = fields.Field()
|
||||||
title: base.String = fields.Field()
|
title: base.String = fields.Field()
|
||||||
caption: base.String = fields.Field()
|
caption: base.String = fields.Field()
|
||||||
video_width: base.Integer = fields.Field()
|
video_width: base.Integer = fields.Field()
|
||||||
|
|
@ -233,7 +321,8 @@ class InlineQueryResultVideo(InlineQueryResult):
|
||||||
id: base.String,
|
id: base.String,
|
||||||
video_url: base.String,
|
video_url: base.String,
|
||||||
mime_type: base.String,
|
mime_type: base.String,
|
||||||
thumb_url: base.String,
|
thumb_url: typing.Optional[base.String] = None, # Deprecated
|
||||||
|
thumbnail_url: typing.Optional[base.String] = None,
|
||||||
title: base.String,
|
title: base.String,
|
||||||
caption: typing.Optional[base.String] = None,
|
caption: typing.Optional[base.String] = None,
|
||||||
parse_mode: typing.Optional[base.String] = None,
|
parse_mode: typing.Optional[base.String] = None,
|
||||||
|
|
@ -245,8 +334,17 @@ class InlineQueryResultVideo(InlineQueryResult):
|
||||||
caption_entities: typing.Optional[typing.List[MessageEntity]] = None,
|
caption_entities: typing.Optional[typing.List[MessageEntity]] = None,
|
||||||
input_message_content: typing.Optional[InputMessageContent] = None,
|
input_message_content: typing.Optional[InputMessageContent] = None,
|
||||||
):
|
):
|
||||||
|
if not thumbnail_url:
|
||||||
|
if thumb_url:
|
||||||
|
warn_deprecated(
|
||||||
|
"thumb_url parameter is deprecated, please use thumbnail_url."
|
||||||
|
)
|
||||||
|
thumbnail_url = thumb_url
|
||||||
|
else:
|
||||||
|
raise ValueError("thumbnail_url is required")
|
||||||
|
|
||||||
super().__init__(
|
super().__init__(
|
||||||
id=id, video_url=video_url, mime_type=mime_type, thumb_url=thumb_url,
|
id=id, video_url=video_url, mime_type=mime_type, thumbnail_url=thumbnail_url,
|
||||||
title=title, caption=caption, video_width=video_width,
|
title=title, caption=caption, video_width=video_width,
|
||||||
video_height=video_height, video_duration=video_duration,
|
video_height=video_height, video_duration=video_duration,
|
||||||
description=description, parse_mode=parse_mode,
|
description=description, parse_mode=parse_mode,
|
||||||
|
|
@ -357,9 +455,14 @@ class InlineQueryResultDocument(InlineQueryResult):
|
||||||
mime_type: base.String = fields.Field()
|
mime_type: base.String = fields.Field()
|
||||||
description: base.String = fields.Field()
|
description: base.String = fields.Field()
|
||||||
input_message_content: InputMessageContent = fields.Field(base=InputMessageContent)
|
input_message_content: InputMessageContent = fields.Field(base=InputMessageContent)
|
||||||
|
# Deprecated fields
|
||||||
thumb_url: base.String = fields.Field()
|
thumb_url: base.String = fields.Field()
|
||||||
thumb_width: base.Integer = fields.Field()
|
thumb_width: base.Integer = fields.Field()
|
||||||
thumb_height: base.Integer = fields.Field()
|
thumb_height: base.Integer = fields.Field()
|
||||||
|
# New fields
|
||||||
|
thumbnail_url: base.String = fields.Field()
|
||||||
|
thumbnail_width: base.Integer = fields.Field()
|
||||||
|
thumbnail_height: base.Integer = fields.Field()
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
|
|
@ -374,17 +477,36 @@ class InlineQueryResultDocument(InlineQueryResult):
|
||||||
description: typing.Optional[base.String] = None,
|
description: typing.Optional[base.String] = None,
|
||||||
reply_markup: typing.Optional[InlineKeyboardMarkup] = None,
|
reply_markup: typing.Optional[InlineKeyboardMarkup] = None,
|
||||||
input_message_content: typing.Optional[InputMessageContent] = None,
|
input_message_content: typing.Optional[InputMessageContent] = None,
|
||||||
thumb_url: typing.Optional[base.String] = None,
|
thumb_url: typing.Optional[base.String] = None, # Deprecated
|
||||||
thumb_width: typing.Optional[base.Integer] = None,
|
thumb_width: typing.Optional[base.Integer] = None, # Deprecated
|
||||||
thumb_height: typing.Optional[base.Integer] = None,
|
thumb_height: typing.Optional[base.Integer] = None, # Deprecated
|
||||||
|
thumbnail_url: typing.Optional[base.String] = None,
|
||||||
|
thumbnail_width: typing.Optional[base.Integer] = None,
|
||||||
|
thumbnail_height: typing.Optional[base.Integer] = None,
|
||||||
):
|
):
|
||||||
|
if thumb_url and not thumbnail_url:
|
||||||
|
thumbnail_url = thumb_url
|
||||||
|
warn_deprecated(
|
||||||
|
'thumb_url is deprecated, use thumbnail_url instead',
|
||||||
|
)
|
||||||
|
if thumb_width and not thumbnail_width:
|
||||||
|
thumbnail_width = thumb_width
|
||||||
|
warn_deprecated(
|
||||||
|
'thumb_width is deprecated, use thumbnail_width instead',
|
||||||
|
)
|
||||||
|
if thumb_height and not thumbnail_height:
|
||||||
|
thumbnail_height = thumb_height
|
||||||
|
warn_deprecated(
|
||||||
|
'thumb_height is deprecated, use thumbnail_height instead',
|
||||||
|
)
|
||||||
|
|
||||||
super().__init__(
|
super().__init__(
|
||||||
id=id, title=title, caption=caption, parse_mode=parse_mode,
|
id=id, title=title, caption=caption, parse_mode=parse_mode,
|
||||||
caption_entities=caption_entities, document_url=document_url,
|
caption_entities=caption_entities, document_url=document_url,
|
||||||
mime_type=mime_type, description=description, reply_markup=reply_markup,
|
mime_type=mime_type, description=description, reply_markup=reply_markup,
|
||||||
input_message_content=input_message_content,
|
input_message_content=input_message_content,
|
||||||
thumb_url=thumb_url, thumb_width=thumb_width,
|
thumbnail_url=thumbnail_url, thumbnail_width=thumbnail_width,
|
||||||
thumb_height=thumb_height,
|
thumbnail_height=thumbnail_height,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -407,9 +529,14 @@ class InlineQueryResultLocation(InlineQueryResult):
|
||||||
heading: typing.Optional[base.Integer] = fields.Field()
|
heading: typing.Optional[base.Integer] = fields.Field()
|
||||||
proximity_alert_radius: typing.Optional[base.Integer] = fields.Field()
|
proximity_alert_radius: typing.Optional[base.Integer] = fields.Field()
|
||||||
input_message_content: InputMessageContent = fields.Field(base=InputMessageContent)
|
input_message_content: InputMessageContent = fields.Field(base=InputMessageContent)
|
||||||
|
# Deprecated fields
|
||||||
thumb_url: base.String = fields.Field()
|
thumb_url: base.String = fields.Field()
|
||||||
thumb_width: base.Integer = fields.Field()
|
thumb_width: base.Integer = fields.Field()
|
||||||
thumb_height: base.Integer = fields.Field()
|
thumb_height: base.Integer = fields.Field()
|
||||||
|
# New fields
|
||||||
|
thumbnail_url: base.String = fields.Field()
|
||||||
|
thumbnail_width: base.Integer = fields.Field()
|
||||||
|
thumbnail_height: base.Integer = fields.Field()
|
||||||
|
|
||||||
def __init__(self, *,
|
def __init__(self, *,
|
||||||
id: base.String,
|
id: base.String,
|
||||||
|
|
@ -422,10 +549,29 @@ class InlineQueryResultLocation(InlineQueryResult):
|
||||||
proximity_alert_radius: typing.Optional[base.Integer] = None,
|
proximity_alert_radius: typing.Optional[base.Integer] = None,
|
||||||
reply_markup: typing.Optional[InlineKeyboardMarkup] = None,
|
reply_markup: typing.Optional[InlineKeyboardMarkup] = None,
|
||||||
input_message_content: typing.Optional[InputMessageContent] = None,
|
input_message_content: typing.Optional[InputMessageContent] = None,
|
||||||
thumb_url: typing.Optional[base.String] = None,
|
thumb_url: typing.Optional[base.String] = None, # Deprecated
|
||||||
thumb_width: typing.Optional[base.Integer] = None,
|
thumb_width: typing.Optional[base.Integer] = None, # Deprecated
|
||||||
thumb_height: typing.Optional[base.Integer] = None,
|
thumb_height: typing.Optional[base.Integer] = None, # Deprecated
|
||||||
|
thumbnail_url: typing.Optional[base.String] = None,
|
||||||
|
thumbnail_width: typing.Optional[base.Integer] = None,
|
||||||
|
thumbnail_height: typing.Optional[base.Integer] = None,
|
||||||
):
|
):
|
||||||
|
if thumb_url and not thumbnail_url:
|
||||||
|
thumbnail_url = thumb_url
|
||||||
|
warn_deprecated(
|
||||||
|
'thumb_url is deprecated, use thumbnail_url instead',
|
||||||
|
)
|
||||||
|
if thumb_width and not thumbnail_width:
|
||||||
|
thumbnail_width = thumb_width
|
||||||
|
warn_deprecated(
|
||||||
|
'thumb_width is deprecated, use thumbnail_width instead',
|
||||||
|
)
|
||||||
|
if thumb_height and not thumbnail_height:
|
||||||
|
thumbnail_height = thumb_height
|
||||||
|
warn_deprecated(
|
||||||
|
'thumb_height is deprecated, use thumbnail_height instead',
|
||||||
|
)
|
||||||
|
|
||||||
super().__init__(
|
super().__init__(
|
||||||
id=id,
|
id=id,
|
||||||
latitude=latitude,
|
latitude=latitude,
|
||||||
|
|
@ -437,9 +583,9 @@ class InlineQueryResultLocation(InlineQueryResult):
|
||||||
proximity_alert_radius=proximity_alert_radius,
|
proximity_alert_radius=proximity_alert_radius,
|
||||||
reply_markup=reply_markup,
|
reply_markup=reply_markup,
|
||||||
input_message_content=input_message_content,
|
input_message_content=input_message_content,
|
||||||
thumb_url=thumb_url,
|
thumbnail_url=thumbnail_url,
|
||||||
thumb_width=thumb_width,
|
thumbnail_width=thumbnail_width,
|
||||||
thumb_height=thumb_height
|
thumbnail_height=thumbnail_height,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -465,9 +611,14 @@ class InlineQueryResultVenue(InlineQueryResult):
|
||||||
google_place_id: base.String = fields.Field()
|
google_place_id: base.String = fields.Field()
|
||||||
google_place_type: base.String = fields.Field()
|
google_place_type: base.String = fields.Field()
|
||||||
input_message_content: InputMessageContent = fields.Field(base=InputMessageContent)
|
input_message_content: InputMessageContent = fields.Field(base=InputMessageContent)
|
||||||
|
# Deprecated fields
|
||||||
thumb_url: base.String = fields.Field()
|
thumb_url: base.String = fields.Field()
|
||||||
thumb_width: base.Integer = fields.Field()
|
thumb_width: base.Integer = fields.Field()
|
||||||
thumb_height: base.Integer = fields.Field()
|
thumb_height: base.Integer = fields.Field()
|
||||||
|
# New fields
|
||||||
|
thumbnail_url: base.String = fields.Field()
|
||||||
|
thumbnail_width: base.Integer = fields.Field()
|
||||||
|
thumbnail_height: base.Integer = fields.Field()
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
|
|
@ -483,17 +634,36 @@ class InlineQueryResultVenue(InlineQueryResult):
|
||||||
google_place_type: typing.Optional[base.String] = None,
|
google_place_type: typing.Optional[base.String] = None,
|
||||||
reply_markup: typing.Optional[InlineKeyboardMarkup] = None,
|
reply_markup: typing.Optional[InlineKeyboardMarkup] = None,
|
||||||
input_message_content: typing.Optional[InputMessageContent] = None,
|
input_message_content: typing.Optional[InputMessageContent] = None,
|
||||||
thumb_url: typing.Optional[base.String] = None,
|
thumb_url: typing.Optional[base.String] = None, # Deprecated
|
||||||
thumb_width: typing.Optional[base.Integer] = None,
|
thumb_width: typing.Optional[base.Integer] = None, # Deprecated
|
||||||
thumb_height: typing.Optional[base.Integer] = None,
|
thumb_height: typing.Optional[base.Integer] = None, # Deprecated
|
||||||
|
thumbnail_url: typing.Optional[base.String] = None,
|
||||||
|
thumbnail_width: typing.Optional[base.Integer] = None,
|
||||||
|
thumbnail_height: typing.Optional[base.Integer] = None,
|
||||||
):
|
):
|
||||||
|
if thumb_url and not thumbnail_url:
|
||||||
|
thumbnail_url = thumb_url
|
||||||
|
warn_deprecated(
|
||||||
|
'thumb_url is deprecated, use thumbnail_url instead',
|
||||||
|
)
|
||||||
|
if thumb_width and not thumbnail_width:
|
||||||
|
thumbnail_width = thumb_width
|
||||||
|
warn_deprecated(
|
||||||
|
'thumb_width is deprecated, use thumbnail_width instead',
|
||||||
|
)
|
||||||
|
if thumb_height and not thumbnail_height:
|
||||||
|
thumbnail_height = thumb_height
|
||||||
|
warn_deprecated(
|
||||||
|
'thumb_height is deprecated, use thumbnail_height instead',
|
||||||
|
)
|
||||||
|
|
||||||
super().__init__(
|
super().__init__(
|
||||||
id=id, latitude=latitude, longitude=longitude, title=title,
|
id=id, latitude=latitude, longitude=longitude, title=title,
|
||||||
address=address, foursquare_id=foursquare_id,
|
address=address, foursquare_id=foursquare_id,
|
||||||
foursquare_type=foursquare_type, google_place_id=google_place_id,
|
foursquare_type=foursquare_type, google_place_id=google_place_id,
|
||||||
google_place_type=google_place_type, reply_markup=reply_markup,
|
google_place_type=google_place_type, reply_markup=reply_markup,
|
||||||
input_message_content=input_message_content, thumb_url=thumb_url,
|
input_message_content=input_message_content, thumbnail_url=thumbnail_url,
|
||||||
thumb_width=thumb_width, thumb_height=thumb_height,
|
thumbnail_width=thumbnail_width, thumbnail_height=thumbnail_height,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -515,9 +685,14 @@ class InlineQueryResultContact(InlineQueryResult):
|
||||||
last_name: base.String = fields.Field()
|
last_name: base.String = fields.Field()
|
||||||
vcard: base.String = fields.Field()
|
vcard: base.String = fields.Field()
|
||||||
input_message_content: InputMessageContent = fields.Field(base=InputMessageContent)
|
input_message_content: InputMessageContent = fields.Field(base=InputMessageContent)
|
||||||
|
# Deprecated fields
|
||||||
thumb_url: base.String = fields.Field()
|
thumb_url: base.String = fields.Field()
|
||||||
thumb_width: base.Integer = fields.Field()
|
thumb_width: base.Integer = fields.Field()
|
||||||
thumb_height: base.Integer = fields.Field()
|
thumb_height: base.Integer = fields.Field()
|
||||||
|
# New fields
|
||||||
|
thumbnail_url: base.String = fields.Field()
|
||||||
|
thumbnail_width: base.Integer = fields.Field()
|
||||||
|
thumbnail_height: base.Integer = fields.Field()
|
||||||
foursquare_type: base.String = fields.Field()
|
foursquare_type: base.String = fields.Field()
|
||||||
|
|
||||||
def __init__(self, *,
|
def __init__(self, *,
|
||||||
|
|
@ -527,15 +702,36 @@ class InlineQueryResultContact(InlineQueryResult):
|
||||||
last_name: typing.Optional[base.String] = None,
|
last_name: typing.Optional[base.String] = None,
|
||||||
reply_markup: typing.Optional[InlineKeyboardMarkup] = None,
|
reply_markup: typing.Optional[InlineKeyboardMarkup] = None,
|
||||||
input_message_content: typing.Optional[InputMessageContent] = None,
|
input_message_content: typing.Optional[InputMessageContent] = None,
|
||||||
thumb_url: typing.Optional[base.String] = None,
|
thumb_url: typing.Optional[base.String] = None, # Deprecated
|
||||||
thumb_width: typing.Optional[base.Integer] = None,
|
thumb_width: typing.Optional[base.Integer] = None, # Deprecated
|
||||||
thumb_height: typing.Optional[base.Integer] = None,
|
thumb_height: typing.Optional[base.Integer] = None, # Deprecated
|
||||||
|
thumbnail_url: typing.Optional[base.String] = None,
|
||||||
|
thumbnail_width: typing.Optional[base.Integer] = None,
|
||||||
|
thumbnail_height: typing.Optional[base.Integer] = None,
|
||||||
foursquare_type: typing.Optional[base.String] = None):
|
foursquare_type: typing.Optional[base.String] = None):
|
||||||
|
if thumb_url and not thumbnail_url:
|
||||||
|
thumbnail_url = thumb_url
|
||||||
|
warn_deprecated(
|
||||||
|
'thumb_url is deprecated, use thumbnail_url instead',
|
||||||
|
)
|
||||||
|
if thumb_width and not thumbnail_width:
|
||||||
|
thumbnail_width = thumb_width
|
||||||
|
warn_deprecated(
|
||||||
|
'thumb_width is deprecated, use thumbnail_width instead',
|
||||||
|
)
|
||||||
|
if thumb_height and not thumbnail_height:
|
||||||
|
thumbnail_height = thumb_height
|
||||||
|
warn_deprecated(
|
||||||
|
'thumb_height is deprecated, use thumbnail_height instead',
|
||||||
|
)
|
||||||
|
|
||||||
super(InlineQueryResultContact, self).__init__(id=id, phone_number=phone_number,
|
super(InlineQueryResultContact, self).__init__(id=id, phone_number=phone_number,
|
||||||
first_name=first_name, last_name=last_name,
|
first_name=first_name, last_name=last_name,
|
||||||
reply_markup=reply_markup,
|
reply_markup=reply_markup,
|
||||||
input_message_content=input_message_content, thumb_url=thumb_url,
|
input_message_content=input_message_content,
|
||||||
thumb_width=thumb_width, thumb_height=thumb_height,
|
thumbnail_url=thumbnail_url,
|
||||||
|
thumbnail_width=thumbnail_width,
|
||||||
|
thumbnail_height=thumbnail_height,
|
||||||
foursquare_type=foursquare_type)
|
foursquare_type=foursquare_type)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ from . import base
|
||||||
from . import fields
|
from . import fields
|
||||||
from .input_file import InputFile
|
from .input_file import InputFile
|
||||||
from .message_entity import MessageEntity
|
from .message_entity import MessageEntity
|
||||||
|
from ..utils.deprecated import warn_deprecated
|
||||||
|
|
||||||
ATTACHMENT_PREFIX = 'attach://'
|
ATTACHMENT_PREFIX = 'attach://'
|
||||||
|
|
||||||
|
|
@ -112,7 +113,8 @@ class InputMediaAnimation(InputMedia):
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
media: base.InputFile,
|
media: base.InputFile,
|
||||||
thumb: typing.Union[base.InputFile, base.String] = None,
|
thumb: typing.Union[base.InputFile, base.String] = None, # Deprecated
|
||||||
|
thumbnail: typing.Union[base.InputFile, base.String] = None,
|
||||||
caption: base.String = None,
|
caption: base.String = None,
|
||||||
width: base.Integer = None,
|
width: base.Integer = None,
|
||||||
height: base.Integer = None,
|
height: base.Integer = None,
|
||||||
|
|
@ -122,8 +124,14 @@ class InputMediaAnimation(InputMedia):
|
||||||
has_spoiler: typing.Optional[base.Boolean] = None,
|
has_spoiler: typing.Optional[base.Boolean] = None,
|
||||||
**kwargs,
|
**kwargs,
|
||||||
):
|
):
|
||||||
|
if not thumbnail and thumb:
|
||||||
|
thumbnail = thumb
|
||||||
|
warn_deprecated(
|
||||||
|
'thumb argument is deprecated, use thumbnail instead',
|
||||||
|
)
|
||||||
|
|
||||||
super().__init__(
|
super().__init__(
|
||||||
type='animation', media=media, thumb=thumb, caption=caption, width=width,
|
type='animation', media=media, thumbnail=thumbnail, caption=caption, width=width,
|
||||||
height=height, duration=duration, parse_mode=parse_mode,
|
height=height, duration=duration, parse_mode=parse_mode,
|
||||||
caption_entities=caption_entities, has_spoiler=has_spoiler, conf=kwargs,
|
caption_entities=caption_entities, has_spoiler=has_spoiler, conf=kwargs,
|
||||||
)
|
)
|
||||||
|
|
@ -139,15 +147,21 @@ class InputMediaDocument(InputMedia):
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
media: base.InputFile,
|
media: base.InputFile,
|
||||||
thumb: typing.Union[base.InputFile, base.String, None] = None,
|
thumb: typing.Union[base.InputFile, base.String, None] = None, # Deprecated
|
||||||
|
thumbnail: typing.Union[base.InputFile, base.String, None] = None,
|
||||||
caption: base.String = None,
|
caption: base.String = None,
|
||||||
parse_mode: base.String = None,
|
parse_mode: base.String = None,
|
||||||
caption_entities: typing.Optional[typing.List[MessageEntity]] = None,
|
caption_entities: typing.Optional[typing.List[MessageEntity]] = None,
|
||||||
disable_content_type_detection: typing.Optional[base.Boolean] = None,
|
disable_content_type_detection: typing.Optional[base.Boolean] = None,
|
||||||
**kwargs,
|
**kwargs,
|
||||||
):
|
):
|
||||||
|
if not thumbnail and thumb:
|
||||||
|
thumbnail = thumb
|
||||||
|
warn_deprecated(
|
||||||
|
'thumb argument is deprecated, use thumbnail instead',
|
||||||
|
)
|
||||||
super().__init__(
|
super().__init__(
|
||||||
type='document', media=media, thumb=thumb, caption=caption,
|
type='document', media=media, thumbnail=thumbnail, caption=caption,
|
||||||
parse_mode=parse_mode, caption_entities=caption_entities,
|
parse_mode=parse_mode, caption_entities=caption_entities,
|
||||||
disable_content_type_detection=disable_content_type_detection,
|
disable_content_type_detection=disable_content_type_detection,
|
||||||
conf=kwargs,
|
conf=kwargs,
|
||||||
|
|
@ -168,7 +182,8 @@ class InputMediaAudio(InputMedia):
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
media: base.InputFile,
|
media: base.InputFile,
|
||||||
thumb: typing.Union[base.InputFile, base.String] = None,
|
thumb: typing.Union[base.InputFile, base.String] = None, # Deprecated
|
||||||
|
thumbnail: typing.Union[base.InputFile, base.String] = None,
|
||||||
caption: base.String = None,
|
caption: base.String = None,
|
||||||
duration: base.Integer = None,
|
duration: base.Integer = None,
|
||||||
performer: base.String = None,
|
performer: base.String = None,
|
||||||
|
|
@ -177,8 +192,13 @@ class InputMediaAudio(InputMedia):
|
||||||
caption_entities: typing.Optional[typing.List[MessageEntity]] = None,
|
caption_entities: typing.Optional[typing.List[MessageEntity]] = None,
|
||||||
**kwargs,
|
**kwargs,
|
||||||
):
|
):
|
||||||
|
if not thumbnail and thumb:
|
||||||
|
thumbnail = thumb
|
||||||
|
warn_deprecated(
|
||||||
|
'thumb argument is deprecated, use thumbnail instead',
|
||||||
|
)
|
||||||
super().__init__(
|
super().__init__(
|
||||||
type='audio', media=media, thumb=thumb, caption=caption,
|
type='audio', media=media, thumbnail=thumbnail, caption=caption,
|
||||||
duration=duration, performer=performer, title=title,
|
duration=duration, performer=performer, title=title,
|
||||||
parse_mode=parse_mode, caption_entities=caption_entities, conf=kwargs,
|
parse_mode=parse_mode, caption_entities=caption_entities, conf=kwargs,
|
||||||
)
|
)
|
||||||
|
|
@ -216,6 +236,8 @@ class InputMediaVideo(InputMedia):
|
||||||
width: base.Integer = fields.Field()
|
width: base.Integer = fields.Field()
|
||||||
height: base.Integer = fields.Field()
|
height: base.Integer = fields.Field()
|
||||||
duration: base.Integer = fields.Field()
|
duration: base.Integer = fields.Field()
|
||||||
|
thumb: typing.Union[base.InputFile, base.String] = fields.Field() # Deprecated
|
||||||
|
thumbnail: typing.Union[base.InputFile, base.String] = fields.Field()
|
||||||
supports_streaming: base.Boolean = fields.Field()
|
supports_streaming: base.Boolean = fields.Field()
|
||||||
has_spoiler: typing.Optional[base.Boolean] = fields.Field()
|
has_spoiler: typing.Optional[base.Boolean] = fields.Field()
|
||||||
|
|
||||||
|
|
@ -223,6 +245,7 @@ class InputMediaVideo(InputMedia):
|
||||||
self,
|
self,
|
||||||
media: base.InputFile,
|
media: base.InputFile,
|
||||||
thumb: typing.Union[base.InputFile, base.String] = None,
|
thumb: typing.Union[base.InputFile, base.String] = None,
|
||||||
|
thumbnail: typing.Union[base.InputFile, base.String] = None,
|
||||||
caption: base.String = None,
|
caption: base.String = None,
|
||||||
width: base.Integer = None,
|
width: base.Integer = None,
|
||||||
height: base.Integer = None,
|
height: base.Integer = None,
|
||||||
|
|
@ -233,8 +256,13 @@ class InputMediaVideo(InputMedia):
|
||||||
has_spoiler: typing.Optional[base.Boolean] = None,
|
has_spoiler: typing.Optional[base.Boolean] = None,
|
||||||
**kwargs,
|
**kwargs,
|
||||||
):
|
):
|
||||||
|
if not thumbnail and thumb:
|
||||||
|
thumbnail = thumb
|
||||||
|
warn_deprecated(
|
||||||
|
'thumb argument is deprecated, use thumbnail instead',
|
||||||
|
)
|
||||||
super().__init__(
|
super().__init__(
|
||||||
type='video', media=media, thumb=thumb, caption=caption,
|
type='video', media=media, thumbnail=thumbnail, caption=caption,
|
||||||
width=width, height=height, duration=duration,
|
width=width, height=height, duration=duration,
|
||||||
parse_mode=parse_mode, caption_entities=caption_entities,
|
parse_mode=parse_mode, caption_entities=caption_entities,
|
||||||
supports_streaming=supports_streaming, has_spoiler=has_spoiler, conf=kwargs
|
supports_streaming=supports_streaming, has_spoiler=has_spoiler, conf=kwargs
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,12 @@
|
||||||
|
import typing
|
||||||
|
|
||||||
from . import base
|
from . import base
|
||||||
from . import fields
|
from . import fields
|
||||||
from . import mixins
|
from . import mixins
|
||||||
|
from .file import File
|
||||||
from .mask_position import MaskPosition
|
from .mask_position import MaskPosition
|
||||||
from .photo_size import PhotoSize
|
from .photo_size import PhotoSize
|
||||||
from .file import File
|
from ..utils.deprecated import warn_deprecated
|
||||||
|
|
||||||
|
|
||||||
class Sticker(base.TelegramObject, mixins.Downloadable):
|
class Sticker(base.TelegramObject, mixins.Downloadable):
|
||||||
|
|
@ -19,7 +22,7 @@ class Sticker(base.TelegramObject, mixins.Downloadable):
|
||||||
height: base.Integer = fields.Field()
|
height: base.Integer = fields.Field()
|
||||||
is_animated: base.Boolean = fields.Field()
|
is_animated: base.Boolean = fields.Field()
|
||||||
is_video: base.Boolean = fields.Field()
|
is_video: base.Boolean = fields.Field()
|
||||||
thumb: PhotoSize = fields.Field(base=PhotoSize)
|
thumbnail: PhotoSize = fields.Field(base=PhotoSize)
|
||||||
emoji: base.String = fields.Field()
|
emoji: base.String = fields.Field()
|
||||||
set_name: base.String = fields.Field()
|
set_name: base.String = fields.Field()
|
||||||
premium_animation: File = fields.Field(base=File)
|
premium_animation: File = fields.Field(base=File)
|
||||||
|
|
@ -28,6 +31,13 @@ class Sticker(base.TelegramObject, mixins.Downloadable):
|
||||||
needs_repainting: base.Boolean = fields.Field()
|
needs_repainting: base.Boolean = fields.Field()
|
||||||
file_size: base.Integer = fields.Field()
|
file_size: base.Integer = fields.Field()
|
||||||
|
|
||||||
|
@property
|
||||||
|
def thumb(self) -> typing.Optional[PhotoSize]:
|
||||||
|
warn_deprecated(
|
||||||
|
"The 'thumb' property is deprecated, use 'thumbnail' instead."
|
||||||
|
)
|
||||||
|
return self.thumbnail
|
||||||
|
|
||||||
async def set_position_in_set(self, position: base.Integer) -> base.Boolean:
|
async def set_position_in_set(self, position: base.Integer) -> base.Boolean:
|
||||||
"""
|
"""
|
||||||
Use this method to move a sticker in a set created by the bot to a specific position.
|
Use this method to move a sticker in a set created by the bot to a specific position.
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ from . import base
|
||||||
from . import fields
|
from . import fields
|
||||||
from .photo_size import PhotoSize
|
from .photo_size import PhotoSize
|
||||||
from .sticker import Sticker
|
from .sticker import Sticker
|
||||||
|
from ..utils.deprecated import warn_deprecated
|
||||||
|
|
||||||
|
|
||||||
class StickerSet(base.TelegramObject):
|
class StickerSet(base.TelegramObject):
|
||||||
|
|
@ -19,4 +20,9 @@ class StickerSet(base.TelegramObject):
|
||||||
is_video: base.Boolean = fields.Field()
|
is_video: base.Boolean = fields.Field()
|
||||||
contains_masks: base.Boolean = fields.Field() # Deprecated
|
contains_masks: base.Boolean = fields.Field() # Deprecated
|
||||||
stickers: typing.List[Sticker] = fields.ListField(base=Sticker)
|
stickers: typing.List[Sticker] = fields.ListField(base=Sticker)
|
||||||
thumb: PhotoSize = fields.Field(base=PhotoSize)
|
thumbnail: PhotoSize = fields.Field(base=PhotoSize)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def thumb(self):
|
||||||
|
warn_deprecated('thumb is deprecated, use thumbnail instead')
|
||||||
|
return self.thumbnail
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,10 @@
|
||||||
|
import typing
|
||||||
|
|
||||||
from . import base
|
from . import base
|
||||||
from . import fields
|
from . import fields
|
||||||
from . import mixins
|
from . import mixins
|
||||||
from .photo_size import PhotoSize
|
from .photo_size import PhotoSize
|
||||||
|
from ..utils.deprecated import warn_deprecated
|
||||||
|
|
||||||
|
|
||||||
class Video(base.TelegramObject, mixins.Downloadable):
|
class Video(base.TelegramObject, mixins.Downloadable):
|
||||||
|
|
@ -15,7 +18,15 @@ class Video(base.TelegramObject, mixins.Downloadable):
|
||||||
width: base.Integer = fields.Field()
|
width: base.Integer = fields.Field()
|
||||||
height: base.Integer = fields.Field()
|
height: base.Integer = fields.Field()
|
||||||
duration: base.Integer = fields.Field()
|
duration: base.Integer = fields.Field()
|
||||||
thumb: PhotoSize = fields.Field(base=PhotoSize)
|
thumbnail: PhotoSize = fields.Field(base=PhotoSize)
|
||||||
file_name: base.String = fields.Field()
|
file_name: base.String = fields.Field()
|
||||||
mime_type: base.String = fields.Field()
|
mime_type: base.String = fields.Field()
|
||||||
file_size: base.Integer = fields.Field()
|
file_size: base.Integer = fields.Field()
|
||||||
|
|
||||||
|
|
||||||
|
@property
|
||||||
|
def thumb(self):
|
||||||
|
warn_deprecated(
|
||||||
|
"thumb is deprecated. Use thumbnail instead",
|
||||||
|
)
|
||||||
|
return self.thumbnail
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,10 @@
|
||||||
|
import typing
|
||||||
|
|
||||||
from . import base
|
from . import base
|
||||||
from . import fields
|
from . import fields
|
||||||
from . import mixins
|
from . import mixins
|
||||||
from .photo_size import PhotoSize
|
from .photo_size import PhotoSize
|
||||||
|
from ..utils.deprecated import warn_deprecated
|
||||||
|
|
||||||
|
|
||||||
class VideoNote(base.TelegramObject, mixins.Downloadable):
|
class VideoNote(base.TelegramObject, mixins.Downloadable):
|
||||||
|
|
@ -14,5 +17,12 @@ class VideoNote(base.TelegramObject, mixins.Downloadable):
|
||||||
file_unique_id: base.String = fields.Field()
|
file_unique_id: base.String = fields.Field()
|
||||||
length: base.Integer = fields.Field()
|
length: base.Integer = fields.Field()
|
||||||
duration: base.Integer = fields.Field()
|
duration: base.Integer = fields.Field()
|
||||||
thumb: PhotoSize = fields.Field(base=PhotoSize)
|
thumbnail: PhotoSize = fields.Field(base=PhotoSize)
|
||||||
file_size: base.Integer = fields.Field()
|
file_size: base.Integer = fields.Field()
|
||||||
|
|
||||||
|
@property
|
||||||
|
def thumb(self):
|
||||||
|
warn_deprecated(
|
||||||
|
"thumb is deprecated. Use thumbnail instead",
|
||||||
|
)
|
||||||
|
return self.thumbnail
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue