Skip to content

zxcvresque/Arc-Link

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

10 Commits
Β 
Β 

Repository files navigation

πŸ€– ARC-LINK: AIO File Utility Bot β€” Zip πŸ—œοΈ / Unzip πŸ“¦ / Merge 🧩 / FTL πŸ”— (Buttons-First)

An all-in-one Telegram bot that auto-detects what users send (archives vs normal files) and responds using a single Session Panel (buttons-first, minimal chat spam).

βœ… πŸ—œοΈ Zip (auto-split for Telegram limits)
βœ… πŸ“¦ Unzip (single / multi-part / multiple archives)
βœ… 🧩 Merge (extract β†’ combine β†’ re-zip)
βœ… πŸ” Password support (extract protected archives + add/remove password on output)
βœ… πŸ”— FTL (File-To-Link: direct download + stream links)
βœ… πŸ” Authorization + DM-only access control
βœ… πŸ“Š Stats (queue count, usage, disk space)
βœ… πŸ› οΈ Admin Panel (live stats + auth/logs management)
βœ… 🧾 Logs Channel (file/job lifecycle logs)


πŸ” Authorization & Access Control (DM-only)

This bot is designed to work only in private chat (DM).

βœ… Who can use the bot?

A user is allowed if either:

  • πŸ‘₯ They are a member of the Main Group (MAIN_GROUP_ID in .env)
    (the bot checks membership via getChatMember β€” the bot must be in that group)
    OR
  • βœ… They are added to the bot’s Authorization List (managed by admins)

🚫 Who is blocked?

  • Any chat that is not DM (groups/channels): bot replies with a short β€œDM me” notice
  • Any user who is not in Main Group and not in Authorization List

πŸ› οΈ Who manages access?

Admins (from ADMIN_IDS) can manage everything via πŸ› οΈ Admin Panel:

  • Add/Remove users from Authorization List
  • Change Main Group ID (runtime)
  • Configure Logs Channel (runtime)

✨ Key UX: Session Panel (One Message, Always Updated)

Instead of spamming messages, the bot:

  • creates one panel message
  • edits it as files arrive
  • finalizes when either:
    • user taps βœ… Done sending, OR
    • an inactivity window (e.g. 2–3s) expires
  • then shows the correct buttons based on what was detected
🧾 Session Panel Detailed Examples (click to expand)

🧾 Session Panel β€” Textual UI Examples (Emojis)

Below are mock panels showing how the bot’s single edited Session Panel message can look in each scenario.
Buttons are represented as [πŸ”˜ Button].


🟦 0) Collecting phase (live updates while user is sending)

🧾 Session Panel

πŸ“₯ Receiving files…
πŸ“¦ Archives: 0   πŸ“„ Files: 3
πŸ“Š Total size: 842 MB
⏳ Waiting for more… (auto-finish in 2s)

Buttons:
[βœ… Done sending] [🧾 List] [❌ Cancel]


πŸ“¦ 1) Single archive detected (1 file)

🧾 Session Panel

πŸ“¦ Archive detected: pack.zip
πŸ“Š Size: 1.6 GB   |   πŸ”’ Password: Unknown

What do you want to do?

Buttons:
[πŸ“‚ Unzip] [🧾 List contents] [🎯 Extract selected]
[πŸ” Password] [βš™οΈ Settings] [❌ Cancel]


πŸ”’ 2) Protected archive β†’ bot asks for password

🧾 Session Panel

πŸ”’ Protected archive detected: protected.zip
❗ Password required to extract.

Send the password now (as a message), or cancel.

Buttons:
[πŸ” Enter password] [❌ Cancel]

βœ… After user sends password:

🧾 Session Panel

πŸ” Password received (session only)
πŸ“¦ Extracting… 37%

Buttons:
[❌ Cancel]


πŸ”“ 3) After extracting protected archive β†’ remove/add password & send

🧾 Session Panel

βœ… Extracted successfully: protected.zip
πŸ” Password used: Yes (session)

What next?

