telegrinder 0.4.2__py3-none-any.whl → 0.5.1__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 (233) hide show
  1. telegrinder/__init__.py +37 -55
  2. telegrinder/__meta__.py +1 -0
  3. telegrinder/api/__init__.py +6 -4
  4. telegrinder/api/api.py +100 -26
  5. telegrinder/api/error.py +42 -8
  6. telegrinder/api/response.py +4 -1
  7. telegrinder/api/token.py +2 -2
  8. telegrinder/bot/__init__.py +9 -25
  9. telegrinder/bot/bot.py +31 -25
  10. telegrinder/bot/cute_types/__init__.py +0 -0
  11. telegrinder/bot/cute_types/base.py +103 -61
  12. telegrinder/bot/cute_types/callback_query.py +447 -400
  13. telegrinder/bot/cute_types/chat_join_request.py +59 -62
  14. telegrinder/bot/cute_types/chat_member_updated.py +154 -157
  15. telegrinder/bot/cute_types/inline_query.py +41 -44
  16. telegrinder/bot/cute_types/message.py +98 -67
  17. telegrinder/bot/cute_types/pre_checkout_query.py +38 -42
  18. telegrinder/bot/cute_types/update.py +1 -8
  19. telegrinder/bot/cute_types/utils.py +1 -1
  20. telegrinder/bot/dispatch/__init__.py +10 -15
  21. telegrinder/bot/dispatch/abc.py +12 -11
  22. telegrinder/bot/dispatch/action.py +104 -0
  23. telegrinder/bot/dispatch/context.py +32 -26
  24. telegrinder/bot/dispatch/dispatch.py +61 -134
  25. telegrinder/bot/dispatch/handler/__init__.py +2 -0
  26. telegrinder/bot/dispatch/handler/abc.py +10 -8
  27. telegrinder/bot/dispatch/handler/audio_reply.py +2 -3
  28. telegrinder/bot/dispatch/handler/base.py +10 -33
  29. telegrinder/bot/dispatch/handler/document_reply.py +2 -3
  30. telegrinder/bot/dispatch/handler/func.py +55 -87
  31. telegrinder/bot/dispatch/handler/media_group_reply.py +2 -3
  32. telegrinder/bot/dispatch/handler/message_reply.py +2 -3
  33. telegrinder/bot/dispatch/handler/photo_reply.py +2 -3
  34. telegrinder/bot/dispatch/handler/sticker_reply.py +2 -3
  35. telegrinder/bot/dispatch/handler/video_reply.py +2 -3
  36. telegrinder/bot/dispatch/middleware/__init__.py +0 -0
  37. telegrinder/bot/dispatch/middleware/abc.py +79 -55
  38. telegrinder/bot/dispatch/middleware/global_middleware.py +18 -33
  39. telegrinder/bot/dispatch/process.py +84 -105
  40. telegrinder/bot/dispatch/return_manager/__init__.py +0 -0
  41. telegrinder/bot/dispatch/return_manager/abc.py +102 -65
  42. telegrinder/bot/dispatch/return_manager/callback_query.py +4 -5
  43. telegrinder/bot/dispatch/return_manager/inline_query.py +3 -4
  44. telegrinder/bot/dispatch/return_manager/message.py +8 -10
  45. telegrinder/bot/dispatch/return_manager/pre_checkout_query.py +4 -5
  46. telegrinder/bot/dispatch/view/__init__.py +4 -4
  47. telegrinder/bot/dispatch/view/abc.py +6 -16
  48. telegrinder/bot/dispatch/view/base.py +54 -178
  49. telegrinder/bot/dispatch/view/box.py +19 -18
  50. telegrinder/bot/dispatch/view/callback_query.py +4 -8
  51. telegrinder/bot/dispatch/view/chat_join_request.py +5 -6
  52. telegrinder/bot/dispatch/view/chat_member.py +5 -25
  53. telegrinder/bot/dispatch/view/error.py +9 -0
  54. telegrinder/bot/dispatch/view/inline_query.py +4 -8
  55. telegrinder/bot/dispatch/view/message.py +5 -25
  56. telegrinder/bot/dispatch/view/pre_checkout_query.py +4 -8
  57. telegrinder/bot/dispatch/view/raw.py +3 -109
  58. telegrinder/bot/dispatch/waiter_machine/__init__.py +2 -5
  59. telegrinder/bot/dispatch/waiter_machine/actions.py +6 -4
  60. telegrinder/bot/dispatch/waiter_machine/hasher/__init__.py +1 -3
  61. telegrinder/bot/dispatch/waiter_machine/hasher/callback.py +1 -1
  62. telegrinder/bot/dispatch/waiter_machine/hasher/hasher.py +11 -7
  63. telegrinder/bot/dispatch/waiter_machine/hasher/message.py +0 -0
  64. telegrinder/bot/dispatch/waiter_machine/machine.py +43 -60
  65. telegrinder/bot/dispatch/waiter_machine/middleware.py +19 -23
  66. telegrinder/bot/dispatch/waiter_machine/short_state.py +6 -5
  67. telegrinder/bot/polling/__init__.py +0 -0
  68. telegrinder/bot/polling/abc.py +0 -0
  69. telegrinder/bot/polling/polling.py +209 -88
  70. telegrinder/bot/rules/__init__.py +3 -16
  71. telegrinder/bot/rules/abc.py +42 -122
  72. telegrinder/bot/rules/callback_data.py +29 -49
  73. telegrinder/bot/rules/chat_join.py +5 -23
  74. telegrinder/bot/rules/command.py +8 -4
  75. telegrinder/bot/rules/enum_text.py +3 -4
  76. telegrinder/bot/rules/func.py +7 -14
  77. telegrinder/bot/rules/fuzzy.py +3 -4
  78. telegrinder/bot/rules/inline.py +8 -20
  79. telegrinder/bot/rules/integer.py +2 -3
  80. telegrinder/bot/rules/is_from.py +12 -11
  81. telegrinder/bot/rules/logic.py +11 -5
  82. telegrinder/bot/rules/markup.py +22 -14
  83. telegrinder/bot/rules/mention.py +8 -7
  84. telegrinder/bot/rules/message_entities.py +8 -4
  85. telegrinder/bot/rules/node.py +23 -12
  86. telegrinder/bot/rules/payload.py +5 -4
  87. telegrinder/bot/rules/payment_invoice.py +6 -21
  88. telegrinder/bot/rules/regex.py +2 -4
  89. telegrinder/bot/rules/rule_enum.py +8 -7
  90. telegrinder/bot/rules/start.py +5 -6
  91. telegrinder/bot/rules/state.py +1 -1
  92. telegrinder/bot/rules/text.py +4 -15
  93. telegrinder/bot/rules/update.py +3 -4
  94. telegrinder/bot/scenario/__init__.py +0 -0
  95. telegrinder/bot/scenario/abc.py +6 -5
  96. telegrinder/bot/scenario/checkbox.py +1 -1
  97. telegrinder/bot/scenario/choice.py +30 -39
  98. telegrinder/client/__init__.py +3 -5
  99. telegrinder/client/abc.py +11 -6
  100. telegrinder/client/aiohttp.py +141 -27
  101. telegrinder/client/form_data.py +1 -1
  102. telegrinder/model.py +61 -89
  103. telegrinder/modules.py +325 -102
  104. telegrinder/msgspec_utils/__init__.py +40 -0
  105. telegrinder/msgspec_utils/abc.py +18 -0
  106. telegrinder/msgspec_utils/custom_types/__init__.py +6 -0
  107. telegrinder/msgspec_utils/custom_types/datetime.py +24 -0
  108. telegrinder/msgspec_utils/custom_types/enum_meta.py +43 -0
  109. telegrinder/msgspec_utils/custom_types/literal.py +25 -0
  110. telegrinder/msgspec_utils/custom_types/option.py +17 -0
  111. telegrinder/msgspec_utils/decoder.py +389 -0
  112. telegrinder/msgspec_utils/encoder.py +206 -0
  113. telegrinder/{msgspec_json.py → msgspec_utils/json.py} +6 -5
  114. telegrinder/msgspec_utils/tools.py +75 -0
  115. telegrinder/node/__init__.py +24 -7
  116. telegrinder/node/attachment.py +1 -0
  117. telegrinder/node/base.py +154 -72
  118. telegrinder/node/callback_query.py +5 -5
  119. telegrinder/node/collection.py +39 -0
  120. telegrinder/node/command.py +1 -2
  121. telegrinder/node/composer.py +121 -72
  122. telegrinder/node/container.py +11 -8
  123. telegrinder/node/context.py +48 -0
  124. telegrinder/node/either.py +27 -40
  125. telegrinder/node/error.py +41 -0
  126. telegrinder/node/event.py +37 -11
  127. telegrinder/node/exceptions.py +7 -0
  128. telegrinder/node/file.py +0 -0
  129. telegrinder/node/i18n.py +108 -0
  130. telegrinder/node/me.py +3 -2
  131. telegrinder/node/payload.py +1 -1
  132. telegrinder/node/polymorphic.py +63 -28
  133. telegrinder/node/reply_message.py +12 -0
  134. telegrinder/node/rule.py +6 -13
  135. telegrinder/node/scope.py +14 -5
  136. telegrinder/node/session.py +53 -0
  137. telegrinder/node/source.py +41 -9
  138. telegrinder/node/text.py +1 -2
  139. telegrinder/node/tools/__init__.py +0 -0
  140. telegrinder/node/tools/generator.py +3 -5
  141. telegrinder/node/utility.py +16 -0
  142. telegrinder/py.typed +0 -0
  143. telegrinder/rules.py +0 -0
  144. telegrinder/tools/__init__.py +48 -88
  145. telegrinder/tools/aio.py +103 -0
  146. telegrinder/tools/callback_data_serialization/__init__.py +5 -0
  147. telegrinder/tools/{callback_data_serilization → callback_data_serialization}/abc.py +0 -0
  148. telegrinder/tools/{callback_data_serilization → callback_data_serialization}/json_ser.py +2 -3
  149. telegrinder/tools/{callback_data_serilization → callback_data_serialization}/msgpack_ser.py +45 -27
  150. telegrinder/tools/final.py +21 -0
  151. telegrinder/tools/formatting/__init__.py +2 -18
  152. telegrinder/tools/formatting/deep_links/__init__.py +39 -0
  153. telegrinder/tools/formatting/{deep_links.py → deep_links/links.py} +12 -85
  154. telegrinder/tools/formatting/deep_links/parsing.py +90 -0
  155. telegrinder/tools/formatting/deep_links/validators.py +8 -0
  156. telegrinder/tools/formatting/html_formatter.py +18 -45
  157. telegrinder/tools/fullname.py +83 -0
  158. telegrinder/tools/global_context/__init__.py +4 -3
  159. telegrinder/tools/global_context/abc.py +17 -14
  160. telegrinder/tools/global_context/builtin_context.py +39 -0
  161. telegrinder/tools/global_context/global_context.py +138 -39
  162. telegrinder/tools/input_file_directory.py +0 -0
  163. telegrinder/tools/keyboard/__init__.py +39 -0
  164. telegrinder/tools/keyboard/abc.py +159 -0
  165. telegrinder/tools/keyboard/base.py +77 -0
  166. telegrinder/tools/keyboard/buttons/__init__.py +14 -0
  167. telegrinder/tools/keyboard/buttons/base.py +18 -0
  168. telegrinder/tools/{buttons.py → keyboard/buttons/buttons.py} +71 -23
  169. telegrinder/tools/keyboard/buttons/static_buttons.py +56 -0
  170. telegrinder/tools/keyboard/buttons/tools.py +18 -0
  171. telegrinder/tools/keyboard/data.py +20 -0
  172. telegrinder/tools/keyboard/keyboard.py +131 -0
  173. telegrinder/tools/keyboard/static_keyboard.py +83 -0
  174. telegrinder/tools/lifespan.py +87 -51
  175. telegrinder/tools/limited_dict.py +4 -1
  176. telegrinder/tools/loop_wrapper.py +332 -0
  177. telegrinder/tools/magic/__init__.py +32 -0
  178. telegrinder/tools/magic/annotations.py +165 -0
  179. telegrinder/tools/magic/dictionary.py +20 -0
  180. telegrinder/tools/magic/function.py +246 -0
  181. telegrinder/tools/magic/shortcut.py +111 -0
  182. telegrinder/tools/parse_mode.py +9 -3
  183. telegrinder/tools/singleton/__init__.py +4 -0
  184. telegrinder/tools/singleton/abc.py +14 -0
  185. telegrinder/tools/singleton/singleton.py +18 -0
  186. telegrinder/tools/state_storage/__init__.py +0 -0
  187. telegrinder/tools/state_storage/abc.py +6 -1
  188. telegrinder/tools/state_storage/memory.py +1 -1
  189. telegrinder/tools/strings.py +0 -0
  190. telegrinder/types/__init__.py +307 -268
  191. telegrinder/types/enums.py +68 -37
  192. telegrinder/types/input_file.py +3 -3
  193. telegrinder/types/methods.py +5699 -5055
  194. telegrinder/types/methods_utils.py +62 -0
  195. telegrinder/types/objects.py +1782 -994
  196. telegrinder/verification_utils.py +3 -1
  197. telegrinder-0.5.1.dist-info/METADATA +162 -0
  198. telegrinder-0.5.1.dist-info/RECORD +200 -0
  199. {telegrinder-0.4.2.dist-info → telegrinder-0.5.1.dist-info}/licenses/LICENSE +2 -2
  200. telegrinder/bot/dispatch/waiter_machine/hasher/state.py +0 -20
  201. telegrinder/bot/rules/id.py +0 -24
  202. telegrinder/bot/rules/message.py +0 -15
  203. telegrinder/client/sonic.py +0 -212
  204. telegrinder/msgspec_utils.py +0 -478
  205. telegrinder/tools/adapter/__init__.py +0 -19
  206. telegrinder/tools/adapter/abc.py +0 -49
  207. telegrinder/tools/adapter/dataclass.py +0 -56
  208. telegrinder/tools/adapter/errors.py +0 -5
  209. telegrinder/tools/adapter/event.py +0 -61
  210. telegrinder/tools/adapter/node.py +0 -46
  211. telegrinder/tools/adapter/raw_event.py +0 -27
  212. telegrinder/tools/adapter/raw_update.py +0 -30
  213. telegrinder/tools/callback_data_serilization/__init__.py +0 -5
  214. telegrinder/tools/error_handler/__init__.py +0 -10
  215. telegrinder/tools/error_handler/abc.py +0 -30
  216. telegrinder/tools/error_handler/error.py +0 -9
  217. telegrinder/tools/error_handler/error_handler.py +0 -179
  218. telegrinder/tools/formatting/spec_html_formats.py +0 -75
  219. telegrinder/tools/functional.py +0 -8
  220. telegrinder/tools/global_context/telegrinder_ctx.py +0 -27
  221. telegrinder/tools/i18n/__init__.py +0 -12
  222. telegrinder/tools/i18n/abc.py +0 -32
  223. telegrinder/tools/i18n/middleware/__init__.py +0 -3
  224. telegrinder/tools/i18n/middleware/abc.py +0 -22
  225. telegrinder/tools/i18n/simple.py +0 -43
  226. telegrinder/tools/keyboard.py +0 -132
  227. telegrinder/tools/loop_wrapper/__init__.py +0 -4
  228. telegrinder/tools/loop_wrapper/abc.py +0 -20
  229. telegrinder/tools/loop_wrapper/loop_wrapper.py +0 -169
  230. telegrinder/tools/magic.py +0 -344
  231. telegrinder-0.4.2.dist-info/METADATA +0 -151
  232. telegrinder-0.4.2.dist-info/RECORD +0 -182
  233. {telegrinder-0.4.2.dist-info → telegrinder-0.5.1.dist-info}/WHEEL +0 -0
