1

There are code where I create a ReplyKeyboardMarkup and wanna hide id after click on button "Chat". How to do this? Without sending new message and delete her like: bot.send_message(mes.chat.id, "working", reply_markup=types.ReplyKeyboardRemove()) bot.delete_message(mes.chat.id, mes.message_id + 1)

code started with putting "/start":

def start_markup():
    markup = types.ReplyKeyboardMarkup(resize_keyboard=True, row_width=2)
    chat = types.KeyboardButton(text="Chat",)
    markup.add(chat)
    return markup

@bot.message_handler(commands=['start'])
def start(mes):
    res = bot.send_message(mes.chat.id , "Chose what do u want", reply_markup=start_markup())

// at this point I already have to hide the reply keyboard

@bot.message_handler() 
def get_message(mes):
    if mes.text == "Chat":
        markup = types.InlineKeyboardMarkup().add(types.InlineKeyboardButton(text='Click', url='...'))
        bot.send_message(mes.chat.id, "Click!!!", reply_markup = markup)

1 Answers1

1

I think that you only has to use ReplyKeyboardRemove(), like:

reply_markup = ReplyKeyboardRemove()

  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jul 23 '22 at 05:14