/**
 * Arbeit Telegram Bot executable file;
 * Setup mongoose and starts logic.js.
 *
 * @module app
 * @license MIT
 */

/** Dependencies */
const mongoose = require('mongoose');
const events = require('events');

// noinspection JSAnnotator
global.eventEmitter = new events.EventEmitter();

/** Configure a bot */
const config = require('./config');

/** Setup mongoose */
mongoose.Promise = global.Promise;
mongoose.connect(config.database);

/** Start bot */
require('./helpers/logic');

/** Start stat server */
require('./helpers/statServer');

/** Start timers for retention boost and reminders */
require('./helpers/timers').startTimers();

/** Print a message to assure that bot is up and running */
console.log('Bot is up and running'); // eslint-disable-line no-console

@@ -164,17 +164,17 @@
 ire(
-'
+%22
 mongoose
 ');%0A
@@ -169,17 +169,17 @@
 mongoose
-'
+%22
 );%0Aconst
@@ -200,16 +200,16 @@
 ire(
-'
+%22
 events
-'
+%22
 );%0A%0A
@@ -336,17 +336,17 @@
 ire(
-'
+%22
 ./config
 ');%0A
@@ -341,17 +341,17 @@
 ./config
-'
+%22
 );%0A%0A/** 
@@ -456,33 +456,33 @@
  bot */%0Arequire(
-'
+%22
 ./helpers/logic'
@@ -480,17 +480,17 @@
 rs/logic
-'
+%22
 );%0A%0A/** 
@@ -510,33 +510,33 @@
 rver */%0Arequire(
-'
+%22
 ./helpers/statSe
@@ -539,17 +539,17 @@
 atServer
-'
+%22
 );%0A%0A/** 
@@ -606,17 +606,17 @@
 require(
-'
+%22
 ./helper
@@ -623,17 +623,17 @@
 s/timers
-'
+%22
 ).startT
@@ -714,17 +714,17 @@
 ole.log(
-'
+%22
 Bot is u
@@ -740,9 +740,9 @@
 ning
-'
+%22
 ); /
@@ -774,8 +774,110 @@
 console%0A
+%0Aprocess.on(%22unhandledRejection%22, (reason) =%3E %7B%0A  console.log(%22Unhandled Rejection at:%22, reason);%0A%7D);%0A

add unhandled rejection handler