1
0
mirror of https://github.com/eternnoir/pyTelegramBotAPI.git synced 2023-08-10 21:12:57 +03:00

Merge pull request #71 from eternnoir/implement-parse_mode

Implement parse_mode
This commit is contained in:
FrankWang 2015-09-09 08:22:13 +08:00
commit 85ffe9936d
2 changed files with 8 additions and 3 deletions

View File

@ -190,7 +190,8 @@ class TeleBot:
result = apihelper.get_user_profile_photos(self.token, user_id, offset, limit) result = apihelper.get_user_profile_photos(self.token, user_id, offset, limit)
return types.UserProfilePhotos.de_json(result) return types.UserProfilePhotos.de_json(result)
def send_message(self, chat_id, text, disable_web_page_preview=None, reply_to_message_id=None, reply_markup=None): def send_message(self, chat_id, text, disable_web_page_preview=None, reply_to_message_id=None, reply_markup=None,
parse_mode=None):
""" """
Use this method to send text messages. Use this method to send text messages.
@ -202,11 +203,12 @@ class TeleBot:
:param disable_web_page_preview: :param disable_web_page_preview:
:param reply_to_message_id: :param reply_to_message_id:
:param reply_markup: :param reply_markup:
:param parse_mode:
:return: API reply. :return: API reply.
""" """
return types.Message.de_json( return types.Message.de_json(
apihelper.send_message(self.token, chat_id, text, disable_web_page_preview, reply_to_message_id, apihelper.send_message(self.token, chat_id, text, disable_web_page_preview, reply_to_message_id,
reply_markup)) reply_markup, parse_mode))
def forward_message(self, chat_id, from_chat_id, message_id): def forward_message(self, chat_id, from_chat_id, message_id):
""" """

View File

@ -61,7 +61,8 @@ def get_me(token):
return _make_request(token, method_url) return _make_request(token, method_url)
def send_message(token, chat_id, text, disable_web_page_preview=None, reply_to_message_id=None, reply_markup=None): def send_message(token, chat_id, text, disable_web_page_preview=None, reply_to_message_id=None, reply_markup=None,
parse_mode=None):
""" """
Use this method to send text messages. On success, the sent Message is returned. Use this method to send text messages. On success, the sent Message is returned.
:param token: :param token:
@ -80,6 +81,8 @@ def send_message(token, chat_id, text, disable_web_page_preview=None, reply_to_m
payload['reply_to_message_id'] = reply_to_message_id payload['reply_to_message_id'] = reply_to_message_id
if reply_markup: if reply_markup:
payload['reply_markup'] = _convert_markup(reply_markup) payload['reply_markup'] = _convert_markup(reply_markup)
if parse_mode:
payload['parse_mode'] = parse_mode
return _make_request(token, method_url, params=payload, method='post') return _make_request(token, method_url, params=payload, method='post')