yagop / node-telegram-bot-api

Telegram Bot API for NodeJS
MIT License
8.3k stars 1.5k forks source link

remove_keyboard doesn't work in sendPhoto #1026

Open damnvalium opened 1 year ago

damnvalium commented 1 year ago

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

danielperez9430 commented 1 year ago

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
        }
    }