-
-
Notifications
You must be signed in to change notification settings - Fork 463
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Text message sometimes empty string #588
Comments
It's kinda hard to figure it out since you didn't provide more information about your case. |
I just using simpel example whatsmeow in godoc, the conversation message has empty string |
IINW, there's 2 type of text message in WhatsApp proto,
reff : |
So we need to check which the correct message type right? |
Right. You can use this function to check: func hasTextMessage(msg *proto.Message) bool {
extendedMsg := msg.GetExtendedTextMessage()
return len(msg.GetConversation()) > 0 ||
len(extendedMsg.GetContextInfo().GetQuotedMessage().GetConversation()) > 0 ||
len(extendedMsg.GetText()) > 0
} |
Your Answer Worked For me after changing some code could be perfect
|
Chances are you want the reply instead of the quoted message. Proposed alternative: func messageContent(msg *waE2E.Message) string {
if msg == nil {
return ""
}
if conversation := msg.GetConversation(); len(conversation) > 0 {
return conversation
}
if extendedMsg := msg.GetExtendedTextMessage().GetText(); len(extendedMsg) > 0 {
return extendedMsg
}
if editedContent := messageContent(msg.GetProtocolMessage().GetEditedMessage()); len(editedContent) > 0 {
return editedContent
}
return ""
} |
I’m facing issue that sometimes received message receiving a empty string. It’s only occured on some whatsapp account. Is there any explanation why this happen?
The text was updated successfully, but these errors were encountered: