From cc4549d5980bb11f41d56af46e138c6ea5aff24f Mon Sep 17 00:00:00 2001 From: Pavel_Duron Date: Sun, 4 Dec 2022 17:05:35 +1000 Subject: [PATCH] fix session --- bot.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/bot.py b/bot.py index 71802d0..1275c72 100644 --- a/bot.py +++ b/bot.py @@ -158,11 +158,11 @@ async def send_topchat(message: types.Message): @dp.message_handler(commands=["globaldick"]) async def send_time(message: types.Message): - - top_chat = session.query(user.user_fullname, user.dick_size).order_by(user.dick_size.desc()).limit(10).all() - delimiter = ': ' - session.close() - engine.dispose() + with session: + top_chat = session.query(user.user_fullname, user.dick_size).order_by(user.dick_size.desc()).limit(10).all() + delimiter = ': ' + + await bot.send_message(message.chat.id, f'πŸ†Π’ΠΎΠΏ 10 пипис Π² ΠΌΠΈΡ€Π΅πŸ†\n\n\ 1. {delimiter.join(map(str, top_chat[0]))}\n\ 2. {delimiter.join(map(str, top_chat[1]))}\n\