diff options
author | Bohdan Horbeshko <bodqhrohro@gmail.com> | 2022-02-05 17:49:21 +0300 |
---|---|---|
committer | Bohdan Horbeshko <bodqhrohro@gmail.com> | 2022-02-05 17:49:21 +0300 |
commit | ab1af4524754f8fc4d0b40927ea58a30a9d2001f (patch) | |
tree | ec4166dabe19241cfd843f29ef7eea874732b7be /telegram/utils.go | |
parent | 00f6e41e71ff6c250e34988e870802b6ecc80baa (diff) |
Support contact messages
Diffstat (limited to 'telegram/utils.go')
-rw-r--r-- | telegram/utils.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/telegram/utils.go b/telegram/utils.go index ee7b4e8..5b0e2ca 100644 --- a/telegram/utils.go +++ b/telegram/utils.go @@ -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()) |