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
61075491ec
commit
6169e6e32a
@ -13,6 +13,20 @@ dick_plus = None
|
||||
dick_minus = None
|
||||
|
||||
|
||||
def top_dick_message(delimiter, top_list):
|
||||
message = f'🏆Топ 10 бубылд чата🏆\n\n'
|
||||
f'🚀 {delimiter.join(map(str, top_list[0]))}\n'
|
||||
f'💫 {delimiter.join(map(str, top_list[1]))}\n'
|
||||
f'🍆 {delimiter.join(map(str, top_list[2]))}\n'
|
||||
f'🍌 {delimiter.join(map(str, top_list[3]))}\n'
|
||||
f'🐍 {delimiter.join(map(str, top_list[4]))}\n'
|
||||
f'🐎 {delimiter.join(map(str, top_list[5]))}\n'
|
||||
f'🌭 {delimiter.join(map(str, top_list[6]))}\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[9]))}\n'
|
||||
|
||||
|
||||
@dp.message_handler(commands=["dick"])
|
||||
async def up_dick(message: types.Message): # рандомайзер
|
||||
|
||||
@ -101,9 +115,9 @@ async def up_dick(message: types.Message): # рандомайзер
|
||||
session.close_all()
|
||||
print('Успешно добавлен пользователь')
|
||||
|
||||
except:
|
||||
except Exception as e:
|
||||
session.rollback()
|
||||
print('ошибка в основном коде')
|
||||
print('ошибка в основном коде, трейсбек:' + '\n'.join(traceback.format_tb(e.__traceback__)))
|
||||
finally:
|
||||
session.close_all()
|
||||
|
||||
@ -120,41 +134,21 @@ async def send_topchat(message: types.Message):
|
||||
session.close()
|
||||
else:
|
||||
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()
|
||||
top = session.query(user.user_fullname, user.dick_size).order_by(user.dick_size.desc()).filter(user.chat_id == chats).limit(10).all()
|
||||
|
||||
# проверка на длину списка, если меньше limit, то:
|
||||
|
||||
sizelen = len(top)
|
||||
if sizelen < 10:
|
||||
lenminus = 10 - sizelen
|
||||
top.extend(('-'*lenminus))
|
||||
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\
|
||||
🍆 {delimiter.join(map(str, top[2]))}\n\
|
||||
🍌 {delimiter.join(map(str, top[3]))}\n\
|
||||
🐍 {delimiter.join(map(str, top[4]))}\n\
|
||||
🐎 {delimiter.join(map(str, top[5]))}\n\
|
||||
🌭 {delimiter.join(map(str, top[6]))}\n\
|
||||
🌶 {delimiter.join(map(str, top[7]))}\n\
|
||||
👌 {delimiter.join(map(str, top[8]))}\n\
|
||||
💩 {delimiter.join(map(str, top[9]))}\n')
|
||||
size_len = len(top)
|
||||
if size_len < 10:
|
||||
len_minus = 10 - size_len
|
||||
top.extend(('-'*len_minus))
|
||||
await bot.send_message(message.chat.id, top_dick_message(delimiter, top))
|
||||
session.close()
|
||||
# если все нормально и участников минимум 10
|
||||
|
||||
else:
|
||||
|
||||
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\
|
||||
🍆 {delimiter.join(map(str, top[2]))}\n\
|
||||
🍌 {delimiter.join(map(str, top[3]))}\n\
|
||||
🐍 {delimiter.join(map(str, top[4]))}\n\
|
||||
🐎 {delimiter.join(map(str, top[5]))}\n\
|
||||
🌭 {delimiter.join(map(str, top[6]))}\n\
|
||||
🌶 {delimiter.join(map(str, top[7]))}\n\
|
||||
👌 {delimiter.join(map(str, top[8]))}\n\
|
||||
💩 {delimiter.join(map(str, top[9]))}\n')
|
||||
await bot.send_message(message.chat.id, top_dick_message(delimiter, top))
|
||||
except:
|
||||
session.rollback()
|
||||
print('ошибка в /topdick')
|
||||
@ -170,21 +164,10 @@ async def send_global_top(message: types.Message):
|
||||
|
||||
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\
|
||||
3. {delimiter.join(map(str, top_chat[2]))}\n\
|
||||
4. {delimiter.join(map(str, top_chat[3]))}\n\
|
||||
5. {delimiter.join(map(str, top_chat[4]))}\n\
|
||||
6. {delimiter.join(map(str, top_chat[5]))}\n\
|
||||
7. {delimiter.join(map(str, top_chat[6]))}\n\
|
||||
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')
|
||||
await bot.send_message(message.chat.id, top_dick_message(delimiter, top_chat))
|
||||
except:
|
||||
session.rollback()
|
||||
print('ошибка в /glovaldick')
|
||||
print('ошибка в /globaldick')
|
||||
finally:
|
||||
session.close_all()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user