From 4367dbc46551a4ec256bef89a8d35ae4f744b7a2 Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Sun, 24 Apr 2022 11:56:07 +0200 Subject: [PATCH] Add missing fields to InlineQueryResultAnimation --- .../inline_query_result_animation.py | 37 +++++++++++++++---- 1 file changed, 30 insertions(+), 7 deletions(-) diff --git a/pyrogram/types/inline_mode/inline_query_result_animation.py b/pyrogram/types/inline_mode/inline_query_result_animation.py index 4a170a18..71d1edf4 100644 --- a/pyrogram/types/inline_mode/inline_query_result_animation.py +++ b/pyrogram/types/inline_mode/inline_query_result_animation.py @@ -35,10 +35,23 @@ class InlineQueryResultAnimation(InlineQueryResult): A valid URL for the animated GIF file. File size must not exceed 1 MB. + animation_width (``int``, *optional*) + Width of the animation. + + animation_height (``int``, *optional*) + Height of the animation. + + animation_duration (``int``, *optional*) + Duration of the animation in seconds. + thumb_url (``str``, *optional*): URL of the static thumbnail for the result (jpeg or gif) Defaults to the value passed in *animation_url*. + thumb_mime_type (``str``, *optional*) + MIME type of the thumbnail, must be one of "image/jpeg", "image/gif", or "video/mp4". + Defaults to "image/jpeg". + id (``str``, *optional*): Unique identifier for this result, 1-64 bytes. Defaults to a randomly generated UUID4. @@ -46,11 +59,8 @@ class InlineQueryResultAnimation(InlineQueryResult): title (``str``, *optional*): Title for the result. - description (``str``, *optional*): - Short description of the result. - caption (``str``, *optional*): - Caption of the photo to be sent, 0-1024 characters. + Caption of the animation to be sent, 0-1024 characters. parse_mode (:obj:`~pyrogram.enums.ParseMode`, *optional*): By default, texts are parsed using both Markdown and HTML styles. @@ -69,7 +79,11 @@ class InlineQueryResultAnimation(InlineQueryResult): def __init__( self, animation_url: str, + animation_width: int = 0, + animation_height: int = 0, + animation_duration: int = 0, thumb_url: str = None, + thumb_mime_type: str = "image/jpeg", id: str = None, title: str = None, description: str = None, @@ -82,7 +96,11 @@ class InlineQueryResultAnimation(InlineQueryResult): super().__init__("gif", id, input_message_content, reply_markup) self.animation_url = animation_url + self.animation_width = animation_width + self.animation_height = animation_height + self.animation_duration = animation_duration self.thumb_url = thumb_url + self.thumb_mime_type = thumb_mime_type self.title = title self.description = description self.caption = caption @@ -96,7 +114,13 @@ class InlineQueryResultAnimation(InlineQueryResult): url=self.animation_url, size=0, mime_type="image/gif", - attributes=[] + attributes=[ + raw.types.DocumentAttributeVideo( + w=self.animation_width, + h=self.animation_height, + duration=self.animation_duration + ) + ] ) if self.thumb_url is None: @@ -105,7 +129,7 @@ class InlineQueryResultAnimation(InlineQueryResult): thumb = raw.types.InputWebDocument( url=self.thumb_url, size=0, - mime_type="image/gif", + mime_type=self.thumb_mime_type, attributes=[] ) @@ -117,7 +141,6 @@ class InlineQueryResultAnimation(InlineQueryResult): id=self.id, type=self.type, title=self.title, - description=self.description, thumb=thumb, content=animation, send_message=(