diff --git a/src/onebot/index.ts b/src/onebot/index.ts index 70eeddd3..c8604fe9 100644 --- a/src/onebot/index.ts +++ b/src/onebot/index.ts @@ -215,7 +215,12 @@ export class NapCatOneBot11Adapter { await this.networkManager.closeSomeAdaterWhenOpen([existingAdapter]); } } else if (adapterConfig.enable) { - const newAdapter = new adapterClass(adapterConfig.name, adapterConfig, this.core, this.actions); + let newAdapter = new adapterClass( adapterConfig.name, adapterConfig, this.core, this.actions ); + + if (adapterClass === OB11ActiveHttpAdapter) { + newAdapter = new adapterClass(adapterConfig.name, adapterConfig, this.core, this, this.actions); + } + await this.networkManager.registerAdapterAndOpen(newAdapter); } } diff --git a/src/onebot/network/active-http.ts b/src/onebot/network/active-http.ts index 94be319f..ac6a602c 100644 --- a/src/onebot/network/active-http.ts +++ b/src/onebot/network/active-http.ts @@ -45,9 +45,6 @@ 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 || !this.obContext.apis.QuickActionApi.handleQuickOperation) { - throw new Error('apis.QuickActionApi.handleQuickOperation 异常'); - } await this.obContext.apis.QuickActionApi.handleQuickOperation(event as QuickActionEvent, resJson); } @@ -78,4 +75,4 @@ export class OB11ActiveHttpAdapter implements IOB11NetworkAdapter { return OB11NetworkReloadType.Normal; } -} \ No newline at end of file +}