2017-07-24 17:12:38 +02:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
// Utils
|
2017-09-27 23:12:12 +03:30
|
|
|
const { logError } = require('./utils/log');
|
2017-09-21 13:57:49 +04:30
|
|
|
|
2017-10-04 23:57:47 +05:30
|
|
|
/**
|
|
|
|
* @type {Telegraf}
|
|
|
|
* Bot
|
|
|
|
*/
|
2017-09-21 13:57:49 +04:30
|
|
|
const bot = require('./bot');
|
|
|
|
|
2017-09-21 23:39:58 +02:00
|
|
|
bot.telegram.getMe().then((botInfo) => {
|
|
|
|
bot.options.username = botInfo.username;
|
2018-01-30 14:38:50 +01:00
|
|
|
bot.context.botInfo = botInfo;
|
2018-09-01 15:46:42 +02:00
|
|
|
}).then(() => {
|
|
|
|
bot.startPolling();
|
2017-09-21 23:39:58 +02:00
|
|
|
});
|
|
|
|
|
2017-10-27 13:50:54 +02:00
|
|
|
bot.use(
|
|
|
|
require('./handlers/middlewares'),
|
|
|
|
require('./handlers/messages'),
|
2017-10-27 18:43:33 +02:00
|
|
|
require('./plugins'),
|
2017-10-27 13:50:54 +02:00
|
|
|
require('./handlers/commands'),
|
2018-01-30 14:38:50 +01:00
|
|
|
require('./handlers/regex'),
|
|
|
|
require('./handlers/unmatched'),
|
2017-10-05 01:15:58 +05:30
|
|
|
);
|
2017-10-27 13:50:54 +02:00
|
|
|
|
2017-07-24 18:08:31 +02:00
|
|
|
|
2017-09-27 23:12:12 +03:30
|
|
|
bot.catch(logError);
|