From b92abaf20d17782c9ee46f0b17ffe670a6f04df1 Mon Sep 17 00:00:00 2001 From: Evelyn Date: Tue, 1 Nov 2016 21:18:43 +0000 Subject: [PATCH] Start of tflstop command --- modules/tfl.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/modules/tfl.py b/modules/tfl.py index a62bbcae..e3c3a692 100644 --- a/modules/tfl.py +++ b/modules/tfl.py @@ -34,6 +34,10 @@ class Module(object): ).hook(self.vehicle, min_args=1, help="Get information for a given vehicle", usage="") + bot.events.on("received").on("command").on("tflstop" + ).hook(self.stop, min_args=1, + help="Get information for a given stop", + usage="") def vehicle_span(self, arrival_time, human=True): vehicle_due_iso8601 = arrival_time @@ -201,3 +205,9 @@ class Module(object): vehicle["vehicleId"], vehicle["lineName"], vehicle["destinationName"], vehicle["currentLocation"], vehicle["stationName"], vehicle["naptanId"], arrival_time, platform)) + def stop(self, event): + app_id = self.bot.config["tfl-api-id"] + app_key = self.bot.config["tfl-api-key"] + + stop = Utils.get_url(URL_STOP % vehicle_id, get_params={ + "app_id": app_id, "app_key": app_key}, json=True)