From 5554783d791a9885784a5f4f86276c9b2e0574a6 Mon Sep 17 00:00:00 2001 From: bakatrouble Date: Mon, 10 Apr 2023 03:55:29 +0300 Subject: [PATCH] split list message --- main.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index 7b51d51..3d491a0 100644 --- a/main.py +++ b/main.py @@ -132,7 +132,14 @@ async def list_tags(msg: Message): tags.sort() lines = [] for tag in tags: - lines.append(f'- {tag} [/del_{tag}]') + entry = f'- {tag} [/del_{tag}]' + if len('\n'.join(lines + [entry])) > 4096: + lines = "\n".join(lines) + await msg.reply(f'Monitored tags:\n\n{lines}') + lines = [entry] + else: + lines.append(f'- {tag} [/del_{tag}]') + lines = "\n".join(lines) await msg.reply(f'Monitored tags:\n\n{lines}')