diff --git a/bot.py b/bot.py index dff99a9..7c34f0d 100644 --- a/bot.py +++ b/bot.py @@ -5,6 +5,7 @@ from random import randint from aiogram import Bot, Dispatcher, executor, types from aiogram.types import ReplyKeyboardRemove, ReplyKeyboardMarkup, KeyboardButton +import sql @@ -48,8 +49,10 @@ async def dick(message: types.Message): async def ident(message: types.Message): id1 = message.from_user.id fullname1 = message.from_user.full_name - #await sql.add_user() + sql.db_start await bot.send_message(message.chat.id, f'{id1} + {fullname1}') + sql.add_user + sql.close #await sql.db.close() diff --git a/sql.py b/sql.py index 35d59dd..f3dcbe0 100644 --- a/sql.py +++ b/sql.py @@ -1,5 +1,5 @@ import sqlite3 as sq -import aiogram + async def db_start(): #подключение к бд global db, cur @@ -10,12 +10,12 @@ async def db_start(): #подключение к бд cur.execute(''''CREATE TABLE IF NOT EXISTS users(id INTEGER PRIMARY KEY, users_id INTEGER, user_name TEXT, dick_size INTEGER)''') db.commit() -async def add_user(id): - cur.execute('''INSERT INTO users (users_id, user_name) VALUES (?)''',[id, fullname]) +async def add_user(): + cur.execute('''INSERT INTO users (users_id, user_name) VALUES (?)''',[id1, fullname1]) db.commit() - -db.commit() +async def close(): + db.close()