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:
parent
13327c371a
commit
f873658aac
@ -460,9 +460,10 @@ class TeleBot:
|
|||||||
def answer_callback_query(self, callback_query_id, text=None, show_alert=None):
|
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)
|
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):
|
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))
|
disable_web_page_preview, reply_markup))
|
||||||
|
|
||||||
def reply_to(self, message, text, **kwargs):
|
def reply_to(self, message, text, **kwargs):
|
||||||
|
@ -313,10 +313,12 @@ def unban_chat_member(token, chat_id, user_id):
|
|||||||
|
|
||||||
# Updating messages
|
# 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):
|
disable_web_page_preview=None, reply_markup=None):
|
||||||
method_url = r'editMessageText'
|
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:
|
if message_id:
|
||||||
payload['message_id'] = message_id
|
payload['message_id'] = message_id
|
||||||
if inline_message_id:
|
if inline_message_id:
|
||||||
|
@ -328,7 +328,7 @@ class TestTeleBot:
|
|||||||
def test_edit_message_text(self):
|
def test_edit_message_text(self):
|
||||||
tb = telebot.TeleBot(TOKEN)
|
tb = telebot.TeleBot(TOKEN)
|
||||||
msg = tb.send_message(CHAT_ID, 'Test')
|
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'
|
assert new_msg.text == 'Edit test'
|
||||||
|
|
||||||
def create_text_message(self, text):
|
def create_text_message(self, text):
|
||||||
|
Loading…
Reference in New Issue
Block a user