Skip to content

Commit 08dd7d1

Browse files
Added caption field to several objects
InlineQueryResultAudio, InlineQueryResultVoice, InlineQueryResultCachedAudio, InlineQueryResultCachedVoice
1 parent 8d65856 commit 08dd7d1

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

‎telebot/types.py‎

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1118,19 +1118,22 @@ def to_json(self):
11181118

11191119

11201120
class InlineQueryResultAudio(JsonSerializable):
1121-
def __init__(self, id, audio_url, title, performer=None, audio_duration=None, reply_markup=None,
1121+
def __init__(self, id, audio_url, title, caption=None, performer=None, audio_duration=None, reply_markup=None,
11221122
input_message_content=None):
11231123
self.type = 'audio'
11241124
self.id = id
11251125
self.audio_url = audio_url
11261126
self.title = title
1127+
self.caption = caption
11271128
self.performer = performer
11281129
self.audio_duration = audio_duration
11291130
self.reply_markup = reply_markup
11301131
self.input_message_content = input_message_content
11311132

11321133
def to_json(self):
11331134
json_dict = {'type': self.type, 'id': self.id, 'audio_url': self.audio_url, 'title': self.title}
1135+
if self.caption:
1136+
json_dict['caption'] = self.caption
11341137
if self.performer:
11351138
json_dict['performer'] = self.performer
11361139
if self.audio_duration:
@@ -1143,19 +1146,22 @@ def to_json(self):
11431146

11441147

11451148
class InlineQueryResultVoice(JsonSerializable):
1146-
def __init__(self, id, voice_url, title, performer=None, voice_duration=None, reply_markup=None,
1149+
def __init__(self, id, voice_url, title, caption=None, performer=None, voice_duration=None, reply_markup=None,
11471150
input_message_content=None):
11481151
self.type = 'voice'
11491152
self.id = id
11501153
self.voice_url = voice_url
11511154
self.title = title
1155+
self.caption = caption
11521156
self.performer = performer
11531157
self.voice_duration = voice_duration
11541158
self.reply_markup = reply_markup
11551159
self.input_message_content = input_message_content
11561160

11571161
def to_json(self):
11581162
json_dict = {'type': self.type, 'id': self.id, 'voice_url': self.voice_url, 'title': self.title}
1163+
if self.caption:
1164+
json_dict['caption'] = self.caption
11591165
if self.performer:
11601166
json_dict['performer'] = self.performer
11611167
if self.voice_duration:
@@ -1413,23 +1419,25 @@ def __init__(self, id, video_file_id, title, description=None, caption=None, rep
14131419

14141420

14151421
class InlineQueryResultCachedVoice(BaseInlineQueryResultCached):
1416-
def __init__(self, id, voice_file_id, title, reply_markup=None, input_message_content=None):
1422+
def __init__(self, id, voice_file_id, title, caption=None, reply_markup=None, input_message_content=None):
14171423
BaseInlineQueryResultCached.__init__(self)
14181424
self.type = 'voice'
14191425
self.id = id
14201426
self.voice_file_id = voice_file_id
14211427
self.title = title
1428+
self.caption = caption
14221429
self.reply_markup = reply_markup
14231430
self.input_message_content = input_message_content
14241431
self.payload_dic['voice_file_id'] = voice_file_id
14251432

14261433

14271434
class InlineQueryResultCachedAudio(BaseInlineQueryResultCached):
1428-
def __init__(self, id, audio_file_id, reply_markup=None, input_message_content=None):
1435+
def __init__(self, id, audio_file_id, caption=None, reply_markup=None, input_message_content=None):
14291436
BaseInlineQueryResultCached.__init__(self)
14301437
self.type = 'audio'
14311438
self.id = id
14321439
self.audio_file_id = audio_file_id
1440+
self.caption = caption
14331441
self.reply_markup = reply_markup
14341442
self.input_message_content = input_message_content
14351443
self.payload_dic['audio_file_id'] = audio_file_id

0 commit comments

Comments
 (0)