Answer the question
In order to leave comments, you need to log in
How to make a shopping cart for a telegram bot?
I have a bot that should show a product at the click of a button, namely its Image, name and price. I seem to understand what is needed through the database, and chose SQLite3 for this, and even wrote this database, but I don’t understand what to do next (
@bot.callback_query_handler(func = lambda call: True)
def callback(call):
if call.data == 'catalog':
kb = types.InlineKeyboardMarkup(row_width=2)
item1 = types.InlineKeyboardButton('Эквадорская роза', callback_data='Ecuador')
kb.add(item1)
elif call.data == 'Ecuador':
kb = types.InlineKeyboardMarkup(row_width=1)
item2 = types.InlineKeyboardButton('Добавить в корзину',callback_data = 'add_cart')
item1= types.InlineKeyboardButton('Назад',callback_data='bac')
kb.add(item2,item1)
bot.edit_message_text(chat_id = call.message.chat.id,message_id=call.message.message_id,
text = 'описание цветка',reply_markup=kb)
import sqlite3 as sq
conn = sq.connect('coc.db')
cur = conn.cursor()
cur.execute("""CREATE TABLE IF NOT EXISTS Ecuador0(position TEXT,price TEXT,image BLOB)""")
Ecuador0= [('Херц 50 см','44,200','image'),
('Хот спот 80 см','50,000','image'),
('Хот Эксплоер 60 см','36,000','image'),
('Хот Эксплоер 70 см','39,600','image'), ........
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question