mirror of
https://github.com/yagop/node-telegram-bot-api
synced 2025-08-29 13:27:44 +00:00
Fix ES6 syntax
Fix: This enables the library to be used without transpiling on Node 6 (current LTS). Author: @GingerPlusPlus
This commit is contained in:
parent
215e0dc23b
commit
487b5f4b8b
@ -27,6 +27,8 @@ class TelegramBotWebHook {
|
|||||||
this.callback = callback;
|
this.callback = callback;
|
||||||
this._regex = new RegExp(this.token);
|
this._regex = new RegExp(this.token);
|
||||||
this._webServer = null;
|
this._webServer = null;
|
||||||
|
this._requestListener = this._requestListener.bind(this);
|
||||||
|
this._parseBody = this._parseBody.bind(this);
|
||||||
|
|
||||||
if (options.key && options.cert) { // HTTPS Server
|
if (options.key && options.cert) { // HTTPS Server
|
||||||
debug('HTTPS WebHook enabled');
|
debug('HTTPS WebHook enabled');
|
||||||
@ -59,7 +61,7 @@ class TelegramBotWebHook {
|
|||||||
* Handle request body by passing it to 'callback'
|
* Handle request body by passing it to 'callback'
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
_parseBody = (err, body) => {
|
_parseBody(err, body) {
|
||||||
if (err) {
|
if (err) {
|
||||||
return debug(err);
|
return debug(err);
|
||||||
}
|
}
|
||||||
@ -78,7 +80,7 @@ class TelegramBotWebHook {
|
|||||||
* @see https://nodejs.org/docs/latest/api/http.html#http_http_createserver_requestlistener
|
* @see https://nodejs.org/docs/latest/api/http.html#http_http_createserver_requestlistener
|
||||||
* @see https://nodejs.org/docs/latest/api/https.html#https_https_createserver_options_requestlistener
|
* @see https://nodejs.org/docs/latest/api/https.html#https_https_createserver_options_requestlistener
|
||||||
*/
|
*/
|
||||||
_requestListener = (req, res) => {
|
_requestListener(req, res) {
|
||||||
debug('WebHook request URL: %s', req.url);
|
debug('WebHook request URL: %s', req.url);
|
||||||
debug('WebHook request headers: %j', req.headers);
|
debug('WebHook request headers: %j', req.headers);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user