feat(telegram): wire audioAsVoice through bot.ts

- Add audioAsVoice option to ReplyPayload type
- Update bot.ts to use sendVoice by default for audio (voice bubble)
- When audioAsVoice is false, use sendAudio (file with metadata)

This allows agents to control voice vs file mode via ReplyPayload.
This commit is contained in:
Manuel Maly authored and Peter Steinberger committed 2026-01-08 03:15:08 +00:00
1 parent 20fd9f7f67
commit 5e1b91b32c
2 files changed
+12 -3

No files matched your search

+2
View File
@@ -18,5 +18,7 @@ export type ReplyPayload = {
mediaUrl?: string;
mediaUrls?: string[];
replyToId?: string;
/** Send audio as voice message (bubble) instead of audio file. Defaults to false. */
audioAsVoice?: boolean;
isError?: boolean;
};
+10 -3
View File
@@ -1250,9 +1250,16 @@ async function deliverReplies(params: {
...mediaParams,
});
} else if (kind === "audio") {
await bot.api.sendAudio(chatId, file, {
...mediaParams,
});
const useVoice = reply.audioAsVoice === true; // default false
if (useVoice) {
await bot.api.sendVoice(chatId, file, {
...mediaParams,
});
} else {
await bot.api.sendAudio(chatId, file, {
...mediaParams,
});
}
} else {
await bot.api.sendDocument(chatId, file, {
...mediaParams,