fix: scope telegram skill commands per bot (#4360) (thanks @robhparker)

This commit is contained in:
Ayaan Zaidi
2026-01-30 11:57:25 +05:30
parent c6ddc95fc0
commit 9025da2296
3 changed files with 90 additions and 3 deletions

View File

@@ -257,11 +257,15 @@ export const registerTelegramNativeCommands = ({
shouldSkipUpdate,
opts,
}: RegisterTelegramNativeCommandsParams) => {
const boundRoute = resolveAgentRoute({ cfg, channel: "telegram", accountId });
const boundAgentIds = boundRoute?.agentId ? [boundRoute.agentId] : undefined;
const boundRoute =
nativeEnabled && nativeSkillsEnabled
? resolveAgentRoute({ cfg, channel: "telegram", accountId })
: null;
const boundAgentIds =
boundRoute && boundRoute.matchedBy.startsWith("binding.") ? [boundRoute.agentId] : null;
const skillCommands =
nativeEnabled && nativeSkillsEnabled
? listSkillCommandsForAgents({ cfg, agentIds: boundAgentIds })
? listSkillCommandsForAgents(boundAgentIds ? { cfg, agentIds: boundAgentIds } : { cfg })
: [];
const nativeCommands = nativeEnabled
? listNativeCommandSpecsForConfig(cfg, { skillCommands, provider: "telegram" })