@@ -1,7 +1,9 @@
1
1
  import enum
2
2
 
3
+ from telegrinder.msgspec_utils import BaseEnumMeta
3
4
 
4
- class ProgrammingLanguage(str, enum.Enum):
5
+
6
+ class ProgrammingLanguage(enum.StrEnum, metaclass=BaseEnumMeta):
5
7
  """Type of ProgrammingLanguage."""
6
8
 
7
9
  ASSEMBLY = "assembly"
@@ -39,7 +41,7 @@ class ProgrammingLanguage(str, enum.Enum):
39
41
  MARKUP = "markup"
40
42
 
41
43
 
42
- class ChatAction(str, enum.Enum):
44
+ class ChatAction(enum.StrEnum, metaclass=BaseEnumMeta):
43
45
  """Type of ChatAction.
44
46
 
45
47
  Choose one, depending on what the user is about to receive:
@@ -68,7 +70,7 @@ class ChatAction(str, enum.Enum):
68
70
  UPLOAD_VIDEO_NOTE = "upload_video_note"
69
71
 
70
72
 
71
- class ReactionEmoji(str, enum.Enum):
73
+ class ReactionEmoji(enum.StrEnum, metaclass=BaseEnumMeta):
72
74
  """Type of ReactionEmoji.
73
75
 
