diff --git a/plugins/plugin_manager.py b/plugins/plugin_manager.py index cecf75d65..1cfd76cfa 100644 --- a/plugins/plugin_manager.py +++ b/plugins/plugin_manager.py @@ -151,6 +151,8 @@ def activate_plugins(self): # 生成新开启的插件实例 self.disable_plugin(name) failed_plugins.append(name) continue + if name in self.instances: + self.instances[name].handlers.clear() self.instances[name] = instance for event in instance.handlers: if event not in self.listening_plugins: @@ -165,6 +167,8 @@ def reload_plugin(self, name: str): for event in self.listening_plugins: if name in self.listening_plugins[event]: self.listening_plugins[event].remove(name) + if name in self.instances: + self.instances[name].handlers.clear() del self.instances[name] self.activate_plugins() return True