From b7cf524e9869828ff85954cb731f7fee98bee8d9 Mon Sep 17 00:00:00 2001 From: jesopo Date: Fri, 31 Aug 2018 12:55:52 +0100 Subject: Give modules event objects with "context"s, to facilitate purging all the event hooks for a module --- modules/tfl.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'modules/tfl.py') diff --git a/modules/tfl.py b/modules/tfl.py index 2a017f1d..72862db6 100644 --- a/modules/tfl.py +++ b/modules/tfl.py @@ -20,30 +20,30 @@ PLATFORM_TYPES = ["Northbound", "Southbound", "Eastbound", "Westbound", "Inner R class Module(object): _name = "TFL" - def __init__(self, bot): + def __init__(self, bot, events): self.bot = bot self.result_map = {} - bot.events.on("received").on("command").on("tflbus" + events.on("received").on("command").on("tflbus" ).hook(self.bus, min_args=1, help="Get bus due times for a TfL bus stop", usage="") - bot.events.on("received").on("command").on("tflline" + events.on("received").on("command").on("tflline" ).hook(self.line, help="Get line status for TfL underground lines", usage="") - bot.events.on("received").on("command").on("tflsearch" + events.on("received").on("command").on("tflsearch" ).hook(self.search, min_args=1, help="Get a list of TfL stop IDs for a given name", usage="") - bot.events.on("received").on("command").on("tflvehicle" + events.on("received").on("command").on("tflvehicle" ).hook(self.vehicle, min_args=1, help="Get information for a given vehicle", usage="") - bot.events.on("received").on("command").on("tflstop" + events.on("received").on("command").on("tflstop" ).hook(self.stop, min_args=1, help="Get information for a given stop", usage="") - bot.events.on("received").on("command").on("tflservice" + events.on("received").on("command").on("tflservice" ).hook(self.service, min_args=1, help="Get service information and arrival estimates", usage="") -- cgit v1.3.1-10-gc9f91