From 9e1c003743182591eafaaddbfd56b315a8a78daa Mon Sep 17 00:00:00 2001 From: KimigaiiWuyi <444835641@qq.com> Date: Fri, 7 Feb 2025 13:25:26 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20=E4=BF=AE=E5=A4=8D=E5=8A=A0?= =?UTF-8?q?=E8=BD=BD=E6=8F=92=E4=BB=B6Bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + gsuid_core/server.py | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 31aa08f..1a5244b 100644 --- a/.gitignore +++ b/.gitignore @@ -675,3 +675,4 @@ gsuid_core/plugins/* logs .pdm-python .pdm-build +.VSCodeCounter diff --git a/gsuid_core/server.py b/gsuid_core/server.py index dbf1c41..d27bde5 100644 --- a/gsuid_core/server.py +++ b/gsuid_core/server.py @@ -87,6 +87,7 @@ class GsServer: sys.path.append(str(plugin_path.parents)) if plugins_path.exists(): module_list = self.load_dir_plugins(plugin, plugin_parent) + return module_list elif nest_path.exists() or src_path.exists(): path = nest_path.parent / plugin.name pyproject = plugin / 'pyproject.toml' @@ -96,6 +97,7 @@ class GsServer: module_list = self.load_dir_plugins( path, plugin_parent, True ) + return module_list # 如果文件夹内有__init_.py,则视为单个插件包 elif plugin_path.exists(): module_list = [ @@ -103,6 +105,7 @@ class GsServer: f'{plugin_parent}.{plugin.name}.__init__' ) ] + return module_list # 如果发现单文件,则视为单文件插件 elif plugin.suffix == '.py': module_list = [ @@ -110,9 +113,9 @@ class GsServer: f'{plugin_parent}.{plugin.name[:-3]}' ) ] + return module_list '''导入成功''' logger.success(f'✅ 插件{plugin.stem}导入成功!') - return module_list except Exception as e: # noqa exception = sys.exc_info() logger.opt(exception=exception).error(f'加载插件时发生错误: {e}')