mirror of
https://github.com/python-telegram-bot/python-telegram-bot.git
synced 2024-11-22 15:17:00 +01:00
Merge branch 'may18minor' into beta
This commit is contained in:
commit
acda19b7e7
6 changed files with 40 additions and 0 deletions
|
@ -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:
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -132,6 +132,7 @@ class Message(TelegramObject):
|
|||
location=None,
|
||||
venue=None,
|
||||
new_chat_member=None,
|
||||
new_chat_members=None,
|
||||
left_chat_member=None,
|
||||
new_chat_title=None,
|
||||
new_chat_photo=None,
|
||||
|
@ -173,6 +174,7 @@ class Message(TelegramObject):
|
|||
self.location = location
|
||||
self.venue = venue
|
||||
self.new_chat_member = new_chat_member
|
||||
self.new_chat_members = new_chat_members
|
||||
self.left_chat_member = left_chat_member
|
||||
self.new_chat_title = new_chat_title
|
||||
self.new_chat_photo = new_chat_photo
|
||||
|
@ -232,6 +234,7 @@ class Message(TelegramObject):
|
|||
data['location'] = Location.de_json(data.get('location'), bot)
|
||||
data['venue'] = Venue.de_json(data.get('venue'), bot)
|
||||
data['new_chat_member'] = User.de_json(data.get('new_chat_member'), bot)
|
||||
data['new_chat_members'] = User.de_list(data.get('new_chat_members'), bot)
|
||||
data['left_chat_member'] = User.de_json(data.get('left_chat_member'), bot)
|
||||
data['new_chat_photo'] = PhotoSize.de_list(data.get('new_chat_photo'), bot)
|
||||
data['pinned_message'] = Message.de_json(data.get('pinned_message'), bot)
|
||||
|
@ -267,6 +270,8 @@ class Message(TelegramObject):
|
|||
data['entities'] = [e.to_dict() for e in self.entities]
|
||||
if self.new_chat_photo:
|
||||
data['new_chat_photo'] = [p.to_dict() for p in self.new_chat_photo]
|
||||
if self.new_chat_members:
|
||||
data['new_chat_members'] = [u.to_dict() for u in self.new_chat_members]
|
||||
|
||||
return data
|
||||
|
||||
|
|
|
@ -99,3 +99,22 @@ class User(TelegramObject):
|
|||
Shortcut for ``bot.getUserProfilePhotos(update.message.from_user.id, *args, **kwargs)``
|
||||
"""
|
||||
return self.bot.getUserProfilePhotos(self.id, *args, **kwargs)
|
||||
|
||||
@staticmethod
|
||||
def de_list(data, bot):
|
||||
"""
|
||||
Args:
|
||||
data (list):
|
||||
bot (telegram.Bot):
|
||||
|
||||
Returns:
|
||||
List<telegram.User>:
|
||||
"""
|
||||
if not data:
|
||||
return []
|
||||
|
||||
users = list()
|
||||
for user in data:
|
||||
users.append(User.de_json(user, bot))
|
||||
|
||||
return users
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue