This commit is contained in:
Skylar Grant 2023-02-10 20:17:21 -05:00 committed by GitHub
parent 29a48ac6ea
commit 33718b1162
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 41 deletions

3
.env Normal file
View File

@ -0,0 +1,3 @@
TOKEN=
DEBUG=true
CLIENTID=

View File

@ -1,39 +0,0 @@
// dotenv for handling environment variables
const dotenv = require('dotenv');
dotenv.config();
const { REST, Routes } = require('discord.js');
const { guildId } = require('../data/config.json');
const clientId = process.env.clientId;
const token = process.env.TOKEN;
const fs = require('fs');
const commands = [];
const commandFiles = fs.readdirSync('../slash-commands').filter(file => file.endsWith('.js'));
for (const file of commandFiles) {
const command = require(`../slash-commands/${file}`);
if (command.data != undefined) {
commands.push(command.data.toJSON());
}
}
console.log(commands);
const rest = new REST({ version: '10' }).setToken(token);
(async () => {
try {
console.log('Started refreshing application (/) commands.');
await rest.put(
Routes.applicationGuildCommands(clientId, guildId),
{ body: commands },
);
console.log('Successfully reloaded application (/) commands.');
process.exit();
} catch (error) {
console.error(error);
}
})();

View File

@ -4,7 +4,7 @@ dotenv.config();
const { REST } = require('@discordjs/rest');
const { Routes } = require('discord-api-types/v9');
const clientId = process.env.clientId;
const clientId = process.env.CLIENTID;
const token = process.env.TOKEN;
const fs = require('fs');
@ -18,7 +18,7 @@ for (const file of commandFiles) {
}
}
console.log(commands);
// console.log(commands);
const rest = new REST({ version: '9' }).setToken(token);