Skip to content

About

BotTelegram For EylandooPanel

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

🤖 EylanPanel Bot

ربات مدیریت تلگرامیِ EylanPanel — یک بات، یک نقش، بدون Webhook Telegram management bot for EylanPanel — one bot, one role, no webhook needed

Python aiogram SQLite Bilingual

فارسی · English


🇮🇷 فارسی

ربات تلگرامی مدیریت EylanPanel — یک بات، یک نقش. هر نصب از این بات به یک کلید API از پنل وصل می‌شه (ادمین اصلی یا یک نماینده‌ی مشخص) و بر همون اساس منوها و دسترسی‌هاش رو نشون می‌ده.

ساخته‌شده با aiogram 3 — بدون نیاز به دیتابیس سنگین (فقط SQLite برای تنظیمات محلی خود بات)، و بدون نیاز به Webhook (polling ساده).

📋 فهرست

🚀 نصب یک‌خطی

روی هر سرور اوبونتو/دبیانی که Python 3.10+ داره، این رو اجرا کن:

curl -fsSL -o eylanpanelbot.sh https://raw.githubusercontent.com/eylandoo/eylanpanel-bot/main/eylanpanelbot.sh && bash eylanpanelbot.sh

اسکریپت به‌صورت تعاملی همه‌چیز رو می‌پرسه: توکن بات (از @BotFather)، آدرس پنل، کلید API پنل، و آیدی عددی تلگرام مالک بات. بعدش خودش:

  • ✅ پایتون/pip لازم رو نصب می‌کنه
  • ✅ یک virtualenv مجزا می‌سازه
  • ✅ بات رو به‌عنوان یک سرویس systemd (eylanpanelbot.service) بالا میاره تا با ری‌بوت سرور هم خودش بیاد بالا

اجرای دوباره‌ی همین دستور روی یک نصب موجود، منوی مدیریت رو باز می‌کنه (آپدیت کد، تغییر پنل/کلید/توکن، حذف کامل و…) — لازم نیست چیزی رو دستی پاک کنی.

🔄 آپدیت کردن

هر وقت نسخه‌ی جدیدی از این ریپو منتشر شد، کافیه همون دستور بالا رو دوباره اجرا کنی و از منو گزینه‌ی «۲) آپدیت کد بات (تنظیمات و دیتابیس دست‌نخورده می‌مونه)» رو بزنی. تنظیمات (.env) و دیتابیس محلی بات (bot.db) هیچ‌وقت توسط آپدیت لمس نمی‌شن.

🏗️ معماری: یک بات = یک نقش

این بات با یک کلید API پنل بالا میاد. نقشش رو خودِ پنل بر اساس همون کلید تعیین می‌کنه:

کلید API متعلق به چیزی که مالک بات (OWNER_TELEGRAM_ID) می‌بینه
👑 ادمین اصلی پنل همه‌ی منوها: کاربران، نمایندگان، سفارشات، نودها، زیرساخت، تنظیمات
🧑‍💼 یک نماینده (Sub-Admin) خاص فقط کاربران خودش، سفارشات خودش، و تنظیماتی که در چهارچوب مجاز خودش هست

هر کسی غیر از OWNER_TELEGRAM_ID که به بات پیام بده، خودکار در نقش مشتری قرار می‌گیره (خرید اکانت، مشاهده‌ی اکانت‌های خودش، تمدید، پشتیبانی) — نیازی به تنظیم جدا نیست.

اگه یک نماینده می‌خواد بات اختصاصی خودش رو داشته باشه، همین نصب‌کننده رو روی سرور خودش اجرا می‌کنه، توکن بات خودش رو می‌سازه، و کلید API نماینده‌ی خودش (از پنل، بخش API Keys) رو بهش می‌ده.

📖 راهنمای کامل منوها

👑 منوی ادمین اصلی