74
76
  Currently, it can be one of `👍`, `👎`, `❤`, `🔥`, `🥰`, `👏`,
@@ -156,7 +158,7 @@ class ReactionEmoji(str, enum.Enum):
156
158
  ENRAGED_FACE = "😡"
157
159
 
158
160
 
159
- class DefaultAccentColor(int, enum.Enum):
161
+ class DefaultAccentColor(enum.IntEnum, metaclass=BaseEnumMeta):
160
162
  """Type of DefaultAccentColor.
161
163
 
162
164
  One of 7 possible user colors:
@@ -180,7 +182,7 @@ class DefaultAccentColor(int, enum.Enum):
180
182
  PINK = 6
181
183
 
182
184
 
183
- class TopicIconColor(int, enum.Enum):
185
+ class TopicIconColor(enum.IntEnum, metaclass=BaseEnumMeta):
184
186
  """Type of TopicIconColor.
185
187
 
186
188
  Docs: https://github.com/telegramdesktop/tdesktop/blob/991fe491c5ae62705d77aa8fdd44a79caf639c45/Telegram/SourceFiles/data/data_forum_topic.cpp#L51-L56
@@ -194,7 +196,7 @@ class TopicIconColor(int, enum.Enum):
194
196
  RED = 0xFB6F5F
