New fields gif_duration in InlineQueryResultGif and mpeg4_duration in

InlineQueryResultMpeg4Gif.
This commit is contained in:
eternnoir 2017-05-25 13:27:13 +08:00
parent b2449e64c2
commit 639218b3bf
1 changed files with 9 additions and 3 deletions

View File

@ -794,7 +794,7 @@ class InlineKeyboardMarkup(Dictionaryable, JsonSerializable):
class InlineKeyboardButton(JsonSerializable):
def __init__(self, text, url=None, callback_data=None, switch_inline_query=None,
switch_inline_query_current_chat=None, callback_game=None, pay = None):
switch_inline_query_current_chat=None, callback_game=None, pay=None):
self.text = text
self.url = url
self.callback_data = callback_data
@ -1077,7 +1077,7 @@ class InlineQueryResultPhoto(JsonSerializable):
class InlineQueryResultGif(JsonSerializable):
def __init__(self, id, gif_url, thumb_url, gif_width=None, gif_height=None, title=None, caption=None,
reply_markup=None, input_message_content=None):
reply_markup=None, input_message_content=None, gif_duration=None):
"""
Represents a link to an animated GIF file.
:param id: Unique identifier for this result, 1-64 bytes.
@ -1101,6 +1101,7 @@ class InlineQueryResultGif(JsonSerializable):
self.caption = caption
self.reply_markup = reply_markup
self.input_message_content = input_message_content
self.gif_duration = gif_duration
def to_json(self):
json_dict = {'type': self.type, 'id': self.id, 'gif_url': self.gif_url, 'thumb_url': self.thumb_url}
@ -1116,12 +1117,14 @@ class InlineQueryResultGif(JsonSerializable):
json_dict['reply_markup'] = self.reply_markup.to_dic()
if self.input_message_content:
json_dict['input_message_content'] = self.input_message_content.to_dic()
if self.gif_duration:
json_dict['gif_duration'] = self.gif_duration
return json.dumps(json_dict)
class InlineQueryResultMpeg4Gif(JsonSerializable):
def __init__(self, id, mpeg4_url, thumb_url, mpeg4_width=None, mpeg4_height=None, title=None, caption=None,
reply_markup=None, input_message_content=None):
reply_markup=None, input_message_content=None, mpeg4_duration=None):
"""
Represents a link to a video animation (H.264/MPEG-4 AVC video without sound).
:param id: Unique identifier for this result, 1-64 bytes
@ -1145,6 +1148,7 @@ class InlineQueryResultMpeg4Gif(JsonSerializable):
self.caption = caption
self.reply_markup = reply_markup
self.input_message_content = input_message_content
self.mpeg4_duration = mpeg4_duration
def to_json(self):
json_dict = {'type': self.type, 'id': self.id, 'mpeg4_url': self.mpeg4_url, 'thumb_url': self.thumb_url}
@ -1160,6 +1164,8 @@ class InlineQueryResultMpeg4Gif(JsonSerializable):
json_dict['reply_markup'] = self.reply_markup.to_dic()
if self.input_message_content:
json_dict['input_message_content'] = self.input_message_content.to_dic()
if self.mpeg4_duration:
json_dict['mpeg4_duration '] = self.mpeg4_duration
return json.dumps(json_dict)