/
commands.go
445 lines (438 loc) · 12.4 KB
/
commands.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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
package bot
import (
"github.com/diamondburned/arikawa/v3/api"
"github.com/diamondburned/arikawa/v3/discord"
)
type command struct {
Scoped discord.GuildID
Data api.CreateCommandData
}
type commandList []command
func (cl commandList) Scoped(to discord.GuildID) commandList {
newCmds := make(commandList, 0)
for _, c := range cl {
newCmds = append(newCmds, command{
Data: c.Data,
Scoped: to,
})
}
return newCmds
}
var commands = commandList{
{
Scoped: 0,
Data: api.CreateCommandData{
Name: "ping",
Description: "The bot may have a little ping (as a treat)",
NoDMPermission: false,
},
},
{
Scoped: 0,
Data: api.CreateCommandData{
Name: "info",
Description: "Displays info about the bot",
NoDMPermission: false,
},
},
{
Scoped: 0,
Data: api.CreateCommandData{
Name: "help",
Description: "Displays info about the bot",
NoDMPermission: false,
},
},
{
Scoped: 0,
Data: api.CreateCommandData{
Name: "is-admin",
Description: "Debugging command to see if one is an admin",
NoDMPermission: false,
},
},
{
Scoped: 0,
Data: api.CreateCommandData{
Name: "game",
Description: "Change the bot's game presence",
Options: discord.CommandOptions{
discord.NewStringOption("new-game", "The new game to change to", true),
},
NoDMPermission: false,
},
},
{
Scoped: 0,
Data: api.CreateCommandData{
Name: "changelog",
Description: "Get the bot's changelog from GitHub",
},
},
{
Scoped: testGuildID,
Data: api.CreateCommandData{
Name: "panic",
Description: "Test the recoverer middleware",
DefaultMemberPermissions: discord.NewPermissions(discord.PermissionManageGuild),
NoDMPermission: true,
},
},
{
Scoped: 0,
Data: api.CreateCommandData{
Name: "jerkcity",
Description: "Various commands relating to Jerkcity",
NoDMPermission: false,
Options: discord.CommandOptions{
discord.NewSubcommandOption(
"latest",
"Fetch the latest episode",
),
discord.NewSubcommandOption(
"episode",
"Fetch an episode by its number",
discord.NewIntegerOption("number", "Number of the episode", true),
),
discord.NewSubcommandOption(
"quote",
"Get a random episode with a cute little quote :)",
),
discord.NewSubcommandOption(
"search",
"Search the Jerkcity API for a specific query",
discord.NewStringOption("query", "Your query", true),
),
},
},
},
{
Scoped: 0,
Data: api.CreateCommandData{
Name: "roles",
Description: "Moderator interface for vanity roles",
DefaultMemberPermissions: discord.NewPermissions(discord.PermissionManageRoles),
NoDMPermission: true,
Options: discord.CommandOptions{
discord.NewSubcommandOption(
"create",
"Create a new vanity role",
discord.NewStringOption("name", "Name of new role", true),
discord.NewStringOption("color", "Color of the new role", false),
discord.NewBooleanOption("hoisted", "Whether the role is hoisted or not", false),
),
discord.NewSubcommandOption(
"delete",
"Delete a vanity role",
discord.NewRoleOption("role", "The role to delete", true),
),
discord.NewSubcommandOption(
"rename",
"Rename a vanity role",
discord.NewRoleOption("role", "The role to rename", true),
discord.NewStringOption("new-name", "The new name", true),
),
discord.NewSubcommandOption(
"setcolor",
"Change a role's color",
discord.NewRoleOption("role", "The role to alter", true),
discord.NewStringOption("color", "The new color", true),
),
discord.NewSubcommandOption(
"import",
"Import existing roles",
discord.NewRoleOption("first", "First role to import", true),
discord.NewRoleOption("second", "Second role to import", false),
discord.NewRoleOption("third", "Third role to import", false),
discord.NewRoleOption("fourth", "Fourth role to import", false),
discord.NewRoleOption("fifth", "Fifth role to import", false),
),
discord.NewSubcommandOption(
"relinquish",
"Relinquish roles from the database",
discord.NewRoleOption("first", "First role to import", true),
discord.NewRoleOption("second", "Second role to import", false),
discord.NewRoleOption("third", "Third role to import", false),
discord.NewRoleOption("fourth", "Fourth role to import", false),
discord.NewRoleOption("fifth", "Fifth role to import", false),
),
discord.NewSubcommandOption(
"fix",
"Update the database to include role names for tracked roles without.",
),
},
},
},
{
Scoped: 0,
Data: api.CreateCommandData{
Name: "role",
Description: "Interface for vanity roles",
NoDMPermission: true,
Options: discord.CommandOptions{
discord.NewSubcommandOption(
"add",
"Add a vanity role to yourself",
discord.NewRoleOption("role", "The role to add", true),
),
discord.NewSubcommandOption(
"remove",
"Remove a vanity role from yourself",
discord.NewRoleOption("role", "The role to remove", true),
),
discord.NewSubcommandOption(
"list",
"List all the vanity roles available",
),
},
},
},
{
Scoped: scroteGuildID,
Data: api.CreateCommandData{
Name: "egoraptor",
Description: "Moderator commands for configuring the Egoraptor functionality",
DefaultMemberPermissions: discord.NewPermissions(discord.PermissionManageGuild),
NoDMPermission: true,
Options: discord.CommandOptions{
discord.NewSubcommandOption(
"toggle",
"Toggle timing users out",
discord.NewBooleanOption("toggled", "Whether to timeout or not", true),
),
discord.NewSubcommandOption(
"settimeout",
"Set the length of timeouts",
discord.NewIntegerOption(
"seconds",
"Number of seconds to time out for",
true,
),
),
},
},
},
{
Scoped: scroteGuildID,
Data: api.CreateCommandData{
Name: "leaderboard",
Description: "Leaderboard for Egoraptor mentions",
NoDMPermission: true,
},
},
{
Scoped: scroteGuildID,
Data: api.CreateCommandData{
Name: "mettic",
Description: "Moderator commands for updating Mettic's role on an interval",
DefaultMemberPermissions: discord.NewPermissions(discord.PermissionManageGuild),
NoDMPermission: true,
Options: discord.CommandOptions{
discord.NewSubcommandOption(
"toggle",
"Toggle updating Mettic's role",
discord.NewBooleanOption("toggled", "Whether to update or not", true),
),
},
},
},
{
Scoped: 0,
Data: api.CreateCommandData{
Name: "q",
Description: "Query guild quotes",
NoDMPermission: true,
Options: discord.CommandOptions{
discord.NewIntegerOption("index", "Quote index", false),
discord.NewUserOption("user", "Member to query", false),
},
},
},
{
Scoped: 0,
Data: api.CreateCommandData{
Name: "quote",
Description: "Interact with guild quotes",
NoDMPermission: true,
Options: discord.CommandOptions{
discord.NewSubcommandOption(
"delete",
"Delete a quote",
discord.NewIntegerOption(
"index",
"The index to delete",
true,
),
),
discord.NewSubcommandOption(
"list",
"Get a list of guild quotes",
),
},
},
},
{
Scoped: 0,
Data: api.CreateCommandData{
Name: "settings",
Description: "Configure bot settings for the guild",
DefaultMemberPermissions: discord.NewPermissions(discord.PermissionManageGuild),
NoDMPermission: true,
Options: discord.CommandOptions{
discord.NewSubcommandGroupOption(
"quotes",
"Configure quote settings for the guild",
discord.NewSubcommandOption(
"toggle",
"Toggle the use of quotes in the guild",
discord.NewBooleanOption(
"toggled",
"Toggle quotes on or off",
true,
),
),
discord.NewSubcommandOption(
"set-min-required",
"Sets the minimum amount of reactions required to quote",
discord.NewIntegerOption(
"minimum",
"The minimum required to quote a message",
true,
),
),
),
},
},
},
{
Scoped: 0,
Data: api.CreateCommandData{
Name: "topster",
Description: "Generate a 3x3 Topster chart with Last.fm data",
Options: discord.CommandOptions{
discord.NewStringOption("lastfm-user", "Your Last.fm username", true),
discord.NewStringOption("period", "The period of time to use for data. Valid options are overall, 7day, 1month, 3month, 6month, 12month", false),
discord.NewStringOption("background-color", "A background color as a hex code", false),
discord.NewStringOption("text-color", "A text color as a hex code", false),
discord.NewStringOption("title", "Your chart's title", false),
discord.NewBooleanOption("show-titles", "Show titles on the chart?", false),
discord.NewBooleanOption("show-numbers", "Show numbers on the chart?", false),
},
},
},
{
Scoped: 0,
Data: api.CreateCommandData{
Name: "tags",
Description: "Commands for managing user-generated tags; think custom commands!",
NoDMPermission: true,
Options: discord.CommandOptions{
discord.NewSubcommandOption(
"create",
"Create a tag",
discord.NewStringOption("name", "Name of the tag", true),
discord.NewStringOption("content", "Content of the tag", true),
),
discord.NewSubcommandOption(
"update",
"Update a tag's content",
discord.NewStringOption("name", "Name of the tag", true),
discord.NewStringOption("content", "New content of the tag", true),
),
discord.NewSubcommandOption(
"rename",
"Rename a tag",
discord.NewStringOption("name", "Current name of the tag", true),
discord.NewStringOption("new-name", "New name of the tag", true),
),
discord.NewSubcommandOption(
"delete",
"Delete a tag",
discord.NewStringOption("name", "Name of the tag", true),
),
discord.NewSubcommandOption(
"list",
"Get a link to a list of tags for the guild",
),
},
},
},
{
Scoped: 0,
Data: api.CreateCommandData{
Name: "tag",
Description: "Query a tag",
NoDMPermission: true,
Options: discord.CommandOptions{
discord.NewStringOption("name", "Name of the tag", true),
},
},
},
{
Scoped: 0,
Data: api.CreateCommandData{
Name: "profile",
Description: "Interface for user profiles",
Options: discord.CommandOptions{
discord.NewSubcommandOption(
"init",
"Create a profile for yourself",
),
discord.NewSubcommandOption(
"delete",
"Delete your profile. THIS IS IRREVERSIBLE.",
discord.NewBooleanOption("are-you-sure", "Confirmation you want to delete your profile", true),
),
discord.NewSubcommandOption(
"get",
"Get a link to your profile on the site",
),
discord.NewSubcommandOption(
"set-timezone",
"Set your timezone",
discord.NewStringOption("timezone", "Your timezone", true),
),
},
},
},
{
Scoped: 0,
Data: api.CreateCommandData{
Name: "time",
Description: "Interface for time-related commands",
Options: discord.CommandOptions{
discord.NewSubcommandOption(
"in",
"Get the time in a specific timezone or your profile's timezone",
discord.NewStringOption("timezone", "A valid timezone", false),
),
discord.NewSubcommandOption(
"stamp",
"Get a Discord timestamp for a given date and time",
discord.NewStringOption("time", "A time in natural language", true),
discord.NewStringOption("timezone", "A valid timezone", false),
discord.NewStringOption("format", "The format of the Discord timestamp", false),
),
},
},
},
{
Scoped: 0,
Data: api.CreateCommandData{
Name: "feedback",
Description: "Submit bot feedback, ideas, or tell the owner they suck",
Options: discord.CommandOptions{
discord.NewStringOption("feedback", "Your feedback", true),
},
},
},
{
Scoped: jennaGuildID,
Data: api.CreateCommandData{
Name: "stfu",
Description: "Tell everyone to use a thread for their argument.",
NoDMPermission: true,
DefaultMemberPermissions: discord.NewPermissions(discord.PermissionAdministrator),
},
},
}