shadism 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- shadism-1.0.0/LICENSE +21 -0
- shadism-1.0.0/MANIFEST.in +6 -0
- shadism-1.0.0/PKG-INFO +165 -0
- shadism-1.0.0/README.md +132 -0
- shadism-1.0.0/duck.html +1841 -0
- shadism-1.0.0/pyproject.toml +66 -0
- shadism-1.0.0/requirements.txt +4 -0
- shadism-1.0.0/setup.cfg +4 -0
- shadism-1.0.0/setup.py +3 -0
- shadism-1.0.0/shadism/__init__.py +10 -0
- shadism-1.0.0/shadism/client.py +326 -0
- shadism-1.0.0/shadism/crypto.py +228 -0
- shadism-1.0.0/shadism/dispatcher.py +176 -0
- shadism-1.0.0/shadism/filters.py +250 -0
- shadism-1.0.0/shadism/methods.py +817 -0
- shadism-1.0.0/shadism/network.py +354 -0
- shadism-1.0.0/shadism/py.typed +0 -0
- shadism-1.0.0/shadism/session.py +61 -0
- shadism-1.0.0/shadism/types/__init__.py +5 -0
- shadism-1.0.0/shadism/types/chat.py +253 -0
- shadism-1.0.0/shadism/types/message.py +138 -0
- shadism-1.0.0/shadism/types/user.py +34 -0
- shadism-1.0.0/shadism.egg-info/PKG-INFO +165 -0
- shadism-1.0.0/shadism.egg-info/SOURCES.txt +25 -0
- shadism-1.0.0/shadism.egg-info/dependency_links.txt +1 -0
- shadism-1.0.0/shadism.egg-info/requires.txt +4 -0
- shadism-1.0.0/shadism.egg-info/top_level.txt +1 -0
shadism-1.0.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 AmirAli khosravinejad
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
shadism-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: shadism
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Ultra-high-performance async UserBot library for the Shad messenger web protocol
|
|
5
|
+
Author-email: AmirAli khosravinejad <khosravinejad.amirali@gmail.com>
|
|
6
|
+
Maintainer-email: AmirAli khosravinejad <khosravinejad.amirali@gmail.com>
|
|
7
|
+
License-Expression: MIT
|
|
8
|
+
Project-URL: Homepage, https://shadism.spark-js.ir
|
|
9
|
+
Project-URL: Documentation, https://shadism.spark-js.ir
|
|
10
|
+
Project-URL: Bale Channel, https://ble.ir/join/8jXbafMPwL
|
|
11
|
+
Project-URL: Repository, https://github.com/AmirAli-khosravinejad/shadism
|
|
12
|
+
Project-URL: Issues, https://github.com/AmirAli-khosravinejad/shadism/issues
|
|
13
|
+
Keywords: shad,messenger,userbot,async,asyncio,chat,bot
|
|
14
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
+
Classifier: Topic :: Communications :: Chat
|
|
21
|
+
Classifier: Topic :: Internet
|
|
22
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
23
|
+
Classifier: Framework :: AsyncIO
|
|
24
|
+
Classifier: Typing :: Typed
|
|
25
|
+
Requires-Python: >=3.11
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
License-File: LICENSE
|
|
28
|
+
Requires-Dist: httpx>=0.27.0
|
|
29
|
+
Requires-Dist: h2>=4.0.0
|
|
30
|
+
Requires-Dist: cryptography>=42.0.0
|
|
31
|
+
Requires-Dist: Pillow>=10.0.0
|
|
32
|
+
Dynamic: license-file
|
|
33
|
+
|
|
34
|
+
# shadism (شادیسم) ⚡
|
|
35
|
+
|
|
36
|
+
[](https://pypi.org/project/shadism/)
|
|
37
|
+
[](https://pypi.org/project/shadism/)
|
|
38
|
+
[](LICENSE)
|
|
39
|
+
[](https://shadism.spark-js.ir)
|
|
40
|
+
[](https://ble.ir/join/8jXbafMPwL)
|
|
41
|
+
|
|
42
|
+
**shadism** is an ultra-high-performance, modern, and fully asynchronous Python SDK and UserBot framework for the **Shad** messenger protocol.
|
|
43
|
+
|
|
44
|
+
Designed from the ground up with native `asyncio`, client-side end-to-end encryption (AES-256-CBC + RSA), rich object-oriented models, and declarative message filtering.
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## 👨💻 Developer & Community
|
|
49
|
+
|
|
50
|
+
- **Author**: AmirAli khosravinejad
|
|
51
|
+
- **Email**: [khosravinejad.amirali@gmail.com](mailto:khosravinejad.amirali@gmail.com)
|
|
52
|
+
- **Official Documentation**: [https://shadism.spark-js.ir](https://shadism.spark-js.ir)
|
|
53
|
+
- **GitHub Repository**: [https://github.com/AmirAli-khosravinejad/shadism](https://github.com/AmirAli-khosravinejad/shadism)
|
|
54
|
+
- **Official Announcement Channel (Bale)**: [https://ble.ir/join/8jXbafMPwL](https://ble.ir/join/8jXbafMPwL)
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## 🚀 Key Features
|
|
59
|
+
|
|
60
|
+
- **⚡ 100% Asynchronous**: Built entirely on `asyncio` and `httpx` with HTTP/2 support.
|
|
61
|
+
- **🔐 End-to-End Encryption**: Automated key generation, passphrases, AES-CBC payload encryption, and RSA authentication.
|
|
62
|
+
- **🎯 Declarative Filters**: Chainable event filters (`filters.command`, `filters.regex`, `filters.group`, `filters.private`, `&`, `|`, `~`).
|
|
63
|
+
- **📜 Smart Chat History**: `get_chat_history()` with automatic batch pagination, deduplication, and update fallback.
|
|
64
|
+
- **📁 Automated Media Streaming**: Chunked file upload (`UploadFile.ashx`) and automatic photo thumbnail generation.
|
|
65
|
+
- **🎙️ Voice Chat (WebRTC)**: Group and channel voice chat creation, joining, speaking activity control, and participants management.
|
|
66
|
+
- **🧩 Rich OOP Models**: Direct interaction with `Message`, `Chat`, and `User` objects (`await msg.reply()`, `await msg.delete()`, `await chat.send_message()`).
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## 📦 Installation
|
|
71
|
+
|
|
72
|
+
All dependencies (`httpx`, `h2`, `cryptography`, `Pillow`) are automatically installed:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
pip install shadism
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
## ⚡ Quickstart
|
|
81
|
+
|
|
82
|
+
### 1. Simple Echo / Ping Bot
|
|
83
|
+
|
|
84
|
+
```python
|
|
85
|
+
import asyncio
|
|
86
|
+
from shadism import Client, filters
|
|
87
|
+
|
|
88
|
+
bot = Client("0937xxxxxxx")
|
|
89
|
+
|
|
90
|
+
@bot.on_message(filters.command("ping"))
|
|
91
|
+
async def ping_handler(message):
|
|
92
|
+
await message.reply("🏓 pong!")
|
|
93
|
+
|
|
94
|
+
@bot.on_message(filters.command("start"))
|
|
95
|
+
async def start_handler(message):
|
|
96
|
+
await message.reply("سلام! ربات شادیسم با موفقیت راهاندازی شد. 🚀")
|
|
97
|
+
|
|
98
|
+
async def main():
|
|
99
|
+
await bot.start()
|
|
100
|
+
|
|
101
|
+
if __name__ == "__main__":
|
|
102
|
+
asyncio.run(main())
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
### 2. Fetching Chat History (`get_chat_history`)
|
|
108
|
+
|
|
109
|
+
```python
|
|
110
|
+
from shadism import Client
|
|
111
|
+
|
|
112
|
+
bot = Client("0937xxxxxxx")
|
|
113
|
+
|
|
114
|
+
@bot.on_message
|
|
115
|
+
async def history_example(message):
|
|
116
|
+
if message.text == "تاریخچه":
|
|
117
|
+
history = await bot.get_chat_history(message.chat_guid, limit=20)
|
|
118
|
+
for msg in history:
|
|
119
|
+
print(f"[{msg.id}] {msg.author_guid}: {msg.text}")
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
### 3. Sending Photos and Files
|
|
125
|
+
|
|
126
|
+
```python
|
|
127
|
+
# Send photo with automatic thumbnail generation
|
|
128
|
+
await bot.send_photo(
|
|
129
|
+
object_guid="u0DoNvd...",
|
|
130
|
+
photo="banner.jpg",
|
|
131
|
+
caption="تصویر جدید 🖼️"
|
|
132
|
+
)
|
|
133
|
+
|
|
134
|
+
# Send documents and files
|
|
135
|
+
await bot.send_file(
|
|
136
|
+
object_guid="u0DoNvd...",
|
|
137
|
+
file="document.pdf",
|
|
138
|
+
caption="فایل ضمیمه 📄"
|
|
139
|
+
)
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
### 4. Interactive Two-Way Message Cleaner
|
|
145
|
+
|
|
146
|
+
```python
|
|
147
|
+
@bot.on_message
|
|
148
|
+
async def clean_messages(message):
|
|
149
|
+
if message.text == "پاکسازی":
|
|
150
|
+
messages = await bot.get_chat_history(message.chat_guid, limit=50)
|
|
151
|
+
to_delete = [
|
|
152
|
+
m.id for m in messages
|
|
153
|
+
if m.author_guid == bot.session.user_guid
|
|
154
|
+
]
|
|
155
|
+
if to_delete:
|
|
156
|
+
await bot.delete_messages(message.chat_guid, to_delete, delete_type="Global")
|
|
157
|
+
await bot.send_message(message.chat_guid, f"عملیات انجام شد: {len(to_delete)} پیام پاک شد.")
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
## 📖 License
|
|
163
|
+
|
|
164
|
+
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
|
|
165
|
+
Developed by **AmirAli khosravinejad**.
|
shadism-1.0.0/README.md
ADDED
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
# shadism (شادیسم) ⚡
|
|
2
|
+
|
|
3
|
+
[](https://pypi.org/project/shadism/)
|
|
4
|
+
[](https://pypi.org/project/shadism/)
|
|
5
|
+
[](LICENSE)
|
|
6
|
+
[](https://shadism.spark-js.ir)
|
|
7
|
+
[](https://ble.ir/join/8jXbafMPwL)
|
|
8
|
+
|
|
9
|
+
**shadism** is an ultra-high-performance, modern, and fully asynchronous Python SDK and UserBot framework for the **Shad** messenger protocol.
|
|
10
|
+
|
|
11
|
+
Designed from the ground up with native `asyncio`, client-side end-to-end encryption (AES-256-CBC + RSA), rich object-oriented models, and declarative message filtering.
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## 👨💻 Developer & Community
|
|
16
|
+
|
|
17
|
+
- **Author**: AmirAli khosravinejad
|
|
18
|
+
- **Email**: [khosravinejad.amirali@gmail.com](mailto:khosravinejad.amirali@gmail.com)
|
|
19
|
+
- **Official Documentation**: [https://shadism.spark-js.ir](https://shadism.spark-js.ir)
|
|
20
|
+
- **GitHub Repository**: [https://github.com/AmirAli-khosravinejad/shadism](https://github.com/AmirAli-khosravinejad/shadism)
|
|
21
|
+
- **Official Announcement Channel (Bale)**: [https://ble.ir/join/8jXbafMPwL](https://ble.ir/join/8jXbafMPwL)
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## 🚀 Key Features
|
|
26
|
+
|
|
27
|
+
- **⚡ 100% Asynchronous**: Built entirely on `asyncio` and `httpx` with HTTP/2 support.
|
|
28
|
+
- **🔐 End-to-End Encryption**: Automated key generation, passphrases, AES-CBC payload encryption, and RSA authentication.
|
|
29
|
+
- **🎯 Declarative Filters**: Chainable event filters (`filters.command`, `filters.regex`, `filters.group`, `filters.private`, `&`, `|`, `~`).
|
|
30
|
+
- **📜 Smart Chat History**: `get_chat_history()` with automatic batch pagination, deduplication, and update fallback.
|
|
31
|
+
- **📁 Automated Media Streaming**: Chunked file upload (`UploadFile.ashx`) and automatic photo thumbnail generation.
|
|
32
|
+
- **🎙️ Voice Chat (WebRTC)**: Group and channel voice chat creation, joining, speaking activity control, and participants management.
|
|
33
|
+
- **🧩 Rich OOP Models**: Direct interaction with `Message`, `Chat`, and `User` objects (`await msg.reply()`, `await msg.delete()`, `await chat.send_message()`).
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## 📦 Installation
|
|
38
|
+
|
|
39
|
+
All dependencies (`httpx`, `h2`, `cryptography`, `Pillow`) are automatically installed:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
pip install shadism
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## ⚡ Quickstart
|
|
48
|
+
|
|
49
|
+
### 1. Simple Echo / Ping Bot
|
|
50
|
+
|
|
51
|
+
```python
|
|
52
|
+
import asyncio
|
|
53
|
+
from shadism import Client, filters
|
|
54
|
+
|
|
55
|
+
bot = Client("0937xxxxxxx")
|
|
56
|
+
|
|
57
|
+
@bot.on_message(filters.command("ping"))
|
|
58
|
+
async def ping_handler(message):
|
|
59
|
+
await message.reply("🏓 pong!")
|
|
60
|
+
|
|
61
|
+
@bot.on_message(filters.command("start"))
|
|
62
|
+
async def start_handler(message):
|
|
63
|
+
await message.reply("سلام! ربات شادیسم با موفقیت راهاندازی شد. 🚀")
|
|
64
|
+
|
|
65
|
+
async def main():
|
|
66
|
+
await bot.start()
|
|
67
|
+
|
|
68
|
+
if __name__ == "__main__":
|
|
69
|
+
asyncio.run(main())
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
### 2. Fetching Chat History (`get_chat_history`)
|
|
75
|
+
|
|
76
|
+
```python
|
|
77
|
+
from shadism import Client
|
|
78
|
+
|
|
79
|
+
bot = Client("0937xxxxxxx")
|
|
80
|
+
|
|
81
|
+
@bot.on_message
|
|
82
|
+
async def history_example(message):
|
|
83
|
+
if message.text == "تاریخچه":
|
|
84
|
+
history = await bot.get_chat_history(message.chat_guid, limit=20)
|
|
85
|
+
for msg in history:
|
|
86
|
+
print(f"[{msg.id}] {msg.author_guid}: {msg.text}")
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
### 3. Sending Photos and Files
|
|
92
|
+
|
|
93
|
+
```python
|
|
94
|
+
# Send photo with automatic thumbnail generation
|
|
95
|
+
await bot.send_photo(
|
|
96
|
+
object_guid="u0DoNvd...",
|
|
97
|
+
photo="banner.jpg",
|
|
98
|
+
caption="تصویر جدید 🖼️"
|
|
99
|
+
)
|
|
100
|
+
|
|
101
|
+
# Send documents and files
|
|
102
|
+
await bot.send_file(
|
|
103
|
+
object_guid="u0DoNvd...",
|
|
104
|
+
file="document.pdf",
|
|
105
|
+
caption="فایل ضمیمه 📄"
|
|
106
|
+
)
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
### 4. Interactive Two-Way Message Cleaner
|
|
112
|
+
|
|
113
|
+
```python
|
|
114
|
+
@bot.on_message
|
|
115
|
+
async def clean_messages(message):
|
|
116
|
+
if message.text == "پاکسازی":
|
|
117
|
+
messages = await bot.get_chat_history(message.chat_guid, limit=50)
|
|
118
|
+
to_delete = [
|
|
119
|
+
m.id for m in messages
|
|
120
|
+
if m.author_guid == bot.session.user_guid
|
|
121
|
+
]
|
|
122
|
+
if to_delete:
|
|
123
|
+
await bot.delete_messages(message.chat_guid, to_delete, delete_type="Global")
|
|
124
|
+
await bot.send_message(message.chat_guid, f"عملیات انجام شد: {len(to_delete)} پیام پاک شد.")
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
## 📖 License
|
|
130
|
+
|
|
131
|
+
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
|
|
132
|
+
Developed by **AmirAli khosravinejad**.
|