From c2250836281289cb1b8639ab1766fb04906eeca9 Mon Sep 17 00:00:00 2001 From: shriMADhav U k Date: Wed, 26 Feb 2025 11:11:35 +0100 Subject: [PATCH 01/17] Fix missing client argument in ChosenInlineResult Co-authored-by: anonymousx97 --- pyrogram/types/inline_mode/chosen_inline_result.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pyrogram/types/inline_mode/chosen_inline_result.py b/pyrogram/types/inline_mode/chosen_inline_result.py index 367039e3e7..15e678586c 100644 --- a/pyrogram/types/inline_mode/chosen_inline_result.py +++ b/pyrogram/types/inline_mode/chosen_inline_result.py @@ -28,8 +28,9 @@ class ChosenInlineResult(Object, Update): .. note:: - In order to receive these updates, your bot must have "inline feedback" enabled. You can enable this feature - with `@BotFather `_. + In order to receive these updates: + 1) your bot must have "inline feedback" enabled. You can enable this feature with `@BotFather `_. + 2) the :obj:`~pyrogram.types.InlineQueryResult` that you answer should have a ``reply_markup`` button.s Parameters: result_id (``str``): @@ -83,5 +84,6 @@ def _parse(client, chosen_inline_result: raw.types.UpdateBotInlineSend, users) - latitude=chosen_inline_result.geo.lat, client=client ) if chosen_inline_result.geo else None, - inline_message_id=inline_message_id + inline_message_id=inline_message_id, + client=client ) From eb714812937d1f773e2d7dba36e5371bdb34ec13 Mon Sep 17 00:00:00 2001 From: shriMADhav U k Date: Wed, 26 Feb 2025 11:13:16 +0100 Subject: [PATCH 02/17] typo. --- pyrogram/types/inline_mode/chosen_inline_result.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/pyrogram/types/inline_mode/chosen_inline_result.py b/pyrogram/types/inline_mode/chosen_inline_result.py index 15e678586c..1b797867db 100644 --- a/pyrogram/types/inline_mode/chosen_inline_result.py +++ b/pyrogram/types/inline_mode/chosen_inline_result.py @@ -28,9 +28,7 @@ class ChosenInlineResult(Object, Update): .. note:: - In order to receive these updates: - 1) your bot must have "inline feedback" enabled. You can enable this feature with `@BotFather `_. - 2) the :obj:`~pyrogram.types.InlineQueryResult` that you answer should have a ``reply_markup`` button.s + In order to receive these updates, your bot must have "inline feedback" enabled. You can enable this feature with `@BotFather `_. Parameters: result_id (``str``): From 468c33273e3d87532e6a79e013cbd2e6ef915ae4 Mon Sep 17 00:00:00 2001 From: shriMADhav U k Date: Wed, 26 Feb 2025 11:15:04 +0100 Subject: [PATCH 03/17] typo --- pyrogram/types/inline_mode/chosen_inline_result.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pyrogram/types/inline_mode/chosen_inline_result.py b/pyrogram/types/inline_mode/chosen_inline_result.py index 1b797867db..c51657d28e 100644 --- a/pyrogram/types/inline_mode/chosen_inline_result.py +++ b/pyrogram/types/inline_mode/chosen_inline_result.py @@ -28,7 +28,8 @@ class ChosenInlineResult(Object, Update): .. note:: - In order to receive these updates, your bot must have "inline feedback" enabled. You can enable this feature with `@BotFather `_. + In order to receive these updates, your bot must have "inline feedback" enabled. + You can enable this feature with `@BotFather `_. Parameters: result_id (``str``): From 4cc610046c2c41aa0bd505882823b1395f7f1b6c Mon Sep 17 00:00:00 2001 From: shriMADhav U k Date: Wed, 26 Feb 2025 11:38:53 +0100 Subject: [PATCH 04/17] 1/n renaming --- .../inline_query_result_animation.py | 51 +++++++++++++++---- 1 file changed, 41 insertions(+), 10 deletions(-) diff --git a/pyrogram/types/inline_mode/inline_query_result_animation.py b/pyrogram/types/inline_mode/inline_query_result_animation.py index a51c571494..16eed7e54e 100644 --- a/pyrogram/types/inline_mode/inline_query_result_animation.py +++ b/pyrogram/types/inline_mode/inline_query_result_animation.py @@ -16,12 +16,15 @@ # You should have received a copy of the GNU Lesser General Public License # along with Pyrogram. If not, see . +import logging from typing import Optional import pyrogram from pyrogram import raw, types, utils, enums from .inline_query_result import InlineQueryResult +log = logging.getLogger(__name__) + class InlineQueryResultAnimation(InlineQueryResult): """Link to an animated GIF file. @@ -44,11 +47,11 @@ class InlineQueryResultAnimation(InlineQueryResult): animation_duration (``int``, *optional*) Duration of the animation in seconds. - thumb_url (``str``, *optional*): + thumbnail_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*) + thumbnail_mime_type (``str``, *optional*) MIME type of the thumbnail, must be one of "image/jpeg", "image/gif", or "video/mp4". Defaults to "image/jpeg". @@ -85,8 +88,8 @@ def __init__( animation_width: int = 0, animation_height: int = 0, animation_duration: int = 0, - thumb_url: str = None, - thumb_mime_type: str = "image/jpeg", + thumbnail_url: str = None, + thumbnail_mime_type: str = "image/jpeg", id: str = None, title: str = None, description: str = None, @@ -95,16 +98,44 @@ def __init__( caption_entities: list["types.MessageEntity"] = None, show_caption_above_media: bool = None, reply_markup: "types.InlineKeyboardMarkup" = None, - input_message_content: "types.InputMessageContent" = None + input_message_content: "types.InputMessageContent" = None, + thumb_url: str = None, + thumb_mime_type: str = None, ): + if thumb_url and thumbnail_url: + raise ValueError( + "Parameters `thumb_url` and `thumbnail_url` are mutually " + "exclusive." + ) + + if thumb_url is not None: + log.warning( + "This property is deprecated. " + "Please use thumbnail_url instead" + ) + thumbnail_url = thumb_url + + if thumb_mime_type and thumbnail_mime_type: + raise ValueError( + "Parameters `thumb_mime_type` and `thumbnail_mime_type` are mutually " + "exclusive." + ) + + if thumb_mime_type is not None: + log.warning( + "This property is deprecated. " + "Please use thumbnail_mime_type instead" + ) + thumbnail_mime_type = thumb_mime_type + 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.thumbnail_url = thumbnail_url + self.thumbnail_mime_type = thumbnail_mime_type self.title = title self.description = description self.caption = caption @@ -128,13 +159,13 @@ async def write(self, client: "pyrogram.Client"): ] ) - if self.thumb_url is None: + if self.thumbnail_url is None: thumb = animation else: thumb = raw.types.InputWebDocument( - url=self.thumb_url, + url=self.thumbnail_url, size=0, - mime_type=self.thumb_mime_type, + mime_type=self.thumbnail_mime_type, attributes=[] ) From b4e4235bcf7db0b4e8abbaaba06368235804646d Mon Sep 17 00:00:00 2001 From: Shrimadhav U K Date: Wed, 26 Feb 2025 18:32:32 +0530 Subject: [PATCH 05/17] 3 --- .../inline_query_result_article.py | 70 +++++++++++++++---- .../inline_query_result_contact.py | 4 ++ .../inline_query_result_document.py | 3 + .../inline_query_result_location.py | 4 ++ .../inline_mode/inline_query_result_photo.py | 3 + .../inline_mode/inline_query_result_venue.py | 4 ++ .../inline_mode/inline_query_result_video.py | 3 + 7 files changed, 79 insertions(+), 12 deletions(-) diff --git a/pyrogram/types/inline_mode/inline_query_result_article.py b/pyrogram/types/inline_mode/inline_query_result_article.py index 096273f15b..5fadb14e70 100644 --- a/pyrogram/types/inline_mode/inline_query_result_article.py +++ b/pyrogram/types/inline_mode/inline_query_result_article.py @@ -16,12 +16,16 @@ # You should have received a copy of the GNU Lesser General Public License # along with Pyrogram. If not, see . +import logging + import pyrogram from pyrogram import raw from pyrogram import types from .inline_query_result import InlineQueryResult +log = logging.getLogger(__name__) + class InlineQueryResultArticle(InlineQueryResult): """Link to an article or web page. @@ -46,13 +50,13 @@ class InlineQueryResultArticle(InlineQueryResult): reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup`, *optional*): Inline keyboard attached to the message. - thumb_url (``str``, *optional*): + thumbnail_url (``str``, *optional*): Url of the thumbnail for the result. - thumb_width (``int``, *optional*): + thumbnail_width (``int``, *optional*): Thumbnail width. - thumb_height (``int``, *optional*): + thumbnail_height (``int``, *optional*): Thumbnail height """ @@ -64,18 +68,60 @@ def __init__( url: str = None, description: str = None, reply_markup: "types.InlineKeyboardMarkup" = None, + thumbnail_url: str = None, + thumbnail_width: int = 0, + thumbnail_height: int = 0, thumb_url: str = None, - thumb_width: int = 0, - thumb_height: int = 0 + thumb_width: int = None, + thumb_height: int = None ): + if thumb_url and thumbnail_url: + raise ValueError( + "Parameters `thumb_url` and `thumbnail_url` are mutually " + "exclusive." + ) + + if thumb_url is not None: + log.warning( + "This property is deprecated. " + "Please use thumbnail_url instead" + ) + thumbnail_url = thumb_url + + if thumb_width and thumbnail_width: + raise ValueError( + "Parameters `thumb_width` and `thumbnail_width` are mutually " + "exclusive." + ) + + if thumb_width is not None: + log.warning( + "This property is deprecated. " + "Please use thumbnail_width instead" + ) + thumbnail_width = thumb_width + + if thumb_height and thumbnail_height: + raise ValueError( + "Parameters `thumb_height` and `thumbnail_height` are mutually " + "exclusive." + ) + + if thumb_height is not None: + log.warning( + "This property is deprecated. " + "Please use thumbnail_height instead" + ) + thumbnail_height = thumb_height + super().__init__("article", id, input_message_content, reply_markup) self.title = title self.url = url self.description = description - self.thumb_url = thumb_url - self.thumb_width = thumb_width - self.thumb_height = thumb_height + self.thumbnail_url = thumbnail_url + self.thumbnail_width = thumbnail_width + self.thumbnail_height = thumbnail_height async def write(self, client: "pyrogram.Client"): return raw.types.InputBotInlineResult( @@ -86,14 +132,14 @@ async def write(self, client: "pyrogram.Client"): description=self.description, url=self.url, thumb=raw.types.InputWebDocument( - url=self.thumb_url, + url=self.thumbnail_url, size=0, mime_type="image/jpeg", attributes=[ raw.types.DocumentAttributeImageSize( - w=self.thumb_width, - h=self.thumb_height + w=self.thumbnail_width, + h=self.thumbnail_height ) ] - ) if self.thumb_url else None + ) if self.thumbnail_url else None ) diff --git a/pyrogram/types/inline_mode/inline_query_result_contact.py b/pyrogram/types/inline_mode/inline_query_result_contact.py index d55a624450..632be4bbba 100644 --- a/pyrogram/types/inline_mode/inline_query_result_contact.py +++ b/pyrogram/types/inline_mode/inline_query_result_contact.py @@ -16,10 +16,14 @@ # You should have received a copy of the GNU Lesser General Public License # along with Pyrogram. If not, see . +import logging + import pyrogram from pyrogram import raw, types from .inline_query_result import InlineQueryResult +log = logging.getLogger(__name__) + class InlineQueryResultContact(InlineQueryResult): """Contact with a phone number diff --git a/pyrogram/types/inline_mode/inline_query_result_document.py b/pyrogram/types/inline_mode/inline_query_result_document.py index eac7901b14..46ccdef495 100644 --- a/pyrogram/types/inline_mode/inline_query_result_document.py +++ b/pyrogram/types/inline_mode/inline_query_result_document.py @@ -16,12 +16,15 @@ # You should have received a copy of the GNU Lesser General Public License # along with Pyrogram. If not, see . +import logging from typing import Optional, List import pyrogram from pyrogram import raw, types, utils, enums from .inline_query_result import InlineQueryResult +log = logging.getLogger(__name__) + class InlineQueryResultDocument(InlineQueryResult): """Link to a file. diff --git a/pyrogram/types/inline_mode/inline_query_result_location.py b/pyrogram/types/inline_mode/inline_query_result_location.py index 236f39a624..5e4cce86d8 100644 --- a/pyrogram/types/inline_mode/inline_query_result_location.py +++ b/pyrogram/types/inline_mode/inline_query_result_location.py @@ -16,10 +16,14 @@ # You should have received a copy of the GNU Lesser General Public License # along with Pyrogram. If not, see . +import logging + import pyrogram from pyrogram import raw, types from .inline_query_result import InlineQueryResult +log = logging.getLogger(__name__) + class InlineQueryResultLocation(InlineQueryResult): """A location on a map. diff --git a/pyrogram/types/inline_mode/inline_query_result_photo.py b/pyrogram/types/inline_mode/inline_query_result_photo.py index 2ccc7a1c35..fabe872fb3 100644 --- a/pyrogram/types/inline_mode/inline_query_result_photo.py +++ b/pyrogram/types/inline_mode/inline_query_result_photo.py @@ -16,12 +16,15 @@ # You should have received a copy of the GNU Lesser General Public License # along with Pyrogram. If not, see . +import logging from typing import Optional import pyrogram from pyrogram import raw, types, utils, enums from .inline_query_result import InlineQueryResult +log = logging.getLogger(__name__) + class InlineQueryResultPhoto(InlineQueryResult): """Link to a photo. diff --git a/pyrogram/types/inline_mode/inline_query_result_venue.py b/pyrogram/types/inline_mode/inline_query_result_venue.py index b3b513a55d..a317cb480a 100644 --- a/pyrogram/types/inline_mode/inline_query_result_venue.py +++ b/pyrogram/types/inline_mode/inline_query_result_venue.py @@ -16,10 +16,14 @@ # You should have received a copy of the GNU Lesser General Public License # along with Pyrogram. If not, see . +import logging + import pyrogram from pyrogram import raw, types from .inline_query_result import InlineQueryResult +log = logging.getLogger(__name__) + class InlineQueryResultVenue(InlineQueryResult): """A venue. diff --git a/pyrogram/types/inline_mode/inline_query_result_video.py b/pyrogram/types/inline_mode/inline_query_result_video.py index 7db59d37f1..90538f980d 100644 --- a/pyrogram/types/inline_mode/inline_query_result_video.py +++ b/pyrogram/types/inline_mode/inline_query_result_video.py @@ -16,12 +16,15 @@ # You should have received a copy of the GNU Lesser General Public License # along with Pyrogram. If not, see . +import logging from typing import Optional import pyrogram from pyrogram import raw, types, utils, enums from .inline_query_result import InlineQueryResult +log = logging.getLogger(__name__) + class InlineQueryResultVideo(InlineQueryResult): """Link to a page containing an embedded video player or a video file. From abb8ffedce366b4e75d604f5a16e38ede3bb8eb2 Mon Sep 17 00:00:00 2001 From: Shrimadhav U K Date: Wed, 26 Feb 2025 19:50:09 +0530 Subject: [PATCH 06/17] 4 --- .../types/inline_mode/inline_query_result.py | 8 +- .../inline_query_result_location.py | 73 ++++++++++++++++--- .../inline_mode/inline_query_result_venue.py | 73 ++++++++++++++++--- .../inline_mode/inline_query_result_video.py | 24 ++++-- .../inline_mode/inline_query_result_voice.py | 1 + 5 files changed, 153 insertions(+), 26 deletions(-) diff --git a/pyrogram/types/inline_mode/inline_query_result.py b/pyrogram/types/inline_mode/inline_query_result.py index 8548e023c7..b6a952b21c 100644 --- a/pyrogram/types/inline_mode/inline_query_result.py +++ b/pyrogram/types/inline_mode/inline_query_result.py @@ -24,7 +24,7 @@ class InlineQueryResult(Object): - """One result of an inline query. + """This object represents one result of an inline query. Telegram clients currently support results of the following 20 types: - :obj:`~pyrogram.types.InlineQueryResultCachedAudio` - :obj:`~pyrogram.types.InlineQueryResultCachedDocument` @@ -36,6 +36,7 @@ class InlineQueryResult(Object): - :obj:`~pyrogram.types.InlineQueryResultArticle` - :obj:`~pyrogram.types.InlineQueryResultAudio` - :obj:`~pyrogram.types.InlineQueryResultContact` + - :obj:`~pyrogram.types.InlineQueryResultDocument` - :obj:`~pyrogram.types.InlineQueryResultAnimation` - :obj:`~pyrogram.types.InlineQueryResultLocation` @@ -43,6 +44,11 @@ class InlineQueryResult(Object): - :obj:`~pyrogram.types.InlineQueryResultVenue` - :obj:`~pyrogram.types.InlineQueryResultVideo` - :obj:`~pyrogram.types.InlineQueryResultVoice` + + .. note:: + + All URLs passed in inline query results will be available to end users and therefore must be assumed to be **public**. + """ def __init__( diff --git a/pyrogram/types/inline_mode/inline_query_result_location.py b/pyrogram/types/inline_mode/inline_query_result_location.py index 5e4cce86d8..017d0ec112 100644 --- a/pyrogram/types/inline_mode/inline_query_result_location.py +++ b/pyrogram/types/inline_mode/inline_query_result_location.py @@ -65,13 +65,13 @@ class InlineQueryResultLocation(InlineQueryResult): input_message_content (:obj:`~pyrogram.types.InputMessageContent`): Content of the message to be sent instead of the file. - thumb_url (``str``, *optional*): + thumbnail_url (``str``, *optional*): Url of the thumbnail for the result. - thumb_width (``int``, *optional*): + thumbnail_width (``int``, *optional*): Thumbnail width. - thumb_height (``int``, *optional*): + thumbnail_height (``int``, *optional*): Thumbnail height. """ @@ -87,10 +87,52 @@ def __init__( id: str = None, reply_markup: "types.InlineKeyboardMarkup" = None, input_message_content: "types.InputMessageContent" = None, + thumbnail_url: str = None, + thumbnail_width: int = 0, + thumbnail_height: int = 0, thumb_url: str = None, - thumb_width: int = 0, - thumb_height: int = 0 + thumb_width: int = None, + thumb_height: int = None ): + if thumb_url and thumbnail_url: + raise ValueError( + "Parameters `thumb_url` and `thumbnail_url` are mutually " + "exclusive." + ) + + if thumb_url is not None: + log.warning( + "This property is deprecated. " + "Please use thumbnail_url instead" + ) + thumbnail_url = thumb_url + + if thumb_width and thumbnail_width: + raise ValueError( + "Parameters `thumb_width` and `thumbnail_width` are mutually " + "exclusive." + ) + + if thumb_width is not None: + log.warning( + "This property is deprecated. " + "Please use thumbnail_width instead" + ) + thumbnail_width = thumb_width + + if thumb_height and thumbnail_height: + raise ValueError( + "Parameters `thumb_height` and `thumbnail_height` are mutually " + "exclusive." + ) + + if thumb_height is not None: + log.warning( + "This property is deprecated. " + "Please use thumbnail_height instead" + ) + thumbnail_height = thumb_height + super().__init__("location", id, input_message_content, reply_markup) self.title = title @@ -100,9 +142,9 @@ def __init__( self.live_period = live_period self.heading = heading self.proximity_alert_radius = proximity_alert_radius - self.thumb_url = thumb_url - self.thumb_width = thumb_width - self.thumb_height = thumb_height + self.thumbnail_url = thumbnail_url + self.thumbnail_width = thumbnail_width + self.thumbnail_height = thumbnail_height async def write(self, client: "pyrogram.Client"): return raw.types.InputBotInlineResult( @@ -115,12 +157,23 @@ async def write(self, client: "pyrogram.Client"): else raw.types.InputBotInlineMessageMediaGeo( geo_point=raw.types.InputGeoPoint( lat=self.latitude, - long=self.longitude + long=self.longitude, ), heading=self.heading, period=self.live_period, proximity_notification_radius=self.proximity_alert_radius, reply_markup=await self.reply_markup.write(client) if self.reply_markup else None ) - ) + ), + thumb=raw.types.InputWebDocument( + url=self.thumbnail_url, + size=0, + mime_type="image/jpeg", + attributes=[ + raw.types.DocumentAttributeImageSize( + w=self.thumbnail_width, + h=self.thumbnail_height + ) + ] + ) if self.thumbnail_url else None ) diff --git a/pyrogram/types/inline_mode/inline_query_result_venue.py b/pyrogram/types/inline_mode/inline_query_result_venue.py index a317cb480a..e19d93504c 100644 --- a/pyrogram/types/inline_mode/inline_query_result_venue.py +++ b/pyrogram/types/inline_mode/inline_query_result_venue.py @@ -66,13 +66,13 @@ class InlineQueryResultVenue(InlineQueryResult): input_message_content (:obj:`~pyrogram.types.InputMessageContent`): Content of the message to be sent instead of the file. - thumb_url (``str``, *optional*): + thumbnail_url (``str``, *optional*): Url of the thumbnail for the result. - thumb_width (``int``, *optional*): + thumbnail_width (``int``, *optional*): Thumbnail width. - thumb_height (``int``, *optional*): + thumbnail_height (``int``, *optional*): Thumbnail height. """ @@ -89,10 +89,52 @@ def __init__( google_place_type: str = None, reply_markup: "types.InlineKeyboardMarkup" = None, input_message_content: "types.InputMessageContent" = None, + thumbnail_url: str = None, + thumbnail_width: int = 0, + thumbnail_height: int = 0, thumb_url: str = None, - thumb_width: int = 0, - thumb_height: int = 0 + thumb_width: int = None, + thumb_height: int = None ): + if thumb_url and thumbnail_url: + raise ValueError( + "Parameters `thumb_url` and `thumbnail_url` are mutually " + "exclusive." + ) + + if thumb_url is not None: + log.warning( + "This property is deprecated. " + "Please use thumbnail_url instead" + ) + thumbnail_url = thumb_url + + if thumb_width and thumbnail_width: + raise ValueError( + "Parameters `thumb_width` and `thumbnail_width` are mutually " + "exclusive." + ) + + if thumb_width is not None: + log.warning( + "This property is deprecated. " + "Please use thumbnail_width instead" + ) + thumbnail_width = thumb_width + + if thumb_height and thumbnail_height: + raise ValueError( + "Parameters `thumb_height` and `thumbnail_height` are mutually " + "exclusive." + ) + + if thumb_height is not None: + log.warning( + "This property is deprecated. " + "Please use thumbnail_height instead" + ) + thumbnail_height = thumb_height + super().__init__("venue", id, input_message_content, reply_markup) self.title = title @@ -103,9 +145,9 @@ def __init__( self.foursquare_type = foursquare_type self.google_place_id = google_place_id self.google_place_type = google_place_type - self.thumb_url = thumb_url - self.thumb_width = thumb_width - self.thumb_height = thumb_height + self.thumbnail_url = thumbnail_url + self.thumbnail_width = thumbnail_width + self.thumbnail_height = thumbnail_height async def write(self, client: "pyrogram.Client"): return raw.types.InputBotInlineResult( @@ -118,7 +160,7 @@ async def write(self, client: "pyrogram.Client"): else raw.types.InputBotInlineMessageMediaVenue( geo_point=raw.types.InputGeoPoint( lat=self.latitude, - long=self.longitude + long=self.longitude, ), title=self.title, address=self.address, @@ -131,5 +173,16 @@ async def write(self, client: "pyrogram.Client"): venue_type=self.foursquare_type or self.google_place_type or "", reply_markup=await self.reply_markup.write(client) if self.reply_markup else None ) - ) + ), + thumb=raw.types.InputWebDocument( + url=self.thumbnail_url, + size=0, + mime_type="image/jpeg", + attributes=[ + raw.types.DocumentAttributeImageSize( + w=self.thumbnail_width, + h=self.thumbnail_height + ) + ] + ) if self.thumbnail_url else None ) diff --git a/pyrogram/types/inline_mode/inline_query_result_video.py b/pyrogram/types/inline_mode/inline_query_result_video.py index 90538f980d..361e46806c 100644 --- a/pyrogram/types/inline_mode/inline_query_result_video.py +++ b/pyrogram/types/inline_mode/inline_query_result_video.py @@ -37,7 +37,7 @@ class InlineQueryResultVideo(InlineQueryResult): video_url (``str``): A valid URL for the embedded video player or video file. - thumb_url (``str``): + thumbnail_url (``str``): URL of the thumbnail (jpeg only) for the video. title (``str``): @@ -87,7 +87,7 @@ class InlineQueryResultVideo(InlineQueryResult): def __init__( self, video_url: str, - thumb_url: str, + thumbnail_url: str, title: str, id: str = None, mime_type: str = "video/mp4", @@ -100,12 +100,26 @@ def __init__( caption_entities: list["types.MessageEntity"] = None, show_caption_above_media: bool = None, reply_markup: "types.InlineKeyboardMarkup" = None, - input_message_content: "types.InputMessageContent" = None + input_message_content: "types.InputMessageContent" = None, + thumb_url: str = None, ): + if thumb_url and thumbnail_url: + raise ValueError( + "Parameters `thumb_url` and `thumbnail_url` are mutually " + "exclusive." + ) + + if thumb_url is not None: + log.warning( + "This property is deprecated. " + "Please use thumbnail_url instead" + ) + thumbnail_url = thumb_url + super().__init__("video", id, input_message_content, reply_markup) self.video_url = video_url - self.thumb_url = thumb_url + self.thumbnail_url = thumbnail_url self.title = title self.video_width = video_width self.video_height = video_height @@ -130,7 +144,7 @@ async def write(self, client: "pyrogram.Client"): ) thumb = raw.types.InputWebDocument( - url=self.thumb_url, + url=self.thumbnail_url, size=0, mime_type="image/jpeg", attributes=[] diff --git a/pyrogram/types/inline_mode/inline_query_result_voice.py b/pyrogram/types/inline_mode/inline_query_result_voice.py index 3d955a0e0b..751bccd3c7 100644 --- a/pyrogram/types/inline_mode/inline_query_result_voice.py +++ b/pyrogram/types/inline_mode/inline_query_result_voice.py @@ -59,6 +59,7 @@ class InlineQueryResultVoice(InlineQueryResult): input_message_content (:obj:`~pyrogram.types.InputMessageContent`, *optional*): Content of the message to be sent instead of the audio. + """ def __init__( From b87445b7392d3df0030a678c492526477bc9379f Mon Sep 17 00:00:00 2001 From: Shrimadhav U K Date: Wed, 26 Feb 2025 19:51:40 +0530 Subject: [PATCH 07/17] 2 --- pyrogram/types/inline_mode/inline_query_result_location.py | 1 + pyrogram/types/inline_mode/inline_query_result_venue.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/pyrogram/types/inline_mode/inline_query_result_location.py b/pyrogram/types/inline_mode/inline_query_result_location.py index 017d0ec112..a6a36ff423 100644 --- a/pyrogram/types/inline_mode/inline_query_result_location.py +++ b/pyrogram/types/inline_mode/inline_query_result_location.py @@ -158,6 +158,7 @@ async def write(self, client: "pyrogram.Client"): geo_point=raw.types.InputGeoPoint( lat=self.latitude, long=self.longitude, + accuracy_radius=self.horizontal_accuracy ), heading=self.heading, period=self.live_period, diff --git a/pyrogram/types/inline_mode/inline_query_result_venue.py b/pyrogram/types/inline_mode/inline_query_result_venue.py index e19d93504c..bf158a4780 100644 --- a/pyrogram/types/inline_mode/inline_query_result_venue.py +++ b/pyrogram/types/inline_mode/inline_query_result_venue.py @@ -160,7 +160,7 @@ async def write(self, client: "pyrogram.Client"): else raw.types.InputBotInlineMessageMediaVenue( geo_point=raw.types.InputGeoPoint( lat=self.latitude, - long=self.longitude, + long=self.longitude ), title=self.title, address=self.address, From 1f52312f458197daeb43346f8c14db5bb16ab2a4 Mon Sep 17 00:00:00 2001 From: Shrimadhav U K Date: Wed, 26 Feb 2025 20:00:40 +0530 Subject: [PATCH 08/17] 5 --- .../inline_query_result_contact.py | 68 +++++++++++++++---- .../inline_query_result_document.py | 68 +++++++++++++++---- .../inline_mode/inline_query_result_photo.py | 26 +++++-- 3 files changed, 130 insertions(+), 32 deletions(-) diff --git a/pyrogram/types/inline_mode/inline_query_result_contact.py b/pyrogram/types/inline_mode/inline_query_result_contact.py index 632be4bbba..552ac04b12 100644 --- a/pyrogram/types/inline_mode/inline_query_result_contact.py +++ b/pyrogram/types/inline_mode/inline_query_result_contact.py @@ -43,7 +43,7 @@ class InlineQueryResultContact(InlineQueryResult): Contact's last name. vcard (``str``, *optional*): - Additional data about the contact in the form of a `vCard `_. + Additional data about the contact in the form of a `vCard `_, 0-2048 bytes. id (``str``, *optional*): Unique identifier for this result, 1-64 bytes. @@ -55,13 +55,13 @@ class InlineQueryResultContact(InlineQueryResult): input_message_content (:obj:`~pyrogram.types.InputMessageContent`, *optional*): Content of the message to be sent instead of the contact. - thumb_url (``str``, *optional*): + thumbnail_url (``str``, *optional*): Url of the thumbnail for the result. - thumb_width (``int``, *optional*): + thumbnail_width (``int``, *optional*): Thumbnail width. - thumb_height (``int``, *optional*): + thumbnail_height (``int``, *optional*): Thumbnail height. """ @@ -74,19 +74,61 @@ def __init__( id: str = None, reply_markup: "types.InlineKeyboardMarkup" = None, input_message_content: "types.InputMessageContent" = None, + thumbnail_url: str = None, + thumbnail_width: int = 0, + thumbnail_height: int = 0, thumb_url: str = None, - thumb_width: int = 0, - thumb_height: int = 0 + thumb_width: int = None, + thumb_height: int = None ): + if thumb_url and thumbnail_url: + raise ValueError( + "Parameters `thumb_url` and `thumbnail_url` are mutually " + "exclusive." + ) + + if thumb_url is not None: + log.warning( + "This property is deprecated. " + "Please use thumbnail_url instead" + ) + thumbnail_url = thumb_url + + if thumb_width and thumbnail_width: + raise ValueError( + "Parameters `thumb_width` and `thumbnail_width` are mutually " + "exclusive." + ) + + if thumb_width is not None: + log.warning( + "This property is deprecated. " + "Please use thumbnail_width instead" + ) + thumbnail_width = thumb_width + + if thumb_height and thumbnail_height: + raise ValueError( + "Parameters `thumb_height` and `thumbnail_height` are mutually " + "exclusive." + ) + + if thumb_height is not None: + log.warning( + "This property is deprecated. " + "Please use thumbnail_height instead" + ) + thumbnail_height = thumb_height + super().__init__("contact", id, input_message_content, reply_markup) self.phone_number = phone_number self.first_name = first_name self.last_name = last_name self.vcard = vcard - self.thumb_url = thumb_url - self.thumb_width = thumb_width - self.thumb_height = thumb_height + self.thumbnail_url = thumbnail_url + self.thumbnail_width = thumbnail_width + self.thumbnail_height = thumbnail_height async def write(self, client: "pyrogram.Client"): return raw.types.InputBotInlineResult( @@ -105,14 +147,14 @@ async def write(self, client: "pyrogram.Client"): ) ), thumb=raw.types.InputWebDocument( - url=self.thumb_url, + url=self.thumbnail_url, size=0, mime_type="image/jpg", attributes=[ raw.types.DocumentAttributeImageSize( - w=self.thumb_width, - h=self.thumb_height + w=self.thumbnail_width, + h=self.thumbnail_height ) ] - ) if self.thumb_url else None + ) if self.thumbnail_url else None ) diff --git a/pyrogram/types/inline_mode/inline_query_result_document.py b/pyrogram/types/inline_mode/inline_query_result_document.py index 46ccdef495..60a81ea412 100644 --- a/pyrogram/types/inline_mode/inline_query_result_document.py +++ b/pyrogram/types/inline_mode/inline_query_result_document.py @@ -66,13 +66,13 @@ class InlineQueryResultDocument(InlineQueryResult): input_message_content (:obj:`~pyrogram.types.InputMessageContent`): Content of the message to be sent instead of the file. - thumb_url (``str``, *optional*): - Url of the thumbnail for the result. + thumbnail_url (``str``, *optional*): + URL of the thumbnail (JPEG only) for the file. - thumb_width (``int``, *optional*): + thumbnail_width (``int``, *optional*): Thumbnail width. - thumb_height (``int``, *optional*): + thumbnail_height (``int``, *optional*): Thumbnail height. """ @@ -88,10 +88,52 @@ def __init__( description: str = "", reply_markup: "types.InlineKeyboardMarkup" = None, input_message_content: "types.InputMessageContent" = None, + thumbnail_url: str = None, + thumbnail_width: int = 0, + thumbnail_height: int = 0, thumb_url: str = None, - thumb_width: int = 0, - thumb_height: int = 0 + thumb_width: int = None, + thumb_height: int = None ): + if thumb_url and thumbnail_url: + raise ValueError( + "Parameters `thumb_url` and `thumbnail_url` are mutually " + "exclusive." + ) + + if thumb_url is not None: + log.warning( + "This property is deprecated. " + "Please use thumbnail_url instead" + ) + thumbnail_url = thumb_url + + if thumb_width and thumbnail_width: + raise ValueError( + "Parameters `thumb_width` and `thumbnail_width` are mutually " + "exclusive." + ) + + if thumb_width is not None: + log.warning( + "This property is deprecated. " + "Please use thumbnail_width instead" + ) + thumbnail_width = thumb_width + + if thumb_height and thumbnail_height: + raise ValueError( + "Parameters `thumb_height` and `thumbnail_height` are mutually " + "exclusive." + ) + + if thumb_height is not None: + log.warning( + "This property is deprecated. " + "Please use thumbnail_height instead" + ) + thumbnail_height = thumb_height + super().__init__("file", id, input_message_content, reply_markup) self.document_url = document_url @@ -101,9 +143,9 @@ def __init__( self.parse_mode = parse_mode self.caption_entities = caption_entities self.description = description - self.thumb_url = thumb_url - self.thumb_width = thumb_width - self.thumb_height = thumb_height + self.thumbnail_url = thumbnail_url + self.thumbnail_width = thumbnail_width + self.thumbnail_height = thumbnail_height async def write(self, client: "pyrogram.Client"): document = raw.types.InputWebDocument( @@ -114,16 +156,16 @@ async def write(self, client: "pyrogram.Client"): ) thumb = raw.types.InputWebDocument( - url=self.thumb_url, + url=self.thumbnail_url, size=0, mime_type="image/jpeg", attributes=[ raw.types.DocumentAttributeImageSize( - w=self.thumb_width, - h=self.thumb_height + w=self.thumbnail_width, + h=self.thumbnail_height ) ] - ) if self.thumb_url else None + ) if self.thumbnail_url else None message, entities = (await utils.parse_text_entities( client, self.caption, self.parse_mode, self.caption_entities diff --git a/pyrogram/types/inline_mode/inline_query_result_photo.py b/pyrogram/types/inline_mode/inline_query_result_photo.py index fabe872fb3..7b5a8d9b6d 100644 --- a/pyrogram/types/inline_mode/inline_query_result_photo.py +++ b/pyrogram/types/inline_mode/inline_query_result_photo.py @@ -38,7 +38,7 @@ class InlineQueryResultPhoto(InlineQueryResult): A valid URL of the photo. Photo must be in jpeg format an must not exceed 5 MB. - thumb_url (``str``, *optional*): + thumbnail_url (``str``, *optional*): URL of the thumbnail for the photo. Defaults to the value passed in *photo_url*. @@ -81,7 +81,7 @@ class InlineQueryResultPhoto(InlineQueryResult): def __init__( self, photo_url: str, - thumb_url: str = None, + thumbnail_url: str = None, photo_width: int = 0, photo_height: int = 0, id: str = None, @@ -92,12 +92,26 @@ def __init__( caption_entities: list["types.MessageEntity"] = None, show_caption_above_media: bool = None, reply_markup: "types.InlineKeyboardMarkup" = None, - input_message_content: "types.InputMessageContent" = None + input_message_content: "types.InputMessageContent" = None, + thumb_url: str = None ): + if thumb_url and thumbnail_url: + raise ValueError( + "Parameters `thumb_url` and `thumbnail_url` are mutually " + "exclusive." + ) + + if thumb_url is not None: + log.warning( + "This property is deprecated. " + "Please use thumbnail_url instead" + ) + thumbnail_url = thumb_url + super().__init__("photo", id, input_message_content, reply_markup) self.photo_url = photo_url - self.thumb_url = thumb_url + self.thumbnail_url = thumbnail_url self.photo_width = photo_width self.photo_height = photo_height self.title = title @@ -122,11 +136,11 @@ async def write(self, client: "pyrogram.Client"): ] ) - if self.thumb_url is None: + if self.thumbnail_url is None: thumb = photo else: thumb = raw.types.InputWebDocument( - url=self.thumb_url, + url=self.thumbnail_url, size=0, mime_type="image/jpeg", attributes=[] From 65c826b93ee7cc960c62a81652051b848b321fd3 Mon Sep 17 00:00:00 2001 From: Shrimadhav U K Date: Wed, 26 Feb 2025 21:31:54 +0530 Subject: [PATCH 09/17] (feat): copy CallbackQuery bound methods to ChosenInlineResult https://t.me/c/1220993104/1382620/1387814 Co-authored-by: anonymousx97 --- .../types/inline_mode/chosen_inline_result.py | 147 ++++++++++++++++++ 1 file changed, 147 insertions(+) diff --git a/pyrogram/types/inline_mode/chosen_inline_result.py b/pyrogram/types/inline_mode/chosen_inline_result.py index c51657d28e..bfe2171e4b 100644 --- a/pyrogram/types/inline_mode/chosen_inline_result.py +++ b/pyrogram/types/inline_mode/chosen_inline_result.py @@ -86,3 +86,150 @@ def _parse(client, chosen_inline_result: raw.types.UpdateBotInlineSend, users) - inline_message_id=inline_message_id, client=client ) + + async def edit_message_text( + self, + text: str, + parse_mode: Optional["enums.ParseMode"] = None, + entities: list["types.MessageEntity"] = None, + link_preview_options: "types.LinkPreviewOptions" = None, + reply_markup: "types.InlineKeyboardMarkup" = None + ) -> bool: + """Edit the text of messages attached to sent :obj:`~pyrogram.types.InlineQueryResult` messages. + + Bound method *edit_message_text* of :obj:`~pyrogram.types.ChosenInlineResult`. + + Parameters: + text (``str``): + New text of the message. + + parse_mode (:obj:`~pyrogram.enums.ParseMode`, *optional*): + By default, texts are parsed using both Markdown and HTML styles. + You can combine both syntaxes together. + + entities (List of :obj:`~pyrogram.types.MessageEntity`): + List of special entities that appear in message text, which can be specified instead of *parse_mode*. + + link_preview_options (:obj:`~pyrogram.types.LinkPreviewOptions`, *optional*): + Link preview generation options for the message + + reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup`, *optional*): + An InlineKeyboardMarkup object. + + Returns: + ``bool``: On success, True is returned. + + Raises: + RPCError: In case of a Telegram RPC error. + """ + if self.inline_message_id is None: + raise ValueError("Identifier of the inline message is required to edit the message") + else: + return await self._client.edit_inline_text( + inline_message_id=self.inline_message_id, + text=text, + parse_mode=parse_mode, + entities=entities, + link_preview_options=link_preview_options, + reply_markup=reply_markup + ) + + async def edit_message_caption( + self, + caption: str, + parse_mode: Optional["enums.ParseMode"] = None, + caption_entities: list["types.MessageEntity"] = None, + reply_markup: "types.InlineKeyboardMarkup" = None + ) -> bool: + """Edit the caption of media messages attached to sent :obj:`~pyrogram.types.InlineQueryResult` messages. + + Bound method *edit_message_caption* of :obj:`~pyrogram.types.ChosenInlineResult`. + + Parameters: + caption (``str``): + New caption of the message. + + parse_mode (:obj:`~pyrogram.enums.ParseMode`, *optional*): + By default, texts are parsed using both Markdown and HTML styles. + You can combine both syntaxes together. + + caption_entities (List of :obj:`~pyrogram.types.MessageEntity`): + List of special entities that appear in message text, which can be specified instead of *parse_mode*. + + reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup`, *optional*): + An InlineKeyboardMarkup object. + + Returns: + ``bool``: On success, True is returned. + + Raises: + RPCError: In case of a Telegram RPC error. + """ + return await self.edit_message_text( + text=caption, + parse_mode=parse_mode, + entities=caption_entities, + reply_markup=reply_markup + ) + + async def edit_message_media( + self, + media: "types.InputMedia", + reply_markup: "types.InlineKeyboardMarkup" = None, + file_name: str = None + ) -> bool: + """Edit animation, audio, document, photo or video messages attached to sent :obj:`~pyrogram.types.InlineQueryResult` messages. + + Bound method *edit_message_media* of :obj:`~pyrogram.types.ChosenInlineResult`. + + Parameters: + media (:obj:`~pyrogram.types.InputMedia`): + One of the InputMedia objects describing an animation, audio, document, photo or video. + + reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup`, *optional*): + An InlineKeyboardMarkup object. + + file_name (``str``, *optional*): + File name of the media to be sent. Not applicable to photos. + Defaults to file's path basename. + + Returns: + ``bool``: On success, True is returned. + + Raises: + RPCError: In case of a Telegram RPC error. + """ + if self.inline_message_id is None: + raise ValueError("Identifier of the inline message is required to edit the message") + else: + return await self._client.edit_inline_media( + inline_message_id=self.inline_message_id, + media=media, + reply_markup=reply_markup + ) + + async def edit_message_reply_markup( + self, + reply_markup: "types.InlineKeyboardMarkup" = None + ) -> bool: + """Edit only the reply markup of messages attached to sent :obj:`~pyrogram.types.InlineQueryResult` messages. + + Bound method *edit_message_reply_markup* of :obj:`~pyrogram.types.ChosenInlineResult`. + + Parameters: + reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup`): + An InlineKeyboardMarkup object. + + Returns: + ``bool``: On success, True is returned. + + Raises: + RPCError: In case of a Telegram RPC error. + """ + if self.inline_message_id is None: + raise ValueError("Identifier of the inline message is required to edit the message") + else: + return await self._client.edit_inline_reply_markup( + inline_message_id=self.inline_message_id, + reply_markup=reply_markup + ) From 104ddddb288ed0ef03d1c413ec96097a9723dc47 Mon Sep 17 00:00:00 2001 From: Shrimadhav U K Date: Wed, 26 Feb 2025 22:09:53 +0530 Subject: [PATCH 10/17] update documentation --- .../types/inline_mode/inline_query_result.py | 2 +- .../inline_query_result_animation.py | 14 +++++-- .../inline_query_result_article.py | 2 +- .../inline_mode/inline_query_result_audio.py | 38 ++++++++++++++++--- .../inline_query_result_cached_sticker.py | 25 +++++++++++- .../inline_query_result_contact.py | 2 +- .../inline_query_result_document.py | 1 + .../inline_query_result_location.py | 3 +- .../inline_mode/inline_query_result_photo.py | 3 +- .../inline_mode/inline_query_result_venue.py | 4 +- .../inline_mode/inline_query_result_video.py | 8 +++- .../inline_mode/inline_query_result_voice.py | 32 ++++++++++++++-- 12 files changed, 111 insertions(+), 23 deletions(-) diff --git a/pyrogram/types/inline_mode/inline_query_result.py b/pyrogram/types/inline_mode/inline_query_result.py index b6a952b21c..7429847bb7 100644 --- a/pyrogram/types/inline_mode/inline_query_result.py +++ b/pyrogram/types/inline_mode/inline_query_result.py @@ -47,7 +47,7 @@ class InlineQueryResult(Object): .. note:: - All URLs passed in inline query results will be available to end users and therefore must be assumed to be **public**. + All URLs passed in inline query results will be available to end users and therefore must be assumed to be *public*. """ diff --git a/pyrogram/types/inline_mode/inline_query_result_animation.py b/pyrogram/types/inline_mode/inline_query_result_animation.py index 16eed7e54e..3c0a168c6b 100644 --- a/pyrogram/types/inline_mode/inline_query_result_animation.py +++ b/pyrogram/types/inline_mode/inline_query_result_animation.py @@ -38,13 +38,16 @@ class InlineQueryResultAnimation(InlineQueryResult): A valid URL for the animated GIF file. File size must not exceed 1 MB. - animation_width (``int``, *optional*) + animation_mime_type (``str``, *optional*): + MIME type of the video file. Must be one of "image/gif" and "video/mp4" + + animation_width (``int``, *optional*): Width of the animation. - animation_height (``int``, *optional*) + animation_height (``int``, *optional*): Height of the animation. - animation_duration (``int``, *optional*) + animation_duration (``int``, *optional*): Duration of the animation in seconds. thumbnail_url (``str``, *optional*): @@ -80,11 +83,13 @@ class InlineQueryResultAnimation(InlineQueryResult): input_message_content (:obj:`~pyrogram.types.InputMessageContent`): Content of the message to be sent instead of the photo. + """ def __init__( self, animation_url: str, + animation_mime_type: str = "image/gif", animation_width: int = 0, animation_height: int = 0, animation_duration: int = 0, @@ -131,6 +136,7 @@ def __init__( super().__init__("gif", id, input_message_content, reply_markup) self.animation_url = animation_url + self.animation_mime_type = animation_mime_type self.animation_width = animation_width self.animation_height = animation_height self.animation_duration = animation_duration @@ -149,7 +155,7 @@ async def write(self, client: "pyrogram.Client"): animation = raw.types.InputWebDocument( url=self.animation_url, size=0, - mime_type="image/gif", + mime_type=self.animation_mime_type, attributes=[ raw.types.DocumentAttributeVideo( w=self.animation_width, diff --git a/pyrogram/types/inline_mode/inline_query_result_article.py b/pyrogram/types/inline_mode/inline_query_result_article.py index 5fadb14e70..fd6faaca14 100644 --- a/pyrogram/types/inline_mode/inline_query_result_article.py +++ b/pyrogram/types/inline_mode/inline_query_result_article.py @@ -57,7 +57,7 @@ class InlineQueryResultArticle(InlineQueryResult): Thumbnail width. thumbnail_height (``int``, *optional*): - Thumbnail height + Thumbnail height. """ def __init__( diff --git a/pyrogram/types/inline_mode/inline_query_result_audio.py b/pyrogram/types/inline_mode/inline_query_result_audio.py index b53c8d027b..30c1313043 100644 --- a/pyrogram/types/inline_mode/inline_query_result_audio.py +++ b/pyrogram/types/inline_mode/inline_query_result_audio.py @@ -24,18 +24,17 @@ class InlineQueryResultAudio(InlineQueryResult): - """Link to an audio file. + """Link to an MP3 audio file. By default, this audio file will be sent by the user with optional caption. - Alternatively, you can use *input_message_content* to send a message with the specified content instead of the - audio. + Alternatively, you can use *input_message_content* to send a message with the specified content instead of the audio. Parameters: audio_url (``str``): A valid URL for the audio file. title (``str``): - Title for the result. + Audio title. id (``str``, *optional*): Unique identifier for this result, 1-64 bytes. @@ -62,6 +61,16 @@ class InlineQueryResultAudio(InlineQueryResult): input_message_content (:obj:`~pyrogram.types.InputMessageContent`, *optional*): Content of the message to be sent instead of the audio. + + thumbnail_url (``str``, *optional*): + Url of the thumbnail for the result. + + thumbnail_width (``int``, *optional*): + Thumbnail width. + + thumbnail_height (``int``, *optional*): + Thumbnail height. + """ def __init__( @@ -75,7 +84,10 @@ def __init__( parse_mode: Optional["enums.ParseMode"] = None, caption_entities: list["types.MessageEntity"] = None, reply_markup: "types.InlineKeyboardMarkup" = None, - input_message_content: "types.InputMessageContent" = None + input_message_content: "types.InputMessageContent" = None, + thumbnail_url: str = None, + thumbnail_width: int = 0, + thumbnail_height: int = 0 ): super().__init__("audio", id, input_message_content, reply_markup) @@ -86,6 +98,9 @@ def __init__( self.caption = caption self.parse_mode = parse_mode self.caption_entities = caption_entities + self.thumbnail_url = thumbnail_url + self.thumbnail_width = thumbnail_width + self.thumbnail_height = thumbnail_height async def write(self, client: "pyrogram.Client"): audio = raw.types.InputWebDocument( @@ -116,5 +131,16 @@ async def write(self, client: "pyrogram.Client"): message=message, entities=entities ) - ) + ), + thumb=raw.types.InputWebDocument( + url=self.thumbnail_url, + size=0, + mime_type="image/jpeg", + attributes=[ + raw.types.DocumentAttributeImageSize( + w=self.thumbnail_width, + h=self.thumbnail_height + ) + ] + ) if self.thumbnail_url else None ) diff --git a/pyrogram/types/inline_mode/inline_query_result_cached_sticker.py b/pyrogram/types/inline_mode/inline_query_result_cached_sticker.py index 06d012fbe6..46e046ad84 100644 --- a/pyrogram/types/inline_mode/inline_query_result_cached_sticker.py +++ b/pyrogram/types/inline_mode/inline_query_result_cached_sticker.py @@ -17,7 +17,7 @@ # along with Pyrogram. If not, see . import pyrogram -from pyrogram import raw, types +from pyrogram import enums, raw, types from .inline_query_result import InlineQueryResult from ...file_id import FileId @@ -36,6 +36,16 @@ class InlineQueryResultCachedSticker(InlineQueryResult): Unique identifier for this result, 1-64 bytes. Defaults to a randomly generated UUID4. + caption (``str``, *optional*): + Caption of the audio to be sent, 0-1024 characters. + + parse_mode (:obj:`~pyrogram.enums.ParseMode`, *optional*): + By default, texts are parsed using both Markdown and HTML styles. + You can combine both syntaxes together. + + caption_entities (List of :obj:`~pyrogram.types.MessageEntity`): + List of special entities that appear in the caption, which can be specified instead of *parse_mode*. + reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup`, *optional*): An InlineKeyboardMarkup object. @@ -47,18 +57,28 @@ def __init__( self, sticker_file_id: str, id: str = None, + caption: str = "", + parse_mode: Optional["enums.ParseMode"] = None, + caption_entities: list["types.MessageEntity"] = None, reply_markup: "types.InlineKeyboardMarkup" = None, input_message_content: "types.InputMessageContent" = None ): super().__init__("sticker", id, input_message_content, reply_markup) self.sticker_file_id = sticker_file_id + self.caption = caption + self.parse_mode = parse_mode + self.caption_entities = caption_entities self.reply_markup = reply_markup self.input_message_content = input_message_content async def write(self, client: "pyrogram.Client"): file_id = FileId.decode(self.sticker_file_id) + message, entities = (await utils.parse_text_entities( + client, self.caption, self.parse_mode, self.caption_entities + )).values() + return raw.types.InputBotInlineResultDocument( id=self.id, type=self.type, @@ -72,7 +92,8 @@ async def write(self, client: "pyrogram.Client"): if self.input_message_content else raw.types.InputBotInlineMessageMediaAuto( reply_markup=await self.reply_markup.write(client) if self.reply_markup else None, - message="", + message=message, + entities=entities ) ) ) diff --git a/pyrogram/types/inline_mode/inline_query_result_contact.py b/pyrogram/types/inline_mode/inline_query_result_contact.py index 552ac04b12..63c1bf3e39 100644 --- a/pyrogram/types/inline_mode/inline_query_result_contact.py +++ b/pyrogram/types/inline_mode/inline_query_result_contact.py @@ -26,7 +26,7 @@ class InlineQueryResultContact(InlineQueryResult): - """Contact with a phone number + """Contact with a phone number. By default, this contact will be sent by the user. Alternatively, you can use *input_message_content* to send a message with the specified content instead of the diff --git a/pyrogram/types/inline_mode/inline_query_result_document.py b/pyrogram/types/inline_mode/inline_query_result_document.py index 60a81ea412..7905c63d9c 100644 --- a/pyrogram/types/inline_mode/inline_query_result_document.py +++ b/pyrogram/types/inline_mode/inline_query_result_document.py @@ -31,6 +31,7 @@ class InlineQueryResultDocument(InlineQueryResult): By default, this file will be sent by the user with an optional caption. Alternatively, you can use *input_message_content* to send a message with the specified content instead of the file. + Currently, only **.PDF** and **.ZIP** files can be sent using this method. Parameters: document_url (``str``): diff --git a/pyrogram/types/inline_mode/inline_query_result_location.py b/pyrogram/types/inline_mode/inline_query_result_location.py index a6a36ff423..4bbe32f536 100644 --- a/pyrogram/types/inline_mode/inline_query_result_location.py +++ b/pyrogram/types/inline_mode/inline_query_result_location.py @@ -49,7 +49,8 @@ class InlineQueryResultLocation(InlineQueryResult): The radius of uncertainty for the location, measured in meters; 0-1500. live_period (``int``, *optional*): - Period in seconds for which the location can be updated, should be between 60 and 86400. + Period in seconds during which the location can be updated, should be between 60 and 86400, + or 0x7FFFFFFF for live locations that can be edited indefinitely. heading (``int``, *optional*): For live locations, a direction in which the user is moving, in degrees. diff --git a/pyrogram/types/inline_mode/inline_query_result_photo.py b/pyrogram/types/inline_mode/inline_query_result_photo.py index 7b5a8d9b6d..5699f9858a 100644 --- a/pyrogram/types/inline_mode/inline_query_result_photo.py +++ b/pyrogram/types/inline_mode/inline_query_result_photo.py @@ -36,7 +36,8 @@ class InlineQueryResultPhoto(InlineQueryResult): Parameters: photo_url (``str``): A valid URL of the photo. - Photo must be in jpeg format an must not exceed 5 MB. + Photo must be in *JPEG* format. + Photo size must not exceed 5MB. thumbnail_url (``str``, *optional*): URL of the thumbnail for the photo. diff --git a/pyrogram/types/inline_mode/inline_query_result_venue.py b/pyrogram/types/inline_mode/inline_query_result_venue.py index bf158a4780..1418d68f57 100644 --- a/pyrogram/types/inline_mode/inline_query_result_venue.py +++ b/pyrogram/types/inline_mode/inline_query_result_venue.py @@ -52,13 +52,13 @@ class InlineQueryResultVenue(InlineQueryResult): Foursquare identifier of the venue if known. foursquare_type (``str``, *optional*): - Foursquare type of the venue, if known. + Foursquare type of the venue, if known. (For example, “arts_entertainment/default”, “arts_entertainment/aquarium” or “food/icecream”.) google_place_id (``str``, *optional*): Google Places identifier of the venue. google_place_type (``str``, *optional*): - Google Places type of the venue. + Google Places type of the venue. (See `supported types `_.) reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup`, *optional*): Inline keyboard attached to the message. diff --git a/pyrogram/types/inline_mode/inline_query_result_video.py b/pyrogram/types/inline_mode/inline_query_result_video.py index 361e46806c..a17ff21cbe 100644 --- a/pyrogram/types/inline_mode/inline_query_result_video.py +++ b/pyrogram/types/inline_mode/inline_query_result_video.py @@ -33,12 +33,18 @@ class InlineQueryResultVideo(InlineQueryResult): Alternatively, you can use *input_message_content* to send a message with the specified content instead of the video. + .. note:: + + If an InlineQueryResultVideo message contains an embedded video (e.g., YouTube), + you must replace its content using *input_message_content*. + + Parameters: video_url (``str``): A valid URL for the embedded video player or video file. thumbnail_url (``str``): - URL of the thumbnail (jpeg only) for the video. + URL of the thumbnail (JPEG only) for the video. title (``str``): Title for the result. diff --git a/pyrogram/types/inline_mode/inline_query_result_voice.py b/pyrogram/types/inline_mode/inline_query_result_voice.py index 751bccd3c7..03ca01c7fd 100644 --- a/pyrogram/types/inline_mode/inline_query_result_voice.py +++ b/pyrogram/types/inline_mode/inline_query_result_voice.py @@ -35,7 +35,7 @@ class InlineQueryResultVoice(InlineQueryResult): A valid URL for the voice recording. title (``str``): - Title for the result. + Recording title. id (``str``, *optional*): Unique identifier for this result, 1-64 bytes. @@ -59,6 +59,15 @@ class InlineQueryResultVoice(InlineQueryResult): input_message_content (:obj:`~pyrogram.types.InputMessageContent`, *optional*): Content of the message to be sent instead of the audio. + + thumbnail_url (``str``, *optional*): + Url of the thumbnail for the result. + + thumbnail_width (``int``, *optional*): + Thumbnail width. + + thumbnail_height (``int``, *optional*): + Thumbnail height. """ @@ -72,7 +81,10 @@ def __init__( parse_mode: Optional["enums.ParseMode"] = None, caption_entities: list["types.MessageEntity"] = None, reply_markup: "types.InlineKeyboardMarkup" = None, - input_message_content: "types.InputMessageContent" = None + input_message_content: "types.InputMessageContent" = None, + thumbnail_url: str = None, + thumbnail_width: int = 0, + thumbnail_height: int = 0 ): super().__init__("voice", id, input_message_content, reply_markup) @@ -82,6 +94,9 @@ def __init__( self.caption = caption self.parse_mode = parse_mode self.caption_entities = caption_entities + self.thumbnail_url = thumbnail_url + self.thumbnail_width = thumbnail_width + self.thumbnail_height = thumbnail_height async def write(self, client: "pyrogram.Client"): audio = raw.types.InputWebDocument( @@ -111,5 +126,16 @@ async def write(self, client: "pyrogram.Client"): message=message, entities=entities ) - ) + ), + thumb=raw.types.InputWebDocument( + url=self.thumbnail_url, + size=0, + mime_type="image/jpeg", + attributes=[ + raw.types.DocumentAttributeImageSize( + w=self.thumbnail_width, + h=self.thumbnail_height + ) + ] + ) if self.thumbnail_url else None ) From 3a6f8442de184791095d01829713070d74277d9c Mon Sep 17 00:00:00 2001 From: Shrimadhav U K Date: Thu, 27 Feb 2025 14:28:36 +0530 Subject: [PATCH 11/17] documentation --- compiler/docs/compiler.py | 4 ++++ docs/source/releases/changes-in-this-fork.rst | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/compiler/docs/compiler.py b/compiler/docs/compiler.py index a9ae31b25f..acc15b8d1c 100644 --- a/compiler/docs/compiler.py +++ b/compiler/docs/compiler.py @@ -795,6 +795,10 @@ def get_title_list(s: str) -> list: CallbackQuery.edit_message_caption CallbackQuery.edit_message_media CallbackQuery.edit_message_reply_markup + ChosenInlineResult.edit_message_text + ChosenInlineResult.edit_message_caption + ChosenInlineResult.edit_message_media + ChosenInlineResult.edit_message_reply_markup """, inline_query=""" InlineQuery diff --git a/docs/source/releases/changes-in-this-fork.rst b/docs/source/releases/changes-in-this-fork.rst index f259aaa21f..d4479d2413 100644 --- a/docs/source/releases/changes-in-this-fork.rst +++ b/docs/source/releases/changes-in-this-fork.rst @@ -29,6 +29,11 @@ Changes in this Fork | Scheme layer used: 199 | +------------------------+ +- Added the bound methods :meth:`~pyrogram.types.ChosenInlineResult.edit_message_text`, :meth:`~pyrogram.types.ChosenInlineResult.edit_message_caption`, :meth:`~pyrogram.types.ChosenInlineResult.edit_message_media` and :meth:`~pyrogram.types.ChosenInlineResult.edit_message_reply_markup`. +- Renamed the fields ``thumb_url``, ``thumb_width``, and ``thumb_height`` in the classes :obj:`~pyrogram.types.InlineQueryResultArticle`, :obj:`~pyrogram.types.InlineQueryResultContact`, :obj:`~pyrogram.types.InlineQueryResultDocument`, :obj:`~pyrogram.types.InlineQueryResultLocation`, and :obj:`~pyrogram.types.InlineQueryResultVenue` to ``thumbnail_url``, ``thumbnail_width``, and ``thumbnail_height`` respectively. +- Renamed the field ``thumb_url`` in the classes :obj:`~pyrogram.types.InlineQueryResultPhoto` and :obj:`~pyrogram.types.InlineQueryResultVideo` to ``thumbnail_url``. +- Renamed the fields ``thumb_url`` and ``thumb_mime_type`` in the classes :obj:`~pyrogram.types.InlineQueryResultAnimation` to ``thumbnail_url`` and ``thumbnail_mime_type`` respectively. +- Fixed a bug with ``_client`` being None in :obj:`~pyrogram.handlers.ChosenInlineResultHandler`. - Added the parameters ``video_cover`` and ``video_start_timestamp`` to the method :meth:`~pyrogram.Client.copy_message`, allowing bots to change the start timestamp for copied videos. - Added ``for_paid_reactions`` in :meth:`~pyrogram.Client.get_send_as_chats`. - `Updated documentation and parameter names according to BOT API 8.3 `__ From ad476a7f6dc37fe5f71a6dead35c8a3efd955218 Mon Sep 17 00:00:00 2001 From: Shrimadhav U K Date: Thu, 27 Feb 2025 21:19:45 +0530 Subject: [PATCH 12/17] typo --- pyrogram/types/inline_mode/chosen_inline_result.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pyrogram/types/inline_mode/chosen_inline_result.py b/pyrogram/types/inline_mode/chosen_inline_result.py index bfe2171e4b..a3c7a4e27c 100644 --- a/pyrogram/types/inline_mode/chosen_inline_result.py +++ b/pyrogram/types/inline_mode/chosen_inline_result.py @@ -16,6 +16,7 @@ # You should have received a copy of the GNU Lesser General Public License # along with Pyrogram. If not, see . +from typing import Optional import pyrogram from pyrogram import raw, types, utils From a5eec402a77e93ee5c2671cbb6b44b8e162801d3 Mon Sep 17 00:00:00 2001 From: Shrimadhav U K Date: Thu, 27 Feb 2025 21:21:03 +0530 Subject: [PATCH 13/17] typo --- .../types/inline_mode/inline_query_result_cached_sticker.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pyrogram/types/inline_mode/inline_query_result_cached_sticker.py b/pyrogram/types/inline_mode/inline_query_result_cached_sticker.py index 46e046ad84..084d7e126f 100644 --- a/pyrogram/types/inline_mode/inline_query_result_cached_sticker.py +++ b/pyrogram/types/inline_mode/inline_query_result_cached_sticker.py @@ -16,6 +16,8 @@ # You should have received a copy of the GNU Lesser General Public License # along with Pyrogram. If not, see . +from typing import Optional + import pyrogram from pyrogram import enums, raw, types from .inline_query_result import InlineQueryResult From 60b730f44485443996e9876720d3afb2e67acb17 Mon Sep 17 00:00:00 2001 From: Shrimadhav U K Date: Fri, 28 Feb 2025 09:15:18 +0530 Subject: [PATCH 14/17] Add InlineQueryResultGame --- compiler/docs/compiler.py | 1 + docs/source/releases/changes-in-this-fork.rst | 1 + pyrogram/types/inline_mode/__init__.py | 2 + .../types/inline_mode/inline_query_result.py | 2 +- .../inline_mode/inline_query_result_game.py | 62 +++++++++++++++++++ 5 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 pyrogram/types/inline_mode/inline_query_result_game.py diff --git a/compiler/docs/compiler.py b/compiler/docs/compiler.py index acc15b8d1c..fee159e0b0 100644 --- a/compiler/docs/compiler.py +++ b/compiler/docs/compiler.py @@ -624,6 +624,7 @@ def get_title_list(s: str) -> list: InlineQueryResultVoice InlineQueryResultArticle InlineQueryResultContact + InlineQueryResultGame InlineQueryResultLocation InlineQueryResultVenue """, diff --git a/docs/source/releases/changes-in-this-fork.rst b/docs/source/releases/changes-in-this-fork.rst index d4479d2413..ec8c2c4afc 100644 --- a/docs/source/releases/changes-in-this-fork.rst +++ b/docs/source/releases/changes-in-this-fork.rst @@ -29,6 +29,7 @@ Changes in this Fork | Scheme layer used: 199 | +------------------------+ +- Added the class :obj:`~pyrogram.types.InlineQueryResultGame`. - Added the bound methods :meth:`~pyrogram.types.ChosenInlineResult.edit_message_text`, :meth:`~pyrogram.types.ChosenInlineResult.edit_message_caption`, :meth:`~pyrogram.types.ChosenInlineResult.edit_message_media` and :meth:`~pyrogram.types.ChosenInlineResult.edit_message_reply_markup`. - Renamed the fields ``thumb_url``, ``thumb_width``, and ``thumb_height`` in the classes :obj:`~pyrogram.types.InlineQueryResultArticle`, :obj:`~pyrogram.types.InlineQueryResultContact`, :obj:`~pyrogram.types.InlineQueryResultDocument`, :obj:`~pyrogram.types.InlineQueryResultLocation`, and :obj:`~pyrogram.types.InlineQueryResultVenue` to ``thumbnail_url``, ``thumbnail_width``, and ``thumbnail_height`` respectively. - Renamed the field ``thumb_url`` in the classes :obj:`~pyrogram.types.InlineQueryResultPhoto` and :obj:`~pyrogram.types.InlineQueryResultVideo` to ``thumbnail_url``. diff --git a/pyrogram/types/inline_mode/__init__.py b/pyrogram/types/inline_mode/__init__.py index 53e883ce9c..4c43876e06 100644 --- a/pyrogram/types/inline_mode/__init__.py +++ b/pyrogram/types/inline_mode/__init__.py @@ -29,6 +29,7 @@ from .inline_query_result_cached_video import InlineQueryResultCachedVideo from .inline_query_result_cached_voice import InlineQueryResultCachedVoice from .inline_query_result_contact import InlineQueryResultContact +from .inline_query_result_game import InlineQueryResultGame from .inline_query_result_document import InlineQueryResultDocument from .inline_query_result_location import InlineQueryResultLocation from .inline_query_result_photo import InlineQueryResultPhoto @@ -56,6 +57,7 @@ "InlineQueryResultVoice", "InlineQueryResultArticle", "InlineQueryResultContact", + "InlineQueryResultGame", "InlineQueryResultLocation", "InlineQueryResultVenue", ] diff --git a/pyrogram/types/inline_mode/inline_query_result.py b/pyrogram/types/inline_mode/inline_query_result.py index 7429847bb7..35a2c5cd48 100644 --- a/pyrogram/types/inline_mode/inline_query_result.py +++ b/pyrogram/types/inline_mode/inline_query_result.py @@ -36,7 +36,7 @@ class InlineQueryResult(Object): - :obj:`~pyrogram.types.InlineQueryResultArticle` - :obj:`~pyrogram.types.InlineQueryResultAudio` - :obj:`~pyrogram.types.InlineQueryResultContact` - + - :obj:`~pyrogram.types.InlineQueryResultGame` - :obj:`~pyrogram.types.InlineQueryResultDocument` - :obj:`~pyrogram.types.InlineQueryResultAnimation` - :obj:`~pyrogram.types.InlineQueryResultLocation` diff --git a/pyrogram/types/inline_mode/inline_query_result_game.py b/pyrogram/types/inline_mode/inline_query_result_game.py new file mode 100644 index 0000000000..e5de782b4b --- /dev/null +++ b/pyrogram/types/inline_mode/inline_query_result_game.py @@ -0,0 +1,62 @@ +# Pyrogram - Telegram MTProto API Client Library for Python +# Copyright (C) 2017-present +# +# This file is part of Pyrogram. +# +# Pyrogram is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as published +# by the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Pyrogram is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with Pyrogram. If not, see . + +import logging + +import pyrogram +from pyrogram import raw, types +from .inline_query_result import InlineQueryResult + +log = logging.getLogger(__name__) + + +class InlineQueryResultGame(InlineQueryResult): + """Represents a :obj:`~pyrogram.types.Game`. + + Parameters: + game_short_name (``str``): + Short name of the game. + + id (``str``, *optional*): + Unique identifier for this result, 1-64 bytes. + Defaults to a randomly generated UUID4. + + reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup`, *optional*): + Inline keyboard attached to the message. + + """ + + def __init__( + self, + game_short_name: str, + id: str = None, + reply_markup: "types.InlineKeyboardMarkup" = None + ): + super().__init__("game", id, None, reply_markup) + + self.game_short_name = game_short_name + + async def write(self, client: "pyrogram.Client"): + return raw.types.InputBotInlineResultGame( + id=self.id, + short_name=self.game_short_name, + title=self.first_name, + send_message=raw.types.InputBotInlineMessageGame( + reply_markup=await self.reply_markup.write(client) if self.reply_markup else None, + ) + ) From 8f1735e39715a5a9d29ecf77b0a25cab81d820f6 Mon Sep 17 00:00:00 2001 From: Shrimadhav U K Date: Sat, 1 Mar 2025 09:02:02 +0530 Subject: [PATCH 15/17] improve typing --- pyrogram/types/bots_and_keyboards/callback_query.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/pyrogram/types/bots_and_keyboards/callback_query.py b/pyrogram/types/bots_and_keyboards/callback_query.py index 796750e77d..f040487656 100644 --- a/pyrogram/types/bots_and_keyboards/callback_query.py +++ b/pyrogram/types/bots_and_keyboards/callback_query.py @@ -89,7 +89,16 @@ def __init__( self.matches = matches @staticmethod - async def _parse(client: "pyrogram.Client", callback_query, users, chats) -> "CallbackQuery": + async def _parse( + client: "pyrogram.Client", + callback_query: Union[ + "raw.types.UpdateBotCallbackQuery", + "raw.types.UpdateInlineBotCallbackQuery", + "raw.types.UpdateBusinessBotCallbackQuery", + ], + users: dict, + chats: dict, + ) -> "CallbackQuery": message = None inline_message_id = None From 411f1db3a105c8006f6f485a73152c8fd1f27eca Mon Sep 17 00:00:00 2001 From: Shrimadhav U K Date: Sat, 1 Mar 2025 09:05:56 +0530 Subject: [PATCH 16/17] Follow-Up: 372429a --- docs/source/releases/changes-in-this-fork.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/source/releases/changes-in-this-fork.rst b/docs/source/releases/changes-in-this-fork.rst index ec8c2c4afc..2bcebe4367 100644 --- a/docs/source/releases/changes-in-this-fork.rst +++ b/docs/source/releases/changes-in-this-fork.rst @@ -1,4 +1,7 @@ +Changes in this Fork +===================== + .. admonition :: A Word of Warning :class: tip From 81b2decbd08eadec4c8e1ef5c535bbe7f66e3b1b Mon Sep 17 00:00:00 2001 From: Shrimadhav U K Date: Sat, 1 Mar 2025 09:22:45 +0530 Subject: [PATCH 17/17] fixes --- docs/source/releases/changes-in-this-fork.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/releases/changes-in-this-fork.rst b/docs/source/releases/changes-in-this-fork.rst index 2bcebe4367..51973d8012 100644 --- a/docs/source/releases/changes-in-this-fork.rst +++ b/docs/source/releases/changes-in-this-fork.rst @@ -36,7 +36,7 @@ Changes in this Fork - Added the bound methods :meth:`~pyrogram.types.ChosenInlineResult.edit_message_text`, :meth:`~pyrogram.types.ChosenInlineResult.edit_message_caption`, :meth:`~pyrogram.types.ChosenInlineResult.edit_message_media` and :meth:`~pyrogram.types.ChosenInlineResult.edit_message_reply_markup`. - Renamed the fields ``thumb_url``, ``thumb_width``, and ``thumb_height`` in the classes :obj:`~pyrogram.types.InlineQueryResultArticle`, :obj:`~pyrogram.types.InlineQueryResultContact`, :obj:`~pyrogram.types.InlineQueryResultDocument`, :obj:`~pyrogram.types.InlineQueryResultLocation`, and :obj:`~pyrogram.types.InlineQueryResultVenue` to ``thumbnail_url``, ``thumbnail_width``, and ``thumbnail_height`` respectively. - Renamed the field ``thumb_url`` in the classes :obj:`~pyrogram.types.InlineQueryResultPhoto` and :obj:`~pyrogram.types.InlineQueryResultVideo` to ``thumbnail_url``. -- Renamed the fields ``thumb_url`` and ``thumb_mime_type`` in the classes :obj:`~pyrogram.types.InlineQueryResultAnimation` to ``thumbnail_url`` and ``thumbnail_mime_type`` respectively. +- Added the field ``animation_mime_type`` and renamed the fields ``thumb_url`` and ``thumb_mime_type`` in the classes :obj:`~pyrogram.types.InlineQueryResultAnimation` to ``thumbnail_url`` and ``thumbnail_mime_type`` respectively. - Fixed a bug with ``_client`` being None in :obj:`~pyrogram.handlers.ChosenInlineResultHandler`. - Added the parameters ``video_cover`` and ``video_start_timestamp`` to the method :meth:`~pyrogram.Client.copy_message`, allowing bots to change the start timestamp for copied videos. - Added ``for_paid_reactions`` in :meth:`~pyrogram.Client.get_send_as_chats`.