Archived
1
This repository has been archived on 2022-11-04. You can view files and clone it, but cannot push or open issues or pull requests.
fwzookeeper/vendor/gitlab.com/toby3d/telegram/utils_contact.go
2018-11-29 20:32:51 +04:00

29 lines
558 B
Go

package telegram
// FullName returns the full name of contact or FirstName if LastName is not
// available.
func (c *Contact) FullName() string {
if c == nil {
return ""
}
if c.HasLastName() {
return c.FirstName + " " + c.LastName
}
return c.FirstName
}
// HaveLastName checks what the current contact has a LastName.
func (c *Contact) HasLastName() bool {
return c != nil && c.LastName != ""
}
func (c *Contact) HasTelegram() bool {
return c != nil && c.UserID != 0
}
func (c *Contact) HasVCard() bool {
return c != nil && c.VCard != ""
}