forked from Pavel_Durov/python_bot
fix engine dispose
This commit is contained in:
parent
5c7935e430
commit
ec8c67a23b
15
bot.py
15
bot.py
@ -8,7 +8,7 @@ from sqlalchemy.ext.declarative import declarative_base
|
||||
from sqlalchemy.orm import sessionmaker
|
||||
from aiogram import Bot, Dispatcher, executor, types
|
||||
from aiogram.types import ReplyKeyboardRemove, ReplyKeyboardMarkup, KeyboardButton
|
||||
from sqdb import user, session
|
||||
from sqdb import user, session, engine
|
||||
|
||||
|
||||
|
||||
@ -85,7 +85,7 @@ async def ident(message: types.Message):
|
||||
session.commit() #обновляет запись
|
||||
await bot.send_message(message.chat.id, f'@{message.from_user.username}, ваш писюн {size_change}\n\
|
||||
Теперь он равен <b>{a.dick_size}</b> см! ')
|
||||
session.close_all()
|
||||
session.close()
|
||||
|
||||
else:
|
||||
int_table = user(user_id = message.from_user.id, user_fullname = message.from_user.full_name, dick_size = numb, datetimes = datetime.datetime.now(),\
|
||||
@ -94,7 +94,7 @@ chat_id = message.chat.id)
|
||||
session.commit()
|
||||
await bot.send_message(message.chat.id, f'@{message.from_user.username}, ваш писюн {size_change}\n\
|
||||
Теперь он равен <b>{int_table.dick_size}</b> см!')
|
||||
session.close_all()
|
||||
session.close()
|
||||
|
||||
|
||||
# int_table = user(user_id = message.from_user.id, user_fullname = message.from_user.full_name, dick_size = numb) #импортирую юзер из sqdb
|
||||
@ -119,7 +119,7 @@ async def send_topchat(message: types.Message):
|
||||
session.commit()
|
||||
session.close()
|
||||
top = session.query(user.user_fullname, user.dick_size).order_by(user.dick_size.desc()).filter(user.chat_id == chats).limit(10).all()
|
||||
|
||||
session.close()
|
||||
delimiter = ': '
|
||||
|
||||
# проверка на длину списка, если меньше limit, то:'''
|
||||
@ -138,7 +138,7 @@ async def send_topchat(message: types.Message):
|
||||
🌶 {delimiter.join(map(str, top[7]))}\n\
|
||||
👌 {delimiter.join(map(str, top[8]))}\n\
|
||||
💩 {delimiter.join(map(str, top[9]))}\n')
|
||||
session.close_all()
|
||||
session.close()
|
||||
# если все нормально и участников минимум 10'''
|
||||
else:
|
||||
await bot.send_message(message.chat.id, f'🏆Топ 10 бубылд чата🏆\n\n\
|
||||
@ -173,7 +173,7 @@ async def send_time(message: types.Message):
|
||||
8. {delimiter.join(map(str, top_chat[7]))}\n\
|
||||
9. {delimiter.join(map(str, top_chat[8]))}\n\
|
||||
10. {delimiter.join(map(str, top_chat[9]))}\n')
|
||||
session.close_all()
|
||||
session.close()
|
||||
|
||||
@dp.message_handler(commands=['start'])
|
||||
async def start_func(message: types.Message):
|
||||
@ -193,9 +193,10 @@ async def send_faggot(message: types.Message):
|
||||
await bot.send_photo(message.chat.id, photo='https://www.meme-arsenal.com/memes/ecebd2339c7eab40e09874bd86a38a09.jpg')
|
||||
|
||||
#хуй
|
||||
|
||||
engine.dispose()
|
||||
if __name__ == '__main__':
|
||||
executor.start_polling(dp, skip_updates=True)
|
||||
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user