-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy-commands.js
36 lines (31 loc) · 972 Bytes
/
deploy-commands.js
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
require("dotenv").config();
const { REST, Routes, SlashCommandBuilder } = require("discord.js");
const commands = [
new SlashCommandBuilder()
.setName("configure")
.setDescription("Configure source and target channels")
.addChannelOption((option) =>
option
.setName("source")
.setDescription("The source channel")
.setRequired(true)
)
.addChannelOption((option) =>
option
.setName("target")
.setDescription("The target channel")
.setRequired(true)
),
].map((command) => command.toJSON());
const rest = new REST({ version: "10" }).setToken(process.env.DISCORD_TOKEN);
(async () => {
try {
console.log("Started refreshing application (/) commands.");
await rest.put(Routes.applicationCommands(process.env.CLIENT_ID), {
body: commands,
});
console.log("Successfully reloaded application (/) commands.");
} catch (error) {
console.error(error);
}
})();