2
0
mirror of https://github.com/pyrogram/pyrogram synced 2025-08-28 21:07:59 +00:00

Add missing fields to InlineQueryResultAnimation

This commit is contained in:
Dan 2022-04-24 11:56:07 +02:00
parent 5108b78ef5
commit 4367dbc465

View File

@ -35,10 +35,23 @@ class InlineQueryResultAnimation(InlineQueryResult):
A valid URL for the animated GIF file. A valid URL for the animated GIF file.
File size must not exceed 1 MB. 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*): thumb_url (``str``, *optional*):
URL of the static thumbnail for the result (jpeg or gif) URL of the static thumbnail for the result (jpeg or gif)
Defaults to the value passed in *animation_url*. 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*): id (``str``, *optional*):
Unique identifier for this result, 1-64 bytes. Unique identifier for this result, 1-64 bytes.
Defaults to a randomly generated UUID4. Defaults to a randomly generated UUID4.
@ -46,11 +59,8 @@ class InlineQueryResultAnimation(InlineQueryResult):
title (``str``, *optional*): title (``str``, *optional*):
Title for the result. Title for the result.
description (``str``, *optional*):
Short description of the result.
caption (``str``, *optional*): 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*): parse_mode (:obj:`~pyrogram.enums.ParseMode`, *optional*):
By default, texts are parsed using both Markdown and HTML styles. By default, texts are parsed using both Markdown and HTML styles.
@ -69,7 +79,11 @@ class InlineQueryResultAnimation(InlineQueryResult):
def __init__( def __init__(
self, self,
animation_url: str, animation_url: str,
animation_width: int = 0,
animation_height: int = 0,
animation_duration: int = 0,
thumb_url: str = None, thumb_url: str = None,
thumb_mime_type: str = "image/jpeg",
id: str = None, id: str = None,
title: str = None, title: str = None,
description: str = None, description: str = None,
@ -82,7 +96,11 @@ class InlineQueryResultAnimation(InlineQueryResult):
super().__init__("gif", id, input_message_content, reply_markup) super().__init__("gif", id, input_message_content, reply_markup)
self.animation_url = animation_url 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_url = thumb_url
self.thumb_mime_type = thumb_mime_type
self.title = title self.title = title
self.description = description self.description = description
self.caption = caption self.caption = caption
@ -96,7 +114,13 @@ class InlineQueryResultAnimation(InlineQueryResult):
url=self.animation_url, url=self.animation_url,
size=0, size=0,
mime_type="image/gif", 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: if self.thumb_url is None:
@ -105,7 +129,7 @@ class InlineQueryResultAnimation(InlineQueryResult):
thumb = raw.types.InputWebDocument( thumb = raw.types.InputWebDocument(
url=self.thumb_url, url=self.thumb_url,
size=0, size=0,
mime_type="image/gif", mime_type=self.thumb_mime_type,
attributes=[] attributes=[]
) )
@ -117,7 +141,6 @@ class InlineQueryResultAnimation(InlineQueryResult):
id=self.id, id=self.id,
type=self.type, type=self.type,
title=self.title, title=self.title,
description=self.description,
thumb=thumb, thumb=thumb,
content=animation, content=animation,
send_message=( send_message=(