24 lines
699 B
JavaScript
24 lines
699 B
JavaScript
const { REST, Routes } = require('discord.js');
|
|
const fs = require('fs');
|
|
require('dotenv').config();
|
|
|
|
const commands = [];
|
|
const commandFiles = fs.readdirSync('./SlashCommands').filter(file => file.endsWith('.js'));
|
|
|
|
for (const file of commandFiles) {
|
|
const command = require(`./SlashCommands/${file}`);
|
|
commands.push(command.data.toJSON());
|
|
}
|
|
|
|
const rest = new REST({ version: '10' }).setToken(process.env.TOKEN);
|
|
|
|
(async () => {
|
|
try {
|
|
console.log('⏳ Deploying slash commands...');
|
|
await rest.put(Routes.applicationCommands(process.env.CLIENT_ID), { body: commands });
|
|
console.log('✅ Commands deployed successfully.');
|
|
} catch (error) {
|
|
console.error(error);
|
|
}
|
|
})();
|