2024-01-21 22:33:15 +10:00
|
|
|
|
from aiogram import types
|
2022-12-05 17:22:23 +10:00
|
|
|
|
from create_bot import bot, dp
|
2022-12-15 22:30:53 +10:00
|
|
|
|
import random
|
2022-12-05 17:22:23 +10:00
|
|
|
|
from random import randint
|
|
|
|
|
import datetime
|
2022-12-16 22:16:21 +10:00
|
|
|
|
from dicktxt import ForReadDict
|
2023-07-16 01:50:12 +10:00
|
|
|
|
from pipisa_functions import pipisa_time
|
2022-12-05 17:22:23 +10:00
|
|
|
|
|
2024-01-21 22:33:15 +10:00
|
|
|
|
from global_conf import CONFIG
|
2023-07-12 21:54:24 +10:00
|
|
|
|
|
2023-07-12 22:00:17 +10:00
|
|
|
|
#### https://docs.python-arango.com/en/main/
|
|
|
|
|
from arango import ArangoClient
|
2023-07-18 06:24:10 +10:00
|
|
|
|
|
2024-01-21 22:33:15 +10:00
|
|
|
|
admins = CONFIG['telegram_admins_ids']
|
2023-07-12 21:54:24 +10:00
|
|
|
|
|
2022-12-05 17:22:23 +10:00
|
|
|
|
|
|
|
|
|
@dp.message_handler(commands=["dick"])
|
|
|
|
|
async def up_dick(message: types.Message):
|
2023-07-12 21:54:24 +10:00
|
|
|
|
#global size_change, dick_plus, dick_minus
|
|
|
|
|
|
2023-07-18 06:24:10 +10:00
|
|
|
|
if message.from_user.id in admins or message.chat.type != 'private':
|
|
|
|
|
|
|
|
|
|
|
2024-01-21 22:33:15 +10:00
|
|
|
|
arango_client = ArangoClient(hosts=CONFIG['databaso']['host'] )
|
|
|
|
|
pipisa_db = arango_client.db(
|
|
|
|
|
CONFIG['databaso']['base'],
|
|
|
|
|
username=CONFIG['databaso']['user'],
|
|
|
|
|
password=CONFIG['databaso']['pass']
|
|
|
|
|
)
|
|
|
|
|
dicks_collection = pipisa_db.collection(CONFIG['databaso']['collection'])
|
2023-07-18 06:24:10 +10:00
|
|
|
|
|
|
|
|
|
|
2024-01-21 21:35:52 +10:00
|
|
|
|
#### TODO уплатить нолог с 100 см для самого нищего
|
|
|
|
|
|
|
|
|
|
|
2023-07-18 06:24:10 +10:00
|
|
|
|
# рандомайзер
|
|
|
|
|
numb = randint(-9,10)
|
|
|
|
|
dick_plus = (
|
|
|
|
|
'<b>вырос</b>',
|
|
|
|
|
'<b>подрос</b>',
|
|
|
|
|
'<b>привстал</b>',
|
|
|
|
|
'<b>увеличился</b>',
|
|
|
|
|
'<b>преисполнился</b>'
|
|
|
|
|
)
|
|
|
|
|
dick_minus = (
|
|
|
|
|
'<b>неудачно потусил на сходке</b>',
|
|
|
|
|
'<b>уменьшился</b>',
|
|
|
|
|
'<b>откусила злая гадюка</b>',
|
|
|
|
|
'<b>продали евреи, он стал дешевле</b>',
|
|
|
|
|
'<b>схуднул</b>'
|
|
|
|
|
)
|
|
|
|
|
dick_stayed = (
|
|
|
|
|
'<b>продвинулся</b>',
|
|
|
|
|
'<b>наноуменьшился</b>',
|
|
|
|
|
'<b>зафиксировал прибыль</b>'
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
if numb > 0:
|
|
|
|
|
size_change = random.choice(dick_plus) + '🚀'
|
|
|
|
|
elif numb == 0:
|
|
|
|
|
size_change = random.choice(dick_stayed) + '🤨'
|
|
|
|
|
else:
|
|
|
|
|
size_change = random.choice(dick_minus) + '✂'
|
2022-12-05 17:22:23 +10:00
|
|
|
|
|
|
|
|
|
|
2023-07-18 06:24:10 +10:00
|
|
|
|
try:
|
|
|
|
|
#### Чекнуть есть ли юзер в базе
|
|
|
|
|
candidate_cursor = dicks_collection.find(
|
|
|
|
|
{
|
|
|
|
|
'user_id': message.from_user.id,
|
|
|
|
|
'chat_id': message.chat.id
|
|
|
|
|
},
|
|
|
|
|
skip=0, limit=1488)
|
|
|
|
|
|
|
|
|
|
if candidate_cursor.count() > 0:
|
|
|
|
|
## Если есть то нарастить и отправить сообщение
|
2023-07-12 21:54:24 +10:00
|
|
|
|
|
2023-07-18 06:24:10 +10:00
|
|
|
|
user = candidate_cursor.pop()
|
|
|
|
|
|
2023-07-12 21:54:24 +10:00
|
|
|
|
|
2023-07-18 06:24:10 +10:00
|
|
|
|
if pipisa_time.rolltime(check_datetime=user['datetimes'], curr_time=datetime.datetime.now()):
|
|
|
|
|
# пришло время крутить!!
|
|
|
|
|
|
|
|
|
|
updetedDick = user["dick_size"] + numb
|
|
|
|
|
try:
|
|
|
|
|
dt = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|
|
|
|
|
metadata = dicks_collection.insert(
|
|
|
|
|
{
|
|
|
|
|
'_key': user['_key'], ### этот нужен чтобы апдейт прилетал тому же юзеру
|
|
|
|
|
'user_id': user['user_id'],
|
|
|
|
|
'user_fullname': message.from_user.full_name,
|
|
|
|
|
'dick_size': updetedDick,
|
|
|
|
|
'datetimes': datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S"),
|
|
|
|
|
'attempts': user['attempts'] + 1,
|
|
|
|
|
'chat_id': message.chat.id
|
|
|
|
|
},
|
|
|
|
|
overwrite_mode='update'
|
|
|
|
|
)
|
|
|
|
|
print(f'Успешно апдейтнули пипису @{message.from_user.username}')
|
|
|
|
|
except Exception as e2:
|
|
|
|
|
print(f'ошибка в обновлении пиписы @{message.from_user.username}')
|
|
|
|
|
print(e2)
|
|
|
|
|
|
|
|
|
|
randomword = ForReadDict.RandomDick()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await bot.send_message(message.chat.id, f'@{message.from_user.username}, ваш <em>{randomword}</em> {size_change}\
|
2023-07-13 00:05:06 +10:00
|
|
|
|
на <b>{abs(numb)}</b> см!\n\
|
|
|
|
|
Теперь он равен <b>{updetedDick}</b> см! ')
|
2023-07-18 06:24:10 +10:00
|
|
|
|
else:
|
|
|
|
|
await bot.send_message(message.chat.id, f'@{message.from_user.username},🚫 вы уже крутили пипису, ее размер <b>{user["dick_size"]}</b> см! ')
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
metadata = dicks_collection.insert(
|
|
|
|
|
{
|
|
|
|
|
'_key': user['_key'], ### этот нужен чтобы апдейт прилетал тому же юзеру
|
|
|
|
|
'user_id': user['user_id'] ,
|
|
|
|
|
'user_fullname': message.from_user.full_name,
|
|
|
|
|
'dick_size': user['dick_size'] ,
|
|
|
|
|
'datetimes': user['datetimes'] ,
|
|
|
|
|
'attempts': user['attempts'] + 1,
|
|
|
|
|
'chat_id': message.chat.id
|
|
|
|
|
},
|
|
|
|
|
overwrite_mode='update'
|
|
|
|
|
)
|
|
|
|
|
print(f'Успешно апдейтнули попытку крутить пипису @{message.from_user.username}')
|
|
|
|
|
except Exception as e2:
|
|
|
|
|
print(f'ошибка в обновлении попытки крутить пипису @{message.from_user.username}')
|
|
|
|
|
print(e2)
|
|
|
|
|
|
|
|
|
|
print(f'пользователь @{message.from_user.username} уже крутил')
|
|
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
## если нету, то создать
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
novenkiy = {
|
|
|
|
|
'user_id': message.from_user.id,
|
|
|
|
|
'user_fullname': message.from_user.full_name,
|
|
|
|
|
'dick_size': numb,
|
|
|
|
|
'datetimes': datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S"),
|
|
|
|
|
'attempts': 1,
|
|
|
|
|
'chat_id': message.chat.id
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
metadata = dicks_collection.insert(novenkiy, overwrite_mode='update')
|
2023-07-12 22:40:45 +10:00
|
|
|
|
|
2023-07-12 21:54:24 +10:00
|
|
|
|
|
2023-07-18 06:24:10 +10:00
|
|
|
|
if numb > 0:
|
|
|
|
|
await bot.send_message(message.chat.id, f'@{message.from_user.username}, ваш писюн показал головку 🚀\n\
|
2022-12-15 22:30:53 +10:00
|
|
|
|
на <b>{abs(numb)}</b> см!\n\
|
2023-07-12 21:54:24 +10:00
|
|
|
|
Теперь он равен <b>{numb}</b> см!')
|
2023-07-18 06:24:10 +10:00
|
|
|
|
else:
|
|
|
|
|
await bot.send_message(message.chat.id, f'@{message.from_user.username}, добро пожаловать в игру!🚀\n\
|
2023-07-12 22:07:03 +10:00
|
|
|
|
Ты стартуешь не с лучшей позиции, природа наградила тебя всего <b>{numb}</b> см 😬')
|
2023-07-18 06:24:10 +10:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
print(f'Успешно добавлен пользователь @{message.from_user.username}')
|
|
|
|
|
except Exception as e1:
|
|
|
|
|
print('ошибка в добавлении нового пользователя')
|
|
|
|
|
print(e1)
|
2022-12-05 17:22:23 +10:00
|
|
|
|
|
2022-12-07 21:12:21 +10:00
|
|
|
|
|
2023-07-18 06:24:10 +10:00
|
|
|
|
except Exception as e:
|
|
|
|
|
print('ошибка DB в /dick')
|
|
|
|
|
print(e)
|
|
|
|
|
else:
|
|
|
|
|
await message.reply('Растить елду можно только в общих чатах!')
|
|
|
|
|
|
2023-07-12 21:54:24 +10:00
|
|
|
|
|
|
|
|
|
|
2022-12-05 17:22:23 +10:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@dp.message_handler(commands=["topdick"])
|
|
|
|
|
async def send_topchat(message: types.Message):
|
2023-07-18 06:24:10 +10:00
|
|
|
|
if message.from_user.id in admins or message.chat.type != 'private':
|
2023-07-12 21:54:24 +10:00
|
|
|
|
|
2024-01-21 22:33:15 +10:00
|
|
|
|
arango_client = ArangoClient(hosts=CONFIG['databaso']['host'] )
|
|
|
|
|
pipisa_db = arango_client.db(
|
|
|
|
|
CONFIG['databaso']['base'],
|
|
|
|
|
username=CONFIG['databaso']['user'],
|
|
|
|
|
password=CONFIG['databaso']['pass']
|
|
|
|
|
)
|
|
|
|
|
dicks_collection = pipisa_db.collection(CONFIG['databaso']['collection'])
|
2023-07-12 21:54:24 +10:00
|
|
|
|
|
2023-07-18 06:24:10 +10:00
|
|
|
|
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)
|
2023-07-12 21:54:24 +10:00
|
|
|
|
|
2023-07-18 06:24:10 +10:00
|
|
|
|
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]
|
2023-07-12 21:54:24 +10:00
|
|
|
|
|
2023-07-18 06:24:10 +10:00
|
|
|
|
dickos = ''
|
|
|
|
|
emo = ['🏆','🚀','🍆','🍌','🐍','🐎','🌭','🌶','👌','💩']
|
2023-07-12 21:54:24 +10:00
|
|
|
|
|
2023-07-18 06:24:10 +10:00
|
|
|
|
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)
|
2023-07-12 21:54:24 +10:00
|
|
|
|
else:
|
2023-07-18 06:24:10 +10:00
|
|
|
|
await message.reply('Работает только в общих чатах!\n'\
|
|
|
|
|
'Вы мсжете посмотреть топ по миру /globaldick')
|
2022-12-05 17:22:23 +10:00
|
|
|
|
|
2023-07-12 21:54:24 +10:00
|
|
|
|
|
2022-12-05 17:22:23 +10:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@dp.message_handler(commands=["globaldick"])
|
|
|
|
|
async def send_global_top(message: types.Message):
|
2023-07-12 21:54:24 +10:00
|
|
|
|
|
|
|
|
|
|
2024-01-21 22:33:15 +10:00
|
|
|
|
arango_client = ArangoClient(hosts=CONFIG['databaso']['host'] )
|
|
|
|
|
pipisa_db = arango_client.db(
|
|
|
|
|
CONFIG['databaso']['base'],
|
|
|
|
|
username=CONFIG['databaso']['user'],
|
|
|
|
|
password=CONFIG['databaso']['pass']
|
|
|
|
|
)
|
|
|
|
|
dicks_collection = pipisa_db.collection(CONFIG['databaso']['collection'])
|
2023-07-12 21:54:24 +10:00
|
|
|
|
|
2022-12-07 21:12:21 +10:00
|
|
|
|
try:
|
2023-07-12 21:54:24 +10:00
|
|
|
|
dicks = dicks_collection.all( )
|
2023-07-20 16:09:27 +10:00
|
|
|
|
dicks = [d for d in dicks if d['user_id'] != d['chat_id']]
|
2023-07-12 21:54:24 +10:00
|
|
|
|
except Exception as e:
|
|
|
|
|
print('ошибка DB в /glovaldick')
|
|
|
|
|
print(e)
|
|
|
|
|
|
|
|
|
|
top_dicks = sorted(dicks, key=lambda dick: dick['dick_size'], reverse=True)
|
|
|
|
|
|
2023-07-20 16:09:27 +10:00
|
|
|
|
|
2023-07-12 21:54:24 +10:00
|
|
|
|
dick_limit = min(len(top_dicks), 10)
|
|
|
|
|
top_dicks = top_dicks[:dick_limit]
|
2023-07-18 06:24:10 +10:00
|
|
|
|
|
2023-07-12 21:54:24 +10:00
|
|
|
|
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)
|
2022-12-05 17:22:23 +10:00
|
|
|
|
|
2023-07-18 06:24:10 +10:00
|
|
|
|
|