Add mpeg4_duration and gif_duration to inline gif and mpeg4gif

This commit is contained in:
Jacob Bom 2017-05-21 14:38:12 +02:00
parent ad347b5c02
commit 5a15d1b5d6
4 changed files with 16 additions and 0 deletions

View file

@ -32,6 +32,7 @@ class InlineQueryResultGif(InlineQueryResult):
thumb_url (str): URL of the static thumbnail for the result (jpeg or gif).
gif_width (Optional[int]): Width of the GIF.
gif_height (Optional[int]): Height of the GIF.
gif_duration (Optional[int]): Duration of the GIF.
title (Optional[str]): Title for the result.
caption (Optional[str]): Caption of the GIF file to be sent, 0-200 characters.
reply_markup (Optional[:class:`telegram.InlineKeyboardMarkup`]): Inline keyboard attached
@ -45,6 +46,7 @@ class InlineQueryResultGif(InlineQueryResult):
thumb_url (str):
gif_width (Optional[int]):
gif_height (Optional[int]):
gif_duration (Optional[int]):
title (Optional[str]):
caption (Optional[str]):
reply_markup (Optional[:class:`telegram.InlineKeyboardMarkup`]):
@ -59,6 +61,7 @@ class InlineQueryResultGif(InlineQueryResult):
thumb_url,
gif_width=None,
gif_height=None,
gif_duration=None,
title=None,
caption=None,
reply_markup=None,
@ -75,6 +78,8 @@ class InlineQueryResultGif(InlineQueryResult):
self.gif_width = gif_width
if gif_height:
self.gif_height = gif_height
if gif_duration:
self.gif_duration = gif_duration
if title:
self.title = title
if caption:

View file

@ -32,6 +32,7 @@ class InlineQueryResultMpeg4Gif(InlineQueryResult):
thumb_url (str): URL of the static thumbnail (jpeg or gif) for the result.
mpeg4_width (Optional[int]): Video width.
mpeg4_height (Optional[int]): Video height.
mpeg4_duration (Optional[int]): Video duration
title (Optional[str]): Title for the result.
caption (Optional[str]): Caption of the MPEG-4 file to be sent, 0-200 characters.
reply_markup (Optional[:class:`telegram.InlineKeyboardMarkup`]): Inline keyboard attached
@ -44,6 +45,7 @@ class InlineQueryResultMpeg4Gif(InlineQueryResult):
thumb_url (str): URL of the static thumbnail (jpeg or gif) for the result.
mpeg4_width (Optional[int]): Video width.
mpeg4_height (Optional[int]): Video height.
mpeg4_duration (Optional[int]): Video duration
title (Optional[str]): Title for the result.
caption (Optional[str]): Caption of the MPEG-4 file to be sent, 0-200 characters.
reply_markup (Optional[:class:`telegram.InlineKeyboardMarkup`]): Inline keyboard attached
@ -60,6 +62,7 @@ class InlineQueryResultMpeg4Gif(InlineQueryResult):
thumb_url,
mpeg4_width=None,
mpeg4_height=None,
mpeg4_duration=None,
title=None,
caption=None,
reply_markup=None,
@ -76,6 +79,8 @@ class InlineQueryResultMpeg4Gif(InlineQueryResult):
self.mpeg4_width = mpeg4_width
if mpeg4_height:
self.mpeg4_height = mpeg4_height
if mpeg4_duration:
self.mpeg4_duration = mpeg4_duration
if title:
self.title = title
if caption:

View file

@ -37,6 +37,7 @@ class InlineQueryResultGifTest(BaseTest, unittest.TestCase):
self.gif_url = 'gif url'
self.gif_width = 10
self.gif_height = 15
self.gif_duration = 1
self.thumb_url = 'thumb url'
self.title = 'title'
self.caption = 'caption'
@ -50,6 +51,7 @@ class InlineQueryResultGifTest(BaseTest, unittest.TestCase):
'gif_url': self.gif_url,
'gif_width': self.gif_width,
'gif_height': self.gif_height,
'gif_duration': self.gif_duration,
'thumb_url': self.thumb_url,
'title': self.title,
'caption': self.caption,
@ -65,6 +67,7 @@ class InlineQueryResultGifTest(BaseTest, unittest.TestCase):
self.assertEqual(gif.gif_url, self.gif_url)
self.assertEqual(gif.gif_width, self.gif_width)
self.assertEqual(gif.gif_height, self.gif_height)
self.assertEqual(gif.gif_duration, self.gif_duration)
self.assertEqual(gif.thumb_url, self.thumb_url)
self.assertEqual(gif.title, self.title)
self.assertEqual(gif.caption, self.caption)

View file

@ -37,6 +37,7 @@ class InlineQueryResultMpeg4GifTest(BaseTest, unittest.TestCase):
self.mpeg4_url = 'mpeg4 url'
self.mpeg4_width = 10
self.mpeg4_height = 15
self.mpeg4_duration = 1
self.thumb_url = 'thumb url'
self.title = 'title'
self.caption = 'caption'
@ -50,6 +51,7 @@ class InlineQueryResultMpeg4GifTest(BaseTest, unittest.TestCase):
'mpeg4_url': self.mpeg4_url,
'mpeg4_width': self.mpeg4_width,
'mpeg4_height': self.mpeg4_height,
'mpeg4_duration': self.mpeg4_duration,
'thumb_url': self.thumb_url,
'title': self.title,
'caption': self.caption,
@ -65,6 +67,7 @@ class InlineQueryResultMpeg4GifTest(BaseTest, unittest.TestCase):
self.assertEqual(mpeg4.mpeg4_url, self.mpeg4_url)
self.assertEqual(mpeg4.mpeg4_width, self.mpeg4_width)
self.assertEqual(mpeg4.mpeg4_height, self.mpeg4_height)
self.assertEqual(mpeg4.mpeg4_duration, self.mpeg4_duration)
self.assertEqual(mpeg4.thumb_url, self.thumb_url)
self.assertEqual(mpeg4.title, self.title)
self.assertEqual(mpeg4.caption, self.caption)