aiosroosh 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.
- aiosroosh-1.0.0/LICENSE +21 -0
- aiosroosh-1.0.0/PKG-INFO +10 -0
- aiosroosh-1.0.0/README.md +250 -0
- aiosroosh-1.0.0/aiosroosh/__init__.py +78 -0
- aiosroosh-1.0.0/aiosroosh/__version__.py +1 -0
- aiosroosh-1.0.0/aiosroosh/asynco/__init__.py +60 -0
- aiosroosh-1.0.0/aiosroosh/asynco/robot.py +640 -0
- aiosroosh-1.0.0/aiosroosh/buttons.py +134 -0
- aiosroosh-1.0.0/aiosroosh/errors.py +178 -0
- aiosroosh-1.0.0/aiosroosh/events.py +73 -0
- aiosroosh-1.0.0/aiosroosh/filters.py +170 -0
- aiosroosh-1.0.0/aiosroosh/types/__init__.py +19 -0
- aiosroosh-1.0.0/aiosroosh/types/callback.py +33 -0
- aiosroosh-1.0.0/aiosroosh/types/chat.py +15 -0
- aiosroosh-1.0.0/aiosroosh/types/message.py +124 -0
- aiosroosh-1.0.0/aiosroosh/types/user.py +15 -0
- aiosroosh-1.0.0/aiosroosh.egg-info/PKG-INFO +10 -0
- aiosroosh-1.0.0/aiosroosh.egg-info/SOURCES.txt +22 -0
- aiosroosh-1.0.0/aiosroosh.egg-info/dependency_links.txt +1 -0
- aiosroosh-1.0.0/aiosroosh.egg-info/requires.txt +1 -0
- aiosroosh-1.0.0/aiosroosh.egg-info/top_level.txt +1 -0
- aiosroosh-1.0.0/pyproject.toml +13 -0
- aiosroosh-1.0.0/setup.cfg +4 -0
- aiosroosh-1.0.0/setup.py +11 -0
aiosroosh-1.0.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 blaygamesoffcial-hash
|
|
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.
|
aiosroosh-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: aiosroosh
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: کتابخانهی ناهمگام (async) پایتون برای API بات سروشپلاس (splus.ir)
|
|
5
|
+
Author:
|
|
6
|
+
Requires-Python: >=3.8
|
|
7
|
+
License-File: LICENSE
|
|
8
|
+
Requires-Dist: aiohttp>=3.8
|
|
9
|
+
Dynamic: license-file
|
|
10
|
+
Dynamic: requires-python
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
# aiosroosh
|
|
2
|
+
|
|
3
|
+
کتابخانهی **ناهمگام (async)** پایتون برای API بات سروشپلاس (سروشپلاس)، که
|
|
4
|
+
از نظر ساختار شبیه بهکلی Telegram Bot API و در آدرس
|
|
5
|
+
`https://api.splus.ir/bot<token>/METHOD_NAME` در دسترس است.
|
|
6
|
+
|
|
7
|
+
> این پروژه نسخهی بازنویسیشده و async از کتابخانهی sync قبلی
|
|
8
|
+
> (`pyrosroosh`) است؛ ساختار عمومی (`Robot`، `Button`، `filters`،
|
|
9
|
+
> `HandlerPriority`، `ErrorHandlerBuilder`، سلسلهمراتب خطاها) کاملاً
|
|
10
|
+
> بازطراحی شده تا استفاده از asyncio و ثبت هندلر با فیلترهای قابلترکیب
|
|
11
|
+
> راحتتر باشد. ساختار پکیج مشابه کتابخانههای `rubka` و `aiobale` است:
|
|
12
|
+
> کلاینت با نام `Robot`، مدلهای داده (`Message`/`Callback`) در
|
|
13
|
+
> `aiosroosh.types`، و همهچیز هم از `aiosroosh.asynco` و هم از ریشهی
|
|
14
|
+
> پکیج (`aiosroosh`) قابل ایمپورت است.
|
|
15
|
+
|
|
16
|
+
منبع مستندات: مستندات رسمی سروشپلاس (`soroushplus.com/p/documents`)؛
|
|
17
|
+
نسخهی کامل استخراجشدهی متن در `docs/soroush_bot_api.md` این پکیج
|
|
18
|
+
موجود است.
|
|
19
|
+
|
|
20
|
+
## نصب
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
pip install -e .
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
وابستگی اصلی: `aiohttp>=3.8`.
|
|
27
|
+
|
|
28
|
+
## شروع سریع
|
|
29
|
+
|
|
30
|
+
```python
|
|
31
|
+
from aiosroosh import Robot, filters
|
|
32
|
+
# یا: from aiosroosh.asynco import Robot, filters
|
|
33
|
+
|
|
34
|
+
bot = Robot(token="YOUR_TOKEN_HERE")
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
@bot.on_message(filters.command("start"))
|
|
38
|
+
async def start(bot, message):
|
|
39
|
+
await message.reply("سلام! خوش آمدید!")
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
bot.run()
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## ساختار ایمپورتها
|
|
46
|
+
|
|
47
|
+
مشابه `rubka`، کلاسهای اصلی از ریشهی پکیج در دسترساند:
|
|
48
|
+
|
|
49
|
+
```python
|
|
50
|
+
from aiosroosh import Robot, Message, Callback, Button, filters
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
و مشابه `aiobale`، بهصورت جداگانه هم قابل ایمپورتاند — کلاینت از
|
|
54
|
+
`aiosroosh.asynco` و مدلهای داده از `aiosroosh.types`:
|
|
55
|
+
|
|
56
|
+
```python
|
|
57
|
+
from aiosroosh.asynco import Robot
|
|
58
|
+
from aiosroosh.types import Message, Callback
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
`Client` بهعنوان نام مستعار قدیمی `Robot` (برای سازگاری با کد قبلی) و
|
|
62
|
+
`CallbackQuery` بهعنوان نام مستعار قدیمی `Callback` همچنان در دسترساند.
|
|
63
|
+
|
|
64
|
+
## گرفتن توکن
|
|
65
|
+
|
|
66
|
+
یک بات در `splus.ir/fatherbot` بسازید، دقیقاً مثل BotFather در تلگرام.
|
|
67
|
+
|
|
68
|
+
## استفادهی پیشرفتهتر (async/await مستقیم)
|
|
69
|
+
|
|
70
|
+
بهجای `bot.run()` میتوانید خودتان چرخهی رویداد را مدیریت کنید:
|
|
71
|
+
|
|
72
|
+
```python
|
|
73
|
+
import asyncio
|
|
74
|
+
from aiosroosh import Robot
|
|
75
|
+
|
|
76
|
+
async def main():
|
|
77
|
+
async with Robot("YOUR_TOKEN_HERE") as bot:
|
|
78
|
+
me = await bot.get_me()
|
|
79
|
+
print(me)
|
|
80
|
+
await bot.poll() # حلقهی long-polling
|
|
81
|
+
|
|
82
|
+
asyncio.run(main())
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## فیلترها (`aiosroosh.filters`)
|
|
86
|
+
|
|
87
|
+
فیلترها قابل ترکیب با `&`، `|` و `~` هستند:
|
|
88
|
+
|
|
89
|
+
```python
|
|
90
|
+
from aiosroosh import filters
|
|
91
|
+
|
|
92
|
+
@bot.on_message(filters.text & ~filters.reply)
|
|
93
|
+
async def handler(bot, message):
|
|
94
|
+
...
|
|
95
|
+
|
|
96
|
+
@bot.on_message(filters.command(["start", "help"]))
|
|
97
|
+
async def start(bot, message):
|
|
98
|
+
...
|
|
99
|
+
|
|
100
|
+
@bot.on_message(filters.photo | filters.video)
|
|
101
|
+
async def on_media(bot, message):
|
|
102
|
+
...
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
فیلترهای آماده: `text`, `photo`, `video`, `audio`, `voice`, `document`,
|
|
106
|
+
`sticker`, `animation`, `video_note`, `contact`, `location`, `dice`,
|
|
107
|
+
`reply`, `media` (ترکیب انواع رسانه)، `private`, `group`, `channel`،
|
|
108
|
+
و توابع `command(...)`, `regex(...)`, `chat(...)`, `user(...)`.
|
|
109
|
+
برای فیلتر سفارشی از `filters.create(func)` استفاده کنید.
|
|
110
|
+
|
|
111
|
+
## اولویت هندلرها (`HandlerPriority`) و مدیریت خطا (`ErrorHandlerBuilder`)
|
|
112
|
+
|
|
113
|
+
```python
|
|
114
|
+
from aiosroosh import HandlerPriority
|
|
115
|
+
from aiosroosh.errors import FloodWait, ChatNotFound
|
|
116
|
+
|
|
117
|
+
@bot.on_message(filters.text, priority=HandlerPriority.HIGH)
|
|
118
|
+
async def logger(bot, message):
|
|
119
|
+
print("پیام جدید:", message.text)
|
|
120
|
+
|
|
121
|
+
@bot.errors.catch(FloodWait)
|
|
122
|
+
async def on_flood(error, update):
|
|
123
|
+
import asyncio
|
|
124
|
+
await asyncio.sleep(error.seconds)
|
|
125
|
+
|
|
126
|
+
@bot.errors.catch(ChatNotFound)
|
|
127
|
+
def on_chat_not_found(error, update):
|
|
128
|
+
print("چت پیدا نشد:", error)
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
اگر هیچ هندلر خطایی خطا را نگیرد، همانطور که انتظار میرود دوباره
|
|
132
|
+
`raise` میشود.
|
|
133
|
+
|
|
134
|
+
## دکمهها (`aiosroosh.Button`)
|
|
135
|
+
|
|
136
|
+
```python
|
|
137
|
+
from aiosroosh import Button
|
|
138
|
+
|
|
139
|
+
# ساخت سریع
|
|
140
|
+
btn1 = Button.inline("مرد", callback_data="male")
|
|
141
|
+
btn2 = Button.inline("زن", callback_data="female")
|
|
142
|
+
markup = Button.inline_markup([[btn1, btn2]])
|
|
143
|
+
|
|
144
|
+
# سازندهی زنجیرهای
|
|
145
|
+
markup = (
|
|
146
|
+
Button.builder(inline=True)
|
|
147
|
+
.add("مرد", callback_data="male")
|
|
148
|
+
.add("زن", callback_data="female")
|
|
149
|
+
.build()
|
|
150
|
+
)
|
|
151
|
+
|
|
152
|
+
# صفحهکلید معمولی
|
|
153
|
+
markup = Button.builder().add("گزینه ۱").add("گزینه ۲").build()
|
|
154
|
+
|
|
155
|
+
# حذف صفحهکلید
|
|
156
|
+
markup = Button.remove_keyboard()
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
## پیامرسانی (`Robot`)
|
|
160
|
+
|
|
161
|
+
تمام متدهای زیر `async` هستند و باید با `await` فراخوانی شوند:
|
|
162
|
+
|
|
163
|
+
`get_me`, `log_out`, `close_bot`, `send_message`, `forward_message`,
|
|
164
|
+
`copy_message`, `send_photo`, `send_audio`, `send_document`,
|
|
165
|
+
`send_video`, `send_animation`, `send_voice`, `send_video_note`,
|
|
166
|
+
`send_sticker`, `send_media_group`, `send_location`, `send_contact`,
|
|
167
|
+
`send_dice`, `get_file`, `download_file`, `edit_message_text`,
|
|
168
|
+
`edit_message_caption`, `edit_message_media`, `edit_message_reply_markup`,
|
|
169
|
+
`delete_message`, `answer_callback_query`, `set_my_commands`,
|
|
170
|
+
`delete_my_commands`, `get_my_commands`, `get_updates`, `set_webhook`,
|
|
171
|
+
`delete_webhook`, `get_webhook_info`.
|
|
172
|
+
|
|
173
|
+
برای رسانهها، یا یک رشتهی `file_id`، یک آدرس `https://`، یا یک فایل
|
|
174
|
+
باینری باز (`open(path, "rb")`) بدهید — دقیقاً مثل مستندات رسمی.
|
|
175
|
+
|
|
176
|
+
`Message`: `reply`, `reply_photo`, `reply_audio`, `reply_document`,
|
|
177
|
+
`reply_video`, `reply_animation`, `reply_voice`, `reply_video_note`,
|
|
178
|
+
`reply_location`, `reply_contact`, `reply_dice`, `reply_sticker`,
|
|
179
|
+
`edit_text`, `edit_caption`, `edit_reply_markup`, `delete`, `forward`,
|
|
180
|
+
`pin`, `unpin`.
|
|
181
|
+
|
|
182
|
+
`Callback` (نام مستعار قدیمی: `CallbackQuery`): `answer`.
|
|
183
|
+
|
|
184
|
+
هر دو کلاس `Message` و `Callback` هم از `aiosroosh` و هم از
|
|
185
|
+
`aiosroosh.types` قابل ایمپورتاند.
|
|
186
|
+
|
|
187
|
+
### توجه به تفاوت نامگذاری با pyrosroosh
|
|
188
|
+
|
|
189
|
+
در نسخهی sync قبلی، متد `close()` روی `Robot` معادل متد Bot API با نام
|
|
190
|
+
`close` بود. در اینجا چون `Robot` خودش یک نشست HTTP (`aiohttp.ClientSession`)
|
|
191
|
+
دارد که باید بسته شود، نامگذاری اینطور تفکیک شده:
|
|
192
|
+
|
|
193
|
+
- `bot.close()` → نشست HTTP خود کلاینت (و polling) را میبندد.
|
|
194
|
+
- `bot.close_bot()` → متد Bot API با نام `close` را فراخوانی میکند
|
|
195
|
+
(اطلاع به سرور برای جابهجایی بین سرورها).
|
|
196
|
+
|
|
197
|
+
## متدهایی که «بهزودی»اند ولی اینجا پیادهسازی شدهاند
|
|
198
|
+
|
|
199
|
+
مطابق مستندات رسمی، متدهای زیر با برچسب «بهزودی» علامتگذاری شدهاند و
|
|
200
|
+
سروشپلاس هنوز آنها را در سرور فعال نکرده:
|
|
201
|
+
|
|
202
|
+
- `send_chat_action` (`sendChatAction`)
|
|
203
|
+
- `get_user_profile_photos` (`getUserProfilePhotos`)
|
|
204
|
+
- `pin_chat_message` (`pinChatMessage`)
|
|
205
|
+
- `unpin_chat_message` (`unpinChatMessage`)
|
|
206
|
+
- `get_chat` (`getChat`)
|
|
207
|
+
- `get_sticker_set` (`getStickerSet`)
|
|
208
|
+
|
|
209
|
+
برخلاف `pyrosroosh` که این متدها را اصلاً پیاده نکرده بود، در `aiosroosh`
|
|
210
|
+
همهی این متدها **کامل و دقیقاً طبق مستندات پیادهسازی شدهاند** — یعنی
|
|
211
|
+
درخواست واقعی به همان endpoint مستند ارسال میشود. تنها تفاوت این است که
|
|
212
|
+
تا وقتی سروشپلاس این قابلیتها را فعال نکرده، پاسخ ناموفق سرور بهجای
|
|
213
|
+
یک `RPCError` مبهم، در قالب `UnsupportedByBackendError` (همراه با نام
|
|
214
|
+
متد و پیام خام سرور) بازگردانده میشود — یعنی قابل تشخیص و قابل مدیریت
|
|
215
|
+
جداگانه با `bot.errors.catch(UnsupportedByBackendError)`. به محض
|
|
216
|
+
فعال شدن هر متد در سمت سرور، بدون هیچ تغییری در کد شما، فراخوانیها با
|
|
217
|
+
موفقیت انجام خواهند شد.
|
|
218
|
+
|
|
219
|
+
نوع reply-markup به نام `ForceReply` نیز طبق مستندات «بهزودی» است؛
|
|
220
|
+
`Button.force_reply(...)` ساختار آن را میسازد، اما ممکن است تا فعال
|
|
221
|
+
شدن این قابلیت در کلاینتهای سروشپلاس اثری نداشته باشد.
|
|
222
|
+
|
|
223
|
+
## سلسلهمراتب خطاها (`aiosroosh.errors`)
|
|
224
|
+
|
|
225
|
+
```
|
|
226
|
+
PysrooshError
|
|
227
|
+
├── ValidationError پارامتر نامعتبر (پیش از ارسال درخواست)
|
|
228
|
+
├── AuthError توکن نامعتبر
|
|
229
|
+
├── SessionError خطای شبکه/نشست HTTP
|
|
230
|
+
│ └── SessionExpiredError استفاده از کلاینتی که close() شده
|
|
231
|
+
└── SoroushPlusAPIError پاسخ ok=false از سرور
|
|
232
|
+
├── UnsupportedByBackendError متد «بهزودی» (بالاتر توضیح داده شد)
|
|
233
|
+
└── RPCError
|
|
234
|
+
├── BadRequest
|
|
235
|
+
│ ├── ChatNotFound
|
|
236
|
+
│ ├── UserNotFound
|
|
237
|
+
│ └── MessageNotFound
|
|
238
|
+
├── Unauthorized
|
|
239
|
+
└── FloodWait (دارای فیلد seconds)
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
## نکته دربارهی مینیاپ
|
|
243
|
+
|
|
244
|
+
طبق مستندات، مینیاپ در سروشپلاس نیز «بهزودی» است و در حال حاضر هیچ
|
|
245
|
+
API عمومیای برای آن منتشر نشده؛ بنابراین چیزی برای پیادهسازی در این
|
|
246
|
+
نسخه وجود ندارد.
|
|
247
|
+
|
|
248
|
+
## مجوز
|
|
249
|
+
|
|
250
|
+
MIT
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"""
|
|
2
|
+
aiosroosh — کتابخانهی ناهمگام (async) پایتون برای API بات سروشپلاس (splus.ir).
|
|
3
|
+
|
|
4
|
+
مشابه ``rubka``، همهی کلاسهای اصلی از ریشهی پکیج هم در دسترساند::
|
|
5
|
+
|
|
6
|
+
from aiosroosh import Robot, Message, Callback, Button, filters
|
|
7
|
+
|
|
8
|
+
bot = Robot("YOUR_TOKEN_HERE")
|
|
9
|
+
|
|
10
|
+
@bot.on_message(filters.command("start"))
|
|
11
|
+
async def start(bot, message):
|
|
12
|
+
await message.reply("سلام!")
|
|
13
|
+
|
|
14
|
+
bot.run()
|
|
15
|
+
|
|
16
|
+
و مشابه ``aiobale``، همهچیز از ``aiosroosh.asynco`` (کلاینت) و
|
|
17
|
+
``aiosroosh.types`` (مدلهای داده مثل ``Message``/``Callback``) نیز
|
|
18
|
+
قابل ایمپورت است::
|
|
19
|
+
|
|
20
|
+
from aiosroosh.asynco import Robot
|
|
21
|
+
from aiosroosh.types import Message, Callback
|
|
22
|
+
"""
|
|
23
|
+
|
|
24
|
+
from .__version__ import __version__
|
|
25
|
+
from .asynco import Robot, Client
|
|
26
|
+
from .types import Message, Callback, CallbackQuery, User, Chat
|
|
27
|
+
from .buttons import Button
|
|
28
|
+
from .events import HandlerPriority, ErrorHandlerBuilder
|
|
29
|
+
from . import filters
|
|
30
|
+
from . import types
|
|
31
|
+
from . import asynco
|
|
32
|
+
from .errors import (
|
|
33
|
+
PysrooshError,
|
|
34
|
+
SoroushPlusAPIError,
|
|
35
|
+
RPCError,
|
|
36
|
+
FloodWait,
|
|
37
|
+
Unauthorized,
|
|
38
|
+
BadRequest,
|
|
39
|
+
ChatNotFound,
|
|
40
|
+
UserNotFound,
|
|
41
|
+
MessageNotFound,
|
|
42
|
+
SessionExpiredError,
|
|
43
|
+
SessionError,
|
|
44
|
+
AuthError,
|
|
45
|
+
ValidationError,
|
|
46
|
+
UnsupportedByBackendError,
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
__all__ = [
|
|
50
|
+
"__version__",
|
|
51
|
+
"Robot",
|
|
52
|
+
"Client",
|
|
53
|
+
"Message",
|
|
54
|
+
"Callback",
|
|
55
|
+
"CallbackQuery",
|
|
56
|
+
"User",
|
|
57
|
+
"Chat",
|
|
58
|
+
"Button",
|
|
59
|
+
"filters",
|
|
60
|
+
"types",
|
|
61
|
+
"asynco",
|
|
62
|
+
"HandlerPriority",
|
|
63
|
+
"ErrorHandlerBuilder",
|
|
64
|
+
"PysrooshError",
|
|
65
|
+
"SoroushPlusAPIError",
|
|
66
|
+
"RPCError",
|
|
67
|
+
"FloodWait",
|
|
68
|
+
"Unauthorized",
|
|
69
|
+
"BadRequest",
|
|
70
|
+
"ChatNotFound",
|
|
71
|
+
"UserNotFound",
|
|
72
|
+
"MessageNotFound",
|
|
73
|
+
"SessionExpiredError",
|
|
74
|
+
"SessionError",
|
|
75
|
+
"AuthError",
|
|
76
|
+
"ValidationError",
|
|
77
|
+
"UnsupportedByBackendError",
|
|
78
|
+
]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "1.0.0"
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"""
|
|
2
|
+
لایهی ناهمگام (async) اصلی aiosroosh (مشابه ``rubka`` / ``aiobale``).
|
|
3
|
+
|
|
4
|
+
همهچیزی که برای نوشتن یک بات لازم دارید از همینجا هم قابل ایمپورت است::
|
|
5
|
+
|
|
6
|
+
from aiosroosh.asynco import Robot, Message, Callback, Button, filters
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from .robot import Robot
|
|
10
|
+
from ..types import Message, Callback, CallbackQuery, User, Chat
|
|
11
|
+
from ..buttons import Button
|
|
12
|
+
from ..events import HandlerPriority, ErrorHandlerBuilder
|
|
13
|
+
from .. import filters
|
|
14
|
+
from ..errors import (
|
|
15
|
+
PysrooshError,
|
|
16
|
+
SoroushPlusAPIError,
|
|
17
|
+
RPCError,
|
|
18
|
+
FloodWait,
|
|
19
|
+
Unauthorized,
|
|
20
|
+
BadRequest,
|
|
21
|
+
ChatNotFound,
|
|
22
|
+
UserNotFound,
|
|
23
|
+
MessageNotFound,
|
|
24
|
+
SessionExpiredError,
|
|
25
|
+
SessionError,
|
|
26
|
+
AuthError,
|
|
27
|
+
ValidationError,
|
|
28
|
+
UnsupportedByBackendError,
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
# نام قدیمی برای سازگاری با نسخههای پیشین (Client -> Robot).
|
|
32
|
+
Client = Robot
|
|
33
|
+
|
|
34
|
+
__all__ = [
|
|
35
|
+
"Robot",
|
|
36
|
+
"Client",
|
|
37
|
+
"Message",
|
|
38
|
+
"Callback",
|
|
39
|
+
"CallbackQuery",
|
|
40
|
+
"User",
|
|
41
|
+
"Chat",
|
|
42
|
+
"Button",
|
|
43
|
+
"filters",
|
|
44
|
+
"HandlerPriority",
|
|
45
|
+
"ErrorHandlerBuilder",
|
|
46
|
+
"PysrooshError",
|
|
47
|
+
"SoroushPlusAPIError",
|
|
48
|
+
"RPCError",
|
|
49
|
+
"FloodWait",
|
|
50
|
+
"Unauthorized",
|
|
51
|
+
"BadRequest",
|
|
52
|
+
"ChatNotFound",
|
|
53
|
+
"UserNotFound",
|
|
54
|
+
"MessageNotFound",
|
|
55
|
+
"SessionExpiredError",
|
|
56
|
+
"SessionError",
|
|
57
|
+
"AuthError",
|
|
58
|
+
"ValidationError",
|
|
59
|
+
"UnsupportedByBackendError",
|
|
60
|
+
]
|