diff --git a/ecosystem.config.js b/ecosystem.config.js index 6baf20d..faaaf88 100644 --- a/ecosystem.config.js +++ b/ecosystem.config.js @@ -1,9 +1,9 @@ module.exports = { apps: [ { - name: 'Exchange bot', + name: 'exchange-bot', script: './src/index.js', - instances: 2, + instances: 1, autorestart: true, watch: true, exec_mode: 'cluster', @@ -14,6 +14,7 @@ module.exports = { env_production: { NODE_ENV: 'production', }, + log_date_format: 'YYYY-MM-DD HH:mm Z', }, ], diff --git a/src/bot/bot.js b/src/bot/bot.js index f5affb9..db79fcb 100644 --- a/src/bot/bot.js +++ b/src/bot/bot.js @@ -1,6 +1,6 @@ const Telegraf = require('telegraf'); const Markup = require('telegraf/markup'); -const { get, isEmpty } = require('lodash'); +const { isEmpty } = require('lodash'); const { TOKEN } = require('../config/env'); const UsersModel = require('../models/Users'); const addMenus = require('./utils/addMenus'); @@ -11,7 +11,6 @@ const UserModel = require('../models/Users'); const execute = () => { const bot = new Telegraf(TOKEN); applyMiddlewares(bot); - bot.start(async ctx => { const usersModel = new UsersModel(); const model = { @@ -80,6 +79,7 @@ const execute = () => { bot.on('text', async ctx => ctx.reply('Some wrong action! Please write something else.'), ); + bot.launch(); }; diff --git a/src/config/env.js b/src/config/env.js index 701ad4b..24bbfc6 100644 --- a/src/config/env.js +++ b/src/config/env.js @@ -1,5 +1,5 @@ const path = require('path'); -require('dotenv').config({ path: path.join(__dirname, '.env') }); +require('dotenv').config({ path: path.join(__dirname, '../../.env') }); module.exports = { DEBUG: process.env.DEBUG,