telegrinder 0.3.4__py3-none-any.whl → 0.4.0__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 +148 -149
- telegrinder/api/__init__.py +9 -8
- telegrinder/api/api.py +101 -93
- telegrinder/api/error.py +20 -16
- telegrinder/api/response.py +20 -20
- telegrinder/api/token.py +36 -36
- telegrinder/bot/__init__.py +72 -66
- telegrinder/bot/bot.py +83 -76
- telegrinder/bot/cute_types/__init__.py +19 -17
- telegrinder/bot/cute_types/base.py +184 -258
- telegrinder/bot/cute_types/callback_query.py +400 -385
- telegrinder/bot/cute_types/chat_join_request.py +62 -61
- telegrinder/bot/cute_types/chat_member_updated.py +157 -160
- telegrinder/bot/cute_types/inline_query.py +44 -43
- telegrinder/bot/cute_types/message.py +2590 -2637
- telegrinder/bot/cute_types/pre_checkout_query.py +42 -0
- telegrinder/bot/cute_types/update.py +112 -104
- telegrinder/bot/cute_types/utils.py +62 -95
- telegrinder/bot/dispatch/__init__.py +59 -55
- telegrinder/bot/dispatch/abc.py +76 -77
- telegrinder/bot/dispatch/context.py +96 -98
- telegrinder/bot/dispatch/dispatch.py +254 -202
- telegrinder/bot/dispatch/handler/__init__.py +13 -13
- telegrinder/bot/dispatch/handler/abc.py +23 -24
- telegrinder/bot/dispatch/handler/audio_reply.py +44 -44
- telegrinder/bot/dispatch/handler/base.py +57 -57
- telegrinder/bot/dispatch/handler/document_reply.py +44 -44
- telegrinder/bot/dispatch/handler/func.py +129 -135
- telegrinder/bot/dispatch/handler/media_group_reply.py +44 -43
- telegrinder/bot/dispatch/handler/message_reply.py +36 -36
- telegrinder/bot/dispatch/handler/photo_reply.py +44 -44
- telegrinder/bot/dispatch/handler/sticker_reply.py +37 -37
- telegrinder/bot/dispatch/handler/video_reply.py +44 -44
- telegrinder/bot/dispatch/middleware/__init__.py +3 -3
- telegrinder/bot/dispatch/middleware/abc.py +97 -22
- telegrinder/bot/dispatch/middleware/global_middleware.py +70 -0
- telegrinder/bot/dispatch/process.py +151 -157
- telegrinder/bot/dispatch/return_manager/__init__.py +15 -13
- telegrinder/bot/dispatch/return_manager/abc.py +104 -108
- telegrinder/bot/dispatch/return_manager/callback_query.py +20 -20
- telegrinder/bot/dispatch/return_manager/inline_query.py +15 -15
- telegrinder/bot/dispatch/return_manager/message.py +36 -36
- telegrinder/bot/dispatch/return_manager/pre_checkout_query.py +20 -0
- telegrinder/bot/dispatch/view/__init__.py +15 -13
- telegrinder/bot/dispatch/view/abc.py +45 -41
- telegrinder/bot/dispatch/view/base.py +231 -200
- telegrinder/bot/dispatch/view/box.py +140 -129
- telegrinder/bot/dispatch/view/callback_query.py +16 -17
- telegrinder/bot/dispatch/view/chat_join_request.py +11 -16
- telegrinder/bot/dispatch/view/chat_member.py +37 -39
- telegrinder/bot/dispatch/view/inline_query.py +16 -17
- telegrinder/bot/dispatch/view/message.py +43 -44
- telegrinder/bot/dispatch/view/pre_checkout_query.py +16 -0
- telegrinder/bot/dispatch/view/raw.py +116 -114
- telegrinder/bot/dispatch/waiter_machine/__init__.py +17 -17
- telegrinder/bot/dispatch/waiter_machine/actions.py +14 -13
- telegrinder/bot/dispatch/waiter_machine/hasher/__init__.py +8 -8
- telegrinder/bot/dispatch/waiter_machine/hasher/callback.py +55 -55
- telegrinder/bot/dispatch/waiter_machine/hasher/hasher.py +59 -57
- telegrinder/bot/dispatch/waiter_machine/hasher/message.py +51 -51
- telegrinder/bot/dispatch/waiter_machine/hasher/state.py +20 -19
- telegrinder/bot/dispatch/waiter_machine/machine.py +251 -172
- telegrinder/bot/dispatch/waiter_machine/middleware.py +94 -89
- telegrinder/bot/dispatch/waiter_machine/short_state.py +57 -68
- telegrinder/bot/polling/__init__.py +4 -4
- telegrinder/bot/polling/abc.py +25 -25
- telegrinder/bot/polling/polling.py +139 -131
- telegrinder/bot/rules/__init__.py +85 -62
- telegrinder/bot/rules/abc.py +213 -206
- telegrinder/bot/rules/callback_data.py +122 -163
- telegrinder/bot/rules/chat_join.py +45 -43
- telegrinder/bot/rules/command.py +126 -126
- telegrinder/bot/rules/enum_text.py +33 -36
- telegrinder/bot/rules/func.py +28 -26
- telegrinder/bot/rules/fuzzy.py +24 -24
- telegrinder/bot/rules/id.py +24 -0
- telegrinder/bot/rules/inline.py +58 -56
- telegrinder/bot/rules/integer.py +21 -20
- telegrinder/bot/rules/is_from.py +127 -127
- telegrinder/bot/rules/logic.py +18 -0
- telegrinder/bot/rules/markup.py +42 -43
- telegrinder/bot/rules/mention.py +14 -14
- telegrinder/bot/rules/message.py +15 -17
- telegrinder/bot/rules/message_entities.py +33 -35
- telegrinder/bot/rules/node.py +33 -27
- telegrinder/bot/rules/payload.py +81 -0
- telegrinder/bot/rules/payment_invoice.py +29 -0
- telegrinder/bot/rules/regex.py +36 -37
- telegrinder/bot/rules/rule_enum.py +72 -72
- telegrinder/bot/rules/start.py +42 -42
- telegrinder/bot/rules/state.py +35 -37
- telegrinder/bot/rules/text.py +38 -33
- telegrinder/bot/rules/update.py +15 -15
- telegrinder/bot/scenario/__init__.py +5 -5
- telegrinder/bot/scenario/abc.py +17 -19
- telegrinder/bot/scenario/checkbox.py +174 -176
- telegrinder/bot/scenario/choice.py +48 -51
- telegrinder/client/__init__.py +12 -4
- telegrinder/client/abc.py +100 -75
- telegrinder/client/aiohttp.py +134 -130
- telegrinder/client/form_data.py +31 -0
- telegrinder/client/sonic.py +212 -0
- telegrinder/model.py +208 -315
- telegrinder/modules.py +239 -237
- telegrinder/msgspec_json.py +14 -14
- telegrinder/msgspec_utils.py +478 -410
- telegrinder/node/__init__.py +86 -25
- telegrinder/node/attachment.py +163 -87
- telegrinder/node/base.py +288 -160
- telegrinder/node/callback_query.py +54 -53
- telegrinder/node/command.py +34 -33
- telegrinder/node/composer.py +163 -198
- telegrinder/node/container.py +33 -27
- telegrinder/node/either.py +82 -0
- telegrinder/node/event.py +54 -65
- telegrinder/node/file.py +51 -0
- telegrinder/node/me.py +15 -16
- telegrinder/node/payload.py +78 -0
- telegrinder/node/polymorphic.py +67 -48
- telegrinder/node/rule.py +72 -76
- telegrinder/node/scope.py +36 -38
- telegrinder/node/source.py +87 -71
- telegrinder/node/text.py +53 -41
- telegrinder/node/tools/__init__.py +3 -3
- telegrinder/node/tools/generator.py +36 -40
- telegrinder/py.typed +0 -0
- telegrinder/rules.py +1 -62
- telegrinder/tools/__init__.py +152 -93
- telegrinder/tools/adapter/__init__.py +19 -0
- telegrinder/tools/adapter/abc.py +49 -0
- telegrinder/tools/adapter/dataclass.py +56 -0
- telegrinder/{bot/rules → tools}/adapter/errors.py +5 -5
- telegrinder/{bot/rules → tools}/adapter/event.py +63 -65
- telegrinder/{bot/rules → tools}/adapter/node.py +46 -48
- telegrinder/{bot/rules → tools}/adapter/raw_event.py +27 -27
- telegrinder/{bot/rules → tools}/adapter/raw_update.py +30 -30
- telegrinder/tools/buttons.py +106 -80
- telegrinder/tools/callback_data_serilization/__init__.py +5 -0
- telegrinder/tools/callback_data_serilization/abc.py +51 -0
- telegrinder/tools/callback_data_serilization/json_ser.py +60 -0
- telegrinder/tools/callback_data_serilization/msgpack_ser.py +172 -0
- telegrinder/tools/error_handler/__init__.py +7 -7
- telegrinder/tools/error_handler/abc.py +30 -33
- telegrinder/tools/error_handler/error.py +9 -9
- telegrinder/tools/error_handler/error_handler.py +179 -193
- telegrinder/tools/formatting/__init__.py +83 -63
- telegrinder/tools/formatting/deep_links.py +541 -0
- telegrinder/tools/formatting/{html.py → html_formatter.py} +266 -294
- telegrinder/tools/formatting/spec_html_formats.py +71 -117
- telegrinder/tools/functional.py +8 -12
- telegrinder/tools/global_context/__init__.py +7 -7
- telegrinder/tools/global_context/abc.py +63 -63
- telegrinder/tools/global_context/global_context.py +387 -412
- telegrinder/tools/global_context/telegrinder_ctx.py +27 -27
- telegrinder/tools/i18n/__init__.py +7 -7
- telegrinder/tools/i18n/abc.py +30 -30
- telegrinder/tools/i18n/middleware/__init__.py +3 -3
- telegrinder/tools/i18n/middleware/abc.py +22 -25
- telegrinder/tools/i18n/simple.py +43 -43
- telegrinder/tools/input_file_directory.py +30 -0
- telegrinder/tools/keyboard.py +128 -128
- telegrinder/tools/lifespan.py +105 -0
- telegrinder/tools/limited_dict.py +32 -37
- telegrinder/tools/loop_wrapper/__init__.py +4 -4
- telegrinder/tools/loop_wrapper/abc.py +20 -15
- telegrinder/tools/loop_wrapper/loop_wrapper.py +169 -224
- telegrinder/tools/magic.py +307 -157
- telegrinder/tools/parse_mode.py +6 -6
- telegrinder/tools/state_storage/__init__.py +4 -4
- telegrinder/tools/state_storage/abc.py +31 -35
- telegrinder/tools/state_storage/memory.py +25 -25
- telegrinder/tools/strings.py +13 -0
- telegrinder/types/__init__.py +268 -260
- telegrinder/types/enums.py +711 -701
- telegrinder/types/input_file.py +51 -0
- telegrinder/types/methods.py +5055 -4633
- telegrinder/types/objects.py +7058 -6950
- telegrinder/verification_utils.py +30 -32
- {telegrinder-0.3.4.dist-info → telegrinder-0.4.0.dist-info}/LICENSE +22 -22
- telegrinder-0.4.0.dist-info/METADATA +144 -0
- telegrinder-0.4.0.dist-info/RECORD +182 -0
- {telegrinder-0.3.4.dist-info → telegrinder-0.4.0.dist-info}/WHEEL +1 -1
- telegrinder/bot/rules/adapter/__init__.py +0 -17
- telegrinder/bot/rules/adapter/abc.py +0 -31
- telegrinder/node/message.py +0 -14
- telegrinder/node/update.py +0 -15
- telegrinder/tools/formatting/links.py +0 -38
- telegrinder/tools/kb_set/__init__.py +0 -4
- telegrinder/tools/kb_set/base.py +0 -15
- telegrinder/tools/kb_set/yaml.py +0 -63
- telegrinder-0.3.4.dist-info/METADATA +0 -110
- telegrinder-0.3.4.dist-info/RECORD +0 -165
|
@@ -1,32 +1,30 @@
|
|
|
1
|
-
import hashlib
|
|
2
|
-
import hmac
|
|
3
|
-
import typing
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
def verify_webapp_request(
|
|
7
|
-
secret_token: str,
|
|
8
|
-
request_headers: typing.Mapping[str, typing.Any],
|
|
9
|
-
) -> bool:
|
|
10
|
-
"""Verifies update request is from telegram."""
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
).
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
__all__ = ("verify_webapp_request", "webapp_validate_request")
|
|
1
|
+
import hashlib
|
|
2
|
+
import hmac
|
|
3
|
+
import typing
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def verify_webapp_request(
|
|
7
|
+
secret_token: str,
|
|
8
|
+
request_headers: typing.Mapping[str, typing.Any],
|
|
9
|
+
) -> bool:
|
|
10
|
+
"""Verifies update request is from telegram."""
|
|
11
|
+
return request_headers.get("X-Telegram-Bot-Api-Secret-Token") == secret_token
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def webapp_validate_request(
|
|
15
|
+
bot_token: str,
|
|
16
|
+
request_query_params: typing.Mapping[str, typing.Any],
|
|
17
|
+
) -> bool:
|
|
18
|
+
"""Verifies authentity of webapp request by counting hash of its parameters."""
|
|
19
|
+
items = sorted(request_query_params.items(), key=lambda kv: kv[0])
|
|
20
|
+
data_check_string = "\n".join(f"{k}={param}" for k, param in items if k != "hash")
|
|
21
|
+
secret = hmac.new(
|
|
22
|
+
"WebAppData".encode(),
|
|
23
|
+
bot_token.encode(),
|
|
24
|
+
hashlib.sha256,
|
|
25
|
+
).digest()
|
|
26
|
+
data_chk = hmac.new(secret, data_check_string.encode(), hashlib.sha256)
|
|
27
|
+
return data_chk.hexdigest() == request_query_params.get("hash")
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
__all__ = ("verify_webapp_request", "webapp_validate_request")
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2022-
|
|
4
|
-
Copyright (c) 2024 luwqz1
|
|
5
|
-
|
|
6
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
-
in the Software without restriction, including without limitation the rights
|
|
9
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
-
furnished to do so, subject to the following conditions:
|
|
12
|
-
|
|
13
|
-
The above copyright notice and this permission notice shall be included in all
|
|
14
|
-
copies or substantial portions of the Software.
|
|
15
|
-
|
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022-2025 timoniq
|
|
4
|
+
Copyright (c) 2024-2025 luwqz1
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
SOFTWARE.
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: telegrinder
|
|
3
|
+
Version: 0.4.0
|
|
4
|
+
Summary: Modern visionary telegram bot framework.
|
|
5
|
+
License: MIT License
|
|
6
|
+
|
|
7
|
+
Copyright (c) 2022-2025 timoniq
|
|
8
|
+
Copyright (c) 2024-2025 luwqz1
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in all
|
|
18
|
+
copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
+
SOFTWARE.
|
|
27
|
+
Keywords: asyncio,api schema,async,bot building,bot api,custom rules,telegram,telegram bot api framework,telegrinder framework,middleware,composition,framework,telegrinder,waiter machine
|
|
28
|
+
Author: timoniq
|
|
29
|
+
Author-email: tesseradecades@mail.ru
|
|
30
|
+
Maintainer: luwqz1
|
|
31
|
+
Maintainer-email: howluwqz1@gmail.com
|
|
32
|
+
Requires-Python: >=3.12,<4.0
|
|
33
|
+
Classifier: Environment :: Console
|
|
34
|
+
Classifier: Intended Audience :: Developers
|
|
35
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
36
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
37
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
38
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
39
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
40
|
+
Classifier: Typing :: Typed
|
|
41
|
+
Provides-Extra: all
|
|
42
|
+
Provides-Extra: fast
|
|
43
|
+
Provides-Extra: loguru
|
|
44
|
+
Provides-Extra: uvloop
|
|
45
|
+
Requires-Dist: aiohttp (>=3.11.11,<4.0.0)
|
|
46
|
+
Requires-Dist: certifi (>=2025.1.31)
|
|
47
|
+
Requires-Dist: choicelib (>=0.1.5,<0.2.0)
|
|
48
|
+
Requires-Dist: colorama (>=0.4.6,<0.5.0)
|
|
49
|
+
Requires-Dist: envparse (>=0.2.0,<0.3.0)
|
|
50
|
+
Requires-Dist: fntypes (>=0.1.4.post3,<0.2.0)
|
|
51
|
+
Requires-Dist: loguru (>=0.7.0) ; extra == "all"
|
|
52
|
+
Requires-Dist: loguru (>=0.7.0) ; extra == "loguru"
|
|
53
|
+
Requires-Dist: msgspec (>=0.19.0,<0.20.0)
|
|
54
|
+
Requires-Dist: pyyaml (>=6.0.2,<7.0.0)
|
|
55
|
+
Requires-Dist: typing-extensions (>=4.12.2,<5.0.0)
|
|
56
|
+
Requires-Dist: uvloop (>=0.21.0) ; extra == "all"
|
|
57
|
+
Requires-Dist: uvloop (>=0.21.0) ; extra == "fast"
|
|
58
|
+
Requires-Dist: uvloop (>=0.21.0) ; extra == "uvloop"
|
|
59
|
+
Requires-Dist: vbml (>=1.1.post1,<2.0)
|
|
60
|
+
Project-URL: Bug Tracker, https://github.com/timoniq/telegrinder/issues
|
|
61
|
+
Project-URL: Documentation, https://telegrinder.readthedocs.io/en/latest/
|
|
62
|
+
Project-URL: Source, https://github.com/timoniq/telegrinder
|
|
63
|
+
Description-Content-Type: text/markdown
|
|
64
|
+
|
|
65
|
+
# Telegrinder
|
|
66
|
+
|
|
67
|
+
Framework for effective and reliable telegram bot building.
|
|
68
|
+
|
|
69
|
+
Still in development.
|
|
70
|
+
|
|
71
|
+
* Type hinted
|
|
72
|
+
* Customizable and extensible
|
|
73
|
+
* Ready to use scenarios and rules
|
|
74
|
+
* Fast models built on [msgspec](https://github.com/jcrist/msgspec)
|
|
75
|
+
* Both low-level and high-level API
|
|
76
|
+
* Support [optional dependecies](https://github.com/timoniq/telegrinder/blob/dev/docs/guide/optional_dependencies.md)
|
|
77
|
+
|
|
78
|
+
# Getting started
|
|
79
|
+
|
|
80
|
+
Install using pip:
|
|
81
|
+
|
|
82
|
+
```console
|
|
83
|
+
pip install telegrinder
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Using poetry:
|
|
87
|
+
|
|
88
|
+
```console
|
|
89
|
+
poetry add telegrinder
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Install from github:
|
|
93
|
+
|
|
94
|
+
```console
|
|
95
|
+
pip install -U https://github.com/timoniq/telegrinder/archive/dev.zip
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
```console
|
|
99
|
+
poetry add git+https://github.com/timoniq/telegrinder.git#dev
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Basic example:
|
|
103
|
+
|
|
104
|
+
```python
|
|
105
|
+
from telegrinder import API, Message, Telegrinder, Token
|
|
106
|
+
from telegrinder.modules import logger
|
|
107
|
+
from telegrinder.rules import Text
|
|
108
|
+
|
|
109
|
+
api = API(token=Token("123:token"))
|
|
110
|
+
bot = Telegrinder(api)
|
|
111
|
+
logger.set_level("INFO")
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
@bot.on.message(Text("/start"))
|
|
115
|
+
async def start(message: Message):
|
|
116
|
+
me = (await api.get_me()).unwrap()
|
|
117
|
+
await message.answer(f"Hello, {message.from_user.full_name}! I'm {me.full_name}.")
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
bot.run_forever()
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
# Documentation
|
|
124
|
+
|
|
125
|
+
[Readthedocs](https://telegrinder.readthedocs.io)
|
|
126
|
+
|
|
127
|
+
# Community
|
|
128
|
+
|
|
129
|
+
Join our [telegram forum](https://t.me/botoforum).
|
|
130
|
+
|
|
131
|
+
# [Contributing](https://github.com/timoniq/telegrinder/blob/main/contributing.md)
|
|
132
|
+
|
|
133
|
+
# License
|
|
134
|
+
|
|
135
|
+
Telegrinder is [MIT licensed](./LICENSE)\
|
|
136
|
+
Copyright © 2022-2025 [timoniq](https://github.com/timoniq)\
|
|
137
|
+
Copyright © 2024-2025 [luwqz1](https://github.com/luwqz1)
|
|
138
|
+
|
|
139
|
+
# Contributors
|
|
140
|
+
|
|
141
|
+
<a href="https://github.com/timoniq/telegrinder/graphs/contributors">
|
|
142
|
+
<img src="https://contributors-img.web.app/image?repo=timoniq/telegrinder" />
|
|
143
|
+
</a>
|
|
144
|
+
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
telegrinder/__init__.py,sha256=4z_tgGLiF8GxKmnxmny6yu4J9iGclNtW17cQmooYhj0,5933
|
|
2
|
+
telegrinder/api/__init__.py,sha256=RuqIF0RsCEGZth6Nc8_6lOYxr9e50Bx5OiR212U3XwU,264
|
|
3
|
+
telegrinder/api/api.py,sha256=DqeSvQcHKVbvkAv7o6r2wCVZM2fcox1DfKHiUWlgggY,3417
|
|
4
|
+
telegrinder/api/error.py,sha256=tYgJtqDakXO2ef_MvhTmNuWALktefpVlyJMfXM0Btg8,440
|
|
5
|
+
telegrinder/api/response.py,sha256=PVTprCDhBBS_8KB5acUs739tfq_SCwZYJ6IB-2sroio,513
|
|
6
|
+
telegrinder/api/token.py,sha256=q2wP2GNy14LdNA3kHBJtSw3-bHZ0ADm_ASesbVWQXSE,951
|
|
7
|
+
telegrinder/bot/__init__.py,sha256=c8vMIjXEOZIuRccrxlRpcpbr-HzvMKxe6HrrIKlH8NM,2945
|
|
8
|
+
telegrinder/bot/bot.py,sha256=jx4ZJHBFSMCTUDgsv0fFocEr6Ti9foEnROB9sYTkyQY,3134
|
|
9
|
+
telegrinder/bot/cute_types/__init__.py,sha256=zytO2K8RuTjlhojRJlfApae9YSOu39GWsAwdffaok-I,746
|
|
10
|
+
telegrinder/bot/cute_types/base.py,sha256=f9ItBY_r4UYGAYmgSsUMXmIcGY9e9oEhn3_1z_djnh8,6417
|
|
11
|
+
telegrinder/bot/cute_types/callback_query.py,sha256=vWnyO7dNJ_7EBYmVwurzDC606RS_99inwP9nK_6gGDo,19499
|
|
12
|
+
telegrinder/bot/cute_types/chat_join_request.py,sha256=LWs8Vta27czrZxFtKu8TkjVE4_n9s7H_OLk6r6tyJh4,2056
|
|
13
|
+
telegrinder/bot/cute_types/chat_member_updated.py,sha256=oVvQ12FSFSL9UC87r7fPuhDv0kOzk7LC8dvXZKKbVus,6251
|
|
14
|
+
telegrinder/bot/cute_types/inline_query.py,sha256=XAz63x7mKaYWVvSJQ7pq_hi5DWw-tiVSiPfj_rqAChc,1550
|
|
15
|
+
telegrinder/bot/cute_types/message.py,sha256=wn1ps4KebSESZ0_PDtdNtRUjCY0KG_XQ-EDsfsh1nMI,145233
|
|
16
|
+
telegrinder/bot/cute_types/pre_checkout_query.py,sha256=y8QgqcvCqVMNmh7JfGQeRYlphH4LF_WAQAwrBPlxWk8,1612
|
|
17
|
+
telegrinder/bot/cute_types/update.py,sha256=4OKBSK0_EgUQTKcHpO5XT4frzhFG84vfQDaADPGTLoM,4181
|
|
18
|
+
telegrinder/bot/cute_types/utils.py,sha256=lt7ycHophjM5A3T20p6PdbO6bXfvKcWOAIsrWJqS9Gc,1563
|
|
19
|
+
telegrinder/bot/dispatch/__init__.py,sha256=agSk03df-VD9Odo8JqfgF8lzW8JWcaXhv3a647hUW0o,2591
|
|
20
|
+
telegrinder/bot/dispatch/abc.py,sha256=8BaLdmupx7Ch0zd5g6jwcTLdidKPFZVaL3kGpzLjpeE,2341
|
|
21
|
+
telegrinder/bot/dispatch/context.py,sha256=-_beXNZ82zpccDOMwO8_WK5_UcXBR6JebnqowOBk570,2727
|
|
22
|
+
telegrinder/bot/dispatch/dispatch.py,sha256=bK0IQeo0UZ_wYJccrNYLTHA481yV1l7OfPyPgYO1V60,7899
|
|
23
|
+
telegrinder/bot/dispatch/handler/__init__.py,sha256=PL17gyh9u9fHHz1yTglyBpRGoioqdMD5UxFAtmTidC0,911
|
|
24
|
+
telegrinder/bot/dispatch/handler/abc.py,sha256=JKLxHaxq9YjBe4xs1_fMYfMRy7U8TJNGtgmbtY0l0Ao,596
|
|
25
|
+
telegrinder/bot/dispatch/handler/audio_reply.py,sha256=MZkWROKdugRcu02-HHq_p8ZsCGxKLkrLJdZmfeOj98g,1340
|
|
26
|
+
telegrinder/bot/dispatch/handler/base.py,sha256=xrM6K4PNxwh37s_L6Y-9M7phaEkU9k1Bx5BQnur8kWE,1780
|
|
27
|
+
telegrinder/bot/dispatch/handler/document_reply.py,sha256=YYcC_4658eN56hlNgGPU2J8WQM6r53TPnHkYpUp4aHQ,1367
|
|
28
|
+
telegrinder/bot/dispatch/handler/func.py,sha256=k96tOnRLjcloKg4vN4grcOmUJXQXZVui58DcgtFeJbE,4980
|
|
29
|
+
telegrinder/bot/dispatch/handler/media_group_reply.py,sha256=57Mqun52VsJblkde8IiSYZF-yBrSwpiqe3nDv0xFsd8,1401
|
|
30
|
+
telegrinder/bot/dispatch/handler/message_reply.py,sha256=E5aH3omcdhxrxe98ysrJcoJtZR7mAYP8T859cS0k3UM,1119
|
|
31
|
+
telegrinder/bot/dispatch/handler/photo_reply.py,sha256=iyfNeCLgn3j6wyEIcJqUyAoUT6kur0DHtbGFLymHEZI,1340
|
|
32
|
+
telegrinder/bot/dispatch/handler/sticker_reply.py,sha256=ihnJtmqMBsFsySNsP7Jzu3hcC09OWhwthvRiCObGHmQ,1185
|
|
33
|
+
telegrinder/bot/dispatch/handler/video_reply.py,sha256=kqwJHxFNQ2_foWzZ59QgX2VEE3yvUlVfwh_sFaFk4Xg,1340
|
|
34
|
+
telegrinder/bot/dispatch/middleware/__init__.py,sha256=znQGQ0jnBioEXr-2RPHOkmDbjei4LEbaTjgiE9c8aXI,96
|
|
35
|
+
telegrinder/bot/dispatch/middleware/abc.py,sha256=CkZc3uW2IAZAFAdb37Cc2ViAe2kfnQ07wubjLDFsPlY,3208
|
|
36
|
+
telegrinder/bot/dispatch/middleware/global_middleware.py,sha256=6k4dY8ax5djqQ0KBlO8F-rK86VGh6sK_VQjMFygQbFI,2523
|
|
37
|
+
telegrinder/bot/dispatch/process.py,sha256=-gZ8BjMti1HXCDQmrnimwOULujJJlk0aKTSpa6QRDHs,4716
|
|
38
|
+
telegrinder/bot/dispatch/return_manager/__init__.py,sha256=ubhWS1MUT0928-KYNZLyM8CKFwTtXoh1QVUf4Xh9V-w,728
|
|
39
|
+
telegrinder/bot/dispatch/return_manager/abc.py,sha256=PK8p2rHNR_7RNIAsFNWbgtN_xfYj_LqDkOA8xQ_1emg,3619
|
|
40
|
+
telegrinder/bot/dispatch/return_manager/callback_query.py,sha256=x7FT1PioR6USsfeyNVyy8mWvP4Vkq-sysIl1OpZm-fI,722
|
|
41
|
+
telegrinder/bot/dispatch/return_manager/inline_query.py,sha256=pM41c53TyPkVY5o5HPBDjgUoyw0w68Kmi9BQcTsXRGc,543
|
|
42
|
+
telegrinder/bot/dispatch/return_manager/message.py,sha256=cLnY3sAJCvVr1iA3GpakwngHrm_5STPMES2ip0VhkuQ,1238
|
|
43
|
+
telegrinder/bot/dispatch/return_manager/pre_checkout_query.py,sha256=M0o1rkNpFNa7m1bATmTC9ZDJCy4eE3e6MnZaknziOw8,735
|
|
44
|
+
telegrinder/bot/dispatch/view/__init__.py,sha256=7nmeWaT94em5IASMUlx8negkZKoOjgm-ap7tya5JAC8,957
|
|
45
|
+
telegrinder/bot/dispatch/view/abc.py,sha256=1uqf0YUxezO4B-ApXBSWk2SErcHtDLvoOEc7flmazV0,1048
|
|
46
|
+
telegrinder/bot/dispatch/view/base.py,sha256=X37M_xjZsgYhcyoorveVLQU57pEtsOGKsT4bBkBwXs8,7587
|
|
47
|
+
telegrinder/bot/dispatch/view/box.py,sha256=WDIBZ24_53KHlDFr6oj17XP0EJLdV0bOoCvBfKVpcPg,5883
|
|
48
|
+
telegrinder/bot/dispatch/view/callback_query.py,sha256=naur6BpqKa_UgYQBHzpeYNUN3q7Gl5r2vpbuNti3MHM,576
|
|
49
|
+
telegrinder/bot/dispatch/view/chat_join_request.py,sha256=Xt_YmuweXJ4XjBJS1wvpIxoJmSigV2m0JCKZ4NbSsFE,356
|
|
50
|
+
telegrinder/bot/dispatch/view/chat_member.py,sha256=OOJeedTPPC5Bf7kpWqXKcblq7aJ7J-SXZwx3I4sNrA4,1160
|
|
51
|
+
telegrinder/bot/dispatch/view/inline_query.py,sha256=gfGidFVGTGvHOIxPpkPVljUMkJJSDa8kiN549tQLKU4,530
|
|
52
|
+
telegrinder/bot/dispatch/view/message.py,sha256=RB75IUCnvodseQ5gyiQY77adWD_OD2E9hzCoz0wZDX8,1373
|
|
53
|
+
telegrinder/bot/dispatch/view/pre_checkout_query.py,sha256=EMEISukuS45J4a_1UH_rRhCyFoaIEEscuXe0s8Me4Mc,578
|
|
54
|
+
telegrinder/bot/dispatch/view/raw.py,sha256=HD1iRuRqNw_6dRa-eO2SGR1j_4E_-AjHYUI07b9RS_E,3858
|
|
55
|
+
telegrinder/bot/dispatch/waiter_machine/__init__.py,sha256=2I3MQpTAVFCHoHJUxAPCWUyasGOkdGSBKRETiTLgBpg,862
|
|
56
|
+
telegrinder/bot/dispatch/waiter_machine/actions.py,sha256=omU5poxjDz9D800Zu4GjXPOW44m4-UqJ8pO9FjRV8iQ,376
|
|
57
|
+
telegrinder/bot/dispatch/waiter_machine/hasher/__init__.py,sha256=nu0WhOWmGkhybOP-faiAFEx1nlYo_N_LW2AuAmbC_Z0,497
|
|
58
|
+
telegrinder/bot/dispatch/waiter_machine/hasher/callback.py,sha256=W-caGejmYBRx-yWdUPH-D54yPPBtESrroNLyVog8e2I,1587
|
|
59
|
+
telegrinder/bot/dispatch/waiter_machine/hasher/hasher.py,sha256=EHBdcAJEeB7_AA0RnLc8JogsEVy82Y-U4kktk3fAs5g,1845
|
|
60
|
+
telegrinder/bot/dispatch/waiter_machine/hasher/message.py,sha256=NoT2BaTrHVnyaaXsXTkf8riJZp8473-T3EXNri4y70I,1253
|
|
61
|
+
telegrinder/bot/dispatch/waiter_machine/hasher/state.py,sha256=D1j8H8XwML0nPPYcDBy9QWM5OAXi3mch5ElUOo7-RmA,677
|
|
62
|
+
telegrinder/bot/dispatch/waiter_machine/machine.py,sha256=uI_tx8VsbVAjHg-NK5ZlGsWVGIyvYcRj2hXTJrkXrKk,9012
|
|
63
|
+
telegrinder/bot/dispatch/waiter_machine/middleware.py,sha256=9uULMp-oF_WSOfU1jQk-D5F1pixmO0i1zj0VdfW5jXc,3075
|
|
64
|
+
telegrinder/bot/dispatch/waiter_machine/short_state.py,sha256=rBLkSgSQvHAO-9XkL5ScAu2gjf42NxOrkJV2tRR64Kk,1739
|
|
65
|
+
telegrinder/bot/polling/__init__.py,sha256=OqfIFPS_V6UrCg-vCv9pkMFzTKdNbDP2faBfATs_TGg,94
|
|
66
|
+
telegrinder/bot/polling/abc.py,sha256=qFiKzWTWENK-sSuShC5cPlM-JS4In2c8-1_ARdwdTms,442
|
|
67
|
+
telegrinder/bot/polling/polling.py,sha256=76YLN_MN85UF69LBNDzihRAz04cnUchtxL8n8SmtoZo,5514
|
|
68
|
+
telegrinder/bot/rules/__init__.py,sha256=KtZgJP3vbSJxqEyOm4b-i5nfMa79LsYkW3ylg0LJVyU,3426
|
|
69
|
+
telegrinder/bot/rules/abc.py,sha256=UE4lMr7jMQ5g3upnRR6sOxlOPydu-ZsAIcPXrnRlthg,6721
|
|
70
|
+
telegrinder/bot/rules/callback_data.py,sha256=I8k2ih0uQ4S6TbebGp8_se9edR2YBjIepgBYCZtHCPE,4379
|
|
71
|
+
telegrinder/bot/rules/chat_join.py,sha256=Tk3XQntpEkibb0g1dft6YmPD7pg9EH_w1IzMAkOmdrY,1355
|
|
72
|
+
telegrinder/bot/rules/command.py,sha256=Ppp2ewM6IF07tX8ik5XbObv1UllhA4RNIEgUQhFPreM,3898
|
|
73
|
+
telegrinder/bot/rules/enum_text.py,sha256=RmamlxJ_rRHbcHXbjfOkeseSZo2uPVS8E07btdqxAAI,907
|
|
74
|
+
telegrinder/bot/rules/func.py,sha256=r1ftBgIA9a_oTCx2IWTPmf2-ZvoMNJVTcYFjoOHsy1w,844
|
|
75
|
+
telegrinder/bot/rules/fuzzy.py,sha256=SmJkL9nKL64OGj8OziHDgkKQcpQNq-Gt8hXnEmovFZ0,673
|
|
76
|
+
telegrinder/bot/rules/id.py,sha256=B5A4gIqe54gnpjerJRm7coRANBbh6rjY1mUcoqeU0Rg,591
|
|
77
|
+
telegrinder/bot/rules/inline.py,sha256=Sm-FGkOf_k_NtlxmdKrXzLLGIMq67K5wwScd-9FA5Eg,1912
|
|
78
|
+
telegrinder/bot/rules/integer.py,sha256=Hjn-tC775-OSYb58Z3a1IT4XsESiLl1YDKy-tsEZjVM,480
|
|
79
|
+
telegrinder/bot/rules/is_from.py,sha256=_ZFdPg6zAsXJ8Cb-sjcRc9fsonzmvGJvh-5Fca2JPTI,3700
|
|
80
|
+
telegrinder/bot/rules/logic.py,sha256=38zsHIyQa2jdBHxQBrppwi1-LJKkYmtnTlFoQKatlC8,598
|
|
81
|
+
telegrinder/bot/rules/markup.py,sha256=vi1n7rrzzTD5YW-wd5yCelV7thVZoMVH5HZsMI7RCh8,1360
|
|
82
|
+
telegrinder/bot/rules/mention.py,sha256=u5VQbEwb1BuYmXMLE0bxLde4fDcvEGCq3JAg0dhuaN8,429
|
|
83
|
+
telegrinder/bot/rules/message.py,sha256=lozu87O7-GbsZrhC9F-AqBa4Nlemr9WfCnjzG2lgPfM,420
|
|
84
|
+
telegrinder/bot/rules/message_entities.py,sha256=ALWS6mgWWvu0NxmRHRt85c0jrcI8FT39oYWqL11fV5E,1057
|
|
85
|
+
telegrinder/bot/rules/node.py,sha256=5n8lGOfNX9hVzpuzmRQDDzsI403Kyc2xiCXSyDbnYK8,1013
|
|
86
|
+
telegrinder/bot/rules/payload.py,sha256=8shfNd7q34q_peSPCllauJOkeVw21HPCrfY2UV-vFhI,2581
|
|
87
|
+
telegrinder/bot/rules/payment_invoice.py,sha256=h3G4BdgFa2huo9H3vdigZ2iUkzQc7spfpySAqH58aOo,901
|
|
88
|
+
telegrinder/bot/rules/regex.py,sha256=OlU_uVlLGsooYs7oA5K-XJ3Gns5jslqveNilDK6FHi8,1165
|
|
89
|
+
telegrinder/bot/rules/rule_enum.py,sha256=35GwPKLBTG_ESn4TZLcFJTLNjYXAi_d9wrfIDexoEH8,2113
|
|
90
|
+
telegrinder/bot/rules/start.py,sha256=AipwfOQ2LGCofvgouRmkIiY9mGFLlEUJ-7a3CLIiy4Q,1147
|
|
91
|
+
telegrinder/bot/rules/state.py,sha256=T0pMFprklUIHKHD-1Gwksn0f8chRHS_MfBjyiNamMLc,922
|
|
92
|
+
telegrinder/bot/rules/text.py,sha256=S-gnf38Kk2KBOf7JLK_AsFU8WvRSK8m4Q_1Rq_v2B74,1171
|
|
93
|
+
telegrinder/bot/rules/update.py,sha256=-mE12-xy0AjOz9RVRVZ8vS7ohGCuf_bNmG26rDbrjfg,392
|
|
94
|
+
telegrinder/bot/scenario/__init__.py,sha256=nnPjdxdvjoEYYMRUEfWvIhZStiY1C984x1azdRRP9II,136
|
|
95
|
+
telegrinder/bot/scenario/abc.py,sha256=ZjcHJyVuUeNKHIHWd_3bNBxuklNMLM-HsBadLnDVzm8,409
|
|
96
|
+
telegrinder/bot/scenario/checkbox.py,sha256=4vfpbRMUFxa06ZKfYcIsVOH6-UWhAn4MjhmU9kGOVAc,5174
|
|
97
|
+
telegrinder/bot/scenario/choice.py,sha256=zBNbbx8NfFak3KU7QpFHmcoLkdakrahlXZ-yOJvdmw4,1770
|
|
98
|
+
telegrinder/client/__init__.py,sha256=2TfRdGAokRyuQhwu09u0KAXc9cLIch9WJtBIjgj49yg,281
|
|
99
|
+
telegrinder/client/abc.py,sha256=rEDgfuo8dufkCY5o9ijgDawAmEuhzGDNj9WrdqUUMA8,2431
|
|
100
|
+
telegrinder/client/aiohttp.py,sha256=v5R-WZS8AwaypHsY12jT6VbI9GN763O0y69DYA3qZZ0,3932
|
|
101
|
+
telegrinder/client/form_data.py,sha256=XpSrM6b42lnoUDR7rnFko7agDzjnuChrCyjp-cACGHE,689
|
|
102
|
+
telegrinder/client/sonic.py,sha256=MZ1ZdVUlwoXkKrfzaV08n4q0M3IYfHKd3UGttVcfK8g,6523
|
|
103
|
+
telegrinder/model.py,sha256=CrN2XOMG_rPFN5jF-QQeNGyepwT3DuBzWLm7oqIMajI,6106
|
|
104
|
+
telegrinder/modules.py,sha256=XcEIjz67xAKcYQfNVIm4VfidMa3M43iDcfUaX6QKFX8,7826
|
|
105
|
+
telegrinder/msgspec_json.py,sha256=eDuRTP_bFYWtNPDINuzY2OGKXbdleaKyXh2mQgfJdMk,237
|
|
106
|
+
telegrinder/msgspec_utils.py,sha256=AbaBcKJWLqjzYtORSDzCuMHpOKEDBxFtcTrAX4L6REE,14339
|
|
107
|
+
telegrinder/node/__init__.py,sha256=WbargilSBjZHE1CUKZzbjZpZx5hl_XOw565Ecy4PRCk,2268
|
|
108
|
+
telegrinder/node/attachment.py,sha256=ocSUsqnPJEIq5aaj5-xKbKmoifnoA1fhlp2brZLJgXY,4857
|
|
109
|
+
telegrinder/node/base.py,sha256=xlqwSPuwDc5FCr-1cJkAafW2_NlZm0o2nAQI7_wYPsQ,8249
|
|
110
|
+
telegrinder/node/callback_query.py,sha256=mcB1mTC20ycwrdV-xjsp0OP7Hgh4umQM8Lb8p4wbHe0,1576
|
|
111
|
+
telegrinder/node/command.py,sha256=0uK1hdAIuTmtKguvUDM39nyLpTV6h_xlIkBytaiSdyc,976
|
|
112
|
+
telegrinder/node/composer.py,sha256=pWFlzQOPxh02qL_fAu8EdpUfADorxxiev-CTX6X6GwM,5602
|
|
113
|
+
telegrinder/node/container.py,sha256=xtPMsPhfXUQAnS-sEvUKPhT-a3pkvUXOUjyD8gJKG_Y,1118
|
|
114
|
+
telegrinder/node/either.py,sha256=waeBVmi5SrZIGQ0xSR633xcnCgZ3MvwIweM11DhocCU,2905
|
|
115
|
+
telegrinder/node/event.py,sha256=KItU-Pf7mT-ztTnVethqd63hkwwOTnqB6smasxRwk00,1842
|
|
116
|
+
telegrinder/node/file.py,sha256=88fS9tDfGpElrqEb1ejY-kpfc0dPkgZMHFNN_wpavO8,1430
|
|
117
|
+
telegrinder/node/me.py,sha256=mBP1i1Jto0XMS9ZYgfRtte9QPfrak0ARgBDJvGQ6CX4,414
|
|
118
|
+
telegrinder/node/payload.py,sha256=Z3rjzux4oB6OKNK0kB7JALp6hclxF174N8WUj3l6FnE,2706
|
|
119
|
+
telegrinder/node/polymorphic.py,sha256=EJ25etzPtlfJa0p4oufPvb2jZJ7d9-zq-PI7zkDrQpQ,2621
|
|
120
|
+
telegrinder/node/rule.py,sha256=pwCHC7Z2IRR-q7ewDB_cjCmbYJsdkftF0QD4r889HQs,2381
|
|
121
|
+
telegrinder/node/scope.py,sha256=tq9TyKyUeiRl0WpAyBAVTBdF9pKC_z0X0MxuxwLBQ8M,734
|
|
122
|
+
telegrinder/node/source.py,sha256=pUBICRo8bkcgzdUW60cy6fsmjAZGv2efBhaQWHTp2Y0,2691
|
|
123
|
+
telegrinder/node/text.py,sha256=vx9gQscBAqwG0e5zm9p1bt6D7yMnp1JS_NWbuZe4Rrw,1379
|
|
124
|
+
telegrinder/node/tools/__init__.py,sha256=iyjs82g3brYGzpPsUQaoK6_r7YuQhRkJ61YjjuPOx9E,67
|
|
125
|
+
telegrinder/node/tools/generator.py,sha256=4zbAASQmSJGiEPBWbHh1F0mXJrCuc4oXHI-kB51I3qQ,973
|
|
126
|
+
telegrinder/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
127
|
+
telegrinder/rules.py,sha256=BFB8RFwKKxqs9HFfo_p0RfulQNonPZAX8cHpmnG7qCU,39
|
|
128
|
+
telegrinder/tools/__init__.py,sha256=Kz1VABWRQqT50bt5c9U85Ot9VWd5NSBh8MdQV7pzi5Q,4444
|
|
129
|
+
telegrinder/tools/adapter/__init__.py,sha256=ZOnQl0uu7UGshKKopH5ZkFtg5N-LMrI8FXwIVTMuNDw,633
|
|
130
|
+
telegrinder/tools/adapter/abc.py,sha256=vq1Q8PzdjtkiJPtjuFg9UJJxcnlvaABlUxTy4NCGOOw,1333
|
|
131
|
+
telegrinder/tools/adapter/dataclass.py,sha256=x6xAjHB8CngwhDbOxIupgzusiP0RXtRH2z4diz4drm8,2232
|
|
132
|
+
telegrinder/tools/adapter/errors.py,sha256=2r_UBTWm5-heU-NchBfobC1f848EWeC64nKvprGnAAY,73
|
|
133
|
+
telegrinder/tools/adapter/event.py,sha256=H-V43ghLAmwjhChfk-AwMHAm_-TlWOQlYgkoU34WRbs,2393
|
|
134
|
+
telegrinder/tools/adapter/node.py,sha256=APX_hXf5R16vPULvfUlhh9jr9X4q_aFSyItDKstlXdM,1572
|
|
135
|
+
telegrinder/tools/adapter/raw_event.py,sha256=Ve2ziMogw533B8K_DXRBpqQGnjnjGFXu7qeYiF-stc0,975
|
|
136
|
+
telegrinder/tools/adapter/raw_update.py,sha256=o-posiO4C_YRMi2KXYGjRKdKJM0wOke90x5aYPB9ZGE,997
|
|
137
|
+
telegrinder/tools/buttons.py,sha256=Ez99XgIcg4_6mtdDvkN0Uq4VkcpgcGE1cufSitXe61A,3904
|
|
138
|
+
telegrinder/tools/callback_data_serilization/__init__.py,sha256=mavF_sXLzhcF2xZ00Z2_jbKzAc2xx4xDUTCMNJUJL8I,187
|
|
139
|
+
telegrinder/tools/callback_data_serilization/abc.py,sha256=OgzpVKw12kbabTxzoNid0a1mrjb1GYvYyYp0BU4TYik,1232
|
|
140
|
+
telegrinder/tools/callback_data_serilization/json_ser.py,sha256=gjgOJMcTmahqZUEOjZatgsqmSFi7BAyOy20FErmlxJE,1952
|
|
141
|
+
telegrinder/tools/callback_data_serilization/msgpack_ser.py,sha256=BREZllzEFuILtWIx46moImpOgrNK3BB2K-oGHhQ5Htw,6972
|
|
142
|
+
telegrinder/tools/error_handler/__init__.py,sha256=WmYWZCNhhSk32j4lIOltEwzoYUx086TGTbOF5h3Ps7s,207
|
|
143
|
+
telegrinder/tools/error_handler/abc.py,sha256=0SJoKDRKFLn83tXvjIFYEm_OWoYt4kWg2v7zCn-5vYo,771
|
|
144
|
+
telegrinder/tools/error_handler/error.py,sha256=uLcG-wqyOeCEB45m8vMcGy5kZ87bGHUS_-fPw2cGE9s,221
|
|
145
|
+
telegrinder/tools/error_handler/error_handler.py,sha256=bvCPnoTQpIB2nbTMp8YtfN2G6ROVd5VvWiumULVJm8s,5897
|
|
146
|
+
telegrinder/tools/formatting/__init__.py,sha256=-OwOBkYwg3Dj7fL5gKpTSMDLb2rRmLHWt1DgsswFORY,2162
|
|
147
|
+
telegrinder/tools/formatting/deep_links.py,sha256=o9bE3sADuTt_DluGR6yqQ3GLBFxXODeI1r3LUqEReDU,19576
|
|
148
|
+
telegrinder/tools/formatting/html_formatter.py,sha256=5r2lryBksrarn9Ejt4mp_0ZZHd8CX310Six82wn1BjM,7854
|
|
149
|
+
telegrinder/tools/formatting/spec_html_formats.py,sha256=YyppEtrgwRTrjK8h5nwIIYaPQXGovYEXarMpk5EPNKs,1542
|
|
150
|
+
telegrinder/tools/functional.py,sha256=pkCVxLIyOLlO-hVtT5xz7LLFdLFbwQ7a0NTqhLV2jJs,201
|
|
151
|
+
telegrinder/tools/global_context/__init__.py,sha256=5pF9growKd28WO739wk_DZUqCDw5hxs6eUcDtxTosX8,290
|
|
152
|
+
telegrinder/tools/global_context/abc.py,sha256=twwAmbTk49KGl_POImr4yj6POr-zdx8mz74McuphZH0,1644
|
|
153
|
+
telegrinder/tools/global_context/global_context.py,sha256=ddKLJyyczORxqb3AbAGG6YeYfV2mL55TNehG6NZMk_E,13626
|
|
154
|
+
telegrinder/tools/global_context/telegrinder_ctx.py,sha256=lEbJqgC0Ex3Cgeu3ufqbD-iVlGRNiB37N1Hto3wmf0Y,707
|
|
155
|
+
telegrinder/tools/i18n/__init__.py,sha256=jMrrdFexgMU-BUiKf-p22VowQaqtQeaCb-Cs0fq2Tls,287
|
|
156
|
+
telegrinder/tools/i18n/abc.py,sha256=jxJVYiTplJaNeklkGiin-m7BkfZiac2fbVXTEdhNw6o,726
|
|
157
|
+
telegrinder/tools/i18n/middleware/__init__.py,sha256=a0yJUYmDbl1Mqf_cWx2TTmA3_Andlk8ixLJyDYAA23I,81
|
|
158
|
+
telegrinder/tools/i18n/middleware/abc.py,sha256=RQLDDEGXseaf2E4XGvtof_2CxhOzHnMLXMvhb6PkWg8,701
|
|
159
|
+
telegrinder/tools/i18n/simple.py,sha256=w2SlMKYqJbDK9ScTwCAB6pdskqwtmqV7pK8yEhSUFDA,1564
|
|
160
|
+
telegrinder/tools/input_file_directory.py,sha256=F77qMxG7reK8VX6rnHKbYZhzQAzw229Q20K8q0CF0cw,839
|
|
161
|
+
telegrinder/tools/keyboard.py,sha256=BvxGs6RvXpqbWBEUVqKKij-Nw4acgXpH7u7fU_N9rP0,3791
|
|
162
|
+
telegrinder/tools/lifespan.py,sha256=2-vGm8Jb9Hpx0mvhWRpSvIRiibtAPJnYSQuAE-QEo-A,3199
|
|
163
|
+
telegrinder/tools/limited_dict.py,sha256=ySot8-lVd0XkRcxl_R9dvTb0g8OfspsbSXQdlB7mVgo,1039
|
|
164
|
+
telegrinder/tools/loop_wrapper/__init__.py,sha256=ZQ5jmE1lOKnqJlMZ9k2OYmjvOEhOlHPijUWqZ4nHIgk,165
|
|
165
|
+
telegrinder/tools/loop_wrapper/abc.py,sha256=aZG2OGoQKLUxeO6WZ_gluFAjRHubeMfKxmKeIG7isYI,383
|
|
166
|
+
telegrinder/tools/loop_wrapper/loop_wrapper.py,sha256=t31AYkk1S_uyoq4MJMQCkoC6_fSvfON3NjBBKEuQy5U,5160
|
|
167
|
+
telegrinder/tools/magic.py,sha256=hDarnKUfo3bzbPQSAttt4BY3wyT0KJ8a1nyXNNTJmlE,9295
|
|
168
|
+
telegrinder/tools/parse_mode.py,sha256=JyQ-x9YAMPLhIIiUX01acyKkpWgs5TBA07W-iUyPHpE,92
|
|
169
|
+
telegrinder/tools/state_storage/__init__.py,sha256=G2EK2HwS0NbRQIu0OotVlgEYtO_GuzN1aJOIxmDEtz4,211
|
|
170
|
+
telegrinder/tools/state_storage/abc.py,sha256=GufeznJI1AF2Cl0D6J3MW94UvsL_QHuOnlEc1lqQNss,878
|
|
171
|
+
telegrinder/tools/state_storage/memory.py,sha256=nbCHHhN3YmjvnbrS_5cLvwrkuJgFA0qGVuAsqhBGNyY,740
|
|
172
|
+
telegrinder/tools/strings.py,sha256=rb8tAmEqkkJnEAIVqME1LpV4GICBZ2IbfUJ_nd7F2Mo,285
|
|
173
|
+
telegrinder/types/__init__.py,sha256=9uF3fmerYcpt0B_3ycj-2AoAv-KVShlUAAaePo65wfY,6844
|
|
174
|
+
telegrinder/types/enums.py,sha256=xK3_4GrM5U3mIezwgzvu-C7Xx_GUQqfQRGEDPaURiec,19060
|
|
175
|
+
telegrinder/types/input_file.py,sha256=xwzag5QvhAUAraw_qeoOQjG6Qqf72GLtQKbHB6VUblI,1440
|
|
176
|
+
telegrinder/types/methods.py,sha256=D45Ou7BrNRqCGRGpatBnMGoM7ZbsXTHq42EBb7ZasrM,219112
|
|
177
|
+
telegrinder/types/objects.py,sha256=jZCyM1-A6msV9XZQcVqVN-pEh_P1qw62kj2Xh-caycU,299955
|
|
178
|
+
telegrinder/verification_utils.py,sha256=Tp-XEp5nu4ih67jbrgU5USSNRgzlILMrfKgfGENYBtg,985
|
|
179
|
+
telegrinder-0.4.0.dist-info/LICENSE,sha256=mKmh92w0b8JKW6Z72AJ00ZtKS_9ZhTH7uevlEspyVD4,1100
|
|
180
|
+
telegrinder-0.4.0.dist-info/METADATA,sha256=QAxTK-_--RbCTfR9tKXFSx9bg9g3qXKfsTV1VuBXdic,4879
|
|
181
|
+
telegrinder-0.4.0.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
|
|
182
|
+
telegrinder-0.4.0.dist-info/RECORD,,
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
from telegrinder.bot.rules.adapter.abc import ABCAdapter, AdaptResult, Event
|
|
2
|
-
from telegrinder.bot.rules.adapter.errors import AdapterError
|
|
3
|
-
from telegrinder.bot.rules.adapter.event import EventAdapter
|
|
4
|
-
from telegrinder.bot.rules.adapter.node import NodeAdapter
|
|
5
|
-
from telegrinder.bot.rules.adapter.raw_event import RawEventAdapter
|
|
6
|
-
from telegrinder.bot.rules.adapter.raw_update import RawUpdateAdapter
|
|
7
|
-
|
|
8
|
-
__all__ = (
|
|
9
|
-
"ABCAdapter",
|
|
10
|
-
"AdaptResult",
|
|
11
|
-
"AdapterError",
|
|
12
|
-
"Event",
|
|
13
|
-
"EventAdapter",
|
|
14
|
-
"NodeAdapter",
|
|
15
|
-
"RawEventAdapter",
|
|
16
|
-
"RawUpdateAdapter",
|
|
17
|
-
)
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import abc
|
|
2
|
-
import dataclasses
|
|
3
|
-
import typing
|
|
4
|
-
|
|
5
|
-
from fntypes.result import Result
|
|
6
|
-
|
|
7
|
-
from telegrinder.api.api import API
|
|
8
|
-
from telegrinder.bot.dispatch.context import Context
|
|
9
|
-
from telegrinder.bot.rules.adapter.errors import AdapterError
|
|
10
|
-
from telegrinder.model import Model
|
|
11
|
-
|
|
12
|
-
From = typing.TypeVar("From", bound=Model)
|
|
13
|
-
To = typing.TypeVar("To")
|
|
14
|
-
|
|
15
|
-
AdaptResult: typing.TypeAlias = Result[To, AdapterError] | typing.Awaitable[Result[To, AdapterError]]
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
class ABCAdapter(abc.ABC, typing.Generic[From, To]):
|
|
19
|
-
ADAPTED_VALUE_KEY: str | None = None
|
|
20
|
-
|
|
21
|
-
@abc.abstractmethod
|
|
22
|
-
def adapt(self, api: API, update: From, context: Context) -> AdaptResult[To]:
|
|
23
|
-
pass
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
@dataclasses.dataclass(slots=True)
|
|
27
|
-
class Event(typing.Generic[To]):
|
|
28
|
-
obj: To
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
__all__ = ("ABCAdapter", "AdaptResult", "Event")
|
telegrinder/node/message.py
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
from telegrinder.bot.cute_types.message import MessageCute
|
|
2
|
-
from telegrinder.node.base import ComposeError, ScalarNode
|
|
3
|
-
from telegrinder.node.update import UpdateNode
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
class MessageNode(ScalarNode, MessageCute):
|
|
7
|
-
@classmethod
|
|
8
|
-
def compose(cls, update: UpdateNode) -> MessageCute:
|
|
9
|
-
if not update.message:
|
|
10
|
-
raise ComposeError("Update is not a message.")
|
|
11
|
-
return update.message.unwrap()
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
__all__ = ("MessageNode",)
|
telegrinder/node/update.py
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
from telegrinder.api.api import API
|
|
2
|
-
from telegrinder.bot.cute_types import UpdateCute
|
|
3
|
-
from telegrinder.node.base import ScalarNode
|
|
4
|
-
from telegrinder.types.objects import Update
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
class UpdateNode(ScalarNode, UpdateCute):
|
|
8
|
-
@classmethod
|
|
9
|
-
def compose(cls, update: Update, api: API) -> UpdateCute:
|
|
10
|
-
if isinstance(update, UpdateCute):
|
|
11
|
-
return update
|
|
12
|
-
return UpdateCute.from_update(update, api)
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
__all__ = ("UpdateNode",)
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
def get_mention_link(user_id: int) -> str:
|
|
2
|
-
return f"tg://user?id={user_id}"
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
def get_resolve_domain_link(username: str) -> str:
|
|
6
|
-
return f"tg://resolve?domain={username}"
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
def get_start_bot_link(bot_id: str | int, data: str) -> str:
|
|
10
|
-
if isinstance(bot_id, int):
|
|
11
|
-
return get_mention_link(bot_id) + f"&start={data}"
|
|
12
|
-
return get_resolve_domain_link(bot_id) + f"&start={data}"
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
def get_start_group_link(bot_id: str | int, data: str) -> str:
|
|
16
|
-
if isinstance(bot_id, int):
|
|
17
|
-
return get_mention_link(bot_id) + f"&startgroup={data}"
|
|
18
|
-
return get_resolve_domain_link(bot_id) + f"&startgroup={data}"
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
def get_channel_boost_link(channel_id: str | int) -> str:
|
|
22
|
-
if isinstance(channel_id, int):
|
|
23
|
-
return get_mention_link(channel_id) + "&boost"
|
|
24
|
-
return get_resolve_domain_link(channel_id) + "&boost"
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
def get_invite_chat_link(invite_link: str) -> str:
|
|
28
|
-
return f"tg://join?invite={invite_link}"
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
__all__ = (
|
|
32
|
-
"get_channel_boost_link",
|
|
33
|
-
"get_invite_chat_link",
|
|
34
|
-
"get_mention_link",
|
|
35
|
-
"get_resolve_domain_link",
|
|
36
|
-
"get_start_bot_link",
|
|
37
|
-
"get_start_group_link",
|
|
38
|
-
)
|
telegrinder/tools/kb_set/base.py
DELETED
telegrinder/tools/kb_set/yaml.py
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import os
|
|
2
|
-
import re
|
|
3
|
-
import typing
|
|
4
|
-
|
|
5
|
-
import yaml
|
|
6
|
-
|
|
7
|
-
from telegrinder.tools.keyboard import InlineKeyboard, Keyboard
|
|
8
|
-
|
|
9
|
-
from .base import KeyboardSetBase, KeyboardSetError
|
|
10
|
-
|
|
11
|
-
PathLike: typing.TypeAlias = str | os.PathLike[str]
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
class KeyboardSetYAML(KeyboardSetBase):
|
|
15
|
-
__config__: PathLike
|
|
16
|
-
|
|
17
|
-
@classmethod
|
|
18
|
-
def load(cls) -> None:
|
|
19
|
-
config_path = getattr(cls, "__config__", "keyboards.yaml")
|
|
20
|
-
if not os.path.exists(config_path):
|
|
21
|
-
raise FileNotFoundError(f"Config file for {cls.__name__!r} is undefined.")
|
|
22
|
-
|
|
23
|
-
config = yaml.load(
|
|
24
|
-
open( # noqa: SIM115
|
|
25
|
-
str(config_path),
|
|
26
|
-
mode="r",
|
|
27
|
-
encoding="UTF-8",
|
|
28
|
-
),
|
|
29
|
-
yaml.Loader,
|
|
30
|
-
)
|
|
31
|
-
for name, hint in typing.get_type_hints(cls).items():
|
|
32
|
-
g = re.match(r"(?:kb_|keyboard_)(.+)", name.lower())
|
|
33
|
-
if not g:
|
|
34
|
-
continue
|
|
35
|
-
|
|
36
|
-
short_name = g.group(1)
|
|
37
|
-
if short_name not in config:
|
|
38
|
-
raise KeyboardSetError(f"Keyboard {short_name!r} is undefined in config.")
|
|
39
|
-
|
|
40
|
-
kb_config = config[short_name]
|
|
41
|
-
if (
|
|
42
|
-
not isinstance(kb_config, dict)
|
|
43
|
-
or "buttons" not in kb_config
|
|
44
|
-
or not isinstance(kb_config["buttons"], list)
|
|
45
|
-
):
|
|
46
|
-
raise KeyboardSetError(
|
|
47
|
-
"Keyboard should be dict with field buttons which must be a list, " "check documentation."
|
|
48
|
-
)
|
|
49
|
-
|
|
50
|
-
buttons = kb_config.pop("buttons")
|
|
51
|
-
new_keyboard: Keyboard | InlineKeyboard = hint(**kb_config)
|
|
52
|
-
for button in buttons:
|
|
53
|
-
if not button:
|
|
54
|
-
new_keyboard.row()
|
|
55
|
-
continue
|
|
56
|
-
if "text" not in button:
|
|
57
|
-
raise KeyboardSetError("Text is required in button.")
|
|
58
|
-
new_keyboard.add(new_keyboard.BUTTON(**button)) # type: ignore
|
|
59
|
-
|
|
60
|
-
setattr(cls, name, new_keyboard)
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
__all__ = ("KeyboardSetYAML",)
|