telegrinder 0.1.dev158__py3-none-any.whl → 0.1.dev160__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 +4 -2
- telegrinder/api/__init__.py +0 -0
- telegrinder/api/abc.py +6 -4
- telegrinder/api/api.py +25 -11
- telegrinder/api/error.py +0 -0
- telegrinder/api/response.py +0 -0
- telegrinder/bot/__init__.py +0 -0
- telegrinder/bot/bot.py +0 -0
- telegrinder/bot/cute_types/__init__.py +0 -0
- telegrinder/bot/cute_types/base.py +100 -9
- telegrinder/bot/cute_types/callback_query.py +426 -37
- telegrinder/bot/cute_types/inline_query.py +44 -17
- telegrinder/bot/cute_types/message.py +2885 -117
- telegrinder/bot/cute_types/update.py +14 -7
- telegrinder/bot/cute_types/utils.py +542 -0
- telegrinder/bot/dispatch/__init__.py +0 -0
- telegrinder/bot/dispatch/abc.py +0 -0
- telegrinder/bot/dispatch/composition.py +0 -0
- telegrinder/bot/dispatch/context.py +0 -0
- telegrinder/bot/dispatch/dispatch.py +0 -0
- telegrinder/bot/dispatch/handler/__init__.py +0 -0
- telegrinder/bot/dispatch/handler/abc.py +0 -0
- telegrinder/bot/dispatch/handler/func.py +1 -1
- telegrinder/bot/dispatch/handler/message_reply.py +0 -0
- telegrinder/bot/dispatch/middleware/__init__.py +0 -0
- telegrinder/bot/dispatch/middleware/abc.py +0 -0
- telegrinder/bot/dispatch/process.py +0 -0
- telegrinder/bot/dispatch/return_manager/__init__.py +0 -0
- telegrinder/bot/dispatch/return_manager/abc.py +0 -0
- telegrinder/bot/dispatch/return_manager/callback_query.py +0 -0
- telegrinder/bot/dispatch/return_manager/inline_query.py +0 -0
- telegrinder/bot/dispatch/return_manager/message.py +0 -0
- telegrinder/bot/dispatch/view/__init__.py +0 -0
- telegrinder/bot/dispatch/view/abc.py +40 -29
- telegrinder/bot/dispatch/view/box.py +0 -0
- telegrinder/bot/dispatch/view/callback_query.py +0 -0
- telegrinder/bot/dispatch/view/inline_query.py +0 -0
- telegrinder/bot/dispatch/view/message.py +0 -0
- telegrinder/bot/dispatch/waiter_machine/__init__.py +0 -0
- telegrinder/bot/dispatch/waiter_machine/machine.py +0 -0
- telegrinder/bot/dispatch/waiter_machine/middleware.py +0 -0
- telegrinder/bot/dispatch/waiter_machine/short_state.py +0 -0
- telegrinder/bot/polling/__init__.py +0 -0
- telegrinder/bot/polling/abc.py +0 -0
- telegrinder/bot/polling/polling.py +7 -11
- telegrinder/bot/rules/__init__.py +0 -0
- telegrinder/bot/rules/abc.py +1 -1
- telegrinder/bot/rules/adapter/__init__.py +0 -0
- telegrinder/bot/rules/adapter/abc.py +0 -0
- telegrinder/bot/rules/adapter/errors.py +0 -0
- telegrinder/bot/rules/adapter/event.py +12 -6
- telegrinder/bot/rules/adapter/raw_update.py +0 -0
- telegrinder/bot/rules/callback_data.py +3 -11
- telegrinder/bot/rules/command.py +0 -0
- telegrinder/bot/rules/enum_text.py +0 -0
- telegrinder/bot/rules/func.py +0 -0
- telegrinder/bot/rules/fuzzy.py +0 -0
- telegrinder/bot/rules/inline.py +2 -1
- telegrinder/bot/rules/integer.py +0 -0
- telegrinder/bot/rules/is_from.py +0 -0
- telegrinder/bot/rules/markup.py +3 -1
- telegrinder/bot/rules/mention.py +0 -0
- telegrinder/bot/rules/message_entities.py +3 -1
- telegrinder/bot/rules/regex.py +1 -1
- telegrinder/bot/rules/rule_enum.py +0 -0
- telegrinder/bot/rules/start.py +0 -0
- telegrinder/bot/rules/text.py +0 -0
- telegrinder/bot/scenario/__init__.py +0 -0
- telegrinder/bot/scenario/abc.py +0 -0
- telegrinder/bot/scenario/checkbox.py +0 -0
- telegrinder/bot/scenario/choice.py +0 -0
- telegrinder/client/__init__.py +2 -2
- telegrinder/client/abc.py +35 -12
- telegrinder/client/aiohttp.py +35 -22
- telegrinder/model.py +70 -23
- telegrinder/modules.py +22 -12
- telegrinder/msgspec_json.py +0 -0
- telegrinder/msgspec_utils.py +30 -10
- telegrinder/node/__init__.py +0 -0
- telegrinder/node/attachment.py +0 -0
- telegrinder/node/base.py +0 -0
- telegrinder/node/composer.py +0 -0
- telegrinder/node/container.py +0 -0
- telegrinder/node/message.py +0 -0
- telegrinder/node/rule.py +0 -0
- telegrinder/node/source.py +0 -0
- telegrinder/node/text.py +0 -0
- telegrinder/node/tools/__init__.py +0 -0
- telegrinder/node/tools/generator.py +0 -0
- telegrinder/node/update.py +0 -0
- telegrinder/rules.py +0 -0
- telegrinder/tools/__init__.py +2 -30
- telegrinder/tools/buttons.py +19 -5
- telegrinder/tools/error_handler/__init__.py +2 -0
- telegrinder/tools/error_handler/abc.py +5 -1
- telegrinder/tools/error_handler/error.py +10 -0
- telegrinder/tools/error_handler/error_handler.py +100 -81
- telegrinder/tools/formatting/__init__.py +0 -0
- telegrinder/tools/formatting/html.py +0 -0
- telegrinder/tools/formatting/links.py +0 -0
- telegrinder/tools/formatting/spec_html_formats.py +0 -0
- telegrinder/tools/global_context/__init__.py +0 -0
- telegrinder/tools/global_context/abc.py +0 -0
- telegrinder/tools/global_context/global_context.py +65 -67
- telegrinder/tools/global_context/telegrinder_ctx.py +0 -0
- telegrinder/tools/i18n/__init__.py +0 -0
- telegrinder/tools/i18n/base.py +0 -0
- telegrinder/tools/i18n/middleware/__init__.py +0 -0
- telegrinder/tools/i18n/middleware/base.py +0 -0
- telegrinder/tools/i18n/simple.py +0 -0
- telegrinder/tools/kb_set/__init__.py +0 -0
- telegrinder/tools/kb_set/base.py +0 -0
- telegrinder/tools/kb_set/yaml.py +3 -3
- telegrinder/tools/keyboard.py +17 -26
- telegrinder/tools/loop_wrapper/__init__.py +0 -0
- telegrinder/tools/loop_wrapper/abc.py +0 -0
- telegrinder/tools/loop_wrapper/loop_wrapper.py +0 -0
- telegrinder/tools/magic.py +1 -1
- telegrinder/tools/parse_mode.py +0 -0
- telegrinder/types/__init__.py +0 -0
- telegrinder/types/enums.py +13 -9
- telegrinder/types/methods.py +783 -673
- telegrinder/types/objects.py +317 -163
- {telegrinder-0.1.dev158.dist-info → telegrinder-0.1.dev160.dist-info}/LICENSE +0 -0
- {telegrinder-0.1.dev158.dist-info → telegrinder-0.1.dev160.dist-info}/METADATA +9 -7
- {telegrinder-0.1.dev158.dist-info → telegrinder-0.1.dev160.dist-info}/RECORD +42 -41
- {telegrinder-0.1.dev158.dist-info → telegrinder-0.1.dev160.dist-info}/WHEEL +1 -1
- telegrinder/tools/inline_query.py +0 -684
|
@@ -1,22 +1,29 @@
|
|
|
1
|
+
import typing
|
|
2
|
+
|
|
1
3
|
from fntypes.co import Nothing, Some
|
|
2
4
|
|
|
3
5
|
from telegrinder.api import ABCAPI
|
|
4
6
|
from telegrinder.msgspec_utils import Option
|
|
5
|
-
from telegrinder.types import
|
|
7
|
+
from telegrinder.types import Model, Update
|
|
6
8
|
|
|
7
9
|
from .base import BaseCute
|
|
8
10
|
|
|
11
|
+
ModelT = typing.TypeVar("ModelT", bound=Model)
|
|
12
|
+
|
|
9
13
|
|
|
10
14
|
class UpdateCute(BaseCute[Update], Update, kw_only=True):
|
|
11
15
|
api: ABCAPI
|
|
12
16
|
|
|
13
17
|
@property
|
|
14
|
-
def
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
def incoming_update(self) -> Model:
|
|
19
|
+
return getattr(
|
|
20
|
+
self,
|
|
21
|
+
self.update_type.expect("Update object has no incoming update.").value,
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
def get_event(self, event_model: type[ModelT]) -> Option[ModelT]:
|
|
25
|
+
if isinstance(self.incoming_update, event_model):
|
|
26
|
+
return Some(self.incoming_update)
|
|
20
27
|
return Nothing()
|
|
21
28
|
|
|
22
29
|
|
|
@@ -0,0 +1,542 @@
|
|
|
1
|
+
import typing
|
|
2
|
+
|
|
3
|
+
from telegrinder.model import get_params
|
|
4
|
+
from telegrinder.types import (
|
|
5
|
+
InlineKeyboardMarkup,
|
|
6
|
+
InlineQueryResultArticle,
|
|
7
|
+
InlineQueryResultAudio,
|
|
8
|
+
InlineQueryResultCachedAudio,
|
|
9
|
+
InlineQueryResultCachedDocument,
|
|
10
|
+
InlineQueryResultCachedGif,
|
|
11
|
+
InlineQueryResultCachedMpeg4Gif,
|
|
12
|
+
InlineQueryResultCachedPhoto,
|
|
13
|
+
InlineQueryResultCachedSticker,
|
|
14
|
+
InlineQueryResultCachedVideo,
|
|
15
|
+
InlineQueryResultCachedVoice,
|
|
16
|
+
InlineQueryResultContact,
|
|
17
|
+
InlineQueryResultDocument,
|
|
18
|
+
InlineQueryResultGame,
|
|
19
|
+
InlineQueryResultGif,
|
|
20
|
+
InlineQueryResultLocation,
|
|
21
|
+
InlineQueryResultMpeg4Gif,
|
|
22
|
+
InlineQueryResultPhoto,
|
|
23
|
+
InlineQueryResultVenue,
|
|
24
|
+
InlineQueryResultVideo,
|
|
25
|
+
InlineQueryResultVoice,
|
|
26
|
+
InputContactMessageContent,
|
|
27
|
+
InputFile,
|
|
28
|
+
InputInvoiceMessageContent,
|
|
29
|
+
InputLocationMessageContent,
|
|
30
|
+
InputMediaAnimation,
|
|
31
|
+
InputMediaAudio,
|
|
32
|
+
InputMediaDocument,
|
|
33
|
+
InputMediaPhoto,
|
|
34
|
+
InputMediaVideo,
|
|
35
|
+
InputTextMessageContent,
|
|
36
|
+
InputVenueMessageContent,
|
|
37
|
+
LabeledPrice,
|
|
38
|
+
LinkPreviewOptions,
|
|
39
|
+
MessageEntity,
|
|
40
|
+
ReactionEmoji,
|
|
41
|
+
ReactionType,
|
|
42
|
+
ReactionTypeEmoji,
|
|
43
|
+
ReplyParameters,
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
InputMedia: typing.TypeAlias = typing.Union[
|
|
47
|
+
InputMediaAnimation,
|
|
48
|
+
InputMediaAudio,
|
|
49
|
+
InputMediaDocument,
|
|
50
|
+
InputMediaPhoto,
|
|
51
|
+
InputMediaVideo,
|
|
52
|
+
]
|
|
53
|
+
InputMessageContent: typing.TypeAlias = typing.Union[
|
|
54
|
+
InputTextMessageContent,
|
|
55
|
+
InputLocationMessageContent,
|
|
56
|
+
InputVenueMessageContent,
|
|
57
|
+
InputContactMessageContent,
|
|
58
|
+
InputInvoiceMessageContent,
|
|
59
|
+
]
|
|
60
|
+
|
|
61
|
+
INPUT_MEDIA_TYPES: typing.Final[dict[str, type[InputMedia]]] = {
|
|
62
|
+
"animation": InputMediaAnimation,
|
|
63
|
+
"audio": InputMediaAudio,
|
|
64
|
+
"document": InputMediaDocument,
|
|
65
|
+
"photo": InputMediaPhoto,
|
|
66
|
+
"video": InputMediaVideo,
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def compose_reactions(
|
|
71
|
+
reactions: (
|
|
72
|
+
str | ReactionEmoji | ReactionType | list[str | ReactionEmoji | ReactionType]
|
|
73
|
+
),
|
|
74
|
+
/,
|
|
75
|
+
) -> list[ReactionType]:
|
|
76
|
+
if not isinstance(reactions, list):
|
|
77
|
+
reactions = [reactions]
|
|
78
|
+
return [
|
|
79
|
+
(
|
|
80
|
+
ReactionTypeEmoji("emoji", emoji)
|
|
81
|
+
if isinstance(emoji, ReactionEmoji)
|
|
82
|
+
else (
|
|
83
|
+
ReactionTypeEmoji("emoji", ReactionEmoji(emoji))
|
|
84
|
+
if isinstance(emoji, str)
|
|
85
|
+
else emoji
|
|
86
|
+
)
|
|
87
|
+
)
|
|
88
|
+
for emoji in ([reactions] if isinstance(reactions, str) else reactions)
|
|
89
|
+
]
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
def compose_reply_params(
|
|
93
|
+
message_id: int | None,
|
|
94
|
+
chat_id: int | str | None,
|
|
95
|
+
*,
|
|
96
|
+
allow_sending_without_reply: bool | None = None,
|
|
97
|
+
quote: str | None = None,
|
|
98
|
+
quote_parse_mode: str | None = None,
|
|
99
|
+
quote_entities: list[MessageEntity] | None = None,
|
|
100
|
+
quote_position: int | None = None,
|
|
101
|
+
**other: typing.Any,
|
|
102
|
+
) -> ReplyParameters:
|
|
103
|
+
return ReplyParameters(**get_params(locals()))
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
def compose_link_preview_options(
|
|
107
|
+
*,
|
|
108
|
+
is_disabled: bool | None = None,
|
|
109
|
+
url: str | None = None,
|
|
110
|
+
prefer_small_media: bool | None = None,
|
|
111
|
+
prefer_large_media: bool | None = None,
|
|
112
|
+
show_above_text: bool | None = None,
|
|
113
|
+
**other: typing.Any,
|
|
114
|
+
) -> LinkPreviewOptions:
|
|
115
|
+
return LinkPreviewOptions(**get_params(locals()))
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
def input_media(
|
|
119
|
+
type: typing.Literal["animation", "audio", "document", "photo", "video"],
|
|
120
|
+
media: str | InputFile,
|
|
121
|
+
*,
|
|
122
|
+
caption: str | None = None,
|
|
123
|
+
parse_mode: str | None = None,
|
|
124
|
+
caption_entities: list[MessageEntity] | None = None,
|
|
125
|
+
**other: typing.Any,
|
|
126
|
+
) -> InputMedia:
|
|
127
|
+
return INPUT_MEDIA_TYPES[type](**get_params(locals()))
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
def input_contact_message_content(
|
|
131
|
+
phone_number: str,
|
|
132
|
+
first_name: str,
|
|
133
|
+
*,
|
|
134
|
+
last_name: str | None = None,
|
|
135
|
+
vcard: str | None = None,
|
|
136
|
+
) -> InputContactMessageContent:
|
|
137
|
+
return InputContactMessageContent(**get_params(locals()))
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
def input_invoice_message_content(
|
|
141
|
+
title: str,
|
|
142
|
+
description: str,
|
|
143
|
+
payload: str,
|
|
144
|
+
provider_token: str,
|
|
145
|
+
currency: str,
|
|
146
|
+
prices: list[LabeledPrice],
|
|
147
|
+
*,
|
|
148
|
+
max_tip_amount: int | None = None,
|
|
149
|
+
suggested_tip_amounts: list[int] | None = None,
|
|
150
|
+
provider_data: str | None = None,
|
|
151
|
+
photo_url: str | None = None,
|
|
152
|
+
photo_size: int | None = None,
|
|
153
|
+
photo_width: int | None = None,
|
|
154
|
+
photo_height: int | None = None,
|
|
155
|
+
need_name: bool | None = None,
|
|
156
|
+
need_phone_number: bool | None = None,
|
|
157
|
+
need_email: bool | None = None,
|
|
158
|
+
need_shipping_address: bool | None = None,
|
|
159
|
+
send_phone_number_to_provider: bool | None = None,
|
|
160
|
+
) -> InputInvoiceMessageContent:
|
|
161
|
+
return InputInvoiceMessageContent(**get_params(locals()))
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
def input_location_message_content(
|
|
165
|
+
latitude: float,
|
|
166
|
+
longitude: float,
|
|
167
|
+
*,
|
|
168
|
+
horizontal_accuracy: float | None = None,
|
|
169
|
+
live_period: int | None = None,
|
|
170
|
+
heading: int | None = None,
|
|
171
|
+
proximity_alert_radius: int | None = None,
|
|
172
|
+
) -> InputLocationMessageContent:
|
|
173
|
+
return InputLocationMessageContent(**get_params(locals()))
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
def input_text_message_content(
|
|
177
|
+
message_text: str,
|
|
178
|
+
*,
|
|
179
|
+
parse_mode: str | None = None,
|
|
180
|
+
entities: list[MessageEntity] | None = None,
|
|
181
|
+
disable_web_page_preview: bool | None = None,
|
|
182
|
+
) -> InputTextMessageContent:
|
|
183
|
+
return InputTextMessageContent(**get_params(locals()))
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
def input_venue_message_content(
|
|
187
|
+
latitude: float,
|
|
188
|
+
longitude: float,
|
|
189
|
+
title: str,
|
|
190
|
+
address: str,
|
|
191
|
+
*,
|
|
192
|
+
foursquare_id: str | None = None,
|
|
193
|
+
foursquare_type: str | None = None,
|
|
194
|
+
google_place_id: str | None = None,
|
|
195
|
+
google_place_type: str | None = None,
|
|
196
|
+
) -> InputVenueMessageContent:
|
|
197
|
+
return InputVenueMessageContent(**get_params(locals()))
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
def inline_query_article(
|
|
201
|
+
id: str,
|
|
202
|
+
title: str,
|
|
203
|
+
input_message_content: InputMessageContent,
|
|
204
|
+
*,
|
|
205
|
+
reply_markup: InlineKeyboardMarkup | None = None,
|
|
206
|
+
url: str | None = None,
|
|
207
|
+
hide_url: bool | None = None,
|
|
208
|
+
description: str | None = None,
|
|
209
|
+
thumbnail_url: str | None = None,
|
|
210
|
+
thumbnail_width: int | None = None,
|
|
211
|
+
thumbnail_height: int | None = None,
|
|
212
|
+
) -> InlineQueryResultArticle:
|
|
213
|
+
return InlineQueryResultArticle(type="article", **get_params(locals()))
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
def inline_query_audio(
|
|
217
|
+
id: str,
|
|
218
|
+
audio_url: str,
|
|
219
|
+
*,
|
|
220
|
+
title: str | None = None,
|
|
221
|
+
caption: str | None = None,
|
|
222
|
+
parse_mode: str | None = None,
|
|
223
|
+
caption_entities: list[MessageEntity] | None = None,
|
|
224
|
+
performer: str | None = None,
|
|
225
|
+
audio_duration: int | None = None,
|
|
226
|
+
reply_markup: InlineKeyboardMarkup | None = None,
|
|
227
|
+
input_message_content: InputMessageContent | None = None,
|
|
228
|
+
) -> InlineQueryResultAudio:
|
|
229
|
+
return InlineQueryResultAudio(type="audio", **get_params(locals()))
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
def inline_query_contact(
|
|
233
|
+
id: str,
|
|
234
|
+
phone_number: str,
|
|
235
|
+
first_name: str,
|
|
236
|
+
*,
|
|
237
|
+
last_name: str | None = None,
|
|
238
|
+
vcard: str | None = None,
|
|
239
|
+
reply_markup: InlineKeyboardMarkup | None = None,
|
|
240
|
+
input_message_content: InputMessageContent | None = None,
|
|
241
|
+
thumbnail_url: str | None = None,
|
|
242
|
+
thumbnail_width: int | None = None,
|
|
243
|
+
thumbnail_height: int | None = None,
|
|
244
|
+
) -> InlineQueryResultContact:
|
|
245
|
+
return InlineQueryResultContact(type="contact", **get_params(locals()))
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
def inline_query_document(
|
|
249
|
+
id: str,
|
|
250
|
+
title: str,
|
|
251
|
+
document_url: str,
|
|
252
|
+
mime_type: str,
|
|
253
|
+
*,
|
|
254
|
+
description: str | None = None,
|
|
255
|
+
caption: str | None = None,
|
|
256
|
+
parse_mode: str | None = None,
|
|
257
|
+
caption_entities: list[MessageEntity] | None = None,
|
|
258
|
+
reply_markup: InlineKeyboardMarkup | None = None,
|
|
259
|
+
input_message_content: InputMessageContent | None = None,
|
|
260
|
+
thumbnail_url: str | None = None,
|
|
261
|
+
thumbnail_width: int | None = None,
|
|
262
|
+
thumbnail_height: int | None = None,
|
|
263
|
+
) -> InlineQueryResultDocument:
|
|
264
|
+
return InlineQueryResultDocument(type="document", **get_params(locals()))
|
|
265
|
+
|
|
266
|
+
|
|
267
|
+
def inline_query_gif(
|
|
268
|
+
id: str,
|
|
269
|
+
gif_url: str,
|
|
270
|
+
*,
|
|
271
|
+
gif_width: int | None = None,
|
|
272
|
+
gif_height: int | None = None,
|
|
273
|
+
gif_duration: int | None = None,
|
|
274
|
+
title: str | None = None,
|
|
275
|
+
caption: str | None = None,
|
|
276
|
+
parse_mode: str | None = None,
|
|
277
|
+
caption_entities: list[MessageEntity] | None = None,
|
|
278
|
+
reply_markup: InlineKeyboardMarkup | None = None,
|
|
279
|
+
input_message_content: InputMessageContent | None = None,
|
|
280
|
+
thumbnail_url: str | None = None,
|
|
281
|
+
thumbnail_mime_type: str | None = None,
|
|
282
|
+
) -> InlineQueryResultGif:
|
|
283
|
+
return InlineQueryResultGif(type="gif", **get_params(locals()))
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
def inline_query_location(
|
|
287
|
+
id: str,
|
|
288
|
+
latitude: float,
|
|
289
|
+
longitude: float,
|
|
290
|
+
*,
|
|
291
|
+
title: str | None = None,
|
|
292
|
+
horizontal_accuracy: float | None = None,
|
|
293
|
+
live_period: int | None = None,
|
|
294
|
+
heading: int | None = None,
|
|
295
|
+
proximity_alert_radius: int | None = None,
|
|
296
|
+
reply_markup: InlineKeyboardMarkup | None = None,
|
|
297
|
+
input_message_content: InputMessageContent | None = None,
|
|
298
|
+
thumbnail_url: str | None = None,
|
|
299
|
+
thumbnail_width: int | None = None,
|
|
300
|
+
thumbnail_height: int | None = None,
|
|
301
|
+
) -> InlineQueryResultLocation:
|
|
302
|
+
return InlineQueryResultLocation(type="location", **get_params(locals()))
|
|
303
|
+
|
|
304
|
+
|
|
305
|
+
def inline_query_venue(
|
|
306
|
+
id: str,
|
|
307
|
+
latitude: float,
|
|
308
|
+
longitude: float,
|
|
309
|
+
title: str,
|
|
310
|
+
address: str,
|
|
311
|
+
*,
|
|
312
|
+
foursquare_id: str | None = None,
|
|
313
|
+
foursquare_type: str | None = None,
|
|
314
|
+
google_place_id: str | None = None,
|
|
315
|
+
google_place_type: str | None = None,
|
|
316
|
+
reply_markup: InlineKeyboardMarkup | None = None,
|
|
317
|
+
input_message_content: InputMessageContent | None = None,
|
|
318
|
+
thumbnail_url: str | None = None,
|
|
319
|
+
thumbnail_width: int | None = None,
|
|
320
|
+
thumbnail_height: int | None = None,
|
|
321
|
+
) -> InlineQueryResultVenue:
|
|
322
|
+
return InlineQueryResultVenue(type="venue", **get_params(locals()))
|
|
323
|
+
|
|
324
|
+
|
|
325
|
+
def inline_query_video(
|
|
326
|
+
id: str,
|
|
327
|
+
video_url: str,
|
|
328
|
+
mime_type: str,
|
|
329
|
+
thumb_url: str,
|
|
330
|
+
*,
|
|
331
|
+
title: str | None = None,
|
|
332
|
+
caption: str | None = None,
|
|
333
|
+
parse_mode: str | None = None,
|
|
334
|
+
caption_entities: list[MessageEntity] | None = None,
|
|
335
|
+
video_width: int | None = None,
|
|
336
|
+
video_height: int | None = None,
|
|
337
|
+
video_duration: int | None = None,
|
|
338
|
+
description: str | None = None,
|
|
339
|
+
reply_markup: InlineKeyboardMarkup | None = None,
|
|
340
|
+
input_message_content: InputMessageContent | None = None,
|
|
341
|
+
thumbnail_url: str | None = None,
|
|
342
|
+
thumbnail_width: int | None = None,
|
|
343
|
+
thumbnail_height: int | None = None,
|
|
344
|
+
) -> InlineQueryResultVideo:
|
|
345
|
+
return InlineQueryResultVideo(type="video", **get_params(locals()))
|
|
346
|
+
|
|
347
|
+
|
|
348
|
+
def inline_query_game(
|
|
349
|
+
id: str,
|
|
350
|
+
game_short_name: str,
|
|
351
|
+
*,
|
|
352
|
+
reply_markup: InlineKeyboardMarkup | None = None,
|
|
353
|
+
) -> InlineQueryResultGame:
|
|
354
|
+
return InlineQueryResultGame(type="game", **get_params(locals()))
|
|
355
|
+
|
|
356
|
+
|
|
357
|
+
def inline_query_voice(
|
|
358
|
+
id: str,
|
|
359
|
+
voice_url: str,
|
|
360
|
+
title: str,
|
|
361
|
+
*,
|
|
362
|
+
caption: str | None = None,
|
|
363
|
+
parse_mode: str | None = None,
|
|
364
|
+
caption_entities: list[MessageEntity] | None = None,
|
|
365
|
+
reply_markup: InlineKeyboardMarkup | None = None,
|
|
366
|
+
input_message_content: InputMessageContent | None = None,
|
|
367
|
+
duration: int | None = None,
|
|
368
|
+
) -> InlineQueryResultVoice:
|
|
369
|
+
return InlineQueryResultVoice(type="voice", **get_params(locals()))
|
|
370
|
+
|
|
371
|
+
|
|
372
|
+
def inline_query_photo(
|
|
373
|
+
id: str,
|
|
374
|
+
photo_url: str,
|
|
375
|
+
thumb_url: str,
|
|
376
|
+
*,
|
|
377
|
+
photo_width: int | None = None,
|
|
378
|
+
photo_height: int | None = None,
|
|
379
|
+
title: str | None = None,
|
|
380
|
+
description: str | None = None,
|
|
381
|
+
caption: str | None = None,
|
|
382
|
+
parse_mode: str | None = None,
|
|
383
|
+
caption_entities: list[MessageEntity] | None = None,
|
|
384
|
+
reply_markup: InlineKeyboardMarkup | None = None,
|
|
385
|
+
input_message_content: InputMessageContent | None = None,
|
|
386
|
+
) -> InlineQueryResultPhoto:
|
|
387
|
+
return InlineQueryResultPhoto(type="photo", **get_params(locals()))
|
|
388
|
+
|
|
389
|
+
|
|
390
|
+
def inline_query_mpeg4_gif(
|
|
391
|
+
id: str,
|
|
392
|
+
mpeg4_url: str,
|
|
393
|
+
*,
|
|
394
|
+
mpeg4_width: int | None = None,
|
|
395
|
+
mpeg4_height: int | None = None,
|
|
396
|
+
mpeg4_duration: int | None = None,
|
|
397
|
+
thumb_url: str | None = None,
|
|
398
|
+
reply_markup: InlineKeyboardMarkup | None = None,
|
|
399
|
+
input_message_content: InputMessageContent | None = None,
|
|
400
|
+
) -> InlineQueryResultMpeg4Gif:
|
|
401
|
+
return InlineQueryResultMpeg4Gif(type="mpeg4_gif", **get_params(locals()))
|
|
402
|
+
|
|
403
|
+
|
|
404
|
+
def inline_query_cached_sticker(
|
|
405
|
+
id: str,
|
|
406
|
+
sticker_file_id: str,
|
|
407
|
+
*,
|
|
408
|
+
reply_markup: InlineKeyboardMarkup | None = None,
|
|
409
|
+
) -> InlineQueryResultCachedSticker:
|
|
410
|
+
return InlineQueryResultCachedSticker(type="sticker", **get_params(locals()))
|
|
411
|
+
|
|
412
|
+
|
|
413
|
+
def inline_query_cached_document(
|
|
414
|
+
id: str,
|
|
415
|
+
document_file_id: str,
|
|
416
|
+
*,
|
|
417
|
+
title: str | None = None,
|
|
418
|
+
description: str | None = None,
|
|
419
|
+
caption: str | None = None,
|
|
420
|
+
parse_mode: str | None = None,
|
|
421
|
+
caption_entities: list[MessageEntity] | None = None,
|
|
422
|
+
reply_markup: InlineKeyboardMarkup | None = None,
|
|
423
|
+
input_message_content: InputMessageContent | None = None,
|
|
424
|
+
) -> InlineQueryResultCachedDocument:
|
|
425
|
+
return InlineQueryResultCachedDocument(type="document", **get_params(locals()))
|
|
426
|
+
|
|
427
|
+
|
|
428
|
+
def inline_query_cached_audio(
|
|
429
|
+
id: str,
|
|
430
|
+
audio_file_id: str,
|
|
431
|
+
*,
|
|
432
|
+
caption: str | None = None,
|
|
433
|
+
parse_mode: str | None = None,
|
|
434
|
+
caption_entities: list[MessageEntity] | None = None,
|
|
435
|
+
reply_markup: InlineKeyboardMarkup | None = None,
|
|
436
|
+
input_message_content: InputMessageContent | None = None,
|
|
437
|
+
) -> InlineQueryResultCachedAudio:
|
|
438
|
+
return InlineQueryResultCachedAudio(type="audio", **get_params(locals()))
|
|
439
|
+
|
|
440
|
+
|
|
441
|
+
def inline_query_cached_video(
|
|
442
|
+
id: str,
|
|
443
|
+
video_file_id: str,
|
|
444
|
+
*,
|
|
445
|
+
title: str | None = None,
|
|
446
|
+
description: str | None = None,
|
|
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
|
+
) -> InlineQueryResultCachedVideo:
|
|
453
|
+
return InlineQueryResultCachedVideo(type="video", **get_params(locals()))
|
|
454
|
+
|
|
455
|
+
|
|
456
|
+
def inline_query_cached_gif(
|
|
457
|
+
id: str,
|
|
458
|
+
gif_file_id: str,
|
|
459
|
+
*,
|
|
460
|
+
title: str | None = None,
|
|
461
|
+
caption: str | None = None,
|
|
462
|
+
parse_mode: str | None = None,
|
|
463
|
+
caption_entities: list[MessageEntity] | None = None,
|
|
464
|
+
reply_markup: InlineKeyboardMarkup | None = None,
|
|
465
|
+
input_message_content: InputMessageContent | None = None,
|
|
466
|
+
) -> InlineQueryResultCachedGif:
|
|
467
|
+
return InlineQueryResultCachedGif(type="gif", **get_params(locals()))
|
|
468
|
+
|
|
469
|
+
|
|
470
|
+
def inline_query_cached_mpeg4_gif(
|
|
471
|
+
id: str,
|
|
472
|
+
mpeg4_file_id: str,
|
|
473
|
+
*,
|
|
474
|
+
title: str | None = None,
|
|
475
|
+
caption: str | None = None,
|
|
476
|
+
parse_mode: str | None = None,
|
|
477
|
+
caption_entities: list[MessageEntity] | None = None,
|
|
478
|
+
reply_markup: InlineKeyboardMarkup | None = None,
|
|
479
|
+
input_message_content: InputMessageContent | None = None,
|
|
480
|
+
) -> InlineQueryResultCachedMpeg4Gif:
|
|
481
|
+
return InlineQueryResultCachedMpeg4Gif(type="mpeg4_gif", **get_params(locals()))
|
|
482
|
+
|
|
483
|
+
|
|
484
|
+
def inline_query_cached_voice(
|
|
485
|
+
id: str,
|
|
486
|
+
voice_file_id: str,
|
|
487
|
+
*,
|
|
488
|
+
caption: str | None = None,
|
|
489
|
+
parse_mode: str | None = None,
|
|
490
|
+
caption_entities: list[MessageEntity] | None = None,
|
|
491
|
+
reply_markup: InlineKeyboardMarkup | None = None,
|
|
492
|
+
input_message_content: InputMessageContent | None = None,
|
|
493
|
+
) -> InlineQueryResultCachedVoice:
|
|
494
|
+
return InlineQueryResultCachedVoice(type="voice", **get_params(locals()))
|
|
495
|
+
|
|
496
|
+
|
|
497
|
+
def inline_query_cached_photo(
|
|
498
|
+
id: str,
|
|
499
|
+
photo_file_id: str,
|
|
500
|
+
*,
|
|
501
|
+
title: str | None = None,
|
|
502
|
+
description: str | None = None,
|
|
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
|
+
) -> InlineQueryResultCachedPhoto:
|
|
509
|
+
return InlineQueryResultCachedPhoto(type="photo", **get_params(locals()))
|
|
510
|
+
|
|
511
|
+
|
|
512
|
+
__all__ = (
|
|
513
|
+
"compose_link_preview_options",
|
|
514
|
+
"compose_reactions",
|
|
515
|
+
"compose_reply_params",
|
|
516
|
+
"inline_query_article",
|
|
517
|
+
"inline_query_photo",
|
|
518
|
+
"inline_query_mpeg4_gif",
|
|
519
|
+
"inline_query_gif",
|
|
520
|
+
"inline_query_video",
|
|
521
|
+
"inline_query_audio",
|
|
522
|
+
"inline_query_voice",
|
|
523
|
+
"inline_query_document",
|
|
524
|
+
"inline_query_location",
|
|
525
|
+
"inline_query_venue",
|
|
526
|
+
"inline_query_contact",
|
|
527
|
+
"inline_query_game",
|
|
528
|
+
"inline_query_cached_sticker",
|
|
529
|
+
"inline_query_cached_document",
|
|
530
|
+
"inline_query_cached_audio",
|
|
531
|
+
"inline_query_cached_video",
|
|
532
|
+
"inline_query_cached_gif",
|
|
533
|
+
"inline_query_cached_mpeg4_gif",
|
|
534
|
+
"inline_query_cached_voice",
|
|
535
|
+
"inline_query_cached_photo",
|
|
536
|
+
"input_media",
|
|
537
|
+
"input_text_message_content",
|
|
538
|
+
"input_location_message_content",
|
|
539
|
+
"input_venue_message_content",
|
|
540
|
+
"input_contact_message_content",
|
|
541
|
+
"input_invoice_message_content",
|
|
542
|
+
)
|
|
File without changes
|
telegrinder/bot/dispatch/abc.py
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -36,7 +36,7 @@ class FuncHandler(ABCHandler[EventT], typing.Generic[EventT, F, ErrorHandlerT]):
|
|
|
36
36
|
|
|
37
37
|
@property
|
|
38
38
|
def on_error(self):
|
|
39
|
-
return self.error_handler.
|
|
39
|
+
return self.error_handler.register_catcher
|
|
40
40
|
|
|
41
41
|
async def check(self, api: ABCAPI, event: Update, ctx: Context | None = None) -> bool:
|
|
42
42
|
ctx = ctx or Context()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|