Skip to content

About

سلف بات تلگرام به زبان فارسی / Persian Telegram self-bot

Topics

Resources

Stars

13 stars

Watchers

1 watching

Forks

Latest commit

 

History

27 Commits

Folders and files

Repository files navigation

🤖 Telegram Self-Bot — Multi-Account Web Panel

A powerful multi-account Telegram self-bot with a beautiful Hono web dashboard, granular role-based access, channel mirroring, live bio clock, in-panel chat viewer, and a rich set of Persian/English commands.

Ported from the original MadelineProto (PHP) script — original authors: SjD, Mr Swift, SylvanasWindruner.


✨ Features

🧑‍🤝‍🧑 Multi-account Unlimited Telegram accounts in one process
🔐 2-role auth admin (full access) · signer (can only add & log in accounts they created)
💬 Web chat viewer Browse dialogs, read history, send messages — directly from the panel
📡 Channel mirror Forward messages from a source chat to any number of destinations, filtered per media type (text / image / video / voice / audio / document / sticker / gif)
🕒 Bio clock Live Tehran time + date written to your Telegram bio every minute
⚙️ Custom prefix Per-account command prefix ($ by default)
🎭 Auto actions typing · echo · mark-read · poker auto-reply
💬 Auto-answer map Keyword → response dictionary
🚫 Enemy list Auto-profane reply + block for chosen users
👤 Profile editor Change first name, last name, bio, username
📤 URL uploader Fetch and re-upload a remote file (up to 50 MB)
🔥 Fun commands fosh, dost, rel, zan, namal, madar, tofang, bk, gharyb, lisyab, car, …
🔁 Self-pinger Optional keep-alive ping for free hosts (Render, Replit, etc.)

🧱 Tech Stack

  • TypeScript (strict, Node 18+)
  • teleproto — MTProto client (fork of GramJS)
  • Mongoose — MongoDB ODM
  • Hono — ultra-light web framework
  • Node.js 18+ / bun 1.4+

🚀 Quick Start

1. Prerequisites

2. Install

git clone <your-repo-url>
cd telegram-selfbot
npm install / bun install

3. Configure

Create a .env file (or export the variables):

# ── Telegram ─────────────────────────────────
API_ID=123456
API_HASH=your_api_hash_here

# ── Mongo ────────────────────────────────────
MONGO_URI=mongodb://127.0.0.1:27017/telegram_selfbot

# ── Server ───────────────────────────────────
PORT=3000
SESSION_SECRET=change-me-to-a-long-random-string

# ── Dashboard users ──────────────────────────
DASH_USER=admin
DASH_PASS=admin-password
DASH_USER2=signer
DASH_PASS2=signer-password

# ── Optional SOCKS5 proxy ────────────────────
PROXY=false
PROXY_SERVER=127.0.0.1
PROXY_PORT=12334

4. Run

npm start / bun run start
# or in development:
npm run dev / bun dev

Open the panel at http://localhost:3000 and log in with DASH_USER / DASH_PASS.


🔧 Environment Variables

Variable Required Default Description
API_ID ✅ — Telegram API ID
API_HASH ✅ — Telegram API hash
MONGO_URI ✅ mongodb://127.0.0.1:27017/telegram_selfbot Mongo connection string
PORT ❌ 3000 HTTP port
SESSION_SECRET ⚠️ random HMAC key for panel cookies — set this in production
DASH_USER / DASH_PASS ❌ admin / admin Admin login
DASH_USER2 / DASH_PASS2 ❌ signer / signer Signer login
PROXY ❌ false Enable SOCKS5 proxy
PROXY_SERVER / PROXY_PORT ❌ 127.0.0.1 / 12334 Proxy address

👥 Dashboard Roles

Role Can do
admin Everything: view all accounts, start / stop / delete, edit state, use chat viewer, run commands via panel
signer Add new accounts and complete the login (code + 2FA) — only for accounts they created. Cannot start/stop or view others' accounts

Session cookie is HMAC-signed (sb_session) and lives 7 days.


📜 Bot Commands

All commands are sent to your own account (Saved Messages or any chat) and are prefixed with the current prefix ($ by default). The account owner is the only one whose messages are treated as commands.

⚙️ Control

Command Description
$bot on|off Enable / disable auto actions
$online on|off Fake online status (keeps pinging UpdateStatus)
$typing on|off Show "typing…" in every incoming chat
$echo on|off Echo messages back
$markread on|off Auto mark as read
$poker on|off Reply 😐🖕🏿 to 😐
$ping / $پینگ Health check
$setprefix <1-3 chars> Change command prefix

