#7 убирац

This commit is contained in:
Simple_Not 2024-01-21 22:02:22 +10:00
parent bb91a90e9e
commit b188edd98d
3 changed files with 2 additions and 64 deletions

View File

@ -1,5 +1,4 @@
from aiogram import types, Dispatcher from aiogram import types, Dispatcher
#from sqlalchemy.orm.session import close_all_sessions
from create_bot import bot, dp from create_bot import bot, dp
#from sqdb import user, session #from sqdb import user, session
import random import random

View File

@ -1,9 +1,6 @@
from create_bot import dp, bot from create_bot import dp, bot
from aiogram import types, Dispatcher from aiogram import types, Dispatcher
from sqdb import user, session
@dp.message_handler(commands=['sendall']) @dp.message_handler(commands=['sendall'])
async def sendall(message: types.Message): async def sendall(message: types.Message):
@ -19,10 +16,8 @@ async def sendall(message: types.Message):
except: except:
print('вероятно бота нет в чате') print('вероятно бота нет в чате')
await bot.send_message(message.from_user.id, 'Сообщение успешно отправлено во все чаты') await bot.send_message(message.from_user.id, 'Сообщение успешно отправлено во все чаты')
except: except:
session.rollback() print('eror sendall')
print('eror sendall')
finally: session.close_all()
# def register_handlers_test(dp: Dispatcher): # def register_handlers_test(dp: Dispatcher):

56
sqdb.py
View File

@ -1,56 +0,0 @@
from sqlalchemy import create_engine, MetaData, Table, Integer, String, BIGINT, \
Column, DateTime, ForeignKey, Numeric
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
from sqlalchemy import select, update
engine = create_engine('postgresql+psycopg2://postgres:postgres@postgres.vdk2ch.ru:5432/jack_bot', echo=True)
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)
dick_size = (Column(Integer))
datetimes = (Column(DateTime))
chat_id = Column(BIGINT)
session.close()
engine.dispose()
# 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)
# int_table = user(user_id = 12345678, user_fullname = 'test', dick_size = 10) #импортирую юзер из sqdb
# session.add(int_table)
# session.commit()
# select user_id, name from employees limit 10
# def adding():
# session.add()
# session.commit()