diff --git a/telebot/__init__.py b/telebot/__init__.py index 5f379e9..570ec76 100644 --- a/telebot/__init__.py +++ b/telebot/__init__.py @@ -190,7 +190,8 @@ class TeleBot: result = apihelper.get_user_profile_photos(self.token, user_id, offset, limit) 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. @@ -202,11 +203,12 @@ class TeleBot: :param disable_web_page_preview: :param reply_to_message_id: :param reply_markup: + :param parse_mode: :return: API reply. """ return types.Message.de_json( 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): """ diff --git a/telebot/apihelper.py b/telebot/apihelper.py index 66cb6e3..ed511e1 100644 --- a/telebot/apihelper.py +++ b/telebot/apihelper.py @@ -61,7 +61,8 @@ def get_me(token): 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. :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 if 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')