From 28af5e14b4a2b23c4e57994c9c769fff660b4899 Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Tue, 18 Sep 2018 11:36:20 +0200 Subject: [PATCH] Add "thumb" field for all InputMedia types except Photo --- .../client/types/input_media/input_media_animation.py | 8 ++++++++ pyrogram/client/types/input_media/input_media_audio.py | 8 ++++++++ .../client/types/input_media/input_media_document.py | 9 +++++++++ pyrogram/client/types/input_media/input_media_video.py | 8 ++++++++ 4 files changed, 33 insertions(+) diff --git a/pyrogram/client/types/input_media/input_media_animation.py b/pyrogram/client/types/input_media/input_media_animation.py index 12fe0e03..14f8c2de 100644 --- a/pyrogram/client/types/input_media/input_media_animation.py +++ b/pyrogram/client/types/input_media/input_media_animation.py @@ -28,6 +28,12 @@ class InputMediaAnimation(InputMedia): Pass a file_id as string to send a file that exists on the Telegram servers or pass a file path as string to upload a new file that exists on your local machine. + thumb (``str``, *optional*): + Thumbnail of the animation 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 90 pixels. + Thumbnails can't be reused and can be only uploaded as a new file. + caption (``str``, *optional*): Caption of the animation to be sent, 0-200 characters @@ -48,6 +54,7 @@ class InputMediaAnimation(InputMedia): def __init__(self, media: str, + thumb: str = None, caption: str = "", parse_mode: str = "", width: int = 0, @@ -55,6 +62,7 @@ class InputMediaAnimation(InputMedia): duration: int = 0): super().__init__(media, caption, parse_mode) + self.thumb = thumb self.width = width self.height = height self.duration = duration diff --git a/pyrogram/client/types/input_media/input_media_audio.py b/pyrogram/client/types/input_media/input_media_audio.py index 2c644107..83979b4a 100644 --- a/pyrogram/client/types/input_media/input_media_audio.py +++ b/pyrogram/client/types/input_media/input_media_audio.py @@ -29,6 +29,12 @@ class InputMediaAudio(InputMedia): Pass a file_id as string to send an audio that exists on the Telegram servers or pass a file path as string to upload a new audio that exists on your local machine. + thumb (``str``, *optional*): + Thumbnail of the music file album cover. + The thumbnail should be in JPEG format and less than 200 KB in size. + A thumbnail's width and height should not exceed 90 pixels. + Thumbnails can't be reused and can be only uploaded as a new file. + caption (``str``, *optional*): Caption of the audio to be sent, 0-200 characters @@ -49,6 +55,7 @@ class InputMediaAudio(InputMedia): def __init__(self, media: str, + thumb: str = None, caption: str = "", parse_mode: str = "", duration: int = 0, @@ -56,6 +63,7 @@ class InputMediaAudio(InputMedia): title: str = ""): super().__init__(media, caption, parse_mode) + self.thumb = thumb self.duration = duration self.performer = performer self.title = title diff --git a/pyrogram/client/types/input_media/input_media_document.py b/pyrogram/client/types/input_media/input_media_document.py index f64da619..07965534 100644 --- a/pyrogram/client/types/input_media/input_media_document.py +++ b/pyrogram/client/types/input_media/input_media_document.py @@ -28,6 +28,12 @@ class InputMediaDocument(InputMedia): Pass a file_id as string to send a file that exists on the Telegram servers or pass a file path as string to upload a new file that exists on your local machine. + thumb (``str``): + 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 90 pixels. + Thumbnails can't be reused and can be only uploaded as a new file. + caption (``str``, *optional*): Caption of the document to be sent, 0-200 characters @@ -39,6 +45,9 @@ class InputMediaDocument(InputMedia): def __init__(self, media: str, + thumb: str = None, caption: str = "", parse_mode: str = ""): super().__init__(media, caption, parse_mode) + + self.thumb = thumb diff --git a/pyrogram/client/types/input_media/input_media_video.py b/pyrogram/client/types/input_media/input_media_video.py index c1f2c9ac..54ce5e5e 100644 --- a/pyrogram/client/types/input_media/input_media_video.py +++ b/pyrogram/client/types/input_media/input_media_video.py @@ -30,6 +30,12 @@ class InputMediaVideo(InputMedia): pass a file path as string to upload a new video that exists on your local machine. Sending video by a URL is currently unsupported. + thumb (``str``): + Thumbnail of the video sent. + The thumbnail should be in JPEG format and less than 200 KB in size. + A thumbnail's width and height should not exceed 90 pixels. + Thumbnails can't be reused and can be only uploaded as a new file. + caption (``str``, *optional*): Caption of the video to be sent, 0-200 characters @@ -53,6 +59,7 @@ class InputMediaVideo(InputMedia): def __init__(self, media: str, + thumb: str = None, caption: str = "", parse_mode: str = "", width: int = 0, @@ -61,6 +68,7 @@ class InputMediaVideo(InputMedia): supports_streaming: bool = True): super().__init__(media, caption, parse_mode) + self.thumb = thumb self.width = width self.height = height self.duration = duration