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
2026-01-04 22:12:29 +01:00
committed by Peter Steinberger
parent 20fd9f7f67
commit 5e1b91b32c
2 changed files with 12 additions and 3 deletions

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;
};

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,