195
197
 
196
198
 
197
- class ChatBoostSourceType(str, enum.Enum):
199
+ class ChatBoostSourceType(enum.StrEnum, metaclass=BaseEnumMeta):
198
200
  """Type of ChatBoostSourceType
199
201
  Docs: https://core.telegram.org/bots/api#chatboostsource
200
202
  """
@@ -204,20 +206,21 @@ class ChatBoostSourceType(str, enum.Enum):
204
206
  GIVEAWAY = "giveaway"
205
207
 
206
208
 
207
- class ContentType(str, enum.Enum):
209
+ class ContentType(enum.StrEnum, metaclass=BaseEnumMeta):
208
210
  """Type of ContentType."""
209
211
 
210
212
  TEXT = "text"
211
213
  ANIMATION = "animation"
212
214
  AUDIO = "audio"
213
215
  DOCUMENT = "document"
216
+ PAID_MEDIA = "paid_media"
214
217
  PHOTO = "photo"
215
218
  STICKER = "sticker"
216
219
  STORY = "story"
217
220
  VIDEO = "video"
218
221
  VIDEO_NOTE = "video_note"
219
222
  VOICE = "voice"
220
- HAS_MEDIA_SPOILER = "has_media_spoiler"
223
+ CHECKLIST = "checklist"
221
224
  CONTACT = "contact"
