Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e75deea

Browse files
committed
Merge pull request python-telegram-bot#59 from ergoz/PR57-Fix
Code cleanup for filename. Filename uses only for sendDocument.
2 parents 0098625 + 17b8bb4 commit e75deea

File tree

1 file changed

+0
-31
lines changed

1 file changed

+0
-31
lines changed

telegram/bot.py

-31
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,6 @@ def forwardMessage(self,
252252
def sendPhoto(self,
253253
chat_id,
254254
photo,
255-
filename=None,
256255
caption=None,
257256
**kwargs):
258257
"""Use this method to send photos.
@@ -264,9 +263,6 @@ def sendPhoto(self,
264263
Photo to send. You can either pass a file_id as String to resend a
265264
photo that is already on the Telegram servers, or upload a new
266265
photo using multipart/form-data.
267-
filename:
268-
File name that shows in telegram message (it is usefull when you
269-
send file generated by temp module, for example). [Optional]
270266
caption:
271267
Photo caption (may also be used when resending photos by file_id).
272268
[Optional]
@@ -286,8 +282,6 @@ def sendPhoto(self,
286282
data = {'chat_id': chat_id,
287283
'photo': photo}
288284

289-
if filename:
290-
data['filename'] = filename
291285
if caption:
292286
data['caption'] = caption
293287

@@ -298,7 +292,6 @@ def sendPhoto(self,
298292
def sendAudio(self,
299293
chat_id,
300294
audio,
301-
filename=None,
302295
duration=None,
303296
performer=None,
304297
title=None,
@@ -321,9 +314,6 @@ def sendAudio(self,
321314
Audio file to send. You can either pass a file_id as String to
322315
resend an audio that is already on the Telegram servers, or upload
323316
a new audio file using multipart/form-data.
324-
filename:
325-
File name that shows in telegram message (it is usefull when you
326-
send file generated by temp module, for example). [Optional]
327317
duration:
328318
Duration of sent audio in seconds. [Optional]
329319
performer:
@@ -346,8 +336,6 @@ def sendAudio(self,
346336
data = {'chat_id': chat_id,
347337
'audio': audio}
348338

349-
if filename:
350-
data['filename'] = filename
351339
if duration:
352340
data['duration'] = duration
353341
if performer:
@@ -402,7 +390,6 @@ def sendDocument(self,
402390
def sendSticker(self,
403391
chat_id,
404392
sticker,
405-
filename=None,
406393
**kwargs):
407394
"""Use this method to send .webp stickers.
408395
@@ -413,9 +400,6 @@ def sendSticker(self,
413400
Sticker to send. You can either pass a file_id as String to resend
414401
a sticker that is already on the Telegram servers, or upload a new
415402
sticker using multipart/form-data.
416-
filename:
417-
File name that shows in telegram message (it is usefull when you
418-
send file generated by temp module, for example). [Optional]
419403
reply_to_message_id:
420404
If the message is a reply, ID of the original message. [Optional]
421405
reply_markup:
@@ -431,9 +415,6 @@ def sendSticker(self,
431415

432416
data = {'chat_id': chat_id,
433417
'sticker': sticker}
434-
435-
if filename:
436-
data['filename'] = filename
437418

438419
return url, data
439420

@@ -442,7 +423,6 @@ def sendSticker(self,
442423
def sendVideo(self,
443424
chat_id,
444425
video,
445-
filename=None,
446426
duration=None,
447427
caption=None,
448428
**kwargs):
@@ -456,9 +436,6 @@ def sendVideo(self,
456436
Video to send. You can either pass a file_id as String to resend a
457437
video that is already on the Telegram servers, or upload a new
458438
video file using multipart/form-data.
459-
filename:
460-
File name that shows in telegram message (it is usefull when you
461-
send file generated by temp module, for example). [Optional]
462439
duration:
463440
Duration of sent video in seconds. [Optional]
464441
caption:
@@ -480,8 +457,6 @@ def sendVideo(self,
480457
data = {'chat_id': chat_id,
481458
'video': video}
482459

483-
if filename:
484-
data['filename'] = filename
485460
if duration:
486461
data['duration'] = duration
487462
if caption:
@@ -494,7 +469,6 @@ def sendVideo(self,
494469
def sendVoice(self,
495470
chat_id,
496471
voice,
497-
filename=None,
498472
duration=None,
499473
**kwargs):
500474
"""Use this method to send audio files, if you want Telegram clients to
@@ -511,9 +485,6 @@ def sendVoice(self,
511485
Audio file to send. You can either pass a file_id as String to
512486
resend an audio that is already on the Telegram servers, or upload
513487
a new audio file using multipart/form-data.
514-
filename:
515-
File name that shows in telegram message (it is usefull when you
516-
send file generated by temp module, for example). [Optional]
517488
duration:
518489
Duration of sent audio in seconds. [Optional]
519490
reply_to_message_id:
@@ -532,8 +503,6 @@ def sendVoice(self,
532503
data = {'chat_id': chat_id,
533504
'voice': voice}
534505

535-
if filename:
536-
data['filename'] = filename
537506
if duration:
538507
data['duration'] = duration
539508

0 commit comments

Comments
 (0)