forked from Pavel_Durov/python_bot
fix localtop when users < 10
This commit is contained in:
parent
3ac8fe1cb5
commit
1a5cad9c0d
48
bot.py
48
bot.py
@ -112,21 +112,43 @@ chat_id = message.chat.id)
|
||||
|
||||
@dp.message_handler(commands=["topdick"])
|
||||
async def send_topchat(message: types.Message):
|
||||
top = session.query(user.user_fullname, user.dick_size).order_by(user.dick_size.desc()).filter(user.chat_id == message.chat.id).limit(10).all()
|
||||
chats = message.chat.id
|
||||
top = session.query(user.user_fullname, user.dick_size).order_by(user.dick_size.desc()).filter(user.chat_id == chats).limit(10).all()
|
||||
delimiter = ': '
|
||||
|
||||
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')
|
||||
session.close_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')
|
||||
session.close_all()
|
||||
|
||||
'''если все нормально и участников минимум 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')
|
||||
session.close_all()
|
||||
|
||||
|
||||
|
||||
@dp.message_handler(commands=["globaldick"])
|
||||
|
Loading…
Reference in New Issue
Block a user