N
N
nikitos25202021-09-22 04:50:04
Python
nikitos2520, 2021-09-22 04:50:04

How to make count buttons for item quantity (+ or -) in python telegram bot?

How to make account buttons (+ or -) in python telegram bot?
I made a basket in the telegram bot and before adding to the basket, the user must select the amount of goods using the + or - buttons. You can see an example in the photo.
code below.614a8b633371e259164197.png

if call.data == 'dobavit_v_korzinu':

markup = types.InlineKeyboardMarkup(row_width=3)
plus = types.InlineKeyboardButton(" ➕", callback_data='plus')
summa = types.InlineKeyboardButton(f"{korzina_auto}", callback_data='summa')
minus = types.InlineKeyboardButton("➖", callback_data='minus')

dobavit_v_korzinu = types.InlineKeyboardButton(" Добавить в корзину", callback_data='dobavit_v_korzinu')

exit_russian = types.InlineKeyboardButton(" Назад", callback_data='exit')

markup.add(minus, summa, plus, dobavit_v_korzinu, exit_russian)
bot.edit_message_text(
    f'Цена продукта составляет {cena:,}  \nМинимальная партия составляет 10 шт.',
    call.message.chat.id, call.message.message_id)
bot.edit_message_reply_markup(call.message.chat.id, call.message.message_id, reply_markup=markup)

elif call.data == 'plus':
korzina_auto + 1

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question