telegrinder 0.1.dev158__py3-none-any.whl → 0.1.dev160__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 +4 -2
- telegrinder/api/__init__.py +0 -0
- telegrinder/api/abc.py +6 -4
- telegrinder/api/api.py +25 -11
- telegrinder/api/error.py +0 -0
- telegrinder/api/response.py +0 -0
- telegrinder/bot/__init__.py +0 -0
- telegrinder/bot/bot.py +0 -0
- telegrinder/bot/cute_types/__init__.py +0 -0
- telegrinder/bot/cute_types/base.py +100 -9
- telegrinder/bot/cute_types/callback_query.py +426 -37
- telegrinder/bot/cute_types/inline_query.py +44 -17
- telegrinder/bot/cute_types/message.py +2885 -117
- telegrinder/bot/cute_types/update.py +14 -7
- telegrinder/bot/cute_types/utils.py +542 -0
- telegrinder/bot/dispatch/__init__.py +0 -0
- telegrinder/bot/dispatch/abc.py +0 -0
- telegrinder/bot/dispatch/composition.py +0 -0
- telegrinder/bot/dispatch/context.py +0 -0
- telegrinder/bot/dispatch/dispatch.py +0 -0
- telegrinder/bot/dispatch/handler/__init__.py +0 -0
- telegrinder/bot/dispatch/handler/abc.py +0 -0
- telegrinder/bot/dispatch/handler/func.py +1 -1
- telegrinder/bot/dispatch/handler/message_reply.py +0 -0
- telegrinder/bot/dispatch/middleware/__init__.py +0 -0
- telegrinder/bot/dispatch/middleware/abc.py +0 -0
- telegrinder/bot/dispatch/process.py +0 -0
- telegrinder/bot/dispatch/return_manager/__init__.py +0 -0
- telegrinder/bot/dispatch/return_manager/abc.py +0 -0
- telegrinder/bot/dispatch/return_manager/callback_query.py +0 -0
- telegrinder/bot/dispatch/return_manager/inline_query.py +0 -0
- telegrinder/bot/dispatch/return_manager/message.py +0 -0
- telegrinder/bot/dispatch/view/__init__.py +0 -0
- telegrinder/bot/dispatch/view/abc.py +40 -29
- telegrinder/bot/dispatch/view/box.py +0 -0
- telegrinder/bot/dispatch/view/callback_query.py +0 -0
- telegrinder/bot/dispatch/view/inline_query.py +0 -0
- telegrinder/bot/dispatch/view/message.py +0 -0
- telegrinder/bot/dispatch/waiter_machine/__init__.py +0 -0
- telegrinder/bot/dispatch/waiter_machine/machine.py +0 -0
- telegrinder/bot/dispatch/waiter_machine/middleware.py +0 -0
- telegrinder/bot/dispatch/waiter_machine/short_state.py +0 -0
- telegrinder/bot/polling/__init__.py +0 -0
- telegrinder/bot/polling/abc.py +0 -0
- telegrinder/bot/polling/polling.py +7 -11
- telegrinder/bot/rules/__init__.py +0 -0
- telegrinder/bot/rules/abc.py +1 -1
- telegrinder/bot/rules/adapter/__init__.py +0 -0
- telegrinder/bot/rules/adapter/abc.py +0 -0
- telegrinder/bot/rules/adapter/errors.py +0 -0
- telegrinder/bot/rules/adapter/event.py +12 -6
- telegrinder/bot/rules/adapter/raw_update.py +0 -0
- telegrinder/bot/rules/callback_data.py +3 -11
- telegrinder/bot/rules/command.py +0 -0
- telegrinder/bot/rules/enum_text.py +0 -0
- telegrinder/bot/rules/func.py +0 -0
- telegrinder/bot/rules/fuzzy.py +0 -0
- telegrinder/bot/rules/inline.py +2 -1
- telegrinder/bot/rules/integer.py +0 -0
- telegrinder/bot/rules/is_from.py +0 -0
- telegrinder/bot/rules/markup.py +3 -1
- telegrinder/bot/rules/mention.py +0 -0
- telegrinder/bot/rules/message_entities.py +3 -1
- telegrinder/bot/rules/regex.py +1 -1
- telegrinder/bot/rules/rule_enum.py +0 -0
- telegrinder/bot/rules/start.py +0 -0
- telegrinder/bot/rules/text.py +0 -0
- telegrinder/bot/scenario/__init__.py +0 -0
- telegrinder/bot/scenario/abc.py +0 -0
- telegrinder/bot/scenario/checkbox.py +0 -0
- telegrinder/bot/scenario/choice.py +0 -0
- telegrinder/client/__init__.py +2 -2
- telegrinder/client/abc.py +35 -12
- telegrinder/client/aiohttp.py +35 -22
- telegrinder/model.py +70 -23
- telegrinder/modules.py +22 -12
- telegrinder/msgspec_json.py +0 -0
- telegrinder/msgspec_utils.py +30 -10
- telegrinder/node/__init__.py +0 -0
- telegrinder/node/attachment.py +0 -0
- telegrinder/node/base.py +0 -0
- telegrinder/node/composer.py +0 -0
- telegrinder/node/container.py +0 -0
- telegrinder/node/message.py +0 -0
- telegrinder/node/rule.py +0 -0
- telegrinder/node/source.py +0 -0
- telegrinder/node/text.py +0 -0
- telegrinder/node/tools/__init__.py +0 -0
- telegrinder/node/tools/generator.py +0 -0
- telegrinder/node/update.py +0 -0
- telegrinder/rules.py +0 -0
- telegrinder/tools/__init__.py +2 -30
- telegrinder/tools/buttons.py +19 -5
- telegrinder/tools/error_handler/__init__.py +2 -0
- telegrinder/tools/error_handler/abc.py +5 -1
- telegrinder/tools/error_handler/error.py +10 -0
- telegrinder/tools/error_handler/error_handler.py +100 -81
- telegrinder/tools/formatting/__init__.py +0 -0
- telegrinder/tools/formatting/html.py +0 -0
- telegrinder/tools/formatting/links.py +0 -0
- telegrinder/tools/formatting/spec_html_formats.py +0 -0
- telegrinder/tools/global_context/__init__.py +0 -0
- telegrinder/tools/global_context/abc.py +0 -0
- telegrinder/tools/global_context/global_context.py +65 -67
- telegrinder/tools/global_context/telegrinder_ctx.py +0 -0
- telegrinder/tools/i18n/__init__.py +0 -0
- telegrinder/tools/i18n/base.py +0 -0
- telegrinder/tools/i18n/middleware/__init__.py +0 -0
- telegrinder/tools/i18n/middleware/base.py +0 -0
- telegrinder/tools/i18n/simple.py +0 -0
- telegrinder/tools/kb_set/__init__.py +0 -0
- telegrinder/tools/kb_set/base.py +0 -0
- telegrinder/tools/kb_set/yaml.py +3 -3
- telegrinder/tools/keyboard.py +17 -26
- telegrinder/tools/loop_wrapper/__init__.py +0 -0
- telegrinder/tools/loop_wrapper/abc.py +0 -0
- telegrinder/tools/loop_wrapper/loop_wrapper.py +0 -0
- telegrinder/tools/magic.py +1 -1
- telegrinder/tools/parse_mode.py +0 -0
- telegrinder/types/__init__.py +0 -0
- telegrinder/types/enums.py +13 -9
- telegrinder/types/methods.py +783 -673
- telegrinder/types/objects.py +317 -163
- {telegrinder-0.1.dev158.dist-info → telegrinder-0.1.dev160.dist-info}/LICENSE +0 -0
- {telegrinder-0.1.dev158.dist-info → telegrinder-0.1.dev160.dist-info}/METADATA +9 -7
- {telegrinder-0.1.dev158.dist-info → telegrinder-0.1.dev160.dist-info}/RECORD +42 -41
- {telegrinder-0.1.dev158.dist-info → telegrinder-0.1.dev160.dist-info}/WHEEL +1 -1
- telegrinder/tools/inline_query.py +0 -684
telegrinder/tools/keyboard.py
CHANGED
|
@@ -14,15 +14,8 @@ from telegrinder.types.objects import (
|
|
|
14
14
|
|
|
15
15
|
from .buttons import Button, ButtonT, InlineButton, RowButtons
|
|
16
16
|
|
|
17
|
-
DictStrAny = dict[str, typing.Any]
|
|
18
|
-
AnyMarkup = InlineKeyboardMarkup | ReplyKeyboardMarkup
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
def keyboard_remove(*, selective: bool | None = None) -> ReplyKeyboardRemove:
|
|
22
|
-
return ReplyKeyboardRemove(
|
|
23
|
-
remove_keyboard=True,
|
|
24
|
-
selective=Nothing() if selective is None else Some(selective),
|
|
25
|
-
)
|
|
17
|
+
DictStrAny: typing.TypeAlias = dict[str, typing.Any]
|
|
18
|
+
AnyMarkup: typing.TypeAlias = InlineKeyboardMarkup | ReplyKeyboardMarkup
|
|
26
19
|
|
|
27
20
|
|
|
28
21
|
@dataclasses.dataclass
|
|
@@ -31,12 +24,12 @@ class KeyboardModel:
|
|
|
31
24
|
one_time_keyboard: bool | Option[bool]
|
|
32
25
|
selective: bool | Option[bool]
|
|
33
26
|
is_persistent: bool | Option[bool]
|
|
34
|
-
keyboard: list[list[
|
|
27
|
+
keyboard: list[list[DictStrAny]]
|
|
35
28
|
|
|
36
29
|
|
|
37
30
|
class ABCMarkup(ABC, typing.Generic[ButtonT]):
|
|
38
31
|
BUTTON: type[ButtonT]
|
|
39
|
-
keyboard: list[list[
|
|
32
|
+
keyboard: list[list[DictStrAny]]
|
|
40
33
|
|
|
41
34
|
@abstractmethod
|
|
42
35
|
def dict(self) -> DictStrAny:
|
|
@@ -70,7 +63,7 @@ class ABCMarkup(ABC, typing.Generic[ButtonT]):
|
|
|
70
63
|
self.keyboard.append([])
|
|
71
64
|
return self
|
|
72
65
|
|
|
73
|
-
def format(self, **format_data:
|
|
66
|
+
def format(self, **format_data: str) -> typing.Self:
|
|
74
67
|
copy_keyboard = self.__class__()
|
|
75
68
|
for row in self.keyboard:
|
|
76
69
|
for button in row:
|
|
@@ -85,22 +78,21 @@ class ABCMarkup(ABC, typing.Generic[ButtonT]):
|
|
|
85
78
|
return self
|
|
86
79
|
|
|
87
80
|
|
|
81
|
+
@dataclasses.dataclass(kw_only=True)
|
|
88
82
|
class Keyboard(ABCMarkup[Button], KeyboardModel):
|
|
89
83
|
BUTTON = Button
|
|
90
84
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
)
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
self.selective = selective
|
|
103
|
-
self.is_persistent = is_persistent
|
|
85
|
+
keyboard: list[list[DictStrAny]] = dataclasses.field(
|
|
86
|
+
default_factory=lambda: [[]],
|
|
87
|
+
init=False,
|
|
88
|
+
)
|
|
89
|
+
resize_keyboard: bool = dataclasses.field(default=True)
|
|
90
|
+
one_time_keyboard: bool = dataclasses.field(default=False)
|
|
91
|
+
selective: bool = dataclasses.field(default=False)
|
|
92
|
+
is_persistent: bool = dataclasses.field(default=False)
|
|
93
|
+
|
|
94
|
+
def get_empty_markup(self, *, selective: bool = False) -> ReplyKeyboardRemove:
|
|
95
|
+
return ReplyKeyboardRemove(remove_keyboard=True, selective=selective) # type: ignore
|
|
104
96
|
|
|
105
97
|
def dict(self) -> DictStrAny:
|
|
106
98
|
self.keyboard = [row for row in self.keyboard if row]
|
|
@@ -133,5 +125,4 @@ __all__ = (
|
|
|
133
125
|
"InlineKeyboard",
|
|
134
126
|
"Keyboard",
|
|
135
127
|
"KeyboardModel",
|
|
136
|
-
"keyboard_remove",
|
|
137
128
|
)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
telegrinder/tools/magic.py
CHANGED
telegrinder/tools/parse_mode.py
CHANGED
|
File without changes
|
telegrinder/types/__init__.py
CHANGED
|
File without changes
|
telegrinder/types/enums.py
CHANGED
|
@@ -35,6 +35,8 @@ class ProgrammingLanguage(str, enum.Enum):
|
|
|
35
35
|
HTML = "html"
|
|
36
36
|
YAML = "yaml"
|
|
37
37
|
JSON = "json"
|
|
38
|
+
MARKDOWN = "markdown"
|
|
39
|
+
MARKUP = "markup"
|
|
38
40
|
|
|
39
41
|
|
|
40
42
|
class ChatAction(str, enum.Enum):
|
|
@@ -152,17 +154,19 @@ class ReactionEmoji(str, enum.Enum):
|
|
|
152
154
|
ENRAGED_FACE = "😡"
|
|
153
155
|
|
|
154
156
|
|
|
155
|
-
class
|
|
156
|
-
"""Type of
|
|
157
|
+
class DefaultAccentColor(int, enum.Enum):
|
|
158
|
+
"""Type of DefaultAccentColor.
|
|
157
159
|
|
|
158
160
|
One of 7 possible user colors:
|
|
159
|
-
-
|
|
160
|
-
-
|
|
161
|
-
-
|
|
162
|
-
-
|
|
163
|
-
-
|
|
164
|
-
-
|
|
165
|
-
-
|
|
161
|
+
- Red
|
|
162
|
+
- Orange
|
|
163
|
+
- Purple
|
|
164
|
+
- Green
|
|
165
|
+
- Cyan
|
|
166
|
+
- Blue
|
|
167
|
+
- Pink
|
|
168
|
+
|
|
169
|
+
Docs: https://core.telegram.org/bots/api#accent-colors
|
|
166
170
|
"""
|
|
167
171
|
|
|
168
172
|
RED = 0
|