telegrinder 0.1.dev158__py3-none-any.whl → 0.1.dev159__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/api/abc.py +4 -4
- telegrinder/api/api.py +25 -11
- telegrinder/bot/cute_types/base.py +100 -9
- telegrinder/bot/cute_types/callback_query.py +421 -28
- telegrinder/bot/cute_types/inline_query.py +13 -13
- telegrinder/bot/cute_types/message.py +2914 -102
- telegrinder/bot/cute_types/update.py +14 -7
- telegrinder/bot/cute_types/utils.py +794 -0
- telegrinder/bot/dispatch/view/abc.py +22 -15
- telegrinder/bot/rules/adapter/event.py +12 -6
- telegrinder/client/__init__.py +2 -2
- telegrinder/client/abc.py +35 -12
- telegrinder/client/aiohttp.py +35 -22
- telegrinder/model.py +70 -22
- telegrinder/modules.py +2 -2
- telegrinder/msgspec_utils.py +28 -8
- telegrinder/tools/__init__.py +0 -27
- telegrinder/tools/buttons.py +19 -5
- telegrinder/types/enums.py +11 -9
- telegrinder/types/methods.py +311 -152
- telegrinder/types/objects.py +109 -67
- {telegrinder-0.1.dev158.dist-info → telegrinder-0.1.dev159.dist-info}/METADATA +3 -2
- {telegrinder-0.1.dev158.dist-info → telegrinder-0.1.dev159.dist-info}/RECORD +25 -25
- {telegrinder-0.1.dev158.dist-info → telegrinder-0.1.dev159.dist-info}/WHEEL +1 -1
- telegrinder/tools/inline_query.py +0 -684
- {telegrinder-0.1.dev158.dist-info → telegrinder-0.1.dev159.dist-info}/LICENSE +0 -0
|
@@ -1,22 +1,29 @@
|
|
|
1
|
+
import typing
|
|
2
|
+
|
|
1
3
|
from fntypes.co import Nothing, Some
|
|
2
4
|
|
|
3
5
|
from telegrinder.api import ABCAPI
|
|
4
6
|
from telegrinder.msgspec_utils import Option
|
|
5
|
-
from telegrinder.types import
|
|
7
|
+
from telegrinder.types import Model, Update
|
|
6
8
|
|
|
7
9
|
from .base import BaseCute
|
|
8
10
|
|
|
11
|
+
ModelT = typing.TypeVar("ModelT", bound=Model)
|
|
12
|
+
|
|
9
13
|
|
|
10
14
|
class UpdateCute(BaseCute[Update], Update, kw_only=True):
|
|
11
15
|
api: ABCAPI
|
|
12
16
|
|
|
13
17
|
@property
|
|
14
|
-
def
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
def incoming_update(self) -> Model:
|
|
19
|
+
return getattr(
|
|
20
|
+
self,
|
|
21
|
+
self.update_type.expect("Update object has no incoming update.").value,
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
def get_event(self, event_model: type[ModelT]) -> Option[ModelT]:
|
|
25
|
+
if isinstance(self.incoming_update, event_model):
|
|
26
|
+
return Some(self.incoming_update)
|
|
20
27
|
return Nothing()
|
|
21
28
|
|
|
22
29
|
|