fix localtop when users < 10
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
3ac8fe1cb5
commit
1a5cad9c0d
44
bot.py
44
bot.py
@ -112,22 +112,44 @@ chat_id = message.chat.id)
|
|||||||
|
|
||||||
@dp.message_handler(commands=["topdick"])
|
@dp.message_handler(commands=["topdick"])
|
||||||
async def send_topchat(message: types.Message):
|
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 = ': '
|
delimiter = ': '
|
||||||
|
|
||||||
|
'''проверка на длину списка, если меньше limit, то:'''
|
||||||
|
sizelen = len(top)
|
||||||
|
if sizelen < 10:
|
||||||
|
lenminus = 10 - sizelen
|
||||||
|
top.extend(('-'*lenminus))
|
||||||
await bot.send_message(message.chat.id, f'🏆Топ 10 бубылд чата🏆\n\n\
|
await bot.send_message(message.chat.id, f'🏆Топ 10 бубылд чата🏆\n\n\
|
||||||
🚀 {delimiter.join(map(str, top[0]))}\n\
|
🚀 {delimiter.join(map(str, top[0]))}\n\
|
||||||
💫 {delimiter.join(map(str, top[1]))}\n\
|
💫 {delimiter.join(map(str, top[1]))}\n\
|
||||||
🍆 {delimiter.join(map(str, top[2]))}\n\
|
🍆 {delimiter.join(map(str, top[2]))}\n\
|
||||||
🍌 {delimiter.join(map(str, top[3]))}\n\
|
🍌 {delimiter.join(map(str, top[3]))}\n\
|
||||||
🐍 {delimiter.join(map(str, top[4]))}\n\
|
🐍 {delimiter.join(map(str, top[4]))}\n\
|
||||||
🐎 {delimiter.join(map(str, top[5]))}\n\
|
🐎 {delimiter.join(map(str, top[5]))}\n\
|
||||||
🌭 {delimiter.join(map(str, top[6]))}\n\
|
🌭 {delimiter.join(map(str, top[6]))}\n\
|
||||||
🌶 {delimiter.join(map(str, top[7]))}\n\
|
🌶 {delimiter.join(map(str, top[7]))}\n\
|
||||||
👌 {delimiter.join(map(str, top[8]))}\n\
|
👌 {delimiter.join(map(str, top[8]))}\n\
|
||||||
💩 {delimiter.join(map(str, top[9]))}\n')
|
💩 {delimiter.join(map(str, top[9]))}\n')
|
||||||
session.close_all()
|
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"])
|
@dp.message_handler(commands=["globaldick"])
|
||||||
async def send_time(message: types.Message):
|
async def send_time(message: types.Message):
|
||||||
|
Loading…
Reference in New Issue
Block a user