When editing message, make each message reply to the previous

This commit is contained in:
Davte 2019-07-17 23:55:59 +02:00
parent c331313f85
commit 568694f3aa
2 changed files with 14 additions and 11 deletions

View File

@ -7,7 +7,7 @@ __author__ = "Davide Testa"
__email__ = "davide@davte.it"
__credits__ = ["Marco Origlia", "Nick Lee @Nickoala"]
__license__ = "GNU General Public License v3.0"
__version__ = "2.1.5"
__version__ = "2.1.6"
__maintainer__ = "Davide Testa"
__contact__ = "t.me/davte"

View File

@ -973,7 +973,7 @@ class Bot(TelegramBot, ObjectWithDatabase):
message_id = message_identifier['message_id']
if 'inline_message_id' in message_identifier:
inline_message_id = message_identifier['inline_message_id']
for i, text_chunk in enumerate(
for i, (text_chunk, is_last) in enumerate(
self.split_message_text(
text=text,
limit=self.__class__.TELEGRAM_MESSAGES_MAX_LEN - 200,
@ -995,16 +995,19 @@ class Bot(TelegramBot, ObjectWithDatabase):
# Inline keyboards attached to inline query results may be
# in chats the bot cannot reach.
break
updates = [update]
else:
await self.send_message(
text=text_chunk,
chat_id=chat_id,
parse_mode=parse_mode,
disable_web_page_preview=disable_web_page_preview,
reply_markup=reply_markup,
update=update,
reply_to_update=True,
send_default_keyboard=False
updates.append(
await self.send_message(
text=text_chunk,
chat_id=chat_id,
parse_mode=parse_mode,
disable_web_page_preview=disable_web_page_preview,
reply_markup=(reply_markup if is_last else None),
update=updates[-1],
reply_to_update=True,
send_default_keyboard=False
)
)
return edited_message