Skip to content

Commit

Permalink
Merge pull request #634 from bietiaop/main
Browse files Browse the repository at this point in the history
fix: handleQuickOperation error
  • Loading branch information
MliKiowa authored Dec 16, 2024
2 parents 35de00c + 553885d commit 5650f18
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
7 changes: 6 additions & 1 deletion src/onebot/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down
5 changes: 1 addition & 4 deletions src/onebot/network/active-http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down Expand Up @@ -78,4 +75,4 @@ export class OB11ActiveHttpAdapter implements IOB11NetworkAdapter {

return OB11NetworkReloadType.Normal;
}
}
}

0 comments on commit 5650f18

Please sign in to comment.