diff --git a/telegram/__init__.py b/telegram/__init__.py index f4520f923..96d5e322c 100644 --- a/telegram/__init__.py +++ b/telegram/__init__.py @@ -73,6 +73,7 @@ from .inlinequeryresultphoto import InlineQueryResultPhoto from .inlinequeryresultvenue import InlineQueryResultVenue from .inlinequeryresultvideo import InlineQueryResultVideo from .inlinequeryresultvoice import InlineQueryResultVoice +from .inlinequeryresultgame import InlineQueryResultGame from .inputtextmessagecontent import InputTextMessageContent from .inputlocationmessagecontent import InputLocationMessageContent from .inputvenuemessagecontent import InputVenueMessageContent @@ -91,23 +92,24 @@ from .version import __version__ # flake8: noqa __author__ = 'devs@python-telegram-bot.org' -__all__ = ['Audio', 'Bot', 'Chat', 'ChatMember', 'ChatAction', 'ChosenInlineResult', - 'CallbackQuery', 'Contact', 'Document', 'Emoji', 'File', 'ForceReply', - 'InlineKeyboardButton', 'InlineKeyboardMarkup', 'InlineQuery', 'InlineQueryResult', - 'InlineQueryResult', 'InlineQueryResultArticle', 'InlineQueryResultAudio', - 'InlineQueryResultCachedAudio', 'InlineQueryResultCachedDocument', - 'InlineQueryResultCachedGif', 'InlineQueryResultCachedMpeg4Gif', - 'InlineQueryResultCachedPhoto', 'InlineQueryResultCachedSticker', - 'InlineQueryResultCachedVideo', 'InlineQueryResultCachedVoice', - 'InlineQueryResultContact', 'InlineQueryResultDocument', 'InlineQueryResultGif', - 'InlineQueryResultLocation', 'InlineQueryResultMpeg4Gif', 'InlineQueryResultPhoto', - 'InlineQueryResultVenue', 'InlineQueryResultVideo', 'InlineQueryResultVoice', - 'InputContactMessageContent', 'InputFile', 'InputLocationMessageContent', - 'InputMessageContent', 'InputTextMessageContent', 'InputVenueMessageContent', - 'KeyboardButton', 'Location', 'Message', 'MessageEntity', 'ParseMode', 'PhotoSize', - 'ReplyKeyboardHide', 'ReplyKeyboardMarkup', 'ReplyMarkup', 'Sticker', 'TelegramError', - 'TelegramObject', 'Update', 'User', 'UserProfilePhotos', 'Venue', 'Video', 'Voice', - 'MAX_MESSAGE_LENGTH', 'MAX_CAPTION_LENGTH', 'SUPPORTED_WEBHOOK_PORTS', - 'MAX_FILESIZE_DOWNLOAD', 'MAX_FILESIZE_UPLOAD', 'MAX_MESSAGES_PER_SECOND_PER_CHAT', - 'MAX_MESSAGES_PER_SECOND', 'MAX_MESSAGES_PER_MINUTE_PER_GROUP', 'WebhookInfo', - 'Animation', 'Game', 'GameHighScore'] +__all__ = [ + 'Audio', 'Bot', 'Chat', 'ChatMember', 'ChatAction', 'ChosenInlineResult', 'CallbackQuery', + 'Contact', 'Document', 'Emoji', 'File', 'ForceReply', 'InlineKeyboardButton', + 'InlineKeyboardMarkup', 'InlineQuery', 'InlineQueryResult', 'InlineQueryResult', + 'InlineQueryResultArticle', 'InlineQueryResultAudio', 'InlineQueryResultCachedAudio', + 'InlineQueryResultCachedDocument', 'InlineQueryResultCachedGif', + 'InlineQueryResultCachedMpeg4Gif', 'InlineQueryResultCachedPhoto', + 'InlineQueryResultCachedSticker', 'InlineQueryResultCachedVideo', + 'InlineQueryResultCachedVoice', 'InlineQueryResultContact', 'InlineQueryResultDocument', + 'InlineQueryResultGif', 'InlineQueryResultLocation', 'InlineQueryResultMpeg4Gif', + 'InlineQueryResultPhoto', 'InlineQueryResultVenue', 'InlineQueryResultVideo', + 'InlineQueryResultVoice', 'InlineQueryResultGame', 'InputContactMessageContent', 'InputFile', + 'InputLocationMessageContent', 'InputMessageContent', 'InputTextMessageContent', + 'InputVenueMessageContent', 'KeyboardButton', 'Location', 'Message', 'MessageEntity', + 'ParseMode', 'PhotoSize', 'ReplyKeyboardHide', 'ReplyKeyboardMarkup', 'ReplyMarkup', 'Sticker', + 'TelegramError', 'TelegramObject', 'Update', 'User', 'UserProfilePhotos', 'Venue', 'Video', + 'Voice', 'MAX_MESSAGE_LENGTH', 'MAX_CAPTION_LENGTH', 'SUPPORTED_WEBHOOK_PORTS', + 'MAX_FILESIZE_DOWNLOAD', 'MAX_FILESIZE_UPLOAD', 'MAX_MESSAGES_PER_SECOND_PER_CHAT', + 'MAX_MESSAGES_PER_SECOND', 'MAX_MESSAGES_PER_MINUTE_PER_GROUP', 'WebhookInfo', 'Animation', + 'Game', 'GameHighScore' +] diff --git a/telegram/inlinequeryresultgame.py b/telegram/inlinequeryresultgame.py new file mode 100644 index 000000000..55412d7d8 --- /dev/null +++ b/telegram/inlinequeryresultgame.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python +# +# A library that provides a Python interface to the Telegram Bot API +# Copyright (C) 2015-2016 +# Leandro Toledo de Souza +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program 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 Public License for more details. +# +# You should have received a copy of the GNU Lesser Public License +# along with this program. If not, see [http://www.gnu.org/licenses/]. +"""This module contains the classes that represent Telegram +InlineQueryResultGame""" + +from telegram import InlineQueryResult, InlineKeyboardMarkup + + +class InlineQueryResultGame(InlineQueryResult): + + def __init__(self, id, game_short_name, reply_markup=None, **kwargs): + # Required + super(InlineQueryResultGame, self).__init__('game', id) + self.id = id + self.game_short_name = game_short_name + + if reply_markup: + self.reply_markup = reply_markup + + @staticmethod + def de_json(data, bot): + data = super(InlineQueryResultGame, InlineQueryResultGame).de_json(data, bot) + + data['reply_markup'] = InlineKeyboardMarkup.de_json(data.get('reply_markup'), bot) + + return InlineQueryResultGame(**data)