From 4749ee885d7522c41a250e690227945aab4893c0 Mon Sep 17 00:00:00 2001 From: Pavel_Duron Date: Tue, 6 Dec 2022 22:27:12 +1000 Subject: [PATCH] fix --- handlers/pipisa.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/handlers/pipisa.py b/handlers/pipisa.py index 009e05b..2148327 100644 --- a/handlers/pipisa.py +++ b/handlers/pipisa.py @@ -22,14 +22,15 @@ async def up_dick(message: types.Message): # работа с таблицей b = session.query(user).filter(user.user_id == message.from_user.id).first() if b: - session.close() last_time = b.datetimes now_time = datetime.datetime.now() diff = now_time.day - last_time.day + if abs(diff) <= 0: await bot.send_message(message.chat.id, f'@{message.from_user.username},🚫 вы уже крутили пипису, ее размер {b.dick_size} см! ') + session.close() print(diff) print(type(diff)) else: @@ -37,9 +38,10 @@ async def up_dick(message: types.Message): a.dick_size = (a.dick_size + numb) a.datetimes = datetime.datetime.now() session.commit() #обновляет запись - session.close() + await bot.send_message(message.chat.id, f'@{message.from_user.username}, ваш писюн {size_change}\n\ Теперь он равен {a.dick_size} см! ') + session.close() @@ -49,23 +51,23 @@ async def up_dick(message: types.Message): chat_id = message.chat.id) session.add(int_table) session.commit() - session.close() + await bot.send_message(message.chat.id, f'@{message.from_user.username}, ваш писюн {size_change}\n\ Теперь он равен {int_table.dick_size} см!') + session.close() @dp.message_handler(commands=["topdick"]) async def send_topchat(message: types.Message): changechat_id = session.query(user).filter(user.user_id == message.from_user.id).first() - session.close() chats = message.chat.id if changechat_id.chat_id != chats: changechat_id.chat_id = chats 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() + top = session.query(user.user_fullname, user.dick_size).order_by(user.dick_size.desc()).filter(user.chat_id == chats).limit(10).all() delimiter = ': ' # проверка на длину списка, если меньше limit, то: @@ -85,11 +87,11 @@ 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() # если все нормально и участников минимум 10 else: - session.close() + await bot.send_message(message.chat.id, f'🏆Топ 10 бубылд чата🏆\n\n\ 🚀 {delimiter.join(map(str, top[0]))}\n\ 💫 {delimiter.join(map(str, top[1]))}\n\ @@ -101,7 +103,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()