Merge pull request #518 from RockChinQ/fix-cannot-disable-funcs-dynamically

[Fix] plugin启用禁用命令对内容函数不生效
This commit is contained in:
Junyan Qin 2023-07-30 23:56:01 +08:00 committed by GitHub
commit 4f5af0e8c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -188,6 +188,11 @@ class PluginOnOffCommand(AbstractCommandNode):
plugin_name = ctx.crt_params[0]
if plugin_name in plugin_list:
plugin_list[plugin_name]['enabled'] = new_status
for func in plugin_host.__callable_functions__:
if func['name'].startswith(plugin_name+"-"):
func['enabled'] = new_status
plugin_switch.dump_switch()
reply = ["[bot]已{}插件: {}".format("启用" if new_status else "禁用", plugin_name)]
else: