<div align="center">
<img src="https://raw.githubusercontent.com/lyrdaadhrpyk802-ux/pyjetra/main/logo.png" width="220" alt="PyJetra Logo">
# PyJetra
**Modern Python wrapper for the Jetra Bot API — Sync & Async**
**کتابخانهی مدرن پایتون برای Jetra Bot API — همگام و ناهمگام**
[](https://pypi.org/project/pyjetra/)
[](https://pypi.org/project/pyjetra/)
[](https://pypi.org/project/pyjetra/)
[](https://github.com/lyrdaadhrpyk802-ux/pyjetra/blob/main/LICENSE)
[](https://github.com/lyrdaadhrpyk802-ux/pyjetra/stargazers)
[](https://github.com/lyrdaadhrpyk802-ux/pyjetra/issues)
[](https://jetra.ir/)
</div>
---
## About
**PyJetra** is a Python library for building [Jetra](https://jetra.ir/) bots. It wraps the **Jetra Bot API** in a clean, modern interface with full support for both synchronous and asynchronous workflows.
**PyJetra** یک کتابخانهی پایتون برای ساخت رباتهای [جترا](https://jetra.ir/) است که یک رابط تمیز و مدرن روی **Jetra Bot API** فراهم میکند و از هر دو حالت همگام و ناهمگام بهطور کامل پشتیبانی میکند.
Whether you are building a small personal bot or a large group-management system, PyJetra gives you the tools you need — without hiding the details.
---
## Install
```bash
pip install pyjetra
Requires Python 3.7+. — نیازمند پایتون ۳٫۷ به بالا.
Features
🔄 Sync & Async / همگام و ناهمگام JetraBot and AsyncJetraBot with matching APIs 🎛️ Full Bot API / پوشش کامل messages, media, edits, deletes, callbacks, webhooks 🧠 FSM / مدیریت وضعیت built-in state management for multi-step flows 🎨 Inline keyboards / دکمههای شیشهای multi-level menus, URL buttons, callbacks 🧩 Filters / فیلترها CommandFilter, TextFilter, RegexFilter 📨 Edited events / ویرایش پیام @bot.on_edited_message 📎 Full media / رسانهی کامل photo, document, video, audio, voice, sticker, animation, location, contact, venue, live photo 🌐 Webhook / وبهوک set_webhook, delete_webhook, get_webhook_info + WSGI/ASGI handlers 💬 Rich Message / تایپ کامل replies, forwards, reply_photo, reply_document, is_forwarded, mentions 🧱 Helpers / هلپرها ChatPermissions factories, User.full_name, Chat.display_name 🛡️ Safe uploads / آپلود امن 25 MB client-side check with FileTooLargeError 🔒 Clean sessions / نشست تمیز async with AsyncJetraBot(...) for leak-free bots
Quick start
from pyjetra import (
JetraBot,
CommandFilter,
InlineKeyboardMarkup,
InlineKeyboardButton,
)
bot = JetraBot("YOUR_BOT_TOKEN")
@bot.on_message(filters=[CommandFilter("start")])
def start(msg):
keyboard = InlineKeyboardMarkup([
[InlineKeyboardButton(text="Open Jetra", url="https://jetra.ir")],
[InlineKeyboardButton(text="About", callback_data="about")],
])
msg.reply("Welcome to PyJetra!", reply_markup=keyboard)
@bot.on_callback_query()
def on_button(cb):
if cb.data == "about":
cb.answer("PyJetra - Python wrapper for the Jetra Bot API")
bot.poll()
Async
import asyncio
from pyjetra import AsyncJetraBot, CommandFilter
async def main():
async with AsyncJetraBot("YOUR_BOT_TOKEN") as bot:
@bot.on_message(filters=[CommandFilter("start")])
async def start(msg):
await msg.reply("Hello from Async PyJetra!")
await bot.start_polling()
asyncio.run(main())
Webhook (FastAPI)
import os
from fastapi import FastAPI
from pyjetra import JetraBot, CommandFilter, make_asgi_handler
app = FastAPI()
bot = JetraBot(os.environ["JETRA_TOKEN"])
@bot.on_message(filters=[CommandFilter("start")])
def start(msg):
msg.reply("Hello from webhook!")
app.add_api_route(
"/webhook",
make_asgi_handler(bot, secret_token=os.environ["WEBHOOK_SECRET"]),
methods=["POST"],
)
@app.on_event("startup")
def setup():
bot.set_webhook(
url=os.environ["WEBHOOK_URL"],
secret_token=os.environ["WEBHOOK_SECRET"],
allowed_updates=["message", "edited_message", "callback_query"],
)
FSM
@bot.on_message(filters=[CommandFilter("register")])
def start_register(msg):
bot.set_state(msg.from_user.id, "waiting_for_name")
msg.reply("What's your name? / اسمت چیه؟")
@bot.on_message()
def handle_name(msg):
if bot.get_state(msg.from_user.id) == "waiting_for_name":
bot.clear_state(msg.from_user.id)
msg.reply(f"Nice to meet you, {msg.text}!")
Links
· 📦 PyPI — · 📁 GitHub — · 🐛 Issues — · 🚀 Releases — · 📖 Jetra Bot API docs — · 💬 PyJetra channel — · 👥 Community chat —
Developer
Ali VEX
Founder and lead developer of PyJetra Bot developer, Python enthusiast, Jetra community member
Ali VEX created PyJetra and maintains JetraGuard, a full-featured group-management bot built on top of it.
Platform Link 💬 Jetra profile 📢 PyJetra channel 👥 Community chat 🐙 GitHub 📧 Email 📦 PyPI
License
Released under the MIT License. See the LICENSE file for details.
Made with ❤️ for the Jetra community — ساختهشده با ❤️ برای جامعهی جترا
Metadata
Release files for pyjetra 1.7.3
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 |
|---|---|---|---|---|
| pyjetra-1.7.3.tar.gz | 61.5 kB | Without provenance | Details for pyjetra-1.7.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyjetra-1.7.3-py3-none-any.whl | Python 3 | none | any | Details for pyjetra-1.7.3-py3-none-any.whl |
Total release size: 87.1 kB
Release files / pyjetra-1.7.3.tar.gz
| Download URL | pyjetra-1.7.3.tar.gz |
|---|---|
| Size | 61.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1a8db38930d61e7e61c179a8ef50d8c3347e5fd79a8c6d705c7b100038843a7a
|
|
BLAKE2b-256 checksum How to use checksums |
b52c41e8610b0f7f627db911586c030a700fa35ed64bec66beeac0dd2da2055f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.8
|
Release files / pyjetra-1.7.3-py3-none-any.whl
| Download URL | pyjetra-1.7.3-py3-none-any.whl |
|---|---|
| Size | 25.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
05d648e5d733e0629679b16360f8f73715e49a7c4eae5ff136dc2d11d3804316
|
|
BLAKE2b-256 checksum How to use checksums |
f9202b4ded40e314f596209bb41834193e5a940e833f22050752383f09127e88
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.8
|
Security for pyjetra 1.7.3
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.