makeOrderKeyboard = types.InlineKeyboardMarkup()
makeOrderButton = types.InlineKeyboardButton(text = "В корзину", callback_data = f"makebuy_{code_product}")
makeOrderKeyboard.add(makeOrderButton)
def send_menuDeserts(message):
db = sqlite3.connect('assort_menu.db')
sql = db.cursor()
for desert in sql.execute("SELECT * FROM all_deserts"):
bot.send_animation(message.chat.id, open(desert[3], 'rb'),
caption = desert[1] + " " + str(desert[2]) + " UAH",
reply_markup = makeOrderKeyboard)
@bot.callback_query_handler(lambda call: call.data.split('makebuy_'))
def makebuy(call: types.CallbackQuery):
try:
code_product = call.data.split('_')[1]
except Exception as e:
print(e)