{"id":50843149,"url":"https://github.com/GeiserX/telegram-delay-channel-cloner","last_synced_at":"2026-07-01T18:01:10.838Z","repository":{"id":249377336,"uuid":"831164410","full_name":"GeiserX/telegram-delay-channel-cloner","owner":"GeiserX","description":"Telegram bot that relays messages between channels with configurable delay and batch processing","archived":false,"fork":false,"pushed_at":"2026-05-20T11:54:36.000Z","size":62,"stargazers_count":3,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-05-20T16:08:56.403Z","etag":null,"topics":["automation","batch-processing","bot","channel","content","docker","docker-compose","hacktoberfest","homelab","media","message-forwarding","open-source","python","repost","scheduler","self-hosted","sqlite","telegram","telegram-bot","telegram-channel"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/GeiserX.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null},"funding":{"github":"geiserx","patreon":"geiser","buy_me_a_coffee":"geiser","thanks_dev":"u/gh/geiserx"}},"created_at":"2024-07-19T20:19:17.000Z","updated_at":"2026-05-20T11:54:41.000Z","dependencies_parsed_at":"2024-07-20T11:12:00.227Z","dependency_job_id":null,"html_url":"https://github.com/GeiserX/telegram-delay-channel-cloner","commit_stats":null,"previous_names":["geiserx/telegram-delay-channel-cloner"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/GeiserX/telegram-delay-channel-cloner","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GeiserX%2Ftelegram-delay-channel-cloner","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GeiserX%2Ftelegram-delay-channel-cloner/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GeiserX%2Ftelegram-delay-channel-cloner/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GeiserX%2Ftelegram-delay-channel-cloner/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GeiserX","download_url":"https://codeload.github.com/GeiserX/telegram-delay-channel-cloner/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GeiserX%2Ftelegram-delay-channel-cloner/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35017091,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-01T02:00:05.325Z","response_time":130,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["automation","batch-processing","bot","channel","content","docker","docker-compose","hacktoberfest","homelab","media","message-forwarding","open-source","python","repost","scheduler","self-hosted","sqlite","telegram","telegram-bot","telegram-channel"],"created_at":"2026-06-14T08:00:22.751Z","updated_at":"2026-07-01T18:01:10.830Z","avatar_url":"https://github.com/GeiserX.png","language":"Python","funding_links":["https://github.com/sponsors/geiserx","https://patreon.com/geiser","https://buymeacoffee.com/geiser","https://thanks.dev/u/gh/geiserx"],"categories":["Bots"],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"docs/images/banner.svg\" alt=\"telegram-delay-channel-cloner banner\" width=\"900\"/\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/GeiserX/telegram-delay-channel-cloner/actions\"\u003e\u003cimg src=\"https://img.shields.io/github/actions/workflow/status/GeiserX/telegram-delay-channel-cloner/docker-publish.yml?style=flat-square\u0026logo=github\u0026label=build\" alt=\"Build Status\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://hub.docker.com/r/drumsergio/telegram-delay-channel-cloner\"\u003e\u003cimg src=\"https://img.shields.io/docker/pulls/drumsergio/telegram-delay-channel-cloner?style=flat-square\u0026logo=docker\u0026label=pulls\" alt=\"Docker Pulls\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/GeiserX/telegram-delay-channel-cloner/blob/main/LICENSE\"\u003e\u003cimg src=\"https://img.shields.io/github/license/GeiserX/telegram-delay-channel-cloner?style=flat-square\" alt=\"License\"\u003e\u003c/a\u003e\n  \u003cimg src=\"https://img.shields.io/badge/python-3.12-blue?style=flat-square\u0026logo=python\u0026logoColor=white\" alt=\"Python 3.12\"\u003e\n  \u003ca href=\"https://codecov.io/gh/GeiserX/telegram-delay-channel-cloner\"\u003e\u003cimg src=\"https://codecov.io/gh/GeiserX/telegram-delay-channel-cloner/graph/badge.svg\" alt=\"codecov\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n---\n\nA lightweight Telegram bot that relays messages from a source channel to a target channel after a configurable delay. Messages that are deleted or edited before the delay expires are handled gracefully -- deleted messages are never forwarded, and edits are picked up automatically. State is persisted in SQLite so nothing is lost across restarts.\n\n## Features\n\n- **Configurable delay** -- set any delay in seconds between receiving and forwarding a message.\n- **Copy or forward** -- choose between copying (no \"Forwarded from\" header) or native forwarding.\n- **Batch processing** -- processes messages in configurable batch sizes to handle bursts efficiently.\n- **Deleted message handling** -- messages deleted from the source channel before the delay elapses are silently skipped.\n- **Edited message handling** -- if a message is edited before being sent, the updated version is forwarded.\n- **Retention cleanup** -- a daily job purges old database records after a configurable retention period.\n- **SQLite persistence** -- all message state is stored on disk, surviving container restarts.\n- **Lightweight** -- runs on `python:3.12-alpine` with minimal dependencies.\n\n## Quick Start\n\n### 1. Create a Telegram Bot\n\n1. Open a conversation with [@BotFather](https://t.me/BotFather) on Telegram.\n2. Send `/newbot` and follow the prompts to obtain your **Bot Token**.\n3. Add the bot as an **administrator** to both the source and target channels.\n\n### 2. Get Channel IDs\n\nThe easiest way is to forward a message from each channel to [@userinfobot](https://t.me/userinfobot) or use the Telegram API. Channel IDs are typically negative numbers (e.g., `-1001234567890`).\n\n### 3. Deploy with Docker Compose\n\nCreate a `docker-compose.yml` file:\n\n```yaml\nservices:\n  channel-delay-cloner:\n    image: drumsergio/telegram-delay-channel-cloner:0.0.1\n    environment:\n      BOT_TOKEN: \"\u003cyour-bot-token\u003e\"\n      SOURCE_CHANNEL: \"\u003csource-channel-id\u003e\"\n      TARGET_CHANNEL: \"\u003ctarget-channel-id\u003e\"\n      DELAY: 3600        # 1 hour\n      POLLING: 30         # check every 30 seconds\n    volumes:\n      - messages_db:/data\n    restart: unless-stopped\n\nvolumes:\n  messages_db:\n```\n\nThen start it:\n\n```bash\ndocker compose up -d\n```\n\n## Environment Variables\n\n| Variable           | Description                                                        | Default            | Required |\n|--------------------|--------------------------------------------------------------------|--------------------|----------|\n| `BOT_TOKEN`        | Telegram Bot API token from BotFather                              | --                 | Yes      |\n| `SOURCE_CHANNEL`   | Chat ID of the source channel                                      | --                 | Yes      |\n| `TARGET_CHANNEL`   | Chat ID of the target channel                                      | --                 | Yes      |\n| `DELAY`            | Delay in **seconds** before forwarding a message                   | `10`               | Yes      |\n| `POLLING`          | Interval in **seconds** between batch processing runs              | `5`                | No       |\n| `COPY_MESSAGE`     | `True` to copy (no forward header), `False` to forward natively    | `True`             | No       |\n| `DB_LOCATION`      | Path to the SQLite database file inside the container              | `/data/messages.db`| No       |\n| `RETENTION_PERIOD` | Number of **days** to keep processed message records               | `7`                | No       |\n| `BATCH_SIZE`       | Maximum number of messages to process per polling cycle            | `10`               | No       |\n\n## How It Works\n\n```\nSource Channel                          Target Channel\n     |                                       ^\n     |  new message                          |  copy/forward\n     v                                       |\n  [Bot receives message]                     |\n     |                                       |\n     +--\u003e SQLite: store message_id     ------+\n          with forward_time = now + DELAY\n                    |\n                    v\n          [Polling job every N seconds]\n          Selects messages where forward_time \u003c= now\n          Forwards batch, removes from DB\n```\n\n1. The bot listens for new posts in the source channel.\n2. Each message is stored in SQLite with a `forward_time` set to `now + DELAY`.\n3. A repeating job runs every `POLLING` seconds, selects messages whose delay has elapsed, and forwards them in batches of `BATCH_SIZE`.\n4. If a message was deleted from the source before the delay expires, the Telegram API returns an error and the message is silently removed from the database.\n5. A daily cleanup job at midnight removes records older than `RETENTION_PERIOD` days.\n\n## Troubleshooting\n\n| Symptom | Likely Cause | Fix |\n|---------|-------------|-----|\n| Bot does not forward anything | Bot is not an admin in both channels | Add the bot as administrator to source and target channels |\n| `message_id_invalid` errors | Message was deleted from source before delay elapsed | Expected behavior -- the bot skips deleted messages automatically |\n| Messages forwarded instantly | `DELAY` is set too low | Increase `DELAY` to the desired number of seconds |\n| Database locked errors | Multiple instances writing to the same volume | Ensure only one container instance runs against each database file |\n| Bot crashes on startup | Missing required environment variables | Verify `BOT_TOKEN`, `SOURCE_CHANNEL`, `TARGET_CHANNEL`, and `DELAY` are set |\n\n## Building from Source\n\n```bash\ngit clone https://github.com/GeiserX/telegram-delay-channel-cloner.git\ncd telegram-delay-channel-cloner\ndocker build -t telegram-delay-channel-cloner .\n```\n\n## Maintainers\n\n- [@GeiserX](https://github.com/GeiserX)\n\n## Contributing\n\nContributions are welcome. [Open an issue](https://github.com/GeiserX/telegram-delay-channel-cloner/issues/new) or submit a pull request.\n\nThis project follows the [Contributor Covenant](http://contributor-covenant.org/version/2/1/) Code of Conduct.\n\n\n## Related Projects\n\n| Project | Description |\n|---------|-------------|\n| [Telegram-Archive](https://github.com/GeiserX/Telegram-Archive) | Automated, incremental Telegram backups with a local web viewer |\n| [telegram-slskd-local-bot](https://github.com/GeiserX/telegram-slskd-local-bot) | Automated music discovery and download via Telegram bot with Soulseek |\n| [paperless-telegram-bot](https://github.com/GeiserX/paperless-telegram-bot) | Manage Paperless-NGX documents entirely through Telegram |\n| [AskePub](https://github.com/GeiserX/AskePub) | Telegram bot for ePub annotation with GPT-4 |\n| [jellyfin-telegram-channel-sync](https://github.com/GeiserX/jellyfin-telegram-channel-sync) | Sync Jellyfin access with Telegram channel membership |\n| [telegram-archive-mcp](https://github.com/GeiserX/telegram-archive-mcp) | MCP Server for Telegram-Archive |\n| [n8n-nodes-telegram-archive](https://github.com/GeiserX/n8n-nodes-telegram-archive) | n8n community node for Telegram-Archive |\n\n## License\n\n[MIT](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FGeiserX%2Ftelegram-delay-channel-cloner","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FGeiserX%2Ftelegram-delay-channel-cloner","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FGeiserX%2Ftelegram-delay-channel-cloner/lists"}