telekit 2.1.0__tar.gz → 2.2.0a0__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.
Files changed (71) hide show
  1. {telekit-2.1.0/telekit.egg-info → telekit-2.2.0a0}/PKG-INFO +8 -17
  2. {telekit-2.1.0 → telekit-2.2.0a0}/README.md +3 -3
  3. {telekit-2.1.0 → telekit-2.2.0a0}/telekit/_inline_buttons.py +108 -1
  4. telekit-2.2.0a0/telekit/_version.py +5 -0
  5. {telekit-2.1.0 → telekit-2.2.0a0}/telekit/example/example_handlers/spells.py +3 -3
  6. {telekit-2.1.0 → telekit-2.2.0a0}/telekit/inline_buttons.py +6 -0
  7. {telekit-2.1.0 → telekit-2.2.0a0/telekit.egg-info}/PKG-INFO +8 -17
  8. telekit-2.1.0/telekit/_version.py +0 -1
  9. {telekit-2.1.0 → telekit-2.2.0a0}/LICENSE +0 -0
  10. {telekit-2.1.0 → telekit-2.2.0a0}/setup.cfg +0 -0
  11. {telekit-2.1.0 → telekit-2.2.0a0}/setup.py +0 -0
  12. {telekit-2.1.0 → telekit-2.2.0a0}/telekit/__init__.py +0 -0
  13. {telekit-2.1.0 → telekit-2.2.0a0}/telekit/_buildtext/__init__.py +0 -0
  14. {telekit-2.1.0 → telekit-2.2.0a0}/telekit/_buildtext/formatter.py +0 -0
  15. {telekit-2.1.0 → telekit-2.2.0a0}/telekit/_buildtext/styles.py +0 -0
  16. {telekit-2.1.0 → telekit-2.2.0a0}/telekit/_callback_query_handler.py +0 -0
  17. {telekit-2.1.0 → telekit-2.2.0a0}/telekit/_chain.py +0 -0
  18. {telekit-2.1.0 → telekit-2.2.0a0}/telekit/_chain_base.py +0 -0
  19. {telekit-2.1.0 → telekit-2.2.0a0}/telekit/_chain_entry_logic.py +0 -0
  20. {telekit-2.1.0 → telekit-2.2.0a0}/telekit/_chain_inline_keyboards_logic.py +0 -0
  21. {telekit-2.1.0 → telekit-2.2.0a0}/telekit/_chapters/__init__.py +0 -0
  22. {telekit-2.1.0 → telekit-2.2.0a0}/telekit/_chapters/chapters.py +0 -0
  23. {telekit-2.1.0 → telekit-2.2.0a0}/telekit/_handler.py +0 -0
  24. {telekit-2.1.0 → telekit-2.2.0a0}/telekit/_init.py +0 -0
  25. {telekit-2.1.0 → telekit-2.2.0a0}/telekit/_input_handler.py +0 -0
  26. {telekit-2.1.0 → telekit-2.2.0a0}/telekit/_logger.py +0 -0
  27. {telekit-2.1.0 → telekit-2.2.0a0}/telekit/_on.py +0 -0
  28. {telekit-2.1.0 → telekit-2.2.0a0}/telekit/_snapvault/__init__.py +0 -0
  29. {telekit-2.1.0 → telekit-2.2.0a0}/telekit/_snapvault/snapcode.py +0 -0
  30. {telekit-2.1.0 → telekit-2.2.0a0}/telekit/_snapvault/snapvault.py +0 -0
  31. {telekit-2.1.0 → telekit-2.2.0a0}/telekit/_state.py +0 -0
  32. {telekit-2.1.0 → telekit-2.2.0a0}/telekit/_telekit_dsl/__init__.py +0 -0
  33. {telekit-2.1.0 → telekit-2.2.0a0}/telekit/_telekit_dsl/mixin.py +0 -0
  34. {telekit-2.1.0 → telekit-2.2.0a0}/telekit/_telekit_dsl/parser/__init__.py +0 -0
  35. {telekit-2.1.0 → telekit-2.2.0a0}/telekit/_telekit_dsl/parser/builder.py +0 -0
  36. {telekit-2.1.0 → telekit-2.2.0a0}/telekit/_telekit_dsl/parser/canvas_parser.py +0 -0
  37. {telekit-2.1.0 → telekit-2.2.0a0}/telekit/_telekit_dsl/parser/lexer.py +0 -0
  38. {telekit-2.1.0 → telekit-2.2.0a0}/telekit/_telekit_dsl/parser/nodes.py +0 -0
  39. {telekit-2.1.0 → telekit-2.2.0a0}/telekit/_telekit_dsl/parser/parser.py +0 -0
  40. {telekit-2.1.0 → telekit-2.2.0a0}/telekit/_telekit_dsl/parser/token.py +0 -0
  41. {telekit-2.1.0 → telekit-2.2.0a0}/telekit/_telekit_dsl/telekit_dsl.py +0 -0
  42. {telekit-2.1.0 → telekit-2.2.0a0}/telekit/_telekit_dsl/telekit_orm.py +0 -0
  43. {telekit-2.1.0 → telekit-2.2.0a0}/telekit/_timeout.py +0 -0
  44. {telekit-2.1.0 → telekit-2.2.0a0}/telekit/_user.py +0 -0
  45. {telekit-2.1.0 → telekit-2.2.0a0}/telekit/dices.py +0 -0
  46. {telekit-2.1.0 → telekit-2.2.0a0}/telekit/example/__init__.py +0 -0
  47. {telekit-2.1.0 → telekit-2.2.0a0}/telekit/example/example_handlers/__init__.py +0 -0
  48. {telekit-2.1.0 → telekit-2.2.0a0}/telekit/example/example_handlers/complete_hotel.py +0 -0
  49. {telekit-2.1.0 → telekit-2.2.0a0}/telekit/example/example_handlers/counter.py +0 -0
  50. {telekit-2.1.0 → telekit-2.2.0a0}/telekit/example/example_handlers/dsl.py +0 -0
  51. {telekit-2.1.0 → telekit-2.2.0a0}/telekit/example/example_handlers/entry.py +0 -0
  52. {telekit-2.1.0 → telekit-2.2.0a0}/telekit/example/example_handlers/faq.py +0 -0
  53. {telekit-2.1.0 → telekit-2.2.0a0}/telekit/example/example_handlers/hotel.py +0 -0
  54. {telekit-2.1.0 → telekit-2.2.0a0}/telekit/example/example_handlers/on_text.py +0 -0
  55. {telekit-2.1.0 → telekit-2.2.0a0}/telekit/example/example_handlers/pages.py +0 -0
  56. {telekit-2.1.0 → telekit-2.2.0a0}/telekit/example/example_handlers/pyapi.py +0 -0
  57. {telekit-2.1.0 → telekit-2.2.0a0}/telekit/example/example_handlers/qr.py +0 -0
  58. {telekit-2.1.0 → telekit-2.2.0a0}/telekit/example/example_handlers/quiz.py +0 -0
  59. {telekit-2.1.0 → telekit-2.2.0a0}/telekit/example/example_handlers/start.py +0 -0
  60. {telekit-2.1.0 → telekit-2.2.0a0}/telekit/example/example_handlers/text_document.py +0 -0
  61. {telekit-2.1.0 → telekit-2.2.0a0}/telekit/example/example_server.py +0 -0
  62. {telekit-2.1.0 → telekit-2.2.0a0}/telekit/parameters.py +0 -0
  63. {telekit-2.1.0 → telekit-2.2.0a0}/telekit/senders.py +0 -0
  64. {telekit-2.1.0 → telekit-2.2.0a0}/telekit/server.py +0 -0
  65. {telekit-2.1.0 → telekit-2.2.0a0}/telekit/styles.py +0 -0
  66. {telekit-2.1.0 → telekit-2.2.0a0}/telekit/types.py +0 -0
  67. {telekit-2.1.0 → telekit-2.2.0a0}/telekit/utils.py +0 -0
  68. {telekit-2.1.0 → telekit-2.2.0a0}/telekit.egg-info/SOURCES.txt +0 -0
  69. {telekit-2.1.0 → telekit-2.2.0a0}/telekit.egg-info/dependency_links.txt +0 -0
  70. {telekit-2.1.0 → telekit-2.2.0a0}/telekit.egg-info/requires.txt +0 -0
  71. {telekit-2.1.0 → telekit-2.2.0a0}/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.1.0
