Response sender is not needed anymore, private channels are now better handled

This commit is contained in:
nemunaire 2014-09-18 07:57:06 +02:00
commit 772d68a34d
32 changed files with 161 additions and 182 deletions

View file

@ -24,17 +24,16 @@ def extractInformation(msg, transport, line, station=None):
times = ratp.getNextStopsAtStation(transport, line, station)
if len(times) > 0:
(time, direction, stationname) = times[0]
return Response(msg.sender, message=["\x03\x02"+time+"\x03\x02 direction "+direction for time, direction, stationname in times], title="Prochains passages du %s ligne %s à l'arrêt %s" %
return Response(message=["\x03\x02"+time+"\x03\x02 direction "+direction for time, direction, stationname in times], title="Prochains passages du %s ligne %s à l'arrêt %s" %
(transport, line, stationname), channel=msg.channel)
else:
return Response(msg.sender, "La station `%s' ne semble pas exister sur le %s ligne %s."
% (station, transport, line), msg.channel)
raise IRCException("La station `%s' ne semble pas exister sur le %s ligne %s."
% (station, transport, line))
else:
stations = ratp.getAllStations(transport, line)
if len(stations) > 0:
return Response(msg.sender, [s for s in stations], title="Stations", channel=msg.channel)
else:
return Response(msg.sender, "Aucune station trouvée.", msg.channel)
if len(stations) == 0:
raise IRCException("aucune station trouvée.")
return Response([s for s in stations], title="Stations", channel=msg.channel)
def ask_ratp(msg):
"""Hook entry from !ratp"""
@ -44,5 +43,5 @@ def ask_ratp(msg):
elif len(msg.cmds) == 3:
return extractInformation(msg, msg.cmds[1], msg.cmds[2])
else:
return Response(msg.sender, "Mauvais usage, merci de spécifier un type de transport et une ligne, ou de consulter l'aide du module.", msg.channel, msg.nick)
raise IRCException("Mauvais usage, merci de spécifier un type de transport et une ligne, ou de consulter l'aide du module.")
return False