I have an error. I don't understand how to forward a message from a telegram bot to a channel. I use telegraf.js After sending the first message, I want to send the second one, and the first one is forwarded. The first photo is the answers in the bot. The second photo is what comes into the channel.
The code itself that I implemented:
bot.on('message', async (ctx) => {
const getFilmId = await kinoInfo(ctx.message.text);
const infoFilm = getFilmId.data.data;
const id = infoFilm.filmId;
const name = infoFilm.nameRu;
ctx.reply(name, {
reply_markup: {
inline_keyboard: [
[{ text: `Watch`, url: 'https://www.instagram.com/' }],
[{ text: 'Telegram channel 1', callback_data: 'ONE' }],
],
},
});
bot.on('callback_query', (ctx) => {
const data = ctx.update.callback_query.data;
if (data === 'ONE') {
postToChannel(ctx);
}
});
const postToChannel = (ctx) => {
ctx.telegram.sendMessage('@fgdsfsdfsd', name, {
parse_mode: 'html',
reply_markup: {
inline_keyboard: [[{ text: `Watch`, url: 'https://www.instagram.com/' }]],
},
});
};
});
use ForwardMessage() method in postToChannel function. and specify message_id
I have a working solution of this. your welcome!