






















@@ -473,6 +473,69 @@ vi.mock("../plugin-sdk/matrix-deps.js", () => ({
473473isMatrixSdkAvailable: vi.fn(() => true),
474474}));
475475476+vi.mock("../channels/plugins/bundled.js", () => ({
477+getBundledChannelSetupPlugin: (channel: string) =>
478+channel === "telegram"
479+ ? {
480+id: "telegram",
481+meta: {
482+id: "telegram",
483+label: "Telegram",
484+selectionLabel: "Telegram",
485+docsPath: "/channels/telegram",
486+blurb: "test stub.",
487+},
488+capabilities: { chatTypes: ["direct", "group"] },
489+config: {
490+listAccountIds: () => ["default"],
491+resolveAccount: () => ({}),
492+},
493+setup: {
494+applyAccountConfig: ({
495+ cfg,
496+ input,
497+}: {
498+cfg: OpenClawConfig;
499+input: { token?: string };
500+}) =>
501+({
502+ ...cfg,
503+channels: {
504+ ...cfg.channels,
505+telegram: {
506+ ...(cfg.channels?.telegram as Record<string, unknown> | undefined),
507+ ...(input.token ? { botToken: input.token } : {}),
508+},
509+},
510+}) as OpenClawConfig,
511+},
512+setupWizard: {
513+channel: "telegram",
514+status: {
515+configuredLabel: "configured",
516+unconfiguredLabel: "not configured",
517+resolveConfigured: ({ cfg }: { cfg: OpenClawConfig }) =>
518+Boolean(cfg.channels?.telegram?.botToken),
519+},
520+credentials: [
521+{
522+inputKey: "token",
523+providerHint: "BotFather",
524+credentialLabel: "Telegram bot token",
525+envPrompt: "Use TELEGRAM_BOT_TOKEN from env?",
526+keepPrompt: "Keep current Telegram bot token?",
527+inputPrompt: "Enter Telegram bot token",
528+inspect: ({ cfg }: { cfg: OpenClawConfig }) => ({
529+accountConfigured: Boolean(cfg.channels?.telegram?.botToken),
530+hasConfiguredValue: Boolean(cfg.channels?.telegram?.botToken),
531+}),
532+},
533+],
534+},
535+}
536+ : undefined,
537+}));
538+476539vi.mock("./onboard-helpers.js", () => ({
477540detectBinary: vi.fn(async () => false),
478541}));
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。