add default_disable_web_page_preview for InputTextMessageContent

This commit is contained in:
Hinrich Mahler 2020-01-20 20:40:29 +01:00
parent 23af7adfb8
commit 4a5a96f516
3 changed files with 9 additions and 1 deletions

View file

@ -1519,6 +1519,10 @@ class Bot(TelegramObject):
if (res.input_message_content._has_parse_mode
and res.input_message_content.parse_mode is DEFAULT_NONE):
res.input_message_content.parse_mode = self.defaults.parse_mode
if (res.input_message_content._has_disable_web_page_preview
and res.input_message_content.disable_web_page_preview is DEFAULT_NONE):
res.input_message_content.disable_web_page_preview = \
self.defaults.disable_web_page_preview
results = [res.to_dict() for res in results]
data = {'inline_query_id': inline_query_id, 'results': results}

View file

@ -32,3 +32,7 @@ class InputMessageContent(TelegramObject):
@property
def _has_parse_mode(self):
return hasattr(self, 'parse_mode')
@property
def _has_disable_web_page_preview(self):
return hasattr(self, 'disable_web_page_preview')

View file

@ -47,7 +47,7 @@ class InputTextMessageContent(InputMessageContent):
def __init__(self,
message_text,
parse_mode=DEFAULT_NONE,
disable_web_page_preview=None,
disable_web_page_preview=DEFAULT_NONE,
**kwargs):
# Required
self.message_text = message_text