feat: Added .env file, and moved some properties from config.json to .env file

This commit is contained in:
Marius Begby committed 2023-07-13 10:40:53 +02:00
1 parent d96b40e277
commit cc3fd9569c
9 files changed
+50 -19

No files matched your search

+10 -5
View File
@@ -1,7 +1,7 @@
const fs = require('node:fs');
const logger = require('./services/logger.js');
const { REST, Routes } = require('discord.js');
const { token, clientId } = require('./config.json');
require('dotenv').config();
const commands = [];
const commandFiles = fs
@@ -13,7 +13,9 @@ for (const file of commandFiles) {
commands.push(command.data.toJSON());
}
const rest = new REST({ version: '10' }).setToken(token);
const rest = new REST({ version: '10' }).setToken(
process.env.DISCORD_BOT_TOKEN
);
(async () => {
try {
@@ -27,9 +29,12 @@ const rest = new REST({ version: '10' }).setToken(token);
logger.info('Started refreshing application (/) bot commands.');
await rest.put(Routes.applicationCommands(clientId), {
body: commands
});
await rest.put(
Routes.applicationCommands(process.env.DISCORD_CLIENT_ID),
{
body: commands
}
);
logger.info('Successfully refreshed application (/) bot commands.');
} catch (error) {