diff --git a/pyrogram/client/types/bots/__init__.py b/pyrogram/client/types/bots/__init__.py index bf85e354..6f350a21 100644 --- a/pyrogram/client/types/bots/__init__.py +++ b/pyrogram/client/types/bots/__init__.py @@ -21,6 +21,7 @@ from .force_reply import ForceReply from .inline_keyboard_button import InlineKeyboardButton from .inline_keyboard_markup import InlineKeyboardMarkup from .inline_query import InlineQuery +from .inline_query_result_article import InlineQueryResultArticle from .inline_query_result_audio import InlineQueryResultAudio from .inline_query_result_cached_audio import InlineQueryResultCachedAudio from .inline_query_result_cached_document import InlineQueryResultCachedDocument diff --git a/pyrogram/client/types/bots/inline_query_result_article.py b/pyrogram/client/types/bots/inline_query_result_article.py new file mode 100644 index 00000000..d27f4236 --- /dev/null +++ b/pyrogram/client/types/bots/inline_query_result_article.py @@ -0,0 +1,104 @@ +# Pyrogram - Telegram MTProto API Client Library for Python +# Copyright (C) 2017-2018 Dan Tès +# +# 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 . + +from pyrogram.api import types +from pyrogram.api.core import Object + + +class InlineQueryResultArticle(Object): + """Represents a link to an article or web page. + + Args: + id (``str``): + Unique identifier for this result, 1-64 bytes. + + title (``str``): + Title for the result. + + input_message_content (``TODO``): + Content of the message to be sent. + + reply_markup (:obj:`InlineKeyboardMarkup `, *optional*): + Inline keyboard attached to the message + + url (``str``, *optional*): + URL of the result + + hide_url (``bool``, *optional*): + Pass True, if you don't want the URL to be shown in the message + + description (``str``, optional): + Short description of the result + + thumb_url (``str``, optional): + Url of the thumbnail for the result + + thumb_width (``int``, *optional*): + Thumbnail width. + + thumb_height (``int``, *optional*): + Thumbnail height. + + """ + ID = 0xb0700033 + + def __init__( + self, + id: str, + title: str, + input_message_content, + reply_markup=None, + url: str = None, + hide_url: bool = None, + description: str = None, + thumb_url: str = "", + thumb_width: int = 0, + thumb_height: int = 0 + ): + self.id = id # string + self.title = title # string + self.input_message_content = input_message_content # flags.4?InputMessageContent + self.reply_markup = reply_markup # flags.3?InlineKeyboardMarkup + self.url = url + self.hide_url = hide_url + self.description = description # flags.2?string + self.thumb_url = thumb_url # flags.5?string + self.thumb_width = thumb_width # flags.6?int + self.thumb_height = thumb_height # flags.7?int + + def write(self): + return types.InputBotInlineResult( + id=self.id, + type="article", + send_message=self.input_message_content.write(self.reply_markup), + title=self.title, + description=self.description, + url=self.url, + thumb=types.InputWebDocument( + url=self.thumb_url, + size=0, + mime_type="image/jpeg", + attributes=[ + types.DocumentAttributeImageSize( + w=self.thumb_width, + h=self.thumb_height + ) + ] + ) if self.thumb_url else None, + content=None + )