Réparation conneries, putain de python
This commit is contained in:
50
tcl.py
50
tcl.py
@@ -30,8 +30,7 @@ class Terminus:
|
|||||||
if h == "Proche":
|
if h == "Proche":
|
||||||
inth.append(0)
|
inth.append(0)
|
||||||
else :
|
else :
|
||||||
if inth.count(int(h[:-4])) == 0:
|
inth.append(int(h[:-4]))
|
||||||
inth.append(int(h[:-4]))
|
|
||||||
inth.sort()
|
inth.sort()
|
||||||
return inth
|
return inth
|
||||||
|
|
||||||
@@ -73,6 +72,13 @@ class Tcl(Plugin):
|
|||||||
return(
|
return(
|
||||||
"""
|
"""
|
||||||
!tcl alerte ligne -> Retourne les alertes TCL sur la ligne donnée
|
!tcl alerte ligne -> Retourne les alertes TCL sur la ligne donnée
|
||||||
|
ligne peut être :
|
||||||
|
- Metros : A, B, C, D
|
||||||
|
- Trams : T1, T2 ...
|
||||||
|
- Renforcés : C1, C2 ...
|
||||||
|
- Bus : 1, 2 ...
|
||||||
|
- Funis : F1, F2
|
||||||
|
ATTENTION : Le bot ne vérifie pas que la ligne existe
|
||||||
!tcl horaires arrêt -> Retourne les horaires à l'arrêt
|
!tcl horaires arrêt -> Retourne les horaires à l'arrêt
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
@@ -93,6 +99,13 @@ class Tcl(Plugin):
|
|||||||
await evt.respond(
|
await evt.respond(
|
||||||
"""
|
"""
|
||||||
!tcl alerte ligne -> Retourne les alertes TCL sur la ligne donnée
|
!tcl alerte ligne -> Retourne les alertes TCL sur la ligne donnée
|
||||||
|
ligne peut être :
|
||||||
|
- Metros : A, B, C, D
|
||||||
|
- Trams : T1, T2 ...
|
||||||
|
- Renforcés : C1, C2 ...
|
||||||
|
- Bus : 1, 2 ...
|
||||||
|
- Funis : F1, F2
|
||||||
|
ATTENTTION : Le bot ne vérifie pas que la ligne existe
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
url = 'https://download.data.grandlyon.com/ws/rdata/tcl_sytral.tclalertetrafic_2/all.json?maxfeatures=200&start=1'
|
url = 'https://download.data.grandlyon.com/ws/rdata/tcl_sytral.tclalertetrafic_2/all.json?maxfeatures=200&start=1'
|
||||||
@@ -168,21 +181,22 @@ class Tcl(Plugin):
|
|||||||
|
|
||||||
for value in values:
|
for value in values:
|
||||||
if value["id"] in Ids:
|
if value["id"] in Ids:
|
||||||
# Les metros ont leur propre code
|
if value["type"] == "E": #Filtré sur les estimés et non théoriques
|
||||||
if value["coursetheorique"].split('-')[0] == "301A" :
|
# Les metros ont leur propre code
|
||||||
transport = "A"
|
if value["coursetheorique"].split('-')[0] == "301A" :
|
||||||
elif value["coursetheorique"].split('-')[0] == "303" :
|
transport = "A"
|
||||||
transport = "C"
|
elif value["coursetheorique"].split('-')[0] == "303" :
|
||||||
elif value["coursetheorique"].split('-')[0] == "325" :
|
transport = "C"
|
||||||
transport = "F1"
|
elif value["coursetheorique"].split('-')[0] == "325" :
|
||||||
elif value["coursetheorique"].split('-')[0] == "326" :
|
transport = "F1"
|
||||||
transport = "F2"
|
elif value["coursetheorique"].split('-')[0] == "326" :
|
||||||
elif value["coursetheorique"].split('-')[0] == "304" :
|
transport = "F2"
|
||||||
transport = "D"
|
elif value["coursetheorique"].split('-')[0] == "304" :
|
||||||
elif value["coursetheorique"].split('-')[0] == "302A" :
|
transport = "D"
|
||||||
transport = "B"
|
elif value["coursetheorique"].split('-')[0] == "302A" :
|
||||||
else:
|
transport = "B"
|
||||||
transport = value["coursetheorique"].split('-')[0][:-1]
|
else:
|
||||||
|
transport = value["coursetheorique"].split('-')[0][:-1]
|
||||||
|
|
||||||
found = False
|
found = False
|
||||||
for line in lines:
|
for line in lines:
|
||||||
@@ -207,8 +221,6 @@ class Tcl(Plugin):
|
|||||||
terms = line.get_all_terminus()
|
terms = line.get_all_terminus()
|
||||||
for t in terms:
|
for t in terms:
|
||||||
self.log.info(t.get_name())
|
self.log.info(t.get_name())
|
||||||
if t.get_name() == nomArret:
|
|
||||||
continue
|
|
||||||
respText += "***Direction " + t.get_name() + "***\n"
|
respText += "***Direction " + t.get_name() + "***\n"
|
||||||
hs = t.get_horaires()
|
hs = t.get_horaires()
|
||||||
hs.sort()
|
hs.sort()
|
||||||
|
|||||||
Reference in New Issue
Block a user