JSON stringify reply_markup if not string

experimental
Yago 10 years ago
parent 723dbae5a8
commit 6a6111360b
  1. 7
      src/telegram.js

@ -96,6 +96,13 @@ TelegramBot.prototype._request = function (path, options) {
throw new Error('Telegram Bot Token not provided!'); throw new Error('Telegram Bot Token not provided!');
} }
options = options || {}; options = options || {};
if (options.form) {
var replyMarkup = options.form.reply_markup;
if (replyMarkup && typeof replyMarkup !== 'string') {
// reply_markup must be passed as JSON stringified to Telegram
options.form.reply_markup = JSON.stringify(replyMarkup);
}
}
options.url = this._buildURL(path); options.url = this._buildURL(path);
debug('HTTP request: %j', options); debug('HTTP request: %j', options);
return requestPromise(options) return requestPromise(options)

Loading…
Cancel
Save