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/quotes.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'modules/quotes.py') diff --git a/modules/quotes.py b/modules/quotes.py index d09bba58..69b1d79b 100644 --- a/modules/quotes.py +++ b/modules/quotes.py @@ -1,21 +1,21 @@ import random, time class Module(object): - def __init__(self, bot): + def __init__(self, bot, events): self.bot = bot - bot.events.on("received").on("command").on("quoteadd", + events.on("received").on("command").on("quoteadd", "qadd").hook(self.quote_add, min_args=1, help="Added a quote to a category", usage=" = ") - bot.events.on("received").on("command").on("quoteget", + events.on("received").on("command").on("quoteget", "qget").hook(self.quote_get, min_args=1, help="Find a quote within a category", usage=" = ") - bot.events.on("received").on("command").on("quotedel", + events.on("received").on("command").on("quotedel", "qdel").hook(self.quote_del, min_args=1, help="Delete a quote from a category", usage=" = ") - bot.events.on("received").on("command").on("quote", + events.on("received").on("command").on("quote", "q").hook(self.quote, min_args=1, help="Get a random quote from a category", usage="") -- cgit v1.3.1-10-gc9f91