forked from zovos/bot_tg
pisi i sisi
This commit is contained in:
parent
3039326100
commit
78dc7f4810
2 changed files with 87 additions and 0 deletions
84
games/nude.py
Normal file
84
games/nude.py
Normal file
|
|
@ -0,0 +1,84 @@
|
||||||
|
import aiohttp
|
||||||
|
from aiogram import types
|
||||||
|
import config
|
||||||
|
import logging
|
||||||
|
import random
|
||||||
|
import json
|
||||||
|
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
CAPTIONS = [
|
||||||
|
"Hot stuff 🔥",
|
||||||
|
"Sexy content 😏"
|
||||||
|
]
|
||||||
|
|
||||||
|
async def handle_nude_cmd(message: types.Message):
|
||||||
|
args = message.text.split(maxsplit=1)
|
||||||
|
|
||||||
|
if len(args) > 1 and args[1].strip() == "-h":
|
||||||
|
help_msg = (
|
||||||
|
"🔥 <b>Справка по команде /nude:</b>\n\n"
|
||||||
|
"Получает случайные изображения взрослых женщин из открытых источников.\n"
|
||||||
|
"• Использует Pornhub API для поиска контента\n"
|
||||||
|
"• По умолчанию ищет популярные видео с высоким рейтингом\n"
|
||||||
|
"• Отправляет превью видео как изображение\n\n"
|
||||||
|
"<i>Пример:</i> <code>/nude</code>\n"
|
||||||
|
"<i>По умолчанию:</i> Популярный контент для взрослых"
|
||||||
|
)
|
||||||
|
await message.reply(help_msg, parse_mode="HTML")
|
||||||
|
return
|
||||||
|
|
||||||
|
# Используем Pornhub API для поиска видео
|
||||||
|
url = "https://www.pornhub.com/webmasters/search"
|
||||||
|
|
||||||
|
params = {
|
||||||
|
"category": "straight",
|
||||||
|
"ordering": "mostviewed",
|
||||||
|
"period": "week",
|
||||||
|
"thumbsize": "medium"
|
||||||
|
}
|
||||||
|
|
||||||
|
headers = {
|
||||||
|
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36"
|
||||||
|
}
|
||||||
|
|
||||||
|
try:
|
||||||
|
async with aiohttp.ClientSession() as session:
|
||||||
|
async with session.get(url, params=params, headers=headers) as resp:
|
||||||
|
if resp.status != 200:
|
||||||
|
logger.error(f"Pornhub API Error: {resp.status}")
|
||||||
|
await message.reply("Не удалось получить контент от сервера :(")
|
||||||
|
return
|
||||||
|
|
||||||
|
# Pornhub API возвращает HTML, нужно парсить
|
||||||
|
text = await resp.text()
|
||||||
|
|
||||||
|
# Ищем URL превью в HTML
|
||||||
|
import re
|
||||||
|
thumb_pattern = r'<img[^>]+src="([^"]+)"[^>]+class="thumb"'
|
||||||
|
matches = re.findall(thumb_pattern, text)
|
||||||
|
|
||||||
|
if not matches:
|
||||||
|
await message.reply("Не удалось найти контент :(")
|
||||||
|
return
|
||||||
|
|
||||||
|
# Берем случайное превью
|
||||||
|
thumb_url = random.choice(matches)
|
||||||
|
|
||||||
|
# Убедимся что URL полный
|
||||||
|
if not thumb_url.startswith('http'):
|
||||||
|
thumb_url = f"https://thumb.pornhub.com{thumb_url}"
|
||||||
|
|
||||||
|
caption = random.choice(CAPTIONS)
|
||||||
|
|
||||||
|
# Отправляем как фото
|
||||||
|
try:
|
||||||
|
input_file = types.URLInputFile(thumb_url)
|
||||||
|
await message.answer_photo(photo=input_file, caption=caption)
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(f"Error sending photo: {e}")
|
||||||
|
await message.answer(f"{caption}\n{thumb_url}")
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
logger.exception("Error in nude command")
|
||||||
|
await message.reply("Произошла ошибка при обращении к API :(")
|
||||||
3
main.py
3
main.py
|
|
@ -23,6 +23,7 @@ from AI.talk_handler import handle_talk, generate_autoreply, push_message
|
||||||
from games.casino import play_casino
|
from games.casino import play_casino
|
||||||
from games.fortune import generate_fortune
|
from games.fortune import generate_fortune
|
||||||
from games.uwu import handle_uwu_cmd
|
from games.uwu import handle_uwu_cmd
|
||||||
|
from games.nude import handle_nude_cmd
|
||||||
from games.betting import (
|
from games.betting import (
|
||||||
clear_user_sport_context,
|
clear_user_sport_context,
|
||||||
debug_sports,
|
debug_sports,
|
||||||
|
|
@ -1417,6 +1418,7 @@ def main():
|
||||||
dp.message.register(handle_sports_debug_cmd, Command("sports_debug"))
|
dp.message.register(handle_sports_debug_cmd, Command("sports_debug"))
|
||||||
dp.message.register(handle_gen_mem, Command("gen_mem"))
|
dp.message.register(handle_gen_mem, Command("gen_mem"))
|
||||||
dp.message.register(handle_uwu_cmd, Command("uwu"))
|
dp.message.register(handle_uwu_cmd, Command("uwu"))
|
||||||
|
dp.message.register(handle_nude_cmd, Command("nude"))
|
||||||
dp.message.register(handle_keywords, F.text)
|
dp.message.register(handle_keywords, F.text)
|
||||||
|
|
||||||
async def on_startup(bot: Bot):
|
async def on_startup(bot: Bot):
|
||||||
|
|
@ -1446,6 +1448,7 @@ def main():
|
||||||
BotCommand(command="sports_debug", description="диагностика API матчей"),
|
BotCommand(command="sports_debug", description="диагностика API матчей"),
|
||||||
BotCommand(command="svodka", description="СВО: итоги"),
|
BotCommand(command="svodka", description="СВО: итоги"),
|
||||||
BotCommand(command="uwu", description="Случайная картинка с e621"),
|
BotCommand(command="uwu", description="Случайная картинка с e621"),
|
||||||
|
BotCommand(command="nude", description="Голые женщины из открытых источников"),
|
||||||
]
|
]
|
||||||
scopes = (
|
scopes = (
|
||||||
BotCommandScopeDefault(),
|
BotCommandScopeDefault(),
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue