forked from go-telegram/bot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbot_commands_scope.go
122 lines (99 loc) · 3.1 KB
/
bot_commands_scope.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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
package models
import (
"encoding/json"
)
// BotCommandScope https://core.telegram.org/bots/api#botcommandscope
type BotCommandScope interface {
MarshalCustom() ([]byte, error)
}
// BotCommandScopeDefault https://core.telegram.org/bots/api#botcommandscopedefault
type BotCommandScopeDefault struct{}
func (m *BotCommandScopeDefault) MarshalCustom() ([]byte, error) {
ret := struct {
Type string `json:"type"`
*BotCommandScopeDefault
}{
Type: "default",
BotCommandScopeDefault: m,
}
return json.Marshal(&ret)
}
// BotCommandScopeAllPrivateChats https://core.telegram.org/bots/api#botcommandscopeallprivatechats
type BotCommandScopeAllPrivateChats struct{}
func (m *BotCommandScopeAllPrivateChats) MarshalCustom() ([]byte, error) {
ret := struct {
Type string `json:"type"`
*BotCommandScopeAllPrivateChats
}{
Type: "all_private_chats",
BotCommandScopeAllPrivateChats: m,
}
return json.Marshal(&ret)
}
// BotCommandScopeAllGroupChats https://core.telegram.org/bots/api#botcommandscopeallgroupchats
type BotCommandScopeAllGroupChats struct{}
func (m *BotCommandScopeAllGroupChats) MarshalCustom() ([]byte, error) {
ret := struct {
Type string `json:"type"`
*BotCommandScopeAllGroupChats
}{
Type: "all_group_chats",
BotCommandScopeAllGroupChats: m,
}
return json.Marshal(&ret)
}
// BotCommandScopeAllChatAdministrators https://core.telegram.org/bots/api#botcommandscopeallchatadministrators
type BotCommandScopeAllChatAdministrators struct{}
func (m *BotCommandScopeAllChatAdministrators) MarshalCustom() ([]byte, error) {
ret := struct {
Type string `json:"type"`
*BotCommandScopeAllChatAdministrators
}{
Type: "all_chat_administrators",
BotCommandScopeAllChatAdministrators: m,
}
return json.Marshal(&ret)
}
// BotCommandScopeChat https://core.telegram.org/bots/api#botcommandscopechat
type BotCommandScopeChat struct {
ChatID any `json:"chat_id"`
}
func (m *BotCommandScopeChat) MarshalCustom() ([]byte, error) {
ret := struct {
Type string `json:"type"`
*BotCommandScopeChat
}{
Type: "chat",
BotCommandScopeChat: m,
}
return json.Marshal(&ret)
}
// BotCommandScopeChatAdministrators https://core.telegram.org/bots/api#botcommandscopechatadministrators
type BotCommandScopeChatAdministrators struct {
ChatID any `json:"chat_id"`
}
func (m *BotCommandScopeChatAdministrators) MarshalCustom() ([]byte, error) {
ret := struct {
Type string `json:"type"`
*BotCommandScopeChatAdministrators
}{
Type: "chat_administrators",
BotCommandScopeChatAdministrators: m,
}
return json.Marshal(&ret)
}
// BotCommandScopeChatMember https://core.telegram.org/bots/api#botcommandscopechatmember
type BotCommandScopeChatMember struct {
ChatID any `json:"chat_id"`
UserID int64 `json:"user_id"`
}
func (m *BotCommandScopeChatMember) MarshalCustom() ([]byte, error) {
ret := struct {
Type string `json:"type"`
*BotCommandScopeChatMember
}{
Type: "chat_member",
BotCommandScopeChatMember: m,
}
return json.Marshal(&ret)
}