Answer the question
In order to leave comments, you need to log in
How to fix a bug?
Hello!
I would like to know why such a bug occurs (or just why it happens and how to fix it). I am using aiogram
I have a split calldata in a function that is bound to an "Add to Cart" button
@dp.callback_query_handler(lambda c: c.data.startswith('add_'))
async def add_to_cart(call: types.CallbackQuery):
operation = call.data.split('_')[0]
current_item = int(call.data.split('_')[-1])
item = items[current_item]
print(operation, current_item, item, prices)
items = [
'Атомик 60|70|80 см',#0
'Болевар 60|70|80 см',#1
'Вайт О"Хара 40|60 см',
Answer the question
In order to leave comments, you need to log in
violpeople , gotta
add = InlineKeyboardButton(text= 'Добавить в корзину',callback_data= f'add_{current_item}')
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question