Add missing file_ref argument to bound methods (#347)

This commit is contained in:
Eric Solinas 2020-02-01 14:13:07 +01:00 committed by GitHub
parent 78cba0489a
commit 42f09cd361
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -746,6 +746,7 @@ class Message(Object, Update):
def reply_animation( def reply_animation(
self, self,
animation: str, animation: str,
file_ref: str = None,
quote: bool = None, quote: bool = None,
caption: str = "", caption: str = "",
parse_mode: Union[str, None] = object, parse_mode: Union[str, None] = object,
@ -787,6 +788,10 @@ class Message(Object, Update):
pass an HTTP URL as a string for Telegram to get an animation from the Internet, or pass an HTTP URL as a string for Telegram to get an animation from the Internet, or
pass a file path as string to upload a new animation that exists on your local machine. pass a file path as string to upload a new animation that exists on your local machine.
file_ref (``str``, *optional*):
A valid file reference obtained by a recently fetched media message.
To be used in combination with a file id in case a file reference is needed.
quote (``bool``, *optional*): quote (``bool``, *optional*):
If ``True``, the message will be sent as a reply to this message. If ``True``, the message will be sent as a reply to this message.
If *reply_to_message_id* is passed, this parameter will be ignored. If *reply_to_message_id* is passed, this parameter will be ignored.
@ -866,6 +871,7 @@ class Message(Object, Update):
return self._client.send_animation( return self._client.send_animation(
chat_id=self.chat.id, chat_id=self.chat.id,
animation=animation, animation=animation,
file_ref=file_ref,
caption=caption, caption=caption,
parse_mode=parse_mode, parse_mode=parse_mode,
duration=duration, duration=duration,
@ -882,6 +888,7 @@ class Message(Object, Update):
def reply_audio( def reply_audio(
self, self,
audio: str, audio: str,
file_ref: str = None,
quote: bool = None, quote: bool = None,
caption: str = "", caption: str = "",
parse_mode: Union[str, None] = object, parse_mode: Union[str, None] = object,
@ -923,6 +930,10 @@ class Message(Object, Update):
pass an HTTP URL as a string for Telegram to get an audio file from the Internet, or pass an HTTP URL as a string for Telegram to get an audio file from the Internet, or
pass a file path as string to upload a new audio file that exists on your local machine. pass a file path as string to upload a new audio file that exists on your local machine.
file_ref (``str``, *optional*):
A valid file reference obtained by a recently fetched media message.
To be used in combination with a file id in case a file reference is needed.
quote (``bool``, *optional*): quote (``bool``, *optional*):
If ``True``, the message will be sent as a reply to this message. If ``True``, the message will be sent as a reply to this message.
If *reply_to_message_id* is passed, this parameter will be ignored. If *reply_to_message_id* is passed, this parameter will be ignored.
@ -1002,6 +1013,7 @@ class Message(Object, Update):
return self._client.send_audio( return self._client.send_audio(
chat_id=self.chat.id, chat_id=self.chat.id,
audio=audio, audio=audio,
file_ref=file_ref,
caption=caption, caption=caption,
parse_mode=parse_mode, parse_mode=parse_mode,
duration=duration, duration=duration,
@ -1018,6 +1030,7 @@ class Message(Object, Update):
def reply_cached_media( def reply_cached_media(
self, self,
file_id: str, file_id: str,
file_ref: str = None,
quote: bool = None, quote: bool = None,
caption: str = "", caption: str = "",
parse_mode: Union[str, None] = object, parse_mode: Union[str, None] = object,
@ -1051,6 +1064,10 @@ class Message(Object, Update):
Media to send. Media to send.
Pass a file_id as string to send a media that exists on the Telegram servers. Pass a file_id as string to send a media that exists on the Telegram servers.
file_ref (``str``, *optional*):
A valid file reference obtained by a recently fetched media message.
To be used in combination with a file id in case a file reference is needed.
quote (``bool``, *optional*): quote (``bool``, *optional*):
If ``True``, the message will be sent as a reply to this message. If ``True``, the message will be sent as a reply to this message.
If *reply_to_message_id* is passed, this parameter will be ignored. If *reply_to_message_id* is passed, this parameter will be ignored.
@ -1092,6 +1109,7 @@ class Message(Object, Update):
return self._client.send_cached_media( return self._client.send_cached_media(
chat_id=self.chat.id, chat_id=self.chat.id,
file_id=file_id, file_id=file_id,
file_ref=file_ref,
caption=caption, caption=caption,
parse_mode=parse_mode, parse_mode=parse_mode,
disable_notification=disable_notification, disable_notification=disable_notification,
@ -1225,6 +1243,7 @@ class Message(Object, Update):
def reply_document( def reply_document(
self, self,
document: str, document: str,
file_ref: str = None,
quote: bool = None, quote: bool = None,
thumb: str = None, thumb: str = None,
caption: str = "", caption: str = "",
@ -1263,6 +1282,10 @@ class Message(Object, Update):
pass an HTTP URL as a string for Telegram to get a file from the Internet, or pass an HTTP URL as a string for Telegram to get a file from the Internet, 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.
file_ref (``str``, *optional*):
A valid file reference obtained by a recently fetched media message.
To be used in combination with a file id in case a file reference is needed.
quote (``bool``, *optional*): quote (``bool``, *optional*):
If ``True``, the message will be sent as a reply to this message. If ``True``, the message will be sent as a reply to this message.
If *reply_to_message_id* is passed, this parameter will be ignored. If *reply_to_message_id* is passed, this parameter will be ignored.
@ -1333,6 +1356,7 @@ class Message(Object, Update):
return self._client.send_document( return self._client.send_document(
chat_id=self.chat.id, chat_id=self.chat.id,
document=document, document=document,
file_ref=file_ref,
thumb=thumb, thumb=thumb,
caption=caption, caption=caption,
parse_mode=parse_mode, parse_mode=parse_mode,
@ -1620,6 +1644,7 @@ class Message(Object, Update):
def reply_photo( def reply_photo(
self, self,
photo: str, photo: str,
file_ref: str = None,
quote: bool = None, quote: bool = None,
caption: str = "", caption: str = "",
parse_mode: Union[str, None] = object, parse_mode: Union[str, None] = object,
@ -1658,6 +1683,10 @@ class Message(Object, Update):
pass an HTTP URL as a string for Telegram to get a photo from the Internet, or pass an HTTP URL as a string for Telegram to get a photo from the Internet, or
pass a file path as string to upload a new photo that exists on your local machine. pass a file path as string to upload a new photo that exists on your local machine.
file_ref (``str``, *optional*):
A valid file reference obtained by a recently fetched media message.
To be used in combination with a file id in case a file reference is needed.
quote (``bool``, *optional*): quote (``bool``, *optional*):
If ``True``, the message will be sent as a reply to this message. If ``True``, the message will be sent as a reply to this message.
If *reply_to_message_id* is passed, this parameter will be ignored. If *reply_to_message_id* is passed, this parameter will be ignored.
@ -1727,6 +1756,7 @@ class Message(Object, Update):
return self._client.send_photo( return self._client.send_photo(
chat_id=self.chat.id, chat_id=self.chat.id,
photo=photo, photo=photo,
file_ref=file_ref,
caption=caption, caption=caption,
parse_mode=parse_mode, parse_mode=parse_mode,
ttl_seconds=ttl_seconds, ttl_seconds=ttl_seconds,
@ -1815,6 +1845,7 @@ class Message(Object, Update):
def reply_sticker( def reply_sticker(
self, self,
sticker: str, sticker: str,
file_ref: str = None,
quote: bool = None, quote: bool = None,
disable_notification: bool = None, disable_notification: bool = None,
reply_to_message_id: int = None, reply_to_message_id: int = None,
@ -1850,6 +1881,10 @@ class Message(Object, Update):
pass an HTTP URL as a string for Telegram to get a .webp sticker file from the Internet, or pass an HTTP URL as a string for Telegram to get a .webp sticker file from the Internet, or
pass a file path as string to upload a new sticker that exists on your local machine. pass a file path as string to upload a new sticker that exists on your local machine.
file_ref (``str``, *optional*):
A valid file reference obtained by a recently fetched media message.
To be used in combination with a file id in case a file reference is needed.
quote (``bool``, *optional*): quote (``bool``, *optional*):
If ``True``, the message will be sent as a reply to this message. If ``True``, the message will be sent as a reply to this message.
If *reply_to_message_id* is passed, this parameter will be ignored. If *reply_to_message_id* is passed, this parameter will be ignored.
@ -1904,6 +1939,7 @@ class Message(Object, Update):
return self._client.send_sticker( return self._client.send_sticker(
chat_id=self.chat.id, chat_id=self.chat.id,
sticker=sticker, sticker=sticker,
file_ref=file_ref,
disable_notification=disable_notification, disable_notification=disable_notification,
reply_to_message_id=reply_to_message_id, reply_to_message_id=reply_to_message_id,
reply_markup=reply_markup, reply_markup=reply_markup,
@ -2012,6 +2048,7 @@ class Message(Object, Update):
def reply_video( def reply_video(
self, self,
video: str, video: str,
file_ref: str = None,
quote: bool = None, quote: bool = None,
caption: str = "", caption: str = "",
parse_mode: Union[str, None] = object, parse_mode: Union[str, None] = object,
@ -2054,6 +2091,10 @@ class Message(Object, Update):
pass an HTTP URL as a string for Telegram to get a video from the Internet, or pass an HTTP URL as a string for Telegram to get a video from the Internet, or
pass a file path as string to upload a new video that exists on your local machine. pass a file path as string to upload a new video that exists on your local machine.
file_ref (``str``, *optional*):
A valid file reference obtained by a recently fetched media message.
To be used in combination with a file id in case a file reference is needed.
quote (``bool``, *optional*): quote (``bool``, *optional*):
If ``True``, the message will be sent as a reply to this message. If ``True``, the message will be sent as a reply to this message.
If *reply_to_message_id* is passed, this parameter will be ignored. If *reply_to_message_id* is passed, this parameter will be ignored.
@ -2136,6 +2177,7 @@ class Message(Object, Update):
return self._client.send_video( return self._client.send_video(
chat_id=self.chat.id, chat_id=self.chat.id,
video=video, video=video,
file_ref=file_ref,
caption=caption, caption=caption,
parse_mode=parse_mode, parse_mode=parse_mode,
duration=duration, duration=duration,
@ -2153,6 +2195,7 @@ class Message(Object, Update):
def reply_video_note( def reply_video_note(
self, self,
video_note: str, video_note: str,
file_ref: str = None,
quote: bool = None, quote: bool = None,
duration: int = 0, duration: int = 0,
length: int = 1, length: int = 1,
@ -2191,6 +2234,10 @@ class Message(Object, Update):
pass a file path as string to upload a new video note that exists on your local machine. pass a file path as string to upload a new video note that exists on your local machine.
Sending video notes by a URL is currently unsupported. Sending video notes by a URL is currently unsupported.
file_ref (``str``, *optional*):
A valid file reference obtained by a recently fetched media message.
To be used in combination with a file id in case a file reference is needed.
quote (``bool``, *optional*): quote (``bool``, *optional*):
If ``True``, the message will be sent as a reply to this message. If ``True``, the message will be sent as a reply to this message.
If *reply_to_message_id* is passed, this parameter will be ignored. If *reply_to_message_id* is passed, this parameter will be ignored.
@ -2257,6 +2304,7 @@ class Message(Object, Update):
return self._client.send_video_note( return self._client.send_video_note(
chat_id=self.chat.id, chat_id=self.chat.id,
video_note=video_note, video_note=video_note,
file_ref=file_ref,
duration=duration, duration=duration,
length=length, length=length,
thumb=thumb, thumb=thumb,
@ -2270,6 +2318,7 @@ class Message(Object, Update):
def reply_voice( def reply_voice(
self, self,
voice: str, voice: str,
file_ref: str = None,
quote: bool = None, quote: bool = None,
caption: str = "", caption: str = "",
parse_mode: Union[str, None] = object, parse_mode: Union[str, None] = object,
@ -2308,6 +2357,10 @@ class Message(Object, Update):
pass an HTTP URL as a string for Telegram to get an audio from the Internet, or pass an HTTP URL as a string for Telegram to get an audio from the Internet, 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.
file_ref (``str``, *optional*):
A valid file reference obtained by a recently fetched media message.
To be used in combination with a file id in case a file reference is needed.
quote (``bool``, *optional*): quote (``bool``, *optional*):
If ``True``, the message will be sent as a reply to this message. If ``True``, the message will be sent as a reply to this message.
If *reply_to_message_id* is passed, this parameter will be ignored. If *reply_to_message_id* is passed, this parameter will be ignored.
@ -2375,6 +2428,7 @@ class Message(Object, Update):
return self._client.send_voice( return self._client.send_voice(
chat_id=self.chat.id, chat_id=self.chat.id,
voice=voice, voice=voice,
file_ref=file_ref,
caption=caption, caption=caption,
parse_mode=parse_mode, parse_mode=parse_mode,
duration=duration, duration=duration,
@ -2911,6 +2965,7 @@ class Message(Object, Update):
def download( def download(
self, self,
file_ref: str = None,
file_name: str = "", file_name: str = "",
block: bool = True, block: bool = True,
progress: callable = None, progress: callable = None,
@ -2930,6 +2985,10 @@ class Message(Object, Update):
message.download() message.download()
Parameters: Parameters:
file_ref (``str``, *optional*):
A valid file reference obtained by a recently fetched media message.
To be used in combination with a file id in case a file reference is needed.
file_name (``str``, *optional*): file_name (``str``, *optional*):
A custom *file_name* to be used instead of the one provided by Telegram. A custom *file_name* to be used instead of the one provided by Telegram.
By default, all files are downloaded in the *downloads* folder in your working directory. By default, all files are downloaded in the *downloads* folder in your working directory.
@ -2971,6 +3030,7 @@ class Message(Object, Update):
""" """
return self._client.download_media( return self._client.download_media(
message=self, message=self,
file_ref=file_ref,
file_name=file_name, file_name=file_name,
block=block, block=block,
progress=progress, progress=progress,