From ed6cb094743b6745c3efd12712415976947e1f97 Mon Sep 17 00:00:00 2001 From: Yago Date: Tue, 7 Jun 2016 00:44:21 +0200 Subject: [PATCH] Bind this.processUpdate to TelegramBot context --- src/telegram.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/telegram.js b/src/telegram.js index 46f4048..7685e58 100644 --- a/src/telegram.js +++ b/src/telegram.js @@ -55,7 +55,7 @@ class TelegramBot extends EventEmitter { } if (options.webHook) { - this._WebHook = new TelegramBotWebHook(token, options.webHook, this.processUpdate); + this._WebHook = new TelegramBotWebHook(token, options.webHook, this.processUpdate.bind(this)); } } @@ -64,10 +64,10 @@ class TelegramBot extends EventEmitter { this._polling.abort = true; this._polling.lastRequest.cancel('Polling restart'); } - this._polling = new TelegramBotPolling(this.token, this.options.polling, this.processUpdate); + this._polling = new TelegramBotPolling(this.token, this.options.polling, this.processUpdate.bind(this)); } - processUpdate = (update) => { + processUpdate(update) { debug('Process Update %j', update); const message = update.message; const inlineQuery = update.inline_query;