mirror of
https://github.com/yagop/node-telegram-bot-api
synced 2025-08-28 12:57:38 +00:00
doc: Document options.webHook.host
This commit is contained in:
parent
c886cf2cb5
commit
dad8697411
@ -74,6 +74,7 @@ Emits `message` when a message arrives.
|
||||
| [options.polling.interval] | <code>String</code> | <code>Number</code> | <code>300</code> | Interval between requests in miliseconds |
|
||||
| [options.polling.autoStart] | <code>Boolean</code> | <code>true</code> | Start polling immediately |
|
||||
| [options.webHook] | <code>Boolean</code> | <code>Object</code> | <code>false</code> | Set true to enable WebHook or set options |
|
||||
| [options.webHook.host] | <code>String</code> | <code>0.0.0.0</code> | Host to bind to |
|
||||
| [options.webHook.port] | <code>Number</code> | <code>8443</code> | Port to bind to |
|
||||
| [options.webHook.key] | <code>String</code> | | Path to file with PEM private key for webHook server. The file is read **synchronously**! |
|
||||
| [options.webHook.cert] | <code>String</code> | | Path to file with PEM certificate (public) for webHook server. The file is read **synchronously**! |
|
||||
|
@ -47,6 +47,7 @@ class TelegramBot extends EventEmitter {
|
||||
* @param {String|Number} [options.polling.interval=300] Interval between requests in miliseconds
|
||||
* @param {Boolean} [options.polling.autoStart=true] Start polling immediately
|
||||
* @param {Boolean|Object} [options.webHook=false] Set true to enable WebHook or set options
|
||||
* @param {String} [options.webHook.host=0.0.0.0] Host to bind to
|
||||
* @param {Number} [options.webHook.port=8443] Port to bind to
|
||||
* @param {String} [options.webHook.key] Path to file with PEM private key for webHook server.
|
||||
* The file is read **synchronously**!
|
||||
|
@ -12,6 +12,7 @@ class TelegramBotWebHook {
|
||||
*
|
||||
* @param {String} token Telegram API token
|
||||
* @param {Boolean|Object} options WebHook options
|
||||
* @param {String} [options.host=0.0.0.0] Host to bind to
|
||||
* @param {Number} [options.port=8443] Port to bind to
|
||||
* @param {String} [options.healthEndpoint=/healthz] An endpoint for health checks that always responds with 200 OK
|
||||
* @param {Function} callback Function for process a new update
|
||||
@ -24,11 +25,13 @@ class TelegramBotWebHook {
|
||||
|
||||
this.token = token;
|
||||
this.options = options;
|
||||
this.options.host = options.host || '0.0.0.0';
|
||||
this.options.port = options.port || 8443;
|
||||
this.options.https = options.https || {};
|
||||
this.options.healthEndpoint = options.healthEndpoint || '/healthz';
|
||||
this.callback = callback;
|
||||
this._regex = new RegExp(this.token);
|
||||
this._healthRegex = new RegExp(options.healthEndpoint || '/healthz');
|
||||
this._healthRegex = new RegExp(this.options.healthEndpoint);
|
||||
this._webServer = null;
|
||||
this._open = false;
|
||||
this._requestListener = this._requestListener.bind(this);
|
||||
|
Loading…
x
Reference in New Issue
Block a user