Expand description
§puniyu_config
统一的 puniyu 配置管理库,覆盖应用、Bot、群聊与好友场景。
§特性
- 提供
AppConfig、BotConfig、GroupConfig、FriendConfig - 提供
app_config()、bot_config()、group_config()、friend_config()统一访问入口 - 提供
ConfigRegistry管理已注册配置 - 初始化时自动创建配置目录并启动配置监听
§示例
use puniyu_config::{app_config, bot_config, init};
init();
let app = app_config();
let bot = bot_config().bot("bot_001");
assert_eq!(app.prefix().as_deref(), Some("!"));
let _ = bot.cd();Structs§
- Adapter
Config - 适配器配置结构
- AppConfig
- BotConfig
- Bot 配置结构
- BotOption
- Bot 配置选项
- Config
Registry - 配置注册表
- Friend
Config - 好友配置结构
- Friend
Option - 好友配置选项
- Group
Config - 群组配置结构
- Group
Option - 群组配置选项
- List
Config - 列表配置
- Plugin
Config - 插件配置结构
- Server
Config - 服务器配置结构
Enums§
- Config
Id - 配置标识符
- Reactive
Mode - Bot 响应模式枚举
Traits§
- Config
- 配置 trait
Functions§
- app_
config - 获取应用配置。
- bot_
config - 获取 Bot 配置。
- friend_
config - 获取好友配置。
- group_
config - 获取群组配置。
- init