This Telegram bot helps manage photo content for your channel by allowing administrators to submit photos and automatically posting them on a schedule. Perfect for content managers who want to automate their channel's photo posting workflow.
- Admin-only Access: Only authorized administrators can submit photos
- Photo Storage: Automatically saves photos with optional captions
- Scheduled Posting: Posts photos twice or more daily at specified times
- No Duplicates: Tracks posted photos to avoid repetition
- Admin Notifications: Alerts admins when content pool is depleted
- Docker Support: Easy deployment with Docker and volume persistence
- Docker and Docker Compose installed
- Telegram Bot Token (get it from @BotFather)
- Public channel where the bot is an administrator
- Python 3.11+ (if running without Docker)
- Clone the repository:
git clone https://github.com/maxbobkov/content-flow-bot.git
cd content-flow-bot- Create a
.envfile in the project root:
BOT_TOKEN=your_bot_token_here
CHANNEL_ID=your_channel_id_here # e.g., -100123456789- Configure admin access by editing
config.py:
ADMIN_IDS = [
123456789, # Replace with actual admin user IDs
987654321
]- Build and start the container:
docker-compose up -d- Start a chat with your bot on Telegram
- Send
/startto verify your admin access - Send photos (with optional captions) to add them to the queue
- The bot will automatically post photos twice daily (9:00 and 21:00 by default)
content-flow-bot/
├── bot.py # Main bot logic
├── database.py # Database operations
├── config.py # Configuration settings
├── requirements.txt # Python dependencies
├── Dockerfile # Docker image configuration
├── docker-compose.yml
└── data/ # Mounted volume for persistence
├── photos/ # Stored photos
└── database.sqlite
- Photos are stored in
data/photos/ - Database file is located at
data/database.sqlite - Both directories are persisted through Docker volumes
To modify the posting schedule, edit the following in bot.py:
scheduler.add_job(
post_random_photo,
trigger='cron',
hour='9,21' # Change these hours (24-hour format UTC)
)Add new administrator IDs in config.py:
ADMIN_IDS = [
123456789, # Your admin IDs here
]To run the bot without Docker:
- Create a virtual environment:
python -m venv venv
source venv/bin/activate # or `venv\Scripts\activate` on Windows- Install dependencies:
pip install -r requirements.txt- Run the bot:
python bot.py- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License.
- aiogram for the excellent Telegram Bot framework
- APScheduler for scheduling functionality
If you encounter any problems or have suggestions, please open an issue in the GitHub repository.