remove empty lines in messages
This commit is contained in:
parent
b523d3b547
commit
d8ff415bb1
1 changed files with 6 additions and 1 deletions
7
bot.py
7
bot.py
|
@ -1,6 +1,7 @@
|
||||||
import asyncio
|
import asyncio
|
||||||
import logging
|
import logging
|
||||||
import pickle
|
import pickle
|
||||||
|
import re
|
||||||
import textwrap
|
import textwrap
|
||||||
from asyncio import sleep
|
from asyncio import sleep
|
||||||
|
|
||||||
|
@ -44,7 +45,7 @@ def process_event(event, template):
|
||||||
description = description or "???"
|
description = description or "???"
|
||||||
description = textwrap.shorten(description, width=512, placeholder="...")
|
description = textwrap.shorten(description, width=512, placeholder="...")
|
||||||
|
|
||||||
return template.format(
|
output = template.format(
|
||||||
title=event.name,
|
title=event.name,
|
||||||
date=date,
|
date=date,
|
||||||
location=location,
|
location=location,
|
||||||
|
@ -53,6 +54,10 @@ def process_event(event, template):
|
||||||
description=description
|
description=description
|
||||||
)
|
)
|
||||||
|
|
||||||
|
output = re.sub(r'(<br>)+', '<br>', output)
|
||||||
|
|
||||||
|
return output
|
||||||
|
|
||||||
|
|
||||||
async def send_message(text):
|
async def send_message(text):
|
||||||
async with aiohttp.ClientSession() as session:
|
async with aiohttp.ClientSession() as session:
|
||||||
|
|
Loading…
Reference in a new issue