From 56e79c10f8c9c465ccb04d4bc3e1e4ee110ec007 Mon Sep 17 00:00:00 2001 From: Leorio Paradinight <62891774+code-rgb@users.noreply.github.com> Date: Wed, 12 May 2021 11:58:21 +0530 Subject: [PATCH] Fix captions being None when editing media message (#617) * added missing doc string * Fix for "None" for default caption --- pyrogram/types/input_media/input_media.py | 2 +- pyrogram/types/input_media/input_media_animation.py | 5 +++-- pyrogram/types/input_media/input_media_audio.py | 5 +++-- pyrogram/types/input_media/input_media_document.py | 5 +++-- pyrogram/types/input_media/input_media_photo.py | 6 +++--- pyrogram/types/input_media/input_media_video.py | 6 +++--- 6 files changed, 16 insertions(+), 13 deletions(-) diff --git a/pyrogram/types/input_media/input_media.py b/pyrogram/types/input_media/input_media.py index a510ad26..16a72bda 100644 --- a/pyrogram/types/input_media/input_media.py +++ b/pyrogram/types/input_media/input_media.py @@ -37,7 +37,7 @@ class InputMedia(Object): def __init__( self, media: str, - caption: str = None, + caption: str = "", parse_mode: str = None, caption_entities: List[MessageEntity] = None ): diff --git a/pyrogram/types/input_media/input_media_animation.py b/pyrogram/types/input_media/input_media_animation.py index a209b80d..e39a148e 100644 --- a/pyrogram/types/input_media/input_media_animation.py +++ b/pyrogram/types/input_media/input_media_animation.py @@ -29,7 +29,8 @@ class InputMediaAnimation(InputMedia): media (``str``): Animation to send. 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. + pass a file path as string to upload a new file that exists on your local machine or + pass an HTTP URL as a string for Telegram to get an animation from the Internet. thumb (``str``, *optional*): Thumbnail of the animation file sent. @@ -65,7 +66,7 @@ class InputMediaAnimation(InputMedia): self, media: str, thumb: str = None, - caption: str = None, + caption: str = "", parse_mode: Optional[str] = object, caption_entities: List[MessageEntity] = None, width: int = 0, diff --git a/pyrogram/types/input_media/input_media_audio.py b/pyrogram/types/input_media/input_media_audio.py index fba368c8..e47bc818 100644 --- a/pyrogram/types/input_media/input_media_audio.py +++ b/pyrogram/types/input_media/input_media_audio.py @@ -31,7 +31,8 @@ class InputMediaAudio(InputMedia): media (``str``): Audio to send. 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. + pass a file path as string to upload a new audio that exists on your local machine or + pass an HTTP URL as a string for Telegram to get an audio file from the Internet. thumb (``str``, *optional*): Thumbnail of the music file album cover. @@ -67,7 +68,7 @@ class InputMediaAudio(InputMedia): self, media: str, thumb: str = None, - caption: str = None, + caption: str = "", parse_mode: Optional[str] = object, caption_entities: List[MessageEntity] = None, duration: int = 0, diff --git a/pyrogram/types/input_media/input_media_document.py b/pyrogram/types/input_media/input_media_document.py index 2701c0ae..12b9fc94 100644 --- a/pyrogram/types/input_media/input_media_document.py +++ b/pyrogram/types/input_media/input_media_document.py @@ -29,7 +29,8 @@ class InputMediaDocument(InputMedia): media (``str``): File to send. 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. + pass a file path as string to upload a new file that exists on your local machine or + pass an HTTP URL as a string for Telegram to get a file from the Internet. thumb (``str``): Thumbnail of the file sent. @@ -56,7 +57,7 @@ class InputMediaDocument(InputMedia): self, media: str, thumb: str = None, - caption: str = None, + caption: str = "", parse_mode: Optional[str] = object, caption_entities: List[MessageEntity] = None ): diff --git a/pyrogram/types/input_media/input_media_photo.py b/pyrogram/types/input_media/input_media_photo.py index ac1cc444..a8213540 100644 --- a/pyrogram/types/input_media/input_media_photo.py +++ b/pyrogram/types/input_media/input_media_photo.py @@ -30,8 +30,8 @@ class InputMediaPhoto(InputMedia): media (``str``): Photo to send. Pass a file_id as string to send a photo that exists on the Telegram servers or - pass a file path as string to upload a new photo that exists on your local machine. - Sending photo by a URL is currently unsupported. + pass a file path as string to upload a new photo that exists on your local machine or + pass an HTTP URL as a string for Telegram to get a photo from the Internet. caption (``str``, *optional*): Caption of the photo to be sent, 0-1024 characters. @@ -51,7 +51,7 @@ class InputMediaPhoto(InputMedia): def __init__( self, media: str, - caption: str = None, + caption: str = "", parse_mode: Optional[str] = object, caption_entities: List[MessageEntity] = None ): diff --git a/pyrogram/types/input_media/input_media_video.py b/pyrogram/types/input_media/input_media_video.py index 13ce18d6..b0c36830 100644 --- a/pyrogram/types/input_media/input_media_video.py +++ b/pyrogram/types/input_media/input_media_video.py @@ -30,8 +30,8 @@ class InputMediaVideo(InputMedia): media (``str``): Video to send. Pass a file_id as string to send a video that exists on the Telegram servers or - 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. + pass a file path as string to upload a new video that exists on your local machine or + pass an HTTP URL as a string for Telegram to get a video from the Internet. thumb (``str``): Thumbnail of the video sent. @@ -70,7 +70,7 @@ class InputMediaVideo(InputMedia): self, media: str, thumb: str = None, - caption: str = None, + caption: str = "", parse_mode: Optional[str] = object, caption_entities: List[MessageEntity] = None, width: int = 0,