refactor!: rename chat providers to channels

This commit is contained in:
Peter Steinberger
2026-01-13 06:16:43 +00:00
parent 0cd632ba84
commit 90342a4f3a
393 changed files with 8004 additions and 6737 deletions

View File

@@ -18,7 +18,9 @@ describe("resolveTelegramToken", () => {
it("prefers env token over config", () => {
vi.stubEnv("TELEGRAM_BOT_TOKEN", "env-token");
const cfg = { telegram: { botToken: "cfg-token" } } as ClawdbotConfig;
const cfg = {
channels: { telegram: { botToken: "cfg-token" } },
} as ClawdbotConfig;
const res = resolveTelegramToken(cfg);
expect(res.token).toBe("env-token");
expect(res.source).toBe("env");
@@ -29,7 +31,7 @@ describe("resolveTelegramToken", () => {
const dir = withTempDir();
const tokenFile = path.join(dir, "token.txt");
fs.writeFileSync(tokenFile, "file-token\n", "utf-8");
const cfg = { telegram: { tokenFile } } as ClawdbotConfig;
const cfg = { channels: { telegram: { tokenFile } } } as ClawdbotConfig;
const res = resolveTelegramToken(cfg);
expect(res.token).toBe("file-token");
expect(res.source).toBe("tokenFile");
@@ -38,7 +40,9 @@ describe("resolveTelegramToken", () => {
it("falls back to config token when no env or tokenFile", () => {
vi.stubEnv("TELEGRAM_BOT_TOKEN", "");
const cfg = { telegram: { botToken: "cfg-token" } } as ClawdbotConfig;
const cfg = {
channels: { telegram: { botToken: "cfg-token" } },
} as ClawdbotConfig;
const res = resolveTelegramToken(cfg);
expect(res.token).toBe("cfg-token");
expect(res.source).toBe("config");
@@ -49,7 +53,7 @@ describe("resolveTelegramToken", () => {
const dir = withTempDir();
const tokenFile = path.join(dir, "missing-token.txt");
const cfg = {
telegram: { tokenFile, botToken: "cfg-token" },
channels: { telegram: { tokenFile, botToken: "cfg-token" } },
} as ClawdbotConfig;
const res = resolveTelegramToken(cfg);
expect(res.token).toBe("");