-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathchat.go
46 lines (38 loc) · 1.06 KB
/
chat.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
package initdata
const (
ChatTypeSender ChatType = "sender"
ChatTypePrivate ChatType = "private"
ChatTypeGroup ChatType = "group"
ChatTypeSupergroup ChatType = "supergroup"
ChatTypeChannel ChatType = "channel"
)
// ChatType describes type of chat.
type ChatType string
// Known returns true if current chat type is known.
func (c ChatType) Known() bool {
switch c {
case ChatTypeSender,
ChatTypePrivate,
ChatTypeGroup,
ChatTypeSupergroup,
ChatTypeChannel:
return true
default:
return false
}
}
// Chat describes chat information:
// https://docs.telegram-mini-apps.com/launch-parameters/init-data#chat
type Chat struct {
// Unique identifier for this chat.
ID int64 `json:"id"`
// Type of chat.
Type ChatType `json:"type"`
// Title of the chat.
Title string `json:"title"`
// Optional. URL of the chat’s photo. The photo can be in .jpeg or .svg
// formats. Only returned for Web Apps launched from the attachment menu.
PhotoURL string `json:"photo_url"`
// Optional. Username of the chat.
Username string `json:"username"`
}