mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2026-02-06 13:05:09 +00:00
Introduce NapCat Protocol and adapter management
Added the new napcat-protocol package with protocol config, event, API, and network management modules. Introduced napcat-adapter package to unify protocol adapter management, replacing direct OneBot usage in framework and shell. Updated napcat-framework and napcat-shell to use NapCatAdapterManager for protocol initialization and registration. Adjusted dependencies and Vite configs to include new packages.
This commit is contained in:
49
packages/napcat-protocol/api/index.ts
Normal file
49
packages/napcat-protocol/api/index.ts
Normal file
@@ -0,0 +1,49 @@
|
||||
import { NapCatCore } from 'napcat-core';
|
||||
import { NapCatProtocolAdapter } from '@/napcat-protocol/index';
|
||||
|
||||
// NapCat Protocol API 基类
|
||||
export abstract class NapCatProtocolApiBase {
|
||||
protected adapter: NapCatProtocolAdapter;
|
||||
protected core: NapCatCore;
|
||||
|
||||
constructor (adapter: NapCatProtocolAdapter, core: NapCatCore) {
|
||||
this.adapter = adapter;
|
||||
this.core = core;
|
||||
}
|
||||
}
|
||||
|
||||
// 消息 API
|
||||
export class NapCatProtocolMsgApi extends NapCatProtocolApiBase {
|
||||
constructor (adapter: NapCatProtocolAdapter, core: NapCatCore) {
|
||||
super(adapter, core);
|
||||
}
|
||||
|
||||
// 消息相关 API 方法可以在这里实现
|
||||
}
|
||||
|
||||
// 用户 API
|
||||
export class NapCatProtocolUserApi extends NapCatProtocolApiBase {
|
||||
constructor (adapter: NapCatProtocolAdapter, core: NapCatCore) {
|
||||
super(adapter, core);
|
||||
}
|
||||
|
||||
// 用户相关 API 方法可以在这里实现
|
||||
}
|
||||
|
||||
// 群组 API
|
||||
export class NapCatProtocolGroupApi extends NapCatProtocolApiBase {
|
||||
constructor (adapter: NapCatProtocolAdapter, core: NapCatCore) {
|
||||
super(adapter, core);
|
||||
}
|
||||
|
||||
// 群组相关 API 方法可以在这里实现
|
||||
}
|
||||
|
||||
// 好友 API
|
||||
export class NapCatProtocolFriendApi extends NapCatProtocolApiBase {
|
||||
constructor (adapter: NapCatProtocolAdapter, core: NapCatCore) {
|
||||
super(adapter, core);
|
||||
}
|
||||
|
||||
// 好友相关 API 方法可以在这里实现
|
||||
}
|
||||
Reference in New Issue
Block a user