fix: 使用请求插件键绑定事件插件
This commit is contained in:
parent
167a4bba6c
commit
46f9152248
@ -76,7 +76,7 @@ export class QqbotPluginHostBridgeService {
|
||||
case 'bindEventPlugin':
|
||||
return this.accountService.bindEventPlugin(
|
||||
getRequiredText(args, 'selfId'),
|
||||
getRequiredText(args, 'pluginKey'),
|
||||
request.pluginKey,
|
||||
);
|
||||
case 'getBoundEventPluginKeys':
|
||||
return this.accountService.getBoundEventPluginKeys(
|
||||
@ -117,7 +117,7 @@ export class QqbotPluginHostBridgeService {
|
||||
case 'unbindEventPlugin':
|
||||
return this.accountService.unbindEventPlugin(
|
||||
getRequiredText(args, 'selfId'),
|
||||
getRequiredText(args, 'pluginKey'),
|
||||
request.pluginKey,
|
||||
);
|
||||
case 'warn':
|
||||
this.logger.warn({
|
||||
|
||||
@ -134,7 +134,7 @@ describe('QQBot plugin host bridge', () => {
|
||||
|
||||
await expect(
|
||||
bridge.handleHostCall(descriptor, {
|
||||
args: { selfId: '10001', pluginKey: 'sample' },
|
||||
args: { selfId: '10001', pluginKey: 'other-plugin' },
|
||||
method: 'bindEventPlugin',
|
||||
pluginKey: 'sample',
|
||||
}),
|
||||
@ -154,6 +154,21 @@ describe('QQBot plugin host bridge', () => {
|
||||
expect(sendService.sendText).toHaveBeenCalledWith(sendInput);
|
||||
});
|
||||
|
||||
it('uses the request plugin key when unbinding event plugins', async () => {
|
||||
const descriptor = createDescriptor();
|
||||
|
||||
await bridge.handleHostCall(descriptor, {
|
||||
args: { selfId: '10001', pluginKey: 'other-plugin' },
|
||||
method: 'unbindEventPlugin',
|
||||
pluginKey: 'sample',
|
||||
});
|
||||
|
||||
expect(accountService.unbindEventPlugin).toHaveBeenCalledWith(
|
||||
'10001',
|
||||
'sample',
|
||||
);
|
||||
});
|
||||
|
||||
it('reads JSON files from descriptor package roots', async () => {
|
||||
const descriptor = createDescriptor();
|
||||
const filePath = join(tempRoot, 'data', 'sample.json');
|
||||
|
||||
Loading…
Reference in New Issue
Block a user