I'm creating a Telegram bot and try to implement module-like architecture for it. So, for handling inline queries, I'm created that class:
class inlineVacationsHandler {
constructor(bot){
this.bot = bot;
this.bot.on('inline_query',this.handler);
}
handler(msg){
console.log(this.bot);
}
}
var bot = new TelegramBot(config.token_dev, {polling: true});
var inline = new inlineVacationsHandler(bot);
But problem is, that I can't use class field "bot" in eventHandler, because in this case "this" don't point to inlineVacationsHandler class. So, how I can get "bot" object from hadler function? Thanks. I'm using Node.js and ES2016.