Replace single report type with composable analysis: depth levels (basic/standard/full) + focus area multi-select (psychology, business, marketing, content, audience, sentiment). Multi-step inline keyboard flow guides users through selection. - i18n: English + Russian, auto-detect from Telegram, /lang override - AI providers: Anthropic + OpenRouter via AIClient abstraction - Telegram Stars payments with per-depth pricing and free trial - SQLite (aiosqlite) for users, analyses, payments tracking - User middleware for auto-registration and language detection - Report persistence: save .md locally, offer file download - New commands: /features, /prices, /lang - Composable prompt system: depth modifiers + focus area fragments
20 lines
669 B
Python
20 lines
669 B
Python
from aiogram import Router
|
|
from aiogram.filters import Command
|
|
from aiogram.types import Message
|
|
|
|
from bot.db import user_repo
|
|
from bot.i18n import Lang, t
|
|
|
|
router = Router()
|
|
|
|
|
|
@router.message(Command("lang"))
|
|
async def cmd_lang(message: Message, lang: Lang = Lang.EN, **_: object) -> None:
|
|
args = (message.text or "").split(maxsplit=1)
|
|
if len(args) < 2 or args[1].strip().lower() not in ("en", "ru"):
|
|
await message.answer(t("lang_usage", lang), parse_mode="HTML")
|
|
return
|
|
|
|
new_lang = args[1].strip().lower()
|
|
await user_repo.update_lang(message.from_user.id, new_lang)
|
|
await message.answer(t("lang_set", new_lang), parse_mode="HTML")
|