import { resolveNormalizedAccountEntry } from "openclaw/plugin-sdk/account-core"; import type { BaseTokenResolution } from "openclaw/plugin-sdk/channel-contract"; import { tryReadSecretFileSync } from "openclaw/plugin-sdk/channel-core"; import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime"; import type { TelegramAccountConfig } from "openclaw/plugin-sdk/config-runtime"; import { resolveDefaultSecretProviderAlias } from "openclaw/plugin-sdk/provider-auth"; import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "openclaw/plugin-sdk/routing"; import {
normalizeSecretInputString,
resolveSecretInputString,
} from "openclaw/plugin-sdk/secret-input";
// When a non-default accountId is explicitly specified but not found in config, // decide whether to fall through to channel-level defaults based on whether // the config has an explicit accounts section (multi-bot setup). // // Multi-bot: accounts section exists with entries → block fallthrough to prevent // routing via the wrong bot's token. // // Single-bot: no accounts section (or empty) → allow fallthrough so that // binding-created accountIds inherit the channel-level token. // See: https://github.com/openclaw/openclaw/issues/53876 if (accountId !== DEFAULT_ACCOUNT_ID && !accountCfg) { const accounts = telegramCfg?.accounts; const hasConfiguredAccounts =
!!accounts && typeof accounts === "object" &&
!Array.isArray(accounts) &&
Object.keys(accounts).length > 0; if (hasConfiguredAccounts) {
opts.logMissingFile?.(
`channels.telegram.accounts: unknown accountId "${accountId}" — not found in config, refusing channel-level fallback`,
); return { token: "", source: "none" };
}
}
const accountTokenFile = accountCfg?.tokenFile?.trim(); if (accountTokenFile) { const token = tryReadSecretFileSync(
accountTokenFile,
`channels.telegram.accounts.${accountId}.tokenFile`,
{ rejectSymlink: true },
); if (token) { return { token, source: "tokenFile" };
}
opts.logMissingFile?.(
`channels.telegram.accounts.${accountId}.tokenFile not found or unreadable: ${accountTokenFile}`,
); return { token: "", source: "none" };
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.