V
V
Vlad Gapanovich2021-10-19 19:43:29
Node.js
Vlad Gapanovich, 2021-10-19 19:43:29

Why is the bot sending the same message?

I'm making a bot on telegraf and ran into one problem. Why is my inline_keyboard not updating. When I send the first post to the channel through the bot and make the second post and also send the first post to the channel, and not the new one?

reply_markup: {
          inline_keyboard: [
            [{ text: `Смотреть ${type}`, url: url }],
            [
              { text: `Отправить 1 канал`, callback_data: 'KH' },
              { text: `Отправить 2 канал`, callback_data: 'KS' },
            ],
            [{ text: `Отправить во все каналы`, callback_data: 'ALL' }],
          ],
        },
 
// callback
    bot.action('KH', (ctx) => {
      message.then((result) => postToChannel(result.text, ctx));
    });
 
    bot.action('KS', (ctx) => {
      message.then((result) => postToStar(result.text, ctx));
    });
 
    bot.action('ALL', (ctx) => {
      message.then((result) => postToChannel(result.text, ctx));
    });
    // пост в каналы
    const postToChannel = (text, ctx) => {
      ctx.telegram.sendMessage('channel', text, {
        parse_mode: 'html',
        reply_markup: {
          inline_keyboard: ,
        },
      });
    };


message is the message that the bot sends me from inline_keyboard

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