From 06867311d7ec92aa09e11534ba081380b1ac0a07 Mon Sep 17 00:00:00 2001 From: Taymuraz Kaytmazov Date: Fri, 18 May 2018 16:37:13 +0300 Subject: [PATCH] refactor: remove botanio Removed due to uselessnes --- src/index.js | 2 -- src/lib/runtime.js | 18 +----------------- 2 files changed, 1 insertion(+), 19 deletions(-) diff --git a/src/index.js b/src/index.js index cc05dad..26f04a0 100644 --- a/src/index.js +++ b/src/index.js @@ -1,4 +1,3 @@ -require('dotenv').config() const debug = require('debug')('rubot:index') const config = require('./config') @@ -40,7 +39,6 @@ catch (error) { const bot = createBot( config.bot.token, - config.bot.botanioToken, features, { username: config.bot.username } ) diff --git a/src/lib/runtime.js b/src/lib/runtime.js index e170c63..18f2993 100644 --- a/src/lib/runtime.js +++ b/src/lib/runtime.js @@ -1,6 +1,5 @@ const debug = require('debug')('rubot:lib:runtime') const Telegraf = require('telegraf') -const Botanio = require('botanio') const extendedContext = require('./extended-context') const { push } = require('./elastic') @@ -25,29 +24,14 @@ function installFeatures(bot, featureList) { * @param {{ username: string }} telegrafConfig * @return {Telegraf} */ -function createBot(token, botanioToken, features, telegrafConfig = {}) { +function createBot(token, features, telegrafConfig = {}) { debug('createBot()', telegrafConfig) const instance = new Telegraf(token, telegrafConfig) - const botan = Botanio(botanioToken) - - instance.use((ctx, next) => { - ctx.botan = botan - next() - }) if (process.env.NODE_ENV === 'development') { instance.use(Telegraf.log()) } - if (process.env.BOTANIO_LOG) { - instance.use((ctx, next) => { - if (ctx.update.message) { - ctx.botan.track(ctx.update.message, 'update') - } - next() - }) - } - if (process.env.ELASTIC_LOG) { instance.use((ctx, next) => { if (ctx.update.message) {