-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcommand.go
175 lines (167 loc) · 7.17 KB
/
command.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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
package main
import (
"github.com/bwmarrin/discordgo"
)
var (
commands = []*discordgo.ApplicationCommand{
{
Name: "ping",
Description: "Replies with Pong!",
},
{
Name: "todo",
Description: "Manage your todos",
Options: []*discordgo.ApplicationCommandOption{
{
Type: discordgo.ApplicationCommandOptionSubCommand,
Name: "add",
Description: "Add a new todo",
Options: []*discordgo.ApplicationCommandOption{
{
Type: discordgo.ApplicationCommandOptionString,
Name: "person",
Description: "User to assign the todo to",
Required: true,
},
{
Type: discordgo.ApplicationCommandOptionString,
Name: "content",
Description: "Content of the todo",
Required: true,
},
},
},
{
Type: discordgo.ApplicationCommandOptionSubCommand,
Name: "get",
Description: "Get all todos",
Options: []*discordgo.ApplicationCommandOption{
{
Type: discordgo.ApplicationCommandOptionString,
Name: "person",
Description: "User to get todos for",
Required: false,
},
},
},
{
Type: discordgo.ApplicationCommandOptionSubCommand,
Name: "complete",
Description: "Complete a todo",
Options: []*discordgo.ApplicationCommandOption{
{
Type: discordgo.ApplicationCommandOptionInteger,
Name: "id",
Description: "ID of the todo to complete",
Required: true,
},
},
},
{
Type: discordgo.ApplicationCommandOptionSubCommand,
Name: "update",
Description: "Update a todo",
Options: []*discordgo.ApplicationCommandOption{
{
Type: discordgo.ApplicationCommandOptionInteger,
Name: "id",
Description: "ID of the todo to update",
Required: true,
},
{
Type: discordgo.ApplicationCommandOptionString,
Name: "content",
Description: "New content of the todo",
Required: true,
},
},
},
{
Type: discordgo.ApplicationCommandOptionSubCommand,
Name: "remove",
Description: "Remove a todo",
Options: []*discordgo.ApplicationCommandOption{
{
Type: discordgo.ApplicationCommandOptionInteger,
Name: "id",
Description: "ID of the todo to remove",
Required: false,
},
{
Type: discordgo.ApplicationCommandOptionString,
Name: "person",
Description: "Person to remove todos for",
Required: false,
},
},
},
},
},
{
Name: "kamino",
Description: "Commands for interacting with Kamino",
Options: []*discordgo.ApplicationCommandOption{
{
Type: discordgo.ApplicationCommandOptionSubCommand,
Name: "get-pods",
Description: "Get all pods",
},
{
Type: discordgo.ApplicationCommandOptionSubCommand,
Name: "delete-pod",
Description: "Delete a pod",
Options: []*discordgo.ApplicationCommandOption{
{
Type: discordgo.ApplicationCommandOptionString,
Name: "name",
Description: "Name of a single pod to delete.",
Required: true,
},
},
},
{
Type: discordgo.ApplicationCommandOptionSubCommand,
Name: "bulk-delete",
Description: "Bulk delete pods",
Options: []*discordgo.ApplicationCommandOption{
{
Type: discordgo.ApplicationCommandOptionString,
Name: "filter",
Description: "Filter for a bulk delete operation. Takes a comma separated list of filters.",
Required: true,
},
},
},
{
Type: discordgo.ApplicationCommandOptionSubCommand,
Name: "refresh",
Description: "Refresh templates",
},
{
Type: discordgo.ApplicationCommandOptionSubCommand,
Name: "competition-clone",
Description: "Clone pods for a competition and create respective users.",
Options: []*discordgo.ApplicationCommandOption{
{
Type: discordgo.ApplicationCommandOptionString,
Name: "template",
Description: "Name of the template to clone pods for.",
Required: true,
},
{
Type: discordgo.ApplicationCommandOptionInteger,
Name: "count",
Description: "Number of teams to clone for.",
Required: true,
},
},
},
},
},
}
commandHandlers = map[string]func(s *discordgo.Session, i *discordgo.InteractionCreate){
"ping": PingHandler,
"todo": TodoHandler,
"kamino": KaminoHandler,
}
)