telekit 2.5.1__tar.gz → 2.5.3__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.
- {telekit-2.5.1 → telekit-2.5.3}/PKG-INFO +8 -2
- {telekit-2.5.1 → telekit-2.5.3}/telekit/_telekit_dsl/mixin.py +15 -5
- {telekit-2.5.1 → telekit-2.5.3}/telekit/_version.py +1 -1
- {telekit-2.5.1 → telekit-2.5.3}/telekit/example/example_handlers/hotel.py +2 -1
- {telekit-2.5.1 → telekit-2.5.3}/telekit.egg-info/PKG-INFO +8 -2
- {telekit-2.5.1 → telekit-2.5.3}/LICENSE +0 -0
- {telekit-2.5.1 → telekit-2.5.3}/README.md +0 -0
- {telekit-2.5.1 → telekit-2.5.3}/setup.cfg +0 -0
- {telekit-2.5.1 → telekit-2.5.3}/setup.py +0 -0
- {telekit-2.5.1 → telekit-2.5.3}/telekit/__init__.py +0 -0
- {telekit-2.5.1 → telekit-2.5.3}/telekit/_buildtext/__init__.py +0 -0
- {telekit-2.5.1 → telekit-2.5.3}/telekit/_buildtext/formatter.py +0 -0
- {telekit-2.5.1 → telekit-2.5.3}/telekit/_buildtext/styles.py +0 -0
- {telekit-2.5.1 → telekit-2.5.3}/telekit/_callback_query_handler.py +0 -0
- {telekit-2.5.1 → telekit-2.5.3}/telekit/_chain.py +0 -0
- {telekit-2.5.1 → telekit-2.5.3}/telekit/_chain_base.py +0 -0
- {telekit-2.5.1 → telekit-2.5.3}/telekit/_chain_entry_logic.py +0 -0
- {telekit-2.5.1 → telekit-2.5.3}/telekit/_chain_inline_keyboards_logic.py +0 -0
- {telekit-2.5.1 → telekit-2.5.3}/telekit/_chapters/__init__.py +0 -0
- {telekit-2.5.1 → telekit-2.5.3}/telekit/_chapters/chapters.py +0 -0
- {telekit-2.5.1 → telekit-2.5.3}/telekit/_handler.py +0 -0
- {telekit-2.5.1 → telekit-2.5.3}/telekit/_init.py +0 -0
- {telekit-2.5.1 → telekit-2.5.3}/telekit/_inline_buttons.py +0 -0
- {telekit-2.5.1 → telekit-2.5.3}/telekit/_inline_keyboard.py +0 -0
- {telekit-2.5.1 → telekit-2.5.3}/telekit/_input_handler.py +0 -0
- {telekit-2.5.1 → telekit-2.5.3}/telekit/_logger.py +0 -0
- {telekit-2.5.1 → telekit-2.5.3}/telekit/_on.py +0 -0
- {telekit-2.5.1 → telekit-2.5.3}/telekit/_reply_keyboard.py +0 -0
- {telekit-2.5.1 → telekit-2.5.3}/telekit/_snapvault/__init__.py +0 -0
- {telekit-2.5.1 → telekit-2.5.3}/telekit/_snapvault/snapcode.py +0 -0
- {telekit-2.5.1 → telekit-2.5.3}/telekit/_snapvault/snapvault.py +0 -0
- {telekit-2.5.1 → telekit-2.5.3}/telekit/_state.py +0 -0
- {telekit-2.5.1 → telekit-2.5.3}/telekit/_telekit_dsl/__init__.py +0 -0
- {telekit-2.5.1 → telekit-2.5.3}/telekit/_telekit_dsl/parser/__init__.py +0 -0
- {telekit-2.5.1 → telekit-2.5.3}/telekit/_telekit_dsl/parser/builder.py +0 -0
- {telekit-2.5.1 → telekit-2.5.3}/telekit/_telekit_dsl/parser/canvas_parser.py +0 -0
- {telekit-2.5.1 → telekit-2.5.3}/telekit/_telekit_dsl/parser/lexer.py +0 -0
- {telekit-2.5.1 → telekit-2.5.3}/telekit/_telekit_dsl/parser/nodes.py +0 -0
- {telekit-2.5.1 → telekit-2.5.3}/telekit/_telekit_dsl/parser/parser.py +0 -0
- {telekit-2.5.1 → telekit-2.5.3}/telekit/_telekit_dsl/parser/token.py +0 -0
- {telekit-2.5.1 → telekit-2.5.3}/telekit/_telekit_dsl/telekit_dsl.py +0 -0
- {telekit-2.5.1 → telekit-2.5.3}/telekit/_telekit_dsl/telekit_orm.py +0 -0
- {telekit-2.5.1 → telekit-2.5.3}/telekit/_text_builder.py +0 -0
- {telekit-2.5.1 → telekit-2.5.3}/telekit/_timeout.py +0 -0
- {telekit-2.5.1 → telekit-2.5.3}/telekit/_trait.py +0 -0
- {telekit-2.5.1 → telekit-2.5.3}/telekit/_user.py +0 -0
- {telekit-2.5.1 → telekit-2.5.3}/telekit/chat.py +0 -0
- {telekit-2.5.1 → telekit-2.5.3}/telekit/debug.py +0 -0
- {telekit-2.5.1 → telekit-2.5.3}/telekit/dices.py +0 -0
- {telekit-2.5.1 → telekit-2.5.3}/telekit/example/__init__.py +0 -0
- {telekit-2.5.1 → telekit-2.5.3}/telekit/example/example_handlers/__init__.py +0 -0
- {telekit-2.5.1 → telekit-2.5.3}/telekit/example/example_handlers/article.py +0 -0
- {telekit-2.5.1 → telekit-2.5.3}/telekit/example/example_handlers/calendar.py +0 -0
- {telekit-2.5.1 → telekit-2.5.3}/telekit/example/example_handlers/complete_hotel.py +0 -0
- {telekit-2.5.1 → telekit-2.5.3}/telekit/example/example_handlers/counter.py +0 -0
- {telekit-2.5.1 → telekit-2.5.3}/telekit/example/example_handlers/dsl.py +0 -0
- {telekit-2.5.1 → telekit-2.5.3}/telekit/example/example_handlers/entry.py +0 -0
- {telekit-2.5.1 → telekit-2.5.3}/telekit/example/example_handlers/faq.py +0 -0
- {telekit-2.5.1 → telekit-2.5.3}/telekit/example/example_handlers/on_text.py +0 -0
- {telekit-2.5.1 → telekit-2.5.3}/telekit/example/example_handlers/pages.py +0 -0
- {telekit-2.5.1 → telekit-2.5.3}/telekit/example/example_handlers/pyapi.py +0 -0
- {telekit-2.5.1 → telekit-2.5.3}/telekit/example/example_handlers/qr.py +0 -0
- {telekit-2.5.1 → telekit-2.5.3}/telekit/example/example_handlers/quiz.py +0 -0
- {telekit-2.5.1 → telekit-2.5.3}/telekit/example/example_handlers/spells.py +0 -0
- {telekit-2.5.1 → telekit-2.5.3}/telekit/example/example_handlers/start.py +0 -0
- {telekit-2.5.1 → telekit-2.5.3}/telekit/example/example_handlers/style.py +0 -0
- {telekit-2.5.1 → telekit-2.5.3}/telekit/example/example_handlers/text_document.py +0 -0
- {telekit-2.5.1 → telekit-2.5.3}/telekit/example/example_server.py +0 -0
- {telekit-2.5.1 → telekit-2.5.3}/telekit/html_text.py +0 -0
- {telekit-2.5.1 → telekit-2.5.3}/telekit/inline_buttons.py +0 -0
- {telekit-2.5.1 → telekit-2.5.3}/telekit/parameters.py +0 -0
- {telekit-2.5.1 → telekit-2.5.3}/telekit/reply_buttons.py +0 -0
- {telekit-2.5.1 → telekit-2.5.3}/telekit/scheduler.py +0 -0
- {telekit-2.5.1 → telekit-2.5.3}/telekit/senders.py +0 -0
- {telekit-2.5.1 → telekit-2.5.3}/telekit/server.py +0 -0
- {telekit-2.5.1 → telekit-2.5.3}/telekit/styles.py +0 -0
- {telekit-2.5.1 → telekit-2.5.3}/telekit/traits/__init__.py +0 -0
- {telekit-2.5.1 → telekit-2.5.3}/telekit/traits/calendar_pick.py +0 -0
- {telekit-2.5.1 → telekit-2.5.3}/telekit/traits/paginated_choice.py +0 -0
- {telekit-2.5.1 → telekit-2.5.3}/telekit/traits/paginated_text.py +0 -0
- {telekit-2.5.1 → telekit-2.5.3}/telekit/traits/track_handoff_origin.py +0 -0
- {telekit-2.5.1 → telekit-2.5.3}/telekit/types.py +0 -0
- {telekit-2.5.1 → telekit-2.5.3}/telekit/utils.py +0 -0
- {telekit-2.5.1 → telekit-2.5.3}/telekit.egg-info/SOURCES.txt +0 -0
- {telekit-2.5.1 → telekit-2.5.3}/telekit.egg-info/dependency_links.txt +0 -0
- {telekit-2.5.1 → telekit-2.5.3}/telekit.egg-info/requires.txt +0 -0
- {telekit-2.5.1 → telekit-2.5.3}/telekit.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: telekit
|
|
3
|
-
Version: 2.5.
|
|
3
|
+
Version: 2.5.3
|
|
4
4
|
Summary: Declarative, developer-friendly library for building Telegram bots
|
|
5
5
|
Home-page: https://github.com/Romashkaa/telekit
|
|
6
6
|
Author: romashka
|
|
@@ -477,7 +477,13 @@ It tries to make Telegram bot development easier.
|
|
|
477
477
|
|
|
478
478
|
---
|
|
479
479
|
|
|
480
|
-
# Changes in version 2.5.
|
|
480
|
+
# Changes in version 2.5.3
|
|
481
|
+
|
|
482
|
+
### v2.5.3
|
|
483
|
+
- Fix: Remove `_` parameters from `_filter_entry` and `_handle_entry` methods in `DSLHandler`
|
|
484
|
+
|
|
485
|
+
### v2.5.2
|
|
486
|
+
- Add `random_` variable prefix in `DSLHandler` — resolves to a random choice from a `list`/`tuple`/`str` static variable
|
|
481
487
|
|
|
482
488
|
### v2.5.1 `(bug-fix)`
|
|
483
489
|
- Implement `TelegramMarkdownV2Sanitizer` for improved `MarkdownV2` handling
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
#
|
|
19
19
|
|
|
20
20
|
import jinja2
|
|
21
|
-
import re, json, copy
|
|
21
|
+
import re, json, copy, random
|
|
22
22
|
from typing import NoReturn, Callable, Any, Literal
|
|
23
23
|
|
|
24
24
|
import telekit
|
|
@@ -618,7 +618,7 @@ class DSLHandler(telekit.Handler):
|
|
|
618
618
|
|
|
619
619
|
return render
|
|
620
620
|
|
|
621
|
-
def _filter_entry(self,
|
|
621
|
+
def _filter_entry(self, text: str):
|
|
622
622
|
scene = self.script_data.get_current_scene()
|
|
623
623
|
|
|
624
624
|
if text in scene.get("entries", {}):
|
|
@@ -628,7 +628,7 @@ class DSLHandler(telekit.Handler):
|
|
|
628
628
|
|
|
629
629
|
return False
|
|
630
630
|
|
|
631
|
-
def _handle_entry(self,
|
|
631
|
+
def _handle_entry(self, text: str):
|
|
632
632
|
scene_name = self.script_data.get_current_scene_name()
|
|
633
633
|
scene = self.script_data.scenes[scene_name]
|
|
634
634
|
|
|
@@ -715,10 +715,20 @@ class DSLHandler(telekit.Handler):
|
|
|
715
715
|
|
|
716
716
|
if isinstance(value, str):
|
|
717
717
|
return value
|
|
718
|
+
|
|
719
|
+
GET_RANDOM_PREFIX = "random_"
|
|
718
720
|
|
|
719
721
|
def _get_static_var(self, name: str) -> str | None:
|
|
720
|
-
|
|
721
|
-
|
|
722
|
+
if name.startswith(self.GET_RANDOM_PREFIX):
|
|
723
|
+
name = name[len(self.GET_RANDOM_PREFIX):]
|
|
724
|
+
seq = self.script_data.static_vars.get(name)
|
|
725
|
+
if isinstance(seq, (str, list, tuple)):
|
|
726
|
+
return str(random.choice(seq))
|
|
727
|
+
else:
|
|
728
|
+
return str(seq)
|
|
729
|
+
else:
|
|
730
|
+
value = self.script_data.static_vars.get(name)
|
|
731
|
+
return None if value is None else str(value)
|
|
722
732
|
|
|
723
733
|
def _get_default_var(self, name: str):
|
|
724
734
|
match name:
|
|
@@ -58,10 +58,11 @@ script = """
|
|
|
58
58
|
$ vars {
|
|
59
59
|
ECONOM_PRICE = 50
|
|
60
60
|
COMFORT_PRICE = 120
|
|
61
|
+
NAME = ["Telekit", "Budapest", "Theft"]
|
|
61
62
|
}
|
|
62
63
|
|
|
63
64
|
@ main {
|
|
64
|
-
title = "🏨 Grand
|
|
65
|
+
title = "🏨 Grand {{random_NAME}} Hotel"
|
|
65
66
|
message = "Welcome, {{first_name}}! Choose your experience and explore our rooms."
|
|
66
67
|
|
|
67
68
|
buttons (2) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: telekit
|
|
3
|
-
Version: 2.5.
|
|
3
|
+
Version: 2.5.3
|
|
4
4
|
Summary: Declarative, developer-friendly library for building Telegram bots
|
|
5
5
|
Home-page: https://github.com/Romashkaa/telekit
|
|
6
6
|
Author: romashka
|
|
@@ -477,7 +477,13 @@ It tries to make Telegram bot development easier.
|
|
|
477
477
|
|
|
478
478
|
---
|
|
479
479
|
|
|
480
|
-
# Changes in version 2.5.
|
|
480
|
+
# Changes in version 2.5.3
|
|
481
|
+
|
|
482
|
+
### v2.5.3
|
|
483
|
+
- Fix: Remove `_` parameters from `_filter_entry` and `_handle_entry` methods in `DSLHandler`
|
|
484
|
+
|
|
485
|
+
### v2.5.2
|
|
486
|
+
- Add `random_` variable prefix in `DSLHandler` — resolves to a random choice from a `list`/`tuple`/`str` static variable
|
|
481
487
|
|
|
482
488
|
### v2.5.1 `(bug-fix)`
|
|
483
489
|
- Implement `TelegramMarkdownV2Sanitizer` for improved `MarkdownV2` handling
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|