-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathuser.go
68 lines (58 loc) · 1.18 KB
/
user.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
package fbbot
type User struct {
ID string `json:"id"`
PhoneNumber string `json:"phone_number,omitempty"`
isFetched bool
firstName string
lastName string
profilePic string
locale string
timezone float32
gender string
isPaymentEnabled bool // Is the user eligible to receive messenger platform payment messages
}
func (u *User) FirstName() string {
if !u.isFetched {
bot.fetchUserData(u)
}
return u.firstName
}
func (u *User) LastName() string {
if !u.isFetched {
bot.fetchUserData(u)
}
return u.lastName
}
func (u *User) FullName() string {
return u.FirstName() + " " + u.LastName()
}
func (u *User) ProfilePic() string {
if !u.isFetched {
bot.fetchUserData(u)
}
return u.profilePic
}
func (u *User) Locale() string {
if !u.isFetched {
bot.fetchUserData(u)
}
return u.locale
}
func (u *User) Timezone() float32 {
if !u.isFetched {
bot.fetchUserData(u)
}
return u.timezone
}
func (u *User) Gender() string {
if !u.isFetched {
bot.fetchUserData(u)
}
return u.gender
}
func (u *User) IsPaymentEnabled() bool {
if !u.isFetched {
bot.fetchUserData(u)
}
return u.isPaymentEnabled
}