telegrinder 0.1.dev19__py3-none-any.whl → 0.1.dev158__py3-none-any.whl
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.
Potentially problematic release.
This version of telegrinder might be problematic. Click here for more details.
- telegrinder/__init__.py +129 -22
- telegrinder/api/__init__.py +11 -2
- telegrinder/api/abc.py +25 -9
- telegrinder/api/api.py +29 -24
- telegrinder/api/error.py +14 -4
- telegrinder/api/response.py +11 -7
- telegrinder/bot/__init__.py +68 -7
- telegrinder/bot/bot.py +30 -24
- telegrinder/bot/cute_types/__init__.py +11 -1
- telegrinder/bot/cute_types/base.py +47 -0
- telegrinder/bot/cute_types/callback_query.py +64 -14
- telegrinder/bot/cute_types/inline_query.py +22 -16
- telegrinder/bot/cute_types/message.py +163 -43
- telegrinder/bot/cute_types/update.py +23 -0
- telegrinder/bot/dispatch/__init__.py +56 -3
- telegrinder/bot/dispatch/abc.py +9 -7
- telegrinder/bot/dispatch/composition.py +74 -0
- telegrinder/bot/dispatch/context.py +71 -0
- telegrinder/bot/dispatch/dispatch.py +86 -49
- telegrinder/bot/dispatch/handler/__init__.py +3 -0
- telegrinder/bot/dispatch/handler/abc.py +11 -5
- telegrinder/bot/dispatch/handler/func.py +41 -32
- telegrinder/bot/dispatch/handler/message_reply.py +46 -0
- telegrinder/bot/dispatch/middleware/__init__.py +2 -0
- telegrinder/bot/dispatch/middleware/abc.py +10 -4
- telegrinder/bot/dispatch/process.py +53 -49
- telegrinder/bot/dispatch/return_manager/__init__.py +19 -0
- telegrinder/bot/dispatch/return_manager/abc.py +95 -0
- telegrinder/bot/dispatch/return_manager/callback_query.py +19 -0
- telegrinder/bot/dispatch/return_manager/inline_query.py +14 -0
- telegrinder/bot/dispatch/return_manager/message.py +25 -0
- telegrinder/bot/dispatch/view/__init__.py +14 -2
- telegrinder/bot/dispatch/view/abc.py +121 -2
- telegrinder/bot/dispatch/view/box.py +38 -0
- telegrinder/bot/dispatch/view/callback_query.py +13 -38
- telegrinder/bot/dispatch/view/inline_query.py +11 -38
- telegrinder/bot/dispatch/view/message.py +11 -46
- telegrinder/bot/dispatch/waiter_machine/__init__.py +9 -0
- telegrinder/bot/dispatch/waiter_machine/machine.py +116 -0
- telegrinder/bot/dispatch/waiter_machine/middleware.py +76 -0
- telegrinder/bot/dispatch/waiter_machine/short_state.py +37 -0
- telegrinder/bot/polling/__init__.py +2 -0
- telegrinder/bot/polling/abc.py +11 -4
- telegrinder/bot/polling/polling.py +89 -40
- telegrinder/bot/rules/__init__.py +92 -5
- telegrinder/bot/rules/abc.py +81 -63
- telegrinder/bot/rules/adapter/__init__.py +11 -0
- telegrinder/bot/rules/adapter/abc.py +21 -0
- telegrinder/bot/rules/adapter/errors.py +5 -0
- telegrinder/bot/rules/adapter/event.py +43 -0
- telegrinder/bot/rules/adapter/raw_update.py +24 -0
- telegrinder/bot/rules/callback_data.py +159 -38
- telegrinder/bot/rules/command.py +116 -0
- telegrinder/bot/rules/enum_text.py +28 -0
- telegrinder/bot/rules/func.py +17 -17
- telegrinder/bot/rules/fuzzy.py +13 -10
- telegrinder/bot/rules/inline.py +61 -0
- telegrinder/bot/rules/integer.py +12 -7
- telegrinder/bot/rules/is_from.py +148 -7
- telegrinder/bot/rules/markup.py +21 -18
- telegrinder/bot/rules/mention.py +17 -0
- telegrinder/bot/rules/message_entities.py +33 -0
- telegrinder/bot/rules/regex.py +27 -19
- telegrinder/bot/rules/rule_enum.py +74 -0
- telegrinder/bot/rules/start.py +42 -0
- telegrinder/bot/rules/text.py +23 -14
- telegrinder/bot/scenario/__init__.py +2 -0
- telegrinder/bot/scenario/abc.py +12 -5
- telegrinder/bot/scenario/checkbox.py +48 -30
- telegrinder/bot/scenario/choice.py +16 -10
- telegrinder/client/__init__.py +2 -0
- telegrinder/client/abc.py +8 -21
- telegrinder/client/aiohttp.py +30 -21
- telegrinder/model.py +68 -37
- telegrinder/modules.py +189 -21
- telegrinder/msgspec_json.py +14 -0
- telegrinder/msgspec_utils.py +207 -0
- telegrinder/node/__init__.py +31 -0
- telegrinder/node/attachment.py +71 -0
- telegrinder/node/base.py +93 -0
- telegrinder/node/composer.py +71 -0
- telegrinder/node/container.py +22 -0
- telegrinder/node/message.py +18 -0
- telegrinder/node/rule.py +56 -0
- telegrinder/node/source.py +31 -0
- telegrinder/node/text.py +13 -0
- telegrinder/node/tools/__init__.py +3 -0
- telegrinder/node/tools/generator.py +40 -0
- telegrinder/node/update.py +12 -0
- telegrinder/rules.py +1 -1
- telegrinder/tools/__init__.py +165 -4
- telegrinder/tools/buttons.py +75 -51
- telegrinder/tools/error_handler/__init__.py +8 -0
- telegrinder/tools/error_handler/abc.py +30 -0
- telegrinder/tools/error_handler/error_handler.py +156 -0
- telegrinder/tools/formatting/__init__.py +81 -3
- telegrinder/tools/formatting/html.py +283 -37
- telegrinder/tools/formatting/links.py +32 -0
- telegrinder/tools/formatting/spec_html_formats.py +121 -0
- telegrinder/tools/global_context/__init__.py +12 -0
- telegrinder/tools/global_context/abc.py +66 -0
- telegrinder/tools/global_context/global_context.py +451 -0
- telegrinder/tools/global_context/telegrinder_ctx.py +25 -0
- telegrinder/tools/i18n/__init__.py +12 -0
- telegrinder/tools/i18n/base.py +31 -0
- telegrinder/tools/i18n/middleware/__init__.py +3 -0
- telegrinder/tools/i18n/middleware/base.py +26 -0
- telegrinder/tools/i18n/simple.py +48 -0
- telegrinder/tools/inline_query.py +684 -0
- telegrinder/tools/kb_set/__init__.py +2 -0
- telegrinder/tools/kb_set/base.py +3 -0
- telegrinder/tools/kb_set/yaml.py +28 -17
- telegrinder/tools/keyboard.py +84 -62
- telegrinder/tools/loop_wrapper/__init__.py +4 -0
- telegrinder/tools/loop_wrapper/abc.py +18 -0
- telegrinder/tools/loop_wrapper/loop_wrapper.py +132 -0
- telegrinder/tools/magic.py +48 -23
- telegrinder/tools/parse_mode.py +1 -2
- telegrinder/types/__init__.py +1 -0
- telegrinder/types/enums.py +651 -0
- telegrinder/types/methods.py +3933 -1128
- telegrinder/types/objects.py +4755 -1633
- {telegrinder-0.1.dev19.dist-info → telegrinder-0.1.dev158.dist-info}/LICENSE +2 -1
- telegrinder-0.1.dev158.dist-info/METADATA +108 -0
- telegrinder-0.1.dev158.dist-info/RECORD +126 -0
- {telegrinder-0.1.dev19.dist-info → telegrinder-0.1.dev158.dist-info}/WHEEL +1 -1
- telegrinder/bot/dispatch/waiter.py +0 -37
- telegrinder/result.py +0 -38
- telegrinder/tools/formatting/abc.py +0 -52
- telegrinder/tools/formatting/markdown.py +0 -57
- telegrinder/typegen/__init__.py +0 -1
- telegrinder/typegen/__main__.py +0 -3
- telegrinder/typegen/nicification.py +0 -20
- telegrinder/typegen/schema_generator.py +0 -259
- telegrinder-0.1.dev19.dist-info/METADATA +0 -22
- telegrinder-0.1.dev19.dist-info/RECORD +0 -74
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: telegrinder
|
|
3
|
+
Version: 0.1.dev158
|
|
4
|
+
Summary: Framework for effective and reliable async telegram bot building.
|
|
5
|
+
Home-page: https://github.com/timoniq/telegrinder
|
|
6
|
+
License: MIT
|
|
7
|
+
Keywords: telegram,telegram bot api framework,telegrinder,asyncio,middleware,composition,bot api,async
|
|
8
|
+
Author: timoniq
|
|
9
|
+
Author-email: tesseradecades@mail.ru
|
|
10
|
+
Maintainer: luwqz1
|
|
11
|
+
Requires-Python: >=3.11,<4.0
|
|
12
|
+
Classifier: Environment :: Console
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
18
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
19
|
+
Classifier: Typing :: Typed
|
|
20
|
+
Requires-Dist: PyYAML (>=6.0,<7.0)
|
|
21
|
+
Requires-Dist: aiohttp (>=3.8.1,<4.0.0)
|
|
22
|
+
Requires-Dist: certifi (>=2022.6.15,<2023.0.0)
|
|
23
|
+
Requires-Dist: choicelib (>=0.1.5,<0.2.0)
|
|
24
|
+
Requires-Dist: colorama (>=0.4.0,<0.5.0)
|
|
25
|
+
Requires-Dist: envparse (>=0.2.0,<0.3.0)
|
|
26
|
+
Requires-Dist: fntypes (>=0.1.1,<0.2.0)
|
|
27
|
+
Requires-Dist: msgspec (>=0.18.4,<0.19.0)
|
|
28
|
+
Requires-Dist: requests (>=2.28.1,<3.0.0)
|
|
29
|
+
Requires-Dist: typing-extensions (>=4.8.0,<5.0.0)
|
|
30
|
+
Requires-Dist: vbml (>=1.1.post1,<2.0)
|
|
31
|
+
Project-URL: Repository, https://github.com/timoniq/telegrinder
|
|
32
|
+
Description-Content-Type: text/markdown
|
|
33
|
+
|
|
34
|
+
# Telegrinder
|
|
35
|
+
|
|
36
|
+
Framework for effective and reliable telegram bot building.
|
|
37
|
+
|
|
38
|
+
Still in development.
|
|
39
|
+
|
|
40
|
+
* Type hinted
|
|
41
|
+
* Customizable and extensible
|
|
42
|
+
* Ready to use scenarios and rules
|
|
43
|
+
* Fast models built on msgspec
|
|
44
|
+
* Both low-level and high-level API
|
|
45
|
+
|
|
46
|
+
# Getting started
|
|
47
|
+
|
|
48
|
+
Install using pip:
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
pip install telegrinder
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Using poetry:
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
poetry add telegrinder
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Install from github:
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
pip install -U https://github.com/timoniq/telegrinder/archive/dev.zip
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
```
|
|
67
|
+
poetry add git+https://github.com/timoniq/telegrinder.git#dev
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Basic example:
|
|
71
|
+
|
|
72
|
+
```python
|
|
73
|
+
from telegrinder import API, Message, Telegrinder, Token
|
|
74
|
+
from telegrinder.modules import logger
|
|
75
|
+
from telegrinder.rules import Text
|
|
76
|
+
|
|
77
|
+
logger.set_level("INFO")
|
|
78
|
+
api = API(token=Token("123:token"))
|
|
79
|
+
bot = Telegrinder(api)
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
@bot.on.message(Text("/start"))
|
|
83
|
+
async def start(message: Message):
|
|
84
|
+
me = (await api.get_me()).unwrap()
|
|
85
|
+
await message.answer(
|
|
86
|
+
f"Hello, {message.from_user.full_name}! I'm {me.full_name}."
|
|
87
|
+
)
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
bot.run_forever()
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
# Documentation
|
|
94
|
+
|
|
95
|
+
[Readthedocs](https://telegrinder.readthedocs.io)
|
|
96
|
+
|
|
97
|
+
# Community
|
|
98
|
+
|
|
99
|
+
Join our [telegram forum](https://t.me/botoforum).
|
|
100
|
+
|
|
101
|
+
# [Contributing](https://github.com/timoniq/telegrinder/blob/main/contributing.md)
|
|
102
|
+
|
|
103
|
+
# License
|
|
104
|
+
|
|
105
|
+
Telegrinder is [MIT licensed](./LICENSE)
|
|
106
|
+
Copyright © 2022-2024 [timoniq](https://github.com/timoniq)\
|
|
107
|
+
Copyright © 2024 [luwqz1](https://github.com/luwqz1)
|
|
108
|
+
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
telegrinder/__init__.py,sha256=tuusAaob1cu2swfwv86_eSZWpJrfEcCZ2QyzS8u6HAM,2821
|
|
2
|
+
telegrinder/api/__init__.py,sha256=pIDtnsL0NwT5PgVm43Gkp-ByOqDsqnD-oFDiC9tcPT4,246
|
|
3
|
+
telegrinder/api/abc.py,sha256=Ms81jKwz0XTcFMvoT5AwuRnbaBuxgVYnRCqrI6RFfLU,1509
|
|
4
|
+
telegrinder/api/api.py,sha256=E9VOqhp55GDxpSRTDxYq6cLcqYs6eXTKJ4ohWPcMLxA,1966
|
|
5
|
+
telegrinder/api/error.py,sha256=7qOYpP3P-s1p235Gp4VhCxcpY5VX8KyK_md3_-M-NCQ,390
|
|
6
|
+
telegrinder/api/response.py,sha256=d7Oxd5kOdbZNJiALkzkecHl8Y3K_BzCmsRq2Sn3otqA,491
|
|
7
|
+
telegrinder/bot/__init__.py,sha256=tLEUne5ftvKUVlkMAtPTO1_TSHkYJBbG73LuiBeC7gk,1560
|
|
8
|
+
telegrinder/bot/bot.py,sha256=C-egmfFZdYDBCxcyfq7GrIWUZ1WOZeUD9ulVG5Ksbd0,2222
|
|
9
|
+
telegrinder/bot/cute_types/__init__.py,sha256=HeuWq297lY209MssrEbj5MsxsGfOhwVLo1pH_-pHv_I,295
|
|
10
|
+
telegrinder/bot/cute_types/base.py,sha256=W1kifloiXh6SdyJPeaAot7Z4o60PUfVNH-Lzkb6S4RU,1115
|
|
11
|
+
telegrinder/bot/cute_types/callback_query.py,sha256=lZPQGOEEWK2Vh6FfXPPxeDinCTREEskEewg8XFGATs8,2522
|
|
12
|
+
telegrinder/bot/cute_types/inline_query.py,sha256=08XA8dHmTyfCXIUkyMWrfTrjW6I8t2v1UcB17lKWvmk,1254
|
|
13
|
+
telegrinder/bot/cute_types/message.py,sha256=JJ3rVNZJJj7KjNhRum-tV4a8vPv4bhPTy4v368ysxaI,6888
|
|
14
|
+
telegrinder/bot/cute_types/update.py,sha256=6BAvgX6uRlJUT-XkBLTtnZX5UKLhO6-qqTaMod4WfrM,572
|
|
15
|
+
telegrinder/bot/dispatch/__init__.py,sha256=o10t98PY1BuIGaJcloxfbgUYp0bf5ZqAaBQScIaV3VQ,1322
|
|
16
|
+
telegrinder/bot/dispatch/abc.py,sha256=3bOKEFJTKarwqWTDqhscVw2U5FBllJ-TyId-aUPzb7c,454
|
|
17
|
+
telegrinder/bot/dispatch/composition.py,sha256=3oYaL7IOnYC2Al0SJ4pk89LTqH8i0eP48t-4-BDtqRQ,2546
|
|
18
|
+
telegrinder/bot/dispatch/context.py,sha256=Uk_GFN3wlLuS5BGgBaLfLxU8xBp_yB4fPJcuzEd1ti4,2093
|
|
19
|
+
telegrinder/bot/dispatch/dispatch.py,sha256=ZjCm-0ZNywlhmd_-1jKJYUHhLRHASLOb8hbmhsBUb48,3783
|
|
20
|
+
telegrinder/bot/dispatch/handler/__init__.py,sha256=mzchbArrm0eoTEeVKHYrtJX4WSfW5t6T4xDU3-mtYaA,169
|
|
21
|
+
telegrinder/bot/dispatch/handler/abc.py,sha256=ffa9zmIcaIkIuQk8JKBty2pf53woH6hzIkQb0wmqA3k,573
|
|
22
|
+
telegrinder/bot/dispatch/handler/func.py,sha256=eoJ8RE-am2Pc49WlOCFTP3UwhVQ-k01Az1UuaTYnzc0,2074
|
|
23
|
+
telegrinder/bot/dispatch/handler/message_reply.py,sha256=pfFINSLwTsx9buHwVW1ahVRWYQZn0QKyIazkO8D5MVo,1425
|
|
24
|
+
telegrinder/bot/dispatch/middleware/__init__.py,sha256=qDuTt2ZZKX9UMjPdw5xaaNZdMI-i3P4Px2T8qbYCMJw,61
|
|
25
|
+
telegrinder/bot/dispatch/middleware/abc.py,sha256=RWmr1agbvCabsh-m1WeQORi-Lrkt1xRBidKkugzA41Y,421
|
|
26
|
+
telegrinder/bot/dispatch/process.py,sha256=Z4iNCwqZQyBogGxFzeNK7Pbk3ldH_e0Z95AE9sm5R-0,2267
|
|
27
|
+
telegrinder/bot/dispatch/return_manager/__init__.py,sha256=-4h9nU-vdyPgv7bqKi1fAlfzNOKTO9m9FtdTZOhrmuc,447
|
|
28
|
+
telegrinder/bot/dispatch/return_manager/abc.py,sha256=dGPwsIUJW_6SRsNxSiWS69xOOwSOATzMP2a7FoD90sA,3150
|
|
29
|
+
telegrinder/bot/dispatch/return_manager/callback_query.py,sha256=FV_bVdJRbtVNRvf_CvL1V5EFZqS83VqZQOWUi1x3pxk,624
|
|
30
|
+
telegrinder/bot/dispatch/return_manager/inline_query.py,sha256=erJ54AXSG_1lACnzmP1CIQYT4RkHT4Ml5PeRD1bkHK4,452
|
|
31
|
+
telegrinder/bot/dispatch/return_manager/message.py,sha256=eXjQEm1qBv5W9MfvdAfleytarR7UY_Ksnpv4EAaMfQY,824
|
|
32
|
+
telegrinder/bot/dispatch/view/__init__.py,sha256=iMReW_At2YzenjUGOgrVnOcHLVJAIQAfI9DdQElZdcM,379
|
|
33
|
+
telegrinder/bot/dispatch/view/abc.py,sha256=YbGTIPMh9tXsombgxhfYhxVdcz4O5NBVy98xf521hm0,4475
|
|
34
|
+
telegrinder/bot/dispatch/view/box.py,sha256=PbIZrAArerS0DjrltTtDorUNqTMyTaXKyF_F6KwMHzc,1197
|
|
35
|
+
telegrinder/bot/dispatch/view/callback_query.py,sha256=iL6DbB8ucXGvlv0w8eyMeZ94S1xz181pIn2yvYK1N_8,636
|
|
36
|
+
telegrinder/bot/dispatch/view/inline_query.py,sha256=ZcT1iCE8uRQ_PeaXGcOsXrMmIl2ow0YTTtDzuQ2kgjU,527
|
|
37
|
+
telegrinder/bot/dispatch/view/message.py,sha256=U80vO8tFtVsMfZHMA_LU9HunLB7nw0vbgEBltyZaSzk,498
|
|
38
|
+
telegrinder/bot/dispatch/waiter_machine/__init__.py,sha256=RUuq-J1qZMeREL8omM8kxEfgAz3-7h3B9NhzSjLTMqA,190
|
|
39
|
+
telegrinder/bot/dispatch/waiter_machine/machine.py,sha256=IhbbDDzRFQQFjOcq1Pzh8tSFE90o3LmxIqe0fnyMM80,3412
|
|
40
|
+
telegrinder/bot/dispatch/waiter_machine/middleware.py,sha256=MExbbYO9Bs_fBv1UTr28mOT3iozwY-H9Yg_7Z-B4Y5U,2483
|
|
41
|
+
telegrinder/bot/dispatch/waiter_machine/short_state.py,sha256=SUvbRRFuNKIZ6QPqp__eh7TrhDXAbBC4MuOjwBQUAUc,1106
|
|
42
|
+
telegrinder/bot/polling/__init__.py,sha256=OqfIFPS_V6UrCg-vCv9pkMFzTKdNbDP2faBfATs_TGg,94
|
|
43
|
+
telegrinder/bot/polling/abc.py,sha256=-5BpX55SJfDlEJWt15yOXWCizQRrgeY5oiA5eHkm1Nw,434
|
|
44
|
+
telegrinder/bot/polling/polling.py,sha256=xAPCyTFzL-5oKgI_Ty-R_Qcx0kcNDXjdqRqZWTgwXFQ,4361
|
|
45
|
+
telegrinder/bot/rules/__init__.py,sha256=d53pGSOmyGwG810JoorPZ0wBArZCbiWmk1hYoDQL7FY,2047
|
|
46
|
+
telegrinder/bot/rules/abc.py,sha256=tOP7hTMaIWgSxRDWrabJRIYBxKsQE8b9a_Vh1xJuFB8,3664
|
|
47
|
+
telegrinder/bot/rules/adapter/__init__.py,sha256=jFWpi3te8n-Ega3caCwLiA3iTW7F86brae0TZzH_BaU,231
|
|
48
|
+
telegrinder/bot/rules/adapter/abc.py,sha256=VxRGQbNtdfA6gZyTk0JjJBdB5n_7g6uwseewtovZEK8,558
|
|
49
|
+
telegrinder/bot/rules/adapter/errors.py,sha256=2r_UBTWm5-heU-NchBfobC1f848EWeC64nKvprGnAAY,73
|
|
50
|
+
telegrinder/bot/rules/adapter/event.py,sha256=MDPqFQ9sbQK2MDNTHgyJ7lTwohhJ7e89ZE5FKUNUkVs,1436
|
|
51
|
+
telegrinder/bot/rules/adapter/raw_update.py,sha256=K0bwq3Hh-hIs_xbEYDOgZHMS4r-Zvo3VKs1B3gkJLGA,752
|
|
52
|
+
telegrinder/bot/rules/callback_data.py,sha256=J81mF2m-108Cr9o_j-ySFbMvDVo8aXLLDEQCUa5punI,5744
|
|
53
|
+
telegrinder/bot/rules/command.py,sha256=2qzcLr_r4g7i5Hndhfd7zyoDfVCLPplr-Ijbr_yE4jo,3322
|
|
54
|
+
telegrinder/bot/rules/enum_text.py,sha256=w5pLQNvBRgrRgh1QA_wATprNcJyt_nQ5t_-bD9BFO9s,901
|
|
55
|
+
telegrinder/bot/rules/func.py,sha256=rhLXf6FjS0p3Nx1ZHqmV7uelUYJOkCf1gwc-SZSyRCo,707
|
|
56
|
+
telegrinder/bot/rules/fuzzy.py,sha256=ReweSKmql4a6AHFv2tXqCQoGktYpeezBLWvW_hS1YJg,712
|
|
57
|
+
telegrinder/bot/rules/inline.py,sha256=vtQtsnUSYIf7kUBs9mPjyvMz2cE8spYSbomS4tY6RBc,1918
|
|
58
|
+
telegrinder/bot/rules/integer.py,sha256=iZWctQQbrUV5kIhv8GI-O3iYzeI2d0dUdQ8uCaLB9gQ,531
|
|
59
|
+
telegrinder/bot/rules/is_from.py,sha256=lnpbu9WXXc_sTyrPZxOjBOhZlw1JCD10j2wCG2yXJFQ,4753
|
|
60
|
+
telegrinder/bot/rules/markup.py,sha256=setJpQPdBfR0s5x-tUFQiNFQwfSlCUnB-7YnVNBPyUA,1074
|
|
61
|
+
telegrinder/bot/rules/mention.py,sha256=ozXV3awsrJhkFKrTvPEl1iyVkDs0GWMmuRSLSnSdOmo,493
|
|
62
|
+
telegrinder/bot/rules/message_entities.py,sha256=QyIzQZOHva7NvLuyw_SeejnvBGj5yf2qG3aD5q3Ti7E,1063
|
|
63
|
+
telegrinder/bot/rules/regex.py,sha256=azSNenYp5EBEGNacNLAfaEiPdIrF7L44m8SetOdYfiY,1173
|
|
64
|
+
telegrinder/bot/rules/rule_enum.py,sha256=BUd78f7fEa0hfu1Paa384_Q-r0lB-ZWWukqkrFXdn58,2083
|
|
65
|
+
telegrinder/bot/rules/start.py,sha256=5ok581Ww56g27rE4QkrykbBZ-ER-SnATQNzMGut2PHA,1183
|
|
66
|
+
telegrinder/bot/rules/text.py,sha256=LaY8A2KUYDZpIllYTRSXXCwWfDN6dnFFmdvXM1nCKvA,1147
|
|
67
|
+
telegrinder/bot/scenario/__init__.py,sha256=sH-n6ZhVPgAiAgQVY9Y8QA4wjkjR5a5z63Oa0PrWogs,148
|
|
68
|
+
telegrinder/bot/scenario/abc.py,sha256=3AZYRjZlkbDtyFbsKdZ6BefzWYlJ0DOrGwh8jI3nzv4,474
|
|
69
|
+
telegrinder/bot/scenario/checkbox.py,sha256=lTPXTxIISCQk2qDmtdj5KLcFsxp5p0QjK8ybT8KHpsk,3956
|
|
70
|
+
telegrinder/bot/scenario/choice.py,sha256=dbRBBSHwODtik95vm4A5SPMbRrDjqVxUbTfNHnnzsFo,1448
|
|
71
|
+
telegrinder/client/__init__.py,sha256=E0g_8KuMWzPqw7OMnCtI8pNn_nfmoA8LXiUTnSFLO4E,130
|
|
72
|
+
telegrinder/client/abc.py,sha256=DFC_ct2PQCHXIliD0hYx_dQX0uLgc_ApuOAX_6QKQAM,1177
|
|
73
|
+
telegrinder/client/aiohttp.py,sha256=cNm3oPV-qiW8FfGUMBu_lfR335HDQnE3f91kBi9rD0w,3615
|
|
74
|
+
telegrinder/model.py,sha256=Nc3bqzdh1JZnllnITs7bAraTOB0J4auuUtT_NPjraLY,2443
|
|
75
|
+
telegrinder/modules.py,sha256=KwMYS1JNZRl80GwPDUrqh79JR1o4LWbdtOZgsjOXwmk,7513
|
|
76
|
+
telegrinder/msgspec_json.py,sha256=aWio-5B0pPIEyARFCtHfSAWBDZoWdwRAaijxxGCeRL0,349
|
|
77
|
+
telegrinder/msgspec_utils.py,sha256=ic39xr1LG7IbaKmF6QJDPbxcYrVVuqEVWfgJp3_XgR0,6168
|
|
78
|
+
telegrinder/node/__init__.py,sha256=01XTe8GPUBp5LXayDshihTxre7ejf99NYte20d08JLM,706
|
|
79
|
+
telegrinder/node/attachment.py,sha256=vMnD2tWQQQ6PFuXEIq2ZdL91xcBxiwlAkMkqJqseLlk,2587
|
|
80
|
+
telegrinder/node/base.py,sha256=iszAnP2pD3REDpUfufbVyJmg0rkXt2-ByeG6LgmS7Zc,2221
|
|
81
|
+
telegrinder/node/composer.py,sha256=f6l8qLjewu6lJTcxAucKyiQ4t-4d614YF6ssk9kYCZg,2225
|
|
82
|
+
telegrinder/node/container.py,sha256=sECP3TyC6AaNcJqKOfrL1T7-N8fkZzP2vB84kku6Jxg,636
|
|
83
|
+
telegrinder/node/message.py,sha256=2IW6DjF0KqH2_TZbZ-MXNsDioQRVPg9TUt86aQos0Kk,415
|
|
84
|
+
telegrinder/node/rule.py,sha256=VGmS4lJAFCoR0hCZSLn56fonMt0FhOGyZ1BQn_1vgeg,1724
|
|
85
|
+
telegrinder/node/source.py,sha256=ccKuqgA9pzAavE0krp_q0joHcz6uWjSyxO2wHSp2p1I,820
|
|
86
|
+
telegrinder/node/text.py,sha256=4kVMHvYRi0hxztVNT4Cv0DvUoI9QSn7NIYMG4U-uqYM,303
|
|
87
|
+
telegrinder/node/tools/__init__.py,sha256=TI_o7MbS4DUOSkNNgJGLocXfRybPFv2WOhBty058wrY,57
|
|
88
|
+
telegrinder/node/tools/generator.py,sha256=bc3kJSvS2TdIcBXkEbI4tpfhnvVe16m9ba5-WcIPy0c,1025
|
|
89
|
+
telegrinder/node/update.py,sha256=QD-m9soBgsP3voTbhaErWdE1FciwYyJCIFNDYf_zra0,253
|
|
90
|
+
telegrinder/rules.py,sha256=BFB8RFwKKxqs9HFfo_p0RfulQNonPZAX8cHpmnG7qCU,39
|
|
91
|
+
telegrinder/tools/__init__.py,sha256=mn70EbB-tXw9psPzt5J5t_8wc7HdSIblsNpG8mwKCxk,3493
|
|
92
|
+
telegrinder/tools/buttons.py,sha256=BOTCGtp0pugRquMDkroJ-lw1GoNL2jtbE_5CqmxZRU0,1807
|
|
93
|
+
telegrinder/tools/error_handler/__init__.py,sha256=iW1EDWLy3HOoRinEpxydg9qeFmg2i5CphZ1S6QyakpY,155
|
|
94
|
+
telegrinder/tools/error_handler/abc.py,sha256=HaKgC-WWHe-6WoY-ATz-sGh536qeO48EGEzsrmVOjt4,764
|
|
95
|
+
telegrinder/tools/error_handler/error_handler.py,sha256=H-sfsZ-TsGokBSMrGTE-r1N3-xnGuKOJQqh5sRFgcmk,5423
|
|
96
|
+
telegrinder/tools/formatting/__init__.py,sha256=1tFuJjMpDphCIOR4uXQhptyLHuAZ26mYSFx_BQwL5Lo,1459
|
|
97
|
+
telegrinder/tools/formatting/html.py,sha256=wWSOT6_p-qaELYfHcMXnyttZG1miKOrapJDRPhZQAoM,8477
|
|
98
|
+
telegrinder/tools/formatting/links.py,sha256=yPFdeazdp_yoblDR9GEP5hM9B3myb1Pa1v4ouJRYIQI,852
|
|
99
|
+
telegrinder/tools/formatting/spec_html_formats.py,sha256=hgu-aD9fLYw-IzS7ZWab5H8BBhmIwtQgHgMZ5kgndaA,2311
|
|
100
|
+
telegrinder/tools/global_context/__init__.py,sha256=QcNZpVTS-ZsPGdF4BQ10wnrfr1fZ3jX9aI-6It0nQxE,282
|
|
101
|
+
telegrinder/tools/global_context/abc.py,sha256=twwAmbTk49KGl_POImr4yj6POr-zdx8mz74McuphZH0,1644
|
|
102
|
+
telegrinder/tools/global_context/global_context.py,sha256=qj502fJ4ySW7oKH1vq_BTVz2hPDd0vXyjxNS2iq2jRc,14071
|
|
103
|
+
telegrinder/tools/global_context/telegrinder_ctx.py,sha256=g4iXYlK2IEi2sbJz1MqfBIDBrqF_4vznddjOUSEW8f8,651
|
|
104
|
+
telegrinder/tools/i18n/__init__.py,sha256=CLUoiCJzOZzF-dqDIHZ5Fc8QUa38cYhIG4WF-ctPLfE,288
|
|
105
|
+
telegrinder/tools/i18n/base.py,sha256=sJwgw6lobMIQEKIC4QH5O4sPKZADHAcxltZJvTtvaFE,637
|
|
106
|
+
telegrinder/tools/i18n/middleware/__init__.py,sha256=y5ZX6s3fOix_Yn98UNO8VqQ7ihJbQ_e5Uz01RgL7pHg,82
|
|
107
|
+
telegrinder/tools/i18n/middleware/base.py,sha256=Gc0G4ix4xlYCcUzO4SHH1L-1h3c3vmudvNuxeuwZDSE,685
|
|
108
|
+
telegrinder/tools/i18n/simple.py,sha256=vgkrleAQiYKcE9-2jn0QLvgr09xEXUsnpmygizt77bA,1619
|
|
109
|
+
telegrinder/tools/inline_query.py,sha256=lMdBAs9vkZSt78OOGNd6XptGpIsRIE0_Qat238CsBq0,23601
|
|
110
|
+
telegrinder/tools/kb_set/__init__.py,sha256=k1KCQTnvEgJ2y4KlghhJWOh5rccwg_27cs8264NtMmk,156
|
|
111
|
+
telegrinder/tools/kb_set/base.py,sha256=mbZs-ViUErfSibzyN064IqZp76LBJPg3NB4D9v4VFtg,243
|
|
112
|
+
telegrinder/tools/kb_set/yaml.py,sha256=gQZ9Ju0b8DAUrJKPehQDAL1KDszb0NiDzLsF1tT-H58,2022
|
|
113
|
+
telegrinder/tools/keyboard.py,sha256=Js4CXzHmLX_TRVawuz1lIRFNGdbG2fxh8L6t4OLkWxY,3824
|
|
114
|
+
telegrinder/tools/loop_wrapper/__init__.py,sha256=os6kfzNEpGa7EHBbwFpym-iEnQvJGokEyHtyuVIOtks,143
|
|
115
|
+
telegrinder/tools/loop_wrapper/abc.py,sha256=T1UnAogzsoSv46s1YBLL_g0vnqfu6NAbxGEQ018WDwE,405
|
|
116
|
+
telegrinder/tools/loop_wrapper/loop_wrapper.py,sha256=ZEwuqqEz-r5BehCRG-E5K1lg2i4ODyyhOh0iKFT8GDw,4306
|
|
117
|
+
telegrinder/tools/magic.py,sha256=roaB5fSymJMXMPMgVWbYjwpK23tDYF8HV_XXL_jxv7Q,1802
|
|
118
|
+
telegrinder/tools/parse_mode.py,sha256=JyQ-x9YAMPLhIIiUX01acyKkpWgs5TBA07W-iUyPHpE,92
|
|
119
|
+
telegrinder/types/__init__.py,sha256=pvPKWDXq9PBiIOCW8dFcJMqgr1kAqodPhwT-u8I4kug,78
|
|
120
|
+
telegrinder/types/enums.py,sha256=Lnxc9fAT8de5bN1m9rsvxsldWw_O7X7Rexxtdn39zxQ,18015
|
|
121
|
+
telegrinder/types/methods.py,sha256=7ErHlq2AraUZtHZWH95TmpfTW34C4fvZdegEmkAVnCQ,183757
|
|
122
|
+
telegrinder/types/objects.py,sha256=tNWJ1ifPL8IuZHpNeOyNLzyI3GSDu0kWzMAi3ZI-81g,203259
|
|
123
|
+
telegrinder-0.1.dev158.dist-info/LICENSE,sha256=J9ngGsqHCNNjpm3xYPT7EnlzsnjhfqNXej5mJFjM6lw,1094
|
|
124
|
+
telegrinder-0.1.dev158.dist-info/METADATA,sha256=7cKd1GWAYL9GJniKdtmt7VHoaiHn3gS9imZ32dSWefc,2760
|
|
125
|
+
telegrinder-0.1.dev158.dist-info/WHEEL,sha256=d2fvjOD7sXsVzChCqf0Ty0JbHKBaLYwDbGQDwQTnJ50,88
|
|
126
|
+
telegrinder-0.1.dev158.dist-info/RECORD,,
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import asyncio
|
|
2
|
-
import dataclasses
|
|
3
|
-
import typing
|
|
4
|
-
from telegrinder.bot.rules import ABCRule
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
DefaultWaiterHandler = typing.Callable[[typing.Any], typing.Coroutine]
|
|
8
|
-
T = typing.TypeVar("T")
|
|
9
|
-
E = typing.TypeVar("E")
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
@dataclasses.dataclass
|
|
13
|
-
class Waiter:
|
|
14
|
-
rules: typing.Iterable[ABCRule]
|
|
15
|
-
event: asyncio.Event
|
|
16
|
-
default: typing.Optional[typing.Union[DefaultWaiterHandler, str]] = None
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
async def wait(waiter: Waiter) -> typing.Tuple[typing.Any, dict]:
|
|
20
|
-
await waiter.event.wait()
|
|
21
|
-
event, ctx = getattr(waiter.event, "e")
|
|
22
|
-
return event, ctx
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
class WithWaiter(typing.Generic[T, E]):
|
|
26
|
-
short_waiters: typing.Dict[T, Waiter]
|
|
27
|
-
|
|
28
|
-
async def wait_for_answer(
|
|
29
|
-
self,
|
|
30
|
-
key: T,
|
|
31
|
-
*rules: ABCRule,
|
|
32
|
-
default: typing.Optional[typing.Union[DefaultWaiterHandler, str]] = None
|
|
33
|
-
) -> typing.Tuple[E, dict]:
|
|
34
|
-
event = asyncio.Event()
|
|
35
|
-
waiter = Waiter(rules, event, default)
|
|
36
|
-
self.short_waiters[key] = waiter
|
|
37
|
-
return await wait(waiter)
|
telegrinder/result.py
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import typing
|
|
2
|
-
|
|
3
|
-
T = typing.TypeVar("T")
|
|
4
|
-
E = typing.TypeVar("E")
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
class Result(typing.Generic[T, E]):
|
|
8
|
-
def __init__(
|
|
9
|
-
self,
|
|
10
|
-
is_ok: bool,
|
|
11
|
-
*,
|
|
12
|
-
value: typing.Optional[T] = None,
|
|
13
|
-
error: typing.Optional[E] = None
|
|
14
|
-
):
|
|
15
|
-
self.is_ok = is_ok
|
|
16
|
-
self.value = value
|
|
17
|
-
self.error = error
|
|
18
|
-
|
|
19
|
-
def unwrap(self) -> T:
|
|
20
|
-
if not self.is_ok:
|
|
21
|
-
raise self.error
|
|
22
|
-
return self.value
|
|
23
|
-
|
|
24
|
-
def unwrap_or(self, alternate_value: T):
|
|
25
|
-
if not self.is_ok:
|
|
26
|
-
return alternate_value
|
|
27
|
-
return self.value
|
|
28
|
-
|
|
29
|
-
def unwrap_via_handler(
|
|
30
|
-
self, handler: typing.Callable[["Result", dict], T], ctx: dict
|
|
31
|
-
):
|
|
32
|
-
return handler(self, ctx)
|
|
33
|
-
|
|
34
|
-
def __repr__(self):
|
|
35
|
-
return "<Result ({}: {})>".format(
|
|
36
|
-
"Ok" if self.is_ok else "Error",
|
|
37
|
-
repr(self.value if self.is_ok else self.error),
|
|
38
|
-
)
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
from abc import ABC, abstractmethod
|
|
2
|
-
from telegrinder.tools.parse_mode import get_mention_link
|
|
3
|
-
import typing
|
|
4
|
-
|
|
5
|
-
T = typing.TypeVar("T")
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
class ABCFormatter(ABC, str):
|
|
9
|
-
PARSE_MODE: str
|
|
10
|
-
|
|
11
|
-
@abstractmethod
|
|
12
|
-
def escape(self: T) -> T:
|
|
13
|
-
...
|
|
14
|
-
|
|
15
|
-
@abstractmethod
|
|
16
|
-
def bold(self: T) -> T:
|
|
17
|
-
...
|
|
18
|
-
|
|
19
|
-
@abstractmethod
|
|
20
|
-
def italic(self: T) -> T:
|
|
21
|
-
...
|
|
22
|
-
|
|
23
|
-
@abstractmethod
|
|
24
|
-
def underline(self: T) -> T:
|
|
25
|
-
...
|
|
26
|
-
|
|
27
|
-
@abstractmethod
|
|
28
|
-
def strike(self: T) -> T:
|
|
29
|
-
...
|
|
30
|
-
|
|
31
|
-
@abstractmethod
|
|
32
|
-
def link(self: T, href: str) -> T:
|
|
33
|
-
...
|
|
34
|
-
|
|
35
|
-
@abstractmethod
|
|
36
|
-
def spoiler(self: T) -> T:
|
|
37
|
-
...
|
|
38
|
-
|
|
39
|
-
def mention(self: T, user_id: int) -> T:
|
|
40
|
-
return self.link(get_mention_link(user_id))
|
|
41
|
-
|
|
42
|
-
@abstractmethod
|
|
43
|
-
def code_block(self: T) -> T:
|
|
44
|
-
...
|
|
45
|
-
|
|
46
|
-
@abstractmethod
|
|
47
|
-
def code_block_with_lang(self: T, lang: str) -> T:
|
|
48
|
-
...
|
|
49
|
-
|
|
50
|
-
@abstractmethod
|
|
51
|
-
def code_inline(self: T) -> T:
|
|
52
|
-
...
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
from .abc import ABCFormatter
|
|
2
|
-
from telegrinder.tools.parse_mode import ParseMode
|
|
3
|
-
|
|
4
|
-
FMT_CHARS = "\\`*_{}[]()#+-=!.@~|"
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
def wrap_md(wrapper: str, s: str) -> "MarkdownFormatter":
|
|
8
|
-
return MarkdownFormatter(wrapper + s + wrapper)
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
class MarkdownFormatter(ABCFormatter):
|
|
12
|
-
PARSE_MODE = ParseMode.MARKDOWNV2
|
|
13
|
-
|
|
14
|
-
def escape(self) -> "MarkdownFormatter":
|
|
15
|
-
return MarkdownFormatter(
|
|
16
|
-
"".join("\\" + x if x in FMT_CHARS else x for x in self)
|
|
17
|
-
.replace("&", "&")
|
|
18
|
-
.replace("<", "<")
|
|
19
|
-
.replace(">", ">")
|
|
20
|
-
)
|
|
21
|
-
|
|
22
|
-
def escape_code(self) -> "MarkdownFormatter":
|
|
23
|
-
return MarkdownFormatter(self.replace("\\", "\\\\").replace("`", "\\`"))
|
|
24
|
-
|
|
25
|
-
def escape_link(self) -> "MarkdownFormatter":
|
|
26
|
-
return MarkdownFormatter(self.replace("`", "\\`").replace(")", "\\)"))
|
|
27
|
-
|
|
28
|
-
def bold(self) -> "MarkdownFormatter":
|
|
29
|
-
return wrap_md("*", self)
|
|
30
|
-
|
|
31
|
-
def italic(self) -> "MarkdownFormatter":
|
|
32
|
-
return wrap_md("_", self)
|
|
33
|
-
|
|
34
|
-
def underline(self) -> "MarkdownFormatter":
|
|
35
|
-
return wrap_md("__", self)
|
|
36
|
-
|
|
37
|
-
def strike(self) -> "MarkdownFormatter":
|
|
38
|
-
return wrap_md("~", self)
|
|
39
|
-
|
|
40
|
-
def spoiler(self) -> "MarkdownFormatter":
|
|
41
|
-
return wrap_md("||", self)
|
|
42
|
-
|
|
43
|
-
def link(self, href: str) -> "MarkdownFormatter":
|
|
44
|
-
return MarkdownFormatter(
|
|
45
|
-
f"[{self.escape()}]({MarkdownFormatter(href).escape_link()})"
|
|
46
|
-
)
|
|
47
|
-
|
|
48
|
-
def code_block(self) -> "MarkdownFormatter":
|
|
49
|
-
return MarkdownFormatter(f"```\n{self.escape_code()}\n```")
|
|
50
|
-
|
|
51
|
-
def code_block_with_lang(self, lang: str) -> "MarkdownFormatter":
|
|
52
|
-
return MarkdownFormatter(
|
|
53
|
-
f"```{MarkdownFormatter(lang).escape()}\n{self.escape_code()}\n```"
|
|
54
|
-
)
|
|
55
|
-
|
|
56
|
-
def code_inline(self) -> "MarkdownFormatter":
|
|
57
|
-
return MarkdownFormatter(f"`{self.escape_code()}`")
|
telegrinder/typegen/__init__.py
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
from .schema_generator import generate
|
telegrinder/typegen/__main__.py
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
Code in this file is automatically parsed.
|
|
3
|
-
---
|
|
4
|
-
Nicifications are basically nice features for models which are included in auto-generated models
|
|
5
|
-
The difference between nicifications and cure types is: cute types can borrow view runtime properties and have context api
|
|
6
|
-
(so they can implement model-specific methods).
|
|
7
|
-
Nicifications can only implement methods/properties working only with model fields.
|
|
8
|
-
---
|
|
9
|
-
Only types from telegrinder.types may be used and imports declared in types/objects
|
|
10
|
-
"""
|
|
11
|
-
from telegrinder.types import Message, User
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
class _Message(Message):
|
|
15
|
-
@property
|
|
16
|
-
def from_user(self) -> "User":
|
|
17
|
-
return self.from_
|
|
18
|
-
|
|
19
|
-
def __eq__(self, other: "Message"):
|
|
20
|
-
return self.message_id == other.message_id and self.chat.id == other.chat.id
|