https://github.com/l1ve4code/telegram-post-generator
Automatically generate and post motivational content to a Telegram channel.
https://github.com/l1ve4code/telegram-post-generator
ai deepseek python telegram telethon
Last synced: 10 months ago
JSON representation
Automatically generate and post motivational content to a Telegram channel.
- Host: GitHub
- URL: https://github.com/l1ve4code/telegram-post-generator
- Owner: l1ve4code
- License: apache-2.0
- Created: 2025-03-20T16:02:06.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-04-24T18:20:06.000Z (12 months ago)
- Last Synced: 2025-06-17T22:02:22.619Z (10 months ago)
- Topics: ai, deepseek, python, telegram, telethon
- Language: Python
- Homepage:
- Size: 15.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# telegram-post-generator
## About
- **Purpose**: Automatically generate and post motivational content to a Telegram channel.
- **Key Features**:
- Generates motivational quotes, facts, tips, and calls to action using AI.
- Posts content with images to a Telegram channel.
- Schedules posts every 3 hours.
- Handles errors and reconnects automatically.
### Technologies
* Language: **Python**
* Libraries: **Telethon, Requests, Schedule, Asyncio**
* Deployment: **Docker, Docker Compose**
* API: **Telegram API, Hugging Face API (or DeepSeek API)**
## Installing
### Clone the Project
```shell
git clone https://github.com/l1ve4code/telegram-post-generator.git
```
### Replace Placeholders in `docker-compose.yml`
```yaml
services:
telegram-autoposter:
build: .
container_name: telegram-autoposter
network_mode: host
environment:
- THEME=YOUR_THEME
- LINK=YOUR_LINK
- API_KEY=YOUR_API_KEY
- API_ID=YOUR_API_ID
- API_HASH=YOUR_API_HASH
- CHANNEL_ID=YOUR_CHANNEL_ID
restart: unless-stopped
```
## Running the Project
### Using Docker Compose
1. Build and start the container:
```shell
docker-compose up --build
```
2. Stop the container:
```shell
docker-compose down
```
### Running Locally
1. Install dependencies:
```shell
pip install -r requirements.txt
```
2. Run the script:
```shell
python main.py
```
## How It Works
1. **Content Generation**:
- The script uses an AI API (Hugging Face or DeepSeek) to generate motivational quotes, facts, tips, and calls to action.
- The generated content is formatted into a post with Markdown and emojis.
2. **Posting to Telegram**:
- The script sends the generated post along with an image to the specified Telegram channel using the `Telethon` library.
- It handles errors such as network interruptions and reconnects automatically.
3. **Scheduling**:
- Posts are scheduled every 3 hours using the `schedule` library.
- The script runs continuously, checking for new posts to send.
4. **Session Management**:
- The session file (`session_file`) is used to maintain the Telegram connection, ensuring that the bot stays logged in.
## Author
* Telegram: **[@live4code](https://t.me/live4code)**
* Email: **steven.marelly@gmail.com**
Good luck with your Telegram AutoPoster! 🚀