2
0
mirror of https://github.com/pyrogram/pyrogram synced 2025-08-30 22:05:28 +00:00

Add "thumb" field for all InputMedia types except Photo

This commit is contained in:
Dan
2018-09-18 11:36:20 +02:00
parent 19d04ca94f
commit 28af5e14b4
4 changed files with 33 additions and 0 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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