Answer the question
In order to leave comments, you need to log in
Is it possible to somehow customize link_preview when sending by telegram bot?
I am using node-telegram-bot-api.
I send a link (to a post in VK) via bot.sendMessage to the bot, a preview is loaded there, and I would like to throw a blur effect on it at that moment.
I think that it is possible to implement something through parse_mode, but something the right idea does not come to mind .....
bot.sendMessage(chatId, 'Заголовок: ' + post.text + '\nСсылка: https://vk.com/wall' + wall + '_' + post.id, {parse_mode: 'HTML', disable_web_page_preview: false});
Answer the question
In order to leave comments, you need to log in
In fact , kruslan's answer is correct, but if suddenly someone needs to solve this problem, then I did it like this: Add the Jimp
library - npm install --save jimp (it has a lot of different image edits)
Add it to the project.
Well, in fact, you get your picture (locally or via url), blur it, save it, and then send it via botSendPhoto.
A crutch, of course, but I didn’t think of it differently.
Blur function example.
blurImage(attachment, attachName); //attachment - урл изображения, attachName - название картинки.
bot.sendPhoto(chatId, 'blurred/' + attachName + '.png', {caption: ' Заголовок: ' + post.text + '\nСсылка: https://vk.com/wall' + wall + '_' + post.id} );
async function blurImage(path, name = '') {
const image = await Jimp.read(path);
image.blur(15)
.write('blurred/' + name + '.png');
console.log('Image Processing Completed');
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question