- Add shared proxy module (bot/utils/proxy.py) to eliminate duplicate SOCKS5 parsing - Fix AI client: escape HTML before Markdown→HTML conversion, unify timeouts, make health check optional and disabled by default, handle 429 retries - Fix ai.py: correct forwarded message handling (aiogram 3.x forward_origin), pass relevant summaries via extra_system_content - Fix dialogue.py: only respond to Astra's messages, use system context instead of prompt injection, answer on the limit message before phase transition - Fix voice.py: load Whisper model in thread pool, safe WAV path generation - Improve database.py: composite indexes, Boolean is_active, upsert file_id cache, add context cleanup helper - Update weather.py and yadisk_download.py to use shared proxy connector - Update yadisk.py: validate URL before cache clear, add download size limit, wrap sync file ops in to_thread - Reuse S3 client via lru_cache - Update setup_commands with /aiclear and /aiuser - Update README, Dockerfile (Python 3.11), docker-compose (mount models) - Pin dependency versions, remove unused httpx[socks] - Add basic pytest tests for layout converter and voice normalization
27 lines
1.2 KiB
Python
27 lines
1.2 KiB
Python
import logging
|
|
|
|
from aiogram.types import BotCommand
|
|
from bot.bot import bot
|
|
|
|
logger = logging.getLogger("setup_commands")
|
|
|
|
COMMANDS = [
|
|
BotCommand(command="start", description="Запуск бота"),
|
|
BotCommand(command="res", description="Исправить раскладку"),
|
|
BotCommand(command="weather", description="Погода в городе"),
|
|
BotCommand(command="ai", description="Спросить Астру"),
|
|
BotCommand(command="aiclear", description="Очистить диалог с Астрой"),
|
|
BotCommand(command="aiuser", description="Список пользователей чата (админ)"),
|
|
BotCommand(command="aino", description="Заблокировать от AI (админ)"),
|
|
BotCommand(command="aiyes", description="Разблокировать для AI (админ)"),
|
|
BotCommand(command="ydf", description="Скачать с Яндекс.Диска"),
|
|
]
|
|
|
|
|
|
async def setup_bot_commands():
|
|
try:
|
|
await bot.set_my_commands(COMMANDS)
|
|
logger.info("Меню команд установлено: %d команд", len(COMMANDS))
|
|
except Exception as exc:
|
|
logger.error("Не удалось установить меню команд: %s", exc)
|