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