telegrinder 0.3.4.post1__py3-none-any.whl → 0.4.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 +30 -31
- telegrinder/api/__init__.py +2 -1
- telegrinder/api/api.py +28 -20
- telegrinder/api/error.py +8 -4
- telegrinder/api/response.py +2 -2
- telegrinder/api/token.py +2 -2
- telegrinder/bot/__init__.py +6 -0
- telegrinder/bot/bot.py +38 -31
- telegrinder/bot/cute_types/__init__.py +2 -0
- telegrinder/bot/cute_types/base.py +54 -128
- telegrinder/bot/cute_types/callback_query.py +76 -61
- telegrinder/bot/cute_types/chat_join_request.py +4 -3
- telegrinder/bot/cute_types/chat_member_updated.py +28 -31
- telegrinder/bot/cute_types/inline_query.py +5 -4
- telegrinder/bot/cute_types/message.py +555 -602
- telegrinder/bot/cute_types/pre_checkout_query.py +42 -0
- telegrinder/bot/cute_types/update.py +20 -12
- telegrinder/bot/cute_types/utils.py +3 -36
- telegrinder/bot/dispatch/__init__.py +4 -0
- telegrinder/bot/dispatch/abc.py +8 -9
- telegrinder/bot/dispatch/context.py +5 -7
- telegrinder/bot/dispatch/dispatch.py +85 -33
- telegrinder/bot/dispatch/handler/abc.py +5 -6
- telegrinder/bot/dispatch/handler/audio_reply.py +2 -2
- telegrinder/bot/dispatch/handler/base.py +3 -3
- telegrinder/bot/dispatch/handler/document_reply.py +2 -2
- telegrinder/bot/dispatch/handler/func.py +36 -42
- telegrinder/bot/dispatch/handler/media_group_reply.py +5 -4
- telegrinder/bot/dispatch/handler/message_reply.py +2 -2
- telegrinder/bot/dispatch/handler/photo_reply.py +2 -2
- telegrinder/bot/dispatch/handler/sticker_reply.py +2 -2
- telegrinder/bot/dispatch/handler/video_reply.py +2 -2
- telegrinder/bot/dispatch/middleware/abc.py +83 -8
- telegrinder/bot/dispatch/middleware/global_middleware.py +70 -0
- telegrinder/bot/dispatch/process.py +44 -50
- telegrinder/bot/dispatch/return_manager/__init__.py +2 -0
- telegrinder/bot/dispatch/return_manager/abc.py +6 -10
- telegrinder/bot/dispatch/return_manager/pre_checkout_query.py +20 -0
- telegrinder/bot/dispatch/view/__init__.py +2 -0
- telegrinder/bot/dispatch/view/abc.py +10 -6
- telegrinder/bot/dispatch/view/base.py +81 -50
- telegrinder/bot/dispatch/view/box.py +20 -9
- telegrinder/bot/dispatch/view/callback_query.py +3 -4
- telegrinder/bot/dispatch/view/chat_join_request.py +2 -7
- telegrinder/bot/dispatch/view/chat_member.py +3 -5
- telegrinder/bot/dispatch/view/inline_query.py +3 -4
- telegrinder/bot/dispatch/view/message.py +3 -4
- telegrinder/bot/dispatch/view/pre_checkout_query.py +16 -0
- telegrinder/bot/dispatch/view/raw.py +42 -40
- telegrinder/bot/dispatch/waiter_machine/actions.py +5 -4
- telegrinder/bot/dispatch/waiter_machine/hasher/__init__.py +0 -0
- telegrinder/bot/dispatch/waiter_machine/hasher/callback.py +0 -0
- telegrinder/bot/dispatch/waiter_machine/hasher/hasher.py +9 -7
- telegrinder/bot/dispatch/waiter_machine/hasher/message.py +0 -0
- telegrinder/bot/dispatch/waiter_machine/hasher/state.py +3 -2
- telegrinder/bot/dispatch/waiter_machine/machine.py +113 -34
- telegrinder/bot/dispatch/waiter_machine/middleware.py +15 -10
- telegrinder/bot/dispatch/waiter_machine/short_state.py +7 -18
- telegrinder/bot/polling/polling.py +62 -54
- telegrinder/bot/rules/__init__.py +24 -1
- telegrinder/bot/rules/abc.py +17 -10
- telegrinder/bot/rules/callback_data.py +20 -61
- telegrinder/bot/rules/chat_join.py +6 -4
- telegrinder/bot/rules/command.py +4 -4
- telegrinder/bot/rules/enum_text.py +1 -4
- telegrinder/bot/rules/func.py +5 -3
- telegrinder/bot/rules/fuzzy.py +1 -1
- telegrinder/bot/rules/id.py +24 -0
- telegrinder/bot/rules/inline.py +6 -4
- telegrinder/bot/rules/integer.py +2 -1
- telegrinder/bot/rules/logic.py +18 -0
- telegrinder/bot/rules/markup.py +5 -6
- telegrinder/bot/rules/message.py +2 -4
- telegrinder/bot/rules/message_entities.py +1 -3
- telegrinder/bot/rules/node.py +15 -9
- telegrinder/bot/rules/payload.py +81 -0
- telegrinder/bot/rules/payment_invoice.py +29 -0
- telegrinder/bot/rules/regex.py +5 -6
- telegrinder/bot/rules/state.py +1 -3
- telegrinder/bot/rules/text.py +10 -5
- telegrinder/bot/rules/update.py +0 -0
- telegrinder/bot/scenario/abc.py +2 -4
- telegrinder/bot/scenario/checkbox.py +12 -14
- telegrinder/bot/scenario/choice.py +6 -9
- telegrinder/client/__init__.py +9 -1
- telegrinder/client/abc.py +35 -10
- telegrinder/client/aiohttp.py +28 -24
- telegrinder/client/form_data.py +31 -0
- telegrinder/client/sonic.py +212 -0
- telegrinder/model.py +38 -145
- telegrinder/modules.py +3 -1
- telegrinder/msgspec_utils.py +136 -68
- telegrinder/node/__init__.py +74 -13
- telegrinder/node/attachment.py +92 -16
- telegrinder/node/base.py +196 -68
- telegrinder/node/callback_query.py +17 -16
- telegrinder/node/command.py +3 -2
- telegrinder/node/composer.py +40 -75
- telegrinder/node/container.py +13 -7
- telegrinder/node/either.py +82 -0
- telegrinder/node/event.py +20 -31
- telegrinder/node/file.py +51 -0
- telegrinder/node/me.py +4 -5
- telegrinder/node/payload.py +78 -0
- telegrinder/node/polymorphic.py +27 -8
- telegrinder/node/rule.py +2 -6
- telegrinder/node/scope.py +4 -6
- telegrinder/node/source.py +37 -21
- telegrinder/node/text.py +20 -8
- telegrinder/node/tools/generator.py +7 -11
- telegrinder/py.typed +0 -0
- telegrinder/rules.py +0 -61
- telegrinder/tools/__init__.py +97 -38
- telegrinder/tools/adapter/__init__.py +19 -0
- telegrinder/tools/adapter/abc.py +49 -0
- telegrinder/tools/adapter/dataclass.py +56 -0
- telegrinder/{bot/rules → tools}/adapter/event.py +8 -10
- telegrinder/{bot/rules → tools}/adapter/node.py +8 -10
- telegrinder/{bot/rules → tools}/adapter/raw_event.py +2 -2
- telegrinder/{bot/rules → tools}/adapter/raw_update.py +2 -2
- telegrinder/tools/buttons.py +52 -26
- telegrinder/tools/callback_data_serilization/__init__.py +5 -0
- telegrinder/tools/callback_data_serilization/abc.py +51 -0
- telegrinder/tools/callback_data_serilization/json_ser.py +60 -0
- telegrinder/tools/callback_data_serilization/msgpack_ser.py +172 -0
- telegrinder/tools/error_handler/abc.py +4 -7
- telegrinder/tools/error_handler/error.py +0 -0
- telegrinder/tools/error_handler/error_handler.py +34 -48
- telegrinder/tools/formatting/__init__.py +57 -37
- telegrinder/tools/formatting/deep_links.py +541 -0
- telegrinder/tools/formatting/{html.py → html_formatter.py} +51 -79
- telegrinder/tools/formatting/spec_html_formats.py +14 -60
- telegrinder/tools/functional.py +1 -5
- telegrinder/tools/global_context/global_context.py +26 -51
- telegrinder/tools/global_context/telegrinder_ctx.py +3 -3
- telegrinder/tools/i18n/abc.py +0 -0
- telegrinder/tools/i18n/middleware/abc.py +3 -6
- telegrinder/tools/input_file_directory.py +30 -0
- telegrinder/tools/keyboard.py +9 -9
- telegrinder/tools/lifespan.py +105 -0
- telegrinder/tools/limited_dict.py +5 -10
- telegrinder/tools/loop_wrapper/abc.py +7 -2
- telegrinder/tools/loop_wrapper/loop_wrapper.py +40 -95
- telegrinder/tools/magic.py +184 -34
- telegrinder/tools/state_storage/__init__.py +0 -0
- telegrinder/tools/state_storage/abc.py +5 -9
- telegrinder/tools/state_storage/memory.py +1 -1
- telegrinder/tools/strings.py +13 -0
- telegrinder/types/__init__.py +8 -0
- telegrinder/types/enums.py +31 -21
- telegrinder/types/input_file.py +51 -0
- telegrinder/types/methods.py +531 -109
- telegrinder/types/objects.py +934 -826
- telegrinder/verification_utils.py +0 -2
- {telegrinder-0.3.4.post1.dist-info → telegrinder-0.4.0.dist-info}/LICENSE +2 -2
- telegrinder-0.4.0.dist-info/METADATA +144 -0
- telegrinder-0.4.0.dist-info/RECORD +182 -0
- {telegrinder-0.3.4.post1.dist-info → telegrinder-0.4.0.dist-info}/WHEEL +1 -1
- telegrinder/bot/rules/adapter/__init__.py +0 -17
- telegrinder/bot/rules/adapter/abc.py +0 -31
- telegrinder/node/message.py +0 -14
- telegrinder/node/update.py +0 -15
- telegrinder/tools/formatting/links.py +0 -38
- telegrinder/tools/kb_set/__init__.py +0 -4
- telegrinder/tools/kb_set/base.py +0 -15
- telegrinder/tools/kb_set/yaml.py +0 -63
- telegrinder-0.3.4.post1.dist-info/METADATA +0 -110
- telegrinder-0.3.4.post1.dist-info/RECORD +0 -165
- /telegrinder/{bot/rules → tools}/adapter/errors.py +0 -0
telegrinder/types/methods.py
CHANGED
|
@@ -9,11 +9,12 @@ from telegrinder.types.enums import * # noqa: F403
|
|
|
9
9
|
from telegrinder.types.objects import * # noqa: F403
|
|
10
10
|
|
|
11
11
|
if typing.TYPE_CHECKING:
|
|
12
|
-
from telegrinder.api import API
|
|
12
|
+
from telegrinder.api.api import API
|
|
13
|
+
from telegrinder.client.abc import ABCClient
|
|
13
14
|
|
|
14
15
|
|
|
15
|
-
class APIMethods:
|
|
16
|
-
"""Telegram Bot API methods version
|
|
16
|
+
class APIMethods[HTTPClient: ABCClient]:
|
|
17
|
+
"""Telegram Bot API methods version 8.3, released `February 12, 2025`."""
|
|
17
18
|
|
|
18
19
|
default_params = ProxiedDict(
|
|
19
20
|
typing.TypedDict(
|
|
@@ -21,11 +22,12 @@ class APIMethods:
|
|
|
21
22
|
)
|
|
22
23
|
)
|
|
23
24
|
|
|
24
|
-
def __init__(self, api: "API") -> None:
|
|
25
|
+
def __init__(self, api: "API[HTTPClient]") -> None:
|
|
25
26
|
self.api = api
|
|
26
27
|
|
|
27
28
|
async def get_updates(
|
|
28
29
|
self,
|
|
30
|
+
*,
|
|
29
31
|
offset: int | None = None,
|
|
30
32
|
limit: int | None = None,
|
|
31
33
|
timeout: int | None = None,
|
|
@@ -58,8 +60,8 @@ class APIMethods:
|
|
|
58
60
|
except chat_member, message_reaction, and message_reaction_count \
|
|
59
61
|
(default). If not specified, the previous setting will be used. Please \
|
|
60
62
|
note that this parameter doesn't affect updates created before the call \
|
|
61
|
-
to
|
|
62
|
-
|
|
63
|
+
to getUpdates, so unwanted updates may be received for a short period of \
|
|
64
|
+
time.
|
|
63
65
|
"""
|
|
64
66
|
|
|
65
67
|
method_response = await self.api.request_raw(
|
|
@@ -70,6 +72,7 @@ class APIMethods:
|
|
|
70
72
|
|
|
71
73
|
async def set_webhook(
|
|
72
74
|
self,
|
|
75
|
+
*,
|
|
73
76
|
url: str,
|
|
74
77
|
certificate: InputFile | None = None,
|
|
75
78
|
ip_address: str | None = None,
|
|
@@ -84,9 +87,10 @@ class APIMethods:
|
|
|
84
87
|
Use this method to specify a URL and receive incoming updates via an outgoing
|
|
85
88
|
webhook. Whenever there is an update for the bot, we will send an HTTPS POST
|
|
86
89
|
request to the specified URL, containing a JSON-serialized Update. In
|
|
87
|
-
case of an unsuccessful request
|
|
88
|
-
|
|
89
|
-
|
|
90
|
+
case of an unsuccessful request (a request with response HTTP status code
|
|
91
|
+
different from 2XY), we will repeat the request and give up after a reasonable
|
|
92
|
+
amount of attempts. Returns True on success. If you'd like to make sure that
|
|
93
|
+
the webhook was set by you, you can specify secret data in the parameter secret_token.
|
|
90
94
|
If specified, the request will contain a header "X-Telegram-Bot-Api-Secret-Token"
|
|
91
95
|
with the secret token as content.
|
|
92
96
|
|
|
@@ -128,6 +132,7 @@ class APIMethods:
|
|
|
128
132
|
|
|
129
133
|
async def delete_webhook(
|
|
130
134
|
self,
|
|
135
|
+
*,
|
|
131
136
|
drop_pending_updates: bool | None = None,
|
|
132
137
|
**other: typing.Any,
|
|
133
138
|
) -> Result[bool, APIError]:
|
|
@@ -208,6 +213,7 @@ class APIMethods:
|
|
|
208
213
|
|
|
209
214
|
async def send_message(
|
|
210
215
|
self,
|
|
216
|
+
*,
|
|
211
217
|
chat_id: int | str,
|
|
212
218
|
text: str,
|
|
213
219
|
business_connection_id: str | None = None,
|
|
@@ -217,13 +223,10 @@ class APIMethods:
|
|
|
217
223
|
link_preview_options: LinkPreviewOptions | None = None,
|
|
218
224
|
disable_notification: bool | None = None,
|
|
219
225
|
protect_content: bool | None = None,
|
|
226
|
+
allow_paid_broadcast: bool | None = None,
|
|
220
227
|
message_effect_id: str | None = None,
|
|
221
228
|
reply_parameters: ReplyParameters | None = None,
|
|
222
|
-
reply_markup: InlineKeyboardMarkup
|
|
223
|
-
| ReplyKeyboardMarkup
|
|
224
|
-
| ReplyKeyboardRemove
|
|
225
|
-
| ForceReply
|
|
226
|
-
| None = None,
|
|
229
|
+
reply_markup: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply | None = None,
|
|
227
230
|
**other: typing.Any,
|
|
228
231
|
) -> Result[Message, APIError]:
|
|
229
232
|
"""Method `sendMessage`, see the [documentation](https://core.telegram.org/bots/api#sendmessage)
|
|
@@ -253,6 +256,10 @@ class APIMethods:
|
|
|
253
256
|
|
|
254
257
|
:param protect_content: Protects the contents of the sent message from forwarding and saving.
|
|
255
258
|
|
|
259
|
+
:param allow_paid_broadcast: Pass True to allow up to 1000 messages per second, ignoring broadcasting \
|
|
260
|
+
limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will \
|
|
261
|
+
be withdrawn from the bot's balance.
|
|
262
|
+
|
|
256
263
|
:param message_effect_id: Unique identifier of the message effect to be added to the message; for private \
|
|
257
264
|
chats only.
|
|
258
265
|
|
|
@@ -271,10 +278,12 @@ class APIMethods:
|
|
|
271
278
|
|
|
272
279
|
async def forward_message(
|
|
273
280
|
self,
|
|
281
|
+
*,
|
|
274
282
|
chat_id: int | str,
|
|
275
283
|
from_chat_id: int | str,
|
|
276
284
|
message_id: int,
|
|
277
285
|
message_thread_id: int | None = None,
|
|
286
|
+
video_start_timestamp: int | None = None,
|
|
278
287
|
disable_notification: bool | None = None,
|
|
279
288
|
protect_content: bool | None = None,
|
|
280
289
|
**other: typing.Any,
|
|
@@ -294,6 +303,8 @@ class APIMethods:
|
|
|
294
303
|
:param from_chat_id: Unique identifier for the chat where the original message was sent (or channel \
|
|
295
304
|
username in the format @channelusername).
|
|
296
305
|
|
|
306
|
+
:param video_start_timestamp: New start timestamp for the forwarded video in the message.
|
|
307
|
+
|
|
297
308
|
:param disable_notification: Sends the message silently. Users will receive a notification with no sound. \
|
|
298
309
|
|
|
299
310
|
:param protect_content: Protects the contents of the forwarded message from forwarding and saving. \
|
|
@@ -309,6 +320,7 @@ class APIMethods:
|
|
|
309
320
|
|
|
310
321
|
async def forward_messages(
|
|
311
322
|
self,
|
|
323
|
+
*,
|
|
312
324
|
chat_id: int | str,
|
|
313
325
|
from_chat_id: int | str,
|
|
314
326
|
message_ids: list[int],
|
|
@@ -352,22 +364,21 @@ class APIMethods:
|
|
|
352
364
|
|
|
353
365
|
async def copy_message(
|
|
354
366
|
self,
|
|
367
|
+
*,
|
|
355
368
|
chat_id: int | str,
|
|
356
369
|
from_chat_id: int | str,
|
|
357
370
|
message_id: int,
|
|
358
371
|
message_thread_id: int | None = None,
|
|
372
|
+
video_start_timestamp: int | None = None,
|
|
359
373
|
caption: str | None = None,
|
|
360
374
|
parse_mode: str | None = default_params["parse_mode"],
|
|
361
375
|
caption_entities: list[MessageEntity] | None = None,
|
|
362
376
|
show_caption_above_media: bool | None = None,
|
|
363
377
|
disable_notification: bool | None = None,
|
|
364
378
|
protect_content: bool | None = None,
|
|
379
|
+
allow_paid_broadcast: bool | None = None,
|
|
365
380
|
reply_parameters: ReplyParameters | None = None,
|
|
366
|
-
reply_markup: InlineKeyboardMarkup
|
|
367
|
-
| ReplyKeyboardMarkup
|
|
368
|
-
| ReplyKeyboardRemove
|
|
369
|
-
| ForceReply
|
|
370
|
-
| None = None,
|
|
381
|
+
reply_markup: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply | None = None,
|
|
371
382
|
**other: typing.Any,
|
|
372
383
|
) -> Result[MessageId, APIError]:
|
|
373
384
|
"""Method `copyMessage`, see the [documentation](https://core.telegram.org/bots/api#copymessage)
|
|
@@ -390,6 +401,8 @@ class APIMethods:
|
|
|
390
401
|
|
|
391
402
|
:param message_id: Message identifier in the chat specified in from_chat_id.
|
|
392
403
|
|
|
404
|
+
:param video_start_timestamp: New start timestamp for the copied video in the message.
|
|
405
|
+
|
|
393
406
|
:param caption: New caption for media, 0-1024 characters after entities parsing. If not \
|
|
394
407
|
specified, the original caption is kept.
|
|
395
408
|
|
|
@@ -406,6 +419,10 @@ class APIMethods:
|
|
|
406
419
|
|
|
407
420
|
:param protect_content: Protects the contents of the sent message from forwarding and saving.
|
|
408
421
|
|
|
422
|
+
:param allow_paid_broadcast: Pass True to allow up to 1000 messages per second, ignoring broadcasting \
|
|
423
|
+
limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will \
|
|
424
|
+
be withdrawn from the bot's balance.
|
|
425
|
+
|
|
409
426
|
:param reply_parameters: Description of the message to reply to.
|
|
410
427
|
|
|
411
428
|
:param reply_markup: Additional interface options. A JSON-serialized object for an inline \
|
|
@@ -421,6 +438,7 @@ class APIMethods:
|
|
|
421
438
|
|
|
422
439
|
async def copy_messages(
|
|
423
440
|
self,
|
|
441
|
+
*,
|
|
424
442
|
chat_id: int | str,
|
|
425
443
|
from_chat_id: int | str,
|
|
426
444
|
message_ids: list[int],
|
|
@@ -469,6 +487,7 @@ class APIMethods:
|
|
|
469
487
|
|
|
470
488
|
async def send_photo(
|
|
471
489
|
self,
|
|
490
|
+
*,
|
|
472
491
|
chat_id: int | str,
|
|
473
492
|
photo: InputFile | str,
|
|
474
493
|
business_connection_id: str | None = None,
|
|
@@ -480,13 +499,10 @@ class APIMethods:
|
|
|
480
499
|
has_spoiler: bool | None = None,
|
|
481
500
|
disable_notification: bool | None = None,
|
|
482
501
|
protect_content: bool | None = None,
|
|
502
|
+
allow_paid_broadcast: bool | None = None,
|
|
483
503
|
message_effect_id: str | None = None,
|
|
484
504
|
reply_parameters: ReplyParameters | None = None,
|
|
485
|
-
reply_markup: InlineKeyboardMarkup
|
|
486
|
-
| ReplyKeyboardMarkup
|
|
487
|
-
| ReplyKeyboardRemove
|
|
488
|
-
| ForceReply
|
|
489
|
-
| None = None,
|
|
505
|
+
reply_markup: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply | None = None,
|
|
490
506
|
**other: typing.Any,
|
|
491
507
|
) -> Result[Message, APIError]:
|
|
492
508
|
"""Method `sendPhoto`, see the [documentation](https://core.telegram.org/bots/api#sendphoto)
|
|
@@ -526,6 +542,10 @@ class APIMethods:
|
|
|
526
542
|
|
|
527
543
|
:param protect_content: Protects the contents of the sent message from forwarding and saving.
|
|
528
544
|
|
|
545
|
+
:param allow_paid_broadcast: Pass True to allow up to 1000 messages per second, ignoring broadcasting \
|
|
546
|
+
limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will \
|
|
547
|
+
be withdrawn from the bot's balance.
|
|
548
|
+
|
|
529
549
|
:param message_effect_id: Unique identifier of the message effect to be added to the message; for private \
|
|
530
550
|
chats only.
|
|
531
551
|
|
|
@@ -544,6 +564,7 @@ class APIMethods:
|
|
|
544
564
|
|
|
545
565
|
async def send_audio(
|
|
546
566
|
self,
|
|
567
|
+
*,
|
|
547
568
|
chat_id: int | str,
|
|
548
569
|
audio: InputFile | str,
|
|
549
570
|
business_connection_id: str | None = None,
|
|
@@ -557,13 +578,10 @@ class APIMethods:
|
|
|
557
578
|
thumbnail: InputFile | str | None = None,
|
|
558
579
|
disable_notification: bool | None = None,
|
|
559
580
|
protect_content: bool | None = None,
|
|
581
|
+
allow_paid_broadcast: bool | None = None,
|
|
560
582
|
message_effect_id: str | None = None,
|
|
561
583
|
reply_parameters: ReplyParameters | None = None,
|
|
562
|
-
reply_markup: InlineKeyboardMarkup
|
|
563
|
-
| ReplyKeyboardMarkup
|
|
564
|
-
| ReplyKeyboardRemove
|
|
565
|
-
| ForceReply
|
|
566
|
-
| None = None,
|
|
584
|
+
reply_markup: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply | None = None,
|
|
567
585
|
**other: typing.Any,
|
|
568
586
|
) -> Result[Message, APIError]:
|
|
569
587
|
"""Method `sendAudio`, see the [documentation](https://core.telegram.org/bots/api#sendaudio)
|
|
@@ -614,6 +632,10 @@ class APIMethods:
|
|
|
614
632
|
|
|
615
633
|
:param protect_content: Protects the contents of the sent message from forwarding and saving.
|
|
616
634
|
|
|
635
|
+
:param allow_paid_broadcast: Pass True to allow up to 1000 messages per second, ignoring broadcasting \
|
|
636
|
+
limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will \
|
|
637
|
+
be withdrawn from the bot's balance.
|
|
638
|
+
|
|
617
639
|
:param message_effect_id: Unique identifier of the message effect to be added to the message; for private \
|
|
618
640
|
chats only.
|
|
619
641
|
|
|
@@ -632,6 +654,7 @@ class APIMethods:
|
|
|
632
654
|
|
|
633
655
|
async def send_document(
|
|
634
656
|
self,
|
|
657
|
+
*,
|
|
635
658
|
chat_id: int | str,
|
|
636
659
|
document: InputFile | str,
|
|
637
660
|
business_connection_id: str | None = None,
|
|
@@ -643,13 +666,10 @@ class APIMethods:
|
|
|
643
666
|
disable_content_type_detection: bool | None = None,
|
|
644
667
|
disable_notification: bool | None = None,
|
|
645
668
|
protect_content: bool | None = None,
|
|
669
|
+
allow_paid_broadcast: bool | None = None,
|
|
646
670
|
message_effect_id: str | None = None,
|
|
647
671
|
reply_parameters: ReplyParameters | None = None,
|
|
648
|
-
reply_markup: InlineKeyboardMarkup
|
|
649
|
-
| ReplyKeyboardMarkup
|
|
650
|
-
| ReplyKeyboardRemove
|
|
651
|
-
| ForceReply
|
|
652
|
-
| None = None,
|
|
672
|
+
reply_markup: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply | None = None,
|
|
653
673
|
**other: typing.Any,
|
|
654
674
|
) -> Result[Message, APIError]:
|
|
655
675
|
"""Method `sendDocument`, see the [documentation](https://core.telegram.org/bots/api#senddocument)
|
|
@@ -696,6 +716,10 @@ class APIMethods:
|
|
|
696
716
|
|
|
697
717
|
:param protect_content: Protects the contents of the sent message from forwarding and saving.
|
|
698
718
|
|
|
719
|
+
:param allow_paid_broadcast: Pass True to allow up to 1000 messages per second, ignoring broadcasting \
|
|
720
|
+
limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will \
|
|
721
|
+
be withdrawn from the bot's balance.
|
|
722
|
+
|
|
699
723
|
:param message_effect_id: Unique identifier of the message effect to be added to the message; for private \
|
|
700
724
|
chats only.
|
|
701
725
|
|
|
@@ -714,6 +738,7 @@ class APIMethods:
|
|
|
714
738
|
|
|
715
739
|
async def send_video(
|
|
716
740
|
self,
|
|
741
|
+
*,
|
|
717
742
|
chat_id: int | str,
|
|
718
743
|
video: InputFile | str,
|
|
719
744
|
business_connection_id: str | None = None,
|
|
@@ -722,6 +747,8 @@ class APIMethods:
|
|
|
722
747
|
width: int | None = None,
|
|
723
748
|
height: int | None = None,
|
|
724
749
|
thumbnail: InputFile | str | None = None,
|
|
750
|
+
cover: InputFile | str | None = None,
|
|
751
|
+
start_timestamp: int | None = None,
|
|
725
752
|
caption: str | None = None,
|
|
726
753
|
parse_mode: str | None = default_params["parse_mode"],
|
|
727
754
|
caption_entities: list[MessageEntity] | None = None,
|
|
@@ -730,13 +757,10 @@ class APIMethods:
|
|
|
730
757
|
supports_streaming: bool | None = None,
|
|
731
758
|
disable_notification: bool | None = None,
|
|
732
759
|
protect_content: bool | None = None,
|
|
760
|
+
allow_paid_broadcast: bool | None = None,
|
|
733
761
|
message_effect_id: str | None = None,
|
|
734
762
|
reply_parameters: ReplyParameters | None = None,
|
|
735
|
-
reply_markup: InlineKeyboardMarkup
|
|
736
|
-
| ReplyKeyboardMarkup
|
|
737
|
-
| ReplyKeyboardRemove
|
|
738
|
-
| ForceReply
|
|
739
|
-
| None = None,
|
|
763
|
+
reply_markup: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply | None = None,
|
|
740
764
|
**other: typing.Any,
|
|
741
765
|
) -> Result[Message, APIError]:
|
|
742
766
|
"""Method `sendVideo`, see the [documentation](https://core.telegram.org/bots/api#sendvideo)
|
|
@@ -774,6 +798,14 @@ class APIMethods:
|
|
|
774
798
|
if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. \
|
|
775
799
|
More information on Sending Files: https://core.telegram.org/bots/api#sending-files. \
|
|
776
800
|
|
|
801
|
+
:param cover: Cover for the video in the message. Pass a file_id to send a file that exists \
|
|
802
|
+
on the Telegram servers (recommended), pass an HTTP URL for Telegram to \
|
|
803
|
+
get a file from the Internet, or pass `attach://<file_attach_name>` to \
|
|
804
|
+
upload a new one using multipart/form-data under <file_attach_name> \
|
|
805
|
+
name. More information on Sending Files: https://core.telegram.org/bots/api#sending-files. \
|
|
806
|
+
|
|
807
|
+
:param start_timestamp: Start timestamp for the video in the message.
|
|
808
|
+
|
|
777
809
|
:param caption: Video caption (may also be used when resending videos by file_id), 0-1024 \
|
|
778
810
|
characters after entities parsing.
|
|
779
811
|
|
|
@@ -793,6 +825,10 @@ class APIMethods:
|
|
|
793
825
|
|
|
794
826
|
:param protect_content: Protects the contents of the sent message from forwarding and saving.
|
|
795
827
|
|
|
828
|
+
:param allow_paid_broadcast: Pass True to allow up to 1000 messages per second, ignoring broadcasting \
|
|
829
|
+
limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will \
|
|
830
|
+
be withdrawn from the bot's balance.
|
|
831
|
+
|
|
796
832
|
:param message_effect_id: Unique identifier of the message effect to be added to the message; for private \
|
|
797
833
|
chats only.
|
|
798
834
|
|
|
@@ -811,6 +847,7 @@ class APIMethods:
|
|
|
811
847
|
|
|
812
848
|
async def send_animation(
|
|
813
849
|
self,
|
|
850
|
+
*,
|
|
814
851
|
chat_id: int | str,
|
|
815
852
|
animation: InputFile | str,
|
|
816
853
|
business_connection_id: str | None = None,
|
|
@@ -826,13 +863,10 @@ class APIMethods:
|
|
|
826
863
|
has_spoiler: bool | None = None,
|
|
827
864
|
disable_notification: bool | None = None,
|
|
828
865
|
protect_content: bool | None = None,
|
|
866
|
+
allow_paid_broadcast: bool | None = None,
|
|
829
867
|
message_effect_id: str | None = None,
|
|
830
868
|
reply_parameters: ReplyParameters | None = None,
|
|
831
|
-
reply_markup: InlineKeyboardMarkup
|
|
832
|
-
| ReplyKeyboardMarkup
|
|
833
|
-
| ReplyKeyboardRemove
|
|
834
|
-
| ForceReply
|
|
835
|
-
| None = None,
|
|
869
|
+
reply_markup: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply | None = None,
|
|
836
870
|
**other: typing.Any,
|
|
837
871
|
) -> Result[Message, APIError]:
|
|
838
872
|
"""Method `sendAnimation`, see the [documentation](https://core.telegram.org/bots/api#sendanimation)
|
|
@@ -886,6 +920,10 @@ class APIMethods:
|
|
|
886
920
|
|
|
887
921
|
:param protect_content: Protects the contents of the sent message from forwarding and saving.
|
|
888
922
|
|
|
923
|
+
:param allow_paid_broadcast: Pass True to allow up to 1000 messages per second, ignoring broadcasting \
|
|
924
|
+
limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will \
|
|
925
|
+
be withdrawn from the bot's balance.
|
|
926
|
+
|
|
889
927
|
:param message_effect_id: Unique identifier of the message effect to be added to the message; for private \
|
|
890
928
|
chats only.
|
|
891
929
|
|
|
@@ -904,6 +942,7 @@ class APIMethods:
|
|
|
904
942
|
|
|
905
943
|
async def send_voice(
|
|
906
944
|
self,
|
|
945
|
+
*,
|
|
907
946
|
chat_id: int | str,
|
|
908
947
|
voice: InputFile | str,
|
|
909
948
|
business_connection_id: str | None = None,
|
|
@@ -914,13 +953,10 @@ class APIMethods:
|
|
|
914
953
|
duration: int | None = None,
|
|
915
954
|
disable_notification: bool | None = None,
|
|
916
955
|
protect_content: bool | None = None,
|
|
956
|
+
allow_paid_broadcast: bool | None = None,
|
|
917
957
|
message_effect_id: str | None = None,
|
|
918
958
|
reply_parameters: ReplyParameters | None = None,
|
|
919
|
-
reply_markup: InlineKeyboardMarkup
|
|
920
|
-
| ReplyKeyboardMarkup
|
|
921
|
-
| ReplyKeyboardRemove
|
|
922
|
-
| ForceReply
|
|
923
|
-
| None = None,
|
|
959
|
+
reply_markup: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply | None = None,
|
|
924
960
|
**other: typing.Any,
|
|
925
961
|
) -> Result[Message, APIError]:
|
|
926
962
|
"""Method `sendVoice`, see the [documentation](https://core.telegram.org/bots/api#sendvoice)
|
|
@@ -960,6 +996,10 @@ class APIMethods:
|
|
|
960
996
|
|
|
961
997
|
:param protect_content: Protects the contents of the sent message from forwarding and saving.
|
|
962
998
|
|
|
999
|
+
:param allow_paid_broadcast: Pass True to allow up to 1000 messages per second, ignoring broadcasting \
|
|
1000
|
+
limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will \
|
|
1001
|
+
be withdrawn from the bot's balance.
|
|
1002
|
+
|
|
963
1003
|
:param message_effect_id: Unique identifier of the message effect to be added to the message; for private \
|
|
964
1004
|
chats only.
|
|
965
1005
|
|
|
@@ -978,6 +1018,7 @@ class APIMethods:
|
|
|
978
1018
|
|
|
979
1019
|
async def send_video_note(
|
|
980
1020
|
self,
|
|
1021
|
+
*,
|
|
981
1022
|
chat_id: int | str,
|
|
982
1023
|
video_note: InputFile | str,
|
|
983
1024
|
business_connection_id: str | None = None,
|
|
@@ -987,13 +1028,10 @@ class APIMethods:
|
|
|
987
1028
|
thumbnail: InputFile | str | None = None,
|
|
988
1029
|
disable_notification: bool | None = None,
|
|
989
1030
|
protect_content: bool | None = None,
|
|
1031
|
+
allow_paid_broadcast: bool | None = None,
|
|
990
1032
|
message_effect_id: str | None = None,
|
|
991
1033
|
reply_parameters: ReplyParameters | None = None,
|
|
992
|
-
reply_markup: InlineKeyboardMarkup
|
|
993
|
-
| ReplyKeyboardMarkup
|
|
994
|
-
| ReplyKeyboardRemove
|
|
995
|
-
| ForceReply
|
|
996
|
-
| None = None,
|
|
1034
|
+
reply_markup: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply | None = None,
|
|
997
1035
|
**other: typing.Any,
|
|
998
1036
|
) -> Result[Message, APIError]:
|
|
999
1037
|
"""Method `sendVideoNote`, see the [documentation](https://core.telegram.org/bots/api#sendvideonote)
|
|
@@ -1032,6 +1070,10 @@ class APIMethods:
|
|
|
1032
1070
|
|
|
1033
1071
|
:param protect_content: Protects the contents of the sent message from forwarding and saving.
|
|
1034
1072
|
|
|
1073
|
+
:param allow_paid_broadcast: Pass True to allow up to 1000 messages per second, ignoring broadcasting \
|
|
1074
|
+
limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will \
|
|
1075
|
+
be withdrawn from the bot's balance.
|
|
1076
|
+
|
|
1035
1077
|
:param message_effect_id: Unique identifier of the message effect to be added to the message; for private \
|
|
1036
1078
|
chats only.
|
|
1037
1079
|
|
|
@@ -1050,6 +1092,7 @@ class APIMethods:
|
|
|
1050
1092
|
|
|
1051
1093
|
async def send_paid_media(
|
|
1052
1094
|
self,
|
|
1095
|
+
*,
|
|
1053
1096
|
chat_id: int | str,
|
|
1054
1097
|
star_count: int,
|
|
1055
1098
|
media: list[InputPaidMedia],
|
|
@@ -1061,12 +1104,9 @@ class APIMethods:
|
|
|
1061
1104
|
show_caption_above_media: bool | None = None,
|
|
1062
1105
|
disable_notification: bool | None = None,
|
|
1063
1106
|
protect_content: bool | None = None,
|
|
1107
|
+
allow_paid_broadcast: bool | None = None,
|
|
1064
1108
|
reply_parameters: ReplyParameters | None = None,
|
|
1065
|
-
reply_markup: InlineKeyboardMarkup
|
|
1066
|
-
| ReplyKeyboardMarkup
|
|
1067
|
-
| ReplyKeyboardRemove
|
|
1068
|
-
| ForceReply
|
|
1069
|
-
| None = None,
|
|
1109
|
+
reply_markup: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply | None = None,
|
|
1070
1110
|
**other: typing.Any,
|
|
1071
1111
|
) -> Result[Message, APIError]:
|
|
1072
1112
|
"""Method `sendPaidMedia`, see the [documentation](https://core.telegram.org/bots/api#sendpaidmedia)
|
|
@@ -1103,6 +1143,10 @@ class APIMethods:
|
|
|
1103
1143
|
|
|
1104
1144
|
:param protect_content: Protects the contents of the sent message from forwarding and saving.
|
|
1105
1145
|
|
|
1146
|
+
:param allow_paid_broadcast: Pass True to allow up to 1000 messages per second, ignoring broadcasting \
|
|
1147
|
+
limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will \
|
|
1148
|
+
be withdrawn from the bot's balance.
|
|
1149
|
+
|
|
1106
1150
|
:param reply_parameters: Description of the message to reply to.
|
|
1107
1151
|
|
|
1108
1152
|
:param reply_markup: Additional interface options. A JSON-serialized object for an inline \
|
|
@@ -1118,12 +1162,14 @@ class APIMethods:
|
|
|
1118
1162
|
|
|
1119
1163
|
async def send_media_group(
|
|
1120
1164
|
self,
|
|
1165
|
+
*,
|
|
1121
1166
|
chat_id: int | str,
|
|
1122
1167
|
media: list[InputMediaAudio | InputMediaDocument | InputMediaPhoto | InputMediaVideo],
|
|
1123
1168
|
business_connection_id: str | None = None,
|
|
1124
1169
|
message_thread_id: int | None = None,
|
|
1125
1170
|
disable_notification: bool | None = None,
|
|
1126
1171
|
protect_content: bool | None = None,
|
|
1172
|
+
allow_paid_broadcast: bool | None = None,
|
|
1127
1173
|
message_effect_id: str | None = None,
|
|
1128
1174
|
reply_parameters: ReplyParameters | None = None,
|
|
1129
1175
|
**other: typing.Any,
|
|
@@ -1150,6 +1196,10 @@ class APIMethods:
|
|
|
1150
1196
|
|
|
1151
1197
|
:param protect_content: Protects the contents of the sent messages from forwarding and saving. \
|
|
1152
1198
|
|
|
1199
|
+
:param allow_paid_broadcast: Pass True to allow up to 1000 messages per second, ignoring broadcasting \
|
|
1200
|
+
limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will \
|
|
1201
|
+
be withdrawn from the bot's balance.
|
|
1202
|
+
|
|
1153
1203
|
:param message_effect_id: Unique identifier of the message effect to be added to the message; for private \
|
|
1154
1204
|
chats only.
|
|
1155
1205
|
|
|
@@ -1164,6 +1214,7 @@ class APIMethods:
|
|
|
1164
1214
|
|
|
1165
1215
|
async def send_location(
|
|
1166
1216
|
self,
|
|
1217
|
+
*,
|
|
1167
1218
|
chat_id: int | str,
|
|
1168
1219
|
latitude: float,
|
|
1169
1220
|
longitude: float,
|
|
@@ -1175,13 +1226,10 @@ class APIMethods:
|
|
|
1175
1226
|
proximity_alert_radius: int | None = None,
|
|
1176
1227
|
disable_notification: bool | None = None,
|
|
1177
1228
|
protect_content: bool | None = None,
|
|
1229
|
+
allow_paid_broadcast: bool | None = None,
|
|
1178
1230
|
message_effect_id: str | None = None,
|
|
1179
1231
|
reply_parameters: ReplyParameters | None = None,
|
|
1180
|
-
reply_markup: InlineKeyboardMarkup
|
|
1181
|
-
| ReplyKeyboardMarkup
|
|
1182
|
-
| ReplyKeyboardRemove
|
|
1183
|
-
| ForceReply
|
|
1184
|
-
| None = None,
|
|
1232
|
+
reply_markup: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply | None = None,
|
|
1185
1233
|
**other: typing.Any,
|
|
1186
1234
|
) -> Result[Message, APIError]:
|
|
1187
1235
|
"""Method `sendLocation`, see the [documentation](https://core.telegram.org/bots/api#sendlocation)
|
|
@@ -1217,6 +1265,10 @@ class APIMethods:
|
|
|
1217
1265
|
|
|
1218
1266
|
:param protect_content: Protects the contents of the sent message from forwarding and saving.
|
|
1219
1267
|
|
|
1268
|
+
:param allow_paid_broadcast: Pass True to allow up to 1000 messages per second, ignoring broadcasting \
|
|
1269
|
+
limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will \
|
|
1270
|
+
be withdrawn from the bot's balance.
|
|
1271
|
+
|
|
1220
1272
|
:param message_effect_id: Unique identifier of the message effect to be added to the message; for private \
|
|
1221
1273
|
chats only.
|
|
1222
1274
|
|
|
@@ -1235,6 +1287,7 @@ class APIMethods:
|
|
|
1235
1287
|
|
|
1236
1288
|
async def send_venue(
|
|
1237
1289
|
self,
|
|
1290
|
+
*,
|
|
1238
1291
|
chat_id: int | str,
|
|
1239
1292
|
latitude: float,
|
|
1240
1293
|
longitude: float,
|
|
@@ -1248,13 +1301,10 @@ class APIMethods:
|
|
|
1248
1301
|
google_place_type: str | None = None,
|
|
1249
1302
|
disable_notification: bool | None = None,
|
|
1250
1303
|
protect_content: bool | None = None,
|
|
1304
|
+
allow_paid_broadcast: bool | None = None,
|
|
1251
1305
|
message_effect_id: str | None = None,
|
|
1252
1306
|
reply_parameters: ReplyParameters | None = None,
|
|
1253
|
-
reply_markup: InlineKeyboardMarkup
|
|
1254
|
-
| ReplyKeyboardMarkup
|
|
1255
|
-
| ReplyKeyboardRemove
|
|
1256
|
-
| ForceReply
|
|
1257
|
-
| None = None,
|
|
1307
|
+
reply_markup: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply | None = None,
|
|
1258
1308
|
**other: typing.Any,
|
|
1259
1309
|
) -> Result[Message, APIError]:
|
|
1260
1310
|
"""Method `sendVenue`, see the [documentation](https://core.telegram.org/bots/api#sendvenue)
|
|
@@ -1292,6 +1342,10 @@ class APIMethods:
|
|
|
1292
1342
|
|
|
1293
1343
|
:param protect_content: Protects the contents of the sent message from forwarding and saving.
|
|
1294
1344
|
|
|
1345
|
+
:param allow_paid_broadcast: Pass True to allow up to 1000 messages per second, ignoring broadcasting \
|
|
1346
|
+
limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will \
|
|
1347
|
+
be withdrawn from the bot's balance.
|
|
1348
|
+
|
|
1295
1349
|
:param message_effect_id: Unique identifier of the message effect to be added to the message; for private \
|
|
1296
1350
|
chats only.
|
|
1297
1351
|
|
|
@@ -1310,6 +1364,7 @@ class APIMethods:
|
|
|
1310
1364
|
|
|
1311
1365
|
async def send_contact(
|
|
1312
1366
|
self,
|
|
1367
|
+
*,
|
|
1313
1368
|
chat_id: int | str,
|
|
1314
1369
|
phone_number: str,
|
|
1315
1370
|
first_name: str,
|
|
@@ -1319,13 +1374,10 @@ class APIMethods:
|
|
|
1319
1374
|
vcard: str | None = None,
|
|
1320
1375
|
disable_notification: bool | None = None,
|
|
1321
1376
|
protect_content: bool | None = None,
|
|
1377
|
+
allow_paid_broadcast: bool | None = None,
|
|
1322
1378
|
message_effect_id: str | None = None,
|
|
1323
1379
|
reply_parameters: ReplyParameters | None = None,
|
|
1324
|
-
reply_markup: InlineKeyboardMarkup
|
|
1325
|
-
| ReplyKeyboardMarkup
|
|
1326
|
-
| ReplyKeyboardRemove
|
|
1327
|
-
| ForceReply
|
|
1328
|
-
| None = None,
|
|
1380
|
+
reply_markup: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply | None = None,
|
|
1329
1381
|
**other: typing.Any,
|
|
1330
1382
|
) -> Result[Message, APIError]:
|
|
1331
1383
|
"""Method `sendContact`, see the [documentation](https://core.telegram.org/bots/api#sendcontact)
|
|
@@ -1353,6 +1405,10 @@ class APIMethods:
|
|
|
1353
1405
|
|
|
1354
1406
|
:param protect_content: Protects the contents of the sent message from forwarding and saving.
|
|
1355
1407
|
|
|
1408
|
+
:param allow_paid_broadcast: Pass True to allow up to 1000 messages per second, ignoring broadcasting \
|
|
1409
|
+
limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will \
|
|
1410
|
+
be withdrawn from the bot's balance.
|
|
1411
|
+
|
|
1356
1412
|
:param message_effect_id: Unique identifier of the message effect to be added to the message; for private \
|
|
1357
1413
|
chats only.
|
|
1358
1414
|
|
|
@@ -1371,6 +1427,7 @@ class APIMethods:
|
|
|
1371
1427
|
|
|
1372
1428
|
async def send_poll(
|
|
1373
1429
|
self,
|
|
1430
|
+
*,
|
|
1374
1431
|
chat_id: int | str,
|
|
1375
1432
|
question: str,
|
|
1376
1433
|
options: list[InputPollOption],
|
|
@@ -1390,13 +1447,10 @@ class APIMethods:
|
|
|
1390
1447
|
is_closed: bool | None = None,
|
|
1391
1448
|
disable_notification: bool | None = None,
|
|
1392
1449
|
protect_content: bool | None = None,
|
|
1450
|
+
allow_paid_broadcast: bool | None = None,
|
|
1393
1451
|
message_effect_id: str | None = None,
|
|
1394
1452
|
reply_parameters: ReplyParameters | None = None,
|
|
1395
|
-
reply_markup: InlineKeyboardMarkup
|
|
1396
|
-
| ReplyKeyboardMarkup
|
|
1397
|
-
| ReplyKeyboardRemove
|
|
1398
|
-
| ForceReply
|
|
1399
|
-
| None = None,
|
|
1453
|
+
reply_markup: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply | None = None,
|
|
1400
1454
|
**other: typing.Any,
|
|
1401
1455
|
) -> Result[Message, APIError]:
|
|
1402
1456
|
"""Method `sendPoll`, see the [documentation](https://core.telegram.org/bots/api#sendpoll)
|
|
@@ -1456,6 +1510,10 @@ class APIMethods:
|
|
|
1456
1510
|
|
|
1457
1511
|
:param protect_content: Protects the contents of the sent message from forwarding and saving.
|
|
1458
1512
|
|
|
1513
|
+
:param allow_paid_broadcast: Pass True to allow up to 1000 messages per second, ignoring broadcasting \
|
|
1514
|
+
limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will \
|
|
1515
|
+
be withdrawn from the bot's balance.
|
|
1516
|
+
|
|
1459
1517
|
:param message_effect_id: Unique identifier of the message effect to be added to the message; for private \
|
|
1460
1518
|
chats only.
|
|
1461
1519
|
|
|
@@ -1474,19 +1532,17 @@ class APIMethods:
|
|
|
1474
1532
|
|
|
1475
1533
|
async def send_dice(
|
|
1476
1534
|
self,
|
|
1535
|
+
*,
|
|
1477
1536
|
chat_id: int | str,
|
|
1478
1537
|
business_connection_id: str | None = None,
|
|
1479
1538
|
message_thread_id: int | None = None,
|
|
1480
1539
|
emoji: DiceEmoji | None = None,
|
|
1481
1540
|
disable_notification: bool | None = None,
|
|
1482
1541
|
protect_content: bool | None = None,
|
|
1542
|
+
allow_paid_broadcast: bool | None = None,
|
|
1483
1543
|
message_effect_id: str | None = None,
|
|
1484
1544
|
reply_parameters: ReplyParameters | None = None,
|
|
1485
|
-
reply_markup: InlineKeyboardMarkup
|
|
1486
|
-
| ReplyKeyboardMarkup
|
|
1487
|
-
| ReplyKeyboardRemove
|
|
1488
|
-
| ForceReply
|
|
1489
|
-
| None = None,
|
|
1545
|
+
reply_markup: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply | None = None,
|
|
1490
1546
|
**other: typing.Any,
|
|
1491
1547
|
) -> Result[Message, APIError]:
|
|
1492
1548
|
"""Method `sendDice`, see the [documentation](https://core.telegram.org/bots/api#senddice)
|
|
@@ -1511,6 +1567,10 @@ class APIMethods:
|
|
|
1511
1567
|
|
|
1512
1568
|
:param protect_content: Protects the contents of the sent message from forwarding.
|
|
1513
1569
|
|
|
1570
|
+
:param allow_paid_broadcast: Pass True to allow up to 1000 messages per second, ignoring broadcasting \
|
|
1571
|
+
limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will \
|
|
1572
|
+
be withdrawn from the bot's balance.
|
|
1573
|
+
|
|
1514
1574
|
:param message_effect_id: Unique identifier of the message effect to be added to the message; for private \
|
|
1515
1575
|
chats only.
|
|
1516
1576
|
|
|
@@ -1529,6 +1589,7 @@ class APIMethods:
|
|
|
1529
1589
|
|
|
1530
1590
|
async def send_chat_action(
|
|
1531
1591
|
self,
|
|
1592
|
+
*,
|
|
1532
1593
|
chat_id: int | str,
|
|
1533
1594
|
action: ChatAction,
|
|
1534
1595
|
business_connection_id: str | None = None,
|
|
@@ -1567,6 +1628,7 @@ class APIMethods:
|
|
|
1567
1628
|
|
|
1568
1629
|
async def set_message_reaction(
|
|
1569
1630
|
self,
|
|
1631
|
+
*,
|
|
1570
1632
|
chat_id: int | str,
|
|
1571
1633
|
message_id: int,
|
|
1572
1634
|
reaction: list[ReactionType] | None = None,
|
|
@@ -1576,9 +1638,9 @@ class APIMethods:
|
|
|
1576
1638
|
"""Method `setMessageReaction`, see the [documentation](https://core.telegram.org/bots/api#setmessagereaction)
|
|
1577
1639
|
|
|
1578
1640
|
Use this method to change the chosen reactions on a message. Service messages
|
|
1579
|
-
can't be reacted to. Automatically forwarded messages from
|
|
1580
|
-
its discussion group have the same available reactions as messages
|
|
1581
|
-
channel. Bots can't use paid reactions. Returns True on success.
|
|
1641
|
+
of some types can't be reacted to. Automatically forwarded messages from
|
|
1642
|
+
a channel to its discussion group have the same available reactions as messages
|
|
1643
|
+
in the channel. Bots can't use paid reactions. Returns True on success.
|
|
1582
1644
|
|
|
1583
1645
|
:param chat_id: Unique identifier for the target chat or username of the target channel \
|
|
1584
1646
|
(in the format @channelusername).
|
|
@@ -1603,6 +1665,7 @@ class APIMethods:
|
|
|
1603
1665
|
|
|
1604
1666
|
async def get_user_profile_photos(
|
|
1605
1667
|
self,
|
|
1668
|
+
*,
|
|
1606
1669
|
user_id: int,
|
|
1607
1670
|
offset: int | None = None,
|
|
1608
1671
|
limit: int | None = None,
|
|
@@ -1628,8 +1691,37 @@ class APIMethods:
|
|
|
1628
1691
|
)
|
|
1629
1692
|
return full_result(method_response, UserProfilePhotos)
|
|
1630
1693
|
|
|
1694
|
+
async def set_user_emoji_status(
|
|
1695
|
+
self,
|
|
1696
|
+
*,
|
|
1697
|
+
user_id: int,
|
|
1698
|
+
emoji_status_custom_emoji_id: str | None = None,
|
|
1699
|
+
emoji_status_expiration_date: int | None = None,
|
|
1700
|
+
**other: typing.Any,
|
|
1701
|
+
) -> Result[bool, APIError]:
|
|
1702
|
+
"""Method `setUserEmojiStatus`, see the [documentation](https://core.telegram.org/bots/api#setuseremojistatus)
|
|
1703
|
+
|
|
1704
|
+
Changes the emoji status for a given user that previously allowed the bot
|
|
1705
|
+
to manage their emoji status via the Mini App method requestEmojiStatusAccess.
|
|
1706
|
+
Returns True on success.
|
|
1707
|
+
|
|
1708
|
+
:param user_id: Unique identifier of the target user.
|
|
1709
|
+
|
|
1710
|
+
:param emoji_status_custom_emoji_id: Custom emoji identifier of the emoji status to set. Pass an empty string \
|
|
1711
|
+
to remove the status.
|
|
1712
|
+
|
|
1713
|
+
:param emoji_status_expiration_date: Expiration date of the emoji status, if any.
|
|
1714
|
+
"""
|
|
1715
|
+
|
|
1716
|
+
method_response = await self.api.request_raw(
|
|
1717
|
+
"setUserEmojiStatus",
|
|
1718
|
+
get_params(locals()),
|
|
1719
|
+
)
|
|
1720
|
+
return full_result(method_response, bool)
|
|
1721
|
+
|
|
1631
1722
|
async def get_file(
|
|
1632
1723
|
self,
|
|
1724
|
+
*,
|
|
1633
1725
|
file_id: str,
|
|
1634
1726
|
**other: typing.Any,
|
|
1635
1727
|
) -> Result[File, APIError]:
|
|
@@ -1655,6 +1747,7 @@ class APIMethods:
|
|
|
1655
1747
|
|
|
1656
1748
|
async def ban_chat_member(
|
|
1657
1749
|
self,
|
|
1750
|
+
*,
|
|
1658
1751
|
chat_id: int | str,
|
|
1659
1752
|
user_id: int,
|
|
1660
1753
|
until_date: datetime | int | None = None,
|
|
@@ -1691,6 +1784,7 @@ class APIMethods:
|
|
|
1691
1784
|
|
|
1692
1785
|
async def unban_chat_member(
|
|
1693
1786
|
self,
|
|
1787
|
+
*,
|
|
1694
1788
|
chat_id: int | str,
|
|
1695
1789
|
user_id: int,
|
|
1696
1790
|
only_if_banned: bool | None = None,
|
|
@@ -1722,6 +1816,7 @@ class APIMethods:
|
|
|
1722
1816
|
|
|
1723
1817
|
async def restrict_chat_member(
|
|
1724
1818
|
self,
|
|
1819
|
+
*,
|
|
1725
1820
|
chat_id: int | str,
|
|
1726
1821
|
user_id: int,
|
|
1727
1822
|
permissions: ChatPermissions,
|
|
@@ -1762,6 +1857,7 @@ class APIMethods:
|
|
|
1762
1857
|
|
|
1763
1858
|
async def promote_chat_member(
|
|
1764
1859
|
self,
|
|
1860
|
+
*,
|
|
1765
1861
|
chat_id: int | str,
|
|
1766
1862
|
user_id: int,
|
|
1767
1863
|
is_anonymous: bool | None = None,
|
|
@@ -1842,6 +1938,7 @@ class APIMethods:
|
|
|
1842
1938
|
|
|
1843
1939
|
async def set_chat_administrator_custom_title(
|
|
1844
1940
|
self,
|
|
1941
|
+
*,
|
|
1845
1942
|
chat_id: int | str,
|
|
1846
1943
|
user_id: int,
|
|
1847
1944
|
custom_title: str,
|
|
@@ -1869,6 +1966,7 @@ class APIMethods:
|
|
|
1869
1966
|
|
|
1870
1967
|
async def ban_chat_sender_chat(
|
|
1871
1968
|
self,
|
|
1969
|
+
*,
|
|
1872
1970
|
chat_id: int | str,
|
|
1873
1971
|
sender_chat_id: int,
|
|
1874
1972
|
**other: typing.Any,
|
|
@@ -1895,6 +1993,7 @@ class APIMethods:
|
|
|
1895
1993
|
|
|
1896
1994
|
async def unban_chat_sender_chat(
|
|
1897
1995
|
self,
|
|
1996
|
+
*,
|
|
1898
1997
|
chat_id: int | str,
|
|
1899
1998
|
sender_chat_id: int,
|
|
1900
1999
|
**other: typing.Any,
|
|
@@ -1919,6 +2018,7 @@ class APIMethods:
|
|
|
1919
2018
|
|
|
1920
2019
|
async def set_chat_permissions(
|
|
1921
2020
|
self,
|
|
2021
|
+
*,
|
|
1922
2022
|
chat_id: int | str,
|
|
1923
2023
|
permissions: ChatPermissions,
|
|
1924
2024
|
use_independent_chat_permissions: bool | None = None,
|
|
@@ -1951,6 +2051,7 @@ class APIMethods:
|
|
|
1951
2051
|
|
|
1952
2052
|
async def export_chat_invite_link(
|
|
1953
2053
|
self,
|
|
2054
|
+
*,
|
|
1954
2055
|
chat_id: int | str,
|
|
1955
2056
|
**other: typing.Any,
|
|
1956
2057
|
) -> Result[str, APIError]:
|
|
@@ -1973,6 +2074,7 @@ class APIMethods:
|
|
|
1973
2074
|
|
|
1974
2075
|
async def create_chat_invite_link(
|
|
1975
2076
|
self,
|
|
2077
|
+
*,
|
|
1976
2078
|
chat_id: int | str,
|
|
1977
2079
|
name: str | None = None,
|
|
1978
2080
|
expire_date: datetime | int | None = None,
|
|
@@ -2009,6 +2111,7 @@ class APIMethods:
|
|
|
2009
2111
|
|
|
2010
2112
|
async def edit_chat_invite_link(
|
|
2011
2113
|
self,
|
|
2114
|
+
*,
|
|
2012
2115
|
chat_id: int | str,
|
|
2013
2116
|
invite_link: str,
|
|
2014
2117
|
name: str | None = None,
|
|
@@ -2048,6 +2151,7 @@ class APIMethods:
|
|
|
2048
2151
|
|
|
2049
2152
|
async def create_chat_subscription_invite_link(
|
|
2050
2153
|
self,
|
|
2154
|
+
*,
|
|
2051
2155
|
chat_id: int | str,
|
|
2052
2156
|
subscription_period: int,
|
|
2053
2157
|
subscription_price: int,
|
|
@@ -2082,6 +2186,7 @@ class APIMethods:
|
|
|
2082
2186
|
|
|
2083
2187
|
async def edit_chat_subscription_invite_link(
|
|
2084
2188
|
self,
|
|
2189
|
+
*,
|
|
2085
2190
|
chat_id: int | str,
|
|
2086
2191
|
invite_link: str,
|
|
2087
2192
|
name: str | None = None,
|
|
@@ -2109,6 +2214,7 @@ class APIMethods:
|
|
|
2109
2214
|
|
|
2110
2215
|
async def revoke_chat_invite_link(
|
|
2111
2216
|
self,
|
|
2217
|
+
*,
|
|
2112
2218
|
chat_id: int | str,
|
|
2113
2219
|
invite_link: str,
|
|
2114
2220
|
**other: typing.Any,
|
|
@@ -2135,6 +2241,7 @@ class APIMethods:
|
|
|
2135
2241
|
|
|
2136
2242
|
async def approve_chat_join_request(
|
|
2137
2243
|
self,
|
|
2244
|
+
*,
|
|
2138
2245
|
chat_id: int | str,
|
|
2139
2246
|
user_id: int,
|
|
2140
2247
|
**other: typing.Any,
|
|
@@ -2159,6 +2266,7 @@ class APIMethods:
|
|
|
2159
2266
|
|
|
2160
2267
|
async def decline_chat_join_request(
|
|
2161
2268
|
self,
|
|
2269
|
+
*,
|
|
2162
2270
|
chat_id: int | str,
|
|
2163
2271
|
user_id: int,
|
|
2164
2272
|
**other: typing.Any,
|
|
@@ -2183,6 +2291,7 @@ class APIMethods:
|
|
|
2183
2291
|
|
|
2184
2292
|
async def set_chat_photo(
|
|
2185
2293
|
self,
|
|
2294
|
+
*,
|
|
2186
2295
|
chat_id: int | str,
|
|
2187
2296
|
photo: InputFile,
|
|
2188
2297
|
**other: typing.Any,
|
|
@@ -2208,6 +2317,7 @@ class APIMethods:
|
|
|
2208
2317
|
|
|
2209
2318
|
async def delete_chat_photo(
|
|
2210
2319
|
self,
|
|
2320
|
+
*,
|
|
2211
2321
|
chat_id: int | str,
|
|
2212
2322
|
**other: typing.Any,
|
|
2213
2323
|
) -> Result[bool, APIError]:
|
|
@@ -2229,6 +2339,7 @@ class APIMethods:
|
|
|
2229
2339
|
|
|
2230
2340
|
async def set_chat_title(
|
|
2231
2341
|
self,
|
|
2342
|
+
*,
|
|
2232
2343
|
chat_id: int | str,
|
|
2233
2344
|
title: str,
|
|
2234
2345
|
**other: typing.Any,
|
|
@@ -2253,6 +2364,7 @@ class APIMethods:
|
|
|
2253
2364
|
|
|
2254
2365
|
async def set_chat_description(
|
|
2255
2366
|
self,
|
|
2367
|
+
*,
|
|
2256
2368
|
chat_id: int | str,
|
|
2257
2369
|
description: str | None = None,
|
|
2258
2370
|
**other: typing.Any,
|
|
@@ -2277,6 +2389,7 @@ class APIMethods:
|
|
|
2277
2389
|
|
|
2278
2390
|
async def pin_chat_message(
|
|
2279
2391
|
self,
|
|
2392
|
+
*,
|
|
2280
2393
|
chat_id: int | str,
|
|
2281
2394
|
message_id: int,
|
|
2282
2395
|
business_connection_id: str | None = None,
|
|
@@ -2312,6 +2425,7 @@ class APIMethods:
|
|
|
2312
2425
|
|
|
2313
2426
|
async def unpin_chat_message(
|
|
2314
2427
|
self,
|
|
2428
|
+
*,
|
|
2315
2429
|
chat_id: int | str,
|
|
2316
2430
|
business_connection_id: str | None = None,
|
|
2317
2431
|
message_id: int | None = None,
|
|
@@ -2344,6 +2458,7 @@ class APIMethods:
|
|
|
2344
2458
|
|
|
2345
2459
|
async def unpin_all_chat_messages(
|
|
2346
2460
|
self,
|
|
2461
|
+
*,
|
|
2347
2462
|
chat_id: int | str,
|
|
2348
2463
|
**other: typing.Any,
|
|
2349
2464
|
) -> Result[bool, APIError]:
|
|
@@ -2367,6 +2482,7 @@ class APIMethods:
|
|
|
2367
2482
|
|
|
2368
2483
|
async def leave_chat(
|
|
2369
2484
|
self,
|
|
2485
|
+
*,
|
|
2370
2486
|
chat_id: int | str,
|
|
2371
2487
|
**other: typing.Any,
|
|
2372
2488
|
) -> Result[bool, APIError]:
|
|
@@ -2387,6 +2503,7 @@ class APIMethods:
|
|
|
2387
2503
|
|
|
2388
2504
|
async def get_chat(
|
|
2389
2505
|
self,
|
|
2506
|
+
*,
|
|
2390
2507
|
chat_id: int | str,
|
|
2391
2508
|
**other: typing.Any,
|
|
2392
2509
|
) -> Result[ChatFullInfo, APIError]:
|
|
@@ -2407,6 +2524,7 @@ class APIMethods:
|
|
|
2407
2524
|
|
|
2408
2525
|
async def get_chat_administrators(
|
|
2409
2526
|
self,
|
|
2527
|
+
*,
|
|
2410
2528
|
chat_id: int | str,
|
|
2411
2529
|
**other: typing.Any,
|
|
2412
2530
|
) -> Result[
|
|
@@ -2451,6 +2569,7 @@ class APIMethods:
|
|
|
2451
2569
|
|
|
2452
2570
|
async def get_chat_member_count(
|
|
2453
2571
|
self,
|
|
2572
|
+
*,
|
|
2454
2573
|
chat_id: int | str,
|
|
2455
2574
|
**other: typing.Any,
|
|
2456
2575
|
) -> Result[int, APIError]:
|
|
@@ -2470,6 +2589,7 @@ class APIMethods:
|
|
|
2470
2589
|
|
|
2471
2590
|
async def get_chat_member(
|
|
2472
2591
|
self,
|
|
2592
|
+
*,
|
|
2473
2593
|
chat_id: int | str,
|
|
2474
2594
|
user_id: int,
|
|
2475
2595
|
**other: typing.Any,
|
|
@@ -2514,6 +2634,7 @@ class APIMethods:
|
|
|
2514
2634
|
|
|
2515
2635
|
async def set_chat_sticker_set(
|
|
2516
2636
|
self,
|
|
2637
|
+
*,
|
|
2517
2638
|
chat_id: int | str,
|
|
2518
2639
|
sticker_set_name: str,
|
|
2519
2640
|
**other: typing.Any,
|
|
@@ -2540,6 +2661,7 @@ class APIMethods:
|
|
|
2540
2661
|
|
|
2541
2662
|
async def delete_chat_sticker_set(
|
|
2542
2663
|
self,
|
|
2664
|
+
*,
|
|
2543
2665
|
chat_id: int | str,
|
|
2544
2666
|
**other: typing.Any,
|
|
2545
2667
|
) -> Result[bool, APIError]:
|
|
@@ -2577,6 +2699,7 @@ class APIMethods:
|
|
|
2577
2699
|
|
|
2578
2700
|
async def create_forum_topic(
|
|
2579
2701
|
self,
|
|
2702
|
+
*,
|
|
2580
2703
|
chat_id: int | str,
|
|
2581
2704
|
name: str,
|
|
2582
2705
|
icon_color: TopicIconColor | None = None,
|
|
@@ -2611,6 +2734,7 @@ class APIMethods:
|
|
|
2611
2734
|
|
|
2612
2735
|
async def edit_forum_topic(
|
|
2613
2736
|
self,
|
|
2737
|
+
*,
|
|
2614
2738
|
chat_id: int | str,
|
|
2615
2739
|
message_thread_id: int,
|
|
2616
2740
|
name: str | None = None,
|
|
@@ -2645,6 +2769,7 @@ class APIMethods:
|
|
|
2645
2769
|
|
|
2646
2770
|
async def close_forum_topic(
|
|
2647
2771
|
self,
|
|
2772
|
+
*,
|
|
2648
2773
|
chat_id: int | str,
|
|
2649
2774
|
message_thread_id: int,
|
|
2650
2775
|
**other: typing.Any,
|
|
@@ -2670,6 +2795,7 @@ class APIMethods:
|
|
|
2670
2795
|
|
|
2671
2796
|
async def reopen_forum_topic(
|
|
2672
2797
|
self,
|
|
2798
|
+
*,
|
|
2673
2799
|
chat_id: int | str,
|
|
2674
2800
|
message_thread_id: int,
|
|
2675
2801
|
**other: typing.Any,
|
|
@@ -2695,6 +2821,7 @@ class APIMethods:
|
|
|
2695
2821
|
|
|
2696
2822
|
async def delete_forum_topic(
|
|
2697
2823
|
self,
|
|
2824
|
+
*,
|
|
2698
2825
|
chat_id: int | str,
|
|
2699
2826
|
message_thread_id: int,
|
|
2700
2827
|
**other: typing.Any,
|
|
@@ -2720,6 +2847,7 @@ class APIMethods:
|
|
|
2720
2847
|
|
|
2721
2848
|
async def unpin_all_forum_topic_messages(
|
|
2722
2849
|
self,
|
|
2850
|
+
*,
|
|
2723
2851
|
chat_id: int | str,
|
|
2724
2852
|
message_thread_id: int,
|
|
2725
2853
|
**other: typing.Any,
|
|
@@ -2745,6 +2873,7 @@ class APIMethods:
|
|
|
2745
2873
|
|
|
2746
2874
|
async def edit_general_forum_topic(
|
|
2747
2875
|
self,
|
|
2876
|
+
*,
|
|
2748
2877
|
chat_id: int | str,
|
|
2749
2878
|
name: str,
|
|
2750
2879
|
**other: typing.Any,
|
|
@@ -2769,6 +2898,7 @@ class APIMethods:
|
|
|
2769
2898
|
|
|
2770
2899
|
async def close_general_forum_topic(
|
|
2771
2900
|
self,
|
|
2901
|
+
*,
|
|
2772
2902
|
chat_id: int | str,
|
|
2773
2903
|
**other: typing.Any,
|
|
2774
2904
|
) -> Result[bool, APIError]:
|
|
@@ -2790,6 +2920,7 @@ class APIMethods:
|
|
|
2790
2920
|
|
|
2791
2921
|
async def reopen_general_forum_topic(
|
|
2792
2922
|
self,
|
|
2923
|
+
*,
|
|
2793
2924
|
chat_id: int | str,
|
|
2794
2925
|
**other: typing.Any,
|
|
2795
2926
|
) -> Result[bool, APIError]:
|
|
@@ -2812,6 +2943,7 @@ class APIMethods:
|
|
|
2812
2943
|
|
|
2813
2944
|
async def hide_general_forum_topic(
|
|
2814
2945
|
self,
|
|
2946
|
+
*,
|
|
2815
2947
|
chat_id: int | str,
|
|
2816
2948
|
**other: typing.Any,
|
|
2817
2949
|
) -> Result[bool, APIError]:
|
|
@@ -2834,6 +2966,7 @@ class APIMethods:
|
|
|
2834
2966
|
|
|
2835
2967
|
async def unhide_general_forum_topic(
|
|
2836
2968
|
self,
|
|
2969
|
+
*,
|
|
2837
2970
|
chat_id: int | str,
|
|
2838
2971
|
**other: typing.Any,
|
|
2839
2972
|
) -> Result[bool, APIError]:
|
|
@@ -2855,6 +2988,7 @@ class APIMethods:
|
|
|
2855
2988
|
|
|
2856
2989
|
async def unpin_all_general_forum_topic_messages(
|
|
2857
2990
|
self,
|
|
2991
|
+
*,
|
|
2858
2992
|
chat_id: int | str,
|
|
2859
2993
|
**other: typing.Any,
|
|
2860
2994
|
) -> Result[bool, APIError]:
|
|
@@ -2877,6 +3011,7 @@ class APIMethods:
|
|
|
2877
3011
|
|
|
2878
3012
|
async def answer_callback_query(
|
|
2879
3013
|
self,
|
|
3014
|
+
*,
|
|
2880
3015
|
callback_query_id: str,
|
|
2881
3016
|
text: str | None = None,
|
|
2882
3017
|
show_alert: bool | None = None,
|
|
@@ -2917,6 +3052,7 @@ class APIMethods:
|
|
|
2917
3052
|
|
|
2918
3053
|
async def get_user_chat_boosts(
|
|
2919
3054
|
self,
|
|
3055
|
+
*,
|
|
2920
3056
|
chat_id: int | str,
|
|
2921
3057
|
user_id: int,
|
|
2922
3058
|
**other: typing.Any,
|
|
@@ -2940,6 +3076,7 @@ class APIMethods:
|
|
|
2940
3076
|
|
|
2941
3077
|
async def get_business_connection(
|
|
2942
3078
|
self,
|
|
3079
|
+
*,
|
|
2943
3080
|
business_connection_id: str,
|
|
2944
3081
|
**other: typing.Any,
|
|
2945
3082
|
) -> Result[BusinessConnection, APIError]:
|
|
@@ -2959,6 +3096,7 @@ class APIMethods:
|
|
|
2959
3096
|
|
|
2960
3097
|
async def set_my_commands(
|
|
2961
3098
|
self,
|
|
3099
|
+
*,
|
|
2962
3100
|
commands: list[BotCommand],
|
|
2963
3101
|
scope: BotCommandScope | None = None,
|
|
2964
3102
|
language_code: str | None = None,
|
|
@@ -2988,6 +3126,7 @@ class APIMethods:
|
|
|
2988
3126
|
|
|
2989
3127
|
async def delete_my_commands(
|
|
2990
3128
|
self,
|
|
3129
|
+
*,
|
|
2991
3130
|
scope: BotCommandScope | None = None,
|
|
2992
3131
|
language_code: str | None = None,
|
|
2993
3132
|
**other: typing.Any,
|
|
@@ -3014,6 +3153,7 @@ class APIMethods:
|
|
|
3014
3153
|
|
|
3015
3154
|
async def get_my_commands(
|
|
3016
3155
|
self,
|
|
3156
|
+
*,
|
|
3017
3157
|
scope: BotCommandScope | None = None,
|
|
3018
3158
|
language_code: str | None = None,
|
|
3019
3159
|
**other: typing.Any,
|
|
@@ -3037,6 +3177,7 @@ class APIMethods:
|
|
|
3037
3177
|
|
|
3038
3178
|
async def set_my_name(
|
|
3039
3179
|
self,
|
|
3180
|
+
*,
|
|
3040
3181
|
name: str | None = None,
|
|
3041
3182
|
language_code: str | None = None,
|
|
3042
3183
|
**other: typing.Any,
|
|
@@ -3060,6 +3201,7 @@ class APIMethods:
|
|
|
3060
3201
|
|
|
3061
3202
|
async def get_my_name(
|
|
3062
3203
|
self,
|
|
3204
|
+
*,
|
|
3063
3205
|
language_code: str | None = None,
|
|
3064
3206
|
**other: typing.Any,
|
|
3065
3207
|
) -> Result[BotName, APIError]:
|
|
@@ -3079,6 +3221,7 @@ class APIMethods:
|
|
|
3079
3221
|
|
|
3080
3222
|
async def set_my_description(
|
|
3081
3223
|
self,
|
|
3224
|
+
*,
|
|
3082
3225
|
description: str | None = None,
|
|
3083
3226
|
language_code: str | None = None,
|
|
3084
3227
|
**other: typing.Any,
|
|
@@ -3103,6 +3246,7 @@ class APIMethods:
|
|
|
3103
3246
|
|
|
3104
3247
|
async def get_my_description(
|
|
3105
3248
|
self,
|
|
3249
|
+
*,
|
|
3106
3250
|
language_code: str | None = None,
|
|
3107
3251
|
**other: typing.Any,
|
|
3108
3252
|
) -> Result[BotDescription, APIError]:
|
|
@@ -3122,6 +3266,7 @@ class APIMethods:
|
|
|
3122
3266
|
|
|
3123
3267
|
async def set_my_short_description(
|
|
3124
3268
|
self,
|
|
3269
|
+
*,
|
|
3125
3270
|
short_description: str | None = None,
|
|
3126
3271
|
language_code: str | None = None,
|
|
3127
3272
|
**other: typing.Any,
|
|
@@ -3147,6 +3292,7 @@ class APIMethods:
|
|
|
3147
3292
|
|
|
3148
3293
|
async def get_my_short_description(
|
|
3149
3294
|
self,
|
|
3295
|
+
*,
|
|
3150
3296
|
language_code: str | None = None,
|
|
3151
3297
|
**other: typing.Any,
|
|
3152
3298
|
) -> Result[BotShortDescription, APIError]:
|
|
@@ -3166,6 +3312,7 @@ class APIMethods:
|
|
|
3166
3312
|
|
|
3167
3313
|
async def set_chat_menu_button(
|
|
3168
3314
|
self,
|
|
3315
|
+
*,
|
|
3169
3316
|
chat_id: int | None = None,
|
|
3170
3317
|
menu_button: MenuButton | None = None,
|
|
3171
3318
|
**other: typing.Any,
|
|
@@ -3189,6 +3336,7 @@ class APIMethods:
|
|
|
3189
3336
|
|
|
3190
3337
|
async def get_chat_menu_button(
|
|
3191
3338
|
self,
|
|
3339
|
+
*,
|
|
3192
3340
|
chat_id: int | None = None,
|
|
3193
3341
|
**other: typing.Any,
|
|
3194
3342
|
) -> Result[Variative[MenuButtonCommands, MenuButtonWebApp, MenuButtonDefault], APIError]:
|
|
@@ -3205,12 +3353,11 @@ class APIMethods:
|
|
|
3205
3353
|
"getChatMenuButton",
|
|
3206
3354
|
get_params(locals()),
|
|
3207
3355
|
)
|
|
3208
|
-
return full_result(
|
|
3209
|
-
method_response, Variative[MenuButtonCommands, MenuButtonWebApp, MenuButtonDefault]
|
|
3210
|
-
)
|
|
3356
|
+
return full_result(method_response, Variative[MenuButtonCommands, MenuButtonWebApp, MenuButtonDefault])
|
|
3211
3357
|
|
|
3212
3358
|
async def set_my_default_administrator_rights(
|
|
3213
3359
|
self,
|
|
3360
|
+
*,
|
|
3214
3361
|
rights: ChatAdministratorRights | None = None,
|
|
3215
3362
|
for_channels: bool | None = None,
|
|
3216
3363
|
**other: typing.Any,
|
|
@@ -3238,6 +3385,7 @@ class APIMethods:
|
|
|
3238
3385
|
|
|
3239
3386
|
async def get_my_default_administrator_rights(
|
|
3240
3387
|
self,
|
|
3388
|
+
*,
|
|
3241
3389
|
for_channels: bool | None = None,
|
|
3242
3390
|
**other: typing.Any,
|
|
3243
3391
|
) -> Result[ChatAdministratorRights, APIError]:
|
|
@@ -3259,6 +3407,7 @@ class APIMethods:
|
|
|
3259
3407
|
|
|
3260
3408
|
async def edit_message_text(
|
|
3261
3409
|
self,
|
|
3410
|
+
*,
|
|
3262
3411
|
text: str,
|
|
3263
3412
|
business_connection_id: str | None = None,
|
|
3264
3413
|
chat_id: int | str | None = None,
|
|
@@ -3311,6 +3460,7 @@ class APIMethods:
|
|
|
3311
3460
|
|
|
3312
3461
|
async def edit_message_caption(
|
|
3313
3462
|
self,
|
|
3463
|
+
*,
|
|
3314
3464
|
business_connection_id: str | None = None,
|
|
3315
3465
|
chat_id: int | str | None = None,
|
|
3316
3466
|
message_id: int | None = None,
|
|
@@ -3364,6 +3514,7 @@ class APIMethods:
|
|
|
3364
3514
|
|
|
3365
3515
|
async def edit_message_media(
|
|
3366
3516
|
self,
|
|
3517
|
+
*,
|
|
3367
3518
|
media: InputMedia,
|
|
3368
3519
|
business_connection_id: str | None = None,
|
|
3369
3520
|
chat_id: int | str | None = None,
|
|
@@ -3374,15 +3525,15 @@ class APIMethods:
|
|
|
3374
3525
|
) -> Result[Variative[Message, bool], APIError]:
|
|
3375
3526
|
"""Method `editMessageMedia`, see the [documentation](https://core.telegram.org/bots/api#editmessagemedia)
|
|
3376
3527
|
|
|
3377
|
-
Use this method to edit animation, audio, document, photo, or video messages
|
|
3378
|
-
If a message is part of a message album, then
|
|
3379
|
-
|
|
3380
|
-
a video otherwise. When an inline message is edited,
|
|
3381
|
-
use a previously uploaded file via its file_id
|
|
3382
|
-
if the edited message is not an inline message,
|
|
3383
|
-
otherwise True is returned. Note that business
|
|
3384
|
-
by the bot and do not contain an inline keyboard
|
|
3385
|
-
48 hours from the time they were sent.
|
|
3528
|
+
Use this method to edit animation, audio, document, photo, or video messages,
|
|
3529
|
+
or to add media to text messages. If a message is part of a message album, then
|
|
3530
|
+
it can be edited only to an audio for audio albums, only to a document for document
|
|
3531
|
+
albums and to a photo or a video otherwise. When an inline message is edited,
|
|
3532
|
+
a new file can't be uploaded; use a previously uploaded file via its file_id
|
|
3533
|
+
or specify a URL. On success, if the edited message is not an inline message,
|
|
3534
|
+
the edited Message is returned, otherwise True is returned. Note that business
|
|
3535
|
+
messages that were not sent by the bot and do not contain an inline keyboard
|
|
3536
|
+
can only be edited within 48 hours from the time they were sent.
|
|
3386
3537
|
|
|
3387
3538
|
:param business_connection_id: Unique identifier of the business connection on behalf of which the message \
|
|
3388
3539
|
to be edited was sent.
|
|
@@ -3409,6 +3560,7 @@ class APIMethods:
|
|
|
3409
3560
|
|
|
3410
3561
|
async def edit_message_live_location(
|
|
3411
3562
|
self,
|
|
3563
|
+
*,
|
|
3412
3564
|
latitude: float,
|
|
3413
3565
|
longitude: float,
|
|
3414
3566
|
business_connection_id: str | None = None,
|
|
@@ -3471,6 +3623,7 @@ class APIMethods:
|
|
|
3471
3623
|
|
|
3472
3624
|
async def stop_message_live_location(
|
|
3473
3625
|
self,
|
|
3626
|
+
*,
|
|
3474
3627
|
business_connection_id: str | None = None,
|
|
3475
3628
|
chat_id: int | str | None = None,
|
|
3476
3629
|
message_id: int | None = None,
|
|
@@ -3507,6 +3660,7 @@ class APIMethods:
|
|
|
3507
3660
|
|
|
3508
3661
|
async def edit_message_reply_markup(
|
|
3509
3662
|
self,
|
|
3663
|
+
*,
|
|
3510
3664
|
business_connection_id: str | None = None,
|
|
3511
3665
|
chat_id: int | str | None = None,
|
|
3512
3666
|
message_id: int | None = None,
|
|
@@ -3545,6 +3699,7 @@ class APIMethods:
|
|
|
3545
3699
|
|
|
3546
3700
|
async def stop_poll(
|
|
3547
3701
|
self,
|
|
3702
|
+
*,
|
|
3548
3703
|
chat_id: int | str,
|
|
3549
3704
|
message_id: int,
|
|
3550
3705
|
business_connection_id: str | None = None,
|
|
@@ -3575,6 +3730,7 @@ class APIMethods:
|
|
|
3575
3730
|
|
|
3576
3731
|
async def delete_message(
|
|
3577
3732
|
self,
|
|
3733
|
+
*,
|
|
3578
3734
|
chat_id: int | str,
|
|
3579
3735
|
message_id: int,
|
|
3580
3736
|
**other: typing.Any,
|
|
@@ -3607,6 +3763,7 @@ class APIMethods:
|
|
|
3607
3763
|
|
|
3608
3764
|
async def delete_messages(
|
|
3609
3765
|
self,
|
|
3766
|
+
*,
|
|
3610
3767
|
chat_id: int | str,
|
|
3611
3768
|
message_ids: list[int],
|
|
3612
3769
|
**other: typing.Any,
|
|
@@ -3632,6 +3789,7 @@ class APIMethods:
|
|
|
3632
3789
|
|
|
3633
3790
|
async def send_sticker(
|
|
3634
3791
|
self,
|
|
3792
|
+
*,
|
|
3635
3793
|
chat_id: int | str,
|
|
3636
3794
|
sticker: InputFile | str,
|
|
3637
3795
|
business_connection_id: str | None = None,
|
|
@@ -3639,13 +3797,10 @@ class APIMethods:
|
|
|
3639
3797
|
emoji: str | None = None,
|
|
3640
3798
|
disable_notification: bool | None = None,
|
|
3641
3799
|
protect_content: bool | None = None,
|
|
3800
|
+
allow_paid_broadcast: bool | None = None,
|
|
3642
3801
|
message_effect_id: str | None = None,
|
|
3643
3802
|
reply_parameters: ReplyParameters | None = None,
|
|
3644
|
-
reply_markup: InlineKeyboardMarkup
|
|
3645
|
-
| ReplyKeyboardMarkup
|
|
3646
|
-
| ReplyKeyboardRemove
|
|
3647
|
-
| ForceReply
|
|
3648
|
-
| None = None,
|
|
3803
|
+
reply_markup: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply | None = None,
|
|
3649
3804
|
**other: typing.Any,
|
|
3650
3805
|
) -> Result[Message, APIError]:
|
|
3651
3806
|
"""Method `sendSticker`, see the [documentation](https://core.telegram.org/bots/api#sendsticker)
|
|
@@ -3675,6 +3830,10 @@ class APIMethods:
|
|
|
3675
3830
|
|
|
3676
3831
|
:param protect_content: Protects the contents of the sent message from forwarding and saving.
|
|
3677
3832
|
|
|
3833
|
+
:param allow_paid_broadcast: Pass True to allow up to 1000 messages per second, ignoring broadcasting \
|
|
3834
|
+
limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will \
|
|
3835
|
+
be withdrawn from the bot's balance.
|
|
3836
|
+
|
|
3678
3837
|
:param message_effect_id: Unique identifier of the message effect to be added to the message; for private \
|
|
3679
3838
|
chats only.
|
|
3680
3839
|
|
|
@@ -3693,6 +3852,7 @@ class APIMethods:
|
|
|
3693
3852
|
|
|
3694
3853
|
async def get_sticker_set(
|
|
3695
3854
|
self,
|
|
3855
|
+
*,
|
|
3696
3856
|
name: str,
|
|
3697
3857
|
**other: typing.Any,
|
|
3698
3858
|
) -> Result[StickerSet, APIError]:
|
|
@@ -3711,6 +3871,7 @@ class APIMethods:
|
|
|
3711
3871
|
|
|
3712
3872
|
async def get_custom_emoji_stickers(
|
|
3713
3873
|
self,
|
|
3874
|
+
*,
|
|
3714
3875
|
custom_emoji_ids: list[str],
|
|
3715
3876
|
**other: typing.Any,
|
|
3716
3877
|
) -> Result[list[Sticker], APIError]:
|
|
@@ -3731,6 +3892,7 @@ class APIMethods:
|
|
|
3731
3892
|
|
|
3732
3893
|
async def upload_sticker_file(
|
|
3733
3894
|
self,
|
|
3895
|
+
*,
|
|
3734
3896
|
user_id: int,
|
|
3735
3897
|
sticker: InputFile,
|
|
3736
3898
|
sticker_format: typing.Literal["static", "animated", "video"],
|
|
@@ -3758,6 +3920,7 @@ class APIMethods:
|
|
|
3758
3920
|
|
|
3759
3921
|
async def create_new_sticker_set(
|
|
3760
3922
|
self,
|
|
3923
|
+
*,
|
|
3761
3924
|
user_id: int,
|
|
3762
3925
|
name: str,
|
|
3763
3926
|
title: str,
|
|
@@ -3800,6 +3963,7 @@ class APIMethods:
|
|
|
3800
3963
|
|
|
3801
3964
|
async def add_sticker_to_set(
|
|
3802
3965
|
self,
|
|
3966
|
+
*,
|
|
3803
3967
|
user_id: int,
|
|
3804
3968
|
name: str,
|
|
3805
3969
|
sticker: InputSticker,
|
|
@@ -3828,6 +3992,7 @@ class APIMethods:
|
|
|
3828
3992
|
|
|
3829
3993
|
async def set_sticker_position_in_set(
|
|
3830
3994
|
self,
|
|
3995
|
+
*,
|
|
3831
3996
|
sticker: str,
|
|
3832
3997
|
position: int,
|
|
3833
3998
|
**other: typing.Any,
|
|
@@ -3850,6 +4015,7 @@ class APIMethods:
|
|
|
3850
4015
|
|
|
3851
4016
|
async def delete_sticker_from_set(
|
|
3852
4017
|
self,
|
|
4018
|
+
*,
|
|
3853
4019
|
sticker: str,
|
|
3854
4020
|
**other: typing.Any,
|
|
3855
4021
|
) -> Result[bool, APIError]:
|
|
@@ -3869,6 +4035,7 @@ class APIMethods:
|
|
|
3869
4035
|
|
|
3870
4036
|
async def replace_sticker_in_set(
|
|
3871
4037
|
self,
|
|
4038
|
+
*,
|
|
3872
4039
|
user_id: int,
|
|
3873
4040
|
name: str,
|
|
3874
4041
|
old_sticker: str,
|
|
@@ -3900,6 +4067,7 @@ class APIMethods:
|
|
|
3900
4067
|
|
|
3901
4068
|
async def set_sticker_emoji_list(
|
|
3902
4069
|
self,
|
|
4070
|
+
*,
|
|
3903
4071
|
sticker: str,
|
|
3904
4072
|
emoji_list: list[str],
|
|
3905
4073
|
**other: typing.Any,
|
|
@@ -3923,6 +4091,7 @@ class APIMethods:
|
|
|
3923
4091
|
|
|
3924
4092
|
async def set_sticker_keywords(
|
|
3925
4093
|
self,
|
|
4094
|
+
*,
|
|
3926
4095
|
sticker: str,
|
|
3927
4096
|
keywords: list[str] | None = None,
|
|
3928
4097
|
**other: typing.Any,
|
|
@@ -3947,6 +4116,7 @@ class APIMethods:
|
|
|
3947
4116
|
|
|
3948
4117
|
async def set_sticker_mask_position(
|
|
3949
4118
|
self,
|
|
4119
|
+
*,
|
|
3950
4120
|
sticker: str,
|
|
3951
4121
|
mask_position: MaskPosition | None = None,
|
|
3952
4122
|
**other: typing.Any,
|
|
@@ -3970,6 +4140,7 @@ class APIMethods:
|
|
|
3970
4140
|
|
|
3971
4141
|
async def set_sticker_set_title(
|
|
3972
4142
|
self,
|
|
4143
|
+
*,
|
|
3973
4144
|
name: str,
|
|
3974
4145
|
title: str,
|
|
3975
4146
|
**other: typing.Any,
|
|
@@ -3992,6 +4163,7 @@ class APIMethods:
|
|
|
3992
4163
|
|
|
3993
4164
|
async def set_sticker_set_thumbnail(
|
|
3994
4165
|
self,
|
|
4166
|
+
*,
|
|
3995
4167
|
name: str,
|
|
3996
4168
|
user_id: int,
|
|
3997
4169
|
format: str,
|
|
@@ -4011,7 +4183,7 @@ class APIMethods:
|
|
|
4011
4183
|
:param thumbnail: A .WEBP or .PNG image with the thumbnail, must be up to 128 kilobytes in size \
|
|
4012
4184
|
and have a width and height of exactly 100px, or a .TGS animation with a thumbnail \
|
|
4013
4185
|
up to 32 kilobytes in size (see https://core.telegram.org/stickers#animation-requirements \
|
|
4014
|
-
for animated sticker technical requirements), or a WEBM video with the \
|
|
4186
|
+
for animated sticker technical requirements), or a .WEBM video with the \
|
|
4015
4187
|
thumbnail up to 32 kilobytes in size; see https://core.telegram.org/stickers#video-requirements \
|
|
4016
4188
|
for video sticker technical requirements. Pass a file_id as a String to \
|
|
4017
4189
|
send a file that already exists on the Telegram servers, pass an HTTP URL \
|
|
@@ -4022,7 +4194,7 @@ class APIMethods:
|
|
|
4022
4194
|
the thumbnail.
|
|
4023
4195
|
|
|
4024
4196
|
:param format: Format of the thumbnail, must be one of `static` for a .WEBP or .PNG image, \
|
|
4025
|
-
`animated` for a .TGS animation, or `video` for a WEBM video.
|
|
4197
|
+
`animated` for a .TGS animation, or `video` for a .WEBM video.
|
|
4026
4198
|
"""
|
|
4027
4199
|
|
|
4028
4200
|
method_response = await self.api.request_raw(
|
|
@@ -4033,6 +4205,7 @@ class APIMethods:
|
|
|
4033
4205
|
|
|
4034
4206
|
async def set_custom_emoji_sticker_set_thumbnail(
|
|
4035
4207
|
self,
|
|
4208
|
+
*,
|
|
4036
4209
|
name: str,
|
|
4037
4210
|
custom_emoji_id: str | None = None,
|
|
4038
4211
|
**other: typing.Any,
|
|
@@ -4056,6 +4229,7 @@ class APIMethods:
|
|
|
4056
4229
|
|
|
4057
4230
|
async def delete_sticker_set(
|
|
4058
4231
|
self,
|
|
4232
|
+
*,
|
|
4059
4233
|
name: str,
|
|
4060
4234
|
**other: typing.Any,
|
|
4061
4235
|
) -> Result[bool, APIError]:
|
|
@@ -4073,8 +4247,159 @@ class APIMethods:
|
|
|
4073
4247
|
)
|
|
4074
4248
|
return full_result(method_response, bool)
|
|
4075
4249
|
|
|
4250
|
+
async def get_available_gifts(self, **other: typing.Any) -> Result[Gifts, APIError]:
|
|
4251
|
+
"""Method `getAvailableGifts`, see the [documentation](https://core.telegram.org/bots/api#getavailablegifts)
|
|
4252
|
+
|
|
4253
|
+
Returns the list of gifts that can be sent by the bot to users and channel chats.
|
|
4254
|
+
Requires no parameters. Returns a Gifts object.
|
|
4255
|
+
"""
|
|
4256
|
+
|
|
4257
|
+
method_response = await self.api.request_raw(
|
|
4258
|
+
"getAvailableGifts",
|
|
4259
|
+
get_params(locals()),
|
|
4260
|
+
)
|
|
4261
|
+
return full_result(method_response, Gifts)
|
|
4262
|
+
|
|
4263
|
+
async def send_gift(
|
|
4264
|
+
self,
|
|
4265
|
+
*,
|
|
4266
|
+
gift_id: str,
|
|
4267
|
+
user_id: int | None = None,
|
|
4268
|
+
chat_id: int | str | None = None,
|
|
4269
|
+
pay_for_upgrade: bool | None = None,
|
|
4270
|
+
text: str | None = None,
|
|
4271
|
+
text_parse_mode: str | None = None,
|
|
4272
|
+
text_entities: list[MessageEntity] | None = None,
|
|
4273
|
+
**other: typing.Any,
|
|
4274
|
+
) -> Result[bool, APIError]:
|
|
4275
|
+
"""Method `sendGift`, see the [documentation](https://core.telegram.org/bots/api#sendgift)
|
|
4276
|
+
|
|
4277
|
+
Sends a gift to the given user or channel chat. The gift can't be converted
|
|
4278
|
+
to Telegram Stars by the receiver. Returns True on success.
|
|
4279
|
+
|
|
4280
|
+
:param user_id: Required if chat_id is not specified. Unique identifier of the target user \
|
|
4281
|
+
who will receive the gift.
|
|
4282
|
+
|
|
4283
|
+
:param chat_id: Required if user_id is not specified. Unique identifier for the chat or \
|
|
4284
|
+
username of the channel (in the format @channelusername) that will receive \
|
|
4285
|
+
the gift.
|
|
4286
|
+
|
|
4287
|
+
:param gift_id: Identifier of the gift.
|
|
4288
|
+
|
|
4289
|
+
:param pay_for_upgrade: Pass True to pay for the gift upgrade from the bot's balance, thereby making \
|
|
4290
|
+
the upgrade free for the receiver.
|
|
4291
|
+
|
|
4292
|
+
:param text: Text that will be shown along with the gift; 0-128 characters.
|
|
4293
|
+
|
|
4294
|
+
:param text_parse_mode: Mode for parsing entities in the text. See formatting options for more details. \
|
|
4295
|
+
Entities other than `bold`, `italic`, `underline`, `strikethrough`, \
|
|
4296
|
+
`spoiler`, and `custom_emoji` are ignored.
|
|
4297
|
+
|
|
4298
|
+
:param text_entities: A JSON-serialized list of special entities that appear in the gift text. \
|
|
4299
|
+
It can be specified instead of text_parse_mode. Entities other than `bold`, \
|
|
4300
|
+
`italic`, `underline`, `strikethrough`, `spoiler`, and `custom_emoji` \
|
|
4301
|
+
are ignored.
|
|
4302
|
+
"""
|
|
4303
|
+
|
|
4304
|
+
method_response = await self.api.request_raw(
|
|
4305
|
+
"sendGift",
|
|
4306
|
+
get_params(locals()),
|
|
4307
|
+
)
|
|
4308
|
+
return full_result(method_response, bool)
|
|
4309
|
+
|
|
4310
|
+
async def verify_user(
|
|
4311
|
+
self,
|
|
4312
|
+
*,
|
|
4313
|
+
user_id: int,
|
|
4314
|
+
custom_description: str | None = None,
|
|
4315
|
+
**other: typing.Any,
|
|
4316
|
+
) -> Result[bool, APIError]:
|
|
4317
|
+
"""Method `verifyUser`, see the [documentation](https://core.telegram.org/bots/api#verifyuser)
|
|
4318
|
+
|
|
4319
|
+
Verifies a user on behalf of the organization which is represented by the
|
|
4320
|
+
bot. Returns True on success.
|
|
4321
|
+
|
|
4322
|
+
:param user_id: Unique identifier of the target user.
|
|
4323
|
+
|
|
4324
|
+
:param custom_description: Custom description for the verification; 0-70 characters. Must be empty \
|
|
4325
|
+
if the organization isn't allowed to provide a custom verification description. \
|
|
4326
|
+
"""
|
|
4327
|
+
|
|
4328
|
+
method_response = await self.api.request_raw(
|
|
4329
|
+
"verifyUser",
|
|
4330
|
+
get_params(locals()),
|
|
4331
|
+
)
|
|
4332
|
+
return full_result(method_response, bool)
|
|
4333
|
+
|
|
4334
|
+
async def verify_chat(
|
|
4335
|
+
self,
|
|
4336
|
+
*,
|
|
4337
|
+
chat_id: int | str,
|
|
4338
|
+
custom_description: str | None = None,
|
|
4339
|
+
**other: typing.Any,
|
|
4340
|
+
) -> Result[bool, APIError]:
|
|
4341
|
+
"""Method `verifyChat`, see the [documentation](https://core.telegram.org/bots/api#verifychat)
|
|
4342
|
+
|
|
4343
|
+
Verifies a chat on behalf of the organization which is represented by the
|
|
4344
|
+
bot. Returns True on success.
|
|
4345
|
+
|
|
4346
|
+
:param chat_id: Unique identifier for the target chat or username of the target channel \
|
|
4347
|
+
(in the format @channelusername).
|
|
4348
|
+
|
|
4349
|
+
:param custom_description: Custom description for the verification; 0-70 characters. Must be empty \
|
|
4350
|
+
if the organization isn't allowed to provide a custom verification description. \
|
|
4351
|
+
"""
|
|
4352
|
+
|
|
4353
|
+
method_response = await self.api.request_raw(
|
|
4354
|
+
"verifyChat",
|
|
4355
|
+
get_params(locals()),
|
|
4356
|
+
)
|
|
4357
|
+
return full_result(method_response, bool)
|
|
4358
|
+
|
|
4359
|
+
async def remove_user_verification(
|
|
4360
|
+
self,
|
|
4361
|
+
*,
|
|
4362
|
+
user_id: int,
|
|
4363
|
+
**other: typing.Any,
|
|
4364
|
+
) -> Result[bool, APIError]:
|
|
4365
|
+
"""Method `removeUserVerification`, see the [documentation](https://core.telegram.org/bots/api#removeuserverification)
|
|
4366
|
+
|
|
4367
|
+
Removes verification from a user who is currently verified on behalf of
|
|
4368
|
+
the organization represented by the bot. Returns True on success.
|
|
4369
|
+
|
|
4370
|
+
:param user_id: Unique identifier of the target user.
|
|
4371
|
+
"""
|
|
4372
|
+
|
|
4373
|
+
method_response = await self.api.request_raw(
|
|
4374
|
+
"removeUserVerification",
|
|
4375
|
+
get_params(locals()),
|
|
4376
|
+
)
|
|
4377
|
+
return full_result(method_response, bool)
|
|
4378
|
+
|
|
4379
|
+
async def remove_chat_verification(
|
|
4380
|
+
self,
|
|
4381
|
+
*,
|
|
4382
|
+
chat_id: int | str,
|
|
4383
|
+
**other: typing.Any,
|
|
4384
|
+
) -> Result[bool, APIError]:
|
|
4385
|
+
"""Method `removeChatVerification`, see the [documentation](https://core.telegram.org/bots/api#removechatverification)
|
|
4386
|
+
|
|
4387
|
+
Removes verification from a chat that is currently verified on behalf of
|
|
4388
|
+
the organization represented by the bot. Returns True on success.
|
|
4389
|
+
|
|
4390
|
+
:param chat_id: Unique identifier for the target chat or username of the target channel \
|
|
4391
|
+
(in the format @channelusername).
|
|
4392
|
+
"""
|
|
4393
|
+
|
|
4394
|
+
method_response = await self.api.request_raw(
|
|
4395
|
+
"removeChatVerification",
|
|
4396
|
+
get_params(locals()),
|
|
4397
|
+
)
|
|
4398
|
+
return full_result(method_response, bool)
|
|
4399
|
+
|
|
4076
4400
|
async def answer_inline_query(
|
|
4077
4401
|
self,
|
|
4402
|
+
*,
|
|
4078
4403
|
inline_query_id: str,
|
|
4079
4404
|
results: list[InlineQueryResult],
|
|
4080
4405
|
cache_time: int | None = None,
|
|
@@ -4115,6 +4440,7 @@ class APIMethods:
|
|
|
4115
4440
|
|
|
4116
4441
|
async def answer_web_app_query(
|
|
4117
4442
|
self,
|
|
4443
|
+
*,
|
|
4118
4444
|
web_app_query_id: str,
|
|
4119
4445
|
result: InlineQueryResult,
|
|
4120
4446
|
**other: typing.Any,
|
|
@@ -4136,13 +4462,49 @@ class APIMethods:
|
|
|
4136
4462
|
)
|
|
4137
4463
|
return full_result(method_response, SentWebAppMessage)
|
|
4138
4464
|
|
|
4465
|
+
async def save_prepared_inline_message(
|
|
4466
|
+
self,
|
|
4467
|
+
*,
|
|
4468
|
+
user_id: int,
|
|
4469
|
+
result: InlineQueryResult,
|
|
4470
|
+
allow_user_chats: bool | None = None,
|
|
4471
|
+
allow_bot_chats: bool | None = None,
|
|
4472
|
+
allow_group_chats: bool | None = None,
|
|
4473
|
+
allow_channel_chats: bool | None = None,
|
|
4474
|
+
**other: typing.Any,
|
|
4475
|
+
) -> Result[PreparedInlineMessage, APIError]:
|
|
4476
|
+
"""Method `savePreparedInlineMessage`, see the [documentation](https://core.telegram.org/bots/api#savepreparedinlinemessage)
|
|
4477
|
+
|
|
4478
|
+
Stores a message that can be sent by a user of a Mini App. Returns a PreparedInlineMessage
|
|
4479
|
+
object.
|
|
4480
|
+
|
|
4481
|
+
:param user_id: Unique identifier of the target user that can use the prepared message. \
|
|
4482
|
+
|
|
4483
|
+
:param result: A JSON-serialized object describing the message to be sent.
|
|
4484
|
+
|
|
4485
|
+
:param allow_user_chats: Pass True if the message can be sent to private chats with users.
|
|
4486
|
+
|
|
4487
|
+
:param allow_bot_chats: Pass True if the message can be sent to private chats with bots.
|
|
4488
|
+
|
|
4489
|
+
:param allow_group_chats: Pass True if the message can be sent to group and supergroup chats.
|
|
4490
|
+
|
|
4491
|
+
:param allow_channel_chats: Pass True if the message can be sent to channel chats.
|
|
4492
|
+
"""
|
|
4493
|
+
|
|
4494
|
+
method_response = await self.api.request_raw(
|
|
4495
|
+
"savePreparedInlineMessage",
|
|
4496
|
+
get_params(locals()),
|
|
4497
|
+
)
|
|
4498
|
+
return full_result(method_response, PreparedInlineMessage)
|
|
4499
|
+
|
|
4139
4500
|
async def send_invoice(
|
|
4140
4501
|
self,
|
|
4502
|
+
*,
|
|
4141
4503
|
chat_id: int | str,
|
|
4142
4504
|
title: str,
|
|
4143
4505
|
description: str,
|
|
4144
4506
|
payload: str,
|
|
4145
|
-
currency:
|
|
4507
|
+
currency: Currency,
|
|
4146
4508
|
prices: list[LabeledPrice],
|
|
4147
4509
|
message_thread_id: int | None = None,
|
|
4148
4510
|
provider_token: str | None = None,
|
|
@@ -4163,6 +4525,7 @@ class APIMethods:
|
|
|
4163
4525
|
is_flexible: bool | None = None,
|
|
4164
4526
|
disable_notification: bool | None = None,
|
|
4165
4527
|
protect_content: bool | None = None,
|
|
4528
|
+
allow_paid_broadcast: bool | None = None,
|
|
4166
4529
|
message_effect_id: str | None = None,
|
|
4167
4530
|
reply_parameters: ReplyParameters | None = None,
|
|
4168
4531
|
reply_markup: InlineKeyboardMarkup | None = None,
|
|
@@ -4252,6 +4615,10 @@ class APIMethods:
|
|
|
4252
4615
|
|
|
4253
4616
|
:param protect_content: Protects the contents of the sent message from forwarding and saving.
|
|
4254
4617
|
|
|
4618
|
+
:param allow_paid_broadcast: Pass True to allow up to 1000 messages per second, ignoring broadcasting \
|
|
4619
|
+
limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will \
|
|
4620
|
+
be withdrawn from the bot's balance.
|
|
4621
|
+
|
|
4255
4622
|
:param message_effect_id: Unique identifier of the message effect to be added to the message; for private \
|
|
4256
4623
|
chats only.
|
|
4257
4624
|
|
|
@@ -4269,12 +4636,15 @@ class APIMethods:
|
|
|
4269
4636
|
|
|
4270
4637
|
async def create_invoice_link(
|
|
4271
4638
|
self,
|
|
4639
|
+
*,
|
|
4272
4640
|
title: str,
|
|
4273
4641
|
description: str,
|
|
4274
4642
|
payload: str,
|
|
4275
|
-
currency:
|
|
4643
|
+
currency: Currency,
|
|
4276
4644
|
prices: list[LabeledPrice],
|
|
4645
|
+
business_connection_id: str | None = None,
|
|
4277
4646
|
provider_token: str | None = None,
|
|
4647
|
+
subscription_period: int | None = None,
|
|
4278
4648
|
max_tip_amount: int | None = None,
|
|
4279
4649
|
suggested_tip_amounts: list[int] | None = None,
|
|
4280
4650
|
provider_data: str | None = None,
|
|
@@ -4296,6 +4666,9 @@ class APIMethods:
|
|
|
4296
4666
|
Use this method to create a link for an invoice. Returns the created invoice
|
|
4297
4667
|
link as String on success.
|
|
4298
4668
|
|
|
4669
|
+
:param business_connection_id: Unique identifier of the business connection on behalf of which the link \
|
|
4670
|
+
will be created. For payments in Telegram Stars only.
|
|
4671
|
+
|
|
4299
4672
|
:param title: Product name, 1-32 characters.
|
|
4300
4673
|
|
|
4301
4674
|
:param description: Product description, 1-255 characters.
|
|
@@ -4313,6 +4686,13 @@ class APIMethods:
|
|
|
4313
4686
|
tax, discount, delivery cost, delivery tax, bonus, etc.). Must contain \
|
|
4314
4687
|
exactly one item for payments in Telegram Stars.
|
|
4315
4688
|
|
|
4689
|
+
:param subscription_period: The number of seconds the subscription will be active for before the next \
|
|
4690
|
+
payment. The currency must be set to `XTR` (Telegram Stars) if the parameter \
|
|
4691
|
+
is used. Currently, it must always be 2592000 (30 days) if specified. Any \
|
|
4692
|
+
number of subscriptions can be active for a given bot at the same time, including \
|
|
4693
|
+
multiple concurrent subscriptions from the same user. Subscription price \
|
|
4694
|
+
must no exceed 2500 Telegram Stars.
|
|
4695
|
+
|
|
4316
4696
|
:param max_tip_amount: The maximum accepted amount for tips in the smallest units of the currency \
|
|
4317
4697
|
(integer, not float/double). For example, for a maximum tip of US$ 1.45 \
|
|
4318
4698
|
pass max_tip_amount = 145. See the exp parameter in currencies.json, it \
|
|
@@ -4368,6 +4748,7 @@ class APIMethods:
|
|
|
4368
4748
|
|
|
4369
4749
|
async def answer_shipping_query(
|
|
4370
4750
|
self,
|
|
4751
|
+
*,
|
|
4371
4752
|
shipping_query_id: str,
|
|
4372
4753
|
ok: bool,
|
|
4373
4754
|
shipping_options: list[ShippingOption] | None = None,
|
|
@@ -4391,7 +4772,7 @@ class APIMethods:
|
|
|
4391
4772
|
|
|
4392
4773
|
:param error_message: Required if ok is False. Error message in human readable form that explains \
|
|
4393
4774
|
why it is impossible to complete the order (e.g. `Sorry, delivery to your \
|
|
4394
|
-
desired address is unavailable
|
|
4775
|
+
desired address is unavailable`). Telegram will display this message \
|
|
4395
4776
|
to the user.
|
|
4396
4777
|
"""
|
|
4397
4778
|
|
|
@@ -4403,6 +4784,7 @@ class APIMethods:
|
|
|
4403
4784
|
|
|
4404
4785
|
async def answer_pre_checkout_query(
|
|
4405
4786
|
self,
|
|
4787
|
+
*,
|
|
4406
4788
|
pre_checkout_query_id: str,
|
|
4407
4789
|
ok: bool,
|
|
4408
4790
|
error_message: str | None = None,
|
|
@@ -4436,6 +4818,7 @@ class APIMethods:
|
|
|
4436
4818
|
|
|
4437
4819
|
async def get_star_transactions(
|
|
4438
4820
|
self,
|
|
4821
|
+
*,
|
|
4439
4822
|
offset: int | None = None,
|
|
4440
4823
|
limit: int | None = None,
|
|
4441
4824
|
**other: typing.Any,
|
|
@@ -4459,6 +4842,7 @@ class APIMethods:
|
|
|
4459
4842
|
|
|
4460
4843
|
async def refund_star_payment(
|
|
4461
4844
|
self,
|
|
4845
|
+
*,
|
|
4462
4846
|
user_id: int,
|
|
4463
4847
|
telegram_payment_charge_id: str,
|
|
4464
4848
|
**other: typing.Any,
|
|
@@ -4478,8 +4862,38 @@ class APIMethods:
|
|
|
4478
4862
|
)
|
|
4479
4863
|
return full_result(method_response, bool)
|
|
4480
4864
|
|
|
4865
|
+
async def edit_user_star_subscription(
|
|
4866
|
+
self,
|
|
4867
|
+
*,
|
|
4868
|
+
user_id: int,
|
|
4869
|
+
telegram_payment_charge_id: str,
|
|
4870
|
+
is_canceled: bool,
|
|
4871
|
+
**other: typing.Any,
|
|
4872
|
+
) -> Result[bool, APIError]:
|
|
4873
|
+
"""Method `editUserStarSubscription`, see the [documentation](https://core.telegram.org/bots/api#edituserstarsubscription)
|
|
4874
|
+
|
|
4875
|
+
Allows the bot to cancel or re-enable extension of a subscription paid in
|
|
4876
|
+
Telegram Stars. Returns True on success.
|
|
4877
|
+
|
|
4878
|
+
:param user_id: Identifier of the user whose subscription will be edited.
|
|
4879
|
+
|
|
4880
|
+
:param telegram_payment_charge_id: Telegram payment identifier for the subscription.
|
|
4881
|
+
|
|
4882
|
+
:param is_canceled: Pass True to cancel extension of the user subscription; the subscription \
|
|
4883
|
+
must be active up to the end of the current subscription period. Pass False \
|
|
4884
|
+
to allow the user to re-enable a subscription that was previously canceled \
|
|
4885
|
+
by the bot.
|
|
4886
|
+
"""
|
|
4887
|
+
|
|
4888
|
+
method_response = await self.api.request_raw(
|
|
4889
|
+
"editUserStarSubscription",
|
|
4890
|
+
get_params(locals()),
|
|
4891
|
+
)
|
|
4892
|
+
return full_result(method_response, bool)
|
|
4893
|
+
|
|
4481
4894
|
async def set_passport_data_errors(
|
|
4482
4895
|
self,
|
|
4896
|
+
*,
|
|
4483
4897
|
user_id: int,
|
|
4484
4898
|
errors: list[PassportElementError],
|
|
4485
4899
|
**other: typing.Any,
|
|
@@ -4508,12 +4922,14 @@ class APIMethods:
|
|
|
4508
4922
|
|
|
4509
4923
|
async def send_game(
|
|
4510
4924
|
self,
|
|
4925
|
+
*,
|
|
4511
4926
|
chat_id: int,
|
|
4512
4927
|
game_short_name: str,
|
|
4513
4928
|
business_connection_id: str | None = None,
|
|
4514
4929
|
message_thread_id: int | None = None,
|
|
4515
4930
|
disable_notification: bool | None = None,
|
|
4516
4931
|
protect_content: bool | None = None,
|
|
4932
|
+
allow_paid_broadcast: bool | None = None,
|
|
4517
4933
|
message_effect_id: str | None = None,
|
|
4518
4934
|
reply_parameters: ReplyParameters | None = None,
|
|
4519
4935
|
reply_markup: InlineKeyboardMarkup | None = None,
|
|
@@ -4538,6 +4954,10 @@ class APIMethods:
|
|
|
4538
4954
|
|
|
4539
4955
|
:param protect_content: Protects the contents of the sent message from forwarding and saving.
|
|
4540
4956
|
|
|
4957
|
+
:param allow_paid_broadcast: Pass True to allow up to 1000 messages per second, ignoring broadcasting \
|
|
4958
|
+
limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will \
|
|
4959
|
+
be withdrawn from the bot's balance.
|
|
4960
|
+
|
|
4541
4961
|
:param message_effect_id: Unique identifier of the message effect to be added to the message; for private \
|
|
4542
4962
|
chats only.
|
|
4543
4963
|
|
|
@@ -4555,6 +4975,7 @@ class APIMethods:
|
|
|
4555
4975
|
|
|
4556
4976
|
async def set_game_score(
|
|
4557
4977
|
self,
|
|
4978
|
+
*,
|
|
4558
4979
|
user_id: int,
|
|
4559
4980
|
score: int,
|
|
4560
4981
|
force: bool | None = None,
|
|
@@ -4599,6 +5020,7 @@ class APIMethods:
|
|
|
4599
5020
|
|
|
4600
5021
|
async def get_game_high_scores(
|
|
4601
5022
|
self,
|
|
5023
|
+
*,
|
|
4602
5024
|
user_id: int,
|
|
4603
5025
|
chat_id: int | None = None,
|
|
4604
5026
|
message_id: int | None = None,
|