All apps · 0 apps
telegram-delay-channel-cloner
Docker app from geiserx's Repository
Overview
Requires a Telegram bot token and the bot must be admin in both source and target channels.
More info: https://github.com/GeiserX/telegram-delay-channel-cloner
Readme
View on GitHub
A 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.
Features
- Configurable delay -- set any delay in seconds between receiving and forwarding a message.
- Copy or forward -- choose between copying (no "Forwarded from" header) or native forwarding.
- Batch processing -- processes messages in configurable batch sizes to handle bursts efficiently.
- Deleted message handling -- messages deleted from the source channel before the delay elapses are silently skipped.
- Edited message handling -- if a message is edited before being sent, the updated version is forwarded.
- Retention cleanup -- a daily job purges old database records after a configurable retention period.
- SQLite persistence -- all message state is stored on disk, surviving container restarts.
- Lightweight -- runs on
python:3.12-alpinewith minimal dependencies.
Quick Start
1. Create a Telegram Bot
- Open a conversation with @BotFather on Telegram.
- Send
/newbotand follow the prompts to obtain your Bot Token. - Add the bot as an administrator to both the source and target channels.
2. Get Channel IDs
The easiest way is to forward a message from each channel to @userinfobot or use the Telegram API. Channel IDs are typically negative numbers (e.g., -1001234567890).
3. Deploy with Docker Compose
Create a docker-compose.yml file:
services:
channel-delay-cloner:
image: drumsergio/telegram-delay-channel-cloner:0.0.1
environment:
BOT_TOKEN: "<your-bot-token>"
SOURCE_CHANNEL: "<source-channel-id>"
TARGET_CHANNEL: "<target-channel-id>"
DELAY: 3600 # 1 hour
POLLING: 30 # check every 30 seconds
volumes:
- messages_db:/data
restart: unless-stopped
volumes:
messages_db:
Then start it:
docker compose up -d
Environment Variables
| Variable | Description | Default | Required |
|---|---|---|---|
BOT_TOKEN |
Telegram Bot API token from BotFather | -- | Yes |
SOURCE_CHANNEL |
Chat ID of the source channel | -- | Yes |
TARGET_CHANNEL |
Chat ID of the target channel | -- | Yes |
DELAY |
Delay in seconds before forwarding a message | 10 |
Yes |
POLLING |
Interval in seconds between batch processing runs | 5 |
No |
COPY_MESSAGE |
True to copy (no forward header), False to forward natively |
True |
No |
DB_LOCATION |
Path to the SQLite database file inside the container | /data/messages.db |
No |
RETENTION_PERIOD |
Number of days to keep processed message records | 7 |
No |
BATCH_SIZE |
Maximum number of messages to process per polling cycle | 10 |
No |
How It Works
Source Channel Target Channel
| ^
| new message | copy/forward
v |
[Bot receives message] |
| |
+--> SQLite: store message_id ------+
with forward_time = now + DELAY
|
v
[Polling job every N seconds]
Selects messages where forward_time <= now
Forwards batch, removes from DB
- The bot listens for new posts in the source channel.
- Each message is stored in SQLite with a
forward_timeset tonow + DELAY. - A repeating job runs every
POLLINGseconds, selects messages whose delay has elapsed, and forwards them in batches ofBATCH_SIZE. - 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.
- A daily cleanup job at midnight removes records older than
RETENTION_PERIODdays.
Troubleshooting
| Symptom | Likely Cause | Fix |
|---|---|---|
| Bot does not forward anything | Bot is not an admin in both channels | Add the bot as administrator to source and target channels |
message_id_invalid errors |
Message was deleted from source before delay elapsed | Expected behavior -- the bot skips deleted messages automatically |
| Messages forwarded instantly | DELAY is set too low |
Increase DELAY to the desired number of seconds |
| Database locked errors | Multiple instances writing to the same volume | Ensure only one container instance runs against each database file |
| Bot crashes on startup | Missing required environment variables | Verify BOT_TOKEN, SOURCE_CHANNEL, TARGET_CHANNEL, and DELAY are set |
Building from Source
git clone https://github.com/GeiserX/telegram-delay-channel-cloner.git
cd telegram-delay-channel-cloner
docker build -t telegram-delay-channel-cloner .
Maintainers
Contributing
Contributions are welcome. Open an issue or submit a pull request.
This project follows the Contributor Covenant Code of Conduct.
Related Projects
| Project | Description |
|---|---|
| Telegram-Archive | Automated, incremental Telegram backups with a local web viewer |
| telegram-slskd-local-bot | Automated music discovery and download via Telegram bot with Soulseek |
| paperless-telegram-bot | Manage Paperless-NGX documents entirely through Telegram |
| AskePub | Telegram bot for ePub annotation with GPT-4 |
| jellyfin-telegram-channel-sync | Sync Jellyfin access with Telegram channel membership |
| telegram-archive-mcp | MCP Server for Telegram-Archive |
| n8n-nodes-telegram-archive | n8n community node for Telegram-Archive |
License
Install telegram-delay-channel-cloner on Unraid in a few clicks.
Find telegram-delay-channel-cloner in Community Apps on your Unraid server, review the template, and click Install. Unraid handles the Docker app or plugin setup from the published template.
Categories
Download Statistics
Related apps
Explore more like this
Explore allDetails
drumsergio/telegram-delay-channel-cloner:latestRuntime arguments
- Network
bridge- Privileged
- false
Template configuration
SQLite database for message persistence
- Target
- /data
- Default
- /mnt/user/appdata/telegram-delay-channel-cloner
Telegram bot API token from @BotFather
- Target
- BOT_TOKEN
Source channel ID (numeric, e.g. -1001234567890)
- Target
- SOURCE_CHANNEL
Target channel ID (numeric, e.g. -1001234567890)
- Target
- TARGET_CHANNEL
Delay in seconds before relaying messages
- Target
- DELAY
- Default
- 10
True = copy message, False = forward message
- Target
- COPY_MESSAGE
- Default
- True
Messages to process per cycle
- Target
- BATCH_SIZE
- Default
- 10
Days to keep message records in database
- Target
- RETENTION_PERIOD
- Default
- 7