دکمه کاربرد
👥 مدیریت کاربران لیست/جست‌وجوی کاربران، جزئیات هر کاربر، ریست ترافیک، لینک ساب، اطلاعات اتصال (فایل‌های واقعی OpenVPN/WireGuard + لینک‌های sing-box)، مدیریت دستگاه‌ها (HWID)، لغو لینک، ویرایش (سقف کلاینت، حجم، انقضا، یادداشت)، پروتکل‌ها و دسترسی‌ها، نودهای مجاز، حذف کاربر
🧑‍💼 نمایندگان لیست نمایندگان، افزودن نماینده‌ی جدید (ویزارد چندمرحله‌ای)، ریست مصرف، ویرایش کیف‌پول/سقف کاربر/پروتکل‌ها/سرورها، تغییر حالت تخصیص، قیمت هر گیگ و ارز، انقضا، حذف نماینده
📋 سفارشات لیست سفارش‌های در انتظار/تاییدشده/ردشده با صفحه‌بندی، تایید سفارش (ساخت خودکار کاربر روی پنل)، رد سفارش
🖥️ نودها لیست نودها، افزودن نود جدید (نام، IP، پسورد SSH)، ویرایش، حذف
🛠 زیرساخت WireGuard، sing-box، پورت‌های OpenVPN، وضعیت پنل، تغییر کلید IPsec
⚙️ تنظیمات شماره کارت برای پرداخت دستی، پلن‌ها (افزودن/ویرایش قیمت، روز، حجم، سقف کلاینت، پروتکل‌ها، نودهای مجاز پلن، حذف)
🌐 زبان تغییر بین فارسی/انگلیسی
🔄 شروع مجدد پاک‌کردن هر مرحله‌ی نیمه‌کاره و بازگشت به منوی اصلی

🧑‍💼 منوی نماینده (Sub-Admin)

نسخه‌ی محدودشده‌ی منوی ادمین — فقط مدیریت کاربران (محدود به کاربران خودش)، سفارشات (محدود به سفارش‌های خودش)، تنظیمات و زبان / شروع مجدد. نماینده هیچ‌وقت کاربران/سفارش‌های نماینده‌های دیگه یا بخش نودها/زیرساخت رو نمی‌بینه.

🛒 منوی مشتری

دکمه کاربرد
🛒 خرید اکانت جدید انتخاب پلن از لیست فعال، آپلود رسید پرداخت، ثبت سفارش برای تایید ادمین
📂 اکانت‌های من لیست اکانت‌های خریداری‌شده، مشاهده‌ی لینک ساب هر اکانت
🔄 تمدید انتخاب اکانت فعلی → پلن جدید → آپلود رسید → ثبت سفارش تمدید
🎫 پشتیبانی پیام مستقیم به مالک بات؛ هر ریپلای مالک خودکار برای مشتری فوروارد می‌شه
🌐 زبان / 🔄 شروع مجدد مثل بالا

⚙️ پیکربندی (.env)

نصب‌کننده این فایل رو خودش تعاملی می‌سازه؛ اگه خواستی دستی بسازی، از روی .env.example کپی کن:

متغیر توضیح
BOT_TOKEN توکن بات از @BotFather
PANEL_URL آدرس کامل پنل، مثل https://panel.example.com:8090
PANEL_API_KEY کلید API — یا کلید ادمین اصلی، یا کلید یک نماینده‌ی خاص
OWNER_TELEGRAM_ID آیدی عددی تلگرام کسی که باید منوی ادمین/نماینده رو ببینه
DEFAULT_LANG زبان پیش‌فرض برای کاربر تازه (fa یا en)
DB_PATH مسیر فایل دیتابیس SQLite محلی بات

🔒 امنیت

  • فایل .env و bot.db هیچ‌وقت نباید کامیت بشن — هر دو در .gitignore هستن.
  • PANEL_API_KEY معادل رمز عبور کامل به همون بخشی از پنله که بهش تعلق داره؛ اگه یک نماینده بات مخصوص خودش رو راه می‌ندازه، فقط کلید API خودش رو بهش بده، نه کلید ادمین اصلی.


🇬🇧 English

The Telegram management bot for EylanPanel — one bot, one role. Each deployment connects to the panel with a single API key (either the main admin's or one specific reseller's), and the bot's menus and permissions follow directly from that key.