📡 Channel mirror

Command Description
$pushSource <srcId> Add a source chat
$pullSource <srcId> Remove a source
$pushDest <src> <dst> Add destination for source
$pullDest <src> <dst> Remove a destination
$clearDests <src> Remove all destinations of a source
$sender / $senders List the whole mirror map
$options <src> Show per-media-type filters
$pushOption <src> <kind> Enable a media type for a source
$pullOption <src> <kind> Disable a media type for a source
$setOptions <src> text,image,… Wholesale set filters

Kinds: text image video voice audio document sticker gif

💬 Auto-answer

Command Description
$setanswer keyword|reply Add to the answer map
$delanswer keyword Remove from map
$answerlist List all answers

🚫 Enemy list

Command Description
$setenemy (reply to user) Add + block user, auto-profane
$delenemy (reply to user) Remove + unblock
$enemylist List enemies

👤 Profile

Command Description
$setfirstname <name> Update first name
$setlastname <name> Update last name
$setbio <text> Update bio
$setusername <username> Change username

🕒 Bio clock

Command Description
$timebio on Enable the live Tehran time/date bio
$timebio off Disable and restore original bio
$timebio refresh Re-read current bio as the new base
$timebio status Show current state

🛠️ Misc

Command Description
$upload <url> Fetch a URL and upload the file (≤ 50 MB)
$flood <n> <text> Send N copies in one message
$flood2 <n> <text> Send N separate messages
$save (reply) Forward a message to your Saved Messages
$id Show group / user ID (reply for user ID)
$info <user> Basic profile info
$gpinfo Group details (inside a group)
$sessions List active Telegram sessions
$j <@channel> Join a channel
$clean answers|enemylist|sender Wipe a section

🎉 Fun

$fosh · $fosh2 · $dost · $rel · $zan · $namal · $namal2 · $madar · $tofang · $bk · $gharyb · $lisyab · $car · $time / $ساعت / $تایم

📅 Persian date

  • $تاریخ شمسی — Jalali date/time
  • $تاریخ میلادی — Gregorian date/time

💻 Web Panel Highlights

  • Multi-account table — live status, prefix, admin Telegram ID
  • Add account — enter phone → Telegram sends SMS code
  • Code / 2FA — enter inline; on success the bot auto-starts
  • Start / Stop / Delete buttons per account
  • State viewer — raw JSON of the Mongo state doc
  • Chats viewer
    • Filter by user / group / channel
    • Search by title, id, or @username
    • Click a chat → message history (last 50, oldest → newest)
    • Inline send with Ctrl+Enter
    • Auto-refreshes every 8 s while a chat is open
  • Command console — send any $command as if from your Telegram account

🐛 Troubleshooting

Symptom Fix
AUTH_KEY_UNREGISTERED Delete the account, re-add, and log in again
PHONE_CODE_INVALID Check the code — it can also be a Telegram-in-app code, not SMS
SESSION_PASSWORD_NEEDED 2FA is enabled — enter the password in the 2FA prompt
CHAT_FORWARDS_RESTRICTED on a channel The mirror source channel has forwarding disabled
FLOOD_WAIT_X Telegram rate-limits — wait X seconds; set smaller limit in the panel
Panel returns 401 Cookie expired — log out, log back in
Signer can't see an account They only see accounts they created; admin sees all
$answerlist always "empty" Fixed in this version — use the updated BotRuntime

🔐 Security Notes

  • The panel must run behind HTTPS in production (or a reverse proxy like Cloudflare / nginx).
  • Set a strong SESSION_SECRET — otherwise cookies reset every restart and are forgeable.
  • Telegram sessions are stored in Mongo in plaintext. Restrict DB access.
  • Never share your API_HASH, DASH_PASS, or SESSION_SECRET.
  • The default admin/admin credentials are insecure — change them.

⚠️ Disclaimer

This project is for educational and personal use only. Using self-bots (user accounts automated via MTProto) may violate Telegram's Terms of Service and can result in account restrictions or bans. The authors and contributors are not responsible for any bans, data loss, or legal consequences arising from the use of this software. Do not use it to spam, harass, or break the law. Obey Telegram's ToS and your local laws.


🙏 Credits

Role Name
Original MadelineProto (PHP) author SjD
Ports & improvements Mr Swift, SylvanasWindruner
TypeScript / teleproto port + web panel this repository

📄 License

MIT — see LICENSE.

About

سلف بات تلگرام به زبان فارسی / Persian Telegram self-bot

Topics

Resources

Stars

13 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages