-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy-commands.js
27 lines (22 loc) · 1.22 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
const fs = require('node:fs');
const { REST } = require('@discordjs/rest');
const { Routes } = require('discord-api-types/v9');
const { SlashCommandBuilder } = require('@discordjs/builders');
const { clientId, guildId } = require('./botconfig.json');
const { token } = require('./token.json');
const commands = [
new SlashCommandBuilder().setName('ping').setDescription('Hvis du gerne vil blivet tagget på discorden'),//Den her er til ping rollen
//new SlashCommandBuilder().setName('support').setDescription('Det her er en support command'),//Den her er til support modal ting ting
]
.map(command => command.toJSON());
const commandFiles = fs.readdirSync('./commands').filter(file => file.endsWith('.js'));
for (const file of commandFiles) {
const command = require(`./commands/${file}`);
console.log(`Loaded Slash commands ${file}.`); // printer hvilke kommandoer der er loaded
console.log(`--------------------------`); // printer fin opstilling mellem kommandoer
commands.push(command.data.toJSON());
}
const rest = new REST({ version: '9' }).setToken(token);
rest.put(Routes.applicationGuildCommands(clientId, guildId), { body: commands })
.then(() => console.log('Så er de commands blevet opdateret.'))
.catch(console.error);