From a42e488e5839119f55071c6c5ea514c6c74d2cea Mon Sep 17 00:00:00 2001 From: Dellle <39235395+Dellle@users.noreply.github.com> Date: Sat, 26 Sep 2020 21:32:57 +0200 Subject: [PATCH] Add username for images from WhatsApp (#1232) --- bridge/whatsapp/handlers.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/bridge/whatsapp/handlers.go b/bridge/whatsapp/handlers.go index f58b30f8..4d1c9a13 100644 --- a/bridge/whatsapp/handlers.go +++ b/bridge/whatsapp/handlers.go @@ -143,10 +143,12 @@ func (b *Bwhatsapp) HandleImageMessage(message whatsapp.ImageMessage) { groupJID := message.Info.RemoteJid senderJID := message.Info.SenderJid - // if len(senderJid) == 0 { - // // TODO workaround till https://github.com/Rhymen/go-whatsapp/issues/86 resolved - // senderJid = *message.Info.Source.Participant - // } + if len(senderJID) == 0 { + // TODO workaround till https://github.com/Rhymen/go-whatsapp/issues/86 resolved + if message.Info.Source != nil && message.Info.Source.Participant != nil { + senderJID = *message.Info.Source.Participant + } + } // translate sender's Jid to the nicest username we can get senderName := b.getSenderName(senderJID)