mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2025-07-19 12:03:37 +00:00
fuck javascript
This commit is contained in:
@@ -1,19 +1,5 @@
|
||||
import type { OneBotFriendApi } from '@/onebot/api/friend';
|
||||
import type { OneBotUserApi } from '@/onebot/api/user';
|
||||
import type { OneBotGroupApi } from '@/onebot/api/group';
|
||||
import type { OneBotMsgApi } from '@/onebot/api/msg';
|
||||
import type { OneBotQuickActionApi } from '@/onebot/api/quick-action';
|
||||
|
||||
export * from './friend';
|
||||
export * from './group';
|
||||
export * from './user';
|
||||
export * from './msg';
|
||||
export * from './quick-action';
|
||||
|
||||
export interface StableOneBotApiWrapper {
|
||||
FriendApi: OneBotFriendApi;
|
||||
UserApi: OneBotUserApi;
|
||||
GroupApi: OneBotGroupApi;
|
||||
MsgApi: OneBotMsgApi;
|
||||
QuickActionApi: OneBotQuickActionApi,
|
||||
}
|
||||
export * from './quick-action';
|
@@ -31,7 +31,6 @@ import {
|
||||
OneBotMsgApi,
|
||||
OneBotQuickActionApi,
|
||||
OneBotUserApi,
|
||||
StableOneBotApiWrapper,
|
||||
} from '@/onebot/api';
|
||||
import { ActionMap, createActionMap } from '@/onebot/action';
|
||||
import { WebUiDataRuntime } from '@/webui/src/helper/Data';
|
||||
@@ -55,7 +54,7 @@ export class NapCatOneBot11Adapter {
|
||||
readonly context: InstanceContext;
|
||||
|
||||
configLoader: OB11ConfigLoader;
|
||||
public readonly apis: StableOneBotApiWrapper;
|
||||
public readonly apis;
|
||||
networkManager: OB11NetworkManager;
|
||||
actions: ActionMap;
|
||||
private readonly bootTime = Date.now() / 1000;
|
||||
@@ -72,7 +71,7 @@ export class NapCatOneBot11Adapter {
|
||||
UserApi: new OneBotUserApi(this, core),
|
||||
FriendApi: new OneBotFriendApi(this, core),
|
||||
MsgApi: new OneBotMsgApi(this, core),
|
||||
QuickActionApi: new OneBotQuickActionApi(this, core),
|
||||
QuickActionApi: new OneBotQuickActionApi(this, core)
|
||||
} as const;
|
||||
this.actions = createActionMap(this, core);
|
||||
this.networkManager = new OB11NetworkManager();
|
||||
|
@@ -30,7 +30,6 @@ export class OB11ActiveHttpAdapter implements IOB11NetworkAdapter {
|
||||
|
||||
async emitEventAsync<T extends OB11EmitEventContent>(event: T) {
|
||||
if (!this.isEnable) return;
|
||||
|
||||
const headers: Record<string, string> = {
|
||||
'Content-Type': 'application/json',
|
||||
'x-self-id': this.core.selfInfo.uin,
|
||||
@@ -46,10 +45,9 @@ export class OB11ActiveHttpAdapter implements IOB11NetworkAdapter {
|
||||
const data = await RequestUtil.HttpGetText(this.config.url, 'POST', msgStr, headers);
|
||||
const resJson: QuickAction = data ? JSON.parse(data) : {};
|
||||
|
||||
if (!this.obContext.apis.QuickActionApi.handleQuickOperation) {
|
||||
if (!this.obContext.apis || !this.obContext.apis.QuickActionApi.handleQuickOperation) {
|
||||
throw new Error('apis.QuickActionApi.handleQuickOperation 异常');
|
||||
}
|
||||
|
||||
await this.obContext.apis.QuickActionApi.handleQuickOperation(event as QuickActionEvent, resJson);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user