Skip to content

Commit 42f09cd

Browse files
authored
Add missing file_ref argument to bound methods (pyrogram#347)
1 parent 78cba04 commit 42f09cd

1 file changed

Lines changed: 60 additions & 0 deletions

File tree

  • pyrogram/client/types/messages_and_media

pyrogram/client/types/messages_and_media/message.py

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -746,6 +746,7 @@ def reply_text(
746746
def reply_animation(
747747
self,
748748
animation: str,
749+
file_ref: str = None,
749750
quote: bool = None,
750751
caption: str = "",
751752
parse_mode: Union[str, None] = object,
@@ -787,6 +788,10 @@ def reply_animation(
787788
pass an HTTP URL as a string for Telegram to get an animation from the Internet, or
788789
pass a file path as string to upload a new animation that exists on your local machine.
789790
791+
file_ref (``str``, *optional*):
792+
A valid file reference obtained by a recently fetched media message.
793+
To be used in combination with a file id in case a file reference is needed.
794+
790795
quote (``bool``, *optional*):
791796
If ``True``, the message will be sent as a reply to this message.
792797
If *reply_to_message_id* is passed, this parameter will be ignored.
@@ -866,6 +871,7 @@ def reply_animation(
866871
return self._client.send_animation(
867872
chat_id=self.chat.id,
868873
animation=animation,
874+
file_ref=file_ref,
869875
caption=caption,
870876
parse_mode=parse_mode,
871877
duration=duration,
@@ -882,6 +888,7 @@ def reply_animation(
882888
def reply_audio(
883889
self,
884890
audio: str,
891+
file_ref: str = None,
885892
quote: bool = None,
886893
caption: str = "",
887894
parse_mode: Union[str, None] = object,
@@ -923,6 +930,10 @@ def reply_audio(
923930
pass an HTTP URL as a string for Telegram to get an audio file from the Internet, or
924931
pass a file path as string to upload a new audio file that exists on your local machine.
925932
933+
file_ref (``str``, *optional*):
934+
A valid file reference obtained by a recently fetched media message.
935+
To be used in combination with a file id in case a file reference is needed.
936+
926937
quote (``bool``, *optional*):
927938
If ``True``, the message will be sent as a reply to this message.
928939
If *reply_to_message_id* is passed, this parameter will be ignored.
@@ -1002,6 +1013,7 @@ def reply_audio(
10021013
return self._client.send_audio(
10031014
chat_id=self.chat.id,
10041015
audio=audio,
1016+
file_ref=file_ref,
10051017
caption=caption,
10061018
parse_mode=parse_mode,
10071019
duration=duration,
@@ -1018,6 +1030,7 @@ def reply_audio(
10181030
def reply_cached_media(
10191031
self,
10201032
file_id: str,
1033+
file_ref: str = None,
10211034
quote: bool = None,
10221035
caption: str = "",
10231036
parse_mode: Union[str, None] = object,
@@ -1051,6 +1064,10 @@ def reply_cached_media(
10511064
Media to send.
10521065
Pass a file_id as string to send a media that exists on the Telegram servers.
10531066
1067+
file_ref (``str``, *optional*):
1068+
A valid file reference obtained by a recently fetched media message.
1069+
To be used in combination with a file id in case a file reference is needed.
1070+
10541071
quote (``bool``, *optional*):
10551072
If ``True``, the message will be sent as a reply to this message.
10561073
If *reply_to_message_id* is passed, this parameter will be ignored.
@@ -1092,6 +1109,7 @@ def reply_cached_media(
10921109
return self._client.send_cached_media(
10931110
chat_id=self.chat.id,
10941111
file_id=file_id,
1112+
file_ref=file_ref,
10951113
caption=caption,
10961114
parse_mode=parse_mode,
10971115
disable_notification=disable_notification,
@@ -1225,6 +1243,7 @@ def reply_contact(
12251243
def reply_document(
12261244
self,
12271245
document: str,
1246+
file_ref: str = None,
12281247
quote: bool = None,
12291248
thumb: str = None,
12301249
caption: str = "",
@@ -1263,6 +1282,10 @@ def reply_document(
12631282
pass an HTTP URL as a string for Telegram to get a file from the Internet, or
12641283
pass a file path as string to upload a new file that exists on your local machine.
12651284
1285+
file_ref (``str``, *optional*):
1286+
A valid file reference obtained by a recently fetched media message.
1287+
To be used in combination with a file id in case a file reference is needed.
1288+
12661289
quote (``bool``, *optional*):
12671290
If ``True``, the message will be sent as a reply to this message.
12681291
If *reply_to_message_id* is passed, this parameter will be ignored.
@@ -1333,6 +1356,7 @@ def reply_document(
13331356
return self._client.send_document(
13341357
chat_id=self.chat.id,
13351358
document=document,
1359+
file_ref=file_ref,
13361360
thumb=thumb,
13371361
caption=caption,
13381362
parse_mode=parse_mode,
@@ -1620,6 +1644,7 @@ def reply_media_group(
16201644
def reply_photo(
16211645
self,
16221646
photo: str,
1647+
file_ref: str = None,
16231648
quote: bool = None,
16241649
caption: str = "",
16251650
parse_mode: Union[str, None] = object,
@@ -1658,6 +1683,10 @@ def reply_photo(
16581683
pass an HTTP URL as a string for Telegram to get a photo from the Internet, or
16591684
pass a file path as string to upload a new photo that exists on your local machine.
16601685
1686+
file_ref (``str``, *optional*):
1687+
A valid file reference obtained by a recently fetched media message.
1688+
To be used in combination with a file id in case a file reference is needed.
1689+
16611690
quote (``bool``, *optional*):
16621691
If ``True``, the message will be sent as a reply to this message.
16631692
If *reply_to_message_id* is passed, this parameter will be ignored.
@@ -1727,6 +1756,7 @@ def reply_photo(
17271756
return self._client.send_photo(
17281757
chat_id=self.chat.id,
17291758
photo=photo,
1759+
file_ref=file_ref,
17301760
caption=caption,
17311761
parse_mode=parse_mode,
17321762
ttl_seconds=ttl_seconds,
@@ -1815,6 +1845,7 @@ def reply_poll(
18151845
def reply_sticker(
18161846
self,
18171847
sticker: str,
1848+
file_ref: str = None,
18181849
quote: bool = None,
18191850
disable_notification: bool = None,
18201851
reply_to_message_id: int = None,
@@ -1850,6 +1881,10 @@ def reply_sticker(
18501881
pass an HTTP URL as a string for Telegram to get a .webp sticker file from the Internet, or
18511882
pass a file path as string to upload a new sticker that exists on your local machine.
18521883
1884+
file_ref (``str``, *optional*):
1885+
A valid file reference obtained by a recently fetched media message.
1886+
To be used in combination with a file id in case a file reference is needed.
1887+
18531888
quote (``bool``, *optional*):
18541889
If ``True``, the message will be sent as a reply to this message.
18551890
If *reply_to_message_id* is passed, this parameter will be ignored.
@@ -1904,6 +1939,7 @@ def reply_sticker(
19041939
return self._client.send_sticker(
19051940
chat_id=self.chat.id,
19061941
sticker=sticker,
1942+
file_ref=file_ref,
19071943
disable_notification=disable_notification,
19081944
reply_to_message_id=reply_to_message_id,
19091945
reply_markup=reply_markup,
@@ -2012,6 +2048,7 @@ def reply_venue(
20122048
def reply_video(
20132049
self,
20142050
video: str,
2051+
file_ref: str = None,
20152052
quote: bool = None,
20162053
caption: str = "",
20172054
parse_mode: Union[str, None] = object,
@@ -2054,6 +2091,10 @@ def reply_video(
20542091
pass an HTTP URL as a string for Telegram to get a video from the Internet, or
20552092
pass a file path as string to upload a new video that exists on your local machine.
20562093
2094+
file_ref (``str``, *optional*):
2095+
A valid file reference obtained by a recently fetched media message.
2096+
To be used in combination with a file id in case a file reference is needed.
2097+
20572098
quote (``bool``, *optional*):
20582099
If ``True``, the message will be sent as a reply to this message.
20592100
If *reply_to_message_id* is passed, this parameter will be ignored.
@@ -2136,6 +2177,7 @@ def reply_video(
21362177
return self._client.send_video(
21372178
chat_id=self.chat.id,
21382179
video=video,
2180+
file_ref=file_ref,
21392181
caption=caption,
21402182
parse_mode=parse_mode,
21412183
duration=duration,
@@ -2153,6 +2195,7 @@ def reply_video(
21532195
def reply_video_note(
21542196
self,
21552197
video_note: str,
2198+
file_ref: str = None,
21562199
quote: bool = None,
21572200
duration: int = 0,
21582201
length: int = 1,
@@ -2191,6 +2234,10 @@ def reply_video_note(
21912234
pass a file path as string to upload a new video note that exists on your local machine.
21922235
Sending video notes by a URL is currently unsupported.
21932236
2237+
file_ref (``str``, *optional*):
2238+
A valid file reference obtained by a recently fetched media message.
2239+
To be used in combination with a file id in case a file reference is needed.
2240+
21942241
quote (``bool``, *optional*):
21952242
If ``True``, the message will be sent as a reply to this message.
21962243
If *reply_to_message_id* is passed, this parameter will be ignored.
@@ -2257,6 +2304,7 @@ def reply_video_note(
22572304
return self._client.send_video_note(
22582305
chat_id=self.chat.id,
22592306
video_note=video_note,
2307+
file_ref=file_ref,
22602308
duration=duration,
22612309
length=length,
22622310
thumb=thumb,
@@ -2270,6 +2318,7 @@ def reply_video_note(
22702318
def reply_voice(
22712319
self,
22722320
voice: str,
2321+
file_ref: str = None,
22732322
quote: bool = None,
22742323
caption: str = "",
22752324
parse_mode: Union[str, None] = object,
@@ -2308,6 +2357,10 @@ def reply_voice(
23082357
pass an HTTP URL as a string for Telegram to get an audio from the Internet, or
23092358
pass a file path as string to upload a new audio that exists on your local machine.
23102359
2360+
file_ref (``str``, *optional*):
2361+
A valid file reference obtained by a recently fetched media message.
2362+
To be used in combination with a file id in case a file reference is needed.
2363+
23112364
quote (``bool``, *optional*):
23122365
If ``True``, the message will be sent as a reply to this message.
23132366
If *reply_to_message_id* is passed, this parameter will be ignored.
@@ -2375,6 +2428,7 @@ def reply_voice(
23752428
return self._client.send_voice(
23762429
chat_id=self.chat.id,
23772430
voice=voice,
2431+
file_ref=file_ref,
23782432
caption=caption,
23792433
parse_mode=parse_mode,
23802434
duration=duration,
@@ -2911,6 +2965,7 @@ def retract_vote(
29112965

29122966
def download(
29132967
self,
2968+
file_ref: str = None,
29142969
file_name: str = "",
29152970
block: bool = True,
29162971
progress: callable = None,
@@ -2930,6 +2985,10 @@ def download(
29302985
message.download()
29312986
29322987
Parameters:
2988+
file_ref (``str``, *optional*):
2989+
A valid file reference obtained by a recently fetched media message.
2990+
To be used in combination with a file id in case a file reference is needed.
2991+
29332992
file_name (``str``, *optional*):
29342993
A custom *file_name* to be used instead of the one provided by Telegram.
29352994
By default, all files are downloaded in the *downloads* folder in your working directory.
@@ -2971,6 +3030,7 @@ def download(
29713030
"""
29723031
return self._client.download_media(
29733032
message=self,
3033+
file_ref=file_ref,
29743034
file_name=file_name,
29753035
block=block,
29763036
progress=progress,

0 commit comments

Comments
 (0)