mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2026-02-04 14:41:14 +00:00
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.
50 lines
1.3 KiB
TypeScript
50 lines
1.3 KiB
TypeScript
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 方法可以在这里实现
|
|
}
|