V
V
Vlad Gapanovich2021-10-20 20:54:32
Node.js
Vlad Gapanovich, 2021-10-20 20:54:32

How to properly implement message forwarding from a bot to a telegram channel?

I got an error. I don’t understand how to forward a message from a telegram bot to a channel. I'm using telegraf.js After sending the first message, I want to send the second, and the first is forwarded. The first photo is the answers in the bot. The second photo is what comes into the channel.

The code that I have 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: `Смотреть`, url: 'https://www.instagram.com/' }],
        [{ text: 'Телеграм 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: ,
      },
    });
  };
});


SLkUi.png
TdpW0.png

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question