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
|
2024-01-24 14:09:31 +10:00
|
|
|
|
import datetime, logging
|
2024-01-22 02:59:25 +10:00
|
|
|
|
from dicktxt import ForReadDict, WordsChange
|
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
|
|
|
|
|
2024-01-23 15:12:59 +10:00
|
|
|
|
from db_logic import tops, user_stuff, postcleaner
|
2023-07-12 21:54:24 +10:00
|
|
|
|
|
2022-12-05 17:22:23 +10:00
|
|
|
|
|
2024-01-23 12:45:44 +10:00
|
|
|
|
admins = CONFIG['telegram_admins_ids']
|
2024-01-22 02:59:25 +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
|
|
|
|
|
2023-07-18 06:24:10 +10:00
|
|
|
|
if message.from_user.id in admins or message.chat.type != 'private':
|
|
|
|
|
|
2024-01-23 15:12:59 +10:00
|
|
|
|
|
|
|
|
|
postcleaner.append_post_to_cleaning_sequence(message=message, type=f'COMMAND_CALL__DICK')
|
2024-01-23 15:29:34 +10:00
|
|
|
|
await clean_posts(chat_id=message.chat.id, type='COMMAND_CALL__DICK', max_id=message.message_id)
|
2024-01-23 15:12:59 +10:00
|
|
|
|
|
2024-01-21 21:35:52 +10:00
|
|
|
|
#### TODO уплатить нолог с 100 см для самого нищего
|
|
|
|
|
|
2023-07-18 06:24:10 +10:00
|
|
|
|
# рандомайзер
|
2024-01-23 02:26:29 +10:00
|
|
|
|
result = randint(-9,10)
|
2024-01-23 13:18:51 +10:00
|
|
|
|
|
|
|
|
|
#### Чекнуть есть ли юзер в базе
|
2024-01-23 13:29:31 +10:00
|
|
|
|
user = user_stuff.get_user(message)
|
2024-01-23 13:18:51 +10:00
|
|
|
|
|
|
|
|
|
if user:
|
|
|
|
|
## Если есть то нарастить и отправить сообщение
|
|
|
|
|
|
|
|
|
|
if pipisa_time.rolltime(check_datetime=user['datetimes'], curr_time=datetime.datetime.now()):
|
|
|
|
|
# пришло время крутить!!
|
|
|
|
|
|
|
|
|
|
updatedDick = user["dick_size"] + result
|
2024-01-23 13:29:31 +10:00
|
|
|
|
user_stuff.update_dick_size(message, user, updatedDick)
|
2024-01-23 13:18:51 +10:00
|
|
|
|
|
2024-01-23 13:21:10 +10:00
|
|
|
|
randomdickword = ForReadDict.RandomDick()
|
|
|
|
|
change_phrase = WordsChange.ChangeWord(result)
|
2024-01-23 13:18:51 +10:00
|
|
|
|
|
|
|
|
|
await bot.send_message( message.chat.id,
|
2024-01-23 13:21:10 +10:00
|
|
|
|
f'@{message.from_user.username}, ваш <em>{randomdickword}</em> {change_phrase} на <b>{abs(result)}</b> см!\nТеперь он равен <b>{updatedDick}</b> см! '
|
2024-01-23 13:18:51 +10:00
|
|
|
|
)
|
|
|
|
|
else:
|
2024-01-23 15:12:59 +10:00
|
|
|
|
mmm = await bot.send_message( message.chat.id,
|
2024-01-23 13:21:10 +10:00
|
|
|
|
f'@{message.from_user.username}, 🚫 вы уже крутили пипису, её размер <b>{user["dick_size"]}</b> см! '
|
2024-01-23 13:18:51 +10:00
|
|
|
|
)
|
2024-01-23 13:29:31 +10:00
|
|
|
|
user_stuff.update_attempts( message, user)
|
2024-01-23 15:12:59 +10:00
|
|
|
|
|
|
|
|
|
postcleaner.append_post_to_cleaning_sequence(message=mmm, type='ALREADY_ROLLED')
|
2024-01-23 15:29:34 +10:00
|
|
|
|
await clean_posts(chat_id=mmm.chat.id, type='ALREADY_ROLLED', max_id=mmm.message_id)
|
2024-01-23 13:18:51 +10:00
|
|
|
|
else:
|
|
|
|
|
## если нету, то создать
|
2024-01-23 13:29:31 +10:00
|
|
|
|
user_stuff.store_new_user(message, result)
|
2024-01-23 13:18:51 +10:00
|
|
|
|
|
|
|
|
|
if result > 0:
|
|
|
|
|
await bot.send_message( message.chat.id,
|
|
|
|
|
f'@{message.from_user.username}, ваш писюн показал головку 🚀\nна <b>{abs(result)}</b> см!\nТеперь он равен <b>{result}</b> см!'
|
|
|
|
|
)
|
|
|
|
|
else:
|
|
|
|
|
await bot.send_message( message.chat.id,
|
|
|
|
|
f'@{message.from_user.username}, добро пожаловать в игру!🚀\nТы стартуешь не с лучшей позиции, природа наградила тебя всего <b>{result}</b> см 😬'
|
|
|
|
|
)
|
2024-01-23 15:12:59 +10:00
|
|
|
|
|
2023-07-18 06:24:10 +10:00
|
|
|
|
else:
|
|
|
|
|
await message.reply('Растить елду можно только в общих чатах!')
|
|
|
|
|
|
2024-01-23 02:26:29 +10:00
|
|
|
|
|
|
|
|
|
|
2024-01-23 02:21:29 +10:00
|
|
|
|
@dp.message_handler(commands = ['topdick', 'globaldick'])
|
2022-12-05 17:22:23 +10:00
|
|
|
|
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':
|
2024-01-23 02:18:50 +10:00
|
|
|
|
|
2024-01-23 12:45:44 +10:00
|
|
|
|
top_ = message['text'].startswith('/topdick')
|
|
|
|
|
glob_ = message['text'].startswith('/globaldick')
|
|
|
|
|
|
|
|
|
|
if top_:
|
2024-01-23 13:18:51 +10:00
|
|
|
|
dickos = tops.get_tops( top_ = True, chat_id=message.chat.id )
|
2024-01-23 15:12:59 +10:00
|
|
|
|
postcleaner.append_post_to_cleaning_sequence(message=message, type=f'COMMAND_CALL__TOPDICK')
|
2024-01-23 15:29:34 +10:00
|
|
|
|
await clean_posts(chat_id=message.chat.id, type='COMMAND_CALL__TOPDICK', max_id=message.message_id)
|
2024-01-23 12:45:44 +10:00
|
|
|
|
elif glob_:
|
2024-01-23 13:18:51 +10:00
|
|
|
|
dickos = tops.get_tops( glob_ = True )
|
2024-01-23 15:12:59 +10:00
|
|
|
|
postcleaner.append_post_to_cleaning_sequence(message=message, type=f'COMMAND_CALL__GLOBALDICK')
|
2024-01-23 15:29:34 +10:00
|
|
|
|
await clean_posts(chat_id=message.chat.id, type='COMMAND_CALL__GLOBALDICK', max_id=message.message_id)
|
2024-01-23 02:18:50 +10:00
|
|
|
|
else:
|
2024-01-24 14:09:31 +10:00
|
|
|
|
logging.error('вызывают хз что!')
|
2023-07-12 21:54:24 +10:00
|
|
|
|
|
2024-01-23 15:12:59 +10:00
|
|
|
|
|
2024-01-23 12:45:44 +10:00
|
|
|
|
if not dickos:
|
2023-07-18 06:24:10 +10:00
|
|
|
|
await bot.send_message(message.chat.id, '🍆 Никто ничего не нарастил! 🍌')
|
|
|
|
|
else:
|
2024-01-23 02:18:50 +10:00
|
|
|
|
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)
|
2023-07-12 21:54:24 +10:00
|
|
|
|
else:
|
2023-07-18 06:24:10 +10:00
|
|
|
|
await message.reply('Работает только в общих чатах!\n'\
|
2024-01-23 15:12:59 +10:00
|
|
|
|
'Вы можете посмотреть топ по миру /globaldick')
|
|
|
|
|
|
|
|
|
|
|
2024-01-23 15:29:34 +10:00
|
|
|
|
async def clean_posts(chat_id, type=None, max_id=None):
|
|
|
|
|
psts = postcleaner.get_posts_to_be_removed(chat_id, type, max_id)
|
2024-01-23 15:12:59 +10:00
|
|
|
|
|
|
|
|
|
for p in psts:
|
|
|
|
|
postcleaner.del_post(chat_id=p['chat_id'], msg_id=p['msg_id'])
|
|
|
|
|
|
|
|
|
|
#### TODO проверить админит ли бот
|
|
|
|
|
await bot.delete_message( chat_id=p['chat_id'], message_id=p['msg_id'], )
|
|
|
|
|
|