Buttons:
[βœ… Send extracted files]
[πŸ”“ Remove password & send] [πŸ” Add password & send]
[❌ Cancel]


πŸ“¦πŸ“¦ 4) Multiple archives detected β†’ choose handling mode

🧾 Session Panel

πŸ“¦ 4 archives detected
πŸ“Š Total size: 5.8 GB

🧠 Detected pattern: 🧩 Parts of one archive (High confidence)
Choose how to proceed:

Buttons:
[🧩 Parts Mode Unzip] [πŸ“¦ Separate Unzip]
[🧩 Merge β†’ Rezip] [🧾 List] [❌ Cancel]


🧩 5) Parts Mode chosen β†’ missing part check

βœ… All parts present:

🧾 Session Panel

🧩 Parts Mode selected
πŸ”Ž Checking parts…

βœ… Found: 12/12 parts
Proceed to extract?

Buttons:
[πŸ“‚ Unzip now] [🧾 List contents] [❌ Cancel]

⚠️ Missing parts detected:

🧾 Session Panel

🧩 Parts Mode selected
πŸ”Ž Checking parts…

⚠️ Missing parts detected
Found: 10/12 parts

Continue anyway (may fail) or cancel?

Buttons:
[⚠️ Force unzip] [❌ Cancel]


πŸ“„ 6) Non-archives detected β†’ choose FTL or Zip

🧾 Session Panel

πŸ“„ 7 files detected (non-archive)
πŸ“Š Total size: 1.2 GB

Choose a mode:

Buttons:
[πŸ”— Get Links (FTL)] [πŸ—œ Make Archive]
[🧾 List] [❌ Cancel]


πŸ”— 7) FTL chosen β†’ pick link type + paging

🧾 Session Panel

πŸ”— FTL mode selected
πŸ“„ Files: 7

Choose link type:

Buttons:
[🎬 Stream links] [⬇️ Direct links] [πŸ“‹ Copy all] [❌ Cancel]

After generating (paged):

🧾 Session Panel

βœ… Links ready (Page 1/2)
1) file1.mp4   🎬 Stream | ⬇️ Direct
2) file2.mp4   🎬 Stream | ⬇️ Direct
3) file3.mp4   🎬 Stream | ⬇️ Direct

Buttons:
[⏭ Next page] [πŸ“‹ Copy all] [❌ Cancel]


πŸ—œ 8) Zip chosen β†’ choose format, part size, password

🧾 Session Panel

πŸ—œ Zip mode selected
πŸ“„ Files: 12
πŸ“Š Total size: 6.4 GB

Choose archive format:

Buttons:
[πŸ—œ ZIP] [🧊 7Z] [⬅️ Back] [❌ Cancel]

Next:

🧾 Session Panel

πŸ“¦ Choose part size (Telegram-safe):

Buttons:
[1900MiB βœ… Recommended] [1024MiB] [Custom ✍️] [⬅️ Back] [❌ Cancel]

Optional password:

🧾 Session Panel

πŸ” Add password to output archive?
(If you skip, archive will be unprotected.)

Buttons:
[πŸ” Add password] [πŸ”“ Skip] [⬅️ Back] [❌ Cancel]

After starting:

🧾 Session Panel

πŸ—œ Creating archive… 41%
πŸ“¦ Output will be split into parts if needed.

Buttons:
[❌ Cancel]


🧠 Smart Detection (Auto + Override)

The bot classifies the current batch into:

  • πŸ“¦ Archives only
  • πŸ“„ Non-archives only
  • 🧩 Mixed (archives + non-archives)

If multiple archives exist, it also tries to detect:

  • 🧩 Parts Mode (split archive parts like .001, .part1.rar, .z01, etc.)
  • πŸ“¦ Separate Archives (independent archives)

If detection is unsure, user can override via buttons:

  • Treat as Parts
  • Treat as Separate
  • Mixed options

🧰 Features

πŸ—œοΈ Zip

  • βœ… Collect many files into one archive
  • βœ… Auto-split output into multiple parts (Telegram-safe)
  • βœ… Choose output: ZIP / 7Z (optional)
  • βœ… Choose part size: 1900MiB / 1024MiB / Custom
  • βœ… Rename output via buttons or /zipname
  • βœ… Optional: πŸ” Add password to output archive
  • βœ… Cleanup after completion

