Closed salimbene closed 4 years ago
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 ?
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!
Fixed in 2.0
Hello!
sendPhoto
does not supportparse_mode
correct? It doesnt seem to do anything with either 'html' or 'parse_node'Great API by the way. Cheers!