forked from Pavel_Durov/python_bot
fix
This commit is contained in:
parent
b148e10393
commit
5c8cd68b6f
Binary file not shown.
BIN
__pycache__/sqdb.cpython-310.pyc
Normal file
BIN
__pycache__/sqdb.cpython-310.pyc
Normal file
Binary file not shown.
8
bot.py
8
bot.py
@ -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}')
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
17
sqdb.py
17
sqdb.py
@ -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:
|
||||||
|
def adding():
|
||||||
|
|
||||||
|
session.add(lisq)
|
||||||
session.commit()
|
session.commit()
|
||||||
|
|
||||||
|
|
||||||
|
#tert.adding() # добавляет запись и коммитит
|
||||||
|
|
||||||
|
|
||||||
#Base.metadata.create_all(engine)
|
#Base.metadata.create_all(engine)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
listq2 = bot.ident.lisq()
|
||||||
|
print(listq2)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user