-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathdeploy-commands.js
More file actions
43 lines (37 loc) · 1.13 KB
/
deploy-commands.js
File metadata and controls
43 lines (37 loc) · 1.13 KB
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
/**
* Minecraft Server Status Bot - Command Deployment
* Created by Team BLK
*/
const { REST, Routes } = require('discord.js');
const config = require('./config.json');
const commands = [
{
name: 'status',
description: 'Get the current status of a Minecraft server',
options: [
{
name: 'server',
description: 'The name of the server to check',
type: 3, // STRING
required: true,
choices: config.minecraft.servers.map(server => ({
name: server.name,
value: server.name
}))
}
],
}
];
const rest = new REST({ version: '10' }).setToken(config.bot.token);
(async () => {
try {
console.log('Started refreshing application (/) commands.');
await rest.put(
Routes.applicationCommands(config.bot.clientId),
{ body: commands },
);
console.log('Successfully reloaded application (/) commands.');
} catch (error) {
console.error(error);
}
})();