

























@@ -2,6 +2,8 @@ import { type ChannelDoctorAdapter } from "openclaw/plugin-sdk/channel-contract"
22import type { OpenClawConfig } from "openclaw/plugin-sdk/config-types";
33import { collectProviderDangerousNameMatchingScopes } from "openclaw/plugin-sdk/runtime-doctor";
44import { normalizeOptionalString } from "openclaw/plugin-sdk/text-runtime";
5+import { inspectDiscordAccount } from "./account-inspect.js";
6+import { resolveDefaultDiscordAccountId } from "./accounts.js";
57import { normalizeCompatibilityConfig as normalizeDiscordCompatibilityConfig } from "./doctor-contract.js";
68import { DISCORD_LEGACY_CONFIG_RULES } from "./doctor-shared.js";
79import { isDiscordMutableAllowEntry } from "./security-doctor.js";
@@ -235,6 +237,26 @@ export function maybeRepairDiscordNumericIds(
235237};
236238}
237239240+export function collectDiscordMissingEnvTokenWarnings(params: {
241+cfg: OpenClawConfig;
242+env?: NodeJS.ProcessEnv;
243+}): string[] {
244+if (resolveDefaultDiscordAccountId(params.cfg) !== "default") {
245+return [];
246+}
247+const account = inspectDiscordAccount({
248+cfg: params.cfg,
249+accountId: "default",
250+envToken: params.env?.DISCORD_BOT_TOKEN ?? "",
251+});
252+if (!account.enabled || account.tokenStatus !== "missing" || account.tokenSource !== "none") {
253+return [];
254+}
255+return [
256+"- channels.discord: default account has no available bot token, and DISCORD_BOT_TOKEN is absent in this doctor environment. After migration, verify DISCORD_BOT_TOKEN is present in the state-dir .env or configure channels.discord.token / channels.discord.accounts.default.token as a SecretRef.",
257+];
258+}
259+238260function collectDiscordMutableAllowlistWarnings(cfg: OpenClawConfig): string[] {
239261const hits: Array<{ path: string; entry: string }> = [];
240262const addHits = (pathLabel: string, list: unknown) => {
@@ -306,11 +328,13 @@ export const discordDoctor: ChannelDoctorAdapter = {
306328warnOnEmptyGroupSenderAllowlist: false,
307329legacyConfigRules: DISCORD_LEGACY_CONFIG_RULES,
308330normalizeCompatibilityConfig: normalizeDiscordCompatibilityConfig,
309-collectPreviewWarnings: ({ cfg, doctorFixCommand }) =>
310-collectDiscordNumericIdWarnings({
331+collectPreviewWarnings: ({ cfg, doctorFixCommand, env }) => [
332+ ...collectDiscordMissingEnvTokenWarnings({ cfg, env }),
333+ ...collectDiscordNumericIdWarnings({
311334hits: scanDiscordNumericIdEntries(cfg),
312335 doctorFixCommand,
313336}),
337+],
314338collectMutableAllowlistWarnings: ({ cfg }) => collectDiscordMutableAllowlistWarnings(cfg),
315339repairConfig: ({ cfg, doctorFixCommand }) => maybeRepairDiscordNumericIds(cfg, doctorFixCommand),
316340};
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。