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_photo / send_video / send_gif — path or http(s) link

عملکرد

بنچمارک 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 ❤️"
)

ارسال فایل / لینک تصویر و ویدیو

await bot.send_photo(chat, "/path/image.jpg")
await bot.send_photo(chat, "https://example.com/pic.png")
await bot.send_video(chat, "https://example.com/clip.mp4")
await bot.send_gif(chat, "https://example.com/anim.gif")

دانلود رسانه

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.2

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.2
File Size Uploaded
nsplusthon-1.3.2.tar.gz 598.4 kB Details

Built distribution (wheel)

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

Total release size: 1.3 MB

Release files / nsplusthon-1.3.2.tar.gz

Download URL nsplusthon-1.3.2.tar.gz
Size 598.4 kB
Tags Source
SHA-256 checksum
How to use checksums
5c0d01253f2c2624bc5d1cbc69f3e269835762ba7dff8cf01142b8004e9c04db
BLAKE2b-256 checksum
How to use checksums
7a88f7c14a03a3852ec3d420967a0159e03e378e4105b506a6ef013f74563983
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.2-py3-none-any.whl

Download URL nsplusthon-1.3.2-py3-none-any.whl
Size 676.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4186cf4173135d8ff61ea51ab886bddaf887ce71719ce9da3cf58664dee64fd9
BLAKE2b-256 checksum
How to use checksums
f2f3d78ead2a93cffc16db6dc4242f574e49306c6226ef91c540e3d2ca946e7a
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

This release

1.3.2 This release

2 release files

1.3.1

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