/
message.go
84 lines (76 loc) · 2.18 KB
/
message.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
package model
type MessageType int
const (
MessageText MessageType = iota
MessageContact
MessageLocation
MessageDocument
MessageSticker
MessagePhoto
MessageVideo
MessageAudio
MessageKeyboard
MessageInlineKeyboard
MessageContactButton
MessageLocationButton
)
const (
ChatTypePrivate = "private"
ChatTypeGroup = "group"
ChatTypeSuperGroup = "supergroup"
ChatTypeChannel = "channel"
)
type Message struct {
Type MessageType
Data string
CallbackQuery CallbackQuery
Caption string
Replies chan *Message
From User
Contact Contact
Location Location
ChatID int64
ChatType string
DisablePreview bool
Markdown bool
InlineButtons []map[string]string
WithURLInlineButtons bool
WithDataInlineButtons bool
Buttons [][]string
ContactButton string
LocationButton string
OneTimeKeyboard bool
ForwardDate int
}
// Contact contains information about a contact.
//
// Note that LastName and UserID may be empty.
type Contact struct {
PhoneNumber string `json:"phone_number"`
FirstName string `json:"first_name"`
LastName string `json:"last_name"` // optional
UserID int `json:"user_id"` // optional
}
// Location contains information about a place.
type Location struct {
Longitude float64 `json:"longitude"`
Latitude float64 `json:"latitude"`
}
// User is a user on Telegram.
type User struct {
ID int `json:"id"`
FirstName string `json:"first_name"`
LastName string `json:"last_name"` // optional
UserName string `json:"username"` // optional
LanguageCode string `json:"language_code"` // optional
}
// CallbackQuery is data sent when a keyboard button with callback data
// is clicked.
type CallbackQuery struct {
ID string `json:"id"`
From User `json:"from"`
InlineMessageID string `json:"inline_message_id"` // optional
ChatInstance string `json:"chat_instance"`
Data string `json:"data"` // optional
GameShortName string `json:"game_short_name"` // optional
}