forked from Pavel_Durov/python_bot
64 lines
2.4 KiB
Python
64 lines
2.4 KiB
Python
async def topdicks_conf(chatId): # тело метода лучших результатов отдельной конфы
|
|
arango_client = ArangoClient(hosts='https://arango.guaranteedstruggle.host')
|
|
pipisa_db = arango_client.db('pipisa', username='root', password='stolendick527')
|
|
dicks_collection = pipisa_db.collection('dicks')
|
|
|
|
try:
|
|
dicks = dicks_collection.find({'chat_id': chatId}, skip=0, limit=1100)
|
|
dicks = [d for d in dicks]
|
|
except Exception as e:
|
|
print('ошибка DB в /topdick')
|
|
print(e)
|
|
|
|
top_dicks = sorted(dicks, key=lambda dick: dick['dick_size'], reverse=True)
|
|
|
|
dick_limit = min(len(top_dicks), 10)
|
|
top_dicks = top_dicks[:dick_limit]
|
|
|
|
conf_top = ''
|
|
emo = ['🏆','🚀','🍆','🍌','🐍','🐎','🌭','🌶','👌','💩']
|
|
|
|
if len(top_dicks) == 0:
|
|
await bot.send_message(message.chat.id, '🍆 Никто ничего не нарастил! 🍌')
|
|
else:
|
|
for i in range(len(top_dicks)):
|
|
conf_top += f' {emo[i]} {i+1}. {top_dicks[i]["user_fullname"]}: {top_dicks[i]["dick_size"]}см\n'
|
|
i += 1
|
|
|
|
|
|
return conf_top
|
|
|
|
|
|
|
|
async def topdicks_global(chatId): #тело метода глобальных лучших результатов
|
|
arango_client = ArangoClient(hosts='https://arango.guaranteedstruggle.host')
|
|
pipisa_db = arango_client.db('pipisa', username='root', password='stolendick527')
|
|
dicks_collection = pipisa_db.collection('dicks')
|
|
|
|
try:
|
|
dicks = dicks_collection.all( )
|
|
dicks = [d for d in dicks if d['user_id'] != d['chat_id']]
|
|
except Exception as e:
|
|
print('ошибка DB в /glovaldick')
|
|
print(e)
|
|
|
|
top_dicks = sorted(dicks, key=lambda dick: dick['dick_size'], reverse=True)
|
|
|
|
|
|
dick_limit = min(len(top_dicks), 10)
|
|
top_dicks = top_dicks[:dick_limit]
|
|
|
|
global_top = ''
|
|
emo = ['🏆','🚀','💫','🍆','🍌','🐍','🐎','🌭','🌶','👌']
|
|
|
|
if len(top_dicks) == 0:
|
|
await bot.send_message(chatId, '🍆 Никто ничего не нарастил! 🍌')
|
|
else:
|
|
for i in range(len(top_dicks)):
|
|
global_top += f' {emo[i]} {i+1}. {top_dicks[i]["user_fullname"]}: {top_dicks[i]["dick_size"]}см\n'
|
|
i += 1
|
|
|
|
return global_top
|
|
|
|
|
|
|