-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy-commands.js
70 lines (66 loc) · 2.09 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
const { SlashCommandBuilder } = require('@discordjs/builders');
const { REST } = require('@discordjs/rest');
const { Routes } = require('discord-api-types/v9');
const { clientID, guildID, token } = require('./config.json');
const commands = [
new SlashCommandBuilder()
.setName('ping')
.setDescription('replys with pong'),
new SlashCommandBuilder()
.setName('add')
.setDescription('Adds two Numbers')
.addIntegerOption(option =>
option.setName('num1')
.setDescription('First Number')
.setRequired(true)
)
.addIntegerOption(option =>
option.setName('num2')
.setDescription('Second Number')
.setRequired(true)
),
new SlashCommandBuilder()
.setName('to-binary')
.setDescription('Converts a base ten number to binary(base 2, base 10)')
.addStringOption(option =>
option.setName('number')
.setDescription('Number to convert')
.setRequired(true)
)
.addIntegerOption(option =>
option.setName('base')
.setDescription('Base of incoming number (Default: 10)')
.setRequired(false)
),
new SlashCommandBuilder()
.setName('to-hex')
.setDescription('Converts a base ten number to hex(base 16)')
.addStringOption(option =>
option.setName('number')
.setDescription('Number to convert')
.setRequired(true)
)
.addIntegerOption(option =>
option.setName('base')
.setDescription('Base of incoming number (Default: 10)')
.setRequired(false)
),
new SlashCommandBuilder()
.setName('to-decimal')
.setDescription('Converts a base 2-36 number to decimal(base 10)')
.addStringOption(option =>
option.setName('number')
.setDescription('Number to convert')
.setRequired(true)
)
.addIntegerOption(option =>
option.setName('base')
.setDescription('Base of incoming number')
.setRequired(true)
),
]
.map(command => command.toJSON());
const rest = new REST({ version: '9' }).setToken(token);
rest.put(Routes.applicationGuildCommands(clientID, guildID), { body: commands })
.then(() => console.log('Registered Commands successfully'))
.catch(console.error);