- FastAPI REST API with JWT auth - aiogram 3 Telegram bot with admin middleware - APScheduler daily tasks (expiry, reminders, revoke, sync) - SQLAlchemy 2 async ORM with Alembic migrations - Jinja2 admin panel (Dashboard, Users, Payments, Servers, Tariffs) - VPN provider abstraction with MockProvider - Stats service with revenue/subscription analytics - Docker Compose (PostgreSQL + Redis + app) - Healthcheck endpoint
31 lines
881 B
Python
31 lines
881 B
Python
from aiogram import Bot, Dispatcher
|
|
from aiogram.client.default import DefaultBotProperties
|
|
from aiogram.enums import ParseMode
|
|
|
|
from app.bot.handlers.start import router as start_router
|
|
from app.bot.handlers.users import router as users_router
|
|
from app.bot.handlers.subscription import router as subscription_router
|
|
from app.bot.handlers.stats import router as stats_router
|
|
from app.bot.middlewares import AdminMiddleware
|
|
from app.settings import settings
|
|
|
|
|
|
def create_dispatcher() -> Dispatcher:
|
|
dp = Dispatcher()
|
|
|
|
dp.message.middleware(AdminMiddleware())
|
|
|
|
dp.include_router(start_router)
|
|
dp.include_router(users_router)
|
|
dp.include_router(subscription_router)
|
|
dp.include_router(stats_router)
|
|
|
|
return dp
|
|
|
|
|
|
def create_bot() -> Bot:
|
|
return Bot(
|
|
token=settings.bot_token,
|
|
default=DefaultBotProperties(parse_mode=ParseMode.HTML),
|
|
)
|