-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathcommands.ts
101 lines (98 loc) · 2.38 KB
/
commands.ts
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
import { REST } from "@discordjs/rest";
import { Routes } from "discord-api-types/rest/v9";
import { ApplicationCommandData } from "discord.js";
import { env } from "./util";
const stringType = 3;
const booleanType = 5;
const clientId = env("KOAKUMA_CLIENT_ID");
const guildId = env("KOAKUMA_GUILD");
const commandRoute = Routes.applicationGuildCommands(clientId, guildId);
const commands: ApplicationCommandData[] = [
{
name: "start",
description: "Start a game with a random tag.",
options: [],
},
{
name: "random",
description:
"Start a game with a random tag. Images are fully random, rather than biased towards recent posts.",
options: [],
},
{
name: "manual",
description: "Hand-pick a tag for others to play with.",
options: [
{
name: "tag",
description: "The tag to play with",
type: stringType,
required: true,
},
],
},
{
name: "scores",
description: "Show the scoreboard.",
},
{
name: "show",
description: "Show a random image with the given tag(s).",
options: [
{
name: "tag",
description: "A tag to search for.",
type: stringType,
required: true,
},
{
name: "tag2",
description: "A second tag to search for.",
type: stringType,
required: false,
},
{
name: "tag3",
description: "A third tag to search for.",
type: stringType,
required: false,
},
{
name: "tag4",
description: "A fourth tag to search for.",
type: stringType,
required: false,
},
{
name: "tag5",
description: "A fifth tag to search for.",
type: stringType,
required: false,
},
{
name: "tag6",
description: "A sixth tag to search for.",
type: stringType,
required: false,
},
],
},
{
name: "wiki",
description: "Look up the wiki entry for a tag.",
options: [
{
name: "tag",
description: "A tag to search for.",
type: stringType,
required: true,
},
],
},
];
export function registerCommands(): void {
console.log("Registering commands...");
const koakumaToken = env("KOAKUMA_TOKEN");
const rest = new REST({ version: "9" }).setToken(koakumaToken);
rest.put(commandRoute, { body: commands });
}