mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-06 06:41:08 +00:00
fix: honor telegram account replyToMode
This commit is contained in:
@@ -220,6 +220,33 @@ describe("telegramPlugin messaging", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("telegramPlugin threading", () => {
|
||||
it("honors per-account replyToMode overrides", () => {
|
||||
const resolveReplyToMode = telegramPlugin.threading?.resolveReplyToMode;
|
||||
if (!resolveReplyToMode) {
|
||||
throw new Error("Expected telegramPlugin.threading.resolveReplyToMode to be defined");
|
||||
}
|
||||
|
||||
const cfg = {
|
||||
channels: {
|
||||
telegram: {
|
||||
replyToMode: "all",
|
||||
botToken: "token-default",
|
||||
accounts: {
|
||||
work: {
|
||||
botToken: "token-work",
|
||||
replyToMode: "first",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
} as OpenClawConfig;
|
||||
|
||||
expect(resolveReplyToMode({ cfg, accountId: "work" })).toBe("first");
|
||||
expect(resolveReplyToMode({ cfg, accountId: "default" })).toBe("all");
|
||||
});
|
||||
});
|
||||
|
||||
describe("telegramPlugin threading", () => {
|
||||
it("keeps topic thread state in plugin-owned tool context", () => {
|
||||
expect(
|
||||
|
||||
@@ -871,7 +871,11 @@ export const telegramPlugin = createChatChannelPlugin({
|
||||
collectWarnings: collectTelegramSecurityWarnings,
|
||||
},
|
||||
threading: {
|
||||
topLevelReplyToMode: "telegram",
|
||||
scopedAccountReplyToMode: {
|
||||
resolveAccount: (cfg, accountId) => resolveTelegramAccount({ cfg, accountId }),
|
||||
resolveReplyToMode: (account) => account.config.replyToMode,
|
||||
fallback: "off",
|
||||
},
|
||||
buildToolContext: (params) => buildTelegramThreadingToolContext(params),
|
||||
resolveAutoThreadId: ({ to, toolContext }) => resolveTelegramAutoThreadId({ to, toolContext }),
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user