olexnzarov / telegraf-session-mongodb

MongoDB session middleware for Telegraf
25 stars 14 forks source link

Expose connection promise from setup function #5

Closed Piotrovskyi closed 4 years ago

Piotrovskyi commented 4 years ago

I want to be able to run bot.launch() after mongo connection initialization

TelegrafMongoSession.setup(bot, process.env.DB_URL).then(() => { bot.launch(); })

Lack of such opportunity lead to errors like TypeError: Cannot read property 'middleware' of undefined This especially happens to me with Google Cloud Functions