python_bot_v2/sql.py
2022-11-07 20:11:37 +10:00

28 lines
459 B
Python

import sqlite3 as sq
async def db_start(): #подключение к бд
global db, cur
db = sq.connect('users.db')
cur = db.cursor()
cur.execute(''''CREATE TABLE IF NOT EXISTS users(id INTEGER PRIMARY KEY, users_id INTEGER, user_name TEXT)''')
db.commit()
async def add_user():
cur.execute('''INSERT INTO users (users_id, user_name) VALUES (?, ?)''')
db.commit()
async def close():
db.commit()
db.close()