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.
- telegrinder/__init__.py +37 -55
- telegrinder/__meta__.py +1 -0
- telegrinder/api/__init__.py +6 -4
- telegrinder/api/api.py +100 -26
- telegrinder/api/error.py +42 -8
- telegrinder/api/response.py +4 -1
- telegrinder/api/token.py +2 -2
- telegrinder/bot/__init__.py +9 -25
- telegrinder/bot/bot.py +31 -25
- telegrinder/bot/cute_types/__init__.py +0 -0
- telegrinder/bot/cute_types/base.py +103 -61
- telegrinder/bot/cute_types/callback_query.py +447 -400
- telegrinder/bot/cute_types/chat_join_request.py +59 -62
- telegrinder/bot/cute_types/chat_member_updated.py +154 -157
- telegrinder/bot/cute_types/inline_query.py +41 -44
- telegrinder/bot/cute_types/message.py +98 -67
- telegrinder/bot/cute_types/pre_checkout_query.py +38 -42
- telegrinder/bot/cute_types/update.py +1 -8
- telegrinder/bot/cute_types/utils.py +1 -1
- telegrinder/bot/dispatch/__init__.py +10 -15
- telegrinder/bot/dispatch/abc.py +12 -11
- telegrinder/bot/dispatch/action.py +104 -0
- telegrinder/bot/dispatch/context.py +32 -26
- telegrinder/bot/dispatch/dispatch.py +61 -134
- telegrinder/bot/dispatch/handler/__init__.py +2 -0
- telegrinder/bot/dispatch/handler/abc.py +10 -8
- telegrinder/bot/dispatch/handler/audio_reply.py +2 -3
- telegrinder/bot/dispatch/handler/base.py +10 -33
- telegrinder/bot/dispatch/handler/document_reply.py +2 -3
- telegrinder/bot/dispatch/handler/func.py +55 -87
- telegrinder/bot/dispatch/handler/media_group_reply.py +2 -3
- telegrinder/bot/dispatch/handler/message_reply.py +2 -3
- telegrinder/bot/dispatch/handler/photo_reply.py +2 -3
- telegrinder/bot/dispatch/handler/sticker_reply.py +2 -3
- telegrinder/bot/dispatch/handler/video_reply.py +2 -3
- telegrinder/bot/dispatch/middleware/__init__.py +0 -0
- telegrinder/bot/dispatch/middleware/abc.py +79 -55
- telegrinder/bot/dispatch/middleware/global_middleware.py +18 -33
- telegrinder/bot/dispatch/process.py +84 -105
- telegrinder/bot/dispatch/return_manager/__init__.py +0 -0
- telegrinder/bot/dispatch/return_manager/abc.py +102 -65
- telegrinder/bot/dispatch/return_manager/callback_query.py +4 -5
- telegrinder/bot/dispatch/return_manager/inline_query.py +3 -4
- telegrinder/bot/dispatch/return_manager/message.py +8 -10
- telegrinder/bot/dispatch/return_manager/pre_checkout_query.py +4 -5
- telegrinder/bot/dispatch/view/__init__.py +4 -4
- telegrinder/bot/dispatch/view/abc.py +6 -16
- telegrinder/bot/dispatch/view/base.py +54 -178
- telegrinder/bot/dispatch/view/box.py +19 -18
- telegrinder/bot/dispatch/view/callback_query.py +4 -8
- telegrinder/bot/dispatch/view/chat_join_request.py +5 -6
- telegrinder/bot/dispatch/view/chat_member.py +5 -25
- telegrinder/bot/dispatch/view/error.py +9 -0
- telegrinder/bot/dispatch/view/inline_query.py +4 -8
- telegrinder/bot/dispatch/view/message.py +5 -25
- telegrinder/bot/dispatch/view/pre_checkout_query.py +4 -8
- telegrinder/bot/dispatch/view/raw.py +3 -109
- telegrinder/bot/dispatch/waiter_machine/__init__.py +2 -5
- telegrinder/bot/dispatch/waiter_machine/actions.py +6 -4
- telegrinder/bot/dispatch/waiter_machine/hasher/__init__.py +1 -3
- telegrinder/bot/dispatch/waiter_machine/hasher/callback.py +1 -1
- telegrinder/bot/dispatch/waiter_machine/hasher/hasher.py +11 -7
- telegrinder/bot/dispatch/waiter_machine/hasher/message.py +0 -0
- telegrinder/bot/dispatch/waiter_machine/machine.py +43 -60
- telegrinder/bot/dispatch/waiter_machine/middleware.py +19 -23
- telegrinder/bot/dispatch/waiter_machine/short_state.py +6 -5
- telegrinder/bot/polling/__init__.py +0 -0
- telegrinder/bot/polling/abc.py +0 -0
- telegrinder/bot/polling/polling.py +209 -88
- telegrinder/bot/rules/__init__.py +3 -16
- telegrinder/bot/rules/abc.py +42 -122
- telegrinder/bot/rules/callback_data.py +29 -49
- telegrinder/bot/rules/chat_join.py +5 -23
- telegrinder/bot/rules/command.py +8 -4
- telegrinder/bot/rules/enum_text.py +3 -4
- telegrinder/bot/rules/func.py +7 -14
- telegrinder/bot/rules/fuzzy.py +3 -4
- telegrinder/bot/rules/inline.py +8 -20
- telegrinder/bot/rules/integer.py +2 -3
- telegrinder/bot/rules/is_from.py +12 -11
- telegrinder/bot/rules/logic.py +11 -5
- telegrinder/bot/rules/markup.py +22 -14
- telegrinder/bot/rules/mention.py +8 -7
- telegrinder/bot/rules/message_entities.py +8 -4
- telegrinder/bot/rules/node.py +23 -12
- telegrinder/bot/rules/payload.py +5 -4
- telegrinder/bot/rules/payment_invoice.py +6 -21
- telegrinder/bot/rules/regex.py +2 -4
- telegrinder/bot/rules/rule_enum.py +8 -7
- telegrinder/bot/rules/start.py +5 -6
- telegrinder/bot/rules/state.py +1 -1
- telegrinder/bot/rules/text.py +4 -15
- telegrinder/bot/rules/update.py +3 -4
- telegrinder/bot/scenario/__init__.py +0 -0
- telegrinder/bot/scenario/abc.py +6 -5
- telegrinder/bot/scenario/checkbox.py +1 -1
- telegrinder/bot/scenario/choice.py +30 -39
- telegrinder/client/__init__.py +3 -5
- telegrinder/client/abc.py +11 -6
- telegrinder/client/aiohttp.py +141 -27
- telegrinder/client/form_data.py +1 -1
- telegrinder/model.py +61 -89
- telegrinder/modules.py +325 -102
- telegrinder/msgspec_utils/__init__.py +40 -0
- telegrinder/msgspec_utils/abc.py +18 -0
- telegrinder/msgspec_utils/custom_types/__init__.py +6 -0
- telegrinder/msgspec_utils/custom_types/datetime.py +24 -0
- telegrinder/msgspec_utils/custom_types/enum_meta.py +43 -0
- telegrinder/msgspec_utils/custom_types/literal.py +25 -0
- telegrinder/msgspec_utils/custom_types/option.py +17 -0
- telegrinder/msgspec_utils/decoder.py +389 -0
- telegrinder/msgspec_utils/encoder.py +206 -0
- telegrinder/{msgspec_json.py → msgspec_utils/json.py} +6 -5
- telegrinder/msgspec_utils/tools.py +75 -0
- telegrinder/node/__init__.py +24 -7
- telegrinder/node/attachment.py +1 -0
- telegrinder/node/base.py +154 -72
- telegrinder/node/callback_query.py +5 -5
- telegrinder/node/collection.py +39 -0
- telegrinder/node/command.py +1 -2
- telegrinder/node/composer.py +121 -72
- telegrinder/node/container.py +11 -8
- telegrinder/node/context.py +48 -0
- telegrinder/node/either.py +27 -40
- telegrinder/node/error.py +41 -0
- telegrinder/node/event.py +37 -11
- telegrinder/node/exceptions.py +7 -0
- telegrinder/node/file.py +0 -0
- telegrinder/node/i18n.py +108 -0
- telegrinder/node/me.py +3 -2
- telegrinder/node/payload.py +1 -1
- telegrinder/node/polymorphic.py +63 -28
- telegrinder/node/reply_message.py +12 -0
- telegrinder/node/rule.py +6 -13
- telegrinder/node/scope.py +14 -5
- telegrinder/node/session.py +53 -0
- telegrinder/node/source.py +41 -9
- telegrinder/node/text.py +1 -2
- telegrinder/node/tools/__init__.py +0 -0
- telegrinder/node/tools/generator.py +3 -5
- telegrinder/node/utility.py +16 -0
- telegrinder/py.typed +0 -0
- telegrinder/rules.py +0 -0
- telegrinder/tools/__init__.py +48 -88
- telegrinder/tools/aio.py +103 -0
- telegrinder/tools/callback_data_serialization/__init__.py +5 -0
- telegrinder/tools/{callback_data_serilization → callback_data_serialization}/abc.py +0 -0
- telegrinder/tools/{callback_data_serilization → callback_data_serialization}/json_ser.py +2 -3
- telegrinder/tools/{callback_data_serilization → callback_data_serialization}/msgpack_ser.py +45 -27
- telegrinder/tools/final.py +21 -0
- telegrinder/tools/formatting/__init__.py +2 -18
- telegrinder/tools/formatting/deep_links/__init__.py +39 -0
- telegrinder/tools/formatting/{deep_links.py → deep_links/links.py} +12 -85
- telegrinder/tools/formatting/deep_links/parsing.py +90 -0
- telegrinder/tools/formatting/deep_links/validators.py +8 -0
- telegrinder/tools/formatting/html_formatter.py +18 -45
- telegrinder/tools/fullname.py +83 -0
- telegrinder/tools/global_context/__init__.py +4 -3
- telegrinder/tools/global_context/abc.py +17 -14
- telegrinder/tools/global_context/builtin_context.py +39 -0
- telegrinder/tools/global_context/global_context.py +138 -39
- telegrinder/tools/input_file_directory.py +0 -0
- telegrinder/tools/keyboard/__init__.py +39 -0
- telegrinder/tools/keyboard/abc.py +159 -0
- telegrinder/tools/keyboard/base.py +77 -0
- telegrinder/tools/keyboard/buttons/__init__.py +14 -0
- telegrinder/tools/keyboard/buttons/base.py +18 -0
- telegrinder/tools/{buttons.py → keyboard/buttons/buttons.py} +71 -23
- telegrinder/tools/keyboard/buttons/static_buttons.py +56 -0
- telegrinder/tools/keyboard/buttons/tools.py +18 -0
- telegrinder/tools/keyboard/data.py +20 -0
- telegrinder/tools/keyboard/keyboard.py +131 -0
- telegrinder/tools/keyboard/static_keyboard.py +83 -0
- telegrinder/tools/lifespan.py +87 -51
- telegrinder/tools/limited_dict.py +4 -1
- telegrinder/tools/loop_wrapper.py +332 -0
- telegrinder/tools/magic/__init__.py +32 -0
- telegrinder/tools/magic/annotations.py +165 -0
- telegrinder/tools/magic/dictionary.py +20 -0
- telegrinder/tools/magic/function.py +246 -0
- telegrinder/tools/magic/shortcut.py +111 -0
- telegrinder/tools/parse_mode.py +9 -3
- telegrinder/tools/singleton/__init__.py +4 -0
- telegrinder/tools/singleton/abc.py +14 -0
- telegrinder/tools/singleton/singleton.py +18 -0
- telegrinder/tools/state_storage/__init__.py +0 -0
- telegrinder/tools/state_storage/abc.py +6 -1
- telegrinder/tools/state_storage/memory.py +1 -1
- telegrinder/tools/strings.py +0 -0
- telegrinder/types/__init__.py +307 -268
- telegrinder/types/enums.py +68 -37
- telegrinder/types/input_file.py +3 -3
- telegrinder/types/methods.py +5699 -5055
- telegrinder/types/methods_utils.py +62 -0
- telegrinder/types/objects.py +1782 -994
- telegrinder/verification_utils.py +3 -1
- telegrinder-0.5.1.dist-info/METADATA +162 -0
- telegrinder-0.5.1.dist-info/RECORD +200 -0
- {telegrinder-0.4.2.dist-info → telegrinder-0.5.1.dist-info}/licenses/LICENSE +2 -2
- telegrinder/bot/dispatch/waiter_machine/hasher/state.py +0 -20
- telegrinder/bot/rules/id.py +0 -24
- telegrinder/bot/rules/message.py +0 -15
- telegrinder/client/sonic.py +0 -212
- telegrinder/msgspec_utils.py +0 -478
- telegrinder/tools/adapter/__init__.py +0 -19
- telegrinder/tools/adapter/abc.py +0 -49
- telegrinder/tools/adapter/dataclass.py +0 -56
- telegrinder/tools/adapter/errors.py +0 -5
- telegrinder/tools/adapter/event.py +0 -61
- telegrinder/tools/adapter/node.py +0 -46
- telegrinder/tools/adapter/raw_event.py +0 -27
- telegrinder/tools/adapter/raw_update.py +0 -30
- telegrinder/tools/callback_data_serilization/__init__.py +0 -5
- telegrinder/tools/error_handler/__init__.py +0 -10
- telegrinder/tools/error_handler/abc.py +0 -30
- telegrinder/tools/error_handler/error.py +0 -9
- telegrinder/tools/error_handler/error_handler.py +0 -179
- telegrinder/tools/formatting/spec_html_formats.py +0 -75
- telegrinder/tools/functional.py +0 -8
- telegrinder/tools/global_context/telegrinder_ctx.py +0 -27
- telegrinder/tools/i18n/__init__.py +0 -12
- telegrinder/tools/i18n/abc.py +0 -32
- telegrinder/tools/i18n/middleware/__init__.py +0 -3
- telegrinder/tools/i18n/middleware/abc.py +0 -22
- telegrinder/tools/i18n/simple.py +0 -43
- telegrinder/tools/keyboard.py +0 -132
- telegrinder/tools/loop_wrapper/__init__.py +0 -4
- telegrinder/tools/loop_wrapper/abc.py +0 -20
- telegrinder/tools/loop_wrapper/loop_wrapper.py +0 -169
- telegrinder/tools/magic.py +0 -344
- telegrinder-0.4.2.dist-info/METADATA +0 -151
- telegrinder-0.4.2.dist-info/RECORD +0 -182
- {telegrinder-0.4.2.dist-info → telegrinder-0.5.1.dist-info}/WHEEL +0 -0
telegrinder/types/enums.py
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import enum
|
|
2
2
|
|
|
3
|
+
from telegrinder.msgspec_utils import BaseEnumMeta
|
|
3
4
|
|
|
4
|
-
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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
|
-
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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
|
-
|
|
440
|
+
DELETED_BUSINESS_MESSAGES = "deleted_business_messages"
|
|
429
441
|
|
|
430
442
|
|
|
431
|
-
class BotCommandScopeType(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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
|
)
|
telegrinder/types/input_file.py
CHANGED
|
@@ -27,7 +27,7 @@ class InputFile:
|
|
|
27
27
|
|
|
28
28
|
def __repr__(self) -> str:
|
|
29
29
|
return "{}(filename={!r}, data={!r})".format(
|
|
30
|
-
self.
|
|
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
|
|
48
|
-
return
|
|
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",)
|