5
def start(bot, update):
    keyboard = [[InlineKeyboardButton("Apples", callback_data='1')],
        [InlineKeyboardButton("Oranges", callback_data='2')],
        [InlineKeyboardButton("Beans", callback_data='3')],
        [InlineKeyboardButton("Rice", callback_data='4')],
        [InlineKeyboardButton("Bread", callback_data='5')],                
        [InlineKeyboardButton("Tomatos", callback_data='6')],                
        [InlineKeyboardButton("Strawberry", callback_data='7')]
    ]
    reply_markup = InlineKeyboardMarkup(keyboard)
    update.message.reply_text('Multiple choice Quizz \nSelect all vegetables:', reply_markup=reply_markup)

Using the InlineKeyboardMarkup, do there is a way in which I can provide feedback for the user button selection without hiding or removing the InlineKeyboardMarkup?

For example when the user select InlineKeyboardButton do I can:

Change the InlineKeyboardButton text
Change the appearance of the InlineKeyboardButton
Edit initial message in update.message.reply_text ( )

I'm trying to see if a multiple choice question can be made, and if so I would need to provide a way to let the user know the button had been selected or pressed.

ed tru
  • 101
  • 1
  • 2
  • 7

3 Answers3

4

Yes, you can update (edit) the current message text with the selection that the user made, this is a simple quick visual feedback to the user as he /she interacts with your inline buttons.

You can use the editXXX methods for this.

see https://core.telegram.org/bots/api#updating-messages

editMessageText - changes the message text before the inlinekeyboard

editMessageReplyMarkup - changes to a new inlinekeyboard

Charles Okwuagwu
  • 10,538
  • 16
  • 87
  • 157
  • I found this on the documentation: Please note, that it is currently only possible to edit messages without reply_markup or with inline keyboards. – ed tru Nov 23 '16 at 02:21
0

As described on: https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating

Yes! It's possible to update the keyboard and message as like as @music bot

RaminMT
  • 174
  • 1
  • 14
0

As a solution, you can use Emoji for showing visual effects. after user pressed your inline button, edit the message and add a relative emoji to that button that inform user of the server feedback.

Vahid Msm
  • 1,032
  • 7
  • 16