222
225
  DICE = "dice"
223
226
  GAME = "game"
@@ -239,12 +242,19 @@ class ContentType(str, enum.Enum):
239
242
  PINNED_MESSAGE = "pinned_message"
240
243
  INVOICE = "invoice"
241
244
  SUCCESSFUL_PAYMENT = "successful_payment"
245
+ REFUNDED_PAYMENT = "refunded_payment"
242
246
  USERS_SHARED = "users_shared"
243
247
  CHAT_SHARED = "chat_shared"
248
+ GIFT = "gift"
249
+ UNIQUE_GIFT = "unique_gift"
244
250
  CONNECTED_WEBSITE = "connected_website"
245
251
  WRITE_ACCESS_ALLOWED = "write_access_allowed"
246
252
  PASSPORT_DATA = "passport_data"
247
253
  PROXIMITY_ALERT_TRIGGERED = "proximity_alert_triggered"
254
+ CHAT_BACKGROUND_SET = "chat_background_set"
255
+ CHECKLIST_TASKS_DONE = "checklist_tasks_done"
256
+ CHECKLIST_TASKS_ADDED = "checklist_tasks_added"
257
+ DIRECT_MESSAGE_PRICE_CHANGED = "direct_message_price_changed"
248
258
  FORUM_TOPIC_CREATED = "forum_topic_created"
249
259
  FORUM_TOPIC_EDITED = "forum_topic_edited"
250
260
  FORUM_TOPIC_CLOSED = "forum_topic_closed"
@@ -255,6 +265,7 @@ class ContentType(str, enum.Enum):
255
265
  GIVEAWAY = "giveaway"
256
266
  GIVEAWAY_WINNERS = "giveaway_winners"
257
267
  GIVEAWAY_COMPLETED = "giveaway_completed"
268
+ PAID_MESSAGE_PRICE_CHANGED = "paid_message_price_changed"
258
269
  VIDEO_CHAT_SCHEDULED = "video_chat_scheduled"
259
270
  VIDEO_CHAT_STARTED = "video_chat_started"
260
271
  VIDEO_CHAT_ENDED = "video_chat_ended"
@@ -264,7 +275,7 @@ class ContentType(str, enum.Enum):
264
275
  UNKNOWN = "unknown"
265
276
 
266
277
 
267
- class Currency(str, enum.Enum):
278
+ class Currency(enum.StrEnum, metaclass=BaseEnumMeta):
268
279
  """Type of Currency.
269
280
  Docs: https://core.telegram.org/bots/payments#supported-currencies
270
281
  """
@@ -359,7 +370,7 @@ class Currency(str, enum.Enum):
359
370
  """Telegram stars."""
360
371
 
361
372
 
362
- class InlineQueryResultType(str, enum.Enum):
373
+ class InlineQueryResultType(enum.StrEnum, metaclass=BaseEnumMeta):
363
374
  """Type of InlineQueryResultType.
364
375
  Docs: https://core.telegram.org/bots/api#inlinequeryresult
365
376
  """
@@ -379,7 +390,7 @@ class InlineQueryResultType(str, enum.Enum):
379
390
  VENUE = "venue"
380
391
 
381
392
 
382
- class MenuButtonType(str, enum.Enum):
393
+ class MenuButtonType(enum.StrEnum, metaclass=BaseEnumMeta):
383
394
  """TType of MenuButtonType.
384
395
  Docs: https://core.telegram.org/bots/api#menubuttondefault
385
396
  """
@@ -389,7 +400,7 @@ class MenuButtonType(str, enum.Enum):
389
400
  WEB_APP = "web_app"
390
401
 
391
402
 
392
- class InputMediaType(str, enum.Enum):
403
+ class InputMediaType(enum.StrEnum, metaclass=BaseEnumMeta):
393
404
  """Type of InputMediaType.
394
405
  Docs: https://core.telegram.org/bots/api#inputmedia
395
406
  """
@@ -401,7 +412,7 @@ class InputMediaType(str, enum.Enum):
401
412
  VIDEO = "video"
