node-telegram-bot-api icon indicating copy to clipboard operation
node-telegram-bot-api copied to clipboard

remove_keyboard doesn't work in sendPhoto

Open damnvalium opened this issue 3 years ago • 1 comments

Bug Report

I have read:

I am using the latest version of the library.

Expected Behavior

sendPhoto(msg.from.id, 'img.png', { reply_markup: { inline_keyboard: [
                [{ text: 'btn', callback_data: 'data' }]],
                remove_keyboard: true
                }
        }
);

It should remove the keyboard created in a previous message.

Actual Behavior

The previous created keyboard is not removed, it is necessary to send an additional text message containing the option to remove it.

Steps to reproduce the Behavior

  1. Create a ReplyKeyboardMarkup
  2. Try removing it from sendPhoto

damnvalium avatar Nov 17 '22 20:11 damnvalium

The problem is more that you can't do two things at the same time (Telegram Bot API backend limits). If in your message send the remove_keyboard: true, you can't send a inline_keyboard for your photo. Telegram ignore the remove_keyboard in your case.

    bot.sendMessage(msg.from.id, "Hello", { reply_markup:  {
        keyboard: [["Yes"], ["No"]],
        resize_keyboard: true,
    } })

    bot.sendPhoto(msg.from.id, "https://raw.githubusercontent.com/yagop/node-telegram-bot-api/53b5565e8a87933d096de61af22e39711cbc8273/test/data/chat_photo.png", {
        reply_markup: {
            remove_keyboard: true
        }
    }

danielperez9430 avatar Jan 10 '23 17:01 danielperez9430