Skip to main content
NSplusthon Logo

NSplusthon

Asynchronous Python library for the Soroush Plus API

Built on Telethon and fully adapted for the Soroush Plus protocol.

PyPI Python License Stars Issues Build

Documentation • PyPI • GitHub • Soroush Plus


کتابخانه NSplusthon یک کتابخانه مدرن و قدرتمند برای Python 3.9+ است که بر پایه asyncio توسعه یافته و امکان تعامل مستقیم با API پیام‌رسان سروش پلاس را به‌عنوان کاربر یا ربات فراهم می‌کند.

این پروژه بر پایه Telethon توسعه یافته و برای معماری اختصاصی سروش پلاس بازطراحی شده است. کتابخانه از TL Schema (Layer 182)، RSA Encryption، DC Routing و WebSocket Transport پشتیبانی می‌کند و تجربه‌ای سریع، پایدار و نزدیک به کلاینت رسمی ارائه می‌دهد.

Note: لطفاً هنگام استفاده از این کتابخانه، قوانین و شرایط استفاده سروش پلاس را رعایت کنید. مسئولیت استفاده از این پروژه بر عهده کاربر است.

ویژگی‌ها

  • پشتیبانی کامل از حساب کاربری و ربات
  • مبتنی بر asyncio با کارایی بالا
  • امکان استفاده به‌صورت Sync و Async
  • پشتیبانی کامل از TL Schema اختصاصی سروش
  • مدیریت Session و StringSession
  • پشتیبانی از WebSocket
  • پشتیبانی از DC Routing
  • رمزنگاری RSA و AES
  • بدون نیاز به API ID و API Hash
  • API مشابه Telethon برای مهاجرت آسان
  • مسیر OpenSSL سریع‌تر از SPlusthon / spluspy (AES-IGE)
  • پکیج Typed (py.typed) برای Pyright / Pylance / mypy
  • Bot + filters و safe_send (FloodWait خودکار)
  • network="ir" و دانلود موازی (workers=)
  • CLI: nsplusthon login / nsplusthon doctor
  • send_png / send_video / send_gif (Soroush shows them as media, not a file)

عملکرد

بنچمارک AES-IGE روی مسیر libssl (بدون cryptg)، ۲۵۶ کیلوبایت، Intel Xeon @ 2.60GHz، Python 3.13.14، بهترینِ ۹ اجرا. خروجی با مرجع C بیت‌به‌بیت یکسان بود.

کتابخانه زمان رمز سرعت
NSplusthon 2.50 ms 100.1 MiB/s
SPlusthon 44.86 ms 5.6 MiB/s
spluspy 42.47 ms 5.9 MiB/s

NSplusthon روی این مسیر حدود ۱۸ برابر SPlusthon است (from_buffer_copy به‌جای کپی بایت‌به‌بایت).

اسکریپت: benchmarks/aes_ige_bench.py

نصب

نیاز به Python 3.9 یا بالاتر.

از PyPI:

pip install nsplusthon

سریع‌ترین نصب (cryptg + پروکسی + رسانه):

pip install "nsplusthon[fast]"

یا آخرین نسخه توسعه:

pip install git+https://github.com/Amogrotex/NSplusthon.git

شروع سریع

from nsplusthon import Bot, filters

bot = Bot("my.session", network="ir")

@bot.on_message(filters.private & filters.text)
async def ping(event):
    await event.reply("pong")

bot.run()

کلاینت کامل (مثل قبل):

from nsplusthon import SoroushClient
from nsplusthon.sessions import StringSession

client = SoroushClient(StringSession(), network="ir")
client.start()
nsplusthon doctor
nsplusthon login

نمونه

from nsplusthon import SoroushClient, events
from nsplusthon.sessions import StringSession

client = SoroushClient(StringSession())

@client.on(events.NewMessage)
async def handler(event):
    await event.reply("سلام 👋")

client.start()
client.run_until_disconnected()

ارسال پیام

client.send_message(
    "username",
    "سلام از NSplusthon ❤️"
)

ارسال فایل

client.send_file(
    "username",
    "/path/image.jpg"
)

دانلود رسانه

message = client.get_messages("username", limit=1)[0]
message.download_media()

Session ذخیره‌شده

from nsplusthon import SoroushClient
from nsplusthon.sessions import StringSession

session = "1AwA..."

with SoroushClient(StringSession(session)) as client:
    print(client.get_me())

وابستگی‌ها

  • aiohttp
  • pyaes
  • rsa

اختیاری:

  • cryptg (افزایش سرعت رمزنگاری)

مستندات

مستندات کامل پروژه:

https://Amogrotex.github.io/NSplusthon/

مجوز

این پروژه تحت مجوز GNU GPL v3 منتشر شده است.


NSplusthon is maintained by AmoGrotex

Forked from SPlusthon by Shayan Heidari — which is itself based on Telethon.

Metadata

Release files for NSplusthon 1.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for NSplusthon 1.3.1
File Size Uploaded
nsplusthon-1.3.1.tar.gz 597.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for NSplusthon 1.3.1
File Interpreter ABI Platform
nsplusthon-1.3.1-py3-none-any.whl Python 3 none any Details

Total release size: 1.3 MB

Release files / nsplusthon-1.3.1.tar.gz

Download URL nsplusthon-1.3.1.tar.gz
Size 597.6 kB
Tags Source
SHA-256 checksum
How to use checksums
ecdf7f697ab43aff5ebab6190e764b07633337c612dc8d2d4fd695b08d5a96b2
BLAKE2b-256 checksum
How to use checksums
54f402d0e6b8a1f73fe76b1bad5f4245624faac663f1953d0263d0052a56b766
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / nsplusthon-1.3.1-py3-none-any.whl

Download URL nsplusthon-1.3.1-py3-none-any.whl
Size 674.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f346baa2f1475e818dc7f3d54b951d83f9b00b2ae2c6375864f3e2e38d6c6764
BLAKE2b-256 checksum
How to use checksums
a4fe88448f5142478bbeeb2d3a53f6198ed05882f0e63fd249722771544ceb34
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release history Release notifications | RSS feed

1.8.2

2 release files

1.8.1

2 release files

1.3.5

2 release files

1.3.4

2 release files

1.3.3

2 release files

1.3.2

2 release files

This release

1.3.1 This release

2 release files

1.3.0

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.4

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page