coffee/return

This commit is contained in:
derlole
2025-05-09 10:50:40 +00:00
parent a02ed0fe08
commit 416d30ae1c
10 changed files with 149 additions and 82 deletions

View File

@@ -0,0 +1,27 @@
# -*- coding: utf-8 -*-
# Dieses Skript erstellt eine SQLite-Datenbank mit einer Tabelle für Befehle.
import os
import sqlite3
db_folder = "db"
db_filename = "coffee.db"
db_path = os.path.join(db_folder, db_filename)
conn = sqlite3.connect(db_path)
cursor = conn.cursor()
# Tabelle erstellen mit entsprechenden Atributen
cursor.execute("""
CREATE TABLE IF NOT EXISTS commands (
id INTEGER PRIMARY KEY AUTOINCREMENT,
user TEXT NOT NULL,
status TEXT NOT NULL,
tstamp DATETIME DEFAULT CURRENT_TIMESTAMP
)
""")
conn.commit()
conn.close()
print(f"[DB]Datenbank erstellt unter: {db_path}")

View File

@@ -4,19 +4,14 @@
import os
import sqlite3
# Ordner und Pfad definieren
db_folder = "db"
db_filename = "commands.db"
db_path = os.path.join(db_folder, db_filename)
# Ordner erstellen, falls nicht vorhanden
os.makedirs(db_folder, exist_ok=True)
# Verbindung zur SQLite-Datenbank
conn = sqlite3.connect(db_path)
cursor = conn.cursor()
# Tabelle erstellen
# Tabelle erstellen mit entsprechenden Atributen
cursor.execute("""
CREATE TABLE IF NOT EXISTS commands (
id INTEGER PRIMARY KEY AUTOINCREMENT,