trying artifitial antitop
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
hogweed1 2024-06-29 01:36:59 +10:00
parent 1533c5eb91
commit 6709eebb88
3 changed files with 62 additions and 1 deletions

View File

@ -32,3 +32,34 @@ def get_tops(top_ = False, glob_ = False, chat_id = None):
i += 1 i += 1
return dickos return dickos
def get_antitops(top_ = False, glob_ = False, chat_id = None):
dicks = []
if top_:
try:
dicks = [d for d in collections.get_dicks_collection().find({'chat_id': chat_id}, skip=0, limit=1100)]
except Exception as e:
logging.error('ошибка DB в /topdick')
logging.error(e)
elif glob_:
try:
dicks = [d for d in collections.get_dicks_collection().all() if d['user_id'] != d['chat_id']]
except Exception as e:
logging.error('ошибка DB в /globaldick')
logging.error(e)
else:
logging.error('вызывают хз что!')
antitop_dicks = sorted(dicks, key=lambda dick: dick['dick_size'], reverse=False)
antitop_dicks = antitop_dicks[:( min(len(antitop_dicks), 10) )]
dickos = ''
emo = ['🏆','🚀','🍆','🍌','🐍','🐎','🌭','🌶','👌','💩']
if len(antitop_dicks) > 0:
for i in range(len(antitop_dicks)):
dickos += f' {emo[i]} {i+1}. {antitop_dicks[i]["user_fullname"]}: {antitop_dicks[i]["dick_size"]}см\n'
i += 1
return dickos

View File

@ -99,6 +99,36 @@ async def send_topchat(message: types.Message):
'Вы можете посмотреть топ по миру /globaldick') 'Вы можете посмотреть топ по миру /globaldick')
@dp.message_handler(commands = ['antitopdick', 'antiglobaldick'])
async def send_antitopchat(message: types.Message):
if message.from_user.id in admins or message.chat.type != 'private':
antitop_ = message['text'].startswith('/antitopdick')
antiglob_ = message['text'].startswith('/antiglobaldick')
if antitop_:
dickos = tops.get_antitops(top_=True, chat_id=message.chat.id)
postcleaner.append_post_to_cleaning_sequence(message=message, type=f'COMMAND_CALL__ANTITOPDICK')
await clean_posts(chat_id=message.chat.id, type='COMMAND_CALL__ANTITOPDICK', max_id=message.message_id)
elif antiglob_:
dickos = tops.get_antitops(glob_=True)
postcleaner.append_post_to_cleaning_sequence(message=message, type=f'COMMAND_CALL__ANTIGLOBALDICK')
await clean_posts(chat_id=message.chat.id, type='COMMAND_CALL__ANTIGLOBALDICK', max_id=message.message_id)
else:
logging.error('вызывают хз что!')
if not dickos:
await bot.send_message(message.chat.id, '🍌 У всех пользователей бубылда растёт! 🍆')
else:
if antitop_:
await bot.send_message(message.chat.id, '🚫Антитоп 10 бубылд чата🚫\n\n' + dickos)
elif antiglob_:
await bot.send_message(message.chat.id, '🚫Антитоп 10 пипис в мире🚫\n\n' + dickos)
else:
await message.reply('Работает только в общих чатах!\n'\
'Вы можете посмотреть антитоп по миру /antiglobaldick')
async def clean_posts(chat_id, type=None, max_id=None): async def clean_posts(chat_id, type=None, max_id=None):
psts = postcleaner.get_posts_to_be_removed(chat_id, type, max_id) psts = postcleaner.get_posts_to_be_removed(chat_id, type, max_id)

View File

@ -1,3 +1,3 @@
aiogram aiogram==2.15
python-arango python-arango
pyyaml pyyaml