Adding InlineKeyboardButton #232

This commit is contained in:
Leandro Toledo 2016-04-13 20:26:38 -03:00
parent ed170e1595
commit 23eba8a24e
3 changed files with 85 additions and 20 deletions

View file

@ -44,6 +44,7 @@ from .emoji import Emoji
from .parsemode import ParseMode
from .message import Message
from .choseninlineresult import ChosenInlineResult
from .inlinekeyboardbutton import InlineKeyboardButton
from .inlinequery import InlineQuery
from .inlinequeryresult import InlineQueryResult
from .inlinequeryresultarticle import InlineQueryResultArticle
@ -109,22 +110,58 @@ def JobQueue(*args, **kwargs):
__author__ = 'devs@python-telegram-bot.org'
__version__ = '3.4'
__all__ = ('Audio', 'Bot', 'Chat', 'Emoji', 'TelegramError', 'InputFile',
'Contact', 'ForceReply', 'ReplyKeyboardHide', 'ReplyKeyboardMarkup',
'UserProfilePhotos', 'ChatAction', 'Location', 'Video', 'Document',
'Sticker', 'File', 'PhotoSize', 'Update', 'ParseMode', 'Message',
'User', 'TelegramObject', 'NullHandler', 'Voice', 'InlineQuery',
'ReplyMarkup', 'ChosenInlineResult', 'InlineQueryResult',
'InlineQueryResult', 'InlineQueryResultArticle',
'InlineQueryResultAudio', 'InlineQueryResultCachedAudio',
'InlineQueryResultCachedDocument', 'InlineQueryResultCachedGif',
'InlineQueryResultCachedMpeg4Gif', 'InlineQueryResultCachedPhoto',
'InlineQueryResultCachedSticker', 'InlineQueryResultCachedVideo',
'InlineQueryResultCachedVoice', 'InlineQueryResultContact',
'InlineQueryResultDocument', 'InlineQueryResultGif',
'InlineQueryResultLocation', 'InlineQueryResultMpeg4Gif',
'InlineQueryResultPhoto', 'InlineQueryResultVenue',
'InlineQueryResultVideo', 'InlineQueryResultVoice',
'InputMessageContent', 'InputTextMessageContent',
'InputLocationMessageContent', 'InputVenueMessageContent',
'InputContactMessageContent')
__all__ = ('Audio',
'Bot',
'Chat',
'ChatAction',
'ChosenInlineResult',
'Contact',
'Document',
'Emoji',
'File',
'ForceReply',
'InlineKeyboardButton',
'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',
'Location',
'Message',
'NullHandler',
'ParseMode',
'PhotoSize',
'ReplyKeyboardHide',
'ReplyKeyboardMarkup',
'ReplyMarkup',
'Sticker',
'TelegramError',
'TelegramObject',
'Update',
'User',
'UserProfilePhotos',
'Video',
'Voice',)

View file

@ -16,3 +16,32 @@
#
# 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 a object that represents a Telegram
InlineKeyboardButton"""
from telegram import TelegramObject
class InlineKeyboardButton(TelegramObject):
"""This object represents a Telegram InlineKeyboardButton."""
def __init__(self,
text,
url=None,
callback_data=None,
switch_inline_query=None):
# Required
self.text = text
# Optionals
self.url = url
self.callback_data = callback_data
self.switch_inline_query = switch_inline_query
@staticmethod
def de_json(data):
if not data:
return None
return InlineKeyboardButton(**data)

View file

@ -39,7 +39,6 @@ class InlineQuery(TelegramObject):
from_user (:class:`telegram.User`):
query (str):
offset (str):
"""
def __init__(self,