Fix Inline buttons parsing

This commit is contained in:
Dan 2019-03-22 11:58:49 +01:00
parent 921800f902
commit f0138ce555

View File

@ -110,21 +110,21 @@ class InlineKeyboardButton(PyrogramType):
) )
def write(self): def write(self):
if self.callback_data: if self.callback_data is not None:
return KeyboardButtonCallback(text=self.text, data=self.callback_data) return KeyboardButtonCallback(text=self.text, data=self.callback_data)
if self.url: if self.url is not None:
return KeyboardButtonUrl(text=self.text, url=self.url) return KeyboardButtonUrl(text=self.text, url=self.url)
if self.switch_inline_query: if self.switch_inline_query is not None:
return KeyboardButtonSwitchInline(text=self.text, query=self.switch_inline_query) return KeyboardButtonSwitchInline(text=self.text, query=self.switch_inline_query)
if self.switch_inline_query_current_chat: if self.switch_inline_query_current_chat is not None:
return KeyboardButtonSwitchInline( return KeyboardButtonSwitchInline(
text=self.text, text=self.text,
query=self.switch_inline_query_current_chat, query=self.switch_inline_query_current_chat,
same_peer=True same_peer=True
) )
if self.callback_game: if self.callback_game is not None:
return KeyboardButtonGame(text=self.text) return KeyboardButtonGame(text=self.text)