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/hash.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'modules/hash.py') diff --git a/modules/hash.py b/modules/hash.py index e123da9a..4508d613 100644 --- a/modules/hash.py +++ b/modules/hash.py @@ -1,12 +1,12 @@ import hashlib +from src import ModuleManager, Utils -class Module(object): - def __init__(self, bot, events, exports): - self.bot = bot - events.on("received.command.hash").hook(self.hash, min_args=2, - help="Hash a string", usage=" ") - +class Module(ModuleManager.BaseModule): + @Utils.hook("received.command.hash", min_args=2, usage=" ") def hash(self, event): + """ + Hash a given string with a given algorithm + """ algorithm = event["args_split"][0].lower() if algorithm in hashlib.algorithms_available: phrase = " ".join(event["args_split"][1:]) -- cgit v1.3.1-10-gc9f91