{"id":27122343,"url":"https://github.com/l1ve4code/telegram-post-stealer","last_synced_at":"2025-04-07T11:36:00.683Z","repository":{"id":280870061,"uuid":"943443329","full_name":"l1ve4code/telegram-post-stealer","owner":"l1ve4code","description":"Automatically forward news messages from one Telegram group to another","archived":false,"fork":false,"pushed_at":"2025-03-05T19:06:52.000Z","size":8,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-05T19:24:43.460Z","etag":null,"topics":["python","stealer","telegram-bot"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/l1ve4code.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-03-05T18:02:09.000Z","updated_at":"2025-03-05T19:06:56.000Z","dependencies_parsed_at":"2025-03-05T19:24:45.461Z","dependency_job_id":"ab75ec37-a454-48c2-846f-52a16c1d67cb","html_url":"https://github.com/l1ve4code/telegram-post-stealer","commit_stats":null,"previous_names":["l1ve4code/telegram-post-stealer"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/l1ve4code%2Ftelegram-post-stealer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/l1ve4code%2Ftelegram-post-stealer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/l1ve4code%2Ftelegram-post-stealer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/l1ve4code%2Ftelegram-post-stealer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/l1ve4code","download_url":"https://codeload.github.com/l1ve4code/telegram-post-stealer/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247647437,"owners_count":20972869,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["python","stealer","telegram-bot"],"created_at":"2025-04-07T11:36:00.217Z","updated_at":"2025-04-07T11:36:00.676Z","avatar_url":"https://github.com/l1ve4code.png","language":"Python","readme":"# telegram-post-stealer\n\n## About\n\n- **Purpose**: Automatically forward news messages from one Telegram group to another.\n- **Key Features**:\n  - Fetches new messages from a source Telegram group.\n  - Forwards messages to a target Telegram group.\n  - Prevents duplicate forwarding using SQLite for message tracking.\n  - Handles network interruptions by periodically checking for missed messages.\n\n### Technologies\n\n* Language: **Python**\n* Libraries: **Telethon, SQLite3, asyncio**\n* Database: **SQLite**\n* Deployment: **Docker, Docker Compose**\n* API: **Telegram API**\n\n## Installing\n\n### Clone the Project\n\n```shell\ngit clone https://github.com/live4code/telegram-post-stealer.git\ncd telegram-news-forwarder\n```\n\n### Set Your Values in `docker-compose.yml`\n\nReplace the placeholders with your Telegram API credentials and group details:\n\n```yaml\nservices:\n  telegram-bot:\n    build: .\n    container_name: telegram-bot\n    network_mode: host\n    volumes:\n      - ./data:/app/data\n    environment:\n      - API_ID=YOUR_API_ID\n      - API_HASH=YOUR_API_HASH\n      - PHONE_NUMBER=YOUR_PHONE_NUMBER\n      - SOURCE_GROUP=SOURCE_GROUP_USERNAME_OR_ID\n      - TARGET_GROUP=TARGET_GROUP_USERNAME_OR_ID\n    restart: unless-stopped\n```\n\n### Replace Placeholders in the Script\n\nIf you're not using Docker, update the following variables in the script (`main.py`):\n\n```python\napi_id = 'YOUR_API_ID'\napi_hash = 'YOUR_API_HASH'\nphone_number = 'YOUR_PHONE_NUMBER'\nsource_group = 'SOURCE_GROUP_USERNAME_OR_ID'\ntarget_group = 'TARGET_GROUP_USERNAME_OR_ID'\n```\n\n## Running the Project\n\n### Using Docker Compose\n\n1. Build and start the container:\n\n   ```shell\n   docker-compose up --build\n   ```\n\n2. Stop the container:\n\n   ```shell\n   docker-compose down\n   ```\n\n### Running Locally\n\n1. Install dependencies:\n\n   ```shell\n   pip install -r requirements.txt\n   ```\n\n2. Run the script:\n\n   ```shell\n   python main.py\n   ```\n\n## How It Works\n\n1. **Fetching Messages**:\n   - The script listens for new messages in the source Telegram group using the `Telethon` library.\n   - If a new message is detected, it checks whether the message has already been forwarded using an SQLite database.\n\n2. **Forwarding Messages**:\n   - If the message is new, it forwards the message to the target group.\n   - The message ID is stored in the SQLite database to prevent duplicates.\n\n3. **Handling Network Issues**:\n   - If the connection is lost, the script periodically checks the last 10 messages in the source group and forwards any missed messages.\n\n4. **Persistent Storage**:\n   - The SQLite database (`news.db`) is stored in the `data` folder, ensuring that message IDs are preserved even after the container is restarted.\n\n## Author\n\n* Telegram: **[@live4code](https://t.me/live4code)**\n* Email: **steven.marelly@gmail.com**\n\nGood luck with your Telegram news forwarding! 🚀\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fl1ve4code%2Ftelegram-post-stealer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fl1ve4code%2Ftelegram-post-stealer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fl1ve4code%2Ftelegram-post-stealer/lists"}