-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathdeploy-commands.js
46 lines (42 loc) · 1.88 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
45
46
const { SlashCommandBuilder } = require('@discordjs/builders');
const { REST } = require('@discordjs/rest');
const { Routes } = require('discord-api-types/v9');
const { clientId, testGuildId, token } = require('./config.json');
const commands = [
new SlashCommandBuilder()
.setName('link')
.setDescription('Link your discord account with a BeatLeader account!')
.addStringOption(option =>
option.setName('userid')
.setDescription('The User ID of your BeatLeader account.')
.setRequired(true)),
new SlashCommandBuilder()
.setName('unlink')
.setDescription('Unink your discord account with a BeatLeader account!'),
new SlashCommandBuilder()
.setName('rank')
.setDescription(`Replies with user's leaderboard rank!`)
.addStringOption(option =>
option.setName('userid')
.setDescription(`The User ID of the BeatLeader account.`)
.setRequired(false))
.addMentionableOption(option =>
option.setName('mentionable')
.setDescription(`Mention the user with a linked BeatLeader account.`)
.setRequired(false)),
new SlashCommandBuilder()
.setName('map')
.setDescription(`Replies with details on a map!`)
.addStringOption(option =>
option.setName('key')
.setDescription(`The map key of the beatmap from BeatSaver.`)
.setRequired(true))
]
.map(command => command.toJSON());
const rest = new REST({ version: '9' }).setToken(token);
rest.put(Routes.applicationCommands(clientId), { body: commands })
.then(() => console.log('Successfully registered application commands.'))
.catch(console.error);
rest.put(Routes.applicationGuildCommands(clientId, testGuildId), { body: commands })
.then(() => console.log('Successfully registered application commands.'))
.catch(console.error);