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

+4 -3
View File
@@ -1,7 +1,8 @@
const fs = require('node:fs');
const logger = require('./services/logger.js');
const { REST, Routes } = require('discord.js');
const { token, clientId, systemServerGuildIds } = require('./config.json');
const { systemServerGuildIds } = require('./config.json');
require('dotenv').config();
const systemCommands = [];
const systemCommandFiles = fs
@@ -13,7 +14,7 @@ for (const file of systemCommandFiles) {
systemCommands.push(systemCommand.data.toJSON());
}
const rest = new REST({ version: '10' }).setToken(token);
const rest = new REST({ version: '10' }).setToken(process.env.DISCORD_BOT_TOKEN);
(async () => {
try {
@@ -29,7 +30,7 @@ const rest = new REST({ version: '10' }).setToken(token);
for (const systemServerGuildId of systemServerGuildIds) {
await rest.put(
Routes.applicationGuildCommands(clientId, systemServerGuildId),
Routes.applicationGuildCommands(process.env.DISCORD_CLIENT_ID, systemServerGuildId),
{
body: systemCommands
}