mirror of
https://github.com/abocn/TelegramBot.git
synced 2025-03-10 04:39:57 +00:00
Migrated everything to dotenvx + edited .gitignore
This commit is contained in:
parent
4269700b66
commit
9944b67edd
6
.gitignore
vendored
6
.gitignore
vendored
@ -132,9 +132,9 @@ dist
|
||||
# Specific
|
||||
*.env
|
||||
*.txt
|
||||
props/*
|
||||
package-lock.json
|
||||
!props/resources.json
|
||||
*.json
|
||||
*.mp4
|
||||
package-lock.json
|
||||
!resources.json
|
||||
plugins/*
|
||||
tmp/*
|
@ -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');
|
||||
|
@ -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 };
|
||||
}
|
||||
|
@ -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, {
|
||||
|
@ -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 = {};
|
||||
|
@ -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', {
|
||||
|
Loading…
x
Reference in New Issue
Block a user