fix: allow media-only telegram voice sends (#1099) (thanks @mukhtharcm)
This commit is contained in:
39
src/channels/plugins/actions/telegram.test.ts
Normal file
39
src/channels/plugins/actions/telegram.test.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
|
||||
import type { ClawdbotConfig } from "../../../config/config.js";
|
||||
import { telegramMessageActions } from "./telegram.js";
|
||||
|
||||
const handleTelegramAction = vi.fn(async () => ({ ok: true }));
|
||||
|
||||
vi.mock("../../../agents/tools/telegram-actions.js", () => ({
|
||||
handleTelegramAction: (...args: unknown[]) => handleTelegramAction(...args),
|
||||
}));
|
||||
|
||||
describe("telegramMessageActions", () => {
|
||||
it("allows media-only sends and passes asVoice", async () => {
|
||||
handleTelegramAction.mockClear();
|
||||
const cfg = { channels: { telegram: { botToken: "tok" } } } as ClawdbotConfig;
|
||||
|
||||
await telegramMessageActions.handleAction({
|
||||
action: "send",
|
||||
params: {
|
||||
to: "123",
|
||||
media: "https://example.com/voice.ogg",
|
||||
asVoice: true,
|
||||
},
|
||||
cfg,
|
||||
accountId: undefined,
|
||||
});
|
||||
|
||||
expect(handleTelegramAction).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
action: "sendMessage",
|
||||
to: "123",
|
||||
content: "",
|
||||
mediaUrl: "https://example.com/voice.ogg",
|
||||
asVoice: true,
|
||||
}),
|
||||
cfg,
|
||||
);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user