Answer the question
In order to leave comments, you need to log in
How to make a message replace the past in the callback of an inline button?
async def ecuador(call:types.CallbackQuery):
kb = InlineKeyboardMarkup(row_width=2)
next = InlineKeyboardButton(text= 'Следующий',callback_data= 'next_1')
previous = InlineKeyboardButton(text= 'Предыдущий',callback_data= 'previous_1')
add = InlineKeyboardButton(text= 'Добавить в корзину',callback_data= 'add_1')
kb.add(previous,next,add)
back = InlineKeyboardButton(text= 'Назад',callback_data= 'back')
kb.add(back)
await bot.send_photo(
chatId,
photo = current_photo,
caption='Название: '+ current_item +'\n\nЦена: '+ current_price + '\n\nId: '+ current_id,
reply_markup=kb)
Answer the question
In order to leave comments, you need to log in
This is where you need to edit your previous post. For example:
bot.edit_message_text(chat_id=call.message.chat.id, message_id=call.message.id, text='Новый текст')
bot.edit_message_media(chat_id=call.message.chat.id, message_id=call.message.id, media=types.InputMediaPhoto(open('file.jpg','r').read(), caption='Новая картинка'))
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question