Réponse en md plutôt que html pour un meilleur rendu sur Element
This commit is contained in:
24
tcl.py
24
tcl.py
@@ -144,7 +144,8 @@ class Tcl(Plugin):
|
||||
|
||||
|
||||
url = 'https://download.data.grandlyon.com/ws/rdata/tcl_sytral.tclpassagearret/all.json?maxfeatures=2000&start=1'
|
||||
respText = "<h3>Prochains départs " + nomArret + " :</h3><ul>"
|
||||
#respText = "<h3>Prochains départs " + nomArret + " :</h3><ul>"
|
||||
respText = "### Prochains départs " + nomArret + " :\n"
|
||||
self.log.info(respText)
|
||||
lines = []
|
||||
while len(url) > 0:
|
||||
@@ -198,27 +199,32 @@ class Tcl(Plugin):
|
||||
newterm.add_horaire(value["delaipassage"])
|
||||
newLine.add_terminus(newterm)
|
||||
lines.append(newLine)
|
||||
respText += "<ul>"
|
||||
#respText += "<ul>"
|
||||
for line in lines:
|
||||
self.log.info("Ligne " + line.get_name())
|
||||
respText += "<li><h5>Ligne " + line.get_name() + "</h5></li>"
|
||||
#respText += "<li><h5>Ligne " + line.get_name() + "</h5></li>"
|
||||
respText += "#### Ligne " + line.get_name() + "\n"
|
||||
terms = line.get_all_terminus()
|
||||
for t in terms:
|
||||
self.log.info(t.get_name())
|
||||
respText += "<b>Direction " + t.get_name() + "</b><ul>"
|
||||
#respText += "<b>Direction " + t.get_name() + "</b><ul>"
|
||||
respText += "***Direction " + t.get_name() + "***\n"
|
||||
hs = t.get_horaires()
|
||||
hs.sort()
|
||||
for idx, h in enumerate(hs):
|
||||
self.log.info(h)
|
||||
if h == 0:
|
||||
respText += "<li>Proche</li>"
|
||||
#respText += "<li>Proche</li>"
|
||||
respText += "- Proche\n"
|
||||
else:
|
||||
respText += "<li>" + str(h) + " min</li>"
|
||||
#respText += "<li>" + str(h) + " min</li>"
|
||||
respText += "- " + str(h) + " min\n"
|
||||
if idx == 2: ##On limite à 3 items
|
||||
break
|
||||
respText += "</ul>"
|
||||
respText += "</ul>"
|
||||
await evt.respond(respText, allow_html=True)
|
||||
respText += "\n"
|
||||
#respText += "</ul>"
|
||||
#respText += "</ul>"
|
||||
await evt.respond(respText)#, allow_html=True)
|
||||
|
||||
|
||||
@classmethod
|
||||
|
||||
Reference in New Issue
Block a user