Modify hook handling
This commit is contained in:
parent
ee97d6f45e
commit
4382d91008
@ -181,9 +181,6 @@ class hook:
|
|||||||
self.__doc__ = self.func.__doc__
|
self.__doc__ = self.func.__doc__
|
||||||
return self
|
return self
|
||||||
|
|
||||||
def caller(self, *args):
|
|
||||||
return self.func(*args)
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def unhook(hookid):
|
def unhook(hookid):
|
||||||
for each in list(HOOKS):
|
for each in list(HOOKS):
|
||||||
|
@ -94,7 +94,7 @@ def unhandled(cli, prefix, cmd, *args):
|
|||||||
if isinstance(arg, bytes): largs[i] = arg.decode('ascii')
|
if isinstance(arg, bytes): largs[i] = arg.decode('ascii')
|
||||||
for fn in decorators.HOOKS.get(cmd, []):
|
for fn in decorators.HOOKS.get(cmd, []):
|
||||||
try:
|
try:
|
||||||
fn.caller(cli, prefix, *largs)
|
fn.func(cli, prefix, *largs)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
if botconfig.DEBUG_MODE:
|
if botconfig.DEBUG_MODE:
|
||||||
raise e
|
raise e
|
||||||
|
Loading…
x
Reference in New Issue
Block a user