This commit is contained in:
2025-06-08 20:49:10 +09:00
parent 37b152a431
commit f7e0d17829
45 changed files with 53 additions and 53 deletions

0
bot.py Normal file
View File

0
config.py Normal file
View File

View File

@@ -1,53 +0,0 @@
import sqlite3
def create_tables():
conn = sqlite3.connect('bot_data.db')
cursor = conn.cursor()
cursor.execute('''
CREATE TABLE IF NOT EXISTS orders (
id INTEGER PRIMARY KEY AUTOINCREMENT,
name TEXT,
phone TEXT,
address TEXT,
cleaning_time TEXT,
cleaning_type TEXT,
payment_method TEXT
)
''')
cursor.execute('''
CREATE TABLE IF NOT EXISTS users (
user_id INTEGER PRIMARY KEY,
name TEXT,
phone TEXT,
address TEXT
)
''')
conn.commit()
conn.close()
def add_order(name, phone, address, cleaning_time, cleaning_type, payment_method):
conn = sqlite3.connect('bot_data.db')
cursor = conn.cursor()
cursor.execute('''
INSERT INTO orders (name, phone, address, cleaning_time, cleaning_type, payment_method)
VALUES (?, ?, ?, ?, ?, ?)
''', (name, phone, address, cleaning_time, cleaning_type, payment_method))
conn.commit()
conn.close()
def get_order_history(user_id):
conn = sqlite3.connect('bot_data.db')
cursor = conn.cursor()
cursor.execute('''
SELECT * FROM orders WHERE user_id = ?
''', (user_id,))
orders = cursor.fetchall()
conn.close()
return orders

53
doners/old_2/database.py Normal file
View File

@@ -0,0 +1,53 @@
import sqlite3
def create_tables():
conn = sqlite3.connect('bot_data.db')
cursor = conn.cursor()
cursor.execute('''
CREATE TABLE IF NOT EXISTS orders (
id INTEGER PRIMARY KEY AUTOINCREMENT,
name TEXT,
phone TEXT,
address TEXT,
cleaning_time TEXT,
cleaning_type TEXT,
payment_method TEXT
)
''')
cursor.execute('''
CREATE TABLE IF NOT EXISTS users (
user_id INTEGER PRIMARY KEY,
name TEXT,
phone TEXT,
address TEXT
)
''')
conn.commit()
conn.close()
def add_order(name, phone, address, cleaning_time, cleaning_type, payment_method):
conn = sqlite3.connect('bot_data.db')
cursor = conn.cursor()
cursor.execute('''
INSERT INTO orders (name, phone, address, cleaning_time, cleaning_type, payment_method)
VALUES (?, ?, ?, ?, ?, ?)
''', (name, phone, address, cleaning_time, cleaning_type, payment_method))
conn.commit()
conn.close()
def get_order_history(user_id):
conn = sqlite3.connect('bot_data.db')
cursor = conn.cursor()
cursor.execute('''
SELECT * FROM orders WHERE user_id = ?
''', (user_id,))
orders = cursor.fetchall()
conn.close()
return orders

0
handlers/__init__.py Normal file
View File

0
handlers/admin.py Normal file
View File

0
handlers/polls.py Normal file
View File

0
handlers/start.py Normal file
View File

0
keyboards/__init__.py Normal file
View File

0
keyboards/inline.py Normal file
View File

0
middlewares/__init__.py Normal file
View File

0
middlewares/logging.py Normal file
View File

0
models/__init__.py Normal file
View File

0
models/poll.py Normal file
View File

0
req.pip Normal file
View File

0
utils/__init__.py Normal file
View File

0
utils/misc.py Normal file
View File