Renome to default_parse_mode

This commit is contained in:
Bibo-Joshi 2019-08-28 15:18:30 +02:00
parent 04de5a54f4
commit bfe773b4af
2 changed files with 11 additions and 9 deletions

View file

@ -82,15 +82,15 @@ class Bot(TelegramObject):
:obj:`telegram.utils.request.Request`. :obj:`telegram.utils.request.Request`.
private_key (:obj:`bytes`, optional): Private key for decryption of telegram passport data. private_key (:obj:`bytes`, optional): Private key for decryption of telegram passport data.
private_key_password (:obj:`bytes`, optional): Password for above private key. private_key_password (:obj:`bytes`, optional): Password for above private key.
parse_mode (:obj:`str`, optional): Default parse mode used if not set explicitly in method default_parse_mode (:obj:`str`, optional): Default parse mode used if not set explicitly in
call. See the constants in :class:`telegram.ParseMode` for the available modes. method call. See the constants in :class:`telegram.ParseMode` for the available modes.
""" """
def __init__(self, token, base_url=None, base_file_url=None, request=None, private_key=None, def __init__(self, token, base_url=None, base_file_url=None, request=None, private_key=None,
private_key_password=None, parse_mode=None): private_key_password=None, default_parse_mode=None):
self.token = self._validate_token(token) self.token = self._validate_token(token)
self.default_parse_mode = parse_mode self.default_parse_mode = default_parse_mode
if base_url is None: if base_url is None:
base_url = 'https://api.telegram.org/bot' base_url = 'https://api.telegram.org/bot'
@ -1489,7 +1489,6 @@ class Bot(TelegramObject):
data.update(kwargs) data.update(kwargs)
result = self._request.post(url, data, timeout=timeout) result = self._request.post(url, data, timeout=timeout)
print(data)
return result return result

View file

@ -58,6 +58,8 @@ class Updater(object):
persistence (:class:`telegram.ext.BasePersistence`): Optional. The persistence class to persistence (:class:`telegram.ext.BasePersistence`): Optional. The persistence class to
store data that should be persistent over restarts. store data that should be persistent over restarts.
use_context (:obj:`bool`, optional): ``True`` if using context based callbacks. use_context (:obj:`bool`, optional): ``True`` if using context based callbacks.
default_parse_mode (:obj:`str`, optional): Default parse mode used if not set explicitly in
method call. See the constants in :class:`telegram.ParseMode` for the available modes.
Args: Args:
token (:obj:`str`, optional): The bot's token given by the @BotFather. token (:obj:`str`, optional): The bot's token given by the @BotFather.
@ -81,8 +83,8 @@ class Updater(object):
set this to ``True``. set this to ``True``.
persistence (:class:`telegram.ext.BasePersistence`, optional): The persistence class to persistence (:class:`telegram.ext.BasePersistence`, optional): The persistence class to
store data that should be persistent over restarts. store data that should be persistent over restarts.
parse_mode (:obj:`str`, optional): Default parse mode used if not set explicitly in method default_parse_mode (:obj:`str`, optional): Default parse mode used if not set explicitly in
call. See the constants in :class:`telegram.ParseMode` for the available modes. method call. See the constants in :class:`telegram.ParseMode` for the available modes.
Note: Note:
You must supply either a :attr:`bot` or a :attr:`token` argument. You must supply either a :attr:`bot` or a :attr:`token` argument.
@ -104,7 +106,7 @@ class Updater(object):
user_sig_handler=None, user_sig_handler=None,
request_kwargs=None, request_kwargs=None,
persistence=None, persistence=None,
parse_mode=None, default_parse_mode=None,
use_context=False): use_context=False):
if (token is None) and (bot is None): if (token is None) and (bot is None):
@ -137,7 +139,8 @@ class Updater(object):
request_kwargs['con_pool_size'] = con_pool_size request_kwargs['con_pool_size'] = con_pool_size
self._request = Request(**request_kwargs) self._request = Request(**request_kwargs)
self.bot = Bot(token, base_url, request=self._request, private_key=private_key, self.bot = Bot(token, base_url, request=self._request, private_key=private_key,
private_key_password=private_key_password, parse_mode=parse_mode) private_key_password=private_key_password,
default_parse_mode=default_parse_mode)
self.user_sig_handler = user_sig_handler self.user_sig_handler = user_sig_handler
self.update_queue = Queue() self.update_queue = Queue()
self.job_queue = JobQueue() self.job_queue = JobQueue()