This commit is contained in:
parent
50b7131b51
commit
73bf3af7a4
9
bot.py
9
bot.py
@ -8,7 +8,7 @@ from sqlalchemy.ext.declarative import declarative_base
|
|||||||
from sqlalchemy.orm import sessionmaker
|
from sqlalchemy.orm import sessionmaker
|
||||||
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
|
||||||
from sqdb import user
|
from sqdb import user, session
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -116,10 +116,9 @@ chat_id = message.chat.id)
|
|||||||
|
|
||||||
@dp.message_handler(commands=["topdick"])
|
@dp.message_handler(commands=["topdick"])
|
||||||
async def send_time(message: types.Message):
|
async def send_time(message: types.Message):
|
||||||
engine = create_engine('postgresql+psycopg2://postgres:postgres@postgres.vdk2ch.ru:5432/jack_bot', echo=True)
|
# engine = create_engine('postgresql+psycopg2://postgres:postgres@postgres.vdk2ch.ru:5432/jack_bot', echo=True)
|
||||||
Session = sessionmaker(bind=engine)
|
# Session = sessionmaker(bind=engine)
|
||||||
session = Session()
|
# session = Session()
|
||||||
Base = declarative_base()
|
|
||||||
|
|
||||||
top = session.query(user.user_fullname, user.dick_size).order_by(user.dick_size.desc()).filter(user.chat_id == user.chat_id).limit(10).all()
|
top = session.query(user.user_fullname, user.dick_size).order_by(user.dick_size.desc()).filter(user.chat_id == user.chat_id).limit(10).all()
|
||||||
delimiter = ': '
|
delimiter = ': '
|
||||||
|
17
sqdb.py
17
sqdb.py
@ -1,4 +1,4 @@
|
|||||||
from sqlalchemy import create_engine, MetaData, Table, Integer, String, BIGINT, \
|
from sqlalchemy import create_engine, MetaData, Table, Integer, String, BIGINT, \
|
||||||
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
|
||||||
@ -24,9 +24,18 @@ class user(Base):
|
|||||||
datetimes = (Column(DateTime))
|
datetimes = (Column(DateTime))
|
||||||
chat_id = Column(BIGINT)
|
chat_id = Column(BIGINT)
|
||||||
|
|
||||||
session.close()
|
def __init__(self, user_id, user_fullname, dick_size, datetimes, chat_id):
|
||||||
top = session.query(user.user_fullname, user.dick_size).order_by(user.dick_size.desc()).filter(user.chat_id == user.chat_id).limit(10).all()
|
self.user_id = user_id
|
||||||
print(top)
|
self.user_fullname = user_fullname
|
||||||
|
self.dick_size = dick_size
|
||||||
|
self.datetimes = datetimes
|
||||||
|
self.chat_id = chat_id
|
||||||
|
|
||||||
|
print(user.chat_id)
|
||||||
|
|
||||||
|
# session.close()
|
||||||
|
# top = session.query(user.user_fullname, user.dick_size).order_by(user.dick_size.desc()).filter(user.chat_id == user.chat_id).limit(10).all()
|
||||||
|
# print(top)
|
||||||
|
|
||||||
|
|
||||||
#Base.metadata.create_all(engine)
|
#Base.metadata.create_all(engine)
|
||||||
|
Loading…
Reference in New Issue
Block a user