mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 07:17:40 +00:00
fix: prefer config tokens over env for discord/telegram
This commit is contained in:
@@ -54,11 +54,6 @@ export function resolveTelegramToken(
|
||||
}
|
||||
|
||||
const allowEnv = accountId === DEFAULT_ACCOUNT_ID;
|
||||
const envToken = allowEnv ? (opts.envToken ?? process.env.TELEGRAM_BOT_TOKEN)?.trim() : "";
|
||||
if (envToken) {
|
||||
return { token: envToken, source: "env" };
|
||||
}
|
||||
|
||||
const tokenFile = telegramCfg?.tokenFile?.trim();
|
||||
if (tokenFile && allowEnv) {
|
||||
if (!fs.existsSync(tokenFile)) {
|
||||
@@ -81,5 +76,10 @@ export function resolveTelegramToken(
|
||||
return { token: configToken, source: "config" };
|
||||
}
|
||||
|
||||
const envToken = allowEnv ? (opts.envToken ?? process.env.TELEGRAM_BOT_TOKEN)?.trim() : "";
|
||||
if (envToken) {
|
||||
return { token: envToken, source: "env" };
|
||||
}
|
||||
|
||||
return { token: "", source: "none" };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user