402
413
 
403
414
 
404
- class UpdateType(str, enum.Enum):
415
+ class UpdateType(enum.StrEnum, metaclass=BaseEnumMeta):
405
416
  """Type of update."""
406
417
 
407
418
  MESSAGE = "message"
@@ -415,6 +426,7 @@ class UpdateType(str, enum.Enum):
415
426
  CALLBACK_QUERY = "callback_query"
416
427
  SHIPPING_QUERY = "shipping_query"
417
428
  PRE_CHECKOUT_QUERY = "pre_checkout_query"
429
+ PURCHASED_PAID_MEDIA = "purchased_paid_media"
418
430
  POLL = "poll"
419
431
  POLL_ANSWER = "poll_answer"
420
432
  MY_CHAT_MEMBER = "my_chat_member"
@@ -425,10 +437,10 @@ class UpdateType(str, enum.Enum):
425
437
  BUSINESS_CONNECTION = "business_connection"
426
438
  BUSINESS_MESSAGE = "business_message"
427
439
  EDITED_BUSINESS_MESSAGE = "edited_business_message"
428
- DELETE_BUSINESS_MESSAGE = "delete_business_messages"
440
+ DELETED_BUSINESS_MESSAGES = "deleted_business_messages"
429
441
 
430
442
 
431
- class BotCommandScopeType(str, enum.Enum):
443
+ class BotCommandScopeType(enum.StrEnum, metaclass=BaseEnumMeta):
432
444
  """Type of BotCommandScope.
433
445
  Represents the scope to which bot commands are applied.
434
446
  """
@@ -442,7 +454,7 @@ class BotCommandScopeType(str, enum.Enum):
442
454
  CHAT_MEMBER = "chat_member"
443
455
 
444
456
 
445
- class ChatType(str, enum.Enum):
457
+ class ChatType(enum.StrEnum, metaclass=BaseEnumMeta):
446
458
  """Type of chat, can be either `private`, `group`, `supergroup` or `channel`."""
447
459
 
448
460
  PRIVATE = "private"
@@ -452,7 +464,7 @@ class ChatType(str, enum.Enum):
452
464
  SENDER = "sender"
453
465
 
454
466
 
455
- class ChatMemberStatus(str, enum.Enum):
467
+ class ChatMemberStatus(enum.StrEnum, metaclass=BaseEnumMeta):
456
468
  """Type of ChatMemberStatus."""
457
469
 
458
470
  CREATOR = "creator"
@@ -463,7 +475,7 @@ class ChatMemberStatus(str, enum.Enum):
463
475
  KICKED = "kicked"
464
476
 
465
477
 
466
- class DiceEmoji(str, enum.Enum):
478
+ class DiceEmoji(enum.StrEnum, metaclass=BaseEnumMeta):
467
479
  """Emoji on which the dice throw animation is based."""
468
480
 
469
481
  DICE = "🎲"
@@ -474,7 +486,7 @@ class DiceEmoji(str, enum.Enum):
474
486
  BOWLING = "🎳"
475
487
 
476
488
 
477
- class MessageEntityType(str, enum.Enum):
489
+ class MessageEntityType(enum.StrEnum, metaclass=BaseEnumMeta):
478
490
  """Type of the entity. Currently, can be `mention` (@username), `hashtag`
479
491
  (#hashtag or #hashtag@chatusername), `cashtag` ($USD or $USD@chatusername),
480
492
  `bot_command` (/start@jobs_bot), `url` (https://telegram.org), `email`
@@ -484,8 +496,7 @@ class MessageEntityType(str, enum.Enum):
484
496
  `blockquote` (block quotation), `expandable_blockquote` (collapsed-by-default
485
497
  block quotation), `code` (monowidth string), `pre` (monowidth block),
486
498
  `text_link` (for clickable text URLs), `text_mention` (for users without
487
- usernames), `custom_emoji` (for inline custom emoji stickers).
488
- """
499
+ usernames), `custom_emoji` (for inline custom emoji stickers)."""
489
500
 
490
501
  MENTION = "mention"
491
502
  HASHTAG = "hashtag"
@@ -508,14 +519,14 @@ class MessageEntityType(str, enum.Enum):
508
519
  EXPANDABLE_BLOCKQUOTE = "expandable_blockquote"
509
520
 
510
521
 
511
- class PollType(str, enum.Enum):
522
+ class PollType(enum.StrEnum, metaclass=BaseEnumMeta):
512
523
  """Poll type, currently can be `regular` or `quiz`."""
513
524
 
514
525
  REGULAR = "regular"
515
526
  QUIZ = "quiz"
516
527
 
517
528
 
518
- class StickerType(str, enum.Enum):
529
+ class StickerType(enum.StrEnum, metaclass=BaseEnumMeta):
519
530
  """Type of the sticker, currently one of `regular`, `mask`, `custom_emoji`.
