Skip to content

Commit 8d65856

Browse files
committed
New field callback_game in InlineKeyboardButton, new fields
game_short_name and chat_instance in CallbackQuery.
1 parent 740d7f4 commit 8d65856

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

telebot/types.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -699,11 +699,14 @@ def to_dic(self):
699699

700700

701701
class InlineKeyboardButton(JsonSerializable):
702-
def __init__(self, text, url=None, callback_data=None, switch_inline_query=None):
702+
def __init__(self, text, url=None, callback_data=None, switch_inline_query=None,
703+
switch_inline_query_current_chat=None, callback_game=None):
703704
self.text = text
704705
self.url = url
705706
self.callback_data = callback_data
706707
self.switch_inline_query = switch_inline_query
708+
self.switch_inline_query_current_chat = switch_inline_query_current_chat
709+
self.callback_game = callback_game
707710

708711
def to_json(self):
709712
return json.dumps(self.to_dic())
@@ -716,6 +719,10 @@ def to_dic(self):
716719
json_dic['callback_data'] = self.callback_data
717720
if self.switch_inline_query is not None:
718721
json_dic['switch_inline_query'] = self.switch_inline_query
722+
if self.switch_inline_query_current_chat is not None:
723+
json_dic['switch_inline_query_current_chat'] = self.switch_inline_query_current_chat
724+
if self.callback_game is not None:
725+
json_dic['callback_game'] = self.callback_game
719726
return json_dic
720727

721728

@@ -729,10 +736,14 @@ def de_json(cls, json_type):
729736
if 'message' in obj:
730737
message = Message.de_json(obj['message'])
731738
inline_message_id = obj.get('inline_message_id')
739+
chat_instance = obj['chat_instance']
732740
data = obj['data']
733-
return cls(id, from_user, data, message, inline_message_id)
741+
game_short_name = obj.get('game_short_name')
742+
return cls(id, from_user, data, chat_instance, message, inline_message_id, game_short_name)
734743

735-
def __init__(self, id, from_user, data, message=None, inline_message_id=None):
744+
def __init__(self, id, from_user, data, chat_instance, message=None, inline_message_id=None, game_short_name=None):
745+
self.game_short_name = game_short_name
746+
self.chat_instance = chat_instance
736747
self.id = id
737748
self.from_user = from_user
738749
self.message = message

0 commit comments

Comments
 (0)