first commit

This commit is contained in:
2024-10-29 16:09:13 +03:00
commit 8bdd4be9b0
42 changed files with 2605 additions and 0 deletions

1
bot.0.1/data_base/__init__.py Executable file
View File

@@ -0,0 +1 @@
from data_base import sqlite_db

26
bot.0.1/data_base/sqlite_db.py Executable file
View File

@@ -0,0 +1,26 @@
from create_bot import bot
import sqlite3 as sq
base = None
cur = None
def sql_start():
global base, cur
base = sq.connect("pizza_cool.db")
cur = base.cursor()
if base:
print("Data base connected OK!")
base.execute("CREATE TABLE IF NOT EXISTS menu(img TEXT, name TEXT PRIMARY KEY, description TEXT, price TEXT)")
base.commit()
async def sql_add_command(state):
async with state.proxy() as data:
cur.execute("INSERT INTO menu VALUES (?, ?, ?, ?)", tuple(data.values()))
base.commit()
async def sql_reade(message):
for ret in cur.execute("SELECT * FROM menu").fetchall():
await bot.send_photo(message.from_user.id, ret[0], f"\n{ret[1]}\nОписание: {ret[2]}\nЦена: {ret[-1]}")