aiogram/aiogram/types/video.py
latan f70c97e9fa - Renamed the field thumb in the classes Animation, Audio, Document, Sticker, Video, VideoNote, InputMediaAnimation, InputMediaAudio, InputMediaDocument, InputMediaVideo, StickerSet to thumbnail.
-  Renamed the fields thumb_url, thumb_width, and thumb_height in the classes InlineQueryResultArticle, InlineQueryResultContact, InlineQueryResultDocument, InlineQueryResultLocation, and InlineQueryResultVenue to thumbnail_url, thumbnail_width, and thumbnail_height respectively.

- Renamed the field thumb_url in the classes InlineQueryResultPhoto and InlineQueryResultVideo to thumbnail_url.

- Renamed the fields thumb_url and thumb_mime_type in the classes InlineQueryResultGif, and InlineQueryResultMpeg4Gif to thumbnail_url and thumbnail_mime_type respectively.
2023-03-22 18:14:27 +02:00

56 lines
1.8 KiB
Python

import typing
from . import base
from . import fields
from . import mixins
from .photo_size import PhotoSize
from ..utils.deprecated import warn_deprecated
class Video(base.TelegramObject, mixins.Downloadable):
"""
This object represents a video file.
https://core.telegram.org/bots/api#video
"""
file_id: base.String = fields.Field()
file_unique_id: base.String = fields.Field()
width: base.Integer = fields.Field()
height: base.Integer = fields.Field()
duration: base.Integer = fields.Field()
thumb: PhotoSize = fields.Field(base=PhotoSize) # Deprecated
thumbnail: PhotoSize = fields.Field(base=PhotoSize)
file_name: base.String = fields.Field()
mime_type: base.String = fields.Field()
file_size: base.Integer = fields.Field()
def __init__(
self,
file_id: base.String,
file_unique_id: base.String,
width: base.Integer,
height: base.Integer,
duration: base.Integer,
thumb: typing.Optional[PhotoSize] = None,
thumbnail: typing.Optional[PhotoSize] = None,
file_name: typing.Optional[base.String] = None,
mime_type: typing.Optional[base.String] = None,
file_size: typing.Optional[base.Integer] = None,
):
if not thumbnail and thumb:
thumbnail = thumb
warn_deprecated(
"thumb is deprecated. Use thumbnail instead",
)
super().__init__(
file_id=file_id,
file_unique_id=file_unique_id,
width=width,
height=height,
duration=duration,
thumbnail=thumbnail,
file_name=file_name,
mime_type=mime_type,
file_size=file_size,
)