Update deploy commands

This commit is contained in:
Marius Begby committed 2023-07-07 00:29:27 +02:00
1 parent 4727c6ca60
commit 9feff8c62f
3 files changed
+34 -1

No files matched your search

+1
View File
@@ -16,6 +16,7 @@ const rest = new REST({ version: '10' }).setToken(token);
(async () => {
try {
console.log("DEPLOYING BOT SLASH COMMANDS");
console.log("Commands: ", commands.map((command) => {return command.name}));
console.log('Started refreshing application (/) commands.');
+32
View File
@@ -0,0 +1,32 @@
const fs = require('node:fs');
const { REST, Routes } = require('discord.js');
const { token, clientId, systemServerGuildId } = require('./config.json');
const systemCommands = [];
const systemCommandFiles = fs
.readdirSync('./system-commands')
.filter((file) => file.endsWith('.js'));
for (const file of systemCommandFiles) {
const systemCommand = require(`./system-commands/${file}`);
systemCommands.push(systemCommand.data.toJSON());
}
const rest = new REST({ version: '10' }).setToken(token);
(async () => {
try {
console.log("DEPLOYING SYSTEM SLASH COMMANDS");
console.log("System Commands: ", systemCommands.map((systemCommand) => {return systemCommand.name}));
console.log('Started refreshing application (/) system commands.');
await rest.put(Routes.applicationGuildCommands(clientId, systemServerGuildId), {
body: systemCommands
});
console.log('Successfully reloaded application (/) system commands.');
} catch (error) {
console.error(error);
}
})();
+1 -1
View File
@@ -6,7 +6,7 @@
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node ./index.js",
"deploy": "node ./deploy-commands.js"
"deploy": "node ./deploy-commands.js && node ./deploy-system-commands.js"
},
"author": "",
"license": "ISC",