pysroosh
Python client for Sroosh, built on Telethon (MTProto).
Install
pip install pysroosh
Optional extras:
pip install pysroosh[redis]
pip install pysroosh[postgres]
Quick start
from pysroosh import Client
bot = Client("my_session")
@bot.on_message()
async def handler(client, message):
await message.reply("Hello!")
bot.run()
Sync usage
from pysroosh.sync import Client
bot = Client("my_session")
@bot.on_message()
def handler(client, message):
message.reply("Hello!")
bot.run()
Events
on_messageon_editedon_callback_queryon_inline_queryon_chat_actionon_user_updateon_message_deletedon_message_readon_error
Filters
from pysroosh import filters
@bot.on_message(filters.text & filters.private)
@bot.on_message(filters.command("start"))
@bot.on_message(filters.photo | filters.video)
Buttons
from pysroosh import Button
keyboard = Button.build_inline([
Button.inline("Option 1", b"opt1"),
Button.inline("Option 2", b"opt2"),
])
await bot.send_message(chat_id, "Choose:", buttons=keyboard)
FSM
from pysroosh.fsm import State, StateMachine
from pysroosh.storage import MemoryStorage
storage = MemoryStorage()
fsm = StateMachine(storage)
class Form:
name = State()
age = State()
Scheduler
from pysroosh.scheduler import MessageScheduler
scheduler = MessageScheduler(bot)
scheduler.schedule_interval("hourly", chat_id, "Hello!", interval=3600)
Admin
await bot.admin.ban_user(chat_id, user_id)
await bot.admin.mute_user(chat_id, user_id)
await bot.admin.purge_messages(chat_id, limit=100)
AFK
bot.afk.set_afk(True, reason="lunch")
@bot.on_message(filters.private & filters.incoming)
async def auto_reply(client, message):
await bot.afk.handle(message)
Mirror
from pysroosh.mirror import MessageMirror
mirror = MessageMirror(bot)
mirror.add_route(source=-100123, targets=[-100456], add_prefix="[Mirror]")
await mirror.start()
CLI
pysroosh run bot.py
pysroosh validate bot.py
pysroosh version
pysroosh session-info my_session.session
Notes
This library uses Telethon as its transport, connecting with the public
Sroosh api_id/api_hash by default (documented by the SrooshJS project).
You may pass your own credentials to Client(session, api_id=..., api_hash=...).
Metadata
Release files for pysroosh 2.0.0
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 |
|---|---|---|---|---|
| pysroosh-2.0.0.tar.gz | 15.6 kB | Without provenance | Details for pysroosh-2.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pysroosh-2.0.0-py3-none-any.whl | Python 3 | none | any | Details for pysroosh-2.0.0-py3-none-any.whl |
Total release size: 33.0 kB
Release files / pysroosh-2.0.0.tar.gz
| Download URL | pysroosh-2.0.0.tar.gz |
|---|---|
| Size | 15.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fb71fa0e025fa62f273f820f25b38e0924f2c44c1978dbb2b2dca7ddf40862fe
|
|
BLAKE2b-256 checksum How to use checksums |
723f4f0760663d422c8528f984b9cb1f13076623eeabd43157d4c94bc7725d9e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.6
|
Release files / pysroosh-2.0.0-py3-none-any.whl
| Download URL | pysroosh-2.0.0-py3-none-any.whl |
|---|---|
| Size | 17.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
31b3b287880a8fb40e35e0bc9d68797e4e75483dd4676f5d976798b40b0832be
|
|
BLAKE2b-256 checksum How to use checksums |
e5ef3ad2cfc04cd8c1271e0ace841094aaf83c378a123bd16d32d175baba7a67
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.6
|
Security for pysroosh 2.0.0
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.