πŸ“¦ Unzip

  • βœ… Unzip a single archive
  • βœ… Unzip multi-part / split archives (Parts Mode)
  • βœ… Unzip many independent archives (Separate Mode)
  • βœ… List contents before extract 🧾
  • βœ… Extract selected files 🎯

πŸ” Password Support (Extraction + Output)

  • βœ… Protected archive detection
  • βœ… If protected, bot prompts: πŸ” β€œSend password”
  • βœ… Password remembered per session only
  • βœ… After extraction, user can optionally:
    • πŸ”“ Remove password & send (rezip unencrypted)
    • πŸ” Add password & send (rezip encrypted)

🧩 Merge / Re-Zip

For multiple archives in a batch:

  • βœ… extract all β†’ combine β†’ re-zip into one archive
  • βœ… choose output format + part size
  • βœ… optional password on final output

πŸ”— FTL (File-To-Link)

  • βœ… Generate direct download + stream links for sent files
  • βœ… Paging for many files (avoids FloodWait spam)
  • βœ… πŸ“‹ Copy all links

πŸ” Authorization System

  • βœ… DM-only usage (no group usage)
  • βœ… Allow access if user is in Main Group OR in Authorization List
  • βœ… Admin-managed Authorization List (add/remove)
  • βœ… Admin can change Main Group ID at runtime

πŸ“Š Stats

  • βœ… Shows queue count (how many jobs waiting/running β€” not full job details)
  • βœ… Shows usage totals (jobs processed, unique users, uptime)
  • βœ… Shows free disk space (+ optional memory/CPU)
  • βœ… Admin version includes β€œwho is currently using the bot”

πŸ› οΈ Admin Panel

  • βœ… Live stats: connected users, active sessions, queue counts
  • βœ… Manage Authorization List (add/remove users)
  • βœ… Change Main Group ID (runtime)
  • βœ… Configure Logs Channel (runtime)
  • βœ… Enable/Disable logs + choose what to log

🧾 Logs System (Logs Channel)

  • βœ… Sends file/job lifecycle logs to a logs channel
  • βœ… Configurable via .env and changeable via Admin Panel
  • βœ… Useful for moderation, debugging, and auditing usage

πŸ“Œ Commands (Minimal β€” Buttons First)

Most users can operate fully via buttons. Commands are mainly entry points.

🧾 General (Users)

  • /start β€” show help + current session panel
  • /help β€” quick usage
  • /commands β€” list all commands
  • /cancel β€” cancel current job/session
  • /stats β€” show bot stats (queue count, usage, free disk)

πŸ—œοΈ Zip

  • /add β€” start collecting files for zipping
  • /zip <name> β€” create archive now (optional if using buttons)
  • /zipname <name> β€” set default archive name for session
  • /zipclear β€” clear collected files

πŸ“¦ Unzip / πŸ”— FTL (Optional entry points)

  • /unzip β€” show unzip actions for current batch (optional)
  • /ftl β€” show link generation actions (optional)

πŸ› οΈ Admin (Admins only)

  • /admin β€” open Admin Panel
  • /logs β€” quick toggle or logs preview (optional; can also live inside Admin Panel)

πŸ–ΌοΈ Extras (Optional)

  • /addthumb β€” set thumbnail (reply to a photo)
  • /delthumb β€” remove thumbnail
  • /mode β€” upload mode (Document / Video etc.)

πŸ“Š Stats Output (Example)

User /stats

πŸ“Š ARC-LINK Stats
🧾 Queue: 3 (waiting: 2, running: 1)
πŸ‘₯ Unique users: 148
βœ… Jobs processed: 1,920
⏱ Uptime: 2d 04h

πŸ’Ύ Disk free: 37.4 GB

Admin /admin β†’ Stats

πŸ“Š Admin Stats
🧾 Queue: 3 (waiting: 2, running: 1)
🟒 Active sessions: 2
πŸ‘₯ Connected users: 148

