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/shakespeare.py | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'modules/shakespeare.py') diff --git a/modules/shakespeare.py b/modules/shakespeare.py index bc4a9900..99d4ba2d 100644 --- a/modules/shakespeare.py +++ b/modules/shakespeare.py @@ -1,5 +1,5 @@ import random -from src import Utils +from src import ModuleManager, Utils INSULT_INTRO = ["Thou art a", "Ye", "Thou", "Thy", "Thee"] @@ -51,14 +51,8 @@ INSULT_PART_3 = ["apple-john", "baggage", "barnacle", "bladder", "boar-pig", "vassal", "whey-face", "wagtail"] -class Module(object): - - def __init__(self, bot, events, exports): - self.bot = bot - self.events = events - - events.on("received.command.insult").hook(self.dispense_insult) - +class Module(ModuleManager.BaseModule): + @Utils.hook("received.command.insult") def dispense_insult(self, event): insult = [random.choice(INSULT_INTRO), random.choice(INSULT_PART_1), random.choice(INSULT_PART_2), random.choice(INSULT_PART_3)] -- cgit v1.3.1-10-gc9f91