From f13528440750ee28bbdefebced1bcee5361d17d8 Mon Sep 17 00:00:00 2001 From: Alexander Trakhimenok <533159+trakhimenok@users.noreply.github.com> Date: Wed, 4 Sep 2024 18:40:36 +0100 Subject: [PATCH] feat: Added VCard to a contact message + doc strings --- tgbotapi/types.go | 22 +++++++++++++++++----- tgbotapi/types_ffjson.go | 2 +- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/tgbotapi/types.go b/tgbotapi/types.go index f555bfa..8c03d8b 100644 --- a/tgbotapi/types.go +++ b/tgbotapi/types.go @@ -347,13 +347,25 @@ type Voice struct { } // Contact contains information about a contact. -// -// Note that LastName and UserID may be empty. +// Note that LastName, UserID, VCard may be empty. type Contact struct { + + // PhoneNumber must always be presented PhoneNumber string `json:"phone_number"` - FirstName string `json:"first_name"` - LastName string `json:"last_name,omitempty"` // optional - UserID int `json:"user_id,omitempty"` // optional + + // FirstName must always be presented + FirstName string `json:"first_name"` + + // Optional + LastName string `json:"last_name,omitempty"` // optional + + // UserID (optional) is a Contact's user identifier in Telegram. + // It has at most 52 significant bits, + // so a 64-bit integer or double-precision float type are safe for storing this identifier. + UserID int64 `json:"user_id,omitempty"` // optional + + // VCard (optional) additional data about the contact in the form of https://en.wikipedia.org/wiki/VCard + VCard string `json:"vcard,omitempty"` } // Location contains information about a place. diff --git a/tgbotapi/types_ffjson.go b/tgbotapi/types_ffjson.go index 1255fbd..d293c2c 100644 --- a/tgbotapi/types_ffjson.go +++ b/tgbotapi/types_ffjson.go @@ -3296,7 +3296,7 @@ handle_UserID: return fs.WrapErr(err) } - j.UserID = int(tval) + j.UserID = tval } }