diff --git a/__pycache__/bot.cpython-310.pyc b/__pycache__/bot.cpython-310.pyc new file mode 100644 index 0000000..3577a0d Binary files /dev/null and b/__pycache__/bot.cpython-310.pyc differ diff --git a/__pycache__/sql.cpython-310.pyc b/__pycache__/sql.cpython-310.pyc deleted file mode 100644 index 7f12f73..0000000 Binary files a/__pycache__/sql.cpython-310.pyc and /dev/null differ diff --git a/bot.py b/bot.py index 94c365e..c74443b 100644 --- a/bot.py +++ b/bot.py @@ -5,7 +5,7 @@ from random import randint from aiogram import Bot, Dispatcher, executor, types from aiogram.types import ReplyKeyboardRemove, ReplyKeyboardMarkup, KeyboardButton -import sql + @@ -49,11 +49,11 @@ 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.db_start + await bot.send_message(message.chat.id, f'{id1} + {fullname1}') - await sql.add_user - await sql.close - #await sql.db.close() + + + diff --git a/dick3.db b/dick3.db new file mode 100644 index 0000000..5fe1830 Binary files /dev/null and b/dick3.db differ diff --git a/dick31.db b/dick31.db new file mode 100644 index 0000000..e69de29 diff --git a/sqdb.py b/sqdb.py new file mode 100644 index 0000000..434105d --- /dev/null +++ b/sqdb.py @@ -0,0 +1,37 @@ +from sqlalchemy import create_engine, MetaData, Table, Integer, String, \ + Column, DateTime, ForeignKey, Numeric +from sqlalchemy.ext.declarative import declarative_base +from sqlalchemy.orm import sessionmaker + +engine = create_engine('sqlite:///dick3.db') +Session = sessionmaker(bind=engine) +session = Session() + + + +Base = declarative_base() + + + +class user(Base): + __tablename__ = 'users' + + id = Column(Integer, primary_key=True) + user_id = Column(Integer) + user_fullname = Column(String) + + + +c2 = user(user_id = 1234, user_fullname = 'dadad') + +session.add(c2) +session.commit() + + + + + + + + + diff --git a/sql.py b/sql.py deleted file mode 100644 index 59ec481..0000000 --- a/sql.py +++ /dev/null @@ -1,27 +0,0 @@ -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() - - - - - - - -