From 08dd7d15934a3dc1f90b820897eb17a3e64142ba Mon Sep 17 00:00:00 2001 From: Evgeny Petrov Date: Tue, 11 Oct 2016 22:57:16 +0300 Subject: [PATCH] Added caption field to several objects InlineQueryResultAudio, InlineQueryResultVoice, InlineQueryResultCachedAudio, InlineQueryResultCachedVoice --- telebot/types.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/telebot/types.py b/telebot/types.py index 8c26bcb..248f728 100644 --- a/telebot/types.py +++ b/telebot/types.py @@ -1118,12 +1118,13 @@ class InlineQueryResultVideo(JsonSerializable): class InlineQueryResultAudio(JsonSerializable): - def __init__(self, id, audio_url, title, performer=None, audio_duration=None, reply_markup=None, + def __init__(self, id, audio_url, title, caption=None, performer=None, audio_duration=None, reply_markup=None, input_message_content=None): self.type = 'audio' self.id = id self.audio_url = audio_url self.title = title + self.caption = caption self.performer = performer self.audio_duration = audio_duration self.reply_markup = reply_markup @@ -1131,6 +1132,8 @@ class InlineQueryResultAudio(JsonSerializable): def to_json(self): json_dict = {'type': self.type, 'id': self.id, 'audio_url': self.audio_url, 'title': self.title} + if self.caption: + json_dict['caption'] = self.caption if self.performer: json_dict['performer'] = self.performer if self.audio_duration: @@ -1143,12 +1146,13 @@ class InlineQueryResultAudio(JsonSerializable): class InlineQueryResultVoice(JsonSerializable): - def __init__(self, id, voice_url, title, performer=None, voice_duration=None, reply_markup=None, + def __init__(self, id, voice_url, title, caption=None, performer=None, voice_duration=None, reply_markup=None, input_message_content=None): self.type = 'voice' self.id = id self.voice_url = voice_url self.title = title + self.caption = caption self.performer = performer self.voice_duration = voice_duration self.reply_markup = reply_markup @@ -1156,6 +1160,8 @@ class InlineQueryResultVoice(JsonSerializable): def to_json(self): json_dict = {'type': self.type, 'id': self.id, 'voice_url': self.voice_url, 'title': self.title} + if self.caption: + json_dict['caption'] = self.caption if self.performer: json_dict['performer'] = self.performer if self.voice_duration: @@ -1413,23 +1419,25 @@ class InlineQueryResultCachedVideo(BaseInlineQueryResultCached): class InlineQueryResultCachedVoice(BaseInlineQueryResultCached): - def __init__(self, id, voice_file_id, title, reply_markup=None, input_message_content=None): + def __init__(self, id, voice_file_id, title, caption=None, reply_markup=None, input_message_content=None): BaseInlineQueryResultCached.__init__(self) self.type = 'voice' self.id = id self.voice_file_id = voice_file_id self.title = title + self.caption = caption self.reply_markup = reply_markup self.input_message_content = input_message_content self.payload_dic['voice_file_id'] = voice_file_id class InlineQueryResultCachedAudio(BaseInlineQueryResultCached): - def __init__(self, id, audio_file_id, reply_markup=None, input_message_content=None): + def __init__(self, id, audio_file_id, caption=None, reply_markup=None, input_message_content=None): BaseInlineQueryResultCached.__init__(self) self.type = 'audio' self.id = id self.audio_file_id = audio_file_id + self.caption = caption self.reply_markup = reply_markup self.input_message_content = input_message_content self.payload_dic['audio_file_id'] = audio_file_id