Skip to content

Commit 0f3398e

Browse files
authored
Merge pull request eternnoir#239 from Kondra007/patch-7
Added Caption field to sendAudio & sendVoice
2 parents 8d65856 + 7e94810 commit 0f3398e

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

‎telebot/apihelper.py‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ def send_video(token, chat_id, data, duration=None, caption=None, reply_to_messa
280280
return _make_request(token, method_url, params=payload, files=files, method='post')
281281

282282

283-
def send_voice(token, chat_id, voice, duration=None, reply_to_message_id=None, reply_markup=None,
283+
def send_voice(token, chat_id, voice, caption=None, duration=None, reply_to_message_id=None, reply_markup=None,
284284
disable_notification=None, timeout=None):
285285
method_url = r'sendVoice'
286286
payload = {'chat_id': chat_id}
@@ -289,6 +289,8 @@ def send_voice(token, chat_id, voice, duration=None, reply_to_message_id=None, r
289289
files = {'voice': voice}
290290
else:
291291
payload['voice'] = voice
292+
if caption:
293+
payload['caption'] = caption
292294
if duration:
293295
payload['duration'] = duration
294296
if reply_to_message_id:
@@ -302,7 +304,7 @@ def send_voice(token, chat_id, voice, duration=None, reply_to_message_id=None, r
302304
return _make_request(token, method_url, params=payload, files=files, method='post')
303305

304306

305-
def send_audio(token, chat_id, audio, duration=None, performer=None, title=None, reply_to_message_id=None,
307+
def send_audio(token, chat_id, audio, caption=None, duration=None, performer=None, title=None, reply_to_message_id=None,
306308
reply_markup=None, disable_notification=None, timeout=None):
307309
method_url = r'sendAudio'
308310
payload = {'chat_id': chat_id}
@@ -311,6 +313,8 @@ def send_audio(token, chat_id, audio, duration=None, performer=None, title=None,
311313
files = {'audio': audio}
312314
else:
313315
payload['audio'] = audio
316+
if caption:
317+
payload['caption'] = caption
314318
if duration:
315319
payload['duration'] = duration
316320
if performer:

0 commit comments

Comments
 (0)