mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-05 22:32:12 +00:00
fix: honor qqbot setup default account
This commit is contained in:
@@ -156,7 +156,8 @@ export const qqbotSetupPlugin: ChannelPlugin<ResolvedQQBotAccount> = {
|
||||
}),
|
||||
},
|
||||
setup: {
|
||||
resolveAccountId: ({ accountId }) => accountId?.trim().toLowerCase() || DEFAULT_ACCOUNT_ID,
|
||||
resolveAccountId: ({ cfg, accountId }) =>
|
||||
accountId?.trim().toLowerCase() || resolveDefaultQQBotAccountId(cfg),
|
||||
applyAccountName: ({ cfg, accountId, name }) =>
|
||||
applyAccountNameToChannelSection({
|
||||
cfg,
|
||||
|
||||
@@ -109,7 +109,8 @@ export const qqbotPlugin: ChannelPlugin<ResolvedQQBotAccount> = {
|
||||
.map((entry) => entry.toUpperCase()),
|
||||
},
|
||||
setup: {
|
||||
resolveAccountId: ({ accountId }) => accountId?.trim().toLowerCase() || DEFAULT_ACCOUNT_ID,
|
||||
resolveAccountId: ({ cfg, accountId }) =>
|
||||
accountId?.trim().toLowerCase() || resolveDefaultQQBotAccountId(cfg),
|
||||
applyAccountName: ({ cfg, accountId, name }) =>
|
||||
applyAccountNameToChannelSection({
|
||||
cfg,
|
||||
|
||||
@@ -345,6 +345,27 @@ describe("qqbot config", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("uses configured defaultAccount when runtime setup accountId is omitted", () => {
|
||||
const runtimeSetup = qqbotPlugin.setup;
|
||||
expect(runtimeSetup).toBeDefined();
|
||||
|
||||
expect(
|
||||
runtimeSetup!.resolveAccountId?.({
|
||||
cfg: {
|
||||
channels: {
|
||||
qqbot: {
|
||||
defaultAccount: "bot2",
|
||||
accounts: {
|
||||
bot2: { appId: "123456" },
|
||||
},
|
||||
},
|
||||
},
|
||||
} as OpenClawConfig,
|
||||
accountId: undefined,
|
||||
} as never),
|
||||
).toBe("bot2");
|
||||
});
|
||||
|
||||
it("rejects --use-env for named accounts across setup paths", () => {
|
||||
const runtimeSetup = qqbotPlugin.setup;
|
||||
const lightweightSetup = qqbotSetupPlugin.setup;
|
||||
|
||||
@@ -127,4 +127,25 @@ describe("qqbot setup", () => {
|
||||
} as never),
|
||||
).toBe("bot2");
|
||||
});
|
||||
|
||||
it("uses configured defaultAccount when setup accountId is omitted", () => {
|
||||
const setup = qqbotSetupPlugin.setup;
|
||||
expect(setup).toBeDefined();
|
||||
|
||||
expect(
|
||||
setup!.resolveAccountId?.({
|
||||
cfg: {
|
||||
channels: {
|
||||
qqbot: {
|
||||
defaultAccount: "bot2",
|
||||
accounts: {
|
||||
bot2: { appId: "123456" },
|
||||
},
|
||||
},
|
||||
},
|
||||
} as OpenClawConfig,
|
||||
accountId: undefined,
|
||||
} as never),
|
||||
).toBe("bot2");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user