From 53a6dc6d7ef56833bf5d8da687ca3e433aeb4ebf Mon Sep 17 00:00:00 2001 From: bakatrouble Date: Sat, 16 Mar 2019 01:27:53 +0300 Subject: [PATCH] fix signed message exceeding limit --- main.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index 0f8c275..62aa3b7 100755 --- a/main.py +++ b/main.py @@ -124,10 +124,12 @@ def _sign_text(text, m: Message, limit): if not text: text = '' + sign = '' if text.startswith('!sign') or text.startswith('/sign'): - text = text[5:] + f'\n\n____________\n' \ + sign = f'\n\n____________\n' \ f'by {escape(m.from_user.full_name)}' - return text[:limit] + + return text[:limit - len(sign)] + sign def _process_message(bot: Bot, m: Message):