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

Fix edit message error.

This commit is contained in:
eternnoir 2016-04-14 15:06:46 +08:00
parent 13327c371a
commit f873658aac
3 changed files with 9 additions and 6 deletions

View File

@ -460,9 +460,10 @@ class TeleBot:
def answer_callback_query(self, callback_query_id, text=None, show_alert=None):
return apihelper.answer_callback_query(self.token, callback_query_id, text, show_alert)
def edit_message_text(self, chat_id, text, message_id=None, inline_message_id=None, parse_mode=None,
def edit_message_text(self, text, chat_id=None, message_id=None, inline_message_id=None, parse_mode=None,
disable_web_page_preview=None, reply_markup=None):
return types.Message.de_json(apihelper.edit_message_text(self.token, chat_id, text, message_id, inline_message_id, parse_mode,
return types.Message.de_json(
apihelper.edit_message_text(self.token, text, chat_id, message_id, inline_message_id, parse_mode,
disable_web_page_preview, reply_markup))
def reply_to(self, message, text, **kwargs):

View File

@ -313,10 +313,12 @@ def unban_chat_member(token, chat_id, user_id):
# Updating messages
def edit_message_text(token, chat_id, text, message_id=None, inline_message_id=None, parse_mode=None,
def edit_message_text(token, text, chat_id=None, message_id=None, inline_message_id=None, parse_mode=None,
disable_web_page_preview=None, reply_markup=None):
method_url = r'editMessageText'
payload = {'chat_id': chat_id, 'text': text}
payload = {'text': text}
if chat_id:
payload['chat_id'] = chat_id
if message_id:
payload['message_id'] = message_id
if inline_message_id:

View File

@ -328,7 +328,7 @@ class TestTeleBot:
def test_edit_message_text(self):
tb = telebot.TeleBot(TOKEN)
msg = tb.send_message(CHAT_ID, 'Test')
new_msg = tb.edit_message_text(CHAT_ID, 'Edit test', message_id=msg.message_id)
new_msg = tb.edit_message_text('Edit test', chat_id=CHAT_ID, message_id=msg.message_id)
assert new_msg.text == 'Edit test'
def create_text_message(self, text):