mirror of
https://github.com/yagop/node-telegram-bot-api
synced 2025-09-02 15:25:28 +00:00
Bind this.processUpdate to TelegramBot context
This commit is contained in:
@@ -55,7 +55,7 @@ class TelegramBot extends EventEmitter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (options.webHook) {
|
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.abort = true;
|
||||||
this._polling.lastRequest.cancel('Polling restart');
|
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);
|
debug('Process Update %j', update);
|
||||||
const message = update.message;
|
const message = update.message;
|
||||||
const inlineQuery = update.inline_query;
|
const inlineQuery = update.inline_query;
|
||||||
|
Reference in New Issue
Block a user