Pyrofork: Add description and thumb to InlineQueryResultAudio #40

Signed-off-by: wulan17 <wulan17@nusantararom.org>
This commit is contained in:
wulan17 2023-12-25 22:37:29 +07:00
parent 44415e7013
commit c0779b52ff
No known key found for this signature in database
GPG key ID: 318CD6CD3A6AC0A5

View file

@ -56,12 +56,18 @@ class InlineQueryResultAudio(InlineQueryResult):
caption_entities (List of :obj:`~pyrogram.types.MessageEntity`): 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*. List of special entities that appear in the caption, which can be specified instead of *parse_mode*.
description (``str``, *optional*):
Short description of the result.
reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup`, *optional*): reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup`, *optional*):
Inline keyboard attached to the message. Inline keyboard attached to the message.
input_message_content (:obj:`~pyrogram.types.InputMessageContent`, *optional*): input_message_content (:obj:`~pyrogram.types.InputMessageContent`, *optional*):
Content of the message to be sent instead of the audio. Content of the message to be sent instead of the audio.
thumb_url (``str``, *optional*):
Url of the thumbnail for the result.
""" """
def __init__( def __init__(
@ -74,8 +80,10 @@ class InlineQueryResultAudio(InlineQueryResult):
caption: str = "", caption: str = "",
parse_mode: Optional["enums.ParseMode"] = None, parse_mode: Optional["enums.ParseMode"] = None,
caption_entities: List["types.MessageEntity"] = None, caption_entities: List["types.MessageEntity"] = None,
description: str = None,
reply_markup: "types.InlineKeyboardMarkup" = None, reply_markup: "types.InlineKeyboardMarkup" = None,
input_message_content: "types.InputMessageContent" = None input_message_content: "types.InputMessageContent" = None,
thumb_url: str = None
): ):
super().__init__("audio", id, input_message_content, reply_markup) super().__init__("audio", id, input_message_content, reply_markup)
@ -86,6 +94,8 @@ class InlineQueryResultAudio(InlineQueryResult):
self.caption = caption self.caption = caption
self.parse_mode = parse_mode self.parse_mode = parse_mode
self.caption_entities = caption_entities self.caption_entities = caption_entities
self.description = description
self.thumb_url = thumb_url
async def write(self, client: "pyrogram.Client"): async def write(self, client: "pyrogram.Client"):
audio = raw.types.InputWebDocument( audio = raw.types.InputWebDocument(
@ -108,6 +118,13 @@ class InlineQueryResultAudio(InlineQueryResult):
type=self.type, type=self.type,
title=self.title, title=self.title,
content=audio, content=audio,
description=self.description,
thumb=raw.types.InputWebDocument(
url=self.thumb_url,
size=0,
mime_type="image/jpeg",
attributes=[]
) if self.thumb_url else None,
send_message=( send_message=(
await self.input_message_content.write(client, self.reply_markup) await self.input_message_content.write(client, self.reply_markup)
if self.input_message_content if self.input_message_content