Built on aiogram 3 — no heavy database (just SQLite for the bot's own local settings), and no webhook required (plain long-polling).

📋 Table of Contents

🚀 One-Line Install

On any Ubuntu/Debian server with Python 3.10+, run:

curl -fsSL -o eylanpanelbot.sh https://raw.githubusercontent.com/eylandoo/eylanpanel-bot/main/eylanpanelbot.sh && bash eylanpanelbot.sh

The script asks everything it needs interactively: your bot token (from @BotFather), the panel's address, the panel API key, and the owner's numeric Telegram ID. It then:

  • ✅ Installs Python/pip if missing
  • ✅ Creates an isolated virtualenv
  • ✅ Brings the bot up as a systemd service (eylanpanelbot.service) so it survives a server reboot

Running the same command again on an existing install opens a management menu instead (update the code, change the panel/key/token, uninstall completely, and more) — nothing needs to be removed by hand first.

🔄 Updating

Whenever a new version of this repo is published, just run the same command above again and pick "2) Update bot code (settings and database stay untouched)" from the menu. Your .env settings and the bot's local database (bot.db) are never touched by an update.

🏗️ Architecture: One Bot, One Role

The bot starts up with a single panel API key, and the panel itself decides its role based on that key:

The API key belongs to What the bot owner (OWNER_TELEGRAM_ID) sees
👑 The panel's main admin Every menu: users, resellers, orders, nodes, infrastructure, settings
🧑‍💼 One specific reseller (sub-admin) Only their own users, their own orders, and settings within their own allowed scope

Anyone other than OWNER_TELEGRAM_ID who messages the bot is automatically treated as a customer (buy an account, view their own accounts, renew, contact support) — no separate configuration needed.

If a reseller wants their own dedicated bot, they simply run this same installer on their own server, create their own bot token, and use their own reseller API key (from the panel's API Keys section) instead of the main admin's.

📖 Full Menu Guide

👑 Main Admin Menu

Button What it does
👥 Manage Users List/search users, per-user details, reset traffic, subscription link, connection info (real OpenVPN/WireGuard config files + sing-box links), device (HWID) management, revoke link, edit (client cap, data limit, expiry, note), protocols & access, allowed nodes, delete user
🧑‍💼 Resellers List resellers, add a new one (multi-step wizard), reset usage, edit wallet/user cap/protocols/servers, switch allocation mode, price per GB and currency, expiry, delete reseller
📋 Orders Paginated list of pending/approved/rejected orders, approve (auto-creates the user on the panel), reject
🖥️ Nodes List nodes, add a new one (name, IP, SSH password), edit, delete
🛠 Infrastructure WireGuard, sing-box, OpenVPN ports, panel status, rotate IPsec key
⚙️ Settings Card number for manual payments, plans (add/edit price, days, data, client cap, protocols, plan's allowed nodes, delete)
🌐 Language Switch between Persian/English
🔄 Restart Clear any half-finished step and return to the main menu

🧑‍💼 Reseller (Sub-Admin) Menu

A scoped-down version of the admin menu — only Manage Users (limited to their own), Orders (limited to their own), Settings, and Language / Restart. A reseller never sees other resellers' users/orders, or the Nodes/Infrastructure sections.

🛒 Customer Menu

Button What it does
🛒 Buy New Account Pick a plan from the active list, upload a payment receipt, submit for admin approval
📂 My Accounts List of purchased accounts, view each one's subscription link
🔄 Renew Pick an existing account → new plan → upload receipt → submit renewal order
🎫 Support Message the bot owner directly; any reply from the owner is auto-forwarded back to that customer
🌐 Language / 🔄 Restart Same as above

⚙️ Configuration (.env)

The installer builds this file interactively. To create it by hand, copy .env.example:

Variable Description
BOT_TOKEN Bot token from @BotFather
PANEL_URL Full panel address, e.g. https://panel.example.com:8090
PANEL_API_KEY API key — either the main admin's or one specific reseller's
OWNER_TELEGRAM_ID The numeric Telegram ID that should see the admin/reseller menu
DEFAULT_LANG Default language for a new user (fa or en)
DB_PATH Path to the bot's local SQLite database file

🔒 Security

  • .env and bot.db must never be committed — both are already in .gitignore.
  • PANEL_API_KEY is equivalent to a full password to whichever part of the panel it belongs to. If a reseller runs their own bot, give them only their own API key — never the main admin's.

About

BotTelegram For EylandooPanel

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages