1
0
telegram/utils_contact.go

29 lines
558 B
Go
Raw Normal View History

2018-08-15 13:26:07 +00:00
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() {
2018-08-21 11:05:04 +00:00
return c.FirstName + " " + c.LastName
2018-08-15 13:26:07 +00:00
}
return c.FirstName
}
// HaveLastName checks what the current contact has a LastName.
func (c *Contact) HasLastName() bool {
2018-08-21 11:05:04 +00:00
return c != nil && c.LastName != ""
2018-08-15 13:26:07 +00:00
}
func (c *Contact) HasTelegram() bool {
return c != nil && c.UserID != 0
}
func (c *Contact) HasVCard() bool {
2018-08-21 11:05:04 +00:00
return c != nil && c.VCard != ""
2018-08-15 13:26:07 +00:00
}