def ans_pr(update, bot): query = update.callback_query user_id = query.message.chat_id msg_id = query.message.message_id status = DB.get_info(user_id, 'status') if query.data in pr.get_products_name() and status == 0: DB.update_user(user_id, 'temp', query.data) text = "Продукт успешно выбран" bot.bot.edit_message_text(chat_id=user_id, message_id=msg_id, text=text, reply_markup=product_names(query.data)) DB.update_user(user_id, 'status', 1) text = tx.get_text('pr_ch').format( DB.get_info(user_id, 'temp')[0], pr.get_quantity(query.data)) bot.bot.send_message(user_id, text)
def product_names(update_item=None): temp = get_array_of_buttons(Product.get_products_name(), update_item) return InlineKeyboardMarkup(temp)