Telegram bot that answers user messages with an AI-generated Russian response and sends the same response as a voice message.
- Receives messages from Telegram users.
- Generates answers through OpenRouter AI.
- Converts generated text to Russian speech with Google Text-to-Speech.
- Sends both text and voice responses back to the user.
- Python
- pyTelegramBotAPI
- OpenRouter API
- gTTS
- Create and activate a virtual environment:
python -m venv .venv
.\.venv\Scripts\Activate.ps1- Install dependencies:
pip install -r requirements.txt- Create environment variables:
copy .env.example .envThen add your real tokens to .env.
- Run the bot:
python main.pyTELEGRAM_API_KEY- Telegram bot token from BotFather.OPENROUTER_API_KEY- API key from OpenRouter.
Do not commit .env or real API keys to the repository.