πŸ‘€ Currently using bot:
- @user1 (unzipping)
- @user2 (zipping)

πŸ› οΈ Admin Panel (Buttons UI Example)

πŸ› οΈ Admin Panel β€” ARC-LINK

πŸ“Š Queue: 3 (2 waiting / 1 running)
🟒 Active sessions: 2
πŸ‘₯ Connected users: 148
πŸ’Ύ Disk free: 37.4 GB
🧾 Logs: βœ… Enabled  |  Channel: -1001234567890
πŸ‘₯ Main Group: -1009876543210

Buttons:
[πŸ“Š Stats] [πŸ‘₯ Authorization] [πŸ‘₯ Main Group]
[🧾 Logs] [πŸ“£ Set Logs Channel] [βš™οΈ Settings]
[❌ Close]

πŸ‘₯ Authorization submenu

πŸ‘₯ Authorization

βœ… Allowed via Main Group: -1009876543210
βœ… Additional allowed users: 23

Send a user ID / @username to add/remove.

Buttons:
[βž• Add user] [βž– Remove user] [🧾 View list] [⬅️ Back]

🧾 Logs submenu

🧾 Logs

Status: βœ… Enabled
Channel: -1001234567890

Choose what to log:

Buttons:
[βœ… File added] [βœ… Job started] [βœ… Job finished] [⚠️ Errors]
[πŸ“£ Set channel] [πŸ›‘ Disable logs] [⬅️ Back]


🧾 Logs Channel (What gets logged)

When enabled, the bot sends logs like:

🧾 LOG β€’ Job Completed βœ…
πŸ‘€ User: @username (123456789)
🧩 Mode: Merge β†’ Rezip
πŸ“¦ Inputs: 3 archives (5.8 GB)
πŸ—œ Output: merged.part001.zip … merged.part003.zip
⏱ Time: 03m 42s
πŸ—“ 2025-12-17 13:02:11

Suggested events to log:

  • πŸ“₯ File added (name/size/type)
  • ▢️ Job started (mode/settings)
  • βœ… Job completed (outputs/parts)
  • ❌ Job failed (error summary)
  • πŸ”— Links generated (count)

🧭 Workflows (Buttons-Only)

Note: All workflows require DM + Authorization.

1) πŸ“¦ User sends 1 archive

Bot shows:

  • πŸ“‚ Unzip
  • 🧾 List contents
  • 🎯 Extract selected
  • πŸ” Password (add/remove / prompt)
  • βš™οΈ Settings
  • ❌ Cancel

2) πŸ“¦ User sends multiple archives

Bot asks:

  • 🧩 Parts Mode Unzip (treat as one split archive)
  • πŸ“¦ Separate Unzip (each archive independently)
  • 🧩 Merge β†’ Rezip
  • 🧾 List
  • ❌ Cancel

3) πŸ“„ User sends non-archive files

Bot asks:

  • πŸ”— Get Links (FTL)
  • πŸ—œοΈ Make Archive
  • 🧾 Show list
  • ❌ Cancel

4) 🧩 User sends mixed files

Bot asks:

  • πŸ“¦ Archive actions
  • πŸ”— Links for non-archives
  • πŸ—œοΈ Zip everything together
  • 🧾 Show list
  • ❌ Cancel

πŸ—ΊοΈ Mermaid β€” Authorization Gate + Core Flow

