mirror of
https://github.com/Mayuri-Chan/pyrofork.git
synced 2026-01-08 07:54:52 +00:00
Fix stackable plugin decorators with include/exclude directives (#643)
* combination of decorators with plugins has solved * fixing last pr: allow stackable plugin decorators even in exclude and include as well. * counting plugins has fixed * fix indentation * Update client.py * Update client.py Co-authored-by: Dan <14043624+delivrance@users.noreply.github.com>
This commit is contained in:
parent
b6613fbd63
commit
73a1fee28a
1 changed files with 13 additions and 15 deletions
|
|
@ -724,7 +724,7 @@ class Client(Methods, Scaffold):
|
||||||
log.info('[{}] [LOAD] {}("{}") in group {} from "{}"'.format(
|
log.info('[{}] [LOAD] {}("{}") in group {} from "{}"'.format(
|
||||||
self.session_name, type(handler).__name__, name, group, module_path))
|
self.session_name, type(handler).__name__, name, group, module_path))
|
||||||
|
|
||||||
count += 1
|
count += 1
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
|
|
@ -749,15 +749,14 @@ class Client(Methods, Scaffold):
|
||||||
for name in handlers:
|
for name in handlers:
|
||||||
# noinspection PyBroadException
|
# noinspection PyBroadException
|
||||||
try:
|
try:
|
||||||
handler, group = getattr(module, name).handler
|
for handler, group in getattr(module, name).handlers:
|
||||||
|
if isinstance(handler, Handler) and isinstance(group, int):
|
||||||
|
self.add_handler(handler, group)
|
||||||
|
|
||||||
if isinstance(handler, Handler) and isinstance(group, int):
|
log.info('[{}] [LOAD] {}("{}") in group {} from "{}"'.format(
|
||||||
self.add_handler(handler, group)
|
self.session_name, type(handler).__name__, name, group, module_path))
|
||||||
|
|
||||||
log.info('[{}] [LOAD] {}("{}") in group {} from "{}"'.format(
|
count += 1
|
||||||
self.session_name, type(handler).__name__, name, group, module_path))
|
|
||||||
|
|
||||||
count += 1
|
|
||||||
except Exception:
|
except Exception:
|
||||||
if warn_non_existent_functions:
|
if warn_non_existent_functions:
|
||||||
log.warning('[{}] [LOAD] Ignoring non-existent function "{}" from "{}"'.format(
|
log.warning('[{}] [LOAD] Ignoring non-existent function "{}" from "{}"'.format(
|
||||||
|
|
@ -785,15 +784,14 @@ class Client(Methods, Scaffold):
|
||||||
for name in handlers:
|
for name in handlers:
|
||||||
# noinspection PyBroadException
|
# noinspection PyBroadException
|
||||||
try:
|
try:
|
||||||
handler, group = getattr(module, name).handler
|
for handler, group in getattr(module, name).handlers:
|
||||||
|
if isinstance(handler, Handler) and isinstance(group, int):
|
||||||
|
self.remove_handler(handler, group)
|
||||||
|
|
||||||
if isinstance(handler, Handler) and isinstance(group, int):
|
log.info('[{}] [UNLOAD] {}("{}") from group {} in "{}"'.format(
|
||||||
self.remove_handler(handler, group)
|
self.session_name, type(handler).__name__, name, group, module_path))
|
||||||
|
|
||||||
log.info('[{}] [UNLOAD] {}("{}") from group {} in "{}"'.format(
|
count -= 1
|
||||||
self.session_name, type(handler).__name__, name, group, module_path))
|
|
||||||
|
|
||||||
count -= 1
|
|
||||||
except Exception:
|
except Exception:
|
||||||
if warn_non_existent_functions:
|
if warn_non_existent_functions:
|
||||||
log.warning('[{}] [UNLOAD] Ignoring non-existent function "{}" from "{}"'.format(
|
log.warning('[{}] [UNLOAD] Ignoring non-existent function "{}" from "{}"'.format(
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue