Skip to content

Commit

Permalink
Pyrofork: Add description and thumb to InlineQueryResultAudio #40
Browse files Browse the repository at this point in the history
Signed-off-by: wulan17 <wulan17@nusantararom.org>
  • Loading branch information
wulan17 committed Dec 26, 2023
1 parent 44415e7 commit c0779b5
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion pyrogram/types/inline_mode/inline_query_result_audio.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,18 @@ class InlineQueryResultAudio(InlineQueryResult):
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*.
description (``str``, *optional*):
Short description of the result.
reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup`, *optional*):
Inline keyboard attached to the message.
input_message_content (:obj:`~pyrogram.types.InputMessageContent`, *optional*):
Content of the message to be sent instead of the audio.
thumb_url (``str``, *optional*):
Url of the thumbnail for the result.
"""

def __init__(
Expand All @@ -74,8 +80,10 @@ def __init__(
caption: str = "",
parse_mode: Optional["enums.ParseMode"] = None,
caption_entities: List["types.MessageEntity"] = None,
description: str = 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)

Expand All @@ -86,6 +94,8 @@ def __init__(
self.caption = caption
self.parse_mode = parse_mode
self.caption_entities = caption_entities
self.description = description
self.thumb_url = thumb_url

async def write(self, client: "pyrogram.Client"):
audio = raw.types.InputWebDocument(
Expand All @@ -108,6 +118,13 @@ async def write(self, client: "pyrogram.Client"):
type=self.type,
title=self.title,
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=(
await self.input_message_content.write(client, self.reply_markup)
if self.input_message_content
Expand Down

1 comment on commit c0779b5

@5hojib
Copy link
Contributor

@5hojib 5hojib commented on c0779b5 Dec 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can I put thumb from audio?

Please sign in to comment.