telegrinder 0.1.dev171__py3-none-any.whl → 0.2.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.

Files changed (92) hide show
  1. telegrinder/__init__.py +2 -2
  2. telegrinder/api/__init__.py +1 -2
  3. telegrinder/api/api.py +3 -3
  4. telegrinder/api/token.py +36 -0
  5. telegrinder/bot/__init__.py +12 -6
  6. telegrinder/bot/bot.py +12 -5
  7. telegrinder/bot/cute_types/__init__.py +7 -7
  8. telegrinder/bot/cute_types/base.py +7 -32
  9. telegrinder/bot/cute_types/callback_query.py +5 -6
  10. telegrinder/bot/cute_types/chat_join_request.py +4 -5
  11. telegrinder/bot/cute_types/chat_member_updated.py +3 -4
  12. telegrinder/bot/cute_types/inline_query.py +3 -4
  13. telegrinder/bot/cute_types/message.py +9 -10
  14. telegrinder/bot/cute_types/update.py +8 -9
  15. telegrinder/bot/cute_types/utils.py +1 -1
  16. telegrinder/bot/dispatch/__init__.py +9 -9
  17. telegrinder/bot/dispatch/abc.py +2 -2
  18. telegrinder/bot/dispatch/context.py +11 -2
  19. telegrinder/bot/dispatch/dispatch.py +18 -33
  20. telegrinder/bot/dispatch/handler/__init__.py +3 -3
  21. telegrinder/bot/dispatch/handler/abc.py +3 -3
  22. telegrinder/bot/dispatch/handler/func.py +17 -12
  23. telegrinder/bot/dispatch/handler/message_reply.py +6 -7
  24. telegrinder/bot/dispatch/middleware/__init__.py +1 -1
  25. telegrinder/bot/dispatch/process.py +30 -11
  26. telegrinder/bot/dispatch/return_manager/__init__.py +4 -4
  27. telegrinder/bot/dispatch/return_manager/callback_query.py +1 -2
  28. telegrinder/bot/dispatch/return_manager/inline_query.py +1 -2
  29. telegrinder/bot/dispatch/return_manager/message.py +1 -2
  30. telegrinder/bot/dispatch/view/__init__.py +8 -8
  31. telegrinder/bot/dispatch/view/abc.py +9 -4
  32. telegrinder/bot/dispatch/view/box.py +2 -2
  33. telegrinder/bot/dispatch/view/callback_query.py +1 -2
  34. telegrinder/bot/dispatch/view/chat_join_request.py +1 -2
  35. telegrinder/bot/dispatch/view/chat_member.py +16 -2
  36. telegrinder/bot/dispatch/view/inline_query.py +1 -2
  37. telegrinder/bot/dispatch/view/message.py +1 -2
  38. telegrinder/bot/dispatch/view/raw.py +8 -10
  39. telegrinder/bot/dispatch/waiter_machine/__init__.py +3 -3
  40. telegrinder/bot/dispatch/waiter_machine/machine.py +10 -6
  41. telegrinder/bot/dispatch/waiter_machine/short_state.py +2 -2
  42. telegrinder/bot/polling/abc.py +1 -1
  43. telegrinder/bot/polling/polling.py +3 -3
  44. telegrinder/bot/rules/__init__.py +20 -20
  45. telegrinder/bot/rules/abc.py +50 -40
  46. telegrinder/bot/rules/adapter/__init__.py +5 -5
  47. telegrinder/bot/rules/adapter/abc.py +6 -3
  48. telegrinder/bot/rules/adapter/errors.py +2 -1
  49. telegrinder/bot/rules/adapter/event.py +27 -15
  50. telegrinder/bot/rules/adapter/node.py +28 -22
  51. telegrinder/bot/rules/adapter/raw_update.py +13 -5
  52. telegrinder/bot/rules/callback_data.py +4 -4
  53. telegrinder/bot/rules/chat_join.py +4 -4
  54. telegrinder/bot/rules/func.py +1 -1
  55. telegrinder/bot/rules/inline.py +3 -3
  56. telegrinder/bot/rules/markup.py +3 -1
  57. telegrinder/bot/rules/message_entities.py +1 -1
  58. telegrinder/bot/rules/text.py +1 -2
  59. telegrinder/bot/rules/update.py +1 -2
  60. telegrinder/bot/scenario/abc.py +2 -2
  61. telegrinder/bot/scenario/checkbox.py +1 -2
  62. telegrinder/bot/scenario/choice.py +1 -2
  63. telegrinder/model.py +6 -1
  64. telegrinder/msgspec_utils.py +55 -55
  65. telegrinder/node/__init__.py +1 -3
  66. telegrinder/node/base.py +14 -86
  67. telegrinder/node/composer.py +71 -74
  68. telegrinder/node/container.py +3 -3
  69. telegrinder/node/event.py +40 -31
  70. telegrinder/node/polymorphic.py +12 -6
  71. telegrinder/node/rule.py +1 -9
  72. telegrinder/node/scope.py +9 -1
  73. telegrinder/node/source.py +11 -0
  74. telegrinder/node/update.py +6 -2
  75. telegrinder/rules.py +59 -0
  76. telegrinder/tools/error_handler/abc.py +2 -2
  77. telegrinder/tools/error_handler/error_handler.py +5 -5
  78. telegrinder/tools/global_context/global_context.py +1 -1
  79. telegrinder/tools/keyboard.py +1 -1
  80. telegrinder/tools/loop_wrapper/loop_wrapper.py +9 -9
  81. telegrinder/tools/magic.py +64 -19
  82. telegrinder/types/__init__.py +1 -0
  83. telegrinder/types/enums.py +1 -0
  84. telegrinder/types/methods.py +78 -11
  85. telegrinder/types/objects.py +46 -24
  86. telegrinder/verification_utils.py +1 -3
  87. {telegrinder-0.1.dev171.dist-info → telegrinder-0.2.0.dist-info}/METADATA +1 -1
  88. telegrinder-0.2.0.dist-info/RECORD +145 -0
  89. telegrinder/api/abc.py +0 -79
  90. telegrinder-0.1.dev171.dist-info/RECORD +0 -145
  91. {telegrinder-0.1.dev171.dist-info → telegrinder-0.2.0.dist-info}/LICENSE +0 -0
  92. {telegrinder-0.1.dev171.dist-info → telegrinder-0.2.0.dist-info}/WHEEL +0 -0
@@ -9,11 +9,11 @@ from telegrinder.types.enums import * # noqa: F403
9
9
  from telegrinder.types.objects import * # noqa: F403