flowchart TD
  A["πŸ‘€ User sends message"] --> B{"πŸ’¬ DM chat?"}
  B -->|"No 🚫"| B1["🚫 Reply: Please DM me to use ARC-LINK"]
  B -->|"Yes βœ…"| C{"πŸ” Authorized?"}

  C -->|"No 🚫"| C1["🚫 Access denied<br/>Join Main Group or request access"]
  C -->|"Yes βœ…"| D["🧾 Session Panel created/updated"]

  D --> E{"⏳ Inactivity window<br/>or βœ… Done sending?"}
  E -->|"βœ… Done / Timer ends"| F["πŸ”Ž Analyze batch"]

  F --> G{"πŸ“¦ Archives only?"}
  F --> H{"πŸ“„ Non-archives only?"}
  F --> I{"🧩 Mixed batch?"}

  %% Archives only
  G --> J{"πŸ“¦ How many archives?"}
  J -->|"1️⃣ One"| K["πŸ“¦ Single Archive Menu<br/>πŸ“‚ Unzip Β· 🧾 List Β· 🎯 Extract selected<br/>πŸ” Password Β· βš™οΈ Settings Β· ❌ Cancel"]
  J -->|"2️⃣+ Many"| L["πŸ“¦ Multi-Archive Menu<br/>🧩 Parts Mode Β· πŸ“¦ Separate Unzip<br/>🧩 Merge β†’ Rezip Β· 🧾 List Β· ❌ Cancel"]

  %% Non-archives only
  H --> M["πŸ“„ Non-Archive Menu<br/>πŸ”— Get Links (FTL) Β· πŸ—œ Make Archive<br/>🧾 List Β· ❌ Cancel"]

  %% Mixed
  I --> N["🧩 Mixed Menu<br/>πŸ“¦ Archive actions Β· πŸ”— Links for non-archives<br/>πŸ—œ Zip everything Β· 🧾 List Β· ❌ Cancel"]

  %% Password extraction flow (applies to archive menus)
  K --> O{"πŸ”’ Protected archive?"}
  L --> O
  O -->|"Yes πŸ”"| P["πŸ” Ask user for password<br/>Store per session only"]
  P --> Q["πŸ“¦ Retry extraction"]
  O -->|"No βœ…"| R["πŸ“€ Upload extracted files"]

  %% Remove password & send (optional after successful extraction)
  R --> S{"πŸ”“ Remove password & send?"}
  S -->|"Yes"| T["πŸ—œ Rezip without password<br/>Send new archive split if needed"]
  S -->|"No"| U["βœ… Done"]

  %% Zip flow (split uploads) from non-archive or mixed menus
  M --> V{"πŸ—œ Make Archive chosen?"}
  N --> V
  V --> W["βš™οΈ Choose format + part size<br/>ZIP/7Z Β· 1900MiB/Custom"]

  %% Add password to output archive (optional during zip settings)
  W --> X{"πŸ” Add password to archive?"}
  X -->|"Yes"| Y["πŸ” Ask password input<br/>Encrypt output archive"]
  X -->|"No"| Z["πŸ”“ No encryption"]

  W --> AA["πŸ—œ Create archive"]
  AA --> AB["πŸ“€ Send parts<br/>part001 Β· part002 Β· ... βœ…"]

  %% FTL flow from non-archive or mixed menus
  M --> AC{"πŸ”— FTL chosen?"}
  N --> AC
  AC --> AD["πŸ”— Generate Stream + Direct links<br/>πŸ“‹ Copy All / Paging"]
Loading

βš™οΈ Configuration (.env)

# Telegram
BOT_TOKEN=123:ABC
API_ID=123456
API_HASH=abcdef1234567890

# Access control
MAIN_GROUP_ID=-1009876543210
ADMIN_IDS=123456789,987654321

# Logs
LOGS_CHANNEL_ID=-1001234567890
LOGS_ENABLED=true

# Storage (example)
DB_PATH=./data/bot.db
DOWNLOAD_DIR=./downloads

Admin Panel can change Main Group ID and Logs Channel ID at runtime (persist in DB).


βœ… Developer Notes (Implementation Targets)

  • Primary UX = one Session Panel message edited throughout a session
  • Authorization gate runs before creating/using Session Panel
  • Membership check uses getChatMember(MAIN_GROUP_ID, user_id) (bot must be in group)
  • Store Authorization List + runtime config in SQLite/JSON (persist across restarts)
  • /stats shows queue counts, not verbose per-job status
  • Admin Panel shows β€œwho is using bot” + lets admins manage auth/logs
  • Logs are optional but strongly recommended for debugging + auditing

About

Build Phase 1A.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors