2
0
mirror of https://github.com/yagop/node-telegram-bot-api synced 2025-08-29 13:27:44 +00:00

Proxy extra request options (PR #178)

This commit is contained in:
Alexander Tarmolov 2016-11-21 12:25:33 +03:00 committed by Gocho Mugo
parent d4a5f5d16c
commit afd2373351

View File

@ -42,6 +42,7 @@ class TelegramBot extends EventEmitter {
* @param {String} [options.webHook.key] PEM private key to webHook server. * @param {String} [options.webHook.key] PEM private key to webHook server.
* @param {String} [options.webHook.cert] PEM certificate (public) 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 {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 * @see https://core.telegram.org/bots/api
*/ */
constructor(token, options = {}) { constructor(token, options = {}) {
@ -168,6 +169,10 @@ class TelegramBot extends EventEmitter {
throw new Error('Telegram Bot Token not provided!'); throw new Error('Telegram Bot Token not provided!');
} }
if (this.options.request) {
Object.assign(options, this.options.request);
}
if (options.form) { if (options.form) {
this._fixReplyMarkup(options.form); this._fixReplyMarkup(options.form);
} }