sendPhoto parse_mode
salimbene opened this issue · 3 comments
salimbene commented
Hello! sendPhoto
does not support parse_mode
correct? It doesnt seem to do anything with either 'html' or 'parse_node'
const response = await api.sendPhoto({
chat_id,
photo,
caption,
parse_mode: 'Markdown'
});
return response;
Great API by the way. Cheers!
realtebo commented
I have the same problem
await api.sendPhoto({
chat_id,
caption: "*" + title + "* \n" + caption + "",
parse_mode: "MarkdownV2",
photo: image_name,
})
The result is a caption with litteral "*" .
Why ?
pedroaf0 commented
Hi! the sendPhoto method supports parse_mode
look:
This is because the parse_mode is not included in the args.
look:
this.sendPhoto = function (params, cb)
{
return new Promise(function(resolve, reject)
{
// Act different depending on value params.photo
fs.exists(params.photo, function (exists)
{
var photo = null;
if (exists)
{
// params.photo is path to file
photo = fs.createReadStream(params.photo);
}
else
{
// params.photo is not a file, simply pass it to POST
photo = params.photo;
}
var args = {
chat_id: params.chat_id,
photo: photo
};
if (params.caption !== undefined)
{
args.caption = params.caption;
}
if (params.reply_to_message_id !== undefined)
{
args.reply_to_message_id = params.reply_to_message_id;
}
if (params.reply_markup !== undefined)
{
args.reply_markup = params.reply_markup;
}
_rest({
method: 'POST',
json: true,
formData: args,
uri: _baseurl + 'sendPhoto'
})
.then(function(body)
{
return commonResponseHandler(body);
})
.then(function(data)
{
resolve(data);
})
.catch(function(err)
{
reject(err);
});
});
}).nodeify(cb);
};
I will launch a PR with the correction soon!
mast commented
Fixed in 2.0