-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy-commands.js
44 lines (38 loc) · 1.04 KB
/
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
37
38
39
40
41
42
43
44
require('dotenv').config();
const { REST, Routes } = require('discord.js');
const commands = [
{
name: 'track',
description: 'Track a Spotify user by their ID',
options: [
{
name: 'userid',
type: 3, // STRING
description: 'The Spotify user ID to track',
required: true,
},
],
},
{
name: 'tracked',
description: 'List tracked Spotify users',
},
{
name: 'help',
description: 'Show help information',
},
];
async function deployCommands() {
const rest = new REST({ version: '10' }).setToken(process.env.DISCORD_TOKEN);
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);
}
}
deployCommands();