NapCatQQ/packages/napcat-protocol/index.ts
手瓜一十雪 506358e01a Refactor protocol management with napcat-protocol package
Introduced the new napcat-protocol package to unify protocol adapter management for OneBot and Satori. Updated napcat-framework and napcat-shell to use ProtocolManager instead of direct adapter instantiation. Added protocol info definitions to napcat-common, and integrated protocol configuration and management APIs into the web UI backend and frontend. This refactor improves maintainability, extensibility, and encapsulation of protocol logic, while maintaining backward compatibility.
2026-01-14 15:41:47 +08:00

36 lines
1.0 KiB
TypeScript

/**
* NapCat Protocol Manager
*
* 统一管理 OneBot 和 Satori 协议适配器
*
* @example
* ```typescript
* import { ProtocolManager } from 'napcat-protocol';
*
* const protocolManager = new ProtocolManager(core, context, pathWrapper);
*
* // 初始化所有协议
* await protocolManager.initAllProtocols();
*
* // 或者只初始化特定协议
* await protocolManager.initProtocol('onebot11');
* await protocolManager.initProtocol('satori');
*
* // 获取协议适配器
* const onebotAdapter = protocolManager.getOneBotAdapter();
* const satoriAdapter = protocolManager.getSatoriAdapter();
*
* // 获取原始适配器实例
* const rawOneBot = onebotAdapter?.getRawAdapter();
* const rawSatori = satoriAdapter?.getRawAdapter();
* ```
*/
export * from './types';
export * from './manager';
export * from './adapters';
// 重新导出原始适配器类型,方便使用
export { NapCatOneBot11Adapter } from 'napcat-onebot/index';
export { NapCatSatoriAdapter } from 'napcat-satori/index';