An advanced Telegram bot built with Go that serves as a personal coding mentor. The system leverages OpenAI's LLMs to provide expert-level guidance, featuring persistent conversation history and a modular architecture.
- Interactive Specialization Selection: Users can choose their learning track (Go, Python, JS, C++, PHP, HTML/CSS) via a sleek, multi-row inline keyboard.
- Context-Aware Mentorship: The bot maintains the state of the selected programming language for each user, ensuring personalized guidance.
- Clean Architecture: Strictly follows a modular design (Domain, Repository, Application layers), making the codebase easy to scale and maintain.
- LLM Agnostic Design: Decoupled service layer allows seamless switching between AI providers (OpenAI, DeepSeek, Anthropic) without rewriting core logic.
- Persistent Storage: Full audit logs and user preferences are stored in a PostgreSQL database with high-performance interaction via the
pgxdriver. - Rich UI/UX: Utilizes HTML-formatted responses and real-time callback feedback for a professional look and feel.
Following the Standard Go Project Layout, the code is organized into logical layers:
ai-programming-mentor/
├── assets/ # UI screenshots and database previews
├── cmd/bot/ # Entry point: Bot initialization and update loop
├── internal/
│ └── domain/ # Core entities: Business models (Message, User)
│ └── repository/# Data Layer: PostgreSQL implementation (Save/Load logic)
├── migrations/ # SQL scripts: Schema definition and table structures
├── .env.example # Environment configuration template
└── README.md # Project documentation
• Language: Go (Golang) 1.21+
• Database: PostgreSQL
• AI Engine: OpenAI GPT-4o-mini
• APIs: Telegram Bot API v5
• Libraries: pgx/v5, godotenv, go-openai
• Installed Go and PostgreSQL.
• API keys from OpenAI and Telegram (@BotFather).
Clone the repository and create a .env file:
git clone [https://github.com/Endropr/ai-programming-mentor.git](https://github.com/Endropr/ai-programming-mentor.git)
cd ai-programming-mentor
cp .env.example .env
TELEGRAM_APITOKEN=your_token
OPENAI_API_KEY=your_key
DB_URL=postgres://user:password@localhost:5432/dbname
go run cmd/bot/main.go

