diff --git a/pyrogram/types/inline_mode/__init__.py b/pyrogram/types/inline_mode/__init__.py index f7323abf95..0c0057639b 100644 --- a/pyrogram/types/inline_mode/__init__.py +++ b/pyrogram/types/inline_mode/__init__.py @@ -35,6 +35,7 @@ from .inline_query_result_venue import InlineQueryResultVenue from .inline_query_result_video import InlineQueryResultVideo from .inline_query_result_voice import InlineQueryResultVoice +from .inline_query_result_game import InlineQueryResultGame from .inline_query_result_cached_audio import InlineQueryResultCachedAudio __all__ = [ @@ -43,5 +44,5 @@ "InlineQueryResultContact", "InlineQueryResultDocument", "InlineQueryResultVoice", "InlineQueryResultLocation", "InlineQueryResultVenue", "InlineQueryResultCachedPhoto", "InlineQueryResultCachedAnimation", "InlineQueryResultCachedSticker", "InlineQueryResultCachedDocument", "InlineQueryResultCachedVideo", - "InlineQueryResultCachedVoice", "InlineQueryResultCachedAudio" + "InlineQueryResultCachedVoice", "InlineQueryResultCachedAudio", "InlineQueryResultGame" ] diff --git a/pyrogram/types/inline_mode/inline_query_result.py b/pyrogram/types/inline_mode/inline_query_result.py index 8548e023c7..15fb8d3a9e 100644 --- a/pyrogram/types/inline_mode/inline_query_result.py +++ b/pyrogram/types/inline_mode/inline_query_result.py @@ -43,6 +43,7 @@ class InlineQueryResult(Object): - :obj:`~pyrogram.types.InlineQueryResultVenue` - :obj:`~pyrogram.types.InlineQueryResultVideo` - :obj:`~pyrogram.types.InlineQueryResultVoice` + - :obj:`~pyrogram.types.InlineQueryResultGame` """ def __init__( 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..6e924c3817 --- /dev/null +++ b/pyrogram/types/inline_mode/inline_query_result_game.py @@ -0,0 +1,58 @@ +# Pyrogram - Telegram MTProto API Client Library for Python +# Copyright (C) 2017-present Dan +# +# 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 pyrogram +from pyrogram import raw, types +from .inline_query_result import InlineQueryResult + + +class InlineQueryResultGame(InlineQueryResult): + """A Game. + + Parameters: + short_name (``str``): + Game short name. + + 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, + short_name: str, + id: str = None, + reply_markup: "types.InlineKeyboardMarkup" = None, + ): + super().__init__("game", id, None, reply_markup) + + self.short_name = short_name + + async def write(self, client: "pyrogram.Client"): + return raw.types.InputBotInlineResultGame( + id=self.id, + short_name=self.short_name, + send_message=( + raw.types.InputBotInlineMessageGame( + reply_markup=await self.reply_markup.write(client) if self.reply_markup else None, + ) + ) + )