NSplusthon
An asynchronous Python MTProto client library for Soroush Plus.
Maintained fork of SPlusthon, itself derived from Telethon. See NOTICE and THIRD_PARTY.md.
Features
- User Accounts & Bots: Support for user login and official bot tokens.
- FSM State Storage: Finite State Machine with
MemoryStorageand persistentSQLiteStorage. - Composable Filters: Combine event filters using Python logic (
&,|,~). - Group Moderation: Built-in flood protection, link checking, profanity filtering, and optional night-lock.
- Interactive Conversations: Linear multi-step conversation handler (
async with client.conversation(chat)). - Client Pool: Manage multiple accounts with client pooling and message broadcasting.
- Inline Keyboards & Paginator: Clean keyboard builder and paginated inline menu layout.
- Soroush Plus Detection: Link parser and entity classifier for Soroush Plus URLs, URIs, and user IDs.
Installation
pip install -U nsplusthon
Optional dependencies for fast crypto (cryptg) and proxy support:
pip install -U "nsplusthon[fast]"
PyPI may lag the git tag (Trusted Publishing — see PUBLISHING.md). Latest:
pip install -U "nsplusthon[fast] @ git+https://github.com/Amogrotex/NSplusthon.git"
Quick Start
Basic Bot Example
from nsplusthon import SoroushClient, events
from nsplusthon.sessions import StringSession
client = SoroushClient(StringSession())
@client.on(events.NewMessage(pattern=r"(?i)hello"))
async def hello_handler(event):
await event.reply("Hello!")
client.start()
client.run_until_disconnected()
Bot Token Login
client.start(bot_token="12345:abcdef")
No API ID or API hash is required.
Usage Examples
Finite State Machine (FSM)
from nsplusthon.fsm import StatesGroup, State, MemoryStorage
class Registration(StatesGroup):
name = State()
city = State()
storage = MemoryStorage()
ctx = storage.get_context(user_id=event.sender_id, chat_id=event.chat_id)
await ctx.set_state(Registration.name)
await ctx.update_data(name="Ali")
Group Guard Moderation
from nsplusthon.moderation import GroupGuard
guard = GroupGuard(
max_flood_messages=5,
max_mentions=3,
allowed_domains=["splus.ir"],
exempt_user_ids={bot_id},
)
result = guard.inspect_message(chat_id=event.chat_id, user_id=event.sender_id, text=event.text)
if result["is_violation"]:
await event.delete()
Keyboard & Pagination
from nsplusthon import Button
from nsplusthon.paginator import Paginator
paginator = Paginator(items=["Item 1", "Item 2", "Item 3"], page_size=2)
keyboard = paginator.build_keyboard(current_page=1, callback_prefix="page")
License
GPL-3.0. Copyright (C) 2026 AmoGrotex. Upstream Telethon is MIT — see NOTICE.
Metadata
Release files for NSplusthon 1.8.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| nsplusthon-1.8.2.tar.gz | 611.5 kB | Without provenance | Details for nsplusthon-1.8.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| nsplusthon-1.8.2-py3-none-any.whl | Python 3 | none | any | Details for nsplusthon-1.8.2-py3-none-any.whl |
Total release size: 1.3 MB
Release files / nsplusthon-1.8.2.tar.gz
| Download URL | nsplusthon-1.8.2.tar.gz |
|---|---|
| Size | 611.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c4c6cff7ce41a31efa2dd3b87de4391d3119f0f77fc4b203c0a1aa87e61c07d0
|
|
BLAKE2b-256 checksum How to use checksums |
0ea11c88a9a4753ba2d31132b422727cd6295f0c1325df9e22b28f5ffa0750a9
|
| 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.8.2-py3-none-any.whl
| Download URL | nsplusthon-1.8.2-py3-none-any.whl |
|---|---|
| Size | 691.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0accee5115619e4f15202e373b89113314708ab8b24dbb93bbd9a784c4501280
|
|
BLAKE2b-256 checksum How to use checksums |
0bcb6d9ed393bf941463f146326829ad2079424c9065ae64aa75509afcf4f07d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Security for NSplusthon 1.8.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.