EduPlannerBotAI is a Telegram bot built with aiogram 3.x
and powered by OpenAI GPT. It generates personalized study plans, exports them to PDF/TXT, and sends reminders as Telegram messages. All data is stored using TinyDB (no other DBs supported).
Note: All code comments and docstrings are in English for international collaboration and code clarity. All user-facing messages and buttons are automatically translated to the user's selected language.
- 📚 Generate personalized study plans (LLM/OpenAI, automatic fallback to Groq if OpenAI unavailable)
- 📝 Export study plans to PDF/TXT
- ⏰ Send reminders as Telegram messages for each study step
- 🗄️ Store data using TinyDB (no SQL/other DBs)
- 🌐 Multilingual: English, Russian, Spanish — all messages, buttons, and files are translated in real time using LLMs (OpenAI or Groq)
- 🏷️ All keyboards are always shown with a short message, ensuring buttons are reliably displayed
- ❌ No empty or invisible messages — all user-facing text is always non-empty (prevents Telegram errors)
- 🔄 Language selection buttons are not translated, so the language filter works correctly
- 🤖 If translation is not possible, the original English text is sent
- 🧩 Simple, maintainable, idiomatic codebase — ready for extension
If the OpenAI API is unavailable, out of quota, or not configured, the bot will automatically use Groq as a fallback LLM provider. Groq offers:
- Fast and reliable generations
- No strict quotas for most users
- OpenAI-compatible API
- Always available fallback
If both OpenAI and Groq are unavailable, the bot falls back to a local plan generator (simple stub).
- Primary: OpenAI API (if
OPENAI_API_KEY
is set and quota is available) - Fallback: Groq (if
GROQ_API_KEY
is set) - Last resort: Local plan generator (simple stub)
- Register and get your API key at Groq.
- Add the following line to your
.env
file:GROQ_API_KEY=your_groq_api_key
- (Optional) Add to
.env.example
for documentation:GROQ_API_KEY=your_groq_api_key
No other changes are needed — the bot will automatically use Groq if OpenAI is not available.
You can choose your preferred language for all bot interactions! Use the /language
command to select from English, Russian, or Spanish. The bot will automatically translate all responses, study plans, and reminders to your chosen language using LLMs (OpenAI or Groq fallback). If translation is not possible, the original English text will be sent.
Supported languages:
- English (
en
) - Русский (
ru
) - Español (
es
)
Translations are performed in real time using the same LLMs that generate study plans, ensuring high-quality and context-aware results. Fallback to Groq is supported for both generation and translation if OpenAI is unavailable.
git clone https://github.com/AlexTkDev/EduPlannerBotAI.git
cd EduPlannerBotAI
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -r requirements.txt
Create a .env
file in the root directory or rename .env.example
to .env
and fill in your tokens:
BOT_TOKEN=your_telegram_bot_token
OPENAI_API_KEY=your_openai_api_key
GROQ_API_KEY=your_groq_api_key
All environment variables are loaded from .env
automatically.
python bot.py
You can run the bot in a container:
docker-compose up --build
Environment variables are loaded from .env
.
When you choose to schedule reminders, the bot will send you a separate Telegram message for each step of your study plan. This ensures you receive timely notifications directly in your chat.
- 100% of core logic and all handlers are covered by automated tests (
pytest
). - Code style: PEP8, pylint score 10/10 (see
.pylintrc
). - To run tests:
pytest
EduPlannerBotAI/
├── bot.py # Bot entry point
├── config.py # Load tokens from .env
├── handlers/ # Command and message handlers
│ ├── __init__.py
│ ├── start.py # /start and greeting
│ ├── planner.py # Study plan generation flow
│ └── language.py # Language selection and filter
├── services/ # Core logic and helper functions
│ ├── llm.py # OpenAI and Groq integration, translation
│ ├── pdf.py # PDF export
│ ├── txt.py # TXT export
│ ├── reminders.py # Reminder simulation
│ └── db.py # TinyDB database
├── .env # Environment variables
├── requirements.txt # Dependencies list
└── README.md # Project documentation
Component | Purpose |
---|---|
Python 3.10+ | Programming language |
aiogram 3.x | Telegram Bot Framework |
OpenAI API | LLM for text generation and translation |
Groq API | Fallback LLM provider (generation+translation) |
fpdf | PDF file generation |
TinyDB | Lightweight NoSQL database |
python-dotenv | Environment variable management |
aiofiles | Asynchronous file operations |
- GitHub Actions workflow for Pylint analysis and tests
- Python version compatibility: 3.10, 3.11, 3.12, 3.13
- Custom
.pylintrc
configuration
- All user-facing messages and buttons always contain non-empty text, eliminating Telegram errors (Bad Request: text must be non-empty).
- Keyboards (format selection, next actions) are always accompanied by a short message to ensure buttons are displayed reliably.
- Language selection buttons are not translated, so the language filter works correctly.
- The entire bot scenario is fully localized: all messages, buttons, and files are translated to the user's selected language (English, Russian, Spanish).
- Multilingual support is powered by LLM-based translation (OpenAI or Groq fallback).
- Fallback to Groq is supported for both generation and translation if OpenAI is unavailable.
- If translation is not possible, the original English text is sent.
- Codebase is fully in English (comments, docstrings, messages), PEP8 and pylint compliant (score 10/10).
- 100% test coverage for all core logic and handlers (pytest).
- Logic is maximally simplified, with no unnecessary conditions; all stages work reliably and predictably.
- Project is ready for open source use and easy extension.
If you're experiencing too many 429 Too Many Requests
errors, consider the following:
- ⏱ Increase
BASE_RETRY_DELAY
- 🔁 Increase
MAX_RETRIES
- 🧠 Use a lighter OpenAI model (e.g.,
gpt-3.5-turbo
instead ofgpt-4
) - 💳 Upgrade your OpenAI plan to one with a higher request quota
We welcome contributions! If you'd like to improve this bot:
- Fork the repository
- Create a feature branch (
git checkout -b feature-name
) - Commit your changes (all code and comments must be in English)
- Push to your fork
- Submit a pull request
Created with ❤️. Feedback and collaboration: @Aleksandr_Tk
MIT License