X Tutup
Skip to content

Commit 23eba8a

Browse files
committed
Adding InlineKeyboardButton python-telegram-bot#232
1 parent ed170e1 commit 23eba8a

File tree

3 files changed

+85
-20
lines changed

3 files changed

+85
-20
lines changed

telegram/__init__.py

Lines changed: 56 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
from .parsemode import ParseMode
4545
from .message import Message
4646
from .choseninlineresult import ChosenInlineResult
47+
from .inlinekeyboardbutton import InlineKeyboardButton
4748
from .inlinequery import InlineQuery
4849
from .inlinequeryresult import InlineQueryResult
4950
from .inlinequeryresultarticle import InlineQueryResultArticle
@@ -109,22 +110,58 @@ def JobQueue(*args, **kwargs):
109110

110111
__author__ = 'devs@python-telegram-bot.org'
111112
__version__ = '3.4'
112-
__all__ = ('Audio', 'Bot', 'Chat', 'Emoji', 'TelegramError', 'InputFile',
113-
'Contact', 'ForceReply', 'ReplyKeyboardHide', 'ReplyKeyboardMarkup',
114-
'UserProfilePhotos', 'ChatAction', 'Location', 'Video', 'Document',
115-
'Sticker', 'File', 'PhotoSize', 'Update', 'ParseMode', 'Message',
116-
'User', 'TelegramObject', 'NullHandler', 'Voice', 'InlineQuery',
117-
'ReplyMarkup', 'ChosenInlineResult', 'InlineQueryResult',
118-
'InlineQueryResult', 'InlineQueryResultArticle',
119-
'InlineQueryResultAudio', 'InlineQueryResultCachedAudio',
120-
'InlineQueryResultCachedDocument', 'InlineQueryResultCachedGif',
121-
'InlineQueryResultCachedMpeg4Gif', 'InlineQueryResultCachedPhoto',
122-
'InlineQueryResultCachedSticker', 'InlineQueryResultCachedVideo',
123-
'InlineQueryResultCachedVoice', 'InlineQueryResultContact',
124-
'InlineQueryResultDocument', 'InlineQueryResultGif',
125-
'InlineQueryResultLocation', 'InlineQueryResultMpeg4Gif',
126-
'InlineQueryResultPhoto', 'InlineQueryResultVenue',
127-
'InlineQueryResultVideo', 'InlineQueryResultVoice',
128-
'InputMessageContent', 'InputTextMessageContent',
129-
'InputLocationMessageContent', 'InputVenueMessageContent',
130-
'InputContactMessageContent')
113+
__all__ = ('Audio',
114+
'Bot',
115+
'Chat',
116+
'ChatAction',
117+
'ChosenInlineResult',
118+
'Contact',
119+
'Document',
120+
'Emoji',
121+
'File',
122+
'ForceReply',
123+
'InlineKeyboardButton',
124+
'InlineQuery',
125+
'InlineQueryResult',
126+
'InlineQueryResult',
127+
'InlineQueryResultArticle',
128+
'InlineQueryResultAudio',
129+
'InlineQueryResultCachedAudio',
130+
'InlineQueryResultCachedDocument',
131+
'InlineQueryResultCachedGif',
132+
'InlineQueryResultCachedMpeg4Gif',
133+
'InlineQueryResultCachedPhoto',
134+
'InlineQueryResultCachedSticker',
135+
'InlineQueryResultCachedVideo',
136+
'InlineQueryResultCachedVoice',
137+
'InlineQueryResultContact',
138+
'InlineQueryResultDocument',
139+
'InlineQueryResultGif',
140+
'InlineQueryResultLocation',
141+
'InlineQueryResultMpeg4Gif',
142+
'InlineQueryResultPhoto',
143+
'InlineQueryResultVenue',
144+
'InlineQueryResultVideo',
145+
'InlineQueryResultVoice',
146+
'InputContactMessageContent',
147+
'InputFile',
148+
'InputLocationMessageContent',
149+
'InputMessageContent',
150+
'InputTextMessageContent',
151+
'InputVenueMessageContent',
152+
'Location',
153+
'Message',
154+
'NullHandler',
155+
'ParseMode',
156+
'PhotoSize',
157+
'ReplyKeyboardHide',
158+
'ReplyKeyboardMarkup',
159+
'ReplyMarkup',
160+
'Sticker',
161+
'TelegramError',
162+
'TelegramObject',
163+
'Update',
164+
'User',
165+
'UserProfilePhotos',
166+
'Video',
167+
'Voice',)

telegram/inlinekeyboardbutton.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,32 @@
1616
#
1717
# You should have received a copy of the GNU Lesser Public License
1818
# along with this program. If not, see [http://www.gnu.org/licenses/].
19+
20+
"""This module contains a object that represents a Telegram
21+
InlineKeyboardButton"""
22+
23+
from telegram import TelegramObject
24+
25+
26+
class InlineKeyboardButton(TelegramObject):
27+
"""This object represents a Telegram InlineKeyboardButton."""
28+
29+
def __init__(self,
30+
text,
31+
url=None,
32+
callback_data=None,
33+
switch_inline_query=None):
34+
# Required
35+
self.text = text
36+
37+
# Optionals
38+
self.url = url
39+
self.callback_data = callback_data
40+
self.switch_inline_query = switch_inline_query
41+
42+
@staticmethod
43+
def de_json(data):
44+
if not data:
45+
return None
46+
47+
return InlineKeyboardButton(**data)

telegram/inlinequery.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ class InlineQuery(TelegramObject):
3939
from_user (:class:`telegram.User`):
4040
query (str):
4141
offset (str):
42-
4342
"""
4443

4544
def __init__(self,

0 commit comments

Comments
 (0)
X Tutup