forked from Pavel_Durov/python_bot
28 lines
459 B
Python
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()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|