Mikhail Kopylov
Mikhail Kopylov

Reputation: 2058

How to send a message with InlineKeyboardMarkup and ReplyKeyboardRemove at the same time?

I've got a case, when a user clicks a button on a custom keyboard, and I want the bot to send a reply message with an inline keyboard, and, at the same time, remove the custom keyboard, because it's become redundant.

According to the SendMessage API, reply_markup should be one of the following:

So I can't send a combination of InlineKeyboardMarkup and ReplyKeyboardRemove.

I've also tried to send a message with ReplyKeyboardRemove, and then make another request of EditMessageReplyMarkup type, but it fails with

{
    "ok": false,
    "error_code": 400,
    "description": "Bad Request: message can't be edited"
}

That's described a bit in Updating messages section:

Please note, that it is currently only possible to edit messages without reply_markup or with inline keyboards.

I'm currently struggling how can I achieve the goal, probably with some workaround?

Upvotes: 1

Views: 2077

Answers (1)

SnoopFrog
SnoopFrog

Reputation: 724

No, you can't combine these. You would need to send two separate messages, each with different reply_markup.

Upvotes: 1

Related Questions