10
10
 
11
11
  if typing.TYPE_CHECKING:
12
- from telegrinder.api.abc import ABCAPI
12
+ from telegrinder.api import API
13
13
 
14
14
 
15
15
  class APIMethods:
16
- """Telegram Bot API 7.8 methods, released `July 31, 2024`."""
16
+ """Telegram Bot API 7.9 methods, released `August 14, 2024`."""
17
17
 
18
18
  default_params = ProxiedDict(
19
19
  typing.TypedDict(
@@ -21,7 +21,7 @@ class APIMethods:
21
21
  )
22
22
  )
23
23
 
24
- def __init__(self, api: "ABCAPI") -> None:
24
+ def __init__(self, api: "API") -> None:
25
25
  self.api = api
26
26
 
27
27
  async def get_updates(
@@ -1053,6 +1053,7 @@ class APIMethods:
1053
1053
  chat_id: int | str,
1054
1054
  star_count: int,
1055
1055
  media: list[InputPaidMedia],
1056
+ business_connection_id: str | None = None,
1056
1057
  caption: str | None = None,
1057
1058
  parse_mode: str | None = default_params["parse_mode"],
1058
1059
  caption_entities: list[MessageEntity] | None = None,
@@ -1069,11 +1070,15 @@ class APIMethods:
1069
1070
  ) -> Result[Message, APIError]:
1070
1071
  """Method `sendPaidMedia`, see the [documentation](https://core.telegram.org/bots/api#sendpaidmedia)
1071
1072
 
1072
- Use this method to send paid media to channel chats. On success, the sent
1073
- Message is returned.
1073
+ Use this method to send paid media. On success, the sent Message is returned.
1074
+
1075
+ :param business_connection_id: Unique identifier of the business connection on behalf of which the message \
1076
+ will be sent.
1074
1077
 
1075
1078
  :param chat_id: Unique identifier for the target chat or username of the target channel \
1076
- (in the format @channelusername).
1079
+ (in the format @channelusername). If the chat is a channel, all Telegram \
1080
+ Star proceeds from this media will be credited to the chat's balance. Otherwise, \
1081
+ they will be credited to the bot's balance.
1077
1082
 
1078
1083
  :param star_count: The number of Telegram Stars that must be paid to buy access to the media. \
1079
1084
 
@@ -1568,7 +1573,7 @@ class APIMethods:
1568
1573
  Use this method to change the chosen reactions on a message. Service messages
1569
1574
  can't be reacted to. Automatically forwarded messages from a channel to
1570
1575
  its discussion group have the same available reactions as messages in the
1571
- channel. Returns True on success.
1576
+ channel. Bots can't use paid reactions. Returns True on success.
1572
1577
 
1573
1578
  :param chat_id: Unique identifier for the target chat or username of the target channel \
1574
1579
  (in the format @channelusername).
@@ -1579,7 +1584,8 @@ class APIMethods:
1579
1584
  :param reaction: A JSON-serialized list of reaction types to set on the message. Currently, \
1580
1585
  as non-premium users, bots can set up to one reaction per message. A custom \
1581
1586
  emoji reaction can be used if it is either already present on the message \
1582
- or explicitly allowed by chat administrators.
1587
+ or explicitly allowed by chat administrators. Paid reactions can't be \
1588
+ used by bots.
1583
1589
 
1584
1590
  :param is_big: Pass True to set the reaction with a big animation.
1585
1591
  """
@@ -2035,6 +2041,67 @@ class APIMethods:
2035
2041
  )
2036
2042
  return full_result(method_response, ChatInviteLink)
2037
2043
 
