Trim backup history output to fit Telegram
This commit is contained in:
@@ -436,8 +436,16 @@ async def backup_history(msg: Message):
|
||||
if content.startswith("⚠️"):
|
||||
await msg.answer(content, reply_markup=backup_kb)
|
||||
return
|
||||
trimmed = False
|
||||
max_len = 3500
|
||||
if len(content) > max_len:
|
||||
content = content[-max_len:]
|
||||
trimmed = True
|
||||
header = "📜 Backup history (tail)"
|
||||
if trimmed:
|
||||
header += " (trimmed)"
|
||||
await msg.answer(
|
||||
f"📜 Backup history (tail)\n`{log_path}`\n```\n{content}\n```",
|
||||
f"{header}\n`{log_path}`\n```\n{content}\n```",
|
||||
reply_markup=backup_kb,
|
||||
parse_mode="Markdown",
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user