mirror of
https://github.com/pyrogram/pyrogram
synced 2025-08-28 04:48:06 +00:00
Add missing fields to InlineQueryResultAnimation
This commit is contained in:
parent
5108b78ef5
commit
4367dbc465
@ -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=(
|
||||
|
Loading…
x
Reference in New Issue
Block a user