@@ -323,7 +323,14 @@ def sendPhoto(self, chat_id, photo, caption=None, **kwargs):
323323
324324 @log
325325 @message
326- def sendAudio (self , chat_id , audio , duration = None , performer = None , title = None , ** kwargs ):
326+ def sendAudio (self ,
327+ chat_id ,
328+ audio ,
329+ duration = None ,
330+ performer = None ,
331+ title = None ,
332+ caption = None ,
333+ ** kwargs ):
327334 """Use this method to send audio files, if you want Telegram clients to
328335 display them in the music player. Your audio must be in an .mp3 format.
329336 On success, the sent Message is returned. Bots can currently send audio
@@ -348,6 +355,8 @@ def sendAudio(self, chat_id, audio, duration=None, performer=None, title=None, *
348355 Performer of sent audio. [Optional]
349356 title:
350357 Title of sent audio. [Optional]
358+ caption:
359+ Audio caption [Optional]
351360
352361 Keyword Args:
353362 disable_notification (Optional[bool]): Sends the message silently.
@@ -381,6 +390,8 @@ def sendAudio(self, chat_id, audio, duration=None, performer=None, title=None, *
381390 data ['performer' ] = performer
382391 if title :
383392 data ['title' ] = title
393+ if caption :
394+ data ['caption' ] = caption
384395
385396 return url , data
386397
@@ -531,7 +542,7 @@ def sendVideo(self, chat_id, video, duration=None, caption=None, **kwargs):
531542
532543 @log
533544 @message
534- def sendVoice (self , chat_id , voice , duration = None , ** kwargs ):
545+ def sendVoice (self , chat_id , voice , duration = None , caption = None , ** kwargs ):
535546 """Use this method to send audio files, if you want Telegram clients to
536547 display the file as a playable voice message. For this to work, your
537548 audio must be in an .ogg file encoded with OPUS (other formats may be
@@ -548,6 +559,8 @@ def sendVoice(self, chat_id, voice, duration=None, **kwargs):
548559 a new audio file using multipart/form-data.
549560 duration:
550561 Duration of sent audio in seconds. [Optional]
562+ caption:
563+ Voice caption [Optional]
551564
552565 Keyword Args:
553566 disable_notification (Optional[bool]): Sends the message silently.
@@ -577,6 +590,8 @@ def sendVoice(self, chat_id, voice, duration=None, **kwargs):
577590
578591 if duration :
579592 data ['duration' ] = duration
593+ if caption :
594+ data ['caption' ] = caption
580595
581596 return url , data
582597
@@ -1443,7 +1458,8 @@ def __reduce__(self):
14431458 return (self .__class__ , (self .token , self .base_url .replace (self .token , '' ),
14441459 self .base_file_url .replace (self .token , '' )))
14451460
1446- # snake_case (PEP8) aliases
1461+ # snake_case (PEP8) aliases
1462+
14471463 get_me = getMe
14481464 send_message = sendMessage
14491465 forward_message = forwardMessage
0 commit comments