Allow ModuleHook hooks to be defined as string for a single hook for list for a multiple hooks->1 method relationship
This commit is contained in:
parent
1e8607f616
commit
49b8c4785a
|
@ -385,7 +385,11 @@ class PyIRCBot(asynchat.async_chat):
|
||||||
:type module: object"""
|
:type module: object"""
|
||||||
" activate a module's hooks "
|
" activate a module's hooks "
|
||||||
for hook in module.hooks:
|
for hook in module.hooks:
|
||||||
self.addHook(hook.hook, hook.method)
|
if type(hook.hook) == list:
|
||||||
|
for hookcmd in hook.hook:
|
||||||
|
self.addHook(hookcmd, hook.method)
|
||||||
|
else:
|
||||||
|
self.addHook(hook.hook, hook.method)
|
||||||
|
|
||||||
def unloadModuleHooks(self, module):
|
def unloadModuleHooks(self, module):
|
||||||
"""**Internal.** Disable (disconnect) hooks of a module
|
"""**Internal.** Disable (disconnect) hooks of a module
|
||||||
|
@ -394,7 +398,11 @@ class PyIRCBot(asynchat.async_chat):
|
||||||
:type module: object"""
|
:type module: object"""
|
||||||
" remove a modules hooks "
|
" remove a modules hooks "
|
||||||
for hook in module.hooks:
|
for hook in module.hooks:
|
||||||
self.removeHook(hook.hook, hook.method)
|
if type(hook.hook) == list:
|
||||||
|
for hookcmd in hook.hook:
|
||||||
|
self.removeHook(hookcmd, hook.method)
|
||||||
|
else:
|
||||||
|
self.removeHook(hook.hook, hook.method)
|
||||||
|
|
||||||
def addHook(self, command, method):
|
def addHook(self, command, method):
|
||||||
"""**Internal.** Enable (connect) a single hook of a module
|
"""**Internal.** Enable (connect) a single hook of a module
|
||||||
|
|
Loading…
Reference in New Issue