520
531
  The type of the sticker is independent from its format, which is determined
521
532
  by the fields `is_animated` and `is_video`.
@@ -526,7 +537,7 @@ class StickerType(str, enum.Enum):
526
537
  CUSTOM_EMOJI = "custom_emoji"
527
538
 
528
539
 
529
- class MessageOriginType(str, enum.Enum):
540
+ class MessageOriginType(enum.StrEnum, metaclass=BaseEnumMeta):
530
541
  """Type of MessageOriginType
531
542
  Docs: https://core.telegram.org/bots/api#messageorigin
532
543
  """
@@ -537,7 +548,7 @@ class MessageOriginType(str, enum.Enum):
537
548
  CHANNEL = "channel"
538
549
 
539
550
 
540
- class StickerSetStickerType(str, enum.Enum):
551
+ class StickerSetStickerType(enum.StrEnum, metaclass=BaseEnumMeta):
541
552
  """Type of stickers in the set, currently one of `regular`, `mask`, `custom_emoji`."""
542
553
 
543
554
  REGULAR = "regular"
@@ -545,7 +556,7 @@ class StickerSetStickerType(str, enum.Enum):
545
556
  CUSTOM_EMOJI = "custom_emoji"
546
557
 
547
558
 
548
- class MaskPositionPoint(str, enum.Enum):
559
+ class MaskPositionPoint(enum.StrEnum, metaclass=BaseEnumMeta):
549
560
  """The part of the face relative to which the mask should be placed. One of `forehead`,
550
561
  `eyes`, `mouth`, or `chin`.
551
562
  """
@@ -556,7 +567,7 @@ class MaskPositionPoint(str, enum.Enum):
556
567
  CHIN = "chin"
557
568
 
558
569
 
559
- class InlineQueryChatType(str, enum.Enum):
570
+ class InlineQueryChatType(enum.StrEnum, metaclass=BaseEnumMeta):
560
571
  """Type of the chat from which the inline query was sent. Can be
561
572
  either `sender` for a private chat with the inline query sender, `private`,
562
573
  `group`, `supergroup`, or `channel`. The chat type should be always known
@@ -571,14 +582,14 @@ class InlineQueryChatType(str, enum.Enum):
571
582
  CHANNEL = "channel"
572
583
 
573
584
 
574
- class InlineQueryResultMimeType(str, enum.Enum):
585
+ class InlineQueryResultMimeType(enum.StrEnum, metaclass=BaseEnumMeta):
575
586
  """MIME type of the content of the video URL, `text/html` or `video/mp4`."""
576
587
 
577
588
  TEXT_HTML = "text/html"
578
589
  VIDEO_MP4 = "video/mp4"
579
590
 
580
591
 
581
- class InlineQueryResultThumbnailMimeType(str, enum.Enum):
592
+ class InlineQueryResultThumbnailMimeType(enum.StrEnum, metaclass=BaseEnumMeta):
582
593
  """MIME type of the thumbnail, must be one of `image/jpeg`, `image/gif`,
583
594
  or `video/mp4`. Defaults to `image/jpeg`
584
595
  """
@@ -588,7 +599,7 @@ class InlineQueryResultThumbnailMimeType(str, enum.Enum):
588
599
  VIDEO_MP4 = "video/mp4"
589
600
 
590
601
 
591
- class PassportElementErrorType(str, enum.Enum):
602
+ class PassportElementErrorType(enum.StrEnum, metaclass=BaseEnumMeta):
592
603
  """Type of PassportElementErrorType.
593
604
  Docs: https://core.telegram.org/bots/api#passportelementerror
594
605
  """
@@ -604,7 +615,7 @@ class PassportElementErrorType(str, enum.Enum):
604
615
  UNSPECIFIED = "unspecified"
605
616
 
606
617
 
607
- class ReactionTypeType(str, enum.Enum):
618
+ class ReactionTypeType(enum.StrEnum, metaclass=BaseEnumMeta):
608
619
  """Type of ReactionTypeType.
609
620
  Docs: https://core.telegram.org/bots/api#reactiontype
610
621
  """
@@ -613,7 +624,7 @@ class ReactionTypeType(str, enum.Enum):
613
624
  CUSTOM_EMOJI = "custom_emoji"
614
625
 
615
626
 
616
- class InlineQueryResultGifThumbnailMimeType(str, enum.Enum):
627
+ class InlineQueryResultGifThumbnailMimeType(enum.StrEnum, metaclass=BaseEnumMeta):
617
628
  """MIME type of the thumbnail, must be one of `image/jpeg`, `image/gif`,
618
629
  or `video/mp4`. Defaults to `image/jpeg`.
