Meilleur affichage des messages long
This commit is contained in:
7
tcl.py
7
tcl.py
@@ -8,6 +8,7 @@ import asyncio
|
|||||||
import json
|
import json
|
||||||
import base64
|
import base64
|
||||||
import difflib
|
import difflib
|
||||||
|
import re
|
||||||
|
|
||||||
|
|
||||||
class Terminus:
|
class Terminus:
|
||||||
@@ -148,8 +149,12 @@ class Tcl(Plugin):
|
|||||||
msg.append(value["message"])
|
msg.append(value["message"])
|
||||||
debut = datetime.fromisoformat(value["debut"])
|
debut = datetime.fromisoformat(value["debut"])
|
||||||
fin = datetime.fromisoformat(value["fin"])
|
fin = datetime.fromisoformat(value["fin"])
|
||||||
|
newMsg = value["message"].replace('\t', '<br>')
|
||||||
|
newMsg = re.sub(r"(?<![ '-])[A-Z]", r"<br>\g<0>", newMsg)
|
||||||
|
newMsg = newMsg.replace('<br> <br>', '<br>')
|
||||||
|
self.log.info(newMsg)
|
||||||
respText = "<h3>" + value["type"] + "</h3><p><strong>" + value["titre"] + "</strong></p><p>" \
|
respText = "<h3>" + value["type"] + "</h3><p><strong>" + value["titre"] + "</strong></p><p>" \
|
||||||
+ value["message"] + "</p><strong>" + debut.strftime("%d/%m/%Y à %H:%M") + " au " \
|
+ newMsg + "</p><strong>" + debut.strftime("%d/%m/%Y à %H:%M") + " au " \
|
||||||
+ fin.strftime("%d/%m/%Y à %H:%M") + "</strong></p>"
|
+ fin.strftime("%d/%m/%Y à %H:%M") + "</strong></p>"
|
||||||
await evt.respond(respText, allow_html=True)
|
await evt.respond(respText, allow_html=True)
|
||||||
if(alerte==False):
|
if(alerte==False):
|
||||||
|
|||||||
Reference in New Issue
Block a user