-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
executable file
·23 lines (16 loc) · 945 Bytes
/
index.js
File metadata and controls
executable file
·23 lines (16 loc) · 945 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
process['env']['NODE_ENV'] = process['env']['NODE_ENV'] || 'development';
require('dotenv').config({ path: `./.env.${process['env']['NODE_ENV']}` });
const route = require('./routes');
const log = require("./config/log");
const database = require('./config/connection');
const TelegramBot = require('node-telegram-bot-api');
const bot = new TelegramBot(process['env']['TELEGRAM_BOT_TOKEN'], { polling: true });
require('./config/scheduledTask')(bot);
// ***************************** CONNECT TO DATABASE *****************************
database.getConnection();
// **************************** INITIALIZE ALL ROUTES ****************************
route(bot);
// ********************************** START BOT **********************************
bot.on('polling_error', log.ERROR);
// ****************************** BOT START LOG **********************************
log.START('🚀🤖 Bot is now running and ready to accept commands! 🚀🤖');