From afd2373351fd8280ea3a5eaecd458f899da734a9 Mon Sep 17 00:00:00 2001 From: Alexander Tarmolov Date: Mon, 21 Nov 2016 12:25:33 +0300 Subject: [PATCH] Proxy extra request options (PR #178) --- src/telegram.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/telegram.js b/src/telegram.js index 12c6614..516a0e6 100644 --- a/src/telegram.js +++ b/src/telegram.js @@ -42,6 +42,7 @@ class TelegramBot extends EventEmitter { * @param {String} [options.webHook.key] PEM private key to webHook server. * @param {String} [options.webHook.cert] PEM certificate (public) to webHook server. * @param {Boolean} [options.onlyFirstMatch=false] Set to true to stop after first match. Otherwise, all regexps are executed + * @param {Object} [options.request] Options which will be added for all requests to telegram api. * @see https://core.telegram.org/bots/api */ constructor(token, options = {}) { @@ -168,6 +169,10 @@ class TelegramBot extends EventEmitter { throw new Error('Telegram Bot Token not provided!'); } + if (this.options.request) { + Object.assign(options, this.options.request); + } + if (options.form) { this._fixReplyMarkup(options.form); }