-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypes.go
70 lines (56 loc) · 1.62 KB
/
types.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
69
70
package teleBot
type User struct {
Id int `json:"id"`
IsBot bool `json:"is_bot"`
FirstName string `json:"first_name"`
LastName string `json:"last_name"`
Username string `json:"username"`
LanguageCode string `json:"language_code"`
}
func (user User) String() string {
return StructToString(user)
}
func (user User) FullName() string {
if user.LastName == "" {
return user.FirstName
}
return user.FirstName + " " + user.LastName
}
// ------------------------------------------------------------------------------------
type Message struct {
Id int `json:"message_id"`
From User `json:"from"`
Date int `json:"date"`
Chat Chat `json:"chat"`
Text string `json:"text"`
}
func (msg Message) String() string {
return StructToString(msg)
}
// ------------------------------------------------------------------------------------
type Chat struct {
Id int `json:"id"`
Type string `json:"type"`
Title string `json:"title"`
Username string `json:"username"`
}
func (chat Chat) String() string {
return StructToString(chat)
}
// ------------------------------------------------------------------------------------
type Update struct {
Id int `json:"update_id"`
Message Message `json:"message"`
// EditedMessage Message `json:"edited_message"`
}
func (upd Update) String() string {
return StructToString(upd)
}
// ------------------------------------------------------------------------------------
type ResponseUpdate struct {
Ok bool `json:"ok"`
Res Message `json:"result"`
}
func (upd ResponseUpdate) String() string {
return StructToString(upd)
}