619
630
  """
@@ -623,7 +634,7 @@ class InlineQueryResultGifThumbnailMimeType(str, enum.Enum):
623
634
  VIDEO_MP4 = "video/mp4"
624
635
 
625
636
 
626
- class InlineQueryResultMpeg4GifThumbnailMimeType(str, enum.Enum):
637
+ class InlineQueryResultMpeg4GifThumbnailMimeType(enum.StrEnum, metaclass=BaseEnumMeta):
627
638
  """MIME type of the thumbnail, must be one of `image/jpeg`, `image/gif`,
628
639
  or `video/mp4`. Defaults to `image/jpeg`.
629
640
  """
@@ -633,21 +644,21 @@ class InlineQueryResultMpeg4GifThumbnailMimeType(str, enum.Enum):
633
644
  VIDEO_MP4 = "video/mp4"
634
645
 
635
646
 
636
- class InlineQueryResultVideoMimeType(str, enum.Enum):
647
+ class InlineQueryResultVideoMimeType(enum.StrEnum, metaclass=BaseEnumMeta):
637
648
  """MIME type of the content of the video URL, `text/html` or `video/mp4`."""
638
649
 
639
650
  TEXT_HTML = "text/html"
640
651
  VIDEO_MP4 = "video/mp4"
641
652
 
642
653
 
643
- class InlineQueryResultDocumentMimeType(str, enum.Enum):
654
+ class InlineQueryResultDocumentMimeType(enum.StrEnum, metaclass=BaseEnumMeta):
644
655
  """MIME type of the content of the file, either `application/pdf` or `application/zip`."""
645
656
 
646
657
  APPLICATION_PDF = "application/pdf"
647
658
  APPLICATION_ZIP = "application/zip"
648
659
 
649
660
 
650
- class EncryptedPassportElementType(str, enum.Enum):
661
+ class EncryptedPassportElementType(enum.StrEnum, metaclass=BaseEnumMeta):
651
662
  """Element type. One of `personal_details`, `passport`, `driver_license`,
652
663
  `identity_card`, `internal_passport`, `address`, `utility_bill`,
653
664
  `bank_statement`, `rental_agreement`, `passport_registration`,
@@ -669,7 +680,7 @@ class EncryptedPassportElementType(str, enum.Enum):
669
680
  EMAIL = "email"
670
681
 
671
682
 
672
- class StickerFormat(str, enum.Enum):
683
+ class StickerFormat(enum.StrEnum, metaclass=BaseEnumMeta):
673
684
  """Format of the sticker."""
674
685
 
675
686
  STATIC = "static"
@@ -677,6 +688,24 @@ class StickerFormat(str, enum.Enum):
677
688
  VIDEO = "video"
678
689
 
679
690
 
691
+ class TransactionPartnerUserTransactionType(enum.StrEnum, metaclass=BaseEnumMeta):
692
+ """This object represents type of the transaction that were made by partner user."""
693
+
694
+ INVOICE_PAYMENT = "invoice_payment"
695
+ PAID_MEDIA_PAYMENT = "paid_media_payment"
696
+ GIFT_PURCHASE = "gift_purchase"
697
+ PREMIUM_PURCHASE = "premium_purchase"
698
+ BUSINESS_ACCOUNT_TRANSFER = "business_account_transfer"
699
+
700
+
701
+ class UniqueGiftInfoOriginType(enum.StrEnum, metaclass=BaseEnumMeta):
702
+ """Origin of the gift. Currently, either `upgrade`, `transfer` or `resale`."""
703
+
704
+ UPGRADE = "upgrade"
705
+ TRANSFER = "transfer"
706
+ RESALE = "resale"
707
+
708
+
680
709
  __all__ = (
681
710
  "BotCommandScopeType",
682
711
  "ChatAction",
@@ -707,5 +736,7 @@ __all__ = (
707
736
  "StickerSetStickerType",
708
737
  "StickerType",
709
738
  "TopicIconColor",
739
+ "TransactionPartnerUserTransactionType",
740
+ "UniqueGiftInfoOriginType",
710
741
  "UpdateType",
711
742
  )
@@ -27,7 +27,7 @@ class InputFile:
27
27
 
28
28
  def __repr__(self) -> str:
29
29
  return "{}(filename={!r}, data={!r})".format(
30
- self.__class__.__name__,
30
+ type(self).__name__,
31
31
  self.filename,
32
32
  (self.data[:30] + b"...") if len(self.data) > 30 else self.data,
33
33
  )
@@ -44,8 +44,8 @@ class InputFile:
44
44
 
45
45
 
46
46
  @encoder.add_enc_hook(InputFile)
47
- def encode_inputfile(inputfile: InputFile, files: Files) -> str:
48
- return inputfile._to_multipart(files)
47
+ def encode_input_file(input_file: InputFile, files: Files) -> str:
48
+ return input_file._to_multipart(files)
49
49
 
50
50
 
51
51
  __all__ = ("InputFile",)