Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @bot.callback_query_handler(func=lambda call: call.data.split('_')[0] == 'category')
- def show_product(call)
- ....
- some code
- ....
- bot.send_photo(call.message.chat.id, product.img.read(), caption=f'Вы вибрали продукт {product.title}\n\n'
- f'Описание: \n'
- f'{product.description} \n\n'
- f'Цена: <b>{product.price}</b>',
- reply_markup=keyboard,
- parse_mode='HTML')
- @bot.callback_query_handler(func=lambda call: call.data.split('_')[0] == 'back')
- def go_back(call):
- try:
- ...
- some awesome code
- ...
- bot.edit_message_text(...)
- expect teleport.apihelper.ApiExeption:
- bot.delete_message(...)
- @bot.callback_query_handler(func=lambda call: call.data.split('_')[0] == 'back')
- def buy_product(call):
- ...
- some useful code
- ...
- db.Cart.objects(user=user).add_product(product)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement