Commit Graph

26 Commits

Author SHA1 Message Date
minecraft1024a
cd84373828 style: 统一代码风格并进行现代化改进
对整个代码库进行了一次全面的风格统一和现代化改进。主要变更包括:

- 将 `hasattr` 等内置函数中的字符串参数从单引号 `'` 统一为双引号 `"`。
- 采用现代类型注解,例如将 `Optional[T]` 替换为 `T | None`,`List[T]` 替换为 `list[T]` 等。
- 移除不再需要的 Python 2 兼容性声明 `# -*- coding: utf-8 -*-`。
- 清理了多余的空行、注释和未使用的导入。
- 统一了文件末尾的换行符。
- 优化了部分日志输出和字符串格式化 (`f"{e!s}"`)。

这些改动旨在提升代码的可读性、一致性和可维护性,使其更符合现代 Python 编码规范。
2025-11-19 23:18:16 +08:00
minecraft1024a
9175207e79 refactor(plugin_system): 引入 PluginMetadata 替代 manifest.json
将插件元数据定义从外部 `_manifest.json` 文件迁移到插件 `__init__.py` 文件中的 `__plugin_meta__` 变量。此举简化了插件加载流程,减少了文件I/O,并使元数据与插件代码更紧密地耦合。

主要变更:
- 引入 `PluginMetadata` 数据类来标准化插件元数据。
- 插件基类 `PluginBase` 现在直接接收 `PluginMetadata` 对象,不再负责解析 JSON 文件。
- 插件管理器 `PluginManager` 调整加载逻辑,从插件模块的 `__plugin_meta__` 属性获取元数据。
- 删除了 `manifest_utils.py` 及其相关的验证和版本比较逻辑,简化了依赖关系。
- 更新了所有内置插件,以采用新的元数据定义方式,并删除了它们各自的 `_manifest.json` 文件。

BREAKING CHANGE: 插件加载机制已改变。所有插件必须在其 `__init__.py` 中定义一个 `__plugin_meta__` 变量,该变量是 `PluginMetadata` 类的实例,并移除旧的 `_manifest.json` 文件。
2025-11-19 23:17:29 +08:00
John Richard
a79253c714 re-style: 格式化代码 2025-11-19 23:13:20 +08:00
Windpicker-owo
fe472dff60 修复代码格式和文件名大小写问题 2025-11-19 22:55:55 +08:00
雅诺狐
a2873a71ef Add PlusCommand enhanced command system
Introduces the PlusCommand system for simplified command development, including new base classes, argument parsing utilities, and registration logic. Updates the plugin system, component registry, and bot message handling to support PlusCommand components alongside traditional commands. Adds documentation and configuration for command prefixes, and provides a developer guide for the new system.
2025-11-19 22:48:49 +08:00
雅诺狐
bb4592846c Refactor config system to use Pydantic validation
Refactored configuration classes to inherit from a new ValidatedConfigBase using Pydantic for robust validation and error reporting. Updated api_ada_configs.py, config.py, config_base.py, and official_configs.py to replace dataclasses with Pydantic models, add field validation, and improve error messages. This change enhances configuration reliability and developer feedback for misconfigurations. Also includes minor code cleanups and removal of unused variables in other modules.
2025-11-19 22:44:45 +08:00
minecraft1024a
8ed15c8199 新增插件Python依赖管理系统,支持自动检查和安装依赖,优化依赖配置和错误处理,更新相关文档和示例代码。 2025-11-19 22:35:58 +08:00
UnCLAS-Prommer
1f53ecff10 加上tools的enum属性 2025-08-03 10:27:47 +08:00
UnCLAS-Prommer
af27d0dbf0 tools整合彻底完成 2025-07-28 23:57:55 +08:00
UnCLAS-Prommer
82c4dfbb88 Merge branch 'dev' into dev 2025-07-28 21:59:48 +08:00
UnCLAS-Prommer
97a10c554f 修复导入爆炸和文档错误 2025-07-28 13:09:33 +08:00
Windpicker-owo
44d86c8847 尝试整合工具和插件系统 2025-07-26 18:37:29 +08:00
UnCLAS-Prommer
56c2adbaec 插件和组件管理API 2025-07-23 11:07:26 +08:00
UnCLAS-Prommer
10bf424540 增加了组件的局部禁用方法 2025-07-23 00:41:31 +08:00
UnCLAS-Prommer
8d20134cbb 合并BaseEventPlugin到BasePlugin,重写了components_registry,修正了统计输出 2025-07-19 19:16:42 +08:00
UnCLAS-Prommer
ca5a45c090 增加logging API 2025-07-19 19:11:59 +08:00
UnCLAS-Prommer
063382862a plugin_name不再受文件夹名称限制 2025-07-18 19:25:06 +08:00
UnCLAS-Prommer
1aa2734d62 typing fix 2025-07-17 00:10:41 +08:00
UnCLAS-Prommer
30b35357d4 plugins sys 修改,复用plugin_base(原base_plugin) 2025-07-16 18:02:42 +08:00
UnCLAS-Prommer
36974197a8 暴露全部api,解决循环import问题 2025-07-08 00:18:24 +08:00
github-actions[bot]
86922f1995 🤖 自动格式化代码 [skip ci] 2025-06-19 15:13:28 +00:00
墨梓柒
1fab6dc710 feat: 添加新的插件和清单管理工具
- 引入了“hello_world_plugin”和“take_picture_plugin”及其各自的清单文件。
- 实现了“manifest_tool.py”,用于创建、验证和管理插件清单。
- 添加了“test_version_compatibility.py”,用于测试版本规范化、比较和兼容性检查。
- 增强了“manifest_utils.py”,增加了版本比较和验证功能。
2025-06-19 23:13:06 +08:00
SengokuCola
ab28b94e33 refc:重构插件api,补全文档,合并expressor和replyer,分离reply和sender,新log浏览器 2025-06-19 20:20:34 +08:00
SengokuCola
2fce679aa4 feat:插件依赖管理(如管 2025-06-15 23:53:23 +08:00
春河晴
b0c553703f ruff 2025-06-10 16:43:45 +09:00
SengokuCola
4d32b3052f feat:重构插件api 2025-06-10 15:28:36 +08:00