telegrinder 0.1.dev170__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.
- telegrinder/__init__.py +2 -2
- telegrinder/api/__init__.py +1 -2
- telegrinder/api/api.py +15 -6
- telegrinder/api/error.py +2 -1
- telegrinder/api/token.py +36 -0
- telegrinder/bot/__init__.py +12 -6
- telegrinder/bot/bot.py +18 -6
- telegrinder/bot/cute_types/__init__.py +7 -7
- telegrinder/bot/cute_types/base.py +122 -20
- telegrinder/bot/cute_types/callback_query.py +10 -6
- telegrinder/bot/cute_types/chat_join_request.py +4 -5
- telegrinder/bot/cute_types/chat_member_updated.py +4 -6
- telegrinder/bot/cute_types/inline_query.py +3 -4
- telegrinder/bot/cute_types/message.py +32 -21
- telegrinder/bot/cute_types/update.py +51 -4
- telegrinder/bot/cute_types/utils.py +3 -466
- telegrinder/bot/dispatch/__init__.py +10 -11
- telegrinder/bot/dispatch/abc.py +8 -5
- telegrinder/bot/dispatch/context.py +17 -8
- telegrinder/bot/dispatch/dispatch.py +71 -48
- telegrinder/bot/dispatch/handler/__init__.py +3 -3
- telegrinder/bot/dispatch/handler/abc.py +4 -4
- telegrinder/bot/dispatch/handler/func.py +46 -22
- telegrinder/bot/dispatch/handler/message_reply.py +6 -7
- telegrinder/bot/dispatch/middleware/__init__.py +1 -1
- telegrinder/bot/dispatch/middleware/abc.py +2 -2
- telegrinder/bot/dispatch/process.py +38 -19
- telegrinder/bot/dispatch/return_manager/__init__.py +4 -4
- telegrinder/bot/dispatch/return_manager/abc.py +3 -3
- telegrinder/bot/dispatch/return_manager/callback_query.py +1 -2
- telegrinder/bot/dispatch/return_manager/inline_query.py +1 -2
- telegrinder/bot/dispatch/return_manager/message.py +1 -2
- telegrinder/bot/dispatch/view/__init__.py +8 -8
- telegrinder/bot/dispatch/view/abc.py +18 -16
- telegrinder/bot/dispatch/view/box.py +75 -64
- telegrinder/bot/dispatch/view/callback_query.py +1 -2
- telegrinder/bot/dispatch/view/chat_join_request.py +1 -2
- telegrinder/bot/dispatch/view/chat_member.py +16 -2
- telegrinder/bot/dispatch/view/inline_query.py +1 -2
- telegrinder/bot/dispatch/view/message.py +12 -5
- telegrinder/bot/dispatch/view/raw.py +9 -8
- telegrinder/bot/dispatch/waiter_machine/__init__.py +3 -3
- telegrinder/bot/dispatch/waiter_machine/machine.py +12 -8
- telegrinder/bot/dispatch/waiter_machine/middleware.py +1 -1
- telegrinder/bot/dispatch/waiter_machine/short_state.py +4 -3
- telegrinder/bot/polling/abc.py +1 -1
- telegrinder/bot/polling/polling.py +6 -6
- telegrinder/bot/rules/__init__.py +20 -20
- telegrinder/bot/rules/abc.py +57 -43
- telegrinder/bot/rules/adapter/__init__.py +5 -5
- telegrinder/bot/rules/adapter/abc.py +6 -3
- telegrinder/bot/rules/adapter/errors.py +2 -1
- telegrinder/bot/rules/adapter/event.py +28 -13
- telegrinder/bot/rules/adapter/node.py +28 -22
- telegrinder/bot/rules/adapter/raw_update.py +13 -5
- telegrinder/bot/rules/callback_data.py +4 -4
- telegrinder/bot/rules/chat_join.py +4 -4
- telegrinder/bot/rules/command.py +5 -7
- telegrinder/bot/rules/func.py +2 -2
- telegrinder/bot/rules/fuzzy.py +1 -1
- telegrinder/bot/rules/inline.py +3 -3
- telegrinder/bot/rules/integer.py +1 -2
- telegrinder/bot/rules/markup.py +5 -3
- telegrinder/bot/rules/message_entities.py +2 -2
- telegrinder/bot/rules/node.py +2 -2
- telegrinder/bot/rules/regex.py +1 -1
- telegrinder/bot/rules/rule_enum.py +1 -1
- telegrinder/bot/rules/text.py +1 -2
- telegrinder/bot/rules/update.py +1 -2
- telegrinder/bot/scenario/abc.py +2 -2
- telegrinder/bot/scenario/checkbox.py +3 -4
- telegrinder/bot/scenario/choice.py +1 -2
- telegrinder/model.py +89 -45
- telegrinder/modules.py +3 -3
- telegrinder/msgspec_utils.py +85 -57
- telegrinder/node/__init__.py +17 -10
- telegrinder/node/attachment.py +19 -16
- telegrinder/node/base.py +46 -22
- telegrinder/node/callback_query.py +5 -9
- telegrinder/node/command.py +6 -2
- telegrinder/node/composer.py +102 -77
- telegrinder/node/container.py +3 -3
- telegrinder/node/event.py +68 -0
- telegrinder/node/me.py +3 -0
- telegrinder/node/message.py +6 -10
- telegrinder/node/polymorphic.py +15 -10
- telegrinder/node/rule.py +20 -6
- telegrinder/node/scope.py +9 -1
- telegrinder/node/source.py +21 -11
- telegrinder/node/text.py +4 -4
- telegrinder/node/update.py +7 -4
- telegrinder/py.typed +0 -0
- telegrinder/rules.py +59 -0
- telegrinder/tools/__init__.py +2 -2
- telegrinder/tools/buttons.py +5 -10
- telegrinder/tools/error_handler/abc.py +2 -2
- telegrinder/tools/error_handler/error.py +2 -0
- telegrinder/tools/error_handler/error_handler.py +6 -6
- telegrinder/tools/formatting/spec_html_formats.py +10 -10
- telegrinder/tools/global_context/__init__.py +2 -2
- telegrinder/tools/global_context/global_context.py +3 -3
- telegrinder/tools/global_context/telegrinder_ctx.py +4 -4
- telegrinder/tools/keyboard.py +3 -3
- telegrinder/tools/loop_wrapper/loop_wrapper.py +47 -13
- telegrinder/tools/magic.py +96 -18
- telegrinder/types/__init__.py +1 -0
- telegrinder/types/enums.py +2 -0
- telegrinder/types/methods.py +91 -15
- telegrinder/types/objects.py +49 -24
- telegrinder/verification_utils.py +1 -3
- {telegrinder-0.1.dev170.dist-info → telegrinder-0.2.0.dist-info}/METADATA +2 -2
- telegrinder-0.2.0.dist-info/RECORD +145 -0
- telegrinder/api/abc.py +0 -73
- telegrinder-0.1.dev170.dist-info/RECORD +0 -143
- {telegrinder-0.1.dev170.dist-info → telegrinder-0.2.0.dist-info}/LICENSE +0 -0
- {telegrinder-0.1.dev170.dist-info → telegrinder-0.2.0.dist-info}/WHEEL +0 -0
|
@@ -2,15 +2,24 @@ from __future__ import annotations
|
|
|
2
2
|
|
|
3
3
|
import typing
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
import fntypes.option
|
|
6
|
+
from fntypes.co import Result, Some, Variative
|
|
6
7
|
|
|
7
|
-
from telegrinder.api import
|
|
8
|
+
from telegrinder.api import API, APIError
|
|
9
|
+
from telegrinder.bot.cute_types.base import BaseCute, compose_method_params, shortcut
|
|
10
|
+
from telegrinder.bot.cute_types.utils import (
|
|
11
|
+
compose_link_preview_options,
|
|
12
|
+
compose_reactions,
|
|
13
|
+
compose_reply_params,
|
|
14
|
+
input_media,
|
|
15
|
+
)
|
|
8
16
|
from telegrinder.model import get_params
|
|
9
|
-
from telegrinder.msgspec_utils import Nothing
|
|
10
|
-
from telegrinder.types import (
|
|
17
|
+
from telegrinder.msgspec_utils import Nothing, Option
|
|
18
|
+
from telegrinder.types.objects import (
|
|
11
19
|
ChatAction,
|
|
12
20
|
DiceEmoji,
|
|
13
21
|
ForceReply,
|
|
22
|
+
InaccessibleMessage,
|
|
14
23
|
InlineKeyboardMarkup,
|
|
15
24
|
InputFile,
|
|
16
25
|
InputMedia,
|
|
@@ -28,14 +37,6 @@ from telegrinder.types import (
|
|
|
28
37
|
User,
|
|
29
38
|
)
|
|
30
39
|
|
|
31
|
-
from .base import BaseCute, compose_method_params, shortcut
|
|
32
|
-
from .utils import (
|
|
33
|
-
compose_link_preview_options,
|
|
34
|
-
compose_reactions,
|
|
35
|
-
compose_reply_params,
|
|
36
|
-
input_media,
|
|
37
|
-
)
|
|
38
|
-
|
|
39
40
|
if typing.TYPE_CHECKING:
|
|
40
41
|
from datetime import datetime
|
|
41
42
|
|
|
@@ -127,7 +128,7 @@ async def execute_method_edit(
|
|
|
127
128
|
|
|
128
129
|
result = await getattr(update.ctx_api, method_name)(**params)
|
|
129
130
|
return result.map(
|
|
130
|
-
lambda v: Variative[
|
|
131
|
+
lambda v: Variative[MessageCute, bool](
|
|
131
132
|
v.only()
|
|
132
133
|
.map(
|
|
133
134
|
lambda x: MessageCute.from_update(x, bound_api=update.api),
|
|
@@ -139,9 +140,9 @@ async def execute_method_edit(
|
|
|
139
140
|
|
|
140
141
|
def get_entity_value(
|
|
141
142
|
entity_value: typing.Literal["user", "url", "custom_emoji_id", "language"],
|
|
142
|
-
entities: Option[list[MessageEntity]] = Nothing,
|
|
143
|
-
caption_entities: Option[list[MessageEntity]] = Nothing,
|
|
144
|
-
) -> Option[typing.Any]:
|
|
143
|
+
entities: fntypes.option.Option[list[MessageEntity]] = Nothing,
|
|
144
|
+
caption_entities: fntypes.option.Option[list[MessageEntity]] = Nothing,
|
|
145
|
+
) -> fntypes.option.Option[typing.Any]:
|
|
145
146
|
ents = entities.unwrap_or(caption_entities.unwrap_or_none())
|
|
146
147
|
if not ents:
|
|
147
148
|
return Nothing
|
|
@@ -152,28 +153,38 @@ def get_entity_value(
|
|
|
152
153
|
|
|
153
154
|
|
|
154
155
|
class MessageCute(BaseCute[Message], Message, kw_only=True):
|
|
155
|
-
api:
|
|
156
|
+
api: API
|
|
157
|
+
|
|
158
|
+
reply_to_message: Option[MessageCute] = Nothing
|
|
159
|
+
"""Optional. For replies in the same chat and message thread, the original
|
|
160
|
+
message. Note that the Message object in this field will not contain further
|
|
161
|
+
reply_to_message fields even if it itself is a reply."""
|
|
162
|
+
|
|
163
|
+
pinned_message: Option[Variative[MessageCute, InaccessibleMessage]] = Nothing
|
|
164
|
+
"""Optional. Specified message was pinned. Note that the Message object in
|
|
165
|
+
this field will not contain further reply_to_message fields even if it
|
|
166
|
+
itself is a reply."""
|
|
156
167
|
|
|
157
168
|
@property
|
|
158
|
-
def mentioned_user(self) -> Option[User]:
|
|
169
|
+
def mentioned_user(self) -> fntypes.option.Option[User]:
|
|
159
170
|
"""Mentioned user without username."""
|
|
160
171
|
|
|
161
172
|
return get_entity_value("user", self.entities, self.caption_entities)
|
|
162
173
|
|
|
163
174
|
@property
|
|
164
|
-
def url(self) -> Option[str]:
|
|
175
|
+
def url(self) -> fntypes.option.Option[str]:
|
|
165
176
|
"""Clickable text URL."""
|
|
166
177
|
|
|
167
178
|
return get_entity_value("url", self.entities, self.caption_entities)
|
|
168
179
|
|
|
169
180
|
@property
|
|
170
|
-
def programming_language(self) -> Option[str]:
|
|
181
|
+
def programming_language(self) -> fntypes.option.Option[str]:
|
|
171
182
|
"""The programming language of the entity text."""
|
|
172
183
|
|
|
173
184
|
return get_entity_value("language", self.entities, self.caption_entities)
|
|
174
185
|
|
|
175
186
|
@property
|
|
176
|
-
def custom_emoji_id(self) -> Option[str]:
|
|
187
|
+
def custom_emoji_id(self) -> fntypes.option.Option[str]:
|
|
177
188
|
"""Unique identifier of the custom emoji."""
|
|
178
189
|
|
|
179
190
|
return get_entity_value("custom_emoji_id", self.entities, self.caption_entities)
|
|
@@ -2,17 +2,64 @@ import typing
|
|
|
2
2
|
|
|
3
3
|
from fntypes.co import Nothing, Some
|
|
4
4
|
|
|
5
|
-
from telegrinder.api import
|
|
5
|
+
from telegrinder.api import API
|
|
6
|
+
from telegrinder.bot.cute_types.base import BaseCute
|
|
7
|
+
from telegrinder.bot.cute_types.callback_query import CallbackQueryCute
|
|
8
|
+
from telegrinder.bot.cute_types.chat_join_request import ChatJoinRequestCute
|
|
9
|
+
from telegrinder.bot.cute_types.chat_member_updated import ChatMemberUpdatedCute
|
|
10
|
+
from telegrinder.bot.cute_types.inline_query import InlineQueryCute
|
|
11
|
+
from telegrinder.bot.cute_types.message import MessageCute
|
|
6
12
|
from telegrinder.msgspec_utils import Option
|
|
7
13
|
from telegrinder.types import Model, Update
|
|
8
14
|
|
|
9
|
-
from .base import BaseCute
|
|
10
|
-
|
|
11
15
|
ModelT = typing.TypeVar("ModelT", bound=Model)
|
|
12
16
|
|
|
13
17
|
|
|
14
18
|
class UpdateCute(BaseCute[Update], Update, kw_only=True):
|
|
15
|
-
api:
|
|
19
|
+
api: API
|
|
20
|
+
|
|
21
|
+
message: Option[MessageCute] = Nothing()
|
|
22
|
+
"""Optional. New incoming message of any kind - text, photo, sticker, etc."""
|
|
23
|
+
|
|
24
|
+
edited_message: Option[MessageCute] = Nothing()
|
|
25
|
+
"""Optional. New version of a message that is known to the bot and was edited.
|
|
26
|
+
This update may at times be triggered by changes to message fields that are
|
|
27
|
+
either unavailable or not actively used by your bot."""
|
|
28
|
+
|
|
29
|
+
channel_post: Option[MessageCute] = Nothing()
|
|
30
|
+
"""Optional. New incoming channel post of any kind - text, photo, sticker,
|
|
31
|
+
etc."""
|
|
32
|
+
|
|
33
|
+
edited_channel_post: Option[MessageCute] = Nothing()
|
|
34
|
+
"""Optional. New version of a channel post that is known to the bot and was edited.
|
|
35
|
+
This update may at times be triggered by changes to message fields that are
|
|
36
|
+
either unavailable or not actively used by your bot."""
|
|
37
|
+
|
|
38
|
+
business_message: Option[MessageCute] = Nothing()
|
|
39
|
+
"""Optional. New message from a connected business account."""
|
|
40
|
+
|
|
41
|
+
edited_business_message: Option[MessageCute] = Nothing()
|
|
42
|
+
"""Optional. New version of a message from a connected business account."""
|
|
43
|
+
|
|
44
|
+
inline_query: Option[InlineQueryCute] = Nothing()
|
|
45
|
+
"""Optional. New incoming inline query."""
|
|
46
|
+
|
|
47
|
+
callback_query: Option[CallbackQueryCute] = Nothing()
|
|
48
|
+
"""Optional. New incoming callback query."""
|
|
49
|
+
|
|
50
|
+
my_chat_member: Option[ChatMemberUpdatedCute] = Nothing()
|
|
51
|
+
"""Optional. The bot's chat member status was updated in a chat. For private
|
|
52
|
+
chats, this update is received only when the bot is blocked or unblocked
|
|
53
|
+
by the user."""
|
|
54
|
+
|
|
55
|
+
chat_member: Option[ChatMemberUpdatedCute] = Nothing()
|
|
56
|
+
"""Optional. A chat member's status was updated in a chat. The bot must be an
|
|
57
|
+
administrator in the chat and must explicitly specify `chat_member` in
|
|
58
|
+
the list of allowed_updates to receive these updates."""
|
|
59
|
+
|
|
60
|
+
chat_join_request: Option[ChatJoinRequestCute] = Nothing()
|
|
61
|
+
"""Optional. A request to join the chat has been sent. The bot must have the can_invite_users
|
|
62
|
+
administrator right in the chat to receive these updates."""
|
|
16
63
|
|
|
17
64
|
@property
|
|
18
65
|
def incoming_update(self) -> Model:
|
|
@@ -1,41 +1,13 @@
|
|
|
1
1
|
import typing
|
|
2
2
|
|
|
3
3
|
from telegrinder.model import get_params
|
|
4
|
-
from telegrinder.types import (
|
|
5
|
-
ChatPermissions,
|
|
6
|
-
InlineKeyboardMarkup,
|
|
7
|
-
InlineQueryResultArticle,
|
|
8
|
-
InlineQueryResultAudio,
|
|
9
|
-
InlineQueryResultCachedAudio,
|
|
10
|
-
InlineQueryResultCachedDocument,
|
|
11
|
-
InlineQueryResultCachedGif,
|
|
12
|
-
InlineQueryResultCachedMpeg4Gif,
|
|
13
|
-
InlineQueryResultCachedPhoto,
|
|
14
|
-
InlineQueryResultCachedSticker,
|
|
15
|
-
InlineQueryResultCachedVideo,
|
|
16
|
-
InlineQueryResultCachedVoice,
|
|
17
|
-
InlineQueryResultContact,
|
|
18
|
-
InlineQueryResultDocument,
|
|
19
|
-
InlineQueryResultGame,
|
|
20
|
-
InlineQueryResultGif,
|
|
21
|
-
InlineQueryResultLocation,
|
|
22
|
-
InlineQueryResultMpeg4Gif,
|
|
23
|
-
InlineQueryResultPhoto,
|
|
24
|
-
InlineQueryResultVenue,
|
|
25
|
-
InlineQueryResultVideo,
|
|
26
|
-
InlineQueryResultVoice,
|
|
27
|
-
InputContactMessageContent,
|
|
4
|
+
from telegrinder.types.objects import (
|
|
28
5
|
InputFile,
|
|
29
|
-
InputInvoiceMessageContent,
|
|
30
|
-
InputLocationMessageContent,
|
|
31
6
|
InputMediaAnimation,
|
|
32
7
|
InputMediaAudio,
|
|
33
8
|
InputMediaDocument,
|
|
34
9
|
InputMediaPhoto,
|
|
35
10
|
InputMediaVideo,
|
|
36
|
-
InputTextMessageContent,
|
|
37
|
-
InputVenueMessageContent,
|
|
38
|
-
LabeledPrice,
|
|
39
11
|
LinkPreviewOptions,
|
|
40
12
|
MessageEntity,
|
|
41
13
|
ReactionEmoji,
|
|
@@ -51,13 +23,6 @@ InputMedia: typing.TypeAlias = typing.Union[
|
|
|
51
23
|
InputMediaPhoto,
|
|
52
24
|
InputMediaVideo,
|
|
53
25
|
]
|
|
54
|
-
InputMessageContent: typing.TypeAlias = typing.Union[
|
|
55
|
-
InputTextMessageContent,
|
|
56
|
-
InputLocationMessageContent,
|
|
57
|
-
InputVenueMessageContent,
|
|
58
|
-
InputContactMessageContent,
|
|
59
|
-
InputInvoiceMessageContent,
|
|
60
|
-
]
|
|
61
26
|
|
|
62
27
|
INPUT_MEDIA_TYPES: typing.Final[dict[str, type[InputMedia]]] = {
|
|
63
28
|
"animation": InputMediaAnimation,
|
|
@@ -69,7 +34,7 @@ INPUT_MEDIA_TYPES: typing.Final[dict[str, type[InputMedia]]] = {
|
|
|
69
34
|
|
|
70
35
|
|
|
71
36
|
def compose_reactions(
|
|
72
|
-
reactions:
|
|
37
|
+
reactions: str | ReactionEmoji | ReactionType | list[str | ReactionEmoji | ReactionType],
|
|
73
38
|
/,
|
|
74
39
|
) -> list[ReactionType]:
|
|
75
40
|
if not isinstance(reactions, list):
|
|
@@ -80,7 +45,7 @@ def compose_reactions(
|
|
|
80
45
|
if isinstance(emoji, ReactionEmoji)
|
|
81
46
|
else (ReactionTypeEmoji("emoji", ReactionEmoji(emoji)) if isinstance(emoji, str) else emoji)
|
|
82
47
|
)
|
|
83
|
-
for emoji in ([reactions] if isinstance(reactions, str) else reactions)
|
|
48
|
+
for emoji in ([reactions] if isinstance(reactions, str) else reactions) # type: ignore
|
|
84
49
|
]
|
|
85
50
|
|
|
86
51
|
|
|
@@ -110,26 +75,6 @@ def compose_link_preview_options(
|
|
|
110
75
|
return LinkPreviewOptions(**get_params(locals()))
|
|
111
76
|
|
|
112
77
|
|
|
113
|
-
def compose_chat_permissions(
|
|
114
|
-
*,
|
|
115
|
-
can_send_messages: bool | None = None,
|
|
116
|
-
can_send_audios: bool | None = None,
|
|
117
|
-
can_send_documents: bool | None = None,
|
|
118
|
-
can_send_photos: bool | None = None,
|
|
119
|
-
can_send_videos: bool | None = None,
|
|
120
|
-
can_send_video_notes: bool | None = None,
|
|
121
|
-
can_send_voice_notes: bool | None = None,
|
|
122
|
-
can_send_polls: bool | None = None,
|
|
123
|
-
can_send_other_messages: bool | None = None,
|
|
124
|
-
can_add_web_page_previews: bool | None = None,
|
|
125
|
-
can_change_info: bool | None = None,
|
|
126
|
-
can_invite_users: bool | None = None,
|
|
127
|
-
can_pin_messages: bool | None = None,
|
|
128
|
-
can_manage_topics: bool | None = None,
|
|
129
|
-
) -> ChatPermissions:
|
|
130
|
-
return ChatPermissions(**get_params(locals()))
|
|
131
|
-
|
|
132
|
-
|
|
133
78
|
def input_media(
|
|
134
79
|
type: typing.Literal["animation", "audio", "document", "photo", "video"],
|
|
135
80
|
media: str | InputFile,
|
|
@@ -142,417 +87,9 @@ def input_media(
|
|
|
142
87
|
return INPUT_MEDIA_TYPES[type](**get_params(locals()))
|
|
143
88
|
|
|
144
89
|
|
|
145
|
-
def input_contact_message_content(
|
|
146
|
-
phone_number: str,
|
|
147
|
-
first_name: str,
|
|
148
|
-
*,
|
|
149
|
-
last_name: str | None = None,
|
|
150
|
-
vcard: str | None = None,
|
|
151
|
-
) -> InputContactMessageContent:
|
|
152
|
-
return InputContactMessageContent(**get_params(locals()))
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
def input_invoice_message_content(
|
|
156
|
-
title: str,
|
|
157
|
-
description: str,
|
|
158
|
-
payload: str,
|
|
159
|
-
provider_token: str,
|
|
160
|
-
currency: str,
|
|
161
|
-
prices: list[LabeledPrice],
|
|
162
|
-
*,
|
|
163
|
-
max_tip_amount: int | None = None,
|
|
164
|
-
suggested_tip_amounts: list[int] | None = None,
|
|
165
|
-
provider_data: str | None = None,
|
|
166
|
-
photo_url: str | None = None,
|
|
167
|
-
photo_size: int | None = None,
|
|
168
|
-
photo_width: int | None = None,
|
|
169
|
-
photo_height: int | None = None,
|
|
170
|
-
need_name: bool | None = None,
|
|
171
|
-
need_phone_number: bool | None = None,
|
|
172
|
-
need_email: bool | None = None,
|
|
173
|
-
need_shipping_address: bool | None = None,
|
|
174
|
-
send_phone_number_to_provider: bool | None = None,
|
|
175
|
-
) -> InputInvoiceMessageContent:
|
|
176
|
-
return InputInvoiceMessageContent(**get_params(locals()))
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
def input_location_message_content(
|
|
180
|
-
latitude: float,
|
|
181
|
-
longitude: float,
|
|
182
|
-
*,
|
|
183
|
-
horizontal_accuracy: float | None = None,
|
|
184
|
-
live_period: int | None = None,
|
|
185
|
-
heading: int | None = None,
|
|
186
|
-
proximity_alert_radius: int | None = None,
|
|
187
|
-
) -> InputLocationMessageContent:
|
|
188
|
-
return InputLocationMessageContent(**get_params(locals()))
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
def input_text_message_content(
|
|
192
|
-
message_text: str,
|
|
193
|
-
*,
|
|
194
|
-
parse_mode: str | None = None,
|
|
195
|
-
entities: list[MessageEntity] | None = None,
|
|
196
|
-
disable_web_page_preview: bool | None = None,
|
|
197
|
-
) -> InputTextMessageContent:
|
|
198
|
-
return InputTextMessageContent(**get_params(locals()))
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
def input_venue_message_content(
|
|
202
|
-
latitude: float,
|
|
203
|
-
longitude: float,
|
|
204
|
-
title: str,
|
|
205
|
-
address: str,
|
|
206
|
-
*,
|
|
207
|
-
foursquare_id: str | None = None,
|
|
208
|
-
foursquare_type: str | None = None,
|
|
209
|
-
google_place_id: str | None = None,
|
|
210
|
-
google_place_type: str | None = None,
|
|
211
|
-
) -> InputVenueMessageContent:
|
|
212
|
-
return InputVenueMessageContent(**get_params(locals()))
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
def inline_query_article(
|
|
216
|
-
id: str,
|
|
217
|
-
title: str,
|
|
218
|
-
input_message_content: InputMessageContent,
|
|
219
|
-
*,
|
|
220
|
-
reply_markup: InlineKeyboardMarkup | None = None,
|
|
221
|
-
url: str | None = None,
|
|
222
|
-
hide_url: bool | None = None,
|
|
223
|
-
description: str | None = None,
|
|
224
|
-
thumbnail_url: str | None = None,
|
|
225
|
-
thumbnail_width: int | None = None,
|
|
226
|
-
thumbnail_height: int | None = None,
|
|
227
|
-
) -> InlineQueryResultArticle:
|
|
228
|
-
return InlineQueryResultArticle(type="article", **get_params(locals()))
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
def inline_query_audio(
|
|
232
|
-
id: str,
|
|
233
|
-
audio_url: str,
|
|
234
|
-
*,
|
|
235
|
-
title: str | None = None,
|
|
236
|
-
caption: str | None = None,
|
|
237
|
-
parse_mode: str | None = None,
|
|
238
|
-
caption_entities: list[MessageEntity] | None = None,
|
|
239
|
-
performer: str | None = None,
|
|
240
|
-
audio_duration: int | None = None,
|
|
241
|
-
reply_markup: InlineKeyboardMarkup | None = None,
|
|
242
|
-
input_message_content: InputMessageContent | None = None,
|
|
243
|
-
) -> InlineQueryResultAudio:
|
|
244
|
-
return InlineQueryResultAudio(type="audio", **get_params(locals()))
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
def inline_query_contact(
|
|
248
|
-
id: str,
|
|
249
|
-
phone_number: str,
|
|
250
|
-
first_name: str,
|
|
251
|
-
*,
|
|
252
|
-
last_name: str | None = None,
|
|
253
|
-
vcard: str | None = None,
|
|
254
|
-
reply_markup: InlineKeyboardMarkup | None = None,
|
|
255
|
-
input_message_content: InputMessageContent | None = None,
|
|
256
|
-
thumbnail_url: str | None = None,
|
|
257
|
-
thumbnail_width: int | None = None,
|
|
258
|
-
thumbnail_height: int | None = None,
|
|
259
|
-
) -> InlineQueryResultContact:
|
|
260
|
-
return InlineQueryResultContact(type="contact", **get_params(locals()))
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
def inline_query_document(
|
|
264
|
-
id: str,
|
|
265
|
-
title: str,
|
|
266
|
-
document_url: str,
|
|
267
|
-
mime_type: str,
|
|
268
|
-
*,
|
|
269
|
-
description: str | None = None,
|
|
270
|
-
caption: str | None = None,
|
|
271
|
-
parse_mode: str | None = None,
|
|
272
|
-
caption_entities: list[MessageEntity] | None = None,
|
|
273
|
-
reply_markup: InlineKeyboardMarkup | None = None,
|
|
274
|
-
input_message_content: InputMessageContent | None = None,
|
|
275
|
-
thumbnail_url: str | None = None,
|
|
276
|
-
thumbnail_width: int | None = None,
|
|
277
|
-
thumbnail_height: int | None = None,
|
|
278
|
-
) -> InlineQueryResultDocument:
|
|
279
|
-
return InlineQueryResultDocument(type="document", **get_params(locals()))
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
def inline_query_gif(
|
|
283
|
-
id: str,
|
|
284
|
-
gif_url: str,
|
|
285
|
-
*,
|
|
286
|
-
gif_width: int | None = None,
|
|
287
|
-
gif_height: int | None = None,
|
|
288
|
-
gif_duration: int | None = None,
|
|
289
|
-
title: str | None = None,
|
|
290
|
-
caption: str | None = None,
|
|
291
|
-
parse_mode: str | None = None,
|
|
292
|
-
caption_entities: list[MessageEntity] | None = None,
|
|
293
|
-
reply_markup: InlineKeyboardMarkup | None = None,
|
|
294
|
-
input_message_content: InputMessageContent | None = None,
|
|
295
|
-
thumbnail_url: str | None = None,
|
|
296
|
-
thumbnail_mime_type: str | None = None,
|
|
297
|
-
) -> InlineQueryResultGif:
|
|
298
|
-
return InlineQueryResultGif(type="gif", **get_params(locals()))
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
def inline_query_location(
|
|
302
|
-
id: str,
|
|
303
|
-
latitude: float,
|
|
304
|
-
longitude: float,
|
|
305
|
-
*,
|
|
306
|
-
title: str | None = None,
|
|
307
|
-
horizontal_accuracy: float | None = None,
|
|
308
|
-
live_period: int | None = None,
|
|
309
|
-
heading: int | None = None,
|
|
310
|
-
proximity_alert_radius: int | None = None,
|
|
311
|
-
reply_markup: InlineKeyboardMarkup | None = None,
|
|
312
|
-
input_message_content: InputMessageContent | None = None,
|
|
313
|
-
thumbnail_url: str | None = None,
|
|
314
|
-
thumbnail_width: int | None = None,
|
|
315
|
-
thumbnail_height: int | None = None,
|
|
316
|
-
) -> InlineQueryResultLocation:
|
|
317
|
-
return InlineQueryResultLocation(type="location", **get_params(locals()))
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
def inline_query_venue(
|
|
321
|
-
id: str,
|
|
322
|
-
latitude: float,
|
|
323
|
-
longitude: float,
|
|
324
|
-
title: str,
|
|
325
|
-
address: str,
|
|
326
|
-
*,
|
|
327
|
-
foursquare_id: str | None = None,
|
|
328
|
-
foursquare_type: str | None = None,
|
|
329
|
-
google_place_id: str | None = None,
|
|
330
|
-
google_place_type: str | None = None,
|
|
331
|
-
reply_markup: InlineKeyboardMarkup | None = None,
|
|
332
|
-
input_message_content: InputMessageContent | None = None,
|
|
333
|
-
thumbnail_url: str | None = None,
|
|
334
|
-
thumbnail_width: int | None = None,
|
|
335
|
-
thumbnail_height: int | None = None,
|
|
336
|
-
) -> InlineQueryResultVenue:
|
|
337
|
-
return InlineQueryResultVenue(type="venue", **get_params(locals()))
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
def inline_query_video(
|
|
341
|
-
id: str,
|
|
342
|
-
video_url: str,
|
|
343
|
-
mime_type: str,
|
|
344
|
-
thumb_url: str,
|
|
345
|
-
*,
|
|
346
|
-
title: str | None = None,
|
|
347
|
-
caption: str | None = None,
|
|
348
|
-
parse_mode: str | None = None,
|
|
349
|
-
caption_entities: list[MessageEntity] | None = None,
|
|
350
|
-
video_width: int | None = None,
|
|
351
|
-
video_height: int | None = None,
|
|
352
|
-
video_duration: int | None = None,
|
|
353
|
-
description: str | None = None,
|
|
354
|
-
reply_markup: InlineKeyboardMarkup | None = None,
|
|
355
|
-
input_message_content: InputMessageContent | None = None,
|
|
356
|
-
thumbnail_url: str | None = None,
|
|
357
|
-
thumbnail_width: int | None = None,
|
|
358
|
-
thumbnail_height: int | None = None,
|
|
359
|
-
) -> InlineQueryResultVideo:
|
|
360
|
-
return InlineQueryResultVideo(type="video", **get_params(locals()))
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
def inline_query_game(
|
|
364
|
-
id: str,
|
|
365
|
-
game_short_name: str,
|
|
366
|
-
*,
|
|
367
|
-
reply_markup: InlineKeyboardMarkup | None = None,
|
|
368
|
-
) -> InlineQueryResultGame:
|
|
369
|
-
return InlineQueryResultGame(type="game", **get_params(locals()))
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
def inline_query_voice(
|
|
373
|
-
id: str,
|
|
374
|
-
voice_url: str,
|
|
375
|
-
title: str,
|
|
376
|
-
*,
|
|
377
|
-
caption: str | None = None,
|
|
378
|
-
parse_mode: str | None = None,
|
|
379
|
-
caption_entities: list[MessageEntity] | None = None,
|
|
380
|
-
reply_markup: InlineKeyboardMarkup | None = None,
|
|
381
|
-
input_message_content: InputMessageContent | None = None,
|
|
382
|
-
duration: int | None = None,
|
|
383
|
-
) -> InlineQueryResultVoice:
|
|
384
|
-
return InlineQueryResultVoice(type="voice", **get_params(locals()))
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
def inline_query_photo(
|
|
388
|
-
id: str,
|
|
389
|
-
photo_url: str,
|
|
390
|
-
thumb_url: str,
|
|
391
|
-
*,
|
|
392
|
-
photo_width: int | None = None,
|
|
393
|
-
photo_height: int | None = None,
|
|
394
|
-
title: str | None = None,
|
|
395
|
-
description: str | None = None,
|
|
396
|
-
caption: str | None = None,
|
|
397
|
-
parse_mode: str | None = None,
|
|
398
|
-
caption_entities: list[MessageEntity] | None = None,
|
|
399
|
-
reply_markup: InlineKeyboardMarkup | None = None,
|
|
400
|
-
input_message_content: InputMessageContent | None = None,
|
|
401
|
-
) -> InlineQueryResultPhoto:
|
|
402
|
-
return InlineQueryResultPhoto(type="photo", **get_params(locals()))
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
def inline_query_mpeg4_gif(
|
|
406
|
-
id: str,
|
|
407
|
-
mpeg4_url: str,
|
|
408
|
-
*,
|
|
409
|
-
mpeg4_width: int | None = None,
|
|
410
|
-
mpeg4_height: int | None = None,
|
|
411
|
-
mpeg4_duration: int | None = None,
|
|
412
|
-
thumb_url: str | None = None,
|
|
413
|
-
reply_markup: InlineKeyboardMarkup | None = None,
|
|
414
|
-
input_message_content: InputMessageContent | None = None,
|
|
415
|
-
) -> InlineQueryResultMpeg4Gif:
|
|
416
|
-
return InlineQueryResultMpeg4Gif(type="mpeg4_gif", **get_params(locals()))
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
def inline_query_cached_sticker(
|
|
420
|
-
id: str,
|
|
421
|
-
sticker_file_id: str,
|
|
422
|
-
*,
|
|
423
|
-
reply_markup: InlineKeyboardMarkup | None = None,
|
|
424
|
-
) -> InlineQueryResultCachedSticker:
|
|
425
|
-
return InlineQueryResultCachedSticker(type="sticker", **get_params(locals()))
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
def inline_query_cached_document(
|
|
429
|
-
id: str,
|
|
430
|
-
document_file_id: str,
|
|
431
|
-
*,
|
|
432
|
-
title: str | None = None,
|
|
433
|
-
description: str | None = None,
|
|
434
|
-
caption: str | None = None,
|
|
435
|
-
parse_mode: str | None = None,
|
|
436
|
-
caption_entities: list[MessageEntity] | None = None,
|
|
437
|
-
reply_markup: InlineKeyboardMarkup | None = None,
|
|
438
|
-
input_message_content: InputMessageContent | None = None,
|
|
439
|
-
) -> InlineQueryResultCachedDocument:
|
|
440
|
-
return InlineQueryResultCachedDocument(type="document", **get_params(locals()))
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
def inline_query_cached_audio(
|
|
444
|
-
id: str,
|
|
445
|
-
audio_file_id: str,
|
|
446
|
-
*,
|
|
447
|
-
caption: str | None = None,
|
|
448
|
-
parse_mode: str | None = None,
|
|
449
|
-
caption_entities: list[MessageEntity] | None = None,
|
|
450
|
-
reply_markup: InlineKeyboardMarkup | None = None,
|
|
451
|
-
input_message_content: InputMessageContent | None = None,
|
|
452
|
-
) -> InlineQueryResultCachedAudio:
|
|
453
|
-
return InlineQueryResultCachedAudio(type="audio", **get_params(locals()))
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
def inline_query_cached_video(
|
|
457
|
-
id: str,
|
|
458
|
-
video_file_id: str,
|
|
459
|
-
*,
|
|
460
|
-
title: str | None = None,
|
|
461
|
-
description: str | None = None,
|
|
462
|
-
caption: str | None = None,
|
|
463
|
-
parse_mode: str | None = None,
|
|
464
|
-
caption_entities: list[MessageEntity] | None = None,
|
|
465
|
-
reply_markup: InlineKeyboardMarkup | None = None,
|
|
466
|
-
input_message_content: InputMessageContent | None = None,
|
|
467
|
-
) -> InlineQueryResultCachedVideo:
|
|
468
|
-
return InlineQueryResultCachedVideo(type="video", **get_params(locals()))
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
def inline_query_cached_gif(
|
|
472
|
-
id: str,
|
|
473
|
-
gif_file_id: str,
|
|
474
|
-
*,
|
|
475
|
-
title: str | None = None,
|
|
476
|
-
caption: str | None = None,
|
|
477
|
-
parse_mode: str | None = None,
|
|
478
|
-
caption_entities: list[MessageEntity] | None = None,
|
|
479
|
-
reply_markup: InlineKeyboardMarkup | None = None,
|
|
480
|
-
input_message_content: InputMessageContent | None = None,
|
|
481
|
-
) -> InlineQueryResultCachedGif:
|
|
482
|
-
return InlineQueryResultCachedGif(type="gif", **get_params(locals()))
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
def inline_query_cached_mpeg4_gif(
|
|
486
|
-
id: str,
|
|
487
|
-
mpeg4_file_id: str,
|
|
488
|
-
*,
|
|
489
|
-
title: str | None = None,
|
|
490
|
-
caption: str | None = None,
|
|
491
|
-
parse_mode: str | None = None,
|
|
492
|
-
caption_entities: list[MessageEntity] | None = None,
|
|
493
|
-
reply_markup: InlineKeyboardMarkup | None = None,
|
|
494
|
-
input_message_content: InputMessageContent | None = None,
|
|
495
|
-
) -> InlineQueryResultCachedMpeg4Gif:
|
|
496
|
-
return InlineQueryResultCachedMpeg4Gif(type="mpeg4_gif", **get_params(locals()))
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
def inline_query_cached_voice(
|
|
500
|
-
id: str,
|
|
501
|
-
voice_file_id: str,
|
|
502
|
-
*,
|
|
503
|
-
caption: str | None = None,
|
|
504
|
-
parse_mode: str | None = None,
|
|
505
|
-
caption_entities: list[MessageEntity] | None = None,
|
|
506
|
-
reply_markup: InlineKeyboardMarkup | None = None,
|
|
507
|
-
input_message_content: InputMessageContent | None = None,
|
|
508
|
-
) -> InlineQueryResultCachedVoice:
|
|
509
|
-
return InlineQueryResultCachedVoice(type="voice", **get_params(locals()))
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
def inline_query_cached_photo(
|
|
513
|
-
id: str,
|
|
514
|
-
photo_file_id: str,
|
|
515
|
-
*,
|
|
516
|
-
title: str | None = None,
|
|
517
|
-
description: str | None = None,
|
|
518
|
-
caption: str | None = None,
|
|
519
|
-
parse_mode: str | None = None,
|
|
520
|
-
caption_entities: list[MessageEntity] | None = None,
|
|
521
|
-
reply_markup: InlineKeyboardMarkup | None = None,
|
|
522
|
-
input_message_content: InputMessageContent | None = None,
|
|
523
|
-
) -> InlineQueryResultCachedPhoto:
|
|
524
|
-
return InlineQueryResultCachedPhoto(type="photo", **get_params(locals()))
|
|
525
|
-
|
|
526
|
-
|
|
527
90
|
__all__ = (
|
|
528
|
-
"compose_chat_permissions",
|
|
529
91
|
"compose_link_preview_options",
|
|
530
92
|
"compose_reactions",
|
|
531
93
|
"compose_reply_params",
|
|
532
|
-
"inline_query_article",
|
|
533
|
-
"inline_query_audio",
|
|
534
|
-
"inline_query_cached_audio",
|
|
535
|
-
"inline_query_cached_document",
|
|
536
|
-
"inline_query_cached_gif",
|
|
537
|
-
"inline_query_cached_mpeg4_gif",
|
|
538
|
-
"inline_query_cached_photo",
|
|
539
|
-
"inline_query_cached_sticker",
|
|
540
|
-
"inline_query_cached_video",
|
|
541
|
-
"inline_query_cached_voice",
|
|
542
|
-
"inline_query_contact",
|
|
543
|
-
"inline_query_document",
|
|
544
|
-
"inline_query_game",
|
|
545
|
-
"inline_query_gif",
|
|
546
|
-
"inline_query_location",
|
|
547
|
-
"inline_query_mpeg4_gif",
|
|
548
|
-
"inline_query_photo",
|
|
549
|
-
"inline_query_venue",
|
|
550
|
-
"inline_query_video",
|
|
551
|
-
"inline_query_voice",
|
|
552
|
-
"input_contact_message_content",
|
|
553
|
-
"input_invoice_message_content",
|
|
554
|
-
"input_location_message_content",
|
|
555
94
|
"input_media",
|
|
556
|
-
"input_text_message_content",
|
|
557
|
-
"input_venue_message_content",
|
|
558
95
|
)
|