fix signed message exceeding limit

This commit is contained in:
bakatrouble 2019-03-16 01:27:53 +03:00
parent 226bbd5bf7
commit 53a6dc6d7e

View File

@ -124,10 +124,12 @@ def _sign_text(text, m: Message, limit):
if not text: if not text:
text = '' text = ''
sign = ''
if text.startswith('!sign') or text.startswith('/sign'): if text.startswith('!sign') or text.startswith('/sign'):
text = text[5:] + f'\n\n____________\n' \ sign = f'\n\n____________\n' \
f'by <a href="tg://user?id={m.from_user.id}">{escape(m.from_user.full_name)}</a>' f'by <a href="tg://user?id={m.from_user.id}">{escape(m.from_user.full_name)}</a>'
return text[:limit]
return text[:limit - len(sign)] + sign
def _process_message(bot: Bot, m: Message): def _process_message(bot: Bot, m: Message):