From d8ff415bb1869ff354743c41f2b5fe189747d6ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Ml=C3=A1dek?= Date: Sat, 27 Feb 2021 09:52:47 +0100 Subject: [PATCH] remove empty lines in messages --- bot.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bot.py b/bot.py index 7169730..1627e93 100644 --- a/bot.py +++ b/bot.py @@ -1,6 +1,7 @@ import asyncio import logging import pickle +import re import textwrap from asyncio import sleep @@ -44,7 +45,7 @@ def process_event(event, template): description = description or "???" description = textwrap.shorten(description, width=512, placeholder="...") - return template.format( + output = template.format( title=event.name, date=date, location=location, @@ -53,6 +54,10 @@ def process_event(event, template): description=description ) + output = re.sub(r'(
)+', '
', output) + + return output + async def send_message(text): async with aiohttp.ClientSession() as session: