Skip to content

Commit b0eb573

Browse files
authored
Merge pull request #2065 from AstrBotDevs/fix-plugin-metadata-load
Improve: add fallback for missing 'desc' in plugin metadata
2 parents fe35bfb + e57deb8 commit b0eb573

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

astrbot/core/star/star_manager.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,9 @@ def _load_plugin_metadata(plugin_path: str, plugin_obj=None) -> StarMetadata:
211211
metadata = plugin_obj.info()
212212

213213
if isinstance(metadata, dict):
214+
if "desc" not in metadata and "description" in metadata:
215+
metadata["desc"] = metadata["description"]
216+
214217
if (
215218
"name" not in metadata
216219
or "desc" not in metadata
@@ -452,8 +455,10 @@ async def load(self, specified_module_path=None, specified_dir_name=None):
452455
metadata.desc = metadata_yaml.desc
453456
metadata.version = metadata_yaml.version
454457
metadata.repo = metadata_yaml.repo
455-
except Exception:
456-
pass
458+
except Exception as e:
459+
logger.error(
460+
f"插件 {root_dir_name} 元数据载入失败: {str(e)}。使用默认元数据。"
461+
)
457462
metadata.config = plugin_config
458463
if path not in inactivated_plugins:
459464
# 只有没有禁用插件时才实例化插件类

0 commit comments

Comments
 (0)