Skip to content
This repository was archived by the owner on Dec 23, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion pyrogram/types/inline_mode/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__ = [
Expand All @@ -43,5 +44,5 @@
"InlineQueryResultContact", "InlineQueryResultDocument", "InlineQueryResultVoice", "InlineQueryResultLocation",
"InlineQueryResultVenue", "InlineQueryResultCachedPhoto", "InlineQueryResultCachedAnimation",
"InlineQueryResultCachedSticker", "InlineQueryResultCachedDocument", "InlineQueryResultCachedVideo",
"InlineQueryResultCachedVoice", "InlineQueryResultCachedAudio"
"InlineQueryResultCachedVoice", "InlineQueryResultCachedAudio", "InlineQueryResultGame"
]
1 change: 1 addition & 0 deletions pyrogram/types/inline_mode/inline_query_result.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__(
Expand Down
58 changes: 58 additions & 0 deletions pyrogram/types/inline_mode/inline_query_result_game.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Pyrogram - Telegram MTProto API Client Library for Python
# Copyright (C) 2017-present Dan <https://github.com/delivrance>
#
# 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 <http://www.gnu.org/licenses/>.

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,
)
)
)