From 2740e848e4759737c842e35477ef7d4cb74f428b Mon Sep 17 00:00:00 2001 From: Hitoshi-Hub Date: Thu, 23 Apr 2026 13:01:38 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A1=D0=B4=D0=B5=D0=BB=D0=B0=D0=BB=20=D1=82?= =?UTF-8?q?=D0=B0=D0=BA=20=D1=87=D1=82=D0=BE=D0=B1=D1=8B=20=D0=BD=D0=B5=20?= =?UTF-8?q?=D0=BE=D1=82=D0=B2=D0=B5=D1=87=D0=B0=D0=BB=20=D0=BD=D0=B0=20?= =?UTF-8?q?=D1=84=D0=BE=D1=82=D0=BE=20=D0=B1=D0=B5=D0=B7=20/watch?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .codex | 0 AI/talk_handler.py | 7 +++++-- games/nude.py | 1 + main.py | 13 ++++++++++++- 4 files changed, 18 insertions(+), 3 deletions(-) create mode 100644 .codex diff --git a/.codex b/.codex new file mode 100644 index 0000000..e69de29 diff --git a/AI/talk_handler.py b/AI/talk_handler.py index 2e99a10..bd98c3f 100644 --- a/AI/talk_handler.py +++ b/AI/talk_handler.py @@ -10,6 +10,7 @@ import re import sqlite3 import time from io import BytesIO +import re from pathlib import Path from typing import Any @@ -237,6 +238,7 @@ AUTONOMOUS_SIGNAL_RE = re.compile( re.IGNORECASE, ) LETTER_RE = re.compile(r"[A-Za-zА-Яа-яЁё0-9]") +WATCH_COMMAND_RE = re.compile(r"^/watch(?:@[A-Za-z0-9_]+)?(?:\s+(.*))?$", re.IGNORECASE | re.DOTALL) _reply_lock = asyncio.Lock() _summary_lock = asyncio.Lock() @@ -903,12 +905,13 @@ async def handle_photo_message(message: Message) -> bool: is_image_document = bool(message.document and (message.document.mime_type or "").startswith("image/")) if not (message.photo or is_image_document) or not message.from_user or message.from_user.is_bot: return False - if message.caption and message.caption.startswith("/"): + watch_match = WATCH_COMMAND_RE.match((message.caption or "").strip()) + if not watch_match: return False chat_id = message.chat.id user_name = message.from_user.first_name or "кент" - caption = _clean_text(message.caption or "") + caption = _clean_text(watch_match.group(1) or "") logger.warning( "Received image message for analysis. chat_id=%s user=%s has_photo=%s has_image_document=%s caption=%s", diff --git a/games/nude.py b/games/nude.py index b1c024d..fec2b61 100644 --- a/games/nude.py +++ b/games/nude.py @@ -18,6 +18,7 @@ CAPTIONS = [ "Шо ты блять псюнчик решил свой подергать?", "Решил подрочить сука?", "гнойный писюн у тебя кнч, да", + "Ух нихуя, это ШПАЧИХА!?", ] LESAINT_POSTS_API = "https://lesaintdesseins.fr/wp-json/wp/v2/posts" diff --git a/main.py b/main.py index 02b60ef..633e026 100644 --- a/main.py +++ b/main.py @@ -58,6 +58,12 @@ def _is_supported_image_message(message: Message) -> bool: ) ) +def _is_watch_image_message(message: Message) -> bool: + if not _is_supported_image_message(message): + return False + caption = (message.caption or "").strip() + return bool(re.match(r"^/watch(?:@[A-Za-z0-9_]+)?(?:\s|$)", caption, flags=re.IGNORECASE)) + async def handle_unmatched_message_debug(message: Message): logger.warning( @@ -1199,6 +1205,10 @@ async def handle_keywords(message: Message): chat_id = message.chat.id user_name = (message.from_user.first_name or "кент") if message.from_user else "кент" + # /ebalnik должен глушить все авто-реакции в чате, включая медиа/фото-ветки. + if chat_id in _autoreply_disabled_chats: + return + if any(re.search(rf'\b{word}\b', text_lower) for word in config.KEYWORDS): audio_path = config.BASE_DIR / "maket" / "Radiohead - Creep.mp3" if audio_path.exists(): @@ -1456,7 +1466,7 @@ def main(): dp.message.register(handle_gen_mem, Command("gen_mem")) dp.message.register(handle_uwu_cmd, Command("uwu")) dp.message.register(handle_nude_cmd, Command("nude")) - dp.message.register(handle_photo_message, _is_supported_image_message) + dp.message.register(handle_photo_message, _is_watch_image_message) dp.message.register(handle_keywords, F.text) dp.message.register(handle_unmatched_message_debug) @@ -1477,6 +1487,7 @@ def main(): BotCommand(command="fetch", description="alias для /prices"), BotCommand(command="zvetok", description="Цветянский бля"), BotCommand(command="talk", description="Побазарить"), + BotCommand(command="watch", description="Коммент фото по подписи /watch"), BotCommand(command="ebalnik", description="вкл/выкл автответов"), BotCommand(command="penis_casino", description="казино на размер"), BotCommand(command="gadanie", description="гадание на фене"),