mirror of https://github.com/Mai-with-u/MaiBot.git
Merge branch 'dev' of https://github.com/MaiM-with-u/MaiBot into dev
commit
bb9c914f80
|
|
@ -14,8 +14,6 @@ project_root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||||
sys.path.insert(0, project_root)
|
sys.path.insert(0, project_root)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def test_version_normalization():
|
def test_version_normalization():
|
||||||
"""测试版本号标准化功能"""
|
"""测试版本号标准化功能"""
|
||||||
print("🧪 测试版本号标准化...")
|
print("🧪 测试版本号标准化...")
|
||||||
|
|
|
||||||
|
|
@ -96,7 +96,7 @@ class BasePlugin(ABC):
|
||||||
"""验证插件基本信息"""
|
"""验证插件基本信息"""
|
||||||
if not self.plugin_name:
|
if not self.plugin_name:
|
||||||
raise ValueError(f"插件类 {self.__class__.__name__} 必须定义 plugin_name")
|
raise ValueError(f"插件类 {self.__class__.__name__} 必须定义 plugin_name")
|
||||||
|
|
||||||
# 验证manifest中的必需信息
|
# 验证manifest中的必需信息
|
||||||
if not self.get_manifest_info("name"):
|
if not self.get_manifest_info("name"):
|
||||||
raise ValueError(f"插件 {self.plugin_name} 的manifest中缺少name字段")
|
raise ValueError(f"插件 {self.plugin_name} 的manifest中缺少name字段")
|
||||||
|
|
@ -144,7 +144,7 @@ class BasePlugin(ABC):
|
||||||
# 只有当插件类中没有定义plugin_name时,才从manifest中获取作为fallback
|
# 只有当插件类中没有定义plugin_name时,才从manifest中获取作为fallback
|
||||||
if not self.plugin_name:
|
if not self.plugin_name:
|
||||||
self.plugin_name = self.manifest_data.get("name", "").replace(" ", "_").lower()
|
self.plugin_name = self.manifest_data.get("name", "").replace(" ", "_").lower()
|
||||||
|
|
||||||
def _get_author_name(self) -> str:
|
def _get_author_name(self) -> str:
|
||||||
"""从manifest获取作者名称"""
|
"""从manifest获取作者名称"""
|
||||||
author_info = self.get_manifest_info("author", {})
|
author_info = self.get_manifest_info("author", {})
|
||||||
|
|
@ -184,7 +184,7 @@ class BasePlugin(ABC):
|
||||||
|
|
||||||
# 从plugin_name生成友好的显示名称
|
# 从plugin_name生成友好的显示名称
|
||||||
display_name = self.plugin_name.replace("_", " ").title()
|
display_name = self.plugin_name.replace("_", " ").title()
|
||||||
|
|
||||||
default_manifest = {
|
default_manifest = {
|
||||||
"manifest_version": 1,
|
"manifest_version": 1,
|
||||||
"name": display_name,
|
"name": display_name,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue