Skip to content

Commit 9435ddd

Browse files
authored
Merge pull request #2564 from Badiboy/master
Removed "is not None" for non-bool fields in to_dict of buttons
2 parents 5d06ec9 + 9665cfa commit 9435ddd

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

telebot/types.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2909,9 +2909,9 @@ def to_dict(self) -> dict:
29092909
data['chat_has_username'] = self.chat_has_username
29102910
if self.chat_is_created is not None:
29112911
data['chat_is_created'] = self.chat_is_created
2912-
if self.user_administrator_rights is not None:
2912+
if self.user_administrator_rights:
29132913
data['user_administrator_rights'] = self.user_administrator_rights.to_dict()
2914-
if self.bot_administrator_rights is not None:
2914+
if self.bot_administrator_rights:
29152915
data['bot_administrator_rights'] = self.bot_administrator_rights.to_dict()
29162916
if self.bot_is_member is not None:
29172917
data['bot_is_member'] = self.bot_is_member
@@ -3003,17 +3003,17 @@ def to_dict(self):
30033003
json_dict['request_contact'] = self.request_contact
30043004
if self.request_location is not None:
30053005
json_dict['request_location'] = self.request_location
3006-
if self.request_poll is not None:
3006+
if self.request_poll:
30073007
json_dict['request_poll'] = self.request_poll.to_dict()
3008-
if self.web_app is not None:
3008+
if self.web_app:
30093009
json_dict['web_app'] = self.web_app.to_dict()
3010-
if self.request_users is not None:
3010+
if self.request_users:
30113011
json_dict['request_users'] = self.request_users.to_dict()
3012-
if self.request_chat is not None:
3012+
if self.request_chat:
30133013
json_dict['request_chat'] = self.request_chat.to_dict()
3014-
if self.icon_custom_emoji_id is not None:
3014+
if self.icon_custom_emoji_id:
30153015
json_dict['icon_custom_emoji_id'] = self.icon_custom_emoji_id
3016-
if self.style is not None:
3016+
if self.style:
30173017
json_dict['style'] = self.style
30183018
return json_dict
30193019

@@ -3238,23 +3238,23 @@ def to_dict(self):
32383238
json_dict['callback_data'] = self.callback_data
32393239
if self.web_app:
32403240
json_dict['web_app'] = self.web_app.to_dict()
3241-
if self.switch_inline_query is not None:
3241+
if self.switch_inline_query:
32423242
json_dict['switch_inline_query'] = self.switch_inline_query
3243-
if self.switch_inline_query_current_chat is not None:
3243+
if self.switch_inline_query_current_chat:
32443244
json_dict['switch_inline_query_current_chat'] = self.switch_inline_query_current_chat
3245-
if self.callback_game is not None:
3245+
if self.callback_game:
32463246
json_dict['callback_game'] = self.callback_game
32473247
if self.pay is not None:
32483248
json_dict['pay'] = self.pay
3249-
if self.login_url is not None:
3249+
if self.login_url:
32503250
json_dict['login_url'] = self.login_url.to_dict()
3251-
if self.switch_inline_query_chosen_chat is not None:
3251+
if self.switch_inline_query_chosen_chat:
32523252
json_dict['switch_inline_query_chosen_chat'] = self.switch_inline_query_chosen_chat.to_dict()
3253-
if self.copy_text is not None:
3253+
if self.copy_text:
32543254
json_dict['copy_text'] = self.copy_text.to_dict()
3255-
if self.icon_custom_emoji_id is not None:
3255+
if self.icon_custom_emoji_id:
32563256
json_dict['icon_custom_emoji_id'] = self.icon_custom_emoji_id
3257-
if self.style is not None:
3257+
if self.style:
32583258
json_dict['style'] = self.style
32593259
return json_dict
32603260

0 commit comments

Comments
 (0)