I'm writing a telegram bot with telegraf . I want to send a photo with a text under it in the reply message. I have written this:
serviceDetailsScene.on('callback_query', async ({replyWithPhoto}) => {
await replyWithPhoto({url: <url>})
}
It works and sends image properly, but I don't know how to append the message to it.
Thanks for any help.
You can do this for replying with image src and caption:
bot.hears('photo', ctx.replyWithPhoto({ source: <pic-src> }, { caption: "cat photo" });
And if you want to send image url you can write this:
bot.hears('photo', ctx.replyWithPhoto({ url: <pic-url> }, { caption: "cat photo" });
试试看:
await replyWithPhoto({url: <url>}, {caption: 'Your caption'})
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.