Before you startশুরুর আগে
TMirror watches your Telegram groups and channels through a bot. Every file that matches your filter (for example PDF, EPUB, MP3) is listed on your own website, where you can search, preview and download it. Optionally, each file is also copied into a backup channel.
TMirror একটি বটের মাধ্যমে আপনার Telegram গ্রুপ ও চ্যানেল দেখে। ফিল্টারের সাথে মিলে যাওয়া প্রতিটি ফাইল (যেমন PDF, EPUB, MP3) আপনার নিজের ওয়েবসাইটে দেখা যায়, সেখানে খোঁজা, প্রিভিউ ও ডাউনলোড করা যায়। চাইলে প্রতিটি ফাইল একটি ব্যাকআপ চ্যানেলেও কপি হয়।
Files stay on Telegram. TMirror stores only a small index (names, sizes, captions) in your free Cloudflare D1 database. Downloads are streamed from Telegram through your Worker.
ফাইল Telegram-এই থাকে। TMirror আপনার ফ্রি Cloudflare D1 ডাটাবেসে শুধু একটি ছোট ইনডেক্স (নাম, সাইজ, ক্যাপশন) রাখে। ডাউনলোড Telegram থেকে আপনার Worker হয়ে আসে।
1Create the botবট তৈরি করুন
- In Telegram, open @BotFather and send
/newbot. - Send a display name (e.g. My Mirror), then a username ending in
bot(e.g. mymirror_files_bot). - BotFather replies with a token like
123456789:AAH…. Copy it. This is the bot’s password. - For groups: send
/setprivacy, pick your bot, choose Disable. (Not needed if the bot is an admin, and never needed for channels.)
- Telegram-এ @BotFather খুলে
/newbotপাঠান। - একটি নাম দিন (যেমন My Mirror), তারপর
botদিয়ে শেষ হওয়া একটি username (যেমন mymirror_files_bot)। - BotFather একটি টোকেন পাঠাবে, যেমন
123456789:AAH…। কপি করুন। এটিই বটের পাসওয়ার্ড। - গ্রুপের জন্য:
/setprivacyপাঠান, বট বাছুন, Disable চাপুন। (বট admin হলে লাগে না, চ্যানেলে কখনো লাগে না।)
Keep the token secret. Anyone with it can control your bot. If it leaks, send /revoke to BotFather and generate a new worker.js.
টোকেন গোপন রাখুন। এটি থাকলে যে কেউ আপনার বট চালাতে পারবে। ফাঁস হলে BotFather-কে /revoke পাঠান এবং নতুন worker.js তৈরি করুন।
2Choose what to mirrorকী মিরর করবেন বাছুন
Add your bot to every group or channel you want to mirror as an administrator (in a channel: Manage channel → Administrators → Add admin). It needs no special rights. Then pick a mode:
যেসব গ্রুপ বা চ্যানেল মিরর করবেন সেখানে বটকে administrator হিসেবে যোগ করুন (চ্যানেলে: Manage channel → Administrators → Add admin)। বিশেষ কোনো অনুমতি লাগবে না। তারপর একটি মোড বাছুন:
| Modeমোড | What is mirroredকী মিরর হয় | Good forকার জন্য ভালো |
|---|---|---|
| Single group/channelএকটি গ্রুপ/চ্যানেল | Exactly one chat. The website opens straight into its files.শুধু একটি চ্যাট। ওয়েবসাইট সরাসরি তার ফাইল খোলে। | A book or music channel with its own site.নিজস্ব সাইটসহ একটি বই বা গানের চ্যানেল। |
| Selected groups/channelsবাছাই করা গ্রুপ/চ্যানেল | Only the chats you pick. Other chats the bot joins show up in /admin switched off.শুধু যেগুলো বাছবেন। বট অন্য চ্যাটে যোগ হলে সেগুলো /admin-এ বন্ধ অবস্থায় দেখাবে। | Most people.বেশিরভাগ মানুষের জন্য। |
| Entire accountপুরো অ্যাকাউন্ট | Every group/channel the bot is added to, automatically. Removing the bot stops mirroring that chat.বট যেসব গ্রুপ/চ্যানেলে যোগ হয়, সব স্বয়ংক্রিয়ভাবে। বট সরালে সেই চ্যাট মিরর বন্ধ হয়। | Many chats, or chats you add often.অনেক চ্যাট, বা প্রায়ই নতুন চ্যাট যোগ করলে। |
“Entire account” means the bot’s chats. Telegram bots cannot read your personal account’s chat list, so add the bot to each chat you want included. Your backup and import channels are always skipped.
“পুরো অ্যাকাউন্ট” মানে বটের চ্যাটগুলো। Telegram বট আপনার ব্যক্তিগত অ্যাকাউন্টের চ্যাট তালিকা পড়তে পারে না, তাই যে চ্যাটগুলো চান সেখানে বট যোগ করুন। ব্যাকআপ ও ইমপোর্ট চ্যানেল সবসময় বাদ থাকে।
Finding a chat id
চ্যাট id খোঁজা
- Easiest: in the generator press Find chats my bot is in. It lists chats the bot joined in the last 24 hours.
- From a post link: long-press any post → Copy link. A link like
t.me/c/1234567890/55means id-1001234567890. Paste the link; the generator converts it. - Public chats: just use
@username.
- সবচেয়ে সহজ: জেনারেটরে বট যেসব চ্যাটে আছে খুঁজুন চাপুন। গত ২৪ ঘণ্টায় বট যেসব চ্যাটে যোগ হয়েছে তা দেখাবে।
- পোস্ট লিংক থেকে: যেকোনো পোস্টে চেপে ধরুন → Copy link।
t.me/c/1234567890/55এর মতো লিংক মানে id-1001234567890। লিংকটি দিন; জেনারেটর নিজেই রূপান্তর করবে। - পাবলিক চ্যাট: শুধু
@usernameদিন।
3File typesফাইলের ধরন
Only files whose name ends with one of your extensions are mirrored. The generator ticks pdf, epub, mobi, mp3 and mp4 for you; tick more from the groups (Books, Audio, Video, Documents, Archives, Images, Apps) or type your own. Choose Mirror every file to switch the filter off.
শুধু যেসব ফাইলের নাম আপনার দেওয়া এক্সটেনশনে শেষ হয় সেগুলো মিরর হয়। জেনারেটর আগে থেকেই pdf, epub, mobi, mp3 ও mp4 টিক দিয়ে রাখে; গ্রুপ থেকে (বই, অডিও, ভিডিও, ডকুমেন্ট, আর্কাইভ, ছবি, অ্যাপ) আরও টিক দিন বা নিজে লিখুন। ফিল্টার বন্ধ করতে সব ফাইল মিরর করুন বাছুন।
| Telegram sendsTelegram পাঠায় | Name usedযে নাম হয় | Matchesমেলে |
|---|---|---|
| File with a nameনামসহ ফাইল | Physics.PDF | pdf |
| File without a nameনামহীন ফাইল | document_55.epub (from its type)(ধরন থেকে) | epub |
| Photoছবি | photo_55.jpg | jpg |
| Musicগান | Artist - Title.mp3 | mp3 |
| Video / voiceভিডিও / ভয়েস | video_55.mp4 · voice_55.ogg | mp4 · ogg |
You can also set a minimum and maximum size in MB. Change the filter any time later in /admin → What to mirror (needs the KV binding).
MB-তে সর্বনিম্ন ও সর্বোচ্চ সাইজও দিতে পারেন। পরে যেকোনো সময় /admin → What to mirror-এ ফিল্টার বদলাতে পারবেন (KV binding লাগবে)।
4Backup & import channelsব্যাকআপ ও ইমপোর্ট চ্যানেল
Both are optional. Create each one as a new private channel (Telegram → New Channel → Private) and add your bot as admin with Post messages and Delete messages rights.
দুটোই ঐচ্ছিক। প্রতিটি একটি নতুন প্রাইভেট চ্যানেল হিসেবে বানান (Telegram → New Channel → Private) এবং বটকে Post messages ও Delete messages অনুমতিসহ admin করুন।
Backup channel
ব্যাকআপ চ্যানেল
Every matching file is copied here (no “Forwarded from” label), with the original caption and an optional 📁 Source chat line. Copies are queued: if Telegram says “slow down”, the rest are sent by the cron job a few minutes later. Copies only go out for new posts and imported old posts — edits are not copied again.
মিলে যাওয়া প্রতিটি ফাইল এখানে কপি হয় (“Forwarded from” লেখা ছাড়া), মূল ক্যাপশন ও ঐচ্ছিক 📁 উৎস চ্যাট লাইনসহ। কপিগুলো সারিতে থাকে: Telegram “ধীরে” বললে বাকিগুলো কয়েক মিনিট পরে cron দিয়ে যায়। শুধু নতুন পোস্ট ও ইমপোর্ট করা পুরোনো পোস্ট কপি হয় — এডিট আবার কপি হয় না।
Import (dump) channel
ইমপোর্ট (dump) চ্যানেল
Bots can’t read old messages. To import files posted before the bot joined, TMirror forwards each old post into this channel, reads the file details and deletes the copy straight away. Keep it empty and private; don’t use it for anything else.
বট পুরোনো মেসেজ পড়তে পারে না। বট যোগ হওয়ার আগের ফাইল আনতে TMirror প্রতিটি পুরোনো পোস্ট এই চ্যানেলে ফরোয়ার্ড করে, ফাইলের তথ্য পড়ে এবং সাথে সাথে কপি মুছে দেয়। চ্যানেলটি খালি ও প্রাইভেট রাখুন; অন্য কাজে ব্যবহার করবেন না।
5Build your worker.jsworker.js তৈরি করুন
- Open the generator. Paste your bot token and press Check bot.
- Pick a mode and your chats, then your file types.
- Optional: enter the backup and import channel ids.
- Set a site title and an admin password (at least 8 characters). Leave Public site off unless everyone may see your files.
- Press Generate worker.js, then Download.
- জেনারেটর খুলুন। বট টোকেন দিয়ে বট যাচাই করুন চাপুন।
- মোড ও চ্যাট বাছুন, তারপর ফাইলের ধরন।
- ঐচ্ছিক: ব্যাকআপ ও ইমপোর্ট চ্যানেলের id দিন।
- সাইটের নাম ও একটি admin পাসওয়ার্ড (কমপক্ষে ৮ অক্ষর) দিন। সবাইকে ফাইল দেখাতে না চাইলে পাবলিক সাইট বন্ধ রাখুন।
- worker.js তৈরি করুন, তারপর ডাউনলোড চাপুন।
Keep worker.js private. It contains your bot token and secrets. To publish your code on GitHub, tick Keep secrets out of the code (see Advanced).
worker.js গোপন রাখুন। এতে বট টোকেন ও secret আছে। কোড GitHub-এ রাখতে চাইলে কোডের বাইরে secret রাখুন টিক দিন (অ্যাডভান্সড দেখুন)।
6Deploy on CloudflareCloudflare-এ deploy করুন
- Log in to dash.cloudflare.com and open Workers & Pages → Create → Create Worker.
- Give it a name (e.g.
my-tmirror) and click Deploy. - Click Edit code. Delete everything in the editor, paste your
worker.js, and click Deploy. - Open the
…workers.devlink. You will see “Almost there” — that’s expected until the database is added in the next step.
- dash.cloudflare.com-এ লগইন করে Workers & Pages → Create → Create Worker খুলুন।
- একটি নাম দিন (যেমন
my-tmirror) এবং Deploy চাপুন। - Edit code চাপুন। এডিটরের সব মুছে আপনার
worker.jsপেস্ট করে Deploy চাপুন। …workers.devলিংক খুলুন। “Almost there” দেখাবে — পরের ধাপে ডাটাবেস যোগ না করা পর্যন্ত এটাই স্বাভাবিক।
7Database, KV & cronডাটাবেস, KV ও cron
D1 database (required)
D1 ডাটাবেস (আবশ্যক)
- Go to Storage & Databases → D1 SQL Database → Create, name it
tmirror. - Open your Worker → Settings → Bindings → Add → D1 database. Variable name:
DB, database:tmirror. Save.
- Storage & Databases → D1 SQL Database → Create-এ যান, নাম দিন
tmirror। - Worker খুলে Settings → Bindings → Add → D1 database। Variable name:
DB, database:tmirror। Save করুন।
Tables are created automatically on the first visit. No SQL needed.
প্রথমবার খুললেই টেবিল নিজে থেকে তৈরি হয়। কোনো SQL লাগবে না।
KV namespace (recommended)
KV namespace (প্রস্তাবিত)
Create one under Storage & Databases → KV and bind it as TM_KV. It lets you add more users and change the mode, filter and backup settings live from /admin.
Storage & Databases → KV-এ একটি বানিয়ে TM_KV নামে bind করুন। এতে বাড়তি ইউজার যোগ করা যায় এবং /admin থেকে মোড, ফিল্টার ও ব্যাকআপ সেটিং লাইভ বদলানো যায়।
Cron trigger (for import & backup)
Cron trigger (ইমপোর্ট ও ব্যাকআপের জন্য)
Worker → Settings → Triggers (sometimes called Trigger events) → Add → Cron trigger, enter:
Worker → Settings → Triggers (sometimes called Trigger events) → Add → Cron trigger, লিখুন:
*/2 * * * *
Every 2 minutes it imports a batch of old files and sends waiting backup copies.
প্রতি ২ মিনিটে এটি কিছু পুরোনো ফাইল ইমপোর্ট করে এবং অপেক্ষমাণ ব্যাকআপ কপি পাঠায়।
8Set the webhookWebhook সেট করুন
- Open your site and log in with the admin username and password.
- Click Admin and press Set webhook. Both dots under Bot & webhook turn green.
- Post a PDF (or any matching file) in one of your chats. Refresh the site — it appears within seconds.
- সাইট খুলে admin ইউজারনেম ও পাসওয়ার্ড দিয়ে লগইন করুন।
- Admin-এ ক্লিক করে Set webhook চাপুন। Bot & webhook-এর নিচের দুটি বিন্দু সবুজ হবে।
- কোনো চ্যাটে একটি PDF (বা মিলে যাওয়া ফাইল) পোস্ট করুন। সাইট রিফ্রেশ করুন — কয়েক সেকেন্ডেই দেখা যাবে।
That’s it — your mirror is live. In /admin you can also switch chats on/off, add users, hide files and create share links.
ব্যস — আপনার মিরর চালু। /admin-এ চ্যাট চালু/বন্ধ, ইউজার যোগ, ফাইল লুকানো ও শেয়ার লিংক তৈরি করা যায়।
9Import old filesপুরোনো ফাইল ইমপোর্ট করুন
New posts are mirrored automatically. For posts from before the bot joined (needs the import channel and the cron trigger):
নতুন পোস্ট নিজে থেকেই মিরর হয়। বট যোগ হওয়ার আগের পোস্টের জন্য (ইমপোর্ট চ্যানেল ও cron trigger লাগবে):
- In Telegram, open the newest post of the chat → Copy link. The last number is the newest message id (e.g.
…/4821). - In /admin → Groups & channels, enter it in the right box next to that chat and press Start.
- About 300 messages are checked per hour on the free plan. Press Run background jobs now to go faster.
- Telegram-এ চ্যাটের সবচেয়ে নতুন পোস্ট খুলে → Copy link। শেষ সংখ্যাটি নতুনতম মেসেজ id (যেমন
…/4821)। - /admin → Groups & channels-এ সেই চ্যাটের পাশে ডান বক্সে এটি লিখে Start চাপুন।
- ফ্রি প্ল্যানে ঘণ্টায় প্রায় ৩০০টি মেসেজ যাচাই হয়। দ্রুত করতে Run background jobs now চাপুন।
Chats with Restrict saving content turned on can’t be imported or copied — Telegram blocks forwarding there. New posts are still listed on your site.
Restrict saving content চালু থাকা চ্যাট ইমপোর্ট বা কপি করা যায় না — Telegram সেখানে ফরোয়ার্ড বন্ধ রাখে। নতুন পোস্ট তবুও সাইটে দেখা যাবে।
10Custom domainনিজের ডোমেইন
If your domain is on Cloudflare: Worker → Settings → Domains & Routes → Add → Custom domain, e.g. files.example.com. Then press Set webhook again in /admin so Telegram uses the new address. A custom domain also turns on edge caching, so popular files load faster.
ডোমেইন Cloudflare-এ থাকলে: Worker → Settings → Domains & Routes → Add → Custom domain, যেমন files.example.com। তারপর /admin-এ আবার Set webhook চাপুন যাতে Telegram নতুন ঠিকানা ব্যবহার করে। নিজের ডোমেইনে edge cache-ও চালু হয়, তাই জনপ্রিয় ফাইল দ্রুত লোড হয়।
Advanced: secrets & Wranglerঅ্যাডভান্সড: secrets ও Wrangler
Tick Keep secrets out of the code in step 5 and the generated file contains no token or password. Add them in Worker → Settings → Variables and Secrets (type Secret):
ধাপ ৫-এ কোডের বাইরে secret রাখুন টিক দিলে তৈরি ফাইলে কোনো টোকেন বা পাসওয়ার্ড থাকে না। Worker → Settings → Variables and Secrets-এ যোগ করুন (type Secret):
| Nameনাম | Valueমান |
|---|---|
BOT_TOKEN | Token from BotFatherBotFather-এর টোকেন |
WEBHOOK_SECRET | Random text (shown by the generator)র্যান্ডম লেখা (জেনারেটর দেখায়) |
LINK_SECRET | Random text (shown by the generator)র্যান্ডম লেখা (জেনারেটর দেখায়) |
ADMIN_PASS | Your admin passwordআপনার admin পাসওয়ার্ড |
ADMIN_USER, DUMP_CHAT_ID | Optional overridesঐচ্ছিক |
Prefer the command line? (Wrangler)
কমান্ড লাইন পছন্দ? (Wrangler)
npx wrangler d1 create tmirror # copy the database_id npx wrangler kv namespace create TM_KV # copy the id cp wrangler.toml.example wrangler.toml # paste both ids npx wrangler secret put BOT_TOKEN npx wrangler secret put WEBHOOK_SECRET npx wrangler secret put LINK_SECRET npx wrangler secret put ADMIN_PASS npx wrangler deploy
Updatingআপডেট
Generate a fresh worker.js here with the same answers (or copy your old CONFIG block over the new one) and paste it into the editor again. Your database, users and live settings are kept.
একই উত্তর দিয়ে এখানে নতুন worker.js তৈরি করুন (অথবা পুরোনো CONFIG অংশটি নতুনটির উপর বসান) এবং আবার এডিটরে পেস্ট করুন। ডাটাবেস, ইউজার ও লাইভ সেটিং থেকে যায়।
Problems & fixesসমস্যা ও সমাধান
New files don’t appearনতুন ফাইল দেখা যাচ্ছে না
Check /admin: the webhook dot must be green and the chat switched On. Make sure the bot is an admin there (or privacy is disabled for groups) and the file’s extension is in your filter.
/admin দেখুন: webhook বিন্দু সবুজ এবং চ্যাট On থাকতে হবে। বট সেখানে admin কিনা (বা গ্রুপে privacy বন্ধ কিনা) এবং ফাইলের এক্সটেনশন ফিল্টারে আছে কিনা দেখুন।
“Find chats” says a webhook is set“চ্যাট খুঁজুন” বলছে webhook সেট করা
Telegram only lists updates before a webhook exists. Paste chat ids or post links instead — or after deploying, use Add by chat id in /admin.
webhook থাকলে Telegram আপডেট দেখায় না। চ্যাট id বা পোস্ট লিংক দিন — অথবা deploy-এর পরে /admin-এ Add by chat id ব্যবহার করুন।
Big files open in Telegram instead of downloadingবড় ফাইল ডাউনলোড না হয়ে Telegram-এ খোলে
Telegram bots can download files up to 20 MB only. Larger files are still listed and open in Telegram for members of the chat. Use the backup channel to keep your own copy.
Telegram বট শুধু ২০ MB পর্যন্ত ফাইল ডাউনলোড করতে পারে। বড় ফাইল তালিকায় থাকে এবং চ্যাটের সদস্যদের জন্য Telegram-এ খোলে। নিজের কপি রাখতে ব্যাকআপ চ্যানেল ব্যবহার করুন।
Backup copies say “failed”ব্যাকআপ কপি “failed” দেখাচ্ছে
The bot must be admin in the backup channel with Post messages. Chats with “Restrict saving content” can’t be copied. Fix the cause, then press Retry failed in /admin.
ব্যাকআপ চ্যানেলে বটকে Post messages অনুমতিসহ admin হতে হবে। “Restrict saving content” চালু চ্যাট কপি করা যায় না। কারণ ঠিক করে /admin-এ Retry failed চাপুন।
The site says “Almost there”সাইটে “Almost there” দেখাচ্ছে
It lists what is missing: usually the D1 binding named exactly DB, or secrets if you chose “Keep secrets out of the code”.
কী নেই তা তালিকায় দেখায়: সাধারণত ঠিক DB নামের D1 binding, অথবা “কোডের বাইরে secret” বাছলে secret গুলো।
I forgot the admin passwordadmin পাসওয়ার্ড ভুলে গেছি
Add a secret ADMIN_PASS with a new password — it overrides the one in the code.
নতুন পাসওয়ার্ড দিয়ে ADMIN_PASS secret যোগ করুন — এটি কোডেরটিকে বাতিল করে।
Limitsসীমাবদ্ধতা
| Whatকী | Limitসীমা |
|---|---|
| Download through the siteসাইট দিয়ে ডাউনলোড | 20 MB per file (Telegram Bot API). Bigger files open in Telegram.ফাইলপ্রতি ২০ MB (Telegram Bot API)। বড় ফাইল Telegram-এ খোলে। |
| Cloudflare Workers FreeCloudflare Workers Free | 100,000 requests per day.দিনে ১,০০,০০০ রিকোয়েস্ট। |
| D1 FreeD1 Free | 5 GB storage — millions of file entries.৫ GB স্টোরেজ — লাখ লাখ ফাইলের তথ্য। |
| Import / backup speedইমপোর্ট / ব্যাকআপ গতি | Up to 15 messages each per cron run (every 2 min).প্রতি cron রানে (২ মিনিট) সর্বোচ্চ ১৫টি করে। |
| Forum topicsফোরাম টপিক | New files keep their topic; imported old files show under “All topics”.নতুন ফাইল টপিকসহ থাকে; ইমপোর্ট করা পুরোনো ফাইল “All topics”-এ দেখায়। |