Code style: black aiogram aiohttp google-generativeai
A Telegram bot that generates themed posts (text + image) using the Gemini API (Google Generative AI) and sends them to a chat via the /post command.
- Generates posts on random topics
- Text + valid cover image (or
fallback.jpgif none) /postcommand for manual triggering- Dockerized and easily deployable via
docker-compose
- aiogram 3.x β asynchronous Telegram bot framework
- Google Generative AI SDK β access to Gemini
- aiohttp β async HTTP requests
- Docker + Docker Compose β for containerization
git clone https://github.com/serejekee/echogem.git
cd telegram-content-botBOT_TOKEN=your_telegram_bot_token GOOGLE_API_KEY=your_google_api_key
docker-compose up --build -d
Done! The bot will start listening for commands.
/post β generate a post on a random topic (e.g., Space, AI, Health, etc.)
Optional: you can easily extend it to accept a custom topic in topics.txt.
my_bot/
βββ bot/ # Contains the bot's main logic and handlers
β βββ __init__.py
β βββ main.py # Telegram bot logic
β βββ handlers.py # Bot command handlers
β βββ utils.py # Utility functions (like generating posts, etc.)
βββ data/ # Contains all necessary data files
β βββ prompt.txt # Add your prompt here
β βββ topics.txt # Add your topics here
β βββ fallback.jpg # Fallback image if there is no picture
βββ Dockerfile # Docker build instructions
βββ docker-compose.yml # Docker container setup
βββ requirements.txt # Dependencies
βββ README.md # Documentation
MIT License β free to use, adapt, and improve π€