From df4d9c06f3f5f3f8c2421328d32cba813d4a6576 Mon Sep 17 00:00:00 2001 From: GochoMugo Date: Fri, 13 Jan 2017 10:52:43 +0300 Subject: [PATCH] src: Fix default options in constructors --- src/telegram.js | 4 +++- src/telegramPolling.js | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/telegram.js b/src/telegram.js index b5a51cc..0a7a97e 100644 --- a/src/telegram.js +++ b/src/telegram.js @@ -71,8 +71,10 @@ class TelegramBot extends EventEmitter { super(); this.token = token; this.options = options; + this.options.polling = (typeof options.polling === 'undefined') ? false : options.polling; + this.options.webHook = (typeof options.webHook === 'undefined') ? false : options.webHook; this.options.baseApiUrl = options.baseApiUrl || 'https://api.telegram.org'; - this.options.filepath = typeof options.filepath === 'undefined' ? true : options.filepath; + this.options.filepath = (typeof options.filepath === 'undefined') ? true : options.filepath; this._textRegexpCallbacks = []; this._onReplyToMessages = []; this._polling = null; diff --git a/src/telegramPolling.js b/src/telegramPolling.js index b2e3464..91d6b45 100644 --- a/src/telegramPolling.js +++ b/src/telegramPolling.js @@ -25,7 +25,7 @@ class TelegramBotPolling { this.request = request; this.options = options; - this.options.timeout = options.timeout || 10; + this.options.timeout = (typeof options.timeout === 'number') ? options.timeout : 10; this.options.interval = (typeof options.interval === 'number') ? options.interval : 300; this.callback = callback; this._offset = 0;