2044
+ async def create_chat_subscription_invite_link(
2045
+ self,
2046
+ chat_id: int | str,
2047
+ subscription_period: int,
2048
+ subscription_price: int,
2049
+ name: str | None = None,
2050
+ **other: typing.Any,
2051
+ ) -> Result[ChatInviteLink, APIError]:
2052
+ """Method `createChatSubscriptionInviteLink`, see the [documentation](https://core.telegram.org/bots/api#createchatsubscriptioninvitelink)
2053
+
2054
+ Use this method to create a subscription invite link for a channel chat.
2055
+ The bot must have the can_invite_users administrator rights. The link
2056
+ can be edited using the method editChatSubscriptionInviteLink or revoked
2057
+ using the method revokeChatInviteLink. Returns the new invite link as
2058
+ a ChatInviteLink object.
2059
+
2060
+ :param chat_id: Unique identifier for the target channel chat or username of the target \
2061
+ channel (in the format @channelusername).
2062
+
2063
+ :param name: Invite link name; 0-32 characters.
2064
+
2065
+ :param subscription_period: The number of seconds the subscription will be active for before the next \
2066
+ payment. Currently, it must always be 2592000 (30 days).
2067
+
2068
+ :param subscription_price: The amount of Telegram Stars a user must pay initially and after each subsequent \
2069
+ subscription period to be a member of the chat; 1-2500.
2070
+ """
2071
+
2072
+ method_response = await self.api.request_raw(
2073
+ "createChatSubscriptionInviteLink",
2074
+ get_params(locals()),
2075
+ )
2076
+ return full_result(method_response, ChatInviteLink)
2077
+
2078
+ async def edit_chat_subscription_invite_link(
2079
+ self,
2080
+ chat_id: int | str,
2081
+ invite_link: str,
2082
+ name: str | None = None,
2083
+ **other: typing.Any,
2084
+ ) -> Result[ChatInviteLink, APIError]:
2085
+ """Method `editChatSubscriptionInviteLink`, see the [documentation](https://core.telegram.org/bots/api#editchatsubscriptioninvitelink)
2086
+
2087
+ Use this method to edit a subscription invite link created by the bot. The
2088
+ bot must have the can_invite_users administrator rights. Returns the
2089
+ edited invite link as a ChatInviteLink object.
2090
+
2091
+ :param chat_id: Unique identifier for the target chat or username of the target channel \
2092
+ (in the format @channelusername).
2093
+
2094
+ :param invite_link: The invite link to edit.
2095
+
2096
+ :param name: Invite link name; 0-32 characters.
2097
+ """
2098
+
2099
+ method_response = await self.api.request_raw(
2100
+ "editChatSubscriptionInviteLink",
2101
+ get_params(locals()),
2102
+ )
2103
+ return full_result(method_response, ChatInviteLink)
2104
+
2038
2105
  async def revoke_chat_invite_link(
2039
2106
  self,
2040
2107
  chat_id: int | str,
@@ -2549,8 +2616,8 @@ class APIMethods:
2549
2616
 
2550
2617
  Use this method to edit name and icon of a topic in a forum supergroup chat.
2551
2618
  The bot must be an administrator in the chat for this to work and must have
2552
- can_manage_topics administrator rights, unless it is the creator of the
2553
- topic. Returns True on success.
2619
+ the can_manage_topics administrator rights, unless it is the creator
2620
+ of the topic. Returns True on success.
2554
2621
 
2555
2622
  :param chat_id: Unique identifier for the target chat or username of the target supergroup \
2556
2623
  (in the format @supergroupusername).
@@ -2681,7 +2748,7 @@ class APIMethods:
2681
2748
 
2682
2749
  Use this method to edit the name of the 'General' topic in a forum supergroup
2683
2750
  chat. The bot must be an administrator in the chat for this to work and must
2684
- have can_manage_topics administrator rights. Returns True on success.
2751
+ have the can_manage_topics administrator rights. Returns True on success.
2685
2752
 
2686
2753
  :param chat_id: Unique identifier for the target chat or username of the target supergroup \
2687
2754
  (in the format @supergroupusername).
@@ -1,5 +1,6 @@
1
1
  import pathlib
2
2
  import typing
3
+ from functools import cached_property
3
4
 
4
5
  from fntypes.co import Variative
5
6
 
@@ -35,6 +36,7 @@ class ReactionType(Model):
35
36
  This object describes the type of a reaction. Currently, it can be one of
36
37
  - ReactionTypeEmoji
37
38
  - ReactionTypeCustomEmoji
39
+ - ReactionTypePaid
38
40
  """
39
41
 
40
42
 
@@ -320,20 +322,21 @@ class Update(Model):
320
322
  """Optional. A boost was removed from a chat. The bot must be an administrator
321
323
  in the chat to receive these updates."""
322
324
 
323
- def __eq__(self, other: typing.Any) -> bool:
325
+ def __eq__(self, other: object) -> bool:
324
326
  return isinstance(other, self.__class__) and self.update_type == other.update_type
325
327
 
326
- @property
328
+ @cached_property
327
329
  def update_type(self) -> UpdateType:
328
330
  """Incoming update type."""
329
331
 
330
332
  return UpdateType(
331
333
  next(
332
- filter(
333
- lambda x: bool(x[1]),
334
- self.to_dict(exclude_fields={"update_id"}).items(),
335
- ),
336
- )[0],
334
+ (
335
+ x
336
+ for x in self.__struct_fields__
337
+ if x != "update_id" and not isinstance(getattr(self, x), type(Nothing))
338
+ )
339
+ ),
337
340
  )
338
341
 
339
342
 
@@ -426,7 +429,7 @@ class User(Model):
426
429
  has_main_web_app: Option[bool] = Nothing
427
430
  """Optional. True, if the bot has a main Web App. Returned only in getMe."""
428
431
 
429
- def __eq__(self, other: typing.Any) -> bool:
432
+ def __eq__(self, other: object) -> bool:
430
433
  return isinstance(other, self.__class__) and self.id == other.id
431
434
 
432
435
  @property
@@ -472,7 +475,7 @@ class Chat(Model):
472
475
  is_forum: Option[bool] = Nothing
473
476
  """Optional. True, if the supergroup chat is a forum (has topics enabled)."""
474
477
 
475
- def __eq__(self, other: typing.Any) -> bool:
478
+ def __eq__(self, other: object) -> bool:
476
479
  return isinstance(other, self.__class__) and self.id == other.id
477
480
 
478
481
  @property
@@ -544,7 +547,9 @@ class ChatFullInfo(Model):
544
547
  personal_chat: Option["Chat"] = Nothing
545
548
  """Optional. For private chats, the personal channel of the user."""
546
549
 
547
- available_reactions: Option[list[Variative["ReactionTypeEmoji", "ReactionTypeCustomEmoji"]]] = Nothing
550
+ available_reactions: Option[
551
+ list[Variative["ReactionTypeEmoji", "ReactionTypeCustomEmoji", "ReactionTypePaid"]]
552
+ ] = Nothing
548
553
  """Optional. List of available reactions allowed in the chat. If omitted,
549
554
  then all emoji reactions are allowed."""
550
555
 
@@ -673,17 +678,17 @@ class Message(MaybeInaccessibleMessage):
673
678
  for supergroups only."""
674
679
 
675
680
  from_: Option["User"] = Nothing
676
- """Optional. Sender of the message; empty for messages sent to channels. For
677
- backward compatibility, the field contains a fake sender user in non-channel
678
- chats, if the message was sent on behalf of a chat."""
681
+ """Optional. Sender of the message; may be empty for messages sent to channels.
682
+ For backward compatibility, if the message was sent on behalf of a chat,
683
+ the field contains a fake sender user in non-channel chats."""
679
684
 
680
685
  sender_chat: Option["Chat"] = Nothing
681
- """Optional. Sender of the message, sent on behalf of a chat. For example, the
682
- channel itself for channel posts, the supergroup itself for messages from
683
- anonymous group administrators, the linked channel for messages automatically
684
- forwarded to the discussion group. For backward compatibility, the field
685
- from contains a fake sender user in non-channel chats, if the message was
686
- sent on behalf of a chat."""
686
+ """Optional. Sender of the message when sent on behalf of a chat. For example,
687
+ the supergroup itself for messages sent by its anonymous administrators
688
+ or a linked channel for messages automatically forwarded to the channel's
689
+ discussion group. For backward compatibility, if the message was sent
690
+ on behalf of a chat, the field from contains a fake sender user in non-channel
691
+ chats."""
687
692
 
688
693
  sender_boost_count: Option[int] = Nothing
689
694
  """Optional. If the sender of the message boosted the chat, the number of boosts
@@ -973,14 +978,14 @@ class Message(MaybeInaccessibleMessage):
973
978
  """Optional. Inline keyboard attached to the message. login_url buttons
974
979
  are represented as ordinary url buttons."""
975
980
 
976
- def __eq__(self, other: typing.Any) -> bool:
981
+ def __eq__(self, other: object) -> bool:
977
982
  return (
978
983
  isinstance(other, self.__class__)
979
984
  and self.message_id == other.message_id
980
985
  and self.chat_id == other.chat_id
981
986
  )
982
987
 
983
- @property
988
+ @cached_property
984
989
  def content_type(self) -> ContentType:
985
990
  """Type of content that the message contains."""
986
991
 
@@ -3011,6 +3016,9 @@ class ChatMemberMember(ChatMember):
3011
3016
  user: "User"
3012
3017
  """Information about the user."""
3013
3018
 
3019
+ until_date: Option[datetime] = Nothing
3020
+ """Optional. Date when the user's subscription will expire; Unix time."""
3021
+
3014
3022
 
3015
3023
  class ChatMemberRestricted(ChatMember):
3016
3024
  """Object `ChatMemberRestricted`, see the [documentation](https://core.telegram.org/bots/api#chatmemberrestricted).
@@ -3329,13 +3337,23 @@ class ReactionTypeCustomEmoji(ReactionType):
3329
3337
  """Custom emoji identifier."""
3330
3338
 
3331
3339
 
3340
+ class ReactionTypePaid(ReactionType):
3341
+ """Object `ReactionTypePaid`, see the [documentation](https://core.telegram.org/bots/api#reactiontypepaid).
3342
+
3343
+ The reaction is paid.
3344
+ """
3345
+
3346
+ type: typing.Literal["paid"]
3347
+ """Type of the reaction, always `paid`."""
3348
+
3349
+
3332
3350
  class ReactionCount(Model):
3333
3351
  """Object `ReactionCount`, see the [documentation](https://core.telegram.org/bots/api#reactioncount).
3334
3352
 
3335
3353
  Represents a reaction added to a message along with the number of times it was added.
3336
3354
  """
3337
3355
 
3338
- type: Variative["ReactionTypeEmoji", "ReactionTypeCustomEmoji"]
3356
+ type: Variative["ReactionTypeEmoji", "ReactionTypeCustomEmoji", "ReactionTypePaid"]
3339
3357
  """Type of the reaction."""
3340
3358
 
3341
3359
  total_count: int
@@ -3357,10 +3375,10 @@ class MessageReactionUpdated(Model):
3357
3375
  date: datetime
3358
3376
  """Date of the change in Unix time."""
3359
3377
 
3360
- old_reaction: list[Variative["ReactionTypeEmoji", "ReactionTypeCustomEmoji"]]
3378
+ old_reaction: list[Variative["ReactionTypeEmoji", "ReactionTypeCustomEmoji", "ReactionTypePaid"]]
3361
3379
  """Previous list of reaction types that were set by the user."""
3362
3380
 
3363
- new_reaction: list[Variative["ReactionTypeEmoji", "ReactionTypeCustomEmoji"]]
3381
+ new_reaction: list[Variative["ReactionTypeEmoji", "ReactionTypeCustomEmoji", "ReactionTypePaid"]]
3364
3382
  """New list of reaction types that have been set by the user."""
3365
3383
 
3366
3384
  user: Option["User"] = Nothing
@@ -5749,6 +5767,9 @@ class TransactionPartnerUser(TransactionPartner):
5749
5767
  invoice_payload: Option[str] = Nothing
5750
5768
  """Optional. Bot-specified invoice payload."""
5751
5769
 
5770
+ paid_media: Option[list[Variative["PaidMediaPreview", "PaidMediaPhoto", "PaidMediaVideo"]]] = Nothing
5771
+ """Optional. Information about the paid media bought by the user."""
5772
+
5752
5773
 
5753
5774
  class TransactionPartnerFragment(TransactionPartner):
5754
5775
  """Object `TransactionPartnerFragment`, see the [documentation](https://core.telegram.org/bots/api#transactionpartnerfragment).
@@ -6421,6 +6442,7 @@ __all__ = (
6421
6442
  "ReactionType",
6422
6443
  "ReactionTypeCustomEmoji",
6423
6444
  "ReactionTypeEmoji",
6445
+ "ReactionTypePaid",
6424
6446
  "RefundedPayment",
6425
6447
  "ReplyKeyboardMarkup",
6426
6448
  "ReplyKeyboardRemove",
@@ -2,8 +2,6 @@ import hashlib
2
2
  import hmac
3
3
  import typing
4
4
 
5
- from telegrinder.api.abc import Token
6
-
7
5
 
8
6
  def verify_webapp_request(
9
7
  secret_token: str,
@@ -15,7 +13,7 @@ def verify_webapp_request(
15
13
 
16
14
 
17
15
  def webapp_validate_request(
18
- bot_token: Token,
16
+ bot_token: str,
19
17
  request_query_params: typing.Mapping[str, typing.Any],
20
18
  ) -> bool:
21
19
  """Verifies authentity of webapp request by counting hash of its parameters."""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: telegrinder
3
- Version: 0.1.dev171
3
+ Version: 0.2.0
4
4
  Summary: Modern visionary telegram bot framework.
5
5
  Home-page: https://github.com/timoniq/telegrinder
6
6
  License: MIT
@@ -0,0 +1,145 @@
1
+ telegrinder/__init__.py,sha256=6w6pzPVw-MOX4zBcNLxEeWfX5yCAbrltcjILhs0yA1I,4219
2
+ telegrinder/api/__init__.py,sha256=AFZ07UvdL4rhq9lZpB-j9JuGOONmfkvt8RfdG71ND38,226
3
+ telegrinder/api/api.py,sha256=OSwm2_mgHS9jCsKy_vdOJzVtH-j6v68ypkdtvKFlQ3w,2877
4
+ telegrinder/api/error.py,sha256=6_KBR819Tg9mLI7w5aHHYnrS8VSDYNkWIrHCnfgCFKk,422
5
+ telegrinder/api/response.py,sha256=d7Oxd5kOdbZNJiALkzkecHl8Y3K_BzCmsRq2Sn3otqA,491
6
+ telegrinder/api/token.py,sha256=wBnMHOgZZuQctsqPKT-u5GVdrj5vJ6u5zpJJOGS8or8,945
7
+ telegrinder/bot/__init__.py,sha256=VP6fLRT3QDU3a5noQdMBqh7IonyIKQrbPwJkgRI52M8,2033
8
+ telegrinder/bot/bot.py,sha256=qrB7GHglZG1wuXdPrAQ7kFzcuOT1og_ybwuem_feL-U,2780
9
+ telegrinder/bot/cute_types/__init__.py,sha256=moe1mSKesNqUBf8m11s2wiL0fJIa8JOEHRqDr2Tira8,639
10
+ telegrinder/bot/cute_types/base.py,sha256=neUZ44REmV_6boN6aPfuM5BeLlMzH9eZ9rgSgQxOx5A,8072
11
+ telegrinder/bot/cute_types/callback_query.py,sha256=nXFFnKHD4qJFpuzxySRRESloThWUGHdJRN8PshFfPY8,20885
12
+ telegrinder/bot/cute_types/chat_join_request.py,sha256=xL0DG-7XSbbKpYOeOuNFCg-wWMkO0uCPygUvV4G23mg,2305
13
+ telegrinder/bot/cute_types/chat_member_updated.py,sha256=Y6RHfqnnk3FlCmPcVMIfGk7nKvrwT5jAUGvCCXqI5G8,10904
14
+ telegrinder/bot/cute_types/inline_query.py,sha256=M9h4wNpFArKgoLPOO6H1AAl6jovuY9BnGwEmqfjp7bo,2493
15
+ telegrinder/bot/cute_types/message.py,sha256=SHK_svaTBS17ERP5kaxcyaiqPYKhhQYhmshFhAWnJtA,150451
16
+ telegrinder/bot/cute_types/update.py,sha256=61zCccok1muityF9HgJz_-sN7oVuw0-s-p_W6bPSpME,3102
17
+ telegrinder/bot/cute_types/utils.py,sha256=oJWRS7TCkvDhckwhc8yxw3Qn1NKvqDtEGTZ745qEbMg,2530
18
+ telegrinder/bot/dispatch/__init__.py,sha256=TMfpLX4OABPgTjntOcC5uxUc8x8VXNlxSc-7iDX73ww,1668
19
+ telegrinder/bot/dispatch/abc.py,sha256=u8mAHiyN0rAHQfw1YxKM4Nt8TovGSJjEAl4ARCj7m9A,650
20
+ telegrinder/bot/dispatch/context.py,sha256=A5kzxzsPy6e4SSd2DYrb5RJ5Flo0FIJOPs1H4T3NTgo,2588
21
+ telegrinder/bot/dispatch/dispatch.py,sha256=BWQSPuK9BICxqlZq71FqacMCAiIXggjRk6R3PAdl18s,6081
22
+ telegrinder/bot/dispatch/handler/__init__.py,sha256=oa4owBqZ3SWOuwYWuitPUjM1-KO0ivCPW1LGObn4Brk,265
23
+ telegrinder/bot/dispatch/handler/abc.py,sha256=FB2Xkiy-ZFsX2pEHfM7tCIXXjgWSouu07JYosICS9UA,578
24
+ telegrinder/bot/dispatch/handler/func.py,sha256=o0Ac47XhMq0wlwtMeNVvoQCavu9vSI3z6Zzssh4P8vU,4808
25
+ telegrinder/bot/dispatch/handler/message_reply.py,sha256=jkGFZ5boYE-uii0KTE5jmtNXdPo-Gs-Abj-_YpSQZVE,2010
26
+ telegrinder/bot/dispatch/middleware/__init__.py,sha256=znQGQ0jnBioEXr-2RPHOkmDbjei4LEbaTjgiE9c8aXI,96
27
+ telegrinder/bot/dispatch/middleware/abc.py,sha256=O3aiE44XpjE6h9iXYc_uWNZCBxDH1KAFrLej4nsJhUI,413
28
+ telegrinder/bot/dispatch/process.py,sha256=T_jfpXjYf0qSFdmY94lNDYUqhdjyCZycWEwCiAcLxBg,4198
29
+ telegrinder/bot/dispatch/return_manager/__init__.py,sha256=z1c9ZC_OdbEJ7utmA8jRiSjJQNTBLlTKmIQzrl-kDJs,602
30
+ telegrinder/bot/dispatch/return_manager/abc.py,sha256=iKO67VMmEbCLsqRDYmnWle2aL3xsZhjkxVKVXfeoVhE,3559
31
+ telegrinder/bot/dispatch/return_manager/callback_query.py,sha256=bxpOjdicsUeKael11UNeXjzHQZuc9sFHLLdPatwiTVg,690
32
+ telegrinder/bot/dispatch/return_manager/inline_query.py,sha256=xCxUzwSqDNAu8EfHW32WfcUtFHMUJ5OfJQQA19qI2nw,513
33
+ telegrinder/bot/dispatch/return_manager/message.py,sha256=fQ41ktzsg4Y26aUYhZOtQD8UYX8tvhVPRdfHfQ4UjZs,1198
34
+ telegrinder/bot/dispatch/view/__init__.py,sha256=xl5opgUk7iDTApGDQWcfDBHIq-rb1qOs2KcM6s2PpB0,801
35
+ telegrinder/bot/dispatch/view/abc.py,sha256=CEb3yMK77wfPeWQc1gqimdvrR7p6zM9s2yBSmBAnCJo,6757
36
+ telegrinder/bot/dispatch/view/box.py,sha256=ydqvuReC7lUZmuNLCEAbs6xOWDWBUj99MpTMhX0jWT8,5530
37
+ telegrinder/bot/dispatch/view/callback_query.py,sha256=wUSFDHykKpDRwZka6exMk2TliMTK1NFKSu88vyMe2Pc,588
38
+ telegrinder/bot/dispatch/view/chat_join_request.py,sha256=10K4BNSO7_-LaFvUWn8wa7JC1oqXLu-7L_NPqVG7CwA,475
39
+ telegrinder/bot/dispatch/view/chat_member.py,sha256=lkHms6P_fdnq7U1KeaL3RCt1ReeX9qDvr2123YsNhrY,1218
40
+ telegrinder/bot/dispatch/view/inline_query.py,sha256=wgel-euw601uk5qHIUZF7vyuhP5ggy0n4k-6103hM7A,559
41
+ telegrinder/bot/dispatch/view/message.py,sha256=FzfL8Yn42exnvMj8VuKwNlKaHPhij5eBzLCrju7FEc0,1356
42
+ telegrinder/bot/dispatch/view/raw.py,sha256=XMlJ0-XeuUfFUjSaI7ApR-gcGmSZ1eB_USHsCKdeMyY,3536
43
+ telegrinder/bot/dispatch/waiter_machine/__init__.py,sha256=IeoNZIxAut4QZCqiQrA6g_BcSFyUdA-oFgfBhsG6ipA,363
44
+ telegrinder/bot/dispatch/waiter_machine/machine.py,sha256=bMMYSwQPZbu58GYk364xu10_G8pLv0OAbvQRz69RhOs,5954
45
+ telegrinder/bot/dispatch/waiter_machine/middleware.py,sha256=f4IJgjMwACOetmAIo6mey5WYOmO3Sw3OG3pga5ptsCc,3528
46
+ telegrinder/bot/dispatch/waiter_machine/short_state.py,sha256=V1NZUwM_pjO-NVvN1kOnx4yo6Mdt5SXMmQnSY5xp21w,2116
47
+ telegrinder/bot/polling/__init__.py,sha256=OqfIFPS_V6UrCg-vCv9pkMFzTKdNbDP2faBfATs_TGg,94
48
+ telegrinder/bot/polling/abc.py,sha256=qFiKzWTWENK-sSuShC5cPlM-JS4In2c8-1_ARdwdTms,442
49
+ telegrinder/bot/polling/polling.py,sha256=w6_d6hOWY2ER5UG6EgGl2ceLvgJNDjeK13sUUmxWcfc,4714
50
+ telegrinder/bot/rules/__init__.py,sha256=0uKfqa0myqjIBcwzfq5YxoRn0aZFR4IlQ3joFROIFEA,2772
51
+ telegrinder/bot/rules/abc.py,sha256=-y5dlftZZaYVPuvJsEmgYcM9nd8MDj3mdlN4Et1Vje8,6122
52
+ telegrinder/bot/rules/adapter/__init__.py,sha256=kWcGnK0N26WsOwtF2n_yy1M2YMOtOp75931-ssVtOps,445
53
+ telegrinder/bot/rules/adapter/abc.py,sha256=lPyieSDDr1z98rZ4W6Ic8QzHDzCEU9xIYrPKU9qDCas,682
54
+ telegrinder/bot/rules/adapter/errors.py,sha256=2r_UBTWm5-heU-NchBfobC1f848EWeC64nKvprGnAAY,73
55
+ telegrinder/bot/rules/adapter/event.py,sha256=XDeHYGwOS7bYsI5bP-iPg5Ut_dzGbTBC089OkJhSfpY,2772
56
+ telegrinder/bot/rules/adapter/node.py,sha256=VuC_LGGkZh6GKW3dCvfDZhbiA8WJyddY8xxzerUZ7us,1663
57
+ telegrinder/bot/rules/adapter/raw_update.py,sha256=r-AeEyGdJS8zpAj5Edzy___OlgT4cMQH9MO-Cq1p0Vk,1039
58
+ telegrinder/bot/rules/callback_data.py,sha256=Sy2T2NF5eEvZ6BTsJd4j6KwAxLLcoZI0A4ZIF3bq7AM,5473
59
+ telegrinder/bot/rules/chat_join.py,sha256=mFmSOXkiU_wSuIjKgMxh8mIusqeH_-DKVvouxdgZe-4,1446
60
+ telegrinder/bot/rules/command.py,sha256=ESJA21HZHWT0RlYzHqOKBa223CTFbqwx_cgvNsWao44,3912
61
+ telegrinder/bot/rules/enum_text.py,sha256=YJ6S2fAQts8zCjCgoL7uUGWlnPOH59rjvA7Si2hKyR4,944
62
+ telegrinder/bot/rules/func.py,sha256=dqcxhC7dIP67Zi20iFz2jCWwwioM2NuemCM5dwpQDXg,769
63
+ telegrinder/bot/rules/fuzzy.py,sha256=Kx4S1y6iFqWM3uIUmor47mCmD08NRRJbcciH-dFs19M,676
64
+ telegrinder/bot/rules/inline.py,sha256=ETAwNdVdOKyk46oK2QoYCH1Sik-FbOGx4Ra5j63aGo8,1939
65
+ telegrinder/bot/rules/integer.py,sha256=kyH2MxlUlDF7i--2mwunOP6Xvjvw4V2IxSyjg8EIMuQ,435
66
+ telegrinder/bot/rules/is_from.py,sha256=x7vCbLzqFkFE0GxPgy_WA_mRFa_ogSNTzyJ6PK3Qx0o,3382
67
+ telegrinder/bot/rules/markup.py,sha256=B0nGzO3j9ee6I5272o3ILTuLcP_AL_yI0Lamlc34gxQ,1247
68
+ telegrinder/bot/rules/mention.py,sha256=xteWbtSjQN3KOXpB8RjuVYu18bGrLxNtVFg6oR-UkxU,435
69
+ telegrinder/bot/rules/message.py,sha256=VFfcEmNrw5sW4EYpk2XgLkSE5-rRr7sWC2dFE26Q3cI,442
70
+ telegrinder/bot/rules/message_entities.py,sha256=imYBaajJbtRZy4oYsCYnIAUlr6-OiDURuza647VQ_ZU,1097
71
+ telegrinder/bot/rules/node.py,sha256=IP7Ke-4hILb12XHNIresMf_87kXhlLfKOloShoQvWN0,892
72
+ telegrinder/bot/rules/regex.py,sha256=mjXXPX-NB2e3gFU6LFihLnKANcgUoAL5lOnfmhC3Qnc,1153
73
+ telegrinder/bot/rules/rule_enum.py,sha256=35GwPKLBTG_ESn4TZLcFJTLNjYXAi_d9wrfIDexoEH8,2113
74
+ telegrinder/bot/rules/start.py,sha256=3ciA28m9JNcM-1H2YnLrUNyS1Y4UsyYPR5MClrpdAdA,1154
75
+ telegrinder/bot/rules/text.py,sha256=h8SBiqF3_kkITDRCeDDanmNG80NRoSgj_dutjoV-26Y,964
76
+ telegrinder/bot/rules/update.py,sha256=k73pZzlzhw77gHAmeIsqehy0-EI2ec8wVGxGRIF_8ao,398
77
+ telegrinder/bot/scenario/__init__.py,sha256=nnPjdxdvjoEYYMRUEfWvIhZStiY1C984x1azdRRP9II,136
78
+ telegrinder/bot/scenario/abc.py,sha256=3UwnA9Nt6CETKm2YclD0gVbn-483fTSBriZADd3p-bM,468
79
+ telegrinder/bot/scenario/checkbox.py,sha256=DT4g2exfnSuCqhdla-tsHq4jQ9m5bkgb8Its-ZRfYX0,4187
80
+ telegrinder/bot/scenario/choice.py,sha256=3xkkhSzJWWUI81rlcqM_NpfKIjinsq_y-CFKL0Uz6gc,1464
81
+ telegrinder/client/__init__.py,sha256=ZiS1Wb_l_kv3FHzEEi1oXtFLwlA_HXmWOzeN0xA3E7Y,104
82
+ telegrinder/client/abc.py,sha256=OxsTX_PLYBEeFT9zpidFUzAbQL9BM7rQqru7zdn5DiQ,1611
83
+ telegrinder/client/aiohttp.py,sha256=AqmuHd6Z3zy96YBe7xIMC4U8Hi9SA7j-0EI7xYE3ZCU,4085
84
+ telegrinder/model.py,sha256=bUGDzw_yjrh5MFf1G2DYBBXJnk4o9RpNCN06mKxs6d4,7334
85
+ telegrinder/modules.py,sha256=GDGBT79wTcC_vEG4-1zWe4E5fMNbp6-n6AwJoYF_Oek,7945
86
+ telegrinder/msgspec_json.py,sha256=phfyhUvYYZUGEcI6RAyRx9lnARPK_Fqtw3Q0MEJnuUk,226
87
+ telegrinder/msgspec_utils.py,sha256=UkuN8H5mD4d4CtaclHTrJuylBgXd3i_wX8qmW1PUgLw,10524
88
+ telegrinder/node/__init__.py,sha256=f4rkFvg0TeAjZehHd6qloxHZectsFsTWPh6opdekhSY,1376
89
+ telegrinder/node/attachment.py,sha256=n79uAt1ixgnr8qjBMNstu36qe4Fli63kSvpgW1WO7S8,3061
90
+ telegrinder/node/base.py,sha256=xvpnNhzj4CG29wOQpJ3oAJEyVbk7bLhcD770gJwMARc,3417
91
+ telegrinder/node/callback_query.py,sha256=aDXnDGQb6H7im5J8A-M3vfZHczg0PrFAjUexIK2dTUM,507
92
+ telegrinder/node/command.py,sha256=S6povhUFXJ3o5keuOzTP7nbIrZ16KKkQNK3xji1LPb4,874
93
+ telegrinder/node/composer.py,sha256=gxce2wCPkIrhhKxh2YpndjxIqXzCmpTWGiqiZT2ewV4,6292
94
+ telegrinder/node/container.py,sha256=j1BR5AeAx5oY-zokBUPw79tMKo9aZ_Em89f616QaXiA,643
95
+ telegrinder/node/event.py,sha256=1mFMqzjQb7hoStZW6vAdvm--2zsYO8tNzEvSqIyHqJ8,2361
96
+ telegrinder/node/me.py,sha256=9RhRLsIe1e-yDLZ6ehfmGvhhLYRMu1VAjkSri9H0V8E,378
97
+ telegrinder/node/message.py,sha256=TbT2zeR9kVR-QAqVkRAmtse4U0BHoWfQ4esKMKLzm7A,449
98
+ telegrinder/node/polymorphic.py,sha256=foT6Zp1Woiu8QDVFqirlfV0qpEO5ggMl_lw2UFaLpp4,2038
99
+ telegrinder/node/rule.py,sha256=HCSN1MwSvzGjYeiCdLjcNaUyVQhUVeDlRcdEgiKU3So,2388
100
+ telegrinder/node/scope.py,sha256=m7gIlQQxlsJhbqn5r-bU7q76TrfI1PCGKs7MwVBdbQk,708
101
+ telegrinder/node/source.py,sha256=rs4S5bLRS6W-hcmeNH1HARuLMt-lf2N0iJH8vh6zl0o,2321
102
+ telegrinder/node/text.py,sha256=Jik937Pn6JGAKiplHmHseWDWoflnK5yirvvG_vrUxl8,581
103
+ telegrinder/node/tools/__init__.py,sha256=iyjs82g3brYGzpPsUQaoK6_r7YuQhRkJ61YjjuPOx9E,67
104
+ telegrinder/node/tools/generator.py,sha256=xuhZ5-TwoctFLlDBdYvjOQxHTpqC4IAdnkzMViVSsUM,1046
105
+ telegrinder/node/update.py,sha256=2baHe10IJ0f6oOeQIqBXduRio9PGVd5Q2lbGyfU9yU8,441
106
+ telegrinder/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
107
+ telegrinder/rules.py,sha256=qQHT63Yek8I2zZFbfH2SzvQLUdZCcWBz-DFlz05i39I,1115
108
+ telegrinder/tools/__init__.py,sha256=N_EGjedn096mPw1Tozc4uMCSXH2h9NCFnKuubFZu5ec,2837
109
+ telegrinder/tools/buttons.py,sha256=4Mc8KZ8i8l2XSiJaybbO23ywIx8T3bQiMH0UkyXuj4I,2905
110
+ telegrinder/tools/error_handler/__init__.py,sha256=WmYWZCNhhSk32j4lIOltEwzoYUx086TGTbOF5h3Ps7s,207
111
+ telegrinder/tools/error_handler/abc.py,sha256=BpBtysvMZKxAYAIrQHYXNxP9mCZRzjtshFFwzIXvVi8,882
112
+ telegrinder/tools/error_handler/error.py,sha256=uLcG-wqyOeCEB45m8vMcGy5kZ87bGHUS_-fPw2cGE9s,221
113
+ telegrinder/tools/error_handler/error_handler.py,sha256=nxYNkOgqY4Mn7x8d6w38Vmk6AlyF4EBwNYWQk9RMcrU,6360
114
+ telegrinder/tools/formatting/__init__.py,sha256=1tFuJjMpDphCIOR4uXQhptyLHuAZ26mYSFx_BQwL5Lo,1459
115
+ telegrinder/tools/formatting/html.py,sha256=h8hyN6t6cJfMBjMf-XWZixVnweoAuLUIJ1xjg9JOJDw,8736
116
+ telegrinder/tools/formatting/links.py,sha256=dYJy2qPxa4YGHYqSSCTv-6hXz0Aa0AGuzsLXwbxPZ9A,1112
117
+ telegrinder/tools/formatting/spec_html_formats.py,sha256=I-OULqlof8NOeSNGBddKkudqMLjsMAQ02Pc6qH_fNRQ,2617
118
+ telegrinder/tools/global_context/__init__.py,sha256=5pF9growKd28WO739wk_DZUqCDw5hxs6eUcDtxTosX8,290
119
+ telegrinder/tools/global_context/abc.py,sha256=twwAmbTk49KGl_POImr4yj6POr-zdx8mz74McuphZH0,1644
120
+ telegrinder/tools/global_context/global_context.py,sha256=U-rdGgPJ5Cde4FuV6IP6jQWxlrvDaH6YYuBSA6RFWHU,13679
121
+ telegrinder/tools/global_context/telegrinder_ctx.py,sha256=U6DHIC-B40HLWojwU3tAui256VcZpTpUmYhSSqV0vDY,663
122
+ telegrinder/tools/i18n/__init__.py,sha256=CLUoiCJzOZzF-dqDIHZ5Fc8QUa38cYhIG4WF-ctPLfE,288
123
+ telegrinder/tools/i18n/base.py,sha256=jxJVYiTplJaNeklkGiin-m7BkfZiac2fbVXTEdhNw6o,726
124
+ telegrinder/tools/i18n/middleware/__init__.py,sha256=y5ZX6s3fOix_Yn98UNO8VqQ7ihJbQ_e5Uz01RgL7pHg,82
125
+ telegrinder/tools/i18n/middleware/base.py,sha256=gGqcPxJLLC3f6XfV_0-drhr27TND40cL1Z5sNmC84lo,663
126
+ telegrinder/tools/i18n/simple.py,sha256=yiaGtEAaMkrzYV3O7esA2wi3A2n9YyndxKPKp8Fs834,1567
127
+ telegrinder/tools/kb_set/__init__.py,sha256=k1KCQTnvEgJ2y4KlghhJWOh5rccwg_27cs8264NtMmk,156
128
+ telegrinder/tools/kb_set/base.py,sha256=mbZs-ViUErfSibzyN064IqZp76LBJPg3NB4D9v4VFtg,243
129
+ telegrinder/tools/kb_set/yaml.py,sha256=glk27r0L9Y8ibaPmTHMAEJZw-ED-ehmSo_NdJNKkrNs,2007
130
+ telegrinder/tools/keyboard.py,sha256=3zaBOMWMV5rPQg6BsLI7S_6_Nhyl2yKosFCbQAk9GzM,3684
131
+ telegrinder/tools/limited_dict.py,sha256=tb1WT4P3Oia5CsCBXTHzlFjrPnIgf9eHCkQ0zhAbEUg,1078
132
+ telegrinder/tools/loop_wrapper/__init__.py,sha256=ZQ5jmE1lOKnqJlMZ9k2OYmjvOEhOlHPijUWqZ4nHIgk,165
133
+ telegrinder/tools/loop_wrapper/abc.py,sha256=ET_Dp-kRz75Jo1fZB3qofUgEXN4FqlU0xH2diESKGCM,266
134
+ telegrinder/tools/loop_wrapper/loop_wrapper.py,sha256=k5NaZ-18c8zuzBHpHNk03_33dHFNww8HiCJEGz2g5W0,6815
135
+ telegrinder/tools/magic.py,sha256=oPaEqqtbFEVXHVCjdbmUvbjtWiQCw2yuMOfoQLLyFjE,4332
136
+ telegrinder/tools/parse_mode.py,sha256=JyQ-x9YAMPLhIIiUX01acyKkpWgs5TBA07W-iUyPHpE,92
137
+ telegrinder/types/__init__.py,sha256=_7ANa63K4rMRWHgSBSQJXi2mNMtOJgp_E4yGattsgJE,6612
138
+ telegrinder/types/enums.py,sha256=q9URlXZvrjOUQKpLfV6v9uspBcLrdW0gtU-m8YDnj7w,19017
139
+ telegrinder/types/methods.py,sha256=Ah7DVfyb99EJzYHCX9feW9hIGBYcnHLKEzu5MUp4rvg,201058
140
+ telegrinder/types/objects.py,sha256=6bN1BsYZ-Kmh1GcXgtumfZvvLJqxjjjJ9OzyfqBtGZM,244504
141
+ telegrinder/verification_utils.py,sha256=X7N0mHoOzbcYeKa5XxI_EFhmEGX5XNU3qqgbV8YRRa4,987
142
+ telegrinder-0.2.0.dist-info/LICENSE,sha256=Q0tKgU8mPOCQAkc6m__BrNIpRge8mPBQJDd59s21NZo,1095
143
+ telegrinder-0.2.0.dist-info/METADATA,sha256=tymq-AfNLTdigt7POIse-MghEs7gYnwrT0hbZXE9aBM,3002
144
+ telegrinder-0.2.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
145
+ telegrinder-0.2.0.dist-info/RECORD,,
telegrinder/api/abc.py DELETED
@@ -1,79 +0,0 @@
1
- import pathlib
2
- import typing
3
- from abc import ABC, abstractmethod
4
- from functools import cached_property
5
-
6
- import msgspec
7
- from envparse import env
8
- from fntypes.result import Result
9
-
10
- from telegrinder.api.error import APIError
11
- from telegrinder.client import ABCClient
12
-
13
- from .error import InvalidTokenError
14
-
15
-
16
- class Token(str):
17
- def __new__(cls, token: str) -> typing.Self:
18
- if token.count(":") != 1 or not token.split(":")[0].isdigit():
19
- raise InvalidTokenError("Invalid token, it should look like this '123:ABC'.")
20
- return super().__new__(cls, token)
21
-
22
- def __repr__(self) -> str:
23
- return f"<Token: {self.bot_id}:{''.join(self.split(':')[-1])[:6]}...>"
24
-
25
- @classmethod
26
- def from_env(
27
- cls,
28
- var_name: str = "BOT_TOKEN",
29
- *,
30
- is_read: bool = False,
31
- path_to_envfile: str | pathlib.Path | None = None,
32
- ) -> typing.Self:
33
- if not is_read:
34
- env.read_envfile(path_to_envfile)
35
- return cls(env.str(var_name))
36
-
37
- @cached_property
38
- def bot_id(self) -> int:
39
- return int(self.split(":")[0])
40
-
41
-
42
- class ABCAPI(ABC):
43
- http: ABCClient
44
-
45
- @abstractmethod
46
- async def request(
47
- self,
48
- method: str,
49
- data: dict[str, typing.Any] | None = None,
50
- files: dict[str, tuple[str, bytes]] | None = None,
51
- ) -> Result[list[typing.Any] | dict[str, typing.Any] | bool, APIError]:
52
- pass
53
-
54
- @abstractmethod
55
- async def request_raw(
56
- self,
57
- method: str,
58
- data: dict[str, typing.Any] | None = None,
59
- files: dict[str, tuple[str, bytes]] | None = None,
60
- ) -> Result[msgspec.Raw, APIError]:
61
- pass
62
-
63
- @property
64
- @abstractmethod
65
- def request_url(self) -> str:
66
- pass
67
-
68
- @property
69
- @abstractmethod
70
- def request_file_url(self) -> str:
71
- pass
72
-
73
- @property
74
- @abstractmethod
75
- def id(self) -> int:
76
- pass
77
-
78
-
79
- __all__ = ("ABCAPI", "Token")