Skip to content

Commit 4367dbc

Browse files
committed
Add missing fields to InlineQueryResultAnimation
1 parent 5108b78 commit 4367dbc

File tree

1 file changed

+30
-7
lines changed

1 file changed

+30
-7
lines changed

pyrogram/types/inline_mode/inline_query_result_animation.py

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,22 +35,32 @@ class InlineQueryResultAnimation(InlineQueryResult):
3535
A valid URL for the animated GIF file.
3636
File size must not exceed 1 MB.
3737
38+
animation_width (``int``, *optional*)
39+
Width of the animation.
40+
41+
animation_height (``int``, *optional*)
42+
Height of the animation.
43+
44+
animation_duration (``int``, *optional*)
45+
Duration of the animation in seconds.
46+
3847
thumb_url (``str``, *optional*):
3948
URL of the static thumbnail for the result (jpeg or gif)
4049
Defaults to the value passed in *animation_url*.
4150
51+
thumb_mime_type (``str``, *optional*)
52+
MIME type of the thumbnail, must be one of "image/jpeg", "image/gif", or "video/mp4".
53+
Defaults to "image/jpeg".
54+
4255
id (``str``, *optional*):
4356
Unique identifier for this result, 1-64 bytes.
4457
Defaults to a randomly generated UUID4.
4558
4659
title (``str``, *optional*):
4760
Title for the result.
4861
49-
description (``str``, *optional*):
50-
Short description of the result.
51-
5262
caption (``str``, *optional*):
53-
Caption of the photo to be sent, 0-1024 characters.
63+
Caption of the animation to be sent, 0-1024 characters.
5464
5565
parse_mode (:obj:`~pyrogram.enums.ParseMode`, *optional*):
5666
By default, texts are parsed using both Markdown and HTML styles.
@@ -69,7 +79,11 @@ class InlineQueryResultAnimation(InlineQueryResult):
6979
def __init__(
7080
self,
7181
animation_url: str,
82+
animation_width: int = 0,
83+
animation_height: int = 0,
84+
animation_duration: int = 0,
7285
thumb_url: str = None,
86+
thumb_mime_type: str = "image/jpeg",
7387
id: str = None,
7488
title: str = None,
7589
description: str = None,
@@ -82,7 +96,11 @@ def __init__(
8296
super().__init__("gif", id, input_message_content, reply_markup)
8397

8498
self.animation_url = animation_url
99+
self.animation_width = animation_width
100+
self.animation_height = animation_height
101+
self.animation_duration = animation_duration
85102
self.thumb_url = thumb_url
103+
self.thumb_mime_type = thumb_mime_type
86104
self.title = title
87105
self.description = description
88106
self.caption = caption
@@ -96,7 +114,13 @@ async def write(self, client: "pyrogram.Client"):
96114
url=self.animation_url,
97115
size=0,
98116
mime_type="image/gif",
99-
attributes=[]
117+
attributes=[
118+
raw.types.DocumentAttributeVideo(
119+
w=self.animation_width,
120+
h=self.animation_height,
121+
duration=self.animation_duration
122+
)
123+
]
100124
)
101125

102126
if self.thumb_url is None:
@@ -105,7 +129,7 @@ async def write(self, client: "pyrogram.Client"):
105129
thumb = raw.types.InputWebDocument(
106130
url=self.thumb_url,
107131
size=0,
108-
mime_type="image/gif",
132+
mime_type=self.thumb_mime_type,
109133
attributes=[]
110134
)
111135

@@ -117,7 +141,6 @@ async def write(self, client: "pyrogram.Client"):
117141
id=self.id,
118142
type=self.type,
119143
title=self.title,
120-
description=self.description,
121144
thumb=thumb,
122145
content=animation,
123146
send_message=(

0 commit comments

Comments
 (0)