Telegram bot for an educational center β card-based subscription management with admin & student roles.
Built with aiogram 3, PostgreSQL (asyncpg), and modular architecture.
- β Add students β by phone number + password (default
123on/skip) - π€ View all users β click to see phone, subscription status, card details
- π Reset password β admin can reset any student's password
- π Statistics β weekly / monthly sales and subscription stats
- π’ Broadcast β send announcements to all users
- π Plan management β view, add, edit, delete subscription plans
- π Login β phone + password authentication
- π View plans β browse available subscription plans
- π³ Purchase β select plan, make payment, send proof (screenshot)
- π΄ Digital card β visually rich card displayed after payment approval
- π Payment history β track past and pending payments
- βΉοΈ Profile β view personal info and subscription status
| Card | Duration | Visual |
|---|---|---|
| π₯ Bronze | 1 month | Brown theme |
| π₯ Silver | 3 months | Silver theme |
| π₯ Gold | 6 months | Gold theme |
| π Platinum | 12 months | Blue diamond theme |
- β Rating
- β Q&A
- π Course Info
- π§ Daily Quiz
card-bot/
βββ .env # Environment variables
βββ .env.example # Template
βββ requirements.txt # Dependencies
βββ run.py # Entry point
βββ bot/
β βββ __init__.py
β βββ config.py # Configuration loader
β βββ main.py # Bot & dispatcher setup
β βββ db/
β β βββ database.py # Connection pool & table init
β β βββ models.py # All database queries
β βββ handlers/
β β βββ common.py # /start, shared handlers
β β βββ admin.py # Full admin panel
β β βββ student.py # Student features
β βββ keyboards/
β β βββ admin_kb.py # Admin keyboards
β β βββ student_kb.py # Student keyboards
β βββ states/
β β βββ admin_states.py
β β βββ student_states.py
β βββ utils/
β βββ card_generator.py # Card visual generator
β βββ helpers.py # Utility functions
- Python 3.11+
- PostgreSQL running locally or remotely
CREATE DATABASE card_bot;cp .env.example .envEdit .env with your values:
BOT_TOKENβ from @BotFatherADMIN_IDSβ comma-separated Telegram user IDsDATABASE_URLβ PostgreSQL connection stringPAYMENT_CARD_NUMBERβ payment card for studentsPAYMENT_CARD_HOLDERβ cardholder name
pip install -r requirements.txtpython run.pyTables are auto-created on startup. Default plans (Bronze, Silver, Gold, Platinum) are seeded if the plans table is empty.
- Admin adds a student via phone number
- Student sends
/start, logs in with phone + password - Student browses plans and selects one to purchase
- Payment details are shown; student sends proof (screenshot)
- Admin receives the proof and approves/rejects
- On approval, a digital subscription card is generated and sent to the student
- Student can view their card, expiry, and payment history anytime
MIT