Add ModuleManager.BaseModule so modules don't *have* to implement __init__
This commit is contained in:
parent
fcbb7c960c
commit
287d031281
2 changed files with 6 additions and 5 deletions
|
@ -2,6 +2,10 @@ import glob, imp, inspect, os, sys, uuid
|
||||||
|
|
||||||
BITBOT_HOOKS_MAGIC = "__bitbot_hooks"
|
BITBOT_HOOKS_MAGIC = "__bitbot_hooks"
|
||||||
|
|
||||||
|
class BaseModule(object):
|
||||||
|
def __init__(self, bot, events, exports):
|
||||||
|
pass
|
||||||
|
|
||||||
class ModuleManager(object):
|
class ModuleManager(object):
|
||||||
def __init__(self, bot, events, exports, directory="modules"):
|
def __init__(self, bot, events, exports, directory="modules"):
|
||||||
self.bot = bot
|
self.bot = bot
|
||||||
|
|
|
@ -1,9 +1,6 @@
|
||||||
import Utils
|
import ModuleManager, Utils
|
||||||
|
|
||||||
class Module(object):
|
|
||||||
def __init__(self, bot, events, exports):
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
class Module(ModuleManager.BaseModule):
|
||||||
@Utils.hook("received.command.ping", help="Ping pong!")
|
@Utils.hook("received.command.ping", help="Ping pong!")
|
||||||
def pong(self, event):
|
def pong(self, event):
|
||||||
event["stdout"].write("Pong!")
|
event["stdout"].write("Pong!")
|
||||||
|
|
Loading…
Reference in a new issue