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/8ball.py | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'modules/8ball.py') diff --git a/modules/8ball.py b/modules/8ball.py index 37d38743..ebfb1b0c 100644 --- a/modules/8ball.py +++ b/modules/8ball.py @@ -1,5 +1,5 @@ import random -from src import Utils +from src import ModuleManager, Utils CHOICES = [ "Definitely", @@ -28,15 +28,11 @@ CHOICES = [ "Sources say maybe" ] -class Module(object): - def __init__(self, bot, events, exports): - events.on("received.command.8ball").hook( - self.decide, - min_args=1, - help="Ask the mystic 8ball a question!", - usage="" - ) - +class Module(ModuleManager.BaseModule): + @Utils.hook("received.command.8ball", min_args=1, usage="") def decide(selfs, event): + """ + Ask the mystic 8ball a question! + """ event["stdout"].write("You shake the magic ball... it " "says " + Utils.bold(random.choice(CHOICES))) -- cgit v1.3.1-10-gc9f91