2
0
mirror of https://github.com/yagop/node-telegram-bot-api synced 2025-08-29 21:37:58 +00:00

JSON stringify reply_markup if not string

This commit is contained in:
Yago 2015-11-19 13:54:06 +01:00
parent 723dbae5a8
commit 6a6111360b

View File

@ -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)