mirror of
https://github.com/eternnoir/pyTelegramBotAPI.git
synced 2023-08-10 21:12:57 +03:00
Added LoginUrl to types
This commit is contained in:
parent
e26ad07965
commit
3c62e9d391
@ -885,9 +885,30 @@ class InlineKeyboardMarkup(Dictionaryable, JsonSerializable):
|
|||||||
return json_dict
|
return json_dict
|
||||||
|
|
||||||
|
|
||||||
|
class LoginUrl(JsonSerializable):
|
||||||
|
def __init__(self, url, forward_text=None, bot_username=None, request_write_access=None):
|
||||||
|
self.url = url
|
||||||
|
self.forward_text = forward_text
|
||||||
|
self.bot_username = bot_username
|
||||||
|
self.request_write_access = request_write_access
|
||||||
|
|
||||||
|
def to_json(self):
|
||||||
|
return json.dumps(self.to_dic())
|
||||||
|
|
||||||
|
def to_dic(self):
|
||||||
|
json_dic = {'url': self.url}
|
||||||
|
if self.forward_text:
|
||||||
|
json_dic['forward_text'] = self.forward_text
|
||||||
|
if self.bot_username:
|
||||||
|
json_dic['bot_username'] = self.bot_username
|
||||||
|
if self.request_write_access:
|
||||||
|
json_dic['request_write_access'] = self.request_write_access
|
||||||
|
return json_dic
|
||||||
|
|
||||||
|
|
||||||
class InlineKeyboardButton(JsonSerializable):
|
class InlineKeyboardButton(JsonSerializable):
|
||||||
def __init__(self, text, url=None, callback_data=None, switch_inline_query=None,
|
def __init__(self, text, url=None, callback_data=None, switch_inline_query=None,
|
||||||
switch_inline_query_current_chat=None, callback_game=None, pay=None):
|
switch_inline_query_current_chat=None, callback_game=None, pay=None, login_url=None):
|
||||||
self.text = text
|
self.text = text
|
||||||
self.url = url
|
self.url = url
|
||||||
self.callback_data = callback_data
|
self.callback_data = callback_data
|
||||||
@ -895,6 +916,7 @@ class InlineKeyboardButton(JsonSerializable):
|
|||||||
self.switch_inline_query_current_chat = switch_inline_query_current_chat
|
self.switch_inline_query_current_chat = switch_inline_query_current_chat
|
||||||
self.callback_game = callback_game
|
self.callback_game = callback_game
|
||||||
self.pay = pay
|
self.pay = pay
|
||||||
|
self.login_url = login_url.to_dic()
|
||||||
|
|
||||||
def to_json(self):
|
def to_json(self):
|
||||||
return json.dumps(self.to_dic())
|
return json.dumps(self.to_dic())
|
||||||
@ -913,6 +935,8 @@ class InlineKeyboardButton(JsonSerializable):
|
|||||||
json_dic['callback_game'] = self.callback_game
|
json_dic['callback_game'] = self.callback_game
|
||||||
if self.pay is not None:
|
if self.pay is not None:
|
||||||
json_dic['pay'] = self.pay
|
json_dic['pay'] = self.pay
|
||||||
|
if self.login_url is not None:
|
||||||
|
json_dic['login_url'] = self.login_url
|
||||||
return json_dic
|
return json_dic
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user