From 59d11fcb8229ee7a2c0459f574c2d3f937f9dbf4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Ml=C3=A1dek?= Date: Wed, 16 Oct 2019 10:29:45 +0200 Subject: [PATCH] improve name formatting --- dudlebot.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dudlebot.py b/dudlebot.py index 113f7d3..a530a7c 100644 --- a/dudlebot.py +++ b/dudlebot.py @@ -12,7 +12,7 @@ from telegram.ext import Updater, CommandHandler, PicklePersistence class DudleBot: - LINE_LIMIT = 9 + LINE_LIMIT = 8 def __init__(self, token): self.logger = logging.getLogger("dudle") @@ -139,8 +139,8 @@ class DudleBot: for response in responses: formatted_plan += f"{str(response)} " - formatted_plan += entry.name if len(entry.name) < self.LINE_LIMIT \ - else entry.name[:self.LINE_LIMIT - 2] + "…" + formatted_plan += entry.name if len(entry.name) <= self.LINE_LIMIT \ + else entry.name[:self.LINE_LIMIT - 1].strip() + "…" formatted_plan += "\n" formatted_plan += "```"