mirror of
https://github.com/python-telegram-bot/python-telegram-bot.git
synced 2025-02-16 18:31:45 +01:00
Add InlineQueryResultGame
This commit is contained in:
parent
358dd795c7
commit
ae17eb3272
2 changed files with 64 additions and 20 deletions
|
@ -73,6 +73,7 @@ from .inlinequeryresultphoto import InlineQueryResultPhoto
|
||||||
from .inlinequeryresultvenue import InlineQueryResultVenue
|
from .inlinequeryresultvenue import InlineQueryResultVenue
|
||||||
from .inlinequeryresultvideo import InlineQueryResultVideo
|
from .inlinequeryresultvideo import InlineQueryResultVideo
|
||||||
from .inlinequeryresultvoice import InlineQueryResultVoice
|
from .inlinequeryresultvoice import InlineQueryResultVoice
|
||||||
|
from .inlinequeryresultgame import InlineQueryResultGame
|
||||||
from .inputtextmessagecontent import InputTextMessageContent
|
from .inputtextmessagecontent import InputTextMessageContent
|
||||||
from .inputlocationmessagecontent import InputLocationMessageContent
|
from .inputlocationmessagecontent import InputLocationMessageContent
|
||||||
from .inputvenuemessagecontent import InputVenueMessageContent
|
from .inputvenuemessagecontent import InputVenueMessageContent
|
||||||
|
@ -91,23 +92,24 @@ from .version import __version__ # flake8: noqa
|
||||||
|
|
||||||
__author__ = 'devs@python-telegram-bot.org'
|
__author__ = 'devs@python-telegram-bot.org'
|
||||||
|
|
||||||
__all__ = ['Audio', 'Bot', 'Chat', 'ChatMember', 'ChatAction', 'ChosenInlineResult',
|
__all__ = [
|
||||||
'CallbackQuery', 'Contact', 'Document', 'Emoji', 'File', 'ForceReply',
|
'Audio', 'Bot', 'Chat', 'ChatMember', 'ChatAction', 'ChosenInlineResult', 'CallbackQuery',
|
||||||
'InlineKeyboardButton', 'InlineKeyboardMarkup', 'InlineQuery', 'InlineQueryResult',
|
'Contact', 'Document', 'Emoji', 'File', 'ForceReply', 'InlineKeyboardButton',
|
||||||
'InlineQueryResult', 'InlineQueryResultArticle', 'InlineQueryResultAudio',
|
'InlineKeyboardMarkup', 'InlineQuery', 'InlineQueryResult', 'InlineQueryResult',
|
||||||
'InlineQueryResultCachedAudio', 'InlineQueryResultCachedDocument',
|
'InlineQueryResultArticle', 'InlineQueryResultAudio', 'InlineQueryResultCachedAudio',
|
||||||
'InlineQueryResultCachedGif', 'InlineQueryResultCachedMpeg4Gif',
|
'InlineQueryResultCachedDocument', 'InlineQueryResultCachedGif',
|
||||||
'InlineQueryResultCachedPhoto', 'InlineQueryResultCachedSticker',
|
'InlineQueryResultCachedMpeg4Gif', 'InlineQueryResultCachedPhoto',
|
||||||
'InlineQueryResultCachedVideo', 'InlineQueryResultCachedVoice',
|
'InlineQueryResultCachedSticker', 'InlineQueryResultCachedVideo',
|
||||||
'InlineQueryResultContact', 'InlineQueryResultDocument', 'InlineQueryResultGif',
|
'InlineQueryResultCachedVoice', 'InlineQueryResultContact', 'InlineQueryResultDocument',
|
||||||
'InlineQueryResultLocation', 'InlineQueryResultMpeg4Gif', 'InlineQueryResultPhoto',
|
'InlineQueryResultGif', 'InlineQueryResultLocation', 'InlineQueryResultMpeg4Gif',
|
||||||
'InlineQueryResultVenue', 'InlineQueryResultVideo', 'InlineQueryResultVoice',
|
'InlineQueryResultPhoto', 'InlineQueryResultVenue', 'InlineQueryResultVideo',
|
||||||
'InputContactMessageContent', 'InputFile', 'InputLocationMessageContent',
|
'InlineQueryResultVoice', 'InlineQueryResultGame', 'InputContactMessageContent', 'InputFile',
|
||||||
'InputMessageContent', 'InputTextMessageContent', 'InputVenueMessageContent',
|
'InputLocationMessageContent', 'InputMessageContent', 'InputTextMessageContent',
|
||||||
'KeyboardButton', 'Location', 'Message', 'MessageEntity', 'ParseMode', 'PhotoSize',
|
'InputVenueMessageContent', 'KeyboardButton', 'Location', 'Message', 'MessageEntity',
|
||||||
'ReplyKeyboardHide', 'ReplyKeyboardMarkup', 'ReplyMarkup', 'Sticker', 'TelegramError',
|
'ParseMode', 'PhotoSize', 'ReplyKeyboardHide', 'ReplyKeyboardMarkup', 'ReplyMarkup', 'Sticker',
|
||||||
'TelegramObject', 'Update', 'User', 'UserProfilePhotos', 'Venue', 'Video', 'Voice',
|
'TelegramError', 'TelegramObject', 'Update', 'User', 'UserProfilePhotos', 'Venue', 'Video',
|
||||||
'MAX_MESSAGE_LENGTH', 'MAX_CAPTION_LENGTH', 'SUPPORTED_WEBHOOK_PORTS',
|
'Voice', 'MAX_MESSAGE_LENGTH', 'MAX_CAPTION_LENGTH', 'SUPPORTED_WEBHOOK_PORTS',
|
||||||
'MAX_FILESIZE_DOWNLOAD', 'MAX_FILESIZE_UPLOAD', 'MAX_MESSAGES_PER_SECOND_PER_CHAT',
|
'MAX_FILESIZE_DOWNLOAD', 'MAX_FILESIZE_UPLOAD', 'MAX_MESSAGES_PER_SECOND_PER_CHAT',
|
||||||
'MAX_MESSAGES_PER_SECOND', 'MAX_MESSAGES_PER_MINUTE_PER_GROUP', 'WebhookInfo',
|
'MAX_MESSAGES_PER_SECOND', 'MAX_MESSAGES_PER_MINUTE_PER_GROUP', 'WebhookInfo', 'Animation',
|
||||||
'Animation', 'Game', 'GameHighScore']
|
'Game', 'GameHighScore'
|
||||||
|
]
|
||||||
|
|
42
telegram/inlinequeryresultgame.py
Normal file
42
telegram/inlinequeryresultgame.py
Normal file
|
@ -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 <devs@python-telegram-bot.org>
|
||||||
|
#
|
||||||
|
# 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)
|
Loading…
Add table
Reference in a new issue