3
+ Version: 2.2.0a0
4
4
  Summary: Declarative, developer-friendly library for building Telegram bots
5
5
  Home-page: https://github.com/Romashkaa/telekit
6
6
  Author: romashka
@@ -36,9 +36,9 @@ Dynamic: summary
36
36
 
37
37
  ![TeleKit](https://github.com/Romashkaa/images/blob/main/TeleKitWide.png?raw=true)
38
38
 
39
- [![PyPi](https://img.shields.io/pypi/v/telekit.svg)](https://pypi.org/project/telekit/)
39
+ [![PyPI](https://img.shields.io/pypi/v/telekit.svg)](https://pypi.org/project/telekit/)
40
40
  [![Python](https://img.shields.io/pypi/pyversions/telekit.svg)](https://pypi.org/project/telekit/)
41
- [![PyPi Downloads](https://static.pepy.tech/badge/telekit)](https://pepy.tech/project/telekit)
41
+ [![PyPI Downloads](https://static.pepy.tech/badge/telekit)](https://pepy.tech/project/telekit)
42
42
 
43
43
  # Telekit
44
44
 
@@ -89,7 +89,7 @@ Even in its beta stage, Telekit accelerates bot development, offering typed comm
89
89
  - Fast to develop and easy-to-extend code
90
90
 
91
91
  [GitHub](https://github.com/Romashkaa/telekit)
92
- [PyPi](https://pypi.org/project/telekit/)
92
+ [PyPI](https://pypi.org/project/telekit/)
93
93
  [Telegram](https://t.me/NotRomashka)
94
94
  [Community](https://t.me/+wu-dFrOBFIwyNzc0)
95
95
 
@@ -378,20 +378,11 @@ It tries to make Telegram bot development easier.
378
378
 
379
379
  ---
380
380
 
381
- # Changes in version 2.1.0
381
+ # Changes in version 2.2.0a0
382
382
 
383
- ## Trigger Improvements
383
+ ## New Button Types
384
384
 
385
385
  | **Name** | **Description** |
386
386
  |----------|-----------------|
387
- | `on.text` | *BugFix:* Commands are no longer matched as text triggers. |
388
-
389
- - Internal refactor of the `On` class.
390
-
391
- ## New Utils
392
-
393
- | **Name** | **Description** |
394
- |----------|-----------------|
395
- | `make_bot_link` | Builds a `t.me` URL to a bot with an optional deep-link payload. |
396
- | `make_user_link` | Builds a `t.me` URL to a user with an optional pre-filled message. |
397
- | `make_qrcode` | Generates a [QR code](./docs/examples/qr_gen.md) URL from any text or link. |
387
+ | `AlertButton` | A callback button that shows a popup alert when pressed. |
388
+ | `NotificationButton` | A callback button that shows a brief notification at the top of the chat screen. |
@@ -1,8 +1,8 @@
1
1
  ![TeleKit](https://github.com/Romashkaa/images/blob/main/TeleKitWide.png?raw=true)
2
2
 
3
- [![PyPi](https://img.shields.io/pypi/v/telekit.svg)](https://pypi.org/project/telekit/)
3
+ [![PyPI](https://img.shields.io/pypi/v/telekit.svg)](https://pypi.org/project/telekit/)
4
4
  [![Python](https://img.shields.io/pypi/pyversions/telekit.svg)](https://pypi.org/project/telekit/)
5
- [![PyPi Downloads](https://static.pepy.tech/badge/telekit)](https://pepy.tech/project/telekit)
5
+ [![PyPI Downloads](https://static.pepy.tech/badge/telekit)](https://pepy.tech/project/telekit)
6
6
 
7
7
  # Telekit
8
8
 
@@ -53,7 +53,7 @@ Even in its beta stage, Telekit accelerates bot development, offering typed comm
53
53
  - Fast to develop and easy-to-extend code
54
54
 
55
55
  [GitHub](https://github.com/Romashkaa/telekit)
56
- [PyPi](https://pypi.org/project/telekit/)
56
+ [PyPI](https://pypi.org/project/telekit/)
57
57
  [Telegram](https://t.me/NotRomashka)
58
58
  [Community](https://t.me/+wu-dFrOBFIwyNzc0)
59
59
 
@@ -34,6 +34,8 @@ __all__ = [
34
34
  "SuggestButton",
35
35
  "CopyTextButton",
36
36
  "CallbackButton",
37
+ "AlertButton",
38
+ "NotificationButton",
37
39
 
38
40
  "ButtonStyle"
39
41
  ]
@@ -54,6 +56,8 @@ class InlineButton:
54
56
  - `SuggestButton`
55
57
  - `CopyTextButton`
56
58
  - `CallbackButton`
59
+ - `AlertButton
60
+ - `NotificationButton
57
61
  """
58
62
 
59
63
  _bot: TeleBot
@@ -70,6 +74,8 @@ class InlineButton:
70
74
  Suggest: type["SuggestButton"]
71
75
  CopyText: type["CopyTextButton"]
72
76
  Callback: type["CallbackButton"]
77
+ Alert: type["AlertButton"]
78
+ Notification: type["NotificationButton"]
73
79
 
74
80
  Styles: type[ButtonStyle] = ButtonStyle
75
81
 
@@ -378,8 +384,109 @@ class CallbackButton(InlineButton):
378
384
  callback=callback,
379
385
  )
380
386
 
387
+ class AlertButton(CallbackButton):
388
+ """
389
+ An inline keyboard button that shows a popup alert when pressed and terminates the chain.
390
+
391
+ When the user presses this button, the specified text is displayed as a modal alert dialog.
392
+ The chain is finalized: all other buttons in the message become inactive and no further
393
+ interaction is expected. Typically used as a session-ending buttons.
394
+
395
+ :param text: Text to display in the alert popup.
396
+ :type text: `str | None`
397
+
398
+ :param style: Style of the button. Must be one of `ButtonStyle.DANGER` (red),
399
+ `*.SUCCESS` (green) or `*.PRIMARY` (blue).
400
+ You can also pass these as string values: "danger", "success", "primary".
401
+ If omitted, an app-specific default style is used.
402
+ :type style: `str | ButtonStyle | None`
403
+
404
+ :param kwargs: Additional keyword arguments passed directly to `InlineKeyboardButton`.
405
+ :type kwargs: `Any`
406
+
407
+ Example::
408
+
409
+ def entry_word(self) -> None:
410
+ self.chain.sender.set_title("✏️ Add a new word")
411
+ self.chain.sender.set_message("Type the word you want to save to your dictionary:")
412
+ self.chain.set_inline_keyboard({
413
+ "✕ Cancel": AlertButton(text="Cancelled")
414
+ })
415
+ self.chain.set_entry_text(
416
+ self.entry_translation,
417
+ delete_user_response=True,
418
+ )
419
+ self.chain.edit()
420
+ """
421
+ def __init__(
422
+ self,
423
+ text: str | None = None,
424
+ *,
425
+ style: str | None | ButtonStyle = None,
426
+ **kwargs
427
+ ):
428
+ super().__init__(
429
+ callback=None,
430
+ answer_text=text,
431
+ answer_as_alert=True,
432
+ style=style,
433
+ **kwargs
434
+ )
435
+
436
+ class NotificationButton(CallbackButton):
437
+ """
438
+ An inline keyboard button that shows a brief notification at the top of the chat screen
439
+ when pressed and terminates the chain.
440
+
441
+ When the user presses this button, the specified text appears as a short non-blocking
442
+ notification. The chain is finalized: all other buttons in the message become inactive
443
+ and no further interaction is expected. Typically used as a session-ending buttons.
444
+
445
+ :param text: Text to display in the notification.
446
+ :type text: `str | None`
447
+
448
+ :param style: Style of the button. Must be one of `ButtonStyle.DANGER` (red),
449
+ `*.SUCCESS` (green) or `*.PRIMARY` (blue).
450
+ You can also pass these as string values: "danger", "success", "primary".
451
+ If omitted, an app-specific default style is used.
452
+ :type style: `str | ButtonStyle | None`
453
+
454
+ :param kwargs: Additional keyword arguments passed directly to `InlineKeyboardButton`.
455
+ :type kwargs: `Any`
456
+
457
+ Example::
458
+
459
+ def entry_word(self) -> None:
460
+ self.chain.sender.set_title("✏️ Add a new word")
461
+ self.chain.sender.set_message("Type the word you want to save to your dictionary:")
462
+ self.chain.set_inline_keyboard({
463
+ "✕ Cancel": NotificationButton(text="Cancelled")
464
+ })
465
+ self.chain.set_entry_text(
466
+ self.entry_translation,
467
+ delete_user_response=True,
468
+ )
469
+ self.chain.edit()
470
+ """
471
+ def __init__(
472
+ self,
473
+ text: str | None = None,
474
+ *,
475
+ style: str | None | ButtonStyle = None,
476
+ **kwargs
477
+ ):
478
+ super().__init__(
479
+ callback=None,
480
+ answer_text=text,
481
+ answer_as_alert=False,
482
+ style=style,
483
+ **kwargs
484
+ )
485
+
381
486
  InlineButton.Link = LinkButton
382
487
  InlineButton.WebApp = WebAppButton
383
488
  InlineButton.Suggest = SuggestButton
384
489
  InlineButton.CopyText = CopyTextButton
385
- InlineButton.Callback = CallbackButton
490
+ InlineButton.Callback = CallbackButton
491
+ InlineButton.Alert = AlertButton
492
+ InlineButton.Notification = NotificationButton
@@ -0,0 +1,5 @@
1
+ # ––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
2
+ # PyPI package version: https://img.shields.io/pypi/v/telekit.svg
3
+ # ––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
4
+
5
+ __version__ = "2.2.0a0"
@@ -40,15 +40,15 @@ class SpellsHandler(telekit.Handler):
40
40
  # ------------------------------------------
41
41
 
42
42
  def handle(self) -> None:
43
- self.display_home_page()
43
+ self.display_spells()
44
44
 
45
- def display_home_page(self) -> None:
45
+ def display_spells(self) -> None:
46
46
  self.chain.sender.set_title("📜 Wizarding Library")
47
47
  self.chain.sender.set_message("Select a spell from the list below to see its description:")
48
48
 
49
49
  self.chain.set_inline_keyboard(
50
50
  {
51
- title: CallbackButton(self.display_home_page, answer_text=content)
51
+ title: CallbackButton(self.display_spells, answer_text=content)
52
52
  for title, content in spells.items()
53
53
  }
54
54
  )
@@ -19,11 +19,15 @@
19
19
 
20
20
  from ._inline_buttons import (
21
21
  InlineButton,
22
+
22
23
  LinkButton,
23
24
  WebAppButton,
24
25
  SuggestButton,
25
26
  CopyTextButton,
27
+
26
28
  CallbackButton,
29
+ AlertButton,
30
+ NotificationButton,
27
31
  )
28
32
 
29
33
  __all__ = [
@@ -35,4 +39,6 @@ __all__ = [
35
39
  "CopyTextButton",
36
40
 
37
41
  "CallbackButton",
42
+ "AlertButton",
43
+ "NotificationButton",
38
44
  ]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: telekit
3
- Version: 2.1.0
3
+ Version: 2.2.0a0
4
4
  Summary: Declarative, developer-friendly library for building Telegram bots
5
5
  Home-page: https://github.com/Romashkaa/telekit
6
6
  Author: romashka
@@ -36,9 +36,9 @@ Dynamic: summary
36
36
 
37
37
  ![TeleKit](https://github.com/Romashkaa/images/blob/main/TeleKitWide.png?raw=true)
38
38
 
39
- [![PyPi](https://img.shields.io/pypi/v/telekit.svg)](https://pypi.org/project/telekit/)
39
+ [![PyPI](https://img.shields.io/pypi/v/telekit.svg)](https://pypi.org/project/telekit/)
40
40
  [![Python](https://img.shields.io/pypi/pyversions/telekit.svg)](https://pypi.org/project/telekit/)
41
- [![PyPi Downloads](https://static.pepy.tech/badge/telekit)](https://pepy.tech/project/telekit)
41
+ [![PyPI Downloads](https://static.pepy.tech/badge/telekit)](https://pepy.tech/project/telekit)
42
42
 
43
43
  # Telekit
44
44
 
@@ -89,7 +89,7 @@ Even in its beta stage, Telekit accelerates bot development, offering typed comm
89
89
  - Fast to develop and easy-to-extend code
90
90
 
91
91
  [GitHub](https://github.com/Romashkaa/telekit)
92
- [PyPi](https://pypi.org/project/telekit/)
92
+ [PyPI](https://pypi.org/project/telekit/)
93
93
  [Telegram](https://t.me/NotRomashka)
94
94
  [Community](https://t.me/+wu-dFrOBFIwyNzc0)
95
95
 
@@ -378,20 +378,11 @@ It tries to make Telegram bot development easier.
378
378
 
379
379
  ---
380
380
 
381
- # Changes in version 2.1.0
381
+ # Changes in version 2.2.0a0
382
382
 
383
- ## Trigger Improvements
383
+ ## New Button Types
384
384
 
385
385
  | **Name** | **Description** |
386
386
  |----------|-----------------|
387
- | `on.text` | *BugFix:* Commands are no longer matched as text triggers. |
388
-
389
- - Internal refactor of the `On` class.
390
-
391
- ## New Utils
392
-
393
- | **Name** | **Description** |
394
- |----------|-----------------|
395
- | `make_bot_link` | Builds a `t.me` URL to a bot with an optional deep-link payload. |
396
- | `make_user_link` | Builds a `t.me` URL to a user with an optional pre-filled message. |
397
- | `make_qrcode` | Generates a [QR code](./docs/examples/qr_gen.md) URL from any text or link. |
387
+ | `AlertButton` | A callback button that shows a popup alert when pressed. |
388
+ | `NotificationButton` | A callback button that shows a brief notification at the top of the chat screen. |
@@ -1 +0,0 @@
1
- __version__ = "2.1.0"
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