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:
committed by
Peter Steinberger
parent
20fd9f7f67
commit
5e1b91b32c
@@ -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;
|
||||
};
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user