From 6da88c97511ce894e02cf2310f57b6c1eb1f8380 Mon Sep 17 00:00:00 2001 From: eternnoir Date: Mon, 29 Aug 2016 20:21:56 +0800 Subject: [PATCH] FIx #225 --- telebot/__init__.py | 8 +++++--- tests/test_telebot.py | 6 ++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/telebot/__init__.py b/telebot/__init__.py index 25e2e20..dbd0df5 100644 --- a/telebot/__init__.py +++ b/telebot/__init__.py @@ -549,9 +549,11 @@ class TeleBot: ) def edit_message_caption(self, caption, chat_id=None, message_id=None, inline_message_id=None, reply_markup=None): - return types.Message.de_json( - apihelper.edit_message_caption(self.token, caption, chat_id, message_id, inline_message_id, reply_markup) - ) + result = apihelper.edit_message_caption(self.token, caption, chat_id, message_id, inline_message_id, reply_markup) + if isinstance(result, bool): + return result + else: + return types.Message.de_json(result) def reply_to(self, message, text, **kwargs): """ diff --git a/tests/test_telebot.py b/tests/test_telebot.py index 6480df0..75409c3 100644 --- a/tests/test_telebot.py +++ b/tests/test_telebot.py @@ -352,6 +352,12 @@ class TestTeleBot: new_msg = tb.edit_message_text('Edit test', chat_id=CHAT_ID, message_id=msg.message_id) assert new_msg.text == 'Edit test' + def test_edit_message_text(self): + tb = telebot.TeleBot(TOKEN) + msg = tb.send_message(CHAT_ID, 'Test') + new_msg = tb.edit_message_text(caption='Edit test', chat_id=CHAT_ID, message_id=msg.message_id) + assert new_msg.text == 'Test' + def test_get_chat(self): tb = telebot.TeleBot(TOKEN) ch = tb.get_chat(GROUP_ID)