7 "go.mau.fi/whatsmeow/proto/waE2E"
10 // whatsappVoiceDownloadTimeout bounds one voice-note media download.
11 const whatsappVoiceDownloadTimeout = 2 * time.Minute
13 // whatsappVoice stores and transcribes accepted voice notes before their batch
14 // is acknowledged. Failure markers reveal no URLs, keys, or process output.
15 func whatsappVoice(ctx context.Context, client WhatsAppClient, store *VoiceStore, transcriber *VoiceTranscriber, audio *waE2E.AudioMessage) string {
16 if audio.GetFileLength() > voiceMaxBytes || client == nil {
17 return "(voice not downloaded)"
20 downloadCtx, cancel := context.WithTimeout(ctx, whatsappVoiceDownloadTimeout)
23 data, err := client.Download(downloadCtx, audio)
25 return "(voice not downloaded)"
28 return transcriber.Text(ctx, store, data)