X Tutup
Skip to content

Commit ae17eb3

Browse files
committed
Add InlineQueryResultGame
1 parent 358dd79 commit ae17eb3

File tree

2 files changed

+64
-20
lines changed

2 files changed

+64
-20
lines changed

telegram/__init__.py

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@
7373
from .inlinequeryresultvenue import InlineQueryResultVenue
7474
from .inlinequeryresultvideo import InlineQueryResultVideo
7575
from .inlinequeryresultvoice import InlineQueryResultVoice
76+
from .inlinequeryresultgame import InlineQueryResultGame
7677
from .inputtextmessagecontent import InputTextMessageContent
7778
from .inputlocationmessagecontent import InputLocationMessageContent
7879
from .inputvenuemessagecontent import InputVenueMessageContent
@@ -91,23 +92,24 @@
9192

9293
__author__ = 'devs@python-telegram-bot.org'
9394

94-
__all__ = ['Audio', 'Bot', 'Chat', 'ChatMember', 'ChatAction', 'ChosenInlineResult',
95-
'CallbackQuery', 'Contact', 'Document', 'Emoji', 'File', 'ForceReply',
96-
'InlineKeyboardButton', 'InlineKeyboardMarkup', 'InlineQuery', 'InlineQueryResult',
97-
'InlineQueryResult', 'InlineQueryResultArticle', 'InlineQueryResultAudio',
98-
'InlineQueryResultCachedAudio', 'InlineQueryResultCachedDocument',
99-
'InlineQueryResultCachedGif', 'InlineQueryResultCachedMpeg4Gif',
100-
'InlineQueryResultCachedPhoto', 'InlineQueryResultCachedSticker',
101-
'InlineQueryResultCachedVideo', 'InlineQueryResultCachedVoice',
102-
'InlineQueryResultContact', 'InlineQueryResultDocument', 'InlineQueryResultGif',
103-
'InlineQueryResultLocation', 'InlineQueryResultMpeg4Gif', 'InlineQueryResultPhoto',
104-
'InlineQueryResultVenue', 'InlineQueryResultVideo', 'InlineQueryResultVoice',
105-
'InputContactMessageContent', 'InputFile', 'InputLocationMessageContent',
106-
'InputMessageContent', 'InputTextMessageContent', 'InputVenueMessageContent',
107-
'KeyboardButton', 'Location', 'Message', 'MessageEntity', 'ParseMode', 'PhotoSize',
108-
'ReplyKeyboardHide', 'ReplyKeyboardMarkup', 'ReplyMarkup', 'Sticker', 'TelegramError',
109-
'TelegramObject', 'Update', 'User', 'UserProfilePhotos', 'Venue', 'Video', 'Voice',
110-
'MAX_MESSAGE_LENGTH', 'MAX_CAPTION_LENGTH', 'SUPPORTED_WEBHOOK_PORTS',
111-
'MAX_FILESIZE_DOWNLOAD', 'MAX_FILESIZE_UPLOAD', 'MAX_MESSAGES_PER_SECOND_PER_CHAT',
112-
'MAX_MESSAGES_PER_SECOND', 'MAX_MESSAGES_PER_MINUTE_PER_GROUP', 'WebhookInfo',
113-
'Animation', 'Game', 'GameHighScore']
95+
__all__ = [
96+
'Audio', 'Bot', 'Chat', 'ChatMember', 'ChatAction', 'ChosenInlineResult', 'CallbackQuery',
97+
'Contact', 'Document', 'Emoji', 'File', 'ForceReply', 'InlineKeyboardButton',
98+
'InlineKeyboardMarkup', 'InlineQuery', 'InlineQueryResult', 'InlineQueryResult',
99+
'InlineQueryResultArticle', 'InlineQueryResultAudio', 'InlineQueryResultCachedAudio',
100+
'InlineQueryResultCachedDocument', 'InlineQueryResultCachedGif',
101+
'InlineQueryResultCachedMpeg4Gif', 'InlineQueryResultCachedPhoto',
102+
'InlineQueryResultCachedSticker', 'InlineQueryResultCachedVideo',
103+
'InlineQueryResultCachedVoice', 'InlineQueryResultContact', 'InlineQueryResultDocument',
104+
'InlineQueryResultGif', 'InlineQueryResultLocation', 'InlineQueryResultMpeg4Gif',
105+
'InlineQueryResultPhoto', 'InlineQueryResultVenue', 'InlineQueryResultVideo',
106+
'InlineQueryResultVoice', 'InlineQueryResultGame', 'InputContactMessageContent', 'InputFile',
107+
'InputLocationMessageContent', 'InputMessageContent', 'InputTextMessageContent',
108+
'InputVenueMessageContent', 'KeyboardButton', 'Location', 'Message', 'MessageEntity',
109+
'ParseMode', 'PhotoSize', 'ReplyKeyboardHide', 'ReplyKeyboardMarkup', 'ReplyMarkup', 'Sticker',
110+
'TelegramError', 'TelegramObject', 'Update', 'User', 'UserProfilePhotos', 'Venue', 'Video',
111+
'Voice', 'MAX_MESSAGE_LENGTH', 'MAX_CAPTION_LENGTH', 'SUPPORTED_WEBHOOK_PORTS',
112+
'MAX_FILESIZE_DOWNLOAD', 'MAX_FILESIZE_UPLOAD', 'MAX_MESSAGES_PER_SECOND_PER_CHAT',
113+
'MAX_MESSAGES_PER_SECOND', 'MAX_MESSAGES_PER_MINUTE_PER_GROUP', 'WebhookInfo', 'Animation',
114+
'Game', 'GameHighScore'
115+
]

telegram/inlinequeryresultgame.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/usr/bin/env python
2+
#
3+
# A library that provides a Python interface to the Telegram Bot API
4+
# Copyright (C) 2015-2016
5+
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
6+
#
7+
# This program is free software: you can redistribute it and/or modify
8+
# it under the terms of the GNU Lesser Public License as published by
9+
# the Free Software Foundation, either version 3 of the License, or
10+
# (at your option) any later version.
11+
#
12+
# This program is distributed in the hope that it will be useful,
13+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
# GNU Lesser Public License for more details.
16+
#
17+
# You should have received a copy of the GNU Lesser Public License
18+
# along with this program. If not, see [http://www.gnu.org/licenses/].
19+
"""This module contains the classes that represent Telegram
20+
InlineQueryResultGame"""
21+
22+
from telegram import InlineQueryResult, InlineKeyboardMarkup
23+
24+
25+
class InlineQueryResultGame(InlineQueryResult):
26+
27+
def __init__(self, id, game_short_name, reply_markup=None, **kwargs):
28+
# Required
29+
super(InlineQueryResultGame, self).__init__('game', id)
30+
self.id = id
31+
self.game_short_name = game_short_name
32+
33+
if reply_markup:
34+
self.reply_markup = reply_markup
35+
36+
@staticmethod
37+
def de_json(data, bot):
38+
data = super(InlineQueryResultGame, InlineQueryResultGame).de_json(data, bot)
39+
40+
data['reply_markup'] = InlineKeyboardMarkup.de_json(data.get('reply_markup'), bot)
41+
42+
return InlineQueryResultGame(**data)

0 commit comments

Comments
 (0)
X Tutup