-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy-commands.js
31 lines (27 loc) · 956 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
const { SlashCommandBuilder } = require('@discordjs/builders');
const { REST } = require('@discordjs/rest');
const { Routes } = require('discord-api-types/v9');
const token = process.env.DISCORD_TOKEN;
const clientId = process.env.CLIENT_ID;
const guildId = process.env.GUILD_ID;
const commands = [
new SlashCommandBuilder()
.setName('server-status')
.setDescription('Replies with the Minecraft server status'),
new SlashCommandBuilder()
.setName('mc-user')
.setDescription('Replies with the Minecraft user information')
.addStringOption((option) =>
option
.setName('username')
.setDescription('Minecraft username')
.setRequired(true)
),
];
const rest = new REST({ version: '9' }).setToken(token);
rest
.put(Routes.applicationGuildCommands(clientId, guildId), { body: commands })
.then(() => {
console.log('Successfully registered application commands.');
})
.catch(console.error);