Such a situation, that in a chat with a bot, deleting a message does not cause problems. But as soon as the message is sent in Inline mode, I get up in a stupor.

By clicking on the button in the chat (with the user), I have to change / delete this message. Everything would be fine, but I can’t catch chat.id and message id. If everything is clear in a chat with a bot, then in Inline mode it does not work at all.

Posting a message

hint = "Тест" try: r = types.InlineQueryResultArticle( id='1', title="Тест", description=hint, input_message_content=types.InputTextMessageContent( message_text="Еще один тест"), reply_markup=main_menu(), ) print(query) bot.answer_inline_query(query.id, [r]) except Exception as e: print(e) 

Send keyboard

 user_markup = telebot.types.InlineKeyboardMarkup() dept = json.dumps({"command": 1, "type": "dept"}) dept_button = telebot.types.InlineKeyboardButton("Тест", callback_data=dept) user_markup.add(dept_button) return user_markup 

What comes back after pressing the button The result of clicking on the button

    0