mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 06:00:43 +00:00
fix(telegram): forward audioAsVoice payloads
Co-authored-by: openclaw-clawsweeper[bot] <280122609+openclaw-clawsweeper[bot]@users.noreply.github.com>
This commit is contained in:
@@ -98,6 +98,32 @@ describe("telegramOutbound", () => {
|
||||
expect(result).toEqual({ channel: "telegram", messageId: "tg-2", chatId: "12345" });
|
||||
});
|
||||
|
||||
it("forwards audioAsVoice payload media to Telegram voice sends", async () => {
|
||||
sendMessageTelegramMock.mockResolvedValueOnce({ messageId: "tg-voice", chatId: "12345" });
|
||||
|
||||
const result = await telegramOutbound.sendPayload!({
|
||||
cfg: {} as never,
|
||||
to: "12345",
|
||||
text: "",
|
||||
payload: {
|
||||
text: "voice caption",
|
||||
mediaUrl: "file:///tmp/note.ogg",
|
||||
audioAsVoice: true,
|
||||
},
|
||||
deps: { sendTelegram: sendMessageTelegramMock },
|
||||
});
|
||||
|
||||
expect(sendMessageTelegramMock).toHaveBeenCalledWith(
|
||||
"12345",
|
||||
"voice caption",
|
||||
expect.objectContaining({
|
||||
mediaUrl: "file:///tmp/note.ogg",
|
||||
asVoice: true,
|
||||
}),
|
||||
);
|
||||
expect(result).toEqual({ channel: "telegram", messageId: "tg-voice", chatId: "12345" });
|
||||
});
|
||||
|
||||
it("passes delivery pin notify requests to Telegram pinning", async () => {
|
||||
pinMessageTelegramMock.mockResolvedValueOnce({ ok: true, messageId: "tg-1", chatId: "12345" });
|
||||
|
||||
|
||||
@@ -96,6 +96,7 @@ export async function sendTelegramPayloadMessages(params: {
|
||||
const payloadOpts = {
|
||||
...params.baseOpts,
|
||||
quoteText,
|
||||
...(params.payload.audioAsVoice === true ? { asVoice: true } : {}),
|
||||
};
|
||||
|
||||
// Telegram allows reply_markup on media; attach buttons only to the first send.
|
||||
|
||||
Reference in New Issue
Block a user