This commit is contained in:
Pavel_Duron 2022-11-09 22:52:44 +10:00
parent b148e10393
commit 5c8cd68b6f
5 changed files with 17 additions and 10 deletions

Binary file not shown.

Binary file not shown.

8
bot.py
View File

@ -2,6 +2,7 @@ from cgitb import text
import datetime import datetime
import logging import logging
from random import randint from random import randint
from sqdb import tert
from aiogram import Bot, Dispatcher, executor, types from aiogram import Bot, Dispatcher, executor, types
from aiogram.types import ReplyKeyboardRemove, ReplyKeyboardMarkup, KeyboardButton from aiogram.types import ReplyKeyboardRemove, ReplyKeyboardMarkup, KeyboardButton
@ -47,10 +48,9 @@ async def dick(message: types.Message):
@dp.message_handler(commands=["id"]) @dp.message_handler(commands=["id"])
async def ident(message: types.Message): async def ident(message: types.Message):
id1 = message.from_user.id lisq = user(user_id = message.from_user.id, user_fullname = message.from_user.full_name)
fullname1 = message.from_user.full_name tert.adding()
await bot.send_message(message.chat.id, f'{message.from_user.id} + {message.from_user.full_name}')
await bot.send_message(message.chat.id, f'{id1} + {fullname1}')

BIN
dick3.db

Binary file not shown.

19
sqdb.py
View File

@ -2,6 +2,7 @@ from sqlalchemy import create_engine, MetaData, Table, Integer, String, \
Column, DateTime, ForeignKey, Numeric Column, DateTime, ForeignKey, Numeric
from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker from sqlalchemy.orm import sessionmaker
import bot
engine = create_engine('sqlite:///dick3.db') engine = create_engine('sqlite:///dick3.db')
Session = sessionmaker(bind=engine) Session = sessionmaker(bind=engine)
@ -21,17 +22,23 @@ class user(Base):
user_fullname = Column(String) user_fullname = Column(String)
#list = user(user_id = message.from_user.id, user_fullname = message.from_user.full_name)
c2 = user(user_id = 1234, user_fullname = 'sfsfsfsfs')
session.add(c2) class tert:
session.commit() def adding():
session.add(lisq)
session.commit()
#tert.adding() # добавляет запись и коммитит
#Base.metadata.create_all(engine) #Base.metadata.create_all(engine)
listq2 = bot.ident.lisq()
print(listq2)