forked from Pavel_Durov/python_bot
меньше кода - лучше!
This commit is contained in:
parent
e677591b97
commit
a58f6c404f
@ -6,7 +6,7 @@ databaso:
|
||||
base: pipisa
|
||||
collection: dicks
|
||||
|
||||
telegram_token: 5724991559:AAEuLvpLsgP6LHRGMSyFtQLlR5qPQUO4b_w
|
||||
telegram_token: 6472915685:AAHPvgrQoqG7DxtfbnHWPe3Lfild-CGJ1j8 # 5724991559:AAEuLvpLsgP6LHRGMSyFtQLlR5qPQUO4b_w
|
||||
telegram_admins_ids:
|
||||
- 317051301 # hogweed1
|
||||
- 226765676 # blackjack
|
||||
|
@ -4,7 +4,7 @@ import random
|
||||
|
||||
def ChangeWord(result): #выбирает рандомное слово для изменения размера пиписы
|
||||
|
||||
with open("dicktxt/dick_changes.yaml", 'r') as f:
|
||||
with open("dicktxt/dick_changes.yaml", 'r', encoding='utf-8') as f:
|
||||
words = yaml.load(f, Loader=yaml.Loader)
|
||||
|
||||
dick_inc = [ f'<b>{w}</b>' for w in words['increment'] ]
|
||||
|
@ -153,20 +153,34 @@ async def up_dick(message: types.Message):
|
||||
|
||||
|
||||
|
||||
@dp.message_handler(commands=["topdick"])
|
||||
@dp.message_handler(commands=['topdick','globaldick'])
|
||||
async def send_topchat(message: types.Message):
|
||||
if message.from_user.id in admins or message.chat.type != 'private':
|
||||
|
||||
top_ = False
|
||||
glob_ = False
|
||||
dicks_collection = get_dicks_collection()
|
||||
try:
|
||||
dicks = dicks_collection.find({'chat_id': message.chat.id}, skip=0, limit=1100)
|
||||
dicks = [d for d in dicks]
|
||||
except Exception as e:
|
||||
print('ошибка DB в /topdick')
|
||||
print(e)
|
||||
|
||||
if message['text'] == '/topdick':
|
||||
top_ = True
|
||||
try:
|
||||
dicks = dicks_collection.find({'chat_id': message.chat.id}, skip=0, limit=1100)
|
||||
dicks = [d for d in dicks]
|
||||
except Exception as e:
|
||||
print('ошибка DB в /topdick')
|
||||
print(e)
|
||||
elif message['text'] == '/globaldick':
|
||||
glob_ = True
|
||||
try:
|
||||
dicks = dicks_collection.all( )
|
||||
dicks = [d for d in dicks if d['user_id'] != d['chat_id']]
|
||||
except Exception as e:
|
||||
print('ошибка DB в /globaldick')
|
||||
print(e)
|
||||
else:
|
||||
print('вызывают хз что!')
|
||||
|
||||
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]
|
||||
|
||||
@ -180,41 +194,10 @@ async def send_topchat(message: types.Message):
|
||||
dickos += f' {emo[i]} {i+1}. {top_dicks[i]["user_fullname"]}: {top_dicks[i]["dick_size"]}см\n'
|
||||
i += 1
|
||||
|
||||
await bot.send_message(message.chat.id, '🏆Топ 10 бубылд чата🏆\n\n' + dickos)
|
||||
if top_:
|
||||
await bot.send_message(message.chat.id, '🏆Топ 10 бубылд чата🏆\n\n' + dickos)
|
||||
elif glob_:
|
||||
await bot.send_message(message.chat.id, '🏆Топ 10 пипис в мире🏆\n\n' + dickos)
|
||||
else:
|
||||
await message.reply('Работает только в общих чатах!\n'\
|
||||
'Вы мсжете посмотреть топ по миру /globaldick')
|
||||
|
||||
|
||||
|
||||
|
||||
@dp.message_handler(commands=["globaldick"])
|
||||
async def send_global_top(message: types.Message):
|
||||
dicks_collection = get_dicks_collection()
|
||||
|
||||
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]
|
||||
|
||||
dickos = ''
|
||||
emo = ['🏆','🚀','💫','🍆','🍌','🐍','🐎','🌭','🌶','👌']
|
||||
|
||||
if len(top_dicks) == 0:
|
||||
await bot.send_message(message.chat.id, '🍆 Никто ничего не нарастил! 🍌')
|
||||
else:
|
||||
for i in range(len(top_dicks)):
|
||||
dickos += f' {emo[i]} {i+1}. {top_dicks[i]["user_fullname"]}: {top_dicks[i]["dick_size"]}см\n'
|
||||
i += 1
|
||||
|
||||
await bot.send_message(message.chat.id, '🏆Топ 10 пипис в мире🏆\n\n' + dickos)
|
||||
|
||||
|
||||
'Вы можете посмотреть топ по миру /globaldick')
|
Loading…
Reference in New Issue
Block a user