Support contact messages

This commit is contained in:
Bohdan Horbeshko 2022-02-05 09:49:21 -05:00
parent 00f6e41e71
commit ab1af45247

View file

@ -469,6 +469,20 @@ func (c *Client) messageToText(message *client.Message) string {
formatter.SortEntities(animation.Caption.Entities),
markupFunction,
)
case client.TypeMessageContact:
contact, _ := message.Content.(*client.MessageContact)
var jid string
if contact.Contact.UserId != 0 {
jid = fmt.Sprintf("%v@%s", contact.Contact.UserId, gateway.Jid.Bare())
}
return fmt.Sprintf(
"*%s %s*\n%s\n%s\n%s",
contact.Contact.FirstName,
contact.Contact.LastName,
contact.Contact.PhoneNumber,
contact.Contact.Vcard,
jid,
)
}
return fmt.Sprintf("unknown message (%s)", message.Content.MessageContentType())