mirror of
https://github.com/darksaid98/cadence-discord-bot.git
synced 2026-12-04 14:38:49 +00:00
Update deploy commands
This commit is contained in:
1 parent
4727c6ca60
commit
9feff8c62f
3 files changed
+34
-1
No files matched your search
@@ -16,6 +16,7 @@ const rest = new REST({ version: '10' }).setToken(token);
|
|||||||
|
|
||||||
(async () => {
|
(async () => {
|
||||||
try {
|
try {
|
||||||
|
console.log("DEPLOYING BOT SLASH COMMANDS");
|
||||||
console.log("Commands: ", commands.map((command) => {return command.name}));
|
console.log("Commands: ", commands.map((command) => {return command.name}));
|
||||||
|
|
||||||
console.log('Started refreshing application (/) commands.');
|
console.log('Started refreshing application (/) commands.');
|
||||||
|
|||||||
@@ -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
@@ -6,7 +6,7 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "echo \"Error: no test specified\" && exit 1",
|
"test": "echo \"Error: no test specified\" && exit 1",
|
||||||
"start": "node ./index.js",
|
"start": "node ./index.js",
|
||||||
"deploy": "node ./deploy-commands.js"
|
"deploy": "node ./deploy-commands.js && node ./deploy-system-commands.js"
|
||||||
},
|
},
|
||||||
"author": "",
|
"author": "",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
|
|||||||
Reference in new issue
Block a user