mirror of
https://github.com/darksaid98/cadence-discord-bot.git
synced 2026-12-03 22:15:37 +00:00
feat: Added .env file, and moved some properties from config.json to .env file
This commit is contained in:
1 parent
d96b40e277
commit
cc3fd9569c
9 files changed
+50
-19
No files matched your search
+10
-5
@@ -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) {
|
||||
|
||||
Reference in new issue
Block a user