forked from Pavel_Durov/python_bot
add close_all_sesions
This commit is contained in:
parent
31abb3460a
commit
0391206ee6
@ -1,4 +1,5 @@
|
||||
from aiogram import types, Dispatcher
|
||||
from sqlalchemy.orm.session import close_all_sessions
|
||||
from create_bot import bot, dp
|
||||
from sqdb import user, session
|
||||
from random import randint
|
||||
@ -31,7 +32,7 @@ async def up_dick(message: types.Message):
|
||||
if abs(diff) <= 0:
|
||||
with session:
|
||||
await bot.send_message(message.chat.id, f'@{message.from_user.username},🚫 вы уже крутили пипису, ее размер <b>{b.dick_size}</b> см! ')
|
||||
session.close()
|
||||
await close_all_sessions()
|
||||
print(diff)
|
||||
print(type(diff))
|
||||
else:
|
||||
@ -42,7 +43,7 @@ async def up_dick(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()
|
||||
close_all_sessions()
|
||||
|
||||
else:
|
||||
with session:
|
||||
@ -53,17 +54,16 @@ async def up_dick(message: types.Message):
|
||||
session.close()
|
||||
await bot.send_message(message.chat.id, f'@{message.from_user.username}, ваш писюн {size_change}\n\
|
||||
Теперь он равен <b>{int_table.dick_size}</b> см!')
|
||||
close_all_sessions()
|
||||
|
||||
|
||||
@dp.message_handler(commands=["topdick"])
|
||||
async def send_topchat(message: types.Message):
|
||||
with session:
|
||||
changechat_id = session.query(user).filter(user.user_id == message.from_user.id).first()
|
||||
chats = message.chat.id
|
||||
if changechat_id.chat_id != chats:
|
||||
changechat_id.chat_id = chats
|
||||
session.close()
|
||||
with session:
|
||||
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 = ': '
|
||||
@ -85,7 +85,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()
|
||||
close_all_sessions()
|
||||
# если все нормально и участников минимум 10
|
||||
|
||||
else:
|
||||
@ -123,7 +123,7 @@ async def send_global_top(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()
|
||||
close_all_sessions()
|
||||
|
||||
|
||||
def register_handlers_pipisa(dp: Dispatcher):
|
||||
|
Loading…
Reference in New Issue
Block a user