From 1c6874fa74c7f041b7bade05a013baf626128cde Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sat, 11 Apr 2026 16:07:33 +0200 Subject: [PATCH] fix(whatsapp_native): thread VoiceConfig to fix EchoTranscription compile error WhatsAppNativeChannel was referencing c.config.EchoTranscription but EchoTranscription belongs to VoiceConfig, not WhatsAppConfig. Add voiceConfig field to the struct and pass cfg.Voice through the constructor so the field resolves correctly. Co-Authored-By: Claude Sonnet 4.6 --- pkg/channels/whatsapp_native/init.go | 2 +- pkg/channels/whatsapp_native/whatsapp_native.go | 5 ++++- pkg/channels/whatsapp_native/whatsapp_native_stub.go | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/pkg/channels/whatsapp_native/init.go b/pkg/channels/whatsapp_native/init.go index df13e8539..2deee2297 100644 --- a/pkg/channels/whatsapp_native/init.go +++ b/pkg/channels/whatsapp_native/init.go @@ -15,6 +15,6 @@ func init() { if storePath == "" { storePath = filepath.Join(cfg.WorkspacePath(), "whatsapp") } - return NewWhatsAppNativeChannel(waCfg, b, storePath) + return NewWhatsAppNativeChannel(waCfg, cfg.Voice, b, storePath) }) } diff --git a/pkg/channels/whatsapp_native/whatsapp_native.go b/pkg/channels/whatsapp_native/whatsapp_native.go index 1756a4bc5..8eb90003f 100644 --- a/pkg/channels/whatsapp_native/whatsapp_native.go +++ b/pkg/channels/whatsapp_native/whatsapp_native.go @@ -51,6 +51,7 @@ const ( type WhatsAppNativeChannel struct { *channels.BaseChannel config config.WhatsAppConfig + voiceConfig config.VoiceConfig storePath string client *whatsmeow.Client container *sqlstore.Container @@ -67,6 +68,7 @@ type WhatsAppNativeChannel struct { // storePath is the directory for the SQLite session store (e.g. workspace/whatsapp). func NewWhatsAppNativeChannel( cfg config.WhatsAppConfig, + voiceCfg config.VoiceConfig, bus *bus.MessageBus, storePath string, ) (channels.Channel, error) { @@ -80,6 +82,7 @@ func NewWhatsAppNativeChannel( c := &WhatsAppNativeChannel{ BaseChannel: base, config: cfg, + voiceConfig: voiceCfg, storePath: storePath, } return c, nil @@ -428,7 +431,7 @@ func (c *WhatsAppNativeChannel) handleIncoming(evt *events.Message) { metadata["peer_kind"] = "direct" metadata["peer_id"] = senderID } - if len(mediaPaths) > 0 && c.config.EchoTranscription { + if len(mediaPaths) > 0 && c.voiceConfig.EchoTranscription { metadata["echo_transcription"] = "true" } diff --git a/pkg/channels/whatsapp_native/whatsapp_native_stub.go b/pkg/channels/whatsapp_native/whatsapp_native_stub.go index 984af23e7..bf74416f3 100644 --- a/pkg/channels/whatsapp_native/whatsapp_native_stub.go +++ b/pkg/channels/whatsapp_native/whatsapp_native_stub.go @@ -14,6 +14,7 @@ import ( // Build with: go build -tags whatsapp_native ./cmd/... func NewWhatsAppNativeChannel( cfg config.WhatsAppConfig, + voiceCfg config.VoiceConfig, bus *bus.MessageBus, storePath string, ) (channels.Channel, error) {