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
55 lines
1.3 KiB
Python
55 lines
1.3 KiB
Python
from dataclasses import dataclass, field
|
|
from datetime import datetime
|
|
from enum import Enum
|
|
|
|
|
|
class Depth(Enum):
|
|
BASIC = "basic"
|
|
STANDARD = "standard"
|
|
FULL = "full"
|
|
|
|
@property
|
|
def label(self) -> str:
|
|
return {
|
|
Depth.BASIC: "Basic",
|
|
Depth.STANDARD: "Standard",
|
|
Depth.FULL: "Full",
|
|
}[self]
|
|
|
|
|
|
class FocusArea(Enum):
|
|
PSYCHOLOGY = "psychology"
|
|
BUSINESS = "business"
|
|
MARKETING = "marketing"
|
|
CONTENT = "content"
|
|
AUDIENCE = "audience"
|
|
SENTIMENT = "sentiment"
|
|
|
|
@property
|
|
def label(self) -> str:
|
|
return {
|
|
FocusArea.PSYCHOLOGY: "Psychology & Influence",
|
|
FocusArea.BUSINESS: "Business & Monetization",
|
|
FocusArea.MARKETING: "Marketing & Growth",
|
|
FocusArea.CONTENT: "Content Strategy",
|
|
FocusArea.AUDIENCE: "Audience & Engagement",
|
|
FocusArea.SENTIMENT: "Sentiment Analysis",
|
|
}[self]
|
|
|
|
|
|
@dataclass
|
|
class ChannelMessage:
|
|
id: int
|
|
date: datetime
|
|
text: str
|
|
views: int | None = None
|
|
forwards: int | None = None
|
|
replies: int | None = None
|
|
|
|
|
|
@dataclass
|
|
class AnalysisSession:
|
|
channel: str
|
|
depth: Depth | None = None
|
|
focus_areas: list[FocusArea] = field(default_factory=list)
|
|
model_id: str | None = None
|