From e3a2fbcc787026d2d8a8b998c85fe8e532c0b8a4 Mon Sep 17 00:00:00 2001 From: A Bunch of Computer Nerds Date: Sun, 8 Dec 2024 20:34:29 -0300 Subject: [PATCH] Migrated to .env --- .gitignore | 1 + package.json | 1 + src/bot.js | 3 ++- src/commands/lastfm.js | 2 +- 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 810c4c0..4816fd8 100644 --- a/.gitignore +++ b/.gitignore @@ -130,6 +130,7 @@ dist .pnp.* # Specific +*.env *.txt props/* package-lock.json diff --git a/package.json b/package.json index ec20d6b..875c635 100644 --- a/package.json +++ b/package.json @@ -4,6 +4,7 @@ "test": "echo \"Error: no test specified\" && exit 1" }, "dependencies": { + "@dotenvx/dotenvx": "^1.28.0", "axios": "^1.7.9", "child_process": "^1.0.2", "commander": "^12.1.0", diff --git a/src/bot.js b/src/bot.js index 1f07377..cc17137 100644 --- a/src/bot.js +++ b/src/bot.js @@ -3,10 +3,11 @@ const path = require('path'); const fs = require('fs'); const Config = require('./props/config.json'); const { isOnSpamWatch } = require('./plugins/lib-spamwatch/spamwatch.js'); +require('@dotenvx/dotenvx').config({ path: "config.env" }); require('./plugins/ytdlp-wrapper.js'); // require('./plugins/termlogger.js'); -const bot = new Telegraf(Config.botToken); +const bot = new Telegraf(process.env.botToken); const MAX_RETRIES = 5; let restartCount = 0; diff --git a/src/commands/lastfm.js b/src/commands/lastfm.js index 57b3811..22338af 100644 --- a/src/commands/lastfm.js +++ b/src/commands/lastfm.js @@ -8,7 +8,7 @@ const spamwatchMiddleware = require('../plugins/lib-spamwatch/Middleware.js')(is const scrobbler_url = 'http://ws.audioscrobbler.com/2.0/'; const api_key = Config.lastKey; -const dbFile = 'props/lastfm.json'; +const dbFile = 'src/props/lastfm.json'; let users = {}; function loadUsers() {