From 287d0312817f9668041c0192fa0c1985b7b10605 Mon Sep 17 00:00:00 2001 From: jesopo Date: Wed, 19 Sep 2018 13:28:18 +0100 Subject: [PATCH] Add ModuleManager.BaseModule so modules don't *have* to implement __init__ --- ModuleManager.py | 4 ++++ modules/pong.py | 7 ++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/ModuleManager.py b/ModuleManager.py index 29248a36..1ecb1f7a 100644 --- a/ModuleManager.py +++ b/ModuleManager.py @@ -2,6 +2,10 @@ import glob, imp, inspect, os, sys, uuid BITBOT_HOOKS_MAGIC = "__bitbot_hooks" +class BaseModule(object): + def __init__(self, bot, events, exports): + pass + class ModuleManager(object): def __init__(self, bot, events, exports, directory="modules"): self.bot = bot diff --git a/modules/pong.py b/modules/pong.py index d67da431..fc12d0c2 100644 --- a/modules/pong.py +++ b/modules/pong.py @@ -1,9 +1,6 @@ -import Utils - -class Module(object): - def __init__(self, bot, events, exports): - pass +import ModuleManager, Utils +class Module(ModuleManager.BaseModule): @Utils.hook("received.command.ping", help="Ping pong!") def pong(self, event): event["stdout"].write("Pong!")