From 51a52e2b0e54031cce5876f54d1d48c268b5441c Mon Sep 17 00:00:00 2001 From: jesopo Date: Wed, 26 Sep 2018 18:27:17 +0100 Subject: Switch to using @Utils.hook and docstrings for event hooks --- modules/quit.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'modules/quit.py') diff --git a/modules/quit.py b/modules/quit.py index 5d40a718..817bb041 100644 --- a/modules/quit.py +++ b/modules/quit.py @@ -1,4 +1,5 @@ import random +from src import ModuleManager, Utils QUOTES = { "You can build a throne with bayonets, but it's difficult to sit on it." : "Boris Yeltsin", @@ -54,10 +55,8 @@ QUOTES = { "I don’t need to understand how encryption works" : "Amber Rudd", } -class Module(object): - def __init__(self, bot, events, exports): - events.on("get.quit-quote").hook(self.quote) - +class Module(ModuleManager.BaseModule): + @Utils.hook("get.quit-quote") def quote(self, event): quote = random.choice(list(QUOTES.items())) return (" - " if quote[1] else "").join(quote) -- cgit v1.3.1-10-gc9f91