diff options
| author | 2018-09-26 18:27:17 +0100 | |
|---|---|---|
| committer | 2018-09-26 18:27:17 +0100 | |
| commit | 51a52e2b0e54031cce5876f54d1d48c268b5441c (patch) | |
| tree | a4c0e8e86c55aa701b06297d5b5a2ceebeaab60d /modules/8ball.py | |
| parent | Also use docstrings to check if a command has help available, allow one-string (diff) | |
Switch to using @Utils.hook and docstrings for event hooks
Diffstat (limited to 'modules/8ball.py')
| -rw-r--r-- | modules/8ball.py | 16 |
1 files changed, 6 insertions, 10 deletions
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="<question>" - ) - +class Module(ModuleManager.BaseModule): + @Utils.hook("received.command.8ball", min_args=1, usage="<question>") 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))) |
