diff --git a/.gitignore b/.gitignore index 4816fd8..71e022f 100644 --- a/.gitignore +++ b/.gitignore @@ -132,9 +132,9 @@ dist # Specific *.env *.txt -props/* -package-lock.json -!props/resources.json +*.json *.mp4 +package-lock.json +!resources.json plugins/* tmp/* \ No newline at end of file diff --git a/src/bot.js b/src/bot.js index ba0a6b8..af34c08 100644 --- a/src/bot.js +++ b/src/bot.js @@ -1,7 +1,6 @@ const { Telegraf } = require('telegraf'); 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'); diff --git a/src/commands/admin.js b/src/commands/admin.js index cfb1de1..ef5929c 100644 --- a/src/commands/admin.js +++ b/src/commands/admin.js @@ -1,4 +1,3 @@ -const Config = require('../props/config.json'); const { getStrings } = require('../plugins/checklang.js'); const { isOnSpamWatch } = require('../plugins/lib-spamwatch/spamwatch.js'); const spamwatchMiddleware = require('../plugins/lib-spamwatch/Middleware.js')(isOnSpamWatch); @@ -10,7 +9,7 @@ async function collectInfo(ctx) { const userId = parseInt(ctx.message.text.split(' ')[1], 10); const admins = await ctx.telegram.getChatAdministrators(chatId); const isAdmin = admins.some(admin => admin.user.id === adminId); - const onCrew = Config.admins.includes(adminId); + const onCrew = process.env.botAdmins.includes(adminId); return { Strings, chatId, userId, isAdmin, onCrew }; } diff --git a/src/commands/crew.js b/src/commands/crew.js index 283abea..9f03684 100644 --- a/src/commands/crew.js +++ b/src/commands/crew.js @@ -1,4 +1,3 @@ -const Config = require('../props/config.json'); const { getStrings } = require('../plugins/checklang.js'); const { isOnSpamWatch } = require('../plugins/lib-spamwatch/spamwatch.js'); const spamwatchMiddleware = require('../plugins/lib-spamwatch/Middleware.js')(isOnSpamWatch); @@ -54,7 +53,7 @@ function getSystemInfo() { async function handleAdminCommand(ctx, action, successMessage, errorMessage) { const Strings = getStrings(ctx.from.language_code); const userId = ctx.from.id; - if (Config.admins.includes(userId)) { + if (process.env.botAdmins.includes(userId)) { try { await action(); ctx.reply(successMessage, { diff --git a/src/commands/lastfm.js b/src/commands/lastfm.js index 22338af..68094eb 100644 --- a/src/commands/lastfm.js +++ b/src/commands/lastfm.js @@ -1,12 +1,11 @@ const fs = require('fs'); const axios = require('axios'); -const Config = require('../props/config.json'); const { getStrings } = require('../plugins/checklang.js'); const { isOnSpamWatch } = require('../plugins/lib-spamwatch/spamwatch.js'); const spamwatchMiddleware = require('../plugins/lib-spamwatch/Middleware.js')(isOnSpamWatch); const scrobbler_url = 'http://ws.audioscrobbler.com/2.0/'; -const api_key = Config.lastKey; +const api_key = process.env.lastKey; const dbFile = 'src/props/lastfm.json'; let users = {}; diff --git a/src/commands/weather.js b/src/commands/weather.js index 3c28c3c..f436055 100644 --- a/src/commands/weather.js +++ b/src/commands/weather.js @@ -3,7 +3,6 @@ // Minor code changes by lucmsilva (https://github.com/lucmsilva651) const axios = require('axios'); -const Config = require('../props/config.json'); const { getStrings } = require('../plugins/checklang.js'); const { isOnSpamWatch } = require('../plugins/lib-spamwatch/spamwatch.js'); const spamwatchMiddleware = require('../plugins/lib-spamwatch/Middleware.js')(isOnSpamWatch); @@ -46,7 +45,7 @@ module.exports = (bot) => { } const location = args.slice(9); - const apiKey = Config.weatherKey; + const apiKey = process.env.weatherKey; try { const locationResponse = await axios.get('https://api.weather.com/v3/location/search', {