minor fixes and PEP8'ification
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
6169e6e32a
commit
da06b5ad23
@ -25,6 +25,13 @@ def top_dick_message(delimiter, top_list):
|
|||||||
f'🌶 {delimiter.join(map(str, top_list[7]))}\n'
|
f'🌶 {delimiter.join(map(str, top_list[7]))}\n'
|
||||||
f'👌 {delimiter.join(map(str, top_list[8]))}\n'
|
f'👌 {delimiter.join(map(str, top_list[8]))}\n'
|
||||||
f'💩 {delimiter.join(map(str, top_list[9]))}\n'
|
f'💩 {delimiter.join(map(str, top_list[9]))}\n'
|
||||||
|
return message
|
||||||
|
|
||||||
|
|
||||||
|
@dp.message_handler(commands=["maintainance"])
|
||||||
|
async def stop_for_maintenance(message: types.Message): # остановить бота
|
||||||
|
if message.from_user.id == 226765676:
|
||||||
|
close_all_sessions() # TODO Вспомнить, как это, блять, делается.
|
||||||
|
|
||||||
|
|
||||||
@dp.message_handler(commands=["dick"])
|
@dp.message_handler(commands=["dick"])
|
||||||
@ -32,10 +39,10 @@ async def up_dick(message: types.Message): # рандомайзер
|
|||||||
|
|
||||||
numb = randint(-6, 10)
|
numb = randint(-6, 10)
|
||||||
global size_change, dick_plus, dick_minus
|
global size_change, dick_plus, dick_minus
|
||||||
dick_plus = ('<b>вырос</b>', '<b>подрос</b>', '<b>привстал</b>')
|
dick_plus = ('<b>вырос</b>', '<b>подрос</b>', '<b>привстал</b>')
|
||||||
dick_minus = ('<b>уменьшился</b>', '<b>откусила злая гадюка</b>', '<b>продали евреи, он стал дешевле</b>')
|
dick_minus = ('<b>уменьшился</b>', '<b>откусила злая гадюка</b>', '<b>продали евреи, он стал дешевле</b>')
|
||||||
if numb > 0:
|
if numb > 0:
|
||||||
size_change = random.choice(dick_plus) + '🚀'
|
size_change = random.choice(dick_plus) + '🚀'
|
||||||
# if numb = 0 size_change = random.choice(const) TODO
|
# if numb = 0 size_change = random.choice(const) TODO
|
||||||
else:
|
else:
|
||||||
size_change = random.choice(dick_minus) + '✂'
|
size_change = random.choice(dick_minus) + '✂'
|
||||||
@ -134,7 +141,8 @@ async def send_topchat(message: types.Message):
|
|||||||
session.close()
|
session.close()
|
||||||
else:
|
else:
|
||||||
session.close()
|
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()
|
users = session.query(user.user_fullname, user.dick_size).order_by(user.dick_size.desc())
|
||||||
|
top = users.filter(user.chat_id == chats).limit(10).all()
|
||||||
|
|
||||||
# проверка на длину списка, если меньше limit, то:
|
# проверка на длину списка, если меньше limit, то:
|
||||||
|
|
||||||
@ -149,14 +157,13 @@ async def send_topchat(message: types.Message):
|
|||||||
else:
|
else:
|
||||||
|
|
||||||
await bot.send_message(message.chat.id, top_dick_message(delimiter, top))
|
await bot.send_message(message.chat.id, top_dick_message(delimiter, top))
|
||||||
except:
|
except Exception as e:
|
||||||
session.rollback()
|
session.rollback()
|
||||||
print('ошибка в /topdick')
|
print('ошибка в /topdick. Трейсбэк:\n' + '\n'.join(traceback.format_tb(e.__traceback__)))
|
||||||
finally:
|
finally:
|
||||||
session.close_all()
|
session.close_all()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@dp.message_handler(commands=["globaldick"])
|
@dp.message_handler(commands=["globaldick"])
|
||||||
async def send_global_top(message: types.Message):
|
async def send_global_top(message: types.Message):
|
||||||
try:
|
try:
|
||||||
@ -165,9 +172,9 @@ async def send_global_top(message: types.Message):
|
|||||||
delimiter = ': '
|
delimiter = ': '
|
||||||
|
|
||||||
await bot.send_message(message.chat.id, top_dick_message(delimiter, top_chat))
|
await bot.send_message(message.chat.id, top_dick_message(delimiter, top_chat))
|
||||||
except:
|
except Exception as e:
|
||||||
session.rollback()
|
session.rollback()
|
||||||
print('ошибка в /globaldick')
|
print('ошибка в /globaldick, трейсбэк:\n' + '\n'.join(traceback.format_tb(e.__traceback__)))
|
||||||
finally:
|
finally:
|
||||||
session.close_all()
|
session.close_all()
|
||||||
|
|
||||||
@ -176,4 +183,3 @@ async def send_global_top(message: types.Message):
|
|||||||
# dp.register_message_handler(up_dick)
|
# dp.register_message_handler(up_dick)
|
||||||
# dp.register_message_handler(send_topchat)
|
# dp.register_message_handler(send_topchat)
|
||||||
# dp.register_message_handler(send_global_top)
|
# dp.register_message_handler(send_global_top)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user